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

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; /* Increased overlap */
    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;
}

.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;
}

.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; }
}

/* Floating Project button & Menu */
#project-wrapper {
    position: fixed;
    top: 18px;
    right: 18px;
    z-index: 99990;
}

.project-btn {
    background: #2d3748;
    color: #fff;
    border: none;
    padding: 10px 14px;
    border-radius: 8px;
    cursor: pointer;
    box-shadow: 0 6px 18px rgba(0,0,0,0.18);
    font-weight: 600;
    min-width: 64px;
    display: block;
}

.project-menu {
    position: absolute;
    top: 45px;
    right: 0;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.15);
    width: 160px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.project-menu[hidden] {
    display: none;
}

.menu-item {
    padding: 12px 16px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    color: #2d3748;
    transition: background 0.2s;
    text-align: left;
    border-bottom: 1px solid #f1f5f9;
}

.menu-item:last-child {
    border-bottom: none;
}

.menu-item:hover {
    background: #f7fafc;
    color: #3b82f6;
}

/* Modal Helpers */
.small-modal {
    width: 400px;
    max-width: 90%;
}

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

.small-btn {
    padding: 8px 16px !important;
    font-size: 14px !important;
    border-radius: 6px !important;
}

.secondary {
    background: #e2e8f0 !important;
    color: #4a5568 !important;
    box-shadow: none !important;
}

.secondary:hover {
    background: #cbd5e1 !important;
    transform: none !important;
}

/* Floating Settings button */
.settings-btn {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 99990;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: #2d3748;
    color: #fff;
    border: none;
    box-shadow: 0 6px 20px rgba(0,0,0,0.25);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.3s ease, background-color 0.2s;
}

.settings-btn:hover {
    background-color: #1a202c;
    transform: rotate(45deg);
}

.settings-btn svg {
    pointer-events: none;
}

/* Editor Panels (Project & Button) */
.project-panel, .editor-panel {
    position: fixed;
    top: 70px;
    right: 18px;
    width: 320px;
    max-width: 95%;
    max-height: 80vh;
    overflow-y: auto;
    background: #ffffff;
    border-radius: 10px;
    box-shadow: 0 12px 30px rgba(0,0,0,0.18);
    z-index: 99995;
    padding: 16px;
    border: 1px solid rgba(0,0,0,0.06);
}

.project-panel { 
    width: 420px; 
    display: none;
    max-height: 85vh;
    flex-direction: column;
    overflow: hidden;
}
.editor-panel[hidden] { display: none; }

.editor-header, .panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    border-bottom: 1px solid #eee;
    padding-bottom: 10px;
}
.editor-header h4, .panel-header h4 { margin: 0; font-size: 16px; color: #2c3e50; }
.editor-close, .panel-close { background: none; border: none; font-size: 18px; cursor: pointer; color: #888; }

.control-group { margin-bottom: 15px; }
.control-group label { display: block; font-size: 13px; margin-bottom: 5px; color: #555; font-weight: 600; }
.control-group input[type="color"] { width: 100%; height: 36px; padding: 0; border: none; cursor: pointer; }
.control-group input[type="range"] { width: 100%; cursor: pointer; }

#btn-target-url {
    width: 100%;
    padding: 10px 12px;
    margin-top: 6px;
    border: 1px solid #cbd5e0;
    border-radius: 6px;
    font-size: 14px;
    color: #2d3748;
    background-color: #fff;
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.06);
    transition: all 0.2s ease;
}

#btn-target-url:focus {
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15), inset 0 1px 2px rgba(0,0,0,0.06);
    outline: none;
}

/* Panel Navigation (Top Tabs) */
.panel-nav {
    display: flex;
    border-bottom: 1px solid #eee;
    margin-bottom: 15px;
}
.panel-nav-btn {
    flex: 1;
    padding: 10px;
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    cursor: pointer;
    font-weight: 600;
    color: #777;
    font-size: 14px;
}
.panel-nav-btn.active {
    color: #2c3e50;
    border-bottom-color: #3498db;
}

