/* ===================================
   COLOR SYSTEM - PREMIUM INDUSTRIAL
   =================================== */

:root {
    --bg-main: #0f0f0f;
    --bg-glass: rgba(15, 15, 20, 0.75);
    --bg-glass-heavy: rgba(10, 10, 12, 0.90);
    --bg-input: rgba(0, 0, 0, 0.4);
    --border: rgba(255, 255, 255, 0.08);
    --border-focus: rgba(255, 170, 0, 0.5);
    --accent: #ffaa00;
    --accent-hover: #ffcc33;
    --accent-glow: rgba(255, 170, 0, 0.3);
    --accent-dim: rgba(255, 170, 0, 0.1);
    --text-main: #ffffff;
    --text-sub: #a0a0a0;
    --text-dim: rgba(255, 255, 255, 0.4);
    --ease-premium: cubic-bezier(0.4, 0, 0.2, 1);
    --duration-fast: 0.15s;
    --duration-normal: 0.3s;
    --duration-slow: 0.5s;
}

/* Utility class for hiding elements */
.hidden {
    display: none !important;
}

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

body {
    margin: 0;
    padding: 0;
    overflow: hidden;
    background: transparent;
    color: var(--text-main);
    font-family: 'Rajdhani', sans-serif;
    -webkit-font-smoothing: antialiased;
}

#canvas-container {
    width: 100vw;
    height: 100vh;
    display: block;
    position: fixed;
    top: 0;
    left: 0;
    z-index: 0;
}

/* ===================================
   CUSTOM MODAL (RESTORED & STYLED)
   =================================== */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    z-index: 10000;
    display: none;
    align-items: center;
    justify-content: center;
    pointer-events: auto !important;
}

.modal-overlay.active {
    display: flex;
}

.modal-content {
    background: var(--bg-glass-heavy);
    border: 1px solid var(--accent-dim);
    border-radius: 12px;
    padding: 32px;
    max-width: 600px;
    width: 90%;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.05);
    animation: fadeIn 0.3s ease;
    display: flex;
    flex-direction: column;
}

.modal-content h3 {
    margin: 0 0 16px 0;
    color: var(--accent);
    font-size: 20px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.modal-content p {
    margin: 0 0 20px 0;
    color: var(--text-sub);
    font-size: 14px;
    line-height: 1.5;
}

#modal-input,
#modal-textarea {
    width: 100%;
    padding: 12px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text-main);
    font-family: 'Rajdhani', sans-serif;
    font-size: 14px;
    margin-bottom: 20px;
    outline: none;
}

#modal-input:focus,
#modal-textarea:focus {
    border-color: var(--accent);
    background: rgba(255, 255, 255, 0.05);
}

.modal-buttons {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    margin-top: 8px;
}

.modal-buttons button {
    min-width: 100px;
}

/* ===================================
   CUSTOM DROPDOWNS (ACCORDION STYLE)
   =================================== */
.custom-dropdown {
    position: relative;
    width: 100%;
}

/* Ensure JS class writes to this */
.custom-dropdown-button {
    width: 100%;
    padding: 10px 35px 10px 12px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text-main);
    text-align: left;
    cursor: pointer;
    font-size: 14px;
    font-family: 'Rajdhani', sans-serif;
    transition: all 0.2s;
    position: relative;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    outline: none;
}

.custom-dropdown-button:hover {
    border-color: var(--accent-dim);
    background: rgba(255, 255, 255, 0.05);
}

.custom-dropdown-button:focus {
    border-color: var(--accent);
}

.custom-dropdown-button::after {
    content: '▼';
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 10px;
    color: var(--text-sub);
    transition: transform 0.3s;
}

.custom-dropdown.open .custom-dropdown-button::after {
    transform: translateY(-50%) rotate(180deg);
}

