.task_view_content {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.task_select_container {
    display: contents;
}

.task_instruction_label {
    text-align: center;
    color: var(--c-text-muted);
    font-weight: 600;
    font-size: 16px;
    margin-bottom: 16px;
    flex-shrink: 0;
}

.main_image_holder {
    margin-bottom: 20px;
    text-align: center;
    width: 100%;
    flex-shrink: 0;
}

.task_question_text {
    font-size: 25px;
    font-weight: 800;
    line-height: 1.3;
    margin-bottom: 10px;
    margin-top: 10px;
}

.task_hero_img {
    height: clamp(100px, 20vh, 200px);
    width: auto;
    max-width: 100%;
    object-fit: contain;
    border-radius: 16px;
    border: 2px solid var(--c-border);
}

.options_list {
    display: flex;
    flex-direction: column;
    width: 100%;
    max-width: 480px;
    margin: 0 auto;
}

.options_list>*+* {
    margin-top: 10px;
}

.btn_cant_listen {
    background: none;
    border: none;
    color: var(--c-text-muted);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    text-decoration: underline;
    margin: 0 auto;
    display: block;
    margin: 24px auto 0 auto;
    opacity: 0.8;
    transition: opacity 0.2s;
}

.options_grid {
    display: flex;
    flex-wrap: wrap;
    width: 100%;
    margin: 0 auto;
    flex-shrink: 1;
    min-height: 0;
    max-width: calc((100vh - var(--header-height) - var(--footer-height) - 180px) * 0.9);
    max-width: min(calc((100vh - var(--header-height) - var(--footer-height) - 180px) * 0.9), 500px);
}

.c_option {
    justify-content: center;
    text-align: center;
    background-color: var(--c-bg-card);
    font-weight: 600;
}

.c_option:hover {
    cursor: pointer;
}

.options_grid .c_option {
    width: 50%;
    padding: 6px;
    box-sizing: border-box;
    background: transparent;
    border: none;
    flex-direction: column;
}

.c_image_card_content {
    background-color: var(--c-bg-card);
    border: 3px solid var(--c-border);
    border-bottom-width: 4px;
    border-radius: 12px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    width: 100%;
    transition: all 0.2s;
}

.c_option.is_selected .c_image_card_content {
    border-color: var(--c-accent-blue);
    background-color: rgba(24, 101, 242, 0.1);
}

.c_option_img_wrap {
    position: relative;
    width: 100%;
    padding-bottom: 100%;
    background-color: #fff;
}

.c_option_img {
    position: absolute;
    /*
    top: 5%;
    left: 5%;
    width: 90%;
    height: 90%;
*/
    top: 0px;
    left: 0px;
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.c_option_footer {
    display: flex;
    align-items: center;
    padding: 8px 10px;
    min-height: 40px;
}

.c_option:not(.is_image_card) {
    width: 100%;
    box-sizing: border-box;
    border: 2px solid var(--c-border);
    border-bottom-width: 4px;
    border-radius: 12px;
    padding: 14px 18px;
    display: flex;
    align-items: center;
}

.c_option.is_selected:not(.is_image_card) {
    border-color: var(--c-accent-blue);
    background-color: rgba(24, 101, 242, 0.15);
}

.c_option.is_disabled {
    pointer-events: none;
}

.c_option_text {
    font-size: 16px;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;

    white-space: normal;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.question_with_audio {
    display: flex;
    align-items: center;
    justify-content: center;
}

.question_with_audio>*+* {
    margin-left: 12px;
}

.question_with_audio .task_question_text {
    margin-bottom: 0;
}

.gap_question_hint {
    margin-bottom: 12px;
    color: var(--c-text-muted);
    font-size: 16px;
    text-align: center;
}

.c_token_container.is_centered {
    justify-content: center;
}

.task_view_matching {
    display: flex;
    flex-direction: column;
    width: 100%;
    max-height: calc(100vh - var(--header-height) - var(--footer-std-height) - 100px);
    flex-shrink: 1;
    min-height: 0;
    margin-top: 10px;
}

.match_grid {
    display: flex;
    width: 100%;
    max-width: 600px;
    margin: 0 auto;
}

.match_column {
    display: flex;
    flex-direction: column;
    width: calc(50% - 8px);
    min-height: 0;
}

.match_column+.match_column {
    margin-left: 16px;
}

.c_match_item {
    background-color: var(--c-bg-card);
    border: 2px solid var(--c-border);
    border-bottom: 4px solid #3e3e3e;
    border-radius: 14px;
    padding: 12px;
    font-weight: 700;
    font-size: 16px;
    transition: all 0.1s;
    min-height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
}

.c_match_item+.c_match_item {
    margin-top: 10px;
}

.c_match_item:hover {
    border-color: var(--c-border-hover);
    transform: scale(1.02);
}

.c_match_item.is_selected {
    border-color: var(--c-accent-blue);
    background-color: rgba(24, 101, 242, 0.15);
}

.c_match_item.is_solved {
    opacity: 0.4;
    pointer-events: none;
    background-color: #222;
    border-color: transparent;
    color: #aaa;
}

.match_audio_icon {
    width: 28px;
    height: 28px;
    fill: #ffffff;
    display: block;
}

.c_match_item.is_error {
    animation: shake_match 0.4s ease-in-out;
    border-color: #ff4b4b !important;
    border-bottom-color: #ff4b4b !important;
    color: #ff4b4b !important;
    background-color: rgba(255, 75, 75, 0.1) !important;
}

@keyframes shake_match {

    0%,
    100% {
        transform: translateX(0);
    }

    20%,
    60% {
        transform: translateX(-6px);
    }

    40%,
    80% {
        transform: translateX(6px);
    }
}


/* --- Таблицы в грамматическом контенте --- */
.text_only_rich_text table,
.split_rich_text table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    border-radius: 10px;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.1);
    margin: 16px 0;
    font-size: 14px;
}

.text_only_rich_text th,
.split_rich_text th {
    background: rgba(255, 255, 255, 0.08);
    color: #fff;
    font-weight: 800;
    text-transform: uppercase;
    font-size: 12px;
    letter-spacing: 0.5px;
    padding: 12px 14px;
    text-align: left;
    border-bottom: 2px solid rgba(255, 255, 255, 0.12);
}

.text_only_rich_text td,
.split_rich_text td {
    padding: 10px 14px;
    color: rgba(255, 255, 255, 0.85);
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    line-height: 1.5;
}

.text_only_rich_text tr:last-child td,
.split_rich_text tr:last-child td {
    border-bottom: none;
}

.text_only_rich_text tr:hover td,
.split_rich_text tr:hover td {
    background: rgba(255, 255, 255, 0.03);
}

.text_only_rich_text td b,
.split_rich_text td b {
    color: var(--c-accent-green);
    font-weight: 800;
}

/* Убираем встроенный border="1" */
.text_only_rich_text table[border],
.split_rich_text table[border] {
    border-style: solid;
    border-color: rgba(255, 255, 255, 0.1);
}

.text_only_rich_text td,
.text_only_rich_text th,
.split_rich_text td,
.split_rich_text th {
    border-left: none;
    border-right: none;
    border-top: none;
}

@media (max-height: 700px) {
    .l_main {
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }

    .task_view_content {
        padding-bottom: 20px;
    }

    .task_view_content .main_image_holder {
        margin-bottom: 8px;
    }

    .task_instruction_label {
        margin-bottom: 4px;
        font-size: 14px;
    }

    .options_grid {
        max-width: 100%;
    }

    .options_grid .c_option {
        padding: 4px;
    }

    .c_option_img_wrap {
        padding-bottom: 70%;
        background-color: var(--c-bg-card);
    }
    .l_main {
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        -webkit-box-pack: start;
        -ms-flex-pack: start;
        justify-content: flex-start;
    }

    .task_wrapper {
        -webkit-box-pack: start;
        -ms-flex-pack: start;
        justify-content: flex-start;
    }
}

