/* ============================================================
   DOTFORGE — Design System & Styles
   Three-panel layout: Left (effects) | Center (canvas) | Right (settings)
   ============================================================ */

/* ── Fonts ── */
@font-face {
    font-family: 'Geist Pixel Square';
    src: url('fonts/GeistPixel-Square.woff2') format('woff2');
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}

/* ── Reset ── */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

/* ── Design Tokens ── */
:root {
    /* Backgrounds */
    --bg-primary: #0a0a0a;
    --bg-surface: #111111;
    --bg-elevated: #191919;
    --bg-muted: #1e1e1e;
    --bg-wash: #252525;

    /* Foreground */
    --fg-primary: #e8e8e8;
    --fg-secondary: #a0a0a0;
    --fg-tertiary: #666666;
    --fg-ghost: #3a3a3a;

    /* Accent */
    --accent: #00ffaa;
    --accent-soft: rgba(0, 255, 170, 0.08);
    --accent-border: rgba(0, 255, 170, 0.3);
    --accent-glow: rgba(0, 255, 170, 0.15);

    /* Borders */
    --border-subtle: rgba(255, 255, 255, 0.06);
    --border-medium: rgba(255, 255, 255, 0.12);

    /* Easings */
    --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
    --ease-in: cubic-bezier(0.55, 0, 1, 0.45);
    --spring: cubic-bezier(0.34, 1.56, 0.64, 1);

    /* Timing */
    --duration-micro: 120ms;
    --duration-sm: 200ms;
    --duration-md: 350ms;
    --duration-lg: 500ms;

    /* Shadows */
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.3), 0 1px 3px rgba(0,0,0,0.15);
    --shadow-md: 0 2px 4px rgba(0,0,0,0.3), 0 4px 12px rgba(0,0,0,0.2);
    --shadow-lg: 0 4px 8px rgba(0,0,0,0.3), 0 8px 24px rgba(0,0,0,0.25);
    --shadow-xl: 0 8px 16px rgba(0,0,0,0.4), 0 16px 48px rgba(0,0,0,0.3);

    /* Layout */
    --left-panel-width: 240px;
    --right-panel-width: 280px;
    --header-height: 44px;
}

/* ── Scrollbar ── */
::-webkit-scrollbar { width: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--fg-ghost); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--fg-tertiary); }

/* ── Selection ── */
::selection { background: var(--accent); color: #000; }

/* ── Base ── */
body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
    background: var(--bg-primary);
    color: var(--fg-primary);
    overflow: hidden;
    height: 100vh;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ── App Layout ── */
.app {
    display: grid;
    grid-template-columns: var(--left-panel-width) 1fr var(--right-panel-width);
    grid-template-rows: var(--header-height) 1fr;
    height: 100vh;
}

/* ── Header Bar ── */
.header {
    grid-column: 1 / -1;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 16px;
    background: var(--bg-surface);
    border-bottom: 1px solid var(--border-subtle);
    z-index: 50;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}

.logo-icon {
    color: var(--accent);
    flex-shrink: 0;
}

.logo {
    font-family: 'Geist Pixel Square', 'SF Mono', 'JetBrains Mono', 'Fira Code', monospace;
    font-size: 15px;
    font-weight: 400;
    letter-spacing: 2px;
    color: var(--fg-primary);
    display: flex;
    align-items: center;
    gap: 0;
}
.logo span { color: var(--accent); }

.beta-tag {
    font-size: 8px;
    font-weight: 700;
    letter-spacing: 1.5px;
    color: var(--accent);
    border: 1px solid var(--accent);
    border-radius: 3px;
    padding: 1px 4px 1px 5px;
    opacity: 0.7;
    user-select: none;
    cursor: default;
    position: relative;
}
.beta-tag:hover {
    opacity: 1;
}
.beta-tag:hover::after {
    content: 'Thank you for being an early supporter!';
    position: absolute;
    top: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%);
    background: var(--bg-elevated);
    color: var(--fg-secondary);
    font-size: 10px;
    font-weight: 500;
    letter-spacing: 0.2px;
    white-space: nowrap;
    padding: 6px 10px;
    border-radius: 4px;
    border: 1px solid var(--border-subtle);
    box-shadow: 0 4px 12px rgba(0,0,0,0.4);
    pointer-events: none;
    z-index: 100;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 10px;
    position: relative;
}

.fps {
    font-family: 'SF Mono', 'JetBrains Mono', 'Fira Code', monospace;
    font-size: 10px;
    color: var(--fg-tertiary);
    letter-spacing: 1px;
    min-width: 50px;
    text-align: right;
}

.header-btn {
    background: var(--bg-muted);
    border: 1px solid var(--border-subtle);
    color: var(--fg-secondary);
    padding: 5px 10px;
    border-radius: 4px;
    cursor: pointer;
    font-family: inherit;
    font-size: 10px;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    white-space: nowrap;
    transition: all var(--duration-sm) var(--ease-out);
    display: flex;
    align-items: center;
    justify-content: center;
}
.header-btn:hover {
    border-color: var(--border-medium);
    color: var(--fg-primary);
    background: var(--bg-wash);
}
.header-btn.primary {
    background: var(--accent-soft);
    border-color: var(--accent-border);
    color: var(--accent);
}
.header-btn.primary:hover {
    background: rgba(0, 255, 170, 0.15);
}

/* ── Header Icon Buttons (Undo/Redo) ── */
.icon-btn {
    padding: 5px 6px;
    min-width: 0;
}
.icon-btn svg { display: block; }
.icon-btn:disabled {
    opacity: 0.3;
    cursor: default;
    pointer-events: none;
}

/* ── Header Separator ── */
.header-separator {
    width: 1px;
    height: 20px;
    background: var(--border-subtle);
    flex-shrink: 0;
}

/* ── Inspire Me Button ── */
.inspire-btn {
    background: linear-gradient(135deg, rgba(255, 100, 200, 0.1), rgba(100, 200, 255, 0.1));
    border-color: rgba(255, 150, 220, 0.3);
    color: #ff96dc;
}
.inspire-btn:hover {
    background: linear-gradient(135deg, rgba(255, 100, 200, 0.2), rgba(100, 200, 255, 0.2));
    border-color: rgba(255, 150, 220, 0.5);
    color: #ffb8e8;
    box-shadow: 0 0 12px rgba(255, 100, 200, 0.15);
}

/* ── PostFX Color Controls ── */
.postfx-colors {
    display: none;
    padding: 4px 4px 6px 36px;
    gap: 8px;
    align-items: center;
}
.postfx-item.active .postfx-colors {
    display: flex;
}
.postfx-colors label {
    font-size: 9px;
    color: var(--fg-tertiary);
    min-width: 16px;
}
.postfx-colors input[type="color"] {
    width: 22px;
    height: 18px;
}

