* {
  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.28), transparent 22%),
    radial-gradient(circle at 84% 16%, rgba(47, 134, 197, 0.22), transparent 24%),
    linear-gradient(180deg, #dfeaf2 0%, #e8f4e5 58%, #d8e7dc 100%);
  overflow: hidden;
}

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

.shell {
  display: grid;
  grid-template-rows: 66px minmax(0, 1fr);
  gap: 7px;
  width: min(1720px, calc(100vw - 12px));
  height: min(980px, calc(100vh - 10px));
  margin: 5px auto;
}

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

.topbar {
  display: grid;
  grid-template-columns: minmax(300px, 0.68fr) minmax(660px, 1.32fr);
  gap: 7px;
  align-items: stretch;
  min-width: 0;
}

body.max-window .topbar {
  grid-template-columns: minmax(260px, 0.58fr) minmax(680px, 1.42fr);
}

.title-card,
.hud,
.game-panel,
.message,
.goal-panel,
.wave-panel,
.craft-panel,
.storage-panel,
.save-panel,
.inventory-bar {
  border: 1px solid rgba(20, 45, 40, 0.14);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: 0 16px 46px rgba(36, 68, 61, 0.16);
  backdrop-filter: blur(12px);
}

.play-layout {
  display: grid;
  grid-template-columns: 220px minmax(720px, 1fr) 236px;
  gap: 7px;
  min-height: 0;
}

body.max-window .play-layout {
  grid-template-columns: 204px minmax(780px, 1fr) 220px;
  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 auto;
  gap: 6px;
  min-width: 0;
  min-height: 0;
}

.title-card {
  display: flex;
  align-items: center;
  gap: 10px;
  position: relative;
  min-width: 0;
  padding: 8px 12px;
}

.game-mark {
  display: grid;
  flex: 0 0 auto;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 8px;
  color: #fff;
  background: linear-gradient(145deg, #0d6b51, #24556c);
  box-shadow: inset 0 -14px 0 rgba(0, 0, 0, 0.14), 0 10px 22px rgba(13, 107, 81, 0.2);
  font-size: 18px;
  font-weight: 1000;
}

.title-copy {
  min-width: 0;
}

.build-badge {
  flex: 0 0 auto;
  margin-left: auto;
  padding: 5px 8px;
  border-radius: 8px;
  color: #0d6b51;
  background: rgba(13, 107, 81, 0.1);
  font-size: 11px;
  font-weight: 900;
  white-space: nowrap;
}

h1 {
  margin: 0;
  color: #17315a;
  font-size: clamp(20px, 1.8vw, 27px);
  line-height: 1.05;
  letter-spacing: 0;
}

.subtitle {
  margin: 4px 0 0;
  overflow: hidden;
  color: #5f6d74;
  font-size: 12px;
  font-weight: 800;
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.hud {
  display: grid;
  grid-template-columns: 104px minmax(220px, 0.8fr) minmax(430px, 1.2fr);
  align-items: center;
  gap: 10px;
  min-width: 0;
  padding: 8px 10px;
}

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

.hud-head {
  display: grid;
  gap: 4px;
}

.hud-bars {
  display: grid;
  gap: 6px;
  min-width: 0;
}

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

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

.hud-head strong,
.hud-energy-label strong {
  color: #17315a;
  font-size: 13px;
  font-weight: 1000;
  line-height: 1;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.hud-head strong {
  font-size: 20px;
}

.hud-resources {
  display: grid;
  grid-template-columns: repeat(6, minmax(52px, 1fr));
  gap: 6px;
  min-width: 0;
}

.hud-chip {
  display: grid;
  grid-template-columns: 20px minmax(0, 1fr);
  grid-template-rows: 18px 15px;
  align-items: center;
  min-height: 39px;
  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;
  grid-row: 1 / 3;
  place-items: center;
  height: 100%;
  color: #fff;
  font-size: 11px;
  font-weight: 1000;
}

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

.hud-chip small {
  min-width: 0;
  padding: 0 6px 3px;
  overflow: hidden;
  color: #60727c;
  font-size: 9px;
  font-weight: 900;
  line-height: 1;
  text-align: right;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.hud-chip.no-network small {
  color: #8a969e;
}

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

.hud-energy {
  display: grid;
  grid-template-columns: 68px minmax(92px, 1fr);
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.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;
  border-color: rgba(20, 75, 55, 0.2);
  background: #74b864;
  box-shadow: 0 20px 62px rgba(28, 65, 43, 0.24);
}

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

.message {
  padding: 8px 10px;
  border: 1px dashed rgba(23, 49, 90, 0.18);
  background: rgba(255, 255, 255, 0.72);
  color: #60727c;
  font-size: 12px;
  font-weight: 800;
  line-height: 1.45;
}

.unit-status-panel {
  position: absolute;
  top: 10px;
  left: 10px;
  z-index: 9;
  width: min(258px, calc(100% - 20px));
  padding: 7px;
  overflow: hidden;
  border: 1px solid rgba(47, 134, 197, 0.42);
  border-left-width: 4px;
  border-radius: 10px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.96), rgba(238, 248, 255, 0.88)),
    rgba(255, 255, 255, 0.92);
  box-shadow: 0 12px 28px rgba(23, 49, 90, 0.18);
  backdrop-filter: blur(10px) saturate(1.1);
  pointer-events: auto;
}

.unit-status-panel.is-robot {
  border-color: rgba(13, 107, 81, 0.42);
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.96), rgba(237, 250, 245, 0.9)),
    rgba(255, 255, 255, 0.92);
}

