:root {
    color-scheme: light;
}

body {
    background-color: #f8f9fa;
    color: #1f2937;
}

input,
select,
textarea {
    width: 100%;
    border-radius: 1rem;
    border: 1px solid rgba(30, 64, 175, 0.12);
    background: rgba(248, 249, 250, 0.9);
    padding: 0.9rem 1rem;
    color: #1f2937;
    outline: none;
    transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

input:focus,
select:focus,
textarea:focus {
    border-color: rgba(30, 64, 175, 0.35);
    box-shadow: 0 0 0 4px rgba(30, 64, 175, 0.08);
    background: #ffffff;
}

.language-select-wrap {
    position: relative;
    display: inline-flex;
    align-items: center;
}

.language-select-wrap-full {
    display: flex;
    width: 100%;
}

.language-select {
    width: auto;
    min-width: 5.75rem;
    min-height: 2.75rem;
    border-radius: 9999px;
    border: 1px solid rgba(30, 64, 175, 0.16);
    background-color: #ffffff;
    box-shadow: 0 8px 22px rgba(30, 64, 175, 0.08);
    color: #1f2937;
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background-image: none !important;
    background-repeat: no-repeat;
    background-position: right center;
    background-size: 0 0;
    line-height: 1.2;
    text-indent: 0.01px;
    text-overflow: "";
    padding-right: 2.7rem;
}

.language-select:hover {
    border-color: rgba(30, 64, 175, 0.24);
    background-color: #ffffff;
}

.language-select:focus,
.language-select:active {
    border-color: rgba(30, 64, 175, 0.35);
    background-color: #ffffff;
    box-shadow: 0 0 0 4px rgba(30, 64, 175, 0.08);
}

.language-select-full {
    width: 100%;
    min-width: 0;
    border-radius: 1rem;
    min-height: 3rem;
    padding-right: 2.9rem;
}

.language-select::-ms-expand {
    display: none;
}

.language-select-icon {
    position: absolute;
    right: 0.95rem;
    top: 50%;
    display: inline-flex;
    width: 0.875rem;
    height: 0.875rem;
    color: #1e40af;
    transform: translateY(-50%);
    pointer-events: none;
}

.language-select-icon svg {
    width: 100%;
    height: 100%;
    display: block;
}

.site-shell::before {
    content: "";
    position: absolute;
    inset: 0;
    background-image:
        linear-gradient(rgba(255, 255, 255, 0.58) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.58) 1px, transparent 1px);
    background-size: 34px 34px;
    mask-image: linear-gradient(to bottom, rgba(0, 0, 0, 0.28), transparent 70%);
    pointer-events: none;
}

.hero-balanced-text {
    min-width: 0;
    max-width: 100%;
    overflow-wrap: break-word;
    text-wrap: pretty;
}

.about-page-grid {
    display: grid;
    gap: 1.25rem;
}

.about-main-card {
    order: 1;
}

.about-photo-card {
    order: 2;
}

.about-detail-grid {
    order: 3;
}

@media (min-width: 1024px) {
    .about-page-grid {
        grid-template-columns: minmax(0, 0.86fr) minmax(0, 1.14fr);
        grid-template-rows: auto minmax(0, 1fr);
        align-items: start;
    }

    .about-photo-card {
        grid-column: 1;
        grid-row: 1 / span 2;
    }

    .about-main-card {
        grid-column: 2;
        grid-row: 1;
    }

    .about-detail-grid {
        grid-column: 2;
        grid-row: 2;
        align-self: stretch;
    }
}

.cta-pulse {
    animation: cta-pulse 2.8s ease-in-out infinite;
}

.footer-social-button {
    align-items: center;
    background: rgba(248, 249, 250, 0.9);
    border-radius: 9999px;
    color: #1f2937;
    display: inline-flex;
    gap: 0.75rem;
    justify-content: center;
    min-height: 3rem;
    min-width: 9.5rem;
    padding: 0.75rem 1rem;
    font-size: 0.875rem;
    font-weight: 600;
    line-height: 1.25rem;
    transition: background-color 0.2s ease, color 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
}

.footer-social-button:hover {
    background: #1e40af;
    color: #ffffff;
}

