:root {
  --bg: #f7f1ea;
  --paper: rgba(255, 250, 244, 0.78);
  --ink: #291f18;
  --muted: #6f665f;
  --line: rgba(41, 31, 24, 0.1);
  --shadow: 0 24px 60px rgba(43, 28, 17, 0.1);
  --door: linear-gradient(135deg, #b48963, #7f5b40);
  --shell: linear-gradient(135deg, #e8ddcf, #d0bea7);
  --open: linear-gradient(135deg, #f5eee6, #dfd0c1);
  --accent: linear-gradient(135deg, #7c9182, #9faea4);
  --top: linear-gradient(135deg, #8f6a49, #6b4d35);
  --handle: linear-gradient(180deg, #5b534c, #2a2724);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Microsoft YaHei UI", sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at top left, rgba(177, 142, 101, 0.14), transparent 28%),
    linear-gradient(180deg, #fbf6f1 0%, #efe6db 100%);
}

.topbar,
.preview-card,
.saved-card,
.panel {
  background: var(--paper);
  border: 1px solid rgba(255, 255, 255, 0.74);
  box-shadow: var(--shadow);
  backdrop-filter: blur(16px);
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px min(30px, 4vw);
}

.brand,
.topbar-actions,
.chip-row,
.action-panel,
.panel-head,
.meta-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-mark {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: linear-gradient(135deg, #b78d65, #6b4d34);
}

.brand strong,
.brand small {
  display: block;
}

.brand small,
.topbar-actions a,
.panel p,
.preview-meta p,
.panel-tip,
.status-text {
  color: var(--muted);
}

.page {
  width: min(1240px, calc(100% - 24px));
  margin: 0 auto;
  padding: 28px 0 40px;
}

.intro h1 {
  max-width: 10ch;
  margin: 0 0 12px;
  font-size: clamp(36px, 5vw, 72px);
  line-height: 1.04;
  letter-spacing: -0.05em;
}

.intro p {
  max-width: 720px;
  line-height: 1.8;
}

.eyebrow {
  display: inline-block;
  margin: 0 0 12px;
  padding: 8px 14px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.72);
  color: var(--muted);
  font-size: 12px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.selector-layout {
  display: grid;
  grid-template-columns: 0.92fr 0.72fr;
  gap: 20px;
}

.preview-column,
.control-column {
  display: grid;
  gap: 14px;
}

.preview-card,
.saved-card,
.panel {
  padding: 20px;
  border-radius: 26px;
}

.preview-meta strong {
  display: block;
  margin: 6px 0 8px;
  font-size: 28px;
}

.preview-meta p {
  margin: 0;
  line-height: 1.8;
}

.scene {
  position: relative;
  overflow: hidden;
  height: 560px;
  margin-top: 18px;
  border-radius: 24px;
  background: linear-gradient(180deg, #f8f0e6 0 66%, #dcc7b4 66% 100%);
}

.wall {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(90deg, rgba(41, 31, 24, 0.04) 1px, transparent 1px),
    linear-gradient(rgba(41, 31, 24, 0.04) 1px, transparent 1px);
  background-size: 44px 44px;
}

.floor {
  position: absolute;
  inset: auto 0 0;
  height: 34%;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.08), rgba(90, 66, 43, 0.08));
}

.cabinet {
  position: absolute;
  transition: background 180ms ease, all 180ms ease;
}

.shell {
  left: 13%;
  right: 13%;
  top: 20%;
  bottom: 13%;
  border-radius: 16px;
  background: var(--shell);
  border: 2px solid rgba(48, 35, 24, 0.1);
}

.top {
  left: 12%;
  right: 12%;
  top: 16%;
  height: 4.5%;
  border-radius: 14px 14px 10px 10px;
  background: var(--top);
}

.door.left,
.door.right {
  top: 24%;
  width: 21%;
  bottom: 18%;
  border-radius: 12px;
  background: var(--door);
}

.door.left {
  left: 18%;
}

.door.right {
  right: 18%;
}

.open {
  left: 41%;
  right: 41%;
  top: 24%;
  bottom: 18%;
  border-radius: 12px;
  background: var(--open);
  display: grid;
  grid-template-rows: repeat(3, 1fr);
  gap: 10px;
  padding: 12px;
}

.open span {
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.28);
}

.accent {
  left: 41%;
  right: 41%;
  top: 49%;
  height: 6%;
  border-radius: 10px;
  background: var(--accent);
}

.handle.left,
.handle.right {
  width: 12px;
  height: 78px;
  top: 41%;
  border-radius: 999px;
  background: var(--handle);
}

.handle.left {
  left: 34%;
}

.handle.right {
  right: 34%;
}

.scene[data-layout="wardrobe"] .door.left,
.scene[data-layout="wardrobe"] .door.right {
  width: 24%;
}

.scene[data-layout="wardrobe"] .open {
  left: 43%;
  right: 43%;
}

.scene[data-layout="study"] .door.right {
  display: none;
}

.scene[data-layout="study"] .door.left {
  width: 28%;
  left: 17%;
}

.scene[data-layout="study"] .open {
  left: 48%;
  right: 15%;
}

.scene[data-layout="study"] .accent {
  left: 48%;
  right: 15%;
}

.scene[data-layout="study"] .handle.right {
  display: none;
}

.preview-footer {
  margin-top: 16px;
  color: var(--muted);
}

.panel h2,
.panel h3 {
  margin: 0 0 10px;
}

.panel p {
  margin: 0;
  line-height: 1.8;
}

.cabinet-list,
.saved-list,
.swatch-grid {
  display: grid;
  gap: 10px;
}

.cabinet-list,
.saved-list {
  grid-template-columns: 1fr;
}

.cabinet-option,
.saved-item,
.swatch,
.chip,
.button,
.text-button {
  cursor: pointer;
}

.cabinet-option,
.saved-item,
.swatch {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.7);
}

.cabinet-option.active,
.saved-item:hover,
.swatch.active {
  border-color: rgba(41, 31, 24, 0.28);
  box-shadow: 0 12px 24px rgba(43, 28, 17, 0.08);
}

.cabinet-option strong,
.saved-item strong,
.swatch-name {
  display: block;
}

.cabinet-option span,
.saved-item span,
.swatch-code {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}

.swatch-brand {
  display: block;
  margin-top: 6px;
  color: #8d6948;
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.chip,
.button,
.text-button {
  min-height: 42px;
  padding: 0 16px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.72);
}

.chip.active,
.chip:hover,
.preset.active {
  background: #241d18;
  color: #fff;
}

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

.swatch-color {
  height: 54px;
  border-radius: 12px;
  margin-bottom: 8px;
  background-position: center;
  background-size: cover;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.28);
}

.swatch-code {
  margin-top: 4px;
}

.empty-material-state {
  padding: 14px 16px;
  border: 1px dashed rgba(41, 31, 24, 0.14);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.56);
  color: var(--muted);
  font-size: 13px;
  line-height: 1.8;
}

.form-grid {
  display: grid;
  gap: 12px;
}

.form-grid label {
  display: block;
  color: var(--muted);
  font-size: 14px;
}

.form-grid input {
  width: 100%;
  margin-top: 8px;
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.72);
  font: inherit;
}

.action-panel {
  justify-content: flex-start;
  margin-top: 14px;
}

.button.dark {
  background: linear-gradient(135deg, #7e5b3e, #a8845a);
  color: #fff;
}

.text-button {
  min-height: auto;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--muted);
}

.status-text {
  min-height: 24px;
  margin: 12px 0 0;
}

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

@media (max-width: 720px) {
  .page {
    width: min(calc(100% - 20px), 1240px);
  }

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

  .intro h1 {
    font-size: 40px;
  }

  .scene {
    height: 420px;
  }
}
