:root {
  color-scheme: dark;
  font-family: "Arial", "Helvetica Neue", Helvetica, sans-serif;
  font-synthesis: none;
  color: #edf5ef;
  background: #071715;
  --ink: #071715;
  --panel: rgba(5, 29, 24, .88);
  --mint: #8bf2cf;
  --mint-hover: #b0ffe5;
  --text: #edf5ef;
  --muted: #acbfb6;
  --line: rgba(203, 234, 220, .34);
  --line-soft: rgba(203, 234, 220, .13);
  --control: rgba(205, 241, 224, .055);
}
* { box-sizing: border-box; }
html, body { margin: 0; width: 100%; height: 100%; overflow: hidden; }
body { -webkit-font-smoothing: antialiased; }
button, input, select { font: inherit; }
button { cursor: pointer; }
button, input, select, summary { -webkit-tap-highlight-color: transparent; }
button { color: inherit; }
button:disabled { opacity: .48; cursor: not-allowed; }
button:focus-visible, input:focus-visible, select:focus-visible, summary:focus-visible, a:focus-visible { outline: 2px solid var(--mint); outline-offset: 4px; }
button:focus:not(:focus-visible) { outline: none; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
#game { position: fixed; inset: 0; width: 100%; height: 100%; touch-action: none; }
#shade { position: fixed; inset: 0; z-index: 4; background: rgba(0, 12, 10, .58); backdrop-filter: blur(6px); }
#brand-header { position: fixed; top: 20px; left: 32px; right: 32px; z-index: 3; display: flex; align-items: center; justify-content: space-between; pointer-events: none; }
.brand { display: inline-flex; gap: 14px; align-items: center; color: var(--text); text-decoration: none; font-size: 32px; font-weight: 800; letter-spacing: -.8px; line-height: 1; pointer-events: auto; }
.brand-mark { position: relative; display: inline-block; width: 58px; height: 38px; }
.brand-mark i { position: absolute; top: 2px; width: 34px; height: 34px; border: 3px solid var(--mint); border-radius: 50%; }
.brand-mark i:first-child { left: 0; }
.brand-mark i:last-child { right: 0; }
.header-actions { display: flex; gap: 34px; align-items: center; pointer-events: auto; }
.connection { margin: 0; display: flex; align-items: center; gap: 10px; color: var(--text); font-size: 15px; }
.connection::before, .status-dot { content: ""; display: inline-block; width: 9px; height: 9px; border-radius: 50%; background: #83f69b; box-shadow: 0 0 13px #83f69b26; flex: none; }
.connection:has(.status-dot)::before { display: none; }
.connection.error { color: #ffaf9e; }
.connection.error::before { background: #ff8e80; }
.button { min-height: 42px; padding: 10px 18px; border: 1px solid transparent; border-radius: 9px; background: transparent; font-weight: 600; font-size: 15px; line-height: 1.15; display: inline-flex; align-items: center; justify-content: center; gap: 10px; transition: background .15s, border-color .15s, color .15s; }
.button-primary { background: var(--mint); color: #031b13; border-color: var(--mint); }
.button-primary:hover { background: var(--mint-hover); border-color: var(--mint-hover); }
.button-outline { border-color: var(--line); background: var(--control); color: var(--text); }
.button-outline:hover { background: #ffffff12; border-color: #e6fff1a0; }
.button-quiet { color: var(--mint); border: 0; }
.button-quiet:hover { background: #8bf2cf0a; color: #c6ffec; }
.full-width { width: 100%; }
.text-button { border: none; background: none; padding: 4px 0; font-size: 12px; color: var(--mint); text-decoration: underline; text-underline-offset: 3px; }
#home { position: fixed; inset: 0; z-index: 2; overflow-y: auto; padding: 112px 32px 28px; display: flex; align-items: center; flex-direction: column; justify-content: center; scrollbar-width: thin; scrollbar-color: #5a7a6b transparent; }
.lobby-shell { flex: none; display: grid; grid-template-columns: .98fr 1.02fr; gap: 34px; width: min(1180px, 100%); padding: 32px 34px; border: 1px solid #d0f4e8c2; border-radius: 22px; background: linear-gradient(110deg, #05241de6, #08221cdd 65%, #031e19e6); box-shadow: 0 24px 100px #0005, inset 0 1px 1px #ffffff0d; backdrop-filter: blur(18px); }
.lobby-play { padding-right: 30px; border-right: 1px solid var(--line); display: flex; flex-direction: column; min-width: 0; }
.game-intro { margin: 1px 0 28px; }
.game-intro h1 { font-size: clamp(52px, 5.3vw, 78px); font-weight: 800; line-height: .95; letter-spacing: -3px; margin: 0 0 8px; }
.game-intro p { font-size: clamp(16px, 1.65vw, 24px); font-weight: 500; color: var(--muted); line-height: 1.3; letter-spacing: -.5px; margin: 0; white-space: nowrap; }
.label-caps { display: block; font-size: 13px; font-weight: 700; text-transform: uppercase; margin-bottom: 8px; letter-spacing: .4px; }
input:not([type=range]):not([type=checkbox]), select { color: var(--text); border: 1px solid #cde4d785; background: var(--control); border-radius: 8px; min-height: 38px; padding: 7px 12px; max-width: 100%; }
input::placeholder { color: #acbfb6; opacity: 1; }
select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='15' height='15' viewBox='0 0 20 20'%3E%3Cpath d='m4 7 6 6 6-6' fill='none' stroke='%23edf5ef' stroke-width='1.7'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 11px center; padding-right: 34px; font-size: 14px; }
select option { background: #102b23; color: var(--text); }
#nick { min-height: 52px; width: 100%; font-size: 22px; padding: 10px 16px; }
.mode-list { display: flex; gap: 7px; margin: 22px 0; }
.mode { flex: 1; min-width: 0; background: var(--control); border: 1px solid #cde4d778; border-radius: 8px; padding: 10px 7px; min-height: 43px; font-size: 13px; font-weight: 500; transition: background .15s, color .15s; }
.mode[data-mode=experimental] { flex: 1.65; }
.mode:hover { background: #ffffff15; }
.mode.active, .mode[aria-pressed=true] { background: var(--mint); border-color: var(--mint); color: #021d13; font-weight: 700; }
.play-button { width: 100%; min-height: 64px; justify-content: space-between; padding: 12px 22px; font-size: 27px; font-weight: 700; border-radius: 9px; }
.play-button span { flex: 1; text-align: center; margin-left: 30px; }
.play-button svg { width: 32px; height: 32px; flex: none; stroke: currentColor; stroke-width: 2.5; stroke-linecap: round; stroke-linejoin: round; }
.resume-button { margin-top: 7px; }
.spectate-button { width: 100%; min-height: 46px; font-size: 18px; margin: 4px 0 15px; }
.party-block { border-top: 1px solid #cce6d98c; padding-top: 18px; }
.party-block h2 { margin: 0 0 13px; font-size: 24px; font-weight: 700; letter-spacing: -.5px; }
#party-code { width: 100%; font-size: 16px; height: 41px; text-transform: uppercase; }
#party-code::placeholder { text-transform: none; }
.party-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 12px; }
.party-actions .button { min-height: 40px; }
.party-sharing { display: flex; gap: 20px; }
#party-status { color: var(--muted); display: block; font-size: 11px; line-height: 1.4; margin-top: 5px; overflow-wrap: anywhere; }
#party-status:empty { margin: 0; }
.keyboard-strip { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: auto -10px -8px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 9px; font-size: 11px; line-height: 1; white-space: nowrap; min-height: 40px; }
.keyboard-strip > span { display: flex; align-items: center; gap: 6px; }
.keyboard-strip > span + span { border-left: 1px solid var(--line); padding-left: 10px; }
.keyboard-strip .mouse-control { gap: 4px; }
.mouse-control svg { width: 16px; height: 23px; stroke: var(--text); stroke-width: 1.3; }
kbd { display: inline-grid; place-items: center; font: inherit; font-size: .95em; min-width: 23px; min-height: 24px; padding: 2px 5px; border: 1px solid #e1f4e5ad; border-radius: 5px; color: #fff; background: #031b154a; box-shadow: 0 2px 0 #0003; }
.lobby-settings { min-width: 0; }
.settings-tabs { display: grid; grid-template-columns: 1fr 1.15fr 1fr; min-height: 44px; border: 1px solid #a6c6b985; background: #fff3; border-radius: 9px; overflow: hidden; }
.settings-tabs button { border: none; background: #06221bdd; padding: 9px 8px; font-weight: 600; font-size: 16px; }
.settings-tabs button + button { border-left: 1px solid var(--line); }
.settings-tabs button.active, .settings-tabs button[aria-selected=true] { color: #032116; background: var(--mint); border-color: var(--mint); }
.settings-tabs button:hover:not(.active) { background: #193a2f; }
.settings-content h2 { margin: 22px 0 21px; font-size: clamp(21px, 2vw, 29px); letter-spacing: -.8px; line-height: 1.2; font-weight: 700; }
.setting-row { min-height: 55px; border-bottom: 1px solid var(--line-soft); display: flex; align-items: center; gap: 12px; padding: 9px 0; font-size: 15px; }
.setting-row > label, .difficulty-row > span { flex: 0 0 126px; font-weight: 600; }
.range-row input[type=range] { flex: 1; min-width: 30px; }
.setting-row output, .number-field { flex: 0 0 53px; max-width: 53px !important; min-width: 53px; text-align: center; font-size: 15px; font-weight: 600; }
.setting-row output { border: 1px solid #cde4d785; border-radius: 8px; background: var(--control); min-height: 34px; padding: 7px 4px; }
.number-field { appearance: textfield; padding: 5px 3px !important; min-height: 34px !important; }
.number-field::-webkit-inner-spin-button, .number-field::-webkit-outer-spin-button { appearance: none; margin: 0; }
input[type=range] { appearance: none; -webkit-appearance: none; width: 100%; height: 24px; margin: 0; background: transparent; cursor: pointer; accent-color: var(--mint); }
input[type=range]::-webkit-slider-runnable-track { height: 7px; border-radius: 8px; background: linear-gradient(to right, var(--mint) 0%, var(--mint) var(--range-progress, 45%), #456359 var(--range-progress, 45%), #456359 100%); }
input[type=range]::-webkit-slider-thumb { appearance: none; -webkit-appearance: none; border: 1px solid #e6fff6; width: 18px; height: 18px; border-radius: 50%; margin-top: -5.5px; background: #aaffdf; box-shadow: 0 0 0 3px #7ce5bb16; }
input[type=range]::-moz-range-track { height: 7px; border-radius: 8px; background: #456359; }
input[type=range]::-moz-range-progress { height: 7px; border-radius: 8px; background: var(--mint); }
input[type=range]::-moz-range-thumb { border: 1px solid #e6fff6; width: 18px; height: 18px; border-radius: 50%; background: #aaffdf; }
.segmented { display: flex; flex: 1; min-width: 0; border: 1px solid #cde4d785; border-radius: 7px; overflow: hidden; min-height: 34px; }
.segmented button { flex: 1; min-width: 0; background: var(--control); border: 0; padding: 6px 7px; font-size: 13px; }
.segmented button + button { border-left: 1px solid var(--line); }
.segmented button.active, .segmented button[aria-pressed=true] { background: var(--mint); color: #031e15; font-weight: 700; }
.select-row select { flex: 1; min-width: 0; }
.twin-row { gap: 24px; padding: 10px 0; }
.twin-row > div { flex: 1; min-width: 0; }
.twin-row > div + div { position: relative; }
.twin-row > div + div::before { content: ""; position: absolute; top: 2px; bottom: 0; left: -12px; border-left: 1px solid var(--line-soft); }
.twin-row label { display: block; font-weight: 600; margin-bottom: 6px; }
.twin-row select { width: 100%; }
.teamwork-row { border-bottom: 0; }
.advanced-tactics { margin-top: 14px; }
.advanced-tactics summary { list-style: none; border: 1px solid #cde4d785; background: var(--control); border-radius: 8px; min-height: 42px; display: flex; align-items: center; justify-content: space-between; gap: 15px; font-size: 17px; font-weight: 600; padding: 9px 14px; cursor: pointer; }
.advanced-tactics summary::-webkit-details-marker { display: none; }
.advanced-tactics summary svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.7; transition: transform .15s; }
.advanced-tactics[open] summary svg { transform: rotate(180deg); }
.advanced-content { padding: 3px 0 12px; }
.advanced-content .range-row { font-size: 14px; }
.setting-label { margin: 14px 0 8px; color: var(--muted); font-size: 12px; }
.preset-list { display: grid; grid-template-columns: repeat(4,1fr); gap: 5px; }
.preset-list button { border: 1px solid var(--line); border-radius: 6px; min-height: 32px; font-size: 11px; background: var(--control); padding: 6px 5px; }
.preset-list button:hover, .preset-list button.active { background: #8bf2cf21; border-color: var(--mint); }
.settings-help { color: var(--muted); font-size: 13px; font-style: italic; line-height: 1.45; margin: 18px 0 0; }
.field-note { color: var(--muted); font-size: 12px; line-height: 1.5; margin: 6px 0 12px; }
.check-row { display: flex; align-items: center; gap: 11px; min-height: 44px; font-size: 14px; border-bottom: 1px solid var(--line-soft); padding: 8px 0; cursor: pointer; }
.check-row input { appearance: none; -webkit-appearance: none; flex: 0 0 18px; width: 18px; height: 18px; border: 1px solid #aec9ba9c; border-radius: 4px; background: var(--control); margin: 0; cursor: pointer; }
.check-row input:checked { border-color: var(--mint); background-color: var(--mint); background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' viewBox='0 0 18 18'%3E%3Cpath d='m4 9 3 3 7-7' fill='none' stroke='%23071e15' stroke-width='2'/%3E%3C/svg%3E"); }
.visual-checks { margin: 5px 0 16px; }
#skins-button { justify-content: space-between; }
#lobby-footer { flex: none; padding-top: 18px; color: #b8cfc580; font-size: 11px; text-align: center; line-height: 1.6; }
#lobby-footer > span:first-child { margin: 0 7px; }
#hud { position: fixed; inset: 0; z-index: 2; pointer-events: none; }
#hud button { pointer-events: auto; }
body:has(#hud:not([hidden])) #brand-header { left: 70px; right: auto; top: 18px; }
body:has(#hud:not([hidden])) .brand { font-size: 24px; gap: 10px; }
body:has(#hud:not([hidden])) .brand-mark { width: 40px; height: 28px; }
body:has(#hud:not([hidden])) .brand-mark i { width: 25px; height: 25px; border-width: 2.5px; }
body:has(#hud:not([hidden])) .header-actions { display: none; }
.hud-top-actions { position: absolute; left: 18px; top: 14px; display: flex; align-items: center; gap: 212px; }
.icon-button { width: 34px; height: 34px; padding: 5px; border: 1px solid var(--line); border-radius: 8px; background: #042119a8; display: grid; place-items: center; }
.icon-button svg { width: 23px; height: 23px; stroke: #e9f8ef; stroke-width: 1.8; stroke-linejoin: round; stroke-linecap: round; }
#settings-button { border-color: transparent; background: transparent; }
#network-stats { position: absolute; top: 55px; left: 24px; color: #eaf5ed; font-size: 12px; white-space: nowrap; }
#network-stats::before { content: ""; display: inline-block; width: 7px; height: 7px; margin-right: 9px; background: var(--mint); border-radius: 50%; }
#room-hud { position: absolute; top: 13px; left: 50%; transform: translateX(-50%); color: #e2efe5; background: #041d17cf; border: 1px solid var(--line); border-radius: 9px; padding: 7px 14px; font-size: 13px; font-weight: 600; text-align: center; max-width: 32%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#zone-hud { position: absolute; top: 55px; left: 50%; transform: translateX(-50%); background: #4c301ed6; color: #ffccb6; border: 1px solid #efb79366; padding: 6px 12px; border-radius: 8px; font-size: 12px; text-align: center; }
#leaderboard { position: absolute; right: 18px; top: 12px; width: 211px; border: 1px solid #c2e1d1a1; background: #021b15bf; border-radius: 13px; padding: 10px 12px; color: #f0f6f1; box-shadow: 0 8px 24px #0002; }
#leaderboard h2 { font-size: 20px; margin: 0 0 5px; padding-bottom: 5px; font-weight: 700; border-bottom: 1px solid var(--line-soft); }
#leaderboard ol { list-style: none; margin: 0 -6px; padding: 0; counter-reset: player; font-size: 12px; line-height: 1.45; }
#leaderboard li { counter-increment: player; display: flex; align-items: center; gap: 10px; padding: 2px 6px; min-height: 23px; border-radius: 5px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
#leaderboard li::before { content: counter(player); flex: 0 0 12px; text-align: center; }
#leaderboard li.me { color: #052216; background: var(--mint); font-weight: 700; }
#leaderboard li span:first-child { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
#leaderboard li span:last-child { font-variant-numeric: tabular-nums; }
#teams-chart { display: block; margin: 10px auto 3px; }
.hud-bottom-left { position: absolute; left: 18px; bottom: 21px; max-width: 225px; }
#score { display: inline-flex; align-items: baseline; gap: 12px; background: #042019c7; border: 1px solid #b9d7c59c; border-radius: 11px; padding: 9px 12px; }
#score small { text-transform: uppercase; font-size: 12px; font-weight: 600; }
#score span { font-size: 20px; font-weight: 700; font-variant-numeric: tabular-nums; }
#squad-list { margin-top: 5px; border: 1px solid #b9d7c59c; background: #042019c7; border-radius: 11px; overflow: hidden; font-size: 12px; }
#squad-list:empty { display: none; }
#squad-list > * { display: flex; gap: 9px; align-items: center; padding: 8px 11px; border-bottom: 1px solid var(--line-soft); }
#squad-list > *:last-child { border-bottom: 0; }
#squad-list > *::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--mint); flex: none; }
#squad-list .squad-state { color: var(--muted); font-size: 11px; margin-left: auto; }
.action-dock { position: absolute; left: 50%; bottom: 11px; transform: translateX(-50%); max-width: calc(100% - 480px); }
.action-rail { display: flex; flex-wrap: nowrap; align-items: center; gap: 2px; padding: 7px; background: #031f17c9; border: 1px solid #d0e8d7b8; border-radius: 13px; backdrop-filter: blur(10px); }
.action-rail button { display: flex; align-items: center; justify-content: center; gap: 6px; background: transparent; border: none; padding: 2px 5px; white-space: nowrap; min-height: 30px; font-size: 11px; border-radius: 5px; touch-action: manipulation; }
.action-rail button:hover, .action-rail button.active { background: #8bf2cf26; }
.action-rail kbd { min-height: 25px; font-size: 12px; }
.rail-divider { height: 22px; width: 1px; background: var(--line); margin: 0 7px; flex: none; }
#merge-status { text-align: center; min-height: 12px; margin: 4px 0 0; color: #adc9ba; font-size: 10px; white-space: nowrap; }
#minimap { position: absolute; right: 18px; bottom: 21px; width: 142px; height: 142px; border: 1px solid #c2e1d1b2; border-radius: 12px; background: #03221bcc; overflow: hidden; }
#minimap canvas { display: block; width: 140px; height: 140px; }
.dialog { position: fixed; top: 50%; left: 50%; z-index: 5; transform: translate(-50%,-50%); width: 400px; max-width: calc(100% - 28px); max-height: calc(100% - 36px); overflow-y: auto; padding: 28px; border: 1px solid #caedddba; border-radius: 18px; background: #06251ff2; box-shadow: 0 24px 100px #0007; backdrop-filter: blur(20px); }
.dialog h2 { font-size: 25px; line-height: 1.1; letter-spacing: -.5px; margin: 0 0 14px; }
.dialog p { color: var(--muted); font-size: 13px; line-height: 1.55; }
.dialog .dialog-subtitle { margin: -5px 0 15px; }
.close-button { position: absolute; top: 8px; right: 10px; width: 28px; height: 28px; border: 0; background: transparent; font-size: 25px; color: var(--muted); }
.results-graph svg { display: block; width: 100%; height: 65px; }
.results-graph path { fill: none; stroke: var(--mint); stroke-width: 2; }
.results-graph { border-bottom: 1px solid var(--line-soft); margin-bottom: 21px; }
.results-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px 10px; margin-bottom: 27px; text-align: center; }
.results-grid strong { display: block; font-size: 27px; font-weight: 600; margin-bottom: 4px; }
.results-grid span { font-size: 11px; color: var(--muted); }
.help-dialog { width: 490px; }
.help-controls { font-size: 12px; margin: 20px 0; }
.help-controls > div { display: flex; align-items: center; gap: 14px; padding: 7px 0; border-bottom: 1px solid var(--line-soft); }
.help-controls dt { width: 85px; flex: none; }
.help-controls dd { margin: 0; color: var(--muted); }
#skin-grid { display: grid; grid-template-columns: repeat(4,1fr); gap: 12px; margin: 24px 0; }
.skin-option { width: 60px; height: 60px; border: 1px solid var(--line); background: #ffffff08; border-radius: 50%; color: var(--text); font-size: 30px; display: grid; place-items: center; }
.skin-option.selected { border: 2px solid var(--mint); box-shadow: 0 0 20px #8bf2cf22; background: #8bf2cf14; }
#touch-controls { position: fixed; right: 18px; bottom: 38px; display: flex; gap: 10px; z-index: 3; }
#touch-controls button { width: 62px; height: 62px; border: 1px solid #c3ecd7bd; border-radius: 50%; background: #073125a6; color: var(--mint); font-size: 24px; touch-action: none; backdrop-filter: blur(8px); }
#touch-controls button:active { background: #20674eaa; }
#touch-controls svg { width: 36px; fill: none; stroke: var(--mint); stroke-width: 2; }
#toast { position: fixed; left: 50%; bottom: 86px; transform: translateX(-50%); z-index: 8; padding: 12px 18px; max-width: min(520px,calc(100% - 24px)); color: #dff7e9; background: #062e24ed; border: 1px solid #9de8c38c; border-radius: 9px; box-shadow: 0 5px 30px #0005; text-align: center; font-size: 13px; line-height: 1.4; }
@media (max-height: 850px) and (min-width: 961px) {
  #brand-header { top: 16px; }
  #home { padding-top: 86px; padding-bottom: 14px; }
  .lobby-shell { width: min(1060px,100%); padding: 24px 28px; gap: 28px; }
  .lobby-play { padding-right: 25px; }
  .game-intro { margin-bottom: 21px; }
  .game-intro h1 { font-size: 64px; }
  .game-intro p { font-size: 18px; }
  .label-caps { font-size: 11px; margin-bottom: 7px; }
  #nick { min-height: 43px; font-size: 19px; }
  .mode-list { margin: 17px 0; gap: 6px; }
  .mode { min-height: 36px; padding: 8px 5px; font-size: 11px; }
  .play-button { min-height: 52px; font-size: 24px; }
  .play-button svg { width: 25px; height: 25px; }
  .spectate-button { min-height: 37px; font-size: 16px; margin-bottom: 11px; }
  .party-block { padding-top: 14px; }
  .party-block h2 { font-size: 21px; margin-bottom: 10px; }
  .party-actions { margin-top: 9px; gap: 10px; }
  .party-actions .button { min-height: 36px; padding: 8px 10px; font-size: 13px; }
  #party-code { height: 36px; min-height: 36px; font-size: 14px; }
  .keyboard-strip { min-height: 35px; margin-top: 19px; padding: 7px 10px; font-size: 9px; gap: 5px; }
  .keyboard-strip > span + span { padding-left: 7px; }
  .keyboard-strip kbd { min-height: 21px; min-width: 21px; }
  .settings-tabs { min-height: 38px; }
  .settings-tabs button { padding: 7px 8px; font-size: 14px; }
  .settings-content h2 { margin: 19px 0 13px; font-size: 24px; }
  .setting-row { min-height: 46px; padding: 6px 0; font-size: 13px; gap: 10px; }
  .setting-row > label, .difficulty-row > span { flex-basis: 111px; }
  .setting-row select { min-height: 33px; font-size: 12px; }
  .setting-row output, .number-field { flex-basis: 47px; min-width: 47px; max-width: 47px !important; font-size: 13px; min-height: 30px; padding: 6px 3px; }
  .segmented { min-height: 31px; }
  .segmented button { padding: 5px 6px; font-size: 12px; }
  .twin-row { padding: 9px 0; }
  .twin-row label { margin-bottom: 5px; }
  .advanced-tactics { margin-top: 9px; }
  .advanced-tactics summary { min-height: 37px; padding: 8px 12px; font-size: 15px; }
  .settings-help { font-size: 12px; margin-top: 14px; }
  #lobby-footer { padding-top: 12px; font-size: 10px; }
}
@media (max-width: 1250px) {
  .action-dock { max-width: calc(100% - 380px); }
  .action-rail { gap: 0; padding: 6px; }
  .action-rail button { font-size: 10px; padding: 2px 4px; gap: 4px; }
  .action-rail button[data-action=double] span, .action-rail button[data-action=triple] span { display: none; }
  .rail-divider { margin: 0 4px; }
}
@media (max-width: 960px) {
  #brand-header { left: 22px; right: 22px; top: 18px; }
  .brand { font-size: 27px; gap: 10px; }
  .brand-mark { width: 47px; height: 33px; }
  .brand-mark i { width: 30px; height: 30px; border-width: 2.5px; }
  .header-actions { gap: 18px; }
  .connection { font-size: 12px; }
  .header-actions .button { min-height: 37px; padding: 8px 13px; font-size: 12px; }
  #home { justify-content: flex-start; padding: 94px 24px 20px; }
  .lobby-shell { grid-template-columns: 1fr; width: min(600px,100%); gap: 28px; padding: 28px; }
  .lobby-play { padding-right: 0; border-right: 0; }
  .game-intro { text-align: center; margin-bottom: 25px; }
  .game-intro h1 { font-size: 64px; }
  .game-intro p { font-size: 19px; }
  .mode-list { margin: 18px 0; }
  .party-block { margin-top: 2px; }
  .keyboard-strip { margin: 22px 0 0; }
  .lobby-settings { border-top: 1px solid var(--line); padding-top: 27px; }
  .settings-content h2 { font-size: 27px; margin-top: 24px; }
  .setting-row { min-height: 56px; }
  .setting-row > label, .difficulty-row > span { flex-basis: 127px; }
  .action-dock { max-width: calc(100% - 30px); bottom: 10px; }
  .action-rail { padding: 6px 8px; gap: 4px; }
  .action-rail button { padding: 2px 5px; font-size: 10px; }
  .action-rail button[data-action=double] span, .action-rail button[data-action=triple] span { display: inline; }
  .action-rail button[data-command] span { display: none; }
  .hud-bottom-left { bottom: 86px; left: 14px; }
  #minimap { bottom: 87px; right: 14px; width: 102px; height: 102px; }
  #minimap canvas { width: 100px; height: 100px; }
  #leaderboard { width: 165px; font-size: 11px; right: 14px; }
  #leaderboard h2 { font-size: 17px; }
  #leaderboard li { min-height: 20px; font-size: 11px; }
  #room-hud { max-width: 35%; top: 85px; }
  .hud-top-actions { gap: 186px; }
  body:has(#hud:not([hidden])) #brand-header { left: 63px; }
  body:has(#hud:not([hidden])) .brand { font-size: 21px; }
  #score { padding: 7px 10px; }
  #score span { font-size: 18px; }
}
@media (max-width: 540px) {
  #brand-header { top: 18px; left: 18px; right: 18px; }
  .brand { font-size: 22px; gap: 8px; }
  .brand-mark { width: 40px; height: 28px; }
  .brand-mark i { width: 25px; height: 25px; border-width: 2.2px; }
  .header-actions { gap: 0; }
  .header-actions .connection { display: none; }
  .header-actions .button { border-color: #b3d1c387; padding: 7px 10px; min-height: 33px; font-size: 10px; border-radius: 7px; }
  #home { padding: 78px 13px 18px; }
  .lobby-shell { padding: 22px 18px 24px; gap: 24px; border-radius: 17px; }
  .game-intro { margin-bottom: 23px; }
  .game-intro h1 { font-size: 54px; letter-spacing: -2px; }
  .game-intro p { font-size: 14px; letter-spacing: -.3px; }
  .label-caps { font-size: 10px; }
  #nick { min-height: 45px; font-size: 18px; padding: 10px 12px; }
  .mode-list { margin: 17px 0; gap: 4px; }
  .mode { font-size: 10px; min-height: 36px; padding: 8px 4px; border-radius: 6px; }
  .mode[data-mode=experimental] { flex: 1.7; }
  .play-button { min-height: 52px; font-size: 23px; padding: 10px 17px; }
  .play-button svg { width: 25px; height: 25px; }
  .spectate-button { font-size: 16px; min-height: 40px; margin-bottom: 13px; }
  .party-block { padding-top: 17px; }
  .party-block h2 { font-size: 20px; }
  #party-code { font-size: 13px; height: 39px; }
  .party-actions { gap: 8px; margin-top: 10px; }
  .party-actions .button { min-height: 39px; padding: 8px 10px; font-size: 12px; }
  .keyboard-strip { margin-top: 20px; padding: 9px 6px; gap: 4px; font-size: 9px; }
  .keyboard-strip > span { gap: 4px; }
  .keyboard-strip > span + span { padding-left: 5px; }
  .keyboard-strip .mouse-control > span { display: none; }
  .keyboard-strip kbd { min-width: 19px; min-height: 20px; padding: 2px 3px; }
  .mouse-control svg { width: 13px; height: 19px; }
  .lobby-settings { padding-top: 24px; }
  .settings-tabs { min-height: 41px; }
  .settings-tabs button { font-size: 13px; padding: 10px 5px; }
  .settings-content h2 { font-size: 22px; margin: 21px 0 16px; letter-spacing: -.7px; }
  .setting-row { font-size: 12px; gap: 8px; min-height: 50px; }
  .setting-row > label, .difficulty-row > span { flex-basis: 93px; }
  .setting-row output, .number-field { flex-basis: 43px; min-width: 43px; max-width: 43px !important; font-size: 12px; padding: 7px 2px; min-height: 30px; }
  .setting-row select { font-size: 12px; min-height: 34px; padding-left: 8px; padding-right: 28px; background-position: right 7px center; }
  .segmented button { font-size: 10px; padding: 7px 3px; }
  .segmented { min-height: 33px; }
  .twin-row { gap: 18px; padding: 10px 0; }
  .twin-row > div + div::before { left: -9px; }
  .twin-row label { margin-bottom: 7px; }
  .advanced-tactics { margin-top: 13px; }
  .advanced-tactics summary { min-height: 39px; font-size: 14px; padding: 9px 11px; }
  .check-row { font-size: 12px; min-height: 43px; }
  .settings-help { font-size: 12px; }
  .field-note { font-size: 11px; }
  .preset-list { grid-template-columns: 1fr 1fr; gap: 7px; }
  #lobby-footer { font-size: 9px; padding-top: 14px; }
  .hud-top-actions { left: 10px; top: 10px; gap: 144px; }
  .icon-button { width: 29px; height: 29px; border-radius: 7px; }
  .icon-button svg { width: 21px; height: 21px; }
  body:has(#hud:not([hidden])) #brand-header { left: 49px; top: 15px; }
  body:has(#hud:not([hidden])) .brand { font-size: 17px; gap: 6px; }
  body:has(#hud:not([hidden])) .brand-mark { width: 31px; height: 23px; }
  body:has(#hud:not([hidden])) .brand-mark i { width: 21px; height: 21px; border-width: 2px; }
  #network-stats { left: 15px; top: 48px; font-size: 10px; }
  #network-stats::before { width: 5px; height: 5px; margin-right: 6px; }
  #leaderboard { right: 9px; top: 10px; width: 118px; padding: 7px 8px; border-radius: 9px; }
  #leaderboard h2 { font-size: 15px; }
  #leaderboard li { font-size: 9px; min-height: 17px; padding: 1px 4px; gap: 3px; }
  #leaderboard li::before { flex-basis: 9px; }
  #teams-chart { width: 80px; height: 80px; }
  #room-hud { left: 13px; transform: none; top: 72px; max-width: 46%; font-size: 9px; padding: 5px 8px; border-radius: 6px; }
  #zone-hud { left: 13px; transform: none; top: 104px; max-width: 46%; font-size: 10px; padding: 5px 7px; }
  .hud-bottom-left { left: 10px; bottom: 96px; max-width: 170px; }
  #score { gap: 9px; padding: 7px 9px; border-radius: 8px; }
  #score small { font-size: 10px; }
  #score span { font-size: 17px; }
  #squad-list { border-radius: 8px; font-size: 10px; }
  #squad-list > * { padding: 6px 7px; gap: 6px; }
  #squad-list > *::before { width: 6px; height: 6px; }
  #squad-list .squad-state { font-size: 9px; }
  #minimap { right: 10px; bottom: 105px; width: 82px; height: 82px; border-radius: 9px; }
  #minimap canvas { width: 80px; height: 80px; }
  .action-dock { bottom: 7px; max-width: calc(100% - 18px); width: 100%; }
  .action-rail { display: grid; grid-template-columns: repeat(4,1fr); gap: 4px; padding: 6px; border-radius: 9px; }
  .action-rail button { min-height: 27px; font-size: 9px; padding: 2px 3px; gap: 4px; }
  .action-rail kbd { min-height: 22px; min-width: 19px; font-size: 10px; padding: 1px 3px; }
  .action-rail .rail-divider { display: none; }
  .action-rail button[data-command] { border-top: 1px solid var(--line-soft); padding-top: 5px; }
  .action-rail button[data-command] span { display: inline; }
  .action-rail button[data-action=double] span, .action-rail button[data-action=triple] span { display: none; }
  #merge-status { font-size: 9px; margin-top: 3px; min-height: 10px; }
  #touch-controls { right: 12px; bottom: 200px; flex-direction: column; gap: 9px; }
  #touch-controls button { width: 49px; height: 49px; font-size: 20px; }
  #touch-controls svg { width: 28px; }
  .dialog { padding: 24px; border-radius: 15px; }
  .dialog h2 { font-size: 23px; }
  #skin-grid { gap: 9px; }
  .skin-option { width: 52px; height: 52px; font-size: 27px; }
  #toast { bottom: 105px; font-size: 12px; }
}
@media (min-width: 961px) and (max-height: 650px) {
  #home { justify-content: flex-start; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; scroll-behavior: auto !important; }
}
/* Keep the complete lobby usable on common 720 px laptop viewports. */
@media (max-height: 750px) and (min-width: 961px) {
  #home { justify-content: safe center; padding-top: 78px; padding-bottom: 10px; }
  .lobby-shell { padding: 20px 25px; }
  .game-intro { margin-bottom: 12px; }
  .game-intro h1 { font-size: 52px; margin-bottom: 6px; }
  .game-intro p { font-size: 15px; }
  .label-caps { font-size: 10px; margin-bottom: 6px; }
  #nick { min-height: 36px; padding: 7px 12px; font-size: 17px; }
  .mode-list { margin: 12px 0; }
  .mode { min-height: 32px; padding: 7px 4px; }
  .play-button { min-height: 46px; font-size: 23px; }
  .spectate-button { min-height: 33px; margin: 2px 0 7px; font-size: 15px; }
  .party-block { padding-top: 10px; }
  .party-block h2 { font-size: 20px; margin-bottom: 8px; }
  #party-code { height: 32px; min-height: 32px; padding: 6px 10px; font-size: 13px; }
  .party-actions { margin-top: 7px; }
  .party-actions .button { min-height: 32px; padding: 7px 10px; }
  .keyboard-strip { margin-top: 13px; min-height: 31px; padding: 6px 9px; }
  .keyboard-strip kbd { min-height: 19px; }
  .settings-tabs { min-height: 35px; }
  .settings-tabs button { font-size: 13px; }
  .settings-content h2 { font-size: 23px; margin: 16px 0 11px; }
  .setting-row { min-height: 40px; padding: 5px 0; font-size: 12px; }
  .setting-row > label, .difficulty-row > span { flex-basis: 106px; }
  .setting-row select { min-height: 30px; padding-top: 5px; padding-bottom: 5px; }
  .setting-row output, .number-field { min-height: 28px; font-size: 12px; padding: 5px 2px; }
  .twin-row { padding: 7px 0; }
  .twin-row label { margin-bottom: 5px; }
  .segmented { min-height: 29px; }
  .segmented button { font-size: 11px; }
  .advanced-tactics { margin-top: 8px; }
  .advanced-tactics summary { min-height: 33px; font-size: 14px; padding: 7px 11px; }
  .settings-help { margin-top: 12px; font-size: 11px; }
  #lobby-footer { padding-top: 10px; }
}

/* Explicit semantic columns avoid double ranks and overflowing squad states. */
#leaderboard li::before, #squad-list > *::before { content:none; }
#leaderboard li .rank { flex:0 0 14px; text-align:center; }
#leaderboard li .player-name { flex:1; min-width:0; overflow:hidden; text-overflow:ellipsis; }
#leaderboard li .player-mass { flex:0 0 auto; }
.squad-row strong { min-width:0; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.online-dot,.offline-dot { width:7px; height:7px; border-radius:50%; background:var(--mint); flex:none; }
.offline-dot { background:#62766b; }

#home { justify-content:safe center; }
@media(max-width:360px){.hud-top-actions{gap:118px;}}
@media(pointer:coarse) and (min-width:541px) and (max-width:960px){#touch-controls{bottom:180px;}}

@media(max-width:960px){body[data-screen=lobby] #brand-header::before{content:"";position:fixed;top:0;left:0;right:0;height:76px;background:linear-gradient(#061713 72%,#06171300);z-index:-1;pointer-events:none;}}
