/* Основной контейнер на весь экран */
.task_view_assemble {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    /* Расталкивает блоки: верх, центр, низ */
    height: 100%;
    min-height: 450px;
    width: 100%;
    max-width: var(--content-max-width);
    margin: 0px auto;
    /* Чтобы на маленьких экранах не схлопывалось */
    box-sizing: border-box;
}

.task_view_assemble .task_char_head {
    width: 64px;
    height: 64px;
}

/* Верхняя область подсказки */
.assemble_prompt_area {
    padding: 10px 0 20px 0;
    text-align: center;
}

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

/* Контейнер кнопок звука */
.audio_controls_group {
    display: flex;
    margin-left: 10px;
}

/* Центральная зона сборки (рабочая область) */
.assemble_sentence_area {
    flex-grow: 1;
    /* Занимает всё свободное пространство */
    display: flex;
    flex-wrap: wrap;
    align-content: center;
    justify-content: center;

    padding: 10px;
    margin: 10px 0;
    border-top: 2px solid var(--c-border);
    border-bottom: 2px solid var(--c-border);

    /* Эмуляция gap 8px */
    margin-left: -4px;
    margin-right: -4px;
}

/* Нижний банк слов */
.assemble_bank_area {
    padding: 20px 0;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    /* Эмуляция gap 10px */
    margin-left: -5px;
    margin-right: -5px;
}

