:root {
    --bg: #0a1f33;
    --bg-glow: #0f2a44;
    --bg-card: rgba(19, 47, 76, 0.82);
    --bg-card-strong: #132f4c;
    --bg-card-contrast: #173a5e;
    --bg-input: rgba(10, 31, 51, 0.75);
    --border: rgba(0, 212, 255, 0.2);
    --border-strong: rgba(0, 212, 255, 0.42);
    --text: #ffffff;
    --text-muted: #c9d1d9;
    --text-secondary: #8b949e;
    --accent: #eeab47;
    --accent-strong: #f7c562;
    --accent-soft: rgba(238, 171, 71, 0.17);
    --accent-rgb: 238, 171, 71;
    --accent-strong-rgb: 247, 197, 98;
    --accent-next: #efaf50;
    --accent-next-strong: #f7c86a;
    --accent-next-rgb: 239, 175, 80;
    --accent-next-strong-rgb: 247, 200, 106;
    --tech-purple: #7b61ff;
    --tech-neon: #00d4ff;
    --success: #7addab;
    --danger: #ff7a6c;
    --warning: #f7c562;
    --primary: #00d4ff;
    --shadow: 0 24px 80px rgba(2, 9, 20, 0.5), 0 8px 26px rgba(0, 0, 0, 0.35);
    --radius: 24px;
    --radius-sm: 14px;
}

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

[hidden] {
    display: none !important;
}

body {
    min-height: 100vh;
    font-family: "Manrope", sans-serif;
    color: var(--text);
    position: relative;
    overflow-x: hidden;
    background:
        radial-gradient(circle at 12% -5%, rgba(0, 212, 255, 0.2), transparent 34%),
        radial-gradient(circle at 86% 18%, rgba(123, 97, 255, 0.22), transparent 30%),
        radial-gradient(circle at 50% 120%, rgba(238, 171, 71, 0.1), transparent 38%),
        linear-gradient(162deg, #0a1f33 0%, #0f2a44 52%, #0a1f33 100%);
}

body::before,
body::after {
    content: "";
    position: fixed;
    pointer-events: none;
    z-index: 0;
}

body::before {
    inset: -22vh auto auto -14vw;
    width: 56vw;
    height: 56vw;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(0, 212, 255, 0.16), transparent 65%);
}

body::after {
    inset: auto -10vw -28vh auto;
    width: 52vw;
    height: 52vw;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(123, 97, 255, 0.16), transparent 66%);
}

button,
input,
select,
textarea {
    font: inherit;
}

a {
    color: inherit;
}

.page-shell {
    min-height: 100vh;
    position: relative;
    z-index: 1;
}

.eyebrow {
    text-transform: uppercase;
    letter-spacing: 0.18em;
    font-size: 0.72rem;
    color: var(--text-muted);
}

.brand-mark {
    position: relative;
    width: 64px;
    height: 64px;
    flex: 0 0 64px;
}

.brand-mark-small {
    width: 44px;
    height: 44px;
    flex-basis: 44px;
}

.brand-ring {
    position: absolute;
    inset: 0;
    border-radius: 50%;
    border: 3px solid var(--accent);
}

.brand-play {
    position: absolute;
    top: 50%;
    left: 52%;
    width: 0;
    height: 0;
    border-top: 9px solid transparent;
    border-bottom: 9px solid transparent;
    border-left: 14px solid var(--accent);
    transform: translate(-45%, -50%);
}

.brand-mark-small .brand-play {
    border-top-width: 6px;
    border-bottom-width: 6px;
    border-left-width: 10px;
}

.auth-shell {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2rem 2rem 1rem;
    gap: 0.6rem;
    overflow-y: auto;
}

.auth-brand {
    width: min(100%, 420px);
    display: grid;
    gap: 1rem;
    justify-items: center;
    text-align: center;
}

.auth-brand-image {
    width: min(100%, 220px);
    height: auto;
}

.auth-brand-text {
    display: grid;
    gap: 0.55rem;
    justify-items: center;
}

.auth-brand h1,
.logo h1,
.page-header h1,
.page-header h3,
.section-title,
.auth-card h2 {
    font-family: "Outfit", sans-serif;
}

.auth-brand h1 {
    font-size: clamp(2rem, 4vw, 2.6rem);
    line-height: 1;
    margin-top: 0.35rem;
}

.auth-copy {
    margin-top: 0;
    color: var(--text-muted);
    line-height: 1.7;
    max-width: 38ch;
}

.auth-card {
    width: min(100%, 420px);
    padding: 2rem;
    border-radius: var(--radius);
    background: linear-gradient(160deg, rgba(23, 58, 94, 0.9), rgba(19, 47, 76, 0.94));
    border: 1px solid var(--border-strong);
    box-shadow: var(--shadow);
    backdrop-filter: blur(10px);
}

.auth-card-header {
    text-align: center;
}

.auth-card-header p {
    color: var(--text-muted);
    margin-top: 0.65rem;
}

.auth-form {
    display: grid;
    gap: 1rem;
    margin-top: 1.5rem;
}

.field span {
    display: block;
    color: #d3e1ef;
    margin-bottom: 0.45rem;
    font-size: 0.92rem;
}

.input {
    width: 100%;
    border: 1px solid var(--border);
    background: var(--bg-input);
    color: var(--text);
    border-radius: 12px;
    padding: 0.92rem 1rem;
    transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}

.input::placeholder {
    color: #7f99b3;
}

.input:focus {
    outline: none;
    border-color: var(--tech-neon);
    box-shadow: 0 0 0 3px rgba(0, 212, 255, 0.16), 0 0 22px rgba(0, 212, 255, 0.15);
}

.auth-status {
    margin-top: 1rem;
    padding: 0.8rem 0.95rem;
    border-radius: 12px;
    border: 1px solid rgba(246, 165, 47, 0.32);
    background: rgba(246, 165, 47, 0.1);
    color: #ffd69a;
    font-size: 0.92rem;
}

.auth-divider {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin: 1.4rem 0;
    color: var(--text-muted);
    font-size: 0.88rem;
}

.auth-divider::before,
.auth-divider::after {
    content: "";
    flex: 1;
    height: 1px;
    background: var(--border);
}

.provider-stack {
    display: grid;
    gap: 0.85rem;
    justify-items: center;
}

.google-login {
    width: min(100%, 300px);
    display: grid;
    place-items: center;
    justify-self: center;
}

#google-login-button {
    width: 100%;
    display: grid;
    place-items: center;
}

.provider-stack .btn-provider.btn-block {
    width: min(100%, 300px);
    justify-self: center;
}

.auth-switch {
    margin-top: 1.5rem;
    text-align: center;
    color: var(--text-muted);
}

.auth-legal-links {
    margin-top: 1rem;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.88rem;
}

.auth-legal-links a {
    color: var(--accent);
    text-decoration: none;
}

.auth-legal-links span {
    margin: 0 0.5rem;
    color: rgba(152, 174, 196, 0.7);
}

.link-button {
    border: 0;
    background: transparent;
    color: var(--accent);
    font-weight: 700;
    cursor: pointer;
}

.btn {
    border: 0;
    border-radius: 12px;
    padding: 0.9rem 1.15rem;
    cursor: pointer;
    transition: transform 0.2s ease, filter 0.2s ease, background 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
    font-weight: 700;
}

.btn:hover {
    transform: translateY(-1px);
    filter: brightness(1.02);
}

.btn-block {
    width: 100%;
}

.btn-sm {
    padding: 0.62rem 0.85rem;
    font-size: 0.84rem;
}

.btn-primary {
    background: linear-gradient(135deg, var(--accent) 0%, var(--accent-strong) 100%);
    color: #0a1f33;
    border: 1px solid rgba(var(--accent-rgb), 0.5);
    box-shadow: 0 8px 20px rgba(var(--accent-rgb), 0.24), 0 0 0 1px rgba(var(--accent-strong-rgb), 0.16);
}

.btn-primary:hover {
    transform: translateY(-1px) scale(1.03);
    box-shadow: 0 12px 24px rgba(var(--accent-rgb), 0.28), 0 0 12px rgba(var(--accent-rgb), 0.3);
}

.wizard-next-btn {
    background: linear-gradient(135deg, var(--accent-next) 0%, var(--accent-next-strong) 100%);
    border: 1px solid rgba(var(--accent-next-rgb), 0.55);
    box-shadow: 0 10px 22px rgba(var(--accent-next-rgb), 0.3), 0 0 0 1px rgba(var(--accent-next-strong-rgb), 0.2);
}

.wizard-next-btn:hover {
    box-shadow: 0 14px 28px rgba(var(--accent-next-rgb), 0.34), 0 0 14px rgba(var(--accent-next-rgb), 0.34);
}

.btn-add-project {
    min-width: 54px;
    width: 54px;
    height: 54px;
    padding: 0;
    border-radius: 14px;
    font-size: 2rem;
    line-height: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.btn-secondary {
    background: transparent;
    color: var(--text);
    border: 1px solid rgba(0, 212, 255, 0.42);
}

.btn-secondary:hover {
    border-color: var(--tech-neon);
    box-shadow: 0 0 0 1px rgba(0, 212, 255, 0.28), 0 0 16px rgba(0, 212, 255, 0.2);
}

.btn-provider {
    background: transparent;
    color: var(--text);
    border: 1px solid rgba(123, 97, 255, 0.45);
}

.btn-provider:hover {
    border-color: var(--tech-purple);
    box-shadow: 0 0 0 1px rgba(123, 97, 255, 0.28), 0 0 16px rgba(123, 97, 255, 0.22);
}

.social-connect-btn {
    display: inline-flex;
    align-items: center;
    justify-content: flex-start;
    gap: 0.65rem;
    min-height: 52px;
    padding: 0.78rem 1rem;
    border-radius: 14px;
}

.social-connect-icon {
    width: 20px;
    height: 20px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 20px;
}

.social-connect-icon svg {
    width: 20px;
    height: 20px;
    display: block;
}

.social-connect-label {
    font-weight: 700;
    letter-spacing: 0.01em;
    line-height: 1.1;
}

.social-connect-btn-youtube {
    border-color: rgba(255, 86, 86, 0.5);
    color: #ffe5e5;
    background: linear-gradient(135deg, rgba(255, 86, 86, 0.12), rgba(255, 86, 86, 0.03));
}

.social-connect-btn-youtube:hover {
    box-shadow: 0 0 0 1px rgba(255, 86, 86, 0.25), 0 0 16px rgba(255, 86, 86, 0.2);
}

.social-connect-btn-tiktok {
    border-color: rgba(77, 244, 255, 0.42);
    color: #dbfdff;
    background: linear-gradient(135deg, rgba(77, 244, 255, 0.12), rgba(255, 77, 168, 0.06));
}

.social-connect-btn-tiktok:hover {
    box-shadow: 0 0 0 1px rgba(77, 244, 255, 0.25), 0 0 16px rgba(77, 244, 255, 0.2);
}

.social-connect-btn-instagram {
    border-color: rgba(245, 140, 87, 0.45);
    color: #ffecd8;
    background: linear-gradient(135deg, rgba(245, 140, 87, 0.14), rgba(204, 90, 180, 0.08));
}

.social-connect-btn-instagram:hover {
    box-shadow: 0 0 0 1px rgba(245, 140, 87, 0.25), 0 0 16px rgba(245, 140, 87, 0.2);
}

#app {
    display: flex;
    min-height: 100vh;
}

/* Sidebar toggle button (visible when collapsed) */
.sidebar-toggle {
    display: none;
    position: fixed;
    top: 16px;
    left: 16px;
    z-index: 101;
    width: 40px;
    height: 40px;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: var(--bg-card-strong);
    color: var(--text);
    cursor: pointer;
    align-items: center;
    justify-content: center;
    transition: opacity 0.3s ease;
}
.sidebar-toggle:hover {
    background: var(--bg-card);
}
.sidebar-collapsed .sidebar-toggle {
    display: flex;
}

/* ── Sidebar (desktop) ── */
.sidebar {
    width: 240px;
    height: 100vh;
    background: var(--bg-card-strong);
    display: flex;
    flex-direction: column;
    position: fixed;
    left: 0;
    top: 0;
    z-index: 100;
    border-right: 1px solid var(--border);
    transition: transform 0.3s ease;
}

/* Sidebar collapsed state */
.sidebar-collapsed .sidebar {
    transform: translateX(-100%);
}
.sidebar-collapsed .main-content {
    margin-left: 0;
}

.sidebar-header {
    padding: 20px 16px;
    cursor: pointer;
}

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
}

.sidebar-logo-img {
    border-radius: 10px;
}

.logo-text {
    font-family: "Outfit", sans-serif;
    font-size: 22px;
    font-weight: 700;
    color: var(--text);
    letter-spacing: -0.5px;
}

.logo h1 {
    font-size: 1.5rem;
}

.sidebar-nav {
    padding: 0 8px;
    flex: 1;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    color: var(--text-muted);
    text-decoration: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 400;
    transition: background 0.2s, color 0.2s;
    cursor: pointer;
}

.nav-item svg {
    flex-shrink: 0;
}

.nav-item:hover {
    background: rgba(246, 165, 47, 0.08);
    color: var(--text);
}

.nav-item.active {
    background: rgba(246, 165, 47, 0.14);
    color: var(--text);
    font-weight: 500;
}

.sidebar-footer {
    padding: 16px;
    border-top: 1px solid var(--border);
}

.sidebar-legal-links {
    margin-top: 12px;
    display: flex;
    gap: 12px;
    font-size: 0.8rem;
}

.sidebar-legal-links a {
    color: var(--text-muted);
    text-decoration: none;
}

.sidebar-legal-links a:hover {
    color: var(--accent);
}

/* ── Credits Display & Modal ── */
.sidebar-credits {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 7px 12px;
    border-radius: 12px;
    background: rgba(var(--accent-rgb), 0.08);
    border: 1px solid rgba(var(--accent-rgb), 0.24);
    cursor: pointer;
    font-size: 12px;
    font-weight: 600;
    color: var(--accent);
    transition: all 0.2s;
    white-space: nowrap;
}
.sidebar-credits:hover {
    background: rgba(var(--accent-rgb), 0.14);
    border-color: rgba(var(--accent-rgb), 0.42);
}

.sidebar-credits-label {
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.01em;
}

.sidebar-credits [data-credits-count] {
    font-weight: 700;
    font-size: 13px;
}
.credits-modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
    animation: fadeIn 0.15s ease-out;
}
.credits-modal {
    background: var(--bg-card-strong);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    padding: 32px 28px 24px;
    max-width: 420px;
    width: 94%;
    position: relative;
    box-shadow: var(--shadow);
}
.credits-modal-close {
    position: absolute;
    top: 12px;
    right: 14px;
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 22px;
    cursor: pointer;
    line-height: 1;
}
.credits-modal-close:hover { color: var(--text); }
.credits-modal-title {
    text-align: center;
    font-size: 1.3rem;
    font-weight: 700;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}
.credit-packages {
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.credit-package {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 18px;
    border-radius: 12px;
    border: 2px solid rgba(255, 255, 255, 0.1);
    background: rgba(255, 255, 255, 0.03);
    cursor: pointer;
    transition: all 0.2s;
    position: relative;
}
.credit-package:hover {
    border-color: rgba(var(--accent-rgb), 0.4);
}
.credit-package-selected {
    border-color: var(--accent);
    background: rgba(var(--accent-rgb), 0.08);
}
.credit-pkg-amount {
    font-size: 16px;
    font-weight: 600;
    color: #fff;
}
.credit-pkg-price {
    font-size: 18px;
    font-weight: 700;
    color: var(--accent);
}
.credit-pkg-badge {
    position: absolute;
    top: -8px;
    right: 12px;
    background: #2ecc40;
    color: #000;
    font-size: 10px;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 8px;
    text-transform: uppercase;
}
.credits-cta {
    margin-top: 18px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.credits-btn {
    width: 100%;
    padding: 14px;
    border-radius: 12px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.2s;
}
.credits-btn-pix {
    background: var(--accent);
    color: #000;
}
.credits-btn-pix:hover {
    background: var(--accent-strong);
}
.credits-btn-card {
    background: rgba(255, 255, 255, 0.06);
    color: var(--text);
    border: 1px solid var(--border);
}
.credits-btn-card:hover {
    background: rgba(255, 255, 255, 0.1);
}
.credits-hint {
    text-align: center;
    color: var(--text-muted);
    font-size: 0.75rem;
    margin-top: 14px;
}
/* PIX QR Modal */
.pix-modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
}
.pix-modal {
    background: var(--bg-card-strong);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    padding: 32px 28px 24px;
    max-width: 400px;
    width: 94%;
    text-align: center;
    box-shadow: var(--shadow);
}
.pix-modal h3 { margin-bottom: 16px; }
.pix-qr-img { max-width: 220px; margin: 12px auto; border-radius: 12px; }
.pix-code-box {
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 10px 14px;
    font-size: 12px;
    word-break: break-all;
    color: var(--text-muted);
    margin: 12px 0;
    max-height: 80px;
    overflow-y: auto;
}
.pix-copy-btn {
    padding: 10px 24px;
    border-radius: 10px;
    background: var(--accent);
    color: #000;
    font-weight: 600;
    border: none;
    cursor: pointer;
    font-size: 14px;
}
.pix-copy-btn:hover { background: var(--accent-strong); }
.pix-waiting {
    color: var(--text-muted);
    font-size: 13px;
    margin-top: 14px;
}
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.sidebar-user {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 4px 6px;
    border-radius: 10px;
    cursor: pointer;
    transition: background 0.2s ease, border-color 0.2s ease;
    border: 1px solid transparent;
}

.sidebar-user:hover {
    background: rgba(255, 255, 255, 0.03);
    border-color: var(--border);
}

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

.user-avatar {
    width: 36px;
    height: 36px;
    flex-shrink: 0;
    border-radius: 50%;
    background: var(--bg-input);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    font-size: 14px;
}

.user-details {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

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

.user-role {
    font-size: 11px;
    font-weight: 600;
    color: var(--accent);
}

.btn-logout-icon {
    flex-shrink: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    border-radius: 8px;
    padding: 4px;
    transition: color 0.2s, background 0.2s;
}

.btn-logout-icon:hover {
    color: var(--danger);
    background: rgba(255, 122, 108, 0.12);
}

/* ── Main Content ── */
.main-content {
    margin-left: 240px;
    flex: 1;
    min-height: 100vh;
    padding: 24px 32px;
    transition: margin-left 0.3s ease;
    overflow-x: hidden;
}

.muted {
    color: var(--text-muted);
}

/* ── Profile page ── */
.profile-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
    padding: 2rem 1rem;
}

.profile-avatar {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    background: var(--bg-input);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
}

.profile-name {
    font-family: "Outfit", sans-serif;
    font-size: 1.4rem;
    font-weight: 700;
}

.profile-email {
    color: var(--text-muted);
    font-size: 0.9rem;
}

.profile-role-badge {
    display: inline-block;
    padding: 0.25rem 0.85rem;
    border-radius: 999px;
    font-size: 0.8rem;
    font-weight: 600;
    background: var(--accent-soft);
    color: var(--accent);
}

.profile-actions {
    margin-top: 1.5rem;
    display: flex;
    flex-wrap: wrap;
    gap: 0.65rem;
    justify-content: center;
}

.profile-admin-host {
    width: min(1180px, 100%);
    margin-top: 1rem;
    border: 1px solid var(--border);
    border-radius: 14px;
    background: rgba(9, 22, 35, 0.92);
    overflow: hidden;
}

.profile-admin-host-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.65rem;
    padding: 0.7rem 0.9rem;
    border-bottom: 1px solid var(--border);
    background: rgba(17, 34, 52, 0.95);
}

.profile-admin-host-header strong {
    font-family: "Outfit", sans-serif;
    font-size: 0.98rem;
    color: var(--accent);
}

.profile-admin-iframe {
    width: 100%;
    min-height: 72vh;
    border: 0;
}

/* ── Automate Page ── */
.automate-sections {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.automate-section .section-subtitle {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-bottom: 0.75rem;
}

.automate-header-actions {
    display: flex;
    align-items: center;
    gap: 0.55rem;
}

.auto-pilot-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.auto-pilot-empty {
    border: 1px dashed rgba(0, 212, 255, 0.28);
    border-radius: 12px;
    background: rgba(8, 28, 44, 0.55);
    padding: 0.9rem;
    display: grid;
    gap: 0.55rem;
    justify-items: flex-start;
}

.auto-pilot-item {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.75rem;
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 0.8rem 0.9rem;
    background: rgba(255, 255, 255, 0.02);
}

.auto-pilot-main {
    flex: 1;
    min-width: 0;
}

.auto-pilot-title-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin-bottom: 0.2rem;
}

.auto-pilot-title-row h4 {
    margin: 0;
    font-size: 0.98rem;
    font-weight: 600;
}

.auto-pilot-status {
    font-size: 0.68rem;
    font-weight: 700;
    border-radius: 999px;
    padding: 0.12rem 0.46rem;
    border: 1px solid transparent;
}

.auto-pilot-status.active {
    color: #22c55e;
    background: rgba(34, 197, 94, 0.12);
    border-color: rgba(34, 197, 94, 0.28);
}

.auto-pilot-status.inactive {
    color: #94a3b8;
    background: rgba(148, 163, 184, 0.12);
    border-color: rgba(148, 163, 184, 0.25);
}

.auto-pilot-meta {
    margin: 0.08rem 0;
    font-size: 0.82rem;
    color: var(--text-muted);
}

.auto-pilot-kpis {
    margin-top: 0.45rem;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.45rem;
}

.auto-pilot-kpis span {
    font-size: 0.76rem;
    color: var(--text-muted);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 8px;
    padding: 0.3rem 0.4rem;
    background: rgba(10, 20, 35, 0.4);
}

.auto-pilot-kpis strong {
    color: var(--text);
}

.auto-pilot-persona-box {
    margin-top: 0.6rem;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 10px;
    padding: 0.6rem;
    background: rgba(10, 20, 35, 0.32);
}

.auto-pilot-persona-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    margin-bottom: 0.45rem;
}

.auto-pilot-persona-head strong {
    font-size: 0.82rem;
}

.auto-pilot-persona-head small {
    color: var(--text-muted);
    font-size: 0.72rem;
}

.auto-pilot-persona-options {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
}

.auto-pilot-persona-summary {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
}

.auto-pilot-persona-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.28rem;
    font-size: 0.76rem;
    color: var(--text);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 999px;
    padding: 0.22rem 0.5rem;
    background: rgba(255, 255, 255, 0.035);
}

.auto-pilot-persona-chip-remove {
    border: 0;
    background: transparent;
    color: var(--text-muted);
    font-size: 0.9rem;
    line-height: 1;
    cursor: pointer;
    padding: 0;
}

.auto-pilot-persona-chip-remove:hover {
    color: var(--text);
}

.auto-pilot-persona-empty {
    font-size: 0.78rem;
    color: var(--text-muted);
}

.auto-pilot-persona-option {
    display: inline-flex;
    align-items: center;
    gap: 0.28rem;
    font-size: 0.78rem;
    color: var(--text);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 999px;
    padding: 0.22rem 0.5rem;
    background: rgba(255, 255, 255, 0.035);
    cursor: pointer;
}

.auto-pilot-persona-option input {
    accent-color: var(--primary);
}

.auto-pilot-actions {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    flex-wrap: wrap;
}

.auto-pilot-error {
    margin: 0.45rem 0 0;
    font-size: 0.76rem;
    color: #fca5a5;
}

.auto-pilot-note {
    margin-top: 0.8rem;
    font-size: 0.82rem;
}

.auto-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1rem 1.2rem;
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}

.auto-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
}

