/* Rawish AI Academy — dark-first navy identity; light available via toggle. */
:root {
  --bg: #0c1322;
  --surface: #131c30;
  --surface-2: #1a2540;
  --ink: #e8ecf6;
  --ink-soft: #c0c9dd;
  --muted: #8792ac;
  --line: #22304f;
  --line-strong: #31426b;
  --accent: #6f93e8;
  --accent-soft: #1c2a4d;
  --accent-ink: #a8bdf5;
  --ember: #ff6b3d;
  --gold: #d9ab4e;
  --gold-soft: #2c2513;
  --good: #5fc08b;
  --good-soft: #12281c;
  --warn: #d29a55;
  --warn-soft: #2f2517;
  --bad: #e07a64;
  --bad-soft: #331c16;
  --shadow: 0 1px 2px rgba(2,6,16,.4), 0 10px 28px -12px rgba(2,6,16,.6);
  --shadow-lg: 0 2px 6px rgba(2,6,16,.5), 0 24px 56px -16px rgba(2,6,16,.7);
  color-scheme: dark;
  --serif: 'Newsreader', Georgia, 'Times New Roman', serif;
  --sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, 'SF Mono', Menlo, monospace;
  --r: 10px;
  --r-lg: 16px;
}
:root[data-theme="light"] {
  --bg: #f6f5f1;
  --surface: #fffefb;
  --surface-2: #f0eee8;
  --ink: #1d1c19;
  --ink-soft: #45433d;
  --muted: #79766c;
  --line: #e3e0d6;
  --line-strong: #cfccc0;
  --accent: #2b3a67;
  --accent-soft: #e6e9f2;
  --accent-ink: #22305a;
  --ember: #e8562e;
  --gold: #9a7b2d;
  --gold-soft: #f3ecd9;
  --good: #33684a;
  --good-soft: #e2ede5;
  --warn: #92551a;
  --warn-soft: #f4e8d8;
  --bad: #96382e;
  --bad-soft: #f4e2df;
  --shadow: 0 1px 2px rgba(29,28,25,.05), 0 8px 24px -12px rgba(29,28,25,.12);
  --shadow-lg: 0 2px 4px rgba(29,28,25,.06), 0 20px 48px -16px rgba(29,28,25,.22);
  color-scheme: light;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--sans);
  background: var(--bg);
  color: var(--ink);
  font-size: 15.5px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}
::selection { background: var(--accent-soft); }

#app { display: flex; min-height: 100vh; }

/* ---------- sidebar ---------- */
#sidebar[hidden] { display: none; }
#sidebar {
  width: 232px; flex: 0 0 232px;
  border-right: 1px solid var(--line);
  padding: 28px 16px 20px;
  display: flex; flex-direction: column; gap: 28px;
  position: sticky; top: 0; height: 100vh;
  background: var(--bg);
}
.brand { display: flex; align-items: center; gap: 11px; padding: 0 10px; }
.brand-mark {
  width: 34px; height: 34px; border-radius: 9px;
  background: var(--accent); color: var(--bg);
  font-family: var(--serif); font-size: 21px; font-weight: 600;
  display: grid; place-items: center;
}
.brand-name { font-weight: 700; letter-spacing: .12em; font-size: 12.5px; }
.brand-name span { color: var(--muted); font-weight: 500; }

#nav { display: flex; flex-direction: column; gap: 2px; flex: 1; }
#nav a {
  display: flex; align-items: center; gap: 11px;
  padding: 9px 12px; border-radius: 8px;
  color: var(--ink-soft); text-decoration: none;
  font-size: 13px; font-weight: 600; letter-spacing: .05em;
  transition: background .12s, color .12s;
}
#nav a svg { width: 17px; height: 17px; opacity: .75; flex: none; }
#nav a:hover { background: var(--surface-2); color: var(--ink); }
#nav a.active { background: var(--accent-soft); color: var(--accent-ink); }
#nav a.active svg { opacity: 1; }
#nav a .nav-badge {
  margin-left: auto; background: var(--gold); color: var(--bg);
  border-radius: 99px; font-size: 10.5px; padding: 1px 7px; font-weight: 700;
}

#sidebar-foot { padding: 0 10px; font-size: 12px; color: var(--muted); line-height: 1.5; }
#sidebar-foot .streak-flame { color: var(--gold); font-weight: 700; }

