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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: #0a0a12;
    color: #ffffff;
    overflow: hidden;
    height: 100vh;
    width: 100vw;
}

#app {
    display: flex;
    flex-direction: column;
    height: 100vh;
    width: 100vw;
}

/* Control Bar */
#control-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 16px;
    background: rgba(20, 20, 30, 0.9);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    height: 70px;
    z-index: 100;
}

.control-section {
    display: flex;
    gap: 16px;
}

.section-label {
    font-size: 11px;
    color: #888;
    cursor: pointer;
    transition: color 0.2s;
}

.section-label:hover {
    color: #fff;
}

#preset-selector {
    padding: 6px 12px;
    background: rgba(30, 30, 45, 0.9);
    border: 1px solid #444;
    color: #fff;
    font-size: 12px;
    border-radius: 4px;
    cursor: pointer;
    min-width: 150px;
}

#preset-selector:hover {
    border-color: #666;
}

#preset-selector:focus {
    outline: none;
    border-color: #4a9eff;
}

#preset-selector option {
    background: #1a1a2e;
    color: #fff;
}

.title-section h1 {
    font-size: 14px;
    font-weight: 400;
    color: #aaa;
    white-space: nowrap;
}

/* Dial Controls */
.dial-section {
    display: flex;
    gap: 12px;
    align-items: center;
}

.dial-group {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.dial {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: linear-gradient(145deg, #1a1a2e, #0f0f1a);
    border: 2px solid #333;
    position: relative;
    cursor: pointer;
    transition: border-color 0.2s;
}

.dial:hover {
    border-color: #666;
}

.dial-knob {
    position: absolute;
    width: 4px;
    height: 12px;
    background: #fff;
    border-radius: 2px;
    top: 4px;
    left: 50%;
    transform-origin: bottom center;
    transform: translateX(-50%);
}

.dial-value {
    position: absolute;
    bottom: -2px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 9px;
    color: #888;
}

.dial-label {
    font-size: 9px;
    color: #666;
}

/* Info Section */
.info-section {
    display: flex;
    align-items: center;
    gap: 16px;
}

#glow-color-btn {
    padding: 4px 12px;
    background: transparent;
    border: 1px solid #444;
    color: #888;
    font-size: 11px;
    cursor: pointer;
    border-radius: 4px;
}

#glow-color-btn:hover {
    border-color: #666;
    color: #fff;
}

.playback-controls {
    display: flex;
    gap: 4px;
}

.playback-controls button {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: 1px solid #444;
    background: transparent;
    color: #888;
    cursor: pointer;
    font-size: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.playback-controls button:hover {
    border-color: #666;
    color: #fff;
}

.playback-controls button.active {
    border-color: #4a9eff;
    color: #4a9eff;
}

#time-display {
    font-size: 11px;
    color: #666;
    font-family: monospace;
}

/* Canvas Container */
#canvas-container {
    flex: 1;
    position: relative;
    overflow: hidden;
}

#main-canvas {
    width: 100%;
    height: 100%;
    display: block;
}

/* Start Overlay */
#start-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(10, 10, 18, 0.95);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    cursor: pointer;
    transition: opacity 0.5s;
}

#start-overlay.hidden {
    opacity: 0;
    pointer-events: none;
}

.start-content {
    text-align: center;
}

.start-content h2 {
    font-size: 32px;
    font-weight: 300;
    margin-bottom: 16px;
    color: #fff;
}

.start-content p {
    font-size: 14px;
    color: #666;
}

/* Glow effect for triggered notes */
.glow {
    filter: drop-shadow(0 0 10px currentColor);
}

/* Side Panel */
#side-panel {
    position: fixed;
    right: 0;
    top: 70px;
    bottom: 0;
    width: 280px;
    background: rgba(15, 15, 25, 0.95);
    border-left: 1px solid rgba(255, 255, 255, 0.1);
    /* above the iso/wellness edge toggles (201) so they cannot bleed through */
    z-index: 202;
    transition: transform 0.3s ease;
    display: flex;
    flex-direction: column;
}

#side-panel.collapsed {
    transform: translateX(280px);
}

#panel-toggle {
    position: absolute;
    left: -36px;
    top: 10px;
    width: 36px;
    height: 36px;
    background: rgba(30, 30, 45, 0.95);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-right: none;
    border-radius: 6px 0 0 6px;
    color: #888;
    font-size: 18px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s, background 0.2s;
}

#panel-toggle:hover {
    color: #fff;
    background: rgba(40, 40, 60, 0.95);
}

.panel-content {
    padding: 16px;
    overflow-y: auto;
    flex: 1;
}

.panel-content h3 {
    font-size: 14px;
    font-weight: 500;
    color: #fff;
    margin-bottom: 16px;
    padding-bottom: 8px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.panel-section {
    margin-bottom: 20px;
}

.panel-section h4 {
    font-size: 11px;
    font-weight: 500;
    color: #888;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 12px;
}

.slider-group {
    margin-bottom: 12px;
}

.slider-group label {
    display: block;
    font-size: 11px;
    color: #aaa;
    margin-bottom: 4px;
}

.slider-group input[type="range"] {
    width: calc(100% - 45px);
    height: 4px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 2px;
    outline: none;
    -webkit-appearance: none;
    vertical-align: middle;
}

.slider-group input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 14px;
    height: 14px;
    background: #4a9eff;
    border-radius: 50%;
    cursor: pointer;
    transition: background 0.2s;
}

.slider-group input[type="range"]::-webkit-slider-thumb:hover {
    background: #6bb3ff;
}

.slider-group .slider-value {
    display: inline-block;
    width: 40px;
    text-align: right;
    font-size: 10px;
    color: #666;
    vertical-align: middle;
}

/* ===== Ring Editor Panel ===== */
#ring-editor {
    position: fixed;
    left: 0;
    top: 70px;
    bottom: 0;
    width: 260px;
    background: rgba(15, 15, 25, 0.98);
    border-right: 1px solid rgba(255, 255, 255, 0.1);
    z-index: 200;
    transition: left 0.3s ease;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

#ring-editor.collapsed {
    left: -260px;
}

#ring-editor-toggle {
    position: fixed;
    left: 0;
    top: 80px;
    width: 36px;
    height: 36px;
    background: rgba(30, 30, 45, 0.95);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-left: none;
    border-radius: 0 6px 6px 0;
    color: #888;
    font-size: 18px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s, background 0.2s, left 0.3s ease;
    z-index: 201;
}

