/* --- training_process/stage_1.css --- */

/* =========================================
   1. ОСНОВНОЙ ЛЕЙАУТ И КОНТЕЙНЕРЫ
   ========================================= */

/* Фикс для 100% высоты экрана без скролла */
html,
body {
    height: 100%;
    margin: 0;
}


#app {
    height: 100%;
    display: flex;
    flex-direction: column;
}





/* Основной контейнер тренажера */
.training-view-container {
    padding-top: 5px !important;
    padding-bottom: 5px !important;
    height: 100vh;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
}

.training-layout {
    display: flex;
    flex-direction: column;
    padding: 10px;
    position: relative;
    flex: 1;
    /* Растягиваем на доступную высоту */
    overflow: hidden;
    /* Скрываем лишнее */
}

/* Карточка тренажера */
.card-training {
    background-color: var(--paper-color);
    text-align: center;
    padding: 10px 15px !important;
    /* Компактные отступы */
    border-radius: 10px;
    margin: 0 !important;
    /* Убираем внешние отступы */
    border: 1px solid #e0e0e0;
    transition: transform 0.1s;
    display: flex;
    flex-direction: column;
    max-height: calc(100vh - 60px);
    /* Ограничение высоты */
}

/* =========================================
   2. ШАПКА (HEADER)
   ========================================= */

.main-header-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    margin-bottom: 5px !important;
    /* Компактнее */
    padding: 2px 10px !important;
    height: 48px !important;
    /* Фиксированная высота для стабильности */
    min-height: 48px !important;
    gap: 10px;
}

.main-header-bar h1 {
    font-size: 1.2rem !important;
    /* Уменьшенный шрифт заголовка */
    color: var(--accent-color);
    margin: 0;
    text-align: center;
    flex-grow: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Кнопка "Домой" */
#exit-to-menu-icon {
    display: block;
    width: 44px;
    height: 44px;
    cursor: pointer;
    color: var(--accent-color);
    opacity: 0.7;
    padding: 8px;
    border-radius: 50%;
    transition: all 0.2s;
    user-select: none;
    flex-shrink: 0;
}

#exit-to-menu-icon svg {
    width: 100%;
    height: 100%;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

#exit-to-menu-icon:hover {
    opacity: 1;
    background-color: rgba(0, 0, 0, 0.05);
    transform: scale(1.05);
}

/* Кнопка "Далее" (Стрелка) */
.next-arrow-button {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.3s ease;
    flex-shrink: 0;
    background-color: white;
    border: 2px solid #2980b9;
    color: #2980b9;
    opacity: 0.7;
    pointer-events: none;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
}

.next-arrow-button svg {
    width: 24px;
    height: 24px;
    stroke: currentColor;
    stroke-width: 2.5;
    stroke-linecap: round;
    stroke-linejoin: round;
    fill: none;
    transition: all 0.2s ease;
}

.next-arrow-button.ready {
    opacity: 1;
    pointer-events: auto;
    animation: pulse-arrow 1.5s infinite ease-in-out;
}

.next-arrow-button.ready:hover {
    background-color: #2980b9;
    color: white;
    transform: scale(1.05);
    animation-play-state: paused;
}

@keyframes pulse-arrow {
    0% {
        opacity: 1;
        box-shadow: 0 0 4px rgba(41, 128, 185, 0.4);
    }

    50% {
        opacity: 1;
        box-shadow: 0 0 12px rgba(41, 128, 185, 1);
    }

    100% {
        opacity: 1;
        box-shadow: 0 0 4px rgba(41, 128, 185, 0.4);
    }
}

/* =========================================
   3. ВНУТРЕННЯЯ ПАНЕЛЬ ИНСТРУМЕНТОВ
   ========================================= */

.training-layout-static-header {
    flex-shrink: 0;
    min-height: 40px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 5px;
    margin-bottom: 5px;
    border-bottom: 1px solid #eee;
    padding-bottom: 5px;
}

.training-header-left {
    display: flex;
    align-items: center;
    gap: 15px;
}

.training-header-right {
    display: flex;
    align-items: center;
    gap: 15px;
    position: relative;
}

/* Кнопка настроек */
.settings-button {
    background: none;
    border: none;
    font-size: 1.5em;
    cursor: pointer;
    color: #888;
    padding: 0 5px;
}