/* ACCORDION MENU - Inline expansion, NO internal scroll */
.custom-dropdown-menu {
    /* Inline flow - part of normal document flow */
    position: relative;
    width: 100%;

    /* Hidden by default - zero height */
    max-height: 0;
    overflow: hidden;
    opacity: 0;

    /* Styling */
    background: var(--bg-glass-heavy);
    border: 1px solid transparent;
    border-radius: 0 0 6px 6px;
    margin-top: -1px;

    /* Smooth expand/collapse */
    transition: max-height 0.3s ease, opacity 0.2s ease, border-color 0.2s ease;
}

.custom-dropdown.open .custom-dropdown-menu {
    /* Expanded state - show ALL content (no internal scroll) */
    max-height: 1000px;
    /* Large enough to fit all options */
    opacity: 1;
    overflow: visible;
    /* NO scroll - let parent scroll */
    border-color: var(--accent-dim);
}

.custom-dropdown-item {
    padding: 10px 12px;
    cursor: pointer;
    transition: all 0.2s;
    color: var(--text-sub);
    font-size: 13px;
    border-left: 3px solid transparent;
}

.custom-dropdown-item:hover {
    background: rgba(255, 170, 0, 0.1);
    border-left-color: var(--accent);
    color: var(--text-main);
}

.custom-dropdown-item.selected {
    background: rgba(255, 170, 0, 0.05);
    color: var(--accent);
    font-weight: 700;
}

/* ===================================
   MAIN SETTINGS PANEL - HORIZONTAL
   =================================== */
#settings-panel {
    position: fixed;
    bottom: 32px;
    left: 50%;
    transform: translateX(-50%);
    width: 94vw;
    max-width: 1400px;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    background: var(--bg-glass-heavy);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border: 1px solid var(--border);
    border-radius: 12px;
    box-shadow: 0 16px 48px rgba(0, 0, 0, 0.6), inset 0 1px 0 rgba(255, 255, 255, 0.05);
    z-index: 1000;
    transition: transform var(--duration-normal) var(--ease-premium), opacity var(--duration-normal) var(--ease-premium);
}

#settings-panel.hidden {
    transform: translateX(-50%) translateY(120%);
    opacity: 0;
    pointer-events: none;
}

/* ===================================
   HEADER & PRESETS
   =================================== */
.visual-grid {
    display: grid;
    grid-template-columns: 320px 1fr;
    gap: 24px;
    height: 100%;
    overflow: hidden;
}

.panel-header {
    padding: 8px 12px;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 12px 12px 0 0;
    flex-shrink: 0;
}

.header-title h3 {
    margin: 0;
    font-size: 20px;
    font-weight: 800;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
}

.header-title .emoji {
    font-size: 24px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #ffaa00;
    padding: 4px 3px 2px 4px;
    border-radius: 8px;
    transition: transform 0.1s ease-out, box-shadow 0.1s ease-out;
}

.header-title .emoji img {
    width: 36px;
    height: 36px;
    vertical-align: middle;
}

.header-title .text {
    color: var(--accent);
    font-size: 24px;
    display: inline-flex;
}

.title-char {
    display: inline-block;
    transition: transform 0.1s ease-out, text-shadow 0.1s ease-out;
}

.header-actions {
    display: flex;
    gap: 8px;
}

/* ICON BUTTON STYLE */
.icon-btn {
    background: var(--bg-input);
    border: 2px solid var(--border);
    color: var(--text-sub);
    padding: 6px 12px;
    border-radius: 4px;
    font-size: 15px;
    font-weight: 700;
    font-family: 'Rajdhani', sans-serif;
    letter-spacing: 1px;
    text-transform: uppercase;
    cursor: pointer;
    transition: all var(--duration-fast);
    display: flex;
    align-items: center;
    gap: 6px;
}

.icon-btn:hover {
    border-color: var(--accent);
    /* UPDATED to Full Accent */
    color: var(--text-main);
    background: rgba(255, 255, 255, 0.05);
}

.preset-bar {
    display: flex;
    gap: 8px;
    padding: 12px 24px;
    overflow-x: auto;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
    align-items: center;
    /* Ensure vertical alignment */
}

.preset-divider {
    width: 2px;
    height: 20px;
    background: var(--border);
    margin: 0 4px;
    flex-shrink: 0;
    border-radius: 1px;
}

/* ... existing code ... */