#ring-editor-toggle.open {
    left: 260px;
}

#ring-editor-toggle:hover {
    color: #fff;
    background: rgba(40, 40, 60, 0.95);
}

.editor-content {
    padding: 12px;
    overflow-y: auto;
    flex: 1;
}

.editor-header {
    margin-bottom: 12px;
}

.editor-header h3 {
    font-size: 13px;
    font-weight: 500;
    color: #fff;
    margin-bottom: 10px;
}

.ring-selector {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
}

.ring-nav {
    width: 28px;
    height: 28px;
    border-radius: 4px;
    border: 1px solid #444;
    background: transparent;
    color: #888;
    cursor: pointer;
    font-size: 12px;
}

.ring-nav:hover {
    border-color: #666;
    color: #fff;
}

#ring-indicator {
    font-size: 12px;
    color: #4a9eff;
    min-width: 80px;
    text-align: center;
}

.ring-preview {
    display: flex;
    justify-content: center;
    margin-bottom: 12px;
}

#ring-preview-canvas {
    border-radius: 8px;
    background: rgba(0, 0, 0, 0.3);
}

.editor-sections {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.editor-section {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 6px;
    padding: 10px;
}

.editor-section h4 {
    font-size: 10px;
    font-weight: 500;
    color: #888;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
}

.editor-select {
    width: 100%;
    padding: 6px 8px;
    background: rgba(30, 30, 45, 0.9);
    border: 1px solid #444;
    color: #fff;
    font-size: 11px;
    border-radius: 4px;
    cursor: pointer;
}

.editor-select:hover {
    border-color: #666;
}

.editor-select:focus {
    outline: none;
    border-color: #4a9eff;
}

/* Waveform Buttons */
.waveform-buttons {
    display: flex;
    gap: 6px;
}

.waveform-btn {
    flex: 1;
    height: 32px;
    border-radius: 4px;
    border: 1px solid #444;
    background: transparent;
    color: #888;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s;
}

.waveform-btn:hover {
    border-color: #666;
    color: #fff;
}

.waveform-btn.active {
    border-color: #4a9eff;
    background: rgba(74, 158, 255, 0.2);
    color: #4a9eff;
}

/* Octave Control */
.octave-control {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
}

.octave-btn {
    width: 32px;
    height: 32px;
    border-radius: 4px;
    border: 1px solid #444;
    background: transparent;
    color: #888;
    cursor: pointer;
    font-size: 16px;
}

.octave-btn:hover {
    border-color: #666;
    color: #fff;
}

#octave-value {
    font-size: 18px;
    color: #4a9eff;
    min-width: 24px;
    text-align: center;
}

/* Duration Buttons */
.duration-buttons {
    display: flex;
    gap: 4px;
}

.duration-btn {
    flex: 1;
    height: 28px;
    border-radius: 4px;
    border: 1px solid #444;
    background: transparent;
    color: #888;
    cursor: pointer;
    font-size: 10px;
    transition: all 0.2s;
}

.duration-btn:hover {
    border-color: #666;
    color: #fff;
}

.duration-btn.active {
    border-color: #4a9eff;
    background: rgba(74, 158, 255, 0.2);
    color: #4a9eff;
}

/* Envelope Sliders */
.envelope-sliders {
    display: flex;
    gap: 8px;
    margin-bottom: 8px;
}

.mini-slider {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.mini-slider label {
    font-size: 9px;
    color: #666;
}

.mini-slider input[type="range"] {
    width: 100%;
    height: 60px;
    -webkit-appearance: slider-vertical;
    writing-mode: bt-lr;
    background: transparent;
}

.mini-slider input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 12px;
    height: 12px;
    background: #4a9eff;
    border-radius: 50%;
    cursor: pointer;
}

.mini-slider input[type="range"]::-webkit-slider-runnable-track {
    width: 4px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 2px;
}

#envelope-canvas {
    width: 100%;
    border-radius: 4px;
}

/* Mix Sliders */
.mix-sliders {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.slider-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.slider-row label {
    font-size: 10px;
    color: #888;
    width: 40px;
}

.slider-row input[type="range"] {
    flex: 1;
    height: 4px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 2px;
    -webkit-appearance: none;
}

.slider-row input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 12px;
    height: 12px;
    background: #4a9eff;
    border-radius: 50%;
    cursor: pointer;
}

.slider-val {
    font-size: 10px;
    color: #666;
    width: 35px;
    text-align: right;
}

/* Mute/Solo/Test */
.mute-solo {
    display: flex;
    gap: 8px;
    justify-content: center;
}

.mute-btn, .solo-btn, .test-btn {
    width: 40px;
    height: 28px;
    border-radius: 4px;
    border: 1px solid #444;
    background: transparent;
    color: #888;
    cursor: pointer;
    font-size: 11px;
    font-weight: 600;
    transition: all 0.2s;
}

.mute-btn:hover, .solo-btn:hover, .test-btn:hover {
    border-color: #666;
    color: #fff;
}

.mute-btn.active {
    border-color: #ff5555;
    background: rgba(255, 85, 85, 0.2);
    color: #ff5555;
}

.solo-btn.active {
    border-color: #50fa7b;
    background: rgba(80, 250, 123, 0.2);
    color: #50fa7b;
}

.test-btn {
    width: 60px;
}

.test-btn:hover {
    border-color: #4a9eff;
    color: #4a9eff;
}

/* Action Buttons */
.editor-section.actions {
    display: flex;
    gap: 8px;
}

.action-btn {
    flex: 1;
    height: 32px;
    border-radius: 4px;
    border: 1px solid #444;
    background: transparent;
    color: #888;
    cursor: pointer;
    font-size: 11px;
    transition: all 0.2s;
}

.action-btn:hover {
    border-color: #4a9eff;
    color: #4a9eff;
}

.action-btn.small {
    height: 28px;
    font-size: 10px;
}

.preset-actions {
    display: flex;
    gap: 6px;
}

