/* Meteo2fou — thème « Nuit Cinématique » (iPad A1822, Safari 16, portrait 768×1024, un écran).
   Valeurs px calées pour une largeur de 768 (= le viewport iPad) ; appliquées telles quelles.
   Remapping maquette -> app : maquette .screen => #app ; maquette .catframe => app .screen. */

*{box-sizing:border-box;margin:0;padding:0;}

html,body{height:100%;overflow:hidden;
  /* Fond racine = #07081a, identique au bas du dégradé de .app. En PWA standalone iOS, le viewport (1004)
     est ~20px plus court que l'écran (1024) ; cette bande basse n'est peinte QUE par cette couleur racine
     (jamais un dégradé). Comme elle = le bas de .app, la jointure est invisible : bleu nuit uni jusqu'au
     bord. (mesuré : inner 1004 vs screen 1024.) */
  background:#07081a;
  color:#e9e9f0;
  font-family:-apple-system,'SF Pro Display','Segoe UI',Roboto,Arial,sans-serif;
  -webkit-font-smoothing:antialiased;-webkit-text-size-adjust:100%;}
/* Bande basse en mode alerte : la couleur racine suit le bas des dégradés .app.health-* (sinon une ligne
   en bas). :has() = Safari 15.4+ (OK iPad Safari 16) ; sans lui, repli gracieux sur #07081a. */