.settings-button:hover {
    color: var(--accent-color);
}

/* Поповер настроек */
.training-settings-popover {
    position: absolute;
    top: 100%;
    right: 0;
    background-color: var(--paper-color);
    border: 1px solid #ccc;
    border-radius: 6px;
    padding: 10px 15px;
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.15);
    z-index: 100;
    display: none;
    font-size: 0.9em;
    white-space: nowrap;
}

.training-settings-popover.visible {
    display: block;
}

.training-settings-popover div {
    margin-bottom: 5px;
}

.training-settings-popover div:last-child {
    margin-bottom: 0;
}

/* Счет и прогресс */
/* 2. ПОЗИЦИОНИРОВАНИЕ ПРОГРЕССА И СЧЕТА */
.score-display-inline {
    font-size: 0.9em;
    color: var(--accent-color);
    font-weight: 500;
    white-space: nowrap;
}

/* Стили для кнопки настроек и попапа внутри индикатора кругов */
.progress-indicator .settings-button {
    position: absolute;
    right: 15px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 1.3em;
    cursor: pointer;
    background: none;
    border: none;
    padding: 4px;
    color: #888;
    z-index: 100;
    transition: color 0.2s, transform 0.2s;
}

.progress-indicator .settings-button:hover {
    color: var(--accent-color);
    transform: translateY(-50%) scale(1.1);
}

.progress-indicator .training-settings-popover {
    position: absolute;
    top: 100%;
    right: 10px;
    background-color: var(--paper-color);
    border: 1px solid #ccc;
    border-radius: 6px;
    padding: 10px 15px;
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.15);
    z-index: 1000;
    display: none;
    font-size: 0.9em;
    white-space: nowrap;
    letter-spacing: normal;
}

.progress-indicator .training-settings-popover.visible {
    display: block;
}

/* Отдельная панель для очков */
.score-panel-row {
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    margin: 5px 0 10px 0;
    flex-shrink: 0;
}

/* Переключатели отображения очков по умолчанию (для ПК) */
.desktop-only-score {
    display: inline-block;
}

.mobile-only-score {
    display: none;
}



.progress-indicator {
    position: relative;
    /* Делаем этот блок "якорем" */
    display: flex;
    justify-content: center;
    /* Кружочки будут строго по центру */
    align-items: center;
    width: 100%;
    margin-bottom: 5px;
    font-size: 18px;
    color: var(--accent-color);
    letter-spacing: 0.15em;
    height: 32px !important;
    /* Фиксированная высота для стабильности */
    min-height: 32px !important;
}

/* Класс для виджета счета (чтобы он встал справа) */
.global-score-widget-wrapper {
    position: absolute;
    /* Вынимаем из потока */
    right: 10px;
    /* Прибиваем к правому краю */
    top: 50%;
    transform: translateY(-50%);
    /* Центрируем по вертикали */
    font-size: 0.9rem;
    /* Размер шрифта виджета */
    letter-spacing: normal;
    /* Сбрасываем разрядку букв, которая есть у кружочков */
    z-index: 10;
}

/* =========================================
   4. КОНТЕНТ (СЛОВО, ПЕРЕВОДЫ)
   ========================================= */

.training-layout-dynamic-content {
    flex-grow: 1;
    flex-shrink: 1;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    /* Подтягиваем вверх */
    align-items: center;
    padding: 5px;
    overflow-x: hidden;
    overflow-y: auto;
}

/* Главное слово (Русское) */
.russian-word {
    font-size: 2.0rem !important;
    /* Компактный размер */
    color: var(--accent-color);
    margin-bottom: 5px !important;
    font-weight: bold;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    line-height: 1.1;
    min-height: 44px;
    /* Стабильная высота для слова */
}

/* Звезда избранного */
.favorite-toggle {
    background: none;
    border: none;
    cursor: pointer;
    padding: 5px;
    margin-top: -5px;
    margin-bottom: 5px;
    color: #ccc;
    transition: color 0.2s, transform 0.2s;
}

.favorite-toggle:hover {
    color: #aaa;
    transform: scale(1.1);
}

