:root {
  --bg: #050e1a;
  --card: #081729;
  --card-2: #0a1b2e;
  --ink: #f1f5f9;
  --muted: #7d93a8;
  --line: rgba(255,255,255,.09);
  --green: #1fae5e;
  --orange: #f0a020;
  --red: #e8453d;
  --blue: #2f9bff;
  --accent: #29a9ff;
  --green-bright: #4ade80;
  --orange-bright: #fbbf24;
  --red-bright: #ff6b63;
  --red-dark: #b91c1c;
  --blue-bright: #60c8ff;
  --font: 'Outfit', -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.45;
  display: flex; flex-direction: column;
  height: 100vh; height: 100dvh;
  overflow: hidden;
  padding-bottom: env(safe-area-inset-bottom);
}

main { flex: 1; min-height: 0; overflow-y: auto; padding: 12px; max-width: 720px; width: 100%; margin: 0 auto; }
.screen { display: none; }
.screen.active { display: block; animation: fade .25s ease; }
#dashboard.active { display: flex; flex-direction: column; min-height: 100%; }
@keyframes fade { from { opacity: 0; transform: translateY(6px);} to { opacity: 1; transform: none; } }

/* Hero "Puis-je sortir ?" : grandit pour combler l'espace dispo, photo extensible */
.hero-card {
  position: relative; overflow: hidden; display: flex; flex-direction: column; flex: 1; min-height: 0;
  background: radial-gradient(120% 140% at 50% -10%, #0e2236 0%, var(--card) 55%, var(--card) 100%);
  border: 1px solid var(--line); border-radius: 6px; padding: 14px; margin-bottom: 12px;
}
/* Photo + courbe : un seul panneau continu, la photo s'estompe dans le fond du graphique */
.hero-visual {
  position: relative; border-radius: 4px; overflow: hidden; display: flex; flex-direction: column; flex: 1; min-height: 0;
  background: var(--card-2);
}
.hero-visual-photo-wrap { position: relative; flex: 1; min-height: 140px; }
.hero-visual-photo {
  position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover;
  animation: heroPhotoFade .5s ease;
}
@keyframes heroPhotoFade { from { opacity: 0; } to { opacity: 1; } }
.hero-visual-scrim {
  position: absolute; inset: 0;
  background:
    linear-gradient(100deg, rgba(5,14,26,.65) 0%, rgba(5,14,26,.3) 42%, transparent 68%),
    linear-gradient(180deg, transparent 32%, var(--card-2) 88%);
}
.hero-photo-location {
  position: absolute; top: 10px; right: 12px; color: rgba(241,245,249,.85);
  font-size: 12px; font-weight: 600; text-shadow: 0 1px 8px rgba(0,0,0,.6);
}
.hero-overlay {
  position: absolute; left: 14px; right: auto; top: 50%; max-width: 70%;
  transform: translateY(-50%); color: #f1f5f9;
  text-shadow: 0 1px 8px rgba(0,0,0,.6);
}
.hero-overlay-label { font-size: 15px; font-weight: 600; opacity: .9; margin-bottom: 2px; }
.hero-overlay-value {
  display: block; font-size: 40px; font-weight: 800; letter-spacing: -.4px; line-height: 1.1;
  font-variant-numeric: tabular-nums; color: var(--red-bright);
}
.hero-overlay-value.gauge-green { color: var(--green-bright); }
.hero-overlay-value.gauge-orange { color: var(--orange-bright); }
.hero-overlay-value.gauge-red { color: var(--red-bright); }
.hero-overlay-value.small-text {
  font-size: 15px; font-weight: 600; color: #f1f5f9; line-height: 1.4; max-width: 95%;
}
.hero-overlay-window { margin-top: 12px; }
.hero-overlay-window-head {
  display: flex; align-items: center; gap: 6px; font-size: 14px; font-weight: 600; opacity: .9;
}
.hero-overlay-window-icon { display: flex; opacity: .9; }
.hero-overlay-window-icon svg { display: block; width: 15px; height: 15px; }
.hero-overlay-window-label { opacity: .85; font-weight: 500; }
.hero-overlay-window-value {
  display: block; margin-top: 2px; font-size: 22px; font-weight: 700;
  font-variant-numeric: tabular-nums; letter-spacing: -.2px;
}
.hero-window-ts-row {
  display: flex; justify-content: space-between; margin-top: 6px; gap: 8px;
  font-size: 10.5px; font-variant-numeric: tabular-nums; opacity: .9;
}
.hero-window-bar {
  display: flex; height: 5px; border-radius: 3px; overflow: hidden; margin-top: 3px;
  background: rgba(255,255,255,.12); max-width: 220px;
}
.hwb-safe { background: var(--green-bright); min-width: 2px; }
.hwb-caution { background: var(--orange-bright); opacity: .7; min-width: 2px; }
.hero-visual-chart {
  position: relative; flex: 0 0 90px; padding: 2px 6px 2px;
  overflow: hidden; /* filet de sécurité : Chart.js débordait visuellement de sa boîte */
}
.hero-visual-chart canvas { display: block; max-height: 100%; }

.hero-stats-row {
  display: grid; grid-template-columns: 1fr 88px 1fr; margin-top: 8px; position: relative;
  background: var(--card-2); border-radius: 5px; overflow: hidden;
}
.hero-stat { display: flex; align-items: center; justify-content: center; gap: 12px; padding: 11px 12px; position: relative; }
.hero-stat:not(:last-child)::after {
  content: ""; position: absolute; right: 0; top: 8px; bottom: 8px; width: 1px; background: var(--line);
}
.hero-stats-trend-badge {
  width: 100%; height: 52px; color: var(--muted);
  display: flex; align-items: center; justify-content: center;
}
.hero-stats-trend-badge svg { width: 38px; height: 38px; }
.hero-stats-trend-badge.gauge-green { color: var(--green-bright); }
.hero-stats-trend-badge.gauge-red { color: var(--red-bright); }
.hero-stat-text { display: flex; flex-direction: column; align-items: center; text-align: center; }
.hero-stat b { font-size: 22px; font-variant-numeric: tabular-nums; }
.hero-stat b.pos { color: var(--green-bright); }
.hero-stat b.neg { color: var(--red-bright); }
.hero-stat-text span { color: var(--muted); font-size: 13.5px; margin-top: 2px; }

.indicator-grid {
  display: grid; grid-template-columns: repeat(3, 1fr); margin-bottom: 6px;
  background: var(--card); border: 1px solid var(--line); border-radius: 6px; overflow: hidden;
}
.indicator { padding: 11px 5px 10px; text-align: center; position: relative; }
.indicator:not(:nth-child(3n)):not(:last-child)::after {
  content: ""; position: absolute; right: 0; top: 10px; bottom: 10px; width: 1px; background: var(--line);
}
.indicator:nth-child(-n+3)::before {
  content: ""; position: absolute; left: 10px; right: 10px; bottom: 0; height: 1px; background: var(--line);
}
.indicator-icon {
  width: auto; height: 24px; margin: 0 auto 6px;
  display: flex; align-items: center; justify-content: center;
}
.indicator-icon svg { display: block; width: 25px; height: 25px; }
.indicator-icon.ind-wind { color: #38bdf8; }
.indicator-icon.ind-pressure { color: #a78bfa; }
.indicator-icon.ind-rain { color: #60a5fa; }
.indicator-icon.ind-wave { color: #2dd4bf; }
.indicator-icon.ind-fish { color: #4ade80; }
.indicator-icon.ind-cloud { color: #94a3b8; }
.indicator-icon.ind-temp { color: #fb923c; }
.indicator b { display: block; font-size: 18px; font-variant-numeric: tabular-nums; }
.indicator span { display: block; color: var(--muted); font-size: 12.5px; margin-top: 4px; }
.indicator .exp-tag { display: inline-block; }
#ind-wind-sub { display: flex; justify-content: center; align-items: center; gap: 9px; }
#ind-wind-sub span { margin-top: 0; }
.exp-tag {
  font-size: 10px; font-weight: 800; color: var(--orange-bright); border: 1px solid rgba(240,160,32,.5);
  border-radius: 5px; padding: 1px 5px; margin-left: 2px; vertical-align: middle;
}
.fish-tier-bon { color: var(--green-bright); }
.fish-tier-moyen { color: var(--orange-bright); }
.fish-tier-faible { color: var(--red-bright); }

.fishing-summary {
  display: flex; align-items: center; gap: 12px; margin-top: 4px; padding: 9px 14px;
  background: var(--card); border: 1px solid var(--line); border-radius: 6px;
}
.fishing-summary .indicator-icon { margin: 0; height: 22px; }
.fishing-summary .indicator-icon svg { width: 20px; height: 20px; }
.fishing-summary b { font-size: 18px; font-variant-numeric: tabular-nums; }
.fishing-summary span { color: var(--muted); font-size: 13px; margin-left: auto; }

.info-list { background: var(--card); border: 1px solid var(--line); border-radius: 6px; overflow: hidden; }
.info-row { display: flex; justify-content: space-between; align-items: center; padding: 13px 16px; border-bottom: 1px solid var(--line); }
.info-row:last-child { border-bottom: none; }
.info-row span { color: var(--muted); font-size: 14px; }
.info-row b { font-variant-numeric: tabular-nums; font-weight: 700; text-align: right; }

.warning { margin-top: 14px; background: rgba(232,69,61,.15); border: 1px solid rgba(232,69,61,.4); color: var(--red-bright); padding: 12px 14px; border-radius: 5px; font-size: 14px; }
.hidden { display: none; }

/* Marée locale */
.filters { display: flex; gap: 8px; margin-bottom: 14px; }
.filters button {
  flex: 1; background: var(--card); color: var(--muted); border: 1px solid var(--line);
  border-radius: 999px; padding: 9px 0; font-weight: 600; font-size: 14px; cursor: pointer;
  font-family: var(--font); transition: background .15s ease, color .15s ease;
}
.filters button.active { background: var(--accent); color: var(--bg); border-color: var(--accent); }
.chart-wrap { background: var(--card); border: 1px solid var(--line); border-radius: 6px; padding: 12px; height: 60vh; min-height: 340px; }

.tide-day-card { padding: 12px 14px; }
.tide-day-header { font-weight: 700; font-size: 14.5px; margin-bottom: 8px; }
.tide-event-row {
  display: flex; align-items: center; gap: 9px; padding: 8px 0; border-top: 1px solid var(--line);
}
.tide-day-card .tide-event-row:first-of-type { border-top: none; }
.tide-event-icon { flex: none; display: flex; color: var(--muted); }
.tide-event-label { flex: none; width: 80px; color: var(--muted); font-size: 13.5px; }
.tide-event-time { flex: none; width: 48px; font-weight: 600; font-variant-numeric: tabular-nums; }
.tide-event-height { flex: 1; text-align: right; font-weight: 700; font-variant-numeric: tabular-nums; }
.tide-event-height.pos { color: var(--green-bright); }
.tide-event-height.neg { color: var(--red-bright); }
.tide-event-coef { flex: none; width: 64px; text-align: right; color: var(--muted); font-size: 12.5px; }

/* Relevé terrain */
.card { background: var(--card); border: 1px solid var(--line); border-radius: 6px; padding: 16px; margin-bottom: 16px; }
.form-card { display: flex; flex-direction: column; gap: 8px; }
.form-card label { color: var(--muted); font-size: 13px; margin-top: 4px; }
.form-card input {
  background: var(--card-2); border: 1px solid var(--line); border-radius: 10px;
  color: var(--ink); padding: 10px 12px; font-size: 16px;
}
.form-card button {
  margin-top: 10px; background: var(--accent); color: var(--bg); border: none;
  border-radius: 999px; padding: 12px 0; font-size: 15px; font-weight: 700; cursor: pointer;
  font-family: var(--font);
}
.form-card button:disabled { opacity: .6; }
.cal-card .cal-explain { margin: 0 0 12px; line-height: 1.5; }
.cal-card .cal-row { display: flex; justify-content: space-between; align-items: center; padding: 4px 0; }
.cal-card .cal-row span { color: var(--muted); font-size: 14px; }
.cal-card .cal-row b { font-variant-numeric: tabular-nums; }
.cal-card #cal-height-examples { margin: 8px 0 4px; }
.cal-card .cal-tech { margin-top: 10px; }
.cal-card .cal-tech summary {
  color: var(--muted); font-size: 13px; cursor: pointer; padding: 4px 0; list-style: none;
}
.cal-card .cal-tech summary::-webkit-details-marker { display: none; }
.cal-card .cal-tech summary::before { content: "▸ "; }
.cal-card .cal-tech[open] summary::before { content: "▾ "; }
.chart-wrap.small { height: 160px; margin-top: 10px; padding: 8px; }
.history-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.history-table th { text-align: left; color: var(--muted); font-weight: 600; padding: 6px 8px; border-bottom: 1px solid var(--line); }
.history-table td { padding: 7px 8px; border-bottom: 1px solid var(--line); font-variant-numeric: tabular-nums; }
.history-table tr:last-child td { border-bottom: none; }
.history-table tr.wx-medium td { color: var(--orange); }

/* Pêche (expérimental) */
.experimental-banner {
  margin-bottom: 14px; background: rgba(240,160,32,.15); border: 1px solid rgba(240,160,32,.4);
  color: var(--orange-bright); padding: 12px 14px; border-radius: 5px; font-size: 14px; font-weight: 600;
}
.muted-text { color: var(--muted); font-size: 13px; margin-top: 8px; }

/* Tab bar : sobre, pas de contour ni de fond, juste un trait sur l'onglet actif */
.tabbar {
  position: sticky; bottom: 0; display: flex; gap: 4px; background: var(--bg); border-top: 1px solid var(--line);
  padding: 0 8px env(safe-area-inset-bottom);
}
.tab {
  flex: 1; position: relative; background: none; border: none; color: var(--muted); margin: 0;
  padding: 13px 0 11px; border-radius: 0; font-size: 14px; font-weight: 600; cursor: pointer;
  font-family: var(--font); transition: color .15s ease;
}
.tab::before {
  content: ""; position: absolute; top: 0; left: 24%; right: 24%; height: 2.5px;
  background: var(--accent); opacity: 0; transition: opacity .15s ease;
}
.tab.active { color: var(--accent); }
.tab.active::before { opacity: 1; }

/* ── Sub-tabs (onglet Données) ── */
.subtabs {
  display: flex; gap: 4px; margin-bottom: 16px;
  padding: 4px; background: var(--card); border-radius: 999px;
}
.subtab {
  flex: 1; padding: 8px 4px; border: none; border-radius: 999px;
  background: transparent; color: var(--muted); font-family: var(--font);
  font-size: 14px; font-weight: 500; cursor: pointer;
}
.subtab.active { background: var(--card-2); color: var(--ink); font-weight: 600; }
.subscreen { display: none; }
.subscreen.active { display: block; }

/* ── Planning cards ── */
.plan-card {
  background: var(--card); border: 1px solid var(--line);
  border-radius: 6px; padding: 16px; margin-bottom: 10px;
}
.plan-card-header {
  display: flex; justify-content: space-between; align-items: baseline;
  margin-bottom: 12px;
}
.plan-date { font-weight: 700; font-size: 16px; }
.plan-coef { color: var(--muted); font-size: 13px; }

/* Barre fenêtre bicolore */
.plan-ts-row {
  display: flex; justify-content: space-between; margin-bottom: 5px;
}
.plan-ts { font-size: 11px; font-variant-numeric: tabular-nums; }
.ts-limit { color: var(--muted); }
.ts-safe { color: var(--ink); font-weight: 600; }
.plan-window-bar {
  display: flex; height: 10px; border-radius: 5px; overflow: hidden;
  background: var(--card-2);
}
.plan-bar-safe { background: var(--green); min-width: 3px; }
.plan-bar-caution { background: var(--orange); opacity: .55; min-width: 3px; }
.plan-durations {
  display: flex; gap: 12px; margin-top: 6px; font-size: 12px;
}
.dur-safe { color: var(--green); }
.dur-phys { color: var(--muted); }

/* Métriques */
.plan-metrics {
  display: flex; flex-direction: column; gap: 9px;
  margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--line);
}
.plan-metrics.muted-wx { opacity: .6; }
.plan-metrics.wx-hidden { display: none; }
.plan-metric { display: flex; align-items: center; gap: 10px; }
.pm-label {
  width: 72px; flex: none;
  color: var(--muted); font-size: 13px;
  white-space: nowrap;
}
.pm-bar-track {
  flex: 1; height: 6px; background: var(--card-2);
  border-radius: 3px; position: relative; overflow: hidden;
}
.pm-bar-fill {
  position: absolute; top: 0; height: 100%; border-radius: 3px;
}
.pm-bar-wind { background: var(--accent); }
.pm-bar-wave { background: #6bcff5; }
.pm-bar-fish { background: var(--green); }
.pm-val {
  font-size: 12px; font-variant-numeric: tabular-nums;
  width: 90px; text-align: right; flex: none; color: var(--ink);
}

/* Carte sans fenêtre */
.plan-no-win { opacity: .45; }
.plan-no-win-label { color: var(--muted); font-size: 14px; margin-top: 4px; }
.plan-loading { color: var(--muted); text-align: center; padding: 24px 0; font-size: 14px; }

/* ── Carousel par zone (indicateur de sortie navigation, accueil) ── */
.zone-carousel-wrap { margin-bottom: 4px; position: relative; }
.zone-carousel {
  display: flex; overflow-x: auto; scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch; scrollbar-width: none;
}
.zone-carousel::-webkit-scrollbar { display: none; }
.zone-panel { flex: 0 0 100%; scroll-snap-align: start; }
.zone-title { font-size: 14px; font-weight: 600; color: var(--ink); margin-bottom: 2px; text-align: center; }
.zone-badge {
  display: flex; align-items: center; gap: 8px; padding: 7px 14px; border-radius: 8px;
  background: var(--card); border: 1px solid var(--line); margin-bottom: 4px;
}
.zone-badge::before { content: ""; width: 12px; height: 12px; border-radius: 50%; flex: 0 0 auto; }
.zone-badge.lvl-super::before { background: var(--green-bright); }
.zone-badge.lvl-bon::before { background: var(--green); }
.zone-badge.lvl-moyen::before { background: var(--orange); }
.zone-badge.lvl-mauvais::before { background: var(--red-bright); }
.zone-badge.lvl-terrible::before { background: var(--red-dark); }
.zone-badge-label { font-weight: 700; font-size: 15px; }
.zone-badge-blurb { color: var(--muted); font-size: 13px; }

/* Chevrons de bord : superposés (position absolue), n'ajoutent aucune hauteur de mise
   en page — remplace les points qui poussaient la page en scroll vertical. */
.zone-chevron {
  position: absolute; top: 50%; transform: translateY(-50%);
  width: 26px; height: 26px; border-radius: 50%;
  background: rgba(8,23,41,.7); border: 1px solid var(--line); color: var(--muted);
  display: flex; align-items: center; justify-content: center;
  pointer-events: none; transition: opacity .15s ease; z-index: 1;
}
.zone-chevron.hidden-edge { opacity: 0; }
.zone-chevron-left { left: 2px; }
.zone-chevron-right { right: 2px; }
.zone-chevron svg { width: 14px; height: 14px; }

/* ── Badges par zone (Planning) ── */
.plan-outing-global { font-weight: 700; font-size: 12.5px; margin-top: 6px; }
.plan-outing-global.lvl-super { color: var(--green-bright); }
.plan-outing-global.lvl-bon { color: var(--green); }
.plan-outing-global.lvl-moyen { color: var(--orange); }
.plan-outing-global.lvl-mauvais { color: var(--red-bright); }
.plan-outing-global.lvl-terrible { color: var(--red-dark); }
.plan-outing-zones { display: flex; justify-content: space-between; gap: 6px; margin-top: 4px; flex-wrap: wrap; }
.plan-outing-badge {
  display: flex; align-items: center; gap: 5px; padding: 3px 8px; border-radius: 12px;
  background: var(--card-2); border: 1px solid var(--line); font-size: 11.5px; color: var(--muted);
}
.plan-outing-badge::before { content: ""; width: 8px; height: 8px; border-radius: 50%; flex: 0 0 auto; }
.plan-outing-badge.lvl-super::before { background: var(--green-bright); }
.plan-outing-badge.lvl-bon::before { background: var(--green); }
.plan-outing-badge.lvl-moyen::before { background: var(--orange); }
.plan-outing-badge.lvl-mauvais::before { background: var(--red-bright); }
.plan-outing-badge.lvl-terrible::before { background: var(--red-dark); }
.plan-outing-badge { cursor: pointer; }

/* ── Détail par critère (panneau dépliable au clic) ── */
.outing-detail { margin-top: 6px; padding: 8px 10px; border-radius: 8px; background: var(--card-2); }
.outing-detail-row {
  display: flex; justify-content: space-between; padding: 3px 0;
  color: var(--muted); font-size: 12.5px;
}
.outing-detail-row.is-worst { color: var(--ink); font-weight: 700; }
.outing-detail-time {
  font-size: 11.5px; color: var(--accent); font-weight: 600;
  padding-bottom: 4px; margin-bottom: 4px; border-bottom: 1px solid var(--line);
}
.lvl-dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; margin-right: 6px; }
.lvl-dot.lvl-super { background: var(--green-bright); }
.lvl-dot.lvl-bon { background: var(--green); }
.lvl-dot.lvl-moyen { background: var(--orange); }
.lvl-dot.lvl-mauvais { background: var(--red-bright); }
.lvl-dot.lvl-terrible { background: var(--red-dark); }
