/* ===================================
   SOLALA WORLD V2 - Mobile-First Retro Styles
   =================================== */

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

body {
    font-family: 'Press Start 2P', cursive;
    overflow: hidden;
    background: #000;
    color: #fff;
    touch-action: none;
    -webkit-user-select: none;
    user-select: none;
}

/* ===================================
   SCREENS (Start, End)
   =================================== */

.screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    display: none;
    align-items: center;
    justify-content: center;
    background: linear-gradient(180deg, #1a0033 0%, #330066 50%, #ff6b35 100%);
    z-index: 1000;
    animation: skyTransition 10s ease-in-out infinite alternate;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    touch-action: pan-y;
}

.screen.active {
    display: flex;
}

@keyframes skyTransition {
    0% { background: linear-gradient(180deg, #1a0033 0%, #330066 50%, #ff6b35 100%); }
    100% { background: linear-gradient(180deg, #0a0015 0%, #1a0033 50%, #cc5528 100%); }
}

.screen-content {
    text-align: center;
    z-index: 10;
    padding: 20px;
    padding-top: 40px;
    padding-bottom: 40px;
    max-width: 90vw;
    width: 100%;
}

/* Glitch Effect */
.glitch-wrapper {
    position: relative;
}

.title {
    font-size: clamp(1.5rem, 8vw, 3rem);
    color: #fff;
    text-shadow:
        0 0 10px #ff00ff,
        0 0 20px #ff00ff,
        0 0 30px #ff00ff,
        3px 3px 0 #00ffff,
        -3px -3px 0 #ff00ff;
    margin-bottom: 20px;
    animation: glitchText 5s infinite;
}

@keyframes glitchText {
    0%, 90%, 100% { transform: translate(0); }
    91% { transform: translate(-2px, 2px); }
    92% { transform: translate(2px, -2px); }
    93% { transform: translate(-2px, 2px); }
}

.subtitle {
    font-size: clamp(0.8rem, 3vw, 1.2rem);
    color: #00ffff;
    margin-bottom: 10px;
    text-shadow: 0 0 10px #00ffff;
}

.subtitle-small {
    font-size: clamp(0.5rem, 2vw, 0.7rem);
    color: #ff6b35;
    margin-bottom: 40px;
    letter-spacing: 3px;
}

/* Character Preview */
.character-preview {
    margin: 40px auto;
    display: none;
    justify-content: center;
}

.pixel-character {
    width: 64px;
    height: 64px;
    background: linear-gradient(to bottom, #00ffff 0%, #0099cc 100%);
    box-shadow:
        0 0 0 4px #000,
        0 0 0 8px #00ffff,
        inset 0 0 20px rgba(0,255,255,0.5);
    animation: bobbing 2s ease-in-out infinite;
}

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

/* Retro Button */
.retro-button {
    font-family: 'Press Start 2P', cursive;
    font-size: clamp(0.7rem, 2.5vw, 1rem);
    padding: 15px 30px;
    background: #ff00ff;
    color: #fff;
    border: 4px solid #fff;
    cursor: pointer;
    text-transform: uppercase;
    box-shadow:
        0 0 10px #ff00ff,
        0 0 20px #ff00ff,
        inset 0 0 10px rgba(255,255,255,0.2);
    transition: all 0.3s;
    margin: 10px;
    touch-action: manipulation;
}

.retro-button:hover, .retro-button:active {
    background: #00ffff;
    box-shadow:
        0 0 20px #00ffff,
        0 0 40px #00ffff,
        inset 0 0 20px rgba(255,255,255,0.5);
    transform: scale(1.05);
}

.retro-button.pulse {
    animation: pulse 2s ease-in-out infinite;
}

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

/* Controls Hint */
.controls-hint {
    margin-top: 60px;
    font-size: clamp(0.4rem, 1.5vw, 0.6rem);
    color: #999;
    line-height: 1.8;
}

/* CRT Effect */
.crt-effect {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background:
        repeating-linear-gradient(
            0deg,
            rgba(0, 0, 0, 0.15),
            rgba(0, 0, 0, 0.15) 1px,
            transparent 1px,
            transparent 2px
        );
    pointer-events: none;
    z-index: 5;
}

/* ===================================
   GAME CONTAINER
   =================================== */

#game-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
}

#game-canvas {
    width: 100%;
    height: 100%;
    display: block;
    touch-action: none;
}

/* ===================================
   HUD (Heads-Up Display)
   =================================== */

#hud {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 100;
}

.hud-top {
    display: flex;
    justify-content: space-between;
    padding: 10px;
    flex-wrap: wrap;
    gap: 10px;
}

.hud-item {
    background: rgba(0, 0, 0, 0.7);
    border: 3px solid #00ffff;
    padding: 8px 15px;
    box-shadow:
        0 0 10px #00ffff,
        inset 0 0 10px rgba(0,255,255,0.2);
    flex: 0 0 auto;
}

.hud-label {
    color: #00ffff;
    font-size: clamp(0.4rem, 1.5vw, 0.6rem);
    display: block;
    margin-bottom: 5px;
}

.hud-value {
    color: #fff;
    font-size: clamp(0.6rem, 2vw, 0.9rem);
    text-shadow: 0 0 5px #00ffff;
}

/* Mute button */
.mute-button {
    position: fixed;
    top: 80px;
    right: 10px;
    background: rgba(0, 0, 0, 0.7);
    border: 3px solid #ff00ff;
    padding: 10px 15px;
    font-size: 1.5rem;
    cursor: pointer;
    pointer-events: all;
    box-shadow:
        0 0 10px #ff00ff,
        inset 0 0 10px rgba(255,0,255,0.2);
    transition: all 0.3s ease;
    z-index: 101;
}

.mute-button:hover {
    background: rgba(255, 0, 255, 0.2);
    box-shadow:
        0 0 20px #ff00ff,
        inset 0 0 15px rgba(255,0,255,0.4);
    transform: scale(1.1);
}

.mute-button:active {
    transform: scale(0.95);
}

.mute-button.muted {
    border-color: #666;
    box-shadow:
        0 0 10px #666,
        inset 0 0 10px rgba(102,102,102,0.2);
}


/* Camera button */
.camera-button {
    position: fixed;
    top: 150px;
    right: 10px;
    background: rgba(0, 0, 0, 0.7);
    border: 3px solid #00ffaa;
    padding: 10px 15px;
    font-size: 1.5rem;
    cursor: pointer;
    pointer-events: all;
    box-shadow:
        0 0 10px #00ffaa,
        inset 0 0 10px rgba(0,255,170,0.2);
    transition: all 0.3s ease;
    z-index: 101;
}

.camera-button:hover {
    background: rgba(0, 255, 170, 0.2);
    box-shadow:
        0 0 20px #00ffaa,
        inset 0 0 15px rgba(0,255,170,0.4);
    transform: scale(1.1);
}

.camera-button:active {
    transform: scale(0.95);
}

.camera-button.active {
    border-color: #ffff00;
    background: rgba(255, 255, 0, 0.2);
    box-shadow:
        0 0 20px #ffff00,
        inset 0 0 15px rgba(255,255,0,0.4);
}

/* ===================================
   MOBILE VIRTUAL JOYSTICK
   =================================== */

#mobile-controls {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 30vh;
    pointer-events: none;
    z-index: 200;
    display: none; /* Show only on mobile */
}

@media (max-width: 768px), (hover: none) {
    #mobile-controls {
        display: block;
    }
}

