:root {
  color-scheme: dark;
  font: 16px/1.4 "Geist", "Inter", system-ui, sans-serif;
  background: #0d1518;
  color: #e6f1ee;
  --panel: #142125;
  --line: #2b3f43;
  --muted: #a3b8b6;
  --mint: #60f5cf;
  --copper: #ff9078;
  --gold: #ffcc77;
  --crystal: #c5b2ff;
}

*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; }
button { font: inherit; touch-action: manipulation; }
button:focus-visible { outline: 2px solid #fff4cd; outline-offset: 3px; }
[hidden] { display: none !important; }
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.game {
  --hud-scale: 1;
  width: min(100%, 1200px);
  min-height: 100vh;
  min-height: 100svh;
  margin: 0 auto;
  padding: max(14px, env(safe-area-inset-top)) max(20px, env(safe-area-inset-right)) max(16px, env(safe-area-inset-bottom)) max(20px, env(safe-area-inset-left));
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: minmax(300px, 1fr) auto;
  gap: 14px;
}

.battle-corner, .resources, .wallet, .wallet-info, .reactor-label,
.reactor-indicator-line, .battle-details {
  display: flex;
  align-items: center;
}
.brand-mark, .briefing-mark span {
  width: 28px;
  aspect-ratio: 1;
  flex: none;
  display: block;
  background: linear-gradient(150deg, #c8ffe8, #4bcdae 50%, #25636a);
  clip-path: polygon(50% 0, 96% 26%, 96% 74%, 50% 100%, 4% 74%, 4% 26%, 50% 0, 50% 23%, 24% 38%, 24% 62%, 50% 77%, 76% 62%, 76% 38%, 50% 23%);
}
h1, h2, p { margin: 0; }
h1 { font-size: clamp(1rem, 3vw, 1.35rem); letter-spacing: -.025em; }
.resources { gap: 6px; }
.wallet {
  min-height: 44px;
  gap: 7px;
  padding: 5px 10px;
  border: 1px solid #614c35;
  border-radius: 10px;
  background: #25231d;
}
.wallet-info { gap: 6px; }
.wallet strong { color: var(--gold); font-size: 1.2rem; font-variant-numeric: tabular-nums; }
.wallet-label { color: #dbc5a2; font-size: .875rem; }
.wallet-crystal { border-color: #54486b; background: #242031; }
.wallet-crystal strong { color: var(--crystal); }
.wallet-crystal .wallet-label { color: #d4c6eb; }
.wallet-population {
  border-color: #446e66;
  background: #19312e;
}
.wallet-population strong { color: #a3edd4; white-space: nowrap; }
.wallet-population .wallet-label { color: #c1ded5; }
.wallet-population.is-full { border-color: #af765a; }
.wallet-population.is-full strong { color: #ffc4a7; }
.population-icon {
  display: inline-block;
  flex: none;
  width: 16px;
  height: 17px;
  background: #8dd9c3;
  mask: radial-gradient(circle at 50% 23%, #000 0 25%, transparent 26%),
    radial-gradient(ellipse at 50% 100%, #000 0 54%, transparent 56%);
}
.ore, .crystal {
  display: inline-block;
  width: 14px;
  height: 17px;
  flex: 0 0 auto;
}
.ore {
  clip-path: polygon(50% 0, 100% 33%, 85% 77%, 50% 100%, 15% 77%, 0 33%);
  background: linear-gradient(120deg, #ffebaa 20%, #f5ad54 54%, #a96939 55%);
}
.crystal {
  clip-path: polygon(57% 0, 92% 32%, 75% 82%, 30% 100%, 12% 65%, 28% 24%);
  background: linear-gradient(108deg, #d2fff9 16%, #8de1fb 39%, #bc96ff 41%, #7a55b1 72%);
}

.arena {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  border: 1px solid #335252;
  border-radius: 14px;
  background: #182e35;
}
#battlefield {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  touch-action: pan-y;
}
#battlefield.can-pan { cursor: grab; }
#battlefield.can-pan:active { cursor: grabbing; }
#battlefield:focus-visible { outline: 2px solid var(--mint); outline-offset: -2px; }
.battle-hud {
  position: absolute;
  top: 0;
  inset-inline: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: start;
  gap: 5px;
  padding: 7px clamp(7px, 2vw, 13px) 11px;
  background: linear-gradient(180deg, #0a171cde, #0a171c00);
  z-index: 3;
  pointer-events: none;
}
.control-status {
  min-width: 0;
  grid-column: 2;
  grid-row: 2;
  justify-self: center;
  text-align: center;
  color: #f2e4c6;
  font-size: calc(.84rem * var(--hud-scale));
  font-weight: 700;
  line-height: 1.2;
  text-shadow: 0 1px 5px #071216;
}
#control-status[data-owner="player"] { color: var(--mint); }
#control-status[data-owner="enemy"] { color: var(--copper); }
.clock-anchor { position: relative; grid-column: 2; grid-row: 1; justify-self: center; }
.field-actions {
  grid-column: 3;
  grid-row: 1;
  justify-self: end;
  min-width: 0;
  display: grid;
  justify-items: end;
  gap: 4px;
}
.field-action, .tech-close, .tech-card button {
  border: 1px solid #597169;
  background: #172b2de8;
  color: #e9f8f0;
  border-radius: 6px;
  cursor: pointer;
}
.field-action {
  min-height: 32px;
  max-width: 100%;
  padding: 3px 6px;
  pointer-events: auto;
  font-size: .75rem;
  font-weight: 750;
}
.field-action:disabled, .tech-card button:disabled { opacity: .57; cursor: default; }
#tech-toggle[aria-expanded="true"] { border-color: var(--mint); color: var(--mint); }
.boat-controls { display: flex; justify-content: end; gap: 4px; max-width: 100%; }
.boat-controls.is-building #boat-action { opacity: 1; }
#boat-cancel { flex: none; pointer-events: auto; font-size: 1.2rem; }
#boat-action.is-ready { color: var(--mint); opacity: .9; }
.tech-panel {
  position: absolute;
  z-index: 6;
  top: 44px;
  right: 6px;
  width: min(280px, calc(100% - 12px));
  max-height: calc(100% - 50px);
  overflow: auto;
  overscroll-behavior: contain;
  padding: 8px;
  border: 1px solid #607d75;
  border-radius: 9px;
  color: #ebf3ee;
  background: #0f1b24fa;
  box-shadow: 0 4px 20px #031419a0;
}
.tech-panel header { display: flex; align-items: center; justify-content: space-between; gap: 6px; }
.tech-panel h2 { margin: 0; font-size: .9rem; }
.tech-close { width: 27px; height: 27px; line-height: 1; }
.tech-hint { margin: 3px 0 6px; color: #b9cdca; font-size: .73rem; }
.tech-tree { display: grid; gap: 4px; }
.tech-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: start;
  gap: 4px;
  padding: 5px;
  border: 1px solid #334f50;
  border-radius: 6px;
  background: #182b30;
  font-size: .74rem;
}
.tech-card[data-branch] { margin-left: 9px; border-left: 2px solid #8a9c81; }
.tech-card strong, .tech-card p { margin: 0; }
.tech-card p { color: #bccecb; line-height: 1.25; }
.tech-card button { min-height: 28px; padding: 1px 5px; font-size: .72rem; white-space: nowrap; }
.tech-card.is-learned { border-color: #5c8f76; }
.tech-card p.tech-requirement { color: #e5cba8; font-size: .69rem; }
#mission-status { margin-right: auto; }

.reactor-tooltip {
  position: absolute;
  z-index: 4;
  width: 248px;
  max-width: calc(100% - 8px);
  padding: 5px 7px 6px;
  transform: translate(-50%, -100%);
  border: 1px solid #539687;
  border-radius: 7px;
  color: var(--mint);
  background: #0b181ff2;
  box-shadow: 0 3px 14px #04131784;
}
.reactor-tooltip::after {
  position: absolute;
  inset: 100% 0 auto;
  height: 8px;
  content: "";
}
.reactor-tooltip.enemy { width: 148px; border-color: #a66857; color: var(--copper); pointer-events: none; }
.upgrade-details {
  position: absolute;
  z-index: 5;
  width: 228px;
  max-width: calc(100% - 8px);
  padding: 7px 8px;
  border: 1px solid #777197;
  border-radius: 7px;
  background: #121d2bf7;
  color: #e4edee;
  box-shadow: 0 4px 15px #04131790;
  pointer-events: none;
}
.upgrade-details.is-narrow { padding: 5px 6px; }
.upgrade-details-title, .upgrade-details h3 {
  margin: 0 0 3px;
  color: #f2edff;
  font-size: .84rem;
  font-weight: 800;
  line-height: 1.25;
}
.upgrade-details-note {
  margin: 3px 0 5px;
  color: #e2caac;
  font-size: .73rem;
  line-height: 1.25;
  overflow-wrap: anywhere;
}
.upgrade-details-note .price { font-size: inherit; }
.upgrade-stat {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(36px, auto) minmax(36px, auto);
  align-items: baseline;
  gap: 5px;
  padding: 3px 0;
  border-top: 1px solid #61718452;
  font-size: .73rem;
  line-height: 1.2;
  font-variant-numeric: tabular-nums;
}
.upgrade-details dl, .upgrade-stat dd { margin: 0; }
.upgrade-stat > * { min-width: 0; overflow-wrap: anywhere; }
.upgrade-stat-current { color: #aebbc6; text-align: right; }
.upgrade-stat-next { color: #c7f7dd; text-align: right; font-weight: 800; }
.upgrade-details.is-narrow .upgrade-stat { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1px 5px; }
.upgrade-details.is-narrow .upgrade-stat dt { grid-column: 1 / -1; }
.upgrade-details.is-narrow .upgrade-stat-current { text-align: left; }

.reactor-label { justify-content: space-between; gap: 5px; margin-bottom: 4px; }
.reactor-label span { color: #ebf4f4; }
.reactor-label b { font-size: .75rem; font-variant-numeric: tabular-nums; }
#reactor-meter, .upgrade-progress, .reactor-indicator progress {
  appearance: none;
  display: block;
  width: 100%;
  height: 4px;
  border: 0;
  border-radius: 6px;
  overflow: hidden;
  color: inherit;
  background: #1d2d31;
  box-shadow: 0 0 0 1px #e0ffff26;
}
.reactor-indicator {
  position: absolute;
  z-index: 2;
  width: min(138px, calc(50% - 12px));
  padding: 4px 6px 6px;
  display: grid;
  gap: 3px;
  transform: translate(-50%, -100%);
  border: 1px solid #539687;
  border-radius: 7px;
  background: #0b181fed;
  color: var(--mint);
  box-shadow: 0 2px 10px #07141973;
  pointer-events: none;
}
.reactor-indicator.enemy { border-color: #a66857; color: var(--copper); }
.reactor-indicator.is-distant { top: auto; bottom: 30px; transform: none; }
#player-reactor-indicator.is-distant { left: 7px; }
#enemy-reactor-indicator.is-distant { right: 7px; left: auto; }
.reactor-indicator-line {
  justify-content: space-between;
  gap: 4px;
  margin-bottom: 3px;
  font-size: min(.8rem, calc(.73rem * var(--hud-scale)));
  line-height: 1.2;
}
.reactor-indicator-line span { color: #e2efee; }
.reactor-indicator-line b { flex: none; font-variant-numeric: tabular-nums; }
.reactor-indicator [data-reactor-progress] { color: var(--crystal); }
.reactor-upgrades {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  align-items: start;
  gap: 5px;
  margin-top: 5px;
}
progress::-webkit-progress-bar { background: #1d2d31; }
progress::-webkit-progress-value { background: currentColor; border-radius: 6px; }
progress::-moz-progress-bar { background: currentColor; border-radius: 6px; }
.clock {
  display: block;
  color: #d8e9e8;
  background: #0a161baf;
  border: 1px solid #63878352;
  padding: 2px 9px;
  min-width: 3.6em;
  min-height: 32px;
  text-align: center;
  border-radius: 8px;
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  cursor: pointer;
  pointer-events: auto;
}
.clock:hover, .clock[aria-expanded="true"] { border-color: #83b3a5; }
.clock:disabled { cursor: default; }
.environment {
  position: absolute;
  top: calc(100% + 4px);
  left: 50%;
  width: max-content;
  max-width: 80vw;
  transform: translateX(-50%);
  padding: 3px 8px;
  border: 1px solid #62827d59;
  border-radius: 6px;
  background: #101b25f0;
  color: #e3eded;
  font-size: .75rem;
  text-align: center;
  pointer-events: none;
}
.battle-footer {
  position: absolute;
  inset: auto 0 0;
  z-index: 1;
  padding: 4px clamp(8px, 2vw, 18px) 6px;
  background: linear-gradient(0deg, #0b171cf0, transparent);
  color: #c6d9d6;
  font-size: .875rem;
  pointer-events: none;
}
#wave { color: #ffb6a5; font-variant-numeric: tabular-nums; }
.battle-details { justify-content: flex-end; text-shadow: 0 1px 5px #071216; }

.command-deck {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel);
}
.recruit-toolbar, .order-grid { display: flex; gap: 6px; }
.recruit-toolbar { min-width: 0; }
.deck-toggle {
  position: relative;
  min-width: 64px;
  min-height: 48px;
  padding: 5px 10px;
  border: 1px solid #496260;
  border-radius: 8px;
  background: #1d3133;
  color: #e5f4f0;
  cursor: pointer;
  font-size: calc(.85rem * var(--hud-scale));
  font-weight: 700;
}
.deck-toggle[aria-expanded="true"] { border-color: #81c8b2; color: #a7f5d8; background: #254440; }
.deck-toggle:disabled { opacity: .5; cursor: default; }
.deck-count {
  margin-left: 5px;
  color: #aee8d6;
  font-size: .75em;
  font-variant-numeric: tabular-nums;
}
.deck-panel {
  position: absolute;
  bottom: calc(100% + 6px);
  left: 0;
  z-index: 2;
  width: min(320px, 100%);
  max-height: var(--deck-room, 300px);
  overflow-y: auto;
  overscroll-behavior-y: contain;
  padding: 9px;
  border: 1px solid #547973;
  border-radius: 10px;
  background: #142629;
  box-shadow: 0 5px 20px #071214a8;
}
.deck-panel h2 { margin: 0 0 8px; color: #e2f2ee; font-size: .9rem; }
.recruit-grid { display: grid; gap: 5px; }
.recruit-item, .upgrade-item { position: relative; display: grid; gap: 2px; min-width: 0; }
.recruit-reason {
  padding: 0 4px 3px;
  color: #ffcfa6;
  font-size: .73rem;
  font-weight: 700;
  line-height: 1.2;
}
.unit-button, .order-button, .upgrade-button {
  min-width: 0;
  min-height: 48px;
  border: 1px solid #3d565a;
  border-radius: 8px;
  background: #233539;
  color: #eef8f6;
  cursor: pointer;
}
.unit-button {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: start;
  gap: 7px;
  width: 100%;
  padding: 4px 8px;
  border-width: 2px;
}
.unit-button canvas { display: block; width: 32px; height: 30px; flex: none; }
.unit-label { display: grid; min-width: 0; gap: 1px; text-align: left; line-height: 1.12; }
.unit-label b { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.price, .cost { display: flex; align-items: center; gap: 4px; }
.price { flex-wrap: wrap; color: var(--gold); font: 700 .875rem/1.2 system-ui, sans-serif; }
.cost { white-space: nowrap; }
.cost-crystal { color: var(--crystal); }
.price .ore, .price .crystal { width: 8px; height: 10px; }
.unit-button:disabled, .order-button:disabled, .upgrade-button:disabled { opacity: .46; cursor: default; }
.unit-button.has-orders { opacity: 1; }
.unit-button.has-orders:disabled > :not(.order-count) { opacity: .55; }
.unit-button.is-building {
  opacity: 1;
  border-color: transparent;
  background:
    linear-gradient(#214343, #214343) padding-box,
    conic-gradient(#91f1d3 var(--build-angle, 0deg), #416360 var(--build-angle, 0deg)) border-box;
}
.cancel-action {
  display: grid;
  place-items: center;
  min-width: 48px;
  min-height: 48px;
  padding: 0 4px;
  border: 1px solid #784f48;
  border-radius: 7px;
  background: #422c2d;
  color: #ffc1ab;
  font: 750 .78rem/1 system-ui, sans-serif;
  cursor: pointer;
}
.cancel-unit { font-size: 1.25rem; }
.cancel-action:not(:disabled):hover { color: #fff0e9; background: #5f3934; }
.cancel-action:disabled { opacity: .5; cursor: default; }
.upgrade-info {
  position: absolute;
  z-index: 1;
  top: 1px;
  left: 1px;
  display: grid;
  place-items: center;
  width: 23px;
  height: 23px;
  padding: 0;
  border: 0;
  border-radius: 6px;
  background: radial-gradient(circle, #3f3d5d 47%, transparent 52%);
  color: #e3daff;
  font: 800 .79rem/1 system-ui, sans-serif;
  cursor: pointer;
}
.upgrade-info:hover, .upgrade-info[aria-expanded="true"] { background: #514b72; color: #fcf7ff; }
.upgrade-info:disabled { opacity: .5; cursor: default; }
.upgrade-button:disabled { pointer-events: none; }
.order-count {
  position: absolute;
  top: 3px;
  right: 3px;
  min-width: 19px;
  padding: 0 3px;
  border-radius: 5px;
  background: #a2f0d7;
  color: #092820;
  font-size: .6875rem;
  font-weight: 850;
  line-height: 1.35;
  text-align: center;
  font-variant-numeric: tabular-nums;
}
.order-button { display: flex; align-items: center; justify-content: center; gap: 8px; min-width: 86px; min-height: 56px; font-weight: 750; padding: 6px 10px; }
.order-button[aria-pressed="true"] { color: var(--mint); border-color: #61bcab; background: #1b4643; }
.order-button[data-order="center"][aria-pressed="true"] { color: #ffdda2; border-color: #bd985c; background: #483b28; }
.order-button[data-order="attack"][aria-pressed="true"] { color: #ffc3ad; border-color: #de947d; background: #50352e; }
.order-icon { width: 18px; height: 18px; background: currentColor; flex: none; }
.shield { clip-path: polygon(50% 0, 95% 22%, 87% 68%, 50% 100%, 13% 68%, 5% 22%, 50% 0, 50% 18%, 22% 31%, 29% 59%, 50% 79%, 71% 59%, 78% 31%, 50% 18%); }
.beacon { clip-path: polygon(50% 2%, 97% 50%, 50% 98%, 3% 50%, 50% 2%, 50% 24%, 26% 50%, 50% 75%, 74% 50%, 50% 24%); }
.strike { clip-path: polygon(56% 0, 100% 0, 100% 44%, 83% 44%, 83% 28%, 23% 88%, 12% 77%, 72% 17%, 56% 17%); }
.upgrade-button {
  position: relative;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 2px;
  min-height: 48px;
  padding: 17px 2px 4px;
  background: #262e40;
  border-color: #4e526d;
}
.upgrade-button.is-upgrading { opacity: 1; padding-bottom: 8px; background: #373553; border-color: #a19ad5; }
.upgrade-button .upgrade-progress {
  position: absolute;
  inset: auto 4px 3px;
  width: calc(100% - 8px);
  height: 2px;
  color: var(--crystal);
}
.upgrade-button .price { justify-content: center; }
.upgrade-time { color: #e1d7ff; font-size: .75rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.upgrade-title { font-size: .875rem; white-space: nowrap; }
.upgrade-title [data-tier] { color: #dbd0ff; font-weight: 750; }
.unit-button:not(:disabled):hover, .order-button:not(:disabled):hover, .upgrade-button:not(:disabled):hover { filter: brightness(1.22); }
.unit-button:not(:disabled):active, .order-button:not(:disabled):active, .upgrade-button:not(:disabled):active { transform: translateY(1px); }

@media (max-width: 700px) {
  .game {
    gap: 8px;
    padding: max(8px, env(safe-area-inset-top)) max(8px, env(safe-area-inset-right)) max(8px, env(safe-area-inset-bottom)) max(8px, env(safe-area-inset-left));
  }
  .command-deck { padding: 6px; gap: 6px; }
  .orders { position: absolute; bottom: calc(100% + 34px); right: 5px; }
  .order-grid { flex-direction: column; gap: 5px; }
  .order-button { flex-direction: column; gap: 2px; min-width: 74px; min-height: 52px; padding: 3px 5px; }
  .order-icon { width: 16px; height: 16px; }
  .deck-panel { width: min(320px, calc(100% - 86px)); }
}

@media (max-width: 475px) {
  .wallet { min-height: 40px; padding: 3px 6px; gap: 3px; }
  .wallet .ore, .wallet .crystal, .population-icon { width: 12px; height: 14px; }
  .wallet strong { font-size: .94rem; }
  .wallet-info { flex-direction: column; align-items: start; gap: 1px; line-height: 1.05; }
  .wallet-label { font-size: .6875rem; }
  .control-status { font-size: min(.75rem, calc(.71rem * var(--hud-scale))); }
  .deck-toggle { min-width: 0; padding-inline: 8px; }
}

@media (max-width: 350px) {
  .resources { gap: 3px; }
  .wallet { padding-inline: 4px; }
  .wallet strong { font-size: .88rem; }
}

@media (orientation: landscape) and (max-height: 540px) {
  .game { grid-template-rows: minmax(160px, 1fr) auto; gap: 6px; padding-block: 6px; }
  .command-deck { padding: 5px 6px; }
  .wallet { min-height: 36px; }
  .battle-hud { padding-block: 5px 9px; }
  .clock { min-height: 29px; }
}
@media (orientation: landscape) and (min-width: 510px) and (max-height: 540px) {
  .orders { position: static; }
  .order-grid { flex-direction: row; }
  .order-button { flex-direction: row; min-width: 68px; min-height: 48px; }
  .deck-panel { width: min(320px, 100%); }
}
@media (orientation: landscape) and (max-width: 820px) and (max-height: 540px) {
  .order-icon { display: none; }
}

.game .unit-label b, .game .order-button { font-size: calc(.89rem * var(--hud-scale)); }
.game .upgrade-title, .game .price, .game .battle-details { font-size: calc(.875rem * var(--hud-scale)); }
.game .reactor-label span { font-size: calc(.75rem * var(--hud-scale)); }

.game[data-density="compact"] .command-deck { padding: 5px 6px; }
.game[data-density="compact"] .unit-button canvas { width: 27px; height: 24px; }
.game[data-density="compact"] .unit-label b,
.game[data-density="compact"] .order-button { font-size: calc(.8rem * var(--hud-scale)); }

.game .reactor-upgrades .upgrade-title, .game .reactor-upgrades .price {
  font-size: min(.8rem, calc(.73rem * var(--hud-scale)));
}

@media (orientation: portrait) and (max-height: 690px) {
  .game[data-density="compact"] { grid-template-rows: minmax(260px, 1fr) auto; }
}

.battle-corner {
  grid-column: 1; grid-row: 1; gap: 6px; min-width: 0;
}
.battle-corner .wallet { min-height: 38px; padding-block: 4px; background: #101e23e8; }
.battle-menu-toggle, .battle-menu button, .construction-panel button {
  border: 1px solid #4d6968; border-radius: 8px; background: #1c3338; color: #eff8f3; cursor: pointer;
}
.battle-menu-toggle {
  display: grid; place-items: center; flex: none; width: 44px; height: 44px; padding: 0;
  pointer-events: auto;
}
.menu-icon {
  position: relative; display: block; width: 18px; height: 2px; border-radius: 1px; background: currentColor;
  box-shadow: 0 -6px 0 currentColor, 0 6px 0 currentColor;
}
.battle-menu {
  width: min(340px, calc(100vw - 24px)); max-height: calc(100svh - 20px); overflow: auto;
  padding: 20px; border: 1px solid #587e75; border-radius: 14px; color: #edf8f3; background: #102327;
}
.battle-menu[open] { display: grid; gap: 10px; }
.battle-menu::backdrop { background: #050c14b9; }
.battle-menu h2 { font-size: 1.24rem; }
.battle-menu p { color: #b8d1c8; font-size: .9rem; }
.battle-menu button, .battle-menu select { min-height: 44px; padding: 6px 12px; }
.battle-language { display: grid; gap: 3px; color: #bbd3ca; font-size: .8rem; }
.battle-language select { border: 1px solid #496460; border-radius: 8px; color: #eaf6ee; background: #1c3439; font: inherit; }
.recruit-line { display: flex; gap: 5px; min-width: 0; }
.recruit-line > .unit-button { flex: 1 1 0; }
.recruit-line > .cancel-unit { flex: none; }
.reactor-range { margin: 1px 0 3px; color: #badcd4; font-size: .73rem; }
.online-match-status {
  position: absolute; z-index: 5; inset: 57px auto auto 50%; translate: -50% 0;
  width: max-content; max-width: calc(100% - 12px); padding: 4px 7px;
  border: 1px solid #9e8263; border-radius: 7px; color: #fff2d5; background: #203435f7;
  font-size: .78rem; text-align: center; pointer-events: none;
}
.troop-grade-toggle { padding-top: 4px; }
.troop-grade-panel {
  position: absolute; z-index: 8; inset: 50% auto auto 50%; translate: -50% -50%;
  width: min(440px, calc(100% - 20px)); max-height: calc(100% - 20px); overflow: auto;
  padding: 11px; border: 1px solid #648f7e; border-radius: 12px;
  color: #e9f7ee; background: #10272cf7; box-shadow: 0 8px 40px #071313d9;
  overscroll-behavior: contain;
}
.troop-grade-panel header { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.troop-grade-panel header h2 { font-size: 1.05rem; }
.troop-grade-panel header button, .troop-grade-buy {
  min-height: 44px; padding: 5px 9px; border: 1px solid #4b776c; border-radius: 7px;
  color: #eafdf3; background: #233f41; cursor: pointer;
}
.troop-grade-panel header button { width: 44px; font-size: 1.15rem; }
.troop-grade-panel p { color: #a9c4be; font-size: .78rem; margin: 3px 0 9px; }
.troop-grade-list { display: grid; gap: 5px; }
.troop-grade-row {
  --grade-color: #ffc488;
  display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 3px 7px;
  padding: 6px 6px 6px 9px; border: 1px solid #3c5d5a; border-left: 3px solid var(--grade-color);
  border-radius: 8px; background: #193034;
}
.troop-grade-row[data-grade="armor"] { --grade-color: #9aaee6; }
.troop-grade-row[data-grade="health"] { --grade-color: #86e7af; }
.troop-grade-row[data-grade="crit"] { --grade-color: #e4a5f6; }
.troop-grade-row[data-grade="dodge"] { --grade-color: #81dbff; }
.troop-grade-row strong { display: block; color: var(--grade-color); font-size: .88rem; }
.troop-grade-row small { display: block; color: #cbdbd6; font-size: .73rem; }
.troop-grade-row progress { grid-column: 1 / -1; width: 100%; height: 5px; color: var(--grade-color); }
.troop-grade-buy:disabled { opacity: .5; cursor: default; }
.troop-grade-row .cancel-action { grid-column: 2; grid-row: 1; min-height: 44px; }
.field-notice {
  position: absolute; z-index: 6; bottom: 38px; left: 50%; translate: -50% 0;
  margin: 0; padding: 5px 10px; border: 1px solid #72ad96; border-radius: 7px;
  color: #f2f8e2; background: #152e2df2; pointer-events: none; font-weight: 700; font-size: .82rem;
}
.building-site {
  position: absolute; z-index: 2; width: 48px; height: 44px; translate: -50% -50%; border-radius: 9px;
  border: 1px dashed #a0ceb0; color: #ecffef; background: #18302e9e; cursor: pointer;
}
.building-site::before {
  position: absolute; inset: auto 3px 1px; height: 12px; content: "";
  border: 1px solid #ab9e6f; border-radius: 50%; background: #253c37; transform: skewX(-12deg);
}
.building-site > span { position: relative; display: block; width: 21px; height: 19px; margin: auto; }
.building-site[data-kind="empty"] > span, .building-site[data-kind="building"] > span {
  background: currentColor; clip-path: polygon(43% 0,57% 0,57% 44%,100% 44%,100% 58%,57% 58%,57% 100%,43% 100%,43% 58%,0 58%,0 44%,43% 44%);
}
.building-site[data-kind="building"] { border-color: #ffe59a; color: #ffe59a; }
.building-site[data-kind="habitat"], .building-site[data-kind="workshop"] {
  border-style: solid; background: #233632e8;
}
.building-site[data-kind="habitat"] > span {
  background: linear-gradient(180deg, #b3ffe3 0 34%, #479a89 34% 100%);
  clip-path: polygon(50% 0,100% 40%,90% 100%,63% 100%,63% 61%,40% 61%,40% 100%,10% 100%,0 40%);
}
.building-site[data-kind="workshop"] > span {
  background: linear-gradient(180deg,#ffe6a4 0 45%,#9f7544 45%);
  clip-path: polygon(0 45%,27% 45%,27% 0,46% 0,46% 45%,61% 20%,61% 48%,87% 20%,87% 48%,100% 48%,100% 100%,0 100%);
}
.building-site:hover, .building-site[aria-expanded="true"] { border-color: #efffe2; filter: brightness(1.2); }
.construction-panel {
  position: absolute; z-index: 7; bottom: 57px; left: 7px; width: min(290px, calc(100% - 14px)); 
  padding: 10px; border: 1px solid #638877; border-radius: 10px; background: #10272bf7;
  box-shadow: 0 5px 18px #040e14c9;
}
.construction-panel header, #construction-options, #construction-status { display: grid; gap: 6px; }
.construction-panel header { grid-template-columns: 1fr auto; align-items: center; margin-bottom: 6px; }
.construction-panel h2 { font-size: .96rem; }
.construction-panel header button { width: 42px; height: 42px; }
#construction-options > button { display: grid; gap: 3px; width: 100%; padding: 5px 8px; text-align: start; min-height: 48px; }
.construction-panel button:disabled { opacity: .52; }
#construction-options small, #construction-job { color: #bad6cc; font-size: .76rem; }
#construction-progress { width: 100%; }
@media (hover: hover) and (pointer: fine) {
  .deck-panel { bottom: 100%; }
}
@media (hover: hover) and (pointer: fine) and (min-width: 701px) {
  .battle-menu-toggle { display: none; }
}
@media (max-width: 700px), (pointer: coarse) {
  .order-button { width: 52px; height: 52px; min-height: 52px; min-width: 52px; border-radius: 50%; }
  .order-button .order-label { display: none; }
  .order-button .order-icon { display: block; width: 21px; height: 21px; }
}
@media (max-width: 700px) {
  .battle-hud { grid-template-columns: minmax(0, 1fr) auto auto; gap: 4px; }
  .control-status { grid-column: 1 / -1; grid-row: 2; }
  .deck-panel { width: min(320px, calc(100% - 64px)); }
}
@media (max-width: 480px) {
  .battle-corner { gap: 4px; }
  .battle-corner .resources { gap: 3px; }
  .battle-corner .wallet { min-height: 34px; padding: 2px 4px; gap: 3px; border-radius: 7px; }
  .battle-corner .wallet-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  .battle-corner .wallet strong { font-size: .76rem; }
}
@media (max-width: 359px) {
  .battle-hud { grid-template-columns: minmax(0, 1fr) auto; }
  .clock-anchor { justify-self: end; }
  .field-actions { grid-column: 2; grid-row: 2; }
  .control-status { grid-column: 1; justify-self: start; text-align: left; }
}
