/* =========================================
   THEME TOKENS
========================================= */

:root {
  --bg: #0f141a;
  --panel: #18212b;
  --panel-2: #121922;
  --panel-3: #0f1720;

  --line: #314558;
  --line-soft: rgba(255, 255, 255, 0.06);

  --text: #e6edf3;
  --muted: #9fb0bf;

  --accent: #f0b000;
  --danger: #c84d4d;
  --info: #77d1ff;
}

/* =========================================
   GLOBAL RESET
========================================= */

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  width: 100%;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: Arial, Helvetica, sans-serif;
}

body {
  overflow: hidden;
}

/* =========================================
   APP LAYOUT
========================================= */

/* =========================================
   FRONT SCREEN
========================================= */

.front-screen {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: stretch;
  justify-content: center;
  z-index: 60;
  background:
    radial-gradient(circle at top, rgba(28, 39, 52, 0.78) 0%, rgba(11, 16, 22, 0.88) 64%),
    linear-gradient(180deg, #0f141a 0%, #0a0f14 100%);
}

.front-screen.is-hidden,
.front-screen-view.is-hidden,
.main.is-hidden {
  display: none;
}

.front-screen-view {
  width: 100%;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px;
}

.front-screen-panel {
  width: min(960px, 100%);
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(15, 23, 32, 0.88);
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.42);
}

.front-screen-panel-title {
  width: min(1280px, calc(100vw - 64px));
  min-height: min(720px, calc(100vh - 64px));
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 40px;
  text-align: center;
  background:
    linear-gradient(180deg, rgba(5, 10, 16, 0.08) 0%, rgba(5, 10, 16, 0.34) 60%, rgba(5, 10, 16, 0.72) 100%),
    url("./art/menu/titleScreen.png") center center / cover no-repeat;
}

.front-screen-panel-select {
  padding: 32px;
}

.front-screen-title-actions {
  padding: 18px;
  border-radius: 18px;
  background: rgba(7, 12, 18, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.36);
}

.front-screen-kicker {
  font-size: 12px;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: var(--muted);
}

.front-screen-title {
  margin: 12px 0 0;
  font-size: clamp(42px, 7vw, 78px);
  line-height: 0.95;
  color: #f6f1d5;
}

.front-screen-subtitle {
  margin: 10px 0 0;
  font-size: 28px;
  color: #f6f1d5;
}

.front-screen-text,
.front-screen-card-text {
  color: var(--muted);
  font-size: 16px;
  line-height: 1.5;
}

.front-screen-text {
  max-width: 620px;
  margin: 18px auto 0;
}

.front-screen-actions {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-top: 28px;
}

.front-screen-actions-bottom {
  justify-content: flex-end;
}

.front-screen-primary {
  background: #c89013;
  border-color: #e1af3a;
  color: #10161d;
  font-weight: 700;
}

.front-screen-primary:hover {
  background: #dfa126;
}

.front-screen-actions button.is-selected,
.front-screen-list-button.is-selected {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px rgba(240, 176, 0, 0.28), 0 0 0 3px rgba(240, 176, 0, 0.12);
}

.front-screen-select-layout {
  display: grid;
  grid-template-columns: minmax(280px, 360px) minmax(0, 1fr);
  gap: 20px;
  margin-top: 22px;
}

.front-screen-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.front-screen-list-button {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  width: 100%;
  padding: 14px 16px;
  border-radius: 10px;
  text-align: left;
}

.front-screen-list-button.is-selected {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px rgba(240, 176, 0, 0.28);
}

.front-screen-list-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
}

.front-screen-list-sub {
  font-size: 11px;
  color: var(--muted);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.front-screen-sidecard {
  min-height: 260px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 20px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(9, 14, 20, 0.62);
}

.front-screen-card-title {
  font-size: 22px;
  font-weight: 700;
  color: #f6f1d5;
}

@media (max-width: 780px) {
  .front-screen-panel-title,
  .front-screen-panel-select {
    padding: 24px;
  }

  .front-screen-select-layout {
    grid-template-columns: 1fr;
  }

  .front-screen-actions,
  .front-screen-actions-bottom {
    flex-wrap: wrap;
    justify-content: center;
  }
}


.app {
  display: flex;
  width: 100vw;
  height: 100vh;
  overflow: hidden;
}

.sidebar {
  width: 320px;
  min-width: 320px;
  background: var(--panel);
  border-right: 1px solid var(--line);
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  overflow: hidden;
}

.main {
  flex: 1;
  min-width: 0;
  min-height: 0;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  overflow: hidden;
}

.panel-title {
  font-size: 18px;
  font-weight: 700;
}

.panel-sub {
  font-size: 12px;
  color: var(--muted);
}

/* =========================================
   CONTROLS / BUTTONS
========================================= */

button {
  background: #22303d;
  color: var(--text);
  border: 1px solid #3a5268;
  padding: 8px 12px;
  cursor: pointer;
  border-radius: 6px;
}

button:hover {
  background: #2a3a49;
}

button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
  flex: 0 0 auto;
}

