/* ========== CSS VARIABLES & THEMES ========== */
:root {
    --fg: #1d1d1f;
    --bg1: #f0f4f8;
    --bg2: #e2e8f0;
    --bg-panel: rgba(255, 255, 255, 0.75);
    --bg-card: rgba(255, 255, 255, 0.9);
    --border: rgba(0, 0, 0, 0.1);
    --shadow: rgba(0, 0, 0, 0.1);
    --accent: #007AFF;
    --accent-rgb: 0, 122, 255;
    --transition-time: 0.3s;
    --animation-ease: ease-in-out;
    --border-radius: 12px;
    --section-spacing: 24px;
}

/* Theme System */
[data-theme="neon-dark"] {
    --bg1: #0b0014; --bg2: #1a0033; --accent: #7b61ff; --accent-rgb: 123, 97, 255;
    --fg: #ffffff; --bg-panel: rgba(30, 30, 40, 0.8); --bg-card: rgba(40, 40, 50, 0.9);
    --border: rgba(255, 255, 255, 0.1); --shadow: rgba(0, 0, 0, 0.2);
}

[data-theme="black-baby"] {
    --bg1: #2c2c2c; --bg2: #4a4a4a; --accent: #ffbb00; --accent-rgb: 255, 187, 0;
    --fg: #ffffff; --bg-panel: #2b2b2b; --bg-card: #1414146b;
    --border: rgba(255, 255, 255, 0.05); --shadow: rgba(0, 0, 0, 0.3);
}

[data-theme="cotton-candy"] {
    --bg1: #ffb6c1; --bg2: #d8bfd8; --accent: #ff69b4; --accent-rgb: 255, 105, 180;
    --fg: #8b4513; --bg-panel: #ffffff80; --bg-card: #ffffff60;
    --border: rgba(0, 0, 0, 0.05); --shadow: rgba(0, 0, 0, 0.1);
}

[data-theme="cyberpunk"] {
    --bg1: #1a1a2e; --bg2: #16213e; --accent: #ff2a6d; --accent-rgb: 255, 42, 109;
    --fg: #ffffff; --bg-panel: #0f3460aa; --bg-card: #1a1a2ecc;
    --border: rgba(255, 0, 255, 0.1); --shadow: rgba(255, 42, 109, 0.2);
}

[data-theme="github-dark"] {
    --bg1: #0d1117; --bg2: #161b22; --accent: #58a6ff; --accent-rgb: 88, 166, 255;
    --fg: #f0f6fc; --bg-panel: #21262dcc; --bg-card: #30363daa;
    --border: rgba(255, 255, 255, 0.1); --shadow: rgba(0, 0, 0, 0.4);
}

[data-theme="solar-flare"] {
    --bg1: #fff2e6; --bg2: #ffd9b3; --accent: #ff6a00; --accent-rgb: 255, 106, 0;
    --fg: #2b2b2b; --bg-panel: rgba(255, 255, 255, 0.85); --bg-card: rgba(255, 235, 220, 0.9);
    --border: rgba(0, 0, 0, 0.05); --shadow: rgba(255, 106, 0, 0.2);
}

[data-theme="minty-fresh"] {
    --bg1: #f0fff6; --bg2: #dffef0; --accent: #2bbf9b; --accent-rgb: 43, 191, 155;
    --fg: #133a32; --bg-panel: rgba(240, 255, 250, 0.9); --bg-card: rgba(220, 250, 240, 0.9);
    --border: rgba(0, 0, 0, 0.05); --shadow: rgba(43, 191, 155, 0.15);
}

[data-theme="vintage-paper"] {
    --bg1: #f7efe1; --bg2: #efe1c8; --accent: #b66b2f; --accent-rgb: 182, 107, 47;
    --fg: #3a2b18; --bg-panel: rgba(247, 239, 225, 0.95); --bg-card: rgba(239, 225, 200, 0.95);
    --border: rgba(0, 0, 0, 0.05); --shadow: rgba(182, 107, 47, 0.1);
}

[data-theme="lavender-dream"] {
    --bg1: #f4eefc; --bg2: #e7ddfb; --accent: #8a63ff; --accent-rgb: 138, 99, 255;
    --fg: #2f2340; --bg-panel: rgba(244, 238, 252, 0.9); --bg-card: rgba(230, 220, 245, 0.9);
    --border: rgba(0, 0, 0, 0.05); --shadow: rgba(138, 99, 255, 0.15);
}

