/* Training Video Maker Styles */

/* Hidden file inputs */
#slides-input,
#avatar-input {
    display: none;
}

/* Uploaded files container */
#uploaded-files-container {
    display: none;
}

.tv-maker-composer {
    width: min(980px, calc(100vw - 32px));
    margin: 0 auto;
    border: 1px solid rgba(113, 137, 255, 0.28);
    border-radius: 26px;
    background: rgba(255, 255, 255, 0.97);
    box-shadow: 0 24px 70px rgba(46, 33, 120, 0.16);
}

.tv-maker-composer--create {
    padding: 18px 18px 16px;
}

.tv-maker-composer--edit {
    width: min(820px, calc(100vw - 32px));
    padding: 14px;
}

.tv-maker-composer--single {
    padding: 18px 18px 16px;
}

.tv-maker-mode-switch {
    display: inline-flex;
    align-self: center;
    gap: 4px;
    margin: 0 auto 14px;
    padding: 4px;
    border: 1px solid rgba(15, 23, 42, 0.08);
    border-radius: 12px;
    background: #F8FAFC;
}

.tv-maker-mode-btn {
    min-height: 34px;
    padding: 0 14px;
    border: 0;
    border-radius: 9px;
    background: transparent;
    color: #64748B;
    font-family: Outfit, sans-serif;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.16s ease, color 0.16s ease, box-shadow 0.16s ease;
}

.tv-maker-mode-btn.is-active {
    background: #FFFFFF;
    color: #0E0F26;
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.14);
}

.tv-maker-composer .description-input {
    width: 100%;
    min-height: 120px;
    border: 0;
    border-radius: 18px;
    background: linear-gradient(180deg, #FFFFFF 0%, #FAFBFF 100%);
    color: #111827;
    font-size: 16px;
    line-height: 1.55;
    resize: vertical;
    box-shadow: none;
}

.tv-maker-composer[data-tv-maker-mode="ai_edit"] .description-input {
    height: 56px;
    min-height: 56px;
    max-height: 56px;
    padding: 10px 12px;
    border-radius: 14px;
    font-size: 14px;
    line-height: 1.4;
    resize: none;
}

.tv-maker-composer--edit .description-input {
    min-height: 96px;
    margin-top: 12px;
    border: 1px solid #E5E7EB;
    background: #FFFFFF;
}

.tv-maker-composer .description-input:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(113, 137, 255, 0.12);
}

.tv-maker-composer .word-count {
    margin-top: 4px;
    color: #94A3B8;
    font-size: 12px;
    text-align: right;
}

.tv-create-source-actions {
    min-height: 0;
    margin: 0;
}

.tv-single-source-actions {
    margin: 0 0 12px;
}

.tv-maker-composer[data-tv-maker-mode="ai_edit"] .tv-single-source-actions {
    margin-bottom: 8px;
}

.tv-maker-composer[data-tv-maker-mode="script"] .tv-single-source-actions {
    display: none !important;
}

.tv-maker-composer[data-tv-maker-mode="generative"] .tv-single-source-actions {
    display: none !important;
}

.tv-single-upload-card {
    width: 100%;
    min-height: 98px;
    padding: 14px !important;
    border: 1px solid rgba(113, 137, 255, 0.18) !important;
    border-radius: 18px !important;
    background: linear-gradient(180deg, #FFFFFF 0%, #F8FAFF 100%) !important;
    box-shadow: none !important;
}

.tv-maker-composer[data-tv-maker-mode="ai_edit"] .tv-single-upload-card {
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 76px;
    padding: 10px 12px !important;
    cursor: pointer;
}

.tv-single-upload-card .tac-text {
    align-items: center;
    text-align: center;
}

.tv-maker-composer[data-tv-maker-mode="ai_edit"] .tv-single-upload-card:not(.has-upload-preview) .tac-text {
    align-items: flex-start;
    text-align: left;
}

.tv-maker-composer[data-tv-maker-mode="ai_edit"] .tv-single-upload-card:not(.has-upload-preview) .tac-title {
    display: block;
    color: #0F172A;
    font-size: 13px;
    font-weight: 700;
    line-height: 1.2;
}

.tv-maker-composer[data-tv-maker-mode="ai_edit"] .tv-single-upload-card:not(.has-upload-preview) .tac-subtitle {
    display: block;
    margin-top: 2px;
    color: #64748B;
    font-size: 11px;
    font-weight: 500;
    line-height: 1.25;
}

.tv-maker-composer[data-tv-maker-mode="ai_edit"] .tv-single-upload-card.has-upload-preview {
    min-height: 82px;
    padding: 10px 12px !important;
}

.tv-maker-composer[data-tv-maker-mode="ai_edit"] .tv-single-upload-card.has-upload-preview .tac-icon {
    width: 76px;
    min-width: 76px;
    height: 54px;
}

.tv-maker-composer[data-tv-maker-mode="ai_edit"] .tv-single-upload-card.has-upload-preview .tac-title,
.tv-maker-composer[data-tv-maker-mode="ai_edit"] .tv-single-upload-card.has-upload-preview .tac-subtitle {
    display: none;
}

.tv-maker-composer[data-tv-maker-mode="ai_edit"] .tv-single-upload-card.has-upload-preview .tv-maker-audio-upload-btn {
    min-height: 38px;
    padding: 7px 10px;
}

.tv-single-upload-card .tv-maker-avatar-actions {
    margin-top: 8px;
}

.tv-single-upload-card .tv-maker-audio-upload-btn {
    flex: 0 1 320px;
    min-height: 60px;
}

.tv-maker-composer[data-tv-maker-mode="ai_edit"] .tv-single-upload-card .tv-maker-avatar-actions {
    margin-top: 6px;
}

.tv-maker-composer[data-tv-maker-mode="ai_edit"] .tv-single-upload-card:not(.has-upload-preview) .tv-maker-avatar-actions {
    display: none;
}

.tv-maker-composer[data-tv-maker-mode="ai_edit"] .tv-single-upload-card .tv-maker-audio-upload-btn {
    min-height: 46px;
}

.tv-single-upload-card.has-upload-preview {
    display: flex;
    align-items: center;
    gap: 14px;
    min-height: 96px;
    background: #FFFFFF !important;
}

.tv-single-upload-card.has-upload-preview .tac-icon {
    display: flex !important;
    width: 92px;
    min-width: 92px;
    height: 68px;
    border: 1px solid #E2E8F0;
    border-radius: 14px;
    background: linear-gradient(180deg, #F8FBFF 0%, #EEF2FF 100%);
    overflow: hidden;
}

.tv-single-upload-card.has-upload-preview .tac-text {
    align-items: stretch;
    text-align: left;
}

.tv-single-upload-card.has-upload-preview .tac-title {
    display: block;
    margin-bottom: 4px;
    color: #0F172A;
    font-size: 15px;
    font-weight: 700;
}

.tv-single-upload-card.has-upload-preview .tac-subtitle {
    display: block;
    max-width: 100%;
    margin-bottom: 10px;
    color: #64748B;
    font-size: 13px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.tv-single-upload-card.has-upload-preview .tv-maker-avatar-actions {
    justify-content: flex-start;
    margin: 0;
}

.tv-single-upload-card.has-upload-preview .tv-maker-audio-upload-btn {
    flex: 0 1 260px;
    min-height: 44px;
}

.tv-create-upload-shell {
    min-height: 0;
    height: 0;
    padding: 0 !important;
    border: 0 !important;
    overflow: visible;
    background: transparent !important;
    box-shadow: none !important;
}

.tv-create-upload-shell .tac-text,
.tv-create-upload-shell .tac-icon {
    display: none !important;
}

.tv-edit-upload-actions {
    display: block !important;
    margin: 0;
}

.tv-edit-upload-card {
    display: flex;
    align-items: stretch;
    min-height: 314px;
    padding: 10px !important;
    border: 1px solid #D7DCE5 !important;
    border-radius: 24px !important;
    background: #F8FBFF !important;
    box-shadow: none !important;
}

.tv-edit-upload-card .tac-text {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
}

.tv-edit-upload-card .tv-maker-avatar-actions {
    width: 100%;
    height: 100%;
    margin: 0;
}

.tv-edit-upload-card .tv-maker-audio-upload-btn {
    width: 100%;
    min-height: 292px;
    flex: 1 1 100%;
    border: 1px dashed #CAD2DF;
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.52);
    box-shadow: none;
    flex-direction: column;
    gap: 18px;
}

.tv-edit-upload-card .tv-maker-audio-upload-btn:hover,
.tv-edit-upload-card.dragover .tv-maker-audio-upload-btn {
    border-color: #7189FF;
    background: linear-gradient(135deg, rgba(113, 137, 255, 0.08), rgba(131, 12, 131, 0.06));
    transform: none;
}

.tv-edit-upload-card .tv-maker-source-icon {
    width: 78px;
    height: 78px;
    border-radius: 22px;
    color: #7189FF;
    background: linear-gradient(145deg, rgba(113, 137, 255, 0.12), rgba(131, 12, 131, 0.08));
    box-shadow: -32px 10px 0 rgba(113, 137, 255, 0.06);
}

.tv-edit-upload-card .tv-maker-source-icon svg {
    width: 24px;
    height: 24px;
}

.tv-edit-upload-card .tv-maker-source-copy {
    gap: 7px;
}

.tv-edit-upload-card .tv-maker-source-title {
    font-size: 15px;
}

.tv-edit-upload-card .tv-maker-source-hint {
    font-size: 13px;
    color: #6B7280;
}

.tv-maker-presenter-control .tv-maker-source-icon {
    width: 24px;
    height: 24px;
    border-radius: 8px;
    margin: 0;
    background: transparent;
    color: #7189FF;
}

.tv-maker-presenter-control .tv-maker-source-icon svg {
    width: 17px;
    height: 17px;
}

.tv-maker-presenter-control {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    border: none;
    font-family: Outfit, sans-serif;
    font-size: 14px;
    font-weight: 400;
    line-height: normal;
    white-space: nowrap;
}

.tv-maker-presenter-control .theme-label {
    font-size: inherit;
    font-weight: inherit;
    line-height: inherit;
}

.tv-maker-presenter-control.is-open {
    border-color: #7189FF;
    background: #F4F6FF;
}

.tv-maker-composer .box-btn {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: nowrap;
    margin-top: 14px;
}

.tv-maker-composer .box-btn .options {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1 1 auto;
    min-width: 0;
    flex-wrap: nowrap;
    overflow-x: auto;
    scrollbar-width: none;
}

.tv-maker-composer .box-btn .options::-webkit-scrollbar {
    display: none;
}

.tv-maker-composer .option {
    min-height: 42px;
    flex: 0 0 auto;
    border-radius: 12px;
}

.tv-maker-composer .tv-aspect-ratio-control {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    position: relative;
    gap: 2px;
    min-height: 42px;
    padding: 3px;
    border: 1px solid rgba(15, 23, 42, 0.08);
    background: #FFFFFF;
}

.tv-aspect-ratio-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    padding: 0;
    border: 0;
    border-radius: 8px;
    color: #64748B;
    background: transparent;
    cursor: pointer;
}

.tv-aspect-ratio-toggle.is-active {
    color: #0E0F26;
    background: #F1F5F9;
}

.tv-aspect-ratio-toggle svg {
    width: 22px;
    height: 22px;
    pointer-events: none;
}

.tv-aspect-ratio-toggle rect {
    stroke: currentColor;
    stroke-width: 1.8;
}

.tv-aspect-ratio-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    color: #0E0F26;
    pointer-events: none;
}

