@media (prefers-reduced-motion: no-preference) {
  @view-transition { navigation: auto; }
}
@font-face {
  font-family: Geist;
  src: url("geist.ttf") format("truetype");
  font-weight: 100 900;
  font-display: swap;
}
:root {
  color-scheme: dark;
  font-family: Geist, system-ui, sans-serif;
  --bg: #101420;
  --panel: #191e2d;
  --line: #373f54;
  --text: #f2f4fc;
  --muted: #b7bfd2;
  --accent: #f2d38d;
  --own: #a1e5cf;
  --other: #f0b988;
  background: var(--bg);
  color: var(--text);
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; }
h1, h2, h3, p { margin: 0; }
a { color: inherit; }
.frame { width: min(1120px, 100% - 28px); margin-inline: auto; }
.site-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 62px;
  font-size: .84rem;
}
.site-bar a { display: inline-flex; align-items: center; gap: 7px; min-height: 44px; text-decoration: none; }
.site-bar a:hover { text-decoration: underline; }
.site-bar .site-home { font-weight: 700; }
.moon-mark { width: 15px; height: 15px; border-radius: 50%; background: var(--accent); position: relative; }
.moon-mark::after {
  content: "";
  position: absolute;
  width: 12px;
  height: 12px;
  background: var(--bg);
  border-radius: 50%;
  inset: 0 -3px auto auto;
}
.hero {
  border: 1px solid var(--line);
  border-radius: 22px;
  min-height: 236px;
  display: grid;
  align-items: end;
  overflow: hidden;
  background-color: #1b2532;
  background-image: linear-gradient(90deg, #0b101cf5 0%, #111725be 45%, #0b101c29 100%), url("lunar-settlement.webp");
  background-position: center, 60% 55%;
  background-size: cover;
}
.hero-copy { padding: clamp(22px, 5vw, 56px); min-width: 0; }
.hero h1 { max-width: 10ch; font-size: clamp(2.3rem, 7.5vw, 5rem); line-height: .99; letter-spacing: -.059em; }
.hero p { max-width: 36ch; margin-top: 14px; color: #e1e6f3; line-height: 1.5; }
#retry { margin-top: 18px; }
.coordinates { font: 600 .77rem Geist, monospace; font-variant-numeric: tabular-nums; color: var(--muted); }
button {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  gap: .45em;
  min-height: 44px;
  padding: 8px 13px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #252b3e;
  color: var(--text);
  font: 650 .86rem/1.25 Geist, system-ui, sans-serif;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
  touch-action: manipulation;
}
button:hover:not(:disabled) { background: #343c51; }
.primary, .primary:hover:not(:disabled) { color: #221c10; }
.primary { background: var(--accent); border-color: var(--accent); }
.primary:hover:not(:disabled), .primary:hover { background: #ffe5a5; }
button:disabled { opacity: .62; cursor: default; }
:focus-visible { outline: 2px solid #fff; outline-offset: 3px; }
.inventory { margin-top: 14px; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; }
.inventory > div {
  display: flex;
  gap: 9px;
  align-items: center;
  min-width: 0;
  padding: 10px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 13px;
  font-size: .8rem;
  color: var(--muted);
}
.inventory strong { display: block; color: var(--text); font-size: 1.22rem; margin-top: 2px; }
.stat-icon, .module-icon {
  flex: none;
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 9px;
  background: #2c3145;
  font-size: 1.17rem;
}
.crystal { color: var(--accent); }
.troop { color: var(--own); }
.play { margin-top: 14px; display: grid; gap: 14px; align-items: start; }
.panel { min-width: 0; padding: 14px; background: var(--panel); border: 1px solid var(--line); border-radius: 16px; }
.panel h2 { font-size: 1.2rem; letter-spacing: -.025em; }
.panel-head { display: flex; gap: 8px; align-items: center; justify-content: space-between; }
.small { font-size: .77rem; padding-inline: 9px; }
.map-key { display: flex; flex-wrap: wrap; gap: 5px 12px; margin-block: 8px 12px; font-size: .74rem; color: var(--muted); }
.map-key span { display: inline-flex; gap: 4px; align-items: center; }
.map-key i { width: 7px; height: 7px; border-radius: 50%; background: #8690a2; }
.map-key .key-other { background: var(--other); }
.map-key .key-base { background: var(--own); }
.map-controls { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; margin-bottom: 8px; }
.map-controls button { width: 44px; padding: 0; font-size: 1.12rem; }
.map-controls p { margin-left: auto; }
.map { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 3px; }
.plot {
  min-width: 0;
  min-height: 44px;
  aspect-ratio: 1 / 1;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  gap: 2px;
  padding: 4px 1px;
  border-radius: 5px;
  font-size: clamp(.63rem, 2.5vw, .84rem);
  font-variant-numeric: tabular-nums;
  background-color: #282e3b;
  background-image: linear-gradient(0deg, #111726d1 0%, #151a244e 100%), url("lunar-relief.jpg");
  background-size: cover, 650% 550%;
  background-position: center, var(--terrain-x) var(--terrain-y);
  color: #f0f1fa;
}
.plot:hover:not(:disabled) { background-color: #42495e; filter: brightness(1.16); }
.plot:focus-visible { position: relative; z-index: 1; }
.plot[aria-pressed="true"] { border-color: #fff; box-shadow: inset 0 0 0 1px #fff; }
.plot[data-occupancy="other"] { color: var(--other); border-color: #af8061; }
.plot[data-occupancy="own"] { color: var(--own); border-color: #699f92; }
.plot-marker { font-size: clamp(.85rem, 4vw, 1.5rem); line-height: 1; }
.map-detail { min-height: 2.7em; margin-top: 11px; font-size: .87rem; color: var(--muted); overflow-wrap: anywhere; }
.found-panel form, .module { display: grid; gap: 9px; margin-top: 14px; }
.found-panel label { font-size: .87rem; color: var(--muted); }
.found-panel input {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 8px 12px;
  background: var(--bg);
  color: var(--text);
  font: inherit;
}
.module { padding-top: 13px; border-top: 1px solid var(--line); }
.module-head { display: flex; align-items: center; gap: 9px; }
.module h3 { font-size: 1rem; }
.module p { font-size: .85rem; line-height: 1.4; }
.module-head p, .muted, .save-note { color: var(--muted); }
progress { appearance: none; width: 100%; height: 9px; border: none; border-radius: 9px; background: #353c50; }
progress::-webkit-progress-bar { border-radius: 9px; background: #353c50; }
progress::-webkit-progress-value { border-radius: 9px; background: var(--accent); }
progress::-moz-progress-bar { border-radius: 9px; background: var(--accent); }
.feedback { margin-top: 11px; color: var(--own); font-size: .87rem; line-height: 1.45; overflow-wrap: anywhere; }
.feedback:empty { display: none; }
.feedback[data-error="true"] { color: #ffc4b9; }
.save-note { margin: 18px 0 max(26px, env(safe-area-inset-bottom)); font-size: .81rem; }
@media (min-width: 740px) {
  .frame { width: min(1120px, 100% - 64px); }
  .site-bar { min-height: 74px; }
  .hero { min-height: 285px; }
  .hero h1 { max-width: none; }
  .play { grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 18px; }
  .panel { padding: 19px; }
  .inventory { max-width: 430px; }
  .inventory > div { padding-inline: 13px; }
  .plot { aspect-ratio: 1.28; padding-bottom: 8px; }
}

/* Chapter one */
:root {
  --bg: #0d1114;
  --panel: #171e23;
  --line: #384653;
  --text: #f4f2e9;
  --muted: #b9c4cc;
  --accent: #ffc052;
  --own: #84e4ed;
  --other: #ffb779;
  --metal: #222c34;
}
body.in-game { padding-bottom: calc(87px + env(safe-area-inset-bottom)); }
.in-game .site-bar { min-height: 46px; }
.frame { width: min(860px, 100% - 24px); }
h2 { font-size: 1.18rem; letter-spacing: -.025em; }
h3 { font-size: 1.02rem; }
p { line-height: 1.45; }
button { background: var(--metal); }
button:hover:not(:disabled) { background: #334250; }
.primary, .primary:hover:not(:disabled) { background: linear-gradient(#ffce70, #eca12b); border-color: #ffce70; }
.panel { background: var(--panel); border-radius: 12px; }
.panel-head { gap: 8px; flex-wrap: wrap; }
.hud {
  padding: 12px;
  background: linear-gradient(154deg, #232d35, #151c21 65%);
  border: 1px solid var(--line);
  border-top-color: #70818c;
  border-radius: 14px 14px 8px 8px;
}
.hud .inventory { margin: 10px 0 0; gap: 5px; grid-template-columns: repeat(4, minmax(0, 1fr)); }
.hud .inventory div {
  display: grid;
  gap: 3px;
  min-width: 0;
  padding: 6px 4px;
  text-align: center;
  background: #0d151c;
  border: 1px solid #354655;
  border-radius: 7px;
  color: var(--muted);
  font-size: .69rem;
}
.hud .inventory strong { font-size: clamp(.88rem, 4vw, 1.15rem); color: var(--text); font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.hud .inventory div:last-child strong { color: var(--own); }
.objective { margin: 10px 0; padding: 10px 12px; border: 1px solid #53513c; border-left: 3px solid var(--accent); border-radius: 8px; background: #27251c; }
.objective header { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; justify-content: space-between; }
.objective h2 { font-size: .93rem; }
.objective p { font-size: .84rem; color: #f5dfb5; margin-top: 4px; }
.objective button { margin-top: 6px; }
.badge { display: inline-block; padding: 3px 7px; border-radius: 4px; background: #20363d; color: var(--own); font-size: .73rem; font-weight: 700; white-space: nowrap; }
.screen { margin-top: 10px; }
.build-panel { margin-top: 5px; padding: 10px; border-top-color: #6c8496; }
.build-panel .panel-head { display: flex; justify-content: space-between; align-items: center; flex-wrap: nowrap; }
.build-panel .primary { flex-shrink: 0; }
.build-selection { display: grid; gap: 5px; margin-top: 8px; color: var(--muted); font-size: .81rem; }
select {
  width: 100%;
  min-width: 0;
  min-height: 44px;
  padding: 8px 27px 8px 9px;
  color: var(--text);
  background: #111a20;
  border: 1px solid var(--line);
  border-radius: 6px;
  font: inherit;
}
.industry { display: grid; gap: 8px; margin-top: 8px; }
.industry .module, .section-copy .module { margin: 0; padding: 12px; border-top: 1px solid var(--line); }
.industry h3 .badge { margin-left: 5px; }
.industry progress { accent-color: var(--own); }
.timer { color: var(--accent); font-size: .85rem; margin-top: 8px; font-variant-numeric: tabular-nums; }
.game-nav {
  position: fixed;
  z-index: 2;
  left: 0;
  right: 0;
  bottom: 0;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 4px;
  width: min(600px, 100%);
  margin-inline: auto;
  padding: 6px 8px calc(6px + env(safe-area-inset-bottom));
  background: #0b1217f7;
  border: 1px solid #4b5b65;
  border-radius: 12px 12px 0 0;
}
.game-nav button { display: grid; gap: 1px; align-content: center; min-height: 53px; border-radius: 5px; padding: 3px; font-size: .72rem; }
.game-nav span { color: var(--muted); font-size: 1.25rem; line-height: 1; }
.game-nav button[aria-pressed="true"] { color: #ffdc91; background: #442d12; border-color: #eea330; }
.game-nav button[aria-pressed="true"] span { color: var(--accent); }
#play { display: grid; gap: 10px; margin-top: 10px; }
#play.playing > :not([hidden]) { grid-column: 1 / -1; }
#expeditions { padding: 12px; }
.missions, .loadout { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 7px; margin: 9px 0; }
.missions button, .loadout label { display: grid; gap: 5px; min-width: 0; }
.missions button[aria-pressed="true"] { border-color: var(--own); background: #20343f; }
.missions span, .loadout label, .muted { color: var(--muted); font-size: .81rem; }
#mission-situation { margin-top: 6px; font-size: .9rem; }
.mission-choices { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.mission-choices button { flex: 1 1 140px; }
.report { border-left: 3px solid var(--own); margin-top: 10px; padding: 7px 9px; background: #172b32; font-size: .84rem; }
.section-copy { display: grid; gap: 10px; }
.crew-member { display: flex; align-items: center; gap: 11px; border-top: 1px solid var(--line); padding-top: 9px; }
.crew-member p { color: var(--muted); font-size: .86rem; }
.portrait { flex: 0 0 42px; display: grid; place-items: center; height: 42px; background: #26414a; color: var(--own); border-radius: 8px; font-weight: 800; }
.game-feedback { margin-top: 8px; }
.game-feedback:empty { display: none; }
.game-feedback[data-error="true"] { position: sticky; bottom: calc(70px + env(safe-area-inset-bottom)); z-index: 1; background: #311c1b; border: 1px solid #9c5650; border-radius: 8px; padding: 8px; }
@media (min-width: 560px) {
  .industry { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 350px) {
  .frame { width: calc(100% - 16px); }
  .hud { padding: 8px; }
  .tile { font-size: .62rem; }
}

/* Colony artwork and controls */
:root {
  --gold: #ffc052;
  --cold: #81f4ff;
  --plate: linear-gradient(160deg, #2e383e 0%, #141b1f 25%, #151b1e 72%, #212a30 100%);
  --plate-edge: #687982;
}
body.in-game {
  padding-bottom: calc(78px + env(safe-area-inset-bottom));
  --line: #4b5b64;
}
.in-game .site-bar { display: none; }
.in-game main { padding-top: max(4px, env(safe-area-inset-top)); }
.hero {
  background-image: linear-gradient(90deg, #080c12e0, #10171921 95%), url("colony-terrain.webp");
  background-position: center, center 23%;
}
.hud, .build-panel, .game-nav {
  background: var(--plate);
  border-color: var(--plate-edge);
  box-shadow: inset 0 1px #d0e3ed62, inset 0 -2px #060a0eb5, 0 2px 6px #0007;
}
.hud { padding: 7px 9px 8px; border-radius: 8px; }
.hud .inventory { margin: 5px 0 0; gap: 4px; }
.hud .inventory div {
  display: grid;
  grid-template-columns: 12px minmax(0, 1fr);
  grid-template-rows: auto auto;
  column-gap: 5px;
  row-gap: 0;
  align-items: center;
  padding: 5px;
  text-align: left;
  background: #10161b;
  border: 1px solid #41535e;
  border-bottom-color: #273139;
  border-radius: 5px;
  line-height: 1.08;
}
.hud .inventory i {
  grid-row: 1 / 3;
  color: #b9ccd8;
  font-size: .8rem;
  font-style: normal;
  text-shadow: 0 0 8px #a4c4e86e;
}
.hud .inventory div:nth-child(2) i { color: var(--gold); text-shadow: 0 0 8px #ffa93371; }
.hud .inventory div:nth-child(3) i, .hud .inventory div:last-child i { color: var(--cold); text-shadow: 0 0 8px #3eb6e28a; }
.hud .inventory strong { grid-column: 2; }
.hud .inventory span { font-size: .61rem; }
.module-art {
  background-image: url("colony-structures.webp");
  background-size: 300% 300%;
  background-repeat: no-repeat;
}
.module-art[data-module="command"] { background-position: 0% 0%; }
.module-art[data-module="extractor"] { background-position: 50% 0%; }
.module-art[data-module="solar"] { background-position: 100% 0%; }
.module-art[data-module="refinery"] { background-position: 0% 50%; }
.module-art[data-module="garage"] { background-position: 50% 50%; }
.module-art[data-module="habitat"] { background-position: 100% 50%; }
.module-art[data-module="barracks"] { background-position: 0% 100%; }
.module-art[data-module="relay"] { background-position: 50% 100%; }
.module-art[data-module=""] { visibility: hidden; }

#colony { margin-top: 5px; }
.scene {
  position: relative;
  isolation: isolate;
  height: clamp(322px, calc(100svh - 279px), 642px);
  overflow: hidden;
  border: 1px solid #697880;
  border-radius: 6px;
  background: #3d4649 url("colony-terrain.webp") center top / cover no-repeat;
}
.scene::after {
  content: "";
  position: absolute;
  z-index: -1;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(180deg, #03060945 0%, transparent 27%, transparent 81%, #070c0e77 100%);
  box-shadow: inset 0 0 36px #02050935;
}
.scene-heading {
  position: absolute;
  z-index: 2;
  inset: 8px 8px auto;
  display: flex;
  justify-content: space-between;
  align-items: start;
  gap: 5px;
  pointer-events: none;
}
.scene-heading h2, .scene-heading span, .scene-task {
  width: max-content;
  max-width: 65%;
  padding: 5px 8px;
  border: 1px solid #526672;
  border-radius: 5px;
  background: #12191eea;
  box-shadow: 0 1px 5px #06091075;
  line-height: 1.18;
}
.scene-heading h2 { font-size: .81rem; }
.scene-heading span { color: var(--cold); font-size: .68rem; }
.scene-task {
  position: absolute;
  z-index: 3;
  bottom: 7px;
  left: 7px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 34px;
  font-size: .73rem;
  font-weight: 700;
  color: #f9d083;
  border-color: #a18044;
  text-decoration: none;
}
.scene-task:hover { background: #302211; }
#objective { scroll-margin-top: 8px; }
.tiles { position: absolute; inset: 0; width: min(100%, 692px); margin-inline: auto; }
.tile {
  --size: 29%;
  position: absolute;
  top: var(--y);
  left: var(--x);
  z-index: var(--depth);
  display: block;
  width: var(--size);
  aspect-ratio: 1;
  min-height: 44px;
  padding: 0;
  transform: translate(-50%, -88%);
  background: none;
  border: 0;
  border-radius: 7px;
}
.tile:hover:not(:disabled), .tile[aria-pressed="true"] { background: transparent; }
.tile:nth-child(1) { --x: 27%; --y: 35%; --size: 39%; --depth: 1; }
.tile:nth-child(2) { --x: 69%; --y: 41%; --size: 34%; --depth: 2; }
.tile:nth-child(3) { --x: 27%; --y: 53%; --size: 32%; --depth: 3; }
.tile:nth-child(4) { --x: 63%; --y: 61%; --size: 36%; --depth: 4; }
.tile:nth-child(5) { --x: 22%; --y: 73%; --size: 32%; --depth: 5; }
.tile:nth-child(6) { --x: 80%; --y: 75%; --size: 34%; --depth: 6; }
.tile:nth-child(7) { --x: 43%; --y: 84%; --size: 32%; --depth: 7; }
.tile:nth-child(8) { --x: 74%; --y: 91%; --size: 34%; --depth: 8; }
.tile:nth-child(9) { --x: 20%; --y: 92%; --size: 32%; --depth: 9; }
.tile-art { position: absolute; inset: 0; pointer-events: none; }
.tile::before {
  content: "";
  position: absolute;
  z-index: -1;
  top: 78%;
  left: 50%;
  width: 60%;
  height: 43%;
  border: 2px dashed #9ce5f1a8;
  box-shadow: 0 0 10px #07161788;
  background: #09363e34;
  transform: translate(-50%, -50%) rotate(-14deg) skewX(-37deg) scaleY(.71);
  pointer-events: none;
}
.tile[data-kind]:not([data-construction])::before { opacity: 0; }
.tile[aria-pressed="true"]::before, .tile[data-construction]::before {
  opacity: 1;
  background: repeating-linear-gradient(94deg, #66fdff4c 0 1px, transparent 1px 12px), #257b8273;
  border: 2px solid var(--cold);
  box-shadow: 0 0 13px #62ffff9c, inset 0 0 8px #5cffff70;
}
.tile:not([data-kind], [data-ghost]) .tile-label {
  display: none;
}
.tile[data-ghost] .tile-art, .tile[data-construction] .tile-art {
  filter: grayscale(1) brightness(1.25) sepia(1) hue-rotate(125deg) saturate(3) drop-shadow(0 0 6px #4ffaffd6);
  opacity: .81;
}
.tile-label {
  position: absolute;
  left: 50%;
  top: 87%;
  max-width: 112%;
  width: max-content;
  padding: 2px 5px;
  transform: translateX(-50%);
  border: 1px solid #596b70;
  border-radius: 3px;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  background: #0d151bdc;
  font-size: .65rem;
  font-weight: 700;
  text-shadow: 0 1px #000;
  pointer-events: none;
}
.tile:not([aria-pressed="true"]) .tile-label { opacity: .83; }
.tile[data-ghost] .tile-label, .tile[data-construction] .tile-label { color: var(--cold); border-color: #60c5ce; }

.build-panel { margin-top: 5px; padding: 6px 8px 8px; border-radius: 7px; }
.build-panel .panel-head { gap: 7px; min-height: 48px; }
.build-art { flex: 0 0 52px; height: 52px; border: 1px solid #414e54; border-radius: 5px; background-color: #10171a; }
.build-copy { flex: 1 1 0; min-width: 0; }
.build-copy h3 { font-size: clamp(.94rem, 4vw, 1.2rem); line-height: 1.14; }
.build-copy p { color: #cbecf5; font-size: .79rem; font-variant-numeric: tabular-nums; }
.build-selection {
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  margin-top: 4px;
}
.build-selection select { min-height: 35px; padding-block: 4px; }
.in-game .primary {
  color: #281606;
  background: linear-gradient(180deg, #ffe197 0%, #ffb32e 49%, #ec9419 100%);
  border: 1px solid #ffd885;
  border-radius: 6px;
  box-shadow: inset 0 1px #fff09c, inset 0 -2px #aa5b12, 0 1px 5px #0007;
  font-weight: 800;
}
.in-game .primary:hover:not(:disabled) { background: linear-gradient(180deg, #ffedbe, #ffc369 47%, #ffab2a); }
.in-game .primary:disabled { box-shadow: none; }
.game-nav {
  width: min(720px, 100%);
  border-radius: 9px 9px 0 0;
}
.game-nav button {
  min-height: 49px;
  background: linear-gradient(145deg, #26323b, #151c21);
  border-color: #445661;
  text-shadow: 0 1px #000b;
}
.game-nav button[aria-pressed="true"] {
  border-color: #e4a949;
  background: linear-gradient(145deg, #654017, #281b13);
  box-shadow: inset 0 1px #ffc9549c, inset 0 0 13px #ffad2133;
}

#map-panel { padding: 7px; border-color: #59666e; border-radius: 7px; }
#map-panel .panel-head { margin: 0 0 3px; }
#map-panel .panel-head button { min-height: 34px; }
.map-key { margin: 3px 0 5px; }
.map-controls { margin: 3px 0 6px; }
.map-controls button { min-height: 34px; min-width: 38px; padding: 4px; }
.map-viewport {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  border: 1px solid #708590;
  border-radius: 5px;
  background: #333d42 url("colony-sector.webp") 50% 44% / cover no-repeat;
}
#map {
  position: relative;
  display: grid;
  grid-template-columns: repeat(5, minmax(0,1fr));
  grid-template-rows: repeat(5, 1fr);
  gap: 0;
  aspect-ratio: auto;
  height: clamp(225px, 38svh, 420px);
  margin: 0;
}
#map .plot {
  position: relative;
  display: grid;
  place-content: center;
  place-items: center;
  gap: 1px;
  width: 100%;
  max-width: 100%;
  min-height: 0;
  aspect-ratio: auto;
  overflow: hidden;
  border: 1px solid #d2dddd23;
  border-radius: 0;
  background: #0d161922;
  text-shadow: 0 1px 3px #000;
}
#map .plot:hover, #map .plot[aria-pressed="true"] {
  background: #2465776e;
  border-color: #84ecffd6;
}
#map .plot[data-occupancy="own"] { background: #113e4560; border-color: #74d5e280; }
#map .plot[data-occupancy="other"] { background: #60411e55; border-color: #eeb04e70; }
#map .plot-marker {
  display: grid;
  place-items: center;
  width: 25px;
  height: 25px;
  border: 1px solid currentColor;
  border-radius: 6px;
  transform: none;
  font-size: 1rem;
  background: #10202be3;
  color: var(--cold);
  box-shadow: 0 0 8px #062328aa;
}
#map [data-occupancy="other"] .plot-marker { color: #ffc470; }
#map [data-occupancy="free"] .plot-marker { display: none; }
.plot-coords { font-size: .61rem; color: #e0e6e5; }
.playing .plot-coords { display: none; }
.playing .plot[aria-pressed="true"] .plot-coords { display: block; }
.plot-tag {
  max-width: 94%;
  overflow: hidden;
  padding: 1px 4px;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: #e1fdff;
  background: #101820e8;
  border: 1px solid #64a7ac;
  border-radius: 3px;
  font-size: .64rem;
  line-height: 1.15;
}
.plot-tag:empty { display: none; }
#map-panel .map-detail { min-height: 0; margin-top: 5px; }
.map-route { position: absolute; inset: 0; pointer-events: none; }
.route-segment {
  position: absolute;
  height: 0;
  border-top: 2px dashed #8ffcff;
  transform-origin: 0 50%;
  filter: drop-shadow(0 0 3px #39cfe7);
}
.route-target, .route-rover { position: absolute; }
.route-target i, .route-rover {
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border: 2px solid #ffb63c;
  border-radius: 50%;
  background: #161a1cba;
  box-shadow: 0 0 9px #ffb020e1, inset 0 0 3px #eea93d;
  transform: translate(-50%, -50%);
}
.route-target b {
  position: absolute;
  top: 14px;
  left: 4px;
  width: max-content;
  padding: 3px 6px;
  background: #141b1eeb;
  color: #ffe1a4;
  border: 1px solid #9b7036;
  border-radius: 4px;
  font-size: .71rem;
}
.map-route[data-label-left="true"] .route-target b { top: 16px; right: -5px; left: auto; }
.route-rover {
  width: 18px;
  height: 18px;
  color: #e9ffff;
  border-color: var(--cold);
  box-shadow: 0 0 8px #48edfe;
  font-size: 9px;
}
@media (prefers-reduced-motion: no-preference) {
  .route-rover { transition: top .65s linear, left .65s linear; }
}
#expeditions { border-color: #697981; background: var(--plate); border-radius: 7px; padding: 8px; }
.mission-banner {
  min-height: clamp(122px, 19svh, 220px);
  align-content: end;
  padding: 8px;
  background: linear-gradient(0deg, #10171ce5, transparent 52%), url("colony-sector.webp") center 44% / cover no-repeat;
  border: 1px solid #526a79;
  border-radius: 5px;
}
.mission-banner[data-mission="signal"] {
  background-image: linear-gradient(0deg, #10171cea, transparent 52%), url("colony-station.webp");
  background-position: center 56%;
}
.mission-banner h3 { font-size: 1.21rem; text-shadow: 0 2px 3px #000; }
.mission-copy { padding: 5px 2px 0; font-size: .81rem; color: #e6e8e7; }
.launch-row { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 5px 8px; }
.launch-row p { flex: 1 1 108px; }
.launch-row button { flex: 1 0 auto; }
.center-icon { display: none; }
@media (max-width: 510px) {
  .playing #map-panel { position: relative; display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px; align-items: center; }
  .playing #map-panel .panel-head { flex-wrap: nowrap; margin: 0; }
  .playing #map-title { font-size: .98rem; }
  .playing #center-map { width: 33px; min-width: 33px; padding: 0; }
  .playing #center-map-label { display: none; }
  .playing .center-icon { display: inline; font-size: 1.13rem; }
  .playing .map-key, .playing .map-controls .coordinates { display: none; }
  .playing .map-controls { gap: 2px; margin: 0; }
  .playing .map-controls button { min-width: 33px; }
  .playing .map-viewport { grid-column: 1 / -1; }
  .playing #map { height: clamp(182px, 29svh, 231px); }
  .playing #map-panel .map-detail {
    position: absolute;
    right: 10px;
    bottom: 9px;
    left: 10px;
    width: fit-content;
    max-width: calc(100% - 20px);
    padding: 2px 4px;
    border-radius: 3px;
    background: #10191bd9;
    color: #e1e8e5;
    font-size: .68rem;
    pointer-events: none;
  }
  #expeditions .panel-head { margin-bottom: 2px; }
  #expeditions .missions { margin: 5px 0 6px; }
  #expeditions .missions button { min-height: 44px; gap: 1px; padding-block: 3px; }
  #expeditions .missions span { font-size: .68rem; }
  .mission-banner { min-height: clamp(104px, 14svh, 132px); }
  #expeditions .loadout { margin: 5px 0 7px; gap: 5px; }
  #expeditions .loadout label { gap: 2px; }
  #expeditions .loadout select { min-height: 39px; padding-block: 4px; }
}
@media (min-width: 580px) {
  .scene { background-position: center 28%; }
  .tile { width: min(var(--size), 195px); }
  .tile:nth-child(1) { width: min(var(--size), 205px); }
  #map .plot-marker { width: 34px; height: 34px; }
}
@media (max-width: 350px) {
  .hud .inventory div { column-gap: 3px; padding-inline: 3px; }
  .hud .inventory span { font-size: .57rem; }
}

/* Framing and metal plates from the gameplay reference */
:root {
  --game-hud-height: clamp(49px, 7.1svh, 61px);
  --game-nav-height: clamp(53px, 9svh, 72px);
  --colony-xp-height: 24px;
  --game-build-height: clamp(84px, 12.1svh, 102px);
  --game-metal: linear-gradient(145deg, #272e33 0, #131719 22%, #0b1013 68%, #252d31 100%);
  --game-edge: #7c888c;
}
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}
.in-game {
  padding-bottom: calc(var(--game-nav-height) + env(safe-area-inset-bottom));
  background: #07090b;
}
.in-game main.frame {
  width: min(100%, 860px);
  padding-top: env(safe-area-inset-top);
}
.in-game .hud, .in-game .build-panel, .in-game .game-nav {
  position: relative;
  background: var(--game-metal);
  border: 1px solid var(--game-edge);
  border-radius: 3px;
  box-shadow: inset 0 2px #c3c8c28c, inset 0 -2px #090c0f, 0 2px 3px #000c;
}
.in-game .hud::before, .in-game .build-panel::before {
  content: "";
  pointer-events: none;
  position: absolute;
  z-index: 0;
  inset: 3px;
  border: 1px solid #546369;
  clip-path: polygon(10px 0, calc(100% - 10px) 0, 100% 10px, 100% calc(100% - 10px),
    calc(100% - 10px) 100%, 10px 100%, 0 calc(100% - 10px), 0 10px);
}
.hud-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 46px;
  gap: 4px;
}
.in-game .hud {
  display: grid;
  align-items: center;
  min-height: var(--game-hud-height);
  min-width: 0;
  padding: 4px 7px;
}
.base-stage {
  display: block;
  width: fit-content;
  max-width: 100%;
  margin-top: 2px;
  padding: 0 9px 1px 5px;
  overflow: hidden;
  clip-path: polygon(0 0, calc(100% - 6px) 0, 100% 50%, calc(100% - 6px) 100%, 0 100%);
  font-weight: 850;
  font-size: .63rem;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: #170e05;
  background: linear-gradient(#ffcc63, #e89924);
}
.in-game .hud .inventory {
  position: relative;
  display: flex;
  align-items: stretch;
  margin: 0;
  gap: 0;
}
.in-game .hud .inventory > div {
  flex: 1 1 0;
  display: grid;
  grid-template-columns: clamp(14px, 5vw, 24px) minmax(0, 1fr);
  grid-template-rows: minmax(10px, auto) minmax(12px, auto);
  gap: 0 3px;
  align-content: center;
  min-width: 0;
  margin: 0;
  padding: 0 2px 0 4px;
  border: 0;
  border-left: 1px solid #8e8b7f;
  border-radius: 0;
  background: none;
}
.in-game .hud .inventory i { width: 100%; height: auto; aspect-ratio: 1; }
.in-game .hud .inventory > div:first-child { border-left: 0; }
.in-game .hud .inventory span { font-size: clamp(.56rem, 2.1vw, .74rem); line-height: 1; }
.in-game .hud .inventory strong { font-size: clamp(.72rem, 3.2vw, 1.1rem); line-height: 1; color: #fff3dc; }
.hud-icon {
  display: inline-block;
  width: 27px;
  height: 27px;
  font-size: 0;
  background-image: url("colony-console-icons.webp");
  background-size: 400% 200%;
  background-repeat: no-repeat;
}
.hud-icon[data-icon="base"] { background-position: 0 0; }
.hud-icon[data-icon="map"] { background-position: 33.333% 0; }
.hud-icon[data-icon="crew"] { background-position: 66.667% 0; }
.hud-icon[data-icon="science"] { background-position: 100% 0; }
.hud-icon[data-icon="ore"] { background-position: 0 100%; }
.hud-icon[data-icon="metal"] { background-position: 33.333% 100%; }
.hud-icon[data-icon="crystal"] { background-position: 66.667% 100%; }

.in-game[data-view="colony"] #colony { margin: 0; }
.in-game[data-view="colony"] .scene {
  height: max(285px, calc(100svh - var(--game-hud-height) - var(--game-build-height) - var(--game-nav-height) - env(safe-area-inset-top) - env(safe-area-inset-bottom)));
  border: 0;
  border-radius: 0;
  background: #3b4142 url("colony-yard.webp") 50% 45% / cover no-repeat;
}
.in-game[data-view="colony"] .scene::after { background: linear-gradient(180deg, #06090b30 0, transparent 22%, transparent 90%, #0b101268 100%); box-shadow: none; }
.colony-overview {
  z-index: 12;
  position: absolute;
  top: 5px;
  right: 6px;
  display: grid;
  justify-items: end;
  gap: 3px;
  max-width: 104px;
  pointer-events: none;
}
.power-readout {
  padding: 2px 5px;
  color: #cdf7f8;
  border: 1px solid #76878fb8;
  background: #101619d6;
  font-size: .62rem;
  line-height: 1.25;
  pointer-events: none;
}
.scene-task { min-height: 36px; color: #eee6ce; background: #151a1cdb; border-color: #5c6870; z-index: 12; }
.in-game .tile { --depth: 1; border: 0; }
.in-game .tile:nth-child(1) { --x: 44%; --y: 42%; --size: 46%; --depth: 3; }
.in-game .tile:nth-child(2) { --x: 15%; --y: 61%; --size: 38%; --depth: 5; }
.in-game .tile:nth-child(3) { --x: 17%; --y: 31%; --size: 35%; --depth: 1; }
.in-game .tile:nth-child(4) { --x: 83%; --y: 55%; --size: 38%; --depth: 4; }
.in-game .tile:nth-child(5) { --x: 26%; --y: 79%; --size: 34%; --depth: 6; }
.in-game .tile:nth-child(6) { --x: 82%; --y: 34%; --size: 34%; --depth: 2; }
.in-game .tile:nth-child(7) { --x: 72%; --y: 80%; --size: 46%; --depth: 8; }
.in-game .tile:nth-child(8) { --x: 49%; --y: 59%; --size: 28%; --depth: 7; }
.in-game .tile:nth-child(9) { --x: 45%; --y: 94%; --size: 26%; --depth: 9; }
.in-game .tile::before {
  top: 81%;
  border-width: 1px;
  border-color: #98e9f1a0;
  background: #163b441a;
}
.in-game .tile[data-ghost]::before, .in-game .tile[data-construction]::before {
  width: 84%;
  height: 55%;
  background: repeating-linear-gradient(0deg, #36efff54 0 1px, transparent 1px 12px),
    repeating-linear-gradient(90deg, #36efff54 0 1px, transparent 1px 12px), #25e5ff36;
  border-color: #b2fcff;
  box-shadow: inset 0 0 9px #99f9ffaa, 0 0 16px #4bedffc2;
}
.in-game .tile-label {
  opacity: 0;
  border-radius: 1px;
  font-size: .59rem;
  transform: translateX(-50%);
}
.in-game .tile:is([aria-pressed="true"], :focus-visible, [data-construction], [data-built]) .tile-label { opacity: 1; }
.in-game .tile[data-ghost] .tile-art {
  opacity: .73;
  filter: grayscale(1) brightness(1.42) contrast(1.2) sepia(1) hue-rotate(126deg) saturate(3.5)
    drop-shadow(0 0 2px #affaFF) drop-shadow(0 0 7px #4bdfff);
}
.in-game .build-panel {
  display: grid;
  grid-template-rows: minmax(48px, 1fr) auto;
  min-height: var(--game-build-height);
  margin: 0;
  padding: 3px 9px;
}
.in-game .build-panel .panel-head { position: relative; align-items: center; gap: 7px; margin: 0; }
.in-game .build-panel .build-art { height: clamp(44px, 7svh, 61px); flex-basis: clamp(44px, 7svh, 61px); }
.in-game .build-panel h3 { font-size: clamp(1.04rem, 4.8vw, 1.58rem); font-weight: 850; }
.in-game #build-detail { color: #d2f4f7; font-weight: 750; font-size: .76rem; }
.in-game .build-selection { display: flex; align-items: center; gap: 7px; margin: 1px 0 0; line-height: 1; overflow: hidden; font-size: .63rem; }
.in-game .build-selection select { flex: 1 1 auto; width: auto; min-height: 23px; padding: 1px 16px 1px 4px; border-radius: 2px; font-size: .7rem; }
.in-game .build-panel .primary { min-width: 27%; font-size: 1rem; font-weight: 900; padding-inline: 6px; }
.in-game #objective, .in-game #industry, .in-game #save-note, .in-game #crew, .in-game #research { margin-inline: 8px; }

.in-game .game-nav {
  z-index: 20;
  position: fixed;
  bottom: 0;
  min-height: var(--game-nav-height);
  width: min(100%, 860px);
  gap: 2px;
  padding: 3px 2px calc(3px + env(safe-area-inset-bottom));
  border-inline-width: 0;
}
.in-game .game-nav button {
  min-height: calc(var(--game-nav-height) - 8px);
  border-radius: 2px;
  gap: 2px;
  padding: 0 2px 2px;
  border-color: #788183;
  box-shadow: inset 0 2px #bcc9c761, inset 0 -2px #030707;
  background: linear-gradient(150deg, #273135, #0e1315 57%);
  font-size: clamp(.73rem, 3.06vw, .96rem);
  font-weight: 800;
}
.in-game .game-nav button[aria-pressed="true"] {
  background: linear-gradient(155deg, #684315, #2d1b0e 64%);
  border-color: #ffc353;
  box-shadow: inset 0 1px #ffdb9a, inset 0 0 8px #ff9a27a8;
  color: #fff2d5;
}
.in-game .game-nav button[aria-pressed="true"] .hud-icon { filter: sepia(.9) saturate(1.6); }
.in-game .game-nav .hud-icon { width: clamp(24px, 5svh, 36px); height: clamp(24px, 5svh, 36px); }
@media (min-width: 700px) {
  .in-game[data-view="colony"] .scene { background-position: center 33%; }
  .in-game .tile:nth-child(1) { width: min(var(--size), 230px); }
  .in-game .tile:nth-child(7) { width: min(var(--size), 230px); }
}


/* Lunar map and expedition briefing */
body[data-view="map"] #play { margin: 0; gap: 0; }
body[data-view="map"] #map-panel {
  display: block;
  position: relative;
  padding: 0;
  margin: 0;
  border: 0;
  border-radius: 0;
  background: #333d42;
}
body[data-view="map"] #map-panel .panel-head {
  position: absolute;
  z-index: 3;
  inset: 0 auto auto 0;
  width: 100%;
  margin: 0;
  padding: 0;
  align-items: flex-start;
  gap: 0;
  pointer-events: none;
}
body[data-view="map"] #map-title {
  color: #f4f0e4;
  font-size: clamp(1rem, 5.25vw, 1.65rem);
  line-height: 1;
  padding: 9px 30px 9px 12px;
  background: linear-gradient(180deg, #465055, #20272a 16%, #1c2022 83%, #433423 100%);
  border-block: 1px solid #a7aba7;
  clip-path: polygon(0 0, 100% 0, calc(100% - 24px) 100%, 0 100%);
  text-shadow: 0 2px 1px #080a0b;
}
body[data-view="map"] #center-map {
  margin: 5px 5px 0 0;
  padding: 0;
  width: 37px;
  min-width: 37px;
  min-height: 37px;
  pointer-events: auto;
  background: linear-gradient(155deg, #566168, #191f23 34%, #15191b 71%, #454547);
  border: 1px solid #999890;
  border-radius: 6px;
}
body[data-view="map"] #center-map-label,
body[data-view="map"] .map-key,
body[data-view="map"] .map-controls .coordinates { display: none; }
body[data-view="map"] .center-icon { display: inline; font-size: 1.15rem; }
body[data-view="map"] .map-controls {
  position: absolute;
  z-index: 3;
  left: 5px;
  bottom: 10px;
  margin: 0;
  display: grid;
  grid-template-columns: repeat(2, auto);
  gap: 2px;
}
body[data-view="map"] .map-controls button {
  min-width: 30px;
  min-height: 30px;
  padding: 3px;
  border-radius: 4px;
  border-color: #999890;
  background: linear-gradient(155deg, #566168, #191f23 34%, #15191b 71%, #454547);
}
body[data-view="map"] .map-viewport {
  border: 0;
  border-radius: 0;
  background-position: 50% 44%;
  background-size: cover;
}
body[data-view="map"] #map {
  grid-template-columns: 1fr 1fr 1.45fr 2fr 1.8fr;
  grid-template-rows: 1fr 1fr 1.4fr 1.7fr 1.7fr;
  height: clamp(215px, calc(56svh - var(--game-hud-height, 42px) - 10px), 570px);
}
body[data-view="map"] #map .plot {
  display: block;
  overflow: visible;
  color: #b4faff;
  border: 0;
  background: transparent;
  box-shadow: none;
}
body[data-view="map"] #map .plot::before {
  position: absolute;
  content: "";
  pointer-events: none;
  width: clamp(36px, 15vw, 85px);
  height: clamp(17px, 6vw, 29px);
  left: 50%;
  top: calc(50% + 12px);
  transform: translate(-50%, -50%) skewY(7deg) rotate(-20deg);
  border: 1px dashed #4ceaf5;
  background: #1eafc238;
}
body[data-view="map"] #map .plot[data-occupancy="free"]::before { display: none; }
body[data-view="map"] #map .plot[data-occupancy="free"]:is(:hover,:focus-visible,[aria-pressed="true"])::before { display: block; }
body[data-view="map"] #map .plot-marker {
  position: absolute;
  display: block;
  left: 50%;
  top: 50%;
  width: clamp(50px, 18vw, 104px);
  height: auto;
  aspect-ratio: 1;
  transform: translate(-50%, -63%);
  color: transparent !important;
  border: 0;
  border-radius: 0;
  background: transparent url("colony-structures.webp") 100% 50% / 300% 300% no-repeat;
  box-shadow: none;
  filter: drop-shadow(0 4px 2px #060809b5);
  pointer-events: none;
}
body[data-view="map"] #map .plot[data-allied="true"]::before {
  border-color: #6ec0ff;
  background: #2559aa75;
  box-shadow: 0 0 9px #409eff96;
}
body[data-view="map"] #map .plot[data-allied="true"] .plot-marker {
  filter: drop-shadow(0 4px 2px #060809b5) drop-shadow(0 0 6px #4aaeff);
}
body[data-view="map"] #map .plot[data-occupancy="own"] .plot-marker { width: clamp(62px, 22vw, 124px); }
body[data-view="map"] #map .plot[data-occupancy="free"] .plot-marker { display: none; }
body[data-view="map"] #map .plot-coords { display: none; }
body[data-view="map"] #map .plot[data-occupancy="free"][aria-pressed="true"] .plot-coords { display: inline; }
body[data-view="map"] #map .plot-tag {
  position: absolute;
  z-index: 1;
  left: 50%;
  bottom: calc(50% + clamp(14px, 8vw, 40px));
  transform: translateX(-50%);
  color: #f2ffff;
  padding: 4px 7px;
  max-width: 114px;
  width: max-content;
  border: 1px solid #58e9f1;
  border-radius: 3px;
  font-size: clamp(.66rem, 2.6vw, .88rem);
  line-height: 1;
  background: #102126ed;
  pointer-events: none;
}
body[data-view="map"] #map-panel .map-detail {
  position: absolute;
  right: 7px;
  left: auto;
  bottom: 5px;
  z-index: 2;
  width: max-content;
  margin: 0;
  max-width: calc(100% - 80px);
  color: #f5f1e8;
  background: #141a1cd9;
  padding: 3px 5px;
  font-size: .65rem;
  pointer-events: none;
}
body[data-view="map"] .route-segment {
  border-top: 2px dashed #58e8f7;
  filter: drop-shadow(0 1px 2px #000) drop-shadow(0 0 3px #13c8ee);
}
body[data-view="map"] .route-target i {
  width: clamp(39px, 16vw, 89px);
  height: clamp(26px, 12vw, 64px);
  border-style: dashed;
  transform: translate(-50%, -48%) rotate(-16deg);
  background: #b16b191c;
  box-shadow: 0 0 10px #f2922590;
}
body[data-view="map"] .route-station {
  position: absolute;
  top: 0;
  left: 0;
  width: clamp(44px, 17vw, 92px);
  aspect-ratio: 1;
  transform: translate(-50%, -64%);
  filter: drop-shadow(0 4px 2px #070e12d0);
}
body[data-view="map"] .map-route[data-mission="survey"] .route-station { display: none; }
body[data-view="map"] .route-target b {
  top: 20px;
  left: 4px;
  color: #ffd687;
  border-color: #ffb049;
  background: #24180de8;
}
body[data-view="map"] .map-route[data-label-left="true"] .route-target b { left: auto; right: -1px; top: 20px; }
body[data-view="map"] .route-rover {
  width: 24px;
  height: 13px;
  font-size: 0;
  border: 1px solid #f6d8ad;
  border-radius: 3px 5px 3px 3px;
  background: linear-gradient(125deg, #e6dfd0 43%, #4b5b64 44% 59%, #edab53 61%);
  box-shadow: 0 3px 2px #0d1012b0;
}
body[data-view="map"] .route-rover::before,
body[data-view="map"] .route-rover::after {
  position: absolute;
  content: "";
  width: 5px;
  height: 5px;
  border-radius: 1px;
  background: #1b1e20;
  bottom: -3px;
}
body[data-view="map"] .route-rover::before { left: 2px; }
body[data-view="map"] .route-rover::after { right: 2px; }

#expeditions .sortie-section-title {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}
#expeditions {
  background: linear-gradient(155deg, #31383b, #171a1c 38% 70%, #292724);
  border: 1px solid #aaa59a;
  border-radius: 8px;
  box-shadow: inset 0 0 0 2px #111416, inset 0 0 0 3px #888072, 0 2px 8px #090a0cbd;
  margin: 0;
  padding: 5px 6px 6px;
}
.sortie-heading {
  display: flex;
  align-items: center;
  min-height: clamp(32px, 5.2svh, 51px);
  gap: 7px;
  padding: 2px 5px;
  border: 1px solid #746d5e;
  background: linear-gradient(160deg, #34383b, #1a1e20 59%, #26211a);
}
.sortie-heading h3 {
  flex: 1;
  min-width: 0;
  margin: 0;
  color: #f5edde;
  line-height: 1;
  font-size: clamp(1.05rem, 5vw, 1.95rem);
  letter-spacing: -.035em;
}
.sortie-emblem {
  display: grid;
  place-items: center;
  flex: 0 0 25px;
  height: 24px;
  border: 1px solid #f28455;
  color: #ff955e;
  background: #361e17;
  font-size: 1.25rem;
  line-height: 1;
}
#expeditions #rover-status {
  border: 1px solid #777469;
  background: linear-gradient(135deg, #3e3830, #211e1b);
  color: #f5ddb3;
  padding: 4px 5px;
  font-size: clamp(.54rem, 2vw, .77rem);
}
#expeditions .mission-card {
  display: grid;
  grid-template-columns: minmax(0, 59fr) minmax(0, 41fr);
  grid-template-areas: "art rail" "art options" "copy launch";
  gap: 4px;
  padding-top: 4px;
  align-items: stretch;
}
#expeditions .mission-banner {
  grid-area: art;
  padding: 0;
  min-height: clamp(102px, 19svh, 230px);
  border: 1px solid #8a857d;
  border-radius: 4px;
  background-position: 43% 55%;
}
#expeditions .mission-banner[data-mission="signal"] {
  background-image: url("colony-station.webp");
}
.sortie-rail {
  grid-area: rail;
  display: grid;
  grid-template-rows: minmax(40px, 1fr) auto;
  min-width: 0;
  gap: 3px;
}
.sortie-crew {
  display: grid;
  align-content: end;
  min-height: 43px;
  padding: 3px 5px;
  overflow: hidden;
  border: 1px solid #686d6a;
  border-radius: 3px;
  background: linear-gradient(0deg, #151b1ef0 6%, #1b232a26 70%), url("colony-field-team.webp") 50% 34% / cover no-repeat, #29363d;
  color: #f9f3e7;
  text-shadow: 0 1px 3px #090c0e;
  line-height: 1.05;
}
.sortie-crew span { font-size: clamp(.51rem, 1.75vw, .77rem); }
.sortie-crew strong { font-size: clamp(.6rem, 2.45vw, 1rem); }
#expeditions .missions {
  display: grid;
  gap: 2px;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  margin: 0;
}
#expeditions .missions button {
  display: block;
  min-height: 24px;
  padding: 2px 1px;
  overflow-wrap: anywhere;
  border: 1px solid #727a7b;
  background: linear-gradient(#343d41, #212729);
  color: #eee9df;
  font-size: clamp(.51rem, 1.8vw, .72rem);
  line-height: 1.1;
}
#expeditions .missions button[aria-pressed="true"] {
  color: #b4f7ff;
  border-color: #62b9c4;
  background: #18333c;
}
#expeditions #mission-brief { display: contents; }
#expeditions #mission-brief[hidden] { display: none; }
#expeditions .loadout {
  grid-area: options;
  display: grid;
  gap: 2px;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  margin: 0;
}
#expeditions .loadout label {
  display: grid;
  gap: 2px;
  color: #eae2d3;
  font-size: clamp(.52rem, 1.75vw, .73rem);
  line-height: 1.1;
}
#expeditions .loadout select {
  width: 100%;
  min-width: 0;
  min-height: 24px;
  padding: 2px 1px;
  border: 1px solid #61757e;
  border-radius: 3px;
  background-color: #1b2930;
  color: #fdf3df;
  font-size: clamp(.49rem, 1.8vw, .69rem);
}
#expeditions .mission-copy {
  grid-area: copy;
  display: flex;
  align-items: center;
  padding: 4px 5px;
  border: 1px solid #464f50;
  color: #eee9df;
  background: #1b2224;
  font-size: clamp(.62rem, 2.25vw, .87rem);
  line-height: 1.16;
}
#expeditions .launch-row {
  grid-area: launch;
  display: grid;
  gap: 2px;
  align-content: center;
  padding: 1px;
}
#expeditions #deploy {
  width: 100%;
  min-height: 32px;
  margin: 0;
  padding: 1px 3px;
  color: #fff6e5;
  border: 1px solid #ffb95b;
  border-radius: 4px;
  font-size: clamp(.64rem, 2.7vw, 1.1rem);
  font-weight: 850;
  line-height: 1.1;
  text-shadow: 0 1px 2px #40250b;
  box-shadow: inset 0 0 0 2px #f0a43c6e, 0 0 7px #e9922682;
  background: linear-gradient(180deg, #ab6b24 0%, #613707 49%, #b87324 100%);
}
#expeditions #deploy:not(:disabled):hover { filter: brightness(1.19); }
#expeditions #mission-cost {
  margin: 0;
  line-height: 1.05;
  font-size: clamp(.54rem, 1.85vw, .74rem);
  text-align: center;
}
#expeditions #mission-live, #expeditions #mission-report { grid-column: 1 / -1; }
#expeditions .mission-card:has(#mission-brief[hidden]) .mission-copy { grid-column: 1 / -1; }
@media (min-height: 740px) {
  #expeditions .missions button, #expeditions .loadout select { min-height: 31px; }
  #expeditions #deploy { min-height: 39px; }
}

body[data-view="map"] #route-rover {
  width: 42px;
  height: 37px;
  background: transparent url("colony-rover.webp") center 52% / 207% auto no-repeat;
  border: 0;
  box-shadow: none;
  filter: drop-shadow(0 2px 2px #10151dd9) drop-shadow(0 0 3px #69cde182);
}
body[data-view="map"] .sortie-emblem { font-size: 0; line-height: 1; }
.in-game .tile:not([aria-pressed="true"]):not(:focus-visible):not([data-construction], [data-built]) .tile-label { opacity: 0; }
.in-game #build::before {
  content: "";
  width: 22px;
  height: 22px;
  background: url("colony-console-icons.webp") 100% 100% / 400% 200% no-repeat;
  filter: grayscale(1) brightness(.24);
}
body[data-view="map"] #map-panel .map-viewport { overflow: hidden; }
body[data-view="map"] #map .plot[data-occupancy="own"] .plot-tag {
  bottom: calc(50% + 17px);
  left: 73%;
  transform: translateX(-15%);
}
#expeditions .mission-banner[data-mission="signal"] {
  background: #11161a url("colony-station.webp") 50% 53% / cover no-repeat;
}
#expeditions .sortie-crew {
  background: linear-gradient(90deg, #101619e6, #13181013 82%), url("colony-field-team.webp") 52% 18% / cover no-repeat, #263139;
}
body[data-view="map"] .sortie-emblem {
  background: #321c14 url("colony-console-icons.webp") 33.333% 0 / 400% 200% no-repeat;
}
.sortie-personnel { display: grid; grid-template-columns: minmax(0, 58fr) minmax(0, 42fr); gap: 3px; }
.sortie-gear {
  display: grid;
  grid-template-rows: minmax(22px, 1fr) auto;
  align-items: center;
  justify-items: center;
  gap: 0;
  min-width: 0;
  min-height: 43px;
  padding: 2px;
  border: 1px solid #60737e;
  border-radius: 3px;
  background: #0d151a;
  color: #f9f3e7;
  font-size: clamp(.48rem, 1.85vw, .75rem);
}
.sortie-gear-art {
  width: 26px;
  height: 26px;
  background: url("colony-console-icons.webp") 100% 100% / 400% 200% no-repeat;
}
.sortie-gear[data-equipment="emp"] .sortie-gear-art {
  width: min(100%, 110px);
  height: 100%;
  background: url("colony-emp.webp") center / contain no-repeat;
}
.in-game .hud .inventory :is(span, strong) {
  min-width: 0;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.in-game { --play-width: clamp(390px, 56.25svh, 620px); }
.in-game[data-view="map"] { --play-width: clamp(390px, 66.667svh, 690px); }
.in-game main.frame, .in-game .game-nav { width: min(100%, var(--play-width)); }
.in-game main.frame { container-type: inline-size; }
.in-game[data-view="colony"] .scene {
  height: max(285px, calc(100svh - var(--game-hud-height) - var(--game-build-height) - var(--game-nav-height) - env(safe-area-inset-top) - env(safe-area-inset-bottom) - 2px));
  background-position: center -31px;
  background-size: auto max(100% + 31px, 177.683cqw);
}
.in-game[data-view="colony"] .tiles { width: 100%; container-type: inline-size; }
.in-game[data-view="colony"] .tile { top: max(43px, calc(var(--y) - 30px)); width: var(--size); }
.in-game[data-view="colony"] .tile:nth-child(1) { --x: 39%; --y: min(56cqw, 44%); --size: 52%; }
.in-game[data-view="colony"] .tile:nth-child(2) { --x: 22%; --y: min(87cqw, 69%); --size: 41%; }
.in-game[data-view="colony"] .tile:nth-child(3) { --x: 17%; --y: min(38cqw, 29%); --size: 32%; }
.in-game[data-view="colony"] .tile:nth-child(4) { --x: 80%; --y: min(75cqw, 59%); --size: 35%; }
.in-game[data-view="colony"] .tile:nth-child(5) { --x: 87%; --y: min(92cqw, 75%); --size: 26%; }
.in-game[data-view="colony"] .tile:nth-child(6) { --x: 81%; --y: min(46cqw, 37%); --size: 35%; }
.in-game[data-view="colony"] .tile:nth-child(7) { --x: 64%; --y: min(115cqw, 90%); --size: 48%; }
.in-game[data-view="colony"] .tile:nth-child(8) { --x: 55%; --y: min(33cqw, 24%); --size: 23%; }
.in-game[data-view="colony"] .tile:nth-child(9) { --x: 40%; --y: min(121cqw, 93%); --size: 23%; }
/* Match the plot anchors to the expansion yard's illustrated foundations. */
.in-game[data-view="colony"] .scene[data-plot-page="2"] {
  background: #343b3d url("colony-yard-expansion.webp") center / 100% 100% no-repeat;
}
.scene[data-plot-page="2"] .tile::before {
  width: 74%;
  transform: translate(-50%, -50%) skewX(-14deg) scaleY(.69);
}
.in-game[data-view="colony"] .scene[data-plot-page="2"] .tile {
  top: var(--y);
  width: clamp(55px, var(--size), 136px);
  transform: translate(-50%, -80%);
}
/* Align each sprite's footprint to the pad using the laboratory as the reference. */
.in-game[data-view="colony"] .scene[data-plot-page="2"] .tile-art {
  transform: translate(calc((50% - var(--footprint-x, 50%)) * 1.25),
    calc((88% - var(--footprint-bottom, 88%)) * 1.25)) scale(1.25);
  transform-origin: 50% 80%;
}
.scene[data-plot-page="2"] .tile-art[data-module="drill"] {
  --footprint-x: 53.5%;
  --footprint-bottom: 87%;
}
.scene[data-plot-page="2"] .tile-art[data-module="warehouse"] {
  --footprint-x: 44%;
  --footprint-bottom: 87%;
}
.scene[data-plot-page="2"] .tile-art[data-module="hospital"] {
  --footprint-bottom: 81%;
}
.scene[data-plot-page="2"] .tile-art[data-module="habitat"] {
  --footprint-x: 46%;
  --footprint-bottom: 78%;
}
.scene[data-plot-page="2"] .tile-art[data-module="barracks"] {
  --footprint-x: 46.5%;
  --footprint-bottom: 76%;
}
.in-game[data-view="colony"] .scene[data-plot-page="2"] [data-slot="9"]  { --x: 27%; --y: 32%; --size: 28%; --depth: 1; }
.in-game[data-view="colony"] .scene[data-plot-page="2"] [data-slot="10"] { --x: 67%; --y: 39%; --size: 29%; --depth: 2; }
.in-game[data-view="colony"] .scene[data-plot-page="2"] [data-slot="11"] { --x: 80%; --y: 51%; --size: 28%; --depth: 3; }
.in-game[data-view="colony"] .scene[data-plot-page="2"] [data-slot="12"] { --x: 79%; --y: 65%; --size: 29%; --depth: 4; }
.in-game[data-view="colony"] .scene[data-plot-page="2"] [data-slot="13"] { --x: 20%; --y: 66%; --size: 29%; --depth: 5; }
.in-game[data-view="colony"] .scene[data-plot-page="2"] [data-slot="14"] { --x: 50%; --y: 76%; --size: 30%; --depth: 6; }
.in-game[data-view="colony"] .scene[data-plot-page="2"] [data-slot="15"] { --x: 82%; --y: 83%; --size: 28%; --depth: 7; }
.in-game[data-view="colony"] .scene[data-plot-page="2"] [data-slot="16"] { --x: 41%; --y: 54%; --size: 26%; --depth: 3; }

.in-game .tile[data-built] .tile-label {
  top: var(--building-label-top, 14%);
  display: flex;
  align-items: center;
  gap: 4px;
  max-width: min(145px, 34cqw);
  padding: 2px 4px;
  color: #f4f7f5;
  border-color: #91b0b6;
  border-radius: 4px;
  background: #08141aef;
  font-size: clamp(.625rem, 2.75cqw, .8rem);
  line-height: 1.15;
  white-space: normal;
}
.tile-level {
  flex: none;
  padding-inline-start: 4px;
  border-inline-start: 1px solid #506d76;
  color: #a7f2f6;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.scene[data-plot-page="1"] .tile[data-slot="0"] { --building-label-top: 24%; }
.scene[data-plot-page="2"] .tile[data-built] { --building-label-top: -8%; }
@container (max-width: 440px) {
  .scene[data-plot-page="1"] .tile[data-slot="0"] { --building-label-top: 51%; }
  .scene[data-plot-page="1"] .tile[data-slot="2"] { --building-label-top: 46%; }
  .scene[data-plot-page="1"] .tile[data-slot="5"] { --building-label-top: 24%; }
}
.in-game .build-panel .primary { min-width: 31%; }
body[data-view="map"] #map .plot[data-occupancy="own"] .plot-tag {
  bottom: calc(50% - 28px);
  left: 46%;
}
/* The map and its briefing share the game's available row. */
body[data-view="map"] #play.playing {
  grid-template-columns: minmax(0, 1fr);
  min-height: 0;
  min-width: 0;
  align-items: stretch;
}

body[data-view="map"] #map-panel,
body[data-view="map"] #map-panel .map-viewport,
body[data-view="map"] #map {
  height: 100%;
  min-height: 0;
}

body[data-view="map"] #expeditions {
  min-width: 0;
  padding: 5px;
}

#expeditions .mission-card:has(#mission-brief[hidden]) {
  grid-template-areas: "art rail" "copy copy";
}

#expeditions #mission-live .mission-choices {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 4px;
  margin-top: 4px;
}

#expeditions #mission-live .mission-choices button {
  min-width: 0;
  padding: 4px 6px;
}

#expeditions #mission-live #mission-clock {
  margin-top: 2px;
}

#expeditions #mission-live #mission-situation {
  margin-top: 2px;
}

@media (max-height: 660px) {
  body[data-view="map"] #map-panel .map-controls {
    grid-template-columns: repeat(4, auto);
    bottom: 5px;
  }

  body[data-view="map"] #map-panel .map-controls button {
    width: 34px;
    min-width: 34px;
    min-height: 34px;
  }

  body[data-view="map"] #expeditions .sortie-heading {
    min-height: 28px;
  }

  body[data-view="map"] #expeditions .mission-banner {
    min-height: 88px;
  }

  body[data-view="map"] #expeditions #mission-live .mission-choices button {
    min-height: 34px;
    font-size: .72rem;
    line-height: 1.2;
  }

  body[data-view="map"] #expeditions #mission-situation,
  body[data-view="map"] #expeditions #mission-report {
    font-size: .72rem;
    line-height: 1.3;
  }

  body[data-view="map"] #expeditions #mission-report {
    margin-top: 3px;
    padding: 5px 6px;
  }

  body[data-view="map"] #expeditions #deploy {
    min-height: 36px;
  }
}

/* Keep the first-time map and naming controls in the same viewport. */
body[data-view="setup"] .site-bar {
  min-height: 42px;
}

body[data-view="setup"] .site-bar a {
  min-height: 42px;
}

body[data-view="setup"] .hero {
  min-height: 0;
  border-radius: 8px;
}

body[data-view="setup"] .hero-copy {
  padding: 9px 11px;
}

body[data-view="setup"] .hero h1 {
  max-width: none;
  font-size: clamp(1.2rem, 5.5vw, 2.2rem);
  line-height: 1.08;
}

body[data-view="setup"] .hero p {
  max-width: 52ch;
  margin-top: 4px;
  font-size: .78rem;
  line-height: 1.25;
}

body[data-view="setup"] #play {
  grid-template-columns: minmax(0, 1fr);
  gap: 6px;
  margin-top: 6px;
}

body[data-view="setup"] #play .panel {
  padding: 7px;
}

body[data-view="setup"] #play .panel h2 {
  font-size: 1rem;
}

body[data-view="setup"] #map-panel .map-key {
  margin: 4px 0;
  font-size: .65rem;
}

body[data-view="setup"] #map-panel .map-controls {
  flex-wrap: nowrap;
  margin-bottom: 4px;
}

body[data-view="setup"] #map-panel :is(.map-controls button, #center-map) {
  min-height: 33px;
}

body[data-view="setup"] #map-panel .map-controls button {
  width: 34px;
}

body[data-view="setup"] #map-panel .map-viewport {
  min-height: 0;
}

body[data-view="setup"] #map-panel #map {
  height: clamp(126px, 29dvh, 238px);
  grid-template-rows: repeat(5, minmax(0, 1fr));
}

body[data-view="setup"] #map-panel #map .plot {
  min-height: 0;
  aspect-ratio: auto;
  padding: 2px;
  line-height: 1.1;
}

body[data-view="setup"] #map-panel .map-detail {
  min-height: 0;
  margin-top: 3px;
  font-size: .7rem;
  line-height: 1.25;
}

body[data-view="setup"] #found-form {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 4px 6px;
  margin-top: 5px;
}

body[data-view="setup"] #found-form :is(label, input) {
  grid-column: 1 / -1;
}

body[data-view="setup"] #found-form label {
  font-size: .75rem;
}

body[data-view="setup"] #found-form :is(input, button) {
  min-height: 38px;
}

body[data-view="setup"] #found-form input {
  padding: 4px 8px;
  font-size: 1rem;
}

body[data-view="setup"] #found-form button {
  padding: 4px 5px;
  font-size: .75rem;
}

body[data-view="setup"] #found-feedback {
  margin-top: 3px;
  font-size: .7rem;
  line-height: 1.25;
}

@media (max-height: 600px) {
  body[data-view="setup"] #map-panel #map {
    height: clamp(110px, 25dvh, 158px);
  }
}


/* Every view shares one viewport between the HUD and the navigation. */
html {
  height: 100%;
  overflow: hidden;
  overscroll-behavior: none;
}
body {
  height: 100dvh;
  overflow: hidden;
  overscroll-behavior: none;
}
body[data-view="setup"] {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
}
body[data-view="setup"] main.frame {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  min-height: 0;
  overflow: clip;
}
body[data-view="setup"] #play {
  grid-template-rows: minmax(0, 1fr) auto;
  min-height: 0;
  margin-bottom: max(4px, env(safe-area-inset-bottom));
}
body[data-view="setup"] #map-panel {
  display: flex;
  flex-direction: column;
  min-height: 0;
}
body[data-view="setup"] #map-panel .map-viewport { flex: 1; }
body[data-view="setup"] #map-panel #map { height: 100%; }

body.in-game {
  --dock-height: calc(var(--game-nav-height) + var(--colony-xp-height) + env(safe-area-inset-bottom));
  padding-bottom: 0;
}
.in-game main.frame {
  position: relative;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  height: calc(100dvh - var(--dock-height));
  overflow: clip;
}
.in-game #hud { grid-row: 1; }
.in-game :is(#colony, #play, #crew, #research) {
  grid-row: 2;
  min-height: 0;
  min-width: 0;
  margin-top: 0;
}
.in-game .game-nav {
  height: var(--dock-height);
  min-height: 0;
  grid-template-rows: calc(var(--colony-xp-height) - 2px) minmax(0, 1fr);
}
.in-game .game-nav button { min-height: 0; }

.in-game #play.playing {
  display: grid;
  grid-template-rows: minmax(94px, 1fr) auto;
}
.in-game :is(#crew, #research) {
  align-self: start;
  gap: 8px;
  margin-top: 8px;
  padding: 10px;
}

.in-game[data-view="colony"] .scene {
  height: 100%;
  min-height: 0;
}
#toggle-objective {
  width: auto;
  max-width: none;
  border-radius: 4px;
}
.in-game #build-panel {
  position: absolute;
  z-index: 15;
  display: grid;
  grid-template-rows: none;
  gap: 5px;
  width: min(174px, calc(50% - 12px));
  min-height: 0;
  margin: 0;
  padding: 7px;
  border-color: #73cbd3;
  background: linear-gradient(155deg, #243741, #111b21 68%);
  box-shadow: 0 4px 16px #04090dcf;
}
.in-game #build-panel::before { content: none; }
#build-panel[data-side="left"]::after,
#build-panel[data-side="right"]::after {
  position: absolute;
  top: calc(var(--pointer-y, 20px) - 4px);
  width: 7px;
  height: 7px;
  border-color: #73cbd3;
  background: #152329;
  content: "";
  transform: rotate(45deg);
  pointer-events: none;
}
#build-panel[data-side="right"]::after {
  left: -5px;
  border-bottom: 1px solid #73cbd3;
  border-left: 1px solid #73cbd3;
}
#build-panel[data-side="left"]::after {
  right: -5px;
  border-top: 1px solid #73cbd3;
  border-right: 1px solid #73cbd3;
}
.build-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 28px;
  gap: 3px;
  align-items: start;
}
.in-game #build-panel #build-title {
  font-size: clamp(.88rem, 3.45vw, 1rem);
  line-height: 1.08;
  overflow-wrap: anywhere;
}
.build-level {
  margin-top: 3px;
  color: #a7f2f6;
  font-size: .75rem;
  line-height: 1.12;
  font-weight: 750;
}
.in-game .panel-close {
  justify-self: end;
  width: 28px;
  min-height: 28px;
  padding: 0;
  font-size: 1.07rem;
  line-height: 1;
  border-radius: 4px;
}
.in-game #build-panel :is(#build-detail, .build-status, .building-controls p) {
  font-size: .72rem;
  line-height: 1.3;
}
.build-status { color: #ffd69b; }
.in-game #build-panel #build {
  width: 100%;
  min-height: 36px;
  padding: 4px;
  font-size: .83rem;
}
.in-game #build-panel #build::before { content: none; }
.in-game #build-panel .build-selection { display: grid; gap: 4px; }
.in-game #build-panel .build-selection select {
  width: 100%;
  min-height: 29px;
  font-size: .76rem;
}
.building-controls {
  display: grid;
  gap: 4px;
  padding-top: 5px;
  border-top: 1px solid #4a666e;
}
.building-controls button {
  min-height: 35px;
  padding: 4px;
  font-size: .73rem;
}
.building-controls progress {
  height: 5px;
  margin: 0;
}


