/* =====================================================================
   AnyTime ADHD & Autism — web edition styles
   Palette mirrors the Android app (pension-app CSS variables).
   ===================================================================== */
:root {
    --bg-color: #0f172a;
    --card-bg: rgba(30, 41, 59, 0.7);
    --card-border: rgba(148, 163, 184, 0.1);
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --accent-color: #3b82f6;
    --accent-hover: #2563eb;
    --success-color: #10b981;
    --warning-color: #f59e0b;
    --danger-color: #ef4444;
    --pill-bg: rgba(59, 130, 246, .12);
    --pill-text: #93c5fd;
    --pill-border: rgba(59, 130, 246, .35);
    --glow-color: #1e293b;
    --radius: 14px;
}

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

html { scroll-behavior: smooth; }

body {
    background: var(--bg-color);
    color: var(--text-primary);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
        "Helvetica Neue", Arial, sans-serif;
    font-size: 16px;
    line-height: 1.55;
    min-height: 100vh;
    overflow-x: hidden;
}

/* Radial background glow (matches app) */
.glow {
    position: fixed;
    inset: 0;
    background: radial-gradient(ellipse 80% 50% at 50% -10%,
        var(--glow-color) 0%, transparent 70%);
    pointer-events: none;
    z-index: 0;
}

/* ------------------------------------------------------------------ */
/* Top bar                                                             */
/* ------------------------------------------------------------------ */
.topbar {
    position: sticky;
    top: 0;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 14px 20px;
    background: rgba(15, 23, 42, 0.85);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--card-border);
}

