/* =========================================================
   Exam page
   Only for /tasks/exam/
   ========================================================= */

.exam-page-form{
    width: 100%;
    max-width: 1120px;
    margin: 0 auto;
}

/* ---------- Top navigation ---------- */

.exam-page-form .exam-progress-nav{
    position: sticky;
    top: 82px;
    z-index: 50;

    justify-content: center;

    margin: 0 auto 28px;
    padding: 18px 20px;

    border-radius: 26px;

    background: rgba(2, 6, 23, 0.72);
    border: 1px solid rgba(148, 163, 184, 0.14);

    backdrop-filter: blur(18px);
    box-shadow: 0 18px 45px rgba(0, 0, 0, 0.22);
}

.exam-page-form .exam-slide{
    width: 100%;
}

/* ---------- Task card ---------- */

.exam-page-form .exam-task-item{
    width: 100%;
    max-width: 1120px;

    margin: 0 auto;
    padding: 34px 34px 30px;

    border-radius: 34px;

    background:
        radial-gradient(circle at top right, rgba(56, 189, 248, 0.10), transparent 32%),
        linear-gradient(180deg, rgba(30, 41, 59, 0.86), rgba(15, 23, 42, 0.92));

    border: 1px solid rgba(148, 163, 184, 0.14);

    box-shadow:
        0 28px 70px rgba(0, 0, 0, 0.34),
        0 0 60px rgba(56, 189, 248, 0.06);
}

.exam-page-form .exam-task-item > p{
    margin: 0 0 24px;

    color: #cbd5e1;

    font-size: 17px;
    line-height: 1.6;
    font-weight: 700;
}

.exam-page-form .exam-task-item .task-question{
    margin-top: 18px !important;
    margin-bottom: 26px !important;

    padding: 42px 38px 34px !important;

    border-radius: 28px !important;

    background:
        linear-gradient(180deg, rgba(15, 23, 42, 0.96), rgba(15, 23, 42, 0.82)) !important;

    border: 1px solid rgba(148, 163, 184, 0.12) !important;

    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.03),
        0 16px 36px rgba(0, 0, 0, 0.18) !important;
}

.exam-page-form .exam-task-item .task-question p{
    margin: 0 0 18px !important;

    color: #d7dee9 !important;

    font-size: 18px !important;
    line-height: 1.72 !important;
}

.exam-page-form .exam-task-item .task-question p:last-child{
    margin-bottom: 0 !important;
}

.exam-page-form .exam-task-item .task-question strong{
    display: inline !important;

    color: #38bdf8 !important;

    font-size: inherit !important;
    line-height: inherit !important;
    font-weight: 900 !important;
}

.exam-page-form .exam-task-item .task-question figure.table{
    margin: 28px auto 32px !important;
}

.exam-page-form .exam-task-item .task-question table{
    margin-left: auto !important;
    margin-right: auto !important;
}

/* ---------- Answer input ---------- */

.exam-page-form .exam-task-item .exam-answer-input{
    width: 100%;
    max-width: 420px;

    height: 58px;

    margin: 0;

    border-radius: 18px;

    background: rgba(2, 6, 23, 0.52);
    border: 1px solid rgba(148, 163, 184, 0.22);

    color: #f8fafc;

    font-size: 17px;
    font-weight: 700;
}

.exam-page-form .exam-task-item .exam-answer-input:focus{
    border-color: rgba(56, 189, 248, 0.88);
    box-shadow: 0 0 0 4px rgba(56, 189, 248, 0.13);
}

/* ---------- Bottom actions ---------- */

.exam-page-form .exam-actions{
    width: 100%;
    max-width: 760px;

    margin: 28px auto 0;

    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px;

    align-items: center;
    justify-content: center;
}

.exam-page-form .exam-actions button{
    width: 100%;
    min-width: 0;
    height: 58px;

    border-radius: 18px;

    font-size: 16px;
    font-weight: 900;

    box-shadow:
        0 16px 38px rgba(56, 189, 248, 0.20),
        inset 0 1px 0 rgba(255, 255, 255, 0.08);

    transition:
        transform 0.25s ease,
        box-shadow 0.25s ease,
        border-color 0.25s ease;
}

.exam-page-form .exam-actions button:hover{
    transform: translateY(-2px);

    box-shadow:
        0 22px 48px rgba(56, 189, 248, 0.28),
        inset 0 1px 0 rgba(255, 255, 255, 0.10);
}

