/* ==========================================================================
   OT Casebook — styles
   ========================================================================== */

:root {
  color-scheme: light;
  --bg: #f6f4ef;
  --bg-glow-1: #dff0ea;
  --bg-glow-2: #f4e8da;
  --surface: #ffffff;
  --surface-2: #faf9f6;
  --surface-3: #f2efe9;
  --ink: #16201e;
  --ink-2: #364240;
  --muted: #69736f;
  --line: #e7e2d9;
  --line-2: #d8d1c5;
  --brand: #0e6b5f;
  --brand-2: #0b5a50;
  --brand-ink: #ffffff;
  --brand-soft: #e1f0eb;
  --focus: #2a9584;
  --ok: #157347;
  --ok-bg: #eaf7ef;
  --ok-line: #9fd8b8;
  --bad: #b3261e;
  --bad-bg: #fdeeec;
  --bad-line: #f1b9b3;
  --amber: #a46a00;
  --amber-bg: #fdf3e0;
  --on-solid: #ffffff;
  --dA: #0f7a6a;
  --dB: #2f63d4;
  --dC: #7b4fd4;
  --dD: #b06f08;
  --dE: #c23a68;
  --dF: #0b84a5;
  --shadow-sm: 0 1px 2px rgba(22, 32, 30, .06), 0 1px 1px rgba(22, 32, 30, .03);
  --shadow-md: 0 10px 28px -12px rgba(22, 32, 30, .18), 0 2px 6px rgba(22, 32, 30, .05);
  --shadow-lg: 0 28px 60px -24px rgba(22, 32, 30, .28), 0 6px 16px rgba(22, 32, 30, .06);
  --radius: 18px;
  --radius-md: 14px;
  --radius-sm: 10px;
  --font-ui: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-display: "Fraunces", ui-serif, Georgia, "Times New Roman", serif;
  --ease: cubic-bezier(.2, .8, .2, 1);
  --ease-out: cubic-bezier(.16, 1, .3, 1);
  --spring: cubic-bezier(.34, 1.56, .64, 1);
  --topbar-h: 64px;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #0c1211;
    --bg-glow-1: #10302a;
    --bg-glow-2: #2a2117;
    --surface: #131b1a;
    --surface-2: #172120;
    --surface-3: #1c2725;
    --ink: #e7eeec;
    --ink-2: #c2ccc9;
    --muted: #8b9894;
    --line: #233230;
    --line-2: #2f403d;
    --brand: #43bba6;
    --brand-2: #5fcab6;
    --brand-ink: #04211d;
    --brand-soft: #143029;
    --focus: #5fcab6;
    --ok: #52cf8f;
    --ok-bg: #102a1e;
    --ok-line: #24583d;
    --bad: #ff8a80;
    --bad-bg: #2e1715;
    --bad-line: #5f2b26;
    --amber: #f0b54a;
    --amber-bg: #2b2210;
    --on-solid: #08110f;
    --dA: #45c2ab;
    --dB: #7ea3ff;
    --dC: #b496ff;
    --dD: #e8a94a;
    --dE: #ff86ae;
    --dF: #4fc6e6;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, .4);
    --shadow-md: 0 12px 30px -12px rgba(0, 0, 0, .6), 0 2px 6px rgba(0, 0, 0, .3);
    --shadow-lg: 0 30px 60px -20px rgba(0, 0, 0, .7);
  }
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0c1211;
  --bg-glow-1: #10302a;
  --bg-glow-2: #2a2117;
  --surface: #131b1a;
  --surface-2: #172120;
  --surface-3: #1c2725;
  --ink: #e7eeec;
  --ink-2: #c2ccc9;
  --muted: #8b9894;
  --line: #233230;
  --line-2: #2f403d;
  --brand: #43bba6;
  --brand-2: #5fcab6;
  --brand-ink: #04211d;
  --brand-soft: #143029;
  --focus: #5fcab6;
  --ok: #52cf8f;
  --ok-bg: #102a1e;
  --ok-line: #24583d;
  --bad: #ff8a80;
  --bad-bg: #2e1715;
  --bad-line: #5f2b26;
  --amber: #f0b54a;
  --amber-bg: #2b2210;
  --on-solid: #08110f;
  --dA: #45c2ab;
  --dB: #7ea3ff;
  --dC: #b496ff;
  --dD: #e8a94a;
  --dE: #ff86ae;
  --dF: #4fc6e6;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .4);
  --shadow-md: 0 12px 30px -12px rgba(0, 0, 0, .6), 0 2px 6px rgba(0, 0, 0, .3);
  --shadow-lg: 0 30px 60px -20px rgba(0, 0, 0, .7);
}