.favorite-toggle.is-favorite {
    color: var(--gold-color, #f1c40f);
}

.favorite-toggle svg {
    width: 28px;
    height: 28px;
    filter: drop-shadow(0 1px 1px rgba(0, 0, 0, 0.2));
}

/* Unified hint capsule favorites integration styling */
.unified-hint-container .favorite-toggle {
    margin: 0;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #b0bec5;
    background: none;
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
    height: 30px;
    width: 30px;
    border-radius: 50%;
}

.unified-hint-container .favorite-toggle:hover {
    color: #78909c;
    background: rgba(0, 0, 0, 0.05);
    transform: scale(1.08);
}

.unified-hint-container .favorite-toggle.is-favorite {
    color: #f1c40f;
}

.unified-hint-container .favorite-toggle svg {
    width: 20px;
    height: 20px;
    filter: drop-shadow(0 1px 2px rgba(241, 196, 15, 0.25));
}

/* Блоки с языками */
.bilingual-training-block {
    margin-bottom: 5px;
    width: 100%;
    max-width: 450px;
}

.bilingual-training-block h3 {
    color: var(--accent-hover);
    margin-bottom: 4px;
    font-size: 1.0em;
    margin-top: 0;
}

/* Поля ввода букв */
.letter-inputs {
    display: flex;
    justify-content: center;
    align-items: baseline;
    flex-wrap: wrap;
    margin-bottom: 8px;
    font-size: 20px;
    min-height: 30px;
}

.letter-input {
    width: 28px;
    height: 38px;
    font-size: 20px;
    text-align: center;
    border: 1px solid #ccc;
    border-radius: 4px;
    transition: all 0.2s;
    background-color: var(--bg-color);
    color: var(--text-color);
    margin: 0 1px;
}

.letter-input:focus {
    outline: none;
    border-color: var(--accent-color);
    box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent-color) 30%, transparent);
}

.letter-input.correct {
    background: #d4edda;
    border-color: var(--success-color);
}

.letter-input.incorrect {
    background: #f8d7da;
    border-color: var(--danger-color);
}

.space-char {
    width: 10px;
    display: inline-block;
}

/* Анимация перелива цвета для новых слов на первом круге */
@keyframes color-cycle {
    0%   { color: var(--accent-color); }
    25%  { color: var(--success-color); }
    50%  { color: #f39c12; text-shadow: 0 0 4px rgba(243, 156, 18, 0.3); }
    75%  { color: #e74c3c; }
    100% { color: var(--accent-color); }
}
.new-word-animation {
    animation: color-cycle 4s ease-in-out infinite !important;
}

/* =========================================
   5. ОПИСАНИЕ И ИСТОРИЯ (ПОДВАЛ)
   ========================================= */

#description-container {
    border: 1px solid var(--accent-color);
    border-radius: 8px;
    margin: 5px auto;
    max-width: 95%;
    width: 100%;
    background-color: #fff;
    text-align: left;
    font-size: 0.9em;
    line-height: 1.3;
    box-sizing: border-box;
    overflow: hidden;
    display: none;
    /* Скрыто по умолчанию */
}

#description-container.visible {
    display: block;
    padding: 8px 15px;
}

.word-description p {
    margin: 0 0 8px 0;
}

.word-description p:last-child {
    margin-bottom: 0;
}

