:root {
  color-scheme: light;
  font-family: "Microsoft YaHei", "Segoe UI", sans-serif;
  background: #f3efe6;
  color: #20242a;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 1200px;
}

button {
  border: 1px solid #9a7a4f;
  background: #fffaf1;
  border-radius: 8px;
  color: #20242a;
  cursor: pointer;
  font: inherit;
  min-height: 38px;
  padding: 8px 12px;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.46;
}

.app-shell {
  display: grid;
  gap: 14px;
  grid-template-rows: auto 1fr;
  min-height: 100vh;
  padding: 16px;
}

.topbar {
  align-items: center;
  background: #fffdf7;
  border: 1px solid #dcc39b;
  border-radius: 10px;
  display: flex;
  gap: 16px;
  justify-content: space-between;
  padding: 12px 14px;
}

.brand-block {
  display: grid;
  gap: 3px;
}

.brand-block strong {
  font-size: 18px;
}

.market-subtitle {
  color: #6f5b32;
  font-size: 12px;
}

.resource-list {
  display: flex;
  gap: 12px;
}

.resource {
  background: #f8f1e3;
  border: 1px solid #dbc6a0;
  border-radius: 8px;
  display: grid;
  gap: 2px;
  font-weight: 700;
  min-width: 110px;
  padding: 6px 8px;
}

.resource small {
  color: #6f5b32;
  font-size: 11px;
  font-weight: 500;
}

.resource-primary {
  background: #2f6f62;
  border-color: #2f6f62;
  color: #fff;
}

.resource-primary small {
  color: #dff4ed;
}

.resource-upgrade-ready {
  animation: upgradePulse 1.5s ease-in-out infinite;
  background: linear-gradient(135deg, #d97825, #f2a544);
  border-color: #b85c11;
  box-shadow: 0 0 0 2px rgba(255, 207, 102, 0.35);
}

.layout {
  align-items: start;
  display: grid;
  gap: 14px;
  grid-template-columns: 248px minmax(560px, 1fr) 332px;
}

.panel {
  background: #fffdf7;
  border: 1px solid #dcc39b;
  border-radius: 10px;
  min-height: 0;
  padding: 14px;
}

.panel h2 {
  font-size: 18px;
  margin: 0 0 12px;
}

.panel-orders {
  background: #fff9ef;
}

.panel-sidebar {
  background: #fafcfd;
}

.orders {
  display: grid;
  gap: 10px;
}

.order-card {
  background: #fff7e8;
  border: 1px solid #cda86f;
  border-radius: 8px;
  padding: 10px;
}

.order-card-timed {
  border-color: #b84d35;
  box-shadow: 0 0 0 2px rgba(184, 77, 53, 0.12);
}

.order-card h3 {
  font-size: 15px;
  margin: 0 0 8px;
}

.order-card ul {
  display: grid;
  gap: 5px;
  margin: 0 0 10px 18px;
  padding: 0;
}

.order-card li {
  align-items: center;
  display: flex;
  gap: 6px;
}

.order-guide {
  background: rgba(255, 255, 255, 0.62);
  border: 1px dashed #cdb47e;
  border-radius: 6px;
  color: #5c4a29;
  font-size: 12px;
  line-height: 1.45;
  margin: 0 0 8px;
  padding: 7px 8px;
}

.order-state {
  border-radius: 6px;
  font-size: 12px;
  font-weight: 700;
  margin: 0 0 8px;
  padding: 6px 8px;
}

.order-ready {
  background: #e3f4ed;
  color: #246b55;
}

.order-blocked {
  background: #f4ead8;
  color: #765329;
}

.panel-board {
  display: grid;
  gap: 6px;
  grid-template-rows: auto auto;
  align-content: start;
}

.board-shell {
  display: flex;
  justify-content: center;
  max-width: 640px;
  margin: 0 auto;
  width: 100%;
}

.board {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(6, minmax(92px, 1fr));
  width: 100%;
}

.cell {
  align-items: center;
  aspect-ratio: 1;
  background: #f7efe0;
  border: 1px solid #d2b482;
  border-radius: 12px;
  display: flex;
  font-size: 12px;
  justify-content: center;
  min-width: 0;
  overflow: hidden;
  padding: 8px;
  position: relative;
  text-align: center;
}

.cell.empty {
  background: #f8f4eb;
  border-color: #e8dcc6;
  border-style: dashed;
}

.cell.filled {
  align-items: center;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.58);
}

.cell.selected {
  background: #dff4ed;
  border: 3px solid #23886b;
  box-shadow: inset 0 0 0 2px #ffffff;
}

.cell-item {
  align-items: center;
  display: flex;
  height: 100%;
  justify-content: center;
  width: 100%;
}

.item-icon {
  align-items: center;
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid rgba(54, 54, 54, 0.12);
  border-radius: 999px;
  display: inline-flex;
  height: 42px;
  justify-content: center;
  justify-self: center;
  width: 42px;
}

