/* --- НАЧАЛО ФАЙЛА STYLE.CSS (ПОЛНАЯ ИСПРАВЛЕННАЯ ВЕРСИЯ) --- */

/* Google Font для корректного отображения русской транскрипции с ударениями */
@import url('https://fonts.googleapis.com/css2?family=Noto+Sans:wght@400;500;700&display=swap');

/* --- BASE STYLES --- */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}

input, textarea {
    -webkit-user-select: text;
    -moz-user-select: text;
    -ms-user-select: text;
    user-select: text;
}

html {
    overflow-x: hidden;
    background: #101010;
    overscroll-behavior: none;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: #fafafa;
    min-height: 100vh;
    padding: 20px;
    padding-top: calc(20px + env(safe-area-inset-top));
    color: #333;
    overflow-x: hidden;
    line-height: 1.6;
    overflow-x: hidden;
    overscroll-behavior: none; /* Отключаем pull-to-refresh и rubber-band */
}


.container {
    max-width: 900px;
    margin: 0 auto;
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    overflow: hidden;
    position: relative;
    /* <-- Якорь для десктопной кнопки "В Архив" */
}

.header {
    background: #fff;
    border-bottom: 1px solid #e5e5e5;
    padding: 20px 30px;
    text-align: left;
    position: relative;
}

.header h1 {
    font-size: 2.2rem;
    margin-bottom: 0px;
    font-weight: 200;
    color: #333;
}

.header p {
    color: #666;
    font-size: 1rem;
    font-weight: 400;
    margin-top: -8px;
}

.stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 1px;
    background: #e5e5e5;
    padding: 0;
}

.stat {
    background: white;
    padding: 30px 20px;
    text-align: center;
}

.stat-number {
    font-size: 2rem;
    font-weight: 600;
    color: #333;
    margin-bottom: 4px;
}

.stat-label {
    color: #666;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 500;
}

.level-selector {
    background: #fff;
    padding: 25px;
    border-bottom: 1px solid #e5e5e5;
    display: flex;
    align-items: center;
    gap: 12px;
}

.level-buttons {
    display: flex;
    gap: 12px;
    align-items: center;
    flex-wrap: wrap;
    flex: 1;
}

.level-btn {
    padding: 8px 16px;
    border: 1px solid #ddd;
    border-radius: 4px;
    background: white;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 0.9rem;
    color: #666;
}

.level-btn:hover:not(:disabled) {
    border-color: #999;
}

.level-btn.active {
    background: #333;
    color: white;
    border-color: #333;
}

.level-btn:disabled {
    background: none;
    border-color: transparent;
    color: #ccc;
    cursor: not-allowed;
    opacity: 1;
}
.level-btn.info-only {
    background: none;
    border-color: transparent;
    color: #999;
    cursor: default;
}

.pack-toggle-btn {
    padding: 8px 12px;
    border: 2px solid #666;
    border-radius: 4px;
    background: white;
    font-weight: 700;
    font-size: 13px;
    cursor: pointer;
    margin-left: 8px;
    min-width: 32px;
    text-align: center;
    transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.pack-toggle-btn.advanced {
    background: #333;
    color: white;
    border-color: #333;
}

.startpack-divider {
    width: 1px;
    height: 20px;
    background: #ddd;
    margin: 0 4px;
}

.startpack-btn.active {
    background: #2563eb;
    color: white;
    border-color: #2563eb;
}

/* === Кнопка глобального поиска === */
.global-search-btn {
    background: none;
    border: none;
    padding: 4px;
    margin-right: 10px;
    cursor: pointer;
    color: #adb5bd;
    transition: color 0.15s ease;
    flex-shrink: 0;
}
.global-search-btn .icon {
    width: 20px;
    height: 20px;
    display: block;
}
.global-search-spacer {
    display: none;
}
.global-search-btn:hover {
    color: #495057;
}

/* === Модалка глобального поиска === */
/* Блокируем скролл body при любой модалке/панели */
body.panel-open {
    overflow: hidden;
}

.global-search-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0, 0, 0, 0.4);
    z-index: 1010;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding-top: 60px;
    overscroll-behavior: none;
}
.global-search-dialog {
    background: white;
    border-radius: 10px;
    width: 94%;
    max-width: 420px;
    max-height: calc(var(--vvh, 100vh) - 100px);
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.2);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
.global-search-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 15px;
    background: #f8f9fa;
    border-bottom: 1px solid #dee2e6;
    flex-shrink: 0;
}
.global-search-header span {
    font-size: 0.9rem;
    font-weight: 600;
}
.global-search-close {
    background: none;
    border: none;
    font-size: 1.2rem;
    cursor: pointer;
    color: #6c757d;
    padding: 0 4px;
}
.global-search-input-wrap {
    padding: 12px 15px;
    border-bottom: 1px solid #f0f0f0;
    flex-shrink: 0;
}
.global-search-input-wrap input {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #dee2e6;
    border-radius: 6px;
    font-size: 16px;
    outline: none;
    box-sizing: border-box;
}
.global-search-input-wrap input:focus {
    border-color: #4a90d9;
}
.global-search-results {
    overflow-y: auto;
    flex: 1;
    padding: 8px 15px;
    background: #f0f1f3;
    touch-action: pan-y;
    overscroll-behavior-y: contain;
}
.global-search-result {
    display: flex;
    align-items: center;
    padding: 10px;
    background: white;
    border: 1px solid #e9ecef;
    border-radius: 6px;
    margin-bottom: 6px;
    cursor: pointer;
    transition: all 0.15s ease;
}
.global-search-result:active {
    background: #e0efff;
}
.global-search-result .gs-word-info {
    flex: 1;
    min-width: 0;
}
.global-search-result .gs-word-de {
    font-weight: 600;
    color: #212529;
}
.global-search-result .gs-word-ru {
    font-size: 0.85rem;
    color: #6c757d;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.global-search-result .gs-word-topic {
    font-size: 0.75rem;
    color: #adb5bd;
    margin-top: 2px;
}
.global-search-result .gs-word-level {
    font-size: 0.75rem;
    padding: 2px 6px;
    background: #e9ecef;
    border-radius: 3px;
    color: #495057;
    margin-left: 8px;
    flex-shrink: 0;
}
/* Locked words (Free plan vitrine) */
.global-search-result.gs-locked {
    opacity: 0.55;
    background: #f8f9fa;
}
.global-search-result.gs-locked:active {
    background: #f8f9fa;
}
.gs-lock-icon {
    font-size: 0.75rem;
    margin-right: 2px;
}
.gs-premium-badge {
    font-size: 0.65rem;
    font-weight: 600;
    padding: 2px 6px;
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    border-radius: 3px;
    margin-left: 8px;
    flex-shrink: 0;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.global-search-no-results {
    text-align: center;
    padding: 20px;
    color: #999;
    font-size: 0.9rem;
}
.global-search-no-results b {
    color: #333;
}
.gs-ai-create-btn {
    margin-top: 12px;
    padding: 10px 20px;
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: #fff;
    border: none;
    border-radius: 12px;
    font-size: 15px;
    cursor: pointer;
}
.gs-word-preview {
    padding: 16px;
}

/* =============================================================================
   TOPIC/SUBTOPIC SELECTOR (APP_SPEC v1.7.2, раздел 10)
   ============================================================================= */

.topics-container {
    background: #fff;
    padding: 25px;
    border-bottom: 1px solid #e5e5e5;
}

.topics-row {
    display: flex;
    gap: 10px 10px;
    flex-wrap: wrap;
    align-items: center;
}

.subtopics-row {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    align-items: center;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px dashed #e0e0e0;
    /* Анимация */
    opacity: 0;
    transform: translateY(-10px);
    transition: opacity 0.2s ease, transform 0.2s ease;
}

.subtopics-row.visible {
    opacity: 1;
    transform: translateY(0);
}

.subtopics-row.vertical {
    flex-direction: row;
    align-items: center;
}

/* Вертикальное расположение только на мобильных */
@media (max-width: 768px) {
    .subtopics-row.vertical {
        flex-direction: column;
        align-items: flex-start;
    }
}

/* Topic Chips */
.topic-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 6px 14px;
    border: 1px solid #e0e0e0;
    border-radius: 16px;
    background: #fff;
    font-size: 0.85rem;
    font-weight: 500;
    color: #555;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.topic-chip:hover {
    border-color: #bbb;
    background: #f0f0f0;
}

.topic-chip.active,
.topic-chip.has-subtopic {
    background: #333;
    color: #fff;
    border-color: #333;
}

.topic-chip.expanded {
    /* Без визуального выделения — expanded только для логики */
}

.topic-chip .topic-name {
    font-weight: 500;
}

.topic-chip .topic-count {
    font-size: 0.75rem;
    color: #999;
}

.topic-chip.active .topic-count {
    color: rgba(255, 255, 255, 0.8);
}

/* Topic chip — источник для MIX (обведённый, не активный) */
.topic-chip.mix-source {
    background: #fff;
    border-color: transparent;
    box-shadow: inset 0 0 0 1.5px #333;
    color: #333;
}

.topic-chip.mix-source .topic-count {
    color: #666;
}

/* Последний Goethe-топик — обводка когда мы в standalone Review */
.topic-chip.last-active {
    box-shadow: inset 0 0 0 1.5px #999;
}

/* Subtopic Chips */
.subtopic-chip {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 6px 12px;
    border: 1px solid #e5e5e5;
    border-radius: 16px;
    background: #fff;
    font-size: 0.8rem;
    font-weight: 400;
    color: #666;
    cursor: pointer;
    transition: all 0.2s ease;
}

.subtopic-chip:hover {
    border-color: #ccc;
    background: #f5f5f5;
}

.subtopic-chip.active {
    background: #333;
    color: #fff;
    border-color: #333;
}

.subtopic-chip .subtopic-name {
    font-weight: 500;
}

.subtopic-chip .subtopic-count {
    font-size: 0.7rem;
    color: #999;
}

.subtopic-chip.active .subtopic-count {
    color: rgba(255, 255, 255, 0.8);
}

/* Subtopic chip — источник для MIX (обведённый) */
.subtopic-chip.mix-source {
    background: #fff;
    border-color: transparent;
    box-shadow: inset 0 0 0 1.5px #333;
    color: #333;
}

.subtopic-chip.mix-source .subtopic-count {
    color: #666;
}

/* Mobile responsive for topics */
@media (max-width: 768px) {
    .topics-container {
        padding: 15px 20px;
    }

    .topics-row {
        gap: 4px;
        flex-wrap: wrap;
        padding-bottom: 8px;
        justify-content: flex-start;
    }

    .topics-row::-webkit-scrollbar {
        display: none;
    }

    .topic-chip {
        padding: 5px 8px;
        font-size: 0.85rem;
        border: none;
    }

    .subtopics-row {
        gap: 5px;
        flex-wrap: wrap;
        padding-bottom: 6px;
    }

    .subtopic-chip {
        padding: 5px 8px;
        font-size: 0.75rem;
        border: none;
    }
}

/* Grammar Tag Filter Chips */
.grammar-tag-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    padding: 8px 0 0;
    margin-top: 8px;
    border-top: 1px dashed #e8e8e8;
    /* Анимация */
    opacity: 0;
    transform: translateY(-6px);
    transition: opacity 0.2s ease, transform 0.2s ease;
}

.grammar-tag-filters.visible {
    opacity: 1;
    transform: translateY(0);
}

.grammar-tag-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    border: 1px solid #e0e0e0;
    border-radius: 12px;
    background: #fafafa;
    font-size: 0.78rem;
    font-weight: 400;
    color: #777;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.grammar-tag-chip:hover {
    border-color: #bbb;
    background: #f0f0f0;
}

.grammar-tag-chip.active {
    background: #555;
    color: #fff;
    border-color: #555;
}

.grammar-tag-count {
    font-size: 0.68rem;
    color: #aaa;
}

.grammar-tag-chip.active .grammar-tag-count {
    color: rgba(255, 255, 255, 0.75);
}

@media (max-width: 768px) {
    .grammar-tag-filters {
        gap: 5px;
        padding: 6px 0 0;
        margin-top: 6px;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        flex-wrap: wrap;
    }

    .grammar-tag-chip {
        padding: 4px 8px;
        font-size: 0.73rem;
        border: none;
    }
}

/* === DRAG HANDLE (snap-point навигация) === */
.drag-handle {
    display: none; /* Скрыт на десктопе */
}

@media (max-width: 768px) {
    .drag-handle {
        display: flex;
        justify-content: center;
        align-items: center;
        height: 16px;
        background: transparent;
        cursor: default;
        touch-action: none;
        user-select: none;
        pointer-events: none;
        overflow: hidden;
    }

    .drag-bar {
        display: block;
        width: 36px;
        height: 4px;
        background: #ccc;
        border-radius: 2px;
    }
}

/* Кнопка "Мои словари" в ряду тем */
.topic-chip.personal-vocab-trigger {
    background: #f8f4ff;
    border-color: #d4c4f0;
}

.topic-chip.personal-vocab-trigger:hover {
    background: #f0e8ff;
    border-color: #b8a4e0;
}

.topic-chip.personal-vocab-trigger.active {
    background: #7c5cbf;
    border-color: #7c5cbf;
    color: #fff;
}

/* Subtopics Popup (Mobile) */
.subtopics-popup-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1100;
    opacity: 0;
    transition: opacity 0.2s ease-out;
}

.subtopics-popup-overlay.show {
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 1;
}

.subtopics-popup {
    background: #fff;
    border-radius: 16px;
    padding: 0;
    max-width: 85vw;
    min-width: 250px;
    max-height: 70vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transform: scale(0.95);
    transition: transform 0.2s ease-out;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
}

.subtopics-popup-overlay.show .subtopics-popup {
    transform: scale(1);
}

.subtopics-popup-header {
    padding: 16px 20px;
    border-bottom: 1px solid #eee;
    font-size: 1.1rem;
    font-weight: 600;
    color: #333;
    background: #fff;
    border-radius: 16px 16px 0 0;
    flex-shrink: 0;
}

.subtopics-popup-list {
    padding: 8px 0;
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-y: contain;
}

.subtopics-popup-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 20px;
    cursor: pointer;
    transition: background 0.15s ease;
}

@media (hover: hover) {
    .subtopics-popup-item:hover {
        background: #f5f5f5;
    }
}

.subtopics-popup-item.active {
    background: #333;
    color: #fff;
}

.subtopics-popup-item .subtopic-name {
    font-size: 0.95rem;
}

.subtopics-popup-item .subtopic-count {
    font-size: 0.8rem;
    color: #999;
}

.subtopics-popup-item.active .subtopic-count {
    color: rgba(255, 255, 255, 0.7);
}

/* Popup item — источник для MIX (обведённый) */
.subtopics-popup-item.mix-source {
    background: #fff;
    box-shadow: inset 0 0 0 1.5px #333;
    color: #333;
}

.subtopics-popup-item.mix-source .subtopic-count {
    color: #666;
}

/* =============================================================================
   END TOPIC/SUBTOPIC SELECTOR
   ============================================================================= */

/* Скрываем старый block-selector (темы перенесены в topics-container) */
.block-selector {
    display: none;
}

/* Оригинальные стили block-selector (на случай если понадобятся)
.block-selector {
    background: white;
    padding: 25px;
    border-bottom: 1px solid #e5e5e5;
    position: relative;
}
*/

