/* Стили для карточек изучения слов (Flashcards) */

.flashcards-container {
    max-width: 800px;
    margin: 0 auto;
}

.header {
    text-align: center;
    color: white;
    margin-bottom: 30px;
}

.header h1 {
    font-size: 36px;
    margin-bottom: 10px;
    text-shadow: 0 2px 10px rgba(0,0,0,0.2);
}

.progress-bar {
    background: rgba(255,255,255,0.3);
    height: 8px;
    border-radius: 10px;
    overflow: hidden;
    margin-bottom: 20px;
}

.progress-fill {
    background: white;
    height: 100%;
    width: 0%;
    transition: width 0.3s;
    border-radius: 10px;
}

.stats {
    display: flex;
    justify-content: center;
    gap: 30px;
    color: white;
    margin-bottom: 30px;
    font-size: 16px;
}

.stat {
    display: flex;
    align-items: center;
    gap: 8px;
}

.stat-icon {
    font-size: 24px;
}

/* Карточка - квадратная или почти квадратная */
.card-stack {
    position: relative;
    width: 100%;
    max-width: 450px;
    height: 450px;
    margin: 0 auto;
    perspective: 1000px;
}

.flashcard {
    position: absolute;
    width: 100%;
    height: 100%;
    border-radius: 25px;
    cursor: pointer;
    transform-style: preserve-3d;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
    -webkit-touch-callout: none;
    perspective: 1000px;
}

.flashcard:hover {
    /* Убираем hover эффект - он конфликтует */
}

.card-front, .card-back {
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px;
    border-radius: 25px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.2);
    transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
    transform-style: preserve-3d;
    -webkit-transform-style: preserve-3d;
}

.card-front {
    background: white;
    transform: rotateY(0deg);
}

.card-back {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    transform: rotateY(180deg);
}

/* Переворот карточки */
.flashcard.flipped .card-front {
    transform: rotateY(-180deg);
}

.flashcard.flipped .card-back {
    transform: rotateY(0deg);
}

.word-main {
    font-size: 48px;
    font-weight: 700;
    margin-bottom: 15px;
    color: #667eea;
    word-wrap: break-word;
    overflow-wrap: break-word;
    hyphens: auto;
    max-width: 100%;
    text-align: center;
}

.word-pronunciation {
    font-size: 20px;
    color: #999;
    margin-bottom: 30px;
    font-style: italic;
    word-wrap: break-word;
    max-width: 100%;
    text-align: center;
}

/* Кнопка аудио */
.audio-button-container {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 30px;
}

.audio-button {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    border-radius: 50%;
    width: 60px;
    height: 60px;
    font-size: 28px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
    transition: all 0.3s ease;
    color: white;
    user-select: none;
    -webkit-user-select: none;
    /* Для мобильных устройств */
    touch-action: manipulation; /* Отключает задержку двойного тапа */
    -webkit-tap-highlight-color: transparent; /* Убирает подсветку при тапе на iOS */
    pointer-events: auto; /* Убеждаемся что кнопка кликабельна */
    position: relative;
    z-index: 10; /* Поверх других элементов */
}

.audio-button:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.6);
}

.audio-button:active {
    transform: scale(0.95);
}

/* Визуальная обратная связь при нажатии */
.audio-button.pressed {
    transform: scale(0.9);
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
    transition: transform 0.1s ease, box-shadow 0.1s ease;
}

.audio-button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

/* Индикация загрузки при запросе к API */
.audio-button.loading {
    animation: pulse 1.5s ease-in-out infinite;
}

/* Индикация загрузки аудио файла */
.audio-button.loading-audio {
    position: relative;
    opacity: 0.8;
}

.audio-button.loading-audio::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

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

.word-translation {
    font-size: 42px;
    font-weight: 700;
    text-align: center;
    word-wrap: break-word;
    overflow-wrap: break-word;
    hyphens: auto;
    max-width: 100%;
    padding: 0 20px;
}

.word-level {
    position: absolute;
    top: 20px;
    right: 20px;
    background: #667eea;
    color: white;
    padding: 5px 15px;
    border-radius: 15px;
    font-size: 14px;
    font-weight: 600;
}

