:root {
    --card-bg: rgba(10, 10, 15, 0.8);
    --card-border: rgba(255, 255, 255, 0.08);
    --accent-glow: rgba(0, 240, 255, 0.4);
    --instrument-bg: #050508;
}

.audio-tool-container {
    max-width: 1000px;
    margin: 0 auto;
    padding: 120px 20px 60px;
}

.tool-header {
    text-align: center;
    margin-bottom: 40px;
}

.tool-header h1 {
    margin-top: 10px;
    font-size: clamp(2rem, 5vw, 3rem);
}

.tool-header p {
    color: var(--text-muted);
}

/* Analysis Rack - Multi-View Instrument Panel */
.analysis-rack {
    background: var(--instrument-bg);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    height: 400px;
    position: relative;
    overflow: hidden;
    margin-bottom: 40px;
    box-shadow: inset 0 0 60px rgba(0, 0, 0, 0.9), 0 15px 50px rgba(0, 0, 0, 0.6);
    display: flex;
    flex-direction: column;
}

.analysis-view {
    flex: 1;
    width: 100%;
    display: none;
    position: relative;
}

.analysis-view.active {
    display: flex;
    justify-content: center;
    align-items: center;
}

canvas {
    width: 100%;
    height: 100%;
    display: block;
}

#goniometer {
    max-width: 350px;
    aspect-ratio: 1/1;
    margin: 0 auto;
}

.view-label {
    position: absolute;
    bottom: 20px;
    left: 20px;
    font-family: var(--font-mono);
    font-size: 0.7rem;
    color: var(--text-muted);
    letter-spacing: 2px;
    text-transform: uppercase;
    opacity: 0.5;
}

.analysis-controls {
    display: flex;
    justify-content: center;
    gap: 10px;
    padding: 15px;
    background: rgba(255, 255, 255, 0.02);
    border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.analysis-btn {
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--text-muted);
    padding: 6px 16px;
    border-radius: 4px;
    font-family: var(--font-mono);
    font-size: 0.7rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.analysis-btn:hover {
    border-color: var(--brand-cyan);
    color: var(--text-main);
}

.analysis-btn.active {
    background: var(--brand-cyan);
    color: #000;
    border-color: var(--brand-cyan);
    box-shadow: 0 0 15px var(--glow-cyan);
}

.visualizer-overlay {
    position: absolute;
    top: 20px;
    right: 30px;
    pointer-events: none;
}

.freq-display {
    font-family: var(--font-mono);
    font-size: 3rem;
    font-weight: 700;
    color: var(--brand-cyan);
    text-shadow: 0 0 20px var(--glow-cyan);
    opacity: 0.8;
}

.freq-display span {
    font-size: 1.2rem;
    margin-left: 5px;
    opacity: 0.5;
}

/* Controls Grid */
.controls-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 24px;
    margin-bottom: 60px;
}

.control-card {
    background: var(--card-bg);
    backdrop-filter: blur(10px);
    border: 1px solid var(--card-border);
    border-radius: 16px;
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 20px;
    transition: transform 0.3s ease;
}

.control-card:hover {
    border-color: rgba(0, 240, 255, 0.2);
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.status-indicator {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    padding: 4px 8px;
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-muted);
}

.status-indicator.active {
    background: rgba(0, 240, 255, 0.1);
    color: var(--brand-cyan);
    box-shadow: 0 0 10px var(--glow-cyan);
}

/* Master Power Button */
.power-btn {
    width: 100%;
    padding: 20px;
    border-radius: 12px;
    border: none;
    background: var(--bg-surface-light);
    color: var(--text-main);
    font-weight: 700;
    font-size: 1.2rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    letter-spacing: 1px;
}

.power-btn svg {
    width: 24px;
    height: 24px;
    transition: transform 0.3s ease;
}

.power-btn.active {
    background: var(--brand-cyan);
    color: #000;
    box-shadow: 0 0 30px var(--glow-cyan);
}

.power-btn:active {
    transform: scale(0.95);
}