/* Floating Show UI Button */
.floating-btn {
    /* Positioning */
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 10001;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(5px);

    /* Layout (Matched to .icon-btn) */
    display: flex;
    align-items: center;
    gap: 6px;

    /* Visuals (Matched to .icon-btn sitting on Panel) */
    /* Composite background to match the visual darkness of the header button */
    background: linear-gradient(var(--bg-input), var(--bg-input)), var(--bg-glass-heavy);

    border: 2px solid var(--border);
    color: var(--text-sub);
    padding: 8px 16px;
    border-radius: 4px;
    font-size: 15px;
    font-weight: 700;
    font-family: 'Rajdhani', sans-serif;
    letter-spacing: 1px;
    text-transform: uppercase;
    cursor: pointer;
    transition: all var(--duration-fast);
}

.floating-btn:hover {
    /* Matched Hover */
    border-color: var(--accent);
    /* UPDATED to Full Accent */
    color: var(--text-main);
    background: linear-gradient(rgba(255, 255, 255, 0.05), rgba(255, 255, 255, 0.05)), var(--bg-glass-heavy);

    /* Lift Effect */
    transform: translateX(-50%) translateY(-2px);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.7);
}

.preset-bar {
    display: flex;
    gap: 8px;
    padding: 12px 24px;
    overflow-x: auto;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}

.preset-bar::-webkit-scrollbar {
    height: 4px;
}

.preset-bar::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 2px;
}

.preset-btn {
    flex: 0 0 auto;
    background: var(--bg-input);
    border: 1px solid var(--border);
    color: var(--text-sub);
    padding: 8px 16px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 700;
    font-family: 'Rajdhani', sans-serif;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    cursor: pointer;
    transition: all var(--duration-fast);
}

.preset-btn:hover {
    border-color: var(--accent-dim);
    color: var(--text-main);
    background: rgba(255, 255, 255, 0.05);
}

.preset-btn.special {
    border-color: var(--accent);
    color: var(--accent);
    background: rgba(255, 170, 0, 0.05);
}

.preset-btn.special:hover {
    background: rgba(255, 170, 0, 0.15);
}



/* ===================================
   TAB NAVIGATION (REMOVED BUT KEPT CSS FOR TABBED CARDS)
   =================================== */
.tab-nav {
    display: none;
    /* Hidden for single dashboard */
}

/* ===================================
   CONTENT AREA
   =================================== */
.tab-content-wrapper {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
}

.tab-content-wrapper::-webkit-scrollbar {
    width: 6px;
}

.tab-content-wrapper::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.1);
}

.tab-content-wrapper::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 3px;
}

.tab-content {
    display: none;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 24px;
}

.two-column-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
}

.three-column-grid {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 24px;
}

.three-column-grid-even {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 20px;
}

/* Inner grid for split Lighting column */
.two-column-grid-inner {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
}

/* Disabled state for Snow and Star settings */
#snow-settings.disabled,
#star-settings.disabled {
    opacity: 0.4;
    pointer-events: none !important;
}

#snow-settings.disabled .setting-group,
#star-settings.disabled .setting-group {
    pointer-events: none !important;
}

#snow-settings.disabled .setting-label,
#star-settings.disabled .setting-label {
    cursor: not-allowed;
}

#snow-settings.disabled input[type="range"],
#star-settings.disabled input[type="range"] {
    cursor: not-allowed;
    pointer-events: none !important;
}

/* Disabled state for Twinkle Randomness when speed is 0 */
#randomness-group.disabled {
    opacity: 0.4;
    pointer-events: none !important;
}

#randomness-group.disabled .setting-label {
    cursor: not-allowed;
}

#randomness-group.disabled input[type="range"] {
    cursor: not-allowed;
    pointer-events: none !important;
}

@media (max-width: 1100px) {

    .three-column-grid,
    .two-column-grid,
    .two-column-grid-inner {
        grid-template-columns: 1fr;
    }
}

