/* Global Styles */
:root {
    --primary-color: #4CAF50;
    --secondary-color: #2E7D32;
    --background-color: #000814;
    --text-color: #ffffff;
    --menu-bg: rgba(0, 0, 0, 0.85);
    --boost-color: #FF5722;
    --star-color: #FFD700;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Arial', sans-serif;
    background-color: var(--background-color);
    background-image: url('../images/s/bg54.jpg');
    background-size: cover;
    background-position: center;
    background-attachment: fixed;
    color: var(--text-color);
    overflow: hidden;
    line-height: 1.6;
}

/* Canvas */
#gameCanvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
}

/* UI Screens */
.screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    background: var(--menu-bg);
    z-index: 2;
    padding: 20px;
    backdrop-filter: blur(5px);
}

.hidden {
    display: none;
}

/* Typography */
h1 {
    font-size: 3.5rem;
    margin-bottom: 2rem;
    text-align: center;
    color: var(--primary-color);
    text-shadow: 0 0 20px rgba(76, 175, 80, 0.5);
    animation: glow 2s ease-in-out infinite alternate;
}

@keyframes glow {
    from {
        text-shadow: 0 0 20px rgba(76, 175, 80, 0.5);
    }
    to {
        text-shadow: 0 0 30px rgba(76, 175, 80, 0.8);
    }
}

h2 {
    font-size: 2.5rem;
    margin-bottom: 1.5rem;
    color: var(--secondary-color);
    text-shadow: 0 0 10px rgba(46, 125, 50, 0.5);
}

/* Buttons */
.menu {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    width: 100%;
    max-width: 300px;
}

.btn-primary, .btn-secondary {
    padding: 15px 30px;
    border: none;
    border-radius: 8px;
    font-size: 1.2rem;
    cursor: pointer;
    transition: all 0.3s ease;
    width: 100%;
    text-transform: uppercase;
    letter-spacing: 1px;
    position: relative;
    overflow: hidden;
}

.btn-primary {
    background: var(--primary-color);
    color: var(--background-color);
    box-shadow: 0 0 15px rgba(76, 175, 80, 0.3);
}

.btn-secondary {
    background: transparent;
    border: 2px solid var(--secondary-color);
    color: var(--secondary-color);
}

.btn-primary:hover {
    transform: scale(1.05);
    box-shadow: 0 0 25px rgba(76, 175, 80, 0.5);
}

.btn-secondary:hover {
    background: rgba(46, 125, 50, 0.1);
    box-shadow: 0 0 20px rgba(46, 125, 50, 0.4);
}

/* Button Effects */
.btn-primary::after, .btn-secondary::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 5px;
    height: 5px;
    background: rgba(255, 255, 255, 0.5);
    opacity: 0;
    border-radius: 100%;
    transform: scale(1, 1) translate(-50%);
    transform-origin: 50% 50%;
}

.btn-primary:focus::after, .btn-secondary:focus::after {
    animation: ripple 1s ease-out;
}

@keyframes ripple {
    0% {
        transform: scale(0, 0);
        opacity: 0.5;
    }
    100% {
        transform: scale(20, 20);
        opacity: 0;
    }
}

/* Game Stats */
.game-stats {
    position: fixed;
    top: 20px;
    left: 20px;
    z-index: 2;
    display: flex;
    flex-direction: column;
    gap: 10px;
    font-size: 1.2rem;
    text-shadow: 0 0 10px rgba(255, 255, 255, 0.5);
}

/* Boost Indicator */
.boost-indicator {
    color: var(--boost-color);
    font-weight: bold;
    text-transform: uppercase;
    animation: pulse 1s ease-in-out infinite;
}

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

/* Power-up Indicators */
.powerup-indicators {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 10px;
}

.powerup-indicator {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(0, 0, 0, 0.7);
    padding: 8px 12px;
    border-radius: 20px;
    border: 2px solid;
    animation: powerupGlow 2s ease-in-out infinite alternate;
}

.powerup-indicator:nth-child(1) {
    border-color: #FF1493;
    color: #FF1493;
}

.powerup-indicator:nth-child(2) {
    border-color: #9400D3;
    color: #9400D3;
}

.powerup-icon {
    font-size: 1.2rem;
}

.powerup-timer {
    width: 40px;
    height: 4px;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 2px;
    overflow: hidden;
    position: relative;
}

.powerup-timer::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    background: currentColor;
    border-radius: 2px;
    animation: timerCountdown var(--duration) linear forwards;
}

@keyframes powerupGlow {
    from {
        box-shadow: 0 0 10px currentColor;
    }
    to {
        box-shadow: 0 0 20px currentColor;
    }
}

@keyframes timerCountdown {
    from {
        width: 100%;
    }
    to {
        width: 0%;
    }
}

/* Game Over Screen */
#gameOverScreen {
    text-align: center;
}

#finalScore {
    font-size: 4rem;
    color: var(--star-color);
    margin: 1rem 0;
    text-shadow: 0 0 20px rgba(255, 215, 0, 0.5);
}