.brand {
    display: flex;
    align-items: center;
    gap: 10px;
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-primary);
}
.brand-mark { font-size: 22px; }
.brand-name {
    font-weight: 700;
    font-size: 17px;
    background: linear-gradient(90deg, #60a5fa, #a78bfa);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.topnav { display: flex; gap: 4px; flex-wrap: wrap; }
.topnav button {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 14px;
    padding: 8px 12px;
    border-radius: 8px;
    cursor: pointer;
    transition: color .15s, background .15s;
}
.topnav button:hover { color: var(--text-primary); background: rgba(148,163,184,.08); }
.topnav button.active { color: var(--pill-text); background: var(--pill-bg); }

/* ------------------------------------------------------------------ */
/* Layout                                                              */
/* ------------------------------------------------------------------ */
.page-container {
    position: relative;
    z-index: 1;
    max-width: 760px;
    margin: 0 auto;
    padding: 24px 20px 64px;
}

.gradient-title {
    font-size: clamp(26px, 5vw, 36px);
    font-weight: 800;
    text-align: center;
    background: linear-gradient(90deg, #60a5fa, #a78bfa);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 8px;
}

.page-subtitle {
    text-align: center;
    color: var(--text-secondary);
    margin-bottom: 24px;
    font-size: 15px;
}

/* ------------------------------------------------------------------ */
/* Cards                                                               */
/* ------------------------------------------------------------------ */
.card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: var(--radius);
    padding: 20px;
    margin-bottom: 16px;
}

.card h3 {
    font-size: 16px;
    font-weight: 700;
    margin-bottom: 12px;
    color: var(--text-primary);
}

.card p { color: var(--text-secondary); font-size: 14.5px; margin-bottom: 10px; }
.card p:last-child { margin-bottom: 0; }
.card strong { color: var(--text-primary); }

.section-heading {
    font-size: 15px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 14px;
    letter-spacing: .02em;
}

/* ------------------------------------------------------------------ */
/* Test cards (home / tests page)                                      */
/* ------------------------------------------------------------------ */
.test-card {
    display: flex;
    align-items: center;
    gap: 14px;
    width: 100%;
    text-align: left;
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: var(--radius);
    padding: 16px 18px;
    margin-bottom: 12px;
    cursor: pointer;
    color: var(--text-primary);
    transition: border-color .15s, transform .15s, background .15s;
}
.test-card:hover {
    border-color: rgba(59, 130, 246, .45);
    background: rgba(30, 41, 59, .85);
    transform: translateY(-1px);
}

.test-card .emoji { font-size: 26px; flex-shrink: 0; }

.test-card .tc-body { flex: 1; min-width: 0; }
.test-card .tc-title { font-weight: 700; font-size: 15.5px; margin-bottom: 3px; }
.test-card .tc-sub { color: var(--text-secondary); font-size: 13px; }

.test-card .tc-badges { display: flex; flex-direction: column; gap: 6px; align-items: flex-end; flex-shrink: 0; }

.pill {
    display: inline-block;
    font-size: 12px;
    font-weight: 600;
    padding: 4px 10px;
    border-radius: 999px;
    background: var(--pill-bg);
    color: var(--pill-text);
    border: 1px solid var(--pill-border);
    white-space: nowrap;
}
.pill.completed { background: rgba(16,185,129,.12); color: #34d399; border-color: rgba(16,185,129,.35); }
.pill.in-progress { background: rgba(245,158,11,.12); color: #fbbf24; border-color: rgba(245,158,11,.35); }

/* ------------------------------------------------------------------ */
/* Buttons                                                             */
/* ------------------------------------------------------------------ */
.btn {
    display: inline-block;
    border: none;
    border-radius: 12px;
    background: var(--accent-color);
    color: #fff;
    font-size: 15px;
    font-weight: 600;
    padding: 14px 22px;
    cursor: pointer;
    transition: background .15s, transform .05s;
    text-decoration: none;
}
.btn:hover { background: var(--accent-hover); }
.btn:active { transform: scale(.98); }
.btn.block { display: block; width: 100%; text-align: center; }
.btn.small { font-size: 13.5px; padding: 10px 16px; }

.btn-row { display: flex; gap: 12px; margin-top: 12px; flex-wrap: wrap; }
.btn-row .btn { flex: 1; min-width: 140px; }

.btn-ghost {
    display: inline-block;
    background: none;
    border: 1px solid var(--card-border);
    border-radius: 12px;
    color: var(--text-secondary);
    font-size: 14px;
    padding: 12px 20px;
    cursor: pointer;
    transition: border-color .15s, color .15s;
}
.btn-ghost:hover { border-color: rgba(148,163,184,.4); color: var(--text-primary); }
.btn-ghost.block { display: block; width: 100%; text-align: center; }

/* ------------------------------------------------------------------ */
/* Quiz                                                                */
/* ------------------------------------------------------------------ */
.quiz-progress-label { color: var(--text-secondary); font-size: 13px; margin-bottom: 8px; }

.progress-track {
    height: 6px;
    background: var(--card-border);
    border-radius: 3px;
    overflow: hidden;
    margin-bottom: 26px;
}
.progress-fill {
    height: 100%;
    background: var(--accent-color);
    border-radius: 3px;
    transition: width .25s ease;
}

.question-card { animation: qfade .25s ease; }
@keyframes qfade {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}
.question-prefix { color: var(--text-secondary); font-size: 13px; margin-bottom: 8px; }
.question-text { font-size: 18px; line-height: 1.45; }

.option-btn {
    display: block;
    width: 100%;
    text-align: left;
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 12px;
    color: var(--text-primary);
    font-size: 15px;
    padding: 14px 18px;
    margin-bottom: 10px;
    cursor: pointer;
    transition: border-color .12s, background .12s;
}
.option-btn:hover { border-color: rgba(59,130,246,.5); }
.option-btn.selected {
    border-color: var(--accent-color);
    background: rgba(59, 130, 246, .14);
}

.quiz-nav { display: flex; gap: 12px; margin-top: 18px; }
.quiz-nav .btn-ghost { flex: 1; text-align: center; }

/* ------------------------------------------------------------------ */
/* Results                                                             */
/* ------------------------------------------------------------------ */
.result-head { text-align: center; font-size: 24px; font-weight: 800; margin: 8px 0 20px; }

.score-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: var(--radius);
    padding: 18px 20px;
    margin-bottom: 10px;
}
.score-card .sc-label { color: var(--text-secondary); font-size: 13px; margin-bottom: 4px; }
.score-card .sc-value { font-size: 26px; font-weight: 800; }

.badge {
    display: inline-block;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: .04em;
    padding: 5px 12px;
    border-radius: 999px;
    white-space: nowrap;
}
.badge.over { background: rgba(239,68,68,.14); color: #f87171; border: 1px solid rgba(239,68,68,.35); }
.badge.elevated { background: rgba(245,158,11,.14); color: #fbbf24; border: 1px solid rgba(245,158,11,.35); }
.badge.typical { background: rgba(16,185,129,.12); color: #34d399; border: 1px solid rgba(16,185,129,.35); }

.subscale-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 12px;
    padding: 12px 16px;
    margin-bottom: 8px;
}
.subscale-card .ss-name { color: var(--text-secondary); font-size: 13px; }
.subscale-card .ss-value { font-size: 18px; font-weight: 700; }

.report-text {
    white-space: pre-wrap;
    color: var(--text-primary);
    font-size: 14.5px;
    line-height: 1.6;
}

.not-diagnosis {
    color: var(--text-secondary);
    font-size: 12.5px;
    text-align: center;
    margin: 10px 0 18px;
}

.risk-card {
    background: rgba(239, 68, 68, .08);
    border: 1px solid rgba(239, 68, 68, .35);
    border-radius: var(--radius);
    padding: 20px;
    margin-bottom: 16px;
}
.risk-card h3 { color: var(--danger-color); margin-bottom: 10px; }
.risk-card p { color: var(--text-primary); font-size: 14px; }

/* ------------------------------------------------------------------ */
/* Snapshot                                                            */
/* ------------------------------------------------------------------ */
.snapshot-group { margin-bottom: 20px; }
.group-label {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-secondary);
    font-size: 13.5px;
    font-weight: 700;
    letter-spacing: .03em;
    margin-bottom: 10px;
}

.domain-row {
    border: 1px solid var(--card-border);
    border-radius: 12px;
    background: var(--card-bg);
    margin-bottom: 10px;
    overflow: hidden;
}
.domain-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 14px 16px;
    cursor: pointer;
}
.domain-head .dr-title { font-weight: 700; font-size: 14.5px; }
.domain-head .dr-intensity { color: var(--text-secondary); font-size: 13px; }
.domain-hint {
    text-align: right;
    color: var(--text-secondary);
    font-size: 11.5px;
    font-style: italic;
    padding: 0 16px 10px;
}
.domain-body { padding: 0 16px 14px; display: none; }
.domain-row.open .domain-body { display: block; }
.domain-row.open .domain-hint .hint-expand { display: none; }
.domain-row:not(.open) .hint-collapse { display: none; }

.finding {
    border-left: 3px solid var(--accent-color);
    padding: 12px 16px;
    margin-bottom: 12px;
    background: var(--card-bg);
    border-radius: 0 12px 12px 0;
}
.finding .f-title { font-weight: 700; margin-bottom: 6px; font-size: 14.5px; }
.finding .f-body { color: var(--text-secondary); font-size: 13.5px; }

.hint-list li { color: var(--text-secondary); font-size: 13.5px; margin-bottom: 8px; }

/* ------------------------------------------------------------------ */
/* Misc                                                                */
/* ------------------------------------------------------------------ */
.empty-state {
    text-align: center;
    color: var(--text-secondary);
    padding: 40px 20px;
    font-size: 14.5px;
}

.muted { color: var(--text-secondary); }
.small { font-size: 13px; }

pre.export-box {
    background: rgba(15, 23, 42, .8);
    border: 1px solid var(--card-border);
    border-radius: 12px;
    padding: 16px;
    font-size: 12.5px;
    line-height: 1.5;
    white-space: pre-wrap;
    word-break: break-word;
    max-height: 400px;
    overflow-y: auto;
    color: var(--text-primary);
    font-family: ui-monospace, "Cascadia Mono", Consolas, monospace;
}

.toast {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    background: var(--accent-color);
    color: #fff;
    font-size: 14px;
    font-weight: 600;
    padding: 12px 22px;
    border-radius: 999px;
    opacity: 0;
    pointer-events: none;
    transition: opacity .25s, transform .25s;
    z-index: 200;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

.footer-note {
    color: var(--text-secondary);
    font-size: 12.5px;
    text-align: center;
    margin-top: 20px;
}

/* Mobile */
@media (max-width: 640px) {
    .topnav { gap: 0; }
    .topnav button { padding: 8px 8px; font-size: 13px; }
    .brand-name { display: none; }
    .page-container { padding: 18px 14px 56px; }
    .card { padding: 16px; }
    .score-card .sc-value { font-size: 22px; }
}

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