:root { --accent: #ffb400; --bg: #0b0f14; --panel: rgba(14, 19, 26, 0.92); --text: #e8edf3; --dim: #8a97a6; }
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #000; color: var(--text); font-family: system-ui, "Segoe UI", Roboto, sans-serif; user-select: none; -webkit-user-select: none; }
canvas#c { position: fixed; inset: 0; width: 100%; height: 100%; display: block; }
.hidden { display: none !important; }

/* ---- menu */
#menu { position: fixed; inset: 0; display: flex; align-items: center; justify-content: center; background: radial-gradient(ellipse at center, rgba(8,12,18,0.55), rgba(4,6,9,0.9)); z-index: 20; padding: 16px; overflow: auto; }
.panel { width: min(640px, 100%); background: var(--panel); border: 1px solid #263140; border-radius: 14px; padding: 26px 30px 20px; box-shadow: 0 20px 60px rgba(0,0,0,0.6); }
h1 { margin: 0; font-size: 54px; letter-spacing: 12px; font-weight: 900; color: var(--accent); text-shadow: 0 0 24px rgba(255,180,0,0.35); }
.sub { margin: 2px 0 18px; color: var(--dim); letter-spacing: 2px; text-transform: uppercase; font-size: 12px; }
label { display: block; font-size: 12px; color: var(--dim); text-transform: uppercase; letter-spacing: 1px; margin-bottom: 12px; }
label output { float: right; color: var(--text); }
#name { display: block; width: 100%; margin-top: 4px; padding: 11px 12px; font-size: 18px; font-weight: 700; color: var(--text); background: #0d141c; border: 1px solid #2a384a; border-radius: 8px; outline: none; user-select: text; -webkit-user-select: text; }
#name:focus { border-color: var(--accent); }
input[type=range] { width: 100%; margin: 6px 0 0; accent-color: var(--accent); }
#swatch { display: inline-block; width: 14px; height: 14px; border-radius: 3px; vertical-align: -2px; margin-left: 6px; }
.row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
#play { display: block; width: 100%; margin-top: 6px; padding: 14px; font-size: 22px; font-weight: 900; letter-spacing: 6px; color: #1a1200; background: var(--accent); border: 0; border-radius: 10px; cursor: pointer; transition: transform .08s, filter .15s; }
#play:hover { filter: brightness(1.1); }
#play:active { transform: scale(0.99); }
#play:disabled { filter: grayscale(0.7) brightness(0.7); cursor: wait; }
.status { text-align: center; color: var(--dim); font-size: 13px; margin: 10px 0 14px; min-height: 18px; }
.status.err { color: #ff6b6b; }
.cols { display: grid; grid-template-columns: 1.2fr 1fr; gap: 24px; border-top: 1px solid #222d3b; padding-top: 14px; }
h3 { margin: 0 0 8px; font-size: 12px; letter-spacing: 2px; text-transform: uppercase; color: var(--accent); }
h3 small { color: var(--dim); text-transform: none; letter-spacing: 0; }
.keys { list-style: none; margin: 0; padding: 0; font-size: 13px; color: #b9c4d0; line-height: 1.9; }
kbd { display: inline-block; min-width: 20px; padding: 0 5px; margin-right: 3px; text-align: center; font: 700 11px/18px ui-monospace, Consolas, monospace; color: var(--text); background: #1a2431; border: 1px solid #33445a; border-bottom-width: 2px; border-radius: 4px; }
.career { width: 100%; font-size: 14px; border-collapse: collapse; }
.career td { padding: 3px 0; color: var(--dim); }
.career td + td { text-align: right; color: var(--text); font-weight: 700; }
.fine { margin: 12px 0 0; font-size: 11px; color: #5b6878; text-align: center; }

/* ---- hud */
#hud { position: fixed; inset: 0; pointer-events: none; z-index: 5; font-weight: 700; text-shadow: 0 1px 3px rgba(0,0,0,0.9); }
#crosshair { position: absolute; left: 50%; top: 50%; width: 0; height: 0; --gap: 7px; }
#crosshair i { position: absolute; background: #fff; box-shadow: 0 0 2px #000; }
#crosshair i:nth-child(1) { width: 2px; height: 9px; left: -1px; top: calc(-9px - var(--gap)); }
#crosshair i:nth-child(2) { width: 2px; height: 9px; left: -1px; top: var(--gap); }
#crosshair i:nth-child(3) { height: 2px; width: 9px; top: -1px; left: calc(-9px - var(--gap)); }
#crosshair i:nth-child(4) { height: 2px; width: 9px; top: -1px; left: var(--gap); }
#hitmarker { position: absolute; left: 50%; top: 50%; opacity: 0; transition: opacity .12s; }
#hitmarker i { position: absolute; width: 3px; height: 11px; background: #fff; transform-origin: 50% 0; }
#hitmarker i:nth-child(1) { transform: rotate(45deg) translateY(7px); }
#hitmarker i:nth-child(2) { transform: rotate(135deg) translateY(7px); }
#hitmarker i:nth-child(3) { transform: rotate(225deg) translateY(7px); }
#hitmarker i:nth-child(4) { transform: rotate(315deg) translateY(7px); }
#hitmarker.show { opacity: 1; transition: none; }
#hitmarker.kill i { background: #ff3b3b; }
#hitmarker.head i { background: #ffd23b; }
#scope { position: absolute; inset: 0; background: radial-gradient(circle at center, transparent 0, transparent 26vmin, #000 26.4vmin); }
#scope::before, #scope::after { content: ""; position: absolute; background: rgba(0,0,0,0.85); }
#scope::before { left: 0; right: 0; top: calc(50% - 1px); height: 2px; }
#scope::after { top: 0; bottom: 0; left: calc(50% - 1px); width: 2px; }
#vignette { position: absolute; inset: 0; box-shadow: inset 0 0 160px 40px rgba(220,0,0,0.0); transition: box-shadow .3s; }
#dirs { position: absolute; left: 50%; top: 50%; width: 0; height: 0; }
#dirs i { position: absolute; left: -90px; top: -90px; width: 180px; height: 180px; transition: opacity 1.2s; }
#dirs i::after { content: ""; position: absolute; left: 50%; top: 0; margin-left: -14px; border: 14px solid transparent; border-bottom: 24px solid rgba(255,40,40,0.85); border-top: 0; }

#topinfo { position: absolute; top: 10px; left: 12px; display: flex; gap: 14px; font-size: 13px; color: #cdd6e0; }
#topinfo b { color: #fff; }
#killfeed { position: absolute; top: 12px; right: 14px; display: flex; flex-direction: column; align-items: flex-end; gap: 4px; font-size: 14px; }
#killfeed div { background: rgba(0,0,0,0.45); padding: 3px 10px; border-radius: 4px; animation: fadein .15s; }
#killfeed div.me { outline: 1px solid var(--accent); }
#killfeed .w { color: #aab4c0; margin: 0 6px; font-weight: 400; }
#killfeed .hs { color: #ffd23b; }
#toast { position: absolute; left: 50%; top: 22%; transform: translateX(-50%); font-size: 26px; font-weight: 900; letter-spacing: 3px; text-align: center; color: var(--accent); opacity: 0; transition: opacity .4s; text-transform: uppercase; }
#toast.show { opacity: 1; transition: none; }
#chatlog { position: absolute; left: 14px; bottom: 120px; width: min(460px, 60vw); display: flex; flex-direction: column; gap: 2px; font-size: 14px; font-weight: 600; }
#chatlog div { background: rgba(0,0,0,0.35); padding: 2px 8px; border-radius: 3px; transition: opacity 1s; overflow-wrap: anywhere; }
#chatinput { position: absolute; left: 14px; bottom: 90px; width: min(460px, 60vw); pointer-events: auto; padding: 8px 10px; font-size: 14px; color: #fff; background: rgba(0,0,0,0.7); border: 1px solid var(--accent); border-radius: 4px; outline: none; user-select: text; -webkit-user-select: text; }

#healthbox { position: absolute; left: 20px; bottom: 22px; display: flex; align-items: center; gap: 12px; }
#hpbar { width: 240px; height: 16px; background: rgba(0,0,0,0.55); border: 1px solid rgba(255,255,255,0.35); border-radius: 3px; overflow: hidden; }
#hpfill { display: block; height: 100%; width: 100%; background: linear-gradient(90deg, #36d17a, #8be04a); transition: width .15s; }
#hptext { font-size: 34px; font-weight: 900; min-width: 56px; }
#ammobox { position: absolute; right: 24px; bottom: 20px; text-align: right; }
#ammo { font-size: 54px; font-weight: 900; line-height: 1; }
#ammomax { font-size: 20px; color: #aab4c0; margin-left: 6px; }
#slots { display: flex; gap: 6px; justify-content: flex-end; margin-bottom: 6px; }
#slots span { padding: 3px 10px; font-size: 12px; background: rgba(0,0,0,0.45); border: 1px solid rgba(255,255,255,0.2); border-radius: 3px; color: #aab4c0; }
#slots span.on { color: #1a1200; background: var(--accent); border-color: var(--accent); }
#reloadtxt { font-size: 13px; color: var(--accent); height: 16px; }

#deathscreen { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; background: rgba(60,0,0,0.35); }
#deathscreen h2 { margin: 0; font-size: 64px; letter-spacing: 10px; color: #ff4a4a; }
#deathscreen p { margin: 6px 0; font-size: 20px; }
#sbwrap { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); width: min(680px, 94vw); max-height: 78vh; overflow: hidden; background: rgba(8,12,18,0.88); border: 1px solid #2c3a4c; border-radius: 10px; padding: 14px 18px; }
#sbwrap h3 { font-size: 14px; }
#scoreboard { width: 100%; border-collapse: collapse; font-size: 14px; }
#scoreboard th { text-align: right; font-size: 11px; letter-spacing: 1px; color: var(--dim); text-transform: uppercase; padding: 4px 8px; }
#scoreboard th:nth-child(2), #scoreboard td:nth-child(2) { text-align: left; }
#scoreboard td { padding: 3px 8px; text-align: right; border-top: 1px solid rgba(255,255,255,0.05); }
#scoreboard tr.me td { background: rgba(255,180,0,0.16); color: #fff; }
#scoreboard td:nth-child(1) { color: var(--dim); width: 36px; }
#conn { position: absolute; left: 50%; top: 40%; transform: translateX(-50%); padding: 14px 26px; font-size: 20px; background: rgba(0,0,0,0.75); border: 1px solid var(--accent); border-radius: 8px; }
@keyframes fadein { from { opacity: 0; transform: translateX(10px); } to { opacity: 1; transform: none; } }

@media (max-width: 600px) { .row, .cols { grid-template-columns: 1fr; } h1 { font-size: 40px; } }
#fs { font: inherit; font-weight: 700; color: var(--accent); background: none; border: 1px solid #33445a; border-radius: 4px; padding: 1px 8px; cursor: pointer; }
#fs:hover { filter: brightness(1.2); }

/* ---- control remapping */
#remapbtn { margin-top: 8px; font: inherit; font-size: 12px; font-weight: 700; color: var(--accent); background: none; border: 1px solid #33445a; border-radius: 4px; padding: 4px 10px; cursor: pointer; }
#remapbtn:hover, #rm-reset:hover, #rm-done:hover { filter: brightness(1.25); }
#remap { position: fixed; inset: 0; z-index: 60; display: flex; align-items: center; justify-content: center; background: rgba(2,4,8,0.78); padding: 16px; }
#remap.hidden { display: none; }
.rm-panel { width: min(560px, 100%); max-height: 88vh; overflow: auto; background: var(--panel); border: 1px solid #2a3647; border-radius: 12px; padding: 18px 20px; box-shadow: 0 20px 60px rgba(0,0,0,0.6); }
.rm-help { margin: 0 0 12px; font-size: 12px; color: var(--dim); }
.rm-row { display: grid; grid-template-columns: 1fr 130px 130px; gap: 8px; align-items: center; padding: 3px 0; font-size: 13px; color: #b9c4d0; }
.rm-slot { display: flex; gap: 4px; }
.rm-key { flex: 1; min-width: 0; font: 700 12px ui-monospace, Consolas, monospace; color: var(--text); background: #1a2431; border: 1px solid #33445a; border-radius: 4px; padding: 6px 4px; cursor: pointer; }
.rm-key:hover { border-color: var(--accent); }
.rm-key.on { color: var(--accent); border-color: var(--accent); }
.rm-x { width: 24px; font: 700 14px sans-serif; color: var(--dim); background: none; border: 1px solid #2a3647; border-radius: 4px; cursor: pointer; }
.rm-x:hover { color: #ff6b6b; border-color: #ff6b6b; }
.rm-foot { display: flex; justify-content: space-between; margin-top: 14px; }
.rm-foot button { font: inherit; font-weight: 700; font-size: 13px; color: var(--text); background: #1a2431; border: 1px solid #33445a; border-radius: 6px; padding: 8px 16px; cursor: pointer; }
#rm-done { color: #04120f; background: var(--accent); border-color: var(--accent); }
@media (max-width: 600px) { .rm-row { grid-template-columns: 1fr 1fr 1fr; } }

#nades { font-size: 13px; color: #aab4c0; margin-bottom: 4px; letter-spacing: 1px; }
#nades b { color: var(--accent); }

#roundbar { position: absolute; top: 10px; left: 50%; transform: translateX(-50%); font-size: 15px; letter-spacing: 2px; color: #cdd6e0; background: rgba(0,0,0,0.4); padding: 3px 14px; border-radius: 4px; }
#roundbar.low { color: #ff6a5a; }
#roundend { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; background: rgba(0,0,0,0.55); text-align: center; }
#roundend h2 { margin: 0 0 14px; font-size: 54px; letter-spacing: 8px; color: var(--accent); }
#roundend ol { list-style: none; padding: 0; margin: 0 0 12px; min-width: 340px; font-size: 20px; }
#roundend li { display: flex; justify-content: space-between; gap: 28px; padding: 4px 14px; margin-bottom: 4px; background: rgba(0,0,0,0.4); border-radius: 4px; }
#roundend li:first-child { font-size: 26px; color: #ffd23b; }
#roundend li.me { outline: 1px solid var(--accent); }
#roundend p { margin: 4px 0; font-size: 18px; color: #cdd6e0; }

#re-vote { display: flex; flex-direction: column; align-items: center; gap: 6px; margin: 10px 0 4px; }
#re-vote .re-vh { font-size: 14px; letter-spacing: 3px; text-transform: uppercase; color: #aab4c0; }
#re-vote button { pointer-events: auto; min-width: 300px; padding: 8px 16px; font: inherit; font-size: 18px; font-weight: 700; color: #e8eef5; background: rgba(0,0,0,0.5); border: 1px solid rgba(255,255,255,0.25); border-radius: 6px; cursor: pointer; }
#re-vote button:hover { border-color: var(--accent); }
#re-vote button.on { color: #101820; background: var(--accent); border-color: var(--accent); }

#roundbar { white-space: nowrap; }
@media (max-height: 760px) { #roundend h2 { font-size: 34px; margin-bottom: 8px; } #roundend ol { font-size: 16px; } #roundend li:first-child { font-size: 20px; } #re-vote button { min-width: 240px; padding: 5px 12px; font-size: 15px; } }
