:root {
  color-scheme: dark;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-synthesis: none;
  font-optical-sizing: auto;
  font-variant-numeric: tabular-nums;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  --bg: #101315;
  --surface: #171b1d;
  --line: #2a3032;
  --line-soft: #22282a;
  --text: #eef0ed;
  --muted: #88918f;
  --faint: #5f6866;
  --accent: #d4fa72;
  --accent-ink: #15190e;
  --good: #a9e38c;
  --bad: #ff8d7a;
}

* { box-sizing: border-box; }
html { min-width: 320px; min-height: 100%; background: var(--bg); }
body { min-width: 320px; min-height: 100vh; margin: 0; color: var(--text); }
button { font: inherit; color: inherit; }
button:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; }
.field:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
::selection { color: var(--accent-ink); background: var(--accent); }

.app-shell { width: min(1240px, calc(100% - 64px)); margin: 0 auto; }
.topbar { height: 74px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--line-soft); }
.brand { display: inline-flex; align-items: center; gap: 11px; color: var(--text); font-size: 14px; font-weight: 650; letter-spacing: -.025em; text-decoration: none; }
.brand-mark { width: 27px; height: 27px; display: grid; place-items: center; border-radius: 8px; background: var(--accent); color: var(--accent-ink); font-size: 14px; font-weight: 800; }
.brand-light { color: #9da5a2; font-weight: 450; }
.status-dot { width: 7px; height: 7px; flex: none; border-radius: 50%; background: var(--faint); }
.layout { display: grid; grid-template-columns: minmax(0, 1fr) 326px; gap: 20px; padding: 32px 0 20px; }
.drill-panel, .side-panel { border: 1px solid var(--line); border-radius: 14px; background: var(--surface); }
.drill-panel { min-width: 0; padding: 25px; }
.sr-only, .mode-picker input { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.mode-picker { display: flex; width: max-content; min-width: 0; gap: 3px; margin: 0 0 11px; padding: 3px; border: 1px solid var(--line); border-radius: 11px; }
.mode-picker label { -webkit-tap-highlight-color: transparent; user-select: none; }
.mode-picker label span { display: grid; min-height: 44px; padding: 0 14px; place-items: center; border-radius: 8px; color: var(--muted); cursor: pointer; font-size: 13px; }
.mode-picker input:checked + span { background: var(--line); color: var(--text); }
.mode-picker input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: -2px; }
.mode-picker:disabled { opacity: .65; }
.mode-picker:disabled label span { cursor: default; }
.panel-heading, .side-heading { display: flex; align-items: center; justify-content: space-between; }
.panel-heading { min-height: 54px; margin-bottom: 22px; }
h1, h2, p { margin-top: 0; }
h1 { margin-bottom: 0; font-size: 22px; font-weight: 620; letter-spacing: -.035em; line-height: 1.15; text-wrap: balance; }
h2 { margin: 0; font-size: 15px; font-weight: 590; letter-spacing: -.015em; line-height: 1.25; text-wrap: balance; }
.round-clock { display: grid; justify-items: end; gap: 1px; padding-left: 18px; }
.clock-label { color: var(--muted); font-size: 12px; }
.clock-value { min-width: 72px; color: var(--text); font-size: 20px; font-weight: 590; letter-spacing: -.035em; text-align: right; white-space: nowrap; }
.field { position: relative; min-height: 438px; overflow: hidden; isolation: isolate; border: 1px solid #30383a; border-radius: 11px; background: #121719; cursor: crosshair; }
.field[data-mode="reaction"] { cursor: default; }
.field-grid { position: absolute; z-index: -1; inset: 0; opacity: .62; pointer-events: none; background-image: linear-gradient(to right, rgba(175, 194, 187, .07) 1px, transparent 1px), linear-gradient(to bottom, rgba(175, 194, 187, .07) 1px, transparent 1px); background-size: 46px 46px; mask-image: radial-gradient(ellipse at center, #000 8%, transparent 82%); }
.field::after { position: absolute; z-index: -1; inset: 0; border-radius: inherit; background: radial-gradient(ellipse at center, transparent 5%, rgba(13, 18, 20, .25) 100%); content: ""; pointer-events: none; }
.field-center { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 20px; text-align: center; transition: opacity 180ms ease, transform 180ms ease; }
.field[data-state="active"] .field-center { opacity: 0; pointer-events: none; transform: scale(.98); }
.round-result { margin-bottom: 13px; color: var(--accent); font-size: 13px; }
.start-button { min-width: 154px; min-height: 48px; padding: 0 18px; display: inline-flex; align-items: center; justify-content: center; gap: 15px; border: 0; border-radius: 8px; background: var(--accent); color: var(--accent-ink); cursor: pointer; font-size: 13px; font-weight: 650; transition: transform 120ms ease, background-color 150ms ease; }
.start-button:hover { background: #e0ff8b; }
.start-button:active { transform: scale(.96); }
.field-hint { max-width: 310px; margin: 14px 0 0; color: var(--muted); font-size: 12px; line-height: 1.5; text-wrap: pretty; }
.target { position: absolute; z-index: 2; width: 54px; height: 54px; display: grid; place-items: center; border: 1px solid var(--accent); border-radius: 50%; background: color-mix(in oklab, var(--accent) 10%, transparent); cursor: crosshair; transform: translate(-50%, -50%); touch-action: manipulation; }
.target[hidden] { display: none; }
.target-ring { width: 22px; height: 22px; display: grid; place-items: center; border-radius: 50%; background: var(--accent); }
.target-ring > span { width: 8px; height: 8px; border-radius: 50%; background: #273019; }
.cue-button { position: absolute; z-index: 2; left: 50%; top: 50%; translate: -50% -50%; touch-action: manipulation; }
.cue-button[hidden] { display: none; }
.cue-button[data-ready="false"] { background: var(--surface); border: 1px solid var(--line); color: var(--text); }
.field-feedback { position: absolute; top: 14px; left: 16px; color: var(--muted); font-size: 11px; pointer-events: none; }
.field-feedback[data-kind="hit"] { color: var(--good); }
.field-feedback[data-kind="miss"] { color: var(--bad); }
.field[data-state="results"] .field-center { opacity: 1; }
.field[data-state="results"] .field-hint { display: none; }
.sidebar { display: flex; flex-direction: column; gap: 14px; }
.side-panel { padding: 19px 20px; }
.side-heading { min-height: 34px; }
.live-state { display: inline-flex; align-items: center; gap: 7px; color: var(--muted); font-size: 12px; }
.live-state[data-state="active"] { color: var(--accent); }
.live-state[data-state="active"] .status-dot { background: var(--accent); box-shadow: 0 0 0 3px rgba(212, 250, 114, .1); }
.live-state[data-state="results"] .status-dot { background: var(--good); }
.stat-list { margin: 18px 0 0; padding: 0; }
.stat-row { min-height: 42px; display: flex; align-items: center; justify-content: space-between; gap: 12px; border-top: 1px solid var(--line-soft); }
.stat-row dt { color: #a3aba8; font-size: 12px; }
.stat-row dd { margin: 0; color: var(--text); font-size: 14px; font-weight: 560; }
.stat-featured dd { color: var(--accent); font-size: 17px; }
.history-heading { margin-bottom: 14px; }
.history-progress { padding: 10px 0; border-top: 1px solid var(--line-soft); font-size: 12px; }
.history-progress p { margin: 0 0 4px; color: var(--muted); }
.history-progress ul { margin: 0; padding: 0; list-style: none; }
.history-progress li + li { margin-top: 3px; }
.history-list { margin: 0; padding: 0; list-style: none; }
.history-item { min-height: 48px; display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 2px 12px; border-top: 1px solid var(--line-soft); }
.history-date { color: var(--muted); font-size: 12px; }
.history-score { grid-row: span 2; color: #d9e0dc; font-size: 13px; font-weight: 580; }
.history-meta { color: var(--muted); font-size: 12px; }
.empty-history { margin: 0; padding: 14px 0 2px; border-top: 1px solid var(--line-soft); color: var(--muted); font-size: 13px; line-height: 1.5; }
.history-list:not(:empty) + .empty-history { display: none; }
.privacy-note { margin: 0; padding: 3px 4px; color: var(--muted); font-size: 12px; }

@media (max-width: 850px) {
  .app-shell { width: min(760px, calc(100% - 36px)); }
  .layout { grid-template-columns: minmax(0, 1fr) 280px; gap: 14px; }
  .drill-panel { padding: 20px; }
  .field { min-height: 400px; }
  .side-panel { padding: 17px; }
}
@media (max-width: 680px) {
  .app-shell { width: calc(100% - 28px); }
  .topbar { height: 64px; }
  .layout { grid-template-columns: 1fr; gap: 12px; padding-top: 18px; }
  .drill-panel { padding: 17px; }
  .panel-heading { margin-bottom: 16px; }
  h1 { font-size: 20px; }
  .field { min-height: min(56vh, 430px); min-height: clamp(300px, 54vh, 430px); }
  .sidebar { display: grid; grid-template-columns: 1fr 1fr; align-items: start; gap: 10px; }
  .side-panel { min-width: 0; padding: 15px; }
  .privacy-note { grid-column: 1 / -1; margin: 0; }
}
@media (max-width: 450px) {
  .sidebar { grid-template-columns: 1fr; }
  .history-panel { min-height: 150px; }
  .history-list { display: grid; grid-template-columns: 1fr 1fr; column-gap: 14px; }
  .history-item:nth-child(2) { border-top: 0; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; }
}
