:root {
    --bg-canvas: #eef2f7;
    --bg-surface: #ffffff;
    --bg-surface-muted: #f5f8fc;
    --border-subtle: #d0d9e4;
    --border-default: #a8b6c6;
    --text-primary: #1a2332;
    --text-secondary: #4a5568;
    --text-muted: #64748b;
    --accent-blue: #3b82c4;
    --accent-blue-soft: #e8f1fa;
    --accent-blue-deep: #2563a8;
    --accent-link: #2b6cb0;
    --accent-link-hover: #1a4f8a;
    --accent-emergency: #c53030;
    --accent-emergency-hover: #9b2c2c;
    --accent-success: #2f855a;
    --accent-warning-bg: #fffaf0;
    --accent-warning-border: #ed8936;
    --accent-danger-bg: #fef5f5;
    --accent-danger-border: #c53030;
    --accent-prevented-bg: #f0fff4;
    --accent-prevented-border: #2f855a;
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --shadow-soft: 0 1px 3px rgba(26, 35, 50, 0.06), 0 1px 2px rgba(26, 35, 50, 0.04);
    --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --max-width: 760px;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    scroll-behavior: smooth;
}

body {
    background: var(--bg-canvas);
    color: var(--text-primary);
    font-family: var(--font-sans);
    font-size: 1rem;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

a {
    color: var(--accent-link);
}

a:hover {
    color: var(--accent-link-hover);
}

/* Header */
.site-header {
    background: var(--bg-surface);
    border-bottom: 1px solid var(--border-subtle);
    box-shadow: var(--shadow-soft);
}

.header-container {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 16px 20px;
}

.site-title {
    font-size: 1.25rem;
    font-weight: 700;
    line-height: 1.3;
    color: var(--accent-blue-deep);
}

/* Main */
.main-content {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 24px 20px 48px;
    display: flex;
    flex-direction: column;
    gap: 32px;
}

/* Hero */
.circuit-breaker {
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-left: 4px solid var(--accent-blue);
    border-radius: var(--radius-lg);
    padding: 24px;
    box-shadow: var(--shadow-soft);
}

.hero-headline {
    font-size: 1.75rem;
    font-weight: 700;
    line-height: 1.25;
    margin-bottom: 8px;
}

.hero-strap {
    color: var(--text-secondary);
    margin-bottom: 20px;
}

.emergency-cta-row {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 16px;
}

.btn-emergency-call {
    flex: 2;
    min-width: 220px;
    background: var(--accent-emergency);
    color: #fff;
    text-decoration: none;
    padding: 14px 18px;
    display: flex;
    flex-direction: column;
    gap: 2px;
    font-weight: 700;
    border: 2px solid transparent;
    border-radius: var(--radius-md);
}

.btn-emergency-call:hover {
    background: var(--accent-emergency-hover);
    color: #fff;
}

.btn-emergency-call small {
    font-size: 0.8125rem;
    font-weight: 400;
    opacity: 0.95;
}

.btn-scroll-triage {
    flex: 1;
    min-width: 140px;
    background: var(--accent-blue-soft);
    color: var(--accent-blue-deep);
    text-decoration: none;
    border: 2px solid var(--accent-blue);
    border-radius: var(--radius-md);
    padding: 14px 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
}

.btn-scroll-triage:hover {
    background: #d6e8f7;
    color: var(--accent-blue-deep);
}

.quick-facts {
    border-top: 1px solid var(--border-subtle);
    padding-top: 12px;
    margin-top: 4px;
}

.quick-facts summary {
    cursor: pointer;
    color: var(--accent-link);
    font-weight: 600;
    font-size: 0.9375rem;
}

.quick-facts ul {
    margin: 12px 0 0 20px;
    color: var(--text-secondary);
    font-size: 0.9375rem;
}

.quick-facts li {
    margin-bottom: 8px;
}

.harm-link-wrap {
    margin-top: 16px;
    padding-top: 12px;
    border-top: 1px solid var(--border-subtle);
}

.btn-jump-harm {
    background: none;
    border: none;
    color: var(--text-secondary);
    font: inherit;
    font-size: 0.875rem;
    cursor: pointer;
    text-align: left;
    padding: 0;
}

.btn-jump-harm strong {
    color: var(--accent-emergency);
    font-weight: 700;
}

.btn-jump-harm:hover strong {
    text-decoration: underline;
}

/* Triage */
.section-title h2 {
    font-size: 1.375rem;
    font-weight: 700;
    margin-bottom: 4px;
}

.section-title p {
    color: var(--text-secondary);
    font-size: 0.9375rem;
}

.stepper-progress {
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: 14px 16px;
    margin: 16px 0;
    box-shadow: var(--shadow-soft);
}

.progress-track {
    height: 6px;
    background: #dce4ee;
    border-radius: 999px;
    margin-bottom: 8px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    width: 25%;
    background: var(--accent-blue);
    border-radius: 999px;
    transition: width 0.25s ease;
}

.step-counter {
    font-size: 0.875rem;
    color: var(--text-muted);
    font-weight: 600;
}

.triage-container {
    min-height: 200px;
}

.step-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    padding: 20px;
    box-shadow: var(--shadow-soft);
}

