* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #0b0d10; font-family: system-ui, -apple-system, "Segoe UI", sans-serif; color: #eee; touch-action: none; user-select: none; }
canvas { display: block; }
.hidden { display: none !important; }

#loading { position: fixed; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; background: radial-gradient(#1b2028, #07080a); z-index: 20; }
h1 { font-size: clamp(42px, 9vw, 86px); letter-spacing: 0.18em; margin: 6px 0 0; font-weight: 900; color: #f1ece4; text-shadow: 0 4px 30px rgba(255, 110, 30, 0.35); }
.sub { letter-spacing: 0.45em; color: #ff7a1a; font-size: 13px; font-weight: 700; margin-bottom: 26px; }
.credit { letter-spacing: 0.5em; font-size: 11px; color: #9aa3ad; }
.barwrap { width: min(420px, 80vw); height: 6px; background: #22272e; border-radius: 3px; overflow: hidden; }
#loadbar { height: 100%; width: 0; background: linear-gradient(90deg, #ff7a1a, #ffb366); transition: width .2s; }
#loadtxt { margin-top: 12px; color: #8b95a1; font-size: 13px; }

#menu { position: fixed; inset: 0; display: flex; align-items: center; justify-content: center; z-index: 10; background: linear-gradient(90deg, rgba(5, 7, 10, 0.82), rgba(5, 7, 10, 0.25)); }
.panel { width: min(440px, 92vw); padding: 28px; background: rgba(14, 17, 22, 0.86); border: 1px solid #2a3038; border-radius: 14px; backdrop-filter: blur(8px); text-align: center; max-height: 94vh; overflow: auto; }
.panel h1 { font-size: 54px; }
button { font: inherit; display: block; width: 100%; margin: 10px 0; padding: 14px; border-radius: 10px; border: 1px solid #39414b; background: #1c2129; color: #eee; font-weight: 700; font-size: 17px; cursor: pointer; }
button.primary { background: #ff7a1a; border-color: #ff7a1a; color: #111; }
button:disabled { opacity: 0.45; cursor: default; }
.opts { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; margin: 16px 0 8px; font-size: 13px; color: #aab3bd; }
.opts select { margin-left: 4px; background: #1c2129; color: #eee; border: 1px solid #39414b; border-radius: 6px; padding: 4px; }
details { text-align: left; margin-top: 10px; font-size: 13px; color: #b8c0c9; }
summary { cursor: pointer; color: #ff9a4d; font-weight: 700; }
.help { margin-top: 8px; line-height: 1.55; }

#hud { position: fixed; inset: 0; pointer-events: none; z-index: 5; }
#crosshair { position: absolute; left: 50%; top: 50%; width: 6px; height: 6px; margin: -3px; border-radius: 50%; background: rgba(255, 255, 255, 0.85); box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.35); }
#dmg { position: absolute; inset: 0; opacity: 0; background: radial-gradient(ellipse at center, rgba(120, 0, 0, 0) 45%, rgba(140, 0, 0, 0.85) 100%); }
#splat { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; }
#deadmsg { position: absolute; inset: 0; display: none; flex-direction: column; align-items: center; justify-content: center; text-align: center; font-size: 64px; font-weight: 900; letter-spacing: 0.2em; color: #c11; background: rgba(0, 0, 0, 0.5); }
#hpbar { position: absolute; left: 24px; bottom: 24px; width: 240px; height: 10px; background: rgba(0, 0, 0, 0.5); border-radius: 5px; overflow: hidden; }
#hpfill { height: 100%; width: 100%; background: #e8e8e8; }
#info { position: absolute; right: 24px; bottom: 20px; text-align: right; text-shadow: 0 1px 4px #000; }
#itemname { font-weight: 800; font-size: 18px; }
#ammo { font-family: ui-monospace, monospace; font-size: 22px; color: #9ff; }
#topright { position: absolute; right: 24px; top: 18px; text-align: right; font-weight: 700; text-shadow: 0 1px 4px #000; }
#wave { color: #ff7a1a; }

#touch { position: fixed; inset: 0; z-index: 6; pointer-events: none; }
#lookzone { position: absolute; right: 0; top: 0; width: 55%; height: 100%; pointer-events: auto; }
#joy { position: absolute; left: 30px; bottom: 30px; width: 130px; height: 130px; border-radius: 50%; background: rgba(255, 255, 255, 0.08); border: 2px solid rgba(255, 255, 255, 0.25); pointer-events: auto; }
#knob { position: absolute; left: 40px; top: 40px; width: 50px; height: 50px; border-radius: 50%; background: rgba(255, 255, 255, 0.35); }
#tbtns { position: absolute; right: 16px; bottom: 16px; display: grid; grid-template-columns: repeat(3, 76px); gap: 8px; pointer-events: auto; }
#tbtns button { margin: 0; padding: 12px 4px; font-size: 12px; background: rgba(20, 24, 30, 0.6); }
#tbtns .big { grid-column: span 3; padding: 20px; font-size: 18px; background: rgba(255, 122, 26, 0.75); color: #111; }

.credits { margin-top: 14px; font-size: 11px; color: #7d8792; }
#heard { position: absolute; left: 50%; bottom: 70px; transform: translateX(-50%); padding: 8px 14px; background: rgba(0,0,0,0.55); border-radius: 10px; font-weight: 600; opacity: 0; transition: opacity .4s; white-space: nowrap; }
#chat { position: absolute; left: 50%; bottom: 110px; transform: translateX(-50%); display: flex; gap: 6px; width: min(560px, 92vw); pointer-events: auto; }
#chat input { flex: 1; font: inherit; font-size: 16px; padding: 12px; border-radius: 10px; border: 1px solid #ff7a1a; background: rgba(10,12,16,0.9); color: #fff; }
#chat button { width: auto; margin: 0; padding: 10px 14px; }

.mem { font-size: 12px; color: #aab3bd; margin: 6px 0 4px; display: flex; gap: 8px; align-items: center; justify-content: center; flex-wrap: wrap; }
button.small { width: auto; display: inline-block; margin: 0; padding: 6px 10px; font-size: 12px; }

#toast { position: absolute; left: 50%; top: 18%; transform: translateX(-50%); padding: 8px 16px; background: rgba(0,0,0,0.6); border-radius: 10px; font-weight: 700; color: #ffd27a; opacity: 0; transition: opacity .4s; white-space: nowrap; pointer-events: none; }
#fxstatus { position: absolute; left: 16px; bottom: 64px; font: 700 15px/1.2 sans-serif; color: #c9a6ff; text-shadow: 0 1px 3px #000; pointer-events: none; }
#fxflash { position: absolute; inset: 0; opacity: 0; pointer-events: none; }

#deadmsg small { display: block; margin-top: 14px; font-size: 22px; letter-spacing: 0.05em; color: #f2d2d2; font-weight: 600; }
#bloodhud { position: absolute; left: 20px; bottom: 44px; font: 600 14px sans-serif; color: #ff6a6a; text-shadow: 0 1px 2px #000; }

/* multiplayer box in the menu */
.mp { margin: 14px 0 6px; padding: 10px 12px; border: 1px solid rgba(255,255,255,0.18); border-radius: 10px; display: grid; gap: 8px; text-align: left; }
.mphead { font-weight: 700; letter-spacing: 0.04em; }
.mp label { display: flex; justify-content: space-between; gap: 10px; align-items: center; font-size: 14px; }
.mp input { flex: 1; max-width: 200px; font: inherit; font-size: 16px; padding: 6px 8px; border-radius: 6px; border: 1px solid rgba(255,255,255,0.25); background: rgba(0,0,0,0.35); color: #fff; }
#mpStatus { font-size: 13px; opacity: 0.85; }
#btnFlat.hidden { display: none; }
