:root {
  --accent: #ff6a1a;
  --panel: rgba(16, 18, 26, 0.86);
  --line: rgba(255, 255, 255, 0.12);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: #0b0c12;
  color: #fff;
  font-family: "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
  font-weight: 700;
  user-select: none;
}

#game { position: fixed; inset: 0; width: 100%; height: 100%; display: block; }
.hidden { display: none !important; }

/* ---------- HUD ---------- */

#hud { position: fixed; inset: 0; pointer-events: none; text-shadow: 0 2px 0 rgba(0, 0, 0, 0.55); }

#roundbar { position: absolute; top: 14px; left: 50%; transform: translateX(-50%); text-align: center; }
#arena-name { font-size: 13px; letter-spacing: 3px; text-transform: uppercase; opacity: 0.85; }
#timer { font-size: 40px; font-weight: 900; font-style: italic; line-height: 1; font-variant-numeric: tabular-nums; }
#timer.urgent { color: #ff4d4d; }

#feed { position: absolute; top: 16px; left: 16px; display: flex; flex-direction: column; gap: 4px; font-size: 14px; }
#feed div { background: rgba(0, 0, 0, 0.45); padding: 4px 10px; border-radius: 4px; width: fit-content; text-shadow: none; }
#feed .w { opacity: 0.7; font-weight: 600; margin: 0 6px; }

#mini { position: absolute; top: 16px; right: 16px; width: 210px; font-size: 14px; text-shadow: none; }
#mini div { display: flex; gap: 8px; align-items: center; background: rgba(0, 0, 0, 0.45); padding: 4px 10px; margin-bottom: 3px; border-radius: 4px; }
#mini .me { background: rgba(255, 106, 26, 0.55); }
#mini .n { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#mini .r { opacity: 0.6; width: 14px; }
.dot { width: 10px; height: 10px; border-radius: 2px; display: inline-block; flex: none; }

#crosshair, #hitmarker { position: absolute; left: 50%; top: 50%; width: 0; height: 0; }
#crosshair i { position: absolute; background: #fff; box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.6); }
#crosshair i:nth-child(1) { width: 2px; height: 8px; left: -1px; top: -14px; }
#crosshair i:nth-child(2) { width: 2px; height: 8px; left: -1px; top: 6px; }
#crosshair i:nth-child(3) { width: 8px; height: 2px; left: -14px; top: -1px; }
#crosshair i:nth-child(4) { width: 8px; height: 2px; left: 6px; top: -1px; }

#hitmarker { opacity: 0; transition: opacity 0.25s; }
#hitmarker::before, #hitmarker::after { content: ""; position: absolute; left: -11px; top: -1.5px; width: 22px; height: 3px; background: #fff; transform: rotate(45deg); box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.5); }
#hitmarker::after { transform: rotate(-45deg); }
#hitmarker.show { opacity: 1; transition: none; }
#hitmarker.head::before, #hitmarker.head::after { background: #ffd23a; }
#hitmarker.kill::before, #hitmarker.kill::after { background: #ff3b3b; }

#scope { position: absolute; inset: 0; display: none; background: radial-gradient(circle at center, transparent 0, transparent 34vh, #000 34.4vh); }
#scope::before, #scope::after { content: ""; position: absolute; background: rgba(0, 0, 0, 0.85); }
#scope::before { left: 0; right: 0; top: 50%; height: 1px; }
#scope::after { top: 0; bottom: 0; left: 50%; width: 1px; }
#scope.on { display: block; }

#vignette { position: absolute; inset: 0; opacity: 0; box-shadow: inset 0 0 140px 20px rgba(255, 0, 0, 0.8); }

#toast { position: absolute; left: 50%; top: 62%; transform: translateX(-50%); font-size: 22px; font-style: italic; font-weight: 900; opacity: 0; transition: opacity 0.4s; white-space: nowrap; }
#toast.show { opacity: 1; transition: none; }