html:has(.app.health-red),body:has(.app.health-red){background:#7a2a12;}
html:has(.app.health-amber),body:has(.app.health-amber){background:#7a4a12;}

/* === #app = la « dalle » (ex-maquette .screen) : fond cinématique + padding, plein viewport. ===
   Flux naturel haut->bas (le chat est dimensionné pour combler le bas et pousser les cartes). */
/* App épinglée aux 4 bords du viewport (position:fixed;inset:0). NB PWA standalone iOS : le viewport est
   ~20px plus court que l'écran -> une bande basse que seule la background-COLOR racine peint (les dégradés
   y sont clippés). Le fond se termine donc en #07081a (= couleur racine) pour une jointure invisible.
   (Halo chaud bas-gauche retiré : il se coupait net sur cette bande, limite iOS non contournable.) */
.app{position:fixed;inset:0;display:flex;flex-direction:column;text-align:left;gap:18px;
  padding:24px 30px 28px;
  background:
    radial-gradient(130% 78% at 74% -6%,#2a3f8f 0%,rgba(42,63,143,0) 50%),
    linear-gradient(180deg,#0d1336 0%,#0a0e26 56%,#07081a 100%);}
/* Alerte rouge (ex-maquette .screen.alert). */
.app.health-red{background:
    radial-gradient(120% 70% at 50% -10%,#b91c1c 0%,rgba(185,28,28,0) 55%),
    linear-gradient(180deg,#3b0d12 0%,#5b1410 55%,#7a2a12 100%);}
/* Alerte ambre (même esprit que le rouge : radial chaud + dégradé sombre). */
.app.health-amber{background:
    radial-gradient(120% 70% at 50% -10%,#b45309 0%,rgba(180,83,9,0) 55%),
    linear-gradient(180deg,#3a2206 0%,#5b3410 55%,#7a4a12 100%);}

/* >>> espacement emoji↔texte UNIFORME partout : inline-flex + gap fixe <<< */
.ico{display:inline-flex;align-items:center;gap:7px;}
.dot{opacity:.45;margin:0 9px;}

/* Rangée haute : chat décalé à gauche + colonne droite (Tesla / agenda). */
.toprow{display:flex;gap:18px;height:540px;flex:none;}
.toprow .cat{flex:1.35;}
.rightcol{flex:1;display:flex;flex-direction:column;gap:14px;}

/* Le chat = cadre ADAPTATIF : .screen épouse le ratio du clip (cat-video.js pose width/height px),
   centré dans sa zone .cat (hauteur fixe 540px -> le fit ne change jamais la hauteur du layout). */
.cat{display:flex;align-items:center;justify-content:center;}
.screen{width:100%;height:100%;flex:none;position:relative;overflow:hidden;
  transition:width .25s ease,height .25s ease;
  border-radius:26px;border:2px solid rgba(255,255,255,.22);
  box-shadow:0 22px 50px rgba(0,0,0,.5),0 0 0 8px rgba(122,160,255,.07);
  background:radial-gradient(125% 110% at 50% 28%,#26407f 0%,#141a3c 72%);}
.app.health-red .screen{border-color:rgba(255,120,90,.5);
  box-shadow:0 22px 50px rgba(0,0,0,.5),0 0 0 8px rgba(255,90,70,.18);}
.cat-video{position:absolute;inset:0;width:100%;height:100%;object-fit:contain;display:block;}
/* Repli emoji quand pas de clip (visibility piloté par cat-video.js). */
.screen-ph{position:absolute;inset:0;display:flex;flex-direction:column;
  align-items:center;justify-content:center;gap:14px;pointer-events:none;}
.screen-cat{font-size:82px;line-height:1;filter:drop-shadow(0 6px 16px rgba(0,0,0,.45));}

/* Bandeau « breaking news » incrusté en bas du chat (position:absolute => ne décale rien). */
.chyron{position:absolute;left:0;right:0;bottom:0;padding:34px 16px 15px;text-align:center;color:#fff;
  background:linear-gradient(0deg,rgba(190,18,30,.97) 28%,rgba(190,18,30,.55) 70%,rgba(190,18,30,0));}
.chyron.amber{background:linear-gradient(0deg,rgba(180,83,9,.97) 28%,rgba(180,83,9,.55) 70%,rgba(180,83,9,0));}
.chyron .ct{font-size:22px;font-weight:800;letter-spacing:.4px;display:flex;align-items:center;justify-content:center;gap:9px;}
.chyron .cs{font-size:14.5px;opacity:.95;margin-top:3px;}

/* Carte alerte Tesla : en haut de la colonne droite, rouge, clignote, seulement < 35 %. */
.tcard{flex:none;border-radius:24px;padding:15px 18px;border:1px solid rgba(255,120,90,.55);
  background:linear-gradient(160deg,rgba(190,18,30,.96),rgba(150,12,22,.96));color:#fff;
  display:flex;align-items:center;gap:14px;box-shadow:0 10px 26px rgba(180,20,30,.35);
  animation:tpulse 1.8s ease-in-out infinite;}
.tcard[hidden]{display:none;}
.tcard .tic{font-size:30px;line-height:1;}
.tcard .tmain{display:flex;flex-direction:column;gap:3px;}
.tcard .th{font-size:12.5px;font-weight:800;letter-spacing:.5px;text-transform:uppercase;opacity:.95;}
.tcard .tv{font-size:32px;font-weight:300;letter-spacing:-1px;line-height:1;}
/* Pulsation : box-shadow + opacité (pas de filtre coûteux -> OK Safari 16). */
@keyframes tpulse{
  0%,100%{box-shadow:0 10px 26px rgba(180,20,30,.30);opacity:.95;}
  50%{box-shadow:0 12px 34px rgba(255,70,70,.6);opacity:1;}
}

/* Carte agenda (= futur calendrier). flex:1 -> reprend la colonne quand la carte Tesla est masquée. */
.agenda{flex:1;border-radius:24px;border:1px solid rgba(255,255,255,.12);background:rgba(255,255,255,.06);
  padding:18px 20px;display:flex;flex-direction:column;gap:15px;overflow:hidden;}
.agenda .ahead{font-size:20px;font-weight:800;display:flex;align-items:center;gap:9px;}
.agenda .aempty{flex:1;display:flex;flex-direction:column;align-items:center;justify-content:center;
  gap:8px;opacity:.5;font-size:15px;}
.agenda .aempty .ae-ic{font-size:34px;}
/* Agenda branché : en-tête + légende, groupes par jour, lignes compactes, +N, badge maj. */
.agenda .ahead{justify-content:flex-start;}
.agenda .alegend{margin-left:auto;display:inline-flex;gap:12px;font-size:11.5px;font-weight:600;opacity:.62;}
.agenda .aleg{display:inline-flex;align-items:center;gap:5px;}
.agenda .adot{width:9px;height:9px;border-radius:50%;flex:none;display:inline-block;}
.agenda .alist{display:flex;flex-direction:column;gap:2px;overflow:hidden;}
.agenda .aday{font-size:11px;font-weight:800;letter-spacing:.6px;text-transform:uppercase;
  opacity:.5;margin-top:9px;}
.agenda .aday:first-child{margin-top:0;}
.agenda .arow{display:flex;align-items:center;gap:9px;height:26px;}
.agenda .atime{flex:none;width:46px;font-variant-numeric:tabular-nums;font-weight:700;font-size:13.5px;opacity:.92;}
.agenda .adots{flex:none;display:inline-flex;gap:3px;width:24px;}
.agenda .atitle{flex:1;min-width:0;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;font-size:14.5px;}
.agenda .amore{font-size:12px;opacity:.55;font-weight:700;margin-top:4px;}
.agenda .aage{margin-top:auto;padding-top:8px;font-size:10.5px;opacity:.4;}
.agenda .aage.stale{color:#f1b06a;opacity:.7;}

/* === DEHORS — hero : météo gauche + Air/Pollen pills à droite ; bas réparti à séparateurs. === */
.hero{flex:none;border-radius:24px;padding:18px 22px;margin:0;border:1px solid rgba(255,255,255,.12);background:rgba(255,255,255,.08);}
.htop{display:flex;align-items:center;gap:18px;}
.wxleft{display:flex;align-items:center;gap:14px;flex:none;}
.htop .deg{font-size:74px;font-weight:200;line-height:.8;letter-spacing:-3px;display:flex;align-items:flex-start;}
.htop .deg .tr{font-size:22px;margin-left:5px;margin-top:9px;}
.htop .cond{font-size:21px;font-weight:600;}
.htop .mm{font-size:16px;opacity:.88;margin-top:6px;}
.htop .mm b{font-weight:700;}
.airmini{flex:1;display:flex;gap:14px;}
.apm{flex:1;display:flex;align-items:center;justify-content:center;gap:13px;background:rgba(255,255,255,.05);border:1px solid rgba(255,255,255,.12);border-radius:18px;padding:11px 14px;}
.apm .ring{width:58px;height:58px;}
.apm .ring i{width:46px;height:46px;font-size:25px;}
.apm .atxt .t{font-size:11.5px;text-transform:uppercase;letter-spacing:.5px;opacity:.6;font-weight:800;}
.apm .atxt .v{font-size:16px;font-weight:700;margin-top:1px;}
.hsub{margin-top:14px;padding-top:13px;border-top:1px solid rgba(255,255,255,.12);display:flex;align-items:stretch;}
.hsub .hi{flex:1;display:inline-flex;align-items:center;justify-content:center;gap:7px;font-size:15.5px;opacity:.88;}
.hsub .hi small{opacity:.62;font-weight:400;font-size:.74em;margin-left:2px;}
.hsub .vsep{width:1px;background:rgba(255,255,255,.15);margin:1px 0;}
.tr.down{color:#7dd3fc;} .tr.up{color:#fca5a5;}
.deg.cold{color:#bae6fd;} .deg.hot{color:#fecaca;}

/* === Anneaux : FORME seulement. Le fond conic-gradient est posé inline par dom.js (ring()).
   .ring = base ; tailles par contexte (.apm .ring = air ; .ring-lg = jauges de pièce). === */
.ring{border-radius:50%;flex:none;display:grid;place-items:center;}
.ring i{border-radius:50%;background:rgba(10,14,30,.82);display:grid;place-items:center;font-style:normal;}

/* === Pièces (Chambre / Salon) — s'étirent pour finir la dalle ; température à la hauteur des anneaux. === */
.rooms{flex:1;min-height:0;display:grid;grid-template-columns:1fr 1fr;gap:18px;}
.room{border-radius:24px;padding:16px;border:1px solid rgba(255,255,255,.10);background:rgba(255,255,255,.07);
  display:flex;flex-direction:column;justify-content:center;gap:16px;}
.room.stale{opacity:.55;}
.room .rn{font-size:18px;font-weight:700;opacity:.94;display:flex;justify-content:center;align-items:center;gap:8px;}
.room .dir{font-size:24px;font-weight:800;color:#9ad0ff;line-height:1;}
.rrow{display:flex;align-items:flex-start;justify-content:space-around;gap:6px;}
.rrow .rt{height:62px;display:flex;align-items:center;font-size:48px;font-weight:300;letter-spacing:-1px;}
.rrow .rt .tr{font-size:24px;font-weight:600;}
.rcol{display:flex;flex-direction:column;align-items:center;gap:6px;}
.rcol .rl{font-size:12.5px;opacity:.82;font-weight:600;display:inline-flex;align-items:center;gap:5px;white-space:nowrap;}
.ring-lg{width:62px;height:62px;}
.ring-lg i{width:48px;height:48px;font-size:15px;font-weight:800;}
.rextra{padding-top:13px;border-top:1px solid rgba(255,255,255,.12);font-size:15px;opacity:.86;display:flex;justify-content:center;align-items:center;gap:13px;flex-wrap:wrap;}
.rextra .sep{width:1px;align-self:stretch;min-height:18px;background:rgba(255,255,255,.22);}
.rextra small{opacity:.6;font-weight:400;font-size:.82em;margin-left:3px;}