.block-selector-visible {
    display: block;
    background: white;
    padding: 25px;
    border-bottom: 1px solid #e5e5e5;
    position: relative;
}

.block-buttons {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
}


.block-btn {
    padding: 6px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    background: white;
    font-weight: 400;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 0.85rem;
    color: #666;
}

.block-btn:hover {
    border-color: #999;
}

.block-btn.active {
    background: #333;
    color: white;
    border-color: #333;
}

.block-label {
    font-weight: 500;
    color: #333;
    margin-right: 15px;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
}

.block-label .icon {
    margin-right: 8px;
}

.main-content {
    padding: 40px;
    height: 500px;
    background: white;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.main-content.is-clickable {
    cursor: pointer;
}

#studyArea {
    display: flex;
    flex-grow: 1;
    width: 100%;
    align-self: stretch;
}

.card {
    position: relative;
    background: white;
    border-radius: 4px;
    padding: 70px 40px 20px;
    text-align: center;
    margin-bottom: 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    transition: opacity 1s cubic-bezier(0.25, 0.46, 0.45, 0.94), transform 1s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    width: 100%;
    flex-grow: 1;
}

#wordCard {
    /* Говорим браузеру, что для этого элемента мы будем сами обрабатывать
       горизонтальные свайпы (pan-x), а вертикальные (pan-y) пусть
       обрабатывает он сам (для скролла). */
    touch-action: pan-y;
}

/* Кнопка "Отметить ошибку" (флажок) — под индикатором уровня */
.flag-error-btn {
    position: absolute;
    top: 94px;
    right: 47px;
    width: 38px;
    height: 38px;
    border: none;
    background: transparent;
    font-size: 26px;
    cursor: pointer;
    color: #aaa;
    opacity: 0.6;
    transition: opacity 0.2s, transform 0.2s, color 0.2s;
    z-index: 10;
    border-radius: 4px;
}

@media (hover: hover) {
    .flag-error-btn:hover {
        opacity: 0.6;
        background: rgba(0, 0, 0, 0.05);
    }
}

.flag-error-btn:active {
    transform: scale(0.95);
}

.flag-error-btn.flagged {
    opacity: 1;
    color: #2196F3;
}

.flag-error-btn.fixed {
    opacity: 1;
    color: #2196F3;
}

/* === КНОПКА ЗВЕЗДЫ (быстрое добавление в "Мои словари") === */
.star-favorite-btn {
    position: absolute;
    top: 179px;
    right: 47px;
    width: 38px;
    height: 38px;
    border: none;
    background: transparent;
    font-size: 26px;
    cursor: pointer;
    color: transparent;
    -webkit-text-stroke: 1.5px #aaa;
    transition: opacity 0.2s, transform 0.2s, color 0.2s;
    z-index: 10;
    border-radius: 4px;
}

@media (hover: hover) {
    .star-favorite-btn:hover {
        background: rgba(0, 0, 0, 0.05);
    }
}

.star-favorite-btn:active {
    transform: scale(0.95);
}

.star-favorite-btn.active {
    color: #888;
    -webkit-text-stroke: 1px #888;
}
/* === КОНЕЦ КНОПКИ ЗВЕЗДЫ === */

/* === МОДАЛКА ФЛАГА ОШИБКИ === */
.flag-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    flex-direction: column;
    align-items: center;
    padding-top: 60px;
    box-sizing: border-box;
    z-index: 10000;
    touch-action: none;
    overscroll-behavior: none;
}

.flag-modal {
    background: white;
    border-radius: 12px;
    width: 94%;
    max-width: 480px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    max-height: calc(var(--vvh, 100vh) - 80px);
}

.flag-modal-header {
    display: flex;
    justify-content: space-between;
    user-select: none;
    align-items: center;
    padding: 12px 16px;
    background: #f8f9fa;
    border-bottom: 1px solid #e9ecef;
    font-weight: 600;
    position: sticky;
    top: 0;
    z-index: 1;
    flex-shrink: 0;
}

.flag-modal-close {
    background: none;
    border: none;
    font-size: 18px;
    cursor: pointer;
    color: #6c757d;
    padding: 4px 8px;
}

.flag-modal-body {
    overflow-y: auto;
    flex: 1;
    min-height: 0;
}

.flag-modal-word {
    font-size: 1.3rem;
    font-weight: 600;
    text-align: center;
    padding: 16px 16px 4px;
    color: #212529;
}

.flag-modal-meta {
    font-size: 0.8rem;
    color: #6c757d;
    text-align: center;
    padding-bottom: 12px;
}

.flag-modal-comment-original {
    font-size: 0.85rem;
    color: #495057;
    font-style: italic;
    text-align: center;
    padding: 0 16px 12px;
    border-bottom: 1px solid #e9ecef;
    margin-bottom: 12px;
}

.flag-modal-types {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 0 16px 12px;
}

.flag-modal-types label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.85rem;
    color: #495057;
    cursor: pointer;
    padding: 6px 10px;
    background: #f8f9fa;
    border-radius: 6px;
    border: 1px solid #e9ecef;
    transition: all 0.15s;
}

.flag-modal-types label:has(input:checked) {
    background: #fff3cd;
    border-color: #ffc107;
}

.flag-modal-types input[type="checkbox"] {
    margin: 0;
    cursor: pointer;
}

.flag-modal-comment {
    width: 100%;
    box-sizing: border-box;
    padding: 10px;
    border: 1px solid #dee2e6;
    border-radius: 6px;
    font-size: 0.9rem;
    resize: none;
    font-family: inherit;
}

.flag-modal-comment-wrap {
    position: relative;
    margin: 0 16px 12px;
    flex-shrink: 0;
}

.flag-modal-comment-wrap .flag-modal-comment {
    width: 100%;
    margin: 0;
}

.flag-modal-placeholder {
    position: absolute;
    top: 10px;
    left: 14px;
    right: 10px;
    font-size: 0.8rem;
    color: #aaa;
    cursor: text;
    line-height: 1.4;
}

.flag-modal-placeholder em {
    font-style: italic;
    font-weight: 600;
    color: #777;
}

.flag-modal-comment:focus {
    outline: none;
    border-color: #80bdff;
}

.flag-modal-comment-display {
    font-size: 0.85rem;
    color: #6c757d;
    font-style: italic;
    padding: 0 16px 12px;
    text-align: center;
}

.flag-modal-actions {
    display: flex;
    gap: 8px;
    padding: 12px 16px;
    background: #f8f9fa;
    border-top: 1px solid #e9ecef;
    flex-shrink: 0;
}

.flag-modal-btn {
    flex: 1;
    padding: 10px 16px;
    border: none;
    border-radius: 6px;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s;
}

.flag-modal-btn.cancel {
    background: #e9ecef;
    color: #495057;
}

.flag-modal-btn.submit {
    background: #ffc107;
    color: #212529;
}

.flag-modal-btn.remove {
    background: #dc3545;
    color: white;
}

.flag-modal-btn:active {
    transform: scale(0.98);
}

/* Desktop: перемещаемая модалка */
.flag-modal-overlay.draggable .flag-modal-header {
    cursor: grab;
}
.flag-modal-overlay.draggable .flag-modal-header:active {
    cursor: grabbing;
}
.flag-modal-overlay.dragging {
    background: rgba(0, 0, 0, 0.15);
}
.flag-modal-overlay.dragging .flag-modal {
    box-shadow: 0 12px 48px rgba(0, 0, 0, 0.3);
}

/* Модалка исправления */
.flag-modal-header.fixed-header {
    background: #d4edda;
    border-bottom-color: #c3e6cb;
}

.flag-modal-resolution {
    background: #f8f9fa;
    border-radius: 6px;
    padding: 12px;
    margin: 0 16px 12px;
}

.flag-modal-resolution .resolution-label {
    font-size: 0.75rem;
    color: #6c757d;
    margin-bottom: 4px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.flag-modal-resolution .resolution-text {
    font-size: 0.9rem;
    color: #212529;
    line-height: 1.4;
}

.flag-modal-thanks {
    text-align: center;
    font-size: 1.1rem;
    padding: 8px 16px 16px;
    color: #28a745;
}

/* Маркер источника слова (G/M/R/A) — позиционируется в main-content, не в карточке */
.source-marker {
    position: absolute;
    top: 24px;
    left: 50px;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 600;
    color: white;
    z-index: 10;
}

.source-marker.source-goethe {
    background-color: #4a90d9; /* синий */
}

.source-marker.source-personal {
    background-color: #7c3aed; /* фиолетовый */
}

.source-marker.source-review {
    background-color: #f59e0b; /* оранжевый */
}

.source-marker.source-archive {
    background-color: #6b7280; /* серый */
}

.word-container {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
    max-width: 600px;
    transform: translateY(30px);
    transition: transform 2s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Слово постепенно поднимается с появлением информации */
.card.phase-sentence .word-container {
    transform: translateY(15px);
}

.card.phase-translation .word-container {
    transform: translateY(0);
}

/* --- [НОВОЕ] СТИЛИ ДЛЯ СИМВОЛА (Базовые) --- */
.symbol-display {
    font-size: 5rem;
    /* Крупный размер */
    font-weight: 700;
    /* Жирный шрифт */
    color: #e9ecef;
    /* Светло-серый (чтобы был как фон) */
    line-height: 1;
    margin-bottom: 5px;
    /* Отступ до слова */
    text-align: center;
    width: 100%;
    transition: color 0.3s ease;
    user-select: none;
    /* Чтобы не выделялся при клике */
}

/* Эффект при наведении на карточку (только для десктопа) */
.card:hover .symbol-display {
    color: #dee2e6;
    /* Чуть темнее при наведении */
}

/* ------------------------------------------- */

.word {
    font-size: 2.8rem;
    font-weight: 400;
    margin-bottom: 0;
    transition: color 0.5s ease;
    color: #333;
    display: flex;
    align-items: baseline;
    justify-content: center;
    gap: 0.3em;
}

.word .article {
    font-size: 0.5em;
    opacity: 0.6;
    font-weight: 500;
    transition: opacity 0.3s ease;
}

.word .main-word {
    font-weight: 400;
    display: grid;
    grid-auto-flow: column;
    align-items: center;
    gap: 0em;
    transition: gap 3.5s ease-in-out;
}

.word.show-morphemes .main-word {
    gap: 0.15em;
}

.word .morpheme {
    transition: none;
}

.word .morpheme-separator {
    opacity: 0;
    transform: scaleX(0);
    transition: all 3.5s ease-in-out;
    color: #999;
    font-weight: 400;
}

.word.show-morphemes .morpheme-separator {
    opacity: 1;
    transform: scaleX(1);
}

.morpheme-separator-mobile {
    display: none;
}

.morpheme-separator-desktop {
    display: inline;
}

.word.hide-articles .article {
    opacity: 0;
}

.word .article.der {
    color: #0066cc;
}

.word .article.die {
    color: #cc0066;
}

.word .article.das {
    color: #666;
}

.word.der .main-word {
    color: #0066cc;
}

.word.die .main-word {
    color: #cc0066;
}

.word.das .main-word {
    color: #333;
}

.morpheme-translation-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    line-height: 1.2;
}

.morpheme-translation-item .morpheme-part {
    font-weight: 500;
    font-size: 1rem;
    color: #555;
}

.morpheme-translation-item .translation-part {
    font-size: 0.85rem;
    color: #888;
    font-style: italic;
}

.level-indicator {
    position: absolute;
    top: 27px;
    right: 50px;
    padding: 4px 8px;
    border-radius: 3px;
    font-size: 0.75rem;
    font-weight: 500;
    color: white;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    z-index: 10;
}

.level-indicator.a1,
.level-indicator.a2,
.level-indicator.b1,
.level-indicator.b2 {
    background: #aaa;
}

.word-crossfade {
    transition: opacity 0.7s ease-in-out, transform 0.7s ease-in-out;
}

.word-fade-out {
    opacity: 0;
    transform: scale(0.95);
}

@keyframes slideInFromBottom {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.card-appear {
    animation: slideInFromBottom 0.6s ease-out;
}

.pronunciation,
.decomposition,
#translationContainer,
#sentenceContainer {
    transition: opacity 2s cubic-bezier(0.4, 0, 0.2, 1);
}

.pronunciation {
    opacity: 1;
    font-family: "Noto Sans", "DejaVu Sans", "Arial Unicode MS", sans-serif;
    letter-spacing: 0.02em;
    transition: opacity 2s cubic-bezier(0.4, 0, 0.2, 1), max-height 2s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Область транскрипции/декомпозиции */
.pronunciation-area {
    position: relative;
    margin-top: 5px;
    width: 100%;
    text-align: center;
    min-height: 3em;
}

.pronunciation-area .pronunciation {
    display: block;
    height: auto;
    transition: opacity 3s cubic-bezier(0.4, 0, 0.2, 1), max-height 3s cubic-bezier(0.4, 0, 0.2, 1);
}

.pronunciation-area .decomposition {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    display: flex;
    flex-direction: row;
    justify-content: center;
    align-items: flex-start;
    gap: 1.5em;
    flex-wrap: wrap;
    opacity: 0;
    transition: opacity 2s cubic-bezier(0.4, 0, 0.2, 1);
}

.pronunciation-area.show-decomposition .pronunciation {
    visibility: hidden;
    opacity: 0;
}

.pronunciation-area.show-decomposition .decomposition {
    opacity: 1;
}

/* Extended form (plural/perfekt) - третье состояние pronunciation-area */
.pronunciation-area .extended-form {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.3em;
    opacity: 0;
    transition: opacity 2s cubic-bezier(0.4, 0, 0.2, 1);
    font-size: 1.1rem;
    color: #1a1a1a;
    font-weight: 500;
}

.pronunciation-area.show-extended-form .pronunciation {
    visibility: hidden;
    opacity: 0;
}

.pronunciation-area.show-extended-form .decomposition {
    opacity: 0;
}

.pronunciation-area.show-extended-form .extended-form {
    opacity: 1;
}

.extended-form-label {
    font-size: 0.85rem;
    color: #b0b0b0;
    font-weight: 400;
    margin-right: 0.15em;
}

.decomp-item {
    display: inline;
    margin: 0 0.2em;
}

.decomp-part {
    font-size: 0.95rem;
    font-weight: 500;
    color: #666;
}

.decomp-note {
    font-size: 0.85rem;
    color: #888;
    margin-left: 2px;
}

/* Разделитель морфем в главном слове: анимация распада */
.word-morpheme {
    display: inline-block;
    transition: transform 1s cubic-bezier(0.4, 0, 0.2, 1);
}

.word-separator {
    display: inline-block;
    width: 0;
    opacity: 0;
}

/* Пробел в словах типа "sich ausziehen" — всегда видим */
.word-space {
    display: inline-block;
    width: 0.3em;
}

/* Тире в словах типа S-Bahn, U-Bahn — всегда видимо */
.word-hyphen {
    display: inline-block;
    opacity: 0.6;
    overflow: hidden;
    transition: width 1s cubic-bezier(0.4, 0, 0.2, 1), opacity 1s cubic-bezier(0.4, 0, 0.2, 1);
}

.word-separator::before {
    content: "-";
    color: inherit;
    opacity: 0.4;
}

/* При phase-morphemes — слово распадается */
.card.phase-morphemes .word-separator {
    width: 0.4em;
    opacity: 1;
}

.card.phase-morphemes .word-morpheme {
    transform: translateX(0);
}

.decomp-note::before {
    content: "(";
}

.decomp-note::after {
    content: ")";
}

.meaning-chain {
    width: 100%;
    margin-top: 6px;
    font-size: 0.8rem;
    color: #999;
    font-style: italic;
    text-align: center;
}

/* Контейнеры перевода и предложения */
#translationContainer {
    opacity: 0;
    margin-top: 15px;
    margin-bottom: 20px;
    min-height: 2em;
    transform: translateY(-5px);
    transition: opacity 2s cubic-bezier(0.4, 0, 0.2, 1), transform 2s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    z-index: 2;
}

.card.phase-translation #translationContainer {
    opacity: 1;
    transform: translateY(0);
}

