* {
    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;
    user-select: none;
    -webkit-user-select: 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: 2px solid #333;
}

/* === OVERLAYS === */
.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: 48px;
    color: #fff;
    letter-spacing: 12px;
    margin-bottom: 8px;
    text-align: center;
}

.subtitle {
    font-size: 18px;
    color: #888;
    letter-spacing: 6px;
    margin-bottom: 30px;
    text-align: center;
}

.instructions {
    color: #aaa;
    text-align: center;
    margin-bottom: 30px;
    line-height: 2;
    font-size: 14px;
}

.instructions p {
    margin: 4px 0;
}

/* === BUTTONS === */
button {
    font-family: 'Courier New', monospace;
    font-size: 18px;
    color: #000;
    background-color: #fff;
    border: none;
    padding: 12px 40px;
    cursor: pointer;
    letter-spacing: 3px;
    margin: 10px;
    transition: all 0.15s;
}

button:hover {
    background-color: #ccc;
}

button:active {
    background-color: #999;
    transform: scale(0.97);
}

/* === HIGH SCORE DISPLAY === */
.high-score-display {
    color: #666;
    font-size: 14px;
    margin-top: 20px;
    letter-spacing: 2px;
}

/* === GAME OVER === */
.final-score {
    font-size: 28px;
    color: #fff;
    margin: 15px 0 25px;
    letter-spacing: 4px;
}

/* === MOBILE CONTROLS === */
#mobile-controls {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    display: flex;
    justify-content: space-between;
    padding: 10px;
    z-index: 20;
    pointer-events: none;
}

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

.control-group {
    display: flex;
    gap: 8px;
    pointer-events: auto;
}

.control-group.left-controls {
    align-items: flex-end;
}

.control-group.right-controls {
    align-items: flex-end;
}

.touch-btn {
    width: 60px;
    height: 60px;
    border: 2px solid rgba(255, 255, 255, 0.4);
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.08);
    color: rgba(255, 255, 255, 0.6);
    font-family: 'Courier New', monospace;
    font-size: 11px;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    pointer-events: auto;
    touch-action: none;
    -webkit-tap-highlight-color: transparent;
}

.touch-btn.active {
    background: rgba(255, 255, 255, 0.25);
    border-color: rgba(255, 255, 255, 0.7);
    color: #fff;
}

.touch-btn.fire-btn {
    width: 70px;
    height: 70px;
    font-size: 12px;
    border-color: rgba(255, 255, 255, 0.5);
}

.touch-btn.hyperspace-btn {
    width: 50px;
    height: 50px;
    font-size: 9px;
    margin-bottom: 5px;
}

/* Arrow icons in buttons */
.touch-btn .arrow {
    font-size: 22px;
    line-height: 1;
}

/* === RESPONSIVE === */
@media (max-width: 600px) {
    .title {
        font-size: 32px;
        letter-spacing: 8px;
    }

    .subtitle {
        font-size: 14px;
    }

    .instructions {
        font-size: 12px;
        padding: 0 10px;
    }

    button {
        font-size: 16px;
        padding: 10px 30px;
    }
}

/* Show/hide desktop vs mobile instructions */
.controls-desktop {
    display: block;
}

.controls-mobile {
    display: none;
}

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

/* Back to arcade menu button */
.menu-button {
    display: inline-block;
    margin-top: 12px;
    padding: 10px 24px;
    font-family: 'Courier New', monospace;
    font-size: 16px;
    color: #888;
    text-decoration: none;
    letter-spacing: 3px;
    border: 2px solid #888;
    background: transparent;
    cursor: pointer;
    transition: all 0.2s;
}

.menu-button:hover {
    color: #fff;
    border-color: #fff;
    box-shadow: 0 0 10px rgba(255, 255, 255, 0.3);
}

/* === NAME ENTRY === */
.name-entry {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin: 1rem 0;
}

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

.enter-name-label {
    color: #aaa;
    font-size: 14px;
    margin-bottom: 12px;
    letter-spacing: 2px;
}

.initials-display {
    display: flex;
    gap: 8px;
    margin-bottom: 12px;
}

.initial {
    width: 40px;
    height: 48px;
    background-color: #000;
    border: 2px solid #fff;
    color: #fff;
    font-size: 28px;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    transition: all 0.1s;
}

.initial.active {
    background-color: #222;
    border-color: #fff;
    box-shadow: 0 0 10px rgba(255, 255, 255, 0.4);
    animation: initialBlink 0.5s infinite;
}

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

.name-instructions {
    color: #666;
    font-size: 11px;
    margin-bottom: 12px;
    text-align: center;
}

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

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

.leaderboard-title {
    color: #fff;
    font-size: 18px;
    margin-bottom: 8px;
    letter-spacing: 4px;
}

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

.leaderboard-entry {
    display: flex;
    justify-content: space-between;
    padding: 4px 8px;
    border-bottom: 1px solid #333;
    font-size: 14px;
}

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

.leaderboard-entry.highlight {
    background-color: #1a1a1a;
    color: #fff;
    box-shadow: 0 0 8px rgba(255, 255, 255, 0.15);
}

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

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

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

.leaderboard-level {
    color: #666;
    width: 3rem;
    text-align: right;
    font-size: 12px;
}

.loading {
    color: #666;
    text-align: center;
    padding: 16px;
}

.your-rank {
    color: #fff;
    margin: 8px 0;
    font-size: 14px;
    letter-spacing: 2px;
}
