/* Spaarth design tokens. One neutral canvas, one accent, subject and status colours.
   Chart colours come from the dataviz reference palette (validated for colour-vision deficiency). */
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-display: swap;
  font-weight: 100 900;
  src: url('/fonts/inter-latin-wght-normal.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-display: swap;
  font-weight: 100 900;
  src: url('/fonts/inter-latin-ext-wght-normal.woff2') format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

:root {
  color-scheme: light;
  /* neutrals */
  --bg: #ffffff;
  --bg-subtle: #f8f9fb;
  --bg-muted: #f2f4f7;
  --bg-hover: #f1f3f7;
  --bg-active: #e9ecf3;
  --border: #e6e8ee;
  --border-strong: #d4d8e1;
  --text: #0f172a;
  --text-2: #3f4a5c;
  --text-3: #667085;
  --text-4: #98a2b3;
  /* accent (indigo, from the logo) */
  --accent: #4f46e5;
  --accent-hover: #4338ca;
  --accent-soft: #eef0ff;
  --accent-soft-2: #e0e3ff;
  --accent-text: #3730a3;
  --brand-gradient: linear-gradient(135deg, #4f8dff 0%, #7b5cff 100%);
  --brand-glow: 0 0 0 1px rgba(99, 102, 241, 0.18), 0 10px 40px -8px rgba(99, 102, 241, 0.35), 0 4px 24px -6px rgba(79, 141, 255, 0.3);
  /* subjects (dataviz categorical slots 1-3, all-pairs validated) */
  --physics: #2a78d6;
  --physics-soft: #e8f1fc;
  --chemistry: #1baf7a;
  --chemistry-soft: #e6f7f0;
  --maths: #eb6834;
  --maths-soft: #fdeee7;
  /* status (dataviz status palette; always paired with a label or icon) */
  --good: #0ca30c;
  --good-text: #067306;
  --good-soft: #e7f6e7;
  --warn: #fab219;
  --warn-text: #8a5a00;
  --warn-soft: #fff6e0;
  --serious: #ec835a;
  --bad: #d03b3b;
  --bad-text: #b42525;
  --bad-soft: #fdecec;
  /* sequential blue for heatmaps */
  --seq-0: #f2f4f7;
  --seq-1: #cde2fb;
  --seq-2: #86b6ef;
  --seq-3: #3987e5;
  --seq-4: #1c5cab;
  /* shape */
  --r-xs: 6px;
  --r-sm: 8px;
  --r-md: 10px;
  --r-lg: 12px;
  --r-xl: 16px;
  --shadow-xs: 0 1px 2px rgba(16, 24, 40, 0.05);
  --shadow-sm: 0 1px 3px rgba(16, 24, 40, 0.08), 0 1px 2px rgba(16, 24, 40, 0.04);
  --shadow-md: 0 8px 24px -6px rgba(16, 24, 40, 0.14), 0 2px 6px rgba(16, 24, 40, 0.05);
  --shadow-lg: 0 24px 48px -12px rgba(16, 24, 40, 0.22);
  /* type */
  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --mono: ui-monospace, 'SF Mono', Menlo, monospace;
  --fs-xs: 12px;
  --fs-sm: 13px;
  --fs-md: 14px;
  --fs-lg: 16px;
  --fs-xl: 18px;
  --fs-2xl: 22px;
  --fs-3xl: 28px;
  /* layout */
  --sb-w: 252px;
  --sb-w-collapsed: 68px;
  --top-h: 56px;
  --content-w: 1180px;
  --ease: cubic-bezier(0.2, 0.8, 0.2, 1);
  --av: clamp(220px, 40vh, 420px);
  --dock: 112px;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; }
body { margin: 0; font-family: var(--font); font-size: var(--fs-md); line-height: 1.5; color: var(--text); background: var(--bg); -webkit-font-smoothing: antialiased; font-feature-settings: 'cv11', 'ss01'; overflow-x: hidden; }
button { font: inherit; color: inherit; cursor: pointer; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
h1, h2, h3, h4 { margin: 0; letter-spacing: -0.015em; color: var(--text); }
h1 { font-size: var(--fs-3xl); font-weight: 650; line-height: 1.2; }
h2 { font-size: var(--fs-xl); font-weight: 620; line-height: 1.3; }
h3 { font-size: var(--fs-lg); font-weight: 600; line-height: 1.35; }
h4 { font-size: var(--fs-md); font-weight: 600; }
p { margin: 0 0 0.6em; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.tnum { font-variant-numeric: tabular-nums; }
.muted { color: var(--text-3); }
.small { font-size: var(--fs-sm); }
.xs { font-size: var(--fs-xs); }
.strong { font-weight: 600; }
.clip { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.grow { flex: 1; min-width: 0; }
.spacer { flex: 1; }
.row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.row.tight { gap: 8px; flex-wrap: nowrap; }
.row.wrap { flex-wrap: wrap; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.ico { display: inline-grid; place-items: center; flex: none; }
.fade-in { animation: rise 0.3s var(--ease); }
@keyframes rise { from { opacity: 0; transform: translateY(6px); } }
@keyframes fade { from { opacity: 0; } }
input[type='text'], input[type='email'], input[type='search'], input[type='number'], input[type='date'], input[type='time'], textarea, select {
  font: inherit; font-size: var(--fs-md); color: var(--text); padding: 9px 12px; border: 1px solid var(--border-strong); border-radius: var(--r-sm); background: var(--bg); width: 100%; transition: border-color 0.12s, box-shadow 0.12s;
}
input:focus, textarea:focus, select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft-2); }
textarea { resize: vertical; min-height: 80px; line-height: 1.5; }
select { appearance: none; padding-right: 32px; background: var(--bg) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23667085' stroke-width='2'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") no-repeat right 10px center; }
input[type='checkbox'] { width: 16px; height: 16px; accent-color: var(--accent); }
label.field { display: flex; flex-direction: column; gap: 6px; font-size: var(--fs-sm); color: var(--text-2); font-weight: 550; }
label.field .hint { font-weight: 400; color: var(--text-3); font-size: var(--fs-xs); }
.rich { line-height: 1.65; }
.rich p { margin: 0 0 0.7em; }
.rich p:last-child { margin-bottom: 0; }
.rich ul, .rich ol { margin: 0 0 0.8em; padding-left: 1.3em; }
.rich code { padding: 0.1em 0.35em; border-radius: 5px; background: var(--bg-muted); font-size: 0.9em; font-family: var(--mono); }
.rich .katex-display { margin: 0.6em 0; overflow-x: auto; overflow-y: hidden; }
::selection { background: var(--accent-soft-2); }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; } }
.rich figure.fig-desc { display: flex; gap: 12px; align-items: flex-start; margin: 14px 0; padding: 12px 14px; border: 1px dashed var(--border-strong); border-radius: var(--r-md); background: var(--bg-subtle); }
.rich figure.fig-desc .fig-ic { flex: none; width: 34px; height: 34px; border-radius: 8px; display: grid; place-items: center; background: var(--bg); color: var(--text-3); border: 1px solid var(--border); }
.rich figure.fig-desc figcaption { font-size: 14px; line-height: 1.55; color: var(--text-2); }
.rich figure.fig-desc figcaption b { display: block; font-size: 12px; text-transform: uppercase; letter-spacing: 0.04em; color: var(--text-3); margin-bottom: 2px; }

/* ---------- layout ---------- */
.app { display: flex; min-height: 100vh; }
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; margin-left: var(--sb-w); transition: margin-left 0.2s var(--ease); }
body.sb-collapsed .main { margin-left: var(--sb-w-collapsed); }
body.no-shell .main { margin-left: 0; }
.screen { position: relative; z-index: 10; width: 100%; max-width: var(--content-w); margin: 0 auto; padding: 24px 32px 140px; outline: none; }
.screen.wide { max-width: 1440px; }
.screen.full { max-width: none; padding: 0; }

/* ---------- sidebar ---------- */
.sidebar { position: fixed; z-index: 40; inset: 0 auto 0 0; width: var(--sb-w); display: flex; flex-direction: column; background: var(--bg-subtle); border-right: 1px solid var(--border); transition: width 0.2s var(--ease), transform 0.2s var(--ease); }
body.sb-collapsed .sidebar { width: var(--sb-w-collapsed); }
body.no-shell .sidebar { display: none; }
.sb-head { display: flex; align-items: center; gap: 8px; height: var(--top-h); padding: 0 12px 0 16px; flex: none; }
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--text); font-weight: 650; font-size: 17px; letter-spacing: -0.02em; text-decoration: none !important; min-width: 0; }
.brand img { border-radius: 8px; flex: none; }
body.sb-collapsed .brand span, body.sb-collapsed .sb-label, body.sb-collapsed .nav-sec, body.sb-collapsed .sb-foot .sb-label { display: none; }
body.sb-collapsed .sb-head { padding: 0 14px; justify-content: center; }
body.sb-collapsed .sb-head .sb-collapse { display: none; }
.sb-collapse { margin-left: auto; }
.nav { flex: 1; overflow-y: auto; padding: 4px 10px 12px; display: flex; flex-direction: column; gap: 1px; }
.nav-sec { margin: 14px 10px 4px; font-size: 11px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-4); }
.nav a { position: relative; display: flex; align-items: center; gap: 11px; height: 36px; padding: 0 10px; border-radius: var(--r-sm); color: var(--text-2); font-size: var(--fs-md); font-weight: 500; text-decoration: none; white-space: nowrap; }
.nav a .ico { color: var(--text-3); }
.nav a:hover { background: var(--bg-hover); color: var(--text); }
.nav a.active { background: var(--bg-active); color: var(--text); font-weight: 600; }
.nav a.active .ico { color: var(--accent); }
.nav a .count { margin-left: auto; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px; background: var(--accent); color: #fff; font-size: 11px; font-weight: 600; display: grid; place-items: center; }
body.sb-collapsed .nav { padding: 4px 12px; }
body.sb-collapsed .nav a { justify-content: center; padding: 0; }
body.sb-collapsed .nav a .count { position: absolute; top: 2px; right: 2px; min-width: 16px; height: 16px; font-size: 10px; padding: 0 4px; }
.sb-foot { flex: none; border-top: 1px solid var(--border); padding: 10px; }
.sb-foot .exam { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: var(--r-sm); font-size: var(--fs-sm); color: var(--text-2); }
.sb-foot .exam b { font-size: var(--fs-lg); color: var(--text); }
body.sb-collapsed .sb-foot .exam { justify-content: center; padding: 8px 0; }
.brain { width: 8px; height: 8px; border-radius: 50%; background: var(--text-4); flex: none; }
.brain.on { background: var(--good); box-shadow: 0 0 0 3px var(--good-soft); }

/* ---------- top bar ---------- */
.topbar { position: sticky; top: 0; z-index: 30; height: var(--top-h); display: flex; align-items: center; gap: 8px; padding: 0 20px 0 24px; background: rgba(255, 255, 255, 0.92); border-bottom: 1px solid var(--border); backdrop-filter: saturate(1.4) blur(10px); -webkit-backdrop-filter: saturate(1.4) blur(10px); }
body[data-mode='home'] .topbar { border-bottom-color: transparent; background: transparent; backdrop-filter: none; }
body.no-shell .topbar { display: none; }
.crumbs { display: flex; align-items: center; gap: 6px; min-width: 0; font-size: var(--fs-md); color: var(--text-3); }
.crumbs a { color: var(--text-3); }
.crumbs a:hover { color: var(--text); text-decoration: none; }
.crumbs .cur { color: var(--text); font-weight: 600; }
.crumbs .sep { color: var(--text-4); }
.search-btn { display: flex; align-items: center; gap: 8px; height: 34px; min-width: 240px; padding: 0 10px; border: 1px solid var(--border); border-radius: var(--r-sm); background: var(--bg-subtle); color: var(--text-3); font-size: var(--fs-sm); }
.search-btn:hover { border-color: var(--border-strong); background: var(--bg); }
.search-btn kbd { margin-left: auto; }
.streak { display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 10px; border-radius: 16px; background: var(--warn-soft); color: var(--warn-text); font-weight: 600; font-size: var(--fs-sm); }
.streak .ico { color: #e98a00; }
.icon-btn { position: relative; display: inline-grid; place-items: center; width: 34px; height: 34px; border: 0; border-radius: var(--r-sm); background: transparent; color: var(--text-2); }
.icon-btn:hover { background: var(--bg-hover); color: var(--text); }
.icon-btn .dot { position: absolute; top: 6px; right: 7px; width: 8px; height: 8px; border-radius: 50%; background: var(--bad); box-shadow: 0 0 0 2px var(--bg); }
.icon-btn.flip .ico { transform: rotate(180deg); }
.menu-btn { display: none; }

/* ---------- popovers & menus ---------- */
.popover { position: fixed; z-index: 60; min-width: 220px; max-width: 380px; padding: 6px; border: 1px solid var(--border); border-radius: var(--r-lg); background: var(--bg); box-shadow: var(--shadow-md); animation: fade 0.12s; }
.popover .mi { display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 10px; border: 0; border-radius: var(--r-sm); background: transparent; text-align: left; font-size: var(--fs-md); color: var(--text-2); }
.popover .mi:hover { background: var(--bg-hover); color: var(--text); }
.popover .mh { padding: 8px 10px 6px; font-size: var(--fs-xs); color: var(--text-3); font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; }
.popover hr { border: 0; border-top: 1px solid var(--border); margin: 6px 0; }
.notif { width: 380px; max-height: 480px; overflow-y: auto; }
.notif .ni { display: flex; gap: 10px; padding: 10px; border-radius: var(--r-sm); }
.notif .ni:hover { background: var(--bg-hover); }
.notif .ni .ico { width: 30px; height: 30px; border-radius: 50%; background: var(--bg-muted); color: var(--text-2); }
.notif .ni.unread .t { font-weight: 600; }
.notif .ni .t { font-size: var(--fs-sm); color: var(--text); line-height: 1.35; }
.notif .ni .b { font-size: var(--fs-xs); color: var(--text-3); margin-top: 2px; }

/* ---------- command palette ---------- */
.cmdk-wrap { position: fixed; z-index: 70; inset: 0; display: grid; justify-items: center; align-items: start; padding-top: 12vh; background: rgba(15, 23, 42, 0.28); animation: fade 0.12s; }
.cmdk { width: min(640px, calc(100vw - 32px)); border: 1px solid var(--border); border-radius: var(--r-xl); background: var(--bg); box-shadow: var(--shadow-lg); overflow: hidden; }
.cmdk-in { display: flex; align-items: center; gap: 10px; padding: 14px 16px; border-bottom: 1px solid var(--border); color: var(--text-3); }
.cmdk-in input { border: 0; padding: 0; font-size: var(--fs-lg); box-shadow: none !important; }
.cmdk-list { max-height: 420px; overflow-y: auto; padding: 6px; }
.cmdk-list .mh { padding: 10px 10px 4px; font-size: var(--fs-xs); color: var(--text-3); font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; }
.cmdk-list .ci { display: flex; align-items: center; gap: 12px; width: 100%; padding: 9px 10px; border: 0; border-radius: var(--r-sm); background: transparent; text-align: left; }
.cmdk-list .ci[aria-selected='true'] { background: var(--accent-soft); }
.cmdk-list .ci .ico { color: var(--text-3); }
.cmdk-list .ci .t { font-size: var(--fs-md); color: var(--text); }
.cmdk-list .ci .m { margin-left: auto; font-size: var(--fs-xs); color: var(--text-3); }
.cmdk-foot { display: flex; gap: 14px; padding: 8px 14px; border-top: 1px solid var(--border); font-size: var(--fs-xs); color: var(--text-3); background: var(--bg-subtle); }
kbd { display: inline-grid; place-items: center; min-width: 20px; height: 20px; padding: 0 5px; border: 1px solid var(--border-strong); border-bottom-width: 2px; border-radius: 5px; background: var(--bg); font-family: var(--font); font-size: 11px; color: var(--text-3); }

/* ---------- Mochi ---------- */
.companion { position: fixed; z-index: 20; transition: top 0.6s var(--ease), left 0.6s var(--ease), width 0.6s var(--ease), height 0.6s var(--ease), opacity 0.3s; }
.companion.home { top: calc(var(--top-h) + 4px); left: calc(var(--sb-w) + (100vw - var(--sb-w)) / 2); width: var(--av); height: var(--av); transform: translateX(-50%); }
body.sb-collapsed .companion.home { left: calc(var(--sb-w-collapsed) + (100vw - var(--sb-w-collapsed)) / 2); }
.companion.dock { top: calc(100vh - var(--dock) - 16px); top: calc(100dvh - var(--dock) - 16px); left: calc(100% - var(--dock) - 16px); width: var(--dock); height: var(--dock); transform: none; }
.companion.hidden, body.mochi-min .companion.dock { opacity: 0; pointer-events: none; }
.stage { position: absolute; inset: 0; }
.stage canvas { width: 100%; height: 100%; display: block; touch-action: none; }
/* The brand gradient lives only here: a soft glow behind Mochi. */
.halo { position: absolute; inset: -14%; border-radius: 50%; pointer-events: none; background: radial-gradient(circle, rgba(99, 132, 255, 0.28) 0%, rgba(140, 110, 255, 0.12) 38%, transparent 66%); }
.companion.dock .halo { inset: -4%; opacity: 0.7; }
.mochi-pill { position: fixed; z-index: 21; right: 16px; bottom: 16px; display: none; align-items: center; gap: 8px; height: 40px; padding: 0 14px 0 6px; border: 1px solid var(--border); border-radius: 20px; background: var(--bg); box-shadow: var(--shadow-md); font-size: var(--fs-sm); font-weight: 600; color: var(--text-2); }
.mochi-pill img { width: 28px; height: 28px; border-radius: 50%; }
body.mochi-min[data-mode='dock'] .mochi-pill { display: inline-flex; }
.bubble { position: absolute; z-index: 2; max-width: 300px; width: max-content; padding: 10px 36px 10px 14px; border: 1px solid var(--border); border-radius: 14px; background: var(--bg); box-shadow: var(--shadow-md); font-size: var(--fs-md); line-height: 1.45; color: var(--text-2); transition: opacity 0.25s, transform 0.3s var(--ease); }
.bubble:has(#bubbleText:empty) { opacity: 0; pointer-events: none; transform: translateY(6px); }
.companion.home .bubble { top: 4%; left: 82%; }
.companion.dock .bubble { bottom: calc(100% + 4px); right: 4px; max-width: min(300px, calc(100vw - 28px)); }
.bubble-x { position: absolute; top: 6px; right: 6px; width: 24px; height: 24px; border: 0; border-radius: 6px; background: transparent; opacity: 0.6; }
.bubble-x:hover { opacity: 1; background: var(--bg-hover); }
.dock-min { position: absolute; top: -6px; right: -6px; z-index: 3; width: 22px; height: 22px; border: 1px solid var(--border); border-radius: 50%; background: var(--bg); display: none; place-items: center; color: var(--text-3); box-shadow: var(--shadow-xs); }
.companion.dock:hover .dock-min { display: grid; }

/* ---------- sheet, toast, banner ---------- */
.sheet { position: fixed; inset: 0; z-index: 55; display: grid; align-items: end; justify-items: center; background: rgba(15, 23, 42, 0.28); animation: fade 0.15s; }
.sheet-card { width: min(720px, 100%); max-height: 86vh; overflow: auto; padding: 18px 20px 22px; border-radius: 18px 18px 0 0; background: var(--bg); box-shadow: var(--shadow-lg); animation: up 0.3s var(--ease); }
@keyframes up { from { transform: translateY(30px); opacity: 0; } }
.sheet-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.dialog-wrap { position: fixed; inset: 0; z-index: 65; display: grid; place-items: center; padding: 16px; background: rgba(15, 23, 42, 0.32); animation: fade 0.12s; }
.dialog { width: min(520px, 100%); max-height: 88vh; overflow: auto; border: 1px solid var(--border); border-radius: var(--r-xl); background: var(--bg); box-shadow: var(--shadow-lg); animation: rise 0.2s var(--ease); }
.dialog.wide { width: min(760px, 100%); }
.dialog-h { display: flex; align-items: center; gap: 10px; padding: 18px 20px 6px; }
.dialog-b { padding: 8px 20px 16px; color: var(--text-2); }
.dialog-f { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 20px 16px; border-top: 1px solid var(--border); background: var(--bg-subtle); border-radius: 0 0 var(--r-xl) var(--r-xl); }
.toast { position: fixed; left: 50%; bottom: 24px; z-index: 80; max-width: calc(100vw - 32px); padding: 10px 16px; border-radius: var(--r-md); background: var(--text); color: #fff; font-size: var(--fs-md); opacity: 0; transform: translate(-50%, 8px); transition: opacity 0.2s, transform 0.25s var(--ease); pointer-events: none; box-shadow: var(--shadow-md); }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.stale { position: fixed; z-index: 75; top: 10px; left: 50%; transform: translateX(-50%); display: flex; align-items: center; gap: 12px; max-width: calc(100vw - 32px); padding: 8px 8px 8px 16px; border-radius: var(--r-lg); background: var(--text); color: #fff; font-size: var(--fs-sm); box-shadow: var(--shadow-md); }
.stale .btn { height: 30px; padding: 0 12px; font-size: var(--fs-sm); background: #fff; color: var(--text); }
.scrim { position: fixed; inset: 0; z-index: 35; background: rgba(15, 23, 42, 0.28); animation: fade 0.15s; }

/* ---------- mobile ---------- */
.tabbar { display: none; }
@media (max-width: 1023px) {
  :root { --sb-w: 68px; }
  body:not(.sb-open) .brand span, body:not(.sb-open) .sb-label, body:not(.sb-open) .nav-sec, body:not(.sb-open) .sb-head .sb-collapse { display: none; }
  body:not(.sb-open) .nav a { justify-content: center; padding: 0; }
  body:not(.sb-open) .sb-head { justify-content: center; padding: 0; }
  body.sb-open .sidebar { width: 260px; box-shadow: var(--shadow-lg); }
  .search-btn { min-width: 0; }
  .search-btn > span:not(.ico), .search-btn kbd { display: none; }
  .search-btn { width: 36px; justify-content: center; padding: 0; background: transparent; border-color: transparent; }
}
@media (max-width: 767px) {
  .main, body.sb-collapsed .main { margin-left: 0; }
  .sidebar { transform: translateX(-100%); width: 280px !important; }
  body.sb-open .sidebar { transform: none; }
  body.sb-open .brand span, body.sb-open .sb-label, body.sb-open .nav-sec { display: initial; }
  body.sb-open .nav a { justify-content: flex-start; padding: 0 10px; }
  .menu-btn { display: inline-grid; }
  .topbar { padding: 0 10px; }
  .crumbs .hide-sm, .streak span { display: none; }
  .screen { padding: 16px 14px 120px; }
  .companion.home, body.sb-collapsed .companion.home { left: 50%; }
  .tabbar { position: fixed; z-index: 30; inset: auto 0 0 0; display: grid; grid-template-columns: repeat(5, 1fr); height: 60px; padding-bottom: env(safe-area-inset-bottom); background: rgba(255, 255, 255, 0.96); border-top: 1px solid var(--border); backdrop-filter: blur(10px); }
  .tabbar a { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; color: var(--text-3); font-size: 11px; font-weight: 550; text-decoration: none; }
  .tabbar a.active { color: var(--accent); }
  .companion.dock { top: calc(100dvh - var(--dock) - 74px); }
  :root { --dock: 84px; --av: clamp(200px, 36vh, 300px); }
  .companion.home .bubble { left: 50%; translate: -50% 0; top: -4%; max-width: min(300px, calc(100vw - 32px)); font-size: var(--fs-sm); }
  .toast { bottom: 76px; }
}
@media print {
  .sidebar, .topbar, .companion, .tabbar, .no-print, .toast, .stale, .scrim, .mochi-pill { display: none !important; }
  .main { margin: 0 !important; }
  .screen { padding: 0; max-width: none; }
  .panel, .card { break-inside: avoid; box-shadow: none; }
}
@media (max-width: 767px) { .stale { left: 8px; right: 8px; transform: none; max-width: none; } }

/* Mochi's next step inside the bubble, and the element Mochi points at. */
.bubble-act { display: flex; align-items: center; gap: 6px; margin-top: 8px; padding: 6px 10px; border: 0; border-radius: 8px; background: var(--accent); color: #fff; font: inherit; font-size: var(--fs-sm); font-weight: 600; cursor: pointer; }
.bubble-act:hover { background: var(--accent-hover); }
.bubble-act[hidden] { display: none; }
@keyframes mochi-pulse { 0% { box-shadow: 0 0 0 0 rgba(79, 70, 229, 0.45); } 100% { box-shadow: 0 0 0 12px rgba(79, 70, 229, 0); } }
.mochi-target { animation: mochi-pulse 1.1s var(--ease) 3; }
@media (prefers-reduced-motion: reduce) { .mochi-target { animation: none; outline: 2px solid var(--accent); outline-offset: 3px; } }

/* ---------- buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 38px; padding: 0 16px; border: 1px solid transparent; border-radius: var(--r-sm); background: var(--accent); color: #fff; font-weight: 600; font-size: var(--fs-md); white-space: nowrap; transition: background 0.12s, border-color 0.12s, color 0.12s, box-shadow 0.12s; text-decoration: none !important; }
.btn:hover { background: var(--accent-hover); }
.btn:disabled { opacity: 0.5; cursor: default; }
.btn.lg { height: 44px; padding: 0 20px; font-size: var(--fs-lg); border-radius: var(--r-md); }
.btn.sm, .btn.small { height: 32px; padding: 0 12px; font-size: var(--fs-sm); }
.btn.xs { height: 26px; padding: 0 9px; font-size: var(--fs-xs); border-radius: var(--r-xs); }
.btn.secondary, .btn.soft { background: var(--bg); color: var(--text); border-color: var(--border-strong); box-shadow: var(--shadow-xs); }
.btn.secondary:hover, .btn.soft:hover { background: var(--bg-subtle); border-color: var(--text-4); }
.btn.ghost { background: transparent; color: var(--text-2); }
.btn.ghost:hover { background: var(--bg-hover); color: var(--text); }
.btn.danger { background: var(--bad); }
.btn.danger:hover { background: #b32f2f; }
.btn.dark { background: var(--text); }
.btn.dark:hover { background: #1e293b; }
.btn.block { width: 100%; }
.linkbtn { border: 0; background: none; padding: 0; color: var(--accent); font: inherit; font-size: var(--fs-sm); font-weight: 550; cursor: pointer; }
.linkbtn:hover { text-decoration: underline; }
.btn-group { display: inline-flex; }
.btn-group .btn { border-radius: 0; }
.btn-group .btn:first-child { border-radius: var(--r-sm) 0 0 var(--r-sm); }
.btn-group .btn:last-child { border-radius: 0 var(--r-sm) var(--r-sm) 0; }
.btn-group .btn + .btn { margin-left: -1px; }

/* ---------- panels ---------- */
.panel, .card { background: var(--bg); border: 1px solid var(--border); border-radius: var(--r-lg); }
.panel { display: flex; flex-direction: column; min-width: 0; }
.card { padding: 20px; }
.card + .card, .panel + .panel { margin-top: 16px; }
.grid > .panel, .grid > .card, .grid > .stack > .panel { margin-top: 0; }
.panel-h { display: flex; align-items: center; gap: 10px; min-height: 52px; padding: 14px 18px 0; }
.panel-h h3 { font-size: var(--fs-md); font-weight: 600; }
.panel-h .sub { font-size: var(--fs-xs); color: var(--text-3); }
.panel-h .actions { margin-left: auto; display: flex; gap: 6px; align-items: center; }
.panel-b { padding: 12px 18px 18px; flex: 1; min-width: 0; }
.panel-b.flush { padding: 8px 0 6px; }
.panel-f { padding: 10px 18px; border-top: 1px solid var(--border); font-size: var(--fs-sm); }
.panel.accent { border-color: var(--accent-soft-2); background: linear-gradient(180deg, var(--accent-soft) 0%, var(--bg) 70%); }
.grid { display: grid; gap: 16px; }
.grid + .grid, .grid + .panel, .panel + .grid, .card + .grid, .grid + .card { margin-top: 16px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.g-main { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
.g-side { grid-template-columns: minmax(0, 1fr) 340px; }
.span2 { grid-column: span 2; }

/* ---------- page header ---------- */
.page-head { display: flex; align-items: flex-end; gap: 16px; margin: 4px 0 20px; flex-wrap: wrap; }
.page-head .t { flex: 1; min-width: 240px; }
.page-head h1 { font-size: 24px; font-weight: 650; }
.page-head p { margin: 4px 0 0; color: var(--text-3); font-size: var(--fs-md); }
.page-head .actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.eyebrow { font-size: var(--fs-xs); font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; color: var(--accent-text); }
.section-t { display: flex; align-items: center; gap: 10px; margin: 28px 0 12px; }
.section-t h2 { font-size: var(--fs-lg); }

/* ---------- tabs & segmented ---------- */
.tabs-u { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 18px; overflow-x: auto; scrollbar-width: none; }
.tabs-u button { position: relative; height: 40px; padding: 0 12px; border: 0; background: transparent; color: var(--text-3); font-weight: 550; font-size: var(--fs-md); white-space: nowrap; }
.tabs-u button:hover { color: var(--text); }
.tabs-u button[aria-selected='true'] { color: var(--text); }
.tabs-u button[aria-selected='true']::after { content: ''; position: absolute; left: 8px; right: 8px; bottom: -1px; height: 2px; border-radius: 2px; background: var(--accent); }
.tabs-u .n { margin-left: 6px; padding: 1px 7px; border-radius: 10px; background: var(--bg-muted); font-size: 11px; color: var(--text-3); }
.seg { display: inline-flex; padding: 3px; border-radius: var(--r-sm); background: var(--bg-muted); gap: 2px; }
.seg button { border: 0; background: transparent; height: 28px; padding: 0 12px; border-radius: 6px; font-size: var(--fs-sm); color: var(--text-2); font-weight: 550; }
.seg button[aria-selected='true'] { background: var(--bg); color: var(--text); box-shadow: var(--shadow-sm); }

/* ---------- chips, badges, tags ---------- */
.chip { display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 12px; border: 1px solid var(--border-strong); border-radius: 16px; background: var(--bg); font-size: var(--fs-sm); color: var(--text-2); font-weight: 500; transition: background 0.12s, border-color 0.12s; }
.chip:hover { background: var(--bg-subtle); }
.chip[aria-pressed='true'] { background: var(--accent-soft); border-color: var(--accent-soft-2); color: var(--accent-text); }
.chip .n { color: var(--text-3); font-size: var(--fs-xs); }
.chip.sm { min-height: 28px; height: auto; padding: 4px 10px; font-size: var(--fs-xs); gap: 5px; line-height: 1.3; text-align: left; }
.badge, .pill { display: inline-flex; align-items: center; gap: 5px; height: 22px; padding: 0 8px; border-radius: 6px; background: var(--bg-muted); color: var(--text-2); font-size: 12px; font-weight: 600; white-space: nowrap; }
.badge.accent { background: var(--accent-soft); color: var(--accent-text); }
.badge.good, .pill.up { background: var(--good-soft); color: var(--good-text); }
.badge.warn { background: var(--warn-soft); color: var(--warn-text); }
.badge.bad, .pill.down { background: var(--bad-soft); color: var(--bad-text); }
.badge.outline { background: transparent; border: 1px solid var(--border-strong); }
.badge.physics { background: var(--physics-soft); color: #1d5aa3; }
.badge.chemistry { background: var(--chemistry-soft); color: #0e7a53; }
.badge.maths { background: var(--maths-soft); color: #b0441b; }
.badge .bdot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.subj-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; flex: none; }
.subj-dot.physics { background: var(--physics); }
.subj-dot.chemistry { background: var(--chemistry); }
.subj-dot.maths { background: var(--maths); }

/* ---------- avatars ---------- */
.avatar { display: inline-grid; place-items: center; width: 32px; height: 32px; border-radius: 50%; color: #fff; font-weight: 650; font-size: 12px; flex: none; letter-spacing: 0.02em; }
.avatar.sm { width: 24px; height: 24px; font-size: 10px; }
.avatar.lg { width: 44px; height: 44px; font-size: 15px; }
.avatar.xl { width: 64px; height: 64px; font-size: 20px; }
.avatar-stack { display: inline-flex; }
.avatar-stack .avatar { box-shadow: 0 0 0 2px var(--bg); }
.avatar-stack .avatar + .avatar { margin-left: -8px; }
.avatar-stack .more { background: var(--bg-muted); color: var(--text-2); }

/* ---------- stat tiles ---------- */
.stat-tile { position: relative; padding: 16px 18px; border: 1px solid var(--border); border-radius: var(--r-lg); background: var(--bg); min-width: 0; }
.stat-tile .l { display: flex; align-items: center; gap: 6px; font-size: var(--fs-sm); color: var(--text-3); font-weight: 550; }
.stat-tile .v { margin-top: 6px; font-size: 26px; font-weight: 650; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; line-height: 1.15; }
.stat-tile .v small { font-size: var(--fs-md); color: var(--text-3); font-weight: 500; letter-spacing: 0; }
.stat-tile .s { margin-top: 4px; font-size: var(--fs-xs); color: var(--text-3); }
.stat-tile .delta { font-weight: 600; }
.stat-tile .delta.up { color: var(--good-text); }
.stat-tile .delta.down { color: var(--bad-text); }
.stat-tile .vrow { display: flex; align-items: flex-end; justify-content: space-between; gap: 10px; }
.stat-tile .vrow .spark { flex: none; margin-bottom: 4px; }
.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; margin-bottom: 16px; }
.stats.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.stat { padding: 16px 18px; border: 1px solid var(--border); border-radius: var(--r-lg); background: var(--bg); }
.stat-v { font-size: 26px; font-weight: 650; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.stat-l { font-size: var(--fs-sm); color: var(--text-3); font-weight: 550; margin-top: 2px; }
.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-top: 14px; }
.kpi { padding: 12px 14px; border-radius: var(--r-md); background: var(--bg-subtle); border: 1px solid var(--border); }
.kpi-l { font-size: var(--fs-xs); color: var(--text-3); font-weight: 600; }
.kpi-v { font-size: var(--fs-xl); font-weight: 650; margin: 2px 0; font-variant-numeric: tabular-nums; }

/* ---------- progress ---------- */
.bar { height: 6px; border-radius: 3px; background: var(--bg-muted); overflow: hidden; }
.bar > i { display: block; height: 100%; border-radius: 3px; background: var(--accent); transition: width 0.4s var(--ease); }
.bar.good > i { background: var(--good); }
.bar.bad > i { background: var(--serious); }
.bar.warn > i { background: var(--warn); }
.bar.physics > i { background: var(--physics); }
.bar.chemistry > i { background: var(--chemistry); }
.bar.maths > i { background: var(--maths); }
.bar.thick { height: 10px; border-radius: 5px; }
.ring { position: relative; display: inline-grid; place-items: center; flex: none; }
.ring svg { transform: rotate(-90deg); }
.ring .rt { position: absolute; text-align: center; line-height: 1.1; }
.ring .rt b { display: block; font-size: 15px; font-variant-numeric: tabular-nums; }
.ring .rt span { font-size: 10px; color: var(--text-3); }

/* ---------- tables & lists ---------- */
.table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: var(--fs-md); }
.table th { position: sticky; top: 0; z-index: 1; padding: 10px 12px; background: var(--bg-subtle); border-bottom: 1px solid var(--border); text-align: left; font-size: var(--fs-xs); font-weight: 600; color: var(--text-3); text-transform: uppercase; letter-spacing: 0.04em; white-space: nowrap; }
.table th.sortable { cursor: pointer; }
.table th.sortable:hover { color: var(--text); }
.table td { padding: 11px 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr:hover td { background: var(--bg-subtle); }
.table tr.me td { background: var(--accent-soft); }
.table .num { text-align: right; font-variant-numeric: tabular-nums; }
.table-wrap { border: 1px solid var(--border); border-radius: var(--r-lg); overflow: auto; }
.panel .table-wrap, .dialog .table-wrap { border: 0; border-radius: 0; }
.table-wrap .table th:first-child, .table-wrap .table td:first-child { padding-left: 16px; }
.list { list-style: none; margin: 0; padding: 0; }
.list > li { padding: 10px 0; border-bottom: 1px solid var(--border); }
.list > li:last-child { border-bottom: 0; }
.lrow { display: flex; align-items: center; gap: 12px; width: 100%; padding: 10px 18px; border: 0; background: transparent; text-align: left; color: var(--text); font-size: var(--fs-md); }
button.lrow:hover, a.lrow:hover { background: var(--bg-subtle); text-decoration: none; }
.lrow .lt { flex: 1; min-width: 0; }
.lrow .lt .t { font-weight: 550; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lrow .lt .m { font-size: var(--fs-xs); color: var(--text-3); margin-top: 1px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lrow .r { flex: none; font-size: var(--fs-sm); color: var(--text-3); text-align: right; }
.lrow .lico { width: 34px; height: 34px; border-radius: var(--r-sm); display: grid; place-items: center; background: var(--bg-muted); color: var(--text-2); flex: none; }
.lrow + .lrow { border-top: 1px solid var(--border); }
.linkrow { display: flex; align-items: center; justify-content: space-between; gap: 12px; width: 100%; padding: 2px 0; border: 0; background: transparent; text-align: left; font-size: var(--fs-md); color: var(--text); }
.linkrow:hover { color: var(--accent); }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 8px 18px; font-size: var(--fs-md); }
.kv > :nth-child(odd) { color: var(--text-3); }

/* ---------- empty, skeleton, loading ---------- */
.empty { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 8px; padding: 36px 20px; color: var(--text-3); }
.empty .ill { width: 56px; height: 56px; border-radius: 16px; display: grid; place-items: center; background: var(--bg-muted); color: var(--text-3); margin-bottom: 4px; }
.empty h4 { color: var(--text); }
.empty p { max-width: 380px; margin: 0; font-size: var(--fs-sm); }
.skel { border-radius: 6px; background: linear-gradient(90deg, var(--bg-muted) 0%, #f8f9fb 50%, var(--bg-muted) 100%); background-size: 200% 100%; animation: shimmer 1.2s infinite linear; }
@keyframes shimmer { to { background-position: -200% 0; } }
.loading { display: grid; gap: 16px; padding: 4px 0; }
.loading .skel { height: 14px; }
.loading .skel.block { height: 110px; border-radius: var(--r-lg); }

/* ---------- forms ---------- */
.switch { position: relative; display: inline-flex; width: 36px; height: 20px; flex: none; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch i { position: absolute; inset: 0; border-radius: 10px; background: var(--border-strong); transition: background 0.15s; cursor: pointer; }
.switch i::after { content: ''; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: var(--shadow-sm); transition: transform 0.15s var(--ease); }
.switch input:checked + i { background: var(--accent); }
.switch input:checked + i::after { transform: translateX(16px); }
.switch input:focus-visible + i { outline: 2px solid var(--accent); outline-offset: 2px; }
.setting { display: flex; align-items: center; gap: 16px; padding: 14px 0; border-bottom: 1px solid var(--border); }
.setting:last-child { border-bottom: 0; }
.setting .st { flex: 1; min-width: 0; }
.setting .st .t { font-weight: 550; }
.setting .st .d { font-size: var(--fs-sm); color: var(--text-3); margin-top: 2px; }
.searchbox { display: flex; align-items: center; gap: 8px; height: 38px; padding: 0 12px; border: 1px solid var(--border-strong); border-radius: var(--r-sm); background: var(--bg); color: var(--text-3); min-width: 220px; }
.searchbox:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft-2); }
.searchbox input { border: 0; padding: 0; height: 100%; box-shadow: none !important; background: transparent; }
.filters { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; }
.filters select { width: auto; height: 34px; padding-top: 0; padding-bottom: 0; font-size: var(--fs-sm); }

/* ---------- misc ---------- */
.callout { display: flex; gap: 12px; padding: 12px 14px; border-radius: var(--r-md); background: var(--bg-subtle); border: 1px solid var(--border); font-size: var(--fs-sm); color: var(--text-2); }
.callout.info { background: var(--accent-soft); border-color: var(--accent-soft-2); }
.callout.warn { background: var(--warn-soft); border-color: #f5dfa8; }
.callout.good { background: var(--good-soft); border-color: #bfe5bf; }
.divider { height: 1px; background: var(--border); margin: 16px 0; }
.trust { display: inline-flex; align-items: center; gap: 6px; font-size: var(--fs-xs); font-weight: 600; color: var(--accent-text); background: var(--accent-soft); border-radius: 6px; padding: 2px 8px; margin-bottom: 8px; }
.timeline { list-style: none; margin: 0; padding: 0; position: relative; }
.timeline > li { position: relative; padding: 0 0 16px 26px; }
.timeline > li::before { content: ''; position: absolute; left: 6px; top: 18px; bottom: -2px; width: 2px; background: var(--border); }
.timeline > li:last-child::before { display: none; }
.timeline > li::after { content: ''; position: absolute; left: 1px; top: 5px; width: 12px; height: 12px; border-radius: 50%; border: 2px solid var(--accent); background: var(--bg); }
.timeline > li.done::after { background: var(--good); border-color: var(--good); }
.timeline > li.behind::after, .timeline > li.missed::after { border-color: var(--bad); }
.timeline > li.now::after { background: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft-2); }
.ok-t { color: var(--good-text); font-weight: 600; }
.bad-t { color: var(--bad-text); font-weight: 600; }
@media (max-width: 1100px) {
  .g4, .stats, .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .g-main, .g-side { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 760px) {
  .g2, .g3 { grid-template-columns: minmax(0, 1fr); }
  .span2 { grid-column: auto; }
  .page-head h1 { font-size: 21px; }
  .searchbox { min-width: 0; width: 100%; }
  .stat-tile { padding: 14px; }
  .stat-tile .v { font-size: 22px; }
}
@media (max-width: 480px) {
  .stat-tile .vrow .spark { display: none; }
}
.drawer-wrap { position: fixed; inset: 0; z-index: 70; background: rgba(15, 23, 42, 0.28); animation: fade 0.15s; }
.drawer { position: absolute; inset: 0 0 0 auto; width: min(680px, 100%); display: flex; flex-direction: column; background: var(--bg); box-shadow: var(--shadow-lg); animation: drawer-in 0.22s var(--ease); }
.drawer.wide { width: min(880px, 100%); }
.drawer-h { display: flex; align-items: center; gap: 8px; padding: 14px 16px 14px 22px; border-bottom: 1px solid var(--border); }
.drawer-h h3 { font-size: var(--fs-lg); font-weight: 650; min-width: 0; }
.drawer-b { flex: 1; overflow: auto; padding: 20px 24px 40px; }
@keyframes drawer-in { from { transform: translateX(40px); opacity: 0; } to { transform: none; opacity: 1; } }
.filters select { max-width: 280px; }

.chart { position: relative; width: 100%; }
.chart svg { display: block; width: 100%; overflow: visible; }
.chart .grid-l { stroke: var(--border); stroke-width: 1; }
.chart .axis-t { fill: var(--text-3); font-size: 11px; font-family: var(--font); }
.chart .lbl { fill: var(--text-2); font-size: 11px; font-weight: 600; font-family: var(--font); }
.chart .line { fill: none; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.chart .area { opacity: 0.12; }
.chart .dot { stroke: var(--bg); stroke-width: 2; }
.chart .hit { fill: transparent; cursor: crosshair; }
.chart .xhair { stroke: var(--text-4); stroke-width: 1; stroke-dasharray: 3 3; pointer-events: none; }
.chart .marker { stroke: var(--text); stroke-width: 2; }
.chart-tip { position: absolute; z-index: 5; pointer-events: none; min-width: 120px; padding: 8px 10px; border: 1px solid var(--border); border-radius: var(--r-sm); background: var(--bg); box-shadow: var(--shadow-md); font-size: var(--fs-xs); color: var(--text-2); white-space: nowrap; transform: translate(-50%, calc(-100% - 10px)); }
.chart-tip b { display: block; color: var(--text); font-size: var(--fs-sm); margin-bottom: 2px; }
.chart-tip .tr { display: flex; align-items: center; gap: 6px; }
.chart-tip .tr i { width: 8px; height: 8px; border-radius: 2px; }
.legend { display: flex; flex-wrap: wrap; gap: 4px 14px; margin-top: 8px; font-size: var(--fs-xs); color: var(--text-2); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 10px; height: 10px; border-radius: 3px; }
.heat { display: grid; grid-auto-flow: column; grid-template-rows: repeat(7, 12px); gap: 3px; }
.heat i { width: 12px; height: 12px; border-radius: 3px; background: var(--seq-0); }
.heat i[data-l='1'] { background: var(--seq-1); }
.heat i[data-l='2'] { background: var(--seq-2); }
.heat i[data-l='3'] { background: var(--seq-3); }
.heat i[data-l='4'] { background: var(--seq-4); }
.heat-legend { display: flex; align-items: center; gap: 3px; font-size: var(--fs-xs); color: var(--text-3); }
.heat-legend i { width: 10px; height: 10px; border-radius: 2px; }
.hbars { display: grid; gap: 10px; }
.hbar { display: grid; grid-template-columns: 110px 1fr 90px; gap: 10px; align-items: center; font-size: var(--fs-sm); }
.hbar .bar { margin: 0; height: 8px; }
.hbar .v { text-align: right; color: var(--text-3); font-variant-numeric: tabular-nums; }
.stackbar { display: flex; height: 10px; border-radius: 5px; overflow: hidden; gap: 2px; background: var(--bg); }
.stackbar i { display: block; height: 100%; }
.stackbar i:first-child { border-radius: 5px 0 0 5px; }
.stackbar i:last-child { border-radius: 0 5px 5px 0; }

/* Page-specific styles (migrated; rebuilt page by page). */
/* ---------- today ---------- */
body[data-mode='home'] .screen { max-width: 760px; padding-top: calc(var(--av) + 8px); }
.mission { padding: 22px 24px; border-radius: var(--r-xl); background: var(--bg); border: 1px solid transparent; box-shadow: var(--brand-glow); }
.mission .eyebrow { color: var(--accent-text); }
.mission h1 { font-size: 26px; margin: 6px 0 6px; }
.mission .why { margin: 0 0 18px; color: var(--text-2); font-size: var(--fs-lg); line-height: 1.5; }
.mission .actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.mission .actions .btn:first-child { height: 42px; padding: 0 20px; }
.alts { display: flex; flex-direction: column; gap: 6px; margin-top: 14px; }
.alt { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 10px 14px; border: 1px solid var(--border); border-radius: var(--r-md); background: var(--bg); font-size: var(--fs-md); text-align: left; }
.alt:hover { border-color: var(--accent-soft-2); background: var(--accent-soft); }
.today-strip { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; margin: 14px 4px 0; }
.ts-prog { display: flex; align-items: center; gap: 10px; font-size: var(--fs-sm); }
.ts-prog .bar { width: 90px; }
.ts-list { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.ts-item { display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 10px; border: 1px solid var(--border); border-radius: 14px; background: var(--bg); font-size: var(--fs-xs); color: var(--text-2); }
.ts-item:hover { border-color: var(--border-strong); color: var(--text); }
.kdot { width: 7px; height: 7px; border-radius: 50%; background: var(--text-4); }
.kdot.k-lesson { background: var(--physics); }
.kdot.k-practice, .kdot.k-dpp { background: var(--accent); }
.kdot.k-feedback { background: var(--bad); }
.kdot.k-review, .kdot.k-cards { background: var(--chemistry); }
.kdot.k-mock { background: var(--maths); }
.composer { margin-top: 18px; padding: 12px 12px 8px 16px; border-radius: var(--r-xl); background: var(--bg); border: 1px solid transparent; box-shadow: var(--brand-glow); transition: box-shadow 0.2s; }
.composer:focus-within { box-shadow: 0 0 0 1.5px rgba(99, 102, 241, 0.45), 0 12px 44px -8px rgba(99, 102, 241, 0.45), 0 4px 26px -6px rgba(79, 141, 255, 0.35); }
.composer textarea { display: block; width: 100%; min-height: 26px; max-height: 160px; padding: 4px 0; border: 0; resize: none; font-size: var(--fs-lg); box-shadow: none !important; background: transparent; line-height: 1.5; }
.composer-bar { display: flex; align-items: center; gap: 4px; margin-top: 6px; }
.composer .send { display: grid; place-items: center; width: 34px; height: 34px; border: 0; border-radius: 50%; background: var(--text); color: #fff; }
.composer .send:hover { background: var(--accent); }
.icon-btn.live { background: var(--bad-soft); color: var(--bad-text); }
.checkin { display: flex; align-items: center; justify-content: center; gap: 6px 14px; flex-wrap: wrap; margin-top: 14px; padding: 6px 8px 6px 14px; border-radius: var(--r-lg); background: var(--bg-subtle); border: 1px solid var(--border); }
.ci-row { display: flex; align-items: center; gap: 6px; }
.checkin .chip { height: 28px; padding: 0 10px; font-size: var(--fs-xs); }
.checkin .btn.ghost { height: 28px; padding: 0 10px; font-size: var(--fs-xs); }
/* ---------- question player ---------- */
.task-head { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.task-head .title { flex: 1; min-width: 0; }
.task-head .title h2 { font-size: 17px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stem { font-size: 17px; line-height: 1.6; margin: 4px 0 18px; }
.options { display: grid; gap: 10px; }
.opt { display: flex; align-items: center; gap: 12px; width: 100%; text-align: left; padding: 14px 16px; border: 1.5px solid var(--border-strong); border-radius: var(--r-md); background: var(--bg); font-size: 16px; transition: border-color 0.15s, background 0.15s; }
.opt b { flex: none; display: grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; background: var(--bg-muted); font-size: 14px; }
.opt:hover { border-color: var(--accent-soft-2); }
.opt[aria-pressed='true'] { border-color: var(--accent); background: var(--accent-soft); }
.opt.right { border-color: var(--good); background: #e9f8f1; }
.opt.wrong { border-color: var(--bad); background: #fdeeed; }
.opt:disabled { cursor: default; }
.numeric { display: flex; gap: 10px; align-items: center; }
.numeric input { max-width: 240px; font-size: 18px; }
.conf { display: flex; gap: 8px; align-items: center; margin-top: 16px; flex-wrap: wrap; }
.result { margin-top: 16px; padding: 16px; border-radius: var(--r-md); background: var(--bg); border: 1px solid var(--border); }
.result.ok { border-color: rgba(31, 157, 107, 0.35); background: rgba(233, 248, 241, 0.8); }
.result.no { border-color: rgba(212, 80, 74, 0.3); background: rgba(253, 238, 237, 0.8); }
.result h3 { margin-bottom: 6px; }
.hintbox { margin-top: 12px; padding: 12px 14px; border-radius: 14px; background: #fff8e8; border: 1px solid #f1dfae; font-size: 15px; }
.rich p { margin: 0 0 0.7em; }
.rich p:last-child { margin-bottom: 0; }
.rich ul, .rich ol { margin: 0 0 0.8em; padding-left: 1.3em; }
.rich code { padding: 0.1em 0.35em; border-radius: 6px; background: rgba(30, 45, 110, 0.07); font-size: 0.9em; }
.rich .katex-display { margin: 0.6em 0; overflow-x: auto; overflow-y: hidden; }

/* ---------- lesson ---------- */
.beat-kind { font-size: 12px; font-weight: 650; letter-spacing: 0.06em; text-transform: uppercase; color: #7a5bd6; }
.beat h2 { margin: 6px 0 12px; }
.beat .rich { font-size: 16.5px; line-height: 1.65; }
.steps { display: flex; gap: 6px; margin: 4px 0 16px; }
.steps i { flex: 1; height: 4px; border-radius: 2px; background: var(--bg-muted); }
.steps i.on { background: var(--accent); }

/* ---------- mock ---------- */
.exam-top { position: sticky; top: 10px; z-index: 15; display: flex; align-items: center; gap: 10px; padding: 10px 12px; margin-bottom: 14px; border-radius: var(--r-lg); background: var(--bg); border: 1px solid var(--border);  }
.timer { font-variant-numeric: tabular-nums; font-weight: 700; font-size: 18px; }
.timer.low { color: var(--bad); }
.tabs { display: flex; gap: 6px; }
.palette { display: grid; grid-template-columns: repeat(auto-fill, minmax(38px, 1fr)); gap: 6px; margin-top: 14px; }
.palette button { height: 38px; border-radius: 10px; border: 1px solid var(--border-strong); background: #fff; font-size: 13px; font-weight: 600; }
.palette button.ans { background: #e3f6ec; border-color: #9fd9bd; }
.palette button.mark { background: #f1e9ff; border-color: #c9b2f5; }
.palette button.cur { outline: 2px solid var(--accent); }
.score { font-family: var(--font); font-size: 44px; font-weight: 700; letter-spacing: -0.03em; }
.subj { display: grid; grid-template-columns: 110px 1fr 130px; gap: 10px; align-items: center; font-size: 14px; margin: 8px 0; }
.subj.wide { grid-template-columns: 96px 1fr minmax(150px, auto); }

/* ---------- progress ---------- */
.ch { display: grid; grid-template-columns: 1fr 120px 46px; gap: 12px; align-items: center; padding: 9px 0; border-bottom: 1px solid var(--border); font-size: 14.5px; }
.ch:last-child { border-bottom: 0; }
.ch .bar { margin: 0; }
.ch .p { text-align: right; font-variant-numeric: tabular-nums; color: var(--text-3); font-size: 13px; }
.state-unknown .bar > i { background: repeating-linear-gradient(45deg, #d7dbe8 0 4px, #eceef5 4px 8px); width: 100% !important; }
.log li { margin: 6px 0; font-size: 14px; }

/* ---------- pages ---------- */
.bar.grow { margin: 0; }
.concepts { list-style: none; margin: 10px 0 0; padding: 0; }
.concepts li { padding: 9px 0; border-top: 1px solid var(--border); }
.chapter h3 { font-size: 16.5px; }
div.spark { display: grid; grid-template-columns: repeat(7, 1fr); gap: 8px; align-items: end; height: 110px; margin-top: 12px; }
.spark-col { display: flex; flex-direction: column; align-items: center; gap: 6px; height: 100%; justify-content: flex-end; }
.spark-col i { display: block; width: 100%; max-width: 26px; min-height: 3px; border-radius: 6px; background: var(--accent); }
.spark-col span { font-size: 11.5px; color: var(--text-3); }
details.note { border-top: 1px solid var(--border); padding: 10px 0; }
details.note summary { display: flex; justify-content: space-between; gap: 12px; cursor: pointer; font-size: 15px; font-weight: 550; list-style: none; }
details.note summary::-webkit-details-marker { display: none; }
details.note[open] summary { margin-bottom: 8px; }
details.note .rich { font-size: 15px; line-height: 1.6; }
.beat-inline + .beat-inline { margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--border); }
.beat-inline h3 { margin-bottom: 6px; }
.pyqs { margin: 10px 0 14px; padding-left: 1.3em; }
.pyqs li { margin: 8px 0; font-size: 15px; line-height: 1.55; }
.option-card { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 12px 0; border-top: 1px solid var(--border); }
.option-card select { width: auto; max-width: 300px; padding: 8px 10px; font-size: 14px; }
.table { width: 100%; border-collapse: collapse; margin-top: 8px; font-size: 14px; }
.table th { text-align: left; font-weight: 550; color: var(--text-3); font-size: 12.5px; padding: 8px 6px; border-bottom: 1px solid var(--border-strong); }
.table td { padding: 9px 6px; border-bottom: 1px solid var(--border); }
.weeks { list-style: none; margin: 10px 0 0; padding: 0; }
.weeks li { padding: 12px 14px; border-radius: 14px; border: 1px solid var(--border); margin-bottom: 8px; background: var(--bg); }
.weeks li.current { border-color: var(--accent-soft-2); background: #f1f5ff; }
.weeks .row { gap: 8px; }
.chblock .ch { width: 100%; border: 0; background: transparent; text-align: left; font: inherit; color: inherit; cursor: pointer; }
.chblock .concepts { margin: 0 0 8px 12px; }
.alts { display: flex; flex-direction: column; gap: 6px; margin-top: 14px; }
.alt { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 11px 14px; border: 1px solid var(--border-strong); border-radius: 14px; background: var(--bg); font-size: 14.5px; text-align: left; }
.alt:hover { border-color: var(--accent-soft-2); }
@media (max-width: 760px) {
  .option-card { flex-direction: column; align-items: flex-start; }
}

/* ---------- plan ---------- */
.cover { margin-top: 10px; }
.cover-v { font: 650 30px/1.1 var(--font); letter-spacing: -0.02em; }
.cover-v .muted { font: 500 15px var(--font); letter-spacing: 0; }
.cover-bar { position: relative; height: 12px; margin-top: 10px; border-radius: 6px; background: var(--bg-muted); }
.cover-bar > i { position: absolute; inset: 0 auto 0 0; border-radius: 6px; background: var(--accent); min-width: 4px; }
.cover-bar > b { position: absolute; top: -4px; bottom: -4px; width: 2px; margin-left: -1px; border-radius: 1px; background: #c98a12; }
.target { margin-top: 12px; }
.target .bar { margin-top: 6px; }
.cal { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; margin-top: 12px; }
.cal-h { font-size: 12px; font-weight: 600; color: var(--text-3); text-align: center; padding-bottom: 2px; }
.cal-day { position: relative; display: flex; flex-direction: column; align-items: flex-start; gap: 3px; min-height: 84px; padding: 7px 8px; border: 1px solid var(--border); border-radius: 12px; background: var(--bg); text-align: left; overflow: hidden; transition: border-color 0.12s, background 0.12s; }
.cal-day:hover { border-color: var(--accent-soft-2); }
.cal-day.out { opacity: 0.45; }
.cal-day.today { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.cal-day.sel { background: var(--accent-soft); border-color: var(--accent-soft-2); }
.cal-day.past:not(.today) .cal-n { color: var(--text-3); }
.cal-n { font-size: 13px; font-weight: 650; }
.cal-ev { max-width: 100%; padding: 1px 6px; border-radius: 6px; background: #fff1d6; color: #8a5a00; font-size: 10.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cal-plan { font-size: 11px; line-height: 1.3; color: var(--text-2); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.cal-bar { width: 100%; height: 4px; margin-top: auto; border-radius: 2px; background: var(--bg-muted); overflow: hidden; }
.cal-bar i { display: block; height: 100%; background: var(--accent); }
.cal-day.has-missed .cal-bar { background: rgba(212, 80, 74, 0.25); }
.cal-meta { font-size: 10.5px; color: var(--text-3); }
.cal-legend { display: flex; gap: 16px; margin-top: 10px; }
.day-detail { margin-top: 12px; padding: 12px 14px; border-radius: 14px; background: var(--bg); border: 1px solid var(--border); }
.day-detail:empty { display: none; }
.ev-line { display: flex; align-items: center; gap: 8px; margin-top: 6px; font-size: 14px; color: #8a5a00; }
.row.tight.wrap { gap: 6px; }
.cov-list { margin-top: 10px; }
.cov-row { display: flex; align-items: center; gap: 12px; padding: 8px 0; border-top: 1px solid var(--border); font-size: 14.5px; }
.cov-mini { flex: none; width: 90px; height: 6px; border-radius: 3px; background: var(--bg-muted); overflow: hidden; }
.cov-mini i { display: block; height: 100%; background: var(--accent); }
.st-not_started { background: var(--bg-muted); color: var(--text-3); }
.ev-date { flex: none; display: flex; flex-direction: column; align-items: center; justify-content: center; width: 46px; height: 46px; border-radius: 12px; background: #fff7e6; color: #8a5a00; line-height: 1.05; }
.ev-date b { font-size: 17px; }
.ev-date span { font-size: 11px; font-weight: 600; text-transform: uppercase; }
.ev-form { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-top: 12px; }
.ev-form input[type='date'] { width: auto; }
.ev-form input[type='text'] { flex: 1; min-width: 180px; }
.ev-form select { width: auto; }
.ev-form input, .ev-form select { padding: 8px 10px; font-size: 14px; }
details.fold > summary { display: flex; align-items: center; justify-content: space-between; cursor: pointer; list-style: none; }
details.fold > summary::-webkit-details-marker { display: none; }
details.fold > summary .ico { transform: rotate(-90deg); transition: transform 0.2s; color: var(--text-3); }
details.fold[open] > summary .ico { transform: rotate(90deg); }
details.fold[open] > summary { margin-bottom: 8px; }
@media (max-width: 760px) {
  .cal { gap: 3px; }
  .cal-day { min-height: 54px; padding: 5px; border-radius: 9px; }
  .cal-plan, .cal-meta, .cal-ev { display: none; }
  .cal-day.has-event::after { content: ''; position: absolute; top: 6px; right: 6px; width: 6px; height: 6px; border-radius: 50%; background: #e7a31f; }
  .cov-mini { width: 50px; }
}

/* ---------- insights ---------- */
.hbar.best > span:first-child { font-weight: 650; color: var(--accent-text); }
div.spark.trend { height: 140px; grid-template-columns: repeat(auto-fit, minmax(28px, 1fr)); }
.spark.trend .spark-col { border: 0; background: transparent; padding: 0; cursor: pointer; }
.spark.trend em { font-style: normal; font-size: 11px; color: var(--text-3); }
div.spark.wide { grid-template-columns: repeat(14, 1fr); gap: 5px; }
.grid2.flat { gap: 24px; margin: 14px 0; }
.grid2.flat h3 { margin-top: 6px; }

/* ---------- focus ---------- */
.focus-run { text-align: center; }
.ring-wrap { position: relative; width: min(280px, 70vw); aspect-ratio: 1; margin: 14px auto; }
.ring-wrap > .ring { position: absolute; inset: 0; border-radius: 50%; background: conic-gradient(var(--accent) calc(var(--p, 0) * 360deg), var(--bg-muted) 0); -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 14px), #000 calc(100% - 13px)); mask: radial-gradient(farthest-side, transparent calc(100% - 14px), #000 calc(100% - 13px)); }
.ring-t { position: absolute; inset: 0; display: grid; place-items: center; font: 650 clamp(40px, 9vw, 60px)/1 var(--font); font-variant-numeric: tabular-nums; letter-spacing: -0.02em; }
body.focus-mode .rail, body.focus-mode .companion, body.focus-mode .focus-run ~ .card { opacity: 0; pointer-events: none; transition: opacity 0.4s; }
body.focus-mode .bg .blob { animation-play-state: paused; }

/* ---------- flashcards ---------- */
.flash { min-height: 300px; display: flex; flex-direction: column; }
.flash-front { font-size: 19px; line-height: 1.55; margin: 22px 0 6px; }
.flash-back { margin-top: 14px; padding-top: 16px; border-top: 1px dashed var(--border-strong); font-size: 16.5px; line-height: 1.6; }
.grades { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-top: auto; padding-top: 18px; }
.kbd { margin-left: 6px; padding: 1px 6px; border-radius: 5px; background: rgba(127, 127, 160, 0.18); font-size: 11px; font-weight: 600; }
.btn:not(.soft):not(.ghost) .kbd { background: var(--bg); }

/* ---------- formula sheet ---------- */
.formula h3 { margin-bottom: 8px; }
.f-row { padding: 10px 0; border-top: 1px solid var(--border); }
.f-row:first-child { border-top: 0; }
.f-name { font-size: 13px; font-weight: 600; color: var(--accent-text); }
.f-tex .katex-display { margin: 4px 0; text-align: left; }
.f-tex .katex-display > .katex { text-align: left; }

/* ---------- print (weekly report, formula sheets) ---------- */
@media print {
  .rail, .companion, .bg, .no-print, .toast, .stale, .scrim, .page-head .icon-btn { display: none !important; }
  body { background: #fff; }
  .screen { padding: 0; max-width: none; }
  .card { box-shadow: none; border: 1px solid #ddd;  background: #fff; break-inside: avoid; }
}
@media (max-width: 760px) {
  .grades { grid-template-columns: 1fr 1fr; }
}

/* ---------- sign-in ---------- */
.signin { max-width: 460px; margin: 0 auto; }
.signin h1 { margin: 4px 0 6px; }
.signin .why { margin: 0 0 16px; color: var(--text-2); }
.signin input { font-size: 17px; }
body.guardian .rail, body.guardian .companion { display: none; }
body.guardian .screen { padding-top: 40px; }

/* ---------- together ---------- */
.board-t tr.me td { background: rgba(44, 107, 227, 0.06); }
.board-t td:first-child { width: 28px; color: var(--text-3); font-variant-numeric: tabular-nums; }
.board-t tr.cf td { background: var(--bg); }
.board-t select { width: auto; padding: 6px 8px; font-size: 13px; }
.thread { padding: 18px 20px; }
.post .rich { margin-top: 6px; font-size: 15px; line-height: 1.6; }
.post.mochi { padding: 10px 12px; border-radius: 14px; background: rgba(123, 92, 255, 0.07); }
.post-a { margin-top: 6px; gap: 12px; }
.reply { margin: 10px 0 0 16px; padding-left: 12px; border-left: 2px solid var(--border-strong); }
.thread input[type='text'] { padding: 8px 12px; font-size: 14px; }
.duel { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 12px; text-align: center; margin: 10px 0; }
.vs { font-weight: 700; color: var(--text-3); }
.lobby { display: flex; gap: 12px; margin: 14px 0; }
.lobby > div { display: flex; align-items: center; gap: 8px; padding: 10px 14px; border-radius: 14px; border: 1px dashed var(--border-strong); color: var(--text-3); }
.lobby > div.ready { border-style: solid; border-color: rgba(31, 157, 107, 0.4); background: rgba(233, 248, 241, 0.8); color: var(--good-text); }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-top: 12px; }
.metric { display: flex; flex-direction: column; gap: 8px; }
.histo { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 3px; align-items: end; height: 84px; }
.histo-col { display: flex; flex-direction: column; justify-content: flex-end; align-items: center; height: 100%; gap: 3px; }
.histo-col i { display: block; width: 100%; border-radius: 4px 4px 2px 2px; background: rgba(124, 141, 255, 0.35); }
.histo-col.me i { background: var(--accent); }
.histo-col span { font-size: 10px; height: 12px; color: var(--accent-text); font-weight: 600; }
.subjects-cmp { display: flex; flex-wrap: wrap; gap: 6px 20px; margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--border); }
.ranks { list-style: none; margin: 6px 0 0; padding: 0; }
.ranks li { display: flex; justify-content: space-between; padding: 5px 0; border-bottom: 1px solid var(--border); font-size: 14px; }
.ranks li.me { font-weight: 650; color: var(--accent-text); }
.consent { padding: 12px 14px; border-radius: 14px; background: rgba(255, 247, 230, 0.7); border: 1px solid #f1dfae; }
.consent .log { margin: 0; padding-left: 1.2em; }
.weekly h2 { margin: 4px 0 0; }
@media (max-width: 760px) {
  .grid3 { grid-template-columns: 1fr; }
  .board-t th:nth-child(4), .board-t td:nth-child(4), .board-t th:nth-child(6), .board-t td:nth-child(6) { display: none; }
}

/* ---------- resources ---------- */
.res-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 10px; }
.res-card { display: block; padding: 14px 16px; border-radius: var(--r-md); background: var(--bg); border: 1px solid var(--border); color: var(--text); text-decoration: none; transition: border-color 0.15s, transform 0.15s var(--ease); }
a.res-card:hover { border-color: var(--accent-soft-2); transform: translateY(-1px); }
.res-card .ico { color: var(--text-3); transform: rotate(-45deg); }
.res-t td { vertical-align: top; }
.res-t td.res-a { white-space: nowrap; text-align: right; }
.res-t td.res-a .icon-btn { display: inline-grid; width: 32px; height: 32px; }
.books { margin-top: 14px; }
@media (max-width: 760px) {
  .res-grid { grid-template-columns: 1fr; }
  .res-t th:nth-child(3), .res-t td:nth-child(3) { display: none; }
}


/* ---------- doubts (chat) ---------- */
.dbt { display: grid; grid-template-columns: 300px minmax(0, 1fr); height: calc(100vh - var(--top-h)); height: calc(100dvh - var(--top-h)); }
.dbt-side { display: flex; flex-direction: column; min-height: 0; border-right: 1px solid var(--border); background: var(--bg); }
.dbt-side-h { display: flex; align-items: center; gap: 8px; padding: 16px 16px 10px; }
.dbt-filters { display: flex; flex-direction: column; gap: 8px; padding: 0 16px 10px; border-bottom: 1px solid var(--border); }
.dbt-filters .searchbox { min-width: 0; height: 34px; }
.dbt-filters .seg { display: flex; }
.dbt-filters .seg button { flex: 1; }
.dbt-subj { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; }
.dbt-subj .chip { flex: none; }
.dbt-threads { flex: 1; overflow-y: auto; padding: 6px 8px 16px; }
.dbt-glabel { padding: 12px 10px 4px; font-size: 11px; font-weight: 600; color: var(--text-4); text-transform: uppercase; letter-spacing: 0.05em; }
.dbt-item { display: block; width: 100%; padding: 9px 10px; border: 0; border-radius: var(--r-sm); background: transparent; text-align: left; }
.dbt-item:hover { background: var(--bg-hover); }
.dbt-item.active { background: var(--bg-active); }
.dbt-item .ico { color: var(--good); }
.dbt-t { font-size: var(--fs-md); font-weight: 550; color: var(--text); }
.dbt-p { margin-top: 2px; font-size: var(--fs-xs); color: var(--text-3); }
.dbt-main { display: flex; flex-direction: column; min-width: 0; min-height: 0; background: var(--bg); }
.dbt-conv { display: flex; flex-direction: column; min-height: 0; height: 100%; }
.dbt-head { display: flex; align-items: center; gap: 12px; padding: 10px 20px; border-bottom: 1px solid var(--border); }
.dbt-head .xs a { color: var(--text-3); }
.dbt-back { display: none; }
.dbt-msgs { flex: 1; overflow-y: auto; padding: 24px 20px 12px; }
.dbt-col { max-width: 760px; margin: 0 auto; display: flex; flex-direction: column; gap: 22px; }
.dbt-foot { padding: 10px 20px 18px; }
.dbt-foot .composer { max-width: 760px; margin: 0 auto; }
.msg { display: flex; gap: 12px; }
.msg.me { flex-direction: column; align-items: flex-end; gap: 6px; }
.bubble-me { max-width: 78%; padding: 10px 14px; border-radius: 18px 18px 4px 18px; background: var(--bg-muted); color: var(--text); font-size: var(--fs-lg); line-height: 1.5; white-space: pre-wrap; word-wrap: break-word; }
.msg-img { max-width: 260px; max-height: 220px; border-radius: var(--r-md); border: 1px solid var(--border); object-fit: cover; }
.msg.mochi { align-items: flex-start; }
.mochi-mark { display: inline-grid; flex: none; border-radius: 50%; }
.msg-body { flex: 1; min-width: 0; }
.msg-name { font-size: var(--fs-sm); font-weight: 600; margin: 4px 0 4px; }
.msg-body > .rich { font-size: var(--fs-lg); line-height: 1.7; color: var(--text); }
.msg-actions { display: flex; align-items: center; gap: 2px; flex-wrap: wrap; margin-top: 8px; }
.icon-btn.sm { width: 30px; height: 30px; color: var(--text-3); }
.icon-btn.on { color: var(--accent); background: var(--accent-soft); }
.msg-follow { display: flex; gap: 6px; flex-wrap: wrap; margin-left: 8px; }
.msg-follow .chip { height: 30px; font-size: var(--fs-xs); }
.typing { display: inline-flex; gap: 5px; padding: 14px 4px; }
.typing i { width: 7px; height: 7px; border-radius: 50%; background: var(--text-4); animation: dot 1.1s infinite; }
.typing i:nth-child(2) { animation-delay: 0.15s; }
.typing i:nth-child(3) { animation-delay: 0.3s; }
@keyframes dot { 30% { transform: translateY(-4px); opacity: 1; } 0%, 60%, 100% { opacity: 0.4; } }
.dbt-hero { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; max-width: 760px; width: 100%; margin: 0 auto; padding: 32px 20px; text-align: center; }
.dbt-hero h1 { font-size: 28px; margin-top: 10px; }
.dbt-hero > p { max-width: 520px; margin: 0 0 8px; }
.dbt-suggest { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; width: 100%; margin: 10px 0 6px; }
.dbt-sug { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 14px; border: 1px solid var(--border); border-radius: var(--r-md); background: var(--bg); text-align: left; font-size: var(--fs-sm); color: var(--text-2); }
.dbt-sug:hover { border-color: var(--border-strong); background: var(--bg-subtle); color: var(--text); }
.dbt-sug .ico { color: var(--text-4); }
.dbt-hero .composer { width: 100%; text-align: left; }
.composer.compact { padding: 10px 10px 6px 14px; }
.composer.compact textarea { font-size: var(--fs-md); }
.comp-thumbs { display: flex; gap: 8px; }
.comp-thumbs:empty { display: none; }
.comp-thumb { position: relative; margin-bottom: 8px; }
.comp-thumb img { width: 64px; height: 64px; object-fit: cover; border-radius: var(--r-sm); border: 1px solid var(--border); }
.comp-thumb button { position: absolute; top: -6px; right: -6px; width: 20px; height: 20px; border: 1px solid var(--border); border-radius: 50%; background: var(--bg); display: grid; place-items: center; }
.sheet .msg.me { margin-top: 6px; }
.sheet .answer { padding: 14px; border-radius: var(--r-md); background: var(--bg-subtle); border: 1px solid var(--border); font-size: var(--fs-md); line-height: 1.6; }
.thumb { max-width: 120px; max-height: 90px; border-radius: var(--r-sm); border: 1px solid var(--border); margin-top: 8px; }
@media (max-width: 860px) {
  .dbt { grid-template-columns: minmax(0, 1fr); height: calc(100dvh - var(--top-h) - 60px); }
  .dbt.has-thread .dbt-side { display: none; }
  .dbt:not(.has-thread):not(.composing) .dbt-main { display: none; }
  .dbt.composing .dbt-side { display: none; }
  .dbt-back { display: inline-grid; }
  .dbt-suggest { grid-template-columns: 1fr; }
}

/* ------------------------------ dashboard ------------------------------ */
.stat-tile.syl .delta.up { color: var(--good-text); font-weight: 600; }
.stat-tile.syl .delta.down { color: var(--warn-text); font-weight: 600; }
.dash-tl > li { padding-bottom: 4px; }
.dash-tl > li::after { top: 17px; }
.dash-tl > li::before { top: 30px; }
.tl-row { display: flex; align-items: center; gap: 14px; padding: 8px 10px; margin-left: -4px; border-radius: var(--r-sm); }
.dash-tl > li.now .tl-row { background: var(--accent-soft); }
.tl-time { width: 64px; flex: none; font-size: var(--fs-sm); color: var(--text-3); font-weight: 550; }
.tl-title { font-weight: 550; }
.tl-title.done { color: var(--text-3); text-decoration: line-through; text-decoration-color: var(--text-4); }
.rev-cells { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.rev-cell { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; padding: 12px; border: 1px solid var(--border); border-radius: var(--r-md); background: var(--bg); text-align: left; }
.rev-cell:hover { background: var(--bg-subtle); }
.rev-cell b { font-size: 22px; font-weight: 650; color: var(--text-3); }
.rev-cell b.accent-t { color: var(--accent-text); }
.rev-cell b.bad-t { color: var(--bad-text); }
.rev-cell b.good-t { color: var(--good-text); }
.rev-cell span { font-size: var(--fs-xs); color: var(--text-3); }
.subj-table { display: grid; }
.subj-table .st-h, .subj-table .st-r { display: grid; grid-template-columns: 130px minmax(0, 1fr) 84px 60px; gap: 14px; align-items: center; }
.subj-table .st-h { padding: 0 0 8px; font-size: var(--fs-xs); color: var(--text-3); font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; border-bottom: 1px solid var(--border); }
.subj-table .st-r { padding: 14px 0; border: 0; border-bottom: 1px solid var(--border); background: none; text-align: left; font-size: var(--fs-md); color: var(--text); }
.subj-table .st-r:last-child { border-bottom: 0; }
.subj-table .st-r:hover { background: var(--bg-subtle); }
.subj-table .num { text-align: right; }
.act { display: flex; gap: 28px; align-items: center; flex-wrap: wrap; }
.act-heat .heat { grid-template-rows: repeat(7, 17px); gap: 4px; }
.act-heat .heat i { width: 17px; height: 17px; border-radius: 4px; }
.act-kv { display: grid; grid-template-columns: repeat(2, minmax(96px, 1fr)); gap: 14px 24px; flex: 1; min-width: 200px; }
.act-kv > div { display: flex; flex-direction: column; }
.act-kv b { font-size: 22px; font-weight: 650; }
.act-kv span { font-size: var(--fs-xs); color: var(--text-3); }
.lico.sj { font-size: var(--fs-sm); font-weight: 650; font-variant-numeric: tabular-nums; }
.lico.sj.physics { background: var(--physics-soft); color: var(--physics); }
.lico.sj.chemistry { background: var(--chemistry-soft); color: var(--chemistry); }
.lico.sj.maths { background: var(--maths-soft); color: var(--maths); }
.datebox { width: 40px; height: 42px; flex: none; display: flex; flex-direction: column; align-items: center; justify-content: center; border: 1px solid var(--border); border-radius: var(--r-sm); line-height: 1.05; }
.datebox b { font-size: 16px; font-weight: 650; }
.datebox span { font-size: 10px; text-transform: uppercase; color: var(--bad-text); font-weight: 650; letter-spacing: 0.04em; }
.lrow.lb { padding-top: 8px; padding-bottom: 8px; }
.lrow.lb.me { background: var(--accent-soft); }
.lrow .rk { width: 22px; text-align: center; font-weight: 650; color: var(--text-3); flex: none; }
.lrow .rk.r1 { color: #b7791f; }
.lrow .rk.r2 { color: #64748b; }
.lrow .rk.r3 { color: #a0522d; }
.live-dot { display: inline-block; width: 7px; height: 7px; margin-right: 5px; border-radius: 50%; background: var(--good); box-shadow: 0 0 0 3px var(--good-soft); vertical-align: 1px; }
@media (max-width: 767px) {
  .tl-row .btn { display: none; }
  .subj-table .st-h, .subj-table .st-r { grid-template-columns: 100px minmax(0, 1fr) 64px; }
  .subj-table .st-h > :last-child, .subj-table .st-r > :last-child { display: none; }
  .tl-time { width: 54px; }
}
.act-weeks { flex-basis: 100%; margin-top: 4px; }

/* -------------------------------- tests hub ------------------------------- */
.sec-title { font-size: var(--fs-lg); font-weight: 650; margin: 8px 0 -4px; }
.tcard { display: flex; flex-direction: column; gap: 8px; padding: 18px; border: 1px solid var(--border); border-radius: var(--r-lg); background: var(--bg); min-width: 0; }
.tcard h3 { font-size: 16px; font-weight: 650; }
.tcard p { margin: 0; font-size: var(--fs-sm); color: var(--text-2); line-height: 1.5; }
.tcard.feature { background: linear-gradient(180deg, #f5f6ff 0%, var(--bg) 60%); border-color: #dfe1fb; }
.tcard.feature.blue { background: linear-gradient(180deg, #f1f8ff 0%, var(--bg) 60%); border-color: #d9e8fa; }
.tcard.feature h3 { font-size: 19px; }
.tcard.info { background: var(--bg-subtle); }
.tcard-h { display: flex; align-items: center; gap: 10px; justify-content: space-between; }
.tcard-sec { display: flex; gap: 4px; flex-wrap: wrap; }
.tcard-ic { width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center; flex: none; background: var(--accent-soft); color: var(--accent); }
.tcard-ic.sm { width: 30px; height: 30px; border-radius: 8px; }
.tcard-ic.k-full { background: #e0e7ff; color: #4338ca; }
.tcard-ic.k-weekly { background: #dbeafe; color: #1d4ed8; }
.tcard-ic.k-mini { background: var(--physics-soft); color: var(--physics); }
.tcard-ic.k-dpp { background: var(--chemistry-soft); color: #0f8a5f; }
.tcard-ic.k-pyq { background: var(--maths-soft); color: #c2410c; }
.tcard-ic.k-chapter { background: #f3e8ff; color: #7e22ce; }
.tcard-ic.k-duel { background: #fce7f3; color: #be185d; }
.tcard-meta { display: flex; flex-wrap: wrap; gap: 4px 0; font-size: var(--fs-xs); color: var(--text-3); font-weight: 550; }
.tcard-meta span + span::before { content: '·'; margin: 0 6px; color: var(--text-4); }
.tcard-f { margin-top: auto; padding-top: 6px; }
.tcard-pattern { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 4px 0; }
.tcard-pattern > div { padding: 8px 10px; border: 1px solid var(--border); border-radius: var(--r-sm); background: var(--bg); }
.tcard-pattern b { display: block; font-size: var(--fs-sm); }
.tcard-pattern span { font-size: 11px; color: var(--text-3); }
.tcard-state { display: flex; align-items: center; font-size: var(--fs-sm); font-weight: 550; color: var(--text-2); }
.live-dot.off { background: var(--text-4); box-shadow: 0 0 0 3px var(--bg-muted); }
.tcard-prog { display: flex; align-items: center; gap: 10px; }
.tcard-prog .bar { flex: 1; }
.mini-table { width: 100%; border-collapse: collapse; font-size: var(--fs-sm); }
.mini-table th, .mini-table td { padding: 6px 8px; text-align: left; border-bottom: 1px solid var(--border); }
.mini-table th { font-size: var(--fs-xs); color: var(--text-3); font-weight: 600; }
.score-cell { display: inline-flex; flex-direction: column; align-items: flex-end; gap: 4px; min-width: 90px; }
.score-cell .bar { width: 90px; }
@media (max-width: 767px) { .tcard-pattern { grid-template-columns: 1fr; } }

/* ----------------------------- NTA test player ---------------------------- */
body.exam-mode .sidebar, body.exam-mode .topbar, body.exam-mode .tabbar, body.exam-mode #companion, body.exam-mode #mochiPill { display: none !important; }
body.exam-mode .main { margin-left: 0 !important; }
.nta { display: flex; flex-direction: column; height: 100vh; height: 100dvh; background: var(--bg); }
.nta-top { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); align-items: center; gap: 16px; height: 62px; padding: 0 20px; border-bottom: 1px solid var(--border); flex: none; }
.nta-brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.nta-logo { width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center; background: var(--brand-gradient); color: #fff; font-weight: 700; flex: none; }
.nta-subjects { display: flex; gap: 4px; padding: 4px; border-radius: 10px; background: var(--bg-muted); }
.nta-subjects button { display: inline-flex; align-items: center; gap: 7px; height: 34px; padding: 0 14px; border: 0; border-radius: 7px; background: transparent; font-size: var(--fs-sm); font-weight: 600; color: var(--text-2); }
.nta-subjects button[aria-selected='true'] { background: var(--bg); color: var(--text); box-shadow: var(--shadow-xs); }
.nta-subjects .n { font-size: 11px; color: var(--text-3); font-weight: 600; }
.nta-right { display: flex; align-items: center; justify-content: flex-end; gap: 14px; }
.nta-timer { display: flex; flex-direction: column; align-items: flex-end; line-height: 1.1; padding: 4px 12px; border: 1px solid var(--border); border-radius: var(--r-sm); }
.nta-timer span { color: var(--text-3); }
.nta-timer b { font-size: 19px; letter-spacing: 0.02em; }
.nta-timer.low { border-color: var(--bad); background: var(--bad-soft); }
.nta-timer.low b { color: var(--bad-text); }
.nta-cand { display: flex; align-items: center; gap: 8px; }
.nta-saved { color: var(--good-text); }
.nta-saved.off { color: var(--warn-text); }
.nta-pal-btn, .nta-pal-close { display: none !important; }
.nta-body { flex: 1; min-height: 0; display: grid; grid-template-columns: minmax(0, 1fr) 330px; }
.nta-main { display: flex; flex-direction: column; min-height: 0; min-width: 0; }
.nta-q-pane { flex: 1; overflow: auto; padding: 22px 32px 28px; }
.nta-qh { display: flex; align-items: flex-start; gap: 14px; padding-bottom: 14px; margin-bottom: 16px; border-bottom: 1px solid var(--border); }
.nta-qno { font-size: 18px; font-weight: 650; margin-bottom: 2px; }
.nta-marks { display: flex; gap: 8px; padding: 4px 10px; border-radius: 6px; background: var(--bg-subtle); font-size: var(--fs-sm); }
.nta-stem { max-width: 860px; }
.nta-opts { display: grid; gap: 10px; max-width: 860px; }
.nta-opt { display: flex; align-items: center; gap: 12px; width: 100%; padding: 13px 16px; border: 1.5px solid var(--border-strong); border-radius: var(--r-md); background: var(--bg); text-align: left; font-size: 16px; transition: border-color 0.12s, background 0.12s; }
.nta-opt:hover { border-color: #c7caf5; }
.nta-opt b { flex: none; font-size: 14px; color: var(--text-3); }
.nta-opt .radio { width: 18px; height: 18px; flex: none; border-radius: 50%; border: 2px solid var(--border-strong); background: var(--bg); }
.nta-opt[aria-checked='true'] { border-color: var(--accent); background: var(--accent-soft); }
.nta-opt[aria-checked='true'] .radio { border-color: var(--accent); box-shadow: inset 0 0 0 3px var(--bg); background: var(--accent); }
.nta-opt .rich p { margin: 0; }
.nta-num { display: flex; gap: 24px; align-items: flex-start; flex-wrap: wrap; }
.nta-num input { width: 240px; height: 48px; font-size: 20px; font-variant-numeric: tabular-nums; }
.nta-keys { display: grid; grid-template-columns: repeat(3, 58px); gap: 6px; }
.nta-key { height: 40px; border: 1px solid var(--border-strong); border-radius: var(--r-sm); background: var(--bg); font-size: 16px; font-weight: 600; }
.nta-key:hover { background: var(--bg-subtle); }
.nta-key.fn { font-size: var(--fs-sm); color: var(--text-2); }
.nta-key:last-child { grid-column: span 2; }
.nta-hint { display: flex; align-items: center; gap: 6px; min-height: 22px; margin-top: 14px; font-size: var(--fs-sm); color: var(--text-3); }
.nta-hint.warn { color: var(--warn-text); }
.nta-hint.ok { color: var(--good-text); }
.nta-actions { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; padding: 12px 20px; border-top: 1px solid var(--border); background: var(--bg); }
.nta-btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 40px; padding: 0 16px; border: 1px solid var(--border-strong); border-radius: var(--r-sm); background: var(--bg); font-size: 13.5px; font-weight: 600; color: var(--text); white-space: nowrap; }
.nta-btn:hover { background: var(--bg-subtle); }
.nta-btn.save { background: #13803a; border-color: #13803a; color: #fff; }
.nta-btn.save:hover { background: #0f6c31; }
.nta-btn.savemark { background: #d9730d; border-color: #d9730d; color: #fff; }
.nta-btn.savemark:hover { background: #bf650b; }
.nta-btn.mark { background: #6250d6; border-color: #6250d6; color: #fff; }
.nta-btn.mark:hover { background: #5242bd; }
.nta-btn.submit { background: var(--accent); border-color: var(--accent); color: #fff; }
.nta-btn.submit:hover { background: var(--accent-hover); }
.nta-btn.ghost { border-color: transparent; background: transparent; }
.nta-btn.ghost:hover { background: var(--bg-hover); }
.nta-btn.block { width: 100%; }
.nta-chip { display: inline-block; padding: 4px 10px; border-radius: 6px; border: 1px solid var(--border-strong); font-size: var(--fs-xs); font-weight: 650; white-space: nowrap; }
.nta-chip.save { background: #13803a; border-color: #13803a; color: #fff; }
.nta-chip.savemark { background: #d9730d; border-color: #d9730d; color: #fff; }
.nta-chip.mark { background: #6250d6; border-color: #6250d6; color: #fff; }
.nta-side { display: flex; flex-direction: column; gap: 14px; min-height: 0; overflow: auto; padding: 16px; border-left: 1px solid var(--border); background: var(--bg-subtle); }
.nta-side-h { display: flex; align-items: center; }
.nta-side-f { display: flex; flex-direction: column; gap: 6px; margin-top: auto; padding-top: 8px; }
.nta-legend { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 10px; font-size: 12px; color: var(--text-2); }
.nta-legend > div { display: flex; align-items: center; gap: 8px; min-width: 0; }
.nta-legend > div:last-child { grid-column: span 2; }
.nta-legend.big { grid-template-columns: 1fr; font-size: var(--fs-sm); }
.nta-legend.big > div:last-child { grid-column: auto; }
.nta-q { display: inline-grid; place-items: center; position: relative; flex: none; width: 36px; height: 34px; border: 1px solid var(--border-strong); border-radius: 6px; background: var(--bg); color: var(--text-2); font-size: 13px; font-weight: 650; font-variant-numeric: tabular-nums; }
.nta-legend .nta-q { width: 30px; height: 28px; font-size: 12px; }
.nta-q.xs { width: 12px; height: 12px; margin-right: 4px; vertical-align: -1px; }
.nta-q.na { background: #e5484d; border-color: #e5484d; color: #fff; border-radius: 4px 4px 16px 16px; }
.nta-q.an { background: #13803a; border-color: #13803a; color: #fff; border-radius: 16px 16px 4px 4px; }
.nta-q.mk { background: #6250d6; border-color: #6250d6; color: #fff; border-radius: 50%; }
.nta-q.am { background: #6250d6; border-color: #6250d6; color: #fff; border-radius: 50%; }
.nta-q.am::after { content: ''; position: absolute; right: -2px; bottom: -2px; width: 11px; height: 11px; border-radius: 50%; background: #13803a; border: 2px solid var(--bg-subtle); }
.nta-q.xs.am::after { width: 6px; height: 6px; border-width: 1px; }
button.nta-q:hover { filter: brightness(0.95); }
.nta-q.cur { outline: 2px solid var(--text); outline-offset: 2px; }
.nta-psec { display: flex; justify-content: space-between; font-size: var(--fs-xs); font-weight: 650; color: var(--text-2); text-transform: uppercase; letter-spacing: 0.04em; margin-top: 4px; }
.nta-psec span { color: var(--text-3); text-transform: none; letter-spacing: 0; font-weight: 550; }
.nta-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; justify-items: center; }
.nta-rules { margin: 0; padding-left: 20px; display: grid; gap: 8px; font-size: var(--fs-md); line-height: 1.55; color: var(--text-2); }
.nta-agree { display: flex; gap: 10px; align-items: flex-start; font-size: var(--fs-sm); color: var(--text-2); line-height: 1.45; cursor: pointer; }
.nta-agree input { margin-top: 2px; width: 16px; height: 16px; flex: none; accent-color: var(--accent); }
.nta-sum th { font-size: 11.5px; white-space: nowrap; text-transform: none; letter-spacing: 0; padding-left: 8px; padding-right: 8px; }
.nta-sum td { padding-left: 8px; padding-right: 8px; }
.nta-sum td:first-child { white-space: nowrap; font-weight: 550; }
.nta-marking { min-height: 70vh; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; text-align: center; }
@media (max-width: 1023px) {
  .nta-top { grid-template-columns: minmax(0, 1fr) auto; height: auto; padding: 10px 14px; }
  .nta-subjects { grid-column: 1 / -1; grid-row: 2; justify-self: stretch; }
  .nta-subjects button { flex: 1; justify-content: center; padding: 0 8px; }
  .nta-body { grid-template-columns: minmax(0, 1fr); }
  .nta-pal-btn, .nta-pal-close { display: inline-flex !important; }
  .nta-side { position: fixed; z-index: 60; inset: 0 0 0 auto; width: min(340px, 92vw); transform: translateX(100%); transition: transform 0.2s var(--ease); box-shadow: var(--shadow-lg); }
  .nta.pal-open .nta-side { transform: none; }
  .nta-q-pane { padding: 16px; }
  .nta-actions { padding: 10px 12px; }
  .nta-actions .nta-btn { height: 38px; padding: 0 11px; font-size: 12.5px; }
}

/* -------------------------------- analysis -------------------------------- */
.score-hero .sh-top { display: flex; justify-content: space-between; align-items: flex-end; gap: 24px; flex-wrap: wrap; }
.sh-score { font-size: 46px; font-weight: 700; letter-spacing: -0.03em; line-height: 1.05; margin: 4px 0 2px; }
.sh-score span { font-size: 20px; color: var(--text-3); font-weight: 550; letter-spacing: 0; }
.sh-bar { width: min(320px, 100%); display: flex; flex-direction: column; gap: 8px; }
.sh-kpis { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 14px; margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--border); }
.kpi { min-width: 0; }
.qmap-sec + .qmap-sec { margin-top: 12px; }
.qmap { display: grid; grid-template-columns: repeat(auto-fill, minmax(34px, 1fr)); gap: 6px; margin-top: 6px; }
.qm { height: 32px; border: 0; border-radius: 6px; font-size: 12px; font-weight: 650; color: #fff; font-variant-numeric: tabular-nums; }
.qm:hover { filter: brightness(0.92); }
.qm.v-right { background: #0ca30c; }
.qm.v-concept { background: #d03b3b; }
.qm.v-slip { background: #ec835a; }
.qm.v-guess { background: #fab219; color: #4a3500; }
.qm.v-skipped { background: var(--bg-muted); color: var(--text-3); }
.rq { padding: 16px 18px; border: 1px solid var(--border); border-left: 3px solid var(--border-strong); border-radius: var(--r-md); scroll-margin-top: 80px; }
.rq.v-right { border-left-color: #0ca30c; }
.rq.v-concept { border-left-color: #d03b3b; }
.rq.v-slip { border-left-color: #ec835a; }
.rq.v-guess { border-left-color: #fab219; }
.rq-h { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; flex-wrap: wrap; }
.rq-n { font-weight: 700; }
.rq .stem { font-size: 16px; margin-bottom: 12px; }
.rq .opt { padding: 10px 14px; font-size: 15px; }
.rq-sol { margin-top: 12px; }
.rq-sol summary { cursor: pointer; font-weight: 600; font-size: var(--fs-sm); color: var(--accent-text); }
.rq-sol .rich { margin-top: 8px; padding: 12px 14px; border-radius: var(--r-sm); background: var(--bg-subtle); font-size: 15px; }
.rq-f { display: flex; gap: 4px; flex-wrap: wrap; margin-top: 12px; padding-top: 8px; border-top: 1px solid var(--border); }
.panel.debrief { background: linear-gradient(180deg, #f7f7ff 0%, var(--bg) 80%); border-color: #e3e4fb; }
@media (max-width: 1100px) { .sh-kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 767px) { .sh-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); } .sh-score { font-size: 38px; } }
.nta-grid + .nta-psec { margin-top: 12px; }
@media (max-width: 1023px) {
  .nta-brand > div:not(.nta-logo) .row { display: none; }
  .nta-cand { display: none !important; }
}
@media (max-width: 600px) {
  .nta-brand > div:not(.nta-logo) { display: none; }
  .nta-right { gap: 8px; }
  .nta-timer { flex-direction: row; align-items: baseline; gap: 6px; padding: 4px 8px; }
  .nta-timer b { font-size: 16px; }
  .nta-subjects .n { display: none; }
  .nta-actions { flex-direction: column; align-items: stretch; }
  .nta-actions > div:first-child { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
  .nta-actions > div:first-child .nta-btn { white-space: normal; line-height: 1.15; height: 44px; }
  .nta-actions > div:last-child { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 6px; }
  .nta-keys { grid-template-columns: repeat(3, 1fr); width: 100%; }
  .nta-num input { width: 100%; }
}

/* --------------------------------- learn --------------------------------- */
.subj-tabs { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.subj-tab { display: flex; align-items: center; gap: 14px; padding: 14px 16px; border: 1px solid var(--border); border-radius: var(--r-lg); background: var(--bg); text-align: left; transition: border-color 0.12s, box-shadow 0.12s; }
.subj-tab:hover { border-color: var(--border-strong); }
.subj-tab[aria-selected='true'] { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.chcard { position: relative; display: flex; flex-direction: column; gap: 10px; padding: 16px 18px; border: 1px solid var(--border); border-radius: var(--r-lg); background: var(--bg); cursor: pointer; min-width: 0; overflow: hidden; transition: border-color 0.12s, box-shadow 0.12s; }
.chcard::before { content: ''; position: absolute; inset: 0 auto 0 0; width: 3px; background: var(--accent); }
.chcard.s-physics::before { background: var(--physics); }
.chcard.s-chemistry::before { background: var(--chemistry); }
.chcard.s-maths::before { background: var(--maths); }
.chcard:hover, .chcard:focus-visible { border-color: var(--border-strong); box-shadow: var(--shadow-sm); outline: none; }
.chcard h3 { font-size: 16px; font-weight: 650; line-height: 1.3; }
.chcard-prog { display: flex; flex-direction: column; gap: 6px; }
.chcard-stats { display: flex; gap: 14px; flex-wrap: wrap; font-size: var(--fs-xs); color: var(--text-3); }
.chcard-stats span { display: inline-flex; align-items: center; gap: 5px; }
.chcard-f { display: flex; gap: 6px; margin-top: auto; padding-top: 4px; }
.clist .crow { display: grid; grid-template-columns: 28px minmax(0, 1fr) 110px auto; gap: 14px; align-items: center; padding: 12px 18px; }
.clist .crow + .crow { border-top: 1px solid var(--border); }
.crow-n { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; background: var(--bg-muted); font-size: 12px; font-weight: 650; color: var(--text-2); }
.crow-main { min-width: 0; cursor: pointer; display: flex; flex-direction: column; gap: 3px; }
.crow-main:hover .strong { color: var(--accent-text); }
.crow-level .bar { margin-top: 4px; }
.crow-act { display: flex; gap: 6px; }
.lico.nk-theory { background: var(--physics-soft); color: var(--physics); }
.lico.nk-example { background: var(--accent-soft); color: var(--accent); }
.lico.nk-reference { background: var(--maths-soft); color: #c2410c; }
.pyq-card { padding: 14px 16px; border: 1px solid var(--border); border-radius: var(--r-md); display: flex; flex-direction: column; gap: 8px; }
.pyq-card .rich { font-size: 15px; }
.pyq-opts { margin: 0; padding-left: 22px; display: grid; grid-template-columns: 1fr 1fr; gap: 4px 20px; font-size: var(--fs-md); color: var(--text-2); }
.pyq-opts li p { margin: 0; }
.beats { display: flex; flex-direction: column; }
.beats .beat-inline { display: flex; gap: 14px; }
.beat-n { width: 28px; height: 28px; flex: none; border-radius: 50%; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent-text); font-weight: 650; font-size: 13px; margin-top: 2px; }
.sib-list { display: flex; flex-direction: column; max-height: 360px; overflow: auto; }
.sib { display: flex; align-items: center; gap: 10px; padding: 8px 18px; border: 0; background: none; text-align: left; font-size: var(--fs-sm); color: var(--text-2); }
.sib:hover { background: var(--bg-subtle); }
.sib.on { background: var(--accent-soft); color: var(--accent-text); font-weight: 600; }
.sib .tnum { width: 18px; color: var(--text-3); font-size: 12px; }
.note-read { display: flex; flex-direction: column; gap: 10px; max-width: 640px; }
.note-read h2 { font-size: 22px; font-weight: 650; }
.note-read > .rich { font-size: 16px; line-height: 1.7; margin-top: 8px; }
.note-nav { display: flex; justify-content: space-between; gap: 12px; margin-top: 24px; padding-top: 16px; border-top: 1px solid var(--border); }
.note-nav .btn { max-width: 48%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: inline-block; }
@media (max-width: 767px) {
  .subj-tabs { grid-template-columns: 1fr; }
  .clist .crow { grid-template-columns: 28px minmax(0, 1fr); }
  .crow-level { display: none; }
  .crow-act { grid-column: 2; }
  .pyq-opts { grid-template-columns: 1fr; }
}
.subj-tab .ring .rt b { font-size: 12px; }

/* ------------------------------ practice bank ----------------------------- */
.quick { display: flex; align-items: center; gap: 12px; padding: 14px 16px; border: 1px solid var(--border); border-radius: var(--r-lg); background: var(--bg); min-width: 0; color: var(--text); }
.quick:hover { border-color: var(--border-strong); box-shadow: var(--shadow-xs); }
.quick .lico { width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center; flex: none; }
.g-filter { grid-template-columns: 290px minmax(0, 1fr); align-items: start; }
.bank-filters { position: sticky; top: calc(var(--top-h) + 16px); }
.bf-group { display: flex; flex-direction: column; gap: 8px; }
.bf-t { font-size: var(--fs-xs); font-weight: 650; color: var(--text-3); text-transform: uppercase; letter-spacing: 0.04em; }
.bank-filters .seg { display: flex; flex-wrap: wrap; }
.bank-filters .seg button { flex: 1; }
.bank-filters .chip { height: 30px; padding: 0 10px; font-size: var(--fs-xs); }
.bank-head { display: flex; align-items: center; gap: 12px; padding: 14px 16px; margin-bottom: 12px; border: 1px solid var(--border); border-radius: var(--r-lg); background: var(--bg-subtle); position: sticky; top: calc(var(--top-h) + 8px); z-index: 5; }
.bank-list { display: flex; flex-direction: column; }
.bank-row { display: flex; align-items: center; gap: 14px; padding: 10px 18px; cursor: pointer; }
.bank-row + .bank-row { border-top: 1px solid var(--border); }
.bank-row:hover { background: var(--bg-subtle); }
.bank-row.on { background: var(--accent-soft); }
.bank-row input { width: 16px; height: 16px; accent-color: var(--accent); flex: none; }
.bank-bar { width: 120px; flex: none; }
.bank-n { width: 40px; text-align: right; font-size: var(--fs-sm); }
@media (max-width: 1023px) { .g-filter { grid-template-columns: minmax(0, 1fr); } .bank-filters { position: static; } }
@media (max-width: 767px) { .bank-bar { display: none; } .bank-head { flex-wrap: wrap; } }
.bank-filters .seg { flex-wrap: nowrap; }
.bank-filters .seg button { padding: 0 6px; font-size: 12.5px; }
.quick .strong { white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.prac-grid { align-items: start; }
.prac-side { position: sticky; top: calc(var(--top-h) + 16px); }
.prac-dots { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.prac-dots i { width: 22px; height: 8px; border-radius: 4px; background: var(--bg-muted); }
.prac-dots i.ok { background: var(--good); }
.prac-dots i.no { background: var(--bad); }
.prac-dots i.cur { background: var(--accent); }
.prac-clock { display: flex; align-items: center; gap: 8px; margin: 12px 0 4px; padding-top: 12px; border-top: 1px solid var(--border); color: var(--text-2); }
.prac-clock b { font-size: 16px; }
.prac-clock b.slow { color: var(--warn-text); }
@media (max-width: 1023px) { .prac-side { position: static; } }

/* --------------------------------- library -------------------------------- */
.bcover { position: relative; width: 132px; height: 176px; flex: none; display: flex; flex-direction: column; justify-content: space-between; padding: 12px; border-radius: 6px 10px 10px 6px; color: #fff; overflow: hidden; box-shadow: inset 6px 0 0 rgba(0, 0, 0, 0.12), 0 1px 2px rgba(15, 23, 42, 0.12), 0 6px 16px -8px rgba(15, 23, 42, 0.35); background: linear-gradient(160deg, #6366f1, #4338ca); }
.bcover::after { content: ''; position: absolute; right: -30px; bottom: -30px; width: 120px; height: 120px; border-radius: 50%; border: 18px solid rgba(255, 255, 255, 0.09); }
.bcover.c-physics { background: linear-gradient(160deg, #3b8be6, #1d4f9c); }
.bcover.c-chemistry { background: linear-gradient(160deg, #22b989, #0c6e50); }
.bcover.c-maths { background: linear-gradient(160deg, #f08043, #b8461b); }
.bcover.k-paper { background: linear-gradient(160deg, #334155, #0f172a); }
.bcover.k-paper.c-physics { background: linear-gradient(160deg, #1e3a5f, #0f172a); }
.bcover.k-paper.c-chemistry { background: linear-gradient(160deg, #134e3a, #0f172a); }
.bcover.k-paper.c-maths { background: linear-gradient(160deg, #5b2a12, #0f172a); }
.bcover-top { display: flex; justify-content: space-between; font-size: 9.5px; font-weight: 700; letter-spacing: 0.08em; opacity: 0.85; }
.bcover-glyph { font-size: 40px; font-weight: 700; line-height: 1; opacity: 0.95; font-family: Georgia, 'Times New Roman', serif; }
.bcover.k-paper .bcover-glyph { font-family: var(--font); font-size: 30px; letter-spacing: -0.02em; }
.bcover-t { position: relative; z-index: 1; font-size: 12.5px; font-weight: 650; line-height: 1.25; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.bcover.sm { width: 88px; height: 118px; padding: 9px; }
.bcover.sm .bcover-glyph { font-size: 28px; }
.bcover.sm.k-paper .bcover-glyph { font-size: 20px; }
.bcover.sm .bcover-t { font-size: 10.5px; }
.bcover.sm .bcover-top { font-size: 8px; }
.bcover.lg { width: 150px; height: 200px; }
.shelf-h { display: flex; align-items: flex-end; gap: 12px; margin-bottom: 12px; }
.shelf-h h3 { font-size: var(--fs-lg); font-weight: 650; }
.shelf-row { display: flex; gap: 18px; overflow-x: auto; padding: 4px 2px 12px; scrollbar-width: thin; }
.shelf-item { display: flex; flex-direction: column; gap: 6px; width: 132px; flex: none; border: 0; padding: 0; background: none; text-align: left; }
.shelf-item:hover .bcover { transform: translateY(-2px); }
.shelf-item .bcover { transition: transform 0.15s var(--ease); }
.lib-stat { display: flex; align-items: center; gap: 14px; padding: 16px; border: 1px solid var(--border); border-radius: var(--r-lg); background: var(--bg); color: var(--text); }
.lib-stat:hover { border-color: var(--border-strong); box-shadow: var(--shadow-xs); }
.lib-stat .lico { width: 42px; height: 42px; border-radius: 10px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); flex: none; }
.off-grid { gap: 0; }
.off-link { display: flex; gap: 12px; padding: 14px 18px; color: var(--text); border-top: 1px solid var(--border); }
.off-link:nth-child(-n + 2) { border-top: 0; }
a.off-link:hover { background: var(--bg-subtle); text-decoration: none; }
.book-pick { display: flex; align-items: center; gap: 8px; width: 100%; padding: 8px 10px; border: 0; border-radius: var(--r-sm); background: none; text-align: left; font-size: var(--fs-sm); color: var(--text-2); }
.book-pick:hover { background: var(--bg-subtle); }
.book-pick.on { background: var(--accent-soft); color: var(--accent-text); font-weight: 600; }
.book-hero h2 { font-size: 22px; font-weight: 650; }
.paper, .ref-book { display: flex; gap: 14px; padding: 14px; border: 1px solid var(--border); border-radius: var(--r-md); background: var(--bg); min-width: 0; }
.note-card { display: flex; flex-direction: column; gap: 8px; min-height: 170px; padding: 14px 16px; border: 1px solid var(--border); border-radius: var(--r-lg); background: var(--bg); text-align: left; color: var(--text); border-top: 3px solid var(--border-strong); }
.note-card.s-physics { border-top-color: var(--physics); }
.note-card.s-chemistry { border-top-color: var(--chemistry); }
.note-card.s-maths { border-top-color: var(--maths); }
.note-card:hover { box-shadow: var(--shadow-sm); border-color: var(--border-strong); }
.note-ex { margin: 0; font-size: var(--fs-sm); color: var(--text-2); line-height: 1.5; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.note-ex p { margin: 0; display: inline; }
.sheet-grid { gap: 0; }
.sheet-item { display: flex; align-items: center; gap: 12px; padding: 12px 18px; border: 0; border-top: 1px solid var(--border); background: none; color: var(--text); }
.sheet-item:hover { background: var(--bg-subtle); }
@media (max-width: 767px) { .book-hero .bcover { display: none; } .off-link:nth-child(2) { border-top: 1px solid var(--border); } }

/* ------------------------- revision, flashcards, focus ------------------------ */
.tile-link { text-align: left; cursor: pointer; }
.tile-link:hover { border-color: var(--border-strong); box-shadow: var(--shadow-xs); }
.recall-row { display: flex; align-items: center; gap: 12px; padding: 10px 18px; cursor: pointer; }
.recall-row + .recall-row { border-top: 1px solid var(--border); }
.recall-row:hover { background: var(--bg-subtle); }
.recall-row .mem { width: 120px; flex: none; }
.recall-row .mem .bar { margin-top: 4px; }
.due-tag { flex: none; min-width: 74px; text-align: right; font-size: var(--fs-xs); color: var(--text-3); font-weight: 600; }
.due-tag.now { color: var(--accent-text); }
.mk-card { display: flex; flex-direction: column; gap: 10px; padding: 14px 16px; border: 1px solid var(--border); border-left: 3px solid var(--bad); border-radius: var(--r-md); }
.mk-card.fixed { border-left-color: var(--good); }
.mk-stem { font-size: 15.5px; }
.mk-card .opt { padding: 9px 12px; font-size: 15px; }
.deck { position: relative; display: flex; flex-direction: column; gap: 8px; min-height: 172px; padding: 16px 18px; border: 1px solid var(--border); border-radius: var(--r-lg); background: var(--bg); margin-top: 8px; }
.deck h3 { font-size: 16px; font-weight: 650; }
.deck-stack { position: absolute; inset: -8px 14px auto; height: 10px; pointer-events: none; }
.deck-stack i { position: absolute; left: 0; right: 0; height: 100%; border: 1px solid var(--border); border-bottom: 0; border-radius: 10px 10px 0 0; background: var(--bg); }
.deck-stack i:nth-child(1) { top: 0; left: 16px; right: 16px; }
.deck-stack i:nth-child(2) { top: 4px; left: 8px; right: 8px; }
.deck-stack i:nth-child(3) { display: none; }
.deck.s-physics { border-top: 3px solid var(--physics); }
.deck.s-chemistry { border-top: 3px solid var(--chemistry); }
.deck.s-maths { border-top: 3px solid var(--maths); }
.flip-top { display: flex; align-items: center; gap: 14px; max-width: 760px; margin: 0 auto 18px; }
.flip-wrap { max-width: 760px; margin: 0 auto; }
.fc-flip { position: relative; height: 380px; perspective: 1400px; cursor: pointer; outline: none; }
.flip-face { position: absolute; inset: 0; display: flex; flex-direction: column; gap: 14px; padding: 24px 28px; border: 1px solid var(--border); border-radius: 16px; background: var(--bg); box-shadow: var(--shadow-md); backface-visibility: hidden; transition: transform 0.45s var(--ease); }
.flip-face.back { transform: rotateY(180deg); background: linear-gradient(180deg, #f7f7ff, var(--bg) 70%); }
.fc-flip.on .flip-face.front { transform: rotateY(-180deg); }
.fc-flip.on .flip-face.back { transform: rotateY(0); }
.flip-body { flex: 1; overflow: auto; display: flex; flex-direction: column; justify-content: center; font-size: 19px; line-height: 1.55; text-align: center; }
.flip-face.back .flip-body { font-size: 17px; }
.fc-flip:focus-visible .flip-face { box-shadow: 0 0 0 3px var(--accent-soft-2), var(--shadow-md); }
.grades2 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-top: 16px; opacity: 0; pointer-events: none; transform: translateY(6px); transition: opacity 0.2s, transform 0.2s; }
.grades2.on { opacity: 1; pointer-events: auto; transform: none; }
.grade { position: relative; display: flex; flex-direction: column; align-items: flex-start; gap: 2px; padding: 10px 12px; border: 1px solid var(--border-strong); border-radius: var(--r-md); background: var(--bg); text-align: left; }
.grade b { font-size: var(--fs-md); }
.grade span { font-size: var(--fs-xs); color: var(--text-3); }
.grade kbd { position: absolute; top: 8px; right: 8px; }
.grade.g-again { border-color: #f3b4b4; }
.grade.g-again:hover { background: var(--bad-soft); }
.grade.g-hard:hover { background: var(--warn-soft); }
.grade.g-good { border-color: var(--accent-soft-2); background: var(--accent-soft); }
.grade.g-good:hover { background: #e6e7ff; }
.grade.g-easy:hover { background: var(--good-soft); }
.focus-presets { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.preset { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; padding: 14px 16px; border: 1px solid var(--border-strong); border-radius: var(--r-md); background: var(--bg); text-align: left; }
.preset b { font-size: 26px; font-weight: 650; line-height: 1; }
.preset span { font-size: var(--fs-xs); color: var(--text-3); }
.preset.on { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.focus-run .ring-wrap { width: min(300px, 70vw); }
@media (max-width: 767px) {
  .recall-row .mem { display: none; }
  .grades2 { grid-template-columns: repeat(2, 1fr); }
  .fc-flip { height: 320px; }
  .focus-presets { grid-template-columns: 1fr; }
}
.quick.next { align-items: flex-start; }
.quick.next .xs { white-space: normal; }
.subj-cmp .sc-row { display: flex; flex-direction: column; gap: 8px; padding: 12px 18px; }
.subj-cmp .sc-row + .sc-row { border-top: 1px solid var(--border); }
.subj-cmp .hbars { gap: 6px; }

/* -------------------------------- progress -------------------------------- */
.hm-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(132px, 1fr)); gap: 6px; }
.hm-tile { position: relative; display: flex; flex-direction: column; justify-content: space-between; gap: 8px; min-height: 76px; padding: 9px 10px 12px; border: 1px solid transparent; border-radius: var(--r-sm); text-align: left; overflow: hidden; color: var(--text); background: var(--seq-0); }
.hm-tile.l0 { background: var(--bg-muted); color: var(--text-3); }
.hm-tile.l1 { background: var(--seq-1); }
.hm-tile.l2 { background: var(--seq-2); }
.hm-tile.l3 { background: var(--seq-3); color: #fff; }
.hm-tile.l4 { background: var(--seq-4); color: #fff; }
.hm-tile:hover { filter: brightness(0.96); }
.hm-tile.on { outline: 2px solid var(--text); outline-offset: 1px; }
.hm-name { font-size: 12.5px; font-weight: 600; line-height: 1.25; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.hm-foot { display: flex; justify-content: space-between; align-items: baseline; font-size: 11px; opacity: 0.85; }
.hm-foot b { font-size: 14px; }
.hm-cov { position: absolute; left: 0; bottom: 0; height: 3px; background: rgba(15, 23, 42, 0.35); }
.hm-tile.l3 .hm-cov, .hm-tile.l4 .hm-cov { background: rgba(255, 255, 255, 0.6); }
.hm-legend { display: flex; flex-wrap: wrap; gap: 10px; font-size: var(--fs-xs); color: var(--text-3); }
.hm-legend span { display: inline-flex; align-items: center; gap: 5px; }
.hm-legend i { width: 12px; height: 12px; border-radius: 3px; background: var(--bg-muted); }
.hm-legend i.l1 { background: var(--seq-1); }
.hm-legend i.l2 { background: var(--seq-2); }
.hm-legend i.l3 { background: var(--seq-3); }
.hm-legend i.l4 { background: var(--seq-4); }
.pc-row { display: flex; align-items: center; gap: 12px; width: 100%; padding: 10px 18px; border: 0; background: none; color: var(--text); }
.pc-row + .pc-row { border-top: 1px solid var(--border); }
.pc-row:hover { background: var(--bg-subtle); }
.feed-row { display: flex; align-items: center; gap: 10px; padding: 8px 18px; }
.feed-row + .feed-row { border-top: 1px solid var(--border); }
.feed-ic { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; flex: none; }
.feed-ic.ok { background: var(--good-soft); color: var(--good-text); }
.feed-ic.no { background: var(--bad-soft); color: var(--bad-text); }
.sc-card + .sc-card { padding-top: 14px; border-top: 1px solid var(--border); }
.sc-nums { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin-top: 8px; }

/* ---------------------------------- plan ---------------------------------- */
.wk { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 8px; }
.wk-day { display: flex; flex-direction: column; gap: 5px; min-height: 150px; padding: 8px; border: 1px solid var(--border); border-radius: var(--r-md); background: var(--bg); min-width: 0; }
.wk-day.past { background: var(--bg-subtle); }
.wk-day.today { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.wk-h { display: flex; align-items: baseline; gap: 6px; padding-bottom: 4px; border-bottom: 1px solid var(--border); font-size: var(--fs-xs); color: var(--text-3); font-weight: 600; }
.wk-h b { font-size: 16px; color: var(--text); }
.wk-h .xs { margin-left: auto; }
.wk-item { display: flex; align-items: center; gap: 4px; width: 100%; padding: 4px 6px; border: 0; border-left: 3px solid var(--accent); border-radius: 4px; background: var(--accent-soft); font-size: 11.5px; text-align: left; color: var(--text); }
.wk-item .clip { flex: 1; min-width: 0; }
.wk-item.k-lesson { border-left-color: var(--physics); background: var(--physics-soft); }
.wk-item.k-review, .wk-item.k-cards { border-left-color: var(--chemistry); background: var(--chemistry-soft); }
.wk-item.k-feedback { border-left-color: var(--bad); background: var(--bad-soft); }
.wk-item.k-mock, .wk-item.k-dpp { border-left-color: var(--maths); background: var(--maths-soft); }
.wk-item.ok { opacity: 0.6; text-decoration: line-through; text-decoration-color: var(--text-4); }
.wk-item.no { opacity: 0.55; border-left-style: dashed; }
.wk-plan { padding: 4px 6px; border: 1px dashed var(--border-strong); border-radius: 4px; font-size: 11.5px; color: var(--text-2); }
.wk-ev { display: flex; align-items: center; gap: 4px; padding: 3px 6px; border-radius: 4px; background: var(--warn-soft); color: var(--warn-text); font-size: 11px; font-weight: 600; }
@media (max-width: 1023px) { .wk { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* --------------------------------- groups --------------------------------- */
.grp-card { display: flex; flex-direction: column; gap: 10px; padding: 16px 18px; border: 1px solid var(--border); border-radius: var(--r-lg); background: var(--bg); text-align: left; color: var(--text); }
.grp-card:hover { border-color: var(--border-strong); box-shadow: var(--shadow-sm); }
.grp-card h3 { font-size: 16px; font-weight: 650; }
.grp-card .lico { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); }
.grp-open { display: inline-flex; align-items: center; gap: 4px; margin-top: auto; font-size: var(--fs-sm); font-weight: 600; color: var(--accent-text); }
.podium { display: grid; grid-template-columns: repeat(3, minmax(0, 180px)); justify-content: center; align-items: end; gap: 14px; padding: 18px 0 0; }
.pod { display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center; min-width: 0; }
.pod-av { position: relative; }
.pod .avatar.lg { width: 56px; height: 56px; font-size: 18px; box-shadow: 0 0 0 3px var(--bg), 0 0 0 5px var(--border); }
.pod.p1 .avatar.lg { width: 68px; height: 68px; font-size: 21px; box-shadow: 0 0 0 3px var(--bg), 0 0 0 5px #e9b949; }
.pod.p2 .avatar.lg { box-shadow: 0 0 0 3px var(--bg), 0 0 0 5px #b8c2cf; }
.pod.p3 .avatar.lg { box-shadow: 0 0 0 3px var(--bg), 0 0 0 5px #c98a5b; }
.medal { position: absolute; right: -6px; bottom: -4px; width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; font-size: 11px; font-weight: 700; color: #fff; background: #94a3b8; border: 2px solid var(--bg); }
.pod.p1 .medal { background: #d4a017; }
.pod.p3 .medal { background: #b06a3b; }
.pod-base { width: 100%; display: grid; place-items: center; margin-top: 6px; border-radius: 10px 10px 0 0; background: var(--bg-muted); color: var(--text-3); font-weight: 700; font-size: var(--fs-sm); }
.pod.p1 .pod-base { height: 86px; background: linear-gradient(180deg, #fff4d6, #fbe7b0); color: #8a6100; }
.pod.p2 .pod-base { height: 62px; background: linear-gradient(180deg, #eef2f6, #dfe5ec); }
.pod.p3 .pod-base { height: 46px; background: linear-gradient(180deg, #fbeee4, #f2d9c6); color: #8a4b22; }
.pod.me .strong { color: var(--accent-text); }
.board-t tr.me td { background: var(--accent-soft); }
.board-t .rk { display: inline-block; width: 22px; text-align: center; font-weight: 650; color: var(--text-3); }
.board-t .rk.r1 { color: #b7791f; }
.board-t .rk.r2 { color: #64748b; }
.board-t .rk.r3 { color: #a0522d; }

/* ------------------------------- challenges ------------------------------- */
.duel-row { display: flex; align-items: center; gap: 12px; width: 100%; padding: 12px 18px; border: 0; background: none; color: var(--text); }
.duel-row + .duel-row { border-top: 1px solid var(--border); }
.duel-row:hover { background: var(--bg-subtle); }
.versus { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 18px; padding: 18px 8px 22px; margin-bottom: 14px; border-bottom: 1px solid var(--border); }
.vs-side { display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center; min-width: 0; }
.vs-side .avatar.lg { width: 64px; height: 64px; font-size: 20px; }
.vs-side.win .avatar.lg { box-shadow: 0 0 0 3px var(--bg), 0 0 0 5px var(--good); }
.vs-score { font-size: 34px; font-weight: 700; letter-spacing: -0.02em; line-height: 1; }
.vs-mid { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.vs-mid span { width: 52px; height: 52px; border-radius: 50%; display: grid; place-items: center; font-weight: 800; color: #fff; background: var(--brand-gradient); box-shadow: var(--brand-glow); }

/* -------------------------------- standings ------------------------------- */
.weekly2 { background: linear-gradient(180deg, #f3f6ff, var(--bg) 70%); border-color: #dfe4fb; }
.weekly2 h2 { font-size: 22px; font-weight: 650; }
.metric2 { display: flex; flex-direction: column; gap: 8px; padding: 14px; border: 1px solid var(--border); border-radius: var(--r-md); min-width: 0; }
.m-you { font-size: 24px; font-weight: 650; }
.subj-band { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.sb-cell { padding: 10px 12px; border-radius: var(--r-sm); background: var(--bg-subtle); display: flex; flex-direction: column; gap: 4px; }
.weekly2 .ranks { list-style: none; margin: 6px 0 0; padding: 0; display: grid; gap: 2px; }
.weekly2 .ranks li { display: flex; justify-content: space-between; padding: 4px 8px; border-radius: 6px; font-size: var(--fs-sm); }
.weekly2 .ranks li.me { background: var(--accent-soft); font-weight: 600; }
@media (max-width: 767px) { .subj-band { grid-template-columns: 1fr; } }

/* -------------------------------- settings -------------------------------- */
.set-layout { display: grid; grid-template-columns: 230px minmax(0, 1fr); gap: 24px; align-items: start; }
.set-nav { position: sticky; top: calc(var(--top-h) + 16px); display: flex; flex-direction: column; gap: 2px; }
.set-nav a { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: var(--r-sm); color: var(--text-2); font-size: var(--fs-md); font-weight: 550; }
.set-nav a:hover { background: var(--bg-hover); text-decoration: none; }
.set-nav a.on { background: var(--bg-active); color: var(--text); }
.set-save { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border: 1px solid var(--border); border-radius: var(--r-lg); background: var(--bg-subtle); position: sticky; bottom: 16px; z-index: 5; }
.setting input[type='time'], .setting input[type='number'], .setting input[type='date'], .setting select { width: auto; }
.setting input[type='number'] { width: 90px; }
@media (max-width: 767px) { .set-layout { grid-template-columns: minmax(0, 1fr); } .set-nav { position: static; flex-direction: row; overflow-x: auto; } .set-nav a { white-space: nowrap; } }
.panel-b.flush > div > .setting, .panel-b.flush > .setting { padding-left: 18px; padding-right: 18px; }
.setting select { max-width: 220px; }

/* --------------------------------- sign-in -------------------------------- */
body.no-shell .companion.home { left: 50%; }
body.signin-mode .screen { max-width: none; padding: 0; }
.signin-split { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); min-height: 100vh; min-height: 100dvh; }
.signin-brand { display: flex; flex-direction: column; gap: 18px; padding: 32px 48px 48px; background: radial-gradient(60% 50% at 50% 38%, rgba(123, 92, 255, 0.10), transparent 70%), var(--bg-subtle); border-right: 1px solid var(--border); }
.signin-stage { height: calc(var(--av) + 20px); }
.signin-brand h2 { font-size: 28px; font-weight: 700; letter-spacing: -0.02em; }
.signin-points { display: flex; flex-direction: column; gap: 16px; max-width: 460px; }
.signin-points .lico { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; background: var(--bg); border: 1px solid var(--border); color: var(--accent); flex: none; }
.signin-form { display: grid; place-items: center; padding: 32px; }
.signin-form .signin { width: min(440px, 100%); box-shadow: var(--shadow-md); }
.signin-provider { height: 42px; }
.google-mark { display: grid; place-items: center; width: 20px; height: 20px; border-radius: 50%; color: #4285f4; background: #fff; font-size: 16px; font-weight: 750; line-height: 1; }
.signin-or { display: flex; align-items: center; gap: 12px; margin: 14px 0; color: var(--text-4); font-size: var(--fs-xs); text-transform: uppercase; letter-spacing: 0.04em; }
.signin-or::before, .signin-or::after { content: ''; flex: 1; height: 1px; background: var(--border); }
body.signin-mode .companion.home { left: 25%; top: 72px; }
body.signin-mode .companion.home .bubble { left: 86%; }
@media (max-width: 900px) {
  .signin-split { grid-template-columns: 1fr; }
  .signin-brand { padding: 20px 20px 8px; border-right: 0; }
  .signin-brand h2, .signin-points { display: none; }
  body.signin-mode .companion.home { left: 50%; top: 56px; }
  body.signin-mode .companion.home .bubble { left: 50%; }
}

/* ---------------------------- guardian and report --------------------------- */
.g-wrap { max-width: 980px; margin: 0 auto; padding: 28px 24px 60px; display: flex; flex-direction: column; gap: 16px; }
.g-head { display: flex; align-items: center; gap: 12px; padding-bottom: 14px; border-bottom: 1px solid var(--border); }
.consent2 { padding: 14px 16px; border: 1px solid var(--border); border-radius: var(--r-md); background: var(--bg-subtle); }
.consent2 ul { margin: 8px 0; padding-left: 20px; font-size: var(--fs-sm); line-height: 1.6; }
.g-details summary { cursor: pointer; font-size: var(--fs-sm); font-weight: 600; color: var(--accent-text); margin-bottom: 8px; }
.rcard { max-width: 860px; margin: 0 auto; padding: 28px 32px; border: 1px solid var(--border); border-radius: var(--r-lg); background: var(--bg); display: flex; flex-direction: column; gap: 18px; box-shadow: var(--shadow-sm); }
.rc-head { display: flex; align-items: center; gap: 12px; padding-bottom: 16px; border-bottom: 2px solid var(--text); }
.rc-week { text-align: right; }
.rc-note { margin: 0; font-size: 16px; line-height: 1.6; }
.rc-grid { display: grid; grid-template-columns: repeat(4, 1fr); border: 1px solid var(--border); border-radius: var(--r-md); overflow: hidden; }
.rc-grid > div { padding: 14px 16px; display: flex; flex-direction: column; gap: 2px; }
.rc-grid > div + div { border-left: 1px solid var(--border); }
.rc-grid b { font-size: 24px; font-weight: 650; }
.rc-table { width: 100%; border-collapse: collapse; font-size: var(--fs-md); }
.rc-table th { width: 140px; text-align: left; padding: 10px 0; color: var(--text-3); font-weight: 600; vertical-align: top; }
.rc-table td { padding: 10px 0; }
.rc-table tr + tr th, .rc-table tr + tr td { border-top: 1px solid var(--border); }
@media (max-width: 767px) { .rc-grid { grid-template-columns: repeat(2, 1fr); } .rc-grid > div:nth-child(3) { border-left: 0; } .rcard { padding: 20px; } }
@media print { .rcard { box-shadow: none; border: 0; padding: 0; } }

/* -------------------------------- onboarding ------------------------------- */
.ob-wrap { max-width: 640px; margin: -8px auto 0; display: flex; flex-direction: column; gap: 16px; }
.ob-steps { list-style: none; margin: 0; padding: 0; display: flex; justify-content: space-between; gap: 4px; }
.ob-steps li { display: flex; flex-direction: column; align-items: center; gap: 4px; flex: 1; min-width: 0; position: relative; }
.ob-steps li + li::before { content: ''; position: absolute; top: 11px; right: 50%; width: 100%; height: 2px; background: var(--border); z-index: 0; }
.ob-steps li.done + li::before, .ob-steps li.done::before, .ob-steps li.cur::before { background: var(--accent); }
.ob-dot { position: relative; z-index: 1; width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; font-size: 11px; font-weight: 700; background: var(--bg); border: 2px solid var(--border-strong); color: var(--text-3); }
.ob-steps li.done .ob-dot { background: var(--accent); border-color: var(--accent); color: #fff; }
.ob-steps li.cur .ob-dot { border-color: var(--accent); color: var(--accent-text); box-shadow: 0 0 0 4px var(--accent-soft); }
.ob-l { font-size: 10.5px; color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.ob-steps li.cur .ob-l { color: var(--text); font-weight: 600; }
.ob-card { padding: 24px 26px; box-shadow: var(--shadow-md); }
.ob-card h2 { font-size: 22px; font-weight: 650; }
.ob-card input[type='text'] { flex: 1; min-width: 200px; font-size: 17px; }
.ob-opts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; width: 100%; }
.ob-opt { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 14px 16px; border: 1px solid var(--border-strong); border-radius: var(--r-md); background: var(--bg); font-size: var(--fs-md); font-weight: 550; text-align: left; color: var(--text); }
.ob-opt:hover { border-color: var(--accent); background: var(--accent-soft); }
.ob-opt.on { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.ob-go { color: var(--text-4); }
.ob-opt:hover .ob-go { color: var(--accent); }
@media (max-width: 600px) { .ob-l { display: none; } .ob-opts { grid-template-columns: 1fr; } }

/* ------------------------------- agent layer ------------------------------- */
.ai-read { padding: 0; overflow: hidden; background: linear-gradient(180deg, #f6f5ff 0%, var(--bg) 120px); border-color: #e2e0fb; }
.ai-read-h { display: flex; align-items: flex-start; gap: 12px; padding: 16px 18px 0; flex-wrap: wrap; }
.ai-src { display: inline-flex; align-items: center; gap: 6px; font-size: var(--fs-xs); font-weight: 600; color: var(--accent-text); }
.ai-src.muted { color: var(--text-3); }
.ai-headline { margin: 6px 0 0; font-size: var(--fs-lg); font-weight: 600; line-height: 1.4; color: var(--text); text-wrap: pretty; }
.ai-cards { display: grid; gap: 12px; padding: 14px 18px 18px; grid-template-columns: repeat(3, minmax(0, 1fr)); }
.ai-cards.n1 { grid-template-columns: minmax(0, 1fr); }
.ai-cards.n2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.ai-card { display: flex; flex-direction: column; gap: 10px; padding: 14px; border: 1px solid var(--border); border-radius: var(--r-md); background: var(--bg); min-width: 0; }
.ai-card h4 { margin: 0; font-size: var(--fs-md); font-weight: 650; }
.ai-card p { margin: 3px 0 0; font-size: var(--fs-sm); color: var(--text-2); line-height: 1.5; }
.ai-act { margin-top: auto; }
.ai-evi { display: flex; flex-wrap: wrap; gap: 6px; }
.ai-evi span { display: inline-flex; align-items: center; padding: 2px 8px; border-radius: 999px; background: var(--bg-muted); color: var(--text-2); font-size: var(--fs-xs); font-weight: 550; font-variant-numeric: tabular-nums; }
.ai-insights .ai-cards { grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.ai-props .panel-b { background: var(--bg-subtle); }
.ai-prop { display: flex; align-items: flex-start; gap: 12px; padding: 14px; border: 1px solid var(--border); border-radius: var(--r-md); background: var(--bg); }
.ai-prop h4 { margin: 0; font-size: var(--fs-md); font-weight: 650; }
.ai-prop p { margin: 3px 0 8px; font-size: var(--fs-sm); color: var(--text-2); line-height: 1.5; }
.ai-prop-a { display: flex; gap: 6px; flex: none; align-items: center; }
.ai-watch { display: flex; align-items: flex-start; gap: 10px; padding: 12px; border-radius: var(--r-md); background: var(--warn-soft); border: 1px solid #f5dfa8; }
.ai-watch-i { flex: none; width: 26px; height: 26px; border-radius: 8px; display: grid; place-items: center; background: #fff; color: var(--warn-text); }
.ai-tl-day + .ai-tl-day { margin-top: 14px; }
.ai-tl-d { font-size: var(--fs-xs); font-weight: 650; text-transform: uppercase; letter-spacing: .04em; color: var(--text-3); margin-bottom: 6px; }
.ai-tl ol { list-style: none; margin: 0; padding: 0; border-left: 2px solid var(--border); margin-left: 12px; }
.ai-tl li { display: flex; align-items: center; gap: 10px; padding: 6px 0 6px 0; margin-left: -13px; font-size: var(--fs-sm); }
.ai-tl-i { flex: none; width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; background: var(--bg); border: 1px solid var(--border-strong); color: var(--text-3); }
.ai-tl li.agent .ai-tl-i { background: var(--accent-soft); border-color: var(--accent-soft-2); color: var(--accent); }
.ai-tl li.agent .ai-tl-t { color: var(--text); }
.ai-tl-t { color: var(--text-2); }
.ai-tl-who { display: inline-block; margin-right: 6px; padding: 0 6px; border-radius: 6px; background: var(--accent-soft); color: var(--accent-text); font-size: var(--fs-xs); font-weight: 650; }
.ai-agent { display: flex; gap: 12px; align-items: flex-start; padding: 14px 16px; }
.ai-agent + .ai-agent { border-top: 1px solid var(--border); }
.tcard.ai { flex-direction: row; align-items: center; gap: 16px; background: linear-gradient(90deg, #f6f5ff 0%, var(--bg) 70%); border-color: #e2e0fb; }
.tcard.ai .tcard-ic { background: var(--accent); color: #fff; }
.tcard.ai p { margin: 2px 0 0; }
.tcard-ic.k-adaptive { background: var(--accent-soft); color: var(--accent); }
.ai-design li { font-size: var(--fs-sm); }
@media (max-width: 900px) { .ai-cards, .ai-cards.n2 { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 600px) { .ai-prop { flex-wrap: wrap; } .ai-prop-a { width: 100%; justify-content: flex-end; } .tcard.ai { flex-direction: column; align-items: flex-start; } }
.mk-diag { display: flex; gap: 8px; align-items: flex-start; padding: 10px 12px; border-radius: var(--r-sm); background: var(--accent-soft); color: var(--text-2); font-size: var(--fs-sm); line-height: 1.45; }
.mk-diag > svg { flex: none; margin-top: 2px; color: var(--accent); }
.mk-diag b { color: var(--accent-text); font-weight: 650; }