#sentenceContainer {
    opacity: 0;
    margin-top: 30px;
    width: 100%;
    display: flex;
    justify-content: center;
    transform: translateY(-20px);
    transition: opacity 2s cubic-bezier(0.4, 0, 0.2, 1), transform 2s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Пример появляется — поднимается на место */
.card.phase-sentence #sentenceContainer {
    opacity: 1;
    transform: translateY(-10px);
}

/* Перевод появляется — пример плавно опускается */
.card.phase-translation #sentenceContainer {
    opacity: 1;
    transform: translateY(0);
}


.translation-container {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

.translation {
    font-size: 1.4rem;
    color: #333;
    font-weight: 400;
    padding: 0;
}

.sentence {
    font-size: 1.4rem;
    color: #4a90e2;
    margin: 0;
    font-weight: 400;
    font-style: italic;
    padding: 20px;
    border-left: 3px solid #4a90e2;
    background: rgba(74, 144, 226, 0.05);
    min-width: 300px;
    max-width: 600px;
    box-sizing: border-box;
    text-align: center;
}

.sentence-translation {
    font-size: 1.1rem;
    color: #888;
    margin-top: 0px;
    font-style: normal;
}

.player-controls-desktop {
    background: white;
    padding: 25px;
    border-top: 1px solid #e5e5e5;
    border-bottom: 1px solid #e5e5e5;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 25px;
}

.player-main-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
}

.left-controls-desktop {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 220px;
}

.speed-controls-desktop {
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-width: 180px;
}

.music-toggle-desktop {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-shrink: 0;
}

.music-btn-desktop {
    width: 40px !important;
    height: 40px !important;
    flex-shrink: 0;
}

.music-btn-desktop.active {
    background: #333;
    border-color: #333;
    color: white;
}

.music-label-desktop {
    font-size: 0.6rem;
    color: #999;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    white-space: nowrap;
}

select.setting-select-desktop {
    min-width: 0;
    max-width: 98px;
    font-size: 0.65rem;
    padding: 2px 4px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.sound-controls-desktop {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 180px;
    justify-content: flex-end;
}

.player-buttons {
    display: flex;
    align-items: center;
    gap: 15px;
}

.player-btn {
    width: 50px;
    height: 50px;
    border: 2px solid #ddd;
    border-radius: 50%;
    background: white;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #666;
}

.player-btn svg {
    transition: transform 0.2s ease;
}

.player-btn:hover {
    border-color: #999;
    background: #f8f8f8;
}

.player-btn {
    transition: background 0.3s ease, border-color 0.3s ease, color 0.3s ease;
}

.player-btn:active:not(:disabled) {
    background: #333;
    border-color: #333;
    color: white;
    transition: none;
}

.player-btn:active svg {
    transform: scale(0.9);
}

.player-btn:disabled {
    border-color: #ddd;
    background: #f5f5f5;
    color: #ccc;
    cursor: not-allowed;
}

.play-pause {
    width: 60px;
    height: 60px;
    border-width: 3px;
}

.play-pause.playing {
    background: #333;
    color: white;
    border-color: #333;
}

.sound-btn,
.translation-sound-btn,
.sentence-sound-btn {
    width: 44px;
    height: 44px;
    border-width: 1px;
}

.sound-btn.active,
.translation-sound-btn.active,
.sentence-sound-btn.active {
    background: #333;
    color: white;
    border-color: #333;
}

.player-options {
    display: flex;
    align-items: center;
    gap: 20px;
    flex-wrap: wrap;
    justify-content: center;
    width: 100%;
}

.control-group {
    display: flex;
    align-items: center;
    gap: 10px;
}

.control-label {
    font-size: 0.9rem;
    color: #666;
    font-weight: 500;
}

/* Speed Slider Styles */
.slider-group {
    flex-direction: column;
    align-items: flex-start !important;
    gap: 6px !important;
}

.speed-slider-container {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
}

.speed-slider {
    flex: 1;
    height: 6px;
    -webkit-appearance: none;
    appearance: none;
    background: #e0e0e0;
    border-radius: 3px;
    outline: none;
    cursor: pointer;
    touch-action: none;
}

.speed-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    background: #4CAF50;
    border-radius: 50%;
    cursor: pointer;
    transition: background 0.2s;
}

.speed-slider::-webkit-slider-thumb:hover {
    background: #45a049;
}

.speed-slider::-moz-range-thumb {
    width: 18px;
    height: 18px;
    background: #4CAF50;
    border: none;
    border-radius: 50%;
    cursor: pointer;
}

.speed-value {
    min-width: 45px;
    font-size: 0.85rem;
    font-weight: 600;
    color: #4CAF50;
    text-align: right;
}

/* Desktop Sliders */
.slider-group-desktop {
    gap: 8px !important;
}

.speed-slider-desktop {
    width: 80px;
    height: 4px;
    -webkit-appearance: none;
    appearance: none;
    background: #e0e0e0;
    border-radius: 2px;
    outline: none;
    cursor: pointer;
}

.speed-slider-desktop::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 14px;
    height: 14px;
    background: #333;
    border-radius: 50%;
    cursor: pointer;
}

.speed-slider-desktop::-moz-range-thumb {
    width: 14px;
    height: 14px;
    background: #333;
    border: none;
    border-radius: 50%;
    cursor: pointer;
}

.speed-value-desktop {
    font-size: 0.75rem;
    font-weight: 600;
    color: #333;
    min-width: 35px;
}

.option-btn,
.repeat-selector,
.sequence-selector,
.learning-mode-selector {
    padding: 6px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    background: white;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    color: #666;
    font-size: 0.85rem;
    min-width: 60px;
    text-align: center;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    justify-content: center;
}

.sequence-selector .icon {
    width: 16px;
    height: 16px;
}

.option-btn:hover,
.repeat-selector:hover,
.sequence-selector:hover,
.learning-mode-selector:hover {
    border-color: #999;
}

.option-btn.active,
.repeat-selector.active,
.sequence-selector.active,
.learning-mode-selector.active {
    background: #333;
    color: white;
    border-color: #333;
}

.sequence-selector.active .icon {
    fill: white;
}

.option-btn:disabled,
.repeat-selector:disabled,
.sequence-selector:disabled,
.learning-mode-selector:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    background: #f5f5f5;
}

/* Select для настроек */
.setting-select {
    padding: 6px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    background: white;
    font-weight: 500;
    cursor: pointer;
    color: #666;
    font-size: 0.85rem;
    min-width: 150px;
    max-width: 200px;
}

.setting-select:focus {
    outline: none;
    border-color: #4a90e2;
}

.vocabulary-manager {
    background: white;
    padding: 25px;
    border-top: 1px solid #e5e5e5;
}

.vocabulary-selector-container {
    display: flex;
    gap: 12px;
    align-items: center;
    flex-wrap: wrap;
    justify-content: center;
}

.vocab-selector,
.vocab-selector-mobile {
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    background: white;
    font-weight: 500;
    font-size: 0.9rem;
    color: #333;
    cursor: pointer;
    min-width: 250px;
}

.icon {
    display: inline-block;
    width: 1em;
    height: 1em;
    stroke-width: 0;
    stroke: currentColor;
    fill: currentColor;
}

.no-words {
    text-align: center;
    color: #888;
    width: 100%;
}

/* --- MOBILE-SPECIFIC STYLES --- */
.header-mobile,
.player-controls-mobile,
#settingsButton,
.settings-overlay,
.settings-panel {
    display: none;
}

/* ============================================ */
/* === СТИЛИ ДЛЯ АВТОРИЗАЦИИ И МОДАЛЬНОГО ОКНА === */
/* ============================================ */

/* --- Контейнер в шапке --- */
.auth-container {
    position: absolute;
    top: 50%;
    right: 30px;
    transform: translateY(-50%);
    display: flex;
    align-items: center;
}

.auth-trigger-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    border-radius: 20px;
    border: 1px solid #ddd;
    background-color: #fff;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 0.9rem;
    color: #333;
}

.auth-trigger-btn:hover {
    background-color: #f7f7f7;
    border-color: #ccc;
}

/* --- Профиль пользователя --- */
.user-profile {
    display: flex;
    align-items: center;
    gap: 12px;
}

.user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background-color: #eee;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    font-weight: 500;
}

.user-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.user-info {
    text-align: left;
}

.user-name {
    font-weight: 500;
    font-size: 0.95rem;
    line-height: 1.2;
}

.user-email {
    font-size: 0.8rem;
    color: #777;
    line-height: 1.2;
}

.btn-icon {
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #777;
}

.btn-icon:hover {
    background-color: #f0f0f0;
    color: #333;
}

/* --- Модальное окно --- */
#authOverlay,
#archiveOverlay_desktop {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1001;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0s 0.3s;
}

#authOverlay.visible,
#archiveOverlay_desktop.visible {
    opacity: 1;
    visibility: visible;
    transition-delay: 0s;
}

.auth-modal {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.95);
    background: white;
    border-radius: 8px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
    z-index: 1002;
    width: 100%;
    max-width: 400px;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.auth-modal.visible {
    transform: translate(-50%, -50%) scale(1);
    opacity: 1;
    visibility: visible;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    border-bottom: 1px solid #e5e5e5;
}

.modal-header h3 {
    font-size: 1.1rem;
    font-weight: 500;
}

.modal-content {
    padding: 20px;
}

/* --- Табы --- */
.auth-tabs {
    display: flex;
    border-bottom: 1px solid #e5e5e5;
    margin-bottom: 20px;
}

.auth-tab {
    flex: 1;
    padding: 10px;
    text-align: center;
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 500;
    color: #888;
    border-bottom: 2px solid transparent;
    transition: all 0.2s ease;
}

.auth-tab.active {
    color: #333;
    border-bottom-color: #333;
}

.auth-tab-content {
    display: none;
}

.auth-tab-content.active {
    display: block;
}

/* --- Социальные кнопки и разделитель --- */
.social-auth {
    margin-bottom: 20px;
}

.social-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    padding: 10px;
    border-radius: 4px;
    border: 1px solid #ddd;
    background: #fff;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 500;
    gap: 10px;
}

.social-btn:hover {
    background: #f7f7f7;
}

.divider {
    display: flex;
    align-items: center;
    text-align: center;
    color: #aaa;
    margin: 20px 0;
}

.divider::before,
.divider::after {
    content: '';
    flex: 1;
    border-bottom: 1px solid #e5e5e5;
}

.divider:not(:empty)::before {
    margin-right: .5em;
}

.divider:not(:empty)::after {
    margin-left: .5em;
}

/* --- Формы --- */
.form-group {
    margin-bottom: 15px;
}

.form-group label {
    display: block;
    font-size: 0.9rem;
    font-weight: 500;
    margin-bottom: 5px;
}

.form-group input {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 1rem;
}

.form-group input:focus {
    outline: none;
    border-color: #4a90e2;
    box-shadow: 0 0 0 2px rgba(74, 144, 226, 0.2);
}

.form-group .hint {
    font-size: 0.8rem;
    color: #888;
    margin-top: 5px;
}

/* --- Общие кнопки --- */
.btn-primary {
    display: block;
    width: 100%;
    padding: 12px;
    background: #333;
    color: white;
    border: none;
    border-radius: 4px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s ease;
}

.btn-primary:hover {
    background: #555;
}

.btn-link {
    background: none;
    border: none;
    color: #4a90e2;
    cursor: pointer;
    font-size: 0.9rem;
    padding: 0;
    margin-bottom: 15px;
}

.back-btn {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 0.9rem;
    color: #555;
    margin-bottom: 20px;
}

/* --- Уведомления --- */
.notification {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background-color: #333;
    color: white;
    padding: 12px 20px;
    border-radius: 4px;
    z-index: 2000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.notification.visible {
    opacity: 1;
    visibility: visible;
}

.notification.success {
    background-color: #28a745;
}

.notification.error {
    background-color: #dc3545;
}

/* --- Стили для кнопки Архивации --- */
.archive-btn {
    position: absolute;
    /* Позиционируется относительно .card */
    bottom: 20px;
    right: 20px;
    width: 60px;
    /* Крупнее для десктопа */
    height: 60px;
    background-color: #f0f2f5;
    border: 1px solid #d9d9d9;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    /* Добавили transition для opacity */
    color: #888;
    z-index: 10;
    opacity: 1;
    pointer-events: auto;
}

.archive-btn:hover {
    background-color: #e9ecef;
    color: #333;
    transform: scale(1.05);
}

.archive-btn .icon {
    width: 28px;
    /* Иконка тоже чуть крупнее */
    height: 28px;
}


/* --- Стили для индикатора прогресса --- */
.window-progress-indicator {
    position: absolute;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    border: 1px solid #e9ecef;
    border-radius: 8px;
    padding: 8px 16px;
    box-shadow: none;
    z-index: 10;
    display: flex;
    align-items: center;
    gap: 32px;
    font-size: 0.9rem;
    font-weight: 500;
    color: #333;
    max-width: calc(100% - 140px);
}

#windowProgressText {
    display: flex;
    align-items: center;
    gap: 2px 14px;
    flex-wrap: wrap;
    justify-content: center;
}

.window-progress-indicator .pi-block {
    white-space: nowrap;
}

.window-progress-indicator .pi-offline {
    color: #e53935;
    font-weight: 600;
}


/* ============================================ */
/* === КНОПКА "В АРХИВ" === */
/* ============================================ */

/* Десктопная версия - привязка к блоку управления */
.player-controls-desktop {
    position: relative;
    /* Для позиционирования кнопки */
}

.archive-btn-desktop {
    position: absolute;
    right: 20px;
    top: -67px;
    /* Высота кнопки (50px) + отступ 1/3 диаметра (~17px) */
    width: 50px;
    height: 50px;
    background: white;
    border: 1px solid #ddd;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 100;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
}

.archive-btn-desktop:hover {
    background: #f8f9fa;
    border-color: #999;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    transform: translateY(-2px);
}

.archive-btn-desktop .icon {
    width: 24px;
    height: 24px;
    fill: #666;
}

.archive-btn-desktop:hover .icon {
    fill: #333;
}


/* --- НОВЫЕ СТИЛИ ДЛЯ АРХИВА --- */
.settings-action-item {
    cursor: pointer;
    padding: 8px 0;
    transition: background-color 0.2s ease;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.settings-action-item:hover {
    background-color: #f8f9fa;
}

.arrow-indicator {
    font-size: 1.2rem;
    color: #adb5bd;
}

.settings-archive {
    padding: 0 20px 20px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    flex: 1;
    min-height: 0;
    scrollbar-width: thin;
    scrollbar-color: #ccc transparent;
}

.settings-archive::-webkit-scrollbar {
    width: 4px;
}

.settings-archive::-webkit-scrollbar-track {
    background: transparent;
}

.settings-archive::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 2px;
}