.unit-status-panel.is-multi {
  border-color: rgba(216, 164, 65, 0.58);
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.97), rgba(255, 248, 223, 0.9)),
    rgba(255, 255, 255, 0.92);
}

.unit-status-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  color: #17315a;
  font-size: 13px;
  font-weight: 1000;
  line-height: 1.15;
}

.unit-status-head span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.unit-status-head strong {
  flex: 0 0 auto;
  padding: 2px 6px;
  border-radius: 999px;
  color: #fff;
  background: #2f86c5;
  font-size: 10px;
  font-weight: 1000;
  letter-spacing: 0;
}

.unit-status-panel.is-robot .unit-status-head strong {
  background: #0d6b51;
}

.unit-status-panel.is-multi .unit-status-head strong {
  color: #513725;
  background: #d8a441;
}

.unit-status-kind,
.unit-status-detail {
  margin-top: 3px;
  overflow: hidden;
  color: #60727c;
  font-size: 11px;
  font-weight: 800;
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}

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

.unit-status-stats div {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 5px;
  min-width: 0;
  min-height: 23px;
  padding: 3px 5px;
  border: 1px solid rgba(47, 134, 197, 0.14);
  border-radius: 7px;
  background: rgba(47, 134, 197, 0.075);
}

.unit-status-panel.is-robot .unit-status-stats div {
  background: rgba(13, 107, 81, 0.08);
  border-color: rgba(13, 107, 81, 0.15);
}

.unit-status-panel.is-multi .unit-status-stats div {
  background: rgba(216, 164, 65, 0.1);
  border-color: rgba(216, 164, 65, 0.18);
}

.unit-status-stats span {
  flex: 0 0 auto;
  color: #60727c;
  font-size: 10px;
  line-height: 1;
}

.unit-status-stats strong {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  color: #17315a;
  font-size: 11px;
  font-weight: 1000;
  line-height: 1;
  text-align: right;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.unit-status-action {
  margin-top: 6px;
  padding: 5px 7px;
  overflow: hidden;
  border: 1px solid rgba(23, 49, 90, 0.08);
  border-radius: 7px;
  color: #17315a;
  background: rgba(23, 49, 90, 0.06);
  font-size: 11px;
  font-weight: 1000;
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.goal-panel {
  padding: 10px;
  border: 1px solid rgba(23, 49, 90, 0.14);
  background: rgba(255, 255, 255, 0.9);
}

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

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

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

.wave-panel {
  padding: 10px;
  border: 1px solid rgba(23, 49, 90, 0.14);
  background: rgba(255, 255, 255, 0.9);
}

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

.wave-main {
  margin-top: 4px;
  color: #0d6b51;
  font-size: 17px;
  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: 9px;
  border: 1px solid rgba(47, 134, 197, 0.2);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: 0 16px 46px rgba(44, 78, 62, 0.14);
}

.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: 8px;
  border: 1px solid rgba(23, 49, 90, 0.16);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(241, 247, 244, 0.92)),
    rgba(255, 255, 255, 0.92);
}

