* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Microsoft YaHei", "Segoe UI", sans-serif;
  color: #17243b;
  background:
    radial-gradient(circle at 14% 12%, rgba(255, 214, 102, 0.36), transparent 22%),
    radial-gradient(circle at 84% 18%, rgba(90, 190, 126, 0.28), transparent 24%),
    linear-gradient(135deg, #dff2ff 0%, #f8efd1 50%, #d9f0dd 100%);
  overflow: hidden;
}

body.max-window {
  background: #e5f2e2;
}

.shell {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 8px;
  width: min(1540px, calc(100vw - 12px));
  height: min(940px, calc(100vh - 12px));
  margin: 6px auto;
}

body.max-window .shell {
  width: 100vw;
  height: 100vh;
  margin: 0;
  gap: 6px;
  padding: 6px;
}

.topbar {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) auto;
  gap: 8px;
  align-items: stretch;
}

body.max-window .topbar {
  grid-template-columns: 1fr;
}

body.max-window .title-card {
  display: none;
}

.title-card,
.hud,
.game-panel,
.message,
.ally-panel,
.goal-panel,
.wave-panel,
.craft-panel,
.storage-panel,
.save-panel,
.inventory-bar {
  border: 2px solid rgba(20, 45, 40, 0.12);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.86);
  box-shadow: 0 18px 50px rgba(44, 78, 62, 0.16);
  backdrop-filter: blur(10px);
}

.play-layout {
  display: grid;
  grid-template-columns: 246px minmax(520px, 1fr) 266px;
  gap: 8px;
  min-height: 0;
}

body.max-window .play-layout {
  grid-template-columns: 220px minmax(720px, 1fr) 242px;
  gap: 6px;
}

.side-panel {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
}

.right-panel {
  overflow-y: auto;
  padding-right: 2px;
}

.center-stage {
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  gap: 7px;
  min-width: 0;
  min-height: 0;
}

.title-card {
  position: relative;
  padding: 14px 18px;
}

.build-badge {
  position: absolute;
  top: 10px;
  right: 12px;
  padding: 4px 8px;
  border-radius: 8px;
  color: #0d6b51;
  background: rgba(13, 107, 81, 0.1);
  font-size: 12px;
  font-weight: 900;
}

h1 {
  margin: 0;
  color: #17315a;
  font-size: clamp(25px, 3vw, 38px);
  line-height: 1.12;
}

.subtitle {
  margin: 6px 0 0;
  color: #5f6d74;
  font-size: 14px;
  line-height: 1.6;
}

.hud {
  display: grid;
  grid-template-rows: auto auto auto;
  gap: 7px;
  min-width: min(520px, 48vw);
  padding: 10px;
}

body.max-window .hud {
  min-width: 0;
}

.hud-head,
.hud-energy-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.hud-head span,
.hud-energy-label span {
  color: #60727c;
  font-size: 12px;
  font-weight: 900;
}

.hud-head strong,
.hud-energy-label strong {
  color: #17315a;
  font-size: 14px;
  font-weight: 1000;
}

.hud-resources {
  display: grid;
  grid-template-columns: repeat(5, minmax(54px, 1fr));
  gap: 6px;
}

.hud-chip {
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr);
  align-items: center;
  min-height: 34px;
  overflow: hidden;
  border: 1px solid rgba(23, 49, 90, 0.1);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.68);
}

.hud-chip span {
  display: grid;
  place-items: center;
  height: 100%;
  color: #fff;
  font-size: 12px;
  font-weight: 1000;
}

