/* Theme variables */
:root {
    --primary-color: #4CAF50;
    --secondary-color: #2196F3;
    --font-family: 'Poppins', Arial, sans-serif;
}

/* Base styles */
body {
    background-color: #ffffff;
    font-family: var(--font-family);
    margin: 0;
    padding: 0;
    text-align: center;
    color: #333333;
    min-height: 100vh;
    overflow-y: auto; /* Enable scrolling */
    box-sizing: border-box;
}

/* Fixed header and footer bars */
.top-bar,
.bottom-bar {
    position: fixed;
    left: 0;
    right: 0;
    background-color: var(--primary-color);
    z-index: 99;
}

.top-bar {
    top: 0;
    height: 160px; /* Bar logo + spacing */
}

.bottom-bar {
    bottom: 0;
    height: 60px; /* Game logo + spacing */
}

/* Logo positioning */
.bar-logo {
    position: fixed;
    top: 10px;
    left: 50%;
    transform: translateX(-50%);
    height: 120px;
    width: auto;
    z-index: 100;
}

.game-logo {
    position: fixed;
    bottom: 10px;
    left: 50%;
    transform: translateX(-50%);
    height: 30px;
    width: auto;
    z-index: 100;
}

/* Content container - holds all screens */
.content-container {
    padding-top: 160px; /* Space for top logo */
    padding-bottom: 60px; /* Space for bottom logo */
    min-height: 100vh;
    box-sizing: border-box;
    position: relative;
    z-index: 1;
}

/* Screen layouts */
.screen {
    display: none; /* Hidden by default */
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    width: 100%;
    padding: 20px;
    box-sizing: border-box;
}

.screen.active {
    display: flex; /* Show active screen */
}

/* Welcome screen and redeem screen are visible by default */
#welcome-screen,
#redeem-screen {
    display: flex;
}

/* Container styling */
.welcome-container, 
.game-container, 
.win-container, 
.lose-container, 
.redeem-container {
    width: 100%;
    max-width: 90%;
    margin: 0 auto;
}

/* Typography */
h1 {
    font-size: 2.5em;
    font-weight: 600;
    margin-bottom: 10px;
    color: #333333;
}

h2 {
    font-size: 1.8em;
    font-weight: 600;
    margin-bottom: 20px;
    color: #333333;
}

.subheading {
    font-size: 1.2em;
    font-weight: 400;
    margin-bottom: 30px;
    color: #666666;
}

/* Buttons */
button {
    background-color: var(--primary-color);
    color: white;
    border: none;
    padding: 15px 32px;
    font-size: 1.2em;
    font-weight: 600;
    border-radius: 8px;
    cursor: pointer;
    transition: transform 0.2s, background-color 0.3s;
}

button:hover {
    background-color: color-mix(in srgb, var(--primary-color) 90%, black);
    transform: scale(1.05);
}

button:active {
    transform: scale(0.95);
}

.answer-button {
    background-color: var(--secondary-color);
    color: white;
    border: none;
    padding: 15px 20px;
    font-size: 1.2em;
    font-weight: 600;
    border-radius: 8px;
    cursor: pointer;
    margin: 10px 0;
    width: 100%; /* Full width for mobile */
    transition: transform 0.2s, background-color 0.3s;
}

.answer-button:hover {
    background-color: color-mix(in srgb, var(--secondary-color) 90%, black);
    transform: scale(1.05);
}

.answer-button:active {
    transform: scale(0.95);
}

/* Answer feedback styles */
.answer-button.correct {
    background-color: #4CAF50 !important; /* Bright green */
    animation: pulse 0.5s;
}

.answer-button.incorrect {
    background-color: #F44336 !important; /* Bright red */
    animation: shake 0.5s;
}

@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    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); }
}

/* Utility classes */
.hidden {
    display: none !important;
}

/* Win Screen Styling */
.win-container {
    text-align: center;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 20px;
}

.win-container h2 {
    font-size: 2em;
    font-weight: 600;
    color: var(--primary-color);
}

