/* ==========================================================================
   TINNITUNE DESIGN SYSTEM (VANILLA CSS)
   ========================================================================== */

:root {
    --color-bg: #0b0f19;
    --color-panel-bg: rgba(18, 25, 41, 0.65);
    --color-panel-border: rgba(255, 255, 255, 0.06);
    --color-panel-border-focus: rgba(255, 255, 255, 0.15);
    
    /* Harmonious HSL Accent Colors */
    --color-purple: hsl(268, 85%, 64%);
    --color-purple-glow: rgba(162, 28, 243, 0.35);
    --color-cyan: hsl(188, 85%, 48%);
    --color-cyan-glow: rgba(6, 198, 227, 0.3);
    --color-indigo: hsl(238, 80%, 60%);
    --color-indigo-glow: rgba(79, 70, 229, 0.3);
    --color-danger: hsl(350, 75%, 55%);
    --color-danger-glow: rgba(239, 68, 68, 0.3);
    --color-success: hsl(145, 80%, 45%);
    
    /* Typography & Text */
    --font-heading: 'Outfit', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    --font-body: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    
    --color-text: #f8fafc;
    --color-text-muted: #94a3b8;
    --color-text-dim: #64748b;
    
    /* Animations & Transitions */
    --transition-smooth: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-fast: all 0.15s ease;
}

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

body {
    background-color: var(--color-bg);
    color: var(--color-text);
    font-family: var(--font-body);
    font-size: 15px;
    line-height: 1.6;
    overflow-x: hidden;
    min-height: 100vh;
    position: relative;
}

/* Floating Blur Decorative Blobs */
.background-decorations {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: -1;
    overflow: hidden;
    pointer-events: none;
}

.blob {
    position: absolute;
    border-radius: 50%;
    filter: blur(100px);
    opacity: 0.25;
    mix-blend-mode: screen;
    animation: float 25s infinite alternate ease-in-out;
}

.blob-purple {
    top: -10%;
    left: 10%;
    width: 450px;
    height: 450px;
    background: radial-gradient(circle, var(--color-purple) 0%, transparent 70%);
}

.blob-cyan {
    bottom: 5%;
    right: 5%;
    width: 500px;
    height: 500px;
    background: radial-gradient(circle, var(--color-cyan) 0%, transparent 70%);
    animation-delay: -5s;
}

.blob-indigo {
    top: 40%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 400px;
    height: 400px;
    background: radial-gradient(circle, var(--color-indigo) 0%, transparent 70%);
    animation-delay: -10s;
}

@keyframes float {
    0% {
        transform: translate(0, 0) scale(1);
    }
    50% {
        transform: translate(30px, -40px) scale(1.1);
    }
    100% {
        transform: translate(-20px, 20px) scale(0.95);
    }
}

/* Main Layout Structure */
.app-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 2rem 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    min-height: 100vh;
}

/* Header Styles */
.main-header {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    gap: 1.5rem;
    padding: 1.5rem 2rem;
    background: var(--color-panel-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--color-panel-border);
    border-radius: 20px;
}

