/* ==========================================================
   Carte de mariage numérique — Laura & Julien
   Enveloppe (design 1) → carte qui sort par le haut (design 2)
   → retournement (design 3)
   ========================================================== */

:root {
  --ink: #3a2a20;
  --ink-soft: #6f5646;
  --paper: #fbf8f3;
  --bg-hi: #f5f0e9;
  --bg-mid: #e6ddd1;
  --bg-lo: #cdbfae;

  /* 1 unité de hauteur d'écran : dvh si dispo (barres mobiles), sinon vh */
  --vh: 1vh;

  /* Format A6 du PDF : 297.75 × 419.25 pt */
  --ratio: 1.40806;

  --env-w: min(72vw, calc(var(--vh) * 42), 440px);
  --env-h: calc(var(--env-w) * var(--ratio));
  --env-top: calc(50% - var(--env-h) / 2 - 18px);

  /* la carte est un peu plus petite que l'enveloppe */
  --card-w: calc(var(--env-w) * .92);
  --card-h: calc(var(--card-w) * var(--ratio));

  /* carte présentée en grand */
  --pw: min(calc(100vw - 32px), calc((var(--vh) * 100 - 132px) / var(--ratio)), 620px);
}
@supports (height: 1dvh) {
  :root { --vh: 1dvh; }
}

* { box-sizing: border-box; }

html, body { margin: 0; height: 100%; }

body {
  overflow: hidden;
  color: var(--ink);
  font-family: 'Cormorant Garamond', Georgia, serif;
  background:
    radial-gradient(120% 85% at 50% 38%, var(--bg-hi) 0%, var(--bg-mid) 55%, var(--bg-lo) 100%);
  -webkit-tap-highlight-color: transparent;
}

/* grain de papier sur le fond */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: .5;
  mix-blend-mode: multiply;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .35 0 0 0 0 .26 0 0 0 0 .18 0 0 0 .22 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

button {
  font: inherit;
  color: inherit;
  border: 0;
  padding: 0;
  background: none;
}

.stage {
  position: fixed;
  inset: 0;
  overflow: hidden;
}

.env-group {
  position: absolute;
  inset: 0;
  transition: translate .45s cubic-bezier(.2, .7, .2, 1);
}

/* ---------- Enveloppe ---------- */

.env-rear,
.env-front {
  position: absolute;
  width: var(--env-w);
  height: var(--env-h);
  left: calc(50% - var(--env-w) / 2);
  top: var(--env-top);
}

.env-rear { z-index: 1; }

.flap {
  position: absolute;
  left: 0;
  bottom: 100%;
  width: 100%;
  height: 36%;
  display: block;
  overflow: visible;
  transform-origin: 50% 100%;
  /* rabat replié derrière l'enveloppe */
  transform: perspective(1000px) rotateX(180deg);
}

.env-front {
  z-index: 3;
  overflow: hidden;
  border-radius: 3px;
  background: var(--paper);
  cursor: pointer;
  box-shadow:
    0 1px 1px rgba(58, 42, 32, .08),
    0 18px 36px -14px rgba(58, 42, 32, .45),
    0 42px 80px -30px rgba(58, 42, 32, .35);
  transition: box-shadow .45s cubic-bezier(.2, .7, .2, 1);
}
.env-front img {
  display: block;
  width: 100%;
  height: 100%;
  mix-blend-mode: multiply; /* le blanc du design prend la teinte du papier */
}
/* lumière + grain du papier de l'enveloppe */
.env-front::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(165deg, rgba(255, 255, 255, .35) 0%, rgba(255, 255, 255, 0) 38%, rgba(58, 42, 32, .05) 100%),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='1.1' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .4 0 0 0 0 .3 0 0 0 0 .22 0 0 0 .09 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  box-shadow: inset 0 0 0 1px rgba(58, 42, 32, .06);
  border-radius: inherit;
}

/* ---------- Carte ---------- */

.card {
  position: absolute;
  z-index: 2;
  width: var(--card-w);
  height: var(--card-h);
  left: calc(50% - var(--card-w) / 2);
  top: calc(var(--env-top) + var(--env-h) * .97 - var(--card-h));
  transform-origin: 0 0;
  perspective: 1800px;
  pointer-events: none;
  outline: none;
}

.card-tilt,
.card-inner,
.face {
  position: absolute;
  inset: 0;
  display: block;
}

.card-tilt {
  transform-style: preserve-3d;
  transform: rotateX(var(--rx, 0deg)) rotateY(var(--ry, 0deg));
  transition: transform .5s cubic-bezier(.2, .7, .2, 1);
}

.card-inner {
  transform-style: preserve-3d;
  transition: transform 1s cubic-bezier(.45, .05, .2, 1);
}
.card.flipped .card-inner { transform: rotateY(180deg); }

.face {
  overflow: hidden;
  border-radius: 4px;
  background: #fff;
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
  box-shadow:
    0 1px 2px rgba(40, 25, 15, .18),
    0 24px 50px -18px rgba(40, 25, 15, .5);
}
.face.front { transform: rotateY(0deg); }
.face.back  { transform: rotateY(180deg); }
.face img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  -webkit-user-drag: none;
  user-select: none;
}

/* ---------- États ---------- */

body[data-state="loading"] .env-group { visibility: hidden; }

body[data-state="closed"] .env-group {
  animation:
    env-in 1.1s cubic-bezier(.2, .7, .2, 1) both,
    float 6s ease-in-out 1.1s infinite;
}

@media (hover: hover) {
  body[data-state="closed"] .env-group:has(.env-front:hover) { translate: 0 -6px; }
  body[data-state="closed"] .env-front:hover {
    box-shadow:
      0 1px 1px rgba(58, 42, 32, .08),
      0 26px 44px -14px rgba(58, 42, 32, .5),
      0 56px 90px -30px rgba(58, 42, 32, .38);
  }
}

body:not([data-state="closed"]) .env-front { cursor: default; }

/* carte sortie : grande et centrée */
body[data-state="out"] .card,
body[data-state="presented"] .card {
  z-index: 5;
  width: var(--pw);
  height: calc(var(--pw) * var(--ratio));
  left: calc(50% - var(--pw) / 2);
  top: calc(50% - var(--pw) * var(--ratio) / 2 - 14px);
}

body[data-state="presented"] .card {
  pointer-events: auto;
  cursor: pointer;
}
body[data-state="presented"] .env-rear,
body[data-state="presented"] .env-front { visibility: hidden; }

.card:focus-visible .face,
.env-front:focus-visible {
  outline: 2px solid var(--ink-soft);
  outline-offset: 4px;
}

/* reflet qui suit la souris sur la carte (ordinateur uniquement) */
@media (hover: hover) and (pointer: fine) {
  .face::after {
    content: "";
    position: absolute;
    inset: 0;
    pointer-events: none;
    background: radial-gradient(circle at var(--mx, 50%) var(--my, 30%), rgba(255, 255, 255, .32), rgba(255, 255, 255, 0) 55%);
    mix-blend-mode: soft-light;
    opacity: 0;
    transition: opacity .4s;
  }
  .face.back::after {
    background: radial-gradient(circle at var(--mxb, 50%) var(--my, 30%), rgba(255, 255, 255, .5), rgba(255, 255, 255, 0) 55%);
  }
  body[data-state="presented"] .card:hover .face::after { opacity: 1; }
}

/* ---------- Indication + bouton rejouer ---------- */

.hint {
  position: fixed;
  z-index: 10;
  left: 0;
  right: 0;
  bottom: max(18px, env(safe-area-inset-bottom));
  margin: 0;
  text-align: center;
  font-style: italic;
  font-size: clamp(17px, calc(var(--vh) * 2.3), 21px);
  letter-spacing: .04em;
  color: var(--ink-soft);
  pointer-events: none;
  opacity: 0;
  transform: translateY(6px);
  transition: opacity .5s, transform .5s;
}
.hint.show { opacity: 1; transform: none; }
.hint.show::before,
.hint.show::after {
  content: "";
  display: inline-block;
  width: 26px;
  height: 1px;
  margin: 0 12px;
  vertical-align: middle;
  background: currentColor;
  opacity: .45;
}

.replay {
  position: fixed;
  z-index: 10;
  top: max(14px, env(safe-area-inset-top));
  right: 16px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px 8px 11px;
  border: 1px solid rgba(58, 42, 32, .16);
  border-radius: 999px;
  background: rgba(255, 255, 255, .4);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  font-style: italic;
  font-size: 16px;
  font-weight: 500;
  color: var(--ink-soft);
  cursor: pointer;
  opacity: 0;
  visibility: hidden;
  transition: opacity .5s, visibility .5s, background .3s;
}
.replay svg { width: 16px; height: 16px; }
.replay:hover { background: rgba(255, 255, 255, .7); }
.replay:focus-visible { outline: 2px solid var(--ink-soft); outline-offset: 3px; }
body[data-state="presented"] .replay { opacity: 1; visibility: visible; }

