/* Layout: same shell as twimoon LSAT. Top bar, one question card per screen, a sticky Next bar; settings slide in from the right. */
:root {
  --bg: #f3f4f8;
  --surface: #ffffff;
  --ink: #1a1d2b;
  --muted: #5d6378;
  --line: #dfe2ea;
  --stim: #eceef5;
  --accent: #4a46a8;
  --accent-ink: #ffffff;
  --right: #23805a;
  --right-soft: #e3f3ea;
  --wrong: #b5443a;
  --wrong-soft: #f8e6e3;
  --font-ui: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-math: "IBM Plex Mono", ui-monospace, Menlo, monospace;
  --fs: 17px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #12131c; --surface: #1a1c28; --ink: #e6e8f0; --muted: #9ba1b5; --line: #2b2e3d; --stim: #222534;
    --accent: #a7a3ff; --accent-ink: #12131c; --right: #6fcf9f; --right-soft: #183427; --wrong: #ef8f86; --wrong-soft: #3a2220;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #12131c; --surface: #1a1c28; --ink: #e6e8f0; --muted: #9ba1b5; --line: #2b2e3d; --stim: #222534;
  --accent: #a7a3ff; --accent-ink: #12131c; --right: #6fcf9f; --right-soft: #183427; --wrong: #ef8f86; --wrong-soft: #3a2220;
  color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font-family: var(--font-ui); font-size: var(--fs); line-height: 1.5;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
  padding-block: 0 112px;
}
body::before { content: ""; position: fixed; inset: 0 0 auto; height: env(safe-area-inset-top, 0px); z-index: 10; background: var(--bg); }
button { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.bar {
  position: sticky; top: env(safe-area-inset-top, 0px); z-index: 5; background: var(--bg);
  max-width: 680px; margin: 0 auto; display: flex; align-items: center; gap: 12px; padding-block: 10px;
}
.brand { font-weight: 600; letter-spacing: 0.01em; font-size: 0.95em; white-space: nowrap; }
.brand span { color: var(--accent); }
.step { flex: 1; min-width: 0; text-align: center; font-size: 0.78em; color: var(--muted); letter-spacing: 0.06em; text-transform: uppercase; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.menu-btn { width: 44px; height: 44px; border: 1px solid var(--line); background: var(--surface); border-radius: 10px; display: grid; place-content: center; gap: 4px; cursor: pointer; }
.menu-btn span { display: block; width: 18px; height: 2px; background: var(--ink); border-radius: 2px; }

.screen { max-width: 680px; margin: 0 auto; display: grid; gap: 14px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 16px; display: grid; gap: 14px; min-width: 0; }
.type-tag { margin: 0; font-size: 0.78em; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); }
.stim { margin: 0; background: var(--stim); border-radius: 10px; padding: 14px 16px; font-size: 1.06em; line-height: 1.6; overflow-wrap: anywhere; }
.choices { display: grid; gap: 8px; }
.choice {
  width: 100%; min-height: 52px; padding: 12px 14px; text-align: left; cursor: pointer;
  background: var(--surface); border: 1.5px solid var(--line); border-radius: 12px; line-height: 1.35;
  font-variant-numeric: tabular-nums;
}
.choice:hover:not(:disabled) { border-color: var(--accent); }
.choice:disabled { cursor: default; }
.choice.right { border-color: var(--right); background: var(--right-soft); }
.choice.wrong { border-color: var(--wrong); background: var(--wrong-soft); }
.choice.right::after { content: " ✅"; }
.choice.wrong::after { content: " ❌"; }
.choice .ltr { font-weight: 600; margin-right: 10px; color: var(--muted); }
.verdict { margin: 0; font-weight: 700; font-size: 1.05em; }
.verdict.right { color: var(--right); }
.verdict.wrong { color: var(--wrong); }
.empty { margin: 0; color: var(--muted); }

.next-bar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 6;
  padding: 12px max(16px, env(safe-area-inset-right, 0px)) calc(12px + env(safe-area-inset-bottom, 0px)) max(16px, env(safe-area-inset-left, 0px));
  background: linear-gradient(to top, var(--bg) 70%, transparent);
}
.primary {
  display: block; width: 100%; max-width: 680px; margin: 0 auto; min-height: 54px; border: none; border-radius: 14px;
  background: var(--accent); color: var(--accent-ink); font-weight: 600; font-size: 1em; cursor: pointer;
}

