:root {
  font-family: "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  color: #224b41;
  background: #edf1dd;
  font-synthesis: none;
  --ink: #224b41;
  --muted: #708375;
  --cream: #fff9e8;
  --green: #237b62;
  --gold: #efb74d;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  background:
    radial-gradient(ellipse at 15% 0, #dbedcf, transparent 52%), #eff2e1;
}
button {
  font: inherit;
  cursor: pointer;
  border: 0;
  border-radius: 9px;
  color: inherit;
  background: #e9edda;
  transition:
    background 0.15s,
    transform 0.15s;
}
button:hover:not(:disabled) {
  filter: brightness(1.04);
  transform: translateY(-1px);
}
button:active:not(:disabled) {
  transform: translateY(1px);
}
button:disabled {
  cursor: default;
  opacity: 0.47;
}
button:focus-visible {
  outline: 3px solid #e8ab3b;
  outline-offset: 3px;
}
[hidden] {
  display: none !important;
}
.page {
  max-width: 1512px;
  margin: auto;
  padding: 0 30px;
}
.masthead {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 86px;
  border-bottom: 1px solid #2d64411c;
}
.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 23px;
  font-weight: 850;
  letter-spacing: 1px;
}
.brand small {
  display: block;
  font-size: 9px;
  letter-spacing: 2px;
  color: #829376;
  margin-top: 4px;
}
.brand-icon {
  display: grid;
  place-items: center;
  background: #24614e;
  color: #f9de91;
  width: 48px;
  height: 48px;
  border-radius: 16px;
  font-size: 42px;
  line-height: 1;
}
.header-tools {
  display: flex;
  align-items: center;
  gap: 8px;
}
.header-tools button {
  font-size: 12px;
  padding: 8px 10px;
  background: #ffffff80;
}
.header-tools > span {
  font-size: 11px;
  color: var(--muted);
  margin-right: 8px;
}
.title-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 23px 0 21px;
}
.eyebrow {
  font-size: 10px;
  letter-spacing: 1.5px;
  color: #859274;
  margin: 0 0 8px;
  font-weight: 600;
}
h1 {
  font-size: clamp(23px, 2.2vw, 33px);
  letter-spacing: -1px;
  margin: 0;
  font-weight: 850;
}
h1 em {
  font-style: normal;
  color: #368868;
}
.chapter-pill {
  background: #e1e8cc;
  padding: 10px 16px;
  border-radius: 30px;
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
}
.game-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 20px;
  align-items: start;
}
.island-panel {
  border-radius: 22px;
  background: #fffbed;
  box-shadow: 0 9px 30px #37523012;
  overflow: hidden;
  border: 1px solid #dce3c9;
}
.resource-bar {
  display: flex;
  background: #285d50;
  color: #fff1c9;
  padding: 13px 20px;
  gap: 20px;
  min-height: 65px;
}
.resource {
  display: flex;
  align-items: center;
  gap: 9px;
  flex: 1;
}
.resource svg {
  width: 28px;
  height: 28px;
  flex-shrink: 0;
  filter: drop-shadow(0 2px 1px #0003);
}
.resource b {
  font-size: 19px;
  line-height: 1;
  display: block;
  color: #fff8d7;
  font-variant-numeric: tabular-nums;
}
.resource small {
  font-size: 9px;
  white-space: nowrap;
  display: block;
  color: #b3cbb5;
  margin-top: 5px;
}
.resource .ammo-icon {
  font-size: 26px;
  color: #ffcc65;
}
.world {
  position: relative;
  aspect-ratio: 3/2;
  overflow: hidden;
  background: #3baead;
  isolation: isolate;
}
.world canvas {
  width: 100%;
  height: 100%;
  display: block;
}
.world-top {
  position: absolute;
  left: 20px;
  right: 20px;
  top: 15px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  pointer-events: none;
}
.map-label {
  font-size: 15px;
  color: #fff7cf;
  font-weight: 800;
  text-shadow: 0 2px 2px #164f57;
}
.map-label small {
  display: block;
  font-size: 8px;
  letter-spacing: 1.5px;
  margin-top: 4px;
}
.health {
  background: #224f43db;
  border: 1px solid #8da77b;
  color: #ffe3a1;
  border-radius: 30px;
  padding: 8px 13px;
  font-size: 12px;
  font-weight: 750;
  box-shadow: 0 3px 0 #16433744;
}
.world-controls {
  position: absolute;
  top: 59px;
  right: 20px;
  display: flex;
  gap: 5px;
  z-index: 3;
}
.world-controls button {
  background: #fff3ceeb;
  box-shadow: 0 2px 0 #45654644;
  font-size: 11px;
  padding: 6px 10px;
}
.world-bottom {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 22px 19px 13px;
  background: linear-gradient(transparent, #1c6464bb);
  color: #efffe0;
  display: flex;
  justify-content: space-between;
  gap: 15px;
  font-size: 11px;
  pointer-events: none;
  text-shadow: 0 1px 2px #255047;
}
.map-targets,
.pad-targets,
.wall-targets {
  position: absolute;
  inset: 0;
  pointer-events: none;
}
.facility-target {
  position: absolute;
  transform: translate(-50%, -50%);
  font-size: 9px;
  font-weight: 650;
  white-space: nowrap;
  background: #fff4d8e8;
  border: 1px solid #79864766;
  box-shadow: 0 2px 0 #5c713730;
  border-radius: 12px;
  padding: 3px 7px;
  pointer-events: auto;
}
.facility-target:hover:not(:disabled) {
  transform: translate(-50%, -55%);
}
.wall-target {
  position: absolute;
  transform: translate(-50%, -50%);
  font-size: 9px;
  font-weight: 750;
  white-space: nowrap;
  background: #faf1cde8;
  border: 1px solid #87754c88;
  border-radius: 14px;
  padding: 3px 6px;
  pointer-events: auto;
  box-shadow: 0 2px 2px #265c4433;
}
.wall-target span {
  color: #768060;
}
.wall-target:hover:not(:disabled) {
  transform: translate(-50%, -50%);
  background: #fff4ba;
}
.wall-target.active {
  background: #ffdb88;
  border-color: #bb8e3e;
}
.wall-target.critical {
  background: #ffcfab;
  color: #a44b2b;
  border-color: #b66f49;
}
.pad-target {
  position: absolute;
  width: 8%;
  height: 12%;
  transform: translate(-50%, -80%);
  border-radius: 45%;
  background: transparent;
  pointer-events: auto;
}
.pad-target:hover:not(:disabled) {
  transform: translate(-50%, -80%);
  background: #fff5ab22;
}
.pad-target:focus-visible {
  outline-offset: -6px;
}
.pad-target.selected {
  box-shadow: inset 0 0 0 2px #fff6b833;
}
.world-overlay {
  position: absolute;
  inset: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #174d3e77;
  backdrop-filter: blur(3px);
}
.ending-card {
  background: #fff6db;
  padding: 25px;
  text-align: center;
  border: 3px solid #deb767;
  border-radius: 22px;
  width: min(85%, 340px);
  box-shadow: 0 10px 40px #174b4377;
}
.ending-card h2 {
  font-size: 25px;
  margin: 8px 0 12px;
}
.ending-card p {
  font-size: 13px;
  line-height: 1.8;
}
.ending-card button {
  padding: 10px 18px;
  background: #287d61;
  color: #fff5ce;
}
.tide-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 15px 21px;
  background: #f2efd8;
  border-bottom: 1px solid #e0e2c7;
}
.tide-bar b {
  font-size: 13px;
  display: block;
}
.tide-bar small {
  font-size: 10px;
  color: #84906f;
  display: block;
  margin-top: 6px;
}
.tide-bar button {
  font-size: 11px;
  white-space: nowrap;
}
.story-strip {
  display: flex;
  gap: 17px;
  padding: 19px 22px;
  min-height: 108px;
  align-items: flex-start;
}
.story-number {
  font-family: Georgia, serif;
  font-style: italic;
  font-size: 32px;
  color: #b7bf8b;
  border-right: 1px solid #d5ddbe;
  padding-right: 17px;
}
.story-strip h2 {
  font-size: 14px;
  margin: 2px 0 7px;
}
.story-strip p {
  font-size: 12px;
  line-height: 1.85;
  color: #708371;
  margin: 0;
}
.running-banner {
  margin: 0 20px 20px;
  padding: 17px 19px;
  background: #dbecc6;
  border: 1px solid #b7d297;
  border-radius: 14px;
}
.running-banner b {
  font-size: 17px;
}
.running-banner p {
  font-size: 12px;
  line-height: 1.7;
  color: #648154;
  margin-bottom: 0;
}
.control-panel {
  background: #fffaf0;
  border-radius: 20px;
  border: 1px solid #dde1c8;
  box-shadow: 0 9px 30px #3752300c;
  padding: 0 18px 14px;
  overflow: hidden;
}
.supply-panel {
  padding: 0 0 15px;
}
.section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 17px 0 9px;
  gap: 5px;
}
.section-title h3 {
  font-size: 12px;
  margin: 0;
}
.section-title small {
  font-size: 9px;
  color: #879576;
}
.gather-actions {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 7px;
}
.gather-actions button {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 9px 3px;
  background: #e8edda;
  border-bottom: 2px solid #d1d9bb;
  font-size: 11px;
  min-height: 48px;
}
.gather-actions svg {
  width: 25px;
  height: 25px;
}
.gather-actions small {
  display: block;
  font-size: 9px;
  color: #859572;
  margin-top: 3px;
}
.ammo-craft {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 8px;
  padding: 10px 12px;
  background: #f6e6bf;
  border-bottom: 2px solid #e5d3a4;
}
.ammo-craft b {
  font-size: 11px;
}
.ammo-craft small {
  font-size: 9px;
  color: #947b45;
}
.panel-tabs {
  display: flex;
  margin: 0 -18px 17px;
  padding: 0 12px;
  background: #e8ebd8;
  gap: 5px;
}
.panel-tabs button {
  background: transparent;
  border-radius: 0;
  font-size: 12px;
  font-weight: 750;
  padding: 13px 8px 11px;
  flex: 1;
  border-bottom: 3px solid transparent;
}
.panel-tabs [aria-selected="true"] {
  border-color: #318468;
  color: #257358;
}
.panel-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 0 0 13px;
}
.panel-heading h2 {
  font-size: 20px;
  margin: 0;
}
.panel-heading > span {
  font-size: 12px;
  font-weight: 700;
  color: #899273;
}
.panel-heading .eyebrow {
  font-size: 9px;
  letter-spacing: 1px;
  margin-bottom: 5px;
}
.primary {
  background: #287c60;
  color: #fff7db;
  padding: 11px 15px;
  font-size: 12px;
  font-weight: 750;
  border-bottom: 3px solid #1e604b;
}
.perimeter-card {
  padding: 16px;
  background: #f6e8c4;
  border: 1px solid #e1c995;
  border-radius: 12px;
  margin-bottom: 10px;
}
.card-eyebrow {
  font-size: 9px;
  color: #a28b55;
  letter-spacing: 0.5px;
}
.perimeter-card h3 {
  font-size: 21px;
  margin: 6px 0;
}
.perimeter-card p {
  font-size: 11px;
  color: #897f57;
  line-height: 1.8;
  margin: 7px 0 12px;
}
.perimeter-card button {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.perimeter-card small {
  font-size: 10px;
  font-weight: normal;
  color: #cfe8bb;
}
.perimeter-summary {
  width: 100%;
  font-size: 10px;
  padding: 10px;
  background: #e6efd4;
  margin-bottom: 9px;
  display: flex;
  justify-content: space-between;
}
.perimeter-summary span {
  color: #75925e;
}
.build-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 8px;
  margin-top: 8px;
  background: #f3f0df;
  border: 1px solid #e4e1c9;
  border-radius: 11px;
}
.build-card .mini-sprite {
  width: 72px;
  height: 72px;
  flex-shrink: 0;
}
.mini-sprite {
  display: block;
  width: 68px;
  height: 68px;
  background-size: 300% 200%;
  background-repeat: no-repeat;
  flex-shrink: 0;
}
.build-card > div {
  flex: 1;
  min-width: 0;
}
.build-card h3 {
  font-size: 12px;
  margin: 0 0 5px;
}
.build-card h3 i {
  font-style: normal;
  color: #5e926d;
}
.build-card p {
  font-size: 10px;
  line-height: 1.65;
  color: #899371;
  margin: 0 0 6px;
}
.build-card button {
  font-size: 9px;
  padding: 7px 9px;
  background: #dee7c9;
  border-bottom: 1px solid #c7d3af;
}
.build-card.done {
  padding: 6px 8px;
  background: #f1f1e2;
}
.build-card.done .mini-sprite {
  width: 53px;
  height: 53px;
}
.build-card.done p {
  margin: 0;
}
.feedback {
  border-top: 1px solid #e2e5d0;
  color: #467658;
  font-size: 11px;
  line-height: 1.65;
  margin: 15px 0 0;
  padding-top: 10px;
  min-height: 29px;
}
.feedback.error {
  color: #b1643e;
}
.wall-inspector,
.tower-inspector {
  display: flex;
  align-items: center;
  padding: 7px;
  background: #f0edda;
  border-radius: 12px;
  border: 1px solid #e0dec6;
  gap: 10px;
}
.wall-inspector .mini-sprite {
  width: 102px;
  height: 94px;
}
.wall-inspector b {
  font-size: 12px;
  display: block;
}
.wall-inspector strong {
  font-size: 22px;
  display: block;
  margin-top: 5px;
}
.wall-inspector strong small {
  font-size: 12px;
  color: #94a17d;
}
.wall-inspector p {
  font-size: 10px;
  line-height: 1.7;
  color: #859370;
  margin: 6px 0 0;
}
.defense-actions {
  display: flex;
  gap: 7px;
  margin: 8px 0 13px;
}
.defense-actions button {
  flex: 1;
  font-size: 11px;
  padding: 9px;
  background: #e1eace;
  border-bottom: 2px solid #ccd8b7;
}
.defense-actions small {
  display: block;
  font-size: 9px;
  color: #7d956c;
  margin-top: 4px;
}
.tower-inspector .mini-sprite {
  width: 92px;
  height: 92px;
}
.tower-inspector h3 {
  font-size: 14px;
  margin: 0 0 7px;
}
.tower-inspector p {
  font-size: 10px;
  color: #83936d;
  margin: 8px 0 0;
}
.stars {
  color: #c7993e;
  font-size: 13px;
  letter-spacing: 2px;
}
.tower-picker {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 5px;
}
.tower-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 4px 2px 9px;
  background: #f3ecd7;
  border: 1px solid #e2dabc;
}
.tower-card b {
  font-size: 10px;
}
.tower-card small {
  font-size: 8px;
  line-height: 1.6;
  color: #909574;
  margin-top: 4px;
}
.tower-card .mini-sprite {
  width: 72px;
  height: 70px;
}
.wall-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 5px;
}
.wall-grid button {
  padding: 7px 4px 6px;
  background: #eaf0d9;
  border: 1px solid #d6dfc2;
  border-radius: 7px;
}
.wall-grid span {
  display: block;
  font-size: 8px;
  color: #7a8b65;
}
.wall-grid b {
  font-size: 14px;
  margin: 3px 0 4px;
  display: block;
}
.wall-grid i {
  display: block;
  height: 3px;
  background: linear-gradient(
    to right,
    #81ac69 var(--fill),
    #d4debc var(--fill)
  );
  border-radius: 4px;
}
.wall-grid .critical {
  background: #f6dfc5;
  border-color: #d0ac7e;
  color: #b4663e;
}
.wall-grid .critical i {
  background: linear-gradient(
    to right,
    #c98049 var(--fill),
    #e5cdac var(--fill)
  );
}
.wall-grid .active {
  box-shadow: 0 0 0 2px #d5b366;
}
.robot-panel {
  background: #ecf0dc;
  border: 1px solid #d8e1c0;
  border-radius: 12px;
  margin-top: 14px;
  padding: 8px 11px 10px;
}
.robot-heading {
  display: flex;
  align-items: center;
  gap: 5px;
}
.robot-heading .mini-sprite {
  width: 76px;
  height: 76px;
}
.robot-heading h3 {
  font-size: 12px;
  margin: 0 0 5px;
}
.robot-heading h3 small {
  font-size: 10px;
  color: #8a9c71;
  margin-left: 6px;
}
.robot-heading p {
  font-size: 10px;
  line-height: 1.6;
  color: #7e926a;
  margin: 0;
}
.robot-panel > button {
  width: 100%;
  padding: 8px;
  font-size: 10px;
  background: #d9e7c2;
}
.robot-cost {
  display: block;
  font-size: 8px;
  color: #96a27d;
  margin-top: 7px;
  line-height: 1.5;
}
.home-repair {
  width: 100%;
  font-size: 11px;
  padding: 9px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 11px;
}
.home-repair small {
  font-size: 9px;
  color: #849775;
}
.automation-list {
  display: grid;
  gap: 8px;
}
.line-card {
  padding: 10px 12px;
  background: #f1efdf;
  border: 1px solid #e3dfc6;
  border-radius: 11px;
}
.line-card.connected {
  background: #eaf0d7;
  border-color: #d3dfb9;
}
.line-heading {
  display: flex;
  align-items: center;
  gap: 9px;
}
.line-heading svg {
  width: 33px;
  height: 33px;
}
.ammo-symbol {
  font-size: 31px;
  color: #c6a448;
  width: 33px;
  text-align: center;
}
.line-heading h3 {
  font-size: 12px;
  margin: 0 0 6px;
}
.line-heading h3 small {
  font-size: 9px;
  color: #8b9a72;
  font-weight: 500;
  margin-left: 5px;
}
.line-heading p {
  font-size: 9px;
  color: #7f9167;
  margin: 0;
}
.line-card button {
  display: block;
  margin: 9px 0 0 auto;
  font-size: 9px;
  padding: 7px 9px;
  background: #dce6c6;
}
.system-check {
  padding: 13px;
  margin-top: 13px;
  background: #f2eed9;
  border: 1px solid #e0dec3;
  border-radius: 11px;
}
.system-check h3 {
  font-size: 12px;
  margin: 0 0 11px;
}
.system-check h3 small {
  font-size: 9px;
  font-weight: normal;
  color: #949e7c;
  margin-left: 7px;
}
.system-check p {
  font-size: 10px;
  color: #929b7e;
  line-height: 1.5;
  margin: 7px 0;
  display: flex;
  gap: 7px;
}
.system-check p.met {
  color: #4b855d;
}
.system-check button {
  padding: 7px 10px;
  font-size: 10px;
  margin-top: 4px;
}
.control-panel [data-panel] > .section-title:first-child {
  margin-top: 0;
}
footer {
  display: flex;
  justify-content: space-between;
  padding: 22px 0;
  color: #9ba488;
  font-size: 10px;
  letter-spacing: 0.3px;
  gap: 15px;
}
dialog {
  border: 1px solid #d4d8b6;
  border-radius: 20px;
  background: #fff9e8;
  color: #315648;
  padding: 29px;
  max-width: 500px;
  width: calc(100% - 36px);
  box-shadow: 0 25px 90px #183f4660;
}
dialog::backdrop {
  background: #163e4070;
  backdrop-filter: blur(5px);
}
dialog h2 {
  font-size: 23px;
  margin: 0 0 16px;
}
dialog p {
  font-size: 13px;
  line-height: 1.9;
  color: #748367;
}
dialog button {
  padding: 11px 14px;
}
.dialog-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.danger {
  background: #b77548;
  color: #fff7dd;
}
@media (max-width: 1100px) {
  .page {
    padding: 0 18px;
  }
  .game-layout {
    grid-template-columns: minmax(0, 1fr) 320px;
    gap: 14px;
  }
  .control-panel {
    padding-left: 14px;
    padding-right: 14px;
  }
  .panel-tabs {
    margin-left: -14px;
    margin-right: -14px;
  }
  .resource-bar {
    gap: 8px;
    padding: 12px;
  }
  .resource {
    gap: 5px;
  }
  .resource b {
    font-size: 16px;
  }
  .resource small {
    font-size: 8px;
  }
  .world-top {
    top: 12px;
    left: 12px;
    right: 12px;
  }
  .world-controls {
    top: 53px;
    right: 12px;
  }
  .wall-target {
    font-size: 8px;
    padding: 3px 5px;
  }
  .facility-target {
    font-size: 8px;
    padding: 3px 5px;
  }
  .world-bottom {
    font-size: 9px;
  }
  .story-strip {
    padding: 15px;
  }
  .build-card .mini-sprite {
    width: 59px;
    height: 62px;
  }
  .build-card.done .mini-sprite {
    width: 47px;
    height: 47px;
  }
  .tower-card .mini-sprite {
    width: 65px;
    height: 62px;
  }
  .tower-card small {
    font-size: 7px;
  }
  .tower-card b {
    font-size: 9px;
  }
  .tide-bar {
    padding: 12px;
  }
  .tide-bar b {
    font-size: 11px;
  }
  .tide-bar button {
    font-size: 10px;
    padding: 9px 11px;
  }
  .tide-bar small {
    font-size: 9px;
  }
}
@media (max-width: 850px) {
  .page {
    max-width: 700px;
    padding: 0 14px;
  }
  .masthead {
    min-height: 73px;
  }
  .brand {
    font-size: 18px;
    gap: 9px;
  }
  .brand-icon {
    width: 37px;
    height: 37px;
    border-radius: 12px;
    font-size: 33px;
  }
  .brand small {
    font-size: 7px;
    letter-spacing: 1px;
  }
  .header-tools {
    gap: 4px;
  }
  .header-tools > span {
    display: none;
  }
  .header-tools button {
    font-size: 10px;
    padding: 7px;
  }
  .title-row {
    position: relative;
    display: block;
    padding: 20px 0 17px;
  }
  .title-row h1 {
    font-size: 24px;
    line-height: 1.45;
  }
  .title-row h1 em {
    white-space: nowrap;
  }
  .title-row .eyebrow {
    padding-right: 100px;
    font-size: 8px;
    letter-spacing: 0.3px;
  }
  .chapter-pill {
    position: absolute;
    right: 0;
    top: 15px;
    font-size: 8px;
    padding: 5px 8px;
    margin: 0;
  }
  .game-layout {
    grid-template-columns: 1fr;
    gap: 14px;
  }
  .control-panel {
    padding: 0 18px 14px;
  }
  .panel-tabs {
    margin-left: -18px;
    margin-right: -18px;
  }
  .resource-bar {
    min-height: 59px;
  }
  .resource b {
    font-size: 18px;
  }
  .resource svg {
    width: 24px;
    height: 24px;
  }
  .resource small {
    font-size: 8px;
  }
  .world-top {
    top: 10px;
    left: 10px;
    right: 10px;
  }
  .map-label {
    font-size: 12px;
  }
  .map-label small {
    font-size: 6px;
    letter-spacing: 1px;
  }
  .health {
    font-size: 10px;
    padding: 5px 8px;
  }
  .world-controls {
    top: 43px;
    right: 11px;
  }
  .world-controls button {
    padding: 5px 7px;
    font-size: 9px;
  }
  .facility-target {
    font-size: 7px;
    padding: 2px 4px;
  }
  .wall-target {
    font-size: 7px;
    padding: 3px 4px;
    min-height: 22px;
  }
  .world-bottom {
    padding: 17px 10px 8px;
    font-size: 8px;
  }
  .pad-target {
    min-width: 28px;
    min-height: 34px;
  }
  .story-strip {
    min-height: 90px;
    padding: 14px;
    gap: 11px;
  }
  .story-strip h2 {
    font-size: 12px;
  }
  .story-strip p {
    font-size: 10px;
  }
  .story-number {
    font-size: 26px;
    padding-right: 11px;
  }
  .tide-bar {
    padding: 12px;
  }
  .tide-bar b {
    font-size: 11px;
  }
  .tide-bar small {
    font-size: 8px;
    line-height: 1.6;
  }
  .tide-bar button {
    font-size: 9px;
    padding: 9px;
  }
  .ending-card {
    padding: 15px;
  }
  .ending-card h2 {
    font-size: 20px;
  }
  .ending-card p {
    font-size: 11px;
  }
  .build-card .mini-sprite {
    width: 74px;
    height: 72px;
  }
  .build-card.done .mini-sprite {
    width: 53px;
    height: 53px;
  }
  .tower-card .mini-sprite {
    width: 82px;
    height: 75px;
  }
  .tower-card b {
    font-size: 11px;
  }
  .tower-card small {
    font-size: 9px;
  }
  .wall-grid span {
    font-size: 9px;
  }
  .wall-grid button {
    padding: 10px 5px;
  }
  .robot-heading p {
    font-size: 11px;
  }
  .robot-cost {
    font-size: 9px;
  }
  footer {
    font-size: 9px;
    line-height: 1.8;
    gap: 20px;
  }
  .system-check p {
    font-size: 11px;
  }
  .line-heading p {
    font-size: 10px;
  }
  .line-card button {
    font-size: 10px;
  }
}
@media (max-width: 370px) {
  .page {
    padding: 0 9px;
  }
  .brand {
    font-size: 16px;
  }
  .brand small {
    display: none;
  }
  .title-row h1 {
    font-size: 21px;
  }
  .title-row .eyebrow {
    max-width: 200px;
  }
  .resource-bar {
    padding: 9px 8px;
    gap: 3px;
  }
  .resource svg {
    width: 21px;
    height: 21px;
  }
  .resource b {
    font-size: 15px;
  }
  .resource small {
    font-size: 7px;
  }
  .world-controls {
    top: 34px;
  }
  .map-label small {
    display: none;
  }
  .world-top {
    top: 7px;
    left: 9px;
    right: 9px;
  }
  .health {
    font-size: 8px;
  }
  .wall-target {
    min-height: 19px;
    font-size: 6px;
    padding: 2px 3px;
  }
  .facility-target {
    font-size: 6px;
  }
  .world-bottom {
    font-size: 7px;
  }
  .tower-card .mini-sprite {
    width: 66px;
    height: 66px;
  }
  .tower-card b {
    font-size: 9px;
  }
  .tower-card small {
    font-size: 8px;
  }
  .control-panel {
    padding-left: 13px;
    padding-right: 13px;
  }
  .panel-tabs {
    margin-left: -13px;
    margin-right: -13px;
  }
  .story-strip {
    padding: 12px;
  }
}
@media (prefers-reduced-motion: reduce) {
  * {
    transition: none !important;
    scroll-behavior: auto !important;
  }
}
/* Chapter-led survival: the map remains primary; new controls appear with the new responsibility. */
.chapter-path {
  display: flex;
  gap: 6px;
  margin: 0 0 20px;
  counter-reset: chapter;
}
.chapter-path > span {
  flex: 1;
  padding: 12px 8px;
  background: #e4ead5;
  border-radius: 9px;
  font-size: 11px;
  color: #84907b;
  display: flex;
  align-items: center;
  gap: 8px;
}
.chapter-path b {
  font-size: 14px;
  font-variant-numeric: tabular-nums;
}
.chapter-path .current {
  background: #2b6a53;
  color: #fff1bf;
  box-shadow: 0 3px 0 #19513c;
}
.chapter-path .complete {
  background: #d9e7c4;
  color: #548066;
}
.resource-bar {
  flex-wrap: wrap;
  gap: 10px 17px;
}
.resource {
  flex: 1 0 65px;
  gap: 7px;
}
.resource-symbol {
  font-size: 23px;
  color: #e8d89e;
}
.activity-strip {
  padding: 12px 20px 16px;
  position: relative;
  display: flex;
  justify-content: space-between;
  gap: 10px;
  background: #edf0d9;
  font-size: 11px;
}
.activity-strip small {
  color: #7a9172;
  white-space: nowrap;
}
.activity-strip > i {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(
    to right,
    #77a66c var(--fill),
    #e0e7ce var(--fill)
  );
}
.needs-bar {
  display: flex;
  gap: 20px;
  padding: 12px 20px;
  background: #f5f3df;
}
.needs-bar > span {
  display: flex;
  align-items: center;
  gap: 7px;
  flex: 1;
  font-size: 10px;
}
.needs-bar i {
  height: 4px;
  flex: 1;
  background: linear-gradient(
    to right,
    #8aa76a var(--fill),
    #dcdcc6 var(--fill)
  );
  border-radius: 3px;
}
.needs-bar b {
  font-size: 9px;
  color: #8a9679;
}
.chapter-goals {
  padding: 0 26px 12px;
}
.chapter-goals p {
  display: flex;
  gap: 9px;
  font-size: 12px;
  color: #7e8f78;
  margin: 9px 0;
}
.chapter-goals p.done {
  color: #438068;
}
.chapter-goals b {
  color: #c4a25d;
}
.chapter-goals p.done b {
  color: #529773;
}
.chapter-footer {
  padding: 14px 24px 22px;
  display: flex;
  align-items: center;
  gap: 16px;
  border-top: 1px solid #e9ead7;
}
.chapter-footer > span {
  flex: 1;
  color: #899574;
  font-size: 10px;
  line-height: 1.7;
}
.chapter-footer .primary {
  padding: 12px 16px;
  font-size: 12px;
}
.story-strip {
  padding-bottom: 12px;
}
.story-strip p {
  font-size: 12px;
  line-height: 1.9;
}
.story-strip .eyebrow {
  font-size: 9px;
}
.panel-tabs button {
  font-size: 12px;
}
.site-note,
.panel-intro {
  font-size: 12px;
  line-height: 1.9;
  color: #7f8d78;
}
.control-panel h2 {
  font-size: 23px;
  margin: 9px 0 12px;
}
.control-panel h3 {
  font-size: 14px;
}
.quiet {
  display: block;
  font-size: 10px;
  color: #8e997f;
  line-height: 1.8;
  margin-top: 10px;
}
.control-panel [data-do] {
  padding: 10px 12px;
  font-size: 11px;
  border-bottom: 2px solid #c8d5b8;
}
.control-panel [data-do] small {
  display: block;
  font-size: 9px;
  color: #879271;
  margin-top: 4px;
}
.life-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 7px;
  margin: 18px 0;
}
.site-list {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 7px;
}
.site-list button {
  text-align: left;
  padding: 11px 10px;
  background: #edf0de;
  border: 1px solid #dce4cb;
}
.site-list span {
  display: block;
  font-size: 11px;
  font-weight: 600;
}
.site-list small {
  font-size: 9px;
  color: #8d987e;
  display: block;
  margin-top: 5px;
}
.site-list .selected {
  border-color: #85a97e;
  background: #e0eacb;
}
.site-target {
  position: absolute;
  transform: translate(-50%, -50%);
  font-size: 10px;
  font-weight: 650;
  background: #fff2cbd9;
  border: 1px solid #e0c58c;
  color: #6d6c46;
  padding: 4px 7px;
  white-space: nowrap;
  pointer-events: auto;
  box-shadow: 0 2px 3px #52634017;
}
.site-target.known {
  background: #edf4d4dc;
  border-color: #b9cc9b;
  color: #4a725a;
}
.site-target:hover:not(:disabled) {
  transform: translate(-50%, -50%);
}
.facility-icon {
  width: 60px;
  flex-shrink: 0;
  text-align: center;
  font-size: 40px;
  color: #8ba174;
}
.build-card {
  margin-bottom: 9px;
}
.build-card p {
  font-size: 11px;
  color: #7f8b73;
}
.encounter {
  margin: 0 23px 23px;
  padding: 17px;
  border: 1px solid #dcc394;
  background: #f5ebd2;
  border-radius: 12px;
}
.encounter h3 {
  font-size: 16px;
  margin: 8px 0;
}
.encounter p {
  font-size: 11px;
  line-height: 1.9;
  color: #8d866b;
}
.encounter small {
  display: block;
  font-size: 10px;
  color: #a28860;
  line-height: 1.7;
}
.encounter button {
  margin-top: 12px;
  padding: 11px 17px;
  font-size: 12px;
}
.craft-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 7px;
  margin-top: 16px;
}
.notice {
  background: #edf0da;
  border-left: 3px solid #b8c78c;
  padding: 12px;
  font-size: 12px;
  line-height: 1.8;
  color: #82906f;
  margin-bottom: 14px;
}
.journal {
  margin-top: 16px;
  color: #86937b;
  font-size: 10px;
  line-height: 1.9;
}
.journal summary {
  cursor: pointer;
  color: #557b61;
  font-size: 11px;
}
.journal ol {
  padding-left: 18px;
}
.journal li {
  margin-bottom: 9px;
}
.running-banner p {
  font-size: 12px;
  line-height: 1.9;
}
@media (max-width: 700px) {
  .chapter-path {
    gap: 4px;
    margin-bottom: 14px;
  }
  .chapter-path > span {
    flex-direction: column;
    gap: 4px;
    padding: 8px 3px;
    font-size: 8px;
    text-align: center;
  }
  .chapter-path b {
    font-size: 12px;
  }
  .resource {
    flex-basis: 45px;
  }
  .resource-bar {
    gap: 8px;
    padding: 12px;
  }
  .resource-symbol {
    font-size: 17px;
  }
  .resource b {
    font-size: 15px;
  }
  .resource small {
    font-size: 8px;
  }
  .needs-bar {
    gap: 12px;
    padding: 10px 13px;
  }
  .needs-bar > span {
    gap: 4px;
  }
  .activity-strip {
    padding: 11px 12px 14px;
    font-size: 10px;
  }
  .activity-strip small {
    font-size: 8px;
  }
  .site-target {
    font-size: 7px;
    padding: 3px 4px;
  }
  .chapter-goals {
    padding: 0 17px 10px;
  }
  .chapter-goals p {
    font-size: 11px;
  }
  .chapter-footer {
    padding: 12px 17px 18px;
    flex-direction: column;
    align-items: stretch;
    gap: 9px;
  }
  .chapter-footer > span {
    font-size: 10px;
  }
  .chapter-footer .primary {
    font-size: 12px;
  }
  .map-wall {
    font-size: 7px !important;
    padding: 2px 4px !important;
  }
  .story-strip p {
    font-size: 11px;
  }
  .world-bottom {
    font-size: 8px;
  }
  .encounter {
    margin: 0 16px 17px;
  }
  .running-banner {
    padding: 15px !important;
  }
  .title-row h1 {
    font-size: 22px;
  }
  .title-row .chapter-pill {
    display: none;
  }
}

