:root {
    --bg: #0d0d0d;
    --panel: #1a1a1a;
    --accent: #00ff41;
    --warn: #ffaa00;
    --error: #ff4444;
    --text: #ececec;
}

body {
    background: var(--bg);
    color: var(--text);
    font-family: 'Courier New', Courier, monospace;
    margin: 0;
}

header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 30px;
    background: #000;
    border-bottom: 1px solid #333;
}

.logo { font-family: 'Courier New', monospace; font-weight: bold; font-size: 1.2rem; text-shadow: 0 0 10px var(--accent); }
.logo span { color: var(--accent); }

.input-selector { display: flex; gap: 10px; }
select { background: #222; color: #fff; border: 1px solid #444; padding: 5px; border-radius: 4px; }
#presetSelect { min-width: 120px; border-color: var(--accent); }
#savePresetBtn { color: #fff; border: 1px solid #555; padding: 5px 10px; border-radius: 4px; cursor: pointer; }
#startBtn { background: var(--accent); border: none; padding: 8px 15px; font-weight: bold; cursor: pointer; border-radius: 4px; }
#lowFidBtn { 
    background: #333; 
    border: 1px solid #555; 
    color: #aaa; 
    padding: 8px 15px; 
    font-size: 0.7rem; 
    cursor: pointer; 
    border-radius: 4px; 
}
#lowFidBtn.active { background: var(--error); color: #fff; border-color: #fff; }

#directMonitorBtn {
    background: #222;
    border: 1px solid #444;
    color: #888;
    padding: 8px 15px;
    font-size: 0.7rem;
    cursor: pointer;
    border-radius: 4px;
}
#directMonitorBtn.active { background: var(--warn); color: #000; border-color: #fff; }

#diagToggleBtn {
    background: #222;
    color: #888;
    border: 1px solid #444;
    padding: 8px 15px;
    font-size: 0.7rem;
    cursor: pointer;
    border-radius: 4px;
}
#diagToggleBtn.active { background: var(--accent); color: #000; border-color: #fff; }

#recordBtn.recording {
    background: #ff4444 !important;
    color: #fff !important;
    box-shadow: 0 0 10px #ff4444;
    animation: pulse-red 1.5s infinite;
}

.record-timer {
    color: #ff4444;
    font-family: 'Courier New', monospace;
    font-size: 0.8rem;
    margin-left: 5px;
    display: none;
    vertical-align: middle;
}

/* Estilização Matrix para Sliders */
input[type="range"] {
    -webkit-appearance: none;
    width: 100%;
    background: #111;
    border: 1px solid #004400;
    height: 6px;
    outline: none;
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 12px;
    height: 18px;
    background: var(--accent);
    box-shadow: 0 0 8px var(--accent);
    cursor: pointer;
}

#panicBtn {
    background: #440000;
    color: #ff4444;
    border: 1px solid #ff4444;
    padding: 8px 15px;
    font-weight: bold;
    cursor: pointer;
    border-radius: 4px;
    transition: 0.2s;
}
#panicBtn.active {
    background: var(--error);
    color: #fff;
    box-shadow: 0 0 15px var(--error);
}

@keyframes pulse-red {
    0% { opacity: 1; }
    50% { opacity: 0.5; }
    100% { opacity: 1; }
}

.dashboard { 
    max-width: 1300px; 
    margin: 30px auto; 
    padding: 0 20px; 
    display: grid; 
    grid-template-columns: 1fr; 
    gap: 20px; 
    align-items: start;
}

.dashboard.show-diagnostics {
    grid-template-columns: 1fr 300px;
}

.visualizer-container {
    height: 120px;
    background: #000;
    border-radius: 8px;
    position: relative;
    border: 1px solid #222;
    margin-bottom: 25px;
}
#waveform { width: 100%; height: 100%; }

.latency-meter {
    position: absolute;
    top: 10px;
    left: 10px;
    font-size: 0.65rem;
    color: var(--accent);
    font-family: 'Orbitron';
    text-shadow: 0 0 5px rgba(0,255,136,0.5);
}

.circular-osc {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 100px;
    height: 100px;
    z-index: 1;
    pointer-events: none;
}

.vu-meters {
    position: absolute;
    top: 10px;
    right: 10px;
    display: flex;
    gap: 5px;
}

