:root {
  color-scheme: dark;
  --bg: #070a0b;
  --panel: #101619;
  --panel-2: #151d21;
  --line: #2d3d3f;
  --text: #ecf4ec;
  --muted: #93a5a0;
  --spice: #d89b35;
  --cyan: #65d7d1;
  --red: #ef6a58;
  --green: #8bcf67;
  --danger: #ff5b4f;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html,
body,
#app {
  width: 100%;
  height: 100%;
  margin: 0;
  min-width: 0;
}

body {
  overflow: hidden;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button {
  border: 1px solid #355057;
  border-radius: 6px;
  background: linear-gradient(180deg, #1f2f33, #142125);
  color: var(--text);
  font: inherit;
  cursor: pointer;
}

button:hover:not(:disabled) {
  border-color: #5e8489;
  background: linear-gradient(180deg, #294046, #1a2a2f);
}

button:disabled {
  cursor: default;
  color: #6d797a;
  border-color: #263539;
  background: #11191c;
}

#app {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
}

#topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 10px 16px;
  border-bottom: 1px solid #213236;
  background: #0a1012;
  min-height: 72px;
  width: 100%;
  min-width: 0;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 260px;
}

.brand-mark {
  width: 42px;
  height: 42px;
  border: 2px solid #e2b65a;
  border-radius: 50%;
  background:
    radial-gradient(circle at 50% 50%, #ffdf88 0 18%, transparent 19%),
    conic-gradient(from 0deg, #45d1c9, #ed6653, #d99d36, #45d1c9);
  box-shadow: 0 0 22px rgba(216, 155, 53, 0.25);
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: 18px;
  letter-spacing: 0;
}

.brand p {
  color: var(--muted);
  font-size: 12px;
  margin-top: 2px;
}

.resource-bar {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 8px;
  flex: 1 1 auto;
}

.music-button {
  flex: 0 0 auto;
  min-width: 88px;
  min-height: 34px;
  padding: 6px 10px;
  border-radius: 4px;
  color: #d8fffb;
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
}

.music-button.muted {
  color: #819093;
  border-color: #263539;
  background: #11191c;
}

.resource-pill {
  flex: 0 1 94px;
  min-width: 0;
  padding: 7px 10px;
  border: 1px solid #283b40;
  border-radius: 6px;
  background: #11191d;
  font-size: 13px;
  line-height: 1.2;
}

.resource-pill b {
  display: block;
  color: #ffffff;
  font-size: 15px;
}

.resource-pill.low b {
  color: var(--danger);
}

#gameShell {
  min-height: 0;
  min-width: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 318px;
}

#stage {
  position: relative;
  min-width: 0;
  min-height: 0;
  background: #0c0d0a;
}

#gameCanvas {
  display: block;
  width: 100%;
  height: 100%;
  cursor: crosshair;
}

.toast {
  position: absolute;
  left: 16px;
  right: 16px;
  bottom: 16px;
  width: min(460px, calc(100vw - 32px));
  max-width: none;
  padding: 10px 12px;
  border: 1px solid rgba(236, 244, 236, 0.16);
  border-radius: 6px;
  background: rgba(8, 12, 13, 0.82);
  color: var(--text);
  font-size: 13px;
  overflow-wrap: anywhere;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 160ms ease, transform 160ms ease;
  pointer-events: none;
}

.toast.visible {
  opacity: 1;
  transform: translateY(0);
}

.mode-badge {
  position: absolute;
  top: 14px;
  left: 14px;
  min-width: 150px;
  padding: 8px 10px;
  border: 1px solid rgba(101, 215, 209, 0.28);
  border-radius: 6px;
  background: rgba(8, 12, 13, 0.78);
  color: #d8fffb;
  font-size: 12px;
  font-weight: 700;
  pointer-events: none;
}

.mode-badge.active {
  border-color: rgba(255, 216, 117, 0.72);
  color: #ffd875;
}

.mission-overlay {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: stretch;
  justify-content: flex-end;
  padding: 24px;
  background:
    linear-gradient(90deg, rgba(4, 7, 8, 0.2), rgba(4, 7, 8, 0.36) 46%, rgba(4, 7, 8, 0.9) 100%),
    url("assets/menu-command-desert.png") center / cover no-repeat,
    #090d0f;
  z-index: 20;
}

.mission-overlay.hidden {
  display: none;
}

