:root {
    --ink: #17323a;
    --ink-soft: #46666a;
    --teal: #0b4f59;
    --teal-deep: #073b42;
    --mint: #e7f1ee;
    --mint-strong: #c9dfd9;
    --paper: #fbfcf8;
    --white: #ffffff;
    --yellow: #f4c95d;
    --danger: #a82d32;
    --danger-soft: #fff1f0;
    --line: #c7d8d3;
    --shadow: 0 18px 44px rgba(7, 59, 66, 0.12);
    --radius: 14px;
    --font-ui: Aptos, "Segoe UI Variable", "Segoe UI", sans-serif;
    --font-display: "Lexend", Aptos, "Segoe UI", sans-serif;
}

html {
    scroll-behavior: smooth;
    scroll-padding-top: 6rem;
}

body {
    margin: 0;
    color: var(--ink);
    background: var(--paper);
    font-family: var(--font-ui);
    font-size: 1rem;
    line-height: 1.6;
}

button,
input,
select {
    font: inherit;
}

.skip-link {
    position: fixed;
    z-index: 1000;
    top: 0.75rem;
    left: 0.75rem;
    padding: 0.7rem 1rem;
    color: var(--white);
    background: var(--teal-deep);
    transform: translateY(-150%);
}

.skip-link:focus {
    transform: translateY(0);
}

.site-header {
    position: relative;
    z-index: 20;
    color: var(--white);
    background: var(--teal);
}

.header-inner {
    min-height: 62px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 0.7rem;
    color: var(--white);
    font-weight: 750;
    letter-spacing: -0.02em;
    text-decoration: none;
}

.alkem-logo-frame {
    width: 2.75rem;
    height: 2.75rem;
    display: grid;
    place-items: center;
    flex: 0 0 auto;
    overflow: hidden;
    border-radius: 10px;
    background: var(--white);
}

.alkem-logo-frame img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.brand-product {
    font-size: 1rem;
}

.brand-note {
    color: #d5e9e5;
    font-size: 0.9rem;
}

.intro {
    padding: clamp(1.75rem, 3vw, 2.5rem) 0;
    color: var(--white);
    background: var(--teal);
}

.intro h1 {
    max-width: none;
    margin: 0 0 0.65rem;
    font-size: clamp(1.85rem, 3vw, 2.45rem);
    font-family: var(--font-display);
    font-weight: 780;
    letter-spacing: -0.04em;
    line-height: 1.02;
}

.intro-copy {
    max-width: 62ch;
    margin: 0;
    color: #d9ebe7;
    font-size: 1rem;
}

.privacy-note {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 0.85rem 0;
    border-top: 1px solid #6d9ba0;
    border-bottom: 1px solid #6d9ba0;
}

.privacy-note svg {
    width: 21px;
    flex: 0 0 21px;
    fill: none;
    stroke: var(--yellow);
    stroke-linejoin: round;
    stroke-width: 1.8;
}

.privacy-note p {
    margin: 0;
    color: #d9ebe7;
    line-height: 1.45;
}

.privacy-note strong {
    color: var(--white);
}

.assessment-layout {
    display: grid;
    grid-template-columns: minmax(190px, 0.28fr) minmax(0, 1fr);
    gap: clamp(2.5rem, 5vw, 5rem);
    padding-top: clamp(2.5rem, 4vw, 4rem);
    padding-bottom: clamp(3rem, 5vw, 5rem);
}

.progress-rail {
    position: sticky;
    top: 2rem;
    align-self: start;
}

.progress-copy {
    display: flex;
    flex-direction: column;
    margin-bottom: 0.8rem;
}

.progress-copy strong {
    font-size: 1.2rem;
    letter-spacing: -0.02em;
}

.progress-copy span,
.rail-note {
    color: var(--ink-soft);
    font-size: 0.92rem;
}

.progress-track {
    width: 100%;
    height: 8px;
    overflow: hidden;
    margin-bottom: 2rem;
    background: var(--mint-strong);
    border-radius: 999px;
}

.progress-track span {
    width: 100%;
    height: 100%;
    display: block;
    background: var(--teal);
    border-radius: inherit;
    transform: scaleX(0);
    transform-origin: left center;
    transition: transform 420ms cubic-bezier(0.16, 1, 0.3, 1);
}

.section-list {
    display: grid;
    gap: 0.4rem;
    margin: 0 0 1.6rem;
    padding: 0;
    list-style: none;
}

.section-list a {
    display: block;
    padding: 0.48rem 0;
    color: var(--ink);
    font-weight: 650;
    text-decoration-color: transparent;
    text-underline-offset: 0.2em;
}

.section-list a:hover,
.section-list a:focus-visible {
    color: var(--teal);
    text-decoration-color: currentColor;
}

