:root {
  --ink: #10212b;
  --paper: #ffffff;
  --line: #d5dde2;
  --accent: #0b6bcb;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; font: 14px/1.35 system-ui, -apple-system, "Segoe UI", sans-serif; color: var(--ink); }
#map { position: absolute; inset: 0; background: #dfe7ea; }

#topbar { position: absolute; top: calc(8px + var(--safe-top)); left: 8px; right: 8px; pointer-events: none; }
.chips { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; pointer-events: auto; padding: 2px; }
.chips::-webkit-scrollbar { display: none; }
.chip { flex: none; border: 1px solid var(--line); background: var(--paper); color: var(--ink); border-radius: 999px; padding: 8px 14px; font: inherit; font-weight: 600; box-shadow: 0 1px 4px rgba(0,0,0,.18); }
.chip[aria-checked="true"] { background: var(--ink); color: #fff; border-color: var(--ink); }

#side { position: absolute; right: 8px; top: calc(64px + var(--safe-top)); display: flex; flex-direction: column; gap: 8px; }
.round { width: 44px; height: 44px; border-radius: 50%; border: 1px solid var(--line); background: var(--paper); font: inherit; font-weight: 700; box-shadow: 0 1px 4px rgba(0,0,0,.18); }
.round[aria-pressed="true"] { background: var(--ink); color: #fff; }

#legend { position: absolute; left: 8px; top: calc(64px + var(--safe-top)); background: rgba(255,255,255,.92); border: 1px solid var(--line); border-radius: 10px; padding: 6px 8px; font-size: 12px; max-width: 150px; }
#legend:empty { display: none; }
#legend .sw { display: inline-block; width: 14px; height: 12px; border-radius: 2px; margin-right: 6px; vertical-align: -1px; border: 1px solid rgba(0,0,0,.25); }
#legend .compass { display: grid; grid-template-columns: repeat(3, 26px); gap: 2px; }
#legend .compass span { height: 22px; border-radius: 3px; color: #fff; font-weight: 700; font-size: 11px; display: grid; place-items: center; }

.card { position: absolute; left: 8px; right: 8px; bottom: calc(34px + var(--safe-bottom)); background: var(--paper); border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px; box-shadow: 0 4px 18px rgba(0,0,0,.25); max-height: 55vh; overflow: auto; z-index: 5; }
.card h2 { margin: 0 0 8px; font-size: 14px; }
.card .row { display: flex; align-items: center; gap: 8px; margin: 8px 0; flex-wrap: wrap; }
.card input[type="number"] { width: 68px; padding: 6px; font: inherit; border: 1px solid var(--line); border-radius: 6px; }
.card select, .card button { font: inherit; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; background: #fff; }
.card input[type="range"] { flex: 1; min-width: 120px; }
.close { position: absolute; top: 6px; right: 8px; border: 0 !important; background: none !important; font-size: 22px !important; padding: 2px 8px !important; }
.fine { font-size: 11px; color: #5a6a73; margin: 6px 0 0; }

#aspect-picker { display: grid; grid-template-columns: repeat(8, 1fr); gap: 4px; flex: 1; }
#aspect-picker button { padding: 8px 0; border-radius: 6px; font-weight: 700; font-size: 12px; }
#aspect-picker button[aria-pressed="true"] { background: var(--ink); color: #fff; border-color: var(--ink); }

#point .big { font-size: 20px; font-weight: 700; }
#point .big span { margin-right: 14px; white-space: nowrap; }
#wind table { border-collapse: collapse; width: 100%; margin-top: 6px; font-size: 12px; }
#wind th, #wind td { text-align: left; padding: 3px 6px 3px 0; white-space: nowrap; }
#wind th { color: #5a6a73; font-weight: 600; }
.arrow { display: inline-block; font-weight: 700; }

#notice { position: absolute; left: 0; right: 0; bottom: 0; margin: 0; padding: 6px 10px calc(6px + var(--safe-bottom)) 10px; font-size: 11px; background: rgba(16,33,43,.88); color: #fff; }
#notice a { color: #9fd0ff; }
.maplibregl-ctrl-bottom-right, .maplibregl-ctrl-bottom-left { bottom: calc(30px + var(--safe-bottom)); }

@media (min-width: 720px) {
  .card { left: auto; width: 380px; }
}