@media (max-width: 639px) {
    .quiz-active .site-footer {
        display: none;
    }

    .quiz-active .test-quiz-section {
        padding-bottom: 1.5rem;
    }

    .site-footer {
        margin-top: 1.5rem;
        padding-bottom: 1rem;
        overflow-wrap: anywhere;
    }

    .site-footer .footer-surface {
        padding: 16px;
        border-radius: 1.5rem;
        box-shadow: 0 4px 16px rgba(30, 64, 175, 0.04);
    }

    .site-footer .footer-layout {
        gap: 1rem;
    }

    .site-footer .footer-intro,
    .site-footer .footer-socials,
    .site-footer .footer-bottom {
        width: 100%;
    }

    .site-footer .footer-intro {
        max-width: none;
    }

    .site-footer .footer-intro > p:first-child {
        color: rgba(30, 64, 175, 0.7);
        font-size: 0.625rem;
        line-height: 1rem;
        letter-spacing: 0;
    }

    .site-footer .footer-intro h2 {
        margin-top: 0.25rem;
        font-size: 1.125rem;
        font-weight: 500;
        line-height: 1.5rem;
    }

    .site-footer .footer-intro h2 + p {
        margin-top: 0.5rem;
        font-size: 0.8125rem;
        line-height: 1.25rem;
    }

    .site-footer .footer-socials {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 0.5rem;
    }

    .site-footer .footer-social-button {
        min-height: 2.75rem;
        min-width: 0;
        width: 100%;
        padding: 8px;
        gap: 8px;
        justify-content: center;
        border: 1px solid rgba(30, 64, 175, 0.1);
        border-radius: 0.5rem;
        background: #f8f9fa;
        font-weight: 500;
        transition: background-color 150ms ease, border-color 150ms ease, color 150ms ease;
    }

    .site-footer .footer-social-button:hover,
    .site-footer .footer-social-button:active {
        background: rgba(30, 64, 175, 0.04);
        border-color: rgba(30, 64, 175, 0.2);
        color: #1e40af;
    }

    .site-footer .footer-social-button > span:last-child {
        min-width: 0;
    }

    .site-footer .footer-social-button:focus-visible {
        outline: 2px solid #1e40af;
        outline-offset: 3px;
    }

    .site-footer .footer-info {
        display: none;
    }

    .site-footer .footer-bottom {
        margin-top: 0.75rem;
        padding-top: 0.75rem;
        font-size: 0.6875rem;
        line-height: 1rem;
    }
}

@media (max-width: 639px) and (prefers-reduced-motion: reduce) {
    .site-footer .footer-social-button {
        transition: none;
    }
}

.footer-social-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1rem;
    min-width: 1rem;
    height: 1rem;
    font-size: 0.95rem;
    line-height: 1;
    flex-shrink: 0;
}

.social-brand-icon,
.footer-social-icon svg {
    display: block;
    height: 100%;
    width: 100%;
}

@media (max-width: 767px) {
    .home-courses-grid > [data-home-card="course"]:not([data-home-index="1"]):not([data-home-index="2"]):not([data-home-index="3"]),
    .home-tests-grid > [data-home-card="test"]:not([data-home-index="1"]):not([data-home-index="2"]):not([data-home-index="3"]),
    .home-materials-grid > [data-home-card="material"]:not([data-home-index="1"]):not([data-home-index="2"]):not([data-home-index="3"]) {
        display: none !important;
    }
}

.course-card-text-safe {
    max-width: 100%;
    min-width: 0;
    overflow-wrap: anywhere;
    white-space: normal;
    word-break: break-word;
}

.material-title-safe,
.material-description-safe,
.material-detail-text-safe {
    max-width: 100%;
    min-width: 0;
    overflow-wrap: anywhere;
    white-space: normal;
    word-break: break-word;
}

.test-title-safe,
.test-description-safe,
.test-question-safe,
.test-option-safe,
.test-explanation-safe {
    max-width: 100%;
    min-width: 0;
    overflow-wrap: anywhere;
    white-space: normal;
    word-break: break-word;
}

.test-detail-page {
    background-color: #f8f9fa;
}

.test-quiz-section {
    padding-top: 1.5rem;
}

.test-run-form {
    --quiz-primary: #1e40af;
    --quiz-ink: #1f2937;
    --quiz-muted: #64748b;
    --quiz-border: #e4e7ec;
    --quiz-success: #285f46;
    --quiz-error: #884550;
    max-width: 840px;
    margin-inline: auto;
    display: grid;
    gap: 1.5rem;
    scroll-margin-top: 7.5rem;
}