#devToolbar {
  position: fixed;
  left: -9999px;
  top: -9999px;
  opacity: 0;
  pointer-events: none;
}

/* =========================================
   EDITOR PANEL
========================================= */

#editor {
  width: 100%;
  max-width: 100%;
  aspect-ratio: 1 / 1;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 8px;
  display: block;
  flex: 0 1 auto;
  min-height: 0;
}

.editor-text {
  fill: #ffffff;
  font-size: 11px;
  text-anchor: middle;
  dominant-baseline: middle;
  pointer-events: none;
  font-weight: 700;
}

.editor-mode-title {
  fill: #f5e7b0;
  font-size: 14px;
  text-anchor: start;
  dominant-baseline: middle;
  pointer-events: none;
  font-weight: 700;
}

.editor-mode-sub {
  fill: #b8c7d4;
  font-size: 10px;
  text-anchor: start;
  dominant-baseline: middle;
  pointer-events: none;
}

.editor-detail-text-large {
  fill: #ffffff;
  font-size: 18px;
  text-anchor: middle;
  dominant-baseline: middle;
  pointer-events: none;
  font-weight: 700;
}

/* --- mech tile edit --- */

.editor-cell {
  stroke: #2b3a48;
  stroke-width: 1;
  cursor: pointer;
}

.editor-cell:hover {
  stroke: var(--accent);
  stroke-width: 2;
}

.editor-cell-selected {
  stroke: var(--accent);
  stroke-width: 2;
}

/* --- detail mode minimap --- */

.editor-cell-mini {
  stroke: rgba(255, 255, 255, 0.12);
  stroke-width: 0.8;
  cursor: pointer;
}

.editor-cell-mini:hover {
  stroke: var(--accent);
  stroke-width: 1.4;
}

.editor-cell-mini-selected {
  stroke: var(--accent);
  stroke-width: 2;
}

/* --- detail cell editor --- */

.editor-cell-detail {
  stroke: rgba(255, 255, 255, 0.16);
  stroke-width: 1;
  cursor: pointer;
}

.editor-cell-detail:hover {
  stroke: var(--accent);
  stroke-width: 2;
}

.editor-cell-detail-large {
  stroke: rgba(255, 255, 255, 0.2);
  stroke-width: 1.4;
}

/* =========================================
   BOARD / STAGE
========================================= */

.stage {
  position: relative;
  min-height: 0;
  overflow: hidden;
}

#board {
  width: 100%;
  height: 100%;
  display: block;
  background: radial-gradient(circle at top, #18212b 0%, #0f141a 70%);
}

.iso-label {
  fill: #d7e3ec;
  font-size: 10px;
  text-anchor: middle;
  pointer-events: none;
}

.grid-outline {
  fill: none;
  stroke: rgba(255, 255, 255, 0.04);
  stroke-width: 1;
}

/* =========================================
   TERRAIN RENDERING
========================================= */

.tile-top,
.tile-left,
.tile-right,
.tile-outline {
  vector-effect: non-scaling-stroke;
}

.tile-outline {
  fill: none;
}

/* =========================================
   MECH RENDERING
========================================= */

.mech-shadow {
  fill: rgba(0, 0, 0, 0.22);
}

.mech-top-body {
  fill: #c84d4d;
  stroke: #581d1d;
  stroke-width: 1.5;
}

.mech-top-body-active {
  stroke: rgba(240, 176, 0, 0.95);
  stroke-width: 2.5;
}

.mech-top-body-preview {
  fill: #d88d22;
  stroke: rgba(0, 0, 0, 0.70);
  stroke-width: 2.5;
}

.mech-top-facing {
  fill: #dceeff;
  stroke: rgba(0, 0, 0, 0.55);
  stroke-width: 1;
}

.mech-top-facing-preview {
  fill: #ffe28a;
  stroke: rgba(0, 0, 0, 0.70);
  stroke-width: 1.2;
}

.mech-cube-top {
  fill: #c84d4d;
  stroke: #581d1d;
  stroke-width: 1.5;
}

.mech-cube-top-active {
  stroke: rgba(240, 176, 0, 0.95);
  stroke-width: 2.5;
}

