:root {
  --bg: #f4f5fa;
  --panel: #ffffff;
  --panel-2: #eceef6;
  --ink: #141726;
  --muted: #5d6378;
  --line: #d9dceb;
  --accent: #5b3df5;
  --accent-ink: #ffffff;
  --pop: #3f8f00;
  --good: #1f8a4c;
  --mid: #b7791f;
  --bad: #c73a3a;
  --box: #5b3df5;
  --shadow: 0 1px 2px rgba(20, 23, 38, .06), 0 4px 16px rgba(20, 23, 38, .06);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #11131c;
    --panel: #1a1d2b;
    --panel-2: #23273a;
    --ink: #eef0f8;
    --muted: #9aa0b8;
    --line: #2e3350;
    --accent: #c6f432;
    --accent-ink: #11131c;
    --pop: #c6f432;
    --good: #4ade80;
    --mid: #fbbf24;
    --bad: #f87171;
    --box: #8b7bff;
    --shadow: none;
  }
}
:root[data-theme="dark"] {
  --bg: #11131c; --panel: #1a1d2b; --panel-2: #23273a; --ink: #eef0f8; --muted: #9aa0b8;
  --line: #2e3350; --accent: #c6f432; --accent-ink: #11131c; --pop: #c6f432; --good: #4ade80;
  --mid: #fbbf24; --bad: #f87171; --box: #8b7bff; --shadow: none;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.5 Inter, system-ui, -apple-system, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
}
#app { max-width: 560px; margin: 0 auto; padding: 16px 16px 48px; padding-top: max(16px, env(safe-area-inset-top)); }
h1, h2, h3, .num { font-family: "Space Grotesk", Inter, sans-serif; letter-spacing: -.01em; }
h1 { font-size: 28px; margin: 0; line-height: 1.1; }
h2 { font-size: 20px; margin: 24px 0 8px; }
h3 { font-size: 17px; margin: 0 0 4px; }
p { margin: 0 0 8px; }
.muted { color: var(--muted); }
.small { font-size: 14px; }

.top { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.chips { display: flex; gap: 8px; }
.chip { background: var(--panel); border: 1px solid var(--line); border-radius: 999px; padding: 6px 12px; font-weight: 600; font-size: 14px; white-space: nowrap; }
.chip b { font-family: "Space Grotesk", sans-serif; }

.card { background: var(--panel); border: 1px solid var(--line); border-radius: 16px; padding: 16px; box-shadow: var(--shadow); margin-bottom: 12px; }
.card.hero { padding: 20px; }
button.card { font-weight: 400; line-height: 1.5; display: block; }
.row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.stack > * + * { margin-top: 8px; }

button, .btn {
  appearance: none; border: 1px solid var(--line); background: var(--panel-2); color: var(--ink);
  font: 600 16px/1 Inter, sans-serif; border-radius: 12px; padding: 14px 16px; min-height: 48px;
  cursor: pointer; width: 100%; text-align: center;
}
button:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
button.primary { background: var(--accent); color: var(--accent-ink); border-color: transparent; font-size: 17px; }
button.link { background: none; border: none; color: var(--muted); width: auto; min-height: 0; padding: 8px 0; font-weight: 500; }
button:disabled { opacity: .45; cursor: default; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.grid3 button { padding: 12px 6px; font-size: 15px; }
.bet-sure { border-color: var(--accent); }
.g-got { border-color: var(--good); }
.g-part { border-color: var(--mid); }
.g-miss { border-color: var(--bad); }

.bar { height: 8px; background: var(--panel-2); border-radius: 99px; overflow: hidden; }
.bar > span { display: block; height: 100%; background: var(--accent); border-radius: 99px; }

.q { font-size: 20px; line-height: 1.4; font-weight: 600; margin: 8px 0 16px; }
.answer { background: var(--panel-2); border-radius: 12px; padding: 12px 14px; margin: 8px 0; }
.yours { border-left: 3px solid var(--line); padding-left: 10px; color: var(--muted); margin: 8px 0; white-space: pre-wrap; }
textarea { width: 100%; min-height: 72px; border: 1px solid var(--line); background: var(--bg); color: var(--ink); border-radius: 12px; padding: 12px; font: 16px/1.4 Inter, sans-serif; resize: vertical; }
input[type=number] { width: 80px; border: 1px solid var(--line); background: var(--bg); color: var(--ink); border-radius: 10px; padding: 10px; font: 16px Inter, sans-serif; }
.tag { display: inline-block; font-size: 12px; font-weight: 600; padding: 2px 8px; border-radius: 99px; background: var(--panel-2); color: var(--muted); }
.progress-dots { display: flex; gap: 4px; margin-bottom: 8px; }
.progress-dots span { flex: 1; height: 4px; border-radius: 4px; background: var(--panel-2); }
.progress-dots span.done { background: var(--accent); }

.big { font-size: 40px; font-weight: 700; font-family: "Space Grotesk", sans-serif; line-height: 1; }
.pts-good { color: var(--good); } .pts-bad { color: var(--bad); }
.boxes { display: flex; align-items: flex-end; gap: 6px; height: 80px; margin: 8px 0 4px; }
.boxes div { flex: 1; background: var(--box); border-radius: 6px 6px 2px 2px; min-height: 2px; }
.boxlabels { display: flex; gap: 6px; font-size: 12px; color: var(--muted); }
.boxlabels span { flex: 1; text-align: center; }
table { width: 100%; border-collapse: collapse; font-size: 15px; }
td, th { text-align: left; padding: 6px 0; border-bottom: 1px solid var(--line); }
th { font-weight: 600; color: var(--muted); font-size: 13px; }
.days { display: grid; grid-template-columns: repeat(14, 1fr); gap: 4px; }
.days span { aspect-ratio: 1; border-radius: 4px; background: var(--panel-2); }
.days span.on { background: var(--accent); }
.level { font-family: "Space Grotesk", sans-serif; font-weight: 700; }
.check { list-style: none; padding: 0; margin: 8px 0 0; }
.check li { padding: 4px 0; }
.check li::before { content: "○ "; color: var(--muted); }
.check li.ok::before { content: "● "; color: var(--good); }

#toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%) translateY(20px); opacity: 0;
  background: var(--ink); color: var(--bg); padding: 10px 16px; border-radius: 12px; font-weight: 600;
  transition: .2s; pointer-events: none; max-width: calc(100% - 32px);
}
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
@media (prefers-reduced-motion: reduce) { #toast { transition: none; } }