.brand {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.logo-icon {
    width: 45px;
    height: 45px;
    border-radius: 12px;
    background: linear-gradient(135deg, var(--color-purple), var(--color-cyan));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    box-shadow: 0 4px 15px rgba(162, 28, 243, 0.4);
}

.brand-text h1 {
    font-family: var(--font-heading);
    font-size: 1.6rem;
    font-weight: 800;
    letter-spacing: -0.5px;
    background: linear-gradient(to right, #ffffff, #d8b4fe, #a5f3fc);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.brand-text p {
    font-size: 0.85rem;
    color: var(--color-text-muted);
}

.header-controls {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 1.5rem;
}

/* Audio Status Badge */
.audio-status {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.4rem 0.8rem;
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.05);
    font-size: 0.8rem;
    font-weight: 500;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: var(--color-danger);
    box-shadow: 0 0 8px var(--color-danger);
    transition: var(--transition-smooth);
}

.audio-status.connected .status-dot {
    background-color: var(--color-success);
    box-shadow: 0 0 8px var(--color-success);
}

/* Master Volume Slider */
.master-volume {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}

.volume-label {
    font-size: 0.75rem;
    color: var(--color-text-muted);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.volume-slider-container {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    background: rgba(255, 255, 255, 0.03);
    padding: 0.4rem 0.8rem;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.vol-percentage {
    font-family: monospace;
    font-size: 0.85rem;
    min-width: 38px;
    text-align: right;
}

/* Visualizer Card */
.visualizer-panel {
    background: var(--color-panel-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--color-panel-border);
    border-radius: 20px;
    padding: 1.5rem 2rem;
}

.visualizer-header {
    margin-bottom: 0.8rem;
}

.visualizer-header h3 {
    font-family: var(--font-heading);
    font-size: 1.1rem;
    font-weight: 600;
}

.visualizer-sub {
    font-size: 0.75rem;
    color: var(--color-text-muted);
}

.canvas-container {
    width: 100%;
    height: 100px;
    border-radius: 12px;
    background: rgba(4, 7, 13, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.04);
    overflow: hidden;
    position: relative;
}

#visualizerCanvas {
    width: 100%;
    height: 100%;
    display: block;
}

/* Dashboard Grid */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.5rem;
}

@media (max-width: 1024px) {
    .dashboard-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .dashboard-grid {
        grid-template-columns: 1fr;
    }
    .main-header {
        flex-direction: column;
        align-items: stretch;
    }
    .header-controls {
        flex-direction: column;
        align-items: stretch;
    }
}

/* Glassmorphic Panel Styles */
.panel {
    background: var(--color-panel-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--color-panel-border);
    border-radius: 24px;
    padding: 2rem;
    box-shadow: 0 10px 30px -10px rgba(0, 0, 0, 0.5);
    transition: var(--transition-smooth);
    display: flex;
    flex-direction: column;
}

.panel:hover {
    border-color: var(--color-panel-border-focus);
}

.panel-header {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    margin-bottom: 0.8rem;
}

.panel-icon {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.icon-purple {
    background: rgba(162, 28, 243, 0.15);
    color: var(--color-purple);
}

.icon-cyan {
    background: rgba(6, 198, 227, 0.15);
    color: var(--color-cyan);
}

.icon-indigo {
    background: rgba(79, 70, 229, 0.15);
    color: var(--color-indigo);
}

.panel-header svg {
    width: 20px;
    height: 20px;
}

.panel-header h2 {
    font-family: var(--font-heading);
    font-size: 1.3rem;
    font-weight: 700;
}

.panel-desc {
    font-size: 0.85rem;
    color: var(--color-text-muted);
    margin-bottom: 1.5rem;
}

/* Sub-panel Sections */
.sub-panel-section {
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
}

.sub-panel-section h3 {
    font-family: var(--font-heading);
    font-size: 1.05rem;
    font-weight: 600;
}

.divider {
    height: 1px;
    background: rgba(255, 255, 255, 0.08);
    margin: 1.5rem 0;
}

/* Control Groups */
.control-group {
    margin-bottom: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
}

.group-title {
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--color-text-dim);
}

.control-header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
}

.control-header label {
    font-size: 0.9rem;
    font-weight: 500;
}

.control-value {
    font-family: monospace;
    font-size: 0.9rem;
    color: var(--color-cyan);
    font-weight: 600;
}

.sub-header {
    margin-top: 0.5rem;
}

.sub-header label {
    font-size: 0.8rem;
    color: var(--color-text-muted);
}

.sub-header .control-value {
    color: var(--color-purple);
    font-size: 0.85rem;
}

/* Logarithmic Range Wrapper */
.range-wrapper {
    display: flex;
    align-items: center;
    gap: 0.8rem;
}