.auto-card-header h4 {
    font-size: 1rem;
    font-weight: 600;
    margin: 0;
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.auto-card-badges {
    display: flex;
    gap: 0.4rem;
    flex-wrap: wrap;
}

.auto-card-badges .badge {
    font-size: 0.72rem;
    padding: 0.15rem 0.5rem;
}

.auto-card-meta {
    display: flex;
    align-items: center;
    gap: 1rem;
    color: var(--text-muted);
    font-size: 0.85rem;
    flex-wrap: wrap;
}

.auto-card-themes {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.auto-card-themes strong {
    color: var(--text);
}

.auto-card-actions {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin-top: 0.25rem;
}

.auto-subtitle-setup-row {
    margin-top: 8px;
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.auto-subtitle-modal-note {
    margin: 0 0 10px;
    font-size: 0.83rem;
    color: var(--text-muted);
}

.auto-subtitle-preview-shell {
    margin-top: 6px;
    display: flex;
    justify-content: center;
}

.auto-subtitle-preview-frame {
    position: relative;
    width: min(100%, 240px);
    aspect-ratio: 9 / 16;
    border-radius: 14px;
    overflow: hidden;
    border: 1px solid rgba(0, 212, 255, 0.22);
    box-shadow: 0 10px 24px rgba(0, 0, 0, 0.35);
    background: #102134;
}

.auto-subtitle-preview-bg {
    position: absolute;
    inset: 0;
    background:
        radial-gradient(circle at 20% 20%, rgba(255, 197, 102, 0.45), transparent 45%),
        radial-gradient(circle at 75% 65%, rgba(41, 145, 224, 0.35), transparent 48%),
        linear-gradient(180deg, #1a3a57 0%, #0c1c2e 68%, #0a1625 100%);
}

.auto-subtitle-preview-caption {
    position: absolute;
    left: 50%;
    top: 82%;
    transform: translate(-50%, -50%);
    color: #facc15;
    background: rgba(0, 0, 0, 0.7);
    border-radius: 6px;
    padding: 4px 8px;
    font-family: "Arial Black", Arial, sans-serif;
    font-size: 24px;
    font-weight: 700;
    text-align: center;
    text-transform: uppercase;
    line-height: 1.12;
    letter-spacing: 0.3px;
    text-shadow: -1px -1px 0 #000, 1px -1px 0 #000, -1px 1px 0 #000, 1px 1px 0 #000;
    display: inline-block;
    max-width: 88%;
    white-space: normal;
    word-break: break-word;
    overflow: visible;
}

.auto-subtitle-style-title {
    margin-top: 12px;
    margin-bottom: 6px;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--accent);
    text-transform: uppercase;
    letter-spacing: 0.4px;
}
.auto-card-detail {
    border-top: 1px solid var(--border);
    padding-top: 0.75rem;
    margin-top: 0.25rem;
}

.auto-theme-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.auto-theme-item {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem;
    font-size: 0.85rem;
    padding: 0.35rem 0.5rem;
    border-radius: 6px;
    background: var(--bg-input);
}

.auto-theme-item .theme-status {
    flex-shrink: 0;
    font-size: 0.8rem;
}

.auto-theme-item .theme-text {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.auto-theme-item .theme-remove {
    cursor: pointer;
    color: var(--text-muted);
    background: none;
    border: none;
    font-size: 1rem;
    padding: 0 4px;
    line-height: 1;
    flex-shrink: 0;
}

.auto-theme-item .theme-date {
    flex-shrink: 0;
    font-size: 0.75rem;
    color: var(--accent);
    opacity: 0.9;
    white-space: nowrap;
}

.auto-theme-item .theme-date.theme-date-custom {
    color: #34d399;
    font-weight: 600;
}

.auto-theme-item .theme-date-editor {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    margin-left: auto;
    flex-shrink: 0;
}

.auto-theme-item .theme-date-input {
    border: 1px solid rgba(96, 129, 162, 0.38);
    background: rgba(7, 28, 52, 0.72);
    color: var(--text);
    border-radius: 6px;
    height: 28px;
    padding: 0 0.35rem;
    font-size: 0.72rem;
    min-width: 126px;
}

.auto-theme-item .theme-date-save,
.auto-theme-item .theme-date-clear {
    border-radius: 6px;
    border: 1px solid rgba(96, 129, 162, 0.35);
    background: rgba(255, 255, 255, 0.03);
    color: var(--text-muted);
    cursor: pointer;
    height: 28px;
    padding: 0 0.5rem;
    font-size: 0.7rem;
    font-weight: 600;
}

.auto-theme-item .theme-date-save:hover,
.auto-theme-item .theme-date-clear:hover {
    border-color: rgba(246, 165, 47, 0.44);
    color: var(--text);
}

.auto-theme-item .theme-date-save:disabled {
    opacity: 0.6;
    cursor: wait;
}

.auto-theme-item .theme-badge {
    flex-shrink: 0;
    font-size: 0.65rem;
    padding: 1px 6px;
    border-radius: 4px;
    font-weight: 600;
    white-space: nowrap;
}
.theme-badge.theme-done { background: #2ecc7122; color: #2ecc71; border: 1px solid #2ecc7144; }
.theme-badge.theme-processing { background: #f39c1222; color: #f39c12; border: 1px solid #f39c1244; }
.theme-badge.theme-failed { background: #e74c3c22; color: #e74c3c; border: 1px solid #e74c3c44; }

.auto-theme-item .theme-error-btn {
    flex-shrink: 0;
    font-size: 0.65rem;
    padding: 1px 6px;
    border-radius: 4px;
    border: 1px solid #e74c3c66;
    background: none;
    color: #e74c3c;
    cursor: pointer;
    white-space: nowrap;
}
.auto-theme-item .theme-run-btn {
    width: 26px;
    height: 26px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    border: 1px solid rgba(52, 211, 153, 0.45);
    background: rgba(52, 211, 153, 0.14);
    color: #34d399;
    cursor: pointer;
    flex-shrink: 0;
    transition: transform 0.16s ease, background 0.16s ease, border-color 0.16s ease;
}

.auto-theme-item .theme-run-btn svg {
    width: 12px;
    height: 12px;
    fill: currentColor;
}

.auto-theme-item .theme-run-btn:hover {
    transform: translateY(-1px);
    background: rgba(52, 211, 153, 0.22);
    border-color: rgba(52, 211, 153, 0.7);
}

.auto-theme-item .theme-run-btn:disabled {
    opacity: 0.55;
    cursor: wait;
    transform: none;
}
.auto-theme-item .theme-error-btn:hover { background: #e74c3c22; }

.auto-theme-item.theme-done { opacity: 0.7; }
.auto-theme-item.theme-failed { border-left: 2px solid #e74c3c; }

.btn-error-pulse {
    box-shadow: 0 0 0 3px #e74c3c, 0 0 12px #e74c3c88 !important;
    animation: errorPulse 0.5s ease-in-out 3;
}
@keyframes errorPulse {
    0%, 100% { box-shadow: 0 0 0 3px #e74c3c, 0 0 12px #e74c3c88; }
    50% { box-shadow: 0 0 0 5px #e74c3c, 0 0 20px #e74c3ccc; }
}

.auto-theme-item .theme-remove:hover {
    color: var(--danger, #e74c3c);
}

.auto-theme-add {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

.auto-theme-add input {
    flex: 1;
}

/* Automation wizard steps */
.automation-steps-dots {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    margin-bottom: 1.25rem;
}

.auto-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--border);
    transition: background 0.2s;
}

.auto-dot.active {
    background: var(--primary);
}

.auto-step {
    display: none;
}

.auto-step.active {
    display: block;
}

.auto-step-title {
    font-size: 1.05rem;
    font-weight: 600;
    margin: 0 0 0.75rem;
    text-align: center;
}

.auto-type-cards {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
}

.auto-type-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.4rem;
    padding: 1.25rem 0.75rem;
    border: 2px solid var(--border);
    border-radius: 12px;
    background: var(--bg-input);
    cursor: pointer;
    text-align: center;
    transition: border-color 0.2s, box-shadow 0.2s;
    color: var(--text);
}

.auto-type-card strong {
    font-size: 0.95rem;
}

.auto-type-card .muted {
    font-size: 0.78rem;
}

.auto-type-card:hover {
    border-color: var(--primary);
}

.auto-type-card.active {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(var(--primary-rgb, 99,102,241), 0.15);
}

.auto-manual-settings {
    margin-top: 0.75rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

/* ── Musical Shorts: Song Selection ── */
.auto-song-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 0.6rem;
    max-height: 290px;
    overflow-y: auto;
    padding-right: 0.2rem;
}

.auto-song-item {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 0.7rem 0.75rem;
    border: 2px solid var(--border);
    border-radius: 10px;
    background: var(--bg-input);
    cursor: pointer;
    transition: border-color 0.2s, background 0.2s, transform 0.2s;
    text-align: left;
    width: 100%;
    color: var(--text);
    position: relative;
    min-height: 84px;
}

.auto-song-item:hover {
    border-color: var(--primary);
    background: rgba(99, 102, 241, 0.05);
    transform: translateY(-1px);
}

.auto-song-item.active {
    border-color: var(--primary);
    background: rgba(99, 102, 241, 0.1);
    box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.15);
}

.auto-song-item .song-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}

.auto-song-item .song-info strong {
    font-size: 0.9rem;
    line-height: 1.25;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.auto-song-item .song-info .muted {
    font-size: 0.75rem;
}

.auto-song-item .song-check {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 22px;
    height: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.95rem;
    color: var(--primary);
    font-weight: 700;
    border: 1px solid var(--border);
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.04);
}

.auto-song-item.active .song-check {
    border-color: rgba(99, 102, 241, 0.45);
    background: rgba(99, 102, 241, 0.16);
}

@media (max-width: 768px) {
    .auto-song-list {
        grid-template-columns: 1fr;
        max-height: 250px;
    }
}

.input-range {
    width: 100%;
    accent-color: var(--primary);
}

.range-labels {
    display: flex;
    justify-content: space-between;
    font-size: 0.72rem;
    color: var(--text-muted);
    margin-top: -0.25rem;
}

.badge-shorts {
    background: #8b5cf622;
    color: #a78bfa;
    border: 1px solid #8b5cf644;
}

.badge-duration-long {
    background: #0ea5e922;
    color: #7dd3fc;
    border: 1px solid #0ea5e944;
}

.badge-duration-short {
    background: #f59e0b22;
    color: #fbbf24;
    border: 1px solid #f59e0b44;
}

.credit-estimate-row {
    margin-top: 0.6rem;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.45rem;
}

.credit-estimate-pill {
    margin-top: 0;
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.4rem 0.72rem;
    border-radius: 999px;
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.01em;
    border: 1px solid rgba(96, 129, 162, 0.32);
    background: rgba(7, 28, 52, 0.65);
    color: var(--text);
}

.credit-estimate-pill.is-loading {
    border-color: rgba(96, 129, 162, 0.46);
    color: var(--text-muted);
}

.credit-estimate-pill.is-ready {
    border-color: rgba(34, 197, 94, 0.42);
    background: rgba(34, 197, 94, 0.12);
    color: #9ef0bf;
}

.credit-estimate-pill.is-warning {
    border-color: rgba(246, 165, 47, 0.56);
    background: rgba(246, 165, 47, 0.14);
    color: #ffd48a;
}

.credit-estimate-pill.is-error {
    border-color: rgba(231, 76, 60, 0.52);
    background: rgba(231, 76, 60, 0.12);
    color: #ffb0a8;
}

.credit-add-btn {
    border: 1px solid rgba(var(--accent-rgb), 0.48);
    background: rgba(var(--accent-rgb), 0.14);
    color: #ffd997;
    border-radius: 999px;
    padding: 0.32rem 0.66rem;
    font-size: 0.72rem;
    line-height: 1;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s ease;
}

.credit-add-btn:hover {
    background: rgba(var(--accent-rgb), 0.22);
    border-color: rgba(var(--accent-rgb), 0.62);
}

.credit-add-btn:active {
    transform: translateY(1px);
}

.auto-theme-item .theme-credit-tag {
    flex-shrink: 0;
    font-size: 0.64rem;
    line-height: 1.15;
    padding: 2px 6px;
    border-radius: 999px;
    border: 1px solid rgba(246, 165, 47, 0.38);
    background: rgba(246, 165, 47, 0.12);
    color: #ffd997;
    white-space: nowrap;
}

/* ── Automation Video Type Grid (matching project wizard) ── */
.auto-video-type-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-top: 0.5rem;
}

.auto-video-type-grid .video-type-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 0.4rem;
    padding: 1.2rem 0.75rem;
    border: 2px solid var(--border);
    border-radius: 12px;
    background: var(--bg-input);
    cursor: pointer;
    transition: border-color 0.2s, background 0.2s, box-shadow 0.2s;
}

.auto-video-type-grid .video-type-card:hover {
    border-color: var(--primary);
}

.auto-video-type-grid .video-type-card.selected {
    border-color: var(--primary);
    background: rgba(99, 102, 241, 0.08);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}

.auto-video-type-grid .video-type-card .video-type-icon {
    margin-bottom: 0.25rem;
    color: var(--text-muted);
}

.auto-video-type-grid .video-type-card.selected .video-type-icon {
    color: var(--primary);
}

.auto-video-type-grid .video-type-card strong {
    font-size: 1rem;
}

.auto-video-type-grid .video-type-card small {
    color: var(--text-muted);
    font-size: 0.78rem;
    line-height: 1.3;
}

.modal-footer-space {
    display: flex;
    align-items: center;
}

/* ── Clip Selector Waveform ── */
.clip-waveform-wrap {
    position: relative;
    margin-top: 14px;
    padding: 0 2px 8px;
}

.clip-waveform-container {
    position: relative;
    width: 100%;
    height: 48px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 10px;
    overflow: hidden;
    cursor: pointer;
    touch-action: none;
}

.clip-waveform-container canvas {
    display: block;
}

.clip-waveform-selection {
    position: absolute;
    top: 0;
    height: 100%;
    background: transparent;
    border: 2px solid var(--accent, #e0a030);
    border-radius: 6px;
    cursor: grab;
    z-index: 2;
    pointer-events: auto;
    min-width: 20px;
    box-sizing: border-box;
}

.clip-waveform-selection:active {
    cursor: grabbing;
}

.clip-waveform-handle {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 14px;
    height: 32px;
    background: var(--accent, #e0a030);
    border-radius: 4px;
    cursor: ew-resize;
    z-index: 3;
}

.clip-handle-left {
    left: -7px;
}

.clip-handle-right {
    right: -7px;
}

.clip-waveform-handle::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 2px;
    height: 14px;
    background: rgba(0, 0, 0, 0.5);
    border-radius: 1px;
}

.clip-waveform-playhead {
    position: absolute;
    top: 0;
    left: 0;
    width: 2px;
    height: 100%;
    background: #fff;
    z-index: 4;
    pointer-events: none;
    transition: left 0.05s linear;
}

.clip-waveform-info {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 44px;
    font-size: 0.82rem;
    color: var(--text-muted, #8892a4);
}

.clip-waveform-play-btn {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: #fff;
    border-radius: 50%;
    width: 34px;
    height: 34px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 0.85rem;
    transition: background 0.2s;
    padding-left: 2px;
}

.clip-waveform-play-btn:hover {
    background: rgba(255, 255, 255, 0.15);
}

.clip-waveform-drag-hint {
    position: absolute;
    left: 50%;
    top: 52px;
    transform: translateX(-50%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: rgba(255, 255, 255, 0.78);
    font-size: 1.9rem;
    line-height: 1;
    pointer-events: auto;
    cursor: grab;
    z-index: 6;
    -webkit-user-select: none;
    user-select: none;
}

.clip-waveform-drag-hint:active {
    cursor: grabbing;
}

.clip-transcribe-status {
    margin-top: 8px;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.82rem;
    color: var(--accent);
}

.clip-transcribe-status::before {
    content: "";
    width: 12px;
    height: 12px;
    border: 2px solid rgba(246, 165, 47, 0.45);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

#clip-duration-options .duration-option:disabled,
#clip-play-btn:disabled,
#clip-close-btn:disabled,
#clip-back-btn:disabled,
#clip-apply-btn:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

/* ── Mobile Bottom Nav ── */
.mobile-bottom-nav {
    display: none;
}

.mobile-nav-tab {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 10px;
    font-family: inherit;
    cursor: pointer;
    padding: 6px 16px;
    transition: color 0.2s;
}

.mobile-nav-tab svg {
    flex-shrink: 0;
}

.mobile-nav-tab.active {
    color: var(--accent);
}

.page {
    display: none;
}

.page.active {
    display: block;
}

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

.page-header-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.page-header-right {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-left: auto;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.page-credits-badge {
    flex-shrink: 0;
}

.page-subheader {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: -0.6rem 0 1.35rem;
    flex-wrap: wrap;
}

.publish-subheader {
    justify-content: flex-start;
}

.automate-header-main {
    gap: 10px;
}

.mobile-profile-btn {
    display: none;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border: 2px solid var(--border);
    border-radius: 50%;
    background: var(--bg-card);
    color: var(--text-muted);
    cursor: pointer;
    padding: 0;
    transition: border-color 0.2s, color 0.2s;
    flex-shrink: 0;
}

.mobile-profile-btn:hover {
    border-color: var(--accent);
    color: var(--accent);
}

.page-header-left .btn-add-project {
    min-width: 36px;
    width: 36px;
    height: 36px;
    font-size: 1.4rem;
    border-radius: 10px;
}

.page-header h1 {
    font-family: "Outfit", sans-serif;
    font-size: 28px;
    font-weight: 700;
    color: var(--text);
    white-space: nowrap;
}

.page-header h3,
.section-title {
    font-size: 1.55rem;
}

.section-title {
    margin: 2rem 0 1rem;
}

.collapsible-section {
    margin-top: 1.2rem;
}
.collapsible-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    background: rgba(96, 129, 162, 0.08);
    border: 1px solid rgba(96, 129, 162, 0.18);
    border-radius: 10px;
    padding: 0.6rem 1rem;
    cursor: pointer;
    transition: background 0.2s;
}
.collapsible-toggle:hover {
    background: rgba(96, 129, 162, 0.16);
}
.collapsible-toggle .section-title {
    margin: 0;
    font-size: 1.15rem;
    color: #fff;
}
.collapsible-arrow {
    font-size: 0.85rem;
    color: #fff;
    transition: transform 0.25s ease;
}
.collapsible-toggle[aria-expanded="true"] .collapsible-arrow {
    transform: rotate(180deg);
}
.collapsible-body {
    padding-top: 0.6rem;
}

.publish-top-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem;
}

.publish-top-tab {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.62rem 0.92rem;
    border-radius: 11px;
    border-color: rgba(0, 212, 255, 0.32);
    color: var(--text-muted);
}

.publish-top-tab.active {
    color: var(--text);
    border-color: rgba(0, 212, 255, 0.68);
    box-shadow: 0 0 0 1px rgba(0, 212, 255, 0.22), 0 0 16px rgba(0, 212, 255, 0.14);
    background: linear-gradient(135deg, rgba(0, 212, 255, 0.12), rgba(123, 97, 255, 0.09));
}

.publish-tab-content {
    display: none;
}

.publish-tab-content.active {
    display: block;
}

.publish-subheader {
    margin-bottom: 1rem;
}

.publish-subheader h3 {
    margin: 0;
    font-size: 1.4rem;
}

.publish-subtitle {
    margin-top: 0;
    margin-bottom: 1rem;
}

.cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.1rem;
}

.panel,
.card,
.song-details {
    border: 1px solid var(--border);
    background: var(--bg-card);
    box-shadow: var(--shadow);
}

.card {
    border-radius: 16px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.card:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 24px rgba(0,0,0,0.25);
}

.panel,
.song-details {
    border-radius: 22px;
    padding: 1.25rem;
}

.card-thumb {
    width: 100%;
    height: 160px;
    object-fit: cover;
    display: block;
    background: rgba(96, 129, 162, 0.08);
}

.card-thumb-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    opacity: 0.3;
}

.card-body {
    padding: 1rem 1.1rem 0.6rem;
    flex: 1;
}

.card-body h4 {
    margin-bottom: 0.3rem;
    font-size: 0.95rem;
    line-height: 1.35;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Hide title on desktop — thumbnail already shows it */
@media (min-width: 769px) {
    .card-body .card-title {
        display: none !important;
    }
}

.card-meta {
    color: var(--text-muted);
    font-size: 0.78rem;
    margin-bottom: 0.45rem;
}

.card-error {
    color: var(--danger);
    font-size: 0.78rem;
    margin-top: 0.3rem;
}

.card-actions {
    display: flex;
    gap: 0.5rem;
}

.card-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.6rem 1.1rem 1rem;
    margin-top: auto;
}

.card-date {
    font-size: 0.72rem;
    color: var(--text-muted);
    white-space: nowrap;
    opacity: 0.7;
}
.expiry-countdown {
    color: #f59e0b;
    font-weight: 600;
}
.expiry-urgent {
    color: #ef4444;
    font-weight: 700;
    animation: pulse-urgent 1.5s ease-in-out infinite;
}
.expiry-expired {
    color: #6b7280;
    font-weight: 600;
    font-style: italic;
}
@keyframes pulse-urgent {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.expiry-warning-content p {
    margin: 0.5rem 0;
    line-height: 1.5;
}
.expiry-warning-highlight {
    background: rgba(245, 158, 11, 0.15);
    border-left: 3px solid #f59e0b;
    padding: 0.75rem 1rem;
    border-radius: 6px;
    margin-top: 1rem !important;
}

.card-btn {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: rgba(96, 129, 162, 0.08);
    color: var(--text-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.15s ease;
}

.card-btn:hover {
    background: rgba(96, 129, 162, 0.18);
    color: #fff;
    transform: scale(1.08);
}

.card-btn-watch {
    color: var(--accent);
    border-color: rgba(246, 210, 124, 0.3);
}

.card-btn-watch:hover {
    background: rgba(246, 210, 124, 0.18);
    color: var(--accent);
}

.card-btn-download {
    color: var(--accent);
    border-color: rgba(246, 210, 124, 0.3);
}

.card-btn-download:hover {
    background: rgba(246, 210, 124, 0.18);
    color: var(--accent);
}

.card-btn-publish {
    color: var(--tech-neon);
    border-color: rgba(0, 212, 255, 0.35);
}

.card-btn-publish:hover {
    background: rgba(0, 212, 255, 0.16);
    color: var(--tech-neon);
}

.card-btn-generate {
    color: var(--primary);
    border-color: rgba(59, 130, 246, 0.3);
}

.card-btn-generate:hover {
    background: rgba(59, 130, 246, 0.18);
    color: var(--primary);
}

.card-btn-similar {
    color: var(--success);
    border-color: rgba(122, 221, 171, 0.3);
}

.card-btn-similar:hover {
    background: rgba(122, 221, 171, 0.18);
    color: var(--success);
}

.card-btn-edit {
    color: #9dc7ff;
    border-color: rgba(157, 199, 255, 0.3);
}

.card-btn-edit:hover {
    background: rgba(157, 199, 255, 0.16);
    color: #9dc7ff;
}

.card-btn-delete {
    color: var(--danger);
    border-color: rgba(255, 122, 108, 0.2);
}

.card-btn-delete:hover {
    background: rgba(255, 122, 108, 0.15);
    color: var(--danger);
}

.form-group {
    margin-bottom: 1rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.45rem;
    color: #d3e1ef;
}

.publish-form-group {
    margin-bottom: 1.05rem;
}

.publish-select-row {
    display: grid;
    grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr);
    gap: 0.65rem;
    align-items: start;
}

.publish-select-row .publish-form-group {
    margin-bottom: 0.9rem;
}

.publish-selected-render-info {
    margin: 0 0 1rem;
    padding: 0.9rem 1rem;
    border-radius: 14px;
    border: 1px solid rgba(0, 212, 255, 0.18);
    background: rgba(7, 24, 41, 0.72);
    color: #9db3c8;
    font-size: 0.96rem;
    line-height: 1.45;
}

.publish-selected-render-info.has-value {
    color: var(--text);
    border-color: rgba(0, 212, 255, 0.32);
    box-shadow: inset 0 0 0 1px rgba(0, 212, 255, 0.08);
}

.pub-render-picker-btn {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    text-align: left;
    cursor: pointer;
}

.pub-render-picker-btn::after {
    content: "\25BE";
    color: var(--text-muted);
    font-size: 0.78rem;
    flex: 0 0 auto;
}

.pub-render-picker-btn.has-value {
    color: var(--text);
}

.pub-render-picker-btn:not(.has-value) {
    color: #9db3c8;
}

.pub-render-picker-btn:disabled {
    cursor: wait;
    opacity: 0.75;
}

.pub-render-select-native {
    display: none !important;
}

.publish-platforms-icons {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.publish-platform-chip {
    position: relative;
    width: 54px;
    height: 46px;
    border-radius: 12px;
    border: 1px solid rgba(96, 129, 162, 0.34);
    background: rgba(9, 35, 63, 0.72);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.18s ease;
}

.publish-platform-chip input {
    position: absolute;
    inset: 0;
    opacity: 0;
    cursor: pointer;
}

.publish-platform-icon {
    width: 22px;
    height: 22px;
    color: #d3e1ef;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.publish-platform-icon svg {
    width: 22px;
    height: 22px;
    display: block;
}

.publish-platform-youtube .publish-platform-icon {
    color: #ff8f8f;
}

.publish-platform-tiktok .publish-platform-icon {
    color: #90fcff;
}

.publish-platform-instagram .publish-platform-icon {
    color: #ffc698;
}

.publish-platform-chip:hover {
    transform: translateY(-1px);
    border-color: rgba(0, 212, 255, 0.55);
    box-shadow: 0 0 0 1px rgba(0, 212, 255, 0.2), 0 0 14px rgba(0, 212, 255, 0.15);
}

.publish-platform-chip:has(input:checked) {
    border-color: rgba(0, 212, 255, 0.78);
    background: linear-gradient(135deg, rgba(0, 212, 255, 0.16), rgba(123, 97, 255, 0.12));
    box-shadow: 0 0 0 1px rgba(0, 212, 255, 0.25), 0 0 16px rgba(0, 212, 255, 0.22);
}

.publish-account-selectors {
    margin-top: 0.85rem;
    display: grid;
    gap: 0.7rem;
    min-width: 0;
}

.publish-account-row {
    border: 1px solid rgba(0, 212, 255, 0.2);
    border-radius: 12px;
    background: rgba(12, 33, 53, 0.5);
    padding: 0.7rem;
    display: grid;
    gap: 0.45rem;
    min-width: 0;
    max-width: 100%;
}

.publish-account-label {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.6rem;
    font-size: 0.82rem;
    color: var(--text-muted);
    min-width: 0;
}

.publish-account-label strong {
    color: var(--text);
    font-size: 0.88rem;
    min-width: 0;
}

.publish-account-label span {
    min-width: 0;
    overflow-wrap: anywhere;
}

.publish-account-help {
    font-size: 0.74rem;
    color: var(--text-secondary);
    overflow-wrap: anywhere;
}

.publish-account-row .input,
.publish-account-row select {
    width: 100%;
    max-width: 100%;
    min-width: 0;
}

.publish-action-row {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.5rem;
    margin-top: 0.75rem;
}

.publish-action-btn {
    min-height: 44px;
    padding: 0.45rem 0.35rem;
    border-radius: 10px;
    font-size: 0.78rem;
    line-height: 1.05;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
}

.publish-action-btn-text {
    display: inline-block;
    white-space: normal;
    line-height: 1.08;
}

.publish-drafts-panel {
    margin-top: 0.25rem;
    padding: 0.85rem;
}

.publish-drafts-empty {
    margin: 0;
    color: var(--text-secondary);
    font-size: 0.86rem;
}

.publish-drafts-list {
    display: grid;
    gap: 0.65rem;
}

.publish-draft-item {
    border: 1px solid rgba(0, 212, 255, 0.2);
    border-radius: 12px;
    background: rgba(12, 33, 53, 0.48);
    padding: 0.72rem;
    display: grid;
    gap: 0.4rem;
    min-width: 0;
}

.publish-draft-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 0.65rem;
    flex-wrap: wrap;
}

.publish-draft-title {
    margin: 0;
    color: var(--text);
    font-size: 0.92rem;
    line-height: 1.2;
}

.publish-draft-meta {
    margin: 0;
    color: var(--text-secondary);
    font-size: 0.76rem;
    line-height: 1.24;
    overflow-wrap: anywhere;
}

.publish-draft-desc {
    margin: 0.1rem 0 0;
    color: var(--text-muted);
    font-size: 0.82rem;
    line-height: 1.35;
    overflow-wrap: anywhere;
}

.publish-draft-actions {
    margin-top: 0.15rem;
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem;
}

.publish-draft-actions .btn {
    min-width: 98px;
}

.checkbox-group {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
}

.checkbox-group label {
    display: flex;
    align-items: center;
    gap: 0.45rem;
}

.table-wrapper {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
}

th,
td {
    padding: 0.85rem 0.8rem;
    text-align: left;
    border-bottom: 1px solid rgba(96, 129, 162, 0.14);
}

th {
    color: var(--text-muted);
    font-weight: 700;
}

.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.65rem;
    border-radius: 999px;
    font-size: 0.76rem;
    font-weight: 700;
}

.badge-pending {
    background: rgba(246, 210, 124, 0.16);
    color: var(--warning);
}

.badge-rendering {
    background: rgba(246, 165, 47, 0.16);
    color: var(--accent-strong);
}

.badge-completed,
.badge-published {
    background: rgba(122, 221, 171, 0.16);
    color: var(--success);
}

.badge-failed {
    background: rgba(255, 122, 108, 0.16);
    color: var(--danger);
}

.btn-see-error {
    display: inline-block;
    margin-left: 6px;
    padding: 2px 8px;
    font-size: 0.72rem;
    border: 1px solid var(--danger);
    color: var(--danger);
    background: transparent;
    border-radius: 4px;
    cursor: pointer;
    vertical-align: middle;
    transition: background 0.2s, color 0.2s;
}
.btn-see-error:hover {
    background: var(--danger);
    color: #fff;
}

.publish-error-text {
    white-space: pre-wrap;
    word-break: break-word;
    background: rgba(255, 122, 108, 0.08);
    border: 1px solid rgba(255, 122, 108, 0.25);
    border-radius: 8px;
    padding: 1rem;
    font-size: 0.92rem;
    line-height: 1.6;
    color: var(--text);
    margin: 0;
    font-family: inherit;
}

.progress-bar {
    width: 100%;
    height: 8px;
    border-radius: 999px;
    background: rgba(96, 129, 162, 0.12);
    overflow: hidden;
    margin-top: 0.7rem;
}

.progress-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--accent), var(--accent-strong));
    transition: width 0.45s ease;
}

.loading {
    text-align: center;
    color: var(--text-muted);
    padding: 2rem;
}

.connect-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 0.9rem;
}

.social-connect-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 0.9rem;
}

.social-account-card {
    padding: 1rem;
    gap: 0.95rem;
}

.social-account-head {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.social-account-icon {
    width: 40px;
    height: 40px;
    border-radius: 11px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: var(--text);
    background: rgba(255, 255, 255, 0.06);
}

.social-account-icon svg {
    width: 21px;
    height: 21px;
    display: block;
}

.social-account-meta {
    min-width: 0;
}

.social-account-platform {
    margin: 0;
    font-size: 1rem;
}

.social-account-user {
    margin: 0.2rem 0 0;
    color: var(--text-muted);
    font-size: 0.85rem;
    overflow-wrap: anywhere;
}

.social-account-actions {
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.social-account-buttons {
    display: flex;
    gap: 0.55rem;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.social-account-status {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    color: var(--success);
    font-size: 0.78rem;
    font-weight: 700;
}

.social-account-status::before {
    content: "";
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: currentColor;
    box-shadow: 0 0 10px rgba(122, 221, 171, 0.5);
}

.social-platform-youtube .social-account-icon {
    color: #ff7b7b;
    border-color: rgba(255, 123, 123, 0.35);
}

.social-platform-tiktok .social-account-icon {
    color: #86fbff;
    border-color: rgba(134, 251, 255, 0.35);
}

.social-platform-instagram .social-account-icon {
    color: #ffbd8f;
    border-color: rgba(255, 189, 143, 0.35);
}

/* Analyze Page */

.analyze-layout {
    display: grid;
    gap: 1rem;
}

.analyze-hero {
    position: relative;
    overflow: hidden;
}

.analyze-hero::before {
    content: "";
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at 12% 20%, rgba(0, 212, 255, 0.2), transparent 52%),
        radial-gradient(circle at 88% 12%, rgba(246, 165, 47, 0.14), transparent 48%);
    pointer-events: none;
}

.analyze-hero > * {
    position: relative;
    z-index: 1;
}

.analyze-hero-kicker {
    margin: 0 0 0.45rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-size: 0.72rem;
    color: #9befff;
}

.analyze-hero h3 {
    margin: 0 0 0.4rem;
    font-size: 1.2rem;
    line-height: 1.35;
    max-width: 760px;
}

.analyze-chip-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 0.8rem;
}

.analyze-chip {
    border: 1px solid rgba(0, 212, 255, 0.3);
    background: rgba(0, 212, 255, 0.12);
    border-radius: 999px;
    padding: 0.28rem 0.68rem;
    font-size: 0.74rem;
    color: #c4f8ff;
    font-weight: 600;
}

.analyze-connect-grid {
    margin-top: 0.8rem;
}

.analyze-account-picker {
    margin-top: 0.95rem;
    margin-bottom: 1rem;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto auto;
    gap: 0.65rem;
    align-items: center;
}

.analyze-account-picker .btn {
    white-space: nowrap;
}

.automate-section-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.85rem;
    margin-bottom: 0.4rem;
    flex-wrap: wrap;
}

.automate-section-head .section-title {
    margin-bottom: 0;
}

.analyze-connected-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 0.72rem;
}

.analyze-connected-card {
    border: 1px solid rgba(0, 212, 255, 0.18);
    background: rgba(9, 28, 45, 0.68);
    border-radius: 12px;
    display: flex;
    align-items: center;
    gap: 0.7rem;
    text-align: left;
    color: var(--text);
    width: 100%;
    padding: 0.74rem 0.8rem;
    cursor: pointer;
    transition: border-color 0.16s ease, transform 0.16s ease, box-shadow 0.16s ease;
}

.analyze-connected-card:hover {
    border-color: rgba(0, 212, 255, 0.35);
    transform: translateY(-1px);
}

.analyze-connected-card.selected {
    border-color: rgba(0, 212, 255, 0.55);
    box-shadow: 0 0 0 1px rgba(0, 212, 255, 0.2), 0 0 18px rgba(0, 212, 255, 0.14);
}

.analyze-connected-meta {
    display: flex;
    flex-direction: column;
    min-width: 0;
    flex: 1;
}

.analyze-connected-meta strong {
    font-size: 0.9rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.analyze-connected-meta small {
    color: var(--text-muted);
    font-size: 0.76rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.analyze-account-status {
    font-size: 0.7rem;
    color: var(--success);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.analyze-results {
    display: grid;
    gap: 1.05rem;
}

.analyze-platform-note {
    border: 1px solid rgba(0, 212, 255, 0.25);
    background: rgba(0, 212, 255, 0.08);
    border-radius: 10px;
    padding: 0.65rem 0.82rem;
    color: #d8f6ff;
    font-size: 0.84rem;
}

.analyze-channel-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
}

.analyze-channel-main {
    display: flex;
    align-items: center;
    gap: 0.74rem;
    min-width: 0;
}

.analyze-channel-avatar {
    width: 52px;
    height: 52px;
    border-radius: 12px;
    object-fit: cover;
    border: 1px solid rgba(0, 212, 255, 0.3);
    background: rgba(255, 255, 255, 0.06);
}

.analyze-channel-avatar-fallback {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #d5f9ff;
    font-weight: 700;
}

.analyze-channel-meta {
    min-width: 0;
}

.analyze-channel-meta h3 {
    margin: 0;
    font-size: 1.1rem;
    line-height: 1.3;
}

.analyze-channel-meta p {
    margin: 0.15rem 0 0;
    color: var(--text-muted);
    font-size: 0.84rem;
}

.analyze-generated-at {
    color: var(--text-muted);
    font-size: 0.76rem;
}

.analyze-kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 0.65rem;
}

.analyze-kpi-card {
    border: 1px solid rgba(0, 212, 255, 0.2);
    background: rgba(13, 37, 59, 0.72);
    border-radius: 12px;
    padding: 0.8rem 0.85rem;
    display: grid;
    gap: 0.16rem;
}

.analyze-kpi-label {
    color: var(--text-muted);
    font-size: 0.72rem;
}

.analyze-kpi-value {
    font-size: 1.05rem;
    line-height: 1.25;
}

.analyze-kpi-hint {
    color: var(--text-muted);
    font-size: 0.72rem;
}

.analyze-section {
    display: grid;
    gap: 0.62rem;
}

.analyze-video-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 0.8rem;
}

.analyze-video-card {
    border: 1px solid rgba(0, 212, 255, 0.22);
    border-radius: 12px;
    overflow: hidden;
    background: rgba(9, 28, 45, 0.7);
    position: relative;
}

.analyze-video-rank {
    position: absolute;
    top: 0.55rem;
    left: 0.55rem;
    background: rgba(4, 25, 40, 0.88);
    border: 1px solid rgba(0, 212, 255, 0.35);
    border-radius: 999px;
    padding: 0.12rem 0.45rem;
    font-size: 0.71rem;
    font-weight: 700;
    color: #8cf6ff;
    z-index: 2;
}

.analyze-video-thumb {
    width: 100%;
    height: 132px;
    object-fit: cover;
    display: block;
}

.analyze-video-thumb-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    font-size: 0.8rem;
    background: rgba(255, 255, 255, 0.05);
}

.analyze-video-body {
    padding: 0.7rem 0.78rem 0.8rem;
    display: grid;
    gap: 0.55rem;
}

.analyze-video-body h4 {
    margin: 0;
    font-size: 0.9rem;
    line-height: 1.35;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.analyze-video-metrics {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.3rem 0.5rem;
    font-size: 0.76rem;
    color: var(--text-muted);
}

.analyze-video-metrics strong {
    color: var(--text);
    font-size: 0.8rem;
}

.analyze-video-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.65rem;
}

.analyze-video-footer span {
    color: var(--text-muted);
    font-size: 0.74rem;
}

.analyze-suggestions-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.8rem;
}

.analyze-suggestion-card {
    border: 1px solid rgba(0, 212, 255, 0.2);
    border-radius: 12px;
    background: rgba(11, 33, 52, 0.72);
    padding: 0.82rem;
    display: grid;
    gap: 0.6rem;
}

.analyze-suggestion-card h4 {
    margin: 0;
    font-size: 0.92rem;
}

.analyze-section-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.8rem;
}

.analyze-persona-summary {
    margin: 0.3rem 0 0;
    color: var(--text-muted);
    font-size: 0.82rem;
    line-height: 1.45;
}

.analyze-persona-grid {
    align-items: stretch;
}

.analyze-persona-stack {
    display: grid;
    gap: 0.6rem;
}

.analyze-persona-card {
    border: 1px solid rgba(0, 212, 255, 0.16);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.025);
    padding: 0.72rem;
    display: grid;
    gap: 0.5rem;
}

.analyze-persona-card-compact {
    gap: 0.36rem;
}

.analyze-persona-card-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.5rem;
}

.analyze-persona-card-head h4 {
    margin: 0;
    font-size: 0.88rem;
    line-height: 1.3;
}