#joystick-zone {
    position: absolute;
    left: 20px;
    bottom: 20px;
    width: 150px;
    height: 150px;
    pointer-events: all;
}

#joystick-base {
    position: absolute;
    width: 150px;
    height: 150px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(0,255,255,0.2), rgba(0,255,255,0.05));
    border: 4px solid rgba(0,255,255,0.5);
    box-shadow: 0 0 20px rgba(0,255,255,0.3);
}

#joystick-stick {
    position: absolute;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: radial-gradient(circle, #00ffff, #0099cc);
    border: 4px solid #fff;
    box-shadow:
        0 0 10px #00ffff,
        inset 0 0 10px rgba(255,255,255,0.5);
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    transition: transform 0.1s;
}

#interact-button {
    position: absolute;
    right: 20px;
    bottom: 20px;
    width: 100px;
    height: 100px;
    border-radius: 50%;
    font-family: 'Press Start 2P', cursive;
    font-size: 0.6rem;
    background: #ff00ff;
    color: #fff;
    border: 4px solid #fff;
    box-shadow:
        0 0 20px #ff00ff,
        inset 0 0 10px rgba(255,255,255,0.3);
    pointer-events: all;
    touch-action: manipulation;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
}

#interact-button:active {
    transform: scale(0.9);
    background: #00ffff;
    box-shadow:
        0 0 30px #00ffff,
        inset 0 0 20px rgba(255,255,255,0.5);
}