.range-limit {
    font-size: 0.75rem;
    color: var(--color-text-dim);
    min-width: 35px;
}

.side-label {
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--color-text-dim);
}

/* Buttons Styling */
button {
    cursor: pointer;
    font-family: var(--font-body);
    font-weight: 600;
    border: none;
    outline: none;
    transition: var(--transition-fast);
}

.btn-primary {
    background: linear-gradient(135deg, var(--color-purple), var(--color-indigo));
    color: white;
    padding: 0.6rem 1.2rem;
    border-radius: 12px;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    box-shadow: 0 4px 12px var(--color-purple-glow);
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 16px var(--color-purple-glow);
    filter: brightness(1.1);
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-glow {
    position: relative;
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.08);
    color: var(--color-text);
    padding: 0.75rem 1rem;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.15);
}

.btn-secondary.active-playing {
    background: rgba(162, 28, 243, 0.15);
    border-color: var(--color-purple);
    color: var(--color-purple);
    box-shadow: 0 0 10px rgba(162, 28, 243, 0.2);
}

.btn-full {
    width: 100%;
    margin-top: auto;
}

.btn-danger {
    background: rgba(239, 68, 68, 0.12);
    border: 1px solid rgba(239, 68, 68, 0.25);
    color: var(--color-danger);
    padding: 0.75rem 1rem;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.btn-danger:hover {
    background: rgba(239, 68, 68, 0.2);
    border-color: rgba(239, 68, 68, 0.4);
    box-shadow: 0 4px 12px var(--color-danger-glow);
}

.btn-indigo-action {
    background: var(--color-indigo);
    color: white;
    padding: 0.7rem 1.2rem;
    border-radius: 12px;
    box-shadow: 0 4px 10px var(--color-indigo-glow);
    font-size: 0.9rem;
}

.btn-indigo-action:hover {
    background: hsl(238, 80%, 65%);
    transform: translateY(-1px);
    box-shadow: 0 6px 14px var(--color-indigo-glow);
}

.btn-indigo-action.active {
    background: var(--color-danger);
    box-shadow: 0 4px 10px var(--color-danger-glow);
}

.btn-indigo-action.active:hover {
    background: hsl(350, 75%, 60%);
}

/* Button Grids */
.btn-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.5rem;
}

.btn-grid-3 {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.4rem;
}

.btn-grid-5 {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 0.3rem;
}

.btn-select {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.05);
    color: var(--color-text-muted);
    padding: 0.6rem 0.5rem;
    border-radius: 10px;
    text-align: left;
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    transition: var(--transition-fast);
}

.btn-select small {
    font-size: 0.65rem;
    color: var(--color-text-dim);
}

.btn-select:hover {
    background: rgba(255, 255, 255, 0.06);
    color: var(--color-text);
}

.btn-select.active {
    background: rgba(162, 28, 243, 0.08);
    border-color: var(--color-purple);
    color: var(--color-text);
    box-shadow: 0 0 10px rgba(162, 28, 243, 0.1);
}

.btn-select.active small {
    color: var(--color-purple);
}

.btn-select-small {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.05);
    color: var(--color-text-muted);
    padding: 0.5rem;
    border-radius: 8px;
    font-size: 0.8rem;
    text-align: center;
}

.btn-select-small:hover {
    background: rgba(255, 255, 255, 0.06);
    color: var(--color-text);
}

.btn-select-small.active {
    background: rgba(6, 198, 227, 0.08);
    border-color: var(--color-cyan);
    color: var(--color-text);
    box-shadow: 0 0 8px rgba(6, 198, 227, 0.1);
}

/* Custom Sliders (Log/Neon Glow) */
input[type="range"] {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 6px;
    border-radius: 3px;
    background: rgba(255, 255, 255, 0.08);
    outline: none;
    transition: background 0.3s;
}

