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

/* ── Auto-injected animated CTA arrow ────────────────────────────────────────
   Adds a small play-triangle ▶ to the right of every main CTA button text,
   gently nudging right and back to draw the eye. Applies to:
     - .cta-button (bridge templates), excluding builder-only small buttons
     - .squeeze-submit-btn (squeeze templates)
*/
.cta-button:not(.small-btn):not(.secondary)::after,
.squeeze-submit-btn::after {
    content: "\25B6"; /* ▶ */
    display: inline-block;
    margin-left: 10px;
    font-size: 0.75em;
    line-height: 1;
    vertical-align: 1px;
    animation: cp-cta-nudge 1.6s ease-in-out infinite;
}
@keyframes cp-cta-nudge {
    0%, 100% { transform: translateX(0); }
    50%      { transform: translateX(6px); }
}
/* Respect users who prefer reduced motion */
@media (prefers-reduced-motion: reduce) {
    .cta-button:not(.small-btn):not(.secondary)::after,
    .squeeze-submit-btn::after {
        animation: none;
    }
}

body {
    font-family: 'Poppins', sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: #f5f5f5;
    padding: 20px;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    background-color: #fff;
    border-radius: 10px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
    overflow: hidden;
}

.content {
    padding: 40px;
}

.authority {
    display: flex; /* block-level flex so auto margins can center the element */
    align-items: center;
    justify-content: flex-start;
    gap: 12px;
    padding: 8px 10px; /* reduced height/padding */
    margin: 0 auto 16px; /* centrado en la fila */
    border-radius: 10px;
    background: #ffffff; /* white background */
    border: 2px dashed #d1d5db; /* light gray dashed lines */
    width: fit-content; /* ajusta exactamente al contenido */
    -webkit-width: -webkit-fit-content;
    text-align: left;
}

.authority-avatar {
    width: 48px;
    height: 48px;
    border-radius: 8px; /* bordes suavemente redondeados */
    object-fit: cover;
    box-shadow: 0 2px 6px rgba(0,0,0,0.08);
    flex: 0 0 48px;
}

.authority-text {
    font-size: 15px;
    color: #2c3e50;
    font-weight: 600;
    line-height: 1;
}

/* Headline styling */
.headline-wrap {
    position: relative;
    width: 100%;
    margin-bottom: 30px;
}

.headline {
    font-size: 36px;
    width: 95%;
    margin: 0 auto;
    text-align: center;
    color: #2c3e50;
    line-height: 1.15;
    word-break: break-word;
}

.edit-headline-trigger {
    position: absolute;
    right: 0;
    top: -15px;
    font-size: 12px;
    color: #a0aec0;
    text-decoration: none;
    border-bottom: 1px dashed #a0aec0;
    white-space: nowrap;
    z-index: 10;
}

.edit-headline-trigger:hover {
    color: #718096;
    border-bottom-color: #718096;
}

/* Colorable spans inside headline */
.colorable {
    padding: 2px 6px;
    border-radius: 4px;
    cursor: text;
    display: inline-block;
    font-weight: 700;
}

