:root {
  --bg: #f4efe6;
  --panel: rgba(255, 252, 246, 0.84);
  --line: rgba(68, 52, 34, 0.12);
  --ink: #23190e;
  --muted: #705d48;
  --accent: #c4661f;
  --accent-strong: #94440c;
  --teal: #1a8676;
  --shadow: 0 22px 50px rgba(31, 20, 8, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at top left, rgba(29, 134, 118, 0.18), transparent 34%),
    radial-gradient(circle at top right, rgba(196, 102, 31, 0.22), transparent 28%),
    linear-gradient(180deg, #f7f1e7, #efe4d4);
}

button,
input,
select {
  font: inherit;
}

.app-shell {
  width: min(1480px, calc(100vw - 32px));
  margin: 16px auto;
  padding: 18px;
  border: 1px solid rgba(35, 25, 14, 0.08);
  border-radius: 28px;
  background: rgba(255, 248, 239, 0.74);
  backdrop-filter: blur(20px);
  box-shadow: var(--shadow);
}

.topbar,
.statusbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.topbar {
  padding: 8px 8px 18px;
}

.eyebrow {
  font-size: 12px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--teal);
}

h1 {
  margin: 4px 0 0;
  font-size: clamp(28px, 3vw, 40px);
  line-height: 1.05;
}

.topbar-actions,
.stack-actions,
.tool-list {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.workspace-layout {
  display: grid;
  grid-template-columns: 180px minmax(0, 1fr) 320px;
  gap: 16px;
  min-height: calc(100vh - 200px);
}

.panel,
.dropzone {
  border: 1px solid var(--line);
  border-radius: 24px;
  background: var(--panel);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.6);
}

.panel {
  padding: 16px;
}

.panel.muted {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.7;
}

.panel-title {
  margin-bottom: 14px;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--teal);
}

.summary-title {
  list-style: none;
  cursor: pointer;
}

.summary-title::-webkit-details-marker {
  display: none;
}

.tool-column,
.side-column {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.tool-list {
  flex-direction: column;
}

.tool-button,
.ghost-button,
.accent-button {
  padding: 12px 14px;
  border-radius: 16px;
  border: 1px solid transparent;
  cursor: pointer;
  transition: transform 140ms ease, background 140ms ease, border-color 140ms ease;
}

.tool-button,
.ghost-button {
  background: rgba(255, 255, 255, 0.72);
  border-color: rgba(35, 25, 14, 0.08);
  color: var(--ink);
}

.tool-button.active {
  background: rgba(26, 134, 118, 0.12);
  border-color: rgba(26, 134, 118, 0.28);
  color: var(--teal);
}

.tool-button.is-disabled,
.ghost-button.is-disabled,
.accent-button.is-disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
}

.accent-button {
  background: linear-gradient(135deg, var(--accent), var(--accent-strong));
  color: #fffaf3;
}

.full-width {
  width: 100%;
}

.dropzone {
  display: flex;
  flex-direction: column;
  padding: 16px;
  min-height: 100%;
}

.dropzone.dragover {
  border-color: rgba(26, 134, 118, 0.38);
  box-shadow: 0 0 0 4px rgba(26, 134, 118, 0.08);
}

.canvas-headline {
  display: flex;
  justify-content: space-between;
  color: var(--muted);
  font-size: 14px;
  margin-bottom: 10px;
}

.canvas-viewport {
  position: relative;
  min-height: 620px;
  border-radius: 22px;
  overflow: hidden;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.42), transparent),
    conic-gradient(from 0deg, rgba(35, 25, 14, 0.02) 0deg 90deg, rgba(255, 255, 255, 0.4) 90deg 180deg, rgba(35, 25, 14, 0.02) 180deg 270deg, rgba(255, 255, 255, 0.4) 270deg 360deg);
  background-size: 48px 48px;
  background-position: center;
}

.canvas-zoom-controls {
  position: absolute;
  top: 16px;
  right: 16px;
  z-index: 3;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border: 1px solid rgba(35, 25, 14, 0.1);
  border-radius: 999px;
  background: rgba(255, 252, 246, 0.88);
  box-shadow: 0 10px 24px rgba(31, 20, 8, 0.12);
}

.zoom-button,
.zoom-reset-button {
  min-width: 42px;
  padding: 10px 12px;
  border-radius: 999px;
}

.zoom-value {
  min-width: 60px;
  text-align: center;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.canvas-stage {
  position: absolute;
  top: 0;
  left: 0;
  transform-origin: top left;
}

.canvas-stage canvas {
  position: absolute;
  inset: 0;
  display: block;
}

#guideCanvas {
  pointer-events: none;
}

.empty-state {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  text-align: center;
  gap: 10px;
  color: var(--muted);
  background: rgba(255, 249, 240, 0.65);
}

.empty-state[hidden] {
  display: none;
}

.field,
.checkbox-row {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 12px;
}

.checkbox-row {
  flex-direction: row;
  align-items: center;
}

.field span,
.checkbox-row span,
.hint {
  color: var(--muted);
  font-size: 13px;
}

.field input,
.field select {
  width: 100%;
  padding: 10px 12px;
  border-radius: 14px;
  border: 1px solid rgba(35, 25, 14, 0.1);
  background: rgba(255, 255, 255, 0.9);
}

.field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.hint {
  line-height: 1.6;
}

.statusbar {
  margin-top: 16px;
  padding: 14px 16px 6px;
  color: var(--muted);
  font-size: 14px;
}

@media (max-width: 1180px) {
  .workspace-layout {
    grid-template-columns: 1fr;
  }

  .tool-column,
  .side-column {
    flex-direction: row;
    overflow-x: auto;
  }

  .panel,
  .dropzone {
    min-width: 280px;
  }
}