.craft-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 7px;
  padding: 0 2px 6px;
  border-bottom: 1px solid rgba(23, 49, 90, 0.1);
  color: #17315a;
  font-size: 13px;
  font-weight: 900;
}

.craft-title span:first-child {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.craft-title span:first-child::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 3px;
  background: #d8a441;
  box-shadow: 0 0 0 3px rgba(216, 164, 65, 0.16);
}

.craft-title span:last-child {
  min-width: 0;
  padding: 3px 7px;
  overflow: hidden;
  border: 1px solid rgba(13, 107, 81, 0.18);
  border-radius: 999px;
  color: #0d6b51;
  background: rgba(13, 107, 81, 0.08);
  font-size: 10px;
  font-weight: 900;
  line-height: 1.1;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.craft-list {
  display: grid;
  gap: 5px;
  max-height: calc(100% - 32px);
  overflow: auto;
  padding: 1px 2px 2px 0;
  scrollbar-width: thin;
}

.craft-recipe {
  position: relative;
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr) auto;
  gap: 6px;
  align-items: center;
  min-height: 46px;
  padding: 5px 6px 5px 7px;
  overflow: visible;
  border: 1px solid rgba(23, 49, 90, 0.12);
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.96), rgba(235, 242, 239, 0.78)),
    rgba(255, 255, 255, 0.72);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.8);
  outline: none;
}

.craft-recipe::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 3px;
  background: #d8a441;
  opacity: 0.42;
}

.craft-recipe.can-craft {
  border-color: rgba(13, 107, 81, 0.24);
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.98), rgba(231, 244, 237, 0.86)),
    rgba(255, 255, 255, 0.76);
}

.craft-recipe.can-craft::before {
  background: #0d6b51;
  opacity: 0.74;
}

.craft-recipe.cannot-craft {
  border-color: rgba(23, 49, 90, 0.1);
}

.craft-recipe:hover {
  border-color: rgba(23, 49, 90, 0.22);
  box-shadow:
    0 8px 18px rgba(23, 49, 90, 0.1),
    inset 0 1px 0 rgba(255, 255, 255, 0.8);
  transition: border-color 0.16s ease, box-shadow 0.16s ease;
}

.craft-recipe:focus-visible {
  border-color: rgba(13, 107, 81, 0.4);
  box-shadow:
    0 0 0 2px rgba(13, 107, 81, 0.12),
    inset 0 1px 0 rgba(255, 255, 255, 0.8);
}

.craft-icon {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border: 1px solid rgba(255, 255, 255, 0.58);
  border-radius: 8px;
  color: #fff;
  background: #8d5a34;
  box-shadow:
    inset 0 -12px 0 rgba(69, 43, 24, 0.25),
    0 5px 12px rgba(23, 49, 90, 0.1);
  font-size: 11px;
  font-weight: 900;
}

.craft-main {
  min-width: 0;
}

.craft-recipe-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 4px;
}

.craft-name {
  margin: 0;
  overflow: hidden;
  color: #17315a;
  font-size: 12px;
  font-weight: 900;
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.craft-output {
  padding: 1px 4px;
  border-radius: 999px;
  color: #5a4320;
  background: rgba(216, 164, 65, 0.18);
  font-size: 9px;
  font-weight: 1000;
  line-height: 1;
}

.craft-cost {
  margin: 2px 0 0;
  color: #60727c;
  font-size: 10px;
  font-weight: 800;
  line-height: 1.15;
}

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

.craft-materials {
  position: absolute;
  z-index: 20;
  top: auto;
  bottom: calc(100% + 2px);
  left: 38px;
  right: 6px;
  display: block;
  padding: 8px;
  border: 1px solid rgba(23, 49, 90, 0.18);
  border-radius: 9px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(238, 245, 241, 0.96)),
    #fff;
  box-shadow: 0 16px 30px rgba(23, 49, 90, 0.18);
  opacity: 0;
  pointer-events: none;
  transform: translateY(3px);
  transition: opacity 0.14s ease, transform 0.14s ease;
}

