/* ============================================================================
   LAST OFFENSIVE — "war room" interface theme
   One consistent look for every screen: olive steel panels, brass nameplates,
   rivets, and green CRT readouts — the same language as the tactical radar room.
   Loaded after style.css; everything here is presentation only.
   ============================================================================ */
:root {
  --steel-1: #3b3d2d; --steel-2: #2a2c20; --steel-3: #22241a; --steel-4: #14150e; --steel-0: #0d0f09;
  --edge: #5a5a40; --edge-2: #4b4d38; --edge-hi: #6f7152;
  --brass-1: #8b7a3c; --brass-2: #5f5328; --brass-edge: #c9b565; --brass-text: #a89a5a; --brass-hi: #e6cf86;
  --ink: #d8d9c0; --ink-dim: #98ab9f; --ink-hi: #ffe6b0;
  --crt: #8dffb0; --crt-soft: #bfe6cb; --crt-bg: #06100a; --crt-edge: #1f5a3a;
  --ok: #3fdc7a; --warn: #ffb830; --alert: #ff6b60; --red-1: #8a2b24; --red-2: #5a1a16; --red-edge: #d9665c;
  --rivet: radial-gradient(circle at 35% 30%, #b9b88e, #4b4a30 70%);
}

html, body { background: var(--steel-0); color: var(--ink); }
::selection { background: #3a6b4a; color: #fff; }
* { scrollbar-width: thin; scrollbar-color: #5a5a40 #14150e; }
::-webkit-scrollbar { width: 10px; height: 10px; } ::-webkit-scrollbar-track { background: #14150e; } ::-webkit-scrollbar-thumb { background: #5a5a40; border: 2px solid #14150e; border-radius: 6px; }
.muted { color: var(--ink-dim); }

/* ---------- headings ---------- */
h1, h2, h3 { font-weight: normal; }
h2 { color: var(--brass-hi); font-size: 13px; letter-spacing: 3px; text-transform: uppercase; border-bottom: 1px dotted var(--edge); padding: 2px 0 6px; margin: 0 0 12px; }
h3 { color: var(--brass-text); font-size: 11px; letter-spacing: 2px; text-transform: uppercase; margin: 14px 0 6px; padding-bottom: 3px; border-bottom: 1px dotted #3f4130; }

/* ---------- buttons ---------- */
button { font-family: inherit; color: var(--ink); background: linear-gradient(#4a4c38, #34362a); border: 1px solid var(--edge); border-bottom-color: var(--steel-4); border-radius: 3px; letter-spacing: 1px; text-shadow: 0 1px 0 #000a; box-shadow: inset 0 1px 0 rgba(255, 255, 220, .12), 0 1px 0 rgba(0, 0, 0, .5); transition: background .12s, border-color .12s, box-shadow .12s; }
button:hover:not(:disabled) { background: linear-gradient(#5a5d44, #40422f); color: #fff; border-color: var(--edge-hi); }
button:active:not(:disabled) { background: linear-gradient(#2a2c20, #34362a); transform: translateY(1px); box-shadow: inset 0 2px 4px rgba(0, 0, 0, .5); }
button:focus-visible, select:focus-visible, input:focus-visible { outline: 2px solid var(--ok); outline-offset: 1px; }
button:disabled { opacity: .45; cursor: not-allowed; }
button.primary { background: linear-gradient(#8b7a3c, #5f5328); border-color: var(--brass-edge); color: #fff7dc; box-shadow: inset 0 1px 0 rgba(255, 245, 190, .35), 0 1px 0 #000a; }
button.primary:hover:not(:disabled) { background: linear-gradient(#a08c46, #6f6130); border-color: #e6d58b; }
button.on { background: linear-gradient(#143b25, #0c2617); border-color: #4fcf86; color: #aaffc8; box-shadow: inset 0 0 8px rgba(80, 255, 150, .25), 0 0 6px rgba(80, 255, 150, .2); }
button.danger, #btn-quit { background: linear-gradient(var(--red-1), var(--red-2)); border-color: var(--red-edge); color: #fff; }
button.danger:hover, #btn-quit:hover { background: linear-gradient(#a5362d, #6a201b); }

/* ---------- inputs ---------- */
select, input[type=text], input[type=number], input:not([type]), textarea { background: #0b0f08; color: var(--crt-soft); border: 1px solid var(--edge-2); border-radius: 2px; box-shadow: inset 0 1px 3px rgba(0, 0, 0, .7); }
select { cursor: pointer; } select:hover { border-color: var(--edge-hi); }
select option { background: #0b0f08; color: var(--crt-soft); }
input[type=range] { accent-color: #7fdc9a; }
input[type=checkbox], input[type=radio] { accent-color: #7fdc9a; }
label { color: var(--ink); }

/* ---------- shells: panels, boxes, dialogs ---------- */
.panel, .menu-box, .modal-box, #gameover { position: relative; background: linear-gradient(#34362a, #22241a); border: 2px solid var(--edge); border-radius: 9px; box-shadow: inset 0 0 0 1px var(--steel-4), inset 0 0 44px rgba(0, 0, 0, .32), 0 12px 46px rgba(0, 0, 0, .8); color: var(--ink); }
.panel.wide, #options .panel, .menu-box, .multiplayer-panel { position: absolute; }
.panel::before, .panel::after, .menu-box::before, .menu-box::after, .modal-box::before, .modal-box::after { content: ""; position: absolute; top: 7px; left: 7px; width: 9px; height: 9px; border-radius: 50%; background: var(--rivet); box-shadow: 0 0 0 1px var(--steel-4); pointer-events: none; }
.panel::after, .menu-box::after, .modal-box::after { left: auto; right: 7px; }
.panel { padding: 18px 22px; }
.panel h2:first-child, .modal-box h2:first-child { text-align: center; }

/* ---------- main menu ---------- */
#menu::after, #multiplayer::after { content: ""; position: absolute; inset: 0; pointer-events: none; background: radial-gradient(ellipse at center, transparent 45%, rgba(0, 0, 0, .7) 100%), repeating-linear-gradient(0deg, rgba(0, 0, 0, .16) 0 1px, transparent 1px 3px); }
.menu-box { z-index: 2; min-width: 420px; padding: 26px 40px 22px; }
.menu-box h1 { display: inline-block; margin: 2px 0 6px; padding: 8px 26px 6px; background: linear-gradient(#8b7a3c, #5f5328); border: 1px solid var(--brass-edge); border-radius: 3px; box-shadow: inset 0 1px 0 rgba(255, 245, 190, .35), 0 2px 0 #000a; text-shadow: none; }
.menu-box h1 .wordmark { display: block; font: 700 38px Georgia, serif; letter-spacing: 8px; color: #1a1507; text-shadow: 0 1px 0 rgba(255, 240, 180, .35); }
.menu-box h1 .year { display: block; font: 700 17px "Courier New", monospace; letter-spacing: 16px; color: #3a0d09; text-shadow: 0 1px 0 rgba(255, 200, 190, .25); margin-top: -2px; }
.menu-box .tag { display: inline-block; margin: 8px 0 16px; padding: 3px 14px; font-size: 11px; letter-spacing: 2px; text-transform: uppercase; color: var(--crt); background: var(--crt-bg); border: 1px solid var(--crt-edge); border-radius: 3px; text-shadow: 0 0 6px #3f9; box-shadow: inset 0 0 12px rgba(0, 0, 0, .8); }
.menu-box button.big { position: relative; display: flex; align-items: center; justify-content: center; width: 100%; margin: 7px 0; padding: 12px 34px; font-size: 14px; letter-spacing: 3px; }
.menu-box button.big::before { content: ""; position: absolute; left: 14px; top: 50%; width: 9px; height: 9px; margin-top: -5px; border-radius: 50%; background: radial-gradient(circle at 35% 30%, #777, #333 70%); box-shadow: 0 0 0 1px #000; }
.menu-box button.big:hover::before, .menu-box button.big.primary::before { background: radial-gradient(circle at 35% 30%, #aaffc8, #1fa75a 70%); box-shadow: 0 0 0 1px #000, 0 0 8px #3f9; }
.menu-box .credits { font-size: 10px; color: #7b7f68; letter-spacing: .5px; border-top: 1px dotted #4b4d38; padding-top: 10px; margin-top: 18px; }

/* ---------- top bar (HUD) ---------- */
#topbar { background: linear-gradient(#3b3d2d, #2a2c20); border-bottom: 2px solid var(--steel-4); box-shadow: inset 0 1px 0 rgba(255, 255, 220, .08); }
#tb-name { display: inline-block; padding: 2px 12px; font-size: 11px; letter-spacing: 2px; text-transform: uppercase; color: #fff4d0; background: linear-gradient(#8b7a3c, #5f5328); border: 1px solid var(--brass-edge); border-radius: 3px; box-shadow: inset 0 1px 0 rgba(255, 245, 190, .3); }
#tb-name:empty { display: none; }
.tb-credits { background: var(--crt-bg); border: 1px solid var(--crt-edge); border-radius: 3px; padding: 1px 9px; font-size: 14px; letter-spacing: 1px; box-shadow: inset 0 0 10px rgba(0, 0, 0, .8); text-shadow: 0 0 6px currentColor; }
.tb-power { display: inline-flex; align-items: center; gap: 4px; padding: 1px 9px; background: var(--crt-bg); border: 1px solid var(--crt-edge); border-radius: 3px; color: var(--crt-soft); box-shadow: inset 0 0 10px rgba(0, 0, 0, .8); }
.powerbar { background: #000; border: 1px solid var(--crt-edge); border-radius: 2px; overflow: hidden; }
.powerbar span { background: linear-gradient(90deg, #1fa75a, #6dff9d); }
#tb-time { display: inline-block; font-size: 17px; letter-spacing: 3px; color: var(--crt); background: var(--crt-bg); padding: 0 10px; border: 1px solid var(--crt-edge); border-radius: 3px; text-shadow: 0 0 6px #3f9; box-shadow: inset 0 0 10px rgba(0, 0, 0, .8); }
#tb-speed, #tb-zoom { color: var(--brass-hi); }
#topbar button { min-height: 24px; }

/* ---------- radar bezel + sidebar ---------- */
#game { grid-template-columns: minmax(0, 1fr) clamp(300px, 22vw, 420px); }
#sidebar { position: relative; background: linear-gradient(90deg, #2d2f23, #22241a); border-left: 2px solid var(--steel-4); box-shadow: inset 2px 0 0 rgba(255, 255, 220, .05); }
#radar-wrap { position: relative; margin: 8px 8px 6px; border: 3px solid var(--steel-4); border-radius: 12px / 10px; background: #020604; box-shadow: 0 0 0 2px var(--edge-hi), inset 0 0 40px rgba(0, 0, 0, .7); overflow: hidden; flex: 0 0 auto; }
#radar-wrap::after { content: ""; position: absolute; inset: 0; pointer-events: none; z-index: 2; background: radial-gradient(ellipse at center, transparent 62%, rgba(0, 0, 0, .5) 100%), repeating-linear-gradient(0deg, rgba(0, 0, 0, .13) 0 1px, transparent 1px 3px); }
#radar-wrap::before { content: "TACTICAL RADAR"; position: absolute; left: 8px; top: 5px; z-index: 3; font-size: 8px; letter-spacing: 2px; color: rgba(141, 255, 176, .55); pointer-events: none; }
#radar { display: block; width: min(100%, 52vh); height: auto; aspect-ratio: 1 / 1; margin: 0 auto; border: 0; image-rendering: auto; cursor: crosshair; background: #020604; }
#radar-expand { z-index: 6; top: 12px; right: 14px; border-color: var(--crt-edge); color: var(--crt); background: rgba(0, 10, 5, .82); }
.sb-btns { gap: 4px; padding: 0 8px 4px; } .sb-btns button { padding: 7px 2px; font-size: 11px; letter-spacing: 2px; }
.sb-btns button.on { background: linear-gradient(#143b25, #0c2617); border-color: #4fcf86; color: #aaffc8; }
.sb-tabs { gap: 2px; padding: 4px 8px 0; border-bottom: 1px solid var(--edge-2); margin: 0 0 0; }
.sb-tabs button { border-radius: 3px 3px 0 0; border-bottom: 0; font-size: 10px; padding: 7px 0; letter-spacing: 1px; }
.sb-tabs button.on { background: linear-gradient(#143b25, #0c2617); border-color: #4fcf86; color: #aaffc8; box-shadow: inset 0 0 8px rgba(80, 255, 150, .25); }
.z-tabs button.on { background: linear-gradient(#143b25, #0c2617); color: #aaffc8; border-bottom-color: #4fcf86; }
#buildlist { gap: 6px; padding: 8px; background: rgba(0, 0, 0, .18); }
.bicon { border: 1px solid var(--edge-2); border-radius: 3px; background: #14150e; box-shadow: inset 0 0 10px rgba(0, 0, 0, .6); transition: border-color .12s, box-shadow .12s; }
.bicon:hover { border-color: var(--brass-edge); box-shadow: inset 0 0 10px rgba(0, 0, 0, .5), 0 0 7px rgba(201, 181, 101, .35); }
.bicon .name { color: var(--ink); } .bicon .cost { color: #ffd86b; }
.bicon .prog { background: rgba(0, 0, 0, .62); border-right: 2px solid var(--brass-edge); }
.bicon .cnt { background: var(--crt-bg); color: var(--crt); border: 1px solid var(--crt-edge); border-radius: 2px; }
.bicon .status { color: var(--crt); text-shadow: 0 0 6px #3f9, 1px 1px 0 #000; letter-spacing: 1px; }
#selinfo { margin: 0 8px 8px; border: 1px solid var(--crt-edge); border-radius: 4px; background: var(--crt-bg); color: var(--crt-soft); box-shadow: inset 0 0 14px rgba(0, 0, 0, .85); }
#selinfo b { color: var(--ink-hi); }
#sw-fire { background: linear-gradient(var(--red-1), var(--red-2)) !important; border: 1px solid var(--red-edge) !important; border-radius: 3px; letter-spacing: 2px; }

/* ---------- in-game overlays ---------- */
#msgs div { background: rgba(0, 10, 5, .55); padding: 1px 7px; border-left: 2px solid var(--crt-edge); border-radius: 0 3px 3px 0; width: fit-content; max-width: 70vw; }
#tooltip { background: rgba(8, 12, 8, .95); border: 1px solid #4fcf86; border-radius: 3px; color: var(--crt-soft); box-shadow: 0 4px 14px #000; }
#tooltip b { color: var(--ink-hi); }
#gameover { border-color: var(--brass-edge); padding: 22px 34px; }
#gameover h2 { color: var(--brass-hi); letter-spacing: 6px; border: 0; }
#go-stats { color: var(--crt-soft); } #go-stats th { color: var(--brass-text); font-weight: normal; letter-spacing: 1px; font-size: 11px; }
#modal { background: rgba(5, 7, 3, .72); backdrop-filter: blur(2px); }
.modal-box { border-color: var(--brass-edge); }
.modal-box h2 { text-align: center; }
.modal-box textarea { background: var(--crt-bg); color: var(--crt-soft); border: 1px solid var(--crt-edge); }
#zeus { background: linear-gradient(#34362a, #22241a); border: 2px solid var(--red-edge); border-radius: 6px; box-shadow: 0 8px 30px #000; }
.z-head { background: linear-gradient(var(--red-1), var(--red-2)); letter-spacing: 3px; font-size: 11px; border-radius: 3px 3px 0 0; }
#z-body button.on { background: linear-gradient(#143b25, #0c2617); border-color: #4fcf86; color: #aaffc8; }
#z-body .ztitle { color: var(--brass-hi); letter-spacing: 1px; }

/* ---------- setup / scenario / multiplayer / options screens ---------- */
#setup, #scenario, #help, #options, #multiplayer { background: radial-gradient(ellipse at 50% 30%, #2a2c22 0%, #15170f 80%); }
#scenario, #setup { overflow-y: auto; }
.setup-tools { padding: 10px 14px 0; text-align: center; }
.scenario-shortcut { letter-spacing: 3px; padding: 9px 20px; }
#map-preview, #scenario-map { background: #020604; border: 3px solid var(--steel-4); border-radius: 10px / 8px; box-shadow: 0 0 0 2px var(--edge-hi), inset 0 0 30px rgba(0, 0, 0, .6); }
#slots th { color: var(--brass-text); letter-spacing: 2px; text-transform: uppercase; font-size: 10px; border-bottom: 1px dotted var(--edge); padding: 3px 4px 5px; }
#slots td { border-top: 1px dotted #3f4130; padding: 4px; }
#slots tr:hover td { background: rgba(80, 255, 150, .05); }
.rules label, #gen-params label, .scenario-option { padding: 2px 0; }
.scenario-years { color: var(--brass-text); letter-spacing: 1px; }
#scenario-year { accent-color: #c9b565; }
.scenario-faction { background: rgba(0, 0, 0, .25); border: 1px solid var(--edge-2); border-left: 3px solid var(--brass-edge); border-radius: 3px; }
.scenario-summary { color: var(--crt-soft); }
.multiplayer-panel { width: min(92vw, 580px); }
.multiplayer-link { color: var(--ink-hi); background: linear-gradient(#4a4c38, #34362a); border: 1px solid var(--edge); border-radius: 3px; letter-spacing: 2px; text-transform: uppercase; font-size: 12px; box-shadow: inset 0 1px 0 rgba(255, 255, 220, .12); }
.multiplayer-link:hover { background: linear-gradient(#5a5d44, #40422f); color: #fff; }
.multiplayer-panel p { color: var(--ink); }
#options label { padding: 4px 0; border-bottom: 1px dotted #3f4130; }

/* ---------- loading / initializing screen ---------- */
#boot { background: radial-gradient(ellipse at 50% 38%, #2a2c22 0%, #0d0f09 75%); font-family: "Lucida Console", Consolas, "Courier New", monospace; }
#boot::after { content: ""; position: absolute; inset: 0; pointer-events: none; background: repeating-linear-gradient(0deg, rgba(0, 0, 0, .18) 0 1px, transparent 1px 3px), radial-gradient(ellipse at center, transparent 50%, rgba(0, 0, 0, .65) 100%); }
#boot .boot-in { position: relative; z-index: 1; width: min(560px, 90vw); padding: 26px 30px 20px; background: linear-gradient(#34362a, #22241a); border: 2px solid var(--edge); border-radius: 10px; box-shadow: inset 0 0 0 1px var(--steel-4), 0 16px 60px #000; }
#boot .boot-plate { display: inline-block; padding: 7px 30px 5px; background: linear-gradient(#8b7a3c, #5f5328); border: 1px solid var(--brass-edge); border-radius: 3px; box-shadow: inset 0 1px 0 rgba(255, 245, 190, .35); }
#boot .boot-plate b { display: block; font: 700 30px Georgia, serif; letter-spacing: 8px; color: #1a1507; text-shadow: 0 1px 0 rgba(255, 240, 180, .35); }
#boot .boot-plate small { display: block; font: 700 14px "Courier New", monospace; letter-spacing: 14px; color: #3a0d09; margin-top: -2px; }
#boot .boot-sub { margin: 14px 0 14px; letter-spacing: 5px; font-size: 11px; color: var(--brass-text); }
#boot .boot-bar { position: relative; height: 16px; padding: 2px; background: #020604; border: 2px solid var(--steel-4); border-radius: 4px; box-shadow: 0 0 0 1px var(--edge-hi), inset 0 0 10px #000; overflow: hidden; }
#boot .boot-bar i { display: block; height: 100%; width: 3%; border-radius: 1px; background: linear-gradient(90deg, #1fa75a, #6dff9d); box-shadow: 0 0 10px #3f9a; transition: width .25s; }
#boot .boot-bar .boot-ticks { position: absolute; inset: 0; pointer-events: none; background: repeating-linear-gradient(90deg, transparent 0 calc(10% - 2px), rgba(0, 0, 0, .75) calc(10% - 2px) 10%); }
#boot .boot-row { display: flex; justify-content: space-between; margin-top: 7px; font-size: 12px; letter-spacing: 2px; color: var(--crt); text-shadow: 0 0 6px #3f9; }
#boot #boot-msg { margin-top: 12px; min-height: 20px; font-size: 14px; color: var(--ink-hi); }
#boot #boot-msg.bad { color: var(--alert); }
#boot #boot-steps { list-style: none; margin: 10px 0 0; padding: 8px 10px; text-align: left; font-size: 11px; color: var(--crt-soft); background: var(--crt-bg); border: 1px solid var(--crt-edge); border-radius: 3px; min-height: 30px; box-shadow: inset 0 0 12px #000; }
#boot #boot-steps li { margin: 1px 0; opacity: .6; } #boot #boot-steps li::before { content: "▸ "; color: var(--ok); } #boot #boot-steps li:last-child { opacity: 1; }
#boot .boot-tip { margin-top: 16px; font-size: 10px; color: #7b7f68; letter-spacing: .5px; }

/* ---------- field manual ---------- */
#help { display: none; }
#help.active { display: block; }
#help .manual { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); width: min(1040px, 96vw); height: min(780px, 94vh); display: flex; flex-direction: column; padding: 14px 18px 12px; }
#help .man-head { display: flex; align-items: center; gap: 14px; padding: 0 28px 10px; border-bottom: 2px solid var(--steel-4); }
#help .man-plate { padding: 5px 16px; background: linear-gradient(#8b7a3c, #5f5328); border: 1px solid var(--brass-edge); border-radius: 3px; box-shadow: inset 0 1px 0 rgba(255, 245, 190, .3); color: #fff4d0; }
#help .man-plate b { display: block; letter-spacing: 4px; font-size: 14px; } #help .man-plate small { display: block; font-size: 9px; letter-spacing: 2px; opacity: .85; }
#help .man-search { margin-left: auto; width: 220px; padding: 5px 9px; font-size: 12px; }
#help .man-body { flex: 1; min-height: 0; display: flex; gap: 10px; padding-top: 10px; }
#help .man-nav { width: 190px; flex: none; display: flex; flex-direction: column; gap: 4px; overflow-y: auto; }
#help .man-nav button { text-align: left; padding: 8px 10px; font-size: 11px; letter-spacing: 1.5px; }
#help .man-nav button .n { display: inline-block; width: 22px; color: var(--brass-text); } #help .man-nav button.on .n { color: var(--crt); }
#help .man-pages { flex: 1; min-width: 0; overflow-y: auto; padding: 4px 14px 10px 4px; border: 1px solid var(--edge-2); border-radius: 4px; background: rgba(0, 0, 0, .22); }
#help .man-page { display: none; padding: 10px 14px; line-height: 1.55; } #help .man-page.on { display: block; }
#help .man-page > h3:first-child { margin-top: 2px; }
#help .man-page p { margin: 6px 0; color: var(--ink); }
#help .man-page ul { margin: 6px 0; padding-left: 20px; } #help .man-page li { margin: 4px 0; color: var(--ink); }
#help .man-page b { color: var(--ink-hi); font-weight: normal; }
#help kbd { display: inline-block; min-width: 20px; padding: 0 6px; margin: 0 1px; text-align: center; font: 11px/18px "Courier New", monospace; color: var(--crt); background: var(--crt-bg); border: 1px solid var(--crt-edge); border-bottom-width: 2px; border-radius: 3px; }
#help table.keys { border-collapse: collapse; width: 100%; margin: 6px 0; } #help table.keys td { padding: 5px 8px; border-bottom: 1px dotted #3f4130; vertical-align: top; } #help table.keys td:first-child { width: 36%; white-space: nowrap; }
#help .tier { display: grid; grid-template-columns: 110px 1fr; gap: 6px 12px; margin: 8px 0; } #help .tier span { color: var(--crt); }
#help .callout { margin: 10px 0; padding: 8px 12px; border-left: 3px solid var(--brass-edge); background: rgba(139, 122, 60, .12); color: var(--ink); }
#help .callout.warn { border-left-color: var(--warn); } #help .callout.tip { border-left-color: var(--ok); }
#help .man-foot { display: flex; justify-content: space-between; align-items: center; padding-top: 10px; }
#help .man-empty { display: none; padding: 20px; color: var(--ink-dim); } #help mark { background: #5f5328; color: #fff4d0; }

/* ---------- misc small screens ---------- */
@media (max-height: 770px) { #radar { width: min(100%, 38vh); } }
@media (max-width: 1220px) { #game { grid-template-columns: minmax(0, 1fr) 270px; } }
@media (max-width: 820px) { #help .man-nav { width: 120px; } #help .man-search { display: none; } .menu-box { min-width: 0; width: 92vw; padding: 20px 18px; } }
#help ol { margin: 6px 0; padding-left: 22px; } #help ol li { margin: 4px 0; }

/* ---------- overrides for the older menu / touch rules in style.css ---------- */
.menu-box button.big { display: flex; margin: 7px 0; padding: 13px 34px; font: 700 14px "Lucida Console", Consolas, monospace; letter-spacing: 3px; color: var(--ink); border: 1px solid var(--edge); background: linear-gradient(#4a4c38, #34362a); box-shadow: inset 0 1px 0 rgba(255, 255, 220, .12), 0 1px 0 rgba(0, 0, 0, .5); }
.menu-box button.big:hover { filter: none; background: linear-gradient(#5a5d44, #40422f); color: #fff; }
.menu-box button.big.primary { color: #fff7dc; border-color: var(--brass-edge); background: linear-gradient(#8b7a3c, #5f5328); box-shadow: inset 0 1px 0 rgba(255, 245, 190, .35), 0 1px 0 #000a; }
.menu-box button.big.primary:hover { background: linear-gradient(#a08c46, #6f6130); }
.menu-box .tag { font: 11px "Lucida Console", Consolas, monospace; color: var(--crt); margin: 8px 0 16px; }
.menu-box .credits { color: #7b7f68; font-size: 10px; margin-top: 18px; }
.setup-tools { justify-content: center; margin: 12px 12px 0; }
#touchbar > button, #touchbar #touchgrp button { background: rgba(34, 36, 26, .94); border: 2px solid var(--edge); color: var(--ink); border-radius: 8px; box-shadow: 0 2px 8px rgba(0, 0, 0, .6), inset 0 1px 0 rgba(255, 255, 220, .1); }
#touchbar > button.on { background: linear-gradient(#143b25, #0c2617); border-color: #4fcf86; color: #aaffc8; }
.sb-tabs button.on { color: #aaffc8; }
#gen-params label:has(input[type=checkbox]), .rules label:has(input[type=checkbox]) { justify-content: flex-start; }

/* ---------- in-game comms (chat + match info) ---------- */
#btn-comms { position: relative; }
#cm-badge { position: absolute; top: -6px; right: -6px; min-width: 16px; padding: 0 4px; font-size: 10px; line-height: 16px; border-radius: 8px; background: var(--red-1); border: 1px solid var(--red-edge); color: #fff; text-align: center; }
#btn-comms.flash { box-shadow: 0 0 8px var(--ok); border-color: var(--ok); }
#comms { position: absolute; left: 10px; bottom: 12px; width: min(430px, 92vw); height: min(380px, 60vh); display: flex; flex-direction: column; z-index: 30; background: linear-gradient(var(--steel-2), var(--steel-4)); border: 1px solid var(--edge); border-top: 2px solid var(--brass-edge); border-radius: 4px; box-shadow: 0 6px 22px rgba(0,0,0,.65); pointer-events: auto; }
#comms.hidden { display: none; }
#comms .cm-head { display: flex; align-items: center; gap: 8px; padding: 5px 8px; border-bottom: 1px solid var(--edge-2); background: linear-gradient(var(--brass-1), var(--brass-2)); }
#comms .cm-head b { letter-spacing: 3px; font-size: 12px; color: #fff4cf; }
#comms .cm-tabs { display: flex; gap: 4px; flex: 1; }
#comms .cm-tabs button { padding: 2px 9px; font-size: 10px; min-height: 20px; }
#comms .cm-tabs button.on { background: linear-gradient(#1c5a3a, #0f3a24); border-color: var(--crt-edge); color: var(--crt); }
#cm-chat, #cm-room { flex: 1; min-height: 0; display: flex; flex-direction: column; padding: 8px; }
#cm-chat.hidden, #cm-room.hidden { display: none; }
#cm-log { flex: 1; overflow-y: auto; background: var(--crt-bg); border: 1px solid var(--crt-edge); border-radius: 3px; padding: 6px 8px; font-size: 12px; line-height: 1.45; color: var(--crt-soft); }
#cm-log .me b { color: var(--brass-hi); } #cm-log b { color: var(--crt); } #cm-log .sys { color: var(--ink-dim); font-style: italic; }
#comms .cm-in { display: flex; gap: 6px; margin-top: 6px; }
#comms .cm-in input { flex: 1; background: var(--crt-bg); color: var(--crt); border: 1px solid var(--crt-edge); border-radius: 3px; padding: 5px 7px; font-family: inherit; }
#cm-room { overflow-y: auto; font-size: 12px; }
#cm-room .code { font-size: 26px; letter-spacing: 6px; text-align: center; color: var(--crt); background: var(--crt-bg); border: 1px solid var(--crt-edge); border-radius: 3px; padding: 6px 0; margin: 4px 0; user-select: all; }
#cm-room table { width: 100%; border-collapse: collapse; margin: 4px 0 8px; } #cm-room td, #cm-room th { text-align: left; padding: 3px 5px; border-bottom: 1px dotted #3f4130; font-size: 11px; }
#cm-room th { color: var(--brass-text); letter-spacing: 1px; font-weight: normal; }
#cm-room .on { color: var(--ok); } #cm-room .off { color: var(--alert); } #cm-room .tag { font-size: 9px; letter-spacing: 1px; padding: 0 4px; border: 1px solid var(--brass-edge); color: var(--brass-hi); border-radius: 2px; margin-left: 4px; }
#cm-room .row { display: flex; gap: 6px; align-items: center; } #cm-room .row input { flex: 1; background: var(--crt-bg); color: var(--crt-soft); border: 1px solid var(--crt-edge); border-radius: 3px; padding: 4px 6px; font-size: 11px; font-family: inherit; }
#cm-room p { color: var(--ink-dim); margin: 6px 0; line-height: 1.4; }

/* ---------- top bar: never overlap on tablets / narrow windows (it wraps to a second row instead) ---------- */
#game { grid-template-rows: auto minmax(0, 1fr); }
#topbar { height: auto; min-height: 40px; flex-wrap: wrap; row-gap: 3px; padding-top: 3px; padding-bottom: 3px; }
#topbar .tb-left, #topbar .tb-right { flex-wrap: wrap; row-gap: 3px; max-width: 100%; }
#topbar .tb-left { flex: 1 1 auto; }
#topbar .tb-right { flex: 0 1 auto; justify-content: flex-end; }
@media (max-width: 1500px) { .tb-credits { padding: 1px 6px; font-size: 13px; } #tb-time { font-size: 15px; letter-spacing: 2px; padding: 0 6px; } #tb-name { padding: 2px 8px; letter-spacing: 1px; } }
@media (max-width: 1100px) { #topbar { font-size: 11px; } .tb-credits { font-size: 12px; letter-spacing: 0; } #topbar button { padding: 2px 6px; margin-left: 2px; } #tb-fuelrate { display: none; } .powerbar { width: 44px; } }

/* ---------- home link (site root) ---------- */
a.home-link { display: block; text-align: center; text-decoration: none; color: var(--brass-hi); }
#gameover a.home-link { display: inline-block; margin-left: 8px; padding: 6px 14px; border: 1px solid var(--steel-4); border-radius: 3px; background: rgba(0, 0, 0, .25); letter-spacing: 2px; font-size: 12px; }
.menu-box a.big.home-link { margin-top: 6px; padding: 10px 14px; border: 1px solid var(--steel-4); border-radius: 3px; background: linear-gradient(#3b3d2d, #2a2c20); letter-spacing: 2px; font-size: 13px; }
.menu-box a.big.home-link:hover { filter: brightness(1.2); }

/* V21.3 — viewport-safe menus: the options screen must scroll even with body overflow hidden. */
#options, #help, #setup, #scenario, #multiplayer { overflow-x:hidden; overflow-y:auto; overscroll-behavior:contain; }
#options .panel {
  position:relative; left:auto; top:auto; transform:none;
  box-sizing:border-box; width:min(780px, calc(100% - 24px));
  max-width:none; max-height:none; margin:12px auto 28px;
  overflow:visible;
}
#options .panel label { min-width:0; gap:10px; flex-wrap:wrap; }
#options .panel select { max-width:100%; }
#setup .setup-grid { box-sizing:border-box; height:auto; min-height:100%; max-width:1250px; }
#setup .map-panel, #setup .players-panel { min-width:0; max-height:calc(100dvh - 28px); overflow-y:auto; }
#scenario .scenario-panel { box-sizing:border-box; width:min(1200px, calc(100% - 24px)); margin:12px auto 28px; }
#scenario .scenario-layout { min-width:0; }
#scenario .scenario-layout > div { min-width:0; }
@media(max-width:830px) {
  #setup .setup-grid { display:block; padding:10px; }
  #setup .map-panel, #setup .players-panel { max-height:none; overflow:visible; margin-bottom:12px; }
  #scenario .scenario-layout { grid-template-columns:1fr; }
}
@media(max-height:700px) { #options .panel { margin-top:6px; } }
