/* =========================
   BUTTONS
========================= */

:root {
  --z-floating: 60;
  --z-toast: 70;
  --z-overlay: 300;
  --floating-bottom-offset: calc(var(--bottom-nav-h, 56px) + var(--safe-bottom, env(safe-area-inset-bottom, 0px)) + 0.9rem);
  --floating-bottom-offset-avoid-sparkle: calc(var(--floating-bottom-offset) + 4.25rem);
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 1.25rem;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.78rem 1.05rem;
  border-radius: 999px;
  font-size: 0.93rem;
  font-weight: 800;
  transition: transform 0.2s ease, background 0.2s ease, box-shadow 0.2s ease, color 0.2s ease;
  position: relative;
  overflow: hidden;
}

.btn::after {
  content: "";
  position: absolute;
  inset: 0;
  background: rgba(255, 255, 255, 0);
  transition: background 0.2s ease;
  border-radius: inherit;
}

.btn:hover {
  transform: translateY(-2px);
}

.btn:hover::after {
  background: rgba(255, 255, 255, 0.08);
}

.btn:active {
  transform: translateY(0px);
}

.btn-primary {
  color: #fff;
  background: var(--primary);
  box-shadow: var(--shadow-medium);
}

.btn-primary:hover {
  background: var(--primary-dark);
  box-shadow: var(--shadow-strong);
}

.btn-secondary {
  background: var(--paper);
  border: 1px solid var(--line-strong);
  color: var(--ink);
}

.btn-secondary:hover {
  background: var(--paper-soft);
}

.text-link {
  display: inline-block;
  margin-top: 0.85rem;
  font-weight: 800;
  color: var(--primary);
}

/* =========================
   GENERIC CARDS / BLOCKS
========================= */

.metric-card,
.editorial-card,
.audience-card,
.note-card,
.value-card,
.content-block {
  padding: 1.05rem;
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.82);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid rgba(79, 70, 229, 0.10);
  box-shadow: 0 4px 20px rgba(79, 70, 229, 0.07), 0 1px 4px rgba(79, 70, 229, 0.04);
  transition: background 0.35s ease, border-color 0.35s ease, box-shadow 0.35s ease, transform 0.2s ease;
}


.metric-card:hover,
.editorial-card:hover,
.audience-card:hover,
.note-card:hover,
.value-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 10px 32px rgba(79, 70, 229, 0.12), 0 2px 6px rgba(79, 70, 229, 0.06);
  border-color: rgba(79, 70, 229, 0.18);
}

.metric-card p,
.editorial-card p,
.audience-card p,
.note-card p,
.value-card p,
.content-block p,
.section-heading p,
.prose-block p,
.footer-text {
  color: var(--muted);
  transition: color 0.35s ease;
}

.audience-grid,
.value-grid,
.cards-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.95rem;
}

.cards-grid-2 {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.cards-grid-3 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.section-heading {
  margin-bottom: 1rem;
}

.center-heading {
  text-align: center;
  margin-bottom: 1.4rem;
}

/* =========================
   HOMEPAGE
========================= */

.hero {
  position: relative;
  overflow: hidden;
  padding-top: 5.5rem;
  padding-bottom: 4.5rem;
}

.hero-noise {
  position: absolute;
  inset: 0;
  opacity: 0.2;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(255,255,255,0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.03) 1px, transparent 1px);
  background-size: 22px 22px;
}

.hero-orb {
  position: absolute;
  border-radius: 999px;
  filter: blur(70px);
  opacity: 0.45;
  pointer-events: none;
}

.hero-orb-a {
  width: 360px;
  height: 360px;
  top: -100px;
  left: -90px;
  background: rgba(99, 102, 241, 0.22);
  animation: orbFloat 8s ease-in-out infinite;
}

.hero-orb-b {
  width: 300px;
  height: 300px;
  top: 5px;
  right: -90px;
  background: rgba(6, 182, 212, 0.18);
  animation: orbFloat 10s ease-in-out infinite reverse;
}

@keyframes orbFloat {
  0%, 100% { transform: translate(0, 0) scale(1); }
  33% { transform: translate(12px, -16px) scale(1.04); }
  66% { transform: translate(-8px, 10px) scale(0.97); }
}

.hero-grid,
.metrics-grid,
.editorial-grid,
.current-focus-card {
  position: relative;
  z-index: 1;
}

.hero-grid {
  display: grid;
  grid-template-columns: 1.08fr 0.92fr;
  gap: 1.6rem;
  align-items: center;
}

/* Hero copy entrance animation */
.js-enhanced .hero-copy > * {
  opacity: 0;
  transform: translateY(24px);
  animation: heroEntrance 0.65s ease forwards;
}

.js-enhanced .hero-copy > *:nth-child(1) { animation-delay: 0.05s; }
.js-enhanced .hero-copy > *:nth-child(2) { animation-delay: 0.12s; }
.js-enhanced .hero-copy > *:nth-child(3) { animation-delay: 0.2s; }
.js-enhanced .hero-copy > *:nth-child(4) { animation-delay: 0.28s; }
.js-enhanced .hero-copy > *:nth-child(5) { animation-delay: 0.36s; }
.js-enhanced .hero-copy > *:nth-child(6) { animation-delay: 0.44s; }

.js-enhanced .hero-panel-wrap {
  opacity: 0;
  transform: translateY(20px) scale(0.97);
  animation: heroEntrance 0.7s ease 0.3s forwards;
}

@keyframes heroEntrance {
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.hero-proof-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  margin-top: 1rem;
}

.proof-pill {
  padding: 0.45rem 0.68rem;
  border-radius: 999px;
  background: rgba(240, 241, 255, 0.80);
  border: 1px solid rgba(99, 102, 241, 0.14);
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
  transition: background 0.35s ease, border-color 0.35s ease, transform 0.2s ease;
}


