@import url("../components/modal.css");
@import url("../components/star-rating.css");
@import url("../components/checkbox.css");

html {
    --training-stat-height: 48px;
    background-color: var(--secondary_background);
}

html,
body {
    height: 100%;
    min-height: 100%;
    max-width: 100%;
    overflow-x: hidden;
    position: relative;
}

.big_container {
    max-width: 1400px;
    margin-left: auto;
    margin-right: auto;
    padding-right: 24px;
    padding-left: 24px;
}

.dot {
    margin: 0 6px;
}

.stat_box_wrapper {
    min-width: 180px;
    max-width: 180px;
    align-self: self-start;
}

.train_stat {
    background-color: var(--white);
    border-bottom-width: 4px;
    padding: 0 !important;
    overflow: hidden;
    text-align: center;
}

.train_stat.box > div[data-cell]:nth-last-child(1 of div[data-cell]) .stat_section.stat_section:not(.stat_header) {
    border-bottom: 0;
}

.stat_section {
    font-weight: var(--main_bold_weight);
    padding: 15px;
    border-bottom: var(--border);
}

.stat_section .stat_num {
    font-size: 20px;
    font-weight: var(--main_bolder_weight);
}

.stat_section img {
    width: 28px;
    margin-right: 6px;
}


.stat_header {
    background-color: var(--secondary_background);
}

.training_wrapper {
    position: relative;
    flex-grow: 1;
    width: 100%;
    max-width: 1180px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border-top: var(--border);
    border-bottom: var(--border);
}

/* A shell without statistics uses the same column width, centered without a rail. */
.training_without_rail > .training_wrapper {
    margin-inline: auto;
}

/* Historical statistics load separately from exercises with independent questions. */
html.training-progress-pending #total_train_progress,
html.training-progress-pending .train_stat .best,
html.training-progress-pending .current_record,
html.training-smartscore-pending .smartscore_progress_wrap,
html.training-smartscore-pending .smartscore_skill_progress,
html.training-smartscore-pending .train_stat .stat_num {
    visibility: hidden !important;
}
html.training-progress-pending .progress-ring-value,
html.training-smartscore-pending .smartscore_progress_fill {
    transition: none !important;
}
.training_progress_sync_status[hidden] { display: none; }

/* Custom trainers keep their loading card only until their own initializer is ready. */
.training_wrapper:has(> .training[hidden]) > :not(.training_progress_loading),
.training_wrapper:has(> .training[hidden]) > :not(.training_progress_loading) * {
    visibility: hidden !important;
    pointer-events: none !important;
}

.training_wrapper:has(> .training[hidden]) .progress-ring-value,
.training_wrapper:has(> .training[hidden]) .smartscore_progress_fill {
    transition: none !important;
}

.training_progress_loading {
    position: absolute;
    inset: 0;
    z-index: 2;
    display: none;
    gap: 16px;
    padding: 24px;
    background-color: var(--white);
    color: var(--secondary);
}

.training_wrapper:has(> .training[hidden]) > .training_progress_loading {
    display: flex;
}

.training_progress_loading_spinner {
    width: 32px;
    height: 32px;
    border: 3px solid var(--lightgray);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: training-progress-loading-spin 0.8s linear infinite;
}

.training_progress_loading [hidden] {
    display: none;
}

@keyframes training-progress-loading-spin {
    to { transform: rotate(360deg); }
}

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

.smartscore_progress_wrap {
    flex: 0 0 auto;
    padding: 32px 24px 0;
    background-color: var(--white);
}

.smartscore_progress_track {
    --smartscore-progress-color: var(--green);
    position: relative;
}

.smartscore_progress_track.streak_yellow {
    --smartscore-progress-color: var(--yellow);
}

.smartscore_progress_track.streak_orange {
    --smartscore-progress-color: var(--orange);
}

.smartscore_streak_notice {
    position: absolute;
    bottom: calc(100% + 4px);
    left: 0;
    z-index: 2;
    width: max-content;
    max-width: 100%;
    overflow: hidden;
    color: var(--smartscore-progress-color);
    font-size: clamp(12px, 1.8vw, 15px);
    font-weight: var(--main_bolder_weight);
    line-height: 16px;
    text-align: center;
    text-overflow: ellipsis;
    text-transform: uppercase;
    white-space: nowrap;
    opacity: 0;
    transform: translate(-50%, 4px);
    transition: left 0.3s ease, color 0.2s ease, opacity 0.15s ease, transform 0.15s ease;
    pointer-events: none;
}