/* ── Light Leak Extended Controls ── */
.postfx-lightleak-controls {
    display: none;
    padding: 4px 4px 8px 36px;
    flex-direction: column;
    gap: 6px;
}
.postfx-item.active .postfx-lightleak-controls {
    display: flex;
}
.ll-row {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-wrap: wrap;
}
.ll-row label {
    font-size: 9px;
    color: var(--fg-tertiary);
    min-width: 34px;
    flex-shrink: 0;
}
.ll-row select {
    font-size: 9px;
    padding: 2px 4px;
    background: var(--bg-inset);
    border: 1px solid var(--border-subtle);
    border-radius: 3px;
    color: var(--fg-secondary);
    max-width: 80px;
}
.ll-row input[type="color"] {
    width: 20px;
    height: 16px;
    flex-shrink: 0;
}
.ll-row input[type="range"] {
    width: 50px;
    flex-shrink: 0;
}
.ll-val {
    font-family: 'SF Mono', 'JetBrains Mono', 'Fira Code', monospace;
    font-size: 9px;
    color: var(--accent);
    min-width: 18px;
    text-align: right;
}

/* ── Settings Gear ── */
.settings-gear {
    padding: 5px 7px;
}
.settings-gear svg {
    display: block;
}
.settings-gear.active {
    background: var(--accent-soft);
    border-color: var(--accent-border);
    color: var(--accent);
}

/* ── Settings Dropdown ── */
.settings-dropdown {
    position: absolute;
    top: calc(var(--header-height) + 4px);
    right: 16px;
    width: 260px;
    background: var(--bg-elevated);
    border: 1px solid var(--border-medium);
    border-radius: 8px;
    box-shadow: var(--shadow-xl);
    z-index: 200;
    padding: 12px;
    display: none;
    animation: fadeIn var(--duration-sm) var(--ease-out);
}
.settings-dropdown.open {
    display: block;
}

.dropdown-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border-subtle);
}
.dropdown-header span {
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: var(--fg-tertiary);
}
.dropdown-close {
    background: none;
    border: none;
    color: var(--fg-tertiary);
    font-size: 16px;
    cursor: pointer;
    padding: 0 4px;
    line-height: 1;
    transition: color var(--duration-sm) var(--ease-out);
}
.dropdown-close:hover {
    color: var(--fg-primary);
}

/* ── DialKit Theme Floater ── */
.dialkit-floater {
    position: fixed;
    top: 100px;
    left: 50%;
    transform: translateX(-50%);
    width: 280px;
    background: var(--bg-elevated);
    border: 1px solid var(--border-medium);
    border-radius: 10px;
    box-shadow: var(--shadow-xl);
    z-index: 300;
    animation: fadeUp var(--duration-md) var(--ease-out);
    overflow: hidden;
}

.floater-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    background: var(--bg-muted);
    border-bottom: 1px solid var(--border-subtle);
    cursor: grab;
    user-select: none;
}
.floater-header:active {
    cursor: grabbing;
}
.floater-header span {
    font-size: 11px;
    font-weight: 600;
    color: var(--fg-secondary);
    letter-spacing: 0.5px;
}
.floater-close {
    background: none;
    border: none;
    color: var(--fg-tertiary);
    font-size: 18px;
    cursor: pointer;
    padding: 0 4px;
    line-height: 1;
    transition: color var(--duration-sm) var(--ease-out);
}
.floater-close:hover {
    color: var(--fg-primary);
}

.floater-body {
    padding: 12px 14px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.floater-row {
    display: flex;
    align-items: center;
    gap: 8px;
}
.floater-row label {
    font-size: 10px;
    color: var(--fg-tertiary);
    min-width: 50px;
    flex-shrink: 0;
}
.floater-hex {
    font-family: 'SF Mono', 'JetBrains Mono', monospace;
    font-size: 9px;
    color: var(--fg-ghost);
    min-width: 55px;
}

/* ── Left Panel (Effects) ── */
.panel-left {
    background: var(--bg-surface);
    border-right: 1px solid var(--border-subtle);
    overflow-y: auto;
    overflow-x: hidden;
    display: flex;
    flex-direction: column;
    contain: layout style paint;
}

/* ── Right Panel (Settings) ── */
.panel-right {
    background: var(--bg-surface);
    border-left: 1px solid var(--border-subtle);
    overflow-y: auto;
    overflow-x: hidden;
    display: flex;
    flex-direction: column;
    contain: layout style paint;
}

/* ── Panel Toolbar (Right Panel top bar) ── */
.panel-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 14px;
    background: var(--bg-surface);
    border-bottom: 1px solid var(--border-subtle);
    position: sticky;
    top: 0;
    z-index: 11;
}
.panel-toolbar-label {
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: var(--fg-ghost);
}
.panel-toolbar-btn {
    display: flex;
    align-items: center;
    gap: 5px;
    background: var(--bg-muted);
    border: 1px solid var(--border-subtle);
    color: var(--fg-tertiary);
    padding: 4px 9px;
    border-radius: 4px;
    cursor: pointer;
    font-family: inherit;
    font-size: 9px;
    font-weight: 500;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    transition: all var(--duration-sm) var(--ease-out);
}
.panel-toolbar-btn svg {
    display: block;
    flex-shrink: 0;
}
.panel-toolbar-btn:hover {
    border-color: var(--border-medium);
    color: var(--fg-secondary);
    background: var(--bg-wash);
}
.panel-toolbar-btn:active {
    transform: scale(0.96);
}
.panel-toolbar-btn.flash {
    border-color: var(--accent-border);
    color: var(--accent);
    background: var(--accent-soft);
}

/* ── Section Headers ── */
.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    cursor: pointer;
    user-select: none;
    transition: background var(--duration-sm) var(--ease-out);
    position: sticky;
    top: 0;
    z-index: 10;
    background: var(--bg-surface);
}
.section-header:hover {
    background: var(--bg-muted);
}
.section-header h3 {
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: var(--fg-tertiary);
}
.section-header .chevron {
    font-size: 12px;
    color: var(--fg-tertiary);
    transition: transform var(--duration-md) var(--ease-out),
                color var(--duration-sm) var(--ease-out);
    display: inline-block;
}
.section-header:hover .chevron {
    color: var(--fg-secondary);
}
.section-header.collapsed .chevron {
    transform: rotate(-90deg);
}

/* ── Section Body ── */
.section-body {
    overflow: hidden;
    transition: max-height var(--duration-md) var(--ease-out),
                opacity var(--duration-sm) var(--ease-out);
    max-height: 2000px;
    opacity: 1;
}
.section-body.collapsed {
    max-height: 0;
    opacity: 0;
}

