/* Layout concept: a modern study dashboard built around a photographer's contact sheet.
   Every catalogue question is a numbered frame; progress is marked the way an editor marks
   a proof — a red circle for trouble, a tick for a keeper. Soft elevated cards on a cool grey
   ground, one dark hero card for today's session, a ring for exam readiness. */
:root {
  --bg: #f3f4f6;           /* cool grey ground */
  --surface: #ffffff;      /* cards */
  --surface-2: #f0f1f4;    /* inputs, hovers, wells */
  --ink: #0f1115;
  --graphite: #5c6270;     /* secondary text */
  --rule: #e3e5ea;         /* hairlines */
  --frame: #e8e9ee;        /* unexposed frame */
  --frame-ink: #868c97;    /* frame numbers, labels */
  --marker: #e2362b;       /* red marker: brand accent, "hard" */
  --marker-soft: #fde8e6;
  --keep: #198754;         /* tick / correct */
  --keep-soft: #e1f4e9;
  --learn: #b4740f;        /* in progress */
  --learn-soft: #fcf0d9;
  --focus: #2563eb;
  --hero-bg: #12141a;      /* today's session card */
  --hero-fg: #ffffff;
  --hero-sub: #a6acb8;
  --hero-line: rgba(255, 255, 255, .14);
  --pill: #ffffff;         /* active tab / segment */
  --shadow-sm: 0 1px 2px rgba(16, 24, 40, .05);
  --shadow: 0 1px 2px rgba(16, 24, 40, .04), 0 8px 24px rgba(16, 24, 40, .06);
  --shadow-lg: 0 2px 4px rgba(16, 24, 40, .05), 0 16px 40px rgba(16, 24, 40, .10);

  --f-display: "Helvetica Neue", Helvetica, Arial, sans-serif;
  --f-ui: "Helvetica Neue", Helvetica, Arial, sans-serif;
  --f-mono: "Helvetica Neue", Helvetica, Arial, sans-serif;

  /* type scale: 15 / 17 / 19 / 24 / 32 / 46 px on desktop, display sizes shrink on phones */
  --s-xs: .9375rem; --s-sm: 1.0625rem; --s-md: 1.1875rem;
  --s-lg: clamp(1.3125rem, 1.1rem + .6vw, 1.5rem);
  --s-xl: clamp(1.625rem, 1.3rem + 1vw, 2rem);
  --s-2xl: clamp(2.125rem, 1.6rem + 1.8vw, 2.875rem);
  --r-sm: 10px; --r: 16px; --r-lg: 22px;
  --gutter: clamp(16px, 4vw, 40px);
  --nav-h: 72px;
  --page-w: 80%;   /* page width on tablet and desktop */
  --ease: cubic-bezier(.2, .7, .2, 1);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0c0d10; --surface: #16181d; --surface-2: #1d2026; --ink: #f1f2f4; --graphite: #9ba1ad; --rule: #272a32;
    --frame: #23262d; --frame-ink: #6d727d; --marker: #ff5d51; --marker-soft: #3a1714;
    --keep: #4cc38a; --keep-soft: #12291d; --learn: #f0b14a; --learn-soft: #33260e; --focus: #7aa7ff;
    --hero-bg: #1c1f27; --hero-fg: #ffffff; --hero-sub: #a6acb8; --hero-line: rgba(255, 255, 255, .12); --pill: #2c303a;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, .4); --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 8px 24px rgba(0, 0, 0, .35);
    --shadow-lg: 0 2px 4px rgba(0, 0, 0, .4), 0 16px 40px rgba(0, 0, 0, .5);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0c0d10; --surface: #16181d; --surface-2: #1d2026; --ink: #f1f2f4; --graphite: #9ba1ad; --rule: #272a32;
  --frame: #23262d; --frame-ink: #6d727d; --marker: #ff5d51; --marker-soft: #3a1714;
  --keep: #4cc38a; --keep-soft: #12291d; --learn: #f0b14a; --learn-soft: #33260e; --focus: #7aa7ff;
  --hero-bg: #1c1f27; --hero-fg: #ffffff; --hero-sub: #a6acb8; --hero-line: rgba(255, 255, 255, .12); --pill: #2c303a;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .4); --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 8px 24px rgba(0, 0, 0, .35);
  --shadow-lg: 0 2px 4px rgba(0, 0, 0, .4), 0 16px 40px rgba(0, 0, 0, .5);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 400 var(--s-md)/1.55 var(--f-ui);
  -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; height: auto; display: block; }
