/* OUSNEL — habillage commun des univers de jeu */
:root {
  --c1: #00f0ff; --c2: #ff00e6; --fond: #05010f; --texte: #e8f3ff; --doux: #93a4c8;
  --verre: rgba(10, 6, 30, 0.72); --bord: rgba(255, 255, 255, 0.1);
  --titre: 'Orbitron', 'Segoe UI', sans-serif; --corps: 'Rajdhani', 'Segoe UI', system-ui, sans-serif;
}
* { margin: 0; padding: 0; box-sizing: border-box; }
html, body { width: 100%; height: 100%; overflow: hidden; background: var(--fond); color: var(--texte); font-family: var(--corps); }
body { -webkit-tap-highlight-color: transparent; user-select: none; -webkit-user-select: none; overscroll-behavior: none; }
canvas.scene { position: fixed; inset: 0; display: block; touch-action: none; cursor: crosshair; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
a { color: inherit; }
:focus-visible { outline: 2px solid var(--c1); outline-offset: 3px; }

/* ---------- Barre ---------- */
.barre {
  position: fixed; top: 0; left: 0; right: 0; z-index: 50; height: 52px;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 0 max(14px, env(safe-area-inset-right)) 0 max(14px, env(safe-area-inset-left));
  background: linear-gradient(180deg, rgba(5, 1, 15, 0.85), rgba(5, 1, 15, 0));
  pointer-events: none;
}
.barre > * { pointer-events: auto; }
.retour { display: flex; align-items: center; gap: 8px; text-decoration: none; font-family: var(--titre); font-weight: 900; letter-spacing: 3px; font-size: 13px; padding: 8px 10px; border-radius: 10px; transition: background .2s; }
.retour:hover { background: rgba(255, 255, 255, 0.07); }
.retour .fleche { color: var(--c1); font-size: 16px; }
.logo-mini { background: linear-gradient(90deg, var(--c1), var(--c2)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.titre-jeu { font-family: var(--titre); font-size: 12px; letter-spacing: 4px; color: var(--doux); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; pointer-events: none; }
.titre-jeu .num { color: var(--c1); margin-right: 8px; }
.actions { display: flex; gap: 4px; }
.ico { width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center; color: var(--texte); transition: background .2s, color .2s; }
.ico svg { width: 20px; height: 20px; }
.ico:hover { background: rgba(255, 255, 255, 0.08); color: var(--c1); }
.ico.off { color: var(--doux); opacity: .6; }
body:not(.en-jeu) .ico[data-a="pause"] { opacity: .3; }

/* ---------- HUD ---------- */
.hud { position: fixed; top: 54px; left: 0; right: 0; z-index: 20; display: flex; justify-content: center; gap: clamp(12px, 4vw, 40px); pointer-events: none; padding: 0 12px; flex-wrap: wrap; }
.hud-item { display: flex; flex-direction: column; align-items: center; min-width: 64px; }
.hud-item .lab { font-family: var(--titre); font-size: 9px; letter-spacing: 3px; color: var(--doux); }
.hud-item .val { font-family: var(--titre); font-weight: 700; font-size: clamp(17px, 2.6vw, 24px); color: #fff; text-shadow: 0 0 10px var(--c1), 0 0 22px var(--c1); font-variant-numeric: tabular-nums; }
.hud-item .val.pop { animation: pop .25s ease-out; }
@keyframes pop { 0% { transform: scale(1.35); color: var(--c1); } 100% { transform: scale(1); } }
body:not(.en-jeu) .hud { opacity: 0; transition: opacity .3s; }

/* ---------- Écrans ---------- */
.ecran {
  position: fixed; inset: 0; z-index: 40; display: flex; align-items: center; justify-content: center; padding: 64px 16px 20px;
  background: radial-gradient(ellipse at 50% 40%, rgba(20, 4, 50, 0.55), rgba(5, 1, 15, 0.9));
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
  opacity: 0; visibility: hidden; transition: opacity .35s, visibility .35s; overflow-y: auto;
}
.ecran.visible { opacity: 1; visibility: visible; }
.carte { width: min(560px, 100%); text-align: center; margin: auto; animation: monte .5s cubic-bezier(.2, .9, .3, 1.2) both; }
.ecran:not(.visible) .carte { animation: none; }
@keyframes monte { from { opacity: 0; transform: translateY(24px) scale(.97); } }
.sur-titre { font-family: var(--titre); font-size: 11px; letter-spacing: 5px; color: var(--c1); opacity: .85; margin-bottom: 10px; }
.carte h1, .carte h2 { font-family: var(--titre); font-weight: 900; letter-spacing: clamp(4px, 1.2vw, 10px); line-height: 1.05; }
.carte h1 { font-size: clamp(34px, 9vw, 72px); }
.carte h2 { font-size: clamp(28px, 7vw, 52px); color: var(--c2); text-shadow: 0 0 18px var(--c2); }
.accroche { font-size: clamp(17px, 2.4vw, 20px); color: #cfe0ff; margin: 14px auto 18px; max-width: 460px; line-height: 1.35; }
.regles { list-style: none; display: grid; gap: 6px; margin: 0 auto 14px; max-width: 470px; text-align: left; }
.regles li { font-size: 16px; line-height: 1.35; padding: 8px 12px 8px 34px; position: relative; background: rgba(255, 255, 255, 0.04); border: 1px solid var(--bord); border-radius: 10px; color: #dbe6ff; }
.regles li::before { content: ''; position: absolute; left: 13px; top: 15px; width: 8px; height: 8px; border-radius: 2px; transform: rotate(45deg); background: var(--c1); box-shadow: 0 0 8px var(--c1); }
.regles b { color: var(--c1); font-weight: 700; }
.controles { font-size: 14px; color: var(--doux); letter-spacing: .5px; margin-bottom: 6px; }
.controles kbd { font-family: var(--titre); font-size: 10px; padding: 2px 6px; border: 1px solid var(--bord); border-radius: 5px; background: rgba(255, 255, 255, .06); color: #fff; }

.glitch { position: relative; color: #fff; text-shadow: 0 0 12px var(--c1), 0 0 40px var(--c1); }
.glitch::before, .glitch::after { content: attr(data-texte); position: absolute; inset: 0; pointer-events: none; }
.glitch::before { color: var(--c1); transform: translate(-3px, 0); clip-path: inset(0 0 60% 0); animation: gl1 3.2s infinite steps(1); mix-blend-mode: screen; opacity: .8; }
.glitch::after { color: var(--c2); transform: translate(3px, 0); clip-path: inset(55% 0 0 0); animation: gl2 2.7s infinite steps(1); mix-blend-mode: screen; opacity: .8; }
@keyframes gl1 { 0%, 88%, 100% { transform: translate(0); clip-path: inset(0 0 100% 0); } 90% { transform: translate(-5px, -2px); clip-path: inset(10% 0 55% 0); } 94% { transform: translate(4px, 1px); clip-path: inset(40% 0 30% 0); } }
@keyframes gl2 { 0%, 84%, 100% { transform: translate(0); clip-path: inset(100% 0 0 0); } 86% { transform: translate(5px, 2px); clip-path: inset(60% 0 10% 0); } 91% { transform: translate(-4px, -1px); clip-path: inset(20% 0 65% 0); } }

.btn-ousnel {
  position: relative; margin: 18px auto 8px; display: inline-flex; padding: 16px 46px; border-radius: 14px;
  font-family: var(--titre); font-weight: 900; font-size: 17px; letter-spacing: 6px; color: #05010f;
  background: linear-gradient(100deg, var(--c1), var(--c2)); box-shadow: 0 0 24px rgba(255, 255, 255, .15), 0 0 40px -6px var(--c1);
  transition: transform .2s, box-shadow .2s; overflow: hidden;
}
.btn-ousnel::after { content: ''; position: absolute; inset: 0; background: linear-gradient(100deg, transparent 30%, rgba(255, 255, 255, .6) 50%, transparent 70%); transform: translateX(-120%); animation: balaie 2.8s infinite; }
@keyframes balaie { 60%, 100% { transform: translateX(120%); } }
.btn-ousnel:hover { transform: translateY(-2px) scale(1.03); box-shadow: 0 0 34px rgba(255, 255, 255, .2), 0 0 60px -4px var(--c1); }
.btn-ousnel:active { transform: scale(.98); }
.btn-ousnel span { position: relative; z-index: 1; }
.perso { font-size: 14px; color: var(--doux); margin-top: 6px; }
.perso b { color: #fff; }
.liens { display: flex; gap: 22px; justify-content: center; margin-top: 10px; }
.lien { font-size: 15px; color: var(--doux); text-decoration: underline; text-underline-offset: 4px; }
.lien:hover { color: #fff; }

.mini-classement { margin: 18px auto 0; max-width: 470px; text-align: left; background: rgba(255, 255, 255, .035); border: 1px solid var(--bord); border-radius: 14px; padding: 12px 14px; }
.mc-tete { display: flex; justify-content: space-between; align-items: baseline; font-family: var(--titre); font-size: 10px; letter-spacing: 3px; color: var(--doux); margin-bottom: 8px; gap: 10px; }
.mc-tete a { letter-spacing: 1px; font-family: var(--corps); font-size: 13px; color: var(--c1); text-decoration: none; white-space: nowrap; }
.mc-liste { list-style: none; display: grid; gap: 3px; }
.mc-liste li { display: grid; grid-template-columns: 24px 1fr auto auto; gap: 10px; align-items: center; font-size: 15px; padding: 4px 6px; border-radius: 7px; }
.mc-liste li.vide { display: block; color: var(--doux); font-size: 14px; }
.mc-liste .rg { font-family: var(--titre); font-size: 11px; color: var(--doux); }
.mc-liste li:nth-child(1) .rg { color: #ffd84d; } .mc-liste li:nth-child(2) .rg { color: #cfd8e6; } .mc-liste li:nth-child(3) .rg { color: #e09a5a; }
.mc-liste .sc { font-family: var(--titre); font-weight: 700; font-size: 13px; color: #fff; }
.mc-liste .ind { font-size: 12px; color: var(--doux); letter-spacing: 1px; }
.mc-liste .dt { font-size: 12px; color: var(--doux); opacity: .7; text-align: right; min-width: 70px; }
.mc-liste li.moi { background: rgba(255, 255, 255, .05); }
.mc-liste li.actuel { background: linear-gradient(90deg, rgba(255, 255, 255, .12), transparent); box-shadow: inset 2px 0 0 var(--c1); }

.score-final { font-family: var(--titre); font-weight: 900; font-size: clamp(48px, 13vw, 96px); line-height: 1; margin: 14px 0 6px; background: linear-gradient(180deg, #fff, var(--c1)); -webkit-background-clip: text; background-clip: text; color: transparent; filter: drop-shadow(0 0 18px var(--c1)); font-variant-numeric: tabular-nums; }
.fin-detail { color: #cfe0ff; font-size: 17px; min-height: 1em; }
.fin-badge { display: inline-block; margin-top: 10px; font-family: var(--titre); font-size: 11px; letter-spacing: 3px; color: var(--doux); }
.fin-badge.record { color: #05010f; background: linear-gradient(90deg, #ffd84d, #ff8a00); padding: 7px 14px; border-radius: 30px; animation: brille 1s ease-in-out infinite alternate; }
@keyframes brille { to { box-shadow: 0 0 26px #ffb84d; } }
.fin-rang { margin-top: 10px; font-size: 16px; color: var(--doux); min-height: 1.3em; }
.fin-rang b { color: #fff; font-family: var(--titre); }
.fin-rang .top { color: #ffd84d; font-family: var(--titre); font-size: 12px; letter-spacing: 2px; }
.suggestion a { display: grid; gap: 2px; margin: 10px auto 0; max-width: 470px; padding: 12px 16px; border-radius: 14px; text-decoration: none; text-align: left; border: 1px solid var(--bord); background: linear-gradient(100deg, rgba(255, 255, 255, .05), transparent); transition: border-color .2s, transform .2s; }
.suggestion a:hover { border-color: var(--sc); transform: translateY(-2px); }
.suggestion span { font-family: var(--titre); font-size: 9px; letter-spacing: 3px; color: var(--doux); }
.suggestion b { font-family: var(--titre); font-size: 16px; letter-spacing: 3px; color: var(--sc); }
.suggestion i { font-style: normal; font-size: 14px; color: #cfe0ff; }

.annonce { position: fixed; left: 50%; top: 38%; z-index: 25; transform: translate(-50%, -50%); font-family: var(--titre); font-weight: 900; font-size: clamp(24px, 6vw, 54px); letter-spacing: 8px; color: var(--c1); text-shadow: 0 0 20px currentColor, 0 0 50px currentColor; pointer-events: none; white-space: nowrap; animation: annonce 1.7s ease-out forwards; }
@keyframes annonce { 0% { opacity: 0; transform: translate(-50%, -50%) scale(2.2); filter: blur(10px); } 15% { opacity: 1; transform: translate(-50%, -50%) scale(1); filter: blur(0); } 75% { opacity: 1; } 100% { opacity: 0; transform: translate(-50%, -60%) scale(.95); } }
.flash { position: fixed; inset: 0; z-index: 15; pointer-events: none; opacity: 0; }
.flash.anim { animation: flash .35s ease-out forwards; }
@keyframes flash { to { opacity: 0; } }

@media (max-width: 560px) {
  .titre-jeu { display: none; }
  .regles li { font-size: 15px; }
  .btn-ousnel { padding: 15px 34px; font-size: 15px; letter-spacing: 4px; }
  .mc-liste .dt { display: none; }
  .mc-liste li { grid-template-columns: 22px 1fr auto; }
}
@media (max-height: 640px) { .regles li { padding: 5px 10px 5px 30px; font-size: 14px; } .regles li::before { top: 11px; left: 11px; } .accroche { margin: 8px auto 10px; } }
@media (prefers-reduced-motion: reduce) { .glitch::before, .glitch::after, .btn-ousnel::after { animation: none; } }
.langue-jeu { font-family: var(--titre); font-size: 11px; font-weight: 700; letter-spacing: 1px; text-decoration: none; }

/* Liens vers d'autres univers (maillage interne) */
.autres { margin: 14px auto 0; max-width: 470px; display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; align-items: center; }
.autres span { font-family: var(--titre); font-size: 9px; letter-spacing: 3px; color: var(--doux); width: 100%; margin-bottom: 2px; }
.autres a { font-family: var(--titre); font-size: 10px; letter-spacing: 2px; padding: 6px 10px; border-radius: 20px; border: 1px solid var(--bord); text-decoration: none; color: var(--doux); transition: color .2s, border-color .2s; }
.autres a:hover { color: #fff; border-color: rgba(255, 255, 255, .35); }
