:root {
  --bg: #0f1420;
  --bg2: #161d2d;
  --panel: rgba(22, 29, 45, 0.92);
  --line: #2a3550;
  --text: #e8edf7;
  --muted: #8e9ab3;
  --green: #5fcf4a;
  --green-dark: #3a8f2c;
  --red: #ff5a5a;
  --gold: #ffcf4a;
  --pixel: 'VT323', ui-monospace, monospace;
  --sans: 'Inter', system-ui, -apple-system, Segoe UI, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font-family: var(--sans);
  color: var(--text);
  background:
    radial-gradient(1200px 600px at 70% -10%, #2b4a7a55, transparent 60%),
    radial-gradient(800px 500px at 0% 110%, #3a8f2c33, transparent 60%),
    var(--bg);
  overflow-x: hidden;
}
.hidden { display: none !important; }
button { font: inherit; }
a { color: #8fc1ff; }
code { background: #0007; padding: 1px 5px; border-radius: 4px; font-size: 0.9em; }
.muted { color: var(--muted); }
.fine { color: var(--muted); font-size: 12px; margin: 8px 0 0; }
.error { color: var(--red); min-height: 1em; margin: 8px 0 0; font-size: 14px; }
.win { color: var(--green); }
.loss { color: var(--red); }
.row { display: flex; gap: 8px; align-items: center; }
.row.end { justify-content: flex-end; }

/* ---------- buttons */
.mc-btn {
  font-family: var(--pixel);
  font-size: 22px;
  letter-spacing: 0.5px;
  color: #fff;
  background: linear-gradient(#8a8a8a, #6b6b6b);
  border: 2px solid #1b1b1b;
  box-shadow: inset 2px 2px 0 #b5b5b5, inset -2px -3px 0 #4a4a4a;
  padding: 6px 18px 8px;
  cursor: pointer;
  text-shadow: 2px 2px 0 #3a3a3a;
  image-rendering: pixelated;
  transition: filter 0.1s;
}
.mc-btn:hover { filter: brightness(1.12); }
.mc-btn:active { box-shadow: inset -2px -2px 0 #b5b5b5, inset 2px 3px 0 #4a4a4a; }
.mc-btn:disabled { filter: grayscale(1) brightness(0.7); cursor: default; }
.mc-btn.primary { background: linear-gradient(#5fcf4a, #3a8f2c); box-shadow: inset 2px 2px 0 #9be98c, inset -2px -3px 0 #2a6a20; text-shadow: 2px 2px 0 #24581b; }
.mc-btn.danger { background: linear-gradient(#d24a4a, #9a2a2a); box-shadow: inset 2px 2px 0 #f08a8a, inset -2px -3px 0 #6a1a1a; }
.mc-btn.ghost { background: linear-gradient(#3a4560, #2a3248); box-shadow: inset 2px 2px 0 #56648a, inset -2px -3px 0 #1a2033; }
.mc-btn.small { font-size: 18px; padding: 3px 12px 5px; }
.link { background: none; border: 0; color: #8fc1ff; cursor: pointer; padding: 0 4px; text-decoration: underline; }

/* ---------- panels & forms */
.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 18px;
  box-shadow: 0 10px 40px #0006;
}
.panel h2 { font-family: var(--pixel); font-size: 30px; font-weight: 400; margin: 0 0 12px; letter-spacing: 1px; }
.panel h3 { margin: 0 0 6px; }
label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 12px; }
input, select {
  display: block; width: 100%; margin-top: 6px; font: inherit; font-size: 15px; color: var(--text);
  background: #0c1220; border: 1px solid var(--line); border-radius: 6px; padding: 9px 10px; outline: none;
}
input:focus, select:focus { border-color: #4f7fd6; }
.row select { margin-top: 0; }
.stake-row { display: flex; align-items: center; background: #0c1220; border: 1px solid var(--line); border-radius: 6px; margin-top: 6px; }
.stake-row input { border: 0; margin: 0; background: transparent; font-family: var(--pixel); font-size: 26px; padding: 4px 8px; }
.dollar { font-family: var(--pixel); font-size: 26px; padding-left: 12px; color: var(--gold); }
.chips { display: flex; gap: 6px; margin: -4px 0 12px; }
.chip { background: #24304a; color: var(--text); border: 1px solid var(--line); border-radius: 999px; padding: 3px 12px; cursor: pointer; font-size: 13px; }
.chip:hover { background: #2f3d5e; }
.tabs { display: flex; gap: 4px; margin-bottom: 14px; border-bottom: 1px solid var(--line); }
.tab { background: none; border: 0; color: var(--muted); padding: 8px 14px; cursor: pointer; border-bottom: 2px solid transparent; font-weight: 600; }
.tab.active { color: var(--text); border-bottom-color: var(--green); }

/* ---------- brand */
.brand { font-family: var(--pixel); font-size: 30px; letter-spacing: 2px; display: flex; align-items: center; gap: 10px; white-space: nowrap; }
.brand em { font-style: normal; color: var(--green); }
.brand.big { font-size: 52px; justify-content: center; }
.cube {
  width: 26px; height: 26px; display: inline-block; image-rendering: pixelated;
  background: linear-gradient(#6aa84f 0 35%, #866043 35%);
  box-shadow: inset -4px -4px 0 #0003, inset 3px 3px 0 #fff2;
}
.brand.big .cube { width: 42px; height: 42px; }

/* ---------- auth */
#auth { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.auth-card { width: min(440px, 100%); }
.tagline { text-align: center; color: var(--muted); margin: 6px 0 20px; }
.auth-card .mc-btn { width: 100%; }

/* ---------- lobby */
.topbar {
  display: flex; align-items: center; gap: 18px; padding: 12px 22px; border-bottom: 1px solid var(--line);
  background: #0b1019cc; backdrop-filter: blur(6px); position: sticky; top: 0; z-index: 5; flex-wrap: wrap;
}
.online { color: var(--muted); font-size: 14px; display: flex; align-items: center; gap: 6px; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--green); box-shadow: 0 0 8px var(--green); }
.wallet { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.balance { font-family: var(--pixel); font-size: 32px; color: var(--gold); text-shadow: 2px 2px 0 #0008; }
.badge { font-size: 11px; font-weight: 800; letter-spacing: 1px; background: #ffcf4a22; color: var(--gold); border: 1px solid #ffcf4a66; padding: 2px 6px; border-radius: 4px; }
.user { display: flex; gap: 8px; align-items: center; color: var(--muted); }
.lobby-grid { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 18px; padding: 20px 22px 40px; max-width: 1280px; margin: 0 auto; }
.side { display: flex; flex-direction: column; gap: 18px; }
.wide { grid-column: 1 / -1; }
.panel-head { display: flex; align-items: baseline; justify-content: space-between; }
.wager-list { display: flex; flex-direction: column; gap: 10px; }
.wager {
  display: grid; grid-template-columns: 96px 1fr auto auto; gap: 14px; align-items: center;
  background: #0f1626; border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px;
}
.wager canvas { width: 96px; height: 60px; background: #0a0f1a; border-radius: 4px; image-rendering: pixelated; }
.wager.is-live { opacity: 0.75; }
.wager-players { font-size: 16px; }
.vs { color: var(--muted); font-size: 12px; margin: 0 4px; }
.wager-stake { display: flex; flex-direction: column; align-items: flex-end; }
.pot { font-family: var(--pixel); font-size: 30px; color: var(--gold); line-height: 1; }
.live-badge { font-size: 12px; font-weight: 800; color: #fff; background: var(--red); padding: 3px 8px; border-radius: 4px; letter-spacing: 1px; }
.empty { color: var(--muted); padding: 30px; text-align: center; border: 1px dashed var(--line); border-radius: 8px; }
.gold { color: var(--gold); }
.wager.room { grid-template-columns: 96px minmax(0, 1fr) auto auto; }
.room-title { font-weight: 600; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.teams { display: flex; align-items: center; gap: 8px; }
.team-col { display: flex; flex-direction: column; gap: 4px; padding-left: 8px; border-left: 3px solid var(--tc); min-width: 104px; }
.slot-name { font-size: 14px; }
.slot-name.me { color: var(--gold); }
.slot-bot, .slot-open { font-size: 13px; color: var(--muted); }
.slot-bot::before { content: '🤖 '; }
.team-col .mc-btn.small { font-size: 16px; padding: 1px 8px 3px; }
.lvl { font-weight: 800; }
.lvl-easy { color: #6fdc5a; } .lvl-medium { color: #ffcf4a; } .lvl-hard { color: #ff8a3a; } .lvl-impossible { color: #ff4a6a; }
.waiting { margin-bottom: 12px; }
.waiting .grow { flex: 1; }
.seg { display: flex; gap: 0; margin: 0 0 12px; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.seg button { flex: 1; background: #0c1220; color: var(--muted); border: 0; border-right: 1px solid var(--line); padding: 8px 6px; cursor: pointer; font-weight: 600; font-size: 13px; }
.seg button:last-child { border-right: 0; }
.seg button.on { background: #24304a; color: var(--text); box-shadow: inset 0 -2px 0 var(--green); }
.seg.diff button[data-v=easy].on { box-shadow: inset 0 -2px 0 #6fdc5a; }
.seg.diff button[data-v=hard].on { box-shadow: inset 0 -2px 0 #ff8a3a; }
.seg.diff button[data-v=impossible].on { box-shadow: inset 0 -2px 0 #ff4a6a; }
.game-menu { background: #0008; z-index: 40; }
.menu-card { width: min(560px, 100%); max-height: 92vh; overflow: auto; position: relative; }
.menu-card h2 { margin-bottom: 2px; font-size: 38px; }
.menu-card > .muted { margin: 0 0 14px; }
.menu-x { position: absolute; right: 12px; top: 10px; background: none; border: 0; color: var(--muted); font-size: 20px; cursor: pointer; }
.menu-x:hover { color: var(--text); }
.mc-btn.wide { width: 100%; margin-top: 4px; }
.mc-btn.big { width: 100%; font-size: 26px; padding: 10px 18px 12px; }
.tabs-seg button { font-size: 14px; }
.game-tag { font-size: 11px; font-weight: 700; color: var(--muted); border: 1px solid var(--line); border-radius: 4px; padding: 1px 5px; margin-left: 6px; vertical-align: middle; }
.menu-card .wager-list { max-height: 46vh; overflow: auto; }
.sound-btn { background: #1a2338; color: var(--muted); border: 1px solid var(--line); border-radius: 999px; padding: 5px 12px; cursor: pointer; font-size: 13px; }
.sound-btn.on { color: var(--green); border-color: #5fcf4a66; }
.map-preview { width: 100%; height: 140px; background: #0a0f1a; border-radius: 6px; margin: -2px 0 12px; image-rendering: pixelated; display: block; }
#create-form .mc-btn { width: 100%; }
.waiting { display: flex; gap: 10px; align-items: center; background: #ffcf4a14; border: 1px solid #ffcf4a44; border-radius: 8px; padding: 12px; font-size: 14px; }
.map-gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px; }
.map-card { background: #0f1626; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.map-card canvas { width: 100%; height: 130px; display: block; background: #0a0f1a; image-rendering: pixelated; }
.map-meta { padding: 10px; display: flex; flex-direction: column; gap: 3px; font-size: 13px; }
.map-meta b { font-size: 15px; }
.upload { background: #0f1626; border: 1px solid var(--line); border-radius: 8px; padding: 14px; margin-bottom: 16px; }
.upload-form { display: grid; grid-template-columns: 1.4fr 1fr 1fr 1fr auto; gap: 8px; align-items: center; }
.upload-form input { margin: 0; }
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th { text-align: left; color: var(--muted); font-weight: 600; padding: 8px; border-bottom: 1px solid var(--line); }
.table td { padding: 8px; border-bottom: 1px solid #1e2740; }

.modal { position: fixed; inset: 0; background: #000a; display: grid; place-items: center; z-index: 50; padding: 16px; }
.modal-card { width: min(380px, 100%); }
.toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); background: #111a2b; border: 1px solid var(--line); padding: 10px 18px; border-radius: 8px; z-index: 60; box-shadow: 0 8px 30px #0008; }

.spinner { width: 42px; height: 42px; border: 5px solid #ffffff22; border-top-color: var(--green); border-radius: 50%; animation: spin 0.9s linear infinite; }
.spinner.small { width: 18px; height: 18px; border-width: 3px; flex: none; }
@keyframes spin { to { transform: rotate(360deg); } }

@media (max-width: 900px) {
  .lobby-grid { grid-template-columns: 1fr; padding: 16px; }
  .upload-form { grid-template-columns: 1fr; }
  .wager, .wager.room { grid-template-columns: 72px minmax(0, 1fr); }
  .wager .teams { grid-column: 1 / -1; }
  .wager canvas { width: 72px; height: 45px; }
  .wager-stake { display: none; }
  .topbar { padding: 10px 16px; gap: 10px; }
  .brand { font-size: 24px; }
}

/* ======================================================= game */
#game { position: fixed; inset: 0; background: #000; overflow: hidden; user-select: none; }
.game-canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.hud-root { position: absolute; inset: 0; pointer-events: none; font-family: var(--pixel); }
.hud-root .overlay, .hud-root .menu-panel, .hud-root button, .hud-root input, .hud-root .slot { pointer-events: auto; }
.hud { position: absolute; inset: 0; }
.crosshair { position: absolute; left: 50%; top: 50%; width: 18px; height: 18px; transform: translate(-50%, -50%); mix-blend-mode: difference; }
.crosshair::before, .crosshair::after { content: ''; position: absolute; background: #fff; }
.crosshair::before { left: 8px; top: 0; width: 2px; height: 18px; }
.crosshair::after { top: 8px; left: 0; height: 2px; width: 18px; }
.damage-flash { position: absolute; inset: 0; box-shadow: inset 0 0 160px #ff000000; }
.damage-flash.on { animation: dmg 0.45s ease-out; }
@keyframes dmg { from { box-shadow: inset 0 0 160px #ff0000aa; } to { box-shadow: inset 0 0 160px #ff000000; } }

.hud-top { position: absolute; top: 10px; left: 0; right: 0; display: flex; justify-content: center; gap: 14px; }
.hud-info, .hud-opp { background: #0008; padding: 2px 12px 4px; font-size: 24px; color: #fff; text-shadow: 2px 2px 0 #000; border-radius: 3px; }
.hud-info:empty, .hud-opp:empty { display: none; }
.hud-info b { color: var(--gold); font-weight: 400; }
.hud-info .danger { color: var(--red); }
.opp-hp { color: #ff6b6b; }
.hud-opp .team { white-space: nowrap; }
.hud-opp .dead { opacity: 0.45; text-decoration: line-through; }
.hud-opp .vs { color: #aab4cc; margin: 0 10px; }
.hud.spectating .hud-bottom, .hud.spectating .crosshair, .hud.spectating .held-name { display: none; }
.hud[data-mode=hub] .bars, .hud[data-mode=hub] .hud-opp { display: none; }
.hud[data-mode=sumo] .bars, .hud[data-mode=tntrun] .bars, .hud[data-mode=dragon] .bars { visibility: hidden; }

.sidebar { position: absolute; right: 8px; top: 50%; transform: translateY(-50%); min-width: 190px; max-width: 260px; background: #0007; padding: 6px 10px 6px; color: #fff; font-size: 21px; line-height: 1.05; text-shadow: 2px 2px 0 #000; }
.sidebar:empty { display: none; }
.sb-title { text-align: center; color: #ffe066; font-size: 24px; margin-bottom: 4px; letter-spacing: 1px; }
.sb-line { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sb-line b { font-weight: 400; color: #fff; }
.sb-dim { color: #aab4cc; }
.sb-gold { color: var(--gold); }
.sb-hp { color: #ff6b6b; }
.sb-ok { color: #6fdc5a; }
.sb-bad { color: #ff4a4a; }
.sb-hint { color: #ffe066; }
.sb-foot { text-align: center; color: #ffe066; font-size: 17px; margin-top: 4px; }
.hud-toast { position: absolute; left: 50%; bottom: 120px; transform: translateX(-50%); background: #000a; color: #ff8a8a; padding: 2px 12px 4px; font-size: 24px; opacity: 0; transition: opacity 0.2s; pointer-events: none; }
.hud-toast.show { opacity: 1; }

.admin-overlay { background: #0007; z-index: 30; }
.admin-panel { text-align: left; width: min(440px, 92vw); }
.admin-panel h2 { text-align: center; color: #ff6b6b; }
.admin-row { display: flex; align-items: center; gap: 12px; background: #0004; padding: 8px 10px; margin: 6px 0; cursor: pointer; color: #fff; font-size: 22px; }
.admin-row.off { opacity: 0.45; cursor: default; }
.admin-row input[type=checkbox] { width: 22px; height: 22px; margin: 0; accent-color: #ff5555; flex: none; }
.admin-label { display: flex; flex-direction: column; flex: 1; text-align: left; }
.admin-label b { font-weight: 400; }
.admin-label small { color: #aab4cc; font-size: 17px; }
.admin-slider { width: 120px; flex: none; margin: 0; padding: 0; accent-color: #ff5555; }
.admin-panel .row .mc-btn { flex: 1; }
.admin-warn { color: #ffb0b0; font-size: 19px; }
.admin-badge { position: absolute; left: 10px; top: 34px; color: #ff6b6b; font-size: 21px; text-shadow: 2px 2px 0 #000; }
.inv-shop .shop-wallet { display: flex; gap: 14px; font-size: 22px; }
.wallet-coin { display: inline-flex; align-items: center; gap: 4px; text-shadow: 1px 1px 0 #0007; }
.wallet-coin i { width: 20px; height: 20px; background-size: contain; image-rendering: pixelated; }
.c-iron { color: #e8e8e8; } .c-gold { color: #ffd84a; } .c-em { color: #3cf07a; }
.shop-cats { display: grid; grid-template-columns: auto auto; gap: 8px 16px; margin: 4px 0 6px; }
.shop-cat-name { font-size: 18px; color: #555; margin: 0 0 2px 2px; }
.shop-row { display: flex; gap: 3px; }
.shop-offer { width: 50px; height: 50px; position: relative; display: grid; place-items: center; background: #8b8b8b; border: 2px solid; border-color: #373737 #fff #fff #373737; cursor: pointer; pointer-events: auto; }
.shop-offer:hover::before { content: ''; position: absolute; inset: 0; background: #ffffff70; z-index: 2; pointer-events: none; }
.shop-offer .item { width: 32px; height: 32px; background-size: 32px 32px; image-rendering: pixelated; }
.shop-offer .count { position: absolute; right: 2px; bottom: -2px; font-size: 20px; color: #fff; text-shadow: 2px 2px 0 #3a3a3a; }
.shop-offer .price { position: absolute; left: -3px; top: -7px; z-index: 3; font-size: 16px; line-height: 1.15; padding: 0 4px; background: #000c; border-radius: 3px; }
.shop-offer.poor .item { filter: grayscale(0.85) brightness(0.75); }
.shop-offer.poor .price { color: #ff6b6b; }
.shop-offer.owned { background: #6f8f6f; cursor: default; }
.shop-offer.owned .item { opacity: 0.5; }
.shop-offer.owned .price { color: #7dff7d; }
.shop-offer.bought { animation: shop-ok 0.35s; }
.shop-offer.nope { animation: shop-no 0.3s; }
@keyframes shop-ok { 30% { background: #7ddc7d; transform: scale(1.1); } }
@keyframes shop-no { 20%, 60% { transform: translateX(-3px); } 40%, 80% { transform: translateX(3px); } }
.hud.spectating::after { content: 'SPECTATING'; position: absolute; bottom: 24px; left: 50%; transform: translateX(-50%); color: #fff; font-size: 30px; text-shadow: 2px 2px 0 #000; letter-spacing: 3px; }
.hud-debug { position: absolute; top: 8px; left: 10px; font-size: 20px; color: #fff; text-shadow: 2px 2px 0 #000; }

.hud-title { position: absolute; left: 0; right: 0; top: 26%; text-align: center; opacity: 0; transition: opacity 0.25s; color: #fff; text-shadow: 4px 4px 0 #3a3a3a; }
.hud-title.show { opacity: 1; }
.hud-title .main { font-size: 96px; line-height: 1; }
.hud-title .sub { font-size: 34px; color: #f0f0f0; margin-top: 6px; }
.hud-title.show .main { animation: title-pop 0.42s cubic-bezier(0.2, 1.5, 0.4, 1) both; }
.hud-title.show .sub { animation: title-sub 0.45s 0.1s ease-out both; }
.hud-title.sub-only .main { display: none; }
@keyframes title-pop { from { transform: scale(2.4); opacity: 0; } 55% { opacity: 1; } to { transform: scale(1); } }
@keyframes title-sub { from { transform: translateY(12px); opacity: 0; } }
.hud-title.count .main { font-size: 150px; }
.hud-title.c3 .main { color: #6fe05a; text-shadow: 5px 5px 0 #1f5a16; }
.hud-title.c2 .main { color: #ffe14a; text-shadow: 5px 5px 0 #6a5300; }
.hud-title.c1 .main { color: #ff5a5a; text-shadow: 5px 5px 0 #6a1414; }
.hud-title.fight .main { font-size: 132px; color: var(--gold); letter-spacing: 6px; text-shadow: 5px 5px 0 #6a4300, 0 0 34px #ffb30099; }
.hud-title.fight.show .main { animation: title-pop 0.42s cubic-bezier(0.2, 1.5, 0.4, 1) both, fight-shake 0.5s 0.42s; }
@keyframes fight-shake { 20% { transform: translateX(-6px) rotate(-1deg); } 40% { transform: translateX(6px) rotate(1deg); } 60% { transform: translateX(-3px); } 80% { transform: translateX(3px); } }

/* --- kill feed, kill note, death screen --------------------------------------------------- */
.killfeed { position: absolute; right: 8px; top: 8px; display: flex; flex-direction: column; align-items: flex-end; gap: 3px; }
.hud:has(.minimap:not(.hidden)) .killfeed { right: 168px; }
.kf-row { display: flex; align-items: center; gap: 6px; background: #000a; padding: 1px 9px 3px; font-size: 21px; color: #fff; text-shadow: 2px 2px 0 #000; white-space: nowrap; animation: kf-in 0.25s ease-out; transition: opacity 0.45s, transform 0.45s; }
.kf-row.mine { background: #3a2a00cc; box-shadow: inset 0 0 0 2px #ffcf4a99; }
.kf-row.out { opacity: 0; transform: translateX(30px); }
@keyframes kf-in { from { transform: translateX(40px); opacity: 0; } }
.kf-ico { width: 22px; height: 22px; background-size: 22px 22px; image-rendering: pixelated; display: inline-block; }
.kf-glyph { font-style: normal; font-family: 'Segoe UI Symbol', 'Apple Symbols', sans-serif; font-size: 17px; color: #ddd; width: 22px; text-align: center; }
.kf-glyph.kf-void { color: #c08cff; }
.kf-rest { color: #c9cfdc; }
.kf-final { color: #ff5a5a; font-weight: 400; }
.kill-note { position: absolute; left: 0; right: 0; top: 62%; text-align: center; color: #fff; text-shadow: 2px 2px 0 #000; opacity: 0; transition: opacity 0.3s; }
.kill-note.show { opacity: 1; }
.kill-note.show .kn-main { animation: kn-pop 0.3s cubic-bezier(0.2, 1.6, 0.4, 1) both; }
.kn-main { font-size: 30px; letter-spacing: 1px; }
.kn-x { color: #ff4a4a; font-family: 'Segoe UI Symbol', sans-serif; font-size: 24px; }
.kn-sub { font-size: 34px; color: var(--gold); letter-spacing: 3px; text-shadow: 3px 3px 0 #6a4300; animation: kn-pop 0.35s 0.08s cubic-bezier(0.2, 1.6, 0.4, 1) both; }
@keyframes kn-pop { from { transform: scale(1.8); opacity: 0; } }
.death { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; padding-bottom: 8vh;
  background: radial-gradient(ellipse at center, #5a000022 0%, #6a000066 60%, #3a0000bb 100%); color: #fff; text-shadow: 3px 3px 0 #000; animation: death-in 0.5s ease-out; }
.death.hidden { display: none; }
@keyframes death-in { from { opacity: 0; } }
.d-title { font-size: 104px; color: #ff4a4a; text-shadow: 5px 5px 0 #4a0000; animation: title-pop 0.5s cubic-bezier(0.2, 1.4, 0.4, 1) both; }
.d-by { font-size: 34px; }
.d-hp { color: #ff7a7a; }
.d-timer { font-size: 28px; color: #ffe066; min-height: 1em; }
.d-timer b { font-weight: 400; font-size: 34px; color: #fff; }
/* --- voice chat --------------------------------------------------------------------------- */
.voice-hud { position: absolute; left: 8px; bottom: 50px; display: flex; align-items: center; gap: 6px; background: #000a; color: #cfd6e6; padding: 2px 9px 3px 6px; font-size: 19px; text-shadow: 2px 2px 0 #000; transition: background 0.15s, color 0.15s; }
.voice-hud.hidden { display: none; }
.voice-hud .vh-mic { width: 18px; height: 18px; fill: currentColor; }
.voice-hud.on { background: #1f5a16dd; color: #b8ffa8; box-shadow: 0 0 14px #6fe05a88; }
.voice-hud.err { color: #ff8a8a; }
.vh-level { width: 46px; height: 5px; background: #fff2; display: block; }
.vh-level b { display: block; height: 100%; background: #6fe05a; transition: width 0.1s; }
.voice-talkers { position: absolute; left: 8px; top: 40%; display: flex; flex-direction: column; gap: 3px; }
.voice-talkers .vt { display: flex; align-items: center; gap: 6px; background: #000a; padding: 1px 9px 3px 6px; font-size: 21px; text-shadow: 2px 2px 0 #000; animation: kf-in 0.2s ease-out; }
.voice-talkers .vh-spk { width: 18px; height: 18px; fill: #6fe05a; animation: spk 0.6s steps(2) infinite; }
@keyframes spk { 50% { opacity: 0.55; } }
.pause .menu-panel { max-height: 96vh; overflow-y: auto; } /* the settings outgrew short windows */

.game-canvas.dead { filter: saturate(0.25) brightness(0.85); transition: filter 0.6s; }

.hud-bottom { position: absolute; bottom: 6px; left: 50%; transform: translateX(-50%); display: flex; flex-direction: column; align-items: center; }
.bars { width: 364px; display: flex; flex-direction: column-reverse; align-items: flex-start; gap: 1px; margin-bottom: 3px; }
.icon-row { display: flex; gap: 0; height: 18px; }
.icon-row .icon { display: block; width: 18px; height: 18px; background-size: 18px 18px; image-rendering: pixelated; margin-right: -1px; }
.icon-row.low .icon { animation: shake 0.3s infinite; }
.icon-row.low .icon:nth-child(2n) { animation-delay: 0.15s; }
@keyframes shake { 50% { transform: translateY(-2px); } }
.held-name { position: absolute; bottom: 100px; left: 0; right: 0; text-align: center; font-size: 26px; color: #fff; text-shadow: 2px 2px 0 #3a3a3a; opacity: 0; transition: opacity 0.4s; }

.hotbar { display: flex; background: #000a; border: 2px solid #000; padding: 1px; }
.slot {
  width: 42px; height: 42px; position: relative; display: grid; place-items: center;
  background: #8b8b8b; border: 2px solid; border-color: #373737 #fff #fff #373737;
}
.hotbar .slot { background: #0006; border: 2px solid #5a5a5a88; width: 42px; height: 42px; }
.hotbar .slot.selected { border: 3px solid #fff; box-shadow: 0 0 0 1px #000; z-index: 1; }
.hotbar .slot.bump .item { animation: slot-bump 0.32s cubic-bezier(0.2, 1.6, 0.4, 1); }
@keyframes slot-bump { from { transform: scale(1.5) translateY(-4px); } }
.slot .item { width: 32px; height: 32px; background-size: 32px 32px; image-rendering: pixelated; }
.slot .item.glint { filter: drop-shadow(0 0 3px #b77cff) saturate(1.3); animation: glint 2s infinite; }
@keyframes glint { 50% { filter: drop-shadow(0 0 5px #d0a8ff) saturate(1.6) brightness(1.15); } }
.slot .count { position: absolute; right: 2px; bottom: -2px; font-size: 22px; color: #fff; text-shadow: 2px 2px 0 #3a3a3a; }
.slot.bare { background: none; border: 0; }

.chat { position: absolute; left: 8px; bottom: 80px; width: min(480px, 60vw); font-size: 21px; }
.chat-log { max-height: 220px; overflow: hidden; display: flex; flex-direction: column; justify-content: flex-end; }
.chat.open .chat-log { overflow-y: auto; background: #0005; }
.chat-line { color: #fff; background: #0006; padding: 0 6px; text-shadow: 2px 2px 0 #000; transition: opacity 1s; }
.chat-line.old { opacity: 0; }
.chat.open .chat-line.old { opacity: 1; }
.chat-line .sys { color: #ffe066; }
.chat-input { margin-top: 4px; font-family: var(--pixel); font-size: 22px; background: #000a; border: 0; border-radius: 0; color: #fff; padding: 2px 6px; }

.overlay { position: absolute; inset: 0; display: grid; place-items: center; background: #0009; }
.loading { background: linear-gradient(#2b3d5c, #121a2b); color: #fff; font-size: 30px; gap: 18px; align-content: center; justify-items: center; }
.click-to-play { cursor: pointer; background: #0006; }
.menu-panel {
  background: #1d2436ee; border: 2px solid #000; box-shadow: inset 2px 2px 0 #3c4766, inset -2px -2px 0 #0b0f1a, 0 10px 40px #000a;
  padding: 22px 26px; width: min(460px, 92vw); color: #fff; text-align: center; font-family: var(--pixel);
}
.menu-panel h2 { font-size: 40px; font-weight: 400; margin: 0 0 14px; }
.menu-panel .mc-btn { width: 100%; margin: 6px 0; }
.menu-panel .hint { color: #aab4cc; font-size: 18px; line-height: 1.2; margin-top: 14px; }
.settings { margin: 10px 0; text-align: left; }
.setting { color: #fff; font-size: 20px; margin-bottom: 8px; }
.setting input { margin-top: 2px; padding: 0; accent-color: var(--green); }
.setting.check { display: flex; align-items: center; gap: 8px; }
.setting.check input { width: 18px; height: 18px; margin: 0; display: inline-block; }

.inv-overlay { background: radial-gradient(ellipse at center, #0005, #000b); }
.inv-panel {
  background: #c6c6c6; border: 3px solid #000; box-shadow: inset 3px 3px 0 #fff, inset -3px -3px 0 #555, 0 18px 60px #000b;
  padding: 12px 14px 10px; color: #3f3f3f; font-size: 24px; border-radius: 3px;
}
.inv-panel.opening { animation: inv-open 0.17s cubic-bezier(0.2, 1.3, 0.4, 1); }
@keyframes inv-open { from { transform: scale(0.94) translateY(10px); opacity: 0; } }
.inv-title { margin: 2px 0 4px 2px; min-height: 4px; }
.inv-head { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 4px; }
.inv-head .inv-title { margin: 0 0 0 2px; }
.inv-btn { font-family: var(--pixel); font-size: 19px; color: #fff; text-shadow: 1px 1px 0 #3a3a3a; background: #7d7d7d; border: 2px solid #000; box-shadow: inset 2px 2px 0 #b9b9b9, inset -2px -2px 0 #4a4a4a; padding: 0 12px 2px; cursor: pointer; }
.inv-btn:hover:not(:disabled) { background: #7f8fcf; box-shadow: inset 2px 2px 0 #c3ccff, inset -2px -2px 0 #4a5590; }
.inv-btn:disabled { opacity: 0.45; cursor: default; }
.grid9 { display: grid; grid-template-columns: repeat(9, 42px); gap: 2px; }
.grid9.hot { margin-top: 10px; }
.chest-grid { margin-bottom: 8px; }
.inv-help { font-size: 16px; line-height: 1.05; color: #6e6e6e; max-width: 394px; margin: 8px auto 0; text-align: center; }
.inv-shop .grid9 { justify-content: center; }
.inv-help span { white-space: nowrap; }

.inv-top { display: flex; gap: 8px; width: 394px; height: 174px; margin-bottom: 10px; }
.armor-col { display: grid; grid-template-rows: repeat(4, 42px); gap: 2px; }
.armor-slot:empty::after { content: ''; position: absolute; inset: 6px; background: var(--ghost) center / contain no-repeat; image-rendering: pixelated; filter: grayscale(1) brightness(0.5); opacity: 0.4; }
.doll-box { width: 116px; position: relative; overflow: hidden; border: 2px solid; border-color: #373737 #fff #fff #373737; background: radial-gradient(ellipse at 50% 32%, #4a4f5e, #111318 78%); }
.doll-box canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.inv-stats { flex: 1; min-width: 0; display: flex; flex-direction: column; justify-content: center; gap: 8px; padding: 8px 10px; background: #0000000f; border: 2px solid; border-color: #555 #fff #fff #555; }
.st-row { display: flex; align-items: baseline; gap: 7px; font-size: 18px; line-height: 1; white-space: nowrap; overflow: hidden; }
.st-row i { width: 18px; height: 18px; flex: none; align-self: center; background-size: contain; image-rendering: pixelated; }
.st-row i.dim { opacity: 0.3; filter: grayscale(1); }
.st-row b { font-weight: 400; font-size: 26px; color: #2b2b2b; min-width: 24px; }
.st-row span { color: #5b5b5b; overflow: hidden; text-overflow: ellipsis; }
.st-row .c-hp { color: #b52222; }
.st-row .c-abs { color: #a07800; font-style: normal; }
.st-held { font-size: 17px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-shadow: 1px 1px 0 #0005; margin-top: 2px; }

.inv-panel .slot { cursor: pointer; }
.inv-panel .slot .item { transition: transform 0.08s; }
.inv-panel .slot:active .item { transform: scale(0.86); }
.inv-panel .slot:hover::before, .inv-panel .slot.dragged::before { content: ''; position: absolute; inset: 0; background: #ffffff78; z-index: 2; pointer-events: none; }
.inv-panel .slot.dragged::before { background: #ffffff4a; box-shadow: inset 0 0 0 2px #fff; }
.inv-panel .slot .count { z-index: 1; }
.inv-panel .slot.held { box-shadow: inset 0 0 0 2px #ffffffcc; }
.cursor-item { position: absolute; left: 0; top: 0; pointer-events: none !important; z-index: 20; }
.cursor-item .slot { pointer-events: none !important; }
.cursor-item .item { filter: drop-shadow(3px 4px 1px #0006); transform: scale(1.08); }
.tooltip { position: absolute; left: 0; top: 0; background: #100010f2; border: 2px solid #0c0010; box-shadow: inset 0 0 0 2px #2d0a6c, 0 8px 22px #0009; padding: 5px 10px 7px; color: #fff; font-size: 22px; line-height: 1.08; z-index: 21; pointer-events: none; white-space: nowrap; }
.tt-name { text-shadow: 2px 2px 0 #0007; }
.tt-ench { color: #aaa; }
.tt-gap { height: 6px; }
.tt-when { color: #aaa; }
.tt-lore { color: #c19bff; font-style: italic; margin-top: 2px; }
.tt-cost { color: #ddd; margin-top: 4px; }
.tt-ok { color: #55ff55; }
.tt-bad { color: #ff5555; }
.tt-keys { color: #74748a; font-size: 16px; margin-top: 6px; }
.tt-stat { color: #5555ff; }

.end { background: radial-gradient(ellipse at 50% 40%, #0008, #000d); overflow: hidden; animation: death-in 0.4s ease-out; }
.end.win { background: radial-gradient(ellipse at 50% 35%, #4a3a0066, #000d 70%); }
.end.lose { background: radial-gradient(ellipse at 50% 35%, #4a000055, #000d 70%); }
.end.win .end-title { color: var(--gold); text-shadow: 5px 5px 0 #6a4300, 0 0 40px #ffb30088; }
.end.lose .end-title { color: var(--red); text-shadow: 5px 5px 0 #4a0000; }
.end-panel { width: min(680px, 94vw); position: relative; z-index: 1; animation: end-panel 0.5s cubic-bezier(0.2, 1.3, 0.4, 1) both; }
@keyframes end-panel { from { transform: translateY(40px) scale(0.92); opacity: 0; } }
.end-title { font-size: 92px; font-weight: 400; margin: 0; line-height: 1; animation: title-pop 0.55s 0.1s cubic-bezier(0.2, 1.5, 0.4, 1) both; }
.end-score { font-size: 64px; line-height: 1; margin: 6px 0 2px; display: flex; justify-content: center; gap: 18px; animation: title-sub 0.5s 0.25s ease-out both; }
.end-score .mine { color: #6fe05a; text-shadow: 4px 4px 0 #1f5a16; }
.end-score .theirs { color: #ff6b6b; text-shadow: 4px 4px 0 #5a1414; }
.end-score .dash { color: #aab4cc; }
.end-sub { font-size: 26px; margin: 8px 0 16px; animation: title-sub 0.5s 0.3s ease-out both; }
.end-sub b { color: var(--gold); font-weight: 400; }
.stats { width: 100%; border-collapse: collapse; font-size: 20px; margin-bottom: 14px; }
.stats th, .stats td { padding: 3px 6px; border-bottom: 1px solid #ffffff22; }
.stats th { color: #aab4cc; font-weight: 400; }
.stats tr:not(:first-child) { animation: title-sub 0.4s ease-out both; }
.stats td.who { text-align: left; white-space: nowrap; }
.stats tr.me { background: #ffffff14; box-shadow: inset 3px 0 0 var(--gold); }
.stats .mvp { color: var(--gold); margin-right: 5px; font-family: 'Segoe UI Symbol', sans-serif; font-size: 16px; text-shadow: 0 0 8px #ffb300; }
.end-actions { display: flex; gap: 10px; }
.menu-panel .end-actions .mc-btn { flex: 1; margin: 4px 0 0; }
.confetti { position: absolute; inset: 0; pointer-events: none; }
.confetti i { position: absolute; top: -20px; width: 9px; height: 14px; animation: confetti linear both; }
@keyframes confetti { to { transform: translate(var(--drift), 110vh) rotate(720deg); } }

/* --- battle royale HUD ------------------------------------------------------------------ */
.hidden.gun-cross, .crosshair.hidden, .scope.hidden, .ammo.hidden, .use-bar.hidden, .zone-warn.hidden, .minimap.hidden { display: none; }
.gun-cross { position: absolute; left: 50%; top: 50%; --gap: 6px; mix-blend-mode: difference; }
.gun-cross i { position: absolute; background: #fff; }
.gun-cross i:nth-child(1) { width: 2px; height: 8px; left: -1px; bottom: var(--gap); }
.gun-cross i:nth-child(2) { width: 2px; height: 8px; left: -1px; top: var(--gap); }
.gun-cross i:nth-child(3) { height: 2px; width: 8px; top: -1px; right: var(--gap); }
.gun-cross i:nth-child(4) { height: 2px; width: 8px; top: -1px; left: var(--gap); }
.hitmarker { position: absolute; left: 50%; top: 50%; opacity: 0; }
.hitmarker i { position: absolute; width: 10px; height: 2px; background: #fff; box-shadow: 0 0 2px #000; }
.hitmarker i:nth-child(1) { transform: translate(-16px, -12px) rotate(45deg); }
.hitmarker i:nth-child(2) { transform: translate(6px, -12px) rotate(-45deg); }
.hitmarker i:nth-child(3) { transform: translate(-16px, 10px) rotate(-45deg); }
.hitmarker i:nth-child(4) { transform: translate(6px, 10px) rotate(45deg); }
.hitmarker.on { animation: hitm 0.28s ease-out; }
.hitmarker.head i { background: #ffd23f; }
.hitmarker.kill i { background: #ff3b3b; width: 14px; }
@keyframes hitm { 0% { opacity: 1; } 70% { opacity: 1; } 100% { opacity: 0; } }
.scope { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; }
.scope-hole { width: min(78vh, 78vw); height: min(78vh, 78vw); border-radius: 50%; box-shadow: 0 0 0 200vmax #000; border: 3px solid #000;
  background: linear-gradient(#000, #000) center / 1px 100% no-repeat, linear-gradient(#000, #000) center / 100% 1px no-repeat,
    radial-gradient(circle, transparent 60%, #0005 100%); }
.ammo { position: absolute; right: 24px; bottom: 26px; color: #fff; text-shadow: 3px 3px 0 #000; text-align: right; }
.ammo b { font-size: 48px; font-weight: 400; }
.ammo b.empty { color: #ff5555; }
.ammo small { font-size: 26px; margin-left: 6px; color: #ddd; }
.ammo .reload { width: 120px; height: 6px; background: #0008; margin: 4px 0 0 auto; }
.ammo .reload i { display: block; height: 100%; background: #ffd23f; }
.use-bar { position: absolute; left: 50%; top: 58%; transform: translateX(-50%); text-align: center; color: #fff; font-size: 22px; text-shadow: 2px 2px 0 #000; }
.use-bar div { width: 180px; height: 8px; background: #0008; margin-top: 4px; }
.use-bar i { display: block; height: 100%; background: #6bff6b; }
.zone-warn { position: absolute; left: 50%; top: 22%; transform: translateX(-50%); color: #e6c8ff; font-size: 30px; text-shadow: 2px 2px 0 #2a0050; animation: blinkz 1s steps(2) infinite; }
@keyframes blinkz { 50% { opacity: 0.55; } }
.hud.zone-out::after { content: ''; position: absolute; inset: 0; pointer-events: none; box-shadow: inset 0 0 180px #8a2be2cc; }
.minimap { position: absolute; right: 8px; top: 8px; width: 150px; height: 150px; border: 2px solid #000; background: #1d3a5a; image-rendering: pixelated; }
.hud[data-mode=royale] .sidebar { top: 172px; transform: none; }
.slot .count.mag { color: #ffe08a; }
.slot .count.mag.empty { color: #ff6b6b; }
.hud.spectating .ammo, .hud.spectating .gun-cross, .hud.spectating .use-bar { display: none; }

/* --- skin panel --- */
.skin-row { display: flex; gap: 12px; align-items: center; margin-bottom: 10px; }
#skin-face { width: 48px; height: 48px; image-rendering: pixelated; border: 2px solid #000; background: #c99a74; }
.skin-form { display: flex; gap: 6px; flex-wrap: wrap; }
.skin-form input { flex: 1; min-width: 120px; }
