/* ============ Silk Road — design tokens ============ */
:root {
  --bg: #ffffff;
  --bg-soft: #f7f7f7;
  --surface: #ffffff;
  --line: #e5e5e5;
  --line-strong: #d0d0d0;
  --text: #3c3c3c;
  --text-soft: #777777;
  --text-faint: #afafaf;

  --accent: #1cb0a8;       /* overridden per course */
  --accent-dark: #148a83;
  --accent-soft: #ddf6f4;

  --green: #58cc02;  --green-dark: #46a302; --green-soft: #d7ffb8; --green-text: #58a700;
  --red: #ff4b4b;    --red-dark: #ea2b2b;   --red-soft: #ffdfe0;   --red-text: #ea2b2b;
  --blue: #1cb0f6;   --blue-dark: #1899d6;  --blue-soft: #ddf4ff;
  --gold: #ffc800;   --gold-dark: #e5a500;
  --orange: #ff9600; --purple: #ce82ff; --pink: #ff86d0;

  --radius: 16px;
  --shadow-3d: 0 4px 0;
  --font: "Nunito", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-fa: "Vazirmatn", "Nunito", sans-serif;
  --font-zh: "Noto Sans SC", "PingFang SC", "Microsoft YaHei", sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #131f24; --bg-soft: #1a2a31; --surface: #131f24; --line: #37464f; --line-strong: #52656d;
    --text: #f1f7fb; --text-soft: #a8b8c0; --text-faint: #6b7d86;
    --green-soft: #1f3a12; --red-soft: #3d1f22; --blue-soft: #10334a; --accent-soft: #123a38;
    --green-text: #79d634; --red-text: #ff7676;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #131f24; --bg-soft: #1a2a31; --surface: #131f24; --line: #37464f; --line-strong: #52656d;
  --text: #f1f7fb; --text-soft: #a8b8c0; --text-faint: #6b7d86;
  --green-soft: #1f3a12; --red-soft: #3d1f22; --blue-soft: #10334a; --accent-soft: #123a38;
  --green-text: #79d634; --red-text: #ff7676;
  color-scheme: dark;
}
[data-course="fa"] { --accent: #1cb0a8; --accent-dark: #128c85; --accent-soft: #d9f5f3; }
[data-course="zh"] { --accent: #e5484d; --accent-dark: #bb2f34; --accent-soft: #ffe3e3; }
[data-course="tr"] { --accent: #2b7de9; --accent-dark: #1d5fb8; --accent-soft: #dcebff; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) [data-course="fa"] { --accent-soft: #113a38; }
  :root:not([data-theme="light"]) [data-course="zh"] { --accent-soft: #3d1a1c; }
  :root:not([data-theme="light"]) [data-course="tr"] { --accent-soft: #14304f; }
}
:root[data-theme="dark"] [data-course="fa"] { --accent-soft: #113a38; }
:root[data-theme="dark"] [data-course="zh"] { --accent-soft: #3d1a1c; }
:root[data-theme="dark"] [data-course="tr"] { --accent-soft: #14304f; }

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; }
body {
  font-family: var(--font); background: var(--bg); color: var(--text);
  font-size: 17px; line-height: 1.45; -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
button { font: inherit; color: inherit; cursor: pointer; border: 0; background: none; }
button:disabled { cursor: default; }
input, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--blue); outline-offset: 2px; border-radius: 12px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

.t-fa { font-family: var(--font-fa); direction: rtl; unicode-bidi: isolate; }
.t-zh { font-family: var(--font-zh); }
.t-tr { font-family: var(--font); }
.rom { color: var(--text-soft); font-weight: 700; font-size: .85em; }
.hide-rom .rom { display: none !important; }

/* ============ Buttons ============ */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 50px; padding: 0 22px; border-radius: 16px;
  font-weight: 800; font-size: 15px; letter-spacing: .8px; text-transform: uppercase;
  background: var(--accent); color: #fff; box-shadow: 0 4px 0 var(--accent-dark);
  transition: transform .08s, box-shadow .08s, filter .15s; user-select: none;
}
.btn:hover:not(:disabled) { filter: brightness(1.06); }
.btn:active:not(:disabled) { transform: translateY(4px); box-shadow: 0 0 0 var(--accent-dark); }
.btn:disabled { background: var(--line); color: var(--text-faint); box-shadow: 0 4px 0 var(--line-strong); }
.btn.green { background: var(--green); box-shadow: 0 4px 0 var(--green-dark); }
.btn.red { background: var(--red); box-shadow: 0 4px 0 var(--red-dark); }
.btn.blue { background: var(--blue); box-shadow: 0 4px 0 var(--blue-dark); }
.btn.gold { background: var(--gold); color: #6b4c00; box-shadow: 0 4px 0 var(--gold-dark); }
.btn.ghost { background: var(--surface); color: var(--blue); border: 2px solid var(--line); box-shadow: 0 4px 0 var(--line); }
.btn.ghost:active:not(:disabled) { box-shadow: 0 0 0 var(--line); }
.btn.plain { background: none; color: var(--text-soft); box-shadow: none; }
.btn.plain:hover { color: var(--text); filter: none; }
.btn.wide { width: 100%; }
.btn.sm { min-height: 40px; font-size: 13px; padding: 0 14px; border-radius: 12px; }

.icon-btn { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; color: var(--text-faint); }
.icon-btn:hover { background: var(--bg-soft); color: var(--text-soft); }

.card {
  background: var(--surface); border: 2px solid var(--line); border-radius: var(--radius);
  padding: 18px;
}

/* ============ Shell layout ============ */
.shell { display: grid; grid-template-columns: 250px minmax(0, 1fr) 380px; min-height: 100vh; }
.sidenav {
  position: sticky; top: 0; height: 100vh; border-right: 2px solid var(--line);
  padding: 22px 16px; display: flex; flex-direction: column; gap: 6px;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 6px 12px 22px; font-weight: 900; font-size: 26px; color: var(--accent); letter-spacing: -.5px; }
.brand svg { width: 40px; height: 40px; }
.navitem {
  display: flex; align-items: center; gap: 16px; padding: 10px 14px; border-radius: 14px;
  font-weight: 800; font-size: 15px; letter-spacing: .6px; text-transform: uppercase; color: var(--text-soft);
  border: 2px solid transparent; text-align: left; width: 100%;
}
.navitem .ni { font-size: 26px; width: 32px; text-align: center; }
.navitem:hover { background: var(--bg-soft); }
.navitem.active { color: var(--accent); background: var(--accent-soft); border-color: var(--accent); }
.main { min-width: 0; padding: 0 24px 120px; }
.rightcol { position: sticky; top: 0; height: 100vh; overflow-y: auto; padding: 22px 24px; display: flex; flex-direction: column; gap: 20px; }

.statbar { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.stat { display: inline-flex; align-items: center; gap: 6px; font-weight: 800; padding: 8px 10px; border-radius: 12px; }
.stat:hover { background: var(--bg-soft); }
.stat .si { font-size: 22px; line-height: 1; }
.stat.streak { color: var(--orange); }
.stat.streak.off { color: var(--text-faint); filter: grayscale(1); }
.stat.gems { color: var(--blue); }
.stat.hearts { color: var(--red); }
.flagbtn { font-size: 26px; padding: 6px 10px; border-radius: 12px; display: inline-flex; align-items: center; gap: 6px; }
.flagbtn:hover { background: var(--bg-soft); }

.topbar { display: none; }
.tabbar { display: none; }

@media (max-width: 1160px) {
  .shell { grid-template-columns: 90px minmax(0, 1fr) 340px; }
  .brand span, .navitem .nl { display: none; }
  .navitem { justify-content: center; padding: 10px; }
  .brand { justify-content: center; padding: 6px 0 22px; }
}
@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; }
  .sidenav, .rightcol { display: none; }
  .main { padding: 0 16px 110px; }
  .topbar {
    display: flex; position: sticky; top: 0; z-index: 20; background: var(--bg);
    border-bottom: 2px solid var(--line); padding: 8px 12px; padding-top: max(8px, env(safe-area-inset-top));
    justify-content: space-between; align-items: center; margin: 0 -16px 0;
  }
  .tabbar {
    display: flex; position: fixed; bottom: 0; left: 0; right: 0; z-index: 30;
    background: var(--bg); border-top: 2px solid var(--line); justify-content: space-around;
    padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
  }
  .tabbar .navitem { flex-direction: column; gap: 0; padding: 6px; width: auto; flex: 1; border-radius: 12px; }
  .tabbar .navitem .nl { display: block; font-size: 10px; letter-spacing: .5px; }
  .tabbar .navitem .ni { font-size: 26px; }
}

/* ============ Learn path ============ */
.unit-banner {
  position: sticky; top: 0; z-index: 10; margin: 0 auto; max-width: 600px;
  background: var(--accent); color: #fff; border-radius: 16px; padding: 16px 18px;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  box-shadow: 0 4px 0 var(--accent-dark); margin-top: 22px;
}
@media (max-width: 900px) { .unit-banner { top: 62px; margin-top: 14px; } }
.unit-banner h2 { margin: 0; font-size: 22px; font-weight: 900; line-height: 1.15; }
.unit-banner .eyebrow { font-size: 13px; font-weight: 800; letter-spacing: 1px; text-transform: uppercase; opacity: .85; }
.unit-banner p { margin: 2px 0 0; font-weight: 700; opacity: .95; }
.guidebtn {
  flex: none; display: inline-flex; align-items: center; gap: 8px; border: 2px solid rgba(255,255,255,.4);
  border-radius: 14px; padding: 10px 14px; color: #fff; font-weight: 800; font-size: 14px; letter-spacing: .6px; text-transform: uppercase;
  box-shadow: 0 3px 0 rgba(0,0,0,.15);
}
.guidebtn:hover { background: rgba(255,255,255,.12); }

.unit { max-width: 600px; margin: 0 auto; }
.unit.locked-unit .unit-banner { background: var(--line); color: var(--text-faint); box-shadow: 0 4px 0 var(--line-strong); position: relative; top: 0; }
.unit.locked-unit .guidebtn { color: var(--text-faint); border-color: var(--line-strong); }
.path { position: relative; display: flex; flex-direction: column; align-items: center; gap: 22px; padding: 78px 0 44px; }
.node-wrap { position: relative; }
.node {
  position: relative; width: 74px; height: 68px; border-radius: 50%;
  background: var(--accent); box-shadow: 0 8px 0 var(--accent-dark); color: #fff;
  display: grid; place-items: center; font-size: 30px; transition: transform .1s, box-shadow .1s;
}
.node:active { transform: translateY(6px); box-shadow: 0 2px 0 var(--accent-dark); }
.node svg { width: 34px; height: 34px; }
.node.done { background: var(--gold); box-shadow: 0 8px 0 var(--gold-dark); }
.node.locked { background: var(--line); box-shadow: 0 8px 0 var(--line-strong); color: var(--text-faint); }
.node.locked:active { transform: none; box-shadow: 0 8px 0 var(--line-strong); }
.node.current::before {
  content: ""; position: absolute; inset: -12px; border-radius: 50%;
  border: 7px solid var(--line); z-index: -1;
}
.node.current::after {
  content: ""; position: absolute; inset: -12px; border-radius: 50%;
  border: 7px solid var(--accent); z-index: -1; clip-path: polygon(50% 50%, 50% 0, 100% 0, 100% 100%, 50% 100%);
  opacity: .0;
}
.node.special { border-radius: 22px; width: 76px; }
.start-bubble {
  position: absolute; bottom: calc(100% + 18px); left: 50%; transform: translateX(-50%);
  background: var(--surface); border: 2px solid var(--line); color: var(--accent);
  font-weight: 900; letter-spacing: 1px; font-size: 15px; padding: 9px 14px; border-radius: 12px;
  white-space: nowrap; text-transform: uppercase; animation: bob 1.6s ease-in-out infinite; pointer-events: none;
}
.start-bubble::after {
  content: ""; position: absolute; top: 100%; left: 50%; transform: translateX(-50%);
  border: 9px solid transparent; border-top-color: var(--line);
}
@keyframes bob { 0%,100% { transform: translate(-50%, 0); } 50% { transform: translate(-50%, -6px); } }
.path-mascot { position: absolute; width: 150px; pointer-events: none; }
.path-mascot svg { width: 100%; height: auto; }

.node-pop {
  position: absolute; top: calc(100% + 18px); left: 50%; transform: translateX(-50%); z-index: 15;
  width: 300px; background: var(--accent); color: #fff; border-radius: 16px; padding: 16px;
  box-shadow: 0 10px 30px rgba(0,0,0,.18); animation: popIn .18s ease-out;
}
.node-pop.locked { background: var(--bg-soft); color: var(--text-soft); border: 2px solid var(--line); }
.node-pop::before { content: ""; position: absolute; bottom: 100%; left: 50%; transform: translateX(-50%); border: 10px solid transparent; border-bottom-color: var(--accent); }
.node-pop.locked::before { border-bottom-color: var(--line); }
.node-pop h3 { margin: 0 0 4px; font-size: 18px; font-weight: 900; }
.node-pop p { margin: 0 0 14px; font-weight: 700; opacity: .9; font-size: 15px; }
.node-pop .btn { width: 100%; background: #fff; color: var(--accent); box-shadow: 0 4px 0 rgba(0,0,0,.18); }
.node-pop.locked .btn { background: var(--line); color: var(--text-faint); box-shadow: 0 4px 0 var(--line-strong); }
@keyframes popIn { from { opacity: 0; transform: translate(-50%, -6px) scale(.96); } to { opacity: 1; transform: translate(-50%, 0) scale(1); } }

.unit-divider { text-align: center; color: var(--text-faint); font-weight: 800; margin: 10px 0 0; display: flex; align-items: center; gap: 14px; max-width: 600px; margin-inline: auto; }
.unit-divider::before, .unit-divider::after { content: ""; flex: 1; height: 2px; background: var(--line); }

/* ============ Right column widgets ============ */
.widget { border: 2px solid var(--line); border-radius: 16px; padding: 18px; }
.widget h3 { margin: 0 0 12px; font-size: 20px; font-weight: 900; display: flex; justify-content: space-between; align-items: center; }
.widget h3 a, .widget h3 button { font-size: 14px; color: var(--blue); text-transform: uppercase; letter-spacing: .6px; font-weight: 800; }
.quest { display: flex; gap: 14px; align-items: center; padding: 10px 0; }
.quest + .quest { border-top: 2px solid var(--line); }
.quest .qi { font-size: 32px; }
.quest .qb { flex: 1; }
.quest .qt { font-weight: 800; margin-bottom: 6px; }
.bar { height: 16px; background: var(--line); border-radius: 99px; position: relative; overflow: hidden; }
.bar > i { position: absolute; inset: 0 auto 0 0; background: var(--gold); border-radius: 99px; transition: width .5s cubic-bezier(.3,1.4,.6,1); }
.bar > i::after { content: ""; position: absolute; left: 8px; right: 8px; top: 3px; height: 4px; border-radius: 99px; background: rgba(255,255,255,.35); }
.bar > span { position: absolute; inset: 0; display: grid; place-items: center; font-size: 12px; font-weight: 800; color: var(--text-soft); }
.bar.green > i { background: var(--green); }
.bar.accent > i { background: var(--accent); }

.dailygoal-ring { display: flex; align-items: center; gap: 16px; }
.dailygoal-ring svg { width: 72px; height: 72px; transform: rotate(-90deg); }

/* ============ Lesson ============ */
.lesson { min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; }
.lesson-top { max-width: 1000px; width: 100%; margin: 0 auto; padding: 22px 24px 8px; display: flex; align-items: center; gap: 16px; padding-top: max(22px, env(safe-area-inset-top)); }
.lesson-top .bar { flex: 1; height: 18px; }
.lesson-top .bar > i { background: var(--green); }
.lesson-hearts { color: var(--red); font-weight: 900; display: flex; gap: 6px; align-items: center; font-size: 18px; }
.combo-flag { position: absolute; right: 0; top: -26px; font-size: 13px; font-weight: 900; color: var(--orange); letter-spacing: .6px; text-transform: uppercase; animation: popIn2 .3s; }
@keyframes popIn2 { from { transform: scale(.6); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.lesson-body { flex: 1; width: 100%; max-width: 640px; margin: 0 auto; padding: 18px 20px 30px; display: flex; flex-direction: column; }
.ex-title { font-size: 28px; font-weight: 900; margin: 10px 0 22px; line-height: 1.2; }
@media (max-width: 600px) { .ex-title { font-size: 22px; margin: 4px 0 16px; } .lesson-top { padding: 14px 16px 4px; } .lesson-body { padding: 10px 16px 24px; } }
.new-badge { display: inline-flex; align-items: center; gap: 6px; color: var(--purple); font-weight: 900; font-size: 14px; letter-spacing: 1px; text-transform: uppercase; margin-bottom: 4px; }

.prompt-row { display: flex; align-items: center; gap: 16px; margin-bottom: 20px; }
.speaker-mascot { width: 110px; flex: none; }
.speaker-mascot svg { width: 100%; height: auto; }
.bubble {
  position: relative; border: 2px solid var(--line); border-radius: 16px; padding: 14px 18px; font-size: 22px; font-weight: 700;
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
}
.bubble::before { content: ""; position: absolute; left: -11px; top: 50%; width: 18px; height: 18px; background: var(--bg); border-left: 2px solid var(--line); border-bottom: 2px solid var(--line); transform: translateY(-50%) rotate(45deg); }
.bubble .t-fa { font-size: 1.15em; }
.bubble .word-hint { border-bottom: 2px dashed var(--line-strong); cursor: help; position: relative; }
.bubble .word-hint:hover { border-color: var(--text-soft); }

.play {
  width: 56px; height: 56px; flex: none; border-radius: 16px; background: var(--blue); color: #fff;
  box-shadow: 0 4px 0 var(--blue-dark); display: grid; place-items: center; transition: transform .08s, box-shadow .08s;
}
.play:active { transform: translateY(4px); box-shadow: none; }
.play svg { width: 28px; height: 28px; }
.play.slow { width: 44px; height: 44px; border-radius: 14px; }
.play.slow svg { width: 24px; height: 24px; }
.play.big { width: 120px; height: 120px; border-radius: 28px; box-shadow: 0 6px 0 var(--blue-dark); }
.play.big svg { width: 54px; height: 54px; }
.play.big.slow { width: 80px; height: 80px; border-radius: 22px; }
.play.big.slow svg { width: 36px; height: 36px; }
.play.playing { animation: pulse 0.9s ease-in-out infinite; }
@keyframes pulse { 0%,100% { filter: brightness(1); } 50% { filter: brightness(1.15); } }
.listen-row { display: flex; align-items: flex-end; justify-content: center; gap: 18px; margin: 10px 0 30px; }

/* intro card */
.intro-card { text-align: center; border: 2px solid var(--line); border-radius: 24px; padding: 30px 20px 26px; margin-bottom: 10px; position: relative; overflow: hidden; }
.intro-card .emoji { font-size: 84px; line-height: 1; margin-bottom: 8px; filter: drop-shadow(0 6px 0 rgba(0,0,0,.06)); animation: floaty 3s ease-in-out infinite; }
@keyframes floaty { 0%,100% { transform: translateY(0) } 50% { transform: translateY(-6px) } }
.intro-card .target { font-size: 48px; font-weight: 800; line-height: 1.25; }
.intro-card .rom { font-size: 22px; display: block; margin-top: 4px; }
.intro-card .en { font-size: 20px; font-weight: 800; color: var(--text); margin-top: 10px; }
.intro-card .actions { display: flex; gap: 12px; justify-content: center; margin-top: 18px; }

/* choice grids */
.choices { display: grid; gap: 12px; }
.choices.list { grid-template-columns: 1fr; }
.choices.grid2 { grid-template-columns: 1fr 1fr; }
.choices.pics { grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); }
.choice {
  position: relative; border: 2px solid var(--line); border-radius: 16px; box-shadow: 0 4px 0 var(--line);
  padding: 14px 16px; min-height: 60px; text-align: left; font-weight: 700; font-size: 18px;
  display: flex; align-items: center; gap: 14px; background: var(--surface); transition: background .1s, transform .08s;
}
.choice:hover:not(:disabled) { background: var(--bg-soft); }
.choice:active:not(:disabled) { transform: translateY(2px); box-shadow: 0 2px 0 var(--line); }
.choice .kbd { flex: none; width: 30px; height: 30px; border: 2px solid var(--line); border-radius: 8px; display: grid; place-items: center; font-size: 14px; color: var(--text-faint); font-weight: 800; }
.choice .cmain { display: flex; flex-direction: column; min-width: 0; }
.choice .cmain .t-fa, .choice .cmain .t-zh { font-size: 1.2em; }
.choice.pic { flex-direction: column; justify-content: flex-end; text-align: center; padding: 18px 10px 14px; min-height: 170px; }
.choice.pic .pe { font-size: 64px; line-height: 1; flex: 1; display: grid; place-items: center; }
.choice.pic .kbd { position: absolute; left: 10px; top: 10px; }
.choice.selected { border-color: var(--blue); background: var(--blue-soft); box-shadow: 0 4px 0 var(--blue); color: var(--blue-dark); }
.choice.selected .kbd { border-color: var(--blue); color: var(--blue); }
.choice.correct { border-color: var(--green); background: var(--green-soft); box-shadow: 0 4px 0 var(--green); color: var(--green-text); }
.choice.wrong { border-color: var(--red); background: var(--red-soft); box-shadow: 0 4px 0 var(--red); color: var(--red-text); animation: shake .35s; }
.choice.faded { opacity: .45; }
.choice.matched { border-color: var(--line); color: var(--text-faint); background: var(--bg-soft); box-shadow: 0 4px 0 var(--line); opacity: .5; }
@keyframes shake { 0%,100% { transform: translateX(0) } 25% { transform: translateX(-6px) } 75% { transform: translateX(6px) } }

.match-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 18px; }
.match-cols .col { display: flex; flex-direction: column; gap: 12px; }
.match-cols .choice { justify-content: center; text-align: center; }

/* tile builder */
.answer-area {
  min-height: 130px; border-bottom: 2px solid var(--line);
  padding: 12px 0; display: flex; flex-wrap: wrap; align-content: flex-start; gap: 10px; margin-bottom: 26px;
  background-image: repeating-linear-gradient(to bottom, transparent 0 62px, var(--line) 62px 64px);
}
.answer-area.rtl { direction: rtl; }
.bank { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; }
.bank.rtl { direction: rtl; }
.tile {
  border: 2px solid var(--line); box-shadow: 0 3px 0 var(--line); border-radius: 13px; padding: 8px 14px;
  font-weight: 700; font-size: 18px; background: var(--surface); min-height: 48px; transition: transform .12s;
  display: inline-flex; flex-direction: column; align-items: center; justify-content: center; line-height: 1.15;
}
.tile .rom { font-size: 12px; }
.tile.t-fa, .tile.t-zh { font-size: 21px; }
.tile:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--line); }
.tile.ghost { background: var(--line); color: transparent; box-shadow: none; border-color: var(--line); pointer-events: none; }
.tile.ghost .rom { color: transparent; }
.tile.flyin { animation: tileIn .18s ease-out; }
@keyframes tileIn { from { transform: scale(.85); opacity: .3; } to { transform: scale(1); opacity: 1; } }

.type-area {
  width: 100%; min-height: 150px; border: 2px solid var(--line); background: var(--bg-soft); border-radius: 16px;
  padding: 14px 16px; font-size: 19px; resize: none; outline: none;
}
.type-area:focus { border-color: var(--blue); }
.special-keys { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.special-keys button { border: 2px solid var(--line); border-radius: 10px; padding: 4px 12px; font-weight: 800; box-shadow: 0 2px 0 var(--line); }

/* fill blank */
.fill-sentence { font-size: 26px; font-weight: 700; display: flex; flex-wrap: wrap; gap: 8px; align-items: baseline; margin-bottom: 26px; line-height: 1.6; }
.fill-sentence .blank { display: inline-block; min-width: 90px; border-bottom: 3px solid var(--text-soft); text-align: center; color: var(--blue); }

/* tone */
.tone-choices { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
@media (max-width: 520px) { .tone-choices { grid-template-columns: repeat(2, 1fr); } }
.tone-choice { flex-direction: column; justify-content: center; text-align: center; min-height: 130px; }
.tone-choice .py { font-size: 30px; font-weight: 800; font-family: var(--font); }
.tone-choice svg { width: 60px; height: 34px; }
.tone-choice .tn { font-size: 13px; font-weight: 800; color: var(--text-soft); text-transform: uppercase; letter-spacing: .6px; }

/* speak */
.speak-card { display: flex; align-items: center; gap: 18px; border: 2px solid var(--line); border-radius: 22px; padding: 18px 20px; }
.speak-mascot { width: 88px; flex: none; }
.speak-main { flex: 1; min-width: 0; }
.speak-main .rom { font-size: 18px; margin-top: 4px; }
.speak-en { color: var(--text-soft); font-weight: 700; margin-top: 2px; }
.speak-play { display: flex; flex-direction: column; gap: 10px; align-items: center; }
@media (max-width: 520px) { .speak-mascot { display: none; } .speak-target { font-size: 28px !important; } }
.speak-target { font-size: 40px; font-weight: 800; display: flex; flex-wrap: wrap; gap: 4px 10px; line-height: 1.3; }
.speak-target.t-fa { direction: rtl; justify-content: flex-start; }
.speak-target .sw { transition: color .25s; border-radius: 8px; padding: 0 2px; }
.speak-target .sw.ok { color: var(--green-text); }
.speak-target .sw.miss { color: var(--red-text); }
.speak-target .sw.part { color: var(--orange); }
.mic-wrap { display: flex; flex-direction: column; align-items: center; gap: 16px; margin-top: 26px; }
.mic-btn {
  position: relative; width: 100%; min-height: 76px; border-radius: 18px; border: 2px solid var(--line); box-shadow: 0 4px 0 var(--line);
  display: flex; align-items: center; justify-content: center; gap: 12px; color: var(--blue); font-weight: 900; font-size: 17px; letter-spacing: .8px; text-transform: uppercase;
  background: var(--surface); overflow: hidden;
}
.mic-btn svg { width: 30px; height: 30px; }
.mic-btn:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--line); }
.mic-btn.listening { border-color: var(--blue); background: var(--blue-soft); box-shadow: 0 4px 0 var(--blue); }
.mic-btn .viz { display: flex; gap: 4px; align-items: center; height: 40px; }
.mic-btn .viz i { width: 6px; border-radius: 99px; background: var(--blue); height: 6px; transition: height .06s; }
.heard { min-height: 28px; color: var(--text-soft); font-weight: 700; text-align: center; font-size: 18px; }
.heard .t-fa, .heard .t-zh { font-size: 1.1em; }
.score-ring { display: flex; align-items: center; gap: 14px; justify-content: center; }
.score-ring .num { font-size: 34px; font-weight: 900; }
.mic-note { font-size: 14px; color: var(--text-soft); text-align: center; max-width: 440px; font-weight: 600; }
.cant-speak { margin-top: auto; }

/* ============ Footer check bar ============ */
.checkbar { border-top: 2px solid var(--line); background: var(--bg); position: sticky; bottom: 0; z-index: 5; }
.checkbar-inner { max-width: 1000px; margin: 0 auto; padding: 22px 24px; display: flex; align-items: center; justify-content: space-between; gap: 16px; padding-bottom: max(22px, env(safe-area-inset-bottom)); }
.checkbar .btn { min-width: 160px; }
.checkbar.ok { background: var(--green-soft); border-color: transparent; }
.checkbar.bad { background: var(--red-soft); border-color: transparent; }
.feedback { display: flex; align-items: center; gap: 16px; animation: slideUp .22s ease-out; min-width: 0; }
@keyframes slideUp { from { transform: translateY(20px); opacity: 0; } to { transform: none; opacity: 1; } }
.feedback .fi { width: 72px; height: 72px; border-radius: 50%; background: var(--surface); display: grid; place-items: center; flex: none; }
.feedback .fi svg { width: 38px; height: 38px; }
.feedback h4 { margin: 0; font-size: 24px; font-weight: 900; }
.checkbar.ok .feedback { color: var(--green-text); }
.checkbar.bad .feedback { color: var(--red-text); }
.feedback .fx { font-size: 17px; font-weight: 700; margin-top: 2px; }
.feedback .fx .t-fa, .feedback .fx .t-zh { font-size: 1.1em; }
.feedback .fmeaning { font-size: 15px; font-weight: 700; opacity: .85; }
@media (max-width: 600px) {
  .checkbar-inner { padding: 14px 16px; padding-bottom: max(14px, env(safe-area-inset-bottom)); gap: 12px; }
  .checkbar .btn { min-width: 0; flex: 1; }
  .checkbar-inner > div:first-child:empty { display: none; }
  .checkbar-inner > div:first-child:has(.skipbtn) { flex: 1; display: flex; }
  .checkbar .skipbtn { flex: 1; font-size: 13px; padding: 0 10px; }
  .checkbar.ok .checkbar-inner, .checkbar.bad .checkbar-inner { flex-direction: column; align-items: stretch; }
  .checkbar.ok .btn, .checkbar.bad .btn { width: 100%; }
  .feedback .fi { display: none; }
  .feedback h4 { font-size: 20px; }
}

/* ============ Results ============ */
.results { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 30px 20px; gap: 14px; max-width: 640px; margin: 0 auto; width: 100%; }
.results h1 { font-size: 34px; margin: 0; font-weight: 900; color: var(--gold-dark); }
.results .mascot-big { width: 200px; animation: jump .9s ease-out; }
@keyframes jump { 0% { transform: translateY(30px) scale(.9); opacity: 0 } 50% { transform: translateY(-14px) scale(1.03); opacity: 1 } 100% { transform: none } }
.result-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; width: 100%; margin-top: 10px; }
.rstat { border: 2px solid var(--gold); border-radius: 16px; overflow: hidden; background: var(--gold); }
.rstat .rl { color: #fff; font-size: 13px; font-weight: 900; letter-spacing: .8px; text-transform: uppercase; padding: 6px 4px; }
.rstat .rv { background: var(--surface); border-radius: 13px; padding: 12px 6px; font-size: 22px; font-weight: 900; color: var(--gold-dark); display: flex; align-items: center; justify-content: center; gap: 6px; }
.rstat.green { border-color: var(--green); background: var(--green); } .rstat.green .rv { color: var(--green-text); }
.rstat.blue { border-color: var(--blue); background: var(--blue); } .rstat.blue .rv { color: var(--blue-dark); }

/* ============ Panels / pages ============ */
.page { max-width: 760px; margin: 0 auto; padding: 26px 0 40px; }
.page h1 { font-size: 30px; font-weight: 900; margin: 0 0 6px; }
.page .lead { color: var(--text-soft); font-weight: 700; margin: 0 0 22px; }
.section-title { font-size: 21px; font-weight: 900; margin: 28px 0 12px; }

.sound-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 12px; }
.sound-tile {
  border: 2px solid var(--line); border-radius: 16px; box-shadow: 0 4px 0 var(--line); padding: 12px 6px 10px; text-align: center; background: var(--surface);
  display: flex; flex-direction: column; align-items: center; gap: 2px; transition: transform .08s;
}
.sound-tile:hover { background: var(--bg-soft); }
.sound-tile:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--line); }
.sound-tile .g { font-size: 36px; font-weight: 800; line-height: 1.2; }
.sound-tile .n { font-weight: 800; font-size: 14px; }
.sound-tile .s { font-size: 13px; color: var(--text-soft); font-weight: 700; }
.sound-tile.playing { border-color: var(--blue); box-shadow: 0 4px 0 var(--blue); background: var(--blue-soft); }
.sound-tile .mastery { width: 60%; height: 5px; border-radius: 99px; background: var(--line); margin-top: 6px; overflow: hidden; }
.sound-tile .mastery i { display: block; height: 100%; background: var(--green); }

.practice-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; }
.practice-card {
  border: 2px solid var(--line); border-radius: 20px; box-shadow: 0 4px 0 var(--line); padding: 20px; text-align: left; background: var(--surface);
  display: flex; flex-direction: column; gap: 6px; transition: transform .08s;
}
.practice-card:hover { background: var(--bg-soft); }
.practice-card:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--line); }
.practice-card .pi { font-size: 40px; }
.practice-card h3 { margin: 0; font-size: 19px; font-weight: 900; }
.practice-card p { margin: 0; color: var(--text-soft); font-weight: 700; font-size: 15px; }
.practice-card .count { font-size: 13px; font-weight: 900; color: var(--accent); text-transform: uppercase; letter-spacing: .6px; }
.practice-card:disabled { opacity: .5; }

