/* ============ Pinpoint — Capital Hunt ============ */
/* Palette: ocean ink / chart land / brass / mint hit / coral miss */
:root {
  --ocean: #0a1420;
  --ocean-deep: #060d16;
  --land: #22384c;
  --land-edge: #3d5b74;
  --border-line: #4e708c;
  --graticule: #16283a;
  --brass: #e2b25c;
  --brass-dim: #a9884f;
  --hit: #55d6a4;
  --miss: #ef7264;
  --ink: #e9eef4;
  --ink-dim: #93a4b5;
  --panel: #101d2c;
  --panel-edge: #223649;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body { height: 100%; }

body {
  font-family: "Bricolage Grotesque", "Segoe UI", system-ui, sans-serif;
  background:
    radial-gradient(1200px 600px at 50% -10%, #12233a 0%, var(--ocean) 55%, var(--ocean-deep) 100%);
  color: var(--ink);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.mono { font-family: "JetBrains Mono", ui-monospace, monospace; }

/* ---------- Top bar ---------- */
.topbar {
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 14px 22px;
  border-bottom: 1px solid var(--panel-edge);
  flex-shrink: 0;
  position: relative;
  z-index: 30;
  background: rgba(10, 20, 32, 0.9);
}

.brand { display: flex; align-items: baseline; gap: 10px; color: var(--brass); }
.brand-rose { width: 22px; height: 22px; align-self: center; }
.brand h1 {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: var(--ink);
}
.brand-sub {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.22em;
  color: var(--brass-dim);
}

.instruments { display: flex; gap: 10px; margin-left: auto; }

.gauge {
  min-width: 88px;
  padding: 6px 14px;
  border: 1px solid var(--panel-edge);
  border-radius: 10px;
  background: rgba(16, 29, 44, 0.7);
  display: flex;
  flex-direction: column;
  align-items: center;
}
.gauge-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: var(--ink-dim);
}
.gauge-value { font-size: 18px; font-weight: 600; }
.gauge-score .gauge-value { color: var(--brass); }
.gauge-value.bump { animation: bump 0.35s ease; }
@keyframes bump { 40% { transform: scale(1.22); } }

.topbar > .ghost-btn { margin-left: 0; }
.instruments[hidden] { display: none; }
.instruments[hidden] + .ghost-btn { margin-left: auto; }

/* ---------- Buttons ---------- */
.solid-btn, .ghost-btn {
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.03em;
  border-radius: 10px;
  cursor: pointer;
  padding: 10px 20px;
  transition: transform 0.12s ease, background 0.15s ease, color 0.15s ease;
}
.solid-btn {
  background: var(--brass);
  color: #221a0c;
  border: 1px solid var(--brass);
}
.solid-btn:hover { transform: translateY(-1px); background: #edc172; }
.solid-btn.big { font-size: 16px; padding: 13px 30px; }
.ghost-btn {
  background: transparent;
  color: var(--ink-dim);
  border: 1px solid var(--panel-edge);
}
.ghost-btn:hover { color: var(--ink); border-color: var(--border-line); }
.ghost-btn.danger:hover { color: var(--miss); border-color: var(--miss); }
button:focus-visible, input:focus-visible, .mode-card:focus-within {
  outline: 2px solid var(--brass);
  outline-offset: 2px;
}

/* ---------- Stage / map ---------- */
.stage {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px 22px 26px;
  min-height: 0;
}

.map-frame {
  position: relative;
  width: 100%;
  max-width: 1280px;
  height: 100%;
  border: 1px solid var(--panel-edge);
  border-radius: 16px;
  background: rgba(8, 17, 27, 0.55);
  overflow: hidden;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.45);
}

#map { width: 100%; height: 100%; display: block; }
#map.armed { cursor: crosshair; }

.land {
  fill: var(--land);
  stroke: var(--land-edge);
  stroke-width: 0.6;
}
.borders {
  fill: none;
  stroke: var(--border-line);
  stroke-width: 0.45;
  opacity: 0.75;
  transition: opacity 0.4s ease;
}
.silhouette .borders { opacity: 0; }
#graticule line {
  stroke: var(--graticule);
  stroke-width: 0.5;
}

/* map marks */
.pin-guess { fill: var(--brass); stroke: #221a0c; stroke-width: 1; }
.pin-true  { fill: none; stroke-width: 1.6; }
.pin-true.hit  { stroke: var(--hit); }
.pin-true.miss { stroke: var(--miss); }
.pin-true-dot.hit  { fill: var(--hit); }
.pin-true-dot.miss { fill: var(--miss); }

.ping {
  fill: none;
  stroke: var(--brass);
  stroke-width: 1.5;
  animation: ping 0.9s ease-out forwards;
  transform-box: fill-box;
  transform-origin: center;
}
@keyframes ping {
  from { opacity: 0.9; transform: scale(0.2); }
  to   { opacity: 0;   transform: scale(1); }
}

.link-line {
  fill: none;
  stroke: var(--ink-dim);
  stroke-width: 1;
  stroke-dasharray: 4 4;
  animation: drawline 0.5s ease forwards;
}
@keyframes drawline { from { opacity: 0; } to { opacity: 0.9; } }

/* ---------- Prompt card ---------- */
.prompt {
  position: absolute;
  left: 50%;
  bottom: 18px;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 12px 20px;
  background: rgba(16, 29, 44, 0.92);
  border: 1px solid var(--panel-edge);
  border-radius: 14px;
  backdrop-filter: blur(6px);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.4);
}
.prompt[hidden] { display: none; }

.prompt-timer { position: relative; width: 52px; height: 52px; flex-shrink: 0; }
.prompt-timer svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.prompt-timer span {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-size: 15px;
  font-weight: 600;
}
.timer-track { fill: none; stroke: var(--panel-edge); stroke-width: 4; }
.timer-arc {
  fill: none;
  stroke: var(--brass);
  stroke-width: 4;
  stroke-linecap: round;
  stroke-dasharray: 163.4; /* 2πr, r=26 */
  transition: stroke-dashoffset 0.2s linear, stroke 0.2s;
}
.timer-arc.low { stroke: var(--miss); }
.prompt-timer.low span { color: var(--miss); }

.prompt-body { display: flex; flex-direction: column; min-width: 220px; }
.prompt-eyebrow {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.2em;
  color: var(--brass-dim);
}
.prompt-city { font-size: 26px; font-weight: 700; line-height: 1.15; }
.prompt-country { font-size: 13px; color: var(--ink-dim); }

.prompt-tolerance {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  padding-left: 16px;
  border-left: 1px solid var(--panel-edge);
}
.prompt-tolerance .mono { font-size: 15px; color: var(--ink); }

/* ---------- Verdict ---------- */
.verdict {
  position: absolute;
  left: 50%;
  bottom: 18px;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 12px 18px;
  background: rgba(16, 29, 44, 0.94);
  border: 1px solid var(--panel-edge);
  border-radius: 14px;
  animation: rise 0.25s ease;
}
.verdict[hidden] { display: none; }
@keyframes rise { from { opacity: 0; transform: translate(-50%, 8px); } }

.verdict-title { font-size: 20px; font-weight: 700; }
.verdict.hit .verdict-title { color: var(--hit); }
.verdict.miss .verdict-title { color: var(--miss); }
.verdict-detail { font-size: 13px; color: var(--ink-dim); max-width: 300px; }
.verdict-points { font-size: 20px; font-weight: 600; }
.verdict.hit .verdict-points { color: var(--hit); }
.verdict.miss .verdict-points { color: var(--miss); }

/* ---------- Overlays ---------- */
.overlay {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgba(6, 13, 22, 0.82);
  backdrop-filter: blur(8px);
  z-index: 20;
  padding: 24px;
  overflow-y: auto;
}
.overlay[hidden] { display: none; }

.panel {
  width: min(560px, 100%);
  background: var(--panel);
  border: 1px solid var(--panel-edge);
  border-radius: 20px;
  padding: 36px 40px;
  text-align: center;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.5);
}
.panel-wide { width: min(640px, 100%); }
.panel-rose { width: 46px; height: 46px; color: var(--brass); margin-bottom: 14px; }
.panel h2 {
  font-size: 30px;
  font-weight: 700;
  line-height: 1.15;
  margin-bottom: 12px;
}
.panel-lede {
  font-size: 14px;
  line-height: 1.55;
  color: var(--ink-dim);
  margin-bottom: 24px;
}

