/* Shell Struck — command-console UI, inspired by Command & Conquer: a steel sidebar with radar,
   credits and build-style weapon plates. Readability first: solid dark panels behind all text,
   PixelLab plates (art/ui) for buttons and the radar bezel only. */
:root {
  --side: 340px;
  --bg: #0b0f14;
  --steel-1: #262d36;
  --steel-2: #1a2028;
  --steel-3: #12171d;
  --line: #3b4552;
  --line-hi: #5b6878;
  --text: #e8ecf0;
  --muted: #9aa7b6;
  --dim: #6e7a88;
  --green: #7dff9a;
  --green-dim: #3fae5c;
  --amber: #ffc25a;
  --red: #e0392c;
  --red-hi: #ff5a46;
  --title: "Black Ops One", Impact, sans-serif;
  --body: Rajdhani, "Segoe UI", sans-serif;
  --mono: "Share Tech Mono", Consolas, monospace;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); font: 600 15px/1.3 var(--body); overflow: hidden; }
#stage { position: fixed; inset: 0; }
body.with-side #stage { right: var(--side); }
#stage canvas { display: block; }
.hidden { display: none !important; }
button { font: inherit; color: inherit; cursor: pointer; }
small { color: var(--muted); font-weight: 500; }
.neg { color: var(--red-hi) !important; }

/* ---------- plates: PixelLab steel and red armour (9-slice) ---------- */
.btn, .chip, .wpn, .aim button, .modes button {
  image-rendering: pixelated; border-style: solid; border-color: transparent; background: none; color: var(--text);
  border-image: url(../art/ui/btn_steel.png) 26 fill / 12px stretch; border-width: 12px; padding: 0;
}
.btn { font: 400 17px var(--title); letter-spacing: 1px; padding: 2px 14px; text-shadow: 0 2px 0 #000; min-height: 46px; }
.btn.fire, .btn.ghost.on, .wpn.on, .modes button.on {
  border-image: url(../art/ui/btn_red.png) 22 28 22 28 fill / 11px 14px stretch; border-width: 11px 14px; color: #ffe2b0;
}
.btn:hover, .chip:hover, .wpn:hover, .aim button:hover, .modes button:hover { filter: brightness(1.18); }
.btn:active, .aim button:active { filter: brightness(0.9); }
.btn:disabled, .wpn:disabled { filter: grayscale(1) brightness(0.6); cursor: not-allowed; }
/* Passive items (parachute) aren't picked, but they're carried: shown at full colour, no hover. */
.wpn.passive:disabled { filter: none; opacity: 0.85; cursor: help; }
.bounty { color: #ffd23a; margin-right: 4px; text-shadow: 0 0 4px rgba(255, 190, 40, 0.7); }
.btn small { color: inherit; opacity: 0.6; font: 400 11px var(--mono); margin-left: 6px; }
.chip { font: 400 12px var(--title); letter-spacing: 1px; border-width: 9px; border-image-width: 9px; padding: 0 4px; min-height: 30px; }
.row { display: flex; gap: 6px; justify-content: center; }

/* Solid steel panel used for everything that carries text. */
.panel, #hud .players, #hud .overlay > div:not(.clipboard), #hud .side section {
  background: linear-gradient(180deg, var(--steel-1), var(--steel-2));
  border: 1px solid var(--line); border-top-color: var(--line-hi);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.05), 0 6px 18px rgba(0,0,0,0.45);
}
h4 { margin: 0 0 8px; font: 400 12px var(--title); letter-spacing: 2px; color: var(--muted); display: flex; align-items: center; gap: 8px; }
h4::before { content: ''; width: 18px; height: 6px; background: url(../art/ui/hazard.png) 0 0 / auto 6px repeat-x; image-rendering: pixelated; }
h4 small { margin-left: auto; font: 500 11px var(--body); letter-spacing: 0; color: var(--dim); }