.rail-note {
    max-width: 24ch;
    margin: 0;
}

.assessment-form {
    min-width: 0;
}

.form-alert {
    margin-bottom: 1.5rem;
    padding: 0.8rem 1rem;
    color: #772126;
    background: var(--danger-soft);
    border: 1px solid #e3a7a5;
    border-radius: var(--radius);
    font-weight: 650;
}

.form-section {
    padding: 0 0 clamp(2.25rem, 3.5vw, 3rem);
}

.section-heading {
    display: grid;
    grid-template-columns: 3rem minmax(0, 1fr);
    gap: 1.1rem;
    align-items: start;
    margin-bottom: 1.4rem;
}

.question-number {
    display: grid;
    place-items: center;
    border-radius: 50%;
    font-weight: 750;
}

.section-heading h2,
.submit-section h2,
.result-heading h2 {
    margin: 0 0 0.45rem;
    font-size: clamp(1.4rem, 2.4vw, 1.8rem);
    font-family: var(--font-display);
    font-weight: 760;
    letter-spacing: -0.035em;
    line-height: 1.08;
}

.section-heading.section-heading-plain {
    grid-template-columns: minmax(0, 1fr);
}

.section-heading p,
.submit-section p {
    max-width: 65ch;
    margin: 0;
    color: var(--ink-soft);
}

.form-label {
    margin-bottom: 0.45rem;
    color: var(--ink);
    font-weight: 700;
}

.required-marker {
    margin-inline-start: 0.12rem;
    color: var(--danger);
    font-weight: 800;
}

.form-control,
.form-select,
.input-group-text {
    min-height: 46px;
    border-color: #9ebbb5;
    border-radius: 10px;
}

.form-control,
.form-select {
    color: var(--ink);
    background-color: var(--white);
    font-size: 1rem;
    line-height: 1.35;
}

.form-control:focus,
.form-select:focus {
    border-color: var(--teal);
    box-shadow: 0 0 0 4px rgba(11, 79, 89, 0.16);
}

.input-group > .form-control {
    border-radius: 10px 0 0 10px;
}

.input-group-text {
    color: var(--ink);
    background: var(--mint);
    border-radius: 0 10px 10px 0;
    font-weight: 700;
}

.form-text {
    color: var(--ink-soft);
}

.field-hint {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.35rem 0.55rem;
    margin-top: 0.45rem;
    font-size: 0.88rem;
    line-height: 1.35;
}

.range-label {
    padding: 0.12rem 0.42rem;
    color: var(--teal-deep);
    background: var(--mint);
    border-radius: 10px;
    font-size: 0.75rem;
    font-weight: 750;
}

.invalid-feedback {
    margin-top: 0.5rem;
    color: var(--danger);
    font-size: 0.88rem;
    font-weight: 650;
    line-height: 1.4;
}

.invalid-feedback.is-visible {
    display: block;
}

.binary-list,
.symptom-list {
    border-top: 1px solid var(--line);
}

.binary-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 1rem 2rem;
    align-items: center;
    margin: 0;
    padding: 1rem 0;
    border: 0;
    border-bottom: 1px solid var(--line);
}

.binary-row legend {
    float: none;
    width: auto;
    display: grid;
    grid-template-columns: 2.35rem minmax(0, 1fr);
    gap: 0.9rem;
    align-items: center;
    margin: 0;
    padding-top: 0.55rem;
    font-size: 1.04rem;
    font-weight: 680;
}

.binary-options {
    display: grid;
    grid-template-columns: repeat(2, minmax(72px, 1fr));
    gap: 0.55rem;
}

.binary-choice {
    min-width: 0;
}

.choice-button,
.frequency-button {
    cursor: pointer;
    user-select: none;
}

.choice-button {
    width: 100%;
    min-height: 46px;
    display: grid;
    place-items: center;
    padding: 0.55rem 1.15rem;
    color: var(--ink);
    background: var(--white);
    border: 1px solid #9ebbb5;
    border-radius: 10px;
    font-weight: 700;
}

.btn-check:focus-visible + .choice-button,
.btn-check:focus-visible + .frequency-button {
    outline: 3px solid var(--yellow);
    outline-offset: 3px;
}

.btn-check:checked + .choice-button {
    color: var(--white);
    background: var(--teal);
    border-color: var(--teal);
}

.group-error {
    display: none;
    grid-column: 1 / -1;
    margin: 0.15rem 0 0;
    color: var(--danger);
    font-size: 0.9rem;
    font-weight: 650;
}

.has-error .group-error {
    display: block;
}

.has-error {
    background: var(--danger-soft);
}

