:root {
  --bg: #f3ecd9;
  --surface: #fffdf6;
  --surface-2: #f4ecd8;
  --text: #1e2b22;
  --muted: #7c7458;
  --line: #e3d6ad;
  --primary: #0d5c3f;
  --primary-2: #147c53;
  --primary-ink: #0a3f2c;
  --soft: #e6f0e6;
  --gold: #ab7f24;
  --gold-2: #d7ab4c;
  --gold-soft: #f6ecd2;
  --shadow: 0 18px 45px rgba(48, 33, 6, .12);
  --shadow-sm: 0 6px 16px rgba(48, 33, 6, .1);
  --radius-lg: 24px;
  --radius-md: 16px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Vazirmatn", Tahoma, sans-serif;
  position: relative;
}

button, input { font: inherit; }
button { cursor: pointer; border: 0; background: none; }
button:focus-visible, input:focus-visible, .page-item:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
}

/* ---------- decorative Islamic pattern veil ---------- */
.pattern-veil {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  opacity: .5;
  background-image:
    radial-gradient(circle at 1px 1px, rgba(171,127,36,.16) 1.4px, transparent 1.4px);
  background-size: 26px 26px;
}
body.dark .pattern-veil { opacity: .35; background-image: radial-gradient(circle at 1px 1px, rgba(215,171,76,.14) 1.4px, transparent 1.4px); }

/* ---------- topbar ---------- */
.topbar {
  position: relative;
  z-index: 2;
  height: 82px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 34px;
  box-shadow: 0 2px 0 rgba(171,127,36,.15);
}
.brand { display: flex; align-items: center; gap: 13px; }
.brand-icon {
  width: 48px; height: 48px;
  filter: drop-shadow(0 6px 10px rgba(13,92,63,.35));
  transition: transform .35s ease;
}
.brand-icon svg { width: 100%; height: 100%; }
.brand-icon .star8 { fill: var(--primary); }
.brand-icon .brand-letter {
  fill: var(--gold-2); font-size: 17px; font-weight: 800;
  font-family: "Vazirmatn", sans-serif;
}
.brand:hover .brand-icon { transform: rotate(8deg) scale(1.05); }
.brand h1 { margin: 0; font-size: 23px; letter-spacing: .3px; }
.brand span { color: var(--muted); font-size: 11.5px; }

.top-actions { display: flex; align-items: center; gap: 10px; }
.icon-btn, .progress-btn {
  background: var(--surface-2); border: 1px solid var(--line);
  color: var(--text); border-radius: 13px; padding: 10px 14px;
  box-shadow: var(--shadow-sm);
  transition: box-shadow .2s ease, transform .2s ease, background .2s ease;
}
.icon-btn { display: grid; place-items: center; width: 42px; height: 42px; }
.icon-btn svg { width: 19px; height: 19px; fill: var(--primary); }
.icon-btn:hover, .progress-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 22px rgba(48,33,6,.16);
  background: var(--gold-soft);
}
.icon-btn:active, .progress-btn:active { transform: translateY(0); box-shadow: var(--shadow-sm); }
.progress-btn { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.progress-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--gold-2);
  box-shadow: 0 0 0 3px rgba(215,171,76,.25);
}
.progress-btn strong { color: var(--primary); margin-right: 2px; }

/* ---------- shell ---------- */
.app-shell {
  position: relative; z-index: 1;
  max-width: 1400px; margin: 0 auto; padding: 30px 28px 60px;
  display: grid; grid-template-columns: 265px 1fr; gap: 26px;
}

