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

body {
    background: linear-gradient(135deg, #0f0f1a 0%, #1a1a2e 50%, #0f0f1a 100%);
    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 - 50px);
    display: flex;
    align-items: center;
    justify-content: center;
}

#canvas {
    image-rendering: pixelated;
    image-rendering: crisp-edges;
    border: 4px solid #FF6B00;
    border-radius: 8px;
    box-shadow: 
        0 0 40px rgba(255, 107, 0, 0.4),
        0 0 80px rgba(255, 107, 0, 0.2),
        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); }
    20% { transform: translateX(-8px) rotate(-1deg); }
    40% { transform: translateX(8px) rotate(1deg); }
    60% { transform: translateX(-6px) rotate(-0.5deg); }
    80% { transform: translateX(6px) rotate(0.5deg); }
}

#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.97);
    padding: 25px;
    border: 3px solid #FF6B00;
    border-radius: 12px;
    text-align: center;
    color: #fff;
    max-width: 340px;
    box-shadow: 
        0 0 50px rgba(255, 107, 0, 0.5),
        inset 0 0 30px rgba(255, 107, 0, 0.1);
    animation: fadeIn 0.3s ease-out;
}

@keyframes fadeIn {
    from { opacity: 0; transform: scale(0.95); }
    to { opacity: 1; transform: scale(1); }
}

.hidden {
    display: none !important;
}

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

.game-title {
    font-size: 22px;
    color: #FF6B00;
    text-shadow: 
        4px 4px 0 #9C27B0,
        -2px -2px 0 #fff,
        0 0 20px rgba(255, 107, 0, 0.5);
    letter-spacing: 3px;
    line-height: 1.3;
    animation: titlePulse 2s ease-in-out infinite;
}

@keyframes titlePulse {
    0%, 100% { text-shadow: 4px 4px 0 #9C27B0, -2px -2px 0 #fff, 0 0 20px rgba(255, 107, 0, 0.5); }
    50% { text-shadow: 4px 4px 0 #9C27B0, -2px -2px 0 #fff, 0 0 40px rgba(255, 107, 0, 0.8); }
}

.title-sorter {
    color: #9C27B0;
    text-shadow: 
        4px 4px 0 #FF6B00,
        -2px -2px 0 #fff,
        0 0 20px rgba(156, 39, 176, 0.5);
}

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

#snoo-sprite {
    font-size: 48px;
    display: inline-block;
    animation: bounce 1s ease-in-out infinite;
    cursor: pointer;
    filter: drop-shadow(0 0 10px rgba(255, 107, 0, 0.5));
}

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

@keyframes dance {
    0%, 100% { transform: rotate(-10deg) scale(1.1); }
    50% { transform: rotate(10deg) scale(1.1); }
}

.tagline {
    font-size: 8px;
    color: #feca57;
    margin: 10px 0;
    animation: glow 2s ease-in-out infinite alternate;
}

@keyframes glow {
    from { text-shadow: 0 0 5px #feca57; }
    to { text-shadow: 0 0 15px #feca57, 0 0 25px #ff6b6b; }
}

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

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

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

.instructions {
    font-size: 7px;
    color: #aaa;
    line-height: 2.2;
    margin: 12px 0;
    padding: 10px;
    background: rgba(255, 107, 0, 0.1);
    border-radius: 6px;
    border: 1px solid rgba(255, 107, 0, 0.3);
}

.pixel-btn {
    font-family: 'Press Start 2P', cursive;
    font-size: 11px;
    padding: 14px 28px;
    background: linear-gradient(180deg, #FF6B00 0%, #cc5500 100%);
    color: #fff;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    margin: 8px 5px;
    box-shadow: 
        0 5px 0 #993300,
        0 8px 15px rgba(0, 0, 0, 0.4);
    transition: all 0.1s;
    text-shadow: 1px 1px 0 #993300;
}

.pixel-btn:hover {
    transform: translateY(-3px);
    box-shadow: 
        0 8px 0 #993300,
        0 12px 20px rgba(0, 0, 0, 0.4);
}

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

.pixel-btn.secondary {
    background: linear-gradient(180deg, #9C27B0 0%, #7b1fa2 100%);
    box-shadow: 
        0 5px 0 #4a148c,
        0 8px 15px rgba(0, 0, 0, 0.4);
}

.pixel-btn.secondary:hover {
    box-shadow: 
        0 8px 0 #4a148c,
        0 12px 20px rgba(0, 0, 0, 0.4);
}

.pixel-btn.small {
    font-size: 9px;
    padding: 10px 20px;
}

#game-hud {
    position: absolute;
    top: 8px;
    left: 8px;
    right: 8px;
    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;
    background: rgba(0, 0, 0, 0.5);
    padding: 6px 10px;
    border-radius: 6px;
    border: 1px solid rgba(255, 107, 0, 0.3);
}

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

#score-display, #combo-display, #timer-display {
    font-size: 16px;
    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.3); }
}

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

#combo-multiplier {
    font-size: 11px;
    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 8px #ff6b6b; }
    100% { color: #ff6b6b; text-shadow: 0 0 15px #feca57; }
}

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

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

/* Tutorial Overlay */
#tutorial-overlay {
    pointer-events: all;
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
}

