/* ============================================================
   KARUSEL VISUAL EDITOR — Dark Studio Theme
   Tone: refined professional, luxury creative tool
   Fonts: DM Sans (UI) + DM Mono (values)
   Accent: warm amber/gold — premium creator tools energy
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=DM+Sans:ital,opsz,wght@0,9..40,300;0,9..40,400;0,9..40,500;0,9..40,600;1,9..40,300&family=DM+Mono:wght@400;500&display=swap');

:root {
    /* Core palette */
    --bg:           #0c0c0e;
    --surface-1:    #141418;
    --surface-2:    #1c1c22;
    --surface-3:    #242430;

    /* Borders */
    --border-subtle: rgba(255,255,255,0.06);
    --border-mid:    rgba(255,255,255,0.12);
    --border-strong: rgba(255,255,255,0.22);

    /* Accent — states */
    --accent:       #f5a623;
    --accent-dim:   rgba(245, 166, 35, 0.15);
    --accent-edit:  #f5a623; /* Same as amber for main selection */
    --accent-edit-dim: rgba(245, 166, 35, 0.15);
    --accent-pan:   #3b82f6; /* Bright Blue */
    --accent-pan-dim: rgba(59, 130, 246, 0.15);
    --accent-crop:  #ef4444; /* Bright Red */
    --accent-crop-dim: rgba(239, 68, 68, 0.15);

    /* Text */
    --text-1:   #f4f4f6;
    --text-2:   #9898a8;
    --text-3:   #55556a;

    /* Indicators: Progress & Index */
    --font-mono: 'DM Mono', monospace;

    /* Shadows */
    --shadow-sm:  0 2px 8px rgba(0,0,0,0.4);
    --shadow-md:  0 8px 24px rgba(0,0,0,0.5);
    --shadow-lg:  0 20px 50px rgba(0,0,0,0.7);

    /* Motion */
    --spring: cubic-bezier(0.16, 1, 0.3, 1);
    --trans: all 0.25s var(--spring);
}

* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }

html, body {
    overflow: hidden;
    height: 100%;
    max-height: 100dvh;
    position: fixed;
    width: 100%;
}

body {
    background: var(--bg);
    display: flex;
    flex-direction: column;
    font-family: 'DM Sans', system-ui, sans-serif;
    color: var(--text-1);
    container-type: size;
    /* Subtle noise texture */
    background-image:
        url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.03'/%3E%3C/svg%3E"),
        radial-gradient(ellipse 80% 60% at 50% 0%, rgba(245,166,35,0.05) 0%, transparent 65%);
}



/* ─── Header ─────────────────────────────────────────────── */
header {
    flex: 0 0 54px;
    padding: 0 16px;
    background: rgba(12, 12, 14, 0.9);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border-bottom: 1px solid var(--border-subtle);
    display: flex;
    align-items: center;
    justify-content: space-between;
    z-index: 100;
}

.header-title {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-2);
    letter-spacing: 0.02em;
}

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

.back-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-2);
    text-decoration: none;
    padding: 6px 10px;
    border-radius: 8px;
    transition: var(--trans);
    border: 1px solid transparent;
}
.back-btn:hover {
    color: var(--text-1);
    background: var(--surface-2);
    border-color: var(--border-subtle);
}
.back-btn svg { width: 16px; height: 16px; stroke-width: 2; }

.save-project-btn {
    width: 86px;
    min-height: 34px;
    border: 1px solid rgba(245, 166, 35, 0.35);
    border-radius: 8px;
    background: rgba(245, 166, 35, 0.12);
    color: var(--text-1);
    font: inherit;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    transition: var(--trans);
}

.save-project-btn:hover {
    background: rgba(245, 166, 35, 0.2);
    border-color: rgba(245, 166, 35, 0.55);
}

.save-project-btn:disabled {
    cursor: wait;
    opacity: 0.6;
}

.save-template-btn {
    width: 34px;
    min-height: 34px;
    border: 1px solid var(--border-mid);
    border-radius: 8px;
    background: var(--surface-2);
    color: var(--text-1);
    font: inherit;
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
    transition: var(--trans);
}

.save-template-btn:hover {
    border-color: rgba(245, 166, 35, 0.55);
    background: rgba(245, 166, 35, 0.12);
}

/* ─── Carousel View ───────────────────────────────────────── */
.carousel-view-container {
    flex: 1;
    position: relative;
    overflow: hidden;
    height: 100dvh;
    display: flex;
    align-items: center;
    overscroll-behavior: none;
}


.carousel-strip {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    overflow-x: auto;
    overflow-y: hidden;
    scroll-snap-type: x mandatory;
    gap: 32px;
    scrollbar-width: none;
    overscroll-behavior-x: none;
}

/* LOCK STRIP DURING EDITING */
body.is-editing .carousel-strip {
    scroll-snap-type: none !important;
    overflow: hidden !important;
}

body.is-editing .card-wrapper {
    scroll-snap-align: none !important;
}

.carousel-strip::-webkit-scrollbar { display: none; }

/* ─── Card Wrapper ────────────────────────────────────────── */
.card-wrapper {
    position: relative;
    scroll-snap-align: center;
    opacity: 0.35;
    transform: scale(0.82);
    filter: blur(1px);
    flex-shrink: 0;
    transition: opacity 0.35s var(--spring), transform 0.35s var(--spring), filter 0.35s var(--spring);
    display: flex;
    align-items: center;
    justify-content: center;
}
.card-wrapper.active {
    opacity: 1;
    transform: scale(1);
    filter: none;
    z-index: 10;
}

