/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Comic Neue', cursive;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    overflow-x: hidden;
}

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

/* Header Styles */
.header {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    padding: 15px 0;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
}

.header .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: relative;
}

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

.logo i {
    font-size: 2.5rem;
    color: #ff6b6b;
    animation: bounce 2s infinite;
}

.logo h1 {
    font-family: 'Fredoka One', cursive;
    font-size: 1.8rem;
    color: #4ecdc4;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.1);
}

/* Header Right - Voice Toggle & Home Button */
.header-right {
    display: flex;
    align-items: center;
    gap: 15px;
}

.voice-toggle-btn {
    background: linear-gradient(45deg, #f39c12, #e67e22);
    color: white;
    border: none;
    padding: 12px;
    border-radius: 50%;
    font-size: 1.1rem;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(243, 156, 18, 0.3);
    width: 45px;
    height: 45px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.voice-toggle-btn:hover {
    transform: translateY(-2px) scale(1.1);
    box-shadow: 0 6px 20px rgba(243, 156, 18, 0.4);
}

.voice-toggle-btn.muted {
    background: linear-gradient(45deg, #95a5a6, #7f8c8d);
    box-shadow: 0 4px 15px rgba(149, 165, 166, 0.3);
}

.voice-toggle-btn.muted:hover {
    box-shadow: 0 6px 20px rgba(149, 165, 166, 0.4);
}

.home-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    background: linear-gradient(45deg, #ff6b6b, #4ecdc4);
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 25px;
    font-family: 'Comic Neue', cursive;
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(255, 107, 107, 0.3);
}

.home-btn:hover {
    transform: translateY(-2px) scale(1.05);
    box-shadow: 0 6px 20px rgba(255, 107, 107, 0.4);
}

.home-btn i {
    font-size: 1.1rem;
}

/* Main Container */
.main-container {
    margin-top: 100px;
    min-height: calc(100vh - 100px);
    position: relative;
}

/* Screen Management */
.screen {
    display: none;
    animation: fadeIn 0.5s ease-in-out;
}

.screen.active {
    display: block;
}

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

/* Welcome Screen */
.welcome-content {
    text-align: center;
    padding: 40px 20px;
    max-width: 600px;
    margin: 0 auto;
}

.welcome-hero {
    margin-bottom: 40px;
}

.hero-icon {
    font-size: 4rem;
    color: #4ecdc4;
    margin-bottom: 20px;
    animation: pulse 2s infinite;
}

.welcome-hero h2 {
    font-family: 'Fredoka One', cursive;
    font-size: 2.5rem;
    color: white;
    margin-bottom: 15px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
}

.welcome-hero p {
    font-size: 1.2rem;
    color: rgba(255, 255, 255, 0.9);
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.3);
}

.player-setup {
    background: rgba(255, 255, 255, 0.95);
    padding: 30px;
    border-radius: 20px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}

.input-group {
    margin-bottom: 25px;
}

.input-group label {
    display: block;
    font-size: 1.1rem;
    color: #333;
    margin-bottom: 10px;
    font-weight: 600;
}

.input-group input {
    width: 100%;
    padding: 12px 15px;
    border: 3px solid #4ecdc4;
    border-radius: 10px;
    font-size: 1.1rem;
    font-family: 'Comic Neue', cursive;
    background: #f8f9fa;
    transition: all 0.3s ease;
}

.input-group input:focus {
    outline: none;
    border-color: #ff6b6b;
    background: white;
    transform: scale(1.02);
}

.class-selection {
    margin-bottom: 25px;
}

.class-selection label {
    display: block;
    font-size: 1.1rem;
    color: #333;
    margin-bottom: 15px;
    font-weight: 600;
}

.class-buttons {
    display: flex;
    gap: 10px;
    justify-content: center;
    flex-wrap: wrap;
}

.class-btn {
    padding: 12px 20px;
    border: 3px solid #4ecdc4;
    background: white;
    color: #333;
    border-radius: 15px;
    font-size: 1rem;
    font-family: 'Comic Neue', cursive;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.class-btn:hover {
    background: #4ecdc4;
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(78, 205, 196, 0.3);
}

.class-btn.selected {
    background: #ff6b6b;
    border-color: #ff6b6b;
    color: white;
    transform: scale(1.1);
}

.start-btn {
    background: linear-gradient(45deg, #ff6b6b, #4ecdc4);
    color: white;
    border: none;
    padding: 15px 30px;
    font-size: 1.2rem;
    font-family: 'Comic Neue', cursive;
    font-weight: 700;
    border-radius: 25px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.2);
}

.start-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.start-btn:not(:disabled):hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.3);
}

/* Dashboard Styles */
.dashboard {
    padding: 40px 20px;
    max-width: 1000px;
    margin: 0 auto;
}

.dashboard-header {
    text-align: center;
    margin-bottom: 40px;
}

.dashboard-header h2 {
    font-family: 'Fredoka One', cursive;
    font-size: 2.2rem;
    color: white;
    margin-bottom: 10px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
}

.dashboard-header p {
    font-size: 1.1rem;
    color: rgba(255, 255, 255, 0.9);
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.3);
}

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