.smartscore_streak_notice.visible {
    opacity: 1;
    transform: translate(-50%, 0);
}

.smartscore_progress {
    width: 100%;
    height: 14px;
    overflow: hidden;
    background-color: var(--gray);
    border-radius: 50vh;
}

.smartscore_progress_fill {
    display: block;
    position: relative;
    width: 0;
    height: 100%;
    overflow: hidden;
    background-color: var(--smartscore-progress-color);
    border-radius: 50vh;
    transition: width 0.3s ease, background-color 0.2s ease;
}

.smartscore_progress_fill::after {
    content: "";
    position: absolute;
    top: 3px;
    left: 7px;
    right: 7px;
    height: 3px;
    background-color: rgb(255 255 255 / 35%);
    border-radius: 50vh;
    pointer-events: none;
}

.training {
    flex-grow: 1;
    background-color: var(--white);
    padding: 32px 24px 24px 24px;
    font-size: 16px;
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.mobile_mode .training,
.mobile_mode .train_results {
    border-bottom-left-radius: 0 !important;
    border-bottom-right-radius: 0 !important;
}

.drob .training {
    padding-top: 24px;
}

.desc {
    font-size: 18px;
}

.desc h1 {
    margin-bottom: 10px;
    padding-bottom: 10px;
    border-bottom: 4px solid var(--accent);
    overflow-wrap: anywhere;
}

.second_nav {
    margin-top: 0;
    padding: 24px;
}

.rubric {
    color: var(--accent);
    font-weight: var(--main_bolder_weight);
    text-transform: uppercase;
    margin-bottom: 15px !important;
    margin-top: 0 !important;
}

.rubric + * {
    margin-top: 0 !important;
}

.desc h2,
.desc h3,
.desc h4,
.desc h5,
.desc h6 {
    font-family: var(--main_font);
    font-weight: 700;
    margin-bottom: 16px;
    margin-top: 48px;
}

.desc p {
    line-height: 1.6em;
    margin: 24px 0;
}

.desc ul li,
.desc ol li {
    margin-top: 14px;
}

.content_box {
    max-width: 728px;
    padding: 24px;
    background-color: var(--white);
    border-radius: var(--radius);
    border: var(--border);
}

.smartscore_skill_progress {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
    text-align: center;
}

.smartscore_skill_progress_summary {
    flex: 0 0 auto;
}

.smartscore_skill_progress_summary h3 {
    margin: 0 0 10px;
}

.smartscore_skill_progress_stars {
    display: flex;
    align-items: center;
    gap: 6px;
    line-height: 0;
}

.smartscore_skill_progress_star {
    flex: 0 0 auto;
    width: 40px;
    height: 40px;
    color: var(--lightgray_2);
    transition: color 0.2s ease;
}

.smartscore_skill_progress_star.earned {
    color: var(--yellow);
}

.smartscore_skill_progress_text {
    margin: 0;
    line-height: 1.5;
}

.other_links {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
}

.dot {
    margin: 0 6px;
}

.single_btn {
    padding: 16px !important;
    width: 100%;
    font-size: inherit;
    text-transform: none;
    font-weight: var(--main_bold_weight);
    display: flex;
    align-items: center;
    justify-content: center;
}

.single_btn.secondary {
    color: var(--main) !important;
}

.other_links .single_btn {
    min-width: 100%;
    max-width: 100%;
}

@media (min-width: 550px) {
    .other_links .single_btn {
        min-width: calc(50% - 12px);
        max-width: calc(50% - 12px);
    }
}

@media (min-width: 768px) {
    .other_grades .single_btn {
        min-width: calc(25% - 12px);
        max-width: calc(25% - 12px);
    }
}


.multiplier {
    color: var(--progress);
}

.correctAnswers,
.solved_count {
    color: var(--blue3);
}

.accuracy {
    color: var(--progress);
}

.time_spent {
    color: var(--secondary);
}

.best {
    color: var(--coral);
    display: inline-block;
    min-width: 4ch;
    font-variant-numeric: tabular-nums;
}

.timer,
.progress {
    position: absolute;
    left: 0;
    height: 7px;
    width: 0;
    transition: 0.2s linear width;
}

.progress {
    bottom: 0;
    background-color: var(--green);
}

.timer {
    top: 0;
    background-color: var(--blue3);
}

.multiplier_bar {
    background-color: var(--progress);
}

.descend {
    width: 100%;
    transition: none;
}

/* FULLSCREEN */
.only_fullscreen {
    display: none;
}

.training_fullscreen .main_wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0;
    position: fixed;
    z-index: 100;
    width: 100%;
    max-width: none;
    top: 0;
    bottom: 0;
    left: 0;
    right: 0;
    background-color: var(--secondary_background);
}