.tv-aspect-ratio-icon svg {
    width: 22px;
    height: 22px;
}

.tv-aspect-ratio-icon rect {
    stroke: currentColor;
    stroke-width: 1.8;
}

.tv-aspect-ratio-select {
    display: none;
}

.tv-maker-composer .tv-script-image-upload-control {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 42px;
    min-height: 42px;
    padding: 0;
    border: 1px solid rgba(15, 23, 42, 0.08);
    background: #FFFFFF;
    cursor: pointer;
}

.tv-maker-composer[data-tv-maker-mode="ai_edit"] .tv-script-image-upload-control,
.tv-maker-composer[data-tv-maker-mode="ai_edit"] .tv-script-image-preview-container {
    display: none !important;
}

.tv-generative-control {
    display: none !important;
    position: relative;
}

.tv-maker-composer[data-tv-maker-mode="generative"] .tv-generative-control {
    display: inline-flex !important;
}

.tv-maker-composer[data-tv-maker-mode="generative"] #tvGenerativeSoundOption {
    display: none !important;
}

.tv-maker-composer[data-tv-maker-mode="generative"] #tvGenerativeSoundOption.is-visible,
.tv-maker-composer[data-tv-maker-mode="generative"] #tvGenerativeDurationBtn.is-visible {
    display: inline-flex !important;
}

.tv-maker-composer[data-tv-maker-mode="generative"] #tvGenerativeDurationBtn {
    display: none !important;
}

.tv-maker-composer[data-tv-maker-mode="generative"] #tvGenerativeCustomizeBtn.is-hidden {
    display: none !important;
}

.tv-maker-composer[data-tv-maker-mode="generative"] #theme-dropdown-btn,
.tv-maker-composer[data-tv-maker-mode="generative"] #tvAvatarSelectBtn,
.tv-maker-composer[data-tv-maker-mode="generative"] #presenter-background-toggle-btn,
.tv-maker-composer[data-tv-maker-mode="generative"] #presenter-background-dropdown-btn,
.tv-maker-composer[data-tv-maker-mode="generative"] #tvOutroOption {
    display: none !important;
}

.tv-generative-menu {
    position: fixed;
    z-index: 10020;
    min-width: 210px;
    max-width: min(92vw, 320px);
    max-height: min(420px, 70vh);
    overflow: auto;
    padding: 8px;
    border: 1px solid #E6E8EF;
    border-radius: 12px;
    background: #FFFFFF;
    box-shadow: 0 16px 38px rgba(15, 23, 42, 0.16);
}

.tv-generative-menu--wide {
    min-width: 280px;
}

.tv-generative-menu--settings {
    min-width: 240px;
}

.tv-generative-menu-item {
    width: 100%;
    padding: 10px 11px;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: #0F172A;
    text-align: left;
    cursor: pointer;
}

.tv-generative-menu-item:hover,
.tv-generative-menu-item.selected {
    background: #F1F5F9;
}

.tv-generative-menu-item span {
    display: block;
    font-size: 13px;
    font-weight: 800;
}

.tv-generative-menu-item .tv-generative-model-main {
    display: grid;
    grid-template-columns: 28px minmax(0, 1fr);
    gap: 2px 9px;
    align-items: center;
}

.tv-generative-menu-item .tv-generative-model-main strong {
    grid-row: span 2;
    display: inline-flex;
    width: 28px;
    height: 28px;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: #0E0F26;
    color: #FFFFFF;
    font-size: 12px;
    line-height: 1;
}

.tv-generative-menu-item .tv-generative-model-main em {
    color: #64748B;
    font-size: 11px;
    font-style: normal;
    font-weight: 700;
}

.tv-generative-menu-item small {
    display: block;
    margin-top: 2px;
    color: #64748B;
    font-size: 11px;
    line-height: 1.3;
}

.tv-generative-menu-item.is-disabled {
    opacity: 0.48;
    cursor: not-allowed;
}

.tv-generative-setting,
.tv-generative-check {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 8px;
    color: #0F172A;
    font-size: 13px;
    font-weight: 700;
}

.tv-generative-check input {
    order: 2;
    margin-left: auto;
}

.tv-generative-check span {
    order: 1;
}

.tv-generative-setting select {
    height: 32px;
    min-width: 96px;
    border: 1px solid #DDE3EF;
    border-radius: 8px;
    background: #FFFFFF;
    color: #0F172A;
    font-size: 13px;
}

.tv-generative-sound-control {
    align-items: center;
    gap: 8px;
}

.tv-generative-customize-icon {
    display: inline-flex;
    width: 18px;
    height: 18px;
    align-items: center;
    justify-content: center;
}

.tv-generative-customize-icon svg {
    width: 18px;
    height: 18px;
    stroke: #0E0F26;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.tv-generative-toggle {
    position: relative;
    display: inline-flex;
    width: 38px;
    height: 22px;
    margin: 0;
    cursor: pointer;
}

.tv-generative-toggle input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.tv-generative-toggle-track {
    position: absolute;
    inset: 0;
    border-radius: 999px;
    background: #CBD5E1;
    transition: background 0.18s ease;
}

.tv-generative-toggle-thumb {
    position: absolute;
    top: 3px;
    left: 3px;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #FFFFFF;
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.2);
    transition: transform 0.18s ease;
}

.tv-generative-toggle input:checked + .tv-generative-toggle-track {
    background: #0E0F26;
}

.tv-generative-toggle input:checked ~ .tv-generative-toggle-thumb {
    transform: translateX(16px);
}

.tv-generative-toggle input:disabled + .tv-generative-toggle-track,
.tv-generative-toggle input:disabled ~ .tv-generative-toggle-thumb {
    opacity: 0.65;
}

.tv-script-image-upload-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    color: #0E0F26;
    pointer-events: none;
}

.tv-script-image-upload-icon svg {
    width: 22px;
    height: 22px;
}

.tv-script-image-upload-icon rect,
.tv-script-image-upload-icon path,
.tv-script-image-upload-icon circle {
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.tv-script-image-preview-container {
    margin: 0 0 10px;
}

.tv-script-image-preview-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.tv-script-image-thumb {
    position: relative;
    width: 58px;
    height: 58px;
    flex: 0 0 auto;
    overflow: hidden;
    border: 1px solid #E2E8F0;
    border-radius: 10px;
    background: #F8FAFC;
}

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

.tv-script-image-remove {
    position: absolute;
    top: 4px;
    right: 4px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    padding: 0;
    border: 0;
    border-radius: 999px;
    color: #FFFFFF;
    background: rgba(15, 23, 42, 0.82);
    font-size: 14px;
    line-height: 1;
    cursor: pointer;
}

.tv-maker-composer #generateScenesBtn {
    flex: 0 0 auto;
    min-width: 170px;
    min-height: 44px;
    white-space: nowrap;
}

.tv-edit-upload-card.has-upload-preview {
    min-height: 188px;
    gap: 14px;
    padding: 14px !important;
    background: #FFFFFF !important;
}

.tv-edit-upload-card.has-upload-preview .tac-icon {
    display: flex !important;
    width: 190px;
    min-width: 190px;
    height: 160px;
    border: 1px solid #E2E8F0;
    border-radius: 18px;
    background: linear-gradient(180deg, #F8FBFF 0%, #EEF2FF 100%);
    overflow: hidden;
}

.tv-edit-upload-card.has-upload-preview .tac-text {
    align-items: stretch;
}

.tv-edit-upload-card.has-upload-preview .tac-title {
    display: block;
    margin-bottom: 4px;
    color: #0F172A;
    font-size: 15px;
    font-weight: 700;
}

.tv-edit-upload-card.has-upload-preview .tac-subtitle {
    display: block;
    max-width: 100%;
    margin-bottom: 12px;
    color: #64748B;
    font-size: 13px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.tv-edit-upload-card.has-upload-preview .tv-maker-audio-upload-btn {
    min-height: 74px;
    flex-direction: row;
    justify-content: flex-start;
    border-style: solid;
    background: #F8FAFC;
}

.tv-edit-upload-card.has-upload-preview .tv-maker-audio-upload-btn .tv-maker-source-icon {
    width: 42px;
    height: 42px;
    border-radius: 14px;
    box-shadow: none;
}

.tv-edit-upload-card.has-upload-preview .tv-maker-audio-upload-btn .tv-maker-source-copy {
    text-align: left;
}

.tv-maker-feedback-toast {
    position: fixed;
    top: 88px;
    right: 24px;
    z-index: 1400;
    width: min(420px, calc(100vw - 32px));
}

.tv-maker-feedback-toast.is-visible {
    display: block !important;
    animation: tv-maker-feedback-toast-in 0.2s ease-out;
}

.tv-maker-feedback-toast-inner {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 14px 16px;
    border-radius: 16px;
    border: 1px solid #FECACA;
    background: rgba(255, 255, 255, 0.98);
    box-shadow: 0 22px 45px rgba(15, 23, 42, 0.18);
    backdrop-filter: blur(10px);
}

.tv-maker-feedback-toast.warning .tv-maker-feedback-toast-inner {
    border-color: #FDE68A;
}

.tv-maker-feedback-icon {
    width: 24px;
    height: 24px;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 24px;
    font-size: 13px;
    font-weight: 700;
    background: #FEF2F2;
    color: #DC2626;
}

.tv-maker-feedback-toast.warning .tv-maker-feedback-icon {
    background: #FFFBEB;
    color: #D97706;
}

.tv-maker-feedback-message {
    flex: 1;
    color: #0F172A;
    font-size: 14px;
    line-height: 1.45;
    padding-top: 1px;
}

.tv-maker-feedback-close {
    border: none;
    background: transparent;
    color: #6B7280;
    font-size: 20px;
    line-height: 1;
    cursor: pointer;
    padding: 0;
    margin-top: -1px;
}

.tv-maker-feedback-close:hover {
    color: #0F172A;
}

.tv-inline-error {
    border-color: #EF4444 !important;
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.16) !important;
}

.tac-card.tv-inline-error,
.option.tv-inline-error,
.tv-custom-theme-upload-area.tv-inline-error,
#generateScenesBtn.tv-inline-error {
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.04), rgba(248, 113, 113, 0.08));
}