.test-progress {
    min-width: 0;
    padding-inline: 0.25rem;
}

.test-progress-summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.test-progress-title {
    color: var(--quiz-ink);
    font-size: 0.875rem;
    font-weight: 600;
    line-height: 1.5rem;
}

.test-progress-level strong {
    display: block;
    padding: 0.125rem 0.5rem;
    border-radius: 0.375rem;
    background: #edf1fb;
    color: var(--quiz-primary);
    font-size: 0.75rem;
    font-weight: 600;
    line-height: 1.5rem;
}

.test-progress-track {
    height: 0.25rem;
    margin-top: 0.75rem;
    overflow: hidden;
    border-radius: 999px;
    background: #e6eaf1;
}

.test-progress-track > div {
    transition: width 160ms ease;
}

.test-run-form .test-question-card {
    padding: 2rem;
    border: 1px solid var(--quiz-border);
    border-radius: 1rem;
    box-shadow: 0 8px 24px rgba(31, 41, 55, 0.04);
    scroll-margin-top: 7.5rem;
}

.test-question-label {
    color: var(--quiz-muted);
    font-size: 0.6875rem;
    font-weight: 600;
    line-height: 1rem;
    text-transform: uppercase;
    letter-spacing: 0;
}

.test-question-title {
    max-width: 36ch;
    margin-top: 0.75rem;
    color: var(--quiz-primary);
    font-size: 1.75rem;
    font-weight: 600;
    line-height: 1.4;
}

.test-question-title :is(h2, h3, h4) {
    color: inherit;
    font: inherit;
}

.test-answer-list {
    display: grid;
    gap: 0.5rem;
    margin-top: 1.5rem;
}

.test-run-form .test-answer-option {
    min-height: 4rem;
    align-items: center;
    padding: 1rem;
    border: 1px solid var(--quiz-border);
    border-radius: 0.5rem;
    background: #fff;
    font-size: 1rem;
    line-height: 1.5rem;
    transition: border-color 160ms ease, background-color 160ms ease, color 160ms ease;
}

@media (hover: hover) {
    .test-run-form .test-answer-option:not(.test-answer-locked):hover {
        border-color: #aab8db;
        background: #f8faff;
    }
}

.test-run-form .test-answer-option:has(input:checked:not(:disabled)) {
    border-color: var(--quiz-primary);
    background: #eff3ff;
    color: var(--quiz-primary);
}

.test-run-form .test-answer-option:has(input:focus-visible) {
    outline: 2px solid var(--quiz-primary);
    outline-offset: 3px;
}

.test-answer-option input {
    width: 1.125rem;
    height: 1.125rem;
    flex-shrink: 0;
    margin: 0;
    padding: 0;
    color: var(--quiz-primary);
    border-color: #a0a9b8;
    box-shadow: none;
}

.test-option-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.test-option-text {
    min-width: 0;
    flex: 1;
}

.test-run-form .test-answer-locked {
    cursor: default;
    background: #fafbfc;
    color: var(--quiz-muted);
}

.test-run-form .test-answer-correct {
    border-color: #a4c6b5;
    background: #f0f9f4;
    color: var(--quiz-success);
}

.test-answer-correct input {
    accent-color: var(--quiz-success);
    color: var(--quiz-success);
}

.test-run-form .test-answer-selected {
    border-color: #dbb0b7;
    background: #fff3f5;
    color: var(--quiz-error);
}

.test-answer-selected input {
    accent-color: var(--quiz-error);
    color: var(--quiz-error);
}

.test-option-badge {
    display: inline-flex;
    align-items: center;
    flex-shrink: 0;
    gap: 0.25rem;
    max-width: 100%;
    font-weight: 600;
    font-size: 0.75rem;
    line-height: 1.125rem;
}

.test-quiz-icon {
    width: 1.125rem;
    height: 1.125rem;
    flex-shrink: 0;
}

.test-question-feedback {
    min-width: 0;
    margin-top: 1.5rem;
    border-top: 1px solid var(--quiz-border);
    padding-top: 1.5rem;
    scroll-margin-top: 7.5rem;
    overflow-wrap: anywhere;
    animation: test-feedback-appear 180ms ease-out;
}

