:root {
  --accent: #ffb21e; --accent2: #ff6a1a; --blue: #2f9bff; --red: #ff3d3d;
  --panel: rgba(10, 14, 22, 0.62); --line: rgba(255, 255, 255, 0.14); --text: #f2f5fa; --muted: #9aa6b8;
  --safe-l: env(safe-area-inset-left, 0px); --safe-r: env(safe-area-inset-right, 0px); --safe-b: env(safe-area-inset-bottom, 0px);
  --font: "Rajdhani", "Barlow Condensed", "Arial Narrow", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #0b0f17; color: var(--text); font-family: var(--font); user-select: none; -webkit-user-select: none; touch-action: none; overscroll-behavior: none; }
canvas#c { position: fixed; inset: 0; width: 100vw; height: 100vh; display: block; }
button { font-family: inherit; cursor: pointer; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 13px; }

/* ---------- screens ---------- */
.screen { position: fixed; inset: 0; z-index: 20; }
#loading { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 18px; background: radial-gradient(ellipse at 50% 40%, #1b2638 0%, #070a10 70%); }
.brand { font-size: 64px; font-weight: 800; letter-spacing: 10px; line-height: 0.9; text-align: center;
  background: linear-gradient(180deg, #fff 20%, var(--accent) 60%, var(--accent2)); -webkit-background-clip: text; background-clip: text; color: transparent;
  filter: drop-shadow(0 4px 18px rgba(255, 140, 20, 0.35)); font-style: italic; }
.brand span { display: block; font-size: 15px; letter-spacing: 7px; color: #fff; -webkit-text-fill-color: #e9eef6; font-style: normal; margin-top: 8px; font-weight: 600; }
.brand.small { font-size: 34px; letter-spacing: 6px; text-align: left; }
.brand.small span { font-size: 10px; letter-spacing: 4px; margin-top: 4px; }
.bar { width: min(420px, 70vw); height: 6px; border-radius: 6px; background: rgba(255,255,255,0.08); overflow: hidden; }
.bar i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--accent2), var(--accent)); transition: width .2s; }

