/* =====================================================================
   Musée des Réussites de l'Humanité — système de design · Licence MIT
   Polices : Inter & Space Grotesk (SIL OFL 1.1), hébergées localement.
   ===================================================================== */
@font-face { font-family: "Inter"; src: url("fonts/inter-latin-wght-normal.woff2") format("woff2"); font-weight: 100 900; font-display: swap; }
@font-face { font-family: "Space Grotesk"; src: url("fonts/space-grotesk-latin-wght-normal.woff2") format("woff2"); font-weight: 300 700; font-display: swap; }

/* ---------- Jetons : thème sombre (par défaut) ---------- */
:root {
  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --display: "Space Grotesk", "Inter", system-ui, sans-serif;
  --fs: 15px;

  --bg: #070915;
  --surface: rgba(14, 17, 38, 0.74);
  --surface-solid: #11142b;
  --surface-2: rgba(255, 255, 255, 0.05);
  --surface-3: rgba(255, 255, 255, 0.09);
  --line: rgba(255, 255, 255, 0.1);
  --line-strong: rgba(255, 255, 255, 0.2);
  --text: #eceefb;
  --muted: #9aa1c7;
  --accent: #ffd34d;          /* or « Nuit de l'Info » */
  --accent-ink: #ffd34d;      /* or utilisé comme couleur de texte */
  --on-accent: #1d1600;
  --future: #b892ff;
  --danger: #ff6b8e;
  --ok: #6fdc8c;

  --r-sm: 8px; --r: 12px; --r-lg: 18px;
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.45), 0 2px 8px rgba(0, 0, 0, 0.25);
  --blur: blur(16px) saturate(150%);
  --ease: cubic-bezier(.2, .7, .2, 1);
}

/* ---------- Jetons : thème clair ---------- */
body.light {
  --bg: #eef1f8;
  --surface: rgba(255, 255, 255, 0.8);
  --surface-solid: #ffffff;
  --surface-2: rgba(22, 26, 64, 0.04);
  --surface-3: rgba(22, 26, 64, 0.08);
  --line: rgba(22, 26, 64, 0.11);
  --line-strong: rgba(22, 26, 64, 0.22);
  --text: #161a2e;
  --muted: #50567a;
  --accent-ink: #8a5d00;
  --future: #6c35c9;
  --danger: #c0274f;
  --ok: #1d7a3a;
  --shadow: 0 18px 50px rgba(40, 44, 90, 0.16), 0 2px 6px rgba(40, 44, 90, 0.08);
}

