/* Shared theme for every individual practice-test page and quiz state. */
body.test-detail-page {
    --test-teal: #15998d;
    --test-teal-bright: #58d0c5;
    --test-teal-deep: #0c7068;
    --test-blue: #102d43;
    --test-gold: #d4a64b;
    --test-line: #d7e5e6;
    --test-soft: #edf8f6;
    --test-shadow: 0 18px 48px rgba(13, 47, 67, .09);
    background:
        radial-gradient(circle at 9% 5%, rgba(21, 153, 141, .09), transparent 28rem),
        var(--bg-primary);
}

html[data-theme="dark"] body.test-detail-page {
    --bg-primary: #0d1729;
    --bg-secondary: #152337;
    --bg-card: #132238;
    --bg-tertiary: #1d3045;
    --border-color: #33485d;
    --text-primary: #f4f8f8;
    --text-secondary: #b9c7d2;
    --text-muted: #99aebe;
    --primary-color: #58d0c5;
    --primary-hover: #78ded5;
    --primary-gradient: linear-gradient(135deg, #58d0c5 0%, #22a99e 100%);
    --test-teal: #58d0c5;
    --test-teal-bright: #78ded5;
    --test-teal-deep: #38b9ad;
    --test-line: rgba(107, 198, 190, .24);
    --test-soft: #15313b;
    --test-shadow: 0 22px 58px rgba(0, 8, 18, .24);
}

body.test-detail-page .header {
    background: rgba(255, 255, 255, .96);
    border-bottom-color: rgba(11, 55, 62, .12);
}

html[data-theme="dark"] body.test-detail-page .header {
    background: rgba(8, 28, 41, .96);
    border-bottom-color: rgba(99, 181, 176, .2);
}

body.test-detail-page .logo {
    background: none;
    color: var(--text-primary);
    -webkit-text-fill-color: currentColor;
}

body.test-detail-page .logo::after {
    color: var(--test-teal);
    content: ".";
}

body.test-detail-page .nav-link:hover,
body.test-detail-page .dropdown.active > .nav-link {
    background: rgba(21, 153, 141, .12);
    color: var(--test-teal);
}

body.test-detail-page .test-page {
    box-sizing: border-box;
    margin: 1.5rem auto 4.5rem;
    max-width: 1220px;
    padding: 0 1.25rem;
    width: 100%;
}

body.test-detail-page .test-card {
    background: var(--bg-card);
    border: 1px solid var(--test-line);
    border-radius: 1.15rem;
    box-shadow: var(--test-shadow);
    margin-bottom: 1.15rem;
    padding: clamp(1.35rem, 3vw, 2rem);
}

body.test-detail-page .test-hero {
    background:
        linear-gradient(rgba(75, 178, 171, .055) 1px, transparent 1px),
        linear-gradient(90deg, rgba(75, 178, 171, .055) 1px, transparent 1px),
        radial-gradient(circle at 92% 5%, rgba(31, 156, 153, .24), transparent 36%),
        linear-gradient(135deg, #0b2632 0%, #0c202a 72%);
    background-size: 44px 44px, 44px 44px, auto, auto;
    border-color: rgba(81, 184, 177, .3);
    border-top: 1px solid rgba(81, 184, 177, .3);
    box-shadow: 0 24px 70px rgba(2, 15, 25, .2);
    color: #f7fbfa;
    overflow: hidden;
    padding: clamp(2rem, 5vw, 4rem);
    position: relative;
}

body.test-detail-page .test-hero::before {
    background: linear-gradient(90deg, var(--test-teal-bright), #86d5c1 72%, var(--test-gold));
    content: "";
    height: 4px;
    inset: 0 0 auto;
    position: absolute;
}

body.test-detail-page .test-breadcrumb {
    color: #a8c7cb;
    font-size: .84rem;
    font-weight: 650;
    margin-bottom: 1.35rem;
}

body.test-detail-page .test-breadcrumb a,
body.test-detail-page .test-breadcrumb a:visited {
    color: var(--test-teal-bright);
    font-weight: 800;
}

body.test-detail-page .test-hero h1 {
    color: #f7fbfa;
    font-size: clamp(2.4rem, 5vw, 4.4rem);
    letter-spacing: -.045em;
    line-height: 1.03;
    margin: 0 0 1.25rem;
    max-width: 900px;
}

body.test-detail-page .test-hero > p {
    color: #c8d9dc;
    font-size: clamp(1rem, 1.35vw, 1.15rem);
    line-height: 1.75;
    max-width: 920px;
}

body.test-detail-page .test-spec-bar {
    gap: .7rem;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    margin-top: 1.75rem;
}

body.test-detail-page .test-spec-item {
    background: rgba(255, 255, 255, .055);
    border: 1px solid rgba(176, 215, 217, .24);
    border-radius: .8rem;
    min-height: 108px;
    padding: .95rem;
}

body.test-detail-page .test-spec-item span {
    color: #9ec4c7;
    font-size: .72rem;
    font-weight: 750;
    letter-spacing: .04em;
    text-transform: uppercase;
}

body.test-detail-page .test-spec-item strong {
    color: #f5fbfa;
    display: block;
    font-size: .98rem;
    line-height: 1.45;
}

body.test-detail-page .test-format-card {
    background:
        radial-gradient(circle at 100% 0, color-mix(in srgb, var(--test-teal) 11%, transparent), transparent 18rem),
        var(--bg-card);
    box-shadow: var(--test-shadow);
    padding: clamp(1.5rem, 3vw, 2.25rem);
}

body.test-detail-page .test-card h2,
body.test-detail-page .test-card h3,
body.test-detail-page .test-card h4 {
    color: var(--text-primary);
    letter-spacing: -.02em;
}

body.test-detail-page .test-card h2 {
    font-size: clamp(1.45rem, 2.4vw, 2rem);
    line-height: 1.2;
}

body.test-detail-page .test-format-card p,
body.test-detail-page .test-related-study-card p,
body.test-detail-page .test-seo-content,
body.test-detail-page .test-seo-content p {
    color: var(--text-secondary);
    line-height: 1.75;
}

body.test-detail-page .btn {
    border-radius: .7rem;
    font-weight: 800;
    min-height: 48px;
    padding: .75rem 1.25rem;
}

body.test-detail-page .btn-primary {
    background: var(--test-teal);
    border-color: var(--test-teal);
    box-shadow: 0 10px 24px color-mix(in srgb, var(--test-teal) 22%, transparent);
    color: #fff;
}

html[data-theme="dark"] body.test-detail-page .btn-primary {
    color: #06272c;
}

body.test-detail-page .btn-primary:hover,
body.test-detail-page .btn-primary:focus-visible {
    background: var(--test-teal-deep);
    border-color: var(--test-teal-deep);
    transform: translateY(-2px);
}

body.test-detail-page .btn-secondary {
    background: var(--bg-secondary);
    border-color: var(--test-line);
    color: var(--text-primary);
}

body.test-detail-page .btn-secondary:hover,
body.test-detail-page .btn-secondary:focus-visible {
    border-color: var(--test-teal);
    color: var(--test-teal);
}

body.test-detail-page .related-test-list {
    gap: .7rem;
}

body.test-detail-page .related-test-list a {
    background: var(--test-soft);
    border-color: transparent;
    border-radius: .75rem;
    color: var(--text-primary);
    min-height: 48px;
    padding: .85rem 2.3rem .85rem 1rem;
    position: relative;
}

body.test-detail-page .related-test-list a::after {
    color: var(--test-teal);
    content: "\2192";
    font-weight: 900;
    position: absolute;
    right: .95rem;
}

body.test-detail-page .related-test-list a:hover,
body.test-detail-page .related-test-list a:focus-visible {
    border-color: var(--test-teal);
    color: var(--test-teal);
}

body.test-detail-page .test-seo-content h2 {
    border-left: 3px solid var(--test-teal);
    margin-top: 2.2rem;
    padding-left: .85rem;
}

body.test-detail-page .test-seo-content h2:first-child {
    margin-top: 0;
}

body.test-detail-page .test-seo-content a,
body.test-detail-page .test-seo-content a:visited {
    color: var(--test-teal);
    font-weight: 750;
}

/* Active quiz */
body.test-detail-page .test-page.exam-active {
    margin-top: 1.5rem;
    max-width: 1040px;
    width: 100%;
}

body.test-detail-page .test-page.exam-active #test-area,
body.test-detail-page .test-page.exam-active #result-area {
    background:
        radial-gradient(circle at 100% 0, color-mix(in srgb, var(--test-teal) 12%, transparent), transparent 22rem),
        var(--bg-card);
    border-color: var(--test-line);
    box-shadow: var(--test-shadow);
}

body.test-detail-page .test-header-row {
    background: var(--test-soft);
    border-color: var(--test-line);
}

body.test-detail-page #timer,
body.test-detail-page .test-status {
    color: var(--test-teal);
}

body.test-detail-page .test-progress {
    background: color-mix(in srgb, var(--test-teal) 12%, var(--bg-tertiary));
    height: 9px;
}

body.test-detail-page .test-progress > i {
    background: linear-gradient(90deg, var(--test-teal), var(--test-teal-bright), var(--test-gold));
}

body.test-detail-page .test-question-area {
    background: var(--bg-secondary);
    border-color: var(--test-line);
    padding: clamp(1.15rem, 3vw, 1.75rem);
}

body.test-detail-page .test-question-area > p:first-child {
    color: var(--test-teal) !important;
    font-size: .74rem;
    font-weight: 800;
    letter-spacing: .07em;
    text-transform: uppercase;
}

body.test-detail-page .test-question-area h4 {
    font-size: clamp(1.05rem, 2vw, 1.3rem);
    line-height: 1.5;
}

body.test-detail-page .test-option {
    background: var(--bg-card);
    border-color: var(--test-line);
    border-radius: .75rem;
    min-height: 58px;
    padding: .95rem 1rem;
}

body.test-detail-page .test-option:hover {
    border-color: var(--test-teal);
}

body.test-detail-page .test-option:has(input:checked) {
    background: color-mix(in srgb, var(--test-teal) 13%, var(--bg-card));
    border-color: var(--test-teal);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--test-teal) 16%, transparent);
}

