/* ODG – OhDjiGames : hub d'entrée. Polices auto-hébergées (OFL), aucun appel tiers. */
@font-face { font-family: 'Rajdhani'; font-weight: 500; font-display: swap; src: url('/fonts/rajdhani-latin-500-normal.woff2') format('woff2'); }
@font-face { font-family: 'Rajdhani'; font-weight: 600; font-display: swap; src: url('/fonts/rajdhani-latin-600-normal.woff2') format('woff2'); }
@font-face { font-family: 'Rajdhani'; font-weight: 700; font-display: swap; src: url('/fonts/rajdhani-latin-700-normal.woff2') format('woff2'); }
@font-face { font-family: 'Press Start 2P'; font-weight: 400; font-display: swap; src: url('/fonts/press-start-2p-latin-400-normal.woff2') format('woff2'); }

:root {
  --bg: #05060a;
  --fg: #f2f2f2;
  --muted: rgba(255, 255, 255, .75);
  --accent: #FFE81F;
  --cyan: #4bd5ee;

  /* Chronologie de l'intro : la sélection apparaît à --t-end */
  --t-crawl-start: 6.5s;
  --t-crawl-dur: 30s;
  --t-end: 34s;
}

* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--fg); }
body { font-family: 'Rajdhani', system-ui, sans-serif; -webkit-font-smoothing: antialiased; }
a { color: var(--fg); }
a:hover { color: #fff; }
.accent { color: var(--accent); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.page { position: relative; min-height: 100vh; min-height: 100dvh; overflow: hidden; }

/* ---------- Ciel ---------- */
.sky { position: absolute; inset: 0; pointer-events: none; }
.stars { position: absolute; top: 0; left: 0; width: 1px; height: 1px; border-radius: 50%; }
.s1 { animation: twinkle 4s ease-in-out infinite alternate; }
.s2 { animation: twinkle 6s 1s ease-in-out infinite alternate; }
.s3 { animation: drift 90s linear infinite; }
.vignette { position: absolute; inset: 0; background: radial-gradient(ellipse at 50% 55%, rgba(5,6,10,0) 40%, rgba(0,0,0,.75) 100%); }
@keyframes twinkle { from { opacity: .35 } to { opacity: 1 } }
@keyframes drift { from { transform: translateY(0) } to { transform: translateY(-40px) } }

/* ---------- Intro ---------- */
.intro { position: absolute; inset: 0; z-index: 5; pointer-events: none; animation: introOut 1.2s var(--t-end) forwards; }
@keyframes introOut { to { opacity: 0; visibility: hidden } }

.intro-line {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); margin: 0;
  width: min(640px, 86vw); font-size: clamp(18px, 2.4vw, 28px); font-weight: 500; line-height: 1.4;
  color: var(--cyan); letter-spacing: .02em;
  animation: lineIn 4.2s .4s both;
}
@keyframes lineIn { 0% { opacity: 0 } 15% { opacity: 1 } 80% { opacity: 1 } 100% { opacity: 0 } }

.logo { position: absolute; left: 50%; top: 50%; display: flex; flex-direction: column; align-items: center; gap: 8px; white-space: nowrap; animation: logoOut 6s 4.8s both; }
@keyframes logoOut {
  0% { opacity: 0; transform: translate(-50%, -50%) scale(2.6) }
  6% { opacity: 1 }
  80% { opacity: 1 }
  100% { opacity: 0; transform: translate(-50%, -50%) scale(.04) }
}
.logo-mark { font-size: clamp(110px, 18vw, 240px); font-weight: 700; line-height: .9; letter-spacing: .06em; color: transparent; -webkit-text-stroke: 4px var(--accent); }
.logo-sub { font-family: 'Press Start 2P', monospace; font-size: clamp(14px, 2vw, 24px); letter-spacing: .2em; color: var(--accent); }

.crawl-wrap { position: absolute; inset: 0; perspective: 380px; overflow: hidden; }
.crawl-plane {
  position: absolute; left: 50%; bottom: 0; width: min(720px, 92vw); height: 170vh;
  transform: translateX(-50%) rotateX(32deg); transform-origin: 50% 100%; overflow: hidden;
  -webkit-mask-image: linear-gradient(to bottom, transparent 0%, #000 40%);
  mask-image: linear-gradient(to bottom, transparent 0%, #000 40%);
}
.crawl-text {
  position: absolute; left: 0; right: 0; top: 100%;
  color: var(--accent); font-weight: 700; font-size: clamp(22px, 3.4vw, 42px); line-height: 1.35; text-align: justify;
  hyphens: auto;
  /* Vitesse constante : le texte remonte de toute la hauteur du plan + sa propre hauteur */
  animation: crawl var(--t-crawl-dur) var(--t-crawl-start) linear both;
}
.crawl-text p { margin: 0 0 36px; }
.crawl-text p:last-child { margin: 0; }
.crawl-text .crawl-episode { margin: 0 0 8px; text-align: center; letter-spacing: .12em; }
.crawl-text .crawl-title { margin: 0 0 48px; text-align: center; font-size: 1.5em; letter-spacing: .08em; }
@keyframes crawl { from { transform: translateY(0) } to { transform: translateY(calc(-100% - 170vh)) } }

.skip {
  position: absolute; z-index: 6; right: 24px; bottom: 24px; min-height: 44px; padding: 0 20px;
  border: 1px solid rgba(255,255,255,.5); border-radius: 2px; background: rgba(255,255,255,.06); color: #fff;
  font-family: 'Rajdhani', sans-serif; font-weight: 600; font-size: 15px; letter-spacing: .18em; cursor: pointer;
  animation: hideOut .4s var(--t-end) forwards;
}
.skip:hover { background: rgba(255,255,255,.14); }
.skip:focus-visible, .replay:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }
@keyframes hideOut { to { opacity: 0; visibility: hidden } }

/* ---------- Sélection ---------- */
.sel-wrap { position: relative; z-index: 2; min-height: 100vh; min-height: 100dvh; }
.select {
  min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; align-items: center;
  justify-content: space-between; gap: 24px; padding: 24px 16px;
}
/* Deux keyframes identiques : changer de classe relance l'animation (revoir l'intro) */
.sel-delay .select { animation: selInA 1.4s var(--t-end) cubic-bezier(.2,.8,.2,1) both; }
.sel-now .select { animation: selInB 1.2s cubic-bezier(.2,.8,.2,1) both; }
@keyframes selInA { from { opacity: 0; visibility: hidden; transform: translateY(40px) scale(.9) } to { opacity: 1; visibility: visible; transform: none } }
@keyframes selInB { from { opacity: 0; visibility: hidden; transform: translateY(40px) scale(.9) } to { opacity: 1; visibility: visible; transform: none } }
.sel-delay .wheel-spin { animation: spinA 1.8s var(--t-end) cubic-bezier(.2,.8,.2,1) both; }
.sel-now .wheel-spin { animation: spinB 1.6s cubic-bezier(.2,.8,.2,1) both; }
@keyframes spinA { from { transform: rotateZ(-120deg) translateZ(-200px) } to { transform: none } }
@keyframes spinB { from { transform: rotateZ(-120deg) translateZ(-200px) } to { transform: none } }

.topbar, .bottombar { width: 100%; max-width: 1200px; display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 12px; }
.brand { display: flex; align-items: baseline; gap: 12px; }
.brand-mark { font-size: 30px; font-weight: 700; letter-spacing: .08em; }
.brand-sub { font-size: 15px; font-weight: 600; letter-spacing: .22em; color: var(--muted); }
.credits { display: flex; align-items: center; gap: 16px; font-family: 'Press Start 2P', monospace; font-size: 11px; letter-spacing: .08em; color: var(--muted); }
.credits .accent { color: var(--accent); }
.blink { animation: blink 1.1s steps(2, start) infinite; }
@keyframes blink { to { visibility: hidden } }

.center { display: flex; flex-direction: column; align-items: center; gap: 20px; }
.sel-title { margin: 0; font-size: clamp(16px, 1.6vw, 20px); font-weight: 600; letter-spacing: .4em; color: rgba(255,255,255,.8); }

/* Roue 3D */
.wheel { position: relative; width: min(560px, 88vw); aspect-ratio: 1 / 1; perspective: 1400px; }
.wheel-tilt { position: absolute; inset: 0; transform-style: preserve-3d; transform: rotateX(16deg); transition: transform .25s ease-out; }
.wheel-spin, #layers, #locked, .wheel nav { position: absolute; inset: 0; transform-style: preserve-3d; }
#locked, .wheel nav { pointer-events: none; }
.layer { position: absolute; inset: 0; border-radius: 50%; border: 2px solid transparent; }
.glass {
  position: absolute; inset: 0; border-radius: 50%; border: 2px solid rgba(255,255,255,.7); background: rgba(18,20,26,.72);
  box-shadow: inset 0 0 70px rgba(255,255,255,.06), 0 40px 90px rgba(0,0,0,.7);
}
.wheel-svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.wheel-svg path { transition: fill .25s; }
.lift { transform: translateZ(22px); pointer-events: none; }
.lift path { fill: rgba(255,255,255,.10); stroke: rgba(255,255,255,.95); stroke-width: 2; }

.slot {
  position: absolute; width: 20%; height: 18%; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
  color: rgba(255,255,255,.45); pointer-events: auto;
  transform: translate(-50%, -50%) translateZ(var(--z, 0px));
  transition: transform .25s cubic-bezier(.2,.8,.2,1);
}
.slot svg { width: 26px; height: 26px; }
.slot-lock-label { font-size: clamp(14px, 2.4vw, 22px); font-weight: 600; letter-spacing: .1em; }
.slot-on { width: 22%; height: 20%; text-decoration: none; color: #fff; border-radius: 4px; }
.slot-on:focus { outline: none; }
.slot-on:focus-visible { box-shadow: 0 0 0 2px #fff; }
.slot-mono { font-family: 'Press Start 2P', monospace; font-size: clamp(16px, 3.4vw, 28px); line-height: 1; text-shadow: 0 0 18px rgba(255,255,255,.35); }
.slot-name { font-size: clamp(12px, 2vw, 17px); font-weight: 700; letter-spacing: .16em; }
.slot-num { font-size: clamp(14px, 2.6vw, 24px); font-weight: 500; letter-spacing: .06em; color: var(--muted); }

.hub {
  position: absolute; left: 50%; top: 50%; width: 42%; height: 42%; border-radius: 50%;
  transform: translate(-50%, -50%) translateZ(48px);
  border: 3px solid rgba(255,255,255,.9); background: rgba(12,14,18,.9);
  box-shadow: 0 0 0 6px rgba(255,255,255,.06), 0 24px 50px rgba(0,0,0,.65), inset 0 0 40px rgba(255,255,255,.07);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; text-align: center; pointer-events: none;
}
.hub-title { font-size: clamp(18px, 4.4vw, 34px); font-weight: 700; line-height: 1.05; letter-spacing: .06em; }
.hub-sub { max-width: 78%; font-family: 'Press Start 2P', monospace; font-size: clamp(7px, 1.4vw, 10px); line-height: 1.7; letter-spacing: .08em; color: var(--muted); }
.hub-sub.is-accent { color: var(--accent); }
.hub-pulse { animation: pulse 2.4s ease-in-out infinite; }
@keyframes pulse { 0%, 100% { opacity: .75 } 50% { opacity: 1 } }

.bottombar { font-size: 14px; font-weight: 600; letter-spacing: .18em; color: rgba(255,255,255,.72); }
.hint-touch { display: none; }
@media (hover: none) { .hint-mouse { display: none; } .hint-touch { display: inline; } }
.replay {
  min-height: 44px; padding: 0 18px; border: 1px solid rgba(255,255,255,.35); border-radius: 2px; background: transparent;
  color: rgba(255,255,255,.8); font-family: 'Rajdhani', sans-serif; font-weight: 600; font-size: 14px; letter-spacing: .18em; cursor: pointer;
}
.replay:hover { color: #fff; border-color: rgba(255,255,255,.7); }

@media (max-width: 560px) {
  .bottombar { justify-content: center; text-align: center; }
  .credits { font-size: 9px; gap: 10px; }
}

/* ---------- Intro passée : rien ne bloque ---------- */
.no-intro .intro, .no-intro .skip { display: none; }

@media (prefers-reduced-motion: reduce) {
  .crawl-text, .logo, .intro-line, .wheel-spin, .select { animation-duration: .01s !important; animation-delay: 0s !important; }
  .intro { animation: introOut .01s 0s forwards; }
  .skip { display: none; }
  .s3, .blink, .hub-pulse { animation: none; }
}
