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

body {
    background: #0f0f1a;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    font-family: 'Press Start 2P', cursive;
    overflow: hidden;
}

#game-container {
    position: relative;
    width: 100%;
    max-width: 600px;
    height: calc(100vh - 40px);
    display: flex;
    align-items: center;
    justify-content: center;
}

#canvas {
    image-rendering: pixelated;
    image-rendering: crisp-edges;
    border: 4px solid #FF6B00;
    border-radius: 4px;
    box-shadow: 0 0 30px rgba(255, 107, 0, 0.3),
                inset 0 0 60px rgba(0, 0, 0, 0.5);
}

#canvas.shake {
    animation: shake 0.2s ease-in-out;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-10px); }
    75% { transform: translateX(10px); }
}

#ui-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    display: flex;
    align-items: center;
    justify-content: center;
}

.screen {
    pointer-events: all;
    background: rgba(15, 15, 26, 0.95);
    padding: 30px;
    border: 3px solid #FF6B00;
    border-radius: 8px;
    text-align: center;
    color: #fff;
    max-width: 350px;
    box-shadow: 0 0 40px rgba(255, 107, 0, 0.4);
}

.hidden {
    display: none !important;
}

.title-container {
    margin-bottom: 20px;
}

.game-title {
    font-size: 20px;
    color: #FF6B00;
    text-shadow: 3px 3px 0 #9C27B0,
                 -1px -1px 0 #fff;
    letter-spacing: 2px;
    line-height: 1.4;
}

.title-sorter {
    color: #9C27B0;
    text-shadow: 3px 3px 0 #FF6B00,
                 -1px -1px 0 #fff;
}

.snoo-container {
    margin: 20px 0;
}

#snoo-sprite {
    width: 64px;
    height: 64px;
    image-rendering: pixelated;
    animation: bounce 1s ease-in-out infinite;
}

@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

.blink-text {
    font-size: 12px;
    color: #fff;
    animation: blink 1s step-end infinite;
    margin: 20px 0;
    cursor: pointer;
}

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

.high-score-display {
    font-size: 10px;
    color: #feca57;
    margin: 15px 0;
}

.instructions {
    font-size: 7px;
    color: #aaa;
    line-height: 2;
    margin: 15px 0;
}

.pixel-btn {
    font-family: 'Press Start 2P', cursive;
    font-size: 10px;
    padding: 12px 24px;
    background: linear-gradient(180deg, #FF6B00 0%, #cc5500 100%);
    color: #fff;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    margin: 10px 5px;
    box-shadow: 0 4px 0 #993300,
                0 6px 10px rgba(0, 0, 0, 0.3);
    transition: all 0.1s;
}

.pixel-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 0 #993300,
                0 8px 15px rgba(0, 0, 0, 0.3);
}

.pixel-btn:active {
    transform: translateY(2px);
    box-shadow: 0 2px 0 #993300,
                0 3px 5px rgba(0, 0, 0, 0.3);
}

#game-hud {
    position: absolute;
    top: 10px;
    left: 10px;
    right: 10px;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    pointer-events: none;
    padding: 0 5px;
}

.hud-left, .hud-center, .hud-right {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.hud-label {
    font-size: 6px;
    color: #888;
    margin-bottom: 3px;
}

#score-display, #combo-display, #timer-display {
    font-size: 14px;
    color: #fff;
    text-shadow: 2px 2px 0 #000;
}

#timer-display.timer-warning {
    color: #f44336;
    animation: pulse 0.5s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.2); }
}

.combo-container {
    display: flex;
    align-items: center;
    gap: 5px;
}

#combo-multiplier {
    font-size: 10px;
    color: #feca57;
    opacity: 0;
    transition: opacity 0.2s;
}

#combo-multiplier.active {
    opacity: 1;
    animation: fire 0.3s ease-in-out infinite alternate;
}

@keyframes fire {
    0% { color: #feca57; text-shadow: 0 0 5px #ff6b6b; }
    100% { color: #ff6b6b; text-shadow: 0 0 10px #feca57; }
}

.lives-container {
    font-size: 12px;
    margin-top: 5px;
}

.timer-container {
    display: flex;
    flex-direction: column;
    align-items: center;
}

/* Game Over Screen */
.game-over-title {
    font-size: 24px;
    color: #f44336;
    text-shadow: 3px 3px 0 #000;
    margin-bottom: 20px;
    animation: glitch 2s ease-in-out infinite;
}

@keyframes glitch {
    0%, 100% { text-shadow: 3px 3px 0 #000; }
    20% { text-shadow: -3px 3px 0 #ff00ff, 3px -3px 0 #00ffff; }
    40% { text-shadow: 3px -3px 0 #ff00ff, -3px 3px 0 #00ffff; }
}

.rank-display {
    margin: 20px 0;
}

.rank-label {
    font-size: 8px;
    color: #888;
    display: block;
    margin-bottom: 10px;
}

.rank-grade {
    font-size: 48px;
    font-weight: bold;
}

.rank-s { color: #ffd700; text-shadow: 0 0 20px #ffd700; }
.rank-a { color: #4CAF50; text-shadow: 0 0 15px #4CAF50; }
.rank-b { color: #2196F3; text-shadow: 0 0 15px #2196F3; }
.rank-c { color: #ff9800; text-shadow: 0 0 15px #ff9800; }
.rank-d { color: #9e9e9e; }
.rank-f { color: #f44336; }

.final-stats {
    font-size: 8px;
    color: #ccc;
    line-height: 2.5;
    margin: 20px 0;
}

.final-stats span {
    color: #feca57;
}

.game-over-buttons {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px;
    margin-top: 20px;
}

#floating-texts {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    overflow: hidden;
}

.floating-text {
    position: absolute;
    font-family: 'Press Start 2P', cursive;
    font-size: 14px;
    font-weight: bold;
    text-shadow: 2px 2px 0 #000;
    animation: floatUp 1s ease-out forwards;
    pointer-events: none;
}

@keyframes floatUp {
    0% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
    100% {
        opacity: 0;
        transform: translateY(-50px) scale(1.5);
    }
}

.game-footer {
    font-size: 8px;
    color: #666;
    padding: 10px;
    text-align: center;
}

.game-footer a {
    color: #FF6B00;
    text-decoration: none;
}

.game-footer a:hover {
    text-decoration: underline;
}

/* Mobile adjustments */
@media (max-width: 480px) {
    .game-title {
        font-size: 16px;
    }
    
    .screen {
        padding: 20px;
        margin: 10px;
    }
    
    .instructions {
        font-size: 6px;
    }
    
    .pixel-btn {
        font-size: 8px;
        padding: 10px 16px;
    }
    
    #game-hud {
        top: 5px;
    }
    
    #score-display, #combo-display, #timer-display {
        font-size: 10px;
    }
    
    .hud-label {
        font-size: 5px;
    }
}