:root {
  --bg: #04050c;
  --panel: rgba(10, 16, 32, 0.78);
  --panel-edge: rgba(41, 227, 255, 0.28);
  --text: #d8e8ff;
  --muted: #7f93b8;
  --cyan: #29e3ff;
  --magenta: #ff3df2;
  --amber: #ffb52e;
  --lime: #5dff8f;
  --red: #ff4060;
  --gold: #ffd84a;
  --font: "Rajdhani", "Segoe UI", system-ui, sans-serif;
  --font-d: "Orbitron", "Rajdhani", "Segoe UI", sans-serif;
  --top-h: 0px;
  --bottom-h: 0px;
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-l: env(safe-area-inset-left, 0px);
  --safe-r: env(safe-area-inset-right, 0px);
  color-scheme: dark; /* univers néon volontairement sombre, thème unique */
}

* { box-sizing: border-box; }
html, body {
  margin: 0; padding: 0; height: 100%; width: 100%;
  background: var(--bg); color: var(--text);
  font-family: var(--font);
  overflow: hidden;
  overscroll-behavior: none;
  touch-action: none;
  -webkit-user-select: none; user-select: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
  position: fixed; inset: 0;
}
#app { position: fixed; inset: 0; overflow: hidden; }
canvas#bg { position: absolute; left: 0; top: 0; display: block; }
/* Calque écran en HTML (un canevas superposé aplatirait la vue inclinée) */
#fx { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
#fx > div { position: absolute; inset: 0; }
#fx .scan { background: repeating-linear-gradient(0deg, rgba(0,0,0,0.13) 0 1px, rgba(0,0,0,0) 1px 3px); }
#fx .edge { opacity: 0; box-shadow: inset 0 0 70px 12px var(--ec, #29e3ff); }
#fx .frame { opacity: 0; inset: auto; border-radius: 16px; box-shadow: 0 0 34px 8px var(--fc, #29e3ff), inset 0 0 22px 2px var(--fc, #29e3ff); border: 2px solid var(--fc, #29e3ff); }
#fx .flash { opacity: 0; background: var(--flc, #fff); }
#app.rfx #fx .scan { display: none; }
canvas#game { position: absolute; left: 0; top: 0; display: block; will-change: transform; backface-visibility: hidden; }
#touch-layer { position: absolute; inset: 0; touch-action: none; }
.hidden { display: none !important; }
button { font-family: inherit; }
kbd {
  font-family: var(--font-d); font-size: 0.72em; padding: 1px 5px; border-radius: 4px;
  border: 1px solid rgba(255,255,255,0.25); background: rgba(255,255,255,0.06); color: #fff;
}

