/* ========================================
   Говорун - Современный дизайн
   Обучение русским словам для слабослышащих
   ======================================== */

:root {
    /* Современная цветовая палитра */
    --primary: #6366F1;
    --primary-dark: #4F46E5;
    --primary-light: #818CF8;
    --primary-glow: rgba(99, 102, 241, 0.4);
    
    --accent: #F472B6;
    --accent-light: #FBCFE8;
    --accent-glow: rgba(244, 114, 182, 0.4);
    
    --success: #10B981;
    --success-dark: #059669;
    --success-light: #34D399;
    --success-glow: rgba(16, 185, 129, 0.4);
    
    --warning: #F59E0B;
    --warning-light: #FDE68A;
    --error: #EF4444;
    --error-dark: #DC2626;
    --error-light: #FCA5A5;
    
    /* Нейтральные цвета */
    --background: #FAFAFA;
    --background-alt: #F3F4F6;
    --surface: #FFFFFF;
    --text-primary: #1F2937;
    --text-secondary: #6B7280;
    --text-muted: #9CA3AF;
    --border-color: #E5E7EB;
    --border-light: #F3F4F6;
    
    /* Градиенты */
    --gradient-primary: linear-gradient(135deg, #6366F1 0%, #8B5CF6 100%);
    --gradient-accent: linear-gradient(135deg, #F472B6 0%, #EC4899 100%);
    --gradient-success: linear-gradient(135deg, #10B981 0%, #059669 100%);
    --gradient-warning: linear-gradient(135deg, #F59E0B 0%, #D97706 100%);
    --gradient-error: linear-gradient(135deg, #EF4444 0%, #DC2626 100%);
    --gradient-header: linear-gradient(135deg, #6366F1 0%, #A855F7 50%, #EC4899 100%);
    --gradient-card: linear-gradient(135deg, #EEF2FF 0%, #E0E7FF 100%);
    
    /* Размеры */
    --radius-sm: 8px;
    --radius-md: 16px;
    --radius-lg: 20px;
    --radius-xl: 24px;
    --radius-2xl: 32px;
    --radius-full: 9999px;
    
    /* Тени */
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.1);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
    --shadow-2xl: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    --shadow-glow: 0 0 40px rgba(99, 102, 241, 0.15);
    
    /* Анимации */
    --transition-fast: 0.15s cubic-bezier(0.4, 0, 0.2, 1);
    --transition: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-bounce: 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* ========================================
   Базовые стили
   ======================================== */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--background);
    color: var(--text-primary);
    min-height: 100vh;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.app-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 24px;
}

/* ========================================
   Шапка
   ======================================== */

.header {
    text-align: center;
    padding: 48px 32px;
    background: var(--gradient-header);
    border-radius: var(--radius-xl);
    color: white;
    margin-bottom: 32px;
    box-shadow: 0 20px 25px -5px rgba(99, 102, 241, 0.3);
    position: relative;
    overflow: hidden;
}

.header::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -10%;
    width: 300px;
    height: 300px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 50%;
}

.header::after {
    content: '';
    position: absolute;
    bottom: -30%;
    left: -5%;
    width: 200px;
    height: 200px;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 50%;
}

.logo {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    margin-bottom: 12px;
    position: relative;
    z-index: 1;
}

.logo-icon {
    font-size: 3.5rem;
    animation: breathe 3s ease-in-out infinite;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 80px;
    height: 80px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    backdrop-filter: blur(10px);
}

@keyframes breathe {
    0%, 100% { transform: scale(1) rotate(0deg); }
    50% { transform: scale(1.15) rotate(5deg); }
}

.header h1 {
    font-size: 2.75rem;
    font-weight: 800;
    letter-spacing: -1px;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
}

.tagline {
    font-size: 1.1rem;
    opacity: 0.95;
    font-weight: 500;
    position: relative;
    z-index: 1;
}

/* ========================================
   Главное меню
   ======================================== */

.main-menu {
    padding: 8px 0;
}

.main-menu h2 {
    text-align: center;
    font-size: 1.5rem;
    margin-bottom: 32px;
    color: var(--text-primary);
    font-weight: 700;
}

.menu-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 20px;
    margin-bottom: 40px;
}

.menu-card {
    background: var(--surface);
    border: 2px solid transparent;
    border-radius: var(--radius-lg);
    padding: 32px 24px;
    cursor: pointer;
    transition: all var(--transition-slow);
    box-shadow: var(--shadow-md);
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 16px;
    position: relative;
    overflow: hidden;
}

.menu-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: var(--gradient-primary);
    transform: scaleX(0);
    transition: transform var(--transition-slow);
}

.menu-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 20px 25px -5px rgba(99, 102, 241, 0.15);
    border-color: var(--primary-light);
}

.menu-card:hover::before {
    transform: scaleX(1);
}

.menu-card:active {
    transform: translateY(-4px);
}

.card-icon {
    font-size: 3.5rem;
    display: block;
    background: var(--accent-light);
    width: 80px;
    height: 80px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 8px;
    transition: transform var(--transition-bounce);
}

.menu-card:hover .card-icon {
    transform: scale(1.1) rotate(-5deg);
}

.card-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-primary);
}

.card-desc {
    font-size: 0.9rem;
    color: var(--text-secondary);
    line-height: 1.5;
}

/* Категории */
.category-selector {
    background: var(--surface);
    border-radius: var(--radius-lg);
    padding: 28px;
    box-shadow: var(--shadow-md);
    margin-bottom: 20px;
}

.category-selector h3 {
    font-size: 1rem;
    margin-bottom: 16px;
    color: var(--text-secondary);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.category-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.category-btn {
    padding: 12px 24px;
    border: 2px solid var(--border-color);
    background: var(--surface);
    border-radius: var(--radius-full);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition);
    font-family: inherit;
    color: var(--text-secondary);
}

.category-btn:hover {
    border-color: var(--primary-light);
    color: var(--primary);
    background: #EEF2FF;
    transform: translateY(-2px);
}

.category-btn.active {
    background: var(--gradient-primary);
    border-color: transparent;
    color: white;
    box-shadow: 0 4px 14px var(--primary-glow);
}

.category-btn.subcategory {
    font-size: 0.9rem;
    padding: 10px 18px;
    background: var(--background-alt);
    border-style: dashed;
}

.category-btn.subcategory.active {
    background: var(--gradient-accent);
    border-color: transparent;
    border-style: solid;
}

/* Селектор голосового движка */
.voice-engine-selector {
    background: var(--surface);
    border-radius: var(--radius-lg);
    padding: 24px 28px;
    box-shadow: var(--shadow-md);
    display: flex;
    align-items: center;
    gap: 16px;
    margin-top: 20px;
}

.voice-engine-selector label {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-secondary);
}

.tts-engine-selector {
    flex: 1;
    max-width: 280px;
    padding: 12px 16px;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    background: var(--surface);
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-primary);
    cursor: pointer;
    transition: all var(--transition);
    font-family: inherit;
}

.tts-engine-selector:hover {
    border-color: var(--primary-light);
}

.tts-engine-selector:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 4px var(--primary-glow);
}

/* Настройки Yandex SpeechKit */
.yandex-voice-settings {
    display: none;
    flex-wrap: wrap;
    gap: 16px;
    padding: 20px;
    background: var(--background-alt);
    border-radius: var(--radius-md);
    margin-top: 16px;
    align-items: center;
}