.game-card {
    background: rgba(255, 255, 255, 0.95);
    padding: 25px;
    border-radius: 20px;
    text-align: center;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
    cursor: pointer;
}

.game-card:hover {
    transform: translateY(-10px) scale(1.02);
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.2);
}

.game-icon {
    margin-bottom: 15px;
}

.game-icon i {
    font-size: 3rem;
    color: #ff6b6b;
    animation: float 3s ease-in-out infinite;
}

.game-card[data-game="math"] .game-icon i {
    color: #ff6b6b;
}

.game-card[data-game="english"] .game-icon i {
    color: #4ecdc4;
}

.game-card[data-game="science"] .game-icon i {
    color: #45b7d1;
}

.game-card[data-game="memory"] .game-icon i {
    color: #f39c12;
}

.game-card h3 {
    font-family: 'Fredoka One', cursive;
    font-size: 1.4rem;
    color: #333;
    margin-bottom: 10px;
}

.game-card p {
    color: #666;
    margin-bottom: 15px;
    font-size: 0.9rem;
}

.difficulty-level {
    margin-bottom: 15px;
    padding: 5px 12px;
    background: linear-gradient(45deg, #4ecdc4, #44a08d);
    border-radius: 15px;
    display: inline-block;
}

.difficulty-level span {
    color: white;
    font-weight: 600;
    font-size: 0.8rem;
}

.play-btn {
    background: linear-gradient(45deg, #4ecdc4, #44a08d);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 15px;
    font-family: 'Comic Neue', cursive;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.play-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 5px 15px rgba(78, 205, 196, 0.4);
}

/* Progress Section */
.progress-section {
    background: rgba(255, 255, 255, 0.95);
    padding: 25px;
    border-radius: 20px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
}

.progress-section h3 {
    font-family: 'Fredoka One', cursive;
    text-align: center;
    margin-bottom: 20px;
    color: #333;
}

.progress-grid {
    display: grid;
    gap: 15px;
}

.subject-progress {
    display: flex;
    align-items: center;
    gap: 15px;
}

.subject-progress span {
    min-width: 80px;
    font-weight: 600;
    color: #333;
}

.progress-bar {
    flex: 1;
    height: 10px;
    background: #e0e0e0;
    border-radius: 5px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #4ecdc4, #44a08d);
    border-radius: 5px;
    width: 0%;
    transition: width 0.5s ease;
}

/* Game Screen Styles */
.game-screen {
    padding: 20px;
}

.game-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(255, 255, 255, 0.95);
    padding: 15px 25px;
    border-radius: 15px;
    margin-bottom: 25px;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.1);
}

