/* Sainte-Jaws — tokens + composants partagés (repris des maquettes design/mockups/shared/mockup.css).
   Règle d'animation : on n'anime QUE transform et opacity (composité GPU, 60 fps),
   jamais width/height/top/left/box-shadow. Les chronos passent par requestAnimationFrame. */
:root {
  color-scheme: dark;
  --ground: #070B0D;
  --ground-2: #0B1114;
  --panel: #0E161A;
  --panel-2: #132026;
  --line: #1E2B31;
  --line-2: #2C3D44;
  --fg: #D9E4E7;
  --fg-strong: #F1F7F8;
  --muted: #7F949B;
  --muted-2: #A9BCC2;
  --xray: #BFE6EE;
  --cyan: #5FC4D6;
  --cyan-deep: #163C44;
  --blood: #E0483E;
  --blood-deep: #3A1513;
  --paper: #E6F1F3;

  --f-display: 'Big Shoulders Display', 'Arial Narrow', sans-serif;
  --f-body: 'Archivo', 'Helvetica Neue', sans-serif;
  --f-mono: 'Martian Mono', 'Courier New', monospace;

  --ease-out: cubic-bezier(.16, 1, .3, 1);
  --ease-io: cubic-bezier(.65, 0, .35, 1);
  --t-fast: 180ms;
  --t-med: 420ms;
  --t-slow: 900ms;
}

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: #000; color: var(--fg); font-family: var(--f-body); }
body { overflow: hidden; }
body.scroll { overflow: auto; height: auto; background: var(--ground); }
img { display: block; max-width: 100%; }
button, input { font: inherit; color: inherit; }

/* ---------- Scène TV (1920×1080, mise à l'échelle de la fenêtre par stage.js) ---------- */
.stage {
  position: absolute; left: 50%; top: 50%;
  width: 1920px; height: 1080px;
  transform: translate(-50%, -50%) scale(var(--s, 1));
  transform-origin: center center;
  overflow: hidden;
  background: var(--ground);
  isolation: isolate;
}

/* ---------- Téléphone : plein écran, colonne centrée (les maquettes faisaient 390 × 844) ---------- */
.phone-app { position: fixed; inset: 0; margin: 0 auto; width: 100%; max-width: 540px; overflow: hidden; overflow: clip; background: var(--ground); isolation: isolate; }
@media (min-width: 541px) { .phone-app { box-shadow: 0 0 0 1px var(--line); } }

/* ---------- Atmosphère ---------- */
.fx { position: absolute; inset: 0; pointer-events: none; }
.fx-glow { background: radial-gradient(ellipse 55% 65% at var(--gx, 30%) var(--gy, 45%), rgba(95, 196, 214, .09), transparent 70%); }
.fx-vignette { background: radial-gradient(ellipse at center, transparent 55%, rgba(0, 0, 0, .55)); }
.fx-scan { background: repeating-linear-gradient(0deg, rgba(191, 230, 238, .03) 0 1px, transparent 1px 4px); }
.fx-grain {
  inset: -40%;
  opacity: .06;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='240' height='240'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='2' stitchTiles='stitch'/><feColorMatrix type='saturate' values='0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
  animation: grain 1.2s steps(6) infinite;
  will-change: transform;
}
@keyframes grain {
  0% { transform: translate(0, 0); } 17% { transform: translate(-6%, 4%); } 33% { transform: translate(5%, -7%); }
  50% { transform: translate(-3%, 8%); } 67% { transform: translate(8%, 2%); } 83% { transform: translate(-7%, -4%); } 100% { transform: translate(0, 0); }
}
.flicker { animation: flicker 9s linear infinite; }
@keyframes flicker {
  0%, 100% { opacity: 1; } 41% { opacity: 1; } 42% { opacity: .35; } 43% { opacity: 1; } 44.5% { opacity: .55; } 45.5% { opacity: 1; } 78% { opacity: 1; } 78.6% { opacity: .6; } 79.2% { opacity: 1; }
}

/* Néon de plafond */
.tube {
  position: absolute; left: 50%; top: 0; width: 46%; height: 6px; transform: translateX(-50%);
  background: linear-gradient(90deg, transparent, rgba(191, 230, 238, .55) 12%, rgba(191, 230, 238, .75) 50%, rgba(191, 230, 238, .55) 88%, transparent);
  box-shadow: 0 0 60px 18px rgba(95, 196, 214, .16);
}

