:root {
  color-scheme: light;
  --bg: #f4f6fc;
  --bg-soft: #eef2fb;
  --surface: rgba(255, 255, 255, .78);
  --surface-solid: #ffffff;
  --surface-raised: #f3f5ff;
  --surface-input: #ffffff;
  --ink: #17213b;
  --text: #2d3855;
  --muted: #586885;
  --faint: #5e6c86;
  --line: rgba(90, 103, 165, .18);
  --line-strong: rgba(102, 88, 232, .38);
  --accent: #6658e8;
  --accent-strong: #4f40c5;
  --cyan: #159fc0;
  --violet: #8b63d7;
  --ok: #0e8061;
  --warn: #8a5a00;
  --err: #bc3f58;
  --focus: #5a4bdd;
  --font-display: "SF Pro Display", "PingFang SC", "Microsoft YaHei", "Segoe UI", sans-serif;
  --font-body: "SF Pro Text", "PingFang SC", "Microsoft YaHei", "Segoe UI", sans-serif;
  --radius: 18px;
  --radius-sm: 12px;
  --ease: cubic-bezier(.2, 0, 0, 1);
  --fast: 120ms;
  --normal: 240ms;
  --slow: 440ms;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  min-width: 320px;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(circle at 72% 4%, rgba(137, 150, 255, .24), transparent 42%), radial-gradient(circle at 10% 90%, rgba(95, 220, 233, .18), transparent 40%), radial-gradient(circle at 8% 12%, rgba(255, 184, 215, .12), transparent 32%);
}
[hidden] { display: none !important; }
a { color: var(--accent-strong); text-decoration: none; }
a:hover { text-decoration: none; }
button, input, textarea, select { font: inherit; }
button { color: inherit; }
svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
h1, h2, h3, p { margin-top: 0; }
h1, h2, h3 { color: var(--ink); font-family: var(--font-display); }
h1 { margin-bottom: 12px; font-size: 30px; line-height: 1.2; letter-spacing: -.025em; }
h2 { margin-bottom: 14px; font-size: 20px; line-height: 1.3; letter-spacing: -.015em; }
h3 { font-size: 16px; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.mono { font-variant-numeric: tabular-nums; }
.skip-link { position: fixed; left: 16px; top: 16px; z-index: 100; padding: 10px 14px; border-radius: 8px; background: var(--ink); color: var(--bg); transform: translateY(-180%); transition: transform var(--fast); }
.skip-link:focus { transform: translateY(0); }

.ambient { position: fixed; inset: 0; z-index: 0; overflow: hidden; pointer-events: none; display: none; }
.page-landing .ambient { display: block; }
.starfield { position: absolute; inset: 0; opacity: .3; background-image: radial-gradient(circle at 12% 22%, rgba(104,99,180,.35) 0 1px, transparent 1.4px), radial-gradient(circle at 74% 18%, rgba(85,157,195,.32) 0 1px, transparent 1.3px), radial-gradient(circle at 36% 72%, rgba(142,100,196,.28) 0 1px, transparent 1.4px), radial-gradient(circle at 88% 76%, rgba(85,157,195,.3) 0 1px, transparent 1.3px); background-size: 260px 260px, 340px 340px, 420px 420px, 510px 510px; }
.orb { position: absolute; border-radius: 50%; filter: blur(82px); mix-blend-mode: normal; opacity: .44; will-change: transform; }
.orb-a { width: 58vw; height: 58vw; min-width: 580px; min-height: 580px; left: -18vw; top: -28vw; background: #a8b8ff; animation: drift-a 18s ease-in-out infinite alternate; }
.orb-b { width: 48vw; height: 48vw; min-width: 480px; min-height: 480px; right: -16vw; top: -10vw; background: #d7b5f6; animation: drift-b 22s ease-in-out infinite alternate; }
.orb-c { width: 40vw; height: 40vw; min-width: 420px; min-height: 420px; left: 36vw; bottom: -26vw; background: #a4e6f1; animation: drift-a 24s ease-in-out infinite alternate-reverse; }

.topbar { position: sticky; top: 0; z-index: 30; display: flex; align-items: center; justify-content: space-between; gap: 20px; min-height: 66px; padding: 10px 28px; border-bottom: 1px solid var(--line); background: rgba(255, 255, 255, .72); backdrop-filter: blur(18px); }
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--ink); font-family: var(--font-display); font-weight: 650; letter-spacing: -.01em; }
.brand-mark { display: inline-grid; place-items: center; width: 32px; height: 32px; color: var(--accent-strong); }
.brand-mark svg { width: 32px; height: 32px; stroke-width: 1.4; }
.brand-satellite { fill: var(--cyan); stroke: none; }
.topnav { display: flex; align-items: center; gap: 12px; }
.topnav .link { color: var(--muted); font-size: 13px; transition: color var(--fast); }
.topnav .link:hover { color: var(--ink); }
.motion-toggle { display: inline-flex; align-items: center; gap: 5px; min-height: 32px; padding: 4px 8px; border: 1px solid transparent; border-radius: 8px; background: transparent; color: var(--faint); font-size: 12px; cursor: pointer; transition: color var(--fast), border-color var(--fast), background var(--fast); }
.motion-toggle:hover { color: var(--ink); border-color: var(--line); background: rgba(255,255,255,.55); }
.motion-toggle svg { width: 14px; height: 14px; }
.wrap { position: relative; z-index: 1; max-width: 1180px; margin: 0 auto; padding: 38px 24px 72px; }
.page-landing .wrap { max-width: 1240px; }
.foot { position: relative; z-index: 1; padding: 26px 20px 34px; color: var(--faint); font-size: 12px; text-align: center; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 42px; padding: 9px 16px; border: 1px solid var(--line); border-radius: 11px; background: rgba(255,255,255,.58); color: var(--text); font-weight: 550; font-size: 14px; letter-spacing: .01em; cursor: pointer; transition: transform var(--fast) var(--ease), border-color var(--fast), background var(--fast), box-shadow var(--fast), color var(--fast); }
.btn:hover { transform: translateY(-2px); border-color: var(--line-strong); background: rgba(255,255,255,.85); }
.btn:active { transform: scale(.98); }
.btn.primary { border-color: rgba(102, 88, 232, .45); background: var(--accent); color: #ffffff; box-shadow: 0 8px 28px rgba(102, 88, 232, .2); }
.btn.primary:hover { background: var(--accent-strong); box-shadow: 0 12px 34px rgba(102, 88, 232, .28); }
.btn.primary:disabled { border-color: var(--line); background: #d9deeb; color: #68738a; box-shadow: none; cursor: not-allowed; }
.btn.ghost { background: transparent; }
.btn.wide { width: 100%; }
.btn.danger { color: var(--err); border-color: rgba(255, 158, 166, .24); }
.btn.danger:hover { background: rgba(255, 158, 166, .08); }
.btn.is-confirmed { border-color: rgba(100, 223, 182, .55); color: var(--ok); }
.btn svg { width: 18px; height: 18px; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 3px; }

.card { border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); padding: 24px; margin-bottom: 20px; box-shadow: 0 20px 70px rgba(69, 64, 130, .1); backdrop-filter: blur(16px); }
.section-kicker { margin-bottom: 8px; color: var(--accent); font-size: 12px; font-weight: 650; letter-spacing: .12em; }
.panel-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 18px; }
.panel-heading h2 { margin-bottom: 0; }
.section-count { color: var(--faint); font-size: 12px; }
.stack { display: flex; flex-direction: column; gap: 10px; }
.field { margin-bottom: 16px; }
.field label { display: block; margin-bottom: 7px; color: var(--text); font-size: 13px; font-weight: 550; }
input[type="text"], input[type="password"], textarea, select { width: 100%; min-height: 44px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; outline: none; background: var(--surface-input); color: var(--text); transition: border-color var(--fast), box-shadow var(--fast), background var(--fast); }
input::placeholder, textarea::placeholder { color: var(--faint); }
input:focus, textarea:focus, select:focus { border-color: var(--line-strong); background: #ffffff; box-shadow: 0 0 0 3px rgba(102, 88, 232, .12); }
textarea { resize: vertical; }
.row-form { display: flex; gap: 10px; flex-wrap: wrap; }
.row-form input[type="text"] { flex: 1 1 280px; }
.create-form { margin-top: 20px; }
.form-actions { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-top: 8px; }
.status { color: var(--muted); font-size: 13px; }
.status.ok { color: var(--ok); }
.status.err { color: var(--err); }
.alert { margin: 14px 0; padding: 11px 13px; border: 1px solid var(--line); border-radius: 10px; font-size: 13px; }
.alert.warn { border-color: rgba(255, 209, 138, .3); background: rgba(255, 209, 138, .07); color: var(--warn); }
.alert.err { border-color: rgba(255, 158, 166, .3); background: rgba(255, 158, 166, .07); color: var(--err); }
.warn-text { color: var(--warn); font-size: 13px; }
.empty { padding: 28px; border: 1px dashed var(--line); border-radius: var(--radius-sm); color: var(--muted); text-align: center; }

.hero-stage { display: grid; grid-template-columns: minmax(0, 1.04fr) minmax(0, .96fr); align-items: center; gap: 56px; min-height: calc(100vh - 172px); padding: 48px 0 70px; }
.hero-copy { position: relative; z-index: 2; animation: enter-up var(--slow) var(--ease) both; }
.eyebrow-pill { display: inline-flex; align-items: center; gap: 8px; margin-bottom: 24px; padding: 6px 11px; border: 1px solid var(--line); border-radius: 999px; background: rgba(126, 158, 229, .06); color: var(--accent-strong); font-size: 12px; letter-spacing: .04em; }
.signal-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--cyan); box-shadow: 0 0 12px rgba(112, 227, 255, .7); }
.hero-copy h1 { max-width: 680px; margin-bottom: 22px; font-size: clamp(42px, 5vw, 64px); line-height: 1.12; letter-spacing: -.045em; }
.hero-lead { max-width: 590px; color: var(--muted); font-size: 17px; line-height: 1.8; }
.hero-actions { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 28px; }
.hero-actions .btn { min-height: 46px; padding-inline: 19px; }
.hero-notes { display: flex; gap: 18px; flex-wrap: wrap; margin-top: 28px; color: var(--faint); font-size: 12px; }
.hero-notes span { position: relative; }
.hero-notes span + span::before { content: ""; position: absolute; left: -10px; top: 50%; width: 2px; height: 2px; border-radius: 50%; background: var(--faint); }
.hero-visual { position: relative; z-index: 1; perspective: 1100px; transform: rotateX(var(--tilt-x, 0deg)) rotateY(var(--tilt-y, 0deg)); transition: transform 180ms ease-out; animation: enter-scale 480ms var(--ease) 80ms both; }
.preview-window { overflow: hidden; border: 1px solid rgba(143, 153, 218, .3); border-radius: 22px; background: rgba(255, 255, 255, .84); box-shadow: 0 34px 100px rgba(69, 64, 130, .18), 0 0 70px rgba(145, 125, 230, .12); backdrop-filter: blur(20px); animation: float-preview 7s ease-in-out infinite; }
.preview-topbar { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 12px; height: 46px; padding: 0 15px; border-bottom: 1px solid var(--line); color: var(--faint); font-size: 12px; }
.window-dots { display: flex; gap: 5px; }
.window-dots i { width: 6px; height: 6px; border-radius: 50%; background: #53617c; }
.window-dots i:nth-child(2) { background: #6a79a0; }
.window-dots i:nth-child(3) { background: #8296c8; }
.preview-live { justify-self: end; display: inline-flex; align-items: center; gap: 5px; color: var(--faint); font-size: 12px; letter-spacing: .12em; }
.preview-live i, .preview-footer i { width: 5px; height: 5px; border-radius: 50%; background: var(--ok); }
.preview-body { display: grid; grid-template-columns: 145px 1fr; min-height: 410px; }
.preview-steps { padding: 18px 14px; border-right: 1px solid var(--line); background: rgba(102, 88, 232, .025); }
.preview-steps div { display: flex; align-items: center; gap: 10px; padding: 8px 7px; color: var(--muted); font-size: 12px; }
.preview-steps div:first-child { border-radius: 7px; background: rgba(102, 88, 232, .1); color: var(--accent-strong); }
.preview-steps b { color: var(--faint); font-size: 12px; font-weight: 500; font-variant-numeric: tabular-nums; }
.preview-steps div:first-child b { color: var(--accent); }
.preview-canvas { position: relative; min-width: 0; padding: 20px; background-image: linear-gradient(rgba(90, 103, 165, .06) 1px, transparent 1px), linear-gradient(90deg, rgba(90, 103, 165, .06) 1px, transparent 1px); background-size: 26px 26px; }
.canvas-label { color: var(--faint); font-size: 12px; letter-spacing: .12em; }
.evidence-graph { display: block; width: 100%; height: 210px; margin-top: 20px; overflow: visible; }
.graph-link { stroke: rgba(102, 88, 232, .45); stroke-width: 1.2; stroke-dasharray: 5 6; }
.graph-node { fill: rgba(102, 88, 232, .09); stroke: rgba(102, 88, 232, .58); stroke-width: 1; }
.graph-core { fill: var(--cyan); stroke: none; }
.node-d { fill: rgba(21, 159, 192, .1); stroke: var(--cyan); }
.graph-label { position: absolute; color: var(--muted); font-size: 12px; }
.label-a { left: 8%; top: 58%; }
.label-b { left: 44%; top: 19%; }
.label-c { left: 43%; top: 73%; }
.label-d { right: 3%; top: 58%; color: var(--accent-strong); }
.preview-answer { display: grid; gap: 9px; margin-top: 8px; }
.preview-answer span { display: block; height: 6px; border-radius: 6px; background: rgba(90, 103, 165, .14); }
.preview-answer span:nth-child(1) { width: 92%; background: rgba(102, 88, 232, .22); }
.preview-answer span:nth-child(2) { width: 78%; }
.preview-answer span:nth-child(3) { width: 86%; }
.preview-answer span:nth-child(4) { width: 54%; }
.preview-footer { display: flex; align-items: center; justify-content: space-between; padding: 11px 15px; border-top: 1px solid var(--line); color: var(--faint); font-size: 12px; }
.preview-footer span:first-child { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); }

.home-grid { display: grid; grid-template-columns: minmax(300px, .82fr) minmax(0, 1.18fr); gap: 22px; align-items: start; scroll-margin-top: 90px; }
.create-card { position: sticky; top: 88px; }
.project-row { display: flex; align-items: center; gap: 14px; padding: 15px 14px; border: 1px solid transparent; border-radius: 12px; color: var(--text); transition: transform var(--fast), border-color var(--fast), background var(--fast); animation: row-enter 300ms var(--ease) both; animation-delay: calc(var(--i, 1) * 35ms); }
.project-row:hover { transform: translateX(3px); border-color: var(--line); background: rgba(102, 88, 232, .05); }
.project-index { color: var(--faint); font-size: 12px; font-variant-numeric: tabular-nums; }
.project-info { display: flex; flex: 1; flex-direction: column; min-width: 0; }
.project-name { overflow: hidden; color: var(--ink); font-weight: 600; text-overflow: ellipsis; white-space: nowrap; }
.row-arrow { flex: 0 0 auto; width: 17px; height: 17px; color: var(--faint); transition: transform var(--fast), color var(--fast); }
.project-row:hover .row-arrow { transform: translateX(3px); color: var(--accent); }

.auth-stage { display: grid; grid-template-columns: minmax(0, 1fr) 400px; align-items: center; gap: 80px; min-height: calc(100vh - 190px); }
.auth-intro { animation: enter-up var(--slow) var(--ease) both; }
.auth-intro h1 { font-size: clamp(40px, 4.6vw, 58px); line-height: 1.14; letter-spacing: -.04em; }
.auth-path { display: flex; align-items: center; gap: 12px; margin-top: 30px; color: var(--faint); font-size: 12px; }
.auth-path i { width: 34px; height: 1px; background: var(--line-strong); }
.auth-card { animation: enter-scale 480ms var(--ease) 80ms both; }
.auth-card h2 { font-size: 23px; }
.auth-form { display: flex; flex-direction: column; gap: 12px; margin-top: 22px; }
.auth-form label { font-size: 13px; font-weight: 550; }
.auth-note { margin: 18px 0 0; color: var(--faint); font-size: 12px; text-align: center; }

.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin-bottom: 24px; }
.page-head h1 { max-width: 780px; }
.head-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.crumb { margin-bottom: 8px; color: var(--faint); font-size: 13px; }
.crumb a { color: var(--muted); }
.progress-card { margin-bottom: 22px; padding: 17px 20px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface); }
.progress-line { display: flex; justify-content: space-between; gap: 12px; margin-bottom: 10px; color: var(--muted); font-size: 13px; }
.progress { height: 6px; overflow: hidden; border-radius: 999px; background: rgba(90, 103, 165, .12); }
.progress span { display: block; height: 100%; border-radius: inherit; background: var(--accent); box-shadow: 0 0 18px rgba(102, 88, 232, .35); transition: width 450ms var(--ease); }
.step-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; margin-bottom: 24px; }
.step-card { position: relative; min-height: 168px; padding: 19px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface); color: var(--text); transition: transform var(--fast) var(--ease), border-color var(--fast), background var(--fast), box-shadow var(--fast); animation: row-enter 320ms var(--ease) both; animation-delay: calc(var(--i, 1) * 35ms); }
.step-card:hover { transform: translateY(-4px); border-color: var(--line-strong); background: var(--surface-raised); box-shadow: 0 14px 36px rgba(69, 64, 130, .14); }
.step-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 15px; }
.step-num { color: var(--faint); font-size: 12px; font-variant-numeric: tabular-nums; }
.step-title { margin-bottom: 6px; color: var(--ink); font-size: 17px; font-weight: 600; }
.step-hint { color: var(--muted); font-size: 13px; line-height: 1.6; }
.step-arrow { position: absolute; right: 16px; bottom: 15px; width: 17px; height: 17px; color: var(--faint); transition: transform var(--fast), color var(--fast); }
.step-card:hover .step-arrow { transform: translateX(3px); color: var(--accent); }
.badge { padding: 3px 8px; border: 1px solid var(--line); border-radius: 999px; color: var(--accent-strong); font-size: 12px; }
.badge.ok { border-color: rgba(100, 223, 182, .24); background: rgba(100, 223, 182, .06); color: var(--ok); }
.badge.idle { color: var(--faint); }
.danger-zone { margin-top: 28px; text-align: right; }

