* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
    --bg-page: #130f2a;
    --bg-soft: #1a1438;
    --bg-card: rgba(40, 28, 74, 0.62);
    --bg-card-2: rgba(29, 22, 58, 0.72);
    --bg-input: rgba(58, 44, 104, 0.46);

    --text-primary: #f8f3ff;
    --text-secondary: #dccdf6;
    --text-muted: #b7a5d8;

    --accent: #c084fc;
    --accent-2: #f0abfc;
    --accent-green: #7ee7d8;
    --accent-orange: #f9a8d4;
    --accent-red: #fb7185;

    --border: rgba(232, 196, 255, 0.35);
    --border-soft: rgba(232, 196, 255, 0.2);

    --radius-lg: 24px;
    --radius-md: 16px;
    --radius-sm: 12px;

    --shadow-sm: 0 8px 20px rgba(42, 23, 84, 0.28);
    --shadow-md: 0 16px 34px rgba(42, 23, 84, 0.38);
    --shadow-lg: 0 28px 58px rgba(31, 14, 65, 0.5);
}

html, body {
    min-height: 100%;
}

body {
    font-family: 'Inter', 'Prompt', sans-serif;
    color: var(--text-primary);
    background:
        radial-gradient(circle at 10% -8%, rgba(192, 132, 252, 0.45) 0%, transparent 42%),
        radial-gradient(circle at 100% 0%, rgba(240, 171, 252, 0.32) 0%, transparent 36%),
        radial-gradient(circle at 58% 78%, rgba(125, 211, 252, 0.14) 0%, transparent 32%),
        linear-gradient(180deg, #1a1140 0%, #120b29 55%, #0d0820 100%);
    overflow-x: hidden;
}

body::before,
body::after {
    content: "";
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 0;
}

body::before {
    opacity: 0.55;
    background-image:
        radial-gradient(2px 2px at 10% 18%, rgba(255, 255, 255, 0.7), transparent 70%),
        radial-gradient(1.8px 1.8px at 24% 66%, rgba(255, 236, 255, 0.6), transparent 70%),
        radial-gradient(2.2px 2.2px at 77% 22%, rgba(255, 255, 255, 0.65), transparent 72%),
        radial-gradient(1.6px 1.6px at 64% 74%, rgba(255, 242, 255, 0.56), transparent 70%),
        radial-gradient(1.8px 1.8px at 42% 40%, rgba(255, 255, 255, 0.62), transparent 72%);
    animation: sparkleDrift 12s ease-in-out infinite alternate;
}

body::after {
    opacity: 0.5;
    background:
        conic-gradient(from 120deg at 14% 84%, rgba(244, 114, 182, 0.23), transparent 40%, rgba(167, 139, 250, 0.24) 68%, transparent 100%),
        conic-gradient(from 300deg at 86% 18%, rgba(192, 132, 252, 0.18), transparent 38%, rgba(125, 211, 252, 0.16) 72%, transparent 100%);
    mix-blend-mode: screen;
    filter: blur(1px);
}

::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: rgba(15, 23, 42, 0.25); }
::-webkit-scrollbar-thumb {
    border-radius: 10px;
    background: linear-gradient(180deg, rgba(110, 120, 255, 0.85), rgba(59, 130, 246, 0.85));
}

/* 📱 MOBILE FORM IMPROVEMENTS */
input, textarea, select {
    font-size: 16px; /* Prevents auto-zoom on iOS */
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
}

input[type="checkbox"],
input[type="radio"] {
    -webkit-appearance: auto;
    -moz-appearance: auto;
    appearance: auto;
    accent-color: #3b82f6;
    width: 16px;
    height: 16px;
    cursor: pointer;
}

input[type="text"],
input[type="email"],
input[type="number"],
input[type="tel"],
textarea {
    padding: 12px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--bg-input);
    color: var(--text-primary);
    font-family: inherit;
    transition: all 0.2s ease;
}

input[type="text"]:focus,
input[type="email"]:focus,
input[type="number"]:focus,
input[type="tel"]:focus,
textarea:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(192, 132, 252, 0.15);
    transform: scale(1.02);
}

/* Prevent iOS input zoom */
@supports (-webkit-touch-callout: none) {
    input, textarea, select {
        font-size: 16px !important;
    }
}

button {
    -webkit-user-select: none;
    user-select: none;
    -webkit-touch-callout: none;
    touch-action: manipulation;
}

/* Remove button default hover on touch devices */
@media (hover: none) and (pointer: coarse) {
    button:hover {
        opacity: 1;
        background: inherit;
    }
    
    button:focus {
        outline: 2px solid var(--accent);
        outline-offset: 2px;
    }
}

.bg-orbs { display: none; }

.header {
    position: sticky;
    top: 0;
    z-index: 40;
    padding: 16px 18px 14px;
    border-bottom: 1px solid var(--border);
    background: rgba(6, 10, 23, 0.86);
    backdrop-filter: blur(14px);
}

.header-logo {
    width: 56px;
    height: 56px;
    margin: 0 auto 6px;
    display: block;
    object-fit: contain;
}

.header h1 {
    text-align: center;
    font-size: 1.02rem;
    letter-spacing: 2.6px;
    font-weight: 800;
}

.header p {
    margin-top: 6px;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.72rem;
}

.header .status-badge {
    margin: 8px auto 0;
    width: fit-content;
    display: inline-flex;
    padding: 6px 14px;
    border-radius: 999px;
    font-size: 0.62rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--accent), var(--accent-2));
    color: #fff;
    box-shadow: 0 8px 22px rgba(59, 130, 246, 0.35);
}

.header-waves { display: none; }

.top-nav-bar {
    position: sticky;
    top: 0;
    z-index: 50;
    display: flex;
    align-items: center;
    justify-content: space-between;
    max-width: 1200px;
    margin: 12px auto 0;
    padding: 10px 16px;
    border-bottom: 1px solid var(--border);
    background: linear-gradient(90deg, rgba(64, 46, 110, 0.6), rgba(37, 26, 72, 0.78));
    backdrop-filter: blur(18px) saturate(140%);
    -webkit-backdrop-filter: blur(18px) saturate(140%);
    box-shadow: 0 12px 28px rgba(31, 18, 61, 0.35);
    border-radius: 18px;
}

.top-nav-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 700;
    letter-spacing: 0.8px;
}

.secondary-speaker-mode {
    display: flex;
    gap: 8px;
}

.secondary-speaker-btn {
    flex: 1;
    padding: 8px 10px;
    border-radius: 10px;
    border: 1px solid var(--border-soft);
    background: rgba(58, 44, 104, 0.35);
    color: var(--text-secondary);
    font-size: 0.74rem;
    cursor: pointer;
    transition: .2s ease;
}