/* ─── Floating Toolbars ───────────────────────────────────── */
.floating-bar {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(20, 20, 24, 0.92);
    backdrop-filter: blur(20px) saturate(150%);
    -webkit-backdrop-filter: blur(20px) saturate(150%);
    border: 1px solid var(--border-mid);
    border-radius: 14px;
    display: flex;
    align-items: center;
    gap: 2px;
    padding: 6px 10px;
    box-shadow: var(--shadow-md), 0 0 0 0.5px rgba(255,255,255,0.04) inset;
    z-index: 20;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.15s ease;
    color: var(--text-1);
}
.card-wrapper.active .floating-bar {
    pointer-events: auto;
    opacity: 1;
    transform: translateX(-50%);
}
.card-wrapper.active .text-format-bar { opacity: 0; pointer-events: none; }

.bar-top { top: -58px; }
.bar-bottom { bottom: -58px; }

.floating-btn {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-2);
    padding: 7px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.18s ease;
    border-radius: 8px;
}
.floating-btn:hover {
    color: var(--text-1);
    background: var(--surface-3);
}
.floating-btn.active {
    color: var(--accent);
    background: var(--accent-dim);
}
.floating-btn svg { width: 18px; height: 18px; stroke-width: 1.8px; }
.text-format-bar .crop-radius-slider {
    width: calc(var(--editor-card-width) * 0.24);
    min-width: calc(var(--editor-card-width) * 0.24);
    max-width: calc(var(--editor-card-width) * 0.24);
    flex: 0 0 calc(var(--editor-card-width) * 0.24);
}
.text-format-bar .media-edge-slider {
    width: calc(var(--editor-card-width) * 0.24);
    min-width: calc(var(--editor-card-width) * 0.24);
    max-width: calc(var(--editor-card-width) * 0.24);
    flex: 0 0 calc(var(--editor-card-width) * 0.24);
}
.text-format-bar {
    width: max-content;
    max-width: min(calc(var(--editor-card-width) + 5rem), calc(100vw - 2rem));
    overflow-x: auto;
    scrollbar-width: none;
}
.text-format-bar::-webkit-scrollbar {
    display: none;
}
.bg-edit-bar .bg-control-slider {
    width: calc(var(--editor-card-width) * 0.24);
    min-width: calc(var(--editor-card-width) * 0.24);
    max-width: calc(var(--editor-card-width) * 0.24);
    flex: 0 0 calc(var(--editor-card-width) * 0.24);
}
.bg-edit-bar {
    width: max-content;
    max-width: min(calc(var(--editor-card-width) + 5rem), calc(100vw - 2rem));
    overflow-x: auto;
    scrollbar-width: none;
}
.bg-edit-bar::-webkit-scrollbar {
    display: none;
}
.bg-edit-bar .floating-btn.active {
    color: var(--accent);
    background: var(--accent-dim);
}

/* ─── Canvas Card ─────────────────────────────────────────── */
.canvas-card {
    width: 100%;
    height: 100%;
    position: relative;
    background: #0f1e5a;
    border-radius: 12px;
    overflow: hidden;
    box-shadow:
        var(--shadow-lg),
        0 0 0 1px rgba(255,255,255,0.06) inset;
    container-type: size;
}
.bg-mask-container {
    position: absolute;
    inset: 0;
    overflow: hidden;
    z-index: 0;
    background: transparent;
}
.slide-bg-element {
    position: absolute;
    max-width: none;
    max-height: none;
    object-fit: fill;
    transform-origin: center;
    will-change: transform, filter;
}
.bg-overlay {
    position: absolute;
    inset: 0;
    pointer-events: none;
}
.bg-texture-overlay {
    position: absolute;
    inset: 0;
    z-index: 1;
    pointer-events: none;
    background-repeat: repeat;
}

/* ─── Safe Area & Regions ─────────────────────────────────── */
.safe-area-overlay {
    position: absolute;
    pointer-events: none;
    border: 1px dashed rgba(255,255,255,0.2);
    z-index: 100;
}

.reserved-region {
    position: absolute;
    left: 0;
    width: 100%;
    height: 12.5%;
    background: rgba(0,0,0,0.35);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    color: rgba(255,255,255,0.85);
    font-size: 13px;
    font-weight: 500;
    z-index: 50;
    pointer-events: none;
    text-align: center;
    padding: 0 10px;
    font-family: 'DM Sans', sans-serif;
}
.region-header { top: 0; border-bottom: 1px dashed rgba(255,255,255,0.15); }
.region-footer { bottom: 0; border-top: 1px dashed rgba(255,255,255,0.15); }