.proof-pill:hover {
  transform: translateY(-1px);
}

.hero-panel-wrap {
  position: relative;
}

.hero-panel-back {
  position: absolute;
  inset: 18px -10px -12px 26px;
  border-radius: 26px;
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.22), rgba(6, 182, 212, 0.18), rgba(139, 92, 246, 0.18));
  filter: blur(18px);
  transition: opacity 0.35s ease;
}

.hero-panel {
  position: relative;
  padding: 1.1rem;
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.88);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(99, 102, 241, 0.14);
  box-shadow: var(--shadow-strong);
  transition: background 0.35s ease, border-color 0.35s ease;
}


.hero-panel-top {
  display: flex;
  gap: 0.4rem;
  margin-bottom: 0.8rem;
}

.hero-panel-top span {
  width: 9px;
  height: 9px;
  border-radius: 999px;
  background: #d3dbe4;
  transition: background 0.35s ease;
}


.preview-reading-card {
  padding: 0.9rem;
  border-radius: 16px;
  background: var(--paper-warm);
  border: 1px solid rgba(92, 110, 132, 0.12);
  transition: background 0.35s ease;
}

.preview-question {
  margin: 0 0 0.5rem;
  font-weight: 800;
}

.preview-answer {
  margin: 0;
  font-size: 0.95rem;
  color: var(--muted);
}

.preview-mini-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.55rem;
  margin-top: 0.8rem;
}

.preview-mini-grid span {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: 0.45rem;
  text-align: center;
  border-radius: 14px;
  background: var(--paper);
  border: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 700;
  transition: background 0.35s ease, border-color 0.35s ease, transform 0.2s ease;
}

.preview-mini-grid span:hover {
  transform: translateY(-1px);
}

.metrics-section {
  padding-top: 0;
}

.metrics-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.95rem;
}

.metric-number {
  margin: 0 0 0.55rem;
  font-size: 0.8rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  color: var(--primary);
}

.editorial-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  align-items: start;
}

.editorial-cards {
  display: grid;
  gap: 0.8rem;
}

.current-focus-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.35rem;
  border-radius: 24px;
  background: linear-gradient(135deg, rgba(255,253,248,0.96), rgba(245,239,228,0.96));
  border: 1px solid rgba(92,110,132,0.12);
  box-shadow: var(--shadow-medium);
  transition: background 0.35s ease, border-color 0.35s ease;
}


.homepage-hero .hero-copy .paper-label {
  margin-bottom: 0.8rem;
}

.paper-preview-panel {
  background: rgba(255, 253, 248, 0.94);
}

.preview-subtopic {
  margin: -0.1rem 0 0.9rem;
  color: var(--muted);
  font-weight: 700;
}

.preview-chip-list {
  margin-top: 0.9rem;
}

.homepage-focus-section .paper-board {
  background: linear-gradient(135deg, #fffdf8, #f7f0e1);
}


/* =========================
   NOTE / PAGE HERO
========================= */

.page-hero {
  padding-top: 4.4rem;
  padding-bottom: 1.6rem;
}

.note-hero {
  padding-bottom: 1.8rem;
}

.note-section {
  padding-top: 0.5rem;
}

.note-subsection {
  margin-top: 1.8rem;
}

.papercraft-hero {
  position: relative;
}

/* =========================
   SEARCH
========================= */

.search-wrap {
  position: relative;
  margin-bottom: 1.5rem;
}

.search-input {
  width: 100%;
  padding: 0.9rem 1rem 0.9rem 3rem;
  border-radius: 18px;
  border: 1.5px solid var(--line-strong);
  background: var(--paper);
  color: var(--ink);
  font-size: 0.97rem;
  font-weight: 600;
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.35s ease;
  box-shadow: var(--shadow-soft);
}

.search-input::placeholder {
  color: var(--muted);
  opacity: 0.7;
}

.search-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(47, 122, 103, 0.12), var(--shadow-soft);
}

.search-icon {
  position: absolute;
  left: 1rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
  font-size: 1.05rem;
  pointer-events: none;
  transition: color 0.2s ease;
}

.search-input:focus ~ .search-icon,
.search-wrap:focus-within .search-icon {
  color: var(--primary);
}

.search-results {
  display: none;
  margin-top: 0.5rem;
}

.search-results.has-results {
  display: block;
  animation: fadeSlide 0.3s ease;
}

.search-result-count {
  margin: 0 0 0.75rem;
  font-size: 0.82rem;
  font-weight: 800;
  color: var(--muted);
  letter-spacing: 0.04em;
}

.search-result-item {
  display: block;
  padding: 0.9rem 1rem;
  border-radius: 16px;
  background: var(--paper);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-soft);
  margin-bottom: 0.55rem;
  transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.35s ease, border-color 0.35s ease;
  cursor: pointer;
  text-decoration: none;
  color: inherit;
}

.search-result-item:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-medium);
  border-color: rgba(47, 122, 103, 0.22);
}

.search-result-tag {
  display: inline-block;
  margin-bottom: 0.3rem;
  padding: 0.2rem 0.5rem;
  border-radius: 8px;
  background: #dfeedd;
  color: #315649;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  transition: background 0.35s ease;
}


.search-result-title {
  margin: 0 0 0.2rem;
  font-size: 0.96rem;
  font-weight: 800;
  color: var(--ink);
  line-height: 1.3;
}

.search-result-excerpt {
  margin: 0;
  font-size: 0.86rem;
  color: var(--muted);
  line-height: 1.5;
}