[data-theme="mono-glass"] {
    --bg1: #f6f7f9; --bg2: #e9ebee; --accent: #8b8f95; --accent-rgb: 139, 143, 149;
    --fg: #1b1b1b; --bg-panel: rgba(250, 250, 252, 0.75); --bg-card: rgba(230, 232, 235, 0.85);
    --border: rgba(0, 0, 0, 0.1); --shadow: rgba(0, 0, 0, 0.1);
}

[data-theme="aurora-light"] {
    --bg1: #f0f4f8; --bg2: #e2e8f0; --accent: #007AFF; --accent-rgb: 0, 122, 255;
    --fg: #1d1d1f; --bg-panel: rgba(255, 255, 255, 0.75); --bg-card: rgba(255, 255, 255, 0.9);
    --border: rgba(0, 0, 0, 0.1); --shadow: rgba(0, 0, 0, 0.1);
}

[data-theme="electric-neon"] {
    --bg1: #000000; --bg2: #1e0033; --accent: #00ff9f; --accent-rgb: 0, 255, 159;
    --fg: #ffffff; --bg-panel: rgba(10, 10, 20, 0.85); --bg-card: rgba(20, 20, 30, 0.95);
    --border: rgba(0, 255, 159, 0.2); --shadow: rgba(0, 255, 159, 0.3);
}

/* Light theme buttons color fix */
[data-theme="aurora-light"] .fullscreen-btn,
[data-theme="solar-flare"] .fullscreen-btn,
[data-theme="minty-fresh"] .fullscreen-btn,
[data-theme="vintage-paper"] .fullscreen-btn,
[data-theme="lavender-dream"] .fullscreen-btn,
[data-theme="mono-glass"] .fullscreen-btn {
    color: #000;
}

/* ========== BASE STYLES ========== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    height: 100%;
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, 'Inter', 'SF Pro Display', system-ui, sans-serif;
    overflow: hidden;
    color: var(--fg);
}

body {
    background: linear-gradient(160deg, var(--bg1), var(--bg2));
    transition: background 1s var(--animation-ease), color 0.5s var(--animation-ease);
}

/* ========== LAYOUT & GRID ========== */
.app {
    display: grid;
    grid-template-columns: 1fr 380px;
    gap: clamp(16px, 2vw, 24px);
    min-height: 100vh;
    padding: clamp(16px, 2vw, 24px);
}

.canvas-wrap {
    position: relative;
    border-radius: var(--border-radius);
    overflow: hidden;
    box-shadow: 0 20px 40px var(--shadow), 0 0 0 1px var(--border);
    background: var(--bg-card);
    backdrop-filter: blur(20px);
    transition: all var(--transition-time) var(--animation-ease);
}

/* Subtle elevation on hover and focus within */
.canvas-wrap:hover,
.canvas-wrap:focus-within {
    transform: translateY(-2px);
    box-shadow: 0 28px 60px var(--shadow), 0 0 0 1px rgba(0,0,0,0.08);
}

.canvas-wrap::before {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, rgba(255,255,255,0.28), rgba(255,255,255,0));
    pointer-events: none;
}

/* Soften/remove white sheen on dark themes to avoid eye strain */
[data-theme="neon-dark"] .canvas-wrap::before,
[data-theme="black-baby"] .canvas-wrap::before,
[data-theme="cyberpunk"] .canvas-wrap::before,
[data-theme="github-dark"] .canvas-wrap::before,
[data-theme="electric-neon"] .canvas-wrap::before {
    background: linear-gradient(180deg, rgba(0,0,0,0.22), rgba(0,0,0,0));
}


canvas {
    display: block;
    width: 100%;
    height: 100%;
    transition: filter var(--transition-time);
    border-radius: inherit;
    border: 1px solid rgba(0,0,0,0.06);
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.45);
}

/* Custom dot cursor over canvas */
#c {
    cursor: none; /* hide system cursor only over canvas */
}

.cursor-dot {
    position: fixed;
    z-index: 10000;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--accent);
    box-shadow:
        0 0 0 2px rgba(var(--accent-rgb), 0.18),
        0 4px 10px rgba(var(--accent-rgb), 0.28);
    transform: translate(-50%, -50%);
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.15s var(--animation-ease), background 0.2s var(--animation-ease);
}

.cursor-dot.visible {
    opacity: 0.5;
}

.panel-wrapper {
    border-radius: var(--border-radius);
    overflow: hidden;
    height: 90vh;
    box-shadow: 0 20px 40px var(--shadow), 0 0 0 1px var(--border);
    transition: transform var(--transition-time) var(--animation-ease), opacity var(--transition-time) var(--animation-ease);
}