/* Default colors for the two parts */
.colorable[data-key="part1"] { color: #5bc0ff; } /* light blue */
.colorable[data-key="part2"] { color: #e74c3c; } /* red */

/* Floating color picker */
.color-picker {
    position: fixed;
    z-index: 9999;
    display: flex;
    gap: 8px;
    align-items: center;
    background: #fff;
    border-radius: 8px;
    padding: 8px;
    box-shadow: 0 6px 18px rgba(0,0,0,0.12);
    border: 1px solid rgba(0,0,0,0.06);
    transform-origin: top left;
}

.color-picker input[type="color"] {
    width: 36px;
    height: 36px;
    padding: 0;
    border: none;
    background: transparent;
    cursor: pointer;
}

.color-picker button {
    background: transparent;
    border: none;
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
    padding: 4px 6px;
}

/* Avatar Social Proof Row */
.avatar-row {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 25px;
    margin-top: -10px;
    gap: 16px; /* Space between group and text */
}

.avatar-row.reverse {
    flex-direction: row-reverse;
}

.avatar-group {
    display: flex;
    align-items: center;
    justify-content: center;
}

.avatar-circle {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    border: 3px solid #fff;
    overflow: hidden;
    margin-left: -22px !important;
    position: relative;
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
    background-color: #e2e8f0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    color: #fff;
    font-size: 15px;
    flex-shrink: 0;
    cursor: grab;
    transition: transform 0.2s, box-shadow 0.2s;
    user-select: none;
}

.avatar-circle.dragging {
    opacity: 0.5;
    cursor: grabbing;
    transform: scale(1.1);
}

.avatar-circle.drag-over {
    border: 3px solid #3b82f6;
    transform: scale(1.05);
}

/* Stacking Order: Leftmost on top (Reverse of default) */
.avatar-circle:nth-child(1) { z-index: 12; }
.avatar-circle:nth-child(2) { z-index: 11; }
.avatar-circle:nth-child(3) { z-index: 10; }
.avatar-circle:nth-child(4) { z-index: 9; }
.avatar-circle:nth-child(5) { z-index: 8; }
.avatar-circle:nth-child(6) { z-index: 7; }
.avatar-circle:nth-child(7) { z-index: 6; }
.avatar-circle:nth-child(8) { z-index: 5; }
.avatar-circle:nth-child(9) { z-index: 4; }
.avatar-circle:nth-child(10) { z-index: 3; }
.avatar-circle:nth-child(11) { z-index: 2; }
.avatar-circle:nth-child(12) { z-index: 1; }

.avatar-circle:first-child {
    margin-left: 0 !important;
}

.avatar-circle img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.social-proof-text {
    margin-left: 0; /* Handled by parent gap */
    font-family: 'Nunito', sans-serif;
    font-weight: 700;
    font-size: 16px;
    color: #4a5568;
    line-height: 1.2;
    cursor: text;
}

/* Video and other styles remain unchanged */
.video-container {
    margin: 30px auto; /* Añadido margen vertical */
    max-width: 800px; /* Limita el ancho máximo (ajusta este valor según necesites) */
    width: 90%; /* Ocupa el 90% del contenedor padre */
}

.youtube-video {
    position: relative;
    width: 100%;
    height: 0;
    padding-bottom: 56.25%; /* Mantiene relación de aspecto 16:9 */
    border-radius: 8px;
    overflow: hidden;
    cursor: pointer;
    margin: 0 auto; /* Centra el contenedor */
}

.video-thumbnail {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover; /* Asegura que la imagen cubra todo el espacio */
    z-index: 1;
    transform-origin: center;
    transition: transform 0.5s ease;
}

.video-generated-poster {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: #000;
    z-index: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center; /* Default centered */
    text-align: center;
    padding: 20px;
    overflow: hidden;
    transition: padding-bottom 0.3s ease, transform 0.5s ease;
    transform-origin: center;
}

.video-generated-poster.has-play-btn {
    justify-content: flex-end;
    padding-bottom: calc(28.125% + 50px); /* Position content just above the center play button */
}

.poster-inner-row {
    display: flex;
    flex-direction: column;
    gap: 15px;
    width: 90%; /* Use more width */
    max-width: 90%;
    z-index: 1;
    /* Removed position relative so absolute children anchor to the video-generated-poster */
    align-items: center;
}

/* Ensure lines inherit text align from container if needed, but flex items use align-items */
.poster-inner-row .poster-line { width: 100%; text-align: center; }

.poster-main-emoji {
    font-size: 80px;
    line-height: 1;
    
    /* Position on the left side of the image, vertically centered */
    position: absolute;
    left: 40px;
    top: 50%;
    transform: translateY(-50%);
    z-index: 2;
}

.poster-text-col {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.2em;
    transition: all 0.3s ease;
    z-index: 1; 
    text-align: center;
    font-size: var(--poster-fs, 32px);
}

@media (max-width: 600px) {
    .poster-text-col {
        font-size: calc(var(--poster-fs, 32px) * 0.45);
        line-height: 1.2;
        width: 100%;
        padding: 0 5px;
    }
    .poster-main-emoji {
        transform: translateY(-50%) scale(0.6);
        left: 2px !important;
    }
    
    /* Adjust spacing for play button on small screens so text doesn't fly off top */
    .video-generated-poster.has-play-btn {
        padding-bottom: calc(20% + 45px); 
        justify-content: flex-end;
    }
}

/* When a person is present, shift content up to avoid overlap */
.poster-text-col.has-person {
    padding-bottom: 25%; 
}

/* If play button is present, we already shifted the container up, so remove extra text padding */
.video-generated-poster.has-play-btn .poster-text-col.has-person {
    padding-bottom: 0;
}

.poster-person-overlay {
    position: absolute;
    max-height: 65%;
    width: auto;
    object-fit: contain;
    z-index: 2;
    pointer-events: none;
}

.poster-person-overlay.bottom-left {
    bottom: 0;
    left: 0;
    transform-origin: bottom left;
}

.poster-person-overlay.bottom-right {
    bottom: 0;
    right: 0;
    transform-origin: bottom right;
}

.poster-line {
    line-height: 1.2;
    white-space: pre-wrap;
    max-width: 100%;
    text-align: center;
}

/* Safety fallback: if a template defines skeleton-style placeholder bars (height + background),
   strip them once the line has real text content, and hide empty lines. This applies regardless
   of whether the auto-overlay class is present, so manual video-cover text edits render cleanly. */
.poster-line:not(:empty) {
    height: auto !important;
    background: transparent !important;
    width: auto !important;
    border-radius: 0 !important;
}
.poster-line:empty {
    display: none;
}

/* Auto-generated single-line overlay: scale font down + nowrap so 3-5 words fit on one line */
.video-generated-poster.auto-overlay .poster-line {
    white-space: nowrap;
    font-size: calc(var(--poster-fs, 32px) * 1.6);
    line-height: 1.1;
    text-align: center;
    width: 100%;
    /* Override the template's inline placeholder styling (height:14px; background:rgba…) */
    height: auto !important;
    background: transparent !important;
    border-radius: 0 !important;
}
/* Force centering on the inner column when auto-gen is active */
.video-generated-poster.auto-overlay .poster-text-col,
.video-generated-poster.auto-overlay .poster-inner-row {
    align-items: center;
    justify-content: center;
    text-align: center;
    width: 100%;
}
/* Hide empty lines 2 & 3 so they don't render as ghost blocks */
.video-generated-poster.auto-overlay .poster-line:empty,
.video-generated-poster.auto-overlay .poster-line.is-empty {
    display: none !important;
}
@media (max-width: 600px) {
    .video-generated-poster.auto-overlay .poster-line {
        font-size: calc(var(--poster-fs, 32px) * 0.7);
    }
}

.video-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: transparent; /* Removed default black alpha overlay */
    pointer-events: none; /* Let clicks pass through to container */
    z-index: 3;
    transition: all 0.5s ease;
}

/* Equalizer Styles */
.equalizer-container {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    align-items: flex-end;
    gap: 3px;
    height: 40px;
    z-index: 5;
    padding: 10px;
    pointer-events: none;
}

.equalizer-bar {
    width: 4px;
    height: 6px;
    background-color: #ffffff;
    border-radius: 2px;
    animation: eq-speech 4.5s ease-in-out infinite;
    transform-origin: bottom;
    opacity: 0.9;
    box-shadow: 0 1px 3px rgba(0,0,0,0.6);
}

/* Varied delays and durations to simulate natural, non-repetitive speech rhythms */
.equalizer-bar:nth-child(1) { animation-delay: -1.7s; animation-duration: 4.8s; transform: scaleY(0.7); }
.equalizer-bar:nth-child(2) { animation-delay: -0.9s; animation-duration: 4.2s; transform: scaleY(0.9); }
.equalizer-bar:nth-child(3) { animation-delay: -0.3s; animation-duration: 4.5s; transform: scaleY(1.1); }
.equalizer-bar:nth-child(4) { animation-delay: -1.2s; animation-duration: 4.3s; transform: scaleY(1.2); }
.equalizer-bar:nth-child(5) { animation-delay: -0.6s; animation-duration: 4.4s; transform: scaleY(1.1); }
.equalizer-bar:nth-child(6) { animation-delay: -1.5s; animation-duration: 4.1s; transform: scaleY(0.9); }
.equalizer-bar:nth-child(7) { animation-delay: -0.4s; animation-duration: 4.7s; transform: scaleY(0.7); }

@keyframes eq-speech {
    0%, 15%, 85%, 100% { 
        height: 5px; 
        opacity: 0.3; 
    }
    18% { height: 18px; opacity: 0.9; }
    24% { height: 10px; opacity: 0.6; }
    30% { height: 24px; opacity: 1; }
    38% { height: 12px; opacity: 0.7; }
    45% { height: 22px; opacity: 0.9; }
    52% { height: 6px; opacity: 0.4; } /* Breath pause */
    60% { height: 26px; opacity: 1; }
    68% { height: 14px; opacity: 0.7; }
    75% { height: 20px; opacity: 0.9; }
    80% { height: 8px; opacity: 0.5; }
}

.play-button {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 4;
    transition: transform 0.2s ease;
}

.youtube-video:hover .play-button {
    transform: translate(-50%, -50%) scale(1.1);
}

.sound-indicator {
    position: absolute;
    top: 16px;
    left: 16px;
    background-color: rgba(0, 0, 0, 0.85);
    color: #fff;
    padding: 8px 14px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    font-weight: 600;
    z-index: 5;
    pointer-events: none;
    box-shadow: 0 2px 4px rgba(0,0,0,0.3);
    animation: sound-pulse 2.5s infinite ease-in-out;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

@keyframes sound-pulse {
    0% { transform: scale(1); box-shadow: 0 0 0 0 rgba(255, 255, 255, 0); }
    50% { transform: scale(1.05); box-shadow: 0 0 0 4px rgba(255, 255, 255, 0.1); }
    100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(255, 255, 255, 0); }
}

.paragraphs {
    margin-bottom: 30px;
    padding: 0 5%;
    box-sizing: border-box;
}

.paragraphs p {
    margin-bottom: 20px;
    font-size: 16px;
    line-height: 1.8;
    color: #555;
}

.button-container {
    text-align: center;
    margin: 30px 0;
    position: relative;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
}

.button-inner-wrap {
    position: relative;
    display: inline-block;
    max-width: 100%;
}

.edit-btn-trigger {
    display: block;
    margin: 12px auto 0;
    font-size: 13px;
    color: #a0aec0;
    text-decoration: none;
    border-bottom: 1px dashed #a0aec0;
    transition: color 0.2s;
    white-space: nowrap;
    width: fit-content;
    text-align: center;
}

.edit-btn-trigger:hover {
    color: #718096;
    border-bottom-color: #718096;
}

@media (max-width: 768px) {

    .edit-headline-trigger {
        position: static;
        display: block;
        margin: 0 auto 10px;
        transform: none;
        width: fit-content;
    }
}

.cta-button {
    display: inline-block;
    text-decoration: none;
    text-align: center;
    padding: 20px 42px;
    font-size: 22px;
    font-weight: bold;
    color: #fff;
    background-color: #004aad;
    border: none;
    border-radius: 50px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 6px rgba(0, 74, 173, 0.3);
}

.cta-button:hover {
    background-color: #003680;
    transform: translateY(-2px);
    box-shadow: 0 6px 8px rgba(0, 74, 173, 0.4);
}

.footer {
    background-color: #f8f9fa;
    padding: 30px 40px;
    text-align: center;
    border-top: 1px solid #eee;
}

.website-name {
    font-size: 24px;
    margin-bottom: 15px;
    color: #2c3e50;
}

.footer-text {
    font-size: 14px;
    color: #777;
    max-width: 600px;
    margin: 0 auto;
    line-height: 1.5;
}

@media (max-width: 768px) {
    .content {
        padding: 20px;
    }
    
    .headline {
        font-size: 28px;
    }
    
    .cta-button {
        padding: 12px 24px;
        font-size: 16px;
    }

    /* Project Panel Tweaks */
    .project-panel { width: 92%; right: 4%; top: 12px; max-width: unset; }
    .project-btn { top: 10px; right: 10px; }
}

/* ═══════════════════════════════════════════════════════════════════════════
   CONVERTPAGES EDITOR UI — Design System
   Variables defined here, everything else references them.
   ═══════════════════════════════════════════════════════════════════════════ */

:root {
    /* Brand */
    --cp-orange:        #ff6b35;
    --cp-orange-dark:   #e55a25;
    --cp-orange-light:  #fff3ee;
    --cp-orange-border: #ffd5c0;

    /* Neutrals */
    --cp-ink:           #111111;
    --cp-ink-2:         #333333;
    --cp-ink-3:         #666666;
    --cp-ink-4:         #999999;
    --cp-ink-5:         #bbbbbb;

    /* Surfaces */
    --cp-surface-0:     #ffffff;
    --cp-surface-1:     #f8f7f5;
    --cp-surface-2:     #f0ede9;
    --cp-surface-3:     #e8e4de;

    /* Borders */
    --cp-border:        #e2ddd8;
    --cp-border-light:  #eeebe7;

    /* Semantic */
    --cp-green:         #16a34a;
    --cp-green-bg:      #f0faf4;
    --cp-green-border:  #86efac;
    --cp-red:           #dc2626;
    --cp-red-bg:        #fff5f4;
    --cp-red-border:    #fca5a5;

    /* Typography */
    --cp-font:          'Poppins', sans-serif;
    --cp-font-size-xs:  11px;
    --cp-font-size-sm:  12px;
    --cp-font-size-md:  13px;
    --cp-font-size-lg:  14px;

    /* Radius */
    --cp-radius-sm:     6px;
    --cp-radius-md:     8px;
    --cp-radius-lg:     12px;
    --cp-radius-xl:     16px;

    /* Shadows */
    --cp-shadow-sm:     0 2px 8px rgba(0,0,0,0.08);
    --cp-shadow-md:     0 6px 24px rgba(0,0,0,0.12);
    --cp-shadow-lg:     0 12px 40px rgba(0,0,0,0.16);
}

/* ── Dashboard button & wrapper ─────────────────────────────────────────── */

#project-wrapper {
    position: fixed;
    top: 16px;
    right: 16px;
    z-index: 99990;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 6px;
}

/* Card containing user bar + editing bar */
#project-wrapper > #user-bar,
#project-wrapper > #editing-bar {
    width: 100%;
    border-radius: 0;
}
#project-wrapper > #user-bar:last-child,
#project-wrapper > #editing-bar:last-child {
    border-radius: 0 0 var(--cp-radius-lg) var(--cp-radius-lg);
}

/* Wrap user-bar and editing-bar in a visual card via a sibling trick */
#user-bar {
    border-top-left-radius: var(--cp-radius-lg);
    border-top-right-radius: var(--cp-radius-lg);
}

