/* styles.css */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Arial', sans-serif;
    -webkit-tap-highlight-color: transparent;
}

body, html {
    width: 100%;
    height: 100%;
    overflow: hidden;
    position: relative;
    background-color: #0099FF; /* Brighter blue */
    touch-action: manipulation;
}

#game-container {
    position: absolute;
    width: 100%;
    height: 100%;
    overflow: hidden;
}

/* Game title and score */
#game-header {
    position: absolute;
    top: 20px;
    left: 0;
    width: 100%;
    z-index: 5;
    text-align: center;
}

#game-title {
    color: white; /* White text during gameplay */
    font-size: 50px;
    font-weight: bold;
}

/* Steps container - using a different animation approach */
#steps-container {
    position: absolute;
    top: 100px;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 2; /* Above clouds */
}

/* Individual step styling - updated with narrower width */
.step {
    position: absolute;
    width: 260px; /* Reduced from 320px to 260px */
    height: 440px; /* Reduced from 495px to maintain proportion */
    border-radius: 26px; /* Slightly adjusted for the smaller size */
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    padding-top: 25px; /* Slightly reduced padding */
    text-align: center;
    color: white;
    box-shadow: 0 5px 15px rgba(0,0,0,0.2);
    border: 3px solid white; /* Slightly thinner border */
    transition: all 1s cubic-bezier(0.22, 1, 0.36, 1);
    pointer-events: auto;
    opacity: 1 !important; /* Ensure all steps are fully opaque */
}

.step.active {
    /* Keep any special styling for active step, but don't change opacity */
}

.step-number {
    font-size: 22px; /* Slightly smaller font */
    text-align: center;
    margin-bottom: 4px;
}

.step-category {
    font-size: 36px; /* Slightly smaller font */
    font-weight: bold;
    text-align: center;
    margin-bottom: 8px;
}

.step-difficulty {
    font-size: 16px; /* Slightly smaller font */
    text-align: center;
}

/* Question overlay */
#question-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.1);
    z-index: 10;
    display: flex;
    flex-direction: column;
    justify-content: top;
    align-items: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.5s ease;
	margin-top:20px;
}

#question-overlay.active {
    opacity: 1;
    pointer-events: all;
}

#question-container {
    width: 90%;
    background-color: white;
    border-radius: 20px;
    padding: 30px 20px;
    max-height: 80%;
    overflow-y: auto;
    position: relative; /* For timer positioning */
}

#question-text {
    font-size: 20px;
    text-align: center;
    margin-bottom: 30px;
    color: #333;
}

.answer-btn {
    display: block;
    width: 100%;
    padding: 12px;
    margin: 10px 0;
    background-color: #f8f8f8;
    border: 2px solid #ddd;
    border-radius: 10px;
    font-size: 17px;
    text-align: left;
    transition: all 0.2s;
}

.answer-btn:active {
    transform: scale(0.98);
}

/* Timer bar */
#timer-container {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 10px;
    background-color: #eee;
    border-radius: 0 0 20px 20px;
    overflow: hidden;
}

#timer-bar {
    height: 100%;
    width: 100%;
    background-color: #4CAF50; /* Green */
    transition: width linear;
}

/* Cloud-specific styles with guaranteed animation */
.cloud {
    position: absolute;
    background: white;
    border-radius: 100px;
    box-shadow: 0 8px 15px rgba(0, 0, 0, 0.1);
    opacity: 0.9;
    z-index: 1;
    will-change: transform; /* Optimize for animation performance */
    animation-name: moveCloud;
    animation-timing-function: linear;
    animation-iteration-count: infinite;
    animation-fill-mode: both; /* Ensure animation applies at start and end */
}

/* Cloud pseudo-elements to create a more cloud-like shape */
.cloud:before, .cloud:after {
    content: '';
    position: absolute;
    background: white;
    border-radius: 50%;
}

.cloud:before {
    width: 50%;
    height: 80%;
    top: -35%;
    left: 20%;
}

.cloud:after {
    width: 60%;
    height: 100%;
    top: -40%;
    right: 20%;
}

/* Clear animation keyframes */
@keyframes moveCloud {
    0% {
        transform: translateX(-150px);
    }
    100% {
        transform: translateX(calc(100vw + 150px));
    }
}

/* Score display */
#score-display {
    position: absolute;
    top: 90px;
    width: 100%;
    text-align: center;
    color: white;
    font-size: 40px;
    z-index: 5;
}

/* Game over panel */
#game-over-panel {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 80%;
    background-color: white;
    padding: 30px;
    border-radius: 20px;
    text-align: center;
    z-index: 20;
    display: none;
}

#game-over-title {
    font-size: 32px;
    margin-bottom: 20px;
}

#final-score {
    font-size: 24px;
    margin-bottom: 30px;
}

#retry-btn {
    background-color: #0099FF; /* Match the new background color */
    color: white;
    padding: 15px 30px;
    border: none;
    border-radius: 10px;
    font-size: 20px;
    cursor: pointer;
}