.search-result-excerpt mark {
  background: rgba(47, 122, 103, 0.18);
  color: var(--primary);
  border-radius: 3px;
  padding: 0 0.1em;
  font-weight: 700;
}


.search-empty {
  display: none;
  padding: 1.5rem;
  text-align: center;
  border-radius: 18px;
  background: var(--paper);
  border: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.92rem;
  font-weight: 700;
}

.search-empty.visible {
  display: block;
  animation: fadeSlide 0.3s ease;
}

/* =========================
   ORG CHART
========================= */

.org-chart { display: flex; flex-direction: column; align-items: center; gap: 0.45rem; text-align: center; }
.org-level { display: flex; justify-content: center; gap: 0.8rem; flex-wrap: wrap; width: 100%; }
.org-level-1, .org-level-2 { max-width: 320px; }
.org-level-3 { max-width: 920px; }

.org-node {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 54px; padding: 0.85rem 1rem; border-radius: 18px;
  background: rgba(255, 253, 248, 0.85); border: 1px solid rgba(92, 110, 132, 0.1);
  box-shadow: var(--shadow-soft); font-weight: 700; line-height: 1.35;
  transition: background 0.35s ease, transform 0.2s ease;
}

.org-node:hover { transform: translateY(-2px); }
.org-arrow { font-size: 1.35rem; line-height: 1; }

/* =========================
   INTERACTION
========================= */

.interactive-toggle {
  margin-top: 0.55rem; padding: 0.72rem 0.95rem; border: none;
  border-radius: 12px; background: var(--primary); color: #fff;
  font-size: 0.9rem; font-weight: 800; cursor: pointer;
  transition: transform 0.2s ease, background 0.2s ease;
}

.interactive-toggle:hover { transform: translateY(-1px); background: var(--primary-dark); }
.interactive-hidden { display: none; }
.interactive-hidden.show { display: block; animation: fadeSlide 0.35s ease; }

.reveal-on-scroll { opacity: 1; transform: none; }

.js-enhanced .reveal-on-scroll {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.55s ease, transform 0.55s ease;
}

.js-enhanced .reveal-on-scroll.visible {
  opacity: 1;
  transform: translateY(0);
}

/* Staggered children */
.js-enhanced .reveal-on-scroll.visible > .paper-chip:nth-child(1) { transition-delay: 0.05s; }
.js-enhanced .reveal-on-scroll.visible > .paper-chip:nth-child(2) { transition-delay: 0.1s; }
.js-enhanced .reveal-on-scroll.visible > .paper-chip:nth-child(3) { transition-delay: 0.15s; }
.js-enhanced .reveal-on-scroll.visible > .paper-chip:nth-child(4) { transition-delay: 0.2s; }
.js-enhanced .reveal-on-scroll.visible > .paper-chip:nth-child(5) { transition-delay: 0.25s; }

/* =========================================
   ILLUSTRATION COMPONENTS
========================================= */

.illustration-stack {
  display: grid;
  gap: 1.2rem;
}

.feature-illustration-card,
.inline-illustration-card {
  background: var(--surface, #fffdf8);
  border: 1px solid rgba(92, 110, 132, 0.14);
  border-radius: 24px;
  box-shadow: 0 12px 28px rgba(36, 49, 63, 0.08);
  overflow: hidden;
}

.feature-illustration-card {
  padding: 1rem;
}

.feature-illustration-head,
.inline-illustration-head {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  margin-bottom: 0.85rem;
}

.feature-illustration-badge,
.inline-illustration-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2rem;
  height: 2rem;
  padding: 0 0.55rem;
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 800;
  background: rgba(211, 170, 78, 0.14);
  color: #7d5f1f;
}

.feature-illustration-title,
.inline-illustration-title {
  margin: 0;
  font-size: 1rem;
  font-weight: 800;
  line-height: 1.3;
  color: var(--text-strong, #24313f);
}

.feature-illustration-figure,
.inline-illustration-figure {
  margin: 0;
}

.feature-illustration-media,
.inline-illustration-media {
  width: 100%;
  display: block;
  border-radius: 18px;
  background: linear-gradient(180deg, rgba(236, 227, 211, 0.75), rgba(248, 244, 236, 0.95));
  border: 1px solid rgba(92, 110, 132, 0.1);
  object-fit: cover;
}

.feature-illustration-media {
  aspect-ratio: 16 / 10;
}

.inline-illustration-media {
  aspect-ratio: 4 / 3;
}

.feature-illustration-caption,
.inline-illustration-caption {
  margin-top: 0.8rem;
  font-size: 0.96rem;
  line-height: 1.6;
  color: var(--text-soft, #5d6a79);
}

.feature-illustration-notes {
  margin-top: 0.95rem;
  display: grid;
  gap: 0.65rem;
}

.feature-illustration-note {
  display: flex;
  gap: 0.7rem;
  align-items: flex-start;
  padding: 0.8rem 0.9rem;
  border-radius: 16px;
  background: rgba(92, 110, 132, 0.06);
}

.feature-illustration-note-icon {
  flex: 0 0 auto;
  font-size: 1rem;
  line-height: 1.2;
}

.feature-illustration-note-text {
  font-size: 0.93rem;
  line-height: 1.55;
  color: var(--text-soft, #5d6a79);
}

.inline-illustration-card {
  padding: 0.85rem;
}

.inline-illustration-card.compact {
  max-width: 420px;
}

.inline-illustration-wrap-right {
  display: grid;
  gap: 1rem;
}

.inline-illustration-wrap-left {
  display: grid;
  gap: 1rem;
}

.illustration-placeholder {
  position: relative;
  overflow: hidden;
}

.illustration-placeholder::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 20% 20%, rgba(211, 170, 78, 0.18), transparent 30%),
    radial-gradient(circle at 80% 25%, rgba(47, 122, 103, 0.14), transparent 28%),
    radial-gradient(circle at 50% 80%, rgba(92, 110, 132, 0.12), transparent 30%);
  pointer-events: none;
}

.illustration-placeholder-label {
  position: absolute;
  left: 14px;
  bottom: 14px;
  z-index: 1;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.45rem 0.75rem;
  border-radius: 999px;
  background: rgba(255, 253, 248, 0.88);
  border: 1px solid rgba(92, 110, 132, 0.12);
  font-size: 0.78rem;
  font-weight: 800;
  color: #5d6a79;
}

@media (min-width: 900px) {
  .inline-illustration-wrap-right {
    grid-template-columns: minmax(0, 1fr) 320px;
    align-items: start;
  }

  .inline-illustration-wrap-left {
    grid-template-columns: 320px minmax(0, 1fr);
    align-items: start;
  }

  .inline-illustration-wrap-right .inline-illustration-card {
    grid-column: 2;
  }

  .inline-illustration-wrap-right > :not(.inline-illustration-card) {
    grid-column: 1;
  }

  .inline-illustration-wrap-left .inline-illustration-card {
    grid-column: 1;
  }

  .inline-illustration-wrap-left > :not(.inline-illustration-card) {
    grid-column: 2;
  }
}

@media (max-width: 760px) {
  .feature-illustration-card,
  .inline-illustration-card {
    border-radius: 20px;
  }

  .feature-illustration-card {
    padding: 0.85rem;
  }

  .inline-illustration-card {
    padding: 0.75rem;
  }

  .feature-illustration-title,
  .inline-illustration-title {
    font-size: 0.96rem;
  }

  .feature-illustration-caption,
  .inline-illustration-caption,
  .feature-illustration-note-text {
    font-size: 0.9rem;
  }
}

/* Dark mode */
[data-theme="dark"] .feature-illustration-card,
[data-theme="dark"] .inline-illustration-card {
  background: rgba(36, 34, 32, 0.96);
  border-color: rgba(220, 210, 190, 0.1);
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.28);
}

