/* Layout: a thin black top strip with the Options and credits tabs; the battlefield canvas below it;
   a gunmetal sidebar with radar and two build columns on the right (bottom console in portrait).
   One dark look, modelled on mid-90s RTS interfaces. */
:root {
  --metal: #3e4042;
  --metal-hi: #6a6d70;
  --metal-lo: #17191a;
  --well: #0b0c0d;
  --ink: #cfd1c8;
  --green: #59e05a;
  --amber: #e9b93a;
  --red: #e0432f;
  --accent: #5b7fb0;       /* swapped per faction */
  --font-stencil: 'Black Ops One', Impact, 'Arial Black', sans-serif;
  --font-ui: 'Archivo Narrow', 'Arial Narrow', 'Helvetica Neue', Arial, sans-serif;
  --font-term: 'VT323', ui-monospace, Menlo, Consolas, monospace;
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-l: env(safe-area-inset-left, 0px);
  --safe-r: env(safe-area-inset-right, 0px);
  --sbw: 176px;
  --ts: calc(var(--safe-t) + 22px);   /* top strip height */
  --cam-h: 56px;
  --gw: 100vw; --gh: 100vh;
  color-scheme: dark;
}
[data-faction="soviets"] { --accent: #b3352b; }

* { box-sizing: border-box; }
html, body {
  margin: 0; height: 100%; overflow: hidden;
  background: #000; color: var(--ink);
  font-family: var(--font-ui); font-size: 15px;
  -webkit-user-select: none; user-select: none;
  -webkit-touch-callout: none; -webkit-tap-highlight-color: transparent;
  overscroll-behavior: none;
}
[hidden] { display: none !important; }
body.touch .mouse-only, body:not(.touch) .touch-only { display: none !important; }
button { font: inherit; color: inherit; cursor: pointer; touch-action: manipulation; }
button:focus-visible { outline: 2px solid var(--amber); outline-offset: 1px; }

#game { position: fixed; left: 0; top: var(--ts); display: block; touch-action: none; }

/* ---------- Bevelled metal ---------- */
.raised, #sidebar, #selbar, #placebar, .tab, .icon, .sb-arrows button, #selBtns button, #placebar button {
  background: linear-gradient(180deg, #55585a, var(--metal) 45%, #2e3032);
  border: 2px solid; border-color: var(--metal-hi) var(--metal-lo) var(--metal-lo) var(--metal-hi);
}
.icon:active, .sb-arrows button:active, #selBtns button:active, #placebar button:active, .tab:active {
  border-color: var(--metal-lo) var(--metal-hi) var(--metal-hi) var(--metal-lo);
}
.sunken { background: var(--well); border: 2px solid; border-color: var(--metal-lo) var(--metal-hi) var(--metal-hi) var(--metal-lo); }

/* ---------- Top strip ---------- */
#topstrip {
  position: fixed; z-index: 7; top: 0; left: 0; right: 0; height: var(--ts);
  padding: var(--safe-t) var(--safe-r) 0 var(--safe-l);
  background: #000; display: flex; justify-content: space-between; align-items: stretch;
}
.tab {
  min-width: 120px; padding: 0 14px; display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 14px; letter-spacing: 0.04em; color: #d6d6cc;
  border-top: 0; border-radius: 0 0 10px 10px;
}
/* Touch screens: the Options tab answers taps on a larger area than it shows (about 44 px tall), since it sits
   on the screen's top edge where iOS also listens for its own swipes. */
#menuBtn { position: relative; }
body.touch #menuBtn::after { content: ''; position: absolute; left: -6px; right: -16px; top: calc(0px - var(--safe-t)); bottom: -22px; }
/* Battle clock in the middle of the strip; it ignores taps so the map below it stays usable. */
#clock {
  position: absolute; left: 50%; top: var(--safe-t); bottom: 0; transform: translateX(-50%);
  display: flex; align-items: center; padding: 0 10px; pointer-events: none;
  font-family: var(--font-term); font-size: 20px; line-height: 1; letter-spacing: 0.08em;
  color: #c9c6b4; font-variant-numeric: tabular-nums;
}
.credits {
  width: var(--sbw); font-size: 16px; letter-spacing: 0.12em; font-variant-numeric: tabular-nums;
  color: #e7e4d4; text-shadow: 1px 1px 0 #000;
}