.triage-step {
    display: none;
}

.triage-step.is-active {
    display: block;
    animation: stepEnter 0.2s ease forwards;
}

@keyframes stepEnter {
    from { opacity: 0; transform: translateY(6px); }
    to { opacity: 1; transform: translateY(0); }
}

.step-header h3 {
    font-size: 1.125rem;
    font-weight: 700;
    margin-bottom: 16px;
}

.options-grid {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.opt-btn {
    background: var(--bg-surface);
    border: 2px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: 14px 16px;
    text-align: left;
    cursor: pointer;
    font: inherit;
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    width: 100%;
    transition: border-color 0.15s ease, background 0.15s ease;
}

.opt-btn:hover {
    border-color: var(--accent-blue);
    background: var(--accent-blue-soft);
}

.opt-btn.active {
    border-color: var(--accent-blue);
    background: var(--accent-blue-soft);
    box-shadow: inset 0 0 0 1px var(--accent-blue);
}

.opt-btn-safe.active {
    border-color: var(--accent-success);
    background: var(--accent-prevented-bg);
    box-shadow: inset 0 0 0 1px var(--accent-success);
}

.opt-btn-emergency.active {
    border-color: var(--accent-emergency);
    background: var(--accent-danger-bg);
    box-shadow: inset 0 0 0 1px var(--accent-emergency);
}

.step-footer {
    margin-top: 16px;
    padding-top: 12px;
    border-top: 1px solid var(--border-subtle);
}

.btn-step-back {
    background: none;
    border: none;
    color: var(--accent-link);
    font: inherit;
    font-size: 0.9375rem;
    font-weight: 600;
    cursor: pointer;
    text-decoration: underline;
    padding: 0;
}

/* Results */
.results-section {
    animation: fadeIn 0.25s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

.results-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-soft);
}

.verdict-banner {
    padding: 20px;
    border-bottom: 1px solid var(--border-subtle);
}

.verdict-banner.danger,
.verdict-banner.critical-harm {
    background: var(--accent-danger-bg);
    border-bottom-color: var(--accent-danger-border);
}

.verdict-banner.prevented {
    background: var(--accent-prevented-bg);
    border-bottom-color: var(--accent-prevented-border);
}

.verdict-badge {
    display: inline-block;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-muted);
    margin-bottom: 6px;
}

.verdict-banner h2 {
    font-size: 1.375rem;
    font-weight: 700;
    line-height: 1.3;
    margin-bottom: 6px;
}

.verdict-banner p {
    color: var(--text-secondary);
    font-size: 0.9375rem;
}

.triage-summary-strip {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid rgba(0, 0, 0, 0.08);
}

.summary-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.summary-tag {
    background: var(--bg-surface-muted);
    border: 1px solid var(--border-subtle);
    border-radius: 999px;
    padding: 2px 10px;
    font-size: 0.8125rem;
    color: var(--text-secondary);
}

.btn-edit-answers {
    background: none;
    border: none;
    color: var(--accent-link);
    font: inherit;
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    text-decoration: underline;
    margin-left: auto;
}

.action-plan-wrapper {
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.action-plan-wrapper > h3 {
    font-size: 1.125rem;
    font-weight: 700;
}

.plan-intro {
    color: var(--text-secondary);
    font-size: 0.9375rem;
    margin-top: -8px;
}

.action-checklist {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 10px;
    border: 1px solid var(--border-subtle);
    border-left: 4px solid var(--accent-emergency);
    border-radius: var(--radius-md);
    background: var(--bg-surface-muted);
    padding: 16px;
}

.action-checklist .phase-divider {
    list-style: none;
    display: block;
    margin: 6px 0 2px;
    padding: 0;
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--text-muted);
    border: none;
    background: transparent;
}

.action-checklist .phase-divider:first-child {
    margin-top: 0;
}

.checklist {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.checklist li {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    gap: 10px;
    font-size: 0.9375rem;
    line-height: 1.45;
}

.checklist input[type="checkbox"] {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
    margin-top: 2px;
    accent-color: var(--accent-blue);
}

.checklist label {
    flex: 1;
    min-width: 200px;
}

.checklist a {
    color: var(--accent-link);
}

.checklist code {
    background: #e8eef5;
    padding: 1px 6px;
    border-radius: var(--radius-sm);
    font-size: 0.875em;
}

.chip-container {
    width: 100%;
    margin-left: 30px;
}

.btn-chip-action {
    display: inline-block;
    padding: 6px 12px;
    font-size: 0.8125rem;
    font-weight: 700;
    text-decoration: none;
    margin-top: 4px;
    margin-right: 6px;
    border: 2px solid transparent;
    border-radius: var(--radius-sm);
}

.btn-chip-action.call-chip {
    background: var(--accent-emergency);
    color: #fff;
}

.btn-chip-action.call-chip:hover {
    background: var(--accent-emergency-hover);
    color: #fff;
}

.btn-chip-action.sms-chip,
.btn-chip-action.email-chip {
    background: var(--accent-blue-deep);
    color: #fff;
}

.btn-chip-action.sms-chip:hover,
.btn-chip-action.email-chip:hover {
    background: #1a4f8a;
    color: #fff;
}

.statement-details-accordion {
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: 14px 16px;
    background: var(--bg-surface-muted);
}

.statement-details-accordion summary {
    cursor: pointer;
    font-weight: 700;
    color: var(--accent-link);
}

.statement-inputs-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 200px), 1fr));
    gap: 12px;
    margin: 14px 0;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.form-group label {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-secondary);
}

