/* Reset dan Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary: #FF6B6B;
    --secondary: #4ECDC4;
    --accent: #FFD166;
    --dark: #1A535C;
    --light: #F7FFF7;
    --success: #06D6A0;
    --warning: #FFD166;
    --danger: #EF476F;
    --purple: #7209B7;
    --blue: #4361EE;
}

body {
    font-family: 'Comic Neue', cursive;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    color: white;
    overflow-x: hidden;
}

/* Floating Shapes Animation */
.floating-shapes {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: -1;
}

.shape {
    position: absolute;
    font-size: 2rem;
    opacity: 0.3;
    animation: float 6s ease-in-out infinite;
}

.shape-1 { top: 10%; left: 5%; animation-delay: 0s; }
.shape-2 { top: 20%; right: 10%; animation-delay: 1s; }
.shape-3 { bottom: 30%; left: 15%; animation-delay: 2s; }
.shape-4 { bottom: 20%; right: 5%; animation-delay: 3s; }
.shape-5 { top: 50%; left: 50%; animation-delay: 4s; }
.shape-6 { top: 70%; right: 20%; animation-delay: 5s; }

@keyframes float {
    0%, 100% { transform: translateY(0) rotate(0deg); }
    50% { transform: translateY(-20px) rotate(10deg); }
}

/* Screen Management */
.screen {
    display: none;
    min-height: 100vh;
    padding: 20px;
}

.screen.active {
    display: block;
}

.container {
    max-width: 800px;
    margin: 0 auto;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border-radius: 25px;
    padding: 30px;
    border: 2px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
}

/* Welcome Screen */
.welcome-header {
    text-align: center;
    margin-bottom: 40px;
}

.logo h1 {
    font-family: 'Fredoka One', cursive;
    font-size: 3rem;
    background: linear-gradient(45deg, var(--accent), var(--secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 10px;
}

.tagline {
    font-size: 1.2rem;
    opacity: 0.9;
}

.welcome-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 30px;
    margin-bottom: 40px;
}

.character-animation {
    position: relative;
}

.character {
    font-size: 8rem;
    animation: bounce 2s ease-in-out infinite;
    filter: drop-shadow(0 10px 20px rgba(0,0,0,0.3));
}

@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-20px); }
}

.player-setup {
    display: flex;
    flex-direction: column;
    gap: 20px;
    width: 100%;
    max-width: 400px;
}

.input-group {
    position: relative;
}

#player-name {
    width: 100%;
    padding: 20px 50px 20px 20px;
    border: none;
    border-radius: 15px;
    background: rgba(255, 255, 255, 0.9);
    font-size: 1.1rem;
    text-align: center;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
    transition: all 0.3s ease;
}

#player-name:focus {
    outline: none;
    transform: scale(1.05);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.3);
}

.input-icon {
    position: absolute;
    right: 15px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 1.2rem;
}

.music-control {
    display: flex;
    justify-content: center;
}

.switch {
    position: relative;
    display: inline-block;
    width: 120px;
    height: 50px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(45deg, var(--primary), var(--purple));
    border-radius: 25px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 15px;
    font-weight: bold;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
    transition: all 0.3s ease;
}

.slider:before {
    content: "";
    position: absolute;
    height: 40px;
    width: 40px;
    left: 5px;
    bottom: 5px;
    background: white;
    border-radius: 50%;
    transition: all 0.3s ease;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
}

input:checked + .slider {
    background: linear-gradient(45deg, var(--success), var(--secondary));
}

input:checked + .slider:before {
    transform: translateX(70px);
}

/* Magic Button */
.btn-magic {
    position: relative;
    background: linear-gradient(45deg, var(--primary), var(--purple));
    color: white;
    border: none;
    padding: 20px 40px;
    border-radius: 15px;
    font-size: 1.3rem;
    font-weight: bold;
    cursor: pointer;
    overflow: hidden;
    transition: all 0.3s ease;
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.3);
}

