/* ============================================
   Luminary Video — Main Stylesheet
   Dark cinematic theme
   ============================================ */

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

/* ---- Variables ---- */
:root {
    --bg:         #0a0a0f;
    --bg2:        #111118;
    --bg3:        #1a1a24;
    --border:     #2a2a38;
    --border2:    #3a3a50;
    --accent:     #6c63ff;
    --accent2:    #a78bfa;
    --accent-glow:rgba(108,99,255,0.25);
    --success:    #22c55e;
    --danger:     #ef4444;
    --warning:    #f59e0b;
    --text:       #e8e8f0;
    --text2:      #9898b0;
    --text3:      #5a5a78;
    --radius:     12px;
    --radius-sm:  8px;
    --radius-lg:  20px;
    --shadow:     0 4px 24px rgba(0,0,0,0.4);
    --shadow-lg:  0 8px 48px rgba(0,0,0,0.6);
    --font-head:  'Syne', sans-serif;
    --font-body:  'DM Sans', sans-serif;
    --nav-h:      64px;
}

/* ---- Reset ---- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; scroll-behavior: smooth; }
body {
    background: var(--bg);
    color: var(--text);
    font-family: var(--font-body);
    font-size: 0.95rem;
    line-height: 1.6;
    min-height: 100vh;
}
a { color: var(--accent2); text-decoration: none; }
a:hover { color: var(--text); }
img, video { max-width: 100%; display: block; }
button { font-family: var(--font-body); cursor: pointer; border: none; }

/* ---- Navbar ---- */
.navbar {
    position: sticky;
    top: 0;
    z-index: 200;
    height: var(--nav-h);
    background: rgba(10,10,15,0.95);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    padding: 0 2rem;
    gap: 2rem;
}
.nav-logo {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text);
    font-family: var(--font-head);
    font-weight: 800;
    font-size: 1.1rem;
    letter-spacing: -0.02em;
    text-decoration: none;
}
.logo-icon {
    width: 32px;
    height: 32px;
    background: var(--accent);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    box-shadow: 0 0 16px var(--accent-glow);
}
.nav-logo-img {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    object-fit: cover;
    box-shadow: 0 0 16px var(--accent-glow);
}
.nav-links {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    flex: 1;
}
.nav-link {
    color: var(--text2);
    font-size: 0.9rem;
    font-weight: 500;
    padding: 0.4rem 0.85rem;
    border-radius: var(--radius-sm);
    transition: all 0.2s;
    text-decoration: none;
}
.nav-link:hover, .nav-link.active {
    color: var(--text);
    background: var(--bg3);
}
.nav-user {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-left: auto;
}
.nav-username {
    font-weight: 600;
    color: var(--text2);
    font-size: 0.85rem;
}

/* ---- Storage mini ---- */
.storage-mini {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.75rem;
    color: var(--text3);
}
.storage-bar-mini {
    width: 64px;
    height: 4px;
    background: var(--bg3);
    border-radius: 99px;
    overflow: hidden;
}
.storage-fill-mini {
    height: 100%;
    background: var(--accent);
    border-radius: 99px;
    transition: width 0.5s ease;
}

/* ---- Main content ---- */
.main-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2.5rem 2rem;
}

/* ---- Auth Pages ---- */
.auth-page {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background:
        radial-gradient(ellipse at 20% 50%, rgba(108,99,255,0.08) 0%, transparent 60%),
        radial-gradient(ellipse at 80% 20%, rgba(167,139,250,0.06) 0%, transparent 50%),
        var(--bg);
}
.auth-container {
    width: 100%;
    max-width: 420px;
    padding: 1.5rem;
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
}
.auth-page .vp-footer {
    width: 100%;
    margin-top: 0;
}
.auth-card {
    background: var(--bg2);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 2.5rem;
    box-shadow: var(--shadow-lg);
}
.auth-logo {
    text-align: center;
    margin-bottom: 2rem;
}
.auth-logo a {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-family: var(--font-head);
    font-weight: 800;
    font-size: 1.2rem;
    color: var(--text);
    text-decoration: none;
}
.auth-card h1 {
    font-family: var(--font-head);
    font-size: 1.6rem;
    font-weight: 700;
    letter-spacing: -0.03em;
    margin-bottom: 0.4rem;
}
.auth-sub {
    color: var(--text2);
    margin-bottom: 1.5rem;
}
.auth-link {
    text-align: center;
    margin-top: 1.5rem;
    color: var(--text2);
    font-size: 0.9rem;
}

/* ---- Forms ---- */
.auth-form, .form-group { display: flex; flex-direction: column; gap: 1rem; }
.form-group { gap: 0.4rem; }
.form-group label {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text2);
    letter-spacing: 0.02em;
}
.form-group label .hint { font-weight: 400; color: var(--text3); }
.form-group label .required { color: var(--accent); }
.form-group input,
.form-group textarea,
.form-group select {
    background: var(--bg3);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text);
    font-family: var(--font-body);
    font-size: 0.95rem;
    padding: 0.7rem 1rem;
    width: 100%;
    transition: border-color 0.2s, box-shadow 0.2s;
    outline: none;
    resize: vertical;
}
.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-glow);
}
.form-group select { appearance: none; cursor: pointer; }
.form-row {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
}
.char-count {
    font-size: 0.75rem;
    color: var(--text3);
    text-align: right;
}