/* Leaderboard */
#leaderboardList {
    background: rgba(0, 0, 0, 0.5);
    padding: 20px;
    border-radius: 10px;
    width: 100%;
    max-width: 400px;
    margin-bottom: 20px;
}

.leaderboard-entry {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    font-size: 1.1rem;
}

.leaderboard-entry:last-child {
    border-bottom: none;
}

.rank {
    color: var(--star-color);
    font-weight: bold;
    width: 30px;
}

.name {
    flex: 1;
    text-align: left;
    margin-left: 15px;
}

.score {
    color: var(--primary-color);
    font-weight: bold;
}

/* Skins Grid */
.skins-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 20px;
    width: 100%;
    max-width: 600px;
    margin-bottom: 20px;
    padding: 20px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 10px;
}

.skin-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 15px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    border: 2px solid transparent;
    position: relative;
    overflow: hidden;
    background: rgba(255, 255, 255, 0.05);
}

.skin-item:hover {
    transform: scale(1.05);
    border-color: var(--primary-color);
    box-shadow: 0 0 15px rgba(76, 175, 80, 0.3);
}

.skin-item.selected {
    border-color: var(--star-color);
    box-shadow: 0 0 20px rgba(255, 215, 0, 0.5);
}

.skin-preview {
    border-radius: 50%;
    margin-bottom: 10px;
}

.skin-name {
    font-size: 0.9rem;
    color: var(--text-color);
    text-align: center;
}

/* Instructions */
.instructions {
    background: rgba(255, 255, 255, 0.1);
    padding: 30px;
    border-radius: 15px;
    margin-bottom: 30px;
    max-width: 500px;
}

.instructions p {
    margin: 15px 0;
    font-size: 1.1rem;
    display: flex;
    align-items: center;
    gap: 10px;
}

/* Score Popup */
.score-popup {
    position: absolute;
    font-size: 1.2rem;
    font-weight: bold;
    pointer-events: none;
    z-index: 3;
    text-shadow: 0 0 10px currentColor;
    animation: scorePopup 1s ease-out forwards;
}

@keyframes scorePopup {
    0% {
        transform: translateY(0) scale(1);
        opacity: 1;
    }
    100% {
        transform: translateY(-50px) scale(1.5);
        opacity: 0;
    }
}

/* Mobile Responsiveness */
@media (max-width: 768px) {
    h1 {
        font-size: 2.5rem;
    }

    h2 {
        font-size: 2rem;
    }

    .btn-primary, .btn-secondary {
        padding: 12px 24px;
        font-size: 1rem;
    }

    .game-stats {
        font-size: 1rem;
    }

    #finalScore {
        font-size: 3rem;
    }
}

/* Nickname Input */
.nickname-input {
    margin-bottom: 2rem;
    width: 100%;
    max-width: 300px;
}

.nickname-input input {
    width: 100%;
    padding: 15px 20px;
    border: 2px solid var(--secondary-color);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-color);
    font-size: 1.1rem;
    text-align: center;
    outline: none;
    transition: all 0.3s ease;
}

.nickname-input input:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 15px rgba(76, 175, 80, 0.3);
}

.nickname-input input::placeholder {
    color: rgba(255, 255, 255, 0.6);
}

/* Death Message */
.death-message {
    font-size: 1.2rem;
    color: var(--boost-color);
    margin-bottom: 1rem;
    text-align: center;
    font-weight: bold;
}

/* Server Stats */
.server-stats {
    background: rgba(255, 255, 255, 0.05);
    padding: 15px;
    border-radius: 8px;
    margin-top: 20px;
    text-align: center;
}

.server-stats h3 {
    color: var(--primary-color);
    margin-bottom: 10px;
    font-size: 1.2rem;
}

.server-stats p {
    margin: 5px 0;
    font-size: 0.9rem;
    color: rgba(255, 255, 255, 0.8);
}

/* Touch Controls Hint */
.touch-hint {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(255, 255, 255, 0.1);
    padding: 10px 20px;
    border-radius: 20px;
    font-size: 0.9rem;
    opacity: 0.7;
    pointer-events: none;
    z-index: 2;
}

@media (min-width: 769px) {
    .touch-hint {
        display: none;
    }
}

/* Multiplayer Enhancements */
.player-info {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 2;
    background: rgba(0, 0, 0, 0.7);
    padding: 10px 15px;
    border-radius: 8px;
    color: var(--text-color);
    font-size: 0.9rem;
}

.connection-status {
    position: fixed;
    top: 60px;
    right: 20px;
    z-index: 2;
    padding: 5px 10px;
    border-radius: 5px;
    font-size: 0.8rem;
    font-weight: bold;
}

.connection-status.connected {
    background: rgba(76, 175, 80, 0.8);
    color: white;
}

.connection-status.disconnected {
    background: rgba(244, 67, 54, 0.8);
    color: white;
}

.connection-status.connecting {
    background: rgba(255, 193, 7, 0.8);
    color: black;
}
