/**
 * Chatbrain — "studio" skin for the image/video generator shortcode (theme="dark").
 *
 * Two columns when the shortcode itself is wide enough (container query, not viewport:
 * many WordPress themes render content in a narrow column), controls on the left and the
 * result canvas on the right. Everything is scoped to .aipkit-studio so the Light and
 * Custom themes keep their original look.
 */

.aipkit-studio {
    --st-bg: #0c0e13;
    --st-panel: #12151c;
    --st-raised: #181c26;
    --st-input: #0f1218;
    --st-border: #232836;
    --st-border-strong: #2f3647;
    --st-text: #e9ebf1;
    --st-muted: #8d95a8;
    --st-faint: #5d6477;
    --st-accent: #8b5cf6;
    --st-accent-2: #3b82f6;
    --st-accent-soft: rgba(139, 92, 246, 0.14);
    --st-ok: #22c55e;
    --st-warn: #f5a524;
    --st-err: #f87171;
    --st-radius: 16px;
    --st-radius-sm: 10px;
    --st-shadow: 0 1px 0 rgba(255, 255, 255, 0.03) inset, 0 12px 32px rgba(0, 0, 0, 0.35);

    container-type: inline-size;
    container-name: aipkit-studio;
    color: var(--st-text);
    font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    font-size: 14px;
    line-height: 1.5;
}

/* The wrapper itself: one calm surface instead of nested grey boxes. */
.aipkit_shortcode_container.aipkit_image_generator_public_wrapper.aipkit-theme-dark.aipkit-studio {
    background: var(--st-bg);
    border: 1px solid var(--st-border);
    border-radius: calc(var(--st-radius) + 4px);
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.35);
    color: var(--st-text);
    overflow: hidden;
}

.aipkit-studio *,
.aipkit-studio *::before,
.aipkit-studio *::after {
    box-sizing: border-box;
}

.aipkit-studio .aipkit_shortcode_body {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas:
        "controls"
        "canvas"
        "history";
    gap: 16px;
    padding: 16px;
}

@container aipkit-studio (min-width: 860px) {
    .aipkit-studio .aipkit_shortcode_body {
        grid-template-columns: minmax(320px, 400px) minmax(0, 1fr);
        grid-template-areas:
            "controls canvas"
            "controls history";
        /* Extra height from a tall controls panel goes to the history row, not a gap. */
        grid-template-rows: auto 1fr;
        align-items: start;
        gap: 20px;
        padding: 20px;
    }
}

/* ---------------------------------------------------------------- Controls panel */

.aipkit-studio .aipkit_image_generator_input_bar {
    grid-area: controls;
    display: flex;
    flex-direction: column;
    gap: 18px;
    margin: 0;
    padding: 18px;
    background: var(--st-panel);
    border: 1px solid var(--st-border);
    border-radius: var(--st-radius);
    box-shadow: var(--st-shadow);
}

.aipkit-studio .aipkit_form-group {
    margin: 0;
}

.aipkit-studio .aipkit_form-label,
.aipkit-studio .aipkit-studio__label,
.aipkit-studio .aipkit_image_generator_edit_upload_row .aipkit_form-label {
    display: block;
    margin: 0 0 8px;
    color: var(--st-muted);
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.02em;
}

/* Generate / Edit as a segmented control. */
.aipkit-studio .aipkit_image_generator_mode_switch {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4px;
    margin: 0;
    padding: 4px;
    background: var(--st-input);
    border: 1px solid var(--st-border);
    border-radius: 12px;
}

.aipkit-studio .aipkit_image_generator_mode_switch[hidden] {
    display: none;
}

.aipkit-studio .aipkit_image_generator_mode_btn,
.aipkit-studio.aipkit-theme-dark .aipkit_image_generator_mode_btn {
    height: 36px;
    margin: 0;
    padding: 0 12px;
    background: transparent;
    border: 0;
    border-radius: 9px;
    color: var(--st-muted);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease;
}

.aipkit-studio .aipkit_image_generator_mode_btn:hover {
    color: var(--st-text);
    background: rgba(255, 255, 255, 0.04);
}

.aipkit-studio .aipkit_image_generator_mode_btn.is-active,
.aipkit-studio.aipkit-theme-dark .aipkit_image_generator_mode_btn.is-active {
    background: var(--st-raised);
    color: var(--st-text);
    box-shadow: 0 1px 0 rgba(255, 255, 255, 0.05) inset, 0 2px 8px rgba(0, 0, 0, 0.4);
}

/* Provider + model: full-width, labelled, readable. */
.aipkit-studio .aipkit_image_generator_controls_row,
.aipkit-studio.aipkit-theme-dark .aipkit_image_generator_controls_row {
    display: block;
    margin: 0;
}

.aipkit-studio .aipkit_image_generator_options,
.aipkit-studio.aipkit-theme-dark .aipkit_image_generator_options {
    display: grid;
    grid-template-columns: minmax(0, 0.8fr) minmax(0, 1.2fr);
    gap: 10px;
    overflow: visible;
}