.vu-meter-container {
    width: 8px; height: 100px;
    background: #222; border: 1px solid #444;
    border-radius: 2px; overflow: hidden;
}
.vu-meter-bar {
    position: absolute; bottom: 0;
    width: 100%; height: 0%;
    background: linear-gradient(to top, #00ff88 70%, #ffff00 85%, #ff4444 100%);
    transition: height 0.05s ease;
}

.reduction-bar {
    position: absolute; top: 0;
    width: 100%; height: 0%;
    background: var(--warn);
    transition: height 0.05s ease;
}

/* Visual de Cabeçote de Amplificador */
.amp-chassis {
    background: linear-gradient(180deg, #2a2a2a 0%, #1a1a1a 100%) !important;
    border: 4px solid #333 !important;
    border-top: 15px solid #111 !important; /* Tolex superior */
    box-shadow: inset 0 2px 10px rgba(255,255,255,0.05), 0 10px 20px rgba(0,0,0,0.5);
    background-image: url('https://www.transparenttextures.com/patterns/carbon-fibre.png'); /* Textura sutil */
}

.pedalboard {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
}

.pedal {
    background: var(--panel);
    padding: 25px;
    border-radius: 12px;
    border: 1px solid #004400;
    text-align: center;
    transition: 0.3s;
}

.pedal.active { border-color: var(--accent); }

.amp-chassis h3 { color: #aaa; text-shadow: 1px 1px #000; letter-spacing: 2px; }

.led {
    width: 8px; height: 8px; background: #000;
    border-radius: 50%; margin: 0 auto 10px;
    border: 1px solid #444;
}

.pedal.active .led { background: var(--accent); box-shadow: 0 0 8px var(--accent); }

.knob-group { margin: 15px 0; }
label { font-size: 0.65rem; color: #777; display: block; margin-top: 5px; text-transform: uppercase; }

.toggle-btn {
    width: 100%; padding: 10px; background: #333;
    border: none; color: #fff; font-weight: bold;
    cursor: pointer; border-radius: 6px;
}

.pedal.active .toggle-btn { background: #444; color: var(--accent); }

#pedal-chorus.active { border-color: var(--accent); }
#pedal-chorus.active .led { background: var(--accent); box-shadow: 0 0 8px var(--accent); }
#pedal-chorus.active .toggle-btn { color: var(--accent); }

#pedal-flanger.active { border-color: var(--accent); }
#pedal-flanger.active .led { background: var(--accent); box-shadow: 0 0 8px var(--accent); }
#pedal-flanger.active .toggle-btn { color: var(--accent); }

.eq-controls {
    display: flex;
    justify-content: space-between;
    margin-top: 15px;
    border-top: 1px solid #333;
    padding-top: 10px;
}
.knob-group.small { flex: 1; }
.knob-group.small input { width: 80%; }

.hi-z-btn {
    background: #222;
    border: 1px solid #444;
    color: #777;
    font-size: 0.7rem;
    padding: 8px;
    margin-bottom: 10px;
    cursor: pointer;
    border-radius: 4px;
    width: 100%;
    transition: 0.2s;
    font-family: 'Orbitron', sans-serif;
    text-transform: uppercase;
}
.hi-z-btn.active {
    background: var(--warn);
    color: #000;
    border-color: #fff;
    box-shadow: 0 0 10px var(--warn);
}

/* Console Lateral */
.debug-console { 
    background: #000; 
    border: 1px solid #222; 
    border-radius: 8px; 
    position: sticky; 
    top: 20px;
    display: none; 
}
.dashboard.show-diagnostics .debug-console { display: block; }
.console-header { background: #111; padding: 10px 15px; display: flex; justify-content: space-between; font-size: 0.65rem; color: #555; border-bottom: 1px solid #222; }
.console-body { height: 600px; overflow-y: auto; padding: 15px; font-family: 'Courier New', monospace; font-size: 0.75rem; color: var(--accent); }
.log-info { color: #888; }
.log-success { color: var(--accent); }
.log-error { color: var(--error); }
.log-warn { color: var(--warn); }

/* Tuner Modal */
.tuner-modal {
    background: #000;
    border: 2px solid var(--accent);
    border-radius: 15px;
    padding: 0;
    color: white;
    text-align: center;
    width: 350px;
    overflow: hidden;
    transition: border-color 0.3s, box-shadow 0.3s;
}
.tuner-modal.in-tune {
    border-color: #fff;
    box-shadow: 0 0 30px var(--accent);
}
.tuner-modal::backdrop { background: rgba(0, 0, 0, 0.8); }

#matrix-canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 0;
    opacity: 0.15;
    pointer-events: none;
}

.modal-content {
    position: relative;
    z-index: 1;
    padding: 30px;
}
.modal-tuner-display {
    font-family: 'Orbitron';
    font-size: 5rem;
    color: var(--accent);
    margin: 20px 0;
}
.modal-tuner-cents { font-family: 'Orbitron'; font-size: 1.2rem; margin-bottom: 20px; }
.tuner-modal button {
    background: transparent;
    border: 1px solid #555;
    color: #888;
    padding: 10px 20px;
    cursor: pointer;
    font-family: 'Orbitron';
}

.tuner-gauge {
    position: relative;
    width: 100%;
    height: 30px;
    background: #111;
    border: 1px solid #333;
    border-radius: 4px;
    margin: 20px 0;
    overflow: hidden;
}
.tuner-scale {
    position: absolute;
    top: 0; left: 50%;
    width: 2px; height: 100%;
    background: rgba(0, 255, 65, 0.3);
    transform: translateX(-50%);
}
.tuner-needle {
    position: absolute;
    top: 0; left: 50%;
    width: 4px; height: 100%;
    background: var(--error);
    transform: translateX(-50%);
    transition: left 0.1s ease-out;
    z-index: 2;
}