* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}

body {
    background-color: #1a1a1a;
    font-family: 'Press Start 2P', cursive;
    overflow: hidden;
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
    color: #fff;
}

#game-container {
    position: relative;
    width: 100vw;
    height: 100vh;
    max-width: 600px;
    max-height: 800px;
    background: #87CEEB;
    overflow: hidden;
    border: 4px solid #fff;
    box-shadow: 0 0 20px rgba(0,0,0,0.5);
}

canvas {
    display: block;
    width: 100%;
    height: 100%;
}

.overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.9);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 100;
    text-align: center;
    padding: 20px;
}

.hidden {
    display: none !important;
}

h1 {
    font-size: 20px;
    margin-bottom: 30px;
    color: #FFD700;
    text-shadow: 3px 3px #000;
    line-height: 1.5;
}

.nickname-box {
    display: flex;
    flex-direction: column;
    gap: 15px;
    width: 100%;
    max-width: 300px;
    margin-bottom: 25px;
}

input {
    padding: 12px;
    font-family: 'Press Start 2P', cursive;
    font-size: 10px;
    border: 3px solid #333;
    background: #eee;
    color: #000;
    text-align: center;
}

input:focus {
    outline: none;
    border-color: #4CAF50;
}

.auth-buttons, .main-menu-btns, .game-over-btns {
    display: flex;
    flex-direction: column;
    gap: 15px;
    width: 100%;
    max-width: 300px;
}

button {
    padding: 15px;
    font-family: 'Press Start 2P', cursive;
    font-size: 12px;
    background-color: #4CAF50;
    color: white;
    border: 4px solid #2E7D32;
    cursor: pointer;
    transition: transform 0.1s;
}

button.secondary {
    background-color: #2196F3;
    border-color: #1565C0;
}

button.text-btn {
    background: none;
    border: none;
    color: #aaa;
    text-decoration: underline;
    font-size: 10px;
    margin-top: 20px;
}

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

.error {
    color: #ff4444;
    font-size: 8px;
    margin-top: 10px;
}

#user-display {
    font-size: 12px;
    margin-bottom: 20px;
    color: #4CAF50;
}

#leaderboard-list {
    width: 100%;
    max-width: 350px;
    max-height: 300px;
    overflow-y: auto;
    margin-bottom: 20px;
    background: #222;
    padding: 10px;
    border: 2px solid #444;
}

.leader-item {
    display: flex;
    justify-content: space-between;
    padding: 8px;
    font-size: 10px;
    border-bottom: 1px solid #333;
}

.leader-item:nth-child(1) { color: #FFD700; }
.leader-item:nth-child(2) { color: #C0C0C0; }
.leader-item:nth-child(3) { color: #CD7F32; }

#save-status {
    font-size: 8px;
    margin: 10px 0;
    color: #aaa;
}

#hud {
    position: absolute;
    top: 20px;
    left: 20px;
    right: 20px;
    display: flex;
    justify-content: space-between;
    pointer-events: none;
    z-index: 5;
    text-shadow: 2px 2px #000;
}

.score-board {
    font-size: 12px;
}

#lives {
    display: flex;
    gap: 5px;
}

.heart {
    font-size: 14px;
}

@keyframes shake {
    0% { transform: translate(1px, 1px) rotate(0deg); }
    10% { transform: translate(-1px, -2px) rotate(-1deg); }
    100% { transform: translate(1px, -2px) rotate(-1deg); }
}

.shake {
    animation: shake 0.3s;
}