/* ---------- Contraste élevé (prioritaire) ---------- */
body.contrast { --bg: #000; --surface: #000; --surface-solid: #000; --surface-2: #000; --surface-3: #111; --line: #fff; --line-strong: #fff;
  --text: #fff; --muted: #fff; --accent-ink: #ffd34d; --blur: none; }
body.light.contrast { --bg: #fff; --surface: #fff; --surface-solid: #fff; --surface-2: #fff; --surface-3: #eee; --line: #000; --line-strong: #000;
  --text: #000; --muted: #000; --accent-ink: #000; }
body.contrast .card, body.contrast .side, body.contrast button { border-width: 2px; }
body.big { --fs: 18.5px; }

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: var(--bg); color: var(--text);
  font: 400 var(--fs)/1.55 var(--font); -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; }
h1, h2, h3 { font-family: var(--display); font-weight: 600; letter-spacing: -0.01em; line-height: 1.15; }
h2 { font-size: 1.45rem; margin: 0 0 .9rem; display: flex; align-items: center; gap: .55rem; }
h2 .ic-wrap { color: var(--accent-ink); }
p { margin: .5rem 0; }
.lead { color: var(--muted); font-size: 1.02em; }
.hint { color: var(--muted); font-size: .88em; }
.num { font-variant-numeric: tabular-nums; }
.kicker { margin: 0 0 .3rem; color: var(--accent-ink); text-transform: uppercase; letter-spacing: .14em; font-size: .72em; font-weight: 600; }
kbd { display: inline-block; min-width: 1.6em; text-align: center; font: 600 .8em/1.5 var(--font); padding: 0 .4em; margin: 0 .08em;
  border-radius: 6px; background: var(--surface-3); border: 1px solid var(--line-strong); border-bottom-width: 2px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
body.light :focus-visible { outline-color: var(--future); }
[hidden] { display: none !important; }

#app { position: fixed; inset: 0; }
#app canvas { display: block; touch-action: none; cursor: grab; }
#app canvas:active { cursor: grabbing; }

/* ---------- Icônes ---------- */
.ic { width: 1.15em; height: 1.15em; flex: none; stroke-width: 1.9; }
.ic-wrap { display: inline-flex; }

/* ---------- Boutons ---------- */
button { font: 500 .95em/1 var(--font); color: var(--text); background: var(--surface-2); border: 1px solid var(--line);
  border-radius: var(--r-sm); padding: .65em 1em; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: .5em;
  transition: background .15s var(--ease), border-color .15s var(--ease), transform .15s var(--ease), box-shadow .15s var(--ease); }
button:hover { background: var(--surface-3); border-color: var(--line-strong); }
button:active { transform: translateY(1px); }
button:disabled { opacity: .4; cursor: not-allowed; }
button.primary { background: var(--accent); border-color: transparent; color: var(--on-accent); font-weight: 600;
  box-shadow: 0 6px 20px rgba(255, 211, 77, .22); }
button.primary:hover { background: #ffdc6e; box-shadow: 0 8px 26px rgba(255, 211, 77, .32); }
button.ghost { background: transparent; border-color: transparent; color: var(--muted); }
button.ghost:hover { color: var(--text); background: var(--surface-2); }
button.lg { padding: .85em 1.35em; font-size: 1em; border-radius: var(--r); }
.icon-btn { padding: 0; width: 36px; height: 36px; border-radius: var(--r-sm); }
.icon-btn.on { background: var(--accent); color: var(--on-accent); border-color: transparent; }
body.contrast button.primary { background: var(--text); color: var(--bg); box-shadow: none; }

.skip { position: absolute; left: -999px; top: 8px; z-index: 100; background: var(--accent); color: #000; padding: .5em 1em; border-radius: 8px; }
.skip:focus { left: 8px; }

/* ---------- Surfaces ---------- */
.overlay { position: fixed; inset: 0; z-index: 30; display: grid; place-items: center; padding: 1.2rem;
  background: rgba(4, 5, 14, 0.62); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); animation: fade .25s var(--ease); }
body.light .overlay { background: rgba(214, 220, 238, 0.6); }
.overlay.scroll { place-items: start center; overflow-y: auto; }
@keyframes fade { from { opacity: 0; } }
.card { position: relative; width: min(560px, 100%); max-height: calc(100vh - 2.4rem); overflow-y: auto;
  background: var(--surface); -webkit-backdrop-filter: var(--blur); backdrop-filter: var(--blur);
  border: 1px solid var(--line); border-radius: var(--r-lg); padding: 1.7rem 1.9rem; box-shadow: var(--shadow);
  animation: rise .3s var(--ease); }
.overlay.scroll .card { max-height: none; }
.card.wide { width: min(860px, 100%); }
@keyframes rise { from { transform: translateY(10px); opacity: 0; } }
.close { position: absolute; top: .9rem; right: .9rem; }
.actions { display: flex; gap: .6rem; flex-wrap: wrap; justify-content: center; margin: 1.3rem 0 .3rem; }
.actions.left { justify-content: flex-start; }
.actions.secondary { margin-top: .2rem; gap: .2rem; }

/* Formulaires */
.card label { display: block; margin: .65rem 0; font-size: .93em; color: var(--muted); }
.card input:not([type=checkbox]):not([type=range]), .card textarea, .card select, .demo input, .demo select {
  display: block; width: 100%; margin-top: .35rem; padding: .62em .8em; font: inherit; font-size: 1rem; color: var(--text);
  background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--r-sm); transition: border-color .15s; }
.card input:focus, .card textarea:focus, .card select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(255, 211, 77, .18); }
.card select { width: auto; display: inline-block; margin: 0 0 0 .5rem; }
.card select option { background: var(--surface-solid); color: var(--text); }
fieldset { border: 1px solid var(--line); border-radius: var(--r); padding: .4rem 1rem .6rem; margin: 0 0 .9rem; }
legend { padding: 0 .4rem; font: 600 .72em var(--font); text-transform: uppercase; letter-spacing: .12em; color: var(--accent-ink); }
.card label.row { display: flex; align-items: center; justify-content: space-between; gap: 1rem; color: var(--text); }
.card label.row input[type=range] { width: 45%; accent-color: var(--accent); }
/* Interrupteurs */
.switch { display: flex !important; align-items: center; gap: .8rem; color: var(--text) !important; cursor: pointer; }
.switch input { appearance: none; -webkit-appearance: none; flex: none; width: 38px; height: 22px; margin: 0; border-radius: 99px;
  background: var(--surface-3); border: 1px solid var(--line-strong); position: relative; cursor: pointer; transition: background .2s; }
.switch input::after { content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%;
  background: var(--text); transition: transform .2s var(--ease); }
.switch input:checked { background: var(--accent); border-color: transparent; }
.switch input:checked::after { transform: translateX(16px); background: var(--on-accent); }
.grid-form { display: grid; grid-template-columns: 1fr 1fr; gap: 0 1rem; }
.grid-form .full { grid-column: 1 / -1; }
.form-end { display: flex; align-items: end; justify-content: flex-end; padding-bottom: .65rem; }

/* ---------- Marque ---------- */
.brand { display: inline-flex; align-items: center; gap: .55rem; font: 600 1rem var(--display); letter-spacing: .01em; }
.brand.small { font-size: .9rem; }
.brand-mark { width: 26px; height: 26px; border-radius: 50%; flex: none;
  background: radial-gradient(circle at 68% 38%, transparent 42%, var(--accent) 43%); box-shadow: 0 0 18px rgba(255, 211, 77, .35);
  border: 1px solid rgba(255, 211, 77, .4); }
.brand-mark.lg { width: 56px; height: 56px; margin: 0 auto .6rem; }

/* ---------- Chargement ---------- */
#loader { position: fixed; inset: 0; z-index: 60; display: grid; place-content: center; justify-items: center; gap: .9rem;
  background: radial-gradient(circle at 50% 40%, #1a1740, #04050c 70%); color: var(--muted); transition: opacity .6s; }
body.light #loader { background: radial-gradient(circle at 50% 40%, #fff7e3, #dfe5f4 70%); }
#loader.done { opacity: 0; pointer-events: none; }
.loader-bar { width: 180px; height: 3px; border-radius: 3px; background: var(--surface-3); overflow: hidden; }
.loader-bar span { display: block; height: 100%; width: 40%; background: linear-gradient(90deg, var(--accent), var(--future));
  animation: load 1.1s var(--ease) infinite; }
@keyframes load { from { transform: translateX(-100%); } to { transform: translateX(260%); } }
#flash { position: fixed; inset: 0; z-index: 50; pointer-events: none; opacity: 0;
  background: radial-gradient(circle, #fff 0%, #e8dcff 40%, rgba(143, 107, 255, 0) 75%); }
body.light #flash { background: radial-gradient(circle, #fff 0%, #fff4d6 45%, rgba(255, 244, 214, 0) 75%); }
#flash.go { animation: flash 1.1s ease-out; }
@keyframes flash { 0% { opacity: 1; transform: scale(.4); } 100% { opacity: 0; transform: scale(2.2); } }

/* ---------- Accueil ---------- */
#intro { overflow: hidden; background: radial-gradient(ellipse at 50% 115%, #3a1f73 0%, #0d0d26 45%, #03040b 100%);
  -webkit-backdrop-filter: none; backdrop-filter: none; }
body.light #intro { background: linear-gradient(180deg, #fbe7c6 0%, #f4d7e6 35%, #dfe6f8 72%, #eef1f8 100%); }
#intro::before, #intro::after { content: ""; position: absolute; inset: -50%; pointer-events: none;
  background-image:
    radial-gradient(1.5px 1.5px at 10% 20%, #fff 50%, transparent 51%), radial-gradient(1px 1px at 30% 70%, #cfe0ff 50%, transparent 51%),
    radial-gradient(1.2px 1.2px at 55% 35%, #fff 50%, transparent 51%), radial-gradient(1px 1px at 75% 85%, #ffe9a8 50%, transparent 51%),
    radial-gradient(1.6px 1.6px at 90% 15%, #fff 50%, transparent 51%), radial-gradient(1px 1px at 45% 55%, #e6d4ff 50%, transparent 51%);
  background-size: 280px 280px; animation: drift 90s linear infinite; opacity: .75; }
#intro::after { background-size: 430px 430px; animation-duration: 160s; opacity: .45; }
body.light #intro::before, body.light #intro::after { opacity: .18; filter: invert(1); }
@keyframes drift { to { transform: translate(140px, -280px); } }
.intro-top { position: absolute; top: 0; left: 0; right: 0; display: flex; justify-content: space-between; align-items: center;
  padding: 1rem 1.3rem; z-index: 2; }
.intro-top .icon-btn { background: var(--surface); }
.intro-card { text-align: center; width: min(660px, 100%); padding: 2.4rem 2.4rem 1.6rem; z-index: 1;
  background: rgba(12, 14, 34, 0.6); border-color: rgba(184, 146, 255, .28);
  box-shadow: var(--shadow), 0 0 140px rgba(143, 107, 255, .22); }
body.light .intro-card { background: rgba(255, 255, 255, 0.7); border-color: rgba(108, 53, 201, .2); box-shadow: var(--shadow), 0 0 140px rgba(255, 211, 77, .25); }
#intro h1 { font-size: clamp(2rem, 5vw, 3.2rem); margin: .35rem 0 .2rem; letter-spacing: -0.025em;
  background: linear-gradient(92deg, #fff 10%, #ffe7a3 55%, #e0c8ff 90%); -webkit-background-clip: text; background-clip: text; color: transparent; }
body.light #intro h1 { background-image: linear-gradient(92deg, #221a52 10%, #6c35c9 60%, #8a5d00 95%); }
.years { display: flex; align-items: center; justify-content: center; gap: .8rem; margin: .4rem 0 1.1rem;
  font: 600 1.15rem var(--display); letter-spacing: .1em; color: var(--accent-ink); }
.years i { width: 90px; height: 2px; border-radius: 2px; background: linear-gradient(90deg, var(--accent), var(--future)); position: relative; }
.years i::after { content: ""; position: absolute; right: -2px; top: -3px; border: 4px solid transparent; border-left: 6px solid var(--future); }
.years .fut { color: var(--future); }
.story { color: var(--muted); max-width: 52ch; margin: 0 auto; }
.story strong { color: var(--text); font-weight: 600; }
.facts { list-style: none; display: flex; justify-content: center; gap: 1.6rem; flex-wrap: wrap; padding: 1rem 0 0; margin: 1.1rem 0 0;
  border-top: 1px solid var(--line); color: var(--muted); font-size: .85em; }
.facts b { display: block; font: 600 1.35rem var(--display); color: var(--text); }
body.calm #intro::before, body.calm #intro::after, body.calm .loader-bar span { animation: none; }

/* ---------- HUD ---------- */
#hud { position: fixed; top: 0; left: 0; right: 0; z-index: 10; display: flex; justify-content: space-between; align-items: center;
  gap: .8rem; padding: .75rem 1rem; pointer-events: none; flex-wrap: wrap; }
#hud > * { pointer-events: auto; }
.hud-left { display: flex; align-items: center; gap: .7rem; }
.hud-left .brand { padding: .5rem .8rem; border-radius: var(--r); background: var(--surface); border: 1px solid var(--line);
  -webkit-backdrop-filter: var(--blur); backdrop-filter: var(--blur); }
.memory { display: flex; align-items: center; gap: .65rem; padding: .5rem .85rem; border-radius: var(--r); font-size: .84em;
  background: var(--surface); border: 1px solid var(--line); -webkit-backdrop-filter: var(--blur); backdrop-filter: var(--blur); }
.memory .label { display: inline-flex; align-items: center; gap: .35rem; color: var(--future); font-weight: 600; }
.bar { width: 130px; height: 6px; border-radius: 6px; background: var(--surface-3); overflow: hidden; }
.bar > div { height: 100%; width: 100%; border-radius: 6px; background: linear-gradient(90deg, var(--danger), var(--future), var(--accent)); transition: width .5s var(--ease); }
.restored { color: var(--muted); padding-left: .65rem; border-left: 1px solid var(--line); }
.memory.low { border-color: var(--danger); animation: low 1.4s ease-in-out infinite; }
.memory.low .label { color: var(--danger); }
@keyframes low { 50% { box-shadow: 0 0 0 4px rgba(255, 107, 142, .22), 0 0 22px rgba(255, 107, 142, .3); } }
body.calm .memory.low { animation: none; box-shadow: 0 0 0 3px rgba(255, 107, 142, .4); }

.hud-actions { display: flex; align-items: center; gap: .2rem; padding: .3rem; border-radius: var(--r);
  background: var(--surface); border: 1px solid var(--line); -webkit-backdrop-filter: var(--blur); backdrop-filter: var(--blur); }
.tb { height: 36px; padding: 0 .75rem; background: transparent; border-color: transparent; font-size: .86em; color: var(--text); }
.tb:hover { background: var(--surface-3); border-color: transparent; }
.tb.icon-only { width: 36px; padding: 0; }
.tb .ic { color: var(--muted); }
.tb:hover .ic { color: var(--text); }
.hud-actions .sep { width: 1px; height: 20px; background: var(--line); margin: 0 .25rem; }

/* ---------- Viseur, invite, astuce, toast ---------- */
#crosshair { position: fixed; left: 50%; top: 50%; width: 8px; height: 8px; margin: -4px; border-radius: 50%; z-index: 5; pointer-events: none;
  background: rgba(255, 255, 255, .9); box-shadow: 0 0 0 2px rgba(0, 0, 0, .25); transition: transform .15s, background .15s; }
body.light #crosshair { background: #161a2e; box-shadow: 0 0 0 2px rgba(255, 255, 255, .8); }
body:has(#prompt:not([hidden])) #crosshair { transform: scale(1.8); background: var(--accent); }
#prompt { position: fixed; left: 50%; top: calc(50% + 26px); transform: translateX(-50%); z-index: 5; pointer-events: none; white-space: nowrap;
  padding: .4rem .8rem; border-radius: 99px; font-size: .84em; font-weight: 500;
  background: var(--surface); border: 1px solid var(--line-strong); -webkit-backdrop-filter: var(--blur); backdrop-filter: var(--blur); }
#hint { position: fixed; left: 50%; bottom: 5.6rem; transform: translateX(-50%); z-index: 9; pointer-events: none; white-space: nowrap;
  display: flex; align-items: center; gap: .45rem; padding: .45rem 1rem; border-radius: 99px; font-size: .84em;
  background: var(--surface); border: 1px solid var(--line); -webkit-backdrop-filter: var(--blur); backdrop-filter: var(--blur); }
#toast { position: fixed; left: 50%; top: 4.6rem; transform: translate(-50%, -8px); z-index: 40; pointer-events: none;
  padding: .55rem 1rem; border-radius: var(--r); font-size: .9em; font-weight: 500; opacity: 0;
  background: var(--surface-solid); border: 1px solid var(--line-strong); box-shadow: var(--shadow); transition: opacity .25s, transform .25s var(--ease); }
#toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- Bandeau de salle ---------- */
#room-banner { position: fixed; left: 50%; bottom: 9.6rem; transform: translate(-50%, 10px); z-index: 7; text-align: center; pointer-events: none;
  opacity: 0; width: min(640px, 90vw); text-shadow: 0 2px 18px rgba(0, 0, 0, .85); }
