@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;500;600;700&display=swap');

:root {
    --bg: #09090b;
    --panel-bg: rgba(24, 24, 27, 0.95);
    --border: rgba(255, 255, 255, 0.12);
    --accent: #8b5cf6;
    --accent-hover: #7c3aed;
    --accent-glow: rgba(139, 92, 246, 0.5);
    --text: #ffffff;
    --text-muted: #a1a1aa;
    --font: 'Poppins', -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", Roboto, sans-serif;
}

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

html,
body {
    height: 100%;
    width: 100%;
    overflow: hidden;
    background: var(--bg);
    color: var(--text);
    font-family: var(--font);
    user-select: none;
    -webkit-user-select: none;
    -webkit-touch-callout: none;
    -webkit-tap-highlight-color: transparent;
    overscroll-behavior: none;
}

.app {
    display: flex;
    flex-direction: column;
    height: 100vh;
    height: 100dvh;
    touch-action: none;
}

button:focus-visible,
a:focus-visible,
input:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

button:active {
    filter: brightness(0.9);
    transform: scale(0.96);
}

.tab-item:active {
    transform: scale(0.95);
}

.action-link {
    color: var(--text-muted) !important;
    transition: all 0.2s ease;
    padding: 4px 8px;
    margin: -4px -8px;
    border-radius: 6px;
}

.action-link:hover {
    color: var(--accent, #8b5cf6) !important;
    background: rgba(139, 92, 246, 0.1) !important;
}

body.light-mode .action-link:hover {
    background: rgba(139, 92, 246, 0.08) !important;
}

.ui-faded {
    opacity: 0 !important;
    pointer-events: none !important;
}

.header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: auto;
    min-height: 60px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: max(12px, env(safe-area-inset-top)) 24px 12px 24px;
    background: linear-gradient(to bottom, rgba(9, 9, 11, 0.9) 0%, transparent 100%);
    z-index: 100;
    pointer-events: none;
}

.header>* {
    pointer-events: auto;
}

.header-left,
.header-center,
.btn-save {
    opacity: 0 !important;
    pointer-events: none !important;
    transition: opacity 0.5s ease;
}

.header.workspace-active .header-left,
.header.workspace-active .header-center,
.header.workspace-active .btn-save {
    opacity: 1 !important;
    pointer-events: auto !important;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

/* .icon-btn styles moved to pro-ui.css */

/* .btn-save styles moved to pro-ui.css */

.header-center {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 101;
}

.app-logo {
    height: 34px;
    width: auto;
    object-fit: contain;
    filter: drop-shadow(0 4px 12px rgba(0, 0, 0, 0.5));
    opacity: 0.9;
}

.thumb-preview {
    display: none;
    position: absolute;
    top: 80px;
    left: 24px;
    width: 56px;
    height: 56px;
    border-radius: 12px;
    overflow: hidden;
    border: 2px solid rgba(255, 255, 255, 0.3);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.4);
    z-index: 150;
    cursor: pointer;
    opacity: 1;
}

.thumb-preview:active {
    transform: scale(0.95);
    border-color: white;
}

.thumb-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.thumb-preview.hidden {
    display: none !important;
}

.workspace {
    flex: 1;
    position: relative;
    overflow: hidden;
    background: var(--bg);
    background-image: radial-gradient(#27272a 1px, transparent 1px);
    background-size: 24px 24px;
    touch-action: none;
    cursor: default;
}

.workspace.cursor-grab {
    cursor: grab;
}

.workspace.cursor-grabbing {
    cursor: grabbing;
}

.canvas-container {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    transform-origin: center center;
    box-shadow: 0 50px 100px -20px rgba(0, 0, 0, 0.7);
    will-change: transform;
}

#baseImage {
    display: block;
    pointer-events: none;
    max-width: none;
}

#threeCanvas,
#overlayCanvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

#overlayCanvas {
    z-index: 10;
}

.empty-state {
    position: absolute;
    inset: 0;
    display: flex;
    background: #09090b;
    z-index: 200;
    padding: 0;
    text-align: left;
    overflow: hidden;
    flex-direction: row;
}

.empty-visual {
    flex: 1;
    height: 100%;
    background: url('/img/Retrato Abstracto de chica.png') no-repeat center center;
    background-size: cover;
    position: relative;
    clip-path: polygon(0 0, 100% 0, 85% 100%, 0% 100%);
    z-index: 1;
}

.empty-visual::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(to right, rgba(0, 0, 0, 0.2), rgba(0, 0, 0, 0.8));
}

.empty-content {
    flex: 1;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 40px 60px 40px 20px;
    overflow-y: auto;
    text-align: center;
    position: relative;
}