.menu-console {
  align-self: center;
  width: min(760px, 100%);
  max-width: calc(100vw - 28px);
  min-width: 0;
  max-height: min(650px, calc(100% - 20px));
  display: grid;
  grid-template-columns: 126px minmax(0, 1fr);
  overflow: hidden;
  border: 1px solid rgba(101, 215, 209, 0.34);
  border-radius: 8px;
  background: rgba(7, 12, 14, 0.92);
  box-shadow: 0 24px 90px rgba(0, 0, 0, 0.62);
}

.menu-rail {
  display: grid;
  align-content: start;
  gap: 8px;
  padding: 14px;
  border-right: 1px solid rgba(101, 215, 209, 0.22);
  background: rgba(7, 13, 15, 0.72);
}

.menu-rail button {
  min-width: 0;
  min-height: 42px;
  padding-inline: 8px;
  font-size: 12px;
  font-weight: 800;
  text-align: left;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.menu-rail button.active,
.difficulty-row button.active {
  border-color: #ffd875;
  background: linear-gradient(180deg, #3b392c, #172827);
  color: #fff4ce;
}

.menu-main {
  min-width: 0;
  padding: 22px;
  overflow: auto;
}

.mission-kicker {
  display: block;
  margin-bottom: 8px;
  color: var(--spice);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.menu-main h2 {
  margin-bottom: 8px;
  font-size: 28px;
  letter-spacing: 0;
  text-transform: none;
}

.menu-main p {
  color: #c4d4d0;
  font-size: 14px;
  line-height: 1.55;
  max-width: 100%;
  overflow-wrap: anywhere;
}

.menu-screen {
  display: none;
  min-width: 0;
}

.menu-screen.active {
  display: grid;
  gap: 16px;
}

.difficulty-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-top: 18px;
}

.difficulty-row button {
  min-height: 42px;
  font-weight: 800;
}

.skirmish-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.skirmish-grid label,
.ai-slot-row label {
  display: grid;
  gap: 5px;
  color: #9fb5b2;
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}

.skirmish-grid select,
.ai-slot-row select {
  width: 100%;
  min-height: 40px;
  padding: 0 10px;
  border: 1px solid #315057;
  border-radius: 5px;
  background: #101a1d;
  color: #e7f5f1;
  font: inherit;
  text-transform: none;
}

.ai-slot-list {
  display: grid;
  gap: 7px;
  max-height: 210px;
  overflow: auto;
  padding-right: 3px;
}

.ai-slot-row {
  display: grid;
  grid-template-columns: minmax(58px, 0.55fr) minmax(110px, 1.4fr) minmax(84px, 0.8fr);
  align-items: end;
  gap: 8px;
  padding: 8px 10px;
  border: 1px solid #263f45;
  border-radius: 6px;
  background: rgba(13, 22, 25, 0.86);
}

.ai-slot-row strong {
  align-self: center;
  color: #ffd875;
  font-size: 12px;
}

.mission-overlay[data-mode="pause"] .difficulty-row {
  display: none;
}

.launch-button,
.resume-button {
  min-height: 52px;
  border-color: rgba(255, 216, 117, 0.68);
  background: linear-gradient(180deg, #4b3b22, #1e2e2d);
  color: #fff4ce;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.resume-button {
  border-color: rgba(101, 215, 209, 0.76);
  background: linear-gradient(180deg, #21424a, #172827);
}

.launch-button.hidden,
.resume-button.hidden {
  display: none;
}

.faction-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.faction-card {
  min-height: 150px;
  padding: 14px;
  border: 1px solid #2d474b;
  border-radius: 8px;
  background: rgba(14, 22, 25, 0.84);
}

.faction-card strong {
  display: block;
  margin-bottom: 10px;
  font-size: 16px;
}

.faction-card span {
  color: #c4d4d0;
  font-size: 13px;
  line-height: 1.45;
}

.compact-card {
  box-shadow: inset 0 0 0 1px rgba(101, 215, 209, 0.15);
}

.dominion-card {
  box-shadow: inset 0 0 0 1px rgba(239, 106, 88, 0.16);
}

.control-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.control-list span {
  padding: 9px 10px;
  border: 1px solid #263a40;
  border-radius: 6px;
  background: rgba(13, 20, 23, 0.82);
  color: #c4d4d0;
  font-size: 12px;
}

.control-list b {
  color: #ffd875;
}

#sidePanel {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  min-height: 0;
  min-width: 0;
  overflow: hidden;
  border-left: 1px solid #213236;
  background: var(--panel);
}

.panel-scroll {
  min-height: 0;
  overflow: auto;
}

.panel-section {
  padding: 12px;
  border-bottom: 1px solid #213236;
}

.minimap-section {
  border-bottom-color: #355057;
  background: #0b1215;
}

.panel-section h2 {
  margin-bottom: 10px;
  color: #cbe2dc;
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.panel-section.compact p {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.selected-panel {
  min-height: 82px;
  padding: 10px;
  border: 1px solid #263a40;
  border-radius: 6px;
  background: #0d1417;
}

.selected-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 800;
}

.selected-title img {
  width: 34px;
  height: 34px;
  image-rendering: auto;
}

.selected-meta {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 7px;
  margin-top: 9px;
  color: var(--muted);
  font-size: 12px;
}

.meter {
  height: 7px;
  margin-top: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: #263538;
}

.meter span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, #8bcf67, #e2b65a);
}

.objective-panel {
  display: grid;
  gap: 7px;
}

.objective-line {
  display: grid;
  grid-template-columns: 16px minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  min-height: 28px;
  min-width: 0;
  color: var(--muted);
  font-size: 12px;
}

.objective-line span:nth-child(2) {
  min-width: 0;
  overflow-wrap: anywhere;
}

.objective-line b {
  justify-self: end;
  color: #d8fffb;
  font-size: 12px;
}

.objective-dot {
  width: 10px;
  height: 10px;
  border: 1px solid #4c6165;
  border-radius: 50%;
  background: #11191d;
}

.objective-line.complete {
  color: #d9fff0;
}

.objective-line.complete .objective-dot {
  border-color: #8bcf67;
  background: #8bcf67;
}

.command-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 7px;
  margin-top: 10px;
}

.command-grid button {
  min-height: 34px;
  font-size: 12px;
}

.queue {
  min-height: 42px;
  margin-bottom: 10px;
  color: var(--muted);
  font-size: 12px;
}

.queue-line {
  padding: 7px 8px;
  border: 1px solid #263a40;
  border-radius: 6px;
  background: #0d1417;
}

.queue-progress {
  height: 5px;
  margin-top: 6px;
  overflow: hidden;
  border-radius: 999px;
  background: #263538;
}

.queue-progress span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--spice), var(--cyan));
}

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