#ability-button {
    position: absolute;
    right: 20px;
    bottom: 140px;
    width: 100px;
    height: 100px;
    border-radius: 50%;
    font-family: 'Press Start 2P', cursive;
    font-size: 0.6rem;
    background: #ffaa00;
    color: #fff;
    border: 4px solid #fff;
    box-shadow:
        0 0 20px #ffaa00,
        inset 0 0 10px rgba(255,255,255,0.3);
    pointer-events: all;
    cursor: pointer;
    touch-action: manipulation;
    transition: all 0.1s;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
}

#ability-button:hover {
    transform: scale(1.05);
}

#ability-button:active {
    transform: scale(0.9);
    background: #ff00aa;
    box-shadow:
        0 0 30px #ff00aa,
        inset 0 0 20px rgba(255,255,255,0.5);
}

/* ===================================
   MODAL (Info Boxes)
   =================================== */

.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.85);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    pointer-events: all;
    padding: 20px;
}

.modal-content {
    background: #0a0015;
    border: 4px solid #00ffff;
    padding: 20px;
    max-width: 500px;
    width: 90vw;
    min-height: 400px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow:
        0 0 30px #00ffff,
        inset 0 0 30px rgba(0,255,255,0.1);
    position: relative;
}

.modal-content h2 {
    color: #ff00ff;
    font-size: clamp(0.9rem, 3vw, 1.5rem);
    margin-bottom: 20px;
    padding-top: 10px;
    padding-right: 45px;
    text-shadow: 0 0 10px #ff00ff;
}

.modal-content h3 {
    color: #00ffff;
    font-size: clamp(0.7rem, 2.5vw, 1rem);
    margin-top: 20px;
    margin-bottom: 10px;
}

.modal-content p {
    color: #ccc;
    font-size: clamp(0.6rem, 2vw, 0.7rem);
    line-height: 1.6;
    margin-bottom: 15px;
}

.modal-content ul {
    list-style: none;
    padding-left: 0;
}

.modal-content li {
    color: #aaa;
    font-size: clamp(0.6rem, 2vw, 0.7rem);
    line-height: 1.8;
    padding-left: 20px;
    position: relative;
}

.modal-content li::before {
    content: '▸';
    position: absolute;
    left: 0;
    color: #ff00ff;
}

.modal-content a {
    color: #00ffff;
    text-decoration: none;
    border-bottom: 1px solid #00ffff;
}

.modal-content a:hover {
    color: #ff00ff;
    border-bottom-color: #ff00ff;
}

.close-button {
    position: absolute;
    top: 15px;
    right: 15px;
    background: #ff00ff;
    border: 2px solid #fff;
    color: #fff;
    font-size: clamp(1rem, 4vw, 1.5rem);
    width: 40px;
    height: 40px;
    cursor: pointer;
    font-family: Arial, sans-serif;
    line-height: 1;
    box-shadow: 0 0 10px #ff00ff;
    touch-action: manipulation;
    z-index: 10;
}

.close-button:active {
    background: #00ffff;
    box-shadow: 0 0 20px #00ffff;
}

/* Sequencer Modal */
.sequencer-modal-content {
    position: relative;
    width: 95vw;
    height: 95vh;
    max-width: 1400px;
    max-height: 900px;
    background: rgba(0, 0, 0, 0.95);
    border: 3px solid #ff00ff;
    box-shadow: 0 0 30px #ff00ff;
    overflow: hidden;
}

