@media (prefers-reduced-motion: no-preference) {
  @view-transition { navigation: auto; }
}

:root {
  --ciel-haut: #070f26;
  --ciel: #0c1631;
  --ciel-bas: #18294f;
  --pierre: #283457;
  --pierre-claire: #3a4870;
  --pierre-sombre: #1c2644;
  --encadrement: #4a5a86;
  --volet: #4c678f;
  --volet-lame: #3a5277;
  --vitre: #0a1226;
  --lumiere: #ffc66e;
  --lumiere-vive: #ffe2a3;
  --lumiere-chaude: #f0923c;
  --neige: #eaf0fa;
  --neige-ombre: #b6c4de;
  --texte: #f4efe6;
  --texte-2: #aebbd8;
  --texte-3: #b3bfdc;
  --trait: rgba(174, 187, 216, 0.22);
  --rate: #d99a8f;
  --urgence: #ff9479;
  --froide: #8a9cc6;

  --titre: "Marcellus", "Times New Roman", serif;
  --corps: "Figtree", system-ui, -apple-system, "Segoe UI", sans-serif;
  --sortie: cubic-bezier(0.16, 1, 0.3, 1);
  --gouttiere: 16px;
  --barre-jour: 0px;
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  background: var(--ciel-haut);
  overflow-x: clip;
}

body {
  position: relative;
  margin: 0;
  min-height: 100dvh;
  overflow-x: clip;
  font-family: var(--corps);
  font-size: 16px;
  line-height: 1.5;
  color: var(--texte);
  background: linear-gradient(180deg, var(--ciel-haut) 0, var(--ciel) 380px, var(--ciel-bas) 100%);
  -webkit-font-smoothing: antialiased;
}

body::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 520px;
  pointer-events: none;
  background-image:
    radial-gradient(1.2px 1.2px at 8% 12%, #fff 60%, transparent 62%),
    radial-gradient(1px 1px at 22% 5%, rgba(255,255,255,.7) 60%, transparent 62%),
    radial-gradient(1.4px 1.4px at 37% 16%, rgba(255,255,255,.85) 60%, transparent 62%),
    radial-gradient(1px 1px at 51% 7%, rgba(255,255,255,.6) 60%, transparent 62%),
    radial-gradient(1.2px 1.2px at 64% 13%, #fff 60%, transparent 62%),
    radial-gradient(1px 1px at 78% 4%, rgba(255,255,255,.75) 60%, transparent 62%),
    radial-gradient(1.5px 1.5px at 91% 11%, rgba(255,255,255,.9) 60%, transparent 62%),
    radial-gradient(1px 1px at 15% 26%, rgba(255,255,255,.5) 60%, transparent 62%),
    radial-gradient(1px 1px at 44% 29%, rgba(255,255,255,.45) 60%, transparent 62%),
    radial-gradient(1.2px 1.2px at 70% 24%, rgba(255,255,255,.6) 60%, transparent 62%),
    radial-gradient(1px 1px at 86% 31%, rgba(255,255,255,.5) 60%, transparent 62%),
    radial-gradient(1px 1px at 4% 40%, rgba(255,255,255,.4) 60%, transparent 62%),
    radial-gradient(1px 1px at 96% 46%, rgba(255,255,255,.4) 60%, transparent 62%);
}

::selection { background: rgba(255, 198, 110, 0.35); color: var(--texte); }
:focus-visible { outline: 2px solid var(--lumiere); outline-offset: 3px; border-radius: 4px; }
a { color: inherit; }
button, input, select { font: inherit; color: inherit; }
button { -webkit-tap-highlight-color: transparent; touch-action: manipulation; }

.n { font-family: var(--corps); font-weight: 600; letter-spacing: -0.01em; }

.visuellement-cache {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

.neige {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 5;
}

/* En-tête */
.barre {
  position: relative;
  z-index: 3;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  max-width: 1180px;
  margin: 0 auto;
  padding: max(12px, env(safe-area-inset-top)) max(var(--gouttiere), env(safe-area-inset-right)) 8px max(var(--gouttiere), env(safe-area-inset-left));
}
.barre-titre {
  margin: 0;
  font-family: var(--titre);
  font-weight: 400;
  font-size: 22px;
  line-height: 1.15;
}
.score {
  display: inline-flex;
  align-items: center;
  flex: none;
  padding: 7px 13px 7px 11px;
  border: 1px solid rgba(255, 198, 110, 0.35);
  border-radius: 999px;
  font-size: 15px;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  color: var(--texte-2);
  background: rgba(255, 198, 110, 0.07);
}
.score svg { width: 15px; height: 15px; margin-right: 7px; color: var(--lumiere); }
.score strong { color: var(--texte); font-weight: 700; }
.score .sur { margin-left: 2px; }

.retour {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-height: 44px;
  padding-right: 8px;
  margin-left: -6px;
  font-weight: 500;
  color: var(--texte-2);
  text-decoration: none;
}
.retour svg { width: 22px; height: 22px; }
.retour:hover { color: var(--texte); }

.lune {
  position: absolute;
  top: 74px;
  right: 9%;
  z-index: 0;
  width: 64px;
  height: 64px;
  pointer-events: none;
  display: none;
}

/* Page du calendrier */
.page {
  position: relative;
  z-index: 1;
  padding: 0 max(var(--gouttiere), env(safe-area-inset-right)) 0 max(var(--gouttiere), env(safe-area-inset-left));
}

.scene {
  position: relative;
  isolation: isolate;
  margin-top: 6px;
}

.batiment {
  position: relative;
  container-type: inline-size;
  width: max(260px, min(100%, 560px, calc((100dvh - 106px - var(--du-jour-h, 84px)) / 1.47)));
  margin: 0 auto;
}

.toit { display: block; width: 100%; height: auto; }

.bandeau {
  position: relative;
  z-index: 1;
  margin-top: -1px;
  padding: 1.8cqw 2cqw 1.6cqw;
  text-align: center;
  line-height: 1.2;
  background: var(--pierre-claire);
  box-shadow: inset 0 -2px 0 rgba(0, 0, 0, 0.18), 0 3px 0 rgba(0, 0, 0, 0.15);
}
.bandeau span {
  font-family: var(--titre);
  font-size: max(9.5px, 3.05cqw);
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: #d3dbef;
  text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.45), 0 1px 0 rgba(255, 255, 255, 0.12);
}
.bandeau sup { font-size: 0.62em; letter-spacing: 0.08em; }

.facade {
  position: relative;
  background:
    linear-gradient(90deg, rgba(255,255,255,.045) 0 2.8cqw, transparent 2.8cqw calc(100% - 2.8cqw), rgba(255,255,255,.045) calc(100% - 2.8cqw)),
    var(--pierre);
}

.guirlande {
  position: absolute;
  top: 0;
  left: 2.8cqw;
  width: calc(100% - 5.6cqw);
  height: auto;
  z-index: 1;
  pointer-events: none;
}
.guirlande .ampoule { animation: scintille 3.4s ease-in-out infinite; }
.guirlande .ampoule:nth-of-type(3n) { animation-delay: -1.2s; }
.guirlande .ampoule:nth-of-type(3n+1) { animation-delay: -2.3s; }

.fenetres {
  list-style: none;
  margin: 0;
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  column-gap: 4cqw;
  row-gap: 3.2cqw;
  padding: 6cqw 7cqw 5.6cqw;
}

/* Une fenêtre */
.f {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.1cqw;
  width: 100%;
  text-decoration: none;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}
.f:focus-visible { outline: none; }
.f:focus-visible .f-baie { outline: 2px solid var(--lumiere); outline-offset: 4px; }

.f-num {
  display: inline-flex;
  align-items: center;
  gap: 0.5cqw;
  height: 4.4cqw;
  font-size: max(11.5px, 3.7cqw);
  font-weight: 600;
  line-height: 1;
  color: var(--texte-3);
  text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.5);
  font-variant-numeric: tabular-nums;
}
.f-num svg { width: max(8px, 2.5cqw); height: max(8px, 2.5cqw); color: var(--lumiere); }