.separator-line {
    width: 100%;
    height: 1px;
    background: var(--border);
    margin: 20px 0;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ===================================
   CONTROL CARDS & TABS
   =================================== */
.control-card {
    display: flex;
    flex-direction: column;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--bg-glass);
    transition: border-color var(--duration-fast);
    position: relative;
    height: 100%;
}

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

.card-header {
    width: 100%;
    padding: 12px 16px;
    background: rgba(255, 255, 255, 0.02);
    border-bottom: 1px solid var(--border);
    color: var(--text-main);
    font-family: 'Rajdhani', sans-serif;
    font-weight: 700;
    font-size: 13px;
    letter-spacing: 1px;
}

/* Card Tabs */
.card-header-tabs {
    display: flex;
    background: rgba(255, 255, 255, 0.02);
    border-bottom: 1px solid var(--border);
}

.card-tab-btn {
    flex: 1;
    padding: 12px;
    background: transparent;
    border: none;
    color: var(--text-sub);
    font-family: 'Rajdhani', sans-serif;
    font-weight: 700;
    font-size: 13px;
    letter-spacing: 1px;
    cursor: pointer;
    transition: all 0.2s;
    border-bottom: 2px solid transparent;
}

.card-tab-btn:hover {
    color: var(--text-main);
    background: rgba(255, 255, 255, 0.02);
}

.card-tab-btn.active {
    color: var(--accent);
    border-bottom-color: var(--accent);
    background: rgba(255, 170, 0, 0.05);
}

.card-content {
    padding: 20px;
    flex: 1;
}

/* Theme card - scrollable accordion container */
.theme-card {
    align-self: start;
    height: auto;
}

.theme-card .card-content {
    max-height: 350px;
    min-height: 387px;
    overflow-y: hidden;
    overflow-x: hidden;
    flex: none;
    padding: 15px;
}

/* Only show scrollbar when dropdown is open */
.theme-card.has-open-dropdown .card-content {
    overflow-y: auto;
}

.theme-card .card-content::-webkit-scrollbar {
    width: 6px;
}

.theme-card .card-content::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 3px;
}

.theme-card .card-content::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 3px;
}

.theme-card .card-content::-webkit-scrollbar-thumb:hover {
    background: var(--accent-dim);
}

.card-tab-content {
    display: none;
    padding: 20px;
    flex: 1;
    height: 100%;
}

.card-tab-content.active {
    display: block;
    animation: fadeIn 0.2s ease;
}

.sub-header {
    margin: 0 0 16px 0;
    font-size: 12px;
    color: var(--accent);
    font-weight: 700;
    letter-spacing: 1px;
    text-transform: uppercase;
    opacity: 0.8;
}

/* ===================================
   CONTROLS
   =================================== */
.setting-group {
    margin-bottom: 20px;
}

.setting-group:last-child {
    margin-bottom: 0;
}

.setting-label {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-sub);
}

.label-value {
    font-family: 'Consolas', monospace;
    font-size: 12px;
    color: var(--accent);
    background: var(--accent-dim);
    padding: 2px 8px;
    border-radius: 4px;
}

input[type="range"] {
    appearance: none;
    -webkit-appearance: none;
    width: 100%;
    height: 6px;
    background: var(--bg-input);
    border-radius: 3px;
    outline: none;
    position: relative;
    cursor: pointer;
}

input[type="range"]::-webkit-slider-runnable-track {
    background: linear-gradient(to right, var(--accent) 0%, var(--accent) var(--value, 50%), rgba(255, 255, 255, 0.15) var(--value, 50%));
    height: 6px;
    border-radius: 3px;
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 18px;
    height: 18px;
    background: #fff;
    border-radius: 50%;
    margin-top: -6px;
    cursor: grab;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.5);
    transition: transform var(--duration-fast);
}

input[type="range"]::-webkit-slider-thumb:hover {
    transform: scale(1.2);
    background: var(--accent);
}

input[type="range"]:active::-webkit-slider-thumb {
    cursor: grabbing;
    transform: scale(1.1);
    background: var(--accent);
}

/* Firefox slider track styling for consistent height */
input[type="range"]::-moz-range-track {
    background: rgba(255, 255, 255, 0.15);
    height: 6px;
    border-radius: 3px;
    border: none;
}

