/*
 * DSA Prep - "Tactile Arcade" design system.
 * Keycap buttons that physically press, solid layered surfaces, a cursor spotlight on cards,
 * per-phase colour tones. Dark ("night arcade") by default, warm "paper" light theme.
 */
:root {
  --bg: #090b18;
  --s0: #05060e; --s1: #0d1021; --s2: #13162d; --s3: #1a1e3a; --s4: #252a4b; --s5: #31375d;
  --row: #171b35; --row-hover: #1d2242;
  --card-bg: linear-gradient(180deg, rgba(255, 255, 255, .028), rgba(255, 255, 255, 0) 45%), #12152c;
  --card-shadow: inset 0 1px 0 rgba(255, 255, 255, .05), 0 2px 0 rgba(0, 0, 0, .35), 0 18px 32px -20px rgba(0, 0, 0, .8);
  --card-shadow-hover: inset 0 1px 0 rgba(255, 255, 255, .07), 0 2px 0 rgba(0, 0, 0, .35), 0 26px 40px -22px rgba(0, 0, 0, .9);
  --line: rgba(255, 255, 255, .075); --line-2: rgba(255, 255, 255, .14);
  --text: #eceefe; --text-2: #a9acc8; --muted: #7b7fa0;
  --primary: #b4a5ff; --primary-strong: #7c5cff; --primary-ledge: #4a2fc9; --primary-soft: rgba(124, 92, 255, .16);
  --lime: #b6f33f; --lime-fill: #b6f33f; --lime-ledge: #6f9a12; --lime-soft: rgba(182, 243, 63, .12); --on-lime: #142000;
  --coral: #ff7d6b; --coral-fill: #ff7d6b; --coral-soft: rgba(255, 125, 107, .14);
  --sky: #4cc3ff; --sky-fill: #38bdf8; --sky-soft: rgba(56, 189, 248, .13);
  --pink: #f78bc6; --pink-fill: #f472b6; --pink-soft: rgba(244, 114, 182, .14);
  --amber: #fcc94a; --amber-fill: #fbbf24; --amber-soft: rgba(251, 191, 36, .14);
  --easy: #34d399; --easy-soft: rgba(52, 211, 153, .14);
  --medium: #fbbf24; --medium-soft: rgba(251, 191, 36, .14);
  --hard: #f472b6; --hard-soft: rgba(244, 114, 182, .14);
  --ok: #b6f33f; --ok-soft: rgba(182, 243, 63, .13); --bad: #ff6e84; --bad-soft: rgba(255, 110, 132, .14); --warn: #fbbf24;
  --btn-bg: #1d2140; --btn-hover: #242a50; --btn-hi: rgba(255, 255, 255, .08); --btn-ledge: #070914;
  --code-bg: #070915; --code-text: #e2e4fb; --code-line: rgba(255, 255, 255, .06);
  --tk-k: #b4a5ff; --tk-s: #b6f33f; --tk-c: #6f7390; --tk-n: #ff8f7d; --tk-t: #7dd3fc; --tk-f: #f5d0fe; --tk-a: #fbbf24;
  --heat-0: #191d38; --heat-1: #33296b; --heat-2: #5240b8; --heat-3: #7c5cff; --heat-4: #b6f33f;
  --glow-a: rgba(124, 92, 255, .17); --glow-b: rgba(182, 243, 63, .05); --dots: rgba(236, 238, 254, .07); --grain: .05;
  --shadow-lg: 0 24px 60px -12px rgba(0, 0, 0, .7);
  --r: 18px; --r-sm: 12px;
  --font: "Plus Jakarta Sans", "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
  --head: "Space Grotesk", "Plus Jakarta Sans", "Segoe UI", system-ui, sans-serif;
  --mono: "JetBrains Mono", "Cascadia Code", Consolas, "Courier New", monospace;
  --sidebar: 252px;
  --ease: cubic-bezier(.2, .8, .2, 1);
  --spring: cubic-bezier(.34, 1.56, .64, 1);
  color-scheme: dark;
}
:root[data-theme="light"] {
  --bg: #f3f0e7;
  --s0: #ffffff; --s1: #faf8f2; --s2: #ffffff; --s3: #f2efe5; --s4: #e6e2d4; --s5: #d6d1c0;
  --row: #f8f6ef; --row-hover: #f1eee3;
  --card-bg: #ffffff;
  --card-shadow: 0 1px 0 rgba(36, 28, 80, .05), 0 3px 0 -1px rgba(36, 28, 80, .06), 0 16px 30px -22px rgba(36, 28, 80, .35);
  --card-shadow-hover: 0 1px 0 rgba(36, 28, 80, .05), 0 4px 0 -1px rgba(36, 28, 80, .08), 0 26px 40px -22px rgba(36, 28, 80, .45);
  --line: rgba(30, 24, 66, .10); --line-2: rgba(30, 24, 66, .19);
  --text: #18152c; --text-2: #4a4663; --muted: #78748e;
  --primary: #5a3cf0; --primary-strong: #6a4cf5; --primary-ledge: #4024c4; --primary-soft: rgba(106, 76, 245, .10);
  --lime: #4a7c00; --lime-fill: #b6f33f; --lime-ledge: #84b51b; --lime-soft: rgba(150, 214, 30, .2); --on-lime: #142000;
  --coral: #d4452e; --coral-fill: #ff7d6b; --coral-soft: rgba(239, 96, 72, .12);
  --sky: #0573b3; --sky-fill: #38bdf8; --sky-soft: rgba(14, 150, 220, .11);
  --pink: #be2a74; --pink-fill: #f472b6; --pink-soft: rgba(219, 39, 119, .10);
  --amber: #9a5b00; --amber-fill: #fbbf24; --amber-soft: rgba(230, 160, 20, .16);
  --easy: #047857; --easy-soft: rgba(5, 150, 105, .12);
  --medium: #9a5b00; --medium-soft: rgba(230, 160, 20, .16);
  --hard: #be185d; --hard-soft: rgba(219, 39, 119, .10);
  --ok: #3f7400; --ok-soft: rgba(150, 214, 30, .22); --bad: #d0213f; --bad-soft: rgba(225, 29, 72, .09); --warn: #9a5b00;
  --btn-bg: #ffffff; --btn-hover: #faf8f2; --btn-hi: rgba(255, 255, 255, .9); --btn-ledge: #d6d1c0;
  --code-bg: #fbfaf5; --code-text: #1f1b3a; --code-line: rgba(30, 24, 66, .07);
  --tk-k: #5a2fe0; --tk-s: #3f7400; --tk-c: #8b879f; --tk-n: #c2412d; --tk-t: #0369a1; --tk-f: #a21caf; --tk-a: #9a5b00;
  --heat-0: #e8e4d8; --heat-1: #d4cbff; --heat-2: #a594f9; --heat-3: #6a4cf5; --heat-4: #9bd81e;
  --glow-a: rgba(124, 92, 255, .11); --glow-b: rgba(255, 125, 107, .08); --dots: rgba(24, 21, 44, .10); --grain: .07;
  --shadow-lg: 0 24px 60px -16px rgba(36, 28, 80, .35);
  color-scheme: light;
}
.tone-violet { --tone: var(--primary); --tone-fill: var(--primary-strong); --tone-soft: var(--primary-soft); }
.tone-lime { --tone: var(--lime); --tone-fill: var(--lime-fill); --tone-soft: var(--lime-soft); }
.tone-sky { --tone: var(--sky); --tone-fill: var(--sky-fill); --tone-soft: var(--sky-soft); }
.tone-coral { --tone: var(--coral); --tone-fill: var(--coral-fill); --tone-soft: var(--coral-soft); }
.tone-pink { --tone: var(--pink); --tone-fill: var(--pink-fill); --tone-soft: var(--pink-soft); }
.tone-amber { --tone: var(--amber); --tone-fill: var(--amber-fill); --tone-soft: var(--amber-soft); }