.analyze-persona-badge {
    display: inline-flex;
    align-items: center;
    border-radius: 999px;
    border: 1px solid rgba(246, 165, 47, 0.32);
    background: rgba(246, 165, 47, 0.1);
    color: var(--accent);
    padding: 0.16rem 0.52rem;
    font-size: 0.68rem;
    white-space: nowrap;
}

.analyze-persona-badge-soft {
    border-color: rgba(0, 212, 255, 0.2);
    background: rgba(0, 212, 255, 0.08);
    color: #8cf6ff;
}

.analyze-persona-chip-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.38rem;
}

.analyze-persona-chip {
    display: inline-flex;
    align-items: center;
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(255, 255, 255, 0.04);
    color: var(--text);
    padding: 0.18rem 0.54rem;
    font-size: 0.72rem;
}

.analyze-persona-metrics,
.analyze-persona-best,
.analyze-empty-card {
    margin: 0;
    color: var(--text-muted);
    font-size: 0.76rem;
    line-height: 1.45;
}

.analyze-description-template {
    min-height: 190px;
    resize: vertical;
}

.analyze-hashtags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
}

.analyze-hashtag {
    border-radius: 999px;
    border: 1px solid rgba(246, 165, 47, 0.35);
    background: rgba(246, 165, 47, 0.11);
    color: var(--accent);
    padding: 0.16rem 0.56rem;
    font-size: 0.72rem;
}

.analyze-hashtag-muted {
    color: var(--text-muted);
    font-size: 0.74rem;
}

.analyze-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    gap: 0.46rem;
}

.analyze-list li {
    display: flex;
    align-items: flex-start;
    gap: 0.35rem;
    color: var(--text);
    line-height: 1.35;
    font-size: 0.84rem;
}

.analyze-list-index {
    color: var(--accent);
    font-weight: 700;
    min-width: 1.2rem;
}

.analyze-list-strong li span:last-child {
    font-weight: 500;
}

.analyze-empty {
    color: var(--text-muted);
}

.analyze-subsection-title {
    margin: 0.2rem 0 0;
    font-size: 0.9rem;
    color: var(--text-muted);
}

.analyze-tools-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 0.75rem;
}

.analyze-history-list {
    display: grid;
    gap: 0.55rem;
    max-height: 52vh;
    overflow-y: auto;
    padding-right: 0.15rem;
}

.analyze-history-toolbar {
    display: grid;
    grid-template-columns: auto minmax(220px, 1fr) auto;
    align-items: center;
    gap: 0.6rem;
    margin-bottom: 0.78rem;
}

.analyze-history-toolbar label {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.analyze-history-item {
    width: 100%;
    border: 1px solid rgba(0, 212, 255, 0.2);
    border-radius: 11px;
    background: rgba(11, 33, 52, 0.72);
    color: var(--text);
    text-align: left;
    padding: 0.72rem 0.8rem;
    display: grid;
    gap: 0.22rem;
    cursor: pointer;
    transition: border-color 0.18s ease, transform 0.18s ease;
}

.analyze-history-item:hover {
    border-color: rgba(0, 212, 255, 0.42);
    transform: translateY(-1px);
}

.analyze-history-title {
    font-size: 0.9rem;
    font-weight: 600;
}

.analyze-history-meta,
.analyze-history-date {
    font-size: 0.78rem;
    color: var(--text-muted);
}

.analyze-tool-card {
    border: 1px solid rgba(0, 212, 255, 0.18);
    border-radius: 12px;
    background: rgba(9, 28, 45, 0.65);
    padding: 0.82rem 0.85rem;
    display: grid;
    gap: 0.4rem;
}

.analyze-tool-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.45rem;
}

.analyze-tool-head h4 {
    margin: 0;
    font-size: 0.9rem;
}

.analyze-tool-badges {
    display: flex;
    gap: 0.35rem;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.analyze-badge {
    border-radius: 999px;
    border: 1px solid rgba(0, 212, 255, 0.38);
    background: rgba(0, 212, 255, 0.11);
    color: #baf6ff;
    font-size: 0.67rem;
    padding: 0.12rem 0.45rem;
    font-weight: 700;
}

.analyze-badge-soft {
    border-color: rgba(246, 165, 47, 0.35);
    background: rgba(246, 165, 47, 0.1);
    color: var(--accent);
}

.analyze-tool-card p {
    margin: 0;
    font-size: 0.8rem;
    line-height: 1.35;
}

.analyze-tool-why {
    color: var(--text-muted);
}

.modal {
    position: fixed;
    inset: 0;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 1.5rem 1rem;
    background: rgba(1, 8, 17, 0.92);
    backdrop-filter: blur(18px);
    z-index: 3000;
}

.modal.open {
    display: flex;
}

.modal-content {
    width: min(100%, 560px);
    max-height: 90vh;
    overflow-y: auto;
    background: var(--bg-card-strong);
    border: 1px solid var(--border);
    border-radius: 26px;
    box-shadow: var(--shadow);
}

.modal-content-wide {
    width: min(calc(100% - 1rem), 900px);
}

#modal-new-project {
    padding: 0.35rem;
}

#modal-new-project .modal-content-wide {
    position: relative;
    width: min(80vw, 1280px);
    max-width: calc(100vw - 2rem);
    height: calc(100vh - 1rem);
    max-height: calc(100vh - 1rem);
    display: flex;
    flex-direction: column;
}

#modal-new-project .modal-body {
    flex: 1;
    min-height: 0;
    overflow: auto;
}

#modal-new-project.similar-busy .modal-body,
#modal-new-project.similar-busy .modal-header {
    user-select: none;
}

.similar-busy-overlay {
    position: absolute;
    inset: 0;
    z-index: 12;
    display: grid;
    place-items: center;
    padding: 24px;
    background: rgba(5, 12, 22, 0.82);
    backdrop-filter: blur(12px);
}

.similar-busy-card {
    width: min(100%, 460px);
    padding: 24px 22px;
    border-radius: 22px;
    border: 1px solid rgba(255, 193, 79, 0.32);
    background: linear-gradient(180deg, rgba(19, 45, 74, 0.96), rgba(12, 30, 50, 0.98));
    box-shadow: 0 24px 60px rgba(3, 10, 20, 0.42);
    text-align: center;
}

.similar-busy-spinner {
    width: 54px;
    height: 54px;
    margin: 0 auto 14px;
    border-radius: 50%;
    border: 3px solid rgba(255, 255, 255, 0.14);
    border-top-color: var(--accent);
    animation: spin 0.9s linear infinite;
}

.similar-busy-card strong {
    display: block;
    font-size: 1.12rem;
    color: var(--text);
}

.similar-busy-card p {
    margin: 8px 0 14px;
    color: var(--text-muted);
    line-height: 1.5;
}

.similar-busy-progress-track {
    width: 100%;
    height: 12px;
    border-radius: 999px;
    overflow: hidden;
    border: 1px solid rgba(255, 193, 79, 0.26);
    background: rgba(255, 255, 255, 0.08);
}

.similar-busy-progress-fill {
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, #ffb938, #ffd978);
    box-shadow: 0 0 18px rgba(255, 193, 79, 0.24);
    transition: width 0.25s ease;
}

.similar-busy-progress-label {
    display: inline-block;
    margin-top: 10px;
    font-size: 0.86rem;
    font-weight: 700;
    color: #ffe3a4;
}

.modal-header,
.modal-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid rgba(96, 129, 162, 0.14);
}

.modal-footer {
    border-bottom: 0;
    border-top: 1px solid rgba(96, 129, 162, 0.14);
    justify-content: flex-end;
}

.modal-footer-space {
    justify-content: space-between;
}

.modal-body {
    padding: 1.25rem;
}

.modal-close {
    border: 0;
    background: transparent;
    color: var(--text-muted);
    font-size: 1.8rem;
    cursor: pointer;
}

.modal-video {
    padding: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    background: #000;
}

.copy-choice-subtitle {
    margin: 0 0 0.9rem;
    color: var(--text);
    font-weight: 600;
}

.copy-choice-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.9rem;
}

.copy-choice-card {
    border: 1px solid rgba(96, 129, 162, 0.35);
    border-radius: 14px;
    background: rgba(10, 38, 68, 0.75);
    color: var(--text);
    text-align: left;
    padding: 1rem;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    transition: border-color 0.2s ease, transform 0.2s ease, background 0.2s ease;
}

.copy-choice-card strong {
    color: var(--accent);
    font-size: 0.92rem;
    letter-spacing: 0.02em;
}

.copy-choice-card span {
    color: var(--text-muted);
    font-size: 0.85rem;
    line-height: 1.35;
}

.copy-choice-card:hover {
    border-color: rgba(246, 165, 47, 0.5);
    background: rgba(17, 50, 86, 0.82);
    transform: translateY(-1px);
}

@media (max-width: 640px) {
    .copy-choice-grid {
        grid-template-columns: 1fr;
    }
}

#player-video {
    width: auto;
    height: auto;
    max-width: 100%;
    max-height: 70vh;
    display: block;
    background: #000;
    object-fit: contain;
}

/* ═══ Creation Wizard Styles ═══ */

.create-tabs-row {
    display: flex;
    gap: 4px;
    margin-bottom: 1.5rem;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 12px;
    padding: 4px;
}

.create-tab {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px 16px;
    border: none;
    border-radius: 10px;
    background: transparent;
    color: var(--text-muted);
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.create-tab:hover {
    color: var(--text);
    background: rgba(255, 255, 255, 0.04);
}

.create-tab.active {
    background: var(--accent-soft);
    color: var(--accent);
    border: 1px solid rgba(246, 165, 47, 0.3);
}

.create-panel {
    min-height: 260px;
}

.wizard-step {
    /* animation applied via .wizard-step-enter class only */
}

.wizard-step-enter {
    animation: wizardFadeIn 0.25s ease-out forwards;
}

@keyframes wizardFadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

.wizard-question {
    font-family: "Outfit", sans-serif;
    font-size: 1.2rem;
    font-weight: 700;
    text-align: center;
    margin-bottom: 6px;
}

.style-step-title {
    margin-top: 12px;
}

.wizard-hint {
    text-align: center;
    color: var(--text-muted);
    font-size: 0.85rem;
    margin-bottom: 1.25rem;
}

.wizard-input-wrap {
    max-width: 500px;
    margin: 0 auto;
}

.wizard-input {
    width: 100%;
    padding: 14px 18px;
    border: 2px dashed rgba(246, 165, 47, 0.35);
    border-radius: 14px;
    background: var(--bg-input);
    color: var(--text);
    font-size: 1rem;
    outline: none;
    transition: border-color 0.2s;
}

.wizard-input:focus {
    border-color: var(--accent);
    border-style: solid;
}

.wizard-input::placeholder {
    color: var(--text-muted);
}

.wizard-textarea {
    width: 100%;
    padding: 14px 18px;
    padding-bottom: 44px;
    border: 2px dashed rgba(246, 165, 47, 0.35);
    border-radius: 14px;
    background: var(--bg-input);
    color: var(--text);
    font-size: 0.95rem;
    line-height: 1.6;
    resize: vertical;
    outline: none;
    transition: border-color 0.2s;
    font-family: "Manrope", sans-serif;
}

.textarea-wrapper {
    position: relative;
    margin-top: 28px;
}

.textarea-inline-actions {
    position: absolute;
    bottom: 10px;
    right: 12px;
    display: flex;
    gap: 6px;
}

.textarea-icon-btn {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--bg-card);
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.2s;
}

.textarea-icon-btn:hover {
    color: var(--accent);
    border-color: var(--accent);
    background: rgba(246, 165, 47, 0.1);
}

.wizard-textarea:focus {
    border-color: var(--accent);
    border-style: solid;
}

.wizard-textarea::placeholder {
    color: var(--text-muted);
}

.wizard-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    max-width: 500px;
    margin: 0 auto;
}

.wizard-option {
    padding: 14px 12px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.03);
    color: var(--text);
    font-size: 0.88rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    text-align: center;
}

.wizard-option:hover {
    border-color: rgba(246, 165, 47, 0.4);
    background: rgba(246, 165, 47, 0.06);
}

.wizard-option.selected {
    border-color: var(--accent);
    background: var(--accent-soft);
    color: var(--accent);
}

.wizard-details-grid {
    max-width: 500px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.duration-options {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.duration-option {
    padding: 10px 16px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.03);
    color: var(--text);
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    text-align: center;
}

.duration-option:hover {
    border-color: rgba(246, 165, 47, 0.4);
}

.duration-option.selected {
    border-color: var(--accent);
    background: var(--accent-soft);
    color: var(--accent);
}

/* Engine options */
.engine-options {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.engine-option {
    flex: 1 1 calc(25% - 6px);
    min-width: 0;
    padding: 8px 6px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.03);
    color: var(--text);
    cursor: pointer;
    transition: all 0.2s;
    text-align: center;
}

.engine-option strong {
    font-size: 0.78rem;
}

.engine-option:hover {
    border-color: rgba(246, 165, 47, 0.4);
}

.engine-option.selected {
    border-color: var(--accent);
    background: var(--accent-soft);
    color: var(--accent);
}

#wizard-realistic-engine,
#script-realistic-engine,
#auto-realistic-engine {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

#wizard-realistic-engine .engine-option,
#script-realistic-engine .engine-option,
#auto-realistic-engine .engine-option {
    min-height: 78px;
    padding: 10px 8px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 4px;
}

#wizard-realistic-engine .engine-option strong,
#script-realistic-engine .engine-option strong,
#auto-realistic-engine .engine-option strong {
    line-height: 1.2;
}

.engine-option-desc {
    display: block;
    font-size: 0.66rem;
    line-height: 1.28;
    color: var(--text-muted);
}

.engine-option.selected .engine-option-desc {
    color: rgba(var(--accent-rgb), 0.95);
}

/* Realistic narration options */
.realistic-narration-options {
    margin-top: 4px;
    padding: 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--surface-alt, rgba(255,255,255,0.03));
}
.realistic-narration-options .form-group { margin-bottom: 10px; }
.realistic-narration-options .form-group:last-child { margin-bottom: 0; }
.realistic-voice-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}
.voice-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 8px 6px;
    border: 2px solid var(--border);
    border-radius: 8px;
    background: var(--surface);
    color: var(--text);
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 600;
    transition: border-color .2s, background .2s;
}
.voice-btn small { font-weight: 400; opacity: 0.7; font-size: 0.72rem; }
.voice-btn:hover { border-color: var(--accent); }
.voice-btn.selected {
    border-color: var(--accent);
    background: var(--accent-soft);
    color: var(--accent);
}

/* Pause options */
.pause-options {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.pause-option {
    padding: 10px 16px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.03);
    color: var(--text);
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    text-align: center;
}

.pause-option:hover {
    border-color: rgba(246, 165, 47, 0.4);
}

.pause-option.selected {
    border-color: var(--accent);
    background: var(--accent-soft);
    color: var(--accent);
}

.pause-hint {
    display: block;
    margin-top: 4px;
    color: var(--text-secondary);
    font-size: 0.75rem;
}

.field-hint {
    display: block;
    margin-top: 6px;
    color: var(--text-muted);
    font-size: 0.75rem;
}

/* Style tags */
.style-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.style-tag {
    padding: 7px 14px;
    border: 1px solid var(--border);
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.03);
    color: var(--text);
    font-size: 0.82rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.style-tag:hover {
    border-color: rgba(246, 165, 47, 0.4);
}

.style-tag.selected {
    border-color: var(--accent);
    background: var(--accent-soft);
    color: var(--accent);
}

.wizard-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 1.5rem;
    padding-top: 1rem;
    border-top: 1px solid rgba(96, 129, 162, 0.1);
}

.wizard-dots {
    display: flex;
    gap: 8px;
}

.wizard-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.15);
    transition: background 0.2s, transform 0.2s;
}

.wizard-dot.active {
    background: var(--accent);
    transform: scale(1.2);
}

.btn-create-video {
    margin-top: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-size: 1rem;
    padding: 14px 24px;
}

.script-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 8px;
}

.char-count {
    color: var(--text-muted);
    font-size: 0.8rem;
}

.ai-suggest-panel {
    animation: wizardFadeIn 0.25s ease-out;
}

.create-progress {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 16px;
    min-height: 200px;
    text-align: center;
}

.create-spinner svg {
    animation: spin 1s linear infinite;
}

.create-progress-track {
    width: min(420px, 100%);
    height: 10px;
    border-radius: 999px;
    background: rgba(96, 129, 162, 0.18);
    border: 1px solid rgba(96, 129, 162, 0.22);
    overflow: hidden;
}

.create-progress-fill {
    height: 100%;
    width: 8%;
    border-radius: inherit;
    background: linear-gradient(90deg, var(--accent), var(--accent-strong));
    transition: width 0.45s ease;
}

.create-progress-meta {
    width: min(420px, 100%);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    font-size: 0.78rem;
    color: var(--text-muted);
}

.create-progress.create-progress--bar-only {
    min-height: 120px;
    gap: 10px;
}

.create-progress.create-progress--bar-only .create-spinner,
.create-progress.create-progress--bar-only #create-progress-text,
.create-progress.create-progress--bar-only .create-progress-meta {
    display: none;
}

.create-progress.create-progress--bar-only .create-progress-track {
    width: min(460px, 100%);
}

svg.spin {
    animation: spin 1s linear infinite;
}

/* ── Photo Upload Section ── */
.photo-upload-section {
    margin-top: 16px;
    padding-top: 14px;
    border-top: 1px solid rgba(96, 129, 162, 0.12);
}

.script-title-gap {
    margin-top: 14px;
}

.photo-upload-header {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.photo-upload-label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text);
}

.photo-upload-hint {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.media-toggle-row {
    justify-content: space-between;
    gap: 12px;
}

.media-toggle-group {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.media-toggle-chip {
    position: relative;
    display: inline-flex;
    align-items: center;
}

.media-toggle-chip input {
    position: absolute;
    opacity: 0;
    width: 1px;
    height: 1px;
    pointer-events: none;
}

.media-toggle-chip-body {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 8px 13px;
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    background: rgba(255, 255, 255, 0.03);
    color: var(--text-muted);
    font-size: 0.82rem;
    font-weight: 600;
    transition: border-color 0.2s ease, background 0.2s ease, color 0.2s ease, box-shadow 0.2s ease;
}

.media-toggle-chip-body svg {
    flex-shrink: 0;
}

.media-toggle-chip input:checked + .media-toggle-chip-body {
    border-color: rgba(var(--accent-rgb), 0.7);
    background: rgba(var(--accent-rgb), 0.2);
    color: var(--text);
    box-shadow: 0 0 0 2px rgba(var(--accent-rgb), 0.16);
}

.media-toggle-chip input:focus-visible + .media-toggle-chip-body {
    box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.22), 0 0 0 4px rgba(var(--accent-rgb), 0.18);
}

.media-toggle-chip--compact .media-toggle-chip-body {
    min-width: 104px;
    justify-content: center;
}

.script-media-toggle-group {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
    width: 100%;
}

.script-media-toggle-group .media-toggle-chip {
    width: 100%;
}

.media-toggle-chip--full .media-toggle-chip-body {
    width: 100%;
    justify-content: center;
    min-height: 40px;
}

.media-toggle-chip-button {
    width: 100%;
    padding: 0;
    border: 0;
    background: none;
    cursor: pointer;
}

.media-toggle-chip-button:hover,
.media-toggle-chip-button:focus-visible {
    outline: none;
}

.media-toggle-chip-button:hover .media-toggle-chip-body,
.media-toggle-chip-button:focus-visible .media-toggle-chip-body {
    border-color: rgba(var(--accent-rgb), 0.7);
    background: rgba(var(--accent-rgb), 0.14);
    color: var(--text);
    box-shadow: 0 0 0 2px rgba(var(--accent-rgb), 0.16);
}

.script-media-toggle-group--vivid {
    gap: 12px;
}

.script-media-chip {
    --script-media-chip-accent: 242, 201, 76;
    --script-media-chip-accent-2: 184, 138, 23;
}

.script-media-chip .media-toggle-chip-body {
    position: relative;
    min-height: 52px;
    justify-content: flex-start;
    gap: 10px;
    padding: 10px 14px;
    border-radius: 18px;
    border-color: rgba(110, 143, 175, 0.24);
    background:
        radial-gradient(circle at top right, rgba(var(--script-media-chip-accent), 0.16), transparent 48%),
        linear-gradient(180deg, rgba(8, 28, 47, 0.92), rgba(4, 18, 31, 0.94));
    color: var(--text);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
    overflow: hidden;
    transition: transform 0.18s ease, border-color 0.18s ease, background 0.18s ease, box-shadow 0.18s ease;
}

.script-media-chip .media-toggle-chip-body::after {
    content: "";
    position: absolute;
    inset: auto -24px -28px auto;
    width: 72px;
    height: 72px;
    border-radius: 999px;
    background: rgba(var(--script-media-chip-accent), 0.08);
    filter: blur(2px);
    pointer-events: none;
}

.script-media-chip:hover .media-toggle-chip-body,
.script-media-chip:focus-visible .media-toggle-chip-body,
.script-media-chip.media-toggle-chip-button:hover .media-toggle-chip-body,
.script-media-chip.media-toggle-chip-button:focus-visible .media-toggle-chip-body {
    transform: translateY(-1px);
    border-color: rgba(var(--script-media-chip-accent), 0.55);
    background:
        radial-gradient(circle at top right, rgba(var(--script-media-chip-accent), 0.22), transparent 48%),
        linear-gradient(180deg, rgba(10, 34, 58, 0.98), rgba(5, 19, 33, 0.96));
    color: var(--text);
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.18), 0 0 0 1px rgba(var(--script-media-chip-accent), 0.12);
}

.script-media-chip input:checked + .media-toggle-chip-body {
    border-color: rgba(var(--script-media-chip-accent), 0.72);
    background:
        radial-gradient(circle at top right, rgba(var(--script-media-chip-accent), 0.24), transparent 52%),
        linear-gradient(180deg, rgba(30, 50, 28, 0.96), rgba(15, 28, 17, 0.96));
    color: #f7fce8;
    box-shadow: 0 0 0 1px rgba(var(--script-media-chip-accent), 0.18), 0 14px 28px rgba(var(--script-media-chip-accent), 0.12);
}

.script-media-chip input:checked + .media-toggle-chip-body .script-media-chip-icon {
    box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.14), 0 10px 24px rgba(var(--script-media-chip-accent), 0.24);
}

.script-media-chip-icon {
    position: relative;
    z-index: 1;
    flex: 0 0 34px;
    width: 34px;
    height: 34px;
    border-radius: 10px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, rgba(var(--script-media-chip-accent), 0.96), rgba(var(--script-media-chip-accent-2), 0.9));
    color: #fff8dc;
    box-shadow: 0 10px 20px rgba(var(--script-media-chip-accent), 0.18);
}

.script-media-chip-icon svg {
    width: 16px;
    height: 16px;
}

.script-media-chip-label {
    position: relative;
    z-index: 1;
    font-size: 0.92rem;
    font-weight: 700;
    letter-spacing: -0.01em;
}

.script-media-chip--images {
    --script-media-chip-accent: 242, 201, 76;
    --script-media-chip-accent-2: 184, 138, 23;
}

.script-media-chip--audio {
    --script-media-chip-accent: 109, 213, 237;
    --script-media-chip-accent-2: 33, 147, 176;
}

.script-media-chip--tevoxi {
    --script-media-chip-accent: 102, 230, 169;
    --script-media-chip-accent-2: 22, 163, 74;
}

.script-media-chip--create {
    --script-media-chip-accent: 255, 153, 102;
    --script-media-chip-accent-2: 255, 94, 98;
}

.script-media-panel {
    border-top: 0;
    padding-top: 4px;
    margin-top: 8px;
}

#modal-script-image-creator {
    padding: 0.5rem;
}

#modal-script-image-creator .modal-content-wide {
    width: min(calc(100vw - 1rem), 1120px);
    max-height: calc(100vh - 1rem);
    display: flex;
    flex-direction: column;
}

#modal-script-image-creator .modal-body {
    flex: 1;
    min-height: 0;
    overflow: auto;
}

.script-image-generator-shell {
    display: block;
}

.script-image-generator-controls {
    border: 1px solid rgba(96, 129, 162, 0.22);
    border-radius: 24px;
    background:
        radial-gradient(circle at top right, rgba(255, 193, 92, 0.14), transparent 36%),
        linear-gradient(180deg, rgba(12, 36, 61, 0.92), rgba(6, 23, 40, 0.92));
    padding: 18px;
    box-shadow: 0 22px 50px rgba(2, 10, 19, 0.26);
}

.script-image-generator-prompt {
    min-height: 180px;
}

.script-image-generator-model-options {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 138px));
    justify-content: space-between;
    gap: 8px;
    align-items: stretch;
}

.script-image-model-card {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    align-content: flex-start;
    justify-content: flex-start;
    gap: 7px;
    width: 100%;
    min-width: 0;
    aspect-ratio: 1 / 1;
    padding: 9px;
    border: 1px solid rgba(110, 143, 175, 0.24);
    border-radius: 18px;
    background: rgba(7, 24, 41, 0.74);
    color: var(--text);
    text-align: left;
    cursor: pointer;
    transition: transform 0.18s ease, border-color 0.18s ease, background 0.18s ease, box-shadow 0.18s ease;
}

.script-image-model-card:hover,
.script-image-model-card:focus-visible {
    outline: none;
    transform: translateY(-1px);
    border-color: rgba(255, 193, 92, 0.6);
    background: rgba(15, 44, 73, 0.9);
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.2);
}

.script-image-model-card.is-active {
    border-color: rgba(255, 193, 92, 0.82);
    background: linear-gradient(180deg, rgba(40, 58, 26, 0.96), rgba(22, 31, 18, 0.96));
    box-shadow: 0 0 0 1px rgba(255, 193, 92, 0.24), 0 12px 28px rgba(255, 193, 92, 0.12);
}

.script-image-model-card-icon {
    flex: 0 0 34px;
    width: 34px;
    height: 34px;
    border-radius: 10px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #fff8dc;
}

.script-image-model-card-icon svg {
    width: 16px;
    height: 16px;
}