[data-theme="dark"] .feature-illustration-badge,
[data-theme="dark"] .inline-illustration-badge {
  background: rgba(211, 170, 78, 0.16);
  color: #e5c980;
}

[data-theme="dark"] .feature-illustration-title,
[data-theme="dark"] .inline-illustration-title {
  color: #ece6d8;
}

[data-theme="dark"] .feature-illustration-caption,
[data-theme="dark"] .inline-illustration-caption,
[data-theme="dark"] .feature-illustration-note-text,
[data-theme="dark"] .illustration-placeholder-label {
  color: #b8af9f;
}

[data-theme="dark"] .feature-illustration-media,
[data-theme="dark"] .inline-illustration-media {
  border-color: rgba(220, 210, 190, 0.08);
  background: linear-gradient(180deg, rgba(57, 52, 48, 0.85), rgba(43, 39, 36, 0.98));
}

[data-theme="dark"] .feature-illustration-note {
  background: rgba(220, 210, 190, 0.06);
}

[data-theme="dark"] .illustration-placeholder-label {
  background: rgba(36, 34, 32, 0.86);
  border-color: rgba(220, 210, 190, 0.1);
}

/* =========================================
   COMIC SCENE ILLUSTRATIONS
========================================= */

.comic-scene {
  position: relative;
  overflow: hidden;
  border-radius: 18px;
  background:
    linear-gradient(180deg, rgba(250, 245, 236, 0.98), rgba(244, 237, 225, 0.98));
}

.comic-scene::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 16% 18%, rgba(211, 170, 78, 0.14), transparent 22%),
    radial-gradient(circle at 84% 22%, rgba(47, 122, 103, 0.12), transparent 20%),
    radial-gradient(circle at 50% 78%, rgba(92, 110, 132, 0.08), transparent 24%);
  pointer-events: none;
}

.comic-scene-stage {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  padding: 1.1rem 1.1rem 1.35rem;
  z-index: 1;
}

.comic-scene-ground {
  position: absolute;
  left: 8%;
  right: 8%;
  bottom: 16%;
  height: 2px;
  background: rgba(92, 110, 132, 0.12);
  z-index: 0;
}

.comic-scene-badge {
  position: absolute;
  z-index: 2;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.38rem 0.7rem;
  border-radius: 999px;
  background: rgba(255, 253, 248, 0.92);
  border: 1px solid rgba(92, 110, 132, 0.1);
  font-size: 0.74rem;
  font-weight: 800;
  color: #5d6a79;
  box-shadow: 0 8px 18px rgba(36, 49, 63, 0.06);
}

.comic-badge-top-left { top: 14px; left: 14px; }
.comic-badge-top-right { top: 14px; right: 14px; }
.comic-badge-bottom-left { bottom: 14px; left: 14px; }
.comic-badge-bottom-right { bottom: 14px; right: 14px; }

.comic-scene-center {
  position: absolute;
  left: 50%;
  top: 43%;
  transform: translate(-50%, -50%);
  z-index: 2;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 86px;
  height: 76px;
  padding: 0 1rem;
  border-radius: 24px;
  background: rgba(255, 253, 248, 0.9);
  border: 1px solid rgba(92, 110, 132, 0.12);
  font-size: 0.9rem;
  font-weight: 800;
  color: #5d6a79;
  text-align: center;
  line-height: 1.2;
  box-shadow: 0 10px 24px rgba(36, 49, 63, 0.08);
}

.comic-figure {
  width: 22%;
  min-width: 56px;
  max-width: 124px;
  aspect-ratio: 3 / 4;
  border-radius: 999px 999px 18px 18px;
  position: relative;
  box-shadow: inset 0 0 0 1px rgba(92, 110, 132, 0.06);
}