.craft-recipe:hover .craft-materials,
.craft-recipe:focus-within .craft-materials {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

.craft-materials::before {
  content: "";
  position: absolute;
  top: auto;
  bottom: -6px;
  left: 18px;
  width: 10px;
  height: 10px;
  border-right: 1px solid rgba(23, 49, 90, 0.18);
  border-bottom: 1px solid rgba(23, 49, 90, 0.18);
  background: rgba(255, 255, 255, 0.98);
  transform: rotate(45deg);
}

.craft-recipe:nth-child(-n + 2) .craft-materials {
  top: calc(100% + 2px);
  bottom: auto;
  transform: translateY(-3px);
}

.craft-recipe:nth-child(-n + 2) .craft-materials::before {
  top: -6px;
  bottom: auto;
  border-top: 1px solid rgba(23, 49, 90, 0.18);
  border-left: 1px solid rgba(23, 49, 90, 0.18);
  border-right: 0;
  border-bottom: 0;
}

.craft-materials-title {
  margin-bottom: 6px;
  color: #17315a;
  font-size: 10px;
  font-weight: 1000;
}

.craft-materials-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.craft-material {
  display: inline-grid;
  grid-template-columns: 18px auto;
  align-items: center;
  gap: 4px;
  max-width: 100%;
  min-height: 22px;
  padding: 2px 5px 2px 2px;
  border: 1px solid rgba(23, 49, 90, 0.12);
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.74);
  color: #17315a;
}

.craft-material.ready {
  border-color: rgba(13, 107, 81, 0.2);
  background: rgba(13, 107, 81, 0.08);
}

.craft-material.missing {
  border-color: rgba(216, 80, 64, 0.22);
  background: rgba(216, 80, 64, 0.08);
  color: #9a332b;
}

.craft-material-mark {
  width: 18px;
  height: 18px;
  border-radius: 6px;
  font-size: 11px;
}