/* ── Saved Presets ── */
.saved-presets-body {
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.saved-preset-save-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    width: 100%;
    padding: 7px 0;
    background: var(--bg-muted);
    border: 1px dashed var(--border-medium);
    border-radius: 6px;
    color: var(--fg-tertiary);
    font-family: inherit;
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.5px;
    cursor: pointer;
    transition: all var(--duration-sm) var(--ease-out);
}
.saved-preset-save-btn:hover {
    background: var(--accent-soft);
    border-color: var(--accent-border);
    color: var(--accent);
}
.saved-preset-save-btn.hidden {
    display: none;
}
.saved-presets-grid {
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.saved-preset-slot {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 5px 6px;
    padding-right: 4px;
    border-radius: 5px;
    cursor: pointer;
    transition: all var(--duration-sm) var(--ease-out);
    border: 1px solid transparent;
    position: relative;
    position: relative;
}
.saved-preset-slot:hover {
    background: var(--bg-muted);
}
.saved-preset-slot.active {
    background: var(--accent-soft);
    border-color: var(--accent-border);
}
.saved-preset-colors {
    display: flex;
    gap: 2px;
    flex-shrink: 0;
}
.saved-preset-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    border: 1px solid rgba(255, 255, 255, 0.12);
}
.saved-preset-name {
    font-size: 10px;
    color: var(--fg-tertiary);
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    letter-spacing: 0.3px;
}
.saved-preset-slot:hover .saved-preset-name {
    color: var(--fg-secondary);
}
.saved-preset-slot.active .saved-preset-name {
    color: var(--accent);
}
.saved-preset-effect {
    font-size: 8px;
    color: var(--fg-ghost);
    letter-spacing: 0.3px;
    flex-shrink: 0;
    max-width: 70px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.saved-preset-delete {
    flex-shrink: 0;
    background: none;
    border: none;
    color: var(--fg-ghost);
    font-size: 14px;
    cursor: pointer;
    padding: 0 4px;
    border-radius: 3px;
    opacity: 0.4;
    transition: opacity var(--duration-sm) var(--ease-out), color var(--duration-sm) var(--ease-out);
    line-height: 1;
    margin-left: auto;
}
.saved-preset-slot:hover .saved-preset-delete {
    opacity: 1;
}
.saved-preset-delete:hover {
    color: #ff4466;
    background: rgba(255, 68, 102, 0.1);
}
.saved-preset-empty-msg {
    font-size: 9px;
    color: var(--fg-ghost);
    text-align: center;
    padding: 8px 0 4px;
    letter-spacing: 0.3px;
}

/* ── Effect Lists ── */
.effect-list {
    padding: 4px 8px 8px;
    display: flex;
    flex-direction: column;
    gap: 1px;
}

.effect-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 10px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 11px;
    color: var(--fg-secondary);
    transition: all var(--duration-sm) var(--ease-out);
    position: relative;
    overflow: hidden;
}
/* Stagger animation — only after initial load */
body.ready .effect-item.animate-in {
    opacity: 0;
    transform: translateX(-8px);
    animation: slideInLeft var(--duration-md) var(--ease-out) forwards;
}
.effect-item:hover {
    background: var(--bg-muted);
    color: var(--fg-primary);
}
.effect-item.active {
    background: var(--accent-soft);
    color: var(--accent);
}
.effect-item.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 2px;
    height: 16px;
    background: var(--accent);
    border-radius: 0 2px 2px 0;
}

.effect-item .dot {
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: var(--fg-ghost);
    flex-shrink: 0;
    transition: background var(--duration-sm) var(--ease-out);
}
.effect-item.active .dot {
    background: var(--accent);
    box-shadow: 0 0 6px var(--accent-glow);
}

/* ── Settings Sections ── */
.settings-section {
    border-bottom: 1px solid var(--border-subtle);
}
.settings-section:last-child {
    border-bottom: none;
}

.settings-body {
    padding: 6px 14px 14px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

/* ── Custom Resolution Inputs ── */
.custom-res-inputs {
    display: flex;
    align-items: center;
    gap: 4px;
    flex: 1;
}
.custom-res-input {
    width: 60px;
    padding: 4px 6px;
    background: var(--bg-inset);
    border: 1px solid var(--border-subtle);
    border-radius: 4px;
    color: var(--fg-primary);
    font-family: 'SF Mono', 'JetBrains Mono', 'Fira Code', monospace;
    font-size: 10px;
    text-align: center;
}
.custom-res-input:focus {
    border-color: var(--accent-border);
    outline: none;
}
.custom-res-x {
    color: var(--fg-ghost);
    font-size: 10px;
}

/* ── Control Row ── */
.control-row {
    display: flex;
    align-items: center;
    gap: 8px;
}
.control-row label {
    font-size: 11px;
    color: var(--fg-tertiary);
    min-width: 64px;
    flex-shrink: 0;
}
.control-row .val {
    font-family: 'SF Mono', 'JetBrains Mono', 'Fira Code', monospace;
    font-size: 10px;
    color: var(--accent);
    min-width: 32px;
    text-align: right;
    flex-shrink: 0;
}

/* ── Range Slider ── */
input[type="range"] {
    flex: 1;
    -webkit-appearance: none;
    height: 3px;
    background: var(--bg-wash);
    border-radius: 2px;
    outline: none;
    transition: background var(--duration-sm) var(--ease-out);
}
input[type="range"]:hover {
    background: var(--fg-ghost);
}
input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 12px;
    height: 12px;
    background: var(--accent);
    border-radius: 50%;
    cursor: pointer;
    transition: transform var(--duration-sm) var(--spring),
                box-shadow var(--duration-sm) var(--ease-out);
    box-shadow: 0 0 0 0 var(--accent-glow);
}
input[type="range"]::-webkit-slider-thumb:hover {
    transform: scale(1.2);
    box-shadow: 0 0 8px var(--accent-glow);
}
input[type="range"]:active::-webkit-slider-thumb {
    transform: scale(0.95);
}

/* ── Color Input ── */
input[type="color"] {
    -webkit-appearance: none;
    width: 28px;
    height: 22px;
    border: 1px solid var(--border-medium);
    border-radius: 4px;
    background: none;
    cursor: pointer;
    padding: 0;
    transition: border-color var(--duration-sm) var(--ease-out),
                box-shadow var(--duration-sm) var(--ease-out);
}
input[type="color"]:hover {
    border-color: var(--fg-tertiary);
    box-shadow: var(--shadow-sm);
}
input[type="color"]::-webkit-color-swatch-wrapper { padding: 2px; }
input[type="color"]::-webkit-color-swatch { border: none; border-radius: 2px; }