.tv-inline-error-shake {
    animation: tv-inline-error-shake 0.28s ease-out;
}

@keyframes tv-maker-feedback-toast-in {
    from {
        opacity: 0;
        transform: translate3d(0, -10px, 0);
    }
    to {
        opacity: 1;
        transform: translate3d(0, 0, 0);
    }
}

@keyframes tv-inline-error-shake {
    0% { transform: translateX(0); }
    25% { transform: translateX(-3px); }
    50% { transform: translateX(3px); }
    75% { transform: translateX(-2px); }
    100% { transform: translateX(0); }
}

/* Ensure button card has relative positioning for popup */
#upload-avatar-btn {
    position: relative;
    justify-content: center;
    width: 100%;
    box-sizing: border-box;
}

#upload-avatar-btn .tac-text {
    display: flex;
    flex-direction: column;
    align-items: center;
    flex: 1 1 auto;
    min-width: 0;
}

#upload-avatar-btn.dragover {
    border-color: #405DE6;
    background: linear-gradient(135deg, rgba(64, 93, 230, 0.08), rgba(59, 130, 246, 0.12));
    box-shadow: 0 0 0 3px rgba(64, 93, 230, 0.12);
}

#upload-avatar-btn.dragover .tac-title,
#upload-avatar-btn.dragover .tac-subtitle {
    color: #1D4ED8;
}

#upload-slides-btn .tac-icon {
    position: relative;
    overflow: hidden;
}

#upload-avatar-btn .tac-icon {
    position: relative;
    overflow: hidden;
    display: none;
}

.tv-maker-composer[data-tv-maker-mode="ai_edit"] #upload-avatar-btn:not(.has-upload-preview) .tac-icon {
    display: inline-flex;
    width: 44px;
    min-width: 44px;
    height: 44px;
    border-radius: 14px;
    background: #EEF2FF;
}

#upload-avatar-btn.has-upload-preview .tac-icon {
    display: flex;
}

.tv-maker-avatar-actions {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: nowrap;
    gap: 10px;
    margin: 12px auto 0;
    width: fit-content;
    max-width: 100%;
}

.tv-maker-avatar-select-btn {
    border: 1px solid #E2E8F0;
    background: linear-gradient(180deg, #FFFFFF 0%, #F8FAFC 100%);
    color: #0F172A;
    border-radius: 14px;
    padding: 10px 12px;
    min-height: 66px;
    cursor: pointer;
    transition: border-color 0.18s ease, background 0.18s ease, box-shadow 0.18s ease, transform 0.18s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    flex: 0 0 280px;
    text-align: center;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.06);
}

.tv-maker-audio-upload-btn {
    background: linear-gradient(180deg, #FFFFFF 0%, #F8FAFC 100%);
}

#tvAvatarSelectBtn {
    border-color: #BFDBFE;
    background: linear-gradient(180deg, #F8FBFF 0%, #FFFFFF 100%);
}

.tv-maker-source-icon {
    width: 34px;
    height: 34px;
    border-radius: 11px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 34px;
    background: #EEF2FF;
    color: #405DE6;
}

#tvAvatarSelectBtn .tv-maker-source-icon {
    background: #ECFDF5;
    color: #047857;
}

.tv-maker-source-icon svg {
    width: 19px;
    height: 19px;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.tv-maker-source-copy {
    display: grid;
    gap: 3px;
    min-width: 0;
    text-align: center;
}

.tv-maker-source-title {
    color: #0F172A;
    font-size: 13px;
    font-weight: 700;
    line-height: 1.15;
}

.tv-maker-source-hint {
    color: #64748B;
    font-size: 11px;
    font-weight: 500;
    line-height: 1.25;
    white-space: normal;
}

.tv-maker-avatar-or {
    color: #64748B;
    background: #F1F5F9;
    border: 1px solid #E2E8F0;
    border-radius: 999px;
    width: 28px;
    height: 28px;
    align-self: center;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 700;
    line-height: 1;
    padding: 0;
}

.tv-maker-avatar-select-btn--coming-soon {
    margin-left: auto;
    background: #F8FAFC;
    color: #64748B;
    border-style: dashed;
    cursor: pointer;
    box-shadow: none;
}

.tv-maker-avatar-select-btn--coming-soon:hover {
    background: #F8FAFC;
    color: #64748B;
    border-color: #D1D5DB;
    box-shadow: none;
}

.tv-maker-avatar-select-btn:hover {
    border-color: #A5B4FC;
    box-shadow: 0 8px 18px rgba(15, 23, 42, 0.08), 0 0 0 3px rgba(99, 102, 241, 0.08);
    transform: translateY(-1px);
}

.tv-maker-avatar-select-btn.is-open {
    background: #EEF2FF;
    border-color: #818CF8;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.12);
}

.tv-maker-avatar-select-caret {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #475569;
}

.tv-maker-selected-avatar-chip {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 1 0 100%;
    gap: 8px;
    max-width: 180px;
    border: 1px solid #BFDBFE;
    background: #EFF6FF;
    color: #1E3A8A;
    border-radius: 12px;
    padding: 5px 8px 5px 5px;
    box-shadow: 0 1px 2px rgba(30, 58, 138, 0.08);
}

.tv-maker-selected-avatar-chip img {
    width: 26px;
    height: 26px;
    border-radius: 9px;
    object-fit: cover;
    flex: 0 0 26px;
    background: #DBEAFE;
}

.tv-maker-selected-avatar-name {
    font-size: 12px;
    font-weight: 600;
    line-height: 1.2;
    max-width: 140px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.tv-maker-selected-avatar-clear {
    border: none;
    background: transparent;
    color: #1E3A8A;
    width: 18px;
    height: 18px;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    font-size: 16px;
    line-height: 1;
    cursor: pointer;
}

.tv-maker-selected-avatar-clear:hover {
    background: rgba(30, 58, 138, 0.12);
}

.tv-maker-popup-option-copy {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.tv-maker-coming-soon-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 3px 7px;
    border-radius: 999px;
    background: #FEF3C7;
    color: #92400E;
    font-size: 10px;
    font-weight: 700;
    line-height: 1;
    letter-spacing: 0.02em;
    text-transform: uppercase;
}

.tv-maker-coming-soon-badge--inline {
    margin-left: 2px;
}

.tv-inline-theme-library-section {
    margin-top: 24px;
}

.tv-inline-theme-library {
    margin-top: 0;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
    display: flex;
    flex-direction: column;
}

.tv-inline-theme-library-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 16px;
}

.tv-inline-theme-library-title {
    font-size: 18px;
    font-weight: 700;
    line-height: 1.2;
    color: #0F172A;
}

.tv-inline-theme-library-subtitle {
    margin-top: 6px;
    font-size: 13px;
    line-height: 1.5;
    color: #64748B;
}

.tv-inline-theme-tabs {
    display: flex;
    gap: 0;
    border-bottom: 1.5px solid #E5E7EB;
    margin-bottom: 8px;
}

.tv-theme-tag-filter {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 4px 0 12px;
}

.tv-theme-tag-filter-btn {
    border: 1px solid #D7DCE5;
    background: #FFFFFF;
    color: #475569;
    border-radius: 999px;
    padding: 6px 11px;
    font-size: 12px;
    font-weight: 600;
    line-height: 1;
    cursor: pointer;
    transition: border-color 0.15s ease, background-color 0.15s ease, color 0.15s ease;
}

.tv-theme-tag-filter-btn:hover {
    border-color: #A5B4FC;
    color: #312E81;
}

.tv-theme-tag-filter-btn.active {
    background: #111827;
    border-color: #111827;
    color: #FFFFFF;
}

.tv-inline-theme-tab {
    background: none;
    border: none;
    padding: 10px 18px;
    font-size: 14px;
    font-weight: 500;
    color: #6B7280;
    cursor: pointer;
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: color 0.2s ease;
}

.tv-inline-theme-tab:hover {
    color: #0F172A;
}

.tv-inline-theme-tab.active {
    color: #0F172A;
    font-weight: 600;
}

.tv-inline-theme-tab.active::after {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    bottom: -1.5px;
    height: 2px;
    background: #0F172A;
    border-radius: 2px 2px 0 0;
}

.tv-inline-theme-panel {
    display: none;
}

.tv-inline-theme-panel.active {
    display: block;
}

.tv-inline-theme-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px;
    padding-top: 8px;
}

.tv-inline-theme-library .tv-theme-card {
    min-width: 0;
}

.tv-inline-theme-library .tv-inline-theme-lazy-hidden {
    display: none !important;
}

.tv-inline-theme-library .tv-theme-card-preview img {
    height: 100%;
}

.tv-create-style-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 210px;
    padding: 18px;
    border: 1px dashed #CBD5E1;
    border-radius: 8px;
    color: #0F172A;
    background: #FFFFFF;
    text-align: center;
    text-decoration: none;
    transition: border-color 0.15s ease, background-color 0.15s ease;
}

.tv-create-style-card:hover {
    border-color: #0F172A;
    background: #F8FAFC;
    color: #0F172A;
    text-decoration: none;
}

.tv-create-style-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    margin-bottom: 10px;
    border-radius: 999px;
    background: #0F172A;
    color: #FFFFFF;
    font-size: 24px;
    font-weight: 500;
    line-height: 1;
}

.tv-create-style-title {
    color: #0F172A;
    font-size: 14px;
    font-weight: 700;
    line-height: 1.2;
}

.tv-create-style-copy {
    margin-top: 5px;
    color: #64748B;
    font-size: 12px;
    font-weight: 600;
    line-height: 1.2;
}

.tv-create-style-card--modal {
    display: none;
}

.tv-theme-modal-backdrop[data-active-section="my"] .tv-create-style-card--modal {
    display: flex;
}

