:root {
  /* Un seul univers visuel, sombre par choix : la Terre vue de l'espace.
     Mise en page : globe plein cadre, instruments de bord épinglés aux angles. */
  color-scheme: dark;
  --bg: #04070d;
  --panel: rgba(8, 15, 27, 0.80);
  --line: rgba(140, 172, 214, 0.24);
  --ink: #e9f0f8;
  --muted: #93a5bc;
  --accent: #ffb347;
  --font-display: 'Barlow Condensed', 'Arial Narrow', sans-serif;
  --font-body: 'Barlow', system-ui, -apple-system, 'Segoe UI', sans-serif;
}
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 14px;
  line-height: 1.4;
  overflow: hidden;
  position: relative;
}
#gl {
  position: absolute; inset: 0; width: 100%; height: 100%;
  display: block; touch-action: none; cursor: grab; outline: none;
}
#gl:active { cursor: grabbing; }
#gl:focus-visible { box-shadow: inset 0 0 0 2px var(--accent); }

.brand { position: absolute; left: 16px; top: 14px; pointer-events: none; }
.brand h1 {
  margin: 0; font-family: var(--font-display); font-weight: 600;
  font-size: 28px; letter-spacing: 0.14em; text-transform: uppercase; line-height: 1;
}
.brand p { margin: 4px 0 0; color: var(--muted); font-size: 13px; }

.presets {
  position: absolute; right: 16px; top: 14px;
  display: flex; flex-direction: column; gap: 6px; align-items: stretch;
}
.presets button, .ctl {
  font: 500 13px var(--font-body); color: var(--ink);
  background: var(--panel); border: 1px solid var(--line); border-radius: 6px;
  padding: 7px 12px; text-align: left; cursor: pointer; white-space: nowrap;
  -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
}
.presets button:hover, .ctl:hover { border-color: rgba(255, 179, 71, 0.6); }
.presets button[aria-pressed="true"] { border-color: var(--accent); color: var(--accent); }
button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.panel {
  background: var(--panel); border: 1px solid var(--line); border-radius: 8px;
  -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
}
.readout { position: absolute; right: 16px; bottom: 16px; width: 264px; padding: 12px 14px; }
.readout h2 {
  margin: 0 0 2px; font-family: var(--font-display); font-weight: 600; font-size: 20px;
  letter-spacing: 0.04em; text-wrap: balance;
}
.readout .pos { color: var(--muted); font-variant-numeric: tabular-nums; font-size: 13px; }
.readout .wind { display: flex; align-items: baseline; gap: 8px; margin-top: 8px; flex-wrap: wrap; }
.readout .kn {
  font-family: var(--font-display); font-weight: 600; font-size: 40px; line-height: 1;
  color: var(--accent); font-variant-numeric: tabular-nums;
}
.readout .kn small { font-size: 18px; font-weight: 500; margin-left: 4px; }
.readout .bf { font-size: 14px; }
.readout dl { margin: 8px 0 0; display: grid; grid-template-columns: auto 1fr; gap: 2px 10px; font-size: 13px; }
.readout dt { color: var(--muted); }
.readout dd { margin: 0; font-variant-numeric: tabular-nums; }

.bottom { display: contents; }
.legend { position: absolute; left: 16px; bottom: 16px; width: 300px; padding: 10px 12px 12px; }
.legend .row { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.legend h3 { margin: 0; font: 600 13px var(--font-body); }
.ramp {
  height: 8px; border-radius: 4px; margin: 8px 0 3px;
  background: linear-gradient(90deg, #3d6fae 0%, #4fc3d9 16%, #7be08a 32%, #f2e25c 48%, #ffa23f 64%, #ff5a5a 80%, #ff4fd0 100%);
}
.ticks { display: flex; justify-content: space-between; color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.stamp { margin: 8px 0 0; color: var(--muted); font-size: 12px; }
.stamp b { color: var(--ink); font-weight: 500; }
.ctl { padding: 4px 10px; font-size: 12px; }

#status {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%);
  padding: 10px 16px; max-width: min(360px, calc(100% - 32px)); text-align: center;
}
#status[hidden] { display: none; }
.hint { position: absolute; left: 50%; top: 16px; transform: translateX(-50%); color: var(--muted); font-size: 12px; pointer-events: none; white-space: nowrap; }

@media (max-width: 1100px) { .hint { display: none; } }
@media (max-width: 720px) {
  .brand h1 { font-size: 22px; }
  .brand p { font-size: 12px; }
  .hint { display: none; }
  .presets {
    left: 0; right: 0; top: 62px; flex-direction: row; overflow-x: auto;
    padding: 0 16px 4px; scrollbar-width: none;
  }
  .presets::-webkit-scrollbar { display: none; }
  .presets button { flex: 0 0 auto; padding: 6px 10px; }
  .bottom { position: absolute; left: 16px; right: 16px; bottom: 12px; display: flex; flex-direction: column; gap: 8px; }
  .readout, .legend { position: static; width: auto; }
  .readout { padding: 10px 12px; }
  .readout .wind { margin-top: 4px; }
  .readout .kn { font-size: 32px; }
  .readout dl { margin-top: 4px; }
  .legend { padding: 8px 10px; }
  .stamp { margin-top: 5px; }
}