.mech-cube-top-preview {
  fill: #d88d22;
  stroke: rgba(0, 0, 0, 0.70);
  stroke-width: 2.5;
}

.mech-cube-top-stripe {
  fill: #dceeff;
  stroke: rgba(0, 0, 0, 0.55);
  stroke-width: 0.8;
}

.mech-cube-top-stripe-preview {
  fill: #ffe28a;
  stroke: rgba(0, 0, 0, 0.70);
  stroke-width: 0.9;
}

.mech-cube-left {
  fill: #9e3535;
  stroke: #581d1d;
  stroke-width: 1.25;
}

.mech-cube-right {
  fill: #b84444;
  stroke: #581d1d;
  stroke-width: 1.25;
}

.mech-label {
  fill: #f6f1d5;
  font-size: 11px;
  text-anchor: middle;
  font-weight: 700;
  pointer-events: none;
}

.mech-footprint {
  fill: rgba(240, 176, 0, 0.10);
  stroke: rgba(240, 176, 0, 0.45);
  stroke-width: 1.5;
}

.unit-status-plate {
  fill: rgba(10, 14, 20, 0.82);
  stroke: rgba(246, 241, 213, 0.65);
  stroke-width: 1.25;
  pointer-events: none;
}

.unit-status-name {
  fill: #f6f1d5;
  font-size: 10px;
  font-weight: 700;
  text-anchor: middle;
  dominant-baseline: middle;
  pointer-events: none;
}

.unit-status-stats {
  fill: #d7dde8;
  font-size: 8px;
  font-weight: 700;
  text-anchor: middle;
  dominant-baseline: middle;
  pointer-events: none;
}

.unit-status-text {
  fill: #f6f1d5;
  font-size: 8px;
  font-weight: 700;
  text-anchor: middle;
  dominant-baseline: middle;
  stroke: rgba(0, 0, 0, 0.82);
  stroke-width: 2;
  paint-order: stroke fill;
  pointer-events: none;
}

/* =========================================
   COMBAT RIBBON
========================================= */

.combat-ribbon {
  display: flex;
  flex-direction: column;
  gap: 0;
  padding: 0;
  background: transparent;
  border-bottom: 0;
  min-height: 0;
  height: 0;
  overflow: hidden;
}

.combat-ribbon-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.combat-ribbon-round {
  font-size: 14px;
  font-weight: 700;
  color: #f6f1d5;
}

.combat-ribbon-phase {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--muted);
}

.combat-ribbon-rows {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.combat-ribbon-row {
  display: grid;
  grid-template-columns: 76px minmax(0, 1fr);
  gap: 8px;
  align-items: start;
}

.combat-ribbon-row-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding-top: 7px;
}

.combat-ribbon-row-cells {
  display: flex;
  gap: 6px;
  min-width: 0;
  overflow-x: auto;
  padding-bottom: 2px;
}

.combat-ribbon-cell {
  min-width: 138px;
  padding: 7px 8px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--panel-2);
  transition: opacity 120ms ease, transform 120ms ease, border-color 120ms ease;
}

.combat-ribbon-cell.is-phase-dim {
  opacity: 0.58;
}

.combat-ribbon-cell.is-complete {
  opacity: 0.42;
}

.combat-ribbon-cell.is-active {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px rgba(240, 176, 0, 0.35);
  transform: translateY(-1px);
}

.combat-ribbon-cell-name {
  font-size: 12px;
  font-weight: 700;
  color: var(--text);
  line-height: 1.1;
}

.combat-ribbon-cell-sub {
  margin-top: 3px;
  font-size: 10px;
  color: var(--muted);
  line-height: 1.2;
}

.combat-ribbon-empty {
  padding: 7px 8px;
  font-size: 11px;
  color: var(--muted);
  border: 1px dashed var(--line);
  border-radius: 8px;
}

/* =========================================
   COMBAT OVERLAY
========================================= */

.combat-overlay {
  position: absolute;
  inset: 68px 0 110px 0;
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 15;
  pointer-events: none;
}

.combat-overlay.is-visible {
  display: flex;
}

.combat-overlay.is-clickthrough {
  pointer-events: none;
}

.combat-overlay:not(.is-clickthrough) {
  pointer-events: auto;
}

.combat-overlay-card {
  min-width: 320px;
  max-width: 460px;
  padding: 18px 20px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: rgba(12, 18, 24, 0.95);
  box-shadow: 0 18px 42px rgba(0, 0, 0, 0.34);
  text-align: center;
}

.combat-overlay-title {
  font-size: 20px;
  font-weight: 700;
  color: #f6f1d5;
}

