/* NÉBULYX — système de design
   Couleurs : vide #02030a · abysse #070b1c · bleu électrique #2d6bff · cyan #2ef2ff · violet #8b5cff · magenta #ff4fd8 · solaire #ffb347
   Typographies : Unbounded (marque, titres), Manrope (interface) */
:root {
  --void: #02030a; --abyss: #070b1c; --deep: #0d1430; --panel: rgba(9, 14, 36, 0.86); --panel-solid: #0b1129;
  --line: rgba(120, 160, 255, 0.16); --line-strong: rgba(46, 242, 255, 0.45);
  --electric: #2d6bff; --cyan: #2ef2ff; --violet: #8b5cff; --magenta: #ff4fd8; --solar: #ffb347; --mint: #3dffa8; --danger: #ff5d73;
  --text: #e9edff; --muted: #8e98c4; --faint: #5c6694;
  --radius-s: 8px; --radius: 14px; --radius-l: 22px;
  --font-brand: 'Unbounded', 'Manrope', system-ui, sans-serif;
  --font-ui: 'Manrope', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --ts: 1;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--void); color: var(--text); font-family: var(--font-ui); font-size: calc(15px * var(--ts)); -webkit-font-smoothing: antialiased; overflow: hidden; overscroll-behavior: none; }
body { touch-action: none; user-select: none; -webkit-user-select: none; -webkit-tap-highlight-color: transparent; }
input, textarea, select, .selectable { user-select: text; -webkit-user-select: text; }
canvas#game { position: fixed; inset: 0; display: block; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--cyan); }
:focus-visible { outline: 2px solid var(--cyan); outline-offset: 2px; }
.hidden { display: none !important; }
.reduced *, .reduced *::before, .reduced *::after { animation: none !important; transition: none !important; }