.back-btn {
    background: #ff6b6b;
    color: white;
    border: none;
    padding: 10px 15px;
    border-radius: 10px;
    font-family: 'Comic Neue', cursive;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.back-btn:hover {
    background: #e55656;
    transform: scale(1.05);
}

.game-header h2 {
    font-family: 'Fredoka One', cursive;
    color: #333;
    font-size: 1.6rem;
}

.game-stats {
    display: flex;
    gap: 20px;
}

.score, .lives, .level, .streak {
    background: #4ecdc4;
    color: white;
    padding: 8px 15px;
    border-radius: 10px;
    font-weight: 600;
}

.streak {
    background: linear-gradient(45deg, #f39c12, #e67e22);
}

.streak.hot {
    background: linear-gradient(45deg, #e74c3c, #c0392b);
    animation: glow 1s ease-in-out infinite;
}

.game-content {
    background: rgba(255, 255, 255, 0.95);
    padding: 30px;
    border-radius: 20px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    text-align: center;
}

/* Math Game Styles */
.math-question-container {
    max-width: 600px;
    margin: 0 auto;
}

.question-display {
    font-size: 3rem;
    font-family: 'Fredoka One', cursive;
    color: #333;
    margin-bottom: 40px;
    padding: 30px;
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    border-radius: 15px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
}

.answer-options {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
    margin-bottom: 30px;
}

.answer-btn {
    padding: 20px;
    font-size: 1.5rem;
    font-family: 'Comic Neue', cursive;
    font-weight: 600;
    background: white;
    border: 3px solid #4ecdc4;
    border-radius: 15px;
    cursor: pointer;
    transition: all 0.3s ease;
    color: #333;
}

.answer-btn:hover {
    background: #4ecdc4;
    color: white;
    transform: scale(1.05);
}

.answer-btn.correct {
    background: #2ecc71;
    border-color: #2ecc71;
    color: white;
    animation: correctAnswer 0.5s ease;
}

.answer-btn.incorrect {
    background: #e74c3c;
    border-color: #e74c3c;
    color: white;
    animation: incorrectAnswer 0.5s ease;
}

/* English Game Styles */
.word-game-container {
    max-width: 600px;
    margin: 0 auto;
}

.word-display {
    margin-bottom: 40px;
}

.word-letters {
    display: flex;
    justify-content: center;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 20px;
}

.letter-slot {
    width: 50px;
    height: 50px;
    border: 3px solid #4ecdc4;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    font-weight: bold;
    background: white;
}

.letter-slot.filled {
    background: #4ecdc4;
    color: white;
}

.letter-options {
    display: flex;
    justify-content: center;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 30px;
}

.letter-btn {
    width: 50px;
    height: 50px;
    border: 3px solid #ff6b6b;
    background: white;
    color: #333;
    border-radius: 10px;
    font-size: 1.2rem;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
}

.letter-btn:hover {
    background: #ff6b6b;
    color: white;
    transform: scale(1.1);
}

.letter-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Science Game Styles */
.science-question-container {
    max-width: 600px;
    margin: 0 auto;
}

.question-image {
    margin-bottom: 30px;
}

.science-visual {
    width: 200px;
    height: 200px;
    margin: 0 auto;
    background: #f8f9fa;
    border-radius: 15px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 4rem;
    color: #4ecdc4;
    border: 3px solid #4ecdc4;
}

.question-text {
    font-size: 1.5rem;
    color: #333;
    margin-bottom: 30px;
    font-weight: 600;
}

/* Memory Game Styles */
.memory-game-container {
    max-width: 600px;
    margin: 0 auto;
}

.memory-instruction {
    font-size: 1.2rem;
    color: #333;
    margin-bottom: 30px;
    font-weight: 600;
}

.memory-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
    margin-bottom: 30px;
    max-width: 400px;
    margin-left: auto;
    margin-right: auto;
}

.memory-cell {
    aspect-ratio: 1;
    background: #f8f9fa;
    border: 3px solid #4ecdc4;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
}

.memory-cell:hover {
    transform: scale(1.05);
}

.memory-cell.active {
    background: #4ecdc4;
    color: white;
    animation: memoryFlash 0.5s ease;
}

.memory-cell.player-active {
    background: #ff6b6b;
    color: white;
}

.memory-controls {
    margin-bottom: 30px;
    display: flex;
    gap: 15px;
    justify-content: center;
    flex-wrap: wrap;
}

.restart-btn {
    background: linear-gradient(45deg, #e74c3c, #c0392b);
    color: white;
    border: none;
    padding: 15px 30px;
    font-size: 1.2rem;
    font-family: 'Comic Neue', cursive;
    font-weight: 700;
    border-radius: 25px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 5px 20px rgba(231, 76, 60, 0.3);
}

.restart-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(231, 76, 60, 0.4);
}

.restart-game-btn {
    background: linear-gradient(45deg, #3498db, #2980b9);
    color: white;
    border: none;
    padding: 12px 20px;
    font-size: 1rem;
    font-family: 'Comic Neue', cursive;
    font-weight: 600;
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(52, 152, 219, 0.3);
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0 auto;
}

.restart-game-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(52, 152, 219, 0.4);
}

.game-controls {
    text-align: center;
}

/* Feedback Messages */
.feedback-message {
    font-size: 1.2rem;
    font-weight: 600;
    padding: 15px;
    border-radius: 10px;
    margin-top: 20px;
    min-height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.feedback-message.correct {
    background: #d4edda;
    color: #155724;
    border: 2px solid #c3e6cb;
}

.feedback-message.incorrect {
    background: #f8d7da;
    color: #721c24;
    border: 2px solid #f5c6cb;
}

/* Modal Styles */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    z-index: 2000;
}

.modal.active {
    display: flex;
    align-items: center;
    justify-content: center;
}

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

.achievement-icon {
    font-size: 4rem;
    color: #ffd700;
    margin-bottom: 20px;
    animation: bounce 1s infinite;
}

.achievement-content h3 {
    font-family: 'Fredoka One', cursive;
    font-size: 1.8rem;
    color: #333;
    margin-bottom: 15px;
}

.modal-close-btn {
    background: linear-gradient(45deg, #4ecdc4, #44a08d);
    color: white;
    border: none;
    padding: 12px 25px;
    border-radius: 15px;
    font-family: 'Comic Neue', cursive;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-top: 15px;
}

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

/* Animations */
@keyframes bounce {
    0%, 20%, 50%, 80%, 100% {
        transform: translateY(0);
    }
    40% {
        transform: translateY(-10px);
    }
    60% {
        transform: translateY(-5px);
    }
}

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

@keyframes float {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-10px);
    }
}

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

@keyframes incorrectAnswer {
    0% {
        transform: translateX(0);
    }
    25% {
        transform: translateX(-5px);
    }
    75% {
        transform: translateX(5px);
    }
    100% {
        transform: translateX(0);
    }
}

@keyframes memoryFlash {
    0% {
        background: #4ecdc4;
    }
    50% {
        background: #ff6b6b;
    }
    100% {
        background: #4ecdc4;
    }
}

@keyframes floatUp {
    0% {
        transform: translateY(0) rotate(0deg);
        opacity: 1;
    }
    100% {
        transform: translateY(-100vh) rotate(360deg);
        opacity: 0;
    }
}

@keyframes particleExplosion {
    0% {
        transform: translate(0, 0) scale(1);
        opacity: 1;
    }
    100% {
        transform: translate(var(--vx), var(--vy)) scale(0);
        opacity: 0;
    }
}

@keyframes wiggle {
    0%, 100% { transform: rotate(0deg); }
    25% { transform: rotate(-3deg); }
    75% { transform: rotate(3deg); }
}

@keyframes glow {
    0%, 100% {
        box-shadow: 0 0 10px rgba(78, 205, 196, 0.5);
    }
    50% {
        box-shadow: 0 0 20px rgba(78, 205, 196, 0.8), 0 0 30px rgba(78, 205, 196, 0.6);
    }
}

.celebration {
    animation: wiggle 0.5s ease-in-out 3;
}

.glow-effect {
    animation: glow 2s ease-in-out infinite;
}

/* Fun Loading Screen */
.loading-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    opacity: 1;
    transition: opacity 1s ease-out;
}