.word-history-footer-container {
    display: none;
    flex-shrink: 0;
    justify-content: space-between;
    align-items: flex-start;
    width: 100%;
    max-width: 700px;
    border-top: 1px solid #e0e0e0;
    background-color: color-mix(in srgb, var(--paper-color) 50%, #fff);
    border-radius: 8px;
    margin: 5px auto 0 auto;
    transition: all 0.3s;
    overflow: hidden;
    max-height: 0;
    padding: 0 10px;
    opacity: 0;
}

.word-history-footer-container.visible {
    display: flex;
    visibility: visible;
    opacity: 1;
    max-height: 200px;
    /* Чуть увеличим запас */
    min-height: 90px;
    /* Фиксируем минимальную высоту сразу */
    padding: 5px 10px;
    margin-top: 5px;
}

.previous-word-box,
.next-word-box {
    width: 49%;
    text-align: left;
    font-size: 0.85em;
    color: #777;
    line-height: 1.4;
    position: relative;
    padding-top: 1.2em;
    min-height: 60px;
    /* Резервируем место под 3 строки текста */
}

.next-word-box {
    text-align: right;
    color: var(--accent-color);
    font-weight: bold;
}

.previous-word-box {
    padding-right: 10px;
    border-right: 1px solid #ddd;
}

.history-label {
    position: absolute;
    top: 0;
    left: 0;
    font-size: 0.8em;
    font-weight: bold;
    color: var(--accent-color);
    opacity: 0.7;
}

.next-word-box .history-label {
    left: auto;
    right: 0;
}

/* =========================================
   6. ПАНЕЛЬ ПОДСКАЗОК И ЖИЗНЕЙ (Unified Hint Container)
   ========================================= */

.unified-hint-container {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 10px;
    border-radius: 30px;
    background: linear-gradient(270deg, rgba(255, 255, 255, 0.3), rgba(230, 245, 255, 0.6), rgba(255, 255, 255, 0.3));
    background-size: 200% 200%;
    animation: shimmer-bg 8s ease infinite;
    border: 1px solid rgba(255, 255, 255, 0.5);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}

@keyframes shimmer-bg {
    0% {
        background-position: 0% 50%;
    }

    50% {
        background-position: 100% 50%;
    }

    100% {
        background-position: 0% 50%;
    }
}

/* Кнопка сердец (слева в овале) */
.hearts-simple-btn {
    background: none;
    border: none;
    padding: 0;
    margin: 0;
    font-size: 1.4rem;
    line-height: 1;
    cursor: pointer;
    color: #ff4b4b;
    transition: transform 0.2s;
    min-width: 100px;
    /* Увеличили ширину, чтобы влезало 7 сердец */
    text-align: right;
    /* Фиксируем по левому краю */
}

.hearts-simple-btn:hover {
    transform: scale(1.05);
}

.hearts-simple-btn:active {
    transform: scale(0.95);
}

/* Разделитель */
.hint-separator {
    width: 1px;
    height: 20px;
    background-color: rgba(0, 0, 0, 0.15);
}

/* Золотые кнопки подсказок */
.hint-gold-wrapper {
    display: flex;
    align-items: center;
    gap: 6px;
}

.hint-gold-btn {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: linear-gradient(135deg, #FFD700 0%, #FFA500 100%);
    border: 2px solid #fff;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    color: #fff;
    font-weight: 800;
    font-size: 0.9rem;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 0;
    margin: 0;
    transition: all 0.2s;
}

.hint-gold-btn:hover {
    transform: scale(1.1) rotate(10deg);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

.hint-gold-btn:active {
    transform: scale(0.95);
}

.hint-gold-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    filter: grayscale(100%);
}

.hint-cost-text {
    font-size: 0.8rem;
    color: #555;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    min-width: 50px;
    text-align: center;
}

/* =========================================
   7. АНИМАЦИИ (Keyframes)
   ========================================= */

@keyframes pulse-blue {
    0% {
        box-shadow: 0 0 0 0 rgba(0, 123, 255, 0.7);
    }

    70% {
        box-shadow: 0 0 0 10px rgba(0, 123, 255, 0);
    }

    100% {
        box-shadow: 0 0 0 0 rgba(0, 123, 255, 0);
    }
}

.field-empty-pulse {
    animation: pulse-blue 0.4s ease;
    border-color: #007bff !important;
}

.field-error-pulse {
    animation: shake 0.5s;
    border-color: #dc3545 !important;
}

/* Анимация тряски (общая) */
.card-training.shake,
.hearts-simple-btn.shake {
    animation: shake 0.5s cubic-bezier(.36, .07, .19, .97) both;
    transform: translate3d(0, 0, 0);
    backface-visibility: hidden;
    perspective: 1000px;
}

@keyframes shake {

    10%,
    90% {
        transform: translate3d(-1px, 0, 0);
    }

    20%,
    80% {
        transform: translate3d(2px, 0, 0);
    }

    30%,
    50%,
    70% {
        transform: translate3d(-4px, 0, 0);
    }

    40%,
    60% {
        transform: translate3d(4px, 0, 0);
    }
}

/* --- ВИРТУАЛЬНАЯ КЛАВИАТУРА (FIXED) --- */

.virtual-keyboard-container {
    position: fixed !important;
    /* Важно! */
    bottom: 0 !important;
    left: 0 !important;
    width: 100% !important;
    background-color: #d1d5db;
    padding: 8px 3px 25px 3px;
    /* Чуть больше отступ снизу для телефонов с жестами */
    z-index: 2147483647 !important;
    /* Максимально возможный Z-index */
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.2);
    display: flex;
    flex-direction: column;
    gap: 6px;
    transform: translateY(0);
    /* Состояние "Открыто" */
    transition: transform 0.3s ease;
    box-sizing: border-box;
}

.virtual-keyboard-container.hidden {
    transform: translateY(110%) !important;
    /* Прячем вниз */
}

.kb-row {
    display: flex;
    justify-content: center;
    gap: 4px;
    width: 100%;
}

.kb-key {
    background-color: #fff;
    border-radius: 5px;
    box-shadow: 0 1px 0 #888;
    color: #000;
    font-size: 22px;
    /* Чуть крупнее шрифт */
    font-weight: 500;
    height: 48px;
    /* Чуть выше кнопки для удобства */
    min-width: 30px;
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}

.kb-key:active {
    background-color: #bbb;
    transform: translateY(2px);
}

.kb-key.kb-special {
    background-color: #aeb4be;
    flex: 1.5;
}

.kb-key.kb-spacer {
    background: transparent;
    box-shadow: none;
    flex: 0.5;
    pointer-events: none;
}

/* Кнопка переключения */
.keyboard-toggle-btn {
    position: fixed !important;
    bottom: 80px !important;
    /* Чуть выше, чтобы не перекрываться нижними панелями */
    right: 20px !important;
    width: 50px;
    height: 50px;
    background-color: var(--accent-color, #2980b9);
    color: white;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 24px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
    z-index: 2147483647 !important;
    /* Тоже поверх всего */
    border: 2px solid white;
    cursor: pointer;
    outline: none;
    -webkit-tap-highlight-color: transparent;
}


/* --- Success Modal (Окно после правильного ответа) --- */
.success-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    /* Затемнение фона */
    backdrop-filter: blur(3px);
    z-index: 99999;
    /* Поверх клавиатуры и всего остального */
    display: flex;
    justify-content: center;
    align-items: flex-start;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s, visibility 0.3s;
}

.success-modal-overlay.visible {
    opacity: 1;
    visibility: visible;
}

.success-modal-content {
    background: var(--paper-color, #faf3e0);
    width: 90%;
    max-width: 400px;
    padding: 25px;
    border-radius: 20px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    border: 2px solid var(--accent-color, #5d4037);
    text-align: center;
    transform: translateY(20px);
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 15vh;
}

.success-modal-overlay.visible .success-modal-content {
    transform: translateY(0);
}

.sm-word {
    font-size: 2em;
    font-weight: bold;
    color: var(--accent-color, #5d4037);
    margin-bottom: 5px;
}

.sm-translation {
    font-size: 1.2em;
    color: #4CAF50;
    /* Зеленый цвет успеха */
    font-weight: 500;
    margin-bottom: 10px;
    border-bottom: 1px dashed #ccc;
    padding-bottom: 10px;
}

.sm-details {
    text-align: left;
    background: rgba(0, 0, 0, 0.03);
    padding: 10px;
    border-radius: 10px;
    font-size: 0.95em;
    color: var(--text-color, #333);
}

.sm-details p {
    margin: 5px 0;
    line-height: 1.4;
}

.sm-label {
    font-weight: bold;
    font-size: 0.8em;
    color: #888;
    text-transform: uppercase;
    display: block;
    margin-bottom: 2px;
}

.sm-close-hint {
    margin-top: 15px;
    font-size: 0.85em;
    color: #999;
    font-style: italic;
}

/* Анимация иконки звука */
.sm-speaker-icon {
    display: inline-block;
    margin-left: 10px;
    cursor: pointer;
    font-size: 1.2rem;
}

.playing .sm-speaker-icon {
    animation: pulseSpeaker 1s infinite;
}

@keyframes pulseSpeaker {
    0% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.2);
        opacity: 0.7;
    }

    100% {
        transform: scale(1);
    }
}


/* Кнопка динамика в правом верхнем углу модалки */
.sm-speaker-btn {
    position: absolute;
    top: 15px;
    right: 15px;
    background: #f0f0f0;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 1.4rem;
    transition: background 0.2s, transform 0.1s;
    user-select: none;
    color: #333;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

.sm-speaker-btn:hover {
    background: #e0e0e0;
    transform: scale(1.05);
}

.sm-speaker-btn:active {
    transform: scale(0.95);
    background: #d0d0d0;
}