.tv-voiceover-confirm-modal {
    max-width: 520px;
}

.tv-voiceover-confirm-copy {
    padding: 4px 2px 6px;
    color: #475569;
    font-size: 15px;
    line-height: 1.6;
}

/* Responsive positioning for avatar popup */
@media (max-width: 768px) {
    .tv-maker-feedback-toast {
        top: 76px;
        right: 16px;
        left: 16px;
        width: auto;
    }

    .tv-maker-avatar-actions {
        flex-wrap: wrap;
        gap: 8px;
        margin-top: 8px;
    }

    .tv-maker-avatar-or {
        margin: -2px 0;
    }

    .tv-maker-selected-avatar-chip {
        max-width: 100%;
    }
}

/* Wavel avatar tooltip - inherits from .ai-twin-tooltip class */
#wavel-avatar-tooltip {
    display: none;
    /* Will be positioned dynamically via JavaScript */
}

#wavel-avatar-tooltip .grid .card {
    cursor: pointer;
    transition: all 0.2s ease;
}

#wavel-avatar-tooltip .grid .card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

#wavel-avatar-tooltip .grid .card.selected {
    border-color: #405DE6;
    box-shadow: 0 0 0 2px rgba(64, 93, 230, 0.2);
}

/* Ensure avatar cards display images and names properly */
#wavel-avatar-tooltip .grid .card {
    min-height: 188px;
    display: flex;
    flex-direction: column;
}

#wavel-avatar-tooltip .grid .card img {
    width: 100%;
    height: auto;
    min-height: 120px;
    object-fit: cover;
    border-radius: 8px;
    display: block;
    background: #f8fafc;
}

#wavel-avatar-tooltip .grid .tv-avatar-preview-media {
    position: relative;
    width: 100%;
    min-height: 120px;
    overflow: hidden;
    border-radius: 8px;
    background: #f8fafc;
}

#wavel-avatar-tooltip .grid .tv-avatar-preview-media img,
#wavel-avatar-tooltip .grid .tv-avatar-preview-media video {
    width: 100%;
    height: 120px;
    min-height: 120px;
    object-fit: cover;
    border-radius: 8px;
    display: block;
}

#wavel-avatar-tooltip .grid .tv-avatar-preview-video {
    position: absolute;
    inset: 0;
    z-index: 1;
    opacity: 0;
    pointer-events: none;
    background: #f8fafc;
    transition: opacity 0.18s ease;
}

#wavel-avatar-tooltip .grid .tv-avatar-preview-media:hover .tv-avatar-preview-video,
#wavel-avatar-tooltip .grid .tv-avatar-preview-media:focus-within .tv-avatar-preview-video,
#wavel-avatar-tooltip .grid .tv-avatar-group-thumb:hover .tv-avatar-preview-video,
#wavel-avatar-tooltip .grid .tv-avatar-group-thumb:focus-within .tv-avatar-preview-video,
#wavel-avatar-tooltip .grid .tv-avatar-look-thumb:hover .tv-avatar-preview-video,
#wavel-avatar-tooltip .grid .tv-avatar-look-thumb:focus-within .tv-avatar-preview-video {
    opacity: 1;
}

#wavel-avatar-tooltip .grid .name {
    font-size: 12px;
    margin-top: 6px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 4px;
}

#wavel-avatar-tooltip .grid .name span {
    flex: 1;
    text-align: left;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

#wavel-avatar-tooltip .grid .tv-avatar-group-card {
    min-height: 0;
    padding: 0;
    overflow: hidden;
    border: 1px solid rgba(135, 154, 185, 0.22);
    background: #ffffff;
    box-shadow: 0 18px 38px rgba(15, 23, 42, 0.08);
}

#wavel-avatar-tooltip .grid .tv-avatar-group-thumb {
    position: relative;
    aspect-ratio: 3 / 4;
    background: #f8fafc;
}

#wavel-avatar-tooltip .grid .tv-avatar-group-thumb img {
    width: 100%;
    height: 100%;
    min-height: 0;
    object-fit: cover;
    border-radius: 0;
}

#wavel-avatar-tooltip .grid .tv-avatar-group-thumb .tv-avatar-preview-video,
#wavel-avatar-tooltip .grid .tv-avatar-look-thumb .tv-avatar-preview-video {
    width: 100%;
    height: 100%;
    min-height: 0;
    object-fit: cover;
    border-radius: 0;
}

#wavel-avatar-tooltip .grid .tv-avatar-group-name {
    margin-top: 0;
    padding: 12px 12px 6px;
    justify-content: center;
}

#wavel-avatar-tooltip .grid .tv-avatar-group-name span {
    text-align: center;
    white-space: normal;
    line-height: 1.35;
    font-weight: 600;
}

#wavel-avatar-tooltip .grid .tv-avatar-group-action {
    margin: 0 12px 12px;
    border-radius: 999px;
    background: #f8fafc;
    color: #334155;
    font-size: 12px;
    font-weight: 600;
    line-height: 1;
    text-align: center;
    padding: 8px 10px;
}

.tv-avatar-look-count {
    position: absolute;
    top: 10px;
    left: 10px;
    z-index: 2;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 26px;
    padding: 0 10px;
    border-radius: 999px;
    background: rgba(15, 23, 42, 0.72);
    color: #ffffff;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.01em;
    backdrop-filter: blur(8px);
}

.tv-avatar-looks-inline {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 12px;
}

.tv-avatar-looks-back {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    border: 1px solid #E5E7EB;
    border-radius: 999px;
    background: #F8FAFC;
    color: #0F172A;
    font-size: 12px;
    font-weight: 600;
    line-height: 1;
    padding: 8px 12px;
    cursor: pointer;
    transition: background 0.18s ease, border-color 0.18s ease;
}

.tv-avatar-looks-back:hover {
    background: #EEF2FF;
    border-color: #C7D2FE;
}

.tv-avatar-looks-copy {
    flex: 1;
    min-width: 0;
}

.tv-avatar-looks-title {
    color: #0F172A;
    font-size: 15px;
    font-weight: 600;
    line-height: 1.25;
}

.tv-avatar-looks-grid-inline {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.tv-avatar-looks-subtitle {
    margin: 0;
    color: #64748b;
    font-size: 12px;
    line-height: 1.45;
}

.tv-avatar-look-card {
    border: 1px solid #e5e7eb;
    border-radius: 18px;
    background: #ffffff;
    padding: 0;
    overflow: hidden;
    text-align: left;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
    width: 150px;
    flex: 0 0 150px;
}

.tv-avatar-look-card:hover {
    transform: translateY(-3px);
    border-color: rgba(79, 70, 229, 0.28);
    box-shadow: 0 18px 40px rgba(15, 23, 42, 0.12);
}

.tv-avatar-look-card.is-selected {
    border-color: #405DE6;
    box-shadow: 0 0 0 2px rgba(64, 93, 230, 0.16);
}

.tv-avatar-look-thumb {
    position: relative;
    aspect-ratio: 3 / 4;
    background: #f8fafc;
}

.tv-avatar-look-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.tv-avatar-look-name {
    padding: 14px 14px 16px;
    font-size: 14px;
    font-weight: 600;
    color: #111827;
    line-height: 1.4;
}

#avatar-selected-image {
    display: none;
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 12px;
}

#avatar-selected-video {
    display: none;
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 12px;
    background: #000;
}

.avatar-remove-btn {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 20px;
    height: 20px;
    border: none;
    border-radius: 50%;
    background: rgba(14, 15, 38, 0.85);
    color: #fff;
    font-size: 14px;
    line-height: 1;
    display: none;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 3;
}

.avatar-remove-btn:hover {
    background: rgba(14, 15, 38, 1);
}

.slides-selected-badge {
    display: none;
    width: 100%;
    height: 100%;
    border-radius: 12px;
    background: linear-gradient(135deg, #eef2ff 0%, #dbeafe 100%);
    color: #1f2937;
    font-size: 11px;
    font-weight: 700;
    align-items: center;
    justify-content: center;
    letter-spacing: 0.3px;
}

.slides-remove-btn {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 20px;
    height: 20px;
    border: none;
    border-radius: 50%;
    background: rgba(14, 15, 38, 0.85);
    color: #fff;
    font-size: 14px;
    line-height: 1;
    display: none;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 3;
}

.slides-remove-btn:hover {
    background: rgba(14, 15, 38, 1);
}

/* Dropdown menus */
#theme-menu,
#language-menu,
#voice-menu {
    display: none;
    background: #ffffff;
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(15, 23, 42, 0.12);
    padding: 8px 0;
    border: 1px solid #E5E7EB;
}

#language-menu.tv-floating-menu {
    position: fixed;
    z-index: 10020;
    min-width: 220px;
    max-width: min(92vw, 320px);
    max-height: min(420px, 70vh);
    overflow: auto;
}

/* Bottom controls container */
.box-btn {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 16px;
}

.box-btn .options {
    display: flex;
    gap: 12px;
}

/* Option buttons */
.option {
    position: relative;
}

.tv-outro-select {
    width: 176px;
    min-width: 176px;
    max-width: min(28vw, 176px);
    height: auto;
    padding: 0 18px 0 0;
    border: none;
    border-radius: 0;
    background-color: transparent;
    color: #0E0F26;
    font-size: 13px;
    font-weight: 500;
    line-height: 1.2;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg width='14' height='14' viewBox='0 0 20 20' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M6 8l4 4 4-4' stroke='%230E0F26' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0 center;
    background-size: 14px 14px;
    cursor: pointer;
    transition: color 0.18s ease, opacity 0.18s ease;
}

.tv-outro-select:hover {
    background-color: transparent;
    color: #0E0F26;
}

.tv-outro-select:focus {
    outline: none;
    box-shadow: none;
}

/* Toggle button inside option container */
.option .tv-theme-toggle {
    padding: 0;
    margin: 0;
    border: none;
    background: transparent;
}

/* Theme icon container */
.theme-icon-container {
    display: inline-flex;
    align-items: center;
    margin-right: 6px;
}

/* Voice icon container */
.voice-icon-container {
    display: inline-flex;
    align-items: center;
    margin-right: 6px;
}

/* Voice avatar icon */
#voice-dropdown-btn > span:first-child {
    display: inline-flex;
    align-items: center;
    margin-right: 6px;
}

.voice-avatar-icon {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #5B6CFF;
    color: white;
    font-size: 10px;
    font-weight: 600;
}

.voice-avatar-icon.emily {
    background: #FF6B35;
}