.build-label {
  padding: 6px 2px 0;
  color: var(--spice);
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.build-button {
  display: grid;
  grid-template-columns: 44px 1fr auto;
  align-items: center;
  gap: 8px;
  min-height: 54px;
  min-width: 0;
  padding: 6px 8px;
  text-align: left;
}

.build-button img {
  width: 42px;
  height: 42px;
}

.build-button strong {
  display: block;
  font-size: 13px;
}

.build-button span {
  display: block;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

.build-button.active {
  border-color: #ffd875;
  background: linear-gradient(180deg, #314038, #1b2928);
}

.build-button.placeable strong::after {
  content: " place";
  color: var(--spice);
  font-size: 11px;
  font-weight: 700;
}

.build-cost {
  min-width: 58px;
  color: #ffd889;
  font-size: 12px;
  text-align: right;
}

#minimap {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 16 / 10;
  border: 1px solid #263a40;
  border-radius: 6px;
  background: #090d0f;
}

@media (max-width: 860px) {
  #topbar {
    align-items: flex-start;
    flex-direction: column;
    gap: 8px;
  }

  .brand {
    min-width: 0;
  }

  .resource-bar {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    justify-content: stretch;
    width: 100%;
    gap: 6px;
  }

  .resource-pill {
    flex: none;
    padding: 6px 8px;
  }

  #gameShell {
    grid-template-columns: 1fr;
    grid-template-rows: minmax(0, 1fr) 315px;
  }

  #sidePanel {
    grid-template-columns: 210px minmax(0, 1fr);
    grid-template-rows: minmax(0, 1fr);
    border-top: 1px solid #213236;
    border-left: 0;
  }

  .minimap-section {
    border-right: 1px solid #213236;
    border-bottom: 0;
  }

  .build-panel {
    grid-template-columns: 1fr;
  }

  .command-grid {
    grid-template-columns: repeat(6, minmax(0, 1fr));
  }

  .command-grid button {
    min-width: 0;
    padding-inline: 4px;
  }

  .mission-overlay {
    justify-content: center;
    padding: 14px;
  }

  .menu-console {
    grid-template-columns: 1fr;
    align-self: center;
    max-height: calc(100% - 12px);
  }

  .menu-rail {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    border-right: 0;
    border-bottom: 1px solid rgba(101, 215, 209, 0.22);
  }

  .menu-rail button {
    text-align: center;
  }
}

