:root {
  --fond: #071619;
  --fond-2: #0c2228;
  --carte: #10292f;
  --carte-2: #153239;
  --ligne: rgba(214, 236, 228, 0.1);
  --encre: #edf4f0;
  --encre-2: rgba(237, 244, 240, 0.7);
  --encre-3: rgba(237, 244, 240, 0.48);
  --or: #f4b863;
  --or-vif: #ffd08a;
  --corail: #ff8d5f;
  --mousse: #9ed6c3;
  --rouge: #ff6a55;
  --titre: 'Fraunces', Georgia, serif;
  --texte: 'Barlow', system-ui, sans-serif;
  --chiffres: 'Barlow Condensed', 'Barlow', sans-serif;
  --bas: env(safe-area-inset-bottom, 0px);
  color-scheme: dark;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { background: var(--fond); }
body {
  margin: 0;
  min-height: 100dvh;
  color: var(--encre);
  font-family: var(--texte);
  font-size: 17px;
  line-height: 1.4;
  background:
    radial-gradient(120% 50% at 50% -10%, rgba(244, 184, 99, 0.12), transparent 60%),
    linear-gradient(180deg, #0a1d22 0%, var(--fond) 40%);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
}
[hidden] { display: none !important; }
button { font: inherit; color: inherit; }
svg { fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

.logo {
  width: 56px;
  height: 56px;
  background: url(/panel/icone.svg) center / contain no-repeat;
}
.logo.petit { width: 26px; height: 26px; }

/* ---------- connexion ---------- */
.connexion { min-height: 100dvh; display: grid; place-items: center; padding: 24px; }
.connexion-carte {
  width: min(100%, 380px);
  padding: 34px 28px 28px;
  border-radius: 24px;
  background: var(--carte);
  border: 1px solid var(--ligne);
  box-shadow: 0 30px 60px -30px rgba(0, 0, 0, 0.7);
  display: grid;
  gap: 16px;
  text-align: center;
}
.connexion-carte .logo { margin: 0 auto; }
.connexion-carte h1 { margin: 0; font-family: var(--titre); font-weight: 400; font-size: 40px; letter-spacing: -0.02em; }
.connexion-carte > p { margin: -10px 0 6px; color: var(--encre-3); }
.erreur { margin: 0; min-height: 1.4em; color: var(--rouge); font-weight: 500; }

/* ---------- structure ---------- */
.app { max-width: 680px; margin: 0 auto; padding: 0 16px calc(96px + var(--bas)); }
.barre {
  position: sticky;
  top: 0;
  z-index: 5;
  margin: 0 -16px;
  padding: calc(12px + env(safe-area-inset-top, 0px)) 16px 12px;
  background: rgba(7, 22, 25, 0.86);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--ligne);
}
.barre-titre { display: flex; align-items: center; gap: 10px; font-family: var(--titre); font-size: 22px; }
.scene-active {
  margin-left: auto;
  font-family: var(--texte);
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.06em;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(244, 184, 99, 0.14);
  color: var(--or-vif);
}
.scene-active:empty { display: none; }
.scene-active.direct { background: rgba(255, 106, 85, 0.18); color: #ffb3a6; }
.voyants { display: flex; gap: 6px; margin-top: 10px; overflow-x: auto; scrollbar-width: none; }
.voyant {
  display: flex;
  align-items: center;
  gap: 7px;
  flex: none;
  padding: 5px 11px;
  border-radius: 999px;
  background: var(--fond-2);
  border: 1px solid var(--ligne);
  font-size: 13.5px;
  font-weight: 600;
  color: var(--encre-2);
}
.voyant i { width: 8px; height: 8px; border-radius: 50%; background: #56666a; }
.voyant.ok i { background: #5ee08a; box-shadow: 0 0 8px rgba(94, 224, 138, 0.7); }
.voyant.alerte i { background: var(--or); box-shadow: 0 0 8px rgba(244, 184, 99, 0.7); }
.voyant.ko i { background: var(--rouge); }

.vue { padding-top: 16px; display: grid; gap: 16px; }
.bloc {
  padding: 18px;
  border-radius: 20px;
  background: var(--carte);
  border: 1px solid var(--ligne);
  display: grid;
  gap: 14px;
}
.bloc h2 { margin: 0; font-size: 13px; font-weight: 700; letter-spacing: 0.18em; text-transform: uppercase; color: var(--or); }
.aide { margin: 0; color: var(--encre-3); font-size: 15px; }
.aide.centre { text-align: center; margin-top: -8px; }

/* ---------- boutons et champs ---------- */
.bouton {
  appearance: none;
  border: 1px solid var(--ligne);
  background: var(--carte-2);
  border-radius: 14px;
  min-height: 52px;
  padding: 10px 16px;
  font-weight: 600;
  font-size: 17px;
  cursor: pointer;
  transition: transform 0.12s ease, background 0.2s ease, border-color 0.2s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.bouton:active { transform: scale(0.97); }
.bouton:disabled { opacity: 0.4; cursor: default; transform: none; }
.bouton.principal { background: var(--or); color: #1b1307; border-color: transparent; }
.bouton.danger { background: rgba(255, 106, 85, 0.12); border-color: rgba(255, 106, 85, 0.35); color: #ffb3a6; }
.bouton.discret { background: transparent; color: var(--encre-2); }
.bouton.large { width: 100%; }
.bouton.actif { background: rgba(244, 184, 99, 0.16); border-color: rgba(244, 184, 99, 0.6); color: var(--or-vif); }
.bouton svg { width: 20px; height: 20px; }
.boutons-ligne { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 10px; }

.champ { display: grid; gap: 6px; }
.champ > span { font-size: 14px; font-weight: 600; color: var(--encre-2); }
.champ input, .champ select, .ajout input {
  width: 100%;
  min-height: 50px;
  padding: 0 14px;
  border-radius: 12px;
  border: 1px solid var(--ligne);
  background: var(--fond);
  color: var(--encre);
  font: inherit;
}
.champ input:focus, .champ select:focus, .ajout input:focus { outline: 2px solid rgba(244, 184, 99, 0.6); outline-offset: 1px; }
.champ.en-ligne { grid-template-columns: 1fr auto; align-items: center; }
.champ.en-ligne input, .champ.en-ligne select { width: 170px; }
.champ.curseur input { padding: 0; min-height: 36px; border: 0; background: none; accent-color: var(--or); }
.interrupteur { display: flex; align-items: center; gap: 14px; min-height: 44px; cursor: pointer; }
.interrupteur input {
  appearance: none;
  flex: none;
  width: 50px;
  height: 30px;
  border-radius: 999px;
  background: #2a4148;
  position: relative;
  transition: background 0.2s ease;
  cursor: pointer;
}
.interrupteur input::after {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: #fff;
  transition: transform 0.2s ease;
}
.interrupteur input:checked { background: var(--or); }
.interrupteur input:checked::after { transform: translateX(20px); }

/* ---------- prises ---------- */
.resume {
  display: grid;
  grid-template-columns: auto 1fr;
  grid-template-areas: 'total derniere' 'annuler annuler';
  align-items: center;
  gap: 12px 18px;
  padding: 16px 18px;
  border-radius: 20px;
  background: linear-gradient(135deg, rgba(244, 184, 99, 0.16), rgba(16, 41, 47, 0.9) 55%);
  border: 1px solid rgba(244, 184, 99, 0.22);
}
.resume-total { display: grid; grid-area: total; }
.etiquette { font-size: 12px; font-weight: 700; letter-spacing: 0.16em; text-transform: uppercase; color: var(--or); }
.resume-total b { font-family: var(--chiffres); font-size: 52px; line-height: 1; font-weight: 700; font-variant-numeric: tabular-nums; }
.resume-derniere { grid-area: derniere; font-size: 15px; color: var(--encre-2); min-width: 0; }
.resume-derniere strong { display: block; color: var(--encre); font-size: 17px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.annuler { grid-area: annuler; min-height: 48px; padding: 8px 14px; font-size: 16px; }

.grille-especes { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
@media (min-width: 560px) { .grille-especes { grid-template-columns: repeat(3, 1fr); } }
.espece {
  position: relative;
  appearance: none;
  border: 1px solid var(--ligne);
  border-radius: 20px;
  background: var(--carte);
  padding: 14px 12px 12px;
  min-height: 150px;
  display: grid;
  grid-template-rows: 56px auto auto;
  justify-items: center;
  align-items: center;
  gap: 4px;
  cursor: pointer;
  text-align: center;
  touch-action: manipulation;
  user-select: none;
  -webkit-user-select: none;
  transition: transform 0.12s ease, border-color 0.3s ease, background 0.3s ease;
  overflow: hidden;
}
.espece:active { transform: scale(0.96); }
.espece.a-des-prises { border-color: rgba(244, 184, 99, 0.35); background: linear-gradient(180deg, rgba(244, 184, 99, 0.1), var(--carte) 60%); }
.espece img { max-width: 100%; max-height: 56px; object-fit: contain; filter: drop-shadow(0 4px 6px rgba(0, 0, 0, 0.4)); pointer-events: none; }
.espece .sans-image { width: 64px; height: 40px; color: var(--mousse); }
.espece .nom { font-weight: 600; font-size: 17px; line-height: 1.15; }
.espece .nombre { font-family: var(--chiffres); font-weight: 700; font-size: 34px; line-height: 1; color: var(--or-vif); font-variant-numeric: tabular-nums; }
.espece .nombre.zero { color: var(--encre-3); }
.espece .plus {
  position: absolute;
  top: 10px;
  right: 10px;
  font-family: var(--chiffres);
  font-weight: 700;
  font-size: 15px;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(244, 184, 99, 0.16);
  color: var(--or);
}
.espece .moins {
  position: absolute;
  top: 6px;
  left: 6px;
  width: 40px;
  height: 40px;
  border-radius: 12px;
  border: 1px solid var(--ligne);
  background: rgba(7, 22, 25, 0.6);
  display: grid;
  place-items: center;
  font-size: 22px;
  font-weight: 600;
  line-height: 1;
  color: var(--encre-2);
}
.espece .moins[hidden] { display: none; }
.espece.flash::after {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 50% 50%, rgba(255, 208, 138, 0.55), transparent 70%);
  animation: flash 0.7s ease-out forwards;
  pointer-events: none;
}
@keyframes flash { from { opacity: 1; transform: scale(0.6); } to { opacity: 0; transform: scale(1.4); } }
.espece .nombre.saute { animation: saute 0.5s cubic-bezier(0.3, 1.6, 0.5, 1); }
@keyframes saute { 40% { transform: scale(1.4); } }

.liste-especes { display: flex; flex-wrap: wrap; gap: 8px; }
.puce-espece {
  appearance: none;
  border: 1px solid var(--ligne);
  background: var(--fond);
  border-radius: 999px;
  padding: 9px 14px;
  font-weight: 600;
  font-size: 15px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.puce-espece.active { border-color: rgba(244, 184, 99, 0.6); background: rgba(244, 184, 99, 0.14); color: var(--or-vif); }
.puce-espece .suppr { color: var(--rouge); font-size: 18px; line-height: 1; padding-left: 2px; }
.ajout { display: grid; grid-template-columns: 1fr auto; gap: 10px; }
details.bloc > summary { cursor: pointer; font-weight: 700; font-size: 13px; letter-spacing: 0.18em; text-transform: uppercase; color: var(--or); list-style: none; display: flex; justify-content: space-between; }
details.bloc > summary::after { content: '+'; font-size: 20px; letter-spacing: 0; color: var(--encre-2); }
details.bloc[open] > summary::after { content: '–'; }
details.bloc > summary::-webkit-details-marker { display: none; }

/* ---------- scènes ---------- */
.grille-scenes { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.grille-scenes .bouton { min-height: 64px; font-size: 18px; }
.flux-live { margin-top: 4px; }
.compte-etat { font-family: var(--chiffres); font-size: 40px; font-weight: 600; font-variant-numeric: tabular-nums; }
.compte-etat small { font-family: var(--texte); font-size: 15px; font-weight: 500; color: var(--encre-3); margin-left: 8px; }
.signal-mesure { display: flex; align-items: baseline; gap: 12px; }
.signal-mesure b { font-family: var(--chiffres); font-size: 40px; font-variant-numeric: tabular-nums; }
.signal-mesure .etat-ok { color: #5ee08a; }
.signal-mesure .etat-faible { color: var(--or); }
.signal-mesure .etat-absent { color: var(--rouge); }

.grille-tests { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.grille-tests .bouton { font-size: 15px; padding: 8px; }

/* ---------- liens et Twitch ---------- */
.etat-meteo { margin: 0; font-size: 15.5px; color: var(--encre-2); line-height: 1.45; }
.etat-meteo b { color: var(--encre); font-size: 17px; }
.suggestions button small { display: block; font-weight: 500; font-size: 13px; color: var(--encre-3); }
.etat-obs { margin: 0; display: flex; gap: 10px; align-items: flex-start; font-size: 15px; color: var(--encre-2); }
.etat-obs i { flex: none; width: 10px; height: 10px; margin-top: 6px; border-radius: 50%; background: #56666a; }
.etat-obs.ok i { background: #5ee08a; box-shadow: 0 0 8px rgba(94, 224, 138, 0.7); }
.etat-obs.ko i { background: var(--rouge); }
.etat-obs.ok { color: var(--encre); }
.lien { display: grid; grid-template-columns: 1fr auto; gap: 10px; align-items: center; padding: 10px 0; border-top: 1px solid var(--ligne); }
.lien:first-child { border-top: 0; }
.lien b { display: block; font-size: 16px; }
.lien code { display: block; font-size: 12.5px; color: var(--encre-3); overflow-wrap: anywhere; }
.lien .bouton { min-height: 42px; font-size: 14px; }
.twitch-ligne { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.twitch-ligne p { margin: 0; }
.twitch-ligne .bouton { flex: none; }

/* ---------- onglets ---------- */
.onglets {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 6;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  padding: 8px max(8px, calc((100vw - 680px) / 2)) calc(8px + var(--bas));
  background: rgba(7, 22, 25, 0.92);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-top: 1px solid var(--ligne);
}
.onglets button {
  appearance: none;
  border: 0;
  background: none;
  display: grid;
  justify-items: center;
  gap: 3px;
  padding: 6px 0;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--encre-3);
  cursor: pointer;
}
.onglets button svg { width: 26px; height: 26px; }
.onglets button.actif { color: var(--or-vif); }

/* ---------- divers ---------- */
.confirmation {
  border: 1px solid var(--ligne);
  border-radius: 22px;
  background: var(--carte);
  color: var(--encre);
  padding: 22px;
  width: min(92vw, 400px);
}
.confirmation::backdrop { background: rgba(2, 8, 10, 0.7); backdrop-filter: blur(3px); }
.confirmation p { margin: 0 0 18px; font-size: 18px; }
.toast {
  position: fixed;
  left: 50%;
  bottom: calc(96px + var(--bas));
  transform: translate(-50%, 20px);
  padding: 12px 18px;
  border-radius: 14px;
  background: #1d3a41;
  border: 1px solid var(--ligne);
  box-shadow: 0 14px 30px -12px rgba(0, 0, 0, 0.7);
  font-weight: 600;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease, transform 0.25s ease;
  max-width: calc(100vw - 32px);
  z-index: 10;
}
.toast.visible { opacity: 1; transform: translate(-50%, 0); }
.toast.erreur { background: #4a1f1a; border-color: rgba(255, 106, 85, 0.4); }
.boutons-ligne .bouton { padding: 8px 6px; white-space: nowrap; }

/* ---------- connexion Twitch ---------- */
.connexion-twitch, .connexion-mdp { display: grid; gap: 12px; }
.connexion-mdp:not(:first-child) { padding-top: 14px; border-top: 1px solid var(--ligne); }
.bouton.twitch { background: #9146ff; border-color: transparent; color: #fff; min-height: 56px; font-size: 18px; text-decoration: none; }
.bouton.twitch .glitch { width: 24px; height: 24px; fill: currentColor; stroke: none; }
.connexion-twitch .aide { font-size: 14.5px; line-height: 1.45; }
.lien-discret { color: var(--encre-2); font-size: 15px; text-decoration: underline; text-underline-offset: 3px; }
a.bouton { text-decoration: none; }

/* ---------- infos Twitch ---------- */
#twitch-champs { display: grid; gap: 14px; }
.champ small { font-weight: 500; color: var(--encre-3); }
.categorie { position: relative; }
.suggestions {
  position: absolute;
  left: 0;
  right: 0;
  top: 100%;
  z-index: 4;
  margin-top: 6px;
  border-radius: 14px;
  background: var(--carte-2);
  border: 1px solid var(--ligne);
  box-shadow: 0 18px 40px -16px rgba(0, 0, 0, 0.8);
  overflow: hidden;
}
.suggestions button {
  appearance: none;
  width: 100%;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 12px;
  border: 0;
  border-top: 1px solid var(--ligne);
  background: none;
  text-align: left;
  font-weight: 600;
  cursor: pointer;
}
.suggestions button:first-child { border-top: 0; }
.suggestions img { width: 26px; height: 36px; border-radius: 4px; object-fit: cover; flex: none; }
#dernier-clip a, .twitch-ligne a:not(.bouton) { color: var(--or-vif); }

/* ---------- stats ---------- */
.onglets { grid-template-columns: repeat(5, 1fr); }
.onglets button { font-size: 12px; }
.tuiles { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.tuile { padding: 14px 16px; border-radius: 18px; background: var(--carte); border: 1px solid var(--ligne); }
.tuile span { display: block; font-size: 13.5px; font-weight: 600; color: var(--encre-2); }
.tuile b { display: block; margin-top: 2px; font-size: 34px; font-weight: 600; line-height: 1.1; color: var(--encre); }
.tuile small { font-size: 16px; font-weight: 500; color: var(--encre-2); margin-left: 2px; }

.barres-especes { display: grid; gap: 10px; }
.barre-espece { display: grid; grid-template-columns: 64px 1fr; align-items: center; gap: 12px; }
.barre-espece img, .barre-espece .sans-image { width: 64px; height: 30px; object-fit: contain; }
.barre-espece .piste { display: flex; align-items: center; gap: 8px; min-width: 0; }
.barre-espece .nom-barre { font-size: 15px; font-weight: 600; margin-bottom: 4px; }
.barre-espece .rempli { height: 14px; min-width: 4px; border-radius: 0 4px 4px 0; background: #be8737; flex: none; }
.barre-espece .valeur { font-size: 15px; font-weight: 600; color: var(--encre); font-variant-numeric: tabular-nums; }

.titre-graphique { margin: -4px 0 0; font-size: 15px; color: var(--encre-2); }
.titre-graphique b { color: var(--encre); }
.colonnes {
  position: relative;
  display: grid;
  grid-template-columns: repeat(24, 1fr);
  align-items: end;
  gap: 2px;
  height: 140px;
  border-bottom: 1px solid rgba(214, 236, 228, 0.16);
}
.colonne { height: 100%; display: flex; align-items: flex-end; justify-content: center; cursor: pointer; touch-action: manipulation; }
.colonne i { display: block; width: 100%; max-width: 24px; min-height: 0; border-radius: 4px 4px 0 0; background: #be8737; transition: background 0.15s ease; }
.colonne:hover i, .colonne.actif i, .colonne:focus-visible i { background: #d9a050; }
.colonne:focus-visible { outline: 2px solid rgba(244, 184, 99, 0.6); outline-offset: 2px; border-radius: 4px; }
.axe-heures { display: flex; justify-content: space-between; font-size: 12.5px; color: var(--encre-3); margin-top: -6px; font-variant-numeric: tabular-nums; }
.infobulle { font-size: 15px; color: var(--encre-2); }
.infobulle b { color: var(--encre); font-size: 17px; margin-right: 6px; }
.tableau-heures summary { cursor: pointer; font-size: 14px; color: var(--encre-2); }
.tableau-heures table { width: 100%; margin-top: 10px; border-collapse: collapse; font-size: 14.5px; font-variant-numeric: tabular-nums; }
.tableau-heures th, .tableau-heures td { text-align: left; padding: 6px 4px; border-top: 1px solid var(--ligne); }
.tableau-heures th { color: var(--encre-3); font-weight: 600; }

.liste-sessions { display: grid; gap: 12px; }
.session-carte { padding: 14px; border-radius: 16px; background: var(--fond); border: 1px solid var(--ligne); display: grid; gap: 10px; }
.session-carte.en-cours { border-color: rgba(244, 184, 99, 0.45); }
.session-tete { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.session-tete b { font-size: 17px; }
.session-tete span { font-size: 14px; color: var(--encre-3); white-space: nowrap; }
.session-lieu { margin: -6px 0 0; font-size: 14.5px; color: var(--encre-2); }
.session-prises { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.session-prises .total { font-size: 28px; font-weight: 600; margin-right: 6px; line-height: 1; }
.puce-prise { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px 3px 4px; border-radius: 999px; background: var(--carte-2); font-size: 14px; font-weight: 600; }
.puce-prise img { width: 34px; height: 18px; object-fit: contain; }
.session-chiffres { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 14px; color: var(--encre-2); }
.session-chiffres b { color: var(--encre); font-weight: 600; }

/* une longue URL ne doit jamais élargir la page sur téléphone */
.vue > * { min-width: 0; }
code { overflow-wrap: anywhere; word-break: break-word; }

/* ---------- fiche d'une session (historique) ---------- */
.session-carte { cursor: pointer; text-align: left; font: inherit; color: inherit; width: 100%; }
.session-carte:active { transform: scale(0.99); }
.feuille {
  width: 100%;
  max-width: 680px;
  height: 100dvh;
  max-height: none;
  margin: 0 auto;
  padding: 0;
  border: 0;
  background: var(--fond);
  color: var(--encre);
}
.feuille::backdrop { background: rgba(2, 8, 10, 0.75); }
.feuille-tete {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: calc(12px + env(safe-area-inset-top, 0px)) 16px 12px;
  background: rgba(7, 22, 25, 0.94);
  border-bottom: 1px solid var(--ligne);
}
.feuille-tete b { display: block; font-family: var(--titre); font-weight: 400; font-size: 24px; }
.feuille-tete span { font-size: 14px; color: var(--encre-3); }
.feuille-tete .fermer { min-height: 44px; width: 44px; padding: 0; }
.feuille-corps { display: grid; gap: 16px; padding: 16px 16px calc(24px + var(--bas)); }
.liste-prises { display: grid; }
.ligne-prise { display: grid; grid-template-columns: 58px 1fr auto; align-items: center; gap: 10px; padding: 8px 0; border-top: 1px solid var(--ligne); }
.ligne-prise:first-child { border-top: 0; }
.ligne-prise img, .ligne-prise .sans-image { width: 58px; height: 26px; object-fit: contain; }
.ligne-prise .quoi b { display: block; font-size: 16px; }
.ligne-prise .quoi span { font-size: 14px; color: var(--encre-3); font-variant-numeric: tabular-nums; }
.ligne-prise .gestes { display: flex; gap: 6px; }
.ligne-prise .gestes .bouton { min-height: 40px; padding: 6px 10px; font-size: 14px; }
.ligne-prise.edition { grid-template-columns: 1fr; }
.edition-prise, .ajout-prise { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.edition-prise .bouton, .ajout-prise .bouton { min-height: 46px; }
.ajout-prise .bouton { grid-column: 1 / -1; }
.edition-prise select, .edition-prise input, .ajout-prise select, .ajout-prise input { grid-column: 1 / -1; }
.edition-prise select, .edition-prise input, .ajout-prise select, .ajout-prise input {
  min-height: 46px; padding: 0 10px; border-radius: 12px; border: 1px solid var(--ligne);
  background: var(--fond); color: var(--encre); font: inherit; font-size: 15px; min-width: 0;
}
.ajout-prise { padding-top: 12px; border-top: 1px dashed var(--ligne); }
.liste-evenements { display: grid; gap: 6px; font-size: 15px; color: var(--encre-2); }
.liste-evenements b { color: var(--encre); }
.liste-evenements time { color: var(--encre-3); font-variant-numeric: tabular-nums; margin-right: 8px; }

/* ---------- chat dans le panel ---------- */
.onglets button { position: relative; }
.non-lus {
  position: absolute; top: 2px; left: 54%;
  min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px;
  background: var(--corail); color: #1b0d06; font-style: normal; font-size: 11.5px; font-weight: 700; line-height: 18px;
}
.vue-chat { position: relative; }
.fil-chat {
  height: calc(100dvh - 200px - var(--bas) - env(safe-area-inset-top, 0px));
  overflow-y: auto;
  overscroll-behavior: contain;
  display: flex; flex-direction: column; gap: 4px;
  padding: 4px 2px 12px;
}
.fil-chat .chat-attente { margin: auto; text-align: center; }
.ligne-chat { padding: 7px 10px; border-radius: 12px; font-size: 16px; line-height: 1.4; overflow-wrap: anywhere; }
.ligne-chat:nth-child(odd) { background: rgba(237, 244, 240, 0.03); }
.ligne-chat time { font-size: 12.5px; color: var(--encre-3); margin-right: 6px; font-variant-numeric: tabular-nums; }
.ligne-chat .auteur { font-weight: 700; color: var(--c, var(--mousse)); margin-right: 6px; }
.ligne-chat .badges { display: inline-flex; gap: 3px; margin-right: 4px; vertical-align: -3px; }
.ligne-chat .badge { width: 17px; height: 17px; }
.ligne-chat .emote { height: 1.5em; vertical-align: -0.4em; }
.ligne-chat.action .texte { font-style: italic; color: var(--c, var(--encre)); }
.ligne-chat.supprime .texte { text-decoration: line-through; color: var(--encre-3); }
.ligne-chat.evenement { background: rgba(244, 184, 99, 0.1); border: 1px solid rgba(244, 184, 99, 0.25); color: var(--encre); }
.ligne-chat.evenement b { color: var(--or-vif); }
.nouveaux { position: absolute; left: 50%; bottom: 14px; transform: translateX(-50%); min-height: 40px; font-size: 14px; background: var(--or); color: #1b1307; border: 0; box-shadow: 0 10px 24px -10px rgba(0, 0, 0, 0.8); }

.presence { margin: 8px 0 0; font-size: 13.5px; color: var(--encre-2); display: flex; align-items: center; gap: 8px; }
.presence::before { content: ''; width: 8px; height: 8px; border-radius: 50%; background: var(--mousse); box-shadow: 0 0 8px rgba(158, 214, 195, 0.7); flex: none; }
.presence b { color: var(--encre); font-weight: 600; }

.autocomplete { position: relative; }
.autocomplete .suggestions button span { display: grid; }

/* ---------- correctifs de mise en page sur petits écrans ---------- */
/* cartes d'espèce : « − », compteur et « +1 » sur une ligne, sous l'illustration */
.espece { grid-template-rows: 52px auto auto; padding: 12px 10px 10px; min-height: 0; gap: 6px; }
.espece img, .espece .sans-image { max-height: 52px; }
.espece-pied { display: grid; grid-template-columns: 40px 1fr 40px; align-items: center; width: 100%; }
.espece .moins { position: static; width: 40px; height: 40px; }
.espece .plus { position: static; justify-self: end; padding: 3px 7px; }
.espece .nombre { text-align: center; }
/* un <details> mis en grille ne réserve pas la hauteur de son contenu : on le laisse en bloc */
details.bloc { display: block; }
details.bloc > :not(summary) { margin-top: 14px; }
.flux-live { margin-top: 12px; }
.grille-scenes .bouton { min-width: 0; overflow-wrap: anywhere; }
/* chaque élément garde sa colonne, même quand « − » est masqué (compteur à 0) */
.espece .moins { grid-column: 1; }
.espece .nombre { grid-column: 2; }
.espece .plus { grid-column: 3; }
details.bloc:not([open]) { padding-top: 16px; padding-bottom: 16px; }
details.bloc > summary { min-height: 24px; align-items: center; }

/* rangées de boutons : elles passent à la ligne au lieu de déborder du bloc */
.boutons-ligne { grid-auto-flow: row; grid-template-columns: repeat(auto-fit, minmax(min(100%, 132px), 1fr)); }
.boutons-ligne .bouton { white-space: normal; text-align: center; line-height: 1.2; }
.boutons-ligne.serre { grid-template-columns: repeat(auto-fit, minmax(62px, 1fr)); }
.boutons-ligne.serre .bouton { white-space: nowrap; }
.confirmation .boutons-ligne { grid-template-columns: 1fr 1fr; }
.grille-tests { grid-template-columns: repeat(auto-fit, minmax(min(100%, 104px), 1fr)); }
.grille-tests .bouton { min-width: 0; line-height: 1.2; }
.voyants { flex-wrap: wrap; overflow: visible; }
.resume-derniere strong { white-space: normal; }

/* ---------- diffusion ---------- */
.diffusion-etat { margin: -4px 0 0; display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; font-size: 15px; color: var(--encre-2); }
.diffusion-etat .pastille-direct { display: inline-flex; align-items: center; gap: 8px; font-weight: 700; color: #ffb3a6; }
.diffusion-etat .pastille-direct::before { content: ''; width: 10px; height: 10px; border-radius: 50%; background: var(--rouge); box-shadow: 0 0 10px var(--rouge); }
.diffusion-etat b { color: var(--encre); font-variant-numeric: tabular-nums; }
.diffusion-etat .mauvais { color: var(--or-vif); }

/* ---------- onglet Chat : aperçu, fil, saisie ---------- */
.vue-chat {
  display: flex;
  flex-direction: column;
  gap: 10px;
  height: calc(100dvh - var(--h-barre, 110px) - var(--h-onglets, 76px) - 16px);
}
.apercu { flex: none; display: grid; gap: 8px; }
.apercu-choix { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; padding: 4px; border-radius: 12px; background: var(--carte); border: 1px solid var(--ligne); }
.apercu-choix button { appearance: none; border: 0; border-radius: 9px; background: none; min-height: 36px; font-weight: 600; font-size: 14px; color: var(--encre-2); cursor: pointer; }
.apercu-choix button.actif { background: var(--carte-2); color: var(--or-vif); }
.apercu-cadre { position: relative; aspect-ratio: 16 / 9; max-height: 32dvh; margin: 0 auto; width: 100%; border-radius: 14px; overflow: hidden; background: #000; }
.apercu-cadre:empty { display: none; }
.apercu-cadre iframe, .apercu-cadre img { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; object-fit: contain; }
.apercu-cadre .apercu-message { position: absolute; inset: 0; display: grid; place-items: center; padding: 16px; text-align: center; font-size: 14px; color: var(--encre-3); }
.vue-chat .fil-chat { flex: 1; min-height: 0; height: auto; }
.ligne-chat[data-id] { cursor: pointer; }
.ligne-chat.cible { outline: 1px solid rgba(244, 184, 99, 0.6); }
.saisie-chat { flex: none; display: grid; grid-template-columns: 1fr 52px; gap: 8px; }
.saisie-chat input {
  min-height: 50px; padding: 0 14px; border-radius: 14px; border: 1px solid var(--ligne);
  background: var(--carte); color: var(--encre); font: inherit; min-width: 0;
}
.saisie-chat input:focus { outline: 2px solid rgba(244, 184, 99, 0.6); }
.saisie-chat input:disabled { opacity: 0.6; }
.saisie-chat .bouton { min-height: 50px; padding: 0; }
.saisie-chat .bouton svg { width: 22px; height: 22px; }
.reponse-a { grid-column: 1 / -1; display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 6px 10px; border-radius: 10px; background: rgba(244, 184, 99, 0.12); font-size: 14px; color: var(--or-vif); }
.reponse-a button { appearance: none; border: 0; background: none; color: inherit; font-size: 20px; line-height: 1; cursor: pointer; padding: 0 4px; }
.vue-chat .nouveaux { bottom: 74px; }