@media (max-width: 1024px) {
    .empty-state {
        flex-direction: column;
    }

    .empty-visual {
        display: none;
    }

    .empty-content {
        padding: 20px;
        width: 100%;
        justify-content: center;
    }

    .studio-hero h1 {
        font-size: 28px;
        margin-bottom: 12px;
    }

    .upload-card {
        margin-bottom: 32px;
        padding: 50px 20px;
    }

    .tutorial-grid {
        gap: 12px;
    }
}

.empty-state.hidden {
    display: none;
}

.studio-hero {
    margin-bottom: 40px;
    max-width: 600px;
    animation: fadeInUp 0.6s ease-out;
}

.studio-hero h1 {
    font-size: 32px;
    font-weight: 800;
    background: linear-gradient(to right, #fff, #a1a1aa);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 12px;
    letter-spacing: -0.5px;
}

.studio-desc {
    color: var(--text-muted);
    font-size: 16px;
    line-height: 1.6;
}

.upload-card {
    background: transparent;
    border: 2px dashed rgba(255, 255, 255, 0.15);
    border-radius: 24px;
    padding: 40px;
    width: 100%;
    max-width: 500px;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    /* overflow: hidden; Removed to prevent clipping on mobile */
    margin-bottom: 60px;
    animation: fadeInUp 0.6s ease-out 0.1s backwards;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.upload-card:hover {
    background: rgba(139, 92, 246, 0.05);
    border-color: var(--accent);
    transform: translateY(-2px);
}

.upload-icon-wrapper {
    width: 64px;
    height: 64px;
    background: transparent;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 16px;
    color: var(--text-muted);
    transition: color 0.3s;
}

.upload-card:hover .upload-icon-wrapper {
    color: var(--accent);
}

.upload-icon-hero {
    width: 48px;
    height: 48px;
}

.upload-card h3 {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 8px;
}

.upload-card p {
    color: var(--text-muted);
    font-size: 14px;
    margin-bottom: 24px;
}

.feature-pills {
    display: flex;
    justify-content: center;
    gap: 12px;
    flex-wrap: wrap;
}

.pill {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    padding: 6px 12px;
    border-radius: 99px;
    font-size: 12px;
    color: #d4d4d8;
    font-weight: 500;
}

.tutorial-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 24px;
    width: 100%;
    max-width: 900px;
    animation: fadeInUp 0.6s ease-out 0.2s backwards;
}

.step-card {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.05);
    padding: 24px;
    border-radius: 16px;
    text-align: left;
    display: flex;
    flex-direction: column;
    gap: 16px;
    transition: background 0.2s;
}

.step-card:hover {
    background: rgba(255, 255, 255, 0.04);
}

.step-icon {
    width: 40px;
    height: 40px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
}

.step-content h4 {
    font-size: 15px;
    font-weight: 700;
    margin-bottom: 4px;
    color: white;
}