.hud-chip strong {
  min-width: 0;
  padding: 0 7px;
  color: #17315a;
  font-size: 18px;
  font-weight: 1000;
  line-height: 1;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.hud-chip.wood span { background: #8d5a34; }
.hud-chip.stone span { background: #69798a; }
.hud-chip.iron span { background: #d8a441; color: #513725; }
.hud-chip.fiber span { background: #2f8f46; }
.hud-chip.bullet span { background: #263241; }

.hud-energy {
  display: grid;
  gap: 5px;
}

.hud-energy-track {
  height: 9px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(23, 49, 90, 0.12);
}

.hud-energy-fill {
  width: 100%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #0d6b51, #7fc866);
  transition: width 0.18s linear;
}

.hud-health-fill {
  background: linear-gradient(90deg, #d85040, #f09a57);
}

.hud-health-fill.fractured {
  background: linear-gradient(90deg, #b83338, #d8a441);
  box-shadow: 0 0 0 1px rgba(184, 51, 56, 0.2) inset;
}

.game-panel {
  position: relative;
  min-height: 0;
  overflow: hidden;
  background: #7bbb63;
}

canvas {
  display: block;
  width: 100%;
  height: 100%;
  background: #80c26b;
  touch-action: none;
}

.message {
  padding: 11px 14px;
  border: 1px solid rgba(23, 49, 90, 0.16);
  background: rgba(255, 255, 255, 0.88);
  color: #28435f;
  font-size: 14px;
  line-height: 1.5;
}

.ally-panel {
  padding: 10px;
  border: 2px solid rgba(47, 134, 197, 0.24);
  background: rgba(255, 255, 255, 0.9);
}

.ally-panel.has-selection {
  border-color: rgba(47, 134, 197, 0.62);
}

.ally-panel-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  color: #17315a;
  font-size: 14px;
  font-weight: 900;
}

.ally-actions {
  display: flex;
  gap: 5px;
}

.ally-actions button {
  min-height: 26px;
  border: 0;
  border-radius: 8px;
  color: #fff;
  background: #2f86c5;
  font: inherit;
  font-size: 11px;
  font-weight: 900;
  cursor: pointer;
}

.ally-actions button:last-child {
  color: #17315a;
  background: rgba(23, 49, 90, 0.1);
}

.ally-summary {
  margin-top: 7px;
  color: #60727c;
  font-size: 12px;
  line-height: 1.45;
}

.ally-stats {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
  margin-top: 8px;
}

.ally-stats div {
  min-width: 0;
  padding: 6px;
  border-radius: 8px;
  background: rgba(47, 134, 197, 0.08);
}

.ally-stats span {
  display: block;
  color: #60727c;
  font-size: 10px;
  line-height: 1.2;
}

.ally-stats strong {
  display: block;
  margin-top: 2px;
  color: #17315a;
  font-size: 12px;
  line-height: 1.2;
}

.ally-list {
  display: grid;
  gap: 5px;
  max-height: 138px;
  margin-top: 8px;
  overflow: auto;
}

.ally-row {
  display: grid;
  gap: 2px;
  width: 100%;
  min-height: 42px;
  padding: 6px 7px;
  border: 1px solid rgba(23, 49, 90, 0.12);
  border-radius: 8px;
  color: #17315a;
  background: rgba(255, 255, 255, 0.64);
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.ally-row.selected {
  border-color: rgba(47, 134, 197, 0.74);
  background: rgba(47, 134, 197, 0.14);
}

.ally-row-name {
  font-size: 12px;
  font-weight: 900;
  line-height: 1.2;
}

.ally-row-meta {
  color: #60727c;
  font-size: 10px;
  line-height: 1.25;
}

.goal-panel {
  padding: 12px;
  border: 2px solid rgba(23, 49, 90, 0.16);
  background: rgba(255, 255, 255, 0.88);
}

.goal-title {
  color: #17315a;
  font-size: 14px;
  font-weight: 900;
}

.goal-text {
  margin-top: 5px;
  color: #0d6b51;
  font-size: 15px;
  font-weight: 900;
  line-height: 1.4;
}

.rule-text {
  margin-top: 4px;
  color: #60727c;
  font-size: 12px;
  line-height: 1.5;
}

.wave-panel {
  padding: 12px;
  border: 2px solid rgba(23, 49, 90, 0.16);
  background: rgba(255, 255, 255, 0.88);
}

.wave-title {
  color: #17315a;
  font-size: 13px;
  font-weight: 900;
}

.wave-main {
  margin-top: 4px;
  color: #0d6b51;
  font-size: 18px;
  font-weight: 900;
  line-height: 1.2;
}

.wave-timer {
  margin-top: 3px;
  color: #17315a;
  font-size: 13px;
  font-weight: 800;
}

.wave-note {
  margin-top: 3px;
  color: #60727c;
  font-size: 11px;
  line-height: 1.45;
}

.perf-panel {
  padding: 10px;
  border: 2px solid rgba(47, 134, 197, 0.2);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.88);
  box-shadow: 0 18px 50px rgba(44, 78, 62, 0.16);
}

.perf-panel.perf-warn {
  border-color: rgba(214, 192, 112, 0.68);
  background: rgba(255, 248, 224, 0.92);
}

.perf-panel.perf-bad {
  border-color: rgba(216, 80, 64, 0.7);
  background: rgba(255, 238, 235, 0.94);
}

.perf-title {
  color: #17315a;
  font-size: 13px;
  font-weight: 900;
}

.perf-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
  margin-top: 7px;
}

.perf-grid div {
  min-width: 0;
  padding: 6px;
  border-radius: 8px;
  background: rgba(47, 134, 197, 0.08);
}

.perf-grid span {
  display: block;
  color: #60727c;
  font-size: 10px;
  line-height: 1.2;
}

.perf-grid strong {
  display: block;
  margin-top: 2px;
  color: #17315a;
  font-size: 11px;
  line-height: 1.2;
  overflow-wrap: anywhere;
}

.craft-panel {
  flex: 1;
  min-height: 0;
  padding: 10px;
  border: 2px solid rgba(23, 49, 90, 0.16);
  background: rgba(255, 255, 255, 0.9);
}

.craft-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
  color: #17315a;
  font-size: 14px;
  font-weight: 900;
}

.craft-list {
  display: grid;
  gap: 7px;
  max-height: calc(100% - 34px);
  overflow: auto;
  padding-right: 2px;
}

.craft-recipe {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  gap: 8px;
  align-items: center;
  padding: 7px;
  border: 1px solid rgba(23, 49, 90, 0.12);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.58);
}

.craft-icon {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 8px;
  color: #fff;
  background: #8d5a34;
  box-shadow: inset 0 -12px 0 rgba(69, 43, 24, 0.25);
  font-weight: 900;
}

.craft-name {
  margin: 0 0 2px;
  color: #17315a;
  font-size: 13px;
  font-weight: 900;
  line-height: 1.2;
}

.craft-cost {
  margin: 0;
  color: #60727c;
  font-size: 11px;
  line-height: 1.35;
}

.craft-cost strong {
  color: #0d6b51;
}

.craft-action {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  align-items: center;
  grid-column: 1 / -1;
}

.craft-status {
  color: #60727c;
  font-size: 11px;
  line-height: 1.4;
}

.craft-button {
  min-width: 64px;
  min-height: 30px;
  border: 0;
  border-radius: 8px;
  color: #fff;
  background: #0d6b51;
  font: inherit;
  font-size: 12px;
  font-weight: 900;
  cursor: pointer;
  box-shadow: 0 10px 22px rgba(13, 107, 81, 0.24);
}

.craft-button:disabled {
  color: #7f8a91;
  background: #d9e1df;
  box-shadow: none;
  cursor: not-allowed;
}

.storage-panel {
  padding: 10px;
  border: 2px solid rgba(23, 49, 90, 0.16);
  background: rgba(255, 255, 255, 0.94);
  scroll-margin-top: 8px;
}

.barracks-panel {
  padding: 10px;
  border: 2px solid rgba(216, 80, 64, 0.28);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 18px 50px rgba(90, 49, 32, 0.14);
}

.floating-barracks {
  position: fixed;
  top: 70px;
  left: calc(50vw - 230px);
  right: auto;
  z-index: 2147483646;
  width: min(460px, calc(100vw - 24px));
  max-height: min(620px, calc(100vh - 100px));
  overflow: auto;
  background: rgba(255, 255, 255, 0.98);
  box-shadow: 0 28px 90px rgba(90, 49, 32, 0.36);
  pointer-events: auto;
}

.barracks-panel.is-open {
  border-color: rgba(216, 80, 64, 0.72);
  box-shadow: 0 28px 90px rgba(216, 80, 64, 0.22), 0 0 0 9999px rgba(21, 41, 34, 0.06);
}

.floating-barracks.is-open {
  display: block !important;
  visibility: visible !important;
  opacity: 1 !important;
  z-index: 2147483646 !important;
}

.barracks-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  color: #17315a;
  font-size: 14px;
  font-weight: 900;
  cursor: grab;
  user-select: none;
}

.barracks-title:active {
  cursor: grabbing;
}

.barracks-close {
  width: 26px;
  height: 26px;
  border: 0;
  border-radius: 8px;
  color: #17315a;
  background: rgba(23, 49, 90, 0.09);
  font: inherit;
  font-weight: 900;
  cursor: pointer;
}

.barracks-status {
  margin-top: 7px;
  color: #60727c;
  font-size: 12px;
  line-height: 1.35;
}

.barracks-progress {
  height: 9px;
  margin-top: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(23, 49, 90, 0.12);
}

.barracks-progress-fill {
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: #d85040;
  transition: width 0.18s linear;
}

.barracks-queue {
  display: grid;
  gap: 5px;
  min-height: 30px;
  margin-top: 8px;
}

.barracks-queue-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: #60727c;
  font-size: 11px;
  font-weight: 900;
}

.barracks-queue-item {
  appearance: none;
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr) auto;
  align-items: center;
  gap: 6px;
  min-height: 28px;
  padding: 4px 7px;
  border: 1px solid rgba(23, 49, 90, 0.1);
  border-radius: 8px;
  color: #17315a;
  background: rgba(23, 49, 90, 0.08);
  font-size: 11px;
  font-weight: 900;
  font-family: inherit;
  text-align: left;
  cursor: pointer;
}

.barracks-queue-item:hover {
  filter: brightness(0.97);
}

.barracks-queue-item:focus-visible {
  outline: 2px solid rgba(23, 49, 90, 0.36);
  outline-offset: 2px;
}

.barracks-empty {
  display: inline-grid;
  place-items: center;
  min-width: 26px;
  height: 24px;
  padding: 0 7px;
  border-radius: 8px;
  color: #17315a;
  background: rgba(23, 49, 90, 0.08);
  font-size: 11px;
  font-weight: 900;
}

.barracks-queue-rank {
  display: inline-grid;
  place-items: center;
  width: 20px;
  height: 20px;
  border-radius: 999px;
  color: inherit;
  background: rgba(255, 255, 255, 0.72);
}

.barracks-queue-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.barracks-queue-state {
  font-size: 10px;
  white-space: nowrap;
}

.barracks-queue-cancel-mark {
  font-size: 10px;
  opacity: 0.78;
  white-space: nowrap;
}

.barracks-queue-item.training {
  color: #fff;
  background: #d85040;
}

.barracks-queue-item.waiting {
  color: #7b4b0e;
  background: #ffd89a;
}

.barracks-queue-item.next {
  color: #17315a;
  background: #c7e6ff;
}

.barracks-queue-item.queued {
  color: #17315a;
  background: rgba(23, 49, 90, 0.08);
}

.barracks-list {
  display: grid;
  gap: 7px;
  margin-top: 8px;
}

.barracks-recipe {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) auto;
  gap: 8px;
  align-items: start;
  padding: 7px;
  border: 1px solid rgba(23, 49, 90, 0.12);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.58);
}