.archive-header {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 10px;
    border-bottom: 1px solid #e9ecef;
    padding: 10px 0;
}

.archive-header h3 {
    font-size: 1.2rem;
    font-weight: 500;
    margin: 0;
    /* Убираем все отступы */
}

.archive-header .back-btn {
    position: absolute;
    /* Позиционируем кнопку абсолютно */
    left: 0;
    /* Прижимаем к левому краю */
    top: 50%;
    /* Центрируем по вертикали */
    transform: translateY(-50%);
    margin-bottom: 0;
    color: #007bff;
    font-size: 0.9rem;
    z-index: 2;
}

.archive-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.archive-list li {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 5px;
    border-bottom: 1px solid #f1f3f5;
    transition: all 0.3s ease;
    overflow: hidden;
}

.archive-list li.removing {
    opacity: 0;
    max-height: 0;
    padding-top: 0;
    padding-bottom: 0;
    border-bottom-width: 0;
}

.archive-word-info .german {
    font-weight: 500;
    color: #343a40;
}

.archive-word-info .russian {
    font-size: 0.85rem;
    color: #6c757d;
    display: block;
}

.restore-btn {
    background: #e9ecef;
    border: none;
    border-radius: 20px;
    padding: 6px 14px;
    font-size: 0.8rem;
    font-weight: 500;
    color: #495057;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.restore-btn:hover {
    background: #dee2e6;
}

/* --- СТИЛИ ДЛЯ ИНФОРМАЦИОННОГО ОВЕРЛЕЯ (ФИНАЛЬНАЯ FLEXBOX ВЕРСИЯ) --- */

.feedback-overlay {
    /* --- Внешний вид и позиционирование --- */
    position: absolute;
    top: 50%;
    left: 50%;
    background-color: #cfcfcf;
    color: #fff;
    border-radius: 12px;
    padding: 20px 30px;
    box-shadow: 0 0px 0px rgba(0, 0, 0, 0.1);
    z-index: 100;
    pointer-events: none;

    /* --- Анимация --- */
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.9);
    transition: opacity 0.4s ease-out, transform 0.4s ease-out;

    /* === МАГИЯ FLEXBOX ДЛЯ ИДЕАЛЬНОГО ЦЕНТРИРОВАНИЯ === */
    display: flex;
    /* Включаем Flexbox-контейнер */
    flex-direction: column;
    /* Располагаем элементы друг под другом (вертикально) */
    justify-content: center;
    /* Центрируем по вертикали */
    align-items: center;
    /* Центрируем по горизонтали */
}

.feedback-overlay.visible {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
}

/* Стиль для немецкого слова (первая строка) */
.feedback-word {
    font-size: 1.6rem;
    font-weight: 600;
}

/* Стиль для сообщения ("в Архив") (вторая строка) */
.feedback-action {
    font-size: 0.9rem;
    color: #fff;
    margin-top: 5px;
}

/* --- СТИЛИ ДЛЯ ДЕСКТОПНОГО АРХИВА --- */

/* Кнопка "Архив" рядом с селектором */
.archive-manage-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    border-radius: 4px;
    border: 1px solid #ddd;
    background-color: #fff;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 0.9rem;
    font-weight: 500;
    color: #333;
}

.archive-manage-btn:hover {
    background-color: #f7f7f7;
    border-color: #ccc;
}

.archive-manage-btn .icon {
    width: 18px;
    height: 18px;
}

/* Модальное окно для архива */
.archive-modal {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.95);
    background: white;
    border-radius: 8px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
    z-index: 1002;
    width: 100%;
    max-width: 500px;
    /* Немного шире, чем auth-modal */
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.archive-modal.visible {
    transform: translate(-50%, -50%) scale(1);
    opacity: 1;
    visibility: visible;
}

/* Переиспользуем .archive-list, но добавим отступы для модального окна */
.archive-modal .archive-content {
    max-height: 60vh;
    overflow-y: auto;
    padding-right: 10px;
    /* Отступ для скроллбара */
}

/* --- Стили для управления персональными словарями --- */

.block-btn.personal-vocab-trigger {
    background-color: #f8f9fa;
    border-style: dashed;
    color: #495057;
}

.block-btn.personal-vocab-trigger.active {
    background-color: #e7f1ff;
    color: #007bff;
    border-color: #007bff;
    border-style: solid;
    font-weight: 600;
}

.personal-vocab-panel {
    position: fixed;
    top: 120px;
    right: 30px;
    z-index: 1002;
    width: 350px;
    max-width: calc(100vw - 20px);
    max-height: 70vh;
    background: white;
    border-radius: 8px;
    box-shadow: 0 5px 25px rgba(0, 0, 0, 0.15);
    border: 1px solid #dee2e6;
    /* Flex для header + body */
    display: flex;
    flex-direction: column;
    overflow: hidden;

    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease-out, box-shadow 0.2s ease-out;
}

.personal-vocab-panel.visible {
    opacity: 1;
    pointer-events: auto;
}

/* Overlay для десктопа */
.personal-vocab-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.3);
    z-index: 1001;
}

.personal-vocab-overlay.visible {
    display: block;
}

.personal-vocab-panel .panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 15px;
    background-color: #f8f9fa;
    border-bottom: 1px solid #dee2e6;
}

/* Desktop drag для панели словарей */
.personal-vocab-panel.draggable .panel-header {
    cursor: grab;
}
.personal-vocab-panel.draggable .panel-header:active {
    cursor: grabbing;
}
.personal-vocab-panel.dragging {
    box-shadow: 0 12px 48px rgba(0, 0, 0, 0.3);
}

.personal-vocab-panel .panel-header h4 {
    margin: 0;
    font-size: 1rem;
    flex: 1;
}

.personal-vocab-panel .close-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 6px;
    border-radius: 6px;
    color: #6c757d;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s ease;
}

.personal-vocab-panel .close-btn:hover {
    background: #e9ecef;
    color: #495057;
}

/* Все дочерние элементы панели не выходят за её ширину */
.personal-vocab-panel * {
    min-width: 0;
    max-width: 100%;
}

/* ============================================ */
/* === REVIEW BOTTOM SHEET                   === */
/* ============================================ */

.review-sheet-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.3);
    z-index: 1001;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.review-sheet-overlay.visible {
    opacity: 1;
}

.review-sheet-panel {
    position: fixed;
    top: 120px;
    right: 30px;
    width: 350px;
    max-height: 70vh;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
    z-index: 1002;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    opacity: 0;
    pointer-events: none;
    transform: translateY(-10px);
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.review-sheet-panel.visible {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0);
}

.review-sheet-panel .panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 15px;
    background-color: #f8f9fa;
    border-bottom: 1px solid #dee2e6;
    flex-shrink: 0;
}

.review-sheet-panel .panel-header h4 {
    margin: 0;
    font-size: 1rem;
    flex: 1;
}

.review-sheet-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

/* MIX toggle — кастомный чекбокс */
.review-mix-toggle {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.8rem;
    color: #495057;
    cursor: pointer;
    padding: 4px 10px;
    border-radius: 6px;
    background: #e9ecef;
    user-select: none;
    transition: background 0.2s ease, color 0.2s ease;
}

.review-mix-toggle:hover {
    background: #dee2e6;
}

/* Скрываем нативный чекбокс */
.review-mix-toggle input[type="checkbox"] {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

/* Кастомная галочка */
.mix-checkbox-custom {
    width: 16px;
    height: 16px;
    border: 2px solid #adb5bd;
    border-radius: 3px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    flex-shrink: 0;
    font-weight: normal !important;
}

.mix-checkbox-custom::after {
    content: '';
    display: none;
    width: 4px;
    height: 8px;
    border: solid #fff;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
    margin-bottom: 2px;
}

/* Checked-состояние */
.review-mix-toggle input:checked + .mix-checkbox-custom {
    background: #2196F3;
    border-color: #2196F3;
}

.review-mix-toggle input:checked + .mix-checkbox-custom::after {
    display: block;
}

/* Активное состояние всего тоггла */
.review-mix-toggle:has(input:checked) {
    background: #e3f2fd;
    color: #1565C0;
}

.mix-label-text {
    font-weight: 600;
}

.review-sheet-panel .close-btn {
    background: none;
    border: none;
    cursor: pointer;
    color: #6c757d;
    padding: 4px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s ease;
}

.review-sheet-panel .close-btn:hover {
    background: #e9ecef;
    color: #495057;
}

.review-sheet-panel .panel-body {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    overscroll-behavior-y: contain;
    min-height: 0;
    padding: 0;
}

.review-sheet-status {
    padding: 15px;
    margin: 0;
    color: #6c757d;
    font-size: 0.85rem;
}

.review-sheet-panel .review-list {
    list-style: none;
    padding: 4px 0;
    margin: 0;
}

.review-sheet-panel .review-item {
    padding: 10px 15px;
}

/* Секция добавления слова (фиксирована вверху панели) */
.add-word-section {
    padding: 10px 15px;
    border-bottom: 1px solid #dee2e6;
    background: #f8f9fa;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

/* Фиксированный футер панели */
.personal-vocab-panel .panel-footer {
    flex-shrink: 0;
    padding: 12px 15px;
    border-top: 1px solid #dee2e6;
    background: #f8f9fa;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.add-word-input-wrapper {
    display: flex;
    align-items: center;
    gap: 8px;
    background: white;
    border: 1px solid #dee2e6;
    border-radius: 6px;
    padding: 0 8px;
    transition: border-color 0.15s ease;
}

.add-word-input-wrapper:focus-within {
    border-color: #4a90d9;
}

.add-word-input-wrapper .search-icon {
    font-size: 1rem;
    opacity: 0.5;
}

.add-word-input-wrapper input {
    flex: 1;
    padding: 10px 0;
    border: none;
    font-size: 16px; /* iOS не зумит при >= 16px */
    outline: none;
    background: transparent;
}

.add-word-input-wrapper .add-word-submit {
    padding: 6px 12px;
    border: none;
    background: #4a90d9;
    color: white;
    border-radius: 4px;
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s ease;
    white-space: nowrap;
}

.add-word-input-wrapper .add-word-submit:hover:not(:disabled) {
    background: #3a7bc8;
}

.add-word-input-wrapper .add-word-submit:disabled {
    background: #e9ecef;
    color: #adb5bd;
    cursor: not-allowed;
}

/* Результаты поиска */
.add-word-results {
    margin-top: 10px;
    flex: 1;
    overflow-y: auto;
}

.add-word-results:empty {
    display: none;
}

.add-word-result-item {
    display: flex;
    align-items: center;
    padding: 10px;
    background: white;
    border: 1px solid #e9ecef;
    border-radius: 6px;
    margin-bottom: 6px;
    cursor: pointer;
    transition: all 0.15s ease;
}

.add-word-result-item:hover {
    border-color: #4a90d9;
    background: #f0f7ff;
}

.add-word-result-item.selected {
    border-color: #28a745;
    background: #e8f5e9;
}

/* Дочерние элементы не перехватывают клики */
.add-word-result-item > * {
    pointer-events: none;
}

.add-word-result-item .select-checkbox {
    font-size: 1.1rem;
    margin-right: 10px;
    color: #adb5bd;
    transition: color 0.15s ease;
}

.add-word-result-item.selected .select-checkbox {
    color: #28a745;
}

.add-word-result-item .word-info {
    flex: 1;
}

.add-word-result-item .word-de {
    font-weight: 600;
    color: #212529;
}

.add-word-result-item .word-ru {
    font-size: 0.85rem;
    color: #6c757d;
}

.add-word-result-item .word-level {
    font-size: 0.75rem;
    padding: 2px 6px;
    background: #e9ecef;
    border-radius: 3px;
    color: #495057;
    margin-left: 8px;
}


/* Сообщения в результатах */
.add-word-no-results {
    text-align: center;
    padding: 15px;
    color: #6c757d;
    font-size: 0.9rem;
}

.add-word-loading {
    text-align: center;
    padding: 15px;
    color: #6c757d;
}

/* Когда идёт поиск, секция растягивается на всю панель */
.add-word-section.searching {
    flex: 1;
    border-bottom: none;
    overflow-y: auto;
}
.add-word-section.searching ~ .panel-body,
.add-word-section.searching ~ .panel-footer {
    display: none !important;
}

/* === Диалог "Сохранить в словарь" === */
.save-to-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0, 0, 0, 0.4);
    z-index: 1010;
    display: flex;
    align-items: center;
    justify-content: center;
}
.save-to-dialog {
    background: white;
    border-radius: 10px;
    width: 280px;
    max-height: 60vh;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.2);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
.save-to-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 15px;
    background: #f8f9fa;
    border-bottom: 1px solid #dee2e6;
    font-size: 0.9rem;
    font-weight: 600;
}
.save-to-close {
    background: none;
    border: none;
    font-size: 1.2rem;
    cursor: pointer;
    color: #6c757d;
    padding: 0 4px;
}
.save-to-body {
    padding: 10px 15px;
    overflow-y: auto;
    flex: 1;
}
.save-to-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 0;
    cursor: pointer;
    border-bottom: 1px solid #f0f0f0;
}
.save-to-item:last-of-type {
    border-bottom: none;
}
.save-to-item input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: #0d6efd;
    flex-shrink: 0;
}
.save-to-name {
    flex: 1;
    font-size: 0.9rem;
}
.save-to-count {
    color: #6c757d;
    font-size: 0.8rem;
}
.save-to-new-row {
    margin-top: 8px;
}
.save-to-new-btn {
    width: 100%;
    padding: 8px;
    background: none;
    border: 1px dashed #adb5bd;
    border-radius: 6px;
    color: #495057;
    cursor: pointer;
    font-size: 0.85rem;
    transition: all 0.15s;
}
.save-to-new-btn:hover {
    border-color: #0d6efd;
    color: #0d6efd;
}
.save-to-new-input-row {
    display: flex;
    gap: 6px;
    align-items: center;
}
.save-to-new-input {
    flex: 1;
    padding: 7px 10px;
    border: 1px solid #dee2e6;
    border-radius: 6px;
    font-size: 16px; /* iOS не зумит при >= 16px */
    outline: none;
}
.save-to-new-input:focus {
    border-color: #0d6efd;
}
.save-to-new-ok {
    padding: 7px 12px;
    background: #0d6efd;
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 0.85rem;
    cursor: pointer;
    white-space: nowrap;
}
.save-to-new-ok:hover {
    opacity: 0.9;
}
.save-to-footer {
    padding: 10px 15px;
    border-top: 1px solid #dee2e6;
}
.save-to-submit {
    width: 100%;
    padding: 8px;
    background: #0d6efd;
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 0.9rem;
    cursor: pointer;
    transition: opacity 0.15s;
}
.save-to-submit:hover:not(:disabled) {
    opacity: 0.9;
}
.save-to-submit:disabled {
    background: #adb5bd;
    cursor: not-allowed;
}

/* Скроллируемая область панели (между поиском и футером) */
.personal-vocab-panel .panel-body {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    min-height: 0;
}