.refine-order, .refine-quantity { display: grid; gap: 4px; }
.refine-order label { color: #c7e4e6; font-size: .72rem; }
.refine-quantity { grid-template-columns: minmax(0, 1fr) auto; }
.refine-quantity input { width: 100%; min-width: 0; min-height: 35px; padding: 4px 6px; font-size: .84rem; }
#refine-info { color: #c7e4e6; }
#refine-clock { color: #a7f2f6; }

.in-game #objective {
  position: absolute;
  left: 8px;
  bottom: 48px;
  z-index: 16;
  width: min(245px, calc(100% - 16px));
  margin: 0;
  padding: 9px;
  background: #282419f5;
  box-shadow: 0 5px 18px #090806ca;
}
.in-game #objective header { flex-wrap: nowrap; }
.in-game #objective header .panel-close { margin: 0; align-self: start; }
#objective #objective-action { min-height: 36px; line-height: 1.2; }
#objective .objective-links { font-size: .71rem; }
.in-game #action-feedback {
  position: absolute;
  inset: auto 7px 7px auto;
  z-index: 18;
  max-width: 66%;
  margin: 0;
  padding: 4px 7px;
  border: 1px solid #5b7f79;
  border-radius: 4px;
  background: #102221f4;
  color: #d7ffed;
  font-size: .74rem;
  pointer-events: none;
}
.in-game #action-feedback[data-error="true"] {
  color: #ffe1ce;
  background: #3e231cf4;
  border-color: #a37261;
}

