:root {
  color-scheme: light;
  --ink: #172a2d;
  --ink-soft: #5a6e70;
  --muted: #8b9b9c;
  --paper: #f5f7f5;
  --panel: #ffffff;
  --line: #e3e9e7;
  --line-dark: #cbd8d5;
  --accent: #087f78;
  --accent-dark: #075e59;
  --accent-soft: #e4f3f0;
  --gold: #be8838;
  --gold-soft: #f8f0e2;
  --danger: #ae514a;
  --radius-xl: 24px;
  --radius-lg: 16px;
  --radius-md: 12px;
  --radius-sm: 9px;
  --shadow: 0 14px 40px rgba(27, 54, 52, .08);
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "SF Pro Text", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  font-synthesis: none;
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; min-width: 320px; color: var(--ink); background: var(--paper); }
button, input, select { font: inherit; }
button { cursor: pointer; }
button:focus-visible, input:focus-visible, select:focus-visible, .upload-zone:focus-within { outline: 3px solid rgba(8,127,120,.22); outline-offset: 3px; }
.app-shell { min-height: 100vh; max-width: 1800px; margin: 0 auto; background: var(--paper); }
.topbar { min-height: 72px; padding: 0 clamp(20px, 4vw, 64px); display: flex; align-items: center; justify-content: space-between; gap: 18px; border-bottom: 1px solid var(--line); background: rgba(255,255,255,.85); backdrop-filter: blur(14px); }
.brand { display: inline-flex; align-items: center; gap: 12px; color: var(--ink); text-decoration: none; }
.brand-mark { width: 30px; height: 30px; display: grid; place-items: center; color: #fff; background: var(--accent); border-radius: 9px; font-size: 12px; transform: rotate(45deg); }
.brand strong { display: block; font-size: 16px; letter-spacing: .04em; }
.brand small { display: block; margin-top: 3px; color: var(--muted); font-size: 9px; font-weight: 700; letter-spacing: .17em; }
.api-status { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 11px; }
.api-status i { width: 7px; height: 7px; border-radius: 50%; background: #b8c5c3; }
.api-status:has(#apiState:not(:empty)) i { background: var(--accent); }
.workspace { max-width: 1640px; margin: 0 auto; padding: clamp(26px, 5vw, 58px) clamp(18px, 4vw, 64px) 48px; }
.hero { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; margin-bottom: 32px; }
.eyebrow { margin: 0 0 8px; color: var(--accent-dark); font-size: 10px; font-weight: 800; letter-spacing: .17em; text-transform: uppercase; }
h1, h2, p { margin-top: 0; }
h1 { margin-bottom: 12px; font-size: clamp(32px, 4.5vw, 58px); line-height: 1.06; letter-spacing: -.06em; }
.hero-copy { max-width: 650px; margin: 0; color: var(--ink-soft); font-size: 14px; line-height: 1.7; }
.hero-badge { min-width: 110px; padding: 13px 15px; border: 1px solid #ead9bc; border-radius: 12px; color: #976723; background: var(--gold-soft); text-align: center; }
.hero-badge span, .hero-badge small { display: block; }
.hero-badge span { font-size: 18px; font-weight: 800; }
.hero-badge small { margin-top: 2px; color: #9f8157; font-size: 10px; }
.stepper { display: flex; align-items: center; gap: 12px; margin-bottom: 20px; padding: 11px 14px; border: 1px solid var(--line); border-radius: var(--radius-lg); background: #fff; box-shadow: 0 5px 20px rgba(27,54,52,.04); }
.step { display: flex; align-items: center; gap: 9px; color: var(--muted); white-space: nowrap; }
.step b { width: 29px; height: 29px; display: grid; place-items: center; border-radius: 9px; color: var(--muted); background: #f0f4f2; font-size: 10px; }
.step span { font-size: 12px; font-weight: 700; }
.step.active { color: var(--ink); }
.step.active b { color: #fff; background: var(--accent); box-shadow: 0 4px 10px rgba(8,127,120,.18); }
.step.done { color: var(--accent-dark); }
.step.done b { color: var(--accent-dark); background: var(--accent-soft); }
.step-line { height: 1px; flex: 1; min-width: 16px; background: var(--line); }
.content-grid { display: grid; grid-template-columns: minmax(300px, 370px) minmax(0, 1fr); gap: 20px; align-items: start; }
.control-panel, .preview-panel { min-width: 0; border: 1px solid var(--line); border-radius: var(--radius-xl); background: var(--panel); box-shadow: var(--shadow); }
.control-panel { position: sticky; top: 20px; overflow: hidden; }
.section-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 23px 23px 17px; }
.section-heading h2 { margin: 0; font-size: 20px; letter-spacing: -.04em; }
.section-index { width: 28px; height: 28px; display: grid; place-items: center; border-radius: 9px; color: var(--accent-dark); background: var(--accent-soft); font-size: 10px; font-weight: 800; }
.upload-zone { min-height: 174px; margin: 0 20px 23px; padding: 22px 16px; display: flex; flex-direction: column; align-items: center; justify-content: center; border: 1.5px dashed #a9cbc4; border-radius: var(--radius-lg); background: #f8fcfb; text-align: center; transition: .2s ease; }
.upload-zone:hover, .upload-zone.dragover { border-color: var(--accent); background: #edf9f5; transform: translateY(-1px); }
.upload-icon { width: 35px; height: 35px; display: grid; place-items: center; border-radius: 11px; color: var(--accent); background: var(--accent-soft); font-size: 24px; line-height: 1; }
.upload-zone > strong { margin-top: 10px; font-size: 13px; }
.upload-zone > small { margin-top: 5px; color: var(--muted); font-size: 10px; }
.file-name { max-width: 100%; overflow: hidden; margin-top: 8px; color: var(--accent-dark); font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.upload-action { position: relative; display: inline-flex; margin-top: 12px; border-radius: 9px; box-shadow: 0 5px 14px rgba(8,127,120,.14); cursor: pointer; }
.file-input { position: absolute; inset: 0; z-index: 2; width: 100%; height: 100%; opacity: 0; cursor: pointer; }
.upload-button { padding: 8px 15px; display: inline-block; border: 1px solid var(--accent); border-radius: 9px; color: #fff; background: var(--accent); font-size: 11px; font-weight: 750; pointer-events: none; }
.parameter-heading { margin: 0 20px; padding: 18px 0 13px; border-top: 1px solid var(--line); }
.parameter-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 13px 10px; margin: 0 20px; }
.field > span, .select-field > span { display: block; margin-bottom: 6px; color: var(--ink-soft); font-size: 11px; font-weight: 650; }
.field > div { position: relative; }
.field input, .select-field select { width: 100%; min-height: 38px; padding: 8px 34px 8px 10px; border: 1px solid var(--line); border-radius: var(--radius-sm); color: var(--ink); background: #fcfdfc; font-size: 12px; }
.field input:focus, .select-field select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(8,127,120,.1); outline: 0; }
.field em { position: absolute; right: 9px; top: 50%; transform: translateY(-50%); color: var(--muted); font-size: 9px; font-style: normal; pointer-events: none; }
.base-shape { display: block; margin: 15px 20px 22px; }
.base-shape select { padding-right: 8px; }
.generate-block { padding: 17px 20px; display: flex; align-items: center; justify-content: space-between; gap: 12px; border-top: 1px solid var(--line); background: #f8faf9; }
.generate-block > span { max-width: 155px; color: var(--muted); font-size: 10px; line-height: 1.4; }
.generate-block > span.error { color: var(--danger); }
.primary-btn, .download-btn { min-height: 42px; padding: 0 17px; display: inline-flex; align-items: center; justify-content: center; gap: 12px; border: 0; border-radius: 10px; color: #fff; background: var(--accent); box-shadow: 0 6px 16px rgba(8,127,120,.18); font-size: 12px; font-weight: 780; }
.primary-btn:hover:not(:disabled), .download-btn:hover:not(:disabled) { background: var(--accent-dark); transform: translateY(-1px); }
.primary-btn:disabled, .download-btn:disabled { opacity: .42; cursor: not-allowed; box-shadow: none; }
.preview-panel { padding-bottom: 22px; }
.preview-heading { padding-bottom: 17px; }
.text-btn { border: 0; color: var(--accent-dark); background: transparent; font-size: 11px; font-weight: 700; }
.text-btn:disabled { color: var(--muted); cursor: not-allowed; }
.preview-grid { display: grid; grid-template-columns: minmax(0, .95fr) minmax(0, 1.05fr); gap: 14px; padding: 0 22px; }
.preview-card { min-width: 0; overflow: hidden; border: 1px solid var(--line); border-radius: var(--radius-lg); background: #fbfdfc; }
.card-topline { min-height: 46px; padding: 13px 14px; display: flex; align-items: center; justify-content: space-between; gap: 10px; border-bottom: 1px solid var(--line); font-size: 12px; font-weight: 800; }
.card-topline span:last-child { color: var(--muted); font-size: 10px; font-weight: 550; }
.line-stage { height: 410px; overflow: hidden; display: flex; align-items: center; justify-content: center; padding: 15px; background: repeating-conic-gradient(#f7faf8 0 25%, #edf3f0 0 50%) 50% / 18px 18px; }
.line-stage img { width: 100%; height: 100%; object-fit: contain; display: block; transform-origin: center; transition: transform .15s ease; }
.line-stage img[hidden], .model-stage canvas[hidden] { display: none; }
.zoom-bar { min-height: 44px; padding: 8px 12px; display: flex; align-items: center; justify-content: center; gap: 9px; border-top: 1px solid var(--line); color: var(--muted); font-size: 10px; }
.zoom-bar button { width: 27px; height: 27px; padding: 0; border: 1px solid var(--line-dark); border-radius: 7px; color: var(--ink); background: #fff; font-size: 16px; line-height: 1; }
.zoom-bar button:hover { border-color: var(--accent); color: var(--accent-dark); }
.zoom-bar #lineZoomValue { min-width: 42px; color: var(--ink-soft); text-align: center; font-weight: 700; }
.zoom-bar .zoom-reset { width: auto; margin-left: 5px; padding: 0 8px; color: var(--muted); font-size: 10px; }
.model-stage { position: relative; height: 454px; overflow: hidden; background: radial-gradient(circle at 50% 35%, #f7faf8, #eaf1ee); }
.model-stage canvas { width: 100%; height: 100%; display: block; }
.empty-state { min-height: 180px; padding: 25px; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; color: var(--muted); }
.empty-state[hidden] { display: none !important; }
/* Keep the line-preview placeholder out of the flex layout after a result
   arrives, even when a host page injects a competing display rule. */
.empty-state.is-hidden { display: none !important; }
.empty-state > span { width: 38px; height: 38px; display: grid; place-items: center; margin-bottom: 12px; border-radius: 50%; color: var(--accent-dark); background: var(--accent-soft); font-size: 11px; font-weight: 800; }
.empty-state b { color: var(--ink); font-size: 12px; }
.empty-state small { max-width: 230px; margin-top: 6px; font-size: 10px; line-height: 1.55; }
.model-legend { min-height: 42px; padding: 10px 14px; display: flex; align-items: center; gap: 13px; color: var(--muted); font-size: 10px; }
.model-legend span { display: inline-flex; align-items: center; gap: 5px; }
.legend-dot { width: 7px; height: 7px; display: inline-block; border-radius: 50%; }
.legend-dot.base { background: #161b1e; }
.legend-dot.wire { background: var(--gold); }
.model-legend span:last-child { margin-left: auto; }
.download-panel { margin: 17px 22px 0; padding: 18px 20px; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 18px; border: 1px solid #d9e8e3; border-radius: var(--radius-lg); background: #f2faf7; }
.download-panel h2 { margin: 0; font-size: 17px; letter-spacing: -.03em; }
.download-panel p:not(.eyebrow) { margin: 5px 0 0; color: var(--ink-soft); font-size: 11px; }
.download-btn { min-width: 130px; }
.download-row { flex: 1 0 100%; min-height: 26px; padding-top: 8px; border-top: 1px solid #d9e8e3; color: var(--muted); font-size: 10px; line-height: 1.45; }
.download-modal { width: min(500px, calc(100% - 28px)); padding: 0; border: 0; border-radius: 20px; background: transparent; color: var(--ink); box-shadow: 0 25px 70px rgba(14,38,38,.26); }
.download-modal::backdrop { background: rgba(16,34,34,.38); backdrop-filter: blur(3px); }
.modal-card { position: relative; padding: 27px; border: 1px solid var(--line); border-radius: 20px; background: #fff; }
.modal-close { position: absolute; right: 16px; top: 14px; width: 30px; height: 30px; border: 0; border-radius: 50%; color: var(--muted); background: #f4f7f5; font-size: 21px; line-height: 1; }
.modal-card h2 { margin: 0; font-size: 23px; letter-spacing: -.04em; }
.modal-copy { margin: 8px 0 18px; color: var(--ink-soft); font-size: 12px; }
.export-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; }
.export-option { min-height: 70px; position: relative; display: flex; align-items: flex-start; gap: 8px; padding: 12px 10px; border: 1px solid var(--line); border-radius: 10px; cursor: pointer; }
.export-option:hover { border-color: #9cc6bd; background: #f5fbf9; }
.export-option input { position: absolute; opacity: 0; pointer-events: none; }
.checkmark { width: 16px; height: 16px; flex: 0 0 auto; margin-top: 1px; border: 1px solid #b4c5c0; border-radius: 5px; background: #fff; }
.export-option input:checked + .checkmark { border-color: var(--accent); background: var(--accent); box-shadow: inset 0 0 0 3px #fff; }
.export-option b, .export-option small { display: block; }
.export-option b { font-size: 11px; }
.export-option small { margin-top: 5px; color: var(--muted); font-size: 9px; }
.export-option.accent-option { border-color: #acd4ca; background: #f0faf7; }
.modal-actions { display: flex; justify-content: flex-end; gap: 9px; margin-top: 21px; }
.secondary-btn { min-height: 40px; padding: 0 17px; border: 1px solid var(--line-dark); border-radius: 9px; color: var(--ink-soft); background: #fff; font-size: 12px; font-weight: 700; }
@media (max-width: 1180px) { .content-grid { grid-template-columns: minmax(290px, 350px) minmax(0, 1fr); } .preview-grid { grid-template-columns: 1fr; } .line-stage { height: 350px; } .model-stage { height: 390px; } }
@media (max-width: 820px) { .topbar { min-height: 64px; } .api-status { display: none; } .hero { align-items: flex-start; } .hero-badge { display: none; } .content-grid { grid-template-columns: 1fr; } .control-panel { position: static; } .preview-grid { grid-template-columns: 1fr 1fr; } .line-stage { height: 350px; } .model-stage { height: 350px; } }
@media (max-width: 600px) { .workspace { padding: 26px 13px 35px; } h1 { font-size: 35px; } .stepper { overflow-x: auto; } .step { min-width: 125px; } .step-line { min-width: 12px; } .preview-grid { grid-template-columns: 1fr; } .line-stage, .model-stage { height: min(78vw, 390px); } .download-panel { align-items: stretch; flex-direction: column; } .download-btn { width: 100%; } .export-grid { grid-template-columns: 1fr; } .modal-card { padding: 23px 18px; } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { transition-duration: .01ms !important; animation-duration: .01ms !important; } }