.lesson h2 { margin: 0; font-size: 1.3em; line-height: 1.2; text-wrap: balance; }
.lesson dl { margin: 0; display: grid; gap: 12px; }
.lesson dt { font-size: 0.72em; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
.lesson dd { margin: 3px 0 0; min-width: 0; }

.know-btn { min-height: 44px; padding: 0 14px; border: 1.5px solid var(--accent); background: var(--accent); color: var(--accent-ink); border-radius: 10px; font-weight: 600; font-size: 0.85em; cursor: pointer; white-space: nowrap; }
.know { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; font-size: 1.15em; }
.know th { font-size: 0.6em; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); text-align: left; padding: 0 8px 8px; font-weight: 600; }
.know td { padding: 10px 8px; border-top: 1px solid var(--line); font-weight: 600; }

.know { table-layout: fixed; }
.know td { height: 2.6em; }
.drill-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.drill-time { margin: 0; font-weight: 700; font-size: 1.15em; font-variant-numeric: tabular-nums; }
.drill-note { margin: 0; color: var(--muted); }
.drill-in { width: 100%; min-width: 0; font: inherit; font-weight: 600; padding: 4px 8px; border: 2px solid var(--accent); border-radius: 8px; background: var(--surface); color: var(--ink); }
.drill-results { margin: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.drill-results dd { margin: 3px 0 0; font-size: 2.2em; font-weight: 700; font-variant-numeric: tabular-nums; }
@keyframes glowRight { from { background: var(--right-soft); } to { background: transparent; } }
@keyframes glowWrong { from { background: var(--wrong-soft); } to { background: transparent; } }
.know tr.flash-right td { animation: glowRight 1s ease-out; }
.know tr.flash-wrong td { animation: glowWrong 1.6s ease-out; }
.know tr.slow td { animation-duration: 2.4s; }
.drill-btn { justify-self: start; min-height: 44px; padding: 0 18px; border: 1.5px solid var(--accent); background: var(--surface); color: var(--accent); border-radius: 10px; font-weight: 600; cursor: pointer; }

.site-foot { max-width: 680px; margin: 24px auto 0; display: flex; justify-content: center; gap: 12px; flex-wrap: wrap; font-size: 0.75em; color: var(--muted); }

.scrim { position: fixed; inset: 0; background: rgb(0 0 0 / 0.35); z-index: 20; }
.menu {
  position: fixed; top: 0; right: 0; bottom: 0; z-index: 21; width: min(340px, 88vw); overflow-y: auto;
  background: var(--surface); border-left: 1px solid var(--line);
  padding: calc(14px + env(safe-area-inset-top, 0px)) calc(18px + env(safe-area-inset-right, 0px)) calc(24px + env(safe-area-inset-bottom, 0px)) 18px;
  display: grid; align-content: start; gap: 18px;
}
.menu-head { display: flex; justify-content: space-between; align-items: center; }
.menu-head h2 { margin: 0; font-size: 1.1em; }
.close { width: 44px; height: 44px; border: none; background: none; font-size: 1.1em; cursor: pointer; }
fieldset { border: none; margin: 0; padding: 0; display: grid; gap: 4px; }
legend { font-size: 0.72em; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); margin-bottom: 4px; padding: 0; }
fieldset > label { display: flex; align-items: center; gap: 10px; min-height: 40px; cursor: pointer; }
input[type="radio"] { accent-color: var(--accent); width: 18px; height: 18px; margin: 0; }

@media (prefers-reduced-motion: no-preference) {
  .card { animation: rise 180ms ease-out; }
  @keyframes rise { from { transform: translateY(6px); opacity: 0.6; } to { transform: none; opacity: 1; } }
}