.yandex-voice-settings.visible {
    display: flex;
}

.yandex-setting {
    display: flex;
    align-items: center;
    gap: 10px;
}

.yandex-setting label {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-secondary);
    white-space: nowrap;
}

.yandex-setting select {
    padding: 10px 14px;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-sm);
    background: var(--surface);
    font-size: 0.9rem;
    cursor: pointer;
    min-width: 140px;
    font-family: inherit;
    transition: all var(--transition);
}

.yandex-setting select:hover {
    border-color: var(--primary-light);
}

.yandex-setting select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-glow);
}

.yandex-setting input[type="range"] {
    width: 120px;
    cursor: pointer;
    accent-color: var(--primary);
}

.yandex-setting span {
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--primary);
    min-width: 40px;
    text-align: center;
}

.test-voice-btn {
    padding: 10px 20px;
    background: var(--gradient-primary);
    color: white;
    border: none;
    border-radius: var(--radius-md);
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition);
    font-family: inherit;
    box-shadow: 0 4px 14px var(--primary-glow);
}

.test-voice-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px var(--primary-glow);
}

@media (max-width: 768px) {
    .yandex-voice-settings {
        flex-direction: column;
        align-items: stretch;
    }

    .yandex-setting {
        justify-content: space-between;
    }

    .yandex-setting select,
    .yandex-setting input[type="range"] {
        flex: 1;
    }
}

/* ========================================
   Режимы обучения - общие стили
   ======================================== */

.mode-section {
    display: none;
    animation: fadeIn 0.4s var(--transition-slow);
}

.mode-section.active {
    display: block;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.mode-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 28px;
    padding: 18px 24px;
    background: var(--surface);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
}

.mode-header h2 {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--text-primary);
}

.back-btn {
    padding: 10px 20px;
    background: var(--surface);
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition);
    font-family: inherit;
    color: var(--text-secondary);
}

.back-btn:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: #EEF2FF;
    transform: translateX(-2px);
}

.progress-info {
    font-weight: 600;
    color: var(--text-secondary);
    background: var(--gradient-card);
    padding: 8px 16px;
    border-radius: var(--radius-full);
    font-size: 0.95rem;
}

/* ========================================
   Карточки
   ======================================== */

.word-card,
.syllables-card,
.practice-card,
.exam-card,
.english-card,
.english-test-card,
.puzzle-card {
    background: var(--surface);
    border-radius: var(--radius-xl);
    padding: 40px;
    box-shadow: 
        var(--shadow-lg),
        0 0 0 1px rgba(0, 0, 0, 0.02);
    margin-bottom: 28px;
}

.word-image-container {
    width: 100%;
    max-width: 420px;
    margin: 0 auto 32px;
    border-radius: var(--radius-lg);
    overflow: hidden;
    background: var(--gradient-card);
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.05);
    position: relative;
}

.word-image-container::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(
        180deg,
        transparent 0%,
        transparent 70%,
        rgba(99, 102, 241, 0.08) 100%
    );
    pointer-events: none;
}

.word-image-container.large {
    max-width: 480px;
}

.word-image {
    max-width: 90%;
    max-height: 90%;
    object-fit: contain;
    border-radius: var(--radius-sm);
}

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

.word-text {
    font-size: 3.5rem;
    font-weight: 800;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: -1px;
    margin-bottom: 12px;
}

.word-transcription {
    font-size: 1.3rem;
    color: var(--text-secondary);
    font-style: italic;
    background: var(--background-alt);
    padding: 8px 20px;
    border-radius: var(--radius-full);
    display: inline-block;
}

/* ========================================
   Кнопки управления
   ======================================== */

.word-controls,
.english-controls,
.syllables-controls,
.puzzle-controls {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    justify-content: center;
    align-items: center;
}

.control-btn {
    padding: 16px 32px;
    border: none;
    border-radius: var(--radius-md);
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition);
    font-family: inherit;
    display: inline-flex;
    align-items: center;
    gap: 12px;
    position: relative;
    overflow: hidden;
}

.control-btn.primary {
    background: var(--gradient-primary);
    color: white;
    box-shadow: 0 4px 14px var(--primary-glow);
}

.control-btn.primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px var(--primary-glow);
}

.control-btn.primary:active {
    transform: translateY(0);
}

.control-btn.secondary {
    background: var(--surface);
    color: var(--primary);
    border: 2px solid var(--primary-light);
}

.control-btn.secondary:hover {
    background: #EEF2FF;
    border-color: var(--primary);
    transform: translateY(-2px);
}

.control-btn.large {
    padding: 20px 40px;
    font-size: 1.2rem;
}

.btn-icon {
    font-size: 1.4rem;
}

/* Контроль скорости */
.voice-settings {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    justify-content: center;
    margin-top: 24px;
    padding: 20px;
    background: var(--background-alt);
    border-radius: var(--radius-lg);
}

.speed-control,
.voice-control {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 18px;
    background: var(--surface);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
}

.speed-control label,
.voice-control label {
    font-weight: 600;
    color: var(--text-secondary);
    white-space: nowrap;
}

.speed-control input[type="range"] {
    width: 120px;
    cursor: pointer;
    accent-color: var(--primary);
}

/* Навигационные кнопки */
.navigation-buttons {
    display: flex;
    justify-content: space-between;
    gap: 16px;
}

.nav-btn {
    flex: 1;
    padding: 16px 28px;
    border: 2px solid var(--border-color);
    background: var(--surface);
    border-radius: var(--radius-md);
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition);
    font-family: inherit;
    color: var(--text-secondary);
}

.nav-btn:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: #EEF2FF;
    transform: translateY(-2px);
}

.nav-btn.primary {
    background: var(--gradient-primary);
    border-color: transparent;
    color: white;
    box-shadow: 0 4px 14px var(--primary-glow);
}

.nav-btn.primary:hover {
    box-shadow: 0 6px 20px var(--primary-glow);
    transform: translateY(-2px);
}

/* ========================================
   Режим по слогам
   ======================================== */

.syllables-display {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 16px;
    margin-bottom: 32px;
}

.syllable-item {
    padding: 28px 40px;
    background: var(--gradient-primary);
    color: white;
    border-radius: var(--radius-lg);
    font-size: 2rem;
    font-weight: 700;
    cursor: pointer;
    transition: all var(--transition-bounce);
    box-shadow: 
        0 10px 15px -3px rgba(99, 102, 241, 0.3),
        0 4px 6px -2px rgba(99, 102, 241, 0.1);
    position: relative;
    top: 0;
}

.syllable-item:hover {
    transform: translateY(-8px) scale(1.05);
    box-shadow: 
        0 20px 25px -5px rgba(99, 102, 241, 0.4),
        0 10px 10px -5px rgba(99, 102, 241, 0.2);
}

.syllable-item:active {
    transform: translateY(-4px) scale(1.02);
}

.syllable-item.active {
    background: var(--gradient-success);
    box-shadow: 
        0 0 0 4px var(--accent-light),
        0 20px 25px -5px rgba(16, 185, 129, 0.4);
    animation: pulse-success 0.5s ease;
}

