:root, [data-theme="light"] {
  color-scheme: light;
  --bg: #f6f7fa;
  --bg-soft: #eef2f5;
  --panel: rgba(255,255,255,.94);
  --panel-solid: #ffffff;
  --panel-2: #f7f9fb;
  --text: #34495e;
  --sub: #64748b;
  --muted: #94a3b8;
  --border: #e5e9ef;
  --border-strong: rgba(12,138,87,.38);
  --primary: #0c8a57;
  --primary-2: #2196f3;
  --cyan: #0c8a57;
  --success: #49d399;
  --warning: #ffbd59;
  --danger: #ff6d83;
  --shadow: 0 5px 18px rgba(52,73,94,.07);
  --radius: 14px;
  --font: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
}

[data-theme="dark"] {
  color-scheme: dark;
  --bg: #181a1b;
  --bg-soft: #202223;
  --panel: rgba(36,38,39,.94);
  --panel-solid: #242627;
  --panel-2: #2b2e30;
  --text: #eeeeee;
  --sub: #bbbbbb;
  --muted: #888888;
  --border: #3f4244;
  --border-strong: rgba(37,201,138,.42);
  --primary: #25c98a;
  --primary-2: #59aaf7;
  --cyan: #53daa5;
  --shadow: 0 18px 45px rgba(0,0,0,.22);
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  color: var(--text);
  background:
    radial-gradient(circle at 12% 0%, rgba(12,138,87,.08), transparent 30rem),
    radial-gradient(circle at 88% 18%, rgba(33,150,243,.06), transparent 25rem),
    linear-gradient(180deg, var(--bg), var(--bg-soft));
  font-family: var(--font);
  line-height: 1.5;
}
button, input, textarea, select { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button { color: inherit; }
img { display: block; max-width: 100%; }
[hidden] { display: none !important; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  min-height: 66px;
  padding: 10px max(20px, calc((100vw - 1540px) / 2));
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(20px);
}
.brand { display: inline-flex; align-items: center; gap: 11px; flex: 0 0 auto; color: inherit; text-decoration: none; }
.brand-mark {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 11px;
  color: #fff;
  font-weight: 800;
  background: linear-gradient(135deg, var(--primary), var(--primary-2));
  box-shadow: 0 8px 22px rgba(12,138,87,.22);
}
.brand strong, .brand small { display: block; }
.brand strong { font-size: 15px; letter-spacing: .02em; white-space: nowrap; }
.brand small { margin-top: 1px; color: var(--muted); font-size: 11px; }
.top-actions { display: flex; align-items: center; gap: 10px; flex: 0 0 auto; }
.mode-indicator {
  display: block; width: 10px; height: 10px; margin: 0 4px;
  border: 2px solid color-mix(in srgb, var(--panel-solid) 76%, transparent);
  border-radius: 50%; background: var(--muted); box-shadow: 0 0 0 3px var(--border), 0 0 10px rgba(100,116,139,.25);
}
.mode-indicator.is-ai { background: var(--success); box-shadow: 0 0 0 3px rgba(73,211,153,.15), 0 0 12px rgba(73,211,153,.5); }
.mode-indicator.is-demo { background: var(--danger); box-shadow: 0 0 0 3px rgba(255,109,131,.14), 0 0 12px rgba(255,109,131,.45); }
.mode-indicator.is-loading { animation: pulse 1.1s ease-in-out infinite; }
.icon-button {
  width: 38px; height: 38px; border: 1px solid var(--border); border-radius: 11px;
  background: var(--panel); cursor: pointer;
}
.icon-button:hover { border-color: var(--border-strong); }
.history-button {
  min-height: 38px; padding: 0 14px; border: 1px solid var(--border-strong);
  border-radius: 11px; color: var(--primary); background: var(--panel); cursor: pointer;
  font-size: 12px; font-weight: 720;
}
.history-button:hover { background: rgba(12,138,87,.07); }
.auth-button {
  min-height: 38px; padding: 0 14px; border: 1px solid var(--border-strong);
  border-radius: 11px; color: #fff; background: linear-gradient(135deg, var(--primary), var(--primary-2));
  box-shadow: 0 7px 18px rgba(12,138,87,.16); cursor: pointer; font-size: 12px; font-weight: 750;
}
.auth-button.is-authenticated { color: var(--primary); background: var(--panel); box-shadow: none; }

.page-shell { width: min(1540px, calc(100% - 40px)); margin: 0 auto; padding: 38px 0 80px; }
.hero { display: flex; align-items: end; justify-content: space-between; gap: 34px; margin-bottom: 22px; }
.hero > div:first-child { flex: 1; max-width: none; }
.eyebrow, .section-kicker { margin: 0 0 7px; color: var(--cyan); font-weight: 750; font-size: 10px; letter-spacing: .18em; }
.hero h1 { margin: 0; font-size: clamp(30px, 3.05vw, 47px); line-height: 1.12; letter-spacing: -.04em; white-space: nowrap; }
.hero p:not(.eyebrow) { margin: 15px 0 0; max-width: 690px; color: var(--sub); font-size: 16px; }
.hero-pipeline { display: flex; align-items: center; flex-wrap: wrap; gap: 7px; color: var(--muted); font-size: 12px; }
.hero-pipeline span { padding: 7px 9px; border: 1px solid var(--border); border-radius: 8px; background: var(--panel); }
.hero-pipeline i { font-style: normal; color: var(--primary); }

.notice { margin: 0 0 14px; padding: 11px 14px; border: 1px solid rgba(255, 189, 89, .25); border-radius: 12px; color: var(--sub); background: rgba(255, 189, 89, .06); font-size: 13px; }
.notice.is-ai { border-color: rgba(73, 211, 153, .26); background: rgba(73, 211, 153, .07); }
.unlock-gate {
  display: flex; align-items: center; gap: 14px; margin-bottom: 14px; padding: 16px 18px;
  border: 1px solid var(--border-strong); border-radius: 14px; background: var(--panel); box-shadow: var(--shadow);
}
.unlock-gate[hidden] { display: none; }
.unlock-mark { display: grid; place-items: center; flex: 0 0 auto; width: 40px; height: 40px; border-radius: 12px; color: #fff; background: linear-gradient(135deg, var(--primary), var(--primary-2)); font-size: 23px; font-weight: 800; }
.unlock-gate > div { flex: 1; min-width: 0; }
.unlock-gate h2 { font-size: 16px; }
.unlock-gate p { margin: 3px 0 0; color: var(--sub); font-size: 12px; }
.unlock-gate .primary-button { flex: 0 0 auto; min-height: 38px; padding: 8px 16px; }
.protected-studio { transition: opacity .18s, filter .18s; }
.protected-studio.is-locked { opacity: .36; filter: grayscale(.28) blur(1px); user-select: none; }
.steps { display: flex; align-items: center; gap: 8px; margin-bottom: 14px; }
.step {
  flex: 1; min-width: 0; display: flex; align-items: center; justify-content: center; gap: 8px;
  padding: 9px 12px; border: 1px solid var(--border); border-radius: 11px;
  color: var(--muted); background: var(--panel); cursor: pointer;
}
.step b { display: grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; background: var(--panel-2); font-size: 11px; }
.step.is-active { color: var(--text); border-color: var(--border-strong); background: linear-gradient(135deg, rgba(91, 137, 255, .15), rgba(124, 92, 255, .08)); }
.step.is-active b, .step.is-complete b { color: #fff; background: linear-gradient(135deg, var(--primary), var(--primary-2)); }

.workspace { display: grid; grid-template-columns: 320px minmax(0, 1fr) 210px; align-items: start; gap: 14px; }
.panel { border: 1px solid var(--border); border-radius: var(--radius); background: var(--panel); box-shadow: var(--shadow); backdrop-filter: blur(18px); }
.form-panel { padding: 20px; }
.panel-heading, .stage-heading { display: flex; align-items: start; justify-content: space-between; gap: 14px; }
h2 { margin: 0; font-size: 18px; letter-spacing: -.02em; }
.text-button { padding: 5px 0; border: 0; color: var(--primary); background: none; cursor: pointer; font-size: 12px; }
form { margin-top: 19px; }
fieldset { margin: 0 0 16px; padding: 0; border: 0; }
legend, .field > span:first-child, .field > label:first-child { display: block; margin-bottom: 7px; color: var(--sub); font-size: 12px; font-weight: 650; }
.field { display: block; margin-bottom: 14px; }
.field em { color: var(--danger); font-style: normal; }
.field small { display: block; margin-top: 5px; color: var(--muted); text-align: right; font-size: 10px; }
input, textarea, select {
  width: 100%; border: 1px solid var(--border); border-radius: 10px; outline: 0;
  color: var(--text); background: var(--panel-2); transition: border-color .16s, box-shadow .16s;
}
input, select { height: 42px; padding: 0 11px; }
textarea { min-height: 116px; padding: 10px 11px; resize: vertical; }
input:focus, textarea:focus, select:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(91, 137, 255, .13); }
input::placeholder, textarea::placeholder { color: color-mix(in srgb, var(--muted) 75%, transparent); }
.password-input-wrap { position: relative; display: block; }
.password-input-wrap input { padding-right: 50px; }
.password-visibility-button {
  position: absolute; top: 50%; right: 4px; display: grid; place-items: center;
  width: 36px; height: 34px; padding: 0; border: 0; border-radius: 8px;
  color: var(--sub); background: transparent; cursor: pointer; transform: translateY(-50%);
}
.password-visibility-button:hover { color: var(--primary); background: rgba(12,138,87,.08); }
.password-visibility-button:focus-visible { outline: 2px solid var(--primary); outline-offset: 1px; }
.password-visibility-button svg { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-linecap: round; stroke-linejoin: round; stroke-width: 1.8; }
.password-visibility-button .eye-closed { display: none; }
.password-visibility-button[aria-pressed="true"] .eye-open { display: none; }
.password-visibility-button[aria-pressed="true"] .eye-closed { display: block; }
.form-grid { display: grid; gap: 10px; }.form-grid.two { grid-template-columns: 1fr 1fr; }
.segmented { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.segmented input { position: absolute; width: 1px; height: 1px; padding: 0; opacity: 0; pointer-events: none; clip: rect(0 0 0 0); }
.segmented span { display: grid; place-items: center; height: 39px; border: 1px solid var(--border); border-radius: 9px; color: var(--muted); background: var(--panel-2); cursor: pointer; font-size: 12px; }
.segmented input:checked + span { color: #fff; border-color: var(--primary); background: linear-gradient(135deg, rgba(91, 137, 255, .55), rgba(124, 92, 255, .48)); }
.color-control { display: grid; grid-template-columns: 42px 1fr; gap: 7px; }
.color-control input[type="color"] { padding: 4px; cursor: pointer; }
.palette-fieldset legend small { color: var(--muted); font-size: 10px; font-weight: 500; }
.palette-inputs { display: grid; gap: 9px; }
.palette-input-row { display: grid; grid-template-columns: 1fr 1fr; gap: 5px 9px; padding: 9px; border: 1px solid var(--border); border-radius: 8px; background: var(--panel-2); }
.palette-input-row > b { grid-column: 1 / -1; font-size: 11px; }
.palette-input-row .field { min-width: 0; margin: 0; }
.palette-input-row .field > span:first-child { margin-bottom: 4px; font-size: 10px; }
.palette-input-row .color-control { grid-template-columns: 35px minmax(0,1fr); gap: 4px; }
.palette-input-row .color-control input { min-width: 0; height: 36px; padding: 0 5px; font-size: 11px; }
.form-error { min-height: 0; margin-bottom: 9px; color: var(--danger); font-size: 12px; }
.manufacturer-profile { margin: -5px 0 14px; padding: 11px; border: 1px solid var(--border); border-radius: 10px; background: rgba(91,137,255,.055); }
.manufacturer-profile b { display: block; font-size: 11px; }.manufacturer-profile p { margin: 4px 0 7px; color: var(--sub); font-size: 10px; }
.manufacturer-profile span { display: block; color: var(--muted); font-size: 9px; }.manufacturer-profile a { color: var(--primary); text-decoration: none; }
.trait-fieldset, .reference-upload-fieldset { margin-bottom: 14px; }
.trait-fieldset legend small, .reference-upload-fieldset legend small { color: var(--muted); font-size: 10px; font-weight: 500; }
.trait-picker { display: flex; flex-wrap: wrap; gap: 7px; }
.trait-picker label { position: relative; }
.trait-picker input { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.trait-picker span {
  display: block; padding: 7px 11px; border: 1px solid var(--border); border-radius: 999px;
  color: var(--sub); background: var(--panel-2); cursor: pointer; font-size: 11px;
}
.trait-picker input:checked + span { color: #fff; border-color: transparent; background: linear-gradient(135deg, var(--primary), var(--primary-2)); }
.trait-picker input:focus-visible + span { outline: 2px solid var(--primary); outline-offset: 2px; }
.trait-picker input:disabled + span { opacity: .42; cursor: not-allowed; }
.trait-custom { margin-top: 9px; }
.reference-upload { padding: 12px; border: 1px dashed var(--border-strong); border-radius: 11px; background: rgba(12,138,87,.035); }
.reference-upload p { margin: 8px 2px 0; color: var(--muted); font-size: 10px; }
.reference-preview { display: grid; grid-template-columns: 64px minmax(0, 1fr) auto; align-items: center; gap: 11px; padding: 10px; border: 1px solid var(--border); border-radius: 11px; background: var(--panel-2); }
.reference-preview img { width: 64px; height: 64px; border-radius: 10px; object-fit: contain; background: #fff; }
.reference-preview b, .reference-preview span { display: block; overflow-wrap: anywhere; }
.reference-preview b { font-size: 11px; }.reference-preview span { margin-top: 3px; color: var(--muted); font-size: 9px; }
.reference-remove { flex: 0 0 auto; color: var(--danger); }

.primary-button, .secondary-button, .ghost-button {
  min-height: 42px; padding: 10px 17px; border-radius: 11px; cursor: pointer; font-weight: 720; font-size: 13px;
}
.primary-button { border: 0; color: #fff; background: linear-gradient(135deg, var(--primary), var(--primary-2)); box-shadow: 0 8px 22px rgba(76, 104, 241, .24); }
.secondary-button { border: 1px solid var(--border-strong); color: var(--text); background: rgba(91, 137, 255, .08); }
.ghost-button { border: 1px solid var(--border); color: var(--sub); background: transparent; }
.wide { width: 100%; }.primary-button small { display: block; margin-top: 1px; opacity: .72; font-size: 9px; font-weight: 500; }
button:disabled { opacity: .42; cursor: not-allowed; box-shadow: none; }
.ghost-button.wide { margin-top: 8px; }

.main-stage { position: relative; min-width: 0; }
.stage-card { min-height: 650px; padding: clamp(20px, 2vw, 30px); }
.empty-state { display: flex; align-items: center; flex-direction: column; justify-content: center; text-align: center; }
.empty-state > p:not(.section-kicker) { max-width: 600px; color: var(--sub); }
.empty-visual { position: relative; width: 160px; height: 160px; margin-bottom: 25px; }
.empty-visual span { position: absolute; inset: 18px; border: 1px solid rgba(91, 137, 255, .25); border-radius: 38px; transform: rotate(45deg); }
.empty-visual span:nth-child(2) { inset: 36px; border-color: rgba(57, 214, 197, .34); }
.empty-visual span:nth-child(3) { inset: 56px; border-color: rgba(124, 92, 255, .5); }
.empty-visual b { position: absolute; inset: 0; display: grid; place-items: center; color: var(--cyan); font-size: 34px; filter: drop-shadow(0 0 16px rgba(57, 214, 197, .42)); }
.principles { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin: 23px 0 0; padding: 0; list-style: none; }
.principles li { padding: 7px 10px; border: 1px solid var(--border); border-radius: 999px; color: var(--muted); font-size: 11px; }
.source-pill { padding: 6px 9px; border: 1px solid var(--border); border-radius: 999px; color: var(--muted); background: var(--panel-2); font-size: 10px; white-space: nowrap; }
.stage-intro { margin: 10px 0 21px; color: var(--sub); font-size: 13px; }
.brief-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 9px; margin-top: 22px; }
.brief-item { min-width: 0; padding: 13px; border: 1px solid var(--border); border-radius: 11px; background: var(--panel-2); }
.brief-item.wide { grid-column: 1 / -1; }
.brief-item small, .concept-plan small { display: block; margin-bottom: 5px; color: var(--muted); font-size: 10px; letter-spacing: .08em; }
.brief-item b { display: block; font-size: 13px; overflow-wrap: anywhere; }
.brief-item span { color: var(--sub); font-size: 12px; }
.palette { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.palette i { width: 18px; height: 18px; border: 1px solid rgba(255,255,255,.24); border-radius: 6px; }
.palette-choice { display: flex; align-items: center; gap: 5px; min-width: 0; padding: 7px 9px; border: 1px solid var(--border); border-radius: 7px; background: var(--panel); }
.palette-choice b { margin-right: 3px; font-size: 11px; }
.palette-choice span { font-size: 10px; }
.concept-plan { display: grid; grid-template-columns: repeat(2, 1fr); gap: 9px; margin-top: 16px; }
.concept-plan article { padding: 13px; border-left: 2px solid var(--primary); border-radius: 0 9px 9px 0; background: rgba(91,137,255,.06); }
.concept-plan b { display: block; margin-bottom: 4px; font-size: 13px; }.concept-plan p { margin: 0; color: var(--sub); font-size: 11px; }
.stage-actions { display: flex; justify-content: flex-end; gap: 9px; margin-top: 22px; }

.candidate-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.candidate-card { position: relative; min-width: 0; overflow: hidden; padding: 0; border: 1px solid var(--border); border-radius: 8px; color: inherit; text-align: left; background: var(--panel-2); }
.candidate-card:hover { border-color: var(--border-strong); transform: translateY(-2px); }
.candidate-card.is-selected { border-color: var(--primary); box-shadow: 0 0 0 2px rgba(91, 137, 255, .16), 0 18px 35px rgba(0,0,0,.2); }
.candidate-select { display: block; width: 100%; padding: 0; border: 0; color: inherit; text-align: left; background: transparent; cursor: pointer; }
.candidate-art { aspect-ratio: 1; display: flex; align-items: center; justify-content: center; min-height: 0; overflow: hidden; padding: 10px; background: #0a1020; }
[data-theme="light"] .candidate-art { background: radial-gradient(circle, rgba(91,137,255,.09), transparent 65%), #edf2fb; }
.candidate-art img { width: min(88%, 260px); height: auto; max-height: calc(100% - 20px); aspect-ratio: 1; object-fit: contain; filter: drop-shadow(0 14px 18px rgba(0,0,0,.18)); }
.candidate-copy { display: block; min-height: 70px; padding: 10px; }.candidate-copy b { display: block; font-size: 12px; }.candidate-copy span { display: block; margin-top: 4px; color: var(--muted); font-size: 10px; }
.candidate-actions { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 2px; padding: 4px; border-top: 1px solid var(--border); }
.candidate-actions button { min-width: 0; padding: 6px 1px; border: 0; border-radius: 4px; color: var(--sub); background: transparent; cursor: pointer; font-size: 10px; }
.candidate-actions button:hover, .candidate-actions button:focus-visible { color: var(--primary); background: var(--panel); }
.candidate-group-title { grid-column: 1 / -1; display: flex; align-items: center; gap: 9px; margin: 11px 0 0; font-size: 14px; }
.candidate-group-title:first-child { margin-top: 0; }
.candidate-group-title small { color: var(--muted); font-size: 11px; font-weight: normal; }
.material-actions { display:flex; align-items:center; gap:10px; margin:-4px 0 12px; min-height:28px; }
.material-actions span { color:var(--muted); font-size:11px; }
.selection-mark { position: absolute; top: 8px; right: 8px; display: grid; place-items: center; width: 24px; height: 24px; border: 1px solid rgba(255,255,255,.25); border-radius: 50%; color: transparent; background: rgba(3,7,17,.5); }
.candidate-card.is-selected .selection-mark { color: #fff; border-color: transparent; background: var(--primary); }
.variants { grid-template-columns: repeat(3, minmax(0, 1fr)); }.variants .candidate-art img { width: min(84%, 260px); }
.refine-controls { margin-top: 22px; padding: 17px; border-top: 1px solid var(--border); background: var(--panel-2); }
.refine-controls h3 { margin: 0 0 12px; font-size: 15px; }
.refine-controls .field { margin: 14px 0 0; }
.refine-controls textarea { min-height: 80px; }

.side-column { display: grid; gap: 14px; }
.mini-panel { padding: 18px; box-shadow: none; }
.live-icon { display: grid; place-items: center; aspect-ratio: 1; margin-top: 15px; padding: 23px; border: 1px solid var(--border); border-radius: 15px; background: radial-gradient(circle, rgba(91,137,255,.12), transparent 68%), var(--panel-2); }
.live-icon img { width: 100%; filter: drop-shadow(0 16px 20px rgba(0,0,0,.22)); }.live-icon span { color: var(--muted); font-size: 11px; }
.mini-sizes { display: flex; align-items: end; justify-content: center; gap: 20px; min-height: 62px; margin-top: 13px; }
.mini-sizes span { display: grid; justify-items: center; gap: 5px; }.mini-sizes img { min-width: 1px; min-height: 1px; }.mini-sizes small { color: var(--muted); font-size: 9px; }
.checklist ul { display: grid; gap: 9px; margin: 15px 0 0; padding: 0; list-style: none; }.checklist li { position: relative; padding-left: 19px; color: var(--sub); font-size: 11px; }.checklist li::before { content: "✓"; position: absolute; left: 0; color: var(--success); }
.references summary { display: flex; align-items: center; justify-content: space-between; list-style: none; cursor: pointer; }.references summary::-webkit-details-marker { display: none; }.references summary small, .references summary b { display: block; }.references summary small { color: var(--cyan); font-size: 9px; letter-spacing: .14em; }.references summary b { margin-top: 3px; font-size: 13px; }.references summary i { color: var(--muted); font-style: normal; }.references[open] summary i { transform: rotate(45deg); }
#referenceList { display: grid; gap: 8px; margin-top: 14px; }.reference-item { padding-top: 8px; border-top: 1px solid var(--border); }.reference-item a { color: var(--primary); text-decoration: none; font-size: 10px; font-weight: 700; }.reference-item span { display: block; margin-top: 3px; color: var(--muted); font-size: 9px; }.legal-note { margin: 12px 0 0; color: var(--muted); font-size: 9px; }

.progress-card { position: absolute; inset: 0; z-index: 5; display: flex; align-items: center; justify-content: center; gap: 13px; border: 1px solid var(--border); border-radius: var(--radius); background: color-mix(in srgb, var(--panel-solid) 88%, transparent); backdrop-filter: blur(14px); }
.progress-card b, .progress-card span { display: block; }.progress-card b { font-size: 14px; }.progress-card span { margin-top: 3px; color: var(--muted); font-size: 11px; }
.spinner { width: 31px; height: 31px; border: 3px solid rgba(91,137,255,.18); border-top-color: var(--primary); border-radius: 50%; animation: spin .8s linear infinite; }
.toast { position: fixed; left: 50%; bottom: 26px; z-index: 50; max-width: min(560px, calc(100vw - 30px)); padding: 11px 15px; border: 1px solid var(--border); border-radius: 11px; color: #fff; background: #141d30; box-shadow: 0 18px 40px rgba(0,0,0,.34); opacity: 0; pointer-events: none; transform: translate(-50%, 12px); transition: .2s; font-size: 12px; }.toast.is-visible { opacity: 1; transform: translate(-50%, 0); }.toast.is-error { border-color: rgba(255,109,131,.45); }
footer { width: min(1540px, calc(100% - 40px)); margin: 0 auto; padding: 24px 0 34px; display: flex; justify-content: center; gap: 18px; border-top: 1px solid var(--border); color: var(--muted); font-size: 11px; } footer a { color: var(--sub); text-decoration: none; }
footer small { margin-left: 4px; font-size: inherit; }

.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
.overlay {
  position: fixed; inset: 0; z-index: 80; display: grid; place-items: center;
  padding: 20px; background: rgba(16,24,40,.52); backdrop-filter: blur(8px);
}
.dialog {
  position: relative; width: min(460px, 100%); max-height: calc(100vh - 40px); overflow: auto;
  padding: 25px; border: 1px solid var(--border); border-radius: 18px;
  background: var(--panel-solid); box-shadow: 0 28px 80px rgba(0,0,0,.28);
}
.dialog > p, .history-heading p { margin: 8px 0 0; color: var(--sub); font-size: 12px; }
.dialog-close {
  width: 36px; height: 36px; border: 1px solid var(--border); border-radius: 10px;
  color: var(--sub); background: var(--panel-2); cursor: pointer; font-size: 22px; line-height: 1;
}
.zoom-dialog { width: min(860px, 100%); padding: 14px; }
.zoom-heading { display: flex; align-items: center; justify-content: space-between; gap: 15px; margin-bottom: 10px; }
.zoom-dialog img { width: min(100%, 720px); max-height: calc(100vh - 130px); margin: 0 auto; object-fit: contain; }
.login-dialog .dialog-close { position: absolute; top: 16px; right: 16px; }
.login-dialog form { margin-top: 22px; }
.account-dialog .dialog-close, .password-dialog .dialog-close { position: absolute; top: 16px; right: 16px; }
.account-actions { margin-top: 16px; }
.password-dialog form { margin-top: 20px; }
.history-overlay { align-items: stretch; justify-items: end; padding: 0; }
.history-dialog {
  width: min(1040px, 94vw); max-height: none; height: 100vh; padding: 26px;
  border-width: 0 0 0 1px; border-radius: 0;
}
.history-heading { display: flex; align-items: start; justify-content: space-between; gap: 20px; }
.history-toolbar {
  display: grid; grid-template-columns: minmax(180px, 1fr) repeat(3, minmax(125px, .45fr)) auto auto;
  gap: 9px; margin-top: 22px;
}
.history-toolbar .secondary-button { min-height: 42px; padding: 8px 12px; white-space: nowrap; }
.history-summary { min-height: 24px; padding: 13px 1px 7px; color: var(--muted); font-size: 11px; }
.history-list { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; padding-bottom: 30px; }
.history-empty { grid-column: 1 / -1; padding: 70px 20px; border: 1px dashed var(--border); border-radius: 16px; color: var(--muted); text-align: center; }
.history-card { overflow: hidden; border: 1px solid var(--border); border-radius: 14px; background: var(--panel); }
.history-thumb { display: grid; place-items: center; aspect-ratio: 1.5; padding: 17px; background: var(--panel-2); }
.history-thumb img { width: min(72%, 150px); aspect-ratio: 1; object-fit: contain; filter: drop-shadow(0 12px 16px rgba(0,0,0,.17)); }
.history-thumb span { color: var(--muted); font-size: 12px; }
.history-copy { padding: 13px; }
.history-copy h3 { margin: 0; font-size: 14px; overflow-wrap: anywhere; }
.history-meta { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 8px; }
.history-meta span { padding: 3px 7px; border-radius: 999px; color: var(--sub); background: var(--panel-2); font-size: 9px; }
.history-time { display: block; margin-top: 9px; color: var(--muted); font-size: 9px; }
.history-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; margin-top: 12px; }
.history-actions button { min-height: 34px; padding: 7px 8px; border: 1px solid var(--border); border-radius: 9px; color: var(--sub); background: var(--panel-2); cursor: pointer; font-size: 10px; }
.history-actions button[data-action="open"] { grid-column: 1 / -1; color: #fff; border-color: transparent; background: linear-gradient(135deg, var(--primary), var(--primary-2)); font-weight: 700; }
.history-actions button[data-action="archive"] { color: var(--danger); }

@keyframes spin { to { transform: rotate(360deg); } }
@keyframes pulse { 50% { opacity: .35; transform: scale(.78); } }

@media (max-width: 1260px) {
  .hero { align-items: start; flex-direction: column; gap: 18px; }
  .workspace { grid-template-columns: 340px minmax(0, 1fr); }
  .side-column { grid-column: 1 / -1; grid-template-columns: 1fr; }
  .live-icon { max-width: 180px; margin-left: auto; margin-right: auto; }
  .candidate-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (max-width: 900px) {
  .page-shell { width: min(100% - 26px, 760px); padding-top: 26px; }
  .hero h1 { white-space: normal; }
  .workspace { grid-template-columns: 1fr; }
  .candidate-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .form-panel { order: 1; }.main-stage { order: 2; }.side-column { order: 3; grid-template-columns: 1fr 1fr; }.references { grid-column: 1 / -1; }
  .stage-card { min-height: 560px; }
  .history-dialog { width: 100vw; }
  .history-toolbar { grid-template-columns: 1fr 1fr; }
  .history-search { grid-column: 1 / -1; }
  .history-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 640px) {
  .topbar { padding: 9px 10px; gap: 7px; }.brand { gap: 6px; }.brand-mark { width: 34px; height: 34px; }.brand strong { font-size: 12px; }.brand small { display: none; }.top-actions { gap: 5px; }.history-button, .auth-button { padding: 0 7px; white-space: nowrap; font-size: 11px; }.icon-button { width: 34px; height: 34px; }
  .page-shell { width: calc(100% - 18px); padding-top: 20px; }.hero h1 { font-size: 31px; }.hero p:not(.eyebrow) { font-size: 14px; }.hero-pipeline { display: none; }
  .unlock-gate { align-items: stretch; flex-direction: column; padding: 15px; }.unlock-mark { display: none; }.unlock-gate .primary-button { width: 100%; }
  .steps { gap: 4px; }.step { padding: 8px 4px; gap: 4px; }.step span { font-size: 10px; }.step b { width: 19px; height: 19px; }
  .form-panel, .stage-card, .mini-panel { padding: 16px; }.form-grid.two, .brief-grid, .concept-plan, .candidate-grid, .variants, .side-column { grid-template-columns: 1fr; }
  .candidate-art { aspect-ratio: 1.45; }.variants .candidate-art { aspect-ratio: 1.45; }
  .stage-actions { flex-direction: column-reverse; }.stage-actions button { width: 100%; }
  .references { grid-column: auto; } footer { width: calc(100% - 24px); flex-wrap: wrap; }
  .overlay { padding: 10px; }.dialog { padding: 20px; }
  .reference-preview { grid-template-columns: 54px minmax(0, 1fr); }.reference-preview img { width: 54px; height: 54px; }.reference-remove { grid-column: 1 / -1; justify-self: start; }
  .history-overlay { padding: 0; }.history-dialog { padding: 18px 13px; }
  .history-toolbar, .history-list { grid-template-columns: 1fr; }
  .history-search { grid-column: auto; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
  .candidate-card:hover { transform: none; }
}