.step-content p {
    font-size: 13px;
    color: var(--text-muted);
    line-height: 1.5;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

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

@media (max-width: 768px) {
    .tutorial-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .step-card {
        flex-direction: row;
        align-items: center;
    }

    .studio-hero h1 {
        font-size: 24px;
    }
}

.btn-primary {
    background: var(--accent);
    color: white;
    border: none;
    padding: 16px 32px;
    border-radius: 99px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 10px;
    box-shadow: 0 8px 24px var(--accent-glow);
}

.floating-controls {
    position: absolute;
    /* On mobile/base: Float ABOVE the panel */
    bottom: calc(100% + 12px);
    top: auto;
    left: 0;
    right: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 0;
    z-index: 100;
    /* Above everything in panel */
    pointer-events: none;
    transition: all 0.3s ease;
    opacity: 1;
}

.floating-controls>* {
    pointer-events: auto;
}

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

.center-actions {
    display: flex;
    gap: 10px;
    align-items: center;
    background: var(--panel-bg-glass, rgba(30, 30, 30, 0.6));
    backdrop-filter: blur(24px) saturate(180%);
    -webkit-backdrop-filter: blur(24px) saturate(180%);
    padding: 6px 12px;
    border-radius: 20px;
    justify-content: center;
}



.history-group {
    display: flex;
    gap: 6px;
    margin-left: 8px;
    padding-left: 10px;
    border-left: 1px solid rgba(255, 255, 255, 0.1);
}

.btn-float-action {
    width: 32px;
    height: 32px;
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    transition: all 0.2s ease;
}

.btn-float-action:hover:not(:disabled) {
    background: rgba(255, 255, 255, 0.15);
    transform: scale(1.05);
}

.btn-float-action:disabled {
    opacity: 0.2;
    cursor: default;
    filter: grayscale(1);
}

.btn-play {
    width: 40px;
    height: 40px;
    background: white;
    border: none;
    border-radius: 50%;
    color: black;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    transition: transform 0.2s;
}

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

.btn-play.playing {
    background: var(--accent);
    color: white;
}

.btn-eraser,
.btn-fx {
    width: 44px;
    height: 44px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid transparent;
    border-radius: 50%;
    color: var(--text);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-eraser:hover,
.btn-fx:hover {
    background: rgba(255, 255, 255, 0.2);
}

.btn-eraser.active,
.btn-fx.active {
    background: var(--accent);
    color: white;
}

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

.btn-fx {
    position: relative;
}

.tool-panel {
    position: fixed;
    /* Lift up on mobile to not cover the Prompt Bar */
    bottom: calc(85px + env(safe-area-inset-bottom, 0px));
    left: 12px;
    right: 12px;
    z-index: 90;
    transition: none !important;
    opacity: 1;
    pointer-events: none;
    /* Allow events through to container */
    overflow: visible !important;
    border-radius: 20px;
    /* Guide for the engine */
}

.panel-container {
    border-radius: 24px;
    background: var(--panel-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    overflow: hidden;
    pointer-events: auto;
    width: 100%;
    height: 100%;

    /* ADVANCED CLIPPING FIX */
    isolation: isolate;
    -webkit-mask-image: -webkit-radial-gradient(white, black);
    /* Force hardware clip */
    mask-image: radial-gradient(white, black);
    border-radius: inherit;
}

.tool-panel.hidden {
    display: none;
}

.panel-header {
    display: none;
}

.panel-body {
    padding: 12px 0;
    display: flex;
    flex-direction: column-reverse;
    gap: 12px;
    transition: none !important;
    max-height: 500px;
    opacity: 1;
    overflow: hidden;
}

.bottom-tabs {
    display: flex;
    justify-content: center;
    gap: 40px;
}

.tab-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 8px 16px;
    border-radius: 16px;
    transition: none !important;
}

.tab-item.active {
    color: var(--accent);
    background: rgba(139, 92, 246, 0.1);
}

.slider-section {
    padding: 0 24px;
    margin: 0 auto;
    width: 100%;
    max-width: 400px;
}

.slider-section.hidden {
    display: none !important;
}

.slider-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 12px;
    color: var(--text-muted);
    font-weight: 600;
    margin-bottom: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

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

.slider-track {
    position: relative;
    height: 6px;
    background: rgba(255, 255, 255, 0.15);
    border-radius: 3px;
    cursor: pointer;
    touch-action: none;
}

.slider-fill {
    position: absolute;
    left: 0;
    top: 0;
    height: 100%;
    background: var(--accent);
    border-radius: 20px;
    pointer-events: none;
}

.slider-thumb {
    position: absolute;
    top: 50%;
    transform: translate(-50%, -50%);
    width: 24px;
    height: 24px;
    background: white;
    border-radius: 50%;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
    pointer-events: none;
}

.btn-toggle-slider {
    background: rgba(255, 255, 255, 0.1);
    border: none;
    width: 28px;
    height: 28px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: white;
}

.btn-toggle-slider.hidden {
    display: none;
}

.modal-body {
    color: var(--text);
    line-height: 1.6;
}

.limit-width {
    max-width: 400px;
}

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

.btn-secondary {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text);
    border: 1px solid rgba(255, 255, 255, 0.1);
    padding: 8px 16px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s;
}

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

.btn-primary {
    background: var(--accent);
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s;
}

.btn-primary:hover {
    filter: brightness(1.1);
}

@media (max-width: 768px) {
    #btnNewImage {
        display: none !important;
    }

    .btn-save span {
        display: none;
    }

    .btn-save {
        padding: 0;
        width: 44px;
        height: 44px;
        justify-content: center;
        margin-left: auto;
    }

    .app-logo {
        height: 24px;
    }

    .header-left {
        display: none !important;
    }

    .thumb-preview {
        display: block;
        top: 8px;
        left: 16px;
        width: 44px;
        height: 44px;
        border-width: 1px;
        z-index: 200;
    }

    .floating-controls {
        bottom: 180px !important;
        padding: 0 16px;
        justify-content: center;
        width: 100%;
    }


    .center-actions {
        background: rgba(20, 20, 20, 0.8);
        border: 1px solid rgba(255, 255, 255, 0.15);
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
        padding: 6px 14px;
        gap: 10px;
    }

    .center-actions .btn-play {
        width: 42px;
        height: 42px;
    }

    .center-actions .btn-play i {
        width: 20px !important;
    }

    .center-actions .btn-float-action,
    .center-actions .btn-fx {
        width: 38px;
        height: 38px;
    }

    .center-actions .history-group {
        gap: 8px !important;
        padding-left: 10px !important;
        margin-left: 6px !important;
    }

    .bottom-tabs {
        gap: 8px;
        justify-content: center;
        padding: 0 12px;
    }

    .tab-item {
        padding: 8px;
        min-width: 44px;
        border-radius: 50%;
        aspect-ratio: 1;
        justify-content: center;
    }

    .tab-item i {
        width: 20px;
        height: 20px;
        margin: 0;
    }

    .tab-item span {
        display: none;
    }

    .preset-btn {
        padding: 8px 10px;
        min-width: 64px;
    }

    .preset-btn .preset-icon {
        font-size: 18px;
    }

    .slider-track {
        height: 6px;
        border-radius: 8px;
    }

    .slider-thumb {
        width: 20px;
        height: 20px;
        box-shadow: 0 4px 8px rgba(0, 0, 0, 0.4);
    }

    .slider-section {
        margin-bottom: 8px;
    }
}