@keyframes pulse-success {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

.syllable-item::after {
    content: '🔊';
    position: absolute;
    bottom: 8px;
    right: 12px;
    font-size: 0.9rem;
    opacity: 0.8;
}

/* ========================================
   Режим "Английский язык"
   ======================================== */

.english-words {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 24px;
    margin: 32px 0;
}

.russian-word,
.english-word {
    text-align: center;
    padding: 24px 32px;
    border-radius: var(--radius-lg);
    min-width: 260px;
    position: relative;
}

.russian-word {
    background: linear-gradient(135deg, #EEF2FF, #E0E7FF);
    border: 2px solid var(--primary-light);
}

.english-word {
    background: linear-gradient(135deg, #FFF7ED, #FFEDD5);
    border: 2px solid #FDBA74;
}

.word-label {
    display: block;
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 8px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.russian-word h3,
.english-word h3 {
    font-size: 2.2rem;
    font-weight: 800;
    margin-bottom: 8px;
}

.russian-word h3 {
    color: var(--primary);
}

.english-word h3 {
    color: #EA580C;
}

.transcription {
    font-size: 1.2rem;
    color: var(--text-secondary);
    font-style: italic;
    margin-bottom: 12px;
}

.word-divider {
    font-size: 2rem;
    color: var(--text-muted);
}

.speak-btn {
    padding: 12px 24px;
    border: none;
    border-radius: var(--radius-full);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition);
    font-family: inherit;
    background: var(--gradient-primary);
    color: white;
    margin-top: 12px;
    box-shadow: 0 4px 14px var(--primary-glow);
}

.speak-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 20px var(--primary-glow);
}

.speak-btn.english {
    background: linear-gradient(135deg, #F97316, #EA580C);
    box-shadow: 0 4px 14px rgba(249, 115, 22, 0.4);
}

.speak-btn.english:hover {
    box-shadow: 0 6px 20px rgba(249, 115, 22, 0.5);
}

.speak-btn.small {
    padding: 8px 16px;
    font-size: 0.9rem;
}

@media (min-width: 768px) {
    .english-words {
        flex-direction: row;
        justify-content: center;
        gap: 32px;
    }

    .word-divider {
        transform: rotate(0deg);
    }
}

/* ========================================
   Режим "Тест английского"
   ======================================== */

.test-word-display {
    margin: 32px 0;
    padding: 24px;
    background: var(--gradient-card);
    border-radius: var(--radius-lg);
    border: 2px solid var(--primary-light);
}

.russian-word-large {
    font-size: 2.5rem;
    font-weight: 800;
    color: var(--primary);
    margin: 12px 0;
    text-transform: uppercase;
    letter-spacing: -0.5px;
}

.test-input-area {
    margin: 32px 0;
}

.test-input-area label {
    display: block;
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 16px;
}

.input-with-btn {
    display: flex;
    gap: 12px;
    max-width: 420px;
    margin: 0 auto;
}

.english-input {
    flex: 1;
    padding: 16px 24px;
    font-size: 1.3rem;
    font-weight: 600;
    border: 3px solid var(--border-color);
    border-radius: var(--radius-md);
    text-align: center;
    text-transform: lowercase;
    font-family: inherit;
    transition: all var(--transition);
    background: var(--surface);
}

.english-input:focus {
    outline: none;
    border-color: #F97316;
    box-shadow: 0 0 0 4px rgba(249, 115, 22, 0.2);
}

.english-input.correct {
    border-color: var(--success);
    background: #ECFDF5;
}

.english-input.incorrect {
    border-color: var(--error);
    background: #FEF2F2;
}

.english-input.shake {
    animation: shake 0.4s ease;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    20%, 60% { transform: translateX(-8px); }
    40%, 80% { transform: translateX(8px); }
}

.check-btn {
    padding: 16px 28px;
    font-size: 1.1rem;
    font-weight: 700;
    background: var(--gradient-success);
    color: white;
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--transition);
    font-family: inherit;
    white-space: nowrap;
    box-shadow: 0 4px 14px rgba(16, 185, 129, 0.4);
}

.check-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 20px rgba(16, 185, 129, 0.5);
}

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

.test-result {
    min-height: 64px;
    margin: 24px 0;
    padding: 20px;
    border-radius: var(--radius-lg);
    font-size: 1.2rem;
    font-weight: 600;
    background: var(--background-alt);
    border: 2px solid transparent;
}

.test-result:empty {
    display: none;
}

.test-result.correct {
    display: block;
    background: linear-gradient(135deg, #ECFDF5, #D1FAE5);
    border: 2px solid var(--success);
    color: #065F46;
    animation: fadeIn 0.3s ease;
}

.test-result.incorrect {
    display: block;
    background: linear-gradient(135deg, #FEF2F2, #FEE2E2);
    border: 2px solid var(--error);
    color: #991B1B;
    animation: fadeIn 0.3s ease;
}

.test-result.hint {
    display: block;
    background: linear-gradient(135deg, #FFF7ED, #FFEDD5);
    border: 2px solid #FDBA74;
    color: #9A3412;
    animation: fadeIn 0.3s ease;
}

.test-result .correct-answer {
    font-size: 1.5rem;
    font-weight: 800;
    color: #9A3412;
    margin-top: 12px;
}

.test-hint {
    margin-top: 16px;
}

.hint-btn {
    padding: 12px 24px;
    font-size: 1rem;
    font-weight: 600;
    background: #FFF7ED;
    color: #9A3412;
    border: 2px solid #FDBA74;
    border-radius: var(--radius-full);
    cursor: pointer;
    transition: all var(--transition);
    font-family: inherit;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.hint-btn:hover {
    background: #FFEDD5;
    transform: scale(1.05);
}

.hint-btn.clear {
    border-color: var(--success);
    color: var(--success);
    background: #ECFDF5;
}

.hint-btn.clear:hover {
    background: #D1FAE5;
}

.hint-btn.syllables {
    border-color: #8B5CF6;
    color: #8B5CF6;
    background: #F5F3FF;
}

.hint-btn.syllables:hover {
    background: #EDE9FE;
}

.hint-text {
    margin-top: 12px;
    font-size: 1.3rem;
    font-weight: 700;
    color: #9A3412;
    letter-spacing: 2px;
}

.print-section {
    margin-top: 32px;
    text-align: center;
    padding-top: 24px;
    border-top: 2px dashed var(--border-color);
}

.print-btn {
    padding: 14px 28px;
    font-size: 1rem;
    font-weight: 600;
    background: linear-gradient(135deg, #64748B, #475569);
    color: white;
    border: none;
    border-radius: var(--radius-full);
    cursor: pointer;
    transition: all var(--transition);
    font-family: inherit;
}

.print-btn:hover {
    transform: scale(1.05);
    box-shadow: var(--shadow-md);
}

.test-score {
    font-size: 0.9rem;
    font-weight: 600;
    margin-left: 16px;
    padding: 6px 14px;
    background: var(--background-alt);
    border-radius: var(--radius-full);
}

/* ========================================
   Режим "Собери слово"
   ======================================== */

.puzzle-hint {
    text-align: center;
    margin-bottom: 28px;
}

.puzzle-score {
    background: var(--gradient-warning);
    color: white;
    padding: 6px 14px;
    border-radius: var(--radius-full);
    font-weight: 700;
    margin-left: 12px;
    box-shadow: 0 4px 14px rgba(245, 158, 11, 0.4);
}

.puzzle-answer-zone {
    margin-bottom: 28px;
}

.puzzle-answer {
    min-height: 84px;
    background: var(--gradient-card);
    border: 3px dashed var(--primary-light);
    border-radius: var(--radius-lg);
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 16px;
    transition: all var(--transition);
}

.puzzle-answer.has-items {
    border-style: solid;
    background: linear-gradient(135deg, #ECFDF5, #D1FAE5);
    border-color: var(--success);
}

.puzzle-answer.error {
    border-color: var(--error);
    background: linear-gradient(135deg, #FEF2F2, #FEE2E2);
    animation: shake 0.5s ease;
}

.puzzle-placeholder {
    color: var(--text-secondary);
    font-size: 1.1rem;
    font-style: italic;
}

.puzzle-syllables-zone {
    margin-bottom: 28px;
}

.puzzle-syllables {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 12px;
    padding: 16px;
    background: var(--background-alt);
    border-radius: var(--radius-lg);
    min-height: 76px;
}

.puzzle-syllable {
    padding: 18px 28px;
    background: var(--gradient-primary);
    color: white;
    border: none;
    border-radius: var(--radius-md);
    font-size: 1.5rem;
    font-weight: 700;
    cursor: pointer;
    transition: all var(--transition-bounce);
    box-shadow: var(--shadow-md);
    font-family: inherit;
}

.puzzle-syllable:hover {
    transform: scale(1.08);
    box-shadow: var(--shadow-xl);
}

.puzzle-syllable:active {
    transform: scale(0.98);
}

.puzzle-syllable.selected {
    background: var(--gradient-success);
    opacity: 0.5;
}

.puzzle-syllable.in-answer {
    opacity: 0.4;
    cursor: not-allowed;
    transform: scale(0.9);
}

.answer-syllable {
    padding: 16px 28px;
    background: linear-gradient(135deg, #8B5CF6, #7C3AED);
    color: white;
    border: none;
    border-radius: var(--radius-md);
    font-size: 1.4rem;
    font-weight: 700;
    cursor: pointer;
    transition: all var(--transition);
    box-shadow: var(--shadow-md);
    font-family: inherit;
    animation: popIn 0.3s var(--transition-bounce);
}

@keyframes popIn {
    from {
        opacity: 0;
        transform: scale(0.5);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.answer-syllable:hover {
    transform: scale(1.08);
    background: linear-gradient(135deg, #7C3AED, #6D28D9);
}

.puzzle-feedback {
    text-align: center;
    padding: 24px;
    border-radius: var(--radius-lg);
    display: none;
}

.puzzle-feedback.visible {
    display: block;
    animation: fadeIn 0.3s ease;
}

.puzzle-feedback.success {
    background: linear-gradient(135deg, #ECFDF5, #D1FAE5);
    border: 2px solid var(--success);
}

.puzzle-feedback.error {
    background: linear-gradient(135deg, #FEF2F2, #FEE2E2);
    border: 2px solid var(--error);
}

.puzzle-feedback-icon {
    font-size: 3rem;
    display: block;
    margin-bottom: 12px;
}

.puzzle-feedback-text {
    font-size: 1.3rem;
    font-weight: 700;
}

.puzzle-feedback.success .puzzle-feedback-text {
    color: var(--success);
}

.puzzle-feedback.error .puzzle-feedback-text {
    color: var(--error);
}

/* ========================================
   Режим практики
   ======================================== */

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

.practice-word h3 {
    font-size: 2.5rem;
    font-weight: 800;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 20px;
}

.practice-hints {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    justify-content: center;
}

.recording-section {
    text-align: center;
}

.microphone-container {
    margin-bottom: 28px;
}

.mic-btn {
    width: 110px;
    height: 110px;
    border-radius: 50%;
    border: none;
    background: var(--gradient-primary);
    cursor: pointer;
    transition: all var(--transition-slow);
    box-shadow: var(--shadow-xl);
}

.mic-btn:hover {
    transform: scale(1.08);
    box-shadow: 0 25px 50px -12px rgba(99, 102, 241, 0.4);
}

.mic-btn.large {
    width: 130px;
    height: 130px;
}

.mic-btn.recording {
    animation: recording-pulse 1.5s infinite;
    background: var(--gradient-error);
}

@keyframes recording-pulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.7); }
    50% { box-shadow: 0 0 0 25px rgba(239, 68, 68, 0); }
}

.mic-icon {
    font-size: 2.8rem;
}

.mic-btn.large .mic-icon {
    font-size: 3.2rem;
}

.mic-status {
    margin-top: 16px;
    font-size: 1.1rem;
    color: var(--text-secondary);
    font-weight: 600;
}

.recognition-result {
    background: var(--background-alt);
    padding: 24px;
    border-radius: var(--radius-lg);
    margin-bottom: 24px;
}

.result-label {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-bottom: 8px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.result-text {
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--text-primary);
}

.feedback-section {
    display: none;
    padding: 28px;
    background: var(--background-alt);
    border-radius: var(--radius-lg);
}

.feedback-section.visible {
    display: block;
    animation: fadeIn 0.3s ease;
}

.feedback-score {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    margin-bottom: 16px;
}

.score-emoji {
    font-size: 3.5rem;
}

.score-text {
    font-size: 1.5rem;
    font-weight: 700;
}

.feedback-section.success .score-text { color: var(--success); }
.feedback-section.warning .score-text { color: var(--warning); }
.feedback-section.error .score-text { color: var(--error); }

/* ========================================
   Режим экзамена
   ======================================== */

.exam-info {
    display: flex;
    gap: 20px;
    align-items: center;
}

.timer {
    padding: 8px 18px;
    background: var(--background-alt);
    border-radius: var(--radius-full);
    font-weight: 700;
    color: var(--text-secondary);
    font-family: monospace;
    font-size: 1rem;
}

.exam-question {
    text-align: center;
    margin-bottom: 28px;
}

.question-text {
    font-size: 1.3rem;
    color: var(--text-secondary);
    margin-bottom: 24px;
}

.exam-recording {
    text-align: center;
    margin-bottom: 28px;
}

.exam-answer {
    margin-top: 24px;
    padding: 18px;
    background: var(--background-alt);
    border-radius: var(--radius-md);
    font-size: 1.2rem;
}

.submit-btn {
    width: 100%;
    padding: 20px;
    background: var(--gradient-success);
    border: none;
    border-radius: var(--radius-md);
    color: white;
    font-size: 1.2rem;
    font-weight: 700;
    cursor: pointer;
    transition: all var(--transition);
    font-family: inherit;
    box-shadow: 0 4px 14px rgba(16, 185, 129, 0.4);
}

.submit-btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(16, 185, 129, 0.5);
}

.submit-btn:disabled {
    background: var(--background-alt);
    color: var(--text-muted);
    cursor: not-allowed;
    box-shadow: none;
}

/* Результаты экзамена */
.exam-results {
    display: none;
    text-align: center;
}

.exam-results.visible {
    display: block;
    animation: fadeIn 0.5s ease;
}

.results-header {
    margin-bottom: 32px;
}

.results-emoji {
    font-size: 5rem;
    display: block;
    margin-bottom: 16px;
    animation: celebrate 0.6s ease;
}

@keyframes celebrate {
    0%, 100% { transform: scale(1) rotate(0deg); }
    25% { transform: scale(1.15) rotate(-8deg); }
    50% { transform: scale(1.2) rotate(8deg); }
    75% { transform: scale(1.1) rotate(-5deg); }
}

.results-header h2 {
    font-size: 2rem;
    color: var(--text-primary);
    font-weight: 700;
}

.results-score {
    margin-bottom: 32px;
}

.score-circle {
    width: 160px;
    height: 160px;
    margin: 0 auto 20px;
    background: var(--gradient-primary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    box-shadow: 0 20px 25px -5px rgba(99, 102, 241, 0.4);
}

.score-number {
    font-size: 3.5rem;
    font-weight: 800;
}

.score-percent {
    font-size: 1.5rem;
    font-weight: 600;
}

.score-grade {
    font-size: 1.5rem;
    font-weight: 700;
}

.score-grade.excellent { color: var(--success); }
.score-grade.good { color: var(--primary); }
.score-grade.fair { color: var(--warning); }
.score-grade.poor { color: var(--error); }

.results-details {
    display: flex;
    justify-content: center;
    gap: 24px;
    margin-bottom: 32px;
    flex-wrap: wrap;
}

.detail-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 28px;
    background: var(--surface);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-md);
}

.detail-icon {
    font-size: 1.6rem;
}

.detail-text {
    font-size: 1.1rem;
    font-weight: 600;
}

.results-answers {
    background: var(--surface);
    border-radius: var(--radius-lg);
    padding: 28px;
    margin-bottom: 28px;
    box-shadow: var(--shadow-md);
    text-align: left;
}

.results-answers h3 {
    margin-bottom: 20px;
    color: var(--text-secondary);
    font-weight: 600;
}

.answers-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.answer-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px;
    background: var(--background-alt);
    border-radius: var(--radius-md);
    border-left: 4px solid var(--border-color);
}

.answer-item.correct {
    border-left-color: var(--success);
}

.answer-item.incorrect {
    border-left-color: var(--error);
}

.answer-word {
    font-weight: 700;
    color: var(--text-primary);
}

.answer-given {
    color: var(--text-secondary);
}

.answer-icon {
    font-size: 1.4rem;
}

.results-actions {
    display: flex;
    gap: 16px;
    justify-content: center;
    flex-wrap: wrap;
}

.action-btn {
    padding: 16px 40px;
    border: none;
    border-radius: var(--radius-md);
    font-size: 1.1rem;
    font-weight: 700;
    cursor: pointer;
    transition: all var(--transition);
    font-family: inherit;
}

.action-btn.primary {
    background: var(--gradient-primary);
    color: white;
    box-shadow: 0 4px 14px var(--primary-glow);
}

.action-btn.primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px var(--primary-glow);
}

.action-btn.secondary {
    background: var(--surface);
    color: var(--text-primary);
    border: 2px solid var(--border-color);
}

.action-btn.secondary:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: #EEF2FF;
}

/* ========================================
   Загрузка и уведомления
   ======================================== */

.loading-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(4px);
    z-index: 1000;
    justify-content: center;
    align-items: center;
    flex-direction: column;
    gap: 24px;
}

.loading-overlay.visible {
    display: flex;
}

.loading-spinner {
    width: 56px;
    height: 56px;
    border: 4px solid var(--border-light);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.notification {
    position: fixed;
    bottom: 32px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: var(--text-primary);
    color: white;
    padding: 16px 28px;
    border-radius: var(--radius-lg);
    display: flex;
    align-items: center;
    gap: 12px;
    box-shadow: var(--shadow-2xl);
    transition: transform var(--transition-slow);
    z-index: 1001;
    font-weight: 600;
}

.notification.visible {
    transform: translateX(-50%) translateY(0);
}

/* ========================================
   Режим редактора
   ======================================== */

.editor-card {
    background: linear-gradient(135deg, #F3F4F6, #E5E7EB) !important;
    border: 2px dashed var(--border-color);
}

.editor-card:hover {
    border-color: var(--primary);
}

.editor-actions-header {
    display: flex;
    gap: 12px;
}

.btn-export,
.btn-import {
    padding: 10px 18px;
    border: none;
    border-radius: var(--radius-md);
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition);
    font-family: inherit;
}

.btn-export {
    background: var(--gradient-success);
    color: white;
    box-shadow: 0 4px 14px rgba(16, 185, 129, 0.4);
}

.btn-import {
    background: linear-gradient(135deg, #8B5CF6, #7C3AED);
    color: white;
    box-shadow: 0 4px 14px rgba(139, 92, 246, 0.4);
}

.btn-export:hover,
.btn-import:hover {
    transform: scale(1.05);
}

.editor-container {
    display: grid;
    grid-template-columns: 300px 1fr;
    gap: 24px;
    min-height: 520px;
}

.editor-sidebar {
    background: var(--surface);
    border-radius: var(--radius-lg);
    padding: 24px;
    box-shadow: var(--shadow-md);
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.editor-db-select,
.editor-category-select {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.editor-db-select label,
.editor-category-select label {
    font-weight: 600;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.editor-db-select select,
.editor-category-select select {
    padding: 12px 16px;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    font-size: 1rem;
    font-family: inherit;
    cursor: pointer;
    background: var(--surface);
    transition: all var(--transition);
}

.editor-db-select select:hover,
.editor-category-select select:hover {
    border-color: var(--primary-light);
}

.btn-add-word {
    padding: 16px 24px;
    background: var(--gradient-primary);
    color: white;
    border: none;
    border-radius: var(--radius-md);
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    transition: all var(--transition);
    font-family: inherit;
    margin-top: auto;
    box-shadow: 0 4px 14px var(--primary-glow);
}

.btn-add-word:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px var(--primary-glow);
}

.editor-words-list {
    background: var(--surface);
    border-radius: var(--radius-lg);
    padding: 24px;
    box-shadow: var(--shadow-md);
    overflow-y: auto;
    max-height: 620px;
}

.word-item {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px;
    background: var(--background-alt);
    border-radius: var(--radius-md);
    margin-bottom: 12px;
    transition: all var(--transition);
}

.word-item:hover {
    box-shadow: var(--shadow-md);
    transform: translateX(5px);
}

.word-item-image {
    width: 64px;
    height: 64px;
    border-radius: var(--radius-md);
    object-fit: cover;
    background: var(--gradient-card);
}

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

.word-item-title {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.word-item-subtitle {
    font-size: 0.9rem;
    color: var(--text-secondary);
}

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

.btn-edit,
.btn-delete-word {
    padding: 10px 14px;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 1.1rem;
    transition: all var(--transition);
}

.btn-edit {
    background: var(--primary-light);
    color: white;
}

.btn-edit:hover {
    background: var(--primary);
    transform: scale(1.05);
}

.btn-delete-word {
    background: #FEF2F2;
    color: var(--error);
}

.btn-delete-word:hover {
    background: var(--error);
    color: white;
    transform: scale(1.05);
}

/* ========================================
   Модальные окна
   ======================================== */

.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    z-index: 1000;
    justify-content: center;
    align-items: center;
    padding: 24px;
}

.modal-overlay.visible {
    display: flex;
}

.modal-content {
    background: var(--surface);
    border-radius: var(--radius-xl);
    padding: 32px;
    max-width: 520px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-2xl);
    animation: modalSlideIn 0.3s var(--transition-slow);
}

.modal-small {
    max-width: 420px;
}

.modal-large {
    max-width: 720px;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-20px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: 2px solid var(--border-light);
}

.modal-header h3 {
    font-size: 1.4rem;
    color: var(--text-primary);
    font-weight: 700;
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.6rem;
    cursor: pointer;
    color: var(--text-secondary);
    transition: color var(--transition);
    padding: 4px;
    line-height: 1;
}

.modal-close:hover {
    color: var(--error);
}

.form-group {
    margin-bottom: 24px;
}

.form-group label {
    display: block;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 10px;
    font-size: 0.95rem;
}

.form-group input {
    width: 100%;
    padding: 14px 18px;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    font-size: 1rem;
    font-family: inherit;
    transition: all var(--transition);
    background: var(--surface);
}

.form-group input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 4px var(--primary-glow);
}

.btn-preview-image {
    margin-top: 12px;
    padding: 10px 18px;
    background: var(--background-alt);
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    cursor: pointer;
    font-family: inherit;
    font-size: 0.9rem;
    font-weight: 600;
    transition: all var(--transition);
    color: var(--text-secondary);
}

.btn-preview-image:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: #EEF2FF;
}

.image-preview {
    display: none;
    margin-bottom: 24px;
    text-align: center;
}

.image-preview.visible {
    display: block;
}

.image-preview img {
    max-width: 220px;
    max-height: 220px;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
}

.form-actions {
    display: flex;
    gap: 16px;
    justify-content: flex-end;
    margin-top: 28px;
}

.btn-cancel,
.btn-save,
.btn-delete {
    padding: 14px 28px;
    border: none;
    border-radius: var(--radius-md);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition);
    font-family: inherit;
}

.btn-cancel {
    background: var(--background-alt);
    color: var(--text-primary);
    border: 2px solid var(--border-color);
}

.btn-cancel:hover {
    border-color: var(--text-secondary);
    background: var(--surface);
}

.btn-save {
    background: var(--gradient-success);
    color: white;
    box-shadow: 0 4px 14px rgba(16, 185, 129, 0.4);
}

.btn-save:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(16, 185, 129, 0.5);
}

.btn-delete {
    background: var(--gradient-error);
    color: white;
    box-shadow: 0 4px 14px rgba(239, 68, 68, 0.4);
}

.btn-delete:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(239, 68, 68, 0.5);
}

.delete-confirm-text {
    text-align: center;
    font-size: 1.1rem;
    margin: 24px 0;
    color: var(--text-primary);
    font-weight: 500;
}

.delete-confirm-text span {
    font-weight: 700;
    color: var(--primary);
}

.empty-list {
    text-align: center;
    padding: 48px;
    color: var(--text-secondary);
}

.empty-list-icon {
    font-size: 3.5rem;
    margin-bottom: 16px;
}

.empty-list-text {
    font-size: 1.1rem;
}

/* Управление категориями */
.editor-category-section {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.editor-category-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.editor-category-header label {
    font-weight: 600;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.btn-manage-categories,
.btn-sync-db {
    padding: 8px 12px;
    background: var(--background-alt);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 1.1rem;
    transition: all var(--transition);
}

.btn-manage-categories:hover {
    border-color: var(--primary);
    background: var(--primary-light);
    color: white;
    transform: scale(1.05);
}

.btn-sync-db {
    background: linear-gradient(135deg, #06B6D4, #0891B2);
    border: none;
    color: white;
}

.btn-sync-db:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 14px rgba(6, 182, 212, 0.4);
}

.category-quick-actions {
    display: flex;
    gap: 10px;
    margin-top: 10px;
}

.btn-add-category,
.btn-add-subcategory {
    flex: 1;
    padding: 10px 14px;
    border: 2px dashed var(--border-color);
    background: var(--background-alt);
    border-radius: var(--radius-md);
    cursor: pointer;
    font-size: 0.9rem;
    font-family: inherit;
    transition: all var(--transition);
    font-weight: 600;
}

.btn-add-category:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: rgba(99, 102, 241, 0.1);
}

.btn-add-subcategory:hover {
    border-color: #8B5CF6;
    color: #8B5CF6;
    background: rgba(139, 92, 246, 0.1);
}

.form-hint {
    display: block;
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-top: 6px;
    font-style: italic;
}

.emoji-suggestions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 12px;
}

.emoji-suggestions span {
    font-size: 1.6rem;
    cursor: pointer;
    padding: 6px 12px;
    border-radius: var(--radius-md);
    background: var(--background-alt);
    transition: all var(--transition);
}

.emoji-suggestions span:hover {
    background: var(--primary-light);
    transform: scale(1.2);
}

.category-manager-content {
    max-height: 420px;
    overflow-y: auto;
    margin-bottom: 24px;
}

.category-manager-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.category-manager-item {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px;
    background: var(--background-alt);
    border-radius: var(--radius-md);
    transition: all var(--transition);
}

.category-manager-item:hover {
    box-shadow: var(--shadow-md);
}

.category-manager-item.subcategory {
    margin-left: 32px;
    border-left: 3px solid #8B5CF6;
}

.category-item-icon {
    font-size: 2rem;
    min-width: 44px;
    text-align: center;
}

.category-item-info {
    flex: 1;
}

.category-item-name {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-primary);
}

.category-item-key {
    font-size: 0.85rem;
    color: var(--text-muted);
    font-family: monospace;
}

.category-item-count {
    font-size: 0.9rem;
    color: var(--text-secondary);
    background: var(--surface);
    padding: 6px 12px;
    border-radius: var(--radius-full);
    font-weight: 600;
}

.category-item-actions {
    display: flex;
    gap: 10px;
}

.btn-add-category-inline {
    padding: 12px 28px;
    background: var(--gradient-primary);
    color: white;
    border: none;
    border-radius: var(--radius-md);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
    transition: all var(--transition);
    box-shadow: 0 4px 14px var(--primary-glow);
}

.btn-add-category-inline:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px var(--primary-glow);
}

.delete-warning {
    text-align: center;
    color: var(--error);
    font-weight: 600;
    margin-bottom: 24px;
    padding: 14px;
    background: #FEF2F2;
    border-radius: var(--radius-md);
    border: 1px solid #FEE2E2;
}

/* ========================================
   Адаптивность
   ======================================== */

@media (max-width: 1024px) {
    .app-container {
        padding: 20px;
    }
    
    .editor-container {
        grid-template-columns: 1fr;
    }
    
    .editor-sidebar {
        order: -1;
    }
}

@media (max-width: 768px) {
    .app-container {
        padding: 16px;
    }

    .header {
        padding: 36px 24px;
    }

    .header h1 {
        font-size: 2.2rem;
    }

    .logo-icon {
        font-size: 2.8rem;
        width: 64px;
        height: 64px;
    }

    .mode-header {
        flex-direction: column;
        gap: 16px;
        text-align: center;
    }

    .mode-header h2 {
        font-size: 1.25rem;
    }

    .word-text {
        font-size: 2.5rem;
    }

    .word-controls,
    .english-controls,
    .syllables-controls {
        flex-direction: column;
    }

    .control-btn {
        width: 100%;
        justify-content: center;
    }

    .syllable-item {
        font-size: 1.6rem;
        padding: 22px 28px;
    }

    .navigation-buttons {
        flex-direction: column;
    }

    .results-details {
        flex-direction: column;
        align-items: center;
    }

    .exam-info {
        flex-direction: column;
        gap: 12px;
    }

    .category-buttons {
        justify-content: center;
    }

    .menu-grid {
        grid-template-columns: 1fr;
    }

    .english-words {
        gap: 20px;
    }

    .russian-word,
    .english-word {
        min-width: auto;
        width: 100%;
    }
}

@media (max-width: 480px) {
    .header h1 {
        font-size: 1.8rem;
    }

    .word-text {
        font-size: 2rem;
    }

    .practice-word h3 {
        font-size: 2rem;
    }

    .syllable-item {
        font-size: 1.3rem;
        padding: 18px 22px;
    }

    .score-circle {
        width: 130px;
        height: 130px;
    }

    .score-number {
        font-size: 2.8rem;
    }

    .modal-content {
        padding: 24px 20px;
    }

    .card-icon {
        width: 70px;
        height: 70px;
        font-size: 3rem;
    }
}

/* ========================================
   Доступность
   ======================================== */

/* Высокий контраст */
@media (prefers-contrast: high) {
    :root {
        --primary: #4338CA;
        --primary-light: #4F46E5;
        --text-primary: #000000;
        --text-secondary: #1F2937;
        --border-color: #000000;
    }

    .word-text {
        text-shadow: none;
    }
}

/* Уменьшение анимаций */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Тёмная тема */
@media (prefers-color-scheme: dark) {
    :root {
        --background: #0F172A;
        --background-alt: #1E293B;
        --surface: #1E293B;
        --text-primary: #F1F5F9;
        --text-secondary: #94A3B8;
        --text-muted: #64748B;
        --border-color: #334155;
        --border-light: #1E293B;
        
        --gradient-card: linear-gradient(135deg, #1E293B 0%, #334155 100%);
        --gradient-header: linear-gradient(135deg, #4F46E5 0%, #7C3AED 50%, #DB2777 100%);
    }

    .word-image-container {
        background: var(--gradient-card);
    }

    .loading-overlay {
        background: rgba(15, 23, 42, 0.95);
    }

    .modal-overlay {
        background: rgba(0, 0, 0, 0.7);
    }
}

/* ========================================
   UX-улучшения: Визуализация звука
   ======================================== */

.audio-visualizer {
    display: flex;
    align-items: flex-end;
    justify-content: center;
    gap: 6px;
    height: 60px;
    padding: 16px;
    background: var(--background-alt);
    border-radius: var(--radius-lg);
    margin: 20px 0;
}

.audio-bar {
    width: 10px;
    min-height: 8px;
    background: var(--gradient-primary);
    border-radius: var(--radius-full);
    transition: height 0.1s ease;
}

.audio-bar.recording {
    animation: audio-wave 0.5s ease-in-out infinite;
}

.audio-bar:nth-child(1) { animation-delay: 0ms; }
.audio-bar:nth-child(2) { animation-delay: 50ms; }
.audio-bar:nth-child(3) { animation-delay: 100ms; }
.audio-bar:nth-child(4) { animation-delay: 150ms; }
.audio-bar:nth-child(5) { animation-delay: 200ms; }
.audio-bar:nth-child(6) { animation-delay: 250ms; }
.audio-bar:nth-child(7) { animation-delay: 300ms; }
.audio-bar:nth-child(8) { animation-delay: 350ms; }

@keyframes audio-wave {
    0%, 100% { height: 8px; }
    50% { height: 48px; }
}

/* ========================================
   UX-улучшения: Индикатор прогресса
   ======================================== */

.progress-dots {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-top: 20px;
    padding: 12px 20px;
    background: var(--background-alt);
    border-radius: var(--radius-full);
}

.progress-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--border-color);
    transition: all var(--transition);
}

.progress-dot.active {
    background: var(--primary);
    transform: scale(1.3);
    box-shadow: 0 0 0 4px var(--primary-glow);
}

.progress-dot.completed {
    background: var(--success);
}

/* Прогресс-бар линейный */
.progress-bar-container {
    width: 100%;
    height: 8px;
    background: var(--border-light);
    border-radius: var(--radius-full);
    overflow: hidden;
    margin: 16px 0;
}

.progress-bar {
    height: 100%;
    background: var(--gradient-primary);
    border-radius: var(--radius-full);
    transition: width var(--transition-slow);
    position: relative;
}

.progress-bar::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(
        90deg,
        transparent,
        rgba(255, 255, 255, 0.3),
        transparent
    );
    animation: shimmer 2s infinite;
}

