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

:root {
    --primary: #0891b2;
    --primary-dark: #0e7490;
    --primary-light: #22d3ee;
    --secondary: #f97316;
    --success: #22c55e;
    --error: #ef4444;
    --background: #ecfeff;
    --card-bg: #ffffff;
    --text: #164e63;
    --text-light: #67e8f9;
    --shadow: rgba(8, 145, 178, 0.2);
}

body {
    font-family: 'Poppins', sans-serif;
    background: linear-gradient(135deg, #ecfeff 0%, #cffafe 50%, #a5f3fc 100%);
    min-height: 100vh;
    color: var(--text);
    overflow-x: hidden;
}

/* Animated Wave Background */
.waves-bg {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 200px;
    overflow: hidden;
    z-index: 0;
    pointer-events: none;
}

.wave {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 200%;
    height: 100%;
    background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 1440 320'%3E%3Cpath fill='%2322d3ee' fill-opacity='0.3' d='M0,192L48,197.3C96,203,192,213,288,229.3C384,245,480,267,576,250.7C672,235,768,181,864,181.3C960,181,1056,235,1152,234.7C1248,235,1344,181,1392,154.7L1440,128L1440,320L1392,320C1344,320,1248,320,1152,320C1056,320,960,320,864,320C768,320,672,320,576,320C480,320,384,320,288,320C192,320,96,320,48,320L0,320Z'%3E%3C/path%3E%3C/svg%3E") repeat-x;
    background-size: 50% 100%;
    animation: wave 15s linear infinite;
}

.wave2 {
    opacity: 0.5;
    animation: wave 20s linear infinite reverse;
    bottom: 10px;
}

.wave3 {
    opacity: 0.3;
    animation: wave 25s linear infinite;
    bottom: 20px;
}

@keyframes wave {
    0% { transform: translateX(0); }
    100% { transform: translateX(-50%); }
}

/* App Container */
.app-container {
    max-width: 600px;
    margin: 0 auto;
    padding: 20px;
    position: relative;
    z-index: 1;
}

/* Header */
header {
    text-align: center;
    margin-bottom: 25px;
}

header h1 {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--primary-dark);
    margin-bottom: 5px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.1);
}

.tagline {
    color: var(--primary);
    font-size: 1rem;
    margin-bottom: 3px;
}

.subtitle {
    color: #666;
    font-size: 0.9rem;
    margin-bottom: 20px;
}

/* Stats Bar */
.stats-bar {
    display: flex;
    justify-content: center;
    gap: 30px;
    background: var(--card-bg);
    padding: 15px 30px;
    border-radius: 50px;
    box-shadow: 0 4px 20px var(--shadow);
}

.stat {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
}

.stat-icon {
    font-size: 1.5rem;
}

.stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary-dark);
}

.stat-label {
    font-size: 0.75rem;
    color: #666;
    text-transform: uppercase;
}

/* Category Navigation */
.category-nav {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-bottom: 25px;
    flex-wrap: wrap;
}

.cat-btn {
    padding: 10px 20px;
    border: 2px solid var(--primary);
    background: white;
    border-radius: 50px;
    font-family: inherit;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.3s ease;
    color: var(--primary);
    font-weight: 500;
}

.cat-btn:hover {
    background: #ecfeff;
}

.cat-btn.active {
    background: var(--primary);
    color: white;
}

/* Game Modes */
.game-mode {
    display: none;
    animation: fadeIn 0.5s ease;
}

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

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

/* Flashcard Mode */
.flashcard-container {
    perspective: 1000px;
    margin-bottom: 30px;
}

.flashcard {
    width: 100%;
    max-width: 450px;
    height: 320px;
    margin: 0 auto;
    position: relative;
}