/* Loading and start screens */
.full-screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    background-color: #0099FF; /* Match the new background color */
    z-index: 30;
}

/* Start screen with background image */
#start-screen {
    background-image: url('images/background.png');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    position: relative;
}

#loading-screen {
    display: none;
}

.spinner {
    width: 60px;
    height: 60px;
    border: 8px solid rgba(255,255,255,0.3);
    border-radius: 50%;
    border-top-color: white;
    animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Updated start button with wobble animation */
#start-btn {
    background-color: #3ABAFF; /* Light blue */
    color: white;
    padding: 20px 60px;
    border: none;
    border-radius: 15px;
    font-size: 25px;
    font-weight: bold;
    cursor: pointer;
    box-shadow: 0 5px 15px rgba(0,0,0,0.3);
    position: absolute;
    bottom: 10%;
    transform: translateY(-50%);
    animation: wobble 2s ease-in-out infinite;
}

/* Wobble animation for button */
@keyframes wobble {
    0%, 100% {
        transform: translateY(-50%) scale(1) rotate(0);
    }
    25% {
        transform: translateY(-50%) scale(1.05) rotate(-2deg);
    }
    50% {
        transform: translateY(-50%) scale(1) rotate(0);
    }
    75% {
        transform: translateY(-50%) scale(1.05) rotate(2deg);
    }
}

/* New Highscore Container Styles */
#highscore-container {
    position: absolute;
    bottom: 10px;
    left: 0;
    width: 100%;
    overflow: hidden;
    z-index: 31; /* Above other elements */
    background: rgba(0,0,0,0.3);
    padding: 5px 0;
}

#highscore-header {
    font-size: 3vh;
    color: white;
    text-shadow: 2px 2px 2px black;
    text-align: center;
    padding: 3px 0;
}

#highscore-scroller {
    white-space: nowrap;
    font-size: 2.5vh;
    color: white;
    text-shadow: 2px 2px 2px black;
    animation: scrollHighscores linear infinite;
    padding: 3px 0;
}

/* Default keyframes, will be updated dynamically */
@keyframes scrollHighscores {
    0% {
        transform: translateX(100%);
    }
    100% {
        transform: translateX(-100%);
    }
}

.score-badge {
    background-color: green; 
    color: white; 
    padding: 2px 8px; 
    border-radius: 10px;
    display: inline-block;
}

/* Sponsor overlay styling - positioned offscreen initially but always in DOM */
#sponsorOverlay {
    position: absolute;
    top: 100%;  /* Start positioned below the viewport */
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.85);
    z-index: 100;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    color: white;
    padding: 20px;
    transition: transform 0.5s ease;
    transform: translateY(0); /* initially offscreen below */
}

/* When visible, move the overlay into view */
#sponsorOverlay.visible {
    transform: translateY(-100%);
}

#sponsorOverlay h1 {
    font-size: 6vh;
    margin-bottom: 2vh;
}

#sponsorBanner {
    margin-bottom: 3vh;
}

#closeSponsorButton {
    font-size: 3vh;
    padding: 1vh 2vh;
    border: none;
    border-radius: 1vh;
    background: gray;
    color: white;
    cursor: not-allowed;
}

#closeSponsorButton.enabled {
    background: #ff9800;
    cursor: pointer;
}

/* Responsive layout for desktop */
@media screen and (min-width: 768px) {
    body, html {
        background-color: #000; /* Black background */
    }
    
    /* Create a fixed-size container to hold the game */
    body:before {
        content: "";
        position: fixed;
        top: 50%;
        left: 50%;
        transform: translate(-50%, -50%);
        width: 414px; /* Standard mobile width */
        height: 896px; /* Standard mobile height */
        background-color: #0099FF;
        z-index: 0;
        box-shadow: 0 0 20px rgba(0, 0, 0, 0.5);
    }
    
    #game-container {
        position: fixed;
        top: 50%;
        left: 50%;
        transform: translate(-50%, -50%);
        width: 414px;
        height: 896px;
        overflow: hidden;
    }
    
    .full-screen {
        position: fixed;
        top: 50%;
        left: 50%;
        transform: translate(-50%, -50%);
        width: 414px;
        height: 896px;
    }
    
    #highscore-container {
        position: fixed;
        bottom: calc(50% - 448px); /* Half of screen height - half of game height + 10px */
        left: 50%;
        transform: translateX(-50%);
        width: 414px;
    }
    
    /* Sponsor overlay for desktop */
    #sponsorOverlay {
        left: 50%;
        width: 414px;
        transform: translateX(-50%);
    }
    
    #sponsorOverlay.visible {
        transform: translate(-50%, -100%);
    }
    
    /* Cloud animation for desktop */
    @keyframes moveCloud {
        0% {
            transform: translateX(-150px);
        }
        100% {
            transform: translateX(564px); /* 414px container width + 150px */
        }
    }
}