/* Профессиональные "Чипы" (кнопки слов) */
.c_chip_option,
.c_chip_sentence {
    margin: 5px;
    /* Замена gap */
    padding: 12px 20px;
    border-radius: 14px;
    font-size: 18px;
    font-weight: 600;
    cursor: pointer;
    border: none;
    background-color: var(--c-bg-card, #ffffff);
    color: var(--c-text-main, #333);

    /* Эффект объема */
    box-shadow: 0 3px 0 var(--c-border, #ddd);
    transition: transform 0.1s, box-shadow 0.1s;
    user-select: none;
}

.c_chip_option:active {
    transform: translateY(2px);
    box-shadow: 0 1px 0 var(--c-border);
}

/* Выбранное слово (вверху) */
.c_chip_sentence {
    background-color: var(--c-accent-blue);
    color: #fff;
    box-shadow: 0 3px 0 #3275d8;
}

/* Использованное слово (внизу) */
.c_chip_option.is_used {
    background-color: #e0e0e0;
    color: #e0e0e0;
    opacity: 0.3;
    box-shadow: none;
    pointer-events: none;
}


@media (max-height: 855px) {

    .c_chip_option,
    .c_chip_sentence {
        margin: 5px;
        padding: 10px 18px;
        border-radius: 14px;
        font-size: 16px;
    }
}

@media (max-height: 780px) {

    .c_chip_option,
    .c_chip_sentence {
        margin: 4px;
        padding: 8px 16px;
        border-radius: 14px;
        font-size: 14px;
    }

    .assemble_sentence_area {
        margin: 5px 0;
    }

    .task_view_assemble {
        min-height: 400px;
    }
}




/* Основной контейнер */
.task_view_gap {
    display: flex;
    flex-direction: column;
    height: 100%;
    justify-content: space-between;
}

/* Верхняя часть: Инструкция и Аудио */
.gap_top_content {
    text-align: center;
    padding-top: 10px;
}

/* Стилизация пропуска в предложении */
.gap_sentence_box {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    padding: 40px 20px;
    font-size: 22px;
    line-height: 2;
    flex-grow: 1; /* Центрирует предложение по вертикали */
}

.gap_placeholder {
    display: inline-block;
    min-width: 40px;
    padding: 2px 8px;
    margin: 0 4px;
    vertical-align: baseline;
    border-bottom: 3px solid #60a5fa;
    border-radius: 4px 4px 0 0;
    font-size: 0px;
    line-height: 1.4em;
    animation: gap_blink 1.5s ease-in-out infinite;
}


@keyframes gap_blink {
    0%, 100% { border-color: #60a5fa; }
    50% { border-color: rgba(96, 165, 250, 0.3); }
}

.gap_filled_readonly {
    display: inline-block;
    padding: 2px 8px;
    border-bottom: 2px solid rgba(255,255,255,0.3);
    color: #60a5fa;
    font-weight: 700;
    min-width: 20px;
    text-align: center;
}

/* Заполненный пропуск */
.gap_filler {
    display: inline-block;
    padding: 2px 12px;
    margin: 0 5px;
    background-color: transparent;
    color: var(--c-accent-blue, #2b7de9);
    border-bottom: 2px solid var(--c-accent-blue, #2b7de9);
    font-weight: bold;
    cursor: pointer;
    animation: gapPop 0.2s cubic-bezier(0.18, 0.89, 0.32, 1.28);
}

@keyframes gapPop {
    0% { transform: scale(0.9); opacity: 0; }
    100% { transform: scale(1); opacity: 1; }
}

/* Сетка вариантов ответа */
.gap_options_row {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    padding-bottom: 30px;
    margin: 0 -5px; /* Компенсация margin кнопок */
}

.gap_bottom_content {
    flex-shrink: 0;
}


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

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

.gap_filled_active {
    background-color: var(--c-accent-blue);
    color: white;
    font-weight: 700;
    font-size: 19px;
    padding: 4px 12px;
    border-radius: 8px;
    margin: 0 4px;
    display: inline-block;
    cursor: pointer;
    animation: popIn 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    box-shadow: 0 4px 10px rgba(24, 101, 242, 0.3);
    border-bottom: 2px solid transparent;
}

.gap_filled_active:hover {
    background-color: #3a7ff5;
    transform: translateY(-1px);
}

.is_hidden {
    display: none !important;
}

.gap_question_hint {
    font-size: 1.4rem;
    font-weight: 600;
    color: #2b7de9;
    color: var(--c-text-muted);
    text-align: center;
    margin: 0;
    line-height: 1.3;
}



.task_view_input {
    display: flex;
    flex-direction: column;
    flex-grow: 1;
    justify-content: center;
    max-width: 600px;
    margin: 0 auto;
    width: 100%;
    padding-bottom: 20px;
}

.task_view_input .task_char_row {
    -webkit-box-align: start;
    -ms-flex-align: start;
    align-items: flex-start;
}

.task_view_input .task_char_head {
    width: 64px;
    height: 64px;
    margin-top: 6px;
}

.input_top_content {
    margin-bottom: 32px;
    text-align: center;
}

.input_area_wrapper {
    width: 100%;
    margin-bottom: 20px;
}

.c_input_field {
    width: 100%;
    background-color: var(--c-bg-card);
    border: 2px solid var(--c-border);
    border-radius: 16px;
    padding: 20px;
    font-family: inherit;
    font-size: 19px;
    font-weight: 500;
    color: var(--c-text-main);
    resize: none;
    outline: none;
    transition: all 0.2s ease-in-out;
}

.c_input_field:focus {
    border-color: var(--c-accent-blue);
    background-color: #252525;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.c_input_field::placeholder {
    color: var(--c-text-muted);
    opacity: 0.6;
}


.task_view_inline {
    display: flex;
    flex-direction: column;
    flex-grow: 1;
    justify-content: center;
    align-items: center;
    max-width: 600px;
    margin: 0 auto;
    padding-bottom: 40px;
}

.inline_sentence_box {
    font-size: 24px;
    font-weight: 600;
    line-height: 2;
    text-align: center;
    color: var(--c-text-main);
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    justify-content: center;
    gap: 0;
}

.c_inline_input {
    background: transparent;
    border: none;
    outline: none;
    padding: 0 2px;
    margin: 0 6px;
    font-family: inherit;
    font-size: inherit;
    font-weight: 800;
    color: var(--c-accent-blue);
    text-align: center;
    border-bottom: 2px solid var(--c-border-hover);
    border-radius: 4px 4px 0 0;
    background-color: rgba(255, 255, 255, 0.05);
    box-sizing: content-box;
    min-width: 60px;
    max-width: 250px;
    transition: width 0.1s ease, border-color 0.2s, background-color 0.2s;
}

.c_inline_input:focus {
    border-bottom-width: 3px;
    border-bottom-color: var(--c-accent-blue);
    background-color: rgba(24, 101, 242, 0.15);
}

.c_inline_input {
    text-overflow: ellipsis;
}

.c_inline_input.has_error {
    border-bottom-color: var(--c-accent-red);
    color: var(--c-accent-red);
}


.task_char_row {
    display: -webkit-box;
    display: -ms-flexbox;
    display: flex;
    -webkit-box-align: center;
    -ms-flex-align: center;
    align-items: center;
    -webkit-box-pack: center;
    -ms-flex-pack: center;
    justify-content: center;
    min-height: 70px;
}

.task_char_head {
    width: 52px;
    height: 52px;
    -ms-flex-negative: 0;
    flex-shrink: 0;
    margin-right: 12px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.05);
    border: 2px solid rgba(255, 255, 255, 0.1);
    padding: 4px;
    animation: char_breathe 3s ease-in-out infinite;
}

.task_char_row > .c_token_container {
    display: -webkit-box;
    display: -ms-flexbox;
    display: flex;
    -webkit-box-flex: 1;
    -ms-flex: 1;
    flex: 1;
    min-width: 0;
}

@keyframes char_breathe {
    0%, 100% { transform: translateY(0) scale(1); }
    50% { transform: translateY(-3px) scale(1.03); }
}

@media (max-width: 400px) {
    .task_char_head {
        width: 40px;
        height: 40px;
        margin-right: 8px;
    }
}

/* Нажатие — монетка крутится */
.task_char_head:active {
    animation: char_flip 0.6s ease;
}

@keyframes char_flip {
    0% { transform: rotateY(0deg) scale(1); }
    50% { transform: rotateY(180deg) scale(0.9); }
    100% { transform: rotateY(360deg) scale(1); }
}

/* Верный ответ — подпрыгивает и светится */
.task_char_head.is_correct {
    animation: char_correct 0.7s ease;
}

@keyframes char_correct {
    0% { transform: translateY(0) rotate(0deg); }
    25% { transform: translateY(-12px) rotate(-8deg); }
    50% { transform: translateY(-6px) rotate(6deg); }
    75% { transform: translateY(-2px) rotate(-3deg); }
    100% { transform: translateY(0) rotate(0deg); }
}

/* Неверный ответ — трясётся и краснеет */
.task_char_head.is_wrong {
    animation: char_wrong 0.5s ease;
}

@keyframes char_wrong {
    0% { transform: translateX(0); filter: hue-rotate(0deg); }
    20% { transform: translateX(-6px) rotate(-5deg); filter: hue-rotate(-30deg) saturate(2); }
    40% { transform: translateX(6px) rotate(5deg); }
    60% { transform: translateX(-4px) rotate(-3deg); }
    80% { transform: translateX(4px) rotate(3deg); }
    100% { transform: translateX(0) rotate(0); filter: hue-rotate(0deg) saturate(1); }
}