.project-btn {
    background: var(--cp-ink);
    color: #ffffff;
    border: none;
    padding: 10px 20px;
    border-radius: var(--cp-radius-md);
    cursor: pointer;
    font-weight: 700;
    font-size: var(--cp-font-size-md);
    letter-spacing: 0.01em;
    font-family: var(--cp-font);
    transition: background 0.15s;
    text-align: center;
    display: block;
    box-shadow: var(--cp-shadow-sm);
}
.project-btn:hover { background: #333333; }

/* ── Dashboard dropdown menu ────────────────────────────────────────────── */

.project-menu {
    position: absolute;
    top: calc(100% + 4px);
    right: 0;
    background: var(--cp-surface-0);
    border: 1px solid var(--cp-border);
    border-radius: var(--cp-radius-lg);
    box-shadow: var(--cp-shadow-md);
    width: 200px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}
.project-menu[hidden] { display: none; }

.menu-item {
    padding: 11px 16px;
    cursor: pointer;
    font-size: var(--cp-font-size-md);
    font-weight: 500;
    color: var(--cp-ink-2);
    font-family: var(--cp-font);
    transition: background 0.12s;
    border-bottom: 1px solid var(--cp-border-light);
}
.menu-item:last-child { border-bottom: none; }
.menu-item:hover { background: var(--cp-orange-light); color: var(--cp-orange); }

/* ── Settings gear button ───────────────────────────────────────────────── */

.settings-btn {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 99990;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--cp-surface-0);
    color: var(--cp-ink-3);
    border: 1px solid var(--cp-border);
    box-shadow: var(--cp-shadow-sm);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.3s ease, box-shadow 0.2s, border-color 0.15s;
}
.settings-btn:hover {
    border-color: var(--cp-orange);
    box-shadow: var(--cp-shadow-md);
    transform: rotate(45deg);
}
.settings-btn svg { pointer-events: none; }

/* ── Modal helpers ──────────────────────────────────────────────────────── */

.small-modal { width: 420px; max-width: 92%; }

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

.small-btn {
    padding: 8px 18px !important;
    font-size: var(--cp-font-size-md) !important;
    border-radius: var(--cp-radius-md) !important;
    font-family: var(--cp-font) !important;
    font-weight: 600 !important;
    cursor: pointer !important;
    border: none !important;
    transition: background 0.15s !important;
}

.secondary {
    background: var(--cp-surface-2) !important;
    color: var(--cp-ink-3) !important;
    box-shadow: none !important;
}
.secondary:hover {
    background: var(--cp-surface-3) !important;
    transform: none !important;
}

/* ── Editor panels (headline, bg, button editors) ───────────────────────── */

.editor-panel {
    position: fixed;
    top: 60px;
    right: 16px;
    width: 300px;
    max-width: 95%;
    max-height: 86vh;
    overflow-y: auto;
    background: #fff;
    border-radius: 14px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.12);
    z-index: 99997;
    padding: 20px;
    border: 1px solid #e5e7eb;
    font-family: 'Poppins', sans-serif;
}
.editor-panel[hidden] { display: none; }

.editor-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    padding-bottom: 14px;
    border-bottom: 1px solid var(--cp-border-light);
}
.editor-header h4 {
    margin: 0;
    font-size: var(--cp-font-size-lg);
    font-weight: 700;
    color: var(--cp-ink);
    font-family: var(--cp-font);
}
.editor-close {
    background: #f3f4f6;
    border: none;
    font-size: 13px;
    cursor: pointer;
    color: #9ca3af;
    line-height: 1;
    transition: all 0.15s;
    padding: 0;
    width: 28px;
    height: 28px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
}
.editor-close:hover { background: #e5e7eb; color: #374151; }

.control-group { margin-bottom: 16px; }
.control-group label {
    display: block;
    font-size: var(--cp-font-size-xs);
    font-weight: 700;
    margin-bottom: 6px;
    color: var(--cp-ink-4);
    text-transform: uppercase;
    letter-spacing: 0.07em;
    font-family: var(--cp-font);
}
.control-group input[type="color"] {
    width: 100%;
    height: 42px;
    padding: 2px;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    cursor: pointer;
    background: #fff;
}
.control-group input[type="color"]:hover { border-color: #ec4899; }
.control-group input[type="range"] {
    width: 100%;
    cursor: pointer;
    accent-color: #ec4899;
}

#btn-target-url {
    width: 100%;
    padding: 9px 12px;
    margin-top: 6px;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    font-size: 13px;
    color: #111827;
    background: var(--cp-surface-0);
    font-family: var(--cp-font);
    transition: border-color 0.15s;
    box-sizing: border-box;
}
#btn-target-url:focus {
    border-color: var(--cp-orange);
    outline: none;
}

/* ── Settings panel ─────────────────────────────────────────────────────── */

.project-panel {
    position: fixed;
    top: 56px;
    right: 16px;
    width: 360px;
    max-width: 95%;
    max-height: 88vh;
    background: var(--cp-surface-0);
    border-radius: var(--cp-radius-xl);
    box-shadow: var(--cp-shadow-lg);
    z-index: 99995;
    border: 1px solid var(--cp-border);
    font-family: var(--cp-font);
    display: none;
    flex-direction: column;
    overflow: hidden;
}

.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 18px;
    border-bottom: 1px solid var(--cp-border-light);
    flex-shrink: 0;
}
.panel-header h4 {
    margin: 0;
    font-size: var(--cp-font-size-lg);
    font-weight: 700;
    color: var(--cp-ink);
    font-family: var(--cp-font);
}
.panel-close {
    background: none;
    border: none;
    font-size: 18px;
    cursor: pointer;
    color: var(--cp-ink-5);
    line-height: 1;
    transition: color 0.15s;
    padding: 2px 4px;
}
.panel-close:hover { color: var(--cp-ink-2); }

/* ── Panel nav tabs ─────────────────────────────────────────────────────── */

.panel-nav {
    display: flex;
    border-bottom: 1px solid var(--cp-border-light);
    padding: 0 18px;
    flex-shrink: 0;
}
.panel-nav-btn {
    flex: 1;
    padding: 11px 4px;
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    cursor: pointer;
    font-weight: 500;
    color: var(--cp-ink-4);
    font-size: var(--cp-font-size-md);
    font-family: var(--cp-font);
    transition: color 0.15s;
    margin-bottom: -1px;
}
.panel-nav-btn:hover { color: var(--cp-ink-2); }
.panel-nav-btn.active {
    color: var(--cp-orange);
    border-bottom-color: var(--cp-orange);
    font-weight: 700;
}

/* ── Panel scrollable view ──────────────────────────────────────────────── */

.panel-view {
    overflow-y: auto;
    flex: 1;
    min-height: 0;
    padding: 16px 18px 20px;
    scroll-behavior: smooth;
}
.panel-view[hidden] { display: none; }

/* ── AI sub-tabs ────────────────────────────────────────────────────────── */

.ai-tabs { display: flex; gap: 6px; margin-bottom: 14px; }
.ai-tab {
    flex: 1;
    background: var(--cp-surface-1);
    border: 1px solid var(--cp-border);
    padding: 8px 10px;
    border-radius: var(--cp-radius-md);
    cursor: pointer;
    font-weight: 500;
    font-size: var(--cp-font-size-sm);
    color: var(--cp-ink-3);
    font-family: var(--cp-font);
    transition: all 0.15s;
    text-align: center;
}
.ai-tab:hover { background: var(--cp-surface-2); color: var(--cp-ink); }
.ai-tab.active {
    background: var(--cp-orange);
    color: #fff;
    border-color: var(--cp-orange);
    font-weight: 700;
}

/* ── AI Content Stepper (new design) ─────────────────────────────────────── */