/* ===== Isochronic Tones Panel ===== */
#iso-panel {
    position: fixed;
    right: 0;
    top: 70px;
    bottom: 0;
    width: 260px;
    background: rgba(15, 15, 25, 0.98);
    border-left: 1px solid rgba(255, 255, 255, 0.1);
    /* above the iso/wellness edge toggles (201) so they cannot bleed through */
    z-index: 202;
    transition: right 0.3s ease;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

#iso-panel.collapsed {
    right: -260px;
}

#iso-toggle {
    position: fixed;
    right: 0;
    top: 130px;
    width: 36px;
    height: 36px;
    background: rgba(30, 30, 45, 0.95);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-right: none;
    border-radius: 6px 0 0 6px;
    color: #888;
    font-size: 18px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s, background 0.2s, right 0.3s ease;
    z-index: 201;
}

#iso-toggle.open {
    right: 260px;
}

#iso-toggle:hover {
    color: #fff;
    background: rgba(40, 40, 60, 0.95);
}

.iso-content {
    padding: 12px;
    overflow-y: auto;
    flex: 1;
}

.iso-header {
    margin-bottom: 12px;
    text-align: center;
}

.iso-header h3 {
    font-size: 13px;
    font-weight: 500;
    color: #fff;
    margin-bottom: 4px;
}

.iso-subtitle {
    font-size: 10px;
    color: #666;
}

/* Brainwave Display */
.iso-brainwave-display {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    margin-bottom: 16px;
    padding: 12px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 8px;
}

.brainwave-indicator {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 8px 16px;
    border: 2px solid #22c55e;
    border-radius: 8px;
    color: #22c55e;
    transition: all 0.3s;
}

.brainwave-label {
    font-size: 16px;
    font-weight: 600;
}

.brainwave-freq {
    font-size: 12px;
    opacity: 0.8;
}

#iso-visualizer {
    border-radius: 4px;
}

/* Isochronic Sections */
.iso-section {
    margin-bottom: 12px;
    padding: 10px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 6px;
}

.iso-section h4 {
    font-size: 10px;
    font-weight: 500;
    color: #888;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
}

.iso-select {
    width: 100%;
    padding: 6px 8px;
    background: rgba(30, 30, 45, 0.9);
    border: 1px solid #444;
    color: #fff;
    font-size: 11px;
    border-radius: 4px;
    cursor: pointer;
}

.iso-select:hover {
    border-color: #666;
}

.iso-select:focus {
    outline: none;
    border-color: #4a9eff;
}

.preset-description {
    font-size: 10px;
    color: #666;
    margin-top: 6px;
    font-style: italic;
}

/* Slider Row */
.iso-slider-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.iso-slider-row input[type="range"] {
    flex: 1;
    height: 4px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 2px;
    -webkit-appearance: none;
}

.iso-slider-row input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 14px;
    height: 14px;
    background: #4a9eff;
    border-radius: 50%;
    cursor: pointer;
    transition: background 0.2s;
}

.iso-slider-row input[type="range"]::-webkit-slider-thumb:hover {
    background: #6bb3ff;
}

.iso-value {
    font-size: 11px;
    color: #4a9eff;
    min-width: 50px;
    text-align: right;
}

/* Brainwave Bands */
.brainwave-bands {
    display: flex;
    justify-content: space-between;
    margin-top: 8px;
    padding-top: 6px;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.brainwave-bands .band {
    font-size: 9px;
    padding: 2px 6px;
    border-radius: 3px;
    opacity: 0.4;
    transition: opacity 0.3s, transform 0.2s;
}

.brainwave-bands .band.active {
    opacity: 1;
    transform: scale(1.1);
}

.brainwave-bands .band.delta {
    color: #8b5cf6;
    background: rgba(139, 92, 246, 0.2);
}

.brainwave-bands .band.theta {
    color: #06b6d4;
    background: rgba(6, 182, 212, 0.2);
}

.brainwave-bands .band.alpha {
    color: #22c55e;
    background: rgba(34, 197, 94, 0.2);
}

.brainwave-bands .band.beta {
    color: #eab308;
    background: rgba(234, 179, 8, 0.2);
}

.brainwave-bands .band.gamma {
    color: #ef4444;
    background: rgba(239, 68, 68, 0.2);
}

/* Isochronic Buttons */
.iso-buttons {
    display: flex;
    gap: 6px;
}

.iso-shape-btn, .iso-pulse-btn {
    flex: 1;
    height: 28px;
    border-radius: 4px;
    border: 1px solid #444;
    background: transparent;
    color: #888;
    cursor: pointer;
    font-size: 10px;
    transition: all 0.2s;
}

.iso-shape-btn:hover, .iso-pulse-btn:hover {
    border-color: #666;
    color: #fff;
}

.iso-shape-btn.active, .iso-pulse-btn.active {
    border-color: #4a9eff;
    background: rgba(74, 158, 255, 0.2);
    color: #4a9eff;
}

/* Isochronic Controls */
.iso-controls {
    display: flex;
    justify-content: center;
    margin-top: 16px;
}

.iso-play-btn {
    width: 100%;
    height: 40px;
    border-radius: 6px;
    border: 2px solid #22c55e;
    background: rgba(34, 197, 94, 0.1);
    color: #22c55e;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.2s;
}

.iso-play-btn:hover {
    background: rgba(34, 197, 94, 0.2);
}

.iso-play-btn.playing {
    border-color: #ef4444;
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
}

.iso-play-btn.playing:hover {
    background: rgba(239, 68, 68, 0.2);
}

/* Isochronic Info */
.iso-info {
    margin-top: 16px;
    padding: 10px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 6px;
}

.iso-info p {
    font-size: 10px;
    color: #666;
    line-height: 1.5;
}

.iso-info strong {
    color: #888;
}

/* ===== Color Themes Panel ===== */
#theme-panel {
    position: fixed;
    left: 0;
    top: 70px;
    bottom: 0;
    width: 280px;
    background: rgba(15, 15, 25, 0.98);
    border-right: 1px solid rgba(255, 255, 255, 0.1);
    z-index: 199;
    transition: left 0.3s ease;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

#theme-panel.collapsed {
    left: -280px;
}

#theme-toggle {
    position: fixed;
    left: 0;
    top: 125px;
    width: 36px;
    height: 36px;
    background: rgba(30, 30, 45, 0.95);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-left: none;
    border-radius: 0 6px 6px 0;
    color: #888;
    font-size: 18px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s, background 0.2s, left 0.3s ease;
    z-index: 200;
}

