:root {
  --orange: #ef5b13;
  --orange-dark: #c94308;
  --ink: #1c1b19;
  --muted: #74716c;
  --line: #dedbd5;
  --soft: #f6f4f0;
  --paper: #fff;
  --green: #3d7651;
  font-family: Inter, "Microsoft YaHei", "PingFang SC", Arial, sans-serif;
  color: var(--ink);
  background: #f8f7f4;
  font-synthesis: none;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; min-width: 320px; background: #f8f7f4; }
button, input { font: inherit; }
button { color: inherit; }

.topbar {
  height: 76px;
  padding: 0 40px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
  background: rgba(255,255,255,.96);
  position: sticky;
  top: 0;
  z-index: 20;
}
.brand { display: flex; align-items: center; gap: 15px; min-width: 0; }
.brand img { width: 82px; height: 44px; object-fit: contain; }
.brand div { display: grid; gap: 4px; }
.brand strong { font-size: 16px; font-weight: 650; white-space: nowrap; }
.brand span { color: var(--muted); font-size: 10px; }
.service-state { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 13px; }
.service-state i { width: 8px; height: 8px; border-radius: 50%; background: #b7b3ac; }
.service-state.ready i { background: var(--green); }
.service-state.error i { background: #b23a2d; }

.workspace { width: min(1440px, calc(100% - 64px)); margin: 0 auto; padding: 44px 0 72px; }
.intro { display: flex; justify-content: space-between; align-items: end; gap: 40px; padding: 6px 0 34px; }
.eyebrow { display: block; margin-bottom: 9px; color: var(--orange-dark); font-size: 11px; font-weight: 700; text-transform: uppercase; }
h1, h2, p { margin: 0; }
h1 { font-size: clamp(30px, 3vw, 46px); line-height: 1.18; font-weight: 650; }
.intro p { max-width: 430px; color: var(--muted); line-height: 1.8; font-size: 14px; }

.step { padding: 26px 0 30px; border-top: 1px solid var(--line); }
.step-heading { display: flex; align-items: center; gap: 15px; margin-bottom: 20px; }
.step-heading > span { width: 34px; height: 34px; display: grid; place-items: center; border: 1px solid var(--orange); color: var(--orange-dark); font-size: 12px; font-weight: 700; }
.step-heading > div:nth-child(2) { min-width: 0; }
.step-heading h2, .result-heading h2 { font-size: 21px; line-height: 1.3; font-weight: 650; }
.step-heading p { margin-top: 3px; color: var(--muted); font-size: 12px; }
.upload-button { margin-left: auto; min-height: 38px; padding: 0 16px; display: inline-flex; align-items: center; border: 1px solid var(--ink); cursor: pointer; background: #fff; font-size: 13px; }
.upload-button:hover { border-color: var(--orange); color: var(--orange-dark); }
.upload-button input { display: none; }

.pattern-strip { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(150px, 1fr); gap: 12px; overflow-x: auto; padding-bottom: 5px; }
.pattern-option { min-width: 0; border: 1px solid var(--line); background: white; padding: 7px; cursor: pointer; text-align: left; }
.pattern-option img, .pattern-swatch { width: 100%; aspect-ratio: 1 / 1; display: block; object-fit: cover; background: var(--soft); }
.pattern-option span { display: block; padding: 9px 3px 3px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; }
.pattern-option.active { border-color: var(--orange); box-shadow: inset 0 -3px 0 var(--orange); }

.fabric-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 12px; }
.fabric-option { min-height: 96px; padding: 16px; border: 1px solid var(--line); background: white; cursor: pointer; text-align: left; }
.fabric-option strong, .mockup-option strong, .scene-option strong { display: block; font-size: 14px; }
.fabric-option span, .mockup-option span, .scene-option span { display: block; margin-top: 6px; color: var(--muted); font-size: 11px; line-height: 1.55; }
.fabric-option i { width: 24px; height: 5px; display: block; margin-bottom: 13px; background: var(--fabric-color); }
.fabric-option.active, .mockup-option.active, .scene-option.active { border-color: var(--orange); background: #fff8f3; box-shadow: inset 0 -3px 0 var(--orange); }

.segments { margin-left: auto; display: flex; padding: 3px; border: 1px solid var(--line); background: #ece9e3; }
.segments button { min-width: 78px; height: 32px; border: 0; background: transparent; cursor: pointer; font-size: 12px; }
.segments button.active { background: white; color: var(--orange-dark); box-shadow: 0 1px 4px rgba(0,0,0,.08); }
.mockup-grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 12px; }
.mockup-option { min-height: 142px; padding: 16px; border: 1px solid var(--line); background: white; cursor: pointer; text-align: left; position: relative; }
.mockup-option::before { content: attr(data-index); display: block; margin-bottom: 27px; color: #aaa59e; font-size: 11px; }
.scene-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 10px; }
.scene-option { min-height: 88px; padding: 14px; border: 1px solid var(--line); background: white; cursor: pointer; text-align: left; }

.generate-panel { min-height: 104px; padding: 20px 24px; display: flex; align-items: center; gap: 24px; background: #242321; color: white; }
.selection-summary { min-width: 0; display: grid; gap: 5px; }
.selection-summary span { color: #aaa59e; font-size: 10px; }
.selection-summary strong { font-size: 16px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.selection-summary small { color: #c9c5be; font-size: 11px; }
.generate-button { margin-left: auto; min-width: 190px; height: 48px; padding: 0 22px; border: 0; background: var(--orange); color: white; cursor: pointer; font-weight: 650; }
.generate-button:hover { background: #ff6a1f; }
.generate-button:disabled { cursor: wait; background: #77736d; }

.result-section { margin-top: 44px; }
.result-heading { display: flex; justify-content: space-between; align-items: end; margin-bottom: 16px; }
.result-status { color: var(--muted); font-size: 12px; }
.result-empty { min-height: 420px; border: 1px solid var(--line); background: white; display: grid; place-content: center; justify-items: center; gap: 9px; text-align: center; }
.result-empty p { color: var(--muted); font-size: 12px; }
.empty-mark { width: 46px; height: 46px; border: 1px solid var(--orange); display: grid; place-items: center; color: var(--orange-dark); font-size: 12px; font-weight: 700; }
.result-card { width: min(760px, 100%); margin: 0 auto; border: 1px solid var(--line); background: white; }
.result-card img { width: 100%; aspect-ratio: 3 / 4; object-fit: contain; display: block; background: #eeeae4; }
.result-card > div { min-height: 70px; padding: 13px 16px; display: flex; align-items: center; gap: 20px; }
.result-card > div > div { display: grid; gap: 5px; min-width: 0; }
.result-card span { color: var(--muted); font-size: 11px; }
.result-card button { margin-left: auto; height: 36px; padding: 0 14px; border: 1px solid var(--ink); background: white; cursor: pointer; }
footer { padding: 24px 40px; border-top: 1px solid var(--line); background: white; color: var(--muted); text-align: center; font-size: 11px; }

@media (max-width: 980px) {
  .fabric-grid { grid-template-columns: repeat(3, 1fr); }
  .mockup-grid { grid-template-columns: repeat(3, 1fr); }
  .scene-grid { grid-template-columns: repeat(4, 1fr); }
}
@media (max-width: 680px) {
  .topbar { height: 68px; padding: 0 16px; }
  h1 { font-size: 27px; line-height: 1.24; }
  .brand img { width: 63px; }
  .brand strong { font-size: 13px; white-space: normal; }
  .brand span, .service-state span { display: none; }
  .workspace { width: calc(100% - 28px); padding-top: 28px; }
  .intro { display: block; }
  .intro p { margin-top: 16px; }
  .step-heading { align-items: flex-start; flex-wrap: wrap; }
  .upload-button, .segments { margin-left: 49px; }
  .pattern-strip { grid-auto-columns: 135px; }
  .fabric-grid { grid-template-columns: repeat(2, 1fr); }
  .mockup-grid { grid-template-columns: repeat(2, 1fr); }
  .scene-grid { grid-template-columns: repeat(2, 1fr); }
  .generate-panel { align-items: stretch; flex-direction: column; }
  .generate-button { margin-left: 0; width: 100%; }
  .selection-summary strong { white-space: normal; }
}
