:root {
  --bg: #0d1117;
  --panel: #161b22;
  --panel-2: #1c2330;
  --border: #263041;
  --text: #e6edf3;
  --muted: #8b98a9;
  --accent: #4aa3ff;
  --fresh: #ff4d4f;
  --mid: #ffa940;
  --old: #ffd666;
  --green: #52c41a;
  --yellow: #fadb14;
  --orange: #fa8c16;
  --red: #f5222d;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

/* Bannière d'installation PWA */
.install-bar {
  position: fixed; left: 12px; right: 12px; z-index: 1000;
  /* Respecte la barre d'outils Safari iOS (safe area) pour rester cliquable. */
  bottom: calc(16px + env(safe-area-inset-bottom, 0px));
  max-width: 560px; margin: 0 auto;
  display: flex; align-items: center; gap: 12px;
  background: var(--panel); border: 1px solid var(--accent);
  border-radius: 14px; padding: 10px 14px;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.6);
  animation: fade-in 0.4s ease both;
}
.install-logo { width: 34px; height: 34px; border-radius: 8px; flex-shrink: 0; }
.install-txt { flex: 1; font-size: 13px; line-height: 1.35; }
.install-btn {
  background: var(--accent); color: #04121f; border: none; font-weight: 700;
  padding: 8px 14px; border-radius: 999px; font-size: 13px; cursor: pointer; flex-shrink: 0;
}
.install-close {
  background: none; border: none; color: var(--muted); font-size: 18px;
  cursor: pointer; flex-shrink: 0;
  width: 40px; height: 40px; display: flex; align-items: center; justify-content: center;
  -webkit-tap-highlight-color: transparent;
}

/* L'attribut hidden doit l'emporter sur le display: flex des barres/overlays. */
.install-bar[hidden], .install-help[hidden], .help-sheet[hidden] { display: none !important; }