input[type="range"]::-moz-range-thumb {
    width: 18px;
    height: 18px;
    background: #fff;
    border-radius: 50%;
    border: none;
    cursor: grab;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.5);
}

input[type="range"]::-moz-range-thumb:hover {
    background: var(--accent);
}

input[type="range"]::-moz-range-progress {
    background: var(--accent);
    height: 6px;
    border-radius: 3px;
}

.toggles-column {
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin-top: 16px;
}

.toggles-row {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    margin-bottom: 12px;
}

.toggle-label {
    display: inline-flex;
    align-items: center;
    cursor: pointer;
}

input[type="checkbox"] {
    display: none;
}

.toggle-switch {
    width: 40px;
    height: 22px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 11px;
    position: relative;
    margin-right: 10px;
    transition: all var(--duration-fast);
}

.toggle-switch::after {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 16px;
    height: 16px;
    background: var(--text-sub);
    border-radius: 50%;
    transition: all var(--duration-fast) var(--ease-premium);
}

input[type="checkbox"]:checked+.toggle-switch {
    background: var(--accent-dim);
    border-color: var(--accent);
}

input[type="checkbox"]:checked+.toggle-switch::after {
    transform: translateX(18px);
    background: var(--accent);
    box-shadow: 0 0 8px var(--accent-glow);
}

.toggle-text {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-sub);
}

input[type="checkbox"]:checked~.toggle-text {
    color: var(--text-main);
}

/* Disabled toggle styling for coming-soon features */
.toggle-label.toggle-disabled {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
}

.toggle-label.toggle-disabled .toggle-switch {
    background: var(--bg-tertiary);
}

.toggle-label.toggle-disabled .toggle-text {
    color: var(--text-dim);
}

/* Feature note styling (inline) */
.feature-note {
    font-size: 10px;
    color: var(--text-dim);
    font-style: italic;
    font-weight: 400;
}

select {
    width: 100%;
    background: var(--bg-input);
    border: 1px solid var(--border);
    color: var(--text-main);
    padding: 10px 14px;
    border-radius: 6px;
    font-family: 'Rajdhani', sans-serif;
    font-size: 14px;
    cursor: pointer;
    outline: none;
}

select:focus {
    border-color: var(--accent);
}

/* ===================================
   SEGMENTED CONTROL (STAR SPEED)
   =================================== */
.control-row-flex {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.segmented-control {
    display: inline-flex;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 2px;
}

.segmented-control input[type="radio"] {
    display: none;
}

.segmented-control label {
    padding: 6px 12px;
    font-size: 12px;
    font-weight: 700;
    color: var(--text-sub);
    cursor: pointer;
    transition: all 0.2s;
    border-radius: 3px;
    font-family: 'Rajdhani', sans-serif;
}

.segmented-control label:hover {
    color: var(--text-main);
    background: rgba(255, 255, 255, 0.05);
}

.segmented-control input[type="radio"]:checked+label {
    background: var(--accent);
    color: #000;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

/* ===================================
   FOOTER ACTIONS
   =================================== */
.button-container {
    padding: 16px 24px;
    border-top: 1px solid var(--border);
    display: flex;
    gap: 16px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 0 0 12px 12px;
    flex-shrink: 0;
}

.primary-btn {
    flex: 1;
    background: linear-gradient(135deg, var(--accent) 0%, #ff8800 100%);
    color: #000;
    border: none;
    padding: 14px;
    border-radius: 6px;
    font-family: 'Rajdhani', sans-serif;
    font-weight: 800;
    font-size: 15px;
    cursor: pointer;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    box-shadow: 0 4px 12px var(--accent-glow);
    transition: all var(--duration-normal) var(--ease-premium);
}

.primary-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px var(--accent-glow);
}

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

.secondary-btn {
    flex: 1;
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-sub);
    padding: 14px;
    border-radius: 6px;
    font-family: 'Rajdhani', sans-serif;
    font-weight: 700;
    font-size: 14px;
    cursor: pointer;
    transition: all var(--duration-fast);
}

.secondary-btn:hover {
    transform: scale(1.05);
    /* Fixed massive scale issue */
    background: var(--accent);
    color: #000;
}

/* Floating Show UI Button */
/* Floating Show UI Button */
.floating-btn {
    /* Positioning */
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 10001;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(5px);

    /* Layout (Matched to .icon-btn) */
    display: flex;
    align-items: center;
    gap: 6px;

    /* Visuals (Matched to .icon-btn sitting on Panel) */
    /* Composite background to match the visual darkness of the header button */
    background: linear-gradient(var(--bg-input), var(--bg-input)), var(--bg-glass-heavy);

    border: 2px solid var(--border);
    color: var(--text-sub);
    padding: 8px 16px;
    border-radius: 4px;
    font-size: 15px;
    font-weight: 700;
    font-family: 'Rajdhani', sans-serif;
    letter-spacing: 1px;
    text-transform: uppercase;
    cursor: pointer;
    transition: all var(--duration-fast);
}

.floating-btn:hover {
    /* Matched Hover */
    border-color: var(--accent);
    color: var(--text-main);
    background: linear-gradient(rgba(255, 255, 255, 0.05), rgba(255, 255, 255, 0.05)), var(--bg-glass-heavy);

    /* Lift Effect */
    transform: translateX(-50%) translateY(-2px);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.7);
}