/* ---- Buttons ---- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    padding: 0.65rem 1.25rem;
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    font-weight: 600;
    font-family: var(--font-body);
    cursor: pointer;
    transition: all 0.2s;
    border: 1px solid transparent;
    text-decoration: none;
    white-space: nowrap;
}
.btn-primary {
    background: var(--accent);
    color: #fff;
    box-shadow: 0 0 20px var(--accent-glow);
}
.btn-primary:hover {
    background: #7c74ff;
    color: #fff;
    box-shadow: 0 0 32px var(--accent-glow);
    transform: translateY(-1px);
}
.btn-ghost {
    background: transparent;
    border-color: var(--border2);
    color: var(--text2);
}
.btn-ghost:hover { background: var(--bg3); color: var(--text); border-color: var(--border2); }
.btn-danger { background: transparent; border-color: var(--danger); color: var(--danger); }
.btn-danger:hover { background: var(--danger); color: #fff; }
.btn-full { width: 100%; }
.btn-large { padding: 0.85rem 1.5rem; font-size: 1rem; }
.btn-sm { padding: 0.4rem 0.85rem; font-size: 0.8rem; }
.btn-link {
    background: none;
    border: none;
    color: var(--accent2);
    font-family: var(--font-body);
    font-size: inherit;
    cursor: pointer;
    padding: 0;
    text-decoration: underline;
}
.btn-link:hover { color: var(--text); }

/* ---- Alerts ---- */
.alert {
    padding: 0.85rem 1.1rem;
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    margin-bottom: 1rem;
    border: 1px solid transparent;
    position: relative;
    z-index: 150;
}
.alert-success { background: rgba(34,197,94,0.1); border-color: rgba(34,197,94,0.3); color: #4ade80; }
.alert-error   { background: rgba(239,68,68,0.1);  border-color: rgba(239,68,68,0.3);  color: #f87171; }
.alert-warning { background: rgba(245,158,11,0.1); border-color: rgba(245,158,11,0.3); color: #fbbf24; }

/* ---- Dashboard Layout ---- */
.generate-layout {
    display: grid;
    grid-template-columns: 1fr 380px;
    gap: 2rem;
    align-items: start;
}
.generate-panel, .jobs-panel {
    background: var(--bg2);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 2rem;
}
.generate-panel h2, .jobs-panel h2 {
    font-family: var(--font-head);
    font-size: 1.3rem;
    font-weight: 700;
    margin-bottom: 1.5rem;
    letter-spacing: -0.02em;
}
.generate-note {
    text-align: center;
    color: var(--text3);
    font-size: 0.8rem;
    margin-top: 1rem;
}
.generate-panel .form-group { margin-bottom: 1.25rem; }

/* ---- Upload Area ---- */
.upload-area {
    border: 2px dashed var(--border2);
    border-radius: var(--radius);
    padding: 1.5rem;
    text-align: center;
    cursor: pointer;
    transition: border-color 0.2s, background 0.2s;
}
.upload-area:hover, .upload-area.drag-over {
    border-color: var(--accent);
    background: rgba(108,99,255,0.04);
}
.upload-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.4rem;
    color: var(--text2);
    font-size: 0.9rem;
}
.upload-icon { font-size: 2rem; }
.upload-hint { font-size: 0.75rem; color: var(--text3); }
.upload-preview {
    position: relative;
    display: inline-block;
}
.upload-preview img {
    max-height: 180px;
    border-radius: var(--radius-sm);
    margin: 0 auto;
}
.btn-remove {
    display: block;
    margin: 0.5rem auto 0;
    background: transparent;
    border: 1px solid var(--border2);
    color: var(--text2);
    font-size: 0.8rem;
    padding: 0.3rem 0.8rem;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.2s;
}
.btn-remove:hover { border-color: var(--danger); color: var(--danger); }

/* ---- Jobs Panel ---- */
.jobs-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1rem;
}
.jobs-header h2 { margin-bottom: 0; }
.jobs-list { display: flex; flex-direction: column; gap: 0.75rem; }
.job-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.85rem;
    background: var(--bg3);
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    transition: border-color 0.2s;
}
.job-item:hover { border-color: var(--border2); }
.job-thumb {
    width: 56px;
    height: 40px;
    border-radius: 6px;
    overflow: hidden;
    flex-shrink: 0;
    background: var(--bg);
    display: flex;
    align-items: center;
    justify-content: center;
}
.job-thumb img, .job-thumb video { width: 100%; height: 100%; object-fit: cover; }
.job-info { flex: 1; min-width: 0; overflow: hidden; }
.job-prompt {
    font-size: 0.82rem;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: var(--text);
    max-width: 100%;
    min-width: 0;
}
.job-meta { font-size: 0.75rem; color: var(--text3); margin-top: 0.15rem; }
.job-status {
    font-size: 0.75rem;
    font-weight: 600;
    padding: 0.25rem 0.6rem;
    border-radius: 99px;
    flex-shrink: 0;
}
.status-complete  { background: rgba(34,197,94,0.15);  color: #4ade80; }
.status-pending   { background: rgba(108,99,255,0.15); color: var(--accent2); }
.status-processing{ background: rgba(245,158,11,0.15); color: #fbbf24; }
.status-failed    { background: rgba(239,68,68,0.15);  color: #f87171; }
.jobs-loading { text-align: center; color: var(--text3); padding: 2rem; }
.jobs-empty   { text-align: center; color: var(--text3); padding: 2rem; font-size: 0.9rem; }

/* ---- Video Grid ---- */
.video-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.5rem;
}
.video-card {
    background: var(--bg2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    transition: border-color 0.2s, transform 0.2s;
}
.video-card:hover { border-color: var(--border2); transform: translateY(-2px); }
.video-thumb {
    position: relative;
    aspect-ratio: 16/9;
    background: var(--bg3);
    overflow: hidden;
}
.video-thumb img,
.video-thumb video {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.video-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.2s;
}
.video-thumb:hover .video-overlay { opacity: 1; }
.btn-play {
    width: 48px;
    height: 48px;
    background: rgba(255,255,255,0.9);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #111;
    font-size: 1.1rem;
    text-decoration: none;
    transition: transform 0.2s;
}
.btn-play:hover { transform: scale(1.1); color: #111; }
.status-thumb {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}
.status-pending  { background: rgba(108,99,255,0.08); }
.status-failed   { background: rgba(239,68,68,0.08);  }
.status-pending span  { font-size: 1.5rem; }
.status-failed span   { font-size: 1.5rem; color: var(--danger); }
.status-pending p, .status-failed p { font-size: 0.82rem; color: var(--text2); }
.countdown { font-size: 0.75rem !important; color: var(--text3) !important; }
.video-info { padding: 1rem; }
.video-prompt {
    font-size: 0.85rem;
    color: var(--text);
    margin-bottom: 0.5rem;
    line-height: 1.5;
}
.video-meta {
    display: flex;
    justify-content: space-between;
    font-size: 0.75rem;
    color: var(--text3);
    margin-bottom: 0.75rem;
}
.video-actions {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

/* ---- Library Header ---- */
.library-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: 2rem;
    gap: 2rem;
}
.library-header h1 {
    font-family: var(--font-head);
    font-size: 2rem;
    font-weight: 800;
    letter-spacing: -0.04em;
}
.library-header p { color: var(--text2); margin-top: 0.25rem; }
.storage-block { min-width: 220px; }
.storage-label {
    display: flex;
    justify-content: space-between;
    font-size: 0.8rem;
    color: var(--text2);
    margin-bottom: 0.4rem;
}
.storage-bar {
    height: 6px;
    background: var(--bg3);
    border-radius: 99px;
    overflow: hidden;
}
.storage-fill {
    height: 100%;
    background: var(--accent);
    border-radius: 99px;
    transition: width 0.5s ease;
}
.storage-warning { background: var(--warning); }
.storage-alert { font-size: 0.78rem; color: var(--warning); margin-top: 0.4rem; }

/* ---- Gallery Header ---- */
.gallery-header { margin-bottom: 2rem; }
.gallery-header h1 {
    font-family: var(--font-head);
    font-size: 2rem;
    font-weight: 800;
    letter-spacing: -0.04em;
}
.gallery-header p { color: var(--text2); margin-top: 0.25rem; }
.gallery-cta {
    margin-top: 4rem;
    text-align: center;
    padding: 3rem;
    background: var(--bg2);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
}
.gallery-cta h3 {
    font-family: var(--font-head);
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
}
.gallery-cta p { color: var(--text2); margin-bottom: 1.5rem; }

/* ---- Video Page ---- */
.video-page-layout {
    display: grid;
    grid-template-columns: 1fr 360px;
    gap: 2rem;
    align-items: start;
}
.video-player-wrap {
    background: #000;
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-lg);
}
.video-player { width: 100%; display: block; }
.video-page-info {
    background: var(--bg2);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1.75rem;
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}
.video-page-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    font-size: 0.85rem;
    color: var(--text2);
}
.video-page-prompt h3, .video-page-prompt h4 {
    font-family: var(--font-head);
    font-size: 0.85rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: var(--text3);
    margin-bottom: 0.4rem;
}
.video-page-prompt p { color: var(--text); font-size: 0.9rem; line-height: 1.6; }
.video-page-prompt .negative { color: var(--text2); font-style: italic; }
.owner-controls {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

/* ---- Share Buttons ---- */
.share-section h3 {
    font-family: var(--font-head);
    font-size: 0.85rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: var(--text3);
    margin-bottom: 0.75rem;
}
.share-buttons { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.share-btn {
    padding: 0.5rem 1rem;
    border-radius: var(--radius-sm);
    font-size: 0.82rem;
    font-weight: 600;
    font-family: var(--font-body);
    cursor: pointer;
    transition: all 0.2s;
    border: none;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
}
.share-facebook { background: #1877f2; color: #fff; }
.share-facebook:hover { background: #1560c0; color: #fff; }
.share-twitter  { background: #000; color: #fff; border: 1px solid #333; }
.share-twitter:hover { background: #111; color: #fff; }
.share-whatsapp { background: #25d366; color: #fff; }
.share-whatsapp:hover { background: #1ea952; color: #fff; }
.share-copy     { background: var(--bg3); color: var(--text2); border: 1px solid var(--border2); }
.share-copy:hover { background: var(--border); color: var(--text); }

/* ---- Pagination ---- */
.pagination {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    margin-top: 2.5rem;
}
.page-btn {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
    background: var(--bg2);
    border: 1px solid var(--border);
    color: var(--text2);
    font-size: 0.9rem;
    font-weight: 600;
    transition: all 0.2s;
    text-decoration: none;
}
.page-btn:hover, .page-btn.active {
    background: var(--accent);
    border-color: var(--accent);
    color: #fff;
}

/* ---- Empty State ---- */
.empty-state {
    text-align: center;
    padding: 5rem 2rem;
}
.empty-icon { font-size: 3.5rem; display: block; margin-bottom: 1rem; }
.empty-state h3 {
    font-family: var(--font-head);
    font-size: 1.4rem;
    margin-bottom: 0.5rem;
}
.empty-state p { color: var(--text2); margin-bottom: 1.5rem; }

/* ---- Spinner ---- */
.spinner {
    width: 28px;
    height: 28px;
    border: 3px solid var(--border2);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---- Landing Page ---- */
.landing-hero {
    text-align: center;
    padding: 6rem 2rem 4rem;
    background:
        radial-gradient(ellipse at 50% 0%, rgba(108,99,255,0.15) 0%, transparent 60%),
        var(--bg);
}
.landing-hero h1 {
    font-family: var(--font-head);
    font-size: clamp(2.5rem, 6vw, 4.5rem);
    font-weight: 800;
    letter-spacing: -0.04em;
    line-height: 1.1;
    margin-bottom: 1.25rem;
    background: linear-gradient(135deg, #fff 40%, var(--accent2));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}
.landing-hero p {
    font-size: 1.15rem;
    color: var(--text2);
    max-width: 540px;
    margin: 0 auto 2.5rem;
    line-height: 1.7;
}
.landing-hero-btns { display: flex; gap: 1rem; justify-content: center; flex-wrap: wrap; }
.landing-features {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1.5rem;
    margin: 4rem 0;
}
.feature-card {
    background: var(--bg2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.75rem;
    transition: border-color 0.2s;
}
.feature-card:hover { border-color: var(--border2); }
.feature-icon { font-size: 2rem; margin-bottom: 1rem; }
.feature-card h3 {
    font-family: var(--font-head);
    font-size: 1.05rem;
    font-weight: 700;
    margin-bottom: 0.4rem;
}
.feature-card p { font-size: 0.88rem; color: var(--text2); line-height: 1.6; }
.landing-gallery-section h2 {
    font-family: var(--font-head);
    font-size: 1.8rem;
    font-weight: 800;
    letter-spacing: -0.03em;
    margin-bottom: 1.5rem;
}

/* ---- Responsive ---- */
@media (max-width: 900px) {
    .generate-layout    { grid-template-columns: 1fr; }
    .video-page-layout  { grid-template-columns: 1fr; }
    .form-row           { grid-template-columns: 1fr 1fr; }
    .library-header     { flex-direction: column; }
}
@media (max-width: 640px) {
    .navbar             { padding: 0 1rem; gap: 1rem; }
    .main-content       { padding: 1.5rem 1rem; }
    .generate-panel,
    .jobs-panel         { padding: 1.25rem; }
    .form-row           { grid-template-columns: 1fr; }
    .nav-links          { display: none; }
    .storage-mini       { display: none; }
    .auth-card          { padding: 1.75rem; }
}

/* ============================================
   LANDING PAGE STYLES
   ============================================ */

.landing-body { overflow-x: hidden; }

/* ---- Orbs / background blobs ---- */
.lp-orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    opacity: 0.18;
    pointer-events: none;
}
.lp-orb-1 { width: 600px; height: 600px; background: var(--accent);  top: -200px; left: -100px; }
.lp-orb-2 { width: 400px; height: 400px; background: #a78bfa;        top: 100px;  right: -50px; }
.lp-orb-3 { width: 300px; height: 300px; background: #06b6d4;        bottom: 0;   left: 40%; }

/* ---- Hero ---- */
.lp-hero {
    position: relative;
    min-height: 92vh;
    display: grid;
    grid-template-columns: 1fr 420px;
    align-items: center;
    gap: 3rem;
    max-width: 1200px;
    margin: 0 auto;
    padding: 5rem 2rem 4rem;
    overflow: hidden;
}
.lp-hero-bg {
    position: absolute;
    inset: 0;
    z-index: 0;
    pointer-events: none;
}
.lp-hero-content { position: relative; z-index: 1; }
.lp-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    background: rgba(108,99,255,0.15);
    border: 1px solid rgba(108,99,255,0.35);
    color: var(--accent2);
    font-size: 0.8rem;
    font-weight: 600;
    padding: 0.35rem 0.85rem;
    border-radius: 99px;
    margin-bottom: 1.5rem;
    letter-spacing: 0.03em;
}
.lp-hero-title {
    font-family: var(--font-head);
    font-size: clamp(2.8rem, 5.5vw, 4.5rem);
    font-weight: 800;
    letter-spacing: -0.04em;
    line-height: 1.08;
    margin-bottom: 1.25rem;
    color: var(--text);
}
.lp-gradient-text {
    background: linear-gradient(135deg, var(--accent2) 0%, #06b6d4 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}
.lp-hero-sub {
    font-size: 1.1rem;
    color: var(--text2);
    line-height: 1.7;
    max-width: 520px;
    margin-bottom: 2rem;
}
.lp-hero-btns { display: flex; gap: 1rem; flex-wrap: wrap; margin-bottom: 1rem; }
.lp-hero-note { font-size: 0.8rem; color: var(--text3); }

/* ---- Floating sample cards ---- */
.lp-hero-cards {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}
.lp-sample-card {
    background: var(--bg2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.25rem;
    transition: transform 0.3s ease, border-color 0.3s;
    animation: float 6s ease-in-out infinite;
}
.lp-sample-card:hover { border-color: var(--border2); }
.lp-sample-1 { animation-delay: 0s;    transform: translateY(0px); }
.lp-sample-2 { animation-delay: 2s;    transform: translateY(0px); }
.lp-sample-3 { animation-delay: 4s;    transform: translateY(0px); }
@keyframes float {
    0%, 100% { transform: translateY(0px); }
    50%       { transform: translateY(-8px); }
}
.lp-sample-icon { font-size: 1.5rem; margin-bottom: 0.5rem; }
.lp-sample-card p { font-size: 0.85rem; color: var(--text2); line-height: 1.5; margin-bottom: 0.5rem; font-style: italic; }
.lp-sample-tag {
    display: inline-block;
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--accent2);
    background: rgba(108,99,255,0.12);
    padding: 0.2rem 0.6rem;
    border-radius: 99px;
}

/* ---- Sections ---- */
.lp-section { padding: 6rem 2rem; }
.lp-container { max-width: 1200px; margin: 0 auto; }
.lp-container-narrow { max-width: 760px; margin: 0 auto; }
.lp-section-label {
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--accent2);
    margin-bottom: 0.75rem;
}
.lp-section-title {
    font-family: var(--font-head);
    font-size: clamp(1.8rem, 3.5vw, 2.8rem);
    font-weight: 800;
    letter-spacing: -0.03em;
    margin-bottom: 3rem;
    color: var(--text);
}

/* ---- How it works ---- */
.lp-steps-section { background: var(--bg2); border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); }
.lp-steps {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
}
.lp-step {
    flex: 1;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 2rem;
    position: relative;
    transition: border-color 0.2s;
}
.lp-step:hover { border-color: var(--accent); }
.lp-step-num {
    font-family: var(--font-head);
    font-size: 3rem;
    font-weight: 800;
    color: var(--border2);
    line-height: 1;
    margin-bottom: 0.5rem;
    letter-spacing: -0.04em;
}
.lp-step-icon { font-size: 1.75rem; margin-bottom: 0.75rem; }
.lp-step h3 {
    font-family: var(--font-head);
    font-size: 1.1rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}
.lp-step p { font-size: 0.88rem; color: var(--text2); line-height: 1.6; }
.lp-step-arrow {
    font-size: 1.5rem;
    color: var(--border2);
    margin-top: 3rem;
    flex-shrink: 0;
}

/* ---- Features ---- */
.lp-features-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.25rem;
}
.lp-feature-card {
    background: var(--bg2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.75rem;
    transition: border-color 0.2s, transform 0.2s;
}
.lp-feature-card:hover { border-color: var(--border2); transform: translateY(-2px); }
.lp-feature-large { grid-column: span 1; }
.lp-feature-icon-lg { font-size: 2.5rem; margin-bottom: 1rem; }
.lp-feature-icon    { font-size: 1.75rem; margin-bottom: 0.75rem; }
.lp-feature-card h3 {
    font-family: var(--font-head);
    font-size: 1.1rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}
.lp-feature-card p { font-size: 0.88rem; color: var(--text2); line-height: 1.6; }
.lp-feature-example {
    margin-top: 1rem;
    padding: 0.75rem 1rem;
    background: var(--bg3);
    border-left: 3px solid var(--accent);
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    font-size: 0.82rem;
    color: var(--text2);
    font-style: italic;
}

/* ---- Gallery ---- */
.lp-gallery-section { background: var(--bg2); border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); }
.lp-gallery-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.5rem;
}
.lp-gallery-card {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    transition: border-color 0.2s, transform 0.2s;
}
.lp-gallery-card:hover { border-color: var(--border2); transform: translateY(-3px); }
.lp-gallery-thumb {
    position: relative;
    aspect-ratio: 16/9;
    background: var(--bg3);
    overflow: hidden;
}
.lp-gallery-thumb img,
.lp-gallery-thumb video { width: 100%; height: 100%; object-fit: cover; }
.lp-gallery-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,0.45);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.2s;
}
.lp-gallery-thumb:hover .lp-gallery-overlay { opacity: 1; }
.lp-gallery-card p.lp-gallery-prompt {
    padding: 0.85rem 1rem 0.25rem;
    font-size: 0.83rem;
    color: var(--text);
    line-height: 1.5;
}
.lp-gallery-meta {
    display: block;
    padding: 0 1rem 0.85rem;
    font-size: 0.75rem;
    color: var(--text3);
}

/* ---- Pricing ---- */
.lp-pricing-sub {
    color: var(--text2);
    margin-top: -2rem;
    margin-bottom: 3rem;
    font-size: 1rem;
}
.lp-pricing-cards {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    max-width: 800px;
    margin: 0 auto;
}
.lp-pricing-card {
    background: var(--bg2);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 2.25rem;
    position: relative;
}
.lp-pricing-starter {
    border-color: var(--accent);
    box-shadow: 0 0 40px var(--accent-glow);
}
.lp-pricing-pro { opacity: 0.7; }
.lp-pricing-badge {
    display: inline-block;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--accent2);
    background: rgba(108,99,255,0.15);
    border: 1px solid rgba(108,99,255,0.3);
    padding: 0.25rem 0.7rem;
    border-radius: 99px;
    margin-bottom: 1rem;
}
.lp-badge-soon { color: var(--text3); background: var(--bg3); border-color: var(--border); }
.lp-pricing-card h3 {
    font-family: var(--font-head);
    font-size: 1.5rem;
    font-weight: 800;
    margin-bottom: 0.5rem;
}
.lp-price {
    font-family: var(--font-head);
    font-size: 3rem;
    font-weight: 800;
    letter-spacing: -0.04em;
    color: var(--text);
    line-height: 1;
    margin-bottom: 0.25rem;
}
.lp-price-sub { font-size: 0.82rem; color: var(--text3); margin-bottom: 1.5rem; }
.lp-pricing-features {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    margin-bottom: 2rem;
}
.lp-pricing-features li { font-size: 0.88rem; color: var(--text2); }
.lp-features-muted li { color: var(--text3); }

/* ---- FAQ ---- */
.lp-faq-section { background: var(--bg2); border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); }
.lp-faqs { display: flex; flex-direction: column; gap: 0; }
.lp-faq {
    border-bottom: 1px solid var(--border);
}
.lp-faq:first-child { border-top: 1px solid var(--border); }
.lp-faq-q {
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.25rem 0;
    background: none;
    border: none;
    color: var(--text);
    font-family: var(--font-head);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    text-align: left;
    transition: color 0.2s;
}
.lp-faq-q:hover { color: var(--accent2); }
.lp-faq-arrow { font-size: 1.1rem; color: var(--text3); transition: transform 0.3s; flex-shrink: 0; margin-left: 1rem; }
.lp-faq-a {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.35s ease;
}
.lp-faq-a p {
    padding-bottom: 1.25rem;
    font-size: 0.92rem;
    color: var(--text2);
    line-height: 1.7;
}

/* ---- Final CTA ---- */
.lp-cta-section { padding: 4rem 2rem 6rem; }
.lp-cta-box {
    position: relative;
    max-width: 700px;
    margin: 0 auto;
    text-align: center;
    background: var(--bg2);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 4rem 3rem;
    overflow: hidden;
}
.lp-cta-orb {
    position: absolute;
    width: 400px;
    height: 400px;
    background: var(--accent);
    border-radius: 50%;
    filter: blur(100px);
    opacity: 0.1;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    pointer-events: none;
}
.lp-cta-box h2 {
    font-family: var(--font-head);
    font-size: clamp(1.6rem, 3vw, 2.2rem);
    font-weight: 800;
    letter-spacing: -0.03em;
    margin-bottom: 0.75rem;
    position: relative;
}
.lp-cta-box p {
    color: var(--text2);
    margin-bottom: 2rem;
    position: relative;
}
.lp-cta-box .btn { position: relative; }

/* ---- Responsive ---- */
@media (max-width: 1024px) {
    .lp-hero            { grid-template-columns: 1fr; min-height: auto; padding-top: 3rem; }
    .lp-hero-cards      { display: none; }
    .lp-features-grid   { grid-template-columns: 1fr; }
    .lp-feature-large   { grid-column: span 1; }
    .lp-gallery-grid    { grid-template-columns: 1fr 1fr; }
    .lp-pricing-cards   { grid-template-columns: 1fr; max-width: 440px; }
}
@media (max-width: 700px) {
    .lp-steps           { flex-direction: column; }
    .lp-step-arrow      { transform: rotate(90deg); margin: 0 auto; }
    .lp-gallery-grid    { grid-template-columns: 1fr; }
    .lp-section         { padding: 4rem 1.25rem; }
    .lp-cta-box         { padding: 2.5rem 1.5rem; }
}

/* ============================================
   DASHBOARD — Engaging Generation Page
   ============================================ */

.dashboard-page { background: var(--bg); }

/* ---- Presets Bar ---- */
.presets-bar {
    position: sticky;
    top: var(--nav-h);
    z-index: 100;
    background: rgba(10,10,15,0.92);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
    padding: 0.6rem 2rem;
}
.presets-scroll {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    overflow-x: auto;
    scrollbar-width: none;
    -ms-overflow-style: none;
}
.presets-scroll::-webkit-scrollbar { display: none; }
.presets-label {
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--text3);
    letter-spacing: 0.08em;
    text-transform: uppercase;
    white-space: nowrap;
    margin-right: 0.25rem;
}
.preset-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.4rem 0.9rem;
    background: var(--bg3);
    border: 1px solid var(--border);
    border-radius: 99px;
    color: var(--text2);
    font-size: 0.8rem;
    font-weight: 500;
    font-family: var(--font-body);
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.2s;
}
.preset-pill:hover {
    background: var(--bg2);
    border-color: var(--border2);
    color: var(--text);
}
.preset-pill.active {
    background: rgba(108,99,255,0.15);
    border-color: var(--accent);
    color: var(--accent2);
    box-shadow: 0 0 12px var(--accent-glow);
}

/* ---- Dashboard Layout ---- */
.dash-main { max-width: 1280px; margin: 0 auto; padding: 2rem; }
.dash-layout {
    display: grid;
    grid-template-columns: 1fr 340px;
    gap: 2rem;
    align-items: start;
}

/* ---- Left Panel ---- */
.dash-generate {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

/* ---- Prompt Zone ---- */
.prompt-zone {
    background: var(--bg2);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    transition: border-color 0.2s;
}
.prompt-zone:focus-within {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-glow);
}
.prompt-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
}
.prompt-label {
    font-family: var(--font-head);
    font-size: 1rem;
    font-weight: 700;
    color: var(--text);
}
.surprise-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    background: var(--bg3);
    border: 1px solid var(--border2);
    color: var(--text2);
    font-size: 0.8rem;
    font-weight: 600;
    font-family: var(--font-body);
    padding: 0.35rem 0.85rem;
    border-radius: 99px;
    cursor: pointer;
    transition: all 0.3s ease;
}
.surprise-btn:hover { color: var(--text); border-color: var(--accent2); background: var(--bg2); }
.prompt-wrap { position: relative; }
.prompt-wrap textarea {
    width: 100%;
    background: transparent;
    border: none;
    outline: none;
    color: var(--text);
    font-family: var(--font-body);
    font-size: 1rem;
    line-height: 1.7;
    resize: none;
    min-height: 120px;
    padding: 0;
}
.prompt-wrap textarea::placeholder { color: var(--text3); }
.prompt-footer {
    display: flex;
    justify-content: flex-end;
    margin-top: 0.5rem;
}
.active-style-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    margin-top: 0.75rem;
    background: rgba(108,99,255,0.12);
    border: 1px solid rgba(108,99,255,0.3);
    color: var(--accent2);
    font-size: 0.78rem;
    font-weight: 600;
    padding: 0.3rem 0.75rem;
    border-radius: 99px;
}
.active-style-badge button {
    background: none;
    border: none;
    color: var(--accent2);
    cursor: pointer;
    font-size: 0.75rem;
    line-height: 1;
    padding: 0 0.1rem;
    opacity: 0.7;
    transition: opacity 0.2s;
}
.active-style-badge button:hover { opacity: 1; }

/* ---- Examples ---- */
.examples-zone {
    background: var(--bg2);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
}
.examples-label {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text3);
    margin-bottom: 0.85rem;
    letter-spacing: 0.02em;
}
.examples-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}
.example-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.45rem 0.9rem;
    background: var(--bg3);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text2);
    font-size: 0.8rem;
    font-family: var(--font-body);
    cursor: pointer;
    transition: all 0.2s;
    text-align: left;
}
.example-chip:hover {
    background: var(--bg);
    border-color: var(--accent);
    color: var(--text);
    transform: translateY(-1px);
}
.example-chip.active {
    background: rgba(108,99,255,0.15);
    border-color: var(--accent);
    color: var(--accent2);
}