#health { position: absolute; left: 22px; bottom: 20px; display: flex; align-items: center; gap: 12px; }
#health-num { font-size: 44px; font-weight: 900; font-style: italic; width: 84px; text-align: right; }
#health-bar { width: 220px; height: 14px; background: rgba(0, 0, 0, 0.5); border-radius: 3px; overflow: hidden; transform: skewX(-12deg); }
#health-fill { height: 100%; width: 100%; background: #4cd964; transition: width 0.12s; }
#health .bars { position: relative; display: flex; flex-direction: column; gap: 5px; }
#health-num { transition: color 0.4s, text-shadow 0.4s; }
#health.heal #health-num { color: #7dff96; text-shadow: 0 0 16px rgba(90, 255, 130, 0.9); transition: none; }
#stamina-bar { width: 220px; height: 6px; background: rgba(0, 0, 0, 0.5); border-radius: 3px; overflow: hidden; transform: skewX(-12deg); }
#stamina-fill { height: 100%; width: 100%; background: #ffd23a; }
#stamina-bar.spent #stamina-fill { background: #ff6b3b; }
#sneak-tag { position: absolute; left: 2px; bottom: 100%; margin-bottom: 6px; font-size: 12px; letter-spacing: 3px; opacity: 0; transition: opacity 0.15s; }
#sneak-tag.on { opacity: 0.9; }

#weapon { position: absolute; right: 22px; bottom: 20px; text-align: right; }
#ammo-cur { font-size: 52px; font-weight: 900; font-style: italic; }
#ammo-max { font-size: 22px; opacity: 0.7; margin-left: 6px; }
#ammo.low #ammo-cur { color: #ff4d4d; }
#weapon-name { font-size: 14px; letter-spacing: 2px; text-transform: uppercase; opacity: 0.85; margin-bottom: 8px; }
#slots { display: flex; gap: 6px; justify-content: flex-end; text-shadow: none; }
#slots div { background: rgba(0, 0, 0, 0.45); padding: 5px 10px; border-radius: 4px; font-size: 12px; border-bottom: 3px solid transparent; opacity: 0.7; }
#slots div.on { border-color: var(--accent); opacity: 1; }
#slots b { color: var(--accent); margin-right: 6px; }

#death { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; background: rgba(120, 0, 0, 0.28); font-size: 20px; }
.big { font-size: 64px; font-weight: 900; font-style: italic; letter-spacing: 2px; color: #ff4d4d; }

/* ---------- Panneaux ---------- */

.overlay { position: fixed; inset: 0; display: flex; align-items: center; justify-content: center; background: rgba(6, 7, 12, 0.6); }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 26px 30px; min-width: 380px; max-width: 92vw; max-height: 94vh; overflow-y: auto; display: flex; flex-direction: column; gap: 14px; }
.panel h1 { margin: 0; font-size: 40px; font-weight: 900; font-style: italic; text-align: center; }
.panel h2 { margin: 0; font-size: 20px; font-style: italic; text-transform: uppercase; }
.panel h2 span { opacity: 0.6; font-size: 14px; margin-left: 8px; }
.small { font-size: 13px; opacity: 0.75; font-weight: 600; text-align: center; }
.logo { font-size: 64px !important; letter-spacing: 2px; }
.logo span { color: var(--accent); }
/* Le logo du jeu : on ne garde que l'hexagone, sans le fond clair de l'image. */
.logo-mark { height: 148px; margin: -4px 0 -14px; display: flex; justify-content: center; align-items: center; filter: drop-shadow(0 6px 22px rgba(255, 106, 26, 0.4)); }
.logo-mark img { width: 196px; height: 196px; flex: none; clip-path: polygon(50% 12.3%, 81.8% 31.3%, 81.8% 68.7%, 50% 87.6%, 18.2% 68.7%, 18.2% 31.3%); }

#scoreboard { position: fixed; left: 50%; top: 50%; transform: translate(-50%, -50%); min-width: 520px; }