/* ---------- main ---------- */
#view { flex: 1; min-width: 0; outline: none; }
.page { max-width: 880px; margin: 0 auto; padding: 52px 40px 100px; }
.page.wide { max-width: 1100px; }

.kicker {
  font-size: 11.5px; font-weight: 700; letter-spacing: .16em; text-transform: uppercase;
  color: var(--muted); margin-bottom: 10px;
}
.kicker b { color: var(--accent); }
h1.display {
  font-family: var(--serif); font-weight: 500; font-size: 40px; line-height: 1.15;
  letter-spacing: -.01em; margin-bottom: 10px; text-wrap: balance;
}
.lede { color: var(--ink-soft); font-size: 16.5px; max-width: 62ch; }

h2.section {
  font-family: var(--serif); font-size: 25px; font-weight: 500; line-height: 1.25;
  margin: 44px 0 14px; letter-spacing: -.005em;
}
h3.sub { font-size: 13px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); margin: 30px 0 12px; }

/* ---------- components ---------- */
.card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-lg); padding: 26px 28px;
  box-shadow: var(--shadow);
}
.card + .card { margin-top: 16px; }
.card.flat { box-shadow: none; }
.card.tinted { background: var(--surface-2); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 9px;
  font: 600 14px var(--sans); letter-spacing: .02em;
  padding: 11px 22px; border-radius: 10px; cursor: pointer;
  border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink);
  transition: transform .08s, box-shadow .12s, background .12s, border-color .12s;
  text-decoration: none; user-select: none;
}
.btn:hover { border-color: var(--muted); }
.btn:active { transform: translateY(1px); }
.btn.primary {
  background: var(--accent); border-color: var(--accent); color: #fdfdfa;
  box-shadow: 0 6px 20px -8px color-mix(in srgb, var(--accent) 65%, transparent);
}
.btn.primary:hover { filter: brightness(1.08); }
.btn.big { font-size: 16px; padding: 16px 34px; border-radius: 13px; letter-spacing: .04em; }
.btn.ghost { border-color: transparent; background: transparent; color: var(--ink-soft); }
.btn.ghost:hover { background: var(--surface-2); color: var(--ink); }
.btn.danger { color: var(--bad); border-color: var(--bad); background: transparent; }
.btn:disabled { opacity: .45; cursor: default; pointer-events: none; }

.pill {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 11.5px; font-weight: 700; letter-spacing: .07em;
  padding: 4px 11px; border-radius: 99px;
  background: var(--surface-2); color: var(--ink-soft);
  border: 1px solid var(--line);
}
.pill.accent { background: var(--accent-soft); color: var(--accent-ink); border-color: transparent; }
.pill.good { background: var(--good-soft); color: var(--good); border-color: transparent; }
.pill.warn { background: var(--warn-soft); color: var(--warn); border-color: transparent; }
.pill.bad { background: var(--bad-soft); color: var(--bad); border-color: transparent; }
.pill.gold { background: var(--gold-soft); color: var(--gold); border-color: transparent; }

.statgrid { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 12px; }
.stat {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r);
  padding: 14px 16px;
}
.stat .v { font-family: var(--serif); font-size: 27px; font-weight: 500; line-height: 1.1; }
.stat .v small { font-size: 15px; color: var(--muted); }
.stat .k { font-size: 11px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); margin-top: 3px; }

.meter { height: 6px; border-radius: 99px; background: var(--surface-2); overflow: hidden; }
.meter > i { display: block; height: 100%; border-radius: 99px; background: var(--accent); transition: width .5s cubic-bezier(.2,.8,.2,1); }
.meter.gold > i { background: var(--gold); }
.meter.good > i { background: var(--good); }

/* prose (lesson body) */
.prose { font-size: 16.5px; line-height: 1.75; color: var(--ink); }
.prose p { margin: 0 0 1.1em; }
.prose p:last-child { margin-bottom: 0; }
.prose strong { font-weight: 650; }
.prose em { font-family: var(--serif); }
.prose ul, .prose ol { margin: 0 0 1.1em 1.3em; }
.prose li { margin-bottom: .35em; }

