:root {
    --blue: #173e60;
    --muted: #617588;
    --yellow: #f5c85e;
    --line: #e2e9ee;
}

* {
    box-sizing: border-box;
}

[hidden] {
    display: none !important;
}

body {
    margin: 0;
    background: #f7fafc;
    color: var(--blue);
    font-family: Tahoma, Arial, sans-serif;
    line-height: 1.9;
}

.header {
    max-width: 1050px;
    margin: auto;
    padding: 25px 24px;
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    color: inherit;
    text-decoration: none;
    font-weight: bold;
}

.brand small {
    display: block;
    font-size: 11px;
    color: var(--muted);
    font-weight: normal;
}

.sun {
    font-size: 32px;
    color: #d99c1c;
}

.container {
    max-width: 1000px;
    margin: auto;
    padding: 0 24px;
}

.hero {
    text-align: center;
    padding: 50px 0 35px;
    max-width: 650px;
    margin: auto;
}

.badge {
    display: inline-block;
    background: #fff4d5;
    color: #795c1b;
    padding: 5px 14px;
    border-radius: 25px;
    font-size: 12px;
}

h1 {
    font-size: clamp(28px, 5vw, 44px);
    line-height: 1.65;
    letter-spacing: -1px;
    margin: 20px 0;
}

h2 {
    font-size: 17px;
    margin: 12px 0 6px;
}

p {
    margin: 0;
}

.intro {
    font-size: 17px;
    color: var(--muted);
    max-width: 560px;
    margin: 0 auto 25px;
}

.button {
    display: inline-flex;
    justify-content: center;
    align-items: center;
    gap: 32px;
    min-height: 56px;
    padding: 10px 35px;
    border-radius: 16px;
    background: var(--blue);
    color: white;
    text-decoration: none;
    font-weight: bold;
    font-size: 17px;
    box-shadow: 0 8px 22px #173e6018;
}

.button:hover {
    background: #24587d;
}

.button:focus-visible,
.brand:focus-visible,
.secondary:focus-visible,
input:focus-visible,
summary:focus-visible {
    outline: 3px solid #dba92d;
    outline-offset: 5px;
}

button {
    font-family: inherit;
    cursor: pointer;
    border: 0;
}

.hint {
    font-size: 12px;
    color: var(--muted);
    margin-top: 12px;
}

.features {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    margin: 25px 0;
}

.features article,
.card {
    background: white;
    border: 1px solid var(--line);
    border-radius: 22px;
    padding: 25px;
}

.number {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 35px;
    height: 35px;
    background: #edf4f8;
    border-radius: 12px;
    font-size: 16px;
}

.features p {
    font-size: 14px;
    color: var(--muted);
}

.note {
    font-size: 13px;
    color: var(--muted);
    border-right: 3px solid var(--yellow);
    padding: 10px 16px;
    margin: 30px 0;
}

.card {
    text-align: center;
    max-width: 700px;
    margin: 45px auto;
}

.card h1 {
    font-size: 26px;
}

footer {
    text-align: center;
    font-size: 11px;
    color: var(--muted);
    padding: 25px 20px;
}

/* پرسشنامه */

.question-wrap {
    max-width: 650px;
    margin: 25px auto 55px;
}

.back-link {
    color: var(--muted);
    font-size: 13px;
}

.wizard-progress {
    margin: 24px 0 35px;
    font-size: 13px;
    color: var(--muted);
}

progress {
    width: 100%;
    height: 8px;
    accent-color: var(--blue);
}

.question-card {
    min-width: 0;
    border: 1px solid var(--line);
    background: white;
    border-radius: 22px;
    padding: 25px;
    margin: 28px 0;
}

.question-card legend {
    font-size: 21px;
    font-weight: bold;
    background: #f7fafc;
    padding: 0 8px;
    max-width: 100%;
}

.question-hint {
    color: var(--muted);
    font-size: 14px;
    margin-bottom: 20px;
}

.choices {
    display: grid;
    gap: 12px;
}

.choice {
    display: flex;
    align-items: center;
    gap: 14px;
    border: 1px solid var(--line);
    border-radius: 14px;
    padding: 15px;
    cursor: pointer;
    min-height: 58px;
}

.choice:has(input:checked) {
    background: #eaf3fa;
    border-color: var(--blue);
}

.choice input {
    width: 21px;
    height: 21px;
    accent-color: var(--blue);
    flex-shrink: 0;
}

.choice:focus-within {
    outline: 2px solid var(--yellow);
}

#age {
    display: block;
    width: 100%;
    padding: 15px;
    font: inherit;
    font-size: 25px;
    border: 1px solid #a6b9c9;
    border-radius: 14px;
    margin: 10px 0;
}

.wizard-actions,
.result-actions {
    display: flex;
    gap: 12px;
}

.wizard-actions .button {
    flex: 1;
}