.loading-screen.fade-out {
    opacity: 0;
    pointer-events: none;
}

.loading-content {
    text-align: center;
    color: white;
}

.loading-spinner {
    font-size: 4rem;
    margin-bottom: 2rem;
    animation: spin 2s linear infinite;
}

.loading-spinner i {
    color: #4ecdc4;
    text-shadow: 0 0 20px rgba(78, 205, 196, 0.5);
}

.loading-content h2 {
    font-family: 'Fredoka One', cursive;
    font-size: 2rem;
    margin-bottom: 1rem;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
}

.loading-dots {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
}

.loading-dots span {
    font-size: 2rem;
    animation: dotBounce 1.5s ease-in-out infinite;
}

.loading-dots span:nth-child(2) {
    animation-delay: 0.3s;
}

.loading-dots span:nth-child(3) {
    animation-delay: 0.6s;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

@keyframes dotBounce {
    0%, 60%, 100% {
        transform: translateY(0);
    }
    30% {
        transform: translateY(-20px);
    }
}

/* Responsive Design */
@media (max-width: 768px) {
    .header .container {
        flex-direction: column;
        gap: 15px;
    }
    
    .logo h1 {
        font-size: 1.4rem;
    }
    
    .home-btn {
        font-size: 0.9rem;
        padding: 10px 20px;
    }
    
    .welcome-hero h2 {
        font-size: 2rem;
    }
    
    .game-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .question-display {
        font-size: 2rem;
        padding: 20px;
    }
    
    .answer-options {
        grid-template-columns: 1fr;
    }
    
    .memory-grid {
        grid-template-columns: repeat(3, 1fr);
        max-width: 300px;
    }
    
    .game-header {
        flex-direction: column;
        gap: 15px;
        text-align: center;
    }
    
    .class-buttons {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 480px) {
    .container {
        padding: 0 15px;
    }
    
    .welcome-hero h2 {
        font-size: 1.6rem;
    }
    
    .game-content {
        padding: 20px 15px;
    }
    
    .answer-btn {
        padding: 15px;
        font-size: 1.2rem;
    }
    
    .memory-grid {
        grid-template-columns: repeat(2, 1fr);
        max-width: 200px;
    }
}