.word-list { border: 2px solid var(--line); border-radius: 16px; overflow: hidden; }
.word-row { display: flex; align-items: center; gap: 14px; padding: 12px 16px; }
.word-row + .word-row { border-top: 2px solid var(--line); }
.word-row .we { font-size: 28px; width: 36px; text-align: center; }
.word-row .wt { flex: 1; min-width: 0; }
.word-row .wt .t { font-weight: 800; font-size: 19px; }
.word-row .wt .e { color: var(--text-soft); font-weight: 700; font-size: 15px; }
.strength { display: flex; gap: 3px; }
.strength i { width: 8px; height: 20px; border-radius: 4px; background: var(--line); }
.strength i.on { background: var(--gold); }
.word-row .play { width: 40px; height: 40px; border-radius: 12px; }
.word-row .play svg { width: 20px; height: 20px; }
.searchbox { width: 100%; padding: 12px 16px; border: 2px solid var(--line); border-radius: 14px; background: var(--bg-soft); font-weight: 700; margin-bottom: 14px; outline: none; }
.searchbox:focus { border-color: var(--blue); }

.profile-head { display: flex; align-items: center; gap: 20px; padding-bottom: 22px; border-bottom: 2px solid var(--line); }
.avatar { width: 96px; height: 96px; border-radius: 50%; background: var(--accent-soft); display: grid; place-items: center; overflow: hidden; border: 3px solid var(--accent); }
.avatar svg { width: 84px; }
.profile-head h1 { margin: 0; }
.stats-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; }
.stat-card { border: 2px solid var(--line); border-radius: 16px; padding: 14px 16px; display: flex; gap: 12px; align-items: center; }
.stat-card .sci { font-size: 28px; }
.stat-card .scv { font-weight: 900; font-size: 22px; line-height: 1.1; }
.stat-card .scl { color: var(--text-soft); font-weight: 700; font-size: 14px; }
.chart { border: 2px solid var(--line); border-radius: 16px; padding: 16px; }
.chart svg { width: 100%; height: 180px; display: block; }