/* ---------- Boutons et champs ---------- */
.btn { appearance: none; border: 1px solid var(--line); background: rgba(45, 107, 255, 0.10); color: var(--text); padding: 0.62em 1.05em; border-radius: var(--radius-s); cursor: pointer; font-weight: 700; letter-spacing: 0.01em; transition: background .15s, border-color .15s, transform .1s; display: inline-flex; align-items: center; gap: .5em; justify-content: center; }
.btn:hover { background: rgba(46, 242, 255, 0.14); border-color: var(--line-strong); }
.btn:active { transform: translateY(1px); }
.btn.primary { background: linear-gradient(135deg, var(--electric), var(--violet)); border-color: transparent; }
.btn.primary:hover { filter: brightness(1.12); }
.btn.ghost { background: transparent; }
.btn.danger { background: rgba(255, 93, 115, 0.12); border-color: rgba(255, 93, 115, 0.45); color: #ffc2cb; }
.btn.small { padding: .38em .7em; font-size: .87em; }
.btn[disabled] { opacity: .45; cursor: not-allowed; }
.field { display: grid; gap: .35em; margin-bottom: .9em; }
.field > span { font-size: .85em; color: var(--muted); font-weight: 600; }
.input { width: 100%; padding: .7em .85em; background: rgba(4, 7, 22, 0.75); border: 1px solid var(--line); border-radius: var(--radius-s); outline: none; transition: border-color .15s; }
.input:focus { border-color: var(--cyan); }
.row { display: flex; gap: .6em; align-items: center; flex-wrap: wrap; }
.grow { flex: 1; }
.muted { color: var(--muted); }
.small { font-size: .86em; }
.err { color: #ffb3bf; font-size: .9em; min-height: 1.2em; }
.ok { color: var(--mint); }
.pill { display: inline-block; padding: .12em .55em; border-radius: 999px; background: rgba(46, 242, 255, .12); color: var(--cyan); font-size: .78em; font-weight: 700; }
.pill.bot { background: rgba(255, 179, 71, .14); color: var(--solar); }
.pill.on { background: rgba(61, 255, 168, .14); color: var(--mint); }
.coins { color: var(--solar); font-weight: 800; white-space: nowrap; }
.coins::before { content: '✦ '; }

/* ---------- Accueil ---------- */
#home { position: fixed; inset: 0; display: grid; grid-template-columns: minmax(170px, 210px) 1fr; grid-template-rows: auto 1fr auto; z-index: 10; background: radial-gradient(ellipse at 70% 40%, rgba(45,107,255,0.10), transparent 60%), linear-gradient(90deg, rgba(2,3,10,.82) 0%, rgba(2,3,10,.35) 55%, rgba(2,3,10,.15) 100%); }
#home header { grid-column: 1 / -1; display: flex; align-items: center; justify-content: space-between; padding: 18px 26px; }
.brand { display: flex; align-items: center; gap: 12px; text-decoration: none; color: var(--text); }
.brand svg { width: 42px; height: 42px; }
.wordmark { font-family: var(--font-brand); font-weight: 800; font-size: 1.35rem; letter-spacing: .09em; }
.account-chip { display: flex; align-items: center; gap: .7em; }
.lvl { font-family: var(--font-brand); font-size: .78em; font-weight: 700; padding: .2em .55em; border-radius: 6px; background: rgba(139, 92, 255, .25); color: #d8c9ff; }

nav.rail { display: flex; flex-direction: column; gap: 2px; padding: 8px 14px 8px 22px; align-self: center; }
nav.rail button { appearance: none; background: none; border: none; text-align: left; padding: .62em .8em; border-radius: var(--radius-s); color: var(--muted); cursor: pointer; font-weight: 700; font-size: 1em; display: flex; align-items: center; gap: .7em; }
nav.rail button:hover, nav.rail button.active { color: var(--text); background: rgba(46, 242, 255, .07); }
nav.rail button .ico { width: 20px; text-align: center; color: var(--cyan); opacity: .8; }
nav.rail button .badge { margin-left: auto; background: var(--magenta); color: #fff; border-radius: 999px; font-size: .7em; padding: 0 .5em; }

.launch { align-self: center; padding: 0 5vw 0 3vw; max-width: 640px; }
.launch h1 { font-family: var(--font-brand); font-weight: 800; font-size: clamp(2.6rem, 7vw, 5.4rem); line-height: .95; letter-spacing: .02em; margin: 0 0 .15em; background: linear-gradient(100deg, #ffffff 0%, #bfe9ff 30%, var(--cyan) 52%, var(--violet) 78%, var(--magenta) 100%); -webkit-background-clip: text; background-clip: text; color: transparent; background-size: 200% 100%; animation: shimmer 9s ease-in-out infinite alternate; }
@keyframes shimmer { from { background-position: 0% 0; } to { background-position: 100% 0; } }
.launch .motd { color: var(--muted); margin: 0 0 1.6em; max-width: 46ch; line-height: 1.5; }
.name-row { display: flex; gap: 12px; align-items: stretch; margin-bottom: 1em; }
.name-row .input { font-size: 1.15em; font-weight: 700; padding: .8em 1em; border-radius: var(--radius); }
.seg { display: inline-flex; background: rgba(4, 7, 22, .7); border: 1px solid var(--line); border-radius: var(--radius); padding: 4px; gap: 2px; flex-wrap: wrap; }
.seg button { appearance: none; border: none; background: none; padding: .55em 1em; border-radius: 10px; cursor: pointer; color: var(--muted); font-weight: 700; }
.seg button[aria-pressed="true"] { background: rgba(46, 242, 255, .14); color: var(--text); box-shadow: inset 0 0 0 1px rgba(46, 242, 255, .35); }
.mode-desc { color: var(--muted); font-size: .9em; margin: .7em 0 1em; max-width: 52ch; min-height: 2.6em; line-height: 1.45; }
.opts { display: grid; gap: .8em; margin-bottom: 1.2em; }
.opts label.inline { display: flex; align-items: center; gap: .7em; color: var(--muted); font-weight: 600; font-size: .92em; }
.skills { display: flex; gap: 8px; flex-wrap: wrap; }
.skill { appearance: none; border: 1px solid var(--line); background: rgba(4, 7, 22, .65); border-radius: var(--radius); padding: .55em .8em; cursor: pointer; display: flex; align-items: center; gap: .55em; color: var(--muted); font-weight: 700; }
.skill .glyph { font-size: 1.25em; color: var(--cyan); width: 1.2em; text-align: center; }
.skill[aria-pressed="true"] { border-color: var(--line-strong); color: var(--text); background: rgba(46, 242, 255, .1); }

/* le bouton Jouer est une cellule vivante */
.play { position: relative; width: 132px; height: 132px; border-radius: 50%; border: none; cursor: pointer; color: #fff; font-family: var(--font-brand); font-weight: 800; font-size: 1.15rem; letter-spacing: .06em; background: radial-gradient(circle at 34% 30%, #9ff8ff 0%, var(--cyan) 22%, var(--electric) 62%, #1a2a8a 100%); box-shadow: 0 0 0 3px rgba(46, 242, 255, .25), 0 0 46px rgba(46, 242, 255, .45), inset 0 -10px 24px rgba(10, 20, 80, .55); animation: breathe 3.2s ease-in-out infinite; flex: none; }
.play::after { content: ''; position: absolute; inset: -14px; border-radius: 50%; border: 1px dashed rgba(46, 242, 255, .45); animation: orbit 14s linear infinite; }
.play:hover { filter: brightness(1.12); }
.play:active { transform: scale(.96); }
@keyframes breathe { 0%, 100% { border-radius: 50% 48% 52% 49% / 49% 52% 48% 51%; } 50% { border-radius: 48% 52% 49% 51% / 52% 48% 51% 49%; box-shadow: 0 0 0 5px rgba(46,242,255,.18), 0 0 64px rgba(46,242,255,.55), inset 0 -10px 24px rgba(10,20,80,.55); } }
@keyframes orbit { to { transform: rotate(360deg); } }
.launch-actions { display: flex; align-items: center; gap: 22px; }
.launch-actions .hint { color: var(--faint); font-size: .85em; line-height: 1.5; }

#home footer { grid-column: 1 / -1; display: flex; justify-content: space-between; align-items: center; padding: 12px 26px; color: var(--faint); font-size: .82em; gap: 1em; }
.announce { margin: 0 0 1em; padding: .7em 1em; border-left: 3px solid var(--magenta); background: rgba(255, 79, 216, .08); border-radius: 0 var(--radius-s) var(--radius-s) 0; max-width: 52ch; }

/* ---------- Tiroir latéral (panneaux) ---------- */
#sheet { position: fixed; top: 0; right: 0; bottom: 0; width: min(560px, 100vw); background: var(--panel); backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px); border-left: 1px solid var(--line); z-index: 30; display: flex; flex-direction: column; transform: translateX(105%); transition: transform .26s cubic-bezier(.2,.8,.2,1); }
#sheet.open { transform: none; }
#sheet header { display: flex; align-items: center; justify-content: space-between; padding: 18px 22px 12px; border-bottom: 1px solid var(--line); }
#sheet h2 { font-family: var(--font-brand); font-weight: 700; font-size: 1.15rem; margin: 0; }
#sheet .body { padding: 18px 22px 40px; overflow-y: auto; flex: 1; touch-action: pan-y; }
#sheet h3 { font-size: .95rem; margin: 1.6em 0 .7em; color: var(--muted); font-weight: 700; }
#sheet h3:first-child { margin-top: 0; }
.close { appearance: none; background: none; border: none; color: var(--muted); font-size: 1.5rem; cursor: pointer; line-height: 1; padding: 4px 8px; border-radius: 8px; }
.close:hover { color: var(--text); background: rgba(255, 255, 255, .06); }
.tabs { display: flex; gap: 4px; margin-bottom: 1em; flex-wrap: wrap; }
.tabs button { appearance: none; border: 1px solid transparent; background: none; color: var(--muted); padding: .4em .8em; border-radius: 999px; cursor: pointer; font-weight: 700; }
.tabs button[aria-selected="true"] { color: var(--text); border-color: var(--line-strong); background: rgba(46, 242, 255, .08); }

table.list { width: 100%; border-collapse: collapse; font-size: .93em; }
table.list th { text-align: left; color: var(--faint); font-weight: 700; font-size: .8em; padding: .4em .5em; border-bottom: 1px solid var(--line); }
table.list td { padding: .55em .5em; border-bottom: 1px solid rgba(120, 160, 255, .07); }
table.list tr.me td { background: rgba(46, 242, 255, .07); }
table.list td.num { text-align: right; font-variant-numeric: tabular-nums; }
.rank { font-family: var(--font-brand); font-weight: 700; color: var(--muted); width: 2.4em; }
.rank.r1 { color: #ffe66d; } .rank.r2 { color: #d6e4ff; } .rank.r3 { color: #ffb38a; }
.empty { color: var(--muted); padding: 1.4em 0; line-height: 1.5; }

.stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.stats > div { background: var(--panel-solid); padding: .8em .9em; }
.stats b { display: block; font-family: var(--font-brand); font-size: 1.2rem; font-weight: 700; margin-bottom: .15em; }
.stats span { color: var(--muted); font-size: .82em; }
.xpbar { height: 8px; background: rgba(255, 255, 255, .07); border-radius: 99px; overflow: hidden; margin: .5em 0 .3em; }
.xpbar > i { display: block; height: 100%; background: linear-gradient(90deg, var(--electric), var(--cyan)); border-radius: 99px; }

.items { display: grid; grid-template-columns: repeat(auto-fill, minmax(116px, 1fr)); gap: 10px; }
.item { appearance: none; border: 1px solid var(--line); background: rgba(4, 7, 22, .6); border-radius: var(--radius); padding: .7em .6em; cursor: pointer; display: grid; justify-items: center; gap: .35em; text-align: center; color: var(--text); font-size: .85em; font-weight: 600; position: relative; }
.item canvas { width: 72px; height: 72px; }
.item .swatch { width: 44px; height: 44px; border-radius: 50%; margin: 14px 0; box-shadow: inset 0 -6px 12px rgba(0,0,0,.35); }
.item[aria-pressed="true"] { border-color: var(--cyan); background: rgba(46, 242, 255, .1); }
.item.locked { opacity: .55; }
.item .tag { font-size: .8em; color: var(--muted); }
.preview-stage { display: flex; gap: 18px; align-items: center; margin-bottom: 1em; }
.preview-stage canvas { width: 160px; height: 160px; border-radius: var(--radius-l); background: radial-gradient(circle, rgba(45,107,255,.18), rgba(2,3,10,.4) 70%); border: 1px solid var(--line); }

.ach { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.ach > div { border: 1px solid var(--line); border-radius: var(--radius-s); padding: .6em .7em; font-size: .86em; }
.ach > div.got { border-color: rgba(255, 230, 109, .45); background: rgba(255, 230, 109, .06); }
.ach b { display: block; margin-bottom: .2em; }
.challenge { display: grid; grid-template-columns: 1fr auto; gap: .3em .8em; align-items: center; padding: .8em 0; border-bottom: 1px solid rgba(120,160,255,.08); }
.challenge .xpbar { grid-column: 1 / -1; margin: 0; }
.person { display: flex; align-items: center; gap: .7em; padding: .6em 0; border-bottom: 1px solid rgba(120,160,255,.08); }
.person .dot { width: 9px; height: 9px; border-radius: 50%; background: var(--faint); flex: none; }
.person .dot.on { background: var(--mint); box-shadow: 0 0 8px var(--mint); }
.kbd { display: inline-block; min-width: 1.8em; padding: .1em .45em; border: 1px solid var(--line-strong); border-radius: 6px; text-align: center; font-weight: 800; font-size: .85em; }
.help p, .help li { line-height: 1.55; color: #cfd6f5; }
.help ul { padding-left: 1.2em; }

/* ---------- Modales ---------- */
.modal-bg { position: fixed; inset: 0; background: rgba(2, 3, 10, .7); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); z-index: 40; display: grid; place-items: center; padding: 16px; }
.modal { background: var(--panel-solid); border: 1px solid var(--line); border-radius: var(--radius-l); padding: 26px; width: min(440px, 100%); max-height: 92vh; overflow-y: auto; box-shadow: 0 30px 80px rgba(0, 0, 0, .55); touch-action: pan-y; }
.modal h2 { font-family: var(--font-brand); margin: 0 0 .8em; font-size: 1.25rem; }
.modal.wide { width: min(620px, 100%); }

/* ---------- Écran de fin ---------- */
.death h2 { font-size: 1.6rem; margin-bottom: .2em; }
.death .killer { color: var(--muted); margin: 0 0 1.2em; }
.death .rewards { margin: 1em 0; padding: .8em 1em; border-radius: var(--radius); background: rgba(139, 92, 255, .12); border: 1px solid rgba(139, 92, 255, .35); min-height: 2.8em; }
.death .actions { display: flex; gap: .6em; flex-wrap: wrap; margin-top: 1.2em; }
.death .actions .btn.primary { flex: 1; padding: .9em; font-size: 1.05em; }

/* ---------- Interface en jeu ---------- */
#hud { position: fixed; inset: 0; pointer-events: none; z-index: 5; font-variant-numeric: tabular-nums; }
#hud > * { pointer-events: auto; }
.hud-stats { position: absolute; top: 12px; left: 12px; display: flex; gap: 6px; align-items: flex-start; }
.hud-stats .box { background: rgba(6, 10, 28, .62); border: 1px solid var(--line); border-radius: var(--radius-s); padding: .4em .7em; }
.hud-stats .big { font-family: var(--font-brand); font-weight: 700; font-size: 1.15rem; display: block; }
.hud-stats .lbl { color: var(--muted); font-size: .75em; }
.menu-btn { width: 40px; height: 40px; border-radius: var(--radius-s); border: 1px solid var(--line); background: rgba(6, 10, 28, .62); color: var(--text); font-size: 1.2rem; cursor: pointer; }
.leaderboard { position: absolute; top: 12px; right: 12px; width: 210px; background: rgba(6, 10, 28, .62); border: 1px solid var(--line); border-radius: var(--radius-s); padding: .55em .7em; font-size: .86em; }
.leaderboard h4 { margin: 0 0 .35em; font-family: var(--font-brand); font-size: .82rem; color: var(--cyan); font-weight: 700; display: flex; justify-content: space-between; }
.leaderboard ol { list-style: none; margin: 0; padding: 0; }
.leaderboard li { display: flex; gap: .4em; padding: .14em 0; white-space: nowrap; overflow: hidden; }
.leaderboard li .n { flex: 1; overflow: hidden; text-overflow: ellipsis; }
.leaderboard li.me { color: var(--cyan); font-weight: 800; }
.leaderboard li .b { color: var(--solar); font-size: .85em; }
.event-banner { position: absolute; top: 14px; left: 50%; transform: translateX(-50%); background: rgba(6, 10, 28, .78); border: 1px solid var(--line-strong); border-radius: 999px; padding: .5em 1.2em; text-align: center; max-width: min(520px, 70vw); font-size: .9em; }
.event-banner b { font-family: var(--font-brand); font-weight: 700; margin-right: .4em; }
.event-banner.flare { border-color: rgba(255, 179, 71, .7); } .event-banner.well { border-color: rgba(180, 140, 255, .7); }
.skill-btn { position: absolute; bottom: 22px; left: 50%; transform: translateX(-50%); width: 68px; height: 68px; border-radius: 50%; border: 1px solid var(--line-strong); background: rgba(6, 10, 28, .72); color: var(--text); cursor: pointer; display: grid; place-items: center; font-size: 1.6rem; }
.skill-btn svg { position: absolute; inset: -4px; width: calc(100% + 8px); height: calc(100% + 8px); transform: rotate(-90deg); }
.skill-btn .key { position: absolute; bottom: -20px; font-size: .7rem; color: var(--muted); }
.skill-btn.ready { box-shadow: 0 0 22px rgba(46, 242, 255, .4); }
.net-status { position: absolute; bottom: 12px; left: 12px; font-size: .78em; color: var(--muted); background: rgba(6,10,28,.5); padding: .2em .6em; border-radius: 6px; }
.net-status.bad { color: #ffb3bf; }
.room-code { position: absolute; bottom: 40px; left: 12px; font-size: .82em; background: rgba(6,10,28,.62); border: 1px solid var(--line); padding: .35em .6em; border-radius: 8px; display: flex; gap: .5em; align-items: center; }
.tutorial { position: absolute; left: 50%; bottom: 110px; transform: translateX(-50%); background: rgba(6, 10, 28, .82); border: 1px solid var(--line-strong); border-radius: var(--radius); padding: .8em 1.1em; max-width: min(420px, 86vw); text-align: center; line-height: 1.5; }

/* commandes tactiles */
.touch-ctrl { display: none; }
.is-touch .touch-ctrl { display: block; }
.is-touch .skill-btn { left: auto; right: 116px; transform: none; bottom: 34px; width: 62px; height: 62px; }
.joy { position: absolute; width: 130px; height: 130px; border-radius: 50%; border: 1px solid rgba(46, 242, 255, .35); background: rgba(46, 242, 255, .05); pointer-events: none; transform: translate(-50%, -50%); }
.joy i { position: absolute; left: 50%; top: 50%; width: 54px; height: 54px; margin: -27px; border-radius: 50%; background: rgba(46, 242, 255, .35); }
.tbtn { position: absolute; width: 74px; height: 74px; border-radius: 50%; border: 1px solid var(--line-strong); background: rgba(6, 10, 28, .65); color: var(--text); font-weight: 800; font-size: .66rem; letter-spacing: .02em; display: grid; place-items: center; touch-action: none; }
.tbtn.split { right: 22px; bottom: 112px; }
.tbtn.eject { right: 22px; bottom: 22px; width: 70px; height: 70px; }

/* ---------- Notifications ---------- */
#toasts { position: fixed; z-index: 60; left: 50%; transform: translateX(-50%); top: 70px; display: grid; gap: 8px; width: min(420px, 92vw); pointer-events: none; }
.toast { pointer-events: auto; background: var(--panel-solid); border: 1px solid var(--line); border-left: 3px solid var(--cyan); border-radius: var(--radius-s); padding: .7em 1em; display: flex; gap: .8em; align-items: center; box-shadow: 0 14px 40px rgba(0,0,0,.5); animation: toast-in .25s ease-out; font-size: .92em; }
.toast.warn { border-left-color: var(--solar); } .toast.error { border-left-color: var(--danger); } .toast.success { border-left-color: var(--mint); } .toast.announce { border-left-color: var(--magenta); }
.toast .grow { line-height: 1.4; }
@keyframes toast-in { from { opacity: 0; transform: translateY(-8px); } }

/* ---------- Réglages ---------- */
.setting { display: flex; align-items: center; justify-content: space-between; gap: 1em; padding: .65em 0; border-bottom: 1px solid rgba(120,160,255,.08); }
.setting .t { display: grid; gap: .15em; }
.setting .t small { color: var(--muted); }
.switch { appearance: none; width: 44px; height: 26px; border-radius: 99px; background: rgba(255,255,255,.12); position: relative; cursor: pointer; flex: none; transition: background .15s; }
.switch::after { content: ''; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; transition: transform .15s; }
.switch:checked { background: var(--electric); }
.switch:checked::after { transform: translateX(18px); }
input[type=range] { accent-color: var(--cyan); width: 160px; }
select.input { width: auto; }

/* ---------- Écrans étroits ---------- */
@media (max-width: 760px) {
  .leaderboard li:nth-child(n+7):not(.me) { display: none; }
  #home { grid-template-columns: 1fr; grid-template-rows: auto 1fr auto auto; overflow-y: auto; touch-action: pan-y; background: linear-gradient(180deg, rgba(2,3,10,.55), rgba(2,3,10,.82)); }
  #home header { padding: 12px 16px; }
  .wordmark { font-size: 1.05rem; }
  .launch { padding: 8px 16px 34px; align-self: start; grid-row: 2; }
  .seg { display: flex; width: 100%; }
  .seg button { flex: 1 1 auto; padding: .5em .7em; }
  .launch-actions { gap: 18px; }
  .launch-actions .hint { font-size: .8em; }
  .launch h1 { font-size: 2.6rem; }
  .launch .motd { margin-bottom: 1em; font-size: .92em; }
  nav.rail { grid-row: 3; flex-direction: row; overflow-x: auto; padding: 6px 10px; gap: 4px; align-self: end; border-top: 1px solid var(--line); background: rgba(2,3,10,.85); touch-action: pan-x; }
  nav.rail button { flex-direction: column; gap: .2em; font-size: .78em; padding: .5em .7em; white-space: nowrap; }
  #home footer { grid-row: 4; padding: 6px 16px 10px; font-size: .75em; }
  .play { width: 96px; height: 96px; font-size: .95rem; margin: 14px; }
  .leaderboard { width: 150px; font-size: .74em; padding: .4em .5em; }
  .hud-stats .box { padding: .3em .5em; }
  .hud-stats .big { font-size: .95rem; }
  .event-banner { top: auto; bottom: 200px; font-size: .8em; }
}
@media (max-height: 520px) and (orientation: landscape) {
  .leaderboard li:nth-child(n+6):not(.me) { display: none; }
  .leaderboard { width: 170px; font-size: .74em; }
  .launch h1 { font-size: 2.2rem; }
  .launch .motd { display: none; }
  .tbtn { width: 60px; height: 60px; }
  .tbtn.split { bottom: 90px; }
}

/* ---------- v1.2 : modes, saison, événements live ---------- */
.mode-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; margin: .2em 0 .7em; }
.mode-card { position: relative; appearance: none; text-align: left; cursor: pointer; border: 1px solid var(--line); background: rgba(4, 7, 22, .72); border-radius: var(--radius); padding: .6em .7em .65em; display: grid; gap: .15em; color: var(--muted); transition: border-color .15s, background .15s, transform .1s; min-width: 0; }
.mode-card:hover { border-color: var(--line-strong); color: var(--text); }
.mode-card[aria-pressed="true"] { background: linear-gradient(150deg, rgba(45, 107, 255, .28), rgba(139, 92, 255, .2)); border-color: rgba(46, 242, 255, .6); color: var(--text); box-shadow: 0 0 24px rgba(46, 242, 255, .12); }
.mc-ico { font-size: 1.15rem; color: var(--cyan); line-height: 1; }
.m-br .mc-ico { color: var(--magenta); } .m-duel .mc-ico { color: var(--solar); } .m-teams .mc-ico { color: var(--mint); } .m-blitz .mc-ico { color: #ffe66d; }
.mc-name { font-weight: 800; font-size: .92em; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mc-tag { font-size: .72em; line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.mc-new { position: absolute; top: -7px; right: 8px; font-size: .62em; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; background: var(--magenta); color: #fff; border-radius: 999px; padding: .1em .55em; }
.mode-desc { color: var(--muted); font-size: .86em; line-height: 1.45; margin: 0 0 .8em; max-width: 60ch; }
.opts .featured { margin: .5em 0 0; color: #e7dcff; }
.opts .featured b { color: #ffe66d; }
.seg .feat { color: #ffe66d; margin-left: .3em; }
.duel-info b { font-family: var(--font-brand); }
.season-chip { appearance: none; margin-left: auto; margin-right: 12px; border: 1px solid rgba(255, 230, 109, .35); background: rgba(255, 230, 109, .08); color: #fff1b0; border-radius: 999px; padding: .35em .9em; font-weight: 700; font-size: .82em; cursor: pointer; }
.season-chip:hover { background: rgba(255, 230, 109, .16); }
.live-banner { display: flex; flex-wrap: wrap; gap: .3em .8em; align-items: center; padding: .55em .9em; margin: 0 0 .9em; border-radius: var(--radius); border: 1px solid rgba(255, 79, 216, .5); background: linear-gradient(100deg, rgba(255, 79, 216, .16), rgba(139, 92, 255, .12)); font-size: .9em; }
.live-banner.soon { border-color: var(--line); background: rgba(4, 7, 22, .6); }
.live-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--magenta); box-shadow: 0 0 10px var(--magenta); animation: blink 1.4s ease-in-out infinite; }
@keyframes blink { 50% { opacity: .3; } }
.install-btn { margin: 0 .6em; }

/* HUD des manches */
.match-bar { position: absolute; top: 12px; left: 50%; transform: translateX(-50%); display: flex; gap: .9em; align-items: center; background: rgba(6, 10, 28, .78); border: 1px solid var(--line-strong); border-radius: 999px; padding: .45em 1.2em; font-size: .9em; white-space: nowrap; max-width: calc(100vw - 480px); overflow: hidden; }
.match-bar .mb-mode { font-family: var(--font-brand); font-weight: 700; font-size: .85em; color: var(--cyan); }
.match-bar .mb-big { font-family: var(--font-brand); font-weight: 800; font-size: 1.25em; }
.match-bar .mb-clock { font-family: var(--font-brand); font-weight: 700; font-variant-numeric: tabular-nums; }
.match-bar .mb-warn { color: #ff8a9b; font-weight: 800; }
.match-bar .team { font-weight: 800; padding: .1em .55em; border-radius: 999px; }
.team.t1, .leaderboard li.team.t1 .n { color: #2ef2ff; } .team.t2, .leaderboard li.team.t2 .n { color: #ff4fd8; }
.match-bar .team.mine { box-shadow: inset 0 0 0 1px currentColor; }
#hud:has(.match-bar:not(.hidden)) .event-banner { top: 60px; }
.countdown { position: absolute; top: 38%; left: 50%; transform: translate(-50%, -50%); font-family: var(--font-brand); font-weight: 800; font-size: clamp(3rem, 10vw, 7rem); color: #fff; text-shadow: 0 0 30px rgba(46, 242, 255, .7), 0 0 80px rgba(139, 92, 255, .5); pointer-events: none; text-align: center; white-space: nowrap; }
.countdown.pop { animation: pop .9s cubic-bezier(.2, .9, .3, 1.3); }
@keyframes pop { 0% { transform: translate(-50%, -50%) scale(.4); opacity: 0; } 30% { transform: translate(-50%, -50%) scale(1.1); opacity: 1; } 100% { transform: translate(-50%, -50%) scale(1); opacity: .95; } }
.kill-feed { position: absolute; top: 64px; left: 12px; list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; font-size: .8em; pointer-events: none; max-width: 300px; }
.hud-stats ~ .kill-feed, #hud .kill-feed { top: 78px; }
.kill-feed li { background: rgba(6, 10, 28, .7); border-left: 2px solid var(--magenta); padding: .25em .6em; border-radius: 4px; animation: slidein .25s ease-out; }
.kill-feed b { color: var(--text); }
@keyframes slidein { from { transform: translateX(-12px); opacity: 0; } }
.emote-wrap { position: absolute; bottom: 44px; left: 12px; display: flex; flex-direction: column-reverse; align-items: flex-start; gap: 6px; }
.emote-btn { width: 40px; height: 40px; border-radius: 50%; border: 1px solid var(--line); background: rgba(6, 10, 28, .7); color: var(--text); font-size: 1.2rem; cursor: pointer; }
.emote-pal { display: grid; grid-template-columns: repeat(4, 40px); gap: 4px; padding: 6px; background: rgba(6, 10, 28, .88); border: 1px solid var(--line); border-radius: 12px; }
.emote-pal button { height: 40px; border: none; border-radius: 8px; background: rgba(46, 242, 255, .08); color: var(--text); font-weight: 800; font-size: 1.05rem; cursor: pointer; }
.emote-pal button:hover { background: rgba(46, 242, 255, .2); }
#hud:has(.room-code) .emote-wrap { bottom: 80px; }
.death-bg.light { background: rgba(2, 3, 10, .35); backdrop-filter: none; -webkit-backdrop-filter: none; }

/* Podium */
.podium-modal { width: min(560px, 100%); }
.podium { display: grid; grid-template-columns: repeat(3, 1fr); align-items: end; gap: 8px; margin: .4em 0 1em; }
.podium .step { display: grid; gap: .25em; text-align: center; animation: rise .6s cubic-bezier(.2, .9, .3, 1.2) both; }
.podium .step.p1 { animation-delay: .25s; } .podium .step.p3 { animation-delay: .1s; }
@keyframes rise { from { transform: translateY(30px); opacity: 0; } }
.podium .who { font-weight: 800; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.podium .score { font-size: .8em; color: var(--muted); }
.podium .block { font-family: var(--font-brand); font-weight: 800; font-size: 1.6rem; border-radius: 10px 10px 4px 4px; display: grid; place-items: center; color: #02030a; }
.podium .p1 .block { height: 110px; background: linear-gradient(180deg, #ffe66d, #ffb347); box-shadow: 0 0 30px rgba(255, 230, 109, .35); }
.podium .p2 .block { height: 80px; background: linear-gradient(180deg, #e6ecff, #9fb0d8); }
.podium .p3 .block { height: 60px; background: linear-gradient(180deg, #ffbe8a, #c9773e); }
.podium .step.me .who { color: var(--cyan); }
.pill.bot { font-size: .65em; color: var(--solar); margin-left: .35em; font-weight: 700; }
.center { text-align: center; }
.podium-modal .rewards, .modal .rewards { margin: 1em 0; padding: .8em 1em; border-radius: var(--radius); background: rgba(139, 92, 255, .12); border: 1px solid rgba(139, 92, 255, .35); min-height: 2.8em; }
.podium-modal .actions, .modal .actions { display: flex; gap: .6em; flex-wrap: wrap; margin-top: 1em; }
.podium-modal .actions .btn.primary { flex: 1; }
.pass-reward b { color: #ffe66d; }

/* Duel */
.radar { position: relative; width: 120px; height: 120px; margin: .4em auto 1em; border-radius: 50%; border: 1px solid var(--line-strong); background: radial-gradient(circle, rgba(46, 242, 255, .12), transparent 70%); overflow: hidden; }
.radar i { position: absolute; inset: 0; border-radius: 50%; border: 1px solid rgba(46, 242, 255, .5); animation: ping 2.4s ease-out infinite; }
.radar i:nth-child(2) { animation-delay: .8s; } .radar i:nth-child(3) { animation-delay: 1.6s; }
@keyframes ping { from { transform: scale(.1); opacity: 1; } to { transform: scale(1); opacity: 0; } }
.rating-change { text-align: center; margin: .6em 0; }
.rating-change b { font-family: var(--font-brand); font-size: 2.4rem; }
.rating-change span { font-weight: 800; font-size: 1.2rem; }
.rating-change.up span { color: var(--mint); } .rating-change.down span { color: var(--danger); }

/* Kill cam */
.replay-modal { width: min(780px, 100%) !important; }
.replay-canvas { display: block; margin: 0 auto; border-radius: 10px; border: 1px solid var(--line); background: #02030a; max-width: 100%; }
.replay-bar { height: 4px; border-radius: 2px; background: rgba(255, 255, 255, .08); margin-top: 8px; overflow: hidden; }
.replay-bar i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--cyan), var(--magenta)); }

/* Pass de saison */
.pass-head { display: flex; justify-content: space-between; align-items: baseline; gap: 1em; flex-wrap: wrap; }
.pass-progress { height: 10px; border-radius: 5px; background: rgba(255, 255, 255, .07); overflow: hidden; margin: .5em 0 1em; }
.pass-progress i { display: block; height: 100%; background: linear-gradient(90deg, #ffe66d, var(--magenta)); }
.pass-track { display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: 8px; }
.tier { border: 1px solid var(--line); border-radius: 10px; padding: .5em; text-align: center; font-size: .78em; background: rgba(4, 7, 22, .6); display: grid; gap: .3em; justify-items: center; }
.tier .tn { font-family: var(--font-brand); font-weight: 700; color: var(--muted); font-size: .9em; }
.tier.got { border-color: rgba(61, 255, 168, .45); background: rgba(61, 255, 168, .07); }
.tier.ex { border-color: rgba(255, 230, 109, .55); background: linear-gradient(160deg, rgba(255, 230, 109, .12), rgba(255, 79, 216, .1)); }
.tier canvas { width: 56px; height: 56px; }
.rank-badge { display: inline-flex; align-items: center; gap: .4em; font-family: var(--font-brand); font-weight: 700; }
.ranks-list { display: flex; flex-wrap: wrap; gap: 6px; margin: .6em 0; font-size: .78em; }
.ranks-list span { padding: .2em .6em; border-radius: 999px; border: 1px solid currentColor; }
.item .excl { font-size: .7em; color: #ffe66d; font-weight: 800; }

@media (max-width: 760px) {
  .mode-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .mc-tag { display: none; }
  .season-chip { margin-right: 0; font-size: .74em; padding: .3em .7em; }
  .match-bar { top: auto; bottom: 150px; max-width: calc(100vw - 24px); font-size: .78em; gap: .6em; padding: .35em .9em; }
  #hud:has(.match-bar:not(.hidden)) .event-banner { top: auto; bottom: 186px; }
  .kill-feed { top: auto !important; bottom: 220px; font-size: .72em; max-width: 220px; }
  .emote-wrap { bottom: 230px; left: auto; right: 12px; align-items: flex-end; }
  .podium .block { font-size: 1.2rem; }
  .podium .p1 .block { height: 80px; } .podium .p2 .block { height: 60px; } .podium .p3 .block { height: 44px; }
}
.launch { min-height: 0; max-height: 100%; overflow-y: auto; scrollbar-width: thin; }
/* Son et plein écran */
.quick { display: flex; gap: 6px; }
#home header .quick { margin-left: auto; margin-right: 10px; }
#home header .quick + .season-chip { margin-left: 0; }
.qbtn { width: 38px; height: 38px; display: grid; place-items: center; padding: 0; border-radius: 10px; border: 1px solid var(--line); background: rgba(6, 10, 28, .7); color: var(--text); cursor: pointer; transition: border-color .15s, background .15s; }
.qbtn:hover { border-color: var(--line-strong); background: rgba(46, 242, 255, .1); }
.qbtn svg { width: 20px; height: 20px; }
.qbtn.qb-sound[aria-pressed="true"] { color: #ff8a9b; border-color: rgba(255, 93, 115, .5); }
.hud-stats .quick { align-self: stretch; align-items: center; }
@media (max-width: 760px) { .qbtn { width: 34px; height: 34px; } #home header .quick { margin-right: 6px; } }
@media (max-width: 760px) {
  #home { grid-template-columns: minmax(0, 1fr); }
  #home header { gap: 6px; padding: 10px 12px; }
  #home header .wordmark, .season-chip .sc-text { display: none; }
  .season-chip { width: 34px; height: 34px; padding: 0; margin: 0; border-radius: 10px; display: grid; place-items: center; }
  #home header .account-chip { gap: .4em; }
  #home header .account-chip .btn { white-space: nowrap; font-size: .8em; padding: .38em .6em; }
}
@media (max-width: 760px) {
  .season-chip { flex: 0 0 34px; min-width: 34px; }
  .hud-stats { position: absolute; }
  .hud-stats .quick { position: absolute; top: 46px; left: 0; flex-direction: column; }
  .hud-stats .box-time { display: none; }
}
@media (max-height: 520px) and (orientation: landscape) {
  .hud-stats .quick { position: static; flex-direction: row; }
}
@media (max-height: 520px) and (orientation: landscape) {
  .is-touch .emote-wrap { bottom: auto; top: 165px; left: auto; right: 12px; align-items: flex-end; flex-direction: column; }
}