/* ── Color Hex Input (editable) ── */
.color-hex-input {
    font-family: 'SF Mono', 'JetBrains Mono', 'Fira Code', monospace;
    font-size: 9px;
    color: var(--fg-secondary);
    background: transparent;
    border: 1px solid transparent;
    min-width: 56px;
    width: 56px;
    padding: 2px 4px;
    border-radius: 3px;
    transition: all var(--duration-sm) var(--ease-out);
    outline: none;
}
.color-hex-input:hover {
    color: var(--fg-primary);
    background: var(--bg-muted);
    border-color: var(--fg-ghost);
}
.color-hex-input:focus {
    color: var(--fg-primary);
    background: var(--bg-surface);
    border-color: var(--accent);
    box-shadow: 0 0 0 1px var(--accent-soft);
}

/* ── Swap Colors Button ── */
.swap-row {
    justify-content: center;
    padding: 0;
    min-height: 0;
    margin: -2px 0;
}
.swap-colors-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 8px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--fg-ghost);
    background: transparent;
    border: 1px solid var(--fg-ghost);
    border-radius: 3px;
    padding: 2px 8px;
    cursor: pointer;
    transition: all var(--duration-sm) var(--ease-out);
}
.swap-colors-btn:hover {
    color: var(--fg-secondary);
    border-color: var(--fg-secondary);
    background: var(--bg-muted);
}
.swap-colors-btn:active {
    color: var(--accent);
    border-color: var(--accent);
}
.swap-colors-btn svg {
    opacity: 0.7;
}

/* ── Palette Section ── */
.palette-section-label {
    font-size: 9px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: var(--fg-ghost);
    margin-bottom: 8px;
}
.palette-grid {
    display: flex;
    flex-direction: column;
    gap: 2px;
    max-height: 200px;
    overflow-y: auto;
    overflow-x: hidden;
    padding-right: 2px;
}
.palette-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 6px;
    border-radius: 5px;
    cursor: pointer;
    transition: all var(--duration-sm) var(--ease-out);
    border: 1px solid transparent;
}
.palette-row:hover {
    background: var(--bg-muted);
}
.palette-row.active {
    background: var(--accent-soft);
    border-color: var(--accent-border);
}
.palette-swatches {
    display: flex;
    gap: 3px;
    flex-shrink: 0;
}
.palette-dot {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    border: 1px solid rgba(255, 255, 255, 0.15);
    cursor: pointer;
    transition: transform var(--duration-sm) var(--ease-out),
                box-shadow var(--duration-sm) var(--ease-out);
}
.palette-dot:hover {
    transform: scale(1.3);
    box-shadow: 0 0 6px rgba(255, 255, 255, 0.25);
    z-index: 1;
}
.palette-dot.copied {
    box-shadow: 0 0 8px var(--accent);
    border-color: var(--accent);
}
.palette-name {
    font-size: 10px;
    color: var(--fg-tertiary);
    letter-spacing: 0.3px;
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.palette-row:hover .palette-name {
    color: var(--fg-secondary);
}
.palette-row.active .palette-name {
    color: var(--accent);
}

/* ── Copy Toast ── */
.copy-toast {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%) translateY(10px);
    background: var(--bg-elevated);
    border: 1px solid var(--accent-border);
    color: var(--accent);
    padding: 6px 14px;
    border-radius: 6px;
    font-family: 'SF Mono', 'JetBrains Mono', monospace;
    font-size: 10px;
    letter-spacing: 0.5px;
    pointer-events: none;
    opacity: 0;
    transition: all var(--duration-md) var(--ease-out);
    z-index: 1000;
    box-shadow: var(--shadow-md);
}
.copy-toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

/* ── Select ── */
select {
    flex: 1;
    background: var(--bg-muted);
    border: 1px solid var(--border-subtle);
    color: var(--fg-primary);
    padding: 5px 8px;
    border-radius: 4px;
    font-family: inherit;
    font-size: 11px;
    outline: none;
    cursor: pointer;
    transition: border-color var(--duration-sm) var(--ease-out);
}
select:hover { border-color: var(--border-medium); }
select:focus { border-color: var(--accent-border); }

/* ── Text Input ── */
input[type="text"] {
    flex: 1;
    background: var(--bg-muted);
    border: 1px solid var(--border-subtle);
    color: var(--fg-primary);
    padding: 6px 8px;
    border-radius: 4px;
    font-family: inherit;
    font-size: 11px;
    outline: none;
    caret-color: var(--accent);
    transition: border-color var(--duration-sm) var(--ease-out),
                box-shadow var(--duration-sm) var(--ease-out);
}
input[type="text"]:hover { border-color: var(--border-medium); }
input[type="text"]:focus {
    border-color: var(--accent-border);
    box-shadow: 0 0 0 2px var(--accent-soft);
}
input[type="text"]::placeholder { color: var(--fg-ghost); }

/* ── Buttons ── */
.btn {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid var(--border-subtle);
    background: var(--bg-muted);
    color: var(--fg-secondary);
    font-family: inherit;
    font-size: 10px;
    font-weight: 500;
    letter-spacing: 0.8px;
    text-transform: uppercase;
    border-radius: 5px;
    cursor: pointer;
    transition: all var(--duration-sm) var(--ease-out);
}
.btn:hover {
    background: var(--bg-wash);
    border-color: var(--border-medium);
    color: var(--fg-primary);
}
.btn:active {
    transform: scale(0.98);
}
.btn.primary {
    border-color: var(--accent-border);
    background: var(--accent-soft);
    color: var(--accent);
}
.btn.primary:hover {
    background: rgba(0, 255, 170, 0.15);
    box-shadow: 0 0 12px var(--accent-glow);
}
.btn-small {
    padding: 6px 10px;
    font-size: 9px;
}

/* ── Canvas Area ── */
.canvas-area {
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    background: var(--bg-primary);
    overflow: hidden;
    contain: strict;
}

#canvas {
    image-rendering: pixelated;
    image-rendering: crisp-edges;
    border-radius: 2px;
}

/* ── Theme Swatches ── */
.theme-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
}

.theme-swatch {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 5px 8px;
    background: var(--bg-muted);
    border: 1px solid var(--border-subtle);
    border-radius: 5px;
    cursor: pointer;
    transition: all var(--duration-sm) var(--ease-out);
}
.theme-swatch:hover {
    border-color: var(--border-medium);
    background: var(--bg-wash);
}
.theme-swatch.active {
    border-color: var(--accent-border);
    background: var(--accent-soft);
}
.theme-swatch .swatch-preview {
    width: 18px;
    height: 18px;
    border-radius: 4px;
    border: 1px solid rgba(255,255,255,0.1);
    flex-shrink: 0;
}
.theme-swatch .swatch-label {
    font-size: 10px;
    color: var(--fg-secondary);
    letter-spacing: 0.3px;
}
.theme-swatch.active .swatch-label {
    color: var(--accent);
}

