:root {
  --bg: oklch(1 0 0);
  --surface: oklch(0.975 0.004 15);
  --surface-strong: oklch(0.945 0.01 15);
  --ink: oklch(0.20 0.025 18);
  --muted: oklch(0.46 0.025 18);
  --line: oklch(0.88 0.012 18);
  --primary: oklch(0.50 0.17 15);
  --primary-strong: oklch(0.42 0.14 15);
  --primary-soft: oklch(0.95 0.025 15);
  --accent: oklch(0.45 0.10 205);
  --accent-soft: oklch(0.95 0.025 205);
  --success: oklch(0.50 0.12 150);
  --warning: oklch(0.70 0.14 75);
  --danger: oklch(0.50 0.18 25);
  --shadow: 0 20px 60px oklch(0.2 0.02 18 / 0.09);
  --radius-sm: 10px;
  --radius: 18px;
  --radius-lg: 28px;
  --focus: 0 0 0 4px oklch(0.70 0.12 205 / 0.35);
}

* { box-sizing: border-box; }
html { color-scheme: light; scroll-behavior: smooth; }
body {
  margin: 0;
  min-width: 320px;
  background: var(--bg);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
button, input, textarea { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .48; }
:focus-visible { outline: none; box-shadow: var(--focus); }
h1, h2, h3, p { margin-top: 0; }
h1, h2, h3 { line-height: 1.15; text-wrap: balance; }
p { text-wrap: pretty; }

.skip-link {
  position: fixed; left: 1rem; top: -5rem; z-index: 50;
  padding: .75rem 1rem; background: var(--ink); color: white; border-radius: 8px;
}
.skip-link:focus { top: 1rem; }
.topbar {
  min-height: 72px; padding: 0 clamp(1rem, 4vw, 3rem); border-bottom: 1px solid var(--line);
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  background: oklch(1 0 0 / .94); position: sticky; top: 0; z-index: 20;
}
.brand { display: flex; align-items: center; gap: .75rem; font-weight: 760; letter-spacing: -.02em; }
.brand-mark {
  display: grid; place-items: center; width: 36px; height: 36px; border-radius: 12px;
  background: var(--primary); color: white; font-size: .95rem;
}
.save-status { color: var(--muted); font-size: .875rem; }
.shell { width: min(1180px, calc(100% - 2rem)); margin-inline: auto; }
.shell.narrow { width: min(760px, calc(100% - 2rem)); }
.shell.wide { width: min(1280px, calc(100% - 2rem)); }
.page-section { padding-block: clamp(2rem, 6vw, 5rem); }
.context-label { color: var(--primary-strong); font-weight: 720; font-size: .875rem; margin-bottom: .75rem; }
.context-label.light { color: oklch(0.9 0.04 15); }

.intro { min-height: calc(100vh - 72px); display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(310px, .75fr); gap: clamp(2rem, 7vw, 7rem); align-items: center; padding-block: clamp(3rem, 8vw, 7rem); }
.intro-copy { max-width: 690px; }
.intro h1 { font-size: clamp(2.5rem, 6vw, 5rem); letter-spacing: -.04em; margin-bottom: 1.4rem; }
.lead { font-size: clamp(1.1rem, 2vw, 1.35rem); color: var(--muted); max-width: 58ch; }
.notice { border: 1px solid; border-radius: var(--radius); padding: 1.15rem 1.25rem; }
.notice strong { display: block; margin-bottom: .25rem; }
.notice p { margin-bottom: 0; }
.info-notice { border-color: oklch(0.82 0.04 205); background: var(--accent-soft); color: oklch(0.30 0.07 205); }
.caution-notice { border-color: oklch(0.84 0.09 75); background: oklch(0.97 0.035 75); color: oklch(0.32 0.065 70); }
.intro-copy .notice { margin-block: 2rem; max-width: 65ch; }
.intro-actions { display: flex; flex-wrap: wrap; gap: .75rem; }
.privacy-note { color: var(--muted); font-size: .875rem; margin: 1.25rem 0 0; max-width: 62ch; }
.journey { background: var(--surface); border-radius: var(--radius-lg); padding: clamp(1.5rem, 4vw, 2.5rem); }
.journey h2 { font-size: 1.25rem; margin-bottom: 1.5rem; }
.journey ol { list-style: none; padding: 0; margin: 0; display: grid; gap: .25rem; }
.journey li { display: grid; grid-template-columns: 42px 1fr; gap: .75rem; padding: .9rem 0; align-items: start; }
.journey li + li { border-top: 1px solid var(--line); }
.journey li > span { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 50%; background: white; color: var(--primary-strong); font-weight: 750; }
.journey p { color: var(--muted); margin: .1rem 0 0; font-size: .925rem; }

.button { min-height: 48px; border: 0; border-radius: 12px; padding: .75rem 1.15rem; font-weight: 720; transition: transform 180ms ease, background 180ms ease, color 180ms ease; }
.button:hover:not(:disabled) { transform: translateY(-1px); }
.button:active:not(:disabled) { transform: translateY(0); }
.button.primary { background: var(--primary); color: white; }
.button.primary:hover:not(:disabled) { background: var(--primary-strong); }
.button.quiet { background: var(--surface-strong); color: var(--ink); }
.button.quiet:hover:not(:disabled) { background: oklch(0.91 0.018 18); }
.button.compact { min-height: 42px; padding: .55rem .85rem; }
.button.full { width: 100%; }
.button.text-button { background: transparent; color: var(--primary-strong); }

.step-heading { max-width: 68ch; margin-bottom: 2.5rem; }
.step-heading h1 { font-size: clamp(2rem, 4vw, 3.35rem); letter-spacing: -.035em; margin-bottom: .75rem; }
.step-heading > p:last-child { color: var(--muted); font-size: 1.08rem; }
.form-stack { display: grid; gap: 1.4rem; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.field { display: grid; gap: .55rem; border: 0; padding: 0; margin: 0; }
.field > span, .field legend { font-weight: 700; }
.field small { color: var(--muted); font-weight: 500; }
input, textarea { width: 100%; border: 1px solid var(--line); border-radius: 12px; padding: .85rem 1rem; background: white; color: var(--ink); }
input::placeholder, textarea::placeholder { color: oklch(0.49 0.02 18); opacity: 1; }
input:hover, textarea:hover { border-color: oklch(0.72 0.025 18); }
textarea { resize: vertical; min-height: 110px; }
.check-grid { display: grid; grid-template-columns: 1fr 1fr; gap: .6rem; }
.check-grid label { display: flex; align-items: center; gap: .7rem; border: 1px solid var(--line); border-radius: 12px; padding: .8rem; }
.check-grid input, .consent-row input { width: 20px; height: 20px; accent-color: var(--primary); flex: 0 0 auto; }
.consent-row { display: flex; align-items: flex-start; gap: .75rem; background: var(--surface); border-radius: 14px; padding: 1rem; }
.form-actions { display: flex; justify-content: space-between; gap: 1rem; padding-top: .5rem; }

.assessment-shell { min-height: calc(100vh - 72px); display: grid; grid-template-columns: minmax(260px, 340px) minmax(0, 1fr); }
.assessment-guide { background: var(--surface); border-right: 1px solid var(--line); padding: clamp(2rem, 4vw, 3.5rem); display: flex; flex-direction: column; gap: 2rem; }
.assessment-guide h2 { font-size: 1.55rem; }
.guide-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 1.35rem; }
.guide-list li { display: grid; gap: .2rem; }
.guide-list span { color: var(--muted); font-size: .925rem; }
.assessment-guide .button { margin-top: auto; align-self: start; }
.assessment-content { padding: clamp(1.25rem, 5vw, 4rem); max-width: 980px; width: 100%; }
.progress-wrap { margin-bottom: 2rem; }
.progress-meta { display: flex; justify-content: space-between; gap: 1rem; color: var(--muted); font-size: .875rem; margin-bottom: .55rem; }
.progress-track { height: 7px; background: var(--surface-strong); border-radius: 99px; overflow: hidden; }
.progress-track span { display: block; height: 100%; width: 0; background: var(--primary); border-radius: inherit; transition: width 220ms ease; }
.question-card { max-width: 820px; }
.question-number { color: var(--primary-strong); font-size: .875rem; font-weight: 730; }
.question-card h1 { font-size: clamp(2rem, 4vw, 3.4rem); letter-spacing: -.035em; margin: .45rem 0 .8rem; }
.question-prompt { color: var(--muted); font-size: 1.08rem; max-width: 65ch; }
.instruction-strip { display: flex; gap: .7rem; align-items: flex-start; background: var(--accent-soft); color: oklch(0.31 0.07 205); padding: .85rem 1rem; border-radius: 12px; margin: 1.5rem 0; }
.instruction-strip b { flex: 0 0 auto; }
.scale-fieldset { border: 0; padding: 0; margin: 2rem 0 1.5rem; }
.scale-fieldset legend { font-weight: 730; margin-bottom: .85rem; }
.scale-grid { display: grid; grid-template-columns: repeat(7, minmax(64px, 1fr)); gap: .55rem; }
.score-option { position: relative; }
.score-option input { position: absolute; inset: 0; opacity: 0; }
.score-option span { min-height: 62px; display: grid; place-items: center; border: 1px solid var(--line); border-radius: 13px; font-weight: 760; background: white; transition: border 160ms ease, background 160ms ease, color 160ms ease, transform 160ms ease; }
.score-option input:hover + span { border-color: var(--primary); transform: translateY(-1px); }
.score-option input:focus-visible + span { box-shadow: var(--focus); }
.score-option input:checked + span { background: var(--primary); border-color: var(--primary); color: white; }
.scale-labels { display: flex; justify-content: space-between; color: var(--muted); font-size: .825rem; margin-top: .55rem; }
.descriptor-panel { border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.descriptor-panel h2 { font-size: 1rem; padding: 1rem; margin: 0; background: var(--surface); }
.descriptor-list { display: grid; }
.descriptor { display: grid; grid-template-columns: 44px 1fr; gap: .75rem; padding: .9rem 1rem; align-items: start; }
.descriptor + .descriptor { border-top: 1px solid var(--line); }
.descriptor strong { display: grid; place-items: center; width: 38px; height: 32px; border-radius: 9px; background: var(--surface-strong); font-variant-numeric: tabular-nums; }
.descriptor.active { background: var(--primary-soft); }
.descriptor.active strong { background: var(--primary); color: white; }
.notes-field { margin-top: 1.5rem; }
.notes-field textarea { min-height: 96px; }
.question-actions { display: flex; justify-content: space-between; gap: .8rem; margin-top: 1.5rem; }

.review-head { display: flex; justify-content: space-between; gap: 2rem; align-items: end; }
.review-score { text-align: right; color: var(--muted); font-size: .9rem; margin-bottom: 2.5rem; }
.review-score strong { display: block; color: var(--ink); font-size: 2rem; font-variant-numeric: tabular-nums; }
.review-layout { display: grid; grid-template-columns: minmax(0, 1fr) 350px; gap: 2rem; align-items: start; }
.review-list { border-top: 1px solid var(--line); }
.review-item { display: grid; grid-template-columns: 40px minmax(0, 1fr) auto auto; gap: 1rem; align-items: center; padding: 1rem .25rem; border-bottom: 1px solid var(--line); }
.review-item .index { color: var(--muted); font-variant-numeric: tabular-nums; }
.review-item h3 { font-size: 1rem; margin: 0; }
.review-item p { color: var(--muted); font-size: .875rem; margin: .2rem 0 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.score-badge { min-width: 48px; text-align: center; padding: .35rem .55rem; border-radius: 999px; background: var(--surface-strong); font-weight: 760; font-variant-numeric: tabular-nums; }
.score-badge.missing { color: var(--danger); background: oklch(0.95 0.03 25); }
.edit-button { border: 0; background: transparent; color: var(--primary-strong); font-weight: 730; padding: .5rem; }
.review-aside { position: sticky; top: 96px; display: grid; gap: 1rem; }

.result-hero { background: var(--primary-strong); color: white; padding-block: clamp(2.5rem, 7vw, 5rem); }
.result-hero-inner { display: flex; align-items: center; justify-content: space-between; gap: 2rem; }
.result-hero h1 { font-size: clamp(2.25rem, 5vw, 4.5rem); letter-spacing: -.04em; margin-bottom: .75rem; }
.result-hero p { color: oklch(0.90 0.025 15); margin-bottom: 0; }
.score-orbit { flex: 0 0 auto; width: 154px; height: 154px; border-radius: 50%; border: 1px solid oklch(1 0 0 / .35); background: oklch(1 0 0 / .08); display: grid; place-content: center; text-align: center; }
.score-orbit strong { font-size: 3.1rem; line-height: 1; font-variant-numeric: tabular-nums; }
.score-orbit span { color: oklch(0.9 0.02 15); }
.result-body { display: grid; grid-template-columns: minmax(0, 1fr) 350px; gap: clamp(2rem, 5vw, 5rem); padding-block: clamp(2.5rem, 6vw, 5rem); align-items: start; }
.result-main { display: grid; gap: 1.5rem; }
.result-band { padding: 1.2rem 1.25rem; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.result-band strong { display: block; font-size: 1.15rem; margin-bottom: .25rem; }
.result-band p { color: var(--muted); margin: 0; }
.section-title-row { margin-top: 1.5rem; }
.section-title-row h2 { margin-bottom: .3rem; }
.section-title-row p { color: var(--muted); margin: 0; }
.domain-chart { display: grid; gap: .95rem; }
.chart-row { display: grid; grid-template-columns: minmax(170px, 260px) minmax(120px, 1fr) 42px; gap: 1rem; align-items: center; }
.chart-row span:first-child { font-size: .925rem; }
.bar-track { height: 10px; background: var(--surface-strong); border-radius: 99px; overflow: hidden; }
.bar-fill { height: 100%; background: var(--accent); border-radius: inherit; }
.chart-value { font-weight: 760; text-align: right; font-variant-numeric: tabular-nums; }
.next-steps { position: sticky; top: 96px; background: var(--surface); border-radius: var(--radius-lg); padding: 1.5rem; display: grid; gap: 1rem; }
.next-steps h2 { font-size: 1.35rem; }
.next-steps ol { list-style: none; padding: 0; margin: 0 0 .5rem; display: grid; gap: 1rem; }
.next-steps li { display: grid; grid-template-columns: 32px 1fr; gap: .75rem; }
.next-steps li span { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; background: white; color: var(--primary-strong); font-weight: 760; }
.next-steps p { margin: 0; font-size: .925rem; }
.toast { position: fixed; left: 50%; bottom: 1.5rem; transform: translateX(-50%); z-index: 40; background: var(--ink); color: white; padding: .75rem 1rem; border-radius: 10px; box-shadow: var(--shadow); }

@media (max-width: 900px) {
  .intro, .review-layout, .result-body { grid-template-columns: 1fr; }
  .intro { min-height: auto; }
  .journey { max-width: 680px; }
  .assessment-shell { grid-template-columns: 1fr; }
  .assessment-guide { border-right: 0; border-bottom: 1px solid var(--line); padding-block: 1.25rem; gap: 1rem; }
  .assessment-guide > div { display: flex; justify-content: space-between; align-items: center; gap: 1rem; }
  .assessment-guide h2 { margin: 0; font-size: 1.1rem; }
  .assessment-guide .context-label { display: none; }
  .guide-list { display: none; }
  .assessment-guide .button { margin: 0; }
  .review-aside, .next-steps { position: static; }
}

@media (max-width: 640px) {
  .topbar { min-height: 64px; padding-inline: 1rem; }
  .save-status { font-size: .75rem; max-width: 130px; text-align: right; }
  .intro { padding-block: 2.5rem; }
  .intro h1 { font-size: 2.55rem; }
  .intro-actions, .form-actions { flex-direction: column-reverse; }
  .intro-actions .button, .form-actions .button { width: 100%; }
  .field-row, .check-grid { grid-template-columns: 1fr; }
  .assessment-content { padding: 1.15rem 1rem 2rem; }
  .assessment-guide { padding: 1rem; flex-direction: row; align-items: center; justify-content: space-between; }
  .assessment-guide > div { display: block; }
  .assessment-guide h2 { font-size: 1rem; margin: 0; }
  .scale-grid { grid-template-columns: repeat(4, 1fr); }
  .score-option span { min-height: 54px; }
  .question-actions { position: sticky; bottom: 0; background: oklch(1 0 0 / .96); padding-block: .8rem; }
  .question-actions .button { flex: 1; }
  .review-head, .result-hero-inner { align-items: flex-start; flex-direction: column; }
  .review-score { text-align: left; margin-bottom: 1rem; }
  .review-item { grid-template-columns: 28px minmax(0, 1fr) auto; gap: .65rem; }
  .review-item .edit-button { grid-column: 2 / -1; justify-self: start; padding-left: 0; }
  .score-orbit { width: 120px; height: 120px; }
  .score-orbit strong { font-size: 2.5rem; }
  .chart-row { grid-template-columns: minmax(0, 1fr) 38px; gap: .5rem; }
  .chart-row .bar-track { grid-column: 1 / -1; grid-row: 2; }
}

@media print {
  .topbar, .button, .review-aside, .next-steps { display: none !important; }
  .result-hero { padding: 1.5rem 0; background: white; color: var(--ink); border-bottom: 2px solid var(--ink); }
  .result-hero p, .context-label.light { color: var(--muted); }
  .score-orbit { border-color: var(--ink); background: white; }
  .result-body { display: block; padding: 1.5rem 0; }
  .chart-row { break-inside: avoid; }
  body { font-size: 12pt; }
}

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