.sequencer-close-button {
    position: absolute;
    top: 10px;
    right: 10px;
    background: #ff00ff;
    border: 2px solid #fff;
    color: #fff;
    font-size: 1.5rem;
    width: 40px;
    height: 40px;
    cursor: pointer;
    font-family: Arial, sans-serif;
    line-height: 1;
    box-shadow: 0 0 10px #ff00ff;
    touch-action: manipulation;
    z-index: 1000;
}

.sequencer-close-button:hover {
    background: #00ffff;
    box-shadow: 0 0 20px #00ffff;
}

.sequencer-close-button:active {
    background: #00ffff;
    box-shadow: 0 0 20px #00ffff;
}

/* ===================================
   SEQUENCER UI
   =================================== */

.sequencer-ui {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.95);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.sequencer-ui.hidden {
    display: none;
}

.sequencer-panel {
    background: rgba(20, 20, 20, 0.98);
    border: 3px solid #ff00ff;
    box-shadow: 0 0 30px #ff00ff;
    padding: 20px;
    max-width: 900px;
    max-height: 90vh;
    overflow-y: auto;
    font-family: 'Press Start 2P', monospace;
}

.sequencer-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 2px solid #ff00ff;
}

.sequencer-header h2 {
    color: #ff00ff;
    font-size: clamp(0.8rem, 3vw, 1.2rem);
    margin: 0;
    text-shadow: 0 0 10px #ff00ff;
}

.sequencer-close {
    background: #ff00ff;
    border: 2px solid #fff;
    color: #fff;
    font-size: 2rem;
    width: 40px;
    height: 40px;
    cursor: pointer;
    font-family: Arial, sans-serif;
    line-height: 1;
    box-shadow: 0 0 10px #ff00ff;
}

.sequencer-close:hover {
    background: #00ffff;
    box-shadow: 0 0 20px #00ffff;
}

.sequencer-controls {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    flex-wrap: wrap;
    align-items: center;
}

.seq-btn {
    background: rgba(0, 0, 0, 0.8);
    border: 2px solid #00ffff;
    color: #00ffff;
    padding: 10px 15px;
    font-family: 'Press Start 2P', monospace;
    font-size: 0.6rem;
    cursor: pointer;
    box-shadow: 0 0 10px rgba(0, 255, 255, 0.3);
    transition: all 0.3s;
}

.seq-btn:hover {
    background: rgba(0, 255, 255, 0.2);
    box-shadow: 0 0 20px #00ffff;
}

.seq-btn.primary {
    border-color: #ff00ff;
    color: #ff00ff;
    box-shadow: 0 0 10px rgba(255, 0, 255, 0.3);
}

.seq-btn.primary:hover {
    background: rgba(255, 0, 255, 0.2);
    box-shadow: 0 0 20px #ff00ff;
}

.seq-btn.primary.playing {
    background: rgba(255, 0, 255, 0.3);
}

.bpm-control {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-left: auto;
}

.bpm-control label {
    color: #00ffff;
    font-size: 0.6rem;
}

#seq-bpm {
    width: 150px;
}

.seq-instrument {
    margin-bottom: 20px;
    padding: 15px;
    background: rgba(0, 0, 0, 0.5);
    border: 2px solid rgba(255, 0, 255, 0.3);
}

.seq-label {
    color: #ff6b35;
    font-size: 0.7rem;
    margin-bottom: 10px;
    text-shadow: 0 0 5px #ff6b35;
}

.seq-grid {
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    gap: 8px;
    margin-bottom: 15px;
}

.beat-box {
    aspect-ratio: 1;
    background: rgba(0, 0, 0, 0.8);
    border: 2px solid #666;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 0.7rem;
    color: #666;
    transition: all 0.2s;
    user-select: none;
}

.beat-box:hover {
    border-color: #00ffff;
    box-shadow: 0 0 10px rgba(0, 255, 255, 0.5);
}