@media (max-width: 560px) {
  .mission-overlay {
    padding: 8px;
  }

  .menu-console {
    width: min(310px, calc(100vw - 40px));
    max-width: min(310px, calc(100vw - 40px));
  }

  .resource-bar {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .resource-pill {
    min-height: 48px;
  }

  .toast {
    left: 12px;
    right: 12px;
    width: auto;
    max-width: none;
    font-size: 12px;
    line-height: 1.35;
  }

  #gameShell {
    grid-template-rows: minmax(0, 1fr) 360px;
  }

  #sidePanel {
    grid-template-columns: 1fr;
    grid-template-rows: auto minmax(0, 1fr);
  }

  .minimap-section {
    border-right: 0;
    border-bottom: 1px solid #213236;
  }

  .command-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .objective-line {
    grid-template-columns: 16px minmax(0, 1fr);
  }

  .objective-line b {
    grid-column: 2;
    justify-self: start;
    margin-top: -4px;
  }

  .difficulty-row {
    grid-template-columns: 1fr;
  }

  .menu-main {
    padding: 12px;
  }

  .menu-rail button {
    padding-inline: 4px;
    font-size: 10px;
  }

  .faction-grid,
  .control-list,
  .skirmish-grid {
    grid-template-columns: 1fr;
  }

  .ai-slot-row {
    grid-template-columns: 1fr 1fr;
  }

  .ai-slot-row strong {
    grid-column: 1 / -1;
  }
}

/* Classic RTS command-console layout */
#app {
  grid-template-rows: 44px minmax(0, 1fr);
  background: #07090a;
}

#topbar {
  min-height: 44px;
  height: 44px;
  padding: 4px 10px;
  border-bottom: 2px solid #35464a;
  background: #090d0f;
  box-shadow: inset 0 -1px #050708;
}

.brand {
  min-width: 230px;
  gap: 8px;
}

.brand-mark {
  display: none;
}

.brand h1 {
  color: #f3f5ed;
  font-size: 14px;
  font-weight: 900;
  text-transform: uppercase;
}

.brand p {
  margin-top: 0;
  color: #718488;
  font-size: 9px;
  text-transform: uppercase;
}

.resource-bar {
  flex-wrap: nowrap;
  gap: 3px;
}

.resource-pill {
  position: relative;
  flex: 0 0 auto;
  min-width: 104px;
  height: 32px;
  padding: 3px 9px 3px 35px;
  overflow: hidden;
  border: 1px solid #304247;
  border-radius: 2px;
  background: #101719;
  color: #7f9597;
  font-size: 9px;
  text-transform: uppercase;
}

.resource-pill img {
  position: absolute;
  left: 4px;
  top: 2px;
  width: 28px;
  height: 28px;
  object-fit: contain;
}

.resource-pill b {
  font-size: 13px;
  line-height: 14px;
}

#gameShell {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: minmax(0, 1fr) 224px;
  min-height: 0;
}

#stage {
  grid-row: 1;
  min-height: 0;
  overflow: hidden;
  border-bottom: 2px solid #46585c;
}

#sidePanel {
  grid-row: 2;
  display: grid;
  grid-template-columns: 260px minmax(340px, 1fr) 420px;
  grid-template-rows: minmax(0, 1fr);
  gap: 4px;
  min-height: 0;
  overflow: hidden;
  padding: 4px;
  border: 0;
  background: #080b0d;
  box-shadow: inset 0 1px #111a1d;
}

.hud-module {
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  border: 1px solid #35484d;
  border-radius: 2px;
  background: #0d1315;
  box-shadow: inset 0 0 0 1px #080b0c;
}

.module-heading {
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 8px;
  border-bottom: 1px solid #2b3d42;
  background: #131c1f;
  color: #aec3c2;
  font-size: 9px;
  font-weight: 900;
  text-transform: uppercase;
}

.module-heading b {
  color: #67d8d0;
  font-size: 8px;
}