.exam-page-form .exam-actions button:first-child{
    background: rgba(15, 23, 42, 0.82);

    border: 1px solid rgba(148, 163, 184, 0.18);

    color: #f8fafc;
}

.exam-page-form .exam-actions button:last-child{
    background: linear-gradient(135deg, #38bdf8, #0ea5e9);

    border: 1px solid rgba(56, 189, 248, 0.28);

    color: #020617;
}

/* Если на первом задании есть только одна кнопка, ставим её в правую колонку */
.exam-page-form .exam-actions button:only-child{
    grid-column: 2;
    width: 100%;
    max-width: none;
    justify-self: stretch;
}

/* ---------- Manual notice ---------- */

.exam-page-form .manual-task-notice{
    max-width: 760px;

    margin: 26px 0 0;
    padding: 18px 20px;

    border-radius: 18px;

    background: rgba(56, 189, 248, 0.08);
    border: 1px solid rgba(56, 189, 248, 0.30);

    color: #dbeafe;

    font-size: 16px;
    font-weight: 700;
    line-height: 1.6;
}

/* ---------- Responsive ---------- */

@media (max-width: 768px){
    .exam-page-form{
        max-width: 100%;
    }

    .exam-page-form .exam-progress-nav{
        position: static;

        justify-content: flex-start;

        margin-bottom: 22px;
        padding: 14px;

        overflow-x: auto;
        flex-wrap: nowrap;
    }

    .exam-page-form .exam-nav-btn{
        flex: 0 0 auto;
    }

    .exam-page-form .exam-task-item{
        padding: 24px 18px 24px;
        border-radius: 28px;
    }

    .exam-page-form .exam-task-item .task-question{
        padding: 36px 20px 26px !important;
    }

    .exam-page-form .exam-task-item .task-question p{
        font-size: 17px !important;
        line-height: 1.65 !important;
    }

    .exam-page-form .exam-task-item .exam-answer-input{
        max-width: 100%;
    }

    .exam-page-form .exam-actions{
        max-width: 100%;

        grid-template-columns: 1fr;
        gap: 14px;
    }

    .exam-page-form .exam-actions button{
        width: 100%;
    }

    .exam-page-form .exam-actions button:only-child{
        grid-column: 1;
        width: 100%;
        max-width: 100%;
        justify-self: stretch;
    }
}




.exam-answer-save-box {
    width: 100%;
    max-width: 760px;

    display: grid;
    grid-template-columns: minmax(260px, 420px) auto;
    align-items: center;
    gap: 14px;
}

.exam-answer-save-box .exam-answer-input {
    max-width: 100%;
}

.exam-answer-save-panel {
    display: flex;
    align-items: center;
    gap: 12px;

    min-height: 58px;
    padding: 0;

    border: none;
    background: transparent;
}

.exam-answer-save-panel.is-visible,
.exam-answer-save-panel.is-saved {
    display: flex;
    background: transparent;
    border: none;
}

.exam-answer-save-message {
    min-width: 150px;
    max-width: 150px;

    color: #94a3b8;

    font-size: 13px;
    font-weight: 900;
    line-height: 1.2;
    letter-spacing: -0.01em;
}

.exam-answer-save-panel.is-saved .exam-answer-save-message {
    color: #67e8f9;
    font-weight: 950;
}

.exam-answer-save-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}

.exam-answer-save-btn,
.exam-answer-cancel-btn {
    height: 42px;
    padding: 0 18px;

    border-radius: 13px;

    font-size: 14px;
    font-weight: 900;

    white-space: nowrap;
    cursor: pointer;
}

.exam-answer-save-btn {
    color: #020617;

    background: linear-gradient(135deg, #38bdf8, #0ea5e9);
    border: 1px solid rgba(56, 189, 248, 0.38);
}

.exam-answer-cancel-btn {
    color: #cbd5e1;

    background: rgba(15, 23, 42, 0.84);
    border: 1px solid rgba(148, 163, 184, 0.22);
}

.exam-answer-input.is-answer-saved {
    color: #67e8f9 !important;
    font-weight: 950 !important;

    border-color: rgba(56, 189, 248, 0.72);
    box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.13);
}

.exam-answer-input.is-answer-saved::placeholder {
    color: rgba(103, 232, 249, 0.50);
}