/* ---------- menu ---------- */
#menu { position: fixed; inset: 0; z-index: 30; display: grid; place-items: center; overflow: auto; }
.menu-bg { position: fixed; inset: 0; background: url(../art/ui/hero.png) center/cover; filter: brightness(0.42) saturate(1.1); }
.menu { position: relative; width: min(760px, calc(100% - 32px)); margin: 24px 0; text-align: center; }
/* Pixel-art title: a shell striking SHELL STRUCK (public/js/logo.js). */
.logo-anim { width: 100%; max-width: 720px; aspect-ratio: 3 / 1; display: block; margin: 0 auto 4px; image-rendering: pixelated;
  filter: drop-shadow(0 0 16px rgba(0,0,0,0.65)); }
.logo { width: 100%; max-width: 680px; display: block; margin: 0 auto 12px;
  -webkit-mask-image: radial-gradient(closest-side, #000 72%, transparent 100%); mask-image: radial-gradient(closest-side, #000 72%, transparent 100%); }
.menu .panel { padding: 18px 20px 16px; border-top: 3px solid var(--red); }
.gamemodes { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0; margin: -6px -8px 14px; border-bottom: 1px solid var(--line); }
.gamemodes button { background: none; border: 0; border-bottom: 3px solid transparent; padding: 8px 6px 9px; font: 400 16px var(--title); letter-spacing: 1px; color: var(--muted); display: flex; flex-direction: column; gap: 2px; }
.gamemodes button small { font: 500 11px var(--body); letter-spacing: 0; color: var(--dim); }
.gamemodes button.on { color: var(--text); border-bottom-color: var(--red-hi); }
.gamemodes button:disabled { cursor: default; opacity: 0.55; }
.names .who { display: flex; gap: 4px; }
.names .who select { width: 150px; }
.clipboard .sub b.int { color: #1f7a3a; }
.modes { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 16px; }
.modes button { padding: 4px 6px; font: 400 18px var(--title); display: flex; flex-direction: column; gap: 2px; min-height: 70px; justify-content: center; }
.modes button small { font: 500 13px var(--body); color: #c3cdd8; }
.modes button.on small { color: #ffd9a8; }
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; text-align: left; }
.grid label { display: flex; flex-direction: column; gap: 5px; color: var(--muted); font: 400 11px var(--title); letter-spacing: 1px; }
select, .names input { background: var(--steel-3); color: var(--text); border: 1px solid var(--line); padding: 8px 9px; font: 600 15px var(--body); border-radius: 2px; }
select:focus, .names input:focus { outline: 1px solid var(--green-dim); }
.names { display: flex; flex-wrap: wrap; gap: 8px; margin: 14px 0 4px; justify-content: center; }
.names input { width: 170px; }
.menu .btn.big { margin-top: 14px; font-size: 26px; padding: 2px 46px; min-height: 64px; }
.rules { color: var(--muted); font-size: 13px; margin: 12px 0 0; }

/* ---------- HUD: battlefield overlays ---------- */
#hud { position: fixed; inset: 0; z-index: 10; pointer-events: none; }
#hud > *, #hud .side { pointer-events: auto; }

.players { position: absolute; top: 10px; left: 10px; width: 290px; padding: 10px 12px 8px; border-radius: 2px; opacity: 0.96; }
.players .p { display: grid; grid-template-columns: 12px 1fr 70px 52px 14px; gap: 8px; align-items: center; padding: 4px 0; border-top: 1px solid rgba(255,255,255,0.05); }
.players .p i { width: 12px; height: 12px; border: 1px solid #000; }
.players .p .n { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 15px; }
.players .p .n small { margin-left: 6px; font-size: 11px; text-transform: uppercase; color: var(--dim); }
.hp, .hpbar { height: 7px; background: #050709; border: 1px solid #000; box-shadow: 0 0 0 1px var(--line); }
.hp span, .hpbar span { display: block; height: 100%; background: linear-gradient(#8dff9f, #3fae5c); }
.hp.mid span, .hpbar.mid span { background: linear-gradient(#ffe08a, #e0a52c); }
.hp.low span, .hpbar.low span { background: linear-gradient(#ff8a7a, #c8301f); }
.players .p .m { text-align: right; font: 400 14px var(--mono); color: var(--green); }
.players .p .st { color: var(--green); text-align: center; }
.players .p.dead { opacity: 0.4; }
/* Team banners above each team's tanks. */
.players .tm { display: grid; grid-template-columns: 12px auto 1fr auto; gap: 8px; align-items: center; margin-top: 6px; padding: 4px 6px;
  background: rgba(255,255,255,0.05); border-left: 3px solid rgba(255,255,255,0.15); }
.players .tm i { width: 12px; height: 12px; border: 1px solid #000; }
.players .tm b { font: 400 13px var(--title); letter-spacing: 1px; text-transform: uppercase; }
.players .tm small { font: 400 11px var(--mono); color: var(--dim); }
.players .tm .m { font: 400 14px var(--mono); color: var(--amber); text-align: right; }
.players .tm.dead { opacity: 0.45; }
.players .tm + .p { border-top: 0; }
.names .who .team-pick { width: 130px; border-left: 4px solid; }
.summary table.teams { min-width: 380px; margin-bottom: 14px; }
.players .p.dead .st { color: var(--red-hi); }

.banner { position: absolute; top: 34%; left: 0; right: 0; text-align: center; font: 400 64px var(--title); color: #fff;
  text-shadow: 0 4px 0 #000, 0 0 28px rgba(224,57,44,0.9); opacity: 0; pointer-events: none !important; }
body.with-side .banner { right: var(--side); }
.banner.show { animation: banner 1.3s ease-out; }
@keyframes banner { 0% { opacity: 0; transform: scale(1.4); } 15% { opacity: 1; transform: scale(1); } 70% { opacity: 1; } 100% { opacity: 0; } }

/* ---------- HUD: the command sidebar ---------- */
.side { position: absolute; top: 0; right: 0; bottom: 0; width: var(--side); display: flex; flex-direction: column; gap: 8px; padding: 8px;
  background: linear-gradient(90deg, #10151b, #161c23 30%, #121820); border-left: 2px solid #000; box-shadow: inset 2px 0 0 var(--line), -6px 0 18px rgba(0,0,0,0.5); overflow: hidden; }
.side-top { display: flex; align-items: center; gap: 6px; }
.side-top .brand { font: 400 15px var(--title); letter-spacing: 2px; color: #cfd8e2; margin-right: auto; padding-left: 4px; }
.side-top .brand::first-letter { color: var(--red-hi); }

.radar { border-image: url(../art/ui/screen.png) 44 34 30 34 fill / 22px 17px 15px 17px stretch; border-style: solid; border-width: 22px 17px 15px;
  image-rendering: pixelated; height: 158px; flex: 0 0 auto; }
.radar canvas { width: 100%; height: 100%; display: block; image-rendering: pixelated; cursor: crosshair; background: #05080b; }

.readouts { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 6px; flex: 0 0 auto; }
.ro { background: #070a0d; border: 1px solid var(--line); padding: 5px 8px 4px; display: flex; flex-direction: column; min-width: 0; }
.ro span { font: 400 10px var(--title); letter-spacing: 1px; color: var(--dim); }
.ro b { font: 400 20px var(--mono); color: var(--green); text-shadow: 0 0 8px rgba(63,174,92,0.55); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ro b em { font-style: normal; } .ro b i { font-style: normal; font-size: 14px; color: var(--green-dim); }
.ro.credits { grid-column: 1 / -1; flex-direction: row; align-items: baseline; justify-content: space-between; }
.ro.credits b { font-size: 28px; color: var(--amber); text-shadow: 0 0 10px rgba(255,194,90,0.45); }
.ro.field { grid-column: 2 / -1; }
.ro.field b { font: 400 15px var(--title); color: var(--text); text-shadow: none; letter-spacing: 1px; padding-top: 3px; }
.ro .arrow { display: inline-block; color: #8fdcff; margin-right: 4px; transition: transform .4s; }

.side section { padding: 10px; border-radius: 2px; }
.plan { flex: 0 0 auto; display: flex; flex-direction: column; gap: 8px; }
.plan .card { display: grid; grid-template-columns: 10px 1fr; gap: 8px 10px; align-items: center; }
.plan .card > i { width: 10px; height: 34px; border: 1px solid #000; }
.plan .card .who { display: grid; grid-template-columns: 1fr auto; gap: 4px 8px; align-items: center; }
.plan .card .who b { font: 400 18px var(--title); grid-column: 1 / -1; letter-spacing: 1px; }
.plan .card .who small { font: 400 13px var(--mono); color: var(--green); }
.plan .card .chips { grid-column: 1 / -1; display: flex; gap: 4px; flex-wrap: wrap; }
.chip-s { font: 400 11px var(--title); font-style: normal; letter-spacing: 1px; padding: 2px 6px; color: #0b0f14; }
.chip-s.scr { background: #f0a8ff; } .chip-s.ice { background: #a8dcff; } .chip-s.goo { background: #b6f08a; } .chip-s.emp { background: #7fd6ff; }
.plan h4 { margin: 2px 0 0; }

/* Weapon plates: square, like C&C build icons, with the ammo count in the corner. */
.plan { overflow-y: auto; }
.weapons { display: grid; grid-template-columns: repeat(5, 1fr); grid-auto-rows: 54px; gap: 5px; overflow-y: auto; flex: 0 0 auto;
  min-height: 113px; max-height: 172px; padding: 2px 4px 6px 0; align-content: start; }
.wpn { position: relative; border-width: 9px; border-image-width: 9px; display: grid; place-items: center; }
.wpn.on { border-width: 9px 11px; border-image-width: 9px 11px; }
.wpn img { width: 34px; height: 34px; image-rendering: pixelated; filter: drop-shadow(0 2px 0 rgba(0,0,0,0.6)); }
.wpn em { position: absolute; right: -5px; bottom: -6px; font: 400 12px var(--mono); font-style: normal; color: var(--amber); background: #05080b; padding: 0 3px; border: 1px solid #000; }
.wdesc { background: #070a0d; border: 1px solid var(--line); padding: 7px 9px; min-height: 58px; }
.wdesc b { display: flex; justify-content: space-between; font: 400 15px var(--title); letter-spacing: 1px; color: var(--text); }
.wdesc b em { font: 400 14px var(--mono); font-style: normal; color: var(--amber); }
.wdesc span { display: block; color: #c3cdd8; font-size: 13px; font-weight: 500; line-height: 1.3; margin-top: 2px; }

.aim { display: flex; flex-direction: column; gap: 6px; }
.aim.off { opacity: 0.35; }
.dial { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 2px 8px; }
.dial > span { font: 400 11px var(--title); letter-spacing: 1px; color: var(--muted); }
.dial > b { font: 400 22px var(--mono); color: var(--green); text-shadow: 0 0 8px rgba(63,174,92,0.55); text-align: right; min-width: 64px; }
.dial .row { grid-column: 1 / -1; justify-content: space-between; align-items: center; gap: 6px; }
.aim button { width: 38px; height: 34px; border-width: 9px; border-image-width: 9px; font: 700 17px var(--body); line-height: 1; color: var(--green); touch-action: none; user-select: none; flex: 0 0 auto; }
.dial .row:first-of-type button { flex: 1 1 0; }
input[type=range] { flex: 1 1 auto; min-width: 0; accent-color: var(--red); height: 22px; }

.acts { display: grid; grid-template-columns: 1fr 1.6fr; gap: 6px; }
.acts .btn { min-height: 54px; }
.acts .btn.fire { font-size: 24px; }
.help { margin: 0; color: var(--dim); font-size: 12px; text-align: center; line-height: 1.35; }

/* Your tank and target intel cards. */
.side { overflow-y: auto; }
.side .unit { flex: 0 0 auto; padding: 9px 10px; }
.unit .u { display: grid; grid-template-columns: 64px 1fr; gap: 10px; align-items: center; }
.unit .pic { width: 64px; height: 64px; background: radial-gradient(circle at 50% 60%, color-mix(in srgb, var(--team) 35%, #0b0f14) 0, #070a0d 70%);
  border: 1px solid var(--line); display: grid; place-items: center; overflow: hidden; }
.unit .pic img { width: 76px; height: 76px; image-rendering: pixelated; margin-top: 6px; }
.unit .facts { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.unit .facts b { font: 400 16px var(--title); letter-spacing: 1px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.unit .facts b small { margin-left: 6px; font: 500 11px var(--body); color: var(--dim); text-transform: uppercase; letter-spacing: 0; }
.unit .kv { font: 400 13px var(--mono); color: var(--green); }
.unit .flags { display: flex; gap: 3px; flex-wrap: wrap; }
.unit .flags em { font: 400 10px var(--title); font-style: normal; letter-spacing: 1px; padding: 1px 5px; background: #f0a8ff; color: #0b0f14; }
.unit .last { margin-top: 8px; background: #070a0d; border: 1px solid var(--line); padding: 6px 8px; }
.unit .last small { font: 400 10px var(--title); letter-spacing: 1px; color: var(--dim); }
.kv2 { display: flex; justify-content: space-between; gap: 8px; padding: 2px 0; }
.kv2 span { font: 400 10px var(--title); letter-spacing: 1px; color: var(--muted); padding-top: 3px; }
.kv2 b { font: 400 14px var(--mono); color: var(--text); text-align: right; font-weight: 400; }
.unit .hint { margin: 0; color: var(--dim); font-size: 13px; }
.intel { border-top: 2px solid var(--red) !important; }
.players .p { cursor: pointer; }
.players .p:hover .n { color: #fff; text-decoration: underline; }

.idle { flex: 0 0 auto; min-height: 120px; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; gap: 6px; }
.idle b { font: 400 22px var(--title); letter-spacing: 2px; color: var(--green); text-shadow: 0 0 10px rgba(63,174,92,0.5); animation: blink 1.4s steps(2) infinite; }
.idle span { color: var(--muted); }
@keyframes blink { 50% { opacity: 0.55; } }

.report { flex: 1 1 auto; display: flex; flex-direction: column; gap: 8px; min-height: 0; }
.report .rows { overflow-y: auto; }
.rr { display: grid; grid-template-columns: 10px 1fr auto; gap: 2px 8px; align-items: center; padding: 6px 0; border-top: 1px solid rgba(255,255,255,0.06); }
.rr i { width: 10px; height: 10px; border: 1px solid #000; }
.rr .n { font-size: 15px; }
.rr b { font: 400 16px var(--mono); color: var(--amber); }
.rr .what { grid-column: 2 / -1; color: var(--muted); font-size: 13px; }
.rr.dead { opacity: 0.5; }
.report .kills { margin: 0; color: var(--red-hi); }
.report .note { margin: 0; color: var(--dim); font-size: 12px; }
.report .btn { min-height: 52px; margin-top: auto; }

/* ---------- overlays (results, pass screen) ---------- */
.overlay { position: absolute; inset: 0; display: grid; place-items: center; background: rgba(4, 7, 10, 0.6); z-index: 20; }
body.with-side .overlay:not(.solid) { right: var(--side); }
.overlay.solid { background: #080b0f; z-index: 40; }
#hud .overlay > div { padding: 20px 24px; max-width: calc(100% - 32px); max-height: calc(100% - 32px); overflow: auto; text-align: center; border-top: 3px solid var(--red); }
.overlay h2 { font: 400 30px var(--title); margin: 0 0 12px; letter-spacing: 1px; text-shadow: 0 2px 0 #000; }
.pass .swatch { width: 64px; height: 10px; margin: 0 auto 12px; border: 2px solid #000; }
.pass p { color: var(--muted); }
.pass .btn { min-height: 60px; font-size: 20px; padding: 2px 26px; }
.summary table { border-collapse: collapse; margin: 6px auto 8px; min-width: 520px; font-size: 16px; }
.summary th { font: 400 11px var(--title); letter-spacing: 1px; color: var(--muted); padding: 6px 12px; text-align: right; border-bottom: 2px solid var(--line-hi); }
.summary td { padding: 7px 12px; text-align: right; border-top: 1px solid rgba(255,255,255,0.06); font-family: var(--mono); }
.summary tr:nth-child(even) td { background: rgba(255,255,255,0.025); }
.summary td b { color: var(--amber); font-weight: 400; }
.summary th:first-child, .summary td:first-child, .summary th:nth-child(2), .summary td:nth-child(2) { text-align: left; font-family: var(--body); }
.summary td i { display: inline-block; width: 11px; height: 11px; border: 1px solid #000; margin-right: 7px; vertical-align: -1px; }
.summary .note { color: var(--dim); font-size: 12px; max-width: 600px; margin: 4px auto 10px; }
.summary .btn { min-height: 54px; padding: 2px 30px; margin: 4px 4px 0; }

/* ---------- shop: a supply clipboard (kept from Blast Doors' spirit) ---------- */
#hud .overlay > .clipboard { position: relative; width: min(780px, calc(100% - 32px)); max-height: calc(100% - 24px); overflow: visible;
  background: linear-gradient(160deg, #8a5a2e, #6b4220 60%, #5a3618); border: 0; border-radius: 14px; padding: 34px 22px 22px;
  box-shadow: 0 14px 40px #000c, inset 0 0 0 3px #3e250f; }
.clipboard .clip { position: absolute; top: -14px; left: 50%; transform: translateX(-50%); width: 170px; height: 40px; border-radius: 8px 8px 4px 4px;
  background: linear-gradient(#e2e6ea, #9aa2ab 45%, #c9ced4 55%, #7d858e); box-shadow: 0 3px 6px #0008; }
.clipboard .paper { background: #f3f1ea; color: #23272e; border-radius: 3px; padding: 16px 18px; max-height: calc(100vh - 120px); overflow: auto; text-align: left;
  background-image: repeating-linear-gradient(transparent 0 27px, #d9e2ec 27px 28px); }
.clipboard h2 { color: #1d2733; font: 400 24px var(--title); margin: 0; text-shadow: none; }
.clipboard .sub, .clipboard .hint { color: #5d6672; font-size: 13px; margin: 2px 0 8px; }
.clipboard table { width: 100%; border-collapse: collapse; font-size: 14px; }
.clipboard th { font: 400 11px var(--title); color: #6a7380; text-align: left; padding: 4px 6px; border-bottom: 2px solid #2b4a7a; }
.clipboard td { padding: 4px 6px; border-bottom: 1px solid #c8cfd8; color: #23272e; }
.clipboard tr[data-k] { cursor: pointer; user-select: none; }
.clipboard tr[data-k]:hover td { background: #e6ebf1; }
.clipboard tr.picked td { background: #dfeedd; }
.clipboard tr.dear td { color: #9aa2ab; }
.clipboard td.ic img { width: 28px; height: 28px; image-rendering: pixelated; display: block; }
.clipboard td.nm small { display: block; color: #6a7380; font-weight: 500; font-size: 12px; }
.clipboard td.ct { white-space: nowrap; }
.clipboard td.ct b { display: inline-block; width: 26px; text-align: center; }
.clipboard td.ct button { width: 24px; height: 24px; border: 1px solid #8a94a0; background: #fff; border-radius: 3px; color: #23272e; }
.clipboard .sums { display: flex; gap: 18px; justify-content: flex-end; margin-top: 10px; font: 400 14px var(--title); color: #2b4a7a; }
.clipboard .sums b { color: #1d2733; }
.clipboard .sums b.neg { color: #c0281c; }
.clipboard .row { justify-content: flex-end; margin-top: 6px; }
.clipboard .btn { color: #fff; min-height: 46px; }

/* ---------- small screens: the sidebar becomes a bottom console ---------- */
@media (max-width: 900px) {
  :root { --side: 0px; }
  body.with-side #stage { right: 0; bottom: 48vh; }
  .side { top: auto; left: 0; width: auto; height: 48vh; flex-direction: column; overflow-y: auto; border-left: 0; border-top: 2px solid #000; }
  .radar { display: none; }
  .readouts { grid-template-columns: repeat(4, 1fr); }
  .ro.credits { grid-column: span 2; } .ro.field { display: none; }
  .players { width: 220px; font-size: 13px; }
  .players .p { grid-template-columns: 10px 1fr 50px 40px 12px; }
  body.with-side .overlay:not(.solid) { bottom: 48vh; }
  .summary table { min-width: 0; font-size: 13px; }
  .weapons { grid-template-columns: repeat(8, 1fr); }
}