/* Webkit / Chrome */
input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--color-text);
    border: 2px solid var(--color-cyan);
    box-shadow: 0 0 8px var(--color-cyan);
    cursor: pointer;
    transition: var(--transition-fast);
}

input[type="range"]::-webkit-slider-thumb:hover {
    transform: scale(1.2);
    box-shadow: 0 0 12px var(--color-cyan);
}

/* Accent Purple Sliders */
input[type="range"].accent-purple::-webkit-slider-thumb {
    border-color: var(--color-purple);
    box-shadow: 0 0 8px var(--color-purple-glow);
}

input[type="range"].accent-purple::-webkit-slider-thumb:hover {
    box-shadow: 0 0 12px var(--color-purple);
}

/* Accent Cyan Sliders */
input[type="range"].accent-cyan::-webkit-slider-thumb {
    border-color: var(--color-cyan);
    box-shadow: 0 0 8px var(--color-cyan-glow);
}

input[type="range"].accent-cyan::-webkit-slider-thumb:hover {
    box-shadow: 0 0 12px var(--color-cyan);
}

/* Firefox Support */
input[type="range"]::-moz-range-thumb {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: var(--color-text);
    border: 2px solid var(--color-cyan);
    box-shadow: 0 0 8px var(--color-cyan);
    cursor: pointer;
    transition: var(--transition-fast);
}

input[type="range"]::-moz-range-thumb:hover {
    transform: scale(1.2);
}

input[type="range"].accent-purple::-moz-range-thumb {
    border-color: var(--color-purple);
    box-shadow: 0 0 8px var(--color-purple-glow);
}

input[type="range"].accent-cyan::-moz-range-thumb {
    border-color: var(--color-cyan);
    box-shadow: 0 0 8px var(--color-cyan-glow);
}

/* Switch Styling (Toggle) */
.switch {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider-round {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(255, 255, 255, 0.08);
    transition: .3s;
    border-radius: 34px;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.slider-round:before {
    position: absolute;
    content: "";
    height: 16px;
    width: 16px;
    left: 3px;
    bottom: 3px;
    background-color: var(--color-text-muted);
    transition: .3s;
    border-radius: 50%;
}

input:checked + .slider-round {
    background-color: rgba(162, 28, 243, 0.2);
    border-color: var(--color-purple);
}

input:checked + .slider-round:before {
    transform: translateX(20px);
    background-color: var(--color-purple);
    box-shadow: 0 0 8px var(--color-purple);
}

/* Expandable Control styling */
.expandable {
    border: 1px solid rgba(255, 255, 255, 0.03);
    background: rgba(255, 255, 255, 0.01);
    padding: 0.8rem 1rem;
    border-radius: 14px;
    transition: var(--transition-smooth);
}

.expandable:focus-within, .expandable:hover {
    border-color: rgba(255, 255, 255, 0.06);
    background: rgba(255, 255, 255, 0.02);
}

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

.expand-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease-out;
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}

.expandable:has(input:checked) .expand-content {
    max-height: 200px;
    margin-top: 0.8rem;
}

/* Ambient Mixer Row */
.ambient-row {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.04);
    border-radius: 12px;
    padding: 0.8rem 1rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.ambient-info {
    display: flex;
    flex-direction: column;
    flex: 1;
}

.ambient-name {
    font-size: 0.85rem;
    font-weight: 600;
}

.ambient-detail {
    font-size: 0.7rem;
    color: var(--color-text-dim);
}

.ambient-slider {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    flex: 1.5;
}

.ambient-val {
    font-family: monospace;
    font-size: 0.8rem;
    min-width: 32px;
    text-align: right;
}

.masker-volume-control {
    margin-top: 0.5rem;
    padding: 0.6rem 0.8rem;
    background: rgba(255, 255, 255, 0.01);
    border: 1px solid rgba(255, 255, 255, 0.02);
    border-radius: 10px;
}

/* Notch Toggle Card styling */
.notch-toggle-card {
    background: rgba(6, 198, 227, 0.04);
    border: 1px solid rgba(6, 198, 227, 0.15);
    border-radius: 16px;
    padding: 1rem 1.2rem;
    margin-bottom: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
}

.notch-top {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
}

.notch-info h4 {
    font-family: var(--font-heading);
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--color-cyan);
}