#theme-toggle.open {
    left: 280px;
}

#theme-toggle:hover {
    color: #fff;
    background: rgba(40, 40, 60, 0.95);
}

.theme-content {
    padding: 12px;
    overflow-y: auto;
    flex: 1;
}

.theme-header {
    margin-bottom: 16px;
    text-align: center;
}

.theme-header h3 {
    font-size: 13px;
    font-weight: 500;
    color: #fff;
    margin-bottom: 4px;
}

.theme-subtitle {
    font-size: 10px;
    color: #666;
}

.theme-section {
    margin-bottom: 16px;
    padding: 10px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 6px;
}

.theme-section h4 {
    font-size: 10px;
    font-weight: 500;
    color: #888;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 10px;
}

/* Theme Grid */
.theme-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
}

.theme-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 8px 4px;
    background: rgba(30, 30, 45, 0.6);
    border: 1px solid #333;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
}

.theme-btn:hover {
    border-color: #555;
    background: rgba(40, 40, 60, 0.8);
}

.theme-btn.active {
    border-color: #4a9eff;
    background: rgba(74, 158, 255, 0.15);
}

.theme-btn-colors {
    display: flex;
    gap: 2px;
    margin-bottom: 4px;
}

.color-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.theme-btn-name {
    font-size: 9px;
    color: #aaa;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}

.theme-btn.active .theme-btn-name {
    color: #4a9eff;
}

/* Theme Preview */
.theme-preview {
    display: flex;
    justify-content: center;
    margin-top: 10px;
}

.preview-bg {
    position: relative;
    width: 100px;
    height: 100px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.preview-ring {
    position: absolute;
    border: 2px solid;
    border-radius: 50%;
    opacity: 0.8;
}

.preview-glow {
    position: absolute;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    opacity: 0.6;
    filter: blur(8px);
}

/* Custom Colors */
.custom-colors {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.color-picker-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.color-picker-row label {
    font-size: 11px;
    color: #aaa;
}

.color-picker-row input[type="color"] {
    width: 50px;
    height: 26px;
    border: 1px solid #444;
    border-radius: 4px;
    background: transparent;
    cursor: pointer;
    padding: 0;
}

.color-picker-row input[type="color"]::-webkit-color-swatch-wrapper {
    padding: 2px;
}

.color-picker-row input[type="color"]::-webkit-color-swatch {
    border: none;
    border-radius: 2px;
}

.apply-custom-btn {
    margin-top: 8px;
    padding: 8px 16px;
    background: rgba(74, 158, 255, 0.2);
    border: 1px solid #4a9eff;
    border-radius: 4px;
    color: #4a9eff;
    font-size: 11px;
    cursor: pointer;
    transition: all 0.2s;
}

.apply-custom-btn:hover {
    background: rgba(74, 158, 255, 0.3);
}

.theme-info {
    margin-top: 12px;
    padding: 8px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 4px;
}

.theme-info p {
    font-size: 10px;
    color: #666;
    line-height: 1.4;
    margin: 0;
}

/* ===== 3D Mode Toggle ===== */
#toggle-3d {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: rgba(30, 30, 45, 0.9);
    border: 2px solid #444;
    color: #888;
    font-size: 14px;
    font-weight: bold;
    cursor: pointer;
    z-index: 300;
    transition: all 0.3s;
}

#toggle-3d:hover {
    border-color: #4a9eff;
    color: #4a9eff;
    transform: scale(1.1);
}

#toggle-3d.active {
    background: rgba(74, 158, 255, 0.2);
    border-color: #4a9eff;
    color: #4a9eff;
    box-shadow: 0 0 20px rgba(74, 158, 255, 0.5);
}

#three-canvas {
    pointer-events: none;
}

/* Mode toggle buttons */
.mode-buttons {
    margin-bottom: 8px;
}

.iso-mode-btn {
    flex: 1;
    height: 32px;
    border-radius: 4px;
    border: 1px solid #444;
    background: transparent;
    color: #888;
    cursor: pointer;
    font-size: 11px;
    transition: all 0.2s;
}

.iso-mode-btn:hover {
    border-color: #666;
    color: #fff;
}

.iso-mode-btn.active {
    border-color: #22c55e;
    background: rgba(34, 197, 94, 0.2);
    color: #22c55e;
}

.mode-info {
    font-size: 9px;
    color: #666;
    font-style: italic;
    margin-top: 6px;
}

/* ===== Ambient Soundscapes Panel ===== */
#ambient-panel {
    position: fixed;
    left: 0;
    top: 70px;
    bottom: 0;
    width: 260px;
    background: rgba(15, 15, 25, 0.98);
    border-right: 1px solid rgba(255, 255, 255, 0.1);
    z-index: 198;
    transition: left 0.3s ease;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

#ambient-panel.collapsed {
    left: -260px;
}

#ambient-toggle {
    position: fixed;
    left: 0;
    top: 170px;
    width: 36px;
    height: 36px;
    background: rgba(30, 30, 45, 0.95);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-left: none;
    border-radius: 0 6px 6px 0;
    color: #888;
    font-size: 18px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s, background 0.2s, left 0.3s ease;
    z-index: 199;
}

#ambient-toggle.open {
    left: 260px;
}

#ambient-toggle:hover {
    color: #fff;
    background: rgba(40, 40, 60, 0.95);
}

.ambient-content {
    padding: 12px;
    overflow-y: auto;
    flex: 1;
}

.ambient-header {
    margin-bottom: 16px;
    text-align: center;
}

.ambient-header h3 {
    font-size: 13px;
    font-weight: 500;
    color: #fff;
    margin-bottom: 4px;
}

.ambient-subtitle {
    font-size: 10px;
    color: #666;
}

.ambient-section {
    margin-bottom: 16px;
    padding: 10px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 6px;
}

.ambient-section h4 {
    font-size: 10px;
    font-weight: 500;
    color: #888;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 10px;
}

.ambient-slider-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.ambient-slider-row input[type="range"] {
    flex: 1;
    height: 4px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 2px;
    -webkit-appearance: none;
}

.ambient-slider-row input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 14px;
    height: 14px;
    background: #4a9eff;
    border-radius: 50%;
    cursor: pointer;
}