.training_fullscreen .stat_box_wrapper {
    align-self: center;
}

.training_fullscreen .only_fullscreen {
    display: flex;
}

.training_fullscreen .train_results {
    overflow-y: auto;
}

.training_fullscreen .test_action_tools_mobile {
    display: none;
}

.training_fullscreen .training_side {
    align-self: center;
}

.switch_full_mobile {
    position: absolute;
    top: 5px;
    right: 5px;
}

/* SOUND */

.switch_sound,
.btn.switch_fullscreen {
    height: 48px;
    width: 48px;
    display: flex;
    padding: 0 !important;
}

.switch_sound img {
    width: 25px;
    display: none;
    vertical-align: middle;
}

.switch_sound img:nth-child(1) {
    display: block;
}

.no_sound .switch_sound img:nth-child(2) {
    display: block;
}

.no_sound .switch_sound img:nth-child(1) {
    display: none;
}


/* RESULTS */

.train_results {
    flex-grow: 1;
    background-color: var(--white);
    padding: 32px 24px 24px 24px;
    font-size: 16px;
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.train_results .box,
.settings .box {
    width: 100%;
    position: relative;
    padding: 24px 16px;
    text-align: center;
}

#perfectAnimWrapper {
    z-index: 1000;
    width: 100%;
    top: 0;
    position: fixed;
    pointer-events: none;
}

.train_results {
    display: none;
}

.smartscore_result_stars {
    gap: 12px;
}

.smartscore_result_star {
    width: clamp(42px, 7vw, 64px);
    height: auto;
    color: var(--lightgray_2);
    transition: color 0.2s ease;
}

.smartscore_result_star.earned {
    color: var(--yellow);
}

.show_results .train_results {
    display: flex;
}

.show_results .smartscore_progress_wrap {
    display: none;
}

.show_results .training,
.show_results .keypad {
    display: none !important;
}

.bignum {
    font-size: calc(1.5rem + 0.7vh + 1.5vw);
}

/* RESULT */

.train_results .box {
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.train_results .box h3,
.train_results .box {
    border: none;
    color: var(--white);
}

.res_correct,
.res_solved {
    background-color: var(--blue3);
}

.res_percent {
    background-color: var(--progress);
}

.res_time_spent {
    background-color: var(--turq);
}

.res_xp {
    background-color: var(--xp);
}

.res_avg_time {
    background-color: var(--orange);
}

.record {
    display: none;
    font-weight: var(--main_boldest_weight);
    font-size: 17px;
}

.current_record {
    position: absolute;
    top: 16px;
    font-weight: var(--main_boldest_weight);
    left: 16px;
}

.current_record ~ .bignum {
    margin-top: 15px;
}

.coin_progress {
    display: inline-block;
    position: relative;
    background-color: var(--gray);
    border-radius: 50vh;
    height: 12px;
    overflow: hidden;
    width: 100%;
}

.coin_progress span {
    display: inline-block;
    background-color: var(--yellow);
    height: inherit;
    position: absolute;
    width: 0;
    left: 0;
}

.xp_counter {
    width: 100%;
    background-color: var(--white);
    border-bottom-width: 4px;
    padding: 24px 16px;
    text-align: center;
}

.xp_counter .session_xp,
.xp_counter .coin {
    font-size: 17px;
    font-weight: var(--main_bolder_weight);
}

.xp_counter img {
    margin-right: 6px;
    height: 27px;
}

.xp_per_correct {
    font-size: 13px;
    background-color: var(--transp_green);
    color: var(--green);
    padding: 7px 5px;
    width: 100%;
    max-width: 210px;
    text-align: center;
    font-weight: var(--main_bolder_weight);
    border-radius: 1000px;
}

.earned_coin img {
    height: 27px !important;
    margin-right: 0;
    margin-left: 15px;
}


.settings select {
    text-align: center;
    border-radius: var(--radius);
    border: var(--border);
    border-bottom-width: 4px;
    padding: 10px 15px;
    cursor: pointer;
    max-width: 130px;
}

.settings #glagoly_mode,
.settings #glagoly_forms {
    max-width: 100%;
}