.panel {
    background: var(--bg-panel);
    backdrop-filter: blur(30px) saturate(180%);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--fg);
    height: 100%;
    overflow-y: auto;
    padding: var(--section-spacing);
    opacity: 0;
    transform: translateX(40px);
    animation: slideIn 0.8s var(--animation-ease) forwards 0.4s;
}

/* ========== TYPOGRAPHY ========== */
h2 {
    margin: 0 0 20px;
    font-size: 24px;
    font-weight: 700;
    letter-spacing: -0.5px;
    background: var(--accent);
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.section-title {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 16px;
    color: var(--fg);
    opacity: 0.9;
}

label {
    display: block;
    font-size: 14px;
    margin: 0 0 8px;
    font-weight: 500;
    color: var(--fg);
    opacity: 0.8;
}

/* ========== FORM ELEMENTS ========== */
.input-group {
    margin-bottom: 16px;
}

input[type="text"],
textarea,
select {
    width: 100%;
    padding: 12px 16px;
    border-radius: var(--border-radius);
    border: 1px solid rgba(0,0,0,0.08);
    background: var(--bg-card);
    color: var(--fg);
    font-size: 16px;
    transition: border-color var(--transition-time) var(--animation-ease), 
                box-shadow var(--transition-time) var(--animation-ease);
    font-family: inherit;
    box-shadow:
        inset 0 1px 0 rgba(255,255,255,0.5),
        0 6px 18px var(--shadow);
}

/* Enhanced select styling */
select {
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    border-radius: calc(var(--border-radius) + 4px);
    background:
        linear-gradient(180deg, rgba(255,255,255,0.35), rgba(255,255,255,0)) padding-box,
        var(--bg-card);
    box-shadow:
        inset 0 1px 0 rgba(255,255,255,0.5),
        0 6px 18px var(--shadow);
    border: 1px solid rgba(0,0,0,0.08);
    padding-right: 44px; /* space for arrow */
    position: relative;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' viewBox='0 0 24 24' fill='none' stroke='rgba(0,0,0,0.6)' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
    background-size: 18px;
}

/* Dark themes arrow color tweak */
[data-theme="neon-dark"] select,
[data-theme="black-baby"] select,
[data-theme="cyberpunk"] select,
[data-theme="github-dark"] select,
[data-theme="electric-neon"] select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' viewBox='0 0 24 24' fill='none' stroke='rgba(255,255,255,0.8)' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
}

/* Hide default arrow on IE */
select::-ms-expand { display: none; }

/* Hover/Focus states for select */
select:hover {
    box-shadow:
        inset 0 1px 0 rgba(255,255,255,0.55),
        0 10px 24px rgba(0,0,0,0.12);
}

select:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(var(--accent-rgb), 0.15), 0 10px 24px rgba(0,0,0,0.14);
}

/* Open-ish visual feedback using :focus-visible */
select:focus-visible {
    transform: translateY(-1px);
}

/* Options basic styling (limited support across browsers) */
select option {
    background: var(--bg-panel);
    color: var(--fg);
}

input[type="text"]:focus,
textarea:focus,
select:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow:
        0 0 0 3px rgba(var(--accent-rgb), 0.12),
        0 10px 24px rgba(0,0,0,0.14);
}

textarea {
    resize: vertical;
    min-height: 80px;
}

textarea::placeholder {
    font-size: 14px;
    color: rgba(var(--fg), 0.5);
    font-style: italic;
}

/* ========== SLIDERS ========== */
.slider-container {
    position: relative;
    margin: 8px 0 16px;
}

input[type="range"] {
    width: 100%;
    height: 5px;
    border-radius: 5px;
    background: linear-gradient(180deg, rgba(255,255,255,0.35), rgba(255,255,255,0)) padding-box, var(--border);
    outline: none;
    appearance: none;
    -webkit-appearance: none;
    transition: background var(--transition-time);
    will-change: transform;
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.5), 0 6px 16px var(--shadow);
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: linear-gradient(180deg, rgba(255,255,255,0.25), rgba(255,255,255,0)) padding-box, var(--accent);
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
    transition: transform var(--transition-time);
    border: 1px solid rgba(0,0,0,0.08);
}

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

input[type="range"]::-moz-range-thumb {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: linear-gradient(180deg, rgba(255,255,255,0.25), rgba(255,255,255,0)) padding-box, var(--accent);
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
    transition: transform var(--transition-time);
    border: 1px solid rgba(0,0,0,0.08);
}