.form-group input {
    border: 2px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    padding: 8px 10px;
    font: inherit;
    font-size: 16px;
}

.form-group input:focus {
    outline: 3px solid rgba(59, 130, 196, 0.35);
    outline-offset: 0;
    border-color: var(--accent-blue);
}

.statement-preview-wrap {
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    padding: 12px;
    max-height: 200px;
    overflow: auto;
    margin-bottom: 12px;
}

.statement-text {
    font-family: ui-monospace, "Cascadia Code", "Source Code Pro", Menlo, Consolas, monospace;
    font-size: 0.75rem;
    line-height: 1.5;
    white-space: pre-wrap;
    word-break: break-word;
}

.statement-button-row,
.action-footer {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.scotland-note {
    margin: 12px 0 0;
    font-size: 0.875rem;
    line-height: 1.45;
    color: var(--text-secondary);
}

.scotland-note a {
    color: var(--accent-link);
}

.btn-copy-statement,
.btn-copy-plan {
    background: var(--accent-blue);
    color: #fff;
    border: 2px solid transparent;
    border-radius: var(--radius-md);
    padding: 12px 16px;
    font: inherit;
    font-size: 0.9375rem;
    font-weight: 700;
    cursor: pointer;
}

.btn-copy-statement:hover,
.btn-copy-plan:hover {
    background: var(--accent-blue-deep);
}

.btn-ext-actionfraud,
.btn-reset-triage {
    background: var(--bg-surface);
    color: var(--text-primary);
    border: 2px solid var(--border-default);
    border-radius: var(--radius-md);
    padding: 12px 16px;
    font: inherit;
    font-size: 0.9375rem;
    font-weight: 700;
    text-decoration: none;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
}

.btn-ext-actionfraud:hover,
.btn-reset-triage:hover {
    background: var(--bg-surface-muted);
    border-color: var(--accent-blue);
}

/* Footer */
.site-footer {
    border-top: 1px solid var(--border-subtle);
    background: var(--bg-surface);
    padding: 20px;
    text-align: center;
    font-size: 0.8125rem;
    color: var(--text-muted);
}

.site-footer p {
    margin-bottom: 8px;
}

.site-footer a {
    color: var(--accent-link);
    font-weight: 600;
}

.footer-nav {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px 16px;
}

/* Disclaimer page */
.disclaimer-page .site-title a {
    color: inherit;
    text-decoration: none;
}

.disclaimer-page .site-title a:hover {
    color: var(--accent-link);
}

.disclaimer-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    padding: 24px;
    box-shadow: var(--shadow-soft);
}

.disclaimer-card h2 {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 16px;
    color: var(--accent-blue-deep);
}

.disclaimer-card h3 {
    font-size: 1.0625rem;
    font-weight: 700;
    margin: 20px 0 8px;
}

.disclaimer-card p,
.disclaimer-card li {
    color: var(--text-secondary);
    font-size: 0.9375rem;
    line-height: 1.55;
}

.disclaimer-card p {
    margin-bottom: 12px;
}

.disclaimer-card ul {
    margin: 0 0 12px 20px;
}

.disclaimer-card li {
    margin-bottom: 6px;
}

.disclaimer-back {
    display: inline-block;
    margin-top: 8px;
    font-weight: 600;
}

/* Offline banner */
.offline-banner {
    background: var(--accent-blue);
    color: #fff;
    padding: 10px 20px;
    font-size: 0.875rem;
}

.offline-banner-container {
    max-width: var(--max-width);
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
}

.btn-dismiss-offline {
    background: transparent;
    border: 2px solid #fff;
    border-radius: var(--radius-sm);
    color: #fff;
    padding: 4px 10px;
    font: inherit;
    font-size: 0.8125rem;
    font-weight: 600;
    cursor: pointer;
    flex-shrink: 0;
}

.btn-dismiss-offline:hover {
    background: rgba(255, 255, 255, 0.15);
}

@media (max-width: 640px) {
    .hero-headline {
        font-size: 1.5rem;
    }

    .emergency-cta-row {
        flex-direction: column;
    }

    .btn-emergency-call,
    .btn-scroll-triage {
        width: 100%;
    }

    .statement-button-row,
    .action-footer {
        flex-direction: column;
    }

    .btn-copy-statement,
    .btn-ext-actionfraud,
    .btn-copy-plan,
    .btn-reset-triage {
        width: 100%;
        justify-content: center;
    }
}