.voice-avatar-icon.sarah {
    background: #8B5CF6;
}

.voice-avatar-icon.lisa {
    background: #10B981;
}

.voice-avatar-icon.john {
    background: #3B82F6;
}

.voice-avatar-icon.michael {
    background: #EF4444;
}

.tv-voice-tooltip-backdrop {
    position: fixed;
    inset: 0;
    z-index: 10050;
    display: none;
    align-items: center;
    justify-content: center;
    background: rgba(14, 15, 38, 0.28);
}

.tv-voice-tooltip {
    position: relative;
    display: block;
    width: min(94vw, 640px);
    max-width: min(94vw, 640px);
    max-height: min(86vh, 720px);
    overflow: hidden;
    background: #fff;
    border: 1px solid #E5E7EB;
    border-radius: 10px;
    box-shadow: 0 24px 70px rgba(15, 23, 42, 0.24);
    padding: 14px;
}

.tv-voice-tooltip .vt-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    color: #0E0F26;
    font-size: 18px;
    font-weight: 700;
    margin-bottom: 8px;
}

.tv-voice-tooltip .vt-close-btn {
    width: 28px;
    height: 28px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: none;
    background: transparent;
    border-radius: 6px;
    cursor: pointer;
}

.tv-voice-tooltip .vt-close-btn:hover {
    background: #F3F4F6;
}

.tv-voice-section-label {
    color: #666;
    font-size: 12px;
    font-weight: 500;
    margin: 8px 0;
}

.tv-voice-ai-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
}

.tv-voice-tooltip .vt-ai-card {
    position: relative;
    min-height: 84px;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 5px;
    padding: 12px 36px 12px 14px;
    border: 1px solid #E6E6E6;
    border-radius: 10px;
    background: #fff;
    color: #0E0F26;
    text-align: left;
    cursor: pointer;
}

.tv-voice-tooltip .vt-ai-card.selected {
    border: 2px solid #0E0F26;
    background: #F4F4F5;
}

.tv-voice-tooltip .vt-ai-checkmark {
    position: absolute;
    top: 10px;
    right: 10px;
}

.tv-voice-tooltip .vt-ai-title {
    font-size: 14px;
    font-weight: 700;
}

.tv-voice-tooltip .vt-ai-subtitle {
    color: #666;
    font-size: 12px;
    line-height: 1.35;
}

.tv-voice-search-row {
    position: relative;
    margin-bottom: 10px;
}

.tv-voice-search-row::before {
    content: "";
    position: absolute;
    left: 12px;
    top: 50%;
    width: 14px;
    height: 14px;
    transform: translateY(-50%);
    background: center / contain no-repeat url("data:image/svg+xml,%3Csvg width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%236B7280' stroke-width='2' stroke-linecap='round' stroke-linejoin='round' xmlns='http://www.w3.org/2000/svg'%3E%3Ccircle cx='11' cy='11' r='8'/%3E%3Cpath d='m21 21-4.3-4.3'/%3E%3C/svg%3E");
    pointer-events: none;
}

.tv-voice-search-row input {
    height: 38px;
    padding-left: 34px;
    border-radius: 7px;
    border-color: #D7DBE3;
}

.tv-voice-tooltip #tvVoiceTooltipCategories {
    position: relative;
    display: flex;
    align-items: center;
    margin-bottom: 8px;
}

.tv-voice-tooltip .vt-cat-wrap {
    display: flex;
    gap: 6px;
    overflow: auto;
    white-space: nowrap;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.tv-voice-tooltip .vt-cat-wrap::-webkit-scrollbar {
    display: none;
}

.tv-voice-tooltip .vt-cat-nav {
    width: 22px;
    height: 22px;
    flex: 0 0 22px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: none;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 1px 4px rgba(15, 23, 42, 0.18);
}

.tv-voice-tooltip .vt-cat {
    flex: 0 0 auto;
    padding: 6px 10px;
    border: 1px solid #E6E6E6;
    border-radius: 14px;
    background: #F3F4F6;
    color: #0E0F26;
    font-size: 12px;
    font-weight: 600;
    line-height: 1;
    text-transform: uppercase;
}

.tv-voice-tooltip .vt-cat.active {
    background: #0E0F26;
    border-color: #0E0F26;
    color: #fff;
}

.tv-voice-tooltip .vt-loader {
    width: 100%;
    display: flex;
    justify-content: center;
    padding: 8px 0;
}

.tv-voice-tooltip .vt-loader .spinner {
    width: 16px;
    height: 16px;
    border: 2px solid #E5E7EB;
    border-top: 2px solid #405DE6;
    border-radius: 50%;
    animation: spin 0.9s linear infinite;
}

.tv-voice-tooltip .vt-cols {
    display: flex;
    gap: 14px;
    max-height: min(45vh, 350px);
    overflow: hidden;
}

.tv-voice-tooltip .vt-left,
.tv-voice-tooltip .vt-right {
    flex: 1;
    min-width: 0;
    max-height: min(45vh, 350px);
    overflow: auto;
    padding-right: 4px;
}

.tv-voice-tooltip .vt-group-title {
    color: #666;
    font-size: 12px;
    font-weight: 500;
    margin: 8px 2px 4px;
    text-transform: uppercase;
}

.tv-voice-tooltip .vt-right .vt-group-title {
    text-transform: none;
}

.tv-voice-tooltip .vt-card {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px;
    border: 1px solid transparent;
    border-radius: 8px;
    background: #fff;
    color: #0E0F26;
    text-align: left;
    cursor: pointer;
}

.tv-voice-tooltip .vt-card:hover,
.tv-voice-tooltip .vt-card.selected {
    background: #F4F4F5;
}

.tv-voice-tooltip .vt-card.selected {
    border-color: #DADDE5;
}

.tv-voice-tooltip .vt-avatar {
    width: 28px;
    height: 28px;
    flex: 0 0 28px;
    border-radius: 50%;
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 700;
}

.tv-voice-card-copy {
    min-width: 0;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.tv-voice-tooltip .vt-name {
    color: #0E0F26;
    font-size: 14px;
    font-weight: 700;
    line-height: 1.2;
}

.tv-voice-tooltip .vt-desc {
    color: #666;
    font-size: 12px;
    line-height: 1.25;
}

.tv-voice-tooltip .vt-play {
    width: 24px;
    height: 24px;
    flex: 0 0 24px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: none;
    border-radius: 50%;
    background: #0E0F26;
    color: #fff;
    font-size: 10px;
}

.tv-voice-empty {
    color: #666;
    font-size: 13px;
    padding: 18px 4px;
    text-align: center;
}

/* Voice menu items */
#voice-menu .qs-item .left > div {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 10px;
    font-weight: 600;
}

@media (max-width: 640px) {
    .tv-voice-tooltip {
        width: calc(100vw - 20px);
        max-height: calc(100vh - 28px);
        padding: 12px;
    }

    .tv-voice-ai-grid,
    .tv-voice-tooltip .vt-cols {
        grid-template-columns: 1fr;
        flex-direction: column;
    }

    .tv-voice-tooltip .vt-left,
    .tv-voice-tooltip .vt-right,
    .tv-voice-tooltip .vt-cols {
        max-height: none;
    }
}

/* Generate button */
#generateScenesBtn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 12px;
    border-radius: 12px;
    background: linear-gradient(135deg, #405DE6 -0.74%, #833AB4 99.26%);
    border: none;
    color: #fff;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: opacity 0.2s;
}

/* Click feedback on primary maker actions */
#generateScenesBtn,
.avatar-remove-btn,
.slides-remove-btn {
    transition: transform 0.12s ease, box-shadow 0.12s ease, filter 0.12s ease;
}

#generateScenesBtn:active:not(:disabled),
.avatar-remove-btn:active:not(:disabled),
.slides-remove-btn:active:not(:disabled) {
    transform: translateY(1px) scale(0.98);
    filter: brightness(0.97);
}

#generateScenesBtn:hover {
    opacity: 0.9;
}

#generateScenesBtn.generate-btn--locked {
    background: linear-gradient(135deg, #64748B 0%, #475569 100%);
    cursor: not-allowed;
}

#generateScenesBtn.generate-btn--locked:hover {
    opacity: 1;
}

#generateScenesBtn .generate-btn-lock {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    opacity: 0.92;
}

#generateScenesBtn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Character count colors */
#char-count {
    color: #666;
}

#char-count.warning {
    color: #F59E0B;
}

#char-count.danger {
    color: #EF4444;
}

/* File preview delete button */
.uploaded-file-item .delete-btn {
    position: absolute;
    top: 5px;
    right: 5px;
    width: 20px;
    height: 20px;
    background: rgba(255, 255, 255, 0.9);
    border: none;
    border-radius: 50%;
    cursor: pointer;
    font-size: 16px;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.uploaded-file-item .delete-btn:hover {
    background: rgba(255, 68, 68, 0.9);
    color: white;
}

/* File preview item */
.uploaded-file-item {
    position: relative;
    width: 80px;
    height: 80px;
    flex-shrink: 0;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid #dee2e6;
}

.uploaded-file-item img,
.uploaded-file-item video {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.uploaded-file-item .file-preview-content {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #F5F6FA;
    flex-direction: column;
    gap: 4px;
}

.uploaded-file-item .file-preview-content span {
    font-size: 10px;
    color: #676768;
}

/* Responsive */
@media (max-width: 768px) {
    .box-btn {
        flex-direction: column;
        gap: 12px;
    }

    .box-btn .options {
        width: 100%;
        flex-wrap: wrap;
    }

    .tv-outro-select {
        min-width: 0;
        width: 100%;
        max-width: none;
    }

    #generateScenesBtn {
        width: 100%;
    }
}

/* Language search bar styling */
.lang-menu .lang-search-wrapper {
    padding: 6px 10px 4px;
    border-bottom: 1px solid #F3F4F6;
}

.lang-menu .lang-search-input {
    width: 100%;
    padding: 6px 10px;
    border-radius: 999px;
    border: 1px solid #D1D5DB;
    font-size: 12px;
    outline: none;
    background-color: #F9FAFB;
    transition: border-color 0.15s ease, box-shadow 0.15s ease, background-color 0.15s ease;
}

.lang-menu .lang-search-input::placeholder {
    color: #9CA3AF;
}

.lang-menu .lang-search-input:focus {
    border-color: #4F46E5;
    background-color: #FFFFFF;
    box-shadow: 0 0 0 1px rgba(79, 70, 229, 0.25);
}

/* Theme selection modal */
.tv-theme-modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.45);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1050;
}