.slider-value {
    position: absolute;
    right: 0;
    top: -20px;
    font-size: 12px;
    color: var(--fg);
    opacity: 0.7;
}

/* ========== BUTTONS ========== */
.btn, .preset-btn {
    padding: 12px 20px;
    border-radius: calc(var(--border-radius) + 2px);
    background:
        linear-gradient(180deg, rgba(255,255,255,0.25), rgba(255,255,255,0)) padding-box,
        var(--accent);
    color: white;
    border: 1px solid rgba(0,0,0,0.08);
    cursor: pointer;
    font-weight: 600;
    font-size: 16px;
    transition: all var(--transition-time) var(--animation-ease);
    font-family: inherit;
    display: flex;
    align-items: center;
    gap: 8px;
    position: relative;
    overflow: hidden;
    will-change: transform;
    box-shadow:
        inset 0 1px 0 rgba(255,255,255,0.5),
        0 8px 20px rgba(var(--accent-rgb), 0.25);
}

.btn::before, .preset-btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    transition: width 0.6s ease, height 0.6s ease;
    z-index: 0;
}

.btn:active::before, .preset-btn:active::before {
    width: 300px;
    height: 300px;
}

.btn > *, .preset-btn > * {
    position: relative;
    z-index: 1;
}

.btn:hover, .preset-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 28px rgba(var(--accent-rgb), 0.35);
}

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

.btn-outline {
    background:
        linear-gradient(180deg, rgba(255,255,255,0.2), rgba(255,255,255,0)) padding-box,
        transparent;
    border: 1px solid rgba(0,0,0,0.1);
    color: var(--fg);
    box-shadow:
        inset 0 1px 0 rgba(255,255,255,0.6),
        0 6px 18px var(--shadow);
}

.preset-btn {
    font-size: 14px;
    padding: 12px;
}

.preset-btn:hover {
    animation: pulse 1s infinite;
}

/* ========== TOGGLES ========== */
.toggle-group {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.toggle {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 26px;
}

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

.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background:
        linear-gradient(180deg, rgba(255,255,255,0.35), rgba(255,255,255,0)) padding-box,
        var(--border);
    transition: background-color var(--transition-time) var(--animation-ease);
    border-radius: 34px;
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.6), 0 6px 16px var(--shadow);
}

.toggle-slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 4px;
    bottom: 4px;
    background: linear-gradient(180deg, rgba(255,255,255,0.75), rgba(255,255,255,0.3));
    transition: transform var(--transition-time) var(--animation-ease);
    border-radius: 50%;
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.8), 0 1px 3px rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(0,0,0,0.05);
}

.toggle input:checked + .toggle-slider {
    background-color: var(--accent);
}

.toggle input:checked + .toggle-slider:before {
    transform: translateX(24px);
}

.toggle input:focus + .toggle-slider {
    box-shadow: 0 0 1px var(--accent);
}

/* ========== COMPONENTS ========== */
.section {
    margin-bottom: var(--section-spacing);
    padding-bottom: 20px;
    border-bottom: 1px solid var(--border);
    opacity: 0;
    transform: translateY(20px);
    animation: fadeInUp 0.6s var(--animation-ease) forwards;
    animation-delay: calc(0.2s * var(--section-index, 0));
}

.section:last-child {
    border-bottom: none;
    margin-bottom: 0;
}

.row {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.stats {
    display: flex;
    justify-content: space-between;
    font-size: 12px;
    color: var(--fg);
    opacity: 0.6;
    margin-top: 8px;
}

.preset-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 8px;
}

.emoji-preview {
    font-size: 20px;
    margin-top: 8px;
}

footer {
    margin-top: 20px;
    font-size: 12px;
    color: var(--fg);
    opacity: 0.4;
    text-align: center;
}

/* ========== FULLSCREEN & OVERLAYS ========== */
.fullscreen-btn {
    position: absolute;
    right: 12px;
    top: 12px;
    z-index: 60;
    background: none;
    border: none;
    color: var(--accent);
    font-size: 22px;
    cursor: pointer;
    opacity: 0.7;
    transition: all var(--transition-time);
}

.fullscreen-btn:hover {
    opacity: 1;
    transform: scale(1.1);
}

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

.overlay {
    position: absolute;
    top: 12px;
    left: 12px;
    z-index: 50;
    color: var(--fg);
    font-family: system-ui;
    font-size: 16px;
    pointer-events: none;
    background: none;
    text-shadow: 1px 1px 2px var(--shadow);
    opacity: 0;
    animation: fadeIn 0.5s var(--animation-ease) forwards 1s;
}

