* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 15px;
    overflow: hidden;
}

.container {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 20px;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.2);
    padding: 25px;
    max-width: 1000px;
    width: 100%;
    height: 95vh;
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.container::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, #ff6b6b, #4ecdc4, #45b7d1, #96ceb4, #ffeaa7);
    background-size: 300% 100%;
    animation: gradient-shift 3s ease infinite;
}

@keyframes gradient-shift {
    0%, 100% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
}

.header {
    text-align: center;
    margin-bottom: 20px;
    position: relative;
    flex-shrink: 0;
}

/* Кнопка возврата к главной */
.back-to-main-btn {
    position: absolute;
    top: -10px;
    left: -10px;
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    padding: 10px 12px;
    border-radius: 10px;
    text-decoration: none;
    font-size: 1.1rem;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
}

.back-to-main-btn:hover {
    transform: translateY(-2px) scale(1.05);
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.4);
    color: white;
}

.title {
    font-size: 2.2rem;
    font-weight: 700;
    color: #2d3748;
    margin-bottom: 15px;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.text-info {
    display: flex;
    justify-content: center;
    margin-bottom: 15px;
}

.text-number {
    font-size: 1.1rem;
    font-weight: 600;
    color: #4a5568;
    padding: 10px 20px;
    background: linear-gradient(135deg, #f7fafc, #edf2f7);
    border-radius: 10px;
    border: 2px solid #e2e8f0;
}

.reader-area {
    display: flex;
    flex-direction: column;
    gap: 20px;
    flex: 1;
    min-height: 0;
}

/* Панель управления */
.controls-panel {
    background: linear-gradient(135deg, #f8f9ff, #e6f3ff);
    border-radius: 14px;
    padding: 12px;
    border: 2px solid #e2e8f0;
    flex-shrink: 0;
}

.visibility-controls h3,
.text-controls h3 {
    color: #2d3748;
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 12px;
    text-align: center;
}

.control-buttons-row {
    display: flex;
    gap: 8px;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
}

.control-btn {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    border: none;
    padding: 10px 12px;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 1.1rem;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
    min-width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.control-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.4);
}

.control-btn.active {
    background: linear-gradient(135deg, #4ecdc4, #44a08d);
    box-shadow: 0 4px 15px rgba(78, 205, 196, 0.3);
}

.control-btn.active:hover {
    box-shadow: 0 8px 25px rgba(78, 205, 196, 0.4);
}

/* Контейнер текста */
.text-container {
    background: white;
    border-radius: 16px;
    padding: 25px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    border: 2px solid #f1f5f9;
    flex: 0 1 auto;
    overflow-y: auto;
    min-height: 200px;
    max-height: 70vh;
}

.text-content {
    font-size: 1.2rem;
    line-height: 1.8;
    color: #2d3748;
    text-align: left;
}

/* Стили для пословного перевода */
.word-pair {
    display: inline-block;
    margin: 0 6px 8px 0;
    vertical-align: baseline;
}

.english-word {
    color: #2d3748;
    font-weight: 600;
}

.russian-word {
    color: #718096;
    font-size: 0.9em;
    font-weight: 400;
    transition: all 0.3s ease;
}

/* Специальные стили для кнопок с буквами Абв */
.fade-btn {
    background: #a0aec0 !important;
    color: white !important;
    font-family: 'Inter', sans-serif !important;
    font-weight: bold !important;
    font-size: 0.9rem !important;
}

.fade-btn:hover {
    background: #718096 !important;
    box-shadow: 0 8px 25px rgba(160, 174, 192, 0.4) !important;
}

.fade-btn.active {
    background: #718096 !important;
    box-shadow: 0 4px 15px rgba(160, 174, 192, 0.3) !important;
}

.brown-btn {
    background: #8b4513 !important;
    color: white !important;
    font-family: 'Inter', sans-serif !important;
    font-weight: bold !important;
    font-size: 0.9rem !important;
}

.brown-btn:hover {
    background: #654321 !important;
    box-shadow: 0 8px 25px rgba(139, 69, 19, 0.4) !important;
}

.brown-btn.active {
    background: #654321 !important;
    box-shadow: 0 4px 15px rgba(139, 69, 19, 0.3) !important;
}

.normal-btn {
    background: #718096 !important;
    color: white !important;
    font-family: 'Inter', sans-serif !important;
    font-weight: bold !important;
    font-size: 0.9rem !important;
}

.normal-btn:hover {
    background: #4a5568 !important;
    box-shadow: 0 8px 25px rgba(113, 128, 150, 0.4) !important;
}

.normal-btn.active {
    background: linear-gradient(135deg, #4ecdc4, #44a08d) !important;
    box-shadow: 0 4px 15px rgba(78, 205, 196, 0.3) !important;
}

/* Состояния русского текста */
.russian-hidden .russian-word {
    display: none;
}

.russian-faded .russian-word {
    opacity: 0;
    color: #a0aec0;
}

.russian-brown .russian-word {
    color: #8b4513;
    opacity: 0.8;
}

.russian-lighter .russian-word {
    color: #cbd5e0;
    opacity: 0.7;
}

/* Навигация */
.navigation {
    display: flex;
    justify-content: center;
    gap: 20px;
    flex-shrink: 0;
}

.nav-btn {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    border: none;
    padding: 12px 16px;
    border-radius: 10px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 1.2rem;
    min-width: 60px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.nav-btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.4);
}

.nav-btn:disabled {
    background: #cbd5e0;
    cursor: not-allowed;
    color: #a0aec0;
}

/* Модальные окна */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
}

.modal.show {
    display: flex;
    align-items: center;
    justify-content: center;
    animation: modal-appear 0.3s ease;
}

.modal-content {
    background: white;
    border-radius: 20px;
    max-width: 800px;
    width: 90%;
    max-height: 80vh;
    overflow: hidden;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.3);
    position: relative;
}

.modal-header {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    padding: 20px 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h2 {
    margin: 0;
    font-size: 1.4rem;
    font-weight: 600;
}

.close-modal {
    background: none;
    border: none;
    color: white;
    font-size: 1.8rem;
    cursor: pointer;
    padding: 0;
    width: 35px;
    height: 35px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.3s ease;
}

.close-modal:hover {
    background: rgba(255, 255, 255, 0.2);
}

.modal-body {
    padding: 30px;
    overflow-y: auto;
    max-height: 60vh;
}

#translationText {
    font-size: 1.1rem;
    line-height: 1.7;
    color: #2d3748;
}

#dictionaryContent {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 14px;
}