.secondary-speaker-btn.active {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.25), rgba(16, 185, 129, 0.18));
    border-color: rgba(167, 139, 250, 0.7);
    color: #f5f3ff;
    box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.18);
}

.secondary-note-box {
    margin-bottom: 10px;
    padding: 10px;
    border-radius: 10px;
    border: 1px solid var(--border-soft);
    background: rgba(47, 35, 91, 0.42);
}

.secondary-note-meta {
    margin-top: 6px;
    display: flex;
    justify-content: space-between;
    gap: 10px;
    font-size: 0.68rem;
    color: var(--text-muted);
}

#secondarySpeakerWordCount.warn {
    color: #fca5a5;
    font-weight: 700;
}

.brand-mark {
    width: 32px;
    height: 32px;
    border-radius: 12px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: radial-gradient(circle at 20% 20%, rgba(255, 255, 255, 0.8), rgba(192, 132, 252, 0.4));
    color: #2a124f;
    box-shadow: 0 0 18px rgba(255, 230, 255, 0.6);
}

.brand-name {
    font-size: 1.05rem;
    color: #f9f3ff;
}

.top-nav-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.center-layout {
    position: relative;
    z-index: 1;
    max-width: 1100px;
    margin: 28px auto 60px;
    padding: 0 16px;
    min-height: calc(100vh - 120px);
}

.tools-modal .modal-body {
    padding: 18px;
}

.tools-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
}

.tools-wide {
    grid-column: 1 / -1;
}

.sidebar-section {
    border: 1px solid var(--border-soft);
    border-radius: var(--radius-md);
    padding: 14px;
    margin-bottom: 12px;
    background: linear-gradient(180deg, rgba(96, 68, 162, 0.32), rgba(55, 36, 96, 0.45));
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.09);
}

.sidebar-section-title {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 10px;
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 1px;
    text-transform: uppercase;
    color: #f1f5ff;
}

.sidebar-section .icon { font-size: 0.95rem; }

