:root {
  --ink: #171923;
  --muted: #6f7484;
  --paper: #f8f5ef;
  --panel: rgba(255, 255, 255, 0.9);
  --line: rgba(68, 55, 43, 0.14);
  --lacquer: #8d1f2d;
  --jade: #2f766f;
  --gold: #c99a42;
  --indigo: #243c6f;
  --shadow: 0 22px 60px rgba(39, 32, 26, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  font-family: "Microsoft YaHei", "PingFang SC", Arial, sans-serif;
  background:
    linear-gradient(135deg, rgba(141, 31, 45, 0.08), transparent 28%),
    linear-gradient(225deg, rgba(47, 118, 111, 0.11), transparent 32%),
    var(--paper);
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

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

.asset-rail,
.inspector-rail,
.viewer-stage {
  min-width: 0;
}

.asset-rail,
.inspector-rail {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.back-link {
  width: max-content;
  color: var(--lacquer);
  text-decoration: none;
  font-size: 13px;
  font-weight: 700;
}

.brand-lockup {
  display: flex;
  gap: 12px;
  align-items: center;
  padding: 12px 4px 8px;
}

.seal {
  display: grid;
  width: 52px;
  height: 52px;
  place-items: center;
  border-radius: 16px;
  background: var(--lacquer);
  color: #fff8eb;
  font-size: 26px;
  font-weight: 800;
  box-shadow: 0 12px 24px rgba(141, 31, 45, 0.24);
}

.brand-lockup p,
.eyebrow {
  margin: 0 0 4px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

.brand-lockup h1,
.stage-header h2,
.hero-card h2 {
  margin: 0;
  line-height: 1.1;
}

.brand-lockup h1 {
  font-size: 22px;
}

.panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.upload-panel,
.asset-rail .panel,
.inspector-rail .panel {
  padding: 14px;
}

.panel-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
  color: var(--muted);
  font-size: 12px;
}

.panel-heading strong {
  color: var(--ink);
}

.drop-zone {
  position: relative;
  display: grid;
  min-height: 162px;
  place-items: center;
  gap: 6px;
  padding: 18px;
  border: 1px dashed rgba(141, 31, 45, 0.36);
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.78), rgba(255, 248, 235, 0.6)),
    rgba(255, 255, 255, 0.62);
  text-align: center;
}

.drop-zone.is-dragging {
  border-color: var(--jade);
  background: rgba(47, 118, 111, 0.11);
}

.drop-zone input {
  display: none;
}

.upload-icon {
  display: block;
  width: 48px;
  height: 48px;
  border: 2px solid var(--lacquer);
  border-radius: 16px;
  background:
    linear-gradient(var(--lacquer), var(--lacquer)) center 16px / 20px 2px no-repeat,
    linear-gradient(var(--lacquer), var(--lacquer)) center / 2px 20px no-repeat;
}

.drop-zone strong {
  color: var(--ink);
}

.drop-zone small,
.file-card small,
.collection-item small,
.hero-card p,
.copy-stack span,
.spec-list dt {
  color: var(--muted);
}

.file-card {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 12px;
  padding: 10px;
  border-radius: 8px;
  background: rgba(141, 31, 45, 0.08);
}

.file-card[hidden] {
  display: none;
}

.file-card > span {
  display: grid;
  width: 44px;
  height: 44px;
  place-items: center;
  border-radius: 8px;
  background: var(--lacquer);
  color: #fff;
  font-size: 12px;
  font-weight: 800;
}

.file-card strong,
.file-card small {
  display: block;
  overflow-wrap: anywhere;
}

.image-to-3d-panel {
  display: grid;
  gap: 10px;
}

.image-upload-zone {
  display: block;
  min-height: 132px;
  overflow: hidden;
  border: 1px dashed rgba(47, 118, 111, 0.38);
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.72), rgba(225, 237, 229, 0.58)),
    rgba(255, 255, 255, 0.62);
}

.image-upload-zone input {
  display: none;
}

.image-preview-placeholder {
  display: grid;
  min-height: 132px;
  place-items: center;
  padding: 16px;
  color: var(--jade);
  font-size: 13px;
  font-weight: 800;
  text-align: center;
  background-position: center;
  background-size: cover;
}

