:root {
    --theme-background: linear-gradient(135deg, #9333ea 0%, #7c3aed 100%);
    --theme-primary: #9333ea;
    --theme-secondary: #7c3aed;
    --theme-accent: #a855f7;
    --theme-question: linear-gradient(135deg, #e9d5ff 0%, #f3e8ff 100%);
    --theme-success: #c084fc;
    --theme-danger: #6b21a8;
    --theme-info: #d8b4fe;
    --theme-title: #581c87;
    --theme-progress: #c084fc;
    --theme-score: #a855f7;
}

body {
    background: var(--theme-background);
    min-height: 100vh;
    font-family: 'Karla', sans-serif;
    color: var(--theme-title);
}

.box.game-container {
    background: var(--theme-question);
    border-radius: 20px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15);
    border: 4px solid var(--theme-accent);
    padding: 2rem;
    position: relative;
    overflow: hidden;
}

.box.game-container::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, var(--theme-accent) 0%, transparent 70%);
    opacity: 0.05;
    transform: rotate(45deg);
    pointer-events: none;
}

.title {
    color: var(--theme-title);
    font-weight: 800;
}

.subtitle {
    color: var(--theme-primary);
    opacity: 0.9;
}

/* Add subtle pattern overlay */
body::after {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image: 
        radial-gradient(circle at 20% 80%, var(--theme-accent) 0%, transparent 50%),
        radial-gradient(circle at 80% 20%, var(--theme-primary) 0%, transparent 50%),
        radial-gradient(circle at 40% 40%, var(--theme-secondary) 0%, transparent 50%);
    opacity: 0.1;
    pointer-events: none;
    z-index: -1;
}

.progress-info {
    margin-bottom: 2rem;
}

.progress-info .tag {
    white-space: nowrap;
}

.progress-info #current-question,
.progress-info #score {
    margin-left: 0.25rem;
}

.tag {
    font-size: 1.1rem;
    padding: 0.75rem 1.5rem;
    border-radius: 25px;
}

.tag.is-info {
    background: var(--theme-accent);
    color: white;
    border: 2px solid var(--theme-secondary);
}

.tag.is-success {
    background: var(--theme-score);
    color: white;
    border: 2px solid var(--theme-secondary);
}

/* Timer styling */
#timer {
    margin-left: 0.25rem;
}

.question-container {
    background: var(--theme-primary);
    padding: 1.5rem;
    border-radius: 15px;
    margin-bottom: 2rem;
    border: 2px solid var(--theme-secondary);
}

#question-text {
    color: white;
    margin: 0;
    font-weight: 700;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.3);
}

.animals-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
    gap: 1rem;
    padding: 2rem;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 15px;
    margin-bottom: 2rem;
    min-height: 200px;
    border: 3px solid var(--theme-accent);
    box-shadow: inset 0 2px 10px rgba(0, 0, 0, 0.1);
}

.animal-item {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 0.5rem;
    animation: fadeIn 0.5s ease-in;
    background: white;
    border-radius: 10px;
    border: 2px solid var(--theme-accent);
}

.animal-image {
    width: 80px;
    height: 80px;
    object-fit: contain;
    transition: transform 0.3s;
    filter: drop-shadow(2px 2px 4px rgba(0, 0, 0, 0.2));
}

.animal-image:hover {
    transform: scale(1.1) rotate(5deg);
}

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

/* Multiple choice specific styles */
.choices-section {
    margin-top: 2rem;
    text-align: center;
}

.choices-grid {
    display: flex;
    justify-content: center;
    gap: 1.5rem;
    flex-wrap: nowrap;
    margin-bottom: 1.5rem;
    padding: 0 0.5rem;
}

.choice-button {
    min-width: 120px;
    height: 80px;
    font-size: 2rem;
    font-weight: 800;
    background: linear-gradient(45deg, var(--theme-primary) 0%, var(--theme-secondary) 100%);
    color: white;
    border: none;
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
}

.choice-button::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.choice-button:hover {
    transform: translateY(-5px) scale(1.05);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.3);
}

.choice-button:hover::before {
    width: 200px;
    height: 200px;
}

.choice-button:active {
    transform: translateY(-2px) scale(1.02);
}

.choice-button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.choice-button.correct {
    background: linear-gradient(45deg, #22c55e 0%, #16a34a 100%);
    animation: correctPulse 0.6s ease-out;
}

.choice-button.incorrect {
    background: linear-gradient(45deg, #ef4444 0%, #dc2626 100%);
    animation: shake 0.5s ease-out;
}

@keyframes correctPulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.2); }
    100% { transform: scale(1); }
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    10%, 30%, 50%, 70%, 90% { transform: translateX(-5px); }
    20%, 40%, 60%, 80% { transform: translateX(5px); }
}

.feedback-message {
    margin-top: 1rem;
    font-size: 1.2rem;
    font-weight: bold;
    border-radius: 10px;
    animation: slideIn 0.3s ease-out;
    border: 2px solid currentColor;
}

.notification.is-success {
    background-color: var(--theme-success);
    color: var(--theme-title);
    border: 2px solid var(--theme-secondary);
}

.notification.is-danger {
    background-color: var(--theme-danger);
    color: white;
    border: 2px solid var(--theme-primary);
}

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