.personal-vocab-panel .panel-content {
    padding: 15px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.mix-mode-control {
    border-top: 1px solid #e9ecef;
    padding-top: 15px;
    display: flex;
    align-items: center;
}

.mix-mode-control label {
    cursor: pointer;
    margin-left: 10px;
}

#personalVocabListContainer .vocab-checkbox-wrapper label {
    padding: 6px 8px;
}

.btn-secondary {
    display: block;
    width: 100%;
    padding: 10px;
    background: #f8f9fa;
    color: #495057;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-secondary:hover {
    background: #e9ecef;
    border-color: #ced4da;
}

/* Inline форма создания словаря */
.create-vocab-inline {
    margin-top: 12px;
    padding: 12px;
    background: #f8f9fa;
    border-radius: 8px;
    border: 1px solid #e9ecef;
}

.create-vocab-inline .form-group {
    margin-bottom: 12px;
}

.create-vocab-inline input[type="text"] {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 1rem;
    box-sizing: border-box;
}

.create-vocab-inline input[type="text"]:focus {
    outline: none;
    border-color: #4a90d9;
    box-shadow: 0 0 0 2px rgba(74, 144, 217, 0.2);
}

.create-vocab-actions {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
}

.create-vocab-actions .btn-cancel {
    padding: 8px 16px;
    border: 1px solid #ddd;
    border-radius: 6px;
    background: white;
    color: #6c757d;
    cursor: pointer;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.create-vocab-actions .btn-cancel:hover {
    background: #f8f9fa;
    border-color: #adb5bd;
}

.create-vocab-actions .btn-primary {
    padding: 8px 16px;
    border: none;
    border-radius: 6px;
    background: #4a90d9;
    color: white;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 500;
}

.create-vocab-actions .btn-primary:hover {
    background: #357abd;
}

/* Информация о выбранных словах */
.create-vocab-inline .selected-words-info {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    background: #e8f5e9;
    border: 1px solid #c8e6c9;
    border-radius: 6px;
    margin-bottom: 12px;
    font-size: 0.85rem;
    color: #2e7d32;
}

.create-vocab-inline .selected-words-info .info-icon {
    font-size: 1rem;
}

/* Стили списка словарей в панели */
.vocab-checkbox-wrapper {
    display: flex;
    align-items: center;
    padding: 8px 10px;
    border-radius: 6px;
    transition: background 0.15s ease;
}

.vocab-checkbox-wrapper:hover {
    background: #f8f9fa;
}

.vocab-checkbox-wrapper.selected {
    background: #e3f2fd;
    border-color: #2196f3;
}

.vocab-checkbox-wrapper.selected .vocab-info {
    background: transparent;
}

.vocab-checkbox-wrapper.selected .vocab-info:hover {
    background: transparent;
}

.vocab-checkbox-wrapper.selected .vocab-name {
    color: #111;
    font-weight: 600;
}

.vocab-checkbox-wrapper input[type="checkbox"] {
    width: 18px;
    height: 18px;
    margin-right: 10px;
    cursor: pointer;
    accent-color: #4a90d9;
    transition: box-shadow 0.15s ease;
}

.vocab-checkbox-wrapper input[type="checkbox"]:hover {
    box-shadow: 0 0 0 3px rgba(74, 144, 217, 0.3);
    border-radius: 3px;
}

.vocab-checkbox-wrapper .vocab-info {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
    transition: background 0.15s ease;
}

/* На десктопе при hover показываем стрелку */
@media (hover: hover) {
    .vocab-checkbox-wrapper .vocab-info:hover .vocab-arrow {
        opacity: 1;
    }
}

.vocab-checkbox-wrapper .vocab-icon {
    font-size: 1.1rem;
}

.vocab-checkbox-wrapper .vocab-name {
    font-weight: 500;
    color: #333;
}
.vocab-checkbox-wrapper.vocab-default .vocab-name {
    font-weight: 700;
}

.vocab-checkbox-wrapper .vocab-arrow {
    font-size: 1.2rem;
    color: #111;
    margin-left: 4px;
    transition: transform 0.15s ease, opacity 0.15s ease;
    opacity: 0;
}

.vocab-checkbox-wrapper.selected .vocab-arrow {
    opacity: 1;
}

.vocab-checkbox-wrapper .vocab-count {
    font-size: 0.8rem;
    color: #999;
    margin-left: auto;
}
/* === БЛОК ВИРТУАЛЬНЫХ СЛОВАРЕЙ (Review, Archive) === */
.vocab-virtual-block {
    margin-top: 12px;
    background-color: #f5f5f5;
    border-radius: 8px;
    border: 1px solid #e0e0e0;
}

.vocab-virtual-block .vocab-checkbox-wrapper {
    background-color: transparent;
}

.vocab-virtual-block .vocab-checkbox-wrapper:first-child {
    border-top-left-radius: 8px;
    border-top-right-radius: 8px;
}

.vocab-virtual-block .vocab-checkbox-wrapper:last-child {
    border-bottom-left-radius: 8px;
    border-bottom-right-radius: 8px;
}

.vocab-virtual-block .vocab-checkbox-wrapper.vocab-archive {
    margin-top: 0;
}

/* Архив без чекбокса - расширенный .vocab-info */
.vocab-info.vocab-info-full {
    padding-left: 28px; /* Компенсация отсутствующего чекбокса */
}

/* === ПУСТОЕ СОСТОЯНИЕ СЛОВАРЯ === */
.vocab-empty-state {
    padding: 30px 20px;
    text-align: center;
    color: #6c757d;
}

.vocab-empty-state p {
    margin: 0 0 8px 0;
    font-size: 0.95rem;
}

.vocab-empty-state .hint {
    font-size: 0.85rem;
    color: #adb5bd;
    line-height: 1.5;
}

/* === СЛОВА В РЕЖИМЕ REVIEW === */
.vocab-word-item.review-active {
    background-color: #e8f5e9;
    border-left: 3px solid #4caf50;
}

.vocab-word-item.review-waiting {
    background-color: #fff8e1;
    border-left: 3px solid #ffc107;
}

.review-date {
    display: inline-block;
    margin-left: 8px;
    font-size: 0.8rem;
    color: #ff9800;
    font-weight: 500;
}


/* ======================================================= */
/*          ПАНЕЛЬ СПИСКА СЛОВ СЛОВАРЯ                     */
/* ======================================================= */
.vocab-words-panel {
    position: fixed;
    top: 120px;
    right: 30px;
    z-index: 1003;
    width: 380px;
    max-height: 70vh;
    background: white;
    border-radius: 8px;
    box-shadow: 0 5px 25px rgba(0, 0, 0, 0.15);
    border: 1px solid #dee2e6;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.vocab-words-panel .panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 15px;
    background-color: #f8f9fa;
    border-bottom: 1px solid #dee2e6;
}

.vocab-words-panel .panel-header h4 {
    margin: 0;
    font-size: 1rem;
    flex: 1;
    text-align: center;
}

.vocab-words-panel .back-btn,
.vocab-words-panel .close-btn {
    background: none;
    border: none;
    font-size: 1.2rem;
    cursor: pointer;
    padding: 0;
    margin: 0;
    border-radius: 4px;
    color: #495057;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    line-height: 1;
}

.vocab-words-panel .back-btn:hover,
.vocab-words-panel .close-btn:hover {
    background: #e9ecef;
}

.vocab-words-list {
    flex: 1;
    overflow-y: auto;
    padding: 10px;
}

.vocab-words-list:empty::after {
    content: 'Словарь пуст';
    display: block;
    text-align: center;
    color: #6c757d;
    padding: 30px;
}

/* Элемент слова в списке */
.vocab-word-item {
    display: flex;
    align-items: center;
    padding: 10px 12px;
    background: #f8f9fa;
    border-radius: 6px;
    margin-bottom: 8px;
    gap: 10px;
}

.vocab-word-item:hover {
    background: #e9ecef;
}
.vocab-word-item.vw-locked {
    opacity: 0.55;
    background: #f0f0f0;
}
.vocab-word-item.vw-locked:hover {
    background: #f0f0f0;
}
.vocab-word-item.vw-locked .gs-premium-badge {
    flex-shrink: 0;
}

.vocab-word-item .word-main {
    flex: 1;
    min-width: 0;
}

.vocab-word-item .word-de {
    font-weight: 600;
    color: #212529;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.vocab-word-item .word-ru {
    font-size: 0.85rem;
    color: #6c757d;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.vocab-word-item .word-actions {
    display: flex;
    gap: 4px;
}

.vocab-word-item .word-action-btn {
    width: 28px;
    height: 28px;
    border: none;
    background: transparent;
    border-radius: 4px;
    cursor: pointer;
    font-size: 1rem;
    color: #6c757d;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s ease;
    outline: none;
}

.vocab-word-item .word-action-btn:focus,
.vocab-word-item .word-action-btn:active {
    outline: none;
    background: transparent;
    color: #6c757d;
}

.vocab-word-item .word-action-btn.reset-state,
.vocab-word-item .word-action-btn.reset-state:focus,
.vocab-word-item .word-action-btn.reset-state:active,
.vocab-word-item .word-action-btn.reset-state:hover {
    background: transparent !important;
    color: #6c757d !important;
    outline: none !important;
}

/* Hover эффекты только для устройств с мышью */
@media (hover: hover) {
    .vocab-word-item .word-action-btn:hover {
        background: #dee2e6;
    }

    .vocab-word-item .word-action-btn.move-btn:hover {
        color: #4a90d9;
    }

    .vocab-word-item .word-action-btn.remove-btn:hover {
        color: #dc3545;
        background: #f8d7da;
    }
}

/* Active состояние для мобильных (при нажатии) */
.vocab-word-item .word-action-btn:active {
    background: #dee2e6;
}

.vocab-word-item .word-action-btn.move-btn:active {
    color: #4a90d9;
}

.vocab-word-item .word-action-btn.remove-btn:active {
    color: #dc3545;
    background: #f8d7da;
}

/* Состояние когда dropdown открыт */
.vocab-word-item .word-action-btn.dropdown-open {
    background: #dee2e6;
    color: #4a90d9;
}

/* Состояние удаления слова */
.vocab-word-item.deleting {
    background: #fff8f8;
}

.vocab-word-item.deleting .deleting-text {
    color: #dc3545;
    font-weight: 600;
    font-size: 0.75rem;
    letter-spacing: 0.5px;
}

.delete-bars {
    display: inline-flex;
    gap: 3px;
    margin-left: 8px;
    vertical-align: middle;
}

.delete-bar {
    width: 4px;
    height: 14px;
    background: #dc3545;
    border-radius: 2px;
    opacity: 0.7;
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.delete-bar.hidden {
    opacity: 0;
    transform: scaleY(0);
}

.vocab-word-item .cancel-delete-btn {
    background: none;
    border: none;
    color: #4a90d9;
    font-weight: 600;
    font-size: 0.75rem;
    cursor: pointer;
    padding: 4px 8px;
    letter-spacing: 0.5px;
}

.vocab-word-item .cancel-delete-btn:hover {
    color: #357abd;
    text-decoration: underline;
}

/* Анимация схлопывания строки */
.vocab-word-item.collapsing {
    overflow: hidden;
    animation: collapseRow 300ms ease-out forwards;
}

@keyframes collapseRow {
    0% {
        opacity: 1;
        max-height: 60px;
        padding-top: 10px;
        padding-bottom: 10px;
        margin-bottom: 8px;
    }
    100% {
        opacity: 0;
        max-height: 0;
        padding-top: 0;
        padding-bottom: 0;
        margin-bottom: 0;
    }
}

/* === СТАТУСЫ СЛОВ В СПИСКЕ СЛОВАРЯ === */
.vocab-word-item.word-archived {
    background: #f5f5f5;
    opacity: 0.7;
}

.vocab-word-item.word-archived .word-de {
    color: #888;
}

.vocab-word-item.word-review {
    background: #fff8e1;
    border-left: 3px solid #ffc107;
}

.word-status-badge {
    display: inline-block;
    font-size: 0.65rem;
    font-weight: 600;
    padding: 1px 5px;
    border-radius: 3px;
    margin-left: 8px;
    vertical-align: middle;
    letter-spacing: 0.3px;
}

.word-status-badge.archived {
    background: #2196F3;
    color: #fff;
}

.word-status-badge.review {
    background: #FF6B00;
    color: #fff;
}

.word-status-badge.personal {
    background: #7c5cbf;
    color: #fff;
}

/* Выпадающий список для переноса */
.move-dropdown {
    position: absolute;
    right: 0;
    top: 100%;
    background: white;
    border: 1px solid #dee2e6;
    border-radius: 6px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 1010;
    min-width: 180px;
    max-height: 200px;
    overflow-y: scroll;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
}

/* Видимый скроллбар */
.move-dropdown::-webkit-scrollbar {
    width: 4px;
}
.move-dropdown::-webkit-scrollbar-track {
    background: #f0f0f0;
    border-radius: 2px;
}
.move-dropdown::-webkit-scrollbar-thumb {
    background: #bbb;
    border-radius: 2px;
}

/* Индикатор скролла — DOM-элемент поверх dropdown */
.move-dropdown-scroll-hint {
    height: 14px;
    line-height: 14px;
    text-align: center;
    font-size: 0.5rem;
    color: #ccc;
    background: linear-gradient(transparent, white 30%);
    pointer-events: none;
    z-index: 1011;
    border-radius: 0 0 6px 6px;
}

.move-dropdown-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    cursor: pointer;
    font-size: 0.9rem;
    border: none;
    background: none;
    width: 100%;
    text-align: left;
}

.move-dropdown-item:hover {
    background: #f0f7ff;
}

/* Mobile */
@media (max-width: 768px) {
    .vocab-words-panel {
        position: fixed;
        top: auto;
        bottom: 0;
        left: 0;
        right: 0;
        width: 100%;
        max-height: 70vh;
        border-radius: 16px 16px 0 0;
        border: none;
    }

    .vocab-words-panel .panel-header {
        position: sticky;
        top: 0;
        background: #f8f9fa;
        z-index: 1;
        border-radius: 16px 16px 0 0;
    }
}

/* Кнопка удаления словаря */
.vocab-delete-btn {
    width: 24px;
    height: 24px;
    border: none;
    background: transparent;
    color: #ccc;
    font-size: 1.2rem;
    cursor: pointer;
    border-radius: 4px;
    transition: all 0.15s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-left: 8px;
}

.vocab-delete-btn:hover {
    background: #fee;
    color: #e55;
}

/* ============================================ */
/* === ОСНОВНОЙ БЛОК АДАПТАЦИИ ДЛЯ МОБИЛЬНЫХ === */
/* ============================================ */

@media (max-width: 768px) {
    html {
        overflow-x: hidden;
        max-width: 100%;
    }

    body {
        overflow-x: hidden;
        overflow-y: scroll;
        max-width: 100%;
        overscroll-behavior: none;
        -webkit-overflow-scrolling: touch;
        /* Блокируем горизонтальные свайпы */
        touch-action: pan-y;
        padding: env(safe-area-inset-top) 0 80px;
    }


    .container {
        margin: 0;
        border-radius: 0;
        box-shadow: none;
        max-width: 100%;
    }

    .main-content {
        align-items: flex-start;
        justify-content: flex-start;
        padding: 10px;
        /* Минимальная высота = viewport - control bar */
        min-height: calc(100vh - 80px);
        min-height: calc(100dvh - 80px); /* Dynamic viewport для iOS Safari */
    }

    .card {
        padding: 80px 20px 20px 20px;
        border: none;
        margin-bottom: 0;
    }

    /* --- [НОВОЕ] Уменьшаем символ на мобильных --- */
    .symbol-display {
        font-size: 4rem;
        /* Чуть меньше, чем на десктопе */
        margin-bottom: 10px;
        color: #e9ecef;
        /* Оставляем светлым */
    }

    /* Разделитель морфем в главном слове: вертикальная черта на мобильных */
    .word-separator::before {
        content: "|";
    }

    /* --------------------------------------------- */

    .word {
        font-size: 3rem;
    }

    .translation {
        font-size: 1.5rem;
    }

    .header,
    .stats,
    .player-controls-desktop,
    .vocabulary-manager {
        display: none !important;
    }

    .block-label {
        display: none;
    }

    .header-mobile {
        display: block;
        padding: 20px;
        text-align: center;
        border-bottom: 1px solid #e9ecef;
        overflow: hidden;
        max-height: 150px;
        transition: max-height 0.3s ease-out, padding 0.3s ease-out, border-color 0.3s;
        background: white;
        position: sticky;
        top: 0;
        z-index: 999;
    }

    .header-mobile.collapsed {
        max-height: 0;
        padding-top: 0;
        padding-bottom: 0;
        border-color: transparent;
        transition: max-height 1.2s ease-out, padding 1.2s ease-out, border-color 1.2s;
    }

    .level-selector {
        display: flex;
        align-items: center;
        padding: 10px;
        border-bottom: 1px solid #e9ecef;
        gap: 8px;
        overflow: hidden;
        max-height: 200px;
        transition: max-height 0.8s ease-in-out, padding 0.8s ease-in-out, border-color 0.8s;
    }
    .level-selector.zone-collapsed {
        max-height: 0;
        padding-top: 0;
        padding-bottom: 0;
        border-color: transparent;
    }

    .topics-container {
        overflow: hidden;
        max-height: 500px;
        transition: max-height 0.8s ease-in-out, padding 0.8s ease-in-out, border-color 0.8s;
    }
    .topics-container.zone-collapsed {
        max-height: 0;
        padding-top: 0;
        padding-bottom: 0;
        border-color: transparent;
    }



    /* block-selector скрыт - темы показываются в topics-row */
    .block-selector {
        display: none;
    }

    .level-buttons,
    .block-buttons {
        justify-content: center;
        gap: 4px clamp(4px, 2vw, 10px);
    }

    .global-search-spacer {
        display: block;
        width: 28px;
        flex-shrink: 0;
    }

    /* Global search → full-width panel на мобильном */
    .global-search-overlay {
        padding-top: 0;
        align-items: flex-start;
    }

    .global-search-dialog {
        width: 100%;
        max-width: 100%;
        max-height: var(--vvh, 100vh);
        border-radius: 0;
        padding-top: env(safe-area-inset-top, 0px);
    }

    .global-search-results {
        -webkit-overflow-scrolling: touch;
    }

    .level-btn,
    .block-btn {
        border: none;
        background: none;
        padding: 6px 8px;
        font-size: 0.9rem;
        font-weight: 400;
        color: #6c757d;
    }

    .level-btn:disabled {
        color: #ced4da;
    }

    .level-btn.active,
    .block-btn.active {
        color: #212529;
        font-weight: 600;
        background: none;
    }

    .startpack-divider {
        width: 1px;
        height: 14px;
        background: #ced4da;
        margin: 0 2px;
    }

    .startpack-btn.active {
        color: #2563eb;
        font-weight: 600;
        background: none;
    }

    .morpheme-separator-desktop {
        display: none;
    }

    .morpheme-separator-mobile {
        display: inline;
    }

    /* Вертикальное расположение морфем на мобильных */
    .decomposition {
        display: flex;
        flex-wrap: wrap;
        justify-content: center;
        gap: 0px 10px;
        padding-bottom: 6px;
        max-height: 200px;
        overflow: hidden;
        transition: opacity 0.5s ease;
    }

    .decomp-item {
        display: inline-flex;
        flex-direction: column;
        align-items: center;
        line-height: 1.1;
    }

    .decomp-note {
        margin-left: 0;
        margin-bottom: -6px;
        display: block;
    }

    .meaning-chain {
        margin-top: 4px;
        font-size: 0.75rem;
        transition: opacity 0.8s ease;
    }

    /* Скрываем meaning-chain при появлении предложения */
    .card.phase-sentence .meaning-chain {
        opacity: 0;
    }

    /* Скрываем многострочные морфемы при переводе — мгновенно */
    .card.phase-translation .pronunciation-area.multiline-decomposition .decomposition {
        opacity: 0;
        transition: opacity 0s;
    }

    /* Перевод по центру — top смещает визуально, layout не трогает */
    .card.phase-translation .pronunciation-area.multiline-decomposition:not(.show-extended-form) ~ #translationContainer {
        top: -20px;
    }

    .level-indicator {
        background: transparent !important;
        color: #666;
        top: 20px;
        right: 30px;
        padding: 4px 8px;
        font-size: 0.8rem;
        font-weight: 400;
    }

    .source-marker {
        top: 20px;
        left: 30px;
        background: transparent !important;
        color: inherit;
        width: auto;
        height: auto;
        padding: 4px 8px;
        font-size: 0.8rem;
        font-weight: 400;
    }

    .source-marker.source-goethe {
        color: #4a90d9;
    }

    .source-marker.source-personal {
        color: #7c3aed;
    }

    .source-marker.source-review {
        color: #f59e0b;
    }

    .source-marker.source-archive {
        color: #6b7280;
    }

    .flag-error-btn {
        top: 62px;
        right: 30px;
        width: 32px;
        height: 32px;
        font-size: 22px;
    }

    .star-favorite-btn {
        top: 120px;
        right: 30px;
        width: 32px;
        height: 32px;
        font-size: 22px;
    }

    /* Модалка флага на мобильных */
    .flag-modal-overlay {
        padding: 60px 16px 20px;
    }

    .flag-modal {
        position: relative;
    }

    .flag-modal-comment {
        font-size: 16px; /* Предотвращает zoom на iOS */
    }

    /* При клавиатуре — модалка прижимается к верху */
    /* keyboard-mode: скрываем чекбоксы, слово и мета остаются */
    .flag-modal-overlay.keyboard-mode .flag-modal-types {
        display: none;
    }
    .flag-modal-overlay.keyboard-mode .flag-modal-body {
        flex: 0 0 auto;
    }
    .flag-modal-overlay.keyboard-mode .flag-modal {
        max-height: none;
    }

    .player-controls-mobile {
        display: flex;
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        background: rgba(255, 255, 255, 0.85);
        backdrop-filter: blur(10px);
        -webkit-backdrop-filter: blur(10px);
        border-top: 1px solid #e9ecef;
        padding: 15px 15px calc(10px + env(safe-area-inset-bottom));
        justify-content: center;
        align-items: center;
        z-index: 1000;
        gap: 9px;
    }

    .mobile-side-btn {
        display: flex;
        position: absolute;
        border: none;
        background: transparent;
        color: #6c757d;
        width: 52px;
        height: 52px;
        align-items: center;
        justify-content: center;
        border-radius: 50%;
        transition: all 0.2s ease;
    }

    #settingsButton {
        display: flex;
        right: 15px;
    }

    #bgMusicButton_mobile {
        position: absolute;
        left: 15px;
    }

    .mobile-side-btn.active {
        background: rgba(74, 144, 226, 0.15);
        color: #4a90e2;
    }

    .player-controls-mobile .player-btn {
        width: 52px;
        height: 52px;
        border-color: #adb5bd;
        color: #6c757d;
    }

    .player-controls-mobile .player-btn:disabled {
        border-color: #dee2e6;
        background: white;
        color: #ced4da;
    }

    .player-controls-mobile .play-pause {
        width: 64px;
        height: 64px;
        border: 2px solid #adb5bd;
        color: #6c757d;
    }

    .player-controls-mobile .player-btn .icon {
        width: 28px;
        height: 28px;
    }

    .player-controls-mobile .play-pause .icon {
        width: 32px;
        height: 32px;
    }

    .mobile-side-btn .icon {
        width: 34px;
        height: 34px;
    }

    .player-controls-mobile .play-pause.playing {
        background: #343a40;
        border-color: #343a40;
        color: white;
    }

    .player-controls-mobile .player-btn {
        transition: background 0.3s ease, border-color 0.3s ease, color 0.3s ease;
    }

    .player-controls-mobile .player-btn:active:not(:disabled) {
        background: #343a40;
        border-color: #343a40;
        color: white;
        transition: none;
    }

    /* Double-tap подсказки: x2 Arc / x2 Rev — снизу кнопок */
    #prevButton_mobile::after,
    #nextButton_mobile::after {
        position: absolute;
        bottom: -20px;
        font-size: 0.55rem;
        color: #999;
        white-space: nowrap;
        pointer-events: none;
    }
    #prevButton_mobile {
        position: relative;
    }
    #prevButton_mobile::after {
        content: "×2 Arc";
    }
    #nextButton_mobile {
        position: relative;
    }
    #nextButton_mobile::after {
        content: "×2 Rev";
    }

    .settings-overlay {
        display: block;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0, 0, 0, 0.4);
        z-index: 1001;
        opacity: 0;
        visibility: hidden;
        transition: opacity 0.3s ease, visibility 0s 0.3s;
    }

    .settings-overlay.visible {
        opacity: 1;
        visibility: visible;
        transition: opacity 0.3s ease;
    }

    .settings-panel {
        display: flex;
        flex-direction: column;
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        background: white;
        border-top-left-radius: 16px;
        border-top-right-radius: 16px;
        padding: 20px 5vw;
        z-index: 1002;
        transform: translateY(100%);
        transition: transform 0.3s ease-in-out;
        max-height: 80vh;
        overflow: hidden;
        box-sizing: border-box;
    }

    .settings-panel.visible {
        transform: translateY(0);
    }

    .settings-header {
        display: flex;
        justify-content: space-between;
        align-items: center;
        margin: -20px -5vw 0;
        padding: 12px 5vw;
        border-bottom: 1px solid #e9ecef;
        flex-shrink: 0;
    }

    .settings-header h2 {
        font-size: 1.2rem;
        font-weight: 500;
    }

    .close-btn {
        font-size: 1.5rem;
        cursor: pointer;
        color: #6c757d;
        background: none;
        border: none;
    }

    .settings-content {
        padding-top: 20px;
        margin-right: -5vw;
        padding-right: 5vw;
        overflow-y: auto;
        overflow-x: hidden;
        flex: 1;
        min-height: 0;
        -webkit-overflow-scrolling: touch;
        overscroll-behavior: contain;
        scrollbar-width: thin;
        scrollbar-color: #ccc transparent;
    }

    .settings-content::-webkit-scrollbar {
        width: 4px;
    }

    .settings-content::-webkit-scrollbar-track {
        background: transparent;
    }

    .settings-content::-webkit-scrollbar-thumb {
        background: #ccc;
        border-radius: 2px;
    }

    .settings-section {
        margin-bottom: 25px;
    }

    .settings-section h3 {
        font-size: 0.9rem;
        text-transform: uppercase;
        letter-spacing: 0.5px;
        color: #adb5bd;
        margin-bottom: 15px;
        font-weight: 500;
        border-bottom: 1px solid #e9ecef;
        padding-bottom: 8px;
    }

    .options-grid {
        display: grid;
        grid-template-columns: 1fr;
        gap: 15px;
    }

    .settings-panel .control-group {
        justify-content: space-between;
        align-items: center;
        gap: 10px;
        flex-wrap: wrap;
    }

    .settings-panel .control-label {
        font-weight: 400;
        color: #333;
        flex: 1 1 auto;
        min-width: 0;
    }

    .settings-panel .option-btn {
        border-radius: 20px;
        background: #f8f9fa;
        border-color: #dee2e6;
        min-width: 0;
        padding: 8px 12px;
    }

    .settings-panel .option-btn.active {
        background: #007bff;
        color: white;
        border-color: #007bff;
    }

    .settings-panel .player-buttons {
        display: flex;
        gap: 8px;
        flex-wrap: wrap;
        justify-content: flex-end;
    }

    .settings-panel .player-buttons .option-btn {
        flex: 0 1 auto;
        min-width: 44px;
        padding: 8px 10px;
        font-size: 0.85rem;
    }

    .vocab-selector-mobile {
        max-width: 60%;
        font-size: 0.9rem;
        padding: 6px 10px;
    }

    /* Стили для блока авторизации внутри мобильного хедера */
    .header-mobile .auth-container {
        position: static;
        transform: none;
        justify-content: center;
        margin-top: 15px;
        padding-bottom: 5px;
    }

    .header-mobile .auth-trigger-btn {
        padding: 6px 14px;
        font-size: 0.9rem;
    }

    .header-mobile .user-profile {
        gap: 8px;
    }

    .header-mobile .user-avatar {
        width: 36px;
        height: 36px;
    }

    .header-mobile .user-name {
        font-size: 0.95rem;
    }

    .header-mobile .user-email {
        display: none;
        /* Экономим место */
    }

    .header-mobile .btn-icon {
        padding: 4px;
    }

    .auth-modal {
        width: 90%;
        max-width: none;
    }

    .player-controls-mobile {
        display: flex;
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        background: rgba(255, 255, 255, 0.85);
        backdrop-filter: blur(10px);
        -webkit-backdrop-filter: blur(10px);
        border-top: 1px solid #e9ecef;
        padding: 15px 15px calc(10px + env(safe-area-inset-bottom));
        justify-content: center;
        align-items: center;
        z-index: 1000;
        gap: 9px;
    }


    @keyframes pullArrowBounce {

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

        50% {
            opacity: 1;
            transform: translateX(-5px);
        }
    }

    /* Кнопка отмены архивации */
    .undo-archive-btn {
        position: fixed;
        bottom: 85px;
        left: 15px;
        z-index: 1001;
        animation: slideInFromLeft 0.3s ease-out;
    }

    .undo-archive-btn button {
        background: #ff6b6b;
        color: white;
        border: none;
        border-radius: 20px;
        padding: 8px 16px;
        font-size: 0.85rem;
        font-weight: 500;
        cursor: pointer;
        box-shadow: 0 2px 8px rgba(255, 107, 107, 0.3);
        transition: all 0.2s ease;
    }

    .undo-archive-btn button:active {
        transform: scale(0.95);
    }

    @keyframes slideInFromLeft {
        from {
            opacity: 0;
            transform: translateX(-20px);
        }

        to {
            opacity: 1;
            transform: translateX(0);
        }
    }

    .window-progress-indicator {
        top: 10px;
        left: 50%;
        transform: translateX(-50%);
        right: auto;
        max-width: calc(100% - 100px);

        border: 1px solid #999;
        border-radius: 0;
        box-shadow: none;
        backdrop-filter: none;
        -webkit-backdrop-filter: none;
        background: transparent;
        padding: 4px 8px;
        font-size: 0.75rem;
        font-weight: 400;
        gap: 6px;
    }

    /* ========================================== */
    /* === REVIEW BOTTOM SHEET НА МОБИЛЬНОМ  === */
    /* ========================================== */
    .review-sheet-panel {
        position: fixed;
        top: auto !important;
        bottom: 0;
        left: 0 !important;
        right: 0 !important;
        width: 100%;
        max-height: 70vh;
        border-radius: 16px 16px 0 0;
        transform: translateY(100%);
        opacity: 1;
        pointer-events: none;
        transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    }

    .review-sheet-panel.visible {
        transform: translateY(0);
        pointer-events: auto;
    }

    .review-sheet-panel .panel-header {
        flex-shrink: 0;
        background: #f8f9fa;
        z-index: 1;
        border-radius: 16px 16px 0 0;
    }

    .review-sheet-panel .panel-body {
        flex: 1;
        overflow-y: scroll;
        -webkit-overflow-scrolling: touch;
        overscroll-behavior-y: contain;
        touch-action: pan-y;
        min-height: 0;
    }

    .review-sheet-overlay {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0, 0, 0, 0.4);
        z-index: 1001;
        opacity: 0;
        transition: opacity 0.3s ease;
    }

    .review-sheet-overlay.visible {
        opacity: 1;
    }

    /* ========================================== */
    /* === ПАНЕЛЬ "МОИ СЛОВАРИ" НА МОБИЛЬНОМ === */
    /* ========================================== */
    .personal-vocab-panel {
        position: fixed;
        top: auto !important;
        bottom: 0;
        left: 0 !important;
        right: 0 !important;
        width: 100% !important;
        max-width: 100% !important;
        max-height: 80vh;
        border-radius: 16px 16px 0 0;
        transform: translateY(100%);
        opacity: 1;
        pointer-events: auto;
        z-index: 1002;
        overflow: hidden;
        display: flex;
        flex-direction: column;
        box-sizing: border-box;
        transition: transform 0.2s ease-out;
    }

    .personal-vocab-panel.visible {
        transform: translateY(0);
    }

    .personal-vocab-panel .panel-header {
        flex-shrink: 0;
        background: #f8f9fa;
        z-index: 1;
        border-radius: 16px 16px 0 0;
    }

    .personal-vocab-panel .panel-body {
        flex: 1;
        overflow-y: scroll;
        -webkit-overflow-scrolling: touch;
        overscroll-behavior-y: contain;
        min-height: 0;
        scrollbar-width: thin;
        scrollbar-color: #ccc transparent;
    }

    .personal-vocab-panel .panel-body::-webkit-scrollbar {
        width: 4px;
    }

    .personal-vocab-panel .panel-body::-webkit-scrollbar-track {
        background: transparent;
    }

    .personal-vocab-panel .panel-body::-webkit-scrollbar-thumb {
        background: #ccc;
        border-radius: 2px;
    }

    /* При клавиатуре — панель сверху экрана */
    .personal-vocab-panel.keyboard-mode {
        bottom: auto;
        top: 0 !important;
        max-height: var(--vvh, 50vh);
        border-radius: 0;
        padding-bottom: 12px;
        transform: translateY(0);
    }

    body.pwa-standalone .personal-vocab-panel.keyboard-mode {
        top: 47px !important;
    }

    /* touch-action: none для мобильных (overflow: hidden — глобально) */
    body.panel-open {
        touch-action: none;
    }


    /* Overlay для закрытия панели при клике вне */
    .personal-vocab-overlay {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0, 0, 0, 0.4);
        z-index: 1001;
        opacity: 0;
        transition: opacity 0.2s ease;
    }

    .personal-vocab-overlay.visible {
        display: block;
        opacity: 1;
    }
}