/* ---- Advanced Options ---- */
.advanced-section {
    background: var(--bg2);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
}
.advanced-toggle {
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.5rem;
    background: none;
    border: none;
    color: var(--text2);
    font-family: var(--font-body);
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: color 0.2s, background 0.2s;
}
.advanced-toggle:hover { color: var(--text); background: var(--bg3); }
.advanced-arrow { transition: transform 0.3s; font-size: 1rem; color: var(--text3); }
.advanced-body {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.5s ease, padding 0.3s ease;
    padding: 0 1.5rem;
}
.advanced-body.open {
    max-height: 2000px; /* increased for new fields */
    padding-bottom: 1.5rem;
}
.advanced-body .form-group { margin-top: 1.25rem; }
.advanced-body .form-row { margin-top: 1.25rem; }

/* ---- Generate Button ---- */
.generate-btn-wrap { text-align: center; }
.generate-btn {
    position: relative;
    width: 100%;
    padding: 1.1rem 2rem;
    background: var(--accent);
    border: none;
    border-radius: var(--radius);
    color: #fff;
    font-family: var(--font-head);
    font-size: 1.15rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    cursor: pointer;
    overflow: hidden;
    transition: transform 0.2s, box-shadow 0.2s, background 0.3s;
    box-shadow: 0 0 30px var(--accent-glow);
}
.generate-btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 0 50px var(--accent-glow);
}
.generate-btn:disabled { cursor: not-allowed; opacity: 0.8; }
.generate-btn.generating {
    background: linear-gradient(135deg, var(--accent), #a78bfa);
    animation: pulse-glow 2s ease-in-out infinite;
}
@keyframes pulse-glow {
    0%, 100% { box-shadow: 0 0 30px var(--accent-glow); }
    50%       { box-shadow: 0 0 60px rgba(108,99,255,0.5); }
}
.generate-btn-inner {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.6rem;
    position: relative;
    z-index: 1;
}
.generate-btn-icon {
    font-size: 1.1rem;
    transition: transform 0.3s;
    display: inline-block;
}
.generate-btn.generating .generate-btn-icon {
    animation: spin 1.5s linear infinite;
}
.generate-btn-glow {
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, transparent 40%, rgba(255,255,255,0.1));
    pointer-events: none;
}
.generate-note {
    font-size: 0.78rem;
    color: var(--text3);
    margin-top: 0.75rem;
}