.flashcard-inner {
    width: 100%;
    height: 100%;
    position: relative;
    transform-style: preserve-3d;
    transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.flashcard.flipped .flashcard-inner {
    transform: rotateY(180deg);
}

.flashcard-front,
.flashcard-back {
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    border-radius: 24px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 30px;
    text-align: center;
    box-shadow: 0 10px 40px var(--shadow);
}

.flashcard-front {
    background: linear-gradient(135deg, #059669 0%, #047857 100%);
    color: white;
}

.flashcard-back {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: white;
    transform: rotateY(180deg);
}

.language-label {
    position: absolute;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(255, 255, 255, 0.2);
    padding: 5px 15px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.audio-btn {
    position: absolute;
    top: 15px;
    right: 15px;
    width: 45px;
    height: 45px;
    border: none;
    background: rgba(255, 255, 255, 0.25);
    border-radius: 50%;
    font-size: 1.4rem;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.audio-btn:hover {
    background: rgba(255, 255, 255, 0.4);
    transform: scale(1.1);
}

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

.audio-btn.playing {
    animation: pulse 0.5s ease infinite;
}

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

.flashcard-front .word {
    font-size: 2.2rem;
    font-weight: 700;
    margin-bottom: 15px;
    margin-top: 20px;
}

.flashcard-front .example {
    font-size: 1rem;
    opacity: 0.9;
    font-style: italic;
    margin-bottom: 25px;
    padding: 0 10px;
}

.reveal-btn {
    padding: 12px 30px;
    background: white;
    color: #059669;
    border: none;
    border-radius: 50px;
    font-family: inherit;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.reveal-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.2);
}

.flashcard-back .translation {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 8px;
    margin-top: 20px;
}

.number-display {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 20px;
    opacity: 0.9;
}

.number-display:empty {
    display: none;
}

.original-word {
    background: rgba(255, 255, 255, 0.15);
    padding: 12px 25px;
    border-radius: 15px;
}

.original-label {
    font-size: 0.85rem;
    opacity: 0.8;
    display: block;
    margin-bottom: 3px;
}

#flash-original {
    font-size: 1.1rem;
    font-weight: 600;
}

.flip-back-btn {
    margin-top: 20px;
    padding: 10px 25px;
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border: 2px solid rgba(255, 255, 255, 0.4);
    border-radius: 50px;
    font-family: inherit;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
}

.flip-back-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    border-color: rgba(255, 255, 255, 0.6);
}

/* Flashcard Controls */
.flashcard-controls {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-bottom: 20px;
}

.control-btn {
    padding: 15px 30px;
    border: none;
    border-radius: 50px;
    font-family: inherit;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 10px;
}

.control-btn.correct {
    background: var(--success);
    color: white;
}

.control-btn.incorrect {
    background: #fef3c7;
    color: #d97706;
}

.control-btn:hover:not([aria-disabled="true"]) {
    transform: scale(1.05);
}

.control-btn[aria-disabled="true"] {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
    pointer-events: auto; /* Allow clicks but show disabled state */
}

.progress-indicator {
    text-align: center;
    color: var(--primary);
    font-weight: 500;
    font-size: 1.1rem;
}

/* Celebration Overlay */
.celebration {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.celebration.active {
    display: flex;
    animation: fadeIn 0.3s ease;
}

.celebration-content {
    background: white;
    padding: 50px;
    border-radius: 30px;
    text-align: center;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    max-width: 90%;
}

.celebration-emoji {
    font-size: 4rem;
    display: block;
    margin-bottom: 20px;
    animation: bounce 0.5s ease infinite alternate;
}

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

.celebration-content h2 {
    font-size: 2rem;
    color: var(--primary-dark);
    margin-bottom: 10px;
}

.celebration-content p {
    color: #666;
    margin-bottom: 30px;
    font-size: 1.1rem;
}

.celebration-btn {
    padding: 15px 40px;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: white;
    border: none;
    border-radius: 50px;
    font-family: inherit;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

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

/* Responsive Design */
@media (max-width: 500px) {
    header h1 {
        font-size: 2rem;
    }

    .stats-bar {
        gap: 15px;
        padding: 12px 20px;
    }

    .stat-value {
        font-size: 1.2rem;
    }

    .flashcard {
        height: 300px;
    }

    .flashcard-front .word {
        font-size: 1.8rem;
    }

    .flashcard-back .translation {
        font-size: 1.6rem;
    }

    .control-btn {
        padding: 12px 20px;
        font-size: 0.9rem;
    }

    .cat-btn {
        padding: 8px 15px;
        font-size: 0.85rem;
    }

    .celebration-content {
        padding: 35px 25px;
    }
}