@media (max-width: 480px) {
    .word {
        font-size: 2.5rem;
    }

    .block-buttons {
        gap: 6px;
    }

    .block-btn {
        padding: 6px 10px;
        font-size: 0.8rem;
    }

    .settings-panel .player-buttons .option-btn {
        min-width: 40px;
        padding: 6px 8px;
        font-size: 0.8rem;
    }

    .vocab-selector-mobile {
        max-width: 100%;
        width: 100%;
    }
}

/* --- Review Topic Chip --- */
/* Базовые стили наследует от .topic-chip */

/* Фиксируем размер чтобы кнопка не прыгала */
.topic-chip.review-chip {
    min-width: 145px;
    box-sizing: border-box;
    justify-content: center;
}

/* Иконка фиксированного размера */
.topic-chip.review-chip .review-icon {
    display: inline-block;
    width: 1em;
    margin-right: 3px;
    text-align: center;
    font-size: 0.8em;
    vertical-align: 0.1em;
}

/* Mix на паузе: белая с внутренней обводкой (inset, не меняет размер) */
.topic-chip.review-chip.mix-paused {
    background: #fff;
    border-color: transparent;
    box-shadow: inset 0 0 0 1.5px #333;
    color: #333;
}

.topic-chip.review-chip.mix-paused .topic-count {
    color: #666;
}

