:root {
  color-scheme: light;
  --bg: #f1eee8;
  --ink: #20201e;
  --muted: #706b62;
  --line: #d5cec2;
  --panel: #fffaf1;
  --panel-deep: #e6ded0;
  --accent: #1e5b4f;
  --accent-2: #b36b35;
  --danger: #9b3328;
  --shadow: 0 22px 60px rgba(55, 45, 31, 0.16);
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  background:
    linear-gradient(90deg, rgba(32, 32, 30, 0.04) 1px, transparent 1px),
    linear-gradient(rgba(32, 32, 30, 0.035) 1px, transparent 1px),
    var(--bg);
  background-size: 28px 28px;
  color: var(--ink);
  font-family: "Microsoft YaHei", "PingFang SC", "Noto Sans SC", sans-serif;
}

button,
select {
  font: inherit;
}

.app-shell {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 18px;
  min-height: 100vh;
  padding: 18px;
}

.stage-panel,
.control-panel {
  border: 1px solid rgba(32, 32, 30, 0.14);
  background: rgba(255, 250, 241, 0.86);
  box-shadow: var(--shadow);
}

.stage-panel {
  display: grid;
  grid-template-rows: auto minmax(420px, 1fr);
  min-width: 0;
  overflow: hidden;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 20px;
  border-bottom: 1px solid var(--line);
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: 24px;
  font-weight: 800;
  letter-spacing: 0;
}

h2 {
  font-size: 15px;
  font-weight: 800;
}

.topbar p {
  margin-top: 5px;
  color: var(--muted);
  font-size: 13px;
}

.view-actions,
.selected-tools,
.tool-grid,
.swatches {
  display: flex;
  gap: 8px;
}

.view-actions button,
.selected-tools button,
.asset-button,
.primary-action {
  min-height: 38px;
  border: 1px solid rgba(32, 32, 30, 0.17);
  background: #fffdf8;
  color: var(--ink);
  padding: 0 12px;
  cursor: pointer;
  transition: transform 160ms ease, border-color 160ms ease, background 160ms ease;
}

.view-actions button:hover,
.selected-tools button:hover,
.asset-button:hover,
.primary-action:hover {
  transform: translateY(-1px);
  border-color: var(--accent);
}

.canvas-wrap {
  position: relative;
  min-height: 420px;
  background:
    radial-gradient(circle at 12% 16%, rgba(179, 107, 53, 0.18), transparent 28%),
    linear-gradient(145deg, #e5dfd4, #f8f3eb 48%, #ddd3c4);
}

#scene {
  display: block;
  width: 100%;
  height: 100%;
  min-height: 420px;
  cursor: grab;
}

#scene.dragging {
  cursor: grabbing;
}

.drag-tip {
  position: absolute;
  left: 18px;
  bottom: 18px;
  padding: 8px 10px;
  border: 1px solid rgba(32, 32, 30, 0.13);
  background: rgba(255, 250, 241, 0.84);
  color: var(--muted);
  font-size: 12px;
  backdrop-filter: blur(10px);
}

.control-panel {
  display: flex;
  flex-direction: column;
  gap: 0;
  padding: 4px 16px 16px;
  overflow: auto;
}

.panel-section {
  padding: 16px 0;
  border-bottom: 1px solid var(--line);
}

.panel-section:last-child {
  border-bottom: 0;
}

.tool-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-top: 12px;
}

.asset-button {
  width: 100%;
  justify-content: center;
  background: #f8efe0;
}

.selected-tools {
  margin-top: 10px;
}

.selected-tools button {
  flex: 1;
}

.selected-tools button:last-child {
  color: var(--danger);
}

.swatches {
  margin-top: 12px;
}

.swatch {
  width: 44px;
  height: 36px;
  border: 2px solid transparent;
  background: var(--swatch);
  cursor: pointer;
}

.swatch.active {
  border-color: var(--accent);
  box-shadow: inset 0 0 0 2px #fffaf1;
}

.field {
  display: grid;
  gap: 7px;
  margin-top: 12px;
}

.field span,
.spec-card span {
  color: var(--muted);
  font-size: 12px;
}

select {
  width: 100%;
  height: 40px;
  border: 1px solid rgba(32, 32, 30, 0.18);
  background: #fffdf8;
  color: var(--ink);
  padding: 0 10px;
}

.spec-card {
  display: grid;
  gap: 6px;
  margin-top: 12px;
  padding: 12px;
  background: var(--panel-deep);
}

.spec-card strong {
  font-size: 14px;
}

.asset-list {
  display: grid;
  gap: 8px;
  min-height: 100px;
  margin: 12px 0;
  padding: 0;
  list-style: none;
}

.asset-list li {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 10px;
  background: #fffdf8;
  border: 1px solid rgba(32, 32, 30, 0.12);
  color: var(--muted);
  font-size: 12px;
}

.primary-action {
  width: 100%;
  min-height: 44px;
  border-color: var(--accent);
  background: var(--accent);
  color: #fffaf1;
  font-weight: 700;
}

@media (max-width: 900px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .control-panel {
    max-height: none;
  }

  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .view-actions {
    width: 100%;
  }

  .view-actions button {
    flex: 1;
  }
}