.comic-figure::before {
  content: "";
  position: absolute;
  top: -16%;
  left: 50%;
  transform: translateX(-50%);
  width: 48%;
  aspect-ratio: 1;
  border-radius: 999px;
}

.comic-figure-ruler,
.comic-figure-ruler::before {
  background: rgba(211, 170, 78, 0.24);
}

.comic-figure-people,
.comic-figure-people::before {
  background: rgba(47, 122, 103, 0.16);
}

.comic-figure-neutral,
.comic-figure-neutral::before {
  background: rgba(92, 110, 132, 0.16);
}

.comic-figure-group {
  display: flex;
  align-items: flex-end;
  gap: 0.7rem;
}

.comic-scene-note {
  position: absolute;
  left: 50%;
  bottom: 12px;
  transform: translateX(-50%);
  z-index: 3;
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.44rem 0.82rem;
  border-radius: 999px;
  background: rgba(255, 253, 248, 0.94);
  border: 1px solid rgba(92, 110, 132, 0.1);
  font-size: 0.76rem;
  font-weight: 800;
  color: #5d6a79;
}

[data-theme="dark"] .comic-scene {
  background:
    linear-gradient(180deg, rgba(51, 46, 42, 0.98), rgba(41, 37, 34, 0.98));
}

[data-theme="dark"] .comic-scene-badge,
[data-theme="dark"] .comic-scene-center,
[data-theme="dark"] .comic-scene-note {
  background: rgba(36, 34, 32, 0.9);
  border-color: rgba(220, 210, 190, 0.1);
  color: #b8af9f;
}

[data-theme="dark"] .comic-figure-neutral,
[data-theme="dark"] .comic-figure-neutral::before {
  background: rgba(220, 210, 190, 0.14);
}

[data-theme="dark"] .comic-figure-ruler,
[data-theme="dark"] .comic-figure-ruler::before {
  background: rgba(211, 170, 78, 0.18);
}

[data-theme="dark"] .comic-figure-people,
[data-theme="dark"] .comic-figure-people::before {
  background: rgba(104, 182, 157, 0.14);
}

[data-theme="dark"] .comic-scene-ground {
  background: rgba(220, 210, 190, 0.1);
}

/* =========================
   NOTE LEARNING ENTRY
========================= */
.note-learning-entry {
  margin-top: 1rem;
}

.note-learning-entry .paper-board {
  padding: 1rem 1rem 1.05rem;
}

.note-learning-entry .point-line {
  margin-bottom: 0.85rem;
}

.note-learning-entry .hero-actions {
  justify-content: flex-start;
}

/* =========================
   SPARKLE MENU (NOTE PAGES) — draggable corner FAB
========================= */

/* Base: default bottom-right; .fab-corner-* classes override */
.note-sparkle-wrap {
  position: fixed;
  right: 14px; bottom: 18px; left: auto; top: auto;
  z-index: var(--z-floating);
  display: flex; flex-direction: column;
  align-items: flex-end; gap: 0.52rem;
  user-select: none; touch-action: none;
}

/* ── Corner Classes ──────────────────────────────────────────────────── */
.note-sparkle-wrap.fab-corner-br {
  right: 14px; bottom: 18px; left: auto; top: auto;
  flex-direction: column; align-items: flex-end;
}
.note-sparkle-wrap.fab-corner-bl {
  left: 14px; bottom: 18px; right: auto; top: auto;
  flex-direction: column; align-items: flex-start;
}
.note-sparkle-wrap.fab-corner-tr {
  right: 14px; top: 80px; left: auto; bottom: auto;
  flex-direction: column-reverse; align-items: flex-end;
}
.note-sparkle-wrap.fab-corner-tl {
  left: 14px; top: 80px; right: auto; bottom: auto;
  flex-direction: column-reverse; align-items: flex-start;
}

/* Mobile: lift bottom corners above bottom nav */
@media (max-width: 760px) {
  .note-sparkle-wrap.fab-corner-br,
  .note-sparkle-wrap.fab-corner-bl {
    bottom: var(--floating-bottom-offset);
  }
}

/* ── Drag State ──────────────────────────────────────────────────────── */
.note-sparkle-wrap.is-dragging,
.note-sparkle-wrap.is-dragging * { transition: none !important; }
.note-sparkle-fab { cursor: grab; }
.note-sparkle-wrap.is-dragging .note-sparkle-fab { cursor: grabbing; }