/* ---------- Typo ---------- */
.label { font-family: var(--f-mono); font-size: var(--fs, 14px); letter-spacing: .14em; text-transform: uppercase; color: var(--muted); }
.label.cyan { color: var(--cyan); }
.label.red { color: var(--blood); }
.display { font-family: var(--f-display); font-weight: 800; text-transform: uppercase; line-height: .9; letter-spacing: .01em; color: var(--fg-strong); margin: 0; text-wrap: balance; }
.outline { color: transparent; -webkit-text-stroke: 2px var(--cyan); }
.num { font-variant-numeric: tabular-nums; }

/* Chrono : chiffres à chasse fixe pour éviter le tremblement */
.clock { font-family: var(--f-display); font-weight: 800; line-height: .8; display: inline-flex; align-items: baseline; color: var(--fg-strong); }
.clock .d { display: inline-block; width: .56em; text-align: center; }
.clock .sep { display: inline-block; width: .28em; text-align: center; opacity: .7; }

/* ---------- Composants ---------- */
.brackets {
  --c: var(--cyan); --l: 34px; --t: 2px;
  position: absolute; inset: 0; pointer-events: none;
  background:
    linear-gradient(var(--c), var(--c)) left top / var(--l) var(--t) no-repeat,
    linear-gradient(var(--c), var(--c)) left top / var(--t) var(--l) no-repeat,
    linear-gradient(var(--c), var(--c)) right top / var(--l) var(--t) no-repeat,
    linear-gradient(var(--c), var(--c)) right top / var(--t) var(--l) no-repeat,
    linear-gradient(var(--c), var(--c)) left bottom / var(--l) var(--t) no-repeat,
    linear-gradient(var(--c), var(--c)) left bottom / var(--t) var(--l) no-repeat,
    linear-gradient(var(--c), var(--c)) right bottom / var(--l) var(--t) no-repeat,
    linear-gradient(var(--c), var(--c)) right bottom / var(--t) var(--l) no-repeat;
}

.portrait { position: relative; overflow: hidden; background: var(--panel); aspect-ratio: 4 / 5; }
.portrait img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; filter: grayscale(.25) contrast(1.06) brightness(.94); }
.portrait::after { content: ""; position: absolute; inset: 0; background: repeating-linear-gradient(0deg, rgba(191, 230, 238, .05) 0 1px, transparent 1px 4px), linear-gradient(180deg, rgba(7, 11, 13, .45), transparent 22%, transparent 70%, rgba(7, 11, 13, .7)); }

.stamp {
  display: inline-block; font-family: var(--f-display); font-weight: 900; text-transform: uppercase;
  letter-spacing: .14em; line-height: 1; color: var(--blood);
  border: 4px solid currentColor; outline: 2px solid currentColor; outline-offset: 4px;
  padding: .08em .4em; transform: rotate(-7deg);
}
.stamp.ok { color: var(--cyan); }

.chip { font-family: var(--f-mono); font-size: var(--fs, 15px); letter-spacing: .1em; text-transform: uppercase; padding: .55em .9em; box-shadow: inset 0 0 0 1px var(--line-2); color: var(--fg); white-space: nowrap; }
.chip.red { color: var(--blood); box-shadow: inset 0 0 0 1px var(--blood); }
.chip.cyan { color: var(--cyan); box-shadow: inset 0 0 0 1px var(--cyan); }

.btn {
  appearance: none; border: 0; cursor: pointer; width: 100%;
  min-height: 60px; padding: 0 22px; display: flex; align-items: center; justify-content: center; gap: 12px;
  font-family: var(--f-display); font-weight: 800; font-size: 25px; letter-spacing: .06em; text-transform: uppercase;
  color: var(--ground); background: var(--cyan);
  transition: transform var(--t-fast) var(--ease-out), opacity var(--t-fast) linear;
}
.btn:active { transform: scale(.97); }
.btn:focus-visible, .tap:focus-visible { outline: 2px solid var(--xray); outline-offset: 3px; }
.btn.ghost { background: transparent; color: var(--fg); box-shadow: inset 0 0 0 1px var(--line-2); }
.btn.red { background: var(--blood); color: var(--fg-strong); }
.btn[disabled] { opacity: .45; cursor: default; }

.bar { position: relative; height: 6px; background: var(--line); overflow: hidden; }
.bar > i { position: absolute; inset: 0; background: var(--cyan); transform-origin: left center; transform: scaleX(var(--p, 1)); will-change: transform; }