@media (max-width: 473px) {
    .settings #glagoly_forms {
        font-size: 14px;
        padding-left: 8px;
        padding-right: 8px;
    }
}


.button_row {
    display: flex;
    justify-content: center;
}

.button_row .btn::before {
    border-radius: 0;
}

.button_row .btn:first-child:before {
    border-top-left-radius: var(--radius);
    border-bottom-left-radius: var(--radius);
}

.button_row .btn:last-child:before {
    border-bottom-right-radius: var(--radius);
    border-top-right-radius: var(--radius);
}

.btn.hide {
    display: none !important;
}

.progress-bar {
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
    width: 55px;
    height: 55px;
    font-size: 19px;
    border-radius: 50%;    
    color: var(--green);
    font-weight: var(--main_bolder_weight);
}

.progress-ring {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    overflow: visible;
    transform: rotate(-90deg);
}

.progress-ring-track,
.progress-ring-value {
    stroke-width: 7;
}

.progress-ring-track {
    fill: var(--white);
    stroke: var(--secondary_background1);
}

.progress-ring-value {
    fill: none;
    stroke: currentColor;
    transition: stroke-dashoffset 0.2s linear;
}

.progress-bar-label {
    position: relative;
    z-index: 1;
}

#total_train_progress .xp {
    font-size: 18px;
} 

.next_prev_train {
    margin-left: auto;
    margin-right: auto;
    max-width: 728px;
}

.next_prev_train .sec {
    font-size: 14px;
}

.next_prev_train .training_name {
    margin-top: 12px;
    font-weight: var(--main_bolder_weight);
}

.next_prev_train .box {
    background-color: var(--white);
    border-bottom-width: 4px;
    height: 100%;
}

.next_prev_train .spacer {
    width: calc(50% - 12px);
    flex-shrink: 0;
}


.prev_training svg {
    rotate: 180deg;
}

.error_row {
    border-top: var(--border);
    padding: 16px 0;
}

.error_row h3 {
    font-weight: 600;
    font-family: var(--main);
    font-size: 19px;
}

.error_row p {
    margin: 10px 0 0 0;
}

.error_count {
    color: var(--blue3);
    background-color: var(--lightblue);
    min-width: 25px;
    display: flex;
    padding: 0 5px;
    min-height: 25px;
    border-radius: 50vh;
    align-items: center;
    justify-content: center;
    font-size: 16px;
}

@media (max-width: 473px) {
    #total_train_progress {
        flex-direction: column-reverse;
    }
    .next_wrap_train {
        flex-direction: column-reverse;
        gap: 15px;
    }
}

@media (max-width: 767px) {
    .main_wrapper {
        flex-direction: column-reverse;
        padding: 0;
        min-height: calc(100svh - var(--nav_height));
        gap: 0;
        margin-top: 0;
    }
    .second_nav {
        display: none;
    }
    .stat_box_wrapper {
        width: 100%;
        max-width: 100%;
        min-width: 0;
    }
    .training_side {
        flex: 0 0 auto;
        width: 100%;
    }
    .train_stat > [data-cell] {
        flex: 1 0 auto;
        position: relative;
    }
    /* Keep the labels available to screen readers without a second row. */
    .train_stat .stat_header {
        position: absolute;
        width: 1px;
        height: 1px;
        padding: 0;
        border: 0;
        overflow: hidden;
        clip-path: inset(50%);
        white-space: nowrap;
    }
    .train_stat .stat_section:not(.stat_header) {
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 4px;
        height: var(--training-stat-height);
        padding: 0 4px;
        border-bottom: 0;
        white-space: nowrap;
    }
    .train_stat [data-cell="xp"] .stat_section > .alc {
        display: contents;
    }
    .train_stat .stat_num {
        min-width: 0;
        font-size: clamp(14px, 4vw, 20px);
        line-height: 1;
        font-variant-numeric: tabular-nums;
    }
    .train_stat .stat_section img {
        flex: 0 0 auto;
        width: 20px;
        height: 20px;
        margin: 0;
    }
    .train_stat > [data-cell="correct"],
    .train_stat > [data-cell="solved_count"] {
        --stat-icon: url("../../img/icons/mark.svg");
        --stat-icon-color: var(--blue3);
    }
    .train_stat > [data-cell="record"] {
        --stat-icon: url("../../img/icons/star.svg");
        --stat-icon-color: var(--coral);
    }
    .train_stat > [data-cell="time_spent"],
    .train_stat > [data-cell$="_time"] {
        --stat-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='9'/%3E%3Cpath d='M12 6v6l4 2'/%3E%3C/svg%3E");
        --stat-icon-color: var(--secondary);
    }
    .train_stat > [data-cell$="_level"] {
        --stat-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M3 20v-6h6V8h6V3h6v17Z'/%3E%3C/svg%3E");
        --stat-icon-color: var(--progress);
    }
    .train_stat > [data-cell]:not([data-cell="xp"]):not([data-cell="multiplier"]) .stat_section:not(.stat_header)::before {
        content: "";
        flex: 0 0 18px;
        width: 18px;
        height: 18px;
        background-color: var(--stat-icon-color, var(--secondary));
        -webkit-mask: var(--stat-icon) center / contain no-repeat;
        mask: var(--stat-icon) center / contain no-repeat;
    }
    .train_stat {
        font-size: 13px;
        display: flex;
        align-items: center;
        height: var(--training-stat-height);
        border: 0;
        border-radius: 0;
    }
    .train_stat .switch_full_mobile {
        position: static;
        flex: 0 0 36px;
        height: var(--training-stat-height);
    }
    .stat_box_wrapper .xp_counter {
        display: none;
    }
    .next_prev_train {
        flex-direction: column;
    }
    .next_prev_train .spacer {
        width: 100%;
    }

    .navbar {
        position: static;
    }
    .teacher-role .teacher.teacher_nav {
        width: 100%;
        display: flex !important;
        justify-content: flex-end;
        position: static;
        background-color: var(--white);
        border-bottom: var(--border);
    }
    .teacher_nav .assign_task {
        border: 0;
    }
    body {
        padding-top: 0;
    }
}

