:root {
  --amber: #ff9a2e;
  --amber-dim: #b3601a;
  --red: #ff3b2f;
  --green: #3cff6a;
  --ink: #0a0806;
  --font: 'Share Tech Mono', 'VT323', monospace;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #000; color: var(--amber); font-family: var(--font); user-select: none; }
canvas#c { position: fixed; inset: 0; width: 100vw; height: 100vh; display: block; image-rendering: pixelated; }
.hidden { display: none !important; }

#overlay-grain { position: fixed; inset: 0; pointer-events: none; z-index: 2; opacity: .09;
  background-image: repeating-linear-gradient(0deg, rgba(0,0,0,.6) 0 1px, transparent 1px 3px);
  mix-blend-mode: multiply; }
#visor { position: fixed; inset: 0; pointer-events: none; z-index: 3;
  background: radial-gradient(ellipse 75% 70% at 50% 50%, transparent 62%, rgba(0,0,0,.55) 88%, rgba(0,0,0,.9) 100%); }
#hurt { position: fixed; inset: 0; pointer-events: none; z-index: 4; opacity: 0; transition: opacity .15s;
  background: radial-gradient(ellipse at center, transparent 35%, rgba(170,0,0,.75) 100%); }
#fear { position: fixed; inset: 0; pointer-events: none; z-index: 4; opacity: 0;
  background: radial-gradient(ellipse at center, transparent 25%, rgba(0,0,0,.95) 90%); }
#flash { position: fixed; inset: 0; pointer-events: none; z-index: 20; opacity: 0; background: #fff; }
#fade { position: fixed; inset: 0; pointer-events: none; z-index: 19; opacity: 0; background: #000; transition: opacity .35s; }

/* ================= menu ================= */
.screen { position: fixed; inset: 0; z-index: 30; display: flex; align-items: center; justify-content: center; }
#menu { background: #050403; overflow: auto; align-items: flex-start; }
.menu-bg { position: fixed; inset: 0; background:
  radial-gradient(ellipse at 50% 120%, rgba(255,120,30,.18), transparent 60%),
  repeating-linear-gradient(0deg, rgba(255,154,46,.03) 0 2px, transparent 2px 4px); animation: flick 6s infinite; }
