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

body {
    font-family: 'Bricolage Grotesque', sans-serif;
    background: linear-gradient(135deg, #0f0a1e 0%, #1a0f2e 50%, #0d0818 100%);
    min-height: 100vh;
    overflow: hidden;
    color: #fff;
}

#canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
}

#header {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    text-align: center;
    z-index: 10;
    pointer-events: none;
}

#header h1 {
    font-size: 2.5rem;
    font-weight: 800;
    background: linear-gradient(90deg, #ff6b6b, #feca57, #54a0ff, #f706cf);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-shadow: 0 0 40px rgba(247, 6, 207, 0.3);
    animation: shimmer 3s ease-in-out infinite;
}

@keyframes shimmer {
    0%, 100% { filter: brightness(1); }
    50% { filter: brightness(1.2); }
}

.sparkle {
    display: inline-block;
    animation: spin 4s linear infinite;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.subtitle {
    font-size: 1rem;
    font-weight: 200;
    color: rgba(255, 255, 255, 0.5);
    margin-top: 5px;
    letter-spacing: 2px;
}

.vibe-meter-container {
    margin-top: 15px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
}

.vibe-meter-label {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 3px;
    color: rgba(255, 255, 255, 0.4);
}

.vibe-meter {
    width: 200px;
    height: 6px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
    overflow: hidden;
}

.vibe-meter-fill {
    height: 100%;
    width: 0%;
    background: #54a0ff;
    border-radius: 3px;
    transition: width 0.3s ease, background 0.5s ease;
}

#inputArea {
    position: fixed;
    bottom: 80px;
    left: 50%;
    transform: translateX(-50%);
    width: 90%;
    max-width: 700px;
    z-index: 10;
}

#codeInput {
    width: 100%;
    height: 120px;
    background: rgba(20, 15, 40, 0.7);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    padding: 20px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 1rem;
    color: rgba(255, 255, 255, 0.8);
    resize: none;
    outline: none;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

#codeInput::placeholder {
    color: rgba(255, 255, 255, 0.3);
}

#codeInput:focus {
    border-color: rgba(247, 6, 207, 0.5);
    box-shadow: 0 0 30px rgba(247, 6, 207, 0.2);
}

.char-count {
    text-align: right;
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.3);
    margin-top: 8px;
    font-family: 'JetBrains Mono', monospace;
}

#controls {
    position: fixed;
    top: 20px;
    left: 20px;
    z-index: 20;
}

.control-toggle, .stats-toggle {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: rgba(20, 15, 40, 0.8);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    font-size: 1.5rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.control-toggle:hover, .stats-toggle:hover {
    background: rgba(247, 6, 207, 0.3);
    transform: scale(1.1);
}

#controlPanel, #statsPanel {
    position: absolute;
    top: 60px;
    left: 0;
    background: rgba(20, 15, 40, 0.9);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    padding: 20px;
    min-width: 250px;
    transition: all 0.3s ease;
}

#statsPanel {
    left: auto;
    right: 0;
}

.hidden {
    opacity: 0;
    pointer-events: none;
    transform: translateY(-10px);
}

.control-group {
    margin-bottom: 20px;
}

.control-group label {
    display: block;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 2px;
    color: rgba(255, 255, 255, 0.5);
    margin-bottom: 10px;
}

.vibe-buttons, .palette-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.vibe-btn, .palette-btn {
    padding: 8px 16px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    color: rgba(255, 255, 255, 0.7);
    font-family: 'Bricolage Grotesque', sans-serif;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.vibe-btn:hover, .palette-btn:hover {
    background: rgba(255, 255, 255, 0.1);
}

.vibe-btn.active, .palette-btn.active {
    background: linear-gradient(135deg, #f706cf, #54a0ff);
    border-color: transparent;
    color: #fff;
}

input[type="range"] {
    width: 100%;
    height: 6px;
    -webkit-appearance: none;
    appearance: none;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
    outline: none;
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    background: linear-gradient(135deg, #f706cf, #54a0ff);
    border-radius: 50%;
    cursor: pointer;
}

.clear-btn {
    width: 100%;
    padding: 12px;
    background: rgba(255, 107, 107, 0.2);
    border: 1px solid rgba(255, 107, 107, 0.3);
    border-radius: 12px;
    color: #ff6b6b;
    font-family: 'Bricolage Grotesque', sans-serif;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.clear-btn:hover {
    background: rgba(255, 107, 107, 0.4);
}

#stats {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 20;
}

#statsPanel h3 {
    font-size: 1rem;
    font-weight: 700;
    margin-bottom: 15px;
    background: linear-gradient(90deg, #54a0ff, #f706cf);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.stat-row {
    display: flex;
    justify-content: space-between;
    font-size: 0.85rem;
    margin-bottom: 8px;
    color: rgba(255, 255, 255, 0.7);
}

.stat-row span:last-child {
    font-family: 'JetBrains Mono', monospace;
    color: #54a0ff;
}

#achievements {
    margin-top: 15px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.achievement-badge {
    padding: 8px 12px;
    background: linear-gradient(135deg, rgba(254, 202, 87, 0.2), rgba(247, 6, 207, 0.2));
    border: 1px solid rgba(254, 202, 87, 0.3);
    border-radius: 8px;
    font-size: 0.8rem;
    animation: unlockPop 0.5s ease;
}

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

#footer {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    align-items: center;
    gap: 20px;
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.4);
    z-index: 10;
}

#footer a {
    color: #54a0ff;
    text-decoration: none;
    transition: color 0.3s ease;
}

#footer a:hover {
    color: #f706cf;
}

#shareBtn {
    padding: 8px 16px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 20px;
    color: rgba(255, 255, 255, 0.8);
    font-family: 'Bricolage Grotesque', sans-serif;
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

#shareBtn:hover {
    background: rgba(247, 6, 207, 0.3);
    border-color: rgba(247, 6, 207, 0.5);
}

@media (max-width: 768px) {
    #header h1 {
        font-size: 1.8rem;
    }
    
    .subtitle {
        font-size: 0.8rem;
    }
    
    .vibe-meter {
        width: 150px;
    }
    
    #inputArea {
        bottom: 70px;
        width: 95%;
    }
    
    #codeInput {
        height: 100px;
        font-size: 0.9rem;
        padding: 15px;
    }
    
    .control-toggle, .stats-toggle {
        width: 44px;
        height: 44px;
        font-size: 1.2rem;
    }
    
    #controlPanel, #statsPanel {
        min-width: 200px;
        padding: 15px;
    }
    
    .vibe-btn, .palette-btn {
        padding: 6px 12px;
        font-size: 0.75rem;
    }
    
    #footer {
        flex-wrap: wrap;
        justify-content: center;
        gap: 10px;
        font-size: 0.7rem;
        padding: 0 20px;
    }
}

@media (max-width: 480px) {
    #header {
        top: 10px;
    }
    
    #header h1 {
        font-size: 1.5rem;
    }
    
    #controls {
        left: 10px;
        top: 10px;
    }
    
    #stats {
        right: 10px;
        top: 10px;
    }
    
    #inputArea {
        bottom: 60px;
    }
    
    #codeInput {
        height: 80px;
    }
}