.tv-theme-modal {
    background: #ffffff;
    border-radius: 18px;
    padding: 20px 24px 18px;
    max-width: 880px;
    width: 100%;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 22px 45px rgba(15, 23, 42, 0.25);
}

.tv-theme-library-modal {
    width: min(1280px, 97vw);
    height: min(860px, 92vh);
    max-width: none;
    max-height: 92vh;
    padding: 0;
    border-radius: 14px;
    display: grid;
    grid-template-columns: 294px minmax(0, 1fr);
    overflow: hidden;
}

.tv-theme-library-sidebar {
    border-right: 1px solid #eef0f4;
    padding: 16px 14px;
    overflow: auto;
    background: #fff;
}

.tv-theme-library-main {
    display: flex;
    flex-direction: column;
    min-width: 0;
    min-height: 0;
    overflow: hidden;
    background: #fff;
}

.tv-theme-library-searchbar {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 22px 12px;
    border-bottom: 1px solid #f2f3f6;
}

.tv-theme-library-search-wrap {
    flex: 1;
    min-width: 0;
    height: 32px;
    border-radius: 8px;
    background: #f1f1f3;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 0 12px;
    color: #6b7280;
}

.tv-theme-library-search-wrap svg {
    width: 15px;
    height: 15px;
    flex: 0 0 15px;
}

.tv-theme-library-search-input {
    border: 0;
    outline: 0;
    background: transparent;
    color: #171923;
    font-size: 13px;
    line-height: 1;
    width: 100%;
    min-width: 0;
}

.tv-theme-library-close {
    width: 34px;
    height: 34px;
    border: 0;
    border-radius: 8px;
    background: #f3f4f6;
    color: #2f3441;
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
}

.tv-theme-library-nav {
    display: grid;
    gap: 6px;
    padding-bottom: 18px;
    margin-bottom: 18px;
    border-bottom: 1px solid #eef0f4;
}

.tv-theme-library-nav-btn {
    border: 0;
    width: 100%;
    min-height: 40px;
    border-radius: 8px;
    background: transparent;
    color: #171923;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0 10px;
    text-align: left;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
}

.tv-theme-library-nav-btn svg {
    width: 16px;
    height: 16px;
    flex: 0 0 16px;
}

.tv-theme-library-nav-btn.is-active {
    background: #f1f1f3;
    font-weight: 700;
}

.tv-theme-library-categories-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 12px;
}

.tv-theme-library-categories-title {
    margin: 0;
    color: #171923;
    font-size: 14px;
    font-weight: 700;
}

.tv-theme-library-categories-clear {
    border: 0;
    background: transparent;
    color: #171923;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    padding: 0;
}

.tv-theme-library-categories {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
}

.tv-theme-library-category-btn {
    border: 1px solid #e5e7eb;
    border-radius: 999px;
    background: #fff;
    color: #30343d;
    font-size: 13px;
    line-height: 1;
    min-height: 28px;
    padding: 0 10px;
    cursor: pointer;
}

.tv-theme-library-category-btn.is-active {
    background: #171923;
    border-color: #171923;
    color: #fff;
}

.tv-theme-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}

.tv-theme-modal-title {
    font-size: 18px;
    font-weight: 600;
    color: #0F172A;
}

.tv-theme-modal-close {
    border: none;
    background: transparent;
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
    color: #4B5563;
    padding: 4px;
}

/* Theme modal tabs */
.tv-theme-tabs {
    display: flex;
    gap: 0;
    border-bottom: 1.5px solid #E5E7EB;
    margin-bottom: 4px;
}

.tv-theme-tab {
    background: none;
    border: none;
    padding: 10px 20px;
    font-size: 14px;
    font-weight: 500;
    color: #6B7280;
    cursor: pointer;
    position: relative;
    transition: color 0.2s;
}

.tv-theme-tab:hover {
    color: #0F172A;
}

.tv-theme-tab.active {
    color: #0F172A;
    font-weight: 600;
}

.tv-theme-tab.active::after {
    content: '';
    position: absolute;
    bottom: -1.5px;
    left: 0;
    right: 0;
    height: 2px;
    background: #0F172A;
    border-radius: 2px 2px 0 0;
}

.tv-theme-tab-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 20px;
    height: 20px;
    padding: 0 6px;
    border-radius: 10px;
    background: #E5E7EB;
    color: #374151;
    font-size: 11px;
    font-weight: 600;
    margin-left: 6px;
}

.tv-theme-tab.active .tv-theme-tab-count {
    background: #0F172A;
    color: #fff;
}

/* Disabled theme card (pending/failed) */
.tv-theme-card--disabled {
    opacity: 0.55;
    cursor: not-allowed;
    pointer-events: none;
}

/* Status badges inside card label */
.tv-theme-status-badge {
    display: inline-block;
    padding: 1px 8px;
    border-radius: 12px;
    font-size: 10px;
    font-weight: 600;
    margin-left: 6px;
    vertical-align: middle;
}
.tv-theme-status-pending {
    background: #FEF3C7;
    color: #92400E;
}
.tv-theme-status-failed {
    background: #FEE2E2;
    color: #991B1B;
}

/* Spinner overlay on card preview */
.tv-theme-card-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,0.35);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 3;
}
.tv-theme-card-preview {
    position: relative;
}

.tv-theme-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 14px;
    padding: 6px 0 16px;
    overflow-y: auto;
}

.tv-theme-library-grid {
    flex: 1;
    min-height: 0;
    overflow: auto;
    padding: 0 22px 28px;
    grid-template-columns: repeat(3, minmax(220px, 1fr));
    align-content: start;
    gap: 28px 18px;
}

.tv-theme-grid-empty {
    grid-column: 1 / -1;
    padding: 40px 20px;
    text-align: center;
    color: #6B7280;
    font-size: 14px;
}

.tv-theme-card {
    border-radius: 16px;
    border: 1.5px solid #E5E7EB;
    background: #F9FAFB;
    padding: 10px 10px 12px;
    display: flex;
    flex-direction: column;
    cursor: pointer;
    text-align: left;
    transition: border-color 0.15s ease, box-shadow 0.15s ease, background-color 0.15s ease, transform 0.1s ease;
}

.tv-theme-library-grid .tv-theme-card {
    border: 0;
    background: transparent;
    border-radius: 8px;
    padding: 0;
    box-shadow: none;
}

.tv-theme-card:hover {
    border-color: #4F46E5;
    box-shadow: 0 8px 20px rgba(79, 70, 229, 0.15);
    transform: translateY(-1px);
}

.tv-theme-library-grid .tv-theme-card:hover {
    border-color: transparent;
    box-shadow: none;
    transform: translateY(-2px);
}

.tv-theme-card.selected {
    border-color: #111827;
    box-shadow: 0 0 0 2px rgba(15, 23, 42, 0.3);
    background: #FFFFFF;
}

.tv-theme-card-label {
    font-size: 14px;
    font-weight: 500;
    color: #111827;
    margin-bottom: 8px;
}

.tv-theme-library-grid .tv-theme-card-label {
    display: block;
    margin: 11px 0 0;
    color: #171923;
    font-size: 15px;
    font-weight: 500;
    line-height: 1.3;
}

.tv-theme-card-tags {
    display: flex;
    align-items: center;
    gap: 5px;
    margin-top: 6px;
    overflow-x: auto;
    white-space: nowrap;
    scrollbar-width: thin;
}

.tv-theme-card-tag {
    display: inline-flex;
    align-items: center;
    flex: 0 0 auto;
    max-width: 150px;
    padding: 4px 7px;
    border-radius: 999px;
    background: #EEF2FF;
    color: #28335F;
    font-size: 11px;
    font-weight: 600;
    line-height: 1.2;
}

.tv-theme-card-tag span {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
}

.tv-theme-card-preview {
    aspect-ratio: 16 / 9;
    border-radius: 12px;
    overflow: hidden;
    background: #111827;
    position: relative;
}

.tv-theme-card[data-is-horizontal="0"] .tv-theme-card-preview,
.tv-theme-card.tv-theme-card--vertical .tv-theme-card-preview {
    aspect-ratio: 9 / 16;
    width: min(100%, 170px);
    margin: 0 auto;
}

.tv-theme-card--orientation-mismatch {
    opacity: 0.52;
}

.tv-theme-card--orientation-mismatch:hover {
    opacity: 0.78;
}

.tv-theme-library-grid .tv-theme-card-preview {
    width: 100%;
    min-height: 0;
    border-radius: 8px;
    display: block;
    background: #eef0f4;
}

.tv-theme-card-preview::after {
    content: 'Preview';
    position: absolute;
    left: 8px;
    bottom: 8px;
    z-index: 4;
    border-radius: 999px;
    background: rgba(17, 24, 39, 0.82);
    color: #fff;
    font-size: 11px;
    line-height: 1;
    padding: 5px 8px;
    opacity: 0;
    transform: translateY(2px);
    transition: opacity 0.15s ease, transform 0.15s ease;
    pointer-events: none;
}

.tv-theme-library-grid .tv-theme-card-preview::after {
    display: none;
}

.tv-theme-card-actions {
    position: absolute;
    left: 12px;
    right: 12px;
    bottom: 12px;
    z-index: 5;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    opacity: 0;
    transform: translateY(8px);
    transition: opacity .2s ease, transform .2s ease;
    pointer-events: none;
}

.tv-theme-card:hover .tv-theme-card-actions,
.tv-theme-card:focus-within .tv-theme-card-actions {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}

.tv-theme-card-action {
    border: 0;
    border-radius: 8px;
    min-height: 32px;
    padding: 0 14px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #171923;
    background: rgba(255,255,255,.92);
    font-size: 13px;
    font-weight: 700;
    line-height: 1;
    cursor: pointer;
    box-shadow: 0 8px 18px rgba(15, 23, 42, .16);
    transition: background .18s ease, color .18s ease, transform .18s ease;
}

.tv-theme-card-action:hover {
    background: #fff;
    color: #171923;
    transform: translateY(-1px);
}

.tv-theme-card:hover .tv-theme-card-preview::after,
.tv-theme-card:focus-visible .tv-theme-card-preview::after {
    opacity: 1;
    transform: translateY(0);
}

.tv-theme-card-preview img {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: contain;
    background: #FFFFFF;
}

.tv-theme-card-preview iframe.tv-theme-card-live-frame {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    border: 0;
    display: block;
    background: #FFFFFF;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.18s ease;
    z-index: 2;
}

