:root {
  --font: "Nunito", ui-rounded, "SF Pro Rounded", "Segoe UI Rounded", "Segoe UI", system-ui, sans-serif;
  --glass: rgba(24, 14, 52, 0.62);
  --glass-2: rgba(255, 255, 255, 0.07);
  --line: rgba(255, 255, 255, 0.14);
  --text: #fff7fb;
  --muted: rgba(255, 240, 250, 0.66);
  --accent: #ff5a8a;
  --accent-2: #ffb347;
  --good: #5ee6a0;
  --bad: #ff6b7d;
  --gold: #ffd23f;
  --shadow: 0 20px 60px rgba(10, 0, 40, 0.45);
  --grad: linear-gradient(135deg, #ff5a8a, #ffb347);
}
body[data-theme="neon"] { --glass: rgba(8, 4, 30, 0.7); --accent: #ff3fc8; --accent-2: #3ce7ff; --grad: linear-gradient(135deg, #ff3fc8, #3ce7ff); }
body[data-theme="snow"] { --glass: rgba(20, 45, 90, 0.62); --accent: #3ea8ff; --accent-2: #8ef0ff; --grad: linear-gradient(135deg, #3e7bff, #6fe3ff); }

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #140c30; color: var(--text); font-family: var(--font); -webkit-font-smoothing: antialiased; }
body { user-select: none; -webkit-user-select: none; -webkit-tap-highlight-color: transparent; }
input, select, textarea { user-select: text; -webkit-user-select: text; }
canvas#game, canvas#game3d { position: fixed; inset: 0; display: block; width: 100%; height: 100%; }
.hidden { display: none !important; }
button { font-family: inherit; }

/* ------------------------------------------------------------ Écrans */
#screens { position: fixed; inset: 0; pointer-events: none; }
.screen { position: absolute; inset: 0; display: none; flex-direction: column; align-items: center; padding: max(16px, env(safe-area-inset-top)) 16px 16px; overflow-y: auto; pointer-events: auto;
  background: radial-gradient(ellipse at 50% 40%, rgba(20, 8, 50, 0.15), rgba(10, 4, 30, 0.55)); backdrop-filter: blur(2px); -webkit-backdrop-filter: blur(2px); }
.screen.on { display: flex; animation: fadeIn 0.35s ease; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

.card { background: var(--glass); border: 1px solid var(--line); border-radius: 22px; padding: 20px; box-shadow: var(--shadow); backdrop-filter: blur(14px) saturate(1.3); -webkit-backdrop-filter: blur(14px) saturate(1.3); color: var(--text); }
h1, h2, h3 { margin: 0 0 10px; letter-spacing: 0.01em; }
h1 { font-size: 26px; font-weight: 900; }
h2 { font-size: 21px; font-weight: 900; }
h3 { font-size: 13px; text-transform: uppercase; letter-spacing: 0.12em; color: var(--muted); font-weight: 800; }
p { margin: 0 0 8px; color: var(--muted); line-height: 1.45; }
small { color: var(--muted); }

/* ------------------------------------------------------------ Logo */
.logo { display: flex; flex-direction: column; align-items: center; margin: 3vh 0 2vh; line-height: 0.85; filter: drop-shadow(0 10px 30px rgba(255, 60, 120, 0.35)); }
.logo span { display: block; font-weight: 1000; font-style: italic; }
.logo-top { font-size: clamp(54px, 11vw, 110px); background: linear-gradient(180deg, #fff 0%, #ffe3ef 45%, #ff9ac0 100%); -webkit-background-clip: text; background-clip: text; color: transparent; -webkit-text-stroke: 2px rgba(80, 20, 80, 0.25); letter-spacing: -0.02em; animation: wob 3s ease-in-out infinite; }
.logo-bot { font-size: clamp(46px, 9vw, 92px); background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; letter-spacing: 0.06em; margin-top: -2px; }
.logo-tag { font-size: 15px !important; font-style: normal !important; letter-spacing: 0.5em; text-transform: uppercase; color: #fff; opacity: 0.85; margin-top: 12px; font-weight: 800 !important; }
.logo.small { flex-direction: row; gap: 8px; margin: 0; align-items: baseline; filter: none; }
.logo.small .logo-top { font-size: 30px; animation: none; -webkit-text-stroke: 0; }
.logo.small .logo-bot { font-size: 30px; letter-spacing: 0.02em; }
@keyframes wob { 0%, 100% { transform: scale(1, 1) translateY(0); } 50% { transform: scale(1.03, 0.97) translateY(3px); } }

/* ------------------------------------------------------------ Boutons */
.btn { appearance: none; border: 1px solid var(--line); background: var(--glass-2); color: var(--text); padding: 10px 16px; border-radius: 14px; font-weight: 800; font-size: 15px; cursor: pointer; transition: transform 0.12s, background 0.2s, box-shadow 0.2s; text-decoration: none; display: inline-flex; align-items: center; justify-content: center; gap: 6px; }
.btn:hover { background: rgba(255, 255, 255, 0.14); transform: translateY(-1px); }
.btn:active { transform: translateY(1px) scale(0.98); }
.btn.primary { background: var(--grad); border-color: transparent; color: #fff; box-shadow: 0 8px 24px rgba(255, 70, 130, 0.35); text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2); }
.btn.primary:hover { box-shadow: 0 10px 30px rgba(255, 70, 130, 0.5); }
.btn.big { padding: 14px 22px; font-size: 18px; border-radius: 16px; }
.btn.ghost { background: transparent; }
.btn.small { padding: 6px 10px; font-size: 13px; border-radius: 10px; }
.btn.danger { background: rgba(255, 90, 110, 0.18); border-color: rgba(255, 90, 110, 0.4); }
.btn:disabled { opacity: 0.45; pointer-events: none; }
.icon-btn { width: 38px; height: 38px; border-radius: 12px; border: 1px solid var(--line); background: var(--glass); color: #fff; cursor: pointer; font-size: 13px; }

/* ------------------------------------------------------------ Login */
.login-card { width: min(400px, 100%); display: flex; flex-direction: column; gap: 12px; }
label { display: flex; flex-direction: column; gap: 6px; font-weight: 800; font-size: 14px; }
label.inline { flex-direction: row; align-items: center; gap: 8px; }
input, select { font: inherit; font-weight: 700; color: var(--text); background: rgba(255, 255, 255, 0.09); border: 1px solid var(--line); border-radius: 12px; padding: 11px 13px; outline: none; transition: border 0.2s, background 0.2s; }
select { padding: 6px 10px; }
select option { background: #241545; }
input:focus, select:focus { border-color: var(--accent); background: rgba(255, 255, 255, 0.14); }
.err { color: var(--bad); font-weight: 800; min-height: 1em; font-size: 14px; }
.net-state { font-size: 12px; color: var(--muted); text-align: center; }
.swatches { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.swatches button { width: 30px; height: 30px; border-radius: 50%; border: 3px solid transparent; cursor: pointer; box-shadow: inset 0 -4px 0 rgba(0, 0, 0, 0.2); transition: transform 0.15s; }
.swatches button:hover { transform: scale(1.15); }
.swatches button.on { border-color: #fff; transform: scale(1.15); }
.blob-preview { display: flex; justify-content: center; }
.mini-blob { --c: #ff5a8a; width: 62px; height: 72px; border-radius: 50% 50% 46% 46% / 62% 62% 38% 38%; background: radial-gradient(circle at 35% 25%, rgba(255, 255, 255, 0.7), transparent 30%), radial-gradient(circle at 50% 30%, var(--c), color-mix(in srgb, var(--c) 60%, #000) 100%); position: relative; animation: hop 1.4s ease-in-out infinite; box-shadow: 0 12px 20px -10px rgba(0, 0, 0, 0.5); }
.mini-blob i { position: absolute; top: 28%; width: 18%; height: 19%; background: #fff; border-radius: 50%; }
.mini-blob i::after { content: ""; position: absolute; left: 28%; top: 30%; width: 52%; height: 44%; background: #1b1530; border-radius: 50%; }
.mini-blob i:first-child { left: 27%; } .mini-blob i:last-child { right: 27%; }
@keyframes hop { 0%, 100% { transform: translateY(0) scale(1.05, 0.95); } 40% { transform: translateY(-14px) scale(0.95, 1.06); } 60% { transform: translateY(-14px) scale(0.97, 1.03); } }

/* ------------------------------------------------------------ Menu */
.topbar { width: min(1100px, 100%); display: flex; align-items: center; gap: 14px; margin-bottom: 18px; flex-wrap: wrap; }
.topbar h1 { margin: 0; flex: 1; }
.topbar .logo.small { flex: 1; }
.me-chip { display: flex; align-items: center; gap: 10px; background: var(--glass); border: 1px solid var(--line); padding: 6px 8px 6px 14px; border-radius: 999px; font-weight: 800; }
.me-chip .elo { background: var(--grad); padding: 3px 10px; border-radius: 999px; font-size: 13px; }
.dot { display: inline-block; width: 12px; height: 12px; border-radius: 50%; background: var(--c, #fff); box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.25); flex: none; }
.menu-grid { width: min(1100px, 100%); display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin: auto 0; }
.tile { text-align: left; cursor: pointer; transition: transform 0.2s, box-shadow 0.2s, border-color 0.2s; display: flex; flex-direction: column; gap: 4px; position: relative; font: inherit; }
.tile:hover { transform: translateY(-4px); border-color: rgba(255, 255, 255, 0.35); }
.tile-solo { grid-column: span 2; cursor: default; }
.tile-solo:hover { transform: none; }
.tile-online { background: linear-gradient(135deg, color-mix(in srgb, var(--accent) 45%, transparent), color-mix(in srgb, var(--accent-2) 35%, transparent)), var(--glass); }
.tile .pill { position: absolute; top: 16px; right: 16px; }
.pill { background: rgba(255, 255, 255, 0.16); padding: 4px 10px; border-radius: 999px; font-size: 12px; font-weight: 800; }
.pill.live::before { content: ""; display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--good); margin-right: 6px; box-shadow: 0 0 8px var(--good); animation: pulse 1.4s infinite; }
@keyframes pulse { 50% { opacity: 0.35; } }
.levels { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-top: 8px; }
.lvl { flex-direction: column; padding: 16px 10px; border-radius: 18px; font-size: 20px; }
.lvl small { font-size: 12px; font-weight: 700; min-height: 1em; }
.lvl.weak { background: linear-gradient(135deg, rgba(94, 230, 160, 0.4), rgba(62, 199, 255, 0.25)); }
.lvl.medium { background: linear-gradient(135deg, rgba(255, 210, 63, 0.45), rgba(255, 140, 60, 0.3)); }
.lvl.expert { background: linear-gradient(135deg, rgba(255, 70, 110, 0.55), rgba(140, 60, 255, 0.4)); }

/* ------------------------------------------------------------ Lobby */
.lobby-grid { width: min(1100px, 100%); display: grid; grid-template-columns: 1fr 1fr 1.1fr; gap: 16px; flex: 1; min-height: 0; }
.lobby-grid .card { display: flex; flex-direction: column; min-height: 0; }
.list { display: flex; flex-direction: column; gap: 8px; overflow-y: auto; }
.row { display: flex; align-items: center; gap: 10px; padding: 10px 12px; background: rgba(255, 255, 255, 0.06); border-radius: 14px; border: 1px solid transparent; }
.row .grow { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 800; }
.row.me { border-color: rgba(255, 255, 255, 0.25); }
.badge { font-size: 11px; font-weight: 800; padding: 3px 8px; border-radius: 999px; background: rgba(255, 255, 255, 0.12); white-space: nowrap; }
.badge.playing { background: rgba(255, 90, 138, 0.35); }
.badge.lobby { background: rgba(94, 230, 160, 0.3); }
.elo-s { font-size: 13px; font-weight: 800; color: var(--gold); }
.empty { color: var(--muted); font-weight: 700; padding: 18px; text-align: center; }
.chat { min-height: 300px; }
.chat-log { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 6px; padding-right: 4px; min-height: 120px; }
.chat-log .msg { background: rgba(255, 255, 255, 0.06); padding: 7px 11px; border-radius: 12px; font-size: 14px; line-height: 1.35; overflow-wrap: anywhere; user-select: text; }
.chat-log .msg b { color: var(--c); }
.chat-log .msg time { float: right; font-size: 11px; color: var(--muted); margin-left: 8px; }
#chat-form { display: flex; gap: 8px; margin-top: 10px; }
#chat-form input { flex: 1; min-width: 0; }
.pending { margin-top: 10px; display: flex; flex-direction: column; gap: 8px; }
.h3-act { display: flex; align-items: center; gap: 8px; white-space: nowrap; }
.h3-act .btn { margin-left: auto; }
.list.tables { flex: 0 0 auto; max-height: 50%; margin-bottom: 14px; }
.table2 { padding: 10px 12px; background: rgba(255, 255, 255, 0.06); border-radius: 14px; display: flex; flex-direction: column; gap: 8px; }
.t2-head { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.t2-head .grow { flex: 1; min-width: 0; }
.t2-teams { display: flex; align-items: center; gap: 8px; }
.t2-teams em { font-style: normal; font-weight: 900; opacity: 0.5; font-size: 12px; }
.t2-team { flex: 1; display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.t2-team small { color: var(--muted); font-weight: 800; font-size: 11px; }
.seat { display: flex; align-items: center; gap: 6px; padding: 6px 8px; border-radius: 10px; background: rgba(255, 255, 255, 0.08); font-weight: 800; font-size: 13px; min-width: 0; border: 1px solid transparent; }
.seat span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.seat.me { border-color: rgba(255, 255, 255, 0.35); }
.seat.free { border: 1px dashed rgba(255, 255, 255, 0.3); background: transparent; color: inherit; font: inherit; font-size: 12px; font-weight: 800; cursor: pointer; justify-content: center; }
.seat.free:hover { background: rgba(255, 255, 255, 0.1); }
.seat-free { display: flex; gap: 5px; }
.seat-free .seat.free { flex: 1; }
.seat-free .bot-add { flex: 0 0 auto; padding: 6px 8px; }
.seat.bot { background: rgba(139, 108, 255, 0.16); }
.seat.bot span { flex: 1; }
.seat .lvl-btn, .seat .x-btn { background: none; border: 0; color: inherit; font: inherit; cursor: pointer; padding: 0; }
.seat .lvl-btn { flex: 1; text-align: left; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.seat .x-btn { opacity: 0.7; font-size: 12px; }
.seat .lvl-btn:hover, .seat .x-btn:hover { opacity: 1; text-decoration: underline; }
.pending .row { background: rgba(255, 179, 71, 0.18); }

/* ------------------------------------------------------------ Classement */
.tabs { width: min(1100px, 100%); display: flex; gap: 6px; margin-bottom: 12px; flex-wrap: wrap; }
.tabs button { border: 1px solid var(--line); background: var(--glass); color: var(--text); padding: 9px 16px; border-radius: 999px; font-weight: 800; cursor: pointer; }
.tabs button.on { background: var(--grad); border-color: transparent; }
.scroll { width: min(1100px, 100%); overflow: auto; flex: 1; min-height: 0; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th { text-align: left; color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: 0.08em; padding: 8px; position: sticky; top: -20px; background: var(--glass); backdrop-filter: blur(10px); }
td { padding: 9px 8px; border-top: 1px solid rgba(255, 255, 255, 0.07); font-weight: 700; white-space: nowrap; }
tr.click { cursor: pointer; }
tr.click:hover td { background: rgba(255, 255, 255, 0.06); }
tr.unranked td { opacity: 0.5; }
.num { text-align: right; font-variant-numeric: tabular-nums; }
.rk { font-weight: 1000; font-size: 16px; width: 36px; }
.form { display: inline-flex; gap: 3px; }
.form i { width: 16px; height: 16px; border-radius: 5px; display: inline-grid; place-items: center; font-style: normal; font-size: 10px; font-weight: 900; }
.form i.w { background: var(--good); color: #063; } .form i.l { background: var(--bad); color: #500; }
.pos { color: var(--good); } .neg { color: var(--bad); }
.podium { display: flex; justify-content: center; align-items: flex-end; gap: 14px; margin: 6px 0 22px; }
.podium .step { text-align: center; width: 150px; }
.podium .block { border-radius: 14px 14px 4px 4px; display: grid; place-items: center; font-size: 34px; font-weight: 1000; color: rgba(255, 255, 255, 0.9); }
.podium .p1 .block { height: 110px; background: linear-gradient(180deg, #ffd23f, #e89a1c); }
.podium .p2 .block { height: 80px; background: linear-gradient(180deg, #dfe6f0, #8f9bb0); }
.podium .p3 .block { height: 60px; background: linear-gradient(180deg, #f0a56b, #a8582a); }
.podium .mini-blob { margin: 0 auto 6px; transform-origin: bottom; }
.podium .nm { font-weight: 900; margin-bottom: 4px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.podium .el { font-size: 13px; color: var(--gold); font-weight: 800; margin-bottom: 6px; }
.filters { display: flex; gap: 8px; margin-bottom: 12px; flex-wrap: wrap; align-items: center; }
.filters input { padding: 7px 11px; }
.matrix td, .matrix th { text-align: center; }
.matrix td.self { background: rgba(255, 255, 255, 0.04); }
.cell-w { color: var(--good); } .cell-l { color: var(--bad); }
.hist-score { font-weight: 1000; font-variant-numeric: tabular-nums; }
.win-name { color: var(--gold); }
.tag { font-size: 11px; padding: 2px 7px; border-radius: 6px; background: rgba(255, 255, 255, 0.1); font-weight: 800; }
.tag.ai { background: rgba(140, 90, 255, 0.35); } .tag.t { background: rgba(255, 210, 63, 0.3); } .tag.ff { background: rgba(255, 90, 110, 0.35); }

/* ------------------------------------------------------------ Tournois */
.tlist { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.tcard { background: rgba(255, 255, 255, 0.07); border-radius: 16px; padding: 14px; cursor: pointer; border: 1px solid transparent; transition: 0.2s; }
.tcard:hover { border-color: rgba(255, 255, 255, 0.3); transform: translateY(-2px); }
.tcard h2 { font-size: 18px; margin-bottom: 4px; }
.bracket { display: flex; gap: 28px; overflow-x: auto; padding: 10px 4px 20px; }
.round { display: flex; flex-direction: column; justify-content: space-around; gap: 14px; min-width: 210px; }
.round h3 { text-align: center; }
.match { background: rgba(255, 255, 255, 0.08); border-radius: 12px; overflow: hidden; border: 1px solid var(--line); position: relative; }
.match .pl { display: flex; justify-content: space-between; padding: 8px 12px; font-weight: 800; gap: 10px; }
.match .pl + .pl { border-top: 1px solid var(--line); }
.match .pl.w { background: linear-gradient(90deg, rgba(255, 210, 63, 0.3), transparent); color: var(--gold); }
.match .pl.tbd { color: var(--muted); font-style: italic; }
.match .act { padding: 6px; border-top: 1px solid var(--line); display: flex; justify-content: center; }
.champion { text-align: center; font-size: 22px; font-weight: 1000; margin: 8px 0 16px; }
.checks { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 6px; max-height: 40vh; overflow-y: auto; margin: 10px 0; }
.checks label { flex-direction: row; align-items: center; gap: 8px; background: rgba(255, 255, 255, 0.06); padding: 8px 10px; border-radius: 10px; cursor: pointer; font-size: 14px; }
.checks input { width: 18px; height: 18px; accent-color: var(--accent); }

/* ------------------------------------------------------------ Options */
.options { width: min(760px, 100%); display: flex; flex-direction: column; gap: 16px; }
.opt { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.opt > span { width: 190px; font-weight: 800; }
.seg { display: inline-flex; background: rgba(255, 255, 255, 0.07); border-radius: 12px; padding: 3px; gap: 3px; flex-wrap: wrap; }
.seg button { border: 0; background: transparent; color: var(--text); font-weight: 800; padding: 8px 14px; border-radius: 10px; cursor: pointer; }
.seg button.on { background: var(--grad); }
input[type=range] { accent-color: var(--accent); width: 200px; padding: 0; }
.help { border-top: 1px solid var(--line); padding-top: 12px; }
.help p { font-size: 14px; }
kbd { display: inline-block; min-width: 24px; padding: 2px 6px; margin: 0 2px; border-radius: 6px; background: rgba(255, 255, 255, 0.15); border-bottom: 2px solid rgba(0, 0, 0, 0.3); font: 800 12px var(--font); color: #fff; text-align: center; }

/* ------------------------------------------------------------ HUD */
#hud { position: fixed; top: max(10px, env(safe-area-inset-top)); left: 50%; transform: translateX(-50%); display: flex; align-items: flex-start; gap: 14px; pointer-events: none; z-index: 5; width: min(760px, 96vw); justify-content: center; }
.hud-side { flex: 1; display: flex; flex-direction: column; align-items: flex-start; gap: 6px; padding-top: 8px; min-width: 0; }
.hud-side.right { align-items: flex-end; }
.hud-name { display: flex; align-items: center; gap: 8px; font-weight: 900; font-size: 17px; background: var(--glass); padding: 6px 12px; border-radius: 999px; border: 1px solid var(--line); max-width: 100%; }
.hud-name span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hud-name .ping { font-size: 11px; font-weight: 800; padding: 2px 6px; border-radius: 6px; background: rgba(0, 0, 0, 0.25); color: var(--muted); white-space: nowrap; }
.hud-name .ping:empty { display: none; }
.hud-name .ping.good { color: #5be37d; }
.hud-name .ping.mid { color: #ffd23f; }
.hud-name .ping.bad { color: var(--bad); }
.pips { display: flex; gap: 5px; padding: 0 10px; }
.pips b { width: 10px; height: 10px; border-radius: 50%; background: rgba(255, 255, 255, 0.22); transition: background 0.15s, transform 0.15s; }
.pips b.on { background: #fff; transform: scale(1.2); box-shadow: 0 0 8px #fff; }
.pips.danger b.on { background: var(--bad); box-shadow: 0 0 8px var(--bad); }
.hud-center { text-align: center; }
.hud-score { display: flex; align-items: center; gap: 6px; background: var(--glass); border: 1px solid var(--line); border-radius: 20px; padding: 2px 18px; font-size: 48px; font-weight: 1000; font-variant-numeric: tabular-nums; box-shadow: var(--shadow); }
.hud-score em { font-style: normal; opacity: 0.5; font-size: 34px; }
.hud-score span { display: inline-block; min-width: 1ch; }
.hud-score span.bump { animation: bump 0.5s cubic-bezier(.2, 1.8, .4, 1); }
@keyframes bump { 0% { transform: scale(1.8); color: var(--gold); } 100% { transform: scale(1); } }
.hud-sub { font-size: 12px; font-weight: 800; color: var(--muted); margin-top: 4px; text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5); }
#hud-corner { position: fixed; top: max(12px, env(safe-area-inset-top)); right: 12px; display: flex; gap: 8px; align-items: center; z-index: 6; }
#hud-ping { font-size: 12px; font-weight: 800; color: var(--muted); background: var(--glass); padding: 4px 8px; border-radius: 8px; }
#hud-ping:empty { display: none; }
#emote-bar { position: fixed; bottom: 14px; left: 50%; transform: translateX(-50%); display: flex; gap: 6px; z-index: 6; }
#emote-bar button { font-size: 22px; background: var(--glass); border: 1px solid var(--line); border-radius: 14px; width: 50px; height: 46px; cursor: pointer; position: relative; transition: transform 0.15s; }
#emote-bar button:hover { transform: translateY(-3px) scale(1.08); }
#emote-bar small { position: absolute; bottom: 1px; right: 4px; font-size: 9px; font-weight: 900; }
#banner { position: fixed; top: 34%; left: 50%; transform: translate(-50%, -50%); z-index: 7; pointer-events: none; font-size: clamp(30px, 6vw, 64px); font-weight: 1000; font-style: italic; white-space: nowrap; text-shadow: 0 4px 0 rgba(40, 10, 60, 0.5), 0 10px 30px rgba(0, 0, 0, 0.4); opacity: 0; }
#banner.show { animation: banner 1.6s cubic-bezier(.2, 1.4, .4, 1) forwards; }
@keyframes banner { 0% { opacity: 0; transform: translate(-50%, -50%) scale(0.3) rotate(-6deg); } 18% { opacity: 1; transform: translate(-50%, -50%) scale(1.08) rotate(-3deg); } 30% { transform: translate(-50%, -50%) scale(1) rotate(-3deg); } 80% { opacity: 1; } 100% { opacity: 0; transform: translate(-50%, -60%) scale(1) rotate(-3deg); } }
#countdown { position: fixed; inset: 0; display: grid; place-items: center; pointer-events: none; z-index: 7; font-size: 160px; font-weight: 1000; text-shadow: 0 8px 0 rgba(40, 10, 60, 0.45); }
#countdown span { animation: cd 0.9s ease-out forwards; }
@keyframes cd { 0% { transform: scale(2.2); opacity: 0; } 25% { transform: scale(1); opacity: 1; } 100% { transform: scale(0.8); opacity: 0; } }
#controls-hint { position: fixed; bottom: 70px; left: 50%; transform: translateX(-50%); background: var(--glass); border: 1px solid var(--line); padding: 10px 16px; border-radius: 14px; font-weight: 700; font-size: 14px; z-index: 6; text-align: center; transition: opacity 0.8s; pointer-events: none; }

/* ------------------------------------------------------------ Tactile */
#touch { position: fixed; inset: auto 0 0 0; display: flex; justify-content: space-between; align-items: flex-end; padding: 0 18px max(18px, env(safe-area-inset-bottom)); z-index: 6; pointer-events: none; }
#touch button { pointer-events: auto; width: 78px; height: 78px; border-radius: 50%; border: 2px solid rgba(255, 255, 255, 0.35); background: rgba(255, 255, 255, 0.14); color: #fff; font-size: 26px; touch-action: none; backdrop-filter: blur(6px); }
#touch button.on { background: rgba(255, 255, 255, 0.4); transform: scale(0.94); }
#touch .tpad { display: flex; gap: 14px; }
#touch .tjump { width: 96px; height: 96px; }

/* ------------------------------------------------------------ Overlays */
.overlay { position: fixed; inset: 0; display: grid; place-items: center; z-index: 20; background: rgba(10, 4, 30, 0.45); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); padding: 16px; animation: fadeIn 0.3s; }
.end-card { width: min(560px, 100%); text-align: center; display: flex; flex-direction: column; gap: 14px; }
.end-title { font-size: 40px; font-weight: 1000; font-style: italic; background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.end-title.lose { background: linear-gradient(135deg, #a9b4ff, #6c7bd9); -webkit-background-clip: text; background-clip: text; }
.end-score { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 12px; }
.end-p { font-weight: 900; font-size: 18px; display: flex; flex-direction: column; align-items: center; gap: 6px; min-width: 0; }
.end-p span { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.end-num { font-size: 64px; font-weight: 1000; font-variant-numeric: tabular-nums; }
.end-elo { font-size: 18px; font-weight: 900; min-height: 1em; }
.end-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: 8px; }
.end-stats div { background: rgba(255, 255, 255, 0.07); border-radius: 12px; padding: 10px; }
.end-stats b { display: block; font-size: 22px; }
.end-stats small { font-size: 11px; text-transform: uppercase; letter-spacing: 0.08em; font-weight: 800; }
.end-actions { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
.pause-card { display: flex; flex-direction: column; gap: 10px; width: min(320px, 100%); text-align: center; }
.modal-card { width: min(640px, 100%); max-height: 88vh; overflow-y: auto; display: flex; flex-direction: column; gap: 12px; }
.modal-card .actions { display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; }
.challenge-in { text-align: center; }
.challenge-in .mini-blob { margin: 4px auto 10px; }
.challenge-in .timer { height: 5px; background: rgba(255, 255, 255, 0.15); border-radius: 3px; overflow: hidden; }
.challenge-in .timer i { display: block; height: 100%; background: var(--grad); animation: shrink 60s linear forwards; }
@keyframes shrink { to { width: 0; } } .challenge-in .timer i { width: 100%; }
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: 8px; }
.stat-grid div { background: rgba(255, 255, 255, 0.07); border-radius: 12px; padding: 10px; text-align: center; }
.stat-grid b { display: block; font-size: 22px; }
.stat-grid small { font-size: 11px; text-transform: uppercase; font-weight: 800; }
svg.spark { width: 100%; height: 120px; display: block; }

#toasts { position: fixed; bottom: 18px; right: 18px; display: flex; flex-direction: column; gap: 8px; z-index: 30; pointer-events: none; }
.toast { background: var(--glass); border: 1px solid var(--line); padding: 11px 16px; border-radius: 14px; font-weight: 800; box-shadow: var(--shadow); animation: toastIn 0.35s cubic-bezier(.2, 1.4, .4, 1); max-width: 340px; }
@keyframes toastIn { from { transform: translateX(40px); opacity: 0; } }

body.ingame #screens { display: none; }

@media (max-width: 860px) {
  .menu-grid { grid-template-columns: 1fr 1fr; }
  .tile-solo { grid-column: span 2; }
  .lobby-grid { grid-template-columns: 1fr; }
  .hud-score { font-size: 34px; padding: 0 12px; }
  .hud-name { font-size: 13px; }
  .podium .step { width: 100px; }
  .opt > span { width: 100%; }
}
@media (max-width: 520px) {
  .menu-grid { grid-template-columns: 1fr; }
  .tile-solo { grid-column: span 1; }
  .levels { gap: 6px; }
  .lvl { font-size: 16px; padding: 12px 4px; }
  #emote-bar { display: none; }
}
.modal-card > * { flex-shrink: 0; }

/* ------------------------------------------------------------ comptes (connexion, invitation, compte, admin) */
.muted { color: var(--muted); }
.center { text-align: center; }
p.small, .small { font-size: 12px; }
.or { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 12px; font-weight: 800; margin: 4px 0; }
.or::before, .or::after { content: ""; flex: 1; height: 1px; background: var(--line); }
#totp-login { display: flex; flex-direction: column; gap: 10px; }
#invite-card h2 { margin: 0; }
#invite-card h3 { margin: 10px 0 0; }
.totp-box { display: flex; flex-direction: column; gap: 8px; padding: 12px; border: 1px solid var(--line); border-radius: 16px; background: rgba(0, 0, 0, 0.15); margin-top: 6px; }
.totp-box .qr { align-self: center; width: 190px; padding: 8px; background: #fff; border-radius: 12px; line-height: 0; }
.totp-box .qr svg { width: 100%; height: auto; }
.totp-box form { display: flex; gap: 8px; align-items: flex-end; }
.totp-box form label { flex: 1; }
code.secret { font-family: ui-monospace, Menlo, monospace; font-size: 13px; color: var(--text); user-select: all; -webkit-user-select: all; word-break: break-all; }
.card.narrow { width: min(720px, 100%); }
.acc-head { display: flex; gap: 14px; align-items: center; margin-bottom: 6px; }
.acc-head h2 { margin: 0; }
#account-body h3, #admin-body h3 { margin: 20px 0 8px; }
#account-body .row .grow { white-space: normal; }
.actions.left { justify-content: flex-start; display: flex; gap: 8px; flex-wrap: wrap; }
.adm-form { display: flex; gap: 8px; flex-wrap: wrap; }
.adm-form input { flex: 1 1 220px; }
.adm-users td.adm-act { display: flex; gap: 6px; flex-wrap: wrap; white-space: normal; }
.adm-users tr.off td { opacity: 0.55; }
.invite-link { margin-top: 10px; padding: 12px; border-radius: 14px; border: 1px solid var(--line); background: rgba(126, 217, 87, 0.1); }
.copy-row { display: flex; gap: 8px; }
.copy-row input { flex: 1; font-family: ui-monospace, Menlo, monospace; font-size: 12px; }

/* connexion par code e-mail */
.login-title { margin: 0; text-align: center; font-size: 24px; font-weight: 1000; }
#login-step-mail, #login-step-code { display: flex; flex-direction: column; gap: 12px; }
#login-step-mail.hidden, #login-step-code.hidden { display: none; }
#code-send, #code-verify { display: flex; flex-direction: column; gap: 10px; }
#in-email { text-align: center; font-size: 16px; }
.code-boxes { display: flex; gap: 8px; justify-content: center; }
.code-boxes input { width: 46px; height: 58px; padding: 0; text-align: center; font-size: 28px; font-weight: 1000; border-radius: 14px;
  border: 2px solid var(--line); background: rgba(255, 255, 255, 0.08); caret-color: var(--accent); }
.code-boxes input:focus { border-color: var(--accent); background: rgba(255, 255, 255, 0.16); transform: translateY(-2px); }
.code-boxes input.filled { background: linear-gradient(135deg, #ff5a8a, #ff8a3d); border-color: transparent; color: #fff; box-shadow: 0 6px 16px rgba(255, 90, 138, 0.35); }
.code-boxes.shake { animation: shake 0.4s; }
@keyframes shake { 20%, 60% { transform: translateX(-6px); } 40%, 80% { transform: translateX(6px); } }
.code-links { display: flex; justify-content: space-between; gap: 8px; }
.link-btn { background: none; border: 0; color: var(--muted); font: inherit; font-size: 13px; font-weight: 800; cursor: pointer; text-decoration: underline; padding: 4px; }
.link-btn:hover { color: var(--text); }
.link-btn:disabled { opacity: 0.5; cursor: default; text-decoration: none; }
@media (max-width: 420px) { .code-boxes input { width: 40px; height: 52px; font-size: 24px; } .code-boxes { gap: 6px; } }
