/* Seventy-Three — styles */
:root {
  --bg: #f6f2ea;
  --bg-2: #efe8dc;
  --surface: #ffffff;
  --surface-2: #faf7f1;
  --text: #1d2230;
  --muted: #6a6f7c;
  --line: #e4dccd;
  --line-strong: #d3c7b2;
  --accent: #1f3a5f;
  --accent-2: #2c5282;
  --on-accent: #ffffff;
  --gold: #e8a91b;
  --gold-soft: #fff3d1;
  --good: #23955a;
  --good-soft: #e3f5ea;
  --bad: #d4453a;
  --bad-soft: #fde8e6;
  --shadow: 0 1px 2px rgba(30, 25, 15, .06), 0 6px 20px rgba(30, 25, 15, .07);
  --shadow-lg: 0 10px 40px rgba(30, 25, 15, .16);
  --radius: 16px;
  --radius-sm: 10px;
  --font: 'Nunito', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --serif: 'Fraunces', Georgia, 'Times New Roman', serif;
  --topbar: 58px;
  --tabbar: 64px;

  --c-pent: #dc7418;
  --c-hist: #c2402f;
  --c-wis: #22955a;
  --c-proph: #7a48c4;
  --c-gosp: #c79300;
  --c-acts: #0e978b;
  --c-paul: #2b67cf;
  --c-cath: #c63c7d;
  --c-apoc: #4d5a74;
  --c: var(--accent);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #12141a; --bg-2: #181b23; --surface: #1c2029; --surface-2: #222733; --text: #eceef3; --muted: #9aa1b1;
    --line: #2d3240; --line-strong: #3b4252; --accent: #8fb3ea; --accent-2: #a9c5f0; --on-accent: #0f1726;
    --gold: #f5bf3c; --gold-soft: #3a3118; --good: #43c482; --good-soft: #163327; --bad: #f06b5f; --bad-soft: #3a1c1a;
    --shadow: 0 1px 2px rgba(0,0,0,.3), 0 6px 20px rgba(0,0,0,.25); --shadow-lg: 0 10px 40px rgba(0,0,0,.5);
    --c-pent: #f08f3a; --c-hist: #e35f4c; --c-wis: #3dba76; --c-proph: #9c74e3; --c-gosp: #e0b22a;
    --c-acts: #27b8aa; --c-paul: #5b8eee; --c-cath: #e2669f; --c-apoc: #8e9bb8;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #12141a; --bg-2: #181b23; --surface: #1c2029; --surface-2: #222733; --text: #eceef3; --muted: #9aa1b1;
  --line: #2d3240; --line-strong: #3b4252; --accent: #8fb3ea; --accent-2: #a9c5f0; --on-accent: #0f1726;
  --gold: #f5bf3c; --gold-soft: #3a3118; --good: #43c482; --good-soft: #163327; --bad: #f06b5f; --bad-soft: #3a1c1a;
  --shadow: 0 1px 2px rgba(0,0,0,.3), 0 6px 20px rgba(0,0,0,.25); --shadow-lg: 0 10px 40px rgba(0,0,0,.5);
  --c-pent: #f08f3a; --c-hist: #e35f4c; --c-wis: #3dba76; --c-proph: #9c74e3; --c-gosp: #e0b22a;
  --c-acts: #27b8aa; --c-paul: #5b8eee; --c-cath: #e2669f; --c-apoc: #8e9bb8;
  color-scheme: dark;
}

/* one colour per section, everywhere */
[data-sec="pent"] { --c: var(--c-pent); }
[data-sec="hist"] { --c: var(--c-hist); }
[data-sec="wis"] { --c: var(--c-wis); }
[data-sec="proph"] { --c: var(--c-proph); }
[data-sec="gosp"] { --c: var(--c-gosp); }
[data-sec="acts"] { --c: var(--c-acts); }
[data-sec="paul"] { --c: var(--c-paul); }
[data-sec="cath"] { --c: var(--c-cath); }
[data-sec="apoc"] { --c: var(--c-apoc); }
[data-sec] { --c-soft: color-mix(in srgb, var(--c) 14%, var(--surface)); --c-ink: color-mix(in srgb, var(--c) 72%, var(--text)); }

/* ---------- base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text); font-family: var(--font); font-size: 16px; line-height: 1.5;
  padding-top: var(--topbar); padding-bottom: calc(var(--tabbar) + env(safe-area-inset-bottom));
  -webkit-tap-highlight-color: transparent; min-height: 100vh;
}
body.in-activity { padding-bottom: env(safe-area-inset-bottom); }
h1, h2, h3, h4 { font-family: var(--serif); line-height: 1.2; margin: 0 0 .4em; letter-spacing: -.01em; }
h1 { font-size: clamp(1.6rem, 4vw, 2.2rem); }
h2 { font-size: 1.35rem; }
h3 { font-size: 1.1rem; }
p { margin: 0 0 .8em; }
a { color: var(--accent-2); }
button { font: inherit; color: inherit; }
#view { outline: none; max-width: 1080px; margin: 0 auto; padding: 16px; }
.muted { color: var(--muted); }
.small { font-size: .86rem; }
.center { text-align: center; }
[hidden] { display: none !important; }

/* ---------- top bar & tab bar ---------- */
.topbar {
  position: fixed; inset: 0 0 auto 0; height: var(--topbar); z-index: 50; display: flex; align-items: center; gap: 12px;
  padding: 0 14px; background: color-mix(in srgb, var(--bg) 86%, transparent); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 9px; text-decoration: none; color: var(--text); font-weight: 800; }
.logo {
  display: grid; place-items: center; width: 34px; height: 34px; border-radius: 10px; font-family: var(--serif); font-size: 1rem;
  color: #fff; background: conic-gradient(from 200deg, var(--c-pent), var(--c-hist), var(--c-wis), var(--c-proph), var(--c-gosp), var(--c-acts), var(--c-paul), var(--c-cath), var(--c-apoc), var(--c-pent));
  box-shadow: inset 0 0 0 3px rgba(255,255,255,.25);
}
.brand-name { font-family: var(--serif); font-size: 1.15rem; }
.topnav { display: none; gap: 4px; margin-left: 12px; }
.topnav a { text-decoration: none; color: var(--muted); font-weight: 700; padding: 7px 12px; border-radius: 999px; }
.topnav a:hover { color: var(--text); background: var(--bg-2); }
.topnav a.active { color: var(--text); background: var(--surface); box-shadow: var(--shadow); }
.hdr-pills { margin-left: auto; display: flex; align-items: center; gap: 6px; }
.pill { background: var(--surface); border: 1px solid var(--line); border-radius: 999px; padding: 3px 10px; font-size: .9rem; white-space: nowrap; }
.pill:first-child { color: var(--gold); }
.pill b { color: var(--text); }
.icon-btn { border: 0; background: transparent; width: 40px; height: 40px; border-radius: 12px; cursor: pointer; font-size: 1.15rem; display: grid; place-items: center; }
.icon-btn:hover { background: var(--bg-2); }
.tabbar {
  position: fixed; inset: auto 0 0 0; z-index: 50; display: flex; height: calc(var(--tabbar) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom); background: color-mix(in srgb, var(--surface) 92%, transparent);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); border-top: 1px solid var(--line);
}
.tabbar a { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px; text-decoration: none; color: var(--muted); font-size: .72rem; font-weight: 700; }
.tabbar a span { font-size: 1.3rem; filter: grayscale(.8); opacity: .75; transition: transform .15s; }
.tabbar a.active { color: var(--text); }
.tabbar a.active span { filter: none; opacity: 1; transform: translateY(-2px) scale(1.08); }
body.in-activity .tabbar { display: none; }
@media (min-width: 900px) {
  .topnav { display: flex; }
  .tabbar { display: none; }
  body { padding-bottom: 24px; }
}
@media (max-width: 380px) { .brand-name { display: none; } }