.floating-btn.hidden {
    display: none;
}

/* ===================================
   TOAST NOTIFICATIONS (NEW)
   =================================== */
#toast-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 11000;
    display: flex;
    flex-direction: column;
    gap: 12px;
    pointer-events: none;
}

.toast {
    background: var(--bg-glass-heavy);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--border);
    border-left: 3px solid var(--accent);
    padding: 16px 20px;
    border-radius: 6px;
    color: var(--text-main);
    font-family: 'Rajdhani', sans-serif;
    font-size: 14px;
    font-weight: 600;
    min-width: 280px;
    max-width: 360px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    gap: 12px;
    transform: translateX(120%);
    transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275), opacity 0.4s ease;
    cursor: pointer;
    pointer-events: auto;
}

.toast.visible {
    transform: translateX(0);
}

.toast.hiding {
    transform: translateX(120%);
    opacity: 0;
}

/* Toast Variants */
.toast-info {
    border-left-color: var(--accent);
}

.toast-success {
    border-left-color: #2ecc71;
}

.toast-warning {
    border-left-color: #e74c3c;
}

.toast-icon {
    font-size: 18px;
}

.toast-message {
    line-height: 1.4;
}

/* ===================================
   RESPONSIVE GRID SYSTEM
   =================================== */

/* Desktop: 3 columns side-by-side */
.three-column-grid-even {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 24px;
}

/* Tablet: 3 columns → 2 columns */
@media (max-width: 1200px) {
    .three-column-grid-even {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Mobile: 2 columns → 1 column (stack vertically) */
@media (max-width: 768px) {
    .three-column-grid-even {
        grid-template-columns: 1fr;
    }

    /* Make panel take more vertical space on mobile */
    #settings-panel {
        max-height: 90vh;
    }
}



/* ===================================
   MODAL SYSTEM STYLING
   =================================== */

.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(8px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.modal-overlay.active {
    display: flex;
    opacity: 1;
}

.modal-content {
    background: var(--bg-glass-heavy);
    backdrop-filter: blur(20px);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 32px;
    max-width: 500px;
    width: 90%;
    position: relative;
    transform: translateY(20px);
    transition: transform 0.3s var(--ease-premium);
}

.modal-overlay.active .modal-content {
    transform: translateY(0);
}

.modal-title {
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 12px;
    color: var(--accent);
}

.modal-message {
    font-size: 14px;
    line-height: 1.6;
    color: var(--text-main);
    margin-bottom: 20px;
    white-space: pre-wrap;
}

.modal-input-container,
.modal-textarea-container {
    margin-bottom: 20px;
}

/* Modal Inputs & Textarea Styling (Phase 3D) */
.modal-input,
.modal-textarea {
    width: 100%;
    padding: 12px 16px;
    background: rgba(0, 0, 0, 0.5);
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text-main);
    font-family: 'Rajdhani', sans-serif;
    font-size: 14px;
    transition: border-color 0.2s ease;
    resize: vertical;
}

.modal-input:focus,
.modal-textarea:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(255, 170, 0, 0.1);
}