/* ---- Right: Jobs Panel ---- */
.dash-jobs {
    background: var(--bg2);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    position: sticky;
    top: calc(var(--nav-h) + 56px);
}
.dash-jobs .jobs-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.25rem;
}
.dash-jobs h2 {
    font-family: var(--font-head);
    font-size: 1.1rem;
    font-weight: 700;
}

/* ---- Responsive ---- */
@media (max-width: 960px) {
    .dash-layout { grid-template-columns: 1fr; }
    .dash-jobs   { position: static; }
    .presets-bar { padding: 0.6rem 1rem; }
}
@media (max-width: 640px) {
    .dash-main   { padding: 1rem; }
    .prompt-zone { padding: 1rem; }
}

/* ============================================
   LIBRARY — Job Status & Failure Messaging
   ============================================ */

/* ---- Status thumbs ---- */
.status-thumb {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    padding: 1rem;
    text-align: center;
}
.status-pending    { background: rgba(108,99,255,0.08); }
.status-failed     { background: rgba(239,68,68,0.08);  }
.status-stuck      { background: rgba(245,158,11,0.08); }
.status-icon       { font-size: 1.75rem; line-height: 1; }
.status-title      { font-size: 0.82rem; font-weight: 600; color: var(--text2); }
.status-sub        { font-size: 0.75rem; color: var(--text3); }
.status-failed .status-icon  { color: var(--danger); }
.status-stuck  .status-icon  { color: var(--warning); }