/* QR (SVG servi par /qr/*.svg) */
.qr { background: var(--paper); padding: 14px; }
.qr img, .qr svg { display: block; width: 100%; height: auto; }

/* ---------- Entrées & micro-animations (transform + opacity uniquement) ---------- */
.rise { animation: rise var(--t-slow) var(--ease-out) both; animation-delay: var(--d, 0ms); }
@keyframes rise { from { opacity: 0; transform: translateY(28px); } }
.fade { animation: fade var(--t-slow) var(--ease-out) both; animation-delay: var(--d, 0ms); }
@keyframes fade { from { opacity: 0; } }
.slam { animation: slam 620ms var(--ease-out) both; animation-delay: var(--d, 0ms); }
@keyframes slam { from { opacity: 0; transform: rotate(-7deg) scale(1.9); } 55% { opacity: 1; transform: rotate(-7deg) scale(.94); } to { transform: rotate(-7deg) scale(1); } }
.wipe { position: absolute; inset: 0; background: var(--ground-2); transform-origin: bottom center; animation: wipe 1.1s var(--ease-io) both; animation-delay: var(--d, 0ms); }
@keyframes wipe { from { transform: scaleY(1); } to { transform: scaleY(0); } }
.scanband { position: absolute; left: 0; right: 0; top: 0; height: 22%; background: linear-gradient(180deg, transparent, rgba(95, 196, 214, .14), transparent); animation: scanband 6s linear infinite; will-change: transform; }
@keyframes scanband { from { transform: translateY(-100%); } to { transform: translateY(560%); } }
.pulse-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--blood); animation: pulse 2s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .2; } }

/* ---------- Téléphone (390 × 844) ---------- */
.ph { position: absolute; inset: 0; display: flex; flex-direction: column; }
.ph-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 18px 20px 14px; border-bottom: 1px solid var(--line); --fs: 11px; }
.ph-scroll { flex: 1; min-height: 0; overflow-y: auto; padding: 22px 20px 28px; display: flex; flex-direction: column; gap: 26px; scrollbar-width: none; }
.ph-scroll::-webkit-scrollbar { display: none; }
.ph-cta { padding: 14px 20px calc(18px + env(safe-area-inset-bottom, 0px)); border-top: 1px solid var(--line); background: linear-gradient(180deg, rgba(7, 11, 13, .6), var(--ground) 30%); display: flex; flex-direction: column; gap: 10px; }
.ph-cta .label { --fs: 11px; text-align: center; }
.ph h1.display { font-size: 58px; }
.ph p { margin: 0; font-size: 17px; line-height: 1.5; color: var(--muted-2); }
.sec { display: flex; flex-direction: column; gap: 12px; }
.sec > .label { --fs: 11px; padding-bottom: 8px; border-bottom: 1px solid var(--line); }

.field { display: flex; flex-direction: column; gap: 8px; }
.field .label { --fs: 11px; }
.field input { appearance: none; width: 100%; min-height: 58px; padding: 0 16px; border: 0; background: var(--panel); box-shadow: inset 0 -2px 0 var(--line-2); font-size: 22px; font-weight: 600; color: var(--fg-strong); transition: box-shadow var(--t-fast) linear; }
.field input:focus { outline: none; box-shadow: inset 0 -2px 0 var(--cyan); }
.stepper { display: grid; grid-template-columns: 58px minmax(0, 1fr) 58px; align-items: center; background: var(--panel); }
.stepper button { appearance: none; border: 0; height: 58px; background: transparent; font-family: var(--f-display); font-size: 34px; font-weight: 800; color: var(--cyan); cursor: pointer; transition: transform var(--t-fast) var(--ease-out); }
.stepper button:active { transform: scale(.9); }
.stepper output { text-align: center; font-family: var(--f-display); font-weight: 800; font-size: 38px; color: var(--fg-strong); }
.bump { animation: bump var(--t-med) var(--ease-out); }
@keyframes bump { 40% { transform: scale(1.25); } }

.opt { appearance: none; border: 0; width: 100%; text-align: left; cursor: pointer; display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 12px; min-height: 64px; padding: 12px 16px; background: var(--panel); box-shadow: inset 0 0 0 1px var(--line); transition: transform var(--t-fast) var(--ease-out), background-color var(--t-fast) linear; }
.opt:active { transform: scale(.98); }
.opt b { display: block; font-family: var(--f-display); font-weight: 800; font-size: 25px; line-height: 1; text-transform: uppercase; color: var(--fg-strong); }
.opt small { display: block; margin-top: 5px; font-size: 14px; color: var(--muted); }
.opt .on-tv { --fs: 10px; color: var(--ground); background: var(--cyan); padding: 5px 8px; opacity: 0; transform: scale(.8); transition: opacity var(--t-fast) linear, transform var(--t-med) var(--ease-out); }
.opt[aria-pressed="true"] { background: var(--cyan-deep); box-shadow: inset 0 0 0 1px var(--cyan); }
.opt[aria-pressed="true"] .on-tv { opacity: 1; transform: none; }