.item-icon svg {
  fill: none;
  height: 28px;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
  width: 28px;
}

.cell-chain-mark {
  border-radius: 999px;
  height: 14px;
  left: 8px;
  position: absolute;
  top: 8px;
  width: 14px;
}

.chain-badge,
.route-label,
.status-badge,
.button-badge {
  border-radius: 999px;
  display: inline-flex;
  font-size: 11px;
  font-weight: 700;
  justify-self: center;
  line-height: 1;
  padding: 4px 6px;
}

.cell-level {
  background: rgba(255, 255, 255, 0.92);
  color: #3f454d;
  justify-self: auto;
  padding: 4px 7px;
  position: absolute;
  right: 8px;
  top: auto;
  bottom: 8px;
}

.item-tier-badge {
  background: rgba(255, 255, 255, 0.92);
  border-radius: 999px;
  color: #3f454d;
  display: inline-flex;
  font-size: 11px;
  font-weight: 700;
  line-height: 1;
  padding: 4px 7px;
}

.chain-pastry {
  background: #fff2cf;
  border-color: #d8a743;
}

.chain-drink {
  background: #e4f3f2;
  border-color: #5fa8a4;
}

.chain-decor {
  background: #f1e9fb;
  border-color: #9b77c5;
}

.chain-pastry .chain-badge,
.chain-badge.chain-pastry {
  background: #8e5f10;
  color: #fff8e8;
}

.chain-pastry .cell-chain-mark {
  background: #8e5f10;
  box-shadow: 0 0 0 3px rgba(255, 248, 232, 0.78);
}

.chain-drink .chain-badge,
.chain-badge.chain-drink {
  background: #1f6f74;
  color: #f0ffff;
}

.chain-drink .cell-chain-mark {
  background: #1f6f74;
  box-shadow: 0 0 0 3px rgba(240, 255, 255, 0.78);
}

.chain-decor .chain-badge,
.chain-badge.chain-decor {
  background: #6b4c91;
  color: #fbf7ff;
}

.chain-decor .cell-chain-mark {
  background: #6b4c91;
  box-shadow: 0 0 0 3px rgba(251, 247, 255, 0.82);
}

.controls {
  display: grid;
  gap: 10px;
}

.status-card {
  background: #f4f8f6;
  border: 1px solid #c5d9cf;
  border-radius: 8px;
  padding: 10px;
}

.status-card p {
  margin: 6px 0 0;
}

.status-card-priority {
  background: #fff6de;
  border-color: #d5a23f;
}

.priority-banner {
  background: #f8d36c;
  border: 1px solid rgba(140, 93, 0, 0.15);
  border-radius: 6px;
  color: #533507;
  font-weight: 700;
  padding: 7px 8px;
}

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

.objective-row {
  align-items: start;
  display: grid;
  gap: 6px;
  grid-template-columns: 68px 1fr;
}

.objective-label {
  color: #6c756e;
  font-size: 12px;
  font-weight: 700;
}

.status-card-head {
  align-items: center;
  display: flex;
  justify-content: space-between;
}

.status-meta {
  color: #6c756e;
  font-size: 12px;
}

.status-badge {
  background: #ffdf89;
  color: #6b4700;
}

.upgrade-card-ready {
  background: #edf8f1;
  border-color: #7eb391;
  box-shadow: inset 0 0 0 1px rgba(102, 151, 121, 0.16);
}

.status-log-card {
  min-height: 132px;
  margin-top: 2px;
}

.status-log-list {
  display: grid;
  gap: 6px;
  margin-top: 8px;
  max-height: 112px;
  overflow-y: auto;
}

.log {
  background: #ffffff;
  border: 1px solid #dbe4de;
  border-radius: 6px;
  color: #586168;
  font-size: 12px;
  line-height: 1.45;
  padding: 6px 8px;
}

.log-latest {
  border-color: #8ec0ab;
  color: #244f41;
}

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

.generator-button {
  font-weight: 700;
}

.primary-action {
  align-items: center;
  display: inline-flex;
  font-weight: 700;
  gap: 8px;
  justify-content: center;
}

.button-badge {
  background: rgba(255, 255, 255, 0.26);
  color: inherit;
}

.action-upgrade-ready {
  animation: upgradePulse 1.5s ease-in-out infinite;
  background: #d97825;
  border-color: #b85c11;
  box-shadow: 0 0 0 2px rgba(217, 120, 37, 0.18);
  color: #fffdf7;
}

.control-note {
  color: #64615a;
  font-size: 12px;
  margin: -4px 0 2px;
}

.control-stack-card {
  display: grid;
  gap: 10px;
}

.action-button-group {
  display: grid;
  gap: 8px;
}

.action-button-group button {
  width: 100%;
}