.combat-overlay-text {
  margin-top: 8px;
  font-size: 13px;
  line-height: 1.4;
  color: var(--muted);
}

.combat-start-button {
  margin-top: 14px;
  min-width: 180px;
  font-size: 14px;
  font-weight: 700;
}

.combat-splash-banner {
  padding: 12px 18px;
  border-radius: 12px;
  border: 1px solid var(--accent);
  background: rgba(15, 20, 26, 0.94);
  color: #f6f1d5;
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 0.04em;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.28);
}

.combat-overlay.is-splash-visible {
  align-items: center;
  justify-content: center;
}

.combat-splash-card {
  min-width: min(78vw, 520px);
  max-width: min(88vw, 720px);
  padding: 26px 34px 28px;
  border-radius: 20px;
  border: 1px solid rgba(240, 176, 0, 0.65);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.04) 0%, rgba(255, 255, 255, 0.01) 100%),
    rgba(10, 15, 21, 0.96);
  box-shadow:
    0 22px 52px rgba(0, 0, 0, 0.42),
    inset 0 1px 0 rgba(255, 255, 255, 0.04);
  text-align: center;
  animation: combatSplashPulse 1800ms ease-out both;
}

.combat-splash-round {
  font-size: clamp(20px, 2vw, 26px);
  line-height: 1;
  font-weight: 800;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: #f0b000;
  text-shadow: 0 0 16px rgba(240, 176, 0, 0.18);
}

.combat-splash-phase {
  margin-top: 10px;
  font-size: clamp(34px, 4vw, 52px);
  line-height: 1.05;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #f6f1d5;
  text-shadow: 0 4px 24px rgba(0, 0, 0, 0.35);
}

@keyframes combatSplashPulse {
  0% {
    opacity: 0;
    transform: translateY(10px) scale(0.97);
  }

  12% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }

  84% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }

  100% {
    opacity: 0;
    transform: translateY(-4px) scale(1.01);
  }
}

/* =========================================
   HUD LAYOUT
========================================= */

.hud {
  position: relative;
  z-index: 30;

  display: grid;
  grid-template-columns: 1fr 1.2fr 0.9fr;
  gap: 6px;
  padding: 6px 8px 8px;
  background: linear-gradient(180deg, #131b24 0%, #0d141b 100%);
  border-top: 1px solid var(--line);
  overflow: visible;

  min-height: 104px;
  height: auto;
  max-height: 34vh;
  align-items: end;
}

.hud-panel {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.02) 0%, rgba(255, 255, 255, 0) 100%),
    var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 6px 8px;
  overflow: hidden;

  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  gap: 6px;
  min-height: 0;
}

.hud-section-title {
  flex: 0 0 auto;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  padding-bottom: 4px;
  border-bottom: 1px solid var(--line-soft);
  line-height: 1;
}

.hud-unit-row,
.hud-mode-box,
.hud-mini-card,
.hud-stat-row,
.hud-menu-list,
.hud-step-row,
.hud-idle-actions {
  flex: 0 0 auto;
}

.hud-unit-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}

.hud-unit-name {
  font-size: 15px;
  font-weight: 700;
  color: #f6f1d5;
  line-height: 1.05;
}

.hud-subline {
  font-size: 11px;
  color: var(--muted);
  line-height: 1.2;
  margin-top: 2px;
}

.hud-stat-row {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
}

.hud-inline-stat {
  display: flex;
  flex-direction: column;
  gap: 3px;
  background: var(--panel-3);
  border: 1px solid var(--line-soft);
  border-radius: 6px;
  padding: 5px 6px;
  min-height: 36px;
  min-width: 0;
}

.hud-inline-stat-label {
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  line-height: 1;
}

