/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Orbitron', monospace;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    overflow: hidden;
    height: 100vh;
    touch-action: manipulation;
}

/* Screen Management */
.screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: none;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.screen.active {
    display: flex;
}

/* Container Styles */
.container {
    text-align: center;
    max-width: 90%;
    padding: 20px;
}

/* Title Styles */
.title {
    font-size: clamp(2rem, 8vw, 4rem);
    font-weight: 900;
    margin-bottom: 2rem;
    text-shadow: 0 0 20px rgba(255, 255, 255, 0.5);
    background: linear-gradient(45deg, #fff, #ffd700);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Username Section */
.username-section {
    margin: 2rem 0;
}

.username-section label {
    display: block;
    margin-bottom: 0.5rem;
    font-size: 1.2rem;
    font-weight: 700;
}

.username-section input {
    width: 100%;
    max-width: 300px;
    padding: 12px 16px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.1);
    color: white;
    font-size: 1rem;
    font-family: inherit;
    backdrop-filter: blur(10px);
    transition: all 0.3s ease;
}

.username-section input:focus {
    outline: none;
    border-color: #ffd700;
    background: rgba(255, 255, 255, 0.2);
    box-shadow: 0 0 20px rgba(255, 215, 0, 0.3);
}

.username-section input::placeholder {
    color: rgba(255, 255, 255, 0.6);
}

.error-message {
    color: #ff6b6b;
    margin-top: 0.5rem;
    font-size: 0.9rem;
    min-height: 1.2rem;
}

/* Button Styles */
.btn {
    padding: 15px 30px;
    margin: 10px;
    border: none;
    border-radius: 8px;
    font-size: 1.1rem;
    font-weight: 700;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 1px;
    min-width: 200px;
}

.btn-primary {
    background: linear-gradient(45deg, #ffd700, #ffed4e);
    color: #333;
    box-shadow: 0 4px 15px rgba(255, 215, 0, 0.3);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(255, 215, 0, 0.4);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.1);
    color: white;
    border: 2px solid rgba(255, 255, 255, 0.3);
    backdrop-filter: blur(10px);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.5);
}

.btn-danger {
    background: linear-gradient(45deg, #ff6b6b, #ee5a52);
    color: white;
    box-shadow: 0 4px 15px rgba(255, 107, 107, 0.3);
}

.btn-danger:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(255, 107, 107, 0.4);
    background: linear-gradient(45deg, #ff5252, #d32f2f);
}

/* Skip Button - Modern Animated Style */
.skip-button {
    position: relative;
    background: linear-gradient(45deg, #ff6b6b, #ffa726);
    color: white;
    border: none;
    border-radius: 50px;
    padding: 12px 24px;
    font-family: 'Orbitron', monospace;
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    overflow: hidden;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 15px rgba(255, 107, 107, 0.4);
    text-transform: uppercase;
    letter-spacing: 1px;
    backdrop-filter: blur(10px);
    border: 2px solid rgba(255, 255, 255, 0.2);
}

.skip-button::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    transition: left 0.6s;
}

.skip-button:hover {
    transform: translateY(-3px) scale(1.05);
    box-shadow: 0 8px 25px rgba(255, 107, 107, 0.6);
    background: linear-gradient(45deg, #ff5252, #ff9800);
    border-color: rgba(255, 255, 255, 0.4);
}

.skip-button:hover::before {
    left: 100%;
}

.skip-button:active {
    transform: translateY(-1px) scale(1.02);
    transition: all 0.1s ease;
}

/* Pulse animation for skip button */
@keyframes pulse-skip {
    0% {
        box-shadow: 0 4px 15px rgba(255, 107, 107, 0.4);
    }
    50% {
        box-shadow: 0 4px 25px rgba(255, 107, 107, 0.8);
    }
    100% {
        box-shadow: 0 4px 15px rgba(255, 107, 107, 0.4);
    }
}

.skip-button.pulse {
    animation: pulse-skip 2s infinite;
}

/* Skip button icon animation */
.skip-button .skip-icon {
    display: inline-block;
    margin-left: 6px;
    transition: transform 0.3s ease;
}

.skip-button:hover .skip-icon {
    transform: translateX(3px);
}

/* Instructions */
.instructions {
    margin: 2rem 0;
    padding: 20px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.instructions p {
    margin: 8px 0;
    font-size: 0.9rem;
    opacity: 0.9;
}

/* Game Screen Styles */
#gameScreen {
    flex-direction: column;
    padding: 0;
}

.game-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    display: flex;
    justify-content: space-between;
    padding: 15px 20px;
    background: rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(10px);
    z-index: 20;
}

.game-header .score,
.game-header .distance {
    font-size: 1.1rem;
    font-weight: 700;
    text-shadow: 0 0 10px rgba(255, 255, 255, 0.5);
}

#gameCanvas {
    width: 100vw;
    height: 100vh;
    background: linear-gradient(to bottom, #87CEEB 0%, #98FB98 100%);
    display: block;
    position: absolute;
    top: 0;
    left: 0;
}



/* Game Over Screen */
#gameOverScreen h2 {
    font-size: clamp(2rem, 6vw, 3rem);
    margin-bottom: 2rem;
    color: #ff6b6b;
}

.final-score {
    margin: 2rem 0;
    padding: 20px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    backdrop-filter: blur(10px);
}

.final-score p {
    margin: 10px 0;
    font-size: 1.2rem;
    font-weight: 700;
}

.leaderboard-section {
    margin: 2rem 0;
}

.leaderboard-section h3 {
    margin-bottom: 1rem;
    color: #ffd700;
}

.leaderboard {
    max-height: 300px;
    overflow-y: auto;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 15px;
    backdrop-filter: blur(10px);
}

.leaderboard-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 15px;
    margin: 5px 0;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    border-left: 4px solid #ffd700;
}

.leaderboard-item.current-player {
    background: rgba(255, 215, 0, 0.2);
    border-left-color: #fff;
}

.leaderboard-item .rank {
    font-weight: 700;
    color: #ffd700;
    min-width: 40px;
    text-align: center;
}

.leaderboard-item .username {
    flex: 1;
    text-align: left;
    margin-left: 20px;
    margin-right: 20px;
}

.leaderboard-item .score {
    font-weight: 700;
    color: #fff;
    min-width: 60px;
    text-align: right;
}

.game-over-buttons {
    margin-top: 2rem;
}

/* Loading Screen */
#loadingScreen .spinner {
    width: 50px;
    height: 50px;
    border: 4px solid rgba(255, 255, 255, 0.3);
    border-top: 4px solid #ffd700;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Responsive Design */
@media (max-width: 768px) {
    .container {
        max-width: 95%;
        padding: 15px;
    }
    
    .btn {
        min-width: 180px;
        padding: 12px 24px;
        font-size: 1rem;
    }
    
    .game-header {
        padding: 10px 15px;
    }
    
    .game-header .score,
    .game-header .distance {
        font-size: 1rem;
    }
}

@media (max-width: 480px) {
    .title {
        font-size: clamp(1.5rem, 6vw, 2.5rem);
    }
    
    .btn {
        min-width: 160px;
        padding: 10px 20px;
        font-size: 0.9rem;
    }
}

/* Scrollbar Styling */
.leaderboard::-webkit-scrollbar {
    width: 6px;
}

.leaderboard::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
}

.leaderboard::-webkit-scrollbar-thumb {
    background: rgba(255, 215, 0, 0.5);
    border-radius: 3px;
}

.leaderboard::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 215, 0, 0.7);
}