/* ── Post-Processing Effects List ── */
.postfx-list {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.postfx-item {
    border-radius: 5px;
    transition: background var(--duration-sm) var(--ease-out);
}
.postfx-item:hover {
    background: rgba(255,255,255,0.02);
}

.postfx-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 5px 4px;
    cursor: pointer;
}

.postfx-toggle {
    position: relative;
    width: 28px;
    height: 14px;
    background: var(--bg-wash);
    border-radius: 7px;
    border: 1px solid var(--border-subtle);
    cursor: pointer;
    flex-shrink: 0;
    transition: all var(--duration-sm) var(--ease-out);
}
.postfx-toggle::after {
    content: '';
    position: absolute;
    top: 1px;
    left: 1px;
    width: 10px;
    height: 10px;
    background: var(--fg-tertiary);
    border-radius: 50%;
    transition: all var(--duration-sm) var(--spring);
}
.postfx-toggle.on {
    background: var(--accent-soft);
    border-color: var(--accent-border);
}
.postfx-toggle.on::after {
    left: 15px;
    background: var(--accent);
    box-shadow: 0 0 6px var(--accent-glow);
}

.postfx-name {
    font-size: 10px;
    color: var(--fg-secondary);
    flex: 1;
    letter-spacing: 0.3px;
}
.postfx-item.active .postfx-name {
    color: var(--accent);
}

.postfx-slider {
    display: none;
    padding: 2px 4px 6px 36px;
    align-items: center;
    gap: 6px;
}
.postfx-item.active .postfx-slider {
    display: flex;
}
.postfx-slider input[type="range"] {
    flex: 1;
    height: 2px;
}
.postfx-slider .val {
    font-family: 'SF Mono', 'JetBrains Mono', monospace;
    font-size: 9px;
    color: var(--accent);
    min-width: 24px;
    text-align: right;
}

/* ── Keyframes ── */
@keyframes slideInLeft {
    from { opacity: 0; transform: translateX(-8px); }
    to { opacity: 1; transform: translateX(0); }
}

@keyframes slideInRight {
    from { opacity: 0; transform: translateX(8px); }
    to { opacity: 1; transform: translateX(0); }
}

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

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes subtlePulse {
    0%, 100% { opacity: 0.4; }
    50% { opacity: 0.7; }
}

.animate-fade-up {
    opacity: 0;
    animation: fadeUp var(--duration-md) var(--ease-out) forwards;
}

.animate-slide-right {
    opacity: 0;
    animation: slideInRight var(--duration-md) var(--ease-out) forwards;
}

/* ── Settings animation stagger — only after initial load ── */
body.ready .settings-body .control-row.animate-in {
    opacity: 0;
    animation: fadeUp var(--duration-md) var(--ease-out) forwards;
}

/* ── Reduced Motion ── */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* ── Focus States ── */
:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
    border-radius: 4px;
}

/* ── Separator ── */
.separator {
    height: 1px;
    background: var(--border-subtle);
    margin: 2px 14px;
}

/* ── Accent Color Bar ── */
.accent-bar {
    width: 100%;
    height: 2px;
    background: linear-gradient(90deg, transparent, var(--accent), transparent);
    opacity: 0.3;
}

/* ── Canvas watermark ── */
.canvas-watermark {
    position: absolute;
    bottom: 16px;
    left: 50%;
    transform: translateX(-50%);
    font-family: 'SF Mono', 'JetBrains Mono', monospace;
    font-size: 9px;
    color: var(--fg-ghost);
    letter-spacing: 2px;
    text-transform: uppercase;
    pointer-events: none;
}

/* ============================================================
   FEEDBACK SYSTEM
   ============================================================ */

/* ── Dropdown Feedback Links ── */
.dropdown-section-label {
    font-size: 9px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: var(--fg-ghost);
    margin-bottom: 6px;
}
.dropdown-feedback-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    text-align: left;
    justify-content: flex-start;
}
.dropdown-feedback-btn svg {
    flex-shrink: 0;
    opacity: 0.6;
}

/* ── Feedback Overlay ── */
.feedback-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    /* backdrop-filter: blur(4px); removed for perf — GPU-heavy while canvas animates */
    z-index: 500;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn var(--duration-sm) var(--ease-out);
}

/* ── Feedback Modal ── */
.feedback-modal {
    width: 440px;
    max-width: 90vw;
    max-height: 85vh;
    background: var(--bg-elevated);
    border: 1px solid var(--border-medium);
    border-radius: 12px;
    box-shadow: var(--shadow-xl);
    display: flex;
    flex-direction: column;
    animation: fadeUp var(--duration-md) var(--ease-out);
    overflow: hidden;
}

.feedback-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-subtle);
    background: var(--bg-muted);
}

.feedback-tabs {
    display: flex;
    gap: 4px;
}

.feedback-tab {
    display: flex;
    align-items: center;
    gap: 5px;
    background: transparent;
    border: 1px solid transparent;
    color: var(--fg-tertiary);
    padding: 5px 12px;
    border-radius: 6px;
    cursor: pointer;
    font-family: inherit;
    font-size: 11px;
    font-weight: 500;
    transition: all var(--duration-sm) var(--ease-out);
}
.feedback-tab:hover {
    color: var(--fg-secondary);
    background: var(--bg-wash);
}
.feedback-tab.active {
    background: var(--accent-soft);
    border-color: var(--accent-border);
    color: var(--accent);
}
.feedback-tab svg { flex-shrink: 0; }

.feedback-close {
    background: none;
    border: none;
    color: var(--fg-tertiary);
    font-size: 20px;
    cursor: pointer;
    padding: 0 4px;
    line-height: 1;
    transition: color var(--duration-sm) var(--ease-out);
}
.feedback-close:hover { color: var(--fg-primary); }

.feedback-body {
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 14px;
    overflow-y: auto;
}