.ambient-value {
    font-size: 11px;
    color: #4a9eff;
    min-width: 40px;
    text-align: right;
}

/* Soundscape Grid */
.ambient-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
}

.soundscape-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 10px 6px;
    background: rgba(30, 30, 45, 0.6);
    border: 1px solid #333;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
}

.soundscape-btn:hover {
    border-color: #555;
    background: rgba(40, 40, 60, 0.8);
}

.soundscape-btn.active {
    border-color: #22c55e;
    background: rgba(34, 197, 94, 0.15);
}

.soundscape-icon {
    font-size: 20px;
    margin-bottom: 4px;
}

.soundscape-name {
    font-size: 9px;
    color: #aaa;
    text-align: center;
}

.soundscape-btn.active .soundscape-name {
    color: #22c55e;
}

/* Active Layers */
.active-layers {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.no-layers {
    font-size: 10px;
    color: #555;
    font-style: italic;
}

.active-layer-tag {
    font-size: 9px;
    padding: 3px 8px;
    background: rgba(34, 197, 94, 0.2);
    border: 1px solid #22c55e;
    border-radius: 12px;
    color: #22c55e;
}

.ambient-actions {
    margin-top: 12px;
}

.ambient-action-btn {
    width: 100%;
    padding: 8px;
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid #ef4444;
    border-radius: 4px;
    color: #ef4444;
    font-size: 11px;
    cursor: pointer;
    transition: all 0.2s;
}

.ambient-action-btn:hover {
    background: rgba(239, 68, 68, 0.2);
}

.ambient-info {
    margin-top: 12px;
    padding: 8px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 4px;
}

.ambient-info p {
    font-size: 10px;
    color: #666;
    line-height: 1.4;
    margin: 0;
}

/* ===== Wellness Panel ===== */
#wellness-panel {
    position: fixed;
    right: 0;
    top: 70px;
    bottom: 0;
    width: 260px;
    background: rgba(15, 15, 25, 0.98);
    border-left: 1px solid rgba(255, 255, 255, 0.1);
    z-index: 198;
    transition: right 0.3s ease;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

#wellness-panel.collapsed {
    right: -260px;
}

#wellness-toggle {
    position: fixed;
    right: 0;
    top: 175px;
    width: 36px;
    height: 36px;
    background: rgba(30, 30, 45, 0.95);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-right: none;
    border-radius: 6px 0 0 6px;
    color: #888;
    font-size: 18px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s, background 0.2s, right 0.3s ease;
    z-index: 199;
}

#wellness-toggle.open {
    right: 260px;
}

#wellness-toggle:hover {
    color: #fff;
    background: rgba(40, 40, 60, 0.95);
}

.wellness-content {
    padding: 12px;
    overflow-y: auto;
    flex: 1;
}

.wellness-header {
    margin-bottom: 16px;
    text-align: center;
}

.wellness-header h3 {
    font-size: 13px;
    font-weight: 500;
    color: #fff;
    margin-bottom: 4px;
}

.wellness-subtitle {
    font-size: 10px;
    color: #666;
}

.wellness-section {
    margin-bottom: 16px;
    padding: 10px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 6px;
}

.wellness-section h4 {
    font-size: 10px;
    font-weight: 500;
    color: #888;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 10px;
}

.wellness-select {
    width: 100%;
    padding: 6px 8px;
    background: rgba(30, 30, 45, 0.9);
    border: 1px solid #444;
    color: #fff;
    font-size: 11px;
    border-radius: 4px;
    cursor: pointer;
    margin-bottom: 8px;
}

/* Timer */
.timer-display {
    text-align: center;
    margin-bottom: 10px;
}

.timer-time {
    font-size: 32px;
    font-weight: 300;
    color: #4a9eff;
    display: block;
}

.timer-status {
    font-size: 10px;
    color: #666;
}

.timer-presets {
    display: flex;
    gap: 4px;
    margin-bottom: 10px;
}

.timer-preset-btn {
    flex: 1;
    padding: 6px;
    background: rgba(30, 30, 45, 0.6);
    border: 1px solid #444;
    border-radius: 4px;
    color: #888;
    font-size: 10px;
    cursor: pointer;
    transition: all 0.2s;
}

.timer-preset-btn:hover {
    border-color: #666;
    color: #fff;
}

.timer-preset-btn.active {
    border-color: #4a9eff;
    background: rgba(74, 158, 255, 0.2);
    color: #4a9eff;
}

.timer-controls {
    display: flex;
    gap: 8px;
}

.timer-control-btn {
    flex: 1;
    padding: 8px;
    background: rgba(30, 30, 45, 0.6);
    border: 1px solid #444;
    border-radius: 4px;
    color: #888;
    font-size: 11px;
    cursor: pointer;
    transition: all 0.2s;
}

.timer-control-btn:hover {
    border-color: #4a9eff;
    color: #4a9eff;
}

/* Breathing */
.breathing-display {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: 10px;
}

.breath-circle {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(34, 197, 94, 0.3) 0%, rgba(34, 197, 94, 0.1) 70%, transparent 100%);
    border: 2px solid #22c55e;
    transition: transform 0.3s ease;
    transform: scale(0.5);
    margin-bottom: 8px;
}

.breath-phase {
    font-size: 14px;
    font-weight: 500;
    color: #22c55e;
    transition: color 0.3s;
}