.ai-step {
    position: relative;
    background: var(--cp-surface-1);
    border: 1px solid var(--cp-border);
    border-radius: var(--cp-radius-lg);
    padding: 16px 16px 16px 50px;
    margin-bottom: 12px;
    transition: background .2s, border-color .2s, opacity .2s, box-shadow .2s;
}
.ai-step.complete {
    background: var(--cp-surface-0);
    border-color: #f9c3dd;
}
.ai-step.active {
    background: var(--cp-surface-0);
    border-color: #f9c3dd;
    box-shadow: 0 0 0 3px #fdf0f6;
}
.ai-step.locked {
    opacity: .55;
    pointer-events: none;
}
.ai-step-num {
    position: absolute;
    left: 14px;
    top: 16px;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: var(--cp-surface-3);
    color: var(--cp-ink-3);
    font-size: 12px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background .2s, color .2s;
    font-family: var(--cp-font);
}
.ai-step.active .ai-step-num { background: #ec4899; color:#fff; }
.ai-step.complete .ai-step-num { background: #16a34a; color:#fff; }
.ai-step.complete .ai-step-num span { display:none; }
.ai-step.complete .ai-step-num::after { content:'✓'; }
.ai-step-title {
    margin: 2px 0 12px;
    font-size: var(--cp-font-size-md);
    font-weight: 700;
    color: var(--cp-ink);
    font-family: var(--cp-font);
}
.ai-step .ai-field { margin-bottom: 10px; }
.ai-step .ai-field:last-child { margin-bottom: 0; }
.ai-step label {
    display: block;
    font-size: var(--cp-font-size-sm);
    font-weight: 600;
    color: var(--cp-ink-2);
    margin: 0 0 5px;
    font-family: var(--cp-font);
}
.ai-step input,
.ai-step textarea {
    width: 100%;
    padding: 9px 11px;
    border: 1px solid var(--cp-border);
    border-radius: var(--cp-radius-sm);
    font-family: var(--cp-font);
    font-size: var(--cp-font-size-md);
    background: var(--cp-surface-0);
    box-sizing: border-box;
}
.ai-step textarea {
    resize: vertical;
    min-height: 100px;
}
.ai-step input:focus,
.ai-step textarea:focus {
    border-color: #ec4899;
    outline: none;
    box-shadow: 0 0 0 3px #fdf0f6;
}
.ai-step .ai-tip {
    font-size: 11px;
    color: var(--cp-ink-3);
    margin: 8px 0 0;
    line-height: 1.45;
    display: flex;
    gap: 6px;
    align-items: flex-start;
    font-family: var(--cp-font);
}
.ai-step .ai-tip svg { flex-shrink: 0; margin-top: 1px; }
.ai-step .ai-help {
    font-size: 11px;
    color: var(--cp-ink-3);
    margin: 6px 0 0;
    line-height: 1.45;
    font-family: var(--cp-font);
}

/* Buttons inside steps */
.ai-step .ai-btn {
    width: 100%;
    padding: 10px 16px;
    border: none;
    border-radius: var(--cp-radius-md);
    font-family: var(--cp-font);
    font-weight: 600;
    font-size: var(--cp-font-size-md);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    transition: background .15s, transform .05s, filter .15s;
}
.ai-step .ai-btn:active { transform: translateY(1px); }
.ai-step .ai-btn:disabled { opacity:.5; cursor: not-allowed; }
.ai-step .ai-btn-primary { background: #ec4899; color: #fff; }
.ai-step .ai-btn-primary:hover { background: #db2777; }
.ai-step .ai-btn-gradient { background: linear-gradient(135deg, #ec4899, #ff6b35); color: #fff; }
.ai-step .ai-btn-gradient:hover { filter: brightness(1.05); }
.ai-step .ai-btn-secondary {
    background: var(--cp-surface-0);
    color: var(--cp-ink-2);
    border: 1px solid var(--cp-border);
}
.ai-step .ai-btn-secondary:hover { background: var(--cp-surface-1); }

/* Prompt preview area */
.ai-prompt-box {
    position: relative;
    background: var(--cp-surface-2);
    border: 1px solid var(--cp-border);
    border-radius: var(--cp-radius-md);
    padding: 10px 12px;
    margin: 10px 0 8px;
}
.ai-prompt-box textarea {
    background: transparent !important;
    border: none !important;
    padding: 0 !important;
    width: 100%;
    min-height: 90px;
    font-size: 12px;
    font-family: 'Menlo','Consolas',monospace !important;
    color: var(--cp-ink-2);
    resize: vertical;
    box-sizing: border-box;
    box-shadow: none !important;
}
.ai-prompt-empty {
    color: var(--cp-ink-4);
    font-size: 12px;
    font-style: italic;
    font-family: var(--cp-font);
    padding: 8px 0;
}

/* Pro auto-generate panel */
.ai-pro-panel {
    background: linear-gradient(135deg, #fdf0f6, #fff3ee);
    border: 1px solid #f9c3dd;
    border-radius: var(--cp-radius-md);
    padding: 11px 12px;
    margin-bottom: 12px;
}
.ai-pro-head {
    display: flex;
    align-items: center;
    gap: 7px;
    margin-bottom: 7px;
}
.ai-pro-title {
    font-size: 12px;
    font-weight: 700;
    color: var(--cp-ink);
    flex: 1;
    font-family: var(--cp-font);
}
.ai-pro-badge {
    background: linear-gradient(135deg, #ec4899, #ff6b35);
    color: #fff;
    font-size: 9px;
    font-weight: 800;
    padding: 2px 6px;
    border-radius: 4px;
    letter-spacing: .03em;
    font-family: var(--cp-font);
}
.ai-pro-desc {
    font-size: 11px;
    color: var(--cp-ink-3);
    line-height: 1.45;
    margin: 0 0 9px;
    font-family: var(--cp-font);
}
.ai-pro-upgrade {
    display: inline-block;
    font-size: 11px;
    font-weight: 700;
    color: #db2777;
    text-decoration: none;
    margin-top: 8px;
    font-family: var(--cp-font);
}
.ai-pro-upgrade:hover { text-decoration: underline; }

.ai-divider-or {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 12px 0;
    color: var(--cp-ink-4);
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .1em;
    font-family: var(--cp-font);
}
.ai-divider-or::before,
.ai-divider-or::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--cp-border-light);
}

/* Split copy + open AI button */
.ai-split-wrap {
    position: relative;
    margin-top: 10px;
}
.ai-split-btn {
    display: flex;
    width: 100%;
    border-radius: var(--cp-radius-md);
    overflow: hidden;
    box-shadow: var(--cp-shadow-sm);
}
.ai-split-main {
    flex: 1;
    background: var(--cp-ink);
    color: #fff;
    border: none;
    padding: 10px 14px;
    font-family: var(--cp-font);
    font-weight: 600;
    font-size: var(--cp-font-size-md);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    border-right: 1px solid rgba(255,255,255,0.18);
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.ai-split-main:hover { background: var(--cp-ink-2); }
.ai-split-toggle {
    background: var(--cp-ink);
    color: #fff;
    border: none;
    padding: 0 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    font-family: var(--cp-font);
    font-weight: 600;
    font-size: 11px;
    white-space: nowrap;
    flex-shrink: 0;
}
.ai-split-toggle:hover { background: var(--cp-ink-2); }
.ai-split-toggle.open svg { transform: rotate(180deg); }
.ai-split-toggle svg { transition: transform .15s; }
.ai-split-logo {
    width: 18px;
    height: 18px;
    border-radius: 4px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-weight: 700;
    font-size: 10px;
    flex-shrink: 0;
    font-family: var(--cp-font);
}
.ai-split-logo.gpt { background:#10a37f; }
.ai-split-logo.cla { background:#cc785c; }
.ai-split-logo.per { background:#1fb8cd; }
.ai-split-logo.gem { background: linear-gradient(135deg,#4285f4 0%,#9b72cb 50%,#d96570 100%); }

.ai-picker-menu {
    position: absolute;
    right: 0;
    top: calc(100% + 4px);
    background: var(--cp-surface-0);
    border: 1px solid var(--cp-border);
    border-radius: var(--cp-radius-md);
    box-shadow: var(--cp-shadow-md);
    padding: 5px;
    min-width: 170px;
    z-index: 10;
    display: none;
}
.ai-picker-menu.open { display: block; }
.ai-picker-item {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 8px 10px;
    border-radius: var(--cp-radius-sm);
    font-size: 12px;
    font-weight: 600;
    color: var(--cp-ink-2);
    cursor: pointer;
    font-family: var(--cp-font);
}
.ai-picker-item:hover { background: #fdf0f6; }
.ai-picker-item .check {
    margin-left: auto;
    color: #ec4899;
    font-weight: 800;
    opacity: 0;
}
.ai-picker-item.selected .check { opacity: 1; }
.ai-picker-item .ai-split-logo { width: 18px; height: 18px; }

/* Success feedback */
.ai-feedback {
    margin-top: 10px;
    padding: 9px 12px;
    border-radius: var(--cp-radius-sm);
    font-size: 12px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 7px;
    font-family: var(--cp-font);
}
.ai-feedback.success {
    background: var(--cp-green-bg);
    border: 1px solid var(--cp-green-border);
    color: #15803d;
}
.ai-feedback.error {
    background: var(--cp-red-bg);
    border: 1px solid var(--cp-red-border);
    color: #b91c1c;
}

/* Spinner for Pro loading state */
.ai-spinner {
    display: inline-block;
    width: 14px;
    height: 14px;
    border: 2px solid rgba(255,255,255,0.4);
    border-top-color: #fff;
    border-radius: 50%;
    animation: ai-spin 0.7s linear infinite;
}
@keyframes ai-spin { to { transform: rotate(360deg); } }

/* ── Settings sections ──────────────────────────────────────────────────── */

.settings-group { margin-bottom: 12px; }

.settings-section-title {
    font-size: var(--cp-font-size-xs);
    font-weight: 700;
    color: var(--cp-ink-4);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    padding: 16px 0 8px;
    border-top: 1px solid var(--cp-border-light);
    margin: 4px 0;
    font-family: var(--cp-font);
    display: block;
}
.settings-section-title:first-child {
    border-top: none;
    padding-top: 0;
    margin-top: 0;
}

.settings-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 5px 0;
    margin-bottom: 4px;
}
.settings-row input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: #ec4899;
    cursor: pointer;
    flex-shrink: 0;
}
.settings-row label {
    font-size: var(--cp-font-size-md);
    color: var(--cp-ink-2);
    cursor: pointer;
    font-family: var(--cp-font);
    font-weight: 500;
}

/* ── Form inputs inside settings/AI panel ───────────────────────────────── */

.ai-tab-content label,
.settings-group label {
    display: block;
    font-size: var(--cp-font-size-xs);
    font-weight: 700;
    margin-top: 10px;
    margin-bottom: 5px;
    color: var(--cp-ink-3);
    text-transform: uppercase;
    letter-spacing: 0.07em;
    font-family: var(--cp-font);
}

.ai-tab-content input,
.ai-tab-content textarea,
.settings-group input[type="text"],
.settings-group input[type="url"],
.settings-group textarea,
.settings-group select,
#setting-btn-layout {
    width: 100%;
    padding: 9px 12px;
    margin-top: 4px;
    border: 1px solid var(--cp-border);
    border-radius: var(--cp-radius-md);
    font-family: var(--cp-font);
    font-size: var(--cp-font-size-md);
    color: var(--cp-ink);
    background: var(--cp-surface-0);
    box-sizing: border-box;
    transition: border-color 0.15s, box-shadow 0.15s;
    appearance: auto;
}
.ai-tab-content input:focus,
.ai-tab-content textarea:focus,
.settings-group input:focus,
.settings-group textarea:focus,
.settings-group select:focus {
    outline: none;
    border-color: var(--cp-orange);
    box-shadow: 0 0 0 3px rgba(255,107,53,0.1);
}

/* ── Paste tab layout ───────────────────────────────────────────────────── */

#tab-paste { display: flex; flex-direction: column; height: 100%; }
#tab-paste[hidden] { display: none !important; }
#paste-json { flex: 1; min-height: 200px; resize: vertical; }
#apply-json {
    position: sticky;
    bottom: 0;
    z-index: 10;
    margin-top: 10px;
    box-shadow: 0 -4px 12px rgba(255,255,255,0.9);
}

/* ── Generate / action buttons ──────────────────────────────────────────── */

.generate-btn {
    display: block;
    margin-top: 10px;
    width: 100%;
    padding: 10px 14px;
    background: var(--cp-ink);
    color: #fff;
    border: none;
    border-radius: var(--cp-radius-md);
    cursor: pointer;
    font-weight: 600;
    font-size: var(--cp-font-size-md);
    font-family: var(--cp-font);
    transition: background 0.15s;
    text-align: center;
    text-decoration: none;
    box-sizing: border-box;
}
.generate-btn:hover { background: var(--cp-ink-2); }
.generate-btn:disabled {
    background: var(--cp-ink-5);
    cursor: not-allowed;
    opacity: 0.7;
}

/* ── Generated output textarea ──────────────────────────────────────────── */

#generated-output {
    max-height: 360px;
    min-height: 120px;
    overflow: auto;
    white-space: pre-wrap;
    font-family: monospace;
    font-size: var(--cp-font-size-sm);
    line-height: 1.5;
    border: 1px solid var(--cp-border);
    border-radius: var(--cp-radius-md);
    padding: 10px 12px;
    background: var(--cp-surface-1);
    color: var(--cp-ink-2);
}

/* ── User bar (email + Help / Account / Sign Out) ───────────────────────── */

#user-bar {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 12px 14px 14px;
    background: #fff;
    border: 1px solid var(--cp-border);
    border-radius: var(--cp-radius-lg) var(--cp-radius-lg) 0 0;
    box-shadow: var(--cp-shadow-md);
    min-width: 200px;
}
.user-email {
    font-size: var(--cp-font-size-xs);
    color: var(--cp-ink-4);
    font-weight: 600;
    font-family: var(--cp-font);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.user-bar-actions {
    display: flex;
    gap: 6px;
}
.user-bar-btn {
    flex: 1;
    background: var(--cp-surface-0);
    border: 1px solid var(--cp-border);
    color: var(--cp-ink-2);
    font-size: var(--cp-font-size-xs);
    font-weight: 700;
    padding: 7px 4px;
    border-radius: var(--cp-radius-md);
    cursor: pointer;
    white-space: nowrap;
    text-align: center;
    font-family: var(--cp-font);
    transition: background 0.15s, border-color 0.15s;
}
.user-bar-btn:hover {
    background: var(--cp-surface-2);
    border-color: #ccc;
    color: var(--cp-ink);
}
.user-bar-signout {
    color: var(--cp-red);
    background: var(--cp-red-bg);
    border-color: var(--cp-red-border);
}
.user-bar-signout:hover {
    background: #fee2de;
    border-color: #f87171;
    color: #991b1b;
}

/* ── Editing bar (page name + Switch Page) ──────────────────────────────── */

#editing-bar {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 10px 14px;
    background: var(--cp-surface-1);
    border: 1px solid var(--cp-border);
    border-top: none;
    border-radius: 0 0 var(--cp-radius-lg) var(--cp-radius-lg);
    box-shadow: var(--cp-shadow-md);
    min-width: 200px;
}
#editing-bar-label {
    font-size: var(--cp-font-size-xs);
    font-weight: 700;
    color: var(--cp-orange);
    font-family: var(--cp-font);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
#editing-bar-actions { display: flex; gap: 6px; }

.editing-bar-switch-btn {
    flex: 1;
    background: var(--cp-green-bg);
    border: 1px solid var(--cp-green-border);
    color: var(--cp-green);
    font-size: var(--cp-font-size-sm);
    font-weight: 700;
    padding: 8px 10px;
    border-radius: var(--cp-radius-md);
    cursor: pointer;
    font-family: var(--cp-font);
    text-align: center;
    transition: background 0.15s, border-color 0.15s;
}
.editing-bar-switch-btn:hover {
    background: #dcfce7;
    border-color: var(--cp-green);
}
.editing-bar-switch-btn:disabled { opacity: 0.45; cursor: not-allowed; }

.publish-menu-btn {
    flex: 1;
    background: var(--cp-orange) !important;
    color: #fff !important;
    font-weight: 700 !important;
    border: none !important;
    font-size: var(--cp-font-size-sm) !important;
    padding: 8px 10px !important;
    border-radius: var(--cp-radius-md) !important;
    cursor: pointer !important;
    font-family: var(--cp-font) !important;
    transition: background 0.15s !important;
}
.publish-menu-btn:hover { background: var(--cp-orange-dark) !important; }

/* ── Privacy link & modal ───────────────────────────────────────────────── */

.privacy-link {
    display: block;
    margin-top: 20px;
    font-size: var(--cp-font-size-sm);
    color: var(--cp-ink-5);
    text-decoration: underline;
    cursor: pointer;
    font-family: var(--cp-font);
}
.privacy-link:hover { color: var(--cp-ink-3); }

.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.45);
    z-index: 100010;
    display: flex;
    align-items: center;
    justify-content: center;
}
.modal-overlay[hidden] { display: none; }

.modal-content {
    background: var(--cp-surface-0);
    width: 500px;
    max-width: 92%;
    max-height: 80vh;
    border-radius: var(--cp-radius-xl);
    display: flex;
    flex-direction: column;
    box-shadow: var(--cp-shadow-lg);
    border: 1px solid var(--cp-border);
    font-family: var(--cp-font);
}
.modal-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--cp-border-light);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
}
.modal-header h4 {
    margin: 0;
    font-size: var(--cp-font-size-lg);
    font-weight: 700;
    color: var(--cp-ink);
}
.modal-close {
    background: none;
    border: none;
    font-size: 18px;
    cursor: pointer;
    color: var(--cp-ink-5);
    transition: color 0.15s;
    padding: 2px 4px;
    line-height: 1;
}
.modal-close:hover { color: var(--cp-ink-2); }
.modal-body {
    padding: 20px;
    overflow-y: auto;
    font-size: var(--cp-font-size-md);
    color: var(--cp-ink-3);
    flex: 1;
    min-height: 0;
    line-height: 1.7;
}
.modal-body p { margin-bottom: 12px; }

/* ── Toaster ────────────────────────────────────────────────────────────── */

#toaster {
    background: var(--cp-ink) !important;
    border-radius: var(--cp-radius-md) !important;
    font-family: var(--cp-font) !important;
    font-size: var(--cp-font-size-sm) !important;
    font-weight: 600 !important;
    padding: 10px 18px !important;
    box-shadow: var(--cp-shadow-md) !important;
    letter-spacing: 0.01em !important;
    transition: opacity 0.25s ease;
    opacity: 0;
    pointer-events: none;
}


/* Authority Modal */
.auth-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0,0,0,0.5);
    z-index: 100000;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}