.frequency-key {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 0.55rem;
    margin: 0 0 0.65rem 3.3rem;
    color: var(--ink-soft);
    font-size: 0.78rem;
    font-weight: 700;
    text-align: center;
}

.symptom-row {
    margin: 0;
    padding: 1.2rem 0 1.4rem;
    border: 0;
    border-bottom: 1px solid var(--line);
    transition: background-color 260ms ease-out;
}

.symptom-row legend {
    float: none;
    width: 100%;
    display: grid;
    grid-template-columns: 2.35rem minmax(0, 1fr);
    gap: 0.9rem;
    align-items: center;
    margin: 0 0 0.8rem;
    padding-top: 0.55rem;
    font-size: 1rem;
    font-weight: 690;
    line-height: 1.45;
}

.question-number {
    width: 2.35rem;
    height: 2.35rem;
    color: var(--teal-deep);
    background: var(--mint);
    box-shadow: inset 0 0 0 1px var(--mint-strong);
    font-size: 0.92rem;
}

.frequency-options {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 0.55rem;
    margin-left: 3.3rem;
}

.frequency-button {
    min-height: 54px;
    display: grid;
    place-items: center;
    gap: 0.18rem;
    padding: 0.45rem;
    color: var(--ink);
    background: var(--white);
    border: 1px solid #9ebbb5;
    border-radius: 12px;
    font-size: 0.78rem;
    font-weight: 680;
    line-height: 1.2;
    text-align: center;
}

.frequency-dot {
    width: 24px;
    height: 24px;
    display: grid;
    place-items: center;
    color: var(--teal);
    background: var(--mint);
    border-radius: 50%;
    font-size: 0.76rem;
    font-weight: 800;
}

.numbered-label {
    display: grid;
    grid-template-columns: 2.35rem minmax(0, 1fr);
    gap: 0.75rem;
    align-items: center;
}

.btn-check:checked + .frequency-button {
    color: var(--white);
    background: var(--teal);
    border-color: var(--teal);
    box-shadow: 0 8px 18px rgba(7, 59, 66, 0.16);
}

.btn-check:checked + .frequency-button .frequency-dot {
    color: var(--teal-deep);
    background: var(--yellow);
}

.submit-section {
    display: flex;
    justify-content: space-between;
    gap: 1.5rem;
    align-items: center;
    padding: clamp(1.4rem, 3vw, 2rem);
    color: var(--ink);
    background: var(--mint);
    border-radius: var(--radius);
}

.submit-section h2 {
    font-size: clamp(1.45rem, 2.5vw, 1.8rem);
}

.submit-button,
.text-button {
    min-height: 50px;
    border-radius: 10px;
    font-weight: 750;
}

.submit-button {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    padding: 0.85rem 1.25rem;
    color: var(--white);
    background: var(--teal);
    border: 0;
    box-shadow: 0 10px 24px rgba(7, 59, 66, 0.18);
}

.submit-button svg {
    width: 22px;
    fill: none;
    stroke: currentColor;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 2;
}

.submit-button:hover {
    background: var(--teal-deep);
}

.submit-button:focus-visible,
.text-button:focus-visible {
    outline: 3px solid var(--yellow);
    outline-offset: 3px;
}

.submit-button:disabled {
    cursor: not-allowed;
    opacity: 0.5;
    box-shadow: none;
}

.submit-button[aria-busy="true"] {
    cursor: wait;
    opacity: 0.72;
}

.result-section {
    padding: clamp(2.75rem, 5vw, 4.5rem) 0;
    color: var(--white);
    background: var(--teal-deep);
}

.result-heading {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 1.5rem;
    align-items: end;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid #5a878b;
}

.result-patient {
    margin: 0 0 0.55rem;
    color: var(--yellow);
    font-weight: 750;
}

.result-heading h2 {
    max-width: 24ch;
    font-size: clamp(1.7rem, 3.2vw, 2.65rem);
}

.result-heading > div > p:last-child {
    max-width: 66ch;
    margin: 0;
    color: #d5e8e5;
    font-size: 1rem;
}

.total-score {
    min-width: 120px;
    text-align: right;
}

.total-score span {
    display: block;
    color: var(--yellow);
    font-size: clamp(3rem, 6vw, 4.5rem);
    font-weight: 800;
    letter-spacing: -0.04em;
    line-height: 0.8;
}

.total-score small {
    color: #d5e8e5;
    font-weight: 650;
}

.score-ledger {
    margin: 0;
}

.score-ledger > div {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 1rem;
    align-items: baseline;
    padding: 1rem 0;
    border-bottom: 1px solid #4a777c;
}

.score-ledger dt {
    color: #d5e8e5;
    font-weight: 600;
}

