/* Dynamic theme system */
:root {
    --theme-background: linear-gradient(135deg, #ff6b6b 0%, #ee5a6f 100%);
    --theme-primary: #ee5a6f;
    --theme-secondary: #ff6b6b;
    --theme-accent: #ff8787;
    --theme-success: #4ade80;
    --theme-danger: #ef4444;
    --theme-info: #3b82f6;
    --theme-question: linear-gradient(135deg, #ffe0e0 0%, #ffd6d6 100%);
    --theme-shadow: rgba(0, 0, 0, 0.1);
}

/* Theme variations */
.theme-red {
    --theme-background: linear-gradient(135deg, #ff6b6b 0%, #ee5a6f 100%);
    --theme-primary: #ee5a6f;
    --theme-secondary: #ff6b6b;
    --theme-accent: #ff8787;
    --theme-question: linear-gradient(135deg, #ffe0e0 0%, #ffd6d6 100%);
}

.theme-orange {
    --theme-background: linear-gradient(135deg, #ff9f43 0%, #ff6348 100%);
    --theme-primary: #ff6348;
    --theme-secondary: #ff9f43;
    --theme-accent: #ffb976;
    --theme-question: linear-gradient(135deg, #ffe8d6 0%, #ffd9c4 100%);
}

.theme-amber {
    --theme-background: linear-gradient(135deg, #ffc107 0%, #ff9800 100%);
    --theme-primary: #ff9800;
    --theme-secondary: #ffc107;
    --theme-accent: #ffd54f;
    --theme-question: linear-gradient(135deg, #fff3cd 0%, #ffe8b3 100%);
}

.theme-yellow {
    --theme-background: linear-gradient(135deg, #ffd93d 0%, #ffb800 100%);
    --theme-primary: #ffb800;
    --theme-secondary: #ffd93d;
    --theme-accent: #ffe66d;
    --theme-question: linear-gradient(135deg, #fff9db 0%, #fff3c4 100%);
}

.theme-lime {
    --theme-background: linear-gradient(135deg, #cddc39 0%, #9ccc65 100%);
    --theme-primary: #9ccc65;
    --theme-secondary: #cddc39;
    --theme-accent: #d4e157;
    --theme-question: linear-gradient(135deg, #f0f4c3 0%, #e6ee9c 100%);
}

.theme-green {
    --theme-background: linear-gradient(135deg, #66bb6a 0%, #43a047 100%);
    --theme-primary: #43a047;
    --theme-secondary: #66bb6a;
    --theme-accent: #81c784;
    --theme-question: linear-gradient(135deg, #c8e6c9 0%, #a5d6a7 100%);
}

.theme-emerald {
    --theme-background: linear-gradient(135deg, #26a69a 0%, #00897b 100%);
    --theme-primary: #00897b;
    --theme-secondary: #26a69a;
    --theme-accent: #4db6ac;
    --theme-question: linear-gradient(135deg, #b2dfdb 0%, #80cbc4 100%);
}

.theme-teal {
    --theme-background: linear-gradient(135deg, #26c6da 0%, #00acc1 100%);
    --theme-primary: #00acc1;
    --theme-secondary: #26c6da;
    --theme-accent: #4dd0e1;
    --theme-question: linear-gradient(135deg, #b2ebf2 0%, #80deea 100%);
}

.theme-cyan {
    --theme-background: linear-gradient(135deg, #00bcd4 0%, #0097a7 100%);
    --theme-primary: #0097a7;
    --theme-secondary: #00bcd4;
    --theme-accent: #26c6da;
    --theme-question: linear-gradient(135deg, #b2ebf2 0%, #80deea 100%);
}

.theme-sky {
    --theme-background: linear-gradient(135deg, #29b6f6 0%, #039be5 100%);
    --theme-primary: #039be5;
    --theme-secondary: #29b6f6;
    --theme-accent: #4fc3f7;
    --theme-question: linear-gradient(135deg, #b3e5fc 0%, #81d4fa 100%);
}

.theme-blue {
    --theme-background: linear-gradient(135deg, #42a5f5 0%, #1e88e5 100%);
    --theme-primary: #1e88e5;
    --theme-secondary: #42a5f5;
    --theme-accent: #64b5f6;
    --theme-question: linear-gradient(135deg, #bbdefb 0%, #90caf9 100%);
}

.theme-indigo {
    --theme-background: linear-gradient(135deg, #5c6bc0 0%, #3f51b5 100%);
    --theme-primary: #3f51b5;
    --theme-secondary: #5c6bc0;
    --theme-accent: #7986cb;
    --theme-question: linear-gradient(135deg, #c5cae9 0%, #9fa8da 100%);
}

.theme-violet {
    --theme-background: linear-gradient(135deg, #7e57c2 0%, #673ab7 100%);
    --theme-primary: #673ab7;
    --theme-secondary: #7e57c2;
    --theme-accent: #9575cd;
    --theme-question: linear-gradient(135deg, #d1c4e9 0%, #b39ddb 100%);
}

.theme-purple {
    --theme-background: linear-gradient(135deg, #ab47bc 0%, #9c27b0 100%);
    --theme-primary: #9c27b0;
    --theme-secondary: #ab47bc;
    --theme-accent: #ba68c8;
    --theme-question: linear-gradient(135deg, #e1bee7 0%, #ce93d8 100%);
}

.theme-fuchsia {
    --theme-background: linear-gradient(135deg, #ec407a 0%, #e91e63 100%);
    --theme-primary: #e91e63;
    --theme-secondary: #ec407a;
    --theme-accent: #f06292;
    --theme-question: linear-gradient(135deg, #f8bbd0 0%, #f48fb1 100%);
}

.theme-pink {
    --theme-background: linear-gradient(135deg, #f06292 0%, #ec407a 100%);
    --theme-primary: #ec407a;
    --theme-secondary: #f06292;
    --theme-accent: #f48fb1;
    --theme-question: linear-gradient(135deg, #fce4ec 0%, #f8bbd0 100%);
}

.theme-rose {
    --theme-background: linear-gradient(135deg, #ff5252 0%, #f44336 100%);
    --theme-primary: #f44336;
    --theme-secondary: #ff5252;
    --theme-accent: #ff8a80;
    --theme-question: linear-gradient(135deg, #ffebee 0%, #ffcdd2 100%);
}

/* Base styles */
body {
    background: var(--theme-background);
    min-height: 100vh;
    font-family: 'Nunito', sans-serif;
    display: flex;
    flex-direction: column;
    margin: 0;
}

/* Game container */
.game-container {
    background: white;
    border-radius: 20px;
    padding: 2rem;
    box-shadow: 0 10px 30px var(--theme-shadow);
}

/* Subtraction display */
.subtraction-display {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1.5rem;
    margin: 2rem 0;
}

/* Adjusted for up to 20 dots */
.dots-cell {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    padding: 0.75rem;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 15px;
    min-height: 200px;
    width: 260px;
    border: 3px solid var(--theme-accent);
    box-shadow: inset 0 2px 10px rgba(0, 0, 0, 0.1);
    justify-content: center;
    align-content: center;
    overflow: hidden;
}

.dot-item {
    display: flex;
    justify-content: center;
    align-items: center;
    animation: fadeIn 0.5s ease-in;
}

/* Smaller dots for up to 20 */
.dot-image {
    width: 24px;
    height: 24px;
    object-fit: contain;
    transition: transform 0.3s;
    filter: drop-shadow(2px 2px 4px rgba(0, 0, 0, 0.2));
}

.dot-image:hover {
    transform: scale(1.1);
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: scale(0.8);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.minus-sign {
    font-size: 3.5rem;
    font-weight: 400;
    color: var(--theme-primary);
    text-shadow: 2px 2px 4px var(--theme-shadow);
}

/* Progress bar */
.progress-info {
    margin-bottom: 2rem;
}

.progress-bar-container {
    margin-bottom: 1rem;
}

.progress-bar {
    height: 30px;
    background: #f0f0f0;
    border-radius: 15px;
    overflow: hidden;
    position: relative;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--theme-primary) 0%, var(--theme-secondary) 100%);
    border-radius: 15px;
    transition: width 0.3s ease;
    width: 0%;
}

.progress-timer {
    position: absolute;
    right: 15px;
    top: 50%;
    transform: translateY(-50%);
    font-weight: 400;
    color: #333;
}

/* Multiple choice buttons */
.choices-grid {
    display: flex;
    justify-content: center;
    gap: 1rem;
    margin: 2rem 0;
    flex-wrap: nowrap;
}

.choice-btn {
    min-width: 100px;
    font-size: 1.5rem;
    font-weight: 400;
    padding: 1rem 2rem;
    border: 3px solid var(--theme-accent);
    border-radius: 15px;
    background: white;
    color: var(--theme-primary);
    font-family: 'Fredoka', sans-serif;
    cursor: pointer;
    transition: all 0.3s ease;
    flex: 1;
    max-width: 150px;
}

.choice-btn:hover:not(:disabled) {
    background: var(--theme-accent);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px var(--theme-shadow);
}

.choice-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.choice-btn.selected {
    background: var(--theme-primary);
    color: white;
    border-color: var(--theme-primary);
}

.choice-btn.correct {
    background: var(--theme-success);
    color: white;
    border-color: var(--theme-success);
}

.choice-btn.incorrect {
    background: var(--theme-danger);
    color: white;
    border-color: var(--theme-danger);
}

/* Question styling */
.question-container {
    background: var(--theme-question);
    padding: 2rem;
    padding-bottom: 1rem !important;
    border-radius: 20px;
    margin-bottom: 2rem;
}

.subtitle.is-3 {
    color: var(--theme-primary) !important;
    font-family: 'Fredoka', sans-serif;
    font-weight: 400 !important;
    margin-bottom: 1rem !important;
}

/* Title styling */
.title.is-2 {
    color: var(--theme-primary) !important;
    font-family: 'Fredoka', sans-serif;
    font-weight: 400;
    margin-bottom: 2rem !important;
}

/* Feedback messages */
.notification {
    font-family: 'Fredoka', sans-serif;
    font-size: 1.2rem;
    font-weight: 400;
    border-radius: 15px;
    box-shadow: 0 4px 12px var(--theme-shadow);
}

.notification.is-success {
    background: #d1f2eb;
    color: #00695c;
}

.notification.is-danger {
    background: #ffebee;
    color: #c62828;
}

/* Result screen */
.result-card {
    background: white;
    padding: 3rem;
    border-radius: 20px;
    box-shadow: 0 10px 30px var(--theme-shadow);
    text-align: center;
}

.result-message {
    font-size: 1.25rem;
    color: var(--theme-primary);
    margin: 2rem 0;
    font-family: 'Fredoka', sans-serif;
}

/* Buttons */
.button {
    font-family: 'Fredoka', sans-serif;
    font-weight: 400;
    transition: all 0.3s ease;
}

.button.is-info {
    background: var(--theme-info);
    color: white;
}

.button.is-primary {
    background: linear-gradient(45deg, var(--theme-primary) 0%, var(--theme-secondary) 100%);
    color: white;
}

#next-btn-container {
    margin-top: 1.5rem;
}

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

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

.correct-animation {
    animation: bounce 0.5s ease-in-out;
}

.incorrect-animation {
    animation: shake 0.5s ease-in-out;
}

/* Responsive design */
@media (max-width: 768px) {
    .game-container {
        padding: 1rem;
    }
    
    .title.is-2 {
        font-size: 1.5rem !important;
    }
    
    .subtitle.is-3 {
        font-size: 1.5rem !important;
    }
    
    .subtraction-display {
        gap: 1rem;
    }
    
    .dots-cell {
        min-height: 160px;
        width: 220px;
        padding: 0.5rem;
        gap: 0.3rem;
    }
    
    .dot-image {
        width: 20px;
        height: 20px;
    }
    
    .minus-sign {
        font-size: 2.5rem;
    }
    
    .choices-grid {
        gap: 0.5rem;
    }
    
    .choice-btn {
        font-size: 1.25rem;
        padding: 0.75rem 1rem;
        min-width: 80px;
    }
}

@media (max-width: 480px) {
    .subtraction-display {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .dots-cell {
        width: 240px;
        min-height: 140px;
        gap: 0.3rem;
    }
    
    .dot-image {
        width: 18px;
        height: 18px;
    }
    
    .minus-sign {
        font-size: 2.5rem;
        margin: 0.5rem 0;
    }
    
    .choices-grid {
        gap: 0.5rem;
    }
    
    .choice-btn {
        font-size: 1.1rem;
        padding: 0.6rem 0.8rem;
        min-width: 70px;
    }
}

/* Sticky footer styles */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
}