.secondary {
    border: 1px solid var(--line);
    background: white;
    border-radius: 14px;
    padding: 12px 24px;
    font-size: 15px;
    color: var(--blue);
    min-height: 56px;
}

.step-error,
.errors {
    color: #9d3632;
}

.errors {
    background: #fff0ee;
    padding: 18px;
    border-radius: 16px;
}

/* نتیجه */

.results-heading {
    text-align: center;
    margin: 30px auto;
}

.results-heading h1 {
    font-size: 32px;
}

.result-list {
    max-width: 700px;
    margin: auto;
    display: grid;
    gap: 16px;
}

.result-card {
    background: white;
    border: 1px solid var(--line);
    border-right: 5px solid #a6b9c9;
    border-radius: 20px;
    padding: 24px;
}

.result-card h2 {
    font-size: 22px;
    margin-top: 0;
}

.status-label {
    display: block;
    margin: 8px 0 12px;
    font-size: 14px;
}

.routine {
    border-right-color: #267c6b;
}

.routine .status-label {
    color: #267c6b;
}

.referral {
    border-right-color: #c66b32;
}

.referral .status-label {
    color: #a14f21;
}

.uncertain {
    border-right-color: #d2ae45;
}

.plan {
    font-weight: bold;
    padding-right: 23px;
}

details {
    font-size: 13px;
    color: var(--muted);
    margin-top: 15px;
}

summary {
    cursor: pointer;
}

.result-note {
    background: #fff5db;
    padding: 12px;
    border-radius: 10px;
    font-size: 14px;
    margin-top: 15px;
}

.result-actions {
    max-width: 700px;
    margin: 20px auto;
}

.result-actions + .hint {
    text-align: center;
}

/* موبایل */

@media (max-width: 600px) {
    .header {
        padding: 18px 20px;
    }

    .container {
        padding: 0 20px;
    }

    .hero {
        padding: 25px 0 20px;
    }

    .features {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .features article {
        padding: 18px;
    }

    .button {
        width: 100%;
    }

    .intro {
        font-size: 16px;
    }

    h1 {
        letter-spacing: 0;
    }

    .card {
        padding: 22px 18px;
        margin: 25px auto;
    }

    .question-card {
        padding: 20px 16px;
    }

    .question-card legend {
        font-size: 19px;
    }

    .result-actions {
        flex-direction: column;
    }
}

@media (prefers-reduced-motion: no-preference) {
    .button {
        transition: background 0.15s;
    }
}

/* چاپ و ذخیره PDF در اندازه A5 */

@page {
    size: A5 portrait;
    margin: 8mm;
}

@media print {
    .header,
    footer,
    .result-actions,
    .back-link {
        display: none !important;
    }

    body {
        background: white;
        color: #173e60;
        font-size: 9pt;
        line-height: 1.45;
    }

    .container {
        width: 100%;
        max-width: none;
        padding: 0;
        margin: 0;
    }

    .results-heading {
        margin: 0 0 4mm;
    }

    .results-heading .badge {
        background: none;
        padding: 0;
        font-size: 9pt;
    }

    .results-heading h1 {
        font-size: 17pt;
        line-height: 1.5;
        margin: 1mm 0;
    }

    .results-heading .intro {
        font-size: 9pt;
        margin: 0;
    }

    .result-list {
        max-width: none;
        display: block;
    }

    .result-card {
        padding: 2.5mm 3mm;
        margin-bottom: 2mm;
        border: 1px solid #ccd6df;
        border-right-width: 3px;
        border-radius: 3mm;
        break-inside: avoid;
        page-break-inside: avoid;
    }

    .result-card h2 {
        font-size: 11pt;
        margin: 0 0 1mm;
    }

    .status-label {
        font-size: 9pt;
        margin: 0 0 1mm;
    }

    .plan {
        margin: 1mm 0 0;
        padding-right: 5mm;
    }

    .result-note {
        background: none;
        padding: 1mm 0 0;
        margin-top: 1mm;
        font-size: 9pt;
    }

    details {
        display: none;
    }

    .note {
        font-size: 8pt;
        line-height: 1.4;
        margin: 2mm 0;
        padding: 1mm 2mm;
    }

    .result-actions + .hint {
        font-size: 7pt;
        margin: 1mm 0 0;
    }
}

.admin-input {
    display: block;
    width: 100%;
    padding: 12px 14px;
    margin: 8px 0 20px;
    border: 1px solid #a6b9c9;
    border-radius: 12px;
    background: white;
    color: var(--blue);
    font: inherit;
}

textarea.admin-input {
    resize: vertical;
    min-height: 110px;
}

.admin-age-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.admin-rule-section {
    margin-top: 25px;
    padding-top: 20px;
    border-top: 1px solid var(--line);
}

.admin-rule-section h2 {
    margin-top: 0;
}