:root {
  --fond: #121217;
  --surface: #1d1d25;
  --surface-2: #17171d;
  --bord: #2e2e39;
  --texte: #f2f0ea;
  --texte-2: #d6d4de;
  --discret: #a8a6b3;
  --accent: #f2b544;
  --accent-fond: #2a2414;
  --accent-bord: #5c4a1c;
  --alerte: #e8a05c;
  --bien: #7fc8a9;
  --rayon: 12px;
  color-scheme: dark;
}

* { box-sizing: border-box; }

html { background: var(--fond); }
html, body { margin: 0; }

body {
  min-height: 100vh;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: var(--texte);
  background:
    url("../icons/bobine.svg") no-repeat right -160px top -70px / 460px,
    radial-gradient(130% 55% at 100% 0%, #241d2c 0%, var(--fond) 65%) fixed,
    var(--fond);
  padding-bottom: calc(72px + env(safe-area-inset-bottom));
}

a { color: var(--accent); text-decoration: none; }
a:hover { color: #ffd27a; }
button { font: inherit; color: inherit; cursor: pointer; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.bandeau-demo, .bandeau-hors-ligne {
  font-size: 12px; text-align: center; padding: 6px 16px;
}
.bandeau-demo { background: #3a2e12; color: #f2d79a; }
.bandeau-hors-ligne { background: #2b2b36; color: var(--texte-2); }

.ecran {
  position: relative; z-index: 1;
  max-width: 560px; margin: 0 auto; padding: 20px 20px 24px;
  display: flex; flex-direction: column; gap: 18px; outline: none;
}

h1 { margin: 0; font-size: 24px; font-weight: 700; letter-spacing: -0.3px; }
h2 { margin: 0; font-size: 17px; font-weight: 650; }
.titre-appli span { color: var(--accent); }
.discret { color: var(--discret); font-size: 13px; }
.petit { font-size: 12px; }
.ligne-titre { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.section { display: flex; flex-direction: column; gap: 10px; }

/* Barre du bas */
.barre {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 10;
  display: grid; grid-template-columns: repeat(4, minmax(0, 1fr));
  background: var(--surface-2); border-top: 1px solid var(--bord);
  height: calc(64px + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom);
}
/* Padmé fait la sieste sur le rebord de la barre du bas, comme sur l'accoudoir. */
.barre::before {
  content: ""; position: absolute; pointer-events: none;
  right: 14px; bottom: calc(100% - 9px);
  width: 86px; height: 54px;
  background: url("../icons/padme-fond.svg") no-repeat right bottom / contain;
}
.barre a {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 4px; font-size: 11px; color: var(--discret);
}
.barre a[aria-current="page"] { color: var(--accent); }
.barre svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* Champs et boutons */
.recherche {
  display: flex; align-items: center; gap: 10px; height: 48px; padding: 0 14px;
  background: var(--surface); border: 1px solid var(--bord); border-radius: var(--rayon);
}
.recherche input { flex: 1; min-width: 0; background: transparent; border: 0; color: var(--texte); font-size: 16px; outline: none; }
.recherche svg { width: 18px; height: 18px; fill: none; stroke: var(--discret); stroke-width: 2; flex-shrink: 0; }

.bouton {
  min-height: 48px; padding: 0 16px; border-radius: var(--rayon);
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  font-size: 15px; font-weight: 650; border: 1px solid var(--bord); background: var(--surface);
}
.bouton-principal { background: var(--accent); color: #121217; border-color: var(--accent); font-weight: 700; }
.bouton-cadre { background: rgba(242, 181, 68, 0.1); color: var(--accent); border-color: var(--accent); }
.bouton svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.bouton-petit { min-height: 36px; font-size: 13px; padding: 0 12px; border-radius: 8px; }

.pastilles { display: flex; flex-wrap: wrap; gap: 8px; }
.pastille {
  min-height: 36px; padding: 0 12px; border-radius: 999px; font-size: 13px;
  border: 1px solid var(--bord); background: transparent; color: var(--texte-2);
}
.pastille[aria-pressed="true"] { background: var(--accent); color: #121217; border-color: var(--accent); font-weight: 600; }

.interrupteur {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  min-height: 48px; padding: 0 14px; background: var(--surface); border-radius: var(--rayon); font-size: 14px;
}
.interrupteur input { width: 20px; height: 20px; accent-color: var(--accent); }

/* Affiches */
.affiche {
  position: relative; overflow: hidden; border-radius: 10px; aspect-ratio: 2 / 3;
  background: linear-gradient(160deg, var(--teinte-a, #2b4a6b), var(--teinte-b, #0f1c2b));
}
.affiche img { width: 100%; height: 100%; object-fit: cover; display: block; }
.affiche .nom-secours {
  position: absolute; inset: auto 0 0 0; padding: 8px; font-size: 12px; font-weight: 600;
}
.affiche .note-coin {
  position: absolute; top: 6px; right: 6px; font-size: 11px; font-weight: 700;
  background: rgba(18, 18, 23, 0.85); border-radius: 6px; padding: 2px 6px;
}
.affiche .liseret { position: absolute; left: 0; right: 0; bottom: 0; height: 4px; }

.defile { display: flex; gap: 12px; overflow-x: auto; padding-bottom: 4px; scroll-snap-type: x proximity; }
.defile > a { flex: 0 0 108px; scroll-snap-align: start; }
.carte-affiche { display: flex; flex-direction: column; gap: 5px; color: var(--texte); }
.carte-affiche .t { font-size: 13px; font-weight: 600; line-height: 1.25; }
.carte-affiche .s { font-size: 11px; color: var(--discret); }

.grille { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px 12px; }

/* Lignes de liste */
.lignes { display: flex; flex-direction: column; gap: 10px; }
.ligne {
  display: flex; gap: 12px; align-items: center; padding: 10px;
  background: var(--surface); border-radius: var(--rayon); color: var(--texte);
}
.ligne .affiche { width: 48px; flex-shrink: 0; border-radius: 6px; }
.ligne .corps { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.ligne .t { font-size: 15px; font-weight: 600; }
.ligne .s { font-size: 12px; color: var(--discret); }

.plateforme {
  align-self: flex-start; font-size: 11px; font-weight: 600; color: #fff;
  border-radius: 999px; padding: 3px 8px; white-space: nowrap;
}
.en-salles { color: var(--accent); border: 1px solid var(--accent); background: transparent; }
.statut-terminee { color: var(--bien); }
.statut-annulee, .alerte { color: var(--alerte); }

/* Fiche */
.entete-fiche { display: flex; gap: 14px; }
.entete-fiche .affiche { width: 110px; flex-shrink: 0; }
.entete-fiche .infos { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.notes { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.note { background: var(--surface); border-radius: 10px; padding: 10px; display: flex; flex-direction: column; gap: 2px; }
.note .l { font-size: 11px; color: var(--discret); }
.note .v { font-size: 20px; font-weight: 700; }
.note .p { font-size: 11px; color: var(--discret); }
.offre { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 10px; background: var(--surface); font-size: 14px; }
.offre-incluse { background: var(--accent-fond); border: 1px solid var(--accent-bord); }
.casting { display: flex; gap: 10px; overflow-x: auto; }
.personne { flex: 0 0 76px; display: flex; flex-direction: column; align-items: center; gap: 4px; text-align: center; }
.personne .photo {
  width: 60px; height: 60px; border-radius: 50%; overflow: hidden; background: #3b4a6b;
  display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 17px;
}
.personne .photo img { width: 100%; height: 100%; object-fit: cover; }
.personne .n { font-size: 12px; font-weight: 600; line-height: 1.25; }
.personne .r { font-size: 11px; color: var(--discret); line-height: 1.25; }
.resume { margin: 0; font-size: 14px; line-height: 1.45; color: var(--texte-2); }
.actions-etat { display: flex; gap: 8px; flex-wrap: wrap; }

/* Choisis pour moi */
.tirage {
  display: flex; flex-direction: column; gap: 12px; padding: 14px;
  background: var(--surface-2); border: 1px solid var(--accent-bord); border-radius: var(--rayon);
}
.tirage[hidden] { display: none; }

.vide { text-align: center; color: var(--discret); font-size: 14px; padding: 24px 8px; }
.erreur { color: var(--alerte); font-size: 14px; }
/* Chargement : Padmé dort. N'apparaît qu'après 0,3 s pour ne pas clignoter quand c'est rapide. */
.chargement-padme {
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  padding: 28px 0; color: var(--discret); font-size: 14px;
  animation: apparait 0.3s ease-out 0.3s both;
}
.chargement-padme svg { width: 170px; height: auto; overflow: visible; }
.padme-corps { transform-box: fill-box; transform-origin: 50% 100%; animation: respire 3.2s ease-in-out infinite; }
.padme-tete { transform-box: fill-box; transform-origin: 25% 85%; animation: dodeline 3.2s ease-in-out infinite; }
.padme-z { opacity: 0; transform-box: fill-box; animation: zzz 3s ease-in infinite; }
.padme-z.z2 { animation-delay: 1s; }
.padme-z.z3 { animation-delay: 2s; }
@keyframes apparait { from { opacity: 0; } to { opacity: 1; } }
@keyframes respire { 0%, 100% { transform: scaleY(1); } 50% { transform: scaleY(1.05); } }
@keyframes dodeline { 0%, 100% { transform: rotate(0deg); } 50% { transform: rotate(-5deg) translateY(1.5px); } }
@keyframes zzz {
  0% { opacity: 0; transform: translate(0, 0) scale(0.6); }
  20% { opacity: 1; }
  100% { opacity: 0; transform: translate(14px, -34px) scale(1.15); }
}
@media (prefers-reduced-motion: reduce) {
  .padme-corps, .padme-tete { animation: none; }
  .padme-z { animation: none; opacity: 1; }
  .padme-z.z1, .padme-z.z2 { opacity: 0; }
}

/* Réglages */
.cases { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.case {
  display: flex; align-items: center; gap: 10px; min-height: 46px; padding: 0 12px;
  background: var(--surface); border: 1px solid var(--bord); border-radius: 10px; font-size: 14px;
}
.case:has(input:checked) { background: var(--accent-fond); border-color: var(--accent-bord); }
.case input { width: 18px; height: 18px; accent-color: var(--accent); }
.point { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.champ { display: flex; gap: 8px; }
.champ input {
  flex: 1; min-width: 0; min-height: 48px; padding: 0 12px; border-radius: 10px;
  border: 1px solid var(--bord); background: var(--surface); color: var(--texte); font-size: 15px;
}
fieldset { margin: 0; padding: 0; border: 0; display: flex; flex-direction: column; gap: 8px; }
legend { font-size: 17px; font-weight: 650; padding: 0; margin-bottom: 8px; }
.visuellement-cache { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
