:root {
  color-scheme: dark;
  --bg: #05070a;
  --panel: rgba(10, 13, 18, .92);
  --panel-solid: #0b0f15;
  --raised: #141a23;
  --line: rgba(255, 255, 255, .1);
  --line-strong: rgba(255, 255, 255, .19);
  --text: #f3f1ea;
  --muted: #929ba9;
  --faint: #818b98;
  --ember: #ff6437;
  --gold: #ffb34f;
  --danger: #f23d59;
  --repair: #53d9bc;
  --blue: #55d8ff;
  --violet: #a980ff;
  --green: #b6e46b;
  font-family: system-ui, -apple-system, "Segoe UI", Arial, sans-serif;
}
* { box-sizing: border-box; }
html, body { width: 100%; height: 100%; margin: 0; overflow: hidden; background: var(--bg); color: var(--text); }
body { min-width: 320px; font-size: 16px; }
button, input, select { font: inherit; }
button { color: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }

.game-shell { position: fixed; inset: 0; overflow: hidden; isolation: isolate; background: #040609; }
#gameCanvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; }
.grain { position: absolute; inset: 0; z-index: 2; pointer-events: none; opacity: .023; mix-blend-mode: screen; background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 160 160' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.84' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.7'/%3E%3C/svg%3E"); }
.game-shell[data-screen="game"] .grain { display: none; }

.game-topbar { position: absolute; z-index: 12; top: 0; left: 0; right: 0; height: 78px; padding: 0 28px; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; border-bottom: 1px solid var(--line); background: linear-gradient(180deg, rgba(4,6,9,.9), rgba(4,6,9,.15)); backdrop-filter: blur(10px); }
.game-brand { display: inline-flex; align-items: baseline; gap: 13px; width: max-content; color: var(--text); text-decoration: none; }
.game-brand > span { color: var(--ember); font-weight: 950; letter-spacing: -.08em; }
.game-brand b { font-size: .82rem; letter-spacing: .11em; }
.game-brand em { color: var(--ember); font: 800 .6rem/1 ui-monospace, Consolas, monospace; }
.match-title { display: none; text-align: center; }
.game-shell[data-screen="game"] .match-title { display: block; }
.match-title span { display: block; color: var(--faint); font: .58rem/1 ui-monospace, Consolas, monospace; letter-spacing: .16em; }
.match-title strong { font-size: .8rem; letter-spacing: .1em; }
.top-actions { justify-self: end; display: flex; align-items: center; gap: 10px; }
.icon-button { width: 38px; height: 38px; border: 1px solid var(--line); border-radius: 8px; background: rgba(255,255,255,.025); cursor: pointer; }
.icon-button:hover { border-color: var(--line-strong); background: rgba(255,255,255,.055); }
.match-leave { display: none; min-height: 38px; padding: 0 11px; border: 1px solid rgba(242,61,89,.28); border-radius: 8px; color: #ff9ba8; background: rgba(242,61,89,.07); font: 800 .58rem/1 ui-monospace, Consolas, monospace; letter-spacing: .08em; cursor: pointer; }
.game-shell[data-screen="game"] .match-leave { display: block; }
.connection-pill { height: 38px; padding: 0 12px; display: inline-flex; align-items: center; gap: 8px; border: 1px solid var(--line); border-radius: 99px; background: rgba(8,11,15,.7); }
.connection-pill i { width: 6px; height: 6px; border-radius: 50%; background: #6c7582; }
.connection-pill b { color: var(--muted); font: 700 .61rem/1 ui-monospace, Consolas, monospace; letter-spacing: .1em; }
.connection-pill.is-online i { background: var(--repair); box-shadow: 0 0 12px var(--repair); }
.connection-pill.is-warn i { background: var(--gold); }
.connection-pill.is-offline i { background: var(--danger); }

[data-layer] { transition: opacity .3s ease, visibility .3s ease; }
.menu-layer, .setup-layer, .join-layer, .lobby-layer, .result-layer { position: absolute; z-index: 8; inset: 0; padding-top: 78px; background: rgba(4,6,9,.74); backdrop-filter: blur(4px); opacity: 0; visibility: hidden; pointer-events: none; }
.menu-layer.is-visible, .setup-layer.is-visible, .join-layer.is-visible, .lobby-layer.is-visible, .result-layer.is-visible { opacity: 1; visibility: visible; pointer-events: auto; }

.menu-layer { display: grid; grid-template-columns: minmax(430px, 690px) 1fr; align-items: center; padding-inline: max(30px, calc((100vw - 1440px) / 2)); background: linear-gradient(90deg, rgba(4,6,9,.98) 0%, rgba(4,6,9,.88) 46%, rgba(4,6,9,.2) 100%); }
.menu-rail { transform: translateY(-2%); }
.edition, .step-label { margin: 0 0 18px; color: var(--ember); font: 750 .68rem/1 ui-monospace, Consolas, monospace; letter-spacing: .16em; text-transform: uppercase; }
.menu-rail h1 { margin: 0; font-size: clamp(5rem, 9.5vw, 9.5rem); line-height: .76; letter-spacing: -.09em; font-weight: 950; }
.menu-rail h1 em { display: inline-block; margin-left: .08em; color: var(--ember); font: 850 clamp(1.3rem, 2.5vw, 2.6rem)/1 ui-monospace, Consolas, monospace; transform: translateY(-1.7em); }
.lead { max-width: 610px; margin: 38px 0 0; color: #aeb5bf; font-size: clamp(1rem, 1.35vw, 1.22rem); line-height: 1.58; }
.main-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 32px; }
.action-primary, .action-secondary, .action-ghost, .create-room { min-height: 57px; padding: 0 22px; border: 1px solid var(--line); border-radius: 8px; font-size: .76rem; font-weight: 850; letter-spacing: .08em; text-transform: uppercase; cursor: pointer; transition: transform .2s, border-color .2s, background .2s; }
.action-primary, .create-room { color: #100b08; background: var(--ember); border-color: transparent; box-shadow: 0 18px 55px rgba(255,100,55,.18); }
.action-primary { min-width: 210px; display: inline-flex; align-items: center; justify-content: space-between; gap: 24px; }
.action-primary span, .create-room span { font-size: 1.15rem; }
.action-secondary { background: rgba(255,255,255,.035); }
.action-ghost { color: var(--muted); background: transparent; border-color: transparent; }
.action-primary:hover, .action-secondary:hover, .action-ghost:hover, .create-room:hover { transform: translateY(-2px); }
.action-secondary:hover, .action-ghost:hover { border-color: var(--line-strong); background: rgba(255,255,255,.06); }
.action-primary:disabled, .create-room:disabled { opacity: .38; box-shadow: none; cursor: not-allowed; transform: none; }
.quick-facts { display: flex; flex-wrap: wrap; gap: 0; margin-top: 38px; color: var(--faint); font: .62rem/1.4 ui-monospace, Consolas, monospace; letter-spacing: .08em; text-transform: uppercase; }
.quick-facts span { padding: 0 14px; border-left: 1px solid var(--line); }
.quick-facts span:first-child { padding-left: 0; border-left: 0; }
.menu-mode-preview { align-self: end; justify-self: end; width: min(340px, 28vw); margin: 0 22px 115px 0; padding: 22px; border: 1px solid var(--line); border-radius: 16px; background: rgba(10,13,18,.6); backdrop-filter: blur(16px); }
.preview-label { display: flex; justify-content: space-between; align-items: center; }
.preview-label span { color: var(--faint); font: .58rem/1 ui-monospace, Consolas, monospace; letter-spacing: .12em; }
.preview-label b { color: var(--ember); font-size: .72rem; letter-spacing: .08em; }
.preview-squad { height: 90px; display: flex; align-items: center; justify-content: center; gap: 18px; }
.fighter { position: relative; width: 27px; height: 27px; display: block; border-radius: 50%; background: var(--blue); box-shadow: 0 0 25px rgba(85,216,255,.45); }
.fighter::after { content: ""; position: absolute; left: 50%; top: -8px; width: 0; height: 0; border-left: 5px solid transparent; border-right: 5px solid transparent; border-bottom: 7px solid #fff; transform: translateX(-50%); }
.fighter.second { background: var(--green); box-shadow: 0 0 25px rgba(182,228,107,.4); }
.fighter.bot { background: #6aaee8; border-radius: 5px; transform: rotate(45deg); }
.fighter.bot::after { border: 0; width: 7px; height: 7px; top: 10px; background: #dceeff; transform: translateX(-50%) rotate(-45deg); }
.mob-mark { width: 25px; height: 25px; background: #9c2639; clip-path: polygon(50% 0, 92% 24%, 82% 78%, 50% 100%, 12% 77%, 5% 27%); filter: drop-shadow(0 0 12px rgba(242,61,89,.55)); }
.menu-mode-preview p { margin: 0; color: var(--muted); font-size: .84rem; line-height: 1.5; }
.menu-footer { position: absolute; left: max(30px, calc((100vw - 1440px) / 2)); right: max(30px, calc((100vw - 1440px) / 2)); bottom: 28px; display: flex; gap: 28px; color: var(--faint); font: .58rem/1 ui-monospace, Consolas, monospace; letter-spacing: .08em; text-transform: uppercase; }

.back-button { position: absolute; top: 105px; left: max(26px, calc((100vw - 1380px) / 2)); border: 0; color: var(--muted); background: transparent; font-size: .75rem; font-weight: 750; letter-spacing: .08em; text-transform: uppercase; cursor: pointer; }
.back-button:hover { color: var(--text); }
.setup-layer { display: grid; grid-template-columns: minmax(360px, .82fr) minmax(480px, 1.18fr); gap: clamp(50px, 7vw, 130px); align-items: center; padding-inline: max(28px, calc((100vw - 1380px) / 2)); background: rgba(5,7,10,.96); overflow: auto; }
.setup-copy, .setup-options { padding-block: 90px 34px; }
.setup-copy h2, .join-card h2, .lobby-card h2, .result-card h2 { margin: 0 0 30px; font-size: clamp(2.6rem, 4.8vw, 5.2rem); line-height: .9; letter-spacing: -.065em; }
.mode-list { display: grid; gap: 8px; }
.mode-card { min-height: 76px; padding: 13px 16px; display: grid; grid-template-columns: 34px 1fr auto; align-items: center; gap: 14px; text-align: left; border: 1px solid var(--line); border-radius: 10px; background: rgba(255,255,255,.018); cursor: pointer; transition: border-color .2s, background .2s, transform .2s; }
.mode-card:hover { transform: translateX(3px); border-color: var(--line-strong); }
.mode-card.is-active { border-color: rgba(255,100,55,.56); background: linear-gradient(90deg, rgba(255,100,55,.12), rgba(255,100,55,.025)); }
.mode-index { color: var(--faint); font: .65rem/1 ui-monospace, Consolas, monospace; }
.mode-card.is-active .mode-index { color: var(--ember); }
.mode-card b { display: block; font-size: .95rem; letter-spacing: .02em; }
.mode-card small { display: block; margin-top: 3px; color: var(--muted); font-size: .73rem; }
.mode-card em { color: var(--faint); font: 700 .66rem/1 ui-monospace, Consolas, monospace; }
.option-head { display: flex; align-items: center; justify-content: space-between; }
.option-head > span { color: var(--faint); font: .59rem/1 ui-monospace, Consolas, monospace; letter-spacing: .1em; }
.arena-preview { position: relative; height: 210px; overflow: hidden; border: 1px solid var(--line); border-radius: 16px; background: radial-gradient(circle at 50% 55%, rgba(255,100,55,.1), transparent 45%), #070a0e; }
.preview-grid { position: absolute; left: 50%; top: 52%; width: 58%; aspect-ratio: 1.65; transform: translate(-50%, -50%) perspective(600px) rotateX(55deg) rotateZ(-13deg); background: repeating-linear-gradient(0deg, transparent 0 34px, rgba(255,255,255,.08) 35px 36px), repeating-linear-gradient(90deg, transparent 0 34px, rgba(255,255,255,.08) 35px 36px), #121821; border: 1px solid var(--line-strong); box-shadow: 0 28px 80px rgba(255,100,55,.13); }
.slot { position: absolute; display: flex; flex-direction: column; align-items: center; gap: 7px; color: var(--muted); font: .55rem/1 ui-monospace, Consolas, monospace; letter-spacing: .06em; }
.slot i { width: 17px; height: 17px; border-radius: 50%; background: var(--blue); box-shadow: 0 0 15px rgba(85,216,255,.65); }
.slot-one { left: 34%; top: 43%; }
.slot-two { left: 46%; top: 61%; }
.slot-two i { background: var(--green); box-shadow: 0 0 15px rgba(182,228,107,.55); }
.slot-three { left: 57%; top: 36%; }
.slot-three i { border-radius: 4px; background: #6aaee8; transform: rotate(45deg); }
.slot-four { left: 68%; top: 55%; color: #cf6878; }
.slot-four i { border-radius: 0; background: #9c2639; clip-path: polygon(50% 0, 92% 24%, 82% 78%, 50% 100%, 12% 77%, 5% 27%); box-shadow: none; filter: drop-shadow(0 0 10px rgba(242,61,89,.65)); }
.field-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 13px; }
.text-field, .select-field { min-height: 69px; padding: 10px 14px 8px; display: flex; flex-direction: column; justify-content: center; border: 1px solid var(--line); border-radius: 9px; background: rgba(255,255,255,.02); }
.text-field span, .select-field span { color: var(--faint); font-size: .63rem; letter-spacing: .08em; text-transform: uppercase; }
.text-field input, .select-field select, .choice-row select { width: 100%; margin-top: 3px; padding: 0; border: 0; outline: 0; color: var(--text); background: transparent; font-weight: 750; }
.select-field select option, .choice-row select option { background: var(--raised); }
.text-field:focus-within, .select-field:focus-within { border-color: rgba(255,100,55,.5); }
.counter-row, .choice-row { min-height: 72px; margin-top: 12px; padding: 11px 14px; display: flex; align-items: center; justify-content: space-between; border: 1px solid var(--line); border-radius: 9px; background: rgba(255,255,255,.02); }
.counter-row b, .choice-row b { display: block; font-size: .82rem; }
.counter-row small, .choice-row small { display: block; color: var(--faint); font-size: .69rem; }
.counter { display: flex; align-items: center; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.counter button { width: 38px; height: 38px; border: 0; background: rgba(255,255,255,.035); cursor: pointer; }
.counter output { width: 42px; text-align: center; font: 750 .8rem/1 ui-monospace, Consolas, monospace; }
.choice-row select { width: auto; min-width: 170px; text-align: right; }
.create-room { width: 100%; margin-top: 15px; display: flex; align-items: center; justify-content: space-between; }
.form-error { min-height: 20px; margin: 8px 3px 0; color: #ff8293; font-size: .72rem; }

.join-layer { display: grid; place-items: center; background: rgba(5,7,10,.96); }
.join-card { width: min(500px, calc(100% - 36px)); padding: 34px; border: 1px solid var(--line); border-radius: 18px; background: var(--panel-solid); box-shadow: 0 30px 100px rgba(0,0,0,.45); }
.join-card h2 { font-size: clamp(2.6rem, 5vw, 4.4rem); margin-bottom: 18px; }
.join-card > p:not(.step-label):not(.form-error) { margin: 0 0 24px; color: var(--muted); }
.join-card .text-field { margin-top: 10px; }
.room-code-field input { color: var(--gold); font: 850 1.25rem/1.4 ui-monospace, Consolas, monospace; letter-spacing: .22em; text-transform: uppercase; }

.lobby-layer { display: grid; grid-template-columns: minmax(440px, 680px) minmax(280px, 400px); gap: 28px; place-content: center; padding-inline: 24px; background: rgba(5,7,10,.92); }
.lobby-card, .lobby-brief { padding: 30px; border: 1px solid var(--line); border-radius: 18px; background: var(--panel-solid); }
.lobby-heading { display: flex; justify-content: space-between; align-items: start; }
.lobby-card h2 { margin-bottom: 22px; font-size: clamp(2.7rem, 5vw, 4.6rem); }
.small-quiet { padding: 8px 11px; border: 1px solid var(--line); border-radius: 7px; color: var(--muted); background: transparent; cursor: pointer; }
.invite-box { min-height: 82px; padding: 13px 14px; display: flex; align-items: center; justify-content: space-between; border: 1px solid rgba(255,179,79,.25); border-radius: 10px; background: rgba(255,179,79,.045); }
.invite-box span { display: block; color: var(--faint); font-size: .62rem; text-transform: uppercase; letter-spacing: .08em; }
.invite-box strong { color: var(--gold); font: 850 1.35rem/1.5 ui-monospace, Consolas, monospace; letter-spacing: .2em; }
.invite-box button { padding: 10px 12px; border: 1px solid var(--line); border-radius: 7px; background: rgba(255,255,255,.04); font-size: .69rem; font-weight: 750; cursor: pointer; }
.roster { display: grid; gap: 8px; margin-top: 16px; }
.roster-item { min-height: 56px; padding: 9px 12px; display: flex; align-items: center; gap: 11px; border: 1px solid var(--line); border-radius: 9px; background: rgba(255,255,255,.018); }
.roster-item i { width: 24px; height: 24px; border-radius: 50%; background: var(--player-color, var(--blue)); box-shadow: 0 0 18px color-mix(in srgb, var(--player-color, var(--blue)) 45%, transparent); }
.roster-item.is-bot i { border-radius: 5px; transform: rotate(45deg); }
.roster-item div { flex: 1; }
.roster-item b { display: block; font-size: .79rem; }
.roster-item small { color: var(--faint); font-size: .66rem; }
.roster-item em { color: var(--repair); font: 650 .6rem/1 ui-monospace, Consolas, monospace; }
.lobby-status { margin-top: 13px; color: var(--muted); font-size: .74rem; text-align: center; }
.lobby-brief { align-self: stretch; display: flex; flex-direction: column; justify-content: center; }
.lobby-brief h3 { margin: 0; font-size: 2rem; line-height: 1.05; letter-spacing: -.04em; }
.lobby-brief > p:not(.step-label) { color: var(--muted); line-height: 1.55; }
.brief-tags { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.brief-tags span { padding: 7px 9px; border: 1px solid var(--line); border-radius: 99px; color: var(--faint); font-size: .61rem; letter-spacing: .07em; text-transform: uppercase; }

.hud { position: absolute; z-index: 5; inset: 0; pointer-events: none; opacity: 0; visibility: hidden; }
.hud.is-visible { opacity: 1; visibility: visible; }
.hud button, .hud input, .hud form { pointer-events: auto; }
.team-panel { position: absolute; top: 96px; left: 24px; width: 220px; display: grid; gap: 7px; }
.team-member { height: 49px; padding: 7px 9px; display: grid; grid-template-columns: 29px 1fr auto; align-items: center; gap: 8px; border: 1px solid var(--line); border-radius: 8px; background: rgba(6,8,12,.72); backdrop-filter: blur(10px); }
.team-member .avatar { width: 23px; height: 23px; border-radius: 50%; background: var(--player-color); box-shadow: 0 0 13px color-mix(in srgb, var(--player-color) 42%, transparent); }
.team-member.is-bot .avatar { border-radius: 4px; transform: rotate(45deg); }
.team-member b { display: block; overflow: hidden; font-size: .65rem; white-space: nowrap; text-overflow: ellipsis; }
.team-member small { display: block; color: var(--faint); font-size: .55rem; }
.team-member .mini-hp { width: 34px; height: 3px; background: rgba(255,255,255,.09); }
.team-member .mini-hp i { display: block; height: 100%; background: var(--repair); }
.objective-panel { position: absolute; top: 94px; left: 50%; min-width: 240px; padding: 11px 18px; text-align: center; border: 1px solid var(--line); border-radius: 10px; background: rgba(6,8,12,.72); backdrop-filter: blur(10px); transform: translateX(-50%); }
.objective-panel span { display: block; color: var(--ember); font: 700 .58rem/1 ui-monospace, Consolas, monospace; letter-spacing: .12em; }
.objective-panel strong { display: block; margin-top: 4px; font-size: .73rem; letter-spacing: .08em; }
.timer { margin-top: 5px; color: var(--muted); font: .67rem/1 ui-monospace, Consolas, monospace; }
.event-feed { position: absolute; top: 96px; right: 24px; width: min(290px, 25vw); display: grid; gap: 5px; text-align: right; }
.feed-item { padding: 6px 9px; color: var(--muted); border-right: 2px solid var(--feed-color, var(--ember)); background: linear-gradient(90deg, transparent, rgba(6,8,12,.75)); font-size: .66rem; animation: feed-in .22s ease both; }
@keyframes feed-in { from { opacity: 0; transform: translateX(8px); } }
.player-vitals { position: absolute; left: 24px; bottom: 25px; width: 225px; }
.health-line { display: grid; grid-template-columns: 25px 1fr 32px; align-items: center; gap: 8px; font: 700 .62rem/1 ui-monospace, Consolas, monospace; }
.health-line > div { height: 7px; overflow: hidden; border-radius: 99px; background: rgba(255,255,255,.1); }
.health-line i { display: block; width: 100%; height: 100%; background: linear-gradient(90deg, var(--repair), #b3e872); transition: width .2s; }
.abilities { position: absolute; left: 50%; bottom: 19px; display: flex; gap: 7px; transform: translateX(-50%); }
.abilities button { position: relative; width: 78px; height: 66px; overflow: hidden; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; border: 1px solid var(--line); border-radius: 10px; background: rgba(6,8,12,.82); backdrop-filter: blur(10px); }
.abilities kbd { color: var(--ember); font: 800 .67rem/1 ui-monospace, Consolas, monospace; }
.abilities span { color: var(--muted); font-size: .58rem; text-transform: uppercase; }
.abilities i { position: absolute; left: 0; right: 0; bottom: 0; height: 2px; background: var(--ember); transform-origin: left; }
.abilities button.is-cooling::after { content: attr(data-cooldown); position: absolute; inset: 0; display: grid; place-items: center; color: #fff; background: rgba(3,4,6,.68); font: 850 1rem/1 ui-monospace, Consolas, monospace; }
.chat-toggle { position: absolute; right: 24px; bottom: 24px; min-height: 38px; padding: 0 12px; border: 1px solid var(--line); border-radius: 8px; color: var(--muted); background: rgba(6,8,12,.78); font-size: .62rem; font-weight: 800; letter-spacing: .1em; }
.chat-panel { position: absolute; right: 24px; bottom: 72px; width: min(330px, calc(100% - 48px)); padding: 10px; border: 1px solid var(--line); border-radius: 11px; background: rgba(6,8,12,.88); backdrop-filter: blur(14px); opacity: 0; visibility: hidden; transform: translateY(8px); transition: .2s; pointer-events: auto; }
.chat-panel.is-open { opacity: 1; visibility: visible; transform: translateY(0); }
.chat-log { max-height: 150px; min-height: 50px; overflow-y: auto; display: grid; gap: 5px; color: var(--muted); font-size: .68rem; }
.chat-log b { color: var(--text); }
.chat-panel form { display: grid; grid-template-columns: 1fr 38px; gap: 6px; margin-top: 8px; }
.chat-panel input { min-width: 0; padding: 9px 10px; border: 1px solid var(--line); border-radius: 7px; outline: 0; color: var(--text); background: rgba(255,255,255,.04); }
.chat-panel form button { border: 0; border-radius: 7px; color: #120b08; background: var(--ember); }

.mobile-controls { display: none; }
.rotate-note { display: none; }
.phase-card { position: absolute; z-index: 15; left: 50%; top: 50%; min-width: min(440px, calc(100% - 36px)); padding: 24px 30px; text-align: center; border: 1px solid rgba(255,100,55,.28); border-radius: 12px; background: rgba(6,8,12,.92); box-shadow: 0 30px 100px rgba(0,0,0,.55); opacity: 0; visibility: hidden; transform: translate(-50%, -45%) scale(.96); transition: .25s; pointer-events: none; }
.phase-card.is-visible { opacity: 1; visibility: visible; transform: translate(-50%, -50%) scale(1); }
.phase-card span { color: var(--ember); font: 750 .66rem/1 ui-monospace, Consolas, monospace; letter-spacing: .14em; }
.phase-card b { display: block; margin-top: 8px; font-size: clamp(1.4rem, 3vw, 2rem); letter-spacing: .03em; }
.phase-card small { display: block; margin-top: 6px; color: var(--muted); }
.toast { position: absolute; z-index: 20; left: 50%; bottom: 105px; padding: 9px 13px; color: var(--text); border: 1px solid var(--line); border-radius: 8px; background: rgba(6,8,12,.9); font-size: .72rem; opacity: 0; transform: translate(-50%, 8px); transition: .22s; pointer-events: none; }
.toast.is-visible { opacity: 1; transform: translate(-50%, 0); }

.result-layer { display: grid; place-items: center; background: rgba(3,4,6,.84); backdrop-filter: blur(12px); }
.result-card { width: min(650px, calc(100% - 36px)); padding: 38px; text-align: center; border: 1px solid var(--line); border-radius: 18px; background: var(--panel-solid); }

/* Во время матча Canvas меняется каждый кадр: плотные панели дешевле живого blur. */
.game-shell[data-screen="game"] .game-topbar,
.game-shell[data-screen="game"] .team-member,
.game-shell[data-screen="game"] .objective-panel,
.game-shell[data-screen="game"] .abilities button,
.game-shell[data-screen="game"] .chat-panel { backdrop-filter: none; }
.game-shell[data-screen="game"] .team-member,
.game-shell[data-screen="game"] .objective-panel { background: rgba(6,8,12,.9); }
.result-card h2 { margin-bottom: 28px; font-size: clamp(2.5rem, 6vw, 5rem); }
.result-stats { display: grid; grid-template-columns: repeat(4, 1fr); border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.result-stat { padding: 15px 8px; border-left: 1px solid var(--line); }
.result-stat:first-child { border-left: 0; }
.result-stat b { display: block; font: 850 1.4rem/1 ui-monospace, Consolas, monospace; }
.result-stat span { display: block; margin-top: 6px; color: var(--faint); font-size: .58rem; letter-spacing: .08em; text-transform: uppercase; }
.result-actions { display: flex; justify-content: center; gap: 10px; margin-top: 24px; }

@media (max-width: 900px) {
  .game-topbar { height: 62px; padding: 0 max(14px, env(safe-area-inset-right)) 0 max(14px, env(safe-area-inset-left)); grid-template-columns: 1fr auto; }
  .match-title { display: none !important; }
  .icon-button[data-fullscreen] { display: none; }
  .connection-pill { height: 33px; }
  .menu-layer, .setup-layer, .join-layer, .lobby-layer, .result-layer { padding-top: 62px; }
  .menu-layer { display: block; padding-inline: 20px; overflow-y: auto; background: linear-gradient(180deg, rgba(4,6,9,.72), rgba(4,6,9,.97) 62%); }
  .menu-rail { min-height: calc(100svh - 62px); padding: 18svh 0 120px; transform: none; }
  .menu-rail h1 { font-size: clamp(4.1rem, 20vw, 7rem); }
  .menu-rail h1 em { display: block; width: max-content; margin: 14px 0 0 2px; transform: none; }
  .lead { margin-top: 24px; }
  .main-actions { display: grid; }
  .main-actions > button { width: 100%; }
  .quick-facts { gap: 10px 15px; }
  .quick-facts span { padding: 0; border: 0; }
  .menu-mode-preview, .menu-footer { display: none; }
  .back-button { top: 78px; left: 17px; }
  .setup-layer { display: block; padding-inline: 18px; }
  .setup-copy, .setup-options { padding: 82px 0 12px; }
  .setup-options { padding-top: 34px; }
  .setup-copy h2 { font-size: 3.2rem; }
  .option-head > span { display: none; }
  .arena-preview { height: 176px; }
  .field-grid { grid-template-columns: 1fr; }
  .choice-row { align-items: flex-start; flex-direction: column; gap: 9px; }
  .choice-row select { width: 100%; text-align: left; }
  .join-layer { align-items: start; overflow-y: auto; }
  .join-card { margin-top: 78px; padding: 25px 20px; }
  .lobby-layer { display: block; padding: 90px 16px 30px; overflow-y: auto; }
  .lobby-card, .lobby-brief { padding: 20px; }
  .lobby-brief { margin-top: 12px; }
  .invite-box { align-items: stretch; flex-direction: column; gap: 8px; }
  .invite-box button { min-height: 42px; }
  .result-layer { align-items: start; overflow-y: auto; }
  .result-card { margin: 78px auto 28px; padding: 26px 18px; }
  .result-stats { grid-template-columns: repeat(2, 1fr); }
  .result-stat:nth-child(3) { border-left: 0; border-top: 1px solid var(--line); }
  .result-stat:nth-child(4) { border-top: 1px solid var(--line); }
  .result-actions { flex-direction: column; }
  .result-actions button { width: 100%; min-width: 0; }
}

@media (hover: none), (pointer: coarse) {
  .game-shell[data-screen="game"] .game-topbar { height: 52px; padding: 0 max(10px, env(safe-area-inset-right)) 0 max(10px, env(safe-area-inset-left)); }
  .game-shell[data-screen="game"] .game-brand b { display: none; }
  .game-shell[data-screen="game"] .connection-pill { height: 30px; }
  .game-shell[data-screen="game"] .connection-pill b { display: none; }
  .game-shell[data-screen="game"] .team-panel { top: 61px; left: 8px; width: 144px; gap: 4px; }
  .game-shell[data-screen="game"] .team-member { height: 35px; padding: 4px 6px; grid-template-columns: 20px 1fr; }
  .game-shell[data-screen="game"] .team-member .avatar { width: 17px; height: 17px; }
  .game-shell[data-screen="game"] .team-member .mini-hp { display: none; }
  .game-shell[data-screen="game"] .objective-panel { top: 59px; min-width: 142px; padding: 7px 10px; }
  .game-shell[data-screen="game"] .event-feed, .game-shell[data-screen="game"] .player-vitals, .game-shell[data-screen="game"] .abilities { display: none; }
  .game-shell[data-screen="game"] .chat-toggle { right: max(8px, env(safe-area-inset-right)); top: 59px; bottom: auto; min-height: 34px; }
  .mobile-controls { position: absolute; inset: 0; display: block; pointer-events: none; }
  .joystick { position: absolute; left: max(20px, env(safe-area-inset-left)); bottom: max(22px, env(safe-area-inset-bottom)); width: 116px; height: 116px; border: 1px solid rgba(255,255,255,.15); border-radius: 50%; background: rgba(7,9,13,.33); pointer-events: auto; touch-action: none; }
  .joystick::before { content: ""; position: absolute; inset: 23px; border: 1px solid rgba(255,255,255,.08); border-radius: 50%; }
  .joystick i { position: absolute; left: 50%; top: 50%; width: 46px; height: 46px; border-radius: 50%; background: rgba(255,255,255,.16); border: 1px solid rgba(255,255,255,.22); transform: translate(-50%, -50%); }
  .touch-actions { position: absolute; right: max(16px, env(safe-area-inset-right)); bottom: max(18px, env(safe-area-inset-bottom)); width: 205px; height: 154px; pointer-events: auto; }
  .touch-actions button { position: absolute; width: 54px; height: 54px; border: 1px solid rgba(255,255,255,.17); border-radius: 50%; background: rgba(7,9,13,.62); font: 800 .65rem/1 ui-monospace, Consolas, monospace; touch-action: none; }
  .touch-actions [data-touch="repair"] { left: 0; top: 18px; color: var(--repair); }
  .touch-actions [data-touch="pulse"] { left: 47px; top: 0; color: var(--violet); }
  .touch-actions .touch-main { right: 0; top: 24px; width: 72px; height: 72px; color: #170b08; background: var(--ember); border-color: transparent; }
  .touch-actions .touch-dash { right: 76px; bottom: 0; width: 64px; height: 64px; color: var(--gold); }
}

@media (orientation: portrait) and (max-width: 650px) and (hover: none) {
  .game-shell[data-screen="game"] .team-panel { top: 105px; }
  .game-shell[data-screen="game"] .rotate-note { position: absolute; z-index: 30; left: 50%; bottom: max(182px, calc(env(safe-area-inset-bottom) + 174px)); width: min(250px, calc(100% - 28px)); padding: 8px 10px; display: grid; grid-template-columns: 25px 1fr; border: 1px solid var(--line); border-radius: 9px; background: rgba(6,8,12,.86); transform: translateX(-50%); pointer-events: none; animation: rotate-hint 4.5s both; }
  .rotate-note > span { grid-row: 1 / 3; align-self: center; color: var(--ember); font-size: 1.25rem; }
  .rotate-note b { font-size: .7rem; }
  .rotate-note small { color: var(--muted); font-size: .59rem; }
}

@media (max-width: 350px) and (hover: none), (max-width: 350px) and (pointer: coarse) {
  .joystick { left: max(10px, env(safe-area-inset-left)); bottom: max(14px, env(safe-area-inset-bottom)); width: 94px; height: 94px; }
  .joystick::before { inset: 19px; }
  .joystick i { width: 39px; height: 39px; }
  .touch-actions { right: max(8px, env(safe-area-inset-right)); bottom: max(10px, env(safe-area-inset-bottom)); width: 178px; height: 136px; }
  .touch-actions button { width: 48px; height: 48px; }
  .touch-actions [data-touch="pulse"] { left: 42px; }
  .touch-actions .touch-main { width: 62px; height: 62px; }
  .touch-actions .touch-dash { right: 66px; width: 56px; height: 56px; }
}

@keyframes rotate-hint { 0%, 70% { opacity: 1; visibility: visible; } 100% { opacity: 0; visibility: hidden; } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
