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

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

body {
    background: #1a1a2e;
    font-family: 'Press Start 2P', monospace;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    overflow: hidden;
    image-rendering: pixelated;
}

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

.hidden {
    display: none !important;
}

/* --- Credit line --- */
.credit {
    margin-top: 20px;
    font-size: 0.5rem;
    color: #6c5ce7;
    letter-spacing: 1px;
}

/* --- Name / Start Screen --- */
#name-screen {
    animation: fadeIn 0.5s ease;
}

#name-screen h1 {
    font-size: 2.5rem;
    color: #f9ca24;
    text-shadow: 4px 4px 0px #e17055, 6px 6px 0px rgba(0,0,0,0.4);
    margin-bottom: 5px;
    letter-spacing: 2px;
}

.pixel-taco-title {
    font-size: 2rem;
    color: #f9ca24;
    margin-bottom: 15px;
}

.subtitle {
    font-size: 0.7rem;
    color: #dfe6e9;
    margin-bottom: 8px;
    line-height: 1.6;
}

.warning {
    font-size: 0.65rem;
    color: #ff6b6b;
    margin-bottom: 25px;
    animation: blink 1s infinite;
}

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

.name-input-area {
    margin-bottom: 20px;
}

.name-input-area label {
    display: block;
    font-size: 0.6rem;
    color: #74b9ff;
    margin-bottom: 10px;
}

#player-name {
    font-family: 'Press Start 2P', monospace;
    font-size: 1rem;
    padding: 12px 20px;
    border: 4px solid #74b9ff;
    border-radius: 0;
    background: #0a0a1a;
    color: #fff;
    text-align: center;
    text-transform: uppercase;
    outline: none;
    width: 280px;
}

#player-name:focus {
    border-color: #f9ca24;
    box-shadow: 0 0 15px rgba(249, 202, 36, 0.3);
}

#player-name::placeholder {
    color: #444;
}

#start-btn, #restart-btn {
    font-family: 'Press Start 2P', monospace;
    font-size: 0.9rem;
    padding: 15px 40px;
    border: 4px solid #f9ca24;
    border-radius: 0;
    background: #f9ca24;
    color: #1a1a2e;
    cursor: pointer;
    transition: transform 0.1s, background 0.1s;
    text-transform: uppercase;
}

#start-btn:hover, #restart-btn:hover {
    transform: scale(1.05);
    background: #ffeaa7;
}

#start-btn:active, #restart-btn:active {
    transform: scale(0.95);
}

.controls-hint {
    margin-top: 15px;
    font-size: 0.5rem;
    color: #636e72;
}

/* --- Sound Toggle (start screen) --- */
.sound-btn-start {
    font-family: 'Press Start 2P', monospace;
    font-size: 0.6rem;
    padding: 10px 25px;
    border: 3px solid #55efc4;
    background: transparent;
    color: #55efc4;
    cursor: pointer;
    margin-bottom: 15px;
    display: block;
    margin-left: auto;
    margin-right: auto;
    transition: all 0.15s;
    text-transform: uppercase;
}

.sound-btn-start:hover {
    background: #55efc4;
    color: #1a1a2e;
}

.sound-btn-start.sound-on {
    background: #55efc4;
    color: #1a1a2e;
    border-color: #55efc4;
}

/* --- Sound Toggle (in-game HUD) --- */
.sound-btn {
    cursor: pointer;
    border: 2px solid #55efc4 !important;
    color: #55efc4 !important;
    background: #0a0a1a;
    transition: all 0.15s;
}

.sound-btn:hover {
    background: rgba(85, 239, 196, 0.15);
}

.sound-btn.sound-on {
    background: #55efc4 !important;
    color: #1a1a2e !important;
}

/* --- Game Screen --- */
#game-screen {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.hud {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-bottom: 8px;
    flex-wrap: wrap;
}

.hud-item {
    font-size: 0.55rem;
    color: #b2bec3;
    background: #0a0a1a;
    padding: 6px 12px;
    border: 2px solid #2d3436;
}

.hud-item span {
    color: #f9ca24;
}

canvas {
    border: 4px solid #f9ca24;
    box-shadow: 0 0 20px rgba(249, 202, 36, 0.2), inset 0 0 20px rgba(0,0,0,0.3);
    cursor: none;
    image-rendering: pixelated;
}

/* --- End Screen --- */
#end-screen {
    animation: fadeIn 0.5s ease;
    max-width: 520px;
}

#end-title {
    font-size: 1.8rem;
    color: #f9ca24;
    text-shadow: 3px 3px 0px #e17055;
    margin-bottom: 8px;
}

#end-message {
    font-size: 0.6rem;
    color: #dfe6e9;
    margin-bottom: 8px;
    line-height: 1.6;
}

#end-score-display {
    font-size: 1rem;
    color: #55efc4;
    margin-bottom: 20px;
}

/* --- Leaderboard --- */
#leaderboard {
    background: #0a0a1a;
    border: 4px solid #f9ca24;
    padding: 15px;
    margin-bottom: 20px;
    text-align: left;
}

#leaderboard h2 {
    font-size: 0.8rem;
    color: #f9ca24;
    text-align: center;
    margin-bottom: 12px;
}

.leaderboard-header {
    display: flex;
    gap: 5px;
    padding: 6px 4px;
    border-bottom: 2px solid #f9ca24;
    margin-bottom: 4px;
    font-size: 0.45rem;
    color: #74b9ff;
}

.lb-rank { width: 50px; text-align: center; }
.lb-name { flex: 1; }
.lb-score { width: 60px; text-align: center; }
.lb-how { width: 70px; text-align: center; }

.lb-row {
    display: flex;
    gap: 5px;
    padding: 5px 4px;
    font-size: 0.42rem;
    color: #dfe6e9;
    border-bottom: 1px solid #1a1a2e;
}

.lb-row:nth-child(even) {
    background: rgba(255,255,255,0.03);
}

.lb-row.highlight {
    color: #55efc4;
    background: rgba(85, 239, 196, 0.1);
}

.lb-row.gold { color: #f9ca24; }
.lb-row.silver { color: #b2bec3; }
.lb-row.bronze { color: #e17055; }

.lb-empty {
    font-size: 0.45rem;
    color: #636e72;
    text-align: center;
    padding: 10px;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}