* { box-sizing: border-box; }
html, body { height: 100%; }
html { -webkit-tap-highlight-color: transparent; }
body { margin: 0; background: var(--bg); color: var(--text); font: 15px/1.6 var(--font); -webkit-font-smoothing: antialiased; overflow-x: hidden; transition: background-color .3s; }
#bgGlow { position: fixed; inset: 0; pointer-events: none; z-index: 0; background: radial-gradient(900px 560px at 88% -12%, var(--glow-a), transparent 62%), radial-gradient(760px 520px at -8% 108%, var(--glow-b), transparent 62%); }
#bgGlow::before { content: ""; position: absolute; inset: 0; background-image: radial-gradient(var(--dots) 1px, transparent 1.4px); background-size: 22px 22px; -webkit-mask-image: radial-gradient(ellipse 90% 75% at 60% 0%, #000 20%, transparent 78%); mask-image: radial-gradient(ellipse 90% 75% at 60% 0%, #000 20%, transparent 78%); }
#bgGlow::after { content: ""; position: absolute; inset: 0; opacity: var(--grain); mix-blend-mode: overlay; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E"); }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
button { font: inherit; color: inherit; }
h1, h2, h3, h4 { font-family: var(--head); line-height: 1.15; margin: 0 0 .5em; letter-spacing: -0.02em; }
h1 { font-size: 2.1rem; font-weight: 700; }
h2 { font-size: 1.2rem; font-weight: 700; }
h3 { font-size: 1.03rem; font-weight: 700; }
code, pre, kbd { font-family: var(--mono); }
code, pre, kbd, .io, .compile-err, .CodeMirror, .mono, textarea.fallback { font-variant-ligatures: none; font-feature-settings: "liga" 0, "calt" 0; }
kbd { font-size: .76em; padding: 1px 6px; border: 1px solid var(--line-2); border-bottom-width: 3px; border-radius: 6px; background: var(--s3); color: var(--text-2); }
svg.i { width: 18px; height: 18px; flex: none; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.i.tiny { width: 13px; height: 13px; vertical-align: -2px; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.mono { font-family: var(--mono); }
.nowrap { white-space: nowrap; }
.hidden { display: none !important; }
.accent { color: var(--primary); }
.lime { color: var(--lime); }
.coral { color: var(--coral); }
.spacer { flex: 1; }
.grow { flex: 1; min-width: 0; }
::selection { background: color-mix(in srgb, var(--primary-strong) 30%, transparent); }
* { scrollbar-width: thin; scrollbar-color: var(--s4) transparent; }
:focus-visible { outline: 2px solid var(--primary-strong); outline-offset: 2px; }

/* ------------------------------------------------ brand */
.logo { display: block; flex: none; transition: transform .25s var(--spring); filter: drop-shadow(0 6px 10px rgba(74, 47, 201, .35)); }
.brand:hover .logo, .mobile-brand:hover .logo { transform: translateY(-1px) rotate(-5deg); }
.brand:active .logo, .mobile-brand:active .logo { transform: translateY(2px) scale(.94); transition-duration: .06s; }
.wordmark { font: 700 19px/1 var(--head); letter-spacing: -.02em; color: var(--text); white-space: nowrap; }
.wordmark em { font: 700 .74em/1 var(--mono); font-style: normal; color: var(--on-lime); background: var(--lime-fill); padding: 3px 6px 4px; border-radius: 6px; margin-left: 5px; position: relative; top: -2px; box-shadow: 0 2px 0 var(--lime-ledge); display: inline-block; transform: rotate(-3deg); }

/* ------------------------------------------------ shell */
.app { position: relative; z-index: 1; display: grid; grid-template-columns: var(--sidebar) minmax(0, 1fr); min-height: 100vh; }
.sidebar { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; background: color-mix(in srgb, var(--s1) 92%, transparent); border-right: 1px solid var(--line); padding: 18px 12px 12px; z-index: 40; backdrop-filter: blur(10px); }
.brand { display: flex; align-items: center; gap: 11px; padding: 2px 6px 22px; color: var(--text); text-decoration: none !important; }
.brand-text { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.brand small { font: 600 10.5px var(--mono); letter-spacing: .04em; color: var(--muted); }
.nav { position: relative; display: flex; flex-direction: column; gap: 2px; }
.nav-ind { position: absolute; left: 0; right: 0; top: 0; height: 42px; border-radius: 12px; background: var(--primary-soft); border: 1px solid color-mix(in srgb, var(--primary-strong) 28%, transparent); opacity: 0; pointer-events: none; transition: transform .5s var(--spring), height .3s var(--ease), opacity .25s; }
.nav-ind::before { content: ""; position: absolute; left: -13px; top: 10px; bottom: 10px; width: 4px; border-radius: 0 4px 4px 0; background: var(--primary-strong); box-shadow: 0 0 14px var(--primary-strong); }
.nav a { position: relative; z-index: 1; overflow: hidden; display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 12px; color: var(--text-2); font-weight: 600; font-size: 14px; text-decoration: none !important; transition: color .2s, background .2s; }
.nav a:hover { color: var(--text); background: color-mix(in srgb, var(--s3) 70%, transparent); }
.nav a .i { transition: transform .35s var(--spring); }
.nav a:hover .i { transform: translateX(2px) scale(1.08); }
.nav a.active { color: var(--primary); background: transparent; }
.nav a.active .i { animation: wiggle .55s var(--spring); }
.nav .badge { margin-left: auto; }
.side-foot { margin-top: auto; padding-top: 12px; border-top: 1px solid var(--line); display: flex; flex-direction: column; gap: 10px; }
.user-chip { position: relative; overflow: hidden; display: flex; align-items: center; gap: 10px; padding: 9px; border-radius: 14px; background: var(--row); border: 1px solid var(--line); text-decoration: none !important; color: var(--text); transition: border-color .2s, transform .2s var(--spring); }
.user-chip:hover { border-color: var(--line-2); transform: translateY(-1px); }
.user-chip .uc-text { display: flex; flex-direction: column; min-width: 0; line-height: 1.3; }
.user-chip .uc-text b, .user-chip .uc-text span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-chip b { font-size: 13.5px; }
.avatar { width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center; font: 700 15px var(--head); color: #fff; background: var(--primary-strong); box-shadow: inset 0 -3px 0 var(--primary-ledge); flex: none; position: relative; }
.avatar .lv { position: absolute; bottom: -5px; right: -6px; font: 700 9.5px var(--mono); background: var(--lime-fill); color: var(--on-lime); border-radius: 999px; padding: 1px 5px; border: 2px solid var(--s1); }
.avatar.xl { width: 84px; height: 84px; border-radius: 24px; font-size: 34px; box-shadow: inset 0 -6px 0 var(--primary-ledge), 0 14px 30px -10px rgba(124, 92, 255, .7); }
.avatar.xl .lv { font-size: 12px; padding: 2px 8px; bottom: -6px; right: -8px; border-color: var(--s2); }
.judge { display: flex; align-items: center; gap: 7px; font-size: 11.5px; color: var(--muted); padding: 0 4px; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); flex: none; }
.dot.on { background: var(--lime-fill); box-shadow: 0 0 0 3px var(--lime-soft); }
.dot.off { background: var(--bad); }
.dot.busy { background: var(--amber-fill); animation: blink 1s infinite; }
.shell { min-width: 0; display: flex; flex-direction: column; }
.hud { position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 10px; padding: 10px 28px; background: color-mix(in srgb, var(--bg) 82%, transparent); backdrop-filter: blur(14px) saturate(1.3); border-bottom: 1px solid var(--line); min-height: 62px; }
.hud .menu-btn, .hud .mobile-brand { display: none; }
.pill { position: relative; overflow: hidden; display: inline-flex; align-items: center; gap: 7px; height: 36px; padding: 0 13px; border-radius: 999px; background: var(--btn-bg); border: 1px solid var(--line); box-shadow: inset 0 1px 0 var(--btn-hi), 0 2px 0 var(--btn-ledge); font-size: 13px; font-weight: 700; white-space: nowrap; color: var(--text); text-decoration: none !important; transition: transform .15s var(--spring), box-shadow .15s; }
.pill:hover { transform: translateY(-1px); }
.pill:active { transform: translateY(2px); box-shadow: inset 0 1px 0 var(--btn-hi), 0 0 0 var(--btn-ledge); }
.pill .i { width: 16px; height: 16px; }
.pill.streak { color: var(--coral); }
.pill.streak .i { animation: flicker 2.4s infinite; fill: color-mix(in srgb, var(--coral) 30%, transparent); }
.pill.xp { gap: 10px; }
.pill.xp .lvl { font: 700 12px var(--mono); color: var(--on-lime); background: var(--lime-fill); padding: 2px 7px; border-radius: 999px; }
.pill.xp .bar { width: 96px; height: 7px; border-radius: 999px; background: var(--s4); overflow: hidden; }
.pill.xp .bar span { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--primary-strong), var(--lime-fill)); border-radius: 999px; transition: width .9s var(--ease); }
.pill.xp small { font: 600 11px var(--mono); color: var(--text-2); }
.pill.xp.bump { animation: bump .7s var(--spring); }
.icon-btn { position: relative; overflow: hidden; width: 38px; height: 38px; border-radius: 11px; display: grid; place-items: center; border: 1px solid var(--line); background: var(--btn-bg); color: var(--text-2); cursor: pointer; text-decoration: none !important; box-shadow: inset 0 1px 0 var(--btn-hi), 0 2px 0 var(--btn-ledge); transition: transform .15s var(--spring), box-shadow .12s, color .15s, background .15s; flex: none; }
.icon-btn:hover { color: var(--text); background: var(--btn-hover); transform: translateY(-1px); }
.icon-btn:active { transform: translateY(2px); box-shadow: inset 0 1px 0 var(--btn-hi), 0 0 0 var(--btn-ledge); transition-duration: .05s; }
#themeBtn .i { transition: transform .5s var(--spring); }
#themeBtn:hover .i { transform: rotate(40deg); }
.main { position: relative; min-width: 0; flex: 1; }
.main > * { transition: opacity .12s ease, transform .12s ease; }
.main.leaving > * { opacity: 0; transform: translateY(-6px) scale(.995); }
.page { max-width: 1180px; margin: 0 auto; padding: 30px 28px 80px; }
.page.narrow { max-width: 900px; }
.page > * { animation: rise .55s var(--ease) both; }
.page > *:nth-child(2) { animation-delay: .04s; } .page > *:nth-child(3) { animation-delay: .08s; } .page > *:nth-child(4) { animation-delay: .12s; }
.page > *:nth-child(5) { animation-delay: .16s; } .page > *:nth-child(6) { animation-delay: .2s; } .page > *:nth-child(n+7) { animation-delay: .24s; }
.stagger > * { animation: rise .5s var(--ease) both; }
.stagger > *:nth-child(2) { animation-delay: .05s; } .stagger > *:nth-child(3) { animation-delay: .1s; } .stagger > *:nth-child(4) { animation-delay: .15s; }
.stagger > *:nth-child(5) { animation-delay: .2s; } .stagger > *:nth-child(6) { animation-delay: .25s; } .stagger > *:nth-child(n+7) { animation-delay: .28s; }
.scrim { position: fixed; inset: 0; z-index: 35; background: rgba(5, 7, 15, .5); backdrop-filter: blur(2px); display: none; }
body.drawer-open .scrim { display: block; animation: fade .2s; }

/* ------------------------------------------------ cards */
.card { position: relative; background: var(--card-bg); border: 1px solid var(--line); border-radius: var(--r); padding: 20px; box-shadow: var(--card-shadow); }
.card + .card { margin-top: 16px; }
.grid > .card { margin-top: 0; }
.card.hover { transition: transform .35s var(--spring), border-color .25s, box-shadow .3s; }
.card.hover:hover { transform: translateY(-4px); border-color: color-mix(in srgb, var(--tone, var(--primary-strong)) 45%, var(--line)); box-shadow: var(--card-shadow-hover); }
.card.hover:active { transform: translateY(-1px) scale(.985); transition-duration: .08s; }
/* cursor spotlight + glowing border near the pointer */
:is(.card.hover, .topic-card, .book-card, .stat-card, .pdf-card, .list-row, .quest, .achv, .mini-card, .level-card, .continue-link, .promo, .option) { isolation: isolate; }
:is(.card.hover, .topic-card, .book-card, .stat-card, .pdf-card, .list-row, .quest, .achv, .mini-card, .level-card, .continue-link, .promo, .option)::after {
  content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none; z-index: -1; opacity: 0; transition: opacity .3s;
  background: radial-gradient(380px circle at var(--mx, 50%) var(--my, 50%), color-mix(in srgb, var(--tone-fill, var(--primary-strong)) 14%, transparent), transparent 55%);
}
:is(.card.hover, .topic-card, .book-card, .stat-card, .pdf-card, .list-row, .quest, .achv, .mini-card, .level-card, .continue-link, .promo, .option)::before {
  content: ""; position: absolute; inset: 0; border-radius: inherit; padding: 1px; pointer-events: none; opacity: 0; transition: opacity .3s;
  background: radial-gradient(200px circle at var(--mx, 50%) var(--my, 50%), var(--tone-fill, var(--primary-strong)), transparent 75%);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0); -webkit-mask-composite: xor; mask-composite: exclude;
}
:is(.card.hover, .topic-card, .book-card, .stat-card, .pdf-card, .list-row, .quest, .achv, .mini-card, .level-card, .continue-link, .promo, .option):hover::after { opacity: 1; }
:is(.card.hover, .topic-card, .book-card, .stat-card, .pdf-card, .list-row, .quest, .achv, .mini-card, .level-card, .continue-link, .promo, .option):hover::before { opacity: 1; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.card-head h2 { margin: 0; display: flex; align-items: center; gap: 10px; }
.card-icon { width: 38px; height: 38px; border-radius: 11px; display: grid; place-items: center; background: var(--primary-soft); color: var(--primary); flex: none; box-shadow: inset 0 -2px 0 color-mix(in srgb, var(--primary-strong) 25%, transparent); }
.card-icon.lime { background: var(--lime-soft); color: var(--lime); box-shadow: inset 0 -2px 0 color-mix(in srgb, var(--lime-fill) 30%, transparent); }
.card-icon.coral { background: var(--coral-soft); color: var(--coral); box-shadow: inset 0 -2px 0 color-mix(in srgb, var(--coral-fill) 30%, transparent); }
.card-icon.sky { background: var(--sky-soft); color: var(--sky); box-shadow: inset 0 -2px 0 color-mix(in srgb, var(--sky-fill) 30%, transparent); }
.card-icon.big { width: 52px; height: 52px; border-radius: 15px; }
.grid { display: grid; gap: 16px; }
.grid + .grid, .grid + .card, .card + .grid, .grid + .info-card { margin-top: 18px; }
.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.cols-main { grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); }
.col { min-width: 0; }
.row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.stack > * + * { margin-top: 12px; }
.eyebrow { font: 700 11px var(--mono); text-transform: uppercase; letter-spacing: .12em; color: var(--muted); margin-bottom: 6px; }
.crumbs { font-size: 13px; color: var(--muted); margin-bottom: 10px; display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.crumbs a { color: var(--muted); }
.crumbs a:hover { color: var(--primary); }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 24px; }
.page-head h1 { margin: 2px 0 6px; }
.page-head p { margin: 0; max-width: 720px; }
.page-head .row { gap: 10px; }

