:root {
  --bg: #f6f8fc;
  --surface: #ffffff;
  --surface-strong: #eef2f8;
  --ink: #0b1020;
  --ink-soft: #273044;
  --mute: #667085;
  --line: #d7dce6;
  --accent: #315cff;
  --accent-strong: #1f45d8;
  --success: #047857;
  --danger: #dc2626;
  --warning: #f59e0b;
  --radius-md: 16px;
  --radius-lg: 24px;
  --shadow-border: 0 0 0 1px rgba(11,16,32,.08), 0 18px 60px rgba(11,16,32,.08);
  color-scheme: light;
}
body.dark, body[data-theme="dark"] {
  --bg: #070a12;
  --surface: #111827;
  --surface-strong: #172033;
  --ink: #f8fafc;
  --ink-soft: #e2e8f0;
  --mute: #a5b4c8;
  --line: #2a3447;
  --accent: #6e8cff;
  --accent-strong: #90a5ff;
  --shadow-border: 0 0 0 1px rgba(255,255,255,.08), 0 18px 60px rgba(0,0,0,.34);
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; background: var(--bg); color: var(--ink); font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; }
button, input { font: inherit; }
.app-shell { min-height: 100dvh; max-width: 520px; margin: 0 auto; padding: calc(14px + env(safe-area-inset-top)) 16px calc(18px + env(safe-area-inset-bottom)); display: flex; flex-direction: column; gap: 16px; }
.topline { display:flex; justify-content: space-between; align-items:center; min-height: 40px; }
.logo { font-weight: 800; letter-spacing: -0.04em; }
.muted { color: var(--mute); }
.hero { margin-top: 28px; padding: 24px; border-radius: 32px; background: radial-gradient(circle at 10% 0%, rgba(49,92,255,.18), transparent 36%), var(--surface); box-shadow: var(--shadow-border); }
h1 { font-size: clamp(38px, 12vw, 52px); line-height: .98; letter-spacing: -0.055em; margin: 0 0 14px; }
h2 { font-size: 28px; line-height: 1.05; letter-spacing: -0.04em; margin: 0; }
.rules { display:flex; flex-wrap: wrap; gap: 8px; margin: 20px 0; }
.chip { display:inline-flex; align-items:center; gap: 6px; border:1px solid var(--line); border-radius: 999px; padding: 7px 10px; color: var(--ink-soft); background: rgba(255,255,255,.45); font-size: 13px; }
.primary, .secondary { min-height: 54px; border-radius: var(--radius-md); padding: 0 18px; border: 0; cursor: pointer; font-weight: 700; transition: transform .12s ease, opacity .12s ease; }
.primary { color: #fff; background: linear-gradient(180deg, var(--accent), var(--accent-strong)); width: 100%; box-shadow: 0 16px 32px rgba(49,92,255,.24); }
.secondary { color: var(--ink); background: var(--surface-strong); width: 100%; }
.primary:disabled { opacity: .45; cursor: not-allowed; box-shadow: none; }
.primary:active, .secondary:active { transform: scale(.99); }
.game-topbar { display:flex; justify-content: space-between; align-items:center; gap: 12px; }
.progress-label { font-size: 11px; letter-spacing: .08em; font-weight: 800; color: var(--mute); text-transform: uppercase; }
.timer-chip { font-variant-numeric: tabular-nums; font-weight: 800; padding: 8px 10px; border:1px solid var(--line); border-radius: 999px; background: var(--surface); }
.progress-rail { height: 6px; border-radius: 999px; background: var(--surface-strong); overflow: hidden; }
.progress-fill { height: 100%; background: linear-gradient(90deg, var(--accent), #62d0ff); width: 0%; transition: width .18s ease; }
.question-content { display:flex; flex: 1; min-height: 0; flex-direction: column; justify-content: center; gap: 16px; }
.flag-card { aspect-ratio: 4 / 3; border-radius: 30px; background: linear-gradient(180deg, var(--surface), var(--surface-strong)); box-shadow: var(--shadow-border); display:grid; place-items:center; overflow:hidden; padding: 18px; }
.flag-card img { width: 100%; height: 100%; object-fit: contain; border-radius: 12px; filter: drop-shadow(0 10px 20px rgba(11,16,32,.12)); }
.flag-emoji { font-size: min(36vw, 160px); line-height: 1; }
.answer-form { margin-top: auto; position: sticky; bottom: calc(12px + env(safe-area-inset-bottom)); background: color-mix(in oklab, var(--bg) 84%, transparent); backdrop-filter: blur(18px); padding-top: 10px; }
.answer-input { width: 100%; height: 56px; border:1px solid var(--line); border-radius: var(--radius-md); padding: 0 16px; background: var(--surface); color: var(--ink); outline: none; font-size: 18px; }
.answer-input:focus { border-color: var(--accent); box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 16%, transparent); }
.suggestions { display:flex; flex-wrap:wrap; gap: 8px; margin: 8px 0; min-height: 36px; }
.suggestion { border:1px solid var(--line); background: var(--surface); color: var(--ink-soft); border-radius: 999px; padding: 8px 10px; }
.dontknow-row { display:flex; justify-content: center; margin: 12px 0 16px; }
.dontknow { border:1px dashed var(--line); background: var(--surface); color: var(--mute); border-radius: 999px; padding: 12px 28px; cursor: pointer; font-size: 15px; font-weight: 700; transition: background .12s ease, color .12s ease; min-width: 160px; text-align:center; }
.dontknow:hover, .dontknow:active { background: var(--surface-strong); color: var(--ink-soft); border-style: solid; }
.form-row { display:grid; grid-template-columns: 1fr auto; gap: 10px; }
.form-row .primary { width: auto; min-width: 126px; }
.feedback { min-height: 34px; color: var(--mute); font-size: 14px; }
.result-summary, .leaderboard, .result-list, .ad-slot { background: var(--surface); box-shadow: var(--shadow-border); border-radius: var(--radius-lg); padding: 16px; }
.rsya-slot { min-height: 250px; margin: 14px 0; display:grid; place-items:center; border:1px dashed var(--line); border-radius: var(--radius-md); background: var(--surface-strong); overflow:hidden; }
.score { font-size: 46px; font-weight: 850; letter-spacing: -0.06em; }
.result-row, .leader-row { display:grid; grid-template-columns: 48px 1fr auto; align-items:center; gap: 12px; padding: 12px 0; border-bottom:1px solid var(--line); }
.result-row:last-child, .leader-row:last-child { border-bottom: 0; }
.flag-thumb { width: 44px; height: 32px; object-fit: contain; border-radius: 5px; background: var(--surface-strong); }
.status { font-weight: 900; font-size: 20px; }
.correct .status { color: var(--success); }
.wrong .status { color: var(--danger); }
.avatar { width: 36px; height: 36px; border-radius: 50%; background: var(--surface-strong); display:grid; place-items:center; overflow:hidden; font-weight: 800; }
.avatar img { width:100%; height:100%; object-fit: cover; }
.leader-row.me { outline: 2px solid color-mix(in srgb, var(--accent) 40%, transparent); outline-offset: -2px; border-radius: 16px; padding-left: 8px; padding-right: 8px; }
.actions { display:grid; gap: 10px; margin-top: 14px; }
.error { border:1px solid color-mix(in srgb, var(--danger) 32%, var(--line)); background: color-mix(in srgb, var(--danger) 8%, var(--surface)); border-radius: var(--radius-md); padding: 14px; }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }
