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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    overflow: hidden;
    width: 100vw;
    height: 100vh;
    background: #000;
}

#gameContainer {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    position: relative;
}

#topBar {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 30px;
    background: rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(10px);
    z-index: 10;
    opacity: 0;
    transition: opacity 0.3s;
}

#topBar.visible {
    opacity: 1;
}

#stageInfo {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

#stageText {
    font-size: 24px;
    font-weight: bold;
    color: #fff;
    text-shadow: 0 0 10px rgba(255, 255, 255, 0.5);
}

#stageNumber {
    color: #00ff88;
    text-shadow: 0 0 15px #00ff88;
}

#delayText {
    font-size: 16px;
    color: #ffaa00;
    font-weight: bold;
}

#livesContainer {
    display: flex;
    gap: 10px;
    font-size: 32px;
}

.heart {
    transition: all 0.3s;
    filter: drop-shadow(0 0 5px rgba(255, 0, 0, 0.8));
}

.heart.lost {
    opacity: 0.2;
    filter: grayscale(100%);
    transform: scale(0.8);
}

#gameScreen {
    width: 100%;
    height: 100%;
    position: relative;
}

.screen {
    width: 100%;
    height: 100%;
    position: absolute;
    top: 0;
    left: 0;
    display: none;
    justify-content: center;
    align-items: center;
    flex-direction: column;
    transition: background-color 0.3s ease;
}

.screen.active {
    display: flex;
}

#startScreen {
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
}

.title {
    font-size: 72px;
    font-weight: bold;
    color: #fff;
    text-shadow: 0 0 30px rgba(255, 0, 0, 0.8);
    margin-bottom: 10px;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% {
        transform: scale(1);
        text-shadow: 0 0 30px rgba(255, 0, 0, 0.8);
    }
    50% {
        transform: scale(1.05);
        text-shadow: 0 0 50px rgba(255, 0, 0, 1);
    }
}

.subtitle {
    font-size: 28px;
    color: #00ff88;
    margin-bottom: 40px;
    text-shadow: 0 0 15px #00ff88;
}

.instructions {
    background: rgba(255, 255, 255, 0.05);
    padding: 30px 40px;
    border-radius: 15px;
    margin-bottom: 40px;
    border: 2px solid rgba(255, 255, 255, 0.1);
    text-align: center;
}

.instructions p {
    color: #fff;
    font-size: 18px;
    margin: 10px 0;
    line-height: 1.6;
    text-align: center;
}

.btn {
    padding: 18px 50px;
    font-size: 24px;
    font-weight: bold;
    color: #fff;
    background: linear-gradient(135deg, #ff0055 0%, #ff4488 100%);
    border: none;
    border-radius: 50px;
    cursor: pointer;
    transition: all 0.3s;
    box-shadow: 0 5px 25px rgba(255, 0, 85, 0.5);
    text-transform: uppercase;
}

.btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 35px rgba(255, 0, 85, 0.7);
}

.btn:active {
    transform: translateY(-1px);
}

#bestRecord {
    margin-top: 20px;
    color: #ffaa00;
    font-size: 18px;
    font-weight: bold;
    text-align: center;
}

#playScreen {
    background-color: #ff0000;
    cursor: pointer;
}

#playScreen.waiting {
    background-color: #ff0000;
    animation: redPulse 1.5s infinite;
}

@keyframes redPulse {
    0%, 100% {
        background-color: #ff0000;
    }
    50% {
        background-color: #cc0000;
    }
}

#playScreen.ready {
    background-color: #00ff00;
    animation: greenGlow 0.5s ease-out;
}

@keyframes greenGlow {
    0% {
        background-color: #00ff00;
        box-shadow: inset 0 0 100px rgba(255, 255, 255, 0.5);
    }
    100% {
        background-color: #00ff00;
    }
}

#playScreen.clicked {
    background-color: #0088ff;
}

#message {
    font-size: 48px;
    font-weight: bold;
    color: #fff;
    text-shadow: 0 0 20px rgba(0, 0, 0, 0.8);
    margin-bottom: 20px;
    pointer-events: none;
}

#reactionTime {
    font-size: 36px;
    font-weight: bold;
    color: #fff;
    text-shadow: 0 0 15px rgba(0, 0, 0, 0.8);
    pointer-events: none;
}

#gameOverScreen {
    background: linear-gradient(135deg, #2d1b1b 0%, #1a0f0f 100%);
}

.gameOverTitle {
    font-size: 64px;
    color: #ff0055;
    text-shadow: 0 0 30px rgba(255, 0, 85, 0.8);
    margin-bottom: 40px;
}

#finalStats {
    background: rgba(255, 255, 255, 0.05);
    padding: 30px 50px;
    border-radius: 15px;
    margin-bottom: 40px;
    border: 2px solid rgba(255, 255, 255, 0.1);
    text-align: center;
}

#finalStats p {
    color: #fff;
    font-size: 24px;
    margin: 15px 0;
    text-align: center;
}

#finalStats span {
    color: #00ff88;
    font-weight: bold;
    text-shadow: 0 0 10px #00ff88;
}