.f-baie {
  position: relative;
  width: 100%;
  aspect-ratio: 5 / 6;
  perspective: 45cqw;
  border: max(2px, 0.75cqw) solid var(--encadrement);
  border-radius: 3px 3px 1px 1px;
  background: var(--vitre);
}
.f-baie::after {
  content: "";
  position: absolute;
  left: -14%;
  right: -14%;
  bottom: calc(-1 * max(5px, 1.7cqw));
  height: max(3.5px, 1.25cqw);
  border-radius: 2px;
  background: var(--neige);
  box-shadow: 0 2px 0 rgba(0, 0, 0, 0.28), inset 0 -1px 0 var(--neige-ombre);
}

.f-lumiere {
  position: absolute;
  inset: 0;
  background: radial-gradient(120% 90% at 50% 78%, var(--lumiere-vive) 0%, var(--lumiere) 42%, var(--lumiere-chaude) 100%);
  opacity: 0;
  transition: opacity 0.9s var(--sortie), filter 0.9s var(--sortie);
}

.f-croisillons {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(90deg, transparent calc(50% - 1px), var(--encadrement) calc(50% - 1px) calc(50% + 1px), transparent calc(50% + 1px)),
    linear-gradient(180deg, transparent calc(50% - 1px), var(--encadrement) calc(50% - 1px) calc(50% + 1px), transparent calc(50% + 1px));
  transition: opacity 0.6s;
}

.f-volet {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 50%;
  background: repeating-linear-gradient(180deg, var(--volet) 0 3px, var(--volet-lame) 3px 4.5px);
  box-shadow: inset 0 0 0 1.5px #314767;
  transition: transform 0.75s var(--sortie);
  will-change: transform;
}
.f-volet.g { left: 0; transform-origin: left center; }
.f-volet.d { right: 0; transform-origin: right center; transition-delay: 0.05s; }