.minimap-section {
  display: grid;
  grid-template-rows: 24px minmax(0, 1fr);
  padding: 0;
  border-color: #495c60;
  background: #06090a;
}

#minimap {
  width: 100%;
  height: 100%;
  min-height: 0;
  aspect-ratio: auto;
  border: 0;
  border-radius: 0;
  object-fit: fill;
}

.command-section {
  display: grid;
  grid-template-rows: 24px minmax(0, 1fr) 44px;
}

.selected-panel {
  min-height: 0;
  margin: 5px;
  padding: 8px 10px;
  overflow: auto;
  border: 1px solid #273a3e;
  border-radius: 2px;
  background: #080c0e;
}

.selected-title {
  min-height: 38px;
  font-size: 13px;
  text-transform: uppercase;
}

.selected-title img {
  width: 42px;
  height: 42px;
  border: 1px solid #3b5559;
  background: #111a1c;
}

.selected-meta {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 4px;
  margin-top: 7px;
  font-size: 10px;
}

.selected-meta span {
  padding: 4px 6px;
  border-left: 2px solid #315e61;
  background: #101719;
}

.meter {
  height: 5px;
  margin-top: 5px;
  border-radius: 0;
}

.meter span {
  background: #78c765;
}

.command-grid {
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 3px;
  margin: 0 5px 5px;
}

.command-grid button {
  min-width: 0;
  min-height: 36px;
  padding: 3px;
  border-radius: 2px;
  background: #172225;
  color: #d7e3de;
  font-size: 9px;
  font-weight: 800;
  text-transform: uppercase;
}

.command-grid button.active,
.command-grid button:hover:not(:disabled) {
  border-color: #72d9d2;
  background: #203538;
  color: #effffb;
}

.production-section {
  display: grid;
  grid-template-rows: 24px auto minmax(0, 1fr);
}

.queue {
  min-height: 0;
  max-height: 96px;
  margin: 4px 5px 0;
  overflow: auto;
  font-size: 9px;
}

.queue-line {
  padding: 4px 6px;
  border-radius: 2px;
}

.queue-toolbar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 6px;
  min-height: 18px;
  margin-bottom: 2px;
  color: #8be8e1;
  font-size: 8px;
  font-weight: 900;
  text-transform: uppercase;
}

.queue-toolbar button,
.queue-item button {
  min-height: 18px;
  padding: 1px 6px;
  border-radius: 2px;
  font-size: 8px;
  font-weight: 900;
  text-transform: uppercase;
}

.queue-item {
  display: grid;
  grid-template-columns: minmax(76px, 1fr) minmax(64px, 1fr) auto;
  align-items: center;
  gap: 6px;
  margin-bottom: 2px;
}

.queue-item.active {
  border-color: #4f8788;
  color: #d7fffb;
}