body.test-detail-page .test-option input {
    accent-color: var(--test-teal);
}

/* Results and answer review */
body.test-detail-page .test-result-card {
    background: var(--test-soft);
    border: 1px solid var(--test-line);
    border-radius: 1rem;
    margin-top: 1.25rem;
    min-height: 170px;
    padding: 1.35rem;
}

body.test-detail-page .test-result-chart {
    background: var(--bg-card);
    border-color: var(--test-line);
    border-radius: 50%;
    right: 1rem;
    top: 1rem;
}

body.test-detail-page .test-result-percent {
    color: var(--test-teal);
}

body.test-detail-page #answers-expanded {
    margin-top: 1.5rem;
}

body.test-detail-page .test-answer-row {
    background: var(--bg-secondary);
    border: 1px solid var(--test-line);
    border-left: 4px solid var(--success-color);
    border-radius: .75rem;
    line-height: 1.65;
    padding: 1rem;
}

body.test-detail-page .test-answer-row.incorrect {
    border-left-color: var(--error-color);
}

@media (max-width: 900px) {
    body.test-detail-page .test-spec-bar {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 640px) {
    body.test-detail-page .test-page,
    body.test-detail-page .test-page.exam-active {
        margin-top: 1rem;
        padding: 0 1rem;
        width: 100%;
    }

    body.test-detail-page .test-hero {
        border-radius: 1rem;
        padding: 2.25rem 1.35rem 1.5rem;
    }

    body.test-detail-page .test-spec-bar {
        grid-template-columns: 1fr;
    }

    body.test-detail-page .test-spec-item {
        min-height: 0;
    }

    body.test-detail-page .test-page.exam-active #test-area:not([hidden]) {
        height: auto;
        min-height: calc(100vh - 7rem);
    }

    body.test-detail-page .test-page.exam-active #test-area:not([hidden]) .test-question-area {
        height: auto;
        max-height: none;
        overflow: visible;
    }

    body.test-detail-page .test-result-card {
        display: grid;
        gap: 1.25rem;
    }

    body.test-detail-page .test-result-chart {
        margin: 0 auto;
        position: relative;
        right: auto;
        top: auto;
    }

    body.test-detail-page .test-result-summary {
        margin-right: 0;
    }
}

@media (prefers-reduced-motion: reduce) {
    body.test-detail-page .btn,
    body.test-detail-page .test-option,
    body.test-detail-page .related-test-list a {
        transition: none;
    }
}