.feedback-field label {
    display: block;
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--fg-tertiary);
    margin-bottom: 6px;
}
.feedback-field .required { color: #ff6b6b; }
.feedback-field .optional { color: var(--fg-ghost); font-weight: 400; text-transform: none; letter-spacing: 0; }

.feedback-field textarea,
.feedback-field input[type="email"] {
    width: 100%;
    background: var(--bg-muted);
    border: 1px solid var(--border-subtle);
    color: var(--fg-primary);
    padding: 8px 10px;
    border-radius: 6px;
    font-family: inherit;
    font-size: 12px;
    outline: none;
    resize: vertical;
    caret-color: var(--accent);
    transition: border-color var(--duration-sm) var(--ease-out);
}
.feedback-field textarea:focus,
.feedback-field input[type="email"]:focus {
    border-color: var(--accent-border);
    box-shadow: 0 0 0 2px var(--accent-soft);
}
.feedback-field textarea::placeholder,
.feedback-field input[type="email"]::placeholder {
    color: var(--fg-ghost);
}

/* ── Screenshot Upload ── */
.feedback-upload {
    position: relative;
    border: 2px dashed var(--border-subtle);
    border-radius: 8px;
    min-height: 80px;
    cursor: pointer;
    transition: all var(--duration-sm) var(--ease-out);
    overflow: hidden;
}
.feedback-upload:hover {
    border-color: var(--accent-border);
    background: var(--accent-soft);
}
.feedback-upload.has-file {
    border-style: solid;
    border-color: var(--accent-border);
}

.upload-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 16px;
    color: var(--fg-ghost);
}
.upload-placeholder svg { opacity: 0.5; }
.upload-placeholder span { font-size: 10px; letter-spacing: 0.5px; }

.upload-preview {
    width: 100%;
    max-height: 160px;
    object-fit: contain;
    border-radius: 6px;
}

.upload-remove {
    position: absolute;
    top: 6px;
    right: 6px;
    width: 22px;
    height: 22px;
    background: rgba(0, 0, 0, 0.7);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: var(--fg-secondary);
    border-radius: 50%;
    cursor: pointer;
    font-size: 14px;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--duration-sm) var(--ease-out);
}
.upload-remove:hover {
    background: #ff4444;
    color: white;
    border-color: transparent;
}

.feedback-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    border-top: 1px solid var(--border-subtle);
    background: var(--bg-muted);
}

.feedback-status {
    font-size: 11px;
    color: var(--fg-tertiary);
    flex: 1;
}
.feedback-status.success { color: var(--accent); }
.feedback-status.error { color: #ff6b6b; }
.feedback-status.loading { color: var(--fg-ghost); }

.feedback-submit {
    min-width: 90px;
    padding: 8px 20px;
    font-size: 11px;
}
.feedback-submit:disabled {
    opacity: 0.4;
    cursor: default;
    pointer-events: none;
}

/* Badge CSS removed for beta — lives in dev branch for launch */

/* ============================================================
   EXPORT DROPDOWN & VIDEO EXPORT
   ============================================================ */

.export-dropdown {
    position: absolute;
    top: calc(var(--header-height) + 4px);
    right: 56px;
    width: 240px;
    background: var(--bg-elevated);
    border: 1px solid var(--border-medium);
    border-radius: 8px;
    box-shadow: var(--shadow-xl);
    z-index: 200;
    padding: 12px;
    display: none;
    animation: fadeIn var(--duration-sm) var(--ease-out);
}
.export-dropdown.open {
    display: block;
}

.export-option {
    display: flex;
    align-items: center;
    gap: 6px;
    text-align: left;
    justify-content: flex-start;
}
.export-option svg { flex-shrink: 0; opacity: 0.6; }

.export-video-section {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.export-row {
    display: flex;
    align-items: center;
    gap: 8px;
}
.export-row label {
    font-size: 10px;
    color: var(--fg-tertiary);
    min-width: 52px;
    flex-shrink: 0;
}
.export-row select {
    flex: 1;
    font-size: 10px;
    padding: 4px 6px;
}

.export-record-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    margin-top: 4px;
}
.export-record-btn svg { flex-shrink: 0; }

.export-record-btn.recording {
    background: rgba(255, 68, 68, 0.15);
    border-color: rgba(255, 68, 68, 0.4);
    color: #ff4444;
    animation: recordPulse 1.5s ease-in-out infinite;
}

@keyframes recordPulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(255, 68, 68, 0); }
    50% { box-shadow: 0 0 12px rgba(255, 68, 68, 0.2); }
}

.export-progress {
    margin-top: 4px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.export-progress-bar {
    width: 100%;
    height: 3px;
    background: var(--bg-wash);
    border-radius: 2px;
    overflow: hidden;
    position: relative;
}
.export-progress-bar::after {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    height: 100%;
    width: var(--progress, 0%);
    background: var(--accent);
    border-radius: 2px;
    transition: width 0.3s linear;
}

.export-progress-text {
    font-family: 'SF Mono', 'JetBrains Mono', monospace;
    font-size: 9px;
    color: var(--fg-tertiary);
    text-align: center;
}

.export-stay-warning {
    font-size: 9px;
    color: var(--fg-ghost);
    line-height: 1.4;
    margin-top: 6px;
    padding: 0 2px;
}

/* ── Code Export ── */
.code-preview {
    width: 100%;
    height: 120px;
    background: var(--bg-base);
    border: 1px solid var(--border-subtle);
    border-radius: 6px;
    color: var(--fg-secondary);
    font-family: 'SF Mono', 'JetBrains Mono', 'Fira Code', monospace;
    font-size: 9px;
    line-height: 1.5;
    padding: 8px;
    resize: none;
    margin-bottom: 6px;
    outline: none;
    box-sizing: border-box;
}
.code-preview:focus {
    border-color: var(--accent-border);
}

/* ── Gallery Modal ── */
.gallery-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.75);
    /* backdrop-filter: blur(4px); removed for perf — GPU-heavy while canvas animates */
    z-index: 500;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn var(--duration-sm) var(--ease-out);
}
.gallery-modal {
    width: 780px;
    max-width: 92vw;
    max-height: 88vh;
    background: var(--bg-elevated);
    border: 1px solid var(--border-medium);
    border-radius: 12px;
    box-shadow: var(--shadow-xl);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: fadeUp var(--duration-md) var(--ease-out);
}
.gallery-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-subtle);
    flex-shrink: 0;
}
.gallery-header h2 {
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 0.5px;
    color: var(--fg-primary);
}
.gallery-close {
    background: none;
    border: none;
    color: var(--fg-tertiary);
    font-size: 18px;
    cursor: pointer;
    padding: 2px 6px;
    border-radius: 4px;
    transition: all var(--duration-sm) var(--ease-out);
}
.gallery-close:hover {
    color: var(--fg-primary);
    background: var(--bg-muted);
}
.gallery-body {
    padding: 16px 20px;
    overflow-y: auto;
    flex: 1;
}
.gallery-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}
.gallery-card {
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid var(--border-subtle);
    cursor: pointer;
    transition: all var(--duration-sm) var(--ease-out);
}
.gallery-card:hover {
    border-color: var(--accent-border);
    box-shadow: 0 0 12px rgba(0, 255, 170, 0.08);
    transform: translateY(-2px);
}
.gallery-card-thumb {
    width: 100%;
    height: 220px;
    position: relative;
    overflow: hidden;
}
.gallery-card-info {
    padding: 10px 12px;
    background: var(--bg-surface);
}
.gallery-card-title {
    font-size: 11px;
    font-weight: 600;
    color: var(--fg-primary);
    margin-bottom: 4px;
}
.gallery-card-tags {
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
}
.gallery-tag {
    font-size: 8px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--fg-ghost);
    padding: 2px 6px;
    background: var(--bg-muted);
    border-radius: 3px;
}

/* Gallery Detail View */
.gallery-detail {
    padding: 16px 20px;
    overflow-y: auto;
    flex: 1;
}
.gallery-detail-back {
    background: none;
    border: none;
    color: var(--fg-tertiary);
    font-size: 11px;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
    margin-bottom: 12px;
    transition: all var(--duration-sm) var(--ease-out);
    font-family: inherit;
}
.gallery-detail-back:hover {
    color: var(--accent);
    background: var(--accent-soft);
}
.gallery-detail-preview {
    width: 100%;
    height: 400px;
    border-radius: 8px;
    overflow: hidden;
    margin-bottom: 16px;
    border: 1px solid var(--border-subtle);
}
.gallery-detail-info h3 {
    font-size: 14px;
    font-weight: 600;
    color: var(--fg-primary);
    margin-bottom: 6px;
}
.gallery-detail-info p {
    font-size: 11px;
    color: var(--fg-tertiary);
    line-height: 1.6;
    margin-bottom: 10px;
}
.gallery-detail-tags {
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
}

/* ── Mobile Gate ── */
.mobile-gate {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 99999;
    background: var(--bg-primary);
    flex-direction: column;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

/* Mobile gate: shown on mobile only if .mobile-gate has no sibling .app visible */
/* Replaced by mobile responsive layout below */

.mobile-gate-bg {
    position: absolute;
    inset: 0;
    z-index: 0;
    background:
        radial-gradient(ellipse at 30% 20%, rgba(0, 255, 170, 0.06) 0%, transparent 60%),
        radial-gradient(ellipse at 70% 80%, rgba(0, 255, 170, 0.04) 0%, transparent 50%);
}

.mobile-gate-content {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 40px 32px;
    text-align: center;
    animation: mobileGateFadeIn 0.8s var(--ease-out) both;
}

@keyframes mobileGateFadeIn {
    from { opacity: 0; transform: translateY(20px) scale(0.96); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

.mobile-gate-icon {
    margin-bottom: 20px;
    animation: mobileGatePulse 3s ease-in-out infinite;
}

@keyframes mobileGatePulse {
    0%, 100% { filter: drop-shadow(0 0 8px rgba(0, 255, 170, 0.3)); }
    50% { filter: drop-shadow(0 0 20px rgba(0, 255, 170, 0.5)); }
}

.mobile-gate-logo {
    font-family: 'Geist Pixel Square', 'SF Mono', 'JetBrains Mono', monospace;
    font-size: 24px;
    letter-spacing: 3px;
    color: var(--fg-primary);
    margin-bottom: 24px;
}
.mobile-gate-logo span {
    color: var(--accent);
}

.mobile-gate-divider {
    width: 40px;
    height: 1px;
    background: var(--border-medium);
    margin-bottom: 24px;
}

.mobile-gate-msg {
    font-family: 'Inter', sans-serif;
    font-size: 15px;
    line-height: 1.7;
    color: var(--fg-secondary);
    max-width: 280px;
    margin-bottom: 32px;
}

.mobile-gate-hint {
    display: flex;
    align-items: center;
    gap: 8px;
    font-family: 'Inter', sans-serif;
    font-size: 11px;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    color: var(--fg-tertiary);
    padding: 8px 16px;
    border: 1px solid var(--border-subtle);
    border-radius: 6px;
}
.mobile-gate-hint svg {
    color: var(--accent);
    flex-shrink: 0;
    opacity: 0.7;
}

/* ── Mobile-only elements: hidden by default on desktop ── */
.mobile-tab-bar,
.mobile-sheet-overlay {
    display: none;
}
/* ── Inspire Me tooltip (all viewports) ── */
.inspire-btn {
    position: relative;
}
.inspire-tooltip {
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    width: 220px;
    padding: 10px 14px;
    background: var(--bg-elevated, #1a1a1a);
    border: 1px solid var(--border-medium);
    border-radius: 8px;
    font-family: 'Inter', sans-serif;
    font-size: 11px;
    line-height: 1.5;
    color: var(--fg-secondary);
    text-transform: none;
    letter-spacing: 0;
    font-weight: 400;
    text-align: center;
    white-space: normal;
    pointer-events: none;
    opacity: 0;
    transform: translateY(-4px);
    transition: opacity 0.25s ease, transform 0.25s ease;
    z-index: 1200;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
}
.inspire-tooltip.visible {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}
.inspire-tooltip::before {
    content: '';
    position: absolute;
    top: -5px;
    right: 20px;
    width: 8px;
    height: 8px;
    background: var(--bg-elevated, #1a1a1a);
    border-left: 1px solid var(--border-medium);
    border-top: 1px solid var(--border-medium);
    transform: rotate(45deg);
}
.inspire-tooltip strong {
    color: var(--accent);
    font-weight: 600;
}

/* Glow on the button when tooltip is visible */
@keyframes inspireGlow {
    0%, 100% { box-shadow: 0 0 6px 2px rgba(255, 105, 180, 0.3); }
    50% { box-shadow: 0 0 14px 4px rgba(255, 105, 180, 0.5); }
}
.inspire-btn.glowing {
    animation: inspireGlow 2s ease-in-out infinite;
}

/* ============================================================
   MOBILE RESPONSIVE LAYOUT
   Full-screen canvas + bottom tab bar + slide-up sheets
   ============================================================ */
@media (max-width: 767px) {

    /* ── Kill mobile gate, show app ── */
    .mobile-gate { display: none !important; }
    .app {
        display: flex !important;
        flex-direction: column;
        height: 100vh;
        height: 100dvh;
    }

    /* ── Compact header ── */
    .header {
        height: 40px;
        padding: 0 12px;
        flex-shrink: 0;
        grid-column: auto;
    }
    .fps,
    .icon-btn,
    #resetBtn,
    #togglePlay,
    .settings-gear,
    .header-separator,
    .beta-tag {
        display: none !important;
    }
    .header-btn {
        font-size: 9px;
        padding: 5px 10px;
    }
    .inspire-btn {
        font-size: 9px;
        padding: 5px 10px;
    }

    /* ── Inspire Me tooltip: mobile override (fixed full-width) ── */
    .inspire-tooltip {
        position: fixed;
        top: 48px;
        left: 12px;
        right: 12px;
        width: auto;
        font-size: 12px;
        border-radius: 10px;
    }
    .inspire-tooltip::before {
        display: none;
    }

    /* ── Canvas area: fill remaining space, center canvas ── */
    .canvas-area {
        flex: 1;
        width: 100%;
        min-height: 0;
        margin-bottom: calc(56px + env(safe-area-inset-bottom, 0px)); /* space for tab bar */
        padding-bottom: 0;
        display: flex;
        align-items: center;
        justify-content: center;
        contain: layout style;
    }
    .canvas-watermark { display: none; }

    /* ── Side panels → bottom sheets ── */
    .panel-left,
    .panel-right {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        top: auto;
        height: auto;
        max-height: 60vh;
        z-index: 1000;
        border: none;
        border-top: 1px solid var(--border-medium);
        border-radius: 16px 16px 0 0;
        transform: translateY(100%);
        transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1);
        overflow-y: auto;
        overflow-x: hidden;
        -webkit-overflow-scrolling: touch;
        padding-bottom: calc(56px + env(safe-area-inset-bottom, 0px));
        background: var(--bg-surface);
        box-shadow: 0 -4px 24px rgba(0, 0, 0, 0.4);
        contain: initial;
    }
    .panel-left.mobile-open,
    .panel-right.mobile-open {
        transform: translateY(0);
    }

    /* ── Drag handle affordance ── */
    .panel-left::before,
    .panel-right::before {
        content: '';
        display: block;
        width: 36px;
        height: 4px;
        background: var(--fg-ghost);
        border-radius: 2px;
        margin: 10px auto 4px;
        flex-shrink: 0;
    }

    /* ── Panel toolbar hidden on mobile ── */
    .panel-toolbar { display: none; }

    /* ── Bottom tab bar ── */
    .mobile-tab-bar {
        display: flex;
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        height: calc(56px + env(safe-area-inset-bottom, 0px));
        padding-bottom: env(safe-area-inset-bottom, 0px);
        background: var(--bg-surface);
        border-top: 1px solid var(--border-medium);
        z-index: 1100;
        align-items: center;
        justify-content: space-around;
        box-shadow: 0 -2px 12px rgba(0, 0, 0, 0.3);
    }
    .mobile-tab {
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 3px;
        background: none;
        border: none;
        color: var(--fg-secondary);
        font-family: inherit;
        font-size: 9px;
        font-weight: 500;
        letter-spacing: 0.5px;
        text-transform: uppercase;
        padding: 8px 20px;
        cursor: pointer;
        transition: color var(--duration-sm) var(--ease-out);
        -webkit-tap-highlight-color: transparent;
    }
    .mobile-tab svg {
        transition: color var(--duration-sm) var(--ease-out);
    }
    .mobile-tab.active {
        color: var(--accent);
    }

    /* ── Sheet overlay ── */
    .mobile-sheet-overlay {
        display: none;
        position: fixed;
        inset: 0;
        background: rgba(0, 0, 0, 0.5);
        z-index: 999;
        -webkit-tap-highlight-color: transparent;
    }
    .mobile-sheet-overlay.active {
        display: block;
        animation: fadeIn var(--duration-sm) var(--ease-out);
    }

    /* ── Touch-friendly targets ── */
    .effect-item {
        padding: 10px 12px;
        font-size: 13px;
        gap: 10px;
    }
    .effect-item .dot {
        width: 6px;
        height: 6px;
    }
    .section-header {
        padding: 14px 16px;
        position: relative;
        top: auto;
    }
    .section-header h3 {
        font-size: 11px;
    }
    .control-row {
        gap: 10px;
        min-height: 38px;
    }
    .control-row label {
        font-size: 12px;
        min-width: 72px;
    }
    .control-row .val {
        font-size: 11px;
        min-width: 36px;
    }
    input[type="range"] {
        height: 4px;
    }
    input[type="range"]::-webkit-slider-thumb {
        width: 22px;
        height: 22px;
    }
    select {
        font-size: 13px;
        padding: 8px 10px;
    }
    input[type="text"] {
        font-size: 13px;
        padding: 8px 10px;
    }
    input[type="color"] {
        width: 34px;
        height: 28px;
    }
    .settings-body {
        padding: 8px 16px 16px;
        gap: 12px;
    }

    /* ── PostFX touch targets ── */
    .postfx-header {
        padding: 10px 8px;
        gap: 10px;
    }
    .postfx-name {
        font-size: 12px;
    }
    .postfx-toggle {
        width: 34px;
        height: 18px;
        border-radius: 9px;
    }
    .postfx-toggle::after {
        width: 14px;
        height: 14px;
    }
    .postfx-toggle.on::after {
        left: 18px;
    }
    .postfx-slider {
        padding: 4px 8px 8px 44px;
    }

    /* ── Swap colors button ── */
    .swap-colors-btn {
        font-size: 9px;
        padding: 4px 12px;
    }

    /* ── Palette section ── */
    .palette-row {
        padding: 6px 8px;
    }
    .palette-name {
        font-size: 11px;
    }
    .palette-dot {
        width: 16px;
        height: 16px;
    }

    /* ── Saved presets ── */
    .saved-preset-slot {
        padding: 8px 8px;
    }
    .saved-preset-name {
        font-size: 12px;
    }
    .saved-preset-save-btn {
        padding: 10px 0;
        font-size: 12px;
    }

    /* ── Export dropdown on mobile ── */
    .export-dropdown {
        position: fixed;
        top: auto;
        bottom: calc(56px + env(safe-area-inset-bottom, 0px) + 8px);
        right: 12px;
        left: 12px;
        width: auto;
        max-height: 60vh;
        overflow-y: auto;
        z-index: 1200;
        border-radius: 12px;
    }
    .export-video-section { display: none; }
    .export-code-section { display: none; }

    /* ── Hide desktop-only elements on mobile ── */
    .settings-dropdown,
    .dialkit-floater,
    .gallery-overlay {
        display: none !important;
    }

    /* ── Section body: no sticky headers on mobile ── */
    .section-header {
        position: relative;
        top: auto;
        z-index: auto;
    }

    /* ── Color hex inputs ── */
    .color-hex-input {
        font-size: 11px;
        min-width: 60px;
        width: 60px;
        padding: 4px 6px;
    }

    /* ── Effect list padding ── */
    .effect-list {
        padding: 4px 10px 10px;
        gap: 2px;
    }
}