.notch-info p {
    font-size: 0.75rem;
    color: var(--color-text-muted);
    line-height: 1.4;
    margin-top: 0.15rem;
}

.notch-toggle-card input:checked + .slider-round {
    background-color: rgba(6, 198, 227, 0.2);
    border-color: var(--color-cyan);
}

.notch-toggle-card input:checked + .slider-round:before {
    background-color: var(--color-cyan);
    box-shadow: 0 0 8px var(--color-cyan);
}

.notch-badge-container {
    display: flex;
    gap: 0.5rem;
}

.badge {
    font-size: 0.7rem;
    font-weight: 700;
    padding: 0.2rem 0.6rem;
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.05);
    color: var(--color-text-muted);
}

#notchStatusBadge.active {
    background: rgba(16, 185, 129, 0.15);
    color: var(--color-success);
    border: 1px solid rgba(16, 185, 129, 0.2);
}

.badge-frequency {
    background: rgba(6, 198, 227, 0.1);
    color: var(--color-cyan);
    border: 1px solid rgba(6, 198, 227, 0.15);
    display: none;
}

.badge-frequency.active {
    display: inline-block;
}

/* Residual Inhibition Styles */
.ri-timer-container {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.04);
    border-radius: 16px;
    padding: 1.2rem;
}

.circular-progress {
    position: relative;
    width: 120px;
    height: 120px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.progress-ring {
    transform: rotate(-90deg);
}

.progress-ring__circle {
    transition: stroke-dashoffset 0.1s linear;
}

.timer-display {
    position: absolute;
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: 1.4rem;
    color: var(--color-text);
}

.ri-controls {
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
    flex: 1;
}

.time-presets {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.3rem;
}

.btn-preset {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.05);
    color: var(--color-text-muted);
    padding: 0.4rem;
    border-radius: 8px;
    font-size: 0.75rem;
}

.btn-preset:hover {
    background: rgba(255, 255, 255, 0.06);
}

.btn-preset.active {
    background: rgba(79, 70, 229, 0.12);
    border-color: var(--color-indigo);
    color: var(--color-indigo);
}

.ri-warning {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    background: rgba(245, 158, 11, 0.08);
    border: 1px solid rgba(245, 158, 11, 0.2);
    padding: 0.8rem 1rem;
    border-radius: 12px;
    font-size: 0.75rem;
    color: #fbbf24;
    line-height: 1.4;
}

.ri-warning svg {
    flex-shrink: 0;
    margin-top: 0.1rem;
}