.script-image-model-card-icon--banana {
    background: linear-gradient(135deg, #f2c94c, #b88a17);
}

.script-image-model-card-icon--gpt {
    background: linear-gradient(135deg, #6dd5ed, #2193b0);
}

.script-image-model-card-icon--wan {
    background: linear-gradient(135deg, #ff9966, #ff5e62);
}

.script-image-model-card-icon--wan-edit {
    background: linear-gradient(135deg, #f9d423, #e65c00);
}

.script-image-model-card-copy {
    display: grid;
    gap: 2px;
    min-width: 0;
    width: 100%;
    align-self: start;
}

.script-image-model-card-copy strong {
    color: var(--text);
    font-size: 0.8rem;
    line-height: 1.12;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.script-image-model-card-copy small {
    color: var(--text-muted);
    font-size: 0.68rem;
    line-height: 1.15;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.script-image-generator-section-head,
.script-image-generator-results-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 8px;
}

.script-image-generator-results-head h4 {
    margin: 0;
    color: var(--text);
    font-size: 1rem;
}

.script-image-generator-results-head small {
    color: var(--text-muted);
}

.script-image-generator-dropzone {
    width: 100%;
    margin-top: 4px;
    padding: 16px;
    border: 1px dashed rgba(0, 212, 255, 0.3);
    border-radius: 16px;
    background: rgba(6, 24, 42, 0.72);
    color: var(--text);
    display: grid;
    gap: 6px;
    justify-items: center;
    text-align: center;
    cursor: pointer;
    transition: border-color 0.2s ease, background 0.2s ease, transform 0.2s ease;
}

.script-image-generator-dropzone:hover {
    border-color: var(--tech-neon);
    background: rgba(0, 212, 255, 0.08);
    transform: translateY(-1px);
}

.script-image-generator-dropzone strong {
    font-size: 0.95rem;
}

.script-image-generator-dropzone small {
    color: var(--text-muted);
}

.script-image-generator-reference-preview {
    margin-top: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
    grid-template-columns: none;
}

.script-image-generator-reference-strip {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
    margin-top: 4px;
}

.script-image-generator-reference-add {
    width: 74px;
    height: 74px;
    border: 1px dashed rgba(0, 212, 255, 0.34);
    border-radius: 18px;
    background: rgba(6, 24, 42, 0.72);
    color: var(--text);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: border-color 0.2s ease, background 0.2s ease, transform 0.2s ease;
}

.script-image-generator-reference-add:hover,
.script-image-generator-reference-add:focus-visible {
    outline: none;
    border-color: var(--tech-neon);
    background: rgba(0, 212, 255, 0.08);
    transform: translateY(-1px);
}

.script-image-generator-reference-preview .photo-preview-item {
    width: 74px;
    min-width: 74px;
    border-radius: 18px;
    border: 1px solid rgba(96, 129, 162, 0.26);
}

.script-image-generator-settings {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
}

.script-image-generator-segmented {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.script-image-generator-segmented--count {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

.script-image-generator-segment {
    min-height: 38px;
    padding: 0 14px;
    border: 1px solid rgba(110, 143, 175, 0.26);
    border-radius: 12px;
    background: rgba(4, 19, 33, 0.7);
    color: var(--text-muted);
    font-weight: 700;
    cursor: pointer;
    transition: border-color 0.18s ease, background 0.18s ease, color 0.18s ease, transform 0.18s ease;
}

.script-image-generator-segment:hover,
.script-image-generator-segment:focus-visible {
    outline: none;
    transform: translateY(-1px);
    border-color: rgba(255, 193, 92, 0.5);
    color: var(--text);
}

.script-image-generator-segment.is-active {
    border-color: rgba(196, 255, 98, 0.72);
    background: rgba(140, 186, 43, 0.16);
    color: #eaffc2;
    box-shadow: 0 0 0 1px rgba(196, 255, 98, 0.16);
}

.script-image-generator-segment.is-disabled,
.script-image-generator-segment:disabled {
    cursor: not-allowed;
    opacity: 0.45;
    transform: none;
}

.script-image-generator-field-note {
    display: block;
    margin-top: 6px;
    color: var(--text-muted);
    font-size: 0.78rem;
}

.form-group.is-disabled .input,
.script-image-generator-toggle.is-disabled {
    opacity: 0.62;
}

.form-group.is-disabled .input {
    cursor: not-allowed;
}

.script-image-generator-toggle {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 4px;
    margin-bottom: 2px;
    padding: 12px 14px;
    border: 1px solid rgba(96, 129, 162, 0.18);
    border-radius: 16px;
    background: rgba(3, 17, 31, 0.5);
}

.script-image-generator-toggle-copy {
    display: grid;
    gap: 3px;
}

.script-image-generator-toggle-copy strong {
    color: var(--text);
}

.script-image-generator-toggle-copy small {
    color: var(--text-muted);
}

.script-image-generator-status {
    margin: 10px 0 0;
    padding: 10px 12px;
    border-radius: 12px;
    border: 1px solid rgba(0, 212, 255, 0.16);
    background: rgba(0, 212, 255, 0.08);
    color: #dff7ff;
    font-size: 0.9rem;
}

.script-image-generator-status.is-error {
    border-color: rgba(255, 122, 108, 0.24);
    background: rgba(255, 122, 108, 0.08);
    color: #ffd1c8;
}

.script-image-generator-status.is-success {
    border-color: rgba(122, 221, 171, 0.24);
    background: rgba(122, 221, 171, 0.08);
    color: #dbffe9;
}

.script-image-generator-estimate {
    margin-top: 0;
    padding: 8px 12px;
    border-radius: 12px;
    border: 1px solid rgba(255, 193, 92, 0.24);
    background: rgba(255, 193, 92, 0.08);
    color: #ffe5a6;
    font-size: 0.84rem;
    line-height: 1.2;
    display: inline-flex;
    width: fit-content;
    max-width: min(100%, 340px);
    align-self: flex-end;
}

.script-image-generator-estimate.is-loading {
    border-color: rgba(0, 212, 255, 0.2);
    background: rgba(0, 212, 255, 0.08);
    color: #dff7ff;
}

.script-image-generator-estimate.is-error {
    border-color: rgba(255, 122, 108, 0.24);
    background: rgba(255, 122, 108, 0.08);
    color: #ffd1c8;
}

.script-image-generator-footer {
    margin-top: 16px;
    padding-top: 0;
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 14px;
}

.script-image-generator-footer-actions {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 10px;
    max-width: 100%;
}

.script-image-generator-inline-results {
    display: grid;
    gap: 12px;
    margin-top: 16px;
}

.script-image-generator-results {
    display: grid;
    gap: 12px;
}

.script-image-generator-empty {
    min-height: 220px;
    border: 1px dashed rgba(96, 129, 162, 0.24);
    border-radius: 18px;
    background: rgba(4, 18, 33, 0.42);
    color: var(--text-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 20px;
    aspect-ratio: var(--script-image-result-ratio, 1 / 1);
}

.script-image-generator-empty--inline {
    min-height: unset;
}

.script-image-generator-stage {
    width: min(100%, 860px);
    aspect-ratio: var(--script-image-result-ratio, 1 / 1);
    border-radius: 20px;
    overflow: hidden;
    border: 1px solid rgba(96, 129, 162, 0.22);
    background: rgba(4, 18, 33, 0.56);
}

.script-image-generator-stage img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.script-image-generator-result-card {
    display: grid;
    gap: 10px;
    padding: 10px;
    border-radius: 16px;
    border: 1px solid rgba(96, 129, 162, 0.22);
    background: rgba(4, 18, 33, 0.56);
    width: min(100%, 860px);
}

.script-image-generator-result-card img {
    width: 100%;
    aspect-ratio: 1;
    object-fit: cover;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.03);
}

.script-image-generator-result-meta {
    display: grid;
    gap: 3px;
}

.script-image-generator-result-meta strong {
    color: var(--text);
    font-size: 0.92rem;
}

.script-image-generator-result-meta span {
    color: var(--text-muted);
    font-size: 0.78rem;
    line-height: 1.3;
}

.script-image-generator-result-actions {
    display: flex;
    gap: 8px;
}

.script-image-generator-result-actions .btn-icon-sm {
    width: 36px;
    height: 36px;
}

.script-image-generator-result-actions .btn-icon-sm svg {
    width: 16px;
    height: 16px;
}

.script-image-generator-result-actions .script-image-generator-use-btn {
    border-color: rgba(122, 221, 171, 0.26);
    color: #9df0bd;
}

.script-image-generator-result-actions .script-image-generator-use-btn:hover {
    border-color: rgba(122, 221, 171, 0.48);
    color: #c8ffde;
}

.script-image-generator-result-thumbs {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.script-image-generator-result-thumb {
    width: 76px;
    height: 76px;
    padding: 0;
    border: 1px solid rgba(96, 129, 162, 0.22);
    border-radius: 16px;
    overflow: hidden;
    background: rgba(4, 18, 33, 0.56);
    cursor: pointer;
    transition: border-color 0.18s ease, transform 0.18s ease, box-shadow 0.18s ease;
}

.script-image-generator-result-thumb:hover,
.script-image-generator-result-thumb:focus-visible {
    outline: none;
    transform: translateY(-1px);
    border-color: rgba(255, 193, 92, 0.6);
}

.script-image-generator-result-thumb.is-active {
    border-color: rgba(196, 255, 98, 0.72);
    box-shadow: 0 0 0 1px rgba(196, 255, 98, 0.16);
}

.script-image-generator-result-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

@media (max-width: 720px) {
    .media-toggle-row {
        align-items: flex-start;
        flex-direction: column;
    }

    .script-media-toggle-group {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .script-media-chip .media-toggle-chip-body {
        min-height: 48px;
        padding: 10px 12px;
    }

    .media-toggle-group {
        width: 100%;
    }

    .media-toggle-chip--compact .media-toggle-chip-body {
        min-width: 0;
    }

    .script-image-generator-settings {
        grid-template-columns: 1fr;
    }

    .script-image-generator-model-options {
        grid-template-columns: repeat(3, minmax(0, 1fr));
        justify-content: stretch;
    }

    .script-image-generator-footer {
        flex-direction: column-reverse;
        align-items: stretch;
    }

    .script-image-generator-footer-actions {
        align-items: stretch;
    }

    .script-image-generator-estimate {
        align-self: stretch;
        width: 100%;
        max-width: none;
    }
}

.photo-upload-area {
    margin-top: 12px;
    animation: wizardFadeIn 0.25s ease-out;
}

.ai-suggest-custom-image-grid {
    margin-top: 10px;
}

.ai-suggest-custom-image-tile {
    position: relative;
    width: 100%;
    aspect-ratio: 1;
    border-radius: 12px;
    border: 1px dashed rgba(0, 212, 255, 0.28);
    background: rgba(10, 31, 51, 0.62);
    color: var(--text);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px;
    text-align: center;
    cursor: pointer;
    transition: border-color 0.2s ease, background 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
}

.ai-suggest-custom-image-tile:hover,
.ai-suggest-custom-image-tile.dragover {
    border-color: var(--tech-neon);
    background: rgba(0, 212, 255, 0.08);
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.18);
}

.ai-suggest-custom-image-tile:active {
    transform: translateY(1px);
}

.ai-suggest-custom-image-tile-icon {
    width: 38px;
    height: 38px;
    border-radius: 12px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: rgba(var(--accent-rgb), 0.14);
    color: var(--accent);
    font-size: 1.3rem;
    font-weight: 700;
    line-height: 1;
}

.ai-suggest-custom-image-tile-title {
    font-size: 0.88rem;
    font-weight: 700;
    line-height: 1.25;
}

.ai-suggest-custom-image-tile-copy {
    font-size: 0.72rem;
    color: var(--text-muted);
    line-height: 1.35;
}

.ai-suggest-custom-image-tile-upload.is-compact {
    padding: 8px;
    border-style: solid;
}

.ai-suggest-custom-image-tile-upload.is-compact .ai-suggest-custom-image-tile-icon {
    width: 44px;
    height: 44px;
    border-radius: 14px;
    font-size: 1.6rem;
}

.ai-suggest-custom-image-tile-upload.is-compact .ai-suggest-custom-image-tile-title,
.ai-suggest-custom-image-tile-upload.is-compact .ai-suggest-custom-image-tile-copy {
    display: none;
}

@media (max-width: 720px) {
    .ai-suggest-custom-image-tile-title {
        font-size: 0.82rem;
    }

    .ai-suggest-custom-image-tile-copy {
        font-size: 0.68rem;
    }
}

.tevoxi-about-body {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.tevoxi-about-body p {
    margin: 0;
}

.tevoxi-about-tip {
    font-size: 0.84rem;
    color: var(--text-muted);
    background: rgba(var(--accent-rgb), 0.08);
    border: 1px solid rgba(var(--accent-rgb), 0.24);
    border-radius: 10px;
    padding: 10px 12px;
    line-height: 1.45;
}

.tevoxi-empty-state {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
    padding: 4px 0;
}

.tevoxi-empty-state .loading {
    margin: 0;
}

.tevoxi-empty-cta-btn {
    align-self: flex-start;
}

.photo-dropzone {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 24px 16px;
    border: 2px dashed rgba(246, 165, 47, 0.3);
    border-radius: 14px;
    background: rgba(246, 165, 47, 0.04);
    cursor: pointer;
    transition: all 0.2s;
    text-align: center;
    color: var(--text-muted);
}

.photo-dropzone:hover, .photo-dropzone.dragover {
    border-color: var(--accent);
    background: rgba(246, 165, 47, 0.08);
    color: var(--accent);
}

.photo-dropzone p {
    margin: 0;
    font-size: 0.9rem;
    font-weight: 500;
}

.photo-dropzone small {
    font-size: 0.75rem;
    opacity: 0.7;
}

#script-photo-area {
    --script-photo-tile-size: clamp(72px, 18vw, 96px);
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    gap: 12px;
}

#script-photo-dropzone {
    width: var(--script-photo-tile-size);
    min-height: var(--script-photo-tile-size);
    aspect-ratio: 1;
    flex: 0 0 var(--script-photo-tile-size);
    padding: 0;
    border-style: dashed;
    border-width: 1.5px;
    border-radius: 14px;
}

#script-photo-dropzone:focus-visible {
    outline: none;
    border-color: var(--tech-neon);
    box-shadow: 0 0 0 3px rgba(0, 212, 255, 0.16);
}

.script-photo-add-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 2.1rem;
    font-weight: 500;
    line-height: 1;
}

#script-photo-preview.photo-preview-grid {
    margin-top: 0;
    display: flex;
    flex: 1 1 220px;
    flex-wrap: wrap;
    gap: 12px;
    min-width: 0;
}

#script-photo-preview .photo-preview-item {
    width: var(--script-photo-tile-size);
    flex: 0 0 var(--script-photo-tile-size);
}

#script-photo-count,
#script-narration-choice {
    flex: 1 0 100%;
    margin-top: 0;
}

.photo-preview-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));
    gap: 8px;
    margin-top: 12px;
}

.photo-preview-item {
    position: relative;
    aspect-ratio: 1;
    border-radius: 10px;
    overflow: hidden;
    border: 2px solid transparent;
    transition: border-color 0.2s;
}

.photo-preview-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.photo-preview-item .photo-remove-btn {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.7);
    color: #fff;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    line-height: 1;
    opacity: 0;
    transition: opacity 0.2s;
}

.photo-preview-item:hover .photo-remove-btn {
    opacity: 1;
}

.photo-count {
    margin-top: 8px;
    font-size: 0.8rem;
    color: var(--text-muted);
}

@media (max-width: 640px) {
    #script-photo-area {
        gap: 10px;
    }

    #script-photo-preview.photo-preview-grid {
        flex-basis: 100%;
    }
}

.script-tevoxi-selection-row {
    margin-top: 8px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.script-tevoxi-selection-row .photo-count {
    margin-top: 0;
    flex: 1;
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.script-tevoxi-play-btn {
    width: 30px;
    height: 30px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.04);
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.2s;
    flex-shrink: 0;
}

.script-tevoxi-play-btn:hover:not(:disabled) {
    color: var(--accent);
    border-color: var(--accent);
    background: rgba(246, 165, 47, 0.1);
}

.script-tevoxi-play-btn.playing {
    color: var(--accent);
    border-color: var(--accent);
}

.script-tevoxi-play-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.narration-choice {
    margin-top: 12px;
    padding: 10px 12px;
    border: 1px solid rgba(96, 129, 162, 0.2);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.02);
    display: flex;
    align-items: flex-start;
    gap: 10px;
}

.narration-choice-text {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.narration-choice-text strong {
    font-size: 0.9rem;
    color: var(--text);
}

.narration-choice-text small {
    font-size: 0.76rem;
    color: var(--text-muted);
}

/* ── Toggle Switch ── */
.toggle-switch {
    position: relative;
    display: inline-block;
    width: 40px;
    height: 22px;
    flex-shrink: 0;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    inset: 0;
    background: rgba(255, 255, 255, 0.12);
    border: 1px solid rgba(255, 255, 255, 0.72);
    border-radius: 22px;
    transition: 0.25s;
}

.toggle-slider::before {
    content: "";
    position: absolute;
    width: 16px;
    height: 16px;
    left: 3px;
    bottom: 3px;
    background: #fff;
    border-radius: 50%;
    transition: 0.25s;
}

.toggle-switch input:checked + .toggle-slider {
    background: var(--accent);
}

.toggle-switch input:checked + .toggle-slider::before {
    transform: translateX(18px);
}

/* ── Subtitle Toggle Row ── */
.subtitle-toggle-row {
    display: flex;
    align-items: center;
    gap: 10px;
}

.subtitle-toggle-label {
    font-size: 0.88rem;
    color: var(--text);
}

.script-subtitle-position-group {
    margin-top: 10px;
}

.script-subtitle-position-group .input {
    max-width: 280px;
}

#script-audio-spectrum-group {
    animation: wizardFadeIn 0.2s ease-out;
}

#script-bgm-group.is-locked {
    opacity: 0.72;
}

#script-bgm-group.is-locked .subtitle-toggle-row {
    pointer-events: none;
}

#script-bgm-group.is-locked .field-hint {
    color: var(--accent);
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

#create-progress-text {
    color: var(--text-muted);
    font-size: 0.95rem;
}

@media (max-width: 768px) {
    /* Hide desktop sidebar */
    .sidebar {
        display: none !important;
    }

    .main-content {
        margin-left: 0 !important;
        padding: 16px 16px 76px;
        overflow-x: hidden;
    }

    .wizard-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .create-tabs-row {
        flex-wrap: wrap;
    }

    /* Show mobile bottom nav */
    .mobile-bottom-nav {
        display: flex;
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        height: 56px;
        background: var(--bg-card-strong);
        border-top: 1px solid var(--border);
        z-index: 1000;
        align-items: center;
        justify-content: space-around;
        padding: 0;
    }

    .mobile-nav-tab {
        flex: 1;
        min-width: 0;
        padding: 6px 8px;
    }

    .mobile-nav-tab span {
        font-size: 9px;
    }

    .mobile-profile-btn {
        display: flex;
    }

    .page-header {
        align-items: center;
        flex-wrap: nowrap;
        gap: 0.75rem;
    }

    .page-header-right {
        width: auto;
        gap: 8px;
        justify-content: flex-end;
        margin-left: auto;
        flex-wrap: nowrap;
        flex-shrink: 0;
    }

    .page-header-left {
        min-width: 0;
        gap: 8px;
    }

    .page-subheader {
        margin: -0.45rem 0 1.1rem;
    }

    .sidebar-credits {
        padding: 6px 10px;
        gap: 4px;
    }

    .sidebar-credits-label {
        font-size: 10px;
    }

    .sidebar-credits [data-credits-count] {
        font-size: 12px;
    }

    .publish-top-tabs {
        width: 100%;
    }

    .publish-top-tab {
        flex: 1;
    }

    .page-header h1 {
        font-size: 22px;
    }

    .cards-grid {
        grid-template-columns: 1fr;
    }

    .checkbox-group,
    .connect-buttons {
        flex-direction: column;
    }

    .publish-platforms-icons {
        flex-direction: row;
    }

    .social-connect-grid {
        grid-template-columns: 1fr;
    }

    .analyze-account-picker {
        grid-template-columns: 1fr;
    }

    .analyze-channel-head {
        align-items: flex-start;
    }

    .analyze-history-toolbar {
        grid-template-columns: 1fr;
    }

    .analyze-video-grid,
    .analyze-suggestions-grid,
    .analyze-tools-grid {
        grid-template-columns: 1fr;
    }

    .card-actions {
        flex-direction: row;
    }

    .publish-tab-content,
    .panel,
    #publish-form-area,
    .publish-select-row,
    .publish-form-group,
    .publish-account-selectors,
    .publish-account-row,
    .publish-drafts-panel,
    .publish-draft-item,
    .table-wrapper {
        min-width: 0;
        max-width: 100%;
    }

    .publish-account-label {
        justify-content: flex-start;
    }

    .publish-action-row {
        gap: 0.4rem;
    }

    .publish-action-btn {
        min-height: 42px;
        padding: 0.38rem 0.22rem;
        font-size: 0.73rem;
        border-radius: 9px;
    }

    .publish-select-row {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 0.5rem;
    }

    .publish-select-row .input {
        font-size: 0.84rem;
        padding-left: 0.72rem;
        padding-right: 0.72rem;
    }

    .automate-section-head {
        align-items: flex-start;
    }

    .publish-draft-head {
        align-items: flex-start;
    }

    .publish-draft-actions .btn {
        flex: 1 1 calc(50% - 0.45rem);
        min-width: 0;
    }

    /* ── Automation mobile fixes ── */
    .automate-header-actions {
        margin-left: auto;
    }

    .auto-pilot-item {
        flex-direction: column;
        align-items: stretch;
    }

    .auto-pilot-kpis {
        grid-template-columns: 1fr;
    }

    .auto-pilot-actions {
        width: 100%;
        flex-direction: column;
    }

    .auto-pilot-actions .btn {
        width: 100%;
    }

    .auto-card {
        padding: 0.75rem 0.85rem;
        max-width: 100%;
        overflow: hidden;
        box-sizing: border-box;
    }

    .auto-card-header h4 {
        font-size: 0.9rem;
    }

    .auto-card-meta {
        gap: 0.5rem;
        font-size: 0.78rem;
    }

    .auto-card-detail {
        min-width: 0;
        overflow: hidden;
    }

    .auto-theme-item {
        min-width: 0;
        max-width: 100%;
        gap: 0.35rem;
    }

    .auto-theme-item span {
        min-width: 0;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .auto-theme-item .theme-badge {
        font-size: 0.6rem;
        padding: 1px 4px;
    }

    .auto-theme-item .theme-credit-tag {
        font-size: 0.58rem;
        padding: 1px 4px;
    }

    .auto-theme-item .theme-error-btn,
    .auto-theme-item .theme-run-btn {
        font-size: 0.6rem;
        padding: 1px 4px;
    }

    .auto-theme-item .theme-run-btn {
        width: 24px;
        height: 24px;
    }

    .auto-theme-item .theme-date-editor {
        width: 100%;
        margin-left: 0;
    }

    .auto-theme-item .theme-date-input {
        flex: 1;
        min-width: 0;
    }

    .auto-theme-add {
        min-width: 0;
        max-width: 100%;
    }

    .auto-theme-add .input {
        min-width: 0;
        flex: 1;
    }

    .auto-card-actions {
        flex-wrap: wrap;
    }

    .auto-card-actions .btn {
        font-size: 0.78rem;
        padding: 0.35rem 0.65rem;
    }

    /* Modal sizing for mobile */
    .modal-content-wide {
        width: calc(100% - 0.5rem);
        max-width: 100vw;
    }

    #modal-new-project .modal-content-wide {
        width: calc(100vw - 0.5rem);
        max-width: calc(100vw - 0.5rem);
        height: calc(100vh - 0.5rem);
        max-height: calc(100vh - 0.5rem);
    }

    .modal-body {
        padding: 0.85rem;
    }

    .auto-type-cards,
    .auto-video-type-grid {
        grid-template-columns: 1fr 1fr;
        gap: 0.5rem;
    }

    #auto-realistic-settings .form-group label,
    #auto-manual-settings .form-group label {
        font-size: 0.85rem;
    }

    .engine-options {
        gap: 6px;
    }

    .similar-busy-card {
        padding: 20px 16px;
    }

    .similar-preview-box-horizontal,
    .similar-preview-box-vertical,
    .similar-preview-box-square {
        max-width: 100%;
    }

    .engine-option {
        flex: 1 1 calc(33% - 4px);
        padding: 6px 4px;
    }

    .engine-option strong {
        font-size: 0.72rem;
    }

    #wizard-realistic-engine,
    #script-realistic-engine,
    #auto-realistic-engine {
        grid-template-columns: 1fr;
    }

    #wizard-realistic-engine .engine-option,
    #script-realistic-engine .engine-option,
    #auto-realistic-engine .engine-option {
        min-height: 0;
    }

    .engine-option-desc {
        font-size: 0.64rem;
    }

    .realistic-inspiration-tags {
        gap: 6px;
    }

    .realistic-inspiration-tags .style-tag {
        font-size: 0.75rem;
        padding: 5px 10px;
    }

    .duration-options {
        gap: 6px;
    }

    .duration-option {
        padding: 8px 12px;
        font-size: 0.8rem;
    }
}

@media (max-width: 900px) {
    .auth-shell {
        justify-content: flex-start;
        padding-top: clamp(3.4rem, 12vh, 5.4rem);
        padding-bottom: 1rem;
    }
}

@media (max-width: 640px) {
    .auth-shell {
        justify-content: flex-start;
        padding: 2.85rem 0.62rem 0.62rem;
        gap: 0.12rem;
    }

    .auth-brand {
        gap: 0.14rem;
    }

    .auth-brand-image {
        width: min(100%, 128px);
    }

    .auth-card {
        width: min(100%, 332px);
        padding: 0.66rem 0.78rem 0.74rem;
    }

    .auth-card-header h2 {
        margin: 0;
        font-size: 1.7rem;
    }

    .auth-card-header p {
        margin-top: 0.32rem;
    }

    .auth-form {
        gap: 0.42rem;
        margin-top: 0.54rem;
    }

    .field span {
        margin-bottom: 0.16rem;
        font-size: 0.8rem;
    }

    .input {
        padding: 0.6rem 0.72rem;
        border-radius: 10px;
    }

    .btn {
        padding: 0.64rem 0.82rem;
        border-radius: 10px;
    }

    .auth-divider {
        margin: 0.56rem 0;
        font-size: 0.78rem;
    }

    .provider-stack {
        gap: 0.42rem;
    }

    .auth-switch {
        margin-top: 0.58rem;
    }

    .auth-legal-links {
        margin-top: 0.42rem;
        font-size: 0.74rem;
    }
}

@media (max-width: 640px) and (max-height: 820px) {
    .auth-brand-image {
        width: min(100%, 112px);
    }

    .auth-card {
        width: min(100%, 318px);
        padding: 0.58rem 0.68rem 0.66rem;
    }

    .auth-form {
        margin-top: 0.45rem;
        gap: 0.35rem;
    }

    .input,
    .btn {
        padding-top: 0.54rem;
        padding-bottom: 0.54rem;
    }
}

/* ═══ Voice Selector & Manager ═══ */

.voice-selector {
    max-width: 560px;
    margin: 0 auto;
}

/* Minha Voz Button (Levita-style) */
.minha-voz-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 14px 20px;
    margin-bottom: 16px;
    background: var(--bg-card);
    border: 2px solid var(--border);
    border-radius: 12px;
    color: var(--text);
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.minha-voz-btn:hover {
    border-color: var(--accent);
    color: var(--accent);
}

.minha-voz-btn.active {
    border-color: var(--accent);
    background: rgba(246,165,47,0.06);
    color: var(--accent);
}

/* Persona Panel */
.persona-panel {
    margin-bottom: 16px;
    padding: 16px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    animation: fadeIn 0.2s;
}

.persona-panel.hidden {
    display: none;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(-6px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Persona List */
.persona-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 12px;
}

.persona-list:empty {
    display: none;
}

.persona-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    background: rgba(255,255,255,0.03);
    border: 1px solid var(--border);
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s;
}

.persona-item:hover {
    border-color: rgba(246,165,47,0.3);
}

.persona-item.selected {
    border-color: var(--accent);
    background: rgba(246,165,47,0.06);
}

.persona-item-icon {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--accent-soft);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 1.1rem;
}

.persona-item-info {
    flex: 1;
    min-width: 0;
}

.persona-item-name {
    font-weight: 600;
    font-size: 0.88rem;
}

.persona-item-meta {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.persona-item-badge {
    font-size: 0.7rem;
    color: var(--accent);
    font-weight: 600;
}

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

/* Persona Actions (Record/Upload) */
.persona-actions {
    display: flex;
    gap: 8px;
    margin-bottom: 12px;
}

.persona-upload-btn,
.persona-record-btn {
    flex: 1;
    padding: 10px 16px;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: rgba(255,255,255,0.03);
    color: var(--text);
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    transition: all 0.2s;
}

.persona-record-btn:hover,
.persona-upload-btn:hover {
    border-color: var(--accent);
    color: var(--accent);
}

.persona-hint {
    font-size: 0.78rem;
    color: var(--text-muted);
    text-align: center;
    margin: 0;
}

/* Recording Area */
.persona-recording-area {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    background: rgba(231, 76, 60, 0.08);
    border: 1px solid rgba(231, 76, 60, 0.3);
    border-radius: 10px;
    margin-bottom: 12px;
}

/* Preview + Save */
.persona-preview {
    margin-bottom: 12px;
}

.persona-preview audio {
    width: 100%;
    height: 36px;
    margin-bottom: 8px;
}

.persona-save-row {
    display: flex;
    gap: 8px;
    align-items: center;
}

.persona-save-row .input {
    flex: 1;
}

/* Consent Step for Voice Cloning */
.consent-step {
    padding: 14px;
    background: rgba(246,165,47,0.05);
    border: 1px solid rgba(246,165,47,0.25);
    border-radius: 10px;
    margin-bottom: 12px;
}

.consent-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}

.consent-icon {
    font-size: 1.2rem;
}

.consent-title {
    font-weight: 700;
    font-size: 0.92rem;
}

.consent-desc {
    font-size: 0.82rem;
    color: var(--text-muted);
    margin: 0 0 10px;
}

.consent-phrase {
    padding: 12px 14px;
    background: rgba(255,255,255,0.06);
    border: 1px dashed rgba(246,165,47,0.4);
    border-radius: 8px;
    font-size: 0.88rem;
    font-style: italic;
    line-height: 1.5;
    margin-bottom: 12px;
    color: var(--text);
}

.consent-actions {
    display: flex;
    gap: 8px;
    margin-bottom: 8px;
}

.consent-status {
    font-size: 0.82rem;
    padding: 8px 12px;
    border-radius: 8px;
    margin-top: 8px;
    text-align: center;
}

.consent-status.success {
    background: rgba(46,204,113,0.12);
    color: #2ecc71;
    border: 1px solid rgba(46,204,113,0.3);
}

.consent-status.error {
    background: rgba(231,76,60,0.12);
    color: #e74c3c;
    border: 1px solid rgba(231,76,60,0.3);
}

.consent-status.loading {
    background: rgba(246,165,47,0.12);
    color: var(--accent);
    border: 1px solid rgba(246,165,47,0.3);
}

.voice-section {
    margin-bottom: 16px;
}

.voice-section-title {
    display: block;
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
}

.suno-voice-hint {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin: 6px 0 0;
    text-align: center;
    opacity: 0.8;
}

/* Voice card with preview button */
.voice-card {
    display: flex;
    align-items: stretch;
    position: relative;
}

.voice-card .wizard-option {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    border-radius: 12px 0 0 12px;
}

.voice-card .wizard-option small {
    font-size: 0.7rem;
    opacity: 0.6;
    font-weight: 400;
}

.voice-preview-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    background: rgba(96, 129, 162, 0.15);
    border: 1px solid var(--border);
    border-left: 0;
    border-radius: 0 12px 12px 0;
    color: var(--accent);
    cursor: pointer;
    transition: background 0.2s, color 0.2s;
}

.voice-preview-btn:hover {
    background: var(--accent);
    color: #fff;
}

.voice-preview-btn.playing {
    background: var(--accent);
    color: #fff;
}

/* Voice Manager Modal */

.vm-header-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}

.vm-header-row h4 {
    margin: 0;
    font-size: 1rem;
}

.vm-profiles-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.vm-profile-card {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    background: rgba(255,255,255,0.03);
    border: 1px solid var(--border);
    border-radius: 12px;
    transition: border-color 0.2s;
}

.vm-profile-card:hover {
    border-color: rgba(246,165,47,0.3);
}

.vm-profile-card.is-default {
    border-color: var(--accent);
    background: rgba(246,165,47,0.04);
}

.vm-profile-icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    background: var(--accent-soft);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.vm-profile-info {
    flex: 1;
    min-width: 0;
}

.vm-profile-name {
    font-weight: 600;
    font-size: 0.9rem;
}

.vm-profile-meta {
    font-size: 0.78rem;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.vm-profile-actions {
    display: flex;
    gap: 6px;
    flex-shrink: 0;
}

.btn-icon-sm {
    background: none;
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text-muted);
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 1.1rem;
    transition: all 0.2s;
}

.btn-icon-sm:hover {
    border-color: var(--accent);
    color: var(--accent);
}

.btn-sm.btn-danger {
    background: #e74c3c;
    border-color: #e74c3c;
    color: #fff;
}

/* Voice Record Area */

.recording-pulse {
    width: 12px;
    height: 12px;
    background: #e74c3c;
    border-radius: 50%;
    animation: pulse-recording 1s infinite;
}

@keyframes pulse-recording {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.5; transform: scale(1.2); }
}

/* Premium High-Tech Refinements */

.sidebar,
.mobile-bottom-nav {
    background: linear-gradient(185deg, rgba(23, 58, 94, 0.92), rgba(10, 31, 51, 0.95));
    backdrop-filter: blur(12px);
}

.sidebar {
    border-right: 1px solid rgba(0, 212, 255, 0.18);
    box-shadow: 10px 0 36px rgba(1, 8, 20, 0.42);
}

.sidebar-toggle {
    background: linear-gradient(155deg, rgba(19, 47, 76, 0.92), rgba(10, 31, 51, 0.96));
    border-color: rgba(0, 212, 255, 0.3);
    box-shadow: 0 12px 24px rgba(1, 8, 20, 0.35);
}

.sidebar-toggle:hover {
    background: linear-gradient(155deg, rgba(23, 58, 94, 0.95), rgba(10, 31, 51, 0.98));
    box-shadow: 0 0 14px rgba(0, 212, 255, 0.2);
}

.main-content {
    background: linear-gradient(180deg, rgba(10, 31, 51, 0.12), rgba(10, 31, 51, 0));
}

.nav-item {
    border: 1px solid transparent;
}

.nav-item:hover {
    background: rgba(0, 212, 255, 0.08);
    border-color: rgba(0, 212, 255, 0.24);
}

.nav-item.active {
    background: linear-gradient(120deg, rgba(0, 212, 255, 0.16), rgba(123, 97, 255, 0.2));
    border-color: rgba(0, 212, 255, 0.35);
    box-shadow: inset 0 0 0 1px rgba(0, 212, 255, 0.16), 0 0 16px rgba(0, 212, 255, 0.16);
}

.nav-item.active svg,
.mobile-nav-tab.active svg,
.create-tab.active svg,
.wizard-dot.active {
    filter: drop-shadow(0 0 8px rgba(0, 212, 255, 0.42));
}

.sidebar-credits {
    background: linear-gradient(130deg, rgba(var(--accent-rgb), 0.18), rgba(var(--accent-strong-rgb), 0.2));
    border: 1px solid rgba(var(--accent-rgb), 0.38);
    color: var(--accent-strong);
    box-shadow: 0 0 0 1px rgba(var(--accent-rgb), 0.12), 0 8px 16px rgba(var(--accent-rgb), 0.12);
}

.sidebar-credits:hover {
    background: linear-gradient(130deg, rgba(var(--accent-rgb), 0.24), rgba(var(--accent-strong-rgb), 0.28));
    box-shadow: 0 0 10px rgba(var(--accent-rgb), 0.24);
}

.user-avatar,
.profile-avatar {
    background: linear-gradient(145deg, rgba(23, 58, 94, 0.88), rgba(19, 47, 76, 0.92));
    border: 1px solid rgba(0, 212, 255, 0.2);
}

.panel,
.card,
.song-details,
.modal-content,
.credits-modal,
.pix-modal,
.persona-panel,
.vm-profile-card,
.copy-choice-card {
    background: linear-gradient(158deg, rgba(19, 47, 76, 0.84), rgba(23, 58, 94, 0.68));
    border-color: rgba(0, 212, 255, 0.22);
    box-shadow: 0 18px 38px rgba(1, 8, 20, 0.38), 0 1px 0 rgba(255, 255, 255, 0.04) inset;
    backdrop-filter: blur(11px);
}