/* ---------- sidebar ---------- */
.sidebar {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius-lg); padding: 20px; height: fit-content;
  box-shadow: var(--shadow); position: sticky; top: 20px;
}
.side-title { display: flex; justify-content: space-between; font-weight: 700; margin-bottom: 15px; padding: 0 2px; }
.count { font-size: 11px; color: var(--muted); font-weight: 500; }
.page-list {
  max-height: 520px; overflow-y: auto; padding-left: 4px; margin-left: -4px;
  scrollbar-width: thin; scrollbar-color: var(--gold-2) transparent;
}
.page-list::-webkit-scrollbar { width: 6px; }
.page-list::-webkit-scrollbar-thumb { background: var(--gold-2); border-radius: 999px; }
.page-list::-webkit-scrollbar-track { background: transparent; }
.page-item {
  width: 100%; display: grid; grid-template-columns: 40px 1fr 20px;
  align-items: center; gap: 10px; padding: 11px; margin: 8px 0;
  border-radius: var(--radius-md); background: transparent; color: var(--text);
  text-align: right; border: 1px solid transparent;
  transition: background .2s ease, box-shadow .2s ease, transform .15s ease, border-color .2s ease;
}
.page-item:hover { background: var(--gold-soft); transform: translateX(-2px); }
.page-item.active {
  background: linear-gradient(135deg, var(--soft), #e0efe2);
  border-color: rgba(13,92,63,.18);
  color: var(--primary-ink); font-weight: 700;
  box-shadow: var(--shadow-sm);
}
.page-label { display: flex; flex-direction: column; align-items: flex-start; line-height: 1.5; }
.page-label small { font-weight: 500; color: var(--muted); font-size: 10.5px; }
.page-item.active .page-label small { color: var(--primary); opacity: .8; }
.page-number {
  width: 36px; height: 36px; display: grid; place-items: center;
  border-radius: 11px; background: #eee3c2; color: var(--gold);
  font-weight: 700; transition: background .2s ease, color .2s ease;
}
.page-item.active .page-number { background: var(--primary); color: #fff; }
.check { color: #c8b98a; font-size: 13px; }
.page-item.active .check { color: var(--primary); }

.learning-card {
  margin-top: 30px; padding: 18px; border-radius: 19px;
  background: linear-gradient(160deg, #0d5c3f, #0a4632);
  color: #eef7f1;
  position: relative; overflow: hidden;
}
.learning-card::after {
  content: ""; position: absolute; inset: 0;
  background-image: radial-gradient(circle at 85% 10%, rgba(215,171,76,.25), transparent 55%);
}
.spark { color: var(--gold-2); position: relative; z-index: 1; }
.spark svg { width: 22px; height: 22px; fill: var(--gold-2); filter: drop-shadow(0 0 6px rgba(215,171,76,.6)); }
.learning-card h3 { margin: 8px 0 5px; font-size: 14px; position: relative; z-index: 1; }
.learning-card p { margin: 0; color: #cfe4d7; font-size: 11.5px; line-height: 1.9; position: relative; z-index: 1; }

/* ---------- content head ---------- */
.content { min-width: 0; }
.content-head {
  display: flex; align-items: end; justify-content: space-between; margin-bottom: 20px; gap: 14px; flex-wrap: wrap;
}
.eyebrow { color: var(--gold); font-size: 11.5px; font-weight: 700; letter-spacing: .2px; }
.content h2 { margin: 5px 0 0; font-size: 29px; }

.page-nav { display: flex; align-items: center; gap: 12px; }
.page-indicator {
  color: var(--muted); font-size: 12px; background: var(--surface);
  border: 1px solid var(--line); padding: 6px 12px; border-radius: 999px;
}
.nav-pill {
  display: flex; align-items: center; gap: 9px;
  background: var(--surface); border: 1px solid var(--line);
  padding: 8px 16px 8px 10px; border-radius: 999px; color: var(--text);
  box-shadow: var(--shadow-sm);
  transition: transform .2s cubic-bezier(.2,.8,.3,1.3), box-shadow .25s ease, background .25s ease, border-color .25s ease;
}
.nav-pill:hover:not(:disabled) { transform: translateY(-3px); box-shadow: 0 14px 26px rgba(48,33,6,.18); border-color: var(--gold-2); }
.nav-pill:active:not(:disabled) { transform: translateY(-1px) scale(.98); }
.nav-pill:disabled { opacity: .4; cursor: not-allowed; box-shadow: none; }
.nav-pill-icon {
  width: 30px; height: 30px; border-radius: 50%; background: var(--soft);
  display: grid; place-items: center; flex-shrink: 0;
}
.nav-pill-icon svg { width: 15px; height: 15px; fill: none; stroke: var(--primary); stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
.nav-pill-text { display: flex; flex-direction: column; text-align: right; line-height: 1.5; }
.nav-pill-text small { font-size: 10px; color: var(--muted); }
.nav-pill-text strong { font-size: 13px; }
.nav-pill-primary {
  background: linear-gradient(135deg, var(--primary), var(--primary-2));
  color: #fff; border-color: transparent;
  box-shadow: 0 12px 24px rgba(13,92,63,.28);
}
.nav-pill-primary .nav-pill-icon { background: rgba(255,255,255,.18); }
.nav-pill-primary .nav-pill-icon svg { stroke: #fff; }
.nav-pill-primary .nav-pill-text small { color: #cfe6da; }
.nav-pill-primary:hover:not(:disabled) { box-shadow: 0 18px 32px rgba(13,92,63,.36); }

/* ---------- book card ---------- */
.book-card, .player {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius-lg); box-shadow: var(--shadow);
}
.book-toolbar {
  padding: 14px 19px; border-bottom: 1px solid var(--line);
  display: flex; justify-content: space-between; align-items: center; color: var(--muted); font-size: 12.5px;
}
.toolbar-title { display: flex; align-items: center; gap: 8px; }
.toolbar-icon { width: 16px; height: 16px; fill: var(--gold); }
.zoom-tools { display: flex; align-items: center; gap: 8px; }
.zoom-tools button {
  width: 30px; height: 30px; border-radius: 9px; background: var(--surface-2);
  border: 1px solid var(--line); font-weight: 700; color: var(--primary);
  transition: transform .15s ease, box-shadow .15s ease, background .15s ease;
}
.zoom-tools button:hover { background: var(--gold-soft); box-shadow: var(--shadow-sm); transform: translateY(-1px); }
.zoom-tools button:active { transform: translateY(0) scale(.94); }
#zoomValue { min-width: 44px; text-align: center; font-variant-numeric: tabular-nums; }

.book-stage {
  min-height: 590px; max-height: 760px; overflow: auto;
  background: repeating-linear-gradient(135deg, #eae0c2 0 2px, #ede4c9 2px 46px);
  padding: 36px 22px; display: flex; justify-content: center;
}
body.dark .book-stage { background: repeating-linear-gradient(135deg, #0e1a15 0 2px, #10201a 2px 46px); }

.book-page {
  transform: scale(1);
  transform-origin: top center;
  transition: transform .25s ease;
  width: min(760px, 100%);
}

/* ---- ornamental Quran-page frame ---- */
.page-frame {
  position: relative;
  background: var(--surface);
  border: 2px solid var(--gold);
  border-radius: 18px;
  padding: 30px clamp(18px, 4vw, 40px) 36px;
  box-shadow: inset 0 0 0 6px var(--gold-soft), 0 20px 40px rgba(48,33,6,.12);
  animation: pageIn .5s ease;
}
body.dark .page-frame { box-shadow: inset 0 0 0 6px rgba(215,171,76,.08), 0 20px 40px rgba(0,0,0,.4); }
.page-frame.has-lesson-tag { padding-top: 46px; }
@keyframes pageIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

.corner { position: absolute; width: 30px; height: 30px; opacity: .8; }
.corner svg { width: 100%; height: 100%; fill: none; stroke: var(--gold); stroke-width: 2; }
.corner-tl { top: 8px; right: 8px; transform: scaleX(-1); }
.corner-tr { top: 8px; left: 8px; }
.corner-bl { bottom: 8px; right: 8px; transform: scale(-1,-1); }
.corner-br { bottom: 8px; left: 8px; transform: scaleY(-1); }

.page-num-tag {
  position: absolute; bottom: -14px; left: 50%; transform: translateX(-50%);
  background: var(--gold); color: #fff; font-size: 11px; font-weight: 700;
  width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center;
  box-shadow: 0 6px 14px rgba(171,127,36,.4);
}

.section-block { margin: 0 0 26px; }
.section-block:last-child { margin-bottom: 0; }
.section-title {
  display: flex; align-items: flex-start; gap: 9px;
  font-size: 15px; font-weight: 600; line-height: 2;
  margin-bottom: 14px; color: var(--primary-ink);
}
.section-title .bullet {
  flex-shrink: 0; width: 20px; height: 20px; margin-top: 3px;
}
.section-title .bullet svg { width: 100%; height: 100%; fill: var(--gold); }

.alpha-box, .word-box, .tafkik-box {
  border: 1px solid var(--line); border-radius: var(--radius-md);
  background: var(--surface-2); padding: 20px;
}

.alpha-equiv {
  text-align: center; font-family: "Amiri", serif; font-size: 26px;
  margin-bottom: 16px; color: var(--primary-ink);
}
.alpha-equiv .eq { color: var(--gold); margin: 0 10px; font-size: 20px; }
.alpha-rows { display: flex; flex-direction: column; gap: 12px; align-items: center; }
.alpha-row { display: flex; gap: 26px; flex-wrap: wrap; justify-content: center; }
.alpha-group { display: flex; gap: 8px; }
.letter-tile {
  width: 46px; height: 46px; display: grid; place-items: center;
  font-family: "Amiri", serif; font-size: 24px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 12px;
  transition: transform .18s cubic-bezier(.2,.8,.3,1.4), box-shadow .18s ease, background .18s ease, color .18s ease;
}
.letter-tile:hover {
  transform: translateY(-4px) scale(1.06);
  box-shadow: 0 12px 20px rgba(171,127,36,.28);
  background: var(--primary); color: #fff; border-color: var(--primary);
}

.word-groups { display: flex; flex-direction: column; gap: 14px; }
.word-row { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; }
.word-chip {
  font-family: "Amiri", serif; font-size: clamp(20px, 2.6vw, 26px);
  background: var(--surface); border: 1px solid var(--line);
  padding: 8px 16px; border-radius: 12px; color: var(--text);
  transition: transform .18s cubic-bezier(.2,.8,.3,1.4), box-shadow .2s ease, background .2s ease, color .2s ease, border-color .2s ease;
}
.star-mark { color: #c0392b; font-size: 0.7em; margin-inline-start: 2px; }
.word-chip:hover {
  transform: translateY(-5px) scale(1.05);
  box-shadow: 0 14px 26px rgba(13,92,63,.22);
  border-color: var(--primary-2);
}
.word-chip.active {
  background: linear-gradient(135deg, var(--primary), var(--primary-2));
  color: #fff; border-color: transparent;
  box-shadow: 0 10px 22px rgba(13,92,63,.4);
  animation: chipPop .35s cubic-bezier(.3,1.6,.4,1);
}
@keyframes chipPop { 0% { transform: scale(.9); } 60% { transform: scale(1.08); } 100% { transform: scale(1); } }

.plain-word {
  font-family: "Amiri", serif; font-size: clamp(19px, 2.4vw, 24px);
  color: var(--primary-ink);
}

.tafkik-box { display: flex; flex-wrap: wrap; align-items: center; gap: 18px; justify-content: center; margin-bottom: 18px; }
.tafkik-table { border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.tafkik-table-head { display: grid; grid-template-columns: 1fr 1fr; }
.tafkik-table-head span {
  padding: 9px 20px; font-size: 12px; font-weight: 700; text-align: center; background: var(--surface);
}
.tafkik-table-head span.hl { background: var(--soft); color: var(--primary-ink); }
.tafkik-table-body { display: flex; align-items: center; justify-content: center; gap: 10px; padding: 14px 20px; font-family: "Amiri", serif; font-size: 22px; background: var(--surface); }
.tafkik-table-body .sep-letters { display: flex; gap: 6px; }
.tafkik-table-body .equals { color: var(--gold); font-weight: 700; }
.tafkik-example-label { font-size: 12.5px; color: var(--muted); }

.note-box {
  margin-top: 6px; display: flex; align-items: center; justify-content: center; gap: 8px;
  border: 1px solid var(--line); border-radius: 12px; padding: 10px 16px;
  font-size: 13px; background: var(--surface);
}
.note-box .accent { color: var(--gold); font-weight: 700; font-family: "Amiri", serif; }

.footnote {
  margin-top: 20px; font-size: 11.5px; color: var(--muted);
  line-height: 2; border-top: 1px dashed var(--line); padding-top: 12px;
}
.footnote .star { color: var(--gold); }

/* ---------- intro paragraph (lesson opener) ---------- */
.intro-box {
  border: 1px solid var(--line); border-radius: var(--radius-md);
  background: var(--surface); padding: 16px 20px; margin-bottom: 4px;
}
.intro-box p { margin: 0 0 10px; line-height: 2.1; font-size: 14.5px; color: var(--text); }
.intro-box p:last-child { margin-bottom: 0; }

/* ---------- numbered verse list ---------- */
.verse-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.verse-item {
  display: flex; align-items: center; gap: 14px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-md);
  padding: 10px 18px;
}
.verse-num {
  flex-shrink: 0; width: 28px; height: 28px; border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--primary-2)); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 12.5px; font-weight: 700;
}
.verse-text {
  flex: 1; text-align: center; background: transparent; border: none;
  font-family: "Amiri", serif; font-size: clamp(20px, 2.8vw, 27px); color: var(--text);
  padding: 4px 0; border-radius: 8px; transition: color .2s ease, background .2s ease, transform .18s ease;
}
.verse-text:hover { color: var(--primary); transform: translateY(-2px); }
.verse-text.active {
  background: linear-gradient(135deg, var(--primary), var(--primary-2)); color: #fff;
  animation: chipPop .35s cubic-bezier(.3,1.6,.4,1);
}

/* ---------- exam note ---------- */
.exam-note {
  display: flex; align-items: flex-start; gap: 8px;
  border: 1px dashed var(--gold-2); border-radius: var(--radius-md);
  background: var(--gold-soft); padding: 12px 16px;
  font-size: 13px; line-height: 2; color: var(--primary-ink);
}
.exam-icon { color: #b3261e; flex-shrink: 0; }

/* ---------- lesson tag (diamond badge, like the printed book) ---------- */
.lesson-tag {
  position: absolute; top: -16px; left: 24px;
  display: inline-flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, var(--primary), var(--primary-2));
  color: #fff; font-size: 12.5px; font-weight: 700;
  padding: 9px 20px; border-radius: 10px;
  box-shadow: 0 10px 20px rgba(13,92,63,.3);
}

/* ---------- player / sound box ---------- */
.player { margin-top: 20px; padding: 22px 24px 20px; position: relative; overflow: hidden; }
.player::before {
  content: ""; position: absolute; top: 0; right: 0; left: 0; height: 4px;
  background: linear-gradient(90deg, var(--gold-2), var(--primary-2), var(--gold-2));
  background-size: 200% 100%;
  animation: shimmer 6s linear infinite;
}
@keyframes shimmer { to { background-position: -200% 0; } }

.player-top { display: flex; justify-content: space-between; align-items: center; }
.audio-title { display: flex; gap: 12px; align-items: center; }
.audio-icon {
  width: 46px; height: 46px; border-radius: 14px;
  background: linear-gradient(135deg, var(--soft), #dcefe2);
  display: grid; place-items: center;
}
.audio-icon svg { width: 22px; height: 22px; fill: none; stroke: var(--primary); stroke-width: 1.8; }
.audio-icon path:first-child { fill: var(--primary); stroke: none; }
.audio-title strong { display: block; font-size: 13.5px; }
.audio-title span { display: block; color: var(--muted); font-size: 11px; margin-top: 3px; }
.speed {
  background: var(--surface-2); border: 1px solid var(--line); border-radius: 11px; padding: 8px 14px;
  font-weight: 700; color: var(--primary); transition: transform .15s ease, box-shadow .15s ease, background .15s ease;
}
.speed:hover { background: var(--gold-soft); box-shadow: var(--shadow-sm); transform: translateY(-2px); }
.speed:active { transform: translateY(0) scale(.95); }

.audio-tracks { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.audio-tracks[hidden] { display: none; }
.audio-track-btn {
  background: var(--surface-2); border: 1px solid var(--line); border-radius: 999px;
  padding: 6px 14px; font-size: 12px; font-weight: 600; color: var(--muted);
  transition: transform .15s ease, box-shadow .15s ease, background .15s ease, color .15s ease;
}
.audio-track-btn:hover { background: var(--gold-soft); color: var(--primary); transform: translateY(-1px); }
.audio-track-btn.active {
  background: linear-gradient(135deg, var(--primary), var(--primary-2)); color: #fff; border-color: transparent;
  box-shadow: var(--shadow-sm);
}

.waveform {
  display: flex; align-items: flex-end; gap: 3px; height: 40px; margin: 16px 2px 6px;
}
.waveform span {
  flex: 1; min-width: 2px; border-radius: 4px;
  background: linear-gradient(180deg, var(--gold-2), var(--primary-2));
  opacity: .35;
  transition: opacity .3s ease;
}
.player.is-playing .waveform span { animation: bar 1.1s ease-in-out infinite; opacity: .9; }

@keyframes bar { 0%, 100% { transform: scaleY(.3); } 50% { transform: scaleY(1); } }

.timeline-row { display: grid; grid-template-columns: 46px 1fr 46px; align-items: center; gap: 10px; margin: 4px 0 6px; color: var(--muted); font-size: 10.5px; font-variant-numeric: tabular-nums; }
.seek-wrap { position: relative; display: flex; align-items: center; }
input[type=range] {
  -webkit-appearance: none; appearance: none; width: 100%; height: 6px; border-radius: 999px;
  background: linear-gradient(90deg, var(--primary) 0%, var(--primary) var(--progress, 0%), var(--line) var(--progress, 0%), var(--line) 100%);
  outline: none;
  direction: ltr;
}
input[type=range]::-webkit-slider-thumb {
  -webkit-appearance: none; width: 18px; height: 18px; border-radius: 50%;
  background: var(--surface); border: 3px solid var(--primary);
  box-shadow: 0 4px 10px rgba(13,92,63,.35);
  cursor: pointer; transition: transform .15s ease;
}
input[type=range]::-webkit-slider-thumb:hover { transform: scale(1.15); }
input[type=range]::-moz-range-thumb {
  width: 18px; height: 18px; border-radius: 50%;
  background: var(--surface); border: 3px solid var(--primary); cursor: pointer;
}
input[type=range]::-moz-range-progress { background: var(--primary); border-radius: 999px; height: 6px; }
input[type=range]::-moz-range-track { background: var(--line); border-radius: 999px; height: 6px; }

.player-controls { display: flex; align-items: center; justify-content: center; gap: 20px; margin-top: 12px; }
.spacer-40 { width: 40px; }
.play-btn {
  width: 62px; height: 62px; border-radius: 50%;
  background: linear-gradient(150deg, var(--primary-2), var(--primary));
  color: #fff; display: grid; place-items: center; position: relative;
  box-shadow: 0 14px 28px rgba(13,92,63,.35);
  transition: transform .2s cubic-bezier(.3,1.4,.4,1), box-shadow .25s ease;
}
.play-btn svg { width: 24px; height: 24px; fill: #fff; }
.play-btn::after {
  content: ""; position: absolute; inset: -8px; border-radius: 50%;
  border: 2px solid var(--gold-2); opacity: 0; transition: opacity .25s ease, transform .25s ease;
}
.play-btn:hover { transform: translateY(-3px) scale(1.04); box-shadow: 0 20px 36px rgba(13,92,63,.45); }
.play-btn:hover::after { opacity: .6; transform: scale(1.06); }
.play-btn:active { transform: translateY(0) scale(.96); }
.player.is-playing .play-btn::after {
  opacity: .55; animation: pulseRing 1.8s ease-out infinite;
}
@keyframes pulseRing { 0% { transform: scale(1); opacity: .6; } 100% { transform: scale(1.35); opacity: 0; } }

.round-control {
  width: 44px; height: 44px; border-radius: 50%; background: var(--surface-2);
  border: 1px solid var(--line);
  color: var(--text); position: relative; display: grid; place-items: center;
  transition: transform .18s cubic-bezier(.2,.8,.3,1.4), box-shadow .18s ease, background .18s ease;
}
.round-control svg { width: 18px; height: 18px; fill: var(--primary); }
#muteBtn svg { fill: none; }
#muteBtn svg path:first-child { fill: var(--primary); }
#muteBtn svg .wave { fill: none; stroke: var(--primary); stroke-width: 1.8; stroke-linecap: round; }
.round-control:hover { transform: translateY(-3px); box-shadow: 0 12px 22px rgba(48,33,6,.18); background: var(--gold-soft); }
.round-control:active { transform: translateY(0) scale(.94); }
.round-control small { font-size: 8px; font-weight: 700; position: absolute; bottom: 2px; color: var(--muted); }

/* ---------- hint ---------- */
.hint {
  display: flex; gap: 12px; align-items: center; margin-top: 18px;
  padding: 15px 18px; border-radius: 16px; background: var(--gold-soft);
  border: 1px solid #ecd9a3; color: #6b5a20; font-size: 12px; line-height: 1.9;
}
.hint-icon { flex-shrink: 0; width: 22px; height: 22px; }
.hint-icon svg { width: 100%; height: 100%; fill: var(--gold); }

/* ---------- dark theme ---------- */
body.dark {
  --bg: #0c1713; --surface: #142420; --surface-2: #182b25;
  --text: #ecf5ee; --muted: #93a89a; --line: #23392f; --soft: #1b3a2c;
  --shadow: 0 18px 45px rgba(0,0,0,.4); --shadow-sm: 0 6px 16px rgba(0,0,0,.35);
  --gold-soft: #23301d; --primary-ink: #dff2e6;
}
body.dark .letter-tile:hover,
body.dark .word-chip.active { color: #08160f; }
body.dark .footnote { border-color: var(--line); }

/* ---------- responsive ---------- */
@media (max-width: 900px) {
  .topbar { padding: 0 16px; height: 72px; }
  .brand span { display: none; }
  .app-shell { grid-template-columns: 1fr; padding: 16px; }
  .sidebar { position: static; display: flex; gap: 8px; align-items: center; overflow-x: auto; padding: 14px; }
  .side-title, .learning-card { display: none; }
  .page-list { display: flex; gap: 8px; max-height: none; overflow-y: visible; overflow-x: auto; padding-left: 0; margin-left: 0; }
  .page-item { min-width: 165px; margin: 0; }
  .book-stage { min-height: 440px; padding: 18px 10px; }
  .page-frame { padding: 22px 14px 28px; }
  .content-head { align-items: start; gap: 14px; flex-direction: column; }
  .page-nav { width: 100%; justify-content: space-between; }
  .nav-pill-text { display: none; }
  .nav-pill { padding: 10px; }
  .waveform { height: 30px; }
}

/* ---------- auth: user tag in topbar (added by backend integration) ---------- */
.user-tag {
  display: flex; align-items: center;
  padding: 10px 14px; border-radius: 13px;
  background: var(--surface-2); border: 1px solid var(--line);
  font-size: 13px; font-weight: 600; color: var(--primary-ink);
}

/* ---------- VIP subscription button + modal ---------- */
.vip-btn {
  display: flex; align-items: center; gap: 6px;
  padding: 10px 16px; border-radius: 13px;
  background: linear-gradient(135deg, var(--gold-2), var(--gold));
  color: #fff; font-weight: 700; font-size: 13px;
  box-shadow: var(--shadow-sm);
  transition: transform .15s ease, box-shadow .2s ease;
}
.vip-btn svg { width: 16px; height: 16px; fill: #fff; }
.vip-btn:hover { transform: translateY(-2px); box-shadow: 0 10px 22px rgba(171,127,36,.35); }

.vip-overlay {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(20, 15, 3, .45);
  display: none; align-items: center; justify-content: center;
  padding: 20px;
}
.vip-overlay.open { display: flex; }

.vip-modal {
  position: relative;
  width: 100%; max-width: 460px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: 30px 26px 26px;
}

.vip-close {
  position: absolute; top: 16px; left: 16px;
  width: 30px; height: 30px; border-radius: 50%;
  background: var(--surface-2); border: 1px solid var(--line);
  color: var(--muted); font-size: 14px;
}
.vip-close:hover { background: var(--gold-soft); color: var(--primary-ink); }

.vip-header { text-align: center; margin-bottom: 22px; }
.vip-crown {
  width: 52px; height: 52px; margin: 0 auto 10px;
  border-radius: 16px;
  background: linear-gradient(135deg, var(--gold-2), var(--gold));
  display: grid; place-items: center;
  box-shadow: var(--shadow-sm);
}
.vip-crown svg { width: 26px; height: 26px; fill: #fff; }
.vip-header h2 { margin: 0 0 4px; font-size: 20px; }
.vip-header p { margin: 0; color: var(--muted); font-size: 12.5px; }

.vip-plans {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 20px;
}

.vip-plan {
  position: relative;
  display: flex; flex-direction: column; gap: 6px;
  padding: 16px 14px;
  border-radius: 15px;
  border: 1.5px solid var(--line);
  background: var(--surface-2);
  text-align: right;
  transition: border-color .15s ease, transform .15s ease, box-shadow .2s ease;
}
.vip-plan:hover { transform: translateY(-2px); box-shadow: var(--shadow-sm); }
.vip-plan.selected { border-color: var(--gold); background: var(--gold-soft); }

.vip-plan-name { font-weight: 700; font-size: 13.5px; color: var(--text); }
.vip-plan-price { font-weight: 800; font-size: 16px; color: var(--primary-ink); }
.vip-plan-price small { font-weight: 500; font-size: 10.5px; color: var(--muted); margin-right: 3px; }

.vip-badge {
  position: absolute; top: -10px; left: 50%; transform: translateX(-50%);
  padding: 3px 10px; border-radius: 20px;
  background: var(--primary); color: #fff;
  font-size: 10px; font-weight: 700; white-space: nowrap;
}
.vip-badge.gold { background: linear-gradient(135deg, var(--gold-2), var(--gold)); }

.vip-submit {
  width: 100%; padding: 13px 0;
  border-radius: 13px;
  background: linear-gradient(135deg, var(--primary), var(--primary-2));
  color: #fff; font-weight: 700;
  box-shadow: var(--shadow-sm);
  transition: transform .15s ease, box-shadow .2s ease;
}
.vip-submit:hover { transform: translateY(-2px); box-shadow: 0 10px 22px rgba(13,92,63,.28); }
.vip-submit:disabled { opacity: .55; cursor: default; transform: none; }
