:root {
  color-scheme: dark;
  --ink: #fff8e9;
  --muted: #9fb2b9;
  --panel: #142128;
  --panel-2: #1b2a31;
  --line: #40535c;
  --gold: #ffbd2e;
  --gold-soft: #f5d98c;
  --guess: #63d5e6;
  --bg: #0d171d;
}

* { box-sizing: border-box; }

html, body { min-height: 100%; }

body {
  margin: 0;
  background:
    radial-gradient(circle at 50% -20%, #243842 0, transparent 45%),
    var(--bg);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button, canvas { -webkit-tap-highlight-color: transparent; }

button {
  min-height: 48px;
  border: 1px solid #f8cb62;
  border-radius: 8px;
  background: var(--gold);
  color: #201500;
  padding: 0.75rem 1.1rem;
  font: inherit;
  font-weight: 800;
  cursor: pointer;
}

button.secondary {
  background: transparent;
  color: var(--ink);
  border-color: var(--line);
}

button:focus-visible, canvas:focus-visible {
  outline: 3px solid var(--guess);
  outline-offset: 3px;
}

.shell {
  width: min(1100px, 100%);
  margin: 0 auto;
  padding: max(1rem, env(safe-area-inset-top)) 1rem max(1rem, env(safe-area-inset-bottom));
}

.topbar, .prompt-row, .feedback, .summary-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.topbar {
  margin-bottom: 1rem;
  border-bottom: 1px solid var(--line);
  padding-bottom: 0.9rem;
}

.eyebrow, .country-label, .feedback-label {
  margin: 0 0 0.28rem;
  color: var(--gold-soft);
  font-size: 0.72rem;
  font-weight: 850;
  letter-spacing: 0.13em;
}

h1, h2, p { margin-top: 0; }
h1 { margin-bottom: 0; font-size: clamp(1.25rem, 4vw, 2rem); }
h2 { margin-bottom: 0; font-size: clamp(1.55rem, 5vw, 2.6rem); }

.scoreboard { min-width: 88px; text-align: right; }
.scoreboard span { display: block; color: var(--muted); font-size: 0.78rem; }
.scoreboard strong { display: block; color: var(--gold); font-size: 1.75rem; line-height: 1; }

.prompt-row { margin-bottom: 0.8rem; }
.instruction { margin-bottom: 0; color: var(--muted); text-align: right; }

.map-frame {
  position: relative;
  display: grid;
  min-height: 220px;
  place-items: center;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #0b1419;
  box-shadow: 0 18px 45px rgb(0 0 0 / 0.28);
}

canvas {
  display: block;
  width: 100%;
  height: auto;
  cursor: crosshair;
  touch-action: manipulation;
}

.loading {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: var(--muted);
  background: var(--bg);
}

.feedback {
  margin-top: 0.8rem;
  padding: 0.85rem 0.95rem;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--panel);
}

.feedback > div { min-width: 86px; }
.feedback strong { display: block; font-size: 1.2rem; }
.location-cue { flex: 1; margin: 0; color: var(--muted); }

.summary {
  margin: 8vh auto 0;
  max-width: 720px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel);
  padding: clamp(1.2rem, 5vw, 2.4rem);
}

.summary h2 { color: var(--gold); font-size: clamp(2.25rem, 10vw, 4.5rem); }
.summary > p:not(.eyebrow) { color: var(--muted); }

.round-results {
  margin: 1.4rem 0;
  border-top: 1px solid var(--line);
}

.result-row {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 1rem;
  padding: 0.8rem 0;
  border-bottom: 1px solid var(--line);
}

.result-row span { color: var(--muted); }
.result-row strong { color: var(--gold-soft); }

[hidden] { display: none !important; }

@media (max-width: 680px) {
  .shell { padding-left: 0.7rem; padding-right: 0.7rem; }
  .topbar { align-items: flex-end; }
  .prompt-row { align-items: flex-end; }
  .instruction { max-width: 8rem; font-size: 0.82rem; }
  .feedback { display: grid; grid-template-columns: 1fr 1fr; }
  .location-cue { grid-column: 1 / -1; }
  .feedback button { grid-column: 1 / -1; width: 100%; }
  .summary-actions { flex-direction: column; }
  .summary-actions button { width: 100%; }
}