.overlay.hidden {
    display: none;
}

#fpsOverlay { top: 12px; }
#particleCountOverlay { top: 32px; }

/* custom cursor styles removed */

/* ========== SCROLLBAR ========== */
.panel::-webkit-scrollbar {
    width: 6px;
}

.panel::-webkit-scrollbar-track {
    background: transparent;
}

.panel::-webkit-scrollbar-thumb {
    background-color: rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.05);
    transition: background-color var(--transition-time);
}

.panel::-webkit-scrollbar-thumb:hover {
    background-color: rgba(255, 255, 255, 0.3);
}

.panel {
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.1) transparent;
}

/* ========== ANIMATIONS ========== */
@keyframes slideIn {
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

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

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

@keyframes pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(var(--accent-rgb), 0.7);
    }
    70% {
        box-shadow: 0 0 0 10px rgba(var(--accent-rgb), 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(var(--accent-rgb), 0);
    }
}

@keyframes shine {
    to {
        background-position: 200% center;
    }
}

@keyframes sparkle {
    from {
        opacity: 0.5;
        transform: scale(0.8);
    }
    to {
        opacity: 1;
        transform: scale(1.2);
    }
}

@keyframes fadeInOut {
    from {
        opacity: 0.4;
    }
    to {
        opacity: 0.8;
    }
}

@keyframes shake {
    0%, 100% { transform: translateX(-50%) translateY(10px); }
    20%, 60% { transform: translateX(calc(-50% - 8px)) translateY(10px); }
    40%, 80% { transform: translateX(calc(-50% + 8px)) translateY(10px); }
}

@keyframes sheen {
    0% { left: -40%; }
    60% { left: 120%; }
    100% { left: 120%; }
}

@keyframes glowPulse {
    0%, 100% { box-shadow: 0 8px 24px rgba(0,0,0,0.35), 0 0 0 1px rgba(255,255,255,0.06), 0 0 18px rgba(255, 56, 56, 0.28); }
    50% { box-shadow: 0 10px 28px rgba(0,0,0,0.4), 0 0 0 1px rgba(255,255,255,0.06), 0 0 34px rgba(255, 56, 56, 0.45); }
}

/* ========== PRELOADER ========== */
#preloader {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--bg-panel);
    color: var(--accent);
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    overflow: hidden;
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    transition: opacity 0.5s ease, visibility 0.5s ease;
}

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

.preloader-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    gap: 1rem;
}

.preloader-logo {
    font-size: 4rem;
    font-weight: bold;
    margin-bottom: 2rem;
    text-align: center;
    background: var(--accent);
    background-size: 200% auto;
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    animation: shine 3s linear infinite;
    position: relative;
}

.preloader-logo::after {
    content: "✨";
    position: absolute;
    top: -10px;
    right: -30px;
    font-size: 2rem;
    animation: sparkle 2s infinite alternate;
}

.progress-container {
    width: 80%;
    max-width: 500px;
    height: 12px;
    background-color: rgba(255, 255, 255, 0.479);
    border-radius: 10px;
    overflow: hidden;
    margin-bottom: 2rem;
}

.progress-bar {
    height: 100%;
    width: 0%;
    background: var(--accent);
    border-radius: 10px;
    transition: width 0.3s ease;
}

.loading-text {
    font-size: 1.2rem;
    height: 40px;
    font-weight: 600;
    text-align: center;
    margin-top: 1rem;
    position: relative;
    overflow: hidden;
    width: 100%;
}

.text-item {
    position: absolute;
    width: 100%;
    top: 0;
    left: 0;
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.5s ease, transform 0.5s ease;
    text-shadow: 0 0 10px var(--accent);
}

.text-item.active {
    opacity: 1;
    transform: translateY(0);
}

.text-item.leaving {
    opacity: 0;
    transform: translateY(-20px);
}

.skip-text {
    position: absolute;
    bottom: 2rem;
    font-size: 0.9rem;
    opacity: 0.7;
    animation: fadeInOut 2s infinite alternate;
}

/* ========== MOBILE OVERLAY ========== */
#mobile-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(160deg, var(--bg1), var(--bg2));
    color: var(--accent);
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    overflow: hidden;
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    transition: opacity 0.5s ease, visibility 0.5s ease;
    opacity: 0;
    animation: fadeIn 0.5s var(--animation-ease) forwards;
}

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