.barracks-info {
  min-width: 0;
}

.barracks-icon {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 8px;
  color: #fff;
  font-weight: 900;
}

.barracks-name {
  margin: 0 0 2px;
  color: #17315a;
  font-size: 13px;
  font-weight: 900;
}

.barracks-cost {
  margin: 0;
  color: #60727c;
  font-size: 11px;
  line-height: 1.3;
}

.barracks-cost strong {
  color: #0d6b51;
}

.barracks-train {
  min-width: 54px;
  min-height: 30px;
  border: 0;
  border-radius: 8px;
  color: #fff;
  background: #d85040;
  font: inherit;
  font-size: 12px;
  font-weight: 900;
  cursor: pointer;
}

.barracks-train:disabled {
  color: #7f8a91;
  background: #d9e1df;
  cursor: not-allowed;
}

.barracks-action {
  display: grid;
  gap: 4px;
  justify-items: center;
  min-width: 62px;
}

.barracks-action span {
  color: #60727c;
  font-size: 10px;
  font-weight: 900;
  white-space: nowrap;
}

.barracks-recipe-flow {
  grid-column: 2 / 4;
  display: grid;
  gap: 5px;
  min-width: 0;
}

.barracks-recipe-progress {
  height: 7px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(23, 49, 90, 0.1);
}

.barracks-recipe-progress-fill {
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: #d85040;
  transition: width 0.18s linear;
}

.barracks-recipe-queue {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  min-width: 0;
}

.barracks-queue-item.compact {
  grid-template-columns: 20px minmax(0, 1fr) auto;
  min-height: 24px;
  padding: 3px 6px;
}

.barracks-empty.compact {
  height: 22px;
  min-width: 46px;
  color: #7f8a91;
  background: rgba(23, 49, 90, 0.06);
}