.faces { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 8px; }
.face { appearance: none; border: 0; padding: 0; background: none; cursor: pointer; display: flex; flex-direction: column; gap: 6px; text-align: center; position: relative; transition: transform var(--t-fast) var(--ease-out), opacity var(--t-fast) linear; }
.face:active { transform: scale(.95); }
.face .portrait { width: 100%; }
.face .brackets { --l: 12px; inset: -4px; bottom: auto; aspect-ratio: 4 / 5.2; opacity: 0; transform: scale(1.08); transition: opacity var(--t-fast) linear, transform var(--t-med) var(--ease-out); }
.face span.n { font-family: var(--f-mono); font-size: 10px; letter-spacing: .06em; text-transform: uppercase; color: var(--muted-2); }
.face[aria-pressed="true"] .brackets { opacity: 1; transform: none; }
.face[aria-pressed="true"] span.n { color: var(--cyan); }
.face[disabled] { opacity: .3; cursor: default; }
.face .tag { position: absolute; top: 4px; right: 4px; font-family: var(--f-mono); font-size: 9px; padding: 2px 4px; background: var(--ground); color: var(--muted-2); }

.scrim { position: absolute; inset: 0; background: rgba(0, 0, 0, .6); opacity: 0; pointer-events: none; transition: opacity var(--t-med) linear; z-index: 20; }
.scrim.open { opacity: 1; pointer-events: auto; }
.sheet { position: absolute; left: 0; right: 0; bottom: 0; z-index: 21; padding: 22px 20px calc(22px + env(safe-area-inset-bottom, 0px)); background: var(--ground-2); box-shadow: 0 -1px 0 var(--line-2); display: flex; flex-direction: column; gap: 14px; transform: translateY(105%); visibility: hidden; transition: transform var(--t-med) var(--ease-out), visibility 0s linear var(--t-med); will-change: transform; }
.sheet.open { transform: none; visibility: visible; transition: transform var(--t-med) var(--ease-out), visibility 0s; }
.sheet h2 { font-size: 36px; }
.sheet .row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

/* ---------- Outils de l'appli ---------- */
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

/* Écrans successifs : l'ancien s'efface en opacité pendant que le nouveau entre. */
.screen { position: absolute; inset: 0; }
.screen.leaving { animation: leave var(--t-med) linear both; pointer-events: none; }
@keyframes leave { to { opacity: 0; } }

/* Message éphémère (erreurs renvoyées par le serveur) */
.toast {
  position: fixed; left: 50%; top: calc(14px + env(safe-area-inset-top, 0px)); z-index: 60; max-width: min(92vw, 480px);
  padding: 12px 16px; background: var(--blood-deep); box-shadow: inset 0 0 0 1px var(--blood);
  font-size: 15px; line-height: 1.4; color: var(--fg-strong);
  transform: translate(-50%, -16px); opacity: 0; pointer-events: none;
  transition: transform var(--t-med) var(--ease-out), opacity var(--t-fast) linear;
}
.toast.show { transform: translate(-50%, 0); opacity: 1; }
.toast.info { background: var(--cyan-deep); box-shadow: inset 0 0 0 1px var(--cyan); }

/* Connexion perdue */
.net { position: fixed; right: 14px; bottom: calc(14px + env(safe-area-inset-bottom, 0px)); z-index: 70; display: flex; align-items: center; gap: 10px; padding: 8px 12px; background: rgba(7, 11, 13, .9); box-shadow: inset 0 0 0 1px var(--line-2); font-family: var(--f-mono); font-size: 11px; letter-spacing: .12em; text-transform: uppercase; color: var(--muted-2); opacity: 0; transform: translateY(8px); transition: opacity var(--t-med) linear, transform var(--t-med) var(--ease-out); pointer-events: none; }
.net.show { opacity: 1; transform: none; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 1ms !important; animation-iteration-count: 1 !important; transition-duration: 1ms !important; }
  .fx-grain, .scanband { display: none; }
}