@keyframes shimmer {
    to { transform: translateX(100%); }
}

/* ========================================
   UX-улучшения: Обратная связь
   ======================================== */

/* Успешное действие */
.feedback-success {
    animation: success-burst 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes success-burst {
    0% { transform: scale(1); }
    50% { transform: scale(1.15); box-shadow: 0 0 0 20px rgba(16, 185, 129, 0.3); }
    100% { transform: scale(1); }
}

/* Ошибка */
.feedback-error {
    animation: error-shake 0.5s ease;
}

@keyframes error-shake {
    0%, 100% { transform: translateX(0); }
    20%, 60% { transform: translateX(-10px); }
    40%, 80% { transform: translateX(10px); }
}

/* Пульсация для привлечения внимания */
.attention-pulse {
    animation: attention-pulse 2s ease-in-out infinite;
}

@keyframes attention-pulse {
    0%, 100% { 
        box-shadow: 0 0 0 0 var(--primary-glow);
        transform: scale(1);
    }
    50% { 
        box-shadow: 0 0 0 15px rgba(99, 102, 241, 0);
        transform: scale(1.02);
    }
}

/* ========================================
   UX-улучшения: Визуализация для слабослышащих
   ======================================== */

/* Визуальный индикатор речи */
.speech-wave {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    height: 40px;
    margin: 16px 0;
}

.speech-wave-bar {
    width: 6px;
    background: var(--gradient-primary);
    border-radius: var(--radius-full);
    animation: speech-visualize 0.8s ease-in-out infinite;
}

.speech-wave-bar:nth-child(1) { height: 20px; animation-delay: 0ms; }
.speech-wave-bar:nth-child(2) { height: 35px; animation-delay: 100ms; }
.speech-wave-bar:nth-child(3) { height: 25px; animation-delay: 200ms; }
.speech-wave-bar:nth-child(4) { height: 40px; animation-delay: 300ms; }
.speech-wave-bar:nth-child(5) { height: 25px; animation-delay: 400ms; }
.speech-wave-bar:nth-child(6) { height: 35px; animation-delay: 500ms; }
.speech-wave-bar:nth-child(7) { height: 20px; animation-delay: 600ms; }

@keyframes speech-visualize {
    0%, 100% { transform: scaleY(0.5); opacity: 0.5; }
    50% { transform: scaleY(1); opacity: 1; }
}

/* Цветовая индикация статуса */
.status-indicator {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    border-radius: var(--radius-full);
    font-weight: 600;
    font-size: 0.9rem;
}

.status-indicator.recording {
    background: rgba(239, 68, 68, 0.1);
    color: var(--error);
    border: 2px solid var(--error-light);
}

.status-indicator.processing {
    background: rgba(245, 158, 11, 0.1);
    color: var(--warning);
    border: 2px solid var(--warning-light);
}

.status-indicator.success {
    background: rgba(16, 185, 129, 0.1);
    color: var(--success);
    border: 2px solid var(--success-light);
}

.status-indicator.ready {
    background: rgba(99, 102, 241, 0.1);
    color: var(--primary);
    border: 2px solid var(--primary-light);
}

/* ========================================
   UX-улучшения: Увеличенный контраст текста
   ======================================== */

.word-text {
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.card-title,
.mode-header h2 {
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

/* ========================================
   UX-улучшения: Тактильная обратная связь (для мобильных)
   ======================================== */

@media (hover: none) and (pointer: coarse) {
    /* Увеличить кнопки для touch-устройств */
    .control-btn,
    .nav-btn,
    .menu-card {
        min-height: 56px;
    }

    /* Визуальный отклик на нажатие */
    .control-btn:active,
    .nav-btn:active,
    .menu-card:active {
        transform: scale(0.97);
    }

    /* Увеличить syllable кнопки */
    .syllable-item {
        min-height: 64px;
        min-width: 64px;
    }
}

/* ========================================
   UX-улучшения: Анимация появления
   ======================================== */

.slide-in-left {
    animation: slideInLeft 0.4s var(--transition-slow);
}

.slide-in-right {
    animation: slideInRight 0.4s var(--transition-slow);
}

.slide-in-up {
    animation: slideInUp 0.4s var(--transition-slow);
}

@keyframes slideInLeft {
    from {
        opacity: 0;
        transform: translateX(-30px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(30px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes slideInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ========================================
   UX-улучшения: Индикатор загрузки с прогрессом
   ======================================== */

.loading-progress {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
}

.loading-progress-text {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-secondary);
}

.loading-progress-bar {
    width: 200px;
    height: 6px;
    background: var(--border-light);
    border-radius: var(--radius-full);
    overflow: hidden;
}

.loading-progress-bar::before {
    content: '';
    display: block;
    height: 100%;
    width: var(--progress, 0%);
    background: var(--gradient-primary);
    transition: width 0.3s ease;
}

/* ========================================
   UX-улучшения: Подсказки с иконками
   ======================================== */

.hint-tooltip {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 16px;
    background: var(--background-alt);
    border-radius: var(--radius-md);
    font-size: 0.9rem;
    color: var(--text-secondary);
    border: 1px dashed var(--border-color);
}

.hint-tooltip::before {
    content: '💡';
    font-size: 1.2rem;
}

/* ========================================
   UX-улучшения: Бейджи достижений
   ======================================== */

.achievement-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: linear-gradient(135deg, #FEF3C7, #FDE68A);
    border: 2px solid #F59E0B;
    border-radius: var(--radius-full);
    font-size: 0.9rem;
    font-weight: 700;
    color: #92400E;
    box-shadow: 0 4px 14px rgba(245, 158, 11, 0.3);
}

.achievement-badge::before {
    content: '🏆';
    font-size: 1.2rem;
}

.achievement-badge.gold {
    background: linear-gradient(135deg, #FEF3C7, #FCD34D);
    border-color: #F59E0B;
    color: #92400E;
}

.achievement-badge.silver {
    background: linear-gradient(135deg, #F3F4F6, #D1D5DB);
    border-color: #9CA3AF;
    color: #374151;
}

.achievement-badge.bronze {
    background: linear-gradient(135deg, #FEF3C7, #FDBA74);
    border-color: #EA580C;
    color: #9A3412;
}

/* ========================================
   UX-улучшения: Звёзды рейтинга
   ======================================== */

.star-rating {
    display: flex;
    gap: 4px;
    justify-content: center;
}

.star {
    font-size: 1.8rem;
    color: var(--border-color);
    transition: all var(--transition);
}

.star.filled {
    color: #F59E0B;
    text-shadow: 0 2px 4px rgba(245, 158, 11, 0.4);
    animation: star-fill 0.3s ease;
}

@keyframes star-fill {
    0% { transform: scale(0.5); opacity: 0; }
    50% { transform: scale(1.3); }
    100% { transform: scale(1); opacity: 1; }
}

/* ========================================
   UX-улучшения: Карточка с комбо-эффектом
   ======================================== */

.combo-streak {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: linear-gradient(135deg, #F0F9FF, #E0F2FE);
    border: 2px solid #0EA5E9;
    border-radius: var(--radius-full);
    font-weight: 700;
    color: #0369A1;
    animation: combo-pulse 1s ease-in-out infinite;
}

@keyframes combo-pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

.combo-streak::before {
    content: '🔥';
    font-size: 1.2rem;
}

/* ========================================
   UX-улучшения: Уведомления с иконками
   ======================================== */

.notification.success {
    background: var(--gradient-success);
}

.notification.error {
    background: var(--gradient-error);
}

.notification.warning {
    background: var(--gradient-warning);
}

.notification-icon {
    font-size: 1.4rem;
}

/* ========================================
   UX-улучшения: Адаптивные подсказки
   ======================================== */

@media (max-width: 768px) {
    .hint-tooltip {
        font-size: 0.85rem;
        padding: 8px 12px;
    }

    .achievement-badge {
        font-size: 0.8rem;
        padding: 6px 12px;
    }

    .star {
        font-size: 1.5rem;
    }
}

/* ========================================
   Переосмысленная оболочка приложения
   ======================================== */

.skip-link {
    position: absolute;
    top: -48px;
    left: 16px;
    z-index: 1000;
    padding: 10px 14px;
    border-radius: var(--radius-full);
    background: #111827;
    color: #fff;
    text-decoration: none;
    font-weight: 700;
    transition: top var(--transition-fast);
}

.skip-link:focus {
    top: 16px;
}

.header {
    text-align: left;
}

.logo {
    justify-content: flex-start;
}

.logo-icon {
    font-size: 2rem;
    width: 56px;
    height: 56px;
    font-weight: 800;
}

.hero-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin: 18px 0 10px;
}

.status-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 12px;
    border-radius: var(--radius-full);
    background: rgba(255, 255, 255, 0.16);
    color: #fff;
    font-weight: 700;
    font-size: 0.9rem;
    border: 1px solid rgba(255, 255, 255, 0.18);
    backdrop-filter: blur(10px);
}

.hero-note {
    max-width: 760px;
    margin-top: 6px;
    font-size: 1rem;
    color: rgba(255, 255, 255, 0.92);
}

.menu-intro {
    display: grid;
    gap: 8px;
    margin-bottom: 20px;
}

.menu-intro h2 {
    margin-bottom: 0;
    text-align: left;
}

.menu-intro p {
    color: var(--text-secondary);
    max-width: 760px;
}

.voice-engine-selector {
    margin-top: 20px;
    display: grid;
    gap: 10px;
    padding: 18px 20px;
    background: var(--surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
}

.voice-engine-selector label,
.category-selector h3 {
    font-size: 1rem;
    font-weight: 700;
}

.voice-hint {
    color: var(--text-secondary);
    font-size: 0.92rem;
}

@media (max-width: 768px) {
    .app-container {
        padding: 16px;
    }

    .header {
        padding: 28px 20px;
    }

    .logo {
        gap: 12px;
    }

    .hero-meta {
        gap: 8px;
    }

    .status-chip {
        font-size: 0.8rem;
        padding: 7px 10px;
    }
}
