@import url('https://fonts.googleapis.com/css2?family=Press+Start+2P&display=swap');

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

body {
    background: #0a0a0a;
    color: #fff;
    font-family: 'Press Start 2P', monospace;
    overflow: hidden;
    height: 100vh;
    width: 100vw;
}

#app {
    width: 100%;
    height: 100vh;
    position: relative;
}

.screen {
    display: none;
    width: 100%;
    height: 100%;
    position: absolute;
    top: 0;
    left: 0;
}

.screen.active {
    display: flex;
}

.menu-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    background: linear-gradient(180deg, #1a0a2e 0%, #16213e 50%, #0f3460 100%);
    gap: 20px;
    padding: 20px;
}

.title {
    font-size: 48px;
    color: #fff;
    text-shadow: 4px 4px 0 #e94560, 8px 8px 0 #533483;
    letter-spacing: 4px;
}

.accent {
    color: #e94560;
}

.subtitle {
    font-size: 12px;
    color: #aaa;
    letter-spacing: 2px;
}

.gameover-title {
    text-shadow: 4px 4px 0 #ff0000, 8px 8px 0 #8b0000;
    animation: pulse 1s ease-in-out infinite alternate;
}

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

.input-group {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

.input-group label {
    font-size: 10px;
    color: #aaa;
}

#player-name {
    background: #1a1a2e;
    border: 3px solid #e94560;
    color: #fff;
    font-family: 'Press Start 2P', monospace;
    font-size: 16px;
    padding: 12px 20px;
    text-align: center;
    outline: none;
    width: 300px;
    max-width: 90vw;
}

#player-name:focus {
    border-color: #fff;
    box-shadow: 0 0 20px rgba(233, 69, 96, 0.5);
}

.btn {
    font-family: 'Press Start 2P', monospace;
    font-size: 14px;
    padding: 15px 40px;
    border: none;
    cursor: pointer;
    letter-spacing: 2px;
    transition: all 0.15s;
    position: relative;
}

.btn:hover {
    transform: translateY(-2px);
}

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

.btn-primary {
    background: #e94560;
    color: #fff;
    box-shadow: 0 4px 0 #b8354c, 0 6px 20px rgba(233, 69, 96, 0.4);
}

.btn-primary:hover {
    background: #ff5a75;
    box-shadow: 0 4px 0 #b8354c, 0 8px 30px rgba(233, 69, 96, 0.6);
}

.btn-secondary {
    background: #533483;
    color: #fff;
    box-shadow: 0 4px 0 #3d2563;
}

.btn-secondary:hover {
    background: #6b44a8;
}

.controls-info {
    margin-top: 20px;
    font-size: 8px;
    color: #666;
    text-align: center;
    line-height: 2;
}

.key {
    display: inline-block;
    background: #333;
    color: #e94560;
    padding: 3px 8px;
    border: 1px solid #555;
    border-radius: 3px;
    margin: 0 2px;
}

#screen-game {
    flex-direction: column;
    background: #000;
}

#game-hud {
    display: flex;
    justify-content: space-around;
    align-items: center;
    padding: 10px 20px;
    background: rgba(0, 0, 0, 0.8);
    border-bottom: 2px solid #e94560;
    z-index: 10;
}

.hud-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.hud-label {
    font-size: 8px;
    color: #888;
}

.hud-value {
    font-size: 16px;
    color: #e94560;
}

#game-canvas {
    flex: 1;
    display: block;
    width: 100%;
    image-rendering: pixelated;
}

.gameover-stats {
    background: rgba(0, 0, 0, 0.4);
    padding: 20px 40px;
    border: 2px solid #533483;
    display: flex;
    flex-direction: column;
    gap: 12px;
    min-width: 280px;
}

.stat-row {
    display: flex;
    justify-content: space-between;
    font-size: 12px;
    gap: 30px;
}

.stat-row span:first-child {
    color: #888;
}

.stat-row span:last-child {
    color: #e94560;
}

.leaderboard-list {
    width: 100%;
    max-width: 400px;
    background: rgba(0, 0, 0, 0.4);
    border: 2px solid #533483;
    padding: 15px;
    max-height: 400px;
    overflow-y: auto;
}

.lb-entry {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 10px;
    font-size: 10px;
    border-bottom: 1px solid #333;
}

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

.lb-rank {
    color: #e94560;
    width: 30px;
}

.lb-name {
    flex: 1;
    color: #fff;
    text-align: left;
    margin-left: 10px;
}

.lb-score {
    color: #ffd700;
}

.lb-entry:nth-child(1) .lb-rank { color: #ffd700; }
.lb-entry:nth-child(2) .lb-rank { color: #c0c0c0; }
.lb-entry:nth-child(3) .lb-rank { color: #cd7f32; }

.loading {
    text-align: center;
    color: #888;
    font-size: 10px;
    padding: 20px;
}

.no-scores {
    text-align: center;
    color: #666;
    font-size: 10px;
    padding: 20px;
}

.debug-section {
    margin-top: 20px;
    width: 100%;
    max-width: 400px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.debug-section h3 {
    font-size: 10px;
    color: #888;
    margin-bottom: 10px;
}

#debug-info {
    width: 100%;
    height: 180px;
    background: #1a1a2e;
    border: 2px solid #533483;
    color: #0f0;
    font-family: 'Courier New', monospace;
    font-size: 9px;
    padding: 10px;
    resize: none;
    outline: none;
}

.btn-small {
    font-size: 10px;
    padding: 8px 20px;
    margin-top: 10px;
    background: #533483;
    color: #fff;
    box-shadow: 0 3px 0 #3d2563;
}

.btn-small:hover {
    background: #6b44a8;
}

@media (max-width: 600px) {
    .title {
        font-size: 28px;
    }
    .btn {
        font-size: 11px;
        padding: 12px 25px;
    }
    #player-name {
        font-size: 12px;
        width: 250px;
    }
    .hud-value {
        font-size: 12px;
    }
}