.aipkit-studio.aipkit-theme-dark .aipkit_image_generator_options .aipkit_form-label {
    display: block;
}

.aipkit-studio .aipkit_image_gen_option {
    min-width: 0;
}

.aipkit-studio select.aipkit_form-input,
.aipkit-studio.aipkit-theme-dark .aipkit_image_generator_options select.aipkit_form-input,
.aipkit-studio .aipkit_veo_video_options select,
.aipkit-studio .aipkit_veo_video_options input[type="text"],
.aipkit-studio .aipkit_veo_video_options textarea {
    width: 100%;
    min-width: 0;
    height: 40px;
    padding: 0 34px 0 12px;
    background-color: var(--st-input);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%238d95a8' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    border: 1px solid var(--st-border);
    border-radius: var(--st-radius-sm);
    color: var(--st-text);
    font-size: 13px;
    line-height: 38px;
    appearance: none;
    -webkit-appearance: none;
    box-shadow: none;
    outline: none;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.aipkit-studio .aipkit_veo_video_options input[type="text"],
.aipkit-studio .aipkit_veo_video_options textarea {
    background-image: none;
    padding: 0 12px;
}

.aipkit-studio .aipkit_veo_video_options textarea {
    height: auto;
    min-height: 64px;
    padding: 10px 12px;
    line-height: 1.5;
}

.aipkit-studio select.aipkit_form-input:hover,
.aipkit-studio .aipkit_veo_video_options select:hover {
    border-color: var(--st-border-strong);
}

.aipkit-studio select.aipkit_form-input:focus,
.aipkit-studio .aipkit_veo_video_options select:focus,
.aipkit-studio .aipkit_veo_video_options input:focus,
.aipkit-studio .aipkit_veo_video_options textarea:focus {
    border-color: var(--st-accent);
    box-shadow: 0 0 0 3px var(--st-accent-soft);
}

.aipkit-studio select option,
.aipkit-studio select optgroup {
    background: var(--st-raised);
    color: var(--st-text);
}

.aipkit-studio select:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

/* Prompt. */
.aipkit-studio .aipkit_image_prompt_textarea,
.aipkit-studio.aipkit-theme-dark .aipkit_image_prompt_textarea {
    display: block;
    width: 100%;
    min-height: 120px;
    padding: 12px 14px !important;
    background: var(--st-input) !important;
    border: 1px solid var(--st-border) !important;
    border-radius: 12px;
    color: var(--st-text) !important;
    font-family: inherit;
    font-size: 14px;
    line-height: 1.55;
    resize: vertical;
    outline: none;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.aipkit-studio .aipkit_image_prompt_textarea:focus {
    border-color: var(--st-accent) !important;
    box-shadow: 0 0 0 3px var(--st-accent-soft) !important;
}

.aipkit-studio .aipkit_image_prompt_textarea::placeholder {
    color: var(--st-faint);
}

/* Source image dropzone. */
.aipkit-studio .aipkit_image_generator_edit_upload_row[hidden] {
    display: none !important;
}

.aipkit-studio .aipkit_image_edit_dropzone,
.aipkit-studio.aipkit-theme-dark .aipkit_image_edit_dropzone {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    min-height: 104px;
    padding: 16px;
    background: var(--st-input);
    border: 1.5px dashed var(--st-border-strong);
    border-radius: 12px;
    color: var(--st-text);
    text-align: center;
    cursor: pointer;
    transition: border-color 0.15s ease, background 0.15s ease;
}

.aipkit-studio .aipkit_image_edit_dropzone::before {
    content: "";
    width: 28px;
    height: 28px;
    margin-bottom: 4px;
    background: currentColor;
    opacity: 0.55;
    -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 16V4m0 0l-4 4m4-4l4 4'/%3E%3Cpath d='M4 16v2a2 2 0 002 2h12a2 2 0 002-2v-2'/%3E%3C/svg%3E") center / contain no-repeat;
    mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 16V4m0 0l-4 4m4-4l4 4'/%3E%3Cpath d='M4 16v2a2 2 0 002 2h12a2 2 0 002-2v-2'/%3E%3C/svg%3E") center / contain no-repeat;
}

.aipkit-studio .aipkit_image_edit_dropzone:hover,
.aipkit-studio .aipkit_image_edit_dropzone:focus-visible,
.aipkit-studio .aipkit_image_edit_dropzone.is-dragover {
    border-color: var(--st-accent);
    background: var(--st-accent-soft);
    outline: none;
}

.aipkit-studio .aipkit_image_edit_dropzone.has-file {
    border-style: solid;
    border-color: rgba(34, 197, 94, 0.55);
    background: rgba(34, 197, 94, 0.08);
}

.aipkit-studio .aipkit_image_edit_dropzone.has-error {
    border-color: rgba(248, 113, 113, 0.7);
    background: rgba(248, 113, 113, 0.08);
}

.aipkit-studio .aipkit_image_edit_dropzone_title {
    font-size: 13px;
    font-weight: 600;
}

.aipkit-studio .aipkit_image_edit_dropzone_meta,
.aipkit-studio .aipkit_image_generator_edit_upload_hint {
    color: var(--st-muted);
    font-size: 12px;
}

.aipkit-studio .aipkit_image_generator_edit_upload_hint {
    display: block;
    margin-top: 8px;
}

.aipkit-studio .aipkit_image_edit_source_input {
    display: none;
}

.aipkit-studio .aipkit_image_edit_file_summary {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 10px;
    padding: 8px;
    background: var(--st-raised);
    border: 1px solid var(--st-border);
    border-radius: 10px;
}

.aipkit-studio .aipkit_image_edit_file_summary[hidden] {
    display: none;
}

.aipkit-studio .aipkit_image_edit_file_preview {
    width: 48px;
    height: 48px;
    object-fit: cover;
    border-radius: 8px;
    border: 1px solid var(--st-border);
}

.aipkit-studio .aipkit_image_edit_file_details {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 12px;
}

.aipkit-studio .aipkit_image_edit_file_remove {
    padding: 6px 10px;
    background: transparent;
    border: 1px solid var(--st-border-strong);
    border-radius: 8px;
    color: var(--st-text);
    font-size: 12px;
    cursor: pointer;
}

.aipkit-studio .aipkit_image_edit_file_remove:hover {
    border-color: var(--st-err);
    color: var(--st-err);
}

.aipkit-studio .aipkit_image_edit_upload_feedback {
    display: block;
    margin-top: 6px;
    color: var(--st-err);
    font-size: 12px;
}

.aipkit-studio .aipkit_image_generator_edit_mode_notice {
    padding: 10px 12px;
    background: rgba(245, 165, 36, 0.1);
    border: 1px solid rgba(245, 165, 36, 0.3);
    border-radius: 10px;
    color: #f7c46c;
    font-size: 12px;
}

.aipkit-studio .aipkit_image_generator_edit_mode_notice[hidden] {
    display: none;
}

/* Generate button: the one strong colour on the page. */
.aipkit-studio .aipkit-studio__footer,
.aipkit-studio.aipkit-theme-dark .aipkit_image_generator_action_area {
    margin: 0;
    padding-top: 4px;
}

.aipkit-studio .aipkit_image_generate_btn,
.aipkit-studio.aipkit-theme-dark .aipkit_image_generate_btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    height: 48px;
    padding: 0 18px;
    background: linear-gradient(135deg, var(--st-accent), var(--st-accent-2));
    border: 0;
    border-radius: 12px;
    color: #fff;
    font-size: 15px;
    font-weight: 700;
    letter-spacing: 0.01em;
    cursor: pointer;
    box-shadow: 0 8px 24px rgba(99, 102, 241, 0.35);
    transition: transform 0.12s ease, box-shadow 0.15s ease, filter 0.15s ease;
}

.aipkit-studio .aipkit_image_generate_btn:hover:not(:disabled) {
    filter: brightness(1.08);
    box-shadow: 0 10px 28px rgba(99, 102, 241, 0.45);
}

.aipkit-studio .aipkit_image_generate_btn:active:not(:disabled) {
    transform: translateY(1px);
}

.aipkit-studio .aipkit_image_generate_btn:disabled {
    opacity: 0.55;
    cursor: not-allowed;
    box-shadow: none;
}

/* Dashicons are an admin font that most themes never load: draw the icon ourselves. */
.aipkit-studio .aipkit_image_generate_btn .dashicons {
    display: none;
}

.aipkit-studio .aipkit_image_generate_btn .aipkit_btn-text::before {
    content: "";
    display: inline-block;
    width: 16px;
    height: 16px;
    margin-right: 8px;
    vertical-align: -3px;
    background: currentColor;
    -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='black'%3E%3Cpath d='M12 2l1.9 5.6L19.5 9.5l-5.6 1.9L12 17l-1.9-5.6L4.5 9.5l5.6-1.9zM19 14l.95 2.8 2.8.95-2.8.95L19 21.5l-.95-2.8-2.8-.95 2.8-.95z'/%3E%3C/svg%3E") center / contain no-repeat;
    mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='black'%3E%3Cpath d='M12 2l1.9 5.6L19.5 9.5l-5.6 1.9L12 17l-1.9-5.6L4.5 9.5l5.6-1.9zM19 14l.95 2.8 2.8.95-2.8.95L19 21.5l-.95-2.8-2.8-.95 2.8-.95z'/%3E%3C/svg%3E") center / contain no-repeat;
}

.aipkit-studio .aipkit_image_generate_btn .aipkit_spinner {
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.35);
    border-left-color: #fff;
    border-radius: 50%;
    animation: aipkit_spin 0.9s linear infinite;
}