/* Phase Experiment Card */
.phase-experiment-card {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

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

.phase-header span {
    font-size: 0.85rem;
    font-weight: 600;
}

.phase-controls {
    display: flex;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    padding: 0.2rem;
}

.btn-toggle-phase {
    background: transparent;
    color: var(--color-text-muted);
    padding: 0.35rem 0.8rem;
    border-radius: 6px;
    font-size: 0.75rem;
}

.btn-toggle-phase:hover {
    color: var(--color-text);
}

.btn-toggle-phase.active {
    background: var(--color-indigo);
    color: white;
    box-shadow: 0 2px 6px rgba(79, 70, 229, 0.3);
}

.phase-visualization {
    background: rgba(0, 0, 0, 0.25);
    border: 1px solid rgba(255, 255, 255, 0.03);
    border-radius: 12px;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.6rem;
}

.wave-visual-container {
    height: 35px;
    width: 100%;
    position: relative;
    display: flex;
    align-items: center;
}

.wave-bar {
    position: absolute;
    width: 100%;
    height: 100%;
    background-repeat: repeat-x;
    background-size: 40px 100%;
    transition: var(--transition-smooth);
}

/* Sine wave styling using CSS SVG background generator */
.blue-wave {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 40 40' width='40' height='40'%3E%3Cpath d='M0,20 Q10,2 20,20 T40,20' fill='none' stroke='hsl(188, 85%25, 48%25)' stroke-width='2'/%3E%3C/svg%3E");
    opacity: 0.75;
    animation: waveMove 2s infinite linear;
}

.red-wave {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 40 40' width='40' height='40'%3E%3Cpath d='M0,20 Q10,2 20,20 T40,20' fill='none' stroke='hsl(350, 75%25, 55%25)' stroke-width='2'/%3E%3C/svg%3E");
    opacity: 0.75;
    animation: waveMove 2s infinite linear;
}

/* Shifted background position for out-of-phase wave */
.phase-experiment-card:has(#btnPhaseInverted.active) .red-wave {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 40 40' width='40' height='40'%3E%3Cpath d='M0,20 Q10,38 20,20 T40,20' fill='none' stroke='hsl(350, 75%25, 55%25)' stroke-width='2'/%3E%3C/svg%3E");
}

@keyframes waveMove {
    from { background-position-x: 0px; }
    to { background-position-x: 40px; }
}

.wave-relation-label {
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--color-text-muted);
}

.info-alert {
    background: rgba(255, 255, 255, 0.02);
    border-left: 3px solid var(--color-indigo);
    border-radius: 0 10px 10px 0;
    padding: 0.8rem 1rem;
    font-size: 0.78rem;
    line-height: 1.45;
}

.alert-title {
    display: block;
    font-weight: 600;
    margin-bottom: 0.2rem;
    color: var(--color-text);
}

.alert-footnote {
    margin-top: 0.4rem;
    color: var(--color-text-dim);
}

/* Footer & Disclaimer Styles */
.main-footer {
    margin-top: 2.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    display: flex;
    flex-direction: column;
    gap: 1.2rem;
    align-items: center;
    text-align: center;
}

.disclaimer {
    max-width: 800px;
    background: rgba(239, 68, 68, 0.04);
    border-left: 3px solid var(--color-danger);
    padding: 1rem 1.25rem;
    border-radius: 8px;
}

.disclaimer h5 {
    color: var(--color-danger);
    font-size: 0.9rem;
    margin-bottom: 0.25rem;
    font-family: var(--font-heading);
}

.disclaimer p {
    font-size: 0.78rem;
    color: var(--color-text-muted);
    line-height: 1.55;
}

.copyright {
    font-size: 0.8rem;
    color: var(--color-text-dim);
    line-height: 1.5;
}

.copyright a,
.copyright a:visited {
    color: var(--color-cyan);
    text-decoration: none;
    font-weight: 500;
    transition: var(--transition-fast);
}

.copyright a:hover,
.copyright a:visited:hover {
    color: var(--color-purple);
    text-decoration: underline;
}

/* Icon Utilities */
.icon {
    width: 18px;
    height: 18px;
}

.icon-sm {
    width: 15px;
    height: 15px;
}

/* ==========================================================================
   PRESET MANAGER SYSTEM
   ========================================================================== */
.preset-manager {
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
    margin-top: 0.5rem;
}

.preset-input-group {
    display: flex;
    gap: 0.5rem;
    width: 100%;
}

.input-neon {
    flex: 1;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.08);
    color: var(--color-text);
    padding: 0.6rem 0.8rem;
    border-radius: 10px;
    font-size: 0.85rem;
    font-family: var(--font-body);
    outline: none;
    transition: var(--transition-fast);
}

.input-neon::placeholder {
    color: var(--color-text-dim);
}

.input-neon:focus {
    border-color: var(--color-cyan);
    background: rgba(255, 255, 255, 0.06);
    box-shadow: 0 0 10px rgba(6, 198, 227, 0.15);
}