/* ─── Layers ──────────────────────────────────────────────── */
/* Lock scroll for mobile while editing */
html,
body {
    position: fixed;
    overflow: hidden;
    overflow-x: clip; /* clip strictly blocks scrollLeft */
    width: 100%;
    height: 100%;
    max-width: 100vw;
}
.layer {
    position: absolute;
    outline: none;
    cursor: move;
    touch-action: none;
    user-select: none;
}
.layer.active-layer::after {
    content: '';
    position: absolute;
    inset: -1px;
    border: 2px solid var(--accent);
    border-radius: inherit;
    pointer-events: none;
    z-index: 10;
    box-shadow: 0 0 10px rgba(0,0,0,0.3);
}
.layer.is-dragging::after,
.layer.is-resizing::after {
    border-color: #f97316 !important; /* Orange for move/resize */
    box-shadow: 0 0 15px rgba(249, 115, 22, 0.4);
}
.layer.is-editing::after {
    border-color: #3b82f6 !important; /* Blue for editing */
    box-shadow: 0 0 15px rgba(59, 130, 246, 0.4);
}
.layer.is-pan-zoom::after {
    content: '';
    position: absolute;
    inset: -1px;
    border: 2px solid var(--accent-pan);
    border-color: var(--accent-pan);
    border-radius: inherit;
    pointer-events: none;
    z-index: 10;
    box-shadow: 0 0 0 3px var(--accent-pan-dim);
}
.layer.is-cropping::after {
    content: '';
    position: absolute;
    inset: -1px;
    border: 2px solid var(--accent-crop);
    border-radius: inherit;
    pointer-events: none;
    z-index: 10;
    box-shadow: 0 0 0 3px var(--accent-crop-dim);
}
/* Original container bounds during crop */
.layer.is-cropping {
    outline: 1.5px dashed var(--accent-crop);
    outline-offset: 1px;
    z-index: 100 !important;
}
.editor-center-guides {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 25;
}
.editor-center-guide {
    position: absolute;
    opacity: 0;
    transition: opacity 0.16s ease;
    box-shadow: 0 0 10px rgba(14,165,233,0.18);
}
.editor-center-guide.is-visible {
    opacity: 1;
}
.editor-center-guide.is-vertical {
    top: 0;
    bottom: 0;
    left: 50%;
    width: 1px;
    transform: translateX(-50%);
    background: repeating-linear-gradient(
        to bottom,
        rgba(14,165,233,0.9) 0 6px,
        rgba(14,165,233,0) 6px 12px
    );
}
.editor-center-guide.is-left-edge {
    left: 5%;
    transform: none;
}
.editor-center-guide.is-right-edge {
    left: auto;
    right: 5%;
    transform: none;
}
.editor-center-guide.is-horizontal {
    left: 0;
    right: 0;
    top: 50%;
    height: 1px;
    transform: translateY(-50%);
    background: repeating-linear-gradient(
        to right,
        rgba(14,165,233,0.9) 0 6px,
        rgba(14,165,233,0) 6px 12px
    );
}
.editor-center-guide.is-top-edge {
    top: 5%;
    transform: none;
}
.editor-center-guide.is-bottom-edge {
    top: auto;
    bottom: 5%;
    transform: none;
}