#menu { pointer-events: none; background: linear-gradient(90deg, rgba(5,8,14,0.82) 0%, rgba(5,8,14,0.25) 45%, rgba(5,8,14,0) 60%, rgba(5,8,14,0.55) 100%); }
#menu > * { pointer-events: auto; }
.topbar { position: absolute; top: 0; left: 0; right: 0; display: flex; justify-content: space-between; align-items: center; padding: 16px calc(22px + var(--safe-r)) 0 calc(22px + var(--safe-l)); }
.top-right { display: flex; gap: 10px; align-items: center; }
.pill { font-size: 13px; padding: 5px 10px; border-radius: 99px; background: var(--panel); border: 1px solid var(--line); color: var(--muted); font-weight: 600; }
.pill.ok { color: #6be08a; }
.icon-btn { width: 42px; height: 42px; border-radius: 12px; border: 1px solid var(--line); background: var(--panel); color: #fff; font-size: 19px; backdrop-filter: blur(8px); transition: transform .15s, background .15s; }
.icon-btn:hover { background: rgba(255,178,30,0.25); } .icon-btn:active { transform: scale(0.92); }
.menu-left { position: absolute; left: calc(26px + var(--safe-l)); top: 92px; width: min(330px, 40vw); }
.field-label { font-size: 12px; letter-spacing: 3px; color: var(--muted); text-transform: uppercase; margin: 14px 0 6px; font-weight: 700; }
#name { width: 100%; font: 700 22px var(--font); color: #fff; background: rgba(0,0,0,0.45); border: 1px solid var(--line); border-radius: 10px; padding: 10px 14px; outline: none; user-select: text; -webkit-user-select: text; }
#name:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(255,178,30,0.2); }
.outfits { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.outfit { padding: 9px 6px; border-radius: 10px; background: var(--panel); border: 1px solid var(--line); color: #dfe6f0; font-weight: 700; font-size: 14px; transition: all .15s; }
.outfit i { display: block; height: 6px; border-radius: 4px; margin-bottom: 6px; }
.outfit.sel { border-color: var(--accent); background: rgba(255,178,30,0.18); color: #fff; transform: translateY(-2px); }
.mystats { margin-top: 14px; display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.mystats div { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 6px; text-align: center; }
.mystats b { display: block; font-size: 20px; } .mystats span { font-size: 11px; color: var(--muted); letter-spacing: 1px; }
.menu-right { position: absolute; right: calc(26px + var(--safe-r)); bottom: calc(26px + var(--safe-b)); width: min(360px, 44vw); display: flex; flex-direction: column; gap: 12px; align-items: stretch; }
.mode-card { background: linear-gradient(135deg, rgba(255,178,30,0.22), rgba(10,14,22,0.7)); border: 1px solid rgba(255,178,30,0.45); border-radius: 14px; padding: 14px 16px; backdrop-filter: blur(8px); }
.mode-tag { font-size: 11px; letter-spacing: 3px; color: var(--accent); font-weight: 700; }
.mode-title { font-size: 26px; font-weight: 800; } .mode-sub { font-size: 14px; color: #cdd6e3; }
.play-btn { position: relative; font: 800 30px var(--font); letter-spacing: 6px; color: #1a1000; padding: 16px 20px; border: 0; border-radius: 14px;
  background: linear-gradient(180deg, #ffd35a, var(--accent) 45%, var(--accent2)); box-shadow: 0 8px 26px rgba(255,120,20,0.45), inset 0 2px 0 rgba(255,255,255,0.55);
  transition: transform .12s, box-shadow .12s, filter .12s; }
.play-btn:hover { filter: brightness(1.08); } .play-btn:active { transform: scale(0.96); box-shadow: 0 3px 12px rgba(255,120,20,0.4); }
.play-btn.small { font-size: 18px; padding: 10px 18px; letter-spacing: 3px; }
.ghost-btn { font: 700 16px var(--font); color: #fff; background: rgba(255,255,255,0.08); border: 1px solid var(--line); border-radius: 12px; padding: 10px 18px; transition: background .15s, transform .12s; }
.ghost-btn:hover { background: rgba(255,255,255,0.16); } .ghost-btn:active { transform: scale(0.96); }
.hint { font-size: 13px; text-align: center; }

#lobby { display: flex; align-items: center; justify-content: center; background: rgba(4,6,10,0.55); backdrop-filter: blur(3px); }
.mm-card { background: var(--panel); border: 1px solid var(--line); border-radius: 18px; padding: 26px 34px; text-align: center; display: flex; flex-direction: column; gap: 8px; min-width: 280px; }
.mm-title { font-size: 28px; font-weight: 800; letter-spacing: 3px; }
.mm-count { font-size: 20px; } .mm-count b { color: var(--accent); font-size: 30px; }
.mm-timer b { color: #fff; }
.spinner { width: 46px; height: 46px; margin: 0 auto 4px; border-radius: 50%; border: 4px solid rgba(255,255,255,0.12); border-top-color: var(--accent); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- HUD ---------- */
#hud { position: fixed; inset: 0; z-index: 10; pointer-events: none; text-shadow: 0 1px 3px rgba(0,0,0,0.7); }
#compass { position: absolute; top: 8px; left: 50%; transform: translateX(-50%); width: min(420px, 46vw); height: 26px; overflow: hidden; border-radius: 6px; background: rgba(0,0,0,0.25);
  mask-image: linear-gradient(90deg, transparent, #000 15%, #000 85%, transparent); -webkit-mask-image: linear-gradient(90deg, transparent, #000 15%, #000 85%, transparent); }
#compassStrip { position: absolute; top: 3px; left: 0; white-space: nowrap; font-weight: 700; font-size: 14px; }
#compassStrip span { display: inline-block; width: 30px; text-align: center; }
#compass .caret { position: absolute; left: 50%; bottom: 0; transform: translateX(-50%); border: 5px solid transparent; border-bottom-color: var(--accent); }
#topinfo { position: absolute; top: 38px; left: 50%; transform: translateX(-50%); display: flex; gap: 8px; align-items: stretch; }
.teamcount { min-width: 60px; text-align: center; background: var(--panel); border-radius: 8px; padding: 2px 8px; border-bottom: 3px solid; }
.teamcount b { font-size: 22px; display: block; line-height: 1.1; } .teamcount span { font-size: 10px; letter-spacing: 2px; color: var(--muted); }
.teamcount.blue { border-color: var(--blue); } .teamcount.red { border-color: var(--red); }
#zoneinfo { background: var(--panel); border-radius: 8px; padding: 3px 12px; text-align: center; min-width: 96px; }
#zonephase { font-size: 11px; letter-spacing: 2px; color: var(--muted); font-weight: 700; } #zonetime { font-size: 20px; font-weight: 800; }
#zoneinfo.shrink #zonetime { color: #7fc0ff; }
#killcount { position: absolute; top: 44px; right: calc(206px + var(--safe-r)); background: var(--panel); padding: 4px 10px; border-radius: 8px; font-size: 18px; }
#killcount b { color: var(--accent); }
#minimap { position: absolute; top: 10px; right: calc(12px + var(--safe-r)); width: 180px; height: 180px; border-radius: 12px; border: 2px solid rgba(255,255,255,0.25); background: #1d2a1a; box-shadow: 0 4px 16px rgba(0,0,0,0.4); }
#squad { position: absolute; left: calc(12px + var(--safe-l)); top: 70px; display: flex; flex-direction: column; gap: 5px; }
.sq { display: flex; align-items: center; gap: 6px; background: var(--panel); border-radius: 7px; padding: 3px 8px; min-width: 150px; font-size: 14px; font-weight: 700; }
.sq .hp { flex: 1; height: 5px; background: rgba(255,255,255,0.15); border-radius: 3px; overflow: hidden; } .sq .hp i { display: block; height: 100%; background: #6be08a; }
.sq.dead { opacity: 0.45; text-decoration: line-through; } .sq.me { border-left: 3px solid var(--accent); }
#killfeed { position: absolute; right: calc(12px + var(--safe-r)); top: 200px; display: flex; flex-direction: column; gap: 4px; align-items: flex-end; }
.kf { background: rgba(0,0,0,0.5); padding: 3px 10px; border-radius: 6px; font-size: 14px; font-weight: 700; animation: kfin .25s ease-out; }
.kf .w { color: var(--muted); margin: 0 6px; font-size: 12px; } .kf .hs { color: var(--accent); }
@keyframes kfin { from { transform: translateX(30px); opacity: 0; } }
#banner { position: absolute; top: 24%; left: 50%; transform: translateX(-50%); font-size: 34px; font-weight: 800; letter-spacing: 4px; text-align: center; color: #fff; opacity: 0; transition: opacity .25s; white-space: nowrap; }
#banner.show { opacity: 1; } #banner small { display: block; font-size: 16px; letter-spacing: 2px; color: var(--accent); }
#toast { position: absolute; bottom: 140px; left: 50%; transform: translateX(-50%); background: var(--panel); padding: 5px 14px; border-radius: 8px; font-weight: 700; opacity: 0; transition: opacity .2s; }
#toast.show { opacity: 1; }
#crosshair { position: absolute; left: 50%; top: 50%; width: 0; height: 0; --g: 8px; }
#crosshair i { position: absolute; background: #fff; box-shadow: 0 0 2px #000; transition: transform .05s; }
#crosshair .t, #crosshair .b { width: 2px; height: 8px; left: -1px; } #crosshair .l, #crosshair .r { height: 2px; width: 8px; top: -1px; }
#crosshair .t { top: calc(-8px - var(--g)); } #crosshair .b { top: var(--g); } #crosshair .l { left: calc(-8px - var(--g)); } #crosshair .r { left: var(--g); }
#crosshair .dot { width: 3px; height: 3px; left: -1.5px; top: -1.5px; border-radius: 50%; background: var(--accent); }
#hitmarker { position: absolute; left: 50%; top: 50%; width: 26px; height: 26px; margin: -13px; opacity: 0; transition: opacity .12s;
  background: linear-gradient(45deg, transparent 45%, #fff 45%, #fff 55%, transparent 55%), linear-gradient(-45deg, transparent 45%, #fff 45%, #fff 55%, transparent 55%);
  mask: radial-gradient(circle, transparent 5px, #000 6px); -webkit-mask: radial-gradient(circle, transparent 5px, #000 6px); }
#hitmarker.show { opacity: 1; } #hitmarker.head { filter: drop-shadow(0 0 3px var(--accent)) sepia(1) saturate(8) hue-rotate(-10deg); } #hitmarker.kill { filter: sepia(1) saturate(10) hue-rotate(-50deg); transform: scale(1.4); }
#dmgdir { position: absolute; left: 50%; top: 50%; width: 220px; height: 220px; margin: -110px; border-radius: 50%; opacity: 0; transition: opacity .5s;
  background: conic-gradient(from -20deg, rgba(255,40,40,0.75) 0deg, transparent 40deg, transparent 360deg); mask: radial-gradient(circle, transparent 92px, #000 96px, #000 104px, transparent 108px); -webkit-mask: radial-gradient(circle, transparent 92px, #000 96px, #000 104px, transparent 108px); }
#vignette { position: absolute; inset: 0; opacity: 0; background: radial-gradient(ellipse at center, transparent 50%, rgba(200,0,0,0.55) 100%); transition: opacity .3s; }
#zonetint { position: absolute; inset: 0; opacity: 0; background: radial-gradient(ellipse at center, rgba(60,120,255,0.05) 40%, rgba(60,120,255,0.45) 100%); transition: opacity .5s; }
#scope { position: absolute; inset: 0; opacity: 0; pointer-events: none; background: radial-gradient(circle at center, transparent 0, transparent 34vmin, #000 34.4vmin); transition: opacity .1s; }
#scope.show { opacity: 1; }
#scope .reticle { position: absolute; left: 50%; top: 50%; width: 68vmin; height: 68vmin; transform: translate(-50%, -50%);
  background: linear-gradient(#000, #000) center/100% 2px no-repeat, linear-gradient(#000, #000) center/2px 100% no-repeat; }
#scope .reticle::after { content: ''; position: absolute; left: 50%; top: 50%; width: 6px; height: 6px; margin: -3px; border-radius: 50%; background: #ff2a2a; }
#progress { position: absolute; left: 50%; top: 62%; transform: translateX(-50%); display: flex; align-items: center; gap: 8px; background: var(--panel); padding: 4px 12px 4px 6px; border-radius: 99px; font-weight: 700; }
#progress svg { width: 30px; height: 30px; transform: rotate(-90deg); } #progress circle { fill: none; stroke: rgba(255,255,255,0.2); stroke-width: 4; }
#progress #progArc { stroke: var(--accent); stroke-dasharray: 106.8; stroke-dashoffset: 106.8; }
#bottom { position: absolute; left: 50%; bottom: calc(12px + var(--safe-b)); transform: translateX(-50%); display: flex; align-items: flex-end; gap: 14px; }
#vitals { width: 230px; display: flex; flex-direction: column; gap: 4px; }
#vitals .armor { height: 6px; background: rgba(255,255,255,0.12); border-radius: 3px; overflow: hidden; } #armorFill { display: block; height: 100%; background: #6fb7ff; width: 0; transition: width .2s; }
#vitals .health { position: relative; height: 18px; background: rgba(0,0,0,0.45); border-radius: 5px; overflow: hidden; border: 1px solid rgba(255,255,255,0.18); }
#hpFill { display: block; height: 100%; width: 100%; background: linear-gradient(180deg, #8ff0a4, #2fbf55); transition: width .15s; }
#hpFill.low { background: linear-gradient(180deg, #ff8a8a, #e02b2b); }
#hpTxt { position: absolute; inset: 0; text-align: center; font-weight: 800; font-size: 14px; line-height: 17px; }
#slots { display: flex; gap: 6px; }
.slot { width: 92px; height: 50px; border-radius: 9px; background: var(--panel); border: 1px solid var(--line); display: flex; flex-direction: column; align-items: center; justify-content: center; font-weight: 700; font-size: 14px; position: relative; pointer-events: auto; transition: all .15s; }
.slot small { font-size: 10px; color: var(--muted); letter-spacing: 1px; } .slot.sel { border-color: var(--accent); background: rgba(255,178,30,0.2); transform: translateY(-3px); }
.slot.empty { opacity: 0.4; } .slot .k { position: absolute; top: 2px; left: 6px; font-size: 10px; color: var(--muted); }
#ammo { min-width: 96px; text-align: right; } #ammo b { font-size: 38px; line-height: 1; } #ammo span { font-size: 18px; color: var(--muted); margin-left: 4px; } #ammo em { display: block; font-style: normal; font-size: 13px; color: var(--accent); letter-spacing: 2px; }
#ammo.empty b { color: var(--red); }
#spectate { position: absolute; left: 50%; bottom: 100px; transform: translateX(-50%); text-align: center; background: var(--panel); padding: 8px 18px; border-radius: 12px; }
#spectate span { display: block; font-size: 11px; letter-spacing: 3px; color: var(--muted); } #spectate b { font-size: 22px; } #spectate small { display: block; color: var(--muted); }
#pickup { position: absolute; left: 50%; top: 60%; transform: translateX(-50%); background: var(--panel); border: 1px solid var(--accent); border-radius: 10px; padding: 6px 12px; font-weight: 700; font-size: 16px; display: flex; gap: 10px; align-items: center; }
kbd { background: #fff; color: #000; border-radius: 4px; padding: 0 6px; font-family: inherit; font-weight: 800; }
#dmglayer { position: absolute; inset: 0; overflow: hidden; }
.dmgnum { position: absolute; left: 0; top: 0; font-size: 22px; font-weight: 800; color: #fff; text-shadow: 0 0 3px #000, 0 2px 4px #000; will-change: transform; }
.dmgnum.head { color: #ffcf3a; font-size: 26px; } .dmgnum.kill { color: #ff5a3a; font-size: 30px; }
#score { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); background: rgba(8,12,20,0.88); border: 1px solid var(--line); border-radius: 14px; padding: 14px 18px; display: grid; grid-template-columns: 1fr 1fr; gap: 18px; min-width: min(560px, 90vw); }
#score h3 { margin: 0 0 6px; font-size: 16px; letter-spacing: 2px; } #score .row { display: flex; justify-content: space-between; font-size: 15px; padding: 2px 0; border-bottom: 1px solid rgba(255,255,255,0.05); } #score .dead { opacity: 0.45; }
#pausehint { position: absolute; left: 50%; top: 40%; transform: translateX(-50%); background: var(--panel); padding: 10px 18px; border-radius: 10px; font-weight: 700; font-size: 18px; }

/* ---------- touch controls ---------- */
#touch { position: fixed; inset: 0; z-index: 11; touch-action: none; }
#joyBase { position: absolute; left: calc(18% + var(--safe-l)); top: 70%; width: 130px; height: 130px; margin: -65px; border-radius: 50%; background: radial-gradient(circle, rgba(255,255,255,0.08), rgba(255,255,255,0.03)); border: 2px solid rgba(255,255,255,0.25); transition: opacity .2s; opacity: 0.6; }
#joyBase.active { opacity: 1; }
#joyKnob { position: absolute; left: 50%; top: 50%; width: 58px; height: 58px; margin: -29px; border-radius: 50%; background: radial-gradient(circle at 35% 30%, rgba(255,255,255,0.75), rgba(255,255,255,0.3)); box-shadow: 0 2px 10px rgba(0,0,0,0.4); }
.tb { position: absolute; width: 58px; height: 58px; border-radius: 50%; border: 2px solid rgba(255,255,255,0.35); background: rgba(10,14,22,0.42); color: #fff; font-size: 22px; font-weight: 800; backdrop-filter: blur(4px);
  transition: transform .08s ease-out, background .08s; display: flex; align-items: center; justify-content: center; padding: 0; touch-action: none; }
.tb.down { transform: scale(0.88); background: rgba(255,178,30,0.45); border-color: var(--accent); }
.tb small { position: absolute; right: 2px; bottom: 0; font-size: 12px; background: var(--accent); color: #000; border-radius: 8px; padding: 0 4px; }
.tb.big { width: 92px; height: 92px; background: radial-gradient(circle at 40% 35%, rgba(255,90,60,0.55), rgba(140,20,10,0.55)); border-color: rgba(255,140,120,0.7); }
.tb.big span { font-size: 16px; letter-spacing: 1px; }
.tb.on { background: rgba(255,178,30,0.38); border-color: var(--accent); }
#tFire { right: calc(9% + var(--safe-r)); bottom: calc(18% + var(--safe-b)); }
#tFireL { left: calc(4% + var(--safe-l)); top: 38%; }
#tAds { right: calc(4% + var(--safe-r)); bottom: calc(42% + var(--safe-b)); }
#tJump { right: calc(2.5% + var(--safe-r)); bottom: calc(10% + var(--safe-b)); }
#tCrouch { right: calc(19% + var(--safe-r)); bottom: calc(6% + var(--safe-b)); }
#tReload { right: calc(19% + var(--safe-r)); bottom: calc(31% + var(--safe-b)); width: 48px; height: 48px; font-size: 19px; }
#tHeal { right: calc(29% + var(--safe-r)); bottom: calc(27% + var(--safe-b)); width: 50px; height: 50px; color: #ff5a5a; }
#tView { right: calc(13% + var(--safe-r)); top: 215px; width: 50px; height: 34px; border-radius: 9px; font-size: 13px; }
#tMap { right: calc(4% + var(--safe-r)); top: 215px; width: 50px; height: 34px; border-radius: 9px; font-size: 13px; }
#tPick { left: 50%; top: 66%; transform: translateX(-50%); width: auto; height: 42px; padding: 0 16px; border-radius: 10px; font-size: 16px; border-color: var(--accent); }
#tPick.down { transform: translateX(-50%) scale(0.92); }
body.touch #minimap { width: 128px; height: 128px; }
body.touch #killcount { right: calc(150px + var(--safe-r)); }
body.touch #killfeed { top: 140px; }
body.touch #bottom { bottom: calc(6px + var(--safe-b)); gap: 8px; }
body.touch #vitals { width: 170px; }
body.touch .slot { width: 72px; height: 42px; font-size: 12px; }
body.touch #ammo b { font-size: 28px; }
body.touch #squad { top: 60px; } body.touch .sq { min-width: 120px; font-size: 12px; }
body.touch #pickup { display: none !important; }

/* ---------- results / modals ---------- */
#results { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; background: radial-gradient(ellipse at center, rgba(20,28,44,0.85), rgba(3,5,9,0.96)); padding: 20px; overflow-y: auto; }
.res-title { font-size: clamp(44px, 9vw, 92px); font-weight: 800; font-style: italic; letter-spacing: 6px; background: linear-gradient(180deg, #fff, var(--accent) 60%, var(--accent2)); -webkit-background-clip: text; background-clip: text; color: transparent; animation: pop .5s cubic-bezier(.2,1.6,.4,1); }
.res-title.lose { background: linear-gradient(180deg, #fff, #9aa6b8); -webkit-background-clip: text; background-clip: text; }
@keyframes pop { from { transform: scale(0.4); opacity: 0; } }
.res-me { display: flex; gap: 10px; } .res-me div { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 8px 16px; text-align: center; } .res-me b { display: block; font-size: 26px; color: var(--accent); } .res-me span { font-size: 12px; color: var(--muted); letter-spacing: 2px; }
.res-table { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; width: min(700px, 94vw); }
.res-team h4 { margin: 0 0 4px; letter-spacing: 2px; } .res-team .row { display: flex; justify-content: space-between; padding: 3px 8px; font-size: 15px; background: rgba(255,255,255,0.04); border-radius: 6px; margin-bottom: 3px; }
.res-team .mvp { color: var(--accent); }
.res-btns { display: flex; gap: 12px; margin-top: 8px; }
.modal { position: fixed; inset: 0; z-index: 40; display: flex; align-items: center; justify-content: center; background: rgba(0,0,0,0.55); backdrop-filter: blur(4px); }
.modal-card { background: #121926; border: 1px solid var(--line); border-radius: 16px; padding: 18px 22px; width: min(400px, 92vw); max-height: 90vh; overflow: auto; }
.modal-card.wide { width: min(620px, 94vw); }
.modal-card h2 { margin: 0 0 12px; letter-spacing: 2px; }
.modal-card label { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin: 10px 0; font-weight: 700; }
.modal-card select, .modal-card input[type=range] { width: 55%; } .modal-card select { font: 600 15px var(--font); background: #0b111b; color: #fff; border: 1px solid var(--line); border-radius: 8px; padding: 6px; }
.modal-btns { display: flex; justify-content: flex-end; margin-top: 12px; }
.board-body table { width: 100%; border-collapse: collapse; font-size: 15px; } .board-body th { text-align: left; color: var(--muted); font-size: 12px; letter-spacing: 1px; } .board-body td, .board-body th { padding: 5px 6px; border-bottom: 1px solid rgba(255,255,255,0.06); }
#bigmap { background: rgba(0,0,0,0.6); } #bigmapC { width: min(86vmin, 600px); height: min(86vmin, 600px); border-radius: 14px; border: 2px solid rgba(255,255,255,0.3); }
#rotate { position: fixed; inset: 0; z-index: 60; background: #0b0f17; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; font-size: 20px; font-weight: 700; }
#rotate div { font-size: 54px; animation: spin 2s linear infinite; }
#fps { position: fixed; left: 6px; bottom: 4px; z-index: 50; font: 12px monospace; color: #8f8; text-shadow: 0 0 2px #000; }
#err { position: fixed; left: 10px; top: 10px; z-index: 99; background: #300; color: #fcc; padding: 8px 12px; border-radius: 8px; max-width: 80vw; font-family: monospace; font-size: 12px; }

@media (max-height: 500px) {
  .brand { font-size: 44px; } .menu-left { top: 70px; } .field-label { margin-top: 8px; } .mystats { display: none; }
  .mode-card { padding: 8px 12px; } .mode-title { font-size: 20px; } .play-btn { font-size: 24px; padding: 12px; }
}
@media (max-width: 700px) and (orientation: portrait) { .menu-left, .menu-right { position: static; width: auto; margin: 12px; } #menu { overflow-y: auto; padding-top: 70px; background: rgba(5,8,14,0.7); } }

.modes { display: flex; gap: 6px; margin-top: 8px; }
.mode { flex: 1; padding: 7px 0; border-radius: 9px; border: 1px solid var(--line); background: rgba(0,0,0,0.35); color: #dfe6f0; font: 800 16px var(--font); transition: all .15s; }
.mode:hover { background: rgba(255,178,30,0.15); } .mode:active { transform: scale(0.94); }
.mode.sel { background: linear-gradient(180deg, #ffd35a, var(--accent)); color: #1a1000; border-color: transparent; box-shadow: 0 3px 12px rgba(255,140,20,0.4); }
.mm-mode { font-size: 16px; background: var(--accent); color: #1a1000; border-radius: 6px; padding: 1px 7px; vertical-align: middle; }

#ping { position: absolute; top: 80px; right: calc(206px + var(--safe-r)); background: var(--panel); padding: 3px 9px; border-radius: 8px; font-size: 14px; font-weight: 700; }
#ping .bars { letter-spacing: -1px; margin-right: 5px; font-size: 12px; }
#ping.good { color: #6be08a; } #ping.ok { color: #ffd35a; } #ping.bad { color: #ff6a5a; }
body.touch #ping { right: calc(150px + var(--safe-r)); top: 76px; font-size: 12px; }

/* ---------- game type, custom rooms, loadout ---------- */
.types { display: flex; gap: 6px; margin: 6px 0 2px; }
.gtype { flex: 1; padding: 7px 4px; border-radius: 9px; border: 1px solid var(--line); background: rgba(0,0,0,0.35); color: #cfd8e6; font: 800 13px var(--font); letter-spacing: 1.5px; transition: all .15s; }
.gtype.sel { background: linear-gradient(180deg, rgba(255,211,90,0.95), rgba(255,140,30,0.95)); color: #1a1000; border-color: transparent; }
.gtype:active { transform: scale(0.95); }
.play-row { display: flex; gap: 10px; align-items: stretch; }
.play-row .play-btn { flex: 1; }
.custom-btn { font-size: 15px; letter-spacing: 1.5px; padding: 0 14px; border-color: rgba(255,178,30,0.5); }
.custom-card { width: min(760px, 96vw); }
.custom-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.custom-col { display: flex; flex-direction: column; gap: 9px; }
.custom-col h3 { margin: 0; font-size: 15px; letter-spacing: 3px; color: var(--accent); }
.text-in { width: 100%; font: 700 17px var(--font); color: #fff; background: rgba(0,0,0,0.45); border: 1px solid var(--line); border-radius: 10px; padding: 9px 12px; outline: none; user-select: text; -webkit-user-select: text; }
.text-in:focus { border-color: var(--accent); }
.code-in { text-transform: uppercase; letter-spacing: 6px; text-align: center; font-size: 22px; }
.join-row { display: flex; gap: 8px; } .join-row .play-btn { white-space: nowrap; }
.toggles { display: flex; gap: 6px; flex-wrap: wrap; }
.toggle { flex: 1; min-width: 90px; padding: 8px 6px; border-radius: 9px; border: 1px solid var(--line); background: rgba(0,0,0,0.35); color: #9aa6b8; font: 800 12px var(--font); letter-spacing: 1px; }
.toggle.on { color: #6be08a; border-color: rgba(107,224,138,0.6); background: rgba(107,224,138,0.12); }
.ghost-btn.tiny { padding: 4px 10px; font-size: 13px; border-radius: 8px; }
.list-head { display: flex; justify-content: space-between; align-items: center; font-weight: 700; color: var(--muted); font-size: 13px; letter-spacing: 1px; }
.room-list { display: flex; flex-direction: column; gap: 6px; max-height: 230px; overflow-y: auto; }
.room-row { display: flex; justify-content: space-between; align-items: center; text-align: left; padding: 8px 12px; border-radius: 10px; border: 1px solid var(--line); background: rgba(255,255,255,0.05); color: #fff; font-family: var(--font); transition: background .15s; }
.room-row:hover { background: rgba(255,178,30,0.15); } .room-row small { display: block; color: var(--muted); font-size: 12px; } .room-row b { font-size: 15px; }
.room-row .rc { font-weight: 800; color: var(--accent); }
#clobby { display: flex; align-items: center; justify-content: center; background: rgba(4,6,10,0.6); backdrop-filter: blur(3px); }
.cl-card { min-width: min(460px, 92vw); }
.cl-code-row { display: flex; align-items: center; justify-content: center; gap: 10px; }
.cl-code-row b { font-size: 34px; letter-spacing: 8px; color: var(--accent); }
.cl-players { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin: 8px 0; text-align: left; }
.cl-p { background: rgba(255,255,255,0.06); border-radius: 8px; padding: 6px 10px; font-weight: 700; display: flex; gap: 6px; align-items: center; }
.crown { font-size: 10px; background: var(--accent); color: #1a1000; border-radius: 5px; padding: 1px 5px; letter-spacing: 1px; }
.cl-note { font-size: 13px; color: #ffd35a; max-width: 420px; margin: 0 auto; }
#loadout { position: fixed; left: 50%; top: 18%; transform: translateX(-50%); z-index: 12; text-align: center; background: rgba(8,12,20,0.78); border: 1px solid rgba(255,178,30,0.45); border-radius: 16px; padding: 10px 14px; backdrop-filter: blur(6px); }
.lo-title { font-weight: 800; letter-spacing: 3px; font-size: 14px; color: var(--accent); margin-bottom: 8px; }
.lo-row { display: flex; gap: 8px; }
.lo-btn { min-width: 96px; padding: 10px 8px; border-radius: 12px; border: 2px solid rgba(255,255,255,0.15); background: rgba(255,255,255,0.06); color: #fff; font-family: var(--font); transition: all .12s; }
.lo-btn b { display: block; font-size: 18px; } .lo-btn small { color: var(--muted); letter-spacing: 1px; }
.lo-btn.sel { border-color: var(--c); background: color-mix(in srgb, var(--c) 30%, transparent); transform: translateY(-2px); }
.lo-btn:active { transform: scale(0.95); }
#zonephase b.sa { color: var(--blue); font-size: 14px; } #zonephase b.sb { color: var(--red); font-size: 14px; }
#ping small { margin-left: 6px; font-size: 10px; opacity: 0.75; letter-spacing: 1px; }

/* ---------- mobile buttons: crisp SVG icons, glassy look, press feedback ---------- */
.tb svg { width: 52%; height: 52%; filter: drop-shadow(0 1px 2px rgba(0,0,0,0.6)); pointer-events: none; }
.tb { background: radial-gradient(circle at 35% 30%, rgba(255,255,255,0.18), rgba(10,14,22,0.5) 70%); border: 2px solid rgba(255,255,255,0.4); box-shadow: 0 3px 12px rgba(0,0,0,0.35), inset 0 1px 0 rgba(255,255,255,0.2); }
.tb.big { background: radial-gradient(circle at 35% 30%, rgba(255,130,90,0.85), rgba(170,30,15,0.75) 70%); border-color: rgba(255,190,170,0.85); box-shadow: 0 4px 18px rgba(255,60,30,0.45), inset 0 2px 0 rgba(255,255,255,0.3); }
.tb.big svg { width: 46%; height: 46%; }
.tb.down { transform: scale(0.86); filter: brightness(1.25); }
.tb.pill-btn { width: 58px; height: 38px; border-radius: 11px; gap: 3px; flex-direction: column; font-size: 9px; letter-spacing: 1px; }
.tb.pill-btn svg { width: 20px; height: 20px; } .tb .lbl { pointer-events: none; font-size: 10px; font-weight: 800; }
#tPick { flex-direction: row; gap: 6px; } #tPick svg { width: 22px; height: 22px; }
#tView { top: 208px; } #tMap { top: 208px; }
#rotate { cursor: pointer; } #rotate .rot-ico { font-size: 54px; animation: rot 2s ease-in-out infinite; }
@keyframes rot { 0%, 30% { transform: rotate(0); } 60%, 100% { transform: rotate(-90deg); } }
@media (max-width: 760px) { .custom-cols { grid-template-columns: 1fr; } .play-row { flex-direction: row; } }
@media (max-height: 500px) { .custom-card { padding: 12px 16px; } .room-list { max-height: 140px; } #loadout { top: 12%; } .lo-btn { min-width: 80px; padding: 6px; } .lo-btn b { font-size: 15px; } }
body.touch #bottom { left: 43%; }
body.touch #tView, body.touch #tMap { top: 146px; }
body.touch #tView { right: calc(4% + 64px + var(--safe-r)); } body.touch #tMap { right: calc(4% + var(--safe-r)); }

#netwarn { position: fixed; top: 64px; left: 50%; transform: translateX(-50%); z-index: 45; max-width: min(640px, 92vw); background: rgba(120,20,20,0.92); border: 1px solid #ff6a5a; color: #fff; border-radius: 12px; padding: 10px 14px; font-size: 14px; text-align: center; }
#netwarn code { background: rgba(0,0,0,0.35); padding: 0 4px; border-radius: 4px; }

/* =========================================================
   UI v2 – mode tiles, custom room modal with tabs, team lobby
   ========================================================= */
.seg-label { font-size: 11px; letter-spacing: 2.5px; color: var(--muted); font-weight: 800; margin: 8px 0 4px; }
.mode-card { padding: 12px 14px; }
.mode-tag { margin-bottom: 4px; }
.types.tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 4px 0 0; }
.types.tiles .gtype { display: flex; align-items: center; gap: 10px; text-align: left; padding: 10px 10px; border-radius: 12px;
  background: linear-gradient(160deg, rgba(255,255,255,0.08), rgba(0,0,0,0.35)); border: 1.5px solid rgba(255,255,255,0.14); color: #dfe6f0; letter-spacing: 0; }
.types.tiles .gtype .gi { flex: none; width: 40px; height: 40px; border-radius: 10px; display: grid; place-items: center; background: rgba(0,0,0,0.35); color: var(--accent); transition: all .15s; }
.types.tiles .gtype .gt b { display: block; font-size: 15px; letter-spacing: 1.5px; } .types.tiles .gtype .gt small { display: block; font-size: 12px; color: var(--muted); font-weight: 600; }
.types.tiles .gtype:hover { border-color: rgba(255,178,30,0.55); }
.types.tiles .gtype.sel { background: linear-gradient(160deg, rgba(255,190,60,0.35), rgba(255,110,20,0.18)); border-color: var(--accent); color: #fff; box-shadow: 0 0 0 3px rgba(255,178,30,0.15), 0 6px 18px rgba(255,120,20,0.25); }
.types.tiles .gtype.sel .gi { background: linear-gradient(180deg, #ffd35a, var(--accent2)); color: #1a1000; }
.types.tiles .gtype.sel .gt small { color: #ffe2a8; }
.types.tiles.small-tiles .gtype { padding: 8px; } .types.tiles.small-tiles .gtype .gi { width: 34px; height: 34px; }
.modes .mode { padding: 8px 0; }
.mode-foot { display: flex; flex-direction: column; margin-top: 8px; padding-top: 8px; border-top: 1px solid rgba(255,255,255,0.08); }
.mode-foot .mode-title { font-size: 20px; } .mode-foot .mode-sub { font-size: 13px; }
.custom-btn { display: flex; align-items: center; justify-content: center; gap: 8px; min-width: 150px; color: var(--accent); }
.custom-btn svg { flex: none; }

/* custom room modal */
.custom-card { padding: 14px 18px 16px; }
.cm-head { display: flex; align-items: center; gap: 14px; margin-bottom: 6px; }
.cm-head h2 { margin: 0; flex: 1; }
.tabs { display: flex; background: rgba(0,0,0,0.4); border-radius: 11px; padding: 3px; gap: 3px; }
.tab { padding: 7px 18px; border: 0; border-radius: 9px; background: transparent; color: var(--muted); font: 800 14px var(--font); letter-spacing: 2px; transition: all .15s; }
.tab.sel { background: linear-gradient(180deg, #ffd35a, var(--accent)); color: #1a1000; }
.x-btn { width: 36px; height: 36px; border-radius: 10px; border: 1px solid var(--line); background: rgba(255,255,255,0.06); color: #fff; font-size: 16px; }
.custom-cols { display: block; }
.custom-card[data-tab="create"] [data-pane="join"], .custom-card[data-tab="join"] [data-pane="create"] { display: none; }
.custom-col { gap: 4px; }
.custom-col .play-btn { margin-top: 10px; }
.hint-host { margin: 6px 0 0; }
.code-in { font-size: 26px; letter-spacing: 10px; }
.room-list { max-height: 240px; margin-top: 4px; }
.room-row { padding: 10px 12px; }
.room-row .rc { background: rgba(255,178,30,0.15); border-radius: 8px; padding: 2px 8px; }

/* team lobby */
#clobby { background: radial-gradient(ellipse at center, rgba(16,22,34,0.85), rgba(3,5,9,0.92)); }
.cl-wrap { width: min(820px, 96vw); max-height: 96vh; overflow-y: auto; display: flex; flex-direction: column; gap: 12px; padding: 14px 18px; background: rgba(10,14,22,0.75); border: 1px solid var(--line); border-radius: 18px; backdrop-filter: blur(8px); }
.cl-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.cl-title { font-size: 26px; font-weight: 800; }
.cl-code { text-align: center; background: rgba(0,0,0,0.4); border: 1px dashed rgba(255,178,30,0.6); border-radius: 14px; padding: 6px 14px; }
.cl-code span { font-size: 10px; letter-spacing: 3px; color: var(--muted); font-weight: 800; }
.cl-code b { display: block; font-size: 32px; letter-spacing: 8px; color: var(--accent); line-height: 1.1; }
.cl-code-btns { display: flex; gap: 6px; justify-content: center; margin-top: 4px; }
.cl-teams { display: grid; grid-template-columns: 1fr auto 1fr; gap: 10px; align-items: start; }
.cl-vs { align-self: center; font-size: 28px; font-weight: 800; font-style: italic; color: var(--accent); text-shadow: 0 0 18px rgba(255,140,20,0.5); }
.cl-team { border-radius: 14px; padding: 8px; background: rgba(255,255,255,0.03); border: 1px solid rgba(255,255,255,0.08); }
.cl-team.blue { border-top: 3px solid var(--blue); } .cl-team.red { border-top: 3px solid var(--red); }
.cl-th { font-size: 12px; letter-spacing: 3px; font-weight: 800; margin: 2px 4px 8px; }
.cl-team.blue .cl-th { color: var(--blue); } .cl-team.red .cl-th { color: var(--red); }
.cl-slots { display: flex; flex-direction: column; gap: 6px; }
.cl-slot { display: flex; align-items: center; gap: 8px; padding: 7px 9px; border-radius: 10px; background: rgba(255,255,255,0.06); font-weight: 700; font-size: 15px; }
.cl-slot .av { width: 28px; height: 28px; border-radius: 8px; display: grid; place-items: center; font-weight: 800; background: rgba(255,255,255,0.12); font-size: 14px; }
.cl-team.blue .cl-slot.filled .av { background: rgba(47,155,255,0.35); } .cl-team.red .cl-slot.filled .av { background: rgba(255,61,61,0.35); }
.cl-slot .nm { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cl-slot.empty { background: transparent; border: 1px dashed rgba(255,255,255,0.14); color: var(--muted); font-weight: 600; }
.cl-slot.me { box-shadow: inset 0 0 0 1.5px var(--accent); }
.cl-slot .you { font-size: 10px; background: #fff; color: #000; border-radius: 5px; padding: 1px 5px; letter-spacing: 1px; }
.cl-note { font-size: 13px; color: #ffd35a; text-align: center; }
.cl-btns { display: flex; gap: 10px; justify-content: center; }
.cl-btns .play-btn { min-width: 200px; }
@media (max-height: 500px) {
  .cl-wrap { padding: 10px 14px; gap: 8px; } .cl-title { font-size: 20px; } .cl-code b { font-size: 24px; }
  .cl-slot { padding: 4px 8px; font-size: 13px; } .cl-slot .av { width: 22px; height: 22px; }
  .types.tiles .gtype { padding: 6px 8px; } .types.tiles .gtype .gi { width: 30px; height: 30px; } .types.tiles .gtype .gt small { display: none; }
  .mode-foot .mode-sub { display: none; } .mode-foot { margin-top: 4px; padding-top: 4px; } .seg-label { margin: 4px 0 2px; }
  .custom-card { padding: 10px 14px; } .room-list { max-height: 150px; }
}

.types.tiles .gtype .gt b { font-size: 14px; letter-spacing: 1px; white-space: nowrap; }
.types.tiles .gtype .gt small { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.types.tiles .gtype .gt { min-width: 0; }
.custom-btn span { white-space: nowrap; }
.menu-right { width: min(400px, 46vw); }