.tv-theme-card-preview video.tv-theme-card-preview-video {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    border: 0;
    display: block;
    background: #000000;
    object-fit: cover;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.18s ease;
    z-index: 3;
}

.tv-theme-card--live-preview .tv-theme-card-preview img {
    opacity: 0 !important;
}

.tv-theme-card--live-preview.tv-theme-card--image-loaded .tv-theme-card-preview iframe.tv-theme-card-live-frame {
    opacity: 1;
}

.tv-theme-card--video-preview .tv-theme-card-preview img {
    opacity: 0 !important;
}

.tv-theme-card--video-preview .tv-theme-card-preview video.tv-theme-card-preview-video {
    opacity: 1;
}

.tv-theme-card--deferred-image .tv-theme-card-preview {
    background: linear-gradient(135deg, #EEF2FF 0%, #F8FAFC 100%);
}

.tv-theme-card--deferred-image .tv-theme-card-preview::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg, rgba(255, 255, 255, 0) 0%, rgba(255, 255, 255, 0.7) 48%, rgba(255, 255, 255, 0) 100%);
    transform: translateX(-100%);
    opacity: 0;
    pointer-events: none;
    z-index: 1;
}

.tv-theme-card--deferred-image .tv-theme-card-preview img {
    opacity: 0;
    transition: opacity 0.22s ease;
}

.tv-theme-card--deferred-image.tv-theme-card--image-loading .tv-theme-card-preview::before {
    opacity: 1;
    animation: tv-theme-card-shimmer 1.25s ease-in-out infinite;
}

.tv-theme-card--deferred-image.tv-theme-card--image-loaded .tv-theme-card-preview::before {
    opacity: 0;
    animation: none;
}

.tv-theme-card--deferred-image.tv-theme-card--image-loaded .tv-theme-card-preview img {
    opacity: 1;
}

@keyframes tv-theme-card-shimmer {
    100% {
        transform: translateX(100%);
    }
}

.tv-theme-card-counter {
    position: absolute;
    right: 8px;
    bottom: 8px;
    border-radius: 9px;
    background: rgba(17, 24, 39, 0.82);
    color: #fff;
    font-size: 11px;
    line-height: 1;
    padding: 5px 7px;
    opacity: 0;
    transform: translateY(2px);
    transition: opacity 0.15s ease, transform 0.15s ease;
    pointer-events: none;
    z-index: 4;
}

.tv-theme-card:hover .tv-theme-card-counter {
    opacity: 1;
    transform: translateY(0);
}

.tv-inline-theme-library .tv-theme-card-counter {
    opacity: 1;
    transform: none;
}

.tv-theme-preview-modal-backdrop {
    position: fixed;
    inset: 0;
    z-index: 10000;
    background: rgba(14, 15, 38, 0.58);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

.tv-theme-preview-modal {
    width: min(1180px, 96vw);
    max-height: 92vh;
    overflow: hidden;
    background: #FFFFFF;
    border-radius: 14px;
    box-shadow: 0 18px 60px rgba(0, 0, 0, 0.26);
    display: flex;
    flex-direction: column;
}

.tv-theme-preview-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 16px 20px;
    border-bottom: 1px solid #ECEFF3;
}

.tv-theme-preview-modal-title-wrap {
    min-width: 0;
}

.tv-theme-preview-modal-title {
    font-size: 18px;
    font-weight: 600;
    color: #0E0F26;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.tv-theme-preview-modal-subtitle {
    margin-top: 3px;
    font-size: 13px;
    color: #737780;
}

.tv-theme-preview-modal-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}

.tv-theme-preview-modal-body {
    flex: 1 1 auto;
    min-height: 0;
    overflow: auto;
    padding: 18px 20px 22px;
    background: #F7F8FB;
}

#tv-theme-preview-modal.is-focus-mode .tv-theme-preview-modal {
    height: min(900px, 92vh);
}

#tv-theme-preview-modal.is-focus-mode .tv-theme-preview-modal-body {
    display: flex;
    flex-direction: column;
    overflow: hidden;
    padding: 14px 20px 16px;
}

.tv-theme-preview-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 16px;
}

.tv-theme-preview-scene {
    overflow: hidden;
    border: 1px solid #E3E7ED;
    border-radius: 10px;
    background: #FFFFFF;
    box-shadow: 0 4px 18px rgba(15, 23, 42, 0.06);
}

.tv-theme-preview-scene-frame {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 9;
    background: #E8EBF0;
    overflow: hidden;
}

.tv-theme-preview-scene-frame.is-vertical {
    aspect-ratio: 9 / 16;
}

.tv-theme-preview-scene-frame iframe,
.tv-theme-scene-preview-frame {
    width: 100%;
    height: 100%;
    border: 0;
    display: block;
    background: #FFFFFF;
}

.tv-theme-preview-scene-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 10px 12px;
    border-top: 1px solid #EEF1F5;
}

.tv-theme-preview-scene-title {
    margin: 0;
    font-size: 13px;
    font-weight: 600;
    color: #171923;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.tv-theme-preview-scene-fix {
    flex: 0 0 auto;
    border: 1px solid #D7DCE5;
    border-radius: 8px;
    background: #FFFFFF;
    color: #303342;
    font-size: 12px;
    font-weight: 600;
    padding: 6px 9px;
    cursor: pointer;
}

.tv-theme-preview-scene-fix:hover {
    border-color: #0E0F26;
    color: #0E0F26;
}

.tv-theme-preview-scene-fix:disabled {
    cursor: not-allowed;
    opacity: 0.62;
}

.tv-theme-preview-scene-view {
    flex: 0 0 auto;
    border: 1px solid #D7DCE5;
    border-radius: 8px;
    background: #0E0F26;
    color: #FFFFFF;
    font-size: 12px;
    font-weight: 600;
    padding: 6px 9px;
    cursor: pointer;
}

.tv-theme-preview-scene-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 0 0 auto;
}

.tv-theme-scene-focus {
    width: 100%;
    height: 100%;
    min-height: 0;
    display: grid;
    grid-template-rows: auto minmax(0, 1fr) auto;
    gap: 10px;
    overflow: hidden;
}

.tv-theme-scene-focus-head,
.tv-theme-scene-focus-foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.tv-theme-scene-focus-title {
    margin: 0;
    min-width: 0;
    font-size: 15px;
    font-weight: 600;
    color: #171923;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.tv-theme-scene-focus-frame {
    width: 100%;
    height: auto;
    aspect-ratio: 16 / 9;
    max-width: 100%;
    max-height: 100%;
    min-height: 0;
    justify-self: center;
    align-self: center;
    background: #FFFFFF;
    border: 1px solid #E3E7ED;
    border-radius: 10px;
    overflow: hidden;
}

.tv-theme-scene-focus-frame.is-vertical {
    aspect-ratio: 9 / 16;
}

.tv-theme-scene-focus-frame iframe {
    width: 100%;
    height: 100%;
    min-height: 0;
    border: 0;
    display: block;
    background: #FFFFFF;
}

.tv-theme-scene-focus-nav {
    border: 1px solid #D7DCE5;
    border-radius: 8px;
    background: #FFFFFF;
    color: #303342;
    font-size: 13px;
    font-weight: 600;
    padding: 8px 11px;
    cursor: pointer;
}

.tv-theme-scene-focus-nav:disabled {
    cursor: not-allowed;
    opacity: 0.5;
}

.tv-theme-scene-focus-fix {
    display: grid;
    gap: 6px;
    flex: 1 1 auto;
}

.tv-theme-scene-focus-fix textarea {
    width: 100%;
    min-height: 52px;
    max-height: 72px;
    resize: vertical;
    border: 1px solid #D7DCE5;
    border-radius: 8px;
    padding: 10px 12px;
    font-size: 13px;
    outline: none;
}

.tv-theme-scene-focus-primary {
    justify-self: end;
    border: 0;
    border-radius: 8px;
    background: #0E0F26;
    color: #FFFFFF;
    font-size: 13px;
    font-weight: 600;
    padding: 9px 13px;
    cursor: pointer;
}

.tv-theme-scene-focus-buttons {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
}

.tv-theme-scene-focus-secondary {
    border: 1px solid #D7DCE5;
    border-radius: 8px;
    background: #FFFFFF;
    color: #303342;
    font-size: 13px;
    font-weight: 600;
    padding: 9px 13px;
    cursor: pointer;
}

.tv-theme-scene-focus-danger {
    border-color: #F0B6B6;
    color: #B42318;
}

.tv-theme-scene-reference-input {
    font-size: 12px;
    color: #4B5563;
}

.tv-theme-preview-message {
    min-height: 220px;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    color: #6B7280;
    font-size: 14px;
}

.tv-theme-create-scene-panel {
    border: 1px dashed #CFD5DF;
    border-radius: 10px;
    background: #FFFFFF;
    min-height: 150px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 18px;
}

.tv-theme-scene-loading-widget {
    min-height: 160px;
    display: grid;
    place-items: center;
    gap: 10px;
    color: #5B6270;
    text-align: center;
    font-size: 13px;
    font-weight: 600;
}

.tv-theme-scene-loading-widget .spinner-border {
    width: 28px;
    height: 28px;
}