/* --- Review Settings Section --- */
.settings-review {
    padding: 0 20px 20px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    flex: 1;
    min-height: 0;
    scrollbar-width: thin;
    scrollbar-color: #ccc transparent;
}

.settings-review::-webkit-scrollbar {
    width: 4px;
}

.settings-review::-webkit-scrollbar-track {
    background: transparent;
}

.settings-review::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 2px;
}

.review-header {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 10px;
    border-bottom: 1px solid #e9ecef;
    padding: 10px 0;
}

/* Скрываем хедер целиком когда кнопка скрыта (from-strip) */
.from-strip .review-header {
    display: none;
}

.from-strip .archive-header {
    display: none;
}

.review-header .back-btn {
    position: absolute;
    left: 0;
    background: none;
    border: none;
    color: #4a90d9;
    font-size: 0.9rem;
    cursor: pointer;
    padding: 4px 8px;
}

.review-content {
    /* Скролл на родителе .settings-review, не здесь */
}

#reviewStatusMessage {
    text-align: center;
    color: #6c757d;
    padding: 20px;
}

/* --- Review List --- */
.review-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.review-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 5px;
    border-bottom: 1px solid #f1f3f5;
    transition: all 0.3s ease;
}

.review-item-main {
    flex: 1;
    min-width: 0;
}

.review-word {
    font-weight: 500;
    color: #343a40;
    display: block;
}

.review-translation {
    font-size: 0.85rem;
    color: #6c757d;
    display: block;
}

.review-item-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-left: 10px;
}

.review-date {
    font-size: 0.75rem;
    color: #adb5bd;
    white-space: nowrap;
    line-height: 1.2;
}

.review-date small {
    display: block;
    font-size: 0.65rem;
    color: #999;
    margin-top: -2px;
}

/* Review item states */
.review-item.review-active {
    background: #e8f5e9;
    border-left: 3px solid #4caf50;
    padding-left: 10px;
}

.review-item.review-active .review-date {
    color: #4caf50;
    font-weight: 500;
}

.review-item.review-waiting {
    opacity: 0.7;
}

/* Restore button in Review list */
.review-item .restore-btn {
    background: #e9ecef;
    border: none;
    color: #495057;
    padding: 4px 10px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.85rem;
    transition: all 0.15s ease;
}

.review-item .restore-btn:hover {
    background: #dee2e6;
    color: #212529;
}

/* --- Danger Button --- */
.option-btn.danger-btn {
    background: #dc3545;
    color: #fff;
    border-color: #dc3545;
}

.option-btn.danger-btn:hover {
    background: #c82333;
    border-color: #bd2130;
}

/* --- Review Frequency Group (подчинённый пункт) --- */
#reviewFrequencyGroup_mobile {
    padding-left: 16px;
}

#reviewFrequencyGroup_mobile .control-label {
    font-size: 0.8rem;
    color: #6c757d;
}

/* --- Review Frequency & Skips Buttons --- */
.review-frequency-btn.active,
.review-skips-btn.active {
    background: #007bff;
    color: #fff;
    border-color: #007bff;
}