.text-input,
.selector-btn,
.modal-card,
.prompt-mode-btn,
.platform-mode-btn,
.admin-add-form input,
.admin-add-role {
    width: 100%;
    border: 1px solid var(--border-soft);
    border-radius: var(--radius-sm);
    background: var(--bg-input);
    color: var(--text-primary);
    font-family: 'Inter', 'Prompt', sans-serif;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.text-input {
    padding: 11px 12px;
    font-size: 0.86rem;
    outline: none;
    transition: border-color .2s, box-shadow .2s;
}

select.text-input {
    background: rgba(12, 16, 44, 0.96) !important;
    border-color: rgba(140, 157, 255, 0.3) !important;
    color: #eef2ff;
    color-scheme: dark;
}

select.text-input option {
    background: #090b1f;
    color: #eef2ff;
}

select.text-input option:checked,
select.text-input option:hover {
    background: #2563eb;
    color: #ffffff;
}

.text-input::placeholder { color: #7f8eb7; }

.text-input:focus,
.selector-btn:hover,
.prompt-mode-btn:hover,
.platform-mode-btn:hover,
.modal-card:hover,
.admin-add-form input:focus {
    border-color: rgba(240, 171, 252, 0.82);
    box-shadow: 0 0 0 3px rgba(240, 171, 252, 0.2), 0 0 24px rgba(192, 132, 252, 0.24);
}

.input-hint {
    margin-top: 6px;
    color: var(--text-muted);
    font-size: 0.68rem;
    line-height: 1.5;
}

.selector-btn {
    padding: 11px 12px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    border: 2px solid var(--border-soft);
    border-radius: var(--radius-sm);
    background: var(--bg-input);
    overflow: hidden;
}

.selector-btn::before {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg, transparent, rgba(240, 171, 252, 0.1), transparent);
    opacity: 0;
    transition: opacity 0.3s;
}

.selector-btn:hover::before {
    opacity: 1;
}

.selector-btn.has-selection {
    border-color: rgba(126, 231, 216, 0.6);
    background: linear-gradient(135deg, rgba(126, 231, 216, 0.08), rgba(18, 184, 134, 0.06));
    box-shadow: 0 0 0 2px rgba(126, 231, 216, 0.15);
}

.selector-btn .selected-text { 
    display: inline-flex; 
    gap: 8px; 
    align-items: center;
    font-weight: 500;
}

.selector-btn .selected-text::before {
    content: "●";
    color: rgba(126, 231, 216, 0.8);
    font-size: 0.5rem;
    opacity: 0;
    transition: opacity 0.3s;
}

.selector-btn.has-selection .selected-text::before {
    opacity: 1;
}

.selector-btn .arrow { 
    color: var(--text-muted); 
    font-size: .74rem;
    transition: transform 0.3s;
}

.selector-btn.has-selection .arrow {
    color: rgba(126, 231, 216, 0.7);
}

.prompt-mode-group { display: flex; gap: 8px; }

.prompt-mode-group--prompt {
    flex-wrap: wrap;
}

.prompt-mode-group--prompt .prompt-mode-btn {
    width: calc(50% - 4px);
}

.prompt-mode-btn,
.platform-mode-btn {
    padding: 10px 8px;
    cursor: pointer;
    text-align: center;
    line-height: 1.35;
    font-size: .72rem;
    transition: .2s;
}

.prompt-mode-btn .mode-icon,
.platform-mode-btn .mode-icon {
    display: block;
    font-size: 1rem;
    margin-bottom: 2px;
}

.prompt-mode-btn .mode-label,
.platform-mode-btn .mode-label {
    display: block;
    margin-top: 2px;
    color: var(--text-muted);
    font-size: .58rem;
}

.prompt-mode-btn.active,
.platform-mode-btn.active,
.btn-option.active {
    border-color: rgba(255, 214, 255, 0.72);
    background: linear-gradient(135deg, rgba(192, 132, 252, 0.34), rgba(244, 114, 182, 0.24));
    color: #fff;
    box-shadow: 0 0 0 3px rgba(192, 132, 252, 0.2), 0 0 22px rgba(244, 114, 182, 0.2);
}

.prompt-mode-btn.active .mode-label,
.platform-mode-btn.active .mode-label {
    color: rgba(235, 242, 255, 0.85);
}

.generate-btn {
    width: 100%;
    border: 0;
    border-radius: 14px;
    padding: 13px 14px;
    font-size: .9rem;
    font-weight: 700;
    color: #fff;
    background: linear-gradient(135deg, #c084fc, #f0abfc 52%, #f9a8d4);
    cursor: pointer;
    transition: transform .2s, box-shadow .2s;
    box-shadow: 0 12px 28px rgba(193, 117, 255, 0.42), 0 0 30px rgba(244, 114, 182, 0.18);
}

.generate-btn:hover { transform: translateY(-1px); }
.generate-btn:active { transform: translateY(0); }

.divider {
    border: 0;
    border-top: 1px solid var(--border-soft);
    margin: 12px 0;
}

.image-upload-zone {
    border: 1px dashed rgba(240, 171, 252, 0.58);
    border-radius: 12px;
    padding: 12px;
    text-align: center;
    position: relative;
    transition: .2s;
    background: rgba(70, 45, 124, 0.22);
}

.image-upload-zone:hover,
.image-upload-zone.dragover {
    border-color: rgba(255, 221, 255, 0.9);
    background: rgba(101, 69, 174, 0.28);
}

.image-upload-zone input[type="file"] {
    position: absolute;
    inset: 0;
    opacity: 0;
    cursor: pointer;
}

.image-upload-zone .upload-icon { font-size: 1.4rem; }
.image-upload-zone .upload-text { margin-top: 3px; font-size: .7rem; color: var(--text-secondary); }

.image-preview-wrapper {
    display: none;
    position: relative;
    margin-top: 8px;
}

.image-preview-wrapper img {
    width: 100%;
    border-radius: 10px;
    border: 1px solid var(--border-soft);
}

.image-preview-wrapper .remove-image {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 24px;
    height: 24px;
    border-radius: 999px;
    border: 0;
    background: rgba(240, 62, 62, 0.95);
    color: #fff;
    cursor: pointer;
}

.empty-state {
    min-height: 58vh;
    border: 1px dashed var(--border-soft);
    border-radius: var(--radius-md);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 22px;
    color: var(--text-secondary);
    background: linear-gradient(180deg, rgba(82, 54, 146, 0.26), rgba(47, 31, 89, 0.22));
    backdrop-filter: blur(12px);
}

.empty-state .empty-icon {
    font-size: 2.4rem;
    margin-bottom: 10px;
}

.empty-state h3 {
    font-size: 1.12rem;
    margin-bottom: 8px;
    color: #fff;
}

.empty-state p {
    font-size: 0.8rem;
    line-height: 1.7;
    max-width: 540px;
}

.storyboard-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 14px;
}

.storyboard-title h2 { font-size: 1.05rem; }
.storyboard-title h2 span { color: #b8c2ff; }

.style-badge {
    border-radius: 999px;
    padding: 6px 10px;
    font-size: .64rem;
    border: 1px solid var(--border-soft);
    background: rgba(25, 37, 78, 0.85);
    color: #e7ecff;
}

.scene-card {
    border: 1px solid var(--border-soft);
    border-radius: var(--radius-md);
    overflow: hidden;
    background: linear-gradient(180deg, rgba(80, 54, 136, 0.34), rgba(45, 30, 84, 0.45));
    box-shadow: var(--shadow-md);
    margin-bottom: 14px;
    animation: fadeIn .25s ease-out;
}

.scene-header {
    padding: 12px 14px;
    border-bottom: 1px solid var(--border-soft);
    background: rgba(92, 62, 154, 0.26);
}

.scene-header h3 {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: .88rem;
}

.scene-number {
    width: 28px;
    height: 28px;
    border-radius: 10px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: .74rem;
    font-weight: 700;
    background: rgba(240, 171, 252, 0.22);
    border: 1px solid rgba(255, 222, 255, 0.42);
    box-shadow: 0 0 18px rgba(240, 171, 252, 0.2);
}

.scene-tag {
    margin-left: auto;
    font-size: .6rem;
    border: 1px solid var(--border-soft);
    border-radius: 999px;
    padding: 3px 8px;
    color: #dbe4ff;
}

.scene-variant-badge {
    font-size: .6rem;
    border-radius: 999px;
    padding: 3px 8px;
    border: 1px solid var(--border-soft);
    color: #e7ecff;
}

.scene-variant-badge.variant-a {
    background: linear-gradient(135deg, rgba(14, 165, 233, 0.28), rgba(6, 182, 212, 0.22));
    border-color: rgba(34, 211, 238, 0.42);
}

.scene-variant-badge.variant-b {
    background: linear-gradient(135deg, rgba(168, 85, 247, 0.28), rgba(236, 72, 153, 0.22));
    border-color: rgba(217, 70, 239, 0.42);
}

.scene-story {
    padding: 13px 14px;
    font-size: .78rem;
    line-height: 1.75;
    color: var(--text-secondary);
    border-bottom: 1px solid var(--border-soft);
}

.scene-story .story-label {
    color: #cbd5ff;
    font-weight: 600;
    font-size: .66rem;
    letter-spacing: .3px;
}

.scene-prompts {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    padding: 12px;
}

.prompt-block {
    border: 1px solid var(--border-soft);
    border-radius: 12px;
    background: rgba(68, 44, 122, 0.32);
    padding: 12px;
    min-width: 0;
    max-width: 100%;
    overflow: hidden;
    transition: transform .2s ease;
}

.prompt-block:hover { transform: translateY(-1px); }

.prompt-block-title {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 8px;
    font-size: .64rem;
    text-transform: uppercase;
    letter-spacing: .8px;
}

.prompt-block-title.img-prompt { color: #7de3b0; }
.prompt-block-title.vid-prompt { color: #ffd166; }

.prompt-block p,
.block-text,
.prompt-content {
    white-space: pre-wrap;
    font-size: .74rem;
    line-height: 1.4;
    margin: 0;
    max-width: 100%;
    overflow-wrap: anywhere;
    word-break: break-word;
    overflow-x: hidden;
    color: #d6e0ff;
    font-family: 'Inter', monospace;
}

.copy-btn,
.action-btn {
    border: 1px solid var(--border-soft);
    border-radius: 10px;
    background: rgba(85, 57, 152, 0.32);
    color: #dbe4ff;
    cursor: pointer;
    transition: .2s;
}

.copy-btn {
    padding: 5px 10px;
    font-size: .64rem;
    margin-left: auto;
}

.copy-btn:hover,
.action-btn:hover {
    border-color: rgba(255, 221, 255, 0.74);
    box-shadow: 0 0 16px rgba(240, 171, 252, 0.22);
}

.copy-btn.copied {
    border-color: rgba(18, 184, 134, 0.55);
    color: #89f0cd;
    background: rgba(18, 184, 134, 0.12);
}

.edit-prompt-btn {
    background: rgba(240, 62, 62, 0.15);
    border-color: rgba(240, 62, 62, 0.25);
    color: #ffc9c9;
}

.edit-prompt-btn.editing {
    background: rgba(18, 184, 134, 0.15);
    border-color: rgba(18, 184, 134, 0.3);
    color: #9cf3d6;
}

.edit-textarea {
    width: 100%;
    min-height: 120px;
    border: 1px solid var(--border-soft);
    border-radius: 10px;
    background: rgba(8, 14, 32, 0.9);
    color: #dfe6ff;
    font-family: 'Inter', monospace;
    font-size: 0.74rem;
    line-height: 1.7;
    padding: 10px;
    resize: vertical;
    outline: none;
}

.edit-textarea:focus {
    border-color: rgba(110, 120, 255, 0.7);
    box-shadow: 0 0 0 3px rgba(110, 120, 255, 0.2);
}

.action-btn {
    padding: 10px 14px;
    font-size: .78rem;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.action-btn.open-gem { color: #c5cbff; }

.loading-overlay {
    position: fixed;
    inset: 0;
    z-index: 3000;
    background: rgba(12, 8, 26, 0.52);
    backdrop-filter: blur(3px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
}

.loading-popup {
    width: min(420px, 92vw);
    border: 1px solid var(--border-soft);
    border-radius: 16px;
    background: linear-gradient(180deg, rgba(74, 51, 126, 0.9), rgba(37, 25, 70, 0.95));
    box-shadow: var(--shadow-lg);
    backdrop-filter: blur(10px) saturate(125%);
    padding: 16px 16px 14px;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    animation: loadingPopupIn .18s ease-out;
}

.loading-spinner {
    width: 44px;
    height: 44px;
    border: 3px solid rgba(110, 120, 255, 0.2);
    border-top-color: var(--accent);
    border-radius: 999px;
    animation: spin .8s linear infinite;
}

.loading-text { margin-top: 12px; font-size: .9rem; font-weight: 600; }
.loading-sub { margin-top: 4px; font-size: .76rem; color: var(--text-muted); }

.app-alert-overlay {
    position: fixed;
    inset: 0;
    z-index: 3800;
    background: rgba(9, 6, 20, 0.55);
    backdrop-filter: blur(5px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
}

.app-alert-card {
    width: min(460px, 95vw);
    border-radius: 16px;
    border: 1px solid var(--border-soft);
    background: linear-gradient(180deg, rgba(63, 43, 112, 0.96), rgba(27, 19, 58, 0.97));
    box-shadow: 0 20px 48px rgba(18, 10, 42, 0.52);
    animation: modalPop .2s ease-out;
    overflow: hidden;
}

.app-alert-head {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 14px;
    border-bottom: 1px solid var(--border-soft);
    background: rgba(22, 16, 49, 0.45);
}

.app-alert-icon {
    width: 28px;
    height: 28px;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.95rem;
    background: rgba(255, 255, 255, 0.08);
}

.app-alert-title {
    font-size: 0.88rem;
    font-weight: 700;
    color: #efe9ff;
}

.app-alert-close {
    margin-left: auto;
    width: 28px;
    height: 28px;
    border-radius: 999px;
    border: 1px solid var(--border-soft);
    background: rgba(255, 255, 255, 0.05);
    color: #ddd6fe;
    cursor: pointer;
}

.app-alert-body {
    padding: 14px;
    color: #f3f0ff;
    font-size: 0.85rem;
    line-height: 1.55;
    word-break: break-word;
}

.app-alert-actions {
    padding: 0 14px 14px;
    display: flex;
    justify-content: flex-end;
}

.app-alert-ok {
    border: 1px solid var(--border-soft);
    border-radius: 10px;
    padding: 8px 16px;
    font-size: 0.8rem;
    font-weight: 700;
    color: #f8f3ff;
    background: linear-gradient(135deg, #6366f1, #4f46e5);
    cursor: pointer;
}

.app-alert-warning .app-alert-title { color: #fde68a; }
.app-alert-error .app-alert-title { color: #fca5a5; }
.app-alert-success .app-alert-title { color: #86efac; }

@keyframes loadingPopupIn {
    0% { transform: translateY(8px) scale(0.98); opacity: 0; }
    100% { transform: translateY(0) scale(1); opacity: 1; }
}

.modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 2000;
    display: none;
    align-items: center;
    justify-content: center;
    background: rgba(24, 14, 45, 0.62);
    backdrop-filter: blur(5px);
}

.modal-overlay.active { display: flex; }

.modal {
    width: min(940px, 92vw);
    max-height: 82vh;
    display: flex;
    flex-direction: column;
    border-radius: 20px;
    overflow: hidden;
    border: 1px solid var(--border);
    background: linear-gradient(180deg, rgba(74, 51, 126, 0.72), rgba(37, 25, 70, 0.82));
    box-shadow: var(--shadow-lg);
    animation: modalPop .2s ease-out;
    backdrop-filter: blur(16px) saturate(135%);
}

.modal-header {
    padding: 14px 16px;
    border-bottom: 1px solid var(--border-soft);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.modal-header h3 { font-size: .88rem; }

.modal-close {
    width: 30px;
    height: 30px;
    border-radius: 999px;
    border: 1px solid var(--border-soft);
    background: rgba(20, 30, 60, 0.85);
    color: #d5ddff;
    cursor: pointer;
}

.modal-body {
    flex: 1;
    min-height: 0;
    padding: 14px;
    overflow-y: auto;
}

.modal-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

.modal-card {
    padding: 12px;
    display: flex;
    align-items: flex-start;
    gap: 10px;
    cursor: pointer;
    position: relative;
    border: 2px solid rgba(232, 196, 255, 0.2);
    border-radius: 12px;
    background: rgba(68, 44, 122, 0.18);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: hidden;
}

.modal-card::before {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(192, 132, 252, 0.1), rgba(244, 114, 182, 0.1));
    opacity: 0;
    transition: opacity 0.3s;
    pointer-events: none;
}

.modal-card:hover {
    border-color: rgba(240, 171, 252, 0.5);
    background: rgba(92, 62, 154, 0.28);
    transform: translateY(-2px) scale(1.02);
    box-shadow: 0 8px 24px rgba(192, 132, 252, 0.2);
}

.modal-card:hover::before {
    opacity: 1;
}

.modal-card.active {
    border-color: rgba(126, 231, 216, 0.8) !important;
    background: linear-gradient(135deg, rgba(126, 231, 216, 0.18), rgba(18, 184, 134, 0.12)) !important;
    box-shadow: 0 0 0 3px rgba(126, 231, 216, 0.2), 0 8px 24px rgba(18, 184, 134, 0.25);
    transform: translateY(-3px) scale(1.03);
    animation: selectPulse 0.4s ease-out;
}

.modal-card.active::after {
    content: "✓";
    position: absolute;
    top: 8px;
    right: 8px;
    width: 22px;
    height: 22px;
    border-radius: 999px;
    background: linear-gradient(135deg, rgba(126, 231, 216, 0.9), rgba(125, 211, 252, 0.9));
    color: #0a1f1a;
    font-size: 0.6rem;
    font-weight: 800;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(126, 231, 216, 0.4);
    animation: checkmarkAppear 0.3s ease-out;
}

@keyframes selectPulse {
    0% {
        box-shadow: 0 0 0 0 rgba(126, 231, 216, 0.4);
    }
    50% {
        box-shadow: 0 0 0 8px rgba(126, 231, 216, 0.1);
    }
    100% {
        box-shadow: 0 0 0 3px rgba(126, 231, 216, 0.2), 0 8px 24px rgba(18, 184, 134, 0.25);
    }
}

@keyframes checkmarkAppear {
    0% {
        opacity: 0;
        transform: scale(0.5) rotate(-45deg);
    }
    100% {
        opacity: 1;
        transform: scale(1) rotate(0deg);
    }
}

.modal-card .mc-icon { 
    width: 32px; 
    min-width: 32px;
    text-align: center; 
    font-size: 1.3rem; 
    padding-top: 2px;
}

.modal-card .mc-info { flex: 1; min-width: 0; }
.modal-card .mc-info .mc-name { 
    font-size: .76rem; 
    font-weight: 600; 
    color: var(--text-primary);
}
.modal-card .mc-info .mc-desc { 
    font-size: .64rem; 
    color: var(--text-muted); 
    margin-top: 3px; 
    line-height: 1.4;
}

/* ===== HELP/TUTORIAL MODAL ===== */
.help-modal { max-width: 600px; }

.tutorial-steps {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.tutorial-step {
    padding: 16px;
    border-radius: 12px;
    border: 1px solid var(--border-soft);
    background: rgba(68, 44, 122, 0.18);
    animation: slideInUp 0.3s ease-out;
    display: none;
}

.tutorial-step.active {
    display: block;
}

.tutorial-step .step-number {
    font-size: 0.7rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin-bottom: 8px;
}

.tutorial-step h4 {
    font-size: 1rem;
    margin-bottom: 8px;
    color: var(--accent);
}

.tutorial-step p {
    font-size: 0.85rem;
    line-height: 1.6;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.tutorial-step-highlight {
    display: inline-block;
    background: rgba(192, 132, 252, 0.15);
    padding: 2px 6px;
    border-radius: 4px;
    border-left: 2px solid var(--accent);
}

.tutorial-action-list {
    list-style: none;
    margin-top: 12px;
    padding-left: 0;
}

.tutorial-action-list li {
    padding: 8px 0;
    padding-left: 24px;
    position: relative;
    font-size: 0.85rem;
    color: var(--text-secondary);
    line-height: 1.5;
}

.tutorial-action-list li::before {
    content: "→";
    position: absolute;
    left: 4px;
    color: var(--accent);
    font-weight: bold;
}

.tutorial-progress {
    display: flex;
    gap: 4px;
    margin-bottom: 12px;
    justify-content: center;
}

.tutorial-dot {
    width: 8px;
    height: 8px;
    border-radius: 999px;
    background: rgba(192, 132, 252, 0.3);
    transition: all 0.2s ease-out;
}

.tutorial-dot.active {
    background: var(--accent);
    transform: scale(1.3);
}

@keyframes slideInUp {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.admin-user-list { max-height: 350px; overflow-y: auto; }

.admin-user-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 8px;
    padding: 10px 12px;
    border-radius: 10px;
    border: 1px solid var(--border-soft);
    background: rgba(17, 28, 58, 0.74);
}

.admin-user-info { display: flex; align-items: center; gap: 8px; }
.admin-user-info .user-email { font-size: .74rem; color: #e7ecff; }
.admin-user-info .user-role { font-size: .6rem; border-radius: 8px; padding: 2px 8px; }
.admin-user-info .user-role.role-admin { color: #cbd2ff; background: rgba(110, 120, 255, 0.18); }
.admin-user-info .user-role.role-user { color: #9cefd5; background: rgba(18, 184, 134, 0.16); }

.admin-remove-btn,
.admin-add-btn,
.logout-btn,
.admin-btn,
.denied-back-btn,
.open-browser-btn,
.google-login-btn {
    border: 1px solid var(--border-soft);
    border-radius: 10px;
    cursor: pointer;
    font-family: 'Inter', 'Prompt', sans-serif;
}

@keyframes spin { to { transform: rotate(360deg); } }
@keyframes fadeIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
@keyframes modalPop { from { opacity: 0; transform: translateY(8px) scale(.98); } to { opacity: 1; transform: translateY(0) scale(1); } }
@keyframes pulse {
    0% { box-shadow: 0 0 0 0 rgba(110, 120, 255, .45); }
    100% { box-shadow: 0 0 0 14px rgba(110, 120, 255, 0); }
}
@keyframes typingDot {
    0%, 60%, 100% { opacity: .3; transform: translateY(0); }
    30% { opacity: 1; transform: translateY(-3px); }
}

@keyframes sparkleDrift {
    0% { transform: translateY(0) scale(1); opacity: 0.48; }
    100% { transform: translateY(-8px) scale(1.02); opacity: 0.66; }
}

.typing-dots span { display: inline-block; margin: 0 1px; font-size: .62rem; }

/* ===== TYPOGRAPHY SCALE UP ===== */
html {
    font-size: 18px;
}

body {
    font-size: 1rem;
}

.sidebar-section-title {
    font-size: 0.8rem;
}

.text-input,
.selector-btn,
.prompt-mode-btn,
.platform-mode-btn,
.generate-btn,
.action-btn {
    font-size: 0.95rem;
}

.input-hint,
.mode-label,
.scene-tag,
.copy-btn {
    font-size: 0.78rem;
}

.empty-state h3,
.storyboard-title h2,
.scene-header h3,
.modal-header h3 {
    font-size: 1.1rem;
}

.empty-state p,
.scene-story,
.prompt-block p,
.block-text,
.prompt-content,
.modal-card .mc-info .mc-name,
.modal-card .mc-info .mc-desc {
    font-size: 0.92rem;
}

.scene-story .story-label,
.prompt-block-title,
.admin-user-info .user-role {
    font-size: 0.8rem;
}

@media (max-width: 1040px) {
    html {
        font-size: 16px;
    }
}

@media (max-width: 1260px) {
    .top-nav-bar {
        padding: 14px 16px;
    }

    .center-layout {
        margin-top: 20px;
    }
}

@media (max-width: 1040px) {
    .top-nav-bar {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }

    .top-nav-actions {
        width: 100%;
    }

    .tools-grid {
        grid-template-columns: 1fr;
    }

    .scene-prompts,
    .modal-grid {
        grid-template-columns: 1fr;
    }
}

/* ===== COSMIC GLASS LAYOUT (2026 REDESIGN) ===== */
:root {
    --layout-max: 1360px;
    --mobile-topbar-offset: 96px;
    --panel-glass: rgba(133, 96, 190, 0.2);
    --panel-glass-strong: rgba(77, 52, 124, 0.32);
    --panel-border: rgba(244, 214, 255, 0.34);
    --glow-soft: 0 0 22px rgba(238, 168, 255, 0.2);
    --glow-strong: 0 18px 48px rgba(36, 18, 74, 0.48);
}

body {
    min-height: 100vh;
    color: #f9f2ff;
    background:
        radial-gradient(circle at 14% 10%, rgba(236, 180, 255, 0.24) 0%, transparent 36%),
        radial-gradient(circle at 88% 8%, rgba(176, 196, 255, 0.2) 0%, transparent 30%),
        radial-gradient(circle at 70% 72%, rgba(216, 150, 255, 0.16) 0%, transparent 28%),
        linear-gradient(160deg, #1b1239 0%, #130b2d 46%, #0c0721 100%);
}

.galaxy-bg-layer {
    position: fixed;
    inset: 0;
    z-index: -1;
    overflow: hidden;
    pointer-events: none;
}

.galaxy-glow {
    position: absolute;
    border-radius: 50%;
    filter: blur(52px);
    opacity: 0.5;
    animation: galaxyFloat 22s ease-in-out infinite alternate;
}

.glow-a {
    width: 34vw;
    height: 34vw;
    top: -8vw;
    left: -4vw;
    background: radial-gradient(circle, rgba(237, 174, 255, 0.42), transparent 68%);
}

.glow-b {
    width: 30vw;
    height: 30vw;
    top: 8vh;
    right: -6vw;
    background: radial-gradient(circle, rgba(170, 196, 255, 0.34), transparent 68%);
    animation-delay: -8s;
}

.glow-c {
    width: 28vw;
    height: 28vw;
    bottom: -8vw;
    left: 44%;
    background: radial-gradient(circle, rgba(216, 159, 255, 0.28), transparent 70%);
    animation-delay: -14s;
}

.starfield {
    position: absolute;
    inset: -20%;
    background-image:
        radial-gradient(2px 2px at 12% 18%, rgba(255, 255, 255, 0.62), transparent 72%),
        radial-gradient(1.6px 1.6px at 28% 76%, rgba(255, 242, 255, 0.56), transparent 70%),
        radial-gradient(2px 2px at 83% 20%, rgba(241, 225, 255, 0.58), transparent 72%),
        radial-gradient(1.4px 1.4px at 64% 68%, rgba(225, 242, 255, 0.56), transparent 70%),
        radial-gradient(1.8px 1.8px at 48% 46%, rgba(255, 240, 252, 0.54), transparent 72%);
    opacity: 0.6;
    animation: starDrift 30s linear infinite;
}

.floating-topbar {
    position: sticky;
    top: 12px;
    z-index: 80;
    width: min(calc(100% - 28px), var(--layout-max));
    margin: 14px auto 0;
    padding: 12px 16px;
    border-radius: 20px;
    border: 1px solid var(--panel-border);
    background: linear-gradient(130deg, rgba(95, 66, 158, 0.4), rgba(44, 28, 80, 0.45));
    box-shadow: var(--glow-soft), var(--glow-strong);
    backdrop-filter: blur(18px) saturate(140%);
    -webkit-backdrop-filter: blur(18px) saturate(140%);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    transition: transform 0.3s ease-in-out, opacity 0.3s ease-in-out;
    transform: translateY(0);
    opacity: 1;
}

.floating-topbar.hidden {
    transform: translateY(-100%);
    opacity: 0;
    pointer-events: none;
}

.topbar-brand {
    display: flex;
    align-items: center;
    gap: 12px;
}

.brand-text {
    display: flex;
    flex-direction: column;
    line-height: 1.2;
}

.brand-text strong {
    font-size: 1rem;
    letter-spacing: 0.4px;
}

.brand-text span {
    font-size: 0.72rem;
    color: rgba(242, 225, 252, 0.86);
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.auth-entry-strip,
.user-entry-strip {
    width: min(calc(100% - 30px), var(--layout-max));
    margin: 10px auto 0;
}

.auth-entry-wrap,
.user-entry-wrap {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 8px;
}

.auth-entry-btn,
.user-entry-btn {
    min-height: 36px;
}

.content-canvas {
    width: min(calc(100% - 30px), var(--layout-max));
    margin: 18px auto 70px;
    min-height: calc(100vh - 170px);
    display: flex;
    align-items: flex-start;
    justify-content: center;
}

.center-stage {
    width: min(100%, 1060px);
    position: relative;
}

#storyboardResult {
    position: relative;
    z-index: 2;
}

.empty-state {
    min-height: 62vh;
    border: 1px solid var(--panel-border);
    border-radius: 28px;
    background: linear-gradient(160deg, rgba(126, 90, 183, 0.2), rgba(55, 35, 102, 0.26));
    box-shadow: var(--glow-soft), var(--glow-strong);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
}

.control-dock {
    position: fixed;
    right: 18px;
    bottom: 22px;
    z-index: 90;
    width: 250px;
    border: 1px solid var(--panel-border);
    border-radius: 18px;
    background: linear-gradient(170deg, rgba(110, 74, 178, 0.44), rgba(49, 31, 95, 0.45));
    box-shadow: var(--glow-soft), var(--glow-strong);
    backdrop-filter: blur(16px) saturate(140%);
    -webkit-backdrop-filter: blur(16px) saturate(140%);
    overflow: hidden;
    transition: width 0.25s ease, transform 0.25s ease;
}

.dock-toggle {
    width: 100%;
    border: 0;
    background: rgba(255, 255, 255, 0.08);
    color: #f7ebff;
    font-size: 0.95rem;
    font-weight: 700;
    letter-spacing: 0.5px;
    cursor: pointer;
    padding: 11px 14px;
    border-bottom: 1px solid rgba(244, 214, 255, 0.18);
}

.dock-body {
    display: grid;
    gap: 8px;
    padding: 10px;
}

.control-dock.collapsed {
    width: 62px;
}

.control-dock.collapsed .dock-body {
    display: none;
}

.control-dock .action-btn {
    width: 100%;
    justify-content: center;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(245, 216, 255, 0.24);
}

.action-btn,
.generate-btn,
.selector-btn,
.prompt-mode-btn,
.platform-mode-btn,
.modal-card,
.scene-card,
.prompt-block {
    transition: transform 0.2s ease, box-shadow 0.24s ease, border-color 0.2s ease, background-color 0.2s ease;
}

.action-btn:hover,
.generate-btn:hover,
.selector-btn:hover,
.prompt-mode-btn:hover,
.platform-mode-btn:hover,
.modal-card:hover,
.scene-card:hover,
.prompt-block:hover {
    transform: translateY(-2px);
    box-shadow: 0 0 22px rgba(238, 172, 255, 0.2);
}

.scene-card,
.storyboard-header,
.follow-up-card,
.quick-actions,
.chat-box {
    border-color: rgba(242, 214, 255, 0.24) !important;
    background: linear-gradient(150deg, rgba(102, 71, 166, 0.26), rgba(57, 37, 102, 0.34)) !important;
    border-radius: 18px;
}

.followup-fx {
    box-shadow: 0 14px 34px rgba(56, 35, 102, 0.35), 0 0 0 1px rgba(146, 130, 255, 0.1);
}

.followup-fx::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    height: 2px;
    background: linear-gradient(90deg, rgba(99, 102, 241, 0), rgba(99, 102, 241, 0.9), rgba(16, 185, 129, 0.9), rgba(99, 102, 241, 0));
    animation: followupShine 3.6s linear infinite;
    z-index: 1;
}

.followup-fx-layer {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 0;
    background:
        radial-gradient(circle at 12% 18%, rgba(99, 102, 241, 0.16) 0%, transparent 34%),
        radial-gradient(circle at 90% 10%, rgba(16, 185, 129, 0.12) 0%, transparent 32%);
}

.followup-fx .scene-header,
.followup-fx > div:not(.followup-fx-layer) {
    position: relative;
    z-index: 2;
}

.followup-live-badge {
    margin-left: auto;
    font-size: 0.66rem;
    letter-spacing: .4px;
    color: #86efac;
    background: rgba(16, 185, 129, 0.16);
    border: 1px solid rgba(16, 185, 129, 0.35);
    border-radius: 999px;
    padding: 3px 10px;
    animation: followupPulse 1.8s ease-in-out infinite;
}

@keyframes followupPulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.1); opacity: .9; }
    50% { box-shadow: 0 0 0 8px rgba(16, 185, 129, 0); opacity: 1; }
}

@keyframes followupShine {
    0% { transform: translateX(-18%); opacity: .4; }
    50% { opacity: 1; }
    100% { transform: translateX(18%); opacity: .4; }
}

.modal-overlay {
    background: rgba(18, 10, 38, 0.7);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.modal {
    border: 1px solid var(--panel-border);
    background: linear-gradient(170deg, rgba(92, 64, 156, 0.42), rgba(44, 27, 84, 0.6));
}

.pricing-modal {
    max-width: 720px;
}

.pricing-card {
    display: block;
    cursor: default;
}

.pricing-card-title {
    margin: 0 0 8px 0;
    font-size: 0.95rem;
}

.pricing-card-desc {
    margin: 0 0 10px 0;
    font-size: 0.82rem;
    line-height: 1.6;
    color: var(--text-secondary);
}

.pricing-card-price {
    margin: 0;
    font-weight: 700;
}

.pricing-empty-state {
    margin: 0;
}

.pricing-empty-title {
    margin-bottom: 8px;
}

.pricing-empty-desc {
    margin: 0;
}

.pricing-modal-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    flex-wrap: wrap;
    margin-top: 14px;
}

.auth-popup-modal {
    max-width: 560px;
}

.auth-popup-body {
    padding: 14px;
    overflow: auto;
}

.auth-popup-form {
    display: grid;
    gap: 8px;
}

.auth-popup-form label {
    font-size: 0.82rem;
    color: var(--text-secondary);
}

.auth-popup-alert {
    border-radius: 10px;
    padding: 9px 10px;
    font-size: 0.82rem;
    margin-bottom: 4px;
}

.auth-popup-alert.error {
    background: rgba(251, 113, 133, 0.16);
    border: 1px solid rgba(251, 113, 133, 0.45);
}

.auth-popup-alert.success {
    background: rgba(16, 185, 129, 0.16);
    border: 1px solid rgba(16, 185, 129, 0.45);
}

.auth-popup-check {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    font-size: 0.78rem;
    line-height: 1.45;
}

.auth-popup-check input[type="checkbox"] {
    margin-top: 2px;
}

.auth-popup-legal-links {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    margin-top: 4px;
}

.auth-popup-submit {
    width: 100%;
    justify-content: center;
    margin-top: 4px;
}

/* 🔧 MOBILE RESPONSIVE: Small Phones (320px - 480px) */
@media (max-width: 480px) {
    body {
        font-size: 13px;
    }

    .floating-topbar {
        top: 6px;
        padding: 8px;
        flex-direction: column;
        gap: 8px;
        position: fixed;
        width: calc(100% - 16px);
        left: 8px;
        right: 8px;
        z-index: 1000;
        background: rgba(30, 30, 50, 0.95);
        backdrop-filter: blur(12px);
        border-radius: 12px;
        box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    }

    .brand-text {
        display: none;
    }

    .topbar-actions {
        width: 100%;
        gap: 6px;
        flex-wrap: wrap;
    }

    .topbar-actions .action-btn,
    .topbar-actions .generate-btn {
        flex: 1;
        min-width: calc(50% - 3px);
        padding: 10px 8px;
        font-size: 12px;
    }

    .auth-entry-strip,
    .user-entry-strip {
        margin-top: var(--mobile-topbar-offset);
        width: calc(100% - 16px);
    }

    .auth-entry-wrap,
    .user-entry-wrap {
        width: 100%;
        gap: 6px;
    }

    .auth-entry-btn,
    .user-entry-btn {
        flex: 1;
        justify-content: center;
        font-size: 12px;
        padding: 10px 8px;
    }

    .content-canvas {
        margin-top: calc(var(--mobile-topbar-offset) + 14px);
        padding: 12px;
    }

    .center-stage {
        padding: 16px 8px;
    }

    .empty-icon {
        font-size: 48px;
    }

    .empty-state h3 {
        font-size: 18px;
    }

    .empty-state p {
        font-size: 12px;
        line-height: 1.4;
    }

    .storyboard-header {
        padding: 12px;
        margin-bottom: 12px;
    }

    .storyboard-title h2 {
        font-size: 16px;
        word-break: break-word;
    }

    .followup-live-badge {
        font-size: 0.6rem;
        padding: 3px 8px;
    }

    .style-badge {
        font-size: 11px;
        padding: 4px 8px;
    }

    .copy-btn {
        font-size: 11px;
        padding: 4px 8px;
    }

    .scene-card {
        padding: 12px;
        margin-bottom: 12px;
    }

    .scene-header h3 {
        font-size: 14px;
    }

    .prompt-block {
        min-width: 0;
        padding: 14px;
        margin-bottom: 12px;
        overflow: hidden;
    }

    .prompt-block-title {
        font-size: 12px;
        flex-wrap: wrap;
        gap: 4px;
    }

    .scene-prompts {
        gap: 12px;
        padding: 12px 0 0;
    }

    .block-text,
    .prompt-content,
    .prompt-block p {
        font-size: 11px;
        line-height: 1.58;
        max-height: 200px;
        overflow-y: auto;
        overflow-x: hidden;
        overflow-wrap: anywhere;
        word-break: break-word;
    }

    .control-dock {
        right: 8px;
        bottom: 8px;
        width: 160px;
    }

    #mainContent {
        scroll-behavior: smooth;
    }

    .pricing-modal {
        width: min(96vw, 96vw);
        max-height: 92vh;
    }

    .pricing-modal .modal-body {
        padding: 10px;
    }

    .pricing-modal-actions {
        flex-direction: column;
    }

    .pricing-modal-actions .action-btn {
        width: 100%;
        justify-content: center;
    }

    .auth-popup-modal {
        width: min(96vw, 96vw);
        max-height: 92vh;
    }

    .auth-popup-body {
        padding: 10px;
    }

    .auth-popup-legal-links {
        grid-template-columns: 1fr;
    }
}

/* 🔧 MOBILE RESPONSIVE: Medium Phones (480px - 768px) */
@media (max-width: 768px) and (min-width: 481px) {
    body {
        font-size: 14px;
    }

    .floating-topbar {
        top: 8px;
        padding: 12px;
        flex-direction: column;
        gap: 10px;
        width: calc(100% - 32px);
        left: 16px;
        right: 16px;
        border-radius: 14px;
        background: rgba(30, 30, 50, 0.95);
    }

    .brand-text strong {
        font-size: 14px;
    }

    .topbar-actions {
        width: 100%;
        gap: 8px;
    }

    .topbar-actions .action-btn,
    .topbar-actions .generate-btn {
        padding: 10px 10px;
        font-size: 13px;
        flex: 1;
    }

    .auth-entry-wrap,
    .user-entry-wrap {
        justify-content: flex-start;
        flex-wrap: wrap;
    }

    .auth-entry-btn,
    .user-entry-btn {
        flex: 1;
        min-width: 180px;
        justify-content: center;
    }

    .content-canvas {
        margin-top: 120px;
        padding: 16px;
    }

    .center-stage {
        padding: 16px;
    }

    .empty-icon {
        font-size: 56px;
    }

    .empty-state h3 {
        font-size: 20px;
    }

    .storyboard-header {
        flex-wrap: wrap;
        gap: 10px;
    }

    .storyboard-title h2 {
        font-size: 18px;
    }

    .style-badge {
        font-size: 12px;
        padding: 6px 10px;
    }

    .scene-card {
        padding: 14px;
    }

    .prompt-block {
        min-width: 0;
        overflow: hidden;
    }

    .scene-prompts {
        gap: 12px;
        padding: 12px 0 0;
    }

    .scene-header h3 {
        font-size: 15px;
    }

    .block-text,
    .prompt-content,
    .prompt-block p {
        font-size: 12px;
        line-height: 1.56;
        max-height: 250px;
        overflow-y: auto;
        overflow-x: hidden;
        overflow-wrap: anywhere;
        word-break: break-word;
    }

    .control-dock {
        width: 200px;
    }

    .pricing-modal-actions .action-btn {
        justify-content: center;
    }

    .auth-popup-body {
        padding: 12px;
    }
}

/* 🔧 TABLET RESPONSIVE (768px - 1024px) */
@media (min-width: 769px) and (max-width: 1024px) {
    .floating-topbar {
        flex-direction: row;
        padding: 12px 16px;
        gap: 16px;
    }

    .topbar-actions {
        gap: 12px;
    }

    .topbar-actions .action-btn,
    .topbar-actions .generate-btn {
        padding: 10px 14px;
        font-size: 14px;
    }

    .content-canvas {
        margin-top: 70px;
        padding: 20px;
    }

    .storyboard-header {
        flex-wrap: wrap;
        gap: 12px;
    }

    .scene-card {
        padding: 16px;
    }

    .block-text {
        font-size: 13px;
        max-height: 300px;
    }
}

/* 🔧 LANDSCAPE MODE (for phones in landscape) */
@media (max-height: 500px) and (orientation: landscape) {
    .floating-topbar {
        position: relative;
        margin-bottom: 12px;
        width: 100%;
        left: auto;
        right: auto;
    }

    .content-canvas {
        margin-top: 0;
        padding: 12px;
    }

    .center-stage {
        padding: 8px;
    }

    .storyboard-header {
        flex-wrap: wrap;
        gap: 8px;
    }

    .scene-card {
        padding: 10px;
        margin-bottom: 10px;
    }

    .scene-prompts {
        flex-direction: column;
    }

    .prompt-block {
        min-height: auto;
    }

    .block-text {
        max-height: 150px;
    }
}

/* 🔧 DESKTOP/LARGER TABLETS (1024px+) */
@media (min-width: 1025px) {
    .floating-topbar {
        flex-direction: row;
        gap: 20px;
    }

    .topbar-actions {
        gap: 16px;
    }

    .content-canvas {
        margin-top: 80px;
        padding: 40px;
    }

    .scene-card {
        padding: 20px;
    }
}

@media (max-width: 980px) {
    .floating-topbar {
        top: 8px;
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }

    .topbar-actions {
        width: 100%;
        justify-content: space-between;
    }

    .topbar-actions .action-btn,
    .topbar-actions .generate-btn {
        flex: 1;
    }

    .content-canvas {
        margin-top: 12px;
    }

    .control-dock {
        right: 12px;
        bottom: 12px;
        width: 220px;
    }
}

@keyframes galaxyFloat {
    0% { transform: translate3d(0, 0, 0) scale(1); }
    100% { transform: translate3d(2vw, -2vh, 0) scale(1.08); }
}

@keyframes starDrift {
    0% { transform: translate3d(0, 0, 0) scale(1); }
    100% { transform: translate3d(-8%, -6%, 0) scale(1.04); }
}
