/* Dead Frenzy: After Hours' chrome (a city at night), plus team colours. */
:root {
  --void: #06070b;
  --panel: rgba(10, 12, 18, 0.88);
  --brass: #e8a83a;
  --brass-hi: #ffd27a;
  --brass-dim: #6a5428;
  --bone: #e6e8ee;
  --dim: #8e96a8;
  --blood: #a8261e;
  --blood-hi: #ef4a3a;
  --heal: #6ee0a0;
  --line: rgba(232, 168, 58, 0.4);
  --gothic: "Bebas Neue", "Barlow Condensed", Impact, sans-serif;
  --prose: "Barlow", "Helvetica Neue", Arial, sans-serif;
  --pixel: "Silkscreen", ui-monospace, monospace;
  --red: #d04848;
  --blue: #4a78d0;
  --green: #5aa848;
  --gold: #d8b040;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: var(--void); color: var(--bone); font-family: var(--prose); }
[hidden] { display: none !important; }
canvas#view { position: fixed; inset: 0; width: 100vw; height: 100vh; image-rendering: pixelated; display: block; }
a { color: var(--brass-hi); }

.kicker { margin: 0 0 4px; color: var(--brass); letter-spacing: 0.2em; text-transform: uppercase; font-size: 10px; font-family: var(--pixel); }
.fine { color: var(--dim); font-size: 13px; line-height: 1.4; margin: 6px 0 0; }
h1, h2, h3 { font-family: var(--gothic); font-weight: 400; margin: 0; letter-spacing: 0.04em; }
button {
  background: linear-gradient(#1a1c24, #101218);
  border: 1px solid var(--brass-dim);
  padding: 9px 14px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-family: var(--gothic);
  font-size: 16px;
  cursor: pointer;
  color: var(--bone);
}
button:hover:not(:disabled) { border-color: var(--brass); color: var(--brass-hi); }
button:disabled { opacity: 0.4; cursor: default; }
button.primary { background: linear-gradient(#b82e24, #6e1612); border-color: #ef6a4a; color: #fff4e8; }
button.primary:hover:not(:disabled) { background: linear-gradient(#d0382c, #84201a); color: #fff; }
input {
  display: block; width: 100%; margin-top: 6px; padding: 10px 12px; background: #0a0c12; color: var(--bone);
  border: 1px solid var(--brass-dim); outline: none; font-family: var(--pixel); font-size: 13px;
}
input:focus { border-color: var(--brass); }
label { display: block; margin: 14px 0 8px; color: var(--dim); letter-spacing: 0.14em; text-transform: uppercase; font-size: 10px; font-family: var(--pixel); }
label.check { display: flex; align-items: center; gap: 8px; margin: 0; }
label.check input { width: auto; margin: 0; }
.row { display: flex; gap: 8px; margin-top: 10px; }
.row.join input { margin: 0; width: 110px; text-transform: uppercase; text-align: center; letter-spacing: 0.3em; }

.screen { position: fixed; inset: 0; display: flex; align-items: center; justify-content: flex-start; padding: 24px 6vw; overflow-y: auto; }
#title { background: radial-gradient(ellipse at 18% 30%, rgba(232, 60, 50, 0.14), transparent 55%), linear-gradient(90deg, rgba(4, 5, 9, 0.95) 0%, rgba(4, 5, 9, 0.7) 45%, rgba(4, 5, 9, 0.1) 80%); }
#lobby { justify-content: center; background: rgba(4, 5, 9, 0.72); }
.card { background: var(--panel); border: 1px solid var(--line); padding: 22px 24px; max-width: 470px; width: 100%; box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5); }
.card.wide { max-width: 920px; }
#title h1 {
  font-size: clamp(64px, 11vw, 128px); line-height: 0.82; color: #f4f1ea;
  text-shadow: 0 0 2px #fff, 0 0 18px rgba(255, 60, 60, 0.8), 0 0 48px rgba(255, 40, 40, 0.45);
}
#title h1::after { content: ""; display: block; width: 160px; height: 4px; margin-top: 10px; background: linear-gradient(90deg, var(--red), var(--blue), var(--green), var(--gold)); }
.lede { color: #c8ccd8; font-size: 16px; line-height: 1.5; }

.lobby-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; margin-bottom: 12px; }
.code { font-family: var(--pixel); font-size: 34px; letter-spacing: 0.25em; margin: 0; color: var(--brass-hi); }
.maps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 14px; }
.map-card { text-align: left; padding: 8px; text-transform: none; letter-spacing: 0; font-family: var(--prose); font-size: 13px; display: flex; flex-direction: column; gap: 4px; }
.map-card canvas { width: 100%; height: 72px; image-rendering: pixelated; background: #0e1828; }
.map-card b { font-family: var(--gothic); font-size: 20px; letter-spacing: 0.05em; font-weight: 400; }
.map-card small { color: var(--dim); }
.map-card.on { border-color: var(--brass-hi); box-shadow: 0 0 0 1px var(--brass-hi) inset; }
.teams { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 10px; }
.team { border: 1px solid #2a2e3a; background: rgba(0, 0, 0, 0.35); padding: 10px; min-height: 120px; display: flex; flex-direction: column; gap: 6px; }
.team h3 { font-size: 22px; display: flex; justify-content: space-between; align-items: center; }
.team h3 small { font-family: var(--pixel); font-size: 9px; color: var(--dim); letter-spacing: 0.1em; }
.team .who { font-family: var(--pixel); font-size: 11px; display: flex; align-items: center; gap: 6px; }
.team .who img { width: 20px; height: 26px; image-rendering: pixelated; }
.team .who.me { color: var(--brass-hi); }
.team .ai { color: var(--dim); font-style: italic; font-size: 13px; }
.team button { margin-top: auto; font-size: 14px; padding: 6px; }
.lobby-foot { display: flex; align-items: center; gap: 10px; margin: 14px 0; flex-wrap: wrap; }
.lobby-foot #start { margin-left: auto; }
.events { margin: 0 0 14px; }
.events select { width: auto; margin: 0 0 0 6px; padding: 2px 6px; }
.ev-list { display: flex; flex-wrap: wrap; gap: 6px 14px; margin-top: 8px; }
.ev-list label { font-size: 12px; }
.classes { display: grid; grid-template-columns: repeat(12, 1fr); gap: 4px; }
.classes button { padding: 4px 2px; display: flex; flex-direction: column; align-items: center; font-size: 11px; letter-spacing: 0.02em; }
.classes img { width: 30px; height: 39px; image-rendering: pixelated; }
.classes button.on { border-color: var(--brass-hi); background: rgba(232, 168, 58, 0.15); }

/* HUD */
#hud { position: fixed; inset: 0; pointer-events: none; font-family: var(--pixel); }
#hud form, #hud input { pointer-events: auto; }
.chip { position: absolute; background: var(--panel); border: 1px solid var(--line); padding: 6px 10px; font-size: 12px; }
#clock { top: 10px; left: 10px; }
#cash { top: 44px; left: 10px; font-size: 18px; color: var(--brass-hi); }
#cash small { font-size: 10px; color: var(--dim); }
#cash.rush { color: #ffe9a0; border-color: #ffd27a; box-shadow: 0 0 12px rgba(255, 210, 122, 0.45); }
#cash.rush small::after { content: " ×2"; color: #ffd27a; }
#twist { top: 84px; left: 10px; font-family: Silkscreen, monospace; font-size: 11px; }
#hold { top: 118px; left: 10px; font-family: Silkscreen, monospace; font-size: 11px; }
#twist[hidden] + #hold { top: 84px; }
.bases { position: absolute; top: 8px; left: 50%; transform: translateX(-50%); display: flex; gap: 8px; }
.base { background: var(--panel); border: 1px solid #2a2e3a; padding: 5px 8px; min-width: 120px; font-size: 10px; }
.base.mine { border-color: var(--brass); }
.base.out { opacity: 0.45; }
.base .bar { height: 6px; background: #1a1012; margin: 4px 0 2px; border: 1px solid #000; }
.base .bar span { display: block; height: 100%; }
.base .row2 { display: flex; justify-content: space-between; color: var(--dim); }
.base.hit { animation: hit 0.5s; }
@keyframes hit { 0% { box-shadow: 0 0 0 2px #fff; } 100% { box-shadow: none; } }
#feed { position: absolute; top: 70px; right: 10px; list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 3px; align-items: flex-end; font-size: 11px; }
#feed li { background: rgba(6, 7, 11, 0.8); padding: 3px 8px; border-left: 3px solid var(--brass-dim); }
#vitals { position: absolute; left: 10px; bottom: 10px; width: 280px; background: var(--panel); border: 1px solid var(--line); padding: 8px; }
.hp { position: relative; height: 18px; background: #1a1012; border: 1px solid #000; }
.hp span { display: block; height: 100%; background: linear-gradient(#6ee0a0, #2a8a5a); }
.hp span.low { background: linear-gradient(#ef6a4a, #8a1c16); }
.hp b { position: absolute; inset: 0; text-align: center; font-size: 11px; line-height: 18px; font-weight: 400; text-shadow: 0 1px 0 #000; }
.gunrow { display: flex; gap: 6px; align-items: center; margin-top: 6px; font-size: 11px; }
.slot { border: 1px solid #2a2e3a; padding: 2px 6px; color: var(--dim); }
.slot.on { border-color: var(--brass); color: var(--brass-hi); }
#ammo { margin-left: auto; color: #e8e0c8; }
#ammo.rel { color: var(--dim); }
#frags { color: #b8c890; }
#mini { position: absolute; right: 10px; bottom: 10px; width: 200px; height: 200px; background: rgba(6, 7, 11, 0.85); border: 1px solid var(--line); image-rendering: pixelated; }
#banner { position: absolute; top: 22%; left: 50%; transform: translateX(-50%); font-family: var(--gothic); font-size: 42px; letter-spacing: 0.06em; text-shadow: 0 2px 0 #000, 0 0 20px rgba(0, 0, 0, 0.8); margin: 0; white-space: nowrap; }
#prompt { position: absolute; bottom: 120px; left: 50%; transform: translateX(-50%); background: var(--panel); border: 1px solid var(--line); padding: 6px 12px; font-size: 12px; margin: 0; }
#dead { position: absolute; top: 40%; left: 50%; transform: translate(-50%, -50%); text-align: center; background: var(--panel); border: 1px solid var(--blood); padding: 14px 26px; }
#dead h2 { font-size: 40px; }
.keys { position: absolute; bottom: 6px; left: 50%; transform: translateX(-50%); font-size: 10px; opacity: 0.7; white-space: nowrap; }
#chat-form { position: absolute; left: 300px; bottom: 34px; width: 360px; display: none; }
#chat-form.open { display: block; }
#chatlog { position: absolute; left: 300px; bottom: 74px; width: 380px; font-family: var(--prose); font-size: 13px; display: flex; flex-direction: column; gap: 2px; }
#chatlog p { margin: 0; text-shadow: 0 1px 0 #000, 0 0 4px #000; }
#ping { position: absolute; top: 10px; right: 10px; margin: 0; font-size: 10px; color: var(--dim); }
#link-lost { position: fixed; top: 40%; left: 50%; transform: translateX(-50%); background: var(--panel); border: 1px solid var(--blood); padding: 10px 16px; z-index: 9; font-family: var(--pixel); }

/* Shop and scores */
.overlay { position: fixed; inset: 0; display: flex; align-items: center; justify-content: center; background: rgba(4, 5, 9, 0.55); padding: 20px; }
.shopcard { max-width: 860px; max-height: 92vh; overflow-y: auto; }
.shop-head { display: flex; align-items: center; gap: 12px; }
.tabs { display: flex; gap: 4px; }
.tabs button.on { border-color: var(--brass-hi); color: var(--brass-hi); background: rgba(232, 168, 58, 0.12); }
.shop-cash { margin: 0 0 0 auto; font-family: var(--pixel); color: var(--brass-hi); font-size: 16px; }
.shop-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 8px; margin-top: 10px; }
.item { text-align: left; text-transform: none; letter-spacing: 0; font-family: var(--prose); font-size: 13px; padding: 8px 10px; display: flex; flex-direction: column; gap: 3px; }
.item b { font-family: var(--gothic); font-size: 19px; letter-spacing: 0.04em; font-weight: 400; display: flex; justify-content: space-between; }
.item b i { font-style: normal; font-family: var(--pixel); font-size: 12px; color: var(--brass-hi); }
.item small { color: var(--dim); line-height: 1.3; }
.item .pips { display: flex; gap: 2px; }
.item .pips span { width: 10px; height: 4px; background: #2a2e3a; }
.item .pips span.on { background: var(--brass); }
.item.poor { opacity: 0.55; }
.item.done { opacity: 0.35; }
.item kbd { font-family: var(--pixel); font-size: 10px; color: var(--dim); }
#score-table { width: 100%; border-collapse: collapse; margin-top: 10px; font-family: var(--pixel); font-size: 12px; }
#score-table th { text-align: left; color: var(--dim); font-weight: 400; padding: 4px 6px; border-bottom: 1px solid #2a2e3a; }
#score-table td { padding: 4px 6px; border-bottom: 1px solid #14161e; }
#score-table td.n { text-align: right; }
#score-table tr.teamrow td { font-family: var(--gothic); font-size: 18px; padding-top: 10px; }

/* Settings */
.menucard { max-width: 560px; max-height: 92vh; overflow-y: auto; }
.menu-list { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 10px 0; }
#menu-help { line-height: 1.5; }
#hud-menu { position: absolute; top: 28px; right: 10px; pointer-events: auto; padding: 2px 9px; font-size: 14px; }
body.nokeys .keys { display: none; }

/* Touch: twin sticks, a pad of buttons on the right edge, a row on top. */
.tstick, #tpad, #ttop { display: none; }
body.touch, body.touch canvas { touch-action: none; -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; overscroll-behavior: none; }
body.touch.playing .tstick:not([hidden]) {
  display: block; position: fixed; z-index: 4; width: 124px; height: 124px; margin: -62px 0 0 -62px; border-radius: 50%;
  border: 2px solid rgba(201, 162, 78, 0.55); background: radial-gradient(rgba(20, 16, 10, 0.25), rgba(20, 16, 10, 0.55)); pointer-events: none;
}
body.touch.playing #taim:not([hidden]) { border-color: rgba(239, 106, 74, 0.6); }
.tknob { position: absolute; left: 50%; top: 50%; width: 54px; height: 54px; border-radius: 50%; background: radial-gradient(circle at 35% 35%, #efd28a, #8a6a2a 70%); box-shadow: 0 0 0 2px #1a140a, 0 4px 14px rgba(0, 0, 0, 0.6); transform: translate(-50%, -50%); }
#taim .tknob { background: radial-gradient(circle at 35% 35%, #f8a080, #8a2a1a 70%); }
body.touch.playing #tpad {
  display: grid; grid-template-columns: repeat(4, 54px); gap: 8px; position: fixed; z-index: 5;
  right: calc(10px + env(safe-area-inset-right)); bottom: calc(10px + env(safe-area-inset-bottom));
}
body.touch.playing #ttop { display: flex; gap: 6px; position: fixed; z-index: 5; top: calc(8px + env(safe-area-inset-top)); right: calc(10px + env(safe-area-inset-right)); }
#tpad button { width: 54px; height: 54px; padding: 0; border-radius: 50%; font-size: 20px; line-height: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; background: rgba(12, 12, 16, 0.72); }
#tpad button small { font-size: 8px; letter-spacing: 0.04em; margin-top: 2px; color: var(--dim); }
#ttop button { padding: 4px 9px; font-size: 11px; background: rgba(12, 12, 16, 0.8); }
#tpad button.pressed, #ttop button.pressed { border-color: var(--brass-hi); background: rgba(232, 168, 58, 0.3); }
body.touch .keys, body.touch #chatlog, body.touch #ping, body.touch #hud-menu { display: none; }
body.touch #mini { top: 46px; bottom: auto; width: 110px; height: 110px; }
body.touch #feed { top: 164px; }
body.touch #vitals { width: 220px; }
body.touch #prompt { bottom: 150px; }

/* Phones: a smaller pad that leaves the right thumb room to aim, and a slim top row. */
/* The pad as an L along the right and bottom edges, dive in the corner, the middle free for the aim thumb. */
body.touch.playing #tpad { display: block; width: 0; height: 0; }
body.touch #tpad button { position: absolute; right: 0; bottom: 0; }
body.touch #tpad button:nth-child(5) { right: 50px; }
body.touch #tpad button:nth-child(6) { right: 100px; }
body.touch #tpad button:nth-child(2) { right: 150px; }
body.touch #tpad button:nth-child(3) { bottom: 50px; }
body.touch #tpad button:nth-child(4) { bottom: 100px; }
body.touch #tpad button:nth-child(7) { bottom: 150px; }
body.touch #tpad button:nth-child(8) { bottom: 200px; }
body.touch #tpad button { width: 44px; height: 44px; font-size: 16px; background: rgba(12, 12, 16, 0.5); border-color: rgba(106, 84, 40, 0.7); }
body.touch #tpad button small { display: none; }
body.touch #ttop button { padding: 3px 7px; font-size: 10px; }
body.touch #mini { top: 38px; width: 92px; height: 92px; }
body.touch #feed { top: 136px; font-size: 10px; }
body.touch #prompt { bottom: 112px; font-size: 10px; padding: 4px 8px; }
@media (max-height: 520px), (max-width: 600px) {
  .bases { top: 4px; gap: 4px; }
  .base { min-width: 0; width: 86px; padding: 2px 5px; font-size: 8px; }
  .base .bar { height: 3px; margin: 2px 0 1px; }
  .base .tag { display: none; }
  .chip { padding: 3px 6px; font-size: 10px; }
  #clock { top: 4px; left: 6px; }
  #cash { top: 26px; left: 6px; font-size: 13px; }
  #cash small { font-size: 8px; }
  #twist { top: 50px; left: 6px; font-size: 9px; }
  #hold { top: 74px; left: 6px; font-size: 9px; }
  #twist[hidden] + #hold { top: 50px; }
  #vitals { width: 190px; padding: 5px; left: 6px; bottom: 6px; }
  .hp { height: 12px; }
  .hp b { font-size: 9px; line-height: 12px; }
  .gunrow { font-size: 9px; margin-top: 4px; }
  #banner { font-size: 28px; }
}

@media (max-width: 820px) {
  .classes { grid-template-columns: repeat(6, 1fr); }
  .maps { grid-template-columns: 1fr; }
  #mini { width: 130px; height: 130px; }
  .keys, #chatlog { display: none; }
  .base { min-width: 80px; }
}