@media (min-width: 769px) {
    .tool-panel {
        top: 100px;
        right: auto;
        left: 24px;
        bottom: auto;
        width: 280px;
        padding-bottom: 0;
        transition: none !important;
        overflow: visible !important;
        background: none !important;
        border: none !important;
        box-shadow: none !important;
        backdrop-filter: none !important;
        -webkit-backdrop-filter: none !important;
    }

    .panel-container {
        background: var(--panel-bg-glass, rgba(30, 30, 30, 0.6));
        backdrop-filter: blur(24px) saturate(180%);
        -webkit-backdrop-filter: blur(24px) saturate(180%);
        border-radius: 20px;
        box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
        overflow: hidden;
        width: 100%;
        height: 100%;
        pointer-events: auto;

        /* FINAL GHOSTING FIX */
        isolation: isolate;
        -webkit-mask-image: linear-gradient(#fff, #fff);
        /* Force hardware layer cache */
        mask-image: linear-gradient(#fff, #fff);
    }

    .panel-header {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 14px 16px;
        background: rgba(255, 255, 255, 0.03);
        border-bottom: 1px solid var(--border);
        cursor: grab;
        user-select: none;
        border-radius: 20px 20px 0 0;
    }

    .panel-header:active {
        cursor: grabbing;
    }

    .drag-title {
        font-size: 13px;
        font-weight: 600;
        display: flex;
        align-items: center;
        gap: 8px;
        color: var(--text-muted);
    }

    .btn-collapse {
        background: transparent;
        border: none;
        color: var(--text-muted);
        width: 28px;
        height: 28px;
        border-radius: 6px;
        display: flex;
        align-items: center;
        justify-content: center;
        cursor: pointer;
    }

    .btn-collapse:hover {
        background: rgba(255, 255, 255, 0.1);
        color: white;
    }

    .panel-body {
        padding: 16px;
        flex-direction: column;
        gap: 20px;
        max-height: 600px;
    }

    .tool-panel.collapsed .panel-container {
        border-radius: 20px !important;
    }

    .tool-panel.collapsed .panel-body {
        padding: 0 !important;
        max-height: 0 !important;
        opacity: 0 !important;
        pointer-events: none !important;
        margin: 0 !important;
        overflow: hidden !important;
    }

    .tool-panel.collapsed {
        height: auto !important;
        min-height: 0 !important;
        padding-bottom: 0 !important;
        background: none !important;
        border: none !important;
        box-shadow: none !important;
    }

    .tool-panel.collapsed .panel-header {
        border-bottom: none;
        border-radius: 0;
        /* Let container handle rounding */
    }

    .bottom-tabs {
        flex-direction: column;
        gap: 8px;
    }

    .tab-item {
        flex-direction: row;
        justify-content: flex-start;
        width: 100%;
        padding: 12px;
    }

    .tab-item i {
        width: 20px;
        margin-right: 8px;
    }

    .slider-section {
        padding: 0;
        width: 100%;
    }

    .thumb-preview {
        display: none;
    }

    .floating-controls {
        position: absolute;
        /* FIXED: BELOW the panel on desktop */
        top: calc(100% + 16px);
        bottom: auto;
        left: 0;
        right: 0;
        justify-content: center;
    }

    /* Support for mobile toggle collapse */
    .tool-panel.mobile-collapsed {
        transform: translateY(calc(100% - 60px));
        opacity: 0.9;
    }

    .tool-panel.mobile-collapsed #btnMobileToggle {
        transform: rotate(180deg);
    }

    .presets-grid {
        display: grid;
        grid-template-columns: repeat(3, 1fr);
        gap: 8px;
        overflow-x: visible;
    }
}

.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(5px);
    display: flex;
    align-items: flex-end;
    justify-content: center;
    z-index: 300;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s;
}