/* ---------- base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font-ui);
  font-size: 16px;
  line-height: 1.55;
  color: var(--ink);
  background-color: var(--bg);
  background-image:
    radial-gradient(1100px 520px at 8% -8%, var(--bg-glow-1), transparent 62%),
    radial-gradient(900px 480px at 105% -4%, var(--bg-glow-2), transparent 58%);
  background-repeat: no-repeat;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
  transition: background-color .4s var(--ease), color .4s var(--ease);
}
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--brand); }
:focus-visible { outline: 2.5px solid var(--focus); outline-offset: 2px; border-radius: 8px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

.wrap { width: 100%; max-width: 1180px; margin: 0 auto; padding: 0 16px; }
@media (min-width: 720px) { .wrap { padding: 0 28px; } }

/* ---------- top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 40;
  height: var(--topbar-h);
  backdrop-filter: saturate(1.4) blur(14px);
  -webkit-backdrop-filter: saturate(1.4) blur(14px);
  background: color-mix(in srgb, var(--bg) 78%, transparent);
  border-bottom: 1px solid color-mix(in srgb, var(--line) 70%, transparent);
}
.topbar .wrap { height: 100%; display: flex; align-items: center; gap: 12px; }
.brand {
  display: inline-flex; align-items: center; gap: 10px;
  text-decoration: none; color: var(--ink);
  font-weight: 650; letter-spacing: -.01em;
  border-radius: 10px;
}
.brand-mark { width: 30px; height: 30px; flex: none; transition: transform .5s var(--spring); }
.brand:hover .brand-mark { transform: rotate(-8deg) scale(1.06); }
.brand-name { font-family: var(--font-display); font-size: 1.22rem; font-weight: 600; }
.brand-name em { font-style: normal; color: var(--brand); }
.topbar-spacer { flex: 1; }
.icon-btn {
  width: 40px; height: 40px; border-radius: 12px;
  display: inline-grid; place-items: center;
  background: transparent; border: 1px solid transparent; color: var(--ink-2);
  transition: background .2s var(--ease), border-color .2s var(--ease), color .2s var(--ease), transform .2s var(--ease);
}
.icon-btn:hover { background: var(--surface); border-color: var(--line); color: var(--ink); }
.icon-btn:active { transform: scale(.94); }
.icon-btn svg { width: 20px; height: 20px; }

/* ---------- buttons ---------- */
.btn {
  --b-bg: var(--surface); --b-ink: var(--ink); --b-line: var(--line-2);
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 0 18px;
  border-radius: 12px; border: 1px solid var(--b-line);
  background: var(--b-bg); color: var(--b-ink);
  font-weight: 600; font-size: .95rem; letter-spacing: -.005em;
  text-decoration: none; white-space: nowrap;
  box-shadow: var(--shadow-sm);
  transition: transform .18s var(--ease), box-shadow .25s var(--ease), background .2s var(--ease), border-color .2s var(--ease), opacity .2s;
}
.btn:hover { transform: translateY(-1px); box-shadow: var(--shadow-md); }
.btn:active { transform: translateY(0) scale(.98); }
.btn svg { width: 18px; height: 18px; flex: none; }
.btn-primary { --b-bg: var(--brand); --b-ink: var(--brand-ink); --b-line: transparent; }
.btn-primary:hover { --b-bg: var(--brand-2); }
.btn-ghost { --b-bg: transparent; --b-line: transparent; box-shadow: none; color: var(--ink-2); }
.btn-ghost:hover { --b-bg: var(--surface); --b-line: var(--line); box-shadow: none; }
.btn-lg { min-height: 52px; padding: 0 24px; font-size: 1rem; border-radius: 14px; }
.btn[disabled] { opacity: .45; pointer-events: none; box-shadow: none; }
.btn .kbd { margin-left: 4px; }

.kbd {
  display: inline-grid; place-items: center;
  min-width: 22px; height: 22px; padding: 0 6px;
  border-radius: 6px; font-size: .72rem; font-weight: 600;
  background: color-mix(in srgb, currentColor 12%, transparent);
  border: 1px solid color-mix(in srgb, currentColor 22%, transparent);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}

/* ---------- view transitions ---------- */
#app { min-height: calc(100vh - var(--topbar-h) - 90px); }
.view { animation: viewIn .55s var(--ease-out) both; }
.view.leaving { animation: viewOut .22s var(--ease) both; }
@keyframes viewIn { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
@keyframes viewOut { to { opacity: 0; transform: translateY(-6px); } }
.rise { animation: rise .7s var(--ease-out) both; animation-delay: calc(var(--d, 0) * 70ms); }
@keyframes rise { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: none; } }

/* ==========================================================================
   HOME
   ========================================================================== */
.hero { padding: 44px 0 28px; display: grid; gap: 28px; }
@media (min-width: 960px) { .hero { grid-template-columns: 1.25fr .9fr; align-items: end; padding: 64px 0 36px; } }
.eyebrow {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: .78rem; font-weight: 650; letter-spacing: .08em; text-transform: uppercase;
  color: var(--brand);
}
.hero h1 {
  font-family: var(--font-display); font-weight: 600;
  font-size: clamp(2.1rem, 5.4vw, 3.6rem); line-height: 1.04; letter-spacing: -.025em;
  margin: 14px 0 16px; text-wrap: balance;
}
.hero h1 .accent { color: var(--brand); font-style: italic; }
.hero p.lede { font-size: 1.08rem; color: var(--ink-2); max-width: 56ch; margin: 0 0 24px; text-wrap: pretty; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 10px; }

