/* NoCarot : carte marine de nuit aux couleurs d'Analyzenn. Les panneaux restent sobres (bleu marine,
   texte écume), la couleur est réservée aux données et aux notes. */

@font-face {
  font-family: "Bricolage Grotesque";
  src: url("../vendor/bricolage-grotesque.woff2") format("woff2");
  font-weight: 200 800;
  font-stretch: 75% 100%;
  font-display: swap;
}

:root {
  --sea: #071a33;
  --panel: #0b2545;           /* bleu marine Analyzenn */
  --panel-2: #15345a;
  --line: #2c4d75;
  --text: #f7f9fb;
  --muted: #a8bad0;
  --accent: #14b8a6;          /* sarcelle Analyzenn */
  --accent-ink: #0b2545;
  --danger: #ff9b7a;
  --radius: 14px;
  --shadow: 0 10px 30px rgba(2, 10, 24, 0.45);
  --bar-h: 92px;
  font-family: "Bricolage Grotesque", "Segoe UI", system-ui, sans-serif;
  font-size: 15px;
  line-height: 1.45;
  color: var(--text);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; background: var(--sea); overflow: hidden; }
button { font: inherit; color: inherit; cursor: pointer; border: 0; background: none; padding: 0; }
h1, h2, h3, p, ul, ol, dl, dd { margin: 0; padding: 0; }
ul, ol { list-style: none; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
[hidden] { display: none !important; }

#map { position: fixed; inset: 0; }
/* Mention du bord de la zone des données, posée à plat sur la carte. */
.edge-label {
  pointer-events: none; white-space: nowrap;
  font-size: 11px; font-weight: 600; letter-spacing: 0.14em; text-transform: uppercase;
  color: rgba(247, 249, 251, 0.42);
  text-shadow: 0 1px 2px rgba(0, 6, 14, 0.6);
}
#fx { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 1; }

/* --- Blocs flottants ------------------------------------------------------ */
.topbar, .rank, .panel, .legend, .timeline, .status, .tip {
  position: fixed;
  z-index: 5;
}
.brand, .seg, .tools, .rank, .panel, .legend, .timeline, .status, .tip {
  background: color-mix(in srgb, var(--panel) 93%, transparent);
  backdrop-filter: blur(10px);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.topbar {
  top: 12px; left: 12px; right: 12px;
  display: flex; flex-wrap: wrap; align-items: stretch; gap: 8px;
  pointer-events: none;
}
.topbar > * { pointer-events: auto; }

.brand { display: flex; align-items: center; gap: 10px; padding: 8px 16px 8px 12px; }
.brand-mark { width: 34px; height: 34px; }
/* Cercle en écho au logo rond d'Analyzenn, avec une carotte en forme de planche de surf */
.brand-mark .ring { fill: none; stroke: var(--accent); stroke-width: 2.6; }
.brand-mark .carotte { fill: #f97316; }
.brand-mark .feuilles { fill: none; stroke: #22c55e; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.brand-mark .veines { fill: none; stroke: #fff3; stroke-width: 1; stroke-linecap: round; }
.brand h1 { font-size: 21px; font-weight: 800; letter-spacing: -0.02em; line-height: 1; }
.brand p { font-size: 12.5px; color: var(--muted); margin-top: 3px; }
.brand-by { display: inline-flex; align-items: center; gap: 5px; vertical-align: -3px; color: var(--accent); text-decoration: none; font-weight: 600; }
.brand-by img { width: 14px; height: 14px; object-fit: contain; }
.brand-by:hover { text-decoration: underline; }
.about a { color: var(--accent); }

.seg { display: flex; padding: 4px; gap: 2px; }
.seg button {
  padding: 0 14px; min-height: 40px; border-radius: 10px;
  font-weight: 600; color: var(--muted);
}
.seg button:hover { color: var(--text); background: var(--panel-2); }
.seg button[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); }
.seg button:disabled, .seg button:disabled:hover { opacity: 0.55; cursor: not-allowed; background: none; color: var(--muted); }
.seg-small { box-shadow: none; padding: 3px; border-radius: 10px; }
.seg-small button { min-height: 30px; padding: 0 10px; font-size: 13px; border-radius: 7px; }

.tools { display: flex; padding: 4px; gap: 2px; margin-left: auto; }
.tool { padding: 0 12px; min-height: 40px; border-radius: 10px; font-weight: 500; color: var(--muted); white-space: nowrap; }
.tool:hover { color: var(--text); background: var(--panel-2); }
.app-link { display: inline-flex; align-items: center; justify-content: center; text-decoration: none; }
.tool[aria-pressed="true"] { color: var(--text); box-shadow: inset 0 -2px 0 var(--accent); }

/* Bouton « Affichage » et son menu d'options de carte */
.tool-menu { display: inline-flex; align-items: center; gap: 7px; }
.tool-menu[aria-expanded="true"] { color: var(--text); background: var(--panel-2); }
.tool-icon { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linejoin: round; stroke-linecap: round; }
.tool-caret { width: 9px; height: 6px; fill: none; stroke: currentColor; stroke-width: 1.6; transition: transform 0.15s; }
.tool-menu[aria-expanded="true"] .tool-caret { transform: rotate(180deg); }
.map-menu {
  position: fixed; z-index: 7; width: min(310px, calc(100vw - 16px)); padding: 12px 14px 6px;
  background: color-mix(in srgb, var(--panel) 96%, transparent); backdrop-filter: blur(10px);
  border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow);
}
.menu-label { font-size: 12px; font-weight: 600; color: var(--muted); margin-bottom: 6px; }
.menu-seg { display: grid; grid-template-columns: 1fr 1fr; margin-bottom: 8px; background: var(--sea); border: 1px solid var(--line); }
.menu-switch { display: flex; align-items: center; justify-content: space-between; gap: 14px; width: 100%; padding: 10px 2px; text-align: left; border-top: 1px solid var(--line); }
.sw-text strong { display: block; font-size: 14.5px; font-weight: 600; }
.sw-text small { display: block; font-size: 12px; color: var(--muted); line-height: 1.35; margin-top: 2px; }
.sw { position: relative; flex: none; width: 38px; height: 22px; border-radius: 11px; background: var(--sea); border: 1px solid var(--line); transition: background 0.15s, border-color 0.15s; }
.sw::after { content: ""; position: absolute; top: 3px; left: 3px; width: 14px; height: 14px; border-radius: 50%; background: var(--muted); transition: transform 0.15s, background 0.15s; }
.menu-switch[aria-checked="true"] .sw { background: var(--accent); border-color: var(--accent); }
.menu-switch[aria-checked="true"] .sw::after { transform: translateX(16px); background: var(--accent-ink); }
.menu-switch:hover .sw-text strong { color: var(--accent); }

/* --- Stations de mesure sur la carte -------------------------------------- */
.station {
  z-index: 5; display: flex; align-items: center; gap: 3px;
  padding: 2px 6px 2px 3px; border-radius: 11px; text-decoration: none;
  background: rgba(11, 37, 69, 0.88); border: 1.5px solid var(--wind, #a8bad0);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.45);
  color: var(--text); font-size: 12px; font-weight: 700; line-height: 1;
}
.station-arrow {
  width: 14px; height: 14px; background: var(--wind);
  clip-path: polygon(50% 0, 100% 70%, 62% 58%, 62% 100%, 38% 100%, 38% 58%, 0 70%);
}
.station.is-stale { width: 11px; height: 11px; padding: 0; border-radius: 50%; background: rgba(11, 37, 69, 0.7); border-color: #a8bad0; }
.station:hover, .station:focus-visible { z-index: 6; border-color: var(--text); }
.station.est-groupee { width: 8px; height: 8px; padding: 0; background: var(--wind); }
.station.est-groupee > span { display: none; }
.pin-vent {
  margin-top: -2px; padding: 3px 6px; border: 1px solid var(--muted);
  border-radius: 0 0 8px 8px; background: var(--panel); color: var(--text);
  font-size: 12px; font-weight: 700; line-height: 1.2; white-space: nowrap;
}
.pin:has(.pin-vent:not([hidden])) { gap: 0; }
.pin:has(.pin-vent:not([hidden])) .pin-note { width: 100%; border-radius: 10px 10px 0 0; }
.pin:has(.pin-vent:not([hidden])) .pin-note:is(:hover, :focus-visible),
.pin:has(.pin-vent:not([hidden])):is(.is-selected, :hover) .pin-note { transform: none; }
.maplibregl-popup:has(.liste-capteurs) { z-index: 1002; }
.maplibregl-popup:has(.liste-capteurs) .maplibregl-popup-content { background: var(--panel); color: var(--text); border-radius: 10px; }
.liste-capteurs { display: grid; gap: 3px; max-height: 40dvh; overflow-y: auto; padding: 4px 14px 0 2px; }
.liste-capteurs a { color: var(--text); padding: 8px 0; line-height: 1.4; }

/* --- Pastilles sur la carte ----------------------------------------------- */
.pin { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 2px; }
.pin-note {
  min-width: 38px; height: 26px; padding: 0 7px; border-radius: 13px;
  display: grid; place-items: center;
  font-stretch: 78%; font-weight: 800; font-size: 15px; letter-spacing: 0.01em;
  background: #5d6b78; color: #fff;
  border: 2px solid rgba(255, 255, 255, 0.92);
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.55);
  transition: transform 0.15s ease;
}
.pin::after {
  content: ""; width: 2px; height: 7px; background: rgba(255, 255, 255, 0.92);
  order: 1; margin-top: -2px; box-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
}
.pin-name {
  order: 2; position: absolute; top: 100%; white-space: nowrap;
  font-size: 12.5px; font-weight: 600; color: #fff;
  text-shadow: 0 0 3px #061a30, 0 0 6px #061a30, 0 1px 2px #061a30;
  opacity: 0; pointer-events: none; transition: opacity 0.15s;
}
.show-names .pin-name, .pin:hover .pin-name, .pin:focus-within .pin-name, .pin.is-selected .pin-name { opacity: 1; }
.pin:hover .pin-note { transform: scale(1.12); }
.pin.is-selected .pin-note { transform: scale(1.3); border-color: var(--accent); box-shadow: 0 0 0 3px rgba(20, 184, 166, 0.4), 0 4px 14px rgba(0, 0, 0, 0.6); }
.pin.is-note-hidden .pin-note {
  min-width: 16px; width: 16px; height: 16px; padding: 0;
  background: var(--panel); border-color: rgba(255, 255, 255, 0.92);
}
.pin.is-off .pin-note { min-width: 12px; width: 12px; height: 12px; padding: 0; background: #7d8a96; border-width: 1.5px; }
.pin.is-off::after { display: none; }

/* --- Classement ----------------------------------------------------------- */
.rank {
  top: 84px; left: 12px; width: 318px;
  /* --legend-h : hauteur réelle de la légende (mesurée en JS), qui grandit avec l'exposition */
  max-height: calc(100vh - 84px - var(--bar-h) - 24px - var(--legend-h, 106px) - 16px);
  display: flex; flex-direction: column; overflow: hidden;
}
.rank-head { padding: 14px 14px 12px; display: grid; grid-template-columns: 1fr auto; gap: 10px; align-items: start; }
.rank-heading h2 { font-size: 19px; font-weight: 750; line-height: 1.2; letter-spacing: -0.01em; }
.rank-heading p { color: var(--muted); font-size: 12px; margin-top: 3px; }
.rank-head .seg { grid-column: 1 / -1; justify-self: stretch; border-color: var(--line); background: var(--sea); }
.rank-head .seg button { flex: 1; min-width: 0; padding-left: 4px; padding-right: 4px; font-size: 12px; white-space: nowrap; }
.rank-toggle { font-size: 13px; color: var(--muted); padding: 5px 8px; border: 1px solid var(--line); border-radius: 7px; }
.rank-toggle:hover { color: var(--text); }
.rank.is-collapsed { max-height: none; width: auto; }
.rank.is-collapsed .rank-head { display: block; padding: 0; }
.rank.is-collapsed .rank-heading, .rank.is-collapsed .seg, .rank.is-collapsed .rank-list { display: none; }
.rank.is-collapsed .rank-toggle { padding: 10px 16px; text-decoration: none; font-weight: 600; color: var(--text); font-size: 15px; }
.rank-list { overflow-y: auto; padding: 0 8px 8px; scrollbar-width: thin; scrollbar-color: var(--line) transparent; }
.rank-list button {
  width: 100%; display: flex; align-items: center; gap: 10px; text-align: left;
  min-height: 58px; padding: 9px 8px; border-radius: 8px;
}
.rank-list li + li { border-top: 1px solid color-mix(in srgb, var(--line) 60%, transparent); }
.rank-list button:hover { background: var(--panel-2); }
.rank-list button.is-selected { background: var(--panel-2); box-shadow: inset 2px 0 0 var(--accent); }
.rank-name { display: grid; min-width: 0; gap: 2px; }
.rank-name strong { font-weight: 600; }
.rank-name span { font-size: 13px; color: var(--muted); line-height: 1.4; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.rank-empty { padding: 10px 12px; color: var(--muted); font-size: 13.5px; }
#rank-search {
  grid-column: 1 / -1; width: 100%; min-height: 44px; padding: 8px 12px;
  border: 1px solid var(--line); border-radius: 8px; background: var(--sea);
  color: var(--text); font: inherit; font-size: 16px;
}
#rank-search::placeholder { color: var(--muted); }
.rank.is-collapsed #rank-search { display: none; }
@media (min-width: 1200px) {
  .rank:not(.is-collapsed) { max-height: calc(100vh - 84px - var(--bar-h) - 36px); }
  .rank:not(.is-collapsed) ~ .legend { left: 342px; }
}

.chip {
  flex: none; min-width: 40px; height: 26px; padding: 0 6px; border-radius: 8px;
  display: inline-grid; place-items: center;
  font-stretch: 78%; font-weight: 800; font-size: 15px;
}
.chip-small { min-width: 32px; height: 20px; font-size: 13px; border-radius: 6px; }

/* --- Fiche spot ----------------------------------------------------------- */
.panel {
  top: 84px; right: 12px; bottom: calc(var(--bar-h) + 24px); width: 440px;
  overflow-y: auto; padding: 0 18px 22px;
  scrollbar-width: thin; scrollbar-color: var(--line) transparent;
}
.panel-head {
  position: sticky; top: 0; z-index: 2; margin: 0 -18px; padding: 14px 18px 0;
  background: var(--panel); border-bottom: 1px solid var(--line);
}
.panel-title { display: flex; justify-content: space-between; align-items: start; gap: 12px; }
.tabs { display: flex; gap: 4px; margin-top: 10px; }
.tabs button {
  padding: 8px 12px 9px; font-weight: 600; font-size: 14px; color: var(--muted);
  border-bottom: 3px solid transparent; border-radius: 6px 6px 0 0;
}
.tabs button:hover { color: var(--text); background: var(--panel-2); }
.tabs button[aria-selected="true"] { color: var(--text); border-bottom-color: var(--accent); }
.panel-head h2 { font-size: 27px; font-weight: 800; letter-spacing: -0.025em; line-height: 1.05; }
.panel-head p { color: var(--muted); font-size: 13.5px; margin-top: 4px; }
.panel-actions { display: flex; gap: 6px; align-items: center; flex: none; }
.panel-fold, .panel-close { color: var(--muted); font-size: 13.5px; padding: 6px 10px; border: 1px solid var(--line); border-radius: 9px; }
.panel-close { width: 34px; padding: 6px 0; font-size: 22px; line-height: 1; }
.panel-fold:hover, .panel-close:hover { color: var(--text); background: var(--panel-2); }
/* Fiche repliée : seul l'en-tête (nom du spot et boutons) reste affiché. */
.panel.is-folded { bottom: auto; padding-bottom: 0; overflow: hidden; }
.panel.is-folded .panel-head { border-bottom: 0; padding-bottom: 12px; }
.panel.is-folded .tabs, .panel.is-folded .notice, .panel.is-folded #contenu-spot { display: none; }
.panel h3 { font-size: 15px; font-weight: 700; margin: 22px 0 8px; }
.notice { margin-top: 12px; padding: 8px 12px; border-radius: 10px; background: var(--panel-2); font-size: 13.5px; }

.hero { display: flex; align-items: center; gap: 14px; margin-top: 12px; }
.rose { width: 172px; flex: none; }
.rose-ring { fill: rgba(124, 199, 242, 0.07); stroke: var(--line); stroke-width: 1.5; }
.rose-land { fill: none; stroke-width: 9; stroke-linecap: butt; }
.rose-tick { stroke: var(--muted); stroke-width: 1; opacity: 0.7; }
.rose-card { font-size: 10.5px; font-weight: 600; fill: var(--muted); }
.rose-note { font-size: 27px; font-weight: 800; font-stretch: 78%; }
.hero-when { color: var(--muted); font-size: 13.5px; }
.hero-when::first-letter { text-transform: uppercase; }
.hero-label { font-size: 22px; font-weight: 700; line-height: 1.15; letter-spacing: -0.015em; margin: 4px 0 10px; }
.rose-key { display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: 12.5px; color: var(--muted); }
.rose-key li { display: flex; align-items: center; gap: 5px; }
.rose-key i { width: 14px; height: 3px; border-radius: 2px; }
.link { margin-top: 10px; font-size: 13.5px; text-decoration: underline; text-underline-offset: 3px; color: var(--text); }

.facts { margin-top: 16px; border-top: 1px solid var(--line); }
.facts > div { display: grid; grid-template-columns: 126px 1fr; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--line); }
.facts dt { color: var(--muted); font-size: 13.5px; }
.facts dd { display: grid; gap: 1px; }
.facts dd strong { font-weight: 600; }
.facts dd span { font-size: 12.5px; color: var(--muted); }

.parts li { display: grid; grid-template-columns: 110px 1fr 44px; align-items: center; gap: 10px; padding: 3px 0; font-size: 13.5px; }
.parts-label { color: var(--muted); }
.parts-bar { height: 6px; border-radius: 3px; background: var(--panel-2); overflow: hidden; }
.parts-bar i { display: block; height: 100%; border-radius: 3px; background: var(--text); }
.parts-value { text-align: right; font-stretch: 80%; font-weight: 600; font-variant-numeric: tabular-nums; }

.days button { width: 100%; display: grid; grid-template-columns: 40px 64px 1fr auto; align-items: center; gap: 10px; padding: 5px 6px; border-radius: 9px; text-align: left; font-size: 13.5px; }
.days button:hover { background: var(--panel-2); }
.days-day { font-weight: 600; }
.days-slot { color: var(--muted); }
.days-label { color: var(--muted); font-size: 12.5px; }
/* Rappel de pluie sous le créneau (hors note) */
.days-rain { grid-column: 3 / -1; margin-top: -5px; font-size: 12px; color: var(--muted); }
.days-rain.is-wet { color: #8fa9ff; }

.charts-wrap { margin: 0 -6px; }
.charts { width: 100%; display: block; touch-action: pan-y; }
.ch-night { fill: rgba(2, 8, 22, 0.34); }
.ch-day { stroke: var(--line); stroke-width: 1; }
.ch-daylabel { font-size: 10.5px; font-weight: 600; fill: var(--muted); }
.ch-title { font-size: 11px; font-weight: 600; fill: var(--text); }
.ch-legend { font-size: 9.5px; fill: var(--muted); }
.ch-tick { font-size: 9.5px; fill: var(--muted); font-variant-numeric: tabular-nums; }
.ch-point { font-size: 9px; fill: var(--muted); }
.ch-grid { stroke: var(--line); stroke-width: 0.6; stroke-dasharray: 2 3; }
.ch-base { stroke: var(--line); stroke-width: 1; }
.ch-arrow { fill: none; stroke: var(--muted); stroke-width: 1.2; stroke-linecap: round; stroke-linejoin: round; }
.ch-selected { stroke: var(--accent); stroke-width: 1.5; }
.ch-cross { stroke: var(--text); stroke-width: 1; opacity: 0.7; }
.ch-hit { cursor: crosshair; }

.table-wrap { margin-top: 8px; font-size: 13px; }
.table-wrap summary { cursor: pointer; color: var(--muted); padding: 6px 0; text-decoration: underline; text-underline-offset: 3px; }
.table-wrap summary:hover { color: var(--text); }
.table-wrap table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.table-wrap { overflow-x: auto; }
.vent-immediat {
  width: 100%; border-collapse: collapse; margin-top: 14px;
  font-size: 14px; font-variant-numeric: tabular-nums;
}
.vent-immediat th, .vent-immediat td { padding: 9px 3px; text-align: right; border-bottom: 1px solid var(--line); }
.vent-immediat th:first-child { text-align: left; }
.vent-immediat thead th { color: var(--muted); font-weight: 500; }
.vent-immediat .jour-vent { background: var(--panel-2); }
.vent-immediat .jour-vent th { padding-left: 8px; }
.vent-immediat .prochaine { color: var(--text); box-shadow: inset 3px 0 var(--accent); }
.vent-immediat .prochaine th { padding-left: 8px; }
.vent-immediat td:nth-child(2) { font-weight: 700; }
.vent-passe { margin-top: 14px; border-top: 1px solid var(--line); }
.vent-passe summary { padding: 12px 0; color: var(--muted); cursor: pointer; }
.table-wrap th, .table-wrap td { padding: 4px 4px; text-align: left; border-bottom: 1px solid var(--line); white-space: nowrap; }
.table-wrap thead th { color: var(--muted); font-weight: 500; font-size: 12px; }
.table-wrap tbody th { font-weight: 600; }
.table-wrap tr.is-current { background: var(--panel-2); }

.prose { font-size: 14px; max-width: 62ch; margin-top: 6px; }
.prose.hazard strong { color: var(--danger); font-weight: 600; }
.foil-reglages { display: flex; flex-wrap: wrap; gap: 10px 16px; margin-top: 14px; }
.foil-reglages label { display: grid; gap: 4px; font-size: 13px; color: var(--muted); }
.foil-reglages input, .foil-reglages select {
  width: 100%; min-height: 40px; padding: 4px 10px; color: var(--text); font: inherit;
  font-size: 16px; background: var(--sea); border: 1px solid var(--line); border-radius: 6px;
}
.foil-distance strong { font-size: 26px; color: #68e3cd; }
.foil-distance small { display: block; color: var(--muted); font-size: 13px; }
.foil-coupe { display: block; width: 100%; margin: 12px 0; background: var(--sea); border-radius: 8px; }
.foil-heures { display: flex; flex-wrap: wrap; gap: 6px; }
.foil-heures button { padding: 8px 10px; background: var(--panel-2); border-radius: 6px; font-size: 14px; }
.foil-heures button:hover { text-decoration: underline; }
.fonds-foil-reglage { display: flex; align-items: center; gap: 8px; margin-top: 8px; font-size: 12px; }
.fonds-foil-reglage input { width: 70px; padding: 4px; font: inherit; background: var(--sea); border: 1px solid var(--line); border-radius: 5px; }
.fonds-foil-cle { display: inline-block; width: 12px; height: 12px; background: #00e9b4; border-radius: 2px; }
.prose.small { font-size: 12.5px; color: var(--muted); margin-top: 12px; }

/* --- Légende -------------------------------------------------------------- */
.legend { left: 12px; bottom: calc(var(--bar-h) + 24px); width: 318px; padding: 10px 14px 10px; }
.legend-title { display: flex; justify-content: space-between; gap: 8px; font-size: 12.5px; align-items: baseline; }
.legend-title span { color: var(--muted); text-align: right; font-size: 11.5px; }
.legend-source-spot { color: var(--muted); font-size: 11px; margin-top: 3px; }
.legend-bar { height: 8px; border-radius: 4px; margin-top: 7px; }
.legend-ticks { position: relative; height: 15px; font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums; }
.legend-ticks span { position: absolute; top: 2px; transform: translateX(-50%); }
.legend-ticks span:first-child { transform: none; }
.legend-ticks span:last-child { transform: translateX(-100%); }
.legend-notes { display: flex; flex-wrap: wrap; gap: 3px 10px; margin-top: 7px; padding-top: 7px; border-top: 1px solid var(--line); font-size: 11.5px; color: var(--muted); }
.legend-notes li { display: flex; align-items: center; gap: 4px; }
.legend-notes i { width: 9px; height: 9px; border-radius: 3px; }

/* --- Frise horaire -------------------------------------------------------- */
.timeline {
  left: 12px; right: 12px; bottom: 12px; height: var(--bar-h);
  display: grid; grid-template-columns: auto 150px 1fr auto; align-items: center; gap: 14px;
  padding: 10px 14px;
}
.tl-actions { display: grid; gap: 5px; }
.tl-actions .tool { white-space: nowrap; }
.fonds-legende-toggle { color: var(--accent); font-size: 12px; padding: 4px; }
.play { width: 46px; height: 46px; border-radius: 50%; background: var(--accent); display: grid; place-items: center; }
.play svg { width: 20px; height: 20px; fill: var(--accent-ink); }
.play .i-pause, .play[aria-pressed="true"] .i-play { display: none; }
.play[aria-pressed="true"] .i-pause { display: block; }
.tl-now {
  display: grid; align-content: center; position: relative; min-width: 0; min-height: 44px;
  padding: 4px 18px 4px 6px; border-radius: 8px;
}
.tl-now::after {
  content: ""; position: absolute; top: calc(50% - 4px); right: 5px; width: 6px; height: 6px;
  border: solid var(--accent); border-width: 0 2px 2px 0; transform: rotate(45deg); pointer-events: none;
}
.tl-now:hover, .tl-now:focus-within { background: var(--panel-2); }
.tl-now:focus-within { outline: 2px solid var(--accent); }
#tl-heure { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; font: inherit; font-size: 16px; cursor: pointer; }
.tl-now strong { font-size: 19px; font-weight: 700; letter-spacing: -0.01em; line-height: 1.15; }
.tl-now strong::first-letter { text-transform: uppercase; }
.tl-now span { font-size: 12px; color: var(--muted); }
.tl-modeles { position: absolute; top: -17px; left: 0; right: 0; height: 14px; pointer-events: none; }
.tl-modeles span { position: absolute; white-space: nowrap; color: var(--muted); font-size: 10px; line-height: 14px; padding-left: 4px; border-left: 1px solid var(--line); }
.tl-modeles b { display: inline-block; font-weight: 500; }
.tl-now .tl-modele-actuel { color: var(--muted); font-size: 10px; line-height: 1.2; }
/* --strip-h : bande des notes ; --detail-h : courbes du spot ouvert (0 sinon). */
.tl-track { --strip-h: 40px; --detail-h: 0px; position: relative; height: calc(var(--strip-h) + var(--detail-h) + 22px); }
#tl-strip { position: absolute; left: 0; right: 0; top: 0; height: var(--strip-h); width: 100%; border-radius: 6px; background: var(--sea); }
#tl-detail { position: absolute; left: 0; right: 0; top: calc(var(--strip-h) + 4px); width: 100%; height: var(--detail-h); display: none; border-radius: 6px; background: var(--sea); }
.tl-row-label { font-size: 10.5px; font-weight: 600; fill: var(--muted); paint-order: stroke; stroke: var(--sea); stroke-width: 3px; }
.tl-days { position: absolute; left: 0; right: 0; top: calc(var(--strip-h) + 4px); height: 18px; font-size: 12px; color: var(--muted); }
@media (min-width: 860px) and (min-height: 620px) {
  body.has-panel { --bar-h: 140px; }
  body.has-panel.frise-complete { --bar-h: 242px; }
  body.has-panel .tl-track { --strip-h: 26px; --detail-h: 58px; }
  body.has-panel.frise-complete .tl-track { --detail-h: 160px; }
  body.has-panel #tl-detail { display: block; }
  body.has-panel .tl-days { top: calc(var(--strip-h) + var(--detail-h) + 8px); }
}
.tl-days span { position: absolute; padding-left: 5px; border-left: 1px solid var(--line); white-space: nowrap; font-weight: 600; }
.tl-cursor { position: absolute; top: -4px; height: calc(var(--strip-h) + var(--detail-h) + 8px); width: 0; border-left: 2px solid var(--text); pointer-events: none; }
.tl-cursor::before { content: ""; position: absolute; left: -7px; top: -5px; width: 12px; height: 12px; border-radius: 50%; background: var(--text); box-shadow: 0 1px 4px rgba(0, 0, 0, 0.6); }
#tl-range { position: absolute; left: 0; right: 0; top: -6px; width: 100%; height: calc(var(--strip-h) + var(--detail-h) + 12px); margin: 0; opacity: 0; cursor: ew-resize; }
#tl-range:focus-visible + * , .tl-track:focus-within #tl-strip { outline: 2px solid var(--accent); outline-offset: 2px; }
.timeline .tool { border: 1px solid var(--line); }

/* --- Messages ------------------------------------------------------------- */
.status { top: 84px; left: 50%; transform: translateX(-50%); max-width: min(560px, calc(100vw - 24px)); padding: 8px 14px; font-size: 13.5px; text-align: center; }
.status.is-error { border-color: var(--danger); }
body.has-panel .status { left: calc(50% - 150px); }

.tip { z-index: 20; pointer-events: none; padding: 8px 11px; border-radius: 10px; font-size: 12.5px; max-width: 260px; }
.tip p { display: flex; align-items: baseline; gap: 6px; }
.tip p i { width: 10px; height: 3px; border-radius: 2px; flex: none; align-self: center; }
.tip strong { font-weight: 700; font-size: 14px; font-stretch: 82%; white-space: nowrap; }
.tip span { color: var(--muted); }
.tip .tip-title { font-weight: 600; margin-bottom: 3px; text-transform: none; }
.tip .tip-title::first-letter { text-transform: uppercase; }

/* La fenêtre elle-même ne défile pas (overflow visible) pour que la croix puisse
   sortir du cadre ; c'est le contenu qui défile. */
.about { --about-h: calc(100dvh - 48px); width: min(640px, calc(100vw - 24px)); max-height: none; padding: 0; overflow: visible; border: 1px solid var(--line); border-radius: 18px; background: var(--panel); color: var(--text); box-shadow: var(--shadow); }
#about-body { max-height: var(--about-h); overflow-y: auto; padding: 26px 28px; border-radius: inherit; overscroll-behavior: contain; }
.about::backdrop { background: rgba(4, 12, 28, 0.6); backdrop-filter: blur(2px); }
.about h2 { font-size: 27px; font-weight: 800; letter-spacing: -0.025em; }
.about h3 { font-size: 15px; font-weight: 700; margin: 18px 0 4px; }
.about p { max-width: 66ch; font-size: 14.5px; }
.about-stamp, .about-credits { color: var(--muted); font-size: 13px !important; margin-top: 6px; }
.about-warning { margin-top: 18px; padding: 10px 14px; border-left: 3px solid var(--danger); background: var(--panel-2); border-radius: 0 10px 10px 0; }
.about-credits { margin-top: 14px; }
/* Croix ronde accolée à l'extérieur du coin haut droit (au-dessus sur écran étroit). */
.about-close { position: absolute; top: 0; left: calc(100% + 10px); display: grid; place-items: center; width: 40px; height: 40px; color: var(--text); background: var(--panel); border: 1px solid var(--line); border-radius: 50%; box-shadow: var(--shadow); transition: background 0.15s, transform 0.15s; }
.about-close svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
.about-close:hover { background: var(--panel-2); transform: rotate(90deg); }
@media (max-width: 760px) {
  .about { --about-h: calc(100dvh - 120px); }
  .about-close { top: auto; bottom: calc(100% + 10px); left: auto; right: 0; }
}

/* --- Contrôles MapLibre --------------------------------------------------- */
.maplibregl-ctrl-bottom-right { bottom: calc(var(--bar-h) + 18px); right: 4px; z-index: 4; transition: right 0.2s; }
body.has-panel .maplibregl-ctrl-bottom-right { right: 456px; }
.maplibregl-ctrl-group { background: var(--panel); border: 1px solid var(--line); box-shadow: var(--shadow) !important; }
.maplibregl-ctrl-group button + button { border-top-color: var(--line); }
.maplibregl-ctrl-group button .maplibregl-ctrl-icon { filter: invert(1) brightness(1.6); }
.maplibregl-ctrl-attrib { background: color-mix(in srgb, var(--panel) 85%, transparent) !important; font-size: 11px; }
.maplibregl-ctrl.maplibregl-ctrl-attrib, .maplibregl-ctrl.maplibregl-ctrl-attrib .maplibregl-ctrl-attrib-inner,
.maplibregl-ctrl.maplibregl-ctrl-attrib a { color: #fff; }
.maplibregl-ctrl-attrib-button { filter: invert(1); }
.maplibregl-marker { will-change: transform; }

/* --- Petits écrans -------------------------------------------------------- */
@media (max-width: 859px) {
  :root { --bar-h: calc(136px + env(safe-area-inset-bottom)); }
  .topbar { top: max(6px, env(safe-area-inset-top)); left: max(8px, env(safe-area-inset-left)); right: max(8px, env(safe-area-inset-right)); gap: 6px; }
  .brand { padding: 6px 12px 6px 8px; }
  .brand p { display: none; }
  .brand h1 { font-size: 18px; }
  .brand-mark { width: 26px; height: 26px; }
  .seg button { padding: 0 9px; min-height: 44px; }
  .tools { margin-left: 0; max-width: 100%; overflow-x: auto; scrollbar-width: none; }
  .tool, .rank-toggle, .panel-fold, .panel-close, .tabs button { min-height: 44px; }
  .panel-close { width: 44px; }
  .rank { top: auto; bottom: calc(var(--bar-h) + 8px); left: max(8px, env(safe-area-inset-left)); width: min(360px, calc(100vw - 16px)); max-height: calc(100dvh - var(--bar-h) - 124px); z-index: 6; }
  .rank:not(.is-collapsed) ~ .legend { visibility: hidden; }
  .legend { left: auto; right: max(8px, env(safe-area-inset-right)); bottom: calc(var(--bar-h) + 8px); width: min(180px, calc(100% - 160px)); padding: 8px 10px; }
  .legend-notes, .legend-title span { display: none; }
  body.has-panel .legend, body.has-panel .rank { display: none; }
  .panel { top: 21vh; top: max(21dvh, env(safe-area-inset-top)); left: 0; right: 0; bottom: var(--bar-h); width: auto; border-radius: 18px 18px 0 0; border-bottom: 0; padding: 0 max(14px, env(safe-area-inset-right)) 18px max(14px, env(safe-area-inset-left)); overscroll-behavior: contain; }
  body.has-panel .topbar { display: none; }
  /* Fiche repliée : barre du bas, carte et sélecteur de couche de nouveau accessibles. */
  body.has-panel.panel-folded .topbar { display: flex; }
  .panel.is-folded { top: auto; bottom: var(--bar-h); }
  body:not(.panel-folded):has(#onglet-vent15[aria-selected="true"]):has(.panel:not([hidden])) .timeline { display: none; }
  .panel:not(.is-folded):has(#onglet-vent15[aria-selected="true"]) { bottom: 0; padding-bottom: max(18px, env(safe-area-inset-bottom)); }
  .panel-head { margin: 0 -14px; padding: 12px 14px 0; }
  .panel-head h2 { font-size: 23px; }
  .rose { width: 138px; }
  .hero-label { font-size: 19px; }
  .timeline { left: 0; right: 0; bottom: 0; border-radius: 0; border-left: 0; border-right: 0; border-bottom: 0;
    grid-template-columns: auto 1fr auto; grid-template-rows: auto auto; gap: 6px 10px; padding: 8px 12px calc(8px + env(safe-area-inset-bottom)); }
  .tl-track { grid-column: 1 / -1; grid-row: 2; height: 52px; }
  #tl-strip { height: 32px; }
  .tl-days { top: 35px; font-size: 11px; }
  .tl-cursor { height: 40px; }
  body.has-panel { --bar-h: calc(198px + env(safe-area-inset-bottom)); }
  body.has-panel.frise-complete { --bar-h: calc(300px + env(safe-area-inset-bottom)); }
  body.has-panel .tl-track { --strip-h: 32px; --detail-h: 58px; height: calc(var(--strip-h) + var(--detail-h) + 22px); }
  body.has-panel.frise-complete .tl-track { --detail-h: 160px; }
  body.has-panel #tl-detail { display: block; }
  body.has-panel .tl-days { top: calc(var(--strip-h) + var(--detail-h) + 8px); }
  body.has-panel .tl-cursor { height: calc(var(--strip-h) + var(--detail-h) + 8px); }
  .tl-actions { display: flex; gap: 4px; }
  .tl-actions .tool { font-size: 12px; padding: 6px; }
  .play { width: 44px; height: 44px; }
  .tl-now strong { font-size: 16px; }
  .tl-modeles span { font-size: 9px; }
  .status { top: auto; bottom: calc(var(--bar-h) + 70px); left: 8px; right: 8px; transform: none; max-width: none; }
  body.has-panel .status { display: none; }
  .maplibregl-ctrl-bottom-right { display: none; }
}

@media (max-width: 600px) {
  .topbar, body.has-panel.panel-folded .topbar { display: grid; grid-template-columns: 1fr auto; }
  .brand { justify-self: start; }
  .tools { grid-column: 2; grid-row: 1; }
  #wind-flag { width: 44px; justify-content: center; }
  #wind-flag-text { display: none; }
  #layer-switch { grid-column: 1 / -1; display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; }
  #layer-switch button { padding: 0 3px; }
  .map-menu { max-height: calc(100dvh - 80px); overflow-y: auto; }
  .tabs { display: flex; gap: 0; }
  .tabs button { flex: 1 1 0; min-width: 0; }
  .panel .tabs button { padding: 7px 2px; font-size: clamp(13px, 3.6vw, 15px); }
  .facts > div { grid-template-columns: minmax(80px, 30%) 1fr; }
}

@media (max-height: 520px) and (orientation: landscape) {
  .rank:not(.is-collapsed) { top: 6px; bottom: 6px; max-height: none; z-index: 8; }
  body.has-panel .topbar, body.has-panel .rank, body.has-panel .legend { display: none; }
  .panel { top: max(4px, env(safe-area-inset-top)); bottom: var(--bar-h); left: 0; right: 0; width: auto; }
  .panel-head { position: static; }
  .panel:not(.is-folded):has(#onglet-vent15[aria-selected="true"]) { bottom: 0; }
  body:not(.panel-folded):has(.panel:not([hidden]) #onglet-vent15[aria-selected="true"]) .timeline { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}

.wind-flag { display: inline-flex; align-items: center; gap: 7px; font-size: 13px; border: 1px solid var(--line); }
.wind-flag .tool-icon { width: 16px; height: 16px; }
.wind-flag.is-warning { color: var(--accent); border-color: color-mix(in srgb, var(--accent) 55%, transparent); }

/* --- Ce qui joue a cette heure -------------------------------------------- */
.why { display: grid; gap: 7px; }
.why li { display: grid; grid-template-columns: 20px 1fr; gap: 8px; font-size: 13.5px; line-height: 1.4; }
.why-sign {
  width: 20px; height: 20px; border-radius: 50%; display: grid; place-items: center;
  font-weight: 800; font-size: 14px; line-height: 1; background: var(--panel-2); color: var(--muted);
}
.why-plus .why-sign { background: #8fd06a; color: var(--accent-ink); }
.why-minus .why-sign { background: #b9643f; color: #fff; }
.why + .link { margin-top: 12px; }

/* --- Lecture du spot ------------------------------------------------------ */
.prose.lead { margin-top: 14px; }
.read-figure { display: flex; align-items: center; gap: 12px; margin: 4px 0 10px; }
.read-rose { width: 216px; flex: none; }
.read-rose-small { width: 176px; }
.read-grid { fill: none; stroke: var(--line); stroke-width: 1; stroke-dasharray: 2 3; }
.read-tick { font-size: 8.5px; fill: var(--muted); }
.read-value { font-size: 9.5px; font-weight: 700; fill: var(--text); font-stretch: 85%; }
.read-bar { cursor: help; }
.read-bar:hover, .read-bar:focus-visible { stroke: var(--text); stroke-width: 1.5; outline: none; }
.read-key { display: grid; gap: 7px; font-size: 12px; color: var(--muted); line-height: 1.35; }
.read-key li { display: grid; grid-template-columns: 14px 1fr; gap: 7px; align-items: start; }
.read-key i { width: 12px; height: 12px; border-radius: 3px; margin-top: 2px; }
.read-key i.is-ring { background: none; border: 3px solid; border-radius: 50%; }
.tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 10px; }
.tiles li { display: grid; gap: 3px; padding: 10px 12px; border-radius: 10px; background: var(--panel-2); }
.tiles strong { font-size: 22px; font-weight: 800; font-stretch: 80%; line-height: 1.1; }
.tiles span:not(.chip) { font-size: 12px; color: var(--muted); line-height: 1.3; }
.tiles .chip { font-size: 17px; height: 28px; min-width: 46px; }
.legend-expo { margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--line); }
.legend-expo { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; }
.legend-expo-label { font-size: 12px; color: var(--muted); }
.carte-litto3d .edge-label { display: none; }
.legende-fonds { font-size: 12px; margin-top: 5px; }
.legende-fonds a { color: inherit; }
.reperes-fonds { display: flex; flex-wrap: wrap; gap: 4px 10px; margin-top: 5px; font-size: 12px; }
.reperes-fonds li { display: flex; align-items: center; gap: 4px; }
.reperes-fonds i { width: 10px; height: 10px; border-radius: 2px; }
.legend-expo .seg { display: inline-flex; background: var(--sea); }
.legend-expo p { flex-basis: 100%; }
.legend-expo p { margin-top: 2px; font-size: 11.5px; color: var(--muted); line-height: 1.35; }
.rank-head .seg { flex-wrap: wrap; }

@media (max-width: 859px) {
  .read-figure { flex-direction: column; align-items: flex-start; }
  .legend-expo p { display: none; }
}

/* --- Observations --------------------------------------------------------- */
.tabs button { padding-left: 9px; padding-right: 9px; }
.obs-list { display: grid; gap: 8px; }
.obs-card { padding: 10px 12px; border-radius: 10px; background: var(--panel-2); display: grid; gap: 3px; }
.obs-head { display: flex; justify-content: space-between; gap: 10px; align-items: baseline; }
.obs-head a { font-weight: 600; color: var(--text); text-underline-offset: 3px; }
.obs-source { font-size: 11.5px; color: var(--muted); white-space: nowrap; }
.obs-value { display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: baseline; }
.obs-value strong { font-size: 20px; font-weight: 800; font-stretch: 82%; }
.obs-value span { font-size: 13px; color: var(--text); }
.obs-meta { font-size: 12.5px; color: var(--muted); line-height: 1.35; }
.obs-list + .prose { margin-top: 10px; }
.obs-links { display: grid; gap: 2px; }
.obs-links li { display: flex; flex-wrap: wrap; gap: 2px 8px; align-items: baseline; padding: 5px 0; border-bottom: 1px solid var(--line); font-size: 13.5px; }
.obs-links a { color: var(--text); text-underline-offset: 3px; }
.obs-links span { font-size: 12px; color: var(--muted); }

.obs-feeds { display: grid; gap: 12px; margin: 8px 0 12px; }
.obs-feed { margin: 0; }
.obs-feed figcaption { display: flex; justify-content: space-between; gap: 10px; align-items: baseline; margin-bottom: 6px; font-size: 13.5px; }
.obs-feed figcaption a { font-weight: 600; color: var(--text); text-underline-offset: 3px; }
.obs-feed figcaption span { font-size: 12px; color: var(--muted); }
.obs-feed iframe { width: 100%; height: 520px; border: 0; border-radius: 10px; background: #fff; }

.obs-feed iframe.is-cam { height: auto; aspect-ratio: 16 / 9; background: #000; }
.obs-feed img { width: 100%; border-radius: 10px; display: block; }
.obs-posts { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 10px; }
.obs-posts a { display: grid; gap: 4px; color: inherit; text-decoration: none; }
.obs-posts img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 8px; }
.obs-video { aspect-ratio: 1; display: grid; place-items: center; border-radius: 8px; background: var(--panel-2); font-weight: 600; }
.fonds-foil-cle.insuffisante { background: #ff5656; }
