@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+SC:wght@400;500;600;700;800&family=Noto+Serif+SC:wght@600;700;800&display=swap');

:root {
  --bg: #f7f7fb;
  --surface: #ffffff;
  --surface-soft: #fafafe;
  --text: #1d1d26;
  --text-secondary: #6e6d7a;
  --border: #e9e8f0;
  --primary: #6e6ae9;
  --primary-dark: #5652d5;
  --primary-soft: #eeedff;
  --accent: #ef9e52;
  --shadow: 0 24px 70px rgba(48, 45, 90, 0.08);
  --radius-lg: 24px;
  --radius-md: 16px;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  min-width: 320px;
  color: var(--text);
  background:
    radial-gradient(circle at 9% 12%, rgba(182, 179, 255, 0.2), transparent 25%),
    radial-gradient(circle at 91% 30%, rgba(255, 220, 184, 0.18), transparent 23%),
    var(--bg);
  font-family: "Noto Sans SC", "PingFang SC", "Microsoft YaHei", sans-serif;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

button, input, textarea, select { font: inherit; }
button, label[for], select, input[type="range"] { cursor: pointer; }

.skip-link {
  position: fixed;
  left: 16px;
  top: -60px;
  z-index: 100;
  padding: 12px 18px;
  color: #fff;
  background: var(--primary-dark);
  border-radius: 10px;
  transition: top 180ms ease;
}
.skip-link:focus { top: 16px; }

.site-header {
  height: 72px;
  padding: 0 max(24px, calc((100vw - 1240px) / 2));
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid rgba(226, 225, 235, 0.85);
  background: rgba(250, 250, 253, 0.82);
  backdrop-filter: blur(14px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  color: var(--text);
  font-size: 17px;
  font-weight: 800;
  text-decoration: none;
}
.brand-mark {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  color: white;
  background: linear-gradient(145deg, #8d89f4, #625ddd);
  border-radius: 12px;
  box-shadow: 0 8px 18px rgba(98, 93, 221, 0.25);
}
.brand-mark svg { width: 23px; stroke: currentColor; stroke-width: 1.8; }
.header-note { color: #858391; font-size: 13px; }

.page-shell { width: min(1240px, calc(100% - 48px)); margin: 0 auto; padding: 58px 0 80px; }
.intro { margin-bottom: 42px; }
.eyebrow { color: var(--primary); font-size: 12px; font-weight: 800; letter-spacing: 0.17em; }
.intro h1 { margin: 12px 0 16px; font-size: clamp(36px, 4.2vw, 58px); line-height: 1.17; letter-spacing: -0.045em; }
.intro h1 span { color: var(--primary); }
.intro p { max-width: 650px; margin: 0; color: var(--text-secondary); font-size: 16px; line-height: 1.8; }

.workspace { display: grid; grid-template-columns: minmax(0, 1fr) 430px; align-items: start; gap: 34px; }
.editor-panel {
  overflow: hidden;
  background: rgba(255,255,255,0.92);
  border: 1px solid rgba(232, 231, 240, 0.95);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
}
.panel-heading { display: flex; align-items: center; justify-content: space-between; padding: 28px 32px 24px; border-bottom: 1px solid var(--border); }
.step-label { color: var(--primary); font-size: 12px; font-weight: 700; }
.panel-heading h2 { margin: 4px 0 0; font-size: 21px; }
.text-button { min-height: 44px; padding: 0 14px; color: var(--text-secondary); background: transparent; border: 0; border-radius: 10px; transition: color 180ms ease, background 180ms ease; }
.text-button:hover { color: var(--primary); background: var(--primary-soft); }

.form-section { padding: 27px 32px 30px; border-bottom: 1px solid var(--border); }
.form-section:last-child { border-bottom: 0; }
.section-title { display: flex; align-items: center; gap: 11px; margin-bottom: 20px; }
.section-title span { width: 30px; height: 30px; display: grid; place-items: center; color: var(--primary); background: var(--primary-soft); border-radius: 9px; font-size: 11px; font-weight: 800; }
.section-title h3 { margin: 0; font-size: 16px; }

.upload-zone {
  min-height: 116px;
  padding: 20px;
  display: flex;
  align-items: center;
  gap: 16px;
  border: 1.5px dashed #cbc9dd;
  border-radius: var(--radius-md);
  background: var(--surface-soft);
  transition: border-color 180ms ease, background 180ms ease, transform 180ms ease;
}
.upload-zone:hover, .upload-zone.is-dragging { border-color: var(--primary); background: #f6f5ff; }
.upload-zone.is-dragging { transform: scale(0.995); }
.upload-icon { flex: 0 0 auto; width: 48px; height: 48px; display: grid; place-items: center; color: var(--primary); background: var(--primary-soft); border-radius: 14px; }
.upload-icon svg { width: 24px; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.upload-copy { min-width: 0; display: flex; flex: 1; flex-direction: column; gap: 5px; }
.upload-copy strong { font-size: 14px; }
.upload-copy small { color: var(--text-secondary); font-size: 12px; }
.upload-action { flex: 0 0 auto; padding: 9px 13px; color: var(--primary); background: #fff; border: 1px solid #dcdaef; border-radius: 10px; font-size: 12px; font-weight: 600; }
.photo-controls { margin-top: 18px; padding: 16px; background: #f9f9fc; border: 1px solid var(--border); border-radius: 14px; }
.control-heading { display: flex; align-items: center; justify-content: space-between; margin-bottom: 4px; color: #3f3e49; font-size: 13px; font-weight: 700; }
.mini-button { min-height: 36px; padding: 0 12px; color: var(--primary); background: var(--primary-soft); border: 0; border-radius: 9px; font-size: 12px; font-weight: 700; transition: background 180ms ease, color 180ms ease; }
.mini-button:hover { color: #fff; background: var(--primary); }
.range-row { margin-top: 13px; display: grid; grid-template-columns: 130px 1fr; align-items: center; gap: 12px; }
.range-row label { display: flex; justify-content: space-between; gap: 6px; color: var(--text-secondary); font-size: 13px; }
.range-row output { color: var(--primary); font-size: 12px; font-variant-numeric: tabular-nums; }
.control-hint { display: block; margin-top: 11px; color: #9694a0; font-size: 11px; line-height: 1.6; }
input[type="range"] { width: 100%; accent-color: var(--primary); }

.field-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.field-wide { grid-column: 1 / -1; }
.field { display: flex; flex-direction: column; gap: 8px; }
.field + .field { margin-top: 18px; }
.field-grid .field + .field { margin-top: 0; }
.field label { color: #3f3e49; font-size: 13px; font-weight: 600; }
.field small { color: #9694a0; font-size: 11px; }
.label-row { display: flex; align-items: center; justify-content: space-between; }
.label-row span { color: #9997a2; font-size: 11px; font-variant-numeric: tabular-nums; }
.char-count { transition: color 180ms ease; }
.char-count.is-over { color: #b45309; font-weight: 600; }
input[type="text"], textarea, select {
  width: 100%;
  color: var(--text);
  background: #fff;
  border: 1px solid #dedde7;
  border-radius: 11px;
  outline: none;
  transition: border-color 180ms ease, box-shadow 180ms ease;
}
input[type="text"], select { height: 46px; padding: 0 13px; }
textarea { min-height: 142px; padding: 12px 13px; resize: vertical; line-height: 1.75; }
input[type="text"]:focus, textarea:focus, select:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(110, 106, 233, 0.12); }
select { appearance: none; background-image: linear-gradient(45deg, transparent 50%, #777483 50%), linear-gradient(135deg, #777483 50%, transparent 50%); background-position: calc(100% - 17px) 19px, calc(100% - 12px) 19px; background-size: 5px 5px; background-repeat: no-repeat; }

.preview-column { position: sticky; top: 24px; }
.preview-toolbar { min-height: 44px; display: flex; align-items: center; justify-content: space-between; color: var(--text-secondary); font-size: 13px; }
.preview-toolbar > div { display: flex; align-items: center; gap: 8px; color: #3d3b47; font-weight: 600; }
.live-dot { width: 8px; height: 8px; border-radius: 50%; background: #43b77d; box-shadow: 0 0 0 4px rgba(67, 183, 125, 0.12); }
#sizeBadge { font-size: 11px; font-variant-numeric: tabular-nums; }
.canvas-stage { padding: 15px; background: #eeedf3; border: 1px solid #e2e1e9; border-radius: 24px; box-shadow: 0 18px 50px rgba(46, 43, 79, 0.09); }
#cardCanvas, #previewCanvas, #compareCanvas, #quoteCanvas, #batchCanvas { width: 100%; height: auto; display: block; border-radius: 17px; background: #fff; box-shadow: 0 8px 22px rgba(43, 40, 76, 0.12); }
.download-button {
  width: 100%;
  min-height: 54px;
  margin-top: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  color: #fff;
  background: linear-gradient(135deg, #7b76ed, #5d58db);
  border: 0;
  border-radius: 14px;
  box-shadow: 0 12px 26px rgba(90, 84, 216, 0.28);
  font-weight: 700;
  transition: transform 180ms ease, box-shadow 180ms ease, filter 180ms ease;
}
.download-button:hover { transform: translateY(-2px); box-shadow: 0 15px 30px rgba(90, 84, 216, 0.34); filter: saturate(1.08); }
.download-button:active { transform: translateY(0); }
.download-button svg { width: 21px; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.privacy-note { margin: 13px 0 0; display: flex; align-items: center; justify-content: center; gap: 6px; color: #9795a0; font-size: 11px; }
.privacy-note svg { width: 15px; stroke: currentColor; stroke-width: 1.7; }

.toast { position: fixed; left: 50%; bottom: 28px; z-index: 50; padding: 12px 18px; color: #fff; background: #272631; border-radius: 12px; box-shadow: 0 12px 28px rgba(0,0,0,0.2); font-size: 13px; opacity: 0; pointer-events: none; transform: translate(-50%, 16px); transition: opacity 200ms ease, transform 200ms ease; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

button:focus-visible, label:focus-within, input:focus-visible, textarea:focus-visible, select:focus-visible, a:focus-visible { outline: 3px solid rgba(110, 106, 233, 0.32); outline-offset: 2px; }

@media (max-width: 980px) {
  .workspace { grid-template-columns: minmax(0, 1fr) 360px; gap: 24px; }
  .page-shell { width: min(100% - 32px, 900px); }
  .form-section, .panel-heading { padding-left: 24px; padding-right: 24px; }
}

@media (max-width: 760px) {
  .site-header { height: 64px; padding: 0 18px; }
  .header-note { display: none; }
  .page-shell { width: min(100% - 28px, 620px); padding: 38px 0 56px; }
  .intro { margin-bottom: 28px; }
  .intro h1 { font-size: 36px; }
  .intro p { font-size: 14px; }
  .workspace { display: flex; flex-direction: column; gap: 28px; }
  .editor-panel, .preview-column { width: 100%; }
  .preview-column { position: static; order: -1; }
  .canvas-stage { max-width: 430px; margin: 0 auto; }
  .download-button { max-width: 430px; margin-left: auto; margin-right: auto; }
}

@media (max-width: 520px) {
  .page-shell { width: min(100% - 20px, 460px); }
  .intro h1 { font-size: 31px; letter-spacing: -0.035em; }
  .panel-heading, .form-section { padding-left: 18px; padding-right: 18px; }
  .field-grid { grid-template-columns: 1fr; }
  .field-grid.cols-3 { grid-template-columns: 1fr; }
  .field-wide { grid-column: auto; }
  .upload-zone { align-items: flex-start; flex-wrap: wrap; }
  .upload-copy { flex-basis: calc(100% - 70px); }
  .upload-action { margin-left: 64px; }
  .range-row { grid-template-columns: 1fr; }
}

.header-side { display: flex; align-items: center; gap: 8px; }
.back-link { display: inline-flex; align-items: center; gap: 6px; min-height: 44px; padding: 0 12px; color: var(--text-secondary); font-size: 13px; font-weight: 600; text-decoration: none; border-radius: 10px; transition: color 180ms ease, background 180ms ease; }
.back-link:hover { color: var(--primary); background: var(--primary-soft); }

.intro-compact { margin-bottom: 26px; }
.intro-compact h1 { margin: 8px 0 6px; font-size: 30px; }
.intro-compact p { margin: 0; font-size: 14px; }

.tabs { display: flex; gap: 8px; margin-bottom: 26px; padding: 8px; background: rgba(255, 255, 255, 0.9); border: 1px solid rgba(232, 231, 240, 0.95); border-radius: 18px; box-shadow: var(--shadow); overflow-x: auto; scrollbar-width: thin; }
.tab { flex: 0 0 auto; min-height: 44px; padding: 0 18px; color: var(--text-secondary); background: transparent; border: 0; border-radius: 12px; font-size: 14px; font-weight: 600; white-space: nowrap; transition: color 180ms ease, background 180ms ease; }
.tab:hover { color: var(--primary); background: var(--primary-soft); }
.tab.is-active { color: #fff; background: linear-gradient(135deg, #7b76ed, #5d58db); box-shadow: 0 6px 16px rgba(90, 84, 216, 0.25); }

.showcase { display: grid; grid-template-columns: 430px minmax(0, 1fr); gap: 34px; align-items: start; transition: opacity 200ms ease; }
body.js-loading .showcase { opacity: 0; }
.showcase-info { padding-top: 6px; }
.showcase-info h2 { margin: 10px 0 8px; font-size: 34px; letter-spacing: -0.03em; }
.showcase-info > p { color: var(--text-secondary); }
.showcase-points { margin: 18px 0 26px; padding: 0; list-style: none; color: var(--text-secondary); font-size: 14px; line-height: 1.9; }
.showcase-points li { padding-left: 22px; position: relative; }
.showcase-points li::before { content: ''; position: absolute; left: 2px; top: 12px; width: 8px; height: 8px; border-radius: 50%; background: var(--primary); }
.showcase-cta { width: auto; max-width: 320px; text-decoration: none; }

.group-heading { margin: 64px 0 22px; }
.group-heading h2 { margin: 10px 0 8px; font-size: 30px; letter-spacing: -0.02em; }
.group-heading p { margin: 0; color: var(--text-secondary); }
.home-group .group-heading { margin-top: 0; }

.home-layout { display: grid; grid-template-columns: 188px minmax(0, 1fr); gap: 22px; align-items: start; }
.side-nav { position: sticky; top: 24px; display: flex; flex-direction: column; gap: 6px; padding: 10px; background: rgba(255, 255, 255, 0.9); border: 1px solid rgba(232, 231, 240, 0.95); border-radius: 18px; box-shadow: var(--shadow); }
.side-nav a { display: flex; align-items: center; gap: 8px; min-height: 46px; padding: 0 11px; color: var(--text-secondary); border-radius: 12px; text-decoration: none; font-size: 13px; font-weight: 600; transition: color 180ms ease, background 180ms ease; }
.side-nav a:hover { color: var(--primary); background: var(--primary-soft); }
.side-nav a.is-active { color: #fff; background: linear-gradient(135deg, #7b76ed, #5d58db); box-shadow: 0 6px 16px rgba(90, 84, 216, 0.25); }
.side-nav a svg { width: 18px; height: 18px; flex: 0 0 auto; stroke: currentColor; stroke-width: 1.8; fill: none; stroke-linecap: round; stroke-linejoin: round; }
.side-nav .nav-count { margin-left: auto; font-size: 11px; font-weight: 700; opacity: 0.65; font-variant-numeric: tabular-nums; }
.home-group { scroll-margin-top: 24px; }
.home-group.is-hidden { display: none; }

.field-grid.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.batch-count-field { margin-top: 16px; }

.batch-rows { max-height: 480px; overflow-y: auto; padding-right: 4px; }
.batch-row { display: grid; grid-template-columns: 1fr 0.7fr 1.3fr; gap: 10px; margin-bottom: 10px; }
.batch-row input { height: 44px; }
.batch-row-head { margin-bottom: 6px; }
.batch-row-head span { color: var(--text-secondary); font-size: 12px; font-weight: 600; padding-left: 2px; }

@media (max-width: 980px) {
  .home-layout { grid-template-columns: 1fr; }
  .side-nav { position: static; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
  .side-nav a { white-space: nowrap; }
  .side-nav .nav-count { margin-left: auto; }
  .tabs { flex-wrap: wrap; gap: 6px; overflow-x: visible; scrollbar-width: none; }
  .tab { min-height: 42px; padding: 0 13px; font-size: 13px; border-radius: 11px; }
}

@media (max-width: 420px) {
  .side-nav a { padding: 0 9px; font-size: 12px; }
  .side-nav a svg { width: 16px; height: 16px; }
  .tab { padding: 0 10px; font-size: 12.5px; }
}

@media (max-width: 980px) {
  .showcase { grid-template-columns: 360px minmax(0, 1fr); gap: 24px; }
}

@media (max-width: 760px) {
  .showcase { display: flex; flex-direction: column; gap: 24px; align-items: stretch; }
  .showcase-preview .canvas-stage { max-width: 430px; margin: 0 auto; }
  .showcase-cta { width: fit-content; min-width: min(320px, 100%); max-width: 100%; margin-left: auto; margin-right: auto; }
  .tabs { margin-bottom: 20px; }
}

.site-footer { padding: 2px 16px 44px; text-align: center; color: var(--text-secondary); font-size: 12.5px; letter-spacing: 0.05em; }

.mobile-bar { display: none; }
.preview-modal { position: fixed; inset: 0; z-index: 70; background: rgba(18, 18, 28, 0.95); display: flex; flex-direction: column; padding: 14px 14px calc(14px + env(safe-area-inset-bottom)); }
.preview-modal[hidden] { display: none; }
.preview-modal-head { display: flex; align-items: center; justify-content: space-between; color: #ffffff; font-weight: 700; margin-bottom: 12px; }
.preview-modal-close { min-height: 44px; padding: 0 16px; color: #ffffff; background: rgba(255, 255, 255, 0.14); border: 0; border-radius: 10px; font-size: 14px; font-weight: 600; }
.preview-modal-body { flex: 1; overflow-y: auto; display: flex; justify-content: center; align-items: flex-start; }
.preview-modal-body .canvas-stage { width: 100%; max-width: 420px; }
body.modal-open { overflow: hidden; }

.save-overlay { position: fixed; inset: 0; z-index: 80; background: rgba(15, 15, 25, 0.96); display: flex; flex-direction: column; align-items: center; padding: 22px 18px calc(22px + env(safe-area-inset-bottom)); overflow-y: auto; }
.save-overlay-title { color: #ffffff; font-size: 17px; font-weight: 700; }
.save-overlay-img { display: block; width: 100%; max-width: 420px; margin: 16px 0 10px; border-radius: 12px; box-shadow: 0 12px 44px rgba(0, 0, 0, 0.45); }
.save-overlay-hint { color: rgba(255, 255, 255, 0.62); font-size: 13px; line-height: 1.7; text-align: center; max-width: 420px; }
.save-overlay-actions { display: flex; gap: 10px; width: 100%; max-width: 420px; margin-top: 16px; }
.save-overlay-secondary { flex: 1; min-height: 48px; display: flex; align-items: center; justify-content: center; border-radius: 12px; background: rgba(255, 255, 255, 0.14); color: #ffffff; font-size: 14px; font-weight: 600; text-decoration: none; }
.save-overlay-close { flex: 1; min-height: 48px; border: 0; border-radius: 12px; background: linear-gradient(135deg, #7b76ed, #5d58db); color: #ffffff; font-size: 15px; font-weight: 700; }

@media (max-width: 760px) {
  .mobile-bar { display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 60; gap: 10px; padding: 10px 14px calc(10px + env(safe-area-inset-bottom)); background: rgba(255, 255, 255, 0.96); border-top: 1px solid var(--border); backdrop-filter: blur(10px); }
  .mobile-bar-button { flex: 1; min-height: 48px; display: flex; align-items: center; justify-content: center; gap: 8px; border: 1px solid #dcdaef; border-radius: 12px; background: #ffffff; color: var(--primary-dark); font-size: 15px; font-weight: 700; }
  .mobile-bar-button svg { width: 19px; height: 19px; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
  .mobile-bar-primary { border: 0; color: #ffffff; background: linear-gradient(135deg, #7b76ed, #5d58db); box-shadow: 0 8px 18px rgba(90, 84, 216, 0.3); }
  body.has-mobile-bar { padding-bottom: 84px; }
  body.has-mobile-bar .toast { bottom: 96px; }
}

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