.weapon-bench-panel {
  border-color: rgba(79, 93, 115, 0.32);
  box-shadow: 0 18px 50px rgba(38, 50, 65, 0.14);
}

.floating-weapon-bench {
  top: 84px;
  left: calc(50vw - 230px);
  box-shadow: 0 28px 90px rgba(38, 50, 65, 0.34);
}

.weapon-bench-panel.is-open {
  border-color: rgba(79, 93, 115, 0.76);
  box-shadow: 0 28px 90px rgba(79, 93, 115, 0.24), 0 0 0 9999px rgba(21, 41, 34, 0.06);
}

.weapon-bench-panel .barracks-progress-fill,
.weapon-bench-panel .barracks-recipe-progress-fill,
.weapon-bench-panel .barracks-train,
.weapon-bench-panel .barracks-queue-item.training {
  background: #4f5d73;
}

.weapon-bench-panel .barracks-train {
  box-shadow: 0 10px 22px rgba(79, 93, 115, 0.24);
}

.weapon-bench-panel .barracks-train:disabled {
  color: #7f8a91;
  background: #d9e1df;
  box-shadow: none;
}

.robot-factory-panel {
  border-color: rgba(47, 134, 197, 0.3);
  box-shadow: 0 18px 50px rgba(26, 87, 119, 0.14);
}

.floating-robot-factory {
  top: 92px;
  left: calc(50vw - 240px);
  box-shadow: 0 28px 90px rgba(26, 87, 119, 0.32);
}

.robot-factory-panel.is-open {
  border-color: rgba(47, 134, 197, 0.74);
  box-shadow: 0 28px 90px rgba(47, 134, 197, 0.24), 0 0 0 9999px rgba(21, 41, 34, 0.06);
}

.robot-factory-panel .barracks-progress-fill,
.robot-factory-panel .barracks-recipe-progress-fill,
.robot-factory-panel .barracks-train,
.robot-factory-panel .barracks-queue-item.training {
  background: #2f86c5;
}

.robot-factory-panel .barracks-train {
  box-shadow: 0 10px 22px rgba(47, 134, 197, 0.24);
}

.robot-factory-panel .barracks-train:disabled {
  color: #7f8a91;
  background: #d9e1df;
  box-shadow: none;
}

.shop-panel {
  padding: 10px;
  border: 2px solid rgba(13, 107, 81, 0.3);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 18px 50px rgba(44, 78, 62, 0.16);
}

.floating-shop {
  position: fixed;
  top: 78px;
  left: calc(50vw - 220px);
  right: auto;
  z-index: 2147483646;
  width: min(440px, calc(100vw - 24px));
  max-height: min(560px, calc(100vh - 104px));
  overflow: auto;
  background: rgba(255, 255, 255, 0.98);
  box-shadow: 0 28px 90px rgba(13, 107, 81, 0.28);
  pointer-events: auto;
}

.shop-panel.is-open {
  border-color: rgba(13, 107, 81, 0.72);
  box-shadow: 0 28px 90px rgba(13, 107, 81, 0.22), 0 0 0 9999px rgba(21, 41, 34, 0.06);
}

.floating-shop.is-open {
  display: block !important;
  visibility: visible !important;
  opacity: 1 !important;
  z-index: 2147483646 !important;
}

.shop-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  color: #17315a;
  font-size: 14px;
  font-weight: 900;
  cursor: grab;
  user-select: none;
}

.shop-title:active {
  cursor: grabbing;
}

.shop-close {
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border: 0;
  border-radius: 8px;
  color: #17315a;
  background: rgba(23, 49, 90, 0.08);
  font: inherit;
  font-size: 18px;
  font-weight: 900;
  line-height: 1;
  cursor: pointer;
}

.shop-status {
  margin-top: 7px;
  color: #60727c;
  font-size: 12px;
  line-height: 1.35;
}

.shop-list {
  display: grid;
  gap: 8px;
  margin-top: 10px;
}

.shop-trade {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  padding: 8px;
  border: 1px solid rgba(23, 49, 90, 0.12);
  border-radius: 8px;
  background: linear-gradient(180deg, #fffdf4 0%, #edf8ec 100%);
}

.shop-trade.disabled {
  opacity: 0.62;
}

.shop-trade-flow {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.shop-trade-side {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  color: #17315a;
  font-size: 12px;
  font-weight: 900;
}

.shop-arrow {
  color: #0d6b51;
  font-weight: 900;
}

.shop-trade-meta {
  grid-column: 1 / 2;
  color: #60727c;
  font-size: 11px;
  font-weight: 800;
}

.shop-trade-button {
  grid-column: 2 / 3;
  grid-row: 1 / span 2;
  min-width: 54px;
  min-height: 32px;
  border: 0;
  border-radius: 8px;
  color: #fff;
  background: #0d6b51;
  font: inherit;
  font-size: 12px;
  font-weight: 900;
  cursor: pointer;
}

.shop-trade-button:disabled {
  color: #7f8a91;
  background: #d9e1df;
  cursor: not-allowed;
}

.floating-storage {
  position: fixed;
  top: 88px;
  left: calc(50vw - 190px);
  right: auto;
  z-index: 2147483647;
  width: min(380px, calc(100vw - 24px));
  max-height: min(560px, calc(100vh - 112px));
  overflow: auto;
  background: rgba(255, 255, 255, 0.98);
  box-shadow: 0 28px 90px rgba(21, 41, 34, 0.42);
  pointer-events: auto;
}

.storage-panel.is-open {
  border-color: rgba(13, 107, 81, 0.72);
  box-shadow: 0 28px 90px rgba(13, 107, 81, 0.28), 0 0 0 9999px rgba(21, 41, 34, 0.08);
}

.floating-storage.is-open {
  display: block !important;
  visibility: visible !important;
  opacity: 1 !important;
  z-index: 2147483647 !important;
}

.storage-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
  color: #17315a;
  font-size: 14px;
  font-weight: 900;
  cursor: grab;
  user-select: none;
}

.storage-title:active {
  cursor: grabbing;
}

.storage-close {
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border: 0;
  border-radius: 8px;
  color: #17315a;
  background: rgba(23, 49, 90, 0.08);
  font: inherit;
  font-size: 18px;
  font-weight: 900;
  line-height: 1;
  cursor: pointer;
}

.storage-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
}

