:root {
  --amber: #ffb347; --amber2: #ffd9a0; --red: #ff5a4a; --green: #7dff9d; --bg: #07060a; --panel: rgba(14, 10, 8, .88);
  --mono: "Courier New", "Lucida Console", monospace;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; background: #000; color: var(--amber2); font-family: var(--mono); overflow: hidden; user-select: none; }
canvas#game { position: fixed; inset: 0; width: 100vw; height: 100vh; image-rendering: pixelated; image-rendering: crisp-edges; background: #000; }
canvas#grain { position: fixed; inset: 0; width: 100vw; height: 100vh; pointer-events: none; mix-blend-mode: overlay; opacity: .22; image-rendering: pixelated; z-index: 3; }
#vignette { position: fixed; inset: 0; pointer-events: none; z-index: 4; background: radial-gradient(ellipse at center, transparent 45%, rgba(0, 0, 0, .75) 100%); }
#hurt { position: fixed; inset: 0; pointer-events: none; z-index: 5; background: radial-gradient(ellipse at center, transparent 30%, rgba(200, 0, 0, .85) 100%); opacity: 0; transition: opacity .35s; }
#fade { position: fixed; inset: 0; pointer-events: none; z-index: 40; background: #000; opacity: 0; transition: opacity .8s; display: flex; align-items: center; justify-content: center; text-align: center; font-size: 28px; letter-spacing: 3px; color: var(--amber); white-space: pre-line; }
.hidden { display: none !important; }

button, input, select { font-family: var(--mono); color: var(--amber2); }
button { background: #241608; border: 2px solid var(--amber); padding: 8px 14px; cursor: pointer; letter-spacing: 1px; text-transform: uppercase; font-weight: bold; }
button:hover:not(:disabled) { background: var(--amber); color: #120a04; }
button:disabled { opacity: .4; cursor: not-allowed; }
button.big { padding: 12px 18px; font-size: 16px; }
button.alt { border-color: var(--green); color: var(--green); background: #0a1a0e; }
button.alt:hover:not(:disabled) { background: var(--green); color: #031008; }
button.small { padding: 2px 10px; }
input[type=text], input:not([type]), input[type=text] { background: #0c0806; border: 2px solid #6a4a2a; padding: 10px; font-size: 16px; width: 100%; }
input:focus { outline: none; border-color: var(--amber); }
select { background: #0c0806; border: 2px solid #6a4a2a; padding: 4px; }

.screen { position: fixed; inset: 0; z-index: 20; display: flex; align-items: center; justify-content: center; overflow-y: auto; }
#menu { background: radial-gradient(ellipse at 50% 20%, #1a0f08 0%, #050304 70%), #000; z-index: 10; align-items: flex-start; }
#menu:before { content: ""; position: absolute; inset: 0; background: repeating-linear-gradient(0deg, rgba(0, 0, 0, .25) 0 2px, transparent 2px 4px); pointer-events: none; }
.menu-inner { max-width: 1100px; width: 100%; padding: 24px 20px 40px; margin: 0 auto; position: relative; }
.title { font-size: clamp(40px, 8vw, 84px); margin: 6px 0 0; letter-spacing: 6px; color: var(--amber); text-shadow: 3px 0 #ff2a2a, -3px 0 #2affea, 0 0 24px rgba(255, 150, 40, .6); animation: glitch 4s infinite steps(1); text-align: center; }
@keyframes glitch { 0%, 92%, 100% { transform: none; text-shadow: 3px 0 #ff2a2a, -3px 0 #2affea, 0 0 24px rgba(255, 150, 40, .6); } 93% { transform: translate(-4px, 2px) skewX(6deg); text-shadow: -6px 0 #ff2a2a, 6px 0 #2affea; } 95% { transform: translate(5px, -2px); } 97% { transform: translate(-2px, 0) skewX(-4deg); } }
.tag { text-align: center; opacity: .75; margin: 4px 0 22px; font-size: 14px; }
.menu-cols { display: grid; grid-template-columns: 330px 1fr; gap: 18px; }
.panel { background: var(--panel); border: 2px solid #6a4a2a; padding: 16px; box-shadow: 0 0 30px rgba(255, 140, 30, .08), inset 0 0 40px rgba(0, 0, 0, .5); position: relative; z-index: 1; }
.panel h2 { margin: 0 0 12px; font-size: 16px; letter-spacing: 3px; color: var(--amber); border-bottom: 1px dashed #6a4a2a; padding-bottom: 6px; }
.panel h3 { margin: 0; font-size: 12px; letter-spacing: 2px; opacity: .7; }
.fld { display: block; font-size: 11px; letter-spacing: 2px; margin-bottom: 14px; opacity: .9; }
.fld input { margin-top: 4px; }
.row { display: flex; gap: 10px; margin: 10px 0; align-items: center; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.row input { flex: 0 0 90px; text-transform: uppercase; text-align: center; letter-spacing: 6px; font-size: 20px; }
.chk { font-size: 13px; cursor: pointer; display: flex; gap: 6px; align-items: center; }
.sel { font-size: 13px; display: flex; gap: 8px; align-items: center; }
.opts { margin-top: 14px; padding-top: 12px; border-top: 1px dashed #6a4a2a; display: flex; flex-direction: column; gap: 10px; }
.err { color: var(--red); min-height: 20px; margin-top: 8px; font-size: 14px; }
.lobbies { min-height: 70px; max-height: 150px; overflow-y: auto; border: 1px solid #4a3220; padding: 6px; font-size: 13px; }
.lobbies .lob { display: flex; justify-content: space-between; align-items: center; padding: 5px 4px; border-bottom: 1px dotted #4a3220; }
.lobbies em { opacity: .5; }
.help { margin-top: 18px; font-size: 13px; position: relative; z-index: 1; }
.help summary { cursor: pointer; color: var(--amber); letter-spacing: 2px; }
.helpgrid { display: grid; gap: 8px; margin-top: 10px; background: var(--panel); padding: 12px; border: 1px solid #4a3220; line-height: 1.5; }
.helpgrid b { color: var(--amber); }
.foot { text-align: center; margin-top: 16px; opacity: .4; font-size: 12px; }

/* customizer */
.cust { display: flex; flex-direction: column; gap: 6px; align-items: stretch; }
.cust canvas { width: 100%; height: 260px; background: radial-gradient(circle at 50% 40%, #2a1c12, #0a0706); border: 1px solid #4a3220; cursor: grab; image-rendering: pixelated; }
.cust .crow { display: flex; align-items: center; gap: 6px; font-size: 12px; }
.cust .crow label { width: 70px; opacity: .7; letter-spacing: 1px; }
.cust .crow .val { flex: 1; text-align: center; color: var(--amber); }
.cust .crow button { padding: 2px 10px; }
.cust .swatches { display: flex; flex-wrap: wrap; gap: 4px; }
.cust .sw { width: 22px; height: 22px; padding: 0; border: 2px solid #000; }
.cust .sw.on { border-color: #fff; box-shadow: 0 0 6px #fff; }
.cust .emos { display: flex; flex-wrap: wrap; gap: 4px; }
.cust .emos button { padding: 2px 6px; font-size: 16px; }

/* HUD */
#hud { position: fixed; inset: 0; z-index: 8; pointer-events: none; }
#topbar { position: absolute; top: 10px; left: 50%; transform: translateX(-50%); text-align: center; text-shadow: 0 0 6px #000, 0 0 2px #000; }
#clock { font-size: 26px; color: var(--amber); letter-spacing: 3px; }
#objective { font-size: 14px; opacity: .9; margin-top: 2px; }
#codebox { position: absolute; top: 10px; right: 14px; font-size: 13px; opacity: .7; text-align: right; text-shadow: 0 0 4px #000; }
#roster { position: absolute; top: 10px; left: 14px; font-size: 13px; text-shadow: 0 0 4px #000, 0 0 2px #000; line-height: 1.5; }
#roster .dead { opacity: .45; text-decoration: line-through; }
#roster .talk { color: var(--green); }
#feed { position: absolute; left: 14px; bottom: 170px; width: 420px; font-size: 14px; display: flex; flex-direction: column; gap: 2px; text-shadow: 0 0 4px #000, 0 0 2px #000; }
#feed div { animation: fadeout 12s forwards; }
#feed .bad { color: var(--red); } #feed .good { color: var(--green); } #feed .warn { color: #ffd23b; } #feed .chat b { color: var(--amber); }
@keyframes fadeout { 0%, 80% { opacity: 1; } 100% { opacity: 0; } }
#center { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; }
#cross { width: 6px; height: 6px; border-radius: 50%; background: rgba(255, 230, 190, .75); box-shadow: 0 0 4px #000; }
#prompt { position: absolute; top: calc(50% + 40px); font-size: 17px; background: rgba(0, 0, 0, .55); padding: 4px 10px; border: 1px solid #6a4a2a; display: none; text-shadow: 0 0 3px #000; white-space: nowrap; }
#prompt b { color: #000; background: var(--amber); padding: 0 6px; margin-right: 6px; }
#banner { position: absolute; top: 18%; width: 100%; text-align: center; font-size: 40px; letter-spacing: 6px; color: var(--red); text-shadow: 0 0 20px rgba(255, 0, 0, .7), 0 0 4px #000; opacity: 0; transition: opacity .5s; white-space: pre-line; }
#banner small { display: block; font-size: 16px; letter-spacing: 2px; color: var(--amber2); margin-top: 6px; }
#rolebox { position: absolute; top: 62px; width: 100%; text-align: center; font-size: 14px; color: var(--amber); text-shadow: 0 0 4px #000; }
#bars { position: absolute; left: 14px; bottom: 14px; width: 220px; display: flex; flex-direction: column; gap: 6px; }
.bar { height: 16px; background: rgba(0, 0, 0, .6); border: 1px solid #6a4a2a; position: relative; }
.bar i { display: block; height: 100%; width: 100%; transition: width .1s; }
.bar.hp i { background: linear-gradient(#ff6a5a, #b02a20); } .bar.st i { background: linear-gradient(#ffd23b, #b08a10); }
.bar span { position: absolute; left: 6px; top: -1px; font-size: 11px; letter-spacing: 2px; text-shadow: 0 0 3px #000; }
#slots { position: absolute; bottom: 14px; left: 50%; transform: translateX(-50%); display: flex; gap: 8px; }
.slot { width: 68px; height: 68px; background: rgba(0, 0, 0, .6); border: 2px solid #5a4028; display: flex; flex-direction: column; align-items: center; justify-content: center; position: relative; font-size: 30px; }
.slot.sel { border-color: var(--amber); box-shadow: 0 0 12px rgba(255, 170, 60, .5); background: rgba(60, 30, 5, .7); }
.slot .k { position: absolute; top: 1px; left: 4px; font-size: 11px; opacity: .6; }
.slot .v { position: absolute; bottom: 1px; right: 4px; font-size: 12px; color: var(--green); }
.slot .bt { position: absolute; bottom: 3px; left: 5px; right: 5px; height: 4px; background: #222; } .slot .bt i { display: block; height: 100%; background: #ffd23b; }
#micbox { position: absolute; bottom: 14px; right: 14px; font-size: 14px; text-align: right; text-shadow: 0 0 4px #000; }
#chatbox { position: absolute; left: 14px; bottom: 100px; width: 420px; display: none; pointer-events: auto; }
#chatbox input { background: rgba(0, 0, 0, .75); font-size: 15px; padding: 6px 8px; }
#wheel { position: absolute; left: 50%; top: 50%; width: 360px; height: 360px; margin: -180px 0 0 -180px; display: none; border-radius: 50%; background: radial-gradient(circle, rgba(0, 0, 0, .75) 30%, rgba(40, 20, 5, .65) 70%); border: 2px solid var(--amber); }
#wheel .ws { position: absolute; width: 90px; height: 70px; margin: -35px 0 0 -45px; text-align: center; font-size: 12px; opacity: .65; transition: transform .1s; }
#wheel .ws i { display: block; font-style: normal; font-size: 32px; }
#wheel .ws.on { opacity: 1; transform: scale(1.35); color: var(--amber); text-shadow: 0 0 10px var(--amber); }
#wheel .hint { position: absolute; left: 0; right: 0; top: 46%; text-align: center; font-size: 12px; opacity: .7; }
#spec { position: absolute; bottom: 110px; width: 100%; text-align: center; font-size: 18px; color: var(--red); text-shadow: 0 0 6px #000; }

/* modals */
.modal { position: fixed; inset: 0; z-index: 25; background: rgba(0, 0, 0, .72); display: flex; align-items: center; justify-content: center; overflow-y: auto; }
.modal-box { background: var(--panel); border: 2px solid var(--amber); padding: 20px; width: min(920px, 96vw); max-height: 92vh; overflow-y: auto; box-shadow: 0 0 40px rgba(255, 150, 40, .2); }
.modal-box h2 { margin: 0 0 12px; letter-spacing: 4px; color: var(--amber); }
.tabs { display: flex; gap: 8px; margin-bottom: 14px; }
.tabs button.on { background: var(--amber); color: #120a04; }
.cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.card { border: 2px solid #5a4028; padding: 12px; cursor: pointer; background: rgba(0, 0, 0, .4); }
.card:hover { border-color: var(--amber2); }
.card.on { border-color: var(--green); box-shadow: 0 0 14px rgba(125, 255, 157, .35); }
.card h4 { margin: 0 0 6px; color: var(--amber); letter-spacing: 1px; }
.card p { margin: 4px 0; font-size: 13px; opacity: .85; }
.modes { display: flex; gap: 12px; margin: 14px 0; }
.modes .card { flex: 1; }
.shop { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 10px; }
.shop .it { border: 1px solid #5a4028; padding: 10px; display: flex; flex-direction: column; gap: 4px; background: rgba(0, 0, 0, .4); }
.shop .it .ic { font-size: 30px; }
.shop .it p { font-size: 12px; opacity: .8; margin: 0; min-height: 30px; }
.note { font-size: 13px; opacity: .8; margin: 8px 0; }
.stat { display: flex; gap: 20px; flex-wrap: wrap; margin-bottom: 10px; color: var(--green); }

#pause { background: rgba(0, 0, 0, .65); z-index: 30; }
#pause .panel { text-align: center; min-width: 320px; }
#pause .panel button { display: block; width: 100%; margin: 8px 0; }
#pause .code { font-size: 44px; letter-spacing: 12px; color: var(--amber); margin: 8px 0; }
#results { background: rgba(0, 0, 0, .8); z-index: 28; }
#results .panel { min-width: min(640px, 94vw); }
#results h1 { margin: 0 0 6px; font-size: 32px; letter-spacing: 4px; }
#results h1.win { color: var(--green); } #results h1.lose { color: var(--red); }
#results table { width: 100%; border-collapse: collapse; margin: 14px 0; }
#results td, #results th { padding: 5px 8px; text-align: left; border-bottom: 1px dotted #4a3220; }
#results .award { color: #ffd23b; }

@media (max-width: 860px) { .menu-cols { grid-template-columns: 1fr; } .cards { grid-template-columns: 1fr; } }
