* {
    box-sizing: border-box;
}

html {
    font-family:
        Inter,
        system-ui,
        -apple-system,
        BlinkMacSystemFont,
        "Segoe UI",
        sans-serif;

    background: #f3f6fb;
    color: #172238;
}

body {
    min-height: 100vh;
    margin: 0;
}

button,
select {
    font: inherit;
}

button {
    cursor: pointer;
}

[hidden] {
    display: none !important;
}

.lesson-shell {
    width: min(980px, calc(100% - 32px));
    margin: 0 auto;
    padding: 32px 0 60px;
}

.lesson-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 24px;
}

.eyebrow {
    margin: 0 0 8px;
    color: #345fab;
    font-weight: 800;
}

h1 {
    margin: 0;
    font-size: clamp(2rem, 5vw, 3.4rem);
    line-height: 1.05;
}

.subtitle {
    max-width: 680px;
    margin: 14px 0 0;
    font-size: 1.08rem;
    line-height: 1.6;
}

.language-control {
    display: grid;
    flex: 0 0 155px;
    gap: 7px;
    font-weight: 750;
}

.language-control select,
.start-controls select {
    width: 100%;
    padding: 11px 13px;
    border: 1px solid #bac6d9;
    border-radius: 11px;
    background: white;
    color: inherit;
}

.development-banner {
    display: grid;
    gap: 4px;
    margin: 26px 0;
    padding: 16px 18px;
    border: 1px solid #cbd9f2;
    border-radius: 16px;
    background: #edf3ff;
}

.screen-card {
    padding: clamp(20px, 4vw, 32px);
    border: 1px solid #e1e7f0;
    border-radius: 24px;
    background: white;
    box-shadow: 0 14px 38px rgb(24 45 80 / 9%);
}

.screen-card > h2 {
    margin-top: 0;
}

.stage-preview-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
}

.stage-preview-grid article {
    padding: 19px;
    border-radius: 17px;
    background: #f6f8fc;
}

.stage-preview-grid h3 {
    margin: 14px 0 8px;
}

.stage-preview-grid p {
    margin: 0;
    line-height: 1.55;
}

.stage-number,
.stage-badge {
    display: grid;
    place-items: center;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: #dfe9fb;
    color: #234c98;
    font-weight: 850;
}

.start-controls {
    display: flex;
    align-items: end;
    justify-content: space-between;
    gap: 18px;
    margin-top: 24px;
}

.start-controls label {
    display: grid;
    gap: 8px;
    min-width: 210px;
    font-weight: 750;
}

.primary-button {
    min-height: 46px;
    padding: 11px 20px;
    border: 0;
    border-radius: 13px;
    background: #2857ad;
    color: white;
    font-weight: 800;
}

.primary-button:hover {
    filter: brightness(1.06);
}

.primary-button:focus-visible,
.answer:focus-visible,
select:focus-visible {
    outline: 3px solid rgb(40 87 173 / 28%);
    outline-offset: 2px;
}

.last-result {
    margin-top: 22px;
    padding: 15px 17px;
    border-radius: 14px;
    background: #f4f6fa;
    line-height: 1.55;
}

.lesson-status {
    display: flex;
    flex-wrap: wrap;
    gap: 9px;
}

.lesson-status span {
    padding: 7px 11px;
    border-radius: 999px;
    background: #eef2f8;
    font-size: 0.92rem;
    font-weight: 750;
}

.digital-time {
    margin: 25px 0;
    font-size: clamp(3.4rem, 11vw, 6.5rem);
    font-weight: 900;
    letter-spacing: 0.05em;
    text-align: center;
}

.stage-heading {
    display: flex;
    align-items: flex-start;
    gap: 14px;
}

.stage-heading h2 {
    margin: 0;
}

.stage-heading p {
    margin: 7px 0 0;
    line-height: 1.55;
}

.answers {
    display: grid;
    gap: 12px;
    margin-top: 22px;
}

.answer {
    width: 100%;
    padding: 15px 17px;
    border: 2px solid #dbe2ed;
    border-radius: 14px;
    background: white;
    color: inherit;
    text-align: left;
    line-height: 1.5;
}

.answer:hover:not(:disabled) {
    border-color: #7f9ed3;
    background: #f6f9ff;
}

.answer.wrong {
    border-color: #d77a7a;
    background: #fff2f2;
}

.answer.correct {
    border-color: #54a575;
    background: #effaf3;
}

.answer:disabled {
    cursor: default;
    opacity: 0.82;
}