.auth-modal[hidden] { display: none; }

.auth-modal-content {
    background: #fff;
    width: 700px;
    max-width: 95%;
    height: 85vh;
    border-radius: 12px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: 0 10px 25px rgba(0,0,0,0.2);
}

.auth-modal-header {
    padding: 16px 20px;
    border-bottom: 1px solid #eee;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #fff;
    color: #2c3e50;
}
.auth-modal-header h4 { margin: 0; font-size: 18px; color: #2c3e50; }
.auth-close { background: none; border: none; font-size: 20px; cursor: pointer; color: #777; }

.auth-tabs {
    display: flex;
    border-bottom: 1px solid #eee;
    background: #f8f9fa;
}
.auth-tab {
    flex: 1;
    padding: 12px;
    background: none;
    border: none;
    cursor: pointer;
    font-weight: 600;
    color: #555;
    border-bottom: 3px solid transparent;
}
.auth-tab.active {
    color: #3498db;
    border-bottom-color: #3498db;
    background: #fff;
}

.auth-view {
    padding: 20px;
    overflow-y: auto;
    flex: 1;
    min-height: 0;
    -webkit-overflow-scrolling: touch;
}
.auth-view[hidden] { display: none; }

.gallery-section-title {
    margin: 10px 0 10px;
    font-size: 14px;
    text-transform: uppercase;
    color: #888;
    font-weight: 700;
}

.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
    gap: 10px;
    margin-bottom: 20px;
}

.gallery-item {
    width: 100%;
    aspect-ratio: 1/1;
    object-fit: cover;
    border-radius: 6px;
    cursor: pointer;
    border: 2px solid transparent;
    transition: all 0.2s;
    background: #eee;
}
.gallery-item:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}