@keyframes flick { 0%,100% { opacity: 1 } 47% { opacity: .85 } 48% { opacity: 1 } 80% { opacity: .95 } }
.menu-inner { position: relative; width: min(760px, 100% - 32px); margin: auto; padding: 24px 0; display: flex; flex-direction: column; gap: 16px; }
.logo { text-align: center; line-height: .82; filter: drop-shadow(0 0 18px rgba(255,80,20,.45)); }
.logo-top, .logo-bot { font-family: 'VT323', monospace; font-size: clamp(64px, 14vw, 132px); color: #ff3b1f; letter-spacing: 6px; transform: skewX(-6deg); }
.logo-bot { color: #ff6a1f; }
.logo-sub { margin-top: 14px; color: var(--amber-dim); letter-spacing: 2px; font-size: 14px; }
.panel { border: 2px solid var(--amber-dim); background: rgba(20,10,4,.82); padding: 18px; display: flex; flex-direction: column; gap: 12px; box-shadow: 0 0 30px rgba(255,120,30,.08) inset; }
.panel.small { font-size: 13px; line-height: 1.5; color: #d9a26a; }
label { display: flex; flex-direction: column; gap: 6px; font-size: 13px; letter-spacing: 1px; }
label.check { flex-direction: row; align-items: center; }
input { font-family: var(--font); background: #120a04; color: var(--amber); border: 1px solid var(--amber-dim); padding: 10px; font-size: 18px; outline: none; }
input:focus { border-color: var(--amber); box-shadow: 0 0 8px rgba(255,154,46,.4); }
input[type=range] { padding: 0; accent-color: var(--amber); }
input.code { text-transform: uppercase; letter-spacing: 6px; flex: 1; text-align: center; min-width: 0; }
.row { display: flex; gap: 10px; flex-wrap: wrap; }
.row > * { flex: 1; }
.btn { font-family: var(--font); background: #2a1406; color: var(--amber); border: 2px solid var(--amber); padding: 10px 14px; font-size: 16px; cursor: pointer; letter-spacing: 2px; transition: background .1s, color .1s; }
.btn:hover { background: var(--amber); color: #120800; }
.btn.big { font-size: 20px; padding: 14px; }
.btn.danger { border-color: var(--red); color: var(--red); }
.btn.danger:hover { background: var(--red); color: #000; }
.btn:disabled { opacity: .4; cursor: wait; }
.colors { display: flex; gap: 8px; flex-wrap: wrap; }
.colors div { width: 30px; height: 30px; border: 2px solid #000; cursor: pointer; outline: 2px solid transparent; }
.colors div.sel { outline-color: var(--amber); }
.msg { min-height: 20px; color: #ffd08a; font-size: 14px; white-space: pre-wrap; }
.msg.err { color: var(--red); }
.credits { font-size: 11px; color: #6a4a2a; text-align: center; }

/* ================= loading ================= */
#loading { background: #000; }
.load-inner { width: min(520px, 100% - 32px); }
.load-title { font-size: 22px; letter-spacing: 4px; margin-bottom: 12px; animation: flick 1s infinite; }
.bar { height: 14px; border: 1px solid var(--amber-dim); background: #120800; }
.bar > div { height: 100%; width: 0; background: var(--amber); transition: width .2s; }
.bar.thin { height: 6px; width: 110px; }
#loadLog { font-size: 12px; color: #b37a3a; min-height: 120px; white-space: pre-wrap; }

/* ================= hud ================= */
#hud { position: fixed; inset: 0; pointer-events: none; z-index: 10; text-shadow: 0 0 6px rgba(255,120,20,.6); }
#crosshair { position: absolute; left: 50%; top: 50%; width: 4px; height: 4px; margin: -2px; background: rgba(255,200,150,.8); border-radius: 50%; }
#prompt { position: absolute; left: 50%; top: calc(50% + 28px); transform: translateX(-50%); font-size: 20px; color: #fff3e0; text-shadow: 0 0 4px #000, 0 0 8px #000; white-space: nowrap; }
#stats { position: absolute; left: 24px; top: 22px; }
.hpwrap { display: flex; gap: 10px; align-items: center; }
#bodyIcon { width: 38px; height: 56px; fill: var(--amber); filter: drop-shadow(0 0 4px rgba(255,120,20,.6)); transition: fill .2s; }
#hpText { font-size: 26px; }
#stamBar { background: var(--amber); }
#weight { font-size: 13px; margin-top: 4px; }
#clock { position: absolute; top: 18px; left: 50%; transform: translateX(-50%); text-align: center; background: rgba(20,8,0,.35); padding: 4px 16px; border: 1px solid rgba(255,154,46,.35); }
#clockTime { font-size: 24px; }
#clockSub { font-size: 12px; opacity: .8; }
#quotaBox { position: absolute; top: 20px; right: 24px; text-align: right; font-size: 14px; line-height: 1.4; }
#crew { position: absolute; top: 96px; right: 24px; text-align: right; font-size: 13px; line-height: 1.5; }
#crew .dead { color: #884422; text-decoration: line-through; }
#crew .talk::before { content: '🔊 '; }
#inv { position: absolute; bottom: 24px; left: 50%; transform: translateX(-50%); display: flex; gap: 8px; }
.slot { width: 76px; height: 64px; border: 2px solid rgba(255,154,46,.45); background: rgba(20,8,0,.45); display: flex; align-items: flex-end; justify-content: center; font-size: 11px; text-align: center; padding: 4px; position: relative; }
.slot.sel { border-color: var(--amber); box-shadow: 0 0 10px rgba(255,154,46,.6); background: rgba(60,25,0,.55); }
.slot .ico { position: absolute; top: 4px; left: 0; right: 0; font-size: 20px; }
.slot .bat { position: absolute; bottom: 0; left: 0; height: 3px; background: #6f6; }
#toast { position: absolute; top: 100px; left: 50%; transform: translateX(-50%); text-align: center; font-size: 18px; max-width: 80vw; }
#toast div { margin-bottom: 6px; background: rgba(20,8,0,.55); padding: 6px 12px; border-left: 3px solid var(--amber); animation: toastIn .3s; }
@keyframes toastIn { from { opacity: 0; transform: translateY(-10px); } }
#bigToast { position: absolute; top: 34%; left: 50%; transform: translate(-50%, -50%); text-align: center; font-size: clamp(22px, 4vw, 44px); color: #ffcf70; letter-spacing: 3px; opacity: 0; transition: opacity .4s; text-shadow: 0 0 12px rgba(255,100,20,.9); white-space: pre-line; }
#bigToast.warn { color: var(--red); }
#chat { position: absolute; left: 24px; bottom: 110px; width: min(420px, 60vw); pointer-events: auto; }
#chatLog { font-size: 15px; max-height: 200px; overflow: hidden; display: flex; flex-direction: column; justify-content: flex-end; }
#chatLog div { background: rgba(0,0,0,.35); padding: 2px 6px; margin-top: 2px; transition: opacity 1s; }
#chatLog b { color: #ffd08a; }
#chatIn { width: 100%; margin-top: 4px; font-size: 15px; padding: 6px; }
#micInd { position: absolute; left: 24px; bottom: 80px; font-size: 14px; padding: 2px 8px; border: 1px solid var(--amber); }
#micInd.live { background: var(--amber); color: #000; }
#micInd.muted { border-color: var(--red); color: var(--red); }
#roomCode { position: absolute; left: 24px; bottom: 24px; font-size: 13px; opacity: .8; }
#scanLayer { position: absolute; inset: 0; }
.scan { position: absolute; transform: translate(-50%, -50%); text-align: center; animation: scanIn .25s; }
.scan .ring { width: 34px; height: 34px; border: 3px solid #3cff6a; border-radius: 50%; margin: 0 auto 4px; box-shadow: 0 0 8px #3cff6a; }
.scan.enemy .ring { border-color: #ff3b2f; box-shadow: 0 0 8px #ff3b2f; }
.scan .lbl { background: rgba(0,40,10,.75); color: #baffc8; padding: 2px 6px; font-size: 13px; white-space: nowrap; border: 1px solid #3cff6a; }
.scan.enemy .lbl { background: rgba(60,0,0,.75); color: #ffc0b8; border-color: #ff3b2f; }
@keyframes scanIn { from { transform: translate(-50%, -50%) scale(2); opacity: 0; } }

/* ================= terminal ================= */
#terminal { position: fixed; inset: 0; z-index: 25; display: flex; align-items: center; justify-content: center; background: rgba(0,0,0,.55); }
.term-screen { width: min(820px, 100% - 32px); height: min(620px, 100% - 32px); background: #021a06; border: 3px solid #1b4a22; box-shadow: 0 0 40px rgba(60,255,106,.25), inset 0 0 60px rgba(0,0,0,.8); padding: 18px; display: flex; flex-direction: column; color: var(--green); text-shadow: 0 0 6px rgba(60,255,106,.7); font-family: 'VT323', monospace; font-size: 22px; }
#termOut { flex: 1; overflow-y: auto; margin: 0; white-space: pre-wrap; font-family: inherit; }
.term-line { display: flex; gap: 8px; align-items: center; }
#termIn { flex: 1; background: transparent; border: none; color: var(--green); font-family: inherit; font-size: 22px; padding: 4px; box-shadow: none; text-shadow: inherit; }

/* ================= death / report / fired ================= */
#death { position: fixed; inset: 0; z-index: 12; pointer-events: none; display: flex; flex-direction: column; align-items: center; justify-content: flex-start; padding-top: 12vh; }
.death-title { font-size: clamp(34px, 7vw, 72px); color: var(--red); letter-spacing: 8px; text-shadow: 0 0 20px #f00; }
#deathCause { font-size: 20px; color: #ffb0a0; margin-top: 8px; }
#spectating { position: fixed; bottom: 90px; font-size: 18px; }
#death .hint { position: fixed; bottom: 60px; font-size: 13px; opacity: .7; }
#report { position: fixed; inset: 0; z-index: 15; display: flex; align-items: center; justify-content: center; background: rgba(0,0,0,.4); pointer-events: none; }
.report-inner { width: min(560px, 100% - 32px); background: rgba(10,5,0,.9); border: 2px solid var(--amber); padding: 20px 24px; animation: toastIn .4s; }
.report-title { font-size: 26px; letter-spacing: 4px; border-bottom: 1px solid var(--amber-dim); padding-bottom: 8px; margin-bottom: 12px; }
#reportBody { font-size: 17px; line-height: 1.6; }
#reportBody .grade { font-size: 64px; text-align: right; margin-top: -60px; }
#fired { position: fixed; inset: 0; z-index: 40; background: #000; display: flex; align-items: center; justify-content: center; }
.fired-inner { text-align: center; }
.fired-title { font-size: clamp(40px, 9vw, 110px); color: var(--red); letter-spacing: 6px; animation: flick 2s infinite; }
#firedBody { font-size: 18px; margin-top: 18px; color: #d9a26a; line-height: 1.6; }
.pause-panel { width: min(420px, 100% - 32px); max-height: calc(100% - 32px); overflow: auto; }
#pause { background: rgba(0,0,0,.6); }
.pause-title { font-size: 30px; letter-spacing: 6px; text-align: center; }
#pauseCode { text-align: center; font-size: 15px; }
#pauseCode b { font-size: 28px; letter-spacing: 6px; color: #fff; }

@media (max-width: 640px) {
  .slot { width: 60px; height: 54px; }
  #quotaBox, #crew { font-size: 11px; }
}
