:root {
  --bg: #050713;
  --panel: rgba(8, 14, 31, .92);
  --panel-soft: rgba(11, 22, 45, .76);
  --line: rgba(104, 188, 255, .22);
  --text: #f6fbff;
  --muted: #8ea4bd;
  --cyan: #51d9ff;
  --blue: #2878ff;
  --violet: #9d65ff;
  --red: #ff5a78;
  --green: #52f5ad;
}
* { box-sizing: border-box; }
html, body { width: 100%; height: 100%; margin: 0; overflow: hidden; font-family: Inter, Arial, sans-serif; background: var(--bg); color: var(--text); }
button, input { font: inherit; }
#renderCanvas { width: 100%; height: 100%; display: block; outline: none; background: radial-gradient(circle at center, #142451 0, #050713 70%); }
.hidden { display: none !important; }
.overlay { position: fixed; inset: 0; z-index: 20; display: grid; place-items: center; padding: 20px; background: radial-gradient(circle at 50% 30%, rgba(45, 102, 255, .22), rgba(2, 5, 14, .88) 66%); backdrop-filter: blur(4px); }
.panel { width: min(570px, 100%); padding: 30px; border: 1px solid var(--line); border-radius: 24px; background: linear-gradient(145deg, rgba(12, 24, 53, .97), rgba(5, 10, 25, .97)); box-shadow: 0 26px 90px rgba(0, 0, 0, .42), inset 0 1px 0 rgba(255,255,255,.06); }
.eyebrow { color: var(--cyan); font-size: 12px; font-weight: 800; letter-spacing: .2em; text-transform: uppercase; }
h1, h2, p { margin-top: 0; }
h1 { margin-bottom: 14px; font-size: clamp(38px, 7vw, 64px); line-height: .92; letter-spacing: -.06em; }
h1 span { color: var(--cyan); text-shadow: 0 0 24px rgba(81, 217, 255, .7); }
h2 { margin: 10px 0 12px; font-size: 34px; }
p { color: #bdcce1; line-height: 1.55; }
.input-label { display: block; margin: 22px 0 8px; color: var(--muted); font-size: 12px; font-weight: 800; text-transform: uppercase; letter-spacing: .12em; }
input { width: 100%; border: 1px solid rgba(110, 176, 255, .3); border-radius: 13px; padding: 14px 15px; color: var(--text); background: rgba(4, 10, 25, .74); outline: none; }
input:focus { border-color: var(--cyan); box-shadow: 0 0 0 3px rgba(81,217,255,.12); }
.button { border: 1px solid transparent; border-radius: 13px; padding: 13px 16px; color: white; font-weight: 800; cursor: pointer; transition: transform .18s ease, filter .18s ease, border-color .18s ease; }
.button:hover { transform: translateY(-2px); filter: brightness(1.13); }
.button.primary { background: linear-gradient(135deg, var(--blue), var(--violet)); box-shadow: 0 12px 28px rgba(49, 92, 255, .24); }
.button.secondary { border-color: rgba(103, 181, 255, .32); background: rgba(16, 35, 68, .74); }
.button.danger { border-color: rgba(255,90,120,.28); background: rgba(97, 22, 46, .68); }
.button.small { padding: 12px 15px; }
.primary-actions { display: grid; margin-top: 13px; }
.queue-message { margin-top: 12px; color: var(--cyan); font-size: 14px; font-weight: 700; }
.dots::after { content: ''; animation: dots 1.4s infinite; }
@keyframes dots { 0% { content: ''; } 33% { content: '.'; } 66% { content: '..'; } 100% { content: '...'; } }
.separator { display: flex; align-items: center; gap: 12px; margin: 20px 0; color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .16em; }
.separator::before, .separator::after { content: ''; height: 1px; flex: 1; background: var(--line); }
.private-grid { display: grid; gap: 10px; }
.join-row { display: grid; grid-template-columns: 1fr auto; gap: 10px; }
#roomCodeInput { text-transform: uppercase; letter-spacing: .25em; font-weight: 900; }
.error { margin-top: 14px; padding: 11px 13px; border-radius: 10px; color: #ffc4cf; background: rgba(120, 20, 47, .5); font-size: 14px; }
.live-stats { display: grid; grid-template-columns: repeat(3,1fr); gap: 10px; margin-top: 22px; }
.live-stats div { padding: 12px 8px; border: 1px solid rgba(98,168,255,.14); border-radius: 12px; text-align: center; background: rgba(10,21,43,.55); }
.live-stats strong, .live-stats span { display: block; }
.live-stats strong { color: var(--cyan); font-size: 20px; }
.live-stats span { margin-top: 3px; color: var(--muted); font-size: 11px; text-transform: uppercase; }
.waiting-panel, .end-panel { text-align: center; }
.room-code-row { display: flex; justify-content: center; align-items: center; gap: 12px; margin: 18px 0; }
#roomCode { color: var(--cyan); font-size: 38px; letter-spacing: .16em; }
.muted { color: var(--muted); font-size: 13px; }
.countdown { position: fixed; inset: 0; z-index: 30; display: grid; place-items: center; color: white; font-size: min(32vw, 290px); font-weight: 900; text-shadow: 0 0 54px rgba(81,217,255,.9); pointer-events: none; }
.hud { position: fixed; inset: 0; z-index: 10; pointer-events: none; }
.hud-top { display: grid; grid-template-columns: minmax(120px,1fr) minmax(270px,auto) minmax(120px,1fr); gap: 10px; padding: 16px; }
.hud-card { padding: 11px 14px; border: 1px solid rgba(98,178,255,.25); border-radius: 13px; background: rgba(4, 11, 26, .76); backdrop-filter: blur(8px); }
.hud-card span, .hud-card strong { display: block; }
.hud-card span { color: var(--muted); font-size: 10px; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; }
.hud-card strong { color: white; font-size: 20px; }
.score-card { display: flex; align-items: center; justify-content: center; gap: 12px; text-align: center; }
.score-card span { width: 90px; overflow: hidden; text-overflow: ellipsis; }
.score-card strong { color: var(--cyan); font-size: 28px; }
.timer-card { justify-self: end; min-width: 120px; text-align: right; }
.room-info { min-width: 120px; }
.crosshair { position: absolute; left: 50%; top: 50%; width: 30px; height: 30px; transform: translate(-50%,-50%); filter: drop-shadow(0 0 4px rgba(81,217,255,.8)); }
.crosshair i { position: absolute; display: block; background: white; }
.crosshair i:nth-child(1) { width: 8px; height: 2px; left: 0; top: 14px; }
.crosshair i:nth-child(2) { width: 8px; height: 2px; right: 0; top: 14px; }
.crosshair i:nth-child(3) { width: 2px; height: 8px; left: 14px; top: 0; }
.crosshair i:nth-child(4) { width: 2px; height: 8px; left: 14px; bottom: 0; }
.hud-bottom { position: absolute; left: 18px; right: 18px; bottom: 18px; display: flex; justify-content: space-between; align-items: end; gap: 16px; }
.health-panel, .weapon-panel { padding: 13px 15px; border: 1px solid rgba(98,178,255,.23); border-radius: 14px; background: rgba(4,11,26,.78); backdrop-filter: blur(8px); }
.health-panel span, .weapon-panel span, .weapon-panel small { display: block; color: var(--muted); font-size: 10px; font-weight: 800; letter-spacing: .12em; }
.health-panel strong { display: block; margin-top: 7px; font-size: 28px; color: var(--green); }
.health-track { width: min(33vw,250px); height: 8px; margin-top: 8px; overflow: hidden; border-radius: 999px; background: rgba(255,255,255,.12); }
.health-fill { width: 100%; height: 100%; border-radius: inherit; background: linear-gradient(90deg, #39d894, #8bffb4); transition: width .18s ease; }
.weapon-panel { text-align: right; }
.weapon-panel strong { display: block; margin: 5px 0; color: var(--cyan); }
.lock-hint { position: absolute; left: 50%; bottom: 94px; transform: translateX(-50%); padding: 9px 12px; border-radius: 999px; color: white; background: rgba(5,12,30,.75); font-size: 12px; }
.event-feed { position: absolute; top: 100px; right: 17px; width: min(360px, 46vw); display: grid; gap: 7px; }
.feed-entry { padding: 8px 10px; border-left: 2px solid var(--cyan); border-radius: 7px; color: #ddebff; background: rgba(4,11,26,.72); font-size: 12px; animation: feedIn .18s ease; }
@keyframes feedIn { from { opacity: 0; transform: translateX(12px); } }
.damage-flash { position: absolute; inset: 0; opacity: 0; background: radial-gradient(circle, transparent 30%, rgba(255, 40, 72, .58)); transition: opacity .12s ease; }
.damage-flash.active { opacity: 1; }
.final-score { margin: 15px 0 20px; color: var(--cyan); font-size: 56px; font-weight: 900; }
.end-panel .button { display: block; width: 100%; margin-top: 10px; }
.loading { position: fixed; z-index: 40; left: 50%; bottom: 24px; transform: translateX(-50%); padding: 10px 14px; border: 1px solid var(--line); border-radius: 999px; color: var(--cyan); background: rgba(4,11,26,.8); font-size: 13px; }
@media(max-width: 640px) {
  .panel { padding: 22px; border-radius: 18px; }
  .hud-top { grid-template-columns: 1fr auto; padding: 8px; }
  .room-info { display: none; }
  .timer-card { min-width: 86px; padding: 8px; }
  .score-card { grid-column: 1; grid-row: 1; padding: 8px; gap: 7px; }
  .score-card span { width: 67px; font-size: 8px; }
  .score-card strong { font-size: 21px; }
  .hud-bottom { left: 8px; right: 8px; bottom: 8px; }
  .health-panel, .weapon-panel { padding: 10px; }
  .weapon-panel small { display:none; }
}

/* V2 FPS : bonus, armes et feedback de tir */
.bonus-panel { display: flex; align-items: end; justify-content: center; gap: 8px; padding-bottom: 4px; }
.status-chip { display: inline-flex; align-items: center; min-height: 30px; padding: 7px 10px; border: 1px solid rgba(103, 211, 255, .36); border-radius: 999px; color: #e9fbff; background: rgba(11, 35, 65, .78); box-shadow: 0 0 18px rgba(81,217,255,.14); font-size: 11px; font-weight: 900; letter-spacing: .08em; }
#statusSpeed { border-color: rgba(255, 230, 109, .48); color: #fff5b8; background: rgba(80, 61, 12, .64); box-shadow: 0 0 18px rgba(255,230,109,.16); }
.hit-marker { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -54%); color: #fff; font-family: Arial, sans-serif; font-size: 42px; font-weight: 300; line-height: 1; text-shadow: 0 0 10px rgba(255,255,255,.9), 0 0 22px rgba(81,217,255,.72); }
.pickup-legend { position: absolute; left: 18px; bottom: 120px; display: grid; grid-template-columns: repeat(2, auto); gap: 5px 12px; padding: 10px 12px; border: 1px solid rgba(98,178,255,.18); border-radius: 12px; background: rgba(4,11,26,.63); backdrop-filter: blur(7px); color: #b9cce5; font-size: 10px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; }
.pickup-legend span { display: flex; align-items: center; gap: 6px; }
.dot { width: 8px; height: 8px; border-radius: 50%; box-shadow: 0 0 9px currentColor; }
.dot.pulse { color: #7dff9e; background: #7dff9e; }
.dot.scatter { color: #ffb354; background: #ffb354; }
.dot.rail { color: #d481ff; background: #d481ff; }
.dot.health { color: #52f5ad; background: #52f5ad; }
.dot.shield { color: #51d9ff; background: #51d9ff; }
.dot.speed { color: #ffe66d; background: #ffe66d; }
@media(max-width: 640px) {
  .pickup-legend { display: none; }
  .bonus-panel { position: absolute; left: 50%; bottom: 72px; transform: translateX(-50%); }
  .status-chip { min-height: 26px; padding: 6px 8px; font-size: 9px; }
}


/* V3 FPS : rotation des maps, audio synthétique et fin de manche enrichie */
.button.ghost { margin-top: 10px; border-color: rgba(122, 204, 255, .24); color: #c5e9ff; background: rgba(15, 43, 78, .42); }
.button.ghost:hover { border-color: rgba(122, 204, 255, .58); background: rgba(18, 65, 110, .58); }
.sound-toggle { width: 100%; font-size: 12px; }
.room-info small { display: block; margin-top: 5px; color: #a7dcff; font-size: 10px; font-weight: 900; letter-spacing: .08em; text-transform: uppercase; }
.end-details { margin: 0 0 18px; padding: 11px 13px; border: 1px solid rgba(98,178,255,.2); border-radius: 12px; color: #b9cce5; background: rgba(6,18,40,.62); font-size: 12px; }
.end-details p { margin: 6px 0; }
.end-details strong { color: var(--cyan); }

/* V4 FPS : comptes, progression, classement et skins 3D */
.landing-overlay { overflow: auto; place-items: start center; }
.landing-shell { display: grid; grid-template-columns: minmax(260px, 340px) minmax(390px, 570px) minmax(250px, 320px); gap: 16px; width: min(1280px, 100%); margin: auto; align-items: start; }
.landing-shell .panel { width: 100%; }
.profile-panel, .leaderboard-panel { padding: 22px; }
h3 { margin: 9px 0 12px; font-size: 26px; }
.compact-copy { margin-bottom: 12px; color: #9fb3ca; font-size: 13px; line-height: 1.45; }
.profile-panel .input-label { margin-top: 13px; }
.account-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 12px; }
.button.tiny { padding: 8px 9px; border-radius: 10px; font-size: 10px; }
.profile-heading { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.profile-heading strong, .profile-heading span { display: block; }
.profile-heading strong { color: white; font-size: 20px; }
.profile-heading span { margin-top: 4px; color: var(--cyan); font-size: 11px; font-weight: 900; letter-spacing: .1em; }
.xp-row { display: flex; justify-content: space-between; gap: 8px; margin-top: 15px; color: #b7c9dd; font-size: 11px; font-weight: 800; }
.xp-row strong { color: var(--cyan); text-align: right; }
.xp-track { height: 8px; margin: 7px 0 12px; overflow: hidden; border-radius: 999px; background: rgba(255,255,255,.1); }
.xp-fill { width: 0; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--blue), var(--cyan)); transition: width .24s ease; }
.section-title { margin: 17px 0 8px; color: #b7c9dd; font-size: 11px; font-weight: 900; letter-spacing: .12em; text-transform: uppercase; }
.skin-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; }
.skin-card { display: grid; grid-template-columns: 23px 1fr; grid-template-rows: auto auto; gap: 1px 8px; align-items: center; padding: 8px; border: 1px solid rgba(103,181,255,.2); border-radius: 10px; color: white; background: rgba(7,18,39,.68); text-align: left; cursor: pointer; }
.skin-card:hover:not(:disabled) { border-color: var(--cyan); }
.skin-card:disabled { cursor: default; opacity: .72; }
.skin-card.locked { opacity: .46; filter: grayscale(.45); }
.skin-card.equipped { border-color: rgba(81,217,255,.72); background: rgba(13,55,79,.65); }
.skin-card strong { overflow: hidden; color: white; font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.skin-card small { color: #91abc4; font-size: 9px; }
.skin-swatch { grid-row: 1 / span 2; width: 22px; height: 22px; border: 3px solid var(--skin-accent); border-radius: 50%; background: var(--skin-body); box-shadow: 0 0 12px var(--skin-accent); }
.profile-message { margin-top: 12px; padding: 9px 10px; border: 1px solid rgba(82,245,173,.3); border-radius: 9px; color: #bbffdc; background: rgba(17,79,57,.42); font-size: 12px; }
.profile-message.profile-error { border-color: rgba(255,90,120,.35); color: #ffc3ce; background: rgba(108,24,48,.5); }
.leaderboard-list { display: grid; gap: 7px; margin-top: 14px; }
.leaderboard-row { display: grid; grid-template-columns: 25px 12px 1fr auto auto; gap: 7px; align-items: center; padding: 9px 8px; border: 1px solid rgba(98,168,255,.14); border-radius: 9px; background: rgba(8,20,42,.57); }
.leaderboard-row b { color: var(--cyan); font-size: 11px; }
.leaderboard-row strong { overflow: hidden; color: white; font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.leaderboard-row small { color: #a4bad1; font-size: 10px; }
.leaderboard-row em { color: #b8ffdb; font-size: 10px; font-style: normal; font-weight: 900; }
.leaderboard-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--skin-accent); box-shadow: 0 0 9px var(--skin-accent); }
.weapon-panel b { color: #cfe9ff; }
.xp-result { color: #b6f4ff !important; font-weight: 800; }
@media(max-width: 1100px) {
  .landing-shell { grid-template-columns: minmax(260px, 330px) minmax(390px, 570px); }
  .leaderboard-panel { grid-column: 1 / -1; }
  .leaderboard-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media(max-width: 760px) {
  .landing-overlay { padding: 10px; }
  .landing-shell { grid-template-columns: 1fr; width: min(570px, 100%); }
  .hero-panel { grid-row: 1; }
  .profile-panel { grid-row: 2; }
  .leaderboard-panel { grid-row: 3; grid-column: auto; }
  .leaderboard-list { grid-template-columns: 1fr; }
}