/* ---------- Sidebar ---------- */
#sidebar {
  position: fixed; z-index: 5; top: var(--ts); right: 0; bottom: 0;
  width: calc(var(--sbw) + var(--safe-r));
  padding: 5px calc(var(--safe-r) + 5px) calc(var(--safe-b) + 5px) 5px;
  border-right: 0; border-bottom: 0;
  display: grid; gap: 5px;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: auto auto minmax(0, 1fr) auto;
  grid-template-areas: "radar" "buttons" "strips" "arrows";
}
.sb-radar { grid-area: radar; }
#radar {
  display: block; width: 100%; aspect-ratio: 1; touch-action: none; image-rendering: pixelated;
  background: #000; border: 3px solid; border-color: var(--metal-lo) var(--metal-hi) var(--metal-hi) var(--metal-lo);
}
.sb-buttons { grid-area: buttons; display: flex; gap: 3px; min-width: 0; }
.icon {
  flex: 1 1 0; min-width: 0; min-height: 34px; padding: 1px 0 0; display: flex; flex-direction: column; align-items: center; justify-content: center;
  line-height: 1; color: #d4d6cc;
}
.icon span { font-size: 17px; }
.icon small { font-size: 10px; font-weight: 700; letter-spacing: 0.03em; text-align: center; color: #a9ac9f; }
.icon[hidden] { display: none; }
.sb-buttons .icon small { font-size: 9px; letter-spacing: 0; }
#returnBtn small, #boxBtn small, #giveBtn small { font-size: 7px; }
/* One-tap squads (touch screens only): under AUTO and SELECT in landscape, a row above the console in portrait. */
.sb-squad { grid-area: squad; display: flex; gap: 3px; min-width: 0; }
.icon.squad { min-height: 40px; gap: 2px; }
.icon.squad small { font-size: 7px; letter-spacing: 0; }
.icon.squad b { font-size: 14px; font-weight: 700; font-variant-numeric: tabular-nums; }
.icon.squad:disabled { opacity: 0.45; cursor: default; }
.icon.squad:disabled:active { border-color: var(--metal-hi) var(--metal-lo) var(--metal-lo) var(--metal-hi); }
/* Touch screens: the command buttons wrap (AUTO, ALLY, GIVE on top, RETURN and SELECT below in team games) so each is
   big enough to tap; in a 1 v 1 AUTO and SELECT share one row. */
body.touch .sb-buttons { flex-wrap: wrap; }
body.touch .sb-buttons .icon { flex: 1 1 30%; min-height: 36px; }
body.touch #returnBtn small, body.touch #boxBtn small, body.touch #giveBtn small { font-size: 9px; }
body.touch #sidebar { grid-template-rows: auto auto auto minmax(0, 1fr); grid-template-areas: "radar" "buttons" "squad" "strips"; }
body.touch .sb-arrows { display: none; }   /* (touch: the build strips scroll with a swipe; the arrows are for a mouse) */
.sb-fold { display: none; }
/* Touch screens: the selection panel on one line (count and health, then buttons that scroll sideways), so it covers
   as little of the battlefield as it can. */
body.touch #selbar { flex-wrap: nowrap; max-width: calc(var(--gw) - 16px - var(--safe-l)); }
body.touch .sel-info { flex: none; max-width: 110px; }
body.touch #selName { font-size: 13px; }
body.touch #selBtns { flex-wrap: nowrap; min-width: 0; overflow-x: auto; scrollbar-width: none; touch-action: pan-x; }
body.touch #selBtns.more { -webkit-mask-image: linear-gradient(90deg, #000 calc(100% - 22px), transparent); mask-image: linear-gradient(90deg, #000 calc(100% - 22px), transparent); }   /* (more buttons off to the right) */
body.touch #selBtns::-webkit-scrollbar { display: none; }
body.touch #selBtns button { flex: none; touch-action: pan-x; }
/* Landscape, touch: a compact panel (about 36 px): the count and health on one small line, shorter buttons. */
@media (orientation: landscape) {
  /* Flush against the top strip and the left edge (owner, 2026-12-01). Above the top strip's layer, so the Options tab's
     larger touch area (which reaches below the strip) does not take taps meant for these buttons. */
  body.touch #selbar {
    top: var(--ts); left: 0; padding: 2px 2px 2px calc(var(--safe-l) + 6px); gap: 4px; z-index: 8;
    border-top: 0; border-left: 0; max-width: var(--gw);
  }
  body.touch #placebar { top: var(--ts); z-index: 8; border-top: 0; padding: 2px 2px 2px 8px; }   /* (placing, guard, rally: flush too) */
  body.touch #placebar button { min-height: 28px; font-size: 11px; padding: 0 8px; }
  body.touch #placeText { font-size: 13px; }
  body.touch #eva { top: calc(var(--ts) + 40px); font-size: 14px; letter-spacing: 0.03em; padding: 0 8px; }   /* (below the panel; small, owner 2026-12-01) */
  body.touch .sel-info { flex-direction: row; align-items: center; gap: 6px; max-width: 150px; padding: 0; }
  body.touch #selName { font-size: 12px; }
  body.touch .sel-info .bar { width: 44px; flex: none; }
  body.touch #selBtns { gap: 3px; }
  body.touch #selBtns button { min-height: 28px; min-width: 36px; padding: 0 7px; font-size: 11px; }
}
.icon[aria-pressed="true"] { color: #fff; background: linear-gradient(180deg, var(--accent), #262829); }
.icon[aria-pressed="true"] small { color: #fff; }

.sb-strips {
  grid-area: strips; min-height: 0;
  display: grid; gap: 3px; grid-template-columns: 10px minmax(0, 1fr) minmax(0, 1fr);
}
.power { position: relative; background: #000; border: 1px solid var(--metal-lo); }
.power i { position: absolute; left: 1px; right: 1px; bottom: 1px; height: calc(var(--p, 0) * (100% - 2px)); background: linear-gradient(90deg, #2c9a33, #5ee060); }
.power b { position: absolute; left: -2px; right: -2px; height: 2px; bottom: calc(var(--d, 0) * 100%); background: #e04030; }
.power[data-state="warn"] i { background: linear-gradient(90deg, #a07a12, #e9c33a); }
.power[data-state="low"] i { background: linear-gradient(90deg, #8a1e14, #e0432f); animation: blink 0.8s steps(2) infinite; }
.strip {
  min-height: 0; overflow-y: auto; overflow-x: hidden; touch-action: pan-y; scrollbar-width: none;
  display: grid; grid-auto-rows: var(--cam-h); gap: 3px; align-content: start;
  background: #000; padding: 1px;
}
.strip::-webkit-scrollbar { display: none; }
.strip .empty { margin: 6px 2px; color: #7d8176; font-size: 12px; line-height: 1.15; text-align: center; }
.cameo {
  position: relative; padding: 0; overflow: hidden; touch-action: pan-y;
  background: #000; border: 1px solid #000; box-shadow: inset 0 0 0 1px #3a3c3e;
}
.cameo img { position: absolute; inset: 0; display: block; width: 100%; height: 100%; object-fit: cover; image-rendering: pixelated; }
.cameo .nm {
  position: absolute; left: 0; right: 0; bottom: 0; padding: 0 2px; text-align: center;
  font-size: 10px; font-weight: 700; letter-spacing: 0; text-transform: uppercase; line-height: 12px;
  color: #f0efe6; background: linear-gradient(180deg, transparent, rgba(0,0,0,0.75) 30%);
  text-shadow: 1px 1px 0 #000; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.cameo .cost { position: absolute; top: 1px; right: 2px; font-size: 10px; font-weight: 700; color: #e9d27a; text-shadow: 1px 1px 0 #000, -1px 0 0 #000; }
.cameo .clock {
  position: absolute; inset: 0; pointer-events: none;
  background: conic-gradient(transparent 0turn calc(var(--p, 0) * 1turn), rgba(0,0,0,0.6) calc(var(--p, 0) * 1turn) 1turn);
}
.cameo .st {
  position: absolute; left: 0; right: 0; top: 32%; text-align: center;
  font-size: 13px; font-weight: 700; font-style: italic; letter-spacing: 0.04em; color: #fff;
  text-shadow: 1px 1px 0 #000, -1px -1px 0 #000, 1px -1px 0 #000, -1px 1px 0 #000;
}
.cameo.ready .st { color: #fff; animation: blink 0.8s steps(2) infinite; }
.cameo.hold .st { color: var(--amber); }
.cameo .ct { position: absolute; left: 3px; top: 1px; font-size: 13px; font-weight: 700; color: #fff; text-shadow: 1px 1px 0 #000; }
.cameo.dim img { filter: grayscale(0.85) brightness(0.5); }
.cameo:active img { filter: brightness(1.35); }
.sb-arrows { grid-area: arrows; display: grid; grid-template-columns: repeat(4, 1fr); gap: 3px; padding-left: 13px; }
.sb-arrows button { min-height: 26px; padding: 0; font-size: 11px; color: #c9c19a; }

/* ---------- Overlays on the battlefield ---------- */
#eva {
  position: fixed; z-index: 6; top: calc(var(--ts) + 8px);
  left: calc(var(--gw) / 2); transform: translateX(-50%);
  width: max-content; max-width: calc(var(--gw) - 24px); text-align: center;
  padding: 1px 10px; font-family: var(--font-term); font-size: 22px; color: var(--green); letter-spacing: 0.06em; text-transform: uppercase;
  background: rgba(0,0,0,0.55); text-shadow: 0 0 6px rgba(89,224,90,0.6);
  pointer-events: none;
}
#eva.show { animation: eva 2.4s steps(1) forwards; }
@keyframes eva { 0%, 12%, 24% { opacity: 1; } 6%, 18% { opacity: 0.25; } 85% { opacity: 1; } 100% { opacity: 0; } }

#selbar {
  position: fixed; z-index: 6;
  top: calc(var(--ts) + 40px); left: calc(var(--safe-l) + 8px);
  max-width: min(calc(var(--gw) - 16px - var(--safe-l)), 440px);
  padding: 4px; display: flex; flex-wrap: wrap; align-items: center; gap: 5px;
}
.sel-info { display: flex; flex-direction: column; gap: 3px; padding: 0 4px; min-width: 0; max-width: 150px; }
#selName { font-size: 14px; font-weight: 700; letter-spacing: 0.03em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: #fff; }
.bar { display: block; width: 90px; height: 6px; background: #000; border: 1px solid #000; position: relative; }
.bar::after { content: ''; position: absolute; inset: 0 auto 0 0; width: calc(var(--p, 1) * 100%); background: #3ed04a; }
.bar[data-state="warn"]::after { background: #e8d23a; }
.bar[data-state="low"]::after { background: var(--red); }
#selBtns { display: flex; gap: 4px; flex-wrap: wrap; }
#selBtns button { min-width: 44px; min-height: 34px; padding: 0 8px; font-weight: 700; font-size: 13px; letter-spacing: 0.05em; }
#selBtns button[aria-pressed="true"] { color: var(--green); }

#placebar {
  position: fixed; z-index: 6;
  top: calc(var(--ts) + 40px); left: calc(var(--gw) / 2); transform: translateX(-50%);
  width: max-content; max-width: calc(var(--gw) - 16px);
  padding: 4px 4px 4px 10px; display: flex; align-items: center; gap: 5px; flex-wrap: wrap; justify-content: center;
}
#placeText { color: var(--amber); font-weight: 700; }
#placebar button { min-height: 34px; padding: 0 10px; font-weight: 700; font-size: 13px; letter-spacing: 0.05em; }
#placeOk:disabled { opacity: 0.4; }

/* ---------- Menu ---------- */
/* The main menu (2026-11-24): a screen of its own with a title on the left and a column of command buttons on the
   right. Original art in CSS only: a dark command-room backdrop with a map grid, a radar sweep and scan lines. Opened
   in a battle (data-mode="pause") it lets the battle show through, dimmed. */
#menu {
  position: fixed; inset: 0; z-index: 20; overflow-y: auto; -webkit-overflow-scrolling: touch;
  padding: calc(var(--safe-t) + 14px) max(14px, var(--safe-r)) calc(var(--safe-b) + 14px) max(14px, var(--safe-l));
  background: #070505;
}
#menu[data-mode="pause"] { background: rgba(4, 3, 3, 0.82); }
.mm-bg { position: fixed; inset: 0; overflow: hidden; pointer-events: none;
  background:
    radial-gradient(ellipse 70% 60% at 28% 45%, rgba(150, 24, 16, 0.42), transparent 70%),
    radial-gradient(ellipse 60% 50% at 85% 100%, rgba(233, 185, 58, 0.10), transparent 70%),
    linear-gradient(180deg, #120807 0%, #050404 60%, #0b0605 100%);
}
#menu[data-mode="pause"] .mm-bg { opacity: 0.55; }
.mm-grid { position: absolute; inset: -2px;
  background:
    linear-gradient(rgba(233, 185, 58, 0.06) 1px, transparent 1px) 0 0 / 48px 48px,
    linear-gradient(90deg, rgba(233, 185, 58, 0.06) 1px, transparent 1px) 0 0 / 48px 48px;
  -webkit-mask-image: radial-gradient(ellipse at 30% 50%, #000 30%, transparent 75%); mask-image: radial-gradient(ellipse at 30% 50%, #000 30%, transparent 75%);
}
.mm-radar { position: absolute; left: 28%; top: 48%; width: min(90vmin, 720px); aspect-ratio: 1; transform: translate(-50%, -50%); border-radius: 50%;
  border: 1px solid rgba(224, 67, 47, 0.35);
  background:
    radial-gradient(circle, transparent 0 24%, rgba(224, 67, 47, 0.22) 24.2% 24.6%, transparent 24.8% 49%, rgba(224, 67, 47, 0.22) 49.2% 49.6%, transparent 49.8% 74%, rgba(224, 67, 47, 0.18) 74.2% 74.6%, transparent 74.8%),
    linear-gradient(transparent calc(50% - 0.5px), rgba(224, 67, 47, 0.2) 0 calc(50% + 0.5px), transparent 0),
    linear-gradient(90deg, transparent calc(50% - 0.5px), rgba(224, 67, 47, 0.2) 0 calc(50% + 0.5px), transparent 0);
}
.mm-radar i { position: absolute; inset: 0; border-radius: 50%; background: conic-gradient(from 0deg, rgba(224, 67, 47, 0.38), rgba(224, 67, 47, 0) 70deg, transparent 360deg); animation: mm-sweep 6s linear infinite; }
@keyframes mm-sweep { to { transform: rotate(360deg); } }
.mm-scan { position: absolute; inset: 0; background: repeating-linear-gradient(0deg, rgba(0, 0, 0, 0.28) 0 1px, transparent 1px 3px); }
@media (prefers-reduced-motion: reduce) { .mm-radar i { animation: none; } }
#menu[data-mode="pause"] .mm-radar { display: none; }

.mm-wrap { position: relative; min-height: 100%; width: min(980px, 100%); margin: 0 auto;
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(260px, 360px); gap: 18px 28px; align-items: center; }
.mm-head { display: flex; flex-direction: column; gap: 8px; align-self: center; }
#menuTitle {
  margin: 0; font-family: var(--font-stencil); font-weight: 400; text-transform: uppercase;
  font-size: clamp(40px, 9vw, 92px); line-height: 0.9; letter-spacing: 0.02em; text-wrap: balance;
  color: #f0e6cf; background: linear-gradient(180deg, #fff4da 0%, #e2cfa0 48%, #b23022 52%, #7a1610 100%);
  -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
  filter: drop-shadow(3px 3px 0 #000) drop-shadow(0 0 18px rgba(224, 67, 47, 0.35));
}
#menuSub { margin: 0; font-family: var(--font-term); font-size: 22px; color: var(--green); letter-spacing: 0.04em; }
#menuSub::after { content: '_'; animation: blink 1.1s step-end infinite; }
.mm-head .version-tag { text-align: left; }
.mm-head .update-btn { align-self: flex-start; padding: 0 14px; }

/* The button column: a metal panel, one bevelled plate per command, a red light that comes on beside the one touched. */
.mm-col { width: 100%; padding: 12px; border: 2px solid; display: flex; flex-direction: column; gap: 7px; box-shadow: 0 20px 60px rgba(0, 0, 0, 0.75), inset 0 0 0 1px rgba(0, 0, 0, 0.6); }
#menu .mm-col { background: linear-gradient(180deg, #2c2e30, #1c1d1f 60%, #141516); border-color: #5c5f62 #0c0d0e #0c0d0e #5c5f62; }
#menu:not([data-view="main"]) [data-panel="main"], #menu:not([data-view="options"]) [data-panel="options"], #menu:not([data-view="info"]) [data-panel="info"] { display: none; }
.mm-btn {
  position: relative; min-height: 50px; padding: 6px 14px 6px 30px; text-align: left;
  font-family: var(--font-stencil); font-size: clamp(17px, 4.4vw, 22px); letter-spacing: 0.06em; text-transform: uppercase; white-space: nowrap;
  color: #e9e3cf; background: linear-gradient(180deg, #4d5154 0%, #34373a 48%, #26282a 52%, #2f3234 100%);
  border: 2px solid; border-color: #7b7f83 #101112 #101112 #7b7f83; text-shadow: 1px 1px 0 #000;
}
.mm-btn::before { content: ''; position: absolute; left: 10px; top: 50%; width: 9px; height: 9px; margin-top: -5px; border-radius: 50%;
  background: #3a0d09; box-shadow: inset 0 1px 2px #000; }
.mm-btn:hover::before, .mm-btn:active::before, .mm-btn:focus-visible::before { background: #ff4a33; box-shadow: 0 0 8px 2px rgba(255, 74, 51, 0.7); }
.mm-btn:active { border-color: #101112 #7b7f83 #7b7f83 #101112; background: linear-gradient(180deg, #24262a, #34373a); }
.mm-btn:hover { color: #fff; }
.mm-btn:disabled { filter: grayscale(0.6); opacity: 0.7; }
.mm-btn.mm-go { color: #fff3cf; background: linear-gradient(180deg, #a2731a 0%, #7d5410 48%, #5f3e09 52%, #70490c 100%); border-color: #e2b552 #2a1b03 #2a1b03 #e2b552; }
.mm-btn.mm-red { color: #f6dcd6; background: linear-gradient(180deg, #8a2f26 0%, #64201a 48%, #4a1612 52%, #5a1b16 100%); border-color: #c0574a #200806 #200806 #c0574a; }
.mm-btn.mm-small { min-height: 40px; font-size: clamp(14px, 3.8vw, 17px); }
.mm-btn[aria-pressed="true"] { color: var(--amber); }
.mm-sub { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.mm-sub .mm-btn { height: auto; padding-left: 22px; padding-right: 6px; font-size: clamp(13px, 3.4vw, 15px); white-space: nowrap; line-height: 1.05; }
.mm-sub .mm-btn::before { left: 8px; width: 7px; height: 7px; margin-top: -4px; }
.mm-rule { height: 2px; margin: 4px 2px; background: linear-gradient(90deg, transparent, #e0432f, transparent); opacity: 0.6; }
.mm-ptitle { margin: 0 0 2px; font-family: var(--font-stencil); font-weight: 400; font-size: 22px; text-transform: uppercase; color: var(--amber); letter-spacing: 0.06em; }
.mm-panel { max-height: none; }
.mm-back { margin-top: 4px; }
.mm-col .continue-btn small { display: block; margin-top: 2px; font-family: var(--font-ui); font-size: 13px; letter-spacing: 0.02em; text-transform: none; opacity: 0.85; }
.mm-col .manual-btn.has-news { position: relative; }
/* Narrow or portrait screens: the title above the column. */
@media (max-width: 640px), (orientation: portrait) {
  .mm-wrap { grid-template-columns: minmax(0, 1fr); align-content: center; width: min(460px, 100%); }
  .mm-head { align-items: center; text-align: center; }
  .mm-head .version-tag { text-align: center; }
  .mm-head .update-btn { align-self: stretch; }
  .mm-radar { left: 50%; top: 26%; }
}
/* Short landscape phones: smaller plates so the column fits. */
@media (orientation: landscape) and (max-height: 440px) {
  .mm-btn { min-height: 42px; font-size: 18px; }
  .mm-btn.mm-small { min-height: 34px; font-size: 14px; }
  .mm-col { gap: 5px; padding: 9px; }
  #menuTitle { font-size: clamp(40px, 8vw, 72px); }
  #menuSub { font-size: 19px; }
  #skirmishSetup { display: grid; grid-template-columns: 1.3fr 1fr; gap: 8px; align-items: stretch; }
  #maps .pick.maps .map-img { width: 84px; }
  #maps .pick.maps button { padding: 6px 8px; }
  #maps .map-mode { margin-bottom: 6px; font-size: 16px; }
  #maps .map-setup .pick button { padding: 5px 8px; font-size: 15px; }
  #maps .map-setup .pick button small { display: none; }
  #maps .map-setup .crest { margin-bottom: 2px; height: 12px; }
}

/* The skirmish screen in the same dark steel: battle tabs along the top, side and difficulty, the maps for that battle. */
#maps .mm-book { background: #1c1d1f; border-color: #5c5f62 #0c0d0e #0c0d0e #5c5f62; }
#maps .fm-top, #maps .fm-foot { background: linear-gradient(180deg, #2c2e30, #1a1b1c); border-color: #0c0d0e; }
#maps .fm-brand { font-size: 18px; }
#maps .mm-tabs { justify-content: center; }
#maps .mm-tabs button { min-height: 38px; min-width: 76px; padding: 0 14px; font-family: var(--font-stencil); font-weight: 400; font-size: 17px; letter-spacing: 0.05em;
  color: #c9c4ad; background: linear-gradient(180deg, #3a3d40, #232527); border-color: #6a6d70 #101112 #101112 #6a6d70; }
#maps .mm-tabs button[aria-current="true"] { color: #fff3cf; background: linear-gradient(180deg, #a2731a, #5f3e09); border-color: var(--amber); }
#maps .mm-page { color: var(--ink); background: radial-gradient(ellipse at 50% 0%, rgba(150, 24, 16, 0.22), transparent 60%), #111213; box-shadow: inset 0 0 40px rgba(0, 0, 0, 0.6); }
#maps .map-setup { margin-bottom: 12px; }
#skirmishSetup { display: grid; gap: 8px; }
#maps .map-mode { margin: 0 0 8px; font-family: var(--font-stencil); font-weight: 400; font-size: 18px; text-transform: uppercase; color: var(--amber); letter-spacing: 0.04em; }
#maps .map-btns { flex-wrap: wrap; justify-content: center; }
#maps .map-btns .mm-btn { flex: 1 1 14em; text-align: center; padding-left: 30px; }
.map-size { margin-left: 6px; padding: 1px 6px; font-style: normal; font-size: 12px; letter-spacing: 0.05em; text-transform: uppercase; vertical-align: middle;
  color: #1b1405; background: var(--amber); border-radius: 2px; white-space: nowrap; }
.pick { display: grid; gap: 6px; }
.sides { grid-template-columns: 1fr 1fr; }
.diff { grid-template-columns: repeat(3, 1fr); }
.pick button {
  padding: 8px; text-align: left; display: flex; flex-direction: column; gap: 2px;
  background: var(--well); color: #aeb3a5; font-size: 18px; font-weight: 700;
  border: 2px solid; border-color: var(--metal-lo) var(--metal-hi) var(--metal-hi) var(--metal-lo);
}
.diff button { text-align: center; align-items: center; font-size: 16px; padding: 7px; }
.pick button small { font-size: 13px; font-weight: 600; line-height: 1.15; color: #8d9286; }
.pick button[aria-pressed="true"] { color: #fff; border-color: var(--amber); box-shadow: inset 0 0 0 1px var(--amber); }
.crest { width: 28px; height: 18px; margin-bottom: 4px; border: 1px solid #000; }
.sides button[data-faction="allies"] .crest { background: linear-gradient(180deg, #97b4da, #36547c); }
.sides button[data-faction="soviets"] .crest { background: linear-gradient(180deg, #dd6c5c, #781d18); }
.buttons { display: flex; flex-wrap: wrap; gap: 6px; }
.buttons .continue-btn { flex: 1 1 100%; height: auto; min-height: 48px; padding-top: 6px; padding-bottom: 6px; }
.continue-btn small { display: block; margin-top: 2px; font-size: 0.55em; letter-spacing: 0.04em; opacity: 0.85; }
.primary {
  flex: 1; height: 48px; font-family: var(--font-stencil); font-size: clamp(16px, 4.6vw, 22px); letter-spacing: 0.04em; text-transform: uppercase; white-space: nowrap;
  color: #1b1405; background: linear-gradient(180deg, #f0c64c, #b8871c);
  border: 2px solid; border-color: #ffe08a #5e4208 #5e4208 #ffe08a;
}
.primary.alt { color: #06210a; background: linear-gradient(180deg, #7fe07a, #2f9a35); border-color: #b9f5b2 #0f4413 #0f4413 #b9f5b2; }
.primary:disabled { filter: grayscale(0.6); }
.audio { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.audio button {
  min-height: 36px; padding: 4px; font-weight: 700; font-size: 14px; color: #8d9286;
  background: var(--well); border: 2px solid; border-color: var(--metal-lo) var(--metal-hi) var(--metal-hi) var(--metal-lo);
}
.audio button[aria-pressed="true"] { color: #fff; border-color: var(--amber); }
.audio button[aria-pressed="true"]::before { content: '● '; color: var(--green); }
.audio .vol { grid-column: 1 / -1; display: grid; grid-template-columns: 11em 1fr; align-items: center; gap: 8px; font-size: 14px; font-weight: 700; color: var(--ink); }
.audio .vol input { width: 100%; min-width: 0; height: 32px; margin: 0; accent-color: var(--amber); touch-action: pan-y; }
.audio .track { grid-column: 1 / -1; color: var(--ink); }
.audio .track span { color: var(--amber); }
.quit-btn {
  height: 40px; font-family: var(--font-stencil); font-size: 16px; letter-spacing: 0.06em; text-transform: uppercase;
  color: #f1d9d4; background: linear-gradient(180deg, #7a2a22, #4a1612); border: 2px solid; border-color: #b0493c #200806 #200806 #b0493c;
}
.update-btn {
  height: 44px; font-weight: 700; font-size: 16px; color: #06210a;
  background: linear-gradient(180deg, #7fe07a, #2f9a35); border: 2px solid; border-color: #b9f5b2 #0f4413 #0f4413 #b9f5b2;
  animation: blink 1.2s step-end infinite;
}
.version-tag { margin: 0; font-size: 12px; color: #8d9286; text-align: center; }
.version-new { margin-top: 2px; padding: 0; border: 0; background: none; font: inherit; font-size: 13px; color: #d9c27a; text-decoration: underline; text-underline-offset: 2px; cursor: pointer; }
/* What's New with unread notes: a NEW badge and a slow glow, until they are opened */
.manual-btn.has-news { position: relative; animation: news-glow 1.8s ease-in-out infinite; }
.manual-btn.has-news::after {
  content: 'NEW'; position: absolute; top: -8px; right: -5px; padding: 1px 5px;
  font-family: var(--font-stencil); font-size: 11px; letter-spacing: 0.05em; color: #fff;
  background: #c0352a; border: 1px solid #ff8a7a; border-radius: 3px; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
}
@keyframes news-glow { 0%, 100% { box-shadow: 0 0 0 0 rgba(231, 196, 92, 0); } 50% { box-shadow: 0 0 10px 2px rgba(231, 196, 92, 0.75); } }
@media (prefers-reduced-motion: reduce) { .manual-btn.has-news { animation: none; box-shadow: 0 0 8px 2px rgba(231, 196, 92, 0.6); } }
.book-btns { display: flex; flex-wrap: wrap; gap: 6px; }   /* three across when there is room, else wrapped onto two rows */
.book-btns .manual-btn { flex: 1 1 8em; min-width: 0; font-size: clamp(14px, 4.2vw, 18px); white-space: nowrap; }
.fm-release { margin: 0 0 18px; }
.fm-release h3 { margin: 0; font-family: var(--font-stencil); font-weight: 400; font-size: 20px; text-transform: uppercase; color: #22201a; }
.fm-release .fm-when { margin: 2px 0 6px; font-family: 'Courier New', monospace; font-size: 13px; color: #6b5a3a; }
.fm-release .fm-when b { color: #a3261c; }
.fm-release ul { margin: 4px 0 8px; padding-left: 20px; display: flex; flex-direction: column; gap: 5px; }
.audio-status { grid-column: 1 / -1; margin: 0; font-size: 13px; color: #8d9286; text-align: center; }
.credits p { margin: 8px 0 0; font-size: 13px; line-height: 1.4; color: #aeb3a5; -webkit-user-select: text; user-select: text; }
.how summary { cursor: pointer; color: var(--amber); font-size: 16px; font-weight: 700; }
.how ul { margin: 8px 0 0; padding-left: 18px; display: flex; flex-direction: column; gap: 5px; font-size: 15px; line-height: 1.3; }

/* ---------- Field Manual ---------- */
.manual-btn {
  height: 40px; font-family: var(--font-stencil); font-size: 18px; letter-spacing: 0.06em; text-transform: uppercase;
  color: #e6e1cf; background: linear-gradient(180deg, #4c5530, #2f3520);
  border: 2px solid; border-color: #7d8a4c #171b0c #171b0c #7d8a4c;
}
#manual, #news, #board, #profile, #online, #maps {
  /* minmax(0, 1fr): the column must not grow to fit the tab strip, or the book runs off a narrow screen. */
  position: fixed; inset: 0; z-index: 30; display: grid; place-items: center; grid-template-columns: minmax(0, 1fr);
  padding: calc(var(--safe-t) + 10px) max(10px, var(--safe-r)) calc(var(--safe-b) + 10px) max(10px, var(--safe-l));
  background: rgba(0,0,0,0.78);
}
.fm-book {
  width: min(820px, 100%); height: min(720px, calc(100vh - 20px)); height: min(720px, calc(100dvh - var(--safe-t) - var(--safe-b) - 20px));
  display: flex; flex-direction: column; min-height: 0;
  background: #2b2f22; border: 2px solid; border-color: #6c7444 #13160b #13160b #6c7444; box-shadow: 0 20px 60px rgba(0,0,0,0.8);
}
.fm-top { display: flex; align-items: center; gap: 8px; padding: 6px 8px; background: #20241a; border-bottom: 2px solid #13160b; }
.fm-brand { font-family: var(--font-stencil); color: var(--amber); letter-spacing: 0.08em; text-transform: uppercase; white-space: nowrap; }
.fm-tabs { flex: 1; display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none; }
.fm-tabs::-webkit-scrollbar { display: none; }
.fm-tabs button, .fm-foot button, .fm-close {
  flex: none; min-height: 32px; padding: 0 10px; font-weight: 700; font-size: 14px; color: #c9c4ad;
  background: #14170e; border: 2px solid; border-color: #13160b #59603a #59603a #13160b;
}
.fm-tabs button[aria-current="true"] { color: #fff; border-color: var(--amber); }
.fm-close { min-width: 36px; font-size: 16px; }
.fm-page {
  flex: 1; min-height: 0; overflow-y: auto; padding: 18px clamp(14px, 4vw, 34px) 24px; -webkit-overflow-scrolling: touch;
  color: #2b261c; font-size: 15.5px; line-height: 1.45; -webkit-user-select: text; user-select: text;
  background:
    radial-gradient(ellipse at 20% 10%, rgba(255,255,255,0.35), transparent 60%),
    radial-gradient(ellipse at 90% 100%, rgba(120,90,40,0.18), transparent 55%),
    repeating-linear-gradient(0deg, rgba(90,70,40,0.035) 0 1px, transparent 1px 3px),
    #e8e0c8;
  box-shadow: inset 0 0 40px rgba(90,65,25,0.35);
}
.fm-page h2 { margin: 0 0 12px; font-family: var(--font-stencil); font-weight: 400; font-size: clamp(24px, 5vw, 32px); text-transform: uppercase; color: #2b2a1c; border-bottom: 3px double #6b5a3a; padding-bottom: 6px; }
.fm-page h4 { margin: 16px 0 2px; font-family: var(--font-stencil); font-weight: 400; font-size: 18px; text-transform: uppercase; color: #5a3b18; }
.fm-page p { margin: 6px 0; }
.fm-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 6px 8px calc(6px + var(--safe-b) * 0); background: #20241a; border-top: 2px solid #13160b; }
.fm-foot button { min-width: 96px; }
.fm-foot button:disabled { opacity: 0.35; }
.fm-num { font-family: var(--font-term); font-size: 22px; color: var(--green); }
.fm-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 330px), 1fr)); gap: 14px; }
.fm-entry { padding: 10px 12px; background: rgba(255,250,235,0.55); border: 1px solid #b9ab86; box-shadow: 2px 2px 0 rgba(80,60,30,0.25); }
.fm-head { display: flex; gap: 10px; align-items: center; }
.fm-head h3 { margin: 0; font-family: var(--font-stencil); font-weight: 400; font-size: 19px; text-transform: uppercase; color: #22201a; line-height: 1.05; }
.fm-pic { width: 96px; height: 72px; flex: none; image-rendering: pixelated; border: 2px solid #3d3a2c; background: #262c16; }
.fm-side { display: inline-block; margin-top: 4px; padding: 1px 7px; font-size: 12px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: #fff; }
.fm-side.allies { background: #36547c; } .fm-side.soviets { background: #8a2620; } .fm-side.both { background: #5a5a3a; } .fm-side.none { background: #6b5a3a; }
.fm-stats { margin: 8px 0 4px; display: grid; grid-template-columns: auto 1fr; gap: 1px 10px; font-family: 'Courier New', Courier, monospace; font-size: 13.5px; }
.fm-stats dt { color: #6b5a3a; font-weight: 700; text-transform: uppercase; }
.fm-stats dd { margin: 0; color: #22201a; }
.fm-vs { font-size: 14px; }
.fm-vs b { color: #5a3b18; }
.fm-table { width: 100%; border-collapse: collapse; font-size: 14.5px; }
.fm-table th, .fm-table td { padding: 6px 8px; border: 1px solid #b9ab86; text-align: left; vertical-align: top; }
.fm-table th { font-family: var(--font-stencil); font-weight: 400; text-transform: uppercase; background: rgba(90,70,40,0.12); }
.fm-table td:first-child { font-weight: 700; color: #5a3b18; white-space: nowrap; }
.fm-cover { text-align: center; padding: 10px 0; }
.fm-cover h2 { border: 0; font-size: clamp(38px, 10vw, 64px); margin: 6px 0 0; }
.fm-sub { font-size: 18px; font-style: italic; color: #4a3d28; }
.fm-stamp { display: inline-block; margin: 0; padding: 2px 12px; border: 3px solid #a3261c; color: #a3261c; font-family: var(--font-stencil); letter-spacing: 0.2em; text-transform: uppercase; transform: rotate(-4deg); }
.fm-toc { max-width: 420px; margin: 18px auto 0; padding: 0; list-style: none; text-align: left; counter-reset: ch; }
.fm-toc li { display: flex; align-items: baseline; gap: 6px; border-bottom: 1px dotted #8b7a55; padding: 4px 0; }
.fm-toc li::before { counter-increment: ch; content: counter(ch) '.'; font-family: var(--font-stencil); color: #6b5a3a; width: 1.6em; }
.fm-toc button { flex: 1; text-align: left; padding: 0; background: none; border: 0; font-family: var(--font-stencil); font-size: 18px; text-transform: uppercase; color: #22201a; }
.fm-toc span { font-family: 'Courier New', monospace; color: #6b5a3a; }
.fm-tips { padding-left: 20px; display: flex; flex-direction: column; gap: 7px; }
.fm-page h2:empty { display: none; }
/* Short landscape phones: a tighter booklet. */
@media (max-height: 500px) {
  .fm-top, .fm-foot { padding: 3px 6px; }
  .fm-tabs button, .fm-foot button, .fm-close { min-height: 28px; font-size: 13px; padding: 0 8px; }
  .fm-page { padding: 10px 14px 16px; font-size: 14.5px; }
  .fm-page h2 { font-size: 22px; margin-bottom: 8px; }
  .fm-cover h2 { font-size: 40px; }
  .fm-num { font-size: 18px; }
  .fm-pic { width: 80px; height: 60px; }
}
/* Leaderboard: the What's New paper with a ruled table. */
.lb-intro { font-style: italic; color: #4a3d28; }
/* Profile: sign-in forms and the service record */
.pf-form { margin: 10px 0; }
.pf-form label { display: block; margin-bottom: 4px; font-family: var(--font-stencil); font-size: 15px; text-transform: uppercase; color: #5a3b18; }
.pf-row { display: flex; gap: 6px; }
.pf-row input { flex: 1; min-width: 0; height: 40px; padding: 0 10px; font: inherit; font-size: 16px; color: #22201a; background: rgba(255,250,235,0.85); border: 2px solid #8b7a55; border-radius: 0; }
.pf-row input:focus { outline: none; border-color: #a3261c; }
.pf-row button, .pf-btn { height: 40px; padding: 0 14px; font-family: var(--font-stencil); font-size: 15px; text-transform: uppercase; color: #f1ead4; background: #4c5530; border: 2px solid; border-color: #7d8a4c #171b0c #171b0c #7d8a4c; cursor: pointer; }
.pf-row button:disabled { opacity: 0.5; }
.pf-msg { min-height: 1.2em; margin: 4px 0 0; font-size: 14px; color: #8a2b1c; }
.pf-small { font-size: 13px; color: #6b5a3a; }
.on-btns { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 12px 0; }
.on-btns .on-go { background: #8a2b1c; border-color: #c4523e #3d0f08 #3d0f08 #c4523e; }
.on-code { margin: 10px 0; font-family: var(--font-stencil); font-size: 44px; letter-spacing: 0.3em; color: #8a2b1c; text-align: center; }
.on-error { padding: 8px 10px; color: #8a2b1c; border: 2px solid #8a2b1c; }
.on-lobby { width: 100%; border-collapse: collapse; margin: 10px 0; }
.on-lobby th, .on-lobby td { padding: 6px 8px; text-align: left; border-bottom: 1px solid #b9a77c; }
.on-lobby th { font-family: var(--font-stencil); text-transform: uppercase; color: #5a3b18; width: 5em; }
.on-side { font-family: var(--font-stencil); text-transform: uppercase; }
.on-side[data-faction="allies"] { color: #2a4d8a; }
.on-side[data-faction="soviets"] { color: #8a2b1c; }
.on-modes { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; margin: 8px 0; }
.on-modes .pf-btn { flex: 1 1 auto; min-width: 0; }
.on-modes .pf-btn[disabled] { opacity: 0.55; }
.on-modes .pf-btn[disabled].on-go { opacity: 0.9; }
.on-teams { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
@media (max-width: 420px) { .on-teams { grid-template-columns: 1fr; } }
.on-teams .on-lobby { margin: 4px 0; }
.on-saves { list-style: none; padding: 0; margin: 6px 0 10px; }
.on-saves li { padding: 6px 0; border-bottom: 1px solid rgba(0,0,0,0.12); line-height: 1.35; }
.on-saves li .pf-btn { float: right; margin-left: 8px; }
.on-prog { position: relative; height: 14px; margin-top: 4px; background: #d8cba6; border: 1px solid #b9a77c; border-radius: 2px; overflow: hidden; }
.on-prog i { position: absolute; left: 0; top: 0; bottom: 0; background: #c08a2e; transition: width 0.3s; }
.on-prog.on-prog-done i { background: #5f8a3a; }
.on-prog small { position: relative; display: block; font-size: 10px; line-height: 14px; padding-left: 4px; color: #2b1d0c; }
.on-lobby caption { font-family: var(--font-stencil); text-transform: uppercase; color: #5a3b18; text-align: left; padding: 2px 8px; }
.on-lobby tr.on-you td:first-child { font-weight: bold; }
.on-modes .on-go { background: #8a2b1c; border-color: #c4523e #3d0f08 #3d0f08 #c4523e; }
.on-side .pf-btn { padding: 3px 10px; font: inherit; color: inherit; background: rgba(255,255,255,0.35); border: 2px solid currentColor; box-shadow: none; }
.on-side .pf-btn::after { content: ' ⇄'; }
#netHud { position: fixed; top: calc(env(safe-area-inset-top, 0px) + 6px); left: 50%; transform: translateX(-50%); z-index: 20; padding: 2px 10px; font-size: 13px; color: #e8e2cc; background: rgba(0,0,0,0.55); border-radius: 3px; pointer-events: none; white-space: nowrap; }
#netHud.slow { color: #ffb44a; }
#netWait { position: fixed; inset: 0; z-index: 30; display: flex; align-items: center; justify-content: center; padding: 16px; background: rgba(0,0,0,0.55); }
#netWait[hidden] { display: none; }
.nw-card { max-width: 420px; padding: 16px 18px; color: #22201a; background: #ece3c8; border: 2px solid #5a4a2a; text-align: center; }
.nw-title { margin: 0 0 6px; font-family: var(--font-stencil); font-size: 20px; text-transform: uppercase; color: #5a3b18; }
.nw-sub { margin: 0 0 12px; }
#deploying .nw-card { width: min(280px, 80vw); }
.load-bar { height: 10px; margin: 4px 0 2px; background: #cfc3a0; border: 1px solid #5a4a2a; overflow: hidden; }
.load-bar i { display: block; height: 100%; width: 0; background: #5a3b18; transition: width 0.2s linear; }
.pf-links { font-size: 14px; }
.pf-link { padding: 0; font: inherit; color: #5a3b18; text-decoration: underline; background: none; border: 0; cursor: pointer; }
.pf-who { display: flex; flex-direction: column; margin: 0 0 12px; }
.pf-name { font-family: var(--font-stencil); font-size: clamp(22px, 6vw, 30px); text-transform: uppercase; color: #22201a; overflow-wrap: anywhere; }
.pf-since { font-size: 13px; color: #6b5a3a; overflow-wrap: anywhere; }
.pf-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(9.5em, 1fr)); gap: 8px; }
.pf-stat { display: flex; flex-direction: column; padding: 10px 12px; background: rgba(255,250,235,0.55); border: 1px solid #8b7a55; }
.pf-k { font-family: var(--font-stencil); font-size: 13px; text-transform: uppercase; color: #6b5a3a; }
.pf-v { font-family: 'Courier New', Courier, monospace; font-size: clamp(22px, 6vw, 28px); font-weight: 700; color: #22201a; font-variant-numeric: tabular-nums; }
.pf-when { font-size: 12px; color: #6b5a3a; }
.pf-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; padding-top: 10px; border-top: 1px solid #b4a27a; }
.pf-actions .pf-msg { flex-basis: 100%; }
.pf-danger { background: #6e2219; border-color: #a4473a #2c0b07 #2c0b07 #a4473a; }
.lb-note { padding: 14px 0; color: #4a3d28; }
.lb-retry { margin-left: 6px; padding: 2px 10px; font-weight: 700; color: #2b261c; background: rgba(255,250,235,0.7); border: 1px solid #8b7a55; }
.lb-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.lb-table td, .lb-table th { white-space: nowrap; }
.lb-table td:nth-child(2) { white-space: normal; overflow-wrap: anywhere; min-width: 7em; font-weight: 700; }
.lb-table .lb-time, .lb-table .lb-score { font-family: 'Courier New', Courier, monospace; font-weight: 700; font-variant-numeric: tabular-nums; }
.lb-table tr.lb-me td { background: rgba(233,185,58,0.28); }
@media (max-width: 520px) {
  .lb-table th:nth-child(5), .lb-table td:nth-child(5) { display: none; }
  .lb-table td, .lb-table th { padding: 5px 5px; font-size: 13.5px; }
  .lb-table th { font-size: 12px; }
}

.fm-end { margin-top: 18px !important; text-align: center; font-family: var(--font-stencil); text-transform: uppercase; color: #6b5a3a; }

@keyframes blink { 50% { opacity: 0.35; } }

/* ---------- Debrief (end of mission) ---------- */
#debrief {
  position: fixed; inset: 0; z-index: 30; overflow-y: auto; -webkit-overflow-scrolling: touch;
  padding: calc(var(--safe-t) + 10px) max(10px, var(--safe-r)) calc(var(--safe-b) + 10px) max(10px, var(--safe-l));
  background: radial-gradient(ellipse at 50% 30%, rgba(42,32,21,0.92), rgba(5,6,5,0.96) 70%);
}
.db-card {
  max-width: 980px; margin: 0 auto; padding: 10px 12px 12px;
  background: linear-gradient(180deg, #3a3d3f, #2b2e2f 40%, #232527);
  border: 2px solid; border-color: var(--metal-hi) var(--metal-lo) var(--metal-lo) var(--metal-hi); box-shadow: 0 20px 60px rgba(0,0,0,0.7);
}
.db-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 10px; }
.db-kick { margin: 0; font-size: 12px; font-weight: 700; letter-spacing: 0.14em; text-transform: uppercase; color: var(--amber); }
#dbTitle { margin: 0; font-family: var(--font-stencil); font-weight: 400; font-size: clamp(24px, 6vw, 36px); text-transform: uppercase; line-height: 1.05; }
#dbTitle.won { color: #d7f7cf; text-shadow: 0 0 12px rgba(89,224,90,0.35); }
#dbTitle.lost { color: #ffb4a8; text-shadow: 0 0 12px rgba(224,67,47,0.35); }
.db-time { font-family: var(--font-term); font-size: 22px; color: var(--green); }
.db-ptabs { display: flex; gap: 4px; margin-top: 8px; }
.db-ptabs button, .db-tabs button {
  min-height: 32px; padding: 0 14px; font-family: var(--font-stencil); font-size: 14px; text-transform: uppercase; color: #aeb3a5;
  background: #14170e; border: 2px solid; border-color: #13160b #59603a #59603a #13160b;
}
.db-ptabs button { min-width: 120px; }
.db-ptabs button[aria-selected="true"], .db-tabs button[aria-pressed="true"] { color: #fff; border-color: var(--amber); background: #1d2017; }
.db-grid { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); gap: 10px; margin-top: 8px; }
.db-grid[data-page="score"] { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.db-grid[hidden] { display: none; }
@media (max-width: 700px) { .db-grid, .db-grid[data-page="score"] { grid-template-columns: minmax(0, 1fr); } }
.db-panel { padding: 8px 10px; background: #1d2017; border: 2px solid; border-color: var(--metal-lo) #4a4f46 #4a4f46 var(--metal-lo); }
.db-ptitle { margin: 0 0 6px; font-family: var(--font-stencil); font-size: 14px; text-transform: uppercase; color: #e6e1cf; }
.db-tabs { display: flex; gap: 4px; margin-bottom: 6px; }
.db-tabs button { flex: 1; font-family: var(--font-ui); font-weight: 700; font-size: 13px; letter-spacing: 0.06em; }
.db-legend { display: flex; gap: 14px; font-size: 13px; color: #aeb3a5; }
.db-legend i, .db-table th i, .db-tip i { display: inline-block; width: 12px; height: 3px; border-radius: 2px; margin-right: 5px; vertical-align: middle; }
.db-chart { position: relative; touch-action: none; }
.db-chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.db-chart text { fill: #7f8577; font-size: 11px; font-family: var(--font-ui); }
.db-grid-line { stroke: #3a3f33; stroke-width: 1; }
.db-xh { stroke: #aeb3a5; stroke-width: 1; }
.db-ring { stroke: #1d2017; stroke-width: 2; }
.db-tip {
  position: absolute; top: 24px; display: none; pointer-events: none; transform: translateX(-50%); white-space: nowrap;
  padding: 4px 7px; font-size: 13px; color: #e6e1cf; background: #0d0f0a; border: 1px solid #59603a;
}
.db-tip b { font-family: var(--font-term); font-size: 17px; font-weight: 400; color: var(--green); }
.db-tipev { color: #aeb3a5; }
.db-note { margin: 6px 0 0; font-size: 12px; color: #7f8577; }
.db-mvp-head { display: flex; gap: 10px; align-items: center; }
.db-mvp-head img { width: 96px; height: 72px; flex: none; image-rendering: pixelated; border: 2px solid #3d3a2c; }
.db-medal { margin: 0; font-size: 11px; font-weight: 700; letter-spacing: 0.14em; text-transform: uppercase; color: var(--amber); }
.db-mvp h3 { margin: 2px 0; font-family: var(--font-stencil); font-weight: 400; font-size: 19px; text-transform: uppercase; line-height: 1.05; color: #e6e1cf; }
.db-call { margin: 0; font-size: 13px; color: #aeb3a5; }
.db-mvpstats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; margin-top: 8px; text-align: center; }
.db-mvpstats b { display: block; font-family: var(--font-term); font-size: 24px; font-weight: 400; line-height: 1; color: var(--green); }
.db-mvpstats span { font-size: 11px; letter-spacing: 0.06em; text-transform: uppercase; color: #7f8577; }
.db-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.db-table th { padding: 2px 4px; font-family: var(--font-stencil); font-weight: 400; font-size: 13px; text-transform: uppercase; text-align: right; color: #aeb3a5; }
.db-table td { padding: 4px; border-top: 1px solid #33372c; text-align: right; font-family: var(--font-term); font-size: 20px; line-height: 1; color: #aeb3a5; }
.db-table td:first-child { text-align: left; font-family: var(--font-ui); font-size: 14px; }
.db-table td.lead { color: #fff; }
.db-bt { display: grid; grid-template-columns: 8em minmax(0, 1fr) 2.4em; align-items: center; gap: 6px; margin: 5px 0; font-size: 13px; color: #aeb3a5; }
.db-bar { height: 10px; border-radius: 0 4px 4px 0; min-width: 2px; }
.db-bt b { font-family: var(--font-term); font-size: 18px; font-weight: 400; text-align: right; color: #e6e1cf; }
.db-buttons { display: flex; gap: 6px; margin-top: 10px; }
.db-buttons button {
  flex: 1; height: 44px; font-family: var(--font-stencil); font-size: 18px; text-transform: uppercase;
  color: #1b1405; background: linear-gradient(180deg, #f0c64c, #b8871c); border: 2px solid; border-color: #ffe08a #5e4208 #5e4208 #ffe08a;
}
.db-buttons .db-rematch { color: #e6e1cf; background: linear-gradient(180deg, #4c5530, #2f3520); border-color: #7d8a4c #171b0c #171b0c #7d8a4c; }
.db-extra { margin-top: 10px; }
.db-name { padding: 8px 10px; background: #1d2017; border: 2px solid; border-color: var(--metal-lo) #4a4f46 #4a4f46 var(--metal-lo); }
.db-name label { display: block; margin-bottom: 4px; font-family: var(--font-stencil); font-size: 14px; text-transform: uppercase; color: var(--amber); }
.db-name-row { display: flex; gap: 6px; }
.db-name input {
  flex: 1; min-width: 0; height: 38px; padding: 0 10px; font: 700 16px var(--font-ui); color: #e6e1cf;
  background: #0d0f0a; border: 2px solid; border-color: #13160b #59603a #59603a #13160b; border-radius: 0;
  -webkit-user-select: text; user-select: text;
}
.db-name input:focus { outline: none; border-color: var(--amber); }
.db-name button {
  flex: none; min-width: 96px; height: 38px; font-family: var(--font-stencil); font-size: 16px; text-transform: uppercase;
  color: #e6e1cf; background: linear-gradient(180deg, #4c5530, #2f3520); border: 2px solid; border-color: #7d8a4c #171b0c #171b0c #7d8a4c;
}
.db-name button:disabled { opacity: 0.5; }
.db-name-msg { margin: 4px 0 0; min-height: 1.2em; font-size: 13px; color: #aeb3a5; }
.db-name.sent .db-name-msg { color: var(--green); }
/* Phones held sideways: each tab fits on one screen */
@media (orientation: landscape) and (max-height: 500px) {
  #debrief { padding-top: calc(var(--safe-t) + 4px); padding-bottom: calc(var(--safe-b) + 4px); }
  .db-card { padding: 6px 10px 8px; }
  .db-kick, .db-note, .db-ptitle { display: none; }
  #dbTitle { font-size: 20px; }
  .db-time { font-size: 20px; }
  .db-ptabs { margin-top: 4px; }
  .db-ptabs button { min-height: 28px; font-size: 13px; }
  .db-grid { margin-top: 6px; gap: 8px; }
  .db-panel { padding: 6px 8px; }
  .db-tabs { margin-bottom: 2px; }
  .db-tabs button { min-height: 26px; font-size: 12px; }
  .db-legend { font-size: 12px; }
  .db-chart svg { max-height: 128px; }
  .db-mvp-head img { width: 80px; height: 60px; }
  .db-mvp h3 { font-size: 17px; }
  .db-mvpstats { margin-top: 4px; }
  .db-mvpstats b { font-size: 20px; }
  .db-table td { padding: 3px 4px; font-size: 18px; }
  .db-buttons { margin-top: 6px; }
  .db-extra { margin-top: 6px; }
  .db-name { padding: 5px 8px; }
  .db-name label { display: none; }
  .db-name input::placeholder { color: #7f8577; }
  .db-buttons button { height: 36px; font-size: 16px; }
}

/* Short landscape phones: slimmer sidebar, smaller radar. */
@media (orientation: landscape) and (max-height: 500px) {
  :root { --sbw: 152px; --ts: calc(var(--safe-t) + 20px); --cam-h: 46px; }
  #sidebar { gap: 4px; padding-top: 4px; padding-bottom: calc(var(--safe-b) + 4px); }
  .sb-radar { width: 70%; justify-self: center; }
  .icon { min-height: 30px; }
  .icon span { font-size: 15px; }
  .icon.squad { min-height: 36px; }
  .sb-arrows button { min-height: 22px; }
  #selbar, #placebar { top: calc(var(--ts) + 36px); }
}

/* Portrait: the sidebar becomes a console along the bottom with two horizontal build strips. */
@media (orientation: portrait) {
  :root { --cam-h: auto; --cons-h: 176px; }
  body.touch { --cons-h: 259px; }   /* the command and squad rows on top of the console */
  body.touch.fold { --cons-h: 95px; }   /* folded: only the command and squad rows */
  body.touch.fold #sidebar { grid-template-rows: auto auto; grid-template-areas: "buttons buttons" "squad squad"; }
  body.touch.fold #sidebar .sb-radar, body.touch.fold #sidebar .sb-strips { display: none; }
  /* The fold handle: a tab on the console's top edge, at the right. */
  body.touch .sb-fold {
    display: flex; align-items: center; justify-content: center; position: absolute; z-index: 1;
    top: -24px; right: calc(var(--safe-r) + 8px); width: 64px; height: 24px; padding: 0;
    color: #d4d6cc; font-size: 16px; line-height: 1; border-bottom: 0; border-radius: 8px 8px 0 0;
    background: linear-gradient(180deg, #55585a, var(--metal)); border: 2px solid; border-color: var(--metal-hi) var(--metal-lo) transparent var(--metal-hi);
  }
  body.touch .sb-fold::after { content: ''; position: absolute; left: -8px; right: -8px; top: -12px; bottom: 0; }   /* (a bigger area to tap) */
  body.spectate .sb-fold { display: none !important; }
  /* The selection panel in the console (touch screens): over the squad row, which hides while something is selected,
     so nothing covers the battlefield. The squad row's bottom edge: the console's bottom padding (5), the build strips
     (78 + 3 + 78) and the gap (5); folded, only the padding. */
  body.touch #selbar {
    top: auto; left: calc(var(--safe-l) + 8px); right: calc(var(--safe-r) + 5px); bottom: calc(var(--safe-b) + 169px);
    max-width: none; height: 40px; padding: 2px 2px 2px 4px; gap: 4px;
  }
  body.touch.fold #selbar { bottom: calc(var(--safe-b) + 5px); }
  body.touch.sel-on #squadBar { visibility: hidden; }
  body.touch #selBtns button { min-height: 32px; padding: 0 9px; font-size: 12px; }
  body.touch .sel-info { max-width: 92px; padding: 0 2px; }
  body.touch .sel-info .bar { width: 70px; }
  body.touch #eva { top: calc(var(--ts) + 26px); }   /* (no panel up there now; clear of the Options tab's touch area) */
  /* The announcer on one smaller line, so it covers less of the battlefield. */
  #eva { font-size: min(17px, 4.6vw); letter-spacing: 0.03em; }   /* (one line for most messages; a long one wraps, small) */
  body.touch #eva { font-size: 14px; }
  .credits { width: auto; min-width: 120px; }
  #sidebar {
    top: auto; left: 0; right: 0; bottom: 0; width: auto;
    height: calc(var(--cons-h) + var(--safe-b));
    border: 0; border-top: 2px solid var(--metal-hi);
    padding: 5px calc(var(--safe-r) + 5px) calc(var(--safe-b) + 5px) calc(var(--safe-l) + 5px);
    grid-template-columns: 124px minmax(0, 1fr);
    grid-template-rows: auto minmax(0, 1fr);
    grid-template-areas: "radar strips" "buttons strips";
  }
  /* The radar column as wide as the two build strips are tall (78 + 3 + 78 px), so the square screen fills its housing
     (with AUTO and SELECT moved up, a 124 px column left an empty strip of housing under it). */
  body.touch #sidebar { grid-template-columns: 159px minmax(0, 1fr); grid-template-rows: auto auto minmax(0, 1fr); grid-template-areas: "buttons buttons" "squad squad" "radar strips"; }
  body.touch .sb-buttons { flex-wrap: nowrap; align-self: stretch; }
  body.touch .sb-buttons .icon { flex: 1 1 0; flex-direction: row; gap: 6px; min-height: 40px; }
  body.touch .sb-buttons .icon small, body.touch #returnBtn small, body.touch #boxBtn small, body.touch #giveBtn small { font-size: 11px; letter-spacing: 0.04em; }
  .icon.squad { flex-direction: row; gap: 6px; min-height: 40px; }
  .icon.squad small { font-size: 11px; letter-spacing: 0.04em; }
  .icon.squad b { font-size: 15px; }
  .sb-buttons { align-self: end; }
  .sb-strips { grid-template-columns: 10px minmax(0, 1fr); grid-template-rows: 78px 78px; align-content: start; }
  .power { grid-row: 1 / 3; }
  .strip {
    grid-auto-flow: column; grid-auto-columns: 100px; grid-auto-rows: auto; grid-template-rows: minmax(0, 1fr);
    overflow-x: auto; overflow-y: hidden; touch-action: pan-x;
  }
  .cameo { touch-action: pan-x; }
  .sb-arrows { display: none; }
  #selbar, #placebar { top: calc(var(--ts) + 26px); }   /* clear of the Options tab's touch area */
  #eva { top: calc(var(--ts) + 74px); }
}
/* Portrait Field Manual: a slimmer header and footer, the page counter on one line. */
@media (orientation: portrait) {
  .fm-top, .fm-foot { padding: 4px 6px; }
  .fm-foot button { min-width: 76px; }
  .fm-num { font-size: 17px; white-space: nowrap; }
  .fm-page { padding: 12px 12px 18px; font-size: 15px; }
  .fm-tabs { -webkit-mask-image: linear-gradient(90deg, #000 88%, transparent); mask-image: linear-gradient(90deg, #000 88%, transparent); }
  .fm-stats { font-size: 13px; }
  .icon small { font-size: 9px; letter-spacing: 0.02em; }
}
@media (orientation: portrait) and (max-width: 360px) {
  #sidebar, body.touch #sidebar { grid-template-columns: 104px minmax(0, 1fr); }
  body.touch .sb-radar { align-self: center; }   /* (too narrow for the full-height radar: a smaller one, centred) */
}
/* Narrow portrait phones: the command row's icons above their labels, so RETURN and SELECT fit. */
@media (orientation: portrait) and (max-width: 400px) {
  body.touch .sb-buttons .icon { flex-direction: column; gap: 2px; }
  body.touch .sb-buttons .icon small, body.touch #returnBtn small, body.touch #boxBtn small, body.touch #giveBtn small { font-size: 10px; letter-spacing: 0.02em; }
}
@media (prefers-reduced-motion: reduce) {
  #eva.show, .cameo.ready .st, .power[data-state="low"] i { animation: none; }
}

/* Map picker: a picture of each map beside its name and description. */
.pick.maps button { display: grid; grid-template-columns: auto 1fr; column-gap: 12px; align-items: center; text-align: left; }
.pick.maps button small { grid-column: 2; }
.pick.maps button[disabled] { opacity: 0.45; }   /* not made for the battle picked (battleFits) */
.pick.maps .map-img { grid-row: 1 / span 2; width: min(34vh, 180px); height: auto; aspect-ratio: 1; image-rendering: pixelated; border: 1px solid #000; }
#beaten { position: fixed; inset: 0; z-index: 30; display: flex; align-items: center; justify-content: center; padding: 16px; background: rgba(0,0,0,0.55); }
#beaten[hidden] { display: none; }
#deploying { position: fixed; inset: 0; z-index: 31; display: flex; align-items: center; justify-content: center; padding: 16px; background: rgba(0,0,0,0.85); }
#deploying[hidden] { display: none; }
/* Giving credits to an ally (team games). */
#upgrades { position: fixed; inset: 0; z-index: 30; display: flex; align-items: center; justify-content: center; padding: 16px; background: rgba(0,0,0,0.55); }
#upgrades[hidden] { display: none; }
#upgrades .nw-card { max-width: 560px; max-height: 100%; overflow-y: auto; }
#upgrades .up-item { margin: 0 0 14px; }
#upgrades .up-name { margin: 0 0 4px; font-weight: 700; }
#upgrades .up-desc { margin: 0 0 8px; font-size: 14px; line-height: 1.35; }
#upgrades .up-row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
#upgrades .up-row .pf-btn { padding: 0 12px; }
#upgrades .pf-btn[disabled] { opacity: 0.45; }
#upgrades .up-done { color: #2f7a2f; font-weight: 700; }
#upgrades .up-pct { font-weight: 700; }
#give { position: fixed; inset: 0; z-index: 30; display: flex; align-items: center; justify-content: center; padding: 16px; background: rgba(0,0,0,0.55); }
#give[hidden] { display: none; }
#give .gv-row { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin: 0 0 12px; }
#give .gv-name { margin: 0 0 6px; font-weight: 700; overflow-wrap: anywhere; }
#give .pf-btn[disabled] { opacity: 0.45; }
#give .gv-name i { display: inline-block; width: 14px; height: 14px; margin-right: 6px; vertical-align: -2px; border: 1px solid #22201a; }
#give .nw-card { max-width: 600px; max-height: 100%; overflow-y: auto; }
#give .gv-row .pf-btn { padding: 0 10px; }
#give .gv-in { flex: 0 1 130px; min-width: 0; height: 40px; padding: 0 10px; font: inherit; font-size: 16px; color: #22201a; background: #fff8e2; border: 2px solid #5a4a2a; }
#give .gv-in.bad { border-color: #a3261a; background: #f6d9d2; }
/* The Auto Attack and Defend ally pickers (team games; #allyPick had no rule of its own, so the Ally button seemed to do nothing) and the picked enemy's colour on the AUTO button. */
#autoPick, #allyPick { position: fixed; inset: 0; z-index: 30; display: flex; align-items: center; justify-content: center; padding: 16px; background: rgba(0,0,0,0.55); }
#autoPick[hidden], #allyPick[hidden] { display: none; }
#autoPick .nw-card, #allyPick .nw-card { width: min(340px, 100%); max-height: 100%; overflow-y: auto; }
.ap-list { display: flex; flex-direction: column; gap: 6px; }
.ap-row { display: flex; align-items: center; gap: 8px; width: 100%; text-align: left; }
.ap-row i { flex: none; width: 16px; height: 16px; border: 1px solid #22201a; }
.ap-row i.ap-any { background: repeating-linear-gradient(45deg, #888 0 3px, #ccc 3px 6px); }
.ap-row small { margin-left: auto; font-size: 11px; opacity: 0.8; }
.ap-row.on { outline: 3px solid #5a3b18; }
.ap-row:disabled { opacity: 0.45; cursor: default; }
.ap-cancel { justify-content: center; }
.ap-row i.ap-move { background: #c8392b; border-radius: 50%; }
.icon.auto.amove { outline: 3px solid #ff4a3a; outline-offset: -3px; animation: amovePulse 0.9s ease-in-out infinite alternate; }
@keyframes amovePulse { from { outline-color: #ff4a3a; } to { outline-color: #ffd23e; } }
.icon.aimed { box-shadow: inset 0 -4px 0 var(--aim); }

/* Watch AI vs AI (owner's map tool, ui.js startWatch): only the radar stays in the sidebar. */
body.spectate #sidebar .sb-buttons, body.spectate #sidebar .sb-strips, body.spectate #sidebar .sb-arrows { visibility: hidden; }
body.spectate #sidebar .sb-squad { display: none; }

/* Chat and map pings in online battles (src/chat.js). Bottom left of the battlefield, clear of the sidebar. */
#talk[hidden], #chatBox[hidden], #talkBtns [hidden], .talk-new[hidden] { display: none; }
#talkBtns { position: fixed; z-index: 8; left: calc(var(--safe-l) + 8px); bottom: calc(var(--safe-b) + 8px); display: flex; gap: 4px; }
.talk-btn { position: relative; flex: none; width: 52px; min-height: 44px; }
.talk-new { position: absolute; top: -6px; right: -6px; min-width: 18px; height: 18px; padding: 0 4px; border-radius: 9px; background: #d23a2a; color: #fff; font-size: 11px; line-height: 18px; text-align: center; }
#chatLog { position: fixed; z-index: 8; left: calc(var(--safe-l) + 8px); bottom: calc(var(--safe-b) + 60px); width: min(420px, calc(var(--gw) - var(--sbw) - var(--safe-l) - var(--safe-r) - 24px)); display: flex; flex-direction: column; gap: 2px; pointer-events: none; }
.cl-line { padding: 2px 6px; font-size: 13px; line-height: 1.3; color: #ece6d2; background: rgba(0,0,0,0.6); border-radius: 3px; overflow-wrap: anywhere; transition: opacity 1s; text-shadow: 0 1px 1px #000; }
.cl-line i { font-style: normal; color: #a9ac9f; font-size: 11px; }
.cl-line.old { opacity: 0; }
.cl-ping { pointer-events: auto; cursor: pointer; text-decoration: underline dotted; }
#chatBox { position: fixed; z-index: 25; top: calc(var(--ts) + 8px); left: calc(var(--safe-l) + 8px); width: min(520px, calc(var(--gw) - var(--sbw) - var(--safe-l) - var(--safe-r) - 24px)); padding: 6px; background: rgba(20,22,22,0.92); border: 2px solid; border-color: var(--metal-hi) var(--metal-lo) var(--metal-lo) var(--metal-hi); display: flex; flex-direction: column; gap: 6px; }
.cb-hist { max-height: 30vh; overflow-y: auto; display: flex; flex-direction: column; gap: 2px; }
.cb-hist .cl-line { background: transparent; padding: 1px 2px; }
.cb-empty { margin: 2px; color: #a9ac9f; font-size: 13px; }
.cb-row { display: flex; gap: 4px; margin: 0; }
.cb-row input { flex: 1 1 auto; min-width: 0; height: 36px; padding: 0 8px; font-size: 16px; color: #f2eedf; background: #0d0f0f; border: 1px solid #5a5d5f; border-radius: 2px; }
.cb-row button, .cb-quick button { min-height: 36px; padding: 0 10px; font-weight: 700; font-size: 13px; color: #e2e2d8; background: linear-gradient(180deg, #55585a, #3a3c3e 45%, #2e3032); border: 1px solid #6a6d70; border-radius: 2px; }
.cb-to { min-width: 54px; color: #8fe08f !important; }
.cb-to.all { color: #ffd23e !important; }
.cb-quick { display: flex; flex-wrap: wrap; gap: 4px; }
.cb-quick button { min-height: 32px; font-size: 12px; font-weight: 600; }
@media (orientation: portrait) {
  #talkBtns { bottom: calc(var(--cons-h) + var(--safe-b) + 8px); }
  #chatLog { bottom: calc(var(--cons-h) + var(--safe-b) + 60px); width: calc(100vw - var(--safe-l) - var(--safe-r) - 16px); }
  #chatBox { width: calc(100vw - var(--safe-l) - var(--safe-r) - 16px); }
}

/* The server browser on the Online page (net.js Online roomsHtml). */
.on-browser { margin: 14px 0 6px; }
.on-browse-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.on-browse-top h3 { margin: 0; }
.on-rooms { list-style: none; margin: 8px 0 0; padding: 0; display: flex; flex-direction: column; gap: 6px; max-height: 46vh; overflow-y: auto; }
.on-rooms li { display: flex; align-items: center; gap: 10px; padding: 6px 8px; background: rgba(90,74,42,0.12); border: 1px solid rgba(90,74,42,0.45); }
.on-rooms li > div { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; }
.on-rooms li b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.on-rooms li small { opacity: 0.8; }
.on-count { font-variant-numeric: tabular-nums; white-space: nowrap; }
.on-room-map { flex: none; width: 64px; height: 64px; object-fit: cover; background: #2a2a24; border: 1px solid rgba(90,74,42,0.6); }
@media (max-height: 440px) { .on-room-map { width: 52px; height: 52px; } }

/* ---------- Skirmish lobby (maps.js MapSelect), after Red Alert 2's skirmish screen: red frames on black ---------- */
#maps.rl { display: block; padding: 0; background: #070404; z-index: 31; }
.rl-screen {
  position: absolute; inset: 0; display: grid; grid-template-columns: minmax(0, 1fr) 230px; gap: 8px;
  padding: calc(var(--safe-t) + 8px) max(8px, var(--safe-r)) calc(var(--safe-b) + 8px) max(8px, var(--safe-l));
  background: radial-gradient(ellipse at 30% 40%, rgba(120, 10, 6, 0.45), transparent 65%),
    repeating-linear-gradient(0deg, rgba(255, 40, 20, 0.035) 0 1px, transparent 1px 4px), #0b0605;
  color: #ffd24a; font-family: var(--font-ui);
}
.rl-main { min-height: 0; overflow-y: auto; padding: 8px 10px; border: 2px solid #8c1a10; box-shadow: inset 0 0 30px rgba(0, 0, 0, 0.8); background: rgba(12, 4, 3, 0.75); }
.rl-title { margin: 0 0 6px; font-family: var(--font-stencil); font-weight: 400; font-size: 18px; letter-spacing: 0.06em; text-transform: uppercase; color: #ffe27a; }
.rl-head, .rl-row { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(0, 1.2fr) 52px minmax(0, 0.9fr); gap: 6px; align-items: start; }
.rl-head { padding: 0 2px 4px; font-weight: bold; color: #ffe27a; font-size: 14px; }
.rl-row { margin-bottom: 5px; }
.rl-c { min-width: 0; display: flex; align-items: center; gap: 5px; min-height: 32px; }
.rl-row select, .rl-you, .rl-fixed, .rl-col {
  min-height: 32px; border: 1px solid #c22a1a; background: linear-gradient(180deg, #1c0806, #0d0403); color: #ffd24a; font: inherit; font-size: 15px;
}
.rl-row select { flex: 1; min-width: 0; padding: 0 6px; border-radius: 0; -webkit-appearance: none; appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, #ffb12a 50%), linear-gradient(135deg, #ffb12a 50%, transparent 50%), linear-gradient(180deg, #1c0806, #0d0403);
  background-position: calc(100% - 13px) 13px, calc(100% - 8px) 13px, 0 0; background-size: 5px 5px, 5px 5px, 100% 100%; background-repeat: no-repeat; padding-right: 20px; }
.rl-row select:disabled { opacity: 0.55; }
.rl-you { flex: 1; min-width: 0; padding: 4px 6px; }
.rl-you b { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rl-fixed { display: flex; align-items: center; padding: 0 8px; flex: 1; }
.rl-col { width: 46px; flex: none; display: flex; align-items: center; justify-content: center; font-size: 12px; box-shadow: inset 0 0 0 3px #0d0403; }
.rl-q { background: #0d0403; }
.rl-crest { flex: none; width: 22px; height: 16px; border: 1px solid #000; background: linear-gradient(135deg, #5b7fb0 0 50%, #ad3128 50%); }
.rl-crest[data-faction="allies"] { background: linear-gradient(180deg, #97b4da, #36547c); }
.rl-crest[data-faction="soviets"] { background: linear-gradient(180deg, #dd6c5c, #781d18); }
.rl-off .rl-c select { color: #a07a2a; }
.rl-prog { margin-top: 4px; background: #2a0d08; border-color: #6d1a10; }
.rl-prog i { background: #d0681e; }
.rl-prog small { color: #fff1c4; }
.rl-fill { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 8px 0 4px; font-size: 14px; }
.rl-msg { min-height: 1.2em; margin: 4px 0; color: #ff7a5a; font-size: 14px; }
.rl-sub { margin: 10px 0 6px; font-family: var(--font-stencil); font-weight: 400; font-size: 16px; text-transform: uppercase; color: #ffe27a; letter-spacing: 0.05em; scroll-margin-top: 6px; }
.rl-maps .pick.maps button { background: #160705; color: #ffd24a; border: 1px solid #6d1a10; }
.rl-maps .pick.maps button[aria-pressed="true"] { border-color: #ffb12a; box-shadow: 0 0 0 1px #ffb12a; background: #3a0e08; }
.rl-maps .pick.maps small { color: #d9b77a; }
.rl-side { min-height: 0; display: flex; flex-direction: column; gap: 8px; overflow-y: auto; }
.rl-panel { border: 2px solid #5f6266; border-color: #8a8d91 #2a2c2e #2a2c2e #8a8d91; background: #141516; padding: 6px; }
.rl-cap { text-align: center; font-weight: bold; color: #fff; background: linear-gradient(180deg, #3a3c3f, #1d1e20); margin: -6px -6px 6px; padding: 4px; font-size: 14px; }
.rl-shot img { display: block; width: 100%; height: auto; aspect-ratio: 1; object-fit: cover; image-rendering: auto; border: 1px solid #000; }
.rl-noimg { display: grid; place-items: center; aspect-ratio: 1; color: #777; }
.rl-battle { color: #fff; font-size: 14px; line-height: 1.35; }
.rl-battle b { display: block; text-align: center; }
.rl-btns { display: flex; flex-direction: column; gap: 6px; }
.rl-btn {
  min-height: 40px; padding: 0 10px; font: inherit; font-weight: bold; font-size: 15px; color: #ffe9b0; cursor: pointer;
  background: linear-gradient(180deg, #8e1d12, #4a0905); border: 2px solid; border-color: #e0503a #2a0503 #2a0503 #e0503a; border-radius: 3px;
  text-shadow: 0 1px 0 #000;
}
.rl-btn:disabled { opacity: 0.5; cursor: default; }
.rl-btn.rl-small { min-height: 32px; font-size: 14px; }
.rl-go { background: linear-gradient(180deg, #c22a16, #6e0d06); }
.rl-back { margin-top: auto; }
@media (max-width: 640px) and (orientation: portrait) {
  .rl-screen { grid-template-columns: minmax(0, 1fr); grid-template-rows: minmax(0, 1fr) auto; }
  .rl-side { flex-direction: row; flex-wrap: wrap; }
  .rl-mapbox { width: 110px; }
  .rl-battle { flex: 1; }
  .rl-btns { width: 100%; flex-direction: row; flex-wrap: wrap; }
  .rl-btns .rl-btn { flex: 1 1 40%; }
}
@media (max-height: 460px) {
  .rl-screen { grid-template-columns: minmax(0, 1fr) 190px; }
  .rl-cap { display: none; }
  .rl-mapbox { max-width: 96px; align-self: center; padding: 3px; }
  .rl-side, .rl-btns { gap: 5px; }
  .rl-battle { padding: 4px; font-size: 13px; }
  .rl-btn { min-height: 30px; font-size: 14px; }
  .rl-title { display: none; }
}
/* The online page while a battle loads behind it (net.js bootView): no close */
#online.on-boot .fm-close { visibility: hidden; }
/* The online lobby in the same layout (net.js rlScreen) */
#online.rl { display: block; padding: 0; background: #070404; }
#online .rl-sub, #online .rl-title { font-family: var(--font-stencil); font-weight: 400; color: #ffe27a; }
.rl-intro { margin: 0 0 8px; font-size: 14px; color: #ffd24a; line-height: 1.35; }
.rl-wait { margin: 4px 0; text-align: center; color: #ffe9b0; font-size: 14px; }
.rl-btn.rl-on { color: #fff3cf; background: linear-gradient(180deg, #a2731a, #5f3e09); border-color: #ffcf5a #3a2504 #3a2504 #ffcf5a; }
.rl-btn.rl-on:disabled { opacity: 0.9; }
.rl-you .rl-btn { margin-top: 4px; }
#online .on-saves { color: #ffd24a; }
/* While a battle loads behind a lobby (skirmish: #maps.rl-busy; online: #online.on-boot), the lobby is not quite opaque
   (owner's iPhone, 2026-11-30: Watch AI vs AI froze when the lobby closed with WebGL on, fine with ?gl=off). Safari need
   not draw a canvas hidden under an opaque page, so the battle's first WebGL frames all landed at once when the lobby went;
   a canvas that shows through, however faintly, is drawn all along, as it was under the old Loading card. */
#maps.rl.rl-busy, #online.rl.on-boot { background: rgba(7, 4, 4, 0.9); }
/* (and plain: no gradients for the phone to blend over the battle every frame, nor the map list's pictures) */
#maps.rl-busy .rl-screen, #online.on-boot .rl-screen { background: rgba(11, 6, 5, 0.94); }
#maps.rl-busy .rl-maps, #maps.rl-busy .rl-sub { display: none; }

/* ---------- Replays (replay.js): the page, the bar while one plays, Save replay in the debrief ---------- */
#replays { position: fixed; inset: 0; z-index: 30; display: grid; place-items: center; grid-template-columns: minmax(0, 1fr);
  padding: calc(var(--safe-t) + 10px) max(10px, var(--safe-r)) calc(var(--safe-b) + 10px) max(10px, var(--safe-l)); background: rgba(0,0,0,0.78); }
.rp-list { list-style: none; padding: 0; margin: 6px 0; }
.rp-list li { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid rgba(0,0,0,0.15); }
.rp-list li > div { flex: 1; min-width: 0; }
.rp-list li b { display: block; font-size: 15px; line-height: 1.3; }
.rp-list li b small { font-weight: normal; opacity: 0.75; }
.rp-list li b i { font-weight: normal; opacity: 0.7; padding: 0 3px; }
.rp-list li > div > small { display: block; opacity: 0.8; margin-top: 2px; }
.rp-status { min-height: 1.2em; }

/* Every menu page in the Skirmish lobby's look (2026-12-01, owner: the parchment pages "no longer fit the style of our main
   menus"; then the Leaderboard and Profile, then the Field Manual and What's New): the whole screen, red frame on black,
   gold text, red plates. Scoped to the book only: the online lobby itself (.on-rl) is already this look. */
#online:not(.rl), #replays, #board, #profile, #manual, #news { padding: 0; background: #070404; }
:is(#online, #replays, #board, #profile, #manual, #news) .fm-book { width: 100%; height: 100%; border: 0; box-shadow: none; gap: 8px;
  padding: calc(var(--safe-t) + 8px) max(8px, var(--safe-r)) calc(var(--safe-b) + 8px) max(8px, var(--safe-l));
  background: radial-gradient(ellipse at 30% 40%, rgba(120, 10, 6, 0.45), transparent 65%),
    repeating-linear-gradient(0deg, rgba(255, 40, 20, 0.035) 0 1px, transparent 1px 4px), #0b0605; }
:is(#online, #replays, #board, #profile, #manual, #news) .fm-top { padding: 4px 4px 4px 10px; border: 2px solid; border-color: #8a8d91 #2a2c2e #2a2c2e #8a8d91; background: linear-gradient(180deg, #3a3c3f, #1d1e20); }
:is(#online, #replays, #board, #profile, #manual, #news) .fm-brand { font-size: 18px; color: #ffe27a; }
:is(#online, #replays, #board, #profile, #manual, #news) .fm-close { min-width: 40px; min-height: 34px; color: #ffe9b0; background: linear-gradient(180deg, #8e1d12, #4a0905);
  border-color: #e0503a #2a0503 #2a0503 #e0503a; border-radius: 3px; }
:is(#online, #replays, #board, #profile, #manual, #news) .fm-page { padding: 10px 14px 16px; color: #ffd24a; font-family: var(--font-ui); -webkit-user-select: none; user-select: none;
  border: 2px solid #8c1a10; background: rgba(12, 4, 3, 0.75); box-shadow: inset 0 0 30px rgba(0, 0, 0, 0.8); }
:is(#online, #replays, #board, #profile, #manual, #news) .fm-page h2 { font-size: clamp(20px, 4vw, 26px); letter-spacing: 0.06em; color: #ffe27a; border-bottom: 2px solid #8c1a10; }
:is(#online, #replays, #board, #profile, #manual, #news) .fm-page h3 { font-family: var(--font-stencil); font-weight: 400; font-size: 17px; letter-spacing: 0.05em; text-transform: uppercase; color: #ffe27a; }
:is(#online, #replays, #board, #profile, #manual, #news) .lb-intro { font-style: normal; color: #ffd24a; }
:is(#online, #replays, #board, #profile, #manual, #news) .pf-small, #replays .rp-status { color: #d9b77a; }
:is(#online, #replays, #board, #profile, #manual, #news) .pf-btn, :is(#online, #replays, #board, #profile, #manual, #news) .pf-row button { height: auto; min-height: 40px; padding: 0 14px; font-family: var(--font-ui); font-weight: bold; font-size: 15px;
  text-transform: none; color: #ffe9b0; text-shadow: 0 1px 0 #000; border-radius: 3px;
  background: linear-gradient(180deg, #8e1d12, #4a0905); border: 2px solid; border-color: #e0503a #2a0503 #2a0503 #e0503a; }
#online .pf-btn.on-go, #replays .pf-btn.on-go { background: linear-gradient(180deg, #c22a16, #6e0d06); }
#online .on-btns > .on-go { min-width: 12em; min-height: 46px; font-size: 17px; }
#online .pf-btn:disabled { opacity: 0.5; }
#online .on-rooms li, #replays .rp-list li { padding: 6px 8px; background: #160705; border: 1px solid #6d1a10; }
#replays .rp-list { display: flex; flex-direction: column; gap: 6px; }
#online .on-rooms li b, #replays .rp-list li b { color: #ffe9b0; }
#online .on-rooms li small, #replays .rp-list li small { color: #d9b77a; opacity: 1; }
#online .on-room-map, #replays .on-room-map { background: #0d0403; border: 1px solid #000; }
#online .on-count { color: #ffe27a; }
#online .on-code { color: #ffb12a; text-shadow: 0 0 12px rgba(255, 120, 40, 0.4); }
#online .on-error { color: #ff7a5a; border-color: #c22a1a; background: rgba(60, 8, 4, 0.6); }
:is(#online, #replays, #board, #profile, #manual, #news) .pf-form label { color: #ffe27a; }
:is(#online, #replays, #board, #profile, #manual, #news) .pf-row input { color: #ffd24a; background: linear-gradient(180deg, #1c0806, #0d0403); border: 1px solid #c22a1a; }
:is(#online, #replays, #board, #profile, #manual, #news) .pf-row input:focus { border-color: #ffb12a; }
:is(#online, #replays, #board, #profile, #manual, #news) .pf-row input::placeholder { color: #8a6a2a; }
:is(#online, #replays, #board, #profile, #manual, #news) .pf-msg { color: #ff7a5a; }
/* (the Leaderboard: battle tabs, a table per difficulty; the Profile: the service record's boxes, sign in and out) */
:is(#online, #replays, #board, #profile, #manual, #news) .fm-tabs button { min-height: 34px; padding: 0 12px; font-family: var(--font-ui); font-weight: bold; font-size: 14px; color: #ffd24a;
  background: linear-gradient(180deg, #2a0d08, #140504); border-color: #6d1a10; border-radius: 3px; }
:is(#online, #replays, #board, #profile, #manual, #news) .fm-tabs button[aria-current="true"] { color: #fff3cf; background: linear-gradient(180deg, #c22a16, #6e0d06); border-color: #ffb12a; }
:is(#online, #replays, #board, #profile, #manual, #news) .fm-page h4 { color: #ffb12a; letter-spacing: 0.05em; }
:is(#online, #replays, #board, #profile, #manual, #news) .lb-note, :is(#online, #replays, #board, #profile, #manual, #news) .pf-since, :is(#online, #replays, #board, #profile, #manual, #news) .pf-when, :is(#online, #replays, #board, #profile, #manual, #news) .pf-k { color: #d9b77a; }
:is(#online, #replays, #board, #profile, #manual, #news) .lb-retry { color: #ffe9b0; background: linear-gradient(180deg, #8e1d12, #4a0905); border: 2px solid; border-color: #e0503a #2a0503 #2a0503 #e0503a; border-radius: 3px; }
:is(#online, #replays, #board, #profile, #manual, #news) .fm-table th, :is(#online, #replays, #board, #profile, #manual, #news) .fm-table td { border-color: #4a120b; }
:is(#online, #replays, #board, #profile, #manual, #news) .fm-table th { color: #ffe27a; background: #2a0d08; }
:is(#online, #replays, #board, #profile, #manual, #news) .fm-table td { background: rgba(22, 7, 5, 0.85); }
:is(#online, #replays, #board, #profile, #manual, #news) .fm-table td:first-child { color: #ffb12a; }
:is(#online, #replays, #board, #profile, #manual, #news) .lb-table tr.lb-me td { color: #fff3cf; background: #5a1a0c; }
:is(#online, #replays, #board, #profile, #manual, #news) .pf-name, :is(#online, #replays, #board, #profile, #manual, #news) .pf-v { color: #ffe9b0; }
:is(#online, #replays, #board, #profile, #manual, #news) .pf-stat { background: #160705; border-color: #6d1a10; }
:is(#online, #replays, #board, #profile, #manual, #news) .pf-actions { border-top-color: #6d1a10; }
:is(#online, #replays, #board, #profile, #manual, #news) .pf-link { color: #ffb12a; }
:is(#online, #replays, #board, #profile, #manual, #news) .pf-btn.pf-danger { background: linear-gradient(180deg, #4a0905, #240302); border-color: #a4473a #1a0302 #1a0302 #a4473a; }
/* (the Field Manual: cover, contents, unit and structure cards, tables, the page footer; What's New: the releases) */
:is(#manual, #news) .fm-page { line-height: 1.45; }
:is(#manual, #news) .fm-page h4 { color: #ffb12a; }
:is(#manual, #news) .fm-page b, :is(#manual, #news) .fm-page strong { color: #ffe9b0; }
:is(#manual, #news) .fm-page a { color: #ffb12a; }
:is(#manual, #news) .fm-foot { border: 2px solid; border-color: #8a8d91 #2a2c2e #2a2c2e #8a8d91; background: linear-gradient(180deg, #3a3c3f, #1d1e20); }
:is(#manual, #news) .fm-foot button { min-height: 34px; color: #ffe9b0; background: linear-gradient(180deg, #8e1d12, #4a0905); border-color: #e0503a #2a0503 #2a0503 #e0503a; border-radius: 3px; }
:is(#manual, #news) .fm-num { color: #ffe27a; }
:is(#manual, #news) .fm-sub { color: #d9b77a; }
:is(#manual, #news) .fm-cover h2 { color: #ffe27a; text-shadow: 0 0 18px rgba(224, 67, 47, 0.45); }
:is(#manual, #news) .fm-stamp { color: #ff5a3a; border-color: #ff5a3a; }
:is(#manual, #news) .fm-toc li { border-bottom-color: #4a120b; }
:is(#manual, #news) .fm-toc li::before, :is(#manual, #news) .fm-toc span { color: #d9b77a; }
:is(#manual, #news) .fm-toc button { color: #ffe9b0; }
:is(#manual, #news) .fm-toc button:hover, :is(#manual, #news) .fm-toc button:focus-visible { color: #ffb12a; }
:is(#manual, #news) .fm-entry { background: #160705; border-color: #6d1a10; box-shadow: none; }
:is(#manual, #news) .fm-head h3 { color: #ffe9b0; }
:is(#manual, #news) .fm-pic { border-color: #000; box-shadow: 0 0 0 1px #6d1a10; }
:is(#manual, #news) .fm-stats dt { color: #ffb12a; }
:is(#manual, #news) .fm-stats dd { color: #ffe9b0; }
:is(#manual, #news) .fm-vs b { color: #ffb12a; }
:is(#manual, #news) .fm-table th, :is(#manual, #news) .fm-table td { border-color: #4a120b; }
:is(#manual, #news) .fm-table th { color: #ffe27a; background: #2a0d08; }
:is(#manual, #news) .fm-table td { background: rgba(22, 7, 5, 0.85); }
:is(#manual, #news) .fm-table td:first-child { color: #ffb12a; }
:is(#manual, #news) .fm-end { color: #d9b77a; }
#news .fm-release { padding: 8px 12px 4px; background: #160705; border: 1px solid #6d1a10; }
#news .fm-release h3 { color: #ffe9b0; }
#news .fm-release .fm-when { color: #d9b77a; }
#news .fm-release .fm-when b { color: #1b1405; background: #e9b93a; padding: 0 5px; }
/* The profile's record (profile.js renderMore): rating, results, favourites, medals, recent battles */
#profile .pf-h { margin: 18px 0 6px; padding-bottom: 3px; font-family: var(--font-stencil); font-weight: 400; font-size: 17px; letter-spacing: 0.05em;
  text-transform: uppercase; color: #ffe27a; border-bottom: 1px solid #6d1a10; }
#profile .pf-h small { margin-left: 6px; font-family: var(--font-ui); font-size: 13px; letter-spacing: 0; text-transform: none; color: #d9b77a; }
#profile .pf-rating { display: inline-flex; flex-direction: column; padding: 8px 14px; background: #160705; border: 1px solid #c22a1a; }
#profile .pf-big { font-family: var(--font-stencil); font-size: 40px; line-height: 1.05; color: #ffe9b0; text-shadow: 0 0 14px rgba(255, 120, 40, 0.35); }
#profile .pf-table td:not(:first-child), #profile .pf-table th:not(:first-child) { text-align: right; font-variant-numeric: tabular-nums; }
#profile .pf-table td:first-child { white-space: normal; }
#profile .pf-table th, #profile .pf-table td { padding: 5px 7px; }
@media (max-width: 480px) { #profile .pf-table { font-size: 13px; } #profile .pf-table th, #profile .pf-table td { padding: 4px 5px; } }
#profile .pf-word { font-family: var(--font-ui); font-size: clamp(17px, 4.5vw, 21px); }
#profile .pf-medals { list-style: none; margin: 4px 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 230px), 1fr)); gap: 6px; }
#profile .pf-medal { display: flex; gap: 8px; align-items: flex-start; padding: 6px 8px; background: #120605; border: 1px solid #3a0f09; }
#profile .pf-medal > div { flex: 1; min-width: 0; display: flex; flex-direction: column; }
#profile .pf-medal b { color: #a08a60; }
#profile .pf-medal small { color: #8a7650; font-size: 12.5px; line-height: 1.25; }
#profile .pf-badge { flex: none; display: grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; font-size: 17px;
  color: #4a3a2a; background: #1e0c08; border: 2px solid #3a2a1e; }
#profile .pf-medal.got { background: #2a0d08; border-color: #c08a2e; }
#profile .pf-medal.got b { color: #ffe9b0; }
#profile .pf-medal.got small { color: #d9b77a; }
#profile .pf-medal.got .pf-badge { color: #5a3a04; background: radial-gradient(circle at 35% 30%, #fff1b0, #e9b93a 55%, #a2731a); border-color: #ffe27a;
  box-shadow: 0 0 10px rgba(233, 185, 58, 0.45); }
#profile .pf-bar { position: relative; display: block; height: 13px; margin-top: 4px; background: #1c0806; border: 1px solid #4a120b; }
#profile .pf-bar i { position: absolute; left: 0; top: 0; bottom: 0; background: #8e3a12; }
#profile .pf-bar em { position: relative; display: block; padding-left: 4px; font-style: normal; font-size: 10px; line-height: 11px; color: #ffe9b0; }
#profile .pf-recent { list-style: none; margin: 4px 0; padding: 0; display: flex; flex-direction: column; gap: 5px; }
#profile .pf-recent li { display: flex; align-items: center; gap: 10px; padding: 6px 8px; background: #160705; border: 1px solid #6d1a10; }
#profile .pf-recent li > div { flex: 1; min-width: 0; display: flex; flex-direction: column; }
#profile .pf-recent b { color: #ffe9b0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#profile .pf-recent small { color: #d9b77a; }
#profile .pf-res { flex: none; width: 3.6em; padding: 2px 0; text-align: center; font-family: var(--font-stencil); font-size: 13px; text-transform: uppercase; border: 1px solid; }
#profile .pf-res.pf-win { color: #1b1405; background: #e9b93a; border-color: #ffe27a; }
#profile .pf-res.pf-loss { color: #ffd2c8; background: #6e0d06; border-color: #c22a1a; }
#profile .pf-res.pf-quit { color: #d9b77a; background: #2a1a10; border-color: #5a3a24; }
#rpBar { position: fixed; left: calc(var(--safe-l) + 8px); right: calc(var(--sbw) + var(--safe-r) + 8px); bottom: calc(var(--safe-b) + 8px); z-index: 25; display: flex; align-items: center; gap: 8px;
  max-width: 760px; margin: 0 auto; padding: 6px 8px; background: rgba(12, 6, 5, 0.88); border: 2px solid #8c1a10; color: #ffd24a; font-family: var(--font-ui); font-size: 14px; }
#rpBar[hidden] { display: none; }
#rpBar button { min-width: 40px; min-height: 34px; padding: 0 8px; font: inherit; font-weight: bold; color: #ffe9b0; background: linear-gradient(180deg, #8e1d12, #4a0905);
  border: 2px solid; border-color: #e0503a #2a0503 #2a0503 #e0503a; border-radius: 3px; cursor: pointer; }
#rpBar input[type=range] { flex: 1; min-width: 60px; accent-color: #d0681e; }
#rpBar .rp-time { white-space: nowrap; font-variant-numeric: tabular-nums; }
#rpBar .rp-who { max-width: 30%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; opacity: 0.85; }
#rpBar .rp-who small { opacity: 0.7; }
@media (max-width: 560px) { #rpBar .rp-who { display: none; } }
.rp-save { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 8px; }
.rp-save .rp-msg { font-size: 13px; }

/* ---------- The observer panel (replay.js Observer): in spectator mode, the sidebar under the radar ---------- */
#obsPanel { grid-area: strips; min-height: 0; overflow-y: auto; display: flex; flex-direction: column; gap: 4px; -webkit-overflow-scrolling: touch; }
#obsPanel[hidden] { display: none; }
body.spectate #sidebar .sb-strips, body.spectate #sidebar .sb-arrows, body.spectate #sidebar .sb-buttons { display: none; }
body.spectate #sidebar { grid-template-rows: auto minmax(0, 1fr); grid-template-areas: "radar" "strips"; }
body.spectate.touch { --cons-h: 176px; }   /* (portrait: no command or squad rows over the console) */
body.spectate #credits { visibility: hidden; }   /* (one side's money: the cards show every side's) */
@media (max-height: 500px) { #obsPanel .ob-row.ob-small { display: none; } .ob-card { padding-top: 3px; padding-bottom: 3px; } .ob-order li:nth-child(n+3) { display: none; } .ob-open .ob-order li { display: list-item; } }
.ob-card { position: relative; padding: 4px 5px 4px 8px; background: #141516; border: 1px solid #2c2e30; color: #d4d6cc; font-size: 11px; line-height: 1.3; cursor: pointer; }
.ob-card::before { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--pc); }
.ob-card.ob-out { opacity: 0.5; }
.ob-name { display: flex; align-items: center; gap: 4px; font-size: 12px; color: #fff; }
.ob-name b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ob-name small { color: #e07a5a; }
.ob-name .rl-crest { width: 14px; height: 10px; }
.ob-row { display: flex; justify-content: space-between; gap: 4px; font-variant-numeric: tabular-nums; }
.ob-row span:first-child { color: #ffd24a; }
.ob-small { color: #a9ac9f; font-size: 10px; }
.ob-small span:first-child { color: #a9ac9f; }
.ob-low { color: #ff7a5a; }
.ob-making { display: flex; flex-wrap: wrap; gap: 2px; margin-top: 3px; }
.ob-idle { color: #777; font-size: 10px; }
.ob-now { position: relative; width: 30px; height: 24px; background: #000; border: 1px solid #444; overflow: hidden; display: grid; place-items: center; font-weight: bold; color: #9fd4ff; }
.ob-now img { width: 100%; height: 100%; object-fit: cover; }
.ob-now b { position: absolute; right: 1px; top: 0; font-size: 9px; color: #fff; text-shadow: 0 0 2px #000; }
.ob-now i { position: absolute; left: 0; bottom: 0; height: 3px; background: #59e05a; }
.ob-now.ob-ready { border-color: #59e05a; }
.ob-order { list-style: none; margin: 3px 0 0; padding: 0; font-size: 10px; color: #c8c9c0; }
.ob-order li { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ob-order li span { color: #888; font-variant-numeric: tabular-nums; }
.ob-order li.ob-bld { color: #fff; }
.ob-more { margin-top: 2px; font-size: 10px; color: #ffb12a; }
.ob-open .ob-order { max-height: none; }