.selected-item-card {
  display: grid;
  gap: 10px;
}

.selected-item-summary {
  align-items: center;
  border-radius: 10px;
  display: grid;
  gap: 10px;
  grid-template-columns: auto 1fr;
  min-width: 0;
  padding: 10px;
}

.selected-item-icon {
  height: 46px;
  width: 46px;
}

.selected-item-main {
  display: grid;
  gap: 8px;
  min-width: 0;
}

.selected-item-title-row,
.selected-item-tags,
.selected-info-row {
  align-items: center;
  display: flex;
  gap: 8px;
  justify-content: space-between;
}

.selected-item-name {
  font-size: 15px;
}

.selected-item-tags {
  flex-wrap: wrap;
  justify-content: flex-start;
}

.selected-demand {
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  padding: 4px 8px;
}

.selected-demand-needed {
  background: #e4f5ea;
  color: #25674f;
}

.selected-demand-idle {
  background: #f4ead8;
  color: #765329;
}

.selected-item-grid {
  display: grid;
  gap: 8px;
}

.selected-info-row {
  border-top: 1px dashed rgba(108, 117, 110, 0.2);
  padding-top: 8px;
}

.selected-item-grid .selected-info-row:first-child {
  border-top: 0;
  padding-top: 0;
}

.selected-label {
  color: #6c756e;
  font-size: 12px;
  font-weight: 700;
}

.selected-item-path {
  line-height: 1.5;
}

.demo-banner {
  align-items: center;
  background: #fff1d4;
  border: 1px solid #d7a246;
  border-radius: 8px;
  color: #704610;
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  padding: 12px 14px;
}

.demo-banner small {
  color: #7a5c2d;
  flex-basis: 100%;
  font-size: 12px;
}

.result-panel {
  align-items: center;
  background: #e8f4ef;
  border: 1px solid #8bc1aa;
  border-radius: 8px;
  display: flex;
  justify-content: space-between;
  padding: 14px;
}

.result-panel p {
  margin: 6px 0 0;
}

.route-label {
  background: #ffffff;
  border: 1px solid #8bc1aa;
  color: #2f6f62;
  margin-left: 8px;
  vertical-align: middle;
}

.result-metrics {
  display: flex;
  gap: 10px;
}

.result-metrics span {
  background: #ffffff;
  border: 1px solid #bad7ca;
  border-radius: 6px;
  padding: 6px 8px;
}

.timer-box {
  background: #fff0e8;
  border: 1px solid #d89072;
  border-radius: 8px;
  color: #8a2f1a;
  font-weight: 700;
  margin: 8px 0;
  padding: 8px;
}

.timer-progress {
  background: #f2cab8;
  border-radius: 999px;
  height: 8px;
  margin-top: 6px;
  overflow: hidden;
}

.timer-progress span {
  background: #bc5a3c;
  display: block;
  height: 100%;
}

.timer-urgent {
  background: #ffe3df;
  border-color: #b83228;
  color: #9f1e16;
}

.peak-stage-banner {
  background: linear-gradient(135deg, #fff1d2, #ffe6b6);
  border: 1px solid #d9a34d;
  border-radius: 8px;
  color: #6f4811;
  margin-bottom: 10px;
  padding: 10px;
}

.peak-stage-banner p {
  margin: 6px 0 0;
}

.peak-route-grid {
  display: grid;
  gap: 8px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin-top: 10px;
}

.peak-route-card {
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid rgba(163, 116, 29, 0.28);
  border-radius: 8px;
  min-width: 0;
  padding: 8px;
}

.peak-route-card strong {
  display: block;
  font-size: 12px;
}

.peak-route-card p {
  font-size: 12px;
  line-height: 1.45;
  margin: 6px 0 0;
}

.peak-route-card-active {
  background: #e6f4ed;
  border-color: #5e9f80;
  color: #225a42;
}

.peak-route-card-muted {
  opacity: 0.72;
}

.peak-order-state,
.peak-reward-note {
  border-radius: 6px;
  font-size: 12px;
  margin: 0 0 8px;
  padding: 6px 8px;
}

.peak-order-open {
  background: #fff6dd;
  color: #8a6115;
}

.peak-order-featured {
  background: #e4f5ea;
  color: #25674f;
  font-weight: 700;
}

.peak-order-normal {
  background: #f4ead8;
  color: #765329;
}

.peak-reward-note {
  background: rgba(255, 255, 255, 0.7);
  border: 1px dashed #ccb57f;
  color: #5a4a2b;
}

@keyframes upgradePulse {
  0%, 100% {
    transform: translateY(0);
    box-shadow: 0 0 0 0 rgba(255, 190, 92, 0.25);
  }
  50% {
    transform: translateY(-1px);
    box-shadow: 0 0 0 6px rgba(255, 190, 92, 0.08);
  }
}
