:root {
    --primary-red: #FF0000;
    --dark-red: #8B0000;
    --bright-red: #FF3333;
    --deep-black: #000000;
    --dark-gray: #0A0A0A;
    --medium-gray: #1A1A1A;
    --light-gray: #333333;
    --glow-intensity: 0 0 15px;
}

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

@import url('https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@300;400;500;700&display=swap');

body {
    background: var(--deep-black);
    color: white;
    font-family: 'JetBrains Mono', 'Consolas', 'Monaco', 'Courier New', monospace;
    overflow-x: hidden;
    min-height: 100vh;
    background-image: 
        radial-gradient(circle at 20% 50%, var(--dark-red) 0%, transparent 70%),
        radial-gradient(circle at 80% 80%, var(--dark-red) 0%, transparent 70%);
    background-size: 300% 300%;
    animation: backgroundShift 30s ease-in-out infinite;
}

@keyframes backgroundShift {
    0%, 100% { background-position: 0% 0%; }
    33% { background-position: 100% 50%; }
    66% { background-position: 50% 100%; }
}

.container {
    display: flex;
    min-height: 100vh;
    margin: 0;
    padding: 0;
}

/* Sidebar Layout */
.sidebar {
    width: 350px;
    min-width: 350px;
    background: var(--dark-gray);
    border-right: 2px solid var(--primary-red);
    box-shadow: 2px 0 10px rgba(255, 0, 0, 0.2);
    overflow-y: auto;
    height: 100vh;
}

.sidebar-header {
    text-align: center;
    padding: 20px 15px 15px 15px;
    border-bottom: 1px solid var(--light-gray);
    margin-bottom: 20px;
}

.sidebar-title {
    font-size: 1.8rem;
    font-weight: 700;
    font-family: 'JetBrains Mono', monospace;
    color: var(--primary-red);
    letter-spacing: 0.1em;
    margin: 0;
    text-shadow: 0 0 10px var(--primary-red);
}

.sidebar-subtitle {
    font-size: 0.9rem;
    font-weight: 300;
    color: var(--bright-red);
    margin: 5px 0 0 0;
    opacity: 0.8;
}

.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: var(--deep-black);
}

/* Old header styles - no longer needed */
header {
    display: none;
}

.glitch {
    font-size: 4rem;
    font-weight: 700;
    font-family: 'JetBrains Mono', monospace;
    text-transform: uppercase;
    position: relative;
    color: var(--primary-red);
    letter-spacing: 0.15em;
    text-shadow: 
        var(--glow-intensity) var(--primary-red);
    animation: subtle-glow 3s ease-in-out infinite;
}

@keyframes subtle-glow {
    0%, 100% {
        text-shadow: 
            var(--glow-intensity) var(--primary-red);
        opacity: 1;
    }
    50% {
        text-shadow: 
            0 0 25px var(--primary-red),
            0 0 35px var(--dark-red);
        opacity: 0.9;
    }
}


.subtitle {
    font-size: 1.2rem;
    font-weight: 300;
    color: var(--bright-red);
    margin-top: 10px;
    text-shadow: 0 0 10px var(--bright-red);
    opacity: 0.8;
}

.controls-panel {
    padding: 0 15px 15px 15px;
    background: transparent;
    border: none;
    box-shadow: none;
    flex: 1;
}