.craft-material-count {
  min-width: 0;
  overflow: hidden;
  font-size: 10px;
  font-weight: 1000;
  line-height: 1;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.craft-detail-text {
  margin: 6px 0 0;
  color: #60727c;
  font-size: 10px;
  font-weight: 800;
  line-height: 1.3;
}

.craft-action {
  display: grid;
  grid-template-columns: auto;
  gap: 3px;
  align-items: center;
  justify-items: end;
}

.craft-status {
  max-width: 58px;
  overflow: hidden;
  padding: 2px 5px;
  border-radius: 999px;
  color: #60727c;
  background: rgba(23, 49, 90, 0.06);
  font-size: 9px;
  font-weight: 800;
  line-height: 1;
  text-align: center;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.can-craft .craft-status {
  color: #0d6b51;
  background: rgba(13, 107, 81, 0.1);
}

.cannot-craft .craft-status {
  color: #9a332b;
  background: rgba(216, 80, 64, 0.1);
}

.craft-button {
  min-width: 48px;
  min-height: 24px;
  border: 0;
  border-radius: 6px;
  color: #fff;
  background: linear-gradient(180deg, #168160, #0d6b51);
  font: inherit;
  font-size: 10px;
  font-weight: 900;
  cursor: pointer;
  box-shadow: 0 5px 12px rgba(13, 107, 81, 0.18);
}

.craft-button:hover:not(:disabled) {
  filter: brightness(1.04);
  transform: translateY(-1px);
}

.craft-button:disabled {
  color: #89939a;
  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 {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-top: 7px;
  color: #60727c;
  font-size: 12px;
  line-height: 1.35;
}

.shop-gold,
.shop-refresh {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 26px;
  padding: 4px 8px;
  border-radius: 8px;
  background: rgba(216, 164, 65, 0.16);
  color: #17315a;
  font-weight: 900;
}

.shop-refresh {
  background: rgba(47, 134, 197, 0.12);
  color: #43606d;
}

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

.shop-section {
  display: grid;
  gap: 7px;
  padding: 8px;
  border: 1px solid rgba(23, 49, 90, 0.1);
  border-radius: 8px;
  background: rgba(246, 250, 244, 0.74);
}

.shop-section-title {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  color: #17315a;
}

.shop-section-title strong {
  font-size: 13px;
  font-weight: 1000;
}

.shop-section-title span {
  color: #60727c;
  font-size: 11px;
  font-weight: 800;
}

.shop-section-list {
  display: grid;
  gap: 7px;
}

.shop-empty {
  padding: 10px;
  border: 1px dashed rgba(23, 49, 90, 0.18);
  border-radius: 8px;
  color: #60727c;
  background: rgba(255, 255, 255, 0.58);
  font-size: 12px;
  font-weight: 800;
  text-align: center;
}

.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.buy {
  background: linear-gradient(180deg, #fffdf4 0%, #eef5ff 100%);
}

.shop-trade.sell {
  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.buy .shop-trade-button {
  background: #2f5f9e;
}

.shop-trade.sell .shop-trade-button {
  background: #0d6b51;
}

.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: flex;
  flex-direction: column;
  gap: 8px;
}

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

.storage-network-card {
  display: flex;
  flex-direction: column;
  gap: 7px;
  padding: 8px;
  border: 2px solid rgba(13, 107, 81, 0.18);
  border-radius: 8px;
  background: linear-gradient(180deg, rgba(240, 250, 244, 0.98), rgba(255, 253, 244, 0.98));
}

.storage-network-card-muted {
  color: #5f768a;
  background: rgba(241, 246, 241, 0.86);
}

.storage-network-title,
.storage-network-meta,
.storage-stock-top,
.storage-capacity-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

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

.storage-network-title strong {
  color: #0d6b51;
  font-size: 12px;
}

.storage-network-meta {
  color: #5f768a;
  font-size: 11px;
  font-weight: 800;
}

.storage-network-note {
  font-size: 12px;
  font-weight: 800;
}

.storage-capacity-row {
  color: #17315a;
  font-size: 11px;
  font-weight: 900;
}

.storage-capacity-row .storage-stock-bar {
  flex: 1;
}

.storage-capacity-row .storage-stock-bar i {
  background: #0d6b51;
}

.storage-capacity-row.capacity-tight .storage-stock-bar i {
  background: #d8a441;
}

.storage-capacity-row.capacity-full .storage-stock-bar i {
  background: #d85040;
}

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

.storage-stock-row {
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr) auto;
  align-items: center;
  gap: 6px;
  min-width: 0;
  padding: 5px;
  border: 1px solid rgba(23, 49, 90, 0.1);
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.72);
}

.storage-stock-row.stock-shortage {
  border-color: rgba(216, 80, 64, 0.38);
  background: rgba(255, 240, 236, 0.92);
}

.storage-stock-row.stock-watch {
  border-color: rgba(216, 164, 65, 0.38);
  background: rgba(255, 249, 229, 0.9);
}

.storage-stock-main {
  min-width: 0;
}

.storage-stock-top {
  min-width: 0;
  color: #17315a;
  font-size: 10px;
  font-weight: 900;
}

.storage-stock-top span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.storage-stock-top strong {
  flex: 0 0 auto;
  color: #5f768a;
}

.stock-shortage .storage-stock-top strong {
  color: #d85040;
}

.stock-watch .storage-stock-top strong {
  color: #b37a16;
}

.storage-stock-bar {
  width: 100%;
  height: 7px;
  overflow: hidden;
  border-radius: 99px;
  background: rgba(23, 49, 90, 0.11);
}

.storage-stock-bar i {
  display: block;
  height: 100%;
  min-width: 4px;
  border-radius: inherit;
}

.storage-stock-count {
  min-width: 22px;
  color: #17315a;
  font-size: 10px;
  font-weight: 900;
  text-align: right;
}

.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-actions {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.35fr);
  gap: 8px;
  margin: 8px 0;
}

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

.farm-upgrade {
  background: #d8a441;
}

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

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

.farm-plot-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
  margin-bottom: 6px;
}

.farm-plot {
  display: grid;
  gap: 2px;
  min-height: 54px;
  padding: 6px;
  border: 1px solid rgba(13, 107, 81, 0.16);
  border-radius: 8px;
  color: #17315a;
  background: rgba(255, 255, 255, 0.72);
}

.farm-plot span,
.farm-plot small {
  color: #60727c;
  font-size: 10px;
  font-weight: 900;
}

.farm-plot strong {
  overflow: hidden;
  font-size: 12px;
  font-weight: 900;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.farm-plot.growing {
  background: rgba(255, 246, 218, 0.82);
}

.farm-plot.ready {
  border-color: rgba(63, 154, 85, 0.38);
  background: rgba(221, 247, 224, 0.92);
}

.farm-crop-card {
  display: grid;
  gap: 5px;
}

.farm-crop {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr) 54px;
  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 em {
  color: #0d6b51;
  font-size: 11px;
  font-style: normal;
  font-weight: 900;
  text-align: right;
}

.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.76;
}

.farm-crop.waiting {
  border-color: rgba(216, 164, 65, 0.28);
  background: rgba(255, 249, 230, 0.82);
}

.farm-crop.waiting em {
  color: #a26d12;
}

.farm-recipe-flow {
  display: grid;
  gap: 5px;
  padding-left: 8px;
}

.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-status {
  margin-bottom: 8px;
  color: #7a4422;
  font-size: 12px;
  font-weight: 900;
}

.campfire-meter-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 8px;
  margin-bottom: 10px;
}

