:root {
  --ink: #e9e6d6; --dim: #a7a48f; --mute: #77755f; --panel: rgba(18, 20, 14, .82); --panel2: rgba(30, 33, 24, .9);
  --line: rgba(214, 205, 160, .18); --accent: #ffcf4a; --accent2: #e39a2d; --good: #7fd16b; --bad: #ff6a4a; --blue: #3d8bff; --red: #ff4a3d;
  --font: "Bahnschrift", "DIN Alternate", "Roboto Condensed", "Arial Narrow", system-ui, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #15170f; color: var(--ink); font-family: var(--font); -webkit-user-select: none; user-select: none; overscroll-behavior: none; }
canvas#gl { position: fixed; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; outline: none; }
#ui { position: fixed; inset: 0; pointer-events: none; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
body.shot #ui { display: none; }

/* ── buttons ── */
.btn { pointer-events: auto; border: 1px solid rgba(255, 207, 74, .45); background: linear-gradient(#3b3a26, #2a2a1b); color: var(--ink); padding: 10px 18px; min-height: 44px; border-radius: 3px; letter-spacing: .06em; text-transform: uppercase; font-weight: 700; font-size: 14px; clip-path: polygon(8px 0, 100% 0, 100% calc(100% - 8px), calc(100% - 8px) 100%, 0 100%, 0 8px); }
.btn:hover:not(:disabled) { background: linear-gradient(#4b4930, #34331f); border-color: var(--accent); }
.btn:disabled { opacity: .45; cursor: default; }
.btn.big { background: linear-gradient(#ffd560, #e29a2a); color: #1b1a0e; border-color: #ffe08a; font-size: 18px; padding: 12px 34px; min-height: 52px; }
.btn.big:hover:not(:disabled) { background: linear-gradient(#ffe07a, #f0aa3a); }
.btn.ghost { background: transparent; border-color: var(--line); }
.btn.small { padding: 6px 12px; min-height: 34px; font-size: 12px; }
.btn.gold { border-color: #e6c35a; color: #ffe08a; }
.chip { pointer-events: auto; border: 1px solid var(--line); background: rgba(255, 255, 255, .04); padding: 8px 12px; min-height: 38px; border-radius: 2px; font-size: 13px; letter-spacing: .03em; }
.chip.on { border-color: var(--accent); background: rgba(255, 207, 74, .14); color: #fff2c4; }
.chip:disabled { opacity: .4; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 6px 0 10px; align-items: center; }
.note { color: var(--dim); font-size: 13px; line-height: 1.45; }
.note.warn { color: #f0b45a; }
.bar { height: 10px; background: rgba(0, 0, 0, .45); border: 1px solid var(--line); position: relative; overflow: hidden; }
.bar > div { height: 100%; background: linear-gradient(90deg, #8fd36b, #c8ee8a); transition: width .1s linear; }
.xpbar { height: 5px; margin: 4px 0 2px; }
.xpbar > div { background: linear-gradient(90deg, var(--accent2), var(--accent)); }

/* ── menu ── */
.menu { position: absolute; inset: 0; display: grid; grid-template-columns: minmax(150px, 190px) minmax(0, 560px) 1fr; grid-template-rows: auto 1fr auto; grid-template-areas: "top top top" "nav body ." "foot foot foot"; gap: 0 18px; padding: max(14px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) max(14px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left)); pointer-events: none; background: linear-gradient(90deg, rgba(10, 11, 7, .78) 0%, rgba(10, 11, 7, .55) 45%, rgba(10, 11, 7, 0) 72%); }
.menu.paused { background: rgba(10, 11, 7, .72); grid-template-columns: minmax(140px, 170px) minmax(0, 760px) 1fr; }
.menu > * { pointer-events: auto; }
.m-top { grid-area: top; display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 12px; }
.logo { font-size: 38px; font-weight: 800; letter-spacing: .22em; color: #f2e7c0; text-shadow: 0 2px 0 #000, 0 0 24px rgba(255, 190, 80, .25); line-height: 1; }
.logo small { display: block; font-size: 11px; letter-spacing: .5em; color: var(--accent); margin-top: 4px; }
.acct { display: flex; gap: 14px; align-items: center; background: var(--panel); border: 1px solid var(--line); padding: 8px 12px; }
.rank { display: flex; gap: 10px; align-items: center; min-width: 190px; }
.rank b { font-size: 15px; letter-spacing: .04em; }
.rank small { color: var(--dim); font-size: 11px; }
.who { color: var(--dim); font-size: 13px; }
.insignia { display: inline-flex; width: 30px; height: 30px; align-items: center; justify-content: center; background: #2b2c1d; border: 1px solid var(--accent2); color: var(--accent); font-style: normal; font-size: 12px; line-height: 1; overflow: hidden; }
.ins { font-style: normal; letter-spacing: -1px; }
.ins.chev { transform: scaleX(1.4); font-weight: 800; }
.ins u { text-decoration: none; display: block; font-size: 9px; }
.m-nav { grid-area: nav; display: flex; flex-direction: column; gap: 4px; }
.m-nav button { text-align: left; background: transparent; border: 0; border-left: 3px solid transparent; padding: 11px 14px; font-size: 15px; letter-spacing: .1em; text-transform: uppercase; color: var(--dim); min-height: 44px; }
.m-nav button:hover { color: var(--ink); background: rgba(255, 255, 255, .03); }
.m-nav button.on { color: #fff2c4; border-left-color: var(--accent); background: linear-gradient(90deg, rgba(255, 207, 74, .14), transparent); }
.m-body { grid-area: body; overflow-y: auto; padding-right: 6px; min-height: 0; scrollbar-width: thin; }
.m-body h3 { font-size: 13px; letter-spacing: .2em; text-transform: uppercase; color: var(--accent); margin: 14px 0 6px; font-weight: 700; }
.m-body h4 { font-size: 12px; letter-spacing: .12em; text-transform: uppercase; color: var(--dim); margin: 8px 0 2px; }
.m-foot { grid-area: foot; display: flex; gap: 12px; align-items: center; padding-top: 12px; }
.cards { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.card { background: var(--panel); border: 1px solid var(--line); padding: 12px 14px; }
.card h3 { margin-top: 0; }
.card p { margin: 0 0 6px; font-size: 13px; color: var(--dim); line-height: 1.4; }
.card label, .settings label { display: flex; align-items: center; gap: 10px; font-size: 13px; color: var(--dim); margin: 8px 0; }
.card label input[type=range], .settings input[type=range] { flex: 1; accent-color: var(--accent); }
select, input.code, input[type=text] { background: #1d1f16; border: 1px solid var(--line); padding: 8px; min-height: 38px; border-radius: 2px; }
input.code { text-transform: uppercase; letter-spacing: .25em; width: 130px; -webkit-user-select: text; user-select: text; }
.row { display: flex; gap: 8px; margin-top: 8px; flex-wrap: wrap; }
.rooms, .friends { list-style: none; margin: 0 0 8px; padding: 0; }
.rooms li, .friends li { display: flex; align-items: center; gap: 8px; padding: 6px 0; border-bottom: 1px solid var(--line); font-size: 13px; }
.rooms li span, .friends li small { color: var(--dim); flex: 1; }
.rooms .rm { flex: 1; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.rooms .rm span { flex: none; font-size: 12px; }
.rooms .rm .rot { min-height: 1em; opacity: .75; }
.card.wide { grid-column: 1 / -1; }
.friends li.on b { color: var(--good); }
.garage .picks { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.pick { text-align: left; background: var(--panel); border: 1px solid var(--line); padding: 10px; display: flex; flex-direction: column; gap: 3px; position: relative; }
.pick.on { border-color: var(--accent); background: rgba(60, 54, 24, .9); box-shadow: inset 0 0 0 1px rgba(255, 207, 74, .3); }
.pick.locked { opacity: .5; }
.pick b { font-size: 15px; letter-spacing: .06em; text-transform: uppercase; }
.pick small { color: var(--dim); font-size: 11.5px; line-height: 1.3; min-height: 30px; }
.pick em { color: var(--accent2); font-style: normal; font-size: 11px; }
.stats { display: grid; grid-template-columns: auto 1fr; gap: 3px 8px; align-items: center; font-size: 10.5px; color: var(--mute); text-transform: uppercase; letter-spacing: .05em; margin-top: 4px; }
.meter { height: 5px; background: rgba(0, 0, 0, .5); display: block; }
.meter i { display: block; height: 100%; background: linear-gradient(90deg, #c9b56a, #f4dd8a); }
.shop { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.item { background: var(--panel); border: 1px solid var(--line); padding: 8px; display: flex; flex-direction: column; gap: 4px; font-size: 12px; }
.item img { width: 100%; aspect-ratio: 1; object-fit: cover; background: #222; }
.item b { font-size: 13.5px; }
.item small { color: var(--dim); line-height: 1.3; }
.item .rar { text-transform: uppercase; letter-spacing: .12em; font-size: 10px; }
.r-uncommon .rar { color: #7fd16b; } .r-rare .rar { color: #4aa3ff; } .r-epic .rar { color: #c27bff; } .r-legendary .rar { color: #ffb02e; }
.r-legendary { border-color: rgba(255, 176, 46, .5); } .r-epic { border-color: rgba(194, 123, 255, .4); }
.item .btn { margin-top: auto; }
.owned { color: var(--good); font-size: 12px; margin-top: auto; }
.lb { list-style: none; padding: 0; margin: 0; background: var(--panel); border: 1px solid var(--line); }
.lb li { display: grid; grid-template-columns: 34px 1fr auto; padding: 7px 10px; border-bottom: 1px solid var(--line); font-size: 14px; }
.lb li span { color: var(--mute); } .lb li em { font-style: normal; color: var(--accent); }
.record { display: grid; grid-template-columns: repeat(4, auto 1fr); gap: 6px 12px; background: var(--panel); border: 1px solid var(--line); padding: 10px; font-size: 13px; }
.record span { color: var(--dim); }
.ranks { list-style: none; padding: 0; margin: 0; columns: 2; font-size: 13px; }
.ranks li { display: flex; align-items: center; gap: 8px; padding: 3px 0; color: var(--mute); break-inside: avoid; flex-wrap: wrap; }
.ranks li.got { color: var(--ink); }
.ranks small { color: var(--mute); } .ranks em { color: var(--accent2); font-style: normal; font-size: 11px; width: 100%; padding-left: 38px; }
.settings { background: var(--panel); border: 1px solid var(--line); padding: 8px 14px; }
.help dl { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; font-size: 14px; }
.help dt { color: var(--accent); } .help dd { margin: 0; color: var(--dim); }
.help ul { color: var(--dim); font-size: 14px; line-height: 1.6; padding-left: 18px; }

/* ── toasts ── */
.toasts-global { position: fixed; left: 50%; top: 14px; transform: translateX(-50%); display: flex; flex-direction: column; gap: 6px; z-index: 50; pointer-events: none; align-items: center; }
.toast { pointer-events: auto; background: rgba(20, 22, 15, .95); border: 1px solid var(--accent2); padding: 10px 14px; font-size: 14px; display: flex; gap: 10px; align-items: center; animation: tin .2s; max-width: min(92vw, 520px); }
@keyframes tin { from { opacity: 0; transform: translateY(-6px); } }

/* ── HUD ── */
.hud { position: absolute; inset: 0; pointer-events: none; font-size: 14px; text-shadow: 0 1px 2px rgba(0, 0, 0, .8); }
.hud-top { position: absolute; top: max(10px, env(safe-area-inset-top)); left: max(12px, env(safe-area-inset-left)); right: max(12px, env(safe-area-inset-right)); display: flex; justify-content: space-between; align-items: flex-start; }
.hud-room { background: var(--panel); border: 1px solid var(--line); padding: 6px 10px; font-size: 13px; color: var(--dim); pointer-events: auto; }
.hud-room b { color: var(--accent); letter-spacing: .2em; cursor: pointer; }
.hud-score { position: absolute; left: 50%; transform: translateX(-50%); text-align: center; }
.score-row { display: flex; align-items: center; gap: 12px; background: var(--panel); border: 1px solid var(--line); padding: 4px 14px; font-size: 24px; font-weight: 800; }
.score-row .clock { font-size: 16px; color: var(--ink); font-weight: 600; letter-spacing: .08em; min-width: 52px; }
.score-row .lead { color: var(--dim); }
.score-sub { font-size: 11px; letter-spacing: .14em; text-transform: uppercase; color: var(--dim); margin-top: 3px; }
.hud-btns { display: flex; gap: 6px; }
.hbtn { pointer-events: auto; width: 44px; height: 44px; background: var(--panel); border: 1px solid var(--line); color: var(--ink); font-size: 16px; }
.feed { position: absolute; right: max(12px, env(safe-area-inset-right)); top: 66px; display: flex; flex-direction: column; align-items: flex-end; gap: 3px; max-width: 46vw; }
.fe { background: rgba(14, 15, 10, .6); padding: 3px 8px; font-size: 13px; transition: opacity .5s; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.fe.out { opacity: 0; } .fe .wi { color: var(--accent); margin: 0 4px; } .fe .sys { color: var(--dim); } .fe b.me { text-decoration: underline; }
.announce { position: absolute; top: 22%; left: 50%; transform: translateX(-50%); font-size: 30px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; color: #fff2c4; opacity: 0; transition: opacity .3s; text-align: center; white-space: nowrap; }
.announce.on { opacity: 1; } .announce.small { font-size: 18px; } .announce.good { color: var(--good); } .announce.bad { color: var(--bad); }
.xpfeed { position: absolute; top: 30%; left: 50%; transform: translateX(-50%); display: flex; flex-direction: column; align-items: center; }
.xpe { color: var(--accent); font-weight: 800; font-size: 16px; animation: xpup 1.8s forwards; }
.xpe small { color: var(--dim); font-weight: 400; }
@keyframes xpup { from { opacity: 0; transform: translateY(10px); } 15% { opacity: 1; transform: none; } 80% { opacity: 1; } to { opacity: 0; transform: translateY(-14px); } }
.reloadbar { position: absolute; left: 50%; top: 50%; width: 64px; height: 6px; margin: -3px 0 0 -32px; background: rgba(0, 0, 0, .55); border: 1px solid rgba(255, 245, 210, .25); border-radius: 3px; overflow: hidden; pointer-events: none; }
.reloadbar i { display: block; height: 100%; width: 0; background: #e8d9a0; }
.reloadbar.hot i { background: #ff9a3d; } .reloadbar.over i { background: #ff4a3d; } .reloadbar.charge i { background: #8fd3ff; }
.hitmark { position: absolute; left: 50%; top: 50%; width: 34px; height: 34px; margin: -17px 0 0 -17px; opacity: 0; background: linear-gradient(45deg, transparent 46%, #fff 46%, #fff 54%, transparent 54%), linear-gradient(-45deg, transparent 46%, #fff 46%, #fff 54%, transparent 54%); -webkit-mask: radial-gradient(circle, transparent 7px, #000 8px); mask: radial-gradient(circle, transparent 7px, #000 8px); }
.hitmark.on { animation: hm .25s; } .hitmark.kill { filter: drop-shadow(0 0 3px red) hue-rotate(0deg); background-color: transparent; }
.hitmark.kill.on { animation: hm .5s; }
@keyframes hm { from { opacity: 1; transform: scale(1.3); } to { opacity: 0; transform: scale(1); } }
.vignette { position: absolute; inset: 0; box-shadow: inset 0 0 140px 30px rgba(200, 20, 10, .55); opacity: 0; }
.vignette.on { animation: vg .6s; }
@keyframes vg { from { opacity: 1; } to { opacity: 0; } }
.dmgdir { position: absolute; left: 50%; top: 50%; width: 220px; height: 220px; margin: -110px 0 0 -110px; opacity: 0; }
.dmgdir::before { content: ""; position: absolute; left: 50%; top: 0; width: 60px; height: 14px; margin-left: -30px; background: radial-gradient(ellipse at center, rgba(255, 60, 40, .9), transparent 70%); }
.dmgdir.on { animation: vg 1s; }
.tags { position: absolute; inset: 0; overflow: hidden; }
.tag { position: absolute; left: 0; top: 0; text-align: center; font-size: 12.5px; font-weight: 700; white-space: nowrap; will-change: transform; }
.tag .tb { width: 54px; height: 4px; background: rgba(0, 0, 0, .55); margin: 2px auto 0; }
.tag .tb div { height: 100%; background: var(--c, #ff8a6a); }
.dmgnum { position: absolute; font-weight: 800; color: #ffe08a; font-size: 18px; animation: dn .9s forwards; transform: translate(-50%, -50%); }
.dmgnum.heal { color: #7dff8e; text-shadow: 0 0 6px rgba(40, 200, 80, .6); }
.res-note { text-align: center; color: var(--dim); font-size: 13px; margin: 0 0 8px; }
.res-extra { display: flex; justify-content: center; gap: 18px; flex-wrap: wrap; margin: -4px 0 10px; color: var(--dim); font-size: 14px; }
.res-extra b { color: #7dff8e; }
@keyframes dn { from { opacity: 1; margin-top: 0; } to { opacity: 0; margin-top: -36px; } }
.hp-panel { position: absolute; left: max(14px, env(safe-area-inset-left)); bottom: max(14px, env(safe-area-inset-bottom)); width: min(280px, 28vw); background: var(--panel); border: 1px solid var(--line); padding: 8px 10px; }
.hp-name { font-size: 11px; letter-spacing: .16em; text-transform: uppercase; color: var(--dim); margin-bottom: 5px; }
.bar.hp { height: 16px; } .bar.hp span { position: absolute; right: 6px; top: -1px; font-size: 12px; font-weight: 800; }
.bar.hp div.mid { background: linear-gradient(90deg, #d8b84a, #f0d070); } .bar.hp div.low { background: linear-gradient(90deg, #d8452a, #ff7a50); }
.buffs { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px; min-height: 0; }
.buff { font-size: 10.5px; letter-spacing: .08em; padding: 2px 6px; border: 1px solid var(--c, var(--accent)); color: var(--c, var(--accent)); text-transform: uppercase; }
.buff.protect { --c: #9fd4ff; } .buff.burn { --c: #ff7a3a; } .buff.flag { --c: #fff2c4; }
.wpn-panel { position: absolute; left: 50%; bottom: max(14px, env(safe-area-inset-bottom)); transform: translateX(-50%); width: min(240px, 26vw); background: var(--panel); border: 1px solid var(--line); padding: 6px 10px; text-align: center; }
.wpn-name { font-size: 12px; letter-spacing: .2em; text-transform: uppercase; color: var(--accent); margin-bottom: 4px; }
.bar.wpn > div { background: linear-gradient(90deg, #b9b9a0, #ecebd2); transition: none; }
.bar.wpn > div.ready { background: linear-gradient(90deg, #8fd36b, #c8ee8a); }
.bar.wpn > div.hot { background: linear-gradient(90deg, #e6a03a, #ffd060); } .bar.wpn > div.over { background: #d8452a; }
.bar.wpn > div.charge { background: linear-gradient(90deg, #6aa8ff, #d6ecff); }
.pips { display: flex; justify-content: center; gap: 5px; margin-top: 4px; min-height: 8px; font-size: 9px; color: var(--mute); letter-spacing: .2em; }
.pips i { width: 14px; height: 7px; background: rgba(0, 0, 0, .5); border: 1px solid var(--line); }
.pips i.on { background: var(--accent); }
.minimap { position: absolute; right: max(14px, env(safe-area-inset-right)); bottom: max(14px, env(safe-area-inset-bottom)); width: 168px; height: 168px; }
.lockhint { position: absolute; left: 50%; top: 60%; transform: translateX(-50%); background: var(--panel); padding: 6px 12px; font-size: 13px; color: var(--dim); border: 1px solid var(--line); }
.hud.dead .cross, .hud.dead .aimdot, .hud.dead .wpn-panel { display: none; }
.deathbox { position: absolute; left: 50%; top: 34%; transform: translateX(-50%); text-align: center; background: rgba(20, 8, 6, .7); border: 1px solid rgba(255, 106, 74, .4); padding: 14px 24px; }
.deathbox .dt { font-size: 22px; font-weight: 800; letter-spacing: .06em; } .deathbox .dt b { color: var(--bad); }
.deathbox .ds { font-size: 15px; color: var(--accent); margin-top: 4px; } .deathbox .dh { font-size: 12px; color: var(--dim); margin-top: 8px; }
.board, .results { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); background: rgba(14, 15, 10, .92); border: 1px solid var(--line); padding: 14px 18px; max-width: min(860px, 96vw); max-height: 86vh; overflow: auto; pointer-events: auto; }
.board-cols { display: flex; gap: 18px; flex-wrap: wrap; }
.board-t { border-collapse: collapse; font-size: 13.5px; min-width: 280px; }
.board-t th { color: var(--dim); font-weight: 600; font-size: 11px; letter-spacing: .12em; text-transform: uppercase; padding: 4px 8px; text-align: right; }
.board-t td { padding: 4px 8px; text-align: right; border-top: 1px solid var(--line); }
.board-t .tn { text-align: left; } .board-t tr.me td { color: var(--accent); } .board-t tr.away td { opacity: .5; }
.board-t small { color: var(--mute); font-size: 9.5px; letter-spacing: .1em; }
.res-head { font-size: 32px; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; text-align: center; margin-bottom: 6px; }
.res-head.won { color: var(--accent); }
.res-xp { text-align: center; color: var(--accent); margin-bottom: 10px; font-weight: 700; }
.res-xp .bar { width: 260px; margin: 6px auto 0; }
.res-next { text-align: center; color: var(--dim); margin-top: 10px; font-size: 13px; }
.netwarn { position: absolute; left: 50%; top: 70px; transform: translateX(-50%); background: rgba(80, 20, 10, .85); padding: 6px 14px; font-size: 13px; }

/* ── touch ── */
.touch-look, .touch-stick, .touch-fire { display: none; }
body.touch.playing .touch-look { display: block; position: absolute; left: 40%; right: 0; top: 70px; bottom: 0; pointer-events: auto; touch-action: none; }
body.touch.playing .touch-stick { display: block; position: absolute; left: max(18px, env(safe-area-inset-left)); bottom: max(18px, calc(env(safe-area-inset-bottom) + 10px)); width: 128px; height: 128px; border-radius: 50%; background: rgba(20, 22, 15, .45); border: 2px solid rgba(214, 205, 160, .35); pointer-events: auto; touch-action: none; }
.touch-stick .knob { position: absolute; left: 50%; top: 50%; width: 56px; height: 56px; margin: -28px 0 0 -28px; border-radius: 50%; background: radial-gradient(circle at 35% 30%, #d8cf9a, #6d6740); box-shadow: 0 3px 10px rgba(0, 0, 0, .5); }
body.touch.playing .touch-fire { display: block; position: absolute; right: max(18px, env(safe-area-inset-right)); bottom: max(22px, calc(env(safe-area-inset-bottom) + 14px)); width: 88px; height: 88px; border-radius: 50%; border: 2px solid var(--accent); background: rgba(90, 40, 20, .55); color: var(--accent); font-weight: 800; letter-spacing: .1em; pointer-events: auto; touch-action: none; }
.touch-fire.on { background: rgba(255, 140, 60, .6); }
/* touch: corners for the thumbs (stick bottom-left, fire bottom-right), minimap top-right, weapon
   state just above the stick; the middle of the screen stays clear */
body.touch .hud .minimap { width: 112px; height: 112px; bottom: auto; top: max(64px, calc(env(safe-area-inset-top) + 58px)); }
body.touch .wpn-panel { left: max(18px, env(safe-area-inset-left)); transform: none; bottom: max(160px, calc(env(safe-area-inset-bottom) + 150px)); width: 128px; padding: 4px 8px; }
body.touch .wpn-name { font-size: 10px; margin-bottom: 2px; }
body.touch .tag { font-size: 13.5px; }
body.touch .tag .tb { width: 60px; height: 5px; }
body.touch .feed { top: max(184px, calc(env(safe-area-inset-top) + 178px)); max-width: 60vw; }
body.touch .hp-panel { width: min(200px, 44vw); bottom: auto; top: max(64px, calc(env(safe-area-inset-top) + 58px)); padding: 6px 8px; }

body.touch .lockhint, body.touch .cross { display: none; }

@media (max-width: 760px), (max-height: 520px) {
  .menu, .menu.paused { display: block; overflow-y: auto; background: rgba(10, 11, 7, .82); padding-bottom: 0; }
  .m-body { overflow: visible; padding-right: 0; margin-top: 6px; }
  .m-foot { position: sticky; bottom: 0; background: linear-gradient(transparent, rgba(10, 11, 7, .96) 30%); padding: 14px 0 max(10px, env(safe-area-inset-bottom)); margin-top: 10px; }
  .m-top { flex-wrap: wrap; margin-bottom: 6px; }
  .m-nav { flex-direction: row; overflow-x: auto; gap: 2px; }
  .m-nav button { border-left: 0; border-bottom: 3px solid transparent; padding: 8px 10px; font-size: 12px; white-space: nowrap; }
  .m-nav button.on { border-bottom-color: var(--accent); }
  .logo { font-size: 26px; } .logo small { display: none; }
  .rank { min-width: 0; } .acct { padding: 6px 8px; }
  .btn.big { font-size: 15px; padding: 10px 18px; }
  .cards { grid-template-columns: 1fr; }
  .garage .picks { grid-template-columns: 1fr 1fr; }
  .record { grid-template-columns: repeat(2, auto 1fr); }
  .ranks { columns: 1; }
  .m-foot { flex-wrap: wrap; } .m-foot .btn.big { flex: 1; }
  .score-row { font-size: 18px; } .announce { font-size: 20px; }
  .feed { top: 100px; font-size: 11px; }
  .hud .minimap { width: 110px; height: 110px; }
}
@media (prefers-reduced-motion: reduce) { .xpe, .toast, .dmgnum { animation-duration: .01s; } }
.hud.recording .lockhint, .hud.recording .hud-btns { display: none !important; }
.gl-lost { position: fixed; left: 50%; top: 40%; transform: translate(-50%, -50%); z-index: 60; background: rgba(14, 15, 10, .94); border: 1px solid var(--accent2); padding: 14px 18px; display: flex; flex-direction: column; gap: 6px; align-items: center; text-align: center; pointer-events: auto; }
.gl-lost span { color: var(--dim); font-size: 13px; }
.gl-stats { position: fixed; left: 6px; top: 50%; z-index: 55; margin: 0; padding: 4px 6px; background: rgba(0, 0, 0, .65); color: #9f9; font: 10px/1.35 ui-monospace, monospace; pointer-events: none; white-space: pre; }
.edge-arrow { position: absolute; left: 0; top: 0; width: 34px; height: 34px; display: flex; align-items: center; justify-content: center; will-change: transform; }
.edge-arrow i { position: absolute; width: 0; height: 0; border-left: 9px solid transparent; border-right: 9px solid transparent; border-bottom: 16px solid var(--c, #ff6a4a); filter: drop-shadow(0 0 2px #000); }
.edge-arrow span { position: absolute; top: 30px; font-size: 10px; font-weight: 700; color: var(--c, #ff6a4a); }
@media (orientation: landscape) and (max-height: 520px) {
  body.touch .wpn-panel { bottom: max(158px, calc(env(safe-area-inset-bottom) + 150px)); }
  body.touch .hud .minimap { width: 96px; height: 96px; }
  body.touch .feed { top: 64px; right: 128px; }
}
body.touch .score-sub { display: none; }
body.touch .deathbox { top: 22%; padding: 10px 14px; max-width: 70vw; }
body.touch .deathbox .dt { font-size: 17px; }
body.touch .deathbox .dh { display: none; }

/* ── economy: credits, garage shop, ranks, results, promotion ── */
.insignia svg { width: 100%; height: 100%; display: block; overflow: visible; }
.insignia { padding: 2px; }
.insignia.sm { width: 20px; height: 20px; padding: 1px; border-color: rgba(227, 154, 45, .5); }
.cr { display: inline-flex; align-items: center; gap: 4px; font-weight: 800; color: #ffe08a; white-space: nowrap; font-variant-numeric: tabular-nums; }
.coin { display: inline-block; width: .95em; height: .95em; border-radius: 50%; flex: none; background: radial-gradient(circle at 35% 30%, #fff6c8 0 12%, #ffd34e 28%, #c98b16 78%, #8a5a08 100%); box-shadow: inset 0 0 0 1.5px rgba(120, 76, 6, .7), 0 0 4px rgba(255, 200, 60, .35); position: relative; }
.coin::after { content: ""; position: absolute; inset: 26%; border-radius: 50%; border: 1.5px solid rgba(138, 90, 8, .55); }
.credits { font-size: 17px; padding: 4px 10px; border-left: 1px solid var(--line); transition: transform .2s; }
.credits.gain .cr { animation: crpop .9s; } .credits.spend .cr { animation: crspend .9s; }
@keyframes crpop { 30% { transform: scale(1.18); color: #fff; text-shadow: 0 0 12px rgba(255, 210, 80, .9); } }
@keyframes crspend { 20% { transform: translateY(2px); color: #ffb08a; } }

.g-sum { display: flex; justify-content: space-between; align-items: center; gap: 10px; background: linear-gradient(90deg, rgba(60, 54, 24, .85), var(--panel)); border: 1px solid var(--line); border-left: 3px solid var(--accent); padding: 8px 12px; margin-bottom: 8px; }
.g-sum small { display: block; font-size: 10.5px; letter-spacing: .16em; text-transform: uppercase; color: var(--dim); }
.g-sum b { font-size: 16px; letter-spacing: .06em; text-transform: uppercase; }
.g-sum > div > span { display: block; font-size: 12px; color: var(--dim); margin-top: 2px; }
.g-cr { text-align: right; } .g-cr .cr { font-size: 22px; }
.trynote { display: flex; align-items: center; gap: 10px; justify-content: space-between; background: rgba(61, 139, 255, .12); border: 1px dashed rgba(120, 180, 255, .5); padding: 6px 10px; font-size: 13px; color: #cfe2ff; margin-bottom: 6px; }
.g-stage { display: none; }
.g-tabs { position: sticky; top: 0; z-index: 2; background: linear-gradient(rgba(14, 15, 10, .95) 70%, transparent); padding: 4px 0 8px; margin: 0 0 4px; }

.garage .picks { grid-template-columns: repeat(auto-fill, minmax(168px, 1fr)); }
.garage .picks.minis { grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); }
.pick { cursor: pointer; transform: perspective(700px) rotateX(var(--rx, 0deg)) rotateY(var(--ry, 0deg)) translateY(var(--ty, 0)); transition: transform .18s ease-out, border-color .15s, box-shadow .2s, background .2s; will-change: transform; }
.pick:hover { --ty: -2px; border-color: rgba(255, 207, 74, .45); box-shadow: 0 6px 18px rgba(0, 0, 0, .35), 0 0 0 1px rgba(255, 207, 74, .12); }
.pick:active { --ty: 1px; transition-duration: .05s; }
.pick:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.pick.unowned > b, .pick.unowned > small, .pick.unowned .stats { opacity: .78; }
.pick.trying { border-color: #6aa8ff; border-style: dashed; background: rgba(30, 44, 70, .85); }
.pick.bought { animation: bought 1.1s ease-out; }
@keyframes bought { 0% { box-shadow: 0 0 0 0 rgba(255, 207, 74, .9), inset 0 0 40px rgba(255, 220, 120, .8); } 100% { box-shadow: 0 0 0 18px rgba(255, 207, 74, 0), inset 0 0 0 rgba(255, 220, 120, 0); } }
.pick b kbd, .slot kbd { font: 700 11px var(--font); background: #ffcf4a; color: #1b1a0e; padding: 1px 6px; border-radius: 2px; letter-spacing: 0; vertical-align: 2px; }
.pick-foot { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: auto; padding-top: 6px; min-height: 30px; }
.pick-foot .btn.small { padding: 4px 10px; min-height: 30px; }
.st { font-size: 11px; letter-spacing: .14em; text-transform: uppercase; color: var(--mute); }
.st.on { color: var(--good); } .st.on::before { content: "✓ "; }
.st.try { color: #8fc0ff; }
.lock { display: inline-flex; align-items: center; gap: 6px; font-size: 11.5px; color: var(--accent2); }
.btn.buy .cr { color: inherit; }
.btn.buy:not(:disabled) { box-shadow: 0 0 0 rgba(255, 207, 74, 0); }
.btn.buy:active:not(:disabled) { transform: scale(.94); }
.btn.buy.sure { background: linear-gradient(#ffd560, #e29a2a); color: #1b1a0e; border-color: #ffe08a; animation: sure .9s ease-in-out infinite alternate; }
.btn.buy.sure .cr { color: #1b1a0e; }
@keyframes sure { to { box-shadow: 0 0 14px rgba(255, 207, 74, .65); } }
.btn.buy:disabled .cr { color: #b98f6a; }
.save { font-size: 11px; color: var(--good); letter-spacing: .06em; }
.kit-parts { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--ink); margin-top: 4px; }
.pick small.worth { min-height: 0; color: var(--mute); }
.swatch { display: inline-block; width: 100%; height: 26px; border: 1px solid rgba(0, 0, 0, .5); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .08); margin-bottom: 4px; flex: none; }
.kit-parts .swatch { width: 16px; height: 16px; margin: 0; }
.swatch.none { background: repeating-linear-gradient(45deg, #2a2b20 0 6px, #22231a 6px 12px); }
.swatch.decal { background: radial-gradient(circle, #e8e2c8 0 30%, transparent 32%), #3a3d2c; }
.pick.mini { padding: 8px; } .pick.mini b { font-size: 12.5px; }
.slots { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 4px 0 8px; }
.slot { display: flex; align-items: center; gap: 8px; background: var(--panel2); border: 1px solid var(--line); padding: 6px 8px; min-height: 48px; }
.slot b { flex: 1; text-transform: uppercase; letter-spacing: .06em; font-size: 13px; }
.slot .note { flex: 1; }
.slot .x { background: transparent; border: 1px solid var(--line); color: var(--dim); width: 32px; height: 32px; }
.ranks li.cur { color: #fff2c4; background: linear-gradient(90deg, rgba(255, 207, 74, .14), transparent); }
.ranks .rn { flex: 1; }
.m-body.enter { animation: bodyin .28s ease-out; }
@keyframes bodyin { from { opacity: 0; transform: translateX(10px); } }

/* in game: credits with XP, results */
.xpe .cre .cr { font-size: 15px; }
.res-gain { display: flex; justify-content: center; align-items: center; gap: 18px; flex-wrap: wrap; margin: 4px 0 12px; }
.res-gain .res-xp { display: flex; align-items: center; gap: 10px; margin: 0; text-align: left; color: var(--ink); }
.res-gain .res-xp .insignia { width: 42px; height: 42px; }
.res-col { min-width: 220px; }
.res-line { display: flex; justify-content: space-between; gap: 12px; } .res-line span { color: var(--accent); }
.res-col small { color: var(--dim); font-size: 11.5px; font-weight: 400; }
.xpbar.big { height: 8px; } .res-xp .bar { width: auto; margin: 4px 0 2px; }
.res-cr { display: flex; flex-direction: column; align-items: center; gap: 2px; }
.res-cr small { color: var(--dim); font-size: 11.5px; }
.cr.big { font-size: 26px; }

/* promotion ceremony */
.ceremony { position: fixed; inset: 0; z-index: 70; display: flex; align-items: center; justify-content: center; background: radial-gradient(circle at 50% 45%, rgba(60, 46, 10, .82), rgba(5, 5, 3, .93) 70%); pointer-events: auto; animation: cerin .35s ease-out; overflow: hidden; cursor: pointer; }
.ceremony.out { animation: cerout .4s forwards; }
@keyframes cerin { from { opacity: 0; } } @keyframes cerout { to { opacity: 0; } }
.cer-rays { position: absolute; left: 50%; top: 42%; width: 160vmax; height: 160vmax; margin: -80vmax 0 0 -80vmax; background: repeating-conic-gradient(from 0deg, rgba(255, 207, 74, .16) 0 6deg, transparent 6deg 18deg); -webkit-mask: radial-gradient(circle, #000 0, transparent 55%); mask: radial-gradient(circle, #000 0, transparent 55%); animation: rays 24s linear infinite; }
@keyframes rays { to { transform: rotate(360deg); } }
.cer-box { position: relative; display: flex; flex-direction: column; align-items: center; gap: 10px; text-align: center; padding: 20px; max-width: min(520px, 92vw); }
.cer-kicker { font-size: 14px; letter-spacing: .5em; text-transform: uppercase; color: var(--accent); animation: fadeup .5s .2s both; }
.cer-badge { animation: badgein .8s .15s cubic-bezier(.2, 1.6, .4, 1) both; filter: drop-shadow(0 0 24px rgba(255, 200, 70, .7)); }
.insignia.huge { width: min(150px, 34vmin); height: min(150px, 34vmin); padding: 12px; border-width: 2px; background: radial-gradient(circle at 50% 40%, #3b3a26, #1c1d13); }
@keyframes badgein { from { opacity: 0; transform: scale(.2) rotate(-25deg); } }
.cer-name { font-size: clamp(28px, 7vw, 54px); font-weight: 800; letter-spacing: .1em; text-transform: uppercase; color: #fff2c4; text-shadow: 0 0 22px rgba(255, 200, 80, .6), 0 3px 0 #000; animation: stamp .45s .75s cubic-bezier(.3, 1.8, .5, 1) both; line-height: 1.05; }
@keyframes stamp { from { opacity: 0; transform: scale(2.4); letter-spacing: .4em; } }
.cer-bonus { font-size: 20px; color: var(--ink); animation: fadeup .5s 1s both; } .cer-bonus .cr { font-size: 26px; }
.cer-opens { animation: fadeup .5s 1.4s both; } .cer-opens small { display: block; color: var(--dim); letter-spacing: .14em; text-transform: uppercase; font-size: 11px; margin-bottom: 6px; }
.cer-opens div { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; }
.cer-opens span { border: 1px solid rgba(255, 207, 74, .5); background: rgba(255, 207, 74, .1); padding: 4px 10px; font-size: 13px; }
.cer-box .btn { animation: fadeup .5s 1.7s both; margin-top: 6px; }
@keyframes fadeup { from { opacity: 0; transform: translateY(12px); } }
.ceremony.still *, .ceremony.still { animation: none !important; }

@media (pointer: coarse) {
  .btn.small, .chip, .pick-foot .btn.small { min-height: 44px; }
  .slot .x { width: 44px; height: 44px; }
  .pick { transform: none; }
}
@media (max-width: 760px), (max-height: 520px) {
  .credits { font-size: 15px; padding: 2px 6px; }
  .garage .picks { grid-template-columns: 1fr 1fr; }
  .garage .picks.minis { grid-template-columns: repeat(3, 1fr); }
  .g-tabs { position: static; }
  .res-col { min-width: 180px; }
  /* phones: the garage opens a window onto the turntable between the summary and the cards */
  .menu.g-open { background: linear-gradient(rgba(10, 11, 7, .78), rgba(10, 11, 7, .2) 30%, rgba(10, 11, 7, .2) 60%, rgba(10, 11, 7, .82) 80%); }
  .g-stage { display: block; height: 34vh; touch-action: pan-y; pointer-events: none; }
}
@media (prefers-reduced-motion: reduce) {
  .pick, .m-body.enter, .pick.bought, .btn.buy.sure, .credits .cr { animation: none !important; transition: none; }
}
/* addon cards: the HUD button's icon by the name */
.pick .ad-pic { display: inline-grid; place-items: center; width: 22px; height: 22px; margin-right: 6px; vertical-align: -5px; border-radius: 50%; background: rgba(255, 215, 106, .12); color: #ffd76a; }
.pick .ad-pic svg { width: 14px; height: 14px; }
.stats .sv { color: var(--ink, #e8e2c8); text-transform: none; letter-spacing: 0; font-size: 11.5px; }

/* pre-game lobby */
.lobby { position: absolute; inset: 0; display: none; align-items: center; justify-content: center; background: rgba(10,12,8,.82); z-index: 30; pointer-events: auto; }
.lobby-box { background: var(--panel); border: 1px solid var(--line); padding: 16px 20px; width: min(560px, 92vw); max-height: 92vh; overflow: auto; }
.lobby-box h2 { margin: 0 0 10px; }
.lobby-box h4 { margin: 12px 0 4px; color: var(--dim); font-weight: normal; font-size: 12px; text-transform: uppercase; letter-spacing: .08em; }
.lobby-grid { display: flex; gap: 14px; flex-wrap: wrap; }
.lobby-map { border: 1px solid var(--line); max-width: 100%; background: #1a1c14; }
.lobby-info { display: flex; flex-direction: column; gap: 4px; flex: 1; min-width: 160px; font-size: 14px; }
.lobby-info small, .lobby-list small { color: var(--dim); font-size: 12px; }
.lobby-list { list-style: none; margin: 0; padding: 0; font-size: 14px; }
.lobby-list li { padding: 3px 0; border-bottom: 1px solid var(--line); }
.lobby-list li.bot span { color: var(--dim); }
.lobby-count { margin: 12px 0 8px; font-size: 16px; }
.lobby-btns { display: flex; gap: 8px; }
.hud-room small { display: block; font-size: 11px; opacity: .7; font-weight: normal; }