.controls-grid {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.control-section {
    padding: 15px 0;
    margin-bottom: 10px;
    border-bottom: 1px solid rgba(255, 0, 0, 0.1);
}

.control-section:last-child {
    border-bottom: none;
    margin-bottom: 0;
}

.tab-container {
    width: 100%;
}

.tab-content {
    width: 100%;
    min-height: 300px;
}

.tabs {
    display: flex;
    border-bottom: 1px solid var(--light-gray);
    margin-bottom: 15px;
    width: 100%;
}

.tab-btn {
    background: transparent;
    border: none;
    padding: 8px 15px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.85rem;
    color: #999;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    transition: all 0.3s ease;
    flex: 1;
    text-align: center;
}

.tab-btn.active {
    color: var(--primary-red);
    border-bottom-color: var(--primary-red);
}

.tab-btn:hover {
    color: var(--bright-red);
}

.tab-panel {
    display: none;
    width: 100%;
}

.tab-panel.active {
    display: block;
}

.about-content {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.85rem;
    line-height: 1.6;
    color: #ccc;
    padding: 10px;
    width: 100%;
    max-width: 100%;
}

.about-content h4 {
    color: var(--primary-red);
    margin: 15px 0 8px 0;
    font-size: 0.95rem;
    text-shadow: 0 0 5px rgba(255, 0, 0, 0.3);
}

.about-content h4:first-child {
    margin-top: 0;
}

.about-content h5 {
    color: var(--bright-red);
    margin: 12px 0 5px 0;
    font-size: 0.85rem;
    font-weight: 500;
}

.about-content p {
    margin: 8px 0;
}

.about-content ul {
    margin: 8px 0;
    padding-left: 20px;
}

.about-content li {
    margin: 5px 0;
}

.about-content strong {
    color: var(--bright-red);
}

/* Audio Controls */
.audio-controls {
    margin-top: 15px;
}

/* Audio Input Controls */
.audio-input-controls {
    margin-top: 15px;
}

.audio-status {
    margin: 10px 0;
    padding: 8px;
    background: rgba(255, 0, 0, 0.05);
    border: 1px solid var(--dark-red);
    border-radius: 4px;
    text-align: center;
}

.audio-input-status {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.8rem;
    color: var(--bright-red);
}

.audio-visualization {
    margin-top: 10px;
    padding: 10px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 4px;
    border: 1px solid var(--light-gray);
}

.volume-meter {
    width: 100%;
    height: 8px;
    background: var(--deep-black);
    border: 1px solid var(--light-gray);
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 8px;
}

.volume-bar {
    height: 100%;
    background: linear-gradient(to right, 
        var(--primary-red) 0%, 
        var(--bright-red) 50%, 
        #FFD700 80%, 
        #FF4500 100%);
    width: 0%;
    transition: width 0.1s ease;
}

.frequency-display {
    text-align: center;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.75rem;
    color: var(--bright-red);
    min-height: 1.2em;
}

/* Dance Controls */
.dance-controls {
    margin-top: 15px;
}

.control-label {
    display: block;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.8rem;
    color: #ccc;
    margin: 10px 0 5px 0;
}

.control-select {
    width: 100%;
    padding: 8px;
    background: var(--medium-gray);
    border: 1px solid var(--light-gray);
    border-radius: 4px;
    color: white;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.control-select:hover {
    border-color: var(--primary-red);
}

.control-select:focus {
    outline: none;
    border-color: var(--primary-red);
    box-shadow: 0 0 5px rgba(255, 0, 0, 0.3);
}

.control-select option {
    background: var(--dark-gray);
    color: white;
}

.volume-control {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin: 8px 0;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.85rem;
    color: #ccc;
}

.volume-control span {
    min-width: 60px;
}

.volume-slider {
    width: 100px;
    height: 6px;
    border-radius: 3px;
    background: linear-gradient(to right, var(--deep-black), var(--dark-red), var(--primary-red));
    outline: none;
    -webkit-appearance: none;
    border: 1px solid var(--light-gray);
}

.volume-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 14px;
    height: 14px;
    border-radius: 1px;
    background: var(--primary-red);
    cursor: pointer;
    box-shadow: 0 0 5px rgba(255, 0, 0, 0.3);
    border: 1px solid var(--bright-red);
}

.control-section h3 {
    color: var(--primary-red);
    margin-bottom: 15px;
    font-weight: 500;
    text-shadow: 0 0 8px var(--primary-red);
    font-size: 1.1rem;
}

.control-btn {
    background: linear-gradient(135deg, var(--dark-red), var(--primary-red));
    color: white;
    border: 1px solid var(--primary-red);
    padding: 10px 15px;
    margin: 3px 0;
    border-radius: 4px;
    cursor: pointer;
    font-family: 'JetBrains Mono', monospace;
    font-weight: 500;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(255, 0, 0, 0.3);
    width: 100%;
    display: block;
}

.control-btn:hover {
    background: linear-gradient(135deg, var(--primary-red), var(--bright-red));
    transform: translateY(-1px);
    box-shadow: 0 4px 15px rgba(255, 0, 0, 0.5);
}

.control-btn.special {
    background: linear-gradient(135deg, var(--deep-black), var(--dark-red));
    border: 1px solid var(--dark-red);
    animation: danger-pulse 2s infinite;
}

@keyframes danger-pulse {
    0%, 100% { 
        box-shadow: 0 2px 8px rgba(139, 0, 0, 0.5);
    }
    50% { 
        box-shadow: 0 2px 8px rgba(139, 0, 0, 0.8), 0 0 15px rgba(139, 0, 0, 0.3);
    }
}

.toggle {
    display: flex;
    align-items: center;
    margin: 10px 0;
    cursor: pointer;
}

.toggle input {
    margin-right: 10px;
    width: 18px;
    height: 18px;
    accent-color: var(--primary-red);
}

.toggle-label {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.9rem;
    color: #ccc;
}

.slider {
    width: 100%;
    height: 8px;
    border-radius: 4px;
    background: linear-gradient(to right, var(--deep-black), var(--dark-red), var(--primary-red));
    outline: none;
    -webkit-appearance: none;
    border: 1px solid var(--light-gray);
}

.slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 2px;
    background: var(--primary-red);
    cursor: pointer;
    box-shadow: 0 0 8px rgba(255, 0, 0, 0.5);
    border: 1px solid var(--bright-red);
}

.stats-section {
    background: rgba(255, 0, 0, 0.05);
    padding: 15px;
    border-radius: 6px;
    border: 1px solid var(--dark-red);
}

.stat {
    margin: 8px 0;
    font-size: 0.95rem;
    font-family: 'JetBrains Mono', monospace;
    color: var(--bright-red);
    text-shadow: 0 0 3px rgba(255, 51, 51, 0.3);
}

.canvas-container {
    position: relative;
    width: 100%;
    height: 100vh;
    border: none;
    border-radius: 0;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--deep-black);
}