.storage-slot {
  position: relative;
  display: grid;
  grid-template-rows: 28px 12px;
  justify-items: center;
  align-items: center;
  min-width: 0;
  height: 48px;
  padding: 4px;
  border: 2px solid rgba(23, 49, 90, 0.14);
  border-radius: 8px;
  background: linear-gradient(180deg, #fffdf4 0%, #eef8ea 100%);
  user-select: none;
}

.storage-slot.filled {
  cursor: grab;
}

.storage-slot.empty {
  background: rgba(241, 246, 241, 0.78);
}

.storage-slot.drag-source {
  opacity: 0.55;
}

.campfire-panel {
  padding: 10px;
  border: 2px solid rgba(216, 117, 42, 0.34);
  border-radius: 8px;
  background: rgba(255, 250, 240, 0.96);
  box-shadow: 0 18px 50px rgba(119, 59, 28, 0.16);
}

.floating-campfire {
  position: fixed;
  top: 72px;
  left: calc(50vw - 250px);
  right: auto;
  z-index: 2147483646;
  width: min(500px, calc(100vw - 24px));
  max-height: min(580px, calc(100vh - 104px));
  overflow: auto;
  background: rgba(255, 250, 240, 0.98);
  box-shadow: 0 28px 90px rgba(119, 59, 28, 0.34);
  pointer-events: auto;
}

.campfire-panel.is-open {
  border-color: rgba(216, 117, 42, 0.82);
  box-shadow: 0 28px 90px rgba(216, 117, 42, 0.24), 0 0 0 9999px rgba(21, 41, 34, 0.06);
}

.floating-campfire.is-open {
  display: block !important;
  visibility: visible !important;
  opacity: 1 !important;
  z-index: 2147483646 !important;
}

.farm-panel {
  padding: 10px;
  border: 2px solid rgba(63, 154, 85, 0.34);
  border-radius: 8px;
  background: rgba(246, 253, 246, 0.97);
  box-shadow: 0 18px 50px rgba(47, 92, 58, 0.16);
}

.floating-farm {
  position: fixed;
  top: 86px;
  left: calc(50vw - 230px);
  z-index: 2147483646;
  width: min(460px, calc(100vw - 24px));
  max-height: min(600px, calc(100vh - 112px));
  overflow: auto;
  pointer-events: auto;
}

.farm-title,
.farm-weather,
.farm-status {
  color: #17315a;
  font-weight: 900;
}

.farm-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
  font-size: 15px;
}

.farm-close {
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border: 0;
  border-radius: 8px;
  color: #0d6b51;
  background: rgba(63, 154, 85, 0.14);
  font: inherit;
  font-size: 18px;
  font-weight: 900;
  cursor: pointer;
}

.farm-weather,
.farm-status {
  margin-bottom: 8px;
  color: #60727c;
  font-size: 12px;
}

.farm-progress {
  height: 9px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(23, 49, 90, 0.12);
}

.farm-progress-fill {
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #3f9a55, #ffd166);
  transition: width 0.18s linear;
}

.farm-harvest {
  width: 100%;
  min-height: 34px;
  margin: 8px 0;
  border: 0;
  border-radius: 8px;
  color: #fff;
  background: #0d6b51;
  font: inherit;
  font-weight: 900;
  cursor: pointer;
}

.farm-harvest:disabled {
  color: #7f8a91;
  background: #d9e1df;
  cursor: not-allowed;
}

.farm-crop-list {
  display: grid;
  gap: 6px;
}

.farm-crop {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr);
  gap: 8px;
  align-items: center;
  min-height: 54px;
  padding: 7px;
  border: 1px solid rgba(13, 107, 81, 0.18);
  border-radius: 8px;
  color: #17315a;
  background: rgba(255, 255, 255, 0.76);
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.farm-crop strong,
.farm-crop small {
  display: block;
}

.farm-crop small {
  margin-top: 2px;
  color: #60727c;
  font-size: 11px;
  font-weight: 800;
}

.farm-crop:disabled,
.farm-crop.disabled {
  opacity: 0.56;
  cursor: not-allowed;
}

.campfire-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
  color: #4a220a;
  font-size: 14px;
  font-weight: 900;
  cursor: grab;
  user-select: none;
}

.campfire-title:active {
  cursor: grabbing;
}

.campfire-close {
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border: 0;
  border-radius: 8px;
  color: #4a220a;
  background: rgba(216, 117, 42, 0.14);
  font: inherit;
  font-size: 18px;
  font-weight: 900;
  line-height: 1;
  cursor: pointer;
}

.campfire-workbench {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto 78px;
  gap: 10px;
  align-items: center;
}

.campfire-label {
  margin-bottom: 6px;
  color: #7a4422;
  font-size: 12px;
  font-weight: 900;
}

.campfire-input-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(58px, 1fr));
  gap: 6px;
}

.campfire-output-grid {
  display: grid;
  grid-template-columns: 70px;
  gap: 6px;
}