@media (max-width: 900px) {
    .exam-answer-save-box {
        max-width: 100%;
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .exam-answer-save-panel {
        align-items: stretch;
        flex-direction: column;
    }

    .exam-answer-save-message {
        max-width: 100%;
    }

    .exam-answer-save-actions {
        width: 100%;
        display: grid;
        grid-template-columns: 1fr 1fr;
    }

    .exam-answer-save-btn,
    .exam-answer-cancel-btn {
        width: 100%;
    }
}

.exam-history-actions {
    display: flex;
    align-items: center;
    gap: 14px;
}

.exam-history-open {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 36px;
    padding: 8px 14px;
    border-radius: 999px;
    background: rgba(37, 99, 235, 0.12);
    color: #2563eb;
    font-weight: 800;
    text-decoration: none;
    border: 1px solid rgba(37, 99, 235, 0.22);
    transition: 0.2s ease;
}

.exam-history-open:hover {
    background: rgba(37, 99, 235, 0.18);
    transform: translateY(-1px);
}

.exam-history-open.is-locked {
    background: rgba(245, 158, 11, 0.14);
    color: #b45309;
    border-color: rgba(245, 158, 11, 0.28);
}

.exam-task-result-card {
    margin-top: 16px;
    padding: 18px;
    border-radius: 22px;
    background: rgba(255, 255, 255, 0.86);
    border: 1px solid rgba(148, 163, 184, 0.22);
    box-shadow: 0 14px 36px rgba(15, 23, 42, 0.08);
}

.exam-task-result-card.is-correct {
    border-color: rgba(34, 197, 94, 0.35);
}

.exam-task-result-card.is-wrong {
    border-color: rgba(239, 68, 68, 0.35);
}

.exam-task-result-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.exam-task-result-head strong {
    font-size: 18px;
    color: #0f172a;
}

.exam-task-result-head span {
    display: inline-flex;
    margin-left: 10px;
    padding: 4px 9px;
    border-radius: 999px;
    background: rgba(15, 23, 42, 0.06);
    color: #64748b;
    font-size: 13px;
    font-weight: 800;
}

.exam-task-score {
    flex: 0 0 auto;
    padding: 8px 13px;
    border-radius: 999px;
    background: rgba(37, 99, 235, 0.1);
    color: #2563eb;
    font-weight: 900;
}

.exam-task-subtopic {
    margin: 8px 0 0;
    color: #64748b;
}

.exam-answer-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
    margin-top: 16px;
}

.exam-answer-grid > div,
.exam-answer-block {
    padding: 14px;
    border-radius: 18px;
    background: rgba(248, 250, 252, 0.9);
    border: 1px solid rgba(148, 163, 184, 0.16);
}

.exam-answer-grid span,
.exam-answer-block span {
    display: block;
    margin-bottom: 7px;
    color: #64748b;
    font-size: 13px;
    font-weight: 800;
}

.exam-answer-grid strong {
    color: #0f172a;
    font-size: 16px;
}

.exam-answer-block {
    margin-top: 14px;
}

.exam-answer-block pre {
    margin: 0;
    white-space: pre-wrap;
    word-break: break-word;
    font-family: inherit;
    color: #0f172a;
    line-height: 1.55;
}

@media (max-width: 720px) {
    .exam-history-item,
    .exam-history-actions,
    .exam-task-result-head {
        align-items: flex-start;
        flex-direction: column;
    }

    .exam-answer-grid {
        grid-template-columns: 1fr;
    }
}

/* Detailed exam attempt result */

.exam-result-card {
    width: min(100%, 980px);
    margin: 72px auto 28px;
    padding: 34px;
    border: 1px solid rgba(80, 190, 255, 0.18);
    border-radius: 28px;
    background:
        radial-gradient(circle at top right, rgba(34, 183, 245, 0.14), transparent 34%),
        linear-gradient(135deg, rgba(21, 31, 49, 0.96), rgba(13, 21, 36, 0.96));
    box-shadow: 0 24px 70px rgba(0, 0, 0, 0.34);
}

.exam-result-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 24px;
    margin-bottom: 28px;
}

.exam-result-header h1 {
    margin: 14px 0 10px;
    color: #f4f8ff;
    font-size: clamp(32px, 4vw, 48px);
    line-height: 1.05;
    letter-spacing: -0.04em;
}

.exam-result-header p {
    margin: 0;
    color: #93a4ba;
    font-size: 15px;
    line-height: 1.6;
}

.exam-summary-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px;
}

.exam-summary-item {
    padding: 18px;
    border: 1px solid rgba(148, 163, 184, 0.16);
    border-radius: 20px;
    background: rgba(10, 18, 32, 0.72);
}

.exam-summary-item span {
    display: block;
    margin-bottom: 10px;
    color: #8ea0b8;
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0.02em;
}

