:root {
  --bg-primary: #0a0a0f;
  --bg-secondary: #14141f;
  --bg-tertiary: #1e1e2e;
  --text-primary: #ffffff;
  --text-secondary: #a0a0b0;
  --text-muted: #606070;
  --accent: #00d4ff;
  --accent-secondary: #00ff88;
  --danger: #ff4466;
  --focus-ring: #00d4ff;
  --focus-glow: rgba(0, 212, 255, 0.4);
  --radius-md: 12px;
}
* { margin: 0; padding: 0; box-sizing: border-box; }
html, body {
  width: 600px; height: 600px; overflow: hidden;
  background: #000;
  color: var(--text-primary);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}
#app { width: 100%; height: 100%; position: relative; }
.screen { width: 100%; height: 100%; position: absolute; top: 0; left: 0; display: flex; flex-direction: column; }
.screen.hidden { display: none; }
.focusable { transition: all 0.15s ease; border: 2px solid transparent; cursor: pointer; outline: none; }
.focusable:focus { border-color: var(--focus-ring); box-shadow: 0 0 20px var(--focus-glow); }
.hidden { display: none !important; }

/* ===== HOME ===== */
.home-content {
  flex: 1; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 18px; padding: 32px;
}
.title {
  font-size: 60px; font-weight: 800; letter-spacing: 4px;
  color: var(--text-primary); text-shadow: 0 0 24px var(--focus-glow);
}
.op-row { display: flex; gap: 24px; }
.op-deco { font-size: 44px; font-weight: 700; color: var(--accent); }
.op-deco.accent2 { color: var(--accent-secondary); }
.subtitle { font-size: 20px; color: var(--text-secondary); }
.menu { display: flex; flex-direction: column; gap: 14px; width: 360px; margin-top: 8px; }

.menu-btn {
  height: 72px; border-radius: var(--radius-md);
  background: var(--bg-tertiary); color: var(--text-primary);
  font-size: 24px; font-weight: 700; letter-spacing: 2px;
  display: flex; align-items: center; justify-content: center;
}
.menu-btn.primary { background: linear-gradient(135deg, #0a4a5a, #0a6a44); }

/* ===== BARS / HEADERS ===== */
.bar {
  height: 72px; background: var(--bg-secondary);
  display: flex; align-items: center; padding: 0 28px;
  border-bottom: 2px solid var(--bg-tertiary);
}
.bar-title { font-size: 26px; font-weight: 800; letter-spacing: 3px; color: var(--text-primary); }

/* ===== SETUP ===== */
.setup-body {
  flex: 1; display: flex; flex-direction: column;
  justify-content: center; gap: 22px; padding: 24px 36px;
}
.opt-group { display: flex; flex-direction: column; gap: 10px; }
.opt-label { font-size: 16px; font-weight: 700; letter-spacing: 2px; color: var(--text-secondary); }
.chip-row { display: flex; gap: 10px; flex-wrap: wrap; }
.chip {
  min-height: 64px; min-width: 84px; flex: 1;
  border-radius: var(--radius-md); background: var(--bg-tertiary);
  color: var(--text-primary); font-size: 24px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
}
.chip.selected {
  background: linear-gradient(135deg, #0a4a5a, #0a6a44);
  color: #fff; box-shadow: inset 0 0 0 2px var(--accent-secondary);
}
.start-btn { margin-top: 8px; }

/* ===== DRILL ===== */
.hud {
  display: flex; padding: 16px 28px 8px; gap: 12px;
}
.hud-cell {
  flex: 1; display: flex; flex-direction: column; align-items: center;
  background: var(--bg-secondary); border-radius: var(--radius-md); padding: 10px 0;
}
.hud-num { font-size: 34px; font-weight: 800; line-height: 1; }
.hud-num.accent2 { color: var(--accent-secondary); }
.hud-cap { font-size: 13px; letter-spacing: 2px; color: var(--text-muted); margin-top: 4px; }

.time-track {
  height: 12px; margin: 4px 28px 0; border-radius: 6px;
  background: var(--bg-tertiary); overflow: hidden;
}
.time-fill {
  height: 100%; width: 100%; border-radius: 6px;
  background: var(--accent); transition: width 0.12s linear;
}
.time-fill.low { background: var(--danger); }

.quiz {
  flex: 1; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 6px;
}
.question { font-size: 76px; font-weight: 800; letter-spacing: 2px; }
.eq { font-size: 40px; font-weight: 700; color: var(--text-secondary); }

.answers {
  display: grid; grid-template-columns: 1fr 1fr; gap: 14px;
  padding: 0 28px 12px;
}
.answer {
  height: 92px; border-radius: var(--radius-md);
  background: var(--bg-tertiary); color: var(--text-primary);
  font-size: 38px; font-weight: 800;
  display: flex; align-items: center; justify-content: center;
}
.answer.correct {
  background: rgba(0,255,136,0.18);
  border-color: var(--accent-secondary);
  box-shadow: 0 0 20px rgba(0,255,136,0.4);
}
.answer.wrong {
  background: rgba(255,68,102,0.18);
  border-color: var(--danger);
  box-shadow: 0 0 20px rgba(255,68,102,0.4);
}
.quit-btn {
  height: 50px; margin: 0 28px 18px; border-radius: var(--radius-md);
  background: var(--bg-secondary); color: var(--text-secondary);
  font-size: 16px; font-weight: 700; letter-spacing: 3px;
  display: flex; align-items: center; justify-content: center;
}

.countdown {
  position: absolute; inset: 0; background: rgba(0,0,0,0.85);
  display: flex; align-items: center; justify-content: center;
}
.countdown span {
  font-size: 160px; font-weight: 900; color: var(--accent);
  text-shadow: 0 0 40px var(--focus-glow);
}

/* ===== RESULTS ===== */
.results-body {
  flex: 1; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 12px; padding: 24px 32px;
}
.best-badge {
  font-size: 22px; font-weight: 800; letter-spacing: 2px;
  color: #000; background: var(--accent-secondary);
  padding: 8px 22px; border-radius: 999px;
}
.big-score { font-size: 96px; font-weight: 900; line-height: 1; color: var(--accent); text-shadow: 0 0 30px var(--focus-glow); }
.big-cap { font-size: 18px; letter-spacing: 4px; color: var(--text-muted); margin-bottom: 6px; }
.res-grid { display: flex; gap: 12px; width: 100%; }
.res-stat {
  flex: 1; display: flex; flex-direction: column; align-items: center;
  background: var(--bg-secondary); border-radius: var(--radius-md); padding: 16px 6px;
}
.res-val { font-size: 32px; font-weight: 800; }
.res-lab { font-size: 13px; letter-spacing: 1px; color: var(--text-muted); margin-top: 4px; text-align: center; }
.results-body .menu { width: 380px; margin-top: 10px; }

/* ===== INFO (howto / stats) ===== */
.info-body {
  flex: 1; display: flex; flex-direction: column;
  justify-content: center; gap: 18px; padding: 28px 40px;
}
.info-line { font-size: 22px; color: var(--text-primary); display: flex; align-items: center; gap: 16px; }
.key {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 88px; height: 44px; padding: 0 10px;
  background: var(--bg-tertiary); border-radius: 8px;
  font-size: 18px; font-weight: 700; color: var(--accent);
}
.rule { border: none; border-top: 1px solid var(--bg-tertiary); }
.info-text { font-size: 19px; line-height: 1.5; color: var(--text-secondary); }
.stat-grid { flex-wrap: wrap; }
.stat-grid .res-stat { min-width: 240px; flex: 1 1 40%; }
.info-body .menu { width: 100%; margin-top: 4px; }