.mode-pick { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 22px; }
.mode-card {
  display: flex;
  flex-direction: column;
  gap: 4px;
  text-align: left;
  padding: 14px 16px;
  border: 1px solid var(--panel-edge);
  border-radius: 12px;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
}
.mode-card:hover { border-color: var(--border-line); }
.mode-card:has(input:checked) {
  border-color: var(--brass);
  background: rgba(226, 178, 92, 0.08);
}
.mode-card input { position: absolute; opacity: 0; }
.mode-name { font-weight: 700; font-size: 15px; }
.mode-card:has(input:checked) .mode-name { color: var(--brass); }
.mode-desc { font-size: 12px; color: var(--ink-dim); line-height: 1.4; }

.rules {
  margin-top: 26px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px 18px;
  text-align: left;
}
.rules div {
  border-top: 1px solid var(--panel-edge);
  padding-top: 8px;
}
.rules dt {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: var(--brass-dim);
  margin-bottom: 2px;
}
.rules dd { font-size: 12px; color: var(--ink-dim); }

/* ---------- End screen ---------- */
.end-eyebrow {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.24em;
  color: var(--brass-dim);
}
.end-score {
  font-size: 64px;
  font-weight: 600;
  color: var(--brass);
  margin: 6px 0 8px;
}
.name-row { display: flex; gap: 10px; justify-content: center; margin-bottom: 16px; }
.name-row[hidden] { display: none; }
.name-input {
  font-family: inherit;
  font-size: 15px;
  padding: 10px 14px;
  width: 200px;
  background: var(--ocean-deep);
  color: var(--ink);
  border: 1px solid var(--panel-edge);
  border-radius: 10px;
}
.name-input::placeholder { color: var(--ink-dim); }
.end-actions { display: flex; gap: 10px; justify-content: center; }