@media (max-height: 420px) {
  body[data-view="setup"] .hero-copy { padding: 4px 7px; }
  body[data-view="setup"] .hero p, body[data-view="setup"] #map-panel .map-key { display: none; }
  body[data-view="setup"] #loading p { display: block; }
  .in-game #crew .crew-member { padding-top: 4px; }
  .in-game #crew .portrait { height: 29px; flex-basis: 29px; }
}

.construction-overview {
  position: absolute;
  top: 5px;
  left: 6px;
  z-index: 13;
  max-width: calc(100% - 116px);
  display: grid;
  justify-items: start;
  gap: 3px;
}
.in-game #toggle-subscription {
  min-height: 36px;
  padding: 3px 9px;
  border: 1px solid #697b80;
  border-radius: 4px;
  background: #152025ee;
  font-size: .78rem;
  line-height: 1.12;
}
.in-game #toggle-subscription[data-active="true"] {
  color: #ffe29c;
  border-color: #b5934a;
}
.construction-overview #construction {
  display: grid;
  gap: 3px;
  padding: 4px 7px;
  margin: 0;
  color: #ffdd91;
  border: 1px solid #a88140;
  border-radius: 4px;
  background: #251d13ed;
  list-style: none;
  font-size: .72rem;
  line-height: 1.16;
}
.in-game #colony-training-queue {
  display: grid;
  gap: 2px;
  max-width: 100%;
  min-height: 36px;
  min-width: 0;
  padding: 4px 7px;
  color: #e7f2ef;
  border: 1px solid #619198;
  border-radius: 4px;
  background: #14292eee;
  font-size: .73rem;
  line-height: 1.15;
  text-align: left;
  overflow-wrap: anywhere;
}
#colony-training-progress { color: #b7dde1; font-variant-numeric: tabular-nums; }
@media (max-width: 359px) {
  .in-game #colony-training-queue { max-width: min(100%, 158px); }
  #colony-training-unit { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
}
.in-game #plot-page {
  right: 8px;
  left: auto;
  width: auto;
  max-width: none;
  padding-inline: 9px;
  border-radius: 4px;
}
.in-game .subscription-info {
  position: absolute;
  top: calc(var(--game-hud-height) + 38px);
  left: 7px;
  z-index: 16;
  width: min(270px, calc(100% - 14px));
  margin: 0;
  padding: 9px;
  gap: 6px;
  border-color: #a78a52;
  background: #272317fa;
  box-shadow: 0 5px 18px #090806ca;
  font-size: .82rem;
  line-height: 1.35;
}
.subscription-info header {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 6px;
}
.in-game .subscription-info h2 { font-size: .98rem; }
.in-game .subscription-info p { margin: 0; }
.build-effect {
  color: #abdee6;
  font-size: .72rem;
  line-height: 1.24;
}
.requirements {
  display: grid;
  gap: 2px;
  padding: 0;
  margin: 0;
  list-style: none;
  line-height: 1.22;
  color: #d1dedf;
}
.requirements [data-met="true"] { color: #a4dfb5; }
.in-game .requirements button {
  min-height: 29px;
  padding: 3px 6px;
  width: 100%;
  text-align: left;
  font: inherit;
  color: #b6edf0;
  background: #193139;
  border-color: #48717a;
}
#colony-experience {
  display: grid;
  gap: 3px;
  min-width: 0;
  padding: 4px 5px;
  border: 1px solid #53757a;
  border-radius: 4px;
  background: #162a33;
}
#colony-experience p { margin: 0; font-size: .71rem; line-height: 1.15; overflow-wrap: anywhere; }
#colony-experience-label { color: #c1edef; font-variant-numeric: tabular-nums; }
#colony-experience-rule { color: #ffdaa0; }
.in-game #build-panel .requirements { font-size: .71rem; }
.in-game #build-panel .requirements button { min-height: 25px; }
.in-game #research {
  max-width: 575px;
  width: calc(100% - 16px);
  justify-self: center;
}
.in-game #research .module {
  display: grid;
  gap: 7px;
  padding: 9px;
  margin: 0;
}
#research .module p { margin: 0; }
#research .requirements { font-size: .85rem; }
.research-current {
  margin: 0;
  padding: 6px 8px;
  color: #ffe29c;
  background: #302719;
  border: 1px solid #8b7044;
  border-radius: 4px;
  font-size: .82rem;
}
.module-art:is([data-module="laboratory"], [data-module="warehouse"], [data-module="drill"]) {
  background-image: url("colony-industry.webp");
  background-size: 300% 100%;
}
.module-art[data-module="laboratory"] { background-position: 0 50%; }
.module-art[data-module="warehouse"] { background-position: 50% 50%; }
.module-art[data-module="drill"] { background-position: 100% 50%; }