.hud-inline-stat-value {
  font-size: 12px;
  font-weight: 700;
  color: var(--text);
  line-height: 1.05;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.hud-mode-box {
  background: var(--panel-3);
  border: 1px solid var(--line-soft);
  border-radius: 6px;
  padding: 7px 8px;
}

.hud-mode-title {
  font-size: 10px;
  font-weight: 700;
  color: #f6f1d5;
  margin-bottom: 4px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  line-height: 1;
}

.hud-mode-text {
  font-size: 11px;
  color: var(--text);
  line-height: 1.2;
}

.hud-mini-card {
  background: var(--panel-3);
  border: 1px solid var(--line-soft);
  border-radius: 6px;
  padding: 7px 8px;
  min-width: 0;
}

.hud-context-title {
  font-size: 13px;
  font-weight: 700;
  color: #f6f1d5;
  line-height: 1.05;
}

.hud-context-sub {
  font-size: 11px;
  color: var(--muted);
  margin-top: 3px;
  line-height: 1.2;
}

.hud-context-sub.status {
  font-weight: 600;
  letter-spacing: 0.02em;
}

.hud-tag {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  align-self: flex-start;
  padding: 4px 8px;
  border-radius: 999px;
  background: var(--panel-3);
  border: 1px solid var(--line);
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  line-height: 1;
  white-space: nowrap;
}

.hud-idle-actions {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.hud-command-button.compact {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #1b2733;
  border: 1px solid #355068;
  border-radius: 6px;
  padding: 8px 10px;
  color: var(--text);
  font-size: 13px;
  font-weight: 700;
  line-height: 1.1;
  min-height: 34px;
}

.hud-command-button.compact:hover:not(:disabled) {
  background: #233343;
}
.hud-command-button.compact.is-selected {
  background: rgba(240, 176, 0, 0.14);
  border-color: rgba(240, 176, 0, 0.7);
  color: #fff4c2;
}


.hud-command-key {
  font-size: 10px;
  color: var(--muted);
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  white-space: nowrap;
}

.hud-menu-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-height: 0;
}

.hud-menu-button {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 8px;
  justify-content: flex-start;
  background: #18232e;
  border: 1px solid #314558;
  border-radius: 6px;
  padding: 7px 10px;
  color: var(--text);
  font-size: 13px;
  font-weight: 700;
  line-height: 1.1;
  min-height: 30px;
}

.hud-menu-button:hover {
  background: #22303d;
}

.hud-menu-button.is-selected {
  background: rgba(240, 176, 0, 0.14);
  border-color: rgba(240, 176, 0, 0.7);
  color: #fff4c2;
}

.hud-menu-button.is-disabled,
.hud-menu-button:disabled {
  background: #121a22;
  border-color: #273645;
  color: rgba(221, 221, 221, 0.42);
  cursor: not-allowed;
}

.hud-menu-button.is-disabled:hover,
.hud-menu-button:disabled:hover {
  background: #121a22;
}

.hud-menu-caret {
  width: 12px;
  color: var(--accent);
  display: inline-flex;
  justify-content: center;
  flex: 0 0 12px;
}

.hud-step-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
}

.hud-step {
  background: #17212b;
  border: 1px solid var(--line-soft);
  border-radius: 6px;
  padding: 6px 7px;
  font-size: 10px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.hud-step.is-active {
  color: #fff4c2;
  border-color: rgba(240, 176, 0, 0.55);
  background: rgba(240, 176, 0, 0.10);
}

/* =========================================
   HUD TARGET STATUS
========================================= */

.hud-status-available {
  color: #4fd1a5;
}

.hud-status-half {
  color: #f6ad55;
}

.hud-status-blocked {
  color: #f56565;
}

.hud-status-out {
  color: #a0aec0;
}

.hud-status-available,
.hud-status-half,
.hud-status-blocked {
  text-shadow: 0 0 6px rgba(0, 0, 0, 0.6);
}

/* =========================================
   HELP DRAWER
========================================= */

.help-drawer {
  position: absolute;
  right: 14px;
  bottom: 100%;
  width: 360px;
  max-width: min(360px, calc(100vw - 28px));

  display: flex;
  flex-direction: column;

  z-index: 200;
  pointer-events: none;
}

.help-drawer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 12px;

  background: rgba(15, 23, 32, 0.97);
  border: 1px solid var(--line);
  border-bottom: none;
  border-top-left-radius: 10px;
  border-top-right-radius: 10px;
  box-shadow: 0 -8px 18px rgba(0, 0, 0, 0.28);

  transform: translateY(1px);
}

.help-drawer-title {
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.08em;
  color: #f0b000;
}

.help-drawer-hotkey {
  font-size: 11px;
  font-weight: 700;
  color: var(--muted);
}

.help-drawer-body {
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  gap: 10px;
  padding: 12px 12px 10px;

  background: rgba(15, 23, 32, 0.97);
  border: 1px solid var(--line);
  border-bottom: none;
  border-top-left-radius: 10px;
  border-top-right-radius: 10px;
  box-shadow: 0 -12px 30px rgba(0, 0, 0, 0.42);

  max-height: 0;
  opacity: 0;
  overflow: hidden;
  visibility: hidden;

  transition:
    max-height 180ms ease,
    opacity 180ms ease,
    visibility 180ms ease,
    padding 180ms ease;
}

.help-drawer.is-open .help-drawer-body {
  max-height: 520px;
  opacity: 1;
  visibility: visible;
}