/* ------------------------------------------------------------- HUD */
#hud { position: absolute; inset: 0; pointer-events: none; }
#hud-top {
  position: absolute; left: 0; right: 0; top: 0;
  padding: calc(4px + var(--safe-t)) calc(10px + var(--safe-r)) 2px calc(10px + var(--safe-l));
  display: flex; align-items: center; gap: 10px;
  background: linear-gradient(180deg, rgba(4,6,14,0.92), rgba(4,6,14,0.55));
  border-bottom: 1px solid rgba(41,227,255,0.15);
}
canvas.dmd { display: block; flex: none; background: #000; border-radius: 4px; box-shadow: 0 0 0 1px #2a1a10, 0 0 0 3px #0d0805, 0 0 0 4px #3a2a1c, 0 0 18px rgba(255,123,28,0.22); }
#hud.dmd-on .hud-score, #hud.dmd-on .big-score { display: none; }
#hud.dmd-top .lumen-bar { display: none; }
#hud.dmd-top .hud-mid { margin-left: auto; }
.hud-score { display: flex; flex-direction: column; min-width: 0; flex: 1; }
#score { font-family: var(--font-d); font-weight: 700; font-size: 24px; color: #fff; letter-spacing: 1px; text-shadow: 0 0 12px rgba(41,227,255,0.6); white-space: nowrap; }
#hiscore { color: var(--muted); font-size: 12px; margin-top: -2px; }
.hud-mid { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; }
.balls { display: inline-flex; gap: 4px; align-items: center; }
.balls i { width: 11px; height: 11px; border-radius: 50%; display: inline-block; background: radial-gradient(circle at 35% 35%, #fff, #29e3ff 55%, #0b2a40); box-shadow: 0 0 6px rgba(41,227,255,0.7); }
.balls i.off { background: #1a2238; box-shadow: none; border: 1px solid #2f3b58; }
.balls.flash i { animation: ballflash 0.6s 3; }
@keyframes ballflash { 50% { transform: scale(1.5); filter: brightness(2); } }
.mult { font-family: var(--font-d); font-size: 12px; color: var(--gold); min-height: 14px; }
.icon-btn {
  pointer-events: auto; width: 40px; height: 40px; border-radius: 10px;
  border: 1px solid var(--panel-edge); background: rgba(10,16,32,0.8); color: var(--cyan);
  font-size: 14px; cursor: pointer;
}
.lumen-bar {
  position: absolute; left: 0; right: 0;
  display: flex; align-items: center; gap: 8px;
  padding: 2px calc(12px + var(--safe-r)) 2px calc(12px + var(--safe-l));
  font-size: 15px; font-weight: 600; color: var(--cyan);
  min-height: 24px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  background: rgba(4,6,14,0.55);
}
.lumen-bar.null { color: var(--red); font-family: var(--font-d); font-size: 12px; letter-spacing: 1px; animation: glitch 0.3s infinite; }
.lumen-bar #lumen-text { overflow: hidden; text-overflow: ellipsis; }
.lumen-eye { width: 14px; height: 14px; border-radius: 50%; flex: 0 0 auto; border: 2px solid currentColor; box-shadow: 0 0 8px currentColor; position: relative; }
.lumen-eye::after { content: ""; position: absolute; left: 3px; top: 3px; width: 4px; height: 4px; border-radius: 50%; background: currentColor; }
.lumen-bar.talk .lumen-eye { animation: talk 0.18s infinite alternate; }
@keyframes talk { to { transform: scale(1.25); } }
@keyframes glitch { 0% { transform: translateX(0); } 33% { transform: translateX(-1px); } 66% { transform: translateX(1px); } }

.mg-bar {
  position: absolute; padding: 6px 10px; border-radius: 10px;
  background: var(--panel); border: 1px solid var(--mg, var(--cyan));
  box-shadow: 0 0 18px rgba(0,0,0,0.5);
}
.mg-head { display: flex; gap: 8px; align-items: baseline; }
#mg-title { font-family: var(--font-d); font-size: 10px; color: var(--mg, var(--cyan)); letter-spacing: 1px; flex: 0 1 auto; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
#mg-progress { font-weight: 700; color: #fff; font-size: 14px; flex: 1 1 auto; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; text-align: right; }
#mg-time { font-family: var(--font-d); font-size: 13px; color: #fff; white-space: nowrap; flex: 0 0 auto; }
.portrait #mg-title { display: none; }
#mg-time.hurry { color: var(--red); animation: talk 0.25s infinite alternate; }
.mg-timer { height: 4px; background: rgba(255,255,255,0.1); border-radius: 2px; margin-top: 4px; overflow: hidden; }
#mg-timer-fill { height: 100%; width: 100%; background: var(--mg, var(--cyan)); transition: width 0.2s linear; }
.mg-perk { font-size: 12px; color: var(--muted); margin-top: 2px; min-height: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.panel {
  position: absolute; top: 12px; bottom: 12px; padding: 12px 14px;
  background: var(--panel); border: 1px solid var(--panel-edge); border-radius: 14px;
  overflow: hidden; display: none;
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
}
.panel h3 { font-family: var(--font-d); font-size: 11px; letter-spacing: 1.5px; color: var(--muted); margin: 12px 0 6px; text-transform: uppercase; }
.panel h3:first-child { margin-top: 0; }
.sectors { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 6px; }
.sectors li { display: grid; grid-template-columns: 22px 1fr auto; gap: 8px; align-items: center; padding: 6px 8px; border-radius: 8px; background: rgba(255,255,255,0.03); border: 1px solid rgba(255,255,255,0.06); }
.sectors li .ic { font-size: 16px; text-align: center; }
.sectors li .nm { font-weight: 700; font-size: 14px; line-height: 1.05; }
.sectors li .nm small { display: block; font-weight: 500; color: var(--muted); font-size: 12px; }
.sectors li .st { font-size: 11px; font-family: var(--font-d); letter-spacing: 0.5px; }
.sectors li .bar { grid-column: 1 / -1; height: 3px; background: rgba(255,255,255,0.08); border-radius: 2px; overflow: hidden; }
.sectors li .bar i { display: block; height: 100%; }
.sectors li.ready { animation: pulse 0.8s infinite alternate; }
@keyframes pulse { to { background: rgba(255,255,255,0.1); } }
.mission { font-size: 15px; line-height: 1.25; }
.mission .mt { color: var(--gold); font-weight: 700; }
.mission .mp { height: 3px; background: rgba(255,255,255,0.1); margin-top: 4px; border-radius: 2px; overflow: hidden; }
.mission .mp i { display: block; height: 100%; background: var(--gold); }
.effects { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 5px; }
.effects li { font-size: 14px; display: flex; justify-content: space-between; gap: 8px; padding: 3px 8px; border-left: 3px solid var(--c, var(--cyan)); background: rgba(255,255,255,0.03); border-radius: 0 6px 6px 0; }
.effects li .t { font-family: var(--font-d); font-size: 11px; color: var(--muted); }
.effects .none { color: var(--muted); border: none; background: none; padding: 0; }
.big-score small { display: block; color: var(--muted); font-size: 12px; }
#score2 { font-family: var(--font-d); font-size: 30px; font-weight: 900; color: #fff; text-shadow: 0 0 16px rgba(41,227,255,0.6); word-break: break-all; }
.panel .row { display: flex; justify-content: space-between; align-items: center; padding: 5px 0; border-bottom: 1px solid rgba(255,255,255,0.05); font-weight: 700; }
.panel .row small { color: var(--muted); font-weight: 500; font-size: 13px; }
.lumen-log { list-style: none; padding: 0; margin: 0; font-size: 14px; display: flex; flex-direction: column; gap: 4px; }
.lumen-log li { color: var(--cyan); opacity: 0.85; }
.lumen-log li.null { color: var(--red); font-family: var(--font-d); font-size: 11px; }
.lumen-log li:not(:first-child) { opacity: 0.45; }
.keys { font-size: 13px; color: var(--muted); line-height: 1.7; margin: 0; }
.touch-keys { display: none; }
.touch .keys { display: none; }
.touch .touch-keys { display: block; }
.panel.compact { padding: 8px 10px; }
.panel.compact h3 { margin: 8px 0 4px; font-size: 10px; }
.panel.compact .sectors { gap: 4px; }
.panel.compact .sectors li { padding: 4px 6px; grid-template-columns: 18px 1fr; }
.panel.compact .sectors li .nm { font-size: 12px; }
.panel.compact .sectors li .nm small { display: none; }
.panel.compact .sectors li .st { grid-column: 2; font-size: 9px; }
.panel.compact .mission, .panel.compact .effects li { font-size: 12px; }
.panel.compact #score2 { font-size: 22px; }
.panel.compact .row { padding: 2px 0; font-size: 13px; }
.panel.compact .lumen-log, .panel.compact .keys { font-size: 12px; }

#hud-bottom {
  position: absolute; left: 0; bottom: 0; padding: 6px calc(10px + var(--safe-l)) calc(6px + var(--safe-b));
  display: flex; flex-direction: column; gap: 4px; pointer-events: none;
}
.mg-bar.slim .mg-head, .mg-bar.slim .mg-timer { display: none; }
.mg-bar.slim .mg-perk { font-size: 14px; white-space: normal; }
.goal { font-size: 13px; font-weight: 700; color: var(--g, var(--cyan)); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-shadow: 0 0 8px var(--g, var(--cyan)); }
.goal::before { content: '▶ '; opacity: 0.8; }
.panel .goal { white-space: normal; margin-bottom: 4px; }
.chip { font-size: 13px; color: var(--gold); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chips { display: flex; flex-wrap: wrap; gap: 4px; }
.chips span { font-size: 11px; padding: 1px 6px; border-radius: 8px; border: 1px solid var(--c, var(--cyan)); color: var(--c, var(--cyan)); background: rgba(4,6,14,0.6); white-space: nowrap; }

/* bouton de lancement (accessible au pouce) */
.launch {
  position: absolute; width: 84px; height: 84px; border-radius: 50%;
  border: 2px solid var(--cyan); background: radial-gradient(circle, rgba(41,227,255,0.25), rgba(4,6,14,0.85) 70%);
  color: #fff; font-family: var(--font-d); font-size: 11px; letter-spacing: 1px;
  touch-action: none; cursor: pointer; z-index: 5;
  box-shadow: 0 0 20px rgba(41,227,255,0.45);
}
.launch .ring { position: absolute; inset: -6px; border-radius: 50%; background: conic-gradient(var(--gold) calc(var(--charge, 0) * 1turn), transparent 0); -webkit-mask: radial-gradient(circle, transparent 58%, #000 60%); mask: radial-gradient(circle, transparent 58%, #000 60%); }
.launch .lbl { position: relative; }
.launch.pulse { animation: lpulse 1s infinite alternate; }
@keyframes lpulse { to { box-shadow: 0 0 34px rgba(41,227,255,0.9); } }
.launch.small { width: 64px; height: 64px; font-size: 9px; }

.zone-hints { position: absolute; left: 0; right: 0; bottom: 0; height: 40%; display: flex; pointer-events: none; transition: opacity 0.8s; }
.zone-hints div { flex: 1; display: flex; align-items: flex-end; justify-content: center; padding-bottom: 18%; font-family: var(--font-d); font-size: 12px; color: rgba(41,227,255,0.7); letter-spacing: 1px; }
.zone-hints .zl { background: linear-gradient(90deg, rgba(41,227,255,0.10), transparent); border-right: 1px dashed rgba(41,227,255,0.25); }
.zone-hints .zr { background: linear-gradient(270deg, rgba(41,227,255,0.10), transparent); }
.zone-hints.fade { opacity: 0; }

.banner {
  position: absolute; left: 50%; transform: translate(-50%, 0); text-align: center;
  pointer-events: none; opacity: 0; transition: opacity 0.25s, transform 0.25s;
  padding: 6px 14px; border-radius: 12px; max-width: 92vw;
  background: rgba(4,6,14,0.32); border: 1px solid rgba(255,255,255,0.08);
  z-index: 4;
}
.banner .bt, .banner .bs { text-shadow: 0 0 10px var(--bc, var(--cyan)), 0 1px 3px #000, 0 0 2px #000; }
.banner.side { background: rgba(8,12,26,0.92); border: 1px solid var(--bc, var(--cyan)); box-shadow: 0 0 24px rgba(0,0,0,0.5); }
.banner.show { opacity: 0.94; transform: translate(-50%, -6px); }
.banner .bt { font-family: var(--font-d); font-weight: 900; font-size: clamp(14px, 3.8vw, 24px); color: var(--bc, var(--cyan)); letter-spacing: 1.5px; }
.banner .bs { font-size: clamp(13px, 3.4vw, 17px); color: #fff; font-weight: 600; margin-top: 2px; }

.tally {
  position: absolute; left: 50%; transform: translateX(-50%); min-width: 220px; z-index: 4;
  padding: 12px 18px; border-radius: 14px; background: rgba(4,6,14,0.82);
  border: 1px solid var(--panel-edge); pointer-events: none; font-size: 15px;
}
.tally h4 { margin: 0 0 6px; font-family: var(--font-d); font-size: 12px; color: var(--cyan); letter-spacing: 1px; text-align: center; }
.tally .l { display: flex; justify-content: space-between; gap: 18px; }
.tally .l span:last-child { font-family: var(--font-d); font-size: 13px; }
.tally .tot { border-top: 1px solid rgba(255,255,255,0.15); margin-top: 6px; padding-top: 6px; color: var(--gold); font-weight: 700; }

/* ------------------------------------------------------------- écrans */
.screen {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  padding: calc(12px + var(--safe-t)) 12px calc(12px + var(--safe-b));
  background: radial-gradient(ellipse at center, rgba(4,6,14,0.55), rgba(4,6,14,0.88));
  z-index: 10; touch-action: pan-y;
}
.card {
  width: min(560px, 100%); max-height: 100%; padding: 22px 22px 18px; border-radius: 18px;
  background: rgba(8,12,26,0.9); border: 1px solid var(--panel-edge);
  box-shadow: 0 0 40px rgba(41,227,255,0.12), inset 0 0 30px rgba(41,227,255,0.04);
  text-align: center;
}
.scrollable { overflow-y: auto; touch-action: pan-y; -webkit-overflow-scrolling: touch; }
.card h2 { font-family: var(--font-d); font-size: 20px; letter-spacing: 2px; color: var(--cyan); margin: 4px 0 12px; }
.card h4 { margin: 4px 0; color: var(--gold); }
.logo {
  font-family: var(--font-d); font-weight: 900; font-size: clamp(32px, 10vw, 58px); letter-spacing: 3px;
  color: #fff; position: relative; display: inline-block;
  text-shadow: 0 0 18px rgba(41,227,255,0.9), 0 0 42px rgba(41,227,255,0.45);
}
.logo::before, .logo::after { content: attr(data-text); position: absolute; left: 0; top: 0; width: 100%; overflow: hidden; }
.logo::before { color: var(--magenta); transform: translate(-2px, 0); clip-path: inset(0 0 60% 0); opacity: 0.7; animation: glitchA 3s infinite; }
.logo::after { color: var(--red); transform: translate(2px, 0); clip-path: inset(55% 0 0 0); opacity: 0.6; animation: glitchB 2.3s infinite; }
@keyframes glitchA { 0%, 90%, 100% { transform: translate(0); opacity: 0; } 92% { transform: translate(-3px, -1px); opacity: 0.8; } 95% { transform: translate(2px, 1px); opacity: 0.6; } }
@keyframes glitchB { 0%, 85%, 100% { transform: translate(0); opacity: 0; } 87% { transform: translate(3px, 1px); opacity: 0.7; } 91% { transform: translate(-2px, 0); opacity: 0.5; } }
.subtitle { font-family: var(--font-d); font-size: 12px; letter-spacing: 3px; color: var(--muted); margin-top: 4px; text-transform: uppercase; }
.pitch { font-size: 16px; line-height: 1.35; color: var(--text); margin: 14px auto; max-width: 440px; }
.menu { display: flex; flex-direction: column; gap: 8px; margin: 14px auto 6px; max-width: 320px; }
.btn {
  pointer-events: auto; padding: 11px 16px; border-radius: 10px; cursor: pointer;
  border: 1px solid var(--panel-edge); background: rgba(41,227,255,0.06); color: #fff;
  font-family: var(--font-d); font-size: 13px; letter-spacing: 1.5px; text-transform: uppercase;
  transition: background 0.15s, transform 0.1s;
}
.btn:hover, .btn:focus-visible { background: rgba(41,227,255,0.18); outline: none; }
.btn:active { transform: scale(0.97); }
.btn.primary { background: linear-gradient(180deg, rgba(41,227,255,0.35), rgba(41,227,255,0.12)); border-color: var(--cyan); box-shadow: 0 0 18px rgba(41,227,255,0.3); }
.btn.ghost { background: transparent; color: var(--muted); }
.scores-box { margin-top: 12px; text-align: left; }
.scores-box h3 { font-family: var(--font-d); font-size: 11px; letter-spacing: 1.5px; color: var(--muted); text-align: center; margin: 6px 0; }
#hiscores { margin: 0 auto; padding-left: 26px; max-width: 300px; font-size: 15px; columns: 1; }
#hiscores li { padding: 1px 0; }
#hiscores li span { float: right; font-family: var(--font-d); font-size: 13px; color: var(--cyan); }
#hiscores .empty { list-style: none; color: var(--muted); text-align: center; margin-left: -26px; }
.hint { color: var(--muted); font-size: 13px; margin: 10px 0 0; }
.help-card { text-align: left; width: min(720px, 100%); }
.help-card h2 { text-align: center; }
.cols { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.cols ul, .rules { padding-left: 18px; margin: 4px 0 10px; line-height: 1.45; font-size: 15px; }
.rules.small { font-size: 14px; }
.tag { font-family: var(--font-d); font-size: 10px; padding: 1px 5px; border-radius: 4px; border: 1px solid; }
.tag.c1 { color: #29d9ff; } .tag.c2 { color: #ffae2a; } .tag.c3 { color: #5dff8f; } .tag.c4 { color: #ff3d6e; }
.tag.c5 { color: #e6ff3d; } .tag.c6 { color: #b07bff; } .tag.c7 { color: #4d7dff; }
.tag.c8 { color: #cfe0ff; } .tag.c9 { color: #ff6ab4; }
.help-card .btn { display: block; margin: 14px auto 0; min-width: 200px; }
.settings-card { text-align: left; }
.settings-card .btn { display: block; margin: 16px auto 0; min-width: 200px; }
.slider { display: grid; grid-template-columns: 130px 1fr; align-items: center; gap: 10px; margin: 10px 0; font-weight: 600; font-size: 16px; }
.slider input { width: 100%; accent-color: var(--cyan); pointer-events: auto; }
.toggle { display: flex; align-items: center; gap: 10px; margin: 10px 0; font-size: 16px; font-weight: 600; cursor: pointer; }
.toggle input { width: 20px; height: 20px; accent-color: var(--cyan); }
.muted { color: var(--muted); }
.final-score { font-family: var(--font-d); font-weight: 900; font-size: clamp(30px, 9vw, 48px); color: #fff; text-shadow: 0 0 18px rgba(41,227,255,0.7); }
.stats { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 14px; margin: 12px auto; max-width: 380px; text-align: left; font-size: 15px; }
.stats span:nth-child(even) { text-align: right; font-weight: 700; color: var(--cyan); }
.name-form { display: flex; gap: 8px; justify-content: center; align-items: center; margin: 10px 0; flex-wrap: wrap; }
.name-form input {
  width: 90px; padding: 8px; border-radius: 8px; border: 1px solid var(--cyan); background: rgba(0,0,0,0.4);
  color: #fff; font-family: var(--font-d); font-size: 18px; text-align: center; text-transform: uppercase; margin-left: 6px;
}
.noscript { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; }

@media (max-width: 520px) {
  .cols { grid-template-columns: 1fr; }
  .card { padding: 16px 14px; }
  .pitch { font-size: 15px; }
}

/* ==========================================================================
   FIN DE SESSION — cinématique, rapport, initiales, tableau des scores
   (src/ui/gameover.js). Uniquement du DOM : un <canvas> posé sur le plateau
   aplatirait la vue inclinée.
   ========================================================================== */
.screen.go { display: block; padding: 0; background: none; touch-action: none; }
.go-stage { position: absolute; inset: 0; overflow: hidden; --null: #ff2a4a; }

/* voile : le plateau éteint reste visible derrière le rapport */
.go-veil {
  position: absolute; inset: 0; opacity: 0; pointer-events: none; transition: opacity 1.1s ease;
  background: radial-gradient(ellipse 70% 62% at 50% 46%, rgba(4,3,12,0.56), rgba(4,3,12,0.9));
  box-shadow: inset 0 0 160px rgba(255,32,80,0.22);
}
.go-veil.on { opacity: 1; }
.go-veil.on.lift { opacity: 0.7; transition-duration: 0.35s; }
.go-flash { position: absolute; inset: 0; opacity: 0; pointer-events: none; mix-blend-mode: screen; background: radial-gradient(circle at 50% 42%, #ffd0d8, #ff2040 40%, #4a0010 100%); }
.go-flash.on { animation: goFlash 1s ease-out both; }
.go-flash:not(.on) { display: none; }   /* éteint : hors de la composition */
@keyframes goFlash { 0% { opacity: 0.95; } 10% { opacity: 0.2; } 16% { opacity: 0.75; } 100% { opacity: 0; } }
@keyframes goFlashSoft { 0% { opacity: 0.35; } 100% { opacity: 0; } }

/* « SIGNAL PERDU » : impact, lente dérive (ralenti), extinction façon tube cathodique */
.go-signal { position: absolute; left: 0; right: 0; top: 40%; transform: translateY(-50%); text-align: center; pointer-events: none; opacity: 0; }
.go-signal.on { opacity: 1; }
.go-sig {
  display: inline-block; font-family: var(--font-d); font-weight: 900; font-size: clamp(30px, 8.6vw, 104px);
  letter-spacing: 0.05em; line-height: 1; color: #ff2a4a; white-space: nowrap;
  text-shadow: 0 0 18px rgba(255,32,80,0.95), 0 0 60px rgba(255,32,80,0.55), 0 0 2px #fff;
}
.go-signal.on .go-sig { animation: goSig 2.7s cubic-bezier(0.2, 0.8, 0.2, 1) both; }
@keyframes goSig {
  0% { transform: scale(2.1); opacity: 0; filter: blur(10px) brightness(3); }
  6% { transform: scale(0.94); opacity: 1; filter: none; }
  10% { transform: scale(1.02); }
  82% { transform: scale(1.09); opacity: 1; filter: none; }
  91% { transform: scale(1.16, 0.05); opacity: 1; filter: brightness(4); }
  100% { transform: scale(0, 0.02); opacity: 0; filter: brightness(4); }
}
.go-sig2 { font-family: var(--font-d); font-size: clamp(9px, 2.1vw, 14px); letter-spacing: 0.26em; white-space: nowrap; text-transform: uppercase; color: #ffb7c3; margin-top: 12px; opacity: 0; text-shadow: 0 0 8px rgba(255,40,80,0.8); }
.go-signal.on .go-sig2 { animation: goSig2 2.5s steps(1) both; }
@keyframes goSig2 { 0% { opacity: 0; } 14% { opacity: 1; } 18% { opacity: 0.2; } 21%, 78% { opacity: 1; } 80%, 100% { opacity: 0; } }
.go-tear { position: absolute; left: -10%; width: 120%; height: 4px; opacity: 0; background: linear-gradient(90deg, transparent, #ff2a4a 20%, #fff 50%, #29e3ff 80%, transparent); }
.go-tear:nth-of-type(1) { top: -40%; }
.go-tear:nth-of-type(2) { top: 55%; height: 2px; }
.go-tear:nth-of-type(3) { top: 130%; height: 6px; }
.go-signal.on .go-tear { animation: goTear 0.55s steps(4) both; }
.go-signal.on .go-tear:nth-of-type(2) { animation-delay: 0.12s; }
.go-signal.on .go-tear:nth-of-type(3) { animation-delay: 0.24s; }
@keyframes goTear { 0% { opacity: 1; transform: translateX(-30%); } 60% { opacity: 1; transform: translateX(20%) scaleY(2); } 100% { opacity: 0; transform: translateX(45%) scaleY(0.5); } }

/* aberration chromatique des titres */
.glx { position: relative; }
.glx::before, .glx::after { content: attr(data-text); position: absolute; left: 0; top: 0; width: 100%; pointer-events: none; text-shadow: none; }
.go-sig.glx::before { color: #29e3ff; opacity: 0.8; mix-blend-mode: screen; animation: goGlxA 0.42s steps(2) infinite; }
.go-sig.glx::after { color: #ff3df2; opacity: 0.8; mix-blend-mode: screen; animation: goGlxB 0.36s steps(2) infinite; }
@keyframes goGlxA { 0% { clip-path: inset(8% 0 72% 0); transform: translate(-7px, 0); } 25% { clip-path: inset(58% 0 20% 0); transform: translate(6px, 0); } 50% { clip-path: inset(30% 0 52% 0); transform: translate(-4px, 0); } 75% { clip-path: inset(80% 0 4% 0); transform: translate(9px, 0); } 100% { clip-path: inset(44% 0 40% 0); transform: translate(-2px, 0); } }
@keyframes goGlxB { 0% { clip-path: inset(66% 0 12% 0); transform: translate(6px, 0); } 33% { clip-path: inset(14% 0 64% 0); transform: translate(-8px, 0); } 66% { clip-path: inset(40% 0 38% 0); transform: translate(4px, 0); } 100% { clip-path: inset(2% 0 86% 0); transform: translate(-5px, 0); } }

/* jauge d'alimentation et messages des IA pendant l'extinction */
.go-status {
  position: absolute; left: 50%; top: 70%; transform: translateX(-50%); width: min(400px, 90vw);
  padding: 10px 14px; border-radius: 10px; pointer-events: none; opacity: 0; transition: opacity 0.4s;
  background: rgba(3,4,12,0.8); border: 1px solid rgba(255,64,96,0.35); box-shadow: 0 0 24px rgba(255,32,80,0.18);
  font-family: var(--font-d); text-transform: uppercase; --pc: var(--cyan);
}
.go-status.on { opacity: 1; }
.go-pw { display: flex; align-items: center; gap: 10px; font-size: 9px; letter-spacing: 0.16em; color: #a9b8d6; }
.go-bar { flex: 1; height: 6px; border-radius: 3px; background: rgba(255,255,255,0.08); overflow: hidden; }
.go-bar i { display: block; height: 100%; width: 100%; background: var(--pc); box-shadow: 0 0 10px var(--pc); }
.go-pw b { min-width: 3.4em; text-align: right; font-size: 12px; color: var(--pc); }
.go-msg { margin-top: 8px; min-height: 1.3em; text-align: center; font-size: 11px; letter-spacing: 0.18em; }
.go-msg.lumen { color: var(--cyan); text-shadow: 0 0 8px rgba(41,227,255,0.8); animation: goBlink 0.5s steps(1) 4; }
.go-msg.null { color: var(--null); text-shadow: 0 0 10px rgba(255,32,80,0.9); animation: glitch 0.25s infinite; }
@keyframes goBlink { 50% { opacity: 0.15; } }

/* mise en page : en-tête, panneaux, menu ; centré verticalement sans rogner (défile au besoin) */
.go-wrap {
  position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; gap: 12px;
  padding: calc(14px + var(--safe-t)) calc(12px + var(--safe-r)) calc(30px + var(--safe-b)) calc(12px + var(--safe-l));
  overflow-x: hidden; overflow-y: auto; touch-action: pan-y;
}
.go-wrap::before, .go-wrap::after { content: ''; flex: 1 1 0; }
.go-head { text-align: center; visibility: hidden; max-width: 100%; }
.go-head.on { visibility: visible; }
.go-title {
  position: relative; margin: 0; font-family: var(--font-d); font-weight: 900; font-size: clamp(24px, 7.4vw, 66px);
  line-height: 1.12; letter-spacing: 0.08em; color: #fff; white-space: nowrap;
  text-shadow: 0 0 12px rgba(41,227,255,0.9), 0 0 38px rgba(41,227,255,0.45);
}
.go-title .go-sz { visibility: hidden; }
.go-title .sl { position: absolute; left: 0; top: 0; width: 100%; clip-path: inset(var(--t) -80px var(--b) -80px); }
.go-head.on .go-title .sl { animation: goSlice 0.75s steps(6, end) calc(var(--i) * 75ms) both; }
@keyframes goSlice {
  0% { transform: translateX(var(--dx)); opacity: 0; color: var(--sc); }
  25% { opacity: 1; }
  70% { transform: translateX(calc(var(--dx) * -0.1)); color: var(--sc); }
  100% { transform: none; opacity: 1; color: #fff; }
}
.go-head.on .go-title { animation: goNeon 1.5s 0.6s both, goBreath 3.4s 2.2s ease-in-out infinite alternate; }
@keyframes goNeon { 0%, 100% { opacity: 1; } 6% { opacity: 0.2; } 10% { opacity: 1; } 18% { opacity: 0.35; } 22% { opacity: 1; } 58% { opacity: 1; } 61% { opacity: 0.5; } 64% { opacity: 1; } }
@keyframes goBreath { to { text-shadow: 0 0 18px rgba(41,227,255,1), 0 0 60px rgba(41,227,255,0.6), 0 0 90px rgba(255,61,242,0.28); } }
.go-title.glx::before, .go-title.glx::after { opacity: 0; }
.go-head.on .go-title.glx::before { color: var(--magenta); clip-path: inset(0 0 58% 0); animation: glitchA 3.1s 2s infinite; }
.go-head.on .go-title.glx::after { color: var(--red); clip-path: inset(52% 0 0 0); animation: glitchB 2.5s 2.4s infinite; }
.go-sub { display: inline-block; margin-top: 6px; font-family: var(--font-d); font-size: clamp(9px, 2.3vw, 13px); letter-spacing: 0.3em; text-transform: uppercase; color: #9fb0cf; }
.go-head.on .go-sub { animation: goType 1.2s steps(36) 0.9s both; }
@keyframes goType { from { clip-path: inset(0 100% 0 0); } to { clip-path: inset(0 0 0 0); } }

.go-body { display: flex; justify-content: center; align-items: flex-start; gap: 16px; width: 100%; max-width: 940px; }
.go-panel {
  position: relative; flex: 0 1 450px; min-width: 0; padding: 14px 18px 16px; border-radius: 14px; visibility: hidden;
  background: linear-gradient(180deg, rgba(12,16,38,0.92), rgba(5,7,18,0.94));
  border: 1px solid rgba(41,227,255,0.34);
  box-shadow: 0 0 30px rgba(41,227,255,0.14), inset 0 0 28px rgba(41,227,255,0.05);
}
.go-panel::before, .go-panel::after { content: ''; position: absolute; width: 18px; height: 18px; pointer-events: none; border: 2px solid var(--cyan); filter: drop-shadow(0 0 4px var(--cyan)); }
.go-panel::before { left: 6px; top: 6px; border-right: 0; border-bottom: 0; border-radius: 6px 0 0 0; }
.go-panel::after { right: 6px; bottom: 6px; border-left: 0; border-top: 0; border-radius: 0 0 6px 0; }
.go-panel.on { visibility: visible; animation: goCrt 0.65s cubic-bezier(0.2, 0.8, 0.2, 1) both; }
@keyframes goCrt {
  0% { transform: scale(0.03, 0.006); opacity: 0; filter: brightness(4); }
  35% { transform: scale(1, 0.012); opacity: 1; filter: brightness(3); }
  72% { transform: scale(1, 1.03); filter: brightness(1.4); }
  100% { transform: none; opacity: 1; filter: none; }
}
.go-lbl { font-family: var(--font-d); font-size: 11px; letter-spacing: 0.3em; text-transform: uppercase; color: var(--muted); text-align: center; margin: 2px 0 4px; }

/* score final : chiffres à largeur fixe (pas de tremblement pendant le décompte) */
.go-report { container-type: inline-size; }
.go-score {
  --em: 6; font-family: var(--font-d); font-weight: 900; line-height: 1.12; text-align: center; white-space: nowrap; color: #fff;
  font-size: clamp(30px, 9vw, 64px); font-size: min(var(--smax, 66px), calc(100cqw / var(--em)));
  text-shadow: 0 0 14px rgba(41,227,255,0.85), 0 0 42px rgba(41,227,255,0.4);
}
.go-score i { font-style: normal; display: inline-block; text-align: center; }
.go-score .d { width: 0.8em; }
.go-score .s { width: 0.32em; }
.go-score.punch { animation: goPunch 0.6s cubic-bezier(0.2, 1.6, 0.4, 1); }
@keyframes goPunch { 0% { transform: scale(1.25); filter: brightness(2.4); } 100% { transform: none; filter: none; } }
.go-score.gold { color: #fff3c4; text-shadow: 0 0 14px rgba(255,216,74,0.95), 0 0 48px rgba(255,170,40,0.6); }

/* rapport ligne à ligne : libellé tapé, pointillés, valeur */
.go-stats { list-style: none; margin: 10px 0 4px; padding: 0; display: grid; gap: 1px 20px; font-size: 15px; }
.go-stats li { display: flex; align-items: baseline; gap: 8px; visibility: hidden; line-height: 1.5; min-width: 0; }
.go-stats li.on { visibility: visible; }
.go-stats .k { color: #c9d6ee; font-weight: 600; white-space: nowrap; }
.go-stats li.on .k { animation: goType 0.32s steps(var(--n, 14)) both; }
.go-stats .ld { flex: 1; min-width: 10px; border-bottom: 1px dotted rgba(127,147,184,0.45); transform-origin: left; }
.go-stats li.on .ld { animation: goLead 0.3s 0.1s both; }
@keyframes goLead { from { transform: scaleX(0); } }
.go-stats .v { font-family: var(--font-d); font-weight: 700; font-size: 13px; color: var(--cyan); white-space: nowrap; text-shadow: 0 0 8px rgba(41,227,255,0.5); }
.go-stats li.on .v { animation: goPop 0.3s 0.15s both; }
@keyframes goPop { 0% { opacity: 0; transform: scale(1.6); } 100% { opacity: 1; transform: none; } }

/* classement : record (or, rayons), rang, hors classement */
.go-rank { position: relative; text-align: center; margin-top: 10px; min-height: 3.1em; visibility: hidden; }
.go-rank.on { visibility: visible; }
.go-rank .rm1 { position: relative; font-family: var(--font-d); font-weight: 900; font-size: clamp(18px, 5.2vw, 30px); letter-spacing: 0.08em; line-height: 1.2; }
.go-rank .rm1 sup { font-size: 0.55em; }
.go-rank .rm2 { position: relative; margin-top: 3px; font-size: 14px; color: #9fb0cf; }
.go-rank.on .rm1 { animation: goStamp 0.65s cubic-bezier(0.2, 1.5, 0.4, 1) both; }
.go-rank.on .rm2 { animation: goUp 0.4s 0.35s both; }
@keyframes goStamp { 0% { transform: scale(2.6) rotate(-5deg); opacity: 0; filter: blur(6px); } 60% { transform: scale(0.95); opacity: 1; filter: none; } 100% { transform: none; opacity: 1; } }
@keyframes goUp { from { opacity: 0; transform: translateY(10px); } }
.go-rank.rec .rm1 { color: var(--gold); text-shadow: 0 0 12px rgba(255,216,74,0.95), 0 0 36px rgba(255,160,40,0.6); }
.go-rank.on.rec .rm1 { animation: goStamp 0.65s cubic-bezier(0.2, 1.5, 0.4, 1) both, goGold 0.9s 0.7s ease-in-out infinite alternate; }
@keyframes goGold { to { text-shadow: 0 0 20px rgba(255,236,150,1), 0 0 60px rgba(255,170,40,0.9); filter: brightness(1.2); } }
.go-rank.rec::before {
  content: ''; position: absolute; left: 50%; top: 0.7em; width: 300px; height: 300px; margin: -150px 0 0 -150px; pointer-events: none;
  background: repeating-conic-gradient(rgba(255,216,74,0.2) 0 7deg, transparent 7deg 20deg);
  -webkit-mask: radial-gradient(ellipse 50% 22% at 50% 50%, #000 20%, transparent 100%); mask: radial-gradient(ellipse 50% 22% at 50% 50%, #000 20%, transparent 100%);
  animation: goRays 9s linear infinite;
}
@keyframes goRays { to { transform: rotate(1turn); } }
.go-rank.top .rm1 { color: var(--cyan); text-shadow: 0 0 12px rgba(41,227,255,0.85); }
.go-rank.out .rm1 { color: #8fa1c4; }

/* second panneau : initiales (or) puis classement (magenta) */
.go-side { border-color: rgba(255,61,242,0.36); box-shadow: 0 0 30px rgba(255,61,242,0.14), inset 0 0 28px rgba(255,61,242,0.05); }
.go-side::before, .go-side::after { border-color: var(--magenta); filter: drop-shadow(0 0 4px var(--magenta)); }
.go-side.entry { border-color: rgba(255,216,74,0.45); box-shadow: 0 0 30px rgba(255,216,74,0.16), inset 0 0 28px rgba(255,216,74,0.05); }
.go-side.entry::before, .go-side.entry::after { border-color: var(--gold); filter: drop-shadow(0 0 4px var(--gold)); }
.go-entry, .go-board { display: none; }
.go-side.entry .go-entry, .go-side.board .go-board { display: block; }

/* saisie d'initiales façon borne d'arcade */
.go-entry { text-align: center; }
.go-entry .go-lbl { color: var(--gold); }
.go-slots { display: flex; justify-content: center; gap: 14px; margin: 18px 0 14px; }
.go-slot {
  position: relative; width: 66px; height: 80px; padding: 0; border-radius: 12px; cursor: pointer; touch-action: manipulation;
  border: 2px solid rgba(41,227,255,0.28); background: linear-gradient(180deg, rgba(0,0,0,0.55), rgba(20,26,50,0.6));
  color: #e8f4ff; font-family: var(--font-d); font-weight: 900; font-size: 44px; line-height: 1;
}
.go-slot.set { color: var(--gold); border-color: rgba(255,216,74,0.6); text-shadow: 0 0 12px rgba(255,216,74,0.8); }
.go-slot.cur { color: #fff; border-color: var(--cyan); text-shadow: 0 0 14px rgba(41,227,255,0.9); box-shadow: 0 0 20px rgba(41,227,255,0.55), inset 0 0 16px rgba(41,227,255,0.22); animation: goCur 0.8s ease-in-out infinite alternate; }
.go-slot.cur::before, .go-slot.cur::after { position: absolute; left: 0; right: 0; font-size: 10px; line-height: 1; color: var(--cyan); text-shadow: 0 0 6px var(--cyan); }
.go-slot.cur::before { content: '▲'; top: -15px; }
.go-slot.cur::after { content: '▼'; bottom: -15px; }
@keyframes goCur { to { box-shadow: 0 0 30px rgba(41,227,255,0.9), inset 0 0 22px rgba(41,227,255,0.35); } }
.go-slot.up { animation: goFlipUp 0.16s ease-out; }
.go-slot.dn { animation: goFlipDn 0.16s ease-out; }
.go-slot.cur.up { animation: goFlipUp 0.16s ease-out, goCur 0.8s 0.16s ease-in-out infinite alternate; }
.go-slot.cur.dn { animation: goFlipDn 0.16s ease-out, goCur 0.8s 0.16s ease-in-out infinite alternate; }
@keyframes goFlipUp { from { transform: translateY(9px) scaleY(0.6); filter: brightness(2); } }
@keyframes goFlipDn { from { transform: translateY(-9px) scaleY(0.6); filter: brightness(2); } }
.go-keys { display: flex; justify-content: center; gap: 12px; margin-top: 20px; }
.go-key {
  min-width: 66px; height: 56px; padding: 0 14px; border-radius: 14px; cursor: pointer; touch-action: manipulation;
  border: 1px solid rgba(41,227,255,0.4); background: rgba(41,227,255,0.08); color: #fff;
  font-family: var(--font-d); font-size: 20px; font-weight: 700; letter-spacing: 0.06em; transition: transform 0.08s, background 0.15s;
}
.go-key:hover { background: rgba(41,227,255,0.2); }
.go-key:active { transform: scale(0.94); background: rgba(41,227,255,0.3); }
.go-key.ok { min-width: 104px; font-size: 16px; border-color: var(--gold); color: var(--gold); background: linear-gradient(180deg, rgba(255,216,74,0.24), rgba(255,216,74,0.06)); }
.go-entry.ready .go-key.ok { animation: goOk 0.6s ease-in-out infinite alternate; }
@keyframes goOk { to { box-shadow: 0 0 26px rgba(255,216,74,0.85); background: rgba(255,216,74,0.32); color: #fff; } }
.go-hint { margin-top: 12px; font-size: 13px; color: var(--muted); line-height: 1.6; }
.go-entry.done .go-slot { color: var(--lime); border-color: var(--lime); text-shadow: 0 0 14px rgba(93,255,143,0.9); box-shadow: 0 0 22px rgba(93,255,143,0.5); animation: goSaved 0.5s both; }
.go-entry.done .go-slot::before, .go-entry.done .go-slot::after { display: none; }
@keyframes goSaved { 0% { transform: scale(1.25); filter: brightness(2.5); } }

/* tableau des scores : lignes qui arrivent une à une, balayage lumineux */
.go-board { position: relative; overflow: hidden; margin: -4px; padding: 4px; }
.lb { list-style: none; margin: 6px 0 0; padding: 0; display: flex; flex-direction: column; gap: 3px; }
.lb-row {
  position: relative; display: grid; grid-template-columns: 2em 3.4em 1fr auto auto; align-items: center; gap: 8px;
  padding: 4px 10px; border-radius: 8px; font-size: 15px; line-height: 1.35; overflow: hidden; text-align: left;
  background: rgba(255,255,255,0.035); border: 1px solid rgba(255,255,255,0.06);
}
.lb-row .rk { font-family: var(--font-d); font-size: 11px; font-weight: 700; color: var(--muted); }
.lb-row .nm { font-family: var(--font-d); font-weight: 700; letter-spacing: 0.14em; color: #fff; white-space: nowrap; }
.lb-row .ld { height: 0; border-bottom: 1px dotted rgba(127,147,184,0.35); transform: translateY(4px); }
.lb-row .lv { font-family: var(--font-d); font-size: 10px; color: var(--muted); letter-spacing: 0.06em; white-space: nowrap; }
.lb-row .sc { font-family: var(--font-d); font-weight: 700; font-size: 14px; color: var(--cyan); text-align: right; white-space: nowrap; text-shadow: 0 0 8px rgba(41,227,255,0.45); }
.lb-row.r1 { background: linear-gradient(90deg, rgba(255,216,74,0.2), rgba(255,216,74,0.04)); border-color: rgba(255,216,74,0.5); }
.lb-row.r1 .rk, .lb-row.r1 .nm, .lb-row.r1 .sc { color: var(--gold); text-shadow: 0 0 10px rgba(255,216,74,0.75); }
.lb-row.r1::after { content: ''; position: absolute; top: 0; bottom: 0; left: -40%; width: 30%; pointer-events: none; background: linear-gradient(100deg, transparent, rgba(255,246,200,0.35), transparent); animation: goShine 3.2s 1.5s ease-in-out infinite; }
@keyframes goShine { 0% { transform: translateX(0); } 45%, 100% { transform: translateX(560%); } }
.lb-row.r2 .sc { color: #e3ecff; text-shadow: 0 0 8px rgba(220,232,255,0.5); }
.lb-row.r3 .sc { color: #ffb27a; text-shadow: 0 0 8px rgba(255,160,90,0.5); }
.lb-row.empty > * { opacity: 0.3; }
.lb-row.me { background: linear-gradient(90deg, rgba(255,61,242,0.36), rgba(41,227,255,0.16)); border-color: var(--magenta); }
.lb-row.me .rk, .lb-row.me .nm { color: #fff; }
.lb-row.you { margin-top: 6px; border: 1px dashed rgba(255,61,242,0.6); background: rgba(255,61,242,0.1); }
.lb-row.you .nm { color: var(--magenta); }
.lb.on .lb-row { animation: goRow 0.5s cubic-bezier(0.2, 0.9, 0.3, 1.25) calc(0.3s + var(--i) * 85ms) both; }
.lb.on .lb-row.me, .lb.on .lb-row.you { animation: goRow 0.5s cubic-bezier(0.2, 0.9, 0.3, 1.25) calc(0.3s + var(--i) * 85ms) both, goMe 0.9s calc(0.8s + var(--i) * 85ms) ease-in-out infinite alternate; }
@keyframes goRow { 0% { opacity: 0; transform: translateX(80px) skewX(-22deg); filter: brightness(3); } 60% { opacity: 1; transform: translateX(-6px) skewX(4deg); } 100% { opacity: 1; transform: none; filter: none; } }
@keyframes goMe { from { box-shadow: 0 0 6px rgba(255,61,242,0.3); } to { box-shadow: 0 0 22px rgba(255,61,242,0.9), inset 0 0 12px rgba(255,255,255,0.18); } }
.go-scan { position: absolute; left: 0; right: 0; top: 0; height: 34%; pointer-events: none; opacity: 0; background: linear-gradient(180deg, transparent, rgba(41,227,255,0.12) 42%, rgba(255,255,255,0.2) 50%, rgba(41,227,255,0.12) 58%, transparent); }
.go-board.on .go-scan { animation: goScan 4.6s 1.6s linear infinite; }
@keyframes goScan { 0% { transform: translateY(-100%); opacity: 1; } 60% { transform: translateY(300%); opacity: 1; } 60.01%, 100% { transform: translateY(300%); opacity: 0; } }

/* menu, onglets (petits écrans), aide en bas à droite */
.go-tabs { display: none; gap: 6px; justify-content: center; }
.go-tabs button { font-family: var(--font-d); font-size: 10px; letter-spacing: 0.18em; text-transform: uppercase; padding: 7px 14px; border-radius: 20px; cursor: pointer; border: 1px solid rgba(41,227,255,0.25); background: rgba(4,6,14,0.6); color: var(--muted); }
.go-tabs button.cur { color: #fff; border-color: var(--cyan); background: rgba(41,227,255,0.16); box-shadow: 0 0 12px rgba(41,227,255,0.35); }
.go-menu { display: flex; justify-content: center; gap: 10px; width: min(450px, 100%); visibility: hidden; }
.go-menu.on { visibility: visible; animation: goUp 0.5s 0.2s both; }
.go-menu .btn { flex: 1 1 0; max-width: 220px; }
.go-skip { position: absolute; right: calc(14px + var(--safe-r)); bottom: calc(10px + var(--safe-b)); font-family: var(--font-d); font-size: 10px; letter-spacing: 0.2em; text-transform: uppercase; color: rgba(159,176,207,0.8); pointer-events: none; animation: goBlinkSoft 1.6s ease-in-out infinite alternate; }
@keyframes goBlinkSoft { from { opacity: 0.35; } to { opacity: 0.9; } }
.go-stage.idle .go-skip { animation: none; opacity: 0.55; }

/* feux d'artifice (particules DOM) */
.go-sparks { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.fw { position: absolute; width: 0; height: 0; }
.fw i { position: absolute; left: -3.5px; top: -3.5px; width: 7px; height: 7px; border-radius: 50%; background: #fff; box-shadow: 0 0 6px 2px var(--c), 0 0 14px 4px var(--c); animation: goFw var(--d, 1.2s) cubic-bezier(0.12, 0.8, 0.3, 1) both; }
@keyframes goFw { 0% { transform: translate(0, 0) scale(1.4); opacity: 1; } 75% { opacity: 1; } 100% { transform: translate(var(--x), var(--y)) scale(0.2); opacity: 0; } }
.fw .core { position: absolute; left: -50px; top: -50px; width: 100px; height: 100px; border-radius: 50%; background: radial-gradient(circle, #fff 0, var(--c) 25%, transparent 68%); animation: goCore 0.6s ease-out both; }
@keyframes goCore { 0% { transform: scale(0.2); opacity: 1; } 100% { transform: scale(2.4); opacity: 0; } }

/* grand écran : deux colonnes, le second panneau s'ouvre en glissant */
.go-wide .go-side {
  flex: 0 1 430px; max-width: 0; padding-left: 0; padding-right: 0; margin-left: -16px; border-width: 0; opacity: 0; overflow: hidden;
  transition: max-width 0.7s cubic-bezier(0.2, 0.8, 0.2, 1), padding 0.7s, margin 0.7s, opacity 0.35s 0.4s;
}
.go-wide .go-side.on { max-width: 430px; padding-left: 18px; padding-right: 18px; margin-left: 0; border-width: 1px; opacity: 1; animation: none; }
/* petit écran : une vue à la fois (rapport, initiales, classement) */
.go-stage:not(.go-wide) .go-body { flex-direction: column; align-items: center; gap: 12px; }
.go-stage:not(.go-wide) .go-panel { flex: none; width: min(450px, 100%); }
.go-stage:not(.go-wide) .go-side:not(.on) { display: none; }
.go-stage:not(.go-wide)[data-view="entry"] .go-stats { display: none; }
.go-stage:not(.go-wide)[data-view="board"] .go-report { display: none; }
.go-stage:not(.go-wide)[data-view="report"] .go-side { display: none; }
.go-stage.idle:not(.go-wide) .go-tabs { display: flex; }

/* cinématique passée : état final immédiat */
.go-fast .go-head.on .go-title { animation: goBreath 3.4s ease-in-out infinite alternate; }
.go-fast .go-head.on .go-title .sl, .go-fast .go-head.on .go-sub, .go-fast .go-panel.on, .go-fast .go-stats li.on > *, .go-fast .go-signal *, .go-fast .go-flash { animation: none; }

@media (max-width: 520px) { .go-sig2 .cd { display: none; } }
@media (max-width: 420px) {
  .go-sub { letter-spacing: 0.15em; white-space: nowrap; }
  .go-panel { padding: 12px 12px 14px; }
  .go-stats { font-size: 14px; }
  .lb-row { gap: 6px; padding: 4px 8px; grid-template-columns: 1.8em 3.2em 1fr auto; }
  .lb-row .lv { display: none; }
  .go-slots { gap: 12px; }
}
@media (max-height: 560px) {
  .go-wrap { gap: 8px; padding-top: calc(8px + var(--safe-t)); padding-bottom: calc(22px + var(--safe-b)); }
  .go-title { font-size: clamp(20px, 6vh, 34px); }
  .go-sub { font-size: 9px; margin-top: 2px; }
  .go-panel { padding: 8px 14px 10px; }
  .go-score { --smax: 40px; }
  .go-stats { grid-template-columns: 1fr 1fr; font-size: 13px; margin: 6px 0 2px; gap: 0 16px; }
  .go-stats li { line-height: 1.38; }
  .go-stats .v { font-size: 11px; }
  .go-rank { margin-top: 4px; min-height: 0; }
  .go-rank .rm1 { font-size: 18px; }
  .go-rank .rm2 { font-size: 12px; }
  .lb { gap: 2px; margin-top: 2px; }
  .lb-row { padding: 1px 8px; font-size: 13px; line-height: 1.3; }
  .lb-row .sc { font-size: 12px; }
  .go-slots { margin: 12px 0 8px; }
  .go-slot { width: 54px; height: 62px; font-size: 34px; }
  .go-keys { margin-top: 14px; }
  .go-key { height: 48px; }
  .go-hint { margin-top: 6px; font-size: 12px; }
  .go-menu .btn { padding: 9px 14px; }
  .go-stage.idle .go-skip { display: none; }
}
@media (max-height: 560px) and (max-width: 759px) {
  .go-stats { grid-template-columns: 1fr; font-size: 12px; }
  .go-stats li { line-height: 1.22; }
  .go-stats .v { font-size: 10px; }
}
@media (max-height: 420px) {
  .go-wrap { gap: 6px; padding-top: calc(6px + var(--safe-t)); padding-bottom: calc(6px + var(--safe-b)); }
  .go-panel { padding: 6px 12px 8px; }
  .go-title { font-size: 20px; }
  .go-sub { font-size: 8px; }
  .go-score { --smax: 34px; }
  .go-rank .rm1 { font-size: 16px; }
  .go-rank .rm2 { font-size: 11px; margin-top: 0; }
  .lb { gap: 1px; }
  .lb-row { line-height: 1.2; padding: 0 8px; }
  .lb-row.you { margin-top: 3px; }
  .go-slots { margin: 10px 0 6px; }
  .go-slot { width: 48px; height: 54px; font-size: 30px; }
  .go-keys { margin-top: 12px; }
  .go-key { height: 44px; }
  .go-hint { display: none; }
  .go-menu .btn { padding: 7px 12px; }
}

/* meilleurs scores de l'écran d'accueil : même habillage que le tableau de fin de session */
#hiscores.lb { padding: 0; max-width: 340px; margin: 0 auto; }
#hiscores .lb-row { grid-template-columns: 1.8em 3.2em 1fr auto; padding: 2px 10px; font-size: 14px; animation: goRow 0.45s cubic-bezier(0.2, 0.9, 0.3, 1.25) calc(0.2s + var(--i) * 70ms) both; }
#hiscores .lb-row span { float: none; }
#hiscores .lb-row .nm { font-family: var(--font-d); font-size: 13px; color: #fff; }
#hiscores .lb-row .sc { font-family: var(--font-d); font-size: 13px; color: var(--cyan); }
#hiscores .lb-row.r1 .nm, #hiscores .lb-row.r1 .sc { color: var(--gold); }
#hiscores .lb-row .lv { display: none; }
#hiscores .empty { margin-left: 0; }

/* réglages d'accessibilité */
#app.rm .go-stage *, #app.rm .go-stage *::before, #app.rm .go-stage *::after, #app.rm #hiscores .lb-row { animation: none !important; transition: none !important; }
#app.rfx .go-sig.glx::before, #app.rfx .go-sig.glx::after, #app.rfx .go-title.glx::before, #app.rfx .go-title.glx::after, #app.rfx .go-tear, #app.rfx .go-rank.rec::before { display: none; }
#app.rfx .go-flash.on { animation-name: goFlashSoft; }
#app.rm .go-signal.on .go-sig2 { opacity: 1; }

/* Écran tactile : les lueurs « qui respirent » animent des ombres portées, repeintes à
   chaque image (rien n'est confié au compositeur). Sur un GPU de téléphone, ces boucles
   infinies faisaient tomber la fin de session vers 10 fps : elles restent allumées, fixes. */
@media (pointer: coarse) {
  .go-head.on .go-title { animation: goNeon 1.5s 0.6s both; }
  .go-fast .go-head.on .go-title { animation: none; }
  .go-rank.on.rec .rm1 { animation: goStamp 0.65s cubic-bezier(0.2, 1.5, 0.4, 1) both; }
  .go-slot.cur { animation: none; box-shadow: 0 0 24px rgba(41,227,255,0.75), inset 0 0 18px rgba(41,227,255,0.28); }
  .go-slot.cur.up { animation: goFlipUp 0.16s ease-out; }
  .go-slot.cur.dn { animation: goFlipDn 0.16s ease-out; }
  .go-entry.ready .go-key.ok { animation: none; box-shadow: 0 0 22px rgba(255,216,74,0.7); background: rgba(255,216,74,0.26); color: #fff; }
  .lb.on .lb-row.me, .lb.on .lb-row.you { animation: goRow 0.5s cubic-bezier(0.2, 0.9, 0.3, 1.25) calc(0.3s + var(--i) * 85ms) both; box-shadow: 0 0 16px rgba(255,61,242,0.7); }
  /* Modes de fusion : un seul élément en « screen » fait recomposer tout l'écran sous lui
     (décor, plateau, calques) dans une image intermédiaire, à chaque image. Le flash rouge
     plein écran restait en place après son éclair : il pesait sur toute la fin de session. */
  .go-flash, .go-sig.glx::before, .go-sig.glx::after { mix-blend-mode: normal; }
  .go-flash.on { animation-name: goFlashSoft; }
  /* rayons du record : dégradé conique masqué qui tournait en boucle, figé */
  .go-rank.rec::before { animation: none; }
}