button, input, select { font: inherit; color: inherit; }
a { color: inherit; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
[hidden] { display: none !important; }
.mono { font-family: var(--f-mono); font-variant-numeric: tabular-nums; }
.eyebrow { font: 600 .8125rem/1.3 var(--f-ui); letter-spacing: .08em; text-transform: uppercase; color: var(--frame-ink); }
.muted { color: var(--graphite); }
h1, h2, h3 { text-wrap: balance; margin: 0; }

@keyframes rise { from { transform: translateY(8px); } to { transform: none; } }
#view > * { animation: rise .35s var(--ease) both; }

/* ---------- shell ---------- */
.top {
  position: sticky; top: env(safe-area-inset-top, 0px); z-index: 20;
  background: color-mix(in srgb, var(--bg) 78%, transparent);
  backdrop-filter: saturate(1.6) blur(14px); -webkit-backdrop-filter: saturate(1.6) blur(14px);
  border-bottom: 1px solid color-mix(in srgb, var(--rule) 70%, transparent);
}
.top-in { width: var(--page-w); margin: 0 auto; padding: 14px var(--gutter); display: flex; align-items: center; gap: 24px; }
.brand { display: flex; align-items: center; gap: 12px; text-decoration: none; min-width: 0; }
.brand-mark { width: 38px; height: 38px; border-radius: 11px; flex: none; box-shadow: var(--shadow-sm); }
.brand-txt { display: flex; flex-direction: column; line-height: 1.15; min-width: 0; }
.brand b { font: 700 1.375rem/1.1 var(--f-display); letter-spacing: -.02em; }
.brand-txt > span { font: 400 .875rem/1.3 var(--f-ui); color: var(--frame-ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nav { display: flex; gap: 4px; margin-left: auto; padding: 4px; background: var(--surface-2); border-radius: 999px; }
.nav a {
  text-decoration: none; padding: 9px 16px; border-radius: 999px; color: var(--graphite);
  font-size: var(--s-sm); font-weight: 500; display: flex; gap: 8px; align-items: center;
  transition: background .2s var(--ease), color .2s var(--ease), box-shadow .2s var(--ease);
}
.nav a:hover { color: var(--ink); }
.nav a[aria-current="page"] { color: var(--ink); background: var(--pill); box-shadow: var(--shadow-sm); }
.nav svg { width: 20px; height: 20px; flex: none; }
.sync-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--frame-ink); flex: none; }
.sync-dot[data-s="ok"] { background: var(--keep); }
.sync-dot[data-s="busy"] { background: var(--learn); }
.sync-dot[data-s="err"] { background: var(--marker); }

main { width: var(--page-w); margin: 0 auto; padding: 36px var(--gutter) 72px; }
.narrow { width: 100%; }

@media (max-width: 960px) { .nav a { padding: 9px 12px; } .nav a span.lbl-long { display: none; } }
@media (max-width: 760px) {
  :root { --page-w: 100%; }
  /* backdrop-filter would make the header the containing block of the fixed bottom nav */
  .top { backdrop-filter: none; -webkit-backdrop-filter: none; background: var(--bg); }
  .nav {
    position: fixed; left: 12px; right: 12px; bottom: calc(10px + env(safe-area-inset-bottom, 0px)); z-index: 30; margin: 0; gap: 2px;
    background: color-mix(in srgb, var(--surface) 92%, transparent); border: 1px solid var(--rule);
    backdrop-filter: saturate(1.6) blur(14px); -webkit-backdrop-filter: saturate(1.6) blur(14px);
    padding: 6px; border-radius: 22px; box-shadow: var(--shadow-lg);
    justify-content: space-around;
  }
  .nav a { flex-direction: column; gap: 3px; font-size: .75rem; padding: 8px 2px; flex: 1; text-align: center; border-radius: 16px; }
  .nav a[aria-current="page"] { background: var(--surface-2); box-shadow: none; color: var(--ink); }
  main { padding-bottom: calc(var(--nav-h) + 48px + env(safe-area-inset-bottom, 0px)); padding-top: 22px; }
  .top-in { padding-block: 12px; }
}

/* ---------- buttons & controls ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 52px; padding: 12px 26px; border-radius: 14px; cursor: pointer;
  border: 1px solid var(--ink); background: var(--ink); color: var(--surface);
  font-weight: 600; font-size: var(--s-md); text-decoration: none; line-height: 1.2;
  transition: transform .15s var(--ease), box-shadow .2s var(--ease), background .2s var(--ease), border-color .2s var(--ease);
}
.btn:hover { transform: translateY(-1px); box-shadow: var(--shadow); }
.btn:active { transform: translateY(0); box-shadow: none; }
.btn.ghost { background: var(--surface); color: var(--ink); border-color: var(--rule); }
.btn.ghost:hover { border-color: var(--frame-ink); }
.btn.danger { background: var(--marker); border-color: var(--marker); color: #fff; }
.btn.small { min-height: 40px; padding: 8px 16px; font-size: var(--s-sm); border-radius: 12px; }
.btn[disabled] { opacity: .45; cursor: not-allowed; transform: none; box-shadow: none; }
.btn .arrow { transition: transform .2s var(--ease); }
.btn:hover .arrow { transform: translateX(3px); }
.row { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; }
.chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 4px 11px; border-radius: 999px;
  font: 600 .8125rem/1.4 var(--f-ui); background: var(--surface-2); color: var(--graphite); white-space: nowrap;
}
.chip i { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.chip.new { color: var(--graphite); }
.chip.learn { color: var(--learn); background: var(--learn-soft); }
.chip.hard { color: var(--marker); background: var(--marker-soft); }
.chip.done { color: var(--keep); background: var(--keep-soft); }

.field { display: grid; gap: 8px; }
.field label, .field .lbl { font-size: var(--s-sm); font-weight: 600; }
.field .hint { font-size: var(--s-xs); color: var(--graphite); }
input[type=text], input[type=email], input[type=date], input[type=search], select, textarea {
  width: 100%; min-height: 52px; padding: 12px 16px; border: 1px solid var(--rule); border-radius: 12px;
  background: var(--surface); transition: border-color .2s var(--ease), box-shadow .2s var(--ease);
}
input:focus, select:focus, textarea:focus { border-color: var(--focus); outline: none; box-shadow: 0 0 0 4px color-mix(in srgb, var(--focus) 18%, transparent); }
.seg { display: inline-flex; gap: 4px; padding: 4px; background: var(--surface-2); border-radius: 14px; flex-wrap: wrap; }
.seg button { border: 0; background: transparent; padding: 9px 16px; cursor: pointer; font-size: var(--s-sm); font-weight: 500; color: var(--graphite); border-radius: 10px; transition: background .2s var(--ease), color .2s var(--ease); }
.seg button:hover { color: var(--ink); }
.seg button[aria-pressed="true"] { background: var(--pill); color: var(--ink); box-shadow: var(--shadow-sm); }

/* ---------- start ---------- */
.hello { display: grid; gap: 10px; margin-bottom: 32px; }
.hello h1 { font: 700 var(--s-2xl)/1.08 var(--f-display); letter-spacing: -.03em; }
.hello p { margin: 0; color: var(--graphite); max-width: 60ch; font-size: var(--s-md); }
.lead-grid { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr); gap: 20px; margin-bottom: 20px; }
@media (max-width: 900px) { .lead-grid { grid-template-columns: 1fr; } }
.panel { background: var(--surface); border: 1px solid var(--rule); border-radius: var(--r-lg); padding: 28px; min-width: 0; box-shadow: var(--shadow); }