.upload-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 140px;
    border: 2px dashed #e5e7eb;
    border-radius: 10px;
    background: #f9fafb;
    gap: 10px;
    margin-bottom: 20px;
    transition: border-color 0.15s;
}
.upload-placeholder:hover { border-color: #ec4899; }
.upload-placeholder p { color: #333 !important; font-family: 'Poppins', sans-serif; font-size: 14px; margin: 0; }

.video-lib-container {
    border-top: 1px solid #eee;
    padding-top: 10px;
}

.video-lib-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    max-height: 300px;
    overflow-y: auto;
    padding-right: 5px; /* space for scrollbar */
}

.video-lib-item {
    width: 100%;
    aspect-ratio: 16/9;
    object-fit: cover;
    border-radius: 4px;
    cursor: pointer;
    border: 2px solid transparent;
    transition: all 0.2s ease;
    background: #eee;
}

.video-lib-item:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 8px rgba(0,0,0,0.15);
    z-index: 1;
}

.video-lib-item.selected {
    border-color: #3b82f6;
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.3);
}

/* Video Animations */
/* Apply to .video-thumbnail AND .video-generated-poster via parent data-anim */
.youtube-video[data-anim="1"] .video-thumbnail, .youtube-video[data-anim="1"] .video-generated-poster { animation: v-pulse 3s infinite ease-in-out; }
.youtube-video[data-anim="2"] .video-thumbnail, .youtube-video[data-anim="2"] .video-generated-poster { animation: v-zoom-slow 5s infinite alternate ease-in-out; }
.youtube-video[data-anim="3"] .video-thumbnail, .youtube-video[data-anim="3"] .video-generated-poster { animation: v-pan-slow 6s infinite alternate ease-in-out; }
.youtube-video[data-anim="4"] .video-thumbnail, .youtube-video[data-anim="4"] .video-generated-poster { animation: v-heartbeat 2s infinite ease-in-out; }
.youtube-video[data-anim="5"] .video-thumbnail, .youtube-video[data-anim="5"] .video-generated-poster { animation: v-breath 4s infinite ease-in-out; }
.youtube-video[data-anim="6"] .video-thumbnail, .youtube-video[data-anim="6"] .video-generated-poster { animation: v-swing 4s infinite ease-in-out; }
.youtube-video[data-anim="7"] .video-thumbnail, .youtube-video[data-anim="7"] .video-generated-poster { animation: v-wobble 5s infinite ease-in-out; }
.youtube-video[data-anim="8"] .video-thumbnail, .youtube-video[data-anim="8"] .video-generated-poster { animation: v-sepia-flash 4s infinite; }
.youtube-video[data-anim="9"] .video-thumbnail, .youtube-video[data-anim="9"] .video-generated-poster { animation: v-hue-cycle 10s infinite linear; }
.youtube-video[data-anim="10"] .video-thumbnail, .youtube-video[data-anim="10"] .video-generated-poster { animation: v-blur-pulse 3s infinite alternate; }

/* Apply to .video-overlay via parent data-anim */
/* Note: We preserve the base transparent black (rgba(0,0,0,0.2)) where possible or replace it with the effect */

/* 11. Scanlines */
.youtube-video[data-anim="11"] .video-overlay { 
    background: linear-gradient(to bottom, rgba(255,255,255,0), rgba(255,255,255,0) 50%, rgba(0,0,0,0.1) 50%, rgba(0,0,0,0.1));
    background-size: 100% 4px; 
    animation: v-scanlines 0.5s infinite linear; 
    box-shadow: inset 0 0 20px rgba(0,0,0,0.3);
}

/* 12. Shine Sweep */
.youtube-video[data-anim="12"] .video-overlay { 
    background: linear-gradient(120deg, rgba(0,0,0,0.2) 30%, rgba(255,255,255,0.4) 50%, rgba(0,0,0,0.2) 70%); 
    background-size: 200% 100%; 
    animation: v-shine 3s infinite linear; 
}

/* 13. Radar Echo */
.youtube-video[data-anim="13"] .video-overlay { 
    background: radial-gradient(circle, rgba(255,255,255,0.3) 0%, rgba(0,0,0,0.2) 60%, rgba(0,0,0,0.2) 100%); 
    animation: v-radar 2s infinite ease-out; 
    opacity: 0.8;
}

/* 14. Random Flash */
.youtube-video[data-anim="14"] .video-overlay { 
    background-color: rgba(0,0,0,0.2);
    animation: v-flash-overlay 2s infinite; 
}

/* 15. Vignette Pulse */
.youtube-video[data-anim="15"] .video-overlay { 
    background-color: transparent;
    animation: v-vignette-pulse 3s infinite ease-in-out; 
}

/* 16. Moving Spotlight */
.youtube-video[data-anim="16"] .video-overlay { 
    background: radial-gradient(circle at 50% 50%, transparent 10%, rgba(0,0,0,0.6) 80%); 
    background-size: 150% 150%;
    animation: v-spotlight 6s infinite alternate ease-in-out; 
}

/* 17. Vertical Sweep */
.youtube-video[data-anim="17"] .video-overlay { 
    background: linear-gradient(0deg, rgba(0,0,0,0.2), rgba(50, 200, 255, 0.2), rgba(0,0,0,0.2)); 
    background-size: 100% 200%; 
    animation: v-matrix-sweep 3s infinite linear; 
}

/* 18. Curtain Wipe */
.youtube-video[data-anim="18"] .video-overlay { 
    background: linear-gradient(90deg, rgba(0,0,0,0.5) 0%, transparent 50%, rgba(0,0,0,0.5) 100%); 
    background-size: 200% 100%; 
    animation: v-curtain 4s infinite ease-in-out; 
}

/* 19 & 20 Filters on Content */
.youtube-video[data-anim="19"] .video-thumbnail, .youtube-video[data-anim="19"] .video-generated-poster { animation: v-contrast 2s infinite alternate ease-in-out; }
.youtube-video[data-anim="20"] .video-thumbnail, .youtube-video[data-anim="20"] .video-generated-poster { animation: v-dreamy 4s infinite ease-in-out; }

/* Variant Switcher (Floating Tabs) */
.variant-switcher {
    position: absolute;
    display: flex;
    gap: 6px;
    background: #2d3748;
    padding: 6px 8px;
    border-radius: 20px;
    z-index: 100000;
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease, transform 0.25s ease;
    transform: translateY(5px) scale(0.95);
}

.variant-switcher.visible {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0) scale(1);
}

.variant-tab {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: #4a5568;
    color: #fff;
    border: none;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    font-family: 'Nunito', sans-serif;
}

.variant-tab:hover {
    background: #718096;
    transform: scale(1.1);
}

.variant-tab.active {
    background: #3b82f6;
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.4);
}

/* Video Creator Styles */
.video-tab {
    flex: 1;
    padding: 12px;
    background: none;
    border: none;
    cursor: pointer;
    font-weight: 600;
    color: #555;
    border-bottom: 3px solid transparent;
}
.video-tab.active {
    color: #ec4899;
    border-bottom-color: #ec4899;
    background: #fff;
}

.creator-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

@media (max-width: 600px) {
    .creator-grid {
        grid-template-columns: 1fr;
    }
}

.line-input-group {
    display: flex;
    gap: 10px;
    align-items: center;
    margin-bottom: 15px;
}

.emoji-select {
    flex: 0 0 110px;
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
    background: #fff;
}

.line-input-group input[type="range"] {
    flex: 1;
}

.creator-preview-note {
    margin-top: 20px;
    text-align: center;
    font-style: italic;
    color: #666;
    font-size: 13px;
}

.modal-footer-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding: 15px 20px;
    border-top: 1px solid #eee;
    background: #fff;
    z-index: 10;
}

/* Input with Extension Group */
.input-with-extension {
    display: flex;
    align-items: stretch;
    margin-top: 5px;
}

.input-with-extension input {
    flex: 1;
    padding: 8px;
    border: 1px solid #ccc;
    border-right: none;
    border-radius: 4px 0 0 4px;
    font-size: 14px;
    width: auto; /* Override specific width */
}

.input-with-extension input:focus {
    outline: none;
    border-color: #3b82f6;
}

.input-with-extension .extension-label {
    padding: 8px 12px;
    background-color: #edf2f7;
    border: 1px solid #ccc;
    border-left: none;
    border-radius: 0 4px 4px 0;
    color: #4a5568;
    font-size: 14px;
    font-weight: 500;
    display: flex;
    align-items: center;
    user-select: none;
}

/* Exit Popup Styles */
.exit-popup-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.6);
    z-index: 200000;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    padding-top: 60px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

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

.exit-popup-content,
.exit-popup {
    background: white;
    padding: 30px 40px;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.25);
    text-align: center;
    position: relative;
    max-width: 90%;
    width: 420px;
    transform: translateY(-20px);
    transition: transform 0.3s ease;
}

.exit-popup-overlay.visible .exit-popup-content,
.exit-popup-overlay.visible .exit-popup {
    transform: translateY(0);
}

.exit-popup-close {
    position: absolute;
    top: 10px;
    right: 15px;
    border: none;
    background: none;
    font-size: 20px;
    cursor: pointer;
    color: #a0aec0;
    line-height: 1;
    transition: color 0.2s;
}

.exit-popup-close:hover {
    color: #4a5568;
}