.callout {
  border-left: 3px solid var(--accent); background: var(--surface);
  border-radius: 0 var(--r) var(--r) 0; padding: 16px 20px; margin: 18px 0;
  border-top: 1px solid var(--line); border-right: 1px solid var(--line); border-bottom: 1px solid var(--line);
}
.callout .label { font-size: 11px; font-weight: 700; letter-spacing: .13em; text-transform: uppercase; color: var(--accent-ink); margin-bottom: 6px; }
.callout.gold { border-left-color: var(--gold); }
.callout.gold .label { color: var(--gold); }
.callout.bad { border-left-color: var(--bad); }
.callout.bad .label { color: var(--bad); }
.callout.good { border-left-color: var(--good); }
.callout.good .label { color: var(--good); }

/* lesson phase rail */
.phase-rail {
  position: sticky; top: 0; z-index: 10;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
  margin: 0 -40px; padding: 12px 40px;
  display: flex; gap: 6px; align-items: center; overflow-x: auto;
}
.phase-rail .seg {
  font-size: 11.5px; font-weight: 600; letter-spacing: .04em;
  padding: 6px 13px; border-radius: 99px; white-space: nowrap;
  color: var(--muted); cursor: pointer; border: 1px solid transparent;
}
.phase-rail .seg:hover { color: var(--ink); }
.phase-rail .seg.here { background: var(--accent-soft); color: var(--accent-ink); border-color: transparent; }
.phase-rail .seg.done { color: var(--good); }
.phase-rail .mins { margin-left: auto; font-size: 11.5px; color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }

/* five-part framework */
.framework { display: grid; gap: 12px; }
.framework .fw {
  border: 1px solid var(--line); border-radius: var(--r); padding: 16px 19px; background: var(--surface);
}
.framework .fw .t { font-size: 11px; font-weight: 800; letter-spacing: .14em; margin-bottom: 6px; }
.fw.cap .t { color: var(--good); } .fw.lim .t { color: var(--bad); }
.fw.lev .t { color: var(--gold); } .fw.arc .t { color: var(--accent-ink); }
.fw.biz .t { color: var(--ink-soft); }

