/* Steam Punk Game UI.
   Menu: the "Option A" design, dark panels with one accent colour per nation.
   In game: Age of Empires 2 layout (resources top left, command panel bottom
   left, selected unit bottom centre, minimap bottom right) in a steampunk
   skin after Aran's reference: copper frames with bolts, oxblood leather
   plaques with gear medallions, gauges and a parchment telegraph log.
   Barlow Condensed for labels and numbers, Barlow for text, Special Elite
   for telegrams. */

:root {
  --font-label: "Barlow Condensed", "Arial Narrow", "Roboto Condensed", sans-serif;
  --font-text: "Barlow", "Segoe UI", "Helvetica Neue", sans-serif;
  --text: #ececec;
  --muted: #a8a8a8;
  --soft: #c9c9c9;
  --good: #6be04e;
  --warn: #f2c14e;
  --bad: #ff4a30;
  --font-type: "Special Elite", "Courier New", monospace;
  --sidebar: 304px;
  /* Brass and iron for the in-game skin. */
  --brass-hi: #f3d9a0;
  --brass: #b88d4a;
  --brass-mid: #8c6630;
  --brass-lo: #4e3517;
  --iron: #1d1915;
  --iron-2: #27211b;
  --iron-hi: #3a3128;
  --engrave: #d7b77a;
  --paper: #ecdfbf;
  --ink: #2b2116;
}