.test-question-feedback:focus {
    outline: none;
}

.test-feedback-title {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--quiz-error);
    font-size: 1rem;
    font-weight: 600;
    line-height: 1.5;
}

.test-feedback-correct .test-feedback-title {
    color: var(--quiz-success);
}

.test-feedback-explanation {
    max-width: 65ch;
    margin-top: 1rem;
}

.test-feedback-explanation h3 {
    color: var(--quiz-ink);
    font-size: 0.875rem;
    font-weight: 600;
    line-height: 1.5rem;
}

.test-feedback-explanation .markdown-content {
    margin-top: 0.5rem;
    color: #475569;
    font-size: 0.9375rem;
    line-height: 1.8;
}

.test-question-actions {
    margin-top: 1.5rem;
}

.test-action-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-end;
    gap: 0.75rem;
}

.test-action-row .test-action-button {
    min-height: 3rem;
    padding: 0.75rem 1.25rem;
    gap: 0.5rem;
    border-radius: 0.5rem;
    transition: background-color 160ms ease, box-shadow 160ms ease;
}

.test-action-next {
    min-width: 9rem;
}

.test-action-next:hover:not(:disabled) {
    background: #193897;
    box-shadow: 0 2px 8px rgba(30, 64, 175, 0.12);
}

.test-action-next:active:not(:disabled) {
    background: #17317f;
}

.test-action-button:focus-visible {
    outline: 2px solid var(--quiz-primary);
    outline-offset: 3px;
}

.test-run-form [data-answer-submit]:disabled {
    opacity: 1;
    background: #e8ecf3;
    color: #475569;
    cursor: not-allowed;
    box-shadow: none;
}

@keyframes test-feedback-appear {
    from { opacity: 0; transform: translateY(4px); }
    to { opacity: 1; transform: translateY(0); }
}

@media (prefers-reduced-motion: reduce) {
    .test-question-feedback {
        animation: none;
    }

    .test-run-form .test-answer-option,
    .test-run-form .test-action-button,
    .test-run-form .test-progress-track > div,
    .test-run-form input {
        transition: none;
    }
}

@media (max-width: 767px) {
    .test-run-form .test-question-card {
        padding: 1.25rem;
    }

    .test-question-title {
        font-size: 1.375rem;
    }

    .test-run-form .test-answer-option {
        gap: 0.75rem;
        padding: 0.875rem;
    }

    .test-option-content {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.25rem;
    }

    .test-action-row {
        flex-direction: column;
        gap: 0.5rem;
    }

    .test-action-row .test-action-button {
        width: 100%;
        min-width: 0;
    }

    .test-action-next { order: 1; }
    .test-action-admin { order: 2; }
}

@keyframes cta-pulse {
    0%,
    100% {
        box-shadow: 0 0 0 0 rgba(250, 204, 21, 0.18);
        transform: translateY(0);
    }
    50% {
        box-shadow: 0 0 0 14px rgba(250, 204, 21, 0);
        transform: translateY(-1px);
    }
}

@media (prefers-reduced-motion: reduce) {
    .cta-pulse {
        animation: none;
    }
}
.markdown-content > * + * {
    margin-top: 0.85rem;
}

.markdown-content h2,
.markdown-content h3,
.markdown-content h4 {
    color: #1e40af;
    font-weight: 600;
    line-height: 1.35;
}

.markdown-content h2 {
    font-size: 1.25rem;
}

.markdown-content h3 {
    font-size: 1.125rem;
}

.markdown-content h4 {
    font-size: 1rem;
}

.markdown-content ul,
.markdown-content ol {
    padding-left: 1.35rem;
}

.markdown-content ul {
    list-style: disc;
}

.markdown-content ol {
    list-style: decimal;
}

.markdown-content li + li {
    margin-top: 0.35rem;
}

.markdown-content blockquote {
    border-left: 3px solid rgba(30, 64, 175, 0.25);
    color: #475569;
    padding-left: 1rem;
}

.markdown-content a,
.markdown-inline a {
    color: #1e40af;
    font-weight: 600;
    overflow-wrap: anywhere;
    text-decoration: underline;
    text-underline-offset: 0.2em;
}

.markdown-inline {
    overflow: hidden;
}

.markdown-inline br {
    display: none;
}