.campfire-meter {
  display: grid;
  gap: 4px;
  color: #7a4422;
  font-size: 11px;
  font-weight: 900;
}

.campfire-meter-track {
  height: 9px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(74, 34, 10, 0.12);
}

.campfire-heat-fill,
.campfire-progress-fill {
  width: 0;
  height: 100%;
  border-radius: inherit;
  transition: width 0.18s linear;
}

.campfire-heat-fill {
  background: linear-gradient(90deg, #d85040, #ffd166);
}

.campfire-progress-fill {
  background: linear-gradient(90deg, #2f86c5, #80cfa9);
}

.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 minmax(174px, 210px);
  gap: 10px;
  align-items: center;
}

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

.campfire-input-grid {
  display: block;
}

.campfire-direct-note {
  display: grid;
  gap: 5px;
  min-height: 70px;
  padding: 10px;
  border: 1px solid rgba(216, 117, 42, 0.28);
  border-radius: 8px;
  background: rgba(255, 249, 230, 0.82);
  color: #7a4422;
  font-size: 12px;
  line-height: 1.35;
}

.campfire-direct-note strong {
  color: #4a220a;
  font-size: 13px;
}

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

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

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

.campfire-process {
  min-width: 78px;
  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-queue {
  display: grid;
  gap: 5px;
  min-height: 28px;
  margin-top: 8px;
}

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

.campfire-recipe-card {
  display: grid;
  gap: 5px;
}

.campfire-recipe {
  appearance: none;
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr) 58px;
  align-items: center;
  width: 100%;
  gap: 8px;
  min-height: 58px;
  padding: 7px;
  border: 1px solid rgba(216, 117, 42, 0.2);
  border-radius: 8px;
  color: #4a220a;
  background: rgba(255, 255, 255, 0.62);
  font: inherit;
  font-size: 12px;
  text-align: left;
  cursor: pointer;
}

.campfire-recipe:disabled {
  opacity: 0.72;
  cursor: not-allowed;
}

.campfire-recipe strong {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.campfire-recipe small {
  display: block;
  overflow: hidden;
  margin-top: 2px;
  color: #7a4422;
  font-size: 10px;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.campfire-recipe em {
  color: #d8752a;
  font-size: 11px;
  font-style: normal;
  font-weight: 900;
  text-align: right;
}

.campfire-recipe-card.waiting .campfire-recipe {
  background: rgba(255, 249, 230, 0.75);
}

.campfire-recipe-flow {
  display: grid;
  gap: 5px;
  padding-left: 8px;
}

.campfire-queue-cancel.training,
.campfire-panel .barracks-recipe-progress-fill {
  background: #d8752a;
}

.campfire-queue-cancel.waiting {
  background: #ffd89a;
}

.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;
}

.tower-panel.is-open {
  border-color: rgba(47, 134, 197, 0.56);
  box-shadow: 0 26px 78px rgba(23, 49, 90, 0.2), 0 0 0 9999px rgba(21, 41, 34, 0.05);
}

.tower-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
  margin-bottom: 8px;
}

.tower-summary div {
  min-width: 0;
  padding: 7px 6px;
  border-radius: 8px;
  color: #17315a;
  background: rgba(47, 134, 197, 0.09);
  text-align: center;
}

.tower-summary span,
.tower-summary strong {
  display: block;
}

.tower-summary span {
  color: #60727c;
  font-size: 11px;
  font-weight: 900;
}

.tower-summary strong {
  margin-top: 2px;
  font-size: 13px;
  font-weight: 900;
}

.tower-action-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 82px;
  gap: 10px;
  align-items: center;
  padding: 8px;
  border: 1px solid rgba(23, 49, 90, 0.12);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.78);
}