.exit-popup-btn {
    display: inline-block;
    background-color: #e53e3e;
    color: white;
    text-decoration: none;
    padding: 12px 24px;
    border-radius: 6px;
    font-weight: bold;
    margin-top: 20px;
    transition: background 0.2s, transform 0.1s;
    font-size: 16px;
}

.exit-popup-btn:hover {
    background-color: #c53030;
    transform: translateY(-1px);
}

#exit-popup-text {
    font-size: 18px;
    font-weight: 700;
    color: #2d3748;
    line-height: 1.4;
    margin: 0;
}

/* New popup structure (matches index4) */
.exit-popup-text {
    font-size: 22px;
    font-weight: 800;
    color: #111;
    margin: 0 0 8px;
    line-height: 1.3;
}
.exit-popup-sub {
    font-size: 14px;
    color: #666;
    margin: 0 0 24px;
}
.exit-popup-cta {
    display: block;
    width: 100%;
    background: linear-gradient(135deg, #0ea5e9, #0284c7);
    color: #fff;
    border: none;
    border-radius: 8px;
    padding: 16px;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    font-family: 'Poppins', sans-serif;
    margin-top: 8px;
    transition: opacity 0.15s, transform 0.1s;
}
.exit-popup-cta:hover {
    opacity: 0.92;
    transform: translateY(-1px);
}

.exit-popup-img {
    display: none;
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    margin: 18px auto 22px;
}

/* Keyframes */
@keyframes v-pulse { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.05); } }
@keyframes v-zoom-slow { 0% { transform: scale(1); } 100% { transform: scale(1.15); } }
@keyframes v-pan-slow { 
    0% { transform: scale(1.2) translate(0, 0); } 
    100% { transform: scale(1.2) translate(-5%, -5%); } 
}
@keyframes v-heartbeat { 0% { transform: scale(1); } 15% { transform: scale(1.08); } 30% { transform: scale(1); } 45% { transform: scale(1.08); } 60% { transform: scale(1); } }
@keyframes v-breath { 0%, 100% { filter: brightness(100%); transform: scale(1); } 50% { filter: brightness(115%); transform: scale(1.03); } }
@keyframes v-swing { 0%, 100% { transform: rotate(0deg) scale(1.05); } 25% { transform: rotate(2deg) scale(1.05); } 75% { transform: rotate(-2deg) scale(1.05); } }
@keyframes v-wobble { 0%, 100% { transform: skew(0deg) scale(1.05); } 25% { transform: skew(2deg) scale(1.05); } 75% { transform: skew(-2deg) scale(1.05); } }
@keyframes v-sepia-flash { 0%, 100% { filter: sepia(0%); } 50% { filter: sepia(40%); } }
@keyframes v-hue-cycle { 0% { filter: hue-rotate(0deg); } 100% { filter: hue-rotate(360deg); } }
@keyframes v-blur-pulse { 0% { filter: blur(0px); } 100% { filter: blur(3px); } }
@keyframes v-scanlines { 0% { background-position: 0 0; } 100% { background-position: 0 100%; } }
@keyframes v-shine { 
    0% { background-position: 200% 0; } 
    100% { background-position: -200% 0; } 
}
@keyframes v-radar { 0% { transform: scale(0.8); opacity: 0.8; } 100% { transform: scale(1.5); opacity: 0; } }
@keyframes v-flash-overlay { 0%, 92%, 100% { background-color: rgba(0,0,0,0.2); } 96% { background-color: rgba(255,255,255,0.5); } }
@keyframes v-vignette-pulse { 0%, 100% { box-shadow: inset 0 0 50px rgba(0,0,0,0.3); } 50% { box-shadow: inset 0 0 150px rgba(0,0,0,0.8); } }
@keyframes v-spotlight { 0% { background-position: 20% 20%; } 100% { background-position: 80% 80%; } }
@keyframes v-matrix-sweep { 0% { background-position: 0 100%; } 100% { background-position: 0 -100%; } }
@keyframes v-curtain { 0% { background-position: 100% 0; } 100% { background-position: -100% 0; } }
@keyframes v-contrast { 
    0% { filter: contrast(100%) saturate(100%); } 
    100% { filter: contrast(130%) saturate(130%); } 
}
@keyframes v-dreamy { 
    0% { filter: blur(0px) brightness(100%); transform: scale(1); } 
    50% { filter: blur(1.5px) brightness(120%); transform: scale(1.02); } 
    100% { filter: blur(0px) brightness(100%); transform: scale(1); } 
}
/* ── Page Image Block (all squeeze templates) ──────────────────────────── */
.page-image-block {
    display: flex;
    justify-content: center;
    margin: 16px auto 20px;
    width: 100%;
    position: relative;
}
.page-image-block.hidden { display: none; }

.page-image-wrap {
    position: relative;
    display: inline-flex;
    justify-content: center;
    cursor: default;
    max-width: 100%;
}
body.is-editor .page-image-wrap {
    cursor: pointer;
}
.page-image-wrap img.page-img {
    display: block;
    width: 100%;
    height: auto;
    border-radius: 10px;
    object-fit: cover;
    transition: opacity 0.15s;
}
body.is-editor .page-image-wrap:hover img.page-img { opacity: 0.88; }

/* Click-to-change hint */
body.is-editor .page-image-wrap::after {
    content: '📷 Click to change';
    position: absolute;
    bottom: 8px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0,0,0,0.6);
    color: #fff;
    font-size: 11px;
    font-family: 'Poppins', sans-serif;
    font-weight: 600;
    padding: 4px 10px;
    border-radius: 20px;
    white-space: nowrap;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.15s;
}
body.is-editor .page-image-wrap:hover::after { opacity: 1; }