.panel,
.song-details,
.card,
.modal-content,
.credits-modal,
.pix-modal {
    border-radius: 14px;
}

.card:hover {
    border-color: rgba(0, 212, 255, 0.34);
    box-shadow: 0 20px 40px rgba(1, 8, 20, 0.46), 0 0 16px rgba(0, 212, 255, 0.12);
}

.card-btn {
    border-color: rgba(0, 212, 255, 0.25);
    background: rgba(19, 47, 76, 0.7);
}

.card-btn:hover {
    border-color: rgba(0, 212, 255, 0.45);
    background: rgba(23, 58, 94, 0.82);
}

.card-btn-generate {
    color: var(--tech-neon);
    border-color: rgba(0, 212, 255, 0.36);
}

.card-btn-generate:hover {
    background: rgba(0, 212, 255, 0.16);
    color: var(--tech-neon);
}

.card-btn-publish {
    color: #86fbff;
    border-color: rgba(134, 251, 255, 0.38);
}

.card-btn-publish:hover {
    background: rgba(134, 251, 255, 0.16);
    color: #86fbff;
}

.table-wrapper.panel {
    border-color: rgba(0, 212, 255, 0.2);
}

th,
.field-hint,
.char-count,
.photo-upload-hint,
.wizard-hint,
.user-role,
.profile-email,
.photo-count,
.vm-profile-meta,
.persona-item-meta {
    color: var(--text-secondary);
}

.progress-bar-fill {
    background: linear-gradient(90deg, var(--tech-neon), var(--tech-purple), var(--accent));
}

.modal,
.credits-modal-overlay,
.pix-modal-overlay {
    background: rgba(2, 10, 18, 0.78);
    backdrop-filter: blur(16px);
}

.modal-header,
.modal-footer {
    border-color: rgba(0, 212, 255, 0.12);
}

.create-tabs-row {
    background: rgba(10, 31, 51, 0.7);
    border: 1px solid rgba(0, 212, 255, 0.18);
}

.create-tab {
    border: 1px solid transparent;
}

.create-tab:hover {
    background: rgba(0, 212, 255, 0.08);
}

.create-tab.active {
    background: linear-gradient(132deg, rgba(0, 212, 255, 0.18), rgba(123, 97, 255, 0.24));
    color: var(--text);
    border-color: rgba(0, 212, 255, 0.36);
    box-shadow: 0 0 14px rgba(0, 212, 255, 0.2);
}

.wizard-input,
.wizard-textarea,
.photo-dropzone,
.copy-choice-card,
.narration-choice {
    background: rgba(10, 31, 51, 0.62);
    border-color: rgba(0, 212, 255, 0.26);
}

.wizard-input:focus,
.wizard-textarea:focus {
    border-color: var(--tech-neon);
    box-shadow: 0 0 0 3px rgba(0, 212, 255, 0.15), 0 0 16px rgba(0, 212, 255, 0.16);
}

.photo-dropzone:hover,
.photo-dropzone.dragover {
    background: rgba(0, 212, 255, 0.08);
    border-color: var(--tech-neon);
    color: var(--tech-neon);
}

.wizard-option,
.duration-option,
.pause-option,
.style-tag,
.minha-voz-btn,
.persona-record-btn,
.persona-upload-btn,
.textarea-icon-btn,
.btn-icon-sm,
.voice-preview-btn,
.script-tevoxi-play-btn {
    background: rgba(19, 47, 76, 0.64);
    border-color: rgba(0, 212, 255, 0.24);
}

.toggle-slider {
    background: rgba(19, 47, 76, 0.72);
    border: 1px solid rgba(255, 255, 255, 0.78);
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.12);
}

.toggle-switch input:checked + .toggle-slider {
    background: linear-gradient(135deg, rgba(var(--accent-rgb), 0.95), rgba(var(--accent-strong-rgb), 0.95));
    border-color: rgba(255, 255, 255, 0.92);
    box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.18), 0 0 10px rgba(var(--accent-rgb), 0.24);
}

.toggle-switch input:focus-visible + .toggle-slider {
    box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.34), 0 0 0 4px rgba(0, 212, 255, 0.18);
}

.wizard-option:hover,
.duration-option:hover,
.pause-option:hover,
.style-tag:hover,
.minha-voz-btn:hover,
.persona-record-btn:hover,
.persona-upload-btn:hover,
.textarea-icon-btn:hover,
.btn-icon-sm:hover,
.script-tevoxi-play-btn:hover:not(:disabled) {
    border-color: rgba(0, 212, 255, 0.42);
    box-shadow: 0 0 12px rgba(0, 212, 255, 0.14);
}

.wizard-option.selected,
.duration-option.selected,
.pause-option.selected,
.style-tag.selected,
.minha-voz-btn.active,
.persona-item.selected,
.vm-profile-card.is-default {
    background: linear-gradient(130deg, rgba(0, 212, 255, 0.16), rgba(123, 97, 255, 0.2));
    border-color: rgba(0, 212, 255, 0.44);
    color: var(--text);
    box-shadow: 0 0 14px rgba(0, 212, 255, 0.18);
}

.voice-preview-btn {
    color: var(--tech-neon);
}

.voice-preview-btn:hover,
.voice-preview-btn.playing {
    background: linear-gradient(135deg, var(--tech-neon), var(--tech-purple));
    color: #0a1f33;
}

.wizard-dot {
    background: rgba(255, 255, 255, 0.22);
}

.wizard-dot.active {
    background: var(--accent-strong);
    transform: scale(1.25);
}

.page.active {
    animation: pageReveal 0.35s ease-out;
}

@keyframes pageReveal {
    from {
        opacity: 0;
        transform: translateY(4px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* --- AI Publish Suggestions --- */
.pub-ai-loading {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    margin-bottom: 10px;
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.12), rgba(168, 85, 247, 0.12));
    border: 1px solid rgba(59, 130, 246, 0.3);
    border-radius: 10px;
    color: var(--primary);
    font-size: 0.85rem;
    animation: aiPulse 1.5s ease-in-out infinite;
}
@keyframes aiPulse {
    0%, 100% { opacity: 0.7; }
    50% { opacity: 1; }
}
.spinner-small {
    width: 18px;
    height: 18px;
    border: 2px solid rgba(59, 130, 246, 0.2);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}
@keyframes spin {
    to { transform: rotate(360deg); }
}

.pub-thumbnail-area {
    margin-bottom: 12px;
}
.pub-thumbnail-provider {
    margin-bottom: 8px;
}
.pub-thumbnail-provider label {
    display: block;
    margin-bottom: 4px;
    font-size: 0.78rem;
    color: var(--text-secondary);
}
.pub-thumbnail-tools {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 8px;
}
.pub-thumb-reference-meta {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
    padding: 8px 10px;
    border-radius: 10px;
    border: 1px dashed rgba(59, 130, 246, 0.35);
    background: rgba(20, 62, 105, 0.28);
}
.pub-thumb-reference-preview {
    width: 60px;
    height: 60px;
    border-radius: 8px;
    object-fit: cover;
    border: 1px solid rgba(59, 130, 246, 0.42);
    flex-shrink: 0;
}
.pub-thumb-reference-status {
    font-size: 0.8rem;
    color: var(--text-secondary);
    line-height: 1.35;
}
.pub-thumb-reference-status.is-ready {
    color: var(--success);
}
.pub-thumb-reference-status.is-error {
    color: var(--danger);
}
.pub-thumbnail-loading {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    margin-bottom: 8px;
    background: linear-gradient(135deg, rgba(168, 85, 247, 0.12), rgba(236, 72, 153, 0.12));
    border: 1px solid rgba(168, 85, 247, 0.3);
    border-radius: 10px;
    color: #a855f7;
    font-size: 0.85rem;
    animation: aiPulse 1.5s ease-in-out infinite;
}
.pub-thumbnail-preview {
    width: 100%;
    max-width: 400px;
    border-radius: 10px;
    border: 2px solid rgba(59, 130, 246, 0.3);
    margin-bottom: 8px;
    display: block;
}
.btn-sm {
    padding: 6px 14px;
    font-size: 0.78rem;
}
#pub-hashtags {
    font-size: 0.82rem;
    color: var(--primary);
}

/* Publish links section */
.pub-links-section {
    border: 1px solid rgba(96, 129, 162, 0.25);
    border-radius: 10px;
    padding: 0;
    overflow: hidden;
}
.pub-links-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    cursor: pointer;
    user-select: none;
    transition: background 0.15s;
}
.pub-links-header:hover {
    background: rgba(96, 129, 162, 0.1);
}
.pub-links-title {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text);
}
.pub-links-arrow {
    font-size: 0.7rem;
    color: var(--text-muted);
    transition: transform 0.2s;
}
.pub-links-arrow.open {
    transform: rotate(180deg);
}
.pub-links-body {
    padding: 0 14px 14px;
}
.pub-links-hint {
    font-size: 0.78rem;
    color: var(--text-muted);
    margin: 0 0 8px;
    line-height: 1.35;
}
.pub-links-account-label {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--primary);
    margin: 0 0 6px;
}
.pub-links-account-label:empty {
    display: none;
}

/* Connect API keys fields */
.connect-api-keys {
    margin-top: 8px;
    padding-top: 10px;
    border-top: 1px solid rgba(96, 129, 162, 0.2);
}
.connect-api-hint {
    font-size: 0.8rem;
    margin-bottom: 10px;
    line-height: 1.4;
}
#pub-links {
    font-size: 0.82rem;
    color: var(--primary);
    margin-bottom: 8px;
}
#btn-save-links {
    margin-top: 2px;
}

/* Edit project modal */
.edit-downloads {
    margin-top: 16px;
    padding-top: 14px;
    border-top: 1px solid rgba(255,255,255,0.08);
}
.edit-downloads > label {
    font-size: 0.85rem;
    font-weight: 600;
    margin-bottom: 8px;
    display: block;
    color: rgba(255,255,255,0.7);
}
.edit-download-btns {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}
.edit-download-btns .btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    text-decoration: none;
}
.edit-thumb-upload > label {
    font-size: 0.85rem;
    font-weight: 600;
    margin-bottom: 8px;
    display: block;
    color: rgba(255,255,255,0.7);
}
.edit-thumb-preview-row {
    display: flex;
    align-items: flex-start;
    gap: 12px;
}
.edit-thumb-img {
    width: 120px;
    max-height: 80px;
    object-fit: cover;
    border-radius: 8px;
    border: 1px solid rgba(255,255,255,0.1);
}
.edit-thumb-actions {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

/* ═══ Video Type Selection Cards ═══ */

.video-type-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    margin-top: 12px;
}

#wizard-video-type-grid,
#modal-new-automation .auto-video-type-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    max-width: 680px;
    margin-left: auto;
    margin-right: auto;
}

/* ── Mode Selection Cards (Step 0) ── */
.create-mode-selection {
    text-align: center;
    padding: 10px 0 20px;
}
.mode-selection-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-top: 16px;
    max-width: 520px;
    margin-left: auto;
    margin-right: auto;
}

.mode-selection-grid-create {
    max-width: 900px;
    grid-template-columns: repeat(4, minmax(0, 1fr));
}
.mode-selection-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 10px;
    padding: 28px 18px 22px;
    background: var(--card);
    border: 2px solid var(--border);
    border-radius: 16px;
    cursor: pointer;
    transition: border-color 0.2s, box-shadow 0.2s, transform 0.15s;
}
.mode-selection-card:hover {
    border-color: var(--accent);
    box-shadow: 0 0 16px rgba(255, 167, 38, 0.2);
    transform: translateY(-3px);
}
.mode-selection-card:active {
    transform: translateY(0);
}
.mode-selection-icon {
    width: 56px;
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.05);
}
.mode-selection-icon svg {
    color: var(--accent);
}
.mode-selection-card strong {
    font-size: 1.05rem;
    color: var(--text);
}
.mode-selection-card small {
    font-size: 0.8rem;
    color: var(--text-muted);
    line-height: 1.4;
}

.workflow-panel-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 12px;
}

#create-panel-workflow {
    height: 100%;
    display: flex;
    flex-direction: column;
}

.workflow-panel-head .wizard-question {
    margin-bottom: 4px;
}

.workflow-head-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
    flex-wrap: wrap;
}

.workflow-head-btn {
    width: 38px;
    min-width: 38px;
    height: 38px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.workflow-head-btn svg {
    width: 18px;
    height: 18px;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.workflow-template-select {
    width: 170px;
    min-height: 34px;
    padding: 6px 9px;
    font-size: 0.8rem;
}

.workflow-shell {
    display: block;
    min-height: 620px;
    flex: 1;
    min-height: 0;
}

.workflow-canvas-wrap {
    position: relative;
    min-height: 0;
    height: 100%;
    overflow: auto;
    border: 1px solid var(--border);
    border-radius: 14px;
    background-color: rgba(12, 38, 68, 0.96);
    background-image: radial-gradient(rgba(148, 199, 255, 0.22) 1px, transparent 1px);
    background-size: 18px 18px;
    cursor: grab;
    touch-action: none;
}

.workflow-connection-menu {
    position: absolute;
    z-index: 30;
    padding: 6px;
    border: 1px solid rgba(0, 212, 255, 0.32);
    border-radius: 9px;
    background: rgba(7, 24, 43, 0.96);
    box-shadow: 0 16px 32px rgba(0, 0, 0, 0.32);
}

.workflow-connection-menu button {
    border: 1px solid rgba(255, 122, 108, 0.4);
    border-radius: 7px;
    background: rgba(255, 122, 108, 0.12);
    color: #ffd0ca;
    padding: 7px 10px;
    font-size: 0.76rem;
    cursor: pointer;
}

.workflow-add-menu {
    position: sticky;
    top: 14px;
    left: 14px;
    z-index: 20;
    width: max-content;
    padding: 12px 0 0 12px;
    pointer-events: none;
}

.workflow-add-main {
    width: 42px;
    height: 42px;
    border: 1px solid rgba(0, 212, 255, 0.42);
    border-radius: 12px;
    background: linear-gradient(135deg, rgba(0, 212, 255, 0.18), rgba(246, 165, 47, 0.2));
    color: var(--text);
    font-size: 1.35rem;
    font-weight: 800;
    cursor: pointer;
    pointer-events: auto;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.22);
}

.workflow-add-popover {
    margin-top: 8px;
    display: grid;
    gap: 8px;
    width: 220px;
    padding: 10px;
    border: 1px solid rgba(0, 212, 255, 0.24);
    border-radius: 12px;
    background: rgba(10, 35, 62, 0.96);
    pointer-events: auto;
    box-shadow: 0 18px 40px rgba(0, 0, 0, 0.34);
}

.workflow-add-card {
    display: grid;
    gap: 3px;
    width: 100%;
    border: 1px solid rgba(0, 212, 255, 0.22);
    border-radius: 10px;
    background: rgba(23, 58, 94, 0.82);
    color: var(--text);
    text-align: left;
    padding: 10px;
    cursor: pointer;
}

.workflow-add-card:hover {
    border-color: var(--accent);
    background: rgba(31, 73, 115, 0.92);
}

.workflow-add-card span {
    color: var(--text-muted);
    font-size: 0.72rem;
}

.workflow-canvas-wrap.panning {
    cursor: grabbing;
}

.workflow-canvas-surface {
    position: relative;
    width: 5000px;
    height: 3200px;
}

.workflow-canvas {
    position: relative;
    width: 5000px;
    height: 3200px;
    color: var(--text);
    transform-origin: top left;
}

.workflow-lines {
    position: absolute;
    inset: 0;
    z-index: 1;
    pointer-events: auto;
}

.workflow-lines path {
    fill: none;
    stroke: #14b8a6;
    stroke-width: 3;
    stroke-linecap: round;
    pointer-events: stroke;
    cursor: pointer;
}

.workflow-lines path.workflow-link-prompt { stroke: #14b8a6; }
.workflow-lines path.workflow-link-image { stroke: #34d399; }
.workflow-lines path.workflow-link-video { stroke: #ec4899; }
.workflow-lines path.workflow-link-audio { stroke: #38bdf8; }
.workflow-lines path.workflow-link-output { stroke: #fb923c; }

.workflow-lines path.selected,
.workflow-lines path:hover {
    stroke: #f6a52f;
    stroke-width: 5;
}

.workflow-lines path.workflow-link-video,
.workflow-lines path.workflow-link-audio {
    stroke-dasharray: 9 8;
}

.workflow-lines path.workflow-link-preview {
    stroke: #f6a52f;
    stroke-width: 4;
    stroke-dasharray: 10 7;
    pointer-events: none;
    filter: drop-shadow(0 0 8px rgba(246, 165, 47, 0.42));
}

.workflow-node {
    position: absolute;
    z-index: 2;
    width: 330px;
    border: 1px solid rgba(0, 212, 255, 0.18);
    border-left: 4px solid #14b8a6;
    border-radius: 8px;
    background: linear-gradient(158deg, rgba(19, 47, 76, 0.96), rgba(23, 58, 94, 0.9));
    box-shadow: 0 10px 26px rgba(1, 8, 20, 0.34);
    padding: 12px;
    user-select: none;
}

.workflow-node.dragging {
    z-index: 5;
    box-shadow: 0 12px 28px rgba(15, 23, 42, 0.2);
}

.workflow-node.dragging header {
    cursor: grabbing;
}

.workflow-node.selected {
    outline: 2px solid rgba(246, 165, 47, 0.78);
    outline-offset: 3px;
    z-index: 6;
}

.workflow-node-pulse {
    outline: 3px solid rgba(255, 167, 38, 0.45);
}

.workflow-node header {
    margin: -2px 0 10px;
    color: var(--text);
    font-weight: 700;
    cursor: grab;
    display: flex;
    align-items: center;
    gap: 8px;
}

.workflow-node header span {
    margin-left: auto;
    color: var(--text-muted);
    font-size: 0.76rem;
    font-weight: 600;
}

.workflow-node header .workflow-drag-handle {
    margin-left: 0;
    color: #67e8f9;
    cursor: grab;
    letter-spacing: -1px;
    flex: 0 0 auto;
}

.workflow-node.dragging header .workflow-drag-handle {
    cursor: grabbing;
}

.workflow-node-name {
    flex: 1;
    min-width: 0;
    border: 1px solid transparent;
    border-radius: 6px;
    background: transparent;
    color: var(--text);
    font: inherit;
    font-weight: 700;
    padding: 3px 5px;
}

.workflow-node-name:focus {
    border-color: rgba(130, 173, 213, 0.42);
    background: rgba(6, 22, 40, 0.38);
    outline: none;
}

.workflow-node label {
    display: block;
    margin: 7px 0 4px;
    color: var(--text-muted);
    font-size: 0.76rem;
}

.workflow-node-images {
    border-left-color: #34d399;
}

.workflow-node-video {
    border-left-color: #ec4899;
}

.workflow-node-audio {
    border-left-color: #38bdf8;
}

.workflow-node-model {
    width: 280px;
    border-left-color: #8b5cf6;
    display: flex;
    flex-direction: column;
}

.workflow-node-output {
    width: 300px;
    border-left-color: #fb923c;
}

.workflow-textarea,
.workflow-input {
    width: 100%;
    border: 1px solid rgba(130, 173, 213, 0.32);
    border-radius: 7px;
    background: rgba(6, 22, 40, 0.5);
    color: var(--text);
    font-size: 0.82rem;
}

.workflow-textarea {
    resize: vertical;
    min-height: 112px;
    padding: 10px;
    line-height: 1.45;
}

.workflow-textarea-small {
    min-height: 70px;
    margin-top: 8px;
}

.workflow-input {
    min-height: 34px;
    padding: 7px 9px;
}

.workflow-node-actions,
.workflow-upload-row {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 8px;
}

.workflow-ai-tools {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 7px;
    margin-top: 8px;
}

.workflow-ai-btn {
    width: 32px;
    height: 32px;
    border: 1px solid rgba(34, 211, 238, 0.48);
    border-radius: 999px;
    background: rgba(6, 22, 40, 0.58);
    color: #a5f3fc;
    font-weight: 800;
    cursor: pointer;
}

.workflow-ai-choices {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.workflow-ai-break {
    flex-basis: 100%;
    height: 0;
}

.workflow-ai-section-label {
    width: 100%;
    font-size: 0.68rem;
    color: var(--text-muted);
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.workflow-ai-choices[hidden] {
    display: none;
}

.workflow-ai-choices button {
    border: 1px solid rgba(56, 189, 248, 0.52);
    border-radius: 999px;
    background: rgba(6, 22, 40, 0.42);
    color: #dbeafe;
    padding: 6px 9px;
    font-size: 0.72rem;
    cursor: pointer;
}

.workflow-ai-custom-persona {
    width: 100%;
    display: grid;
    gap: 6px;
}

.workflow-ai-custom-persona[hidden] {
    display: none;
}

.workflow-ai-custom-persona-status {
    font-size: 0.73rem;
    line-height: 1.45;
    color: var(--text-muted);
}

.workflow-ai-choices button:hover,
.workflow-ai-btn:hover {
    border-color: #f6a52f;
    color: #fff;
}

.workflow-model-name-hint {
    margin: -4px 0 8px;
    color: var(--text-muted);
    font-size: 0.72rem;
}

.workflow-mini-btn,
.workflow-upload-icon {
    border: 1px solid rgba(130, 173, 213, 0.32);
    border-radius: 7px;
    background: rgba(6, 22, 40, 0.38);
    color: var(--text);
    padding: 7px 10px;
    font-size: 0.76rem;
    cursor: pointer;
}

.workflow-mini-btn:hover,
.workflow-upload-icon:hover {
    border-color: #8b5cf6;
    color: #6d28d9;
}

.workflow-upload-icon,
.workflow-thumb-add,
.workflow-media-add {
    width: 36px;
    height: 36px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid rgba(130, 173, 213, 0.42);
    border-radius: 9px;
    background: rgba(6, 22, 40, 0.4);
    color: #93c5fd;
    font-size: 1.2rem;
    line-height: 1;
    cursor: pointer;
}

.workflow-upload-icon:hover,
.workflow-thumb-add:hover,
.workflow-media-add:hover {
    border-color: #22d3ee;
    color: #fff;
}

.workflow-thumb-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 8px;
    min-height: 72px;
    margin-top: 10px;
    padding: 8px;
    border: 1px solid rgba(130, 173, 213, 0.24);
    border-radius: 8px;
}

.workflow-thumb,
.workflow-thumb-add {
    margin: 0;
    aspect-ratio: 1;
    min-height: 58px;
}

.workflow-thumb {
    position: relative;
    overflow: hidden;
    border: 1px solid rgba(130, 173, 213, 0.32);
    border-radius: 7px;
}

.workflow-thumb-fallback {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    font-size: 0.7rem;
    letter-spacing: 0.08em;
}

.workflow-thumb img {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: cover;
}

.workflow-thumb-remove {
    position: absolute;
    top: 4px;
    right: 4px;
}

.workflow-item-remove {
    width: 22px;
    height: 22px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid rgba(130, 173, 213, 0.4);
    border-radius: 999px;
    background: rgba(7, 20, 36, 0.86);
    color: #f8fafc;
    cursor: pointer;
    line-height: 1;
    padding: 0;
}

.workflow-item-remove:hover {
    border-color: #f87171;
    color: #fecaca;
}

.workflow-switch {
    display: flex !important;
    align-items: center;
    gap: 8px;
    color: var(--text-muted) !important;
}

.workflow-switch input {
    accent-color: #7c3aed;
}

.workflow-port {
    position: absolute;
    width: 10px;
    height: 10px;
    border: 2px solid #fff;
    border-radius: 50%;
    background: #14b8a6;
    box-shadow: 0 0 0 1px rgba(15, 23, 42, 0.14);
    cursor: crosshair;
    opacity: 0;
    transition: opacity 0.16s ease, box-shadow 0.16s ease, background 0.16s ease;
}

.workflow-node:hover .workflow-port,
.workflow-node.selected .workflow-port,
.workflow-port.workflow-port-open,
.workflow-port.pending {
    opacity: 1;
}

.workflow-port.pending {
    background: #f6a52f;
    box-shadow: 0 0 0 5px rgba(246, 165, 47, 0.26);
}

.workflow-node-preview {
    margin-top: 8px;
    min-height: 0;
}

.workflow-card-loading {
    display: grid;
    justify-items: center;
    gap: 8px;
    width: 100%;
    min-height: 110px;
    padding: 16px 12px;
    border: 1px dashed rgba(130, 173, 213, 0.26);
    border-radius: 10px;
    background: rgba(6, 22, 40, 0.32);
    color: var(--text-muted);
    text-align: center;
}

.workflow-card-loader {
    width: 28px;
    height: 28px;
    border: 3px solid rgba(246, 165, 47, 0.2);
    border-top-color: #f6a52f;
    border-radius: 50%;
    animation: spin 0.85s linear infinite;
}

.workflow-card-loading-copy {
    font-size: 0.74rem;
    line-height: 1.35;
}

.workflow-node-preview img {
    width: 100%;
    max-height: 130px;
    object-fit: cover;
    border: 1px solid rgba(130, 173, 213, 0.32);
    border-radius: 8px;
}

.workflow-node-preview video,
.workflow-node-preview audio {
    width: 100%;
    border: 1px solid rgba(130, 173, 213, 0.32);
    border-radius: 8px;
    background: #020617;
}

.workflow-port-out {
    right: -8px;
    top: 50%;
}

.workflow-port-in {
    left: -8px;
    top: 50%;
}

.workflow-port-in-prompt { top: 28%; }
.workflow-port-in-images { top: 44%; background: #34d399; }
.workflow-port-in-video { top: 60%; background: #ec4899; }
.workflow-port-in-audio { top: 76%; background: #38bdf8; }
.workflow-port-out-model { background: #fb923c; }

.workflow-credit-estimate {
    width: 100%;
    margin: 10px 0 8px;
    justify-content: center;
    padding: 0.22rem 0.56rem;
    font-size: 0.68rem;
    font-weight: 700;
    text-align: center;
    white-space: normal;
    line-height: 1.22;
    box-sizing: border-box;
}

.workflow-run-btn {
    width: 100%;
    min-height: 54px;
    margin-top: 0;
    border-radius: 16px;
    border: 1px solid rgba(255, 230, 148, 0.8);
    background: linear-gradient(135deg, #ffd666 0%, #f6a52f 52%, #ea8f1f 100%);
    color: #09111e;
    font-size: 1rem;
    font-weight: 800;
    letter-spacing: 0.01em;
    box-shadow: 0 16px 30px rgba(246, 165, 47, 0.3);
}

.workflow-run-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 18px 32px rgba(246, 165, 47, 0.36);
}

.workflow-run-btn:disabled {
    opacity: 0.72;
    transform: none;
    box-shadow: none;
}

.workflow-output-box {
    min-height: 150px;
    border: 1px solid rgba(130, 173, 213, 0.24);
    border-radius: 8px;
    background: #0f172a;
    color: #e2e8f0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    text-align: center;
    padding: 16px;
    font-size: 0.82rem;
}

.workflow-output-loader {
    width: 34px;
    height: 34px;
    border: 3px solid rgba(246, 165, 47, 0.22);
    border-top-color: #f6a52f;
    border-radius: 50%;
    animation: spin 0.85s linear infinite;
}

.workflow-output-progress {
    width: 100%;
    height: 8px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.1);
    overflow: hidden;
}

.workflow-output-progress span {
    display: block;
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, var(--accent), var(--accent-strong));
}

.workflow-output-video {
    width: 100%;
    max-height: 180px;
    border-radius: 8px;
    background: #000;
}

.workflow-template-modal {
    position: absolute;
    inset: 0;
    z-index: 60;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(3, 13, 25, 0.58);
}

.workflow-template-modal[hidden] {
    display: none;
}

.workflow-template-dialog {
    width: min(420px, calc(100% - 32px));
    border: 1px solid rgba(0, 212, 255, 0.32);
    border-radius: 12px;
    background: rgba(10, 35, 62, 0.98);
    box-shadow: 0 24px 54px rgba(0, 0, 0, 0.42);
    padding: 18px;
}

.workflow-template-dialog-wide {
    width: min(560px, calc(100% - 32px));
}

.workflow-template-dialog h4 {
    margin: 0 0 12px;
}

.workflow-template-hint {
    margin: 0 0 12px;
    color: var(--text-muted);
    font-size: 0.8rem;
    line-height: 1.45;
}

.workflow-prompt-persona-input {
    min-height: 112px;
    resize: vertical;
}

.workflow-template-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 14px;
}

.workflow-media-list {
    display: grid;
    gap: 8px;
    margin-top: 8px;
    color: var(--text-muted);
    font-size: 0.72rem;
}

.workflow-media-item {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: start;
    gap: 8px;
    padding: 6px 8px;
    border: 1px solid rgba(130, 173, 213, 0.2);
    border-radius: 7px;
    background: rgba(6, 22, 40, 0.28);
}

.workflow-media-item-main {
    display: grid;
    gap: 6px;
    min-width: 0;
}

.workflow-media-preview {
    width: 100%;
    max-height: 172px;
    border-radius: 8px;
    background: #020617;
}

.workflow-media-item-label {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.workflow-media-item-link {
    color: var(--accent);
    font-size: 0.68rem;
    text-decoration: none;
}

.workflow-media-item-link:hover {
    text-decoration: underline;
}

.editor-start-selection {
    padding-bottom: 8px;
}

.editor-start-grid {
    max-width: 900px;
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.editor-start-card {
    width: 100%;
    appearance: none;
    color: inherit;
    font-family: inherit;
}

.editor-start-card:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

.editor-media-order-modal {
    max-width: 720px;
}

.editor-media-order-description {
    margin: 0 0 16px;
    color: var(--text-muted);
}

.editor-media-order-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-height: min(52vh, 420px);
    overflow-y: auto;
}

.editor-media-order-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 14px;
    border-radius: 16px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.05), rgba(255, 255, 255, 0.025));
    transition: border-color 0.18s ease, background 0.18s ease, transform 0.18s ease, opacity 0.18s ease;
}

.editor-media-order-item.dragging {
    opacity: 0.45;
}

.editor-media-order-item.drag-over {
    border-color: rgba(var(--accent-rgb), 0.6);
    background: linear-gradient(180deg, rgba(var(--accent-rgb), 0.18), rgba(255, 255, 255, 0.03));
    transform: translateY(-1px);
}

.editor-media-order-item-main {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
}

.editor-media-order-preview {
    width: 70px;
    height: 70px;
    border-radius: 14px;
    overflow: hidden;
    flex: 0 0 70px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.editor-media-order-preview-media {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    background: #09131c;
}

.editor-media-order-index {
    width: 32px;
    height: 32px;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    color: var(--accent);
    background: rgba(var(--accent-rgb), 0.16);
    flex: 0 0 32px;
}

.editor-media-order-copy {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.editor-media-order-copy strong,
.editor-media-order-copy small {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.editor-media-order-copy small {
    color: var(--text-muted);
}

.editor-media-order-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.editor-media-order-move {
    appearance: none;
    border: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(255, 255, 255, 0.04);
    color: var(--text);
    border-radius: 12px;
    width: 38px;
    height: 38px;
    cursor: pointer;
    font: inherit;
    transition: border-color 0.18s ease, background 0.18s ease, transform 0.18s ease;
}

.editor-media-order-move:hover:not(:disabled) {
    border-color: rgba(var(--accent-rgb), 0.55);
    background: rgba(var(--accent-rgb), 0.14);
    transform: translateY(-1px);
}

.editor-media-order-move:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.editor-audio-source-modal {
    max-width: 760px;
}

.editor-audio-source-switch {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

.editor-audio-source-choice {
    appearance: none;
    width: 100%;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    border-radius: 18px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.055), rgba(255, 255, 255, 0.02));
    color: var(--text-muted);
    cursor: pointer;
    transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease, color 0.2s ease;
}

.editor-audio-source-choice:hover {
    transform: translateY(-1px);
    color: var(--text);
    border-color: rgba(var(--accent-rgb), 0.4);
}

.editor-audio-source-choice.active {
    color: var(--text);
    border-color: rgba(var(--accent-rgb), 0.72);
    background: linear-gradient(180deg, rgba(var(--accent-rgb), 0.22), rgba(255, 255, 255, 0.02));
    box-shadow: 0 14px 34px rgba(0, 0, 0, 0.22);
}

.editor-audio-source-choice-icon {
    flex: 0 0 44px;
    width: 44px;
    height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 14px;
    background: rgba(var(--accent-rgb), 0.14);
    color: var(--accent);
}

.editor-audio-source-choice-label {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    justify-content: center;
}

.editor-audio-source-panel {
    margin-top: 16px;
    display: grid;
    gap: 14px;
}

.editor-audio-source-local-card {
    width: 100%;
    min-height: 220px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 14px;
    border-radius: 22px;
    border: 1px dashed rgba(var(--accent-rgb), 0.46);
    background: radial-gradient(circle at top, rgba(var(--accent-rgb), 0.2), rgba(255, 255, 255, 0.02) 62%);
    color: var(--text);
    cursor: pointer;
    transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.editor-audio-source-local-card:hover {
    transform: translateY(-1px);
    border-color: rgba(var(--accent-rgb), 0.82);
    box-shadow: 0 18px 42px rgba(0, 0, 0, 0.2);
}

.editor-audio-source-local-card svg {
    color: var(--accent);
}

.editor-audio-source-link-shell {
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 62px;
    padding: 0 16px;
    border-radius: 18px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(6, 17, 34, 0.82);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.editor-audio-source-link-shell svg {
    flex: 0 0 auto;
    color: var(--accent);
}

.editor-audio-source-link-shell .input {
    min-height: 62px;
    padding: 0;
    border: 0;
    background: transparent;
    box-shadow: none;
}

.editor-audio-source-link-shell .input:focus {
    box-shadow: none;
}

.editor-audio-video-preview-host {
    min-height: 220px;
}

.editor-audio-video-preview-card {
    padding: 12px;
    border-radius: 20px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(255, 255, 255, 0.03);
}

.editor-audio-video-preview-card .workflow-media-preview {
    min-height: 240px;
    object-fit: cover;
}

.editor-audio-video-preview-empty {
    min-height: 220px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    border-radius: 20px;
    border: 1px dashed rgba(var(--accent-rgb), 0.36);
    background: linear-gradient(180deg, rgba(var(--accent-rgb), 0.15), rgba(255, 255, 255, 0.02));
    color: var(--text-muted);
}

.editor-audio-video-modal-status {
    margin: 8px 2px 0;
    color: var(--text-muted);
    font-size: 0.92rem;
}

.editor-audio-video-modal-status.error {
    color: #fda4af;
}

.editor-recorder-modal {
    max-width: 980px;
}

.editor-recorder-layout {
    display: grid;
    grid-template-columns: minmax(280px, 340px) minmax(0, 1fr);
    gap: 18px;
    align-items: stretch;
}

.editor-recorder-side {
    display: grid;
    gap: 14px;
}

.editor-recorder-modes {
    display: grid;
    gap: 12px;
}

.editor-recorder-mode {
    appearance: none;
    width: 100%;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px;
    border-radius: 18px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.055), rgba(255, 255, 255, 0.02));
    color: var(--text-muted);
    cursor: pointer;
    text-align: left;
    transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease, color 0.2s ease, background 0.2s ease;
}

.editor-recorder-mode:hover {
    transform: translateY(-1px);
    color: var(--text);
    border-color: rgba(var(--accent-rgb), 0.42);
}

.editor-recorder-mode.active {
    color: var(--text);
    border-color: rgba(var(--accent-rgb), 0.76);
    background: linear-gradient(180deg, rgba(var(--accent-rgb), 0.22), rgba(255, 255, 255, 0.03));
    box-shadow: 0 16px 36px rgba(0, 0, 0, 0.22);
}

.editor-recorder-mode-icon {
    flex: 0 0 48px;
    width: 48px;
    height: 48px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 16px;
    background: rgba(var(--accent-rgb), 0.14);
    color: var(--accent);
}

.editor-recorder-mode-copy {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.editor-recorder-tools {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.editor-recorder-chip {
    appearance: none;
    min-height: 42px;
    padding: 0 16px;
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(255, 255, 255, 0.03);
    color: var(--text-muted);
    cursor: pointer;
    transition: border-color 0.2s ease, background 0.2s ease, color 0.2s ease, transform 0.2s ease;
}

.editor-recorder-chip:hover {
    transform: translateY(-1px);
    border-color: rgba(var(--accent-rgb), 0.4);
    color: var(--text);
}

.editor-recorder-chip.active {
    border-color: rgba(var(--accent-rgb), 0.72);
    background: rgba(var(--accent-rgb), 0.18);
    color: var(--text);
}

.editor-recorder-chip:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.editor-recorder-preview-shell {
    position: relative;
    min-height: 380px;
    border-radius: 24px;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: radial-gradient(circle at top, rgba(var(--accent-rgb), 0.12), rgba(4, 17, 34, 0.96) 62%);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.editor-recorder-preview {
    width: 100%;
    height: 100%;
    min-height: 380px;
    display: block;
    object-fit: cover;
    background: #050d18;
}

.editor-recorder-preview-empty {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 28px;
    text-align: center;
    color: var(--text-muted);
}

.editor-recorder-preview-empty strong {
    color: var(--text);
    font-size: 1.1rem;
}

.editor-recorder-preview-empty-icon {
    width: 64px;
    height: 64px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 20px;
    background: rgba(var(--accent-rgb), 0.14);
    color: var(--accent);
}

.editor-recorder-timer {
    position: absolute;
    top: 16px;
    right: 16px;
    min-width: 78px;
    height: 38px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 14px;
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(6, 17, 34, 0.88);
    color: var(--text);
    font-weight: 700;
    letter-spacing: 0.04em;
    box-shadow: 0 10px 22px rgba(0, 0, 0, 0.22);
}

.editor-recorder-status {
    margin: 0;
    min-height: 22px;
    color: var(--text-muted);
    font-size: 0.94rem;
    line-height: 1.45;
}

.editor-recorder-status.error {
    color: #fda4af;
}

@media (max-width: 720px) {
    .editor-audio-source-switch {
        grid-template-columns: 1fr;
    }

    .editor-audio-source-local-card,
    .editor-audio-video-preview-empty {
        min-height: 180px;
    }

    .editor-audio-video-preview-card .workflow-media-preview {
        min-height: 180px;
    }

    .editor-recorder-layout {
        grid-template-columns: 1fr;
    }

    .editor-recorder-preview-shell,
    .editor-recorder-preview {
        min-height: 260px;
    }
}

.similar-panel-head {
    margin-bottom: 14px;
}

.similar-source-grid {
    max-width: 860px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: 1fr;
    gap: 14px;
    align-items: start;
}

.similar-source-link-group,
.similar-source-upload-group,
.similar-details-grid {
    width: 100%;
}

.similar-source-upload-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
    align-items: flex-start;
}

.similar-source-upload-group .similar-upload-card {
    max-width: 120px;
}

.similar-source-link-group .input,
.similar-details-grid .input {
    min-height: 54px;
}

.similar-upload-card {
    width: 120px;
    min-height: 120px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0;
    padding: 12px;
    border: 1px dashed rgba(var(--accent-rgb), 0.45);
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.025);
    color: var(--text);
    text-align: center;
    cursor: pointer;
    transition: border-color 0.2s ease, background 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
}

.similar-upload-card:hover,
.similar-upload-card.has-file {
    border-color: rgba(var(--accent-rgb), 0.8);
    background: rgba(var(--accent-rgb), 0.09);
    box-shadow: 0 10px 26px rgba(0, 0, 0, 0.14);
}

.similar-upload-card:active {
    transform: translateY(1px);
}

.similar-upload-card-icon {
    flex: 0 0 56px;
    width: 56px;
    height: 56px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 16px;
    background: rgba(var(--accent-rgb), 0.14);
    color: var(--accent);
}

.similar-upload-meta-row {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    flex-wrap: wrap;
    gap: 10px;
    max-width: 420px;
}

.similar-upload-loaded-copy {
    display: block;
    color: var(--text-muted);
    font-size: 0.95rem;
    line-height: 1.45;
    word-break: break-word;
}

.similar-panel-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 10px;
    margin-top: 16px;
    margin-bottom: 10px;
    width: 100%;
    max-width: 860px;
    margin-left: auto;
    margin-right: auto;
}

.similar-panel-actions > .btn-secondary {
    margin-right: auto;
}

.similar-panel-actions-right {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 10px;
}

.similar-analysis-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 10px;
}

.similar-analysis-action {
    display: grid;
    gap: 6px;
    min-width: 220px;
}

.similar-analysis-action .btn {
    width: 100%;
}

.similar-analysis-estimate {
    min-height: 36px;
    justify-content: center;
    text-align: center;
    padding-inline: 12px;
}

.similar-unified-trigger {
    display: inline-flex;
    align-items: center;
    gap: 10px;
}

.similar-a-plus-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    border-radius: 999px;
    border: 1px solid rgba(255, 167, 38, 0.42);
    background: rgba(255, 167, 38, 0.14);
    color: var(--accent);
    font-weight: 700;
    letter-spacing: 0.03em;
}

.similar-source-preview {
    max-width: 720px;
    margin: 12px auto 0;
    padding: 10px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.02);
}

.similar-source-preview-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 8px;
    color: var(--text);
}

.similar-source-open-link {
    font-size: 0.78rem;
    color: var(--accent);
    text-decoration: none;
}

.similar-source-open-link:hover {
    text-decoration: underline;
}

.similar-source-preview-stage {
    width: 100%;
    min-height: 180px;
    max-height: min(72vh, 720px);
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    overflow: hidden;
    border: 1px solid var(--border);
    background: rgba(0, 0, 0, 0.28);
}

.similar-source-preview-stage video {
    width: auto;
    height: auto;
    max-width: 100%;
    max-height: min(72vh, 720px);
    border: 0;
    display: block;
    object-fit: contain;
}

.similar-source-preview-stage iframe {
    width: 100%;
    min-height: 180px;
    aspect-ratio: 16 / 9;
    border: 0;
    display: block;
}

.similar-unified-reference-frame-wrap {
    margin-top: 14px;
}

@media (max-width: 640px) {
    .similar-source-grid {
        grid-template-columns: 1fr;
    }

    .similar-source-upload-group .similar-upload-card {
        max-width: 120px;
    }

    .similar-panel-actions {
        justify-content: flex-end;
    }

    .similar-panel-actions-right {
        width: 100%;
    }

    .similar-analysis-actions,
    .similar-analysis-action {
        width: 100%;
    }

    .similar-panel-actions-right .btn {
        width: 100%;
    }

    .similar-source-preview-stage {
        min-height: 150px;
        max-height: 56vh;
    }

    .similar-source-preview-stage video {
        max-height: 56vh;
    }

    .similar-unified-reference-frame-wrap {
        margin-top: 12px;
    }

    .similar-source-preview-head {
        flex-direction: column;
        align-items: flex-start;
    }

    .similar-upload-card {
        min-height: 116px;
        padding: 14px;
    }

    .similar-upload-meta-row {
        flex-direction: column;
        align-items: flex-start;
    }
}

.similar-status {
    margin-top: 14px;
    margin-bottom: 12px;
    padding: 12px 14px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.03);
    color: var(--text-muted);
    text-align: left;
}

.similar-status.status-running {
    border-color: rgba(255, 167, 38, 0.55);
    background: rgba(255, 167, 38, 0.12);
    color: var(--text);
}

.similar-status.status-error {
    border-color: rgba(239, 68, 68, 0.5);
    background: rgba(239, 68, 68, 0.1);
    color: #fca5a5;
}

.similar-status.status-success {
    border-color: rgba(34, 197, 94, 0.55);
    background: rgba(34, 197, 94, 0.14);
    color: #86efac;
}

.similar-unified-prompt {
    margin-top: 14px;
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 14px;
    background: rgba(255, 255, 255, 0.02);
    max-width: 960px;
    margin-left: auto;
    margin-right: auto;
}

.similar-unified-prompt-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 12px;
}

.similar-unified-prompt-head strong {
    color: var(--text);
}

.similar-unified-prompt-meta {
    margin: 6px 0 0;
    color: var(--text-muted);
    font-size: 0.82rem;
    line-height: 1.45;
}

.similar-unified-prompt-actions {
    display: flex;
    gap: 10px;
}

.similar-unified-prompt-text {
    min-height: 210px;
    resize: vertical;
    font-size: 0.95rem;
    line-height: 1.55;
}

.similar-unified-generation {
    margin-top: 14px;
    padding-top: 14px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.similar-unified-toolbar {
    display: grid;
    grid-template-columns: minmax(0, 1.6fr) minmax(220px, 0.9fr);
    gap: 14px;
    align-items: start;
}

.similar-unified-toolbar-block {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.similar-unified-engine-picker {
    margin-top: 0;
}

.similar-unified-duration-options {
    justify-content: flex-start;
}

.similar-unified-generation-actions {
    display: flex;
    justify-content: flex-end;
    margin-top: 14px;
}

.similar-upload-card-mini {
    width: 92px;
    min-width: 92px;
    min-height: 92px;
    padding: 10px;
    border-radius: 12px;
}

.similar-upload-card-mini .similar-upload-card-icon {
    width: 46px;
    height: 46px;
    border-radius: 14px;
}

.similar-unified-upload-section {
    margin-top: 14px;
    padding-top: 14px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.similar-unified-upload-head {
    margin-bottom: 8px;
}

.similar-unified-upload-controls {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.similar-unified-upload-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.similar-unified-upload-actions .field-hint {
    min-width: min(100%, 320px);
}

.similar-unified-upload-status {
    margin-top: 12px;
    margin-bottom: 0;
}

.similar-unified-last-frame-group {
    margin-top: 12px;
    padding: 10px 12px;
    border: 1px solid rgba(var(--accent-rgb), 0.18);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.02);
}

.similar-unified-last-frame-toggle {
    color: var(--text) !important;
}

.similar-unified-last-frame-toggle input {
    accent-color: var(--accent);
}

.similar-unified-last-frame-group .pause-hint {
    display: block;
    margin-top: 8px;
}

.similar-unified-preview {
    margin-top: 14px;
}

.similar-unified-preview-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 10px;
}

.similar-unified-preview-head strong {
    color: var(--text);
}

#similar-unified-preview-stage {
    display: block;
}

.similar-scenes-container {
    margin-top: 14px;
    max-width: 960px;
    margin-left: auto;
    margin-right: auto;
}

.similar-scenes-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 12px;
}

.similar-generation-step {
    margin-top: 14px;
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 12px;
    background: rgba(255, 255, 255, 0.02);
    max-width: 960px;
    margin-left: auto;
    margin-right: auto;
}

.similar-generation-head h4 {
    margin: 0;
    color: var(--text);
}

.similar-detected-profile {
    margin: 6px 0 0;
    color: var(--text-muted);
    font-size: 0.82rem;
}

#similar-engine-options {
    margin-top: 10px;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
}

#similar-engine-options .engine-option {
    width: 100%;
    min-width: 0;
}