.tower-action-block {
  display: grid;
  gap: 5px;
  margin-top: 7px;
  min-width: 0;
}

.tower-action-flow {
  display: grid;
  gap: 5px;
  padding-left: 8px;
  min-width: 0;
}

.tower-action-card button {
  min-height: 34px;
}

.tower-branch-grid {
  display: grid;
  gap: 7px;
}

.tower-branch-card {
  grid-template-columns: minmax(0, 1fr) 74px;
}

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

.save-button,
.pause-button,
.max-window-button,
.restart-button {
  flex: 1 1 86px;
  min-width: 70px;
  min-height: 32px;
  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: 8px;
  width: 100%;
  padding: 7px;
  border: 1px solid rgba(18, 36, 43, 0.18);
  border-radius: 10px;
  background:
    linear-gradient(135deg, rgba(18, 43, 48, 0.08), rgba(216, 164, 65, 0.08)),
    rgba(247, 252, 247, 0.94);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.8);
}

.equipment-slot {
  --slot-accent: #d8a441;
  --slot-accent-soft: rgba(216, 164, 65, 0.18);
  --slot-ink: #17315a;
  position: relative;
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  grid-template-rows: 18px 20px 16px;
  gap: 1px 8px;
  align-items: center;
  min-width: 0;
  height: 68px;
  padding: 7px 9px 7px 8px;
  overflow: hidden;
  border: 1px solid color-mix(in srgb, var(--slot-accent) 32%, rgba(18, 36, 43, 0.2));
  border-radius: 10px;
  background:
    linear-gradient(140deg, rgba(255, 255, 255, 0.86) 0%, rgba(245, 251, 241, 0.72) 48%, var(--slot-accent-soft) 100%),
    #f8fbf3;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.92),
    inset 0 -10px 24px rgba(23, 49, 90, 0.05),
    0 8px 18px rgba(20, 45, 40, 0.08);
  user-select: none;
}

.equipment-slot::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 4px;
  background: linear-gradient(180deg, var(--slot-accent), color-mix(in srgb, var(--slot-accent) 60%, #17315a));
}

.equipment-slot::after {
  content: "普通";
  position: absolute;
  right: 7px;
  top: 6px;
  padding: 1px 5px;
  border: 1px solid rgba(255, 255, 255, 0.68);
  border-radius: 999px;
  color: #fff7d6;
  background: color-mix(in srgb, var(--slot-accent) 78%, #17315a);
  box-shadow: 0 3px 10px rgba(23, 49, 90, 0.16);
  font-size: 9px;
  font-weight: 1000;
  letter-spacing: 0;
  line-height: 1.35;
}

.equipment-slot.filled {
  cursor: grab;
  border-color: color-mix(in srgb, var(--slot-accent) 54%, #17315a);
  background:
    radial-gradient(circle at 18% 22%, rgba(255, 255, 255, 0.82), transparent 27%),
    linear-gradient(140deg, rgba(255, 255, 255, 0.88) 0%, rgba(241, 249, 238, 0.72) 43%, var(--slot-accent-soft) 100%),
    #f8fbf3;
}

.equipment-slot.filled:hover {
  transform: translateY(-1px);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.94),
    inset 0 -10px 24px rgba(23, 49, 90, 0.06),
    0 12px 22px rgba(20, 45, 40, 0.12);
}

.equipment-slot.empty {
  color: #6f7d77;
  border-style: dashed;
  border-color: rgba(23, 49, 90, 0.18);
  background:
    repeating-linear-gradient(135deg, rgba(23, 49, 90, 0.04) 0 6px, transparent 6px 12px),
    rgba(241, 247, 241, 0.78);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.72);
}

.equipment-slot.empty::after {
  content: "空位";
  color: #6f7d77;
  background: rgba(255, 255, 255, 0.72);
  border-color: rgba(23, 49, 90, 0.12);
}

.equipment-slot.drag-source {
  opacity: 0.55;
  transform: scale(0.98);
}

.equipment-slot[data-equipment-slot="attackWeapon"] {
  --slot-accent: #d8752a;
  --slot-accent-soft: rgba(216, 117, 42, 0.2);
}

.equipment-slot[data-equipment-slot="defenseWeapon"] {
  --slot-accent: #4c78a8;
  --slot-accent-soft: rgba(76, 120, 168, 0.2);
}

.equipment-slot[data-equipment-slot="food"] {
  --slot-accent: #3f9a55;
  --slot-accent-soft: rgba(63, 154, 85, 0.2);
}

.equipment-label {
  grid-column: 2;
  grid-row: 1;
  align-self: end;
  max-width: calc(100% - 38px);
  color: color-mix(in srgb, var(--slot-accent) 72%, #17315a);
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0;
  line-height: 1.15;
}

.equipment-slot .item-mark {
  grid-column: 1;
  grid-row: 1 / 4;
  width: 32px;
  height: 32px;
  border: 1px solid rgba(255, 255, 255, 0.72);
  border-radius: 10px;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.42),
    0 6px 14px rgba(23, 49, 90, 0.15);
}

.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;
  padding-right: 32px;
  color: var(--slot-ink);
  font-size: 12px;
  line-height: 1.12;
}