/* ── FAB Button ──────────────────────────────────────────────────────── */
.note-sparkle-fab {
  width: 52px; height: 52px;
  border-radius: 50%; border: none;
  font-size: 1.15rem;
  color: #fff;
  background: linear-gradient(135deg, #6d63ff, #a78bfa);
  box-shadow: 0 8px 24px rgba(109, 99, 255, 0.32), 0 2px 8px rgba(109, 99, 255, 0.18);
  transition: transform 0.22s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.22s ease;
  animation: sparkle-idle-pulse 3.2s ease-in-out infinite;
  flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
}
.note-sparkle-fab svg { width: 22px; height: 22px; pointer-events: none; }

@keyframes sparkle-idle-pulse {
  0%, 100% { box-shadow: 0 8px 24px rgba(109,99,255,0.32), 0 2px 8px rgba(109,99,255,0.18); }
  50%       { box-shadow: 0 10px 30px rgba(109,99,255,0.46), 0 4px 14px rgba(109,99,255,0.26); }
}

.note-sparkle-fab:hover { transform: scale(1.08); }
.note-sparkle-wrap.is-open .note-sparkle-fab {
  animation: none;
  transform: scale(0.93) rotate(20deg);
}

/* ── Items Container ─────────────────────────────────────────────────── */
.note-sparkle-items {
  display: flex; flex-direction: column;
  align-items: center; gap: 0.48rem;
  pointer-events: none;
}

/* ── Individual Item ─────────────────────────────────────────────────── */
.note-sparkle-item {
  width: 44px; height: 44px;
  border-radius: 50%;
  border: 1px solid rgba(92, 110, 132, 0.13);
  background: rgba(255, 253, 248, 0.97);
  box-shadow: 0 6px 18px rgba(36, 49, 63, 0.12), 0 2px 6px rgba(36, 49, 63, 0.07);
  font-size: 1.1rem;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  text-decoration: none; color: var(--muted);
  opacity: 0;
  transform: translateY(16px) scale(0.82);
  transition: opacity 0.22s ease, transform 0.28s cubic-bezier(0.34, 1.56, 0.64, 1),
              background 0.15s ease, box-shadow 0.15s ease;
  position: relative;
}
.note-sparkle-item svg { width: 20px; height: 20px; pointer-events: none; }
.note-sparkle-item:hover {
  background: rgba(255, 253, 248, 1);
  box-shadow: 0 8px 22px rgba(36, 49, 63, 0.17), 0 2px 8px rgba(36, 49, 63, 0.1);
}

/* Top corners: items start above FAB (open downward) */
.note-sparkle-wrap.fab-corner-tr .note-sparkle-item,
.note-sparkle-wrap.fab-corner-tl .note-sparkle-item {
  transform: translateY(-16px) scale(0.82);
}

/* ── Tooltip ─────────────────────────────────────────────────────────── */
.note-sparkle-item[data-tooltip]::before {
  content: attr(data-tooltip);
  position: absolute;
  right: calc(100% + 10px); top: 50%;
  transform: translateY(-50%);
  background: rgba(36, 49, 63, 0.88); color: #fff;
  font-size: 0.72rem; font-weight: 700;
  font-family: "Plus Jakarta Sans", sans-serif;
  padding: 0.28rem 0.6rem; border-radius: 8px;
  white-space: nowrap; opacity: 0;
  pointer-events: none; transition: opacity 0.15s ease;
}
/* Left corners: tooltip on right */
.note-sparkle-wrap.fab-corner-bl .note-sparkle-item[data-tooltip]::before,
.note-sparkle-wrap.fab-corner-tl .note-sparkle-item[data-tooltip]::before {
  right: auto; left: calc(100% + 10px);
}
.note-sparkle-item[data-tooltip]:hover::before { opacity: 1; }

/* ── Staggered Open Animation ────────────────────────────────────────── */
.note-sparkle-wrap.is-open .note-sparkle-items { pointer-events: auto; }
.note-sparkle-wrap.is-open .note-sparkle-item:nth-child(1) {
  opacity: 1; transform: translateY(0) scale(1); transition-delay: 0ms;
}
.note-sparkle-wrap.is-open .note-sparkle-item:nth-child(2) {
  opacity: 1; transform: translateY(0) scale(1); transition-delay: 55ms;
}
.note-sparkle-wrap.is-open .note-sparkle-item:nth-child(3) {
  opacity: 1; transform: translateY(0) scale(1); transition-delay: 110ms;
}

/* ── Dark Mode ───────────────────────────────────────────────────────── */
[data-theme="dark"] .note-sparkle-item {
  background: rgba(36, 34, 32, 0.96);
  border-color: rgba(220, 210, 190, 0.12);
  box-shadow: 0 6px 18px rgba(0,0,0,0.28), 0 2px 6px rgba(0,0,0,0.18);
}
[data-theme="dark"] .note-sparkle-item:hover {
  background: rgba(48, 46, 44, 0.98);
  box-shadow: 0 8px 22px rgba(0,0,0,0.35), 0 2px 8px rgba(0,0,0,0.22);
}

/* ── Mobile ──────────────────────────────────────────────────────────── */
@media (max-width: 640px) {
  .note-sparkle-fab { width: 48px; height: 48px; }
  .note-sparkle-item { width: 42px; height: 42px; }
  .note-sparkle-item[data-tooltip]::before { display: none; }
}

/* ── FAB Group (button + countdown) ─────────────────────────────── */
.note-sparkle-fab-group {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

/* ── FAB Row (positions controls beside FAB) ─────────────────────── */
.sparkle-fab-row {
  position: relative;
  display: flex;
  align-items: center;
  flex-shrink: 0;
}

/* ── Audio Side Controls ─────────────────────────────────────────── */
.sparkle-audio-controls {
  position: absolute;
  right: calc(100% + 10px);
  top: 50%;
  transform: translateY(-50%) translateX(14px);
  display: flex;
  flex-direction: row;
  gap: 6px;
  align-items: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.26s cubic-bezier(0.34, 1.56, 0.64, 1);
}
/* Left-corner variant: controls appear on the RIGHT */
.note-sparkle-wrap.fab-corner-bl .sparkle-audio-controls,
.note-sparkle-wrap.fab-corner-tl .sparkle-audio-controls {
  right: auto;
  left: calc(100% + 10px);
  transform: translateY(-50%) translateX(-14px);
}
.note-sparkle-wrap.controls-open .sparkle-audio-controls {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(-50%) translateX(0);
}
/* Left-corner open state */
.note-sparkle-wrap.fab-corner-bl.controls-open .sparkle-audio-controls,
.note-sparkle-wrap.fab-corner-tl.controls-open .sparkle-audio-controls {
  transform: translateY(-50%) translateX(0);
}

/* ── Control Buttons ─────────────────────────────────────────────── */
.sparkle-ctrl-btn {
  width: 36px; height: 36px;
  border-radius: 50%;
  border: 1px solid rgba(92, 110, 132, 0.13);
  background: rgba(255, 253, 248, 0.97);
  box-shadow: 0 4px 12px rgba(36, 49, 63, 0.12), 0 1px 4px rgba(36, 49, 63, 0.07);
  font-size: 0.85rem;
  line-height: 1;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  transition: transform 0.12s ease, background 0.12s ease;
}
.sparkle-ctrl-btn:hover {
  background: rgba(255, 253, 248, 1);
  box-shadow: 0 6px 16px rgba(36, 49, 63, 0.16);
}
.sparkle-ctrl-btn:active { transform: scale(0.88); }
.sparkle-ctrl-btn[data-ctrl="skip-back"],
.sparkle-ctrl-btn[data-ctrl="skip-fwd"] {
  font-size: 0.65rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  font-family: "Plus Jakarta Sans", sans-serif;
}
/* Play/pause button — CSS-drawn icons, no text */
.sparkle-ctrl-btn[data-ctrl="play-pause"] { font-size: 0; }
.sparkle-ctrl-btn[data-ctrl="play-pause"]::before {
  content: '';
  display: block;
  width: 9px; height: 12px;
  border-left: 2.5px solid currentColor;
  border-right: 2.5px solid currentColor;
  box-sizing: border-box;
}
.sparkle-ctrl-btn[data-ctrl="play-pause"].is-paused::before {
  width: 0; height: 0;
  border-style: solid;
  border-width: 6px 0 6px 11px;
  border-color: transparent transparent transparent currentColor;
  border-right: none;
}

/* Staggered entrance */
.note-sparkle-wrap.controls-open .sparkle-ctrl-btn:nth-child(1) { transition-delay: 0ms; }
.note-sparkle-wrap.controls-open .sparkle-ctrl-btn:nth-child(2) { transition-delay: 35ms; }
.note-sparkle-wrap.controls-open .sparkle-ctrl-btn:nth-child(3) { transition-delay: 70ms; }
.note-sparkle-wrap.controls-open .sparkle-ctrl-btn:nth-child(4) { transition-delay: 105ms; }

[data-theme="dark"] .sparkle-ctrl-btn {
  background: rgba(36, 34, 32, 0.96);
  border-color: rgba(220, 210, 190, 0.12);
  box-shadow: 0 4px 12px rgba(0,0,0,0.28);
}
[data-theme="dark"] .sparkle-ctrl-btn:hover {
  background: rgba(48, 46, 44, 0.98);
}

/* ── FAB Inner (positions ring around FAB) ───────────────────────── */
.note-sparkle-fab-inner {
  position: relative;
  width: 52px; height: 52px;
  flex-shrink: 0;
}

/* ── Audio Progress Ring (around FAB) ────────────────────────────── */
.sparkle-audio-ring {
  position: absolute;
  top: 50%; left: 50%;
  width: 68px; height: 68px;
  transform: translate(-50%, -50%);
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.3s ease;
}
.note-sparkle-wrap.audio-active .sparkle-audio-ring {
  opacity: 1;
}
.sparkle-audio-ring svg {
  width: 68px; height: 68px;
  transform: rotate(-90deg);
  overflow: visible;
}

/* ── Countdown Text ──────────────────────────────────────────────── */
.sparkle-audio-countdown {
  font-size: 0.62rem;
  font-weight: 700;
  font-family: "Plus Jakarta Sans", sans-serif;
  font-variant-numeric: tabular-nums;
  color: rgba(109, 99, 255, 0.75);
  letter-spacing: 0.02em;
  line-height: 1;
  opacity: 0;
  transition: opacity 0.3s ease;
  white-space: nowrap;
}
.note-sparkle-wrap.audio-active .sparkle-audio-countdown {
  opacity: 1;
}

/* Suppress idle pulse when audio is active */
.note-sparkle-wrap.audio-active .note-sparkle-fab {
  animation: none;
}

@media (max-width: 640px) {
  .note-sparkle-fab-inner { width: 48px; height: 48px; }
  .sparkle-audio-ring { width: 62px; height: 62px; }
  .sparkle-audio-ring svg { width: 62px; height: 62px; }
  .sparkle-ctrl-btn { width: 32px; height: 32px; font-size: 0.78rem; }
}

/* ── Audio Notice Sheet ──────────────────────────────────────────── */
.audio-notice-sheet {
  position: fixed;
  left: 1rem; right: 1rem;
  bottom: var(--floating-bottom-offset);
  max-width: 400px;
  margin: 0 auto;
  z-index: var(--z-toast);
  background: var(--paper);
  border: 1px solid rgba(92, 110, 132, 0.1);
  border-radius: 1rem;
  box-shadow: 0 8px 32px rgba(36,49,63,0.13), 0 2px 8px rgba(36,49,63,0.07);
  padding: 0.8rem 1rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  animation: hz-sheet-in 0.26s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}
.audio-notice-sheet.is-leaving {
  animation: audio-notice-out 0.18s ease forwards;
}
@keyframes audio-notice-out {
  to { transform: translateY(20px); opacity: 0; }
}
.audio-notice-icon { font-size: 1.1rem; flex-shrink: 0; line-height: 1; }
.audio-notice-text {
  flex: 1;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--ink);
  line-height: 1.45;
  margin: 0;
}
.audio-notice-footer {
  display: flex; align-items: center; gap: 0.5rem; flex-shrink: 0;
}
.audio-notice-countdown {
  font-size: 0.72rem; font-weight: 700;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  min-width: 1.2em; text-align: center;
}
.audio-notice-dismiss {
  border: none;
  background: var(--primary); color: #fff;
  font-size: 0.72rem; font-weight: 700;
  font-family: "Plus Jakarta Sans", sans-serif;
  padding: 0.3rem 0.65rem; border-radius: 6px;
  cursor: pointer; line-height: 1;
  transition: opacity 0.15s ease;
}
.audio-notice-dismiss:hover { opacity: 0.85; }
[data-theme="dark"] .audio-notice-sheet {
  border-color: rgba(255,255,255,0.08);
  box-shadow: 0 8px 32px rgba(0,0,0,0.32);
}

@media (max-width: 560px) {
  .audio-notice-sheet {
    align-items: flex-start;
    flex-wrap: wrap;
    gap: 0.6rem;
  }

  .audio-notice-text {
    min-width: 0;
  }

  .audio-notice-footer {
    width: 100%;
    justify-content: flex-end;
  }
}

/* =========================
   GLOBAL SEARCH OVERLAY
========================= */

.hz-search-overlay {
  position: fixed; inset: 0; z-index: var(--z-overlay);
  background: rgba(0, 0, 0, 0.48);
  backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px);
  display: none; align-items: flex-end; justify-content: center;
}
.hz-search-overlay.is-open {
  display: flex;
  animation: hz-overlay-in 0.18s ease both;
}
@keyframes hz-overlay-in {
  from { opacity: 0; } to { opacity: 1; }
}