.countdown {
  position: relative; overflow: hidden;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 22px 22px 20px;
  box-shadow: var(--shadow-md);
}
.countdown::after {
  content: ""; position: absolute; inset: auto -40px -60px auto; width: 200px; height: 200px; border-radius: 50%;
  background: radial-gradient(circle, color-mix(in srgb, var(--brand) 22%, transparent), transparent 70%);
  pointer-events: none;
}
.countdown .label { font-size: .8rem; font-weight: 600; color: var(--muted); display: flex; align-items: center; gap: 8px; }
.pulse-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--brand); box-shadow: 0 0 0 0 color-mix(in srgb, var(--brand) 60%, transparent); animation: pulse 2.2s infinite; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--brand) 55%, transparent); } 70% { box-shadow: 0 0 0 10px transparent; } 100% { box-shadow: 0 0 0 0 transparent; } }
.countdown .days { font-family: var(--font-display); font-size: 3.4rem; line-height: 1; font-weight: 600; letter-spacing: -.03em; margin: 10px 0 2px; }
.countdown .days small { font-family: var(--font-ui); font-size: 1rem; font-weight: 500; color: var(--ink-2); letter-spacing: 0; margin-left: 6px; }
.countdown .when { color: var(--ink-2); font-size: .95rem; }
.facts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-top: 18px; }
.fact { background: var(--surface-2); border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; }
.fact b { display: block; font-size: 1.05rem; letter-spacing: -.01em; }
.fact span { font-size: .78rem; color: var(--muted); }

.resume-banner {
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  margin: 4px 0 24px; padding: 14px 16px;
  background: var(--brand-soft); border: 1px solid color-mix(in srgb, var(--brand) 25%, transparent);
  border-radius: var(--radius-md);
}
.resume-banner .txt { flex: 1; min-width: 200px; }
.resume-banner b { display: block; }
.resume-banner span { font-size: .9rem; color: var(--ink-2); }