.similar-generation-actions {
    margin-top: 12px;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.similar-scenes-list {
    display: grid;
    gap: 12px;
}

.similar-scene-card {
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 12px;
    background: rgba(255, 255, 255, 0.02);
}

.similar-scene-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 8px;
    color: var(--text);
}

.similar-scene-time {
    color: var(--text-muted);
    font-size: 0.82rem;
}

.similar-reference-frame-panel {
    margin-bottom: 14px;
    border: 1px solid rgba(255, 193, 77, 0.22);
    border-radius: 20px;
    padding: 14px;
    background: linear-gradient(160deg, rgba(8, 16, 30, 0.94), rgba(255, 193, 77, 0.08));
    box-shadow: 0 18px 34px rgba(4, 10, 22, 0.28);
    overflow: hidden;
}

.similar-reference-frame-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 14px;
}

.similar-reference-frame-head strong {
    display: block;
    color: var(--text);
    font-size: 0.95rem;
    letter-spacing: 0.02em;
}

.similar-reference-frame-head span {
    display: block;
    margin-top: 4px;
    color: var(--text-muted);
    font-size: 0.82rem;
    line-height: 1.45;
}

.similar-reference-frame-body {
    display: flex;
    justify-content: stretch;
    width: 100%;
}

.similar-reference-frame-gallery {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(146px, 1fr));
    gap: 12px;
    width: 100%;
}

.similar-reference-frame-gallery-single {
    grid-template-columns: minmax(0, 1fr);
    max-width: 360px;
}

.similar-frame-gallery-item {
    position: relative;
}

.similar-frame-gallery-box {
    position: relative;
    overflow: hidden;
    border-radius: 18px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    background: radial-gradient(circle at top left, rgba(255, 193, 77, 0.12), rgba(9, 16, 31, 0.88) 62%);
    box-shadow: 0 16px 34px rgba(4, 10, 22, 0.24);
    transition: transform 0.22s ease, border-color 0.22s ease, box-shadow 0.22s ease;
}

.similar-frame-gallery-box::before {
    content: "";
    position: absolute;
    top: -18%;
    left: -20%;
    width: 72%;
    height: 72%;
    border-radius: 999px;
    background: radial-gradient(circle, rgba(255, 193, 77, 0.24), rgba(255, 193, 77, 0));
    opacity: 0.55;
    transition: transform 0.24s ease, opacity 0.24s ease;
    z-index: 0;
}

.similar-frame-gallery-box::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, rgba(4, 12, 24, 0.05), rgba(4, 12, 24, 0.48));
    pointer-events: none;
    z-index: 1;
}

.similar-frame-gallery-item:hover .similar-frame-gallery-box {
    transform: translateY(-3px) scale(1.01);
    border-color: rgba(255, 193, 77, 0.4);
    box-shadow: 0 22px 42px rgba(4, 10, 22, 0.34);
}

.similar-frame-gallery-item:hover .similar-frame-gallery-box::before,
.similar-frame-gallery-item.is-active .similar-frame-gallery-box::before {
    transform: translate3d(14px, 14px, 0);
    opacity: 0.85;
}

.similar-frame-gallery-item.is-active .similar-frame-gallery-box {
    border-color: rgba(17, 201, 255, 0.58);
    box-shadow: 0 0 0 1px rgba(17, 201, 255, 0.2), 0 22px 42px rgba(7, 18, 36, 0.4);
}

.similar-frame-gallery-item.is-base .similar-frame-gallery-box {
    border-color: rgba(255, 255, 255, 0.16);
}

.similar-frame-gallery-box img {
    position: relative;
    z-index: 1;
}

.similar-frame-gallery-badge {
    position: absolute;
    top: 10px;
    left: 10px;
    z-index: 3;
    display: inline-flex;
    align-items: center;
    min-height: 30px;
    padding: 0 10px;
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    background: rgba(3, 10, 20, 0.74);
    color: #f8fbff;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    backdrop-filter: blur(12px);
}

.similar-frame-gallery-item.is-active .similar-frame-gallery-badge {
    border-color: rgba(17, 201, 255, 0.32);
    background: rgba(17, 201, 255, 0.16);
    color: #c7f5ff;
}

.similar-frame-image-action {
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 4;
    width: 38px;
    height: 38px;
    border-radius: 12px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #f8fbff;
    text-decoration: none;
    background: rgba(3, 10, 20, 0.74);
    border: 1px solid rgba(255, 255, 255, 0.12);
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.22);
    backdrop-filter: blur(12px);
    opacity: 0;
    transform: translateY(-6px);
    transition: opacity 0.2s ease, transform 0.2s ease, background 0.2s ease, border-color 0.2s ease;
}

.similar-frame-image-actions {
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 4;
    display: flex;
    gap: 8px;
    opacity: 0;
    transform: translateY(-6px);
    transition: opacity 0.2s ease, transform 0.2s ease;
}

.similar-frame-image-actions .similar-frame-image-action {
    position: static;
    top: auto;
    right: auto;
    opacity: 1;
    transform: none;
}

.similar-frame-gallery-item:hover .similar-frame-image-action,
.similar-frame-gallery-item.is-active .similar-frame-image-action,
.similar-frame-gallery-box:focus-within .similar-frame-image-action {
    opacity: 1;
    transform: translateY(0);
}

.similar-frame-gallery-item:hover .similar-frame-image-actions,
.similar-frame-gallery-item.is-active .similar-frame-image-actions,
.similar-frame-gallery-box:focus-within .similar-frame-image-actions {
    opacity: 1;
    transform: translateY(0);
}

.similar-frame-image-action:hover {
    border-color: rgba(255, 193, 77, 0.36);
    background: rgba(255, 193, 77, 0.16);
}

.similar-reference-frame-tools {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
    justify-content: flex-end;
}

.similar-frame-tool-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 40px;
    padding: 0 14px;
    border-radius: 14px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    background: rgba(255, 255, 255, 0.06);
    color: var(--text);
    font-size: 0.82rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    text-decoration: none;
    cursor: pointer;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
    backdrop-filter: blur(12px);
    transition: transform 0.18s ease, border-color 0.18s ease, background 0.18s ease, box-shadow 0.18s ease, color 0.18s ease;
}

.similar-frame-tool-btn:hover {
    transform: translateY(-1px);
    border-color: rgba(255, 193, 77, 0.42);
    background: rgba(255, 193, 77, 0.12);
    box-shadow: 0 12px 26px rgba(6, 14, 28, 0.24);
}

.similar-frame-tool-btn-primary {
    border-color: rgba(255, 193, 77, 0.44);
    background: rgba(255, 193, 77, 0.16);
    color: #ffe7ae;
}

.similar-frame-tool-btn.is-active {
    border-color: rgba(17, 201, 255, 0.38);
    background: rgba(17, 201, 255, 0.12);
    color: #c7f5ff;
    box-shadow: 0 12px 26px rgba(7, 18, 36, 0.28);
}

.similar-frame-tool-btn-icon {
    width: 42px;
    min-width: 42px;
    padding: 0;
}

.similar-frame-tool-btn svg,
.similar-frame-image-action svg,
.similar-reference-frame-submit-btn svg {
    flex: 0 0 auto;
}

.similar-frame-tool-btn-icon svg {
    width: 18px;
    height: 18px;
}

.similar-reference-frame-editor {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.similar-reference-frame-narration-editor {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.similar-reference-frame-editor label {
    display: block;
    margin-bottom: 8px;
    color: var(--text);
    font-weight: 600;
}

.similar-reference-frame-narration-editor label {
    display: block;
    margin-bottom: 8px;
    color: var(--text);
    font-weight: 600;
}

.similar-reference-frame-editor-input {
    min-height: 108px;
    resize: vertical;
}

.similar-reference-frame-editor-tools {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
    margin-top: 10px;
}

.similar-reference-frame-upload-note {
    display: inline-flex;
    align-items: center;
    min-height: 40px;
    padding: 0 14px;
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-muted);
    font-size: 0.82rem;
    line-height: 1.4;
}

.similar-reference-frame-upload-list {
    margin-top: 12px;
}

.similar-reference-frame-upload-title {
    display: block;
    margin-bottom: 8px;
    color: var(--text);
    font-size: 0.82rem;
    font-weight: 600;
}

.similar-reference-frame-upload-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(96px, 1fr));
    gap: 8px;
}

.similar-reference-frame-progress {
    margin-top: 12px;
}

.similar-reference-frame-progress-label {
    display: block;
    margin-bottom: 8px;
    color: var(--text);
    font-size: 0.82rem;
    font-weight: 600;
}

.similar-reference-frame-progress-bar {
    position: relative;
    height: 8px;
    border-radius: 999px;
    overflow: hidden;
    background: rgba(255, 255, 255, 0.1);
}

.similar-reference-frame-progress-bar span {
    position: absolute;
    inset: 0 auto 0 -35%;
    width: 35%;
    border-radius: inherit;
    background: linear-gradient(90deg, rgba(255, 193, 77, 0), rgba(255, 193, 77, 0.85), rgba(17, 201, 255, 0.7));
    animation: similar-frame-progress-slide 1.25s ease-in-out infinite;
}

.similar-reference-frame-editor-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    margin-top: 10px;
}

.similar-reference-frame-submit-btn {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    flex: 0 0 auto;
    min-height: 42px;
    padding: 0 18px;
    border-radius: 14px;
    font-size: 0.95rem;
    box-shadow: 0 16px 30px rgba(255, 193, 77, 0.18);
}

@keyframes similar-frame-progress-slide {
    0% {
        left: -35%;
    }
    100% {
        left: 100%;
    }
}

.similar-scene-preview {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    margin-bottom: 10px;
    justify-items: center;
}

.similar-scene-preview-single {
    grid-template-columns: 1fr;
}

.similar-preview-box {
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 16px;
    min-height: 120px;
    background: linear-gradient(180deg, rgba(8, 16, 31, 0.94), rgba(5, 12, 24, 0.84));
    overflow: hidden;
    width: 100%;
    margin: 0 auto;
    box-shadow: 0 16px 30px rgba(4, 10, 22, 0.18);
}

.similar-preview-box-horizontal {
    max-width: 360px;
    aspect-ratio: 16 / 9;
}

.similar-preview-box-vertical {
    max-width: 250px;
    aspect-ratio: 9 / 16;
}

.similar-preview-box-square {
    max-width: 300px;
    aspect-ratio: 1 / 1;
}

.similar-preview-box img,
.similar-preview-box video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

@media (max-width: 820px) {
    .similar-reference-frame-head {
        flex-direction: column;
    }

    .similar-reference-frame-tools {
        width: 100%;
        justify-content: flex-start;
    }

    .similar-frame-tool-btn {
        flex: 1 1 0;
    }

    .similar-frame-tool-btn-icon {
        flex: 0 0 auto;
    }

    .similar-reference-frame-gallery,
    .similar-scene-preview {
        grid-template-columns: 1fr;
    }

    .similar-frame-image-action {
        opacity: 1;
        transform: translateY(0);
    }

    .similar-reference-frame-upload-note {
        width: 100%;
        min-height: 0;
        padding: 10px 14px;
        border-radius: 16px;
    }
}

.similar-preview-empty {
    min-height: 120px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    font-size: 0.78rem;
}

.similar-scene-prompt-input {
    min-height: 190px;
    resize: vertical;
    line-height: 1.5;
}

.similar-scene-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 10px;
}

.similar-scene-engine-picker {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 10px;
}

.similar-scene-engine-btn {
    min-width: 42px;
    height: 30px;
    border-radius: 999px;
    border: 1px solid rgba(125, 158, 189, 0.28);
    background: rgba(255, 255, 255, 0.03);
    color: var(--text-muted);
    padding: 0 10px;
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    cursor: pointer;
    transition: all 0.2s ease;
}

.similar-scene-engine-btn:hover {
    border-color: rgba(0, 212, 255, 0.36);
    color: var(--accent);
    background: rgba(0, 212, 255, 0.08);
}

.similar-scene-engine-btn.selected {
    border-color: rgba(255, 193, 79, 0.52);
    background: rgba(255, 193, 79, 0.14);
    color: #ffe2a1;
}

.similar-scene-action-btn {
    width: 42px;
    height: 42px;
    border-radius: 12px;
    border: 1px solid var(--border);
    background: rgba(255, 255, 255, 0.04);
    color: var(--text-muted);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
}

.similar-scene-action-btn svg {
    width: 18px;
    height: 18px;
}

.similar-scene-action-btn:hover:not(:disabled) {
    border-color: rgba(0, 212, 255, 0.4);
    color: var(--accent);
    background: rgba(0, 212, 255, 0.08);
}

.similar-scene-action-btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.similar-scene-action-btn-primary {
    border-color: rgba(255, 193, 79, 0.45);
    color: #ffd480;
    background: rgba(255, 193, 79, 0.12);
}

.similar-scene-action-btn-primary:hover:not(:disabled) {
    border-color: #ffc14f;
    color: #ffe4a8;
    background: rgba(255, 193, 79, 0.22);
}

.similar-scene-upload-panel {
    margin-top: 10px;
    border: 1px dashed var(--border);
    border-radius: 10px;
    padding: 8px;
    background: rgba(255, 255, 255, 0.01);
}

.similar-scene-upload-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 8px;
    color: var(--text-muted);
    font-size: 0.8rem;
}

.similar-upload-clear {
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 4px 8px;
    background: rgba(255, 255, 255, 0.03);
    color: var(--text-muted);
    font-size: 0.74rem;
    cursor: pointer;
}

.similar-upload-clear:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.similar-scene-upload-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(96px, 1fr));
    gap: 8px;
}

.similar-upload-thumb {
    margin: 0;
    border: 1px solid var(--border);
    border-radius: 8px;
    overflow: hidden;
    background: rgba(0, 0, 0, 0.22);
}

.similar-upload-thumb img {
    width: 100%;
    height: 78px;
    object-fit: cover;
    display: block;
}

.similar-upload-thumb figcaption {
    padding: 4px 6px;
    font-size: 0.68rem;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

@media (max-width: 480px) {
    .mode-selection-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .workflow-panel-head {
        flex-direction: column;
        align-items: stretch;
    }

    .workflow-head-actions {
        flex-direction: row;
        align-items: center;
        justify-content: flex-start;
    }

    .workflow-template-select {
        width: 100%;
        flex: 1 1 100%;
    }

    .workflow-shell {
        grid-template-columns: 1fr;
    }

    .workflow-palette {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .workflow-canvas-wrap {
        min-height: 540px;
    }

    .workflow-canvas {
        width: 1220px;
    }
    .mode-selection-card {
        padding: 20px 14px 16px;
    }

    .credit-add-btn {
        padding: 0.28rem 0.58rem;
        font-size: 0.66rem;
    }

    .similar-scenes-toolbar {
        flex-direction: column;
        align-items: stretch;
    }

    .similar-unified-prompt-head {
        flex-direction: column;
        align-items: stretch;
    }

    .similar-unified-toolbar {
        grid-template-columns: 1fr;
    }

    .similar-unified-upload-controls {
        align-items: flex-start;
    }

    .similar-unified-upload-actions {
        width: 100%;
    }

    .similar-unified-upload-actions .btn {
        width: 100%;
    }

    .similar-unified-preview-head {
        flex-direction: column;
        align-items: flex-start;
    }

    .similar-unified-prompt-actions {
        width: 100%;
    }

    .similar-unified-prompt-actions .btn {
        width: 100%;
    }

    .similar-unified-generation-actions .btn {
        width: 100%;
    }

    .similar-scenes-toolbar .btn {
        width: 100%;
    }

    #similar-engine-options {
        grid-template-columns: 1fr;
    }

    .similar-generation-actions {
        flex-direction: column;
    }

    .similar-generation-actions .btn {
        width: 100%;
    }

    .similar-scene-preview {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 900px) {
    .mode-selection-grid-create {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        max-width: 520px;
    }

    .editor-start-grid {
        grid-template-columns: 1fr;
        max-width: 520px;
    }
}

.video-type-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 8px;
    padding: 18px 12px 14px;
    background: var(--card);
    border: 2px solid var(--border);
    border-radius: 14px;
    cursor: pointer;
    transition: border-color 0.2s, box-shadow 0.2s, transform 0.15s;
}

.video-type-card:hover {
    border-color: var(--accent);
    box-shadow: 0 0 12px rgba(255, 167, 38, 0.15);
    transform: translateY(-2px);
}

.video-type-card.selected {
    border-color: var(--accent);
    box-shadow: 0 0 16px rgba(255, 167, 38, 0.25);
    background: linear-gradient(135deg, rgba(255, 167, 38, 0.08), rgba(255, 167, 38, 0.02));
}

.video-type-icon {
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.05);
}