/* Artwork overlaps in perspective; separate its size from the touch area. */
.in-game[data-view="colony"] .tile { pointer-events: none; }
.in-game[data-view="colony"] .tile::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: max(58%, 44px);
  height: max(58%, 44px);
  transform: translate(-50%, -50%);
  pointer-events: auto;
}

.in-game #play.world-open { display: block; }
.in-game #world-view {
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  height: 100%;
  min-height: 0;
  isolation: isolate;
  background: #20292d;
}
#world-stage { position: relative; min-height: 0; min-width: 0; overflow: hidden; }
#world-viewport {
  position: absolute;
  inset: 0;
  height: auto;
  touch-action: none;
  user-select: none;
  overscroll-behavior: contain;
  overflow: hidden;
  cursor: grab;
  background: #32393b url("colony-sector.webp") center / cover;
}
#world-viewport:active { cursor: grabbing; }
#world-viewport:focus-visible { outline: 2px solid #89d8e0; outline-offset: -3px; }
#world-terrain, #world-route, #world-markers { position: absolute; inset: 0; pointer-events: none; }
#world-terrain { background: url("colony-sector.webp") repeat; }
#world-terrain::after {
  position: absolute;
  inset: 0;
  content: "";
  background: linear-gradient(180deg, #0b141662, transparent 23%, transparent 78%, #0b141682);
  box-shadow: inset 0 0 40px #080c1073;
}
#world-route { z-index: 1; }
#world-markers { z-index: 2; }
.in-game .world-marker {
  position: absolute;
  display: grid;
  grid-template-rows: 1fr auto;
  place-items: center;
  width: clamp(44px, calc(var(--world-cell) * .99), 126px);
  height: clamp(44px, calc(var(--world-cell) * .86), 103px);
  min-height: 0;
  margin: 0;
  padding: 0;
  transform: translate(-50%, -55%);
  color: #f2f0df;
  border: 0;
  background: transparent;
  box-shadow: none;
  pointer-events: auto;
  cursor: pointer;
}
.in-game .world-marker:hover:not(:disabled) { background: transparent; }
.in-game .world-marker:focus-visible { outline: 2px solid #c5f6fe; outline-offset: 0; }
.world-marker-art {
  position: absolute;
  inset: -3% 0 0;
  pointer-events: none;
  background: url("colony-structures.webp") 100% 50% / 300% 300% no-repeat;
  filter: drop-shadow(0 3px 2px #091012) drop-shadow(0 0 7px #18242e);
}
.world-marker[data-marker="own"] .world-marker-art {
  background-position: 0 0;
  filter: drop-shadow(0 4px 3px #080c0f) drop-shadow(0 0 6px #56daf0b8);
}
.world-marker[data-marker="deposit"] .world-marker-art {
  inset: 19% 19% 6%;
  background: url("colony-console-icons.webp") 66.667% 100% / 400% 200% no-repeat;
  filter: drop-shadow(0 0 7px #05cdecb8) drop-shadow(0 3px 2px #041323);
}
.world-marker[data-marker="deposit"][data-status="signal"] .world-marker-art {
  opacity: .87;
  scale: .83;
}
.world-marker[data-marker="deposit"][data-status="depleted"] .world-marker-art { opacity: .52; filter: grayscale(.65); }
.world-marker-caption {
  position: absolute;
  top: 1px;
  max-width: min(142px, 38vw);
  min-width: 0;
  padding: 2px 5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: inherit;
  font-size: .72rem;
  font-weight: 750;
  line-height: 1.2;
  background: #141b21ec;
  border: 1px solid #849497;
  border-radius: 4px;
  box-shadow: 0 2px 6px #030808a6;
  pointer-events: none;
}
.world-marker:is([data-marker="own"], [data-marker="base"]) .world-marker-caption { display: flex; }
.world-marker-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.world-marker-level { flex: none; white-space: pre; }
.world-marker[data-marker="base"] .world-marker-caption { top: auto; bottom: -2px; }
.world-marker:is([data-marker="own"], [data-marker="deposit"]) .world-marker-caption { color: #cbf8ff; border-color: #59b9c8; }
.world-marker[aria-pressed="true"] { z-index: 2; }
.world-marker[aria-pressed="true"]::after {
  position: absolute;
  inset: 39% 7% 6%;
  content: "";
  border: 1px dashed #ffd781;
  border-radius: 50%;
  filter: drop-shadow(0 0 4px #fab34d);
  pointer-events: none;
}
.world-marker[aria-pressed="true"] .world-marker-caption { color: #fff1bb; border-color: #ebaf5a; background: #211b12ed; }
.world-marker[data-allied="true"] .world-marker-art {
  filter: drop-shadow(0 3px 2px #091012) drop-shadow(0 0 6px #4aaeff);
}
.world-marker[data-allied="true"]::after {
  position: absolute;
  inset: 39% 7% 6%;
  content: "";
  border: 1px solid #6ec0ff;
  border-radius: 50%;
  box-shadow: 0 0 9px #409eff96, inset 0 0 7px #409eff66;
  pointer-events: none;
}
.world-marker[data-allied="true"][aria-pressed="true"]::after {
  border-width: 2px;
  filter: drop-shadow(0 0 3px #53aaff);
}
.world-marker[data-allied="true"]::before {
  content: attr(data-alliance-tag);
  position: absolute;
  top: 0;
  z-index: 1;
  padding: 2px 5px;
  color: #e2f5ff;
  font: 750 .69rem/1.15 system-ui, sans-serif;
  border: 1px solid #6ec0ff;
  border-radius: 4px;
  background: #11284aee;
  pointer-events: none;
}
.world-marker[data-allied="true"] .world-marker-caption {
  color: #e2f5ff;
  border-color: #6ec0ff;
  background: #11284af2;
}
.world-marker[data-marker="cluster"] .world-marker-art {
  inset: 10%;
  border: 1px solid #80dce9;
  background: #142e36e8;
  box-shadow: 0 0 12px #53c7d080;
  border-radius: 100%;
}
.in-game .world-marker[data-marker="cluster"] { width: 46px; height: 46px; }
.world-marker[data-marker="cluster"] .world-marker-caption {
  top: 50%;
  left: 50%;
  translate: -50% -50%;
  color: #c9f6ff;
  padding: 0;
  background: transparent;
  border: 0;
  box-shadow: none;
  font-size: .93rem;
}
.world-trail, .world-rover { position: absolute; pointer-events: none; }
.world-trail { border-top: 2px dashed #72e9f0; filter: drop-shadow(0 0 4px #042e40); transform-origin: 0 0; }
.world-rover {
  width: clamp(26px, calc(var(--world-cell) * .47), 57px);
  aspect-ratio: 1.6;
  background: url("colony-rover.webp") center 52% / 207% auto no-repeat;
  translate: -50% -58%;
  filter: drop-shadow(0 2px 3px #030812);
}
.world-rover[data-returning="true"] { scale: -1 1; }
.world-tools {
  position: absolute;
  top: 7px;
  left: 6px;
  right: 6px;
  z-index: 3;
  display: flex;
  gap: 4px;
  pointer-events: none;
}
.in-game .world-tools button, .in-game #world-back {
  min-height: 36px;
  max-width: 51%;
  margin: 0;
  padding: 4px 7px;
  color: #e9f1ef;
  border: 1px solid #617c83;
  border-radius: 4px;
  background: #151f24ee;
  font-size: .75rem;
  line-height: 1.08;
  pointer-events: auto;
}
#world-campaign { margin-left: auto; }
#world-activity[data-fresh="true"] { color: #ffe3a1; border-color: #cc9e49; }
#world-touch {
  position: absolute;
  bottom: 6px;
  left: 7px;
  z-index: 3;
  margin: 0;
  padding: 3px 6px;
  color: #edede1;
  background: #13191bcf;
  border-radius: 4px;
  font-size: .71rem;
  line-height: 1.12;
  pointer-events: none;
}
.in-game .world-card {
  position: relative;
  display: grid;
  gap: 5px;
  padding: 7px 8px;
  margin: 0;
  background: linear-gradient(165deg, #26343c, #141c23 62%);
  border: 1px solid #677b81;
  border-top-color: #daa353;
  border-radius: 6px 6px 0 0;
  box-shadow: inset 0 1px 0 #fff4cf32, 0 -4px 16px #080f1375;
  color: #eaf4f4;
  line-height: 1.25;
}
.world-card header {
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr) 28px;
  align-items: center;
  gap: 5px;
}
.world-card header .hud-icon { width: 22px; height: 22px; }
.in-game .world-card h2 {
  margin: 0;
  color: #f5eedc;
  font-size: clamp(1rem, 4vw, 1.2rem);
  line-height: 1.12;
  overflow-wrap: anywhere;
}
.in-game .world-card p { margin: 0; font-size: .77rem; }
#world-detail { color: #cfdee0; }
#world-alliance {
  padding: 4px 7px;
  color: #d0ebff;
  border: 1px solid #528db8;
  border-radius: 4px;
  background: #152a46;
}
#world-quote {
  background: #122028;
  border: 1px solid #45636d;
  border-radius: 4px;
  padding: 4px 5px;
  color: #e5f7fa;
  font-weight: 700;
}
#world-clock, #world-notice { color: #f8d391; }
#world-report { color: #bcf0cb; }
#world-crew { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 4px; }
.world-person {
  position: relative;
  display: flex;
  flex-direction: row;
  align-items: end;
  height: clamp(51px, 9.8svh, 76px);
  gap: 3px;
  padding: 4px;
  border: 1px solid #b69562;
  border-radius: 4px;
  background: #263238;
  isolation: isolate;
  overflow: hidden;
}
.world-person::before {
  position: absolute;
  inset: 0;
  z-index: -1;
  content: "";
  background: linear-gradient(0deg, #0a0e13f5 4%, #0b101400 82%);
}
.world-person[data-person="ada"] { background-image: url("colony-field-team.webp"); background-size: cover; background-position: 50% 31%; }
.world-person[data-person="nina"] { background-position: left center; }
.world-person[data-person="marek"] { background-position: center center; }
.world-person[data-person="jan"] { background-position: right center; }
.world-person:has(input:not(:checked)) { border-color: #5c747e; filter: saturate(.45); }
.world-person input { width: 13px; height: 13px; margin: 0 0 1px; flex: none; accent-color: #e5aa49; }
.world-person strong, .world-person small { display: block; }
.world-person strong { color: #fff0d0; font-size: .79rem; }
.world-person small { color: #e0e6e1; font-size: .65rem; line-height: 1.03; }
.in-game #world-dispatch { min-height: 40px; padding: 4px 8px; border-radius: 4px; }
.in-game #world-dispatch::before { content: none; }
.in-game :is(#world-cancel, #world-refinery, #world-player-social) { min-height: 36px; padding: 4px 8px; font-size: .83rem; }
.in-game #world-back { position: absolute; top: 6px; left: 6px; z-index: 14; }
.in-game #map-panel:has(#world-back:not([hidden])) .panel-head { padding-left: 128px; }
.in-game #map-panel:has(#world-back:not([hidden])) .map-controls { display: none; }

@media (max-height: 580px) {
  .in-game .world-card { padding: 5px 6px; gap: 4px; }
  .world-tools { top: 5px; }
  .in-game .world-marker-caption { font-size: .67rem; }
}


/* Crew manifest and research station */
.in-game #crew.crew-console,
.in-game #research.research-console {
  --console-border: #638087;
  --console-metal: #1c272c;
  --console-orange: #efb351;
  --console-blue: #9de8ec;
  display: grid;
  grid-auto-rows: max-content;
  align-content: start;
  justify-self: center;
  align-self: stretch;
  width: calc(100% - 12px);
  max-width: 690px;
  min-width: 0;
  margin: 5px 0 3px;
  padding: clamp(6px, 1.2dvh, 12px);
  gap: clamp(5px, 1.15dvh, 11px);
  overflow: hidden;
  border: 1px solid #4e6669;
  border-top-color: #b09158;
  border-radius: 6px;
  background: linear-gradient(180deg, #151d21ec, #172426b8 44%, #111a20e8),
    url("colony-yard.webp") center / cover no-repeat;
  box-shadow: inset 0 1px 0 #89a8a344, 0 6px 16px #0007;
}
.console-header {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  min-height: 31px;
  padding-bottom: 5px;
  border-bottom: 1px solid #8a72564d;
}
.console-header .hud-icon { width: 24px; height: 24px; }
.in-game .console-header h2 {
  margin: 0;
  color: #faedd3;
  font-size: clamp(1.12rem, 4.4vw, 1.65rem);
  line-height: 1;
}
.in-game .console-header p {
  margin: 0;
  padding: 4px 5px;
  color: #dce9de;
  background: #1a292be8;
  border: 1px solid var(--console-border);
  border-radius: 3px;
  font-size: .71rem;
  font-weight: 750;
  white-space: nowrap;
}
.in-game #crew.crew-console {
  grid-template-rows: auto minmax(0, 1fr);
  align-content: stretch;
}
.crew-stats { display: flex; gap: 3px; justify-content: end; flex-wrap: wrap; }
.in-game .crew-stats p { padding-inline: 4px; font-size: .68rem; }
.in-game #crew-puzzles { color: #d0ebf3; border-color: #6a9eae; }
.crew-scroll {
  display: grid;
  grid-auto-rows: max-content;
  align-content: start;
  gap: 7px;
  min-height: 0;
  overflow: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
}
#crew-roster {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 4px 6px;
}
.in-game .crew-group {
  grid-column: 1 / -1;
  margin: 2px 0 0;
  color: #c5d6d6;
  font-size: .71rem;
  font-weight: 700;
}
.in-game .crew-tile {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: minmax(0, 1fr) auto;
  place-items: stretch;
  place-content: stretch;
  overflow: hidden;
  height: clamp(58px, 13.1dvh, 111px);
  min-width: 0;
  min-height: 0;
  padding: 0;
  color: #e3ebdf;
  background: #182830;
  border: 1px solid #68848c;
  border-radius: 4px;
  box-shadow: 0 2px 5px #0209097f;
}
.in-game .crew-tile:is(:hover,:focus-visible) { border-color: #baeaf0; }
.in-game .crew-tile[aria-pressed="true"] {
  color: #ffedbe;
  background: #352a17;
  border-color: var(--console-orange);
  box-shadow: inset 0 0 0 1px #fbbd6b47, 0 2px 7px #03070b;
}
.crew-portrait,
#world-crew .world-person[data-person] {
  min-width: 0;
  background-color: #202c31;
  background-image: var(--person-image, none);
  background-size: var(--person-size, cover);
  background-position: var(--person-position, center);
  background-repeat: no-repeat;
}
[data-person="ada"] {
  --person-image: url("colony-field-team.webp");
  --person-position: 50% 29%;
}
:is([data-person="nina"], [data-person="marek"], [data-person="jan"]) {
  --person-image: url("world-crew.webp");
  --person-size: 300% auto;
}
[data-person="nina"] { --person-position: 0% 31%; }
[data-person="marek"] { --person-position: 50% 31%; }
[data-person="jan"] { --person-position: 100% 31%; }
:is([data-person="zofia"], [data-person="lena"], [data-person="olek"], [data-person="roza"]) {
  --person-image: url("crew-specialists.webp");
  --person-size: 200% auto;
}
[data-person="zofia"] { --person-position: 0% 11%; }
[data-person="lena"] { --person-position: 100% 11%; }
[data-person="olek"] { --person-position: 0% 82%; }
[data-person="roza"] { --person-position: 100% 82%; }
.crew-tile[data-status="locked"] .crew-portrait { filter: saturate(.4) brightness(.72); }
[data-person="iza"], [data-person="tomasz"], [data-person="viktor"] {
  --person-image: url("crew-elites.webp");
  --person-size: 300% auto;
}
[data-person="iza"] { --person-position: 0% center; }
[data-person="tomasz"] { --person-position: 50% center; }
[data-person="viktor"] { --person-position: 100% center; }
:is([data-person="mira"], [data-person="bruno"], [data-person="sara"], [data-person="oskar"]) {
  --person-image: url("crew-expedition.webp");
  --person-size: 400% auto;
}
[data-person="mira"] { --person-position: 0% center; }
[data-person="bruno"] { --person-position: 33.333% center; }
[data-person="sara"] { --person-position: 66.667% center; }
[data-person="oskar"] { --person-position: 100% center; }
.in-game .crew-tile[data-elite="true"] { border-color: #ac8b59; }
.crew-elite-tag {
  position: absolute;
  top: 2px;
  right: 2px;
  padding: 2px 4px;
  border-radius: 3px;
  background: #493824f0;
  color: #ffdda3;
  font-size: .56rem;
  line-height: 1;
}
.crew-tile[data-status="available_to_buy"] .crew-tile-name::before { background: #f4c87f; }
.crew-tile[data-status="away"] .crew-portrait { filter: saturate(.64); }
.crew-tile-name {
  position: relative;
  display: block;
  padding: 2px 2px 2px 8px;
  overflow: hidden;
  color: inherit;
  border-top: 1px solid #d1ecd03b;
  font-size: .72rem;
  line-height: 1.18;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.crew-tile-name::before {
  position: absolute;
  top: 50%;
  left: 4px;
  width: 4px;
  height: 4px;
  transform: translateY(-50%);
  content: "";
  border-radius: 50%;
  background: #a8b7c0;
}
.crew-tile[data-status="available"] .crew-tile-name::before { background: #91dca4; }
.crew-tile:is([data-status="away"], [data-status="available_to_recruit"]) .crew-tile-name::before { background: #fbd17e; }
.in-game .crew-card, .in-game #research .research-card {
  display: grid;
  gap: 6px;
  min-width: 0;
  margin: 0;
  padding: 8px;
  color: #ebf2ec;
  background: linear-gradient(153deg, #2a3d41, #151e25 62%);
  border: 1px solid var(--console-border);
  border-top-color: #ad976b;
  border-radius: 5px;
  box-shadow: inset 0 1px 0 #f6d58e26, 0 3px 8px #03090a85;
}
.crew-profile, .research-profile {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  min-width: 0;
}
.crew-profile .crew-portrait {
  height: clamp(56px, 11.5dvh, 100px);
  aspect-ratio: 1;
  border: 1px solid #8b9692;
  border-radius: 4px;
}
.crew-identity, .research-identity {
  display: grid;
  min-width: 0;
  gap: 3px;
}
.in-game :is(.crew-card, .research-card) :is(h3,p) {
  margin: 0;
}
.in-game :is(.crew-card, .research-card) h3 {
  color: #fff0c9;
  font-size: clamp(1rem, 4vw, 1.28rem);
  line-height: 1.15;
  overflow-wrap: anywhere;
}
.in-game :is(.crew-card, .research-card) p {
  color: #dce9e7;
  font-size: clamp(.75rem, 2.6vw, .87rem);
  line-height: 1.26;
}
.in-game #crew-role, .in-game #research-cost { color: var(--console-blue); }
.in-game .console-state {
  justify-self: start;
  padding: 2px 5px;
  color: #e1ddc9;
  background: #171f26;
  border: 1px solid #70868b;
  border-radius: 3px;
  font-size: .65rem;
  line-height: 1.2;
}
.in-game [data-status="available"] .console-state,
.in-game .console-state[data-status="done"] {
  color: #c6f8d6;
  border-color: #70a98b;
}
.in-game [data-status="away"] .console-state,
.in-game [data-status="available_to_recruit"] .console-state,
.in-game .console-state[data-status="active"],
.in-game .console-state[data-status="ready"] {
  color: #ffe7a8;
  border-color: #b99b5d;
}
.in-game #crew-requirements { font-size: .73rem; }
.in-game :is(#crew-recruit, #research-start, #crew-guard-service button) {
  width: 100%;
  min-height: 34px;
  margin: 0;
  padding: 4px 8px;
}
.crew-profile-status { display: flex; flex-wrap: wrap; gap: 3px; }
.in-game #crew-level { color: #aee7ef; }
.in-game #crew-ability { color: #efd7af; }
.crew-progression {
  display: grid;
  gap: 4px;
  padding: 5px;
  border: 1px solid #4c7076;
  border-radius: 4px;
  background: #172a31;
}
.in-game #crew-bonus { color: #baead5; }
.in-game #crew-next-bonus { color: #c4e5eb; }
.in-game #crew-upgrade-reason { color: #efc995; }
.in-game :is(#crew-upgrade, #crew-shop) {
  width: 100%;
  min-height: 36px;
  margin: 0;
  padding: 4px 8px;
}
#crew-guard-service {
  display: grid;
  gap: 5px;
  padding-top: 4px;
  border-top: 1px solid #6a838862;
}
.in-game #crew-guard-service p { font-size: .71rem; }
.research-controls {
  display: grid;
  gap: 5px;
}
.research-controls progress {
  width: 100%;
  height: 5px;
  margin: 0;
  border: 0;
  border-radius: 2px;
  accent-color: var(--console-blue);
}
.research-profile {
  grid-template-columns: minmax(0, 1fr) minmax(60px, 29%);
  gap: 6px;
}
.research-module-art {
  display: block;
  width: 100%;
  max-height: 104px;
  aspect-ratio: 1;
  filter: drop-shadow(0 0 9px #48b7cf58);
}
.in-game .research-card .requirements :is(button,span) { font-size: clamp(.7rem, 2.6vw, .87rem); }
.in-game .research-card .requirements [data-met="true"] span { padding-inline: 3px; }
.in-game #research.research-console {
  grid-template-rows: auto auto auto minmax(0, 1fr) auto;
  align-content: stretch;
}
.research-header { grid-row: 1; gap: 6px; }
.research-heading { display: grid; justify-items: start; min-width: 0; gap: 3px; }
.in-game #research-laboratory {
  min-width: 0;
  min-height: 29px;
  padding: 2px 5px;
  border: 1px solid #68848a;
  border-radius: 3px;
  background: #15272e;
  color: #aee5ea;
  font-size: .71rem;
  text-align: left;
}
.in-game #research .research-stats { flex-direction: column; align-items: end; }
.in-game #research .research-stats p { font-size: .67rem; padding: 3px 4px; }
.research-controls { grid-row: 2; }
#research-tracks, #research-stages { display: grid; gap: 3px; }
#research-tracks { grid-template-columns: repeat(auto-fit, minmax(57px, 1fr)); }
#research-stages { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.in-game #research :is(#research-tracks, #research-stages) button {
  min-width: 0;
  min-height: 38px;
  padding: 3px 4px;
  border: 1px solid #596f75;
  border-radius: 4px;
  background: #172731;
  color: #e0e9e8;
  font-size: clamp(.67rem, 2.55vw, .79rem);
  font-weight: 700;
  line-height: 1.08;
  overflow-wrap: anywhere;
}
.in-game #research #research-stages button {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 4px;
  min-height: 34px;
  font-variant-numeric: tabular-nums;
}
#research-stages [data-status="locked"] span:last-child { color: #aab8b9; }
#research-stages [data-status="active"] span:last-child { color: #ffce79; }
#research-stages [data-status="done"] span:last-child { color: #9de0ac; }
#research-stages [data-status="ready"] span:last-child { color: #91dce7; }
.in-game #research :is(#research-tracks, #research-stages) button[aria-pressed="true"] {
  border-color: #d5af6b;
  background: #393326;
  color: #fff0c1;
}
.in-game #research-current {
  grid-row: 3;
  min-height: 33px;
  padding: 4px 7px;
  text-align: left;
  font-size: .73rem;
}
.research-scroll {
  grid-row: 4;
  min-height: 0;
  overflow: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
}
.in-game #research-start { grid-row: 5; }
.research-detail-block {
  display: grid;
  min-width: 0;
  gap: 4px;
}
.research-detail-block h4 { margin: 0; color: #f3ddb1; font-size: .76rem; }
#research-unlock-list {
  display: flex;
  flex-wrap: wrap;
  gap: 3px;
  padding: 0;
  margin: 0;
  list-style: none;
}
#research-unlock-list li {
  padding: 3px 5px;
  border: 1px solid #537c79;
  border-radius: 3px;
  background: #1b3438;
  color: #bcf1dc;
  font-size: .73rem;
  overflow-wrap: anywhere;
}
#research-conditions { padding-top: 4px; border-top: 1px solid #5c747866; }
.in-game #research .research-card .requirements button { min-height: 32px; }
#barracks-research { padding-top: 4px; border-top: 1px solid #4c6870; }
#barracks-research-list { font-size: .74rem; }
.in-game #barracks-research-list button { min-height: 34px; }
#open-research { min-height: 30px; padding: 2px 5px; font-size: .76rem; }
@media (max-height: 600px) {
  .in-game #crew.crew-console, .in-game #research.research-console { gap: 5px; padding: 6px; }
  .in-game #crew.crew-console .crew-card, .in-game #research.research-console .research-card { padding: 6px; gap: 4px; }
  .in-game .crew-tile { height: 60px; }
  .in-game .research-card .requirements button { min-height: 24px; }
}

#world-crew .world-person {
  min-width: 0;
  height: clamp(53px, 10dvh, 87px);
}
#world-crew .world-person[data-team-slot="lead"] { display: grid; align-content: end; }
#world-crew .world-person[data-status="locked"] { filter: saturate(.56); }
#world-crew .world-person[data-team-slot^="support"] { padding: 0; }
#world-crew .world-person strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#world-crew .world-person small { line-height: 1.13; }
#world-crew select {
  position: relative;
  width: 100%;
  min-width: 0;
  min-height: 26px;
  margin: 0;
  padding: 2px 3px;
  color: #f8e6bd;
  background: #111c21ed;
  border: 0;
  border-top: 1px solid #a68b53;
  border-radius: 0;
  font-size: clamp(.65rem, 2.5vw, .8rem);
  line-height: 1.1;
  text-overflow: ellipsis;
}
#world-crew select:focus-visible { outline: 2px solid #ebbd6c; outline-offset: -2px; }

.world-marker[data-site-kind="research"] .world-marker-art {
  background-position: 100% 0;
  filter: drop-shadow(0 0 4px #95e7f585);
}
.world-marker[data-site-kind="rescue"] .world-marker-art {
  background-position: 66.667% 0;
  filter: drop-shadow(0 0 4px #d6a561a6);
}


/* Atlas thumbnails occupy the whole portrait row in roster buttons. */
.crew-tile .crew-portrait {
  display: block;
  justify-self: stretch;
  align-self: stretch;
  width: 100%;
  height: 100%;
}
.in-game #crew-requirements [data-met="false"] { color: #f4cf9b; }
.in-game :is(.crew-card, .research-card) .console-state { font-size: .68rem; }

.world-map-meta {
  position: absolute;
  z-index: 3;
  top: 47px;
  left: 6px;
  right: 6px;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 5px;
  pointer-events: none;
}
.world-level-group {
  display: grid;
  gap: 3px;
  min-width: 94px;
  padding: 4px 6px;
  pointer-events: none;
}
.world-level-group, #world-filter {
  color: #f2e7c9;
  background: #18252bee;
  border: 1px solid #7c8b7c;
  border-radius: 4px;
  font-size: .71rem;
  line-height: 1.05;
}
#world-level { color: #edcf8f; font-weight: 800; }
#world-map-xp { width: 100%; height: 4px; margin: 0; accent-color: #e9b349; }
#world-filter {
  max-width: 46%;
  min-height: 30px;
  margin: 0 0 0 auto;
  padding: 3px 4px;
  pointer-events: auto;
  cursor: pointer;
}
.world-marker[data-marker="deposit"]:is([data-site-kind="mine"], [data-site-kind="creature"]) .world-marker-art {
  inset: 15% 2% 3%;
  background-image: url("world-targets.webp");
  background-size: 200% 100%;
  background-repeat: no-repeat;
}
.world-marker[data-marker="deposit"][data-site-kind="mine"] .world-marker-art {
  background-position: 0% 100%;
  filter: drop-shadow(0 0 6px #e4b35fa8) drop-shadow(0 3px 2px #161012);
}
.world-marker[data-marker="deposit"][data-site-kind="creature"] .world-marker-art {
  background-position: 100% 100%;
  filter: drop-shadow(0 0 7px #e56e538c) drop-shadow(0 3px 2px #161012);
}
.world-marker[data-site-kind="mine"] .world-marker-caption { color: #ffdf9d; border-color: #c19749; }
.world-marker[data-site-kind="creature"] .world-marker-caption { color: #fbc6b6; border-color: #c77b66; }
.world-marker[data-locked="true"] .world-marker-art { opacity: .63; }
.world-marker[data-locked="true"] .world-marker-caption { border-style: dashed; }
@media (max-height: 580px) {
  .world-map-meta { top: 43px; }
}

.in-game #store {
  display: grid;
  grid-row: 2;
  align-content: start;
  min-height: 0;
  min-width: 0;
  padding: 9px;
  margin: 5px 6px;
  gap: 8px;
  background: linear-gradient(180deg, #101b21f0, #14232bd9 56%, #0a141a9c), url("colony-station.webp") center / cover;
  border: 1px solid #688187;
  border-top-color: #d5a764;
  border-radius: 6px;
}
.shop-head, .shop-title-row {
  display: flex;
  align-items: center;
  min-width: 0;
  justify-content: space-between;
  gap: 6px;
}
.shop-head { border-bottom: 1px solid #9d825257; padding-bottom: 5px; }
.shop-head h2 { flex: 1; margin: 0; color: #f4ead4; }
.shop-head .hud-icon { width: 20px; height: 20px; }
.shop-wallet {
  display: flex;
  gap: 4px;
  align-items: center;
  margin: 0;
  padding: 3px 6px;
  background: #19282fe6;
  border: 1px solid #638489;
  border-radius: 4px;
  color: #c9f6fb;
  font-size: .84rem;
}
#shop-offers { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 5px; }
.in-game #shop-offers button {
  display: grid;
  grid-template-columns: 23px minmax(0, 1fr);
  align-items: center;
  min-height: 60px;
  gap: 5px;
  padding: 5px;
  text-align: left;
  color: #f2efe3;
  background: linear-gradient(145deg, #26373f, #18232a);
  border: 1px solid #637984;
  border-radius: 4px;
  line-height: 1.17;
}
#shop-offers .hud-icon { width: 22px; height: 22px; }
#shop-offers strong { display: block; font-size: .78rem; }
#shop-offers small { display: block; margin-top: 4px; color: #b2d8dd; font-size: .71rem; }
.in-game #shop-offers button[aria-pressed="true"] { border-color: #e5ac57; background: linear-gradient(145deg, #4d3a26, #292921); }
#shop-panel {
  display: grid;
  gap: 7px;
  padding: 8px;
  background: linear-gradient(#20323bea, #14212ae8);
  border: 1px solid #65888e;
  border-top-color: #b69360;
  border-radius: 5px;
  color: #edf5f4;
}
.in-game #store:has(#shop-exchange:not([hidden])) { grid-template-rows: auto auto minmax(0, 1fr); }
#shop-exchange {
  min-height: 0;
  overflow: auto;
  align-content: start;
  overscroll-behavior: contain;
  scrollbar-width: thin;
}
.shop-portrait {
  display: block;
  width: 23px;
  height: 33px;
  border-radius: 3px;
  border: 1px solid #a78c5f;
}
#shop-character {
  display: grid;
  grid-template-columns: 43px minmax(0, 1fr);
  align-items: start;
  gap: 6px;
}
#shop-character-portrait {
  width: 43px;
  aspect-ratio: 1;
  border: 1px solid #9f8252;
  border-radius: 4px;
}
#shop-character-level { color: #ffda98; }
#shop-character-ability { color: #cee5e8; }
#shop-panel h3, #shop-panel p { margin: 0; }
#shop-panel h3 { font-size: .96rem; color: #f7e7c6; }
#shop-panel p { font-size: .8rem; line-height: 1.25; }
#shop-price { color: #b0ebf1; text-align: right; }
#shop-reason { color: #efce9e; }
#shop-job-row { display: grid; gap: 3px; font-size: .76rem; }
#shop-jobs {
  width: 100%;
  min-height: 34px;
  padding: 3px 5px;
  background: #17272d;
  border: 1px solid #709095;
  border-radius: 4px;
  color: #f3e9d4;
  font: inherit;
}
#shop-confirm-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px; }
.in-game #shop-panel button { min-height: 38px; padding: 4px 7px; border-radius: 4px; font-size: .78rem; }
.in-game #shop-panel .primary::before { content: none; }
.in-game .game-nav { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.in-game .game-nav button { min-width: 0; padding-inline: 2px; }
.in-game .game-nav #colony-level {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  margin: 0;
  padding: 0 7px;
  border: 1px solid #58777d;
  border-radius: 3px;
  box-shadow: none;
  background: #14242a;
  color: #def1f2;
  font-size: .68rem;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.in-game .game-nav #colony-level span { font-size: inherit; color: inherit; }
#colony-level .colony-level-track {
  position: relative;
  height: 5px;
  overflow: hidden;
  background: #071318;
  border-radius: 3px;
  box-shadow: inset 0 0 0 1px #325961;
}
#colony-level .colony-level-fill {
  position: absolute;
  inset: 0 auto 0 0;
  width: var(--colony-level-progress, 0%);
  border-radius: inherit;
  background: linear-gradient(90deg, #29899c, #9ce7f3);
}
.in-game .game-nav #colony-level[data-maximum="true"] {
  border-color: #a98a52;
  color: #ffe4ad;
}
#colony-level[data-maximum="true"] .colony-level-fill {
  background: linear-gradient(90deg, #b5833b, #ffdd91);
}
body[data-rover-paint="polar"] :is(.world-rover, #route-rover) {
  filter: hue-rotate(141deg) saturate(1.3) drop-shadow(0 1px 4px #19c6e482);
}
@media (max-width: 370px) {
  #shop-offers strong { font-size: .74rem; }
  #shop-offers small { font-size: .68rem; }
}

.shop-modes { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 5px; }
.in-game .shop-modes button {
  min-width: 0;
  min-height: 35px;
  padding: 4px 7px;
  color: #d5e4e8;
  border: 1px solid #627b84;
  border-radius: 4px;
  background: #192930ec;
  font-size: .81rem;
}
.in-game .shop-modes button[aria-pressed="true"] { color: #ffe9bb; border-color: #dcb075; background: #48351fe8; }
#shop-exchange, #checkout-panel { display: grid; gap: 7px; }
#checkout-panel p { margin: 0; }
.checkout-mode {
  justify-self: start;
  padding: 3px 6px;
  border: 1px solid #97733c;
  border-radius: 4px;
  color: #fee2a9;
  background: #2b211ceb;
  font-size: .77rem;
}
#checkout-packs { display: grid; gap: 5px; }
.in-game .checkout-pack {
  display: grid;
  grid-template-columns: 31px minmax(0, 1fr) auto;
  align-items: center;
  gap: 7px;
  min-height: 55px;
  padding: 5px 8px;
  color: #def8fb;
  background: linear-gradient(115deg, #2b4852ee, #19262cef);
  border: 1px solid #61858f;
  border-radius: 5px;
  text-align: left;
}
.in-game .checkout-pack:hover:not(:disabled) { border-color: #95c8d1; background: #29434d; }
.in-game .checkout-pack .hud-icon { width: 28px; height: 28px; }
.in-game .checkout-pack strong { font-size: .88rem; }
.in-game .checkout-pack span { color: #ffe3a5; font-size: .94rem; font-weight: 750; white-space: nowrap; }
#checkout-status, #checkout-disabled {
  padding: 6px 8px;
  background: #1b2d34;
  border: 1px solid #587682;
  border-radius: 4px;
  color: #e5f4f6;
  font-size: .81rem;
  line-height: 1.25;
}
#checkout-status[data-kind="success"] { border-color: #588d71; color: #c4f3d2; }
#checkout-status[data-kind="error"] { border-color: #ab7d52; color: #ffdfb6; }
.in-game #checkout-retry { min-height: 36px; padding: 4px 7px; }
#shop-categories { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 3px; }
@media (min-width: 570px) {
  #shop-categories { grid-template-columns: repeat(6, minmax(0, 1fr)); }
}
.in-game #shop-categories button {
  min-width: 0;
  min-height: 29px;
  padding: 3px 1px;
  font-size: .71rem;
  background: #1d3038;
  border: 1px solid #627c86;
  border-radius: 4px;
}
.in-game #shop-categories button[aria-pressed="true"] { color: #ffe5af; background: #423421; border-color: #d6a25a; }
#shop-receipt {
  padding: 5px 7px;
  background: #182e2be8;
  border: 1px solid #5a907e;
  border-radius: 5px;
  color: #d8f6e8;
  font-size: .74rem;
  line-height: 1.25;
}
#shop-receipt p { margin: 2px 0 0; }
#shop-receipt-expedition { color: #c1f2fd; }
@media (max-height: 610px) {
  .in-game #store { gap: 5px; padding: 6px; margin-block: 3px; }
  #shop-exchange { gap: 5px; }
  #checkout-panel { gap: 3px; }
  #checkout-packs { gap: 3px; }
  #checkout-panel .checkout-mode { padding-block: 2px; }
  #checkout-status, #checkout-disabled { padding-block: 4px; }
  .in-game .checkout-pack { min-height: 44px; }
  .in-game #shop-offers button { min-height: 48px; }
  #shop-panel { gap: 5px; padding: 6px; }
}
.in-game :is(#shop-receipt-close, #shop-receipt-crew) { min-height: 32px; margin-top: 5px; padding: 3px 7px; font-size: .73rem; }
.in-game .hud .inventory .hud-water {
  grid-column: 1;
  grid-row: 1 / 3;
  align-self: center;
  justify-self: center;
  width: 61%;
  height: auto;
  border-radius: 14% 70% 68% 69%;
  background: linear-gradient(135deg, #a2eeff, #2a97cc 72%);
  box-shadow: 0 0 5px #42bdf47a;
  transform: rotate(45deg);
}
.in-game .hud .inventory #water { color: #b2f1ff; }
@media (max-width: 355px) {
  .in-game .hud .inventory > div {
    grid-template-columns: 13px minmax(0, 1fr);
    column-gap: 2px;
    padding-inline: 2px;
  }
  .in-game .hud .inventory > div:has(#crystals) { flex-grow: 1.15; }
}
#world-report-details { display: grid; gap: 4px; }
#world-report-details p { margin: 0; }
#world-report-history { display: grid; grid-template-columns: auto minmax(0,1fr); align-items: center; gap: 6px; color: #d8e7e8; font-size: .72rem; }
#world-report-select { min-width: 0; min-height: 32px; padding: 2px 4px; width: 100%; color: #def2f4; background: #17313c; border: 1px solid #6e98a0; border-radius: 4px; font: inherit; }
#world-report-crew, #world-report-timing { color: #c4d9dd; }
#world-report-loot {
  display: flex;
  flex-wrap: wrap;
  gap: 3px;
  padding: 0;
  margin: 0;
  list-style: none;
}
#world-report-loot li {
  padding: 2px 5px;
  color: #ddf8e5;
  background: #1c3634;
  border: 1px solid #467468;
  border-radius: 4px;
  font-size: .72rem;
}
#world-report-encounters, #world-report-observation { color: #ffe9bb; }
#mission-report-summary { display:block; }
#mission-report-details { display:block; margin-top:3px; color:#c6dce2; }
.shop-modes { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.in-game .shop-modes button { padding-inline:3px; font-size:.75rem; line-height:1.12; }
#monthly-panel { display:grid; gap:6px; }
#monthly-panel p { margin:0; }
.monthly-card {
  display:grid; gap:8px; padding:8px;
  background:linear-gradient(135deg,#293c43,#17262eea);
  border:1px solid #698d94; border-top-color:#d5a95f; border-radius:5px;
}
.monthly-card header { display:flex; align-items:center; justify-content:space-between; gap:4px; }
.monthly-card h3 { margin:0; color:#ffefd2; font-size:.96rem; }
#monthly-price { color:#ffe0a0; font-size:.86rem; white-space:nowrap; }
.monthly-card ul { margin:0; padding-left:1.1rem; color:#e4eeee; font-size:.83rem; }
.monthly-card p { color:#c9e7ea; font-size:.8rem; }
#monthly-rewards { display:grid; gap:4px; }
.monthly-card .monthly-cadence { color:#f6e3b7; font-size:.78rem; font-weight:700; }
.monthly-supply {
  display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:4px; margin:0;
}
.monthly-supply > div {
  min-width:0; padding:4px 2px; text-align:center;
  border:1px solid #597880; border-radius:4px; background:#162b34;
}
.monthly-supply dt {
  display:flex; align-items:center; justify-content:center; gap:3px; color:#d3e5e7;
  font-size:.72rem; white-space:nowrap;
}
.monthly-supply dt .hud-icon { width:12px; height:12px; flex:0 0 12px; }
.monthly-supply dd {
  margin:1px 0 0; color:#fff0cc; font-size:.9rem; font-weight:750; font-variant-numeric:tabular-nums;
}
#monthly-titanium-reserve { color:#bed3d6; font-size:.71rem; }
.monthly-card button, #subscription-shop { min-height:34px; padding:3px 7px; font-size:.8rem; }
#monthly-stop-options { display:grid; grid-template-columns: minmax(0,1fr) auto; gap:5px; }
#monthly-result[data-kind=success] { color:#b9eccb; }
#monthly-result[data-kind=error] { color:#ffd8b4; }


/* Settings beside the resource bar and account access before founding a base. */
body[data-view="setup"] .site-bar { gap: 7px; }
#setup-account { min-height: 34px; padding: 3px 8px; }

#hud-settings {
  min-width: 0;
  padding: 0;
  border-color: var(--game-edge);
  border-radius: 3px;
  background: var(--game-metal);
  box-shadow: inset 0 2px #c3c8c28c, inset 0 -2px #090c0f, 0 2px 3px #000c;
  color: #fff0d2;
  font: 600 1.6rem/1 system-ui, sans-serif;
}
#hud-settings:hover:not(:disabled) { color: #ffd789; background: #303b3e; }
#hud-settings:focus-visible { outline-offset: -4px; }

#account-dialog {
  width: min(360px, 100% - 24px);
  max-height: calc(100dvh - 24px);
  padding: 14px;
  margin: auto;
  overflow: auto;
  border: 1px solid #849a9d;
  border-radius: 8px;
  background: linear-gradient(150deg, #26383f, #141e24 70%);
  color: #f7f4ed;
  box-shadow: inset 0 1px #d0e3ed62, 0 8px 30px #03080be0;
}
#account-dialog::backdrop { background: #050a0ed4; }
#account-dialog header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}
#account-dialog h2 { margin-inline-end: auto; font-size: 1.06rem; }
#account-dialog :is(#close-account, #settings-back) { min-width: 36px; min-height: 36px; padding: 0; font-size: 1.2rem; }
#settings-panel { display: grid; gap: 10px; }
.settings-settlement {
  padding: 9px 11px;
  border: 1px solid #546b6e;
  border-radius: 5px;
  background: #101b20;
}
#base-name { color: #fff0d2; overflow-wrap: anywhere; }
.settings-details { display: flex; flex-wrap: wrap; align-items: center; gap: 5px 9px; margin-top: 5px; }
#settings-panel #settings-account { width: 100%; }
.research-stats { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 3px 5px; }
#research-points { font-variant-numeric: tabular-nums; }
#account-modes { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin-bottom: 10px; }
#account-modes button[aria-pressed="true"] { border-color: #e7bd75; color: #ffdea9; }
#account-form, #account-profile { display: grid; gap: 5px; }
#account-form label { font-size: .8rem; font-weight: 720; }
#account-form input {
  min-width: 0;
  width: 100%;
  height: 38px;
  padding: 5px 9px;
  background: #101b20;
  border: 1px solid #7f9295;
  border-radius: 5px;
  color: #fff;
  font: inherit;
  font-size: 16px;
}
#account-email { margin-bottom: 4px; }
#account-dialog p { font-size: .8rem; line-height: 1.35; overflow-wrap: anywhere; }
#account-password-hint, #account-claim { color: #c8d9db; }
#account-dialog #account-submit, #account-dialog #account-logout { min-height: 39px; margin-top: 6px; }
#account-status { margin-top: 7px; color: #ffcebd; }
#account-status:empty { margin: 0; }
@media (max-width: 355px) {
  body[data-view="setup"] .site-bar a { font-size: .72rem; }
}


#account-dialog :is(form, #account-password-group, #account-verify-password-group) { display: grid; gap: 5px; }
#account-dialog form label { font-size: .8rem; font-weight: 720; }
#account-dialog form input {
  min-width: 0;
  width: 100%;
  height: 38px;
  padding: 5px 9px;
  background: #101b20;
  border: 1px solid #7f9295;
  border-radius: 5px;
  color: #fff;
  font: inherit;
  font-size: 16px;
}
#account-links {
  display: flex;
  gap: 3px 9px;
  flex-wrap: wrap;
}
#account-links button {
  min-height: 36px;
  padding: 0 4px;
  background: none;
  border-color: transparent;
  color: #c7edf1;
  font-size: .77rem;
  text-decoration: underline;
  text-underline-offset: .16em;
}
#account-mail-note { margin-block: 6px; color: #f0d4a6; }
#account-email-status { color: #c8d9db; }
#account-status[data-error="false"] { color: #caf0df; }



/* Barracks training appears over the selected building without expanding its card. */
#open-barracks { width:100%; min-height:30px; padding:2px 5px; font-size:.76rem; }
#barracks-dialog {
  width:min(390px, calc(100% - 22px)); max-height:calc(100dvh - 26px); margin:auto; padding:10px;
  overflow:auto; border:1px solid #78929a; border-top-color:#cfa75f; border-radius:7px;
  background:linear-gradient(155deg,#293c43,#121b22 66%); color:#edf5f5;
  box-shadow:inset 0 1px #edf6ef50,0 10px 38px #05090dc2;
}
#barracks-dialog[open] { display:grid; gap:7px; }
#barracks-dialog::backdrop { background:#061016cd; }
.barracks-head { display:grid; grid-template-columns:24px minmax(0,1fr) 32px; align-items:center; gap:6px; }
.barracks-head .hud-icon { width:24px; height:24px; }
.barracks-head h2 { margin:0; color:#fff0d1; font-size:1.03rem; }
#close-barracks { min-width:31px; min-height:32px; font-size:1.07rem; padding:0; }
.barracks-roster, .barracks-detail { display:grid; gap:4px; }
.barracks-roster button {
  display:grid; grid-template-columns:20px minmax(0,1fr) auto; align-items:center; gap:7px;
  min-height:33px; padding:3px 6px; text-align:left; border-color:#5e747b; color:#e9f3f4; background:#182b32;
}
.barracks-roster button[aria-pressed="true"] { border-color:#e3b264; color:#ffe8b5; background:#3c3629; }
.barracks-roster strong { font-size:.82rem; }
.barracks-roster small { font-size:.74rem; white-space:nowrap; font-variant-numeric:tabular-nums; }
.barracks-roster .hud-icon { width:19px; height:19px; }
.barracks-detail { padding:6px; border:1px solid #4c6870; border-radius:4px; background:#101e26; }
#barracks-dialog p { margin:0; font-size:.75rem; line-height:1.25; }
#barracks-capacity, #barracks-readiness { color:#b9d9dc; }
#barracks-cost, #barracks-queue, #barracks-reason { color:#f4d29c; }
#barracks-train { min-height:37px; }
#barracks-feedback { color:#94e6be; }
#barracks-feedback[data-error="true"] { color:#ffbd9c; }
#barracks-feedback:empty { display:none; }



#world-squad {
  display:grid; gap:3px; padding:4px 5px; border:1px solid #6d7974; border-radius:4px; background:#122830;
}
.squad-slots, .formation { display:grid; gap:3px; }
.formation-row { display:grid; grid-template-columns:minmax(0,1fr) 3.1rem; gap:4px; }
.formation-row select {
  width:100%; min-width:0; min-height:27px; padding:0 4px;
  font:inherit; font-size:.78rem; color:#fff0c9; background:#152027; border:1px solid #718486; border-radius:3px;
}
.in-game .world-card #world-squad-label { color:#ffe1a5; font-weight:750; font-size:.76rem; }
.in-game .world-card #world-squad-tactics { color:#c1d6d7; font-size:.68rem; }
#world-report-battle {
  display:grid; gap:3px; padding:4px 5px; border:1px solid #5f7783; border-radius:4px; background:#14242c;
}
#world-report-tactics { color:#e5e7d5; }
#world-report-injured { color:#f4d7a8; }
#world-context[data-outcome="retreat"] #world-report { color:#ffd2ac; }
@media (max-height:600px) {
  .in-game #world-context[data-kind="hunt"] #world-crew .world-person { height:47px; }
}



/* The clinic uses the same terrain and touch hitbox as the other buildings. */
.module-art[data-module="hospital"] {
  background-image:url("lunar-hospital.webp"); background-size:contain; background-position:center;
}
#hospital-controls {
  display:grid; gap:3px; padding:4px 5px; border:1px solid #5d8587; border-radius:4px; background:#122832;
}
.in-game #build-panel #hospital-summary { color:#c7f1e9; font-weight:750; }
#hospital-patients, #world-report-care { display:grid; gap:3px; margin:0; padding:0; list-style:none; }
#hospital-patients li, #world-report-care li {
  display:flex; justify-content:space-between; align-items:baseline; flex-wrap:wrap; gap:1px 5px;
  color:#ddecdf; font-size:.7rem; line-height:1.24;
}
.hospital-patient-time, .report-care-time { color:#f5d7a7; font-variant-numeric:tabular-nums; white-space:nowrap; }
#hospital-empty { color:#aec9cb; }
#world-report-care { padding-top:3px; border-top:1px solid #597682; }
#world-report-care [data-care-mode="hospital"] { color:#b8f6d9; }


/* Ranked unit selection and training controls in Koszary. */
#barracks-dialog { width: min(430px, calc(100% - 16px)); }
#barracks-dialog[open] { gap: 6px; }
#barracks-dialog .barracks-roster {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 4px;
}
#barracks-dialog .barracks-roster button {
  grid-template: auto auto / 19px minmax(0, 1fr);
  gap: 0 5px;
  align-content: center;
  min-height: 46px;
  line-height: 1.05;
  padding: 4px 5px;
  border-radius: 4px;
}
#barracks-dialog .barracks-roster .hud-icon { grid-row: 1 / 3; }
#barracks-dialog .barracks-roster strong { overflow-wrap: anywhere; font-size: .75rem; }
#barracks-dialog .barracks-roster small { grid-column: 2; margin-top: 2px; color: #c2d9db; font-size: .66rem; }
#barracks-tiers {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 3px;
}
#barracks-tiers button {
  display: grid;
  place-content: center;
  gap: 2px;
  min-width: 0;
  min-height: 40px;
  padding: 2px;
  border: 1px solid #607784;
  border-radius: 4px;
  background: #182b32;
  color: #f7e8c9;
  font-size: .76rem;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}
#barracks-tiers small { color: #c2dcde; font-size: .66rem; }
#barracks-tiers button[data-locked="true"] { border-style: dashed; color: #a9bfc3; }
#barracks-tiers button[aria-pressed="true"] { border-color: #e3b264; background: #3c3629; color: #ffe8b5; }
#barracks-dialog :is(.barracks-roster button, #barracks-tiers button):focus-visible { outline-offset: -3px; }
#barracks-dialog h3 { color: #fbefd8; font-size: .84rem; }
#barracks-dialog .barracks-detail { gap: 3px; }
#barracks-dialog #barracks-description { color: #cfdee0; }
#barracks-dialog .barracks-queue {
  display: grid;
  gap: 2px;
  padding: 5px 6px;
  border-left: 2px solid #cfa75f;
  background: #101d24;
}
#barracks-batch { color: #b9d9dc; font-variant-numeric: tabular-nums; }
.barracks-count {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(46px, auto);
  align-items: center;
  gap: 4px;
  min-width: 0;
  color: #c9dfe0;
  font-size: .72rem;
}
#barracks-train-count {
  width: 100%;
  min-width: 0;
  min-height: 34px;
  padding: 2px 4px;
  border: 1px solid #658089;
  border-radius: 4px;
  background: #12212a;
  color: #eef5f5;
  font: inherit;
  font-size: .83rem;
}
.barracks-actions { display: grid; grid-template-columns: minmax(0, 1fr); gap: 4px; }
.barracks-actions:has(#barracks-promotion:not([hidden])) { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.barracks-operation {
  display: grid;
  grid-template-rows: auto auto auto minmax(0, 1fr) auto;
  gap: 3px;
  min-width: 0;
  padding: 5px;
  border: 1px solid #526f78;
  border-radius: 4px;
  background: #172830;
}
#barracks-dialog .barracks-operation :is(button, p) { min-width: 0; overflow-wrap: anywhere; }
#barracks-dialog .barracks-operation button { grid-row: 5; min-height: 40px; padding: 3px; font-size: .72rem; }
#barracks-dialog :is(#barracks-cost, #barracks-promotion-cost) { color: #f4d29c; }
#barracks-dialog :is(#barracks-train-reason, #barracks-promotion-reason) { color: #f6bea0; font-size: .68rem; }
@media (max-width: 355px) {
  #barracks-dialog { padding: 7px; }
  #barracks-dialog .barracks-roster button { min-height: 43px; }
}

/* Map communications console */
#social-dialog {
  width:min(470px, calc(100% - 14px)); height:min(640px, calc(100dvh - 16px)); max-width:none; max-height:none;
  padding:0; border:1px solid #6c8b92; border-radius:8px; color:#e5edf0;
  background:radial-gradient(ellipse at 100% 0, #24383d, #112129 48%, #0e1a21);
  box-shadow:0 16px 45px #05080bca, 0 0 0 3px #30454a70;
}
#social-dialog[open] { display:flex; flex-direction:column; }
#social-dialog::backdrop { background:#070b10c9; }
.social-head {
  display:flex; gap:8px; align-items:center; justify-content:space-between;
  padding:8px 10px; background:#192a32b9; border-bottom:1px solid #42616c;
}
.social-head h2 { margin:0; color:#ffde9a; font-size:1.07rem; letter-spacing:.025em; }
#social-sign { margin:2px 0 0; color:#adc8ce; font-size:.76rem; overflow-wrap:anywhere; }
#social-dialog button, #social-dialog select, #social-dialog input { margin:0; min-width:0; }
#social-dialog .panel-close { width:36px; height:36px; flex:none; }
.social-tabs { display:flex; flex-wrap:wrap; gap:3px; padding:6px; border-bottom:1px solid #3e5961; }
#social-dialog .social-tabs button { flex:1 1 auto; min-height:35px; padding:4px 5px; font-size:.73rem; }
#social-dialog .social-tabs [aria-pressed="true"] { background:#325059; border-color:#f5c77c; color:#ffdfa2; }
.social-scroll {
  flex:1 1 auto; min-height:0; overflow:auto; overscroll-behavior:contain; scrollbar-width:thin;
  padding:8px 9px; display:flex; flex-direction:column; gap:7px;
}
.social-scroll > *, .social-head, .social-tabs, #social-feedback, .social-chat-form { flex-shrink:0; }
.social-scroll :is(h3, p), #social-feedback { margin:0; overflow-wrap:anywhere; }
.social-scroll h3 { color:#ffdfa2; font-size:1rem; }
.social-scroll p, #social-feedback { color:#c5d6da; font-size:.82rem; }
#social-feedback { background:#1d393a; padding:5px 9px; }
#social-feedback[data-error="true"] { color:#ffd6b9; background:#4b3228; }
.social-row, .social-form, .social-duel-builder {
  display:grid; gap:5px; padding:7px; border:1px solid #48646d; border-radius:5px; background:#14272f;
}
.social-row strong { color:#ebf5f5; overflow-wrap:anywhere; }
.social-row-form, .social-chat-form { display:grid; grid-template-columns:minmax(0,1fr) auto; gap:5px; }
.social-chat-form { padding:7px; border-top:1px solid #42616c; background:#14272f; }
.social-actions { display:flex; flex-wrap:wrap; gap:4px; }
#social-dialog :is(button, input, select) { font-size:.81rem; }
#social-dialog :is(input, select) { padding:5px 7px; color:#eef5f5; background:#0c1b22; }
#social-dialog .social-actions button { min-height:34px; padding:4px 7px; }
.social-messages, .social-duels { display:grid; gap:5px; }
.social-message {
  display:grid; grid-template-columns:minmax(0,1fr) auto; align-items:start; gap:4px;
  padding:6px 7px; border-radius:4px; background:#1b3139;
}
.social-message strong { color:#a9d8df; font-size:.83rem; overflow-wrap:anywhere; }
.social-message time { font-size:.69rem; color:#b1c5c9; }
.social-message p { grid-column:1; white-space:pre-wrap; color:#f2f0df; }
#social-dialog .social-report { min-height:26px; align-self:end; padding:2px 5px; font-size:.69rem; }
#social-dialog .social-duel-builder select { min-height:34px; }
@media (max-width:359px) {
  #social-dialog .social-tabs button { font-size:.69rem; padding-inline:3px; }
  .in-game .world-tools button { padding-inline:5px; font-size:.70rem; }
}


.alliance-banner, .alliance-board {
  display: grid;
  gap: 7px;
  padding: 9px;
  border: 1px solid #4e6b80;
  border-radius: 6px;
  background: #122431;
}
.alliance-banner {
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  background: linear-gradient(120deg, #1e3e61, #132d44 58%, #132432);
  border-color: #5785ae;
}
.alliance-tag {
  display: grid;
  min-height: 41px;
  place-items: center;
  padding: 3px 8px;
  color: #d6eeff;
  font-weight: 760;
  background: #142b46;
  border: 1px solid #669acc;
  border-radius: 5px;
}
.alliance-identity { display: grid; gap: 2px; }
.alliance-resources, .alliance-funding {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
}
.alliance-balance {
  display: grid;
  grid-template-columns: 19px minmax(0, 1fr);
  align-items: center;
  gap: 1px 5px;
  padding: 5px 6px;
  color: #cae1eb;
  font-size: .78rem;
  border: 1px solid #3c6278;
  border-radius: 4px;
  background: #152c3c;
}
.alliance-balance .hud-icon { grid-row: span 2; width: 19px; height: 19px; }
.alliance-balance strong {
  color: #faefcf;
  font-size: .94rem;
  font-variant-numeric: tabular-nums;
  overflow-wrap: anywhere;
}
.social-scroll .alliance-today { color: #e5f5ff; font-weight: 700; }
.social-scroll .alliance-note { color: #bcd1de; font-size: .74rem; }
.alliance-donation { display: grid; grid-template-columns: 1fr .75fr auto; align-items: stretch; gap: 4px; }
#social-dialog .alliance-donation > *, #social-dialog .alliance-project > button { min-height: 38px; }
#social-dialog .alliance-donation > button { padding-inline: 7px; }
.alliance-project {
  display: grid;
  gap: 6px;
  min-width: 0;
  padding: 7px;
  background: #192f3d;
  border: 1px solid #486879;
  border-radius: 5px;
}
.alliance-project[data-status="active"] { border-color: #62a5d9; }
.alliance-project[data-status="done"] { border-color: #52867c; }
.alliance-project-head {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: baseline;
  gap: 3px 5px;
}
.alliance-project-head h4 {
  margin: 0;
  color: #f1f5f5;
  font-size: .88rem;
  overflow-wrap: anywhere;
}
.alliance-research-status, .alliance-bonuses li {
  padding: 2px 5px;
  color: #d8e9f3;
  font-size: .7rem;
  font-weight: 700;
  background: #243e51;
  border: 1px solid #507084;
  border-radius: 4px;
}
[data-status="ready"] .alliance-research-status { color: #ffe1a6; background: #453722; border-color: #9b7745; }
[data-status="active"] .alliance-research-status { color: #d5ecff; background: #1d4569; border-color: #598fc0; }
[data-status="done"] .alliance-research-status, .alliance-bonuses li {
  color: #c8f4df;
  background: #21443d;
  border-color: #578b81;
}
.alliance-bonuses { display: flex; flex-wrap: wrap; gap: 4px; margin: 0; padding: 0; list-style: none; }
.alliance-fund {
  display: grid;
  gap: 3px;
  color: #dcecf1;
  font-size: .76rem;
  font-variant-numeric: tabular-nums;
}
.alliance-fund progress {
  width: 100%;
  height: 6px;
  accent-color: #63b6ea;
}
.alliance-time { color: #ceebff; font-size: .82rem; font-weight: 700; font-variant-numeric: tabular-nums; }
@media (max-width:359px) {
  .alliance-donation { grid-template-columns: 1fr .75fr; }
  .alliance-donation > button { grid-column: 1 / -1; }
}

/* Raid controls stay in the map toolbar and use a scrollable in-game briefing. */
.barracks-entry:has(button:not([hidden])) { display:grid; grid-template-columns:repeat(auto-fit,minmax(0,1fr)); gap:3px; }
.barracks-entry:not(:has(button:not([hidden]))) { display:none; }
#open-defense { min-width:0; min-height:30px; padding:2px 5px; font-size:.76rem; }
.in-game .world-tools #world-raids {
  position:relative;
  padding-inline:6px;
  color:#ffdea1;
  border-color:#9a724b;
}
.in-game .world-tools #world-raids[data-threat="true"] { border-color:#e5a175; color:#ffe5cb; background:#482820f5; }
#world-raid-alert {
  display:inline-block;
  min-width:1.15em;
  margin-inline-start:3px;
  padding:1px 2px;
  border-radius:3px;
  color:#25150f;
  background:#f4b786;
  font-weight:800;
  line-height:1;
}
.in-game #world-raid-target { min-height:36px; padding:4px 8px; color:#ffe0ad; border-color:#a07350; font-size:.83rem; }
@media (max-width:359px) {
  .in-game .world-tools button { min-width:0; padding-inline:4px; }
  .in-game .world-tools #world-raids { padding-inline:4px; }
}

#raids-dialog {
  width:min(460px, calc(100% - 14px));
  min-width:0;
  max-height:calc(100dvh - 16px);
  margin:auto;
  padding:0;
  overflow:hidden;
  color:#e8eef0;
  border:1px solid #78868a;
  border-top-color:#c48b59;
  border-radius:8px;
  background:linear-gradient(145deg,#26363b,#101c23 66%);
  box-shadow:0 16px 45px #05080bd4,0 0 0 3px #30454a70;
}
#raids-dialog[open] { display:flex; flex-direction:column; }
#raids-dialog::backdrop { background:#070b10c9; }
#raids-dialog h2, #raids-dialog h3, #raids-dialog h4, #raids-dialog p { margin:0; overflow-wrap:anywhere; }
#raids-dialog h2 { color:#ffdfa6; font-size:1.06rem; }
#raids-dialog h3 { color:#f4dfbd; font-size:.94rem; }
#raids-dialog h4 { color:#f2dfb9; font-size:.79rem; }
#raids-dialog p, #raids-dialog li { color:#cee0e5; font-size:.81rem; line-height:1.3; }
.raid-head {
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:6px;
  padding:6px 9px;
  border-bottom:1px solid #59696c;
  background:#192a32cd;
}
#close-raids { flex:none; width:36px; height:36px; padding:0; }
.raid-tabs { display:flex; gap:3px; padding:5px 6px; border-bottom:1px solid #496065; }
.raid-tabs button { flex:1 1 0; min-width:0; min-height:37px; padding:3px; font-size:.74rem; line-height:1.09; }
.raid-tabs button[aria-pressed="true"] { border-color:#d7aa6c; background:#3d3528; color:#ffe7bb; }
.raid-head, .raid-tabs, #raid-feedback { flex-shrink:0; }
.raid-scroll { flex:1 1 auto; min-height:0; overflow:auto; overscroll-behavior:contain; padding:8px; scrollbar-width:thin; }
.raid-scroll > section, #raid-active section, .raid-list, .raid-report-content { display:grid; gap:6px; }
#raid-active { gap:10px; }
#raid-feedback { padding:5px 8px; background:#203735; }
#raids-dialog #raid-feedback[data-error="true"] { background:#4b3028; color:#ffe0c7; }
#raids-dialog .raid-capacity { color:#f9d796; font-weight:700; font-variant-numeric:tabular-nums; }
#raids-dialog .raid-reason { color:#f7c2a1; }
.raid-formation select { min-height:37px; }
#raid-attack button, #raid-defense button { min-height:40px; font-size:.81rem; }
.raid-row, .raid-report {
  min-width:0;
  display:grid;
  gap:5px;
  padding:7px;
  border:1px solid #506970;
  border-radius:5px;
  background:#172b33;
}
.raid-row[data-direction="incoming"] { border-inline-start:3px solid #d2936a; }
.raid-row strong, .raid-report strong { color:#f3eee2; font-size:.87rem; overflow-wrap:anywhere; }
.raid-row time, .raid-report time { color:#e9c994; font-size:.76rem; font-variant-numeric:tabular-nums; }
.raid-report summary { cursor:pointer; padding:4px 1px; color:#f6ddb0; }
.raid-report summary strong { margin-inline-end:4px; }
.raid-report-content { padding-top:6px; }
.raid-report-content section {
  display:grid;
  gap:3px;
  padding:5px 6px;
  border:1px solid #4a656d;
  border-radius:4px;
  background:#11232b;
}
.raid-report-content ul { display:grid; gap:3px; list-style:none; margin:0; padding:0; }
#raids-dialog .raid-report[data-outcome="victory"] .raid-result { color:#b7ecd1; }
#raids-dialog .raid-report[data-outcome="defeat"] .raid-result { color:#ffc2a5; }
#raids-dialog .raid-report[data-outcome="draw"] .raid-result { color:#f3dfad; }