.beat-box.active {
    background: linear-gradient(135deg, #ff00ff, #ff6ec7);
    border-color: #ff00ff;
    color: #fff;
    box-shadow: 0 0 15px #ff00ff;
}

.beat-box.playing {
    border-color: #00ff00;
    box-shadow: 0 0 20px #00ff00, inset 0 0 10px rgba(0, 255, 0, 0.3);
    animation: pulse-beat 0.2s ease-in-out;
}

@keyframes pulse-beat {
    0% { transform: scale(1); }
    50% { transform: scale(1.1); }
    100% { transform: scale(1); }
}

.seq-controls {
    display: flex;
    gap: 20px;
}

.seq-controls .control-group {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
}

.seq-controls label {
    color: #00d9ff;
    font-size: 0.6rem;
    min-width: 40px;
}

.seq-controls input[type="range"] {
    flex: 1;
    min-width: 100px;
}

.seq-controls .value-display {
    color: #ff6ec7;
    font-size: 0.6rem;
    min-width: 30px;
    text-align: right;
}

/* ===================================
   END SCREEN
   =================================== */

.stats-box {
    background: rgba(0, 0, 0, 0.5);
    border: 3px solid #00ffff;
    padding: 20px;
    margin: 40px auto;
    max-width: 500px;
    box-shadow: 0 0 20px #00ffff;
}

.stat-item {
    display: flex;
    justify-content: space-between;
    margin: 15px 0;
    font-size: clamp(0.6rem, 2vw, 0.7rem);
    flex-wrap: wrap;
    gap: 10px;
}

.stat-label {
    color: #00ffff;
}

.stat-value {
    color: #ff00ff;
    text-shadow: 0 0 5px #ff00ff;
}

.contact-heading {
    font-size: clamp(0.9rem, 3vw, 1.2rem);
    color: #ff6b35;
    margin: 40px 0 20px;
    text-shadow: 0 0 10px #ff6b35;
}

.contact-info {
    margin: 20px 0;
    font-size: clamp(0.6rem, 2.5vw, 0.8rem);
    line-height: 2;
}

.contact-info a {
    color: #00ffff;
    text-decoration: none;
}

.contact-info a:hover {
    color: #ff00ff;
}

/* ===================================
   SCROLLBAR STYLING
   =================================== */

.modal-content::-webkit-scrollbar {
    width: 10px;
}

.modal-content::-webkit-scrollbar-track {
    background: #0a0015;
}

.modal-content::-webkit-scrollbar-thumb {
    background: #ff00ff;
    border: 2px solid #0a0015;
}

.modal-content::-webkit-scrollbar-thumb:hover {
    background: #00ffff;
}

/* ===================================
   MOBILE OPTIMIZATIONS
   =================================== */

@media (max-width: 768px) {
    .hud-item {
        padding: 6px 12px;
    }

    .modal-content {
        padding: 15px;
        max-width: 95vw;
        width: 95vw;
    }

    .modal-content h2 {
        padding-top: 30px;
        padding-right: 40px;
    }

    .close-button {
        width: 35px;
        height: 35px;
        font-size: 1rem;
    }
}

/* Landscape mobile */
@media (max-width: 896px) and (orientation: landscape) {
    #joystick-zone {
        width: 120px;
        height: 120px;
    }

    #joystick-base {
        width: 120px;
        height: 120px;
    }

    #joystick-stick {
        width: 50px;
        height: 50px;
    }

    #interact-button {
        width: 80px;
        height: 80px;
        font-size: 0.5rem;
    }

    #ability-button {
        width: 80px;
        height: 80px;
        bottom: 120px;
        font-size: 0.5rem;
    }
}

/* ===================================
   CHARACTER SELECTION SCREEN
   =================================== */

.character-grid {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 30px;
    margin: 40px auto;
    max-width: 1400px;
}

.character-card {
    background: rgba(0, 0, 0, 0.7);
    border: 3px solid #00ffff;
    padding: 20px;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 220px;
    flex-shrink: 0;
}

.character-card:hover {
    transform: scale(1.05);
    border-color: #ff00ff;
    box-shadow:
        0 0 20px #ff00ff,
        0 0 40px #ff00ff,
        inset 0 0 20px rgba(255, 0, 255, 0.2);
}

.character-card.selected {
    border-color: #ffff00;
    box-shadow:
        0 0 30px #ffff00,
        0 0 60px #ffff00;
    animation: selectedPulse 1s infinite;
}

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