/* exam */
.q-card { margin-bottom: 18px; }
.q-num { font-size: 11px; font-weight: 800; letter-spacing: .12em; color: var(--muted); display: flex; gap: 8px; align-items: center; margin-bottom: 8px; }
.q-text { font-size: 17px; font-weight: 550; line-height: 1.5; margin-bottom: 14px; }
.opt {
  display: flex; gap: 12px; align-items: flex-start;
  border: 1.5px solid var(--line); border-radius: var(--r);
  padding: 12px 15px; margin-bottom: 8px; cursor: pointer;
  transition: border-color .1s, background .1s;
  background: var(--surface);
}
.opt:hover { border-color: var(--line-strong); background: var(--surface-2); }
.opt.sel { border-color: var(--accent); background: var(--accent-soft); }
.opt.correct { border-color: var(--good); background: var(--good-soft); }
.opt.wrong { border-color: var(--bad); background: var(--bad-soft); }
.opt .dot {
  width: 22px; height: 22px; flex: none; border-radius: 99px;
  border: 1.5px solid var(--line-strong); display: grid; place-items: center;
  font-size: 11px; font-weight: 700; color: var(--muted); margin-top: 1px;
}
.opt.sel .dot { border-color: var(--accent); background: var(--accent); color: #fff; }
.opt.correct .dot { border-color: var(--good); background: var(--good); color: #fff; }
.opt.wrong .dot { border-color: var(--bad); background: var(--bad); color: #fff; }

.conf { display: flex; gap: 7px; margin-top: 10px; align-items: center; }
.conf .lab { font-size: 11.5px; color: var(--muted); font-weight: 600; letter-spacing: .05em; }
.conf button {
  font: 600 11.5px var(--sans); padding: 4px 12px; border-radius: 99px;
  border: 1px solid var(--line); background: var(--surface); color: var(--muted); cursor: pointer;
}
.conf button.sel { background: var(--ink); border-color: var(--ink); color: var(--bg); }

textarea.answer {
  width: 100%; min-height: 120px; resize: vertical;
  font: 400 15px/1.6 var(--sans); color: var(--ink);
  background: var(--surface); border: 1.5px solid var(--line); border-radius: var(--r);
  padding: 13px 15px;
}
textarea.answer:focus { outline: none; border-color: var(--accent); }

.rubric-item { display: flex; gap: 10px; align-items: flex-start; padding: 8px 0; border-bottom: 1px dashed var(--line); cursor: pointer; }
.rubric-item:last-child { border-bottom: 0; }
.rubric-item input { margin-top: 5px; accent-color: var(--good); width: 15px; height: 15px; }

.score-hero { text-align: center; padding: 40px 20px 30px; }
.score-hero .big-num { font-family: var(--serif); font-size: 76px; font-weight: 500; line-height: 1; }
.score-hero .big-num small { font-size: 30px; color: var(--muted); }

/* journey */
.phase-block { margin-bottom: 34px; }
.phase-head { display: flex; align-items: baseline; gap: 12px; margin-bottom: 12px; }
.phase-head .n { font-family: var(--serif); font-size: 15px; color: var(--gold); font-weight: 600; }
.phase-head .t { font-family: var(--serif); font-size: 20px; font-weight: 500; }
.week-row {
  display: flex; align-items: center; gap: 14px;
  border: 1px solid var(--line); background: var(--surface);
  border-radius: var(--r); padding: 13px 18px; margin-bottom: 7px;
  cursor: pointer; transition: border-color .1s, box-shadow .12s;
}
.week-row:hover { border-color: var(--line-strong); box-shadow: var(--shadow); }
.week-row.current { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.week-row .wnum { font: 600 12px var(--mono); color: var(--muted); width: 38px; flex: none; }
.week-row .wtitle { font-weight: 600; font-size: 14.5px; flex: 1; min-width: 0; }
.week-row .dots { display: flex; gap: 4px; }
.week-row .dots i {
  width: 9px; height: 9px; border-radius: 99px; background: var(--surface-2); border: 1px solid var(--line-strong);
}
.week-row .dots i.done { background: var(--good); border-color: var(--good); }
.week-row .dots i.partial { background: var(--gold); border-color: var(--gold); }
.week-expand { border: 1px solid var(--line); border-top: 0; border-radius: 0 0 var(--r) var(--r); margin: -8px 0 8px; padding: 14px 18px 10px; background: var(--surface-2); }
.day-line { display: flex; align-items: center; gap: 11px; padding: 7px 0; border-bottom: 1px dashed var(--line); font-size: 14px; }
.day-line:last-child { border-bottom: 0; }
.day-line .d { font: 600 11px var(--mono); color: var(--muted); width: 28px; }
.day-line a { color: var(--ink); text-decoration: none; font-weight: 550; }
.day-line a:hover { color: var(--accent-ink); text-decoration: underline; }

.youarehere { display: flex; align-items: center; gap: 10px; margin: 18px 0 26px; }
.youarehere .track { flex: 1; height: 8px; border-radius: 99px; background: var(--surface-2); position: relative; overflow: visible; }
.youarehere .track > i { position: absolute; inset: 0 auto 0 0; border-radius: 99px; background: linear-gradient(90deg, var(--good), var(--accent)); }
.youarehere .marker {
  position: absolute; top: 50%; transform: translate(-50%, -50%);
  width: 16px; height: 16px; border-radius: 99px; background: var(--accent);
  border: 3px solid var(--bg); box-shadow: 0 0 0 1.5px var(--accent);
}

/* knowledge map */
.kmap-node { cursor: pointer; }
.kmap-tip {
  position: fixed; z-index: 50; pointer-events: none;
  background: var(--ink); color: var(--bg); font-size: 12.5px; line-height: 1.45;
  border-radius: 8px; padding: 8px 12px; max-width: 260px; box-shadow: var(--shadow-lg);
}

/* chat / tutor */
.chat { display: flex; flex-direction: column; gap: 10px; }
.msg { max-width: 85%; padding: 11px 15px; border-radius: 14px; font-size: 14.5px; line-height: 1.6; }
.msg.user { align-self: flex-end; background: var(--accent); color: #fdfdfa; border-bottom-right-radius: 4px; }
.msg.bot { align-self: flex-start; background: var(--surface-2); border: 1px solid var(--line); border-bottom-left-radius: 4px; }
.msg.bot .modeltag { display: block; font-size: 10px; font-weight: 700; letter-spacing: .1em; color: var(--muted); margin-bottom: 4px; }
.chat-input { display: flex; gap: 9px; margin-top: 12px; }
.chat-input input {
  flex: 1; font: 400 14.5px var(--sans); padding: 11px 15px;
  border: 1.5px solid var(--line); border-radius: 10px; background: var(--surface); color: var(--ink);
}
.chat-input input:focus { outline: none; border-color: var(--accent); }

/* tables */
table.clean { width: 100%; border-collapse: collapse; font-size: 14px; }
table.clean th { text-align: left; font-size: 11px; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); font-weight: 700; padding: 8px 10px; border-bottom: 1px solid var(--line-strong); }
table.clean td { padding: 9px 10px; border-bottom: 1px solid var(--line); }
table.clean tr:last-child td { border-bottom: 0; }
.num { font-variant-numeric: tabular-nums; font-family: var(--mono); font-size: 13px; }

/* forms */
.field { margin-bottom: 18px; }
.field label { display: block; font-size: 12px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); margin-bottom: 7px; }
.field input[type=text], .field input[type=date], .field input[type=password], .field select {
  width: 100%; font: 400 15px var(--sans); color: var(--ink);
  padding: 11px 14px; border: 1.5px solid var(--line); border-radius: 10px; background: var(--surface);
}
.field input:focus, .field select:focus { outline: none; border-color: var(--accent); }
.daypick { display: flex; gap: 6px; }
.daypick button {
  flex: 1; font: 600 12px var(--sans); padding: 9px 0; border-radius: 8px;
  border: 1.5px solid var(--line); background: var(--surface); color: var(--muted); cursor: pointer;
}
.daypick button.sel { background: var(--accent); border-color: var(--accent); color: #fdfdfa; }

.toggle-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 14px 0; border-bottom: 1px solid var(--line); }
.toggle-row:last-child { border-bottom: 0; }
.toggle-row .t { font-weight: 600; font-size: 14.5px; }
.toggle-row .d { font-size: 13px; color: var(--muted); max-width: 46ch; }
.switch { position: relative; width: 42px; height: 24px; flex: none; cursor: pointer; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch .sl { position: absolute; inset: 0; border-radius: 99px; background: var(--line-strong); transition: .15s; }
.switch .sl:before { content: ''; position: absolute; width: 18px; height: 18px; border-radius: 99px; left: 3px; top: 3px; background: #fff; transition: .15s; }
.switch input:checked + .sl { background: var(--good); }
.switch input:checked + .sl:before { transform: translateX(18px); }

/* visuals */
.visual-frame {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg);
  padding: 24px; margin: 20px 0; box-shadow: var(--shadow);
}
.visual-frame svg { max-width: 100%; height: auto; display: block; margin: 0 auto; }
.visual-frame .v-title { font-family: var(--serif); font-size: 18px; font-weight: 550; margin-bottom: 3px; }
.visual-frame .v-caption { font-size: 13px; color: var(--muted); margin-bottom: 18px; }
.walkthrough { counter-reset: wt; margin-top: 18px; border-top: 1px solid var(--line); padding-top: 6px; }
.walkthrough .wt {
  display: flex; gap: 13px; padding: 10px 0; font-size: 14px; color: var(--ink-soft); line-height: 1.6;
}
.walkthrough .wt:before {
  counter-increment: wt; content: counter(wt);
  width: 22px; height: 22px; flex: none; border-radius: 99px; margin-top: 2px;
  background: var(--accent-soft); color: var(--accent-ink);
  font-size: 11.5px; font-weight: 700; display: grid; place-items: center;
}

/* comparison table visual */
.viz-comparison { width: 100%; border-collapse: collapse; font-size: 14px; }
.viz-comparison th { font-size: 12px; letter-spacing: .07em; text-transform: uppercase; padding: 10px 13px; background: var(--surface-2); border: 1px solid var(--line); }
.viz-comparison td { padding: 11px 13px; border: 1px solid var(--line); vertical-align: top; }
.viz-comparison td.aspect { font-weight: 650; font-size: 13px; width: 18%; background: var(--surface-2); }

/* misc */
.empty { text-align: center; color: var(--muted); padding: 60px 20px; }
.empty .art { font-family: var(--serif); font-size: 40px; opacity: .4; margin-bottom: 8px; }
hr.soft { border: 0; border-top: 1px solid var(--line); margin: 26px 0; }
.row { display: flex; gap: 12px; align-items: center; }
.row.between { justify-content: space-between; }
.row.wrap { flex-wrap: wrap; }
.grow { flex: 1; min-width: 0; }
.mt8 { margin-top: 8px; } .mt16 { margin-top: 16px; } .mt24 { margin-top: 24px; } .mt32 { margin-top: 32px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.fade-in { animation: fadeIn .35s cubic-bezier(.2,.8,.2,1); }
@keyframes fadeIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* setup */
.setup-wrap { min-height: 100vh; display: grid; place-items: center; padding: 40px 20px; }
.setup-card { width: 100%; max-width: 520px; }
.setup-card .welcome-mark {
  width: 56px; height: 56px; border-radius: 15px; background: var(--accent); color: #fdfdfa;
  font-family: var(--serif); font-size: 33px; display: grid; place-items: center; margin: 0 auto 20px;
}

@media (max-width: 900px) {
  #app { flex-direction: column; }
  #sidebar { width: 100%; flex: none; height: auto; position: static; flex-direction: row; align-items: center; padding: 12px 16px; gap: 14px; overflow-x: auto; }
  #nav { flex-direction: row; }
  #nav a { padding: 7px 10px; }
  #nav a span.nav-label { display: none; }
  #sidebar-foot { display: none; }
  .page { padding: 28px 18px 80px; }
  .phase-rail { margin: 0 -18px; padding: 10px 18px; }
}

@media print {
  #sidebar, .phase-rail, .btn { display: none !important; }
}

/* Listen mode (text-to-speech) */
.tts-btn {
  display: inline-grid; place-items: center;
  width: 26px; height: 26px; margin-left: 10px; vertical-align: middle;
  border: 1px solid var(--line-strong); border-radius: 99px;
  background: var(--surface); color: var(--ink-soft); cursor: pointer;
  transition: color .12s, border-color .12s, background .12s;
}
.tts-btn:hover { color: var(--accent-ink); border-color: var(--accent); background: var(--accent-soft); }
.tts-master { gap: 8px; }
.tts-reading { outline: 2px solid var(--accent); outline-offset: 6px; border-radius: var(--r); }
#tts-bar {
  position: fixed; bottom: 18px; right: 18px; z-index: 60;
  display: none; align-items: center; gap: 8px;
  background: var(--surface); border: 1px solid var(--line-strong);
  border-radius: 99px; padding: 8px 14px; box-shadow: var(--shadow-lg);
}
#tts-bar.active { display: flex; }
#tts-bar button {
  font: 600 13px var(--sans); border: 0; background: transparent;
  color: var(--ink); cursor: pointer; padding: 4px 6px; border-radius: 8px;
}
#tts-bar button:hover { background: var(--surface-2); }
#tts-bar .tts-label { font-size: 12px; color: var(--muted); max-width: 220px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#tts-bar select {
  font: 500 12px var(--sans); max-width: 140px;
  border: 1px solid var(--line); border-radius: 8px; padding: 3px 6px;
  background: var(--surface); color: var(--ink-soft);
}
@media (max-width: 700px) { #tts-bar select { display: none; } }

/* ---------- visual retention upgrades ---------- */
h2.section.with-icon { display: flex; align-items: center; gap: 11px; }
.sec-icon {
  width: 34px; height: 34px; flex: none; border-radius: 10px;
  display: grid; place-items: center;
  background: var(--accent-soft); color: var(--accent-ink);
}
.sec-icon svg { width: 18px; height: 18px; }

.week-dots { display: inline-flex; gap: 4px; margin-left: 10px; vertical-align: middle; }
.week-dots i { width: 7px; height: 7px; border-radius: 99px; background: var(--surface-2); border: 1px solid var(--line-strong); }
.week-dots i.past { background: var(--good); border-color: var(--good); }
.week-dots i.here { background: var(--accent); border-color: var(--accent); transform: scale(1.35); }

.term-chips { display: flex; flex-wrap: wrap; gap: 7px; margin: 8px 0 12px; }
.term-chips span {
  font-size: 12px; font-weight: 650; letter-spacing: .02em;
  padding: 4px 12px; border-radius: 99px;
  background: var(--gold-soft); color: var(--gold);
  border: 1px solid color-mix(in srgb, var(--gold) 30%, transparent);
}

/* framework journey rail */
.fw-rail { position: relative; padding-left: 26px; }
.fw-rail::before {
  content: ''; position: absolute; left: 25px; top: 28px; bottom: 28px; width: 2px;
  background: linear-gradient(var(--good), var(--bad), var(--gold), var(--accent), var(--ink-soft));
  opacity: .35; border-radius: 2px;
}
.fw-step { position: relative; display: flex; gap: 18px; padding: 12px 0; }
.fw-node {
  position: relative; z-index: 1; flex: none;
  width: 52px; height: 52px; border-radius: 16px; margin-left: -26px;
  display: grid; place-items: center;
  background: var(--surface); border: 2px solid var(--line-strong);
  box-shadow: var(--shadow);
}
.fw-node svg { width: 22px; height: 22px; }
.fw-node .fw-n {
  position: absolute; top: -7px; right: -7px;
  width: 19px; height: 19px; border-radius: 99px;
  font: 700 10.5px var(--sans);
  display: grid; place-items: center;
  background: var(--ink); color: var(--bg);
}
.fw-step.cap .fw-node { color: var(--good); border-color: var(--good); }
.fw-step.lim .fw-node { color: var(--bad); border-color: var(--bad); }
.fw-step.lev .fw-node { color: var(--gold); border-color: var(--gold); }
.fw-step.arc .fw-node { color: var(--accent-ink); border-color: var(--accent); }
.fw-step.biz .fw-node { color: var(--ink-soft); border-color: var(--line-strong); }
.fw-body {
  flex: 1; min-width: 0;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r);
  padding: 15px 19px;
}
.fw-step.cap .fw-body { border-left: 3px solid var(--good); }
.fw-step.lim .fw-body { border-left: 3px solid var(--bad); }
.fw-step.lev .fw-body { border-left: 3px solid var(--gold); }
.fw-step.arc .fw-body { border-left: 3px solid var(--accent); }
.fw-step.biz .fw-body { border-left: 3px solid var(--line-strong); }
.fw-body .t {
  font-size: 11px; font-weight: 800; letter-spacing: .14em; margin-bottom: 7px;
  display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap;
}
.fw-step.cap .fw-body .t { color: var(--good); }
.fw-step.lim .fw-body .t { color: var(--bad); }
.fw-step.lev .fw-body .t { color: var(--gold); }
.fw-step.arc .fw-body .t { color: var(--accent-ink); }
.fw-step.biz .fw-body .t { color: var(--ink-soft); }
.fw-sub { font-size: 11px; font-weight: 500; letter-spacing: .01em; text-transform: none; color: var(--muted); }

/* connections constellation */
.conn-svg { max-width: 560px; display: block; margin: 4px auto 10px; }
.conn-node:hover rect { fill: var(--good); }
.conn-node:hover text { fill: var(--bg); }
.conn-list { list-style: none; margin: 0; padding: 0; }
.conn-list li { display: flex; gap: 10px; align-items: flex-start; padding: 7px 0; border-top: 1px dashed var(--line); font-size: 14.5px; line-height: 1.6; }
.conn-list li:first-child { border-top: 0; }
.conn-ref {
  flex: none; font: 600 11px var(--mono); letter-spacing: .04em;
  padding: 2px 9px; border-radius: 99px; margin-top: 2px;
  background: var(--good-soft); color: var(--good);
}

/* ---------- Rawish AI Academy motion & editorial accents ---------- */
.kicker::before { content: '—'; color: var(--ember); margin-right: 8px; font-weight: 800; }
.kicker b { color: var(--ember); }
.brand-name { font-size: 11px; }
.streak-flame { animation: emberPulse 2.6s ease-in-out infinite; }

/* reveal on scroll */
.reveal { opacity: 0; transform: translateY(14px); }
.reveal.revealed { opacity: 1; transform: none; transition: opacity .55s cubic-bezier(.2,.8,.2,1), transform .55s cubic-bezier(.2,.8,.2,1); }
.fw-step.reveal.revealed { transition-delay: calc(var(--stagger, 0) * 90ms); }
.term-chips span { animation: popIn .4s cubic-bezier(.3,1.4,.5,1) backwards; }
.term-chips span:nth-child(1) { animation-delay: .05s; } .term-chips span:nth-child(2) { animation-delay: .12s; }
.term-chips span:nth-child(3) { animation-delay: .19s; } .term-chips span:nth-child(4) { animation-delay: .26s; }
.term-chips span:nth-child(5) { animation-delay: .33s; } .term-chips span:nth-child(6) { animation-delay: .4s; }

@keyframes popIn { from { opacity: 0; transform: scale(.7); } to { opacity: 1; transform: scale(1); } }
@keyframes emberPulse { 0%,100% { opacity: 1; } 50% { opacity: .55; } }
@keyframes drawStroke { from { stroke-dashoffset: var(--draw-len, 1400); } to { stroke-dashoffset: 0; } }
@keyframes growX { from { transform: scaleX(0); } to { transform: scaleX(1); } }
@keyframes floaty { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-5px); } }
@keyframes orbitSpin { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }
@keyframes softPulse { 0%,100% { opacity: 1; } 50% { opacity: .35; } }