.modal-input::placeholder,
.modal-textarea::placeholder {
    color: var(--text-dim);
}

.modal-buttons {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
}

.modal-btn {
    padding: 10px 24px;
    border-radius: 6px;
    font-family: 'Rajdhani', sans-serif;
    font-weight: 600;
    font-size: 14px;
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
}

.modal-cancel {
    background: var(--bg-glass);
    color: var(--text-main);
    border: 1px solid var(--border);
}

.modal-cancel:hover {
    background: var(--bg-glass-heavy);
    border-color: var(--accent-dim);
}

.modal-ok {
    background: linear-gradient(135deg, var(--accent) 0%, #ff8800 100%);
    color: #000;
    font-weight: 700;
}

.modal-ok:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px var(--accent-glow);
}

/* ===================================
   BUTTON HOVER ANIMATIONS (Phase 3E.4)
   =================================== */

/* Preset buttons, reset button, apply button */
.preset-btn:not(:disabled):hover,
.secondary-btn:hover,
.primary-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.4);
}

/* Active state for all buttons */
.preset-btn:not(:disabled):active,
.secondary-btn:active,
.primary-btn:active {
    transform: translateY(0px);
}

/* ===================================
   TOGGLES ROW (Horizontal Layout)
   =================================== */
.toggles-row {
    display: flex;
    gap: 16px;
    margin-top: 12px;
    flex-wrap: wrap;
}

.toggles-row .toggle-label {
    flex: 1;
    min-width: 120px;
}

/* ===================================
   NOUISLIDER CUSTOM STYLING
   =================================== */
.noui-slider-container {
    height: 6px !important;
    margin: 18px 0 20px 0;
}

.noUi-target {
    background: rgba(255, 255, 255, 0.08) !important;
    border: none !important;
    border-radius: 50px !important;
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.3) !important;
    height: 6px !important;
}

.noUi-horizontal {
    height: 6px !important;
}

.noUi-base {
    height: 6px !important;
}

.noUi-connects {
    border-radius: 50px !important;
}

.noUi-connect {
    background: #ffaa00 !important;
    border-radius: 3px !important;
}

.noUi-horizontal .noUi-handle {
    width: 18px !important;
    height: 18px !important;
    border-radius: 50% !important;
    background: #ffffff !important;
    border: none !important;
    box-shadow: none !important;
    cursor: pointer !important;
    top: -6px !important;
    right: -9px !important;
    transition: all 0.15s ease;
}

.noUi-handle:before,
.noUi-handle:after {
    display: none !important;
}

.noUi-handle:hover {
    background: #ffaa00 !important;
    transform: scale(1.3);
}

.noUi-handle:focus {
    outline: none !important;
    box-shadow: none !important;
}

.noUi-handle:active {
    background: #ffcc44 !important;
}

/* ===================================
   TUTORIAL SYSTEM
   =================================== */

/* Dark overlay during tutorial - reduced to see lights */
.tutorial-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 9998;
    cursor: pointer;
    animation: tutorialFadeIn 0.4s ease-out;
}

@keyframes tutorialFadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

/* Highlight ring around active element */
.tutorial-highlight {
    position: fixed;
    pointer-events: none;
    border: 3px solid var(--accent);
    border-radius: 12px;
    box-shadow:
        0 0 20px var(--accent-glow),
        0 0 40px var(--accent-glow),
        inset 0 0 20px rgba(255, 170, 0, 0.1);
    z-index: 10000;
    animation: tutorialPulse 2s ease-in-out infinite;
    transition: opacity 0.3s ease, left 0.4s ease, top 0.4s ease, width 0.4s ease, height 0.4s ease;
    opacity: 1;
}

.tutorial-highlight.fading-out {
    opacity: 0;
}