.breath-phase.inhale { color: #22c55e; }
.breath-phase.hold { color: #eab308; }
.breath-phase.exhale { color: #06b6d4; }
.breath-phase.holdOut { color: #8b5cf6; }

.breathing-controls {
    display: flex;
    gap: 8px;
}

.breathing-control-btn {
    flex: 1;
    padding: 8px;
    background: rgba(30, 30, 45, 0.6);
    border: 1px solid #444;
    border-radius: 4px;
    color: #888;
    font-size: 11px;
    cursor: pointer;
    transition: all 0.2s;
}

.breathing-control-btn:hover {
    border-color: #22c55e;
    color: #22c55e;
}

/* Tap Tempo */
.tap-tempo-btn {
    width: 100%;
    height: 50px;
    border-radius: 25px;
    background: rgba(30, 30, 45, 0.6);
    border: 2px solid #444;
    color: #888;
    font-size: 14px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.1s;
    margin-bottom: 8px;
}

.tap-tempo-btn:hover {
    border-color: #666;
    color: #fff;
}

.tap-tempo-btn.tapped {
    transform: scale(0.95);
    border-color: #4a9eff;
    background: rgba(74, 158, 255, 0.2);
}

.tap-result {
    display: block;
    text-align: center;
    font-size: 11px;
    color: #4a9eff;
}

/* Focus Mode */
.focus-btn {
    width: 100%;
    padding: 12px;
    background: rgba(139, 92, 246, 0.1);
    border: 2px solid #8b5cf6;
    border-radius: 6px;
    color: #8b5cf6;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    margin-bottom: 8px;
}

.focus-btn:hover {
    background: rgba(139, 92, 246, 0.2);
}

.focus-info {
    font-size: 9px;
    color: #666;
    text-align: center;
    margin: 0;
}

/* Focus Mode Active */
body.focus-mode {
    cursor: none;
}

body.focus-mode:hover {
    cursor: default;
}

#focus-exit-btn {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 10px 20px;
    background: rgba(0, 0, 0, 0.7);
    border: 1px solid #444;
    border-radius: 20px;
    color: #fff;
    font-size: 12px;
    cursor: pointer;
    z-index: 10000;
    transition: opacity 0.3s;
}

#focus-exit-btn:hover {
    background: rgba(0, 0, 0, 0.9);
    border-color: #666;
}

/* ===== Shape & Orbiters Panel ===== */
#shape-panel {
    position: fixed;
    left: 0;
    top: 70px;
    bottom: 0;
    width: 280px;
    background: rgba(15, 15, 25, 0.98);
    border-right: 1px solid rgba(255, 255, 255, 0.1);
    z-index: 197;
    transition: left 0.3s ease;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

#shape-panel.collapsed {
    left: -280px;
}

#shape-toggle {
    position: fixed;
    left: 0;
    top: 215px;
    width: 36px;
    height: 36px;
    background: rgba(30, 30, 45, 0.95);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-left: none;
    border-radius: 0 6px 6px 0;
    color: #888;
    font-size: 18px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s, background 0.2s, left 0.3s ease;
    z-index: 198;
}

#shape-toggle.open {
    left: 280px;
}

#shape-toggle:hover {
    color: #fff;
    background: rgba(40, 40, 60, 0.95);
}

.shape-content {
    padding: 12px;
    overflow-y: auto;
    flex: 1;
}

.shape-header {
    margin-bottom: 16px;
    text-align: center;
}

.shape-header h3 {
    font-size: 13px;
    font-weight: 500;
    color: #fff;
    margin-bottom: 4px;
}

.shape-subtitle {
    font-size: 10px;
    color: #666;
}

.shape-section {
    margin-bottom: 16px;
    padding: 10px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 6px;
}

.shape-section h4 {
    font-size: 10px;
    font-weight: 500;
    color: #888;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 10px;
}

.orbiter-controls {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.orbiter-count {
    font-size: 12px;
    color: #4a9eff;
    text-align: center;
}

.orbiter-buttons {
    display: flex;
    gap: 6px;
}

.shape-btn {
    flex: 1;
    padding: 6px 10px;
    background: rgba(30, 30, 45, 0.6);
    border: 1px solid #444;
    border-radius: 4px;
    color: #888;
    font-size: 10px;
    cursor: pointer;
    transition: all 0.2s;
}

.shape-btn:hover {
    border-color: #4a9eff;
    color: #4a9eff;
}

.shape-btn.danger:hover {
    border-color: #ef4444;
    color: #ef4444;
}

.orbiter-pattern {
    margin-top: 10px;
}

.orbiter-pattern label {
    display: block;
    font-size: 10px;
    color: #888;
    margin-bottom: 4px;
}

.shape-select {
    width: 100%;
    padding: 6px 8px;
    background: rgba(30, 30, 45, 0.9);
    border: 1px solid #444;
    color: #fff;
    font-size: 11px;
    border-radius: 4px;
    cursor: pointer;
}

.shape-slider-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}

.shape-slider-row label {
    font-size: 10px;
    color: #888;
    width: 40px;
}

.shape-slider-row input[type="range"] {
    flex: 1;
    height: 4px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 2px;
    -webkit-appearance: none;
}

.shape-slider-row input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 12px;
    height: 12px;
    background: #4a9eff;
    border-radius: 50%;
    cursor: pointer;
}

.shape-value {
    font-size: 10px;
    color: #4a9eff;
    min-width: 35px;
    text-align: right;
}

.shape-checkboxes {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-top: 8px;
}

.shape-checkboxes label {
    font-size: 10px;
    color: #888;
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
}

.shape-checkboxes input[type="checkbox"] {
    width: 14px;
    height: 14px;
    accent-color: #4a9eff;
}

.preset-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 6px;
}

.preset-btn {
    padding: 8px 6px;
    background: rgba(30, 30, 45, 0.6);
    border: 1px solid #333;
    border-radius: 4px;
    color: #888;
    font-size: 10px;
    cursor: pointer;
    transition: all 0.2s;
}

.preset-btn:hover {
    border-color: #bd93f9;
    color: #bd93f9;
    background: rgba(189, 147, 249, 0.1);
}

.shape-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 6px;
}

.mandala-shape-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 8px 4px;
    background: rgba(30, 30, 45, 0.6);
    border: 1px solid #333;
    border-radius: 4px;
    color: #888;
    font-size: 8px;
    cursor: pointer;
    transition: all 0.2s;
}

.mandala-shape-btn .shape-icon {
    font-size: 16px;
    margin-bottom: 2px;
}

.mandala-shape-btn .shape-name {
    font-size: 8px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}

.mandala-shape-btn:hover {
    border-color: #50fa7b;
    color: #50fa7b;
    background: rgba(80, 250, 123, 0.1);
}

.mandala-shape-btn.active {
    border-color: #50fa7b;
    color: #50fa7b;
    background: rgba(80, 250, 123, 0.15);
}

.toggle-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.toggle-row span {
    font-size: 11px;
    color: #aaa;
}

.toggle-btn {
    padding: 6px 16px;
    background: rgba(239, 68, 68, 0.2);
    border: 1px solid #ef4444;
    border-radius: 4px;
    color: #ef4444;
    font-size: 11px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s;
}

.toggle-btn.active {
    background: rgba(34, 197, 94, 0.2);
    border-color: #22c55e;
    color: #22c55e;
}