.prize-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    width: 100%;
}

.score-display {
    background-color: var(--primary-color);
    color: white;
    padding: 8px 15px;
    border-radius: 15px 15px 0 0;
    font-size: 1.2em;
    font-weight: 600;
    margin-bottom: -10px;
    position: relative;
    z-index: 1;
}

.score-value {
    font-size: 1.3em;
    font-weight: 700;
}

.voucher {
    background-color: #FFC107; /* Yellow */
    color: #333333;
    font-size: 2em;
    font-weight: 700;
    padding: 30px;
    border-radius: 15px;
    width: 80%;
    display: inline-block;
    animation: fadeIn 1s ease-in-out;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

#redeem-button {
    background-color: var(--primary-color);
    color: white;
    border: none;
    padding: 15px 32px;
    font-size: 1.2em;
    font-weight: 600;
    border-radius: 8px;
    cursor: pointer;
    transition: transform 0.2s, background-color 0.3s;
}

#redeem-button:hover {
    background-color: color-mix(in srgb, var(--primary-color) 90%, black);
    transform: scale(1.05);
}

/* Lose Screen Styling */
.lose-container {
    text-align: center;
}

.lose-container h2 {
    font-size: 2em;
    font-weight: 600;
    color: #FF5722; /* Light Red */
    margin-bottom: 20px;
}

#retry-button {
    background-color: var(--secondary-color);
    color: white;
    border: none;
    padding: 15px 32px;
    font-size: 1.2em;
    font-weight: 600;
    border-radius: 8px;
    cursor: pointer;
    transition: transform 0.2s, background-color 0.3s;
}

#retry-button:hover {
    background-color: color-mix(in srgb, var(--secondary-color) 90%, black);
    transform: scale(1.05);
}

/* Redeem form styling */
.redeem-form {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin-top: 20px;
    width: 100%;
    max-width: 300px;
}

.redeem-form label {
    font-size: 1em;
    font-weight: 600;
    color: #333333;
    text-align: left;
}

.redeem-form input {
    padding: 10px;
    font-size: 1em;
    border: 2px solid #cccccc;
    border-radius: 8px;
    width: 100%;
    box-sizing: border-box;
}

.redeem-form input:focus {
    border-color: var(--primary-color);
    outline: none;
}

.redeem-form button {
    background-color: var(--primary-color);
    color: white;
    border: none;
    padding: 15px 32px;
    font-size: 1.2em;
    font-weight: 600;
    border-radius: 8px;
    cursor: pointer;
    transition: transform 0.2s, background-color 0.3s;
}

.redeem-form button:hover {
    background-color: color-mix(in srgb, var(--primary-color) 90%, black);
    transform: scale(1.05);
}

.redeem-form button:active {
    transform: scale(0.95);
}

/* Cooldown button */
#cooldown-button {
    background-color: #cccccc; /* Gray to indicate disabled state */
    color: #666666; /* Lighter text color */
    border: none;
    padding: 15px 32px;
    font-size: 1.2em;
    font-weight: 600;
    border-radius: 8px;
    cursor: not-allowed; /* Show disabled cursor */
    transition: transform 0.2s, background-color 0.3s;
}

/* Progress bar */
#quiz-progress {
    width: 100%;
    height: 20px;
    margin-bottom: 20px;
    border: none;
    border-radius: 10px;
    background-color: #e0e0e0;
}

#quiz-progress::-webkit-progress-bar {
    background-color: #e0e0e0;
    border-radius: 10px;
}

#quiz-progress::-webkit-progress-value {
    background-color: var(--primary-color);
    border-radius: 10px;
}

#quiz-progress::-moz-progress-bar {
    background-color: var(--primary-color);
    border-radius: 10px;
}

/* Fade-in animation */
@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

/* Add iOS-specific fixes */
@supports (-webkit-touch-callout: none) {
    body {
        min-height: -webkit-fill-available;
    }

    .content-container {
        min-height: -webkit-fill-available;
    }
}