/* Un volet ouvert déborde sur la fenêtre voisine : seul le cadre de chaque fenêtre reçoit le toucher. */
.f-baie > *, .f-baie::after { pointer-events: none; }

/* États */
.f[data-etat="ouverte"] .f-num { color: var(--lumiere); }
.f[data-etat="ouverte"] .f-lumiere { opacity: 1; animation: veille 2.8s ease-in-out infinite; }
.f[data-etat="ouverte"] .f-croisillons { opacity: 0.5; }
.f[data-etat="ouverte"] .f-volet.g { transform: rotateY(-38deg); }
.f[data-etat="ouverte"] .f-volet.d { transform: rotateY(38deg); }
.f[data-etat="ouverte"] .f-baie { box-shadow: 0 0 4cqw rgba(255, 186, 92, 0.4); }

.f[data-etat="juste"] .f-lumiere { opacity: 1; }
.f[data-etat="juste"] .f-lumiere::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: 4%;
  width: 46%;
  height: 58%;
  transform: translateX(-50%);
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 26'%3E%3Cpath fill='%23284a3c' d='M10 1 15.5 9.5H12.5L17.5 17H13.8L19 24H1L6.2 17H2.5L7.5 9.5H4.5Z'/%3E%3Crect x='8.6' y='24' width='2.8' height='2' fill='%23284a3c'/%3E%3Cg fill='%23fff1c2'%3E%3Ccircle cx='8' cy='12' r='.9'/%3E%3Ccircle cx='12.4' cy='15' r='.9'/%3E%3Ccircle cx='7' cy='20' r='.9'/%3E%3Ccircle cx='13.5' cy='21' r='.9'/%3E%3Ccircle cx='10' cy='18' r='.9'/%3E%3C/g%3E%3C/svg%3E") no-repeat center bottom / contain;
}
.f[data-etat="juste"] .f-croisillons { opacity: 0.45; }
.f[data-etat="juste"] .f-baie { box-shadow: 0 0 3cqw rgba(255, 186, 92, 0.32); }

