/* ==================== RESET & BASE ==================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

html, body {
    width: 100%;
    height: 100%;
    overflow: hidden;
    font-family: 'Segoe UI', 'Comic Sans MS', sans-serif;
    touch-action: manipulation;
}

body {
    display: flex;
    justify-content: center;
    align-items: center;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
}

/* ==================== GAME CONTAINER ==================== */
#game-container {
    position: relative;
    width: 100%;
    height: 100%;
    max-width: 500px;
    max-height: 900px;
    overflow: hidden;
    background-size: cover;
    background-position: center;
}

/* Wide screens (16:9 landscape) - allow full width */
@media (min-aspect-ratio: 4/3) {
    #game-container {
        max-width: 100%;
        max-height: 100%;
    }
}

/* ==================== SCREENS ==================== */
.screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 20px;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.screen.active {
    display: flex;
    opacity: 1;
}

/* ==================== BUTTONS ==================== */
.btn {
    padding: 18px 50px;
    font-size: 24px;
    font-weight: bold;
    border: none;
    border-radius: 50px;
    cursor: pointer;
    transition: all 0.2s;
    text-transform: uppercase;
    letter-spacing: 2px;
}

.btn:active { transform: scale(0.95); }

.btn-primary, .btn-play {
    background: linear-gradient(180deg, #4ade80 0%, #22c55e 100%);
    color: white;
    box-shadow: 0 6px 0 #16a34a, 0 10px 20px rgba(0,0,0,0.3);
    padding: 18px 50px;
    font-size: 24px;
    font-weight: bold;
    border: none;
    border-radius: 50px;
    cursor: pointer;
    transition: all 0.2s;
    text-transform: uppercase;
    letter-spacing: 2px;
}

.btn-primary:active, .btn-play:active {
    box-shadow: 0 2px 0 #16a34a;
    transform: translateY(4px);
}

.btn-secondary {
    background: linear-gradient(180deg, #60a5fa 0%, #3b82f6 100%);
    color: white;
    box-shadow: 0 6px 0 #2563eb, 0 10px 20px rgba(0,0,0,0.3);
    font-size: 18px;
    padding: 14px 35px;
}

.btn-reward, .btn-rewarded {
    background: linear-gradient(180deg, #fbbf24 0%, #f59e0b 100%);
    color: #1e293b;
    box-shadow: 0 6px 0 #d97706, 0 10px 20px rgba(0,0,0,0.3);
    font-size: 16px;
    padding: 14px 25px;
    font-weight: bold;
    border: none;
    border-radius: 50px;
    cursor: pointer;
    transition: all 0.2s;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 15px;
}

.btn-rewarded:active {
    box-shadow: 0 2px 0 #d97706;
    transform: translateY(4px);
}

.btn-purchase {
    background: linear-gradient(180deg, #a855f7 0%, #9333ea 100%);
    color: white;
    box-shadow: 0 6px 0 #7e22ce, 0 10px 20px rgba(0,0,0,0.3);
    font-size: 16px;
    padding: 12px 25px;
    font-weight: bold;
    border: none;
    border-radius: 50px;
    cursor: pointer;
    transition: all 0.2s;
    letter-spacing: 1px;
}

.btn-purchase:active {
    box-shadow: 0 2px 0 #7e22ce;
    transform: translateY(4px);
}

/* ==================== SOUND BUTTON ==================== */
#sound-toggle {
    position: absolute;
    top: 15px;
    right: 15px;
    width: 50px;
    height: 50px;
    border: none;
    background: rgba(255,255,255,0.2);
    border-radius: 50%;
    cursor: pointer;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(5px);
    transition: transform 0.2s;
}

#sound-toggle:active { transform: scale(0.9); }
#sound-toggle img { width: 30px; height: 30px; object-fit: contain; }

/* ==================== LOADING ==================== */
#loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    transition: opacity 0.5s;
}

#loading-overlay.hidden { opacity: 0; pointer-events: none; }

.loading-spinner {
    width: 60px;
    height: 60px;
    border: 5px solid rgba(255,255,255,0.2);
    border-top-color: #4ade80;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }
.loading-text { color: #fff; font-size: 24px; margin-top: 20px; }

/* ==================== BRANDING ==================== */
.branding {
    margin-top: 30px;
    font-size: 16px;
    color: rgba(255, 255, 255, 0.9);
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
    letter-spacing: 1px;
}

.branding strong {
    color: #fbbf24;
    font-size: 18px;
}

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

@keyframes mascotFloat {
    0%, 100% { transform: translateY(0) rotate(-2deg); }
    50% { transform: translateY(-15px) rotate(2deg); }
}

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

@keyframes correctAnswer {
    0% { transform: scale(1); }
    30% { transform: scale(1.3); box-shadow: 0 0 30px #4ade80; }
    100% { transform: scale(1); }
}

@keyframes wrongAnswer {
    0%, 100% { transform: translateX(0); }
    20%, 60% { transform: translateX(-10px); }
    40%, 80% { transform: translateX(10px); }
}

@keyframes timerPulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

@keyframes flyStar {
    0% { transform: scale(1); opacity: 1; }
    100% { transform: scale(0.5) translateY(-200px); opacity: 0; }
}

@keyframes resultsPopIn {
    0% { transform: scale(0.5); opacity: 0; }
    100% { transform: scale(1); opacity: 1; }
}

@keyframes starEarned {
    0% { transform: scale(0) rotate(-180deg); }
    100% { transform: scale(1) rotate(0); }
}

/* ==================== RESPONSIVE ==================== */
@media (max-height: 700px) {
    .game-title { font-size: 36px; }
    .mascot-menu { width: 140px; height: 140px; }
    .question-text { font-size: 36px; }
    .answer-btn { font-size: 28px; }
    .timer-container { width: 60px; height: 60px; }
    .timer-text { font-size: 22px; }
}

@media (max-width: 360px) {
    .game-title { font-size: 32px; }
    .btn { padding: 14px 35px; font-size: 20px; }
    .question-text { font-size: 32px; }
    .answer-btn { font-size: 24px; }
}