.campfire-output-slot {
  height: 58px;
  border-color: rgba(216, 117, 42, 0.36);
  background: linear-gradient(180deg, #fff7df 0%, #ffe0a3 100%);
}

.campfire-center {
  display: grid;
  place-items: center;
}

.campfire-process {
  min-width: 68px;
  min-height: 34px;
  border: 0;
  border-radius: 8px;
  color: #fff;
  background: #d8752a;
  font: inherit;
  font-size: 13px;
  font-weight: 900;
  cursor: pointer;
  box-shadow: 0 10px 22px rgba(216, 117, 42, 0.26);
}

.campfire-recipes {
  display: grid;
  gap: 6px;
  margin-top: 10px;
}

.campfire-recipe {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding: 7px 8px;
  border-radius: 8px;
  color: #4a220a;
  background: rgba(255, 255, 255, 0.62);
  font-size: 12px;
}

.campfire-recipe strong {
  white-space: nowrap;
}

.bed-panel {
  position: absolute;
  top: 14px;
  left: 50%;
  z-index: 25;
  display: grid;
  gap: 8px;
  width: min(360px, calc(100% - 28px));
  padding: 10px;
  border: 2px solid rgba(216, 117, 42, 0.5);
  border-radius: 8px;
  background: rgba(255, 252, 240, 0.96);
  box-shadow: 0 18px 60px rgba(86, 59, 34, 0.2);
  transform: translateX(-50%);
}

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

.bed-title {
  color: #17315a;
  font-weight: 900;
}

.bed-status,
.bed-info,
.bed-upgrade-cost {
  color: #6b5848;
  font-size: 12px;
  font-weight: 800;
  line-height: 1.45;
}

.floating-close {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border: 0;
  border-radius: 8px;
  color: #7a4422;
  background: rgba(216, 117, 42, 0.16);
  font-size: 18px;
  font-weight: 900;
  cursor: pointer;
}

.bed-progress {
  height: 9px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(23, 49, 90, 0.12);
}

.bed-progress-fill {
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: #d8752a;
  transition: width 120ms linear;
}

.bed-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.bed-actions button {
  min-height: 34px;
  border: 0;
  border-radius: 8px;
  color: #fffdf6;
  background: #d8752a;
  font-weight: 900;
  cursor: pointer;
}

.bed-actions button:last-child {
  background: #0d6b51;
}

.bed-actions button:disabled {
  color: #7f8a91;
  background: #d9e1df;
  cursor: not-allowed;
}

.save-panel {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 6px;
  border: 2px solid rgba(23, 49, 90, 0.14);
  background: rgba(255, 255, 255, 0.88);
  margin-top: auto;
}

.save-button,
.pause-button,
.max-window-button,
.restart-button {
  flex: 1 1 92px;
  min-width: 74px;
  min-height: 34px;
  border: 0;
  border-radius: 8px;
  color: #fff;
  font: inherit;
  font-size: 13px;
  font-weight: 900;
  cursor: pointer;
}

.save-button {
  background: #0d6b51;
}

.pause-button {
  background: #d8752a;
}

.pause-button.is-paused {
  background: #17315a;
}

.max-window-button {
  background: #2f86c5;
}

.max-window-button.is-active {
  background: #17315a;
}

.restart-button {
  color: #17315a;
  background: rgba(23, 49, 90, 0.1);
}

.equipment-bar {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
  width: 100%;
  padding: 7px;
  border: 2px solid rgba(13, 107, 81, 0.2);
  border-radius: 8px;
  background: rgba(247, 252, 247, 0.92);
}

.equipment-slot {
  position: relative;
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr);
  grid-template-rows: 14px 24px 14px;
  gap: 2px 6px;
  align-items: center;
  min-width: 0;
  height: 62px;
  padding: 5px 6px;
  border: 2px solid rgba(13, 107, 81, 0.18);
  border-radius: 8px;
  background: linear-gradient(180deg, #fffdf4 0%, #eaf7ee 100%);
  user-select: none;
}

.equipment-slot.filled {
  cursor: grab;
}

.equipment-slot.empty {
  color: #6f7d77;
  background: rgba(241, 247, 241, 0.78);
}

.equipment-slot.drag-source {
  opacity: 0.55;
}

.equipment-label {
  grid-column: 1 / -1;
  color: #0d6b51;
  font-size: 11px;
  font-weight: 900;
}

.equipment-slot .item-mark {
  grid-column: 1;
  grid-row: 2;
}

.equipment-name,
.equipment-count {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 11px;
  font-weight: 900;
}

.equipment-name {
  grid-column: 2;
  grid-row: 2;
  color: #17315a;
}

.equipment-count {
  grid-column: 1 / -1;
  grid-row: 3;
  color: #60727c;
}

.inventory-bar {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 58px;
  grid-template-columns: none;
  gap: 6px;
  width: 100%;
  max-width: none;
  padding: 7px;
  border: 2px solid rgba(23, 49, 90, 0.16);
  background: rgba(255, 255, 255, 0.88);
  overflow-x: auto;
}

.inventory-slot {
  position: relative;
  display: grid;
  grid-template-rows: 26px auto auto;
  justify-items: center;
  align-items: center;
  min-width: 58px;
  height: 58px;
  padding: 5px 4px 4px;
  border: 2px solid rgba(23, 49, 90, 0.14);
  border-radius: 8px;
  background: linear-gradient(180deg, #fffdf4 0%, #eef8ea 100%);
  user-select: none;
}

.inventory-slot.filled {
  cursor: grab;
}

.inventory-slot.empty {
  color: #8a969e;
  background: rgba(241, 246, 241, 0.78);
}

.inventory-empty-hint {
  display: flex;
  align-items: center;
  min-width: 150px;
  height: 58px;
  padding: 0 12px;
  color: #60727c;
  font-size: 13px;
  font-weight: 800;
}

.inventory-slot.drag-source {
  opacity: 0.55;
}

.item-mark {
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border-radius: 8px;
  color: #fff;
  font-size: 15px;
  font-weight: 900;
  line-height: 1;
}

.item-mark.axe {
  background: #69798a;
  box-shadow: inset 10px -8px 0 rgba(123, 74, 43, 0.5);
}

.item-mark.wood {
  background: #8d5a34;
}

.item-mark.stone {
  background: #7a8898;
}

.item-mark.ironOre {
  background: #5f6770;
  box-shadow: inset 0 -8px 0 rgba(216, 164, 65, 0.45);
}

.item-mark.workbench {
  background: #9b6a3a;
}

.item-mark.storageBox {
  background: #b06d2c;
}

.item-mark.feedingTrough {
  background: #a76d3e;
  box-shadow: inset 0 -8px 0 rgba(63, 154, 85, 0.48);
}

.item-mark.bed {
  background: #4c78a8;
}

.item-mark.campfire {
  background: #d8752a;
}

.item-mark.fence {
  background: #7c5a34;
}

.item-mark.woodenGate {
  background: #6f4a2a;
}

.item-mark.berry {
  background: #b23a61;
}

.item-mark.fiber {
  background: #3f9a55;
}

.item-mark.waterDrop {
  background: #2f86c5;
}

.item-mark.mushroomSeed,
.item-mark.cabbageSeed,
.item-mark.spinachSeed,
.item-mark.pumpkinSeed,
.item-mark.watermelonSeed {
  background: #6f8f3a;
}

.item-mark.mushroom {
  background: #9b7f70;
}

.item-mark.cabbage,
.item-mark.spinach {
  background: #3f9a55;
}

.item-mark.pumpkin {
  background: #d8752a;
}

.item-mark.watermelon {
  background: #2f8f46;
  box-shadow: inset 0 -8px 0 rgba(216, 80, 64, 0.45);
}

.item-mark.farm {
  background: #7b5a35;
  box-shadow: inset 0 -8px 0 rgba(63, 154, 85, 0.55);
}

.item-mark.waterPurifier {
  background: #2f86c5;
  box-shadow: inset 0 -8px 0 rgba(255, 255, 255, 0.34);
}

.item-mark.rope {
  background: #c99a4a;
}

.item-mark.weaponBench {
  background: #4f5d73;
}

.item-mark.robotFactory {
  background: #2f86c5;
  box-shadow: inset 0 -8px 0 rgba(255, 209, 102, 0.36);
}

.item-mark.barracks {
  background: #6b4a34;
}

.item-mark.shop {
  background: #d8a441;
}

.item-mark.gun {
  background: #263241;
}

.item-mark.bullet {
  background: #7b6f46;
}

.item-mark.radar {
  background: #17315a;
  box-shadow: inset 0 -8px 0 rgba(47, 134, 197, 0.52);
}

.item-mark.landMine {
  background: #4f5661;
  box-shadow: inset 0 -8px 0 rgba(216, 80, 64, 0.38);
}

.item-mark.miningMachine {
  background: #59616b;
}

.item-mark.ironMiningRobot {
  background: #6f7680;
  box-shadow: inset 0 -8px 0 rgba(216, 164, 65, 0.48);
}

.item-mark.lumberMachine {
  background: #8d5a34;
}

.item-mark.grassMachine {
  background: #3f9a55;
}

.item-mark.berryMachine {
  background: #b23a61;
}

.item-mark.pickupRobot {
  background: #2f86c5;
}

.item-mark.repairRobot {
  background: #d8752a;
}

.item-mark.resourceDepot {
  background: #0d6b51;
}

.item-mark.cityWall {
  background: #687586;
}

.item-mark.watchtower {
  background: #5b6b46;
}

.item-mark.magicTower {
  background: linear-gradient(135deg, #d8752a 0%, #5f8fd8 100%);
}

.item-mark.summonTower {
  background: #4f3b63;
  box-shadow: inset 0 -8px 0 rgba(216, 117, 42, 0.45);
}

.item-mark.feather {
  background: #f1c453;
}

.item-mark.wool {
  background: #9aa5af;
}

.item-mark.milk {
  background: #f2f6ff;
  color: #17315a;
  box-shadow: inset 0 -8px 0 rgba(76, 120, 168, 0.36);
}

.item-mark.hotMilk {
  background: linear-gradient(145deg, #fff6d8, #f2b15a);
  color: #4a220a;
  box-shadow: inset 0 -8px 0 rgba(186, 103, 35, 0.34);
}

.item-mark.egg {
  background: #f6e1a6;
  color: #17315a;
  box-shadow: inset 0 -8px 0 rgba(216, 164, 65, 0.42);
}

.item-mark.eggRoll {
  background: linear-gradient(145deg, #ffd166, #f39c3d);
  color: #4a220a;
  box-shadow: inset 0 -8px 0 rgba(169, 90, 18, 0.34);
}

.item-mark.meleeSoldier {
  background: #2f86c5;
}

.item-mark.rangedSoldier {
  background: #5b6b46;
}

.item-mark.dragon {
  background: #b23a61;
}

.item-mark.battleRobot {
  background: #4f5661;
  box-shadow: inset 0 -8px 0 rgba(255, 209, 102, 0.45);
}

.item-mark.empty {
  color: #8a969e;
  background: rgba(138, 150, 158, 0.16);
}

.item-name {
  margin-top: 1px;
  color: #17315a;
  font-size: 10px;
  font-weight: 800;
  line-height: 1.1;
  white-space: nowrap;
}

.item-count {
  margin-top: 1px;
  color: #0d6b51;
  font-size: 10px;
  line-height: 1.1;
  white-space: nowrap;
}

.drag-ghost {
  position: fixed;
  display: grid;
  grid-template-columns: 30px auto;
  gap: 8px;
  align-items: center;
  min-width: 116px;
  padding: 8px 10px;
  border: 2px solid rgba(23, 49, 90, 0.16);
  border-radius: 8px;
  color: #17315a;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 16px 36px rgba(34, 64, 54, 0.24);
  pointer-events: none;
  z-index: 20;
}

.touch-controls {
  position: absolute;
  inset: auto 16px 108px 16px;
  display: none;
  justify-content: space-between;
  align-items: end;
  pointer-events: none;
  z-index: 3;
}

.dpad {
  display: grid;
  grid-template-columns: repeat(3, 54px);
  grid-template-rows: repeat(3, 54px);
  gap: 7px;
}

.touch-btn,
.attack-btn,
.overlay button {
  border: 0;
  border-radius: 8px;
  font: inherit;
  font-weight: 800;
  cursor: pointer;
  user-select: none;
}

.touch-btn,
.attack-btn {
  pointer-events: auto;
  color: #17315a;
  background: rgba(255, 255, 255, 0.86);
  border: 2px solid rgba(23, 49, 90, 0.16);
  box-shadow: 0 12px 28px rgba(34, 64, 54, 0.18);
}

.touch-btn {
  min-width: 54px;
  min-height: 54px;
  font-size: 24px;
}

.touch-btn[data-dir="up"] {
  grid-column: 2;
  grid-row: 1;
}

.touch-btn[data-dir="up-left"] {
  grid-column: 1;
  grid-row: 1;
}

.touch-btn[data-dir="up-right"] {
  grid-column: 3;
  grid-row: 1;
}

.touch-btn[data-dir="left"] {
  grid-column: 1;
  grid-row: 2;
}

.touch-btn[data-dir="right"] {
  grid-column: 3;
  grid-row: 2;
}

.touch-btn[data-dir="down"] {
  grid-column: 2;
  grid-row: 3;
}

.touch-btn[data-dir="down-left"] {
  grid-column: 1;
  grid-row: 3;
}

.touch-btn[data-dir="down-right"] {
  grid-column: 3;
  grid-row: 3;
}

.attack-btn {
  width: 92px;
  height: 92px;
  color: #fff;
  background: #d8752a;
  border-color: rgba(255, 255, 255, 0.42);
  font-size: 20px;
}

.overlay {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(21, 41, 34, 0.52);
  z-index: 12;
}

.dialog {
  width: min(500px, 100%);
  padding: 24px;
  border: 2px solid rgba(255, 255, 255, 0.7);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.96);
  text-align: center;
  box-shadow: 0 24px 70px rgba(21, 41, 34, 0.28);
}

.dialog h2 {
  margin: 0 0 10px;
  color: #17315a;
  font-size: clamp(26px, 4vw, 38px);
}

.dialog p {
  margin: 0 0 18px;
  color: #5f6d74;
  line-height: 1.7;
}

.overlay button {
  min-width: 210px;
  min-height: 50px;
  color: #fff;
  background: #0d6b51;
  box-shadow: 0 12px 28px rgba(13, 107, 81, 0.24);
}

.hidden {
  display: none;
}

@media (max-width: 980px) {
  body {
    overflow: auto;
  }

  .shell {
    grid-template-rows: auto auto;
    width: min(100vw - 16px, 680px);
    height: auto;
    min-height: calc(100vh - 16px);
    margin: 8px auto;
  }

  .topbar {
    grid-template-columns: 1fr;
  }

  .hud {
    min-width: 0;
  }

  .hud-resources {
    grid-template-columns: repeat(3, minmax(72px, 1fr));
  }

  .hud-chip strong {
    font-size: 16px;
  }

  .play-layout {
    grid-template-columns: 1fr;
  }

  .center-stage {
    order: 1;
  }

  .left-panel {
    order: 2;
  }

  .right-panel {
    order: 3;
    overflow: visible;
    padding-right: 0;
  }

  .game-panel {
    height: min(58vh, 520px);
  }

  .craft-panel {
    max-height: 360px;
  }

  .craft-list {
    max-height: 300px;
  }

  .inventory-bar {
    grid-auto-columns: 54px;
    grid-template-columns: none;
    gap: 5px;
    padding: 6px;
  }

  .equipment-bar {
    gap: 5px;
    padding: 6px;
  }

  .equipment-slot {
    height: 58px;
    padding: 4px 5px;
  }

  .inventory-slot {
    min-width: 54px;
    height: 56px;
  }

  .floating-storage {
    top: 14px;
    left: 12px;
    right: auto;
    width: auto;
    max-height: min(500px, calc(100vh - 28px));
  }

  .floating-campfire {
    top: 18px;
    left: 12px;
    right: auto;
    width: calc(100vw - 24px);
    max-height: min(580px, calc(100vh - 36px));
  }

  .campfire-workbench {
    grid-template-columns: 1fr;
  }

  .campfire-input-grid {
    grid-template-columns: repeat(3, minmax(52px, 1fr));
  }

  .campfire-output-grid {
    grid-template-columns: 76px;
  }

  .floating-barracks {
    top: 18px;
    left: 12px;
    right: auto;
    width: calc(100vw - 24px);
    max-height: min(620px, calc(100vh - 36px));
  }

  .floating-weapon-bench {
    top: 22px;
    left: 12px;
    right: auto;
    width: calc(100vw - 24px);
    max-height: min(620px, calc(100vh - 44px));
  }

  .floating-robot-factory {
    top: 26px;
    left: 12px;
    right: auto;
    width: calc(100vw - 24px);
    max-height: min(620px, calc(100vh - 52px));
  }

  .floating-shop {
    top: 22px;
    left: 12px;
    right: auto;
    width: calc(100vw - 24px);
    max-height: min(560px, calc(100vh - 44px));
  }

  .touch-controls {
    display: flex;
  }
}