#room-banner h3 { margin: .1rem 0; font-size: clamp(1.7rem, 4vw, 2.7rem); color: var(--room, var(--accent)); }
#room-banner h3::after { content: ""; display: block; height: 2px; width: 36%; margin: .45rem auto 0; border-radius: 2px;
  background: linear-gradient(90deg, transparent, var(--room, var(--accent)), transparent); }
#room-banner p { margin: .3rem 0 0; color: #eef0ff; }
body.light #room-banner { text-shadow: 0 1px 0 rgba(255, 255, 255, .9), 0 0 22px rgba(255, 255, 255, .95); }
body.light #room-banner p { color: var(--text); }
body.light #room-banner h3 { filter: brightness(.75) saturate(1.3); }
#room-banner.show { animation: banner 4.2s ease forwards; }
@keyframes banner { 0% { opacity: 0; transform: translate(-50%, 14px); } 12%, 75% { opacity: 1; transform: translate(-50%, 0); } 100% { opacity: 0; transform: translate(-50%, -6px); } }
body.calm #room-banner.show { animation-name: banner-calm; }
@keyframes banner-calm { 0%, 80% { opacity: 1; transform: translate(-50%, 0); } 100% { opacity: 0; transform: translate(-50%, 0); } }

/* ---------- Plan & frise ---------- */
#minimap { position: fixed; right: 1rem; bottom: 5.4rem; z-index: 8; width: 150px; height: 205px; cursor: pointer;
  border-radius: var(--r); background: var(--surface); border: 1px solid var(--line); -webkit-backdrop-filter: var(--blur); backdrop-filter: var(--blur);
  transition: width .25s var(--ease), height .25s var(--ease); }
#minimap.big { width: 290px; height: 396px; }
body:has(#panel:not([hidden])) #minimap { display: none; }
#timeline { position: fixed; left: 1rem; right: 1rem; bottom: 1rem; height: 3.3rem; z-index: 8; border-radius: var(--r);
  background: var(--surface); border: 1px solid var(--line); -webkit-backdrop-filter: var(--blur); backdrop-filter: var(--blur); }
#timeline .axis { position: absolute; left: 3%; right: 3%; top: 50%; height: 2px; border-radius: 2px;
  background: linear-gradient(90deg, var(--accent) 50%, var(--future) 50%); opacity: .8; }
#timeline .tick { position: absolute; top: 64%; transform: translateX(-50%); font-size: .68em; color: var(--muted); pointer-events: none; font-variant-numeric: tabular-nums; }
#timeline .now { position: absolute; top: 6%; transform: translateX(-50%); font-size: .66em; font-weight: 600; color: var(--danger);
  text-transform: uppercase; letter-spacing: .08em; pointer-events: none; }
#timeline button.dot { position: absolute; top: 50%; width: 14px; height: 14px; padding: 0; border-radius: 50%; transform: translate(-50%, -50%);
  border: 2px solid var(--surface-solid); box-shadow: 0 0 0 1px var(--line-strong), 0 0 10px rgba(0, 0, 0, .3); transition: transform .15s var(--ease); }
#timeline button.dot:hover, #timeline button.dot:focus-visible { transform: translate(-50%, -50%) scale(1.5); z-index: 2; }
#timeline button.dot.faded { opacity: .35; }

#dpad { position: fixed; left: 1rem; bottom: 5.4rem; z-index: 9; display: grid; grid-template-columns: repeat(3, 52px); grid-template-rows: repeat(2, 52px); gap: 6px; }
#dpad button { background: var(--surface); font-size: 1.1rem; touch-action: none; user-select: none; -webkit-user-select: none;
  -webkit-backdrop-filter: var(--blur); backdrop-filter: var(--blur); }
#dpad [data-move=f] { grid-column: 2; grid-row: 1; }
#dpad [data-move=l] { grid-column: 1; grid-row: 2; }
#dpad [data-move=b] { grid-column: 2; grid-row: 2; }
#dpad [data-move=r] { grid-column: 3; grid-row: 2; }

/* ---------- Fiche d'œuvre ---------- */
.side { position: fixed; top: 4.4rem; right: 1rem; bottom: 5.2rem; width: min(430px, calc(100% - 2rem)); z-index: 20; overflow-y: auto;
  padding: 1.3rem 1.5rem 1.4rem; border-radius: var(--r-lg); background: var(--surface); border: 1px solid var(--line);
  border-top: 3px solid var(--room, var(--accent)); box-shadow: var(--shadow); -webkit-backdrop-filter: var(--blur); backdrop-filter: var(--blur);
  animation: slide .3s var(--ease); scrollbar-width: thin; }