.character-display {
    width: 100%;
    height: 150px;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.character-card h3 {
    font-size: 1rem;
    color: #00ffff;
    margin: 10px 0 15px 0;
    text-shadow: 0 0 10px #00ffff;
    text-align: center;
}

.ability-name {
    font-size: 0.7rem;
    color: #ff00ff;
    margin-bottom: 10px;
    text-shadow: 0 0 5px #ff00ff;
    text-align: center;
    width: 100%;
}

.ability-desc {
    font-size: 0.5rem;
    color: #cccccc;
    line-height: 1.5;
    text-align: center;
    width: 100%;
}

.ability-hint {
    font-size: 0.7rem;
    color: #ffff00;
    text-shadow: 0 0 10px #ffff00;
    margin-top: 30px;
    animation: pulse 2s infinite;
}

@media (max-width: 768px) {
    .character-grid {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 15px;
    }

    .character-card {
        padding: 10px;
        width: auto;
    }

    .character-display {
        height: 60px;
        margin-bottom: 8px;
    }

    .character-card h3 {
        font-size: 0.5rem;
        margin: 5px 0 8px 0;
    }

    .ability-name {
        font-size: 0.4rem;
        margin-bottom: 4px;
    }

    .ability-desc {
        font-size: 0.35rem;
        line-height: 1.3;
    }
}

/* ===================================
   LOADING SCREEN
   =================================== */

.loading-container {
    margin-top: 60px;
    padding: 0 20px;
}

.loading-bar-outer {
    width: 100%;
    max-width: 600px;
    height: 40px;
    background: rgba(0, 0, 0, 0.7);
    border: 4px solid #00ffff;
    margin: 0 auto;
    position: relative;
    overflow: hidden;
    box-shadow:
        0 0 20px #00ffff,
        inset 0 0 20px rgba(0, 255, 255, 0.2);
}

.loading-bar-inner {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, #ff00ff, #00ffff, #ff00ff);
    background-size: 200% 100%;
    animation: loadingGradient 2s linear infinite;
    box-shadow: 0 0 20px #ff00ff;
    transition: width 0.3s ease-out;
}

@keyframes loadingGradient {
    0% { background-position: 0% 50%; }
    100% { background-position: 200% 50%; }
}

.loading-percentage {
    font-size: clamp(1rem, 4vw, 1.5rem);
    color: #ffff00;
    margin-top: 20px;
    text-shadow: 0 0 10px #ffff00;
    animation: pulse 2s infinite;
}

.loading-message {
    font-size: clamp(0.6rem, 2vw, 0.9rem);
    color: #ff00ff;
    margin-top: 30px;
    min-height: 60px;
    line-height: 1.6;
    text-shadow: 0 0 10px #ff00ff;
    animation: flicker 3s infinite;
}

@keyframes flicker {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.8; }
    75% { opacity: 0.9; }
}

@media (max-width: 768px) {
    .loading-bar-outer {
        height: 30px;
    }

    .loading-message {
        min-height: 80px;
    }
}

/* ===================================
   goodie POUCH
   =================================== */

.egg-pouch {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 1000;
}

.pouch-toggle {
    position: relative;
    background: rgba(139, 69, 19, 0.9);
    border: 3px solid #FFD700;
    border-radius: 50%;
    width: 70px;
    height: 70px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow:
        0 0 20px rgba(255, 215, 0, 0.5),
        inset 0 0 10px rgba(0, 0, 0, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
}

.pouch-toggle:hover {
    transform: scale(1.1) rotate(5deg);
    box-shadow:
        0 0 30px rgba(255, 215, 0, 0.8),
        inset 0 0 10px rgba(0, 0, 0, 0.3);
}

.pouch-toggle svg {
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.5));
}

.pouch-count {
    position: absolute;
    top: -5px;
    right: -5px;
    background: #ff00ff;
    color: #fff;
    border: 2px solid #fff;
    border-radius: 50%;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'Press Start 2P', cursive;
    font-size: 0.65rem;
    font-weight: bold;
    box-shadow: 0 0 10px #ff00ff;
    animation: pouchPulse 2s infinite;
}

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

