* { box-sizing: border-box; }
:root {
  --bg: #0f1724;
  --panel: #182433;
  --panel-2: #1f2d3f;
  --ink: #eaf2f8;
  --muted: #93a8ba;
  --accent: #55d6a8;
  --wrong: #ff6b6b;
  --correct: #55d6a8;
  --key: #223140;
}
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--ink); font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; overscroll-behavior: none; -webkit-user-select: none; user-select: none; -webkit-tap-highlight-color: transparent; }
#app { height: 100%; display: flex; flex-direction: column; padding: 12px; gap: 10px; }
.topbar { display: flex; align-items: center; gap: 12px; }
.title { font-size: 18px; font-weight: 700; }
.title small { font-size: 12px; color: var(--muted); font-weight: 400; }
.spacer { flex: 1; }
.hud { display: flex; align-items: center; gap: 6px; background: var(--panel); padding: 6px 12px; border-radius: 8px; font-size: 14px; }
.hud b { color: var(--accent); }
.card { background: var(--panel); border-radius: 12px; padding: 16px; }
.question-card { flex: 1; display: flex; flex-direction: column; gap: 12px; min-height: 0; }
.category { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.5px; }
.question { font-size: 20px; font-weight: 600; line-height: 1.3; }
.options { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; flex: 1; min-height: 0; align-content: start; }
.opt-btn { background: var(--panel-2); color: var(--ink); border: 2px solid transparent; border-radius: 10px; padding: 14px; font-size: 16px; font-weight: 600; cursor: pointer; transition: transform 0.1s, border-color 0.15s, background 0.15s; text-align: left; }
.opt-btn:hover { border-color: var(--accent); }
.opt-btn:active { transform: scale(0.98); }
.opt-btn.correct { background: rgba(85,214,168,0.2); border-color: var(--correct); color: var(--correct); }
.opt-btn.wrong { background: rgba(255,107,107,0.2); border-color: var(--wrong); color: var(--wrong); }
.opt-btn:disabled { cursor: default; opacity: 0.85; }
.timer-row { display: flex; align-items: center; gap: 10px; }
.timer { font-size: 18px; font-weight: 700; min-width: 28px; text-align: center; }
.timerbar-wrap { flex: 1; height: 8px; background: var(--panel-2); border-radius: 4px; overflow: hidden; }
.timerbar { height: 100%; background: var(--accent); transition: width 0.1s linear; }
.timerbar.low { background: var(--wrong); }
.statusbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.statusbar .actions { display: flex; gap: 8px; margin-left: auto; }
.btn { background: var(--key); color: var(--ink); border: none; border-radius: 8px; padding: 8px 14px; font-size: 14px; font-weight: 600; cursor: pointer; }
.btn.primary { background: var(--accent); color: #0f1724; }
.btn:hover { filter: brightness(1.15); }
.result { position: fixed; inset: 0; background: rgba(0,0,0,0.6); display: none; align-items: center; justify-content: center; z-index: 50; }
.result.show { display: flex; }
.result-card { background: var(--panel); border-radius: 16px; padding: 28px; max-width: 360px; width: 90%; text-align: center; }
.result-card h2 { margin: 0 0 8px; }
.result-card p { color: var(--muted); margin: 0 0 16px; }
.modal { position: fixed; inset: 0; background: rgba(0,0,0,0.6); display: flex; align-items: center; justify-content: center; z-index: 60; }
.modal-card { background: var(--panel); border-radius: 16px; padding: 24px; max-width: 420px; width: 90%; }
.modal-card h3 { margin: 0 0 10px; }
.modal-card p { color: var(--muted); font-size: 14px; line-height: 1.5; }
.toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%) translateY(20px); background: var(--panel-2); color: var(--ink); padding: 10px 16px; border-radius: 8px; opacity: 0; transition: opacity 0.2s, transform 0.2s; pointer-events: none; z-index: 70; }
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
@media (max-width: 520px) {
  .options { grid-template-columns: 1fr; }
  .question { font-size: 17px; }
}