.side::before { content: ""; position: absolute; inset: 0 0 auto 0; height: 150px; pointer-events: none; border-radius: inherit;
  background: radial-gradient(ellipse at 15% 0%, color-mix(in srgb, var(--room, #ffd34d) 26%, transparent), transparent 70%); }
body.calm .side { animation: none; }
@keyframes slide { from { transform: translateX(24px); opacity: 0; } }
.p-head { display: flex; justify-content: space-between; align-items: flex-start; position: relative; }
.p-head .close { position: static; }
.big-year { margin: 0; font: 700 3.4rem/1 var(--display); letter-spacing: -.03em;
  background: linear-gradient(180deg, var(--text), var(--room, var(--accent))); -webkit-background-clip: text; background-clip: text; color: transparent; }
.big-year.future::after { content: " ✦"; font-size: .4em; vertical-align: super; -webkit-text-fill-color: var(--future); }
.side h2 { font-size: 1.4rem; margin: .1rem 0 .55rem; display: block; }
.side #p-meta { margin-top: .5rem; }
.badge { display: inline-flex; align-items: center; margin: 0 0 .8rem; padding: .2em .7em; border-radius: 99px; font-size: .74em; font-weight: 600; letter-spacing: .02em; }
.badge.reel { background: rgba(255, 211, 77, .15); color: var(--accent-ink); }
.badge.nuit { background: rgba(110, 160, 255, .17); color: #9cc0ff; }
.badge.futur { background: rgba(184, 146, 255, .17); color: var(--future); }
body.light .badge.reel { background: #fff1c2; color: #7a5200; }
body.light .badge.nuit { background: #dde8ff; color: #1f4fb8; }
body.light .badge.futur { background: #eee0ff; color: #5b23b0; }
.memory-mini { display: flex; align-items: center; gap: .6rem; font-size: .78em; color: var(--muted); padding: .55rem .7rem;
  border-radius: var(--r-sm); background: var(--surface-2); }
.memory-mini .bar { flex: 1; }
#p-mem-pct { min-width: 3.2em; text-align: right; }
.ex-text { white-space: pre-wrap; font-size: 1.01em; line-height: 1.65; margin: .9rem 0; }
.ex-text.glitch { animation: glitch 1.2s steps(2) infinite; }
body.calm .ex-text.glitch { animation: none; }
@keyframes glitch { 50% { text-shadow: 2px 0 var(--danger), -2px 0 #2ad4c9; } }
.side .actions { justify-content: stretch; margin-top: .6rem; }
.side .actions button { flex: 1 1 auto; }
#p-quiz { margin-top: 1rem; padding-top: 1rem; border-top: 1px solid var(--line); }
#p-quiz .choices { display: grid; gap: .45rem; margin-top: .6rem; }
#p-quiz .choices button { justify-content: flex-start; text-align: left; line-height: 1.35; padding: .75em 1em; }
#p-quiz .ok { color: var(--ok); font-weight: 600; }
#p-quiz .ko { color: var(--danger); font-weight: 600; }
.tour-nav { margin-top: 1.1rem; padding-top: .9rem; border-top: 1px solid var(--line); }
.tour-progress { height: 3px; border-radius: 3px; background: var(--surface-3); overflow: hidden; margin-bottom: .75rem; }
#p-tour-bar { height: 100%; width: 0; background: linear-gradient(90deg, var(--accent), var(--future)); transition: width .4s var(--ease); }
.tour-row { display: flex; align-items: center; gap: .4rem; }
.tour-row #p-step { color: var(--muted); font-size: .85em; margin-right: auto; padding-left: .3rem; }

/* Démos (sujets 2018 et 2020) */
.demo { margin: .9rem 0; padding: .9rem 1rem; border-radius: var(--r); background: var(--surface-2); border: 1px solid var(--line); }
.demo h3 { margin: 0 0 .6rem; font-size: .9em; color: var(--accent-ink); letter-spacing: .01em; }
.gauges { display: grid; grid-template-columns: repeat(2, 1fr); gap: .45rem; font-size: .8em; color: var(--muted); }
.gauges div { background: var(--surface-2); border: 1px solid var(--line); padding: .5rem .6rem; border-radius: var(--r-sm); }
.gauges b { display: block; font: 600 1.35em var(--display); color: var(--text); font-variant-numeric: tabular-nums; }
.alert { margin-top: .55rem; padding: .5rem .7rem; border-radius: var(--r-sm); font-size: .85em; background: rgba(255, 107, 142, .14); color: var(--danger);
  border: 1px solid rgba(255, 107, 142, .35); }
.demo label { display: block; margin: .4rem 0; font-size: .88em; }
.demo input[type=checkbox] { accent-color: var(--accent); }
.surf-bars { display: flex; align-items: flex-end; gap: 4px; height: 60px; margin-top: .6rem; }
.surf-bars div { flex: 1; background: #2ad4c9; border-radius: 3px 3px 0 0; min-height: 3px; }

/* ---------- Guide (onglets) ---------- */
.tabs { display: flex; gap: .2rem; padding: .25rem; margin: 0 0 1.1rem; border-radius: var(--r); background: var(--surface-2); border: 1px solid var(--line); overflow-x: auto; }
.tabs [role=tab] { flex: 1; background: transparent; border: none; color: var(--muted); padding: .6em .9em; white-space: nowrap; }
.tabs [role=tab][aria-selected=true] { background: var(--surface-solid); color: var(--text); box-shadow: 0 1px 4px rgba(0, 0, 0, .25); }
.pane { min-height: 260px; }
.steps { counter-reset: s; list-style: none; padding: 0; margin: 0; display: grid; gap: .65rem; }
.steps li { counter-increment: s; position: relative; padding: .7rem .9rem .7rem 3rem; border-radius: var(--r); background: var(--surface-2); border: 1px solid var(--line); }
.steps li::before { content: counter(s); position: absolute; left: .85rem; top: .7rem; width: 1.6rem; height: 1.6rem; border-radius: 50%;
  display: grid; place-items: center; font: 600 .8rem var(--display); background: var(--accent); color: var(--on-accent); }
.legend { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem .6rem; margin: 1rem 0 0; font-size: .85em; color: var(--muted); }
.legend .badge { margin: 0; }
.keys { width: 100%; border-collapse: collapse; font-size: .92em; }
.keys th { text-align: left; font-weight: 500; color: var(--muted); padding: .55rem .5rem .55rem 0; width: 34%; vertical-align: top; }
.keys td { padding: .55rem 0; }
.keys tr + tr th, .keys tr + tr td { border-top: 1px solid var(--line); }
.room-list { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: .6rem; }
.room-list button { width: 100%; height: 100%; display: flex; flex-direction: column; align-items: flex-start; gap: .25rem; text-align: left;
  padding: .85rem 1rem; line-height: 1.4; border-left: 3px solid var(--room); }
.room-list b { font: 600 1rem var(--display); color: var(--text); }
.room-list span { color: var(--muted); font-size: .86em; }
.room-list small { color: var(--room); font-weight: 600; font-variant-numeric: tabular-nums; }
body.light .room-list small { filter: brightness(.7); }
.ticks { list-style: none; padding: 0; margin: 0; display: grid; gap: .5rem; }
.ticks li { padding-left: 1.6rem; position: relative; }
.ticks li::before { content: ""; position: absolute; left: .2rem; top: .45em; width: .7rem; height: .4rem; border-left: 2px solid var(--ok); border-bottom: 2px solid var(--ok); transform: rotate(-45deg); }

/* ---------- Tutoriel interactif ---------- */
#coach-spot { position: fixed; z-index: 44; pointer-events: none; border-radius: var(--r); border: 2px solid var(--accent);
  box-shadow: 0 0 0 9999px rgba(3, 4, 12, .55), 0 0 24px rgba(255, 211, 77, .5); transition: all .35s var(--ease); }
body.light #coach-spot { box-shadow: 0 0 0 9999px rgba(40, 44, 90, .35), 0 0 24px rgba(255, 211, 77, .6); }
#coach { position: fixed; z-index: 45; width: min(360px, calc(100vw - 32px)); padding: 1.1rem 1.2rem 1rem; border-radius: var(--r-lg);
  background: var(--surface-solid); border: 1px solid var(--line-strong); box-shadow: var(--shadow); animation: rise .3s var(--ease); }
#coach.center { left: 50% !important; top: 50% !important; transform: translate(-50%, -50%); animation: none; }
#coach h3 { margin: .1rem 0 .35rem; font-size: 1.15rem; }
#coach p:not(.kicker) { color: var(--muted); margin: 0; }
.coach-dots { display: flex; gap: .3rem; margin: .9rem 0 .2rem; }
.coach-dots i { width: 6px; height: 6px; border-radius: 6px; background: var(--line-strong); transition: width .25s var(--ease); }
.coach-dots i.on { width: 18px; background: var(--accent); }
.coach-actions { display: flex; align-items: center; gap: .4rem; margin-top: .7rem; }
.coach-actions #coach-skip { margin-right: auto; padding-left: 0; }

/* ---------- Mode texte & expo ---------- */
#text-content section { border-top: 1px solid var(--line); padding-top: .7rem; margin-top: 1.1rem; }
#text-content h3 { font-size: 1.15rem; margin: .3rem 0; }
#text-content article { margin: .9rem 0 1.2rem; padding: .9rem 1rem; border-radius: var(--r); background: var(--surface-2); border: 1px solid var(--line); }
#text-content h4 { margin: .1rem 0 .3rem; font: 600 1rem var(--display); }
#expo-list { list-style: none; padding: 0; display: grid; gap: .55rem; margin-top: 1.1rem; }
#expo-list li { padding: .75rem .95rem; border-radius: var(--r); background: var(--surface-2); border: 1px solid var(--line); }
#expo-list small { color: var(--muted); }

/* ---------- Visite guidée par une IA (MCP) ---------- */
  color: var(--accent-ink); margin: 1rem 0 .3rem; padding: .7rem; border-radius: var(--r); background: var(--surface-2); border: 1px dashed var(--line-strong); }
  padding: .85rem 1rem; border-radius: var(--r-lg); background: var(--surface); border: 1px solid var(--future); box-shadow: var(--shadow);
  -webkit-backdrop-filter: var(--blur); backdrop-filter: var(--blur); }
  text-transform: uppercase; letter-spacing: .12em; }

/* ---------- Petits écrans ---------- */
@media (max-width: 1100px) { .tb .t { display: none; } .tb { width: 36px; padding: 0; } .hud-left .brand span:last-child { display: none; } }
@media (max-width: 760px) {
  .hud-left .brand, .restored, .memory .label { display: none; }
  #minimap { width: 104px; height: 142px; bottom: 5rem; }
  .side { top: auto; bottom: 0; right: 0; left: 0; width: 100%; max-height: 64%; border-radius: var(--r-lg) var(--r-lg) 0 0; }
  .grid-form { grid-template-columns: 1fr; }
  .card { padding: 1.3rem 1.2rem; }
  #hint { display: none; }
}

/* Bandeau de salle v3 : pastille compacte sous le HUD (ne masque plus les œuvres) */
#room-banner { top: 4.6rem; bottom: auto; width: auto; max-width: min(560px, 90vw); text-shadow: none !important;
  padding: .65rem 1.2rem .7rem; border-radius: var(--r-lg); background: var(--surface); border: 1px solid var(--line);
  border-left: 3px solid var(--room, var(--accent)); box-shadow: var(--shadow); -webkit-backdrop-filter: var(--blur); backdrop-filter: var(--blur); }
#room-banner .kicker { color: var(--muted); }
#room-banner h3 { font-size: 1.35rem; filter: none !important; }
#room-banner h3::after { display: none; }
#room-banner p { color: var(--muted) !important; font-size: .88em; }
body.light #room-banner h3 { color: color-mix(in srgb, var(--room) 70%, #000); }

/* =====================================================================
   Planète 2046 · Le Journal — un vrai téléviseur dans un salon de 2046
   L'écran reste « plateau télé » (sombre) ; le salon et la télécommande suivent le thème.
   ===================================================================== */
.overlay.tv { z-index: 40; padding: 0; display: grid; place-items: center; overflow: hidden; color: var(--text);
  background:
    radial-gradient(60% 55% at 50% 42%, color-mix(in srgb, var(--seg, #4f8cff) 30%, transparent), transparent 70%),
    linear-gradient(180deg, #0c0f22 0%, #090a18 68%, #15110f 68.2%, #0d0a08 100%); }
.tv-room { width: 100%; height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .55rem; padding: 1rem; }
.tv-room > * { width: min(94vw, calc((100vh - 230px) * 16 / 9)); }

/* --- le poste */
.tv-set { position: relative; padding: 1.1% 1.1% 0; border-radius: 16px;
  background: linear-gradient(180deg, #2c2f39, #131419 60%, #0c0d10);
  box-shadow: 0 0 0 1px rgba(255,255,255,.06) inset, 0 30px 80px rgba(0,0,0,.6), 0 0 140px color-mix(in srgb, var(--seg, #4f8cff) 28%, transparent); }
.tv-screen { position: relative; aspect-ratio: 16 / 9; border-radius: 6px; overflow: hidden; background: #04050b; container-type: inline-size;
  box-shadow: 0 0 0 2px #000, inset 0 0 40px rgba(0,0,0,.8); }
.tv-chin { display: flex; align-items: center; justify-content: center; position: relative; height: 2.4rem; }
.tv-brand { font: 600 .62rem/1 var(--display); letter-spacing: .35em; color: rgba(255,255,255,.35); }
.tv-led { position: absolute; right: 1.2rem; width: 6px; height: 6px; border-radius: 50%; background: #3dff8a; box-shadow: 0 0 8px #3dff8a; }
.tv-stand { width: min(18vw, 220px) !important; height: 26px; margin-top: -.55rem;
  background: linear-gradient(180deg, #1a1b21, #2e3038); clip-path: polygon(30% 0, 70% 0, 100% 100%, 0 100%); border-radius: 0 0 6px 6px;
  filter: drop-shadow(0 10px 12px rgba(0,0,0,.5)); }

/* effets d'écran : reflets, lignes, neige au changement de chaîne */
.tv-screen::after { content: ""; position: absolute; inset: 0; pointer-events: none; z-index: 3;
  background: repeating-linear-gradient(0deg, rgba(255,255,255,.03) 0 1px, transparent 1px 3px); }
.tv-glare { position: absolute; inset: 0; z-index: 4; pointer-events: none;
  background: linear-gradient(118deg, rgba(255,255,255,.10) 0%, rgba(255,255,255,.03) 28%, transparent 40%),
              radial-gradient(120% 95% at 50% 50%, transparent 62%, rgba(0,0,0,.45) 100%); }
.tv-static { position: absolute; inset: 0; z-index: 5; pointer-events: none; opacity: 0;
  background: repeating-radial-gradient(circle at 17% 32%, #fff 0 1px, transparent 1px 3px), repeating-radial-gradient(circle at 73% 61%, #888 0 1px, transparent 1px 2px), #333;
  background-size: 7px 9px, 5px 6px, auto; mix-blend-mode: screen; }
.tv-screen.switch .tv-static { animation: static .38s steps(6) both; }
@keyframes static { 0% { opacity: .9; background-position: 0 0, 0 0; } 50% { opacity: .7; background-position: 3px 5px, 4px 1px; } 100% { opacity: 0; background-position: 6px 2px, 1px 4px; } }
.tv.on .tv-frame { animation: crtOn .75s cubic-bezier(.2,.8,.2,1) both; }
@keyframes crtOn {
  0% { transform: scale(.7, .004); filter: brightness(6); opacity: 1; }
  40% { transform: scale(1, .006); filter: brightness(4); }
  70% { transform: scale(1, 1.02); filter: brightness(1.6); }
  100% { transform: none; filter: none; } }

/* --- contenu du journal : tout est proportionnel à la largeur de l'écran (cqw) */
.tv-frame { position: absolute; inset: 0; display: grid; grid-template-rows: auto 1fr auto auto; gap: 1.3cqw;
  padding: 2.2cqw 3cqw 0; font-size: 1.28cqw; color: #f2f3ff;
  background: radial-gradient(120% 80% at 75% 5%, color-mix(in srgb, var(--seg, #4f8cff) 24%, transparent), transparent 60%),
              linear-gradient(160deg, #070b26 0%, #0e0822 55%, #05050c 100%); }
.tv-top { display: flex; align-items: center; gap: 1.2em; }
.tv-logo { display: flex; align-items: center; gap: .6em; font-family: var(--display); }
.tv-logo b { font-size: 1.35em; letter-spacing: .03em; text-transform: uppercase; }
.tv-logo span:last-child { color: rgba(255,255,255,.6); padding-left: .7em; border-left: 1px solid rgba(255,255,255,.25); }
.tv-dot { width: 1.9em; height: 1.9em; border-radius: 50%; background: conic-gradient(#2ad4c9, #4f8cff, #c98bff, #ff5c8a, #ffd34d, #7ddc5a, #2ad4c9);
  box-shadow: 0 0 1.2em rgba(120,160,255,.6); animation: spin 8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.tv-live { margin-left: auto; position: relative; background: #e11d48; color: #fff; font-weight: 800; font-size: .8em; letter-spacing: .14em;
  padding: .4em .8em .4em 1.7em; border-radius: .3em; }
.tv-live::before { content: ""; position: absolute; left: .7em; top: 50%; width: .55em; height: .55em; margin-top: -.275em; border-radius: 50%; background: #fff; animation: blink 1.2s steps(2) infinite; }
@keyframes blink { 50% { opacity: 0; } }
.tv-clock { font-variant-numeric: tabular-nums; color: rgba(255,255,255,.75); font-size: .9em; text-transform: capitalize; }

.tv-stage { min-height: 0; display: grid; grid-template-columns: 0.8fr 1.2fr; gap: 3cqw; align-items: center; }
.tv-visual { position: relative; display: grid; place-items: center; height: 100%; min-height: 0; }
.tv-visual canvas { height: 100%; max-height: 26cqw; width: auto; aspect-ratio: 1; }
.tv-visual::after { content: "2046"; position: absolute; bottom: 2%; font: 700 4.4em/1 var(--display); letter-spacing: .08em;
  color: transparent; -webkit-text-stroke: 1px color-mix(in srgb, var(--seg, #fff) 70%, transparent); opacity: .5; }
.tv-story.in > * { animation: tvIn .7s var(--ease) both; }
.tv-story.in > *:nth-child(2) { animation-delay: .08s; } .tv-story.in > *:nth-child(3) { animation-delay: .16s; } .tv-story.in > *:nth-child(4) { animation-delay: .24s; }
@keyframes tvIn { from { opacity: 0; transform: translateY(.9em); } }
.tv-cat { display: inline-flex; align-items: center; gap: .45em; margin: 0 0 .8em; padding: .35em .8em; border-radius: 99em; font-weight: 700; font-size: .82em;
  letter-spacing: .1em; text-transform: uppercase; color: var(--seg, #fff);
  background: color-mix(in srgb, var(--seg, #4f8cff) 20%, transparent); border: 1px solid color-mix(in srgb, var(--seg, #4f8cff) 45%, transparent); }
.tv-cat svg { width: 1.2em; height: 1.2em; }
.tv-story h2 { font: 700 2.75em/1.08 var(--display); letter-spacing: -.01em; margin: 0 0 .5em; }
.tv-lead { color: rgba(255,255,255,.78); line-height: 1.5; margin: 0 0 1.2em; }
.tv-stats { display: grid; grid-template-columns: 1fr 1fr; gap: .9em; }
.tv-stat { background: rgba(255,255,255,.05); border: 1px solid rgba(255,255,255,.1); border-radius: .7em; padding: .75em .9em; }
.tv-stat .l { display: block; font-size: .72em; text-transform: uppercase; letter-spacing: .08em; color: rgba(255,255,255,.6); margin-bottom: .3em; }
.tv-vs { display: flex; align-items: baseline; justify-content: space-between; gap: .5em; }
.tv-vs .y26 { font-size: .78em; color: rgba(255,255,255,.55); }
.tv-vs .y46 { font: 700 1.75em/1 var(--display); color: var(--seg, #fff); font-variant-numeric: tabular-nums; }
.tv-meter { height: .38em; border-radius: 1em; background: rgba(255,255,255,.1); margin-top: .5em; overflow: hidden; }
.tv-meter i { display: block; height: 100%; width: var(--w); background: var(--seg, #fff); border-radius: inherit; animation: grow 1.6s var(--ease) both; }
@keyframes grow { from { width: 0; } }

.tv-anchor { display: flex; align-items: center; gap: .9em; background: rgba(0,0,0,.5); border: 1px solid rgba(255,255,255,.1);
  border-left: .3em solid var(--seg, #e11d48); border-radius: .6em; padding: .6em .9em; }
.tv-avatar { flex: none; width: 3.1em; height: 3.1em; border-radius: 50%; position: relative;
  background: radial-gradient(circle at 50% 38%, #f4c9a0 0 22%, transparent 23%), radial-gradient(circle at 50% 30%, #2b1a12 0 30%, transparent 31%),
    radial-gradient(ellipse at 50% 100%, var(--seg, #4f8cff) 0 48%, transparent 49%), #1b2140; box-shadow: 0 0 0 2px rgba(255,255,255,.2); }
.tv:not(.paused) .tv-avatar::after { content: ""; position: absolute; inset: -.35em; border-radius: 50%; border: 2px solid var(--seg, #fff); animation: pulse 1.4s ease-out infinite; }
@keyframes pulse { from { transform: scale(.9); opacity: .7; } to { transform: scale(1.2); opacity: 0; } }
.tv-anchor-name { font-size: .75em; color: rgba(255,255,255,.6); }
.tv-sub { margin: .15em 0 0; line-height: 1.4; color: #fff; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

.tv-ticker { display: flex; align-items: stretch; height: 2.6em; margin: 0 -3cqw; overflow: hidden; background: #ffd34d; color: #1a1400; font-weight: 700; }
.tv-flash { position: relative; z-index: 1; flex: none; display: grid; place-items: center; padding: 0 1em; background: #e11d48; color: #fff;
  letter-spacing: .12em; font-size: .85em; box-shadow: .5em 0 .8em rgba(0,0,0,.25); }
.tv-track { display: flex; align-items: center; white-space: nowrap; animation: ticker 60s linear infinite; }
.tv-track span { padding: 0 1.4em; position: relative; }
.tv-track span::after { content: "•"; position: absolute; right: -.2em; opacity: .5; }
@keyframes ticker { to { transform: translateX(-50%); } }

/* --- télécommande / sommaire (hors écran, suit le thème) */
.tv-remote { display: grid; gap: .55rem; margin-top: .35rem; }
.tv-rundown { display: flex; gap: .4rem; overflow-x: auto; scrollbar-width: none; justify-content: center; }
.tv-rundown button { flex: none; display: inline-flex; align-items: center; gap: .4rem; padding: .4rem .75rem; border-radius: 999px; font-size: .82rem;
  background: rgba(255,255,255,.06); border: 1px solid rgba(255,255,255,.12); color: rgba(255,255,255,.82); }
.tv-rundown button svg { width: 15px; height: 15px; color: var(--seg); }
.tv-rundown button[aria-selected="true"] { background: var(--seg); color: #0b0d1a; border-color: transparent; font-weight: 700; }
.tv-rundown button[aria-selected="true"] svg { color: inherit; }
.tv-controls { display: flex; align-items: center; justify-content: space-between; gap: .8rem; flex-wrap: wrap; }
.tv-transport { display: flex; align-items: center; gap: .5rem; }
.tv-transport .num { min-width: 3.4rem; text-align: center; font-variant-numeric: tabular-nums; color: rgba(255,255,255,.65); font-size: .9rem; }
.tv-controls button { color: #fff; background: rgba(255,255,255,.08); border-color: rgba(255,255,255,.16); }
.tv-controls button:hover { background: rgba(255,255,255,.16); }
.tv-controls button.primary { background: var(--accent); color: var(--on-accent); border-color: transparent; }
.tv-fiction { margin: 0; text-align: center; font-size: .74rem; color: rgba(255,255,255,.5); }
body.calm .tv-track, body.calm .tv-dot, body.calm .tv-live::before, body.calm .tv.on .tv-frame, body.calm .tv-static { animation: none; }

/* --- salon de jour (thème clair) : mur crème, parquet, télé noire laquée */
body.light .overlay.tv { color: #12152b;
  background:
    radial-gradient(55% 50% at 50% 42%, color-mix(in srgb, var(--seg, #4f8cff) 22%, transparent), transparent 70%),
    linear-gradient(180deg, #f3efe7 0%, #e9e3d8 68%, #b98d62 68.2%, #a77b52 100%); }
body.light .tv-set { box-shadow: 0 0 0 1px rgba(0,0,0,.4) inset, 0 30px 60px rgba(60,40,20,.35), 0 0 120px color-mix(in srgb, var(--seg, #4f8cff) 22%, transparent); }
body.light .tv-rundown button { background: #fff; border-color: rgba(22,26,64,.14); color: #2c3150; box-shadow: 0 1px 2px rgba(22,26,64,.08); }
body.light .tv-rundown button svg { color: color-mix(in srgb, var(--seg) 75%, #000); }
body.light .tv-rundown button[aria-selected="true"] { background: var(--seg); color: #0b0d1a; }
body.light .tv-controls button { color: #12152b; background: #fff; border-color: rgba(22,26,64,.16); box-shadow: 0 1px 2px rgba(22,26,64,.08); }
body.light .tv-controls button:hover { background: #f4f5fa; }
body.light .tv-controls button.primary { background: var(--accent); color: var(--on-accent); }
body.light .tv-transport .num { color: #50567a; }
body.light .tv-fiction { color: #6a5a48; }

/* --- petits écrans : l'écran devient plein cadre et défilant */
@media (max-width: 760px), (max-height: 520px) {
  .tv-room { justify-content: flex-start; overflow-y: auto; padding: .6rem; }
  .tv-room > * { width: 100%; }
  .tv-screen { aspect-ratio: auto; }
  .tv-frame { position: relative; font-size: 13px; padding: 1rem 1rem 0; gap: .8rem; }
  .tv-stage { grid-template-columns: 1fr; }
  .tv-visual canvas { max-height: 150px; }
  .tv-visual::after { font-size: 2.4em; }
  .tv-stats { grid-template-columns: 1fr; }
  .tv-ticker { margin: 0 -1rem; }
  .tv-clock, .tv-stand { display: none; }
  .tv-rundown { justify-content: flex-start; }
  .tv-controls { justify-content: center; }
}

/* tunnel temporel (canvas plein écran, voir src/timewarp.js) */
#warp { position: fixed; inset: 0; width: 100vw; height: 100vh; z-index: 60; pointer-events: none; transition: opacity .45s ease; }
#warp.out { opacity: 0; }
.sr-only { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.hud .tb-2046 { color: var(--future); }

/* =====================================================================
   Journal v3 : les images du reportage remplissent l'écran,
   le texte devient habillage télé (bandeau bas, infographies, sous-titres)
   ===================================================================== */
.tv-frame { grid-template-rows: auto 1fr auto auto auto; gap: .9cqw; background: #000; }
#tv-footage { position: absolute; inset: 0; width: 100%; height: 100%; z-index: 0; display: block; }
.tv-frame::after { content: ""; position: absolute; inset: 0; z-index: 0; pointer-events: none;
  background: linear-gradient(180deg, rgba(3,5,18,.7) 0%, transparent 16%, transparent 52%, rgba(3,5,18,.8) 100%); }
.tv-frame > :not(#tv-footage) { position: relative; z-index: 1; }
.tv-top { text-shadow: 0 1px 6px rgba(0,0,0,.6); }

.tv-stage { display: flex; justify-content: space-between; align-items: flex-start; gap: 2cqw; min-height: 0; }
.tv-tag { margin: 0; display: inline-flex; align-items: center; gap: .5em; padding: .35em .7em; border-radius: .3em; font-size: .78em; font-weight: 700;
  letter-spacing: .06em; background: rgba(0,0,0,.55); color: #fff; text-transform: uppercase; backdrop-filter: blur(4px); }
.tv-tag .rec { width: .6em; height: .6em; border-radius: 50%; background: #ff3b3b; animation: blink 1.2s steps(2) infinite; }
.tv-tag .tc { font-variant-numeric: tabular-nums; opacity: .7; font-weight: 500; }
.tv-stats { width: 27%; grid-template-columns: 1fr; gap: .6em; }
.tv-stats .tv-stat { background: rgba(6,9,28,.72); border-color: rgba(255,255,255,.14); backdrop-filter: blur(6px);
  border-left: .25em solid var(--seg); animation: tvIn .8s var(--ease) both .3s; }
.tv-stats .tv-stat + .tv-stat { animation-delay: .5s; }

/* bandeau bas (« lower third ») */
.tv-story { margin: 0 -3cqw; padding: .8em 3cqw .7em; max-width: none;
  background: linear-gradient(90deg, rgba(6,8,26,.94) 0%, rgba(6,8,26,.82) 60%, rgba(6,8,26,.25) 100%);
  border-top: .22em solid var(--seg, #e11d48); }
.tv-story .tv-cat { margin: 0 0 .45em; font-size: .72em; }
.tv-story h2 { font-size: 2.05em; margin: 0 0 .25em; }
.tv-story .tv-lead { margin: 0; font-size: .92em; display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical; overflow: hidden; }

/* présentatrice : sous-titres compacts */
.tv-anchor { padding: .4em .8em; gap: .7em; background: rgba(0,0,0,.72); border-radius: .4em; }
.tv-avatar { width: 2.3em; height: 2.3em; }
.tv-anchor-name { font-size: .68em; }
.tv-sub { font-size: .9em; -webkit-line-clamp: 1; }
.tv-ticker { margin-top: 0; }

@media (max-width: 760px), (max-height: 520px) {
  .tv-frame { min-height: 70vh; }
  .tv-stats { width: 100%; grid-template-columns: 1fr 1fr; }
  .tv-stage { flex-direction: column; }
  .tv-story { margin: 0 -1rem; padding: .7rem 1rem; }
  .tv-story h2 { font-size: 1.35em; }
}
/* habillage plus compact : la catégorie flotte au-dessus du bandeau, sous-titres sur une ligne */
.tv-story { padding-top: .65em; padding-bottom: .55em; }
.tv-story .tv-cat { position: absolute; top: -2.1em; left: 3cqw; margin: 0; background: var(--seg); color: #0b0d1a; border-color: transparent; }
.tv-story h2 { font-size: 1.9em; }
.tv-anchor-name { display: none; }
.tv-anchor { padding: .35em .7em; }
@media (max-width: 760px), (max-height: 520px) { .tv-story .tv-cat { left: 1rem; } }

/* Quiz : la réponse choisie est clairement marquée (vert = juste, rouge = fausse), les autres s'estompent */
#p-quiz .choices button { position: relative; transition: background .2s, border-color .2s, opacity .2s; }
#p-quiz .choices button:disabled { opacity: .45; cursor: default; }
#p-quiz .choices button.right, #p-quiz .choices button.wrong { opacity: 1; font-weight: 700; padding-right: 2.6em; }
#p-quiz .choices button.right { background: color-mix(in srgb, var(--ok) 18%, var(--surface-solid)); border: 2px solid var(--ok); color: var(--ok); }
#p-quiz .choices button.wrong { background: color-mix(in srgb, var(--danger) 14%, var(--surface-solid)); border: 2px solid var(--danger); color: var(--danger); text-decoration: line-through; }
#p-quiz .choices .mark { position: absolute; right: 1em; top: 50%; transform: translateY(-50%); font-size: 1.1em; text-decoration: none; }
#p-quiz .res.ok, #p-quiz .res.ko { font-weight: 700; padding: .6em .8em; border-radius: var(--r-sm); }
#p-quiz .res.ok { background: color-mix(in srgb, var(--ok) 14%, transparent); color: var(--ok); }
#p-quiz .res.ko { background: color-mix(in srgb, var(--danger) 12%, transparent); color: var(--danger); }

/* ---------- Fiche d'œuvre v2 : écran en tête, puces, fond opaque, actions épinglées ---------- */
.side { padding: 0 1.25rem 0; background: color-mix(in srgb, var(--surface-solid) 97%, transparent); border-top: 0; overflow-x: hidden; }
.side::before { display: none; }
.p-screen { position: relative; margin: 0 -1.25rem 1rem; aspect-ratio: 16 / 9; background: #05060f; overflow: hidden;
  border-bottom: 3px solid var(--room, var(--accent)); }
.p-screen canvas { display: block; width: 100%; height: 100%; }
.p-screen::after { content: ""; position: absolute; inset: 0; pointer-events: none;
  background: repeating-linear-gradient(0deg, rgba(0,0,0,.12) 0 1px, transparent 1px 3px), radial-gradient(ellipse at center, transparent 60%, rgba(0,0,0,.35)); }
.p-screen .close { position: absolute; top: .6rem; right: .6rem; z-index: 2; background: rgba(6,8,22,.6); color: #fff; border-color: rgba(255,255,255,.25);
  -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); }
.p-screen .close:hover { background: rgba(6,8,22,.85); }
.p-live { position: absolute; top: .95rem; right: 3.6rem; z-index: 2; display: inline-flex; align-items: center; gap: .4em; padding: .25em .6em; border-radius: 99px;
  background: rgba(6,8,22,.6); color: #fff; font: 700 .64rem/1 var(--font); letter-spacing: .1em; text-transform: uppercase; }
.p-live i { width: .55em; height: .55em; border-radius: 50%; background: #ff3b5c; animation: pulse-live 1.4s ease-in-out infinite; }
@keyframes pulse-live { 50% { opacity: .25; } }
body.calm .p-live i { animation: none; }
.p-chips { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem; margin-bottom: .55rem; }
.chip { display: inline-flex; align-items: center; gap: .4em; padding: .22em .7em; border-radius: 99px; font-size: .74em; font-weight: 700;
  background: var(--surface-2); color: var(--text); border: 1px solid var(--line); }
.chip.year { background: var(--room, var(--accent)); color: #10121e; border-color: transparent; font-family: var(--display); letter-spacing: .02em; }
.chip.room::before { content: ""; width: .6em; height: .6em; border-radius: 50%; background: var(--room, var(--accent)); }
.p-chips .badge { margin: 0; }
.side h2 { font-size: 1.32rem; line-height: 1.25; margin: 0 0 .8rem; }
.memory-mini { gap: .5rem; padding: .5rem .7rem; border: 1px solid var(--line); }
.memory-mini [data-icon] svg, .memory-mini svg { width: 15px; height: 15px; color: var(--room, var(--accent)); }
.ex-text { font-size: .97em; line-height: 1.7; margin: 1rem 0 .4rem; padding-left: .85rem; border-left: 3px solid color-mix(in srgb, var(--room, var(--accent)) 55%, transparent); }
.side .actions { position: sticky; bottom: 0; z-index: 3; margin: .8rem -1.25rem 0; padding: .8rem 1.25rem 1rem;
  background: linear-gradient(to bottom, transparent, var(--surface-solid) 28%); }
#p-quiz { margin: .2rem 0 1rem; padding: 1rem; border: 1px solid var(--line); border-radius: var(--r-md, 14px); background: var(--surface-2); }
#p-quiz > p:first-child { margin-top: 0; }
#p-quiz > p:first-child::before { content: "Quiz de restauration"; display: block; margin-bottom: .35rem; font-size: .68rem; font-weight: 700;
  letter-spacing: .12em; text-transform: uppercase; color: var(--room, var(--accent)); }
#p-demo:not(:empty) { margin: .6rem 0; }
.tour-nav { margin-bottom: 1rem; }
@media (max-width: 760px) { .p-screen { max-height: 30vh; } }
.side .p-chips #p-meta { margin: 0; }
.side .actions { align-items: center; }
.side .actions #p-speak { flex: 0 0 auto; }
.mem-state { flex: 1; text-align: right; font-size: .8em; font-weight: 600; color: var(--muted); }

/* ---------- Fiche d'œuvre v3 : cartel de musée ---------- */
.side { padding: 0 1.5rem; width: min(440px, calc(100% - 2rem)); border-radius: 18px; border: 1px solid var(--line); box-shadow: 0 24px 60px -20px rgba(0,0,0,.45), 0 2px 6px rgba(0,0,0,.12); }
.p-screen { margin: 0 -1.5rem 1.25rem; border-bottom: 0; box-shadow: inset 0 -1px 0 var(--line); }
.p-screen::before { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 3px; z-index: 1; background: var(--room, var(--accent)); }
.p-live { right: auto; left: .75rem; top: .75rem; background: rgba(6,8,22,.55); font-size: .6rem; }
.p-overline { display: flex; align-items: center; gap: .5rem; margin: 0 0 .45rem; font-size: .7rem; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); }
.p-dot { width: .55rem; height: .55rem; border-radius: 2px; background: var(--room, var(--accent)); flex: none; }
.side h2 { font: 600 1.55rem/1.2 var(--display); letter-spacing: -.015em; margin: 0 0 1.1rem; text-wrap: balance; }
.p-facts { display: grid; grid-template-columns: auto 1fr auto; margin: 0 0 1.1rem; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.p-facts > div { padding: .7rem .9rem .75rem 0; }
.p-facts > div + div { padding-left: .9rem; border-left: 1px solid var(--line); }
.p-facts > div:last-child { padding-right: 0; }
.p-facts dt { margin: 0 0 .25rem; font-size: .64rem; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }
.p-facts dd { margin: 0; font-weight: 600; font-size: .95rem; }
.p-facts #p-year { font: 700 1.35rem/1 var(--display); color: var(--room, var(--accent)); letter-spacing: -.01em; }
.p-facts .badge { margin: 0; font-size: .72rem; }
.p-mem { margin: 0 0 1.2rem; }
.p-mem-head { display: flex; justify-content: space-between; margin-bottom: .4rem; font-size: .7rem; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }
.p-mem-head .num { letter-spacing: 0; color: var(--text); }
.p-mem .bar { width: 100%; max-width: none; flex: none; height: 6px; border-radius: 99px; background: var(--surface-2); overflow: hidden; }
.p-mem .bar > div { height: 100%; border-radius: inherit; background: var(--room, var(--accent)); transition: width .6s var(--ease); }
.ex-text { margin: 0 0 .5rem; padding: 0; border: 0; font-size: .95rem; line-height: 1.72; color: color-mix(in srgb, var(--text) 82%, var(--muted)); hyphens: auto; }
.ex-text .lead { display: block; margin-bottom: .55rem; font-size: 1.06rem; line-height: 1.55; font-weight: 600; color: var(--text); }
.side .actions { margin: 1rem -1.5rem 0; padding: .85rem 1.5rem 1.1rem; border-top: 1px solid var(--line); background: var(--surface-solid); }
.side .actions #p-speak { padding: .6em 1.1em; }
.mem-state { font-size: .75rem; }

/* ---------- Accueil : la Terre ---------- */
#intro-earth { position: absolute; inset: 0; width: 100%; height: 100%; z-index: 0; display: block; }
#intro .intro-card { transition: opacity .3s, transform .3s; }
#intro.diving .intro-card, #intro.diving .intro-top, #intro.diving #earth-caption { opacity: calc(1 - var(--dive, 0) * 2.2); transform: scale(calc(1 - var(--dive, 0) * .06)); pointer-events: none; }
#intro.diving::before, #intro.diving::after { opacity: calc(.6 - var(--dive, 0)); }
#earth-caption { position: absolute; z-index: 1; left: 69%; bottom: 7vh; transform: translateX(-50%); margin: 0; display: inline-flex; align-items: center; gap: .55em;
  padding: .5em 1em; border-radius: 99px; background: rgba(8, 10, 28, .62); border: 1px solid rgba(255,255,255,.14); color: #fff; white-space: nowrap;
  font: 600 .86rem var(--font); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); opacity: 0; }
#earth-caption i { width: .6em; height: .6em; border-radius: 50%; background: var(--c); box-shadow: 0 0 10px var(--c); }
#earth-caption.show { animation: cap-in 3.5s ease both; }
@keyframes cap-in { 0% { opacity: 0; translate: 0 8px; } 12%, 85% { opacity: 1; translate: 0 0; } 100% { opacity: 0; } }
body.calm #earth-caption.show { animation: none; opacity: 1; }
body.light #intro { background: radial-gradient(ellipse at 70% 50%, #1b2c5c 0%, #0b1230 45%, #050816 100%); }
body.light #intro::before, body.light #intro::after { opacity: .6; filter: none; }
@media (min-aspect-ratio: 23/20) and (min-width: 900px) {
  #intro { justify-items: start; padding-left: max(4vw, 1.5rem); }
  #intro .intro-card { width: min(540px, 44vw); text-align: left; }
  #intro .intro-card .years, #intro .intro-card .actions { justify-content: flex-start; }
}
@media not ((min-aspect-ratio: 23/20) and (min-width: 900px)) { #earth-caption { display: none; } }
body.light #intro .intro-top .brand { color: #fff; }

/* ouverture de la Terre (fissure → deux moitiés) */
#intro-bg { position: absolute; inset: 0; z-index: 0; pointer-events: none; }
#intro.opening::before, #intro.opening::after { opacity: 0 !important; transition: opacity .8s; }
#earth-title { position: absolute; z-index: 2; left: 50%; top: 13vh; margin: 0; transform: translate(-50%, var(--ty, 14px)); opacity: 0; pointer-events: none;
  display: flex; flex-direction: column; align-items: center; gap: .45rem; text-align: center; color: #fff; text-shadow: 0 2px 24px rgba(0,0,0,.65); white-space: nowrap; }
#earth-title span { font-size: clamp(1.5rem, 4.2vw, 3rem); font-weight: 700; letter-spacing: -.02em; }
#earth-title small { font-size: clamp(.72rem, 1.4vw, .95rem); letter-spacing: .32em; text-transform: uppercase; color: #ffd2a6; }

/* Le Grand Séisme (2027 → 2028), entre le tunnel temporel et le journal de 2046 */
#quake { position: fixed; inset: 0; z-index: 61; background: #02040a; color: #fff; animation: q-in .5s ease both; transition: opacity .45s ease; }
#quake.out { opacity: 0; pointer-events: none; }
#quake canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
#quake .q-top { position: absolute; top: 4.5vh; left: 0; right: 0; display: flex; flex-direction: column; align-items: center; gap: .5rem; }
#quake .q-alert { background: #d6332a; color: #fff; font-weight: 700; font-size: .8rem; letter-spacing: .16em; text-transform: uppercase; padding: .45em 1em; border-radius: 999px; box-shadow: 0 0 24px rgba(255,70,50,.55); animation: q-blink 1.2s ease-in-out infinite; }
#quake .q-sub { font-size: .75rem; letter-spacing: .3em; text-transform: uppercase; opacity: .7; }
#quake .q-year { position: absolute; top: 13vh; left: 50%; transform: translateX(-50%); font: 700 clamp(3rem, 11vw, 7.5rem)/1 "Space Grotesk", system-ui, sans-serif; text-shadow: 0 0 40px rgba(255,110,60,.6); }
#quake .q-cap { position: absolute; left: 50%; bottom: 15vh; transform: translateX(-50%); margin: 0; width: min(92vw, 760px); text-align: center; font-size: clamp(1rem, 2.4vw, 1.45rem); font-weight: 600; text-shadow: 0 2px 18px rgba(0,0,0,.8); }
#quake .q-cap.in { animation: q-cap .7s ease both; }
#quake .q-bar { position: absolute; left: 50%; bottom: 8vh; transform: translateX(-50%); width: min(60vw, 560px); height: 4px; background: rgba(255,255,255,.15); border-radius: 2px; }
#quake .q-bar i { position: absolute; inset: 0 auto 0 0; background: #ff7a45; border-radius: 2px; }
#quake .q-bar span { position: absolute; top: 10px; font-size: .75rem; opacity: .65; }
#quake .q-bar span:last-child { right: 0; }
#quake .q-skip { position: absolute; right: 24px; bottom: 24px; background: rgba(255,255,255,.1); color: #fff; border: 1px solid rgba(255,255,255,.3); border-radius: 999px; padding: .55em 1.2em; font: inherit; cursor: pointer; }
#quake .q-skip:hover, #quake .q-skip:focus-visible { background: rgba(255,255,255,.22); outline: 2px solid #ffb38a; outline-offset: 2px; }
@keyframes q-in { from { opacity: 0; } }
@keyframes q-cap { from { opacity: 0; transform: translate(-50%, 12px); } }
@keyframes q-blink { 50% { box-shadow: 0 0 6px rgba(255,70,50,.3); } }
@media (prefers-reduced-motion: reduce) { #quake .q-alert { animation: none; } }
@media (max-width: 600px) { #quake .q-bar { bottom: 14vh; } #quake .q-cap { bottom: 20vh; } #quake .q-skip { right: 50%; transform: translateX(50%); bottom: 4vh; } }

/* bouton « Jouer au jeu » de l'accueil */
#btn-game.game { background: linear-gradient(135deg, #8f6bff, #c98bff); color: #fff; border-color: transparent; box-shadow: 0 6px 24px rgba(143,107,255,.35); }
#btn-game.game:hover, #btn-game.game:focus-visible { filter: brightness(1.08); }
