:root {
  --gold: #ffcb3d;
  --gold2: #ff9f1c;
  --blue: #3d8bff;
  --red: #ff4646;
  --ink: #0f1020;
  --panel: rgba(16, 17, 34, 0.86);
  --text: #f4f1e6;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #10121f; color: var(--text); font-family: Rubik, system-ui, sans-serif; user-select: none; -webkit-user-select: none; touch-action: none; }
#c { position: fixed; inset: 0; width: 100%; height: 100%; display: block; }
.hidden { display: none !important; }

#loading { position: fixed; inset: 0; display: grid; place-items: center; font: 42px Bangers, sans-serif; letter-spacing: 2px; color: var(--gold); background: #10121f; z-index: 50; }

/* ---------- overlays ---------- */
.overlay { position: fixed; inset: 0; display: flex; align-items: flex-start; justify-content: center; overflow-y: auto; padding: 16px; z-index: 20; background: linear-gradient(180deg, rgba(10,10,25,.25), rgba(10,10,25,.55)); }
.panel { width: min(1060px, 100%); margin: auto 0; background: var(--panel); border: 2px solid rgba(255, 203, 61, .35); border-radius: 22px; padding: 18px 22px 20px; box-shadow: 0 20px 60px rgba(0,0,0,.5), inset 0 0 0 1px rgba(255,255,255,.04); backdrop-filter: blur(6px); }
.panel.small { width: min(440px, 100%); text-align: center; }
.logo { font-family: Bangers, sans-serif; font-weight: 400; font-size: clamp(48px, 8vw, 86px); letter-spacing: 3px; margin: 0; line-height: 1; text-align: center; color: var(--blue); text-shadow: 0 4px 0 #0b2a66, 0 8px 18px rgba(0,0,0,.5); }
.logo span { color: var(--red); text-shadow: 0 4px 0 #6b0f0f, 0 8px 18px rgba(0,0,0,.5); }
.tag { text-align: center; margin: 6px 0 4px; color: var(--gold); font-weight: 600; }
h2 { font: 44px Bangers, sans-serif; letter-spacing: 2px; margin: 4px 0 14px; color: var(--gold); }
h3 { margin: 16px 0 8px; font-size: 15px; text-transform: uppercase; letter-spacing: 1.5px; color: #ffe9a8; }
h3 small { text-transform: none; letter-spacing: 0; color: #b9b3a0; font-weight: 400; }

.cards { display: grid; grid-template-columns: repeat(6, 1fr); gap: 10px; }
.cards.maps { grid-template-columns: repeat(5, 1fr); }
.card { background: rgba(255,255,255,.05); border: 2px solid rgba(255,255,255,.08); border-radius: 14px; padding: 8px; cursor: pointer; transition: transform .12s, border-color .12s, background .12s; text-align: center; min-width: 0; }
.card:hover { transform: translateY(-2px); border-color: rgba(255,203,61,.5); }
.card.sel { border-color: var(--gold); background: rgba(255, 203, 61, .14); box-shadow: 0 0 0 3px rgba(255,203,61,.18); }
.card img { width: 100%; aspect-ratio: 150 / 190; object-fit: cover; border-radius: 10px; display: block; background: #1b1d2b; }
.card .nm { font-weight: 800; margin-top: 6px; font-size: 15px; }
.card .ti { font-size: 12px; color: #c8c2ad; }
.card .st { font-size: 11px; color: #9fe39a; margin-top: 3px; }
.card .em { font-size: 40px; line-height: 1.2; }
.card .ds { font-size: 12px; color: #c8c2ad; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { padding: 8px 12px; border-radius: 999px; background: rgba(255,255,255,.06); border: 2px solid rgba(255,255,255,.08); cursor: pointer; font-weight: 600; font-size: 14px; }
.chip.sel { border-color: var(--gold); background: rgba(255,203,61,.16); }
.chip small { color: #c8c2ad; font-weight: 400; }
.chip img { height: 24px; width: 48px; object-fit: contain; vertical-align: middle; margin-right: 4px; border-radius: 6px; background: #1b1d2b; }

.row { display: flex; flex-wrap: wrap; gap: 14px; align-items: center; margin-top: 16px; }
label { font-weight: 600; display: flex; gap: 8px; align-items: center; }
select { background: #24263a; color: var(--text); border: 1px solid #444; border-radius: 8px; padding: 6px 8px; font: inherit; }
button { font-family: Bangers, sans-serif; font-size: 30px; letter-spacing: 2px; padding: 8px 28px; border-radius: 14px; border: 0; cursor: pointer; color: #2a1600; background: linear-gradient(180deg, #ffe27a, var(--gold2)); box-shadow: 0 5px 0 #a35b00, 0 10px 22px rgba(0,0,0,.35); transition: transform .08s; }
button:active { transform: translateY(3px); box-shadow: 0 2px 0 #a35b00; }
button.ghost { background: rgba(255,255,255,.08); color: var(--text); box-shadow: none; font-size: 22px; }
#play { margin-left: auto; font-size: 38px; }
button.small { font: 600 14px Rubik, sans-serif; letter-spacing: 0; padding: 7px 12px; border-radius: 10px; }
input[type=range] { accent-color: var(--gold); width: 110px; }
.panel.small button { display: block; width: 100%; margin: 10px 0; }
.help { margin-top: 14px; font-size: 13.5px; line-height: 1.55; color: #d6d0bb; background: rgba(0,0,0,.25); padding: 10px 12px; border-radius: 12px; }
.blue { color: var(--blue); font-weight: 800; }
.red { color: var(--red); font-weight: 800; }
body.touch #helpDesk, body:not(.touch) #helpTouch { display: none; }

/* ---------- HUD ---------- */
#hud { position: fixed; inset: 0; pointer-events: none; z-index: 10; }
#minimap { position: absolute; left: 14px; top: 14px; width: 220px; height: 130px; border-radius: 12px; border: 2px solid rgba(255,255,255,.25); background: rgba(0,0,0,.35); }
#score { position: absolute; top: 12px; left: 50%; transform: translateX(-50%); display: flex; gap: 10px; align-items: center; font: 30px Bangers, sans-serif; letter-spacing: 1.5px; }
#score .team { padding: 4px 14px; border-radius: 12px; background: rgba(0,0,0,.45); display: flex; gap: 8px; align-items: center; }
#score .team.blue { color: #8fbcff; border-bottom: 4px solid var(--blue); }
#score .team.red { color: #ff9a9a; border-bottom: 4px solid var(--red); }
#score b { color: #fff; font-weight: 400; font-size: 36px; }
#score .vs { font: 600 12px Rubik, sans-serif; color: #fff; opacity: .8; text-transform: uppercase; }
.ficon { font-size: 24px; transition: opacity .2s; }
.ficon.away { animation: blink .5s infinite alternate; }
.ficon.dropped { opacity: .45; }
@keyframes blink { to { opacity: .2; } }
#feed { position: absolute; right: 14px; top: 14px; display: flex; flex-direction: column; gap: 4px; align-items: flex-end; font-size: 14px; font-weight: 600; }
#feed div { background: rgba(0,0,0,.5); padding: 4px 10px; border-radius: 8px; animation: fadein .2s; }
@keyframes fadein { from { opacity: 0; transform: translateX(20px); } }
#cross { position: absolute; left: 50%; top: 50%; width: 0; height: 0; }
#cross i { position: absolute; background: #fff; box-shadow: 0 0 2px #000; }
#cross i:nth-child(1) { width: 2px; height: 9px; left: -1px; top: -16px; }
#cross i:nth-child(2) { width: 2px; height: 9px; left: -1px; top: 7px; }
#cross i:nth-child(3) { width: 9px; height: 2px; left: -16px; top: -1px; }
#cross i:nth-child(4) { width: 9px; height: 2px; left: 7px; top: -1px; }
#hitm { position: absolute; left: -11px; top: -17px; font: 800 24px Rubik; color: #ff4; opacity: 0; text-shadow: 0 0 4px #000; }
#banner { position: absolute; top: 22%; left: 50%; transform: translateX(-50%); font: 44px Bangers, sans-serif; letter-spacing: 2px; text-align: center; text-shadow: 0 3px 0 #000, 0 0 20px rgba(0,0,0,.6); opacity: 0; transition: opacity .25s; white-space: nowrap; }
#banner.show { opacity: 1; }
#status { position: absolute; left: 14px; bottom: 14px; width: 280px; background: rgba(0,0,0,.45); padding: 10px 12px; border-radius: 14px; }
#pname { font-weight: 800; margin-bottom: 6px; }
.bar { position: relative; height: 18px; border-radius: 9px; background: rgba(255,255,255,.15); overflow: hidden; }
#hpfill { height: 100%; width: 100%; background: linear-gradient(90deg, #3ddc84, #9cff6e); transition: width .15s; }
#hptext { position: absolute; inset: 0; font-size: 12px; font-weight: 800; text-align: center; line-height: 18px; text-shadow: 0 1px 2px #000; }
#money { margin-top: 6px; font-weight: 800; color: var(--gold); font-size: 18px; }
#weapon { position: absolute; right: 14px; bottom: 14px; text-align: right; background: rgba(0,0,0,.45); padding: 10px 12px; border-radius: 14px; min-width: 220px; }
#wname { font: 26px Bangers, sans-serif; letter-spacing: 1.5px; color: var(--gold); }
#ammo { font-size: 28px; font-weight: 800; }
#slots { display: flex; gap: 4px; justify-content: flex-end; margin-top: 6px; }
#slots span { width: 24px; height: 24px; border-radius: 6px; background: rgba(255,255,255,.1); font-size: 12px; font-weight: 800; display: grid; place-items: center; }
#slots span.on { background: var(--gold); color: #2a1600; }
#dead { position: absolute; top: 40%; left: 50%; transform: translateX(-50%); font: 40px Bangers, sans-serif; letter-spacing: 2px; text-align: center; text-shadow: 0 3px 0 #000; background: rgba(0,0,0,.35); padding: 10px 26px; border-radius: 16px; }
#obj { position: absolute; transform: translate(-50%, -100%); text-align: center; font: 15px Bangers, sans-serif; letter-spacing: 1px; text-shadow: 0 2px 0 #000, 0 0 8px rgba(0,0,0,.7); white-space: nowrap; pointer-events: none; }
#obj b { display: block; font-weight: 400; font-size: 17px; }
#obj span { display: inline-block; margin-top: 2px; font: 700 12px Rubik, sans-serif; color: #fff; background: rgba(0,0,0,.45); padding: 1px 7px; border-radius: 8px; }
#obj::after { content: '▼'; display: block; font-size: 14px; line-height: 1; margin-top: 1px; }
#obj.edge { opacity: .85; }
#buffs { margin-top: 4px; font-size: 14px; font-weight: 800; min-height: 0; }
#money .hint { font-size: 11px; color: #bbb; font-weight: 600; }
#dmgnums .dmg { position: absolute; transform: translate(-50%, -50%); font: 22px Bangers, sans-serif; letter-spacing: 1px; text-shadow: 0 2px 0 #000; pointer-events: none; display: none; }
#board { position: absolute; left: 50%; top: 80px; transform: translateX(-50%); display: none; gap: 14px; background: rgba(10,10,25,.82); padding: 12px 16px; border-radius: 16px; border: 1px solid rgba(255,255,255,.15); max-width: calc(100vw - 32px); overflow-x: auto; }
#board.show { display: flex; }
#board table { border-collapse: collapse; font-size: 13px; min-width: 260px; }
#board caption { font: 22px Bangers, sans-serif; letter-spacing: 1.5px; text-align: left; padding-bottom: 4px; }
#board th, #board td { padding: 3px 8px; text-align: left; }
#board th { color: #aaa; font-weight: 600; border-bottom: 1px solid rgba(255,255,255,.15); }
#board tr.me td { color: #ffd34d; font-weight: 800; }
#shop { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); width: min(420px, calc(100vw - 32px)); background: rgba(14,14,30,.92); border: 2px solid rgba(255,203,61,.6); border-radius: 18px; padding: 12px 14px; pointer-events: auto; box-shadow: 0 16px 50px rgba(0,0,0,.5); }
#shop .shead { font: 26px Bangers, sans-serif; letter-spacing: 1.5px; color: var(--gold); margin-bottom: 8px; }
#shop .shead span { color: #fff; margin-left: 6px; }
#shop .shead small { display: block; font: 600 11px Rubik, sans-serif; letter-spacing: 0; color: #aaa; }
#shop .item { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 12px; background: rgba(255,255,255,.06); margin-bottom: 6px; cursor: pointer; }
#shop .item:hover { background: rgba(255,203,61,.15); }
#shop .item.off { opacity: .45; }
#shop .item .ic { font-size: 26px; }
#shop .item small { display: block; color: #bbb; font-size: 12px; }
#shop .item .pr { margin-left: auto; font: 22px Bangers, sans-serif; color: var(--gold); }
#vignette { position: absolute; inset: 0; box-shadow: inset 0 0 160px rgba(255,0,0,.85); opacity: 0; }

/* ---------- touch ---------- */
#touch { position: absolute; inset: 0; pointer-events: none; }
#stick { position: absolute; left: 30px; bottom: 120px; width: 130px; height: 130px; border-radius: 50%; background: rgba(255,255,255,.12); border: 2px solid rgba(255,255,255,.3); pointer-events: none; }
#knob { position: absolute; left: 40px; top: 40px; width: 50px; height: 50px; border-radius: 50%; background: rgba(255,255,255,.45); }
.tb { position: absolute; pointer-events: auto; width: 64px; height: 64px; padding: 0; border-radius: 50%; font: 26px Rubik, sans-serif; background: rgba(255,255,255,.18); color: #fff; box-shadow: none; border: 2px solid rgba(255,255,255,.35); }
#bFire { right: 26px; bottom: 150px; width: 88px; height: 88px; font-size: 38px; background: rgba(255,80,60,.4); }
#bJump { right: 128px; bottom: 120px; }
#bReload { right: 128px; bottom: 196px; font-weight: 800; }
#bGun { right: 30px; bottom: 250px; }
#bZoom { right: 204px; bottom: 150px; }
#bMelee { right: 30px; bottom: 330px; }
#bShop { right: 14px; top: 172px; width: 44px; height: 44px; font-size: 18px; }
#bBoard { right: 14px; top: 224px; width: 44px; height: 44px; font-size: 18px; }
#bPause { right: 14px; top: 120px; width: 44px; height: 44px; font-size: 18px; }
body.touch #status { width: 200px; bottom: 8px; padding: 6px 10px; }
body.touch #weapon { bottom: 8px; min-width: 150px; padding: 6px 10px; }
body.touch #wname { font-size: 18px; }
body.touch #ammo { font-size: 20px; }
body.touch #slots { display: none; }
body.touch #minimap { width: 150px; height: 89px; }

@media (max-width: 860px) {
  .cards { grid-template-columns: repeat(3, 1fr); }
  .cards.maps { grid-template-columns: repeat(3, 1fr); }
  #score { font-size: 22px; }
  #score b { font-size: 26px; }
  #banner { font-size: 28px; }
  #play { margin-left: 0; width: 100%; }
  #feed { top: 60px; font-size: 12px; }
}