/* ---------- controls ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; border: 1px solid var(--line-strong); background: var(--surface);
  color: var(--text); padding: 10px 16px; border-radius: 12px; font-weight: 800; cursor: pointer; text-decoration: none;
  transition: transform .08s, box-shadow .15s, background .15s; min-height: 44px; line-height: 1.2;
}
.btn:hover { background: var(--surface-2); }
.btn:active { transform: translateY(1px) scale(.99); }
.btn:disabled { opacity: .55; cursor: default; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); box-shadow: 0 3px 0 color-mix(in srgb, var(--accent) 70%, #000); }
.btn.primary:hover { background: var(--accent-2); }
.act[data-sec] .btn.primary, .result[data-sec] .btn.primary { background: var(--c); border-color: var(--c); color: #fff; box-shadow: 0 3px 0 color-mix(in srgb, var(--c) 65%, #000); }
.btn.ghost { background: transparent; }
.btn.danger { border-color: var(--bad); color: var(--bad); background: transparent; }
.btn.small { padding: 6px 12px; min-height: 34px; font-size: .9rem; border-radius: 10px; }
.btn.big { padding: 13px 22px; font-size: 1.05rem; min-height: 50px; }
.btn.full { width: 100%; }
.btn.ghost-light { background: rgba(255,255,255,.18); border-color: rgba(255,255,255,.4); color: #fff; }
.link-btn { border: 0; background: none; color: var(--accent-2); cursor: pointer; padding: 0; font-weight: 700; }
.input {
  width: 100%; font: inherit; font-size: 1rem; color: var(--text); background: var(--surface); border: 2px solid var(--line); border-radius: 12px;
  padding: 10px 12px; min-height: 46px; outline: none; transition: border-color .15s, box-shadow .15s;
}
.input:focus { border-color: var(--accent-2); box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent-2) 18%, transparent); }
textarea.input { resize: vertical; min-height: 90px; }
select.input { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%); background-position: calc(100% - 18px) 50%, calc(100% - 12px) 50%; background-size: 6px 6px; background-repeat: no-repeat; padding-right: 34px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); margin-bottom: 16px; }
.row-btns { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0; }
.tag { display: inline-block; font-size: .78rem; font-weight: 700; padding: 2px 8px; border-radius: 999px; background: var(--bg-2); color: var(--muted); }
.dc { display: inline-block; font-size: .62rem; font-weight: 800; letter-spacing: .04em; padding: 1px 5px; border-radius: 5px; background: var(--gold-soft); color: color-mix(in srgb, var(--gold) 65%, var(--text)); border: 1px solid color-mix(in srgb, var(--gold) 45%, transparent); vertical-align: middle; margin-left: 4px; }
.dc-tag { background: var(--gold-soft); color: color-mix(in srgb, var(--gold) 65%, var(--text)); }

.chip {
  display: inline-flex; align-items: center; gap: 5px; padding: 3px 10px; border-radius: 999px; font-weight: 700; font-size: .92rem;
  background: var(--c-soft, var(--bg-2)); color: var(--c-ink, var(--text)); border: 1px solid color-mix(in srgb, var(--c) 35%, transparent);
  white-space: nowrap; cursor: default; vertical-align: middle; line-height: 1.4;
}
.chip[data-n] { cursor: pointer; }
.chip.plain { --c-soft: var(--bg-2); --c-ink: var(--text); border-color: var(--line); }
.chip-num { font-size: .75rem; opacity: .75; }
.chip.hl { box-shadow: 0 0 0 3px color-mix(in srgb, var(--c) 45%, transparent); background: var(--c); color: #fff; }
.chip.dim { opacity: .38; }
.chip.missed-chip { text-decoration: line-through; text-decoration-color: var(--bad); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chips.big .chip { font-size: 1rem; padding: 6px 12px; }
.num-badge {
  display: inline-grid; place-items: center; min-width: 30px; height: 30px; padding: 0 6px; border-radius: 9px; font-weight: 800; font-size: .88rem;
  background: var(--c); color: #fff; flex-shrink: 0;
}
.stars { display: inline-flex; gap: 1px; letter-spacing: 0; }
.stars i { font-style: normal; color: var(--line-strong); }
.stars i.on { color: var(--gold); text-shadow: 0 1px 0 color-mix(in srgb, var(--gold) 50%, #000); }

/* toggle switch / segmented / checks */
.switch { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; font-weight: 700; }
.switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch .sw { width: 44px; height: 26px; border-radius: 99px; background: var(--line-strong); position: relative; transition: background .2s; flex-shrink: 0; }
.switch .sw::after { content: ''; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.25); transition: transform .2s; }
.switch input:checked + .sw { background: var(--good); }
.switch input:checked + .sw::after { transform: translateX(18px); }
.switch input:focus-visible + .sw { outline: 3px solid var(--accent-2); outline-offset: 2px; }
.seg { display: flex; flex-wrap: wrap; gap: 6px; }
.seg label { cursor: pointer; }
.seg input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.seg span { display: inline-block; padding: 8px 14px; border-radius: 10px; border: 2px solid var(--line); background: var(--surface); font-weight: 700; font-size: .92rem; transition: all .15s; }
.seg input:checked + span { border-color: var(--accent); background: var(--accent); color: var(--on-accent); }
.seg input:focus-visible + span { outline: 3px solid var(--accent-2); outline-offset: 2px; }
.checks { display: grid; gap: 6px; }
.check { display: flex; gap: 10px; align-items: center; cursor: pointer; font-weight: 600; }
.check input, .sec-check input { width: 20px; height: 20px; accent-color: var(--accent); }
.sec-checks { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.sec-check { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px 6px 8px; border-radius: 999px; border: 2px solid color-mix(in srgb, var(--c) 40%, transparent); background: var(--c-soft); color: var(--c-ink); font-weight: 700; cursor: pointer; }
.sec-check input { accent-color: var(--c); }
.field { margin-bottom: 18px; }
.f-label { display: block; font-weight: 800; margin-bottom: 6px; font-size: .95rem; }
.toggle-field small { display: block; margin: 4px 0 0 54px; }

/* ---------- toasts, modal, fx ---------- */
#toasts { position: fixed; left: 50%; top: calc(var(--topbar) + 10px); transform: translateX(-50%); z-index: 200; display: grid; gap: 8px; pointer-events: none; width: min(92vw, 420px); }
.toast { background: var(--text); color: var(--bg); padding: 10px 16px; border-radius: 12px; font-weight: 700; box-shadow: var(--shadow-lg); text-align: center; animation: toast-in .25s ease-out; transition: opacity .35s, transform .35s; }
.toast.good { background: var(--good); color: #fff; }
.toast.bad { background: var(--bad); color: #fff; }
.toast.out { opacity: 0; transform: translateY(-8px); }
@keyframes toast-in { from { opacity: 0; transform: translateY(-10px); } }
.modal-back { position: fixed; inset: 0; z-index: 150; background: rgba(15, 18, 28, .5); display: flex; align-items: flex-end; justify-content: center; animation: fade-in .18s; }
.modal-back.out { opacity: 0; transition: opacity .18s; }
body.scroll-locked { position: fixed; left: 0; right: 0; overflow: hidden; }
.modal-back, .modal { overscroll-behavior: contain; }
.modal { background: var(--surface); width: 100%; max-width: 520px; max-height: 88vh; overflow: auto; border-radius: 20px 20px 0 0; padding: 18px 18px calc(18px + env(safe-area-inset-bottom)); box-shadow: var(--shadow-lg); animation: sheet-up .25s cubic-bezier(.2,.9,.3,1.1); }
.modal.wide { max-width: 720px; }
.modal-head { display: flex; align-items: flex-start; gap: 8px; }
.modal-head h3 { flex: 1; font-size: 1.25rem; display: flex; align-items: center; gap: 8px; margin-top: 6px; }
.modal-body p { margin-bottom: .7em; }
.modal-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 12px; flex-wrap: wrap; }
.modal-actions .btn { flex: 1; }
@media (min-width: 640px) {
  .modal-back { align-items: center; }
  .modal { border-radius: 20px; animation: pop-in .2s ease-out; }
  .modal-actions .btn { flex: 0 1 auto; }
}
@keyframes fade-in { from { opacity: 0; } }
@keyframes sheet-up { from { transform: translateY(40px); opacity: .4; } }
@keyframes pop-in { from { transform: scale(.94); opacity: 0; } }
.info-tags { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-bottom: 10px; }
.info-tags > * { min-height: 28px; display: inline-flex; align-items: center; line-height: 1.2; }
.info-tagline { font-family: var(--serif); font-size: 1.1rem; font-weight: 700; }
.fx-layer { position: fixed; inset: 0; pointer-events: none; z-index: 300; overflow: hidden; }
.fx-layer i { position: absolute; width: 9px; height: 13px; border-radius: 2px; }
.fx-layer i.spark { width: 7px; height: 7px; border-radius: 50%; background: var(--gold); box-shadow: 0 0 8px var(--gold); }

/* ---------- pages ---------- */
.page { max-width: 1000px; margin: 0 auto; }
.page.narrow { max-width: 640px; }
.page-head { margin: 8px 0 20px; }
.grid-h { font-size: 1.15rem; margin: 26px 0 12px; }
.back-link { display: inline-block; margin-bottom: 12px; text-decoration: none; font-weight: 700; }
.tool-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 12px; }
.tool-card { display: flex; gap: 14px; align-items: flex-start; padding: 16px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); text-decoration: none; color: var(--text); box-shadow: var(--shadow); transition: transform .12s, box-shadow .15s; }
.tool-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.tc-ico { font-size: 1.8rem; width: 50px; height: 50px; border-radius: 14px; background: var(--bg-2); display: grid; place-items: center; flex-shrink: 0; }
.tc-body { display: flex; flex-direction: column; gap: 2px; }
.tc-body small { color: var(--muted); line-height: 1.35; }
.tc-best { font-size: .78rem; font-weight: 800; color: var(--good); margin-top: 4px; }
.setup-head { display: flex; gap: 14px; align-items: flex-start; margin-bottom: 18px; }
.setup-head h1 { font-size: 1.6rem; margin: 0; }
.setup-ico { font-size: 2.2rem; }
.best-row { display: grid; grid-template-columns: 1fr auto; gap: 2px 12px; padding: 8px 0; border-bottom: 1px solid var(--line); align-items: baseline; }
.best-row:last-child { border-bottom: 0; }
.best-row > :nth-child(3) { grid-column: 1 / -1; }

