:root {
  --bg: #17261a; --panel: #1f3524; --panel2: #2a4631; --line: #3f6a49; --text: #eef6ee; --muted: #a3bfa6;
  --accent: #e8c547; --good: #7ddc7a; --bad: #ef7b6c; --xp: #5ad1ff;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); font: 16px/1.4 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; overflow: hidden; touch-action: none; user-select: none; -webkit-user-select: none; }
.hidden { display: none !important; }
button, input { font: inherit; color: inherit; }
#cv { position: fixed; inset: 0; width: 100%; height: 100%; display: block; }

.top { position: fixed; top: var(--site-bar, 0px); left: 0; right: 0; display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 8px max(10px, env(safe-area-inset-right)) 4px max(10px, env(safe-area-inset-left)); z-index: 5; pointer-events: none; }
.top > * { pointer-events: auto; }
.top h1 { margin: 0; font-size: 1.2rem; letter-spacing: .03em; color: var(--accent); text-shadow: 0 1px 4px rgba(0,0,0,.6); white-space: nowrap; }
.top-right { display: flex; align-items: center; gap: 6px; }
.langs { display: inline-flex; }
.chip { background: rgba(31,53,36,.88); border: 1px solid var(--line); border-radius: 999px; padding: 5px 11px; font-size: .85rem; cursor: pointer; }
.langs .chip:first-child { border-radius: 999px 0 0 999px; }
.langs .chip:last-child { border-radius: 0 999px 999px 0; border-left: 0; }
.chip.active { background: var(--accent); color: #1a1a10; border-color: var(--accent); font-weight: 700; }

.hud { position: fixed; top: calc(var(--site-bar, 0px) + 46px); left: max(10px, env(safe-area-inset-left)); right: max(10px, env(safe-area-inset-right)); z-index: 4; pointer-events: none; display: grid; gap: 6px; max-width: 460px; }
.bars { display: grid; gap: 4px; }
.bar { position: relative; height: 18px; background: rgba(0,0,0,.5); border: 1px solid rgba(255,255,255,.25); border-radius: 9px; overflow: hidden; }
.bar i { position: absolute; inset: 0; width: 100%; transform-origin: left; transform: scaleX(1); }
.bar.hp i { background: #4fbf5a; }
.bar.hp.low i { background: #d8453a; }
.bar.xp { height: 14px; }
.bar.xp i { background: var(--xp); transform: scaleX(0); }
.bar span { position: relative; display: block; text-align: center; font-size: .72rem; font-weight: 700; line-height: 16px; text-shadow: 0 1px 2px #000; }
.bar.xp span { line-height: 12px; font-size: .66rem; }
.nums { display: flex; gap: 6px; }
.stat { background: rgba(0,0,0,.5); border: 1px solid rgba(255,255,255,.25); border-radius: 10px; padding: 2px 10px; min-width: 72px; }
.stat small { display: block; color: var(--muted); font-size: .62rem; text-transform: uppercase; letter-spacing: .06em; }
.stat b { font-size: 1.05rem; font-variant-numeric: tabular-nums; }
.items { display: flex; flex-wrap: wrap; gap: 4px; }
.items span { background: rgba(0,0,0,.55); border: 1px solid rgba(255,255,255,.25); border-radius: 8px; padding: 1px 7px; font-size: .72rem; }
.items span b { color: var(--accent); }
.alert { background: #b3261e; color: #fff; font-weight: 800; border-radius: 10px; padding: 6px 14px; letter-spacing: .08em; text-align: center; animation: blink .4s infinite alternate; }
@keyframes blink { to { opacity: .45; } }
.pause { position: fixed; top: 40%; left: 50%; transform: translateX(-50%); z-index: 9; background: rgba(0,0,0,.7); padding: 12px 20px; border-radius: 12px; }

.overlay { position: fixed; inset: 0; background: rgba(4,12,6,.6); z-index: 10; display: flex; align-items: flex-start; justify-content: center; overflow-y: auto; padding: calc(var(--site-bar, 0px) + 52px) 12px 16px; touch-action: pan-y; }
#account { z-index: 2147483001; background: rgba(0,0,0,.65); align-items: center; padding-top: 12px; }
.sheet { background: var(--panel); border: 1px solid var(--line); border-radius: 16px; padding: 16px; width: 100%; max-width: 520px; margin: auto; display: grid; gap: 10px; box-shadow: 0 10px 40px rgba(0,0,0,.5); user-select: text; -webkit-user-select: text; }
.sheet.wide { max-width: 680px; margin-top: 0; }
.sheet h2, .sheet h3 { margin: 0; }
.sheet h3 { font-size: .95rem; color: var(--muted); font-weight: 600; }
.sheet p { margin: 0; }
.hint { color: var(--muted); font-size: .88rem; }
.error { color: var(--bad); min-height: 1.2em; font-size: .9rem; }
.big { font-size: 1.3rem; font-weight: 800; color: var(--accent); text-align: center; }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.stats > div { background: var(--panel2); border: 1px solid var(--line); border-radius: 12px; padding: 6px 10px; text-align: center; }
.stats small { display: block; color: var(--muted); font-size: .72rem; text-transform: uppercase; letter-spacing: .05em; }
.stats b { font-size: 1.25rem; font-variant-numeric: tabular-nums; }
.btn { background: var(--accent); color: #1c1a0c; border: 0; border-radius: 12px; padding: 12px 14px; font-weight: 700; cursor: pointer; min-height: 46px; }
.btn.ghost { background: var(--panel2); color: var(--text); border: 1px solid var(--line); font-weight: 600; }
.big-btn { font-size: 1.25rem; min-height: 56px; }
.actions { display: flex; gap: 8px; }
.actions .btn { flex: 1; }
label { display: block; font-size: .88rem; color: var(--muted); margin: 6px 0 4px; }
input[type=text], input[type=password], input[type=email] { width: 100%; background: #0d1a10; border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; }
input:focus-visible, button:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }

.cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.card { text-align: left; background: var(--panel2); border: 2px solid var(--line); border-radius: 14px; padding: 12px; cursor: pointer; display: grid; gap: 6px; align-content: start; min-height: 150px; }
.card:hover, .card:focus-visible { border-color: var(--accent); transform: translateY(-2px); }
.card .tagc { font-size: .7rem; text-transform: uppercase; letter-spacing: .08em; color: var(--accent); font-weight: 800; }
.card.up .tagc { color: var(--xp); }
.card b { font-size: 1.05rem; }
.card small { color: var(--muted); }
.card .key { justify-self: end; background: #0006; border-radius: 6px; padding: 0 7px; font-size: .75rem; color: var(--muted); }
@media (max-width: 560px) { .cards { grid-template-columns: 1fr; } .card { min-height: 0; } }

.top-table { width: 100%; border-collapse: collapse; font-size: .92rem; }
.top-table td { padding: 4px 6px; border-bottom: 1px solid var(--line); }
.top-table td:first-child { width: 2em; color: var(--muted); }
.top-table td:nth-child(n+3) { text-align: right; font-variant-numeric: tabular-nums; }
.top-table tr.me td { color: var(--accent); font-weight: 700; }
@media (max-height: 520px) { .stats b { font-size: 1.05rem; } .big-btn { min-height: 46px; } }

/* ---- Ugly Zombies 3D ---- */
:root { --bg: #18222f; --panel: #202c3d; --panel2: #2b3a50; --line: #45597a; --accent: #f0b84a; --money: #7ddc7a; }
body { background: var(--bg); }
.top h1 { font-size: 1.1rem; }
#xhair { position: fixed; z-index: 3; width: 34px; height: 34px; margin: -17px 0 0 -17px; pointer-events: none; border: 2px solid rgba(255,255,255,.85); border-radius: 50%; box-shadow: 0 0 0 1px rgba(0,0,0,.5); }
#xhair::after { content: ""; position: absolute; left: 50%; top: 50%; width: 4px; height: 4px; margin: -2px; background: #ff5a4a; border-radius: 50%; }
#vignette { position: fixed; inset: 0; z-index: 2; pointer-events: none; box-shadow: inset 0 0 120px 30px rgba(220,0,0,0); transition: box-shadow .25s; }
#vignette.hurt { box-shadow: inset 0 0 120px 30px rgba(220,0,0,.55); transition: none; }
body.playing { cursor: none; }
body.playing.touch { cursor: auto; }
.hud { max-width: 340px; }
.bar.hp { height: 22px; border-radius: 11px; }
.bar.hp span { line-height: 20px; font-size: .8rem; }
.stat.money b { color: var(--money); }
.stat b.bump { animation: bump .3s; }
@keyframes bump { 50% { transform: scale(1.25); color: #fff; } }
.plist { display: grid; gap: 3px; }
.plist div { display: grid; grid-template-columns: 10px 1fr 54px; gap: 6px; align-items: center; background: rgba(0,0,0,.45); border-radius: 8px; padding: 2px 8px; font-size: .75rem; }
.plist i { width: 10px; height: 10px; border-radius: 50%; display: block; }
.plist em { display: block; height: 6px; background: #0007; border-radius: 3px; overflow: hidden; font-style: normal; }
.plist em b { display: block; height: 100%; background: #4fbf5a; }
.plist .dead { opacity: .45; }
.msg { position: fixed; top: calc(var(--site-bar, 0px) + 46px); left: 50%; transform: translateX(-50%); z-index: 4; background: rgba(0,0,0,.6); border-radius: 12px; padding: 6px 14px; font-weight: 700; text-align: center; pointer-events: none; max-width: 70vw; }
.banner { position: fixed; top: 28%; left: 0; right: 0; text-align: center; z-index: 6; font-size: clamp(1.8rem, 6vw, 3.4rem); font-weight: 900; letter-spacing: .06em; color: #fff; text-shadow: 0 3px 12px #000, 0 0 30px rgba(255,60,40,.7); pointer-events: none; animation: ban 2.2s forwards; }
.banner.good { color: var(--money); text-shadow: 0 3px 12px #000; }
@keyframes ban { 0% { opacity: 0; transform: scale(1.4); } 12% { opacity: 1; transform: scale(1); } 80% { opacity: 1; } 100% { opacity: 0; } }
.weapon { position: fixed; right: max(12px, env(safe-area-inset-right)); bottom: calc(14px + env(safe-area-inset-bottom)); z-index: 4; pointer-events: none; text-align: right; background: rgba(0,0,0,.5); border-radius: 12px; padding: 6px 12px; min-width: 120px; }
.weapon .wname { font-size: .75rem; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.ammo b { font-size: 1.7rem; font-variant-numeric: tabular-nums; }
.ammo span { color: var(--muted); font-size: 1rem; margin-left: 4px; }
.rl { height: 4px; background: #0007; border-radius: 2px; overflow: hidden; margin-top: 3px; opacity: 0; }
.rl.on { opacity: 1; }
.rl i { display: block; height: 100%; width: 0; background: var(--accent); }
.wbar { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(10px + env(safe-area-inset-bottom)); z-index: 5; display: flex; gap: 6px; }
.wbar button { background: rgba(32,44,61,.85); border: 2px solid var(--line); border-radius: 10px; padding: 4px 10px; min-width: 46px; min-height: 40px; cursor: pointer; font-size: .78rem; }
.wbar button.cur { border-color: var(--accent); background: rgba(80,60,20,.85); }
.wbar button small { display: block; color: var(--muted); font-size: .62rem; }
body.touch .wbar { left: 12px; transform: none; bottom: calc(14px + env(safe-area-inset-bottom)); }
body.touch .wbar button { min-width: 38px; min-height: 36px; padding: 2px 6px; }
body.touch .wbar button small { display: none; }

#touch { position: fixed; inset: 0; z-index: 3; pointer-events: none; }
.zone { position: absolute; top: 0; bottom: 0; width: 50%; pointer-events: auto; touch-action: none; }
#zone-l { left: 0; } #zone-r { right: 0; }
.stick { position: absolute; width: 120px; height: 120px; margin: -60px 0 0 -60px; border-radius: 50%; border: 2px solid rgba(255,255,255,.4); background: rgba(255,255,255,.08); pointer-events: none; }
.stick i { position: absolute; left: 50%; top: 50%; width: 52px; height: 52px; margin: -26px; border-radius: 50%; background: rgba(255,255,255,.45); }
.tbtn { position: absolute; width: 54px; height: 54px; border-radius: 50%; border: 2px solid rgba(255,255,255,.5); background: rgba(20,30,45,.7); color: #fff; font-size: 1.5rem; pointer-events: auto; right: max(14px, env(safe-area-inset-right)); touch-action: none; }
#b-reload { bottom: calc(120px + env(safe-area-inset-bottom)); }
#b-swap { bottom: calc(190px + env(safe-area-inset-bottom)); }

.row { display: flex; gap: 8px; }
.row input { flex: 1; text-transform: uppercase; letter-spacing: .3em; font-weight: 800; text-align: center; font-size: 1.2rem; }
.roomcode { font-size: 2.6rem; font-weight: 900; letter-spacing: .3em; text-align: center; color: var(--accent); background: var(--panel2); border-radius: 12px; padding: 4px 0 4px .3em; }
.lobby { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.lobby li { background: var(--panel2); border: 1px solid var(--line); border-radius: 10px; padding: 6px 12px; display: flex; align-items: center; gap: 8px; }
.lobby li i { width: 12px; height: 12px; border-radius: 50%; display: block; }
.lobby li small { margin-left: auto; color: var(--muted); }
.shop-head { display: flex; justify-content: space-between; align-items: center; }
.shop-money { font-size: 1.5rem; font-weight: 800; color: var(--money); }
.cards { grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); }
.card { min-height: 0; cursor: default; }
.card:hover { transform: none; border-color: var(--line); }
.card.owned { opacity: .7; }
.card .price { color: var(--money); font-weight: 800; }
.card button { margin-top: 4px; min-height: 38px; padding: 6px 10px; }
.card button:disabled { opacity: .45; cursor: not-allowed; }
.pips { letter-spacing: .15em; color: var(--accent); font-size: .85rem; }
@media (max-width: 560px) { .cards { grid-template-columns: 1fr 1fr; } }
@media (max-width: 380px) { .cards { grid-template-columns: 1fr; } }
.cards { grid-template-columns: repeat(auto-fill, minmax(165px, 1fr)); }
.shop-foot { position: sticky; bottom: -16px; margin: 0 -16px -16px; padding: 10px 16px 14px; background: linear-gradient(transparent, var(--panel) 25%); display: grid; gap: 6px; }
body.playing .langs, body.playing #btn-account, body.playing .top h1 { display: none; }
@media (max-width: 520px) { .chip { padding: 4px 9px; } .top h1 { font-size: .95rem; } }
body.touch .wbar { bottom: calc(78px + env(safe-area-inset-bottom)); left: 8px; }
@media (max-width: 520px) { .msg { top: calc(var(--site-bar, 0px) + 160px); } }