.equipment-count {
  grid-column: 2;
  grid-row: 3;
  display: inline-flex;
  align-items: center;
  width: max-content;
  max-width: 100%;
  padding: 2px 6px;
  border-radius: 999px;
  color: #60727c;
  background: rgba(255, 255, 255, 0.58);
  font-size: 10px;
  line-height: 1.15;
}

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

.inventory-slot {
  position: relative;
  display: grid;
  grid-template-rows: 24px auto auto;
  justify-items: center;
  align-items: center;
  min-width: 54px;
  height: 54px;
  padding: 5px 4px 4px;
  border: 1px 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.goldCoin {
  background: #e0b23f;
  color: #3f2a0a;
}

.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.mushroomSoup,
.item-mark.cabbageSoup,
.item-mark.spinachSoup,
.item-mark.pumpkinSoup {
  background: #b7793a;
  box-shadow: inset 0 -8px 0 rgba(255, 223, 143, 0.4);
}

.item-mark.watermelonJuice {
  background: #d85040;
  box-shadow: inset 0 -8px 0 rgba(47, 143, 70, 0.42);
}

.item-mark.burntFood {
  background: #3d2b23;
  color: #ffd89a;
  box-shadow: inset 0 -8px 0 rgba(216, 80, 64, 0.32);
}

.item-mark.perfectMeal {
  background: linear-gradient(145deg, #ffd166, #80cfa9);
  color: #3f2a0a;
  box-shadow: inset 0 -8px 0 rgba(255, 255, 255, 0.32);
}

.item-mark.campStew {
  background: #8d5a34;
  box-shadow: inset 0 -8px 0 rgba(63, 154, 85, 0.38);
}

.item-mark.sweetMilkCustard {
  background: linear-gradient(145deg, #fff6d8, #d875a8);
  color: #4a220a;
}

.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 (min-width: 981px) and (max-width: 1280px) {
  .shell {
    width: calc(100vw - 10px);
  }

  .topbar {
    grid-template-columns: minmax(250px, 0.58fr) minmax(600px, 1.42fr);
  }

  .build-badge {
    display: none;
  }

  .play-layout {
    grid-template-columns: 190px minmax(640px, 1fr) 204px;
  }

  .hud {
    grid-template-columns: 88px minmax(190px, 0.74fr) minmax(390px, 1.26fr);
    gap: 8px;
  }

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

@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;
  }

  .title-card {
    min-height: 64px;
  }

  .build-badge {
    display: none;
  }

  .hud {
    grid-template-columns: 1fr;
    min-width: 0;
  }

  .hud-head {
    grid-template-columns: auto auto;
    align-items: center;
    justify-content: space-between;
  }

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

  .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 {
    grid-template-columns: 30px minmax(0, 1fr);
    height: 62px;
    padding: 6px 7px 6px 7px;
  }

  .equipment-slot .item-mark {
    width: 29px;
    height: 29px;
  }

  .equipment-label {
    font-size: 9px;
  }

  .equipment-name {
    font-size: 11px;
  }

  .equipment-count {
    padding: 1px 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 {
    display: block;
  }

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

  .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;
  }
}
