:root {
  color-scheme: dark;
  --bg: #030907;
  --surface: #07130f;
  --surface-2: #0b1b15;
  --surface-3: #10271e;
  --line: rgba(156, 211, 178, 0.14);
  --line-strong: rgba(156, 211, 178, 0.28);
  --text: #e7f4ea;
  --muted: #86a492;
  --blue: #51b9ff;
  --blue-strong: #168dd8;
  --red: #ff635f;
  --red-strong: #c8333a;
  --amber: #f6c35b;
  --green: #72e3a1;
  --shadow: 0 22px 64px rgba(0, 0, 0, 0.38);
  font-family: "Segoe UI", "Arial Hebrew", Arial, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  width: 100%;
  min-width: 980px;
  height: 100%;
  margin: 0;
  overflow: hidden;
  background: var(--bg);
  color: var(--text);
}

button { font: inherit; }

button:focus-visible {
  outline: 2px solid var(--amber);
  outline-offset: 2px;
}

.app-shell {
  height: 100vh;
  display: grid;
  grid-template-rows: 72px minmax(0, 1fr);
  background:
    radial-gradient(circle at 48% -20%, rgba(63, 145, 105, 0.16), transparent 36%),
    var(--bg);
}

.topbar {
  position: relative;
  z-index: 20;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 24px;
  padding: 0 22px;
  border-bottom: 1px solid var(--line-strong);
  background: rgba(3, 9, 7, 0.94);
  backdrop-filter: blur(18px);
  direction: ltr;
}

.brand-block {
  justify-self: start;
  direction: ltr;
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-block h1 {
  margin: 2px 0 0;
  font-size: 20px;
  letter-spacing: 0.12em;
  font-weight: 760;
}

/* Command Fall's mark (14 Nov 2026): a picture, brand/mark.svg (made by tools/icons/make-icons.mjs). It is taller than
   wide, so only its height is set. */
.brand-mark { display: block; flex: none; width: auto; height: 42px; }

.eyebrow {
  margin: 0;
  color: var(--muted);
  font-size: 9px;
  line-height: 1;
  font-weight: 700;
  letter-spacing: 0.15em;
  text-transform: uppercase;
}

.phase-block {
  direction: var(--ui-dir, rtl);
  display: grid;
  grid-template-columns: auto auto;
  align-items: center;
  justify-content: center;
  gap: 2px 12px;
  text-align: center;
}

.phase-block strong {
  direction: ltr;
  font-variant-numeric: tabular-nums;
  font-size: 21px;
  letter-spacing: 0.08em;
}

.phase-block small {
  grid-column: 1 / -1;
  color: var(--muted);
  font-size: 11px;
}

.phase-pill {
  padding: 5px 10px;
  border: 1px solid rgba(246, 195, 91, 0.3);
  border-radius: 999px;
  color: var(--amber);
  background: rgba(246, 195, 91, 0.08);
  font-size: 11px;
  font-weight: 700;
}

.icon-button {
  justify-self: end;
  width: 38px;
  height: 38px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  color: var(--muted);
  background: rgba(255,255,255,0.025);
  cursor: pointer;
}

.icon-button:hover { color: var(--text); background: rgba(255,255,255,0.06); }

.top-actions {
  justify-self: end;
  display: flex;
  align-items: center;
  gap: 8px;
}

.tutorial-button {
  height: 38px;
  padding: 0 13px;
  border: 1px solid rgba(246,195,91,.35);
  border-radius: 8px;
  color: var(--amber);
  background: rgba(246,195,91,.07);
  cursor: pointer;
  font-size: 11px;
  font-weight: 700;
}
.tutorial-button:hover { background: rgba(246,195,91,.13); }

.command-layout {
  min-height: 0;
  display: grid;
  grid-template-columns: 240px minmax(480px, 1fr) 270px;
  direction: ltr;
}

.panel {
  direction: var(--ui-dir, rtl);
  min-height: 0;
  padding: 15px;
  background: linear-gradient(180deg, rgba(7,19,15,0.98), rgba(4,12,9,0.98));
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--line-strong) transparent;
}

.build-panel { border-right: 1px solid var(--line-strong); }
.intel-panel { border-left: 1px solid var(--line-strong); }

.panel-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--line);
}

.panel-heading.compact { align-items: center; }

.panel-heading h2 {
  margin: 6px 0 0;
  font-size: 17px;
  font-weight: 650;
}

.credit-stack { text-align: left; }
.credit-stack strong {
  display: block;
  color: var(--amber);
  font-size: 27px;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}
.credit-stack span { color: var(--muted); font-size: 10px; }

.income-row {
  display: flex;
  justify-content: space-between;
  padding: 10px 0;
  color: var(--muted);
  font-size: 11px;
  border-bottom: 1px solid var(--line);
}
.income-row strong { color: var(--green); font-weight: 600; }

.panel-section { padding-top: 18px; }

.section-label {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 10px;
  margin-bottom: 10px;
}

.section-label > span { font-size: 12px; font-weight: 700; }
.section-label small { color: var(--muted); font-size: 9px; text-align: left; }
.section-label button {
  border: 0;
  padding: 0;
  color: var(--muted);
  background: none;
  font-size: 10px;
  cursor: pointer;
}

.build-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.build-card {
  position: relative;
  min-height: 70px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  text-align: right;
  color: var(--text);
  background: rgba(255,255,255,0.025);
  cursor: pointer;
  transition: border-color .18s ease, transform .18s ease, background .18s ease;
}

.build-card:hover:not(:disabled) {
  transform: translateY(-1px);
  border-color: rgba(81,185,255,0.45);
  background: rgba(81,185,255,0.06);
}

.build-card.active {
  border-color: var(--blue);
  box-shadow: inset 0 0 0 1px rgba(81,185,255,0.2);
  background: rgba(81,185,255,0.1);
}

.build-card:disabled { opacity: 0.38; cursor: not-allowed; }
.build-card .card-icon { display: block; color: var(--blue); font-size: 20px; line-height: 1; }
.build-card strong { display: block; margin-top: 5px; font-size: 11px; }
.build-card small { display: block; margin-top: 3px; color: var(--muted); font-size: 9px; }
.build-card .card-limit { margin-top: 2px; color: var(--amber); }
.build-card .card-limit.full { color: var(--red, #ff635f); }
.build-card .price {
  position: absolute;
  left: 8px;
  top: 8px;
  color: var(--amber);
  font-size: 10px;
  font-weight: 700;
}

.segmented {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(0,0,0,0.18);
}

.segmented button {
  border: 0;
  padding: 8px 4px;
  border-radius: 6px;
  color: var(--muted);
  background: transparent;
  font-size: 10px;
  cursor: pointer;
}

.segmented button.active { color: var(--text); background: var(--surface-3); }

.primary-action {
  width: 100%;
  margin-top: 18px;
  padding: 12px 14px;
  border: 1px solid rgba(114,227,161,0.48);
  border-radius: 8px;
  color: #031008;
  background: linear-gradient(135deg, #82efad, #46bc7b);
  box-shadow: 0 10px 24px rgba(70,188,123,0.14);
  cursor: pointer;
}

.primary-action:hover { filter: brightness(1.08); }
/* While the opening command sites are being placed: a quieter button for letting the game choose. */
.primary-action.sites-action { color: #d9f6e5; background: rgba(114,227,161,0.1); box-shadow: none; }
.primary-action.sites-action + .primary-action { margin-top: 8px; }
/* Once all three sites stand (or were scattered), the button has nothing left to do. */
.primary-action.sites-action.hidden { display: none; }
.primary-action:disabled { filter: grayscale(1); opacity: .42; cursor: not-allowed; }
.primary-action span, .primary-action > strong { display: block; font-weight: 800; }
.primary-action small { display: block; margin-top: 2px; opacity: .65; font-size: 9px; }

.map-stage {
  position: relative;
  direction: ltr;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  background: #07130f;
}

#gameCanvas {
  display: block;
  width: 100%;
  height: 100%;
  cursor: grab;
  touch-action: none;
}
#gameCanvas:active { cursor: grabbing; }
#gameCanvas.action-mode { cursor: crosshair; }

.satellite-badge {
  position: absolute;
  z-index: 3;
  top: 76px;
  left: 16px;
  direction: ltr;
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 1px 7px;
  align-items: center;
  padding: 7px 9px;
  border: 1px solid rgba(255,255,255,.14);
  border-radius: 7px;
  color: rgba(255,255,255,.82);
  background: rgba(3,9,7,.75);
  backdrop-filter: blur(8px);
  pointer-events: none;
}
.satellite-badge strong { font-size: 8px; letter-spacing: .13em; }
.satellite-badge small { grid-column: 2; direction: var(--ui-dir, rtl); color: var(--muted); font-size: 8px; }
.live-dot { grid-row: span 2; width: 7px; height: 7px; border-radius: 50%; background: var(--green); box-shadow: 0 0 10px rgba(114,227,161,.7); }

.map-controls {
  position: absolute;
  z-index: 9;
  left: 16px;
  top: 130px;
  display: grid;
  width: 38px;
  overflow: hidden;
  border: 1px solid rgba(255,255,255,.18);
  border-radius: 8px;
  background: rgba(3,9,7,.82);
  backdrop-filter: blur(10px);
  box-shadow: var(--shadow);
}
.map-controls button {
  height: 34px;
  border: 0;
  border-bottom: 1px solid var(--line);
  color: var(--text);
  background: transparent;
  cursor: pointer;
  font-size: 18px;
}
.map-controls button:hover { color: var(--amber); background: rgba(255,255,255,.06); }
.map-controls span { padding: 6px 0; color: var(--muted); text-align: center; font-size: 8px; }

.objective-card {
  position: absolute;
  z-index: 8;
  top: 76px;
  right: 16px;
  direction: var(--ui-dir, rtl);
  width: 230px;
  display: grid;
  grid-template-columns: 34px 1fr;
  gap: 3px 9px;
  padding: 10px 11px;
  border: 1px solid rgba(246,195,91,.28);
  border-radius: 8px;
  background: rgba(3,9,7,.82);
  backdrop-filter: blur(10px);
  box-shadow: var(--shadow);
}
.objective-card .eyebrow { grid-column: 1 / -1; }
.objective-card > span { grid-row: 2; display: grid; place-items: center; color: var(--amber); font-size: 22px; font-weight: 800; border-left: 1px solid var(--line); }
.objective-card strong, .objective-card small { display: block; }
.objective-card strong { font-size: 11px; }
.objective-card small { margin-top: 3px; color: var(--muted); font-size: 9px; line-height: 1.35; }

.map-top-overlay {
  position: absolute;
  inset: 14px 16px auto;
  display: grid;
  grid-template-columns: 1fr 1fr;
  align-items: start;
  pointer-events: none;
}

.nation-card {
  width: 190px;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 1px 10px;
  padding: 9px 11px;
  border-radius: 8px;
  background: rgba(3,9,7,0.82);
  backdrop-filter: blur(8px);
  box-shadow: var(--shadow);
}

.nation-card.blue { justify-self: start; border: 1px solid rgba(81,185,255,0.3); }
.nation-card.red { justify-self: end; border: 1px solid rgba(255,99,95,0.3); text-align: right; }
.nation-card span { font-size: 10px; font-weight: 700; }
.nation-card strong { grid-row: span 2; font-size: 21px; font-variant-numeric: tabular-nums; }
.nation-card.blue strong { color: var(--blue); }
.nation-card.red strong { color: var(--red); }
.nation-card small { color: var(--muted); font-size: 9px; }

.conflict-label {
  justify-self: center;
  text-align: center;
  color: rgba(231,244,234,0.42);
  font-size: 9px;
  letter-spacing: .15em;
}
.conflict-label span, .conflict-label small { display: block; }
.conflict-label small { margin-top: 3px; letter-spacing: normal; }

.map-instruction {
  position: absolute;
  left: 50%;
  bottom: 23px;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 9px;
  max-width: 520px;
  padding: 9px 14px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  color: var(--text);
  background: rgba(3,9,7,0.84);
  backdrop-filter: blur(10px);
  box-shadow: var(--shadow);
  pointer-events: none;
}

.map-instruction p { direction: var(--ui-dir, rtl); margin: 0; font-size: 11px; }
.pulse-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--amber);
  box-shadow: 0 0 0 0 rgba(246,195,91,.55);
  animation: pulse 1.8s infinite;
}

@keyframes pulse {
  70% { box-shadow: 0 0 0 8px rgba(246,195,91,0); }
  100% { box-shadow: 0 0 0 0 rgba(246,195,91,0); }
}

.map-legend {
  position: absolute;
  left: 14px;
  bottom: 14px;
  direction: var(--ui-dir, rtl);
  display: flex;
  gap: 12px;
  padding: 7px 9px;
  border-radius: 6px;
  color: var(--muted);
  background: rgba(3,9,7,0.68);
  font-size: 9px;
  pointer-events: none;
}
.map-legend span { display: flex; align-items: center; gap: 5px; }
.legend-dot { width: 7px; height: 7px; border-radius: 50%; }
.legend-dot.friendly { background: var(--blue); }
.legend-dot.detected { background: var(--red); }
.legend-ring { width: 10px; height: 10px; border: 1px dashed var(--red); border-radius: 50%; }

.context-card {
  position: absolute;
  z-index: 33;
  right: 50%;
  bottom: 54px;
  transform: translateX(50%);
  direction: var(--ui-dir, rtl);
  width: min(580px, calc(100vw - 520px));
  min-width: 380px;
  padding: 14px 18px 16px;
  border: 1px solid rgba(81, 185, 255, 0.4);
  border-radius: 12px;
  background: rgba(4, 12, 9, 0.96);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.7), 0 0 0 1px rgba(81, 185, 255, 0.15);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.context-card.hidden { display: none !important; }

.context-card > button#closeContext {
  position: absolute;
  left: 12px;
  top: 10px;
  width: 28px;
  height: 28px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.05);
  font-size: 16px;
  line-height: 1;
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: all 0.15s ease;
  z-index: 5;
}