/* Resource signs stay clickable where tall tower silhouettes overlap them. */
[data-sites] {
  z-index: 4;
}

/* Chapter objectives are small playable steps, with optional story reading. */
.chapter-guide {
  padding: 20px 24px 14px;
  border-top: 1px solid #e4e6d1;
}
.guide-heading {
  display: flex;
  align-items: center;
  gap: 13px;
  margin-bottom: 16px;
}
.guide-chapter-number {
  font-family: Georgia, serif;
  font-size: 31px;
  font-style: italic;
  color: #a6b37c;
}
.guide-heading .eyebrow {
  margin: 0 0 4px;
  font-size: 9px;
}
.guide-heading h2 {
  margin: 0;
  font-size: 17px;
}
.guide-count {
  margin-left: auto;
  font-size: 11px;
  color: #7d8b70;
  white-space: nowrap;
}
.goal-rail {
  display: flex;
  gap: 8px;
}
.goal-stop {
  flex: 1;
  min-width: 0;
  padding: 10px 5px;
  border: 1px solid #dfe5cf;
  border-radius: 12px;
  background: #f5f4e8;
  display: grid;
  grid-template-columns: 26px 1fr;
  column-gap: 6px;
  text-align: left;
  align-items: center;
}
.goal-stop > span {
  grid-row: 1 / 3;
  color: #9da66e;
  font-size: 25px;
  text-align: center;
}
.goal-stop b {
  font-size: 11px;
  line-height: 1.5;
}
.goal-stop small {
  font-size: 9px;
  color: #919b80;
}
.goal-stop.selected {
  background: #e6edcf;
  border-color: #88a87c;
  box-shadow: inset 0 -2px #89aa7e33;
}
.goal-stop.selected > span {
  color: #44735a;
}
.goal-stop.done > span {
  color: #428169;
}
.goal-stop.done:not(.selected) {
  background: #f2f5e8;
  border-color: #dfe9d5;
}
.guide-task {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 15px 0 12px;
  min-height: 91px;
}
.guide-task > div {
  flex: 1;
  min-width: 0;
}
.guide-task > .mini-sprite {
  width: 58px;
  height: 58px;
  flex: 0 0 58px;
}
.guide-task-icon {
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  flex: 0 0 52px;
  color: #669071;
  background: #ecedd8;
  border-radius: 50% 45% 48% 40%;
  font-family: Georgia, serif;
  font-size: 32px;
}
.guide-task small {
  font-size: 9px;
  color: #8c9b7d;
}
.guide-task h3 {
  font-size: 14px;
  margin: 3px 0 5px;
}
.guide-task p {
  color: #829076;
  font-size: 11px;
  margin: 0;
  line-height: 1.6;
}
.guide-task .primary {
  flex-shrink: 0;
  font-size: 12px;
  padding: 12px 16px;
}
.guide-check {
  font-size: 29px;
  color: #7aa177;
  padding: 0 14px;
}
.guide-bottom {
  display: flex;
  align-items: start;
  gap: 14px;
  border-top: 1px dashed #dfe4d0;
  padding-top: 10px;
}
.chapter-note {
  flex: 1;
  min-width: 0;
}
.chapter-note summary,
.encounter-note summary {
  cursor: pointer;
  color: #879478;
  font-size: 10px;
  padding: 5px 0;
}
.chapter-note p,
.encounter-note p {
  color: #74816a;
  font-size: 12px;
  line-height: 1.8;
  margin: 8px 0;
}
.chapter-next {
  font-size: 12px;
  padding: 10px 14px;
}
.is-guide-target {
  outline: 3px solid #edc76d;
  outline-offset: 4px;
  box-shadow: 0 0 0 8px #fff3b144;
}
.guide-arrival {
  outline: 3px solid #9abd85;
  outline-offset: 5px;
  border-radius: 10px;
}
@media (max-width: 700px) {
  .chapter-guide {
    padding: 15px 14px 12px;
  }
  .guide-heading {
    gap: 9px;
    margin-bottom: 12px;
  }
  .guide-heading h2 {
    font-size: 15px;
  }
  .guide-chapter-number {
    font-size: 26px;
  }
  .goal-rail {
    gap: 5px;
  }
  .goal-stop {
    display: flex;
    flex-direction: column;
    padding: 8px 2px;
    text-align: center;
  }
  .goal-stop > span {
    font-size: 22px;
    line-height: 25px;
  }
  .goal-stop b {
    font-size: 10px;
  }
  .goal-stop small {
    font-size: 8px;
  }
  .guide-task {
    gap: 10px;
    flex-wrap: wrap;
  }
  .guide-task-icon {
    width: 40px;
    height: 40px;
    flex-basis: 40px;
  }
  .guide-task > .mini-sprite {
    width: 44px;
    height: 44px;
    flex-basis: 44px;
  }
  .guide-task .primary {
    margin-left: 50px;
    width: calc(100% - 50px);
  }
  .guide-task h3 {
    font-size: 13px;
  }
  .guide-task p {
    font-size: 10px;
  }
  .guide-bottom {
    flex-wrap: wrap;
  }
  .chapter-next {
    width: 100%;
  }
}

/* Keep the recipe readable even when the action itself is unavailable. */
button.cost-button:disabled {
  opacity: 1;
  background: #eceedd;
  box-shadow: none;
}
button.cost-button:disabled .button-title {
  color: #84917a;
}
.control-panel [data-do] .cost-list {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 4px 10px;
  margin-top: 5px;
  font-size: 10px;
  line-height: 1.6;
}
.cost-item {
  display: inline-flex;
  align-items: baseline;
  gap: 4px;
  white-space: nowrap;
}
.cost-item.enough {
  color: #4d705c;
}
.cost-item.missing {
  color: #b14432;
  font-weight: 650;
}
.cost-shortage {
  font-size: 0.9em;
  font-weight: 500;
}