.step-layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 18px; align-items: start; }
.step-layout > .card { margin-bottom: 0; }
.ai-panel { position: sticky; top: 86px; }
.ai-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.ai-head h2 { margin-bottom: 0; }
.deliverable { margin: 10px 0 12px; color: var(--muted); font-size: 13px; line-height: 1.65; }
.deliverable strong { color: var(--text); }
.deliverable a { display: inline-block; margin-top: 4px; }
.ai-output { max-height: 62vh; margin: 12px 0 10px; padding: 16px; overflow: auto; border: 1px solid var(--line); border-radius: 11px; background: #f7f8ff; color: var(--text); font-family: var(--font-body); font-size: 13.5px; line-height: 1.8; white-space: pre-wrap; word-break: break-word; transition: opacity var(--normal), border-color var(--normal), box-shadow var(--normal); }
.markdown-body { white-space: normal; }
.markdown-body h2, .markdown-body h3, .markdown-body h4 { margin: 18px 0 10px; line-height: 1.4; }
.markdown-body h2:first-child, .markdown-body h3:first-child, .markdown-body h4:first-child { margin-top: 0; }
.markdown-body h2 { font-size: 19px; }
.markdown-body h3 { font-size: 16px; }
.markdown-body h4 { font-size: 14px; }
.markdown-body p { margin: 0 0 12px; }
.markdown-body p:last-child { margin-bottom: 0; }
.markdown-body strong { color: var(--ink); font-weight: 650; }
.markdown-body a { text-decoration: underline; text-underline-offset: 2px; }
.markdown-body ul, .markdown-body ol { margin: 8px 0 14px; padding-left: 23px; }
.markdown-body li { margin: 6px 0; }
.markdown-body li::marker { color: var(--accent); }
.table-scroll { margin: 14px 0; overflow-x: auto; }
.markdown-body table { width: 100%; min-width: 360px; border-collapse: collapse; font-size: 12.5px; }
.markdown-body th, .markdown-body td { padding: 8px 10px; border: 1px solid var(--line); vertical-align: top; }
.markdown-body th { background: rgba(102, 88, 232, .08); color: var(--ink); font-weight: 600; text-align: left; }
.markdown-body blockquote { margin: 12px 0; padding: 10px 13px; border-left: 3px solid var(--accent); border-radius: 0 8px 8px 0; background: rgba(102, 88, 232, .055); }
.markdown-body blockquote p { margin-bottom: 0; }
.markdown-body code { padding: 2px 5px; border-radius: 5px; background: #eceffc; color: #4f40c5; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .92em; }
.markdown-body pre { margin: 12px 0; padding: 14px; overflow: auto; border-radius: 10px; background: #edf1fa; color: var(--text); }
.markdown-body pre code { padding: 0; background: transparent; color: inherit; }
.markdown-body hr { margin: 18px 0; border: 0; border-top: 1px solid var(--line); }
.ai-output.is-loading { opacity: .45; }
.ai-output.is-complete { border-color: rgba(100, 223, 182, .5); box-shadow: 0 0 0 3px rgba(100, 223, 182, .08); }
.empty-output { color: var(--faint); }
.ai-waiting { display: flex; align-items: center; gap: 10px; margin: 12px 0; padding: 11px 12px; border: 1px solid var(--line); border-radius: 10px; background: rgba(102, 88, 232, .05); color: var(--muted); font-size: 12px; }
.ai-waiting #ai-elapsed { margin-left: auto; color: var(--faint); }
.waiting-orbit { flex: 0 0 auto; width: 16px; height: 16px; border: 2px solid rgba(102, 88, 232, .18); border-top-color: var(--accent); border-radius: 50%; animation: spin .9s linear infinite; }
.ai-waiting.waiting-static .waiting-orbit { animation: none; border-color: var(--faint); }
.reference-results { margin: 12px 0 20px; }
.reference-item { animation: row-enter 280ms var(--ease) both; animation-delay: calc(var(--i, 1) * 35ms); }
.update-time { margin-top: 10px; }

@keyframes enter-up { from { opacity: 0; transform: translateY(18px); } to { opacity: 1; transform: translateY(0); } }
@keyframes enter-scale { from { opacity: 0; transform: translateY(18px) scale(.985); } to { opacity: 1; transform: translateY(0) scale(1); } }
@keyframes row-enter { from { opacity: 0; transform: translateY(9px); } to { opacity: 1; transform: translateY(0); } }
@keyframes drift-a { from { transform: translate3d(-3%, -2%, 0) scale(1); } to { transform: translate3d(7%, 5%, 0) scale(1.08); } }
@keyframes drift-b { from { transform: translate3d(4%, -4%, 0) scale(1.04); } to { transform: translate3d(-6%, 6%, 0) scale(.96); } }
@keyframes float-preview { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-8px); } }
@keyframes spin { to { transform: rotate(360deg); } }
@view-transition { navigation: auto; }
::view-transition-old(root) { animation: 160ms ease both fade-out; }
::view-transition-new(root) { animation: 260ms var(--ease) both fade-in; }
@keyframes fade-out { to { opacity: 0; } }
@keyframes fade-in { from { opacity: 0; transform: translateY(5px); } to { opacity: 1; transform: translateY(0); } }

body.motion-paused .ambient { display: none; }
body.motion-paused *, body.motion-paused *::before, body.motion-paused *::after { animation: none !important; transition: none !important; }
body.motion-paused .hero-visual { transform: none !important; }
body.motion-paused ::view-transition-old(root), body.motion-paused ::view-transition-new(root) { animation: none !important; }

@media (max-width: 1040px) {
  .hero-stage { grid-template-columns: 1fr; gap: 44px; padding-top: 60px; }
  .hero-copy { max-width: 760px; }
  .hero-visual { width: min(100%, 700px); margin: 0 auto; }
  .step-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .auth-stage { grid-template-columns: 1fr 380px; gap: 40px; }
}
@media (max-width: 860px) {
  .home-grid, .step-layout, .auth-stage { grid-template-columns: 1fr; }
  .create-card, .ai-panel { position: static; }
  .auth-stage { gap: 34px; padding-top: 36px; }
  .auth-card { max-width: 480px; }
  .page-head { flex-direction: column; align-items: flex-start; }
}
@media (max-width: 640px) {
  .wrap { padding: 26px 16px 56px; }
  .topbar { min-height: 58px; padding: 8px 16px; }
  .brand { font-size: 13px; }
  .brand-mark, .brand-mark svg { width: 27px; height: 27px; }
  .topnav { gap: 8px; }
  .motion-toggle span { display: none; }
  .motion-toggle { min-width: 32px; justify-content: center; }
  .hero-stage { min-height: auto; padding: 42px 0 54px; }
  .hero-copy h1 { font-size: 38px; }
  .hero-lead { font-size: 15px; }
  .eyebrow-pill { margin-bottom: 18px; font-size: 12px; }
  .hero-notes { gap: 10px 16px; }
  .preview-body { grid-template-columns: 104px 1fr; min-height: 360px; }
  .preview-steps { padding: 14px 8px; }
  .preview-steps div { gap: 6px; padding: 7px 4px; font-size: 12px; }
  .preview-canvas { padding: 14px 10px; }
  .evidence-graph { height: 175px; }
  .graph-label { font-size: 12px; }
  .home-grid { gap: 16px; }
  .card { padding: 19px; border-radius: 15px; }
  .step-grid { grid-template-columns: 1fr; }
  .step-card { min-height: 142px; }
  .progress-line { flex-direction: column; gap: 2px; }
  .form-actions { align-items: stretch; }
  .form-actions .btn { flex: 1 1 auto; }
  .form-actions .status { flex-basis: 100%; }
  .auth-path { flex-wrap: wrap; }
  .auth-path i { width: 20px; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .ambient { display: none; }
  .hero-visual { transform: none !important; }
  ::view-transition-old(root), ::view-transition-new(root) { animation: none !important; }
}

/* Topic confirmation and connected research workflow. */
.workflow-nav { display: flex; gap: 8px; overflow-x: auto; padding: 2px 0 14px; margin-bottom: 18px; scrollbar-width: thin; }
.workflow-nav a { display: flex; flex: 0 0 auto; align-items: center; gap: 7px; padding: 9px 11px; border: 1px solid var(--line); border-radius: 10px; background: rgba(255,255,255,.6); color: var(--muted); font-size: .875rem; }
.workflow-nav a span { color: var(--faint); font-size: .75rem; font-variant-numeric: tabular-nums; }
.workflow-nav a[aria-current] { border-color: var(--accent); background: #efedff; color: var(--accent-strong); font-weight: 600; }
.topic-context { display: flex; align-items: baseline; flex-wrap: wrap; gap: 8px 16px; margin-bottom: 22px; padding: 15px 18px; border-left: 3px solid var(--accent); background: rgba(255,255,255,.7); border-radius: 4px 10px 10px 4px; }
.context-label { color: var(--muted); font-size: .875rem; }
.topic-context strong { flex: 1 1 340px; color: var(--ink); overflow-wrap: anywhere; }
.topic-context a { font-size: .875rem; }
.step-layout { grid-template-columns: minmax(0, .95fr) minmax(0, 1.05fr); }
.step-layout .panel-heading { align-items: baseline; flex-wrap: wrap; gap: 8px; }
.step-layout .field label, .topic-confirm label { font-size: .875rem; }
.step-layout input, .step-layout textarea, .step-layout select { font-size: 1rem; }
.step-layout select { appearance: none; padding-right: 34px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 16 16'%3E%3Cpath d='m4 6 4 4 4-4' fill='none' stroke='%23586885' stroke-width='1.5'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; }
.field-help { margin: 10px 0 14px; color: var(--muted); font-size: .875rem; line-height: 1.75; }
.form-divider { height: 1px; margin: 22px 0; background: var(--line); }
.topic-confirm { margin-top: 26px; padding-top: 24px; border-top: 1px solid var(--line); }
.topic-confirm h2 { font-size: 1.125rem; margin-bottom: 8px; }
.topic-confirm label { display: block; font-weight: 600; margin-bottom: 8px; }
.topic-confirm textarea { margin-bottom: 12px; }
.topic-confirm .status { display: block; margin-top: 8px; }
.reference-library { margin-top: 16px; border-block: 1px solid var(--line); }
.reference-library summary { padding: 13px 0; cursor: pointer; color: var(--accent-strong); font-weight: 600; font-size: .875rem; }
.reference-library h3 { margin-top: 20px; margin-bottom: 2px; font-size: .875rem; color: var(--muted); }
.reference-item { padding: 14px 0; border-bottom: 1px solid var(--line); }
.reference-item:last-child { border-bottom: 0; }
.reference-item strong { display: block; margin: 5px 0; font-size: 1rem; color: var(--ink); line-height: 1.65; }
.reference-meta { font-size: .8125rem; color: var(--muted); }
.reference-source { font-size: .875rem; color: var(--muted); }
.step-layout .ai-output { font-size: 1rem; max-height: 65vh; }
.step-layout .deliverable { font-size: .875rem; }
.ai-head { align-items: center; }
.ai-head .btn { min-height: 36px; padding: 5px 10px; }
.step-layout #ai-output, #f-selected_topic { scroll-margin-top: 90px; }
.btn:disabled { cursor: not-allowed; opacity: .65; transform: none; }
.step-navigation { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; margin-top: 24px; }
#topic-mismatch .btn { margin-top: 8px; }
@media (max-width: 860px) {
  .step-layout { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  .workflow-nav { margin-inline: -2px; }
  .workflow-nav a { padding: 8px 10px; }
  .step-layout .card { padding: 18px; }
  .step-layout .ai-output { max-height: none; padding: 12px; }
  .topic-context { padding: 12px 14px; }
  .step-navigation .field-help { margin: 0; }
}