/* Layer Handles */
.layer-handle {
    position: absolute;
    width: 12px;
    height: 12px;
    background: #fff;
    border: 2.5px solid var(--accent);
    border-radius: 50%;
    z-index: 100;
    pointer-events: none;
    box-shadow: 0 2px 6px rgba(0,0,0,0.3);
    transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.layer.is-pan-zoom .layer-handle,
.layer.is-editing .layer-handle {
    border-color: var(--accent-pan);
}
.layer.is-cropping .layer-handle { border-color: var(--accent-crop); }

.handle-tl { top: -6px; left: -6px; }
.handle-tr { top: -6px; right: -6px; }
.handle-bl { bottom: -6px; left: -6px; }
.handle-br { bottom: -6px; right: -6px; }

.layer.is-editing {
    z-index: 101 !important;
}

.text-layer {
    padding: 8px;
    color: white;
    min-width: 50px;
    min-height: 40px;
    font-size: 20px;
    white-space: pre-line;
    word-wrap: break-word;
    overflow-wrap: break-word;
    font-weight: 500;
    user-select: none;
    line-height: 1.3;
    display: block;
}

.layer[data-type="text"] {
    font-size: inherit;
    font-weight: inherit;
    font-style: inherit;
    color: inherit;
    line-height: inherit;
    paint-order: stroke fill;
}
.layer-text-content {
    display: block;
    width: 100%;
    margin: 0;
    padding: 0;
}
.layer[data-type="text"][data-text-mask="true"]:not(.is-editing) .layer-text-content {
    opacity: 0;
}
.layer[data-type="text"][data-text-mask="true"]:not(.is-editing) .custom-highlight::before {
    opacity: 0;
}
.text-mask-preview {
    position: absolute;
    inset: 0;
    overflow: hidden;
    pointer-events: none;
    z-index: 1;
    -webkit-mask-image: var(--text-mask-svg);
    mask-image: var(--text-mask-svg);
    -webkit-mask-repeat: no-repeat;
    mask-repeat: no-repeat;
    -webkit-mask-size: 100% 100%;
    mask-size: 100% 100%;
    -webkit-mask-position: center;
    mask-position: center;
}
.layer.is-editing .text-mask-preview {
    display: none;
}
.text-layer.is-editing .layer-text-content {
    pointer-events: auto;
}
.text-layer.is-editing {
    cursor: text;
    user-select: text;
    background: rgba(0,0,0,0.4);
    backdrop-filter: blur(4px);
}

/* ─── Custom Text Highlight Marks ─────────────────────────── */
.text-layer .custom-highlight {
    display: inline !important;
    color: inherit;
    line-height: inherit;
    vertical-align: baseline;
    box-decoration-break: clone;
    -webkit-box-decoration-break: clone;
    position: relative;
    isolation: isolate;
    padding: 0 !important;
    margin: 0 !important;
    background: transparent !important;
}

.text-layer .custom-highlight::before {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    pointer-events: none;
    z-index: -1;
    background: transparent;
}

.custom-highlight[data-shape="rect"]::before {
    top: calc(-1 * var(--hl-pad-y, 0.1em));
    right: calc(-1 * var(--hl-pad-x, 0.25em));
    bottom: calc(-1 * var(--hl-pad-y, 0.1em));
    left: calc(-1 * var(--hl-pad-x, 0.25em));
    border-radius: var(--hl-radius, 0);
    background-color: var(--hl-color, #ffffff);
}

.custom-highlight[data-shape="round"]::before {
    top: calc(-1 * var(--hl-pad-y, 0.15em));
    right: calc(-1 * var(--hl-pad-x, 0.5em));
    bottom: calc(-1 * var(--hl-pad-y, 0.15em));
    left: calc(-1 * var(--hl-pad-x, 0.5em));
    border-radius: var(--hl-radius, 1em);
    background-color: var(--hl-color, #ffffff);
}

.custom-highlight[data-shape="skew-left"]::before,
.custom-highlight[data-shape="skew-right"]::before {
    top: calc(-1 * var(--hl-pad-y, 0.15em));
    right: calc(-1 * (var(--hl-pad-x, 0.5em) + 1em));
    bottom: calc(-1 * var(--hl-pad-y, 0.15em));
    left: calc(-1 * (var(--hl-pad-x, 0.5em) + 1em));
    border-radius: 0;
    background-color: var(--hl-color, #ffffff);
}

.custom-highlight[data-shape="skew-left"]::before {
    transform: skewX(var(--hl-skew, -20deg));
}

.custom-highlight[data-shape="skew-right"]::before {
    transform: skewX(var(--hl-skew, 20deg));
}

.shape-btn {
    flex: 1;
    text-align: center;
    background: var(--surface-2);
    color: var(--text-2);
    padding: 8px 0;
    cursor: pointer;
    border: 1.5px solid var(--border-subtle);
    transition: 0.2s;
    font-size: 12px;
    font-weight: 600;
    border-radius: 6px;
    font-family: 'DM Sans', sans-serif;
}
.shape-btn.active {
    border-color: var(--accent);
    color: var(--accent);
    background: var(--accent-dim);
}

.p-slider { width: 100%; margin-top: 5px; cursor: pointer; accent-color: var(--accent); }
.p-row { display: flex; align-items: center; justify-content: space-between; margin-top: 8px; font-size: 12px; color: var(--text-2); }

/* ─── Media Layers ────────────────────────────────────────── */
.image-layer, .video-layer {
    overflow: hidden;
    background: var(--surface-2);
    display: flex;
    align-items: center;
    justify-content: center;
}
.image-layer img, .video-layer video {
    position: absolute;
    max-width: none;
    pointer-events: none;
    transform-origin: center;
}
.image-layer.is-pan-zoom, .video-layer.is-pan-zoom { cursor: grab; }
.image-layer.is-pan-zoom:active, .video-layer.is-pan-zoom:active { cursor: grabbing; }
.layer-img-inner, .layer-video-inner { pointer-events: none; }
.layer.is-pan-zoom .layer-img-inner, .layer.is-pan-zoom .layer-video-inner { pointer-events: auto; }
.media-placeholder-inner,
.bg-media-placeholder {
    width: 100%;
    height: 100%;
    border: 1px dashed rgba(255,255,255,0.35);
    background:
        linear-gradient(135deg, rgba(255,255,255,0.08), rgba(255,255,255,0.02)),
        repeating-linear-gradient(45deg, rgba(255,255,255,0.07) 0 8px, transparent 8px 16px);
    color: rgba(255,255,255,0.86);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    font: inherit;
    text-align: center;
    cursor: pointer;
}
.media-placeholder-inner span,
.bg-media-placeholder span {
    font-size: 13px;
    font-weight: 800;
}
.media-placeholder-inner small,
.bg-media-placeholder small {
    font-size: 10px;
    color: rgba(255,255,255,0.58);
}
.layer-media-viewport.has-edge-fade {
    -webkit-mask-image:
        linear-gradient(to right, transparent 0%, #000 var(--media-edge-fade), #000 calc(100% - var(--media-edge-fade)), transparent 100%),
        linear-gradient(to bottom, transparent 0%, #000 var(--media-edge-fade), #000 calc(100% - var(--media-edge-fade)), transparent 100%);
    mask-image:
        linear-gradient(to right, transparent 0%, #000 var(--media-edge-fade), #000 calc(100% - var(--media-edge-fade)), transparent 100%),
        linear-gradient(to bottom, transparent 0%, #000 var(--media-edge-fade), #000 calc(100% - var(--media-edge-fade)), transparent 100%);
    -webkit-mask-repeat: no-repeat;
    mask-repeat: no-repeat;
    -webkit-mask-size: 100% 100%;
    mask-size: 100% 100%;
    -webkit-mask-composite: source-in;
    mask-composite: intersect;
}

/* ─── Add Slide Button ────────────────────────────────────── */
.add-slide-trigger {
    flex-shrink: 0;
    width: 40px;
    height: 40px;
    background: var(--surface-2);
    border-radius: 50%;
    border: 1px solid var(--border-mid);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--trans);
    z-index: 5;
}
.add-slide-trigger:hover {
    background: var(--accent);
    border-color: var(--accent);
    transform: scale(1.1);
    box-shadow: 0 0 16px rgba(245,166,35,0.4);
}
.add-slide-trigger svg { width: 20px; height: 20px; color: var(--text-2); pointer-events: none; transition: color 0.2s; }
.add-slide-trigger:hover svg { color: #000; }

/* ─── Bottom Nav ──────────────────────────────────────────── */
.bottom-nav {
    flex: 0 0 62px;
    display: flex;
    background: var(--surface-1);
    border-top: 1px solid var(--border-subtle);
    z-index: 200;
    padding-bottom: env(safe-area-inset-bottom);
}

.nav-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    cursor: pointer;
    font-size: 10px;
    font-weight: 500;
    letter-spacing: 0.02em;
    transition: all 0.18s ease;
    color: var(--text-3);
    position: relative;
}
.nav-item:hover {
    color: var(--text-2);
    background: rgba(255,255,255,0.03);
}
.nav-item svg {
    width: 22px;
    height: 22px;
    stroke-width: 1.6;
    color: inherit;
    transition: transform 0.2s var(--spring);
}
.nav-item:hover svg { transform: translateY(-1px); }
.nav-item.active {
    color: var(--accent);
}
.nav-item.active svg { color: var(--accent); }

/* Export button — accent highlight */
.nav-item-export {
    color: var(--accent);
    position: relative;
}
.nav-item-export::before {
    content: '';
    position: absolute;
    top: 0;
    left: 20%;
    right: 20%;
    height: 2px;
    background: var(--accent);
    border-radius: 0 0 2px 2px;
    box-shadow: 0 0 8px var(--accent);
}
.nav-item-export svg { stroke-width: 2; }

/* ─── Bottom Sheet ────────────────────────────────────────── */
.bottom-sheet {
    position: fixed;
    bottom: -420px;
    left: 0;
    width: 100%;
    max-height: 420px;
    height: auto;
    min-height: 260px;
    background: rgba(20, 20, 24, 0.95);
    backdrop-filter: blur(24px) saturate(180%);
    -webkit-backdrop-filter: blur(24px) saturate(180%);
    color: var(--text-1);
    z-index: 1500;
    border-radius: 20px 20px 0 0;
    padding: 0 20px 20px;
    box-shadow:
        0 -20px 60px rgba(0,0,0,0.7),
        0 0 0 0.5px rgba(255,255,255,0.06) inset;
    border-top: 1px solid var(--border-mid);
    transition: bottom 0.35s var(--spring);
    display: flex;
    flex-direction: column;
}
.bottom-sheet.open { bottom: 62px; }

/* Sheet drag strip */
.bottom-sheet::before {
    content: '';
    display: block;
    width: 36px;
    height: 4px;
    background: var(--border-strong);
    border-radius: 2px;
    margin: 12px auto 0;
    flex-shrink: 0;
}

.sheet-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: 16px 0 16px;
    flex: 0 0 auto;
}
.sheet-title {
    font-weight: 600;
    font-size: 16px;
    color: var(--text-1);
    letter-spacing: -0.01em;
}
.close-sheet {
    background: var(--surface-3);
    border: 1px solid var(--border-subtle);
    font-size: 16px;
    cursor: pointer;
    color: var(--text-2);
    line-height: 1;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: 0.2s;
}
.close-sheet:hover {
    color: var(--text-1);
    background: var(--surface-3);
    border-color: var(--border-mid);
}
.sheet-content {
    flex: 1;
    overflow-y: auto;
    padding-bottom: 20px;
    scrollbar-width: thin;
    scrollbar-color: var(--border-mid) transparent;
}

.editor-toast {
    position: fixed;
    left: 50%;
    bottom: 88px;
    transform: translateX(-50%) translateY(12px);
    width: min(calc(100vw - 32px), 420px);
    padding: 12px 14px;
    border-radius: 14px;
    border: 1px solid var(--border-mid);
    background: rgba(20, 20, 24, 0.96);
    color: var(--text-1);
    font-size: 13px;
    font-weight: 500;
    line-height: 1.4;
    text-align: center;
    box-shadow: var(--shadow-md);
    opacity: 0;
    pointer-events: none;
    z-index: 300;
    transition: opacity 0.2s ease, transform 0.2s ease;
}
.editor-toast.visible {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

/* ─── Sheet Controls ──────────────────────────────────────── */
.setting-group { margin-bottom: 20px; }
.setting-group label {
    display: block;
    font-size: 11px;
    font-weight: 600;
    margin-bottom: 10px;
    color: var(--text-3);
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.ratio-grid { display: flex; gap: 6px; flex-wrap: wrap; }
.ratio-btn {
    flex: 1;
    min-width: 56px;
    padding: 10px 0;
    border: 1px solid var(--border-subtle);
    border-radius: 10px;
    background: var(--surface-2);
    cursor: pointer;
    font-weight: 600;
    font-size: 13px;
    color: var(--text-2);
    transition: all 0.18s ease;
    font-family: 'DM Sans', sans-serif;
}
.ratio-btn:hover {
    background: var(--surface-3);
    color: var(--text-1);
    border-color: var(--border-mid);
}
.ratio-btn.active {
    border-color: var(--accent);
    color: var(--accent);
    background: var(--accent-dim);
}

input[type="range"] { width: 100%; accent-color: var(--accent); }
.bg-mode-switch {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 8px;
    margin: 0 0 18px;
}

.bg-mode-btn {
    height: 42px;
    border: 1px solid transparent;
    border-radius: 20px;
    background: var(--surface-2);
    color: var(--text-2);
    font: inherit;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.18s ease;
}

.bg-mode-btn.active {
    background: #ffffff;
    color: #141418;
}

.bg-mode-btn:not(.active):hover {
    background: var(--surface-3);
    color: var(--text-1);
}

.bg-sheet-panel {
    padding-top: 2px;
}

.gradient-grid {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    gap: 12px;
    padding: 4px 0 10px;
}

.bg-color-grid {
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 12px;
    padding: 4px 0 10px;
}

.bg-color-swatch {
    width: 100%;
    aspect-ratio: 1;
    min-width: 0;
    border: 1.5px solid var(--border-subtle);
    border-radius: 50%;
    cursor: pointer;
    transition: transform 0.16s ease, border-color 0.16s ease, box-shadow 0.16s ease;
}

.bg-color-swatch:hover,
.bg-color-swatch.active {
    transform: translateY(-2px);
    border-color: var(--accent);
    box-shadow: 0 0 0 2px var(--accent-dim);
}

.gradient-swatch {
    width: 100%;
    aspect-ratio: 1;
    min-width: 0;
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 10px;
    cursor: pointer;
    box-shadow: inset 0 0 0 1px rgba(0,0,0,0.08);
    transition: transform 0.16s ease, border-color 0.16s ease, box-shadow 0.16s ease;
}

.gradient-swatch:hover {
    transform: translateY(-2px);
    border-color: rgba(255,255,255,0.42);
    box-shadow: 0 8px 18px rgba(0,0,0,0.28), inset 0 0 0 1px rgba(255,255,255,0.16);
}

.gradient-swatch:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

.texture-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 10px;
}

.texture-card {
    min-width: 0;
    border: 1px solid var(--border-subtle);
    border-radius: 8px;
    background: var(--surface-2);
    color: var(--text-2);
    cursor: pointer;
    overflow: hidden;
    transition: all 0.18s ease;
}

.texture-card.active,
.texture-card:hover {
    border-color: var(--accent);
    color: var(--text-1);
    background: var(--surface-3);
}

.texture-card.active {
    box-shadow: 0 0 0 1px var(--accent);
}

.texture-preview {
    height: 62px;
    border-bottom: 1px solid var(--border-subtle);
    background-color: #18181d;
    background-repeat: repeat;
}

.texture-name {
    padding: 7px 5px;
    font-size: 10px;
    font-weight: 700;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.texture-controls {
    margin-top: 14px;
    padding: 12px;
    border: 1px solid var(--border-subtle);
    border-radius: 8px;
    background: var(--surface-2);
}

.bg-apply-all-btn {
    width: 100%;
    min-height: 40px;
    margin: 8px 0 14px;
    border: 1px solid var(--border-mid);
    border-radius: 8px;
    background: var(--surface-2);
    color: var(--text-2);
    font: inherit;
    font-size: 12px;
    font-weight: 800;
    cursor: pointer;
    transition: all 0.18s ease;
}

.bg-apply-all-btn:hover,
.bg-apply-all-btn.active {
    border-color: var(--accent);
    color: var(--accent);
    background: var(--accent-dim);
}

.texture-control-row {
    display: grid;
    grid-template-columns: 92px 1fr 42px;
    gap: 10px;
    align-items: center;
    margin-bottom: 12px;
    color: var(--text-2);
    font-size: 12px;
    font-weight: 700;
}

.texture-control-row:last-child {
    margin-bottom: 0;
}

.texture-control-row span:last-child {
    color: var(--text-3);
    font-family: var(--font-mono);
    font-size: 11px;
    text-align: right;
}

.texture-color-grid {
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    gap: 8px;
    margin-top: 10px;
}

.texture-color-btn {
    width: 100%;
    aspect-ratio: 1;
    border: 1.5px solid var(--border-subtle);
    border-radius: 50%;
    cursor: pointer;
}

.texture-color-btn.active {
    border-color: var(--accent);
    box-shadow: 0 0 0 2px var(--accent-dim);
}

.toggle-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 0;
    border-bottom: 1px solid var(--border-subtle);
    font-weight: 500;
    color: var(--text-2);
    font-size: 14px;
}
.slider-wrap {
    display: flex;
    gap: 12px;
    align-items: center;
}
.slider-wrap span {
    font-family: 'DM Mono', monospace;
    font-weight: 500;
    min-width: 38px;
    font-size: 12px;
    color: var(--accent);
    text-align: right;
}

.text-input {
    width: 100%;
    padding: 12px 14px;
    border: 1px solid var(--border-mid);
    border-radius: 10px;
    font-family: 'DM Sans', sans-serif;
    margin-top: 8px;
    font-size: 14px;
    background: var(--surface-2);
    color: var(--text-1);
}
.text-input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-dim);
}

.hints { font-size: 12px; color: var(--text-3); line-height: 1.5; }

/* ─── Templates Grid ──────────────────────────────────────── */
.templates-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(92px, 1fr));
    gap: 10px;
}

.template-actions {
    margin-bottom: 14px;
}

.template-section-title {
    margin: 16px 0 10px;
    color: var(--text-2);
    font-size: 12px;
    font-weight: 700;
}

.template-empty {
    padding: 12px;
    border: 1px solid var(--border-subtle);
    border-radius: 8px;
    color: var(--text-3);
    font-size: 12px;
    text-align: center;
    background: var(--surface-2);
}

.template-folder-tools {
    display: grid;
    gap: 10px;
    margin-bottom: 14px;
}

.template-folder-list {
    display: grid;
    gap: 8px;
}

.template-folder-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 8px 10px;
    border: 1px solid var(--border-subtle);
    border-radius: 8px;
    background: var(--surface-2);
    color: var(--text-2);
    font-size: 12px;
}

.template-folder-row button {
    width: 24px;
    height: 24px;
    border: 1px solid var(--border-mid);
    border-radius: 6px;
    background: var(--surface-3);
    color: var(--text-1);
    cursor: pointer;
}

.template-card {
    border-radius: 10px;
    overflow: hidden;
    border: 1.5px solid var(--border-subtle);
    cursor: pointer;
    transition: all 0.22s var(--spring);
    background: var(--surface-2);
}
.template-card:hover {
    border-color: var(--accent);
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(0,0,0,0.4), 0 0 0 1px var(--accent);
}
.template-card img {
    width: 100%;
    aspect-ratio: 3/4;
    object-fit: cover;
    display: block;
    opacity: 0.9;
    transition: opacity 0.2s;
}
.template-card:hover img { opacity: 1; }
.template-card .tpl-name {
    padding: 7px 6px;
    font-size: 10px;
    font-weight: 600;
    text-align: center;
    color: var(--text-2);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    letter-spacing: 0.02em;
}

.template-card .template-meta {
    padding: 0 6px 7px;
    color: var(--text-3);
    font-size: 9px;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.smart-layout-grid {
    grid-template-columns: repeat(3, minmax(92px, 1fr));
}

.smart-layout-card {
    border-radius: 8px;
}

.smart-layout-preview {
    width: 100%;
    aspect-ratio: 100 / 133;
    display: block;
    background: var(--surface-3);
}

.smart-layout-bg {
    fill: var(--surface-3);
}

.smart-layout-title,
.smart-layout-body {
    fill: var(--text-1);
    font-family: 'DM Sans', system-ui, sans-serif;
    letter-spacing: 0;
}

.smart-layout-title {
    font-size: 11px;
    font-weight: 800;
}

.smart-layout-body {
    font-size: 8px;
    font-weight: 500;
    fill: var(--text-2);
}

.smart-layout-body-muted {
    opacity: 0.55;
}

.personal-template-card {
    position: relative;
}

.template-delete-btn {
    position: absolute;
    top: 6px;
    right: 6px;
    z-index: 2;
    width: 24px;
    height: 24px;
    border: 1px solid rgba(255,255,255,0.18);
    border-radius: 999px;
    background: rgba(0,0,0,0.55);
    color: var(--text-1);
    cursor: pointer;
}

.template-edit-btn {
    position: absolute;
    top: 6px;
    left: 6px;
    z-index: 2;
    width: 24px;
    height: 24px;
    border: 1px solid rgba(255,255,255,0.18);
    border-radius: 999px;
    background: rgba(0,0,0,0.55);
    color: var(--text-1);
    cursor: pointer;
}

.template-placeholder {
    width: 100%;
    aspect-ratio: 3/4;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--surface-3), var(--surface-1));
    color: var(--accent);
    font-size: 28px;
    font-weight: 800;
}

.template-modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 12000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 18px;
    background: rgba(0,0,0,0.72);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.template-modal {
    width: min(420px, 100%);
    border: 1px solid var(--border-mid);
    border-radius: 12px;
    background: var(--surface-1);
    box-shadow: var(--shadow-lg);
    overflow: hidden;
}

.template-modal-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    border-bottom: 1px solid var(--border-subtle);
    color: var(--text-1);
    font-weight: 700;
}