/* ---------- path ---------- */
.welcome { border-left: 6px solid var(--gold); }
.path-hero { background: var(--surface); border: 1px solid var(--line); border-radius: 22px; padding: 18px; box-shadow: var(--shadow); margin-bottom: 18px; }
.hero-top { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 10px; align-items: flex-end; }
.hero-top h1 { margin: 0; }
.eyebrow { font-size: .75rem; letter-spacing: .1em; text-transform: uppercase; font-weight: 800; color: var(--muted); }
.hero-stats { display: flex; gap: 14px; font-size: 1.05rem; }
.hero-stats b { font-size: 1.3rem; }
.hero-stats small { color: var(--muted); }
.hero-stats span:first-child { color: var(--gold); }
.hero-stats span:first-child b { color: var(--text); }
.book-strip { display: grid; grid-template-columns: repeat(73, 1fr); gap: 2px; margin: 14px 0; }
.book-strip i { height: 10px; border-radius: 3px; background: color-mix(in srgb, var(--c) 22%, var(--bg-2)); }
.book-strip i.on { background: var(--c); }
.next-card, .daily-card {
  display: flex; align-items: center; gap: 12px; width: 100%; text-align: left; padding: 12px 14px; border-radius: 16px; cursor: pointer;
  border: 2px solid color-mix(in srgb, var(--c) 45%, transparent); background: var(--c-soft, var(--bg-2)); text-decoration: none; color: var(--text); margin-top: 10px;
}
.next-card:hover, .daily-card:hover { filter: brightness(1.02); }
.next-card.done, .daily-card.done { cursor: default; }
.daily-card { --c: var(--gold); --c-soft: var(--gold-soft); }
.nc-ico, .daily-card > span:first-child { font-size: 1.7rem; width: 48px; height: 48px; display: grid; place-items: center; border-radius: 14px; background: var(--surface); flex-shrink: 0; }
.nc-text, .daily-card > span:nth-child(2) { display: flex; flex-direction: column; flex: 1; min-width: 0; }
.nc-text small, .daily-card small { color: var(--muted); font-size: .8rem; }
.nc-text b { font-size: 1.08rem; }
.nc-text span { color: var(--muted); font-size: .88rem; }
.nc-go { font-weight: 800; color: var(--c-ink, var(--accent)); white-space: nowrap; }
.path { position: relative; max-width: 560px; margin: 0 auto; }
.stage-banner { scroll-margin-top: calc(var(--topbar) + 12px);
  display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 16px 18px; border-radius: 18px; color: #fff; margin: 26px 0 6px;
  background: linear-gradient(135deg, var(--c), color-mix(in srgb, var(--c) 70%, #101828)); box-shadow: 0 6px 0 color-mix(in srgb, var(--c) 55%, #000), var(--shadow);
}
.stage-banner h2 { margin: 2px 0; font-size: 1.3rem; color: #fff; }
.stage-banner.final-stage {
  background: linear-gradient(135deg, #1f3a5f, #4b2a6e 55%, #a0661a); box-shadow: 0 6px 0 #10203a, var(--shadow);
}
.stage-banner.final-stage h2::before { content: '🏁 '; }
.stage-banner.checkpoint-stage {
  background: radial-gradient(circle at 15% 0%, rgba(245, 191, 60, .22), transparent 55%), linear-gradient(135deg, #263048, #121726);
  border: 2px solid #e8a91b; box-shadow: 0 6px 0 #6b4a0d, var(--shadow);
}
.stage-banner.checkpoint-stage .sb-num { color: #f5c75a; opacity: 1; }
.stage-banner.checkpoint-stage h2::before { content: '🏆 '; }
.sb-num { font-size: .75rem; text-transform: uppercase; letter-spacing: .1em; font-weight: 800; opacity: .85; }
.sb-sub { font-size: .88rem; opacity: .92; }
.sb-right { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }
.sb-stars { font-weight: 800; background: rgba(0,0,0,.18); padding: 3px 10px; border-radius: 99px; white-space: nowrap; }
.stops { position: relative; }
.trail { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.trail path { fill: none; stroke: var(--line-strong); stroke-width: 7; stroke-dasharray: 2 12; stroke-linecap: round; vector-effect: non-scaling-stroke; }
.node { position: absolute; transform: translate(-50%, -38px); width: 130px; display: flex; flex-direction: column; align-items: center; gap: 4px; border: 0; background: none; cursor: pointer; padding: 0; z-index: 1; }
.node-ico {
  width: 74px; height: 74px; border-radius: 50%; display: grid; place-items: center; font-size: 2rem; background: var(--c); color: #fff;
  box-shadow: 0 6px 0 color-mix(in srgb, var(--c) 60%, #000), inset 0 -4px 0 rgba(0,0,0,.1), inset 0 3px 0 rgba(255,255,255,.25);
  transition: transform .12s; position: relative;
}
.node:not(.locked):hover .node-ico { transform: translateY(-2px); }
.node:active .node-ico { transform: translateY(3px); box-shadow: 0 3px 0 color-mix(in srgb, var(--c) 60%, #000); }
.node.t-boss .node-ico { width: 86px; height: 86px; font-size: 2.4rem; border-radius: 26px; }
.node.t-final .node-ico { width: 92px; height: 92px; font-size: 2.6rem; --c: var(--gold); border-radius: 28px; }
.node.t-review .node-ico { --c: var(--accent); }
.node.locked .node-ico { background: var(--bg-2); color: var(--muted); box-shadow: 0 6px 0 var(--line-strong); font-size: 1.5rem; filter: grayscale(1); }
.node-label { font-size: .8rem; font-weight: 800; background: var(--surface); border: 1px solid var(--line); padding: 2px 9px; border-radius: 99px; max-width: 150px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; box-shadow: var(--shadow); }
.node.locked .node-label { color: var(--muted); box-shadow: none; }
.node-stars { font-size: 1rem; line-height: 1; }
.node.done .node-ico::after { content: '✓'; position: absolute; right: -4px; bottom: -2px; width: 24px; height: 24px; border-radius: 50%; background: var(--good); color: #fff; font-size: .8rem; display: grid; place-items: center; font-weight: 900; border: 2px solid var(--surface); }
.node.current .node-ico { animation: pulse 1.8s infinite; }
@keyframes pulse { 0% { box-shadow: 0 6px 0 color-mix(in srgb, var(--c) 60%, #000), 0 0 0 0 color-mix(in srgb, var(--c) 55%, transparent); } 70% { box-shadow: 0 6px 0 color-mix(in srgb, var(--c) 60%, #000), 0 0 0 18px transparent; } 100% { box-shadow: 0 6px 0 color-mix(in srgb, var(--c) 60%, #000), 0 0 0 0 transparent; } }
.here { position: absolute; top: -34px; background: var(--text); color: var(--bg); font-size: .72rem; font-weight: 800; padding: 3px 10px; border-radius: 8px; white-space: nowrap; animation: bob 1.6s ease-in-out infinite; }
.here::after { content: ''; position: absolute; left: 50%; bottom: -5px; transform: translateX(-50%); border: 5px solid transparent; border-top-color: var(--text); border-bottom: 0; }
@keyframes bob { 50% { transform: translateY(-4px); } }
.node.just-unlocked .node-ico { animation: unlock .9s cubic-bezier(.3,1.6,.5,1); }
@keyframes unlock { 0% { transform: scale(.4) rotate(-20deg); filter: grayscale(1); } 60% { transform: scale(1.18) rotate(6deg); } 100% { transform: scale(1); } }
.ref-mini { display: grid; gap: 6px; margin-bottom: 12px; }
.rm-row { display: grid; grid-template-columns: auto 1fr; gap: 0 10px; align-items: center; }
.rm-row .muted { grid-column: 2; }

/* ---------- activity shell ---------- */
.act { max-width: 760px; margin: 0 auto; }
.act-top { display: flex; align-items: center; gap: 8px; margin: -4px 0 8px; }
.act-title { flex: 1; display: flex; align-items: center; gap: 8px; font-weight: 800; min-width: 0; }
.act-title span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.act-icon { font-size: 1.3rem; }
.act-meta { font-weight: 800; white-space: nowrap; }
.clock { font-variant-numeric: tabular-nums; }
.clock.warn { color: var(--bad); }
.act-progress { height: 10px; background: var(--bg-2); border-radius: 99px; overflow: hidden; margin-bottom: 18px; }
.act-progress i { display: block; height: 100%; width: 0; background: var(--c); border-radius: 99px; transition: width .35s ease; background-image: linear-gradient(rgba(255,255,255,.3), rgba(255,255,255,0)); }
.sticky-actions {
  position: sticky; bottom: 0; z-index: 5; display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 10px;
  padding: 12px 0 calc(12px + env(safe-area-inset-bottom)); margin-top: 16px;
  background: linear-gradient(to top, var(--bg) 70%, transparent);
}
.round-score { font-weight: 800; padding: 8px 14px; border-radius: 12px; background: var(--bg-2); }
.round-score.good { background: var(--good-soft); color: var(--good); }
.part-intro { padding: 32px 20px; }
.part-step { font-weight: 800; color: var(--muted); text-transform: uppercase; font-size: .78rem; letter-spacing: .1em; }
.part-icon { font-size: 3rem; margin: 6px 0; }
.game-head { text-align: center; margin-bottom: 14px; }
.game-head h3 { margin-bottom: 2px; }

/* ---------- result ---------- */
.result { max-width: 640px; margin: 0 auto; }
.result-card { background: var(--surface); border-radius: 24px; padding: 26px 18px; text-align: center; box-shadow: var(--shadow-lg); border: 1px solid var(--line); border-top: 8px solid var(--c); }
.result-stars { display: flex; justify-content: center; gap: 10px; margin-bottom: 8px; }
.big-star { font-style: normal; font-size: 3.4rem; line-height: 1; color: var(--line); transition: color .2s; }
.big-star:nth-child(2) { transform: translateY(-12px); font-size: 4rem; }
.big-star.on { color: var(--gold); animation: star-pop .5s cubic-bezier(.3,1.8,.5,1); text-shadow: 0 3px 0 color-mix(in srgb, var(--gold) 55%, #000), 0 0 24px color-mix(in srgb, var(--gold) 50%, transparent); }
.big-star:nth-child(2).on { animation-name: star-pop2; }
@keyframes star-pop { 0% { transform: scale(0) rotate(-40deg); } 100% { transform: scale(1) rotate(0); } }
@keyframes star-pop2 { 0% { transform: translateY(-12px) scale(0) rotate(-40deg); } 100% { transform: translateY(-12px) scale(1) rotate(0); } }
.result-sub { color: var(--muted); }
.result-stats { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; margin: 16px 0; }
.result-stats div { background: var(--bg-2); border-radius: 14px; padding: 10px 14px; min-width: 88px; }
.result-stats b { display: block; font-size: 1.35rem; }
.result-stats span { font-size: .78rem; color: var(--muted); font-weight: 700; }
.badge-best, .badge-unlock { display: inline-block; margin: 4px; padding: 6px 14px; border-radius: 99px; font-weight: 800; background: var(--gold-soft); color: color-mix(in srgb, var(--gold) 50%, var(--text)); }
.badge-fixed { display: inline-block; margin: 4px; padding: 6px 14px; border-radius: 99px; font-weight: 800; background: var(--bg-2); color: var(--text); }
.fixed-tag { font-size: .78rem; font-weight: 800; color: color-mix(in srgb, var(--gold) 55%, var(--text)); background: var(--gold-soft); padding: 1px 7px; border-radius: 6px; }
.srow.redo { border-left-color: var(--gold); background: var(--gold-soft); }
.srow.ok.fixed { border-left-color: var(--gold); }
.srow.ok.fixed .input { border-color: var(--gold); background: var(--gold-soft); }
.srow.ok.fixed .sanswer { color: color-mix(in srgb, var(--gold) 55%, var(--text)); }
.quiz.fixing .qcard { border: 2px dashed var(--gold); }
.badge-unlock { background: var(--good-soft); color: var(--good); animation: pop-in .4s ease-out .9s both; }
.missed { margin: 16px 0; padding-top: 14px; border-top: 1px dashed var(--line-strong); }
.missed h4 { font-family: var(--font); font-weight: 800; }
.missed .chips { justify-content: center; margin-bottom: 10px; }
.result-actions { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin-top: 18px; }
.result-details { margin-top: 20px; }
.details-h { margin: 18px 0 10px; }
.review-list { display: grid; gap: 8px; }
.review-item { display: flex; gap: 10px; background: var(--surface); border: 1px solid var(--line); border-left: 5px solid var(--good); border-radius: 12px; padding: 10px 12px; font-size: .92rem; }
.review-item.bad { border-left-color: var(--bad); }
.ri-mark { font-weight: 900; }
.review-item.ok .ri-mark { color: var(--good); }
.review-item.bad .ri-mark { color: var(--bad); }
.ri-q em { font-style: normal; font-weight: 800; }

/* ---------- sheet (fading list / test) ---------- */
.sheet { display: grid; gap: 6px; }
.sheet.cols { display: block; columns: 280px 3; column-gap: 14px; }
.sheet.cols .srow { break-inside: avoid; margin-bottom: 6px; }
.srow { display: flex; align-items: center; gap: 8px; min-height: 48px; background: var(--surface); border: 1px solid var(--line); border-left: 6px solid var(--line-strong); border-radius: 12px; padding: 4px 8px 4px 6px; }
.srow.show { border-left-color: var(--c); background: var(--c-soft); }
.snum { min-width: 28px; text-align: right; font-weight: 800; color: var(--muted); font-variant-numeric: tabular-nums; }
.sname { font-weight: 800; }
.sfield { flex: 1; display: flex; align-items: center; gap: 4px; min-width: 0; }
.sfield .input { min-height: 38px; padding: 6px 10px; border-width: 2px; }
.sletter { font-weight: 900; font-size: 1.05rem; color: var(--accent-2); min-width: 1.2em; }
.hint-mini { border: 0; background: var(--bg-2); border-radius: 8px; width: 34px; height: 34px; cursor: pointer; flex-shrink: 0; font-weight: 900; }
.hint-mini.used { background: var(--gold-soft); color: color-mix(in srgb, var(--gold) 50%, var(--text)); }
.sanswer { font-weight: 800; font-size: .88rem; color: var(--bad); white-space: nowrap; }
.srow.live-ok { border-left-color: var(--good); }
.srow.live-ok .input { border-color: var(--good); background: var(--good-soft); }
.srow.ok { border-left-color: var(--c); }
.srow.ok .input { border-color: var(--good); background: var(--good-soft); color: var(--text); opacity: 1; }
.srow.ok .sanswer { color: var(--good); }
.srow.bad { border-left-color: var(--bad); background: var(--bad-soft); }
.srow.bad .input { border-color: var(--bad); text-decoration: line-through; opacity: .85; }
.srow .input:disabled { -webkit-text-fill-color: currentColor; }
.test-head { margin-bottom: 10px; }
.filled { font-weight: 700; }

/* ---------- lessons ---------- */
.lesson-head { border-left: 6px solid var(--c); padding: 4px 0 4px 14px; margin-bottom: 16px; }
.lesson-head h2 { margin: 2px 0 4px; font-size: 1.5rem; }
.lesson-head .eyebrow { color: var(--c-ink); }
.book-cards { list-style: none; padding: 0; margin: 0 0 16px; display: grid; gap: 10px; }
.book-card { display: flex; gap: 12px; background: var(--surface); border: 1px solid var(--line); border-left: 6px solid var(--c); border-radius: 14px; padding: 12px; box-shadow: var(--shadow); animation: rise .35s ease-out both; }
.book-card:nth-child(2) { animation-delay: .05s; } .book-card:nth-child(3) { animation-delay: .1s; } .book-card:nth-child(4) { animation-delay: .15s; }
.book-card:nth-child(5) { animation-delay: .2s; } .book-card:nth-child(6) { animation-delay: .25s; } .book-card:nth-child(n+7) { animation-delay: .3s; }
@keyframes rise { from { opacity: 0; transform: translateY(10px); } }
.book-card h4 { font-size: 1.15rem; margin: 2px 0; }
.abbr { font-family: var(--font); font-size: .8rem; font-weight: 700; color: var(--muted); background: var(--bg-2); padding: 1px 6px; border-radius: 6px; margin-left: 4px; }
.tagline { font-weight: 800; color: var(--c-ink); margin: 0 0 2px; }
.book-card .summary { margin: 0; font-size: .95rem; }
.mnemonic-card { background: linear-gradient(135deg, var(--c-soft), var(--surface)); border: 2px dashed color-mix(in srgb, var(--c) 45%, transparent); border-radius: 16px; padding: 14px 16px; margin-bottom: 14px; }
.mn-label { font-size: .75rem; text-transform: uppercase; letter-spacing: .08em; font-weight: 800; color: var(--muted); }
.mn-text { font-family: var(--serif); font-size: 1.3rem; font-weight: 700; color: var(--c-ink); margin: 2px 0 4px; }
.mn-how { font-size: .92rem; color: var(--muted); margin-bottom: 8px; }
.mn-mine { border-top: 1px dashed var(--line-strong); padding-top: 8px; margin: 8px 0; }
.letters-row { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.ltr { font-weight: 900; font-size: 1.2rem; background: var(--bg-2); border-radius: 8px; padding: 2px 10px; }
.mini-timeline { display: grid; gap: 4px; }
.mt-era { display: grid; grid-template-columns: 18px 1fr; gap: 10px; padding: 6px 0; opacity: .5; }
.mt-era.hit { opacity: 1; }
.mt-dot { width: 14px; height: 14px; border-radius: 50%; background: var(--line-strong); margin-top: 5px; }
.mt-era.hit .mt-dot { background: var(--accent-2); box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent-2) 25%, transparent); }
.mt-title { font-weight: 800; }
.retry-slot { margin: 12px 0; display: grid; gap: 10px; }

/* ---------- quiz ---------- */
.quiz { display: grid; gap: 14px; }
.quiz-head { display: flex; justify-content: space-between; align-items: center; font-weight: 800; color: var(--muted); font-size: .9rem; }
.lives { color: var(--line-strong); font-size: 1.25rem; letter-spacing: 2px; }
.lives i { font-style: normal; transition: color .2s; }
.lives i.on { color: var(--bad); }
.qclock.over { color: var(--bad); }
.qtimer { height: 6px; border-radius: 99px; background: var(--bg-2); overflow: hidden; }
.qtimer i { display: block; height: 100%; background: var(--good); transition: width .1s linear; }
.qtimer i.low { background: var(--bad); }
.boss-bar { display: flex; align-items: center; gap: 10px; background: #1a1325; color: #fff; padding: 10px 14px; border-radius: 14px; }
.boss-name { font-weight: 800; white-space: nowrap; }
.hp { flex: 1; height: 14px; background: rgba(255,255,255,.15); border-radius: 99px; overflow: hidden; }
.hp i { display: block; height: 100%; background: linear-gradient(90deg, #ff5a5a, #ffb03a); border-radius: 99px; transition: width .5s cubic-bezier(.3,1.4,.6,1); }
.qcard { background: var(--surface); border: 1px solid var(--line); border-radius: 20px; padding: 22px 18px; text-align: center; box-shadow: var(--shadow); }
.qtype { font-size: .75rem; text-transform: uppercase; letter-spacing: .1em; font-weight: 800; color: var(--muted); margin-bottom: 8px; }
.qprompt { font-size: 1.3rem; font-weight: 700; line-height: 1.5; }
.qprompt em { font-style: normal; text-decoration: underline; text-decoration-color: var(--gold); text-decoration-thickness: 3px; text-underline-offset: 3px; }
.qprompt .chip { font-size: 1.1rem; padding: 4px 12px; }
.qprompt blockquote { font-size: 1rem; font-weight: 600; margin: 12px 0 0; padding: 12px 14px; background: var(--surface-2); border-radius: 12px; border-left: 4px solid var(--gold); text-align: left; line-height: 1.5; }
.mc { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.mc-opt { position: relative; min-height: 64px; padding: 12px 12px 12px 38px; border-radius: 14px; border: 2px solid var(--line); border-bottom-width: 4px; background: var(--surface); font-weight: 800; font-size: 1.02rem; cursor: pointer; text-align: left; transition: transform .08s, border-color .15s, background .15s; }
.mc-opt[data-sec] { border-left: 6px solid var(--c); }
.mc-opt:hover:not(:disabled) { border-color: var(--accent-2); }
.mc-opt:active:not(:disabled) { transform: translateY(2px); border-bottom-width: 2px; }
.mc-opt .key { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); width: 20px; height: 20px; border-radius: 6px; background: var(--bg-2); color: var(--muted); font-size: .72rem; display: grid; place-items: center; }
.mc-opt.ok { border-color: var(--good); background: var(--good-soft); }
.mc-opt.bad { border-color: var(--bad); background: var(--bad-soft); }
.mc-opt:disabled:not(.ok):not(.bad) { opacity: .55; }
@media (max-width: 420px) { .mc-opt { font-size: .95rem; padding-left: 34px; } }
.typed { display: flex; flex-wrap: wrap; gap: 8px; }
.typed .input { flex: 1 1 220px; font-size: 1.1rem; min-height: 52px; }
.typed .btn { min-height: 52px; }
.typed.ok .input { border-color: var(--good); background: var(--good-soft); }
.typed.bad .input { border-color: var(--bad); background: var(--bad-soft); }
.hint-btn:disabled { opacity: 1; background: var(--gold-soft); border-color: var(--gold); }
.qfeedback { min-height: 0; border-radius: 16px; display: grid; gap: 8px; justify-items: center; text-align: center; }
.qfeedback.good, .qfeedback.bad { padding: 14px; animation: rise .2s ease-out; }
.qfeedback.good { background: var(--good-soft); }
.qfeedback.bad { background: var(--bad-soft); }
.fb-title { font-weight: 900; font-size: 1.1rem; }
.qfeedback.good .fb-title { color: var(--good); }
.qfeedback.bad .fb-title { color: var(--bad); }
.fb-info { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; justify-content: center; }
.daily-intro .chips { justify-content: center; margin: 4px 0 20px; }

/* ---------- flashcards ---------- */
.flash { display: grid; justify-items: center; gap: 12px; }
.card3d { width: min(100%, 440px); aspect-ratio: 4 / 3; perspective: 1200px; border: 0; background: none; padding: 0; cursor: pointer; }
.card3d .inner { position: relative; width: 100%; height: 100%; transition: transform .5s cubic-bezier(.3,1.2,.5,1); transform-style: preserve-3d; }
.card3d.flipped .inner { transform: rotateY(180deg); }
.face { position: absolute; inset: 0; backface-visibility: hidden; -webkit-backface-visibility: hidden; border-radius: 22px; padding: 22px; display: flex; flex-direction: column; justify-content: center; align-items: center; text-align: center; gap: 6px; box-shadow: var(--shadow-lg); overflow: auto; }
.face.front { background: linear-gradient(160deg, var(--c), color-mix(in srgb, var(--c) 70%, #0d1525)); color: #fff; }
.card3d.neutral-front .face.front { background: linear-gradient(160deg, #31415e, #1b2438); }
.face.back { background: var(--surface); border: 3px solid var(--c); transform: rotateY(180deg); }
.card-q { font-size: .78rem; text-transform: uppercase; letter-spacing: .12em; font-weight: 800; opacity: .8; }
.card-big { font-family: var(--serif); font-size: clamp(1.8rem, 7vw, 2.6rem); font-weight: 700; line-height: 1.1; }
.card-big.num { font-size: clamp(3.4rem, 15vw, 5rem); }
.face.back .card-big { color: var(--c-ink); }
.card-sub { font-weight: 700; color: var(--muted); font-size: .9rem; }
.card-tag { font-weight: 800; margin: 4px 0 0; }
.card-summary { font-size: 1rem; line-height: 1.5; margin: 0; }
.face.front .card-summary { font-size: 1.02rem; }
.card-name-sm { font-family: var(--serif); font-weight: 700; font-size: 1.3rem; color: var(--c-ink); }
.card-trick { margin-top: 8px; font-size: .82rem; color: var(--muted); border-top: 1px dashed var(--line-strong); padding-top: 6px; }
.flash-btns { display: flex; gap: 10px; width: min(100%, 440px); opacity: 0; pointer-events: none; transform: translateY(6px); transition: all .2s; }
.flash-btns.show { opacity: 1; pointer-events: auto; transform: none; }
.flash-btns .btn { flex: 1; min-height: 54px; }
.flash-btns .learn { border-color: var(--c-pent); color: var(--c-pent); }
.flash-btns .got { background: var(--good); border-color: var(--good); color: #fff; box-shadow: 0 3px 0 color-mix(in srgb, var(--good) 65%, #000); }

/* ---------- games ---------- */
.sort-list { list-style: none; padding: 0; margin: 0 auto; max-width: 460px; display: grid; gap: 8px; }
.sort-item { display: flex; align-items: center; gap: 10px; background: var(--surface); border: 2px solid var(--line); border-radius: 14px; padding: 10px 10px 10px 12px; font-weight: 800; font-size: 1.05rem; touch-action: none; user-select: none; cursor: grab; box-shadow: var(--shadow); }
.sort-item.dragging { z-index: 10; position: relative; cursor: grabbing; box-shadow: var(--shadow-lg); border-color: var(--accent-2); transform-origin: center; }
.grip { color: var(--muted); letter-spacing: -2px; }
.sort-item .sname { flex: 1; }
.spos { font-size: .8rem; color: var(--muted); }
.arrows { display: flex; gap: 4px; }
.arrows button { width: 34px; height: 34px; border-radius: 9px; border: 1px solid var(--line); background: var(--surface-2); cursor: pointer; font-size: .7rem; }
.sort-list.locked .sort-item { cursor: default; }
.sort-list.locked .arrows { display: none; }
.sort-item.ok { border-color: var(--good); border-left: 8px solid var(--c); }
.sort-item.bad { border-color: var(--bad); background: var(--bad-soft); }

.speed-top { position: sticky; top: calc(var(--topbar) + 6px); z-index: 5; background: var(--bg); padding: 6px 0 10px; display: grid; gap: 8px; }
.big-input { font-size: 1.25rem; min-height: 56px; }
.speed-stats { display: flex; align-items: center; gap: 8px; font-size: 1.1rem; }
.speed-stats .give { margin-left: auto; }
.speed-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 6px; }
.slot { display: flex; align-items: center; gap: 8px; min-height: 40px; padding: 4px 10px 4px 6px; border-radius: 10px; border: 2px dashed var(--line-strong); background: var(--surface); }
.slot .snum { min-width: 22px; }
.slot.filled { border-style: solid; border-color: var(--c); background: var(--c-soft); }
.slot.filled .sname { color: var(--c-ink); }
.slot.miss { border-style: solid; border-color: var(--bad); background: var(--bad-soft); }
.slot.miss .sname { color: var(--bad); }

.run { display: grid; gap: 8px; max-width: 360px; margin: 0 auto 16px; }
.run-item { padding: 12px 14px; border-radius: 14px; background: var(--c-soft); border-left: 6px solid var(--c); font-weight: 800; text-align: center; font-size: 1.05rem; }
.run-item.gap { border: 3px dashed var(--line-strong); background: var(--surface); color: var(--muted); font-size: 1.5rem; padding: 6px; }
.run-item.gap.ok { border-style: solid; border-color: var(--good); background: var(--good-soft); color: var(--text); font-size: 1.05rem; padding: 12px; }
.run-item.gap.bad { border-style: solid; border-color: var(--bad); background: var(--bad-soft); color: var(--text); font-size: 1.05rem; padding: 12px; }
.ans { max-width: 520px; margin: 0 auto 12px; }

.match { display: grid; grid-template-columns: 1fr 1.3fr; gap: 10px; }
.match.long { grid-template-columns: 1fr 2fr; }
.mcol { display: grid; gap: 8px; align-content: start; }
.mcard { min-height: 58px; padding: 10px 12px; border-radius: 14px; border: 2px solid var(--line); border-bottom-width: 4px; background: var(--surface); cursor: pointer; font-weight: 700; text-align: left; transition: all .15s; font-size: .95rem; line-height: 1.35; }
.mcard.book { font-weight: 800; font-size: 1rem; }
.match.long .mcard.desc { font-size: .85rem; font-weight: 600; }
.mcard.desc[data-sec] { border-left: 6px solid var(--c); }
.mcard.sel { border-color: var(--accent-2); background: color-mix(in srgb, var(--accent-2) 12%, var(--surface)); transform: scale(1.02); }
.mcard.matched { border-color: var(--c); background: var(--c-soft); color: var(--c-ink); opacity: .85; cursor: default; transform: none; }
.mcard.wrong { border-color: var(--bad); background: var(--bad-soft); }

.sort-stage { display: grid; place-items: center; min-height: 140px; margin-bottom: 10px; }
.sort-card { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 22px 34px; border-radius: 20px; background: var(--surface); border: 3px solid var(--line-strong); font-family: var(--serif); font-size: 1.7rem; font-weight: 700; box-shadow: var(--shadow-lg); touch-action: none; user-select: none; cursor: grab; transition: background .2s, border-color .2s; }
.sort-card small { font-family: var(--font); font-size: .78rem; color: var(--muted); }
.sort-card.dragging { cursor: grabbing; transition: none; z-index: 20; position: relative; }
.sort-card.ok { border-color: var(--c); background: var(--c-soft); color: var(--c-ink); }
.sort-card.bad { border-color: var(--bad); background: var(--bad-soft); }
.bins { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 8px; }
.bin { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; min-height: 76px; border-radius: 16px; border: 2px solid var(--c); background: var(--c-soft); color: var(--c-ink); font-weight: 800; cursor: pointer; box-shadow: 0 4px 0 color-mix(in srgb, var(--c) 45%, transparent); transition: transform .1s; }
.bin:active { transform: translateY(3px); box-shadow: 0 1px 0 color-mix(in srgb, var(--c) 45%, transparent); }
.bin-count { font-size: .78rem; opacity: .7; }
.bin.flash-right { animation: glow .7s; }
@keyframes glow { 50% { box-shadow: 0 0 0 6px color-mix(in srgb, var(--c) 50%, transparent); transform: scale(1.04); } }

.duel { display: grid; grid-template-columns: 1fr; gap: 12px; max-width: 480px; margin: 0 auto; align-items: center; }
@media (min-width: 560px) { .duel { grid-template-columns: 1fr auto 1fr; } }
.duel-btn { min-height: 110px; border-radius: 20px; border: 2px solid var(--line); border-bottom-width: 6px; background: var(--surface); font-family: var(--serif); font-size: 1.5rem; font-weight: 700; cursor: pointer; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; transition: transform .08s; }
.duel-btn:active:not(:disabled) { transform: translateY(3px); border-bottom-width: 3px; }
.duel-btn small { font-family: var(--font); font-size: .85rem; color: var(--muted); min-height: 1.2em; }
.duel-btn.ok { border-color: var(--good); background: var(--good-soft); }
.duel-btn.dim { opacity: .55; }
.vs { text-align: center; font-weight: 800; color: var(--muted); }

.hood { display: grid; gap: 12px; align-items: center; max-width: 720px; margin: 0 auto 12px; }
@media (min-width: 700px) { .hood { grid-template-columns: 1fr auto 1fr; } }
.hood-center { order: -1; text-align: center; padding: 22px 26px; border-radius: 20px; background: linear-gradient(160deg, var(--c), color-mix(in srgb, var(--c) 70%, #0d1525)); color: #fff; font-family: var(--serif); font-size: 1.7rem; font-weight: 700; display: flex; flex-direction: column; box-shadow: var(--shadow-lg); }
@media (min-width: 700px) { .hood-center { order: 0; } }
.hood-center small { font-family: var(--font); font-size: .85rem; opacity: .8; }
.hood-slot label { display: block; font-weight: 800; font-size: .85rem; color: var(--muted); margin-bottom: 4px; }
.hood-slot .typed .input { flex-basis: 100%; }

.surv-top { display: flex; justify-content: space-between; align-items: center; font-weight: 800; margin-bottom: 10px; }
.streak b { font-size: 1.4rem; color: var(--gold); }
.chain { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; min-height: 34px; margin-bottom: 14px; }
.surv-q { text-align: center; font-size: 1.35rem; font-weight: 700; margin-bottom: 12px; }

.odd-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; max-width: 520px; margin: 0 auto 14px; }
.odd-btn { min-height: 90px; border-radius: 18px; border: 2px solid var(--line); border-bottom-width: 5px; background: var(--surface); font-weight: 800; font-size: 1.12rem; cursor: pointer; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; padding: 8px; }
.odd-btn[data-sec] { background: var(--c-soft); border-color: color-mix(in srgb, var(--c) 50%, transparent); }
.odd-btn small { font-size: .75rem; color: var(--c-ink); font-weight: 700; }
.odd-btn.odd { box-shadow: 0 0 0 4px var(--gold); }

.mys-box { display: flex; flex-direction: column; align-items: center; gap: 8px; margin-bottom: 14px; }
.mys-q { width: 100%; max-width: 360px; text-align: center; font-family: var(--serif); font-size: 2.6rem; font-weight: 700; padding: 18px; border-radius: 20px; background: linear-gradient(160deg, #31415e, #1b2438); color: #fff; box-shadow: var(--shadow-lg); }
.mys-q.revealed { background: linear-gradient(160deg, var(--c), color-mix(in srgb, var(--c) 70%, #0d1525)); font-size: 1.8rem; animation: pop-in .35s ease-out; }
.mys-clue { font-weight: 700; font-style: italic; color: var(--muted); }
.mys-legend { text-align: center; margin-bottom: 6px; }
.guesses { display: grid; gap: 6px; max-width: 560px; margin: 0 auto 12px; }
.guess { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 8px 10px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; animation: rise .25s ease-out; }
.guess.win { border-color: var(--good); background: var(--good-soft); }
.g-dir { font-weight: 800; min-width: 84px; }
.g-t, .g-s { font-weight: 800; font-size: .85rem; padding: 2px 8px; border-radius: 8px; }
.y { background: var(--good-soft); color: var(--good); }
.n { background: var(--bad-soft); color: var(--bad); }
.g-h { margin-left: auto; }

.shelf-wrap { background: linear-gradient(var(--bg-2), var(--bg)); border-radius: 18px; padding: 10px; }
.shelf { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 4px 3px; padding: 6px 4px; background-image: repeating-linear-gradient(to bottom, transparent 0 calc(100% - 0px)); }
.spine {
  position: relative; width: 34px; border: 0; border-radius: 4px 4px 2px 2px; background: var(--c, var(--line-strong)); color: #fff; cursor: pointer; padding: 6px 0 22px;
  display: flex; flex-direction: column; align-items: center; justify-content: flex-start; box-shadow: inset -4px 0 0 rgba(0,0,0,.14), inset 3px 0 0 rgba(255,255,255,.16), 0 4px 0 #8a6a45;
  margin-bottom: 8px;
}
.sp-t { writing-mode: vertical-rl; transform: rotate(180deg); font-weight: 800; font-size: .8rem; letter-spacing: .02em; white-space: nowrap; }
.sp-n { position: absolute; bottom: 4px; font-size: .62rem; font-weight: 800; opacity: .9; }
.spine.gap { background: transparent; border: 2px dashed var(--line-strong); color: var(--muted); box-shadow: 0 4px 0 #8a6a45; }
.spine.gap .sp-t { writing-mode: horizontal-tb; transform: none; font-size: 1.1rem; }
.spine.sel { border-color: var(--accent-2); background: color-mix(in srgb, var(--accent-2) 15%, transparent); animation: bob 1.2s infinite; }
.spine.revealed { outline: 3px solid var(--bad); outline-offset: -3px; }
.shelf-panel { display: grid; gap: 6px; justify-items: stretch; }
.sp-label { text-align: center; }
.sp-ans { width: 100%; max-width: 560px; margin: 0 auto; }

.unscr { display: grid; gap: 16px; justify-items: center; }
.slots { display: flex; flex-wrap: wrap; gap: 5px; justify-content: center; align-items: center; padding: 10px; border-radius: 16px; transition: background .2s; }
.slots.bad { background: var(--bad-soft); }
.slots.ok { background: var(--good-soft); }
.slots.revealed { background: var(--bad-soft); }
.prefix { font-family: var(--serif); font-size: 1.6rem; font-weight: 700; margin-right: 6px; }
.sp-gap { width: 14px; }
.slot-l { width: 38px; height: 46px; border-radius: 10px; border: 0; border-bottom: 4px solid var(--line-strong); background: var(--surface); font-weight: 900; font-size: 1.35rem; cursor: pointer; }
.slot-l.fixed { background: var(--gold-soft); border-bottom-color: var(--gold); }
.slots.ok .slot-l { border-bottom-color: var(--good); }
.tiles { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; max-width: 560px; }
.tile { width: 46px; height: 50px; border-radius: 12px; border: 2px solid var(--line); border-bottom-width: 5px; background: var(--surface); font-weight: 900; font-size: 1.4rem; cursor: pointer; transition: transform .1s, opacity .15s; }
.tile:active { transform: translateY(3px); border-bottom-width: 2px; }
.tile.used { opacity: .2; pointer-events: none; }
@media (max-width: 420px) { .slot-l { width: 30px; height: 40px; font-size: 1.1rem; } .tile { width: 40px; height: 46px; font-size: 1.2rem; } }

/* ---------- reference ---------- */
.ref-tools { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; margin-bottom: 12px; }
.ref-tools .input { flex: 1 1 260px; }
.legend { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.legend .chip { text-decoration: none; cursor: pointer; }
.ref-testament h2 { margin: 28px 0 10px; font-size: 1.5rem; }
.ref-section { background: var(--surface); border: 1px solid var(--line); border-top: 6px solid var(--c); border-radius: var(--radius); padding: 14px; margin-bottom: 14px; box-shadow: var(--shadow); scroll-margin-top: calc(var(--topbar) + 10px); }
.ref-sec-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.ref-sec-head h3 { color: var(--c-ink); margin: 0; font-size: 1.25rem; }
.ref-row { border-top: 1px solid var(--line); }
.ref-btn { display: grid; grid-template-columns: auto 1fr auto; grid-template-areas: 'n name abbr' 'n tag tag'; gap: 0 10px; align-items: center; width: 100%; text-align: left; padding: 10px 2px; background: none; border: 0; cursor: pointer; }
.ref-btn .num-badge { grid-area: n; }
.ref-name { grid-area: name; font-weight: 800; font-size: 1.05rem; }
.ref-abbr { grid-area: abbr; font-size: .82rem; color: var(--muted); font-weight: 700; }
.ref-tag { grid-area: tag; font-size: .86rem; color: var(--muted); }
@media (min-width: 700px) { .ref-btn { grid-template-columns: auto 200px 1fr auto; grid-template-areas: 'n name tag abbr'; } }
.ref-more { display: none; padding: 0 4px 12px 42px; animation: rise .2s ease-out; }
.ref-row.open .ref-more { display: block; }
.ref-row.open .ref-name { color: var(--c-ink); }

/* ---------- timeline ---------- */
.tl-filter { max-width: 360px; margin-bottom: 16px; }
.timeline { list-style: none; padding: 0; margin: 0; position: relative; }
.era { display: grid; grid-template-columns: 42px 1fr; gap: 12px; margin-bottom: 14px; position: relative; }
/* connector runs from each dot to the next one, so it stops at the last era */
.era:not(:last-child)::before { content: ''; position: absolute; left: 19px; top: 21px; bottom: -35px; width: 4px; border-radius: 4px; background: color-mix(in srgb, var(--accent-2) 45%, transparent); }
.era-dot { width: 42px; height: 42px; border-radius: 50%; background: var(--surface); border: 3px solid var(--accent-2); display: grid; place-items: center; font-weight: 900; z-index: 1; }
.era-body { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; box-shadow: var(--shadow); }
.era-dates { font-size: .78rem; font-weight: 800; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.era-body h3 { margin: 2px 0 6px; }
.era-body .chip { transition: opacity .2s, background .2s; }

/* ---------- mnemonics ---------- */
.tip { background: var(--gold-soft); border-color: color-mix(in srgb, var(--gold) 40%, transparent); font-weight: 700; }
.mn-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 12px; }
.mn-item { border-top: 6px solid var(--c); margin: 0; display: grid; gap: 8px; align-content: start; }
.mn-item-head { display: flex; justify-content: space-between; gap: 8px; align-items: baseline; }
.mn-item-head h3 { margin: 0; color: var(--c-ink); }
.mb-books { display: flex; flex-wrap: wrap; gap: 4px 10px; font-size: .92rem; }
.mb-book b { color: var(--c-ink); font-size: 1.05rem; }
.mn-ready, .mn-yours { font-size: .95rem; }
.mn-item .btn.edit { justify-self: start; }

/* ---------- progress ---------- */
.stat-tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; margin-bottom: 16px; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; box-shadow: var(--shadow); }
.stat b { display: block; font-size: 1.5rem; }
.stat span { font-size: .82rem; color: var(--muted); font-weight: 700; }
.mastery, .stage-stars { display: grid; gap: 8px; }
.m-row, .ss-row { display: grid; grid-template-columns: 150px 1fr 54px; gap: 10px; align-items: center; font-weight: 700; font-size: .92rem; }
.ss-row { grid-template-columns: minmax(120px, 230px) 1fr 54px; }
.m-row b, .ss-row b { text-align: right; }
.m-bar { height: 12px; border-radius: 99px; background: var(--bg-2); overflow: hidden; }
.m-bar i { display: block; height: 100%; background: var(--c); border-radius: 99px; transition: width .6s ease; }
@media (max-width: 480px) { .m-row, .ss-row { grid-template-columns: 1fr 50px; } .m-row .m-bar, .ss-row .m-bar { grid-column: 1 / -1; grid-row: 2; } }
.heat { display: grid; grid-template-columns: repeat(auto-fill, minmax(52px, 1fr)); gap: 5px; }
.heat-cell { aspect-ratio: 1; border-radius: 10px; border: 1px solid color-mix(in srgb, var(--c) 40%, transparent); background: color-mix(in srgb, var(--c) var(--m), var(--surface)); cursor: pointer; display: flex; flex-direction: column; align-items: center; justify-content: center; line-height: 1.1; padding: 2px; }
.heat-cell span { font-weight: 900; font-size: .9rem; }
.heat-cell small { font-size: .62rem; font-weight: 700; opacity: .8; }
.missed-list { display: grid; gap: 6px; margin-bottom: 12px; }
.mm-row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.best-table .best-row { grid-template-columns: 1fr auto; }

/* ---------- motion preferences ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
@media (max-width: 520px) {
  .typed .input { flex-basis: 100%; }
  .typed .btn { flex: 1; }
  .shelf-panel { background: var(--bg); }
}