.session-panel {
  display: grid; gap: 24px; align-content: space-between;
  background: var(--hero-bg); color: var(--hero-fg); border-color: transparent; position: relative; overflow: hidden;
}
.session-panel::after { /* soft red glow in the corner */
  content: ""; position: absolute; width: 340px; height: 340px; right: -120px; top: -160px; border-radius: 50%;
  background: radial-gradient(closest-side, color-mix(in srgb, var(--marker) 38%, transparent), transparent); pointer-events: none;
}
.session-panel > * { position: relative; z-index: 1; }
.session-panel .eyebrow { color: var(--hero-sub); }
.session-panel h2 { font: 700 var(--s-xl)/1.15 var(--f-display); letter-spacing: -.02em; }
.session-panel .btn { background: var(--hero-fg); color: var(--hero-bg); border-color: var(--hero-fg); }
.session-panel .btn.ghost { background: transparent; color: var(--hero-fg); border-color: var(--hero-line); }
.session-panel .btn.ghost:hover { border-color: var(--hero-fg); }
.big-nums { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.big-nums div { display: grid; gap: 4px; padding: 14px 16px; border: 1px solid var(--hero-line); border-radius: 14px; background: rgba(255, 255, 255, .04); }
.big-nums b { font: 700 2.5rem/1 var(--f-display); font-variant-numeric: tabular-nums; letter-spacing: -.03em; }
.big-nums span { font-size: var(--s-xs); color: var(--hero-sub); }

.ready { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 24px; align-items: center; }
.ready .ready-txt { display: grid; gap: 10px; min-width: 0; }
.ready h3 { font: 700 var(--s-lg)/1.2 var(--f-display); letter-spacing: -.01em; }
.ring { position: relative; width: 132px; height: 132px; flex: none; }
.ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring .track { fill: none; stroke: var(--surface-2); stroke-width: 10; }
.ring .val { fill: none; stroke-width: 10; stroke-linecap: round; transition: stroke-dashoffset .9s var(--ease); }
.ring .lbl { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; }
.ring .lbl b { font: 700 1.875rem/1 var(--f-display); letter-spacing: -.03em; font-variant-numeric: tabular-nums; }
.ring .lbl span { font-size: .8125rem; color: var(--graphite); margin-top: 2px; }
@media (max-width: 560px) {
  .panel { padding: 20px; }
  .ready { gap: 18px; }
  .ring { width: 96px; height: 96px; }
  .ring .lbl b { font-size: 1.375rem; }
  .ring .lbl span { font-size: .75rem; }
  .big-nums { gap: 8px; }
  .big-nums div { padding: 12px; }
  .big-nums b { font-size: 2rem; }
  .bucket { padding: 16px; }
  .bucket p { display: none; }
  .card { padding: 20px 16px; }
  .opt { grid-template-columns: 36px minmax(0, 1fr); gap: 12px; padding: 14px; }
  .opt .k { width: 36px; height: 36px; }
  .seg { display: flex; width: 100%; }
  .seg button { flex: 1; padding: 10px 8px; }
  .stack-sm { flex-wrap: wrap !important; }
  .stack-sm > * { flex: 1 1 100% !important; }
}
.meter { height: 8px; background: var(--surface-2); border-radius: 99px; overflow: hidden; display: flex; }
.meter i { display: block; height: 100%; }
.meter .m-done { background: var(--keep); }
.meter .m-learn { background: var(--learn); }
.meter .m-hard { background: var(--marker); }
.legend { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: var(--s-xs); color: var(--graphite); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }

.buckets { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; margin-bottom: 48px; }
@media (max-width: 900px) { .buckets { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.bucket {
  text-align: left; cursor: pointer; background: var(--surface); border: 1px solid var(--rule); border-radius: var(--r);
  padding: 20px; display: grid; gap: 6px; align-content: start; min-width: 0; box-shadow: var(--shadow-sm);
  transition: transform .2s var(--ease), box-shadow .2s var(--ease), border-color .2s var(--ease);
}
.bucket:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); border-color: transparent; }
.bucket b { font: 700 var(--s-xl)/1.1 var(--f-display); font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.bucket .t { font-weight: 600; font-size: var(--s-sm); display: flex; align-items: center; gap: 8px; }
.bucket .t i { width: 10px; height: 10px; border-radius: 50%; }
.bucket p { margin: 0; font-size: var(--s-xs); color: var(--graphite); }

/* contact sheet */
.sheet-head { display: flex; align-items: end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 16px; }
.sheet-head h2 { font: 700 var(--s-xl)/1.2 var(--f-display); letter-spacing: -.02em; }
.contact {
  background: #111318; padding: 18px 14px; border-radius: var(--r-lg); box-shadow: var(--shadow); border: 1px solid var(--rule);
  display: grid; grid-template-columns: repeat(auto-fill, minmax(44px, 1fr)); gap: 6px;
}
.frame {
  position: relative; aspect-ratio: 3 / 2; max-width: 100%; background: #e8e9ee; border: 0; padding: 0; cursor: pointer;
  border-radius: 5px; font: 600 .75rem/1 var(--f-mono); color: #868c97;
  display: flex; align-items: flex-end; justify-content: flex-start; padding: 0 0 3px 4px;
  transition: transform .15s var(--ease), filter .15s var(--ease);
}
.frame[data-b="learn"] { background: #fcf0d9; color: #b4740f; }
.frame[data-b="done"] { background: #e1f4e9; color: #198754; }
.frame[data-b="hard"] { background: #fde8e6; color: #e2362b; }
.frame[data-b="hard"]::after {
  content: ""; position: absolute; inset: -3px; border: 2px solid #ff5d51; border-radius: 50%;
  transform: rotate(-8deg); pointer-events: none;
}
.frame[data-b="done"]::before {
  content: ""; position: absolute; right: 5px; top: 4px; width: 6px; height: 10px;
  border: solid #198754; border-width: 0 2px 2px 0; transform: rotate(40deg);
}
.frame.state { outline: 1px dashed #868c97; outline-offset: -4px; }
.frame:hover { transform: scale(1.08); z-index: 1; }
.edge { display: flex; justify-content: space-between; font: 600 .75rem/1 var(--f-mono); color: var(--frame-ink); letter-spacing: .14em; margin-top: 10px; gap: 12px; flex-wrap: wrap; padding-inline: 6px; }

.exam-card { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 24px; align-items: center; margin-top: 40px; }
@media (max-width: 640px) { .exam-card { grid-template-columns: 1fr; } }
.exam-card h2 { font: 700 var(--s-xl)/1.2 var(--f-display); letter-spacing: -.02em; margin-bottom: 6px; }
.history { display: flex; gap: 6px; align-items: end; height: 44px; margin-top: 14px; }
.history i { width: 12px; background: var(--keep); border-radius: 4px; display: block; }
.history i.fail { background: var(--marker); }

/* ---------- study card ---------- */
.study-top { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.progress { flex: 1; min-width: 120px; height: 8px; background: var(--surface-2); border-radius: 99px; overflow: hidden; }
.progress i { display: block; height: 100%; background: linear-gradient(90deg, var(--ink), color-mix(in srgb, var(--ink) 70%, var(--marker))); border-radius: 99px; transition: width .4s var(--ease); }
.card { display: grid; gap: 22px; background: var(--surface); border: 1px solid var(--rule); border-radius: var(--r-lg); padding: clamp(20px, 3vw, 36px); box-shadow: var(--shadow); }
.qmeta { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.q-de { font: 700 var(--s-xl)/1.25 var(--f-display); letter-spacing: -.02em; margin: 0; }
.q-pl { font: italic 400 var(--s-lg)/1.4 var(--f-display); color: var(--graphite); margin: 0; }
.reveal-pl { border: 0; background: var(--surface-2); padding: 8px 14px; border-radius: 999px; color: var(--graphite); font-size: var(--s-sm); font-weight: 500; cursor: pointer; justify-self: start; }
.reveal-pl:hover { color: var(--ink); }
.qimg { background: #fff; border: 1px solid var(--rule); border-radius: var(--r); padding: 16px; }
.qimg img { margin: 0 auto; max-height: 380px; width: auto; }
.speak { border: 1px solid var(--rule); background: var(--surface); border-radius: 999px; width: 46px; height: 46px; display: inline-grid; place-items: center; cursor: pointer; color: var(--graphite); flex: none; transition: color .2s var(--ease), border-color .2s var(--ease), box-shadow .2s var(--ease); }
.speak:hover { color: var(--ink); border-color: var(--frame-ink); box-shadow: var(--shadow-sm); }
.speak svg { width: 20px; height: 20px; }

.opts { display: grid; gap: 12px; }
.opt {
  display: grid; grid-template-columns: 40px minmax(0, 1fr); gap: 16px; align-items: center; text-align: left;
  padding: 16px 18px; border: 1.5px solid var(--rule); border-radius: var(--r); background: var(--surface);
  cursor: pointer; min-height: 64px;
  transition: border-color .2s var(--ease), background .2s var(--ease), transform .15s var(--ease), box-shadow .2s var(--ease);
}
.opt:hover:not([disabled]) { border-color: var(--frame-ink); transform: translateY(-1px); box-shadow: var(--shadow); }
.opt .k {
  width: 40px; height: 40px; display: grid; place-items: center; border-radius: 12px; background: var(--surface-2);
  font: 700 var(--s-sm)/1 var(--f-ui); color: var(--graphite); transition: background .2s var(--ease), color .2s var(--ease);
}
.opt .de { font-weight: 600; display: block; }
.opt .pl { display: block; font-size: var(--s-sm); color: var(--graphite); margin-top: 3px; }
.opt[disabled] { cursor: default; }
.opt.correct { border-color: var(--keep); background: var(--keep-soft); }
.opt.correct .k { background: var(--keep); color: #fff; }
.opt.wrong { border-color: var(--marker); background: var(--marker-soft); animation: shake .35s var(--ease); }
.opt.wrong .k { background: var(--marker); color: #fff; }
.opt.picked { border-color: var(--ink); background: var(--surface-2); }
.opt.picked .k { background: var(--ink); color: var(--surface); }
.opt.dim { opacity: .5; }
@keyframes shake { 0%, 100% { transform: none; } 25% { transform: translateX(-4px); } 75% { transform: translateX(4px); } }

.explain { background: var(--surface-2); border-radius: var(--r); padding: 16px 20px; display: grid; gap: 6px; animation: rise .3s var(--ease) both; }
.explain .verdict { font-weight: 700; font-size: var(--s-md); }
.explain .verdict.ok { color: var(--keep); }
.explain .verdict.no { color: var(--marker); }
.explain p { margin: 0; color: var(--graphite); max-width: 70ch; }
.grades { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.grades .btn { flex-direction: column; gap: 4px; min-height: 68px; }
.grades .btn small { font: 500 var(--s-xs)/1.2 var(--f-ui); opacity: .7; }
.kbd-hint { font-size: var(--s-xs); color: var(--frame-ink); text-align: center; margin: 0; }
@media (hover: none) { .kbd-hint { display: none; } }

.done-screen { text-align: left; display: grid; gap: 22px; padding: clamp(24px, 4vw, 48px); background: var(--surface); border: 1px solid var(--rule); border-radius: var(--r-lg); box-shadow: var(--shadow); }
.done-screen h1 { font: 700 var(--s-2xl)/1.08 var(--f-display); letter-spacing: -.03em; }

/* ---------- browse ---------- */
.filters { display: grid; gap: 16px; margin-bottom: 20px; }
.tabs { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; padding: 4px; background: var(--surface-2); border-radius: 16px; }
.tabs::-webkit-scrollbar { display: none; }
.tabs button { border: 0; background: none; padding: 10px 16px; cursor: pointer; white-space: nowrap; color: var(--graphite); font-weight: 600; font-size: var(--s-sm); border-radius: 12px; transition: background .2s var(--ease), color .2s var(--ease); }
.tabs button:hover { color: var(--ink); }
.tabs button[aria-pressed="true"] { color: var(--ink); background: var(--pill); box-shadow: var(--shadow-sm); }
.tabs .n { font: 500 var(--s-xs) var(--f-mono); margin-left: 6px; color: var(--frame-ink); }
.list { display: grid; gap: 10px; }
.item { background: var(--surface); border: 1px solid var(--rule); border-radius: var(--r); box-shadow: var(--shadow-sm); transition: box-shadow .2s var(--ease); }
.item:hover { box-shadow: var(--shadow); }
.item > button {
  width: 100%; text-align: left; background: none; border: 0; cursor: pointer; padding: 18px 20px;
  display: grid; grid-template-columns: 56px minmax(0, 1fr) auto; gap: 14px; align-items: start; border-radius: var(--r);
}
.item .num { font: 700 var(--s-sm)/1 var(--f-mono); color: var(--graphite); background: var(--surface-2); border-radius: 10px; padding: 9px 0; text-align: center; }
.item .tq { font: 600 var(--s-md)/1.4 var(--f-display); display: block; }
.item .tp { font-size: var(--s-sm); color: var(--graphite); display: block; margin-top: 3px; }
.item .ans { font-size: var(--s-sm); margin-top: 10px; display: block; color: var(--keep); font-weight: 500; }
.item .detail { padding: 0 20px 22px 90px; display: grid; gap: 14px; }
@media (max-width: 560px) {
  .item > button { grid-template-columns: 44px minmax(0, 1fr); padding: 16px; }
  .item > button .chip { grid-column: 2; justify-self: start; }
  .item .detail { padding: 0 16px 18px; }
}
.item .detail ol { margin: 0; padding-left: 22px; display: grid; gap: 8px; }
.item .detail li.c { color: var(--keep); font-weight: 600; }
.item .detail li span { display: block; font-size: var(--s-sm); color: var(--graphite); font-weight: 400; }
.empty { padding: 56px 0; color: var(--graphite); text-align: center; }

/* ---------- exam ---------- */
.exam-bar { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.timer { font: 700 var(--s-lg)/1 var(--f-mono); font-variant-numeric: tabular-nums; padding: 10px 16px; border-radius: 12px; background: var(--surface); border: 1px solid var(--rule); box-shadow: var(--shadow-sm); }
.timer.low { color: var(--marker); border-color: var(--marker); }
.qgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(44px, 1fr)); gap: 6px; margin-bottom: 20px; }
.qgrid button { aspect-ratio: 1; border: 1px solid var(--rule); background: var(--surface); border-radius: 10px; font: 600 .875rem var(--f-mono); cursor: pointer; color: var(--graphite); padding: 0; transition: transform .15s var(--ease), background .2s var(--ease); }
.qgrid button:hover { transform: translateY(-1px); }
.qgrid button.answered { background: var(--ink); color: var(--surface); border-color: var(--ink); }
.qgrid button.cur { outline: 2px solid var(--marker); outline-offset: 2px; }
.qgrid button.ok { background: var(--keep-soft); color: var(--keep); border-color: transparent; }
.qgrid button.no { background: var(--marker-soft); color: var(--marker); border-color: transparent; }
.score { font: 700 5.5rem/1 var(--f-display); font-variant-numeric: tabular-nums; letter-spacing: -.04em; }
.verdict-big { font: 700 var(--s-xl)/1.2 var(--f-display); padding: 6px 16px; border-radius: 999px; }
.verdict-big.pass { color: var(--keep); background: var(--keep-soft); }
.verdict-big.fail { color: var(--marker); background: var(--marker-soft); }
.rules { margin: 0; padding-left: 22px; display: grid; gap: 8px; color: var(--graphite); }
.done-screen .list .item { padding: 16px 20px; }

/* ---------- teacher ---------- */
.t-sum { margin-bottom: 20px; }
.t-sum .bucket { cursor: default; }
.t-sum .bucket:hover { transform: none; box-shadow: var(--shadow-sm); border-color: var(--rule); }
.t-tools { margin-bottom: 16px; }
.t-tools .seg { margin-right: auto; }
.item > button.t-row { grid-template-columns: 48px minmax(0, 1fr) auto; align-items: center; }
.t-avatar { width: 48px; height: 48px; border-radius: 50%; display: grid; place-items: center; background: var(--hero-bg); color: var(--hero-fg); font: 700 1.25rem/1 var(--f-display); }
.t-main { display: grid; gap: 4px; min-width: 0; }
.t-meter { display: grid; gap: 6px; margin-top: 8px; max-width: 520px; }
.t-stats { display: grid; justify-items: end; text-align: right; gap: 2px; }
.t-stats b { font: 700 1.75rem/1 var(--f-display); letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.t-stats > span:not(.tp) { font-size: .8125rem; color: var(--graphite); }
.t-detail { padding-left: 82px; }
.t-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
.t-grid p { margin: 4px 0 0; font-weight: 600; }
.t-hard { margin: 8px 0 0; padding-left: 22px; display: grid; gap: 10px; }
.t-hard .tq { font-size: var(--s-sm); }
@media (max-width: 760px) {
  .t-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .t-detail { padding-left: 16px; }
  .item > button.t-row { grid-template-columns: 40px minmax(0, 1fr) auto; }
  .t-avatar { width: 40px; height: 40px; font-size: 1rem; }
  .t-stats b { font-size: 1.375rem; }
}
@media (max-width: 560px) { .item > button.t-row .t-stats { grid-column: auto; } }

.t-invite { display: grid; gap: 16px; margin-bottom: 24px; }
.t-invite h2 { font: 700 var(--s-lg)/1.2 var(--f-display); letter-spacing: -.01em; }
.t-invite-grid { display: grid; grid-template-columns: 2fr 1fr 1.4fr; gap: 16px; }
.t-span { grid-column: 1 / -1; }
textarea { resize: vertical; line-height: 1.5; font: inherit; }
.t-preview { display: grid; gap: 10px; margin-top: 8px; }
.t-preview iframe { width: 100%; height: 1150px; border: 1px solid var(--rule); border-radius: var(--r); background: #f3f4f6; }
.t-inv { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 14px; align-items: center; padding: 16px 20px; }
@media (max-width: 760px) {
  .t-invite-grid { grid-template-columns: 1fr; }
  .t-inv { grid-template-columns: minmax(0, 1fr) auto; }
  .t-inv .btn { grid-column: 1 / -1; justify-self: start; }
  .t-preview iframe { height: 1300px; }
}

/* ---------- settings ---------- */
.settings { display: grid; gap: 20px; }
.settings > .hello { margin-bottom: 8px; }
.settings section { display: grid; gap: 20px; padding: clamp(20px, 3vw, 32px); background: var(--surface); border: 1px solid var(--rule); border-radius: var(--r-lg); box-shadow: var(--shadow-sm); }
.settings h2 { font: 700 var(--s-lg)/1.2 var(--f-display); letter-spacing: -.01em; }
.two { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; }
@media (max-width: 560px) { .two { grid-template-columns: 1fr; } }
.switch { display: flex; gap: 12px; align-items: center; cursor: pointer; }
.switch input { width: 22px; height: 22px; accent-color: var(--ink); }
.note { font-size: var(--s-sm); color: var(--graphite); margin: 0; max-width: 70ch; }
.msg { font-size: var(--s-sm); padding: 12px 16px; border-radius: 12px; background: var(--surface-2); }
.msg.ok { background: var(--keep-soft); color: var(--keep); }
.msg.err { background: var(--marker-soft); color: var(--marker); }

footer.foot { width: var(--page-w); margin: 0 auto; padding: 0 var(--gutter) 44px; font-size: var(--s-xs); color: var(--frame-ink); }
@media (max-width: 760px) { footer.foot { padding-bottom: calc(var(--nav-h) + 44px); } }

.toast {
  position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%);
  background: var(--ink); color: var(--surface); padding: 12px 20px; border-radius: 999px; font-size: var(--s-sm); font-weight: 500;
  z-index: 50; max-width: calc(100% - 32px); box-shadow: var(--shadow-lg); animation: rise .25s var(--ease) both;
}
@media (max-width: 760px) { .toast { bottom: calc(var(--nav-h) + 28px + env(safe-area-inset-bottom, 0px)); } }

@media (prefers-reduced-motion: reduce) { *, *::before, *::after { transition: none !important; animation: none !important; } }