/* ---- Job info bar ---- */
.job-info-bar {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.78rem;
    color: var(--text2);
    margin-bottom: 0.5rem;
    padding: 0.4rem 0;
}
.job-info-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}
.job-info-dot.pending    {
    background: var(--accent2);
    animation: dot-pulse 1.5s ease-in-out infinite;
}
.job-info-dot.processing {
    background: var(--warning);
    animation: dot-pulse 1s ease-in-out infinite;
}
@keyframes dot-pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50%       { opacity: 0.4; transform: scale(0.7); }
}

/* ---- Failure messaging ---- */
.failure-info {
    margin-bottom: 0.5rem;
}
.failure-reason {
    font-size: 0.8rem;
    color: var(--text2);
    line-height: 1.5;
    margin-bottom: 0.5rem;
    padding: 0.6rem 0.75rem;
    background: rgba(239,68,68,0.06);
    border-left: 3px solid var(--danger);
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}
.failure-tips-toggle {
    background: none;
    border: none;
    color: var(--warning);
    font-size: 0.78rem;
    font-family: var(--font-body);
    cursor: pointer;
    padding: 0.25rem 0;
    transition: color 0.2s;
    font-weight: 600;
}
.failure-tips-toggle:hover { color: #fde68a; }
.failure-tips {
    margin-top: 0.5rem;
    padding: 0.85rem;
    background: rgba(245,158,11,0.06);
    border: 1px solid rgba(245,158,11,0.2);
    border-radius: var(--radius-sm);
    font-size: 0.78rem;
    color: var(--text2);
    line-height: 1.6;
}
.failure-tips p { margin-bottom: 0.4rem; font-weight: 600; color: var(--text); }
.failure-tips p:first-child { margin-bottom: 0.5rem; }
.failure-tips ul {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    margin-bottom: 0.75rem;
}
.failure-tips ul li::before { content: '• '; color: var(--warning); }
.failure-tip-note {
    font-size: 0.75rem !important;
    color: var(--text3) !important;
    font-style: italic;
    font-weight: 400 !important;
    border-top: 1px solid var(--border);
    padding-top: 0.5rem;
    margin-top: 0.25rem;
}

/* ============================================
   MOBILE — Additional fixes
   ============================================ */

@media (max-width: 640px) {

    /* Navbar — show username, hide storage */
    .storage-mini { display: none; }

    /* Library header stacks */
    .library-header {
        flex-direction: column;
        gap: 1rem;
    }
    .storage-block { width: 100%; }

    /* Video grid — single column */
    .video-grid {
        grid-template-columns: 1fr;
    }

    /* Video page stacks */
    .video-page-layout {
        grid-template-columns: 1fr;
    }

    /* Share buttons wrap */
    .share-buttons {
        flex-wrap: wrap;
    }

    /* Owner controls wrap */
    .owner-controls {
        flex-wrap: wrap;
    }

    /* Landing hero buttons stack */
    .lp-hero-btns {
        flex-direction: column;
        align-items: stretch;
    }

    .lp-hero-btns .btn {
        text-align: center;
    }

    /* Pricing cards stack */
    .lp-pricing-cards {
        grid-template-columns: 1fr;
    }

    /* Auth card padding tighter */
    .auth-card {
        padding: 1.5rem 1.25rem;
    }

    /* Dashboard jobs panel */
    .dash-jobs {
        margin-top: 0;
    }

    /* Example chips wrap tightly */
    .examples-grid {
        gap: 0.4rem;
    }

    .example-chip {
        font-size: 0.75rem;
        padding: 0.4rem 0.75rem;
    }

    /* Presets bar label hidden on mobile */
    .presets-label {
        display: none;
    }

    /* Generate button full width */
    .generate-btn {
        font-size: 1rem;
        padding: 1rem;
    }

    /* Form row single column */
    .form-row {
        grid-template-columns: 1fr;
    }

    /* Gallery CTA padding */
    .gallery-cta {
        padding: 2rem 1.25rem;
    }

    /* Steps section */
    .lp-steps {
        flex-direction: column;
    }

    .lp-step-arrow {
        transform: rotate(90deg);
        margin: 0 auto;
    }
}

/* ---- Auth pages mobile ---- */
@media (max-width: 480px) {
    .auth-page {
        align-items: flex-start;
        padding-top: 2rem;
    }

    .auth-container {
        padding: 1rem;
    }

    .auth-card {
        padding: 1.5rem 1.25rem;
        border-radius: var(--radius);
    }

    .auth-card h1 {
        font-size: 1.4rem;
    }

    .auth-logo a {
        font-size: 1rem;
    }

    .auth-logo img {
        width: 36px !important;
        height: 36px !important;
    }

    .btn-full {
        padding: 0.85rem;
        font-size: 0.95rem;
    }

    .form-group input {
        font-size: 16px; /* Prevents iOS zoom on input focus */
        padding: 0.75rem 0.85rem;
    }

    .alert {
        font-size: 0.85rem;
    }
}

/* ============================================
   MOBILE — Dashboard & Navbar overflow fixes
   ============================================ */

/* Prevent horizontal overflow globally */
html, body {
    overflow-x: hidden;
    max-width: 100vw;
}

@media (max-width: 768px) {

    /* Navbar — stop logo wrapping */
    .navbar {
        padding: 0 0.75rem;
        gap: 0.75rem;
        overflow: hidden;
    }

    .nav-logo {
        flex-shrink: 0;
        max-width: 160px;
    }

    .logo-text {
        font-size: 0.9rem;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .nav-logo-img {
        width: 28px !important;
        height: 28px !important;
        flex-shrink: 0;
    }

    /* Nav username — hide on small screens to save space */
    .nav-username { display: none; }

    /* Dashboard main padding */
    .dash-main {
        padding: 0.75rem;
        overflow-x: hidden;
    }

    /* Prompt zone full width */
    .prompt-zone {
        width: 100%;
        box-sizing: border-box;
    }

    .prompt-wrap textarea {
        font-size: 16px; /* prevent iOS zoom */
        width: 100%;
    }

    /* Examples grid — wrap cleanly */
    .examples-zone {
        width: 100%;
        box-sizing: border-box;
        overflow: hidden;
    }

    .examples-grid {
        display: flex;
        flex-wrap: wrap;
        gap: 0.4rem;
    }

    .example-chip {
        font-size: 0.75rem;
        padding: 0.35rem 0.65rem;
        white-space: nowrap;
    }

    /* Generate button — full text visible */
    .generate-btn {
        width: 100%;
        box-sizing: border-box;
        font-size: 0.95rem;
        padding: 0.9rem 1rem;
    }

    .generate-btn-inner {
        width: 100%;
        justify-content: center;
    }

    /* Advanced section full width */
    .advanced-section {
        width: 100%;
        box-sizing: border-box;
    }

    /* Jobs panel */
    .dash-jobs {
        width: 100%;
        box-sizing: border-box;
    }

    /* Presets bar — contains overflow */
    .presets-bar {
        padding: 0.5rem 0.75rem;
        overflow: hidden;
    }

    .presets-scroll {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
}

/* ============================================
   iOS SAFARI — Horizontal overflow nuclear fix
   ============================================ */

/* iOS Safari ignores overflow-x on body — must use this pattern */
html {
    overflow-x: hidden;
    width: 100%;
}

body {
    overflow-x: hidden;
    width: 100%;
    position: relative;
}

@media (max-width: 768px) {

    /* Force everything to respect viewport width */
    * {
        max-width: 100%;
    }

    /* Except things that need to scroll horizontally */
    .presets-scroll,
    .admin-table,
    .admin-table-full,
    .log {
        max-width: none;
    }

    /* The main wrappers */
    .dash-main,
    .main-content,
    .auth-container,
    .landing-hero,
    .lp-container,
    .lp-container-narrow {
        width: 100%;
        max-width: 100%;
        box-sizing: border-box;
        overflow-x: hidden;
    }

    /* Specific elements that commonly break layout */
    .generate-panel,
    .prompt-zone,
    .examples-zone,
    .advanced-section,
    .generate-btn-wrap,
    .video-grid,
    .video-card,
    .jobs-panel,
    .dash-jobs {
        width: 100%;
        max-width: 100%;
        box-sizing: border-box;
    }

    /* Tables need explicit overflow container */
    .admin-card {
        overflow-x: auto;
        max-width: 100%;
    }

    /* Footer shouldn't cause overflow */
    .vp-footer {
        width: 100%;
        box-sizing: border-box;
        overflow-x: hidden;
    }

    .vp-footer__inner {
        width: 100%;
        box-sizing: border-box;
        padding: 0 1rem;
    }

    /* Modals full width on mobile */
    .vp-modal-content {
        width: calc(100% - 2rem) !important;
        max-width: 100% !important;
        box-sizing: border-box;
    }
}

/* ---- Presets scroll arrows ---- */
.presets-bar {
    display: flex;
    align-items: center;
    gap: 0;
}
.presets-arrow {
    flex-shrink: 0;
    width: 28px;
    height: 28px;
    background: var(--bg3);
    border: 1px solid var(--border2);
    border-radius: 50%;
    color: var(--text2);
    font-size: 1.2rem;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    z-index: 2;
    padding: 0;
    font-family: var(--font-body);
}
.presets-arrow:hover { background: var(--border2); color: var(--text); }
.presets-arrow-left  { margin-right: 0.4rem; }
.presets-arrow-right { margin-left:  0.4rem; }

/* Fade edges to hint scrollability */
.presets-scroll {
    flex: 1;
    -webkit-mask-image: linear-gradient(to right, transparent 0%, black 5%, black 95%, transparent 100%);
    mask-image: linear-gradient(to right, transparent 0%, black 5%, black 95%, transparent 100%);
}

/* ---- Video platform share buttons ---- */
.share-youtube { background: #ff0000; color: #fff; }
.share-youtube:hover { background: #cc0000; color: #fff; }
.share-tiktok  { background: #010101; color: #fff; border: 1px solid #333; }
.share-tiktok:hover  { background: #111; color: #fff; }
.share-reels   { background: linear-gradient(45deg, #f09433, #e6683c, #dc2743, #cc2366, #bc1888); color: #fff; }
.share-reels:hover   { opacity: 0.9; color: #fff; }

.share-platform-note {
    font-size: 0.78rem;
    color: var(--text3);
    margin-bottom: 0.75rem;
}

.share-platform-tips {
    margin-top: 0.75rem;
}

.share-platform-tips details {
    font-size: 0.8rem;
}

.share-platform-tips summary {
    color: var(--text3);
    cursor: pointer;
    padding: 0.25rem 0;
    list-style: none;
    display: flex;
    align-items: center;
    gap: 0.3rem;
}

.share-platform-tips summary::before {
    content: '↓';
    font-size: 0.75rem;
    transition: transform 0.2s;
}

details[open] summary::before { transform: rotate(180deg); }

.platform-tips-body {
    margin-top: 0.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    padding: 0.75rem;
    background: var(--bg3);
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
}

.platform-tip {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    font-size: 0.78rem;
}

.platform-tip strong { color: var(--text); }
.platform-tip span   { color: var(--text3); }

/* ============================================
   MOBILE — Dashboard layout fixes v2
   ============================================ */

@media (max-width: 768px) {

    /* Fix the large black gap — prompt zone needs visible background */
    .prompt-zone {
        background: var(--bg2) !important;
        border: 1px solid var(--border) !important;
        border-radius: var(--radius-lg) !important;
        margin-bottom: 0 !important;
    }

    /* Ensure prompt label is visible */
    .prompt-label {
        display: block !important;
        color: var(--text) !important;
        font-size: 1rem !important;
        margin-bottom: 0.5rem !important;
    }

    /* Textarea must be visible */
    .prompt-wrap textarea {
        background: transparent !important;
        border: none !important;
        color: var(--text) !important;
        width: 100% !important;
        min-height: 100px !important;
        display: block !important;
    }

    /* Jobs panel — fix overflow */
    .dash-jobs {
        overflow: hidden !important;
    }

    .job-item {
        overflow: hidden !important;
        width: 100% !important;
        box-sizing: border-box !important;
    }

    .job-info {
        overflow: hidden !important;
        min-width: 0 !important;
        flex: 1 !important;
    }

    .job-prompt {
        overflow: hidden !important;
        text-overflow: ellipsis !important;
        white-space: nowrap !important;
        max-width: 100% !important;
        display: block !important;
    }

    /* Job status badge — don't let it overflow */
    .job-status {
        flex-shrink: 0 !important;
        max-width: 80px !important;
    }

    /* Jobs list container */
    .jobs-list {
        overflow: hidden !important;
        width: 100% !important;
    }

    /* Presets bar spacing */
    .presets-bar {
        top: var(--nav-h) !important;
    }

    /* Dashboard main — account for sticky presets bar height */
    .dash-main {
        padding-top: 1rem !important;
    }

    /* Surprise button — don't let it overflow navbar */
    .surprise-btn {
        font-size: 0.75rem !important;
        padding: 0.3rem 0.65rem !important;
        white-space: nowrap !important;
    }

    /* Char count stays in bounds */
    .char-count {
        font-size: 0.7rem !important;
    }
}

/* ============================================
   MOBILE — Navbar & presets z-index fixes
   ============================================ */

@media (max-width: 768px) {

    /* Navbar must always be on top of everything */
    .navbar {
        z-index: 300 !important;
        position: sticky !important;
        top: 0 !important;
        background: rgba(10,10,15,0.98) !important;
    }

    /* Presets bar sits below navbar */
    .presets-bar {
        z-index: 200 !important;
        position: sticky !important;
        top: var(--nav-h) !important;
        background: rgba(10,10,15,0.98) !important;
    }

    /* Alerts must show above presets bar */
    #generate-error,
    #generate-success,
    .alert {
        position: relative !important;
        z-index: 250 !important;
    }

    /* Modals and overlays always on top */
    .vp-modal-overlay {
        z-index: 9999 !important;
    }

    /* Ensure dash-main content doesn't overlap sticky bars */
    .dash-main {
        position: relative;
        z-index: 1;
    }

    /* Generate panel and jobs panel below sticky bars */
    .dash-generate,
    .dash-jobs {
        position: relative;
        z-index: 1;
    }
}

/* ============================================
   MOBILE — Navbar declutter
   ============================================ */

@media (max-width: 900px) {
    /* Hide nav links on tablet — too crowded */
    .nav-links { display: none; }
    .storage-mini { display: none; }
    .nav-username { display: none; }
}

@media (max-width: 768px) {
    /* Navbar — absolute minimum on small screens */
    .navbar {
        padding: 0 1rem !important;
        gap: 0.5rem !important;
        flex-wrap: nowrap !important;
        height: auto !important;
        min-height: var(--nav-h) !important;
    }

    /* Logo — fixed small size, no wrapping */
    .nav-logo {
        flex-shrink: 0 !important;
        flex: 0 0 auto !important;
    }

    .nav-logo-img {
        width: 32px !important;
        height: 32px !important;
        flex-shrink: 0 !important;
    }

    .logo-text {
        font-size: 0.85rem !important;
        white-space: nowrap !important;
        overflow: hidden !important;
        text-overflow: ellipsis !important;
        max-width: 120px !important;
    }

    /* Nav user — push to right, minimal */
    .nav-user {
        margin-left: auto !important;
        gap: 0.5rem !important;
        flex-shrink: 0 !important;
    }

    /* Sign out link — keep small */
    .nav-user .nav-link {
        font-size: 0.8rem !important;
        padding: 0.35rem 0.6rem !important;
        white-space: nowrap !important;
    }

    /* Hamburger-style menu hint — show a menu button instead of all links */
    .nav-links {
        display: none !important;
    }

    /* Admin link in navbar — hide on very small, accessible via dashboard */
    .nav-links .nav-link[href*="admin"] {
        display: none !important;
    }
}

/* ============================================
   MOBILE BOTTOM TAB BAR
   ============================================ */

.mobile-tabs {
    display: none; /* Hidden on desktop */
}

@media (max-width: 768px) {
    /* Show bottom tab bar on mobile */
    .mobile-tabs {
        display: flex;
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        z-index: 300;
        background: rgba(10,10,15,0.97);
        backdrop-filter: blur(16px);
        -webkit-backdrop-filter: blur(16px);
        border-top: 1px solid var(--border);
        padding: 0.5rem 0 calc(0.5rem + env(safe-area-inset-bottom));
        justify-content: space-around;
        align-items: center;
    }

    .mobile-tab {
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 0.2rem;
        padding: 0.4rem 1rem;
        text-decoration: none;
        color: var(--text3);
        transition: color 0.2s;
        flex: 1;
    }

    .mobile-tab.active,
    .mobile-tab:hover {
        color: var(--accent2);
    }

    .mobile-tab-icon {
        font-size: 1.3rem;
        line-height: 1;
    }

    .mobile-tab-label {
        font-size: 0.65rem;
        font-weight: 600;
        letter-spacing: 0.03em;
        font-family: var(--font-body);
    }

    /* Add bottom padding to page content so tab bar doesn't cover it */
    .main-content,
    .dash-main,
    .auth-container,
    body > .container {
        padding-bottom: calc(6rem + env(safe-area-inset-bottom)) !important;
    }

    /* vp-footer needs space above tab bar too */
    .vp-footer {
        margin-bottom: calc(4rem + env(safe-area-inset-bottom)) !important;
    }
}

/* ============================================
   PROMPT LIBRARY
   ============================================ */

.prompt-search-bar {
    display: flex;
    gap: 0.75rem;
    margin-bottom: 1rem;
    align-items: center;
}

.prompt-search-input {
    flex: 1;
    background: var(--bg2);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text);
    font-family: var(--font-body);
    font-size: 0.9rem;
    padding: 0.6rem 1rem;
    outline: none;
    transition: border-color 0.2s;
}

.prompt-search-input:focus { border-color: var(--accent); }

.prompt-tags-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    margin-bottom: 1.5rem;
}

.prompt-tag-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.3rem 0.75rem;
    background: var(--bg3);
    border: 1px solid var(--border);
    border-radius: 99px;
    color: var(--text2);
    font-size: 0.78rem;
    font-weight: 500;
    text-decoration: none;
    transition: all 0.2s;
    cursor: pointer;
}

.prompt-tag-pill:hover { border-color: var(--accent); color: var(--accent2); }
.prompt-tag-pill.active { background: rgba(108,99,255,0.15); border-color: var(--accent); color: var(--accent2); }
.prompt-tag-pill.small { font-size: 0.72rem; padding: 0.2rem 0.55rem; }
.prompt-tag-pill span { color: var(--text3); font-size: 0.7rem; }

.prompt-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 1.25rem;
    margin-bottom: 2rem;
}

.prompt-card {
    background: var(--bg2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    transition: border-color 0.2s, transform 0.2s;
}

.prompt-card:hover {
    border-color: var(--border2);
    transform: translateY(-2px);
}

.prompt-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.prompt-status-badge {
    font-size: 0.72rem;
    font-weight: 700;
    padding: 0.2rem 0.6rem;
    border-radius: 99px;
    letter-spacing: 0.03em;
}

.badge-success { background: rgba(34,197,94,0.15); color: #4ade80; }
.badge-failed  { background: rgba(239,68,68,0.12); color: #f87171; }

.prompt-date {
    font-size: 0.72rem;
    color: var(--text3);
}

.prompt-text {
    font-size: 0.88rem;
    line-height: 1.6;
    color: var(--text);
    flex: 1;
    white-space: pre-wrap;
    word-break: break-word;
}

.prompt-note {
    font-size: 0.8rem;
    color: var(--text2);
    font-style: italic;
    background: var(--bg3);
    border-radius: var(--radius-sm);
    padding: 0.5rem 0.75rem;
    border-left: 3px solid var(--accent);
}

.prompt-card-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.3rem;
}

.prompt-card-actions {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    padding-top: 0.5rem;
    border-top: 1px solid var(--border);
}

@media (max-width: 768px) {
    .prompt-grid {
        grid-template-columns: 1fr;
    }
    .prompt-search-bar {
        flex-wrap: wrap;
    }
}

/* ============================================
   SETTINGS PAGE
   ============================================ */

.settings-card {
    background: var(--bg2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

.settings-card-title {
    font-family: var(--font-head);
    font-size: 1.1rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    color: var(--text);
}

.settings-card-desc {
    font-size: 0.85rem;
    color: var(--text2);
    margin-bottom: 1.25rem;
    line-height: 1.6;
}

.settings-field {
    margin-bottom: 1rem;
}

.settings-label {
    display: block;
    font-size: 0.78rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text3);
    margin-bottom: 0.4rem;
}

.settings-input {
    width: 100%;
    box-sizing: border-box;
    background: var(--bg3);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text);
    font-family: var(--font-body);
    font-size: 0.9rem;
    padding: 0.6rem 0.9rem;
    outline: none;
    transition: border-color 0.2s;
}

.settings-input:focus { border-color: var(--accent); }

.settings-hint {
    font-size: 0.75rem;
    color: var(--text3);
    margin-top: 0.35rem;
}

.settings-info-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.6rem 0;
    border-bottom: 1px solid var(--border);
    font-size: 0.88rem;
}

.settings-info-row:last-child { border-bottom: none; }

.watermark-preview {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.75rem 1rem;
    background: var(--bg3);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    margin-bottom: 1rem;
    flex-wrap: wrap;
}

/* ---- Video visibility & copyright ---- */

.visibility-select {
    background: var(--bg3);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text);
    font-family: var(--font-body);
    font-size: 0.85rem;
    padding: 0.45rem 0.75rem;
    outline: none;
    cursor: pointer;
    transition: border-color 0.2s;
}

.visibility-select:focus { border-color: var(--accent); }

.visibility-select-sm {
    background: var(--bg3);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text);
    font-family: var(--font-body);
    font-size: 0.78rem;
    padding: 0.3rem 0.5rem;
    outline: none;
    cursor: pointer;
}

.video-copyright {
    font-size: 0.75rem;
    color: var(--text3);
    margin-top: 0.75rem;
    padding-top: 0.75rem;
    border-top: 1px solid var(--border);
}

/* ---- Download toggle button states ---- */
.toggle-download-btn[data-allowed="1"] {
    color: var(--success) !important;
    border-color: rgba(34,197,94,0.4) !important;
}
.toggle-download-btn[data-allowed="0"] {
    color: var(--danger) !important;
    border-color: rgba(239,68,68,0.4) !important;
}

/* ---- Watermark toggle button states ---- */
.toggle-watermark-btn[data-enabled="1"] {
    color: var(--accent2) !important;
    border-color: rgba(167,139,250,0.4) !important;
}
.toggle-watermark-btn[data-enabled="0"] {
    color: var(--text3) !important;
    border-color: var(--border) !important;
}

/* ---- Prompt tips button ---- */
.prompt-tips-btn {
    width: 1.4rem;
    height: 1.4rem;
    border-radius: 50%;
    border: 1px solid var(--accent);
    background: transparent;
    color: var(--accent);
    font-size: 0.75rem;
    font-weight: 700;
    cursor: pointer;
    line-height: 1;
    transition: all 0.2s;
    flex-shrink: 0;
}
.prompt-tips-btn:hover {
    background: var(--accent);
    color: white;
}

/* ---- Tips modal ---- */
.tips-formula { display: flex; flex-direction: column; gap: 0.85rem; margin-top: 1.25rem; }
.tips-part {
    display: flex;
    gap: 0.85rem;
    align-items: flex-start;
    padding: 0.75rem;
    background: rgba(255,255,255,0.03);
    border-radius: 8px;
    border: 1px solid var(--border);
}
.tips-num {
    width: 1.6rem;
    height: 1.6rem;
    border-radius: 50%;
    background: var(--accent);
    color: white;
    font-size: 0.8rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    margin-top: 0.1rem;
}
.tips-part strong { font-size: 0.88rem; color: var(--text); display: block; margin-bottom: 0.2rem; }
.tips-part p { font-size: 0.78rem; color: var(--text3); margin: 0 0 0.5rem; }
.tips-chips { display: flex; flex-wrap: wrap; gap: 0.35rem; }
.tips-chip {
    padding: 0.25rem 0.6rem;
    background: rgba(108,99,255,0.12);
    border: 1px solid rgba(108,99,255,0.3);
    border-radius: 99px;
    color: var(--accent2);
    font-size: 0.75rem;
    cursor: pointer;
    transition: all 0.15s;
}
.tips-chip:hover { background: rgba(108,99,255,0.25); color: white; }

/* ---- Sound checkbox ---- */
.checkbox-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    font-size: 0.9rem;
    color: var(--text);
}
.checkbox-label input[type="checkbox"] {
    width: 1rem;
    height: 1rem;
    accent-color: var(--accent);
    cursor: pointer;
}

/* ---- Reference images grid ---- */
.ref-images-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.75rem;
}
.ref-image-slot {
    border: 1px dashed var(--border);
    border-radius: 8px;
    overflow: hidden;
    aspect-ratio: 16/9;
    position: relative;
}
.ref-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    gap: 0.35rem;
    font-size: 0.78rem;
    color: var(--text3);
}
.ref-placeholder .upload-icon { font-size: 1.2rem; }
.ref-preview {
    position: relative;
    height: 100%;
}
.ref-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.btn-remove-ref {
    position: absolute;
    top: 4px;
    right: 4px;
    background: rgba(0,0,0,0.6);
    border: none;
    color: white;
    border-radius: 4px;
    font-size: 0.7rem;
    padding: 2px 5px;
    cursor: pointer;
}

/* ---- First / Last frame ---- */
.frame-upload {
    border: 1px dashed var(--border);
    border-radius: 8px;
    overflow: hidden;
    aspect-ratio: 16/9;
    position: relative;
}
.frame-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    font-size: 0.82rem;
}
.frame-preview {
    position: relative;
    height: 100%;
}
.frame-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.btn-remove-frame {
    position: absolute;
    top: 4px;
    right: 4px;
    background: rgba(0,0,0,0.6);
    border: none;
    color: white;
    border-radius: 4px;
    font-size: 0.7rem;
    padding: 2px 5px;
    cursor: pointer;
}

@media (max-width: 600px) {
    .ref-images-grid { grid-template-columns: repeat(3, 1fr); gap: 0.5rem; }
    .tips-part { flex-direction: column; }
    /* First/last frame stacks on mobile */
    .advanced-body .form-row {
        grid-template-columns: 1fr;
    }
}