.feedback,
.explanation {
    margin-top: 18px;
    padding: 16px 18px;
    border-radius: 14px;
    line-height: 1.6;
}

.feedback.success {
    background: #ebf8f0;
    color: #245f3d;
}

.feedback.warning {
    background: #fff7e7;
    color: #765417;
}

.feedback.error {
    background: #fff0f0;
    color: #7b3030;
}

.explanation {
    background: #f1f4f9;
}

.lesson-actions {
    display: flex;
    justify-content: flex-end;
    margin-top: 20px;
}

.finish-screen {
    text-align: center;
}

.result-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 15px;
    margin: 25px 0;
}

.result-grid article {
    display: grid;
    gap: 8px;
    padding: 20px 15px;
    border-radius: 17px;
    background: #f5f7fb;
}

.result-grid strong {
    font-size: 2rem;
}

html[dir="rtl"] body {
    direction: rtl;
}

html[dir="rtl"] .lesson-header,
html[dir="rtl"] .stage-heading {
    flex-direction: row-reverse;
}

html[dir="rtl"] .lesson-header,
html[dir="rtl"] .screen-card,
html[dir="rtl"] .answer {
    text-align: right;
}

html[dir="rtl"] .lesson-actions {
    justify-content: flex-start;
}

@media (max-width: 760px) {
    .lesson-header {
        display: grid;
    }

    .language-control {
        width: 100%;
    }

    .stage-preview-grid,
    .result-grid {
        grid-template-columns: 1fr;
    }

    .start-controls {
        display: grid;
    }

    .start-controls label {
        min-width: 0;
    }

    .primary-button {
        width: 100%;
    }

    .lesson-actions {
        display: grid;
    }
}

/* answer-instruction-audio-v2-1 */
.answer-instruction-panel {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-top: 20px;
    padding: 15px 17px;
    border: 1px solid #cddbf1;
    border-radius: 14px;
    background: #eef4ff;
}

.answer-instruction-text {
    margin: 0;
    font-weight: 800;
    line-height: 1.5;
}

.instruction-audio-controls {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
    flex: 0 0 auto;
}

.instruction-repeat-button {
    min-height: 42px;
    padding: 9px 13px;
    border: 1px solid #2d61b7;
    border-radius: 11px;
    background: white;
    color: #1f4d9c;
    font: inherit;
    font-weight: 800;
}

.instruction-repeat-button:hover {
    background: #f6f9ff;
}

.instruction-repeat-button:focus-visible,
.instruction-audio-toggle input:focus-visible {
    outline: 3px solid rgb(40 87 173 / 28%);
    outline-offset: 2px;
}

.instruction-audio-toggle {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-weight: 700;
    line-height: 1.35;
    cursor: pointer;
}

.instruction-audio-toggle input {
    width: 20px;
    height: 20px;
    margin: 0;
    accent-color: #2d61b7;
}

html[dir="rtl"] .answer-instruction-panel {
    text-align: right;
}

html[dir="rtl"] .instruction-audio-controls {
    flex-direction: row-reverse;
}

@media (max-width: 760px) {
    .answer-instruction-panel {
        align-items: stretch;
        flex-direction: column;
    }

    .instruction-audio-controls {
        justify-content: space-between;
    }

    html[dir="rtl"] .instruction-audio-controls {
        flex-direction: row-reverse;
    }
}

/* back to time menu navigation v1 */

.lesson-return-navigation {
    width: min(100% - 32px, 1020px);
    margin-inline: auto;
}

.lesson-return-navigation-top {
    padding-top: 24px;
    padding-bottom: 4px;
}

.lesson-return-navigation-finish {
    width: 100%;
    margin-top: 20px;
    text-align: center;
}

.lesson-return-link {
    display: inline-flex;
    align-items: center;
    min-height: 44px;
    padding: 10px 14px;
    border: 1px solid #b9cdf2;
    border-radius: 12px;
    background: #ffffff;
    color: #2457b8;
    font-weight: 800;
    line-height: 1.25;
    text-decoration: none;
    box-shadow: 0 4px 14px rgba(36, 87, 184, .08);
}

.lesson-return-link:hover,
.lesson-return-link:focus-visible {
    border-color: #2457b8;
    background: #eef4ff;
    outline: none;
}

@media (max-width: 640px) {
    .lesson-return-navigation {
        width: min(100% - 24px, 1020px);
    }

    .lesson-return-navigation-top {
        padding-top: 14px;
    }

    .lesson-return-link {
        width: 100%;
        justify-content: center;
        text-align: center;
    }
}