@keyframes tutorialPulse {

    0%,
    100% {
        box-shadow:
            0 0 20px var(--accent-glow),
            0 0 40px var(--accent-glow);
    }

    50% {
        box-shadow:
            0 0 30px var(--accent),
            0 0 60px var(--accent-glow);
    }
}

/* Highlighted element gets raised above overlay */
.tutorial-highlighted {
    position: relative;
    z-index: 10001 !important;
}

/* Ensure ALL children of highlighted element are visible */
.tutorial-highlighted,
.tutorial-highlighted * {
    opacity: 1 !important;
    color: var(--text-main) !important;
}

/* Give highlighted elements a solid visible background */
.tutorial-highlighted.control-card,
.tutorial-highlighted.column,
.tutorial-highlighted.setting-group,
.tutorial-highlighted.card-header-tabs {
    background: rgba(20, 20, 25, 0.95) !important;
}

/* Dropdown scroll highlight during tutorial animation */
.tutorial-scroll-highlight {
    background: var(--accent) !important;
    color: #000 !important;
}

/* Custom dropdown stays above overlay during tutorial */
.tutorial-active .custom-dropdown.open {
    z-index: 10002 !important;
}

.tutorial-active .custom-dropdown.open .custom-dropdown-menu {
    z-index: 10002 !important;
}

/* Speech bubble */
.tutorial-bubble {
    position: fixed;
    z-index: 10002;
    background: linear-gradient(145deg, rgba(30, 30, 35, 0.98), rgba(20, 20, 25, 0.98));
    border: 1px solid var(--accent);
    border-radius: 16px;
    padding: 20px 24px;
    max-width: 380px;
    min-width: 300px;
    box-shadow:
        0 8px 32px rgba(0, 0, 0, 0.5),
        0 0 40px var(--accent-glow);
    animation: bubbleSlideIn 0.4s var(--ease-premium);
    transition: opacity 0.3s ease, transform 0.3s ease;
    opacity: 1;
}

.tutorial-bubble.fading-out {
    opacity: 0;
    transform: translateY(-10px);
}

@keyframes bubbleSlideIn {
    from {
        opacity: 0;
        transform: translateX(-50%) translateY(-15px);
    }

    to {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
}

/* Bubble pointer removed - clean bubble design */

/* Bubble header */
.bubble-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    padding-bottom: 10px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.bubble-title {
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--accent);
    letter-spacing: 0.5px;
}

.bubble-progress {
    font-size: 0.85rem;
    color: var(--text-dim);
    font-weight: 500;
}

/* Bubble message */
.bubble-message {
    font-size: 1rem;
    line-height: 1.6;
    color: var(--text-main);
    margin-bottom: 16px;
}

.bubble-message strong {
    color: var(--accent);
    font-weight: 600;
}

.bubble-message em {
    color: #ff6b6b;
    font-style: normal;
    font-size: 0.9em;
}

/* Bubble footer */
.bubble-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 12px;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.bubble-hint {
    font-size: 0.8rem;
    color: var(--text-dim);
    font-style: italic;
}

.bubble-skip {
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: var(--text-sub);
    padding: 6px 14px;
    border-radius: 6px;
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.bubble-skip:hover {
    border-color: #ff6b6b;
    color: #ff6b6b;
    background: rgba(255, 107, 107, 0.1);
}

/* Logo during tutorial - raised above overlay with subtle glow */
.tutorial-active .header-title .emoji {
    animation: logoGlow 1.5s ease-in-out infinite;
    z-index: 10003;
    position: relative;
}

@keyframes logoGlow {

    0%,
    100% {
        filter: drop-shadow(0 0 8px var(--accent)) drop-shadow(0 0 20px var(--accent-glow));
        transform: scale(1);
    }

    50% {
        filter: drop-shadow(0 0 15px var(--accent)) drop-shadow(0 0 35px var(--accent));
        transform: scale(1.05);
    }
}

/* Ensure header stays visible during tutorial */
.tutorial-active .header-title {
    z-index: 10003 !important;
    position: relative;
}