.btn-magic:hover {
    transform: translateY(-5px) scale(1.05);
    box-shadow: 0 15px 30px rgba(0, 0, 0, 0.4);
}

.btn-magic:active {
    transform: translateY(0) scale(1);
}

.btn-sparkle {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    opacity: 0;
    transition: all 0.3s ease;
}

.btn-magic:hover .btn-sparkle {
    opacity: 1;
    animation: sparkle 1s ease-in-out;
}

@keyframes sparkle {
    0% { transform: translate(-50%, -50%) scale(0); opacity: 0; }
    50% { opacity: 1; }
    100% { transform: translate(-50%, -50%) scale(2); opacity: 0; }
}

/* Feature Cards */
.welcome-features {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
}

.feature-card {
    background: rgba(255, 255, 255, 0.1);
    padding: 25px;
    border-radius: 15px;
    text-align: center;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    transition: all 0.3s ease;
}

.feature-card:hover {
    transform: translateY(-5px);
    background: rgba(255, 255, 255, 0.2);
}

.feature-icon {
    font-size: 3rem;
    margin-bottom: 15px;
}

/* Main Menu */
.menu-header {
    text-align: center;
    margin-bottom: 40px;
}

.player-welcome h2 {
    font-size: 2.5rem;
    margin-bottom: 20px;
    background: linear-gradient(45deg, var(--accent), var(--warning));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.player-stats {
    display: flex;
    justify-content: center;
    gap: 20px;
}

.stat-badge {
    background: rgba(255, 255, 255, 0.2);
    padding: 15px 25px;
    border-radius: 15px;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.2rem;
    font-weight: bold;
    backdrop-filter: blur(10px);
}

/* Game Selection */
.game-selection {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 25px;
    margin-bottom: 40px;
}

.game-card {
    background: rgba(255, 255, 255, 0.1);
    padding: 30px;
    border-radius: 20px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
    border: 2px solid transparent;
    position: relative;
    overflow: hidden;
}

.game-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
    transition: left 0.5s;
}

.game-card:hover::before {
    left: 100%;
}

.game-card:hover {
    transform: translateY(-10px) scale(1.05);
    border-color: rgba(255, 255, 255, 0.3);
}

.penjumlahan-card { background: linear-gradient(135deg, #FF6B6B, #FF8E8E); }
.pengurangan-card { background: linear-gradient(135deg, #4ECDC4, #6EE7E7); }
.perkalian-card { background: linear-gradient(135deg, #FFD166, #FFE8A5); }

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.card-icon {
    font-size: 3rem;
}

.card-stars {
    display: flex;
    gap: 5px;
}

.star {
    font-size: 1.2rem;
    opacity: 0.5;
}

.star.active {
    opacity: 1;
    animation: twinkle 1s ease-in-out;
}

@keyframes twinkle {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.3); }
}

.card-progress {
    margin-top: 20px;
}

.progress-bar {
    width: 100%;
    height: 10px;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 5px;
    overflow: hidden;
    margin-bottom: 10px;
}

.progress-fill {
    height: 100%;
    background: rgba(255, 255, 255, 0.8);
    border-radius: 5px;
    transition: width 0.5s ease;
}

.progress-text {
    font-size: 0.9rem;
    opacity: 0.8;
}

/* Game Screen */
.game-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 40px;
    padding: 20px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    backdrop-filter: blur(10px);
}

.game-info h2 {
    font-size: 2rem;
    margin-bottom: 10px;
}

.level-display {
    display: flex;
    align-items: center;
    gap: 10px;
}

.level-number {
    background: var(--accent);
    color: var(--dark);
    padding: 10px 20px;
    border-radius: 50%;
    font-weight: bold;
    font-size: 1.5rem;
}

.live-stats {
    display: flex;
    flex-direction: column;
    gap: 15px;
    align-items: flex-end;
}

.hearts {
    display: flex;
    gap: 5px;
}

.heart {
    font-size: 1.5rem;
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.2); }
}

.score-display {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.5rem;
    font-weight: bold;
}

/* Question Container */
.question-container {
    background: rgba(255, 255, 255, 0.1);
    padding: 40px;
    border-radius: 25px;
    text-align: center;
    margin-bottom: 30px;
    backdrop-filter: blur(10px);
    border: 2px solid rgba(255, 255, 255, 0.2);
    position: relative;
    overflow: hidden;
}

.question-text {
    font-size: 4rem;
    font-weight: bold;
    margin-bottom: 20px;
    text-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
}

.question-character {
    font-size: 4rem;
    animation: float 3s ease-in-out infinite;
}

/* Options Grid */
.options-container {
    margin-bottom: 30px;
}

.options-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
}