.video-type-card.selected .video-type-icon {
    background: rgba(255, 167, 38, 0.12);
    color: var(--accent);
}

.video-type-icon svg {
    color: var(--text-muted);
    transition: color 0.2s;
}

.video-type-card.selected .video-type-icon svg {
    color: var(--accent);
}

.video-type-card strong {
    font-size: 0.9rem;
    color: var(--text);
    line-height: 1.3;
}

.video-type-card small {
    font-size: 0.72rem;
    color: var(--text-muted);
    line-height: 1.3;
}

/* Credit consumption badges */
.credit-badge {
    font-size: 0.68rem;
    font-weight: 600;
    padding: 3px 10px;
    border-radius: 20px;
    margin-top: 2px;
    letter-spacing: 0.02em;
}
.credit-regular {
    background: rgba(76, 175, 80, 0.15);
    color: #66bb6a;
}
.credit-moderate {
    background: rgba(255, 167, 38, 0.15);
    color: #ffa726;
}
.credit-high {
    background: rgba(239, 83, 80, 0.15);
    color: #ef5350;
}

@media (max-width: 480px) {
    .video-type-grid {
        grid-template-columns: 1fr;
        gap: 10px;
    }
    #wizard-video-type-grid,
    #modal-new-automation .auto-video-type-grid {
        grid-template-columns: 1fr;
        max-width: none;
    }
    .video-type-card {
        flex-direction: row;
        text-align: left;
        padding: 14px 16px;
        gap: 12px;
    }
    .video-type-icon {
        width: 42px;
        height: 42px;
        flex-shrink: 0;
    }
    .video-type-card strong,
    .video-type-card small {
        display: block;
    }
}

/* ═══ Realistic Video Panel (Seedance 2.0) ═══ */

.tab-badge-beta {
    font-size: 0.6rem;
    font-weight: 700;
    background: linear-gradient(135deg, #ff6b35, #f7931e);
    color: #fff;
    padding: 1px 5px;
    border-radius: 6px;
    margin-left: 4px;
    vertical-align: top;
    letter-spacing: 0.5px;
}

.realistic-info-banner {
    display: flex;
    align-items: center;
    gap: 10px;
    background: rgba(0, 212, 255, 0.08);
    border: 1px solid rgba(0, 212, 255, 0.2);
    border-radius: 12px;
    padding: 12px 16px;
    margin-bottom: 20px;
    font-size: 0.85rem;
    color: var(--text-muted);
    line-height: 1.4;
}

.realistic-info-banner svg {
    flex-shrink: 0;
    color: var(--tech-neon);
}

.realistic-prompt-area {
    min-height: 120px;
    resize: vertical;
    font-size: 0.95rem;
    line-height: 1.5;
}

.realistic-char-count {
    text-align: right;
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 4px;
}

.realistic-inspiration {
    margin-top: 16px;
}

.realistic-inspiration-label {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-bottom: 8px;
    display: block;
}

.realistic-inspiration-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.realistic-inspiration-tags .style-tag {
    font-size: 0.8rem;
    padding: 6px 12px;
}

.realistic-audio-toggle {
    margin-top: 8px;
}

.realistic-audio-toggle .toggle-label {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    font-size: 0.9rem;
    color: var(--text);
}

.realistic-audio-toggle .toggle-label input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--accent);
}

.realistic-persona-preview {
    margin-top: 10px;
}

.realistic-persona-card {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.03);
}

.realistic-persona-thumb {
    width: 52px;
    height: 52px;
    border-radius: 10px;
    object-fit: cover;
    border: 1px solid rgba(255, 255, 255, 0.14);
    background: rgba(255, 255, 255, 0.04);
}

.realistic-persona-meta {
    display: flex;
    flex-direction: column;
    min-width: 0;
    gap: 3px;
}

.realistic-persona-name {
    font-size: 0.86rem;
    font-weight: 600;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.realistic-persona-sub {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.realistic-persona-empty {
    font-size: 0.78rem;
    color: var(--text-muted);
    padding: 8px 2px;
}

.realistic-persona-picker-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 8px;
}

.realistic-persona-picker-label {
    font-size: 0.76rem;
    color: var(--text-muted);
}

.realistic-persona-picker-count {
    font-size: 0.76rem;
    color: var(--accent);
    font-weight: 600;
}

.auto-realistic-persona-head {
    margin-top: 10px;
}

.auto-realistic-persona-summary {
    margin-bottom: 10px;
}

.realistic-persona-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.realistic-persona-option {
    width: 58px;
    height: 58px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.03);
    cursor: pointer;
    overflow: hidden;
    transition: border-color 0.2s, box-shadow 0.2s, background 0.2s;
}

.realistic-persona-option:hover {
    border-color: rgba(0, 212, 255, 0.42);
    box-shadow: 0 0 10px rgba(0, 212, 255, 0.12);
}

.realistic-persona-option.selected {
    border-color: var(--accent);
    background: linear-gradient(130deg, rgba(var(--accent-rgb), 0.16), rgba(var(--accent-strong-rgb), 0.12));
    box-shadow: 0 0 0 1px rgba(var(--accent-rgb), 0.28);
}

.realistic-persona-option .realistic-persona-thumb {
    width: 100%;
    height: 100%;
    border: 0;
    border-radius: 10px;
}

.realistic-persona-option-none {
    background: linear-gradient(140deg, rgba(255, 255, 255, 0.03), rgba(255, 255, 255, 0.01));
}

.realistic-persona-none-label {
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.01em;
    color: var(--text-muted);
    text-transform: uppercase;
}

.realistic-persona-option-none.selected .realistic-persona-none-label {
    color: var(--text);
}

.realistic-persona-actions {
    margin-top: 8px;
    display: flex;
    justify-content: flex-start;
    align-items: center;
    gap: 8px;
}

.realistic-persona-gear {
    width: 34px;
    height: 34px;
    padding: 0;
}

.btn-back-icon {
    width: 34px;
    height: 34px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

/* Clean UI mode: remove explanatory helper copy across pages */
.wizard-hint,
.pause-hint,
.field-hint,
.suno-voice-hint,
.realistic-inspiration-label,
.section-subtitle,
#auto-step3-desc,
.auto-type-card .muted {
    display: none !important;
}

#modal-publish-schedule .modal-body > .muted,
#modal-clip-selector .form-group > .muted,
#modal-auto-subtitle .modal-header .muted,
#modal-auto-subtitle .auto-subtitle-modal-note {
    display: none !important;
}

.persona-manager-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 10px;
}

.persona-manager-empty {
    grid-column: 1 / -1;
    margin: 0;
    padding: 1rem 1.1rem;
    border-radius: 16px;
    border: 1px dashed rgba(0, 212, 255, 0.18);
    background: rgba(7, 23, 39, 0.58);
    color: var(--text-muted);
    text-align: center;
}

.persona-manager-header-main {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    min-width: 0;
}

.persona-manager-header-main h3 {
    margin: 0;
}

.persona-manager-add-btn {
    min-width: 40px;
    width: 40px;
    height: 40px;
    padding: 0;
    border-radius: 12px;
    font-size: 1.6rem;
    line-height: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 10px 22px rgba(var(--accent-rgb), 0.26), 0 0 0 1px rgba(var(--accent-strong-rgb), 0.2);
}

.persona-manager-add-btn:hover {
    box-shadow: 0 14px 28px rgba(var(--accent-rgb), 0.32), 0 0 14px rgba(var(--accent-rgb), 0.24);
}

.persona-manager-card {
    border: 1px solid var(--border);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.03);
    overflow: hidden;
    cursor: pointer;
}

.persona-manager-card.selected {
    border-color: var(--accent);
    box-shadow: 0 0 0 1px rgba(246, 165, 47, 0.3);
}

.persona-manager-photo-wrap {
    position: relative;
}

.persona-manager-photo {
    width: 100%;
    height: 170px;
    object-fit: contain;
    object-position: center;
    display: block;
    background: rgba(255, 255, 255, 0.05);
}

.persona-manager-photo-expand {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 34px;
    min-width: 34px;
    height: 34px;
    padding: 0;
    border-radius: 10px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.persona-manager-photo-expand svg {
    width: 16px;
    height: 16px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.persona-manager-info {
    padding: 10px;
}

.persona-manager-name {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 4px;
}

.persona-manager-meta {
    font-size: 0.73rem;
    color: var(--text-muted);
}

.persona-manager-voice-row {
    display: flex;
    gap: 8px;
    padding: 0 10px 10px;
    align-items: center;
}

.persona-manager-voice-select {
    flex: 1;
    height: 34px;
    font-size: 0.8rem;
    padding: 6px 10px;
}

.persona-manager-voice-play {
    width: 38px;
    min-width: 38px;
    height: 34px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.persona-manager-voice-play.disabled,
.persona-manager-voice-play:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.persona-manager-voice-link-row {
    padding: 0 10px 10px;
}

.persona-manager-voice-link {
    width: 100%;
}

.persona-manager-actions {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 6px;
    padding: 0 10px 10px;
}

.persona-manager-actions .btn {
    flex: 0 0 auto;
}

.persona-manager-action-icon {
    width: 36px;
    min-width: 36px;
    height: 34px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.persona-manager-action-icon svg {
    width: 16px;
    height: 16px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.persona-manager-action-danger {
    border-color: rgba(239, 68, 68, 0.45);
}

.persona-manager-action-danger:hover {
    background: rgba(239, 68, 68, 0.12);
}

.persona-manager-divider {
    height: 1px;
    background: var(--border);
    margin: 14px 0;
}

.persona-manager-modal .modal-body {
    display: grid;
    gap: 1rem;
}

.persona-manager-create-modal {
    width: min(calc(100% - 1rem), 900px);
}

.persona-manager-create-modal .modal-body {
    display: grid;
}

.persona-manager-create-shell {
    display: grid;
    gap: 1rem;
    padding: 1.15rem;
    border-radius: 22px;
    border: 1px solid rgba(0, 212, 255, 0.18);
    background: linear-gradient(180deg, rgba(16, 42, 68, 0.94), rgba(11, 31, 51, 0.82));
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.03);
}

.persona-manager-create-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.8rem;
    flex-wrap: wrap;
}

.persona-manager-create-kicker {
    display: inline-flex;
    align-items: center;
    padding: 0.35rem 0.72rem;
    border-radius: 999px;
    border: 1px solid rgba(247, 197, 98, 0.3);
    background: rgba(247, 197, 98, 0.12);
    color: #ffe1ab;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.persona-manager-create-header h4 {
    margin: 0;
    font-family: "Outfit", sans-serif;
    font-size: 1.08rem;
    letter-spacing: -0.02em;
}

.persona-manager-create-grid {
    display: grid;
    grid-template-columns: repeat(12, minmax(0, 1fr));
    gap: 0.8rem;
    align-items: start;
}

.persona-manager-create-grid .form-group {
    margin-bottom: 0;
}

.persona-manager-human-fields {
    display: contents;
}

.persona-manager-field-name {
    grid-column: span 4;
}

.persona-manager-field-age {
    grid-column: span 3;
}

.persona-manager-field-skin {
    grid-column: span 5;
}

.persona-manager-field-hair {
    grid-column: span 4;
}

.persona-manager-field-description {
    grid-column: span 5;
}

.persona-manager-field-voice {
    grid-column: span 3;
}

.persona-manager-field-inline {
    grid-column: span 6;
}

.persona-manager-field-reference {
    grid-column: 1 / -1;
}

.persona-manager-create-shell label {
    margin-bottom: 0.42rem;
    font-size: 0.83rem;
    font-weight: 600;
    color: #dce9f6;
}

.persona-manager-create-shell .input {
    min-height: 48px;
    border-radius: 14px;
    background: rgba(6, 23, 39, 0.82);
}

.persona-manager-create-shell textarea.input {
    min-height: 132px;
    resize: vertical;
}

.persona-manager-field-voice .persona-manager-voice-create-row {
    align-items: stretch;
}

.persona-manager-field-voice .persona-manager-voice-create-row .input {
    min-width: 0;
}

.persona-manager-field-voice .persona-manager-voice-play {
    width: 44px;
    min-width: 44px;
    height: 48px;
    border-radius: 14px;
}

.persona-manager-create-shell .persona-reference-upload {
    padding: 0.75rem 0.85rem;
    border-radius: 16px;
    border: 1px dashed rgba(0, 212, 255, 0.18);
    background: rgba(6, 23, 39, 0.42);
}

.persona-reference-upload {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.persona-manager-voice-create-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.persona-manager-voice-create-row .input {
    flex: 1;
}

.persona-voice-builder-body .form-group {
    margin-bottom: 10px;
}

.persona-prompt-editor-body .form-group {
    margin-bottom: 10px;
}

.persona-image-viewer-content {
    width: min(96vw, 1200px);
}

.persona-image-viewer-body {
    display: flex;
    align-items: center;
    justify-content: center;
    max-height: 80vh;
    overflow: auto;
}

.persona-image-viewer-img {
    max-width: 100%;
    max-height: 76vh;
    width: auto;
    height: auto;
    object-fit: contain;
    border-radius: 12px;
    border: 1px solid var(--border);
    background: rgba(255, 255, 255, 0.03);
}

.grok-anchor-preview-content {
    width: min(96vw, 1180px);
}

.grok-anchor-preview-body {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.grok-anchor-preview-frame {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 240px;
    max-height: 76vh;
    overflow: auto;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.02);
    padding: 8px;
}

.grok-anchor-preview-img {
    max-width: 100%;
    max-height: 72vh;
    width: auto;
    height: auto;
    object-fit: contain;
    border-radius: 10px;
}

.persona-voice-builder-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.persona-voice-builder-tags .btn {
    border-radius: 999px;
    padding: 5px 10px;
}

.persona-reference-preview {
    width: 58px;
    height: 58px;
    border-radius: 10px;
    object-fit: cover;
    border: 1px solid var(--border);
    background: rgba(255, 255, 255, 0.04);
}

.realistic-step {
    animation: fadeIn 0.3s ease;
}

@media (max-width: 900px) {
    .persona-manager-create-grid {
        grid-template-columns: repeat(6, minmax(0, 1fr));
    }

    .persona-manager-field-name,
    .persona-manager-field-description,
    .persona-manager-field-inline,
    .persona-manager-field-reference {
        grid-column: 1 / -1;
    }

    .persona-manager-field-age,
    .persona-manager-field-skin,
    .persona-manager-field-hair,
    .persona-manager-field-voice {
        grid-column: span 3;
    }
}

@media (max-width: 680px) {
    .persona-manager-header-main {
        gap: 0.7rem;
    }

    .persona-manager-add-btn {
        min-width: 36px;
        width: 36px;
        height: 36px;
        font-size: 1.35rem;
    }

    .persona-manager-create-shell {
        padding: 0.95rem;
    }

    .persona-manager-create-grid {
        grid-template-columns: 1fr;
    }

    .persona-manager-field-name,
    .persona-manager-field-age,
    .persona-manager-field-skin,
    .persona-manager-field-hair,
    .persona-manager-field-description,
    .persona-manager-field-voice,
    .persona-manager-field-inline,
    .persona-manager-field-reference {
        grid-column: 1 / -1;
    }
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ══════════════════════════════════════════════════════════════
   VIDEO EDITOR — CapCut-style editing workspace
   ══════════════════════════════════════════════════════════════ */

/* When the editor page is active, strip main-content padding and lock overflow
   so that timeline zoom never shifts the top area. */
#page-editor {
    overflow: hidden;
    max-width: 100%;
}
#page-editor:has(.editor-workspace:not([hidden])),
#page-editor.editor-fullscreen {
    margin: -24px -32px;
    padding: 0;
    width: calc(100% + 64px);
    max-height: 100vh;
    max-height: 100dvh;
}

/* ── Editor workspace layout ── */
.editor-workspace {
    display: flex;
    flex-direction: column;
    height: 100vh;
    max-height: 100dvh;
    width: 100%;
    min-width: 0;
    max-width: 100%;
    overflow: hidden;
    background: var(--bg);
    position: relative;
}

.editor-topbar {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 16px;
    background: linear-gradient(185deg, rgba(23, 58, 94, 0.85), rgba(10, 31, 51, 0.92));
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
    min-height: 48px;
    max-width: 100%;
    overflow-x: hidden;
}

.editor-back-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 4px;
    border-radius: 6px;
    transition: background 0.2s, color 0.2s;
    display: flex;
    align-items: center;
}
.editor-back-btn:hover { background: rgba(255,255,255,0.08); color: var(--text); }

.editor-project-name {
    font-weight: 600;
    font-size: 14px;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1;
    cursor: text;
    border-radius: 8px;
    padding: 6px 8px;
    transition: background 0.18s ease, box-shadow 0.18s ease;
}

.editor-project-name:hover {
    background: rgba(255,255,255,0.05);
}

.editor-project-name.editing {
    background: rgba(255,255,255,0.08);
    box-shadow: inset 0 0 0 1px rgba(0, 212, 255, 0.45);
    outline: none;
}

.editor-topbar-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

/* ── Main editor area (tools + preview + props) ── */
.editor-main {
    display: flex;
    flex: 1;
    width: 100%;
    min-width: 0;
    min-height: 0;
    overflow: hidden;
    max-width: 100%;
}

/* Left tools panel */
.editor-tools-panel {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 8px 4px;
    background: linear-gradient(185deg, rgba(15, 42, 70, 0.9), rgba(8, 25, 42, 0.95));
    border-right: 1px solid var(--border);
    width: 64px;
    flex-shrink: 0;
    overflow-y: auto;
}

.editor-tool-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    padding: 8px 4px;
    border: none;
    background: none;
    color: var(--text-muted);
    font-size: 9px;
    font-family: inherit;
    cursor: pointer;
    border-radius: 8px;
    transition: background 0.2s, color 0.2s;
}
.editor-tool-btn:hover { background: rgba(0, 212, 255, 0.08); color: var(--text); }
.editor-tool-btn.active {
    background: rgba(0, 212, 255, 0.15);
    color: var(--accent);
}
.editor-tool-btn svg { flex-shrink: 0; }

/* Preview area */
.editor-preview-area {
    flex: 1 1 0;
    width: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-width: 0;
    overflow: hidden;
    padding: 12px;
    gap: 8px;
    position: relative;
}

.editor-canvas-wrapper {
    position: relative;
    margin: 0 auto;
    max-width: 100%;
    max-height: calc(100% - 48px);
    aspect-ratio: var(--editor-aspect-ratio, 9 / 16);
    background: #000;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 8px 32px rgba(0,0,0,0.5);
}

.editor-canvas-wrapper video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

#editor-overlay-canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

#editor-media-layer-host {
    position: absolute;
    inset: 0;
    pointer-events: none;
}

#editor-media-layer-host > * {
    pointer-events: auto;
}

.editor-media-layer-item {
    position: absolute;
    overflow: hidden;
    border-radius: 8px;
    border: 1px solid transparent;
    background: rgba(5, 12, 20, 0.45);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.35);
    cursor: grab;
    touch-action: none;
    user-select: none;
}

.editor-media-layer-item:active {
    cursor: grabbing;
}

.editor-media-layer-item.selected {
    border-color: rgba(0, 212, 255, 0.8);
    box-shadow: 0 0 0 1px rgba(0, 212, 255, 0.35), 0 8px 24px rgba(0, 0, 0, 0.45);
}

.editor-media-layer-item video,
.editor-media-layer-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    pointer-events: none;
}

.editor-media-layer-handle {
    position: absolute;
    right: 4px;
    bottom: 4px;
    width: 14px;
    height: 14px;
    border-radius: 3px;
    border: 1px solid rgba(255, 255, 255, 0.7);
    background: linear-gradient(135deg, rgba(0, 212, 255, 0.92), rgba(18, 128, 220, 0.9));
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.35);
    cursor: nwse-resize;
}

.editor-layer-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
    max-height: 170px;
    overflow-y: auto;
    padding-right: 2px;
}

.editor-layer-list-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 8px 10px;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(255, 255, 255, 0.04);
    color: var(--text);
    font-size: 12px;
    cursor: pointer;
}

.editor-layer-list-item.active {
    border-color: rgba(0, 212, 255, 0.45);
    background: rgba(0, 212, 255, 0.12);
}

.editor-layer-library-overlay {
    position: fixed;
    inset: 0;
    z-index: 4000;
}

.editor-layer-library-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(3, 10, 20, 0.72);
    backdrop-filter: blur(4px);
}

.editor-layer-library-modal {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    width: min(900px, calc(100vw - 28px));
    max-height: calc(100vh - 48px);
    border-radius: 14px;
    border: 1px solid rgba(0, 212, 255, 0.26);
    background: linear-gradient(180deg, rgba(12, 34, 58, 0.98), rgba(5, 18, 34, 0.98));
    box-shadow: 0 28px 56px rgba(0, 0, 0, 0.5);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.editor-layer-library-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 14px 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.editor-layer-library-header h3 {
    margin: 0;
    font-size: 16px;
    color: var(--text);
}

.editor-layer-library-selected-count {
    margin-left: auto;
    font-size: 12px;
    color: var(--text-muted);
    white-space: nowrap;
}

.editor-layer-library-close {
    width: 30px;
    height: 30px;
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    background: rgba(255, 255, 255, 0.06);
    color: var(--text);
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
}

.editor-layer-library-list {
    padding: 12px;
    overflow: auto;
    display: grid;
    gap: 8px;
    grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
}

.editor-layer-library-card {
    appearance: none;
    width: 100%;
    text-align: left;
    padding: 0;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.04);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    position: relative;
    cursor: pointer;
    transition: border-color 0.2s ease, background 0.2s ease, transform 0.2s ease;
}

.editor-layer-library-card:hover {
    border-color: rgba(0, 212, 255, 0.42);
    background: rgba(255, 255, 255, 0.06);
    transform: translateY(-1px);
}

.editor-layer-library-card.selected {
    border-color: rgba(0, 212, 255, 0.72);
    background: rgba(0, 212, 255, 0.12);
}

.editor-layer-library-thumb-wrap {
    width: 100%;
    aspect-ratio: 1/1;
    background: rgba(0, 0, 0, 0.22);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    position: relative;
}

.editor-layer-library-thumb {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
    background: rgba(255, 255, 255, 0.05);
}

.editor-layer-library-thumb.placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    font-size: 12px;
}

.editor-layer-library-top-meta {
    position: absolute;
    left: 6px;
    top: 6px;
    display: flex;
    gap: 4px;
    max-width: calc(100% - 38px);
}

.editor-layer-library-chip {
    font-size: 10px;
    line-height: 1;
    font-weight: 700;
    color: #e6f6ff;
    border: 1px solid rgba(0, 212, 255, 0.45);
    background: rgba(2, 14, 28, 0.82);
    padding: 4px 6px;
    border-radius: 999px;
    white-space: nowrap;
}

.editor-layer-library-check {
    position: absolute;
    right: 8px;
    top: 8px;
    width: 20px;
    height: 20px;
    border-radius: 999px;
    border: 1px solid rgba(0, 212, 255, 0.66);
    background: rgba(0, 9, 22, 0.76);
    color: #38bdf8;
    font-size: 13px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
}

.editor-layer-library-meta {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 8px;
    min-height: 52px;
}

.editor-layer-library-meta strong {
    font-size: 11px;
    color: var(--text);
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.editor-layer-library-meta span {
    font-size: 10px;
    color: var(--text-muted);
}

.editor-layer-library-footer {
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    padding: 12px;
    display: flex;
    justify-content: flex-end;
}

.editor-layer-library-send-btn {
    min-width: 220px;
}

.publish-render-library-modal .editor-layer-library-list {
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
}

.publish-render-library-modal .editor-layer-library-thumb-wrap {
    aspect-ratio: 16 / 9;
}

.publish-render-library-modal .editor-layer-library-meta {
    min-height: 58px;
}

.publish-render-library-modal .editor-layer-library-send-btn {
    min-width: 200px;
}

.editor-layer-library-loading,
.editor-layer-library-empty,
.editor-layer-library-error {
    border-radius: 10px;
    border: 1px dashed rgba(255, 255, 255, 0.18);
    padding: 20px 12px;
    text-align: center;
    color: var(--text-muted);
    font-size: 12px;
    background: rgba(255, 255, 255, 0.03);
    grid-column: 1 / -1;
}

.editor-layer-library-error {
    margin: 10px 12px 0;
    border-style: solid;
    border-color: rgba(239, 68, 68, 0.4);
    color: #fca5a5;
}

@media (max-width: 768px) {
    .editor-layer-library-list {
        grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
    }

    .publish-render-library-modal .editor-layer-library-list {
        grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    }

    .editor-layer-library-selected-count {
        font-size: 11px;
    }

    .editor-layer-library-send-btn {
        min-width: 100%;
    }
}

.editor-play-controls {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.editor-play-btn {
    background: rgba(0, 212, 255, 0.15);
    border: 1px solid rgba(0, 212, 255, 0.3);
    color: var(--accent);
    cursor: pointer;
    padding: 8px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}
.editor-play-btn:hover { background: rgba(0, 212, 255, 0.25); }

.editor-time {
    font-size: 12px;
    font-family: 'Manrope', monospace;
    color: var(--text-muted);
    font-variant-numeric: tabular-nums;
}
.editor-time-sep { color: var(--text-muted); font-size: 12px; margin: 0 2px; }

/* Right properties panel */
.editor-props-panel {
    width: 260px;
    flex-shrink: 0;
    background: linear-gradient(185deg, rgba(15, 42, 70, 0.9), rgba(8, 25, 42, 0.95));
    border-left: 1px solid var(--border);
    overflow-y: auto;
    overflow-x: hidden;
    scrollbar-gutter: stable;
    padding: 12px;
}

.editor-props-content {
    display: flex;
    flex-direction: column;
    gap: 12px;
    min-width: 0;
}

.editor-props-hint {
    color: var(--text-muted);
    font-size: 13px;
    text-align: center;
    padding: 24px 8px;
}

.editor-props-title {
    font-size: 13px;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 4px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.editor-props-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 0;
}

.editor-props-group > * {
    min-width: 0;
}

.editor-props-group label {
    font-size: 11px;
    color: var(--text-muted);
    font-weight: 600;
}

.editor-props-group input,
.editor-props-group select,
.editor-props-group textarea {
    background: rgba(255,255,255,0.06);
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text);
    padding: 6px 8px;
    font-size: 12px;
    font-family: inherit;
    width: 100%;
    min-width: 0;
}

.editor-props-group input:focus,
.editor-props-group select:focus,
.editor-props-group textarea:focus {
    border-color: var(--accent);
    outline: none;
}

.editor-color-row {
    display: flex;
    gap: 6px;
    align-items: center;
}

.editor-color-row input[type="color"] {
    width: 32px;
    height: 32px;
    padding: 0;
    border: 2px solid var(--border);
    border-radius: 6px;
    cursor: pointer;
    background: none;
}

.editor-font-size-row {
    display: flex;
    align-items: center;
    gap: 6px;
    min-width: 0;
}

.editor-font-size-row input[type="range"] {
    width: 100%;
    min-width: 0;
    flex: 1;
    accent-color: var(--accent);
}

.editor-font-size-row span {
    font-size: 11px;
    color: var(--text-muted);
    min-width: 28px;
    text-align: right;
}

/* Props panel buttons */
.editor-add-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px 12px;
    background: rgba(0, 212, 255, 0.12);
    border: 1px dashed rgba(0, 212, 255, 0.3);
    border-radius: 8px;
    color: var(--accent);
    font-size: 12px;
    font-family: inherit;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}
.editor-add-btn:hover { background: rgba(0, 212, 255, 0.2); }

/* Trim controls */
.editor-trim-range {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.editor-trim-range label {
    font-size: 11px;
    color: var(--text-muted);
}

.editor-trim-range input[type="range"] {
    width: 100%;
    min-width: 0;
    accent-color: var(--accent);
}

.editor-trim-values {
    display: flex;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 6px 10px;
    font-size: 11px;
    color: var(--text-muted);
    font-variant-numeric: tabular-nums;
}

/* Filter grid */
.editor-filter-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 6px;
}

.editor-filter-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 10px 4px;
    background: rgba(255,255,255,0.04);
    border: 1px solid var(--border);
    border-radius: 8px;
    cursor: pointer;
    font-size: 10px;
    color: var(--text-muted);
    transition: border-color 0.2s, background 0.2s;
}
.editor-filter-card:hover { border-color: rgba(0, 212, 255, 0.3); background: rgba(0, 212, 255, 0.06); }
.editor-filter-card.active { border-color: var(--accent); background: rgba(0, 212, 255, 0.12); color: var(--accent); }

.editor-filter-preview {
    width: 40px;
    height: 40px;
    border-radius: 6px;
    background: linear-gradient(135deg, #1a3a5c, #0a1f33);
}

.editor-transition-junctions {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.editor-transition-junction {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 3px;
    width: 100%;
    text-align: left;
    padding: 10px 12px;
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(255, 255, 255, 0.04);
    color: var(--text);
    cursor: pointer;
    transition: border-color 0.2s ease, background 0.2s ease, transform 0.2s ease;
}

.editor-transition-junction:hover {
    border-color: rgba(0, 212, 255, 0.3);
    background: rgba(0, 212, 255, 0.06);
    transform: translateY(-1px);
}

.editor-transition-junction.active {
    border-color: rgba(0, 212, 255, 0.62);
    background: rgba(0, 212, 255, 0.12);
}

.editor-transition-junction strong {
    font-size: 12px;
    line-height: 1.3;
}

.editor-transition-junction span {
    font-size: 10px;
    color: var(--text-muted);
}

.editor-transition-selection-card {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 12px;
    border-radius: 12px;
    border: 1px solid rgba(0, 212, 255, 0.22);
    background: linear-gradient(180deg, rgba(0, 212, 255, 0.1), rgba(255, 255, 255, 0.03));
}

.editor-transition-selection-card strong {
    font-size: 13px;
    color: var(--text);
}

.editor-transition-selection-card span {
    font-size: 11px;
    color: var(--text-muted);
}

.editor-transition-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
}

.editor-transition-card {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 8px;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(255, 255, 255, 0.04);
    color: var(--text);
    cursor: pointer;
    text-align: left;
    transition: border-color 0.2s ease, background 0.2s ease, transform 0.2s ease;
}

.editor-transition-card:hover {
    border-color: rgba(0, 212, 255, 0.34);
    background: rgba(0, 212, 255, 0.07);
    transform: translateY(-1px);
}

.editor-transition-card.active {
    border-color: rgba(0, 212, 255, 0.72);
    background: rgba(0, 212, 255, 0.12);
    box-shadow: inset 0 0 0 1px rgba(0, 212, 255, 0.18);
}

.editor-transition-card strong {
    font-size: 11px;
    line-height: 1.2;
}

.editor-transition-card small {
    font-size: 10px;
    line-height: 1.35;
    color: var(--text-muted);
}

.editor-transition-preview {
    position: relative;
    width: 100%;
    aspect-ratio: 1 / 0.72;
    border-radius: 10px;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: linear-gradient(135deg, rgba(9, 18, 30, 0.95), rgba(17, 28, 44, 0.95));
}

.editor-transition-preview-pane {
    position: absolute;
    inset: 0;
}

.editor-transition-preview-pane.before {
    background:
        linear-gradient(140deg, rgba(66, 153, 225, 0.8), rgba(15, 44, 92, 0.88)),
        radial-gradient(circle at 22% 26%, rgba(255, 255, 255, 0.4), transparent 28%);
}

.editor-transition-preview-pane.after {
    background:
        linear-gradient(140deg, rgba(251, 146, 60, 0.8), rgba(111, 44, 20, 0.9)),
        radial-gradient(circle at 78% 70%, rgba(255, 255, 255, 0.45), transparent 26%);
    opacity: 0.92;
}

.editor-transition-preview-flash {
    position: absolute;
    inset: 0;
    background: rgba(255, 255, 255, 0.78);
    opacity: 0;
}

.editor-transition-preview-dissolve .editor-transition-preview-pane.before {
    clip-path: inset(0 28% 0 0);
}

.editor-transition-preview-dissolve .editor-transition-preview-pane.after {
    clip-path: inset(0 0 0 34%);
    opacity: 0.72;
}

.editor-transition-preview-fade-black::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg, transparent 0 22%, rgba(0, 0, 0, 0.84) 45% 55%, transparent 78% 100%);
}

