:root {
  --ink: #151922;
  --muted: #687487;
  --line: #dce2ec;
  --soft: #f4f7fb;
  --panel: #ffffff;
  --blue: #246bfe;
  --green: #17866f;
  --red: #c83232;
  --amber: #c8892f;
  --shadow: 0 14px 38px rgba(25, 35, 55, 0.1);
  font-family:
    Inter, "MiSans", "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background: #e9eef6;
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-rows: auto 1fr;
}

.topbar {
  min-height: 76px;
  padding: 14px 22px;
  border-bottom: 1px solid #d7deea;
  background: rgba(255, 255, 255, 0.94);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.topbar p,
.panel-heading span {
  margin: 0 0 3px;
  color: var(--green);
  font-size: 12px;
  font-weight: 900;
}

.topbar h1 {
  margin: 0;
  font-size: 25px;
  letter-spacing: 0;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.status-pill {
  height: 34px;
  padding: 0 12px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  font-size: 12px;
  font-weight: 900;
}

.status-pill.ready {
  color: var(--green);
  background: #eaf8f4;
}

.primary-button,
.ghost-button {
  min-height: 40px;
  border: 0;
  border-radius: 8px;
  padding: 0 14px;
  font-weight: 900;
}

.primary-button {
  color: #fff;
  background: var(--blue);
  box-shadow: 0 10px 24px rgba(36, 107, 254, 0.22);
}

.ghost-button {
  color: var(--ink);
  border: 1px solid var(--line);
  background: #fff;
}

.primary-button:disabled,
.ghost-button:disabled {
  cursor: wait;
  opacity: 0.68;
}

.full-button {
  width: 100%;
}

.workspace {
  min-height: 0;
  padding: 18px;
  display: grid;
  grid-template-columns: 300px minmax(560px, 1fr) 340px;
  gap: 16px;
}

.left-panel,
.right-panel {
  min-height: 0;
  display: grid;
  align-content: start;
  gap: 12px;
}

.panel-card,
.canvas-toolbar,
.stage-wrap,
.insight-strip article {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.panel-card {
  padding: 14px;
}

.panel-heading {
  margin-bottom: 12px;
}

.panel-heading h2 {
  margin: 0;
  font-size: 17px;
}

.upload-dropzone {
  min-height: 154px;
  border: 1.5px dashed #b9c5d8;
  border-radius: 8px;
  background: #f8fbff;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 6px;
  text-align: center;
}

.upload-dropzone input {
  display: none;
}

.upload-dropzone strong {
  font-size: 15px;
}

.upload-dropzone em,
.source-preview span,
.canvas-toolbar span,
.field span,
.range-field span,
.analysis-grid span,
.insight-strip span {
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
}

.upload-icon {
  width: 46px;
  height: 38px;
  border: 3px solid var(--blue);
  border-radius: 8px;
  position: relative;
}

.upload-icon::after {
  content: "";
  position: absolute;
  width: 13px;
  height: 13px;
  border: 3px solid var(--blue);
  border-radius: 999px;
  left: 13px;
  top: 9px;
}

.source-preview {
  margin-top: 12px;
  display: grid;
  grid-template-columns: 72px 1fr;
  gap: 10px;
  align-items: center;
}

.source-preview img {
  width: 72px;
  height: 72px;
  object-fit: cover;
  border-radius: 8px;
}

.source-preview strong {
  display: block;
  font-size: 14px;
}

.analysis-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 12px;
}

.analysis-grid article {
  min-height: 68px;
  border-radius: 8px;
  background: #f7f9fc;
  padding: 10px;
  display: grid;
  align-content: center;
}

.analysis-grid strong {
  margin-top: 4px;
  font-size: 13px;
}

.check-list {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 8px;
}

.check-list li {
  min-height: 34px;
  border-radius: 8px;
  padding: 8px 10px 8px 30px;
  background: #f7f9fc;
  position: relative;
  font-size: 13px;
}

.check-list li::before {
  content: "";
  position: absolute;
  left: 10px;
  top: 12px;
  width: 10px;
  height: 10px;
  border-radius: 999px;
}

.check-list .pass::before {
  background: var(--green);
}

.check-list .warn::before {
  background: var(--amber);
}

.qa-detail-list {
  margin: 12px 0 0;
  padding: 10px;
  list-style: none;
  display: grid;
  gap: 7px;
  border-radius: 8px;
  background: #f7f9fc;
}

.qa-detail-list li {
  position: relative;
  padding-left: 18px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.qa-detail-list li::before {
  content: "";
  position: absolute;
  left: 2px;
  top: 7px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #95a3b8;
}

.qa-detail-list .pass::before {
  background: var(--green);
}

.qa-detail-list .warn::before {
  background: var(--amber);
}

.qa-detail-list .info::before {
  background: var(--blue);
}

.canvas-column {
  min-width: 0;
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: 12px;
}

.canvas-toolbar {
  padding: 12px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.canvas-toolbar strong {
  display: block;
  font-size: 15px;
}

.segmented-control {
  height: 38px;
  padding: 4px;
  border-radius: 8px;
  background: #edf2f8;
  display: flex;
  gap: 4px;
}

.segmented-control button {
  min-width: 76px;
  border: 0;
  border-radius: 7px;
  color: var(--muted);
  background: transparent;
  font-size: 12px;
  font-weight: 900;
}

.segmented-control .active {
  color: var(--blue);
  background: #fff;
}

.stage-wrap {
  min-height: 0;
  padding: 18px;
  display: grid;
  place-items: center;
  overflow: auto;
}

.design-stage {
  width: min(100%, 760px);
  aspect-ratio: 1 / 1;
  position: relative;
  overflow: hidden;
  border-radius: 4px;
  background: #ddd;
  box-shadow: 0 20px 46px rgba(19, 28, 45, 0.18);
}

.stage-image {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.design-stage.show-result .stage-image {
  object-fit: contain;
  background: #f7f9fc;
}

.safe-zone {
  position: absolute;
  left: 6.5%;
  top: 16%;
  width: 35%;
  height: 46%;
  border: 1px dashed rgba(36, 107, 254, 0.35);
  border-radius: 10px;
  display: none;
}

.design-stage.show-source .stage-title,
.design-stage.show-source .feature-grid,
.design-stage.show-result .stage-title,
.design-stage.show-result .feature-grid {
  display: none;
}

.design-stage.ai-rendered .stage-title,
.design-stage.ai-rendered .feature-grid {
  display: none;
}

.design-stage.show-compare::after {
  content: "预计效果";
  position: absolute;
  left: 18px;
  bottom: 18px;
  padding: 8px 14px;
  border-radius: 8px;
  color: #fff;
  background: rgba(239, 68, 68, 0.95);
  font-size: 22px;
  font-weight: 900;
}

.design-stage.show-compare .safe-zone {
  display: block;
}

.stage-badge {
  position: absolute;
  left: 18px;
  bottom: 18px;
  z-index: 3;
  padding: 8px 14px;
  border-radius: 8px;
  color: #fff;
  background: rgba(17, 24, 39, 0.86);
  font-size: 18px;
  font-weight: 900;
}

.design-stage.show-result.has-result .stage-badge {
  background: rgba(36, 107, 254, 0.94);
}

.empty-result {
  position: absolute;
  inset: 0;
  z-index: 2;
  padding: 24px;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 8px;
  text-align: center;
  color: var(--ink);
  background: rgba(244, 247, 251, 0.86);
  backdrop-filter: blur(4px);
}

.empty-result strong {
  font-size: 22px;
}

.empty-result span {
  max-width: 280px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}

.compare-view {
  width: min(100%, 980px);
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.compare-card {
  min-width: 0;
  aspect-ratio: 1 / 1;
  position: relative;
  overflow: hidden;
  border-radius: 6px;
  background: #dfe5ee;
  box-shadow: 0 18px 42px rgba(19, 28, 45, 0.15);
}

.compare-card img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
  background: #f7f9fc;
}

.compare-card img.is-muted {
  filter: grayscale(1);
  opacity: 0.36;
}

.compare-card > span,
.compare-empty {
  position: absolute;
  z-index: 2;
  border-radius: 8px;
  font-weight: 900;
}

.compare-card > span {
  left: 14px;
  bottom: 14px;
  padding: 7px 12px;
  color: #fff;
  background: rgba(17, 24, 39, 0.86);
  font-size: 16px;
}

.compare-card:last-child > span {
  background: rgba(36, 107, 254, 0.94);
}

.compare-empty {
  inset: 50% auto auto 50%;
  padding: 8px 12px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.92);
  font-size: 13px;
  transform: translate(-50%, -50%);
}

.stage-title {
  position: absolute;
  top: var(--title-y, 4%);
  left: 7%;
  right: 4%;
  margin: 0;
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 0.28em;
  text-align: center;
  white-space: nowrap;
  font-size: clamp(24px, 3.65vw, 48px);
  line-height: 0.95;
  font-weight: 1000;
  letter-spacing: 0;
  text-transform: uppercase;
  text-shadow:
    0 2px 0 rgba(255, 255, 255, 0.95),
    0 0 10px rgba(255, 255, 255, 0.86);
}

.stage-title span {
  color: #0d1117;
}

.stage-title mark {
  color: var(--accent-color, #c83232);
  background: transparent;
}

.feature-grid {
  position: absolute;
  left: var(--features-x, 8%);
  top: var(--features-y, 13%);
  width: min(37%, 300px);
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: clamp(16px, 2.2vw, 28px) clamp(16px, 2.4vw, 30px);
  align-items: start;
  justify-items: center;
}

.feature-item {
  display: grid;
  justify-items: center;
  text-align: center;
  align-content: start;
  gap: 7px;
  width: 100%;
  min-width: 0;
}

.feature-item strong {
  color: #111;
  max-width: 132px;
  min-height: 2.3em;
  display: -webkit-box;
  overflow: hidden;
  font-size: clamp(10px, 1.18vw, 15px);
  line-height: 1.15;
  font-weight: 900;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow-wrap: anywhere;
  text-shadow:
    0 1px 0 #fff,
    0 0 5px rgba(255, 255, 255, 0.92);
}

.feature-icon {
  width: clamp(50px, 5.35vw, 74px);
  height: clamp(50px, 5.35vw, 74px);
  border-radius: 999px;
  background: var(--icon-bg, #fff);
  border: 1px solid rgba(12, 18, 28, 0.08);
  box-shadow: 0 7px 16px rgba(10, 20, 35, 0.16);
  position: relative;
}

.feature-icon::before,
.feature-icon::after {
  content: "";
  position: absolute;
}

.icon-clean::before {
  left: 28%;
  top: 28%;
  width: 44%;
  height: 44%;
  border: 3px solid #111;
  border-radius: 6px;
}

.icon-clean::after {
  left: 39%;
  top: 17%;
  width: 22%;
  height: 16%;
  border: 3px solid #111;
  border-bottom: 0;
  border-radius: 6px 6px 0 0;
}

.icon-timer::before {
  left: 25%;
  top: 26%;
  width: 50%;
  height: 50%;
  border: 3px solid #111;
  border-radius: 999px;
}

.icon-timer::after {
  left: 50%;
  top: 34%;
  width: 22%;
  height: 3px;
  background: #111;
  transform: rotate(-44deg);
  transform-origin: left center;
}

.icon-cube::before {
  left: 30%;
  top: 28%;
  width: 40%;
  height: 40%;
  border: 3px solid #111;
  transform: rotate(30deg) skew(-10deg);
}

.icon-heat::before {
  left: 25%;
  top: 47%;
  width: 50%;
  height: 22%;
  border-top: 3px solid #111;
  border-bottom: 3px solid #111;
}

.icon-heat::after {
  left: 30%;
  top: 25%;
  width: 40%;
  height: 18%;
  border-top: 3px solid #111;
  border-radius: 50%;
}

.icon-sparkle::before {
  left: 33%;
  top: 14%;
  width: 34%;
  height: 72%;
  border: 3px solid #111;
  transform: rotate(45deg);
}

.icon-sparkle::after {
  left: 14%;
  top: 33%;
  width: 72%;
  height: 34%;
  border: 3px solid #111;
  transform: rotate(45deg);
}

.icon-drop::before {
  left: 30%;
  top: 18%;
  width: 40%;
  height: 56%;
  border: 3px solid #111;
  border-radius: 50% 50% 55% 55%;
  transform: rotate(45deg);
}

.icon-leaf::before {
  left: 25%;
  top: 22%;
  width: 50%;
  height: 46%;
  border: 3px solid #111;
  border-radius: 70% 0 70% 0;
  transform: rotate(-22deg);
}

.icon-leaf::after {
  left: 34%;
  top: 52%;
  width: 36%;
  height: 3px;
  background: #111;
  transform: rotate(-34deg);
}

.icon-shield::before {
  left: 28%;
  top: 18%;
  width: 44%;
  height: 56%;
  border: 3px solid #111;
  border-radius: 8px 8px 18px 18px;
}

.insight-strip {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
}

.insight-strip article {
  min-height: 72px;
  padding: 12px;
  display: grid;
  align-content: center;
}

.insight-strip strong {
  margin-top: 4px;
  font-size: 14px;
}

.field,
.range-field {
  display: grid;
  gap: 6px;
  margin-bottom: 12px;
}

.field input,
.feature-editor-list input,
.feature-editor-list select {
  width: 100%;
  height: 38px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 10px;
  background: #fbfcfd;
  color: var(--ink);
}

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

.color-row label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.color-row input {
  width: 100%;
  height: 38px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.feature-editor-list {
  display: grid;
  gap: 8px;
  margin-bottom: 12px;
}

.feature-editor-list article {
  display: grid;
  grid-template-columns: 86px 1fr;
  gap: 8px;
}

.history-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.empty-history {
  grid-column: 1 / -1;
  margin: 0;
  padding: 14px;
  border-radius: 8px;
  color: var(--muted);
  background: #f7f9fc;
  font-size: 12px;
  text-align: center;
}

.history-item {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 6px;
  display: grid;
  gap: 6px;
  background: #fff;
  text-align: left;
}

.history-item img {
  width: 100%;
  aspect-ratio: 1 / 1;
  border-radius: 6px;
  object-fit: cover;
  background: #eef2f7;
}

.history-item span {
  overflow: hidden;
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.range-field input {
  width: 100%;
  accent-color: var(--blue);
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  z-index: 20;
  min-height: 42px;
  padding: 10px 16px;
  border-radius: 999px;
  color: #fff;
  background: rgba(17, 24, 39, 0.92);
  box-shadow: 0 14px 34px rgba(15, 23, 42, 0.28);
  display: none;
  align-items: center;
  transform: translateX(-50%);
  font-size: 13px;
  font-weight: 900;
}

.toast.active {
  display: flex;
}

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

  .right-panel {
    grid-column: 1 / -1;
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (max-width: 820px) {
  .topbar,
  .canvas-toolbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .workspace {
    grid-template-columns: 1fr;
    padding: 12px;
  }

  .right-panel {
    grid-template-columns: 1fr;
  }

  .feature-grid {
    left: 6%;
    width: 38%;
    gap: 12px 10px;
  }

  .stage-title {
    left: 6%;
    right: 3%;
    font-size: clamp(19px, 7vw, 34px);
  }

  .feature-icon {
    width: clamp(42px, 11vw, 58px);
    height: clamp(42px, 11vw, 58px);
  }

  .feature-item strong {
    max-width: 94px;
    font-size: clamp(9px, 2.6vw, 12px);
  }

  .history-list {
    grid-template-columns: 1fr 1fr;
  }

  .compare-view {
    grid-template-columns: 1fr;
  }
}
