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

body {
    background-color: #000;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    font-family: 'Courier New', monospace;
    overflow: hidden;
    touch-action: none;
}

#game-container {
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
}

#game-canvas {
    display: block;
    image-rendering: pixelated;
    image-rendering: crisp-edges;
    border: 4px solid #333;
}

.overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    background-color: rgba(0, 0, 0, 0.85);
    z-index: 10;
}

.overlay.hidden {
    display: none;
}

.title {
    font-size: 3rem;
    color: #00ff00;
    text-shadow: 4px 4px 0 #006600;
    margin-bottom: 0.5rem;
    letter-spacing: 0.3rem;
    animation: pulse 1s ease-in-out infinite alternate;
}

.subtitle {
    font-size: 1rem;
    color: #ffff00;
    margin-bottom: 2rem;
    letter-spacing: 0.2rem;
}

@keyframes pulse {
    from { transform: scale(1); }
    to { transform: scale(1.05); }
}

.instructions {
    color: #fff;
    text-align: center;
    margin-bottom: 2rem;
    line-height: 1.8;
}

.instructions p {
    margin: 0.3rem 0;
    font-size: 0.9rem;
}

.controls-mobile {
    display: none;
}

@media (hover: none) and (pointer: coarse) {
    .controls-desktop {
        display: none;
    }
    .controls-mobile {
        display: block;
    }
}

button {
    padding: 1rem 2rem;
    font-size: 1.2rem;
    font-family: 'Courier New', monospace;
    background-color: #00aa00;
    color: #fff;
    border: none;
    cursor: pointer;
    text-transform: uppercase;
    letter-spacing: 0.1rem;
    transition: all 0.2s;
    border: 3px solid #00ff00;
}

button:hover {
    background-color: #00cc00;
    transform: scale(1.05);
}

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

.final-score {
    font-size: 1.5rem;
    color: #ffff00;
    margin: 1rem 0;
}

.high-score-display {
    color: #ff6600;
    margin-top: 1rem;
    font-size: 1rem;
}

/* Name Entry Styles */
.name-entry {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin: 1rem 0;
}

.name-entry.hidden {
    display: none;
}

.enter-name-label {
    color: #00ffff;
    font-size: 1rem;
    margin-bottom: 1rem;
    letter-spacing: 0.1rem;
}

.initials-display {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.initial {
    width: 2.5rem;
    height: 3rem;
    background-color: #000;
    border: 3px solid #00ff00;
    color: #00ff00;
    font-size: 2rem;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    transition: all 0.1s;
}

.initial.active {
    background-color: #003300;
    border-color: #ffff00;
    color: #ffff00;
    animation: blink 0.5s infinite;
}

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

.name-instructions {
    color: #888;
    font-size: 0.7rem;
    margin-bottom: 1rem;
    text-align: center;
}

/* Leaderboard Styles */
#leaderboard-section {
    display: flex;
    flex-direction: column;
    align-items: center;
}

#leaderboard-section.hidden {
    display: none;
}

.leaderboard-title {
    color: #ffff00;
    font-size: 1.2rem;
    margin-bottom: 0.5rem;
    letter-spacing: 0.2rem;
}

.leaderboard {
    background-color: rgba(0, 0, 0, 0.8);
    border: 2px solid #444;
    padding: 0.5rem;
    margin-bottom: 1rem;
    min-width: 250px;
    max-height: 200px;
    overflow-y: auto;
}

.leaderboard-entry {
    display: flex;
    justify-content: space-between;
    padding: 0.3rem 0.5rem;
    border-bottom: 1px solid #333;
    font-size: 0.9rem;
}

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

.leaderboard-entry.highlight {
    background-color: #003300;
    color: #00ff00;
}

.leaderboard-rank {
    color: #888;
    width: 2rem;
}

.leaderboard-name {
    color: #00ffff;
    width: 3rem;
    text-align: center;
}

.leaderboard-score {
    color: #ffff00;
    width: 5rem;
    text-align: right;
}

.leaderboard-level {
    color: #888;
    width: 3rem;
    text-align: right;
    font-size: 0.8rem;
}

.loading {
    color: #888;
    text-align: center;
    padding: 1rem;
}

.your-rank {
    color: #00ff00;
    margin: 0.5rem 0;
    font-size: 1rem;
}

#mobile-controls {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 5;
}

#mobile-controls.hidden {
    display: none;
}

.touch-hint {
    color: rgba(255, 255, 255, 0.5);
    font-size: 0.8rem;
    text-align: center;
}

/* Responsive scaling */
@media (max-width: 480px) {
    .title {
        font-size: 2rem;
    }

    .subtitle {
        font-size: 0.8rem;
    }

    .instructions p {
        font-size: 0.75rem;
    }

    button {
        padding: 0.8rem 1.5rem;
        font-size: 1rem;
    }
}

/* Scanline effect for retro feel */
#game-canvas {
    position: relative;
}

#game-container::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: repeating-linear-gradient(
        0deg,
        rgba(0, 0, 0, 0.1) 0px,
        rgba(0, 0, 0, 0.1) 1px,
        transparent 1px,
        transparent 2px
    );
    pointer-events: none;
    z-index: 1;
}

/* Back to arcade menu button */
.menu-button {
    display: inline-block;
    margin-top: 12px;
    padding: 0.7rem 1.5rem;
    font-family: 'Courier New', monospace;
    font-size: 1rem;
    color: #00ff00;
    text-decoration: none;
    letter-spacing: 0.15rem;
    border: 2px solid #00ff00;
    background: transparent;
    cursor: pointer;
    transition: all 0.2s;
}

.menu-button:hover {
    background: #00ff00;
    color: #000;
}