/* Aide novices : boutons ? et panneau d'explication */
.info-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 16px; height: 16px; border-radius: 50%;
  background: var(--panel-2); border: 1px solid var(--border); color: var(--muted);
  font-size: 10px; font-weight: 700; cursor: pointer; vertical-align: 1px;
  padding: 0; line-height: 1;
}
.info-btn:hover { color: var(--accent); border-color: var(--accent); }
.help-sheet {
  position: fixed; inset: 0; z-index: 1200;
  background: rgba(0, 0, 0, 0.55);
  display: flex; align-items: flex-end; justify-content: center;
}
.help-card {
  background: var(--panel); border: 1px solid var(--border);
  border-radius: 18px 18px 0 0; padding: 22px 20px calc(20px + env(safe-area-inset-bottom, 0px));
  width: 100%; max-width: 560px;
  animation: slide-up 0.25s ease both;
}
.help-card h3 { margin: 0 0 8px; font-size: 17px; }
.help-card p { margin: 0 0 16px; font-size: 14px; line-height: 1.6; color: #c2ccd8; }
@keyframes slide-up { from { transform: translateY(30px); opacity: 0; } to { transform: none; opacity: 1; } }

/* Fenêtre d'aide à l'installation (iOS) */
.install-help {
  position: fixed; inset: 0; z-index: 1100;
  background: rgba(0, 0, 0, 0.6);
  display: flex; align-items: center; justify-content: center; padding: 20px;
}
.install-help-card {
  background: var(--panel); border: 1px solid var(--border); border-radius: 16px;
  padding: 22px; max-width: 360px; text-align: center;
  animation: fade-in 0.3s ease both;
}
.install-help-card .install-logo { width: 48px; height: 48px; margin: 0 auto 8px; }
.install-help-card h3 { margin: 0 0 14px; font-size: 18px; }
.install-help-card ol { text-align: left; padding-left: 20px; margin: 0 0 14px; }
.install-help-card li { font-size: 14px; line-height: 1.7; color: #c2ccd8; }
.ios-share { vertical-align: -3px; color: var(--accent); }
.install-help-note { font-size: 12px; color: var(--muted); margin: 0 0 16px; }

/* Top bar */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 24px;
  background: linear-gradient(180deg, #131a24, var(--bg));
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 500;
}
.brand { display: flex; align-items: center; gap: 12px; }
.logo { width: 42px; height: 42px; border-radius: 10px; object-fit: cover; display: block; }
.topbar h1 { margin: 0; font-size: 20px; letter-spacing: 0.2px; }
.tagline { margin: 2px 0 0; font-size: 13px; color: var(--muted); }

.status { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); }
.dot { width: 9px; height: 9px; border-radius: 50%; background: var(--muted); }
.dot.ok { background: var(--green); box-shadow: 0 0 8px var(--green); animation: pulse-dot 2s ease-in-out infinite; }
.dot.err { background: var(--red); box-shadow: 0 0 8px var(--red); }
@keyframes pulse-dot { 0%, 100% { opacity: 1; } 50% { opacity: 0.4; } }
.refresh-btn {
  background: var(--panel-2); border: 1px solid var(--border); color: var(--text);
  border-radius: 8px; width: 30px; height: 30px; font-size: 16px; cursor: pointer;
  margin-left: 4px; transition: background 0.15s, transform 0.2s;
}
.refresh-btn:hover { background: #22303f; }
.refresh-btn.spin { animation: spin 0.6s linear; }
@keyframes spin { from { transform: rotate(0); } to { transform: rotate(360deg); } }

/* Synthèse */
.hero {
  display: flex; align-items: center; gap: 14px;
  background: linear-gradient(135deg, #17202e, #141b26);
  border: 1px solid var(--border); border-radius: 14px;
  padding: 16px 20px; margin-bottom: 20px;
}
.hero-emoji { font-size: 30px; line-height: 1; }
.hero-text { margin: 0; font-size: 16px; font-weight: 500; }

/* Onglets */
.tabs {
  display: flex; gap: 4px; margin-bottom: 20px;
  border-bottom: 1px solid var(--border);
  overflow-x: auto; -webkit-overflow-scrolling: touch;
}
.tab {
  background: none; border: none; color: var(--muted);
  padding: 12px 18px; font-size: 15px; cursor: pointer;
  border-bottom: 2px solid transparent; white-space: nowrap;
  transition: color 0.15s;
}
.tab:hover { color: var(--text); }
.tab.active { color: var(--text); border-bottom-color: var(--accent); font-weight: 600; }
.tab-panel { display: none; }
.tab-panel.active { display: block; animation: fade-in 0.3s ease both; }

/* Localisation */
.loc-bar { display: flex; align-items: center; gap: 10px; margin-bottom: 20px; flex-wrap: wrap; }
.loc-chip {
  background: var(--panel-2); border: 1px solid var(--border);
  padding: 6px 12px; border-radius: 999px; font-size: 13px; font-weight: 600;
}
.loc-btn {
  background: var(--panel); border: 1px solid var(--border); color: var(--text);
  padding: 6px 12px; border-radius: 999px; font-size: 13px; cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}
.loc-btn:hover { background: #22303f; border-color: #33465c; }
.loc-model { font-size: 12px; color: var(--muted); margin-left: auto; }

/* Recherche de commune */
.search { position: relative; }
.search-input {
  background: var(--panel); border: 1px solid var(--border); color: var(--text);
  padding: 6px 12px; border-radius: 999px; font-size: 13px; width: 200px; outline: none;
}
.search-input:focus { border-color: var(--accent); }
.search-results {
  display: none; position: absolute; top: 110%; left: 0; z-index: 600;
  min-width: 240px; max-height: 280px; overflow-y: auto;
  background: var(--panel); border: 1px solid var(--border); border-radius: 12px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5); padding: 4px;
}
.search-results.open { display: block; }
.search-item {
  display: block; width: 100%; text-align: left; background: none; border: none;
  color: var(--text); padding: 9px 12px; border-radius: 8px; font-size: 14px; cursor: pointer;
}
.search-item:hover { background: var(--panel-2); }
.search-empty { padding: 10px 12px; font-size: 13px; color: var(--muted); }

/* Radar animé */
.radar {
  display: flex; align-items: center; gap: 10px; margin-top: 10px;
  background: var(--panel-2); border: 1px solid var(--border); border-radius: 10px; padding: 8px 12px;
}
.radar-btn {
  background: var(--panel); border: 1px solid var(--border); color: var(--accent);
  width: 30px; height: 30px; border-radius: 8px; font-size: 13px; cursor: pointer; flex-shrink: 0;
}
.radar-btn:hover { background: #22303f; }
.radar-slider { flex: 1; accent-color: var(--accent); }
.radar-time { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; min-width: 62px; text-align: right; }
.radar-btn:disabled { opacity: 0.4; cursor: default; }
.rain-modes { display: flex; gap: 4px; flex-shrink: 0; }
.rain-mode {
  background: var(--panel); border: 1px solid var(--border); color: var(--muted);
  padding: 5px 9px; border-radius: 999px; font-size: 12px; cursor: pointer;
}
.rain-mode:hover { background: #22303f; }
.rain-mode.active { background: var(--accent); color: #04121f; border-color: var(--accent); font-weight: 700; }
.rain-mode:disabled { opacity: .35; cursor: not-allowed; }
.rain-mode:disabled:hover { background: var(--panel); }
@media (max-width: 520px) {
  .search-input { width: 150px; }
  .radar-slider { display: none; }
}

/* Nowcast pluie */
.nowcast { margin-bottom: 20px; }
.badge.warn { color: var(--orange); border-color: var(--orange); }
.nowcast-strip { display: flex; gap: 6px; align-items: flex-end; height: 84px; }
.nc-slot { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 4px; height: 100%; }
.nc-bar {
  flex: 1; width: 100%; background: var(--panel-2); border-radius: 4px;
  position: relative; overflow: hidden; min-height: 0;
}
.nc-bar > span {
  position: absolute; left: 0; right: 0; bottom: 0;
  background: linear-gradient(180deg, #4aa3ff, #1d6fd6); border-radius: 4px 4px 0 0;
}
.nc-lbl { font-size: 10px; color: var(--muted); font-variant-numeric: tabular-nums; }

/* Fiabilité */
.relia-bar { height: 10px; background: var(--panel-2); border-radius: 999px; overflow: hidden; }
.relia-bar > span { display: block; height: 100%; width: 0; border-radius: 999px; transition: width 0.5s; background: var(--muted); }
.relia-bar > span.ok { background: var(--green); }
.relia-bar > span.mid { background: var(--yellow); }
.relia-bar > span.low { background: var(--orange); }
.relia-text { margin: 10px 0 0; font-size: 13px; color: var(--muted); line-height: 1.5; }
.relia-models { display: flex; flex-wrap: wrap; gap: 6px 16px; margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--border); }
.relia-model { font-size: 12px; color: var(--muted); display: flex; align-items: center; gap: 5px; }
.relia-model b { color: var(--text); }
.relia-model-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }

/* Bannière alerte orage */
.storm-banner {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 16px; margin-bottom: 14px;
  background: rgba(245, 34, 45, 0.15);
  border: 1px solid rgba(245, 34, 45, 0.35);
  border-radius: 12px;
  animation: fade-in 0.3s ease both;
}
.storm-banner[hidden] { display: none !important; }
.sb-icon { font-size: 20px; flex-shrink: 0; }
.sb-text { flex: 1; font-size: 14px; font-weight: 600; color: #ff7875; }
.sb-close { background: none; border: none; color: var(--muted); font-size: 16px; cursor: pointer; padding: 4px 8px; border-radius: 4px; flex-shrink: 0; }

/* Modal détail journée */
.day-modal {
  position: fixed; inset: 0; z-index: 500;
  display: flex; flex-direction: column; align-items: center; justify-content: flex-end;
}
.day-modal[hidden] { display: none !important; }
.dm-backdrop {
  position: absolute; inset: 0;
  background: rgba(0,0,0,0.6); backdrop-filter: blur(3px);
}
.dm-card {
  position: relative; z-index: 1;
  background: var(--panel); border: 1px solid var(--border);
  border-radius: 20px 20px 0 0;
  width: 100%; max-width: 640px; max-height: 85dvh;
  display: flex; flex-direction: column;
  animation: sheet-up 0.3s cubic-bezier(0.32, 0.72, 0, 1) both;
}
@keyframes sheet-up { from { transform: translateY(100%); } to { transform: none; } }
.dm-head {
  display: flex; align-items: flex-start; justify-content: space-between;
  padding: 20px 20px 16px; border-bottom: 1px solid var(--border); flex-shrink: 0;
}
.dm-title { font-size: 17px; font-weight: 700; }
.dm-summary { font-size: 13px; color: var(--muted); margin-top: 4px; }
.dm-close {
  background: var(--panel-2); border: none; color: var(--text); font-size: 15px;
  width: 30px; height: 30px; border-radius: 50%; cursor: pointer;
  display: flex; align-items: center; justify-content: center; flex-shrink: 0; margin-left: 12px;
}
.dm-hours { overflow-y: auto; -webkit-overflow-scrolling: touch; padding: 4px 0 env(safe-area-inset-bottom, 16px); }
.dm-row {
  display: grid; grid-template-columns: 36px 26px 44px 54px 1fr;
  align-items: center; gap: 8px;
  padding: 10px 20px; border-bottom: 1px solid var(--border); font-size: 14px;
}
.dm-row:last-child { border-bottom: none; }
.dm-hour { color: var(--muted); font-size: 13px; }
.dm-icon { font-size: 17px; text-align: center; }
.dm-temp { font-weight: 600; }
.dm-rain { color: var(--accent); font-size: 13px; }
.dm-gust { color: var(--muted); font-size: 12px; }

/* Sélecteur de fond de carte */
.bm-switcher { display: flex; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; }
.bm-btn {
  background: var(--panel-2); border: none; color: var(--text);
  padding: 5px 9px; font-size: 14px; cursor: pointer;
  border-right: 1px solid var(--border);
}
.bm-btn:last-child { border-right: none; }
.bm-btn.active { background: var(--accent); }

/* Hint "toucher pour le détail" */
.badge-hint { font-size: 11px; color: var(--muted); }

/* Layout */
main { max-width: 1200px; margin: 0 auto; padding: 24px; }

/* Bandeau de diagnostic */
.diag {
  background: #3a1d1d;
  border: 1px solid #7a2e2e;
  color: #ffb4b4;
  border-radius: 10px;
  padding: 10px 14px;
  margin: 0 0 18px;
  font-size: 13px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 16px;
  margin-bottom: 20px;
}

/* Bulletin « ce qui vous attend » */
.bulletin { display: flex; flex-direction: column; gap: 10px; }
.bul-line { display: flex; gap: 10px; align-items: baseline; font-size: 14.5px; line-height: 1.5; }
.bul-ico { font-size: 18px; flex-shrink: 0; }

/* Défilé heure par heure */
.hstrip {
  display: flex; gap: 4px; overflow-x: auto; padding-bottom: 6px;
  -webkit-overflow-scrolling: touch; scrollbar-width: thin;
}
.hs-cell {
  min-width: 56px; display: flex; flex-direction: column; align-items: center; gap: 4px;
  padding: 10px 4px; border-radius: 10px; flex-shrink: 0;
}
.hs-cell.now { background: var(--panel-2); border: 1px solid var(--border); }
.hs-hour { font-size: 11px; color: var(--muted); }
.hs-icon { font-size: 20px; }
.hs-temp { font-size: 14px; font-weight: 700; }
.hs-rain { font-size: 10px; color: var(--accent); min-height: 13px; }
.hs-wind { font-size: 10px; color: var(--muted); min-height: 13px; display: flex; align-items: center; gap: 2px; }
.hs-wind-arrow { display: inline-block; font-style: normal; line-height: 1; }

/* Confort & visibilité */
.comfort-grid { display: flex; flex-direction: column; gap: 14px; }
.comfort-item { display: flex; align-items: center; gap: 14px; }
.comfort-icon { font-size: 1.5rem; flex-shrink: 0; width: 30px; text-align: center; }
.comfort-text { display: flex; flex-direction: column; gap: 2px; }
.comfort-text b { font-size: .9rem; font-weight: 700; }
.comfort-text span { font-size: .78rem; color: var(--muted); }
.trend-up { color: #3fb950; }
.trend-down { color: #f85149; }

/* Soleil */
.sun-row { display: flex; justify-content: space-around; gap: 12px; text-align: center; }
.sun-item { display: flex; flex-direction: column; gap: 4px; align-items: center; }
.sun-emoji { font-size: 22px; }
.sun-lbl { font-size: 12px; color: var(--muted); }
.sun-item b { font-size: 17px; font-variant-numeric: tabular-nums; }
.card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 18px;
  animation: fade-in 0.4s ease both;
  transition: border-color 0.2s, transform 0.2s;
}
.metric:hover, .idx:hover { border-color: #33465c; }
@keyframes fade-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.metric { display: flex; flex-direction: column; gap: 8px; }
.obs-time { margin: 0 0 10px; font-size: 12px; color: var(--muted); }
.metric-label { font-size: 13px; color: var(--muted); }
.metric-value { font-size: 30px; font-weight: 700; }
.metric-value small { font-size: 15px; font-weight: 500; color: var(--muted); }

.grid {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 20px;
}
.side { display: flex; flex-direction: column; gap: 20px; }

.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}
.card-head h2 { margin: 0; font-size: 16px; }
.badge {
  font-size: 13px;
  background: var(--panel-2);
  border: 1px solid var(--border);
  color: var(--accent);
  padding: 4px 10px;
  border-radius: 999px;
}

/* Map */
.map-card { display: flex; flex-direction: column; }
#map {
  height: 68vh;
  min-height: 480px;
  border-radius: 10px;
  overflow: hidden;
  background: var(--panel-2);
}
/* Onglet Carte : la carte prend toute la largeur, la vigilance passe dessous. */
.tab-panel[data-panel="carte"] .grid { grid-template-columns: 1fr; }

/* Message d'info superposé à la carte (ex. pas de pluie prévue) */
.map-card { position: relative; }
.map-note {
  position: absolute; top: 66px; left: 50%; transform: translateX(-50%);
  z-index: 500; background: rgba(5, 8, 14, 0.86); border: 1px solid var(--border);
  color: var(--text); padding: 8px 14px; border-radius: 999px; font-size: 13px;
  pointer-events: none; white-space: nowrap; box-shadow: 0 2px 10px rgba(0, 0, 0, 0.5);
}
.leaflet-container { background: #0a0e14; }
.legend {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--muted);
  margin: 12px 2px 0;
}
.legend-grad {
  width: 120px; height: 8px; border-radius: 999px;
  background: linear-gradient(90deg, hsl(0,92%,62%), hsl(28,92%,55%), hsl(55,92%,50%), hsl(55,60%,40%));
}
.legend-live { margin-left: auto; color: var(--green); font-weight: 600; }
.legend-cells { color: var(--muted); }
.cell-swatch {
  width: 14px; height: 14px; border-radius: 50%;
  background: rgba(255, 122, 24, 0.25); border: 1.5px solid #ff7a18; flex-shrink: 0;
}
.cell-label { color: #fff; font-size: 12px; font-weight: 700; text-shadow: 0 0 3px #000, 0 0 3px #000; white-space: nowrap; text-align: center; }

/* Bouton « me localiser » sur la carte */
.leaflet-locate-btn {
  width: 34px; height: 34px; line-height: 34px; text-align: center;
  background: var(--panel); color: var(--accent); border: 1px solid var(--border);
  border-radius: 8px; font-size: 18px; font-weight: 700;
  box-shadow: 0 1px 5px rgba(0, 0, 0, 0.45); cursor: pointer; text-decoration: none;
  display: block; margin: 10px 0 0 10px;
}
.leaflet-locate-btn:hover { background: #22303f; }
.leaflet-locate-btn.locating { animation: pulse-dot 1s ease-in-out infinite; }
.legend-live.off { color: var(--muted); }

/* Vigilance */
.vigilance { display: flex; align-items: center; gap: 14px; }
.vig-badge {
  min-width: 52px;
  height: 52px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 22px;
  background: var(--panel-2);
  color: var(--muted);
}
.vig-badge.v1 { background: var(--green); color: #05270a; }
.vig-badge.v2 { background: var(--yellow); color: #302b00; }
.vig-badge.v3 { background: var(--orange); color: #2c1500; }
.vig-badge.v4 { background: var(--red); color: #2c0202; }
.vig-text { margin: 0; font-size: 14px; color: var(--muted); }

/* Timeline */
.timeline { display: flex; flex-direction: column; gap: 2px; max-height: 320px; overflow-y: auto; }
.tl-row {
  display: grid;
  grid-template-columns: 54px 1fr auto;
  align-items: center;
  gap: 10px;
  padding: 7px 4px;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
}
.tl-row:last-child { border-bottom: none; }
.tl-hour { color: var(--muted); font-variant-numeric: tabular-nums; }
.tl-bar { height: 6px; border-radius: 3px; background: var(--panel-2); position: relative; overflow: hidden; }
.tl-bar > span { position: absolute; inset: 0 auto 0 0; background: var(--accent); border-radius: 3px; }
.tl-temp { font-weight: 600; font-variant-numeric: tabular-nums; }

/* Page légale */
.legal { max-width: 820px; margin: 0 auto; padding: 24px; }
.legal .card { margin-bottom: 16px; }
.legal h2 { margin: 0 0 10px; font-size: 17px; }
.legal p { font-size: 14px; line-height: 1.6; color: #c2ccd8; margin: 0 0 10px; }
.legal ul { font-size: 14px; line-height: 1.6; color: #c2ccd8; margin: 0 0 10px; padding-left: 20px; }
.legal a { color: var(--accent); }
.legal-note { font-size: 12px; color: var(--muted); }
.footer-links { margin-top: 6px; }
.footer-links a { color: var(--accent); text-decoration: none; }

/* Footer */
footer {
  text-align: center;
  color: var(--muted);
  font-size: 12px;
  padding: 24px;
  border-top: 1px solid var(--border);
  margin-top: 20px;
}

/* Analyse orageuse */
.storm {
  display: grid;
  grid-template-columns: 260px 1fr;
  gap: 24px;
  align-items: center;
  margin-bottom: 20px;
}
.storm-gauge { display: flex; align-items: center; gap: 16px; }
.gauge {
  width: 96px; height: 96px;
  border-radius: 50%;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  background: var(--panel-2);
  border: 4px solid var(--muted);
  flex-shrink: 0;
}
.gauge.v0 { border-color: #3a4658; }
.gauge.v1 { border-color: var(--green); }
.gauge.v2 { border-color: var(--yellow); }
.gauge.v3 { border-color: var(--orange); }
.gauge.v4 { border-color: var(--red); box-shadow: 0 0 16px rgba(245,34,45,0.5); }
.gauge-score { font-size: 34px; font-weight: 800; line-height: 1; }
.gauge-max { font-size: 12px; color: var(--muted); }
.storm-verdict { display: flex; flex-direction: column; gap: 6px; }
.storm-level { font-size: 16px; font-weight: 700; }
.storm-peak { font-size: 13px; color: var(--muted); }

.storm-indices {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
}
.idx {
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px;
  display: flex; flex-direction: column; gap: 3px;
}
.idx-label { font-size: 12px; color: var(--muted); }
.idx-val { font-size: 20px; font-weight: 700; }
.idx-val small { font-size: 12px; font-weight: 500; color: var(--muted); }
.idx-hint { font-size: 11px; color: #5f6b7c; }

/* Convection AROME */
.conv-sub { margin: 0 0 16px; font-size: 13px; color: var(--muted); line-height: 1.5; }
.conv-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.conv-window {
  margin-top: 14px; padding: 12px 14px; border-radius: 10px;
  background: var(--panel-2); border: 1px solid var(--border);
  font-size: 14px; color: var(--muted);
}
.conv-window.active {
  background: rgba(250, 140, 22, 0.12); border-color: var(--orange); color: #ffd8a8;
}

/* Bulletin vigilance */
.vig-bulletin {
  margin: 14px 0 0;
  font-size: 13px;
  line-height: 1.5;
  color: var(--muted);
  max-height: 180px;
  overflow-y: auto;
}

/* Graphiques */
.charts { display: flex; flex-direction: column; gap: 18px; }
.chart-title { font-size: 13px; color: var(--muted); margin-bottom: 6px; }
.chart-title span { color: #5f6b7c; }
.chart { height: 90px; background: var(--panel-2); border-radius: 8px; position: relative; overflow: hidden; }
.chart svg { width: 100%; height: 100%; display: block; }
.chart-guide {
  position: absolute; top: 0; bottom: 0; width: 1px;
  background: rgba(255, 255, 255, 0.35); pointer-events: none; opacity: 0;
  transition: opacity 0.1s;
}
.chart-tip {
  position: absolute; top: 6px; transform: translateX(-50%);
  background: rgba(5, 8, 14, 0.92); border: 1px solid var(--border);
  border-radius: 6px; padding: 4px 8px; font-size: 12px;
  pointer-events: none; opacity: 0; white-space: nowrap;
  display: flex; flex-direction: column; line-height: 1.3; transition: opacity 0.1s;
}
.chart-tip span { color: var(--muted); font-size: 10px; }
.chart-axis { position: relative; height: 16px; margin-top: 2px; }
.chart-axis span {
  position: absolute; transform: translateX(-50%);
  font-size: 11px; color: #5f6b7c; text-transform: capitalize; white-space: nowrap;
}
.chart-axis span:first-child { transform: none; }

/* Prévision 7 jours */
.wk-row {
  display: grid;
  grid-template-columns: 1.5fr 28px 1.7fr 32px 90px 32px;
  align-items: center; gap: 10px;
  padding: 11px 4px; border-bottom: 1px solid var(--border); font-size: 14px;
  cursor: pointer; border-radius: 6px; transition: background 0.15s;
}
.wk-row:hover { background: var(--panel-2); }
.wk-row:last-child { border-bottom: none; }
.wk-day { text-transform: capitalize; }
.wk-icon { font-size: 20px; text-align: center; }
.wk-meta { color: var(--muted); font-size: 12.5px; }
.wk-tmin { color: var(--muted); text-align: right; font-variant-numeric: tabular-nums; }
.wk-tmax { font-weight: 700; text-align: right; font-variant-numeric: tabular-nums; }
.wk-bar { position: relative; height: 6px; background: var(--panel-2); border-radius: 999px; }
.wk-bar > span {
  position: absolute; top: 0; height: 100%; border-radius: 999px;
  background: linear-gradient(90deg, #4aa3ff, #52c41a, #fadb14, #fa8c16);
}
@media (max-width: 560px) {
  .wk-row { grid-template-columns: 1.2fr 26px 34px 60px 34px; }
  .wk-meta { display: none; }
}

/* Prévision par jour (ancien) */
.daily { display: flex; flex-direction: column; }
.day-row {
  display: grid;
  grid-template-columns: 1.4fr auto 90px 2fr;
  align-items: center;
  gap: 12px;
  padding: 12px 4px;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
}
.day-row:last-child { border-bottom: none; }
.day-name { text-transform: capitalize; }
.day-icon { font-size: 20px; text-align: center; }
.day-temps { font-variant-numeric: tabular-nums; }
.day-temps .tmin { color: var(--muted); }
.day-meta { color: var(--muted); font-size: 13px; text-align: right; }

/* Responsive */
@media (max-width: 900px) {
  .cards { grid-template-columns: repeat(2, 1fr); }
  .grid { grid-template-columns: 1fr; }
  #map { height: 62vh; min-height: 380px; }
  .storm { grid-template-columns: 1fr; }
  .storm-indices { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 520px) {
  main { padding: 16px; }
  .metric-value { font-size: 24px; }
  .day-row { grid-template-columns: 1fr auto auto; }
  .day-meta { display: none; }
}

/* ==========================================================================
   Couche visuelle « waouh » — surcharge volontairement les règles de base.
   ========================================================================== */

html, body {
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

/* Fond vivant : nappes de couleur type aurore, en mouvement très lent */
body {
  background: var(--bg);
  position: relative;
}
body::before {
  content: "";
  position: fixed; inset: -20%;
  z-index: -1;
  background:
    radial-gradient(38% 30% at 18% 12%, rgba(46, 110, 227, 0.16), transparent 70%),
    radial-gradient(32% 28% at 85% 8%, rgba(124, 77, 255, 0.12), transparent 70%),
    radial-gradient(40% 34% at 78% 88%, rgba(23, 165, 137, 0.10), transparent 70%),
    radial-gradient(30% 26% at 8% 80%, rgba(250, 140, 22, 0.07), transparent 70%);
  animation: aurora 26s ease-in-out infinite alternate;
  pointer-events: none;
}
@keyframes aurora {
  0%   { transform: translate3d(0, 0, 0) scale(1); }
  50%  { transform: translate3d(2.5%, -2%, 0) scale(1.06); }
  100% { transform: translate3d(-2%, 2.5%, 0) scale(1.02); }
}

/* Barre du haut : verre dépoli */
.topbar {
  background: rgba(13, 17, 23, 0.72);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}
.topbar h1 {
  background: linear-gradient(90deg, #e6edf3, #9cc3ff);
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent;
  font-weight: 800; letter-spacing: 0.3px;
}

/* Cartes : verre dépoli + lueur au survol */
.card {
  background: rgba(22, 27, 34, 0.66);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.07);
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.25);
}
.card:hover {
  border-color: rgba(74, 163, 255, 0.35);
  box-shadow: 0 10px 34px rgba(0, 0, 0, 0.35), 0 0 24px rgba(74, 163, 255, 0.07);
  transform: translateY(-2px);
}

/* Synthèse : bordure dégradée lumineuse */
.hero {
  position: relative;
  background: linear-gradient(135deg, rgba(28, 40, 61, 0.85), rgba(19, 26, 36, 0.85));
  border: 1px solid transparent;
  background-clip: padding-box;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.35);
}
.hero::before {
  content: "";
  position: absolute; inset: -1px;
  border-radius: 15px;
  padding: 1px;
  background: linear-gradient(120deg, rgba(74,163,255,0.55), rgba(124,77,255,0.35), rgba(74,163,255,0.15));
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor; mask-composite: exclude;
  pointer-events: none;
}
.hero-emoji { font-size: 38px; filter: drop-shadow(0 2px 8px rgba(74, 163, 255, 0.35)); }
.hero-text { font-size: 17px; font-weight: 600; }

/* Onglets : pilules avec dégradé actif */
.tabs { border-bottom: none; gap: 8px; padding: 4px; background: rgba(22, 27, 34, 0.5); border-radius: 999px; width: fit-content; max-width: 100%; }
.tab { border: none; border-radius: 999px; padding: 10px 18px; }
.tab.active {
  background: linear-gradient(120deg, #2e6ee3, #4aa3ff);
  color: #fff; border-bottom-color: transparent;
  box-shadow: 0 4px 16px rgba(46, 110, 227, 0.4);
}

/* Valeurs : plus grandes, température en dégradé chaud */
.metric-value { font-size: 32px; font-weight: 800; letter-spacing: -0.5px; }
[data-field="temp"], [data-field="feels"] {
  background: linear-gradient(90deg, #ffd08a, #ff7a45);
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent;
}
[data-field="temp"] small, [data-field="feels"] small {
  -webkit-text-fill-color: var(--muted);
}

/* Bulletin : cartes lignes avec liseré */
.bul-line {
  background: rgba(28, 35, 48, 0.55);
  border-left: 3px solid var(--accent);
  border-radius: 8px;
  padding: 10px 12px;
}

/* Heure par heure : cellules arrondies au survol */
.hs-cell { transition: background 0.15s, transform 0.15s; border-radius: 12px; }
.hs-cell:hover { background: rgba(74, 163, 255, 0.10); transform: translateY(-2px); }
.hs-cell.now {
  background: linear-gradient(160deg, rgba(46, 110, 227, 0.25), rgba(46, 110, 227, 0.08));
  border-color: rgba(74, 163, 255, 0.5);
}

/* Jauge orage : halo animé quand le risque est haut */
.gauge.v3, .gauge.v4 { animation: gauge-pulse 2.2s ease-in-out infinite; }
@keyframes gauge-pulse {
  0%, 100% { box-shadow: 0 0 12px rgba(250, 140, 22, 0.35); }
  50%      { box-shadow: 0 0 26px rgba(245, 34, 45, 0.55); }
}

/* Boutons accent en dégradé */
.install-btn, .loc-btn:hover, .rain-mode.active {
  background: linear-gradient(120deg, #2e6ee3, #4aa3ff);
  color: #fff; border-color: transparent;
}

/* Barres de défilement discrètes */
::-webkit-scrollbar { height: 8px; width: 8px; }
::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.14); border-radius: 999px; }
::-webkit-scrollbar-thumb:hover { background: rgba(74, 163, 255, 0.4); }
::-webkit-scrollbar-track { background: transparent; }

/* Footer plus doux */
footer { border-top: 1px solid rgba(255, 255, 255, 0.05); }

/* Respecte les préférences réduites en mouvement */
@media (prefers-reduced-motion: reduce) {
  body::before, .gauge.v3, .gauge.v4, .dot.ok { animation: none; }
  .card, .hs-cell { transition: none; }
}

/* ---- Aujourd'hui en bref — pills ---- */
.today-highlights { display: flex; flex-wrap: wrap; gap: 10px; }
.th-pill {
  display: flex; align-items: center; gap: 10px;
  flex: 1 1 180px; padding: 12px 14px;
  border-radius: 12px; border: 1px solid;
}
.th-pill-icon { font-size: 1.6rem; flex-shrink: 0; }
.th-pill-body { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.th-pill-body b { font-size: .92rem; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.th-pill-body span { font-size: .75rem; color: var(--muted); }
.pill-danger { background: rgba(248,81,73,.1);   border-color: rgba(248,81,73,.4);   color: #ff9090; }
.pill-warn   { background: rgba(210,153,34,.12); border-color: rgba(210,153,34,.45); color: #f0c060; }
.pill-warm   { background: rgba(255,140,40,.1);  border-color: rgba(255,140,40,.4);  color: #ffb070; }
.pill-ok     { background: rgba(63,185,80,.1);   border-color: rgba(63,185,80,.4);   color: #7cdd8e; }
.pill-cool   { background: rgba(88,166,255,.1);  border-color: rgba(88,166,255,.4);  color: #8dc7ff; }
.pill-info   { background: rgba(88,166,255,.1);  border-color: rgba(88,166,255,.35); color: #8dc7ff; }
.pill-muted  { background: rgba(139,148,158,.08);border-color: rgba(139,148,158,.25);color: #8b949e; }

/* ---- Bandeau d'info admin ---- */
.info-banner {
  display: flex; align-items: center; gap: 12px;
  margin: 10px 14px 0; padding: 14px 18px;
  border-radius: 14px; border: 1px solid;
  font-size: 1rem; font-weight: 600; line-height: 1.4;
  position: sticky; top: 8px; z-index: 200;
  box-shadow: 0 6px 24px rgba(0,0,0,.5);
  backdrop-filter: blur(10px);
}
.info-banner[hidden] { display: none; }
.info-banner[data-type="info"]    { background: rgba(13,42,74,.92); border-color: rgba(88,166,255,.6); color: #8dc7ff; }
.info-banner[data-type="warning"] { background: rgba(58,38,0,.92); border-color: rgba(210,153,34,.6); color: #f0c060; }
.info-banner[data-type="danger"]  { background: rgba(58,13,13,.92); border-color: rgba(248,81,73,.6); color: #ff9090; }
.ib-icon { font-size: 1.2rem; flex-shrink: 0; }
.ib-text { flex: 1; }
.ib-close { background: none; border: none; cursor: pointer; font-size: 1.1rem;
             color: inherit; opacity: .6; padding: 0 4px; line-height: 1; flex-shrink: 0; }
.ib-close:hover { opacity: 1; }

/* ---- Page de maintenance ---- */
.maintenance-page {
  min-height: 100svh; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 16px;
  text-align: center; padding: 32px;
}
.maint-icon { font-size: 4rem; }
.maintenance-page h1 { font-size: 1.5rem; font-weight: 700; }
.maint-msg { color: var(--text-2, #8b949e); font-size: 1rem; max-width: 440px; }
.maint-sub { color: var(--text-2, #8b949e); font-size: .85rem; }