.score-ledger dd {
    margin: 0;
    color: var(--white);
    font-size: 1.35rem;
    font-weight: 800;
}

.score-ledger dd small {
    display: inline-block;
    margin-left: 0.6rem;
    color: #c8dfdb;
    font-size: 0.9rem;
    font-weight: 600;
}

.result-advice {
    display: flex;
    gap: 0.9rem;
    align-items: flex-start;
    max-width: 74ch;
    margin-top: 1.5rem;
    color: #d5e8e5;
}

.result-advice svg {
    width: 24px;
    flex: 0 0 24px;
    fill: none;
    stroke: var(--yellow);
    stroke-linecap: round;
    stroke-width: 1.8;
}

.result-advice p {
    margin: 0;
}

.result-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-top: 1.5rem;
}

.text-button {
    padding: 0.7rem 1.1rem;
    color: var(--white);
    background: transparent;
    border: 1px solid #83a9aa;
}

.site-footer {
    padding: 2rem 0;
    color: #cde2df;
    background: #052e34;
}

.site-footer .container-xl {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    gap: 1rem;
}

.site-footer p {
    margin: 0;
    font-size: 0.88rem;
}

.footer-summary {
    display: grid;
    gap: 0.2rem;
}

.footer-copyright {
    color: var(--mint-strong);
    text-align: right;
}

[hidden] {
    display: none !important;
}

@media (max-width: 991.98px) {
    .intro {
        padding: 1.75rem 0 2rem;
    }

    .intro h1 {
        max-width: none;
        font-size: clamp(1.85rem, 4.5vw, 2.25rem);
    }

    .assessment-layout {
        grid-template-columns: 1fr;
    }

    .progress-rail {
        position: static;
        padding: 1rem;
        background: var(--mint);
        border-radius: var(--radius);
    }

    .section-list,
    .rail-note {
        display: none;
    }

    .progress-track {
        margin-bottom: 0;
    }
}

@media (max-width: 767.98px) {
    .brand-note,
    .frequency-key {
        display: none;
    }

    .intro {
        padding: 1.2rem 0 1.35rem;
    }

    .intro .row {
        --bs-gutter-y: 1.25rem;
    }

    .intro h1 {
        max-width: none;
        margin-bottom: 0.5rem;
        font-size: clamp(1.7rem, 6vw, 1.9rem);
    }

    .privacy-note {
        gap: 0.7rem;
        padding: 0.85rem 0;
    }

    .alkem-logo-frame {
        width: 2.5rem;
        height: 2.5rem;
    }

    .alkem-logo-frame img {
        width: 100%;
        height: 100%;
    }

    .assessment-layout {
        gap: 2rem;
    }

    .binary-row {
        grid-template-columns: minmax(0, 1fr);
        gap: 0.75rem;
        padding: 1.15rem 0;
    }

    .binary-options {
        width: 100%;
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .section-heading {
        grid-template-columns: 2.6rem minmax(0, 1fr);
    }

    .frequency-options {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        margin-left: 0;
    }

    .frequency-button:last-of-type {
        grid-column: 1 / -1;
    }

    .submit-section,
    .result-heading {
        align-items: stretch;
        flex-direction: column;
        grid-template-columns: 1fr;
    }

    .submit-section {
        display: flex;
    }

    .submit-button {
        width: 100%;
    }

    .total-score {
        text-align: left;
    }

    .site-footer .container-xl {
        align-items: flex-start;
        flex-direction: column;
    }

    .footer-copyright {
        text-align: left;
    }
}

@media (max-width: 479.98px) {
    .symptom-row legend {
        grid-template-columns: 2.1rem minmax(0, 1fr);
    }

    .question-number {
        width: 2.1rem;
        height: 2.1rem;
    }

    .score-ledger > div {
        grid-template-columns: 1fr;
        gap: 0.15rem;
    }

    .score-ledger dd small {
        display: block;
        margin: 0.15rem 0 0;
    }
}

@media (prefers-reduced-motion: reduce) {
    html {
        scroll-behavior: auto;
    }

    *,
    *::before,
    *::after {
        scroll-behavior: auto !important;
        transition-duration: 0.01ms !important;
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
    }
}

@media print {
    .site-header,
    .intro,
    .assessment-layout,
    .result-actions,
    .site-footer {
        display: none !important;
    }

    .result-section {
        display: block !important;
        padding: 0;
        color: #000;
        background: #fff;
    }

    .result-heading,
    .score-ledger > div {
        border-color: #999;
    }

    .result-heading h2,
    .result-patient,
    .result-heading > div > p:last-child,
    .total-score span,
    .total-score small,
    .score-ledger dt,
    .score-ledger dd,
    .score-ledger dd small,
    .result-advice {
        color: #000;
    }
}