#lifeCanvas {
    display: block;
    max-width: 100%;
    max-height: 100%;
    background: #000000;
    image-rendering: pixelated;
    border: 2px solid var(--primary-red);
    box-shadow: 0 0 30px rgba(255, 0, 0, 0.5);
}

.overlay-effects {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    background: 
        repeating-linear-gradient(
            0deg,
            transparent,
            transparent 2px,
            rgba(255, 255, 255, 0.03) 2px,
            rgba(255, 255, 255, 0.03) 4px
        );
    animation: scanlines 8s linear infinite;
}

@keyframes scanlines {
    0% { transform: translateY(0); }
    100% { transform: translateY(10px); }
}

.midi-ready {
    text-align: center;
    margin-top: 30px;
    padding: 15px;
    background: rgba(255, 0, 0, 0.05);
    border: 1px solid var(--dark-red);
    border-radius: 4px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.9rem;
    animation: midi-pulse 4s ease-in-out infinite;
}

@keyframes midi-pulse {
    0%, 100% { opacity: 0.5; }
    50% { opacity: 1; }
}

.sidebar-footer {
    margin-top: auto;
    padding: 15px;
    border-top: 1px solid var(--light-gray);
    text-align: center;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.8rem;
}

.sidebar-footer p {
    margin: 0;
    color: #999;
}

.sidebar-footer a {
    color: var(--primary-red);
    text-decoration: none;
    font-weight: 500;
    transition: all 0.3s ease;
}

.sidebar-footer a:hover {
    color: var(--bright-red);
    text-decoration: underline;
}

.midi-status {
    padding: 10px 15px;
    text-align: center;
}

.midi-ready {
    background: rgba(255, 0, 0, 0.05);
    border: 1px solid var(--dark-red);
    border-radius: 4px;
    padding: 8px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.8rem;
}

.midi-ready p {
    margin: 0;
    color: var(--bright-red);
}

/* MIDI Visual Feedback Animations */
.midi-flash {
    animation: midi-button-flash 0.3s ease-out;
}

.midi-flash-intense {
    animation: midi-button-flash-intense 0.5s ease-out;
}

@keyframes midi-button-flash {
    0% { 
        background: linear-gradient(135deg, var(--dark-red), var(--primary-red));
        transform: scale(1);
        box-shadow: 0 2px 8px rgba(255, 0, 0, 0.3);
    }
    50% { 
        background: linear-gradient(135deg, var(--primary-red), var(--bright-red));
        transform: scale(1.05);
        box-shadow: 0 4px 20px rgba(255, 0, 0, 0.8);
    }
    100% { 
        background: linear-gradient(135deg, var(--dark-red), var(--primary-red));
        transform: scale(1);
        box-shadow: 0 2px 8px rgba(255, 0, 0, 0.3);
    }
}