.template-modal-close {
    width: 30px;
    height: 30px;
    border: 1px solid var(--border-subtle);
    border-radius: 8px;
    background: var(--surface-2);
    color: var(--text-1);
    cursor: pointer;
    font-size: 18px;
}

.template-modal-body {
    display: grid;
    gap: 14px;
    padding: 16px;
}

.template-modal-field {
    display: grid;
    gap: 7px;
    color: var(--text-2);
    font-size: 12px;
    font-weight: 700;
}

.template-modal-field input,
.template-modal-field select {
    width: 100%;
    min-height: 40px;
    border: 1px solid var(--border-mid);
    border-radius: 8px;
    background: var(--surface-2);
    color: var(--text-1);
    padding: 0 10px;
    font: inherit;
}

.template-modal-check {
    display: flex;
    align-items: center;
    gap: 9px;
    color: var(--text-2);
    font-size: 13px;
}

.template-modal-text {
    color: var(--text-2);
    font-size: 13px;
    line-height: 1.45;
}

.template-modal-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    padding: 0 16px 16px;
}

/* Handles are now unified via .layer-handle in the .layer section */
.is-cropping { outline: 1.5px dashed var(--accent-crop); }

/* ─── Video Trimmer ───────────────────────────────────────── */
.canvas-container {
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
    border-radius: 4px;
    overflow: hidden;
    contain: layout style;
}