[data-faction="de"], [data-faction="none"] { --accent: #ffb81c; --line: #4a535c; --panel: rgba(24,28,32,0.95); --panel-solid: #181c20; --cameo: #2b3137; }
[data-faction="fr"] { --accent: #79c2ff; --line: #3a4c78; --panel: rgba(17,24,43,0.95); --panel-solid: #11182b; --cameo: #1f2b4a; }
[data-faction="ru"] { --accent: #ff5a36; --line: #6a2a20; --panel: rgba(34,13,10,0.95); --panel-solid: #220d0a; --cameo: #3a1712; }
[data-faction="uk"] { --accent: #e9c35c; --line: #3b5274; --panel: rgba(14,22,36,0.95); --panel-solid: #0e1624; --cameo: #1a2a44; }

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: #0b0b0c;
  color: var(--text);
  font-family: var(--font-text);
  font-size: 14px;
  overflow: hidden;
  user-select: none;
}

button, select, input { font: inherit; color: inherit; }
button:focus-visible, select:focus-visible, input:focus-visible { outline: 2px solid var(--accent, #ffb81c); outline-offset: 2px; }
button { transition: border-color 0.12s, background-color 0.12s, color 0.12s, filter 0.12s; }
h1, h2, h3 { margin: 0; }
.hidden { display: none !important; }

kbd {
  display: inline-block;
  padding: 0 5px;
  border: 1px solid #4a535c;
  border-bottom-width: 2px;
  background: #121417;
  font-family: var(--font-label);
  font-weight: 600;
  font-size: 13px;
}

.tiny {
  font-family: var(--font-label);
  font-size: 11px;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--muted);
}

.btn-primary, .btn-ghost {
  height: 56px;
  padding: 0 30px;
  font-family: var(--font-label);
  font-size: 20px;
  font-weight: 700;
  letter-spacing: 2px;
  text-transform: uppercase;
  cursor: pointer;
}
.btn-primary {
  border: 0;
  background: var(--accent);
  color: #111;
  clip-path: polygon(14px 0, 100% 0, 100% calc(100% - 14px), calc(100% - 14px) 100%, 0 100%, 0 14px);
}
.btn-primary:hover { filter: brightness(1.12); }
.btn-primary:active, .nav-item.primary:active { filter: brightness(0.92); transform: translateY(1px); }
.btn-ghost { border: 1px solid var(--line); background: transparent; color: var(--text); font-weight: 600; font-size: 18px; letter-spacing: 1.5px; }
.btn-ghost:hover { border-color: var(--accent); color: #fff; }

/* ---------------- Menu ---------------- */

#menu {
  position: fixed;
  inset: 0;
  overflow: auto;
  display: flex;
  gap: 64px;
  align-items: flex-start;
  justify-content: center;
  padding: 72px 48px;
  background:
    linear-gradient(90deg, rgba(8,8,9,0.92) 0%, rgba(8,8,9,0.75) 38%, rgba(8,8,9,0.4) 100%),
    url("assets/menu-backdrop.jpg") center / cover no-repeat,
    #0b0b0c;
}

.menu-intro { width: 400px; flex: none; display: flex; flex-direction: column; gap: 14px; }
.telegram {
  align-self: flex-start;
  padding: 6px 10px;
  background: #e8dcbf;
  color: #2b2116;
  font-family: "Special Elite", "Courier New", monospace;
  font-size: 12px;
  letter-spacing: 1px;
  transform: rotate(-1.5deg);
}
.menu-intro h1 {
  font-family: var(--font-label);
  font-size: 84px;
  font-weight: 700;
  line-height: 0.9;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: #fff;
}
.menu-intro .sub { margin: 0 0 14px; font-size: 16px; line-height: 1.5; color: var(--soft); }
.menu-nav { display: flex; flex-direction: column; gap: 6px; }
.nav-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 48px;
  padding: 0 18px;
  border: 1px solid #4a535c;
  background: rgba(20,22,25,0.7);
  font-family: var(--font-label);
  font-size: 20px;
  font-weight: 600;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  text-align: left;
  cursor: pointer;
}
.nav-item:hover:not(:disabled) { border-color: var(--accent); }
.nav-item:disabled { cursor: default; color: #8d8d8d; }
.nav-item .later { margin-left: auto; font-size: 13px; letter-spacing: 1px; color: var(--muted); }
.nav-item.primary {
  height: 52px;
  border: 0;
  background: var(--accent);
  color: #111;
  font-size: 22px;
  font-weight: 700;
  clip-path: polygon(0 0, 100% 0, 100% 100%, 14px 100%, 0 38px);
}

.setup {
  width: min(800px, 100%);
  display: flex;
  flex-direction: column;
  gap: 22px;
  padding: 28px;
  /* Same brass-and-iron frame as the in-game panels. */
  position: relative;
  background: linear-gradient(180deg, rgba(39,33,27,0.96), rgba(29,25,21,0.96));
  border: 3px solid transparent;
  border-image: linear-gradient(155deg, var(--brass-hi) 0%, var(--brass) 22%, var(--brass-lo) 48%, var(--brass-mid) 70%, var(--brass-hi) 100%) 1;
  box-shadow: 0 16px 40px rgba(0,0,0,0.5);
}
.setup::before {
  content: "";
  position: absolute;
  inset: 3px;
  pointer-events: none;
  --rivet: radial-gradient(circle at 40% 35%, var(--brass-hi) 0 1.2px, var(--brass) 2px, var(--brass-lo) 3px, transparent 3.6px);
  background: var(--rivet) left top / 8px 8px no-repeat, var(--rivet) right top / 8px 8px no-repeat,
    var(--rivet) left bottom / 8px 8px no-repeat, var(--rivet) right bottom / 8px 8px no-repeat;
}
.setup-head h2 { color: var(--brass-hi) !important; }
.setup-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.setup-head h2 { font-family: var(--font-label); font-size: 30px; font-weight: 700; letter-spacing: 1px; text-transform: uppercase; color: #fff; }
.setup-head span { font-family: var(--font-label); font-size: 13px; letter-spacing: 2px; text-transform: uppercase; color: var(--muted); }
.field { display: flex; flex-direction: column; gap: 8px; }
.label { font-family: var(--font-label); font-size: 12px; letter-spacing: 2px; text-transform: uppercase; color: var(--muted); }
.label.accent { color: var(--accent); font-size: 13px; }

.faction-cards { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.faction-card {
  display: flex;
  flex-direction: column;
  padding: 0;
  background: #121417;
  border: 1px solid #3a4148;
  overflow: hidden;
  cursor: pointer;
  text-align: left;
}
.faction-card:hover { border-color: var(--card-accent); }
.faction-card.active { background: #1d2126; border: 2px solid var(--card-accent); }
.faction-card .pic { position: relative; height: 104px; background: var(--card-bg); }
.faction-card .pic img { width: 100%; height: 104px; object-fit: cover; display: block; }
.faction-card .pic::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 4px; background: var(--card-accent); }
.faction-card .txt { display: flex; flex-direction: column; gap: 2px; padding: 10px 12px 12px; }
.faction-card .country { font-family: var(--font-label); font-size: 12px; letter-spacing: 2px; text-transform: uppercase; color: var(--card-accent); }
.faction-card .name { font-family: var(--font-label); font-size: 18px; font-weight: 700; line-height: 1.05; text-transform: uppercase; color: #fff; }
.faction-card .tag { font-size: 12px; color: #b9b9b9; }

.faction-detail {
  display: flex;
  gap: 18px;
  padding: 16px 18px;
  background: rgba(255,255,255,0.03);
  border: 1px solid #3a4148;
}
.faction-detail .main { flex: 1; display: flex; flex-direction: column; gap: 6px; }
.faction-detail .title { font-family: var(--font-label); font-size: 22px; font-weight: 700; text-transform: uppercase; color: #fff; }
.faction-detail .motto { font-style: italic; color: var(--accent); }
.faction-detail .body { font-size: 13px; line-height: 1.5; color: var(--soft); }
.faction-detail .divider { width: 1px; background: #3a4148; }
.faction-detail .side { width: 220px; display: flex; flex-direction: column; gap: 4px; font-size: 13px; }
.faction-detail .side .label { margin-top: 4px; }

.setup-row { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
select, input[type="number"], input[type="text"] {
  height: 44px;
  padding: 0 10px;
  background: #0f1113;
  border: 1px solid #4a535c;
  color: #fff;
  font-family: var(--font-label);
  font-size: 17px;
  font-weight: 600;
  width: 100%;
}
.segmented { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); height: 44px; border: 1px solid #4a535c; }
.segmented button { border: 0; background: transparent; color: var(--soft); font-family: var(--font-label); font-size: 16px; font-weight: 600; text-transform: uppercase; cursor: pointer; }
.segmented button.on { background: var(--accent); color: #111; font-weight: 700; }
.setup-actions { display: flex; justify-content: flex-end; gap: 12px; flex-wrap: wrap; }

.nav-item:not(.primary) svg { display: none; }

/* Multiplayer lobby */
.mp-form { display: flex; flex-direction: column; gap: 18px; }
.mp-row { align-items: end; }
.mp-host-btn .btn-primary { height: 44px; padding: 0 18px; font-size: 17px; clip-path: polygon(10px 0, 100% 0, 100% calc(100% - 10px), calc(100% - 10px) 100%, 0 100%, 0 10px); }
.mp-or { display: flex; align-items: center; gap: 12px; font-family: var(--font-label); font-size: 12px; letter-spacing: 2px; text-transform: uppercase; color: var(--muted); }
.mp-or::before, .mp-or::after { content: ""; flex: 1; height: 1px; background: #3a4148; }
.mp-join { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 14px; align-items: end; }
.mp-join .btn-ghost, .mp-link .btn-ghost { height: 44px; font-size: 16px; padding: 0 20px; }
#mp-code { text-transform: uppercase; letter-spacing: 6px; }
.mp-wait { display: flex; flex-direction: column; gap: 12px; }
.mp-link { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px; }
#mp-link { font-family: var(--font-text); font-size: 15px; font-weight: 500; user-select: all; }
.mp-status { display: flex; gap: 12px; align-items: center; color: var(--soft); font-size: 15px; line-height: 1.5; }
.mp-status b { font-family: var(--font-label); font-size: 20px; letter-spacing: 4px; color: var(--accent); }
.mp-msg { padding: 10px 14px; border-left: 3px solid #ff5a36; background: rgba(255,90,54,0.1); color: #ffd2c6; font-size: 14px; }
.spinner { flex: none; width: 18px; height: 18px; border: 2px solid var(--line); border-top-color: var(--accent); border-radius: 50%; animation: spin 0.9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spinner { animation-duration: 3s; } }

/* ---------------- Game ---------------- */

/* Copper, brass and oxblood leather, after Aran's steampunk reference. */
#game {
  position: fixed;
  inset: 0;
  font-family: var(--font-text);
  --copper-hi: #f6c48a;
  --copper: #c07a3e;
  --copper-mid: #8e4f22;
  --copper-lo: #4a2410;
  --leather: #7a1e14;
  --leather-lo: #3c0c07;
  --cream: #f6e6c4;
  --wood: #2a1a10;
  --gear: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100'%3E%3Cdefs%3E%3ClinearGradient id='g' x1='0' y1='0' x2='1' y2='1'%3E%3Cstop offset='0' stop-color='%23f2b878'/%3E%3Cstop offset='.45' stop-color='%23a8622c'/%3E%3Cstop offset='1' stop-color='%234a2410'/%3E%3C/linearGradient%3E%3C/defs%3E%3Cpath fill='url(%23g)' stroke='%232a1408' stroke-width='1.5' fill-rule='evenodd' d='M44.8%2010.3%20L46.2%202.1%20L53.8%202.1%20L55.2%2010.3%20L65.3%2013.0%20L70.7%206.7%20L77.2%2010.4%20L74.4%2018.3%20L81.7%2025.6%20L89.6%2022.8%20L93.3%2029.3%20L87.0%2034.7%20L89.7%2044.8%20L97.9%2046.2%20L97.9%2053.8%20L89.7%2055.2%20L87.0%2065.3%20L93.3%2070.7%20L89.6%2077.2%20L81.7%2074.4%20L74.4%2081.7%20L77.2%2089.6%20L70.7%2093.3%20L65.3%2087.0%20L55.2%2089.7%20L53.8%2097.9%20L46.2%2097.9%20L44.8%2089.7%20L34.7%2087.0%20L29.3%2093.3%20L22.8%2089.6%20L25.6%2081.7%20L18.3%2074.4%20L10.4%2077.2%20L6.7%2070.7%20L13.0%2065.3%20L10.3%2055.2%20L2.1%2053.8%20L2.1%2046.2%20L10.3%2044.8%20L13.0%2034.7%20L6.7%2029.3%20L10.4%2022.8%20L18.3%2025.6%20L25.6%2018.3%20L22.8%2010.4%20L29.3%206.7%20L34.7%2013.0%20Z%20M50%2034a16%2016%200%201%200%200.01%200Z'/%3E%3Ccircle cx='50' cy='50' r='26' fill='none' stroke='%232a1408' stroke-width='3' opacity='.5'/%3E%3C/svg%3E");
}

#viewport { position: absolute; inset: 0; overflow: hidden; container-type: inline-size; }
#view { position: absolute; inset: 0; width: 100%; height: 100%; display: block; cursor: default; }
#view.cursor-attack { cursor: crosshair; }
#view.cursor-place { cursor: copy; }
#game.spectating #buildpanel, #game.spectating #mapblock .gauge, #game.spectating .plate { display: none; }

/* A thick copper frame with bolts in the corners and dark wood-and-iron inside. */
.copper {
  position: relative;
  background:
    radial-gradient(130% 90% at 50% 0%, rgba(255,190,120,0.08), transparent 60%),
    repeating-linear-gradient(90deg, rgba(0,0,0,0.06) 0 2px, transparent 2px 7px),
    linear-gradient(180deg, #33200f, #1c120a);
  border: 6px solid transparent;
  border-image: linear-gradient(150deg, var(--copper-hi) 0%, var(--copper) 18%, var(--copper-lo) 45%, var(--copper-mid) 65%, var(--copper-hi) 85%, var(--copper) 100%) 1;
  box-shadow: inset 0 0 0 2px rgba(0,0,0,0.65), inset 0 3px 14px rgba(0,0,0,0.7), 0 12px 30px rgba(0,0,0,0.6);
}
.copper::before {
  content: "";
  position: absolute;
  inset: -6px;
  pointer-events: none;
  --bolt: radial-gradient(circle at 40% 35%, #ffe2b8 0 1.4px, var(--copper) 2.6px, var(--copper-lo) 4px, rgba(0,0,0,0.6) 4.6px, transparent 5.2px);
  background: var(--bolt) left 0 top 0 / 12px 12px no-repeat, var(--bolt) right 0 top 0 / 12px 12px no-repeat,
    var(--bolt) left 0 bottom 0 / 12px 12px no-repeat, var(--bolt) right 0 bottom 0 / 12px 12px no-repeat;
  z-index: 3;
}
/* Oxblood leather: buttons and plates. */
.leather {
  background:
    radial-gradient(120% 140% at 30% 20%, rgba(255,140,110,0.22), transparent 55%),
    repeating-radial-gradient(circle at 20% 30%, rgba(0,0,0,0.05) 0 1px, transparent 1px 3px),
    linear-gradient(180deg, var(--leather), var(--leather-lo));
}

/* ---------- banner (top centre) ---------- */

.banner {
  position: absolute;
  top: 10px;
  right: 10px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 6px 8px 6px 18px;
  background:
    radial-gradient(120% 140% at 30% 20%, rgba(255,140,110,0.25), transparent 55%),
    linear-gradient(180deg, #8a2417, #3c0c07);
  border: 4px solid transparent;
  border-image: linear-gradient(150deg, var(--copper-hi), var(--copper) 25%, var(--copper-lo) 50%, var(--copper) 75%, var(--copper-hi)) 1;
  box-shadow: inset 0 0 0 1px rgba(0,0,0,0.6), 0 8px 20px rgba(0,0,0,0.55);
  white-space: nowrap;
  z-index: 2;
}
#banner-title {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  font-family: var(--font-label);
  font-size: 20px;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--cream);
  text-shadow: 0 2px 0 rgba(0,0,0,0.6);
}
#clock {
  padding: 1px 9px;
  font-family: var(--font-label);
  font-size: 19px;
  font-weight: 700;
  color: #ffd98a;
  background: #140906;
  box-shadow: inset 0 2px 5px rgba(0,0,0,0.9), 0 0 0 2px var(--copper-mid);
  font-variant-numeric: tabular-nums;
}
.top-buttons { display: flex; gap: 4px; }
.icon-btn {
  width: 32px;
  height: 30px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid var(--copper-mid);
  background: radial-gradient(circle at 40% 30%, #4a2a16, #1c0f08);
  color: var(--copper-hi);
  cursor: pointer;
}
.icon-btn:hover { border-color: var(--copper-hi); color: #fff; }
.icon-btn:active { transform: translateY(1px); }
.icon-btn.speed { width: auto; padding: 0 8px; font-family: var(--font-label); font-size: 15px; font-weight: 700; }
.icon-btn.on { border-color: #ffd98a; color: #ffd98a; }

/* ---------- resources (top left) ---------- */

.hud { z-index: 2; }
#viewport::after {
  /* A copper steam pipe running behind the bottom panels. */
  content: "";
  position: absolute;
  left: 30px;
  right: 30px;
  bottom: 70px;
  height: 14px;
  border-radius: 7px;
  background: linear-gradient(180deg, var(--copper-lo), var(--copper-hi) 30%, var(--copper) 55%, var(--copper-lo));
  box-shadow: 0 4px 8px rgba(0,0,0,0.5);
  pointer-events: none;
  z-index: 1;
}
#game.spectating #viewport::after { display: none; }

#sidebar {
  position: absolute;
  top: 12px;
  left: 40px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px 40px;
}
.plate {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
  height: 40px;
  min-width: 120px;
  padding: 0 14px 0 26px;
  border: 4px solid transparent;
  border-image: linear-gradient(150deg, var(--copper-hi), var(--copper) 25%, var(--copper-lo) 50%, var(--copper) 75%, var(--copper-hi)) 1;
  background:
    radial-gradient(120% 140% at 30% 20%, rgba(255,140,110,0.22), transparent 55%),
    linear-gradient(180deg, #6d1a11, #320a06);
  box-shadow: inset 0 0 0 1px rgba(0,0,0,0.6), 0 6px 14px rgba(0,0,0,0.5);
}
.plate .medallion {
  position: absolute;
  left: -30px;
  top: 50%;
  transform: translateY(-50%);
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--gear) center / contain no-repeat;
  filter: drop-shadow(0 3px 4px rgba(0,0,0,0.6));
}
.plate .medallion svg { width: 24px; height: 24px; padding: 2px; border-radius: 50%; background: radial-gradient(circle at 40% 35%, #6d1a11, #2a0703); }
.plate-label { font-family: var(--font-label); font-size: 13px; font-weight: 700; letter-spacing: 1.5px; text-transform: uppercase; color: var(--cream); opacity: 0.8; }
#coal, #aether, #power-text, #unitcount { margin-left: auto; font-family: var(--font-label); font-size: 24px; font-weight: 700; color: #ffd98a; font-variant-numeric: tabular-nums; text-shadow: 0 2px 0 rgba(0,0,0,0.6); white-space: nowrap; transition: color 0.2s; }
#power-text, #unitcount, #aether { font-size: 20px; }
#aether { color: #d8c4ff; }
.plate.aether { min-width: 100px; }
.bbtn .bcost .ae { font-style: normal; color: #d8c4ff; margin-left: 3px; }
.plate.army { min-width: 100px; }
#unitcount.full { color: #ff6a50; }
#coal.down { color: #fff4d6; }
.reserve.short { animation: short 0.6s ease-out; }
.reserve.short #coal { color: #ff6a50; }
@keyframes short { 20%, 60% { filter: brightness(1.6) saturate(1.4); } }
.power.low #power-text { color: #ff6a50; animation: blink 0.8s steps(2) infinite; }
@keyframes blink { 50% { opacity: 0.45; } }
.spec { display: flex; gap: 24px; padding: 6px 12px; background: rgba(28,18,10,0.88); box-shadow: 0 0 0 2px var(--copper-mid); margin-left: -30px; }
.spec:empty { display: none; }
.spec .spec-row { font-family: var(--font-label); font-size: 15px; font-weight: 700; text-transform: uppercase; color: var(--cream); }
.spec .spec-row small { display: block; font-size: 12px; color: #c9b38e; letter-spacing: 0.5px; font-weight: 500; }

/* ---------- field telegraph (under the resources) ---------- */

.parchment {
  background:
    radial-gradient(140% 100% at 50% 0%, rgba(255,255,255,0.35), transparent 60%),
    radial-gradient(circle at 85% 90%, rgba(120,70,20,0.25), transparent 40%),
    #e9d6ac;
  border: 4px solid transparent;
  border-image: linear-gradient(150deg, var(--copper-hi), var(--copper) 25%, var(--copper-lo) 50%, var(--copper) 75%, var(--copper-hi)) 1;
  box-shadow: inset 0 0 18px rgba(110,60,15,0.45), 0 8px 20px rgba(0,0,0,0.55);
}
#toasts-wrap {
  position: absolute;
  left: 10px;
  top: 66px;
  width: min(400px, calc(100% - 20px));
  padding: 8px 10px 4px;
  pointer-events: none;
}
#toasts-wrap:has(#toasts:empty) { display: none; }
#toasts { display: flex; flex-direction: column; gap: 2px; }
.toast {
  display: flex;
  align-items: baseline;
  gap: 6px;
  color: #2b1a0c;
  font-family: var(--font-type);
  font-size: 14px;
  line-height: 1.3;
  animation: toast-in 0.25s ease-out, toast-out 0.8s ease-in 7.2s forwards;
}
.toast .msg::before { content: "[Telegraph] "; color: #7a4a1c; }
.toast.bad .msg { color: #8e1a0e; }
.toast.bad .msg::before { content: "[Urgent] "; color: #b3261e; }
.toast .times { font-family: var(--font-label); font-weight: 700; color: #7a4a1c; }
.toast:not(:last-child) { opacity: 0.7; }
.telegraph-head { margin-top: 4px; padding-top: 2px; border-top: 1px solid rgba(90,50,15,0.4); font-family: var(--font-label); font-size: 12px; font-weight: 700; letter-spacing: 1px; color: #7a4a1c; }
@keyframes toast-in { from { opacity: 0; transform: translateX(-10px); } }
@keyframes toast-out { to { opacity: 0; } }

/* ---------- command panel (bottom left) ---------- */

#game { --bar-h: 236px; --cmd-w: 430px; --map-w: 250px; }
#buildpanel {
  position: absolute;
  left: 10px;
  bottom: 10px;
  width: var(--cmd-w);
  height: var(--bar-h);
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 10px 12px 8px;
}
#buildpanel .gear { position: absolute; background: var(--gear) center / contain no-repeat; pointer-events: none; filter: drop-shadow(0 4px 6px rgba(0,0,0,0.6)); z-index: -1; }
#buildpanel .gear-a { width: 110px; height: 110px; right: -34px; top: -52px; animation: spin 40s linear infinite; }
#buildpanel .gear-b { width: 64px; height: 64px; right: 62px; top: -36px; animation: spin 23s linear infinite reverse; }
@keyframes spin { to { transform: rotate(360deg); } }

.tabs { display: flex; gap: 8px; padding-left: 18px; }
.tab {
  position: relative;
  height: 38px;
  flex: 1;
  min-width: 0;
  padding: 0 8px 0 26px;
  display: flex;
  align-items: center;
  border: 3px solid transparent;
  border-image: linear-gradient(150deg, var(--copper-hi), var(--copper) 25%, var(--copper-lo) 50%, var(--copper) 75%, var(--copper-hi)) 1;
  background:
    radial-gradient(120% 140% at 30% 20%, rgba(255,140,110,0.22), transparent 55%),
    linear-gradient(180deg, #6d1a11, #320a06);
  box-shadow: inset 0 0 0 1px rgba(0,0,0,0.6), 0 4px 10px rgba(0,0,0,0.5);
  color: var(--cream);
  cursor: pointer;
}
.tab.train:not(.shown) { display: none; }
.tab .medal {
  position: absolute;
  left: -24px;
  top: 50%;
  transform: translateY(-50%);
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--gear) center / contain no-repeat;
  filter: drop-shadow(0 3px 4px rgba(0,0,0,0.6));
  color: var(--cream);
}
.tab .medal svg { width: 22px; height: 22px; padding: 3px; border-radius: 50%; background: radial-gradient(circle at 40% 35%, #6d1a11, #2a0703); }
.tab .tab-label { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-family: var(--font-label); font-size: 15px; font-weight: 700; letter-spacing: 0.5px; text-transform: uppercase; text-shadow: 0 2px 0 rgba(0,0,0,0.6); }
.tab .key { position: absolute; right: 3px; top: 0; font-family: var(--font-label); font-size: 10px; font-weight: 700; color: rgba(246,230,196,0.55); }
.tab:hover { filter: brightness(1.18); }
.tab.active {
  background: radial-gradient(120% 140% at 30% 20%, rgba(255,200,150,0.35), transparent 55%), linear-gradient(180deg, #b22c1a, #5a1209);
  box-shadow: inset 0 0 0 1px rgba(0,0,0,0.6), 0 0 14px rgba(255,120,60,0.45);
}
.tab.active .tab-label { color: #fff3d6; }
.tab.active .medal { animation: spin 6s linear infinite; }
.tab.active .medal svg { animation: spin 6s linear infinite reverse; }
.tab .badge {
  position: absolute;
  right: -8px;
  top: -9px;
  min-width: 20px;
  height: 20px;
  padding: 0 5px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  background: radial-gradient(circle at 35% 30%, #ffe08a, #c98a1c);
  border: 2px solid var(--copper-lo);
  color: #2a1408;
  font-family: var(--font-label);
  font-size: 12px;
  font-weight: 700;
  z-index: 1;
}

#tab-extra:empty { display: none; }
.toggle { height: 28px; border: 2px solid var(--copper-mid); background: linear-gradient(180deg, #4a2a16, #1c0f08); color: var(--cream); font-family: var(--font-label); font-size: 13px; font-weight: 700; letter-spacing: 1px; text-transform: uppercase; cursor: pointer; }
.toggle.on { border-color: #ffd98a; color: #ffd98a; }

/* The grid of cameos, like the AoE2 command card. */
.build-grid {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  grid-auto-rows: 74px;
  gap: 8px;
  align-content: start;
  overflow-y: auto;
  padding: 3px;
  scrollbar-width: thin;
  scrollbar-color: var(--copper-mid) transparent;
}
.bbtn {
  position: relative;
  padding: 0;
  overflow: hidden;
  border: 3px solid transparent;
  border-image: linear-gradient(150deg, var(--copper-hi), var(--copper) 25%, var(--copper-lo) 50%, var(--copper) 75%, var(--copper-hi)) 1;
  background: radial-gradient(circle at 50% 35%, #8a2417, #2a0703);
  box-shadow: inset 0 0 10px rgba(0,0,0,0.7);
  cursor: pointer;
}
.bbtn .thumb { position: absolute; inset: 0 0 6px 0; }
.bbtn .bimg { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; pointer-events: none; }
.bbtn .bprog { position: absolute; inset: 0; display: none; background: conic-gradient(rgba(0,0,0,0) 0 calc(var(--p, 0) * 1turn), rgba(10,5,3,0.65) 0); }
.bbtn.building .bprog { display: block; }
.bbtn .bname {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 6px;
  padding: 8px 2px 1px;
  background: linear-gradient(rgba(0,0,0,0), rgba(20,8,4,0.92) 55%);
  font-family: var(--font-label);
  font-size: 10.5px;
  font-weight: 700;
  line-height: 1.05;
  text-transform: uppercase;
  text-align: center;
  color: var(--cream);
}
.bbtn .bcost { position: absolute; left: 0; top: 0; padding: 0 4px; background: rgba(20,8,4,0.8); font-family: var(--font-label); font-size: 12px; font-weight: 700; color: #ffd98a; }
.bbtn .bcount { position: absolute; right: 3px; top: 0; font-family: var(--font-label); font-size: 17px; font-weight: 700; color: #fff; text-shadow: 0 1px 2px #000, 0 0 4px #000; }
.bbtn .bar { position: absolute; left: 0; right: 0; bottom: 0; height: 6px; background: #0c0705; }
.bbtn .bar i { display: block; height: 100%; width: calc(var(--p, 0) * 100%); background: linear-gradient(180deg, #ffe58a, #d39b1c); }
.bbtn.ready .bar i { width: 100%; background: linear-gradient(180deg, #a6f58a, #3fae2a); }
.bbtn .bpct { position: absolute; left: 0; right: 0; top: 18px; text-align: center; font-family: var(--font-label); font-size: 17px; font-weight: 700; color: #fff; text-shadow: 0 1px 3px #000; font-variant-numeric: tabular-nums; }
.bbtn .bready { position: absolute; inset: 0 0 6px; display: none; align-items: center; justify-content: center; background: rgba(10,30,5,0.35); font-family: var(--font-label); font-size: 15px; font-weight: 700; letter-spacing: 2px; text-transform: uppercase; color: #c8ffb0; text-shadow: 0 0 6px #3fae2a, 0 1px 2px #000; animation: blink 0.9s steps(2) infinite; }
.bbtn.ready .bready { display: flex; }
.bbtn .block { position: absolute; right: 3px; top: 3px; display: none; width: 14px; height: 14px; color: var(--cream); }
.bbtn .block svg { width: 100%; height: 100%; }
.bbtn:hover:not(.locked) { filter: brightness(1.2); }
.bbtn:active:not(.locked) { transform: translateY(1px); }
.bbtn.active-q, .bbtn.ready, .bbtn.placing { box-shadow: inset 0 0 10px rgba(0,0,0,0.7), 0 0 12px rgba(255,190,90,0.7); }
.bbtn.locked { cursor: not-allowed; }
.bbtn.locked .thumb { filter: grayscale(1) brightness(0.5); }
.bbtn.locked .block { display: block; }
.bbtn.locked .bcount { display: none; }
.bbtn.locked .bname, .bbtn.locked .bcost { opacity: 0.55; }
.bbtn.poor:not(.locked) .bcost { color: #ff6a50; }
.bbtn.busy { filter: brightness(0.6); }
.bbtn.nope { animation: nope 0.32s ease-in-out; }
@keyframes nope {
  20% { transform: translateX(-4px); filter: brightness(1.6) hue-rotate(-20deg); }
  40% { transform: translateX(4px); }
  60% { transform: translateX(-3px); filter: brightness(1.6) hue-rotate(-20deg); }
  80% { transform: translateX(2px); }
}
.build-hint { font-size: 11.5px; line-height: 1.3; color: #d8c6a2; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---------- map (bottom right) ---------- */

#mapblock { position: absolute; right: 10px; bottom: 10px; width: var(--map-w); }
.radar-block { display: flex; gap: 6px; padding: 6px; height: var(--bar-h); }
.steam-bar { position: relative; width: 14px; flex: none; padding: 2px; background: #0c0705; box-shadow: inset 0 2px 5px rgba(0,0,0,0.9), 0 0 0 2px var(--copper-mid); }
#power-segs { display: flex; flex-direction: column; gap: 2px; height: calc(100% - 22px); }
#power-segs span { flex: 1; background: rgba(255,255,255,0.06); }
#power-segs span.on { background: linear-gradient(90deg, #3aa12a, #8fec6c, #3aa12a); }
#power-used { position: absolute; left: -3px; right: -3px; height: 2px; background: #fff; box-shadow: 0 0 3px #000; transition: bottom 0.3s; }
.steam-bar .bolt { position: absolute; left: 0; right: 0; bottom: 2px; height: 18px; color: #ffd34d; display: flex; justify-content: center; }
.steam-bar .bolt svg { width: 12px; height: 12px; }
#game.low-power #power-segs span.on { background: var(--bad); animation: blink 0.8s steps(2) infinite; }
.radar { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.radar-title { text-align: center; font-family: var(--font-label); font-size: 13px; font-weight: 700; letter-spacing: 1.5px; text-transform: uppercase; color: var(--cream); background: linear-gradient(180deg, #5a3a1c, #2a170a); box-shadow: 0 0 0 1px var(--copper-mid); }
.radar-glass { position: relative; flex: 1; min-height: 0; background: #18251a; overflow: hidden; box-shadow: inset 0 0 18px rgba(0,0,0,0.9), 0 0 0 2px var(--copper-mid); }
.radar-glass::after { content: ""; position: absolute; inset: 0; pointer-events: none; background: radial-gradient(110% 80% at 25% 10%, rgba(255,255,255,0.1), transparent 45%), radial-gradient(closest-side, transparent 78%, rgba(0,0,0,0.4)); }
#minimap { display: block; width: 100%; height: 100%; cursor: pointer; object-fit: fill; }
#mapblock .gauge { position: absolute; left: -44px; top: -50px; z-index: 4; }
.dial { width: 88px; height: 88px; display: block; filter: drop-shadow(0 4px 6px rgba(0,0,0,0.6)); }
.dial-rim { fill: #6b3a18; stroke: var(--copper-hi); stroke-width: 2.5; }
.dial-face { fill: #f1e3c2; stroke: #3a1d0a; stroke-width: 1; }
.dial-ticks line { stroke: #3b2310; stroke-width: 1.4; }
.dial-red { fill: none; stroke: #c0281c; stroke-width: 5; }
.dial-word { font-family: var(--font-label); font-size: 7px; font-weight: 700; letter-spacing: 1px; fill: #5a3a1c; text-anchor: middle; }
.needle { transform-origin: 32px 32px; transition: transform 0.6s cubic-bezier(.3,1.6,.5,1); }
.needle path { fill: #9a1a10; }
.hub { fill: var(--copper-lo); stroke: var(--copper-hi); stroke-width: 1; }
#game.low-power .needle { animation: shudder 0.15s linear infinite alternate; }
@keyframes shudder { to { translate: 0.5px 0; } }

/* ---------- selected unit (bottom centre) ---------- */

.selection {
  position: absolute;
  left: calc(var(--cmd-w) + 24px);
  bottom: 10px;
  width: min(620px, calc(100% - var(--cmd-w) - var(--map-w) - 48px));
  height: calc(var(--bar-h) - 40px);
  display: flex;
  gap: 14px;
  padding: 10px 12px;
}
.selection .portrait { position: relative; width: 140px; height: 100%; flex: none; overflow: hidden; background: radial-gradient(circle at 50% 35%, #8a2417, #2a0703); box-shadow: 0 0 0 3px var(--copper-mid), 0 0 0 4px var(--copper-lo), inset 0 0 14px rgba(0,0,0,0.75); }
.selection .portrait img { width: 100%; height: 100%; object-fit: cover; display: block; }
.selection .portrait .count { position: absolute; left: 0; top: 0; padding: 0 8px; background: linear-gradient(180deg, var(--copper-hi), var(--copper)); color: #2a1408; font-family: var(--font-label); font-size: 17px; font-weight: 700; }
.selection .info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.selection .title { display: flex; flex-direction: column; gap: 2px; }
.selection h3 { font-family: var(--font-label); font-size: 23px; font-weight: 700; color: var(--cream); line-height: 1; text-shadow: 0 2px 0 rgba(0,0,0,0.6); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.selection .role { font-family: var(--font-label); font-size: 13px; letter-spacing: 1.5px; text-transform: uppercase; color: #e0a96a; }
.selection.enemy h3 { color: #ffb4a3; }
.selection.enemy .role { color: #ff7a60; }
.selection .hp { display: flex; align-items: center; gap: 8px; }
.selection .hp::before { content: "Health"; font-family: var(--font-label); font-size: 15px; font-weight: 600; color: var(--cream); }
.selection .pips { flex: 1; min-width: 70px; max-width: 220px; display: flex; padding: 2px; background: #0c0705; box-shadow: inset 0 1px 3px rgba(0,0,0,0.9), 0 0 0 2px var(--copper-mid); }
.selection .pips span { flex: 1; height: 12px; background: rgba(255,255,255,0.05); }
.selection .pips.good span.on { background: linear-gradient(180deg, #a6f58a, #3fae2a 60%, #2a7a1c); }
.selection .pips.warn span.on { background: linear-gradient(180deg, #ffe58a, #d39b1c 60%, #8a5a0c); }
.selection .pips.bad span.on { background: linear-gradient(180deg, #ff9a7a, #c02a18 60%, #7a1408); }
.selection .hp-text { font-family: var(--font-label); font-size: 15px; font-weight: 700; color: var(--cream); font-variant-numeric: tabular-nums; }
.selection .stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
.selection .stat { display: flex; flex-direction: column; padding: 2px 8px; min-width: 0; background: rgba(0,0,0,0.4); box-shadow: 0 0 0 1px var(--copper-mid); }
.selection .stat .k { font-family: var(--font-label); font-size: 10px; letter-spacing: 1.5px; text-transform: uppercase; color: #c9a06a; }
.selection .stat .v { font-family: var(--font-label); font-size: 16px; font-weight: 700; color: var(--cream); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.selection .note { font-size: 13px; line-height: 1.35; color: #d8c6a2; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.selection .groups { display: flex; flex-wrap: wrap; gap: 6px; }
.selection .chip { position: relative; width: 58px; height: 44px; padding: 0; overflow: hidden; cursor: pointer; border: 0; background: radial-gradient(circle at 50% 35%, #8a2417, #2a0703); box-shadow: 0 0 0 2px var(--copper-mid); }
.selection .chip:hover { box-shadow: 0 0 0 2px var(--copper-hi); }
.selection .chip img { width: 100%; height: 100%; object-fit: cover; display: block; }
.selection .chip b { position: absolute; right: 3px; bottom: 0; font-family: var(--font-label); font-size: 15px; color: #fff; text-shadow: 0 1px 2px #000; }
.selection .actions { flex: none; display: grid; grid-template-columns: repeat(2, 50px); grid-auto-rows: 50px; gap: 8px; align-content: start; padding-top: 2px; }
.ability {
  position: relative;
  padding: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  border: 3px solid transparent;
  border-image: linear-gradient(150deg, var(--copper-hi), var(--copper) 25%, var(--copper-lo) 50%, var(--copper) 75%, var(--copper-hi)) 1;
  background: radial-gradient(120% 140% at 30% 20%, rgba(255,140,110,0.25), transparent 55%), linear-gradient(180deg, #8a2417, #3c0c07);
  color: #ffd98a;
  cursor: pointer;
}
.ability svg { width: 20px; height: 20px; }
.ability .key { position: absolute; left: 2px; top: 0; font-family: var(--font-label); font-size: 10px; font-weight: 700; color: rgba(246,230,196,0.6); }
.ability .lbl { font-family: var(--font-label); font-size: 10px; letter-spacing: 0.5px; text-transform: uppercase; color: var(--cream); line-height: 1; }
.ability:hover { filter: brightness(1.2); }
.ability:active { transform: translateY(1px); }


.paused {
  position: absolute;
  left: 50%;
  top: 38%;
  transform: translate(-50%, -50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 16px 48px;
  pointer-events: none;
}
.paused span { font-family: var(--font-label); font-size: 42px; font-weight: 700; letter-spacing: 9px; text-transform: uppercase; color: var(--cream); line-height: 1; text-shadow: 0 2px 0 #000; }
.paused small { font-family: var(--font-label); font-size: 13px; letter-spacing: 2px; text-transform: uppercase; color: #e0a96a; }

/* ---------- smaller windows ---------- */

@media (max-height: 820px) {
  #game { --bar-h: 206px; --map-w: 220px; }
  .build-grid { grid-auto-rows: 58px; gap: 6px; }
  #buildpanel { gap: 6px; padding-top: 8px; }
  .tab { height: 34px; }
  .dial { width: 74px; height: 74px; }
  #mapblock .gauge { left: -36px; top: -42px; }
}
@media (max-height: 640px) {
  #game { --bar-h: 180px; --map-w: 190px; }
  .build-hint { display: none; }
}
@container (max-width: 1280px) {
  #game { --cmd-w: 380px; }
  .build-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .selection .portrait { width: 110px; }
  #banner-title { max-width: 260px; }
}
@container (max-width: 1060px) {
  #game { --cmd-w: 330px; --map-w: 200px; }
  .tab .tab-label { font-size: 13px; }
  .selection .portrait { display: none; }
  .selection .stats { display: none; }
  #banner-title { display: none; }
}
@container (max-width: 860px) {
  #game { --cmd-w: 290px; --map-w: 170px; }
  .build-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .tab .tab-label, .tab .key { display: none; }
  .tab { padding: 0; justify-content: center; }
  .selection .actions { grid-template-columns: repeat(2, 42px); grid-auto-rows: 42px; }
  .ability .lbl { display: none; }
  #mapblock .gauge { display: none; }
}


/* ---------------- Tooltip and overlays ---------------- */

.tooltip {
  --accent: #ffb81c;
  position: fixed;
  max-width: 290px;
  padding: 10px 12px;
  background: linear-gradient(180deg, var(--iron-2), var(--iron));
  border: 2px solid var(--brass-mid);
  box-shadow: 0 0 0 1px var(--brass-lo), 0 10px 24px rgba(0,0,0,0.55);
  font-size: 12px;
  line-height: 1.45;
  color: #e6dcc6;
  pointer-events: none;
  z-index: 50;
}
.tooltip h4 { margin: 0 0 2px; font-family: var(--font-label); font-weight: 700; font-size: 17px; text-transform: uppercase; letter-spacing: 0.5px; color: var(--brass-hi); }
.tooltip .tt-role { font-family: var(--font-label); color: var(--accent); text-transform: uppercase; letter-spacing: 1px; font-size: 12px; margin-bottom: 4px; }
.tooltip .tt-req { color: #ff8f7a; margin-top: 6px; font-weight: 600; }
.tooltip .tt-stats { color: #f2e6cc; margin-top: 6px; font-family: var(--font-label); font-size: 13px; letter-spacing: 0.3px; }
.tooltip .tt-hint { margin-top: 8px; padding-top: 6px; border-top: 1px solid var(--brass-lo); font-size: 11px; color: #a89c84; }

.overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.65);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 40;
  padding: 16px;
}
.overlay-card {
  max-width: 600px;
  max-height: calc(100vh - 32px);
  overflow-y: auto;
  padding: 28px;
  background: rgba(20,23,27,0.97);
  border: 1px solid #4a535c;
  line-height: 1.55;
  clip-path: polygon(24px 0, 100% 0, 100% calc(100% - 24px), calc(100% - 24px) 100%, 0 100%, 0 24px);
  --accent: #ffb81c;
}
/* In game, overlays wear the brass skin too. */
#game .overlay-card, #help.in-game .overlay-card {
  clip-path: none;
  background: linear-gradient(180deg, var(--iron-2), var(--iron));
  border: 3px solid transparent;
  border-image: linear-gradient(155deg, var(--brass-hi) 0%, var(--brass) 22%, var(--brass-lo) 48%, var(--brass-mid) 70%, var(--brass-hi) 100%) 1;
  box-shadow: 0 16px 40px rgba(0,0,0,0.6);
}
#game .overlay-card { --accent: inherit; }
.overlay-card h2 { font-family: var(--font-label); font-size: 32px; font-weight: 700; text-transform: uppercase; letter-spacing: 1px; color: #fff; margin-bottom: 8px; }
#game .overlay-card h2 { color: var(--brass-hi); }
.overlay-card ul { padding-left: 18px; color: var(--soft); }
#help .overlay-card { max-width: 860px; }
.keys { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 32px; margin-top: 8px; }
.keys h3 { font-family: var(--font-label); font-size: 13px; font-weight: 600; letter-spacing: 2px; text-transform: uppercase; color: var(--accent); margin-bottom: 8px; }
.keys dl { display: grid; grid-template-columns: max-content 1fr; gap: 7px 14px; margin: 0; font-size: 13px; line-height: 1.4; }
.keys dt { white-space: nowrap; color: #fff; }
.keys dd { margin: 0; color: var(--soft); }
.help-tip { margin: 16px 0 0; padding: 10px 12px; border-left: 3px solid var(--accent); background: rgba(255,255,255,0.04); font-size: 13px; color: var(--soft); }
@media (max-width: 760px) { .keys { grid-template-columns: 1fr; } }
#end-title[data-result="won"] { color: var(--accent) !important; }
#end-title[data-result="lost"] { color: var(--bad) !important; }
.overlay-card b { color: #fff; font-weight: 600; }
.overlay-actions { display: flex; gap: 10px; margin-top: 16px; flex-wrap: wrap; }
#end-stats { display: grid; grid-template-columns: 1fr auto auto auto; gap: 6px 20px; margin-top: 14px; padding: 12px 14px; background: #0f0d0b; box-shadow: inset 0 2px 6px rgba(0,0,0,0.85), 0 0 0 1px var(--brass-lo); font-family: var(--font-label); font-size: 17px; font-variant-numeric: tabular-nums; }
#end-stats .h { font-family: var(--font-label); letter-spacing: 1.5px; text-transform: uppercase; color: var(--muted); font-size: 12px; }

/* Laptop-height screens: tighten the menu so Start stays in view. */
@media (max-height: 820px) and (min-width: 1101px) {
  #menu { padding: 36px 40px; gap: 48px; }
  .menu-intro { gap: 10px; }
  .menu-intro h1 { font-size: 68px; }
  .menu-intro .sub { margin-bottom: 8px; font-size: 15px; }
  .setup { gap: 16px; padding: 22px 24px; }
  .faction-card .pic, .faction-card .pic img { height: 84px; }
  .faction-card .txt { padding: 8px 10px 10px; }
  .faction-detail { padding: 12px 16px; }
  .btn-primary, .btn-ghost { height: 50px; }
}

@media (max-width: 1100px) {
  #menu { flex-direction: column; align-items: stretch; padding: 32px 16px; gap: 28px; }
  .menu-intro { width: auto; }
  .menu-intro h1 { font-size: 56px; }
}
@media (max-width: 760px) {
  .faction-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .setup-row { grid-template-columns: 1fr; }
  .faction-detail { flex-direction: column; }
  .faction-detail .divider { display: none; }
}

/* Player vs player: stalled-on-peer notice and the connection badge. */
.net-wait {
  position: absolute; left: 50%; top: 84px; transform: translateX(-50%);
  display: flex; gap: 10px; align-items: center; padding: 10px 16px;
  background: linear-gradient(180deg, #6d1a11, #320a06); border: 3px solid var(--copper, #c07a3e); color: var(--cream, #fff);
  font-family: var(--font-label); font-size: 16px; letter-spacing: 1px; text-transform: uppercase;
  pointer-events: none; z-index: 20;
}
.net-badge {
  /* Under the banner, clear of the minimap. */
  position: absolute; right: 12px; top: 62px; padding: 4px 10px;
  background: rgba(0,0,0,0.55); border: 1px solid var(--line); color: var(--soft);
  font-family: var(--font-label); font-size: 12px; letter-spacing: 1.5px; text-transform: uppercase;
  pointer-events: none;
}
@media (max-width: 760px) { .mp-join, .mp-link { grid-template-columns: 1fr; } }

.mp-msg.info { border-left-color: var(--accent); background: rgba(255,255,255,0.06); color: var(--soft); }