/* AI Sub-Tabs */
.ai-tabs { display: flex; gap: 8px; margin-bottom: 10px; }
.ai-tab {
    background: #e2e8f0;
    border: 1px solid rgba(0,0,0,0.06);
    padding: 10px 14px;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 700;
    font-size: 13px;
    color: #4a5568;
    transition: all 0.2s;
    flex: 1;
}
.ai-tab:hover { background: #cbd5e1; }
.ai-tab.active { 
    background: #3b82f6; 
    color: white;
    border-color: #2563eb;
    box-shadow: 0 2px 4px rgba(59, 130, 246, 0.3);
}

/* Common Inputs */
.ai-tab-content label, .settings-group label { display: block; font-size: 13px; margin-top: 8px; color: #333; font-weight: 600; }
.ai-tab-content input, .ai-tab-content textarea,
.settings-group input[type="text"], .settings-group textarea {
    width: 100%;
    padding: 8px;
    margin-top: 6px;
    border: 1px solid rgba(0,0,0,0.08);
    border-radius: 6px;
    font-family: inherit;
    font-size: 14px;
    box-sizing: border-box;
}

/* Sticky apply button in paste tab */
#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 10px rgba(255,255,255,0.8);
}

.panel-view {
    overflow-y: auto; /* Enable vertical scrolling for content */
    flex: 1; /* Take remaining space */
    min-height: 0; /* Firefox flex fix */
    padding-right: 4px; /* Space for scrollbar */
    scroll-behavior: smooth;
}

.panel-view[hidden] { display: none; }

.settings-group { margin-bottom: 16px; }
.settings-section-title {
    font-size: 16px;
    color: #1a202c;
    border-bottom: 2px solid #e2e8f0;
    padding-bottom: 8px;
    margin: 25px 0 15px;
    font-weight: 800;
}
.settings-section-title:first-child { margin-top: 5px; }

.settings-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
}
.settings-row label { font-size: 14px; color: #333; cursor: pointer; }

/* Privacy Link */
.privacy-link {
    display: block;
    margin-top: 20px;
    font-size: 13px;
    color: #999;
    text-decoration: underline;
    cursor: pointer;
}
.privacy-link:hover { color: #666; }

/* Privacy Modal */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0,0,0,0.5);
    z-index: 100010;
    display: flex;
    align-items: center;
    justify-content: center;
}
.modal-overlay[hidden] { display: none; }
.modal-content {
    background: #fff;
    width: 500px;
    max-width: 90%;
    max-height: 80vh;
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    box-shadow: 0 10px 25px rgba(0,0,0,0.2);
}
.modal-header {
    padding: 16px;
    border-bottom: 1px solid #eee;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.modal-header h4 { margin: 0; }
.modal-close { background: none; border: none; font-size: 18px; cursor: pointer; color: #888; }
.modal-body {
    padding: 20px;
    overflow-y: auto;
    font-size: 14px;
    color: #444;
    flex: 1;
    min-height: 0;
}
.modal-body p { margin-bottom: 12px; }
#generated-output {
    max-height: 360px;
    min-height: 120px;
    overflow: auto;
    white-space: pre-wrap;
    font-family: monospace;
    font-size: 13px;
    line-height: 1.4;
    border: 1px solid rgba(0,0,0,0.08);
    border-radius: 6px;
    padding: 8px;
}
.generate-btn {
    margin-top: 10px;
    width: 100%;
    padding: 10px;
    background: #2d3748;
    color: #fff;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 700;
}

.generate-btn:disabled {
    background: #a0aec0;
    cursor: not-allowed;
    opacity: 0.7;
}

#setting-btn-layout {
    width: 100%;
    padding: 8px;
    border: 1px solid rgba(0,0,0,0.08);
    border-radius: 6px;
    font-size: 14px;
    margin-top: 6px;
    background-color: #fff;
    cursor: pointer;
}

/* simple toaster styling (matches project button look) */
#toaster {
  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;
}
.auth-modal[hidden] { display: none; }

.auth-modal-content {
    background: #fff;
    width: 600px;
    max-width: 90%;
    max-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;
}
.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;
}
.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 #ddd;
    border-radius: 8px;
    background: #fafafa;
    gap: 10px;
    margin-bottom: 20px;
}

.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: #3498db;
    border-bottom-color: #3498db;
    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: 8px;
    margin-bottom: 15px;
}

.emoji-select {
    width: 60px;
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 16px;
}

.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 {
    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 {
    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;
}

/* 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); } 
}