.context-card > button#closeContext:hover {
  border-color: var(--red);
  color: var(--red);
  background: rgba(255, 99, 95, 0.15);
}

.context-card .eyebrow {
  margin: 0;
  padding-left: 36px;
}

.context-card h3 {
  margin: 2px 0 4px;
  padding-left: 36px;
  font-size: 16px;
  letter-spacing: 0.02em;
}

.context-card > p:not(.eyebrow) {
  margin: 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.5;
}

.context-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin: 0;
  width: 100%;
}

.context-stats span {
  padding: 8px 10px;
  border: 1px solid rgba(81, 185, 255, 0.2);
  border-radius: 6px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.03);
  font-size: 10px;
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.context-stats strong {
  display: block;
  color: var(--text);
  font-size: 13px;
  font-weight: 700;
}

.context-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 2px;
  width: 100%;
}

.context-actions button {
  flex: 1 1 calc(20% - 8px);
  min-width: 80px;
  min-height: 38px;
  padding: 6px 10px;
  border: 1px solid rgba(81, 185, 255, 0.35);
  border-radius: 6px;
  color: var(--text);
  background: rgba(81, 185, 255, 0.09);
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
  text-align: center;
}

.context-actions button:hover:not(:disabled) {
  border-color: var(--blue);
  background: rgba(81, 185, 255, 0.24);
  transform: translateY(-1px);
}

.context-actions button:disabled {
  opacity: 0.35;
  cursor: not-allowed;
  border-color: var(--line);
  background: rgba(255, 255, 255, 0.02);
}

.context-actions button.danger {
  border-color: rgba(255, 99, 95, 0.45);
  color: #ffb8b5;
  background: rgba(255, 99, 95, 0.12);
}

.alert-state {
  padding: 5px 8px;
  border-radius: 999px;
  font-size: 9px;
  font-weight: 700;
}
.alert-state.calm { color: var(--green); background: rgba(114,227,161,.09); }
.alert-state.warning { color: var(--amber); background: rgba(246,195,91,.1); }
.alert-state.critical { color: var(--red); background: rgba(255,99,95,.12); animation: alertFlash .8s infinite alternate; }
@keyframes alertFlash { to { box-shadow: 0 0 16px rgba(255,99,95,.25); } }

.readiness-grid { display: grid; grid-template-columns: repeat(4,1fr); gap: 5px; }
.readiness-grid article {
  padding: 9px 6px;
  border: 1px solid var(--line);
  border-radius: 7px;
  text-align: center;
  background: rgba(255,255,255,.02);
}
.readiness-grid span { display: block; color: var(--muted); font-size: 9px; }
.readiness-grid strong { display: block; margin-top: 4px; font-size: 14px; }

.intel-actions { display: grid; gap: 7px; }
.intel-actions button {
  display: grid;
  grid-template-columns: 30px 1fr;
  gap: 8px;
  align-items: center;
  width: 100%;
  padding: 9px;
  border: 1px solid var(--line);
  border-radius: 8px;
  text-align: right;
  color: var(--text);
  background: rgba(255,255,255,.025);
  cursor: pointer;
}
.intel-actions button:hover:not(:disabled) { border-color: rgba(114,227,161,.4); background: rgba(114,227,161,.05); }
.intel-actions button.active { border-color: var(--green); background: rgba(114,227,161,.09); }
.intel-actions button:disabled { opacity: .35; cursor: not-allowed; }
.intel-actions strong, .intel-actions small { display: block; }
.intel-actions strong { font-size: 10px; }
.intel-actions small { margin-top: 2px; color: var(--muted); font-size: 8px; }
.action-icon { color: var(--green); font-size: 20px; text-align: center; }

.log-section { min-height: 0; }
.event-log {
  display: flex;
  flex-direction: column;
  gap: 7px;
  max-height: 290px;
  margin: 0;
  padding: 0;
  overflow-y: auto;
  list-style: none;
}
.event-log li {
  position: relative;
  padding: 0 12px 0 0;
  color: var(--muted);
  font-size: 9px;
  line-height: 1.5;
}
.event-log li::before {
  position: absolute;
  right: 0;
  top: 5px;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--muted);
  content: "";
}
.event-log li.info::before { background: var(--blue); }
.event-log li.warn::before { background: var(--amber); }
.event-log li.danger::before { background: var(--red); }
.event-log time { direction: ltr; display: inline-block; margin-left: 5px; color: rgba(134,164,146,.55); }

.toast-layer {
  position: fixed;
  z-index: 80;
  top: 84px;
  left: 50%;
  transform: translateX(-50%);
  display: grid;
  gap: 8px;
  pointer-events: none;
}
.toast {
  min-width: 280px;
  padding: 10px 14px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  text-align: center;
  color: var(--text);
  background: rgba(3,9,7,.94);
  box-shadow: var(--shadow);
  animation: toastIn .25s ease-out;
  font-size: 11px;
}
.toast.danger { border-color: rgba(255,99,95,.45); }
.toast.success { border-color: rgba(114,227,161,.45); }
@keyframes toastIn { from { transform: translateY(-8px); opacity: 0; } }