.option-btn {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    padding: 30px;
    border-radius: 20px;
    font-size: 2rem;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
    border: 2px solid transparent;
    color: white;
}

.option-btn:hover {
    transform: scale(1.05);
    background: rgba(255, 255, 255, 0.3);
    border-color: rgba(255, 255, 255, 0.5);
}

.option-btn.correct {
    background: var(--success);
    animation: celebrate 0.5s ease-in-out;
}

.option-btn.wrong {
    background: var(--danger);
    animation: shake 0.5s ease-in-out;
}

@keyframes celebrate {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-10px); }
    75% { transform: translateX(10px); }
}

/* Game Feedback */
.game-feedback {
    min-height: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.feedback-content {
    padding: 20px 40px;
    border-radius: 15px;
    font-size: 1.3rem;
    font-weight: bold;
    text-align: center;
    animation: slideIn 0.5s ease-out;
}

@keyframes slideIn {
    from { transform: translateY(20px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

.feedback-correct {
    background: var(--success);
    color: white;
}

.feedback-wrong {
    background: var(--danger);
    color: white;
}

/* Results Screen */
.results-content {
    text-align: center;
}

.results-header {
    margin-bottom: 40px;
}

.result-character {
    font-size: 8rem;
    margin-bottom: 20px;
    animation: bounce 2s ease-in-out infinite;
}

.results-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 30px;
    margin-bottom: 40px;
}

.stat-item {
    background: rgba(255, 255, 255, 0.1);
    padding: 25px;
    border-radius: 20px;
    backdrop-filter: blur(10px);
}

.stat-label {
    display: block;
    font-size: 1rem;
    opacity: 0.8;
    margin-bottom: 10px;
}

.stat-value {
    font-size: 2.5rem;
    font-weight: bold;
}

/* Confetti */
.confetti {
    position: fixed;
    width: 10px;
    height: 10px;
    background: var(--accent);
    animation: confetti-fall 5s linear forwards;
}

@keyframes confetti-fall {
    0% { transform: translateY(-100px) rotate(0deg); opacity: 1; }
    100% { transform: translateY(100vh) rotate(360deg); opacity: 0; }
}

/* Responsive Design */
@media (max-width: 768px) {
    .container {
        padding: 20px;
        margin: 10px;
    }
    
    .logo h1 {
        font-size: 2rem;
    }
    
    .character {
        font-size: 5rem;
    }
    
    .game-selection {
        grid-template-columns: 1fr;
    }
    
    .options-grid {
        grid-template-columns: 1fr;
    }
    
    .question-text {
        font-size: 2.5rem;
    }
    
    .option-btn {
        padding: 20px;
        font-size: 1.5rem;
    }
}

/* Utility Classes */
.btn-primary, .btn-secondary, .btn-action {
    padding: 15px 30px;
    border: none;
    border-radius: 15px;
    font-size: 1.1rem;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 10px;
    justify-content: center;
}

.btn-primary {
    background: linear-gradient(45deg, var(--primary), var(--purple));
    color: white;
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.2);
    color: white;
}

.btn-action {
    background: rgba(255, 255, 255, 0.1);
    color: white;
}

.btn-primary:hover, .btn-secondary:hover, .btn-action:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.2);
}