.modal-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

.modal-content {
    background: #18181b;
    border: 1px solid var(--border);
    border-radius: 24px 24px 0 0;
    width: 100%;
    max-width: 500px;
    padding: 24px;
    transform: translateY(100%);
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

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

@media (min-width: 769px) {
    .modal-content {
        border-radius: 24px;
        margin-bottom: 40px;
    }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 24px;
}

.modal-title {
    font-size: 20px;
    font-weight: 700;
    color: white;
}

.export-tabs {
    display: flex;
    padding: 4px;
    background: rgba(0, 0, 0, 0.3);
    margin-bottom: 20px;
    border-radius: 12px;
}

.export-tab {
    flex: 1;
    padding: 10px;
    border: none;
    background: transparent;
    color: var(--text-muted);
    font-weight: 600;
    cursor: pointer;
    border-radius: 10px;
    transition: all 0.2s;
}

.export-tab.active {
    background: var(--accent);
    color: white;
}

.aspect-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
    margin-bottom: 20px;
}

.aspect-btn {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 12px 0;
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
}

.aspect-btn.active {
    border-color: var(--accent);
    color: white;
    background: rgba(139, 92, 246, 0.1);
}

.aspect-rect {
    border: 2px solid currentColor;
    border-radius: 2px;
    opacity: 0.8;
}

.btn-render {
    width: 100%;
    padding: 16px;
    background: var(--text);
    color: black;
    border: none;
    border-radius: 16px;
    font-weight: 700;
    font-size: 16px;
    cursor: pointer;
    margin-top: 10px;
}

.progress-overlay {
    position: absolute;
    inset: 0;
    background: rgba(9, 9, 11, 0.95);
    z-index: 10;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
}

.progress-overlay.visible {
    opacity: 1;
    pointer-events: auto;
}

.toast {
    position: fixed;
    top: 80px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(20, 20, 20, 0.9);
    border: 1px solid var(--border);
    color: white;
    padding: 10px 24px;
    border-radius: 99px;
    font-weight: 500;
    z-index: 500;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.3s, transform 0.3s;
}

.toast.visible {
    opacity: 1;
    transform: translate(-50%, 10px);
}

.brush-cursor {
    position: fixed;
    top: 0;
    left: 0;
    pointer-events: none;
    z-index: 1000;
    border: 1.5px solid rgba(255, 255, 255, 0.9);
    background: rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    display: none;
    will-change: transform, width, height;
    box-shadow: 0 0 4px rgba(0, 0, 0, 0.8), inset 0 0 4px rgba(0, 0, 0, 0.2);
}

.brush-cursor.visible {
    display: block;
}

/* --- LOADING SPINNER --- */
@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.spinner {
    width: 18px;
    height: 18px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    display: inline-block;
}

.btn-help-floating {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: rgba(20, 20, 20, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    z-index: 200;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    transition: all 0.2s;
}

.btn-help-floating:hover {
    background: rgba(255, 255, 255, 0.1);
    transform: scale(1.05);
}

@media (max-width: 768px) {
    .btn-help-floating {
        display: none !important;
    }

    .header-left {
        display: flex !important;
    }
}

/* Styles Grid styles */
.styles-grid {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.style-card {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px;
    background: rgba(255, 255, 255, 0.05);
    border: 2px solid transparent;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s;
    text-align: left;
}

.style-card:hover {
    background: rgba(255, 255, 255, 0.08);
}

.style-card.active {
    border-color: var(--accent);
    background: rgba(139, 92, 246, 0.15);
}

.style-icon {
    width: 56px;
    height: 56px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--accent);
}

.style-card.active .style-icon {
    background: var(--accent);
    color: white;
}

.style-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.style-name {
    font-size: 16px;
    font-weight: 600;
    color: white;
}

.style-desc {
    font-size: 13px;
    color: var(--text-muted);
}

/* Toggle Switch */
input:checked+.slider {
    background-color: var(--accent);
}

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

input:checked+.slider:before {
    transform: translateX(20px);
}

.slider:before {
    position: absolute;
    content: "";
    height: 16px;
    width: 16px;
    left: 4px;
    bottom: 4px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
}