:root {
  --bg: #f6f4ff; --bg2: #ffffff; --panel: #ffffff; --ink: #1d1433; --ink2: #5b5478; --line: #e4def7; --soft: #efeaff;
  --brand: #7c5cff; --brand-d: #5b3ee6; --teal: #00c2a8; --teal-d: #00917d; --gold: #ffb020; --gold-d: #d98a00;
  --pink: #ff5d8f; --red: #ff4d5e; --red-d: #d1293b; --orange: #ff7a45; --blue: #4da3ff;
  --ok-bg: #dffbf3; --bad-bg: #ffe5e8; --shadow: 0 10px 30px rgba(60, 40, 140, .10);
  --mascot-bond: #3a3060; --radius: 18px;
  --font: 'Nunito', system-ui, -apple-system, Segoe UI, sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, Consolas, monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #120d24; --bg2: #19132f; --panel: #1f183a; --ink: #f1edff; --ink2: #b3aad6; --line: #342a5c; --soft: #2a2150;
    --ok-bg: #0f3b33; --bad-bg: #4a1a26; --shadow: 0 10px 30px rgba(0, 0, 0, .35); --mascot-bond: #cfc6ff; color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #120d24; --bg2: #19132f; --panel: #1f183a; --ink: #f1edff; --ink2: #b3aad6; --line: #342a5c; --soft: #2a2150;
  --ok-bg: #0f3b33; --bad-bg: #4a1a26; --shadow: 0 10px 30px rgba(0, 0, 0, .35); --mascot-bond: #cfc6ff; color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--ink); font-family: var(--font); font-size: 16px; line-height: 1.5; -webkit-font-smoothing: antialiased; }
button { font: inherit; color: inherit; cursor: pointer; }
a { color: var(--brand); }
sub, sup { line-height: 0; }
h1, h2, h3 { line-height: 1.2; margin: 0 0 .4em; font-weight: 900; letter-spacing: -.01em; }
.grad { background: linear-gradient(90deg, var(--brand), var(--pink)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.muted { color: var(--ink2); }
.mono { font-family: var(--mono); }

/* ---------- layout ---------- */
#app { display: grid; grid-template-columns: 240px 1fr; min-height: 100vh; }
.sidebar { position: sticky; top: 0; height: 100vh; padding: 22px 14px; border-right: 2px solid var(--line); background: var(--bg2); display: flex; flex-direction: column; gap: 6px; }
.brand { display: flex; align-items: center; gap: 8px; font-weight: 900; font-size: 19px; white-space: nowrap; padding: 4px 6px 18px; text-decoration: none; color: var(--ink); }
.brand small { display: block; font-size: 11px; font-weight: 700; color: var(--ink2); letter-spacing: .08em; text-transform: uppercase; }
.nav a { display: flex; align-items: center; gap: 12px; padding: 11px 14px; border-radius: 14px; color: var(--ink2); text-decoration: none; font-weight: 800; border: 2px solid transparent; }
.nav a .ico { font-size: 20px; width: 26px; text-align: center; }
.nav a:hover { background: var(--soft); color: var(--ink); }
.nav a.active { background: var(--soft); color: var(--brand); border-color: color-mix(in srgb, var(--brand) 40%, transparent); }
.nav a .pill { margin-left: auto; background: var(--red); color: #fff; font-size: 12px; border-radius: 99px; padding: 0 8px; }
.sidebar .foot { margin-top: auto; font-size: 12px; color: var(--ink2); padding: 0 10px; }
.main { min-width: 0; display: flex; flex-direction: column; }
.topbar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 14px; padding: 12px 28px; background: color-mix(in srgb, var(--bg) 85%, transparent); backdrop-filter: blur(10px); border-bottom: 2px solid var(--line); }
.topbar .spacer { flex: 1; }
.stat-chip { display: inline-flex; align-items: center; gap: 6px; font-weight: 900; padding: 6px 12px; border-radius: 99px; background: var(--panel); border: 2px solid var(--line); white-space: nowrap; }
.stat-chip.streak { color: var(--orange); }
.stat-chip.streak.cold { color: var(--ink2); filter: grayscale(1); }
.stat-chip.xp { color: var(--gold-d); }
.lvl { display: flex; align-items: center; gap: 10px; min-width: 0; }
.lvl .badge-num { width: 36px; height: 36px; border-radius: 12px; display: grid; place-items: center; font-weight: 900; color: #fff; background: linear-gradient(135deg, var(--brand), var(--pink)); flex: none; }
.lvl .meta { min-width: 0; }
.lvl .t { font-weight: 800; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar { height: 10px; border-radius: 99px; background: var(--soft); overflow: hidden; }
.bar > i { display: block; height: 100%; border-radius: 99px; background: linear-gradient(90deg, var(--brand), var(--pink)); transition: width .6s cubic-bezier(.2, .8, .2, 1); }
.bar.teal > i { background: linear-gradient(90deg, var(--teal), #6be3c9); }
.bar.gold > i { background: linear-gradient(90deg, var(--gold), #ffd36e); }
.lvl .bar { width: 140px; height: 8px; margin-top: 3px; }
#view { padding: 28px; max-width: 1100px; width: 100%; margin: 0 auto; flex: 1; animation: fadeUp .35s ease both; }
.tabbar { display: none; }

@keyframes fadeUp { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes pop { 0% { transform: scale(.9); } 50% { transform: scale(1.06); } 100% { transform: scale(1); } }
@keyframes shake { 0%, 100% { transform: translateX(0); } 20%, 60% { transform: translateX(-7px); } 40%, 80% { transform: translateX(7px); } }
@keyframes bob { 0%, 100% { transform: translateY(0) rotate(-2deg); } 50% { transform: translateY(-6px) rotate(2deg); } }
@keyframes floatUp { from { opacity: 1; transform: translateY(0); } to { opacity: 0; transform: translateY(-40px); } }

/* ---------- buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 0; border-radius: 16px; padding: 13px 22px; font-weight: 900; font-size: 15px; letter-spacing: .02em; text-transform: uppercase; text-decoration: none;
  background: var(--panel); color: var(--ink); box-shadow: 0 4px 0 var(--line); border: 2px solid var(--line); transition: transform .08s, box-shadow .08s, filter .15s; }
.btn:hover { filter: brightness(1.04); }
.btn:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--line); }
.btn.primary { background: var(--brand); color: #fff; border-color: var(--brand); box-shadow: 0 4px 0 var(--brand-d); }
.btn.primary:active { box-shadow: 0 1px 0 var(--brand-d); }
.btn.teal { background: var(--teal); color: #fff; border-color: var(--teal); box-shadow: 0 4px 0 var(--teal-d); }
.btn.gold { background: var(--gold); color: #3b2500; border-color: var(--gold); box-shadow: 0 4px 0 var(--gold-d); }
.btn.red { background: var(--red); color: #fff; border-color: var(--red); box-shadow: 0 4px 0 var(--red-d); }
.btn.ghost { background: transparent; box-shadow: none; border-color: transparent; color: var(--ink2); text-transform: none; letter-spacing: 0; }
.btn.ghost:hover { background: var(--soft); }
.btn.sm { padding: 8px 14px; font-size: 13px; border-radius: 12px; }
.btn.block { width: 100%; }
.btn:disabled { opacity: .45; cursor: not-allowed; transform: none; box-shadow: 0 4px 0 var(--line); filter: grayscale(.5); }

/* ---------- cards ---------- */
.card { background: var(--panel); border: 2px solid var(--line); border-radius: var(--radius); padding: 22px; box-shadow: var(--shadow); }
.grid { display: grid; gap: 18px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.section-title { display: flex; align-items: baseline; justify-content: space-between; margin: 30px 0 14px; }
.section-title h2 { font-size: 22px; margin: 0; }
.chip { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 800; padding: 4px 10px; border-radius: 99px; background: var(--soft); color: var(--ink2); }
.chip.c { background: color-mix(in srgb, var(--c) 16%, transparent); color: var(--c); }

/* ---------- home ---------- */
.hero { display: grid; grid-template-columns: auto 1fr auto; gap: 22px; align-items: center; background: linear-gradient(135deg, #7c5cff, #b14dff 55%, #ff5d8f); color: #fff; border: 0; position: relative; overflow: hidden; }
.hero::after { content: ''; position: absolute; right: -60px; top: -60px; width: 260px; height: 260px; border: 26px solid rgba(255,255,255,.08); border-radius: 30%; transform: rotate(30deg); }
.hero .mascot { animation: bob 3s ease-in-out infinite; }
.hero h1 { font-size: 30px; margin: 0 0 4px; }
.hero p { margin: 0; opacity: .92; font-weight: 600; }
.hero .btn { position: relative; z-index: 1; }
.ring { --p: 0; --c: var(--teal); width: 92px; height: 92px; border-radius: 50%; display: grid; place-items: center; background: conic-gradient(var(--c) calc(var(--p) * 1%), var(--soft) 0); position: relative; flex: none; }
.ring::before { content: ''; position: absolute; inset: 9px; background: var(--panel); border-radius: 50%; }
.ring > span { position: relative; font-weight: 900; text-align: center; line-height: 1.05; font-size: 18px; }
.ring > span small { display: block; font-size: 11px; color: var(--ink2); font-weight: 800; }
.ring.sm { width: 54px; height: 54px; }
.ring.sm::before { inset: 6px; }
.ring.sm > span { font-size: 13px; }
.action-card { display: flex; flex-direction: column; gap: 10px; text-decoration: none; color: var(--ink); transition: transform .15s, border-color .15s; }
.action-card:hover { transform: translateY(-3px); border-color: var(--brand); }
.action-card .big-ico { font-size: 34px; }
.action-card h3 { margin: 0; font-size: 19px; }
.action-card p { margin: 0; color: var(--ink2); font-size: 14px; }
.tipbox { display: flex; gap: 14px; align-items: flex-start; }
.tipbox .lbl { font-size: 12px; font-weight: 900; text-transform: uppercase; letter-spacing: .08em; color: var(--brand); }

/* ---------- map ---------- */
.course-head { display: flex; align-items: center; gap: 16px; margin: 34px 0 16px; }
.course-head h2 { margin: 0; font-size: 24px; }
.course-head .bar { flex: 1; max-width: 260px; }
.units { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 16px; }
.unit-card { --c: var(--brand); position: relative; display: flex; flex-direction: column; gap: 10px; padding: 18px; border-radius: var(--radius); background: var(--panel); border: 2px solid var(--line); text-decoration: none; color: var(--ink); box-shadow: 0 5px 0 var(--line); transition: transform .12s, border-color .12s; }
.unit-card:hover { transform: translateY(-3px); border-color: var(--c); }
.unit-card .u-ico { width: 52px; height: 52px; border-radius: 16px; display: grid; place-items: center; font-size: 28px; background: color-mix(in srgb, var(--c) 18%, transparent); }
.unit-card .u-num { position: absolute; top: 16px; right: 16px; font-size: 12px; font-weight: 900; color: var(--ink2); }
.unit-card h3 { margin: 0; font-size: 18px; }
.unit-card p { margin: 0; color: var(--ink2); font-size: 13.5px; flex: 1; }
.unit-card .bar > i { background: var(--c); }
.stars { letter-spacing: 2px; font-size: 16px; }
.stars .off { opacity: .2; filter: grayscale(1); }
.unit-card.rec { border-color: var(--c); box-shadow: 0 5px 0 var(--c); }
.rec-flag { position: absolute; top: -12px; left: 16px; background: var(--c); color: #fff; font-size: 11px; font-weight: 900; padding: 3px 10px; border-radius: 99px; text-transform: uppercase; letter-spacing: .06em; }

/* ---------- unit page ---------- */
.unit-hero { --c: var(--brand); display: grid; grid-template-columns: auto 1fr auto; gap: 22px; align-items: center; border-top: 8px solid var(--c); }
.unit-hero .u-ico { width: 84px; height: 84px; border-radius: 24px; display: grid; place-items: center; font-size: 46px; background: color-mix(in srgb, var(--c) 18%, transparent); }
.unit-hero h1 { font-size: 30px; }
.mode-card { display: flex; flex-direction: column; gap: 10px; }
.mode-card .big-ico { font-size: 38px; }
.mode-card h3 { margin: 0; }
.mode-card p { margin: 0; color: var(--ink2); font-size: 14px; flex: 1; }
.topic-list { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }

/* ---------- lesson ---------- */
.lesson { max-width: 760px; margin: 0 auto; }
.lesson-top { display: flex; align-items: center; gap: 14px; margin-bottom: 18px; }
.lesson-top .bar { flex: 1; height: 14px; }
.lesson-card { min-height: 360px; animation: fadeUp .3s ease both; }
.lesson-card h2 { font-size: 26px; }
.lesson-card .kicker { font-size: 12px; font-weight: 900; letter-spacing: .1em; text-transform: uppercase; color: var(--c, var(--brand)); margin-bottom: 6px; }
.lesson-card p, .lesson-card li { font-size: 16.5px; }
.lesson-card ul { padding-left: 22px; }
.lesson-card li { margin: 4px 0; }
.mols { display: flex; flex-wrap: wrap; gap: 12px; margin: 16px 0 4px; }
.mols figure { margin: 0; padding: 8px; border-radius: 14px; background: var(--soft); text-align: center; }
.mols figcaption { font-size: 13px; font-weight: 700; color: var(--ink2); max-width: 210px; margin: 0 auto; }
.callout { border-radius: 14px; padding: 12px 16px; margin: 14px 0; font-size: 15px; border-left: 5px solid; }
.callout.tip { background: color-mix(in srgb, var(--teal) 12%, transparent); border-color: var(--teal); }
.callout.trap { background: color-mix(in srgb, var(--red) 10%, transparent); border-color: var(--red); }
.callout.mnemonic { background: color-mix(in srgb, var(--gold) 16%, transparent); border-color: var(--gold); }
table.mini { border-collapse: collapse; width: 100%; margin: 10px 0; font-size: 14.5px; }
table.mini th, table.mini td { text-align: left; padding: 7px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
table.mini th { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--ink2); }
table.mini tr:hover td { background: var(--soft); }
.lesson-nav { display: flex; justify-content: space-between; gap: 10px; margin-top: 18px; }

/* ---------- quiz ---------- */
.quiz { max-width: 800px; margin: 0 auto; }
.quiz-top { display: flex; align-items: center; gap: 14px; margin-bottom: 18px; }
.quiz-top .bar { flex: 1; height: 16px; }
.quiz-top .x { font-size: 22px; text-decoration: none; color: var(--ink2); padding: 4px 8px; border-radius: 10px; }
.combo { font-weight: 900; color: var(--orange); min-width: 64px; text-align: right; }
.combo.hot { animation: pop .3s ease; }
.hearts { font-size: 20px; letter-spacing: 2px; }
.q-card { position: relative; }
.q-meta { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.q-prompt { font-size: 21px; font-weight: 800; line-height: 1.4; margin: 0 0 14px; }
.q-structure { display: flex; justify-content: center; margin: 6px 0 16px; padding: 10px; background: var(--soft); border-radius: 16px; }
.choices { display: grid; gap: 10px; }
.choices.mols-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.choice { display: flex; align-items: center; gap: 12px; text-align: left; padding: 14px 16px; border-radius: 16px; background: var(--panel); border: 2px solid var(--line); box-shadow: 0 4px 0 var(--line); font-weight: 700; font-size: 16px; transition: transform .08s, border-color .1s, background .1s; }
.choice:hover:not(:disabled) { border-color: var(--brand); }
.choice .key { flex: none; width: 28px; height: 28px; border-radius: 9px; display: grid; place-items: center; font-size: 13px; font-weight: 900; border: 2px solid var(--line); color: var(--ink2); }
.choice.sel { border-color: var(--brand); background: color-mix(in srgb, var(--brand) 10%, var(--panel)); box-shadow: 0 4px 0 var(--brand); }
.choice.sel .key { border-color: var(--brand); color: var(--brand); }
.choice.right { border-color: var(--teal); background: var(--ok-bg); box-shadow: 0 4px 0 var(--teal); }
.choice.wrong { border-color: var(--red); background: var(--bad-bg); box-shadow: 0 4px 0 var(--red); animation: shake .4s; }
.choice:disabled { cursor: default; }
.choice.molc { flex-direction: column; justify-content: center; }
.choice.molc .lbl { font-size: 13px; color: var(--ink2); }
.choice .why { display: block; font-weight: 600; font-size: 13.5px; color: var(--ink2); margin-top: 4px; }
.rank-pool, .rank-list { display: flex; flex-direction: column; gap: 8px; }
.rank-wrap { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.rank-wrap h4 { margin: 0 0 8px; font-size: 13px; text-transform: uppercase; letter-spacing: .06em; color: var(--ink2); }
.rank-list { min-height: 120px; padding: 10px; border: 2px dashed var(--line); border-radius: 16px; }
.rank-item { display: flex; align-items: center; gap: 10px; padding: 11px 14px; border-radius: 14px; border: 2px solid var(--line); background: var(--panel); font-weight: 700; text-align: left; box-shadow: 0 3px 0 var(--line); }
.rank-item .n { width: 24px; height: 24px; border-radius: 8px; background: var(--brand); color: #fff; font-size: 13px; display: grid; place-items: center; font-weight: 900; flex: none; }
.rank-item.placed { border-color: var(--brand); }
.rank-end { font-size: 12px; font-weight: 900; color: var(--brand); text-transform: uppercase; letter-spacing: .06em; }
.num-input { font: inherit; font-size: 28px; font-weight: 900; width: 180px; padding: 10px 16px; border-radius: 16px; border: 2px solid var(--line); background: var(--panel); color: var(--ink); text-align: center; }
.num-input:focus { outline: none; border-color: var(--brand); }
.hint-box .hint { margin-top: 12px; padding: 12px 14px; border-radius: 14px; background: color-mix(in srgb, var(--gold) 15%, transparent); border: 2px solid color-mix(in srgb, var(--gold) 45%, transparent); font-weight: 600; animation: fadeUp .25s; }
.q-actions { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-top: 20px; }
.feedback { display: none; margin: 18px -22px -22px; padding: 18px 22px 22px; border-radius: 0 0 var(--radius) var(--radius); animation: fadeUp .25s; }
.feedback.show { display: block; }
.feedback.ok { background: var(--ok-bg); }
.feedback.bad { background: var(--bad-bg); }
.feedback .fb-head { display: flex; align-items: center; gap: 12px; margin-bottom: 8px; }
.feedback .fb-head h3 { margin: 0; font-size: 22px; }
.feedback.ok h3 { color: var(--teal-d); }
.feedback.bad h3 { color: var(--red-d); }
:root[data-theme="dark"] .feedback.ok h3 { color: #5ff0d0; }
:root[data-theme="dark"] .feedback.bad h3 { color: #ff8a96; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .feedback.ok h3 { color: #5ff0d0; } :root:not([data-theme="light"]) .feedback.bad h3 { color: #ff8a96; } }
.feedback .explain { font-size: 15.5px; }
.feedback .fb-actions { display: flex; justify-content: flex-end; margin-top: 12px; }
.xp-float { position: absolute; right: 24px; top: 16px; font-weight: 900; color: var(--gold-d); font-size: 22px; animation: floatUp 1.2s ease forwards; pointer-events: none; }
.kbd-hint { font-size: 12px; color: var(--ink2); text-align: center; margin-top: 12px; }
kbd { font-family: var(--mono); font-size: 11px; padding: 1px 6px; border: 1.5px solid var(--line); border-bottom-width: 3px; border-radius: 6px; background: var(--panel); }

/* ---------- results ---------- */
.results { text-align: center; max-width: 620px; margin: 0 auto; }
.results .mascot { animation: bob 3s ease-in-out infinite; }
.results h1 { font-size: 34px; }
.res-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin: 22px 0; }
.res-stat { border-radius: 16px; padding: 14px 8px; border: 2px solid; }
.res-stat .v { font-size: 26px; font-weight: 900; }
.res-stat .k { font-size: 12px; font-weight: 900; text-transform: uppercase; letter-spacing: .06em; }
.res-stat.gold { border-color: var(--gold); color: var(--gold-d); }
.res-stat.teal { border-color: var(--teal); color: var(--teal-d); }
.res-stat.orange { border-color: var(--orange); color: var(--orange); }
.missed { text-align: left; }
.missed details { background: var(--panel); border: 2px solid var(--line); border-radius: 14px; padding: 12px 16px; margin-bottom: 8px; }
.missed summary { font-weight: 800; cursor: pointer; }

/* ---------- games ---------- */
.game-stage { max-width: 720px; margin: 0 auto; text-align: center; }
.game-hud { display: flex; flex-wrap: wrap; gap: 8px; justify-content: space-between; align-items: center; margin-bottom: 16px; font-weight: 900; font-size: 18px; }
@media (max-width: 480px) { .game-hud .seg button { padding: 6px 8px; font-size: 12px; } .game-hud { font-size: 15px; } }
.timer { font-size: 30px; font-weight: 900; font-variant-numeric: tabular-nums; }
.timer.low { color: var(--red); animation: pop .5s infinite; }
.transform { display: flex; align-items: center; justify-content: center; gap: 16px; flex-wrap: wrap; font-size: 20px; font-weight: 900; padding: 26px 18px; }
.transform .from, .transform .to { padding: 12px 18px; border-radius: 16px; background: var(--soft); }
.transform .arrow { font-size: 36px; color: var(--brand); }
.transform .note { flex-basis: 100%; font-size: 14px; color: var(--ink2); font-weight: 700; }
.flash { perspective: 1000px; max-width: 520px; margin: 0 auto; }
.flash-inner { position: relative; height: 260px; transition: transform .5s; transform-style: preserve-3d; cursor: pointer; }
.flash.flipped .flash-inner { transform: rotateY(180deg); }
.flash-face { position: absolute; inset: 0; backface-visibility: hidden; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; padding: 24px; border-radius: 22px; border: 2px solid var(--line); background: var(--panel); box-shadow: var(--shadow); font-weight: 900; font-size: 24px; }
.flash-face.back { transform: rotateY(180deg); background: linear-gradient(135deg, color-mix(in srgb, var(--brand) 14%, var(--panel)), var(--panel)); font-size: 20px; }
.flash-face small { font-size: 13px; color: var(--ink2); font-weight: 700; }

/* ---------- tools ---------- */
.tabs { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 18px; }
.tabs button { border: 2px solid var(--line); background: var(--panel); border-radius: 12px; padding: 8px 14px; font-weight: 800; color: var(--ink2); }
.tabs button.on { border-color: var(--brand); color: var(--brand); background: var(--soft); }
.search { width: 100%; font: inherit; padding: 12px 16px; border-radius: 14px; border: 2px solid var(--line); background: var(--panel); color: var(--ink); margin-bottom: 14px; }
.search:focus, .field input:focus, .field select:focus { outline: none; border-color: var(--brand); }
.field { display: flex; flex-direction: column; gap: 6px; font-weight: 800; font-size: 14px; }
.field input, .field select { font: inherit; padding: 10px 12px; border-radius: 12px; border: 2px solid var(--line); background: var(--panel); color: var(--ink); }
.dou-out { font-size: 44px; font-weight: 900; color: var(--brand); }
.table-scroll { overflow-x: auto; }

/* ---------- profile ---------- */
.badges { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.badge-tile { text-align: center; padding: 16px 10px; border-radius: 16px; border: 2px solid var(--line); background: var(--panel); }
.badge-tile .bi { font-size: 38px; }
.badge-tile .bn { font-weight: 900; font-size: 14px; }
.badge-tile .bd { font-size: 12px; color: var(--ink2); }
.badge-tile.locked { opacity: .45; }
.badge-tile.locked .bi { filter: grayscale(1); }
.toggle-row { display: flex; justify-content: space-between; align-items: center; padding: 12px 0; border-bottom: 1px solid var(--line); font-weight: 800; }
.seg { display: inline-flex; border: 2px solid var(--line); border-radius: 12px; overflow: hidden; }
.seg button { border: 0; background: var(--panel); padding: 7px 12px; font-weight: 800; color: var(--ink2); }
.seg button.on { background: var(--brand); color: #fff; }

/* ---------- toasts & modal ---------- */
#toasts { position: fixed; top: 76px; right: 20px; z-index: 100; display: flex; flex-direction: column; gap: 8px; }
.toast { background: var(--panel); border: 2px solid var(--line); border-left: 6px solid var(--brand); padding: 12px 16px; border-radius: 14px; box-shadow: var(--shadow); font-weight: 700; max-width: 320px; animation: fadeUp .3s; transition: opacity .4s, transform .4s; }
.toast.streak { border-left-color: var(--orange); }
.toast.goal { border-left-color: var(--teal); }
.toast.badge { border-left-color: var(--gold); }
.toast.out { opacity: 0; transform: translateX(30px); }
#confetti { position: fixed; inset: 0; pointer-events: none; z-index: 200; }
.modal-back { position: fixed; inset: 0; background: rgba(15, 8, 40, .55); z-index: 150; display: grid; place-items: center; padding: 16px; animation: fadeUp .2s; }
.modal { background: var(--panel); border-radius: 24px; padding: 28px; max-width: 480px; width: 100%; box-shadow: 0 30px 80px rgba(0, 0, 0, .35); max-height: 90vh; overflow: auto; }
.levelup { text-align: center; }
.levelup .lv-num { font-weight: 900; color: var(--brand); text-transform: uppercase; letter-spacing: .1em; }
.onboard .opt-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 8px 0 16px; }
.onboard .opt { border: 2px solid var(--line); border-radius: 14px; padding: 12px 8px; background: var(--panel); font-weight: 800; text-align: center; }
.onboard .opt small { display: block; font-weight: 700; color: var(--ink2); font-size: 12px; }
.onboard .opt.on { border-color: var(--brand); background: var(--soft); color: var(--brand); }
.smiles-fallback { font-family: var(--mono); font-size: 13px; padding: 6px 10px; border-radius: 8px; background: var(--soft); }
.mol-wrap { display: inline-block; line-height: 0; }

/* ---------- responsive ---------- */
@media (max-width: 900px) {
  #app { grid-template-columns: 1fr; }
  .sidebar { display: none; }
  .tabbar { display: flex; position: fixed; bottom: 0; left: 0; right: 0; z-index: 30; background: var(--bg2); border-top: 2px solid var(--line); padding: 6px 4px calc(6px + env(safe-area-inset-bottom)); justify-content: space-around; }
  .tabbar a { display: flex; flex-direction: column; align-items: center; text-decoration: none; color: var(--ink2); font-size: 11px; font-weight: 800; padding: 4px 8px; border-radius: 12px; }
  .tabbar a .ico { font-size: 22px; }
  .tabbar a.active { color: var(--brand); background: var(--soft); }
  #view { padding: 18px 16px 100px; }
  .topbar { padding: 10px 16px; gap: 8px; }
  .lvl .bar { width: 80px; }
  .lvl .t { display: none; }
  .g2, .g3 { grid-template-columns: 1fr; }
  .hero, .unit-hero { grid-template-columns: 1fr; text-align: center; justify-items: center; }
  .rank-wrap { grid-template-columns: 1fr; }
  .q-prompt { font-size: 18px; }
  .choices.mols-grid { grid-template-columns: 1fr 1fr; }
  #toasts { right: 12px; left: 12px; top: 64px; }
  .toast { max-width: none; }
}
@media (max-width: 480px) {
  .choices.mols-grid { grid-template-columns: 1fr; }
  .res-stats { grid-template-columns: 1fr 1fr 1fr; gap: 6px; }
  .onboard .opt-grid { grid-template-columns: 1fr; }
  .stat-chip { padding: 5px 9px; font-size: 14px; }
}

/* ================= rich lessons ================= */
.toc { display: flex; gap: 8px; overflow-x: auto; padding: 2px 2px 12px; margin-bottom: 6px; scrollbar-width: thin; }
.toc-pill { flex: none; border: 2px solid var(--line); background: var(--panel); border-radius: 99px; padding: 6px 12px; font-weight: 800; font-size: 13px; color: var(--ink2); white-space: nowrap; }
.toc-pill.on { border-color: var(--c, var(--brand)); color: var(--c, var(--brand)); background: var(--soft); }
.lesson { max-width: 820px; }
.lesson-card h2 { font-size: 28px; }
.lesson-body > p { margin: 12px 0; }
.lesson-body h3 { font-size: 18px; margin: 22px 0 6px; }
.tldr { display: flex; gap: 10px; align-items: baseline; padding: 12px 16px; border-radius: 14px; background: linear-gradient(90deg, color-mix(in srgb, var(--c, var(--brand)) 16%, transparent), transparent); font-weight: 700; font-size: 16.5px; margin: 6px 0 14px; }
.tldr span { flex: none; font-size: 12px; font-weight: 900; text-transform: uppercase; letter-spacing: .08em; color: var(--c, var(--brand)); }
.keys { margin-top: 22px; padding: 14px 18px; border-radius: 16px; border: 2px dashed color-mix(in srgb, var(--c, var(--brand)) 50%, var(--line)); }
.keys-h { font-weight: 900; margin-bottom: 4px; }
.keys ul { margin: 0; padding-left: 20px; }
.keys li { margin: 3px 0; font-size: 15.5px; }
.fig { margin: 16px 0; padding: 14px; border-radius: 16px; background: var(--soft); text-align: center; overflow-x: auto; }
.fig figcaption { font-size: 13.5px; font-weight: 700; color: var(--ink2); margin-top: 8px; }
.fig .dia { width: 100%; height: auto; }
.rxn-row { display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 4px 8px; }
.rxn-row .sp { display: flex; flex-direction: column; align-items: center; }
.rxn-row .sp small { font-size: 12px; color: var(--ink2); font-weight: 700; }
.sp-text { font-weight: 800; font-size: 17px; padding: 0 4px; white-space: nowrap; }
.plus { font-size: 22px; font-weight: 900; color: var(--ink2); }
.rxn-arrow { display: flex; flex-direction: column; align-items: center; min-width: 96px; max-width: 170px; font-size: 13px; font-weight: 800; line-height: 1.25; }
.rxn-arrow .above, .rxn-arrow .below { min-height: 16px; color: var(--c, var(--brand)); text-align: center; }
.rxn-arrow .below { color: var(--ink2); font-weight: 700; }
.arr { width: 88px; height: 16px; }
.arr path { fill: none; stroke: var(--ink); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.blk-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; align-items: start; }
.blk-row > div > .fig { margin: 8px 0; }
.dia { color: var(--ink2); font-family: var(--font); }
.dia .ax { stroke: var(--ink2); stroke-width: 1.5; }
.dia .guide { stroke: var(--ink2); stroke-width: 1; stroke-dasharray: 4 4; opacity: .7; }
.dia .bond, .dia .ring { stroke: var(--ink); stroke-width: 2.5; stroke-linecap: round; }
.dia .nm-circle { fill: var(--panel); stroke: var(--ink); stroke-width: 2.5; }
.dia text { font-size: 12.5px; font-weight: 700; fill: var(--ink2); }
.dia .lbl { fill: var(--ink); }
.dia .lbl.sm { font-size: 11px; fill: var(--ink2); }
.dia .lbl.strong { font-weight: 900; font-size: 13.5px; }
.dia .lbl.hl { fill: var(--pink); font-weight: 900; }
.dia .lbl.on { fill: #fff; font-size: 11px; font-weight: 900; }
.dia .lbl.badge { fill: #fff; font-size: 11px; font-weight: 900; }
.dia .lbl.elec { font-size: 17px; fill: var(--brand); font-weight: 900; }
.dia .ttl { font-weight: 900; font-size: 13px; fill: var(--ink); }
.dia .axl { font-size: 11.5px; fill: var(--ink2); font-weight: 800; }
.dia .gap { font-size: 12px; font-weight: 900; }
.bars { text-align: left; }
.bars-t { font-weight: 900; margin-bottom: 8px; }
.bar-row { display: grid; grid-template-columns: minmax(90px, 30%) 1fr minmax(70px, auto); gap: 10px; align-items: center; margin: 5px 0; font-size: 14px; }
.bar-row .bl { font-weight: 800; }
.bar-row .bt { height: 12px; border-radius: 99px; background: color-mix(in srgb, var(--ink2) 15%, transparent); overflow: hidden; }
.bar-row .bt i { display: block; height: 100%; border-radius: 99px; }
.bar-row .bv { font-weight: 900; font-variant-numeric: tabular-nums; }
.bar-row .bv small { font-weight: 700; color: var(--ink2); }
.mech { margin: 18px 0; border: 2px solid color-mix(in srgb, var(--c, var(--brand)) 40%, var(--line)); border-radius: 18px; padding: 14px; }
.mech-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.mech-dots i { display: inline-block; width: 9px; height: 9px; border-radius: 50%; background: var(--line); margin-left: 5px; }
.mech-dots i.on { background: var(--c, var(--brand)); }
.mech-step { animation: fadeUp .25s; padding: 8px 0; }
.mech-step + .mech-step:not([hidden]) { border-top: 1px dashed var(--line); }
.mech-lbl { font-size: 12px; font-weight: 900; letter-spacing: .08em; text-transform: uppercase; color: var(--c, var(--brand)); margin-bottom: 4px; }
.mech-note { font-size: 15px; margin-top: 6px; }
.flow { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; margin-top: 6px; }
.flow-chip { font-size: 12.5px; font-weight: 800; padding: 3px 10px; border-radius: 99px; background: color-mix(in srgb, var(--orange) 16%, transparent); color: var(--orange); }
.mech-nav { display: flex; justify-content: space-between; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.ex { margin: 18px 0; padding: 16px; border-radius: 18px; background: color-mix(in srgb, var(--blue) 9%, transparent); border: 2px solid color-mix(in srgb, var(--blue) 35%, transparent); }
.ex-head, .check-head, .w-head { font-weight: 900; font-size: 13px; text-transform: uppercase; letter-spacing: .08em; margin-bottom: 6px; display: flex; gap: 8px; align-items: center; }
.ex-head { color: var(--blue); }
.ex-q { font-weight: 700; }
.ex-steps { margin: 10px 0; padding-left: 22px; }
.ex-steps li { margin: 6px 0; animation: fadeUp .25s; }
.ex-ans { padding: 10px 14px; border-radius: 12px; background: var(--ok-bg); margin: 8px 0; animation: fadeUp .25s; }
.check { margin: 18px 0; padding: 16px; border-radius: 18px; border: 2px solid color-mix(in srgb, var(--gold) 55%, transparent); background: color-mix(in srgb, var(--gold) 8%, transparent); }
.check-head { color: var(--gold-d); }
.check-q { font-weight: 800; margin: 4px 0 10px; }
.check-opts { display: grid; gap: 8px; }
.check-opts.molish { grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); }
.check .choice { padding: 10px 14px; font-size: 15px; }
.check-fb { margin-top: 10px; padding: 10px 14px; border-radius: 12px; font-size: 15px; }
.check-fb.ok { background: var(--ok-bg); }
.check-fb.bad { background: var(--bad-bg); }
.deeper { margin: 16px 0; border: 2px solid var(--line); border-radius: 16px; padding: 0 16px; background: var(--panel); }
.deeper summary { cursor: pointer; font-weight: 900; padding: 12px 0; color: var(--ink2); }
.deeper[open] summary { color: var(--c, var(--brand)); }
.deeper-body { padding-bottom: 12px; font-size: 15.5px; }
.widget { margin: 18px 0; padding: 16px; border-radius: 18px; background: var(--soft); }
.w-head { color: var(--brand); justify-content: space-between; }
.w-body { display: flex; gap: 16px; align-items: center; flex-wrap: wrap; justify-content: center; }
.w-dia { flex: none; background: var(--panel); border-radius: 14px; padding: 6px; }
.w-dia svg { width: 200px; height: auto; display: block; }
.w-ctl { flex: 1; min-width: 220px; }
.reag-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin: 10px 0; }
.reag-grid .choice { font-size: 14px; padding: 10px 12px; display: block; }
.reag-grid small { color: var(--ink2); font-weight: 700; }
.sne-out { padding: 12px 16px; border-radius: 14px; background: var(--panel); border-left: 5px solid var(--brand); }
.sne-res { font-size: 22px; font-weight: 900; color: var(--brand); }
.seg-wrap { overflow-x: auto; }
.chair-flip .btn { margin-top: 8px; }
.cf-note { font-size: 13.5px; margin-top: 6px; min-height: 1em; }
.sec-list { display: grid; gap: 10px; }
.sec-item { display: flex; gap: 14px; align-items: center; padding: 14px 18px; text-decoration: none; color: var(--ink); }
.sec-item:hover { border-color: var(--brand); }
.sec-item small { display: block; color: var(--ink2); font-size: 13.5px; font-weight: 600; }
.sec-n { flex: none; width: 34px; height: 34px; border-radius: 11px; display: grid; place-items: center; background: var(--soft); font-weight: 900; color: var(--brand); }
.recap { max-width: 860px; margin: 0 auto; }
.recap-sec { margin: 14px 0; }
.recap-sec h3 a { color: var(--ink); text-decoration: none; }
.recap-sec h3 a:hover { color: var(--brand); }
.tldr-inline { font-weight: 700; margin: 4px 0 6px; }
.recap-sec ul { margin: 6px 0; padding-left: 20px; }
@media (max-width: 600px) {
  .reag-grid { grid-template-columns: 1fr; }
  .rxn-arrow { min-width: 80px; }
  .lesson-card h2 { font-size: 22px; }
  .tldr { flex-direction: column; gap: 2px; }
  .lesson-card { padding: 18px 14px; }
  .fig { padding: 10px 6px; }
}
@media print {
  .sidebar, .topbar, .tabbar, .no-print, #toasts { display: none !important; }
  #app { display: block; }
  body { background: #fff; }
  .card { box-shadow: none; break-inside: avoid; }
}

/* ================= Carby, front and center ================= */
.brand .mascot { flex: none; }
.carby-says { display: flex; gap: 12px; align-items: flex-start; margin: 16px 0; }
.carby-says .mascot { flex: none; margin-top: 2px; }
.carby-says .bubble { position: relative; flex: 1; padding: 12px 16px; border-radius: 16px; font-size: 15.5px; border: 2px solid; }
.carby-says .bubble::before { content: ''; position: absolute; left: -9px; top: 18px; width: 14px; height: 14px; transform: rotate(45deg); background: inherit; border-left: 2px solid; border-bottom: 2px solid; border-color: inherit; }
.carby-says.tip .bubble { background: color-mix(in srgb, var(--teal) 12%, var(--panel)); border-color: color-mix(in srgb, var(--teal) 55%, transparent); }
.carby-says.trap .bubble { background: color-mix(in srgb, var(--red) 10%, var(--panel)); border-color: color-mix(in srgb, var(--red) 50%, transparent); }
.carby-says .who { font-size: 11.5px; font-weight: 900; text-transform: uppercase; letter-spacing: .08em; margin-bottom: 2px; }
.carby-says.tip .who { color: var(--teal-d); }
.carby-says.trap .who { color: var(--red); }
.carby-hint { display: flex; gap: 10px; align-items: center; }
.carby-hint .mascot { flex: none; }

/* Carby buddy in the top bar */
#topbar-stats { display: flex; align-items: center; gap: 14px; flex: 1; min-width: 0; }
#carby-buddy { position: relative; flex: none; line-height: 0; }
#carby-buddy.bounce .cb-face { animation: carbyBounce .7s cubic-bezier(.3, 1.6, .5, 1); }
@keyframes carbyBounce { 0% { transform: scale(1); } 30% { transform: scale(1.35) rotate(-10deg); } 60% { transform: scale(.95) rotate(6deg); } 100% { transform: scale(1); } }
.cb-bubble { position: absolute; top: 50px; left: -6px; z-index: 60; width: max-content; max-width: min(300px, 80vw); line-height: 1.4; padding: 10px 14px; border-radius: 14px; background: var(--panel); border: 2px solid var(--brand); box-shadow: var(--shadow); font-weight: 800; font-size: 14px; animation: fadeUp .25s; }
.cb-bubble::before { content: ''; position: absolute; top: -8px; left: 18px; width: 12px; height: 12px; transform: rotate(45deg); background: var(--panel); border-left: 2px solid var(--brand); border-top: 2px solid var(--brand); }
.carby-daily { font-size: 16px; }
.unit-intro { margin: 18px 0 0; }
.unit-intro .bubble { font-size: 16px; font-weight: 700; }
@media (max-width: 900px) { #topbar-stats { gap: 8px; } }.brand small { white-space: normal; }

/* ================= Carby Explains: walkthrough theater ================= */
.theater { position: fixed; inset: 0; z-index: 160; background: var(--bg); display: flex; flex-direction: column; animation: fadeUp .25s; }
.th-top { display: flex; align-items: center; gap: 12px; padding: 12px 20px; border-bottom: 2px solid var(--line); }
.th-title { font-weight: 900; font-size: 17px; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.th-count { font-weight: 800; color: var(--ink2); font-size: 13px; }
.th-progress { height: 5px; background: var(--soft); }
.th-progress i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--brand), var(--pink)); transition: width .4s; }
.th-stage { flex: 1; min-height: 0; overflow: auto; padding: 18px; display: flex; justify-content: center; align-items: flex-start; }
.th-board { width: 100%; max-width: 820px; min-height: 200px; }
.th-board-in { animation: fadeUp .35s; }
.th-board-in .q-prompt { font-size: 20px; }
.th-end { text-align: center; padding: 30px 10px; }
.th-bottom { display: flex; align-items: flex-end; gap: 10px; padding: 0 20px 6px; max-width: 900px; width: 100%; margin: 0 auto; }
.th-carby { flex: none; line-height: 0; }
.th-bubble { position: relative; flex: 1; margin-bottom: 26px; padding: 14px 18px; border-radius: 20px; background: var(--panel); border: 2px solid var(--brand); box-shadow: var(--shadow); min-height: 62px; }
.th-bubble::before { content: ''; position: absolute; left: -10px; bottom: 22px; width: 16px; height: 16px; transform: rotate(45deg); background: var(--panel); border-left: 2px solid var(--brand); border-bottom: 2px solid var(--brand); }
.th-say { font-size: 18px; font-weight: 700; line-height: 1.45; }
.th-ask-q { font-weight: 900; margin: 10px 0 8px; }
.th-ask-opts { display: grid; gap: 8px; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); }
.th-ask-opts .choice { padding: 10px 14px; font-size: 15px; }
.th-ask-fb { margin: 10px 0 8px; padding: 10px 14px; border-radius: 12px; font-weight: 700; }
.th-ask-fb.ok { background: var(--ok-bg); } .th-ask-fb.bad { background: var(--bad-bg); }
.th-controls { display: flex; justify-content: center; gap: 8px; padding: 10px 16px calc(12px + env(safe-area-inset-bottom)); border-top: 2px solid var(--line); }
.th-loading { margin: auto; text-align: center; padding: 20px; }
.wt-title { text-align: center; padding: 24px 10px; }
.wt-title .wt-ico { font-size: 64px; }
.wt-title h2 { font-size: 30px; }
.wb-note { font-size: 19px; line-height: 1.55; padding: 18px 22px; border-radius: 16px; background: var(--soft); border-left: 6px solid var(--brand); }
.wt-rank { font-size: 18px; font-weight: 800; } .wt-rank li { margin: 6px 0; }
.wt-num { font-size: 56px; font-weight: 900; text-align: center; color: var(--brand); }
.watch-btn { margin: 0 0 10px; text-transform: none; letter-spacing: 0; }

/* animated Carby actor */
.actor { overflow: visible; }
.actor .body { transform-box: fill-box; transform-origin: 50% 100%; animation: actorIdle 2.6s ease-in-out infinite; }
.actor .eyes { transform-box: fill-box; transform-origin: center; animation: blink 4.2s infinite; }
.actor .b-right { transform-box: view-box; transform-origin: 50px 50px; }
.actor .mouth > * { display: none; }
.actor.mood-happy .m-smile, .actor.mood-wow .m-open, .actor.mood-think .m-flat, .actor.mood-sad .m-sad, .actor:not([class*="mood-"]) .m-smile { display: inline; }
.actor.talking .mouth .m-open { display: inline; animation: talk .26s steps(2) infinite; }
.actor.talking .mouth .m-smile, .actor.talking .mouth .m-flat, .actor.talking .mouth .m-sad { display: inline; animation: talk .26s steps(2) infinite reverse; }
.actor .brows { opacity: 0; transition: opacity .2s; }
.actor.mood-think .brows, .actor.mood-wow .brows { opacity: 1; }
.actor.mood-think .br-l { transform: translateY(-2px); }
.actor.mood-think .eyes { animation: lookUp 3s ease-in-out infinite; }
.actor.mood-wow .b-right { animation: wave .9s ease-in-out 2; }
.actor.mood-wow .body { animation: hop .6s ease-out 1, actorIdle 2.6s ease-in-out .6s infinite; }
.actor.mood-sad .body { animation: droop 3s ease-in-out infinite; }
@keyframes actorIdle { 0%, 100% { transform: translateY(0) scale(1); } 50% { transform: translateY(-2px) scale(1.015, .985); } }
@keyframes blink { 0%, 90%, 100% { transform: scaleY(1); } 94% { transform: scaleY(.1); } }
@keyframes talk { 0% { opacity: 1; } 100% { opacity: 0; } }
@keyframes wave { 0%, 100% { transform: rotate(0); } 30% { transform: rotate(-28deg); } 60% { transform: rotate(12deg); } }
@keyframes hop { 0% { transform: translateY(0); } 40% { transform: translateY(-9px) scale(.96, 1.05); } 100% { transform: translateY(0); } }
@keyframes lookUp { 0%, 100% { transform: translate(0, 0); } 50% { transform: translate(2px, -2px); } }
@keyframes droop { 0%, 100% { transform: translateY(1px) rotate(-2deg); } 50% { transform: translateY(2px) rotate(2deg); } }
@media (prefers-reduced-motion: reduce) { .actor *, .actor { animation: none !important; } }
@media (max-width: 600px) {
  .th-bottom { padding: 0 10px 4px; } .th-carby svg { width: 84px; height: 84px; } .th-say { font-size: 16px; }
  .th-stage { padding: 10px; } .th-bubble { margin-bottom: 14px; }
}

/* ================= My Course ================= */
.ai-chip { display: inline-block; margin: 4px 0 10px; padding: 6px 14px; border-radius: 99px; font-size: 14px; background: var(--soft); color: var(--ink2); border: 2px solid var(--line); }
.ai-chip.on { color: var(--teal-d); border-color: color-mix(in srgb, var(--teal) 50%, transparent); }
.ai-setup code, .md-out code { font-family: var(--mono); font-size: 13px; padding: 1px 6px; border-radius: 6px; background: var(--soft); }
.dropzone { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 26px 16px; margin: 10px 0 16px; border: 3px dashed var(--line); border-radius: 20px; background: var(--panel); cursor: pointer; text-align: center; transition: border-color .15s, background .15s; }
.dropzone:hover, .dropzone.over { border-color: var(--brand); background: var(--soft); }
.dropzone input { display: none; }
.dropzone .dz-ico { font-size: 34px; }
.dropzone small { color: var(--ink2); font-weight: 600; }
.up-row { display: flex; align-items: center; gap: 10px; font-weight: 700; margin-bottom: 10px; }
.cover-list { display: grid; gap: 10px; }
.cover-row { --c: var(--brand); display: flex; flex-direction: column; gap: 8px; padding: 16px 18px; border-left: 6px solid var(--c); }
.cover-refs { font-size: 13px; } .cover-refs a { color: var(--ink2); }
.exam-card { display: flex; gap: 18px; align-items: center; border: 2px solid var(--orange); }
.exam-count { flex: none; width: 84px; height: 84px; border-radius: 22px; display: grid; place-items: center; align-content: center; background: linear-gradient(135deg, var(--orange), var(--pink)); color: #fff; }
.exam-count b { font-size: 34px; line-height: 1; } .exam-count small { font-weight: 800; }
.exam-row { display: flex; justify-content: space-between; gap: 12px; align-items: center; flex-wrap: wrap; margin-bottom: 10px; }
.exam-row.past { opacity: .55; }
.unit-picks { display: flex; flex-wrap: wrap; gap: 6px; }
.pick { display: inline-flex; gap: 6px; align-items: center; padding: 6px 10px; border-radius: 10px; border: 2px solid var(--line); font-size: 13.5px; font-weight: 700; cursor: pointer; }
.pick:has(input:checked) { border-color: var(--brand); background: var(--soft); }
.doc-card { margin-bottom: 12px; }
.doc-name { margin: 0; overflow-wrap: anywhere; }
.doc-actions { margin-top: 10px; gap: 6px; }
.doc-actions .btn { text-transform: none; letter-spacing: 0; }
select.kind { font: inherit; font-weight: 800; font-size: 13px; padding: 6px 8px; border-radius: 10px; border: 2px solid var(--line); background: var(--panel); color: var(--ink); }
.made-row { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; }
.modal.wide { max-width: 860px; }
.doc-text { white-space: pre-wrap; font-family: var(--font); font-size: 15px; background: var(--soft); padding: 14px; border-radius: 12px; max-height: 55vh; overflow: auto; }
.md-out { max-height: 62vh; overflow: auto; margin: 12px 0; font-size: 15.5px; }
.md-out h2, .md-out h3, .md-out h4 { margin: 14px 0 6px; }
.cite { font-size: 12px; font-weight: 800; padding: 1px 7px; border-radius: 99px; background: color-mix(in srgb, var(--blue) 18%, transparent); color: var(--blue); white-space: nowrap; }
.chat { display: flex; flex-direction: column; height: min(62vh, 620px); padding: 0; overflow: hidden; }
.chat-log { flex: 1; overflow: auto; padding: 16px; display: flex; flex-direction: column; gap: 12px; }
.chat-empty { margin: auto; text-align: center; max-width: 460px; }
.msg { display: flex; gap: 8px; align-items: flex-start; max-width: 88%; }
.msg.me { align-self: flex-end; }
.msg .mb { padding: 10px 14px; border-radius: 16px; background: var(--soft); font-size: 15px; overflow-wrap: anywhere; }
.msg.me .mb { background: var(--brand); color: #fff; }
.msg .mb p { margin: 4px 0; } .msg .mb ul, .msg .mb ol { margin: 4px 0; padding-left: 20px; }
.msg.typing .mb { color: var(--ink2); font-style: italic; }
.chat-in { display: flex; gap: 8px; padding: 12px; border-top: 2px solid var(--line); }
.chat-in input { flex: 1; min-width: 0; font: inherit; padding: 10px 14px; border-radius: 14px; border: 2px solid var(--line); background: var(--panel); color: var(--ink); }
.chat-in input:focus { outline: none; border-color: var(--brand); }
.carby-daily a { color: #fff; font-weight: 900; }
.th-stage { align-items: center; }
@media (min-width: 900px) { .th-board-in { zoom: 1.2; } }

/* ================= feedback & version ================= */
.fb-chip { cursor: pointer; font-size: 15px; }
.ver-link { display: inline-block; margin-top: 8px; font-size: 12px; font-weight: 800; color: var(--ink2); }
.sidebar .foot .btn { margin-bottom: 4px; text-transform: none; letter-spacing: 0; }
.fb-form { text-align: center; }
.fb-kinds { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; margin: 12px 0; }
.fb-kinds .opt { border: 2px solid var(--line); border-radius: 12px; padding: 7px 10px; background: var(--panel); font-weight: 800; font-size: 13px; }
.fb-kinds .opt.on { border-color: var(--brand); background: var(--soft); color: var(--brand); }
.fb-form textarea { width: 100%; font: inherit; padding: 12px; border-radius: 14px; border: 2px solid var(--line); background: var(--panel); color: var(--ink); resize: vertical; }
.fb-form textarea:focus { outline: none; border-color: var(--brand); }
.whats-new { text-align: center; }
.wn-ver { text-align: left; margin: 10px 0; }
.wn-ver ul { margin: 4px 0; padding-left: 20px; }
.card.access { margin-bottom: 12px; }
@media (max-width: 480px) { .fb-chip { padding: 5px 8px; } }