@media (min-width: 768px) {
    .navbar {
        display: block;
    }

    .content_box {
        margin-left: auto;
        margin-right: auto;
        border-bottom-width: 4px;
    }

    .training {
        padding: 32px;
    }

    .training_wrapper {
        min-height: calc(100vh - var(--nav_height) - 100px);
        border: var(--border);
        border-radius: var(--radius);
        border-bottom-width: 4px;
    }

    .keypad section:last-child {
        border-bottom-left-radius: var(--radius);
        border-bottom-right-radius: var(--radius);
    }
    .stat_section .stat_num {
        font-size: 25px;
    }
}

@media (min-height: 953px) {
    .training_wrapper {
        min-height: 753px;
    }
}

/* Tinkumo curriculum layout. */
.training_content {
    flex: 1;
    min-width: 0;
    width: 100%;
    container: training-content / inline-size;
}

.training_details {
    width: 100%;
    padding-left: 24px;
    padding-right: 24px;
}

.training_content .save_progress_prompt {
    margin-left: auto;
    margin-right: auto;
}


.training_layout { display: flex; }
.training_wrapper { min-width: 0; }
.training_details .content_box { border: var(--border); border-bottom-width: 4px; border-radius: var(--radius); }
@container training-content (max-width: 767px) {
    .main_wrapper {
        flex-direction: column-reverse;
        gap: 16px;
    }

    .stat_box_wrapper {
        width: 100%;
        max-width: 100%;
        min-width: 0;
    }

    .train_stat {
        display: flex;
        font-size: 13px;
    }

    .train_stat > div {
        flex: 1;
        min-width: 0;
    }

    .stat_section:not(.stat_header) {
        border-bottom: 0;
    }

    .stat_box_wrapper .xp_counter {
        display: none;
    }

    .training_content > .container.mobile {
        display: block !important;
    }
}

@media (max-width: 767px) {
    .training_content .main_wrapper { gap: 0; }
}
/* Skill progress uses the same score and three-star result as Obrazavr. */
html.training-progress-pending .training-best-stars { visibility: hidden; }
.training-stars { display: inline-flex; align-items: center; gap: 6px; line-height: 0; color: var(--lightgray_2); }
.training-stars svg { flex: 0 0 auto; transition: color .2s ease; }
.training-stars .earned { color: var(--yellow); }
.training-result-stars { margin: 12px auto; gap: 12px; }
.training-result-stars svg { width: clamp(42px, 7vw, 64px); height: auto; }
.training-best-stars { margin-top: 16px; }
.training-stars-description { margin: 12px 0 24px; color: var(--secondary); line-height: 1.6; }
.uses-smartscore .train_stat [data-cell="multiplier"], .uses-smartscore .train_stat [data-cell="record"],
.uses-smartscore .training > .progress, .uses-smartscore .training > .timer { display: none; }
.training-save-status[hidden] { display: none; }