.pouch-content {
    position: absolute;
    bottom: 80px;
    right: 0;
    width: 320px;
    max-height: 450px;
    background: rgba(10, 10, 10, 0.95);
    border: 3px solid #00ffff;
    border-radius: 10px;
    padding: 15px;
    display: none;
    box-shadow:
        0 0 30px rgba(0, 255, 255, 0.5),
        inset 0 0 20px rgba(0, 0, 0, 0.5);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    touch-action: pan-y;
}

.pouch-content.active {
    display: block;
    animation: pouchSlideIn 0.3s ease-out;
}

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

.pouch-title {
    font-family: 'Press Start 2P', cursive;
    font-size: 0.75rem;
    color: #00ffff;
    text-align: center;
    margin: 0 0 15px 0;
    text-shadow: 0 0 10px #00ffff;
    padding-bottom: 10px;
    border-bottom: 2px solid #00ffff;
}

.pouch-items {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}

.pouch-item {
    background: rgba(0, 255, 255, 0.1);
    border: 2px solid #00ffff;
    border-radius: 8px;
    padding: 10px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    transition: all 0.3s ease;
    cursor: pointer;
}

.pouch-item:hover {
    background: rgba(0, 255, 255, 0.2);
    border-color: #ff00ff;
    transform: translateY(-3px);
    box-shadow: 0 5px 15px rgba(255, 0, 255, 0.3);
}

.pouch-item svg {
    width: 60px;
    height: 60px;
    filter: drop-shadow(0 2px 8px rgba(0, 255, 255, 0.5));
}

.pouch-item-name {
    font-family: 'Press Start 2P', cursive;
    font-size: 0.45rem;
    color: #00ffff;
    text-align: center;
    line-height: 1.4;
    text-shadow: 0 0 5px #00ffff;
}

.pouch-item.new {
    animation: newItemPulse 1s ease-out;
}

@keyframes newItemPulse {
    0% {
        transform: scale(0) rotate(0deg);
        opacity: 0;
    }
    50% {
        transform: scale(1.2) rotate(180deg);
    }
    100% {
        transform: scale(1) rotate(360deg);
        opacity: 1;
    }
}

/* Pouch scrollbar */
.pouch-content::-webkit-scrollbar {
    width: 8px;
}

.pouch-content::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.5);
    border-radius: 4px;
}

.pouch-content::-webkit-scrollbar-thumb {
    background: #00ffff;
    border-radius: 4px;
    box-shadow: 0 0 5px #00ffff;
}

.pouch-content::-webkit-scrollbar-thumb:hover {
    background: #ff00ff;
    box-shadow: 0 0 10px #ff00ff;
}

@media (max-width: 768px) {
    .egg-pouch {
        bottom: 100px;
        right: 10px;
    }

    .pouch-toggle {
        width: 60px;
        height: 60px;
    }

    .pouch-toggle svg {
        width: 40px;
        height: 40px;
    }

    .pouch-count {
        width: 24px;
        height: 24px;
        font-size: 0.55rem;
    }

    .pouch-content {
        width: 280px;
        max-height: 350px;
        bottom: 70px;
    }

    .pouch-items {
        grid-template-columns: 1fr;
    }

    /* Sequencer slider adjustments for mobile */
    .seq-controls input[type="range"] {
        min-width: 60px;
        max-width: 80px;
    }

    .seq-controls {
        gap: 10px;
    }

    .seq-controls .control-group {
        gap: 5px;
    }

    .seq-controls label {
        min-width: 30px;
        font-size: 0.5rem;
    }

    .seq-controls .value-display {
        min-width: 25px;
        font-size: 0.5rem;
    }

    /* Sequencer buttons in one row on mobile */
    .sequencer-controls {
        flex-wrap: wrap;
        gap: 10px;
    }

    .seq-btn {
        padding: 10px 12px;
        font-size: 0.5rem;
        white-space: nowrap;
        flex: 1;
        min-width: 0;
    }

    .bpm-control {
        margin-left: 0;
        flex-basis: 100%;
        width: 100%;
        justify-content: center;
    }

    .bpm-control label {
        font-size: 0.5rem;
    }

    #seq-bpm {
        flex: 1;
        max-width: 200px;
    }
}