/* ------------------------------------------------------------------ Canvas */

.aipkit-studio .aipkit-studio__canvas {
    grid-area: canvas;
    position: relative;
    display: flex;
    flex-direction: column;
    min-height: 420px;
    padding: 16px;
    background:
        radial-gradient(1200px 400px at 50% -10%, rgba(139, 92, 246, 0.07), transparent 60%),
        var(--st-panel);
    border: 1px solid var(--st-border);
    border-radius: var(--st-radius);
    box-shadow: var(--st-shadow);
}

@container aipkit-studio (min-width: 860px) {
    .aipkit-studio .aipkit-studio__canvas {
        min-height: 560px;
    }
}

.aipkit-studio .aipkit-studio__canvas-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}

.aipkit-studio .aipkit-studio__canvas-title {
    color: var(--st-muted);
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.02em;
}

.aipkit-studio .aipkit-studio__empty {
    display: none;
    flex: 1;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 24px;
    color: var(--st-faint);
    text-align: center;
}

.aipkit-studio .aipkit-studio__canvas.is-empty .aipkit-studio__empty {
    display: flex;
}

.aipkit-studio .aipkit-studio__empty-icon {
    margin-bottom: 6px;
    color: var(--st-border-strong);
}

.aipkit-studio .aipkit-studio__empty-title {
    margin: 0;
    color: var(--st-text);
    font-size: 15px;
    font-weight: 600;
}