.ach { display: flex; gap: 16px; align-items: center; padding: 14px 0; }
.ach + .ach { border-top: 2px solid var(--line); }
.ach .badge { width: 64px; height: 72px; flex: none; display: grid; place-items: center; font-size: 30px; border-radius: 14px; background: var(--line); filter: grayscale(1); opacity: .6; position: relative; }
.ach.got .badge { background: linear-gradient(160deg, var(--gold), var(--orange)); filter: none; opacity: 1; box-shadow: 0 4px 0 var(--gold-dark); }
.ach .ab { flex: 1; }
.ach .at { font-weight: 900; font-size: 17px; }
.ach .ad { color: var(--text-soft); font-weight: 700; font-size: 15px; margin-bottom: 6px; }

.settings-row { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 14px 0; }
.settings-row + .settings-row { border-top: 2px solid var(--line); }
.settings-row .sl { font-weight: 800; }
.settings-row .sd { color: var(--text-soft); font-weight: 600; font-size: 14px; }
.switch { position: relative; width: 56px; height: 32px; border-radius: 99px; background: var(--line); flex: none; transition: background .2s; }
.switch::after { content: ""; position: absolute; top: 4px; left: 4px; width: 24px; height: 24px; border-radius: 50%; background: #fff; transition: transform .2s; box-shadow: 0 2px 3px rgba(0,0,0,.2); }
.switch.on { background: var(--blue); }
.switch.on::after { transform: translateX(24px); }
.seg { display: inline-flex; border: 2px solid var(--line); border-radius: 12px; overflow: hidden; }
.seg button { padding: 6px 12px; font-weight: 800; font-size: 14px; }
.seg button.on { background: var(--blue-soft); color: var(--blue-dark); }

/* ============ Modal ============ */
.modal-back { position: fixed; inset: 0; background: rgba(0,0,0,.5); z-index: 100; display: grid; place-items: center; padding: 16px; animation: fade .15s; }
@keyframes fade { from { opacity: 0 } }
.modal { background: var(--bg); border-radius: 22px; width: 100%; max-width: 520px; max-height: 88vh; overflow-y: auto; padding: 26px; animation: popModal .22s cubic-bezier(.3,1.4,.6,1); position: relative; }
.modal.wide { max-width: 720px; }
@keyframes popModal { from { transform: scale(.92); opacity: 0 } }
.modal h2 { margin: 0 0 8px; font-size: 26px; font-weight: 900; }
.modal .close { position: absolute; top: 14px; right: 14px; }
.modal .center { text-align: center; }
.modal .actions { display: flex; flex-direction: column; gap: 12px; margin-top: 20px; }

.guide-tip { border: 2px solid var(--line); border-radius: 16px; padding: 16px 18px; margin-bottom: 12px; }
.guide-tip h4 { margin: 0 0 6px; font-size: 18px; font-weight: 900; color: var(--accent); }
.guide-tip p { margin: 0; font-weight: 600; }
.guide-words { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 10px; }
.guide-word { border: 2px solid var(--line); border-radius: 14px; padding: 10px 12px; display: flex; gap: 10px; align-items: center; text-align: left; }
.guide-word:hover { background: var(--bg-soft); }
.guide-word .gw { font-weight: 800; }
.guide-word .ge { color: var(--text-soft); font-weight: 700; font-size: 14px; }

/* ============ Onboarding ============ */
.onb { min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; }
.onb-body { flex: 1; max-width: 900px; width: 100%; margin: 0 auto; padding: 30px 20px; display: flex; flex-direction: column; align-items: center; }
.hero { text-align: center; display: flex; flex-direction: column; align-items: center; gap: 18px; padding: 40px 0 10px; }
.hero .mascot-hero { width: 230px; animation: floaty 3.5s ease-in-out infinite; }
.hero h1 { font-size: 40px; line-height: 1.12; margin: 0; font-weight: 900; max-width: 640px; letter-spacing: -.5px; }
.hero h1 em { font-style: normal; color: var(--accent); }
.hero p { font-size: 19px; color: var(--text-soft); font-weight: 700; margin: 0; max-width: 520px; }
.hero .floating-words { position: relative; width: 100%; max-width: 620px; height: 0; }
.floating-words span { position: absolute; font-weight: 800; font-size: 22px; color: var(--text-faint); opacity: .7; animation: floaty 4s ease-in-out infinite; }
@media (max-width: 600px) { .hero h1 { font-size: 30px; } .hero .mascot-hero { width: 180px; } .floating-words { display: none; } }
.lang-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 16px; width: 100%; margin-top: 22px; }
.lang-card {
  border: 2px solid var(--line); border-radius: 22px; box-shadow: 0 5px 0 var(--line); padding: 22px 18px; text-align: center; background: var(--surface);
  display: flex; flex-direction: column; align-items: center; gap: 6px; transition: transform .1s;
}
.lang-card:hover { background: var(--bg-soft); transform: translateY(-2px); }
.lang-card:active { transform: translateY(3px); box-shadow: 0 2px 0 var(--line); }
.lang-card .flag { font-size: 58px; line-height: 1; }
.lang-card .ln { font-size: 22px; font-weight: 900; }
.lang-card .nn { font-size: 26px; font-weight: 800; color: var(--accent); }
.lang-card .tg { font-size: 14px; color: var(--text-soft); font-weight: 700; }
.lang-card.selected { border-color: var(--blue); background: var(--blue-soft); box-shadow: 0 5px 0 var(--blue); }
.goal-list { display: flex; flex-direction: column; gap: 12px; width: 100%; max-width: 520px; margin-top: 20px; }
.goal-item { display: flex; justify-content: space-between; font-weight: 800; }
.onb-foot { border-top: 2px solid var(--line); padding: 20px; display: flex; justify-content: center; }
.onb-foot .btn { min-width: 220px; }
.features { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 14px; width: 100%; margin: 34px 0 10px; }
.feature { border: 2px solid var(--line); border-radius: 18px; padding: 18px; }
.feature .fe { font-size: 32px; }
.feature h4 { margin: 8px 0 4px; font-size: 17px; font-weight: 900; }
.feature p { margin: 0; color: var(--text-soft); font-weight: 600; font-size: 15px; }