table { width: 100%; border-collapse: collapse; font-size: 15px; }
th { font-size: 11px; letter-spacing: 1.5px; text-transform: uppercase; opacity: 0.6; padding: 4px 10px; }
td { padding: 7px 10px; text-align: center; border-top: 1px solid var(--line); font-variant-numeric: tabular-nums; }
.left { text-align: left; }
td.left { display: flex; align-items: center; gap: 8px; }
tr.me td { background: rgba(255, 106, 26, 0.22); }
tr.first td { color: #ffd23a; }

input#name { font: inherit; font-size: 18px; padding: 12px 14px; border-radius: 6px; border: 1px solid var(--line); background: rgba(255, 255, 255, 0.08); color: #fff; outline: none; text-align: center; user-select: text; }
input#name:focus { border-color: var(--accent); }
button { font: inherit; font-size: 20px; font-weight: 900; font-style: italic; letter-spacing: 1px; padding: 13px; border: 0; border-radius: 6px; background: var(--accent); color: #fff; cursor: pointer; }
button:hover:not(:disabled) { filter: brightness(1.12); }
button:disabled { opacity: 0.4; cursor: default; }
label.small { display: flex; flex-direction: column; gap: 8px; }
input[type="range"] { accent-color: var(--accent); }

.controls { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 18px; font-size: 12px; font-weight: 600; opacity: 0.8; }
.controls b { color: var(--accent); margin-right: 6px; }

#gi-status { position: absolute; left: 50%; bottom: 14px; transform: translateX(-50%); font-size: 12px; font-weight: 600; opacity: 0.75; }

.quality { display: flex; flex-direction: column; gap: 6px; }
.quality .row { display: flex; gap: 6px; }
.quality button { flex: 1; font-size: 13px; padding: 8px 4px; background: rgba(255, 255, 255, 0.1); font-style: normal; letter-spacing: 0; }
.quality button.on { background: var(--accent); }
.quality .hint { font-size: 12px; font-weight: 600; opacity: 0.7; text-align: center; min-height: 30px; }

/* Les résultats passent au-dessus du menu pause. */
#roundend { z-index: 2; }
/* Apparaît avec un léger retard : en plein écran, la souris est recapturée avant. */
#click-resume { z-index: 2; background: rgba(6, 7, 12, 0.25); cursor: pointer; animation: appear 0.15s ease-out 0.12s both; }
#click-resume div { padding: 12px 24px; border-radius: 6px; background: var(--panel); border: 1px solid var(--line); font-size: 20px; font-weight: 900; font-style: italic; letter-spacing: 1px; }
@keyframes appear { from { opacity: 0; } }
#status { z-index: 3; background: rgba(6, 7, 12, 0.9); }
#status .panel { max-width: 520px; }
#status-text { font-size: 15px; line-height: 1.5; }

/* Message de l'administrateur à tous les joueurs */
#notice { position: fixed; left: 50%; top: 84px; transform: translateX(-50%); z-index: 4; max-width: min(720px, 90vw); padding: 10px 20px; border-radius: 6px; background: var(--accent); font-size: 18px; text-align: center; box-shadow: 0 6px 24px rgba(0, 0, 0, 0.4); opacity: 0; pointer-events: none; transition: opacity 0.4s; }
#notice.show { opacity: 1; }

#name-error { color: #ff6b6b; font-size: 13px; text-align: center; min-height: 0; }
#name-error:empty { display: none; }

/* ---------- Tableau de bord admin (opérateurs) ---------- */

kbd { font: inherit; font-size: 0.72em; font-style: normal; padding: 1px 6px; border-radius: 4px; background: rgba(0, 0, 0, 0.32); margin-left: 6px; }
button.secondary { background: rgba(255, 255, 255, 0.12); font-size: 15px; }

#admin-open { position: fixed; left: 14px; top: 14px; z-index: 5; font-size: 13px; font-style: normal; padding: 7px 12px; background: rgba(16, 18, 26, 0.9); border: 1px solid var(--accent); }
body.playing #admin-open { display: none; }

#admin { z-index: 5; background: rgba(6, 7, 12, 0.74); }
#admin .panel { width: min(880px, 96vw); max-width: 96vw; height: min(660px, 94vh); gap: 12px; padding: 20px 22px; overflow: hidden; }
.admin-head { display: flex; align-items: center; gap: 12px; }
.mode { font-size: 11px; font-weight: 800; padding: 4px 10px; border-radius: 999px; background: rgba(255, 255, 255, 0.12); text-transform: uppercase; letter-spacing: 1px; }
.mode.online { background: #1f8f4a; }
.mode.private { background: #6c5ce7; }
.mode.maintenance { background: #b97f00; }
.mode.closed { background: #c0392b; }
#admin-close { margin-left: auto; width: 34px; height: 34px; padding: 0; font-size: 22px; font-style: normal; line-height: 1; background: rgba(255, 255, 255, 0.1); }

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); }
.tabs button { background: none; font-size: 14px; font-style: normal; letter-spacing: 0.5px; padding: 9px 18px; border-radius: 6px 6px 0 0; opacity: 0.6; border-bottom: 3px solid transparent; }
.tabs button.on { opacity: 1; border-bottom-color: var(--accent); background: rgba(255, 255, 255, 0.06); }

#admin section { flex: 1; min-height: 0; display: flex; flex-direction: column; gap: 10px; }
#admin input, #admin select { font: inherit; font-size: 13px; font-weight: 600; padding: 8px 10px; border-radius: 5px; border: 1px solid var(--line); background: rgba(255, 255, 255, 0.08); color: #fff; outline: none; user-select: text; min-width: 0; }
#admin input:focus, #admin select:focus { border-color: var(--accent); }
#admin select option { color: #000; }
#admin section button { font-size: 13px; font-style: normal; letter-spacing: 0; padding: 8px 12px; }
#admin button.ghost { background: rgba(255, 255, 255, 0.12); }
#admin button.danger { background: #c0392b; }
#admin button:disabled { opacity: 0.22; }
.ad-row { display: flex; gap: 8px; align-items: center; }
.ad-row > input { flex: 1; }
.label { font-size: 11px; letter-spacing: 1.5px; text-transform: uppercase; opacity: 0.6; margin-top: 4px; }
.ad-note { font-size: 13px; font-weight: 600; opacity: 0.7; }

.ad-list { flex: 1; min-height: 0; overflow-y: auto; display: flex; flex-direction: column; gap: 4px; }
.ad-player { display: grid; grid-template-columns: 10px minmax(80px, 1.3fr) 76px 58px minmax(80px, 1fr) 96px 80px 70px; align-items: center; gap: 8px; padding: 6px 8px; border-radius: 6px; background: rgba(255, 255, 255, 0.05); font-size: 14px; }
.ad-player .n { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ad-player .tags { font-size: 10px; text-transform: uppercase; letter-spacing: 1px; color: var(--accent); white-space: nowrap; }
.ad-player .kd { font-variant-numeric: tabular-nums; opacity: 0.8; text-align: center; }
.ad-player .ip { font-family: Consolas, "Cascadia Mono", monospace; font-size: 12px; font-weight: 400; opacity: 0.75; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; user-select: text; }
#admin .ad-player button { padding: 6px 4px; font-size: 12px; }
.ad-row.bots { border-top: 1px solid var(--line); padding-top: 10px; }
.ad-row.bots .label { margin: 0; }
.ad-row.bots #ad-bots { width: 70px; flex: none; }

.segmented { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
#admin .segmented button { background: rgba(255, 255, 255, 0.1); padding: 12px 6px; }
#admin .segmented button.on { background: var(--accent); }

.maps { display: grid; grid-template-columns: repeat(2, 1fr); grid-auto-rows: minmax(120px, 1fr); gap: 10px; flex: 1; min-height: 0; overflow-y: auto; }
#admin .maps .map { position: relative; padding: 0; overflow: hidden; border-radius: 8px; background: #0d0f16; border: 2px solid transparent; min-height: 0; }
.map img { width: 100%; height: 100%; object-fit: cover; display: block; }
.map img:not([src]) { visibility: hidden; }
.map .name { position: absolute; left: 0; right: 0; bottom: 0; padding: 22px 12px 8px; text-align: left; font-size: 18px; font-weight: 900; font-style: italic; background: linear-gradient(transparent, rgba(0, 0, 0, 0.78)); }
.map .badge { position: absolute; top: 8px; right: 8px; display: none; font-size: 11px; padding: 3px 9px; border-radius: 999px; background: var(--accent); text-transform: uppercase; letter-spacing: 1px; }
#admin .maps .map.on { border-color: var(--accent); }
.map.on .badge { display: block; }
.map:hover img { filter: brightness(1.18); }

.console { flex: 1; min-height: 0; overflow-y: auto; background: rgba(0, 0, 0, 0.45); border-radius: 6px; padding: 8px 10px; font-family: Consolas, "Cascadia Mono", monospace; font-size: 12.5px; font-weight: 400; line-height: 1.5; user-select: text; white-space: pre-wrap; overflow-wrap: anywhere; }
.console .cmd { font-weight: 700; }
.console .reply { color: #5ad1e6; }
.console .err { color: #ff6b6b; }
#admin #ad-help { width: 34px; height: 34px; flex: none; padding: 0; border-radius: 50%; font-family: Georgia, "Times New Roman", serif; font-style: italic; font-size: 17px; background: rgba(255, 255, 255, 0.16); }
.memo { max-height: 200px; overflow-y: auto; background: rgba(0, 0, 0, 0.35); border-radius: 6px; padding: 8px 10px; font-size: 12.5px; font-weight: 600; display: flex; flex-direction: column; gap: 3px; flex: none; }
.memo div { display: grid; grid-template-columns: 260px 1fr; gap: 10px; }
.memo code { font-family: Consolas, "Cascadia Mono", monospace; color: var(--accent); }
.memo span { opacity: 0.8; }

#ad-feedback { min-height: 18px; font-size: 13px; font-weight: 600; opacity: 0.85; }
#ad-feedback.error { color: #ff6b6b; opacity: 1; }

#re-title { color: #ffd23a; }
#re-next { text-align: center; font-size: 16px; }

/* ---------- Commandes tactiles (téléphone, tablette : public/touch.js) ---------- */

:root { --btn: 1; --stick: 124px; }
body:not(.touch) .touch-only, body.touch .pc-only { display: none !important; }
.menu-col { display: contents; }
body.touch { overscroll-behavior: none; -webkit-tap-highlight-color: transparent; }
body.touch button { touch-action: manipulation; }
body.touch kbd, body.touch #sneak-tag { display: none; }

#touch { display: none; position: fixed; inset: 0; touch-action: none; -webkit-touch-callout: none; -webkit-user-select: none; }
body.touch.ingame #touch { display: block; }

#stick-home { position: absolute; width: 0; height: 0; left: calc(34px + var(--stick) / 2 + env(safe-area-inset-left, 0px)); bottom: calc(26px + var(--stick) / 2 + env(safe-area-inset-bottom, 0px)); }
#stick { position: absolute; left: 0; top: 0; width: var(--stick); height: var(--stick); border-radius: 50%; background: rgba(255, 255, 255, 0.08); border: 2px solid rgba(255, 255, 255, 0.3); pointer-events: none; }
#stick.rest { opacity: 0.5; }
#stick-knob { position: absolute; left: 27%; top: 27%; width: 46%; height: 46%; border-radius: 50%; background: rgba(255, 255, 255, 0.55); box-shadow: 0 2px 10px rgba(0, 0, 0, 0.4); }

/* Boutons : --size, --x (depuis la droite), --y (depuis le bas), à l'échelle de --btn */
.tbtn { position: absolute; width: calc(var(--size) * var(--btn)); height: calc(var(--size) * var(--btn)); right: calc(var(--x) * var(--btn) + env(safe-area-inset-right, 0px)); bottom: calc(var(--y) * var(--btn) + env(safe-area-inset-bottom, 0px)); border-radius: 50%; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px; background: rgba(16, 18, 26, 0.42); border: 2px solid rgba(255, 255, 255, 0.3); color: #fff; }
.tbtn svg { width: 44%; height: 44%; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; pointer-events: none; }
.tbtn span { font-size: calc(7.5px * var(--btn)); letter-spacing: 0; opacity: 0.85; pointer-events: none; white-space: nowrap; }
.tbtn.down { background: rgba(255, 255, 255, 0.3); }
.tbtn.on { background: rgba(255, 106, 26, 0.75); border-color: var(--accent); }
.tbtn[data-act="fire"] { --size: 86px; --x: 30px; --y: 44px; background: rgba(255, 106, 26, 0.32); border-color: rgba(255, 106, 26, 0.9); }
.tbtn[data-act="fire"].down { background: rgba(255, 106, 26, 0.7); }
.tbtn[data-act="fire"] .auto-tag { display: none; font-size: calc(9px * var(--btn)); color: #ffd23a; }
.tbtn[data-act="fire"].auto .auto-tag { display: block; }
/* En arc autour du tir, pour laisser libre la barre d'armes en bas au centre à toutes les tailles */
.tbtn[data-act="aim"] { --size: 56px; --x: 45px; --y: 171px; }
.tbtn[data-act="reload"] { --size: 54px; --x: 110px; --y: 152px; }
.tbtn[data-act="crouch"] { --size: 56px; --x: 150px; --y: 97px; }
.tbtn[data-act="jump"] { --size: 64px; --x: 149px; --y: 26px; }
.tbtn[data-act="sprint"] { --size: 56px; --x: 240px; --y: 76px; }
/* Pause et scores : petits carrés en haut à gauche, taille fixe */
.tbtn.sys { width: 40px; height: 40px; border-radius: 8px; right: auto; bottom: auto; top: calc(8px + env(safe-area-inset-top, 0px)); left: calc(var(--x) + env(safe-area-inset-left, 0px)); }
.tbtn[data-act="pause"] { --x: 10px; }
.tbtn[data-act="scores"] { --x: 56px; }

/* HUD réorganisé autour des commandes */
body.touch #roundbar { top: 4px; }
body.touch #timer { font-size: 30px; }
body.touch #arena-name { font-size: 11px; }
body.touch #health { left: calc(108px + env(safe-area-inset-left, 0px)); top: 8px; bottom: auto; gap: 8px; }
body.touch #health-num { font-size: 28px; width: auto; }
body.touch #health-bar, body.touch #stamina-bar { width: 120px; }
body.touch #health-bar { height: 10px; }
body.touch #feed { top: calc(58px + env(safe-area-inset-top, 0px)); left: calc(12px + env(safe-area-inset-left, 0px)); font-size: 12px; }
body.touch #mini { top: 8px; right: calc(10px + env(safe-area-inset-right, 0px)); width: 150px; font-size: 12px; }
body.touch #mini div { padding: 2px 8px; margin-bottom: 2px; }
body.touch #weapon { right: auto; left: 50%; transform: translateX(-50%); bottom: calc(6px + env(safe-area-inset-bottom, 0px)); display: flex; flex-direction: column; align-items: center; gap: 2px; text-align: center; }
body.touch #weapon-name { display: none; }
body.touch #ammo-cur { font-size: 28px; }
body.touch #ammo-max { font-size: 14px; }
body.touch #slots { pointer-events: auto; }
body.touch #slots div { padding: 8px 10px; font-size: 11px; }
body.touch #gi-status { top: 50px; bottom: auto; }
body.touch #toast { font-size: 18px; }

.touch-settings { display: flex; flex-direction: column; gap: 8px; }
.touch-settings .hint { font-size: 12px; font-weight: 600; opacity: 0.7; text-align: center; }
.touch-settings .t-auto { font-size: 14px; font-style: normal; padding: 9px; }
.touch-settings .t-auto.on { background: var(--accent); }

/* Téléphone tenu à la verticale pendant la partie */
#rotate { display: none; z-index: 6; background: rgba(6, 7, 12, 0.94); }
#rotate .panel { align-items: center; min-width: 0; text-align: center; }
#rotate svg { width: 64px; height: 64px; fill: none; stroke: var(--accent); stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
@media (orientation: portrait) {
  body.touch.ingame #rotate { display: flex; }
}

/* Petits écrans : panneaux plus compacts */
@media (max-width: 440px) {
  .panel { min-width: 0; width: 94vw; padding: 20px 18px; }
}
@media (max-height: 540px) {
  .panel { padding: 14px 20px; gap: 9px; }
  .panel h1 { font-size: 28px; }
  .logo { font-size: 38px !important; }
  .logo-mark { height: 78px; margin: -4px 0 -8px; }
  .logo-mark img { width: 104px; height: 104px; }
  button { font-size: 17px; padding: 10px; }
  input#name { padding: 9px 12px; font-size: 16px; }
  .quality .hint { min-height: 0; }
}
@media (max-height: 540px) and (orientation: landscape) {
  #menu .panel { flex-direction: row; align-items: center; gap: 24px; width: min(780px, 96vw); }
  #menu .menu-col { display: flex; flex-direction: column; gap: 9px; flex: 1; min-width: 0; }
  #pause .panel { display: grid; grid-template-columns: 1fr 1fr; gap: 9px 22px; width: min(780px, 96vw); align-items: start; }
  #pause .panel > h1, #pause #resume, #pause .panel > .small:last-child { grid-column: 1 / -1; }
  #scoreboard { min-width: 0; width: min(560px, 94vw); }
}

/* ---------- Bonus et arme spéciale ---------- */

/* Bonus en cours, au-dessus des barres de vie et d'endurance */
#buffs { position: absolute; left: 0; bottom: calc(100% + 26px); display: flex; gap: 6px; text-shadow: none; }
#buffs span { font-size: 12px; font-weight: 900; letter-spacing: 1.5px; padding: 3px 9px; border-radius: 4px; }
#buffs .guard { background: rgba(90, 200, 250, 0.85); color: #06202c; }
#buffs .haste { background: rgba(255, 210, 58, 0.9); color: #2c2200; }
body.touch #buffs { bottom: auto; top: calc(100% + 6px); }
/* Invulnérable : bords de l'écran bleutés */
#guard-fx { position: absolute; inset: 0; opacity: 0; box-shadow: inset 0 0 120px 10px rgba(90, 200, 250, 0.7); transition: opacity 0.25s; }
#guard-fx.on { opacity: 1; }
/* Case 4 et nom de l'arme spéciale, en or */
#slots div.special { border-bottom-color: rgba(255, 200, 74, 0.5); }
#slots div.special b, #weapon.special #weapon-name { color: #ffc84a; }
#slots div.special.on { border-color: #ffc84a; }

/* Carte Debug : dégâts infligés, qui montent et s'effacent près du viseur */
.dmg-pop { position: absolute; left: 50%; top: 50%; font-size: 18px; font-weight: 900; font-style: italic; color: #fff; pointer-events: none; animation: dmg-pop 0.9s ease-out forwards; }
.dmg-pop.head { color: #ffd23a; }
.dmg-pop.kill { color: #ff3b3b; }
@keyframes dmg-pop {
  from { transform: translate(var(--dx), -12px); opacity: 1; }
  to { transform: translate(var(--dx), -64px); opacity: 0; }
}

/* ---------- Comptes, profil, classement ---------- */

/* Icône de certification à côté du pseudo des joueurs qui ont un compte */
.verified { display: inline-flex; align-items: center; justify-content: center; flex: none; width: 15px; height: 15px; border-radius: 50%; background: #2f9bff; color: #fff; font-size: 10px; font-weight: 900; font-style: normal; line-height: 1; text-shadow: none; margin-right: 5px; vertical-align: -2px; }

.menu-row { display: flex; gap: 8px; }
.menu-row button { flex: 1; font-size: 13px; font-style: normal; padding: 9px 6px; }
.account-user { display: flex; align-items: center; justify-content: center; gap: 4px; flex-wrap: wrap; font-size: 18px; padding: 8px; border-radius: 6px; background: rgba(47, 155, 255, 0.14); border: 1px solid rgba(47, 155, 255, 0.4); }
.account-user .verified { width: 18px; height: 18px; font-size: 12px; }
#acc-meta { font-size: 12px; font-weight: 600; opacity: 0.7; margin-left: 6px; }
button.link { background: none; padding: 0 4px; font-size: 12px; font-weight: 600; font-style: normal; letter-spacing: 0; color: #9ccfff; text-decoration: underline; }

/* Panneaux par-dessus le menu et la pause */
.sheet { z-index: 6; background: rgba(6, 7, 12, 0.78); }
.sheet .panel { width: min(420px, 94vw); }
.sheet .panel.wide { width: min(720px, 96vw); }
.sheet-head { display: flex; align-items: center; gap: 10px; }
.sheet-head .close { margin-left: auto; width: 34px; height: 34px; padding: 0; font-size: 22px; font-style: normal; line-height: 1; background: rgba(255, 255, 255, 0.1); }
.field { display: flex; flex-direction: column; gap: 6px; font-size: 13px; font-weight: 600; opacity: 0.9; }
.field input { font: inherit; font-size: 16px; padding: 10px 12px; border-radius: 6px; border: 1px solid var(--line); background: rgba(255, 255, 255, 0.08); color: #fff; outline: none; user-select: text; }
.field input:focus { border-color: var(--accent); }
#auth-error { color: #ff6b6b; font-size: 13px; text-align: center; }
#auth-error:empty { display: none; }

.profile-head { display: flex; flex-direction: column; gap: 4px; }
.profile-name { display: flex; align-items: center; font-size: 26px; font-weight: 900; font-style: italic; }
.profile-name .verified { width: 20px; height: 20px; font-size: 13px; margin-right: 8px; }
.profile-head .warn { font-size: 13px; font-weight: 600; color: #ffcc66; }
.bar { height: 8px; border-radius: 4px; background: rgba(255, 255, 255, 0.12); overflow: hidden; }
.bar > div { height: 100%; background: var(--accent); }
.level { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 12px; }
.level b { font-size: 18px; font-style: italic; }
.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.stat-grid div { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 4px; border-radius: 6px; background: rgba(255, 255, 255, 0.05); }
.stat-grid b { font-size: 20px; font-variant-numeric: tabular-nums; }
.stat-grid span { font-size: 11px; font-weight: 600; opacity: 0.7; text-align: center; }
.achievements { display: flex; flex-direction: column; gap: 6px; }
.ach { display: grid; grid-template-columns: 1fr auto 150px; align-items: center; gap: 12px; padding: 8px 10px; border-radius: 6px; background: rgba(255, 255, 255, 0.04); border-left: 3px solid transparent; }
.ach.tier-1 { border-left-color: #cd7f32; }
.ach.tier-2 { border-left-color: #c9d1d9; }
.ach.tier-3 { border-left-color: #ffc84a; }
.ach-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.ach-text b { font-size: 14px; }
.ach-text span { font-size: 12px; font-weight: 600; opacity: 0.65; }
.medals { display: flex; gap: 4px; }
.medals i { width: 24px; height: 24px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 10px; font-style: normal; font-weight: 900; background: rgba(255, 255, 255, 0.08); color: rgba(255, 255, 255, 0.35); }
.medals i.on.t1 { background: #cd7f32; color: #fff; }
.medals i.on.t2 { background: #c9d1d9; color: #222; }
.medals i.on.t3 { background: #ffc84a; color: #2c2200; }
.ach-prog { display: flex; flex-direction: column; gap: 3px; align-items: stretch; text-align: right; }
.ach-prog .small { text-align: right; }
#board .tabs button { font-size: 13px; padding: 8px 12px; }
#board td.left { display: flex; align-items: center; }
#board-me { text-align: left; font-size: 14px; }
@media (max-width: 600px) {
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
  .ach { grid-template-columns: 1fr auto; }
  .ach-prog { grid-column: 1 / -1; }
}

/* Bandeau doré : succès débloqué, niveau gagné */
#unlock { position: fixed; left: 50%; top: 140px; transform: translateX(-50%) translateY(-10px); z-index: 4; padding: 10px 22px; border-radius: 6px; background: linear-gradient(90deg, #b8860b, #ffc84a, #b8860b); color: #231a00; font-size: 17px; font-weight: 900; font-style: italic; letter-spacing: 1px; box-shadow: 0 6px 24px rgba(0, 0, 0, 0.45); opacity: 0; pointer-events: none; transition: opacity 0.3s, transform 0.3s; white-space: nowrap; }
#unlock.show { opacity: 1; transform: translateX(-50%); }
#board tbody tr { cursor: pointer; }

/* Clé à molette des opérateurs, après le pseudo */
.staff { display: inline-flex; flex: none; width: 14px; height: 14px; margin-left: 5px; vertical-align: -2px; color: #ffc84a; }
.staff svg { width: 100%; height: 100%; fill: none; stroke: currentColor; stroke-width: 2.6; stroke-linecap: round; stroke-linejoin: round; filter: drop-shadow(0 1px 0 rgba(0, 0, 0, 0.6)); }
/* Interrupteur du tableau de bord admin */
.badge-toggle { display: flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 700; opacity: 0.85; cursor: pointer; user-select: none; }
.badge-toggle input { accent-color: var(--accent); width: 15px; height: 15px; margin: 0; }
.badge-toggle .staff { margin-left: 0; }