.shape-info {
    margin-top: 12px;
    padding: 8px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 4px;
}

.shape-info p {
    font-size: 10px;
    color: #666;
    line-height: 1.4;
    margin: 0;
}

/* ===================== Spectrum Halo (Resonance) ===================== */
#spectrum-panel {
    position: fixed;
    left: 0;
    top: 70px;
    bottom: 0;
    width: 280px;
    background: rgba(15, 15, 25, 0.98);
    border-right: 1px solid rgba(255, 255, 255, 0.1);
    z-index: 196;
    transition: left 0.3s ease;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

#spectrum-panel.collapsed {
    left: -280px;
}

#spectrum-toggle {
    position: fixed;
    left: 0;
    top: 260px;
    width: 36px;
    height: 36px;
    background: rgba(30, 30, 45, 0.95);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-left: none;
    border-radius: 0 6px 6px 0;
    color: #888;
    font-size: 18px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s, background 0.2s, left 0.3s ease;
    z-index: 197;
}

#spectrum-toggle.open {
    left: 280px;
}

#spectrum-toggle:hover {
    color: #fff;
    background: rgba(40, 40, 60, 0.95);
}

.spectrum-content {
    padding: 12px;
    overflow-y: auto;
    flex: 1;
}

.spectrum-header {
    margin-bottom: 16px;
    text-align: center;
}

.spectrum-header h3 {
    font-size: 13px;
    font-weight: 500;
    color: #fff;
    margin-bottom: 4px;
}

.spectrum-subtitle {
    font-size: 10px;
    color: #666;
}

.spectrum-section {
    margin-bottom: 16px;
    padding: 10px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 6px;
}

.spectrum-section h4 {
    font-size: 10px;
    font-weight: 500;
    color: #888;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 10px;
}

.spectrum-enable {
    width: 100%;
    padding: 8px 10px;
    background: rgba(30, 30, 45, 0.6);
    border: 1px solid #444;
    border-radius: 4px;
    color: #888;
    font-size: 11px;
    cursor: pointer;
    transition: all 0.2s;
}

.spectrum-enable:hover {
    border-color: #4a9eff;
    color: #4a9eff;
}

.spectrum-enable.active {
    background: rgba(74, 158, 255, 0.18);
    border-color: #4a9eff;
    color: #4a9eff;
}

.spectrum-modes {
    display: flex;
    gap: 6px;
}

.spectrum-mode-btn {
    flex: 1;
    padding: 6px 8px;
    background: rgba(30, 30, 45, 0.6);
    border: 1px solid #444;
    border-radius: 4px;
    color: #888;
    font-size: 10px;
    cursor: pointer;
    transition: all 0.2s;
}

.spectrum-mode-btn:hover {
    border-color: #4a9eff;
    color: #4a9eff;
}

.spectrum-mode-btn.active {
    background: rgba(74, 158, 255, 0.18);
    border-color: #4a9eff;
    color: #4a9eff;
}

.spectrum-slider-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}

.spectrum-slider-row:last-child {
    margin-bottom: 0;
}

.spectrum-slider-row label {
    font-size: 10px;
    color: #888;
    width: 64px;
}

.spectrum-slider-row input[type="range"] {
    flex: 1;
    height: 4px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 2px;
    -webkit-appearance: none;
}

.spectrum-slider-row input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 12px;
    height: 12px;
    background: #4a9eff;
    border-radius: 50%;
    cursor: pointer;
}

.spectrum-value {
    font-size: 10px;
    color: #4a9eff;
    min-width: 35px;
    text-align: right;
}

/* ===== Lo-Fi Radio Panel ===== */
#lofi-panel {
    position: fixed;
    right: 0;
    top: 70px;
    bottom: 0;
    width: 300px;
    background: rgba(15, 15, 25, 0.98);
    border-left: 1px solid rgba(255, 255, 255, 0.1);
    /* above the iso/wellness edge toggles (201) so they cannot bleed through */
    z-index: 202;
    transition: right 0.3s ease;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

#lofi-panel.collapsed {
    right: -300px;
}

#lofi-toggle {
    position: fixed;
    right: 0;
    top: 220px;
    width: 36px;
    height: 36px;
    background: rgba(30, 30, 45, 0.95);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-right: none;
    border-radius: 6px 0 0 6px;
    color: #888;
    font-size: 18px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s, background 0.2s, right 0.3s ease;
    z-index: 203;
}

#lofi-toggle.open {
    right: 300px;
}

#lofi-toggle:hover {
    color: #fff;
    background: rgba(40, 40, 60, 0.95);
}

#lofi-toggle.live {
    color: #ffb86c;
    border-color: rgba(255, 184, 108, 0.5);
    box-shadow: 0 0 12px rgba(255, 184, 108, 0.25);
}

.lofi-content {
    padding: 12px;
    overflow-y: auto;
    flex: 1;
}

.lofi-header {
    margin-bottom: 16px;
    text-align: center;
}

.lofi-header h3 {
    font-size: 13px;
    font-weight: 500;
    color: #fff;
    margin-bottom: 4px;
}

.lofi-subtitle {
    font-size: 10px;
    color: #666;
}

.lofi-section {
    margin-bottom: 16px;
    padding: 10px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 6px;
}

.lofi-section h4 {
    font-size: 10px;
    font-weight: 500;
    color: #888;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 10px;
}