/* ============ Dialogue ============ */
.dlg { display: flex; flex-direction: column; gap: 14px; }
.dline { display: flex; gap: 12px; align-items: flex-end; animation: slideUp .3s ease-out; }
.dline.B { flex-direction: row-reverse; }
.dline .av { width: 52px; height: 52px; border-radius: 50%; flex: none; display: grid; place-items: center; font-size: 30px; background: var(--accent-soft); }
.dline.B .av { background: var(--blue-soft); }
.dline .db { border: 2px solid var(--line); border-radius: 18px; padding: 12px 16px; max-width: 80%; cursor: pointer; }
.dline.B .db { border-color: var(--blue-soft); background: var(--blue-soft); }
.dline .db .dt { font-size: 21px; font-weight: 800; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.dline .db .de { color: var(--text-soft); font-weight: 700; font-size: 15px; margin-top: 4px; }
.dline .db.speaking { border-color: var(--blue); box-shadow: 0 0 0 3px var(--blue-soft); }
.dline .mini-play { width: 32px; height: 32px; border-radius: 10px; background: var(--blue); color: #fff; display: grid; place-items: center; flex: none; }
.dline .mini-play svg { width: 18px; height: 18px; }
.dline.you .db { border: 2px dashed var(--blue); background: var(--surface); }
.dline .score-chip { display: inline-block; margin-top: 6px; font-size: 13px; font-weight: 900; padding: 2px 10px; border-radius: 99px; background: var(--green-soft); color: var(--green-text); }
.dline .score-chip.low { background: var(--red-soft); color: var(--red-text); }

/* toast & confetti */
#confetti { position: fixed; inset: 0; pointer-events: none; z-index: 200; width: 100%; height: 100%; }
#toast {
  position: fixed; left: 50%; bottom: 100px; transform: translateX(-50%) translateY(20px); z-index: 150;
  background: var(--text); color: var(--bg); font-weight: 800; padding: 12px 20px; border-radius: 14px; opacity: 0;
  transition: opacity .2s, transform .2s; pointer-events: none; max-width: 90vw; text-align: center;
}
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

.pill { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 900; padding: 4px 10px; border-radius: 99px; background: var(--bg-soft); color: var(--text-soft); text-transform: uppercase; letter-spacing: .5px; }
.pill.accent { background: var(--accent-soft); color: var(--accent-dark); }
.muted { color: var(--text-soft); }
.row { display: flex; gap: 12px; align-items: center; }
.spacer { flex: 1; }
.mt { margin-top: 16px; }

.combo-burst { position: fixed; top: 20%; left: 50%; transform: translateX(-50%); z-index: 120; font-size: 34px; font-weight: 900; color: var(--orange); text-shadow: 0 3px 0 rgba(0,0,0,.08); pointer-events: none; animation: burst 1.3s ease-out forwards; white-space: nowrap; }
@keyframes burst { 0% { transform: translate(-50%, 20px) scale(.6); opacity: 0 } 20% { transform: translate(-50%, 0) scale(1.1); opacity: 1 } 70% { opacity: 1 } 100% { transform: translate(-50%, -40px) scale(1); opacity: 0 } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
.node-wrap:has(.node-pop) { z-index: 30; }
@media (max-width: 600px) { .path-mascot { width: 96px; } .path-mascot[style*="left"] { left: 0 !important; } .path-mascot[style*="right"] { right: 0 !important; } }
@media (max-width: 380px) { .path-mascot { display: none; } }

/* =====================================================================
   SILK ROAD THEME LAYER — distinct identity: parchment, night indigo,
   jewel accents, serif display type, star-tile waypoints, caravan route.
   ===================================================================== */
:root {
  --bg: #fbf6ec; --bg-soft: #f4ecdc; --surface: #fffdf8; --line: #eadfca; --line-strong: #d9c9a8;
  --text: #2a2440; --text-soft: #72687f; --text-faint: #aea39a;
  --night: #1f1b3d; --night-2: #2c2757; --gold: #e2a93b; --gold-dark: #b98118; --saffron: #f2b33d;
  --green: #2f9e6a; --green-dark: #237a51; --green-soft: #e3f4ea; --green-text: #1f7a4d;
  --red: #d9534a; --red-dark: #b23a32; --red-soft: #fbe6e2; --red-text: #b23a32;
  --blue: #3c5bd6; --blue-dark: #2c45ad; --blue-soft: #e7ebfb;
  --orange: #e0782b;
  --radius: 18px;
  --font: "Manrope", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-display: "Fraunces", Georgia, serif;
  --shadow-sm: 0 1px 2px rgba(42,36,64,.06), 0 2px 8px rgba(42,36,64,.05);
  --shadow-md: 0 4px 14px rgba(42,36,64,.08), 0 1px 3px rgba(42,36,64,.06);
  --shadow-lg: 0 18px 44px rgba(31,27,61,.18);
}
[data-course="fa"] { --accent: #0e8f86; --accent-dark: #0a6e67; --accent-soft: #dcf1ee; }
[data-course="zh"] { --accent: #c2412d; --accent-dark: #962f20; --accent-soft: #f9e3dd; }
[data-course="tr"] { --accent: #2451a6; --accent-dark: #1a3c7e; --accent-soft: #e1e9f8; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #15132a; --bg-soft: #1d1a38; --surface: #1b1934; --line: #312d55; --line-strong: #453f72;
    --text: #f3eee4; --text-soft: #b1a8c4; --text-faint: #6e6690;
    --green-soft: #173a2a; --red-soft: #402024; --blue-soft: #1e2650; --green-text: #5fd39a; --red-text: #ff8a80;
    --shadow-sm: 0 1px 2px rgba(0,0,0,.3); --shadow-md: 0 4px 14px rgba(0,0,0,.35);
  }
  :root:not([data-theme="light"]) [data-course="fa"] { --accent: #25b5aa; --accent-soft: #11322f; }
  :root:not([data-theme="light"]) [data-course="zh"] { --accent: #e0604b; --accent-soft: #3a1c18; }
  :root:not([data-theme="light"]) [data-course="tr"] { --accent: #5b86e0; --accent-soft: #172748; }
}
:root[data-theme="dark"] {
  --bg: #15132a; --bg-soft: #1d1a38; --surface: #1b1934; --line: #312d55; --line-strong: #453f72;
  --text: #f3eee4; --text-soft: #b1a8c4; --text-faint: #6e6690;
  --green-soft: #173a2a; --red-soft: #402024; --blue-soft: #1e2650; --green-text: #5fd39a; --red-text: #ff8a80;
  --shadow-sm: 0 1px 2px rgba(0,0,0,.3); --shadow-md: 0 4px 14px rgba(0,0,0,.35);
}
:root[data-theme="dark"] [data-course="fa"] { --accent: #25b5aa; --accent-soft: #11322f; }
:root[data-theme="dark"] [data-course="zh"] { --accent: #e0604b; --accent-soft: #3a1c18; }
:root[data-theme="dark"] [data-course="tr"] { --accent: #5b86e0; --accent-soft: #172748; }

body {
  font-family: var(--font); font-size: 16.5px; letter-spacing: -.005em;
  background-color: var(--bg);
  background-image: radial-gradient(circle at 1px 1px, color-mix(in srgb, var(--line-strong) 45%, transparent) 1px, transparent 0);
  background-size: 22px 22px;
}
h1, h2, .ex-title, .results h1, .page h1, .hero h1, .modal h2, .unit-banner h2, .brand, .section-title, .widget h3, .node-pop h3 {
  font-family: var(--font-display); letter-spacing: -.01em;
}

/* Buttons: soft pills, no chunky 3D ledge */
.btn {
  border-radius: 999px; text-transform: none; letter-spacing: 0; font-size: 16px; font-weight: 800;
  background: linear-gradient(180deg, color-mix(in srgb, var(--accent) 88%, #fff), var(--accent));
  box-shadow: 0 6px 16px color-mix(in srgb, var(--accent) 30%, transparent), inset 0 1px 0 rgba(255,255,255,.25);
  transition: transform .12s, box-shadow .15s, filter .15s;
}
.btn:hover:not(:disabled) { transform: translateY(-1px); filter: none; box-shadow: 0 10px 22px color-mix(in srgb, var(--accent) 34%, transparent); }
.btn:active:not(:disabled) { transform: scale(.98); box-shadow: 0 3px 8px color-mix(in srgb, var(--accent) 25%, transparent); }
.btn:disabled { background: var(--bg-soft); color: var(--text-faint); box-shadow: none; border: 1.5px solid var(--line); }
.btn.green { background: linear-gradient(180deg, #3bb57c, var(--green)); box-shadow: 0 6px 16px rgba(47,158,106,.3); }
.btn.red { background: linear-gradient(180deg, #e46a61, var(--red)); box-shadow: 0 6px 16px rgba(217,83,74,.3); }
.btn.blue { background: linear-gradient(180deg, #5673e3, var(--blue)); box-shadow: 0 6px 16px rgba(60,91,214,.28); }
.btn.gold { background: linear-gradient(180deg, var(--saffron), var(--gold)); color: #3a2a05; }
.btn.ghost { background: var(--surface); color: var(--text); border: 1.5px solid var(--line-strong); box-shadow: var(--shadow-sm); }
.btn.ghost:active:not(:disabled) { box-shadow: none; }
.btn.plain { background: none; box-shadow: none; }
.btn.sm { border-radius: 999px; font-size: 14px; }

/* Cards & choices: paper cards with soft shadows */
.card, .widget, .choice, .tile, .sound-tile, .practice-card, .lang-card, .guide-tip, .stat-card, .chart, .word-list, .feature, .intro-card, .speak-card, .mic-btn, .guide-word {
  border-width: 1.5px; border-color: var(--line); background: var(--surface); box-shadow: var(--shadow-sm);
}
.choice { border-radius: 16px; box-shadow: var(--shadow-sm); transition: border-color .15s, background .15s, transform .1s, box-shadow .15s; }
.choice:hover:not(:disabled) { background: var(--surface); border-color: var(--line-strong); box-shadow: var(--shadow-md); transform: translateY(-1px); }
.choice:active:not(:disabled) { transform: scale(.99); box-shadow: var(--shadow-sm); }
.choice .kbd { border-radius: 50%; border-width: 1.5px; font-size: 12px; width: 26px; height: 26px; }
.choice.selected { border-color: var(--accent); background: var(--accent-soft); color: var(--text); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent); }
.choice.selected .kbd { border-color: var(--accent); color: #fff; background: var(--accent); }
.choice.correct { border-color: var(--green); background: var(--green-soft); color: var(--green-text); box-shadow: 0 0 0 3px rgba(47,158,106,.18); }
.choice.wrong { border-color: var(--red); background: var(--red-soft); color: var(--red-text); box-shadow: 0 0 0 3px rgba(217,83,74,.16); }
.choice.matched { box-shadow: none; }
.tile { border-radius: 999px; padding: 8px 18px; box-shadow: var(--shadow-sm); }
.tile:active { transform: scale(.96); box-shadow: none; }
.tile.ghost { background: var(--bg-soft); border-style: dashed; border-color: var(--line-strong); }
.answer-area { background-image: repeating-linear-gradient(to bottom, transparent 0 62px, var(--line) 62px 63.5px); border-bottom-width: 1.5px; }
.play { border-radius: 50%; background: linear-gradient(180deg, color-mix(in srgb, var(--accent) 85%, #fff), var(--accent)); box-shadow: 0 6px 16px color-mix(in srgb, var(--accent) 30%, transparent); }
.play:active { transform: scale(.95); box-shadow: none; }
.play.slow { background: var(--surface); color: var(--accent); border: 1.5px solid var(--line-strong); box-shadow: var(--shadow-sm); }
.play.big { border-radius: 50%; box-shadow: 0 10px 26px color-mix(in srgb, var(--accent) 30%, transparent); }
.play.big.slow { border-radius: 50%; }
.play.playing { animation: ripple 1.2s ease-out infinite; }
@keyframes ripple { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--accent) 45%, transparent); } 100% { box-shadow: 0 0 0 18px transparent; } }
.bubble { border-width: 1.5px; background: var(--surface); box-shadow: var(--shadow-sm); border-radius: 18px; }
.bubble::before { background: var(--surface); border-width: 1.5px; }
.new-badge { color: var(--gold-dark); font-family: var(--font-display); text-transform: none; letter-spacing: 0; font-size: 16px; }
.intro-card { border-radius: 28px; background: linear-gradient(180deg, var(--surface), var(--bg-soft)); }
.intro-card .target { font-family: var(--font-display); }
.intro-card .t-fa, .intro-card .t-zh { font-family: inherit; }
.intro-card .target .t-fa { font-family: var(--font-fa); }
.intro-card .target .t-zh { font-family: var(--font-zh); }
.mic-btn { border-radius: 999px; min-height: 68px; color: var(--accent); text-transform: none; letter-spacing: 0; font-size: 17px; }
.mic-btn.listening { border-color: var(--accent); background: var(--accent-soft); box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 20%, transparent); }
.mic-btn .viz i { background: var(--accent); }
.speak-card { border-radius: 24px; }
.type-area { border-width: 1.5px; background: var(--surface); box-shadow: inset 0 1px 3px rgba(0,0,0,.04); }
.type-area:focus { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 20%, transparent); }
.searchbox { border-width: 1.5px; background: var(--surface); }
.searchbox:focus { border-color: var(--accent); }
.bar { background: var(--bg-soft); box-shadow: inset 0 1px 2px rgba(0,0,0,.06); }
.bar > i { background: linear-gradient(90deg, var(--saffron), var(--gold)); }
.bar > i::after { display: none; }
:focus-visible { outline-color: var(--accent); }

/* Shell: night-indigo rail */
.sidenav { background: var(--night); border-right: 0; color: #e9e3f5; }
.brand { color: var(--saffron); font-weight: 800; font-size: 25px; letter-spacing: -.02em; }
.brand-mark { width: 44px; height: 44px; border-radius: 14px; background: rgba(255,255,255,.08); display: grid; place-items: center; }
.brand-mark svg { width: 38px; height: 38px; }
.navitem { color: #b9b1d0; text-transform: none; letter-spacing: 0; font-size: 16px; font-weight: 700; border: 0; border-radius: 14px; }
.navitem:hover { background: rgba(255,255,255,.06); color: #fff; }
.navitem.active { background: linear-gradient(90deg, rgba(242,179,61,.22), rgba(242,179,61,.06)); color: var(--saffron); border: 0; box-shadow: inset 3px 0 0 var(--saffron); }
.navitem .ni { font-size: 22px; }
.rightcol { gap: 18px; }
.widget { border-radius: 20px; }
.widget h3 { font-size: 19px; }
.stat { font-weight: 800; border-radius: 999px; padding: 7px 12px; background: var(--surface); border: 1.5px solid var(--line); box-shadow: var(--shadow-sm); }
.stat:hover { background: var(--surface); border-color: var(--line-strong); }
.stat .si { font-size: 18px; }
.stat.streak { color: var(--orange); } .stat.gems { color: var(--gold-dark); } .stat.hearts { color: #2a8fd6; }
.flagbtn { background: var(--surface); border: 1.5px solid var(--line); border-radius: 999px; font-size: 22px; padding: 4px 10px; box-shadow: var(--shadow-sm); }
@media (max-width: 900px) {
  .topbar { background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(10px); border-bottom: 1.5px solid var(--line); }
  .tabbar { background: var(--night); border-top: 0; border-radius: 22px 22px 0 0; box-shadow: 0 -8px 24px rgba(31,27,61,.2); }
  .tabbar .navitem { color: #a79fc2; }
  .tabbar .navitem.active { box-shadow: none; background: rgba(242,179,61,.16); }
  .tabbar .navitem .nl { font-size: 11px; font-weight: 700; }
}

/* Unit banners: postcards from each city on the road */
.unit-banner {
  background: radial-gradient(120% 140% at 100% 0%, color-mix(in srgb, var(--accent) 70%, #fff 0%) 0%, var(--accent) 38%, var(--accent-dark) 100%);
  border-radius: 22px; padding: 18px 20px; box-shadow: var(--shadow-md); overflow: hidden; position: sticky; isolation: isolate;
}
.unit-banner::before {
  content: ""; position: absolute; inset: 0; z-index: -1; opacity: .16;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='56' height='56' viewBox='0 0 56 56'%3E%3Cpath d='M28 4l6 10 12-2-2 12 10 6-10 6 2 12-12-2-6 10-6-10-12 2 2-12-10-6 10-6-2-12 12 2z' fill='none' stroke='white' stroke-width='1.5'/%3E%3Ccircle cx='28' cy='28' r='5' fill='none' stroke='white' stroke-width='1.5'/%3E%3C/svg%3E");
  background-size: 56px 56px; mask-image: linear-gradient(90deg, transparent 20%, #000 90%);
}
.unit-banner .eyebrow { font-family: var(--font); text-transform: uppercase; letter-spacing: .14em; font-size: 11.5px; font-weight: 800; opacity: .85; }
.unit-banner h2 { font-size: 26px; font-weight: 800; margin-top: 2px; }
.unit-banner p { font-weight: 600; opacity: .92; }
.guidebtn { border-radius: 999px; border: 1.5px solid rgba(255,255,255,.45); text-transform: none; letter-spacing: 0; font-size: 14px; background: rgba(255,255,255,.1); box-shadow: none; backdrop-filter: blur(4px); }
.unit.locked-unit .unit-banner { background: var(--bg-soft); color: var(--text-soft); box-shadow: none; border: 1.5px dashed var(--line-strong); }
.unit.locked-unit .unit-banner::before { opacity: .0; }
.stamp {
  position: absolute; right: 118px; top: 50%; transform: translateY(-50%) rotate(-12deg);
  width: 76px; height: 76px; border-radius: 50%; border: 2.5px dashed rgba(255,255,255,.85); color: #fff;
  display: grid; place-items: center; text-align: center; line-height: 1; font-weight: 800; font-size: 10px; letter-spacing: .08em; text-transform: uppercase; opacity: .9;
}
.stamp span { margin-top: 14px; }
.stamp b { font-size: 22px; margin-top: -26px; }
@media (max-width: 560px) { .stamp { display: none; } .unit-banner h2 { font-size: 22px; } }

/* The route & star-tile waypoints */
.path { gap: 0; padding: 78px 0 36px; overflow-x: clip; }
.route { position: absolute; top: 0; left: 50%; transform: translateX(-50%); pointer-events: none; overflow: visible; }
.route-base { fill: none; stroke: var(--line-strong); stroke-width: 4; stroke-dasharray: 2 10; stroke-linecap: round; }
.route-done { fill: none; stroke: var(--gold); stroke-width: 5; stroke-linecap: round; }
.node-wrap { height: 104px; display: flex; flex-direction: column; align-items: center; z-index: 1; }
.node-wrap::before {
  content: ""; position: absolute; top: -9px; left: 50%; width: 90px; height: 90px; margin-left: -45px; border-radius: 50%; z-index: -1;
}
.node-wrap.is-current::before { background: radial-gradient(circle, color-mix(in srgb, var(--accent) 35%, transparent), transparent 70%); animation: glow 2.2s ease-in-out infinite; }
@keyframes glow { 0%,100% { transform: scale(.9); opacity: .7 } 50% { transform: scale(1.15); opacity: 1 } }
.node {
  width: 72px; height: 72px; border-radius: 0; box-shadow: none; flex: none;
  clip-path: polygon(50% 0%, 65.7% 12.1%, 85.4% 14.6%, 87.9% 34.3%, 100% 50%, 87.9% 65.7%, 85.4% 85.4%, 65.7% 87.9%, 50% 100%, 34.3% 87.9%, 14.6% 85.4%, 12.1% 65.7%, 0% 50%, 12.1% 34.3%, 14.6% 14.6%, 34.3% 12.1%);
  background: radial-gradient(circle at 50% 35%, color-mix(in srgb, var(--accent) 70%, #fff), var(--accent) 55%, var(--accent-dark));
  filter: drop-shadow(0 4px 6px rgba(31,27,61,.18));
  transition: transform .15s;
}
.node svg { width: 28px; height: 28px; }
.node:hover { transform: rotate(22.5deg) scale(1.04); }
.node:hover svg { transform: rotate(-22.5deg); }
.node:active { transform: scale(.94); box-shadow: none; }
.node.done { background: radial-gradient(circle at 50% 35%, #ffe1a1, var(--saffron) 50%, var(--gold-dark)); box-shadow: none; color: #5a3b00; }
.node.locked { background: radial-gradient(circle at 50% 35%, var(--surface), var(--bg-soft) 60%, var(--line-strong)); box-shadow: none; color: var(--text-faint); }
.node.locked:active { transform: none; box-shadow: none; }
.node.current::before, .node.current::after { display: none; }
.node.kind-test { width: 84px; height: 84px; margin-top: -6px; }
.node.special { border-radius: 0; }
.node-label { margin-top: 6px; font-size: 12.5px; font-weight: 700; color: var(--text-soft); max-width: 130px; text-align: center; line-height: 1.2; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; background: color-mix(in srgb, var(--bg) 85%, transparent); padding: 0 6px; border-radius: 6px; }
.start-bubble {
  bottom: calc(100% + 4px); background: var(--night); color: var(--saffron); border: 0; border-radius: 999px;
  text-transform: none; letter-spacing: 0; font-size: 14px; padding: 8px 14px; box-shadow: var(--shadow-md);
}
.start-bubble::after { border-top-color: var(--night); border-width: 7px; }
.node-pop {
  top: 84px; width: min(300px, 84vw); background: var(--night); color: #f3eee4; border-radius: 20px; box-shadow: var(--shadow-lg);
}
.node-pop::before { border-bottom-color: var(--night); }
.node-pop h3 { font-size: 20px; color: #fff; }
.node-pop p { color: #c8c0dc; font-weight: 600; }
.node-pop .btn { background: linear-gradient(180deg, #ffd27a, var(--saffron)); color: #3a2a05; box-shadow: 0 6px 16px rgba(242,179,61,.3); }
.node-pop.locked { background: var(--surface); color: var(--text-soft); border: 1.5px solid var(--line); }
.node-pop.locked h3 { color: var(--text); }
.node-pop.locked p { color: var(--text-soft); }
.node-pop.locked::before { border-bottom-color: var(--line); }
.node-pop.locked .btn { background: var(--bg-soft); color: var(--text-faint); box-shadow: none; }
.path-mascot { width: 130px; }

/* Lesson: caravan progress route */
.lesson { background: transparent; }
.lesson-top .route-bar { height: 10px; overflow: visible; background: repeating-linear-gradient(90deg, var(--line-strong) 0 6px, transparent 6px 12px); box-shadow: none; border-radius: 99px; }
.lesson-top .route-bar > i { background: linear-gradient(90deg, var(--saffron), var(--gold)); border-radius: 99px; }
.caravan { position: absolute; top: 50%; transform: translate(-50%, -62%) scaleX(-1); font-size: 28px; transition: left .5s cubic-bezier(.3,1.3,.6,1); filter: drop-shadow(0 2px 2px rgba(0,0,0,.15)); z-index: 2; }
.oasis { position: absolute; right: -6px; top: 50%; transform: translate(50%, -60%); font-size: 22px; }
.lesson-top { gap: 22px; }
.lesson-hearts { color: #2a8fd6; font-size: 17px; background: var(--surface); border: 1.5px solid var(--line); border-radius: 999px; padding: 4px 12px; box-shadow: var(--shadow-sm); }
.ex-title { font-weight: 800; font-size: 30px; }
.combo-flag { color: var(--gold-dark); text-transform: none; letter-spacing: 0; font-size: 13px; top: -30px; right: 30px; }

/* Feedback: floating sheet */
.checkbar { background: color-mix(in srgb, var(--bg) 92%, transparent); backdrop-filter: blur(8px); border-top: 1.5px solid var(--line); }
.checkbar.ok, .checkbar.bad { border-top: 0; border-radius: 26px 26px 0 0; box-shadow: 0 -10px 30px rgba(31,27,61,.12); }
.checkbar.ok { background: var(--green-soft); }
.checkbar.bad { background: var(--red-soft); }
.feedback h4 { font-family: var(--font-display); font-weight: 800; }
.feedback .fi { box-shadow: var(--shadow-sm); }
.checkbar.ok .feedback .fi { color: var(--green); }
.checkbar.bad .feedback .fi { color: var(--red); }

/* Results */
.results h1 { color: var(--text); font-weight: 800; }
.rstat { border: 0; background: var(--surface); box-shadow: var(--shadow-md); border-radius: 20px; }
.rstat .rl { color: var(--text-soft); font-size: 11.5px; letter-spacing: .12em; }
.rstat .rv { background: none; color: var(--gold-dark); font-family: var(--font-display); font-size: 26px; }
.rstat.green, .rstat.blue { background: var(--surface); }
.rstat.green .rv { color: var(--green-text); } .rstat.blue .rv { color: var(--accent); }

/* Onboarding */
.hero h1 { font-weight: 800; font-size: 46px; }
.hero h1 em { font-style: italic; color: var(--accent); }
.lang-card { border-radius: 24px; box-shadow: var(--shadow-sm); }
.lang-card:hover { background: var(--surface); box-shadow: var(--shadow-md); transform: translateY(-3px); }
.lang-card.selected { border-color: var(--accent); background: var(--accent-soft); box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 22%, transparent); }
.lang-card .ln { font-family: var(--font-display); }
.onb-foot { border-top: 1.5px solid var(--line); }
.feature .fe { width: 52px; height: 52px; border-radius: 16px; background: var(--bg-soft); display: grid; place-items: center; font-size: 26px; }

/* Misc */
.sound-tile, .practice-card { border-radius: 20px; box-shadow: var(--shadow-sm); }
.sound-tile:hover, .practice-card:hover { background: var(--surface); box-shadow: var(--shadow-md); transform: translateY(-2px); }
.sound-tile:active, .practice-card:active { transform: scale(.98); box-shadow: var(--shadow-sm); }
.sound-tile.playing { border-color: var(--accent); background: var(--accent-soft); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 20%, transparent); }
.sound-tile .g { font-family: var(--font-display); }
.sound-tile .g.t-fa { font-family: var(--font-fa); } .sound-tile .g.t-zh { font-family: var(--font-zh); }
.practice-card .pi { width: 58px; height: 58px; border-radius: 18px; background: var(--accent-soft); display: grid; place-items: center; font-size: 30px; }
.practice-card .count { color: var(--accent); text-transform: none; letter-spacing: 0; font-size: 14px; }
.strength i.on { background: var(--gold); }
.switch.on { background: var(--accent); }
.seg { border-width: 1.5px; border-radius: 999px; }
.seg button.on { background: var(--accent); color: #fff; border-radius: 999px; }
.avatar { border-color: var(--gold); background: var(--bg-soft); }
.ach.got .badge { background: radial-gradient(circle at 50% 30%, #ffe1a1, var(--saffron) 55%, var(--gold-dark)); box-shadow: none;
  clip-path: polygon(50% 0%, 65.7% 12.1%, 85.4% 14.6%, 87.9% 34.3%, 100% 50%, 87.9% 65.7%, 85.4% 85.4%, 65.7% 87.9%, 50% 100%, 34.3% 87.9%, 14.6% 85.4%, 12.1% 65.7%, 0% 50%, 12.1% 34.3%, 14.6% 14.6%, 34.3% 12.1%); }
.ach .badge { width: 68px; height: 68px; border-radius: 0; clip-path: polygon(50% 0%, 65.7% 12.1%, 85.4% 14.6%, 87.9% 34.3%, 100% 50%, 87.9% 65.7%, 85.4% 85.4%, 65.7% 87.9%, 50% 100%, 34.3% 87.9%, 14.6% 85.4%, 12.1% 65.7%, 0% 50%, 12.1% 34.3%, 14.6% 14.6%, 34.3% 12.1%); }
.modal { border-radius: 28px; background: var(--surface); box-shadow: var(--shadow-lg); }
.modal-back { background: rgba(21,19,42,.55); backdrop-filter: blur(3px); }
.pill.accent { background: var(--accent-soft); color: var(--accent); text-transform: none; letter-spacing: 0; font-size: 14px; }
.guide-tip h4 { font-family: var(--font-display); }
.dline .db { border-width: 1.5px; border-radius: 20px; background: var(--surface); box-shadow: var(--shadow-sm); }
.dline.B .db { background: var(--accent-soft); border-color: transparent; }
.dline .db.speaking { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 20%, transparent); }
.dline .mini-play { border-radius: 50%; background: var(--accent); }
.dline.you .db { border-color: var(--accent); }
#toast { background: var(--night); color: #f3eee4; border-radius: 999px; }
.combo-burst { color: var(--gold-dark); font-family: var(--font-display); }
.quest + .quest { border-top-width: 1.5px; }
.word-row + .word-row { border-top-width: 1.5px; }
.word-row .play { border-radius: 50%; }
.lesson-top .route-bar > .caravan { inset: auto; display: block; top: 50%; font-size: 30px; color: initial; place-items: initial; }
.lesson-top .route-bar > .oasis { inset: auto; display: block; top: 50%; right: -6px; font-size: 22px; }
.start-bubble { bottom: auto; top: 20px; left: calc(50% + 48px); transform: none; animation: nudge 1.6s ease-in-out infinite; }
.start-bubble::after { top: 50%; left: auto; right: 100%; transform: translateY(-50%); border: 7px solid transparent; border-right-color: var(--night); }
@keyframes nudge { 0%,100% { transform: translateX(0) } 50% { transform: translateX(5px) } }
.node-wrap.flip .start-bubble { left: auto; right: calc(50% + 48px); }
.node-wrap.flip .start-bubble::after { right: auto; left: 100%; border-right-color: transparent; border-left-color: var(--night); }

/* =====================================================================
   ACCOUNTS, SYNC & INSTALLABLE APP — account forms, recovery code,
   sync indicator, install button / iOS steps, update banner.
   Built on the Silk Road theme layer tokens above.
   ===================================================================== */
/* --- Forms --- */
.acc-panel { display: flex; flex-direction: column; gap: 16px; }
.acc-tabs { display: flex; align-self: flex-start; padding: 3px; background: var(--bg-soft); border: 1.5px solid var(--line); }
.acc-tabs button { padding: 7px 16px; font-weight: 800; font-size: 14px; color: var(--text-soft); border-radius: 999px; }
.acc-tabs button.on { color: #fff; }
.acc-form { display: flex; flex-direction: column; gap: 14px; }
.acc-field { display: flex; flex-direction: column; gap: 6px; }
.acc-field label { font-weight: 800; font-size: 14px; }
.acc-input {
  width: 100%; padding: 12px 16px; border: 1.5px solid var(--line-strong); border-radius: 14px; background: var(--surface);
  font-weight: 700; font-size: 16px; outline: none; transition: border-color .15s, box-shadow .15s;
}
.acc-input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 20%, transparent); }
.acc-mono { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; letter-spacing: .08em; text-transform: uppercase; }
.acc-pw { position: relative; }
.acc-pw .acc-input { padding-right: 76px; }
.acc-eye { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); padding: 6px 12px; border-radius: 999px; font-size: 13px; font-weight: 800; color: var(--accent); }
.acc-eye:hover { background: var(--accent-soft); }
.acc-hint { font-size: 13px; color: var(--text-soft); font-weight: 600; }
.acc-error { min-height: 0; color: var(--red-text); font-weight: 800; font-size: 14px; }
.acc-error:empty { display: none; }
.acc-link { align-self: center; color: var(--accent); font-weight: 800; font-size: 15px; padding: 4px 8px; border-radius: 999px; }
.acc-link:hover { text-decoration: underline; }
.acc-fine { margin: 0; font-size: 13px; color: var(--text-soft); font-weight: 600; text-align: center; }
.acc-reset-head h3 { font-family: var(--font-display); font-size: 21px; margin: 0 0 4px; }
.acc-reset-head p { margin: 0 0 6px; font-weight: 600; }
.acc-modal .acc-hero { display: flex; align-items: center; gap: 14px; margin: -4px 40px 18px 0; }
.acc-modal .acc-hero h2 { margin: 0; font-size: 24px; }
.acc-modal .acc-hero p { margin: 2px 0 0; font-weight: 600; }
.acc-mascot { width: 64px; flex: none; }
.acc-mascot svg { width: 100%; height: auto; }

/* --- Recovery code --- */
.rc-modal { display: flex; flex-direction: column; gap: 12px; }
.rc-modal h2 { margin: 4px 0 0; }
.rc-modal p { margin: 0; font-weight: 600; }
.rc-code {
  display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; padding: 16px; margin-top: 4px;
  background: var(--night); border-radius: 18px; box-shadow: inset 0 0 0 1.5px rgba(242,179,61,.35);
}
.rc-code span {
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: 22px; font-weight: 700; letter-spacing: .14em;
  color: var(--saffron); text-align: center; padding: 8px 4px; background: rgba(255,255,255,.05); border-radius: 12px; user-select: all;
}
@media (min-width: 560px) { .rc-code { grid-template-columns: repeat(4, 1fr); } .rc-code span { font-size: 19px; } }
.rc-actions { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; }
.rc-check { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border: 1.5px solid var(--line); border-radius: 14px; background: var(--bg-soft); font-weight: 800; cursor: pointer; }
.rc-check input { width: 20px; height: 20px; accent-color: var(--accent); flex: none; }

/* --- Profile: account + app cards --- */
.acc-card { display: flex; flex-direction: column; gap: 16px; }
.acc-who, .acc-pitch { display: flex; align-items: center; gap: 14px; }
.acc-pitch p { margin: 4px 0 0; font-weight: 600; }
.acc-avatar {
  width: 56px; height: 56px; flex: none; display: grid; place-items: center; font-family: var(--font-display); font-size: 26px; font-weight: 800;
  color: var(--saffron); background: var(--night); border-radius: 0;
  clip-path: polygon(50% 0%, 65.7% 12.1%, 85.4% 14.6%, 87.9% 34.3%, 100% 50%, 87.9% 65.7%, 85.4% 85.4%, 65.7% 87.9%, 50% 100%, 34.3% 87.9%, 14.6% 85.4%, 12.1% 65.7%, 0% 50%, 12.1% 34.3%, 14.6% 14.6%, 34.3% 12.1%);
}
.acc-id { min-width: 0; }
.acc-name { font-family: var(--font-display); font-weight: 800; font-size: 19px; }
.acc-email { color: var(--text-soft); font-weight: 700; overflow-wrap: anywhere; }
.acc-sync { margin-top: 4px; font-size: 13px; font-weight: 700; color: var(--green-text); }
.acc-sync[data-state="offline"], .acc-sync[data-state="error"] { color: var(--orange); }
.acc-sync[data-state="saving"] { color: var(--text-soft); }
.acc-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.acc-danger { border-top: 1.5px solid var(--line); padding-top: 10px; display: flex; justify-content: flex-end; }
.acc-delete { color: var(--red-text); }
.acc-loading { margin: 0; font-weight: 700; }
.app-card { display: flex; align-items: center; gap: 14px; margin-top: 14px; flex-wrap: wrap; }
.app-ic { width: 52px; height: 52px; flex: none; display: grid; place-items: center; font-size: 28px; border-radius: 14px; overflow: hidden; background: var(--bg-soft); }
.app-ic img { width: 100%; height: 100%; display: block; }
.app-tx { flex: 1; min-width: 200px; }
.app-tx p { margin: 2px 0 0; font-weight: 600; font-size: 14.5px; }

/* --- Onboarding account offer --- */
.acc-offer { gap: 22px; }
.acc-offer-cards { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; width: 100%; max-width: 640px; }
.acc-offer-card { align-items: flex-start; text-align: left; }
.acc-offer-card .flag { font-size: 40px; }
@media (max-width: 560px) { .acc-offer-cards { grid-template-columns: 1fr; } }

/* --- Sync indicator (stat bar) --- */
.sync-pill {
  display: inline-flex; align-items: center; gap: 6px; padding: 6px 10px; border-radius: 999px; font-size: 13px; font-weight: 800;
  color: var(--green-text); background: var(--surface); border: 1.5px solid var(--line); box-shadow: var(--shadow-sm); white-space: nowrap;
  transition: color .2s, border-color .2s;
}
.sync-pill[hidden] { display: none; }
.sync-pill .sp-i { display: grid; width: 18px; height: 18px; }
.sync-pill .sp-i svg { width: 18px; height: 18px; }
.sync-pill[data-state="saved"] .sp-t { display: none; }
.sync-pill[data-state="saving"] { color: var(--text-soft); }
.sync-pill[data-state="saving"] .sp-i { animation: sp-bob 1s ease-in-out infinite; }
.sync-pill[data-state="offline"], .sync-pill[data-state="error"] { color: var(--orange); border-color: color-mix(in srgb, var(--orange) 40%, var(--line)); }
@keyframes sp-bob { 50% { transform: translateY(-2px); } }
@media (max-width: 1400px) { .rightcol .sync-pill .sp-t { display: none; } }
@media (max-width: 900px) { .sync-pill { padding: 6px 8px; } .sync-pill .sp-t { display: none; } }

/* --- Install button --- */
.install-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; border-radius: 999px; font-weight: 800; font-size: 15px;
  padding: 10px 18px; background: linear-gradient(180deg, #ffd27a, var(--saffron)); color: #3a2a05; box-shadow: 0 6px 16px rgba(242,179,61,.3);
  transition: transform .12s, box-shadow .15s;
}
.install-btn[hidden] { display: none; }
.install-btn:hover { transform: translateY(-1px); box-shadow: 0 10px 22px rgba(242,179,61,.36); }
.install-btn .ib-i { font-size: 18px; line-height: 1; }
.side-foot { margin-top: auto; padding: 12px 4px 4px; display: flex; }
.install-btn.side { width: 100%; background: rgba(242,179,61,.12); color: var(--saffron); box-shadow: inset 0 0 0 1.5px rgba(242,179,61,.4); }
.install-btn.side:hover { background: rgba(242,179,61,.2); box-shadow: inset 0 0 0 1.5px rgba(242,179,61,.6); }
@media (max-width: 1160px) { .install-btn.side { padding: 10px; } .install-btn.side .ib-l { display: none; } }
.offline-btn { border-radius: 999px; padding: 5px 12px; font-size: 13.5px; font-weight: 800; color: var(--accent); border: 1.5px solid var(--line-strong); background: var(--surface); }
.offline-btn:hover:not(:disabled) { border-color: var(--accent); }
.offline-btn.done { color: var(--green-text); border-color: transparent; background: var(--green-soft); }

/* --- iOS install steps --- */
.ios-install h2 { margin-top: 8px; }
.ios-install > p { font-weight: 600; margin: 0 0 6px; }
.ios-warn { background: var(--red-soft); color: var(--red-text); font-weight: 800; padding: 10px 14px; border-radius: 14px; font-size: 14px; }
.ios-steps { list-style: none; margin: 14px 0 0; padding: 0; display: flex; flex-direction: column; gap: 12px; }
.ios-step { display: flex; align-items: center; gap: 14px; padding: 14px; border: 1.5px solid var(--line); border-radius: 18px; background: var(--surface); box-shadow: var(--shadow-sm); }
.ios-n { width: 32px; height: 32px; flex: none; display: grid; place-items: center; border-radius: 50%; background: var(--night); color: var(--saffron); font-family: var(--font-display); font-weight: 800; }
.ios-body { flex: 1; }
.ios-t { font-weight: 800; }
.ios-d { color: var(--text-soft); font-weight: 600; font-size: 14px; }
.ios-art { flex: none; }
.ios-ico { width: 48px; height: 48px; display: grid; place-items: center; border-radius: 14px; background: var(--blue-soft); color: #0a84ff; }
.ios-phone { width: 56px; height: 92px; border-radius: 14px; background: var(--night); padding: 6px; box-shadow: var(--shadow-md); }
.ios-screen { height: 100%; border-radius: 9px; background: linear-gradient(180deg, #3a3372, #1f1b3d); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; }
.ios-mini { width: 30px; height: 30px; border-radius: 8px; background: #2c2757; box-shadow: 0 0 0 1.5px rgba(242,179,61,.5); display: grid; place-items: center; animation: floaty 1.6s ease-in-out infinite; }
.ios-mini svg { width: 26px; height: 26px; }
.ios-lbl { font-size: 7px; color: #f3eee4; font-weight: 800; }

/* --- "New version available" banner --- */
.update-banner {
  position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(96px + env(safe-area-inset-bottom)); z-index: 160;
  display: flex; align-items: center; gap: 12px; padding: 8px 8px 8px 16px; max-width: calc(100vw - 24px);
  background: var(--night); color: #f3eee4; border-radius: 999px; box-shadow: var(--shadow-lg); font-weight: 800;
  animation: ub-in .3s cubic-bezier(.3,1.4,.6,1);
}
@media (min-width: 901px) { .update-banner { bottom: 24px; } }
.update-banner .ub-dot { color: var(--saffron); }
.update-banner .btn.sm { min-height: 36px; }
.update-banner .ub-x { width: 32px; height: 32px; border-radius: 50%; color: #b9b1d0; font-size: 20px; }
.update-banner .ub-x:hover { background: rgba(255,255,255,.08); color: #fff; }
@keyframes ub-in { from { opacity: 0; transform: translate(-50%, 16px); } }

/* Persian in Latin letters */
.t-rom { font-family: var(--font); direction: ltr; unicode-bidi: isolate; font-weight: 800; letter-spacing: -.005em; }
html.fa-latin .rom { display: none !important; }
.intro-card .target .t-rom { font-family: var(--font-display); }
.tile.t-rom { font-size: 18px; }
.speak-target.t-rom { direction: ltr; }
.fill-sentence.t-rom { direction: ltr; }

.level-head { max-width: 600px; margin: 34px auto 6px; display: flex; gap: 14px; align-items: center; padding: 14px 16px; border-radius: 18px; background: var(--night); color: #f3eee4; }
.level-head:first-child { margin-top: 22px; }
.level-badge { flex: none; width: 54px; height: 54px; display: grid; place-items: center; font-family: var(--font-display); font-weight: 800; font-size: 20px; color: #3a2a05;
  background: radial-gradient(circle at 50% 35%, #ffe1a1, var(--saffron) 55%, var(--gold-dark));
  clip-path: polygon(50% 0%, 65.7% 12.1%, 85.4% 14.6%, 87.9% 34.3%, 100% 50%, 87.9% 65.7%, 85.4% 85.4%, 65.7% 87.9%, 50% 100%, 34.3% 87.9%, 14.6% 85.4%, 12.1% 65.7%, 0% 50%, 12.1% 34.3%, 14.6% 14.6%, 34.3% 12.1%); }
.lh-title { font-family: var(--font-display); font-weight: 800; font-size: 19px; }
.lh-title .muted { color: #b1a8c4; font-family: var(--font); font-size: 14px; font-weight: 700; }
.lh-desc { color: #c8c0dc; font-weight: 600; font-size: 14.5px; }

.recall-en { font-family: var(--font-display); font-size: 28px; font-weight: 800; line-height: 1.25; margin-bottom: 6px; }
.speak-target.concealed { display: none; }
@media (max-width: 520px) { .recall-en { font-size: 22px; } }

[hidden] { display: none !important; }

* { font-synthesis-weight: none; }

.tone-note { display: flex; gap: 12px; align-items: center; justify-content: center; flex-wrap: wrap; margin-top: 10px; color: var(--text); font-size: 15px; text-align: left; }
.tone-note svg { display: block; border-radius: 10px; }

/* =====================================================================
   NIGHT OPS THEME — Build-to-Run style: near-black, Syne uppercase display,
   JetBrains Mono labels, amber + sky accents, flat panels, pill CTAs.
   Deliberately a single dark look (tokens pinned for every theme state).
   ===================================================================== */
:root, :root[data-theme="light"], :root[data-theme="dark"] {
  --bg: #07090D; --bg-soft: #0E131A; --surface: #10141B; --line: #243041; --line-strong: #32405A;
  --text: #EEF3F8; --text-soft: #8F9AAB; --text-faint: #5E6978; --muted: #8F9AAB;
  --night: #07090D; --night-2: #10141B;
  --amber: #E9A552; --amber-deep: #B7731F; --gold: #E9A552; --gold-dark: #B7731F; --saffron: #F4C98A; --orange: #E9A552;
  --sky: #7CC2F0; --sky-deep: #2F7FC4;
  --skybg: radial-gradient(circle at 28% 30%, #D6EEFB 0, rgba(214,238,251,0) 34%), radial-gradient(circle at 72% 62%, #B3DDF5 0, rgba(179,221,245,0) 40%), linear-gradient(140deg, #3E8FD8 0%, #6DB7EC 45%, #4FA1E2 100%);
  --amberbg: linear-gradient(140deg, #E9A552 0%, #F4C98A 55%, #E39A43 100%);
  --green: #8FE0B0; --green-dark: #5DBB86; --green-soft: rgba(143,224,176,.10); --green-text: #8FE0B0;
  --red: #FF7A7A; --red-dark: #D95454; --red-soft: rgba(255,122,122,.10); --red-text: #FF8F8F;
  --blue: #7CC2F0; --blue-dark: #2F7FC4; --blue-soft: rgba(124,194,240,.12);
  --display: "Syne", "Arial Black", "Helvetica Neue", Arial, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, Menlo, Consolas, monospace;
  --font: "Manrope", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-display: var(--display);
  --shadow-sm: none; --shadow-md: 0 12px 40px rgba(0,0,0,.45); --shadow-lg: 0 24px 60px rgba(0,0,0,.6);
  color-scheme: dark;
}
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --bg: #07090D; --surface: #10141B; --bg-soft: #0E131A; --line: #243041; --line-strong: #32405A; --text: #EEF3F8; --text-soft: #8F9AAB; --text-faint: #5E6978; --green-soft: rgba(143,224,176,.10); --red-soft: rgba(255,122,122,.10); --blue-soft: rgba(124,194,240,.12); --green-text: #8FE0B0; --red-text: #FF8F8F; } }
[data-course], html[data-course] { --accent: #7CC2F0 !important; --accent-dark: #2F7FC4 !important; --accent-soft: rgba(124,194,240,.12) !important; }

body { background-color: var(--bg); color: var(--text); font-family: var(--font);
  background-image: radial-gradient(circle at 1px 1px, rgba(143,154,171,.16) 1px, transparent 0); background-size: 28px 28px; }
h1, h2, .ex-title, .results h1, .page h1, .hero h1, .modal h2, .unit-banner h2, .brand, .section-title, .widget h3, .node-pop h3, .lh-title, .feature h4, .practice-card h3, .lang-card .ln, .guide-tip h4, .feedback h4, .recall-en {
  font-family: var(--display); text-transform: uppercase; font-weight: 800; letter-spacing: -.01em; line-height: 1.02;
}
.ex-title { font-size: 34px; }
.recall-en { text-transform: none; font-family: var(--font); letter-spacing: -.01em; }
.t-rom, .t-fa, .t-zh, .t-tr, .speak-target, .intro-card .target, .tile, .choice .cmain { text-transform: none !important; }
.intro-card .target .t-rom, .intro-card .target { font-family: var(--font); font-weight: 800; letter-spacing: -.02em; }
.eyebrow, .new-badge, .pill, .pill.accent, .unit-banner .eyebrow, .lh-title .muted, .rstat .rl, .practice-card .count, .stat, .navitem .nl, .tabbar .navitem .nl, .kbd, .choice .kbd, .start-bubble, .node-label, .tone-choice .tn, .guide-word .ge, .dline .score-chip, .combo-flag {
  font-family: var(--mono); text-transform: uppercase; letter-spacing: .14em; font-weight: 600;
}
.new-badge, .eyebrow { color: var(--amber); font-size: 13px; }

/* Buttons: sky pill with glow; secondary = outline */
.btn { font-family: var(--font); text-transform: none; letter-spacing: 0; font-weight: 800; border-radius: 999px; color: #07090D;
  background: var(--skybg); box-shadow: 0 8px 30px rgba(124,194,240,.28), inset 0 1px 0 rgba(255,255,255,.4); border: 0; }
.btn:hover:not(:disabled) { transform: translateY(-1px); box-shadow: 0 12px 38px rgba(124,194,240,.38); }
.btn:active:not(:disabled) { transform: scale(.98); }
.btn.green, .btn.blue { background: var(--skybg); color: #07090D; box-shadow: 0 8px 30px rgba(124,194,240,.28); }
.btn.gold { background: var(--amberbg); color: #07090D; box-shadow: 0 8px 30px rgba(233,165,82,.28); }
.btn.red { background: linear-gradient(140deg, #FF8F8F, #E25B5B); color: #07090D; box-shadow: 0 8px 30px rgba(255,122,122,.25); }
.btn.ghost { background: transparent; color: var(--text); border: 1px solid var(--line-strong); box-shadow: none; }
.btn.ghost:hover:not(:disabled) { border-color: var(--sky); box-shadow: none; }
.btn.plain { background: none; color: var(--text-soft); box-shadow: none; }
.btn:disabled { background: var(--surface); color: var(--text-faint); border: 1px solid var(--line); box-shadow: none; }

/* Panels */
.card, .widget, .choice, .sound-tile, .practice-card, .lang-card, .guide-tip, .stat-card, .chart, .word-list, .feature, .intro-card, .speak-card, .mic-btn, .guide-word, .bubble, .modal, .dline .db, .level-head, .rstat {
  background: var(--surface); border: 1px solid var(--line); box-shadow: none; border-radius: 20px; color: var(--text);
}
.bubble::before { background: var(--surface); border-color: var(--line); }
.intro-card { background: linear-gradient(180deg, #121821, #0C1016); }
.choice:hover:not(:disabled), .practice-card:hover, .sound-tile:hover, .lang-card:hover, .guide-word:hover { background: #141A23; border-color: var(--line-strong); box-shadow: none; }
.choice .kbd { border: 1px solid var(--line-strong); color: var(--text-faint); background: transparent; font-size: 11px; letter-spacing: 0; }
.choice.selected { border-color: var(--sky); background: rgba(124,194,240,.10); box-shadow: 0 0 0 1px var(--sky) inset; color: var(--text); }
.choice.selected .kbd { background: var(--sky); color: #07090D; border-color: var(--sky); }
.choice.correct { border-color: var(--green); background: var(--green-soft); color: var(--green); box-shadow: none; }
.choice.wrong { border-color: var(--red); background: var(--red-soft); color: var(--red-text); box-shadow: none; }
.tile { background: var(--surface); border: 1px solid var(--line-strong); color: var(--text); border-radius: 12px; box-shadow: 0 3px 0 #05070A; }
.tile.ghost { background: transparent; border: 1px dashed var(--line); box-shadow: none; }
.answer-area { background-image: repeating-linear-gradient(to bottom, transparent 0 62px, var(--line) 62px 63px); border-color: var(--line); }
.type-area, .searchbox { background: #0B0F15; border: 1px solid var(--line); color: var(--text); }
.type-area:focus, .searchbox:focus { border-color: var(--sky); box-shadow: 0 0 0 3px rgba(124,194,240,.15); }
.play { background: var(--skybg); color: #07090D; box-shadow: 0 8px 26px rgba(124,194,240,.3); }
.play.slow { background: transparent; color: var(--sky); border: 1px solid var(--line-strong); box-shadow: none; }
.mic-btn { color: var(--sky); border-radius: 999px; }
.mic-btn.listening { border-color: var(--sky); background: rgba(124,194,240,.1); box-shadow: 0 0 0 4px rgba(124,194,240,.12); }
.mic-btn .viz i { background: var(--sky); }
.bar { background: #0B0F15; box-shadow: inset 0 0 0 1px var(--line); }
.bar > i { background: var(--amberbg); }

/* Shell */
.sidenav { background: #07090D; border-right: 1px solid var(--line); }
.brand { color: var(--text); font-size: 22px; letter-spacing: .02em; }
.brand .road { color: var(--sky); }
.brand-mark { background: transparent; border-radius: 0; width: 38px; height: 38px; }
.brand-mark svg { width: 38px; height: 38px; }
.navitem { color: var(--text-soft); border-radius: 12px; }
.navitem:hover { background: #10141B; color: var(--text); }
.navitem.active { background: #10141B; color: var(--text); box-shadow: inset 3px 0 0 var(--amber); }
.navitem .nl { font-size: 12px; }
.stat { background: var(--surface); border: 1px solid var(--line); color: var(--text); font-size: 13px; letter-spacing: .06em; }
.stat.streak { color: var(--amber); } .stat.gems { color: var(--amber); } .stat.hearts { color: var(--sky); }
.stat.streak.off { color: var(--text-faint); }
.flagbtn { background: var(--surface); border: 1px solid var(--line); }
.widget h3 { font-size: 18px; }
@media (max-width: 900px) {
  .topbar { background: rgba(7,9,13,.88); border-bottom: 1px solid var(--line); }
  .tabbar { background: #07090D; border-top: 1px solid var(--line); border-radius: 0; box-shadow: none; }
  .tabbar .navitem.active { background: #10141B; box-shadow: inset 0 -3px 0 var(--amber); }
}

/* Unit banner: the sky block with black type, like the reference's blue section */
.unit-banner { background: var(--skybg); color: #07090D; border-radius: 22px; box-shadow: 0 16px 50px rgba(62,143,216,.25); }
.unit-banner::before { opacity: 0; }
.unit-banner h2 { font-size: 30px; color: #07090D; }
.unit-banner p { color: #0B1A2A; font-weight: 600; }
.unit-banner .eyebrow { color: #0B2238; opacity: 1; }
.guidebtn { background: #07090D; color: var(--text); border: 0; border-radius: 999px; font-family: var(--font); text-transform: none; letter-spacing: 0; box-shadow: none; }
.guidebtn:hover { background: #10141B; }
.unit.locked-unit .unit-banner { background: var(--surface); color: var(--text-soft); border: 1px dashed var(--line-strong); box-shadow: none; }
.unit.locked-unit .unit-banner h2, .unit.locked-unit .unit-banner p, .unit.locked-unit .unit-banner .eyebrow { color: var(--text-soft); }
.unit.locked-unit .guidebtn { background: #0B0F15; color: var(--text-soft); }
/* "Saturated"-style stamp for completed stops */
.stamp { border: 2px solid var(--amber-deep); background: rgba(233,165,82,.95); color: #07090D; border-radius: 8px; width: auto; height: auto; padding: 5px 12px; transform: translateY(-50%) rotate(-6deg);
  font-family: var(--display); font-size: 13px; letter-spacing: .06em; right: 120px; }
.stamp span { margin: 0; } .stamp b { display: none; }
.level-head { background: var(--surface); color: var(--text); border: 1px solid var(--line); }
.level-badge { background: var(--amberbg); color: #07090D; font-family: var(--display); }
.lh-desc { color: var(--text-soft); }
.lh-title .muted { color: var(--text-faint); font-size: 11px; }

/* Waypoints */
.node { background: radial-gradient(circle at 50% 35%, #D6EEFB, #6DB7EC 45%, #2F7FC4); color: #07090D; filter: drop-shadow(0 6px 16px rgba(124,194,240,.35)); }
.node.done { background: radial-gradient(circle at 50% 35%, #F4C98A, #E9A552 50%, #B7731F); color: #07090D; filter: drop-shadow(0 6px 14px rgba(233,165,82,.25)); }
.node.locked { background: radial-gradient(circle at 50% 35%, #1A2130, #121821 60%, #0E131A); color: var(--text-faint); filter: none; }
.node-wrap.is-current::before { background: radial-gradient(circle, rgba(124,194,240,.35), transparent 70%); }
.route-base { stroke: var(--line-strong); } .route-done { stroke: var(--amber); }
.node-label { background: transparent; color: var(--text-soft); font-size: 10px; letter-spacing: .12em; }
.start-bubble { background: var(--amberbg); color: #07090D; font-size: 11px; }
.start-bubble::after { border-right-color: #E9A552; }
.node-wrap.flip .start-bubble::after { border-left-color: #E9A552; }
.node-pop { background: #10141B; border: 1px solid var(--line-strong); color: var(--text); box-shadow: var(--shadow-lg); }
.node-pop::before { border-bottom-color: var(--line-strong); }
.node-pop p { color: var(--text-soft); }
.node-pop .btn { background: var(--skybg); color: #07090D; }
.path-mascot { width: 96px; opacity: .9; }

/* Lesson */
.lesson-top .route-bar { background: repeating-linear-gradient(90deg, var(--line-strong) 0 6px, transparent 6px 12px); box-shadow: none; }
.lesson-hearts { background: var(--surface); border: 1px solid var(--line); color: var(--sky); font-family: var(--mono); }
.checkbar { background: rgba(7,9,13,.9); border-top: 1px solid var(--line); }
.checkbar.ok { background: #0E1A15; box-shadow: 0 -1px 0 var(--green); }
.checkbar.bad { background: #1D1013; box-shadow: 0 -1px 0 var(--red); }
.feedback .fi { background: transparent; border: 2px solid currentColor; }
.checkbar.ok .feedback, .checkbar.ok .feedback .fi { color: var(--green); }
.checkbar.bad .feedback, .checkbar.bad .feedback .fi { color: var(--red-text); }
.feedback h4 { font-size: 22px; }

/* Results */
.results h1 { color: var(--text); font-size: 44px; }
.rstat .rl { color: var(--text-faint); font-size: 11px; }
.rstat .rv { background: none; color: var(--amber); font-family: var(--display); }
.rstat.green .rv { color: var(--green); } .rstat.blue .rv { color: var(--sky); }
.mascot-big, .results .mascot-big { width: 150px; }

/* Onboarding */
.hero h1 { font-size: 64px; line-height: .95; max-width: 760px; }
.hero h1 em { font-style: normal; color: var(--amber); }
.hero p { color: var(--text-soft); }
.hero .mascot-hero { width: 150px; }
.floating-words span { color: var(--line-strong); }
.lang-card .nn { color: var(--sky); }
.lang-card.selected { border-color: var(--sky); background: rgba(124,194,240,.08); box-shadow: 0 0 0 1px var(--sky) inset; }
.onb-foot { border-top: 1px solid var(--line); background: rgba(7,9,13,.9); }
.feature .fe { background: #0B0F15; border: 1px solid var(--line); }
@media (max-width: 600px) { .hero h1 { font-size: 40px; } .ex-title { font-size: 24px; } .unit-banner h2 { font-size: 24px; } .results h1 { font-size: 32px; } }

/* Misc */
.modal-back { background: rgba(3,4,7,.72); }
#toast { background: #EEF3F8; color: #07090D; }
.practice-card .pi, .feature .fe { background: #0B0F15; border: 1px solid var(--line); }
.practice-card .count { color: var(--amber); font-size: 11px; }
.pill.accent { background: rgba(233,165,82,.12); color: var(--amber); font-size: 11px; }
.section-title { font-size: 20px; }
.guide-tip h4 { color: var(--amber); font-size: 16px; }
.switch.on { background: var(--sky); }
.seg button.on { background: var(--sky); color: #07090D; }
.avatar { background: #0B0F15; border-color: var(--amber); }
.ach.got .badge { background: var(--amberbg); }
.dline.B .db { background: rgba(124,194,240,.08); border-color: rgba(124,194,240,.3); }
.dline .mini-play { background: var(--sky); color: #07090D; }
.tone-choice .py { font-family: var(--font); }
.sound-tile .g { font-family: var(--font); }
.combo-burst { color: var(--amber); font-family: var(--display); text-transform: uppercase; }
.heard { color: var(--text-soft); }

.navitem .ni { display: grid; place-items: center; }
.navitem .ni svg { width: 22px; height: 22px; }
.navitem.active .ni { color: var(--amber); }
.floating-words { display: none !important; }
