:root {
  --bg: #0f172a; /* slate-900 */
  --fg: #e5e7eb; /* gray-200 */
  --muted: #94a3b8; /* slate-400 */
  --accent: #22c55e; /* green-500 */
  --accent-weak: #14532d; /* green-950 */
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, "Apple Color Emoji", "Segoe UI Emoji";
  color: var(--fg);
  background: radial-gradient(1200px 800px at 70% -10%, #1f2937, var(--bg));
}

.topbar {
  padding: 12px 16px;
  border-bottom: 1px solid #1f2937;
  background: rgba(15, 23, 42, 0.7);
  backdrop-filter: blur(6px);
}
.topbar h1 { margin: 0; font-size: 18px; color: var(--muted); font-weight: 600; }

main { max-width: 720px; margin: 0 auto; padding: 20px 16px 48px; }

.display { text-align: center; margin: 20px 0 8px; }
.speed {
  font-variant-numeric: tabular-nums;
  font-size: clamp(56px, 16vw, 144px);
  line-height: 1;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: #f8fafc;
  text-shadow: 0 0 24px rgba(34, 197, 94, 0.2);
}
.unit { margin-top: 8px; color: var(--muted); display: flex; gap: 12px; justify-content: center; }
.unit input { vertical-align: middle; }

.controls { display: flex; gap: 10px; justify-content: center; align-items: center; margin: 18px 0 10px; flex-wrap: wrap; }
button {
  appearance: none;
  border: 1px solid #334155;
  background: #0b1220;
  color: var(--fg);
  padding: 10px 14px;
  border-radius: 10px;
  font-weight: 600;
  cursor: pointer;
}
button.primary { background: linear-gradient(180deg, #22c55e, #16a34a); border-color: #16a34a; color: #06240f; }
button:disabled { opacity: 0.5; cursor: not-allowed; }
button#exportBtn { border-color: #0ea5e9; background: #0b1420; }
button#resetBtn { border-color: #f59e0b; background: #1a1205; }

.toggle { color: var(--muted); display: flex; gap: 6px; align-items: center; }

.mapwrap { margin: 8px 0 14px; }
.map {
  height: min(45vh, 420px);
  min-height: 220px;
  width: 100%;
  border-radius: 12px;
  border: 1px solid rgba(148,163,184,0.15);
  overflow: hidden;
}

.stats { margin-top: 8px; display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px 14px; }
.stats div { color: var(--muted); background: rgba(148, 163, 184, 0.08); padding: 10px 12px; border-radius: 10px; border: 1px solid rgba(148,163,184,0.15); }
.stats strong { color: #cbd5e1; font-weight: 700; margin-right: 6px; }

.notes { margin-top: 12px; color: var(--muted); }
details { background: rgba(2, 6, 23, 0.4); border: 1px solid #0b1220; padding: 8px 12px; border-radius: 8px; }

.footer { color: var(--muted); text-align: center; font-size: 12px; padding: 18px 0 28px; }

@media (max-width: 420px) {
  .stats { grid-template-columns: 1fr; }
}