.editor-transition-preview-slide-left .editor-transition-preview-pane.before {
    clip-path: inset(0 36% 0 0);
}

.editor-transition-preview-slide-left .editor-transition-preview-pane.after {
    transform: translateX(36%);
}

.editor-transition-preview-slide-right .editor-transition-preview-pane.before {
    clip-path: inset(0 0 0 36%);
}

.editor-transition-preview-slide-right .editor-transition-preview-pane.after {
    transform: translateX(-36%);
}

.editor-transition-preview-slide-up .editor-transition-preview-pane.before {
    clip-path: inset(0 0 34% 0);
}

.editor-transition-preview-slide-up .editor-transition-preview-pane.after {
    transform: translateY(30%);
}

.editor-transition-preview-slide-down .editor-transition-preview-pane.before {
    clip-path: inset(34% 0 0 0);
}

.editor-transition-preview-slide-down .editor-transition-preview-pane.after {
    transform: translateY(-30%);
}

.editor-transition-preview-zoom-in .editor-transition-preview-pane.after {
    transform: scale(0.72);
    border-radius: 14px;
    box-shadow: 0 0 0 10px rgba(255, 255, 255, 0.08);
}

.editor-transition-preview-flash-white .editor-transition-preview-flash {
    opacity: 1;
    clip-path: polygon(38% 0, 62% 0, 100% 100%, 0 100%);
}

.editor-transition-empty {
    border: 1px dashed rgba(255, 255, 255, 0.16);
    border-radius: 12px;
    padding: 14px 12px;
    color: var(--text-muted);
    font-size: 12px;
    line-height: 1.5;
    background: rgba(255, 255, 255, 0.03);
}

/* Sticker/emoji grid */
.editor-sticker-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 6px;
}

.editor-sticker-item {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    padding: 8px;
    background: rgba(255,255,255,0.04);
    border: 1px solid var(--border);
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.2s, transform 0.15s;
    user-select: none;
}
.editor-sticker-item:hover { background: rgba(0, 212, 255, 0.1); transform: scale(1.1); }

/* Quality controls */
.editor-quality-option {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px;
    background: rgba(255,255,255,0.04);
    border: 1px solid var(--border);
    border-radius: 8px;
    cursor: pointer;
    transition: border-color 0.2s;
}
.editor-quality-option:hover { border-color: rgba(0, 212, 255, 0.3); }
.editor-quality-option.active { border-color: var(--accent); background: rgba(0, 212, 255, 0.1); }

.editor-quality-label {
    font-size: 12px;
    font-weight: 600;
    color: var(--text);
}
.editor-quality-desc {
    font-size: 10px;
    color: var(--text-muted);
}

/* Music section */
.editor-music-current {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px;
    background: rgba(255,255,255,0.04);
    border: 1px solid var(--border);
    border-radius: 8px;
}

.editor-music-info {
    flex: 1;
    font-size: 12px;
    color: var(--text);
}

.editor-music-info small {
    display: block;
    color: var(--text-muted);
    font-size: 10px;
}

.editor-volume-row {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
}

.editor-volume-row svg { flex-shrink: 0; color: var(--text-muted); }

.editor-volume-row input[type="range"] {
    width: 100%;
    min-width: 0;
    flex: 1;
    accent-color: var(--accent);
}

.editor-volume-row span {
    font-size: 11px;
    color: var(--text-muted);
    min-width: 28px;
    text-align: right;
}

.editor-ai-music-overlay {
    position: fixed;
    inset: 0;
    z-index: 4050;
}

.editor-ai-music-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(3, 10, 20, 0.72);
    backdrop-filter: blur(4px);
}

.editor-ai-music-modal {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    width: min(560px, calc(100vw - 24px));
    border-radius: 14px;
    border: 1px solid rgba(0, 212, 255, 0.3);
    background: linear-gradient(180deg, rgba(12, 34, 58, 0.98), rgba(5, 18, 34, 0.98));
    box-shadow: 0 28px 56px rgba(0, 0, 0, 0.5);
    padding: 14px;
}

.editor-ai-music-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.editor-ai-music-header h3 {
    margin: 0;
    font-size: 16px;
    color: var(--text);
}

.editor-ai-music-close {
    width: 30px;
    height: 30px;
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    background: rgba(255, 255, 255, 0.06);
    color: var(--text);
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
}

.editor-ai-music-subtitle {
    margin: 8px 0 10px;
    font-size: 12px;
    color: var(--text-muted);
}

.editor-ai-music-error {
    border: 1px solid rgba(239, 68, 68, 0.45);
    background: rgba(239, 68, 68, 0.12);
    color: #fca5a5;
    font-size: 12px;
    border-radius: 8px;
    padding: 8px 10px;
    margin-bottom: 10px;
}

.editor-ai-music-form {
    display: grid;
    gap: 8px;
}

.editor-ai-music-form label {
    font-size: 11px;
    color: var(--text-muted);
}

.editor-ai-music-form select,
.editor-ai-music-form textarea {
    width: 100%;
    border-radius: 9px;
    border: 1px solid var(--border);
    background: rgba(255, 255, 255, 0.05);
    color: var(--text);
    padding: 9px 10px;
    font-size: 12px;
    resize: vertical;
}

.editor-ai-music-form select option {
    background: #253241;
    color: #e6f7ff;
}

.editor-ai-music-form select:focus,
.editor-ai-music-form textarea:focus {
    outline: none;
    border-color: rgba(0, 212, 255, 0.55);
    box-shadow: 0 0 0 2px rgba(0, 212, 255, 0.16);
}

.editor-ai-music-footer {
    margin-top: 12px;
    display: flex;
    justify-content: flex-end;
    gap: 8px;
}

.editor-ai-music-generate-btn {
    border-color: rgba(0, 212, 255, 0.65);
    background: rgba(0, 212, 255, 0.18);
}

.editor-ai-music-generate-btn:disabled,
.editor-ai-music-close:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* ── Quick actions row ── */
.editor-quick-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    min-width: 0;
    padding: 8px 12px;
    border-top: 1px solid var(--border);
    background: rgba(5, 20, 36, 0.7);
    overflow-x: auto;
}

.editor-quick-icon-btn {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: rgba(255,255,255,0.05);
    color: var(--text-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
}

.editor-quick-icon-btn:hover:not(:disabled) {
    border-color: rgba(0, 212, 255, 0.35);
    color: var(--accent);
    background: rgba(0, 212, 255, 0.1);
}

.editor-quick-icon-btn.active {
    border-color: rgba(var(--accent-rgb), 0.7);
    color: var(--accent);
    background: rgba(var(--accent-rgb), 0.14);
}

.editor-quick-icon-btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.editor-quick-icon-btn[data-rate-label] {
    position: relative;
    width: 42px;
    justify-content: flex-start;
    padding-left: 8px;
}

.editor-quick-icon-btn[data-rate-label]::after {
    content: attr(data-rate-label);
    position: absolute;
    right: 5px;
    bottom: 4px;
    font-size: 8px;
    font-weight: 700;
    line-height: 1;
    color: #dff6ff;
    opacity: 0.9;
    font-variant-numeric: tabular-nums;
}

.editor-aspect-selector {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 6px;
}

.editor-aspect-selector label {
    font-size: 10px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.4px;
}

.editor-aspect-selector select {
    height: 32px;
    border-radius: 8px;
    border: 1px solid rgba(0, 212, 255, 0.28);
    background: linear-gradient(180deg, rgba(8, 35, 58, 0.98), rgba(7, 26, 45, 0.98));
    color: #e6f7ff;
    padding: 0 8px;
    font-size: 12px;
    font-weight: 600;
}

.editor-aspect-selector select:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 2px rgba(0, 212, 255, 0.16);
}

.editor-aspect-selector select option {
    background: #0a2136;
    color: #e6f7ff;
}

/* ── Timeline ── */
.editor-timeline {
    flex-shrink: 0;
    height: 160px;
    width: 100%;
    min-width: 0;
    max-width: 100%;
    background: linear-gradient(0deg, rgba(8, 25, 42, 0.98), rgba(15, 42, 70, 0.92));
    border-top: 1px solid var(--border);
    position: relative;
    overflow-x: auto;
    overflow-y: auto;
}

.editor-timeline-ruler {
    height: 24px;
    background: rgba(0,0,0,0.2);
    display: flex;
    align-items: flex-end;
    padding: 0 76px 0 80px;
    position: relative;
    border-bottom: 1px solid var(--border);
}

.editor-ruler-mark {
    position: absolute;
    bottom: 4px;
    font-size: 9px;
    color: var(--text-muted);
    transform: translateX(-50%);
    font-variant-numeric: tabular-nums;
}

.editor-ruler-mark.minute {
    font-size: 10px;
    color: rgba(219, 237, 255, 0.9);
}

.editor-ruler-tick {
    position: absolute;
    bottom: 0;
    width: 1px;
    height: 6px;
    background: rgba(255,255,255,0.15);
}
.editor-ruler-tick.major { height: 12px; background: rgba(255,255,255,0.25); }

.editor-timeline-tracks {
    padding-left: 0;
    padding-right: 16px;
}

.editor-track {
    display: flex;
    height: 44px;
    border-bottom: 1px solid rgba(255,255,255,0.05);
}

.editor-track-label {
    width: 80px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 4px;
    padding: 0 6px 0 8px;
    font-size: 10px;
    color: var(--text-muted);
    background: rgba(0,0,0,0.15);
    border-right: 1px solid var(--border);
    white-space: nowrap;
    cursor: pointer;
    transition: background 0.18s ease, color 0.18s ease, opacity 0.18s ease;
}

.editor-track-label svg {
    flex-shrink: 0;
}

.editor-track-label-main {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    min-width: 0;
}

.editor-track-label-text {
    overflow: hidden;
    text-overflow: ellipsis;
}

.editor-track-props-volume-group {
    margin-top: 2px;
    gap: 8px;
}

.editor-track-props-volume-list {
    display: grid;
    gap: 6px;
}

.editor-track-props-volume-item {
    width: 100%;
    border: 1px solid rgba(0, 212, 255, 0.28);
    background: rgba(0, 212, 255, 0.1);
    border-radius: 8px;
    color: #dff5ff;
    padding: 8px;
    display: grid;
    gap: 6px;
}

.editor-track-props-volume-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.editor-track-props-volume-name-wrap {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
}

.editor-track-props-volume-icon {
    width: 18px;
    height: 18px;
    border-radius: 6px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.08);
    flex-shrink: 0;
}

.editor-track-props-volume-icon svg {
    width: 13px;
    height: 13px;
}

.editor-track-props-volume-name {
    font-size: 12px;
    font-weight: 600;
}

.editor-track-props-volume-slider {
    width: 100%;
    min-width: 0;
    accent-color: var(--accent);
}

.editor-track-props-volume-value {
    font-size: 11px;
    color: var(--text-muted);
    font-variant-numeric: tabular-nums;
}

.editor-track.track-targeted .editor-track-label {
    color: #f8fbff;
    opacity: 1;
}

.editor-track[data-track="video"].track-targeted .editor-track-label {
    background: linear-gradient(135deg, rgba(26, 107, 58, 0.38), rgba(14, 74, 40, 0.35));
}

.editor-track[data-track="audio"].track-targeted .editor-track-label {
    background: linear-gradient(135deg, rgba(74, 26, 107, 0.38), rgba(46, 14, 74, 0.35));
}

.editor-track.track-insert-selected .editor-track-label {
    box-shadow: inset 0 0 0 1px rgba(0, 212, 255, 0.45);
}

.editor-track[data-track="layer-video"].track-insert-selected .editor-track-label,
.editor-track[data-track^="layer-video-"].track-insert-selected .editor-track-label {
    background: linear-gradient(135deg, rgba(141, 63, 31, 0.38), rgba(97, 37, 15, 0.34));
}

.editor-track.track-not-targeted .editor-track-label {
    opacity: 0.55;
}

.editor-track-content {
    flex: 1;
    position: relative;
    min-height: 100%;
    min-width: 0;
}

.editor-transition-marker {
    position: absolute;
    top: 50%;
    width: 15px;
    height: 15px;
    border-radius: 4px;
    border: 1px solid rgba(255, 255, 255, 0.3);
    background: linear-gradient(135deg, rgba(18, 128, 220, 0.96), rgba(0, 212, 255, 0.82));
    transform: translate(-50%, -50%) rotate(45deg);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.28);
    cursor: pointer;
    z-index: 4;
}

.editor-transition-marker::after {
    content: "";
    position: absolute;
    inset: 3px;
    border-radius: 2px;
    background: rgba(4, 18, 34, 0.75);
}

.editor-transition-marker.configured {
    border-color: rgba(251, 191, 36, 0.75);
    background: linear-gradient(135deg, rgba(251, 191, 36, 0.96), rgba(249, 115, 22, 0.86));
}

.editor-transition-marker.selected {
    box-shadow: 0 0 0 2px rgba(0, 212, 255, 0.24), 0 8px 20px rgba(0, 0, 0, 0.3);
}

.editor-track-clip {
    position: absolute;
    top: 3px;
    height: calc(100% - 6px);
    border-radius: 4px;
    font-size: 9px;
    color: #fff;
    display: flex;
    align-items: center;
    padding: 0 6px;
    cursor: pointer;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    transition: opacity 0.2s;
}
.editor-track-clip:hover { opacity: 0.85; }

.editor-track-clip.clip-text {
    padding: 0 10px;
}

.editor-track-clip.clip-text::before,
.editor-track-clip.clip-text::after {
    content: "";
    position: absolute;
    top: 4px;
    bottom: 4px;
    width: 3px;
    border-radius: 2px;
    background: rgba(255, 255, 255, 0.35);
    opacity: 0.9;
}

.editor-track-clip.clip-text::before {
    left: 2px;
}

.editor-track-clip.clip-text::after {
    right: 2px;
}

.editor-track-clip.selected {
    outline: 2px solid rgba(0, 212, 255, 0.8);
    outline-offset: -1px;
    box-shadow: 0 0 0 1px rgba(3, 10, 17, 0.5);
}

.editor-track-clip.clip-video {
    background: linear-gradient(135deg, #0d3d1f, #072a14);
    border: 1px solid rgba(20, 80, 42, 0.7);
}
.editor-track-clip.clip-audio {
    background: linear-gradient(135deg, #2d0d42, #1a0830);
    border: 1px solid rgba(55, 18, 82, 0.7);
}

.editor-track-clip.clip-audio:not(.clip-audio-master) {
    z-index: 2;
}

.editor-track-clip.with-waveform {
    overflow: hidden;
}

.editor-track-clip.with-waveform::before {
    content: "";
    position: absolute;
    left: 2px;
    right: 2px;
    top: 2px;
    bottom: 2px;
    border-radius: 3px;
    background-image: var(--editor-track-wave-image);
    background-repeat: var(--editor-track-wave-repeat, no-repeat);
    background-size: var(--editor-track-wave-size, 100% 100%);
    background-position: left center;
    opacity: 1;
    pointer-events: none;
}

.editor-track-clip.with-waveform.loading::before {
    background-image: repeating-linear-gradient(
        90deg,
        rgba(228, 247, 255, 0.9) 0,
        rgba(228, 247, 255, 0.9) 2px,
        rgba(228, 247, 255, 0.2) 2px,
        rgba(228, 247, 255, 0.2) 8px
    );
    background-size: 120px 100%;
    animation: editor-wave-loading 1.25s linear infinite;
}

.editor-track-clip.with-waveform::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.09), rgba(255, 255, 255, 0));
    pointer-events: none;
}

.editor-track-clip.with-waveform {
    text-shadow: 0 1px 1px rgba(0, 0, 0, 0.55);
}

.editor-track-clip.clip-audio.clip-audio-master {
    top: 1px;
    height: calc(100% - 2px);
    z-index: 1;
    border-color: rgba(80, 18, 55, 0.72);
    background: linear-gradient(135deg, #3d0e2a, #280818);
    overflow: hidden;
}

.editor-track-clip.clip-audio.clip-audio-master::before {
    content: "";
    position: absolute;
    left: 2px;
    right: 2px;
    top: 2px;
    bottom: 2px;
    border-radius: 3px;
    background-image: var(--audio-waveform-image);
    background-repeat: var(--audio-waveform-repeat, no-repeat);
    background-size: var(--audio-waveform-size, 100% 100%);
    background-position: left center;
    opacity: 1;
    pointer-events: none;
}

.editor-track-clip.clip-audio.clip-audio-master::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0));
    pointer-events: none;
}

.editor-track-clip.clip-audio.clip-audio-master > span {
    position: relative;
    z-index: 1;
    font-weight: 600;
    letter-spacing: 0.02em;
}

.editor-track-clip.clip-audio.clip-audio-master.loading::before {
    background-image: repeating-linear-gradient(
        90deg,
        rgba(238, 188, 255, 0.9) 0,
        rgba(238, 188, 255, 0.9) 2px,
        rgba(238, 188, 255, 0.2) 2px,
        rgba(238, 188, 255, 0.2) 8px
    );
    background-size: 120px 100%;
    animation: editor-wave-loading 1.25s linear infinite;
}

@keyframes editor-wave-loading {
    0% {
        background-position: 0 50%;
    }
    100% {
        background-position: 120px 50%;
    }
}
.editor-track-clip.clip-text {
    background: linear-gradient(135deg, #1a4a6b, #0e2e4a);
    border: 1px solid rgba(26, 74, 107, 0.6);
}
.editor-track-clip.clip-sticker {
    background: linear-gradient(135deg, #6b5a1a, #4a3e0e);
    border: 1px solid rgba(107, 90, 26, 0.6);
}

.editor-track-clip.clip-media {
    background: linear-gradient(135deg, #8d3f1f, #61250f);
    border: 1px solid rgba(141, 63, 31, 0.65);
}

.editor-track-clip.clip-reversed {
    box-shadow: inset 0 0 0 1px rgba(255, 244, 200, 0.45);
}

.editor-timeline-playhead {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 2px;
    background: var(--accent);
    left: 80px;
    z-index: 10;
    pointer-events: none;
    transition: none;
}

.editor-timeline-playhead::before {
    content: "";
    position: absolute;
    top: 0;
    left: -5px;
    width: 12px;
    height: 12px;
    background: var(--accent);
    clip-path: polygon(50% 100%, 0 0, 100% 0);
}

/* ── Export modal ── */
.editor-export-overlay {
    position: fixed;
    inset: 0;
    z-index: 2000;
    background: rgba(0,0,0,0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(4px);
}

.editor-export-card {
    background: var(--bg-card-strong);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 32px;
    text-align: center;
    max-width: 360px;
    width: 90%;
}

.editor-export-card h3 {
    margin-bottom: 12px;
    font-size: 18px;
    color: var(--text);
}

.editor-export-progress {
    width: 100%;
    height: 8px;
    background: rgba(255,255,255,0.08);
    border-radius: 4px;
    overflow: hidden;
    margin: 16px 0;
}

.editor-export-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--accent), #7b61ff);
    border-radius: 4px;
    transition: width 0.3s;
    width: 0%;
}

.editor-export-status {
    font-size: 13px;
    color: var(--text-muted);
}

/* ── Editor video selection cards ── */
.editor-video-card-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0,0,0,0.4);
    opacity: 0;
    transition: opacity 0.2s;
    border-radius: 8px 8px 0 0;
}
.card:hover .editor-video-card-overlay { opacity: 1; }

.editor-subtitle-modal-content {
    width: min(100%, 460px);
}

.editor-subtitle-modal-input {
    min-height: 120px;
    resize: vertical;
}

.editor-subtitle-modal-time {
    margin: 8px 0 0;
    font-size: 12px;
    color: var(--text-muted);
}

.editor-drafts-modal-list {
    display: grid;
    gap: 10px;
    max-height: min(52vh, 420px);
    overflow-y: auto;
}

.editor-drafts-empty {
    margin: 0;
    font-size: 13px;
    color: var(--text-muted);
}

.editor-draft-item {
    border: 1px solid rgba(111, 142, 173, 0.35);
    border-radius: 12px;
    background: rgba(7, 24, 43, 0.58);
    padding: 10px 12px;
    display: grid;
    gap: 8px;
}

.editor-draft-head {
    display: block;
}

.editor-draft-title {
    margin: 0;
    font-size: 14px;
    font-weight: 700;
    color: var(--text);
}

.editor-draft-meta {
    margin: 3px 0 0;
    font-size: 11px;
    color: var(--text-muted);
}

.editor-draft-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
}

.editor-upload-card {
    grid-column: 1 / -1;
    padding: 12px;
    border: 1px dashed rgba(0, 212, 255, 0.32);
    border-radius: 12px;
    background: rgba(0, 212, 255, 0.06);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.editor-upload-card h4 {
    font-size: 13px;
    color: var(--text);
    margin: 0;
}

.editor-upload-card p {
    font-size: 11px;
    color: var(--text-muted);
    margin: 3px 0 0;
}

.editor-video-card-overlay svg {
    color: var(--accent);
    filter: drop-shadow(0 2px 8px rgba(0,0,0,0.5));
}

/* ── Responsive: mobile editor ── */
@media (max-width: 768px) {
    #page-editor:has(.editor-workspace:not([hidden])),
    #page-editor.editor-fullscreen {
        margin: -16px -16px -76px;
        padding: 0;
        width: calc(100% + 32px);
    }

    .editor-workspace {
        --editor-mobile-props-height: clamp(96px, 18vh, 152px);
        height: calc(100vh - 56px);
        height: calc(100dvh - 56px);
        display: flex;
        flex-direction: column;
    }

    .editor-main {
        flex-direction: column;
        flex: 1;
        min-height: 0;
    }

    .editor-tools-panel {
        order: 2;
        position: relative;
        bottom: auto; left: auto; right: auto;
        width: 100%;
        flex-direction: row;
        justify-content: space-around;
        padding: 4px 0;
        border-right: none;
        border-top: 1px solid var(--border);
        overflow-x: auto;
        height: auto;
        flex-shrink: 0;
    }

    .editor-tool-btn {
        min-width: 48px;
    }

    .editor-transition-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .editor-preview-area {
        order: 1;
        flex: 1;
        padding: 6px;
        min-height: 0;
    }

    .editor-quick-actions {
        flex-wrap: wrap;
        row-gap: 6px;
        padding: 6px 8px;
    }

    .editor-aspect-selector {
        width: 100%;
        justify-content: flex-end;
    }

    .editor-upload-card {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
    }

    .editor-canvas-wrapper {
        max-height: 100%;
    }

    .editor-props-panel {
        order: 3;
        display: block;
        position: relative;
        bottom: auto; left: auto; right: auto; top: auto;
        width: 100%;
        height: var(--editor-mobile-props-height);
        max-height: var(--editor-mobile-props-height);
        min-height: var(--editor-mobile-props-height);
        border-left: none;
        border-top: 1px solid var(--border);
        border-radius: 0;
        padding: 6px 10px;
        overflow-y: auto;
        overflow-x: hidden;
        scrollbar-gutter: stable;
        flex-shrink: 0;
    }

    .editor-props-panel.open {
        display: block;
    }

    .editor-props-panel .editor-props-title {
        display: none;
    }

    .editor-timeline {
        height: auto;
        min-height: 116px;
        flex-shrink: 0;
    }

    .editor-timeline-ruler {
        padding-right: 92px;
    }

    .editor-timeline-tracks {
        padding-right: 24px;
    }

    .editor-topbar {
        padding: 6px 12px;
        min-height: 44px;
        flex-shrink: 0;
    }
}

/* Landscape phone adjustments */
@media (max-width: 768px) and (orientation: landscape) {
    .editor-canvas-wrapper {
        aspect-ratio: auto;
        max-height: 100%;
        width: auto;
        height: 100%;
    }

    .editor-timeline {
        height: auto;
        min-height: 100px;
    }

    .editor-tools-panel {
        bottom: 80px;
    }
}

/* Subtitle list items */
.editor-sub-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.editor-sub-count {
    font-size: 11px;
    color: var(--text-muted);
}

.editor-sub-icon-btn {
    width: 30px;
    height: 30px;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: rgba(255,255,255,0.05);
    color: var(--text-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
}

.editor-sub-icon-btn:hover {
    border-color: rgba(0, 212, 255, 0.35);
    color: var(--accent);
}

.editor-sub-icon-btn.active {
    border-color: var(--accent);
    color: var(--accent);
    background: rgba(0, 212, 255, 0.14);
}

.editor-sub-quick-card {
    margin-top: 8px;
    padding: 8px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: rgba(255,255,255,0.03);
    display: flex;
    flex-direction: column;
    gap: 8px;
    overflow: hidden;
    width: 100%;
    max-width: 100%;
    min-width: 0;
}

.editor-sub-quick-row {
    display: grid;
    grid-template-columns: 56px minmax(0, 1fr) 40px;
    gap: 6px;
    align-items: center;
    min-width: 0;
    width: 100%;
    max-width: 100%;
}

.editor-sub-quick-label {
    font-size: 11px;
    color: var(--text-muted);
    font-weight: 600;
}

.editor-sub-stepper {
    display: grid;
    grid-template-columns: 24px minmax(0, 1fr) 24px;
    align-items: center;
    gap: 6px;
    min-width: 0;
    width: 100%;
}

.editor-sub-stepper button {
    width: 24px;
    height: 24px;
    border-radius: 6px;
    border: 1px solid var(--border);
    background: rgba(255,255,255,0.06);
    color: var(--text);
    cursor: pointer;
    font-size: 13px;
    line-height: 1;
}

.editor-sub-stepper button:hover {
    border-color: rgba(0, 212, 255, 0.35);
    color: var(--accent);
}

.editor-sub-stepper input[type="range"] {
    width: 100%;
    min-width: 0;
    flex: 1;
    accent-color: var(--accent);
}

.editor-sub-quick-value {
    font-size: 11px;
    color: var(--text-muted);
    text-align: right;
    font-variant-numeric: tabular-nums;
    min-width: 0;
}

.editor-sub-quick-empty {
    margin-top: 8px;
    padding: 8px;
    border: 1px dashed var(--border);
    border-radius: 8px;
    color: var(--text-muted);
    font-size: 11px;
}

@media (max-width: 768px) {
    .editor-sub-quick-row {
        grid-template-columns: 52px minmax(0, 1fr) 34px;
        gap: 4px;
    }

    .editor-sub-stepper {
        grid-template-columns: 22px minmax(0, 1fr) 22px;
        gap: 4px;
    }

    .editor-sub-stepper button {
        width: 22px;
        height: 22px;
    }
}

.editor-subtitle-item {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 8px;
    background: rgba(255,255,255,0.04);
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 11px;
    color: var(--text);
    cursor: pointer;
    transition: border-color 0.2s;
    min-width: 0;
}
.editor-subtitle-item:hover { border-color: rgba(0, 212, 255, 0.3); }
.editor-subtitle-item.active { border-color: var(--accent); background: rgba(0, 212, 255, 0.08); }
.editor-subtitle-item .sub-time { color: var(--text-muted); font-size: 10px; min-width: 70px; }
.editor-subtitle-item .sub-text {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.editor-subtitle-item .sub-delete {
    background: none; border: none; color: var(--text-muted); cursor: pointer;
    padding: 2px; border-radius: 4px;
}
.editor-subtitle-item .sub-delete:hover { color: #ef4444; }

.editor-smartcuts-summary {
    margin: 10px 0 8px;
    font-size: 12px;
    color: var(--text-muted);
}

.editor-smartcuts-error {
    margin: 10px 0 0;
    padding: 8px 10px;
    border: 1px solid rgba(239, 68, 68, 0.28);
    border-radius: 8px;
    background: rgba(239, 68, 68, 0.08);
    color: #fecaca;
    font-size: 12px;
}

.editor-smartcuts-list {
    display: grid;
    gap: 8px;
    margin-top: 10px;
}

.editor-smartcut-item {
    border: 1px solid rgba(111, 142, 173, 0.28);
    border-radius: 8px;
    background: rgba(7, 24, 43, 0.58);
    padding: 10px;
    cursor: pointer;
}

.editor-smartcut-item:hover {
    border-color: rgba(0, 212, 255, 0.34);
}

.editor-smartcut-item.approved {
    border-color: rgba(34, 197, 94, 0.38);
    background: rgba(16, 74, 42, 0.2);
}

.editor-smartcut-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 8px;
}

.editor-smartcut-head strong {
    min-width: 0;
    color: var(--text);
    font-size: 13px;
    line-height: 1.25;
}

.editor-smartcut-check {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    flex-shrink: 0;
    color: var(--text-muted);
    font-size: 11px;
    cursor: pointer;
}

.editor-smartcut-check input {
    width: 14px;
    height: 14px;
    accent-color: #22c55e;
}

.editor-smartcut-time {
    margin-top: 5px;
    color: var(--accent);
    font-size: 11px;
    font-variant-numeric: tabular-nums;
}

.editor-smartcut-item p {
    margin: 6px 0 0;
    color: var(--text-muted);
    font-size: 11px;
    line-height: 1.35;
}

.editor-smartcuts-clear {
    margin-top: 10px;
    border-color: rgba(239, 68, 68, 0.3);
    color: #fca5a5;
}

/* Subtitle styles grid */
.editor-subtitle-styles-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 6px;
    margin-top: 4px;
    min-width: 0;
}
.editor-sub-style-card {
    display: flex; flex-direction: column; align-items: center; gap: 3px;
    padding: 6px 4px; border-radius: 8px; cursor: pointer;
    background: rgba(255,255,255,0.04); border: 1px solid transparent;
    transition: all 0.15s;
    min-width: 0;
}
.editor-sub-style-card:hover { border-color: rgba(0,212,255,0.3); background: rgba(0,212,255,0.06); }
.editor-sub-style-card.active { border-color: var(--accent); background: rgba(0,212,255,0.1); }
.editor-sub-style-card span {
    font-size: 9px;
    color: var(--text-muted);
    text-align: center;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.editor-sub-style-preview {
    min-height: 22px; display: flex; align-items: center; justify-content: center;
    line-height: 1.2; white-space: nowrap;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Color row */
.editor-color-row {
    display: flex; align-items: center; gap: 8px;
}
.editor-color-row input[type="color"] {
    width: 32px; height: 28px; border: 1px solid var(--border); border-radius: 6px;
    background: transparent; cursor: pointer; padding: 1px;
}
.editor-font-size-row {
    display: flex; align-items: center; gap: 8px; min-width: 0;
}
.editor-font-size-row input[type="range"] { flex: 1; width: 100%; min-width: 0; }
.editor-font-size-row span { font-size: 11px; color: var(--text-muted); min-width: 36px; }