.btn-primary-sm {
    background: linear-gradient(135deg, var(--color-purple), var(--color-indigo));
    color: white;
    padding: 0.6rem 1rem;
    border-radius: 10px;
    font-size: 0.85rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.4rem;
    box-shadow: 0 4px 10px var(--color-purple-glow);
}

.btn-primary-sm:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 14px var(--color-purple-glow);
    filter: brightness(1.1);
}

.btn-primary-sm:active {
    transform: translateY(0);
}

.presets-list {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    max-height: 150px;
    overflow-y: auto;
    padding-right: 2px;
}

/* Custom Scrollbar for Presets List */
.presets-list::-webkit-scrollbar {
    width: 4px;
}
.presets-list::-webkit-scrollbar-track {
    background: transparent;
}
.presets-list::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 2px;
}
.presets-list::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.2);
}

.no-presets {
    font-size: 0.8rem;
    color: var(--color-text-dim);
    text-align: center;
    padding: 0.8rem 0;
    font-style: italic;
}

.preset-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 0.8rem;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.04);
    border-radius: 10px;
    transition: var(--transition-fast);
    cursor: pointer;
}

.preset-item:hover {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.1);
}

.preset-info {
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
    flex: 1;
    min-width: 0;
}

.preset-name {
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--color-text);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.preset-meta {
    font-size: 0.7rem;
    color: var(--color-text-muted);
}

.btn-delete-preset {
    background: transparent;
    color: var(--color-text-dim);
    width: 26px;
    height: 26px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition-fast);
}

.btn-delete-preset:hover {
    background: rgba(239, 68, 68, 0.15);
    color: var(--color-danger);
}


/* Binaural & Modulation Button Selector Subtitle Styles */
.btn-select-small:has(small) {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.15rem;
    padding: 0.45rem 0.3rem;
}

.btn-select-small small {
    font-size: 0.6rem;
    color: var(--color-text-dim);
    font-weight: normal;
    margin-top: 0.1rem;
    display: block;
}

.btn-select-small.active small {
    color: var(--color-cyan);
}

/* Specific active purple small state for tuner modulation type button */
#btnModTremolo.active small, #btnModAsr.active small {
    color: var(--color-purple);
}

#btnModTremolo.active, #btnModAsr.active {
    background: rgba(162, 28, 243, 0.08);
    border-color: var(--color-purple);
    color: var(--color-text);
    box-shadow: 0 0 8px rgba(162, 28, 243, 0.1);
}

/* Local Music Player Card Styles */
.music-player-card {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.04);
    border-radius: 16px;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
    margin-top: 0.2rem;
}

.file-upload-wrapper input[type="file"] {
    display: none;
}

.file-upload-label {
    display: flex !important;
    align-items: center;
    justify-content: center;
    gap: 0.6rem;
    border: 2px dashed rgba(6, 198, 227, 0.25) !important;
    background: rgba(6, 198, 227, 0.02) !important;
    border-radius: 12px;
    padding: 0.8rem 1.2rem;
    cursor: pointer;
    transition: var(--transition-smooth);
    width: 100%;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--color-text-muted);
}

.file-upload-label:hover {
    border-color: var(--color-cyan) !important;
    background: rgba(6, 198, 227, 0.05) !important;
    color: var(--color-text);
    box-shadow: 0 0 10px rgba(6, 198, 227, 0.1);
}

.player-controls-row {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.04);
    border-radius: 12px;
    padding: 0.6rem 0.8rem;
    animation: fadeInPlayer 0.3s ease-out;
}

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

.player-progress-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}

.player-time-info {
    display: flex;
    justify-content: space-between;
    font-size: 0.65rem;
    color: var(--color-text-dim);
    font-family: monospace;
}

#localAudioProgress {
    height: 4px;
    margin: 0.2rem 0;
}