/* SVG animation hooks (tagged inside the visual engine) */
.revealed .anim-draw, .visual-frame.revealed .anim-draw {
  stroke-dasharray: var(--draw-len, 1400);
  animation: drawStroke 1.6s cubic-bezier(.4,0,.2,1) both;
}
.revealed .anim-growx { transform-origin: left center; animation: growX .8s cubic-bezier(.2,.8,.2,1) backwards; }
.revealed .anim-growx:nth-of-type(2) { animation-delay: .1s; }
.anim-pulse { animation: softPulse 2.4s ease-in-out infinite; }
.anim-float { animation: floaty 4.5s ease-in-out infinite; }
.anim-orbit { animation: orbitSpin 14s linear infinite; }
.anim-pop { animation: popIn .45s cubic-bezier(.3,1.4,.5,1) backwards; }

/* count-up numbers get tabular alignment while animating */
.counting { font-variant-numeric: tabular-nums; }

/* primary CTA: quiet ember lift on hover */
.btn.primary:hover { box-shadow: 0 8px 26px -8px color-mix(in srgb, var(--ember) 45%, var(--accent) 30%); }

/* theme toggle */
.theme-toggle {
  display: inline-flex; align-items: center; gap: 6px;
  font: 600 11px var(--sans); letter-spacing: .06em;
  color: var(--muted); background: none; border: 1px solid var(--line);
  border-radius: 99px; padding: 4px 11px; cursor: pointer; margin-top: 8px;
}
.theme-toggle:hover { color: var(--ink); border-color: var(--line-strong); }