.f[data-etat="ratee"] .f-lumiere {
  opacity: 1;
  background: radial-gradient(120% 90% at 50% 78%, #cfd9f0 0%, #8a9cc6 55%, #5a6b94 100%);
}
.f[data-etat="ratee"] .f-croisillons { opacity: 0.6; }

.f[data-etat="manquee"] .f-baie { background: #111a33; }

.f[data-etat="juste"] .f-volet.g,
.f[data-etat="ratee"] .f-volet.g,
.f[data-etat="manquee"] .f-volet.g,
.f.ouvre .f-volet.g { transform: rotateY(-110deg); }
.f[data-etat="juste"] .f-volet.d,
.f[data-etat="ratee"] .f-volet.d,
.f[data-etat="manquee"] .f-volet.d,
.f.ouvre .f-volet.d { transform: rotateY(110deg); }

.f.ouvre .f-lumiere { opacity: 1; animation: none; filter: brightness(1.12); }

@media (hover: hover) {
  .f[data-etat="futur"]:hover .f-volet.g { transform: rotateY(-8deg); }
  .f[data-etat="futur"]:hover .f-volet.d { transform: rotateY(8deg); }
  .f[data-etat="ouverte"]:not(.ouvre):hover .f-volet.g { transform: rotateY(-55deg); }
  .f[data-etat="ouverte"]:not(.ouvre):hover .f-volet.d { transform: rotateY(55deg); }
}

.f.secoue .f-volet.g { animation: secoue 0.42s var(--sortie); }
.f.secoue .f-volet.d { animation: secoue-d 0.42s var(--sortie); }

@keyframes veille { 0%, 100% { opacity: 0.78; } 50% { opacity: 1; } }
@keyframes scintille { 0%, 100% { opacity: 1; } 50% { opacity: 0.4; } }
@keyframes secoue {
  0% { transform: rotateY(0); } 25% { transform: rotateY(-14deg); }
  55% { transform: rotateY(5deg); } 80% { transform: rotateY(-3deg); } 100% { transform: rotateY(0); }
}
@keyframes secoue-d {
  0% { transform: rotateY(0); } 25% { transform: rotateY(14deg); }
  55% { transform: rotateY(-5deg); } 80% { transform: rotateY(3deg); } 100% { transform: rotateY(0); }
}

/* Rez-de-chaussée et abords */
.rdc {
  position: relative;
  height: 22cqw;
  background:
    linear-gradient(180deg, transparent calc(100% - 4cqw), var(--pierre-sombre) calc(100% - 4cqw)),
    linear-gradient(90deg, rgba(255,255,255,.045) 0 2.8cqw, transparent 2.8cqw calc(100% - 2.8cqw), rgba(255,255,255,.045) calc(100% - 2.8cqw)),
    var(--pierre);
  box-shadow: inset 0 3px 0 rgba(255, 255, 255, 0.05);
}
.rdc .porte {
  position: absolute;
  left: 50%;
  bottom: 0;
  width: 21cqw;
  height: auto;
  transform: translateX(-50%);
}
.rdc .lanterne { position: absolute; bottom: 11cqw; width: 3.8cqw; height: auto; }
.rdc .lanterne.g { left: calc(50% - 17.5cqw); }
.rdc .lanterne.d { left: calc(50% + 13.7cqw); }

.sapin {
  position: absolute;
  right: -5cqw;
  bottom: -3.5cqw;
  width: 21cqw;
  height: auto;
  z-index: 3;
  pointer-events: none;
  filter: drop-shadow(0 4px 6px rgba(0, 0, 0, 0.35));
}
.sapin .lampion { animation: scintille 3.2s ease-in-out infinite; }
.sapin .lampion:nth-of-type(2n) { animation-delay: -1.1s; }
.sapin .lampion:nth-of-type(3n) { animation-delay: -2.2s; }

.bonhomme {
  position: absolute;
  left: 1cqw;
  bottom: -3cqw;
  width: 14cqw;
  height: auto;
  z-index: 3;
  pointer-events: none;
  filter: drop-shadow(0 4px 6px rgba(0, 0, 0, 0.3));
}

.foret {
  position: absolute;
  left: 50%;
  bottom: 22px;
  z-index: -1;
  width: 100vw;
  height: 120px;
  transform: translateX(-50%);
  pointer-events: none;
}

.sol {
  position: relative;
  z-index: 2;
  display: block;
  width: 100vw;
  height: 46px;
  margin: -16px 0 0 calc(50% - 50vw);
}

/* Le jour même */
.du-jour {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 6;
  padding: 18px max(var(--gouttiere), env(safe-area-inset-right)) max(14px, env(safe-area-inset-bottom)) max(var(--gouttiere), env(safe-area-inset-left));
  background: linear-gradient(180deg, rgba(11, 19, 44, 0) 0, rgba(11, 19, 44, 0.94) 18px, #0b132c 100%);
}
.du-jour-interieur {
  display: flex;
  align-items: center;
  gap: 14px;
  max-width: 600px;
  margin: 0 auto;
}
.du-jour-texte { flex: 1; min-width: 0; }
.du-jour h2 {
  margin: 0;
  font-family: var(--titre);
  font-weight: 400;
  font-size: 23px;
  line-height: 1.1;
}
.du-jour p { margin: 3px 0 0; font-size: 14px; color: var(--texte-2); }
.du-jour > .aussi { max-width: 600px; margin: 8px auto 0; }
.du-jour .aussi a { padding: 6px 0; color: var(--lumiere); text-underline-offset: 3px; }
.du-jour .bouton { width: auto; flex: none; min-height: 52px; padding: 0 20px; font-size: 16px; }
.du-jour .prochaine { flex: none; text-align: right; }
.du-jour .prochaine span { display: block; font-size: 13px; color: var(--texte-2); }
.du-jour .prochaine strong { font-size: 18px; font-variant-numeric: tabular-nums; }

body[data-page="calendrier"] { padding-bottom: calc(var(--du-jour-h, 84px) + 12px); }

.bouton {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  min-height: 56px;
  padding: 0 22px;
  border: 0;
  border-radius: 14px;
  font-size: 17px;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  color: #1d1406;
  background: linear-gradient(180deg, #ffd28a 0%, var(--lumiere) 100%);
  box-shadow: 0 6px 16px -6px rgba(0, 0, 0, 0.55), inset 0 1px 0 rgba(255, 255, 255, 0.5);
  transition: transform 0.16s var(--sortie), background 0.2s, color 0.2s;
}
.bouton:active { transform: scale(0.97); }
.bouton[disabled] {
  color: var(--texte-2);
  background: rgba(174, 187, 216, 0.1);
  box-shadow: inset 0 0 0 1px var(--trait);
  cursor: not-allowed;
}
.bouton.discret {
  color: var(--texte);
  background: rgba(174, 187, 216, 0.1);
  box-shadow: inset 0 0 0 1px var(--trait);
}

.legende {
  list-style: none;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px 16px;
  max-width: 600px;
  margin: 26px auto 0;
  padding: 0;
  font-size: 14px;
  color: var(--texte-2);
}
.legende li { display: flex; align-items: center; gap: 9px; }
.mini {
  flex: none;
  width: 14px;
  height: 17px;
  border: 2px solid var(--encadrement);
  border-radius: 2px;
  background: var(--vitre);
}
.mini.fermee { background: repeating-linear-gradient(180deg, var(--volet) 0 2px, var(--volet-lame) 2px 3px); }
.mini.allumee { background: var(--lumiere); }
.mini.froide { background: var(--froide); }

/* Toast */
.toast {
  position: fixed;
  left: 50%;
  bottom: calc(max(24px, env(safe-area-inset-bottom)) + var(--barre-jour));
  z-index: 20;
  width: max-content;
  max-width: calc(100% - 32px);
  padding: 12px 18px;
  border-radius: 12px;
  font-size: 15px;
  color: var(--texte);
  background: #22305a;
  box-shadow: 0 10px 30px -8px rgba(0, 0, 0, 0.6), inset 0 0 0 1px rgba(174, 187, 216, 0.2);
  transform: translate(-50%, 16px);
  opacity: 0;
  pointer-events: none;
  transition: transform 0.35s var(--sortie), opacity 0.25s;
}
.toast.visible { transform: translate(-50%, 0); opacity: 1; }
body[data-page="calendrier"] { --barre-jour: var(--du-jour-h, 84px); }

/* Page d'une fenêtre */
.fenetre-page {
  position: relative;
  z-index: 1;
  max-width: 600px;
  margin: 0 auto;
  padding: 4px max(var(--gouttiere), env(safe-area-inset-right)) 40px max(var(--gouttiere), env(safe-area-inset-left));
}

.vignette {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 10px 0 24px;
}
.mur {
  position: relative;
  container-type: inline-size;
  width: 184px;
  padding: 30px 0 26px;
  display: grid;
  place-items: center;
  border-radius: 3px;
  background:
    linear-gradient(90deg, rgba(255,255,255,.05) 0 9px, transparent 9px calc(100% - 9px), rgba(255,255,255,.05) calc(100% - 9px)),
    var(--pierre);
  box-shadow: 0 24px 40px -24px rgba(0, 0, 0, 0.8);
}
.mur::before {
  content: "";
  position: absolute;
  top: -5px;
  left: -6px;
  right: -6px;
  height: 9px;
  border-radius: 5px;
  background: var(--neige);
  box-shadow: 0 2px 0 rgba(0, 0, 0, 0.2);
}
.mur .guirlande { top: 4px; left: 6%; width: 88%; }
.mur .f { width: 46cqw; cursor: default; view-transition-name: fenetre; }
.mur .f-num { display: none; }
.mur .f-baie { perspective: 70cqw; }
.mur .f[data-etat="juste"] .f-baie { box-shadow: 0 0 9cqw rgba(255, 186, 92, 0.45); }
.mur .f.eclat .f-lumiere { animation: eclat 1.1s var(--sortie); }
@keyframes eclat { 0% { filter: brightness(1); } 30% { filter: brightness(1.45); } 100% { filter: brightness(1); } }

.vignette-date {
  margin: 16px 0 0;
  font-family: var(--titre);
  font-size: 19px;
  letter-spacing: 0.04em;
  color: var(--texte-2);
}
.vignette-date.grande { margin-top: 18px; font-weight: 400; font-size: 30px; line-height: 1.1; letter-spacing: 0.02em; color: var(--texte); }

/* Avant d'ouvrir */
.regles {
  list-style: none;
  max-width: 380px;
  margin: 4px auto 0;
  padding: 0;
  border-radius: 16px;
  background: rgba(174, 187, 216, 0.07);
  box-shadow: inset 0 0 0 1px var(--trait);
}
.regles li { display: flex; align-items: center; gap: 14px; padding: 15px 18px; font-size: 16px; line-height: 1.35; color: var(--texte-2); }
.regles li + li { border-top: 1px solid var(--trait); }
.regles svg { flex: none; width: 24px; height: 24px; color: var(--lumiere); }
.regles strong { font-weight: 600; color: var(--texte); }

/* Pendant le chrono */
.entete-jeu { display: flex; align-items: center; gap: 14px; margin: 6px 0 26px; }
.mur.mini { flex: none; width: 60px; padding: 10px 0 9px; box-shadow: 0 12px 22px -14px rgba(0, 0, 0, 0.8); }
.mur.mini::before { top: -3px; left: -3px; right: -3px; height: 6px; border-radius: 3px; }
.mur.mini .f { width: 62cqw; }
.entete-date { flex: 1; min-width: 0; margin: 0; font-family: var(--titre); font-size: 21px; line-height: 1.15; color: var(--texte-2); }
.en-jeu .question { font-size: 22px; }

.chrono { position: relative; display: grid; place-items: center; flex: none; width: 64px; height: 64px; }
.chrono svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; transform: rotate(-90deg); }
.chrono circle { fill: none; stroke-width: 5; }
.chrono .piste { stroke: rgba(174, 187, 216, 0.16); }
.chrono .arc { stroke: var(--lumiere); stroke-linecap: round; transition: stroke 0.3s; }
.chrono-s { font-size: 23px; font-weight: 700; line-height: 1; font-variant-numeric: tabular-nums; transition: color 0.3s; }
.chrono.presse .arc { stroke: var(--urgence); }
.chrono.presse .chrono-s { color: var(--urgence); }
.chrono-s.bat { animation: bat 0.45s var(--sortie); }
.chrono.arrete { opacity: 0.4; transition: opacity 0.4s; }
@keyframes bat { from { transform: scale(1.25); } to { transform: scale(1); } }

.etincelle {
  position: absolute;
  z-index: 8;
  width: 5px;
  height: 5px;
  margin: -2.5px 0 0 -2.5px;
  border-radius: 50%;
  background: var(--lumiere-vive);
  box-shadow: 0 0 6px rgba(255, 198, 110, 0.8);
  pointer-events: none;
}

/* La fenêtre passe d'une taille à l'autre sans coupure */
.mur { view-transition-name: mur; }
::view-transition-group(mur),
::view-transition-group(fenetre) { animation-duration: 0.5s; animation-timing-function: var(--sortie); }

.question {
  margin: 0;
  font-size: 23px;
  font-weight: 600;
  line-height: 1.3;
  letter-spacing: -0.01em;
  text-wrap: balance;
}

.reponses { display: grid; gap: 10px; margin: 22px 0 0; }
.reponses.vf { grid-template-columns: 1fr 1fr; }

.choix {
  position: relative;
  display: flex;
  align-items: center;
  gap: 14px;
  min-height: 58px;
  padding: 12px 16px;
  border: 0;
  border-radius: 14px;
  text-align: left;
  font-size: 17px;
  line-height: 1.3;
  cursor: pointer;
  background: rgba(174, 187, 216, 0.07);
  box-shadow: inset 0 0 0 1px var(--trait);
  transition: background 0.2s, box-shadow 0.2s, opacity 0.3s, transform 0.16s var(--sortie);
}
.choix:active:not([disabled]) { transform: scale(0.985); }
.reponses.vf .choix { justify-content: center; min-height: 76px; font-size: 19px; font-weight: 600; }
.choix .lettre {
  display: grid;
  place-items: center;
  flex: none;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  font-size: 14px;
  font-weight: 600;
  color: var(--texte-2);
  box-shadow: inset 0 0 0 1px var(--trait);
  transition: background 0.2s, color 0.2s, box-shadow 0.2s;
}
.choix .marque { width: 22px; height: 22px; margin-left: auto; flex: none; }
.reponses.vf .choix .marque { position: absolute; right: 12px; top: 12px; width: 18px; height: 18px; }
@media (hover: hover) { .choix:not([disabled]):hover { background: rgba(174, 187, 216, 0.12); } }

.choix[aria-pressed="true"] { background: rgba(255, 198, 110, 0.12); box-shadow: inset 0 0 0 2px var(--lumiere); }
.choix[aria-pressed="true"] .lettre { background: var(--lumiere); color: #1d1406; box-shadow: none; }
.choix[disabled] { cursor: default; }
.reponses.corrigee .choix { opacity: 0.5; }
.reponses.corrigee .choix.bonne { opacity: 1; background: rgba(255, 198, 110, 0.14); box-shadow: inset 0 0 0 2px var(--lumiere); }
.reponses.corrigee .choix.bonne .lettre { background: var(--lumiere); color: #1d1406; box-shadow: none; }
.reponses.corrigee .choix.bonne .marque { color: var(--lumiere); }
.reponses.corrigee .choix.fausse { opacity: 1; background: rgba(217, 154, 143, 0.08); box-shadow: inset 0 0 0 1.5px rgba(217, 154, 143, 0.6); }
.reponses.corrigee .choix.fausse .lettre { color: var(--rate); box-shadow: inset 0 0 0 1px rgba(217, 154, 143, 0.6); }
.reponses.corrigee .choix.fausse .marque { color: var(--rate); }

.nombre {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 10px;
  margin: 26px 0 0;
  padding: 16px;
  border-radius: 16px;
  background: rgba(174, 187, 216, 0.07);
  box-shadow: inset 0 0 0 1px var(--trait);
  cursor: text;
  transition: box-shadow 0.2s;
}
.nombre:focus-within { box-shadow: inset 0 0 0 2px var(--lumiere); }
.nombre input {
  width: 3ch;
  min-width: 0;
  padding: 0;
  border: 0;
  outline: 0;
  font-size: 40px;
  font-weight: 600;
  text-align: center;
  font-variant-numeric: tabular-nums;
  background: none;
  caret-color: var(--lumiere);
}
.nombre input::placeholder { color: rgba(174, 187, 216, 0.45); }
.nombre .unite { font-size: 18px; color: var(--texte-2); }
.nombre.juste { box-shadow: inset 0 0 0 2px var(--lumiere); }
.nombre.fausse { box-shadow: inset 0 0 0 1.5px rgba(217, 154, 143, 0.6); }
.nombre-aide { margin: 10px 0 0; text-align: center; font-size: 14px; color: var(--texte-2); }

.barre-bas {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 6;
  padding: 22px max(var(--gouttiere), env(safe-area-inset-right)) max(14px, env(safe-area-inset-bottom)) max(var(--gouttiere), env(safe-area-inset-left));
  background: linear-gradient(180deg, rgba(11, 19, 44, 0) 0, rgba(11, 19, 44, 0.94) 22px, #0b132c 100%);
}
.barre-bas > div { max-width: 600px; margin: 0 auto; }
.barre-bas p { margin: 8px 0 0; text-align: center; font-size: 13.5px; color: var(--texte-2); }
body.avec-barre-bas { padding-bottom: calc(var(--barre-h, 124px) + 8px); --barre-jour: var(--barre-h, 124px); }

.verdict { margin-top: 30px; }
.verdict h2 { margin: 0; font-family: var(--titre); font-weight: 400; font-size: 32px; line-height: 1.1; }
.verdict.juste h2 { color: var(--lumiere); }
.verdict .bonne-reponse { margin: 8px 0 0; font-size: 17px; }
.verdict .explication { margin: 12px 0 0; color: var(--texte-2); max-width: 60ch; }
.verdict dl {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1px;
  margin: 24px 0 0;
  border-radius: 14px;
  overflow: hidden;
  background: var(--trait);
}
.verdict dl div { padding: 14px 16px; background: #111c3a; }
.verdict dt { font-size: 13.5px; color: var(--texte-2); }
.verdict dd { margin: 2px 0 0; font-size: 20px; font-weight: 600; font-variant-numeric: tabular-nums; }
.verdict .bouton { margin-top: 22px; }

.message { text-align: center; }
.message h1 { margin: 0; font-family: var(--titre); font-weight: 400; font-size: 32px; line-height: 1.1; }
.message p { margin: 10px auto 0; max-width: 34ch; color: var(--texte-2); }
.message .bouton { margin-top: 26px; }

.note-manquee {
  margin: 0;
  padding: 12px 14px;
  border-radius: 12px;
  font-size: 15px;
  color: var(--texte-2);
  background: rgba(174, 187, 216, 0.07);
}

/* Inscription */
.accueil {
  position: relative;
  z-index: 1;
  max-width: 440px;
  margin: 0 auto;
  padding: max(24px, env(safe-area-inset-top)) max(var(--gouttiere), env(safe-area-inset-right)) 24px max(var(--gouttiere), env(safe-area-inset-left));
}
.accueil-batiment { width: min(100%, 360px); }
.accueil-batiment .fenetres { padding-bottom: 7cqw; }
.accueil-batiment .sol-court { display: block; width: calc(100% + 24px); height: 30px; margin: -12px -12px 0; position: relative; z-index: 2; }
.accueil h1 {
  margin: 20px 0 0;
  font-family: var(--titre);
  font-weight: 400;
  font-size: 34px;
  line-height: 1.08;
  text-align: center;
}
.accueil .chapeau { margin: 10px auto 0; max-width: 30ch; text-align: center; color: var(--texte-2); text-wrap: balance; }

.formulaire { display: grid; gap: 18px; margin-top: 28px; }
.champ { display: grid; gap: 7px; }
.champ[hidden] { display: none; }
.champ label { font-size: 15px; font-weight: 600; }
.champ input[type="text"] {
  width: 100%;
  min-height: 52px;
  padding: 0 14px;
  border: 0;
  border-radius: 12px;
  font-size: 17px;
  background: rgba(174, 187, 216, 0.08);
  box-shadow: inset 0 0 0 1px var(--trait);
  transition: box-shadow 0.2s;
}
.champ input[type="text"]:focus { outline: 0; box-shadow: inset 0 0 0 2px var(--lumiere); }
.champ input::placeholder { color: rgba(174, 187, 216, 0.5); }
.champ .aide { margin: 0; font-size: 14px; color: var(--texte-2); }
.champ[data-erreur] input[type="text"], .champ[data-erreur] .code .case, .champ[data-erreur] .pelotons label { box-shadow: inset 0 0 0 1.5px var(--rate); }
.champ .erreur { margin: 0; font-size: 14px; color: var(--rate); }

.pelotons { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 0; padding: 0; border: 0; }
.pelotons legend { padding: 0; margin-bottom: 7px; font-size: 15px; font-weight: 600; }
.pelotons label {
  display: grid;
  place-items: center;
  min-height: 52px;
  border-radius: 12px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  background: rgba(174, 187, 216, 0.08);
  box-shadow: inset 0 0 0 1px var(--trait);
  transition: background 0.2s, box-shadow 0.2s, color 0.2s;
}
.pelotons input { position: absolute; opacity: 0; pointer-events: none; }
.pelotons input:checked + label { color: #1d1406; background: var(--lumiere); box-shadow: none; }
.pelotons input:focus-visible + label { outline: 2px solid var(--lumiere); outline-offset: 3px; }
.pelotons sup { font-size: 0.65em; }

.code { position: relative; display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.code input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; font-size: 16px; caret-color: transparent; }
.code .case {
  display: grid;
  place-items: center;
  height: 60px;
  border-radius: 12px;
  background: rgba(174, 187, 216, 0.08);
  box-shadow: inset 0 0 0 1px var(--trait);
  transition: box-shadow 0.2s;
}
.code .case.active { box-shadow: inset 0 0 0 2px var(--lumiere); }
.code .case.pleine::after { content: ""; width: 12px; height: 12px; border-radius: 50%; background: var(--texte); }

.bascule {
  justify-self: center;
  min-height: 44px;
  padding: 0 8px;
  border: 0;
  background: none;
  font-size: 15px;
  color: var(--texte-2);
  cursor: pointer;
}
.bascule strong { color: var(--lumiere); font-weight: 600; }

/* Panneau de la maquette, absent du vrai site */
.maquette-pastille {
  position: relative;
  z-index: 4;
  display: block;
  min-height: 36px;
  margin: 28px auto 20px;
  padding: 0 14px;
  border: 1px dashed rgba(174, 187, 216, 0.55);
  border-radius: 999px;
  font-size: 12.5px;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--texte-2);
  background: rgba(7, 15, 38, 0.85);
  cursor: pointer;
}
.maquette-panneau {
  position: fixed;
  left: 50%;
  bottom: max(16px, env(safe-area-inset-bottom));
  z-index: 40;
  width: min(360px, calc(100% - 24px));
  padding: 16px;
  border: 1px dashed rgba(174, 187, 216, 0.55);
  border-radius: 14px;
  font-size: 14px;
  background: #0b1330;
  box-shadow: 0 18px 40px -10px rgba(0, 0, 0, 0.7);
  transform: translateX(-50%);
}
.maquette-panneau[hidden] { display: none; }
.maquette-panneau p { margin: 0; color: var(--texte-2); font-size: 13px; }
.maquette-panneau .ligne { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 12px; }
.maquette-panneau .ligne span { font-weight: 600; }
.maquette-panneau button {
  min-height: 40px;
  padding: 0 12px;
  border: 0;
  border-radius: 10px;
  font-size: 14px;
  background: rgba(174, 187, 216, 0.12);
  cursor: pointer;
}
.maquette-panneau .pas { width: 40px; padding: 0; font-size: 18px; }
.maquette-panneau .grille { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 12px; }
.maquette-panneau output { min-width: 112px; text-align: center; font-variant-numeric: tabular-nums; }
.maquette-panneau .fermer { position: absolute; top: 8px; right: 8px; width: 36px; min-height: 36px; padding: 0; font-size: 18px; }

/* Tablette */
@media (min-width: 700px) {
  .lune { display: block; }
  .foret { height: 150px; }
}

/* Ordinateur */
@media (min-width: 1100px) {
  :root { --largeur-batiment: max(300px, min(560px, calc((100dvh - 130px) / 1.47))); }
  .barre { padding-top: 18px; }
  .barre-titre { font-size: 28px; }
  body[data-page="calendrier"] { padding-bottom: 0; --barre-jour: 0px; }
  .page {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
    grid-template-areas: "legende scene jour";
    align-items: end;
    min-height: calc(100dvh - 70px);
  }
  /* La scène prend la largeur du bâtiment : le sol, large comme l'écran, ne doit pas élargir sa colonne. */
  .scene { grid-area: scene; margin-top: 0; width: var(--largeur-batiment); }
  .batiment { width: var(--largeur-batiment); }
  .legende {
    grid-area: legende;
    align-self: center;
    justify-self: end;
    grid-template-columns: 1fr;
    margin: 0 64px 120px 0;
  }
  .du-jour {
    grid-area: jour;
    position: static;
    align-self: center;
    justify-self: start;
    width: min(320px, calc(100% - 64px));
    margin: 0 0 120px 64px;
    padding: 0;
    background: none;
  }
  .du-jour-interieur { display: block; }
  .du-jour h2 { font-size: 36px; }
  .du-jour p { margin-top: 8px; font-size: 16px; }
  .du-jour .bouton { width: 100%; margin-top: 20px; min-height: 56px; font-size: 17px; }
  .du-jour .prochaine { margin-top: 20px; text-align: left; }
  .du-jour .prochaine strong { font-size: 22px; }
  .du-jour > .aussi { margin-top: 18px; }
  .foret { height: 190px; }
  .lune { top: 90px; right: 12%; width: 76px; height: 76px; }
  .maquette-pastille { position: fixed; left: 16px; bottom: 16px; margin: 0; }
  .question { font-size: 27px; }
  .fenetre-page { padding-top: 16px; }
}

/* Téléphone couché : trop peu de hauteur pour une barre fixe, la barre du jour suit le bâtiment */
@media (orientation: landscape) and (max-height: 500px) and (max-width: 1099px) {
  body[data-page="calendrier"] { padding-bottom: 24px; --barre-jour: 0px; }
  .du-jour { position: static; padding: 18px 0 0; background: none; }
  .batiment { width: min(100%, 440px); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

.chargement {
  margin: 22vh auto 0;
  text-align: center;
  color: var(--texte-2);
}
