  :root {
    color-scheme: light;
    --surface-1:      #fcfcfb;
    --page-plane:     #f9f9f7;
    --text-primary:   #0b0b0b;
    --text-secondary: #52514e;
    --text-muted:     #898781;
    --gridline:       #e1e0d9;
    --baseline:       #c3c2b7;
    --border:         rgba(11,11,11,0.10);
    --accent:         #2a78d6;
    --accent-wash:    rgba(42,120,214,0.08);
    --good:           #0ca30c;
    --warning:        #fab219;
    --critical:       #d03b3b;
    --card-shadow:    0 1px 2px rgba(11,11,11,0.06), 0 1px 12px rgba(11,11,11,0.04);
  }
  html[data-theme="dark"] {
    color-scheme: dark;
    --surface-1:      #1a1a19;
    --page-plane:     #0d0d0d;
    --text-primary:   #ffffff;
    --text-secondary: #c3c2b7;
    --text-muted:     #898781;
    --gridline:       #2c2c2a;
    --baseline:       #383835;
    --border:         rgba(255,255,255,0.10);
    --accent:         #3987e5;
    --accent-wash:    rgba(57,135,229,0.14);
    --good:           #0ca30c;
    --warning:        #fab219;
    --critical:       #e66767;
    --card-shadow:    0 1px 2px rgba(0,0,0,0.3), 0 1px 16px rgba(0,0,0,0.25);
  }

  * { box-sizing: border-box; }
  html, body {
    margin: 0; padding: 0;
    font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
    background: var(--page-plane);
    color: var(--text-primary);
  }
  body { min-height: 100vh; }

  .app {
    max-width: 720px;
    margin: 0 auto;
    padding: 24px 20px 64px;
    min-height: 100vh;
  }

  .topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
  }
  .brand {
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 0.06em;
    color: var(--text-muted);
    text-transform: uppercase;
  }
  .theme-toggle {
    border: 1px solid var(--border);
    background: var(--surface-1);
    color: var(--text-secondary);
    border-radius: 8px;
    padding: 6px 12px;
    font-size: 13px;
    cursor: pointer;
  }
  .theme-toggle:hover { color: var(--text-primary); }

  .card {
    background: var(--surface-1);
    border: 1px solid var(--border);
    border-radius: 16px;
    box-shadow: var(--card-shadow);
    padding: 32px 28px;
  }

  h1 {
    font-size: 24px;
    line-height: 1.3;
    margin: 0 0 8px;
    font-weight: 700;
  }
  h2 {
    font-size: 19px;
    margin: 0 0 4px;
    font-weight: 700;
  }
  p { line-height: 1.55; color: var(--text-secondary); margin: 0 0 12px; }
  .muted { color: var(--text-muted); font-size: 13px; }

  /* ---- Intro screen ---- */
  .intro-lede { font-size: 15px; margin-bottom: 20px; }
  .howto {
    background: var(--accent-wash);
    border-radius: 12px;
    padding: 16px 18px;
    margin: 20px 0 24px;
  }
  .howto p { color: var(--text-primary); font-size: 14px; margin: 0; }
  .field { margin-bottom: 18px; }
  .field label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 6px;
  }
  .field input {
    width: 100%;
    font-size: 16px;
    padding: 12px 14px;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: var(--page-plane);
    color: var(--text-primary);
    font-family: inherit;
  }
  .field input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-wash);
  }
  .field-error {
    color: var(--critical);
    font-size: 12px;
    margin-top: 6px;
    display: none;
  }
  .field.invalid input { border-color: var(--critical); }
  .field.invalid .field-error { display: block; }

  /* ---- Progress ---- */
  .progress-wrap { margin-bottom: 20px; }
  .progress-track {
    height: 6px;
    background: var(--gridline);
    border-radius: 3px;
    overflow: hidden;
  }
  .progress-fill {
    height: 100%;
    background: var(--accent);
    border-radius: 3px;
    transition: width 0.25s ease;
  }
  .progress-label {
    display: flex;
    justify-content: space-between;
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 6px;
  }

  /* ---- Question ---- */
  .pill {
    display: inline-block;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--accent);
    background: var(--accent-wash);
    border-radius: 999px;
    padding: 4px 10px;
    margin-bottom: 14px;
  }
  .question-text {
    font-size: 20px;
    font-weight: 600;
    line-height: 1.4;
    margin: 0 0 24px;
    color: var(--text-primary);
  }
  .scale {
    display: flex;
    flex-direction: column;
    gap: 8px;
  }
  .scale-option {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px 14px;
    border: 1px solid var(--border);
    border-radius: 12px;
    cursor: pointer;
    background: var(--page-plane);
    transition: border-color 0.15s ease, background 0.15s ease;
  }
  .scale-option:hover { border-color: var(--accent); }
  .scale-option.selected {
    border-color: var(--accent);
    background: var(--accent-wash);
  }
  .scale-num {
    width: 28px; height: 28px;
    flex: none;
    border-radius: 50%;
    border: 2px solid var(--baseline);
    display: flex; align-items: center; justify-content: center;
    font-size: 13px; font-weight: 700;
    color: var(--text-secondary);
  }
  .scale-option.selected .scale-num {
    border-color: var(--accent);
    background: var(--accent);
    color: #fff;
  }
  .scale-text { font-size: 14.5px; color: var(--text-primary); }

  .nav-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 28px;
    gap: 12px;
  }
  button {
    font-family: inherit;
    font-size: 15px;
    font-weight: 600;
    border-radius: 10px;
    padding: 12px 22px;
    cursor: pointer;
    border: none;
  }
  .btn-primary {
    background: var(--accent);
    color: #fff;
  }
  .btn-primary:disabled {
    opacity: 0.4;
    cursor: not-allowed;
  }
  .btn-ghost {
    background: transparent;
    color: var(--text-secondary);
    border: 1px solid var(--border);
  }
  .btn-ghost:hover { color: var(--text-primary); }

  /* ---- Results ---- */
  .result-header { text-align: center; margin-bottom: 8px; }
  .result-meta {
    display: flex;
    justify-content: center;
    gap: 18px;
    flex-wrap: wrap;
    font-size: 13px;
    color: var(--text-muted);
    margin-bottom: 24px;
  }

  .hero-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 16px;
    padding: 24px 28px;
    border-radius: 14px;
    background: var(--accent-wash);
    margin-bottom: 28px;
  }
  .hero-label { font-size: 13px; color: var(--text-secondary); font-weight: 600; margin-bottom: 4px; }
  .hero-value { font-size: 48px; font-weight: 700; line-height: 1; color: var(--text-primary); }
  .hero-sub { font-size: 12px; color: var(--text-muted); margin-top: 4px; }

  .status-badge {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    font-size: 13px;
    font-weight: 700;
    padding: 7px 14px;
    border-radius: 999px;
    background: var(--surface-1);
    border: 1px solid var(--border);
  }
  .status-dot { width: 9px; height: 9px; border-radius: 50%; flex: none; }
  .status-good .status-dot { background: var(--good); }
  .status-warning .status-dot { background: var(--warning); }
  .status-critical .status-dot { background: var(--critical); }
  .status-good { color: var(--good); }
  .status-warning { color: #9a6c00; }
  html[data-theme="dark"] .status-warning { color: var(--warning); }
  .status-critical { color: var(--critical); }

  .section-title {
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--text-muted);
    margin: 32px 0 14px;
  }

  /* bar chart */
  .chart { display: flex; flex-direction: column; gap: 16px; }
  .bar-row { }
  .bar-row-top {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 6px;
    gap: 8px;
  }
  .bar-name { font-size: 14px; font-weight: 600; color: var(--text-primary); }
  .bar-value-group { display: flex; align-items: center; gap: 8px; flex: none; }
  .bar-value { font-size: 14px; font-weight: 700; color: var(--text-primary); font-variant-numeric: tabular-nums; }
  .bar-track-wrap { position: relative; }
  .bar-track {
    position: relative;
    height: 24px;
    background: var(--gridline);
    border-radius: 4px;
    overflow: hidden;
  }
  .bar-fill {
    position: absolute;
    left: 0; top: 0; bottom: 0;
    border-radius: 4px;
    transition: width 0.5s ease;
  }
  .bar-gridlines {
    position: absolute;
    inset: 0;
    display: flex;
    justify-content: space-between;
    pointer-events: none;
  }
  .bar-gridlines span {
    width: 1px;
    background: var(--surface-1);
    opacity: 0.5;
  }
  .bar-axis {
    display: flex;
    justify-content: space-between;
    font-size: 10px;
    color: var(--text-muted);
    margin-top: 4px;
    padding: 0 1px;
  }

  .indicator-meaning { font-size: 12.5px; color: var(--text-muted); margin-top: 6px; }

  /* radar chart */
  .radar-wrap {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 12px 4px 4px;
  }
  .radar-wrap svg { width: 100%; max-width: 380px; height: auto; }
  .radar-axis-label { font-size: 11.5px; font-weight: 600; fill: var(--text-secondary); }
  .radar-value-label { font-size: 11px; font-weight: 700; fill: var(--text-primary); }
  .radar-ring { fill: none; stroke: var(--gridline); stroke-width: 1; }
  .radar-spoke { stroke: var(--gridline); stroke-width: 1; }
  .radar-area { fill: var(--accent); fill-opacity: 0.12; stroke: var(--accent); stroke-width: 2; stroke-linejoin: round; }
  .radar-legend {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
    justify-content: center;
    margin-top: 10px;
  }
  .radar-legend-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: var(--text-secondary);
  }
  .radar-legend-dot { width: 9px; height: 9px; border-radius: 50%; flex: none; }

  /* focus list */
  .focus-list { display: flex; flex-direction: column; gap: 10px; }
  .focus-item {
    display: flex;
    gap: 14px;
    padding: 14px 16px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--page-plane);
  }
  .focus-rank {
    flex: none;
    width: 26px; height: 26px;
    border-radius: 50%;
    background: var(--accent);
    color: #fff;
    font-size: 13px;
    font-weight: 700;
    display: flex; align-items: center; justify-content: center;
  }
  .focus-body strong { color: var(--text-primary); font-size: 14.5px; }
  .focus-body p { margin: 3px 0 0; font-size: 13.5px; }

  /* next steps */
  .steps-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
  }
  @media (max-width: 540px) {
    .steps-grid { grid-template-columns: 1fr; }
  }
  .step-card {
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 16px;
    background: var(--page-plane);
  }
  .step-card h3 {
    font-size: 14px;
    margin: 0 0 6px;
    color: var(--text-primary);
  }
  .step-card p { font-size: 13.5px; margin: 0; }

  .disclaimer {
    margin-top: 28px;
    font-size: 12.5px;
    color: var(--text-muted);
    border-top: 1px solid var(--border);
    padding-top: 16px;
  }

  .result-actions {
    display: flex;
    gap: 12px;
    margin-top: 28px;
    flex-wrap: wrap;
  }

  @media print {
    .theme-toggle, .result-actions { display: none !important; }
    body { background: #fff; }
    .card { box-shadow: none; border: none; }
  }

  @media (max-width: 480px) {
    h1 { font-size: 21px; }
    .hero-value { font-size: 38px; }
    .card { padding: 24px 18px; }
  }

  /* ---- Site links: logo back to home, result CTA, next steps ---- */
  .topbar-brand { display: flex; align-items: center; gap: 12px; min-width: 0; }
  .brand-link { display: block; flex: none; border-radius: 4px; }
  .brand-logo { height: 28px; width: auto; display: block; }
  .brand-logo-dark { display: none; }
  html[data-theme="dark"] .brand-logo-light { display: none; }
  html[data-theme="dark"] .brand-logo-dark { display: block; }
  .result-header h2 { font-size: 24px; line-height: 1.3; margin: 0 0 8px; }
  .cta-row { margin-top: 16px; }
  .btn-link {
    display: inline-block;
    font-size: 15px;
    font-weight: 600;
    border-radius: 10px;
    padding: 12px 22px;
    text-decoration: none;
  }
  .next-links { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
  .next-links li { font-size: 14px; line-height: 1.5; color: var(--text-secondary); }
  .next-links a, .app-footer a { color: var(--accent); font-weight: 600; text-decoration: none; }
  .next-links a:hover, .app-footer a:hover { text-decoration: underline; }
  .app-footer {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 20px;
    justify-content: center;
    margin-top: 28px;
    font-size: 13px;
  }
  a:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
  @media print {
    .cta-row, .next-title, .next-links, .app-footer { display: none !important; }
  }
  @media (max-width: 480px) {
    .result-header h2 { font-size: 21px; }
    .brand-logo { height: 24px; }
  }

  /* ---- Save fallback (browsers without print support) ---- */
  .save-modal {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    background: rgba(11,11,11,0.55);
  }
  .save-modal-panel {
    width: 100%;
    max-width: 560px;
    max-height: calc(100vh - 32px);
    overflow-y: auto;
    background: var(--surface-1);
    border: 1px solid var(--border);
    border-radius: 14px;
    box-shadow: var(--card-shadow);
    padding: 20px;
    color: var(--text-primary);
  }
  .save-modal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
  .save-modal-close {
    background: transparent;
    color: var(--text-secondary);
    font-size: 24px;
    line-height: 1;
    padding: 4px 10px;
  }
  .save-modal-note, .save-modal-hint { font-size: 14px; line-height: 1.5; color: var(--text-secondary); margin: 0 0 12px; }
  .save-modal-hint { font-size: 13px; color: var(--text-muted); margin: 12px 0 0; }
  .save-modal-img { display: block; margin-top: 16px; width: 100%; height: auto; border: 1px solid var(--border); border-radius: 8px; }
  .save-modal-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 14px; }
  .save-modal-actions:empty { display: none; }
  .save-modal-btn { text-align: center; }
  @media print {
    .save-modal { display: none !important; }
  }