@keyframes midi-button-flash-intense {
    0% { 
        background: linear-gradient(135deg, var(--dark-red), var(--primary-red));
        transform: scale(1);
        box-shadow: 0 2px 8px rgba(255, 0, 0, 0.3);
    }
    25% { 
        background: linear-gradient(135deg, var(--primary-red), var(--bright-red));
        transform: scale(1.1);
        box-shadow: 0 6px 25px rgba(255, 0, 0, 1);
    }
    50% { 
        background: linear-gradient(135deg, var(--bright-red), #FF6666);
        transform: scale(1.05);
        box-shadow: 0 8px 30px rgba(255, 0, 0, 0.9);
    }
    100% { 
        background: linear-gradient(135deg, var(--dark-red), var(--primary-red));
        transform: scale(1);
        box-shadow: 0 2px 8px rgba(255, 0, 0, 0.3);
    }
}

/* MIDI Feedback Messages */
.midi-feedback {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0, 0, 0, 0.9);
    color: white;
    padding: 15px 25px;
    border-radius: 8px;
    font-family: 'JetBrains Mono', monospace;
    font-weight: 500;
    font-size: 1.2rem;
    z-index: 1000;
    pointer-events: none;
    animation: midi-feedback-animation 1.5s ease-out forwards;
    border: 2px solid var(--primary-red);
    box-shadow: 0 0 20px rgba(255, 0, 0, 0.5);
}

/* Audio Input Feedback Messages */
.audio-feedback {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0, 0, 0, 0.9);
    color: white;
    padding: 15px 25px;
    border-radius: 8px;
    font-family: 'JetBrains Mono', monospace;
    font-weight: 500;
    font-size: 1.2rem;
    z-index: 1000;
    pointer-events: none;
    animation: audio-feedback-animation 2s ease-out forwards;
    border: 2px solid #00FF00;
    box-shadow: 0 0 20px rgba(0, 255, 0, 0.5);
}

.audio-feedback-thanos {
    color: var(--dark-red);
    border-color: var(--dark-red);
    box-shadow: 0 0 20px rgba(139, 0, 0, 0.8);
}

@keyframes audio-feedback-animation {
    0% {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0.5);
    }
    20% {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1.1);
    }
    80% {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1);
    }
    100% {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0.9);
    }
}

.midi-feedback-spawn {
    color: var(--bright-red);
    border-color: var(--bright-red);
}

.midi-feedback-kill {
    color: var(--dark-red);
    border-color: var(--dark-red);
}

.midi-feedback-radiation {
    color: #FFD700;
    border-color: #FFD700;
    box-shadow: 0 0 20px rgba(255, 215, 0, 0.5);
    animation: radiation-feedback-animation 2s ease-out forwards;
}

@keyframes midi-feedback-animation {
    0% {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0.5);
    }
    20% {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1.1);
    }
    80% {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1);
    }
    100% {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0.9);
    }
}

@keyframes radiation-feedback-animation {
    0% {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0.5);
    }
    10% {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1.2);
    }
    90% {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1);
    }
    100% {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0.8);
    }
}

/* Toggle flash animation */
.toggle.midi-flash {
    animation: toggle-flash 0.3s ease-out;
}

@keyframes toggle-flash {
    0% { 
        background: transparent; 
    }
    50% { 
        background: rgba(255, 0, 0, 0.2);
        border-radius: 4px;
    }
    100% { 
        background: transparent; 
    }
}

/* Slider flash animation */
.slider.midi-flash-intense {
    animation: slider-flash 2s ease-out;
}

@keyframes slider-flash {
    0%, 100% { 
        background: linear-gradient(to right, var(--deep-black), var(--dark-red), var(--primary-red));
    }
    50% { 
        background: linear-gradient(to right, #FFD700, #FF8C00, var(--primary-red));
        box-shadow: 0 0 15px rgba(255, 215, 0, 0.8);
    }
}

@media (max-width: 768px) {
    .glitch {
        font-size: 2.5rem;
    }
    
    .controls-panel {
        grid-template-columns: 1fr;
    }
    
    .midi-feedback {
        font-size: 1rem;
        padding: 10px 20px;
    }
}