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

body {
    font-family: 'Arial', sans-serif;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    color: white;
}

.game-container {
    position: relative;
    text-align: center;
}

.game-header {
    margin-bottom: 10px;
}

.score-display {
    display: flex;
    justify-content: space-around;
    background: rgba(0, 0, 0, 0.6);
    padding: 10px 20px;
    border-radius: 10px;
    font-size: 18px;
    font-weight: bold;
    width: 400px;
}

#gameCanvas {
    border: 3px solid #00d4ff;
    background: linear-gradient(180deg, #000428 0%, #004e92 100%);
    box-shadow: 0 0 20px rgba(0, 212, 255, 0.5);
    border-radius: 5px;
}

.start-screen, .game-over {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0, 0, 0, 0.9);
    padding: 40px;
    border-radius: 15px;
    border: 2px solid #00d4ff;
    box-shadow: 0 0 30px rgba(0, 212, 255, 0.7);
    z-index: 10;
}

.start-screen h1 {
    font-size: 32px;
    margin-bottom: 20px;
    color: #00d4ff;
    text-shadow: 0 0 10px rgba(0, 212, 255, 0.8);
}

.instructions {
    margin: 20px 0;
    text-align: left;
}

.instructions h3 {
    margin-bottom: 10px;
    color: #00d4ff;
}

.instructions p {
    margin: 5px 0;
    font-size: 14px;
}

.game-over h2 {
    font-size: 36px;
    color: #ff4757;
    margin-bottom: 20px;
    text-shadow: 0 0 10px rgba(255, 71, 87, 0.8);
}

.game-over p {
    font-size: 20px;
    margin-bottom: 20px;
}

button {
    background: linear-gradient(135deg, #00d4ff 0%, #0099cc 100%);
    color: white;
    border: none;
    padding: 15px 40px;
    font-size: 18px;
    font-weight: bold;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-top: 10px;
}

button:hover {
    background: linear-gradient(135deg, #0099cc 0%, #00d4ff 100%);
    transform: scale(1.05);
    box-shadow: 0 0 20px rgba(0, 212, 255, 0.8);
}

button:active {
    transform: scale(0.98);
}

button.secondary-button {
    background: linear-gradient(135deg, #6c757d 0%, #495057 100%);
    margin-top: 10px;
}

button.secondary-button:hover {
    background: linear-gradient(135deg, #495057 0%, #6c757d 100%);
}

.hidden {
    display: none;
}

/* Hall of Fame */
.hall-of-fame {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0, 0, 0, 0.95);
    padding: 30px;
    border-radius: 15px;
    border: 2px solid #00d4ff;
    box-shadow: 0 0 30px rgba(0, 212, 255, 0.7);
    z-index: 10;
    width: 90%;
    max-width: 450px;
    max-height: 80vh;
    overflow-y: auto;
}

.hall-of-fame h2 {
    font-size: 32px;
    margin-bottom: 20px;
    color: #00d4ff;
    text-shadow: 0 0 10px rgba(0, 212, 255, 0.8);
    text-align: center;
}

.scores-list {
    margin: 20px 0;
}

.score-entry {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 15px;
    margin: 8px 0;
    background: rgba(0, 212, 255, 0.1);
    border-left: 3px solid #00d4ff;
    border-radius: 5px;
    font-size: 16px;
}

.score-entry.rank-1 {
    background: rgba(255, 215, 0, 0.2);
    border-left-color: gold;
}

.score-entry.rank-2 {
    background: rgba(192, 192, 192, 0.2);
    border-left-color: silver;
}

.score-entry.rank-3 {
    background: rgba(205, 127, 50, 0.2);
    border-left-color: #cd7f32;
}

.score-rank {
    font-weight: bold;
    margin-right: 15px;
    min-width: 30px;
}

.score-name {
    flex: 1;
    text-align: left;
}

.score-value {
    font-weight: bold;
    color: #00d4ff;
}

/* High Score Entry */
#highScoreEntry {
    margin: 20px 0;
}

.high-score-message {
    color: #ffd700;
    font-size: 20px;
    font-weight: bold;
    margin-bottom: 15px;
    text-shadow: 0 0 10px rgba(255, 215, 0, 0.8);
}

#playerName {
    width: 100%;
    padding: 12px;
    margin-bottom: 15px;
    background: rgba(0, 0, 0, 0.5);
    border: 2px solid #00d4ff;
    border-radius: 8px;
    color: white;
    font-size: 16px;
    text-align: center;
}

#playerName:focus {
    outline: none;
    border-color: #00ffff;
    box-shadow: 0 0 10px rgba(0, 212, 255, 0.5);
}

#playerName::placeholder {
    color: rgba(255, 255, 255, 0.5);
}

/* Touch controls */
.touch-controls {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 5;
}

.touch-indicator {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 212, 255, 0.3);
    color: white;
    padding: 10px 20px;
    border-radius: 10px;
    border: 2px solid rgba(0, 212, 255, 0.5);
    font-size: 14px;
    animation: pulse 2s infinite;
}

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

/* Mobile-specific styles */
.mobile-controls {
    display: none;
}

.desktop-controls {
    display: block;
}

/* Mobile responsive design */
@media only screen and (max-width: 768px) {
    body {
        padding: 0;
        margin: 0;
        overflow: hidden;
        min-height: 100vh;
        min-height: -webkit-fill-available;
    }

    html {
        height: -webkit-fill-available;
    }

    .game-container {
        width: 100vw;
        height: 100vh;
        display: flex;
        flex-direction: column;
        justify-content: center;
        align-items: center;
    }

    .game-header {
        margin-bottom: 5px;
    }

    .score-display {
        width: 90vw;
        max-width: 400px;
        padding: 8px 15px;
        font-size: 16px;
    }

    #gameCanvas {
        width: 90vw !important;
        height: calc(100vh - 60px) !important;
        max-width: 400px;
        max-height: 700px;
        border: 2px solid #00d4ff;
        touch-action: none;
    }

    .mobile-controls {
        display: block;
    }

    .desktop-controls {
        display: none;
    }

    .start-screen, .game-over {
        width: 80%;
        max-width: 350px;
        padding: 30px 20px;
    }

    .start-screen h1 {
        font-size: 24px;
        margin-bottom: 15px;
    }

    .instructions {
        margin: 15px 0;
        text-align: center;
    }

    .instructions p {
        font-size: 13px;
    }

    .game-over h2 {
        font-size: 28px;
    }

    .game-over p {
        font-size: 18px;
    }

    button {
        padding: 12px 30px;
        font-size: 16px;
        width: 100%;
    }

    .hall-of-fame {
        width: 85%;
        padding: 20px;
        max-height: 85vh;
    }

    .hall-of-fame h2 {
        font-size: 24px;
    }

    .score-entry {
        font-size: 14px;
        padding: 10px 12px;
    }

    .high-score-message {
        font-size: 18px;
    }

    #playerName {
        font-size: 14px;
    }
}

/* iPhone specific optimizations */
@media only screen and (max-width: 480px) {
    .score-display {
        font-size: 14px;
        padding: 6px 12px;
    }

    .start-screen h1 {
        font-size: 20px;
    }

    .touch-indicator {
        font-size: 12px;
        padding: 8px 16px;
    }
}