/* ---------- Leaderboard ---------- */
.board { list-style: none; text-align: left; margin-bottom: 22px; }
.board li {
  display: grid;
  grid-template-columns: 34px 1fr auto auto;
  gap: 14px;
  align-items: baseline;
  padding: 10px 6px;
  border-bottom: 1px solid var(--panel-edge);
}
.board .rank { font-family: "JetBrains Mono", monospace; color: var(--brass-dim); font-size: 13px; }
.board li:first-child .rank { color: var(--brass); }
.board .who { font-weight: 600; }
.board .meta { font-size: 11px; color: var(--ink-dim); letter-spacing: 0.04em; }
.board .pts { font-family: "JetBrains Mono", monospace; font-weight: 600; color: var(--ink); }
.board li:first-child .pts { color: var(--brass); }
.board-empty { color: var(--ink-dim); font-size: 14px; margin-bottom: 22px; }

/* ---------- Responsive ---------- */
@media (max-width: 720px) {
  .stage { padding: 10px; }
  .prompt { flex-wrap: wrap; justify-content: center; max-width: calc(100% - 20px); }
  .prompt-tolerance { display: none; }
  .prompt-city { font-size: 20px; }
  .panel { padding: 26px 22px; }
  .mode-pick, .rules { grid-template-columns: 1fr; }
  .brand-sub { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: 0.001s !important; transition-duration: 0.001s !important; }
}
