:root {
  color-scheme: light;
  --ink: #121926;
  --muted: #667085;
  --line: #d8dde6;
  --soft-line: #e9edf3;
  --paper: #ffffff;
  --canvas: #e9edf1;
  --accent: #f3b51b;
  --accent-strong: #da9500;
  --blue: #2457d6;
  --shadow: 0 18px 50px rgba(18, 25, 38, 0.13);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", sans-serif;
}

* { box-sizing: border-box; }
html { min-width: 320px; background: var(--canvas); }
body { margin: 0; min-height: 100vh; color: var(--ink); background: var(--canvas); }
button, input, select { font: inherit; }
button { color: inherit; }

.topbar {
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
  background: rgba(255,255,255,.96);
  border-bottom: 1px solid var(--line);
  position: relative;
  z-index: 10;
}

.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none; font-size: 17px; font-weight: 750; letter-spacing: -.02em; }
.brand-mark { width: 34px; height: 34px; border-radius: 9px; display: grid; place-items: center; background: var(--ink); box-shadow: inset 0 -2px 0 rgba(255,255,255,.08); }
.brand-mark svg { width: 22px; height: 22px; fill: none; stroke: #fff; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.brand-mark svg path:first-child { fill: #fff; stroke: none; }
.brand-mark svg path:last-child { stroke: var(--ink); stroke-width: 1.2; }

.topbar-actions { display: flex; align-items: center; gap: 10px; }
.entry-link { height: 36px; display: inline-flex; align-items: center; gap: 7px; padding: 0 13px; border: 1px solid #cbd2dd; border-radius: 9px; color: #465266; background: #fff; text-decoration: none; font-size: 13px; font-weight: 750; transition: color .16s ease, border-color .16s ease, background .16s ease, transform .16s ease; }
.entry-link svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.entry-link:hover { color: var(--ink); border-color: #9da8b8; background: #f7f9fb; transform: translateX(-1px); }
.entry-link:focus-visible { outline: 3px solid rgba(36,87,214,.18); outline-offset: 2px; }

.privacy-pill { display: inline-flex; align-items: center; gap: 8px; padding: 8px 12px; border: 1px solid #d9e3da; border-radius: 999px; color: #3d5b45; background: #f7fbf7; font-size: 13px; font-weight: 650; }
.privacy-pill span { width: 7px; height: 7px; border-radius: 50%; background: #32a65a; box-shadow: 0 0 0 4px rgba(50,166,90,.1); }

.workspace { min-height: calc(100vh - 64px); display: grid; grid-template-columns: minmax(340px, 420px) 1fr; }
.controls { background: var(--paper); border-right: 1px solid var(--line); padding: 34px 36px 30px; overflow-y: auto; }
.intro { padding-bottom: 26px; border-bottom: 1px solid var(--soft-line); }
.eyebrow { margin: 0 0 7px; color: #737e91; font-size: 11px; line-height: 1; letter-spacing: .18em; font-weight: 800; }
.intro h1 { margin: 0; font-size: clamp(27px, 2.3vw, 34px); line-height: 1.16; letter-spacing: -.045em; font-weight: 780; }
.intro > p:last-child { margin: 12px 0 0; color: var(--muted); font-size: 15px; line-height: 1.65; }

.step { padding: 23px 0; border-bottom: 1px solid var(--soft-line); }
.step-heading { display: flex; align-items: flex-start; gap: 12px; margin-bottom: 15px; }
.step-number { flex: 0 0 auto; display: grid; place-items: center; width: 27px; height: 27px; border-radius: 8px; border: 1px solid #ccd3df; color: #667085; font-size: 13px; font-weight: 800; }
.step.active .step-number { color: #111827; background: var(--accent); border-color: var(--accent); }
.step-heading h2 { margin: 0 0 3px; font-size: 16px; line-height: 1.15; letter-spacing: -.01em; }
.step-heading p { margin: 0; color: #8a93a3; font-size: 12px; }

.dropzone { min-height: 128px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; border: 1.5px dashed #b9c1cf; border-radius: 14px; background: #fafbfc; cursor: pointer; transition: border-color .18s ease, background .18s ease, transform .18s ease; }
.dropzone:hover, .dropzone.is-dragging { border-color: var(--blue); background: #f3f6ff; transform: translateY(-1px); }
.dropzone input { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.dropzone strong { font-size: 14px; }
.dropzone small { color: #858e9d; font-size: 12px; }
.upload-icon { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 10px; background: #fff; border: 1px solid #d9dee7; color: var(--blue); box-shadow: 0 4px 10px rgba(18,25,38,.05); }
.upload-icon svg { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.file-card { display: flex; align-items: center; gap: 11px; border: 1px solid var(--line); border-radius: 12px; padding: 10px; background: #fbfcfd; }
.file-badge { width: 38px; height: 44px; border-radius: 8px; display: grid; place-items: center; color: #b42318; background: #fff0ee; font-size: 10px; font-weight: 850; letter-spacing: .06em; }
.file-meta { min-width: 0; flex: 1; display: flex; flex-direction: column; gap: 3px; }
.file-meta strong { font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.file-meta span { font-size: 12px; color: var(--muted); }
.icon-button { width: 30px; height: 30px; border: 0; border-radius: 7px; background: transparent; color: #7b8492; cursor: pointer; font-size: 22px; line-height: 1; }
.icon-button:hover { background: #eef1f5; color: #b42318; }

.field-row { display: flex; align-items: end; gap: 9px; }
.preset-row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 12px; }
.preset-button { height: 37px; border: 1px solid #cbd2dd; border-radius: 9px; background: #fff; color: #596579; font-size: 12px; font-weight: 750; cursor: pointer; }
.preset-button:hover { border-color: #9aa6ba; }
.preset-button.is-active { border-color: var(--blue); color: var(--blue); background: #f2f6ff; box-shadow: inset 0 0 0 1px rgba(36,87,214,.08); }
.preset-button:disabled { opacity: .45; cursor: not-allowed; }
.field-row label { flex: 1; color: var(--muted); font-size: 12px; font-weight: 650; }
.field-row select { display: block; width: 100%; height: 40px; margin-top: 6px; padding: 0 12px; border: 1px solid #cbd2dd; border-radius: 9px; background: #fff; color: var(--ink); font-size: 14px; }
.multiply { padding-bottom: 10px; color: #98a2b3; }

.toggle-line, .check-line, .range-line { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-top: 16px; }
.toggle-line { cursor: pointer; }
.toggle-line span { display: flex; flex-direction: column; gap: 2px; }
.toggle-line strong { font-size: 13px; }
.toggle-line small { color: var(--muted); font-size: 11px; }
.toggle-line input { position: absolute; opacity: 0; }
.toggle-line i { flex: 0 0 auto; width: 40px; height: 23px; padding: 3px; border-radius: 99px; background: #cbd2dc; transition: background .18s; }
.toggle-line i::after { content: ""; display: block; width: 17px; height: 17px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.2); transition: transform .18s; }
.toggle-line input:checked + i { background: var(--blue); }
.toggle-line input:checked + i::after { transform: translateX(17px); }

.layout-chip { display: flex; align-items: center; gap: 11px; min-height: 57px; padding: 9px 11px; border: 1px solid var(--line); border-radius: 11px; background: #fbfcfd; }
.layout-chip > div { min-width: 0; flex: 1; display: flex; flex-direction: column; gap: 2px; }
.layout-chip strong { font-size: 13px; }
.layout-chip small { color: var(--muted); font-size: 11px; }
.layout-chip b { color: #526070; font-size: 11px; padding: 5px 7px; background: #eef1f5; border-radius: 6px; }
.mini-grid { width: 34px; height: 42px; display: grid; grid-template-columns: 1fr 1fr; grid-template-rows: 1fr 1fr; gap: 2px; padding: 3px; background: #fff; border: 1px solid #aeb7c5; box-shadow: 0 2px 5px rgba(18,25,38,.08); }
.mini-grid i { background: #e7eaf0; }
.range-line { font-size: 13px; }
.range-line output { font-variant-numeric: tabular-nums; color: var(--muted); }
.range { width: 100%; height: 4px; margin: 13px 0 2px; accent-color: var(--blue); cursor: pointer; }
.check-line { justify-content: flex-start; font-size: 13px; cursor: pointer; }
.check-line input { width: 16px; height: 16px; accent-color: var(--blue); }

.actions { display: grid; grid-template-columns: 1.6fr 1fr; gap: 10px; padding-top: 22px; }
.primary, .secondary { height: 46px; border-radius: 10px; border: 1px solid transparent; font-size: 14px; font-weight: 750; cursor: pointer; transition: transform .15s ease, box-shadow .15s ease, opacity .15s ease; }
.primary { display: inline-flex; align-items: center; justify-content: center; gap: 8px; background: var(--ink); color: #fff; box-shadow: 0 8px 18px rgba(18,25,38,.17); }
.primary svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.secondary { background: #fff; border-color: #cbd2dc; }
.primary:not(:disabled):hover, .secondary:not(:disabled):hover { transform: translateY(-1px); }
.primary:not(:disabled):hover { box-shadow: 0 11px 24px rgba(18,25,38,.23); }
button:disabled { opacity: .42; cursor: not-allowed; box-shadow: none; }

.preview-panel { min-width: 0; display: flex; flex-direction: column; padding: 30px clamp(22px, 4vw, 60px) 22px; background: radial-gradient(circle at 50% 35%, #f3f5f7 0, #e9edf1 58%, #e2e7ec 100%); }
.preview-toolbar, .preview-status { width: min(100%, 760px); margin-inline: auto; }
.preview-toolbar { display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px; }
.preview-toolbar h2 { margin: 0; font-size: 20px; letter-spacing: -.025em; }
.page-nav { display: inline-flex; align-items: center; gap: 10px; height: 36px; padding: 3px; border-radius: 9px; background: rgba(255,255,255,.7); border: 1px solid rgba(166,176,190,.75); backdrop-filter: blur(8px); }
.page-nav button { width: 29px; height: 28px; display: grid; place-items: center; border: 0; border-radius: 6px; background: transparent; font-size: 22px; line-height: 1; cursor: pointer; }
.page-nav button:not(:disabled):hover { background: #fff; }
.page-nav span { color: var(--muted); font-size: 12px; min-width: 48px; text-align: center; font-variant-numeric: tabular-nums; }
.page-nav b { color: var(--ink); }

.stage { min-height: 0; flex: 1; position: relative; display: grid; place-items: center; }
.paper-shell { width: min(72%, 535px); min-width: 310px; filter: drop-shadow(0 22px 35px rgba(27,36,50,.18)); }
.paper { position: relative; width: 100%; aspect-ratio: 210 / 297; display: grid; grid-template-columns: 1fr 1fr; grid-template-rows: 1fr 1fr; overflow: hidden; background: #fff; }
.paper-cell { min-width: 0; min-height: 0; position: relative; display: grid; place-items: center; padding: 6%; overflow: hidden; }
.paper-cell img { display: block; width: 100%; height: 100%; object-fit: contain; }
.paper-cell.placeholder span { display: grid; place-items: center; width: 34px; height: 34px; color: #c5ccd5; border: 1px solid #dfe3e9; border-radius: 50%; font-size: 12px; }
.guide { position: absolute; z-index: 2; pointer-events: none; opacity: .8; }
.guide-v { top: 0; bottom: 0; left: 50%; border-left: 1px dashed #b8c0cb; }
.guide-h { left: 0; right: 0; top: 50%; border-top: 1px dashed #b8c0cb; }
.paper.no-guides .guide { display: none; }
.empty-copy { position: absolute; left: calc(50% + min(36%, 267px) + 34px); top: 50%; transform: translateY(-50%); width: 170px; display: flex; flex-direction: column; gap: 6px; }
.empty-copy strong { font-size: 14px; }
.empty-copy span { color: #788291; font-size: 12px; line-height: 1.55; }
.loading-card { position: absolute; display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 18px 22px; border-radius: 13px; background: rgba(18,25,38,.92); color: #fff; box-shadow: var(--shadow); }
.loading-card strong { font-size: 13px; }
.loading-card small { color: #cbd2dc; font-size: 11px; }
.spinner { width: 23px; height: 23px; border: 2px solid rgba(255,255,255,.25); border-top-color: var(--accent); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.preview-status { display: flex; align-items: center; justify-content: space-between; padding-top: 14px; color: var(--muted); font-size: 12px; }
.preview-status > span:first-child { display: inline-flex; align-items: center; gap: 7px; }
.preview-status i { width: 7px; height: 7px; border-radius: 50%; background: #98a2b3; }
.preview-status .is-ready i { background: #32a65a; box-shadow: 0 0 0 4px rgba(50,166,90,.1); }

.toast { position: fixed; left: 50%; bottom: 22px; z-index: 50; transform: translate(-50%, 18px); min-width: 220px; max-width: calc(100vw - 32px); padding: 12px 16px; border-radius: 9px; background: #151b26; color: #fff; font-size: 13px; box-shadow: 0 12px 30px rgba(18,25,38,.25); opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.is-hidden { display: none !important; }

@media (max-width: 1040px) {
  .workspace { grid-template-columns: 365px 1fr; }
  .controls { padding-inline: 28px; }
  .paper-shell { width: min(82%, 500px); }
  .empty-copy { display: none; }
}

@media (max-width: 760px) {
  .topbar { height: 58px; padding-inline: 16px; }
  .privacy-pill { display: none; }
  .entry-link { height: 34px; padding-inline: 11px; }
  .workspace { display: flex; flex-direction: column; }
  .controls { order: 2; border: 0; padding: 28px 20px 36px; }
  .preview-panel { order: 1; min-height: 620px; padding: 24px 16px 18px; }
  .paper-shell { width: min(84vw, 430px); min-width: 270px; }
  .intro h1 { font-size: 29px; }
}

@media (max-width: 440px) {
  .brand span:last-child { font-size: 15px; }
  .entry-link { padding-inline: 9px; font-size: 12px; }
  .preview-panel { min-height: 530px; }
  .actions { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