/* Native Text Editor Overlay (Pure DOM Mode) */
#text-editor-overlay {
    position: fixed;
    display: none;
    background: transparent !important;
    color: transparent !important;
    -webkit-text-fill-color: transparent !important;
    caret-color: white; /* Will be overridden in JS */
    border: none;
    outline: none;
    resize: none;
    overflow: hidden;
    z-index: 10000;
    padding: 0;
    margin: 0;
    line-height: inherit;
    font-size: 16px;
    transform-origin: top left;
    word-break: break-word;
    word-wrap: break-word;
    overflow-wrap: break-word;
    white-space: pre-line;
}

#text-editor-done-btn {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 10001;
    background: #6c5ce7;
    color: white;
    border: none;
    padding: 12px 32px;
    border-radius: 12px;
    font-weight: 600;
    font-size: 16px;
    box-shadow: 0 4px 15px rgba(108, 92, 231, 0.4);
    display: none;
    transition: transform 0.2s, background 0.2s;
}

#text-editor-done-btn:active {
    transform: translateX(-50%) scale(0.95);
    background: #5b4bc4;
}

.canvas-card {
    overflow: hidden;
}
.trimmer-timeline {
    border: 1px solid var(--border-mid);
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.2);
    border-radius: 6px;
    overflow: hidden;
}
.trim-handle {
    position: absolute;
    top: -5px;
    bottom: -5px;
    width: 12px;
    background: var(--accent);
    cursor: ew-resize;
    border-radius: 6px;
    box-shadow: 0 4px 12px rgba(245,166,35,0.5);
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
}
.trim-handle::after {
    content: '';
    width: 2px;
    height: 14px;
    background: rgba(0,0,0,0.4);
    border-radius: 1px;
}