#next-btn {
    margin-top: 1rem;
    font-size: 1.1rem;
    padding: 0.75rem 2rem;
    border-radius: 25px;
    background: linear-gradient(45deg, var(--theme-primary) 0%, var(--theme-secondary) 100%);
    color: white;
    border: none;
    font-weight: 700;
    transition: all 0.3s ease;
}

#next-btn:hover {
    transform: scale(1.05);
    background: linear-gradient(45deg, var(--theme-accent) 0%, var(--theme-primary) 100%);
}

.result-card {
    background: rgba(255, 255, 255, 0.95);
    padding: 3rem;
    border-radius: 20px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    border: 3px solid var(--theme-primary);
    max-width: 500px;
    margin: 0 auto;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
}

#final-score {
    font-size: 3rem;
    margin: 1rem 0;
    animation: zoomIn 0.5s ease-out;
    color: var(--theme-primary);
    font-weight: 900;
}

@keyframes zoomIn {
    from {
        transform: scale(0);
    }
    to {
        transform: scale(1);
    }
}

.result-message {
    font-size: 1.3rem;
    color: var(--theme-title);
    margin: 1.5rem 0;
    font-weight: bold;
}

#play-again-btn {
    margin: 1.5rem 0 0;
    font-size: 1.2rem;
    padding: 1rem 2.5rem;
    border-radius: 30px;
    background: linear-gradient(45deg, var(--theme-primary) 0%, var(--theme-secondary) 100%);
    color: white;
    border: none;
    font-weight: 700;
    transition: all 0.3s ease;
    display: inline-block;
}

#play-again-btn:hover {
    transform: scale(1.05);
    background: linear-gradient(45deg, var(--theme-accent) 0%, var(--theme-primary) 100%);
}

/* Theme-based styling for all text elements */
#result-screen .title {
    color: var(--theme-title);
}

#result-screen .subtitle {
    color: var(--theme-secondary);
}

/* Style time display */
#time-taken {
    color: var(--theme-primary);
    font-weight: bold;
    background: var(--theme-info);
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    display: inline-block;
}

/* Progress bar effect for tags */
.tag {
    transition: all 0.3s ease;
}

.tag:hover {
    transform: scale(1.05);
}

/* Add theme indicator */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 5px;
    background: var(--theme-secondary);
    z-index: 9999;
}

/* Style feedback notification text */
.notification {
    font-weight: bold;
}

/* Mobile text abbreviation */
@media (max-width: 768px) {
    #play-again-btn {
        font-size: 1.1rem;
        padding: 0.75rem 2rem;
        width: auto;
        min-width: 150px;
    }
    .question-label::after {
        content: 'Q:';
    }
    
    .question-label {
        font-size: 0;
    }
    
    .question-label::after {
        font-size: 0.9rem;
    }
    .animals-grid {
        grid-template-columns: repeat(auto-fit, minmax(50px, 1fr));
        gap: 0.4rem;
        padding: 0.75rem;
        min-height: 150px;
    }
    
    .animal-item {
        padding: 0.25rem;
    }
    
    .animal-image {
        width: 40px;
        height: 40px;
    }
    
    .choice-button {
        min-width: 70px;
        height: 50px;
        font-size: 1.3rem;
        padding: 0 1rem;
    }
    
    .choices-grid {
        gap: 0.75rem;
    }
    
    .box.game-container {
        padding: 1rem;
    }
    
    .box.game-container .title {
        font-size: 1.1rem;
        margin-bottom: 1rem;
    }
    
    #question-text {
        font-size: 1.2rem;
    }
    
    .question-container {
        padding: 1rem;
        margin-bottom: 1.5rem;
    }
    
    .tag {
        font-size: 0.9rem;
        padding: 0.5rem 1rem;
    }
    
    .progress-info {
        margin-bottom: 1.5rem;
    }
    
    .feedback-message {
        font-size: 1rem;
        padding: 0.75rem;
    }
    
    #next-btn {
        font-size: 1rem;
        padding: 0.5rem 1.5rem;
    }
}

/* Extra small screens and iPhone 4 */
@media (max-width: 480px) {
    #play-again-btn {
        font-size: 1rem;
        padding: 0.6rem 1.5rem;
        min-width: 120px;
    }
    .animals-grid {
        grid-template-columns: repeat(auto-fit, minmax(45px, 1fr));
        gap: 0.3rem;
        padding: 0.5rem;
    }
    
    .animal-image {
        width: 35px;
        height: 35px;
    }
    
    .box.game-container .title {
        font-size: 1rem;
    }
    
    #question-text {
        font-size: 1.1rem;
    }
    
    .tag {
        font-size: 0.85rem;
        padding: 0.4rem 0.8rem;
    }
    
    #final-score {
        font-size: 2.5rem;
    }
    
    .choice-button {
        min-width: 60px;
        height: 45px;
        font-size: 1.2rem;
        border-radius: 12px;
        padding: 0 0.75rem;
    }
    
    .choices-grid {
        gap: 0.5rem;
    }
}

/* iPhone 4 and very small screens */
@media (max-width: 320px) {
    .choice-button {
        min-width: 50px;
        height: 40px;
        font-size: 1.1rem;
        padding: 0 0.5rem;
    }
    
    .choices-grid {
        gap: 0.4rem;
        padding: 0 0.25rem;
    }
    
    .choices-section {
        padding: 0 0.5rem;
    }
}