.hz-search-sheet {
  width: 100%; max-width: 600px; max-height: 78vh;
  background: var(--paper);
  border-radius: 20px 20px 0 0;
  display: flex; flex-direction: column; overflow: hidden;
  animation: hz-sheet-in 0.24s cubic-bezier(0.34, 1.56, 0.64, 1) both;
  padding-bottom: var(--safe-bottom);
}
@keyframes hz-sheet-in {
  from { transform: translateY(40px); opacity: 0.5; }
  to   { transform: translateY(0);    opacity: 1; }
}

.hz-search-header {
  padding: 1rem 1rem 0.75rem;
  flex-shrink: 0;
  border-bottom: 1px solid var(--line);
}
.hz-search-input-wrap {
  display: flex; align-items: center; gap: 0.55rem;
  background: rgba(92, 110, 132, 0.06);
  border: 1px solid var(--line);
  border-radius: 12px; padding: 0 0.75rem;
}
.hz-search-icon { flex-shrink: 0; color: var(--muted); display: flex; align-items: center; }
.hz-search-icon svg { width: 17px; height: 17px; }
.hz-search-input {
  flex: 1; border: none; background: none;
  padding: 0.72rem 0; font-size: 1rem; font-family: inherit;
  color: var(--ink); outline: none;
  -webkit-appearance: none; appearance: none;
}
.hz-search-input::placeholder { color: var(--muted); }
.hz-search-close {
  background: none; border: none; cursor: pointer;
  color: var(--muted); padding: 0.3rem;
  display: flex; align-items: center; justify-content: center;
  border-radius: 8px; flex-shrink: 0;
  transition: color 0.15s, background 0.15s;
}
.hz-search-close svg { width: 18px; height: 18px; }
.hz-search-close:hover { color: var(--ink); background: rgba(92,110,132,0.08); }