/* Inputs & Sliders */
.freq-input-group {
    display: flex;
    align-items: center;
    gap: 10px;
    background: rgba(0, 0, 0, 0.3);
    padding: 12px 18px;
    border-radius: 10px;
    border: 1px solid var(--border-color);
}

#freq-number {
    background: transparent;
    border: none;
    color: var(--text-main);
    font-family: var(--font-mono);
    font-size: 1.5rem;
    width: 100%;
    outline: none;
}

input[type="range"] {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 6px;
    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: var(--brand-cyan);
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 0 10px var(--glow-cyan);
}

.volume-control {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.volume-control label {
    font-size: 0.85rem;
    color: var(--text-muted);
}

#volume-value {
    font-family: var(--font-mono);
    text-align: right;
    font-size: 0.9rem;
    color: var(--brand-cyan);
}

.ref-levels {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    margin-top: 5px;
}

.ref-btn {
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.1);
    color: var(--text-muted);
    padding: 8px 4px;
    border-radius: 6px;
    font-size: 0.75rem;
    font-family: var(--font-mono);
    cursor: pointer;
    transition: all 0.2s ease;
}

.ref-btn:hover {
    border-color: var(--brand-cyan);
    color: var(--text-main);
}

/* Sweep Controls */
.sweep-controls {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin: 5px 0;
}

.sweep-btn {
    background: rgba(0,0,0,0.4);
    border: 1px solid rgba(255,255,255,0.15);
    color: var(--text-main);
    padding: 12px;
    border-radius: 8px;
    font-family: var(--font-mono);
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.sweep-btn.active {
    background: rgba(255, 150, 0, 0.1);
    border-color: #ff9600;
    color: #ff9600;
    box-shadow: 0 0 15px rgba(255, 150, 0, 0.3);
}

.sweep-options select {
    width: 100%;
    background: var(--bg-surface-light);
    border: 1px solid var(--border-color);
    color: var(--text-main);
    padding: 8px;
    border-radius: 6px;
    outline: none;
}

/* Presets & Buttons */
.freq-presets, .waveform-grid, .noise-grid, .channel-grid {
    display: grid;
    gap: 10px;
}

.freq-presets {
    grid-template-columns: repeat(4, 1fr);
}

.waveform-grid {
    grid-template-columns: repeat(4, 1fr);
}

.noise-grid {
    grid-template-columns: 1fr 1fr;
}

.channel-grid {
    grid-template-columns: repeat(3, 1fr);
}

.preset-btn, .wave-btn, .noise-btn, .mode-btn {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-color);
    color: var(--text-muted);
    padding: 10px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.85rem;
    transition: all 0.2s ease;
    display: flex;
    justify-content: center;
    align-items: center;
}

.wave-btn svg {
    width: 20px;
    height: 20px;
}

.active, .preset-btn:hover, .wave-btn:hover, .noise-btn:hover, .mode-btn:hover {
    background: rgba(0, 240, 255, 0.1);
    border-color: var(--brand-cyan);
    color: var(--brand-cyan);
}

.mode-btn[data-mode="phase"].active {
    border-color: #ff3e3e;
    color: #ff3e3e;
    background: rgba(255, 62, 62, 0.1);
}

/* SEO Guide */
.seo-guide {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    padding: 40px;
}

.seo-content h2 { margin-bottom: 20px; }
.seo-content h3 { margin-top: 32px; color: var(--brand-cyan); font-size: 1.2rem; }
.seo-content p { margin-bottom: 20px; color: var(--text-muted); line-height: 1.8; }
.seo-content ul { padding-left: 20px; margin-bottom: 30px; }
.seo-content li { margin-bottom: 12px; color: var(--text-muted); }

.guide-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
    margin: 40px 0;
}

.guide-item {
    background: rgba(255,255,255,0.02);
    padding: 24px;
    border-radius: 16px;
    border: 1px solid rgba(255,255,255,0.05);
}

@media (max-width: 800px) {
    .guide-grid { grid-template-columns: 1fr; }
}

/* Responsive */
@media (max-width: 600px) {
    .audio-tool-container {
        padding-top: 100px;
    }
    .freq-presets, .waveform-grid, .channel-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}