.aipkit-studio .aipkit-studio__empty-text {
    margin: 0;
    max-width: 320px;
    color: var(--st-muted);
    font-size: 13px;
}

.aipkit-studio .aipkit_image_generator_results,
.aipkit-studio.aipkit-theme-dark .aipkit_image_generator_results {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 260px), 1fr));
    gap: 14px;
    min-height: 0;
    margin: 0;
    padding: 0;
    border: 0;
}

.aipkit-studio .aipkit-studio__canvas.is-empty .aipkit_image_generator_results {
    display: none !important;
}

.aipkit-studio .aipkit_image_result,
.aipkit-studio.aipkit-theme-dark .aipkit_image_result {
    position: relative;
    overflow: hidden;
    background: var(--st-input);
    border: 1px solid var(--st-border);
    border-radius: 12px;
}

.aipkit-studio .aipkit_image_result img {
    display: block;
    width: 100%;
    height: auto;
    aspect-ratio: auto;
    object-fit: contain;
    max-height: 70vh;
}

/* A single result gets the whole canvas. */
.aipkit-studio .aipkit_image_generator_results > .aipkit_image_result:only-child {
    grid-column: 1 / -1;
    justify-self: center;
    max-width: 100%;
}

.aipkit-studio .aipkit_image_result video,
.aipkit-studio .aipkit_image_generator_results video {
    display: block;
    width: 100%;
    max-height: 70vh;
    background: #000;
    border-radius: 12px;
}

.aipkit-studio .aipkit_image_result p,
.aipkit-studio.aipkit-theme-dark .aipkit_image_result p {
    position: static;
    max-height: none;
    margin: 0;
    padding: 8px 10px;
    background: transparent;
    color: var(--st-muted);
    font-size: 12px;
    font-style: normal;
}

.aipkit-studio .aipkit_image_results_placeholder,
.aipkit-studio.aipkit-theme-dark .aipkit_image_results_placeholder {
    grid-column: 1 / -1;
    padding: 60px 0;
    color: var(--st-muted);
    text-align: center;
}

.aipkit-studio .aipkit_image_results_message,
.aipkit-studio.aipkit-theme-dark .aipkit_image_results_message {
    grid-column: 1 / -1;
    margin: 0;
    padding: 12px 14px;
    border-radius: 12px;
    font-size: 13px;
}

.aipkit-studio .aipkit_image_results_message.aipkit_message-error {
    background: rgba(248, 113, 113, 0.08);
    border: 1px solid rgba(248, 113, 113, 0.35);
    color: #fecaca;
}

.aipkit-studio .aipkit_image_results_message.aipkit_message-info {
    background: rgba(59, 130, 246, 0.08);
    border: 1px solid rgba(59, 130, 246, 0.3);
    color: #bfdbfe;
}

/* ----------------------------------------------------------------- History */

.aipkit-studio .aipkit_image_history_section {
    grid-area: history;
    margin: 0;
    padding: 16px;
    background: var(--st-panel);
    border: 1px solid var(--st-border);
    border-radius: var(--st-radius);
}

.aipkit-studio .aipkit_image_history_title {
    margin: 0 0 12px;
    color: var(--st-muted);
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.02em;
    text-transform: none;
}

.aipkit-studio .aipkit-image-history-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(96px, 1fr));
    gap: 10px;
}

.aipkit-studio .aipkit-image-history-item,
.aipkit-studio.aipkit-theme-dark .aipkit-image-history-item {
    overflow: hidden;
    background: var(--st-input);
    border: 1px solid var(--st-border);
    border-radius: 10px;
    transition: border-color 0.15s ease, transform 0.15s ease;
}

.aipkit-studio .aipkit-image-history-item:hover {
    border-color: var(--st-border-strong);
    transform: translateY(-1px);
}

.aipkit-studio .aipkit-image-history-info,
.aipkit-studio.aipkit-theme-dark .aipkit-image-history-info {
    color: var(--st-muted);
    font-size: 11px;
}

/* ----------------------------------------------------- Video options panel */