/* --- Personal Mix Frequency Control --- */
.mix-frequency-control {
    padding-left: 16px;
    margin-top: 8px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.mix-frequency-control .frequency-label {
    font-size: 0.8rem;
    color: #6c757d;
}

.mix-frequency-control .frequency-buttons {
    display: flex;
    gap: 4px;
}

.freq-btn {
    width: 28px;
    height: 28px;
    padding: 0;
    border: 1px solid #ccc;
    border-radius: 4px;
    background: #fff;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.15s ease;
}

.freq-btn:hover {
    border-color: #007bff;
}

.freq-btn.active {
    background: #007bff;
    color: #fff;
    border-color: #007bff;
}

/* ============================================
   WORDAPEDIA: AI-создание карточек
   ============================================ */

/* AI Create Button */
.ai-create-btn {
    margin-top: 12px;
    padding: 10px 20px;
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: #fff;
    border: none;
    border-radius: 20px;
    font-size: 15px;
    cursor: pointer;
}

/* AI Loading */
.ai-loading {
    text-align: center;
    padding: 30px;
    color: #666;
}
.ai-spinner {
    width: 32px;
    height: 32px;
    margin: 0 auto 12px;
    border: 3px solid #eee;
    border-top-color: #667eea;
    border-radius: 50%;
    animation: aispin 0.8s linear infinite;
}
@keyframes aispin {
    to { transform: rotate(360deg); }
}

/* Preview Card */
.word-preview {
    padding: 16px;
    background: #fafafa;
    border-radius: 12px;
    margin: 8px 0;
}
.preview-badges {
    display: flex;
    gap: 6px;
    margin-bottom: 8px;
}
.preview-badge {
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 10px;
    background: #e8eaf6;
    color: #3949ab;
}
.preview-badge-form {
    background: #fff3e0;
    color: #e65100;
}
.preview-word {
    font-size: 22px;
    font-weight: 600;
    margin-bottom: 4px;
}
.preview-transcr {
    font-size: 13px;
    color: #888;
    margin-bottom: 4px;
}
.preview-transl {
    font-size: 16px;
    color: #555;
    margin-bottom: 8px;
}
.preview-lemma {
    font-size: 13px;
    color: #999;
    margin-bottom: 8px;
    font-style: italic;
}
.preview-morphemes {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 4px;
    padding: 8px;
    background: #fff;
    border-radius: 8px;
    margin-bottom: 8px;
}
.preview-morph {
    display: flex;
    flex-direction: column;
    align-items: center;
}
.preview-morph-part {
    font-size: 14px;
    font-weight: 500;
}
.preview-morph-note {
    font-size: 10px;
    color: #888;
}
.preview-morph-sep {
    color: #ccc;
    font-size: 12px;
}
.preview-example {
    padding: 8px;
    background: #fff;
    border-left: 3px solid #667eea;
    border-radius: 4px;
    margin-bottom: 12px;
}
.preview-ex-de {
    font-size: 14px;
}
.preview-ex-ru {
    font-size: 13px;
    color: #777;
}
.preview-actions {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
}
.preview-btn-cancel {
    padding: 8px 16px;
    background: #eee;
    border: none;
    border-radius: 8px;
    cursor: pointer;
}
.preview-btn-save {
    padding: 8px 20px;
    background: #4caf50;
    color: #fff;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
}

/* ============================================
   WORDAPEDIA: Form Discovery (Flow A)
   ============================================ */

.form-discovery {
    padding: 16px;
    background: #fafafa;
    border-radius: 12px;
    margin: 8px 0;
}
.form-discovery-header {
    text-align: center;
    margin-bottom: 4px;
}
.form-discovery-query {
    font-size: 20px;
    font-weight: 600;
}
.form-discovery-arrow {
    font-size: 18px;
    color: #999;
    margin: 4px 0;
}
.form-discovery-badge {
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 10px;
    background: #fff3e0;
    color: #e65100;
    display: inline-block;
}
.form-btn {
    padding: 12px 16px;
    border: none;
    border-radius: 10px;
    font-size: 14px;
    cursor: pointer;
    text-align: center;
    flex: 1;
}
.form-btn-lemma {
    background: #e8f5e9;
    color: #2e7d32;
}
.form-btn-form {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: #fff;
}

/* === SMART SEARCH: Unified Results + AI Suggest === */

.search-section-divider {
    font-size: 11px;
    font-weight: 600;
    color: #999;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 8px 4px 4px;
    margin-top: 4px;
}

/* Form discovery compact (in personal search results) */
.form-discovery-compact.fdc-personal {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px;
    background: #fff;
    border: 1px solid #e9ecef;
    border-radius: 6px;
    margin-bottom: 6px;
}
.fdc-info { flex: 1; min-width: 0; }
.fdc-query { font-size: 14px; font-weight: 500; }
.fdc-parent { font-size: 13px; color: #666; margin-top: 2px; }
.fdc-transl { color: #999; }
.fdc-actions { display: flex; gap: 4px; flex-shrink: 0; margin-left: 8px; }
.form-btn-sm {
    padding: 5px 10px;
    border: none;
    border-radius: 8px;
    font-size: 12px;
    cursor: pointer;
    white-space: nowrap;
}
.form-btn-lemma-sm { background: #e8f5e9; color: #2e7d32; }
.form-btn-form-sm { background: linear-gradient(135deg, #667eea, #764ba2); color: #fff; }

/* AI suggest hint (loading) */
.ai-suggest-hint {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-top: 12px;
    font-size: 13px;
    color: #999;
}
.ai-suggest-hint .ai-suggest-spinner {
    width: 16px;
    height: 16px;
    border: 2px solid #eee;
    border-top-color: #667eea;
    border-radius: 50%;
    animation: aispin 0.8s linear infinite;
}

/* AI suggest results */
/* === Search Action Sheet === */
.search-action-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.45);
    z-index: 1020;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    animation: fadeIn 0.15s ease-out;
}
.search-action-sheet {
    background: #fff;
    border-radius: 16px 16px 0 0;
    padding: 20px 20px calc(20px + env(safe-area-inset-bottom, 0px));
    width: 100%;
    max-width: 400px;
    text-align: center;
    animation: slideUp 0.2s ease-out;
}
@keyframes slideUp {
    from { transform: translateY(100%); }
    to { transform: translateY(0); }
}
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}
.search-action-word {
    font-size: 1.2rem;
    font-weight: 600;
    color: #1a1a1a;
}
.search-action-topic {
    font-size: 0.85rem;
    color: #888;
    margin: 4px 0 16px;
}
.search-action-btn {
    width: 100%;
    padding: 14px;
    border: none;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    margin-bottom: 8px;
}
.search-action-btn.listen-here {
    background: #333;
    color: #fff;
}
.search-action-btn.listen-here:active {
    background: #555;
}
.search-action-btn.go-to-topic {
    background: #f0f0f0;
    color: #333;
}
.search-action-btn.go-to-topic:active {
    background: #e0e0e0;
}
.search-action-btn.open-archive {
    background: #e3f2fd;
    color: #1976d2;
}
.search-action-btn.open-archive:active {
    background: #bbdefb;
}

.gs-ask-ai-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    width: 100%;
    padding: 10px;
    margin-top: 8px;
    border: 1px dashed #c0c8d0;
    border-radius: 8px;
    background: #f8f9fb;
    color: #5a6a7a;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
}
.gs-ask-ai-btn:active {
    background: #eef1f5;
}
.gs-ask-ai-btn:disabled {
    cursor: default;
    opacity: 0.7;
}
.gs-premium-hint {
    text-align: center;
    font-size: 13px;
    color: #555;
    padding: 10px 8px;
    margin-top: 6px;
    cursor: pointer;
    border-radius: 8px;
    transition: background 0.15s;
}
.gs-premium-hint:active {
    background: #f0f0f0;
}
.gs-premium-word {
    color: #4ecdc4;
    font-size: 15px;
    font-weight: 700;
}
.ai-suggest-header {
    font-size: 13px;
    color: #888;
    padding: 8px 4px 4px;
    font-weight: 500;
}
.ai-suggest-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px;
    background: #fff;
    border: 1px solid #e0e4f0;
    border-radius: 8px;
    margin-bottom: 6px;
}
.ai-suggest-card-info { flex: 1; min-width: 0; }
.ai-suggest-card-word { font-size: 15px; font-weight: 600; color: #333; }
.ai-suggest-card-transl { font-size: 13px; color: #666; margin-top: 1px; }
.ai-suggest-card-type {
    font-size: 10px;
    color: #999;
    background: #f0f0f0;
    padding: 1px 6px;
    border-radius: 8px;
    display: inline-block;
    margin-top: 2px;
}
.ai-suggest-create-btn,
.ai-suggest-nav-btn {
    padding: 6px 12px;
    border: none;
    border-radius: 10px;
    font-size: 13px;
    cursor: pointer;
    white-space: nowrap;
    flex-shrink: 0;
    margin-left: 8px;
}
.ai-suggest-create-btn {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: #fff;
}
.ai-suggest-nav-btn {
    background: #e8f5e9;
    color: #2e7d32;
    font-weight: 500;
}

/* === PWA STANDALONE MODE === */
body.pwa-standalone {
    padding-top: 47px;
}

body.pwa-standalone::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 47px;
    background: #101010;
    z-index: 99999;
}

body.pwa-standalone .card {
    padding-bottom: 25%;
}


/* === Word Strip (навигационная полоса слов) === */
.word-strip-container {
    width: 100%;
    overflow: visible;
    background: #fafafa;
    border-top: 1px solid #eee;
    border-bottom: 1px solid #eee;
    height: 52px;
    display: none; /* Скрыт пока нет данных */
    position: relative;
}

/* Strip Action Buttons (Mobile only) */
.strip-actions {
    display: none; /* показывается JS при переходе в strip zone */
    margin-top: 4px; /* промежуток между стрип-лентой и кнопками */
    padding: 12px 20px;
    background: #fff;
    gap: 20px;
    flex-wrap: wrap;
}

.strip-action-btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px 12px;
    background: #f5f5f5;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 0.85rem;
    color: #555;
    cursor: pointer;
    min-width: 0;
}

.strip-action-btn:active {
    background: #343a40;
    border-color: #343a40;
    color: white;
}

.strip-action-btn:active .strip-action-icon {
    fill: white;
}

.strip-action-icon {
    width: 16px;
    height: 16px;
    fill: #777;
    flex-shrink: 0;
}

.strip-vocab-selector {
    display: none;
}
@media (min-width: 769px) {
    .strip-vocab-selector {
        display: block;
        width: 100%;
        padding: 6px 10px;
        border: 1px solid #ddd;
        border-radius: 6px;
        font-size: 0.8rem;
        color: #666;
        background: transparent;
        -webkit-appearance: none;
        appearance: none;
        background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%23999'%3e%3cpath d='M7 10l5 5 5-5z'/%3e%3c/svg%3e");
        background-repeat: no-repeat;
        background-position: right 6px center;
        background-size: 16px;
        padding-right: 24px;
    }
}
/* Треугольник-указатель ▼ на карточке — "ниже есть strip" */
.main-content.has-word-strip::after {
    content: '';
    position: absolute;
    bottom: -6px;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-left: 5px solid transparent;
    border-right: 5px solid transparent;
    border-top: 6px solid #e74c3c;
    z-index: 1;
}

.word-strip {
    display: flex;
    align-items: center;
    height: 100%;
    overflow-x: auto;
    overflow-y: hidden;
    scrollbar-width: none;
    -ms-overflow-style: none;
    -webkit-overflow-scrolling: touch;
    touch-action: pan-x;
    overscroll-behavior-y: none;
    padding: 0 50%; /* Центрирование: padding = половина ширины → любой элемент может быть по центру */
}
.word-strip::-webkit-scrollbar { display: none; }

.word-strip-item {
    flex-shrink: 0;
    padding: 6px 14px;
    cursor: pointer;
    text-align: center;
    white-space: nowrap;
    font-family: 'DM Mono', monospace;
}

.word-strip-item .ws-word {
    font-size: 0.85rem;
    font-weight: 500;
    color: #333;
    line-height: 1.2;
}
.word-strip-item .ws-translation {
    font-size: 0.65rem;
    color: #999;
    line-height: 1.2;
}

/* Текущее слово */
.word-strip-item.active .ws-word {
    font-weight: 700;
    color: #000;
}
.word-strip-item.active .ws-translation {
    color: #555;
}

/* Оконный режим: слова В окне */
.word-strip-item.in-window .ws-word { color: #333; }
.word-strip-item.in-window .ws-translation { color: #888; }

/* Оконный режим: слова ВНЕ окна */
.word-strip-item.outside-window .ws-word { color: #ccc; }
.word-strip-item.outside-window .ws-translation { color: #ddd; }


/* Разделитель — зубцы храповика */
.word-strip-separator {
    flex-shrink: 0;
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: #bbb;
    padding: 0;
    margin: 0 6px;
    user-select: none;
}
.word-strip-separator.sep-in-window { background: #555; }

@media (max-width: 768px) {
    .word-strip-container {
        height: 48px;
    }
    .word-strip-item {
        padding: 4px 10px;
    }
    .word-strip-item .ws-word { font-size: 0.8rem; }
    .word-strip-item .ws-translation { font-size: 0.6rem; }
}

/* ===== COMPACT MOBILE (≤360px, iPhone с Display Zoom, SE 1st gen) ===== */
@media (max-width: 360px) {

    /* Player: кнопки меньше */
    .player-controls-mobile .player-btn {
        width: 44px;
        height: 44px;
    }
    .player-controls-mobile .play-pause {
        width: 54px;
        height: 54px;
    }
    .player-controls-mobile .player-btn .icon {
        width: 24px;
        height: 24px;
    }
    .player-controls-mobile .play-pause .icon {
        width: 28px;
        height: 28px;
    }
    .mobile-side-btn {
        width: 44px;
        height: 44px;
    }
    .mobile-side-btn .icon {
        width: 28px;
        height: 28px;
    }
    .player-controls-mobile {
        gap: 4px;
    }

    /* Progress indicator: компактнее */
    .window-progress-indicator {
        max-width: calc(100% - 56px);
        font-size: 0.7rem;
        padding: 3px 6px;
        gap: 4px;
        border: none;
    }

    /* Source/Level маркеры: ближе к краям, выровнены по верху progress bar */
    .source-marker {
        left: 15px;
        top: 10px;
    }
    .level-indicator {
        right: 15px;
        top: 10px;
    }
    .flag-error-btn {
        right: 15px;
    }
    .star-favorite-btn {
        right: 15px;
    }

    /* Вертикальные отступы: компактнее */
    .pronunciation-area {
        min-height: 2.5em;
        margin-top: 2px;
    }
    #translationContainer {
        margin-top: 5px;
        margin-bottom: 6px;
    }
    #sentenceContainer {
        margin-top: 20px;
    }

    /* Decomposition: все расстояния ~30% меньше */
    .decomposition {
        gap: 0px 6px;
        padding-bottom: 9px;
    }
    .decomp-item {
        line-height: 1.0;
        margin: 0 0.14em;
    }
    .decomp-part {
        font-size: 0.8rem;
    }
    .decomp-note {
        font-size: 0.7rem;
        margin-bottom: -9px;
    }

    .meaning-chain {
        margin-top: 2px;
        font-size: 0.65rem;
    }

    /* Level selector */
    .level-selector {
        padding: 8px;
        gap: 4px;
    }

    /* Topics */
    .topics-container {
        padding: 10px 12px;
    }
    .topic-chip {
        padding: 4px 6px;
        font-size: 0.8rem;
    }
    .subtopic-chip {
        padding: 4px 6px;
    }

    /* Card padding */
    .card {
        padding-left: 12px;
        padding-right: 12px;
    }

    /* Double-tap подсказки: сверху кнопок на маленьких экранах */
    #prevButton_mobile::after,
    #nextButton_mobile::after {
        bottom: auto;
        top: -18px;
    }

    /* Decomposition + транскрипция: скрываем мгновенно, layout НЕ меняется */
    .card.phase-translation .pronunciation-area .decomposition,
    .card.phase-translation .pronunciation-area .pronunciation {
        opacity: 0;
        transition: opacity 0s;
    }
    /* Перевод по центру — top смещает визуально, layout не трогает */
    .card.phase-translation .pronunciation-area:not(.show-extended-form) ~ #translationContainer {
        top: -20px;
    }
    .card.phase-translation .pronunciation-area:not(.show-extended-form) ~ #sentenceContainer {
        top: -18px;
    }
    /* Multiline: больше компенсация из-за 2го ряда морфем */
    .card.phase-translation .pronunciation-area.multiline-decomposition:not(.show-extended-form) ~ #translationContainer {
        top: -25px;
    }
    .card.phase-translation .pronunciation-area.multiline-decomposition ~ #sentenceContainer {
        top: -30px;
    }

    /* PWA: уменьшить safe-area (статус-бар ~20px, нет notch на ≤360px) */
    body.pwa-standalone {
        padding-top: 20px;
    }
    body.pwa-standalone::before {
        height: 20px;
    }

    /* Flag modal: компактнее, помещается в экран */
    .flag-modal-overlay {
        padding-top: 10px;
    }
    .flag-modal {
        max-height: calc(var(--vvh, 100vh) - 20px);
    }
    .flag-modal-header {
        padding: 8px 12px;
    }
    .flag-modal-word {
        font-size: 1.1rem;
        padding: 8px 12px 2px;
    }
    .flag-modal-meta {
        padding-bottom: 8px;
        font-size: 0.75rem;
    }
    .flag-modal-types {
        gap: 6px;
        padding: 0 12px 8px;
    }
    .flag-modal-types label {
        font-size: 0.8rem;
        padding: 4px 8px;
    }
    .flag-modal-comment-wrap {
        margin: 0 12px 8px;
    }
    .flag-modal-actions {
        padding: 8px 12px;
    }
    .flag-modal-comment-original {
        padding: 0 12px 8px;
        font-size: 0.8rem;
    }

    /* Auth modal: компактнее */
    .modal-header {
        padding: 12px 15px;
    }
    .modal-content {
        padding: 15px;
    }
    .auth-tabs {
        margin-bottom: 15px;
    }

    /* Archive modal */
    .archive-modal {
        padding: 15px;
    }
}

/* === PWA Install Banners === */
.pwa-install-banner {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    background: #1a1a2e;
    color: #fff;
    font-size: 0.85rem;
    z-index: 100000;
    box-shadow: 0 -2px 10px rgba(0,0,0,0.3);
}
.pwa-install-banner span {
    flex: 1;
}
.pwa-install-banner button {
    border: none;
    cursor: pointer;
    font-size: 0.85rem;
}
#pwaInstallBtn {
    background: #4a90d9;
    color: #fff;
    padding: 8px 16px;
    border-radius: 6px;
    font-weight: 600;
}
.pwa-install-close {
    background: transparent;
    color: #999;
    font-size: 1.1rem;
    padding: 4px 8px;
}
.ios-install span b {
    color: #4a90d9;
}

/* =============================================================================
   UPGRADE MODAL
   ============================================================================= */

.upgrade-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.upgrade-modal {
    background: #1a1a2e;
    border-radius: 16px;
    padding: 28px 24px;
    max-width: 380px;
    width: 100%;
    position: relative;
    text-align: center;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
}

.upgrade-modal-close {
    position: absolute;
    top: 12px;
    right: 14px;
    background: none;
    border: none;
    color: #888;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 4px 8px;
}

.upgrade-modal-title {
    font-size: 1.4rem;
    color: #fff;
    margin: 0 0 4px;
    font-weight: 700;
}

.upgrade-modal-subtitle {
    color: #aaa;
    font-size: 0.9rem;
    margin: 0 0 20px;
}

.upgrade-modal-features {
    margin-bottom: 20px;
}

.upgrade-feature {
    color: #ccc;
    font-size: 0.85rem;
    padding: 4px 0;
}

.upgrade-feature::before {
    content: '\2713 ';
    color: #4ecdc4;
}

.upgrade-plans {
    display: flex;
    gap: 12px;
    margin-bottom: 20px;
}

.upgrade-plan-card {
    flex: 1;
    background: #16213e;
    border: 2px solid #333;
    border-radius: 12px;
    padding: 16px 12px;
    cursor: pointer;
    transition: border-color 0.2s;
    position: relative;
    text-align: center;
    color: #fff;
    font-family: inherit;
}

.upgrade-plan-card:hover,
.upgrade-plan-card.plan-selected {
    border-color: #4ecdc4;
}

.plan-badge {
    position: absolute;
    top: -10px;
    right: -6px;
    background: #4ecdc4;
    color: #000;
    font-size: 0.65rem;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 8px;
    text-transform: uppercase;
}

.plan-period {
    font-size: 0.85rem;
    color: #aaa;
    margin-bottom: 6px;
}

.plan-price {
    font-size: 1.5rem;
    font-weight: 700;
    color: #fff;
}

.plan-per {
    font-size: 0.75rem;
    color: #888;
    font-weight: 400;
}

.plan-savings {
    font-size: 0.75rem;
    color: #4ecdc4;
    margin-top: 4px;
}

.upgrade-submit-btn {
    width: 100%;
    background: #4ecdc4;
    color: #000;
    border: none;
    border-radius: 10px;
    padding: 14px;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    font-family: inherit;
    transition: opacity 0.2s;
}

.upgrade-submit-btn:hover {
    opacity: 0.9;
}

.upgrade-submit-btn:disabled {
    opacity: 0.5;
    cursor: default;
}

/* Settings panel subscription section */
.premium-btn {
    background: #4ecdc4 !important;
    color: #000 !important;
    font-weight: 600 !important;
}

.manage-btn {
    background: #333 !important;
    color: #ccc !important;
}

.plan-premium {
    color: #4ecdc4 !important;
    font-weight: 600;
}

/* =============================================================================
   PLAY RING — Loading / Offline indicator on play button
   ============================================================================= */

.play-ring-wrapper {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.play-ring {
    position: absolute;
    width: calc(100% + 12px);
    height: calc(100% + 12px);
    top: -6px;
    left: -6px;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.3s;
}

.play-ring.loading {
    opacity: 1;
    animation: ring-pulse 1.5s ease-in-out infinite;
}

.play-ring.offline {
    opacity: 1;
    animation: none;
}

.play-ring-track {
    fill: none;
    stroke: #e0e0e0;
    stroke-width: 2;
}

.play-ring-fill {
    fill: none;
    stroke: #5ba8f5;
    stroke-width: 2.5;
    stroke-dasharray: 213.6;
    stroke-dashoffset: 213.6;
    stroke-linecap: round;
    transform: rotate(-90deg);
    transform-origin: center;
    transition: stroke-dashoffset 0.3s, stroke 0.3s;
}

.play-ring.offline .play-ring-fill {
    stroke: #f0a030;
    stroke-dashoffset: 0;
}

@keyframes ring-pulse {
    0%, 100% { opacity: 0.3; }
    50% { opacity: 1; }
}

/* --- КОНЕЦ ФАЙЛА STYLE.CSS --- */