.help-section {
  display: grid;
  gap: 6px;
}

.help-section-title {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #f0b000;
}

.help-list {
  display: grid;
  gap: 4px;
}

.help-row {
  display: grid;
  grid-template-columns: 132px 1fr;
  gap: 10px;
  align-items: center;
  min-height: 22px;
}

.help-key {
  font-size: 11px;
  font-weight: 700;
  color: #dfe8ef;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--line-soft);
  border-radius: 6px;
  padding: 4px 8px;
  text-align: center;
  white-space: nowrap;
}

.help-label {
  font-size: 12px;
  color: var(--text);
}

/* =========================================
   RESPONSIVE HUD
========================================= */

@media (max-height: 820px) {
  .hud {
    min-height: 94px;
    padding: 5px 7px 7px;
  }

  .hud-panel {
    padding: 5px 7px;
    gap: 5px;
  }

  .hud-unit-name {
    font-size: 14px;
  }

  .hud-subline,
  .hud-mode-text,
  .hud-context-sub {
    font-size: 10px;
  }

  .hud-inline-stat-value {
    font-size: 11px;
  }
}

@media (max-height: 720px) {
  .hud {
    min-height: 88px;
    max-height: 30vh;
  }

  .hud-panel {
    gap: 4px;
  }

  .hud-section-title {
    font-size: 9px;
    padding-bottom: 3px;
  }

  .hud-unit-name {
    font-size: 13px;
  }

  .hud-subline,
  .hud-mode-text,
  .hud-context-sub {
    font-size: 9px;
    line-height: 1.1;
  }

  .hud-inline-stat {
    min-height: 32px;
    padding: 4px 5px;
  }

  .hud-inline-stat-label {
    font-size: 8px;
  }

  .hud-inline-stat-value {
    font-size: 10px;
  }

  .hud-context-title {
    font-size: 12px;
  }

  .hud-step {
    padding: 5px 6px;
    font-size: 9px;
  }

  .hud-command-button.compact,
  .hud-menu-button {
    min-height: 28px;
    font-size: 12px;
    padding: 6px 8px;
  }

.mech-top-facing,
.mech-top-facing-preview {
  fill: none;
  stroke-linecap: round;
}

.mech-top-facing {
  stroke: #dceeff;
  stroke-width: 3;
}

.mech-top-facing-preview {
  stroke: #ffe28a;
  stroke-width: 3.5;
}
}


/* =========================================
   MAP EDITOR POLISH
========================================= */

.editor-brush-preview {
  fill: rgba(255, 214, 92, 0.12);
  stroke: rgba(255, 214, 92, 0.95);
  stroke-width: 2;
  pointer-events: none;
}

.editor-spawn-marker {
  stroke: rgba(255,255,255,0.9);
  stroke-width: 1.25;
  pointer-events: none;
}

.editor-spawn-marker-player {
  fill: #2b5f9b;
}

.editor-spawn-marker-enemy {
  fill: #8c2b2b;
}

.editor-spawn-text {
  fill: #ffffff;
  font-size: 10px;
  text-anchor: middle;
  dominant-baseline: middle;
  pointer-events: none;
  font-weight: 700;
}

.editor-movement-badge {
  stroke: rgba(255,255,255,0.35);
  stroke-width: 1;
  pointer-events: none;
}

.editor-movement-badge-difficult {
  fill: rgba(143,125,47,0.88);
}

.editor-movement-badge-hazard {
  fill: rgba(185,77,47,0.9);
}

.editor-movement-badge-impassable {
  fill: rgba(43,43,43,0.92);
}

.editor-badge-text {
  fill: #ffffff;
  font-size: 10px;
  text-anchor: middle;
  dominant-baseline: middle;
  pointer-events: none;
  font-weight: 700;
}

/* =========================================
   MISSION RUNTIME V1 — BRIEFING / DIALOGUE
========================================= */

.front-screen-panel-briefing {
  max-width: 860px;
}

.front-screen-briefing-map {
  margin-top: 8px;
  font-size: 12px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.front-screen-briefing-text {
  margin-top: 22px;
  padding: 18px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.035);
  color: var(--text);
  font-size: 16px;
  line-height: 1.55;
}

.front-screen-briefing-objective-title {
  margin-top: 22px;
}

.front-screen-objective-list {
  margin: 10px 0 0;
  padding-left: 20px;
  color: var(--muted);
  line-height: 1.55;
}

.hud-dialogue-portrait-wrap {
  display: flex;
  gap: 12px;
  align-items: center;
}