/* Indicators: Progress & Index */
.slide-progress-wrap {
    position: absolute;
    bottom: 25px;
    left: 40px;
    right: 40px;
    height: 4px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    overflow: hidden;
    z-index: 5;
}

.slide-progress-fill {
    height: 100%;
    background: var(--accent);
    transition: width 0.3s ease;
}

.slide-index-indicator {
    position: absolute;
    bottom: 40px;
    right: 40px;
    font-size: 14px;
    font-weight: 600;
    opacity: 0.7;
    z-index: 5;
    font-family: 'DM Mono', monospace;
}

.setting-group-title {
    font-size: 11px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-3);
    margin: 24px 0 12px 0;
    padding-bottom: 6px;
    border-bottom: 1px solid var(--border-subtle);
}
/* ─── Layers List ─────────────────────────────────────────── */
.layers-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 15px;
    position: relative;
}

.media-library-panel {
    margin-top: 16px;
    border-top: 1px solid rgba(255,255,255,0.08);
    padding-top: 14px;
}
.media-library-head,
.media-folder-tools,
.media-library-upload-row,
.media-library-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}
.media-library-head {
    justify-content: space-between;
}
.media-library-add-folder,
.media-folder-tools button,
.media-library-upload-row button {
    border: 1px solid rgba(255,255,255,0.12);
    background: rgba(255,255,255,0.07);
    color: var(--text-1);
    border-radius: 8px;
    padding: 8px 10px;
    font-size: 12px;
}
.media-folder-strip {
    display: flex;
    overflow-x: auto;
    gap: 8px;
    padding: 8px 0 10px;
}
.media-folder-strip button {
    border: 1px solid rgba(255,255,255,0.12);
    background: rgba(255,255,255,0.05);
    color: var(--text-2);
    border-radius: 8px;
    padding: 8px 10px;
    font-size: 12px;
    white-space: nowrap;
}
.media-folder-strip button.active {
    color: #fff;
    border-color: rgba(255,255,255,0.3);
    background: rgba(255,255,255,0.13);
}
.media-folder-tools {
    justify-content: flex-start;
    margin-bottom: 10px;
}
.media-library-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
}
.media-library-item {
    min-width: 0;
}
.media-library-thumb {
    width: 100%;
    aspect-ratio: 1;
    max-height: 72px;
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 8px;
    overflow: hidden;
    background: rgba(255,255,255,0.05);
    position: relative;
    padding: 0;
}
.media-library-thumb img,
.media-library-thumb video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
.media-library-thumb span {
    position: absolute;
    left: 6px;
    bottom: 6px;
    padding: 3px 6px;
    border-radius: 6px;
    background: rgba(0,0,0,0.55);
    color: #fff;
    font-size: 9px;
    line-height: 1;
}
.media-library-actions {
    margin-top: 6px;
}
.media-library-actions select {
    min-width: 0;
    flex: 1;
    border: 1px solid rgba(255,255,255,0.12);
    background: rgba(15,15,18,0.95);
    color: var(--text-1);
    border-radius: 7px;
    padding: 6px;
    font-size: 11px;
}
.media-library-actions button {
    width: 28px;
    height: 28px;
    border-radius: 7px;
    border: 1px solid rgba(255,255,255,0.12);
    background: rgba(255,82,82,0.16);
    color: #ffb4b4;
    font-size: 18px;
    line-height: 1;
}
.media-library-empty {
    grid-column: 1 / -1;
    color: var(--text-3);
    font-size: 12px;
    text-align: center;
    padding: 16px 8px;
}
.media-library-upload-row {
    margin-top: 10px;
}