.tv-theme-modal-footer {
    margin-top: 6px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.tv-theme-secondary-btn {
    border-radius: 999px;
    border: 1px solid #D1D5DB;
    background: #F9FAFB;
    padding: 6px 14px;
    font-size: 13px;
    font-weight: 500;
    color: #111827;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.tv-theme-secondary-btn:hover {
    background: #F3F4F6;
}

.tv-theme-footer-right {
    display: flex;
    align-items: center;
    gap: 10px;
}

.tv-theme-toggle {
    border: none;
    background: transparent;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
}

.tv-theme-toggle-label {
    font-size: 13px;
    color: #111827;
}

.tv-theme-toggle-switch {
    width: 38px;
    height: 20px;
    border-radius: 999px;
    background: #E5E7EB;
    position: relative;
    transition: background-color 0.15s ease;
}

.tv-theme-toggle-knob {
    position: absolute;
    top: 2px;
    left: 2px;
    width: 16px;
    height: 16px;
    border-radius: 999px;
    background: #FFFFFF;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.15);
    transition: transform 0.15s ease;
}

.tv-theme-toggle-on .tv-theme-toggle-switch {
    background: #4F46E5;
}

.tv-theme-toggle-on .tv-theme-toggle-knob {
    transform: translateX(18px);
}

.tv-theme-primary-btn {
    border-radius: 999px;
    border: none;
    padding: 7px 18px;
    background: #0F172A;
    color: #F9FAFB;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.tv-theme-primary-btn:hover {
    opacity: 0.92;
}

@media (max-width: 768px) {
    .tv-inline-theme-library-section {
        margin-top: 18px;
    }

    .tv-inline-theme-library {
        padding: 16px;
        border-radius: 18px;
    }

    .tv-inline-theme-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 12px;
    }

    /* Let aspect-ratio (16/9 or 9/16) drive preview height so the artwork
     * scales with the actual card width instead of being clamped to a thin
     * strip. Previously the hard-coded 116px crushed the image. */
    .tv-inline-theme-library .tv-theme-card-preview img {
        height: 100%;
    }

    /* Compose box — main prompt area. Tighten padding/radius/shadow and
     * reduce textarea height so the box doesn't dominate the viewport. */
    .tv-maker-composer {
        width: calc(100vw - 20px);
        border-radius: 18px;
        box-shadow: 0 12px 32px rgba(46, 33, 120, 0.12);
    }

    .tv-maker-composer--create,
    .tv-maker-composer--single {
        padding: 14px 14px 12px;
    }

    .tv-maker-composer .description-input {
        min-height: 96px;
        font-size: 15px;
        border-radius: 14px;
    }

    .tv-maker-mode-switch {
        margin-bottom: 10px;
        padding: 3px;
    }

    .tv-maker-mode-btn {
        min-height: 30px;
        padding: 0 10px;
        font-size: 12px;
    }

    /* Hero section — shrink the gradient header so it doesn't push the
     * actionable content below the fold on phones. */
    .gradient-dots-background {
        margin: 12px 0 0 !important;
        padding: 6px 12px;
        border-radius: 16px !important;
    }

    /* ai-ads-generator.css clamps .search-header-title to 14px on mobile
     * which is too small for an H1; restore a sensible hero size locally. */
    .tv-maker-center-widget .search-header-title {
        font-size: 22px;
        line-height: 1.2;
    }

    .training-video-maker-subtitle {
        font-size: 12px;
        line-height: 1.35;
        padding: 0 6px 8px;
    }

    .tv-theme-modal {
        max-width: 100%;
        margin: 0 12px;
        padding: 16px 14px 14px;
    }

    .tv-theme-library-modal {
        margin: 0 12px;
        padding: 0;
        grid-template-columns: 1fr;
        height: min(860px, 92vh);
    }

    .tv-theme-library-sidebar {
        border-right: 0;
        border-bottom: 1px solid #eef0f4;
        max-height: 220px;
    }

    .tv-theme-library-searchbar {
        padding: 12px 14px;
    }

    .tv-theme-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 12px;
    }

    .tv-theme-library-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        padding: 0 14px 22px;
        gap: 18px 12px;
    }

    .tv-theme-modal-footer {
        flex-direction: column;
        align-items: stretch;
    }

    .tv-theme-footer-right {
        justify-content: space-between;
        width: 100%;
    }
}

/* Phone-size tightening — keep the 2-column theme grid so users still see
 * multiple options at a glance; just trim the library padding and gap so
 * each card gets a touch more width. */
@media (max-width: 480px) {
    .tv-inline-theme-library {
        padding: 12px;
        border-radius: 14px;
    }

    .tv-inline-theme-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 10px;
    }

    .tv-maker-composer {
        width: calc(100vw - 16px);
        border-radius: 16px;
    }

    .tv-maker-composer--create,
    .tv-maker-composer--single {
        padding: 12px 12px 10px;
    }

    .tv-maker-composer .description-input {
        min-height: 88px;
        font-size: 14px;
    }

    .tv-inline-theme-library-title {
        font-size: 15px;
    }

    .tv-theme-grid,
    .tv-theme-library-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 10px;
    }

    .tv-theme-library-grid {
        padding: 0 12px 18px;
        gap: 14px 10px;
    }
}

/* Custom theme upload modal styles */
.tv-custom-theme-upload-content {
    padding: 20px 0;
    flex: 1;
    overflow-y: auto;
}

.tv-custom-theme-upload-title {
    font-size: 16px;
    font-weight: 600;
    color: #111827;
    margin-bottom: 8px;
}

.tv-custom-theme-upload-description {
    font-size: 14px;
    color: #6B7280;
    margin-bottom: 16px;
    line-height: 1.5;
}

.tv-custom-theme-field-label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: #374151;
    margin-bottom: 8px;
}

.tv-custom-theme-name-input,
.tv-custom-theme-description-input,
.tv-custom-theme-orientation-input,
.tv-custom-theme-prompt-input {
    width: 100%;
    border: 1px solid #D1D5DB;
    border-radius: 8px;
    padding: 12px;
    font-size: 14px;
    line-height: 1.5;
    color: #111827;
    background: #FFFFFF;
    margin-bottom: 18px;
}

.tv-custom-theme-name-input {
    min-height: 44px;
}

.tv-custom-theme-template-count {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    margin-bottom: 18px;
}

.tv-custom-theme-template-count .tv-custom-theme-name-input {
    margin-bottom: 0;
}

.tv-custom-theme-category-input {
    display: none;
}

.tv-custom-theme-category-picker {
    position: relative;
    margin-bottom: 18px;
}

.tv-custom-theme-category-trigger {
    width: 100%;
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 8px 12px;
    border: 1px solid #D1D5DB;
    border-radius: 8px;
    background: #FFFFFF;
    cursor: pointer;
    text-align: left;
}

.tv-custom-theme-category-picker.open .tv-custom-theme-category-trigger,
.tv-custom-theme-category-trigger:focus {
    border-color: #4F46E5;
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.14);
    outline: none;
}

.tv-custom-theme-category-tags {
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 6px;
    overflow-x: auto;
    white-space: nowrap;
    scrollbar-width: thin;
}

.tv-custom-theme-category-placeholder {
    color: #6B7280;
    font-size: 14px;
}

.tv-custom-theme-category-tag {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    flex: 0 0 auto;
    max-width: 190px;
    padding: 5px 8px;
    border-radius: 999px;
    background: #EEF2FF;
    color: #1F2937;
    font-size: 12px;
    font-weight: 600;
}

.tv-custom-theme-category-tag-text {
    overflow: hidden;
    text-overflow: ellipsis;
}

.tv-custom-theme-category-tag-remove {
    border: 0;
    background: transparent;
    color: #4B5563;
    cursor: pointer;
    padding: 0;
    line-height: 1;
}

.tv-custom-theme-category-caret {
    flex: 0 0 auto;
    color: #6B7280;
    font-size: 14px;
}

.tv-custom-theme-category-menu {
    position: absolute;
    z-index: 20;
    top: calc(100% + 6px);
    left: 0;
    right: 0;
    max-height: 240px;
    overflow-y: auto;
    display: none;
    padding: 6px;
    border: 1px solid #D1D5DB;
    border-radius: 12px;
    background: #FFFFFF;
    box-shadow: 0 18px 38px rgba(15, 23, 42, 0.16);
}

.tv-custom-theme-category-picker.open .tv-custom-theme-category-menu {
    display: block;
}

.tv-custom-theme-category-option {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 9px;
    border: 0;
    border-radius: 8px;
    background: transparent;
    padding: 9px 10px;
    color: #111827;
    cursor: pointer;
    text-align: left;
    font-size: 14px;
}

.tv-custom-theme-category-option:hover {
    background: #F3F4F6;
}

.tv-custom-theme-category-option.is-selected {
    background: #EEF2FF;
    color: #3730A3;
    font-weight: 600;
}

.tv-custom-theme-category-option-check {
    width: 16px;
    flex: 0 0 16px;
    text-align: center;
}

.tv-custom-theme-description-input {
    min-height: 84px;
    resize: vertical;
}

.tv-custom-theme-orientation-input {
    min-height: 44px;
}

.tv-custom-theme-prompt-input {
    min-height: 104px;
    resize: vertical;
}

.tv-custom-theme-name-input:focus,
.tv-custom-theme-description-input:focus,
.tv-custom-theme-orientation-input:focus,
.tv-custom-theme-prompt-input:focus {
    border-color: #4F46E5;
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.14);
    outline: none;
}

.tv-custom-theme-upload-area {
    border: 2px dashed #D1D5DB;
    border-radius: 12px;
    background: #F9FAFB;
    padding: 60px 20px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s ease;
    margin-bottom: 20px;
    display: block;
    position: relative;
}

.tv-custom-theme-upload-area:hover {
    border-color: #4F46E5;
    background: #F5F7FA;
}

.tv-custom-theme-upload-area.dragover {
    border-color: #4F46E5;
    background: #EEF2FF;
}

.tv-custom-theme-upload-area.uploading {
    opacity: 0.6;
    pointer-events: none;
    position: relative;
}

.tv-custom-theme-upload-area.uploading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 24px;
    height: 24px;
    border: 2px solid #E5E7EB;
    border-top-color: #4F46E5;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

.tv-custom-theme-upload-icon {
    margin: 0 auto 12px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.tv-custom-theme-upload-text {
    font-size: 14px;
    font-weight: 500;
    color: #374151;
}

.tv-custom-theme-preview-container {
    margin-top: 20px;
}

.tv-custom-theme-preview-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 12px;
}

.tv-custom-theme-preview-item {
    position: relative;
    border-radius: 8px;
    overflow: hidden;
    aspect-ratio: 1;
    border: 2px solid #E5E7EB;
    cursor: pointer;
    transition: all 0.2s ease;
}

.tv-custom-theme-preview-item:hover {
    border-color: #4F46E5;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.2);
}

.tv-custom-theme-preview-item.selected {
    border-color: #111827;
    box-shadow: 0 0 0 2px rgba(15, 23, 42, 0.3);
}

.tv-custom-theme-preview-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.tv-custom-theme-preview-item .remove-btn {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.6);
    border: none;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    line-height: 1;
    transition: background 0.2s ease;
}

.tv-custom-theme-preview-item .remove-btn:hover {
    background: rgba(220, 38, 38, 0.9);
}

.tv-custom-theme-upload-loading {
    display: none;
    text-align: center;
    padding: 20px;
    color: #6B7280;
    font-size: 14px;
}

.tv-custom-theme-upload-loading.active {
    display: block;
}

.tv-custom-theme-upload-loading .spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid #E5E7EB;
    border-top-color: #4F46E5;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
    margin-right: 8px;
    vertical-align: middle;
}

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