/* --- stations --- */
.lofi-stations {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.lofi-station-btn {
    display: grid;
    grid-template-columns: 24px 1fr;
    grid-template-rows: auto auto;
    align-items: center;
    text-align: left;
    gap: 0 8px;
    padding: 7px 9px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 5px;
    color: #aaa;
    cursor: pointer;
    transition: all 0.2s;
}

.lofi-station-btn:hover {
    background: rgba(255, 255, 255, 0.08);
    color: #fff;
}

.lofi-station-btn.active {
    border-color: #ffb86c;
    background: rgba(255, 184, 108, 0.12);
    color: #ffb86c;
}

.lofi-station-icon {
    grid-row: 1 / 3;
    font-size: 17px;
    text-align: center;
}

.lofi-station-name {
    font-size: 11px;
    font-weight: 500;
}

.lofi-station-blurb {
    font-size: 9px;
    color: #666;
    line-height: 1.3;
}

.lofi-station-btn.active .lofi-station-blurb {
    color: rgba(255, 184, 108, 0.7);
}

/* --- transport + now playing --- */
.lofi-transport {
    margin-bottom: 8px;
}

.lofi-play-btn {
    width: 100%;
    padding: 9px;
    background: rgba(255, 184, 108, 0.14);
    border: 1px solid rgba(255, 184, 108, 0.45);
    border-radius: 5px;
    color: #ffb86c;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.lofi-play-btn:hover {
    background: rgba(255, 184, 108, 0.25);
}

.lofi-play-btn.playing {
    background: rgba(80, 250, 123, 0.12);
    border-color: rgba(80, 250, 123, 0.45);
    color: #50fa7b;
}

.lofi-now {
    padding: 8px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 5px;
    min-height: 40px;
}

.lofi-now-idle {
    font-size: 10px;
    color: #555;
    font-style: italic;
}

.lofi-now-line {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 3px;
}

.lofi-now-label {
    font-size: 11px;
    color: #fff;
    text-transform: capitalize;
}

.lofi-now-src {
    font-size: 8px;
    padding: 1px 5px;
    border-radius: 3px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    background: rgba(255, 255, 255, 0.08);
    color: #777;
}

.lofi-now-src.llm {
    background: rgba(189, 147, 249, 0.18);
    color: #bd93f9;
}

.lofi-now-key {
    font-size: 9px;
    color: #666;
    margin-bottom: 4px;
}

.lofi-now-chords {
    font-size: 11px;
    color: #8be9fd;
    font-family: 'SF Mono', 'Consolas', monospace;
    letter-spacing: 0.5px;
    word-spacing: 2px;
}

.lofi-now-note {
    margin-top: 4px;
    font-size: 9px;
    color: #7a6a9a;
    font-style: italic;
    line-height: 1.35;
}

.lofi-progress {
    margin-top: 6px;
    height: 2px;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 1px;
    overflow: hidden;
}

.lofi-progress span {
    display: block;
    height: 100%;
    background: #ffb86c;
    transition: width 0.6s linear;
}

/* --- sliders --- */
.lofi-slider-row {
    display: grid;
    grid-template-columns: 66px 1fr 46px;
    align-items: center;
    gap: 8px;
    margin-bottom: 7px;
}

.lofi-slider-row:last-child {
    margin-bottom: 0;
}

.lofi-slider-row label {
    font-size: 10px;
    color: #999;
}

.lofi-slider-row input[type="range"] {
    width: 100%;
    height: 4px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 2px;
    -webkit-appearance: none;
}

.lofi-slider-row input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 12px;
    height: 12px;
    background: #ffb86c;
    border-radius: 50%;
    cursor: pointer;
}

.lofi-value {
    font-size: 10px;
    color: #ffb86c;
    text-align: right;
}

/* --- switches --- */
/* Names the poem while it is being read; empty and invisible otherwise. */
.lofi-poem-now {
    margin-top: 8px;
    min-height: 0;
    color: #6a6a7a;
    font-size: 10px;
    font-style: italic;
    line-height: 1.45;
    text-align: center;
    opacity: 0;
    transition: opacity 0.8s ease;
}

.lofi-poem-now.active {
    color: #c9a7d8;
    opacity: 1;
}

.lofi-switch {
    display: block;
    width: 100%;
    margin-top: 6px;
    padding: 6px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    color: #888;
    font-size: 10px;
    cursor: pointer;
    transition: all 0.2s;
}

.lofi-switch:hover {
    background: rgba(255, 255, 255, 0.08);
    color: #ccc;
}

.lofi-switch.active {
    border-color: #50fa7b;
    background: rgba(80, 250, 123, 0.12);
    color: #50fa7b;
}

.lofi-switch:disabled {
    opacity: 0.4;
    cursor: default;
}

.lofi-switch:disabled:hover {
    background: rgba(255, 255, 255, 0.04);
    color: #888;
}

/* --- director --- */
.lofi-director-modes {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 4px;
    margin-bottom: 8px;
}

.lofi-dir-btn {
    padding: 5px 2px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    color: #888;
    font-size: 10px;
    cursor: pointer;
    transition: all 0.2s;
}

.lofi-dir-btn:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.08);
}

.lofi-dir-btn.active {
    border-color: #bd93f9;
    background: rgba(189, 147, 249, 0.16);
    color: #bd93f9;
}

.lofi-field {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 6px;
}

.lofi-field span {
    font-size: 10px;
    color: #999;
    min-width: 56px;
}

.lofi-field input {
    flex: 1;
    min-width: 0;
    padding: 5px 6px;
    background: rgba(0, 0, 0, 0.35);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    color: #ddd;
    font-size: 10px;
    font-family: 'SF Mono', 'Consolas', monospace;
}

.lofi-field input:focus {
    outline: none;
    border-color: rgba(189, 147, 249, 0.6);
}

.lofi-action-btn {
    width: 100%;
    padding: 6px;
    background: rgba(189, 147, 249, 0.12);
    border: 1px solid rgba(189, 147, 249, 0.4);
    border-radius: 4px;
    color: #bd93f9;
    font-size: 10px;
    cursor: pointer;
    transition: all 0.2s;
}

.lofi-action-btn:hover:not(:disabled) {
    background: rgba(189, 147, 249, 0.24);
}

.lofi-action-btn:disabled {
    opacity: 0.5;
    cursor: default;
}

.lofi-status {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 8px;
    padding: 5px 7px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 4px;
}

.lofi-led {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #666;
    flex-shrink: 0;
}

.lofi-status.local .lofi-led { background: #666; }
.lofi-status.thinking .lofi-led { background: #ffb86c; animation: lofi-blink 1s infinite; }
.lofi-status.ok .lofi-led { background: #50fa7b; }
.lofi-status.error .lofi-led { background: #ff5555; }

@keyframes lofi-blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.25; }
}

.lofi-status-text {
    font-size: 9px;
    color: #888;
    line-height: 1.3;
    word-break: break-word;
}

.lofi-info {
    margin-top: 8px;
    font-size: 9px;
    color: #555;
    line-height: 1.45;
}

.lofi-info code {
    color: #8be9fd;
    font-family: 'SF Mono', 'Consolas', monospace;
}