.upload-progress-overlay {
    position: fixed;
    inset: 0;
    z-index: 10000;
    display: none;
    align-items: center;
    justify-content: center;
    background: rgba(0,0,0,0.62);
    backdrop-filter: blur(12px);
}
.upload-progress-overlay.is-visible {
    display: flex;
}
.upload-progress-panel {
    width: min(310px, calc(100vw - 36px));
    border: 1px solid rgba(255,255,255,0.14);
    border-radius: 8px;
    background: rgba(18,18,22,0.96);
    padding: 22px;
    text-align: center;
    color: #fff;
}
.upload-progress-spinner {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    border: 3px solid rgba(255,255,255,0.16);
    border-top-color: #fff;
    margin: 0 auto 14px;
    animation: uploadSpin 0.9s linear infinite;
}
.upload-progress-title {
    font-size: 15px;
    font-weight: 800;
    margin-bottom: 6px;
}
.upload-progress-text {
    font-size: 12px;
    color: var(--text-3);
}
@keyframes uploadSpin {
    to { transform: rotate(360deg); }
}

.layers-sheet {
    transition: opacity 0.18s ease;
}

.layers-sheet.is-sorting {
    opacity: 0.3;
}

.layer-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    background: var(--surface-2);
    border: 1px solid var(--border-mid);
    border-radius: 12px;
    cursor: grab;
    transition: all 0.2s ease;
    user-select: none;
    touch-action: none;
}

.layer-item:hover {
    background: var(--surface-3);
    border-color: var(--accent);
}

.layer-item.active {
    border-color: var(--accent);
    background: var(--accent-dim);
}

.layers-sheet.is-sorting .setting-group-title,
.layers-sheet.is-sorting > div:first-child {
    opacity: 0.55;
}

.layers-list.is-sorting .layer-item:not(.is-floating) {
    opacity: 0.46;
    transform: scale(0.985);
}

.layer-item.is-floating {
    cursor: grabbing;
    background: rgba(36,36,48,0.96);
    border-color: var(--accent);
    box-shadow: 0 14px 36px rgba(0,0,0,0.42), 0 0 0 1px rgba(245,166,35,0.24);
    transform: scale(1.015);
}

.layer-placeholder {
    border-radius: 12px;
    border: 1.5px dashed rgba(245,166,35,0.45);
    background: rgba(245,166,35,0.08);
    box-shadow: inset 0 0 0 1px rgba(245,166,35,0.08);
    transition: all 0.18s ease;
}

.layer-item .layer-icon {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--surface-1);
    border-radius: 8px;
    color: var(--text-2);
}

.layer-item .layer-name {
    flex: 1;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-1);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.layer-item .layer-actions {
    display: flex;
    gap: 4px;
}

.layer-action-btn {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-3);
    border-radius: 6px;
    transition: all 0.15s ease;
}

.layer-action-btn:hover {
    background: var(--surface-1);
    color: var(--text-1);
}

.layer-action-btn.del:hover {
    color: #ef4444;
    background: rgba(239, 68, 68, 0.1);
}

.layer-action-btn svg {
    width: 16px;
    height: 16px;
}

.custom-stroke {
    -webkit-text-stroke: var(--st-width, inherit) var(--st-color, inherit) !important;
}