/* ---------- Animations ---------- */

@keyframes env-in {
  from { opacity: 0; transform: translateY(28px) rotate(-1.5deg) scale(.97); }
  to   { opacity: 1; transform: none; }
}
@keyframes float {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(-7px); }
}

@media (prefers-reduced-motion: reduce) {
  body[data-state="closed"] .env-group { animation: env-in .4s ease-out both; }
  .card-inner { transition-duration: .45s; }
  .card-tilt { transition: none; }
}

/* ---------- Terrain de basket ---------- */

.court {
  position: fixed;
  inset: 0;
  z-index: 0;
}
.court svg { display: block; width: 100%; height: 100%; }
.stage { z-index: 1; }
body { background: #1f130e; }
body::before { z-index: 0; }

.hint {
  color: #fbf8f3;
  text-shadow: 0 1px 6px rgba(30, 18, 10, .55);
}

.court-logo { transition: opacity .9s ease; }
body:not([data-state="loading"]) .court-logo { opacity: 0; }

/* ---------- Enveloppe blanche, date en relief ---------- */

.env-front { background: #fdfcfa; }
.emboss {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: calc(var(--env-w) * .02);
  font-family: 'Bodoni Moda', Didot, Georgia, serif;
  font-weight: 500;
  font-size: calc(var(--env-w) * .19);
  line-height: .92;
  letter-spacing: .04em;
  color: #fdfcfa;
  /* gaufrage : lumière en haut à gauche, ombre en bas à droite */
  text-shadow:
    -1px -1px 1px rgba(255, 255, 255, .95),
    1px 1px 1px rgba(90, 70, 55, .22),
    2px 3px 5px rgba(90, 70, 55, .14);
}

/* ---------- Enveloppe marron (même teinte que le terrain) ---------- */

.env-front { background: #1f130e; }
.env-front::after {
  background: linear-gradient(165deg, rgba(255, 255, 255, .06) 0%, rgba(255, 255, 255, 0) 40%, rgba(0, 0, 0, .12) 100%);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .05);
}
.emboss {
  color: #1f130e;
  text-shadow:
    -1px -1px 1px rgba(255, 235, 220, .16),
    1px 1px 1px rgba(0, 0, 0, .7),
    2px 3px 6px rgba(0, 0, 0, .45);
}

/* SAVE THE DATE couleur crème des lignes du terrain */
.emboss {
  color: #efe1d8;
  text-shadow:
    -1px -1px 0 rgba(255, 255, 255, .35),
    1px 1px 1px rgba(0, 0, 0, .6),
    2px 3px 6px rgba(0, 0, 0, .4);
}

/* ---------- Billet de match (paysage, rangé à la verticale dans l'enveloppe) ---------- */

:root {
  --t-ratio: 3.078;
  --tw: calc(var(--env-h) * .92);            /* longueur du billet = hauteur utile de l'enveloppe */
  --th: calc(var(--tw) / var(--t-ratio));
  --ptw: min(calc(100vw - 32px), calc((var(--vh) * 100 - 140px) * var(--t-ratio)), 980px);
}
.card {
  width: var(--tw);
  height: var(--th);
  left: calc(50% - var(--tw) / 2);
  top: calc(var(--env-top) + var(--env-h) * .51 - var(--th) / 2);
  rotate: -90deg;
  transform-origin: 50% 50%;
}
body[data-state="out"] .card,
body[data-state="presented"] .card {
  width: var(--ptw);
  height: calc(var(--ptw) / var(--t-ratio));
  left: calc(50% - var(--ptw) / 2);
  top: calc(50% - var(--ptw) / var(--t-ratio) / 2 - 14px);
  rotate: none;
}
.face {
  background: transparent;
  box-shadow: none;
  border-radius: 0;
}
.face.front img {
  object-fit: contain;
  filter: drop-shadow(0 18px 24px rgba(0, 0, 0, .45)) drop-shadow(0 2px 3px rgba(0, 0, 0, .3));
}
.face.back img { object-fit: contain; }

.replay { color: #efe1d8; background: rgba(239, 225, 216, .08); border-color: rgba(239, 225, 216, .25); }
.replay:hover { background: rgba(239, 225, 216, .18); }

/* ---------- Billet déchirable ---------- */

.piece { position: absolute; inset: 0; display: block; }
.face.front .piece img {
  display: block; width: 100%; height: 100%; object-fit: contain;
  filter: drop-shadow(0 18px 24px rgba(0, 0, 0, .45)) drop-shadow(0 2px 3px rgba(0, 0, 0, .3));
}
.piece.stub { transform-origin: 85.45% 0; }
.face.back { display: none; }

/* ---------- Écran géant ---------- */

:root {
  --jw: min(calc(100vw - 48px), calc((var(--vh) * 100 - 170px) * 1.414), 1100px);
}
.jumbo {
  position: fixed;
  z-index: 8;
  left: calc(50% - var(--jw) / 2 - 14px);
  top: max(54px, calc(50% - var(--jw) / 1.414 / 2 - 40px));
  width: calc(var(--jw) + 28px);
  visibility: hidden;
  pointer-events: none;
}
body[data-state="screen"] .jumbo { visibility: visible; }
.jumbo-cable {
  position: absolute;
  bottom: 100%;
  width: 2px;
  height: 100vh;
  background: linear-gradient(#0b0705, #4a3a30);
}
.jumbo-cable.left { left: 18%; }
.jumbo-cable.right { right: 18%; }
.jumbo-box {
  position: relative;
  padding: 14px 14px 0;
  border-radius: 10px;
  background: linear-gradient(180deg, #2b2420, #120d0a);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, .12),
    0 0 0 1px #000,
    0 30px 70px -10px rgba(0, 0, 0, .8),
    0 0 120px rgba(239, 225, 216, .1);
}
.jumbo-screen {
  position: relative;
  overflow: hidden;
  aspect-ratio: 1800 / 1273;
  background: #050302;
  border-radius: 3px;
}
.jumbo-screen img { display: block; width: 100%; height: 100%; }
/* trame LED + reflet de vitre */
.jumbo-screen::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(165deg, rgba(255, 255, 255, .07), rgba(255, 255, 255, 0) 35%),
    repeating-linear-gradient(0deg, rgba(0, 0, 0, .22) 0 1px, transparent 1px 3px),
    repeating-linear-gradient(90deg, rgba(0, 0, 0, .12) 0 1px, transparent 1px 3px);
}
.jumbo-ribbon {
  overflow: hidden;
  white-space: nowrap;
  margin: 10px -14px 0;
  padding: 7px 0 9px;
  border-top: 1px solid rgba(255, 255, 255, .06);
  font: 600 clamp(11px, 1.4vw, 15px)/1 'Courier New', monospace;
  letter-spacing: .3em;
  color: #ffb877;
  text-shadow: 0 0 6px rgba(255, 150, 70, .8);
}
.jumbo-ribbon span { display: inline-block; padding-left: 100%; animation: ribbon 24s linear infinite; }
@keyframes ribbon { to { transform: translateX(-100%); } }

body[data-state="screen"] .replay { opacity: 1; visibility: visible; }

body[data-state="tearing"] .env-rear,
body[data-state="tearing"] .env-front,
body[data-state="screen"] .env-rear,
body[data-state="screen"] .env-front,
body[data-state="screen"] .card { visibility: hidden; }
body[data-state="tearing"] .card { z-index: 5; }
body[data-state="tearing"] .card {
  width: var(--ptw);
  height: calc(var(--ptw) / var(--t-ratio));
  left: calc(50% - var(--ptw) / 2);
  top: calc(50% - var(--ptw) / var(--t-ratio) / 2 - 14px);
  rotate: none;
}

/* ---------- Écran géant cliquable ---------- */
body[data-state="screen"] .jumbo { pointer-events: auto; cursor: pointer; }

/* ---------- Vestiaires ---------- */

.locker-room, .lr-doors {
  position: fixed;
  inset: 0;
  visibility: hidden;
}
.locker-room { z-index: 6; overflow: hidden; background: #160d09; }
.lr-doors { z-index: 9; perspective: 1400px; }
body[data-state="doors"] .lr-doors,
body[data-state="doors"] .locker-room,
body[data-state="lockers"] .locker-room { visibility: visible; }
body[data-state="doors"] .jumbo,
body[data-state="lockers"] .jumbo,
body[data-state="doors"] .card,
body[data-state="lockers"] .card { visibility: hidden; }

/* mur + rangée de casiers */
.lr-wall {
  position: absolute;
  inset: 0 0 18% 0;
  background:
    radial-gradient(70% 60% at 50% 30%, rgba(255, 214, 170, .14), transparent 70%),
    linear-gradient(#24160f, #1a100b);
}
.lr-lockers {
  position: absolute;
  left: -2%;
  right: -2%;
  bottom: 0;
  height: 78%;
  display: flex;
  gap: 4px;
  padding: 0 4px;
}
.lr-locker {
  position: relative;
  flex: 1;
  min-width: 46px;
  border-radius: 3px 3px 0 0;
  background: linear-gradient(90deg, #3a2519, #4a3022 45%, #3a2519);
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .5), inset 0 2px 0 rgba(255, 255, 255, .05);
}
/* aérations */
.lr-locker::before {
  content: "";
  position: absolute;
  left: 22%;
  right: 22%;
  top: 7%;
  height: 9%;
  background: repeating-linear-gradient(#120b07 0 2px, transparent 2px 6px);
  opacity: .8;
}
/* poignée */
.lr-locker::after {
  content: "";
  position: absolute;
  right: 14%;
  top: 46%;
  width: 4px;
  height: 22px;
  border-radius: 2px;
  background: linear-gradient(#a98c76, #5b4434);
}
.lr-plate {
  position: absolute;
  left: 50%;
  top: 22%;
  translate: -50% 0;
  padding: 3px 6px;
  border-radius: 2px;
  background: #efe1d8;
  color: #1f130e;
  font: 600 9px/1 'Bodoni Moda', Georgia, serif;
  letter-spacing: .12em;
  white-space: nowrap;
}

.lr-floor {
  position: absolute;
  inset: 82% 0 0 0;
  background: linear-gradient(#2a1a12, #0e0806);
  box-shadow: 0 -2px 0 rgba(255, 255, 255, .04);
}

/* tableau du coach avec le design */
.lr-board {
  --bw: min(calc(100vw - 48px), calc((var(--vh) * 100 - 250px) * 1.414), 74vw, 820px);
  position: absolute;
  left: calc(50% - var(--bw) / 2);
  top: max(56px, calc(46% - var(--bw) / 1.414 / 2));
  width: var(--bw);
  padding: 8px;
  border-radius: 4px;
  background: linear-gradient(#5a3e2c, #3a2519);
  box-shadow: 0 30px 60px -12px rgba(0, 0, 0, .85), 0 0 0 1px #000, 0 0 160px rgba(255, 214, 170, .12);
}
.lr-board img { display: block; width: 100%; height: auto; border-radius: 2px; }

/* banc en bois au premier plan */
.lr-bench {
  position: absolute;
  left: 8%;
  right: 8%;
  bottom: 5%;
  height: 4.5%;
  border-radius: 4px;
  background: linear-gradient(#b07a4f, #7a4f31);
  box-shadow: 0 18px 30px rgba(0, 0, 0, .7), inset 0 2px 0 rgba(255, 255, 255, .2);
}
.lr-bench span::before,
.lr-bench span::after {
  content: "";
  position: absolute;
  top: 100%;
  width: 10px;
  height: 120%;
  background: #2a1a12;
}
.lr-bench span::before { left: 10%; }
.lr-bench span::after { right: 10%; }

/* portes battantes */
.lr-door {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 50%;
  background:
    linear-gradient(90deg, rgba(0, 0, 0, .25), transparent 12%, transparent 88%, rgba(0, 0, 0, .25)),
    linear-gradient(#3b2519, #2a1a12);
  box-shadow: inset 0 0 0 2px rgba(0, 0, 0, .6);
}
.lr-door.left { left: 0; transform-origin: 0 50%; }
.lr-door.right { right: 0; transform-origin: 100% 50%; }
.lr-window {
  position: absolute;
  top: 26%;
  left: 50%;
  translate: -50% 0;
  width: min(22vw, 120px);
  aspect-ratio: 1;
  border-radius: 50%;
  border: 6px solid #6b4a36;
  background: radial-gradient(circle at 35% 35%, rgba(255, 220, 180, .35), rgba(20, 12, 8, .9) 70%);
}
.lr-handle {
  position: absolute;
  top: 54%;
  width: 14px;
  height: 90px;
  border-radius: 7px;
  background: linear-gradient(90deg, #8a6c56, #c9a98a, #6b4a36);
}
.lr-door.left .lr-handle { right: 8%; }
.lr-door.right .lr-handle { left: 8%; }
.lr-sign {
  position: absolute;
  top: 9%;
  left: 50%;
  translate: -50% 0;
  padding: 10px 22px 9px;
  border: 1px solid rgba(239, 225, 216, .5);
  background: #1f130e;
  color: #efe1d8;
  text-align: center;
  font: 500 clamp(16px, 2.6vw, 26px)/1 'Bodoni Moda', Georgia, serif;
  letter-spacing: .3em;
  box-shadow: 0 10px 30px rgba(0, 0, 0, .6);
}
.lr-sign small {
  display: block;
  margin-top: 6px;
  font: italic 400 clamp(11px, 1.4vw, 14px)/1 'Cormorant Garamond', Georgia, serif;
  letter-spacing: .12em;
  opacity: .8;
}

body[data-state="lockers"] .replay { opacity: 1; visibility: visible; }

/* l'écran reste visible pendant qu'il remonte */
body[data-state="leaving"] .jumbo { visibility: visible; }

/* ---------- Programme papier ---------- */

.program {
  --pgw: min(calc(100vw - 48px), calc((var(--vh) * 100 - 170px) * 1.414), 860px);
  position: fixed;
  z-index: 7;
  left: calc(50% - var(--pgw) / 2);
  top: calc(50% - var(--pgw) / 1.414 / 2 - 14px);
  width: var(--pgw);
  aspect-ratio: 1800 / 1273;
  perspective: 2200px;
  rotate: -1.5deg;
  visibility: hidden;
}
body[data-state="program-in"] .program,
body[data-state="program"] .program,
body[data-state="to-lockers"] .program { visibility: visible; }
body[data-state="program"] .program { cursor: pointer; }
body[data-state="program-in"] .card,
body[data-state="program"] .card,
body[data-state="to-lockers"] .card,
body[data-state="leaving"] .card { visibility: hidden; }

.prog-page,
.prog-face {
  position: absolute;
  inset: 0;
  border-radius: 2px 6px 6px 2px;
  overflow: hidden;
}
.prog-page {
  box-shadow: 0 30px 60px -14px rgba(0, 0, 0, .85), 0 2px 4px rgba(0, 0, 0, .5);
}
.prog-page img { display: block; width: 100%; height: 100%; }
/* grain du papier + ombre de la reliure */
.prog-page::after,
.prog-face::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(90deg, rgba(0, 0, 0, .45), rgba(0, 0, 0, 0) 6%, rgba(255, 255, 255, .03) 50%, rgba(0, 0, 0, .12)),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='1' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .9 0 0 0 0 .85 0 0 0 0 .8 0 0 0 .07 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

.prog-cover {
  position: absolute;
  inset: 0;
  transform-origin: 0 50%;
  transform-style: preserve-3d;
}
.prog-face {
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
}
.prog-face.front {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: calc(var(--pgw) * .014);
  background: #1f130e;
  color: #efe1d8;
  box-shadow: inset 0 0 0 calc(var(--pgw) * .02) #1f130e, inset 0 0 0 calc(var(--pgw) * .022) #efe1d8,
    0 30px 60px -14px rgba(0, 0, 0, .85);
  text-align: center;
}
.prog-face.back {
  transform: rotateY(180deg);
  background: #2a1a12;
}
.prog-kicker {
  font: 500 calc(var(--pgw) * .016)/1 'Bodoni Moda', Georgia, serif;
  letter-spacing: .4em;
  text-transform: uppercase;
  opacity: .8;
}
.prog-script { width: 40%; height: auto; }
.prog-title {
  font: 500 calc(var(--pgw) * .07)/1 'Bodoni Moda', Georgia, serif;
  letter-spacing: .14em;
}
.prog-date {
  font: 500 calc(var(--pgw) * .028)/1 'Bodoni Moda', Georgia, serif;
  letter-spacing: .3em;
}
.prog-venue {
  font: italic 400 calc(var(--pgw) * .026)/1 'Cormorant Garamond', Georgia, serif;
  letter-spacing: .06em;
  opacity: .85;
}
.prog-price {
  margin-top: calc(var(--pgw) * .03);
  font: 500 calc(var(--pgw) * .013)/1 'Bodoni Moda', Georgia, serif;
  letter-spacing: .3em;
  text-transform: uppercase;
  opacity: .6;
}

body[data-state="program"] .replay { opacity: 1; visibility: visible; }

/* l'enveloppe ne revient plus après la sortie du billet */
body:is([data-state="leaving"], [data-state="program-in"], [data-state="program"], [data-state="to-lockers"], [data-state="doors"], [data-state="lockers"]) :is(.env-rear, .env-front) { visibility: hidden; }

/* ---------- Salle des trophées ---------- */

body[data-state="lockers"] .lr-board { cursor: pointer; }

.trophy-room {
  position: fixed;
  inset: 0;
  z-index: 9;
  visibility: hidden;
  overflow: hidden;
  background:
    linear-gradient(transparent 76%, rgba(0, 0, 0, .55) 76.2%, #0d0806),
    #201610;
}
body:is([data-state="trophy-in"], [data-state="trophy"]) .trophy-room { visibility: visible; }
body[data-state="trophy"] .replay { opacity: 1; visibility: visible; z-index: 11; }

/* étagère / socle commun */
.tr-shelf {
  position: absolute;
  left: 4%;
  right: 4%;
  top: 76%;
  height: 10px;
  border-radius: 2px;
  background: linear-gradient(#5a3e2c, #2a1a12);
  box-shadow: 0 14px 30px rgba(0, 0, 0, .7);
}

/* faisceaux des spots */
.tr-spot {
  position: absolute;
  top: -10%;
  height: 90%;
  width: 34vw;
  translate: -50% 0;
  opacity: 0;
  pointer-events: none;
  background: radial-gradient(60% 100% at 50% 0%, rgba(255, 226, 190, .22), rgba(255, 226, 190, .06) 55%, transparent 75%);
  clip-path: polygon(42% 0, 58% 0, 100% 100%, 0 100%);
}
.tr-spot.s1 { left: 18%; }
.tr-spot.s2 { left: 50%; width: 46vw; }
.tr-spot.s3 { left: 82%; }

.tr-item {
  position: absolute;
  bottom: 24%;
  translate: -50% 0;
  opacity: 0;
}
.tr-item svg { display: block; width: 100%; height: auto; filter: drop-shadow(0 12px 18px rgba(0, 0, 0, .6)); }
.tr-trophy { left: 18%; width: min(15vw, 150px); }
.tr-shoes { left: 82%; width: min(22vw, 230px); }
.tr-card {
  left: 50%;
  bottom: 22%;
  width: min(48vw, calc((var(--vh) * 100 - 110px) * .62), 520px);
}
.tr-card img { display: block; width: 100%; height: auto; }

body[data-state="trophy"] .tr-spot,
body[data-state="trophy"] .tr-item { opacity: 1; }
body[data-state="trophy"] .tr-card { pointer-events: auto; }

/* téléphone : trophée et baskets plus petits, posés de part et d'autre du bas de la carte */
@media (max-width: 640px) {
  .tr-trophy { left: 14%; width: 22vw; }
  .tr-shoes { left: 85%; width: 26vw; }
  .tr-card { width: min(70vw, calc((var(--vh) * 100 - 110px) * .62)); bottom: 20%; }
}
.tr-card { bottom: 25%; }
@media (max-width: 640px) { .tr-card { bottom: 25%; } }
/* deux trophées symétriques */
.tr-shoes { width: min(15vw, 150px); }
@media (max-width: 640px) { .tr-shoes { width: 22vw; left: 86%; } }

/* voile noir des transitions */
.veil {
  position: fixed;
  inset: 0;
  z-index: 8;
  background: #0d0806;
  opacity: 0;
  pointer-events: none;
}

/* les vestiaires restent affichés sous le voile noir pendant l'extinction */
body[data-state="to-trophy"] .locker-room { visibility: visible; }
body[data-state="to-trophy"] :is(.card, .jumbo, .env-rear, .env-front) { visibility: hidden; }

/* ==========================================================
   Téléphones (iOS / Android)
   ========================================================== */

/* tap immédiat (pas de délai ni de zoom au double-tap), pinch-zoom conservé pour lire les détails */
html, body, button, .jumbo, .program, .lr-board { touch-action: manipulation; }
/* pas de menu « enregistrer l'image » ni de sélection au appui long */
img { -webkit-touch-callout: none; -webkit-user-select: none; user-select: none; }
body { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }

/* portrait : les visuels paysage prennent toute la largeur de l'écran */
@media (max-width: 640px) and (orientation: portrait) {
  :root {
    --ptw: min(calc(100vw - 12px), calc((var(--vh) * 100 - 140px) * var(--t-ratio)));
    --jw: min(calc(100vw - 28px), calc((var(--vh) * 100 - 170px) * 1.414));
  }
  .program { --pgw: min(calc(100vw - 16px), calc((var(--vh) * 100 - 170px) * 1.414)); }
  .lr-board { --bw: min(calc(100vw - 16px), calc((var(--vh) * 100 - 250px) * 1.414)); padding: 5px; }
  .jumbo-box { padding: 7px 7px 0; border-radius: 6px; }
  .jumbo-ribbon { margin: 6px -7px 0; padding: 6px 0 7px; font-size: 10px; }
  .jumbo-cable.left { left: 22%; }
  .jumbo-cable.right { right: 22%; }

  /* salle des trophées : carte au centre, trophées plus petits dans les coins */
  .tr-card { width: min(72vw, calc((var(--vh) * 100 - 150px) * .62)); bottom: 25%; }
  .tr-trophy { left: 8%; width: 14vw; }
  .tr-shoes { left: 92%; width: 14vw; }
  .tr-spot { width: 60vw; }
  .tr-spot.s2 { width: 90vw; }

  .lr-sign { white-space: nowrap; letter-spacing: .2em; }
  .replay { padding: 7px 12px 7px 9px; font-size: 15px; }
}

/* téléphone à l'horizontale : écran bas, on réduit les marges verticales */
@media (max-height: 500px) and (orientation: landscape) {
  :root {
    --ptw: min(calc(100vw - 32px), calc((var(--vh) * 100 - 70px) * var(--t-ratio)), 980px);
    --jw: min(calc(100vw - 48px), calc((var(--vh) * 100 - 80px) * 1.414), 1100px);
  }
  .program { --pgw: min(calc(100vw - 48px), calc((var(--vh) * 100 - 70px) * 1.414)); }
  .lr-board { --bw: min(calc(100vw - 48px), calc((var(--vh) * 100 - 90px) * 1.414), 74vw); top: 14px; }
  .jumbo { top: 18px; }
  .jumbo-ribbon { display: none; }
  .tr-card { width: min(40vw, calc(var(--vh) * 62 * .846)); bottom: 25%; }
  .tr-trophy, .tr-shoes { width: min(11vw, 110px); }
  .lr-sign { top: 6%; }
  .hint { bottom: max(6px, env(safe-area-inset-bottom)); font-size: 15px; }
}
@media (max-width: 640px) and (orientation: portrait) {
  .tr-card { width: min(68vw, calc((var(--vh) * 100 - 150px) * .62)); }
  .tr-shelf { left: 1%; right: 1%; }
}

/* ---------- Enveloppe : rabat triangulaire visible + noms ---------- */
.env-flap-closed {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}
.env-names {
  position: absolute;
  left: 50%;
  top: 63%;
  width: 58%;
  height: auto;
  translate: -50% -50%;
  filter: drop-shadow(0 1px 1px rgba(0, 0, 0, .6));
}
/* le rabat dessiné disparaît quand l'enveloppe s'ouvre (le vrai rabat bascule derrière) */
body:not([data-state="closed"]):not([data-state="loading"]) .env-flap-closed { opacity: 0; transition: opacity .25s; }
.env-front .env-names {
  mix-blend-mode: normal;
  top: 71%;
  width: 54%;
  height: auto;
}

/* ---------- Écran géant : couverture « Official Game Program » ---------- */
.jumbo-cover {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: calc(var(--jw) * .014);
  background: #1f130e;
  color: #efe1d8;
  text-align: center;
  box-shadow: inset 0 0 0 calc(var(--jw) * .022) #1f130e, inset 0 0 0 calc(var(--jw) * .024) #efe1d8;
  text-shadow: 0 0 calc(var(--jw) * .012) rgba(239, 225, 216, .35);
}
.jc-kicker { font: 500 calc(var(--jw) * .016)/1 'Bodoni Moda', Georgia, serif; letter-spacing: .4em; text-transform: uppercase; opacity: .8; }
.jc-script { width: 40%; height: auto; filter: drop-shadow(0 0 6px rgba(239, 225, 216, .25)); }
.jc-title { font: 500 calc(var(--jw) * .07)/1 'Bodoni Moda', Georgia, serif; letter-spacing: .14em; }
.jc-date { font: 500 calc(var(--jw) * .028)/1 'Bodoni Moda', Georgia, serif; letter-spacing: .3em; }
.jc-venue { font: italic 400 calc(var(--jw) * .026)/1 'Cormorant Garamond', Georgia, serif; letter-spacing: .06em; opacity: .85; }
.jc-price { margin-top: calc(var(--jw) * .03); font: 500 calc(var(--jw) * .013)/1 'Bodoni Moda', Georgia, serif; letter-spacing: .3em; text-transform: uppercase; opacity: .6; }
.jumbo-screen .jc-script { width: 40%; height: auto; display: block; }

/* ---------- Programme : carte à deux volets (ouverture depuis le milieu) ---------- */
body:is([data-state="program-closed"], [data-state="program-opening"]) .program { visibility: visible; }
body:is([data-state="program-closed"], [data-state="program-opening"]) :is(.card, .env-rear, .env-front) { visibility: hidden; }
body[data-state="program-closed"] .program { cursor: pointer; }
body[data-state="program-closed"] .replay { opacity: 1; visibility: visible; }

.gf-panel {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 50%;
  transform-style: preserve-3d;
}
.gf-panel.left { left: 0; transform-origin: 0 50%; }
.gf-panel.right { left: 50%; transform-origin: 100% 50%; }
.gf-face {
  position: absolute;
  inset: 0;
  overflow: hidden;
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
}
.gf-face.front { background: #1f130e; }
.gf-panel.left .gf-face.front { border-radius: 3px 0 0 3px; box-shadow: inset -1px 0 0 rgba(0, 0, 0, .6); }
.gf-panel.right .gf-face.front { border-radius: 0 3px 3px 0; box-shadow: inset 1px 0 0 rgba(255, 255, 255, .06); }
.gf-face.back {
  transform: rotateY(180deg);
  background: linear-gradient(90deg, #2a1a12, #24160f);
}
.gf-panel.left .gf-face.back { box-shadow: inset 8px 0 18px rgba(0, 0, 0, .35); }
.gf-panel.right .gf-face.back { box-shadow: inset -8px 0 18px rgba(0, 0, 0, .35); }
/* le visuel de couverture fait toute la largeur : chaque volet en montre une moitié */
.gf-art {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 200%;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: inset 0 0 0 calc(var(--pgw) * .022) #1f130e, inset 0 0 0 calc(var(--pgw) * .024) #efe1d8;
}
.gf-panel.left .gf-art { left: 0; }
.gf-panel.right .gf-art { left: -100%; }
.gf-art img { width: 46%; height: auto; display: block; }
/* ombre portée de la carte fermée */
.program::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 3px;
  box-shadow: 0 30px 60px -14px rgba(0, 0, 0, .85);
  pointer-events: none;
}

/* ---------- Extérieur de la salle : le lieu ---------- */

.arena {
  position: fixed;
  inset: 0;
  z-index: 7;
  overflow: hidden;
  visibility: hidden;
  background: #090504;
}
body:is([data-state="arena-in"], [data-state="arena"]) .arena { visibility: visible; }
body:is([data-state="arena-in"], [data-state="arena"]) :is(.card, .env-rear, .env-front) { visibility: hidden; }
body[data-state="arena"] .arena { cursor: pointer; }
body[data-state="arena"] .replay { opacity: 1; visibility: visible; }

.arena-bg { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }

.ar-beam { transform-box: fill-box; transform-origin: 50% 100%; animation: beam 7s ease-in-out infinite alternate; }
.ar-beam.b2 { animation-delay: -3.5s; }
@keyframes beam { from { transform: rotate(-9deg); } to { transform: rotate(9deg); } }

/* l'affiche, comme un grand panneau lumineux sur la façade */
.arena-poster {
  --aw: min(calc(100vw - 32px), calc((var(--vh) * 100 - 210px) * 1.5), 720px);
  position: absolute;
  left: calc(50% - var(--aw) / 2);
  top: max(40px, calc(42% - var(--aw) / 1.5 / 2));
  width: var(--aw);
  padding: 6px;
  border-radius: 3px;
  background: #120a07;
  box-shadow:
    0 0 0 1px #3a2a20,
    0 0 60px rgba(255, 184, 119, .28),
    0 30px 60px -10px rgba(0, 0, 0, .9);
}
.arena-poster img { display: block; width: 100%; height: auto; }

@media (prefers-reduced-motion: reduce) { .ar-beam { animation: none; } }
@media (max-height: 500px) and (orientation: landscape) {
  .arena-poster { --aw: min(calc(100vw - 48px), calc((var(--vh) * 100 - 60px) * 1.5)); top: 14px; }
}
body[data-state="to-program"] .arena { visibility: visible; }
body[data-state="to-program"] :is(.card, .env-rear, .env-front) { visibility: hidden; }
.arena-poster {
  --aw: min(calc(100vw - 32px), calc((var(--vh) * 100 - 260px) * 1.5), 600px);
  top: calc(52% - var(--aw) / 1.5 / 2);
}
@media (max-width: 640px) and (orientation: portrait) {
  .arena-poster { --aw: calc(100vw - 20px); top: calc(50% - var(--aw) / 1.5 / 2); }
}

/* ---------- Programme : tableau des play-offs (DA journal sportif) ---------- */

.program.bracket {
  inset: 0;
  left: 0;
  top: 0;
  width: auto;
  aspect-ratio: auto;
  rotate: none;
  perspective: none;
  background: #ecebe8;
  color: #1f130e;
  overflow: hidden;
}
.program.bracket::before { display: none; }
.bk-sheet {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 56px 16px 64px;
  font-family: 'Oswald', 'Arial Narrow', sans-serif;
}
.bk-kicker { margin: 0; font-weight: 500; font-size: clamp(13px, 1.6vw, 18px); letter-spacing: .02em; }
.bk-title {
  margin: 0 0 1vh;
  font-weight: 700;
  font-size: clamp(40px, 7vw, 84px);
  line-height: .95;
  letter-spacing: -.01em;
}
.bk-foot {
  margin: 1vh 0 0;
  font-weight: 500;
  font-size: clamp(12px, 1.4vw, 16px);
  letter-spacing: .2em;
  text-transform: uppercase;
  color: #6f5646;
}

.bk-board {
  --bkw: min(calc(100vw - 48px), calc((var(--vh) * 100 - 300px) * 1000 / 520), 1000px);
  position: relative;
  width: var(--bkw);
  aspect-ratio: 1000 / 520;
  font-size: calc(var(--bkw) * .022);
}
.bk-box {
  position: absolute;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: .25em;
  padding: 0 .9em;
  border-radius: .35em;
  background: #fff;
  box-shadow: 0 0 0 1px #d8d3cd, 0 2px 6px rgba(31, 19, 14, .06);
  font-weight: 500;
  line-height: 1.1;
}
.bk-box small {
  font-size: .62em;
  font-weight: 500;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: #8a7a6e;
}
.bk-box span { font-size: 1.15em; }
.bk-box .seed { font-weight: 500; color: #8a7a6e; margin-right: .2em; }
.bk-box.win { box-shadow: 0 0 0 2px #1f130e, 0 4px 10px rgba(31, 19, 14, .12); }
.bk-box.win span { font-weight: 700; }
.bk-box.b5 { background: #1f130e; color: #efe1d8; box-shadow: 0 10px 24px rgba(31, 19, 14, .3); }
.bk-box.b5 small { color: #c9a98a; }
.bk-box.b5 span { font-size: 1.4em; font-weight: 700; }

.bk-line { position: absolute; display: block; border: 0 solid #9c8f84; transform-origin: 0 0; }
.bk-line.on { border-color: #1f130e; }

/* positions — ordinateur / paysage */
.b1 { left: 0; top: 14%; width: 21%; height: 15%; }
.b2 { left: 0; top: 62%; width: 21%; height: 15%; }
.k1 { left: 21%; top: 21.5%; width: 4%; height: 48%; border-width: 2px 2px 2px 0; }
.k1b { left: 25%; top: 45.5%; width: 4%; height: 0; border-top-width: 2px; }
.b3 { left: 29%; top: 38%; width: 20%; height: 15%; }
.k2 { left: 49%; top: 45.5%; width: 5%; height: 0; border-top-width: 2px; }
.b4 { left: 54%; top: 38%; width: 20%; height: 15%; }
.k3 { left: 74%; top: 45.5%; width: 5%; height: 0; border-top-width: 2px; }
.b5 { left: 79%; top: 34%; width: 21%; height: 23%; }
.bk-trophy { position: absolute; left: 84.5%; top: 60%; width: 10%; height: auto; filter: drop-shadow(0 6px 8px rgba(0, 0, 0, .25)); }

/* téléphone en portrait : le tableau se lit de haut en bas */
@media (max-width: 640px) and (orientation: portrait) {
  .bk-sheet { padding: 60px 12px 56px; gap: 6px; }
  .bk-board {
    --bkw: min(calc(100vw - 24px), calc((var(--vh) * 100 - 230px) * 600 / 900));
    aspect-ratio: 600 / 900;
    font-size: calc(var(--bkw) * .05);
  }
  .b1 { left: 0; top: 2%; width: 46%; height: 11%; }
  .b2 { left: 54%; top: 2%; width: 46%; height: 11%; }
  .k1 { left: 23%; top: 13%; width: 54%; height: 4%; border-width: 0 2px 2px 2px; }
  .k1b { left: 50%; top: 17%; width: 0; height: 5%; border-width: 0 0 0 2px; }
  .b3 { left: 15%; top: 22%; width: 70%; height: 11%; }
  .k2 { left: 50%; top: 33%; width: 0; height: 6%; border-width: 0 0 0 2px; }
  .b4 { left: 15%; top: 39%; width: 70%; height: 11%; }
  .k3 { left: 50%; top: 50%; width: 0; height: 6%; border-width: 0 0 0 2px; }
  .b5 { left: 10%; top: 56%; width: 80%; height: 15%; }
  .bk-trophy { left: 41%; top: 74%; width: 18%; }
}
@media (max-height: 500px) and (orientation: landscape) {
  .bk-sheet { padding: 10px 16px 30px; gap: 4px; }
  .bk-title { font-size: 34px; }
  .bk-board { --bkw: min(calc(100vw - 48px), calc((var(--vh) * 100 - 130px) * 1000 / 520)); }
}

body[data-state="program"] .program.bracket { cursor: pointer; }
/* indication et bouton lisibles sur la page claire du tableau */
body:is([data-state="program-in"], [data-state="program"]) .hint { color: #6f5646; text-shadow: none; }
body[data-state="program"] .replay { color: #1f130e; background: rgba(31, 19, 14, .06); border-color: rgba(31, 19, 14, .25); }

/* tableau : typo de l'invitation (script « The » + capitales à empattements espacées) */
.bk-title img { display: block; width: clamp(180px, 26vw, 320px); height: auto; }
.bk-sheet { font-family: 'Bodoni Moda', Georgia, serif; }
.bk-kicker { font: italic 400 clamp(15px, 1.8vw, 20px)/1 'Cormorant Garamond', Georgia, serif; letter-spacing: .06em; }
.bk-foot { font-family: 'Bodoni Moda', Georgia, serif; letter-spacing: .3em; }
.bk-box small { font-family: 'Bodoni Moda', Georgia, serif; letter-spacing: .18em; }
.bk-box span { font-family: 'Bodoni Moda', Georgia, serif; font-weight: 500; letter-spacing: .12em; text-transform: uppercase; font-size: 1em; }
.bk-box.win span { font-weight: 600; }
.bk-box.b5 span { font-size: 1.15em; font-weight: 600; }
.bk-box .seed { font-family: 'Bodoni Moda', Georgia, serif; }
@media (max-width: 640px) and (orientation: portrait) {
  .bk-title img { width: 58vw; }
  .bk-box span { font-size: .9em; }
}
.bk-box small { font-size: .55em; letter-spacing: .1em; white-space: nowrap; }
.bk-box span { font-size: .92em; letter-spacing: .05em; white-space: nowrap; }
.bk-box.b5 span { font-size: 1.05em; white-space: normal; }
.bk-box:not(.b5) span { font-size: .84em; }
@media (max-width: 640px) and (orientation: portrait) {
  .bk-sheet { padding-top: 72px; }
  .bk-board { --bkw: min(calc(100vw - 24px), calc((var(--vh) * 100 - 250px) * 600 / 900)); }
}
/* stade sur téléphone en portrait : ciel au-dessus, façade en bas, affiche entre les deux */
@media (max-width: 640px) and (orientation: portrait) {
  .arena { background: linear-gradient(#090504, #0c0706 60%); }
  .arena-poster { --aw: calc(100vw - 20px); top: calc(36% - var(--aw) / 1.5 / 2); }
}
@media (max-width: 640px) and (orientation: portrait) {
  .ar-sky { fill: transparent; }
  .arena { background: linear-gradient(#090504 0%, #140b07 55%, #2a160e 82%, #3a1f14 100%); }
}

/* ---------- RSVP : bouton formulaire sur téléphone, QR code sur ordinateur ---------- */
.tr-card { position: absolute; }
.rsvp-btn { display: none; }
@media (max-width: 900px), (hover: none) and (pointer: coarse) {
  .rsvp-btn {
    position: absolute;
    left: 50%;
    top: 55.6%;
    translate: -50% -50%;
    width: 46%;
    height: 17%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    border-radius: 10px;
    background: #1f130e;
    color: #efe1d8;
    text-decoration: none;
    font: 600 clamp(12px, 3.6vw, 16px)/1 'Bodoni Moda', Georgia, serif;
    letter-spacing: .14em;
    text-transform: uppercase;
    box-shadow: 0 8px 18px rgba(31, 19, 14, .35), 0 0 0 1px #6b4a36;
    animation: rsvp-pulse 2.2s ease-in-out infinite;
  }
  .rsvp-btn svg { width: 22px; height: 22px; }
}
@keyframes rsvp-pulse {
  0%, 100% { box-shadow: 0 8px 18px rgba(31, 19, 14, .35), 0 0 0 1px #6b4a36, 0 0 0 0 rgba(239, 225, 216, .5); }
  50% { box-shadow: 0 8px 18px rgba(31, 19, 14, .35), 0 0 0 1px #6b4a36, 0 0 0 8px rgba(239, 225, 216, 0); }
}
@media (prefers-reduced-motion: reduce) { .rsvp-btn { animation: none; } }

/* ---------- Bouton « Précédent » (sous Rejouer) ---------- */
.prev-btn {
  position: fixed;
  z-index: 11;
  top: calc(max(14px, env(safe-area-inset-top)) + 46px);
  right: 16px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px 8px 10px;
  border: 1px solid rgba(239, 225, 216, .25);
  border-radius: 999px;
  background: rgba(239, 225, 216, .08);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  color: #efe1d8;
  font: italic 500 16px/1 'Cormorant Garamond', Georgia, serif;
  cursor: pointer;
  opacity: 0;
  visibility: hidden;
  transition: opacity .5s, visibility .5s, background .3s;
}
.prev-btn svg { width: 16px; height: 16px; }
.prev-btn:hover { background: rgba(239, 225, 216, .18); }
.prev-btn:focus-visible { outline: 2px solid #efe1d8; outline-offset: 3px; }
body:is([data-state="presented"], [data-state="screen"], [data-state="arena"], [data-state="program"], [data-state="lockers"], [data-state="trophy"]) .prev-btn { opacity: 1; visibility: visible; }
body[data-state="program"] .prev-btn { color: #1f130e; background: rgba(31, 19, 14, .06); border-color: rgba(31, 19, 14, .25); }
.replay { z-index: 11; }
body:is([data-state="arena"], [data-state="lockers"]) .replay { opacity: 1; visibility: visible; }

/* ---------- Indication bien visible pour tous ---------- */
.hint {
  left: 50%;
  right: auto;
  translate: -50% 0;
  display: inline-flex;
  align-items: center;
  gap: 12px;
  width: max-content;
  max-width: calc(100vw - 24px);
  padding: 10px 20px 10px 14px;
  border-radius: 999px;
  border: 1px solid rgba(239, 225, 216, .35);
  background: rgba(20, 12, 8, .82);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  box-shadow: 0 10px 30px rgba(0, 0, 0, .45);
  color: #efe1d8;
  text-shadow: none;
  text-align: left;
  font-style: normal;
  bottom: max(16px, calc(env(safe-area-inset-bottom) + 8px));
}
.hint.show::before, .hint.show::after { display: none; }
body:is([data-state="program-in"], [data-state="program"]) .hint { color: #efe1d8; }
.h-icon { flex: none; width: 30px; height: 30px; animation: tap 1.6s ease-in-out infinite; }
.h-text { display: flex; flex-direction: column; gap: 3px; }
.h-main { font: italic 600 clamp(19px, 2.4vw, 22px)/1.05 'Cormorant Garamond', Georgia, serif; letter-spacing: .02em; }
.h-sub { font: 500 clamp(11px, 1.3vw, 13px)/1.2 'Bodoni Moda', Georgia, serif; letter-spacing: .12em; text-transform: uppercase; opacity: .75; }
@keyframes tap { 0%, 60%, 100% { transform: translateY(0) scale(1); } 30% { transform: translateY(3px) scale(.9); } }
@media (prefers-reduced-motion: reduce) { .h-icon { animation: none; } }
@media (max-height: 500px) and (orientation: landscape) {
  .hint { padding: 6px 14px 6px 10px; } .h-icon { width: 22px; height: 22px; } .h-main { font-size: 16px; } .h-sub { font-size: 10px; }
}
/* laisser la place à l'indication en bas du tableau */
.bk-sheet { padding-bottom: 104px; }
.bk-board { --bkw: min(calc(100vw - 48px), calc((var(--vh) * 100 - 340px) * 1000 / 520), 1000px); }
@media (max-width: 640px) and (orientation: portrait) {
  .bk-sheet { padding-bottom: 96px; }
  .bk-board { --bkw: min(calc(100vw - 24px), calc((var(--vh) * 100 - 290px) * 600 / 900)); }
}
@media (max-height: 500px) and (orientation: landscape) {
  .bk-sheet { padding-bottom: 56px; }
  .bk-board { --bkw: min(calc(100vw - 48px), calc((var(--vh) * 100 - 150px) * 1000 / 520)); }
}
/* le voile noir passe au-dessus de toutes les scènes */
.veil { z-index: 10; }

/* ==========================================================
   Voyage : décollage de l'avion + passeport
   ========================================================== */

.flight, .passport { visibility: hidden; }
body:is([data-state="flight"]) .flight { visibility: visible; }
body:is([data-state="flight"], [data-state="passport-closed"], [data-state="passport-opening"], [data-state="passport"], [data-state="to-program"]) :is(.card, .env-rear, .env-front, .jumbo, .arena) { visibility: hidden; }

/* --- avion --- */
.flight { position: fixed; inset: 0; z-index: 7; overflow: hidden; }
.fl-sky {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(60% 40% at 70% 78%, rgba(255, 196, 140, .55), transparent 70%),
    linear-gradient(#1f130e 0%, #4a2c1e 40%, #a8673f 75%, #e8b47e 100%);
}
.fl-cloud {
  position: absolute;
  height: 38px;
  border-radius: 40px;
  background: rgba(255, 236, 214, .5);
  filter: blur(6px);
  box-shadow: 30px -14px 0 4px rgba(255, 236, 214, .45), 70px 0 0 -2px rgba(255, 236, 214, .4);
}
.fl-cloud.c1 { top: 14%; width: 140px; left: 110%; }
.fl-cloud.c2 { top: 30%; width: 200px; left: 140%; }
.fl-cloud.c3 { top: 8%; width: 110px; left: 175%; }
.fl-cloud.c4 { top: 46%; width: 160px; left: 210%; }
.fl-runway {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 22%;
  background: linear-gradient(#2a1a12, #140b07);
  box-shadow: 0 -2px 0 rgba(239, 225, 216, .25);
}
.fl-runway span {
  position: absolute;
  left: 0;
  right: 0;
  top: 40%;
  height: 6px;
  background: repeating-linear-gradient(90deg, #efe1d8 0 70px, transparent 70px 160px);
  opacity: .8;
}
body[data-state="flight"] .fl-runway span { animation: runway .35s linear infinite; }
@keyframes runway { to { background-position: -160px 0; } }
.fl-plane {
  --plw: min(96vw, 860px);
  position: absolute;
  left: calc(50% - var(--plw) / 2);
  bottom: calc(22% - var(--plw) * .03);
  width: var(--plw);
  transform-origin: 54% 47%;
}
.fl-plane svg { display: block; width: 100%; height: auto; filter: drop-shadow(0 18px 18px rgba(0, 0, 0, .35)); }

/* --- passeport --- */
.passport {
  --ppw: min(46vw, calc((var(--vh) * 100 - 190px) * .75), 420px);  /* largeur d'une page */
  position: fixed;
  z-index: 7;
  left: calc(50% - var(--ppw));
  top: calc(50% - var(--ppw) / .75 / 2 - 14px);
  width: calc(var(--ppw) * 2);
  height: calc(var(--ppw) / .75);
  perspective: 2400px;
  translate: calc(var(--ppw) * -.5) 0;
  transition: translate 1.3s cubic-bezier(.55, .05, .25, 1);
}
.passport.open { translate: 0 0; }
.passport.instant, .passport.instant .pp-cover { transition: none; }
body:is([data-state="passport-closed"], [data-state="passport-opening"], [data-state="passport"], [data-state="to-arena"]) .passport { visibility: visible; }
body:is([data-state="passport-closed"], [data-state="passport"]) .passport { cursor: pointer; }
body:is([data-state="passport-closed"], [data-state="passport"]) :is(.replay, .prev-btn) { opacity: 1; visibility: visible; }

.pp-page, .pp-cover {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 50%;
  width: 50%;
}
.pp-page {
  overflow: hidden;
  border-radius: 0 6px 6px 0;
  background: #201610;
  box-shadow: 0 30px 60px -14px rgba(0, 0, 0, .85), inset 10px 0 18px rgba(0, 0, 0, .45);
}
.pp-cover {
  transform-origin: 0 50%;
  transform-style: preserve-3d;
  transition: transform 1.3s cubic-bezier(.55, .05, .25, 1);
}
.passport.open .pp-cover { transform: rotateY(-180deg); }
.pp-face {
  position: absolute;
  inset: 0;
  overflow: hidden;
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
}
.pp-face.front {
  border-radius: 2px 8px 8px 2px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: calc(var(--ppw) * .045);
  color: #d9b77a;
  text-align: center;
  background:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.7' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 .35 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E"),
    linear-gradient(135deg, #3a2519, #24160f);
  box-shadow: 0 30px 60px -14px rgba(0, 0, 0, .85), inset 6px 0 10px rgba(0, 0, 0, .4), inset 0 0 0 1px rgba(217, 183, 122, .15);
  text-shadow: 0 1px 0 rgba(0, 0, 0, .6), 0 -1px 0 rgba(255, 230, 180, .15);
}
.pp-kicker { font: 500 calc(var(--ppw) * .045)/1 'Bodoni Moda', Georgia, serif; letter-spacing: .3em; text-transform: uppercase; }
.pp-emblem { width: 38%; height: auto; color: #d9b77a; filter: drop-shadow(0 1px 0 rgba(0, 0, 0, .6)); }
.pp-title { font: 600 calc(var(--ppw) * .085)/1 'Bodoni Moda', Georgia, serif; letter-spacing: .12em; }
.pp-names { font: italic 500 calc(var(--ppw) * .075)/1 'Cormorant Garamond', Georgia, serif; }
.pp-date { font: 500 calc(var(--ppw) * .045)/1 'Bodoni Moda', Georgia, serif; letter-spacing: .3em; }
.pp-face.back {
  transform: rotateY(180deg);
  border-radius: 6px 0 0 6px;
  background: #201610;
  box-shadow: inset -10px 0 18px rgba(0, 0, 0, .45);
}
/* l'affiche s'étale sur la double page */
.pp-art { position: absolute; top: 0; bottom: 0; width: 200%; left: -100%; display: block; }
.pp-art.left { left: 0; }
.pp-art img { display: block; width: 100%; height: 100%; object-fit: cover; }
.pp-face.back .pp-art::after, .pp-page .pp-art::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent 46%, rgba(0, 0, 0, .35) 50%, transparent 54%);
}
/* tampon d'arrivée */
.pp-stamp {
  position: absolute;
  right: 7%;
  top: 7%;
  width: 34%;
  aspect-ratio: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4%;
  border: 3px double #c4573f;
  border-radius: 50%;
  color: #c4573f;
  rotate: -14deg;
  opacity: 0;
  font-family: 'Bodoni Moda', Georgia, serif;
  mix-blend-mode: screen;
}
.pp-stamp b { font-size: calc(var(--ppw) * .045); letter-spacing: .14em; }
.pp-stamp i { font-style: normal; font-size: calc(var(--ppw) * .03); letter-spacing: .08em; }
.passport.stamped .pp-stamp { opacity: .9; }

@media (max-width: 640px) and (orientation: portrait) {
  .passport { --ppw: min(46vw, calc((var(--vh) * 100 - 190px) * .75)); }
}
@media (max-height: 500px) and (orientation: landscape) {
  .passport { --ppw: min(46vw, calc((var(--vh) * 100 - 70px) * .75)); top: calc(50% - var(--ppw) / .75 / 2 - 10px); }
}
.pp-stamp { right: 3%; top: 2.5%; width: 30%; }

/* ---------- Parvis : l'affiche « Official Game Program » (après l'avion) ---------- */
body[data-state="to-passport"] .arena { visibility: visible; }
body[data-state="to-passport"] :is(.card, .env-rear, .env-front) { visibility: hidden; }
.arena-poster { --jw: var(--aw); }
.ap-screen { position: relative; aspect-ratio: 1.414; overflow: hidden; border-radius: 2px; }
.arena-poster .jc-script { width: 40%; height: auto; display: block; }

body[data-state="to-arena"] :is(.card, .env-rear, .env-front) { visibility: hidden; }
/* le stade reste affiché pendant le fondu au noir vers le programme */
body[data-state="to-program"] .arena { visibility: visible; }

/* ---------- Passagers dessinés dans les hublots ---------- */
.fl-plane :is(.pax, .eye, .dog-ear, .tongue) { transform-box: fill-box; }
.pax { transform-origin: 50% 100%; animation: pax-bob 2.4s ease-in-out infinite; }
.pax-b { animation-delay: -.8s; }
.pax-c { animation-duration: 1.6s; animation-delay: -.4s; }
@keyframes pax-bob { 0%, 100% { transform: translateY(0) rotate(0); } 50% { transform: translateY(1.5px) rotate(-2deg); } }
.eye { transform-origin: 50% 50%; animation: blink 3.6s infinite; }
.pax-b .eye { animation-delay: -1.3s; }
.pax-c .eye { animation-delay: -2.4s; }
@keyframes blink { 0%, 92%, 100% { transform: scaleY(1); } 95% { transform: scaleY(.1); } }
.dog-ear { transform-origin: 50% 100%; animation: ear 2s ease-in-out infinite; }
@keyframes ear { 0%, 70%, 100% { transform: rotate(0); } 78% { transform: rotate(-14deg); } 86% { transform: rotate(4deg); } }
.tongue { transform-origin: 50% 0%; animation: pant .45s ease-in-out infinite alternate; }
@keyframes pant { from { transform: scaleY(.7); } to { transform: scaleY(1.2); } }
@media (prefers-reduced-motion: reduce) { .fl-plane :is(.pax, .eye, .dog-ear, .tongue) { animation: none; } }

/* ---------- Stade : deux projecteurs au sol braqués sur l'affiche ---------- */
.ar-lights {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  mix-blend-mode: screen;
  filter: blur(3px);
}
.ar-lamp {
  position: absolute;
  bottom: 4%;
  width: clamp(34px, 5vw, 56px);
  aspect-ratio: 1.5;
  border-radius: 6px 6px 3px 3px;
  background: linear-gradient(#3a2a20, #120a07);
  box-shadow: 0 6px 14px rgba(0, 0, 0, .7);
}
.ar-lamp::before {
  content: "";
  position: absolute;
  left: 14%;
  right: 14%;
  top: -12%;
  height: 34%;
  border-radius: 50%;
  background: radial-gradient(#fffaf0, #ffd9a8 60%, #c98a5c);
  box-shadow: 0 0 18px 6px rgba(255, 220, 170, .7);
}
.ar-lamp::after {
  content: "";
  position: absolute;
  left: 40%;
  width: 20%;
  top: 100%;
  height: 10px;
  background: #120a07;
}
.ar-lamp.left { left: 12%; translate: -50% 0; rotate: 32deg; }
.ar-lamp.right { left: 88%; translate: -50% 0; rotate: -32deg; }
@media (max-width: 640px) and (orientation: portrait) {
  .ar-lamp { bottom: 2%; }
}

/* projecteurs sur trépied, bien visibles */
.ar-lamp { width: clamp(70px, 10vw, 130px); aspect-ratio: 1; bottom: 2%; background: none; box-shadow: none; border-radius: 0; z-index: 2; }
.ar-lamp::before, .ar-lamp::after { display: none; }
.ar-lamp svg { display: block; width: 100%; height: 100%; overflow: visible; filter: drop-shadow(0 8px 10px rgba(0, 0, 0, .7)); }
.ar-head { transform-box: fill-box; transform-origin: 50% 100%; }
.ar-lamp.left { left: 14%; rotate: 0deg; }
.ar-lamp.left .ar-head { transform: rotate(-38deg); transition: none; }
.ar-lamp.right { left: 86%; rotate: 0deg; scale: -1 1; }
.ar-lamp.right .ar-head { transform: rotate(-38deg); }
.ar-lights { filter: blur(2px); z-index: 1; }
@media (max-width: 640px) and (orientation: portrait) {
  .ar-lamp { width: 20vw; bottom: 1%; }
}

/* couverture du passeport : visuel fourni */
.passport { --pr: .709; height: calc(var(--ppw) / var(--pr)); top: calc(50% - var(--ppw) / var(--pr) / 2 - 14px); }
.pp-face.front { background: none; border-radius: 3px 16px 16px 3px; box-shadow: 0 30px 60px -14px rgba(0, 0, 0, .85); }
.pp-cover-img { display: block; width: 100%; height: 100%; object-fit: cover; }

/* intérieur du passeport : visuel fourni (format 3:2 sur la double page), il a déjà son tampon */
.passport { --pr: .75; }
.pp-page, .pp-face.back { background: #fdfbf8; }
.pp-art img { object-fit: contain; }
.pp-stamp { display: none; }
.pp-face.back .pp-art::after, .pp-page .pp-art::after {
  background: linear-gradient(90deg, transparent 44%, rgba(60, 40, 25, .22) 50%, transparent 56%);
}

/* ---------- Passeport : version moderne et graphique ---------- */
.pp-face.front.pp-modern {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: calc(var(--ppw) * .04);
  border-radius: 4px 18px 18px 4px;
  background: linear-gradient(160deg, #3a2519 0%, #2a1a12 55%, #22150e 100%);
  box-shadow: 0 24px 50px -16px rgba(0, 0, 0, .7), inset 0 0 0 1px rgba(217, 183, 122, .18);
  color: #d9b77a;
  text-shadow: none;
}
.pp-modern::before {
  content: "";
  position: absolute;
  inset: calc(var(--ppw) * .05);
  border: 1px solid rgba(217, 183, 122, .45);
  border-radius: 2px 12px 12px 2px;
  pointer-events: none;
}
.pm-top { font: 500 calc(var(--ppw) * .038)/1 'Bodoni Moda', Georgia, serif; letter-spacing: .5em; text-transform: uppercase; opacity: .8; }
.pm-title { font: 500 calc(var(--ppw) * .1)/1 'Bodoni Moda', Georgia, serif; letter-spacing: .22em; margin-right: -.22em; }
.pm-rule { width: 18%; height: 1px; background: currentColor; opacity: .6; }
.pm-emblem {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .12em;
  width: calc(var(--ppw) * .34);
  aspect-ratio: 1;
  border: 1px solid currentColor;
  border-radius: 50%;
  font: 500 calc(var(--ppw) * .1)/1 'Bodoni Moda', Georgia, serif;
  box-shadow: inset 0 0 0 calc(var(--ppw) * .012) #2a1a12, inset 0 0 0 calc(var(--ppw) * .015) rgba(217, 183, 122, .5);
}
.pm-emblem i { font: italic 400 .55em/1 'Cormorant Garamond', Georgia, serif; }
.pm-sub { font: italic 500 calc(var(--ppw) * .06)/1 'Cormorant Garamond', Georgia, serif; color: #efe1d8; }
.pm-date { font: 500 calc(var(--ppw) * .038)/1 'Bodoni Moda', Georgia, serif; letter-spacing: .35em; }
.pm-chip { width: calc(var(--ppw) * .12); height: auto; margin-top: calc(var(--ppw) * .03); opacity: .85; }
/* intérieur : pages plates, pli discret */
.pp-face.back .pp-art::after, .pp-page .pp-art::after { background: linear-gradient(90deg, transparent 48%, rgba(60, 40, 25, .12) 50%, transparent 52%); }
.pp-page { border-radius: 0 18px 18px 0; box-shadow: 0 24px 50px -16px rgba(0, 0, 0, .7); }
.pp-face.back { border-radius: 18px 0 0 18px; box-shadow: none; }