.stats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin-bottom: 36px; }
@media (min-width: 720px) { .stats { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.stat {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-md);
  padding: 16px 18px; box-shadow: var(--shadow-sm);
}
.stat .k { font-size: .78rem; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.stat .v { font-family: var(--font-display); font-size: 2rem; font-weight: 600; letter-spacing: -.02em; line-height: 1.15; margin-top: 4px; }
.stat .v small { font-family: var(--font-ui); font-size: .9rem; color: var(--muted); font-weight: 500; }
.stat .bar { height: 6px; border-radius: 999px; background: var(--surface-3); overflow: hidden; margin-top: 10px; }
.stat .bar i { display: block; height: 100%; width: 0; border-radius: inherit; background: var(--brand); transition: width 1.1s var(--ease-out); }

.section-head { display: flex; align-items: end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin: 0 0 16px; }
.section-head h2 { font-family: var(--font-display); font-weight: 600; font-size: 1.6rem; letter-spacing: -.02em; margin: 0; }
.section-head p { margin: 4px 0 0; color: var(--muted); font-size: .95rem; }

.home-grid { display: grid; gap: 36px; padding-bottom: 56px; }
@media (min-width: 1040px) { .home-grid { grid-template-columns: minmax(0, 1fr) 360px; align-items: start; } }
@media (min-width: 1040px) and (min-height: 880px) { .home-grid > aside { position: sticky; top: calc(var(--topbar-h) + 20px); } }

/* filter chips */
.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip-btn {
  border: 1px solid var(--line-2); background: var(--surface); color: var(--ink-2);
  border-radius: 999px; padding: 6px 13px; font-size: .85rem; font-weight: 550;
  transition: background .2s var(--ease), color .2s var(--ease), border-color .2s var(--ease), transform .15s var(--ease);
}
.chip-btn:hover { border-color: var(--brand); color: var(--ink); }
.chip-btn:active { transform: scale(.96); }
.chip-btn[aria-pressed="true"] { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.chip-btn .cnt, .seg .cnt { display: inline-block; margin-left: 6px; font-size: .75rem; font-weight: 650; opacity: .6; font-variant-numeric: tabular-nums; }
.seg-sm { display: inline-grid; grid-template-columns: repeat(3, auto); }
.seg-sm button { padding: 6px 12px; font-size: .84rem; }

/* case cards */
.case-grid { display: grid; gap: 14px; grid-template-columns: minmax(0, 1fr); margin-top: 16px; }
@media (min-width: 640px) { .case-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.case-card {
  position: relative; text-align: left; width: 100%;
  display: flex; flex-direction: column; gap: 12px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 18px 18px 16px; box-shadow: var(--shadow-sm);
  text-decoration: none; color: inherit;
  transition: transform .3s var(--ease-out), box-shadow .3s var(--ease-out), border-color .3s var(--ease);
}
.case-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); border-color: color-mix(in srgb, var(--brand) 35%, var(--line)); }
.case-card:active { transform: translateY(-1px) scale(.995); }
.case-card .top { display: flex; align-items: center; gap: 10px; }
.case-no {
  font-size: .72rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase;
  color: var(--muted);
}
.case-card h3 { margin: 0; font-size: 1.12rem; letter-spacing: -.01em; line-height: 1.3; }
.case-card h3 .sub { display: block; font-weight: 500; font-size: .9rem; color: var(--muted); margin-top: 2px; }
.case-card .teaser { color: var(--ink-2); font-size: .9rem; margin: 0; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.case-card .foot { display: flex; align-items: flex-end; justify-content: space-between; flex-wrap: wrap; gap: 10px; margin-top: auto; padding-top: 4px; }
.case-card .foot .tag-row { flex: 1 1 160px; min-width: 0; }
.tag-row { display: flex; gap: 6px; flex-wrap: wrap; }
.tag {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: .74rem; font-weight: 600; padding: 3px 9px; border-radius: 999px;
  background: var(--surface-3); color: var(--ink-2); border: 1px solid var(--line);
  white-space: nowrap;
}
.case-status { display: inline-flex; align-items: center; gap: 8px; font-size: .82rem; font-weight: 600; color: var(--muted); white-space: nowrap; }
.mini-ring { width: 30px; height: 30px; transform: rotate(-90deg); }
.mini-ring circle { fill: none; stroke-width: 4; }
.mini-ring .trk { stroke: var(--surface-3); }
.mini-ring .val { stroke: var(--brand); stroke-linecap: round; transition: stroke-dashoffset 1s var(--ease-out); }
.case-card .go {
  position: absolute; top: 16px; right: 16px; width: 32px; height: 32px; border-radius: 10px;
  display: grid; place-items: center; color: var(--muted);
  transition: transform .3s var(--ease-out), color .2s, background .2s;
}
.case-card:hover .go { transform: translateX(3px); color: var(--brand); background: var(--brand-soft); }
.case-card .go svg { width: 18px; height: 18px; }

/* side panel */
.panel {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 20px; box-shadow: var(--shadow-sm);
}
.panel + .panel { margin-top: 16px; }
.panel h3 { margin: 0 0 4px; font-size: 1.05rem; letter-spacing: -.01em; }
.panel .hint { margin: 0 0 14px; color: var(--muted); font-size: .86rem; }
.domain-row {
  width: 100%; text-align: left; display: block;
  background: transparent; border: 1px solid transparent; border-radius: 12px;
  padding: 10px 10px; margin: 0 -10px; width: calc(100% + 20px);
  transition: background .2s var(--ease), border-color .2s var(--ease);
}
.domain-row:hover { background: var(--surface-2); border-color: var(--line); }
.domain-row .r1 { display: flex; align-items: center; gap: 10px; }
.domain-row .dot { width: 10px; height: 10px; border-radius: 3px; background: var(--d); flex: none; }
.domain-row .nm { font-weight: 600; font-size: .9rem; flex: 1; min-width: 0; }
.domain-row .pct { font-size: .82rem; font-weight: 650; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.domain-row .r2 { display: flex; align-items: center; gap: 10px; margin-top: 7px; padding-left: 20px; }
.domain-row .track { position: relative; flex: 1; height: 7px; border-radius: 999px; background: var(--surface-3); overflow: hidden; }
.domain-row .track i { position: absolute; inset: 0 auto 0 0; width: 0; border-radius: inherit; background: var(--d); transition: width 1.1s var(--ease-out); }
.domain-row .meta { font-size: .74rem; color: var(--muted); white-space: nowrap; font-variant-numeric: tabular-nums; }
.quick-list { display: grid; gap: 8px; }
.quick {
  display: flex; align-items: center; gap: 12px; width: 100%; text-align: left;
  padding: 12px 14px; border-radius: 12px; border: 1px solid var(--line);
  background: var(--surface-2);
  transition: border-color .2s var(--ease), background .2s var(--ease), transform .2s var(--ease);
}
.quick:hover { border-color: var(--brand); background: var(--surface); transform: translateX(2px); }
.quick[disabled] { opacity: .5; pointer-events: none; }
.quick .ic { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; background: var(--brand-soft); color: var(--brand); flex: none; }
.quick .ic svg { width: 18px; height: 18px; }
.quick .t { flex: 1; min-width: 0; }
.quick .t b { display: block; font-size: .92rem; }
.quick .t span { font-size: .8rem; color: var(--muted); }
.quick .n { font-weight: 700; font-size: .85rem; color: var(--ink-2); font-variant-numeric: tabular-nums; }

.empty-note { color: var(--muted); font-size: .9rem; padding: 24px; text-align: center; border: 1px dashed var(--line-2); border-radius: var(--radius); }

/* ==========================================================================
   RUN (question view)
   ========================================================================== */
.runbar {
  position: sticky; top: var(--topbar-h); z-index: 30;
  background: color-mix(in srgb, var(--bg) 86%, transparent);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid color-mix(in srgb, var(--line) 70%, transparent);
}
.runbar .wrap { display: flex; align-items: center; gap: 10px; min-height: 58px; }
.runbar .title { flex: 1; min-width: 0; }
.runbar .title b { display: block; font-size: .95rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.runbar .title span { font-size: .8rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.timer {
  display: inline-flex; align-items: center; gap: 6px;
  font-variant-numeric: tabular-nums; font-size: .85rem; font-weight: 600; color: var(--ink-2);
  padding: 6px 10px; border-radius: 10px; background: var(--surface); border: 1px solid var(--line);
  transition: color .3s, background .3s, border-color .3s;
}
.timer svg { width: 15px; height: 15px; }
.timer.over { color: var(--amber); background: var(--amber-bg); border-color: color-mix(in srgb, var(--amber) 30%, transparent); }
.timer.stopped { opacity: .65; }
.flag-btn[aria-pressed="true"] { color: var(--amber); background: var(--amber-bg); border-color: color-mix(in srgb, var(--amber) 30%, transparent); }
.flag-btn[aria-pressed="true"] svg { fill: currentColor; }
.progress { height: 3px; background: var(--line); position: relative; overflow: hidden; }
.progress i { position: absolute; inset: 0 auto 0 0; width: 0; background: linear-gradient(90deg, var(--brand), color-mix(in srgb, var(--brand) 60%, var(--dB))); transition: width .6s var(--ease-out); }
.dots { display: none; gap: 5px; align-items: center; }
@media (min-width: 720px) { .dots { display: flex; } }
.dots i { width: 8px; height: 8px; border-radius: 50%; background: var(--line-2); transition: background .3s var(--ease), transform .3s var(--spring); }
.dots i.cur { background: var(--ink); transform: scale(1.25); }
.dots i.ok { background: var(--ok); }
.dots i.bad { background: var(--bad); }

.run-grid { display: grid; gap: 18px; padding: 20px 0 64px; }
@media (min-width: 980px) { .run-grid { grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: 28px; padding-top: 28px; } }

/* case panel */
.case-panel {
  align-self: start;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow-sm); overflow: hidden;
}
@media (min-width: 980px) {
  .case-panel { position: sticky; top: calc(var(--topbar-h) + 58px + 24px); max-height: calc(100vh - var(--topbar-h) - 58px - 48px); overflow: auto; }
}
.case-panel.swap { animation: viewIn .5s var(--ease-out) both; }
.case-head {
  width: 100%; text-align: left; display: flex; align-items: flex-start; gap: 12px;
  padding: 18px 20px 14px; background: transparent; border: 0; cursor: default;
}
.case-head .txt { flex: 1; min-width: 0; }
.case-label { font-size: .72rem; font-weight: 700; letter-spacing: .09em; text-transform: uppercase; color: var(--brand); }
.case-title { font-size: 1.02rem; font-weight: 700; letter-spacing: .01em; margin-top: 6px; line-height: 1.35; text-transform: uppercase; }
.case-title .k { color: var(--muted); font-weight: 650; }
.case-title.is-situation { text-transform: none; font-size: 1.05rem; letter-spacing: -.005em; font-weight: 650; }
.case-title.is-situation .k { text-transform: uppercase; font-size: .9rem; letter-spacing: .02em; }
.case-toggle { display: none; width: 30px; height: 30px; border-radius: 9px; place-items: center; color: var(--muted); background: var(--surface-3); transition: transform .35s var(--ease-out); flex: none; }
.case-toggle svg { width: 16px; height: 16px; }
.case-tags { display: flex; gap: 6px; flex-wrap: wrap; padding: 0 20px 14px; }
.case-hint { display: none; font-size: .8rem; font-weight: 550; color: var(--brand); margin-top: 6px; }
.case-body { display: grid; grid-template-rows: 1fr; transition: grid-template-rows .45s var(--ease-out); }
.case-body > div { overflow: hidden; }
.case-summary { padding: 14px 20px 20px; border-top: 1px solid var(--line); }
.case-summary h4 { margin: 0 0 8px; font-size: .78rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.case-summary ul { margin: 0; padding: 0; list-style: none; display: grid; gap: 9px; }
.case-summary li { position: relative; padding-left: 18px; color: var(--ink-2); font-size: .95rem; line-height: 1.55; }
.case-summary li::before { content: ""; position: absolute; left: 2px; top: .62em; width: 6px; height: 6px; border-radius: 50%; background: color-mix(in srgb, var(--brand) 70%, var(--line-2)); }

@media (max-width: 979px) {
  .case-head { cursor: pointer; }
  .case-toggle { display: grid; }
  .case-panel.collapsed .case-body { grid-template-rows: 0fr; }
  .case-panel.collapsed .case-toggle { transform: rotate(-90deg); }
  .case-panel.collapsed .case-hint { display: block; }
}

/* question card */
.q-stage { position: relative; min-width: 0; }
.q-card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow-md); padding: 22px 20px 20px;
}
@media (min-width: 720px) { .q-card { padding: 28px 28px 24px; } }
.q-card.enter { animation: qIn .5s var(--ease-out) both; }
.q-card.enter-back { animation: qInBack .5s var(--ease-out) both; }
.q-card.exit { animation: qOut .2s var(--ease) both; }
.q-card.exit-back { animation: qOutBack .2s var(--ease) both; }
@keyframes qIn { from { opacity: 0; transform: translateX(28px); } to { opacity: 1; transform: none; } }
@keyframes qInBack { from { opacity: 0; transform: translateX(-28px); } to { opacity: 1; transform: none; } }
@keyframes qOut { to { opacity: 0; transform: translateX(-22px); } }
@keyframes qOutBack { to { opacity: 0; transform: translateX(22px); } }

.q-meta { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
.q-num { font-size: .76rem; font-weight: 700; letter-spacing: .09em; text-transform: uppercase; color: var(--muted); }
.q-stem { font-size: 1.14rem; line-height: 1.55; font-weight: 520; letter-spacing: -.008em; margin: 0 0 20px; text-wrap: pretty; }
@media (min-width: 720px) { .q-stem { font-size: 1.22rem; } }
.q-stem .kw { font-weight: 750; color: var(--ink); background: linear-gradient(transparent 62%, color-mix(in srgb, var(--brand) 22%, transparent) 62%); padding: 0 1px; }

.opts { display: grid; gap: 10px; margin: 0; padding: 0; list-style: none; }
.opt {
  --o-line: var(--line-2); --o-bg: var(--surface); --o-num-bg: var(--surface-3); --o-num-ink: var(--ink-2);
  position: relative; width: 100%; text-align: left;
  display: grid; grid-template-columns: 34px minmax(0, 1fr) auto; align-items: start; gap: 12px;
  padding: 13px 14px; border-radius: 14px;
  border: 1.5px solid var(--o-line); background: var(--o-bg);
  font-size: 1rem; line-height: 1.5; color: var(--ink);
  animation: rise .5s var(--ease-out) both; animation-delay: calc(80ms + var(--i, 0) * 55ms);
  transition: border-color .22s var(--ease), background .22s var(--ease), box-shadow .22s var(--ease), transform .18s var(--ease), opacity .35s var(--ease);
}
.opt:hover { border-color: color-mix(in srgb, var(--brand) 55%, var(--line-2)); box-shadow: var(--shadow-sm); transform: translateY(-1px); }
.opt:active { transform: scale(.992); }
.opt-num {
  width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center;
  background: var(--o-num-bg); color: var(--o-num-ink); font-weight: 700; font-size: .92rem;
  transition: background .22s var(--ease), color .22s var(--ease), transform .35s var(--spring);
}
.opt-text { padding-top: 5px; }
.opt-mark { width: 26px; height: 26px; margin-top: 4px; display: grid; place-items: center; }
.opt-mark svg { width: 22px; height: 22px; }
.opt.selected { --o-line: var(--brand); --o-bg: color-mix(in srgb, var(--brand) 7%, var(--surface)); --o-num-bg: var(--brand); --o-num-ink: var(--brand-ink); box-shadow: 0 0 0 4px color-mix(in srgb, var(--brand) 14%, transparent); }
.opt.selected .opt-num { transform: scale(1.06); }

.answered .opt { cursor: default; }
.answered .opt:hover { transform: none; box-shadow: none; }
.answered .opt:not(.correct):not(.wrong) { opacity: .62; }
.opt.correct { --o-line: var(--ok); --o-bg: var(--ok-bg); --o-num-bg: var(--ok); --o-num-ink: var(--on-solid); animation: pop .55s var(--spring) both; }
.opt.wrong { --o-line: var(--bad); --o-bg: var(--bad-bg); --o-num-bg: var(--bad); --o-num-ink: var(--on-solid); animation: shake .45s var(--ease) both; }
.opt.correct .opt-mark { color: var(--ok); }
.opt.wrong .opt-mark { color: var(--bad); }
.opt-tag { grid-column: 2 / -1; justify-self: start; margin-top: -2px; font-size: .72rem; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; }
.opt.correct .opt-tag { color: var(--ok); }
.opt.wrong .opt-tag { color: var(--bad); }
@keyframes pop { 0% { transform: scale(1); } 40% { transform: scale(1.018); } 100% { transform: scale(1); } }
@keyframes shake { 0%, 100% { transform: translateX(0); } 20% { transform: translateX(-5px); } 40% { transform: translateX(5px); } 60% { transform: translateX(-3px); } 80% { transform: translateX(2px); } }
.draw path { stroke-dasharray: 30; stroke-dashoffset: 30; animation: draw .5s .15s var(--ease-out) forwards; }
@keyframes draw { to { stroke-dashoffset: 0; } }

.q-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 20px; }
.q-actions .spacer { flex: 1; }
.kbd-hint { font-size: .78rem; color: var(--muted); display: none; align-items: center; gap: 6px; }
@media (min-width: 720px) and (hover: hover) { .kbd-hint { display: inline-flex; } }

/* feedback */
.feedback { display: grid; grid-template-rows: 0fr; transition: grid-template-rows .6s var(--ease-out); }
.feedback.open { grid-template-rows: 1fr; }
.feedback > .fb-inner { overflow: hidden; min-height: 0; }
.fb-pad { padding-top: 22px; display: grid; gap: 14px; }
.fb-pad > * { opacity: 0; transform: translateY(10px); transition: opacity .5s var(--ease-out), transform .5s var(--ease-out); transition-delay: calc(120ms + var(--s, 0) * 80ms); }
.feedback.open .fb-pad > * { opacity: 1; transform: none; }

.verdict {
  display: flex; align-items: center; gap: 14px;
  padding: 14px 16px; border-radius: 14px; border: 1px solid;
}
.verdict.ok { background: var(--ok-bg); border-color: var(--ok-line); }
.verdict.bad { background: var(--bad-bg); border-color: var(--bad-line); }
.verdict .badge { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; flex: none; color: var(--on-solid); }
.verdict.ok .badge { background: var(--ok); }
.verdict.bad .badge { background: var(--bad); }
.verdict .badge svg { width: 22px; height: 22px; }
.verdict b { display: block; font-size: 1.05rem; }
.verdict span { font-size: .92rem; color: var(--ink-2); }

.why {
  border: 1px solid var(--line); border-radius: 14px; padding: 14px 16px; background: var(--surface-2);
}
.why h5 { margin: 0 0 8px; font-size: .74rem; font-weight: 750; letter-spacing: .08em; text-transform: uppercase; display: flex; align-items: center; gap: 8px; }
.why.best h5 { color: var(--ok); }
.why.yours h5 { color: var(--bad); }
.why.others h5 { color: var(--muted); }
.why .quote { font-weight: 600; margin: 0 0 6px; }
.why p { margin: 0; color: var(--ink-2); }
.why.best { border-color: var(--ok-line); background: color-mix(in srgb, var(--ok-bg) 60%, var(--surface)); }
.why.yours { border-color: var(--bad-line); background: color-mix(in srgb, var(--bad-bg) 55%, var(--surface)); }
.why .num { display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 6px; font-size: .75rem; font-weight: 750; background: var(--surface-3); color: var(--ink-2); margin-right: 8px; flex: none; }
.why.best .num { background: var(--ok); color: var(--on-solid); }
.why.yours .num { background: var(--bad); color: var(--on-solid); }
.other-item { display: grid; gap: 4px; padding: 12px 0; border-top: 1px dashed var(--line-2); }
.other-item:first-of-type { border-top: 0; padding-top: 2px; }
.other-item .quote { display: flex; align-items: flex-start; }

.pearl {
  display: flex; gap: 12px; align-items: flex-start;
  padding: 14px 16px; border-radius: 14px;
  background: linear-gradient(135deg, color-mix(in srgb, var(--brand) 12%, var(--surface)), color-mix(in srgb, var(--dB) 8%, var(--surface)));
  border: 1px solid color-mix(in srgb, var(--brand) 25%, var(--line));
}
.pearl .ic { color: var(--brand); flex: none; margin-top: 2px; }
.pearl .ic svg { width: 20px; height: 20px; }
.pearl b { display: block; font-size: .74rem; letter-spacing: .08em; text-transform: uppercase; color: var(--brand); margin-bottom: 2px; }
.pearl p { margin: 0; font-weight: 550; }

.meta-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.dchip {
  --d: var(--brand);
  display: inline-flex; align-items: center; gap: 7px;
  font-size: .78rem; font-weight: 650; padding: 5px 11px; border-radius: 999px;
  color: var(--d); background: color-mix(in srgb, var(--d) 11%, transparent);
  border: 1px solid color-mix(in srgb, var(--d) 28%, transparent);
}
.dchip i { width: 7px; height: 7px; border-radius: 2px; background: var(--d); }
.comp-line { font-size: .84rem; color: var(--muted); width: 100%; }
.comp-line b { color: var(--ink-2); font-weight: 650; }

/* ==========================================================================
   SUMMARY
   ========================================================================== */
.summary { padding: 36px 0 72px; max-width: 860px; margin: 0 auto; }
.score-card {
  display: grid; gap: 24px; align-items: center;
  background: var(--surface); border: 1px solid var(--line); border-radius: 22px;
  padding: 26px; box-shadow: var(--shadow-lg); position: relative; overflow: hidden;
}
@media (min-width: 720px) { .score-card { grid-template-columns: 180px minmax(0, 1fr); padding: 32px; } }
.score-card::before {
  content: ""; position: absolute; inset: -120px -120px auto auto; width: 320px; height: 320px; border-radius: 50%;
  background: radial-gradient(circle, color-mix(in srgb, var(--brand) 16%, transparent), transparent 70%);
}
.ring-wrap { position: relative; width: 170px; height: 170px; margin: 0 auto; }
.ring { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring circle { fill: none; stroke-width: 12; }
.ring .trk { stroke: var(--surface-3); }
.ring .val { stroke: url(#ringGrad); stroke-linecap: round; transition: stroke-dashoffset 1.4s var(--ease-out) .2s; }
.ring-label { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; }
.ring-label b { font-family: var(--font-display); font-size: 2.6rem; font-weight: 600; letter-spacing: -.03em; line-height: 1; }
.ring-label span { font-size: .82rem; color: var(--muted); margin-top: 4px; }
.score-card h1 { font-family: var(--font-display); font-weight: 600; font-size: clamp(1.7rem, 4vw, 2.3rem); letter-spacing: -.02em; margin: 6px 0 8px; line-height: 1.1; }
.score-card p { margin: 0; color: var(--ink-2); }
.score-meta { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.score-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 22px; position: relative; }

.review-list { margin-top: 28px; display: grid; gap: 10px; }
.review-item { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; overflow: hidden; box-shadow: var(--shadow-sm); }
.review-item > button {
  width: 100%; text-align: left; display: flex; align-items: center; gap: 12px;
  padding: 14px 16px; background: transparent; border: 0;
}
.review-item .st { width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; flex: none; color: var(--on-solid); }
.review-item .st.ok { background: var(--ok); }
.review-item .st.bad { background: var(--bad); }
.review-item .st.skip { background: var(--line-2); }
.review-item .st svg { width: 17px; height: 17px; }
.review-item .rt { flex: 1; min-width: 0; }
.review-item .rt small { display: block; font-size: .74rem; font-weight: 700; color: var(--muted); letter-spacing: .06em; text-transform: uppercase; }
.review-item .rt span { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 550; }
.review-item .chev { color: var(--muted); transition: transform .35s var(--ease-out); flex: none; }
.review-item .chev svg { width: 18px; height: 18px; }
.review-item.open .chev { transform: rotate(180deg); }
.review-body { display: grid; grid-template-rows: 0fr; transition: grid-template-rows .45s var(--ease-out); }
.review-item.open .review-body { grid-template-rows: 1fr; }
.review-body > div { overflow: hidden; }
.review-body .inner { padding: 0 16px 16px; display: grid; gap: 10px; }
.review-body .stem { margin: 0; font-weight: 550; }

/* ==========================================================================
   DIALOG / TOAST / FOOTER
   ========================================================================== */
dialog.sheet {
  border: 1px solid var(--line); border-radius: 20px; padding: 0; width: min(440px, calc(100vw - 32px));
  background: var(--surface); color: var(--ink); box-shadow: var(--shadow-lg);
}
dialog.sheet[open] { animation: dlgIn .35s var(--ease-out) both; }
dialog.sheet::backdrop { background: rgba(10, 16, 15, .38); backdrop-filter: blur(3px); animation: fade .3s var(--ease) both; }
@keyframes dlgIn { from { opacity: 0; transform: translateY(12px) scale(.98); } to { opacity: 1; transform: none; } }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
.sheet-head { display: flex; align-items: center; justify-content: space-between; padding: 18px 20px 6px; }
.sheet-head h2 { margin: 0; font-size: 1.15rem; }
.sheet-body { padding: 8px 20px 20px; display: grid; gap: 18px; }
.setting { display: grid; gap: 8px; }
.setting > label, .setting > .lbl { font-weight: 600; font-size: .92rem; }
.setting .desc { font-size: .82rem; color: var(--muted); margin-top: -4px; }
.seg { display: grid; grid-template-columns: repeat(3, 1fr); background: var(--surface-3); border-radius: 12px; padding: 4px; gap: 4px; }
.seg button { border: 0; background: transparent; border-radius: 9px; padding: 8px 6px; font-size: .86rem; font-weight: 600; color: var(--ink-2); transition: background .2s var(--ease), color .2s var(--ease), box-shadow .2s; }
.seg button[aria-pressed="true"] { background: var(--surface); color: var(--ink); box-shadow: var(--shadow-sm); }
.switch-row { display: flex; align-items: center; justify-content: space-between; gap: 14px; }
.switch { position: relative; width: 46px; height: 28px; flex: none; }
.switch input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; }
.switch span { position: absolute; inset: 0; border-radius: 999px; background: var(--line-2); transition: background .25s var(--ease); pointer-events: none; }
.switch span::after { content: ""; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.25); transition: transform .3s var(--spring); }
.switch input:checked + span { background: var(--brand); }
.switch input:checked + span::after { transform: translateX(18px); }
.switch input:focus-visible + span { outline: 2.5px solid var(--focus); outline-offset: 2px; }
.danger-btn { color: var(--bad); border-color: var(--bad-line); }

.toast {
  position: fixed; left: 50%; bottom: 24px; z-index: 80;
  transform: translate(-50%, 20px); opacity: 0;
  background: var(--ink); color: var(--bg); padding: 10px 16px; border-radius: 12px;
  font-size: .9rem; font-weight: 550; box-shadow: var(--shadow-lg);
  transition: opacity .3s var(--ease), transform .4s var(--spring);
  pointer-events: none; max-width: calc(100vw - 32px);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

.site-foot { border-top: 1px solid var(--line); padding: 22px 0 30px; color: var(--muted); font-size: .8rem; }
.site-foot .wrap { display: flex; flex-wrap: wrap; gap: 8px 20px; justify-content: space-between; }
.site-foot p { margin: 0; max-width: 70ch; }

#confetti { position: fixed; inset: 0; pointer-events: none; z-index: 90; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-delay: 0ms !important; transition-duration: .001ms !important; transition-delay: 0ms !important; scroll-behavior: auto !important; }
}