.end-screen {
  position: fixed;
  z-index: 100;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgba(1,5,3,.8);
  backdrop-filter: blur(12px);
}
.end-screen.hidden { display: none; }
.end-card {
  width: min(480px, 90vw);
  padding: 30px;
  border: 1px solid var(--line-strong);
  border-radius: 14px;
  text-align: center;
  background: linear-gradient(180deg, #0b1b15, #06100c);
  box-shadow: var(--shadow);
}
.end-card h2 { margin: 9px 0; font-size: 28px; }
.end-card > p:not(.eyebrow) { color: var(--muted); font-size: 12px; line-height: 1.6; }
.end-stats { display: grid; grid-template-columns: repeat(3,1fr); gap: 8px; margin-top: 20px; }
.end-stats article { padding: 10px; border: 1px solid var(--line); border-radius: 8px; }
.end-stats span { display: block; color: var(--muted); font-size: 9px; }
.end-stats strong { display: block; margin-top: 4px; font-size: 18px; }

.tutorial-overlay {
  position: fixed;
  z-index: 100;
  inset: 0;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 24px;
  background: rgba(1,5,3,.62);
  pointer-events: none;
}
.tutorial-overlay.hidden { display: none; }
.tutorial-card {
  position: relative;
  pointer-events: auto;
  z-index: 105;
  direction: var(--ui-dir, rtl);
  width: min(520px, 92vw);
  margin-bottom: 24px;
  padding: 24px 26px;
  border: 1px solid rgba(246,195,91,.5);
  border-radius: 14px;
  background: linear-gradient(160deg, rgba(14,35,26,.99), rgba(4,13,9,.99));
  box-shadow: 0 28px 100px rgba(0,0,0,.75), 0 0 0 1px rgba(246,195,91,.25);
}
.tutorial-close { position: absolute; left: 13px; top: 10px; border: 0; color: var(--muted); background: none; font-size: 23px; cursor: pointer; }
.tutorial-progress { height: 3px; margin: -24px -26px 20px; overflow: hidden; border-radius: 14px 14px 0 0; background: rgba(255,255,255,.05); }
.tutorial-progress span { display: block; width: 10%; height: 100%; background: linear-gradient(90deg,var(--green),var(--amber)); transition: width .25s ease; }
.tutorial-card h2 { margin: 6px 0 10px; font-size: 20px; }
.tutorial-card > p:not(.eyebrow) { margin: 0; color: #b5cabe; font-size: 13px; line-height: 1.65; }
.tutorial-tip { margin-top: 14px; padding: 10px 12px; border-right: 3px solid var(--amber); color: #dcebe1; background: rgba(246,195,91,.08); font-size: 11px; line-height: 1.55; }
.tutorial-actions { display: grid; grid-template-columns: 1fr 2fr; gap: 9px; margin-top: 18px; }
.tutorial-actions button { min-height: 40px; margin: 0; border-radius: 8px; cursor: pointer; font-size: 12px; font-weight: 700; }
.tutorial-actions > button:first-child { border: 1px solid var(--line-strong); color: var(--muted); background: rgba(255,255,255,.03); }
.tutorial-actions > button:disabled { opacity: .3; cursor: not-allowed; }
.skip-tutorial { width: 100%; margin-top: 11px; border: 0; color: var(--muted); background: none; cursor: pointer; font-size: 11px; }

.tutorial-focus {
  position: relative;
  z-index: 102 !important;
  box-shadow: 0 0 0 3px var(--amber), 0 0 45px rgba(246,195,91,.65) !important;
  pointer-events: auto !important;
}

body.tutorial-open .tutorial-overlay { pointer-events: none; }

.context-card.base-context { border-color: rgba(246,195,91,.38); }
.base-manifest { display: grid; gap: 5px; margin-top: 11px; }
.base-manifest span { display: flex; justify-content: space-between; padding: 6px 8px; border: 1px solid var(--line); border-radius: 5px; color: var(--muted); font-size: 9px; }
.base-manifest strong { color: var(--text); font-size: 9px; }

.view-switch {
  position: absolute;
  z-index: 32;
  top: 17px;
  left: 50%;
  transform: translateX(-50%);
  direction: var(--ui-dir, rtl);
  display: flex;
  padding: 3px;
  border: 1px solid rgba(255,255,255,.18);
  border-radius: 9px;
  background: rgba(3,9,7,.88);
  backdrop-filter: blur(12px);
  box-shadow: 0 12px 30px rgba(0,0,0,.32);
}
.view-switch button {
  position: relative;
  min-width: 93px;
  padding: 7px 11px;
  border: 0;
  border-radius: 6px;
  color: var(--muted);
  background: transparent;
  cursor: pointer;
  font-size: 10px;
  font-weight: 700;
}
.view-switch button.active { color: var(--text); background: rgba(114,227,161,.14); }
.new-chip {
  position: absolute;
  top: -12px;
  left: 5px;
  padding: 2px 5px;
  border-radius: 999px;
  color: #041108;
  background: var(--amber);
  font-size: 7px;
}

.map-instruction .cancel-action {
  margin-right: 7px;
  padding: 5px 8px;
  border: 1px solid rgba(255,99,95,.4);
  border-radius: 999px;
  color: #ffaaa7;
  background: rgba(255,99,95,.08);
  cursor: pointer;
  pointer-events: auto;
  font-size: 9px;
}
.map-instruction .cancel-action.hidden { display: none; }

.three-world {
  position: absolute;
  z-index: 22;
  inset: 0;
  overflow: hidden;
  background: #111b16;
}
.three-world.hidden { display: none; }

body.terrain-lab-open .command-layout { grid-template-columns: minmax(0,1fr); }
body.terrain-lab-open .build-panel,
body.terrain-lab-open .intel-panel { display: none; }
body.terrain-lab-open .map-stage { grid-column: 1; }
#threeCanvas { width: 100%; height: 100%; display: block; outline: none; touch-action: none; -webkit-touch-callout: none; -webkit-user-select: none; user-select: none; -webkit-tap-highlight-color: transparent; }
/* Phones: no page zoom on a double tap, and no grey flash on tapped buttons. */
html { touch-action: manipulation; -webkit-tap-highlight-color: transparent; }
#threeCanvas.action-mode { cursor: crosshair; }

.map-stage.is-3d .satellite-badge,
.map-stage.is-3d .map-controls,
.map-stage.is-3d .objective-card,
.map-stage.is-3d .map-top-overlay,
.map-stage.is-3d .map-instruction,
.map-stage.is-3d .map-legend,
.map-stage.is-3d .context-card { display: none !important; }

.terrain-lab-title {
  position: absolute;
  z-index: 4;
  top: 68px;
  left: 18px;
  direction: var(--ui-dir, rtl);
  width: 225px;
  padding: 12px 14px;
  border: 1px solid rgba(114,227,161,.26);
  border-radius: 10px;
  background: rgba(3,9,7,.82);
  backdrop-filter: blur(12px);
  box-shadow: var(--shadow);
  pointer-events: none;
}
.terrain-lab-title strong, .terrain-lab-title small { display: block; }
.terrain-lab-title strong { margin-top: 6px; font-size: 16px; }
.terrain-lab-title small { margin-top: 4px; color: var(--muted); font-size: 9px; }

.terrain-lab-panel {
  position: absolute;
  z-index: 5;
  top: 68px;
  right: 18px;
  direction: var(--ui-dir, rtl);
  width: 250px;
  padding: 14px;
  border: 1px solid rgba(255,255,255,.18);
  border-radius: 10px;
  background: rgba(3,9,7,.9);
  backdrop-filter: blur(14px);
  box-shadow: var(--shadow);
}
.lab-status-row { display: flex; align-items: center; gap: 9px; }
.lab-status-row small, .lab-status-row strong { display: block; }
.lab-status-row small { color: var(--muted); font-size: 8px; }
.lab-status-row strong { margin-top: 3px; font-size: 11px; }
.lab-state-dot { width: 9px; height: 9px; flex: 0 0 auto; border-radius: 50%; background: var(--green); box-shadow: 0 0 12px rgba(114,227,161,.65); }
.lab-state-dot.busy { background: var(--amber); box-shadow: 0 0 12px rgba(246,195,91,.65); }
.lab-state-dot.danger { background: var(--red); box-shadow: 0 0 12px rgba(255,99,95,.65); }
.lab-metrics { display: grid; grid-template-columns: repeat(3,1fr); gap: 6px; margin-top: 12px; }
.lab-metrics article { padding: 7px 5px; border: 1px solid var(--line); border-radius: 6px; text-align: center; background: rgba(255,255,255,.025); }
.lab-metrics span, .lab-metrics strong { display: block; }
.lab-metrics span { color: var(--muted); font-size: 8px; }
.lab-metrics strong { margin-top: 3px; font-size: 10px; }
.lab-instruction { min-height: 36px; margin: 11px 0; padding: 8px 10px; border-right: 2px solid var(--amber); color: #b9cdc0; background: rgba(246,195,91,.055); font-size: 9px; line-height: 1.55; }
.lab-actions { display: grid; gap: 6px; }
.lab-actions button { display: grid; grid-template-columns: 38px 1fr; align-items: center; min-height: 39px; border: 1px solid var(--line-strong); border-radius: 7px; text-align: right; color: var(--text); background: rgba(255,255,255,.035); cursor: pointer; font-size: 10px; }
.lab-actions button span { color: var(--amber); font-size: 8px; text-align: center; letter-spacing: .08em; }
.lab-actions button:hover:not(:disabled) { border-color: var(--green); background: rgba(114,227,161,.08); }
.lab-actions button:disabled { opacity: .35; cursor: not-allowed; }
.lab-actions button.active { border-color: var(--amber); background: rgba(246,195,91,.1); }
.lab-actions button.track-active { border-color: var(--blue); background: rgba(81,185,255,.11); }
.lab-actions button.track-active span { color: var(--blue); }
.lab-footnote { display: flex; justify-content: space-between; gap: 5px; margin-top: 11px; padding-top: 10px; border-top: 1px solid var(--line); color: var(--muted); font-size: 7px; }
.lab-footnote span { display: flex; align-items: center; gap: 4px; }
.lab-footnote i { width: 8px; height: 8px; display: inline-block; }
.road-key { border-radius: 2px; background: #3c4441; }
.deploy-key { border: 1px solid var(--blue); border-radius: 50%; }
.target-key { border: 1px solid var(--red); transform: rotate(45deg); }

.lab-camera-help {
  position: absolute;
  z-index: 4;
  left: 18px;
  bottom: 18px;
  direction: var(--ui-dir, rtl);
  display: grid;
  grid-template-columns: auto auto;
  gap: 4px 10px;
  padding: 9px 11px;
  border-radius: 7px;
  color: var(--muted);
  background: rgba(3,9,7,.78);
  backdrop-filter: blur(9px);
  pointer-events: none;
  font-size: 8px;
}
.lab-camera-help strong { color: var(--text); font-weight: 600; }

@media (max-height: 760px) {
  .panel { padding: 13px; }
  .panel-section { padding-top: 12px; }
  .build-card { min-height: 75px; }
  .build-card strong { margin-top: 5px; }
  .event-log { max-height: 180px; }
}

@media (max-width: 720px) {
  .terrain-lab-title { display: none; }
  .terrain-lab-panel { top: 58px; right: 10px; width: min(246px, calc(100vw - 20px)); }
  .lab-camera-help { left: 10px; bottom: 10px; }
}

/* Unified 3D command surface — 0.5A */
.hud-toggle {
  height: 34px;
  padding: 0 11px;
  border: 1px solid var(--line-strong);
  border-radius: 7px;
  color: var(--muted);
  background: rgba(255,255,255,.025);
  cursor: pointer;
  font-size: 10px;
  font-weight: 700;
}
.hud-toggle.active { color: var(--green); border-color: rgba(114,227,161,.36); background: rgba(114,227,161,.08); }

html, body { min-width: 0; }
.command-layout { position: relative; display: block; direction: ltr; isolation: isolate; }
.map-stage { position: absolute; z-index: 1; inset: 0; }
#gameCanvas { display: none; }
.three-world { z-index: 2; }
.retired-view-switch,
.terrain-lab-title,
.terrain-lab-panel,
.lab-camera-help,
.map-controls { display: none !important; }

body.terrain-lab-open .command-layout { display: block; }
body.terrain-lab-open .build-panel,
body.terrain-lab-open .intel-panel { display: block; }

.build-panel,
.intel-panel {
  position: absolute;
  z-index: 34;
  top: 14px;
  bottom: 14px;
  width: 268px;
  min-height: 0;
  border: 1px solid rgba(184,224,199,.2);
  border-radius: 13px;
  background: linear-gradient(180deg, rgba(4,14,10,.98), rgba(3,10,7,.96));
  backdrop-filter: none;
  box-shadow: 0 24px 70px rgba(0,0,0,.38);
  transition: transform .24s ease, opacity .2s ease;
}
.build-panel { right: 14px; border-right: 1px solid rgba(184,224,199,.2); }
.intel-panel { left: 14px; border-left: 1px solid rgba(184,224,199,.2); }
body.hide-build-panel .build-panel { transform: translateX(calc(100% + 22px)); opacity: 0; pointer-events: none; }
body.hide-intel-panel .intel-panel { transform: translateX(calc(-100% - 22px)); opacity: 0; pointer-events: none; }

.panel-heading { padding-bottom: 12px; }
.panel-heading h2 { font-size: 15px; }
.panel-section { padding-top: 13px; }
.build-grid { gap: 6px; }
.build-card { min-height: 72px; padding: 8px; background: rgba(255,255,255,.035); }
.build-card strong { margin-top: 5px; }
.doctrine-section { padding-top: 11px; }
.primary-action { margin-top: 12px; }
.event-log { max-height: 210px; }

.map-stage.is-3d .objective-card,
.map-stage.is-3d .map-top-overlay,
.map-stage.is-3d .map-instruction,
.map-stage.is-3d .map-legend,
.map-stage.is-3d .context-card,
.map-stage.is-3d .satellite-badge { display: flex !important; }
.map-stage.is-3d .objective-card { display: grid !important; }
.map-stage.is-3d .map-top-overlay { display: grid !important; }
.map-stage.is-3d .context-card.hidden { display: none !important; }

.map-top-overlay { z-index: 28; inset: 16px 300px auto; }
.nation-card { width: 172px; background: rgba(3,9,7,.76); }
.objective-card {
  z-index: 29;
  top: 72px;
  right: 50%;
  transform: translateX(50%);
  width: 250px;
  background: rgba(3,9,7,.78);
}
/* The legend and the live badge share one stack, so they can never cover each other. */
.map-status { position: absolute; z-index: 29; left: 296px; bottom: 15px; display: flex; flex-direction: column; align-items: flex-start; gap: 6px; pointer-events: none; }
.map-status .satellite-badge, .map-status .map-legend { position: static; align-items: center; gap: 7px; white-space: nowrap; }
.map-instruction { z-index: 31; bottom: 17px; max-width: clamp(240px, calc(100% - 1010px), 600px); pointer-events: auto; }
.context-card {
  z-index: 33;
}

@media (max-width: 1180px) {
  .build-panel,.intel-panel { width: 238px; }
  .map-top-overlay { inset-inline: 260px; }
  .context-card { width: min(560px, calc(100vw - 520px)); min-width: 380px; }
  .map-status { left: 254px; }
  .map-legend { display: none !important; }
  .build-card { min-height: 66px; }
}

@media (max-height: 760px) {
  .build-panel,.intel-panel { top: 8px; bottom: 8px; padding: 10px; }
  .panel-section { padding-top: 9px; }
  .section-label { margin-bottom: 6px; }
  .build-card { min-height: 59px; }
  .doctrine-section { display: none; }
  .event-log { max-height: 120px; }
  .context-card { bottom: 54px; }
}

@media (max-width: 720px) {
  .app-shell { grid-template-rows: 58px minmax(0,1fr); }
  .topbar { grid-template-columns: 1fr auto; gap: 8px; padding: 0 9px; }
  .brand-block { gap: 7px; }
  .brand-mark { height: 32px; }
  .brand-block .eyebrow,.phase-block,.tutorial-button,.icon-button { display: none; }
  .brand-block h1 { margin: 0; font-size: 14px; letter-spacing: .08em; }
  .top-actions { gap: 5px; }
  .hud-toggle { height: 31px; padding: 0 9px; }
  .build-panel,.intel-panel { top: 8px; bottom: 8px; width: min(286px, calc(100vw - 16px)); padding: 12px; }
  .build-panel { right: 8px; }
  .intel-panel { left: 8px; }
  .map-top-overlay { inset: 9px 9px auto; grid-template-columns: 1fr 1fr; gap: 7px; }
  .nation-card { width: auto; padding: 7px 8px; }
  .nation-card span { font-size: 8px; }
  .nation-card strong { font-size: 17px; }
  .conflict-label,.objective-card,.satellite-badge,.map-legend { display: none !important; }
  .context-card { right: 8px; bottom: 58px; transform: none; width: calc(100vw - 16px); min-width: 0; }
  .context-stats { position: static; width: auto; margin-top: 9px; }
  .context-actions { grid-template-columns: repeat(3,1fr); }
  .map-instruction { right: 8px; left: 8px; bottom: 10px; transform: none; justify-content: center; width: auto; padding: 8px 10px; }
  .map-instruction p { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 9px; }
}

.credits-overlay { position: fixed; inset: 0; z-index: 90; display: flex; align-items: center; justify-content: center; padding: 16px; background: rgba(3,9,7,.72); }
.credits-overlay.hidden { display: none; }
.credits-card { width: min(620px, 100%); max-height: 84vh; overflow-y: auto; padding: 22px 24px; border: 1px solid var(--line-strong); border-radius: 12px; background: #0b1712; color: var(--text); }
.credits-card h2 { margin: 0 0 8px; font-size: 18px; }
.credits-card p { margin: 0 0 12px; color: var(--muted); font-size: 12px; line-height: 1.6; }
.credits-card ul { margin: 0 0 16px; padding: 0 18px 0 0; font-size: 12px; line-height: 1.9; }
.credits-card a { color: var(--blue); }
.credits-card button { padding: 8px 18px; border: 1px solid var(--line-strong); border-radius: 8px; background: rgba(255,255,255,.05); color: var(--text); cursor: pointer; }

.build-tabs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; margin-bottom: 8px; }
.build-tabs button { padding: 6px 0; border: 1px solid var(--line); border-radius: 6px; background: rgba(255,255,255,.025); color: var(--muted); font-size: 11px; cursor: pointer; }
.build-tabs button.active { border-color: var(--blue); color: var(--text); background: rgba(81,185,255,.1); }
.build-card[hidden] { display: none; }
.select-all-ground { width: 100%; margin-top: 8px; padding: 8px 0; border: 1px solid var(--line-strong); border-radius: 8px; background: rgba(81,185,255,.08); color: var(--text); font-size: 11px; cursor: pointer; }
.select-all-ground.hidden { display: none; }
#difficultySection.hidden { display: none; }
.selection-box { position: absolute; z-index: 30; border: 1px solid #51b9ff; background: rgba(81,185,255,.14); pointer-events: none; }


/* ---------- opening screen ----------
   A slowly drifting view of the battlefield, a tactical grid, a radar sweep, the title and real loading progress.
   The delayed animation is a last resort if the 3D script never runs. */
.loading-screen {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: grid;
  place-items: center;
  overflow: hidden;
  background: #040a07;
  color: #e7f4ea;
  transition: opacity .6s ease, visibility .6s;
  animation: loading-give-up 0s linear 25s forwards;
}
.loading-screen.done { opacity: 0; visibility: hidden; pointer-events: none; }
/* "Click to start" (17 Nov 2026): it takes the place of the progress line once the game has loaded. */
.loading-screen.ready { cursor: pointer; }
.loading-screen.ready .splash-progress, .loading-screen.ready .splash-status { display: none; }
.splash-start { margin-top: 22px; padding: 14px 34px; border: 1px solid rgba(114,227,161,.55); border-radius: 12px; color: #04110b; background: linear-gradient(180deg, #8ff0b5, var(--green)); font: inherit; font-size: clamp(16px, 2.2vw, 20px); font-weight: 800; letter-spacing: .02em; cursor: pointer; box-shadow: 0 0 0 0 rgba(114,227,161,.5); animation: splash-start-pulse 1.8s ease-out infinite; }
.splash-start[hidden] { display: none; }
.splash-start:focus, .splash-start:focus-visible { outline: 2px solid rgba(114,227,161,.7); outline-offset: 3px; }
.splash-start-touch { display: none; }
@media (pointer: coarse) { .splash-start-desk { display: none; } .splash-start-touch { display: inline; } }
@keyframes splash-start-pulse { 0% { box-shadow: 0 0 0 0 rgba(114,227,161,.45); } 70% { box-shadow: 0 0 0 16px rgba(114,227,161,0); } 100% { box-shadow: 0 0 0 0 rgba(114,227,161,0); } }
@media (prefers-reduced-motion: reduce) { .splash-start { animation: none; } }
.splash-map {
  position: absolute;
  inset: -6%;
  background: url("./assets/map/v3/board.webp") center / cover no-repeat;
  filter: saturate(.55) brightness(.42) contrast(1.05);
  transform: scale(1.04);
  animation: splash-drift 40s ease-in-out infinite alternate;
}
.splash-grid {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse at center, rgba(4,10,7,.15) 0%, rgba(4,10,7,.72) 62%, rgba(4,10,7,.96) 100%),
    repeating-linear-gradient(0deg, rgba(114,227,161,.05) 0 1px, transparent 1px 64px),
    repeating-linear-gradient(90deg, rgba(114,227,161,.05) 0 1px, transparent 1px 64px);
}
.splash-radar {
  position: absolute;
  width: min(78vmin, 720px);
  aspect-ratio: 1;
  border-radius: 50%;
  border: 1px solid rgba(114,227,161,.16);
  /* A fading trail behind a bright leading edge, like a real radar sweep. */
  background: conic-gradient(from 0deg, rgba(114,227,161,0) 0deg, rgba(114,227,161,.13) 55deg, rgba(114,227,161,.3) 56deg, rgba(114,227,161,0) 57deg);
  -webkit-mask: radial-gradient(circle, #000 0 69.5%, transparent 70%);
          mask: radial-gradient(circle, #000 0 69.5%, transparent 70%);
  animation: splash-sweep 4.5s linear infinite;
}
.splash-radar::after {
  content: "";
  position: absolute;
  inset: 22%;
  border-radius: 50%;
  border: 1px solid rgba(114,227,161,.12);
}
.splash-center {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  width: min(640px, calc(100vw - 32px));
  text-align: center;
}
.splash-mark { height: clamp(64px, 17vh, 132px); margin-bottom: 14px; }
.splash-kicker { margin: 0; color: var(--green); font-size: 11px; font-weight: 700; letter-spacing: .32em; }
.splash-title {
  margin: 8px 0 0;
  font-size: clamp(28px, 6vw, 64px);
  white-space: nowrap;
  font-weight: 800;
  letter-spacing: .1em;
  line-height: 1;
  text-shadow: 0 6px 30px rgba(0,0,0,.6);
}
.splash-tagline { margin: 12px 0 0; color: #b6cabe; font-size: clamp(13px, 1.8vw, 16px); }
.splash-progress {
  width: 100%;
  height: 4px;
  margin-top: 34px;
  overflow: hidden;
  border-radius: 2px;
  background: rgba(255,255,255,.1);
}
.splash-progress i {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, #38b679, #72e3a1);
  box-shadow: 0 0 12px rgba(114,227,161,.7);
  transform: scaleX(.04);
  transform-origin: left center;
}
html[dir="rtl"] .splash-progress i { transform-origin: right center; }
.splash-status { display: flex; justify-content: space-between; width: 100%; margin-top: 10px; color: #9bb5a8; font-size: 13px; }
/* 18 Nov 2026 (the owner's phone): the tip was placed by itself near the bottom and sat over "tap to start" on a short
   screen. The screen is now three rows: the title block in the middle row and the tip at the end of the last, so the
   two never meet; where the screen is short, the middle moves up rather than under the tip. */
.loading-screen { grid-template-rows: 1fr auto 1fr; }
.splash-center { grid-row: 2; }
.splash-tip {
  grid-row: 3;
  align-self: end;
  width: min(640px, calc(100vw - 32px));
  margin: 12px 0 7vh;
  color: #cfe0d5;
  font-size: 14px;
  line-height: 1.5;
  text-align: center;
  opacity: 0;
  transform: translateY(6px);
  transition: opacity .4s ease, transform .4s ease;
}
.splash-tip.in { opacity: .9; transform: none; }
/* A short screen (a phone on its side, 296 points high): a tighter title block and a smaller tip. */
@media (max-height: 420px) {
  .splash-kicker { font-size: 10px; }
  .splash-title { margin-top: 4px; font-size: clamp(26px, 5vw, 40px); }
  .splash-tagline { margin-top: 6px; font-size: 12px; }
  .splash-progress { margin-top: 18px; }
  .splash-status { margin-top: 6px; font-size: 12px; }
  .splash-start { margin-top: 14px; padding: 10px 30px; }
  .splash-tip { margin: 8px 0 10px; font-size: 12px; line-height: 1.4; }
}
@keyframes splash-drift { from { transform: scale(1.04) translate(0, 0); } to { transform: scale(1.14) translate(-2%, 1.5%); } }
@keyframes splash-sweep { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) {
  .splash-map, .splash-radar { animation: none; }
}

/* ---------- fonts for each language ---------- */
html[lang="zh"] { font-family: "Microsoft YaHei", "PingFang SC", "Noto Sans SC", "Segoe UI", sans-serif; }
html[lang="hi"] { font-family: "Nirmala UI", "Noto Sans Devanagari", "Segoe UI", sans-serif; }
html[lang="ar"] { font-family: "Segoe UI", "Noto Sans Arabic", Tahoma, sans-serif; }

/* ---------- main menu ---------- */
body.menu-open .app-shell { grid-template-rows: 0 minmax(0, 1fr); }
body.menu-open .topbar,
body.menu-open .panel,
body.menu-open .map-top-overlay,
body.menu-open .objective-card,
body.menu-open .map-instruction,
body.menu-open .map-status,
body.menu-open .context-card,
body.menu-open .toast-layer { visibility: hidden; }
.main-menu {
  position: fixed;
  inset: 0;
  z-index: 150;
  display: flex;
  justify-content: flex-start;
  background: linear-gradient(90deg, rgba(3,9,7,.9) 0, rgba(3,9,7,.62) 34%, rgba(3,9,7,.06) 72%);
}
html[dir="rtl"] .main-menu { background: linear-gradient(270deg, rgba(3,9,7,.9) 0, rgba(3,9,7,.62) 34%, rgba(3,9,7,.06) 72%); }
.main-menu.hidden { display: none; }
.menu-panel {
  display: flex;
  flex-direction: column;
  /* "safe" keeps the top reachable when the window is too short for everything. */
  justify-content: safe center;
  gap: 16px;
  width: min(430px, 100vw);
  height: 100%;
  overflow-y: auto;
  padding: 24px 32px;
  scrollbar-width: thin;
}
@media (max-height: 760px) {
  .menu-panel { gap: 10px; padding: 12px 24px; }
  .menu-brand .brand-mark { display: none; }
  .menu-page { gap: 6px; }
  .menu-item { padding: 8px 12px; }
  .menu-primary { padding: 11px 12px; }
  .menu-item:disabled small { display: none; }
  .menu-item:disabled em { top: 7px; }
  .menu-heading { margin-top: 4px; }
}
.menu-brand .brand-mark { height: 76px; margin-bottom: 10px; }
.menu-brand h1 { margin: 0; font-size: clamp(26px, 4vh, 36px); letter-spacing: .08em; }
.menu-brand p { margin: 6px 0 0; color: var(--muted); font-size: 13px; }
.menu-page { display: flex; flex-direction: column; gap: 8px; }
.menu-page.hidden { display: none; }
.menu-heading { margin: 10px 0 0; color: var(--muted); font-size: 12px; font-weight: 600; }
.menu-item {
  position: relative;
  display: block;
  width: 100%;
  padding: 11px 14px;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: rgba(7,19,15,.86);
  color: var(--text);
  font: inherit;
  text-align: start;
  cursor: pointer;
  transition: background .15s, border-color .15s;
}
.menu-item strong { display: block; font-size: 15px; }
.menu-item small { display: block; margin-top: 2px; color: var(--muted); font-size: 12px; }
.menu-item em {
  position: absolute;
  inset-inline-end: 12px;
  top: 12px;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(114,227,161,.14);
  color: var(--green);
  font-size: 11px;
  font-style: normal;
}
.menu-item em.hidden { display: none; }
.menu-item:not(:disabled):hover { background: var(--surface-3); border-color: var(--green); }
.menu-item:focus-visible, .menu-secondary:focus-visible, .language-choices button:focus-visible { outline: 2px solid var(--green); outline-offset: 2px; }
.menu-item:disabled { cursor: not-allowed; opacity: .55; }
.menu-item:disabled em { background: rgba(246,195,91,.14); color: var(--amber); }
.menu-primary { padding: 15px 14px; border-color: transparent; background: linear-gradient(135deg, #72e3a1, #38b679); color: #05140d; }
.menu-primary small { color: rgba(5,20,13,.72); }
.menu-primary:not(:disabled):hover { background: linear-gradient(135deg, #8aedb2, #46c587); border-color: transparent; }
.menu-item[data-pick-difficulty].active { border-color: var(--green); }
.menu-best { color: var(--amber) !important; }
.menu-best:empty { display: none; }
.menu-row { display: flex; gap: 8px; margin-top: 6px; }
/* Friends room: a code to share, or a code to type in. */
.friends-join { display: flex; gap: 8px; }
.friends-join .menu-secondary { flex: 0 0 auto; width: auto; padding-inline: 18px; }
.friends-code-input { flex: 1; min-width: 0; padding: 10px 12px; border: 1px solid var(--line-strong); border-radius: 8px; background: var(--surface-2, #0d1a14); color: var(--text); font: 600 18px/1 ui-monospace, monospace; letter-spacing: .18em; text-transform: uppercase; text-align: center; }
.friends-code-input::placeholder { font: 400 13px/1 inherit; letter-spacing: 0; text-transform: none; color: var(--muted); }
.friends-room { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 12px; border: 1px solid var(--line-strong); border-radius: 10px; background: rgba(114,227,161,.06); }
.friends-room.hidden { display: none; }
.friends-room small { color: var(--muted); font-size: 12px; }
.friends-room strong { font: 700 30px/1.1 ui-monospace, monospace; letter-spacing: .22em; color: var(--green, #72e3a1); }
.friends-room .menu-secondary { width: auto; padding-inline: 18px; }
.friends-status { min-height: 1.4em; margin: 2px 0 0; color: var(--muted); font-size: 12px; line-height: 1.5; }
.friends-status.error { color: var(--red, #ff635f); }
/* Friends room lobby: players, match settings, the host's start. */
.friends-entry { display: flex; flex-direction: column; gap: 8px; }
.friends-entry.hidden, .friends-lobby.hidden, .lobby-wait.hidden, #lobbyStart.hidden { display: none; }
.friends-lobby { display: flex; flex-direction: column; gap: 8px; }
.lobby-players { display: flex; flex-direction: column; gap: 4px; margin: 0; padding: 0; list-style: none; }
.lobby-players li { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; background: rgba(7,19,15,.7); font-size: 13px; }
.lobby-players li b { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.lobby-players li em { padding: 1px 8px; border-radius: 999px; background: rgba(246,195,91,.14); color: var(--amber); font-size: 11px; font-style: normal; }
.lobby-players li em.you { background: rgba(114,227,161,.14); color: var(--green); }
.lobby-players li.empty { color: var(--muted); font-style: italic; border-style: dashed; }
.lobby-kick { padding: 3px 10px; border: 1px solid rgba(255,99,95,.45); border-radius: 6px; background: transparent; color: var(--red, #ff635f); font: inherit; font-size: 11px; cursor: pointer; }
.lobby-settings { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.lobby-setting { display: flex; flex-direction: column; gap: 3px; padding: 7px 9px; border: 1px solid var(--line); border-radius: 8px; background: rgba(7,19,15,.7); }
.lobby-setting span { color: var(--muted); font-size: 11px; }
.lobby-setting select { width: 100%; padding: 5px 6px; border: 1px solid var(--line-strong); border-radius: 6px; background: var(--surface-2, #0d1a14); color: var(--text); font: inherit; font-size: 13px; }
.lobby-setting select:disabled { opacity: .8; cursor: default; }
.lobby-wait { margin: 0; padding: 10px; border: 1px dashed var(--line-strong); border-radius: 8px; color: var(--muted); font-size: 13px; text-align: center; }
/* 18 Nov 2026: the players and the settings are two blocks, and the host's start sits above "back" at the end. */
.lobby-block { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.lobby-foot { flex-direction: column; }
.lobby-foot .menu-secondary { flex: none; }
/* Ranked 1 on 1: sign-in, profile card, statistics, last matches, leaderboard, account. */
.ranked-signin, .ranked-profile { display: flex; flex-direction: column; gap: 8px; }
.ranked-signin.hidden, .ranked-profile.hidden, .ranked-search.hidden, .google-slot.hidden, #rankedFind.hidden, #rankedRecover.hidden, .end-rating.hidden, .opponent-chip.hidden { display: none; }
.ranked-lead { margin: 0; color: var(--muted); font-size: 12px; line-height: 1.5; }
.ranked-input { flex: 1; min-width: 0; padding: 10px 12px; border: 1px solid var(--line-strong); border-radius: 8px; background: var(--surface-2, #0d1a14); color: var(--text); font: inherit; font-size: 15px; }
.ranked-input:focus, .ranked-code-input:focus { outline: 2px solid var(--green); outline-offset: 1px; }
.ranked-code-input { font-size: 14px; letter-spacing: .08em; }
.ranked-label { color: var(--muted); font-size: 12px; }
/* 18 Nov 2026: a taken nickname, with three free ones to pick. */
.name-taken { display: flex; flex-direction: column; gap: 6px; padding: 8px 10px; border: 1px solid rgba(246,195,91,.3); border-radius: 8px; background: rgba(246,195,91,.07); color: var(--amber); font-size: 12px; line-height: 1.5; }
.name-taken.hidden { display: none; }
.name-ideas { display: flex; flex-wrap: wrap; gap: 6px; }
.name-ideas .name-idea { flex: 1 1 auto; width: auto; max-width: 100%; padding: 8px 10px; white-space: nowrap; }
.google-slot { display: flex; justify-content: center; width: 100%; min-height: 44px; }
.google-slot > div { display: flex; justify-content: center; width: 100%; }
/* Google's button sits in a light frame; on this dark page the browser painted it a white box unless told it is light. */
.google-slot iframe { color-scheme: light; border-radius: 8px; }
/* 18 Nov 2026: at an address Google cannot accept (a home-network address, a cloudflared tunnel) a note stands in
   for the button. */
.google-slot.google-unavailable { min-height: 0; }
.google-note { margin: 0; width: 100%; padding: 8px 10px; border: 1px dashed var(--line-strong); border-radius: 8px; color: var(--muted); font-size: 12px; line-height: 1.5; text-align: center; }
.insignia { display: inline-block; flex: 0 0 auto; width: 46px; height: 46px; }
.insignia.small { width: 22px; height: 22px; vertical-align: middle; }
.ranked-card { display: flex; align-items: center; gap: 12px; padding: 12px; border: 1px solid var(--line-strong); border-radius: 12px; background: rgba(7,19,15,.86); }
.ranked-who { flex: 1; min-width: 0; }
.ranked-who strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 16px; }
.ranked-who small { display: block; margin-top: 2px; color: var(--amber); font-size: 12px; }
.ranked-rating { text-align: center; }
.ranked-rating strong { display: block; color: var(--green); font: 700 26px/1 ui-monospace, monospace; }
.ranked-rating small { color: var(--muted); font-size: 11px; }
.ranked-progress { height: 6px; overflow: hidden; border-radius: 999px; background: rgba(255,255,255,.08); }
.ranked-progress i { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, #38b679, #72e3a1); transition: width .4s; }
.ranked-progress-text { margin-top: -2px; color: var(--muted); font-size: 11px; }
.ranked-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.ranked-stats article { padding: 7px 8px; border: 1px solid var(--line); border-radius: 8px; background: rgba(7,19,15,.7); }
.ranked-stats span { display: block; color: var(--muted); font-size: 10px; }
.ranked-stats strong { display: block; margin-top: 2px; font-size: 15px; }
.ranked-search { display: flex; align-items: center; gap: 12px; padding: 12px; border: 1px solid var(--green); border-radius: 10px; background: rgba(114,227,161,.08); }
.ranked-search div { flex: 1; }
.ranked-search strong { display: block; font-size: 14px; }
.ranked-search small { color: var(--muted); font: 12px ui-monospace, monospace; }
.ranked-search .menu-secondary { flex: 0 0 auto; width: auto; }
.ranked-pulse { width: 14px; height: 14px; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 0 rgba(114,227,161,.6); animation: ranked-pulse 1.4s infinite; }
@keyframes ranked-pulse { 0% { box-shadow: 0 0 0 0 rgba(114,227,161,.55); } 70% { box-shadow: 0 0 0 14px rgba(114,227,161,0); } 100% { box-shadow: 0 0 0 0 rgba(114,227,161,0); } }
.ranked-recent, .ranked-board { display: flex; flex-direction: column; gap: 4px; margin: 0; padding: 0; list-style: none; }
.ranked-recent li { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 2px 10px; padding: 7px 10px; border: 1px solid var(--line); border-inline-start: 3px solid var(--muted); border-radius: 8px; background: rgba(7,19,15,.7); font-size: 13px; }
.ranked-recent li.win { border-inline-start-color: var(--green); }
.ranked-recent li.loss { border-inline-start-color: var(--red, #ff635f); }
.ranked-recent li small { grid-column: 1 / -1; color: var(--muted); font-size: 11px; }
.ranked-recent li.empty, .ranked-board li.empty { display: block; border-inline-start-width: 1px; color: var(--muted); font-size: 12px; line-height: 1.5; }
.ranked-result { font-weight: 700; }
.ranked-recent li.win .ranked-result { color: var(--green); }
.ranked-recent li.loss .ranked-result { color: var(--red, #ff635f); }
.ranked-opponent { display: flex; align-items: center; gap: 6px; min-width: 0; }
.ranked-opponent b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; }
.ranked-delta { font: 700 13px ui-monospace, monospace; }
.ranked-recent li.win .ranked-delta { color: var(--green); }
.ranked-recent li.loss .ranked-delta { color: var(--red, #ff635f); }
.ranked-board li { display: grid; grid-template-columns: 30px auto 1fr auto; align-items: center; gap: 8px; padding: 7px 10px; border: 1px solid var(--line); border-radius: 8px; background: rgba(7,19,15,.7); font-size: 13px; }
.ranked-board li.me { border-color: var(--green); background: rgba(114,227,161,.1); }
.ranked-board .place { color: var(--muted); font: 700 13px ui-monospace, monospace; text-align: center; }
.ranked-board li:nth-child(-n+3) .place { color: var(--amber); }
.ranked-board b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; }
.ranked-board .rating { color: var(--green); font: 700 14px ui-monospace, monospace; }
.ranked-box { display: flex; flex-direction: column; gap: 6px; padding: 12px; border: 1px solid var(--line-strong); border-radius: 10px; background: rgba(7,19,15,.7); }
.ranked-box strong { font-size: 14px; }
.ranked-box small { color: var(--muted); font-size: 12px; line-height: 1.5; }
.ranked-box code { padding: 8px; border-radius: 6px; background: rgba(255,255,255,.06); color: var(--green); font: 600 15px ui-monospace, monospace; letter-spacing: .06em; text-align: center; user-select: all; }
.menu-secondary.danger { color: var(--red, #ff635f); }
/* In a ranked match: the opponent's name and rank next to the game's name. */
.opponent-chip { display: flex; align-items: center; gap: 8px; margin-inline-start: 14px; padding: 4px 12px 4px 6px; border: 1px solid rgba(255,99,95,.35); border-radius: 999px; background: rgba(255,99,95,.08); direction: var(--ui-dir, rtl); }
.opponent-chip > span:last-child { display: grid; line-height: 1.15; }
.opponent-chip small { color: var(--muted); font-size: 10px; }
.opponent-chip strong { font-size: 13px; max-width: 160px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (max-width: 1180px) { .opponent-chip small:first-child { display: none; } }
/* The end screen of a ranked match: the new rating and how it moved. */
.end-rating { display: grid; grid-template-columns: auto 1fr; align-items: center; gap: 4px 14px; margin-bottom: 14px; padding: 12px 16px; border: 1px solid var(--line-strong); border-radius: 12px; background: rgba(7,19,15,.7); }
.end-rating .insignia { grid-row: span 2; width: 52px; height: 52px; }
.end-rating div { display: flex; align-items: baseline; gap: 10px; }
.end-rating div small { color: var(--muted); font-size: 12px; }
.end-rating strong { font: 700 28px/1 ui-monospace, monospace; }
.end-rating em { font: 700 18px ui-monospace, monospace; font-style: normal; color: var(--muted); }
.end-rating em.up { color: var(--green); }
.end-rating em.down { color: var(--red, #ff635f); }
.end-rating > small { color: var(--amber); font-size: 13px; }
.menu-secondary {
  flex: 1;
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: rgba(7,19,15,.86);
  color: var(--text);
  font: inherit;
  font-size: 13px;
  cursor: pointer;
}
.menu-secondary:hover { background: var(--surface-3); }

/* ---------- pause and settings ---------- */
.menu-dialog {
  position: fixed;
  inset: 0;
  z-index: 160;
  display: grid;
  place-items: center;
  padding: 16px;
  background: rgba(1,5,3,.66);
}
.menu-dialog.hidden { display: none; }
.settings-dialog { z-index: 170; }
.dialog-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: min(420px, 100%);
  max-height: 100%;
  overflow-y: auto;
  padding: 24px;
  border: 1px solid var(--line-strong);
  border-radius: 14px;
  background: linear-gradient(180deg, #0b1b15, #06100c);
  box-shadow: var(--shadow);
}
.dialog-card h2 { margin: 0 0 6px; font-size: 20px; }
/* 18 Nov 2026, found on the user's phone: a card taller than the screen squeezed its rows (flex shrinking) instead
   of scrolling, so the settings' "Done" sat over the music rows and the report's buttons fell off the bottom. Rows
   keep their height and the card scrolls. */
.dialog-card > * { flex-shrink: 0; }
.dialog-card .primary-action { margin-top: 4px; }
.setting { display: flex; flex-direction: column; gap: 7px; padding: 10px 0; border-top: 1px solid var(--line); }
.setting-label { font-size: 13px; font-weight: 600; }
.setting-note { color: var(--muted); font-size: 11px; line-height: 1.5; }
.setting-note:empty { display: none; }
.setting-check { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 600; cursor: pointer; }
.setting input[type="range"] { width: 100%; accent-color: var(--green); }
.setting-check input { width: 16px; height: 16px; accent-color: var(--green); }
/* Music and effects (17 Nov 2026): a volume whose sound is off is greyed. */
.setting input[type="range"]:disabled { opacity: .4; }
.language-choices { display: grid; grid-template-columns: repeat(auto-fit, minmax(92px, 1fr)); gap: 6px; }
.language-choices button { padding: 9px 6px; border: 1px solid var(--line-strong); border-radius: 8px; background: transparent; color: var(--text); font: inherit; font-size: 13px; cursor: pointer; }
.language-choices button:hover { background: var(--surface-3); }
.language-choices button.active { border-color: var(--green); background: rgba(114,227,161,.14); color: var(--green); font-weight: 700; }
.credits-overlay { z-index: 180 !important; }

/* ---------- results ---------- */
.end-screen { z-index: 140; padding: 16px; overflow-y: auto; }
.end-card { width: min(620px, 100%); padding: 24px; }
.end-screen[data-result="blue"] #endTitle { color: var(--green); }
.end-screen[data-result="red"] #endTitle { color: var(--red); }
.end-stats { display: block; margin-top: 14px; }
.end-versus { display: grid; grid-template-columns: 1fr 2fr 1fr; align-items: center; gap: 10px; }
.end-versus .side b { display: block; color: var(--muted); font-size: 11px; font-weight: 500; }
.end-versus .side strong { display: block; margin-top: 2px; font-size: 26px; }
.end-versus .side.blue strong { color: var(--blue); }
.end-versus .side.red strong { color: var(--red); }
.end-bars { display: flex; justify-content: space-between; direction: var(--ui-dir, rtl); height: 8px; border-radius: 4px; background: rgba(255,255,255,.08); overflow: hidden; }
.end-bars i { display: block; height: 100%; }
.end-bars i.blue { background: var(--blue); }
.end-bars i.red { background: var(--red); }
.end-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 14px; }
.end-stats article { padding: 9px 10px; }
.end-stats article span { font-size: 11px; }
.end-stats article strong { font-size: 17px; }
.end-score { margin-top: 12px; padding: 10px; border: 1px solid rgba(246,195,91,.35); border-radius: 8px; background: rgba(246,195,91,.07); }
.end-score span { display: block; color: var(--muted); font-size: 11px; }
.end-score strong { display: block; margin: 2px 0; color: var(--amber); font-size: 24px; }
.end-score small { color: var(--muted); font-size: 11px; }
.end-actions { display: flex; gap: 8px; margin-top: 14px; }
.end-actions > * { flex: 1; margin-top: 0; }
@media (max-width: 560px) {
  .end-grid { grid-template-columns: repeat(2, 1fr); }
  .end-versus { grid-template-columns: 1fr 1fr; }
  .end-bars { grid-column: 1 / -1; grid-row: 2; }
}

/* ---------- tutorial coach ---------- */
body.tutorial-on .objective-card { display: none !important; }
.coach {
  position: fixed;
  z-index: 60;
  top: 132px;
  left: 50%;
  transform: translateX(-50%);
  width: min(520px, calc(100vw - 590px));
  min-width: 300px;
  padding: 12px 14px;
  border: 1px solid rgba(114,227,161,.45);
  border-radius: 12px;
  background: rgba(5,14,10,.94);
  box-shadow: var(--shadow);
}
.coach.hidden { display: none; }
.coach-head { display: flex; align-items: center; gap: 8px; }
.coach-avatar { flex: none; width: 12px; height: 12px; border-radius: 50%; background: var(--green); box-shadow: 0 0 10px rgba(114,227,161,.8); }
.coach-title { flex: 1; min-width: 0; }
.coach-title strong { display: block; font-size: 12px; }
.coach-title small { display: block; color: var(--muted); font-size: 11px; }
.coach-link { flex: none; padding: 3px 7px; border: 1px solid var(--line); border-radius: 6px; background: transparent; color: var(--muted); font: inherit; font-size: 11px; cursor: pointer; }
.coach-link:hover { color: var(--text); background: var(--surface-3); }
.coach-text { margin: 9px 0 0; font-size: 14px; line-height: 1.55; }
.coach-hint { margin: 8px 0 0; color: var(--amber); font-size: 13px; font-weight: 600; }
.coach.done { border-color: var(--green); }
.coach.done .coach-hint { color: var(--green); }
.coach-hint.hidden, .coach-next.hidden, .coach-voiceless.hidden { display: none; }
.coach-voiceless { display: block; margin-top: 6px; color: var(--muted); font-size: 11px; }
.coach-next { margin-top: 10px; padding: 9px 14px; }
.coach-highlight { outline: 3px solid var(--amber) !important; outline-offset: 2px; animation: coach-pulse 1.1s ease-in-out infinite; }
@keyframes coach-pulse { 50% { outline-color: rgba(246,195,91,.3); } }
@media (max-width: 900px) { .coach { top: 64px; width: calc(100vw - 16px); min-width: 0; } }
@media (prefers-reduced-motion: reduce) {
  .coach-highlight { animation: none; }
}

/* ---------- phones (12 Nov 2026) ----------
   body.phone is set by game.js (applyPhoneLayout) on a touch screen whose short side is a phone's, or with ?phone=1.
   The map fills the screen under a thin bar; the two panels are drawers, one open at a time; a selected unit's card
   is a sheet along the bottom; the war's start buttons float at the bottom right (#phoneDock). Every tap target is
   at least about 40 px. The computer layout is untouched: everything here sits under body.phone. */
.phone-dock, #fullscreenButton, .rotate-hint, .home-screen-hint.hidden { display: none; }
body.phone {
  --safe-l: env(safe-area-inset-left, 0px);
  --safe-r: env(safe-area-inset-right, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
  min-width: 0;
}
/* The height is the window's own, measured by the page (--app-h, game.js): in full screen Android's Chrome counted
   100dvh as 440 points on a 384-point screen, and the bottom of the game (card, war buttons, instruction) was cut off
   (13 Nov 2026, on the user's phone). */
body.phone .app-shell { height: 100vh; height: var(--app-h, 100dvh); grid-template-rows: 46px minmax(0, 1fr); padding: 0; }
/* The map runs to the screen's edges, under the camera's notch too (13 Nov 2026: the user saw black strips and wanted
   the game to the end of the screen); only the buttons and panels keep clear of the notch (--safe-l / --safe-r).
   In the main menu the top bar is gone and the map fills the whole screen behind the menu. */
body.phone.menu-open .app-shell { grid-template-rows: minmax(0, 1fr); }
body.phone.menu-open .topbar { display: none !important; }

/* The top bar: the clock and phase in the middle, the buttons at the side, no titles. */
body.phone .topbar { grid-template-columns: auto 1fr auto; gap: 8px; padding: 0 calc(8px + var(--safe-r)) 0 calc(8px + var(--safe-l)); }
body.phone .brand-block { gap: 6px; }
body.phone .brand-block > div:not(.brand-mark):not(.opponent-chip) { display: none; }
body.phone .brand-mark { height: 30px; }
body.phone .splash-mark { height: clamp(46px, 15vh, 96px); margin-bottom: 8px; }
body.phone .opponent-chip small:first-child { display: none; }
body.phone .phase-block { display: flex !important; align-items: center; justify-content: center; gap: 8px; }
body.phone .phase-block small { display: none; }
body.phone .phase-pill { padding: 4px 9px; font-size: 10px; }
body.phone .phase-block strong { font-size: 18px; }
body.phone .top-actions { gap: 6px; }
body.phone .hud-toggle,
body.phone .tutorial-button { display: inline-block !important; height: 38px; min-width: 48px; padding: 0 11px; font-size: 12px; }
body.phone .icon-button { display: inline-grid !important; place-items: center; width: 40px; height: 38px; padding: 0; }
body.phone #fullscreenButton { display: none !important; }
body.phone.can-fullscreen #fullscreenButton { display: inline-grid !important; }

/* The panels are drawers over the map, each a little under half the width, scrolling inside. */
body.phone .build-panel,
body.phone .intel-panel { top: 6px; bottom: 6px; width: min(310px, 47vw); padding: 10px 11px; overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; }
body.phone .build-panel { right: calc(6px + var(--safe-r)); }
body.phone .intel-panel { left: calc(6px + var(--safe-l)); }
body.phone .panel-heading { padding-bottom: 8px; }
body.phone .panel-heading h2 { font-size: 14px; }
body.phone .panel-section { padding-top: 9px; }
body.phone .doctrine-section { display: block; }
body.phone .build-tabs button { min-height: 38px; }
body.phone .build-card { min-height: 60px; }
body.phone .segmented button { min-height: 38px; }
body.phone .intel-actions button { min-height: 46px; }
body.phone .event-log { max-height: none; }
body.phone .select-all-ground { min-height: 40px; }

/* The two nations' resilience: small tags in the top corners. */
body.phone .map-top-overlay { inset: 6px calc(8px + var(--safe-r)) auto calc(8px + var(--safe-l)); gap: 8px; }
body.phone .nation-card { width: auto; padding: 4px 9px; gap: 0 8px; align-items: center; }
body.phone .nation-card span { font-size: 9px; }
body.phone .nation-card small { display: none; }
body.phone .nation-card strong { grid-row: auto; font-size: 16px; }
body.phone .map-status { display: none !important; }

/* A selected unit's card: a low sheet along the bottom (about a third of the screen), with the name and numbers on
   one line and its buttons large enough for a finger. The description and the English eyebrow are left out. */
body.phone .map-stage.is-3d .context-card { left: calc(8px + var(--safe-l)); right: calc(8px + var(--safe-r)); bottom: calc(6px + var(--safe-b)); transform: none; width: auto; min-width: 0; max-height: 48%; overflow-y: auto; padding: 7px 10px 8px; display: grid !important; grid-template-columns: auto minmax(0, auto) minmax(0, 1fr); align-items: center; gap: 6px 10px; }
body.phone .map-stage.is-3d .context-card.hidden { display: none !important; }
body.phone .context-card > button#closeContext { position: static; grid-column: 1; grid-row: 1; width: 38px; height: 38px; font-size: 20px; }
body.phone .context-card .eyebrow,
body.phone .context-card > p:not(.eyebrow) { display: none; }
body.phone .context-card h3 { grid-column: 2; grid-row: 1; margin: 0; padding: 0; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
body.phone .context-stats { grid-column: 3; grid-row: 1; display: flex; flex-wrap: wrap; gap: 5px; }
body.phone .context-stats span { flex: 1 1 80px; flex-direction: row; justify-content: space-between; align-items: center; gap: 6px; padding: 3px 8px; font-size: 9px; }
body.phone .context-stats strong { font-size: 12px; }
body.phone .context-actions { grid-column: 1 / -1; gap: 6px; }
body.phone .context-actions button { min-height: 40px; flex: 1 1 0; min-width: 92px; padding: 4px 6px; font-size: 12px; line-height: 1.2; }

/* The instruction line sits at the bottom left; while a card is open, it moves up between the nation tags. A long
   one takes two lines instead of being cut. */
body.phone .map-instruction { left: calc(8px + var(--safe-l)); right: auto; bottom: calc(8px + var(--safe-b)); transform: none; max-width: calc(100% - 210px); min-width: 0; padding: 6px 10px; gap: 7px; border-radius: 14px; }
body.phone .map-instruction p { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; font-size: 11px; line-height: 1.35; }
body.phone .map-instruction .cancel-action { flex: none; min-height: 34px; padding: 6px 12px; font-size: 12px; }
body.phone:has(.context-card:not(.hidden)) .map-instruction { top: 6px; bottom: auto; left: 50%; transform: translateX(-50%); max-width: calc(100% - 300px); }

/* While a drawer is open it has the screen: the card, the instruction and the floating buttons wait until it closes. */
body.phone:not(.hide-build-panel) .map-stage.is-3d .context-card,
body.phone:not(.hide-intel-panel) .map-stage.is-3d .context-card,
body.phone:not(.hide-build-panel) .map-instruction,
body.phone:not(.hide-intel-panel) .map-instruction,
body.phone:not(.hide-build-panel) .phone-dock,
body.phone:not(.hide-intel-panel) .phone-dock { display: none !important; }

/* The war's start buttons, floating at the bottom right. Gone once the war is on, or while a card is open. */
body.phone .phone-dock { position: absolute; z-index: 32; right: calc(8px + var(--safe-r)); bottom: calc(8px + var(--safe-b)); display: flex; flex-direction: column; gap: 6px; width: 180px; }
body.phone .phone-dock .primary-action { margin: 0; min-height: 46px; padding: 7px 10px; font-size: 13px; }
body.phone .phone-dock .primary-action small { font-size: 9px; }
body.phone .phone-dock .primary-action.sites-action { min-height: 40px; border: 1px solid rgba(114,227,161,.45); background: rgba(5,16,11,.94); font-size: 12px; }
body.phone .phone-dock .primary-action.sites-action small { display: none; }
body.phone .phone-dock #startWar:disabled { display: none; }
body.phone:has(.context-card:not(.hidden)) .phone-dock,
body.menu-open .phone-dock { display: none; }

/* Messages, the tutorial's narrator, menus and dialogs fit the short screen. */
body.phone .toast-layer { top: 52px; }
body.phone .toast { min-width: 0; max-width: 60vw; padding: 7px 11px; font-size: 11px; }
/* The narrator sits under the nation tags at the left, away from the buy drawer (right) and the war buttons (bottom
   right); the lessons' camera puts their targets right of the middle. While the operations drawer (left) is open it
   moves to the right. With a unit's card open it folds to its title and goal, and a tap on its head folds or opens it.
   (13 Nov 2026, on the user's phone: at the right it covered the drawer's tabs, and step 6 could not be done.) */
body.phone .coach { top: 92px; left: calc(8px + var(--safe-l)); right: auto; transform: none; width: min(330px, 42vw); min-width: 0; max-height: calc(100% - 100px); overflow-y: auto; padding: 7px 10px; z-index: 33; }
body.phone:not(.hide-intel-panel) .coach { left: auto; right: calc(8px + var(--safe-r)); }
body.phone .coach-head { cursor: pointer; }
body.phone .coach-text { margin-top: 6px; font-size: 12px; line-height: 1.45; }
body.phone .coach-hint { margin-top: 5px; font-size: 12px; }
body.phone .coach-link { min-height: 34px; }
body.phone .coach-next { min-height: 40px; margin-top: 7px; }
body.phone .coach.folded .coach-text,
body.phone .coach.folded .coach-voiceless,
body.phone:has(.context-card:not(.hidden)) .coach .coach-text,
body.phone:has(.context-card:not(.hidden)) .coach .coach-voiceless { display: none; }
/* The narrator gives the lesson's instruction, so the game's own line stays out of its way. */
body.phone.tutorial-on .map-instruction { display: none !important; }
body.phone .menu-panel { padding: 10px calc(18px + var(--safe-r)) 10px calc(18px + var(--safe-l)); width: min(440px, 100vw); }
body.phone .menu-item { min-height: 46px; }
body.phone .menu-secondary { min-height: 40px; }
body.phone .dialog-card,
body.phone .credits-card { max-height: calc(var(--app-h, 100dvh) - 32px); overflow-y: auto; }
/* ---------- phones, from the scan on the user's phone (13 Nov 2026) ---------- */
/* No scroll bars: Android drew the menu's as a grey line across the whole screen. Lists and drawers still scroll. */
body.phone, body.phone * { scrollbar-width: none; }
body.phone ::-webkit-scrollbar { display: none; }
/* No pull-to-refresh or bounce of the whole page over the game. */
html:has(body.phone), body.phone { overscroll-behavior: none; }
/* Frosted glass over the moving map is blurred again every frame by a phone's graphics chip; the panels are dark
   enough without it. */
body.phone * { -webkit-backdrop-filter: none !important; backdrop-filter: none !important; }
/* The main menu in two columns, so all of it fits a phone's height without scrolling ("5 players" is not out yet). */
body.phone .menu-brand h1 { font-size: 22px; }
body.phone .menu-brand p { margin-top: 2px; font-size: 11px; }
body.phone .menu-page[data-page="home"]:not(.hidden) { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; align-content: start; }
body.phone .menu-page[data-page="home"] > :not(.menu-item) { grid-column: 1 / -1; }
body.phone .menu-page[data-page="home"] .menu-item:disabled { display: none; }
body.phone .menu-page[data-page="home"] .menu-heading { margin: 2px 0 -2px; }
body.phone .menu-item small { font-size: 10.5px; }
/* With the browser's address bar showing (a screen under 340 points high) the main menu leaves out the lines under the
   titles, so all of it still fits without scrolling (13 Nov 2026). */
@media (max-height: 340px) {
  body.phone .menu-page[data-page="home"] .menu-item small,
  body.phone .menu-brand p { display: none; }
  body.phone .menu-page[data-page="home"] .menu-item { min-height: 44px; padding-top: 9px; padding-bottom: 9px; }
}
/* In the half-width cards a tag ("recommended", "new") sits under the title instead of over its end. */
body.phone .menu-page[data-page="home"] .menu-item em:not(.hidden) { position: static; display: inline-block; justify-self: start; margin-top: 3px; }
/* "Back" and "close" stay at the bottom edge of their screen while the rest scrolls (they were below the screen's
   edge on a phone: settings' "done" 613 points down a 384-point screen). The lobby's "start" sits just above. */
/* 18 Nov 2026 (the owner's phone): as a sticky row inside the scrolling menu, "back" lay over the buttons scrolled
   under it ("I have a recovery code" in ranked, the lobby's players and settings). It is now a footer of its own at
   the screen's bottom edge, and the menu above it ends where the footer starts, so whatever scrolls stays above it.
   --menu-w is the menu's width, which the footer shares (the lobby's is wider). */
body.phone { --menu-foot: 56px; }
body.phone .menu-panel { --menu-w: min(440px, 100vw); width: var(--menu-w); }
body.phone .menu-panel:has(> .menu-page:not(.hidden) > .menu-row:last-child) { align-self: flex-start; height: calc(100% - var(--menu-foot)); padding-bottom: 8px; }
body.phone .menu-page:not(.hidden) > .menu-row:last-child { position: fixed; bottom: 0; inset-inline-start: 0; z-index: 3; box-sizing: border-box; width: var(--menu-w); height: var(--menu-foot); margin: 0; padding: 7px calc(18px + var(--safe-r)) 7px calc(18px + var(--safe-l)); align-items: stretch; gap: 8px; border-top: 1px solid var(--line); background: rgba(3,9,7,.97); }
body.phone .menu-page > .menu-row:last-child > button { min-height: 0; }
/* The friends room's footer: the host's start and "back" side by side. */
body.phone .lobby-foot { flex-direction: row; justify-content: flex-end; }
body.phone .lobby-foot #lobbyStart { flex: 1 1 0; min-width: 0; display: flex; flex-direction: column; justify-content: center; padding: 4px 12px; }
body.phone .lobby-foot #lobbyStart.hidden { display: none; }
body.phone .lobby-foot #lobbyStart strong { font-size: 14px; }
body.phone .lobby-foot #lobbyStart small { display: block; margin-top: 1px; overflow: hidden; font-size: 10px; white-space: nowrap; text-overflow: ellipsis; }
/* "Back" keeps its place and width whether or not the start is beside it (a guest has no start). */
body.phone .lobby-foot .menu-secondary { flex: 0 0 calc((100% - 8px) * .37); }
/* The friends room with its lobby open: the whole width of the screen, darker behind, no title, and two columns: the
   code and the players at the start, the settings (a 2 x 3 grid) at the end. */
body.phone .main-menu:has(#friendsLobby:not(.hidden)) { background: rgba(3,9,7,.94); }
body.phone .menu-panel:has(#friendsLobby:not(.hidden)) { --menu-w: 100vw; }
body.phone .menu-panel:has(#friendsLobby:not(.hidden)) .menu-brand { display: none; }
body.phone .menu-page[data-page="friends"]:has(#friendsLobby:not(.hidden)) { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr); grid-template-rows: auto auto auto 1fr; gap: 6px 16px; align-content: start; }
body.phone .menu-page[data-page="friends"]:has(#friendsLobby:not(.hidden)) > .menu-heading { grid-column: 1 / -1; grid-row: 1; margin: 0; }
body.phone .menu-page[data-page="friends"]:has(#friendsLobby:not(.hidden)) > #friendsRoom { grid-column: 1; grid-row: 2; }
body.phone #friendsLobby:not(.hidden) { display: contents; }
body.phone #friendsLobby .lobby-people { grid-column: 1; grid-row: 3; gap: 5px; }
body.phone #friendsLobby .lobby-rules { grid-column: 2; grid-row: 2 / span 3; gap: 5px; }
body.phone .menu-page[data-page="friends"]:has(#friendsLobby:not(.hidden)) > #friendsStatus { grid-column: 1; grid-row: 4; margin: 0; }
body.phone .menu-page[data-page="friends"]:has(#friendsLobby:not(.hidden)) > #friendsStatus:empty { display: none; }
/* Ranked sign-in on a phone: the whole width too, in two columns (a nickname and "play as a guest" at the start;
   Google and the recovery code at the end), so every choice shows at once above the footer. */
body.phone .main-menu:has([data-page="ranked"]:not(.hidden) #rankedSignIn:not(.hidden)) { background: rgba(3,9,7,.94); }
body.phone .menu-panel:has([data-page="ranked"]:not(.hidden) #rankedSignIn:not(.hidden)) { --menu-w: 100vw; }
body.phone .menu-panel:has([data-page="ranked"]:not(.hidden) #rankedSignIn:not(.hidden)) .menu-brand { display: none; }
body.phone #rankedSignIn:not(.hidden) { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); grid-auto-flow: row dense; gap: 7px 16px; align-items: start; }
body.phone #rankedSignIn > * { grid-column: 1; }
body.phone #rankedSignIn > #rankedGoogleSignIn,
body.phone #rankedSignIn > #rankedRecoverOpen,
body.phone #rankedSignIn > #rankedRecover { grid-column: 2; }
body.phone #rankedSignIn .menu-primary { padding: 9px 12px; }
/* The room's code in one row: the code, then "copy" and "send to a friend". */
body.phone .friends-room { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; grid-template-rows: auto auto; align-items: center; gap: 0 8px; padding: 5px 8px 5px 12px; }
body.phone .friends-room.hidden { display: none; }
body.phone .friends-room small { grid-column: 1; grid-row: 1; font-size: 10px; line-height: 1.2; }
body.phone .friends-room strong { grid-column: 1; grid-row: 2; font-size: 22px; }
body.phone .friends-room .menu-secondary { grid-row: 1 / span 2; min-height: 38px; padding: 4px 10px; font-size: 12px; white-space: nowrap; }
body.phone .friends-room #friendsCopy { grid-column: 3; }
body.phone .friends-room #friendsShare:not(.hidden) { grid-column: 2; justify-self: end; }
body.phone .friends-room #friendsShare.hidden { display: none; }
/* Tidy players: one low row each. */
body.phone .lobby-players li { min-height: 34px; padding: 4px 10px; font-size: 12.5px; }
body.phone .lobby-wait { padding: 7px; font-size: 12px; }
body.phone .lobby-settings { gap: 5px; }
body.phone .lobby-setting { gap: 2px; padding: 4px 7px; }
body.phone .lobby-setting span { overflow: hidden; font-size: 10px; white-space: nowrap; text-overflow: ellipsis; }
body.phone .lobby-setting select { min-height: 32px; padding: 3px 5px; font-size: 12px; }
body.phone #closeSettings,
body.phone #closeCredits { position: sticky; bottom: 0; z-index: 2; width: 100%; min-height: 44px; box-shadow: 0 -10px 14px rgba(3,9,7,.9); }
/* 18 Nov 2026: the rows scrolled past showed in the card's padding under "Done"; the button now sits 10px up with a
   strip of the card's colour below it, and the card has no padding of its own at the bottom. */
body.phone .settings-dialog .dialog-card { padding-bottom: 10px; }
body.phone #closeSettings { bottom: 0; box-shadow: 0 -10px 14px rgba(3,9,7,.9), 0 10px 0 #06100c, 0 24px 0 #06100c; }
/* The buy drawer's heading is short, so more cards show; the English eyebrows are left out. */
body.phone .panel .eyebrow { display: none; }
body.phone .build-panel .panel-heading h2 { font-size: 13px; }
body.phone .build-panel .credit-stack strong { font-size: 22px; }
body.phone .build-panel .credit-stack span { display: none; }
body.phone .build-panel .section-label small { display: none; }
body.phone .income-row { padding: 6px 0; }
/* A lobby player whose phone is in another app for a moment (the seat is kept a minute and a half). */
.lobby-players em.away { color: var(--amber); }
/* No keyboard, no "Esc" on the cancel button. */
body.phone .esc-key { display: none; }
@media (pointer: coarse) { .esc-key { display: none; } }
/* Big enough for a finger. */
body.phone .map-instruction .cancel-action { min-height: 40px; padding: 6px 14px; }
body.phone .setting-check input { width: 24px; height: 24px; }
body.phone #volumeSlider, body.phone #musicSlider { height: 32px; }
body.phone .lobby-kick { min-height: 34px; padding: 4px 12px; }
body.phone #clearLog { min-width: 40px; min-height: 34px; }
/* A message never lands on the instruction line, which moves up between the nation tags while a card is open. */
body.phone:has(.context-card:not(.hidden)) .toast-layer { top: 104px; }
/* The end screen's card starts at the top when it is taller than the screen, so its result is never cut off. */
body.phone .end-screen { place-items: safe center; }
.home-screen-hint { margin: 4px 0 0; padding: 8px 10px; border: 1px solid rgba(246,195,91,.3); border-radius: 8px; color: var(--amber); background: rgba(246,195,91,.07); font-size: 11px; line-height: 1.5; }

/* ?perf=1: the frame-rate overlay (world3d.js), for measuring on a real phone. */
.perf-panel { position: fixed; z-index: 450; left: 50%; top: 50px; transform: translateX(-50%); max-width: calc(100vw - 16px); padding: 6px 8px; border: 1px solid rgba(114,227,161,.5); border-radius: 8px; color: #d9f6e5; background: rgba(0,0,0,.82); font: 11px/1.35 Consolas, monospace; pointer-events: auto; }
.perf-panel pre { margin: 0; white-space: pre-wrap; font: inherit; }
/* ?diag=1 / ?shots=1: a small note at the bottom that never covers the drawn picture's middle. */
.perf-panel.diag-panel { top: auto; bottom: 6px; pointer-events: none; font-size: 12px; text-align: center; }
.perf-buttons { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 5px; }
.perf-buttons button { min-height: 32px; padding: 3px 8px; border: 1px solid rgba(114,227,161,.45); border-radius: 6px; color: #d9f6e5; background: rgba(114,227,161,.1); font: inherit; }

/* Upright: the game asks for the phone to be turned. */
body.phone-portrait .rotate-hint { position: fixed; inset: 0; z-index: 500; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; padding: 24px; text-align: center; color: var(--text); background: var(--bg); }
.rotate-hint strong { font-size: 18px; }
.rotate-hint small { color: var(--muted); font-size: 13px; }
.rotate-phone { width: 44px; height: 74px; border: 3px solid var(--green); border-radius: 9px; animation: rotate-phone 2.4s ease-in-out infinite; }
@keyframes rotate-phone { 0%, 25% { transform: rotate(0deg); } 55%, 100% { transform: rotate(-90deg); } }
@media (prefers-reduced-motion: reduce) { .rotate-phone { animation: none; transform: rotate(-90deg); } }

/* ---------- free-for-all (16 Nov 2026) ----------
   body.ffa-mode is the multiplayer page (game.js). Its top of the map has a tag for every side instead of the duel's two
   resilience cards; a tag opens the standings (a drawer on a phone). body.spectating is a player whose state fell and who
   watches the battle camera: the buy and operations panels give way to the camera's list. Each side's colour comes in
   as --team. Nothing here applies to the 1 vs 1 game. */
.ffa-tags, .ffa-standings, .battle-cam { display: none; }
body.ffa-mode .map-stage .map-top-overlay { display: none !important; }
body.ffa-mode .ffa-tags { position: absolute; z-index: 30; top: 16px; left: 300px; right: 300px; display: flex; justify-content: center; gap: 6px; flex-wrap: wrap; pointer-events: auto; cursor: pointer; }
body.ffa-mode.menu-open .ffa-tags { display: none; }
/* 16 Nov 2026: the toasts came up over the middle tags; in this mode they start below the tags' row. */
body.ffa-mode .toast-layer { top: 140px; }
body.phone.ffa-mode .toast-layer { top: 96px; }
body.phone.ffa-mode:has(.context-card:not(.hidden)) .toast-layer { top: 140px; }
.ffa-tag { position: relative; display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 0 8px; min-width: 116px; max-width: 168px; flex: 1 1 0; padding: 6px 10px 6px 9px; border: 1px solid color-mix(in srgb, var(--team) 40%, transparent); border-inline-start: 3px solid var(--team); border-radius: 8px; color: var(--text); background: rgba(3,9,7,.8); box-shadow: var(--shadow); text-align: start; cursor: pointer; }
.ffa-tag:hover { background: rgba(10,26,20,.9); }
.ffa-tag.me { box-shadow: 0 0 0 1px color-mix(in srgb, var(--team) 55%, transparent), var(--shadow); }
.ffa-tag-name { grid-column: 1; min-width: 0; overflow: hidden; font-size: 10px; white-space: nowrap; text-overflow: ellipsis; }
.ffa-tag-name b { font-weight: 700; }
.ffa-tag-name .short { display: none; }
.ffa-tag strong { grid-column: 2; grid-row: 1 / span 2; color: var(--team); font-size: 20px; font-variant-numeric: tabular-nums; }
.ffa-tag small { grid-column: 1; color: var(--muted); font-size: 9px; white-space: nowrap; }
.ffa-tag.out { filter: grayscale(1); opacity: .5; }
.ffa-tag.out strong { color: var(--muted); font-size: 16px; }
body.ffa-mode .ffa-standings:not(.hidden) { position: absolute; z-index: 36; top: 72px; left: 50%; transform: translateX(-50%); display: block; width: min(620px, calc(100% - 32px)); max-height: calc(100% - 96px); overflow-y: auto; padding: 10px 12px 12px; border: 1px solid var(--line-strong); border-radius: 12px; background: linear-gradient(180deg, rgba(8,22,16,.98), rgba(4,12,9,.97)); box-shadow: var(--shadow); }
.ffa-standings-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; font-size: 13px; }
.ffa-standings-head button { width: 32px; height: 32px; border: 1px solid var(--line-strong); border-radius: 8px; color: var(--text); background: transparent; font-size: 18px; cursor: pointer; }
.ffa-table { width: 100%; border-collapse: collapse; font-size: 12px; font-variant-numeric: tabular-nums; }
.ffa-table th { padding: 5px 6px; color: var(--muted); font-size: 10px; font-weight: 600; text-align: start; border-bottom: 1px solid var(--line-strong); }
.ffa-table td { padding: 6px; border-bottom: 1px solid var(--line); text-align: start; vertical-align: middle; }
.ffa-table td.place { color: var(--team); font-size: 15px; font-weight: 800; }
.ffa-table td.name span { display: flex; align-items: center; gap: 6px; }
.ffa-table td.name i { flex: none; width: 10px; height: 10px; border-radius: 50%; background: var(--team); }
.ffa-table td.name small { display: block; margin-top: 2px; color: var(--muted); font-size: 10px; }
.ffa-table tr.me td.name b { color: var(--team); }
.ffa-table tr.out td:not(.name), .ffa-table tr.out td.name b { color: var(--muted); }
.ffa-chip { display: inline-block; margin: 1px 2px; padding: 1px 6px; border: 1px solid color-mix(in srgb, var(--team) 60%, transparent); border-radius: 9px; color: var(--team); font-size: 10px; }
/* The results: the table first, then this player's own numbers (the end screen's own small labels are spans too). */
.end-screen .ffa-table { margin-bottom: 4px; }
.end-stats .ffa-table td.name span { display: flex; color: inherit; font-size: 12px; }
.end-stats .ffa-table .ffa-chip { display: inline-block; color: var(--team); font-size: 10px; }
.ffa-fallen-place { color: var(--amber) !important; font-size: 16px !important; font-weight: 700; }
.ffa-fallen-note { margin: 12px 0 0; }
body.phone .ffa-fallen .end-card { padding: 12px 16px; }
body.phone .ffa-fallen .end-card h2 { margin: 2px 0; font-size: 20px; }
body.phone .ffa-fallen-place { margin: 0; }
body.phone .ffa-fallen .end-stats { margin-top: 8px; }
body.phone .ffa-fallen .end-grid { gap: 5px; margin-top: 0; }
body.phone .ffa-fallen .end-stats article { padding: 4px 8px; }
body.phone .ffa-fallen .end-stats strong { font-size: 14px; }
body.phone .ffa-fallen-note { display: none; }
body.phone .ffa-fallen .end-actions { margin-top: 8px; }
/* The battle camera: its list where the operations room was, and nothing that gives orders. */
body.spectating .build-panel, body.spectating .intel-panel, body.spectating .phone-dock, body.spectating .map-stage.is-3d .map-instruction,
body.spectating .map-stage.is-3d .map-legend, body.spectating .map-stage.is-3d .satellite-badge,
body.spectating #toggleBuildPanel, body.spectating #toggleIntelPanel, body.spectating .map-stage.is-3d .context-card { display: none !important; }
body.spectating .battle-cam:not(.hidden) { position: absolute; z-index: 34; top: 14px; left: 14px; bottom: 14px; display: flex; flex-direction: column; gap: 8px; width: 268px; padding: 12px; border: 1px solid rgba(184,224,199,.2); border-radius: 13px; background: linear-gradient(180deg, rgba(4,14,10,.97), rgba(3,10,7,.95)); box-shadow: 0 24px 70px rgba(0,0,0,.38); }
.battle-cam-head h2 { margin: 2px 0 4px; font-size: 15px; }
.battle-cam-head small { color: var(--muted); font-size: 10px; line-height: 1.4; }
.battle-cam-now { margin: 0; padding: 7px 9px; border: 1px solid rgba(246,195,91,.35); border-radius: 8px; color: var(--amber); background: rgba(246,195,91,.07); font-size: 11px; line-height: 1.4; }
.battle-cam-list { flex: 1; min-height: 0; margin: 0; padding: 0; overflow-y: auto; list-style: none; }
.battle-cam-list li + li { margin-top: 5px; }
.battle-cam-list li.empty { color: var(--muted); font-size: 11px; line-height: 1.5; }
.battle-cam-list button { display: flex; align-items: center; gap: 8px; width: 100%; padding: 6px 8px; border: 1px solid var(--line); border-inline-start: 3px solid var(--team); border-radius: 7px; color: var(--text); background: rgba(255,255,255,.03); text-align: start; cursor: pointer; }
.battle-cam-list button.active { border-color: rgba(246,195,91,.6); background: rgba(246,195,91,.09); }
.battle-cam-list time { flex: none; color: var(--muted); font-size: 10px; font-variant-numeric: tabular-nums; }
.battle-cam-list b { display: block; font-size: 11px; }
.battle-cam-list small { display: block; color: var(--muted); font-size: 10px; }
.battle-cam .menu-secondary { flex: none; min-height: 36px; }
@media (max-width: 1180px) { body.ffa-mode .ffa-tags { left: 260px; right: 260px; } }
@media (max-width: 720px) {
  body.ffa-mode .ffa-tags { top: 9px; left: 9px; right: 9px; }
  .ffa-tag-name .long { display: none; }
  .ffa-tag-name .short { display: inline; }
}
/* A phone: the tags in one row along the top, short names; the standings a drawer from the side. */
body.phone.ffa-mode .ffa-tags { top: 6px; left: calc(8px + var(--safe-l)); right: calc(8px + var(--safe-r)); gap: 5px; flex-wrap: nowrap; }
body.phone .ffa-tag { min-width: 0; max-width: 140px; padding: 3px 7px; gap: 0 5px; }
body.phone .ffa-tag-name .long { display: none; }
body.phone .ffa-tag-name .short { display: inline; }
body.phone .ffa-tag strong { font-size: 15px; }
body.phone .ffa-tag small { font-size: 8px; }
body.phone.ffa-mode .ffa-standings:not(.hidden) { top: 0; bottom: 0; left: auto; right: 0; transform: none; width: min(440px, 72vw); max-height: none; border-radius: 12px 0 0 12px; padding: 8px calc(10px + var(--safe-r)) 10px 10px; }
body.phone .ffa-table { font-size: 11px; }
body.phone .ffa-table th, body.phone .ffa-table td { padding: 4px; }
body.phone.spectating .battle-cam:not(.hidden) { top: auto; bottom: calc(6px + var(--safe-b)); left: calc(6px + var(--safe-l)); width: min(260px, 40vw); max-height: 62%; padding: 8px; gap: 6px; }
body.phone .battle-cam-head .eyebrow, body.phone .battle-cam-head small { display: none; }
body.phone .battle-cam-head h2 { margin: 0; font-size: 13px; }
body.phone .battle-cam-list button { min-height: 40px; }

/* ---------- the name (14 Nov 2026) ----------
   COMMAND FALL in heavy capitals; FALL is green and its letters drop a little each, as if falling. Last in the file so
   it wins over the older h1 rules (.brand-block h1, .menu-brand h1, .splash-title) that have the same weight. */
h1.wordmark { font-weight: 900; letter-spacing: .07em; white-space: nowrap; direction: ltr; unicode-bidi: isolate; }
.wordmark .fall { color: var(--green); }
.wordmark .fall i { display: inline-block; font-style: normal; }
.wordmark .fall i:nth-child(2) { transform: translateY(.05em); }
.wordmark .fall i:nth-child(3) { transform: translateY(.12em); }
.wordmark .fall i:nth-child(4) { transform: translateY(.23em); }

/* ---------- bug reports and the legal links in the main menu (16 Nov 2026) ---------- */
.report-dialog { z-index: 175; }
.report-dialog .dialog-card h2 { margin-bottom: 0; }
.report-text { flex: none; width: 100%; min-height: 110px; resize: vertical; line-height: 1.5; }
.report-count { align-self: flex-end; margin-top: -6px; color: var(--muted); font-size: 11px; }
/* The picture the player adds (17 Nov 2026): "add a picture", or once one is chosen its small preview with ✕ on the
   corner, and a line beside them. The file input itself is out of sight; the button opens it. */
.report-picture { position: relative; display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; }
.report-file { position: absolute; width: 1px; height: 1px; opacity: 0; overflow: hidden; pointer-events: none; clip-path: inset(50%); }
.report-picture .report-add { flex: 0 0 auto; width: auto; padding-inline: 18px; }
.report-picture .setting-note { flex: 1 1 150px; margin: 0; }
.report-thumb { position: relative; flex: 0 0 auto; width: 120px; height: 72px; margin: 8px 0 0; margin-inline-end: 8px; border: 1px solid var(--line-strong); border-radius: 8px; background: #000; }
.report-thumb img { display: block; width: 100%; height: 100%; object-fit: cover; border-radius: 7px; }
.report-remove { position: absolute; top: -10px; inset-inline-end: -10px; display: grid; place-items: center; width: 26px; height: 26px; padding: 0; border: 1px solid var(--line-strong); border-radius: 50%; background: #0b1b15; color: var(--text); font: inherit; font-size: 12px; line-height: 1; cursor: pointer; }
.report-remove:hover, .report-remove:focus-visible { background: var(--surface-3); color: var(--red, #ff635f); }
.report-add.hidden, .report-thumb.hidden { display: none; }
.menu-row-home { flex-wrap: wrap; }
.menu-legal { display: flex; flex: 1 0 100%; justify-content: center; gap: 8px; margin: 0; color: var(--muted); font-size: 11px; }
.menu-legal a { color: var(--muted); text-decoration: underline; text-underline-offset: 2px; }
.menu-legal a:hover, .menu-legal a:focus-visible { color: var(--green); }
/* On a phone the box is short enough to leave room for the keyboard, and 16px text keeps an iPhone from zooming in. */
body.phone .report-text { min-height: 64px; height: 72px; font-size: 16px; }
body.phone .report-thumb { width: 96px; height: 56px; }
body.phone .report-remove { width: 30px; height: 30px; }
/* A phone's menu fits its height without scrolling: the two links stand in a small column beside the three buttons. */
body.phone .menu-row-home { flex-wrap: nowrap; gap: 6px; }
body.phone .menu-row-home .menu-secondary { min-width: 0; padding-inline: 6px; }
body.phone .menu-legal { flex: 0 0 auto; flex-direction: column; justify-content: center; align-items: flex-start; gap: 0; font-size: 10.5px; line-height: 1.2; }
body.phone .menu-legal a { padding: 3px 2px; }
body.phone .menu-legal > span { display: none; }