.card-back .word-level {
    background: rgba(255,255,255,0.3);
}

.hint-text {
    position: absolute;
    bottom: 30px;
    font-size: 14px;
    color: #999;
    text-align: center;
}

.card-back .hint-text {
    color: rgba(255,255,255,0.8);
}

/* Кнопки действий */
.action-buttons {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-top: 30px;
}

.action-btn {
    width: 70px;
    height: 70px;
    border-radius: 50%;
    border: none;
    font-size: 32px;
    cursor: pointer;
    box-shadow: 0 5px 15px rgba(0,0,0,0.2);
    transition: all 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.action-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 8px 20px rgba(0,0,0,0.3);
}

.btn-dont-know {
    background: linear-gradient(135deg, #ff6b6b, #ee5a6f);
    color: white;
}

.btn-know {
    background: linear-gradient(135deg, #51cf66, #37b24d);
    color: white;
}

/* Экран завершения */
.completion-screen {
    display: none;
    text-align: center;
    color: white;
    padding: 40px;
}

.completion-screen.show {
    display: block;
}

.completion-icon {
    font-size: 80px;
    margin-bottom: 20px;
}

.completion-title {
    font-size: 36px;
    font-weight: 700;
    margin-bottom: 20px;
}

.completion-stats {
    font-size: 18px;
    margin-bottom: 30px;
}

.restart-btn {
    background: white;
    color: #667eea;
    padding: 15px 40px;
    border: none;
    border-radius: 30px;
    font-size: 18px;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 5px 15px rgba(0,0,0,0.2);
    transition: all 0.3s;
}

.restart-btn:hover {
    transform: scale(1.05);
}

/* Свайп индикаторы */
.swipe-indicator {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    font-size: 60px;
    opacity: 0;
    transition: opacity 0.3s;
    pointer-events: none;
}

.swipe-indicator.left {
    left: 30px;
}

.swipe-indicator.right {
    right: 30px;
}

.flashcard.dragging-left .swipe-indicator.left {
    opacity: 1;
}

.flashcard.dragging-right .swipe-indicator.right {
    opacity: 1;
}

/* Limit Banner */
.limit-banner {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    border-radius: 15px;
    padding: 25px;
    margin-bottom: 30px;
    box-shadow: 0 10px 30px rgba(245, 87, 108, 0.3);
    animation: slideDown 0.5s ease;
}

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

.limit-banner-content {
    display: flex;
    align-items: center;
    gap: 20px;
    color: white;
}

.limit-icon {
    font-size: 48px;
    flex-shrink: 0;
}

.limit-text {
    flex: 1;
}

.limit-text h3 {
    font-size: 20px;
    margin-bottom: 10px;
    font-weight: 700;
}

.limit-text p {
    font-size: 14px;
    margin-bottom: 5px;
    opacity: 0.95;
}

.limit-actions {
    display: flex;
    gap: 10px;
    flex-shrink: 0;
}

.btn-register, .btn-login {
    padding: 12px 24px;
    border-radius: 8px;
    text-decoration: none;
    font-weight: 600;
    transition: all 0.2s;
    display: inline-block;
    font-size: 14px;
}

.btn-register {
    background: white;
    color: #f5576c;
}

.btn-register:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(255,255,255,0.3);
}

.btn-login {
    background: rgba(255,255,255,0.2);
    color: white;
    border: 1px solid white;
}

.btn-login:hover {
    background: rgba(255,255,255,0.3);
}

/* Адаптивность */
@media (max-width: 768px) {
    .card-stack {
        max-width: 100%;
        height: 400px;
    }

    .limit-banner-content {
        flex-direction: column;
        text-align: center;
    }

    .limit-actions {
        width: 100%;
        flex-direction: column;
    }

    .btn-register, .btn-login {
        width: 100%;
    }
}

@media (max-width: 480px) {
    .card-stack {
        height: 350px;
    }

    .word-main {
        font-size: 36px;
    }

    .word-translation {
        font-size: 32px;
    }
}