.image-preview-placeholder.has-image {
  color: #fff;
  text-shadow: 0 1px 8px rgba(0, 0, 0, 0.42);
}

.generate-3d-command {
  min-height: 42px;
  border: 0;
  border-radius: 8px;
  background: var(--jade);
  color: #fff;
  font-weight: 800;
}

.generate-3d-command:disabled {
  cursor: wait;
  opacity: 0.72;
}

.generation-result-card {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 10px;
  border-radius: 8px;
  background: rgba(47, 118, 111, 0.12);
}

.generation-result-card[hidden] {
  display: none;
}

.generation-result-card > span {
  display: grid;
  width: 44px;
  height: 44px;
  place-items: center;
  border-radius: 8px;
  background: var(--jade);
  color: #fff;
  font-size: 12px;
  font-weight: 800;
}

.generation-result-card strong,
.generation-result-card a {
  display: block;
  overflow-wrap: anywhere;
}

.generation-result-card a {
  margin-top: 3px;
  color: var(--jade);
  font-size: 12px;
  font-weight: 800;
  text-decoration: none;
}

.generation-result-card button {
  min-height: 34px;
  border: 1px solid rgba(47, 118, 111, 0.26);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.74);
  color: var(--jade);
  font-size: 12px;
  font-weight: 800;
}

.generation-note {
  color: var(--muted);
  line-height: 1.5;
}

.collection-item {
  display: flex;
  width: 100%;
  gap: 10px;
  align-items: center;
  margin-top: 8px;
  padding: 10px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: inherit;
  text-align: left;
}

.collection-item.active,
.collection-item:hover {
  border-color: rgba(141, 31, 45, 0.22);
  background: rgba(141, 31, 45, 0.07);
}

.look-dot {
  width: 24px;
  height: 24px;
  flex: 0 0 auto;
  border-radius: 50%;
  box-shadow: inset 0 0 0 4px rgba(255, 255, 255, 0.75);
}

.look-dot.ming { background: var(--lacquer); }
.look-dot.song { background: var(--jade); }
.look-dot.tang { background: var(--gold); }
.look-dot.accessory { background: var(--indigo); }

.viewer-stage {
  display: grid;
  grid-template-rows: auto minmax(520px, 1fr) auto;
  gap: 14px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.7), rgba(255, 248, 235, 0.64)),
    rgba(255, 255, 255, 0.54);
  box-shadow: var(--shadow);
}

.stage-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-width: 0;
}

.stage-header h2 {
  font-size: clamp(28px, 4vw, 54px);
}

.stage-actions {
  display: flex;
  gap: 8px;
  flex: 0 0 auto;
}

.icon-button {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.86);
}

.icon-button.active {
  border-color: rgba(141, 31, 45, 0.38);
  background: var(--lacquer);
}

.icon {
  position: relative;
  width: 18px;
  height: 18px;
  color: currentColor;
}

.icon-button.active .icon {
  color: #fff;
}

.icon.rotate {
  border: 2px solid currentColor;
  border-left-color: transparent;
  border-radius: 50%;
}

.icon.target {
  border: 2px solid currentColor;
  border-radius: 50%;
}

.icon.target::after {
  content: "";
  position: absolute;
  inset: 6px;
  border-radius: 50%;
  background: currentColor;
}

.icon.light {
  border-radius: 50%;
  background: currentColor;
  box-shadow: 0 0 0 5px rgba(201, 154, 66, 0.22);
}

.model-frame {
  position: relative;
  min-height: 520px;
  overflow: hidden;
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.24), rgba(255, 248, 235, 0.92)),
    radial-gradient(circle at 50% 72%, rgba(141, 31, 45, 0.18), transparent 34%);
}

.model-frame.gallery-light {
  background:
    linear-gradient(180deg, rgba(248, 245, 239, 0.6), rgba(225, 237, 229, 0.74)),
    radial-gradient(circle at 50% 72%, rgba(47, 118, 111, 0.22), transparent 34%);
}

model-viewer {
  position: relative;
  z-index: 2;
  width: 100%;
  height: 100%;
  min-height: 520px;
  --poster-color: transparent;
}

.empty-state {
  position: absolute;
  inset: 0;
  z-index: 3;
  display: grid;
  place-content: center;
  gap: 10px;
  text-align: center;
  pointer-events: none;
}