/* Placeholder */
.page-image-placeholder {
    width: 520px;
    max-width: 100%;
    height: 180px;
    border: 2px dashed #e5e7eb;
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    background: #fff;
    gap: 10px;
    transition: all 0.2s;
    box-sizing: border-box;
    box-shadow: 0 1px 4px rgba(0,0,0,0.04);
}
.page-image-placeholder:hover {
    border-color: #ec4899;
    background: #fdf2f8;
    box-shadow: 0 4px 16px rgba(236,72,153,0.1);
    transform: translateY(-1px);
}
.page-image-placeholder span:first-child {
    font-size: 0; /* hide broken image icon */
    display: flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    background: #fdf2f8;
    border-radius: 12px;
}
.page-image-placeholder span:first-child::before {
    content: '';
    display: block;
    width: 24px;
    height: 24px;
    background: #ec4899;
    mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2'%3E%3Crect x='3' y='3' width='18' height='18' rx='2'/%3E%3Ccircle cx='8.5' cy='8.5' r='1.5'/%3E%3Cpolyline points='21 15 16 10 5 21'/%3E%3C/svg%3E");
    mask-size: contain;
    mask-repeat: no-repeat;
    -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2'%3E%3Crect x='3' y='3' width='18' height='18' rx='2'/%3E%3Ccircle cx='8.5' cy='8.5' r='1.5'/%3E%3Cpolyline points='21 15 16 10 5 21'/%3E%3C/svg%3E");
    -webkit-mask-size: contain;
    -webkit-mask-repeat: no-repeat;
}
.page-image-placeholder span:last-child {
    font-size: 13px;
    font-weight: 600;
    color: #6b7280;
    font-family: 'Poppins', sans-serif;
}
.page-image-placeholder:hover span:last-child { color: #ec4899; }

/* ✕ dismiss button */
.page-image-dismiss {
    position: absolute;
    top: -10px;
    right: -10px;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: #e53e3e;
    color: #fff;
    border: none;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    z-index: 10;
    box-shadow: 0 2px 6px rgba(0,0,0,0.2);
    transition: background 0.15s, transform 0.1s;
    font-family: 'Poppins', sans-serif;
}
.page-image-dismiss:hover { background: #c53030; transform: scale(1.1); }

/* ── Page Image Resize Bar ─────────────────────────────────────────────── */
.page-image-resize-bar {
    display: flex;
    align-items: center;
    gap: 10px;
    background: #1e293b;
    border-radius: 10px;
    padding: 10px 16px;
    margin: 6px auto 12px;
    width: fit-content;
    max-width: 90%;
    box-shadow: 0 4px 16px rgba(0,0,0,0.18);
    flex-wrap: wrap;
    justify-content: center;
}
.pir-label {
    font-size: 12px;
    color: #94a3b8;
    font-family: 'Poppins', sans-serif;
    white-space: nowrap;
}
.pir-val { color: #fff; }
.pir-slider {
    width: 140px;
    accent-color: #ff6b35;
    cursor: pointer;
}
.pir-change-btn, .pir-done-btn {
    background: #334155;
    color: #fff;
    border: none;
    border-radius: 6px;
    padding: 5px 10px;
    font-size: 12px;
    font-family: 'Poppins', sans-serif;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s;
    white-space: nowrap;
}
.pir-change-btn:hover { background: #475569; }
.pir-done-btn { background: #ff6b35; }
.pir-done-btn:hover { background: #e55a25; }

/* ── Page Image Restore Pill ───────────────────────────────────────────── */
.page-image-restore-pill {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    margin: 4px auto 16px;
    width: fit-content;
    padding: 7px 16px;
    background: #f1f5f9;
    border: 1.5px dashed #94a3b8;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    font-family: 'Poppins', sans-serif;
    color: #64748b;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.page-image-restore-pill:hover {
    background: #fff8f5;
    border-color: #ff6b35;
    color: #ff6b35;
}

/* ── Page Image Gallery Modal ──────────────────────────────────────────── */
.pig-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.35);
    z-index: 100050;
    backdrop-filter: blur(4px);
    align-items: center;
    justify-content: center;
    padding: 20px;
}
.pig-modal {
    background: #fff;
    border-radius: 14px;
    width: 100%;
    max-width: 680px;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0,0,0,0.12);
}
.pig-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid #f3f4f6;
    flex-shrink: 0;
}
.pig-header h4 {
    font-size: 16px;
    font-weight: 700;
    font-family: 'Poppins', sans-serif;
    color: #111;
    margin: 0;
}
.pig-close {
    background: #f3f4f6;
    border: none;
    font-size: 13px;
    cursor: pointer;
    color: #9ca3af;
    line-height: 1;
    padding: 0;
    width: 28px;
    height: 28px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s;
}
.pig-close:hover { background: #e5e7eb; color: #374151; }
.pig-toolbar {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 20px;
    border-bottom: 1px solid #f3f4f6;
    background: #f9fafb;
    flex-shrink: 0;
}
.pig-upload-btn {
    background: #ec4899;
    color: #fff;
    border: none;
    border-radius: 7px;
    padding: 8px 14px;
    font-size: 13px;
    font-weight: 700;
    font-family: 'Poppins', sans-serif;
    cursor: pointer;
    transition: background 0.15s;
}
.pig-upload-btn:hover { background: #db2777; }
.pig-count {
    font-size: 12px;
    color: #999;
    font-family: 'Poppins', sans-serif;
}
.pig-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 10px;
    padding: 16px 20px;
    overflow-y: auto;
    background: #fff;
    flex: 1;
}
.pig-cell {
    position: relative;
    border-radius: 8px;
    overflow: hidden;
    aspect-ratio: 1;
    background: #f9fafb;
    cursor: pointer;
    border: 2px solid transparent;
    transition: border-color 0.15s, transform 0.1s;
}
.pig-cell:hover { border-color: #ec4899; transform: scale(1.02); box-shadow: 0 4px 12px rgba(236,72,153,0.15); }
.pig-cell img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
.pig-delete {
    position: absolute;
    top: 5px;
    right: 5px;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: rgba(220,38,38,0.85);
    color: #fff;
    border: none;
    font-size: 11px;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.15s;
    z-index: 2;
    font-family: 'Poppins', sans-serif;
}
.pig-cell:hover .pig-delete { opacity: 1; }
.pig-loading, .pig-empty {
    grid-column: 1 / -1;
    text-align: center;
    padding: 40px 20px;
    color: #999;
    font-size: 14px;
    font-family: 'Poppins', sans-serif;
}

/* ── Editor UI Responsive ──────────────────────────────────────────────────── */

/* Below 1024px — compact the project-wrapper so it doesn't overlap toolbar */
@media (max-width: 1024px) {
    #project-wrapper {
        top: auto;
        bottom: 80px;
        right: 70px; /* clear the floating toolbar */
    }
}

/* Below 900px — move project-wrapper to left side */
@media (max-width: 900px) {
    #project-wrapper {
        top: 12px;
        right: auto;
        left: 12px;
        bottom: auto;
    }
    .project-btn { font-size: 12px; padding: 8px 14px; }
    .project-menu { left: 0; right: auto; }
}

/* Below 768px — hide text labels on floating toolbar, icons only */
@media (max-width: 768px) {
    .ftb-btn span {
        display: none !important;
    }
    .ftb-btn {
        padding: 10px 12px !important;
        min-width: unset !important;
    }
    /* Settings panel full width */
    .project-panel {
        width: 92% !important;
        right: 4% !important;
        left: 4% !important;
        top: 56px !important;
    }
    /* Editor panels full width */
    .editor-panel {
        width: 92% !important;
        right: 4% !important;
        left: 4% !important;
    }
    /* Text toolbar wraps on small screens */
    .cp-tt {
        max-width: 95vw !important;
    }
}

/* Below 600px — hide floating toolbar entirely, rely on settings panel */
@media (max-width: 600px) {
    #floating-toolbar {
        display: none !important;
    }
    #project-wrapper {
        top: 8px;
        left: 8px;
    }
    .settings-btn {
        bottom: 12px;
        right: 12px;
    }
}


/* ═══════════════════════════════════════════════════════════════════════════
   CP TOP BAR — Full-width editor chrome
   ═══════════════════════════════════════════════════════════════════════════ */

#project-wrapper {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    width: 100% !important;
    height: auto !important;
    z-index: 99990 !important;
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    padding: 0 !important;
    margin: 0 !important;
    display: none; /* auth.js sets to block when authenticated */
}

.cp-topbar {
    display: flex;
    align-items: center;
    background: #ffffff;
    border-bottom: 1px solid #e5e7eb;
    height: 52px;
    padding: 0 16px;
    gap: 8px;
    font-family: 'Poppins', sans-serif;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 99990;
}

/* Push page content down so top bar doesn't overlap it */
body.is-editor {
    padding-top: 52px !important;
}

/* LEFT zone */
.cp-topbar-left {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
    min-width: 0;
}

.cp-topbar-logo {
    background: #ec4899;
    color: #fff;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.04em;
    padding: 5px 9px;
    border-radius: 6px;
    flex-shrink: 0;
}
.cp-topbar-logo-img {
    flex-shrink: 0;
    display: block;
}

.cp-topbar-page {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
    padding-left: 12px;
    border-left: 1px solid #e5e7eb;
}

.cp-topbar-pagename {
    font-size: 13.5px;
    font-weight: 600;
    color: #374151;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 200px;
}

.cp-topbar-switch {
    background: #f3f4f6;
    border: 1px solid #e5e7eb;
    color: #6b7280;
    font-size: 12px;
    font-weight: 600;
    font-family: 'Poppins', sans-serif;
    padding: 5px 11px;
    border-radius: 5px;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.15s;
}
.cp-topbar-switch:hover { background: #e5e7eb; color: #374151; }

/* CENTRE zone */
.cp-topbar-centre {
    display: flex;
    align-items: center;
    gap: 2px;
    flex: 1;
    justify-content: center;
}

/* Shared button style */
.cp-topbar-btn {
    display: flex;
    align-items: center;
    gap: 5px;
    background: transparent;
    border: 1px solid transparent;
    color: #6b7280;
    font-size: 12.5px;
    font-weight: 600;
    font-family: 'Poppins', sans-serif;
    padding: 6px 12px;
    border-radius: 6px;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.15s;
}
.cp-topbar-btn:hover {
    background: #f3f4f6;
    border-color: #e5e7eb;
    color: #111827;
}
.cp-topbar-btn svg { flex-shrink: 0; }

.cp-topbar-sep { width: 1px; height: 20px; background: #e5e7eb; margin: 0 4px; }

/* Update button — green */
.cp-topbar-btn--update {
    color: #16a34a !important;
    border-color: #bbf7d0 !important;
    background: #f0fdf4 !important;
}
.cp-topbar-btn--update:hover {
    background: #dcfce7 !important;
    border-color: #86efac !important;
}

/* Publish button — solid black Gumroad-style */
.cp-topbar-btn--publish {
    background: #111827 !important;
    color: #fff !important;
    border-color: #111827 !important;
    font-weight: 700 !important;
    padding: 6px 16px !important;
}
.cp-topbar-btn--publish:hover {
    background: #1f2937 !important;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0,0,0,0.15) !important;
}

/* RIGHT zone */
.cp-topbar-right {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}

.cp-topbar-divider {
    width: 1px;
    height: 22px;
    background: #e5e7eb;
    margin: 0 4px;
}

/* Account avatar button */
.cp-topbar-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: #ec4899;
    color: #fff;
    font-size: 13px;
    font-weight: 700;
    font-family: 'Poppins', sans-serif;
    border: 2px solid #fce7f3;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.15s, box-shadow 0.15s;
}
.cp-topbar-avatar:hover { transform: scale(1.05); box-shadow: 0 2px 8px rgba(236,72,153,0.3); }

/* Account dropdown */
.cp-account-dropdown {
    position: absolute;
    top: 56px;
    right: 12px;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.1);
    min-width: 210px;
    padding: 6px;
    z-index: 100000;
    font-family: 'Poppins', sans-serif;
}
.cp-account-dropdown[hidden] { display: none; }

.cp-account-email {
    font-size: 11px;
    color: #9ca3af;
    padding: 6px 10px 10px;
    border-bottom: 1px solid #f3f4f6;
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.cp-account-item {
    display: block;
    width: 100%;
    padding: 8px 10px;
    font-size: 12px;
    font-weight: 600;
    color: #374151;
    background: none;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    text-align: left;
    text-decoration: none;
    font-family: 'Poppins', sans-serif;
    transition: background 0.12s;
    box-sizing: border-box;
}
.cp-account-item:hover { background: #f3f4f6; color: #111827; }
.cp-account-signout { color: #ef4444 !important; }
.cp-account-signout:hover { background: #fef2f2 !important; }

/* ── Mobile ── */
@media (max-width: 600px) {
    .cp-topbar-centre { display: none; }
    .cp-topbar-right .cp-topbar-btn--update,
    .cp-topbar-right .cp-topbar-btn--publish { display: none !important; }
    #floating-toolbar { display: flex !important; }
}

/* ── Compact at mid-sizes ── */
@media (max-width: 900px) {
    .cp-topbar-pagename { max-width: 100px; }
    .cp-topbar-btn { padding: 5px 8px; font-size: 10px; }
}


/* Settings gear button hidden — replaced by top bar Settings button */
#settings-btn { display: none !important; }