.aipkit-studio .aipkit_veo_video_options {
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin: 0;
    padding: 14px;
    background: var(--st-raised);
    border: 1px solid var(--st-border);
    border-radius: 12px;
}

.aipkit-studio .aipkit_veo_video_options[hidden] {
    display: none !important;
}

.aipkit-studio .aipkit_veo_video_options > *,
.aipkit-studio .aipkit_veo_field--full,
.aipkit-studio .aipkit_veo_notice,
.aipkit-studio .aipkit_veo_estimate {
    margin: 0;
}

.aipkit-studio .aipkit_veo_video_options > [hidden] {
    display: none !important;
}

/* The image upload moves in here while a video model is selected. */
.aipkit-studio .aipkit_veo_video_options .aipkit_image_generator_edit_upload_row .aipkit_image_edit_dropzone {
    min-height: 88px;
}

.aipkit-studio [data-veo-field="toggles"] {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.aipkit-studio [data-veo-field="toggles"] [hidden] {
    display: none !important;
}

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

.aipkit-studio .aipkit_veo_field .aipkit_form-label {
    margin-bottom: 6px;
}

.aipkit-studio .aipkit_veo_field.is-locked select {
    opacity: 0.6;
}

.aipkit-studio .aipkit_form-help,
.aipkit-studio .aipkit_veo_video_options .aipkit_form-help {
    color: var(--st-muted);
    font-size: 12px;
}

.aipkit-studio .aipkit_veo_notice {
    background: rgba(245, 165, 36, 0.1);
    border: 1px solid rgba(245, 165, 36, 0.3);
    color: #f7c46c;
    border-radius: 10px;
}

.aipkit-studio .aipkit_veo_estimate {
    background: var(--st-accent-soft);
    border: 1px solid rgba(139, 92, 246, 0.3);
    border-radius: 10px;
    color: #d8ccff;
}

.aipkit-studio .aipkit_veo_estimate.is-insufficient {
    background: rgba(248, 113, 113, 0.1);
    border-color: rgba(248, 113, 113, 0.4);
    color: #fecaca;
}

/* Toggles as switches. */
.aipkit-studio .aipkit_veo_toggle {
    position: relative;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 0;
    cursor: pointer;
    font-size: 13px;
}

.aipkit-studio .aipkit_veo_toggle input[type="checkbox"] {
    appearance: none;
    -webkit-appearance: none;
    flex: 0 0 auto;
    width: 36px;
    height: 20px;
    margin: 0;
    background: var(--st-border-strong);
    border-radius: 999px;
    position: relative;
    cursor: pointer;
    transition: background 0.15s ease;
}

.aipkit-studio .aipkit_veo_toggle input[type="checkbox"]::after {
    content: "";
    position: absolute;
    top: 2px;
    left: 2px;
    width: 16px;
    height: 16px;
    background: #fff;
    border-radius: 50%;
    transition: transform 0.15s ease;
}

.aipkit-studio .aipkit_veo_toggle input[type="checkbox"]:checked {
    background: var(--st-accent);
}

.aipkit-studio .aipkit_veo_toggle input[type="checkbox"]:checked::after {
    transform: translateX(16px);
}

.aipkit-studio .aipkit_veo_toggle input[type="checkbox"]:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.aipkit-studio input[type="file"].aipkit_veo_file {
    width: 100%;
    padding: 8px;
    background: var(--st-input);
    border: 1px dashed var(--st-border-strong);
    border-radius: 10px;
    color: var(--st-muted);
    font-size: 12px;
}

.aipkit-studio input[type="file"]::file-selector-button {
    margin-right: 10px;
    padding: 6px 10px;
    background: var(--st-raised);
    border: 1px solid var(--st-border-strong);
    border-radius: 8px;
    color: var(--st-text);
    cursor: pointer;
}

.aipkit-studio .aipkit_veo_diag_btn {
    background: transparent;
    border: 1px solid var(--st-border);
    color: var(--st-muted);
}

/* Multi-image strip (edit mode). */
.aipkit-studio .aipkit_extra_image {
    border-color: var(--st-border);
    border-radius: 10px;
}

.aipkit-studio .aipkit_extra_images_counter {
    color: var(--st-muted);
}

/* ------------------------------------------------ Video to edit + trimmer */

.aipkit-studio .aipkit-edit-video {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.aipkit-edit-video__drop {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    min-height: 96px;
    padding: 14px;
    background: var(--st-input, #0f1218);
    border: 1.5px dashed var(--st-border-strong, #2f3647);
    border-radius: 12px;
    color: var(--st-text, #e9ebf1);
    text-align: center;
    cursor: pointer;
    transition: border-color 0.15s ease, background 0.15s ease;
}

.aipkit-edit-video__drop:hover,
.aipkit-edit-video__drop:focus-visible,
.aipkit-edit-video__drop.is-dragover {
    border-color: var(--st-accent, #8b5cf6);
    background: var(--st-accent-soft, rgba(139, 92, 246, 0.14));
    outline: none;
}

.aipkit-edit-video__drop[hidden] {
    display: none !important;
}

.aipkit-edit-video__drop-title {
    font-size: 13px;
    font-weight: 600;
}

.aipkit-edit-video__drop-meta {
    color: var(--st-muted, #8d95a8);
    font-size: 12px;
}

.aipkit-edit-video__stage[hidden] {
    display: none !important;
}

.aipkit-edit-video__player {
    display: block;
    width: 100%;
    max-height: 260px;
    background: #000;
    border-radius: 10px;
}

.aipkit-trim {
    position: relative;
    margin-top: 10px;
    user-select: none;
    -webkit-user-select: none;
    touch-action: none;
}

.aipkit-trim__track {
    position: relative;
    height: 44px;
    background:
        repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.05) 0 2px, transparent 2px 12px),
        var(--st-input, #0f1218);
    border: 1px solid var(--st-border, #232836);
    border-radius: 10px;
    overflow: hidden;
}

.aipkit-trim__range {
    position: absolute;
    top: 0;
    bottom: 0;
    background: rgba(139, 92, 246, 0.22);
    border-top: 2px solid var(--st-accent, #8b5cf6);
    border-bottom: 2px solid var(--st-accent, #8b5cf6);
    cursor: grab;
}

.aipkit-trim__range:active {
    cursor: grabbing;
}

.aipkit-trim__handle {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 14px;
    margin-left: -7px;
    background: var(--st-accent, #8b5cf6);
    border-radius: 6px;
    cursor: ew-resize;
    z-index: 2;
}

.aipkit-trim__handle::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    width: 2px;
    height: 14px;
    margin: -7px 0 0 -1px;
    background: rgba(255, 255, 255, 0.85);
    border-radius: 1px;
}

.aipkit-trim__handle:focus-visible {
    outline: 2px solid #fff;
    outline-offset: 1px;
}

.aipkit-trim__playhead {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 2px;
    background: #fff;
    opacity: 0.85;
    pointer-events: none;
    z-index: 1;
}

.aipkit-trim__meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-top: 8px;
    color: var(--st-muted, #8d95a8);
    font-size: 12px;
    font-variant-numeric: tabular-nums;
}

.aipkit-trim__chip {
    padding: 3px 8px;
    background: var(--st-accent-soft, rgba(139, 92, 246, 0.14));
    border: 1px solid rgba(139, 92, 246, 0.35);
    border-radius: 999px;
    color: #d8ccff;
    font-weight: 600;
}

.aipkit-trim__chip.is-over {
    background: rgba(248, 113, 113, 0.12);
    border-color: rgba(248, 113, 113, 0.45);
    color: #fecaca;
}

.aipkit-edit-video__actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.aipkit-edit-video__btn {
    padding: 7px 12px;
    background: var(--st-raised, #181c26);
    border: 1px solid var(--st-border-strong, #2f3647);
    border-radius: 8px;
    color: var(--st-text, #e9ebf1);
    font-size: 12px;
    cursor: pointer;
}

.aipkit-edit-video__btn:hover {
    border-color: var(--st-accent, #8b5cf6);
}

.aipkit-edit-video__status {
    color: var(--st-muted, #8d95a8);
    font-size: 12px;
}

.aipkit-edit-video__status.is-error {
    color: var(--st-err, #f87171);
}

/* ------------------------------------------------ Several clips + model chips */

.aipkit-edit-video__list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.aipkit-edit-video__list:empty {
    display: none;
}

.aipkit-edit-clip {
    padding: 10px;
    background: var(--st-raised, #181c26);
    border: 1px solid var(--st-border, #232836);
    border-radius: 12px;
}

.aipkit-edit-clip__head {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
    min-width: 0;
}

.aipkit-edit-clip__tag {
    flex: 0 0 auto;
    padding: 2px 8px;
    background: var(--st-accent-soft, rgba(139, 92, 246, 0.14));
    border-radius: 999px;
    color: #d8ccff;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.02em;
}

.aipkit-edit-clip__name {
    flex: 1 1 auto;
    min-width: 0;
    overflow: hidden;
    color: var(--st-muted, #8d95a8);
    font-size: 12px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.aipkit-studio .aipkit-edit-clip__remove {
    flex: 0 0 auto;
    padding: 4px 10px;
    background: transparent;
    border: 1px solid var(--st-border-strong, #2f3647);
    border-radius: 8px;
    color: var(--st-text, #e9ebf1);
    font-size: 12px;
    line-height: 1.4;
    cursor: pointer;
}

.aipkit-studio .aipkit-edit-clip__remove:hover {
    border-color: var(--st-err, #f87171);
    color: #fecaca;
}

.aipkit-edit-video__drop-icon {
    width: 26px;
    height: 26px;
    margin-bottom: 2px;
    background: var(--st-muted, #8d95a8);
    -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='2.5' y='5' width='14' height='14' rx='2.5'/%3E%3Cpath d='m16.5 10 5-3v10l-5-3'/%3E%3C/svg%3E") center / contain no-repeat;
    mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='2.5' y='5' width='14' height='14' rx='2.5'/%3E%3Cpath d='m16.5 10 5-3v10l-5-3'/%3E%3C/svg%3E") center / contain no-repeat;
}

.aipkit-edit-video__drop.is-compact {
    flex-direction: row;
    flex-wrap: wrap;
    gap: 8px;
    min-height: 0;
    padding: 10px 12px;
}

.aipkit-edit-video__drop.is-compact .aipkit-edit-video__drop-icon {
    width: 18px;
    height: 18px;
    margin: 0;
}

.aipkit-edit-video__drop.is-compact .aipkit-edit-video__drop-meta {
    display: none;
}

.aipkit-edit-video__budget {
    margin: 0;
    color: var(--st-muted, #8d95a8);
    font-size: 12px;
    font-variant-numeric: tabular-nums;
}

.aipkit-edit-video__budget.is-over {
    color: var(--st-err, #f87171);
}

.aipkit-edit-video__models {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding-bottom: 4px;
}

.aipkit-edit-video__models[hidden] {
    display: none !important;
}

.aipkit-edit-video__models-title {
    color: var(--st-muted, #8d95a8);
    font-size: 12px;
    font-weight: 600;
}

.aipkit-edit-video__chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.aipkit-studio .aipkit-edit-video__chip {
    display: inline-flex;
    align-items: baseline;
    gap: 6px;
    padding: 6px 10px;
    background: var(--st-input, #0f1218);
    border: 1px solid var(--st-border-strong, #2f3647);
    border-radius: 999px;
    color: var(--st-text, #e9ebf1);
    font-size: 12px;
    line-height: 1.3;
    cursor: pointer;
    transition: border-color 0.15s ease, background 0.15s ease;
}

.aipkit-studio .aipkit-edit-video__chip small {
    color: var(--st-faint, #5d6477);
    font-size: 10.5px;
}

.aipkit-studio .aipkit-edit-video__chip:hover {
    border-color: var(--st-accent, #8b5cf6);
}

.aipkit-studio .aipkit-edit-video__chip.is-active {
    background: var(--st-accent-soft, rgba(139, 92, 246, 0.14));
    border-color: var(--st-accent, #8b5cf6);
    cursor: default;
}

.aipkit-studio .aipkit-edit-video__chip.is-active small {
    color: #cbbcff;
}

.aipkit-edit-video__warning {
    margin: 0;
    padding: 9px 11px;
    background: rgba(245, 165, 36, 0.1);
    border: 1px solid rgba(245, 165, 36, 0.35);
    border-radius: 10px;
    color: #fcd9a0;
    font-size: 12px;
    line-height: 1.45;
}

/* ------------------------------------------------ "What do you want to edit?" */

.aipkit-source-switch {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin: 0 0 4px;
}

.aipkit-source-switch[hidden] {
    display: none !important;
}

.aipkit-source-switch__label {
    color: var(--st-muted, #8d95a8);
    font-size: 12px;
    font-weight: 600;
}

.aipkit-source-switch__options {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.aipkit-studio .aipkit-source-switch__btn {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    background: var(--st-input, #0f1218);
    border: 1px solid var(--st-border, #232836);
    border-radius: 12px;
    color: var(--st-text, #e9ebf1);
    text-align: left;
    cursor: pointer;
    transition: border-color 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
}

.aipkit-studio .aipkit-source-switch__btn:hover {
    border-color: var(--st-border-strong, #2f3647);
}

.aipkit-studio .aipkit-source-switch__btn.is-active {
    background: var(--st-accent-soft, rgba(139, 92, 246, 0.14));
    border-color: var(--st-accent, #8b5cf6);
    box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.12);
}

.aipkit-studio .aipkit-source-switch__btn:focus-visible {
    outline: 2px solid var(--st-accent, #8b5cf6);
    outline-offset: 2px;
}

.aipkit-source-switch__text {
    display: flex;
    flex-direction: column;
    gap: 1px;
    min-width: 0;
}

.aipkit-source-switch__text strong {
    font-size: 13px;
    font-weight: 600;
}

.aipkit-source-switch__text small {
    color: var(--st-muted, #8d95a8);
    font-size: 11.5px;
    line-height: 1.3;
}

.aipkit-source-switch__icon {
    flex: 0 0 auto;
    width: 30px;
    height: 30px;
    border-radius: 9px;
    background: var(--st-raised, #181c26);
    position: relative;
}

.aipkit-source-switch__icon::after {
    content: "";
    position: absolute;
    inset: 6px;
    background: var(--st-muted, #8d95a8);
    -webkit-mask: var(--aipkit-icon) center / contain no-repeat;
    mask: var(--aipkit-icon) center / contain no-repeat;
}

.aipkit-studio .aipkit-source-switch__btn.is-active .aipkit-source-switch__icon {
    background: linear-gradient(135deg, var(--st-accent, #8b5cf6), var(--st-accent-2, #3b82f6));
}

.aipkit-studio .aipkit-source-switch__btn.is-active .aipkit-source-switch__icon::after {
    background: #fff;
}

.aipkit-source-switch__icon--image {
    --aipkit-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='3' y='3' width='18' height='18' rx='3'/%3E%3Ccircle cx='9' cy='9' r='2'/%3E%3Cpath d='m21 15-4.5-4.5L6 21'/%3E%3C/svg%3E");
}

.aipkit-source-switch__icon--video {
    --aipkit-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='2.5' y='5' width='14' height='14' rx='2.5'/%3E%3Cpath d='m16.5 10 5-3v10l-5-3'/%3E%3C/svg%3E");
}

.aipkit-source-switch__note {
    margin: 0;
    padding: 8px 10px;
    background: rgba(245, 165, 36, 0.1);
    border: 1px solid rgba(245, 165, 36, 0.35);
    border-radius: 10px;
    color: #fcd9a0;
    font-size: 12px;
}

@container aipkit-studio (max-width: 380px) {
    .aipkit-source-switch__text small {
        display: none;
    }
}

.aipkit-edit-clip .aipkit-edit-video__player {
    max-height: 200px;
}

/* On a phone the model chips scroll sideways instead of stacking ten rows. */
@container aipkit-studio (max-width: 520px) {
    .aipkit-edit-video__chips {
        flex-wrap: nowrap;
        overflow-x: auto;
        padding-bottom: 4px;
        scrollbar-width: thin;
        -webkit-overflow-scrolling: touch;
    }

    .aipkit-studio .aipkit-edit-video__chip {
        flex: 0 0 auto;
        white-space: nowrap;
    }
}

/* ------------------------------------------------ Toggles and plain file inputs */

.aipkit-studio .aipkit_veo_toggle,
.aipkit-studio .aipkit_veo_toggle span {
    color: var(--st-text, #e9ebf1);
}

.aipkit-studio .aipkit_veo_toggle[hidden] {
    display: none !important;
}

.aipkit-studio .aipkit_veo_toggle input[disabled] + span {
    color: var(--st-faint, #5d6477);
    opacity: 1;
}

.aipkit-studio .aipkit_veo_video_options input[type="file"] {
    width: 100%;
    padding: 6px;
    background: var(--st-input, #0f1218);
    border: 1px dashed var(--st-border-strong, #2f3647);
    border-radius: 10px;
    color: var(--st-muted, #8d95a8);
    font-size: 12px;
}

.aipkit-studio .aipkit_veo_video_options input[type="file"]::file-selector-button {
    margin-right: 10px;
    padding: 6px 12px;
    background: var(--st-raised, #181c26);
    border: 1px solid var(--st-border-strong, #2f3647);
    border-radius: 8px;
    color: var(--st-text, #e9ebf1);
    font: inherit;
    font-weight: 600;
    cursor: pointer;
}

/* ------------------------------------------------------ Sign-in notice card */

.aipkit-studio--notice {
    padding: 16px;
    background: var(--st-bg);
    border: 1px solid var(--st-border);
    border-radius: calc(var(--st-radius) + 4px);
}

.aipkit-studio__notice-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    max-width: 440px;
    margin: 0 auto;
    padding: 36px 24px;
    text-align: center;
}

.aipkit-studio__notice-icon {
    display: grid;
    place-items: center;
    width: 52px;
    height: 52px;
    background: var(--st-accent-soft);
    border-radius: 16px;
    font-size: 24px;
}

.aipkit-studio__notice-title {
    margin: 4px 0 0;
    color: var(--st-text);
    font-size: 18px;
    font-weight: 700;
}

.aipkit-studio__notice-text {
    margin: 0;
    color: var(--st-muted);
    font-size: 14px;
}

.aipkit-studio__notice-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px;
    margin-top: 8px;
}

.aipkit-studio__btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 42px;
    padding: 0 18px;
    background: var(--st-raised, #181c26);
    border: 1px solid var(--st-border-strong, #2f3647);
    border-radius: 11px;
    color: var(--st-text, #e9ebf1) !important;
    font-size: 14px;
    font-weight: 600;
    text-decoration: none !important;
}

.aipkit-studio__btn--primary {
    background: linear-gradient(135deg, var(--st-accent, #8b5cf6), var(--st-accent-2, #3b82f6));
    border: 0;
    color: #fff !important;
}

.aipkit-studio__login-inline {
    grid-column: 1 / -1;
    justify-self: center;
    margin-top: 6px;
}

@container aipkit-studio (max-width: 520px) {
    .aipkit-studio .aipkit_shortcode_body {
        gap: 12px;
        padding: 10px;
    }

    .aipkit-studio .aipkit_image_generator_input_bar {
        padding: 14px;
    }

    .aipkit-studio .aipkit_image_generator_options,
    .aipkit-studio.aipkit-theme-dark .aipkit_image_generator_options {
        grid-template-columns: minmax(0, 1fr);
    }

    .aipkit-studio .aipkit-studio__canvas {
        min-height: 260px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .aipkit-studio *,
    .aipkit-studio *::before,
    .aipkit-studio *::after {
        transition: none !important;
        animation-duration: 0.01ms !important;
    }
}

/* Several rules above set `display` on elements the scripts hide with the `hidden`
   attribute; without this they would stay visible. */
.aipkit-studio [hidden] {
    display: none !important;
}