.empty-state.is-hidden {
  display: none;
}

.ceramic-ghost {
  position: relative;
  width: 190px;
  height: 256px;
  margin: 0 auto 8px;
}

.ceramic-ghost span {
  position: absolute;
  display: block;
}

.vase-neck {
  left: 70px;
  top: 18px;
  width: 50px;
  height: 72px;
  border-radius: 24px 24px 14px 14px;
  background: linear-gradient(180deg, #eef6f7, #8fb9c7);
  border: 8px solid #265f82;
  border-bottom: 0;
}

.vase-shoulder {
  left: 28px;
  top: 76px;
  width: 134px;
  height: 72px;
  border-radius: 66px 66px 24px 24px;
  background:
    radial-gradient(circle at 35% 45%, rgba(255, 255, 255, 0.8), transparent 22%),
    linear-gradient(135deg, #ffffff, #9ac7d2);
  border: 7px solid #265f82;
}

.vase-body {
  left: 36px;
  top: 118px;
  width: 118px;
  height: 118px;
  border-radius: 34px 34px 52px 52px;
  background:
    radial-gradient(circle at 38% 32%, rgba(255, 255, 255, 0.84), transparent 18%),
    repeating-linear-gradient(115deg, rgba(38, 95, 130, 0.72) 0 8px, transparent 8px 26px),
    linear-gradient(180deg, #f8ffff, #b5d8df);
  border: 7px solid #265f82;
}

.vase-base {
  left: 58px;
  bottom: 10px;
  width: 74px;
  height: 24px;
  border-radius: 0 0 22px 22px;
  background: #265f82;
}

.stage-floor {
  position: absolute;
  left: 10%;
  right: 10%;
  bottom: 34px;
  z-index: 1;
  height: 32px;
  border-radius: 50%;
  background: rgba(39, 32, 26, 0.11);
  filter: blur(12px);
}

.timeline-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.timeline-step {
  min-width: 0;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.62);
  color: var(--muted);
  text-align: center;
  font-size: 13px;
  font-weight: 700;
}

.timeline-step.active {
  color: #fff;
  background: var(--lacquer);
}

.tag {
  display: inline-flex;
  margin-bottom: 12px;
  padding: 6px 9px;
  border-radius: 999px;
  background: rgba(47, 118, 111, 0.12);
  color: var(--jade);
  font-size: 12px;
  font-weight: 800;
}

.hero-card h2 {
  font-size: 25px;
}

.spec-list {
  display: grid;
  gap: 12px;
  margin: 0;
}

.spec-list div {
  display: grid;
  gap: 3px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}

.spec-list div:last-child {
  padding-bottom: 0;
  border-bottom: 0;
}

.spec-list dt,
.copy-stack span {
  font-size: 12px;
  font-weight: 800;
}

.spec-list dd {
  margin: 0;
  font-weight: 700;
}

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

.copy-stack article {
  padding: 11px;
  border-radius: 8px;
  background: rgba(201, 154, 66, 0.11);
}

.copy-stack p {
  margin: 5px 0 0;
  line-height: 1.55;
}

.command-panel {
  display: grid;
  gap: 10px;
}

.primary-command,
.secondary-command {
  min-height: 44px;
  border-radius: 8px;
  font-weight: 800;
}

.primary-command {
  border: 0;
  background: var(--lacquer);
  color: #fff8eb;
}

.secondary-command {
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.72);
  color: var(--ink);
}

@media (max-width: 1180px) {
  .studio-shell {
    grid-template-columns: 280px minmax(0, 1fr);
  }

  .inspector-rail {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .command-panel {
    align-content: start;
  }
}

@media (max-width: 780px) {
  .studio-shell,
  .inspector-rail {
    grid-template-columns: 1fr;
  }

  .studio-shell {
    padding: 12px;
  }

  .asset-rail {
    grid-row: 1;
  }

  .viewer-stage {
    grid-row: 2;
    min-height: 70vh;
  }

  .stage-header {
    align-items: flex-start;
  }

  .stage-header h2 {
    font-size: 32px;
  }

  .model-frame,
  model-viewer {
    min-height: 430px;
  }

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