.overlay-content {
    background: var(--bg-panel);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    gap: 1rem;
}

.logo {
    font-size: 4rem;
    font-weight: bold;
    margin-bottom: 2rem;
    text-align: center;
    background: var(--accent);
    background-size: 200% auto;
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    animation: shine 3s linear infinite;
    position: relative;
}

.logo::after {
    content: "✨";
    position: absolute;
    top: -10px;
    right: -30px;
    font-size: 2rem;
    animation: sparkle 2s infinite alternate;
}

.message {
    font-size: 1.2rem;
    font-weight: 600;
    text-align: center;
    line-height: 1.5;
    width: 80%;
    max-width: 500px;
}

/* ========== ERROR DISPLAY ========== */
#errorDisplay {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%) translateY(0);
    background: linear-gradient(135deg, rgba(255, 56, 56, 0.75), rgba(255, 0, 0, 0.6));
    color: #fff;
    padding: 14px 22px;
    border-radius: 14px;
    z-index: 9999;
    display: none;
    max-width: 80%;
    text-align: center;
    box-shadow: 0 8px 24px rgba(0,0,0,0.35), 0 0 0 1px rgba(255,255,255,0.06), 0 0 24px rgba(255, 56, 56, 0.35);
    opacity: 0;
    font-family: system-ui, sans-serif;
    transition: opacity 0.4s ease, transform 0.4s ease, box-shadow 0.4s ease, backdrop-filter 0.4s ease;
    backdrop-filter: blur(10px) saturate(140%);
    border: 1px solid rgba(255, 56, 56, 0.35);
    overflow: hidden;
}

#errorDisplay.visible {
    opacity: 1;
    transform: translateX(-50%) translateY(10px);
    animation: glowPulse 2.2s var(--animation-ease) infinite;
}

#errorDisplay.shake {
    animation: shake 0.4s ease;
}

#errorDisplay::before {
    content: "";
    position: absolute;
    inset: 0;
    background: radial-gradient(120px 40px at 10% -20%, rgba(255,255,255,0.45), transparent 60%),
                radial-gradient(160px 60px at 90% -30%, rgba(255,255,255,0.25), transparent 60%);
    pointer-events: none;
}

#errorDisplay::after {
    content: "";
    position: absolute;
    top: 0;
    left: -40%;
    width: 40%;
    height: 100%;
    background: linear-gradient(120deg, transparent, rgba(255,255,255,0.25), transparent);
    transform: skewX(-20deg);
    animation: sheen 3.2s ease-in-out infinite;
    pointer-events: none;
}

/* ========== FULLSCREEN STATES ========== */
body[data-fullscreen="true"] #stage {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw !important;
    height: 100vh !important;
    z-index: 9998;
}

body[data-fullscreen="true"] #c {
    width: 100vw !important;
    height: 100vh !important;
}

body[data-fullscreen="true"] .hide-on-fullscreen {
    display: none !important;
}

.canvas-wrap.fullscreen {
    border-radius: 0;
}

/* ========== INTERACTIVE STATES ========== */
button:hover,
input[type="range"]:hover,
.toggle-slider:hover {
    filter: brightness(1.1);
}

.main-content {
    opacity: 0;
    transition: opacity 0.5s ease;
}

.main-content.loaded {
    opacity: 1;
}

/* ========== RESPONSIVE DESIGN ========== */
@media (max-width: 1000px) {
    .app {
        grid-template-columns: 1fr;
        padding: 16px;
    }

    .panel-wrapper {
        position: fixed;
        bottom: 16px;
        right: 16px;
        left: 16px;
        width: auto;
        max-height: 60vh;
        height: auto;
        z-index: 1000;
    }

    .panel {
        border-radius: var(--border-radius) var(--border-radius) 0 0;
    }
}

@media (pointer: coarse) {
    #mobile-overlay {
        display: flex;
    }

    body {
        overflow: hidden;
        height: 100%;
    }
}

@media (pointer: coarse) and (min-width: 1200px) {
    .overlay-content {
        max-width: 600px;
    }
}

@media (pointer: coarse) and (max-width: 480px) {
    .logo, .preloader-logo {
        font-size: 30px;
    }

    .message {
        font-size: 15px;
    }
}

@media (pointer: fine) {
    #mobile-overlay {
        display: none !important;
    }
}

/* ========== ACCESSIBILITY ========== */
@media (prefers-reduced-motion: reduce) {
    * {
        animation: none !important;
        transition: none !important;
    }
    
    .btn::before, .preset-btn::before {
        display: none;
    }
}