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

body {
    font-family: 'Courier New', monospace;
    background-color: #000;
    overflow: hidden;
    touch-action: none;
    user-select: none;
    -webkit-user-select: none;
}

#game-container {
    position: relative;
    width: 100vw;
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    background: linear-gradient(to bottom, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
}

#gameCanvas {
    background: linear-gradient(to bottom, #87CEEB 0%, #4682B4 70%, #1E90FF 100%);
    image-rendering: pixelated;
    image-rendering: -moz-crisp-edges;
    image-rendering: crisp-edges;
    max-width: 100%;
    max-height: 100%;
}

#ui-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    padding: 20px;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    pointer-events: none;
}

#ui-overlay > * {
    pointer-events: auto;
}

#score-display, #lives-display {
    background: rgba(0, 0, 0, 0.7);
    color: #fff;
    padding: 8px 16px;
    border: 2px solid #fff;
    border-radius: 0;
    font-size: 18px;
    font-weight: bold;
    text-shadow: 2px 2px 0px #000;
}

.score-label, .lives-label {
    color: #ffd700;
}

#power-up-display {
    position: absolute;
    top: 80px;
    left: 20px;
    background: rgba(0, 0, 0, 0.7);
    color: #fff;
    padding: 8px 16px;
    border: 2px solid #fff;
    font-size: 16px;
    display: flex;
    align-items: center;
    gap: 10px;
}

#power-up-icon {
    font-size: 24px;
}

#pause-btn {
    background: rgba(0, 0, 0, 0.7);
    color: #fff;
    border: 2px solid #fff;
    padding: 8px 12px;
    font-size: 20px;
    cursor: pointer;
}

.screen {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    background: rgba(0, 0, 0, 0.85);
    z-index: 100;
}

.pixel-text {
    color: #fff;
    text-shadow: 3px 3px 0px #000;
    margin: 10px 0;
    text-align: center;
}

h1.pixel-text {
    font-size: 48px;
    color: #ff6b6b;
    margin-bottom: 30px;
}

h2.pixel-text {
    font-size: 36px;
    color: #ffd700;
}

p.pixel-text {
    font-size: 20px;
}

h3.pixel-text.small {
    font-size: 18px;
    color: #ffd700;
    margin: 20px 0 10px 0;
}

#top-scores-preview {
    margin: 20px 0;
    padding: 15px;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.3);
    max-width: 300px;
}

#top-scores-list {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.top-score-entry {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 4px 8px;
    font-family: 'Courier New', monospace;
    font-size: 14px;
    color: #fff;
    text-shadow: 1px 1px 0px #000;
}

.top-score-entry .rank {
    min-width: 25px;
    font-size: 16px;
}

.top-score-entry .name {
    flex: 1;
    margin: 0 8px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.top-score-entry .score {
    color: #ffd700;
    font-weight: bold;
    min-width: 60px;
    text-align: right;
}

.pixel-btn {
    background: #4CAF50;
    color: #fff;
    border: none;
    padding: 15px 40px;
    font-size: 24px;
    font-family: 'Courier New', monospace;
    font-weight: bold;
    text-transform: uppercase;
    cursor: pointer;
    margin: 10px;
    position: relative;
    text-shadow: 2px 2px 0px #000;
    box-shadow: 
        0 6px 0 #2e7d32,
        0 12px 0 rgba(0,0,0,0.2);
    transition: all 0.1s;
}

.pixel-btn:hover {
    background: #5cbf60;
}

.pixel-btn:active {
    transform: translateY(6px);
    box-shadow: 
        0 0 0 #2e7d32,
        0 6px 0 rgba(0,0,0,0.2);
}

.hidden {
    display: none !important;
}

#mobile-controls {
    position: absolute;
    bottom: 20px;
    left: 20px;
    pointer-events: auto;
}

#joystick-container {
    position: relative;
    width: 120px;
    height: 120px;
}

#joystick-base {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.3);
    border: 3px solid rgba(255, 255, 255, 0.5);
    position: relative;
    touch-action: none;
}

#joystick-knob {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.8);
    border: 2px solid #000;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    transition: all 0.1s ease;
    pointer-events: none;
}

#jump-info {
    color: #fff;
    font-size: 12px;
    text-align: center;
    margin-top: 10px;
    text-shadow: 1px 1px 0px #000;
    font-family: 'Courier New', monospace;
}

.pixel-input {
    background: #2c2c2c;
    color: #fff;
    border: 2px solid #fff;
    padding: 10px 15px;
    font-size: 18px;
    font-family: 'Courier New', monospace;
    text-align: center;
    margin: 10px;
    width: 200px;
    text-shadow: 1px 1px 0px #000;
}

.pixel-input:focus {
    outline: none;
    border-color: #ffd700;
    box-shadow: 0 0 10px rgba(255, 215, 0, 0.5);
}

.pixel-btn.secondary {
    background: #666;
    box-shadow: 
        0 6px 0 #333,
        0 12px 0 rgba(0,0,0,0.2);
}

.pixel-btn.secondary:hover {
    background: #777;
}

.pixel-btn.secondary:active {
    box-shadow: 
        0 0 0 #333,
        0 6px 0 rgba(0,0,0,0.2);
}

.leaderboard-entries {
    width: 100%;
    max-width: 400px;
    margin: 20px 0;
}

.leaderboard-entry {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 15px;
    margin: 5px 0;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.3);
    font-family: 'Courier New', monospace;
    font-size: 16px;
    color: #fff;
    text-shadow: 1px 1px 0px #000;
}

.leaderboard-entry:nth-child(1) {
    border-color: #ffd700;
    background: rgba(255, 215, 0, 0.1);
}

.leaderboard-entry:nth-child(2) {
    border-color: #c0c0c0;
    background: rgba(192, 192, 192, 0.1);
}

.leaderboard-entry:nth-child(3) {
    border-color: #cd7f32;
    background: rgba(205, 127, 50, 0.1);
}

.leaderboard-entry .rank {
    font-size: 20px;
    min-width: 40px;
    text-align: center;
}

.leaderboard-entry .name {
    flex: 1;
    margin: 0 10px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.leaderboard-entry .score {
    font-weight: bold;
    color: #ffd700;
    min-width: 80px;
    text-align: right;
}

@media (max-width: 768px) {
    #score-display, #lives-display {
        font-size: 14px;
        padding: 6px 12px;
    }
    
    #power-up-display {
        font-size: 14px;
        top: 60px;
    }
    
    h1.pixel-text {
        font-size: 32px;
    }
    
    h2.pixel-text {
        font-size: 28px;
    }
    
    p.pixel-text {
        font-size: 16px;
    }
    
    .pixel-btn {
        font-size: 18px;
        padding: 12px 30px;
    }
    
    .pixel-input {
        font-size: 16px;
        width: 180px;
    }
    
    .leaderboard-entry {
        font-size: 14px;
        padding: 6px 10px;
    }
    
    .leaderboard-entry .rank {
        font-size: 16px;
        min-width: 30px;
    }
    
    #top-scores-preview {
        max-width: 280px;
        padding: 10px;
    }
    
    h3.pixel-text.small {
        font-size: 16px;
    }
    
    .top-score-entry {
        font-size: 12px;
        padding: 3px 6px;
    }
    
    .top-score-entry .rank {
        min-width: 20px;
        font-size: 14px;
    }
}