.tutorial-box {
    background: rgba(15, 15, 26, 0.98);
    border: 3px solid #feca57;
    border-radius: 12px;
    padding: 25px;
    text-align: center;
    max-width: 300px;
    box-shadow: 0 0 40px rgba(254, 202, 87, 0.3);
}

#tutorial-text {
    font-size: 10px;
    color: #fff;
    line-height: 2;
    margin-bottom: 20px;
}

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

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

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

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

.rank-grade {
    font-size: 52px;
    font-weight: bold;
    display: inline-block;
    animation: rankPop 0.5s ease-out;
}

@keyframes rankPop {
    0% { transform: scale(0); }
    50% { transform: scale(1.3); }
    100% { transform: scale(1); }
}

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

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

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

.playable-proof {
    font-size: 8px;
    color: #4CAF50;
    margin: 15px 0;
    animation: glow 2s ease-in-out infinite alternate;
}

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

#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, -1px -1px 0 #000;
    animation: floatUp 1s ease-out forwards;
    pointer-events: none;
    white-space: nowrap;
}

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

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

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

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

.mute-btn {
    position: fixed;
    top: 10px;
    right: 10px;
    font-size: 20px;
    background: rgba(0, 0, 0, 0.5);
    border: 2px solid #FF6B00;
    border-radius: 8px;
    padding: 8px;
    cursor: pointer;
    z-index: 100;
    transition: all 0.2s;
}

.mute-btn:hover {
    background: rgba(255, 107, 0, 0.3);
    transform: scale(1.1);
}

/* Mobile adjustments */
@media (max-width: 480px) {
    .game-title {
        font-size: 18px;
    }
    
    .screen {
        padding: 18px;
        margin: 10px;
        max-width: 300px;
    }
    
    .instructions {
        font-size: 6px;
    }
    
    .pixel-btn {
        font-size: 9px;
        padding: 12px 20px;
    }
    
    #game-hud {
        top: 5px;
    }
    
    .hud-left, .hud-center, .hud-right {
        padding: 4px 8px;
    }
    
    #score-display, #combo-display, #timer-display {
        font-size: 12px;
    }
    
    .hud-label {
        font-size: 5px;
    }
    
    .lives-container {
        font-size: 12px;
    }
    
    .mute-btn {
        top: 5px;
        right: 5px;
        font-size: 16px;
        padding: 6px;
    }
}

@media (max-height: 600px) {
    .screen {
        padding: 15px;
    }
    
    .snoo-container {
        margin: 10px 0;
    }
    
    #snoo-sprite {
        font-size: 36px;
    }
    
    .instructions {
        margin: 8px 0;
        padding: 8px;
    }
}