.exam-summary-item strong {
    display: block;
    color: #28c3ff;
    font-size: 30px;
    font-weight: 900;
    line-height: 1;
}

.exam-result-section {
    width: min(100%, 980px);
    margin: 0 auto 34px;
}

.exam-result-section h2 {
    margin: 0 0 18px;
    color: #f4f8ff;
    font-size: 26px;
    line-height: 1.2;
    letter-spacing: -0.025em;
}

.exam-task-result-card {
    position: relative;
    margin-bottom: 16px;
    padding: 22px;
    border: 1px solid rgba(148, 163, 184, 0.16);
    border-radius: 24px;
    background:
        linear-gradient(135deg, rgba(21, 31, 49, 0.96), rgba(13, 21, 36, 0.96));
    box-shadow: 0 18px 44px rgba(0, 0, 0, 0.24);
}

.exam-task-result-card.is-wrong {
    border-color: rgba(255, 105, 105, 0.28);
    background:
        radial-gradient(circle at top right, rgba(255, 86, 86, 0.08), transparent 34%),
        linear-gradient(135deg, rgba(21, 31, 49, 0.98), rgba(13, 21, 36, 0.98));
}

.exam-task-result-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    margin-bottom: 14px;
}

.exam-task-result-head > div:first-child {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.exam-task-result-head strong {
    color: #f4f8ff;
    font-size: 18px;
    font-weight: 900;
}

.exam-task-result-head span {
    display: inline-flex;
    align-items: center;
    min-height: 26px;
    padding: 0 10px;
    border-radius: 999px;
    background: rgba(148, 163, 184, 0.12);
    color: #9fb0c6;
    font-size: 12px;
    font-weight: 800;
}

.exam-task-score {
    min-width: 54px;
    padding: 8px 12px;
    border-radius: 999px;
    background: rgba(34, 183, 245, 0.12);
    color: #28c3ff;
    font-size: 14px;
    font-weight: 900;
    text-align: center;
}

.exam-task-result-card.is-wrong .exam-task-score {
    background: rgba(255, 86, 86, 0.12);
    color: #ff7b7b;
}

.exam-task-subtopic {
    margin: 0 0 16px;
    color: #9fb0c6;
    font-size: 15px;
    font-weight: 700;
    line-height: 1.5;
}

.exam-answer-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
    margin-bottom: 14px;
}

.exam-answer-grid > div,
.exam-answer-block {
    padding: 15px 16px;
    border: 1px solid rgba(148, 163, 184, 0.14);
    border-radius: 16px;
    background: rgba(7, 13, 25, 0.62);
}

.exam-answer-grid span,
.exam-answer-block span {
    display: block;
    margin-bottom: 8px;
    color: #7f91aa;
    font-size: 12px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.exam-answer-grid strong {
    color: #f4f8ff;
    font-size: 16px;
    font-weight: 800;
    word-break: break-word;
}

.exam-answer-block {
    margin-top: 12px;
}

.exam-answer-block pre {
    margin: 0;
    color: #e6edf7;
    font-family: "Inter", system-ui, sans-serif;
    font-size: 14px;
    font-weight: 650;
    line-height: 1.65;
    white-space: pre-wrap;
    word-break: break-word;
}

.exam-answer-block:has(pre) pre {
    font-family: "JetBrains Mono", "Consolas", monospace;
    font-weight: 500;
}

.solution-link,
.back-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 40px;
    padding: 0 16px;
    border: 1px solid rgba(34, 183, 245, 0.24);
    border-radius: 999px;
    background: rgba(34, 183, 245, 0.1);
    color: #35c6ff;
    font-size: 14px;
    font-weight: 800;
    text-decoration: none;
    transition: transform 0.18s ease, border-color 0.18s ease, background 0.18s ease;
}

.solution-link:hover,
.back-link:hover {
    transform: translateY(-1px);
    border-color: rgba(34, 183, 245, 0.5);
    background: rgba(34, 183, 245, 0.16);
}

@media (max-width: 860px) {
    .exam-result-card,
    .exam-result-section {
        width: calc(100% - 32px);
    }

    .exam-result-card {
        margin-top: 38px;
        padding: 24px;
    }

    .exam-result-header {
        flex-direction: column;
    }

    .exam-summary-grid,
    .exam-answer-grid {
        grid-template-columns: 1fr;
    }
}

.exam-set-video-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    justify-content: flex-end;
    align-items: center;
}

.exam-set-video-btn,
.exam-set-result-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 46px;
    border-radius: 14px;
    padding: 0 18px;
    font-size: 14px;
    font-weight: 900;
    text-decoration: none;
    transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}