.hud-dialogue-portrait {
  width: 74px;
  height: 74px;
  flex: 0 0 auto;
  border: 1px solid rgba(240, 176, 0, 0.45);
  border-radius: 12px;
  overflow: hidden;
  background:
    linear-gradient(135deg, rgba(240, 176, 0, 0.12), rgba(119, 209, 255, 0.08)),
    rgba(255, 255, 255, 0.04);
  display: flex;
  align-items: center;
  justify-content: center;
  color: rgba(246, 241, 213, 0.9);
  font-size: 26px;
  font-weight: 900;
}

.hud-dialogue-portrait img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.hud-dialogue-name {
  font-size: 17px;
  font-weight: 900;
  color: #f6f1d5;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.hud-dialogue-sub {
  margin-top: 5px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.hud-dialogue-text {
  min-height: 74px;
  padding: 12px 14px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.035);
  color: var(--text);
  font-size: 16px;
  line-height: 1.45;
}

.hud-dialogue-progress {
  margin-top: 8px;
  color: var(--muted);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

/* =========================================
   MISSION BUILDER — FULLSCREEN WYSIWYG SHELL
========================================= */

.mission-builder {
  position: fixed;
  inset: 0;
  z-index: 10000;
  background: rgba(4, 8, 13, 0.98);
  color: var(--text);
  font-family: inherit;
}

.builder-frame {
  display: grid;
  grid-template-rows: 72px 1fr 34px;
  height: 100vh;
  min-height: 0;
}

.builder-topbar {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) auto auto;
  align-items: center;
  gap: 18px;
  padding: 12px 18px;
  background: rgba(10, 16, 24, 0.96);
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.34);
}

.builder-kicker,
.builder-section-kicker,
.builder-readout-kicker {
  color: #f0b000;
  font-size: 10px;
  line-height: 1;
  font-weight: 900;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.builder-title-block h1,
.builder-workspace-header h2 {
  margin: 4px 0 0;
  color: #f5f7ff;
  font-weight: 900;
  letter-spacing: 0.02em;
}

.builder-title-block h1 { font-size: 24px; }
.builder-workspace-header h2 { font-size: 20px; }

.builder-status-strip {
  display: flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
}

.builder-status-strip span,
.builder-bottombar > div,
.builder-workspace-note,
.builder-field-label,
.builder-inspector-note {
  color: var(--muted);
  font-size: 12px;
}

.builder-status-strip span {
  padding: 6px 10px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.04);
  color: #dfe8ef;
  font-weight: 800;
}

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

.builder-top-actions button,
.builder-tab {
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.06);
  color: #eaf2fb;
  border-radius: 9px;
}

.builder-top-actions button {
  padding: 8px 10px;
  font-size: 12px;
  font-weight: 800;
}

.builder-top-actions button:hover,
.builder-tab:hover { background: rgba(255, 255, 255, 0.11); }

.builder-top-actions .builder-close {
  border-color: rgba(240, 176, 0, 0.45);
  color: #ffe0a0;
}

.builder-body {
  display: grid;
  grid-template-columns: 176px minmax(420px, 1fr) 320px;
  min-height: 0;
}

.builder-tabs {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 14px 10px;
  overflow: auto;
  background: rgba(10, 16, 24, 0.9);
  border-right: 1px solid rgba(255, 255, 255, 0.08);
}

.builder-tab {
  width: 100%;
  padding: 9px 10px;
  text-align: left;
  font-size: 12px;
  font-weight: 850;
  letter-spacing: 0.02em;
}

.builder-tab.is-active {
  background: linear-gradient(90deg, rgba(240, 176, 0, 0.22), rgba(255, 255, 255, 0.06));
  border-color: rgba(240, 176, 0, 0.56);
  color: #fff4cc;
}

.builder-workspace-shell {
  display: grid;
  grid-template-rows: auto 1fr;
  min-width: 0;
  min-height: 0;
  padding: 14px;
  gap: 12px;
}

.builder-workspace-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 18px;
  min-height: 52px;
}

.builder-workspace-note {
  max-width: 520px;
  text-align: right;
  line-height: 1.35;
}

.builder-workspace {
  position: relative;
  min-height: 0;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 16px;
  background: rgba(5, 9, 15, 0.9);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.03), 0 18px 50px rgba(0,0,0,0.36);
}

.builder-workspace svg {
  width: 100%;
  height: 100%;
  min-height: 360px;
  display: block;
}

.builder-readout {
  position: absolute;
  left: 14px;
  bottom: 14px;
  width: min(320px, calc(100% - 28px));
  padding: 12px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 12px;
  background: rgba(8, 14, 22, 0.88);
  box-shadow: 0 10px 24px rgba(0,0,0,0.28);
}