.dictionary-item {
    background: linear-gradient(135deg, #f8f9ff, #e6f3ff);
    border-radius: 10px;
    padding: 14px;
    border: 2px solid #e2e8f0;
}

.dict-english {
    font-weight: 600;
    color: #2d3748;
    font-size: 1rem;
    margin-bottom: 6px;
}

.dict-russian {
    color: #718096;
    font-size: 0.95rem;
}

/* Стили для модального окна настроек */
.settings-modal {
    max-width: 700px;
    max-height: 85vh;
}

.settings-step {
    display: none;
}

.settings-step.active {
    display: block;
}

.step-header {
    margin-bottom: 20px;
}

.step-header h3 {
    color: #2d3748;
    font-size: 1.3rem;
    margin-bottom: 10px;
}

.step-header p {
    color: #718096;
    font-size: 1rem;
    margin-bottom: 10px;
}

.format-example {
    background: linear-gradient(135deg, #f8f9ff, #e6f3ff);
    padding: 12px;
    border-radius: 8px;
    border: 2px solid #e2e8f0;
    font-size: 0.9rem;
    color: #4a5568;
}

.custom-textarea {
    width: 100%;
    min-height: 200px;
    padding: 15px;
    border: 2px solid #e2e8f0;
    border-radius: 10px;
    font-family: inherit;
    font-size: 1rem;
    line-height: 1.5;
    resize: vertical;
    transition: border-color 0.3s ease;
    color: #2d3748;
    background-color: #ffffff;
}

.custom-textarea:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.custom-textarea::placeholder {
    color: #a0aec0;
}

.step-buttons {
    margin-top: 20px;
    display: flex;
    gap: 15px;
    justify-content: flex-end;
}

.step-btn {
    padding: 12px 24px;
    border: none;
    border-radius: 10px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 1rem;
}

.step-btn {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
}

.step-btn-secondary {
    background: linear-gradient(135deg, #718096, #4a5568);
}

.step-btn-success {
    background: linear-gradient(135deg, #4ecdc4, #44a08d);
}

.step-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.4);
}

.step-btn-secondary:hover {
    box-shadow: 0 8px 25px rgba(113, 128, 150, 0.4);
}

.step-btn-success:hover {
    box-shadow: 0 8px 25px rgba(78, 205, 196, 0.4);
}

/* Индикатор прогресса */
.progress-indicator {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-top: 30px;
    padding-top: 20px;
    border-top: 2px solid #e2e8f0;
}

.progress-step {
    width: 35px;
    height: 35px;
    border-radius: 50%;
    background: #e2e8f0;
    color: #a0aec0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 1rem;
    transition: all 0.3s ease;
}

.progress-step.active {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
}

.progress-step.completed {
    background: linear-gradient(135deg, #4ecdc4, #44a08d);
    color: white;
}

.progress-line {
    width: 80px;
    height: 3px;
    background: #e2e8f0;
    transition: all 0.3s ease;
}

.progress-line.completed {
    background: linear-gradient(135deg, #4ecdc4, #44a08d);
}

/* Загрузочный экран */
.loading-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(102, 126, 234, 0.95);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    color: white;
}

.loading-screen.hide {
    display: none;
}

.spinner {
    width: 60px;
    height: 60px;
    border: 4px solid rgba(255, 255, 255, 0.3);
    border-top: 4px solid white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 20px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.loading-screen p {
    font-size: 1.3rem;
    font-weight: 600;
}

@keyframes modal-appear {
    from {
        opacity: 0;
        transform: scale(0.8);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* Адаптивный дизайн */
@media (max-width: 768px) {
    body {
        padding: 10px;
    }

    .container {
        padding: 15px;
        height: 100vh;
        border-radius: 15px;
    }

    .title {
        font-size: 1.8rem;
    }

    .back-to-main-btn {
        width: 40px;
        height: 40px;
        font-size: 1rem;
    }

    .controls-panel {
        padding: 10px;
    }

    .control-buttons-row {
        gap: 6px;
    }

    .control-btn {
        min-width: 40px;
        height: 40px;
        font-size: 1rem;
        padding: 8px 10px;
    }

    .control-btn svg {
        width: 14px;
        height: 10px;
    }

    #hideRussianBtn svg {
        width: 18px;
        height: 13px;
    }

    #showTranslationBtn svg {
        width: 18px;
        height: 13px;
    }

    .control-btn i {
        font-size: 0.9rem;
    }

    .text-content {
        font-size: 1.1rem;
        line-height: 1.6;
    }

    .text-container {
        max-height: 60vh;
    }

    .navigation {
        gap: 15px;
    }

    .nav-btn {
        min-width: 50px;
        height: 44px;
        font-size: 1.1rem;
    }

    .nav-btn i {
        font-size: 1.1rem;
    }

    .modal-content {
        width: 95%;
        margin: 10px;
    }

    .modal-header {
        padding: 15px 20px;
    }

    .modal-body {
        padding: 20px;
    }

    .settings-modal {
        max-width: 95%;
    }

    .progress-indicator {
        margin-top: 20px;
    }

    .progress-line {
        width: 50px;
    }

    .translation-container {
        margin-top: 15px;
        padding: 15px;
    }
}

@media (max-width: 480px) {
    .control-buttons-row {
        gap: 4px;
        flex-wrap: wrap;
        justify-content: center;
    }

    .control-btn {
        min-width: 36px;
        height: 36px;
        font-size: 0.9rem;
        padding: 6px 8px;
    }

    .control-btn svg {
        width: 12px;
        height: 9px;
    }

    .control-btn i {
        font-size: 0.8rem;
    }

    .fade-btn, .brown-btn, .normal-btn {
        font-size: 0.7rem !important;
    }

    .text-container {
        padding: 15px;
        max-height: 50vh;
    }

    .text-content {
        font-size: 1rem;
    }

    .step-buttons {
        flex-direction: column;
    }

    .step-btn {
        width: 100%;
    }

    .navigation {
        gap: 10px;
    }

    .nav-btn {
        min-width: 45px;
        height: 40px;
        font-size: 1rem;
    }

    .nav-btn i {
        font-size: 1rem;
    }

    .translation-container {
        margin-top: 10px;
        padding: 12px;
    }

    .translation-header h3 {
        font-size: 1rem;
    }

    .translation-text {
        font-size: 1rem;
    }
}

/* Художественный перевод в основном окне */
.translation-container {
    margin-top: 20px;
    padding: 20px;
    background: linear-gradient(135deg, #f0f9ff, #e0f2fe);
    border-radius: 12px;
    border: 2px solid #bae6fd;
}

.translation-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.translation-header h3 {
    margin: 0;
    color: #0c4a6e;
    font-size: 1.1rem;
}

.close-translation {
    background: none;
    border: none;
    color: #0c4a6e;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
    transition: all 0.3s ease;
}

.close-translation:hover {
    background: rgba(12, 74, 110, 0.1);
}

.translation-text {
    color: #0c4a6e;
    font-size: 1.1rem;
    line-height: 1.6;
}

/* Кнопка копирования словаря */
.header-buttons {
    display: flex;
    gap: 10px;
    align-items: center;
}

.copy-btn {
    background: linear-gradient(135deg, #4ecdc4, #44a08d);
    color: white;
    border: none;
    padding: 8px 12px;
    border-radius: 8px;
    font-size: 1.1rem;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.copy-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(78, 205, 196, 0.4);
}

/* Стили для SVG иконок */
.control-btn svg {
    width: 16px;
    height: 12px;
    flex-shrink: 0;
}

/* Увеличенные флаги */
#hideRussianBtn svg {
    width: 20px;
    height: 15px;
}

#showTranslationBtn svg {
    width: 20px;
    height: 15px;
}

.control-btn i {
    font-size: 1rem;
}

.nav-btn i {
    font-size: 1.2rem;
}

.copy-btn i {
    margin-right: 5px;
    font-size: 1rem;
} 