.exam-set-video-btn {
    border: 1px solid rgba(56, 189, 248, 0.38);
    background: linear-gradient(135deg, #38bdf8, #6366f1);
    color: #020617;
    box-shadow: 0 16px 34px rgba(56, 189, 248, 0.22);
}

.exam-set-result-link {
    border: 1px solid rgba(148, 163, 184, 0.22);
    background: rgba(15, 23, 42, 0.68);
    color: rgba(226, 232, 240, 0.92);
}

.exam-set-video-btn:hover,
.exam-set-result-link:hover {
    transform: translateY(-1px);
}

.exam-final-result-card {
    width: min(1040px, calc(100% - 32px));
    margin: 0 auto 26px;
    border: 1px solid rgba(56, 189, 248, 0.22);
    border-radius: 28px;
    background:
        radial-gradient(circle at top right, rgba(56, 189, 248, 0.18), transparent 34%),
        rgba(15, 23, 42, 0.88);
    box-shadow: 0 22px 60px rgba(2, 8, 23, 0.34);
    padding: 28px;
    display: flex;
    justify-content: space-between;
    gap: 24px;
    align-items: center;
}

.exam-final-result-label {
    color: #38bdf8;
    font-size: 13px;
    font-weight: 900;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    margin-bottom: 10px;
}

.exam-final-result-main h2 {
    margin: 0 0 10px;
    color: #f8fafc;
    font-size: clamp(34px, 6vw, 58px);
    font-weight: 950;
    line-height: 0.95;
}

.exam-final-result-main p {
    max-width: 620px;
    margin: 0;
    color: rgba(226, 232, 240, 0.78);
    font-size: 15px;
    line-height: 1.7;
}

.exam-result-details-card {
    width: min(1040px, calc(100% - 32px));
    margin: 0 auto 28px;
    border: 1px solid rgba(148, 163, 184, 0.16);
    border-radius: 26px;
    background: rgba(15, 23, 42, 0.82);
    padding: 24px;
}

.exam-result-details-header h2 {
    margin: 0 0 8px;
    color: #f8fafc;
    font-size: 24px;
    font-weight: 900;
}

.exam-result-details-header p {
    margin: 0 0 18px;
    color: rgba(226, 232, 240, 0.74);
    line-height: 1.65;
}

.exam-result-details-list {
    display: grid;
    gap: 12px;
}

.exam-result-details-item {
    display: grid;
    grid-template-columns: 1.4fr 120px 1.8fr;
    gap: 16px;
    align-items: center;
    border: 1px solid rgba(148, 163, 184, 0.14);
    border-radius: 18px;
    background: rgba(2, 6, 23, 0.28);
    padding: 16px;
}

.exam-result-details-item.is-correct {
    border-color: rgba(34, 197, 94, 0.28);
}

.exam-result-details-item.is-wrong {
    border-color: rgba(248, 113, 113, 0.28);
}

.exam-result-details-title {
    display: flex;
    flex-direction: column;
    gap: 5px;
    color: #f8fafc;
    font-weight: 900;
}

.exam-result-details-title strong {
    color: rgba(226, 232, 240, 0.62);
    font-size: 13px;
}

.exam-result-details-status {
    justify-self: start;
    border-radius: 999px;
    padding: 8px 12px;
    background: rgba(30, 41, 59, 0.8);
    color: #f8fafc;
    font-size: 13px;
    font-weight: 900;
}

.exam-result-details-item.is-correct .exam-result-details-status {
    background: rgba(22, 163, 74, 0.2);
    color: #86efac;
}

.exam-result-details-item.is-wrong .exam-result-details-status {
    background: rgba(220, 38, 38, 0.18);
    color: #fca5a5;
}

.exam-result-details-answer p {
    margin: 0 0 6px;
    color: rgba(226, 232, 240, 0.78);
    line-height: 1.55;
}

.exam-result-details-answer p:last-child {
    margin-bottom: 0;
}

.exam-set-bottom-video {
    width: min(1040px, calc(100% - 32px));
    margin: 22px auto 0;
    display: flex;
    justify-content: center;
}

@media (max-width: 760px) {
    .exam-final-result-card {
        flex-direction: column;
        align-items: stretch;
    }

    .exam-set-video-actions {
        justify-content: stretch;
    }

    .exam-set-video-btn,
    .exam-set-result-link {
        width: 100%;
    }

    .exam-result-details-item {
        grid-template-columns: 1fr;
    }
}