.queue-item strong {
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.build-panel {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-height: 0;
  padding: 5px;
  overflow: auto;
}

.command-grid-empty {
  grid-column: 1 / -1;
  align-self: stretch;
  display: grid;
  place-content: center;
  gap: 5px;
  min-height: 112px;
  padding: 16px;
  border: 1px dashed #2c4247;
  color: #6f8588;
  text-align: center;
}

.command-grid-empty strong {
  color: #b7c9c7;
  font-size: 10px;
  text-transform: uppercase;
}

.command-grid-empty span {
  font-size: 9px;
}

.build-label {
  display: none;
}

.build-button {
  position: relative;
  flex: 0 0 auto;
  display: grid;
  grid-template-columns: 46px minmax(0, 1fr) auto;
  grid-template-rows: 1fr;
  gap: 8px;
  min-width: 0;
  min-height: 52px;
  padding: 5px 7px;
  overflow: hidden;
  border-radius: 2px;
  background: #11191c;
}

.build-button img {
  grid-row: 1;
  width: 42px;
  height: 42px;
  align-self: center;
  border: 1px solid #324a4f;
  background: #080c0d;
}

.build-button strong {
  display: block;
  overflow: hidden;
  color: #dce8e4;
  font-size: 11px;
  line-height: 14px;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.build-button span {
  display: block;
  margin-top: 2px;
  color: #768b8d;
  font-size: 8px;
  line-height: 10px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.build-cost {
  min-width: 42px;
  align-self: center;
  color: #e6b859;
  font-size: 9px;
  text-align: right;
}

.build-button.placeable strong::after {
  content: "";
}

.build-button.active {
  border-color: #ebc466;
  background: #29332e;
}

.objective-flyout {
  position: absolute;
  top: 12px;
  left: 12px;
  width: 254px;
  overflow: hidden;
  border: 1px solid rgba(70, 97, 101, 0.9);
  border-radius: 2px;
  background: rgba(7, 12, 14, 0.88);
  box-shadow: 0 5px 18px rgba(0, 0, 0, 0.28);
  pointer-events: none;
}

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

.objective-line {
  grid-template-columns: 10px minmax(0, 1fr) auto;
  min-height: 21px;
  gap: 6px;
  font-size: 9px;
}

.objective-line b {
  font-size: 9px;
}

.objective-dot {
  width: 6px;
  height: 6px;
  border-radius: 0;
}

.mode-badge {
  top: 12px;
  right: 12px;
  left: auto;
  min-width: 134px;
  padding: 6px 9px;
  border-radius: 2px;
  text-align: right;
}

.toast {
  bottom: 12px;
  left: 50%;
  right: auto;
  width: min(440px, calc(100vw - 32px));
  border-radius: 2px;
  transform: translate(-50%, 8px);
  text-align: center;
}

.toast.visible {
  transform: translate(-50%, 0);
}

.field-notes {
  position: absolute;
  right: 8px;
  bottom: 230px;
  padding: 4px 8px;
  border: 1px solid #31464b;
  background: rgba(8, 13, 15, 0.86);
  color: #84989a;
  font-size: 8px;
  text-transform: uppercase;
  pointer-events: none;
}

@media (max-width: 980px) {
  #gameShell {
    grid-template-rows: minmax(0, 1fr) 270px;
  }

  #sidePanel {
    grid-template-columns: 220px minmax(0, 1fr);
    grid-template-rows: 1fr 1fr;
  }

  .minimap-section {
    grid-row: 1 / 3;
  }

  .command-section {
    grid-column: 2;
    grid-row: 1;
  }

  .production-section {
    grid-column: 2;
    grid-row: 2;
  }

  .build-panel {
    display: flex;
  }

  .build-button {
    min-height: 50px;
  }

  .field-notes {
    display: none;
  }
}

@media (max-width: 620px) {
  #topbar {
    height: 54px;
    min-height: 54px;
    align-items: center;
    flex-direction: row;
  }

  #app {
    grid-template-rows: 54px minmax(0, 1fr);
  }

  .brand {
    min-width: 112px;
  }

  .brand h1 {
    font-size: 11px;
  }

  .brand p {
    display: none;
  }

  .resource-bar {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 2px;
  }

  .resource-pill {
    width: auto;
    min-width: 0;
    height: 22px;
    min-height: 0;
    padding: 2px 4px;
    font-size: 7px;
  }

  .resource-pill img {
    left: 2px;
    top: 1px;
    width: 20px;
    height: 20px;
  }

  .resource-pill {
    padding-left: 24px;
  }

  .resource-pill b {
    display: inline;
    margin-left: 3px;
    font-size: 9px;
  }

  #gameShell {
    grid-template-rows: minmax(0, 1fr) 320px;
  }

  #sidePanel {
    grid-template-columns: 145px minmax(0, 1fr);
    grid-template-rows: 112px 196px;
  }

  .minimap-section {
    grid-column: 1;
    grid-row: 1;
  }

  .command-section {
    grid-column: 2;
    grid-row: 1;
    grid-template-rows: 24px minmax(0, 1fr) 36px;
  }

  .production-section {
    grid-column: 1 / 3;
    grid-row: 2;
  }

  .command-section .selected-panel {
    margin: 3px;
    padding: 4px 6px;
  }

  .command-section .selected-title {
    min-height: 28px;
    font-size: 9px;
  }

  .command-section .selected-title img {
    width: 28px;
    height: 28px;
  }

  .command-section .selected-meta,
  .command-section .meter {
    display: none;
  }

  .objective-flyout {
    display: none;
  }

  .selected-meta {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .command-grid {
    grid-template-columns: repeat(3, minmax(44px, 1fr));
    margin: 0 3px 3px;
  }

  .command-grid button {
    font-size: 7px;
  }

  .build-panel {
    display: flex;
  }

  .build-button {
    grid-template-columns: 38px minmax(0, 1fr) auto;
  }

  .build-button img {
    width: 34px;
    height: 34px;
  }
}