.builder-readout-title {
  margin-top: 4px;
  color: #f5f7ff;
  font-size: 14px;
  font-weight: 900;
}

.builder-readout-grid {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 5px 12px;
  margin-top: 10px;
  font-size: 11px;
}

.builder-readout-grid span { color: var(--muted); }
.builder-readout-grid strong { color: #eaf2fb; text-align: right; }

.builder-inspector {
  min-width: 0;
  padding: 14px;
  overflow: auto;
  background: rgba(10, 16, 24, 0.92);
  border-left: 1px solid rgba(255, 255, 255, 0.08);
}

.builder-panel-title {
  color: #f0b000;
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  margin-bottom: 10px;
}

.builder-inspector-card,
.builder-inspector-note {
  padding: 10px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.035);
  margin-bottom: 10px;
}

.builder-field-label {
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 850;
}

.builder-field-value {
  margin-top: 5px;
  color: #f5f7ff;
  font-size: 14px;
  font-weight: 800;
  line-height: 1.3;
}

.builder-inspector-note { line-height: 1.4; }

.builder-bottombar {
  display: grid;
  grid-template-columns: 0.9fr minmax(220px, 0.9fr) auto minmax(240px, 0.55fr);
  gap: 12px;
  align-items: center;
  padding: 7px 14px;
  background: rgba(10, 16, 24, 0.96);
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.builder-bottombar > div:last-child {
  text-align: right;
  color: #dfe8ef;
}

.builder-bottombar [data-builder-selection-summary] {
  color: #dffbff;
  font-weight: 800;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* =========================================
   MISSION BUILDER — WORKSPACE CORE V1
========================================= */

.builder-workspace svg[data-builder-board] {
  cursor: crosshair;
}

.builder-readout-help {
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--muted);
  font-size: 11px;
  line-height: 1.35;
}

.builder-inspector-card.is-emphasis {
  border-color: rgba(255, 122, 182, 0.55);
  background: rgba(255, 122, 182, 0.11);
}

.builder-workspace-overlays polygon,
.builder-workspace-overlays line {
  filter: drop-shadow(0 0 6px rgba(103, 232, 249, 0.35));
}

/* =========================================
   MISSION BUILDER — ADAPTER READ OVERLAYS V1
========================================= */

.builder-workspace-side {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
}

.builder-overlay-toggles {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px;
}

.builder-overlay-toggle {
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.055);
  color: var(--muted);
  padding: 4px 8px;
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.builder-overlay-toggle.is-active {
  border-color: rgba(103, 232, 249, 0.58);
  background: rgba(103, 232, 249, 0.14);
  color: #dffbff;
}

.builder-overlay-deployment {
  fill: rgba(103, 232, 249, 0.12);
  stroke: rgba(103, 232, 249, 0.72);
  stroke-width: 2;
  vector-effect: non-scaling-stroke;
}

.builder-overlay-room {
  fill: rgba(240, 176, 0, 0.08);
  stroke: rgba(240, 176, 0, 0.42);
  stroke-width: 1.5;
  vector-effect: non-scaling-stroke;
}

.builder-overlay-spawn {
  fill: rgba(255, 122, 182, 0.24);
  stroke: rgba(255, 122, 182, 0.9);
  stroke-width: 2.5;
  vector-effect: non-scaling-stroke;
}

.builder-overlay-spawn-text,
.builder-overlay-label,
.builder-overlay-edge-label {
  font-family: inherit;
  font-weight: 950;
  paint-order: stroke;
  stroke: rgba(0, 0, 0, 0.75);
  stroke-width: 3px;
  vector-effect: non-scaling-stroke;
}

.builder-overlay-spawn-text {
  fill: #ffe5f1;
  font-size: 11px;
}

.builder-overlay-label {
  fill: #f5f7ff;
  font-size: 9px;
}

.builder-overlay-label-room { fill: #ffe8aa; }
.builder-overlay-label-deploy { fill: #dffbff; }
.builder-overlay-label-height { fill: #ffffff; }

.builder-overlay-structure-edge {
  stroke-width: 4;
  stroke-linecap: round;
  vector-effect: non-scaling-stroke;
}

.builder-overlay-structure-edge.is-blocking {
  stroke: rgba(255, 122, 182, 0.95);
}

.builder-overlay-structure-edge.is-open {
  stroke: rgba(121, 255, 184, 0.86);
  stroke-dasharray: 5 4;
}

.builder-overlay-edge-label {
  fill: #ffd6e7;
  font-size: 8px;
}