/* ------------------------------------------------ buttons (keycaps) */
.btn { --ledge: var(--btn-ledge); position: relative; overflow: hidden; display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 40px; padding: 0 16px; border-radius: 12px; border: 1px solid var(--line-2); background: var(--btn-bg); color: var(--text); font: 700 14px var(--head); cursor: pointer; text-decoration: none !important; white-space: nowrap; box-shadow: inset 0 1px 0 var(--btn-hi), 0 3px 0 var(--ledge); transition: transform .15s var(--spring), box-shadow .12s, background .15s, border-color .15s; user-select: none; }
.btn:hover { background: var(--btn-hover); transform: translateY(-1px); box-shadow: inset 0 1px 0 var(--btn-hi), 0 4px 0 var(--ledge); }
.btn:active { transform: translateY(3px); box-shadow: inset 0 1px 0 var(--btn-hi), 0 0 0 var(--ledge); transition-duration: .05s; }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none; box-shadow: inset 0 1px 0 var(--btn-hi), 0 3px 0 var(--ledge); }
.btn .i { width: 17px; height: 17px; }
.btn.primary { --ledge: var(--primary-ledge); background: var(--primary-strong); border-color: transparent; color: #fff; box-shadow: inset 0 1px 0 rgba(255, 255, 255, .28), 0 3px 0 var(--ledge), 0 10px 22px -10px rgba(124, 92, 255, .8); }
.btn.primary:hover { background: color-mix(in srgb, var(--primary-strong) 88%, #fff); box-shadow: inset 0 1px 0 rgba(255, 255, 255, .28), 0 4px 0 var(--ledge), 0 14px 26px -10px rgba(124, 92, 255, .9); }
.btn.primary:active { box-shadow: inset 0 1px 0 rgba(255, 255, 255, .28), 0 0 0 var(--ledge), 0 4px 10px -6px rgba(124, 92, 255, .8); }
.btn.primary::after { content: ""; position: absolute; top: 0; bottom: 0; left: -70%; width: 45%; background: linear-gradient(100deg, transparent, rgba(255, 255, 255, .32), transparent); transform: skewX(-20deg); transition: left .7s var(--ease); pointer-events: none; }
.btn.primary:hover::after { left: 135%; }
.btn.lime { --ledge: var(--lime-ledge); background: var(--lime-fill); border-color: transparent; color: var(--on-lime); box-shadow: inset 0 1px 0 rgba(255, 255, 255, .45), 0 3px 0 var(--ledge); }
.btn.lime:hover { background: color-mix(in srgb, var(--lime-fill) 90%, #fff); }
.btn.danger { --ledge: color-mix(in srgb, var(--bad) 55%, #000); background: var(--bad); border-color: transparent; color: #fff; }
.btn.danger-ghost { background: transparent; color: var(--bad); border-color: color-mix(in srgb, var(--bad) 40%, transparent); box-shadow: none; }
.btn.danger-ghost:hover { background: var(--bad-soft); box-shadow: none; }
.btn.ghost { background: transparent; border-color: transparent; color: var(--text-2); box-shadow: none; }
.btn.ghost:hover { background: var(--s3); color: var(--text); transform: none; box-shadow: none; }
.btn.ghost:active { transform: scale(.96); box-shadow: none; }
.btn.sm { height: 32px; padding: 0 12px; font-size: 13px; border-radius: 10px; }
.btn.lg { height: 50px; padding: 0 24px; font-size: 16px; border-radius: 14px; }
.btn.block { width: 100%; }
.ripple { position: absolute; border-radius: 50%; pointer-events: none; background: currentColor; opacity: .22; transform: scale(0); animation: ripple .6s var(--ease) forwards; z-index: 0; }
.option .ripple, .list-row .ripple { opacity: .1; }

/* ------------------------------------------------ chips, bars, rings, tabs */
.badge { display: inline-flex; align-items: center; gap: 5px; height: 22px; padding: 0 9px; border-radius: 999px; font: 700 11px var(--mono); background: var(--s4); color: var(--text-2); white-space: nowrap; }
.badge .i { width: 12px; height: 12px; stroke-width: 3; }
.badge.accent { background: var(--primary-strong); color: #fff; }
.badge.coral, .badge.count { background: var(--coral-fill); color: #2a0a05; }
.badge.easy { background: var(--easy-soft); color: var(--easy); }
.badge.medium { background: var(--medium-soft); color: var(--medium); }
.badge.hard { background: var(--hard-soft); color: var(--hard); }
.badge.ok { background: var(--ok-soft); color: var(--ok); }
.badge.bad { background: var(--bad-soft); color: var(--bad); }
.badge.violet { background: var(--primary-soft); color: var(--primary); }
.badge.sky { background: var(--sky-soft); color: var(--sky); }
.badge.tone { background: var(--tone-soft); color: var(--tone); }
.badge.timer.low, .badge.low { background: var(--bad-soft); color: var(--bad); animation: blink 1s infinite; }
.kind { font: 700 10px var(--mono); letter-spacing: .06em; padding: 2px 7px; border-radius: 6px; background: var(--primary-soft); color: var(--primary); }
.kind.CODE { background: var(--sky-soft); color: var(--sky); }
.kind.QUIZ { background: var(--amber-soft); color: var(--amber); }
.kind.TEST, .kind.MOCK { background: var(--pink-soft); color: var(--pink); }
.kind.REVIEW { background: var(--coral-soft); color: var(--coral); }
.kind.LEETCODE { background: var(--s4); color: var(--text-2); }
.xp-tag { font: 700 12px var(--mono); color: var(--lime); white-space: nowrap; }
.xp-tag .i { width: 14px; height: 14px; stroke-width: 3; vertical-align: -2px; }
.progress { height: 8px; background: var(--s4); border-radius: 999px; overflow: hidden; }
.progress > span { display: block; height: 100%; width: 0; border-radius: 999px; background: var(--primary-strong); transition: width 1.1s var(--ease); background-image: linear-gradient(90deg, rgba(255, 255, 255, 0), rgba(255, 255, 255, .25)); }
.progress.lime > span { background-color: var(--lime-fill); }
.progress.tone > span { background-color: var(--tone-fill, var(--primary-strong)); }
.progress.thin { height: 6px; }
.ring { position: relative; width: 60px; height: 60px; flex: none; }
.ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring circle { fill: none; stroke-width: 6; }
.ring .track { stroke: var(--s4); }
.ring .val { stroke: var(--primary-strong); stroke-linecap: round; transition: stroke-dashoffset 1.3s var(--ease); }
.ring.lime .val { stroke: var(--lime-fill); }
.ring.coral .val { stroke: var(--coral-fill); }
.ring.tone .val { stroke: var(--tone-fill, var(--primary-strong)); }
.ring b { position: absolute; inset: 0; display: grid; place-items: center; font: 700 12px var(--mono); }
.tabs { display: flex; gap: 4px; padding: 5px; border-radius: 15px; background: var(--s1); border: 1px solid var(--line); margin-bottom: 22px; overflow-x: auto; scrollbar-width: none; box-shadow: inset 0 2px 4px rgba(0, 0, 0, .12); }
.tabs::-webkit-scrollbar { display: none; }
.tabs a, .tabs button { position: relative; overflow: hidden; padding: 8px 14px; border: 0; background: none; color: var(--text-2); font: 600 14px var(--head); border-radius: 10px; cursor: pointer; white-space: nowrap; text-decoration: none !important; transition: background .2s, color .2s, transform .15s var(--spring); display: inline-flex; align-items: center; gap: 7px; }
.tabs a .i, .tabs button .i { width: 16px; height: 16px; }
.tabs a:hover, .tabs button:hover { color: var(--text); }
.tabs a:active, .tabs button:active { transform: scale(.96); }
.tabs a.active, .tabs button.active { background: var(--btn-bg); color: var(--primary); box-shadow: inset 0 1px 0 var(--btn-hi), 0 2px 0 var(--btn-ledge), 0 0 0 1px var(--line); }
.tabs .count { font: 700 11px var(--mono); color: var(--muted); }
.seg { display: inline-flex; padding: 4px; border-radius: 13px; background: var(--s1); border: 1px solid var(--line); box-shadow: inset 0 2px 4px rgba(0, 0, 0, .12); }
.seg button { position: relative; overflow: hidden; border: 0; background: none; padding: 6px 13px; border-radius: 9px; font: 600 13px var(--head); color: var(--text-2); cursor: pointer; transition: background .2s, color .2s, transform .15s var(--spring); }
.seg button:active { transform: scale(.95); }
.seg button.on { background: var(--btn-bg); color: var(--primary); box-shadow: inset 0 1px 0 var(--btn-hi), 0 2px 0 var(--btn-ledge), 0 0 0 1px var(--line); }
input[type=text], input[type=password], input[type=date], input[type=number], select, textarea { font: inherit; color: var(--text); background: var(--s0); border: 1px solid var(--line-2); border-radius: 12px; padding: 10px 13px; outline: none; box-shadow: inset 0 2px 3px rgba(0, 0, 0, .1); transition: border-color .15s, box-shadow .15s; }
input:focus, select:focus, textarea:focus { border-color: var(--primary-strong); box-shadow: 0 0 0 4px var(--primary-soft); }
textarea { width: 100%; resize: vertical; }
label.field { display: flex; flex-direction: column; gap: 6px; font: 700 11px var(--mono); text-transform: uppercase; letter-spacing: .07em; color: var(--text-2); }
label.field input, label.field select, label.field textarea { text-transform: none; letter-spacing: 0; font: 15px var(--font); }
label.field.inline { flex-direction: row; align-items: center; gap: 8px; }
.empty { text-align: center; padding: 30px 16px; color: var(--muted); }
.empty b { display: block; color: var(--text); font: 700 16px var(--head); margin-bottom: 4px; }
.info-card { display: flex; align-items: flex-start; gap: 14px; }
.info-card > div { flex: 1; min-width: 0; }
.info-card p { margin: 4px 0 0; }
.info-card .btn { flex: none; align-self: center; }
.callout, .md blockquote { margin: 1em 0; padding: 13px 16px; border-radius: 14px; border: 1px solid var(--line); border-left: 4px solid var(--primary-strong); background: var(--primary-soft); }
.callout > :first-child { margin-top: 0; } .callout > :last-child { margin-bottom: 0; }
.callout.tip { border-left-color: var(--lime-fill); background: var(--lime-soft); }
.callout.warn { border-left-color: var(--amber-fill); background: var(--amber-soft); }
.callout.danger { border-left-color: var(--bad); background: var(--bad-soft); }
.offline-banner { background: var(--amber-soft); color: var(--text); border: 1px solid var(--line); border-left: 4px solid var(--amber-fill); border-radius: 14px; padding: 12px 15px; font-size: 14px; margin-bottom: 16px; }
.offline-banner code { background: var(--s3); padding: 1px 6px; border-radius: 6px; }

/* ------------------------------------------------ dashboard */
.hero { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 18px; align-items: end; margin-bottom: 22px; }
.hero h1 { font-size: 2.7rem; margin: 10px 0 8px; }
.target-chip { display: inline-flex; align-items: center; gap: 8px; padding: 5px 12px; border-radius: 999px; background: var(--lime-soft); color: var(--lime); font: 700 12px var(--head); border: 1px solid color-mix(in srgb, var(--lime-fill) 30%, transparent); }
.target-chip::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--lime-fill); box-shadow: 0 0 0 3px color-mix(in srgb, var(--lime-fill) 25%, transparent); animation: blink 2s infinite; }
.hero-sub { color: var(--text-2); display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.hero-sub .sep { opacity: .4; }
.hero-cards { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.mini-card, .level-card { position: relative; padding: 14px 16px; border-radius: var(--r); background: var(--card-bg); border: 1px solid var(--line); box-shadow: var(--card-shadow); color: var(--text); text-decoration: none !important; transition: transform .35s var(--spring), border-color .2s; }
.mini-card { display: flex; gap: 12px; align-items: center; }
.mini-card:hover, .level-card:hover { transform: translateY(-3px); border-color: var(--line-2); }
.mini-card:active, .level-card:active { transform: scale(.98); transition-duration: .08s; }
.mini-card > div { display: flex; flex-direction: column; min-width: 0; }
.mini-card .card-icon { width: 46px; height: 46px; border-radius: 14px; }
.mini-card b { font: 700 16px var(--head); }
.mini-card .muted { font-size: 12.5px; }
.level-card { display: block; }
.level-card .row b { font: 700 15px var(--head); color: var(--primary); }
.level-card .progress { margin: 10px 0 6px; height: 9px; }
.stat { display: flex; justify-content: space-between; gap: 10px; }
.stat-label { font: 700 11px var(--mono); text-transform: uppercase; letter-spacing: .09em; color: var(--text-2); }
.stat-value { font: 700 2.3rem/1.1 var(--head); margin-top: 8px; letter-spacing: -0.03em; }
.stat-value span { font-size: 1rem; color: var(--muted); font-weight: 600; margin-left: 4px; }
.stat-value span[data-count] { font-size: inherit; color: inherit; font-weight: inherit; margin: 0; }
.stat-sub { margin-top: 12px; display: flex; gap: 6px; flex-wrap: wrap; font-size: 12.5px; color: var(--text-2); }
.stat-card { display: block; color: var(--text); text-decoration: none !important; background: radial-gradient(260px 150px at 100% 0%, var(--tone-soft, transparent), transparent 72%), var(--card-bg); }
.stat-card .stat-label { color: var(--tone, var(--text-2)); }
.quest-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 9px; }
.quest-sub { margin: -6px 0 12px; }
.quest { position: relative; display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 14px; background: var(--row); border: 1px solid var(--line); transition: border-color .2s, transform .3s var(--spring), background .3s; }
.quest:hover { transform: translateX(3px); background: var(--row-hover); }
.quest .check { position: relative; width: 28px; height: 28px; border-radius: 50%; border: 2px solid var(--line-2); display: grid; place-items: center; flex: none; background: var(--s0); padding: 0; cursor: pointer; box-shadow: inset 0 -2px 0 rgba(0, 0, 0, .15); transition: background .2s, border-color .2s, transform .2s var(--spring); }
.quest .check:hover { border-color: var(--lime-fill); transform: scale(1.1); }
.quest .check:active { transform: scale(.88); }
.quest .check.auto { cursor: default; }
.quest .check.auto:hover { border-color: var(--line-2); transform: none; }
.quest .check svg { width: 15px; height: 15px; stroke-width: 3.2; opacity: 0; transform: scale(.4); transition: opacity .2s, transform .35s var(--spring); }
.quest.done { background: color-mix(in srgb, var(--lime-fill) 7%, var(--row)); }
.quest.done .check { background: var(--lime-fill); border-color: var(--lime-fill); color: var(--on-lime); animation: pop .45s var(--spring); }
.quest.done .check::after { content: ""; position: absolute; inset: -2px; border-radius: 50%; border: 2px solid var(--lime-fill); animation: ringout .6s var(--ease) forwards; }
.quest.done .check svg { opacity: 1; transform: none; }
.quest .q-body { flex: 1; min-width: 0; }
.quest .q-title { display: block; font-weight: 600; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.quest .q-title .i { color: var(--muted); }
.quest.done .q-title { color: var(--muted); text-decoration: line-through; text-decoration-color: color-mix(in srgb, var(--lime) 60%, transparent); }
.quest .q-meta { display: flex; gap: 6px; align-items: center; margin-top: 4px; flex-wrap: wrap; font-size: 12px; color: var(--muted); }
details.overdue { margin-top: 14px; }
details.overdue > summary { cursor: pointer; list-style: none; display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--amber); font-weight: 600; margin-bottom: 10px; }
details.overdue > summary::-webkit-details-marker { display: none; }
details.overdue > summary .i { width: 15px; height: 15px; }
.continue-card { background: radial-gradient(300px 200px at 100% 0%, var(--primary-soft), transparent 70%), var(--card-bg); }
.continue-link { position: relative; display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 13px 15px; margin: 6px 0 14px; border-radius: 14px; background: var(--primary-strong); color: #fff; font: 700 15px var(--head); text-decoration: none !important; box-shadow: inset 0 1px 0 rgba(255, 255, 255, .25), 0 4px 0 var(--primary-ledge); transition: transform .2s var(--spring), box-shadow .15s; --tone-fill: #fff; }
.continue-link:hover { transform: translateY(-2px); box-shadow: inset 0 1px 0 rgba(255, 255, 255, .25), 0 6px 0 var(--primary-ledge); }
.continue-link:active { transform: translateY(4px); box-shadow: inset 0 1px 0 rgba(255, 255, 255, .25), 0 0 0 var(--primary-ledge); transition-duration: .05s; }
.continue-link span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.continue-link .i { transition: transform .3s var(--spring); }
.continue-link:hover .i { transform: translateX(4px); }
.quick { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.quick .btn { justify-content: flex-start; }
.badges { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.badges.all { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
.achv { position: relative; text-align: center; padding: 16px 10px 14px; border-radius: 16px; background: var(--row); border: 1px solid var(--line); transition: transform .35s var(--spring); --tone-fill: var(--lime-fill); }
.achv:hover { transform: translateY(-3px) rotate(-1deg); }
.achv .medal { position: relative; width: 52px; height: 58px; margin: 0 auto 10px; display: grid; place-items: center; overflow: hidden; clip-path: polygon(50% 0, 100% 25%, 100% 75%, 50% 100%, 0 75%, 0 25%); background: var(--lime-fill); color: var(--on-lime); }
.achv .medal::after { content: ""; position: absolute; top: -20%; bottom: -20%; left: -80%; width: 40%; background: linear-gradient(100deg, transparent, rgba(255, 255, 255, .6), transparent); transform: skewX(-20deg); }
.achv:hover .medal::after { animation: shine .9s var(--ease); }
.achv .medal svg { width: 24px; height: 24px; stroke-width: 2.4; }
.achv b { display: block; font: 700 13.5px var(--head); }
.achv small { display: block; color: var(--muted); font-size: 11.5px; margin-top: 2px; line-height: 1.35; }
.achv .st { display: inline-block; margin-top: 8px; font: 700 9.5px var(--mono); letter-spacing: .08em; padding: 2px 8px; border-radius: 999px; background: var(--lime-soft); color: var(--lime); }
.achv.locked { --tone-fill: var(--muted); }
.achv.locked .medal { background: var(--s4); color: var(--muted); }
.achv.locked b { color: var(--text-2); }
.achv.locked .st { background: var(--s4); color: var(--muted); }
.journey { position: relative; display: grid; grid-template-columns: repeat(6, 1fr); gap: 8px; padding: 18px 0 4px; }
.journey::before { content: ""; position: absolute; left: 8%; right: 8%; top: 45px; height: 4px; background: repeating-linear-gradient(90deg, var(--s4) 0 10px, transparent 10px 16px); border-radius: 3px; }
.journey .fill { position: absolute; left: 8%; top: 45px; height: 4px; width: 0; background: linear-gradient(90deg, var(--lime-fill), var(--primary-strong)); border-radius: 3px; transition: width 1.4s var(--ease); }
.jnode { position: relative; text-align: center; text-decoration: none !important; color: var(--text); }
.jnode .node { width: 56px; height: 56px; margin: 0 auto 10px; border-radius: 18px; display: grid; place-items: center; background: var(--btn-bg); border: 1px solid var(--line-2); color: var(--muted); position: relative; z-index: 1; box-shadow: inset 0 1px 0 var(--btn-hi), 0 4px 0 var(--btn-ledge); transition: transform .3s var(--spring), box-shadow .15s; }
.jnode:hover .node { transform: translateY(-3px) rotate(-4deg); }
.jnode:active .node { transform: translateY(4px); box-shadow: inset 0 1px 0 var(--btn-hi), 0 0 0 var(--btn-ledge); transition-duration: .05s; }
.jnode.done .node { background: var(--lime-fill); border-color: transparent; color: var(--on-lime); box-shadow: inset 0 1px 0 rgba(255, 255, 255, .4), 0 4px 0 var(--lime-ledge); }
.jnode.current .node { background: var(--primary-strong); border-color: transparent; color: #fff; box-shadow: inset 0 1px 0 rgba(255, 255, 255, .3), 0 4px 0 var(--primary-ledge); animation: pulse 2.2s infinite; }
.jnode b { display: block; font: 700 13px var(--head); }
.jnode small { display: block; font-size: 11.5px; color: var(--muted); }
.jnode.current small { color: var(--primary); }
.jnode.done small { color: var(--lime); }
.heatmap { display: grid; grid-auto-flow: column; grid-template-rows: repeat(7, 13px); grid-auto-columns: 13px; justify-content: start; gap: 4px; overflow-x: auto; padding-bottom: 4px; }
.heatmap i { width: 13px; height: 13px; border-radius: 4px; background: var(--heat-0); transition: transform .2s var(--spring); }
.heatmap i:hover { transform: scale(1.5); }
.heatmap i.l1 { background: var(--heat-1); } .heatmap i.l2 { background: var(--heat-2); } .heatmap i.l3 { background: var(--heat-3); } .heatmap i.l4 { background: var(--heat-4); }
.heatmap i.future { visibility: hidden; }
.heat-legend { margin-top: 8px; gap: 6px; }
.heatmap.mini { display: inline-grid; grid-template-rows: 11px; grid-auto-columns: 11px; gap: 3px; padding: 0; }
.heatmap.mini i { width: 11px; height: 11px; border-radius: 3px; }

/* ------------------------------------------------ learn: topics, lists */
.search { position: relative; display: flex; align-items: center; }
.search .i { position: absolute; left: 12px; width: 16px; height: 16px; color: var(--muted); pointer-events: none; }
.search input { padding-left: 36px; width: 250px; max-width: 100%; }
.promo { position: relative; display: flex; align-items: center; gap: 14px; margin-bottom: 28px; color: var(--text); text-decoration: none !important; --tone: var(--lime); --tone-fill: var(--lime-fill); background: radial-gradient(400px 160px at 0% 50%, var(--lime-soft), transparent 70%), var(--card-bg); }
.promo > .i { color: var(--lime); transition: transform .3s var(--spring); }
.promo:hover > .i { transform: translateX(5px); }
.phase-block + .phase-block { margin-top: 36px; }
.phase-title { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.phase-title h2 { margin: 0; }
.phase-num { width: 36px; height: 36px; border-radius: 11px; display: grid; place-items: center; background: var(--btn-bg); color: var(--primary); font: 700 15px var(--mono); flex: none; border: 1px solid var(--line-2); box-shadow: inset 0 1px 0 var(--btn-hi), 0 3px 0 var(--btn-ledge); }
.topic-card { display: flex; flex-direction: column; gap: 10px; color: var(--text); text-decoration: none !important; overflow: hidden; min-height: 200px; }
.topic-card .wm { position: absolute; right: -4px; bottom: -26px; z-index: -1; font: 700 112px/1 var(--head); letter-spacing: -.07em; color: var(--tone, var(--primary)); opacity: .07; pointer-events: none; transition: transform .5s var(--spring), opacity .3s; }
.topic-card:hover .wm { transform: translate(-8px, -8px) rotate(-4deg); opacity: .13; }
.topic-card h3 { margin: 0; font-size: 1.06rem; }
.topic-card p { margin: 0; font-size: 13.5px; color: var(--text-2); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.topic-card .top { display: flex; align-items: center; justify-content: space-between; }
.topic-card .progress { margin-top: auto; }
.topic-num { display: inline-grid; place-items: center; min-width: 38px; height: 30px; padding: 0 8px; border-radius: 9px; font: 700 13px var(--mono); color: var(--tone, var(--primary)); background: var(--tone-soft, var(--primary-soft)); box-shadow: inset 0 -2px 0 color-mix(in srgb, var(--tone-fill, var(--primary-strong)) 35%, transparent); }
.topic-icon { width: 32px; height: 32px; border-radius: 10px; display: grid; place-items: center; color: var(--tone); background: var(--tone-soft); transition: transform .4s var(--spring); }
.topic-icon .i { width: 16px; height: 16px; }
.topic-card:hover .topic-icon { transform: rotate(-12deg) scale(1.12); }
.topic-meta { display: flex; gap: 6px; flex-wrap: wrap; }
.topic-card.mastered { border-color: color-mix(in srgb, var(--lime-fill) 45%, transparent); }
.topic-card.mastered .wm { color: var(--lime); opacity: .12; }
.list { display: flex; flex-direction: column; gap: 8px; }
.list-row { position: relative; overflow: hidden; display: flex; align-items: center; gap: 14px; padding: 13px 16px; border-radius: 14px; background: var(--row); border: 1px solid var(--line); color: var(--text); text-decoration: none !important; transition: transform .3s var(--spring), background .2s; cursor: pointer; }
.list-row:hover { transform: translateX(4px); background: var(--row-hover); }
.list-row:active { transform: translateX(2px) scale(.99); transition-duration: .06s; }
.list-row > .i:last-child { color: var(--muted); transition: transform .3s var(--spring); }
.list-row:hover > .i:last-child { transform: translateX(3px); color: var(--primary); }
.list-row .title { font-weight: 650; }
.list-row .sub { font-size: 12.5px; color: var(--muted); }
.status-icon { width: 26px; height: 26px; display: inline-grid; place-items: center; border-radius: 50%; flex: none; }
.status-icon svg { width: 14px; height: 14px; stroke-width: 3; }
.status-icon.solved { background: var(--lime-fill); color: var(--on-lime); }
.status-icon.attempted { background: var(--amber-soft); color: var(--amber); }
.status-icon.none { border: 2px solid var(--line-2); }
.topic-nav { margin-top: 32px; }

/* ------------------------------------------------ lessons + markdown */
.lesson-layout { display: grid; grid-template-columns: minmax(0, 1fr) 240px; gap: 36px; align-items: start; }
.toc { position: sticky; top: 84px; font-size: 13px; padding: 14px 16px; border-radius: var(--r); background: var(--card-bg); border: 1px solid var(--line); box-shadow: var(--card-shadow); max-height: calc(100vh - 110px); overflow: auto; }
.toc b { display: block; font: 700 11px var(--mono); text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin-bottom: 8px; }
.toc a { display: block; color: var(--text-2); padding: 5px 8px; margin: 0 -8px; border-radius: 8px; line-height: 1.35; transition: background .15s, color .15s; }
.toc a:hover { color: var(--primary); background: var(--primary-soft); text-decoration: none; }
.toc a.active { color: var(--primary); font-weight: 700; background: var(--primary-soft); }
.md { font-size: 15.5px; line-height: 1.75; overflow-wrap: break-word; }
.md > *:first-child { margin-top: 0; }
.md h1 { font-size: 1.6rem; margin: 1.6em 0 .6em; }
.md h2 { font-size: 1.35rem; margin: 1.9em 0 .6em; }
.md h2::before { content: "#"; color: var(--primary-strong); opacity: .6; margin-right: 8px; font-family: var(--mono); }
.md h3 { font-size: 1.08rem; margin: 1.5em 0 .5em; }
.md p { margin: .75em 0; }
.md ul, .md ol { padding-left: 1.4em; margin: .6em 0; }
.md li { margin: .3em 0; }
.md li::marker { color: var(--primary); }
.md li > p { margin: .2em 0; }
.md hr { border: 0; border-top: 1px dashed var(--line-2); margin: 2em 0; }
.md strong { font-weight: 700; color: var(--text); }
.md code { font-size: .85em; padding: .12em .42em; border-radius: 6px; background: var(--s3); color: var(--primary); border: 1px solid var(--line); }
.md pre { position: relative; margin: 1em 0; background: var(--code-bg); border: 1px solid var(--line); border-radius: 14px; padding: 15px 18px; overflow-x: auto; font-size: 13.5px; line-height: 1.6; color: var(--code-text); box-shadow: inset 0 2px 8px rgba(0, 0, 0, .12); }
.md pre code { background: none; padding: 0; font-size: inherit; color: inherit; border: 0; }
.md pre .copy { position: absolute; top: 8px; right: 8px; opacity: 0; transition: opacity .15s; }
.md pre:hover .copy { opacity: 1; }
.md table { border-collapse: separate; border-spacing: 0; width: 100%; margin: 1em 0; font-size: 14px; display: block; overflow-x: auto; border: 1px solid var(--line); border-radius: 12px; }
.md th, .md td { border-bottom: 1px solid var(--line); padding: 9px 12px; text-align: left; vertical-align: top; }
.md tr:last-child td { border-bottom: 0; }
.md th { background: var(--s3); font-weight: 700; font-family: var(--head); }
.tk-k { color: var(--tk-k); font-weight: 600; } .tk-s { color: var(--tk-s); } .tk-c { color: var(--tk-c); font-style: italic; } .tk-n { color: var(--tk-n); } .tk-t { color: var(--tk-t); } .tk-f { color: var(--tk-f); } .tk-a { color: var(--tk-a); }
.lesson-foot { margin-top: 40px; padding-top: 20px; border-top: 1px dashed var(--line-2); display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.read-progress { position: fixed; top: 0; left: 0; height: 3px; background: linear-gradient(90deg, var(--primary-strong), var(--lime-fill)); z-index: 60; width: 0; transition: width .1s linear; box-shadow: 0 0 10px var(--primary-strong); }
.chapter-title { font-size: 2.1rem; margin: 4px 0 22px; }
.md h1, .md h2, .md h3, .phase-block, .week, .chapter-title { scroll-margin-top: 84px; }

/* ------------------------------------------------ quiz */
.quiz-wrap { max-width: 780px; }
.quiz-modes { margin-bottom: 18px; }
.quiz-top { display: flex; align-items: center; gap: 14px; margin-bottom: 18px; }
.quiz-top .progress { flex: 1; }
.quiz-q, .quiz-q .md { font-size: 16.5px; }
.options { display: flex; flex-direction: column; gap: 11px; margin-top: 18px; }
.option { position: relative; overflow: hidden; display: flex; gap: 12px; align-items: flex-start; text-align: left; width: 100%; padding: 14px 16px; border-radius: 14px; border: 1.5px solid var(--line-2); background: var(--row); cursor: pointer; font-size: 15px; line-height: 1.5; color: var(--text); box-shadow: 0 3px 0 var(--btn-ledge); transition: border-color .15s, background .15s, transform .2s var(--spring), box-shadow .1s; animation: rise .4s var(--ease) both; }
.option:nth-child(2) { animation-delay: .04s; } .option:nth-child(3) { animation-delay: .08s; } .option:nth-child(4) { animation-delay: .12s; }
.option:hover:not(:disabled) { border-color: var(--primary-strong); transform: translateY(-2px); box-shadow: 0 5px 0 var(--btn-ledge); }
.option:active:not(:disabled) { transform: translateY(3px); box-shadow: 0 0 0 var(--btn-ledge); transition-duration: .05s; }
.option .key { flex: none; width: 28px; height: 28px; border-radius: 9px; display: grid; place-items: center; background: var(--btn-bg); border: 1px solid var(--line-2); box-shadow: 0 2px 0 var(--btn-ledge); font: 700 12px var(--mono); color: var(--text-2); }
.option.picked { border-color: var(--primary-strong); background: var(--primary-soft); }
.option.correct { border-color: var(--lime-fill); background: var(--lime-soft); animation: pop .4s var(--spring); box-shadow: 0 3px 0 var(--lime-ledge); --tone-fill: var(--lime-fill); }
.option.correct .key { background: var(--lime-fill); color: var(--on-lime); border-color: transparent; box-shadow: 0 2px 0 var(--lime-ledge); }
.option.wrong { border-color: var(--bad); background: var(--bad-soft); animation: shake .45s; box-shadow: 0 3px 0 color-mix(in srgb, var(--bad) 50%, #000); }
.option.wrong .key { background: var(--bad); color: #fff; border-color: transparent; }
.option:disabled { cursor: default; }
.option code { font-size: .88em; padding: .1em .35em; border-radius: 5px; background: var(--s4); }
.explain { margin-top: 16px; animation: rise .35s var(--ease) both; }
.score-ring { width: 156px; height: 156px; border-radius: 50%; display: grid; place-items: center; margin: 6px auto 16px; background: conic-gradient(var(--lime-fill) calc(var(--p) * 1%), var(--s4) 0); animation: spinin .8s var(--spring); box-shadow: 0 10px 30px -10px rgba(182, 243, 63, .4); }
.score-ring > div { width: 122px; height: 122px; border-radius: 50%; background: var(--s2); display: grid; place-items: center; font: 700 32px var(--head); }
.review-list { list-style: none; padding: 0; margin: 0; }
.review-list li { padding: 14px 0; border-bottom: 1px dashed var(--line-2); }
.kbd-hint { white-space: nowrap; }

/* ------------------------------------------------ solve (problem page) */
.solve-page { display: flex; flex-direction: column; height: calc(100vh - 62px); }
.test-bar { display: flex; align-items: center; gap: 12px; padding: 8px 16px; background: var(--s1); border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.test-bar .timer { font: 700 15px var(--mono); padding: 5px 12px; border-radius: 10px; background: var(--s3); border: 1px solid var(--line); }
.test-bar .timer.low { color: var(--bad); background: var(--bad-soft); animation: blink 1s infinite; }
.solve-head { display: flex; align-items: center; gap: 10px; padding: 8px 16px; background: var(--s1); border-bottom: 1px solid var(--line); flex-wrap: wrap; min-height: 50px; }
.solve-head .crumb { font-size: 13px; color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.solve-head .crumb b { color: var(--text); font-weight: 700; }
.solve-head .icon-btn { width: 32px; height: 32px; }
.solve { flex: 1; min-height: 0; display: grid; grid-template-columns: minmax(300px, 42%) 6px minmax(360px, 1fr); }
.pane { min-width: 0; min-height: 0; display: flex; flex-direction: column; background: var(--s1); }
.pane-tabs { display: flex; align-items: center; gap: 2px; padding: 0 10px; height: 46px; border-bottom: 1px solid var(--line); background: var(--s2); flex: none; overflow-x: auto; scrollbar-width: none; }
.pane-tabs button { position: relative; overflow: hidden; height: 100%; padding: 0 12px; border: 0; background: none; color: var(--text-2); font: 600 13px var(--head); border-bottom: 2px solid transparent; cursor: pointer; white-space: nowrap; display: inline-flex; align-items: center; gap: 6px; transition: color .15s, border-color .2s; }
.pane-tabs button:hover { color: var(--text); }
.pane-tabs button.active { color: var(--primary); border-bottom-color: var(--primary-strong); }
.pane-tabs button:disabled { opacity: .4; cursor: not-allowed; }
.pane-tabs .count { font: 700 11px var(--mono); color: var(--muted); }
.pane-tabs .i, .solve-mobile-tabs .i { width: 15px; height: 15px; }
.pane-body { flex: 1; overflow: auto; padding: 22px 24px 36px; }
.gutter { background: var(--line); cursor: col-resize; transition: background .15s; }
.gutter:hover, .gutter.drag { background: var(--primary-strong); }
.prob-title { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
.prob-title h1 { font-size: 1.5rem; margin: 0; }
.sig-card { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-radius: 12px; background: var(--code-bg); border: 1px solid var(--line); font: 13px var(--mono); margin: 16px 0 6px; overflow-x: auto; }
.sig-card code { white-space: nowrap; }
.hint-card { border: 1px solid var(--line); border-radius: 14px; margin-bottom: 10px; overflow: hidden; background: var(--row); animation: rise .35s var(--ease) both; }
.hint-card summary { cursor: pointer; padding: 11px 15px; font: 700 14px var(--head); list-style: none; color: var(--amber); }
.hint-card summary::-webkit-details-marker { display: none; }
.hint-card summary .i { width: 15px; height: 15px; vertical-align: -2px; }
.hint-card .md { padding: 0 15px 12px; }
.spoiler { text-align: center; padding: 40px 20px; border: 1px dashed var(--line-2); border-radius: 16px; }
.spoiler h2 { justify-content: center; }
.editor-bar { display: flex; align-items: center; gap: 8px; padding: 6px 10px; height: 46px; border-bottom: 1px solid var(--line); background: var(--s2); flex: none; }
.editor-bar .lang { display: inline-flex; align-items: center; gap: 6px; font: 600 12.5px var(--mono); padding: 5px 10px; border-radius: 8px; background: var(--s3); color: var(--text); }
.editor-bar .lang::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--coral-fill); }
.editor-bar .icon-btn { width: 32px; height: 32px; }
.judge-chip { display: inline-flex; align-items: center; gap: 6px; font: 600 11.5px var(--mono); color: var(--text-2); white-space: nowrap; }
.stopwatch { font: 600 12.5px var(--mono); color: var(--text-2); padding: 5px 10px; border-radius: 8px; cursor: pointer; border: 1px solid var(--line); background: var(--s3); }
.editor-area { flex: 1; min-height: 140px; position: relative; overflow: hidden; background: var(--code-bg); }
.editor-area .CodeMirror { position: absolute; inset: 0; height: 100%; font-family: var(--mono); font-size: var(--editor-font, 14px); line-height: 1.6; }
.editor-area textarea.fallback { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; border-radius: 0; resize: none; padding: 12px 14px; font: var(--editor-font, 14px)/1.6 var(--mono); background: var(--code-bg); color: var(--code-text); tab-size: 4; white-space: pre; box-shadow: none; }
.console { flex: none; height: 40%; min-height: 48px; border-top: 1px solid var(--line); display: flex; flex-direction: column; background: var(--s1); transition: height .35s var(--ease); }
.console.collapsed { height: 48px; }
.console-head { display: flex; align-items: center; gap: 10px; padding: 6px 12px 6px 16px; border-bottom: 1px solid var(--line); flex: none; min-height: 47px; background: var(--s2); }
.console-head .verdict { font: 700 15px var(--head); display: inline-flex; align-items: center; gap: 8px; }
.verdict .i { width: 18px; height: 18px; }
.verdict.ok { color: var(--lime); } .verdict.bad { color: var(--bad); } .verdict.warn { color: var(--amber); }
.console-body { flex: 1; overflow: auto; padding: 14px 16px; }
.console-body .i { vertical-align: -3px; width: 15px; height: 15px; }
.console.collapsed .console-body { display: none; }
.result-banner { display: flex; align-items: center; gap: 14px; padding: 14px 16px; border-radius: 14px; background: var(--row); border: 1px solid var(--line); margin-bottom: 14px; animation: pop .45s var(--spring); }
.result-banner .big { font: 700 20px var(--head); }
.result-banner .ico { width: 44px; height: 44px; border-radius: 14px; display: grid; place-items: center; flex: none; background: var(--s4); }
.result-banner .ico .i { width: 22px; height: 22px; stroke-width: 3; }
.result-banner.ok { border-color: color-mix(in srgb, var(--lime-fill) 40%, transparent); background: color-mix(in srgb, var(--lime-fill) 7%, var(--row)); }
.result-banner.ok .big { color: var(--lime); }
.result-banner.ok .ico { background: var(--lime-fill); color: var(--on-lime); box-shadow: 0 3px 0 var(--lime-ledge); }
.result-banner.bad { border-color: color-mix(in srgb, var(--bad) 35%, transparent); }
.result-banner.bad .big { color: var(--bad); }
.result-banner.bad .ico { background: var(--bad-soft); color: var(--bad); }
.case-tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 12px; }
.case-tabs button { position: relative; overflow: hidden; border: 1px solid var(--line); background: var(--row); border-radius: 9px; padding: 5px 11px; font: 600 12px var(--mono); cursor: pointer; display: inline-flex; align-items: center; gap: 6px; color: var(--text-2); }
.case-tabs button.active { border-color: var(--primary-strong); background: var(--primary-soft); color: var(--text); }
.case-tabs .pip { width: 7px; height: 7px; border-radius: 50%; background: var(--muted); }
.case-tabs .pip.AC { background: var(--lime-fill); } .case-tabs .pip.WA, .case-tabs .pip.RE, .case-tabs .pip.TLE { background: var(--bad); }
.io-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 10px; }
.io-label { font: 700 10.5px var(--mono); text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin: 8px 0 5px; }
.io { font: 13px/1.5 var(--mono); background: var(--code-bg); border: 1px solid var(--line); border-radius: 10px; padding: 9px 11px; white-space: pre-wrap; word-break: break-all; max-height: 220px; overflow: auto; color: var(--code-text); }
.io.bad { border-color: var(--bad); }
.io.ok { border-color: var(--lime-fill); }
.compile-err { font: 13px/1.5 var(--mono); white-space: pre-wrap; color: var(--bad); background: var(--bad-soft); border-radius: 12px; padding: 11px 13px; }
.engine-note { display: flex; gap: 12px; align-items: flex-start; padding: 14px; border-radius: 14px; background: var(--primary-soft); border: 1px solid var(--line); animation: rise .4s var(--ease) both; }
.engine-note > .i { width: 26px; height: 26px; color: var(--primary); flex: none; animation: spin 3s linear infinite; }
.engine-note > div > * + * { margin-top: 4px; }
.spinner { width: 16px; height: 16px; border: 2px solid var(--s5); border-top-color: var(--primary-strong); border-radius: 50%; animation: spin .7s linear infinite; display: inline-block; }
.solve-mobile-tabs { display: none; }
.cm-s-dsa.CodeMirror { background: var(--code-bg); color: var(--code-text); }
.cm-s-dsa .CodeMirror-gutters { background: var(--code-bg); border-right: 1px solid var(--code-line); }
.cm-s-dsa .CodeMirror-linenumber { color: var(--muted); opacity: .7; }
.cm-s-dsa .CodeMirror-cursor { border-left: 2px solid var(--primary-strong); }
.cm-s-dsa .CodeMirror-activeline-background { background: var(--code-line); }
.cm-s-dsa .CodeMirror-selected, .cm-s-dsa .CodeMirror-focused .CodeMirror-selected { background: color-mix(in srgb, var(--primary-strong) 22%, transparent); }
.cm-s-dsa .CodeMirror-matchingbracket { color: var(--lime) !important; text-decoration: underline; }
.cm-s-dsa .cm-keyword { color: var(--tk-k); font-weight: 600; } .cm-s-dsa .cm-string, .cm-s-dsa .cm-string-2 { color: var(--tk-s); }
.cm-s-dsa .cm-comment { color: var(--tk-c); font-style: italic; } .cm-s-dsa .cm-number { color: var(--tk-n); }
.cm-s-dsa .cm-type, .cm-s-dsa .cm-variable-3 { color: var(--tk-t); } .cm-s-dsa .cm-def { color: var(--tk-f); }
.cm-s-dsa .cm-meta { color: var(--tk-a); } .cm-s-dsa .cm-atom { color: var(--tk-n); } .cm-s-dsa .cm-builtin { color: var(--tk-t); }
.cm-s-dsa .cm-operator { color: var(--text-2); }
.cm-err-line { background: var(--bad-soft) !important; }

/* ------------------------------------------------ plan */
.plan-total { margin: 20px 0 8px; }
.weeks { margin-top: 20px; }
.week { border: 1px solid var(--line); border-radius: var(--r); background: var(--card-bg); box-shadow: var(--card-shadow); overflow: hidden; }
.week + .week { margin-top: 12px; }
.week > summary { display: flex; align-items: center; gap: 14px; padding: 15px 18px; cursor: pointer; list-style: none; transition: background .2s; }
.week > summary:hover { background: var(--row); }
.week > summary::-webkit-details-marker { display: none; }
.week > summary .wk { font: 700 15px var(--head); min-width: 78px; }
.week > summary .wk-topics { flex: 1; color: var(--text-2); font-size: 14px; }
.week > summary .chev { width: 16px; height: 16px; color: var(--muted); transition: transform .3s var(--spring); }
.week[open] > summary .chev { transform: rotate(90deg); }
.wk-bar { width: 80px; flex: none; }
.week.current { border-color: var(--primary-strong); box-shadow: 0 0 0 4px var(--primary-soft), var(--card-shadow); }
.week-days { border-top: 1px solid var(--line); padding: 8px; display: flex; flex-direction: column; gap: 8px; animation: rise .35s var(--ease) both; }
.day { display: grid; grid-template-columns: 140px 1fr; gap: 16px; padding: 12px; border-radius: 14px; }
.day.today { background: var(--primary-soft); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--primary-strong) 30%, transparent); }
.day-date { font-size: 13px; color: var(--muted); }
.day-date b { display: block; color: var(--text); font: 700 14px var(--head); }
.day-kind { display: inline-block; margin-top: 6px; }
.day-title { font: 700 14.5px var(--head); margin-bottom: 8px; }

/* ------------------------------------------------ theory books + PDFs */
.book-card { display: flex; flex-direction: column; gap: 10px; }
.book-java { --tone: var(--coral); --tone-fill: var(--coral-fill); --tone-soft: var(--coral-soft); }
.book-postgresql { --tone: var(--sky); --tone-fill: var(--sky-fill); --tone-soft: var(--sky-soft); }
.book-spring-boot { --tone: var(--lime); --tone-fill: var(--lime-fill); --tone-soft: var(--lime-soft); }
.book-cover { position: relative; overflow: hidden; display: flex; align-items: flex-start; justify-content: space-between; height: 136px; padding: 14px 14px 14px 24px; border-radius: 14px; border: 1px solid var(--line);
  background: repeating-linear-gradient(135deg, transparent 0 11px, color-mix(in srgb, var(--tone-fill) 9%, transparent) 11px 12px), radial-gradient(140% 120% at 0% 0%, var(--tone-soft), transparent 70%), var(--s3); }
.book-cover::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 9px; background: var(--tone-fill); box-shadow: inset -2px 0 0 rgba(0, 0, 0, .18); }
.book-word { position: absolute; right: 14px; bottom: 2px; font: 800 48px/1 var(--mono); letter-spacing: -.06em; color: var(--tone); opacity: .9; transition: transform .5s var(--spring); }
.book-card:hover .book-word { transform: translateX(-8px) rotate(-4deg) scale(1.05); }
.book-icon { width: 54px; height: 54px; border-radius: 16px; display: grid; place-items: center; background: var(--tone-fill); color: #fff; flex: none; box-shadow: inset 0 -4px 0 rgba(0, 0, 0, .18); transition: transform .4s var(--spring); }
.book-spring-boot .book-icon { color: var(--on-lime); }
.book-card:hover .book-icon { transform: rotate(-8deg) translateY(-2px); }
.book-icon .i { width: 26px; height: 26px; }
.book-icon.lg { width: 66px; height: 66px; border-radius: 20px; }
.book-cover .badge { background: color-mix(in srgb, var(--s1) 80%, transparent); }
.book-card h3 { margin: 4px 0 0; font-size: 1.15rem; }
.book-card p { margin: 0; }
.book-actions { margin-top: auto; padding-top: 6px; flex-wrap: nowrap; }
.pdf-card { display: flex; flex-direction: column; gap: 8px; }
.pdf-card h3 { margin: 6px 0 0; }
.pdf-card p { margin: 0 0 6px; flex: 1; }

/* ------------------------------------------------ profile, mock, settings */
.profile-hero { display: flex; align-items: center; gap: 22px; background: radial-gradient(420px 220px at 0% 0%, var(--primary-soft), transparent 70%), var(--card-bg); }
.profile-hero h1 { margin: 0 0 4px; font-size: 1.8rem; }
.profile-hero .progress { margin: 12px 0 6px; max-width: 420px; height: 9px; }
.mini-stats .card { padding: 16px; }
.mini-stats .stat-value { font-size: 1.8rem; margin-top: 4px; }
.settings-row { align-items: flex-end; gap: 14px; }
.rubric-row { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 12px 0; border-bottom: 1px dashed var(--line-2); flex-wrap: wrap; }
.check-row { display: flex; align-items: center; gap: 10px; font-size: 14px; cursor: pointer; }
.check-row input { width: 18px; height: 18px; accent-color: var(--primary-strong); }
.checklist { margin: 0; padding-left: 20px; font-size: 14px; }
.checklist li { margin: 7px 0; }
.checklist li::marker { color: var(--primary); font-weight: 700; }

/* ------------------------------------------------ auth screen */
.auth-wrap { position: fixed; inset: 0; z-index: 90; background: var(--bg); overflow: auto; display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); }
.auth-wrap::before { content: ""; position: fixed; inset: 0; pointer-events: none; background-image: radial-gradient(var(--dots) 1px, transparent 1.4px); background-size: 22px 22px; -webkit-mask-image: radial-gradient(ellipse 70% 70% at 25% 30%, #000, transparent 75%); mask-image: radial-gradient(ellipse 70% 70% at 25% 30%, #000, transparent 75%); }
.auth-hero { position: relative; padding: 56px 48px; display: flex; flex-direction: column; justify-content: center; gap: 24px; background: radial-gradient(700px 500px at 15% 15%, var(--glow-a), transparent 60%); }
.auth-hero h1 { font-size: clamp(2.3rem, 4.6vw, 3.8rem); line-height: 1.04; margin: 0; letter-spacing: -.035em; }
.auth-hero h1 .hl { background: var(--lime-fill); color: var(--on-lime); padding: 0 .14em; border-radius: .14em; -webkit-box-decoration-break: clone; box-decoration-break: clone; box-shadow: 0 .08em 0 var(--lime-ledge); }
.auth-hero h1 .a { color: var(--primary); text-decoration: underline wavy color-mix(in srgb, var(--primary-strong) 70%, transparent); text-underline-offset: .15em; text-decoration-thickness: .06em; }
.auth-hero p { color: var(--text-2); font-size: 1.1rem; max-width: 540px; margin: 0; }
.float-chips { display: flex; gap: 10px; flex-wrap: wrap; }
.float-chips .mini-card { animation: float 5s ease-in-out infinite; padding: 10px 14px; }
.float-chips .mini-card:nth-child(2) { animation-delay: -1.6s; } .float-chips .mini-card:nth-child(3) { animation-delay: -3.2s; }
.code-card { max-width: 560px; border-radius: 16px; border: 1px solid var(--line); background: var(--code-bg); overflow: hidden; box-shadow: var(--card-shadow), 0 0 0 6px color-mix(in srgb, var(--s3) 60%, transparent); transform: rotate(-1deg); }
.code-card .bar { display: flex; align-items: center; gap: 7px; padding: 10px 14px; background: var(--s2); border-bottom: 1px solid var(--line); font: 600 12.5px var(--mono); color: var(--text-2); }
.code-card .bar i { width: 11px; height: 11px; border-radius: 50%; display: inline-block; }
.code-card pre { margin: 0; padding: 14px 16px; font: 13px/1.6 var(--mono); color: var(--code-text); overflow-x: auto; }
.auth-panel { position: relative; display: grid; place-items: center; padding: 40px 28px; }
.auth-card { width: min(440px, 100%); padding: 30px; border-radius: 24px; background: var(--card-bg); border: 1px solid var(--line-2); box-shadow: var(--shadow-lg); animation: rise .6s var(--ease) both; }
.auth-card .wordmark { font-size: 21px; }
.auth-card h2 { font-size: 1.55rem; margin: 20px 0 4px; }
.auth-card form { display: flex; flex-direction: column; gap: 14px; margin-top: 20px; }
.auth-card .err { color: var(--bad); font-size: 13.5px; display: flex; gap: 6px; align-items: center; min-height: 20px; }
.auth-card .err svg { width: 16px; height: 16px; flex: none; }
.auth-tabs { display: flex; width: 100%; margin-top: 22px; }
.auth-tabs button { flex: 1; padding: 9px 12px; }
.pw-wrap { position: relative; display: block; }
.pw-wrap input { width: 100%; padding-right: 46px; }
.pw-wrap .icon-btn { position: absolute; right: 5px; top: 50%; width: 34px; height: 32px; transform: translateY(-50%); box-shadow: none; border-color: transparent; background: transparent; }
.pw-wrap .icon-btn:active { transform: translateY(-50%) scale(.92); }
.auth-wrap.leaving { animation: fadeout .38s var(--ease) forwards; }
body.auth-open { overflow: hidden; }

/* ------------------------------------------------ modal, toast, effects */
.modal-back { position: fixed; inset: 0; background: rgba(5, 7, 15, .6); backdrop-filter: blur(6px); display: grid; place-items: center; z-index: 100; padding: 16px; animation: fade .2s; }
.modal { background: var(--card-bg); background-color: var(--s2); border: 1px solid var(--line-2); border-radius: 24px; box-shadow: var(--shadow-lg); width: min(540px, 100%); padding: 26px; max-height: 90vh; overflow: auto; animation: modalin .45s var(--spring); }
.modal h2 { margin-top: 0; font-size: 1.5rem; }
.modal .actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 22px; flex-wrap: wrap; }
.grade-btns { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-top: 14px; }
.grade-btns button { display: flex; flex-direction: column; align-items: center; gap: 2px; height: auto; padding: 12px 6px; white-space: normal; text-align: center; line-height: 1.3; }
.grade-btns small { font: 500 11px var(--font); color: var(--muted); }
.grade-btns .btn.primary small { color: inherit; opacity: .85; }
.levelup { text-align: center; }
.levelup .big-level { width: 124px; height: 124px; margin: 0 auto 14px; border-radius: 36px; display: grid; place-items: center; font: 700 48px var(--head); color: var(--on-lime); background: var(--lime-fill); box-shadow: inset 0 -8px 0 var(--lime-ledge), 0 16px 40px -10px rgba(182, 243, 63, .6); animation: spinin .9s var(--spring); }
#toast { position: fixed; bottom: 24px; right: 24px; z-index: 120; display: flex; flex-direction: column; gap: 10px; align-items: flex-end; pointer-events: none; }
.toast { display: flex; align-items: center; gap: 10px; background: var(--s2); color: var(--text); border: 1px solid var(--line-2); padding: 10px 16px 10px 10px; border-radius: 16px; font-weight: 600; font-size: 14px; box-shadow: var(--shadow-lg); animation: toastin .5s var(--spring) both; }
.toast.xp { border-color: color-mix(in srgb, var(--lime-fill) 50%, transparent); }
.toast.xp b { color: var(--lime); font-family: var(--mono); }
.toast .t-ico { width: 32px; height: 32px; border-radius: 10px; display: grid; place-items: center; background: var(--primary-soft); color: var(--primary); flex: none; }
.toast.xp .t-ico { background: var(--lime-fill); color: var(--on-lime); }
.toast .t-ico .i { width: 16px; height: 16px; }
.toast.out { animation: toastout .35s var(--ease) forwards; }
#confetti { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 110; }
.float-xp { position: fixed; z-index: 130; pointer-events: none; font: 800 16px var(--mono); color: var(--on-lime); background: var(--lime-fill); padding: 3px 9px; border-radius: 999px; box-shadow: 0 3px 0 var(--lime-ledge), 0 10px 20px -6px rgba(0, 0, 0, .4); transform: translate(-50%, -50%); animation: floatup 1.15s var(--ease) forwards; white-space: nowrap; }
.footnote { margin-top: 28px; font-size: 12px; color: var(--muted); text-align: center; }
.bottom-nav { display: none; }

/* ------------------------------------------------ keyframes */
@keyframes rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes fadeout { to { opacity: 0; transform: scale(1.02); } }
@keyframes pop { 0% { transform: scale(.85); } 55% { transform: scale(1.08); } 100% { transform: scale(1); } }
@keyframes modalin { from { opacity: 0; transform: translateY(18px) scale(.94); } to { opacity: 1; transform: none; } }
@keyframes shake { 10%, 90% { transform: translateX(-1px); } 20%, 80% { transform: translateX(3px); } 30%, 50%, 70% { transform: translateX(-6px); } 40%, 60% { transform: translateX(6px); } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes spinin { from { transform: rotate(-160deg) scale(.4); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes pulse { 0% { box-shadow: inset 0 1px 0 rgba(255, 255, 255, .3), 0 4px 0 var(--primary-ledge), 0 0 0 0 rgba(124, 92, 255, .5); } 70% { box-shadow: inset 0 1px 0 rgba(255, 255, 255, .3), 0 4px 0 var(--primary-ledge), 0 0 0 16px rgba(124, 92, 255, 0); } 100% { box-shadow: inset 0 1px 0 rgba(255, 255, 255, .3), 0 4px 0 var(--primary-ledge), 0 0 0 0 rgba(124, 92, 255, 0); } }
@keyframes flicker { 0%, 100% { transform: scale(1) rotate(0); } 25% { transform: scale(1.12) rotate(-5deg); } 50% { transform: scale(.94) rotate(3deg); } 75% { transform: scale(1.06) rotate(-2deg); } }
@keyframes blink { 50% { opacity: .45; } }
@keyframes float { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-7px); } }
@keyframes toastin { from { opacity: 0; transform: translateY(16px) scale(.9); } to { opacity: 1; transform: none; } }
@keyframes toastout { to { opacity: 0; transform: translateX(30px); } }
@keyframes ripple { to { transform: scale(1); opacity: 0; } }
@keyframes ringout { from { transform: scale(1); opacity: .9; } to { transform: scale(1.9); opacity: 0; } }
@keyframes wiggle { 0% { transform: scale(1); } 35% { transform: scale(1.25) rotate(-10deg); } 70% { transform: scale(.95) rotate(4deg); } 100% { transform: scale(1); } }
@keyframes bump { 0% { transform: scale(1); } 30% { transform: scale(1.12); box-shadow: 0 0 0 5px var(--lime-soft); } 100% { transform: scale(1); } }
@keyframes shine { from { left: -80%; } to { left: 140%; } }
@keyframes floatup { 0% { opacity: 0; transform: translate(-50%, -20%) scale(.6); } 18% { opacity: 1; transform: translate(-50%, -70%) scale(1.12); } 70% { opacity: 1; } 100% { opacity: 0; transform: translate(-50%, -280%) scale(1); } }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}

/* ------------------------------------------------ focus mode (problem/test pages) */
body.focus { --sidebar: 74px; }
body.focus .sidebar { padding: 14px 10px 10px; }
body.focus .brand { padding: 0 0 16px; justify-content: center; }
body.focus .brand-text, body.focus .nav .lbl, body.focus .nav .badge, body.focus .user-chip .uc-text, body.focus .judge span:last-child { display: none; }
body.focus .nav a { justify-content: center; padding: 11px 0; }
body.focus .nav-ind::before { left: -11px; }
body.focus .user-chip { justify-content: center; padding: 6px; }
body.focus .judge { justify-content: center; }
body.focus .hud { padding: 8px 16px; min-height: 54px; }
body.focus .solve-page { height: calc(100vh - 54px); }
@supports (height: 100dvh) {
  .solve-page { height: calc(100dvh - 62px); }
  body.focus .solve-page { height: calc(100dvh - 54px); }
}

/* ------------------------------------------------ responsive */
@media (max-width: 1180px) {
  .cols-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .lesson-layout { grid-template-columns: 1fr; }
  .toc { display: none; }
  .hero { grid-template-columns: 1fr; }
  .pill.xp .bar { width: 64px; }
  .cols-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 920px) {
  .hide-sm, .kbd-hint { display: none !important; }
  .app { grid-template-columns: 1fr; }
  .sidebar { position: fixed; left: 0; top: 0; bottom: 0; width: 280px; transform: translateX(-105%); transition: transform .4s var(--spring); box-shadow: var(--shadow-lg); }
  .sidebar.open { transform: none; }
  body.focus .sidebar { width: 280px; padding: 18px 12px 12px; }
  body.focus .brand { padding: 2px 6px 22px; justify-content: flex-start; }
  body.focus .brand-text, body.focus .nav .lbl, body.focus .user-chip .uc-text, body.focus .judge span:last-child { display: flex; }
  body.focus .nav .lbl, body.focus .judge span:last-child { display: inline; }
  body.focus .nav a { justify-content: flex-start; padding: 10px 12px; }
  .hud { padding: 8px 14px; gap: 8px; min-height: 58px; }
  .hud .menu-btn { display: grid; }
  .hud .mobile-brand { display: flex; align-items: center; gap: 8px; text-decoration: none !important; }
  .hud .mobile-brand .wordmark { font-size: 17px; }
  .page { padding: 20px 16px 112px; }
  h1 { font-size: 1.65rem; }
  .hero h1 { font-size: 2rem; }
  .cols-2, .cols-3, .cols-main { grid-template-columns: 1fr; }
  .journey { grid-template-columns: repeat(3, 1fr); row-gap: 22px; }
  .journey::before, .journey .fill { display: none; }
  .day { grid-template-columns: 1fr; gap: 6px; }
  .solve-page, body.focus .solve-page { height: calc(100vh - 58px - 64px); }
  @supports (height: 100dvh) {
    .solve-page, body.focus .solve-page { height: calc(100dvh - 58px - 64px - env(safe-area-inset-bottom)); }
  }
  .solve { grid-template-columns: 1fr; }
  .gutter { display: none; }
  .solve-mobile-tabs { display: flex; gap: 4px; padding: 6px 10px; background: var(--s2); border-bottom: 1px solid var(--line); }
  .solve-mobile-tabs button { position: relative; overflow: hidden; flex: 1; height: 38px; border: 0; border-radius: 10px; background: none; color: var(--text-2); font: 700 13px var(--head); display: inline-flex; align-items: center; justify-content: center; gap: 6px; }
  .solve-mobile-tabs button.active { background: var(--btn-bg); color: var(--primary); box-shadow: inset 0 1px 0 var(--btn-hi), 0 2px 0 var(--btn-ledge), 0 0 0 1px var(--line); }
  .solve[data-mtab="desc"] .pane.right, .solve[data-mtab="code"] .pane.left, .solve[data-mtab="result"] .pane.left { display: none; }
  .solve[data-mtab="code"] .console { display: none; }
  .solve[data-mtab="result"] .editor-area, .solve[data-mtab="result"] .editor-bar { display: none; }
  .solve[data-mtab="result"] .console { height: 100% !important; }
  .solve[data-mtab="result"] .console.collapsed .console-body { display: block; }
  .bottom-nav { display: grid; grid-template-columns: repeat(5, 1fr); position: fixed; left: 0; right: 0; bottom: 0; z-index: 50; height: calc(64px + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom); background: color-mix(in srgb, var(--s1) 94%, transparent); backdrop-filter: blur(16px) saturate(1.3); border-top: 1px solid var(--line); }
  .bn-ind { position: absolute; top: 8px; left: 0; width: 60px; height: 32px; border-radius: 999px; background: var(--primary-soft); border: 1px solid color-mix(in srgb, var(--primary-strong) 25%, transparent); opacity: 0; pointer-events: none; transition: transform .5s var(--spring), opacity .2s; }
  .bottom-nav a { position: relative; overflow: hidden; display: flex; flex-direction: column; align-items: center; justify-content: flex-start; padding-top: 13px; gap: 5px; color: var(--muted); font: 700 10.5px var(--mono); letter-spacing: .05em; text-transform: uppercase; text-decoration: none !important; }
  .bottom-nav a .i { width: 21px; height: 21px; position: relative; z-index: 1; transition: transform .35s var(--spring); }
  .bottom-nav a.active { color: var(--primary); }
  .bottom-nav a.active .i { animation: wiggle .55s var(--spring); }
  .bottom-nav a:active .i { transform: scale(.85); }
  .bottom-nav a .badge { position: absolute; top: 5px; left: 56%; height: 17px; padding: 0 5px; font-size: 10px; z-index: 2; }
  #toast { bottom: 82px; right: 12px; left: 12px; align-items: stretch; }
  .auth-wrap { grid-template-columns: 1fr; }
  .auth-hero { padding: 32px 20px 0; gap: 14px; }
  .auth-hero .code-card, .auth-hero .float-chips { display: none; }
  .auth-panel { padding: 20px 16px 40px; align-items: start; }
  .search input { width: 100%; }
  .page-head > .row { width: 100%; }
  .page-head .search { flex: 1; }
  .profile-hero { flex-direction: column; text-align: center; align-items: center; }
  .profile-hero .progress { margin-left: auto; margin-right: auto; }
  .info-card { flex-wrap: wrap; }
  .info-card .btn { align-self: flex-start; margin-left: 52px; }
  .chapter-title { font-size: 1.65rem; }
  .test-bar { padding: 8px 10px; gap: 8px; }
  .topic-card { min-height: 0; }
}
@media (max-width: 560px) {
  .hide-xs { display: none !important; }
  .cols-4 { grid-template-columns: 1fr 1fr; gap: 10px; }
  .cols-4 .card { padding: 14px; }
  .stat-value { font-size: 1.75rem; }
  .ring { width: 46px; height: 46px; }
  .hero h1 { font-size: 1.75rem; }
  .hero-cards { grid-template-columns: 1fr; }
  .grade-btns { grid-template-columns: repeat(2, 1fr); }
  .hud .pill.xp .bar, .hud .pill.xp small { display: none; }
  .hud .mobile-brand .wordmark em { display: none; }
  .badges { grid-template-columns: repeat(2, 1fr); }
  .journey { grid-template-columns: repeat(2, 1fr); }
  .quest { padding: 10px 12px; }
  .list-row { padding: 12px; gap: 10px; }
  .editor-bar { gap: 6px; padding: 6px 8px; }
  .editor-bar .btn.sm { padding: 0 10px; }
  .book-cover { height: 112px; }
  .book-word { font-size: 40px; }
  .wk-bar { display: none; }
  .week > summary { gap: 10px; padding: 13px 14px; }
  .week > summary .wk { min-width: 64px; }
  .mini-stats .stat-value { font-size: 1.5rem; }
  .quick { grid-template-columns: 1fr 1fr; }
}

/* late overrides: plain characters in code (the font shorthand above resets ligature settings) */
code, pre, kbd, .io, .compile-err, .CodeMirror, .mono, textarea.fallback, .sig-card, .code-card pre { font-variant-ligatures: none !important; font-feature-settings: "liga" 0, "calt" 0 !important; }
.auth-hero .target-chip { align-self: flex-start; }