.hz-search-body { flex: 1; overflow-y: auto; overscroll-behavior: contain; }

.hz-search-result-item {
  display: flex; flex-direction: column; gap: 0.2rem;
  padding: 0.75rem 1rem; text-decoration: none;
  border-bottom: 1px solid var(--line); transition: background 0.12s;
}
.hz-search-result-item:last-child { border-bottom: none; }
.hz-search-result-item:hover { background: rgba(47, 122, 103, 0.05); }
.hz-search-result-tag {
  font-size: 0.67rem; font-weight: 800;
  letter-spacing: 0.06em; text-transform: uppercase; color: var(--primary);
}
.hz-search-result-title {
  font-size: 0.9rem; font-weight: 700; color: var(--ink);
  line-height: 1.3; margin: 0;
}
.hz-search-result-excerpt {
  font-size: 0.77rem; color: var(--muted); line-height: 1.5; margin: 0;
  display: -webkit-box; -webkit-line-clamp: 2;
  -webkit-box-orient: vertical; overflow: hidden;
}
.hz-search-result-excerpt mark {
  background: rgba(47, 122, 103, 0.18); color: var(--ink); border-radius: 2px;
}
.hz-search-empty-msg {
  padding: 2rem 1rem; text-align: center;
  color: var(--muted); font-size: 0.88rem; display: none;
}
.hz-search-empty-msg.is-visible { display: block; }

[data-theme="dark"] .hz-search-input-wrap { background: rgba(255,255,255,0.04); }

/* ── Desktop Floating TOC ──────────────────────────────────────────────────── */
.hz-toc { display: none; }

@media (min-width: 1024px) {
  .hz-toc {
    display: flex;
    flex-direction: column;
    gap: 2px;
    position: fixed;
    top: 50%;
    right: max(1rem, calc((100vw - 800px) / 2 - 176px));
    transform: translateY(-50%);
    width: 156px;
    max-height: 58vh;
    overflow-y: auto;
    z-index: 30;
    padding: 0.4rem 0;
    scrollbar-width: none;
  }
  .hz-toc::-webkit-scrollbar { display: none; }

  .hz-toc-item {
    font-size: 0.71rem;
    font-weight: 600;
    color: var(--muted);
    text-decoration: none;
    padding: 0.24rem 0.65rem;
    border-left: 2px solid transparent;
    line-height: 1.4;
    transition: color 0.15s, border-color 0.15s;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: block;
  }
  .hz-toc-item:hover { color: var(--ink); }
  .hz-toc-item.is-active {
    color: var(--primary);
    border-left-color: var(--primary);
    font-weight: 700;
  }
}