#victoryScreen {
    background: linear-gradient(135deg, #1b2d1b 0%, #0f1a0f 100%);
}

.victoryTitle {
    font-size: 56px;
    color: #00ff88;
    text-shadow: 0 0 30px rgba(0, 255, 136, 0.8);
    margin-bottom: 40px;
    animation: victoryPulse 1.5s infinite;
}

@keyframes victoryPulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.1);
    }
}

#victoryStats {
    background: rgba(255, 255, 255, 0.05);
    padding: 30px 50px;
    border-radius: 15px;
    margin-bottom: 40px;
    border: 2px solid rgba(0, 255, 136, 0.3);
    text-align: center;
}

#victoryStats p {
    color: #fff;
    font-size: 24px;
    margin: 15px 0;
    text-align: center;
}

#victoryStats span {
    color: #ffaa00;
    font-weight: bold;
    text-shadow: 0 0 10px #ffaa00;
}

.name-input-section {
    margin: 30px 0;
    padding: 25px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 15px;
    border: 2px solid rgba(255, 255, 255, 0.1);
    display: none;
    text-align: center;
}

.congrats-text {
    color: #ffaa00;
    font-size: 24px;
    font-weight: bold;
    margin-bottom: 15px;
    text-shadow: 0 0 15px #ffaa00;
    text-align: center;
}

.name-input {
    padding: 12px 20px;
    font-size: 20px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 10px;
    background: rgba(0, 0, 0, 0.3);
    color: #fff;
    text-align: center;
    text-transform: uppercase;
    width: 250px;
    margin-right: 10px;
    font-weight: bold;
    letter-spacing: 2px;
}

.name-input:focus {
    outline: none;
    border-color: #00ff88;
    box-shadow: 0 0 15px rgba(0, 255, 136, 0.5);
}

.name-input::placeholder {
    color: rgba(255, 255, 255, 0.4);
    text-transform: none;
    letter-spacing: normal;
}

.btn-small {
    padding: 12px 30px;
    font-size: 18px;
    font-weight: bold;
    color: #fff;
    background: linear-gradient(135deg, #00ff88 0%, #00cc66 100%);
    border: none;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s;
    box-shadow: 0 3px 15px rgba(0, 255, 136, 0.5);
    text-transform: uppercase;
}

.btn-small:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 25px rgba(0, 255, 136, 0.7);
}

.btn-small:active {
    transform: translateY(0);
}

.leaderboard-section {
    margin: 20px 0;
    width: 100%;
    max-width: 600px;
    text-align: center;
}

.leaderboard-title {
    color: #ffaa00;
    font-size: 28px;
    margin-bottom: 20px;
    text-shadow: 0 0 15px #ffaa00;
    text-align: center;
}

.leaderboard-list {
    background: rgba(0, 0, 0, 0.3);
    border-radius: 15px;
    padding: 20px;
    border: 2px solid rgba(255, 255, 255, 0.1);
}

.leaderboard-entry {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 20px;
    margin: 8px 0;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    transition: all 0.3s;
}

.leaderboard-entry.highlight {
    background: rgba(0, 255, 136, 0.2);
    border-color: #00ff88;
    box-shadow: 0 0 20px rgba(0, 255, 136, 0.5);
    animation: highlightPulse 1.5s infinite;
}

@keyframes highlightPulse {
    0%, 100% {
        box-shadow: 0 0 20px rgba(0, 255, 136, 0.5);
    }
    50% {
        box-shadow: 0 0 30px rgba(0, 255, 136, 0.8);
    }
}

.leaderboard-entry .rank {
    font-size: 24px;
    font-weight: bold;
    color: #ffaa00;
    min-width: 50px;
}

.leaderboard-entry .player-name {
    flex: 1;
    font-size: 20px;
    font-weight: bold;
    color: #fff;
    text-align: left;
    margin-left: 15px;
    letter-spacing: 1px;
}

.leaderboard-entry .player-time {
    font-size: 20px;
    font-weight: bold;
    color: #00ff88;
    text-shadow: 0 0 10px #00ff88;
}

.no-scores {
    color: rgba(255, 255, 255, 0.5);
    font-size: 18px;
    padding: 30px;
    text-align: center;
}

@media (max-width: 768px) {
    .title {
        font-size: 48px;
    }
    
    .subtitle {
        font-size: 20px;
    }
    
    .instructions p {
        font-size: 16px;
    }
    
    .btn {
        font-size: 20px;
        padding: 15px 40px;
    }
    
    #message {
        font-size: 32px;
    }
    
    #topBar {
        padding: 15px 20px;
    }
    
    #stageText {
        font-size: 20px;
    }
    
    #livesContainer {
        font-size: 24px;
    }
    
    .name-input {
        width: 200px;
        font-size: 18px;
    }
    
    .btn-small {
        font-size: 16px;
        padding: 10px 25px;
    }
    
    .leaderboard-title {
        font-size: 24px;
    }
    
    .leaderboard-entry .rank {
        font-size: 20px;
        min-width: 40px;
    }
    
    .leaderboard-entry .player-name {
        font-size: 16px;
    }
    
    .leaderboard-entry .player-time {
        font-size: 16px;
    }
}