@media (prefers-reduced-motion: reduce) {
  .reveal { opacity: 1; transform: none; }
  .anim-draw, .anim-growx, .anim-pulse, .anim-float, .anim-orbit, .anim-pop,
  .term-chips span, .streak-flame, .fade-in, .pulsing { animation: none !important; transition: none !important; }
}

/* structured-visual animations play when the visual scrolls into view */
.visual-frame .anim-pop, .visual-frame .anim-growx { animation-play-state: paused; }
.visual-frame.revealed .anim-pop, .visual-frame.revealed .anim-growx,
.visual-frame:not(.reveal) .anim-pop, .visual-frame:not(.reveal) .anim-growx { animation-play-state: running; }
tr.anim-pop { transform-origin: left center; }

/* curated video reference card */
.video-card {
  display: flex; align-items: center; gap: 16px; width: 100%;
  background: var(--surface); border: 1.5px solid var(--line);
  border-radius: var(--r-lg); padding: 14px 18px;
  text-decoration: none; color: var(--ink);
  transition: border-color .12s, box-shadow .15s, transform .1s;
}
.video-card:hover { border-color: var(--ember); box-shadow: var(--shadow-lg); transform: translateY(-1px); }
.vc-play {
  width: 44px; height: 44px; flex: none; border-radius: 99px;
  display: grid; place-items: center; font-size: 15px; padding-left: 3px;
  background: color-mix(in srgb, var(--ember) 16%, transparent); color: var(--ember);
  border: 1.5px solid var(--ember);
}
.video-card:hover .vc-play { background: var(--ember); color: #fff; }
.vc-kicker { display: block; font-size: 10.5px; font-weight: 800; letter-spacing: .12em; color: var(--ember); margin-bottom: 2px; }
.video-card b { font-size: 14.5px; }
.vc-why { display: block; font-size: 12.5px; color: var(--muted); margin-top: 2px; }
.vc-arrow { color: var(--muted); font-size: 18px; flex: none; }

/* inline video player */
.video-block .video-card { width: 100%; cursor: pointer; font: inherit; }
.video-player { margin-top: 10px; border-radius: var(--r-lg); overflow: hidden; border: 1px solid var(--line-strong); box-shadow: var(--shadow-lg); }
.video-player iframe { display: block; width: 100%; aspect-ratio: 16 / 9; border: 0; }

/* simplify button + discussion */
.simplify-btn { font-size: 11px; padding: 2px 10px; margin-left: 10px; vertical-align: middle; color: var(--muted); border: 1px dashed var(--line-strong); border-radius: 99px; }
.simplify-btn:hover { color: var(--accent-ink); border-color: var(--accent); }
#discuss-list .group-row { padding: 10px 0; }
