* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { width: 100%; height: 100%; overflow: hidden; background: #000; }
body { font-family: "Segoe UI", "Arial Black", Arial, sans-serif; color: #fff; user-select: none; }
#game, #game canvas { position: fixed; inset: 0; width: 100%; height: 100%; display: block; }
.hidden { display: none !important; }

/* ---------- HUD ---------- */
#hud { position: fixed; inset: 0; pointer-events: none; }
.txtshadow, #hud { text-shadow: 0 2px 0 rgba(0,0,0,.55), 0 0 6px rgba(0,0,0,.35); }

#crosshair { position: absolute; left: 50%; top: 50%; width: 0; height: 0; --gap: 8px; transition: opacity .1s; }
#crosshair .ch { position: absolute; background: #fff; box-shadow: 0 0 0 1px rgba(0,0,0,.6); }
#crosshair .t, #crosshair .b { width: 2px; height: 9px; left: -1px; }
#crosshair .l, #crosshair .r { width: 9px; height: 2px; top: -1px; }
#crosshair .t { top: calc(-1 * var(--gap) - 9px); }
#crosshair .b { top: var(--gap); }
#crosshair .l { left: calc(-1 * var(--gap) - 9px); }
#crosshair .r { left: var(--gap); }
#crosshair .dot { position: absolute; width: 3px; height: 3px; left: -1.5px; top: -1.5px; background: #ff4d4d; border-radius: 50%; }
#crosshair.off { opacity: 0; }

#hitmarker { position: absolute; left: 50%; top: 50%; width: 0; height: 0; opacity: 0; }
#hitmarker i { position: absolute; width: 11px; height: 3px; background: #fff; left: -5.5px; top: -1.5px; box-shadow: 0 0 2px #000; }
#hitmarker i:nth-child(1) { transform: rotate(45deg) translateX(-12px); }
#hitmarker i:nth-child(2) { transform: rotate(135deg) translateX(-12px); }
#hitmarker i:nth-child(3) { transform: rotate(225deg) translateX(-12px); }
#hitmarker i:nth-child(4) { transform: rotate(315deg) translateX(-12px); }
#hitmarker.head i { background: #ffd31a; }
#hitmarker.kill i { background: #ff3b3b; width: 15px; }
#hitmarker.show { animation: hm .22s ease-out; }
@keyframes hm { 0% { opacity: 1; transform: scale(1.35); } 100% { opacity: 0; transform: scale(1); } }

#scope { position: absolute; inset: 0; display: none;
  background: radial-gradient(circle at center, transparent 0, transparent 38vh, #000 38.4vh); }
#scope::before, #scope::after { content: ""; position: absolute; background: #000; }
#scope::before { left: 0; right: 0; top: 50%; height: 2px; margin-top: -1px; }
#scope::after { top: 0; bottom: 0; left: 50%; width: 2px; margin-left: -1px; }
#scope.on { display: block; }

#vignette { position: absolute; inset: 0; opacity: 0;
  background: radial-gradient(ellipse at center, transparent 45%, rgba(220,0,0,.85) 100%); }

#dmgdirs { position: absolute; left: 50%; top: 50%; width: 0; height: 0; }
.dmgdir { position: absolute; left: -130px; top: -130px; width: 260px; height: 260px; }
.dmgdir::before { content: ""; position: absolute; left: 50%; top: 0; margin-left: -34px; width: 68px; height: 22px;
  border-radius: 50% 50% 0 0; border-top: 7px solid rgba(255,40,40,.9); }

#dmgnums { position: absolute; inset: 0; }
.dnum { position: absolute; font-weight: 900; font-size: 20px; color: #fff; transform: translate(-50%, -50%); white-space: nowrap; }
.dnum.head { color: #ffd31a; font-size: 26px; }

#topbar { position: absolute; top: 14px; left: 50%; transform: translateX(-50%); text-align: center; }
#wave { font-size: 30px; font-weight: 900; letter-spacing: 2px; }
#enemiesLeft { font-size: 16px; font-weight: 700; opacity: .9; }

#scorebox { position: absolute; top: 14px; left: 18px; }
#score { font-size: 34px; font-weight: 900; line-height: 1; }
#scorebox .lbl { font-size: 13px; font-weight: 700; opacity: .8; }
#kills { margin-top: 6px; font-size: 16px; font-weight: 700; }

#killfeed { position: absolute; top: 14px; right: 18px; display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }
.feed { background: rgba(0,0,0,.45); padding: 5px 12px; border-radius: 8px; font-weight: 700; font-size: 15px; animation: feedIn .2s ease-out; }
.feed.head { border-left: 4px solid #ffd31a; }
.feed.good { border-left: 4px solid #39d353; }
.feed.out { opacity: 0; transition: opacity .4s; }
@keyframes feedIn { from { transform: translateX(30px); opacity: 0; } to { transform: none; opacity: 1; } }

#banner { position: absolute; top: 24%; left: 0; right: 0; text-align: center; opacity: 0; transition: opacity .35s; }
#banner.on { opacity: 1; }
#banner .big { font-size: 64px; font-weight: 900; letter-spacing: 3px; color: #ffe600;
  text-shadow: 0 4px 0 #b34700, 0 0 18px rgba(0,0,0,.6); }
#banner .small { font-size: 22px; font-weight: 700; margin-top: 6px; }

#reload { position: absolute; left: 50%; top: calc(50% + 44px); transform: translateX(-50%); text-align: center; display: none; }
#reload.on { display: block; }
#reload .txt { font-size: 13px; font-weight: 900; letter-spacing: 2px; }
#reload .bar { width: 120px; height: 6px; background: rgba(0,0,0,.5); border-radius: 3px; margin-top: 4px; overflow: hidden; }
#reload .fill { height: 100%; width: 0; background: #ffe600; }

#hpbox { position: absolute; left: 18px; bottom: 20px; display: flex; align-items: center; gap: 10px; }
.hpicon { width: 38px; height: 38px; border-radius: 9px; background: #e8243c; font-size: 32px; font-weight: 900;
  line-height: 36px; text-align: center; box-shadow: 0 3px 0 #8a0f1f; }
.hpbar { width: 230px; height: 22px; background: rgba(0,0,0,.5); border-radius: 11px; overflow: hidden; border: 2px solid rgba(255,255,255,.35); }
.hpbar .fill { height: 100%; width: 100%; background: linear-gradient(#5cf27a, #22b345); transition: width .15s; }
.hpbar .fill.low { background: linear-gradient(#ff6b6b, #d11a2a); }
#hpnum { font-size: 30px; font-weight: 900; min-width: 56px; }

#ammobox { position: absolute; right: 22px; bottom: 86px; text-align: right; }
#wname { font-size: 18px; font-weight: 800; opacity: .9; }
#ammobox .ammo { font-weight: 900; }
#mag { font-size: 52px; line-height: 1; }
#mag.low { color: #ff4d4d; }
#reserve { font-size: 24px; margin-left: 6px; opacity: .85; }

#slots { position: absolute; right: 18px; bottom: 18px; display: flex; gap: 6px; }
.slot { width: 92px; padding: 5px 7px; border-radius: 8px; background: rgba(0,0,0,.45); border: 2px solid rgba(255,255,255,.15);
  font-size: 12px; font-weight: 800; position: relative; }
.slot .k { position: absolute; top: 3px; right: 6px; opacity: .7; }
.slot .n { display: block; font-size: 13px; }
.slot .a { display: block; opacity: .8; font-weight: 700; }
.slot.cur { border-color: #ffe600; background: rgba(255,230,0,.22); transform: translateY(-4px); }
.slot.empty .a { color: #ff6b6b; }

/* ---------- ekrany ---------- */
.overlay { position: fixed; inset: 0; display: flex; align-items: center; justify-content: center;
  background: rgba(10, 20, 40, .55); }
.panel { background: linear-gradient(#2b3a67, #1b2440); border: 4px solid #ffe600; border-radius: 22px; padding: 30px 44px;
  text-align: center; box-shadow: 0 10px 0 #0d1222, 0 20px 60px rgba(0,0,0,.6); max-width: 92vw; }
.panel h1 { font-size: 64px; font-weight: 900; color: #ffe600; letter-spacing: 3px;
  text-shadow: 0 5px 0 #b34700, 0 0 24px rgba(255,200,0,.35); }
.panel h2 { font-size: 52px; font-weight: 900; color: #ffe600; text-shadow: 0 4px 0 #b34700; }
.panel .sub, .panel p { font-size: 20px; font-weight: 700; margin-top: 8px; }
.controls { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 26px; margin: 22px 0; text-align: left; font-size: 16px; }
.controls b { display: inline-block; min-width: 128px; color: #7fe3ff; }
button { pointer-events: auto; cursor: pointer; font-family: inherit; font-size: 30px; font-weight: 900; letter-spacing: 2px;
  color: #1b2440; background: linear-gradient(#ffef5c, #ffc400); border: none; border-radius: 14px; padding: 14px 54px;
  box-shadow: 0 6px 0 #b37a00; transition: transform .08s; }
button:hover { transform: translateY(-2px) scale(1.03); }
button:active { transform: translateY(4px); box-shadow: 0 2px 0 #b37a00; }
.best { margin-top: 16px; font-size: 18px; font-weight: 700; opacity: .9; }
.stats { margin: 18px 0 10px; font-size: 22px; line-height: 1.6; }
.stats b { color: #7fe3ff; }
#newBest { font-size: 26px; font-weight: 900; color: #39ff14; margin-bottom: 14px; animation: pulse .8s infinite alternate; }
@keyframes pulse { from { transform: scale(1); } to { transform: scale(1.08); } }
#pause { cursor: pointer; }
#pause .panel, #shop .panel, #dead .panel, #menu .panel { cursor: default; }

/* ---------- menu: swiaty, ustawienia, ranking ---------- */
.overlay { overflow-y: auto; padding: 16px 0; }
.panel.wide { width: min(1080px, 95vw); }
.panel.wide h1 { font-size: 54px; }
.menu-grid, .dead-grid { display: grid; grid-template-columns: 1.1fr 1fr; gap: 26px; text-align: left; margin: 14px 0 18px; }
.sect { font-weight: 900; color: #ffe600; letter-spacing: 1px; font-size: 17px; margin: 6px 0 8px; }
#maps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 14px; }
.mapcard { border-radius: 14px; padding: 10px 12px; cursor: pointer; border: 3px solid rgba(255,255,255,.25);
  min-height: 96px; transition: transform .1s; text-shadow: 0 2px 0 rgba(0,0,0,.45); }
.mapcard:hover { transform: translateY(-2px); }
.mapcard.on { border-color: #ffe600; transform: translateY(-3px); box-shadow: 0 0 0 3px rgba(255,230,0,.35), 0 6px 0 #0d1222; }
.mapcard .mname { display: block; font-weight: 900; font-size: 17px; }
.mapcard .mdesc { display: block; font-size: 12.5px; font-weight: 700; margin-top: 4px; opacity: .95; }
.map-arena { background: linear-gradient(160deg, #3b8be0 0%, #7f8fa6 45%, #5cb84a 100%); }
.map-magic { background: linear-gradient(160deg, #7cc8f0 0%, #f8c3da 55%, #c3a6ee 100%); }
.map-jungle { background: linear-gradient(160deg, #3d9be0 0%, #2e7d32 50%, #1b4d1e 100%); }

#settings .srow { display: grid; grid-template-columns: 140px 1fr 30px; align-items: center; gap: 10px; margin: 8px 0; font-weight: 800; }
#settings .seg { grid-column: span 2; }
#settings b { color: #7fe3ff; text-align: right; }
input[type=range] { width: 100%; accent-color: #ffe600; cursor: pointer; }
.seg { display: flex; gap: 6px; flex-wrap: wrap; }
.seg button { font-size: 14px; padding: 7px 10px; letter-spacing: 0; border-radius: 9px; background: #44507a; color: #fff;
  box-shadow: 0 3px 0 #222a45; }
.seg button.on { background: linear-gradient(#ffef5c, #ffc400); color: #1b2440; box-shadow: 0 3px 0 #b37a00; }
#settingsPause { text-align: left; margin: 14px 0 4px; min-width: min(520px, 86vw); }
.btnrow { display: flex; gap: 14px; justify-content: center; flex-wrap: wrap; margin-top: 16px; }
button.ghost { background: #44507a; color: #fff; box-shadow: 0 6px 0 #222a45; }
.panel .controls { grid-template-columns: 1fr 1fr; margin: 0; font-size: 14.5px; gap: 5px 18px; }
.panel .controls b { min-width: 104px; }

.ranking { background: rgba(0,0,0,.25); border-radius: 12px; padding: 8px 10px; margin-bottom: 14px; min-height: 40px; }
.rk-row { display: grid; grid-template-columns: 30px 1fr 64px 70px; gap: 6px; padding: 3px 4px; font-weight: 700; font-size: 15px; border-radius: 6px; }
.rk-row:nth-child(1) .rk-c0 { color: #ffd700; }
.rk-row:nth-child(2) .rk-c0 { color: #d9e2ec; }
.rk-row:nth-child(3) .rk-c0 { color: #e0915a; }
.rk-row.me { background: rgba(255,230,0,.25); }
.rk-c1 { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rk-c2 { opacity: .75; font-size: 13px; align-self: center; }
.rk-c3 { text-align: right; color: #7fe3ff; }
.rk-empty { opacity: .8; font-weight: 700; padding: 6px 2px; }
#nickBox { margin-top: 10px; }
.nickrow { display: flex; gap: 8px; }
#nick { flex: 1; min-width: 0; font: 900 22px "Segoe UI", Arial, sans-serif; padding: 8px 12px; border-radius: 10px;
  border: 3px solid #ffe600; background: #fffbe6; color: #1b2440; outline: none; }
#nickSave { font-size: 20px; padding: 8px 18px; }
#dead .stats { margin: 4px 0 8px; }

/* ---------- sklep ---------- */
#shopItems { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 14px; }
.shopitem { display: flex; flex-direction: column; align-items: center; gap: 3px; font-size: 18px; padding: 12px 10px;
  letter-spacing: 0; min-width: 150px; }
.shopitem .si-d { font-size: 13px; font-weight: 700; }
.shopitem .si-p { font-size: 17px; padding-left: 24px; position: relative; }
.shopitem .si-p::before { content: ""; position: absolute; left: 0; top: 50%; width: 17px; height: 17px; margin-top: -9px; border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #fff3a0, #ffc400 55%, #b37a00); box-shadow: 0 0 0 2px #8a5a00; }
.shopitem:disabled { opacity: .45; cursor: not-allowed; transform: none; }

/* ---------- HUD: monety, misje, moce, pancerz, granaty ---------- */
#coinsBox { margin-top: 6px; display: flex; align-items: center; gap: 6px; font-size: 20px; font-weight: 900; color: #ffe066; }
.coin { display: inline-block; width: 20px; height: 20px; border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #fff3a0, #ffc400 55%, #b37a00); box-shadow: 0 0 0 2px #8a5a00; }
.shopkey { font-size: 12px; font-weight: 800; color: #fff; opacity: .7; margin-left: 4px; }
#mission { position: absolute; top: 150px; left: 18px; max-width: 330px; background: rgba(70, 30, 110, .55);
  border: 2px solid #e2c2ff; border-radius: 12px; padding: 8px 12px; }
#mission .mt { font-size: 12px; font-weight: 900; color: #ffd6ff; letter-spacing: 1px; text-transform: uppercase; }
#mission .mx { font-size: 17px; font-weight: 800; }
#mission .mp { font-size: 20px; font-weight: 900; color: #ffe600; }
#powers { margin-top: 4px; font-size: 16px; font-weight: 900; color: #b8f2ff; white-space: pre; }
#armorbox { position: absolute; left: 18px; bottom: 66px; display: flex; align-items: center; gap: 10px; }
.armoricon { width: 30px; height: 30px; margin-left: 4px; border-radius: 8px; background: linear-gradient(#7fd3ff, #2d8bd6);
  box-shadow: 0 3px 0 #164a73; }
.armorbar { width: 180px; height: 14px; background: rgba(0,0,0,.5); border-radius: 7px; overflow: hidden; border: 2px solid rgba(255,255,255,.35); }
.armorbar .fill { height: 100%; width: 0; background: linear-gradient(#a8e4ff, #3a9be0); }
#nades { font-size: 16px; font-weight: 800; margin-top: 2px; opacity: .9; }
.feed.money { border-left: 4px solid #ffc400; color: #ffe066; }

/* ---------- pasek broni (do 11 broni, zawija sie w gore) ---------- */
#rightbox { position: absolute; right: 18px; bottom: 18px; display: flex; flex-direction: column; align-items: flex-end; gap: 10px; }
#rightbox #ammobox, #rightbox #slots { position: static; }
#rightbox #slots { flex-wrap: wrap-reverse; justify-content: flex-end; max-width: 620px; }
#rightbox .slot { width: 96px; }

/* ---------- czolg ---------- */
#tankbox { position: absolute; right: 18px; bottom: 18px; width: 340px; background: rgba(30, 45, 10, .6);
  border: 2px solid #b6d36b; border-radius: 12px; padding: 10px 14px; }
.tk-t { font-size: 20px; font-weight: 900; color: #e6ff9a; letter-spacing: 2px; }
.tk-row { display: grid; grid-template-columns: 76px 1fr; align-items: center; gap: 8px; margin-top: 6px; font-weight: 800; font-size: 14px; }
.tk-bar { height: 14px; background: rgba(0,0,0,.5); border-radius: 7px; overflow: hidden; border: 2px solid rgba(255,255,255,.3); }
.tk-bar .fill { height: 100%; width: 100%; }
.tk-bar .tk-hp { background: linear-gradient(#c9f27a, #6b8e23); }
.tk-bar .tk-heat { background: linear-gradient(#ffd27a, #ff8c1a); }
.tk-bar .tk-heat.hot { background: linear-gradient(#ff7a7a, #d11a2a); }
.tk-bar .tk-rocket { background: linear-gradient(#c7c7c7, #7a7a7a); }
.tk-bar .tk-rocket.ready { background: linear-gradient(#ff8a7a, #ff2a2a); box-shadow: inset 0 0 6px #ffd0c0; }
.tk-hint { margin-top: 8px; font-size: 13px; font-weight: 800; opacity: .85; }
#usehint { position: absolute; left: 50%; bottom: 120px; transform: translateX(-50%); background: rgba(0,0,0,.55);
  padding: 8px 18px; border-radius: 10px; font-size: 20px; font-weight: 900; color: #ffe600; border: 2px solid #ffe600; }

/* ---------- super bronie w sklepie ---------- */
.shopsect { margin-top: 16px; text-align: left; }
#shopItems { margin-top: 6px; }
#shopWeapons { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 6px; }
.shopitem.weapon { background: linear-gradient(#ffb36b, #ff6a3d); color: #2a0f00; box-shadow: 0 6px 0 #a3321a; }
.shopitem .si-k { font-size: 12px; font-weight: 800; opacity: .8; }
.shopitem.owned, .shopitem.owned:disabled { background: linear-gradient(#8ff0a2, #3fb35a); color: #0d3317;
  box-shadow: 0 6px 0 #22743a; opacity: 1; cursor: default; }
.shopitem.owned .si-p { padding-left: 0; }
.shopitem.owned .si-p::before { display: none; }
