/* ============================================================
   KIE AI — WAR ROOM  |  Design System v5
   Brick Brand — Dark, Red accent, JetBrains Mono, Inter
   ============================================================ */

:root {
    --bg: #000000;
    --surface: #0d0d0d;
    --surface-2: #141414;
    --surface-3: #1a1a1a;
    --border: #222222;
    --border-hover: #333333;

    --accent: #DC2626;
    --accent-dim: rgba(220, 38, 38, 0.08);
    --accent-glow: rgba(220, 38, 38, 0.25);

    --green: #00c853;
    --green-dim: rgba(0, 200, 83, 0.1);
    --yellow: #ffd600;
    --yellow-dim: rgba(255, 214, 0, 0.1);
    --blue: #2979ff;
    --blue-dim: rgba(41, 121, 255, 0.1);

    --text: #ffffff;
    --text-dim: #999;
    --text-muted: #555;

    --mono: 'JetBrains Mono', monospace;
    --sans: 'Inter', -apple-system, sans-serif;

    --radius: 3px;
    --header-h: 56px;
}

/* ── Reset ── */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: var(--sans);
    background: var(--bg);
    color: var(--text);
    height: 100vh;
    display: flex;
    flex-direction: column;
    -webkit-font-smoothing: antialiased;
    overflow: hidden;
}

/* ============================================================
   HEADER
   ============================================================ */
#app-header {
    height: var(--header-h);
    display: flex;
    align-items: center;
    gap: 0;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
    padding: 0;
    z-index: 100;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 0;
    padding: 0 24px;
    height: 100%;
    border-right: 1px solid var(--border);
}

.logo-mark {
    width: 28px;
    height: 28px;
    background: var(--accent);
    border-radius: 2px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--mono);
    font-weight: 800;
    font-size: 12px;
    color: #fff;
    letter-spacing: -0.05em;
    flex-shrink: 0;
}

.logo-mark::after {
    content: 'BR';
}

.header-divider {
    width: 1px;
    height: 20px;
    background: var(--border);
    margin: 0 14px;
}

.logo-text {
    font-family: var(--mono);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.08em;
    color: var(--text);
    text-transform: uppercase;
    white-space: nowrap;
}

.logo-sub {
    font-family: var(--mono);
    font-size: 10px;
    color: var(--text-muted);
    letter-spacing: 0.05em;
    margin-left: 10px;
    padding-left: 10px;
    border-left: 1px solid var(--border);
}

.header-center {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 0 20px;
    font-family: var(--mono);
    font-size: 10px;
    color: var(--text-muted);
    letter-spacing: 0.06em;
}

.header-center .breadcrumb-sep {
    color: var(--border);
}

.header-center .breadcrumb-active {
    color: var(--text);
    font-weight: 600;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-left: auto;
    padding: 0 24px;
}

.credits-badge {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 5px 12px;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    cursor: pointer;
    transition: border-color 0.15s;
}

.credits-badge:hover {
    border-color: var(--green);
}

.credits-badge svg {
    color: var(--green);
    flex-shrink: 0;
}

.credits-l.header-breadcrumb {
    font-family: var(--mono);
    font-size: 10px;
    letter-spacing: 0.1em;
    color: var(--text-dim);
    text-transform: uppercase;
}

.header-breadcrumb a {
    color: var(--text-muted);
    text-decoration: none;
    transition: color 0.15s;
}

.header-breadcrumb a:hover {
    color: var(--accent);
}

.header-breadcrumb #breadcrumb-cat {
    color: var(--text);
    font-weight: 600;
}

.credits-value {
    font-family: var(--mono);
    font-size: 12px;
    font-weight: 700;
    color: var(--green);
}

.version-tag {
    font-family: var(--mono);
    font-size: 9px;
    color: var(--text-muted);
    padding: 3px 8px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    letter-spacing: 0.06em;
}

/* ============================================================
   LOBBY / PRE-MENU
   ============================================================ */
.lobby {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px 24px;
    overflow-y: auto;
    position: relative;
    background: linear-gradient(145deg, #050505 0%, #0a0a0a 40%, #080808 70%, #050505 100%);
    z-index: 1;
}

.lobby::before {
    content: '';
    position: fixed;
    inset: 0;
    z-index: -1;
    background:
        radial-gradient(ellipse at 20% 50%, rgba(220, 38, 38, 0.06) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 20%, rgba(220, 38, 38, 0.05) 0%, transparent 50%),
        radial-gradient(ellipse at 50% 80%, rgba(220, 38, 38, 0.04) 0%, transparent 50%);
    pointer-events: none;
}

.lobby-inner {
    max-width: 900px;
    width: 100%;
}

.lobby-hero {
    margin-bottom: 48px;
    text-align: center;
}

.lobby-hero-badge {
    font-family: var(--mono);
    font-size: 9px;
    font-weight: 600;
    letter-spacing: 0.2em;
    color: var(--accent);
    margin-bottom: 20px;
}

.lobby-title {
    font-family: var(--sans);
    font-size: clamp(32px, 5vw, 56px);
    font-weight: 900;
    letter-spacing: -0.05em;
    line-height: 1.05;
    color: var(--text);
    margin-bottom: 16px;
}

.blink {
    animation: blink-cursor 1s step-end infinite;
    color: var(--accent);
}

@keyframes blink-cursor {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0;
    }
}

.lobby-subtitle {
    font-family: var(--sans);
    font-size: 14px;
    font-weight: 300;
    color: var(--text-dim);
    line-height: 1.6;
    max-width: 480px;
    margin: 0 auto;
}

/* Lobby Grid */
.lobby-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
}

.lobby-card {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 14px;
    padding: 24px 20px;
    background: rgba(18, 18, 18, 0.5);
    border: 1px solid rgba(220, 38, 38, 0.08);
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.25s ease;
    text-align: left;
    overflow: hidden;
}

.lobby-card:hover {
    border-color: rgba(220, 38, 38, 0.3);
    background: rgba(24, 24, 24, 0.8);
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
}

.lobby-card:hover .lobby-card-glow {
    opacity: 1;
}

.lobby-card-glow {
    position: absolute;
    bottom: -40px;
    left: 50%;
    transform: translateX(-50%);
    width: 120px;
    height: 60px;
    background: radial-gradient(ellipse, rgba(220, 38, 38, 0.15), transparent 70%);
    opacity: 0;
    transition: opacity 0.3s;
    pointer-events: none;
}

.lobby-card-wide {
    grid-column: span 3;
    flex-direction: row;
    align-items: center;
    padding: 20px 24px;
}

.lobby-card-wide .lobby-card-body {
    flex: 1;
}

.lobby-card-icon {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.lobby-card-icon svg {
    width: 28px;
    height: 28px;
    color: var(--text-dim);
    transition: color 0.2s;
}

.lobby-card:hover .lobby-card-icon svg {
    color: var(--accent);
    filter: drop-shadow(0 0 8px var(--accent-glow));
}

.lobby-card-body {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
}

.lobby-card-title {
    font-family: var(--sans);
    font-size: 14px;
    font-weight: 700;
    color: var(--text);
    letter-spacing: -0.01em;
}

.lobby-card-desc {
    font-family: var(--mono);
    font-size: 9px;
    color: var(--text-muted);
    line-height: 1.4;
    letter-spacing: 0.02em;
}

.lobby-card-count {
    font-family: var(--mono);
    font-size: 9px;
    color: var(--text-muted);
    padding: 3px 8px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    white-space: nowrap;
    align-self: flex-start;
}

.lobby-card:hover .lobby-card-count {
    color: var(--accent);
    border-color: rgba(220, 38, 38, 0.3);
}

/* ── Lobby Divider & Slim Card ── */
.lobby-divider {
    margin-top: 48px;
    margin-bottom: 36px;
    font-family: var(--mono);
    font-size: 10px;
    font-weight: 700;
    color: var(--text-dim);
    letter-spacing: 0.2em;
    text-transform: uppercase;
    text-align: center;
}

.lobby-slim-card {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    height: 80px;
    padding: 0 24px;
    background: rgba(18, 18, 18, 0.5);
    border: 1px solid rgba(220, 38, 38, 0.08);
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.25s ease;
    text-align: left;
}

.lobby-slim-card:hover {
    border-color: rgba(220, 38, 38, 0.3);
    background: rgba(24, 24, 24, 0.8);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
}

.lobby-slim-card:hover .lsc-arrow {
    color: var(--accent);
}

.lobby-slim-card:hover .lsc-arrow svg {
    transform: translateX(4px);
}

.lsc-left {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
}

.lsc-icon svg {
    width: 28px;
    height: 28px;
    color: var(--text);
}

.lsc-title {
    font-family: var(--sans);
    font-size: 16px;
    font-weight: 700;
    color: var(--text);
}

.lsc-center {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 2;
    justify-content: center;
    transform: translateY(-1px);
    /* Optical alignment refinement */
}

.lsc-pill {
    font-family: var(--mono);
    font-size: 10px;
    color: var(--text-muted);
    background: var(--surface-2);
    padding: 6px 10px;
    border-radius: 4px;
    border: 1px solid var(--border);
    white-space: nowrap;
}

.lsc-right {
    display: flex;
    align-items: center;
    gap: 20px;
    flex: 1;
    justify-content: flex-end;
}

.lsc-count {
    font-family: var(--mono);
    font-size: 9px;
    color: var(--text-muted);
    padding: 3px 8px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    white-space: nowrap;
}

.lsc-arrow {
    display: flex;
    align-items: center;
    gap: 6px;
    font-family: var(--sans);
    font-size: 12px;
    font-weight: 600;
    color: var(--text-dim);
    transition: color 0.2s ease;
}

.lsc-arrow svg {
    transition: transform 0.25s ease;
}

/* ============================================================
   WORKSPACE LAYOUT (2-column: sidebar + results)
   ============================================================ */
#app-main {
    display: grid;
    grid-template-columns: 380px 1fr;
    height: calc(100vh - var(--header-h));
    overflow: hidden;
    transition: grid-template-columns 0.3s ease;
}

.panel {
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* ── Panel Header Bar ── */
.panel-topbar {
    padding: 14px 20px;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--surface);
}

.panel-topbar-title {
    font-family: var(--mono);
    font-size: 10px;
    font-weight: 700;
    color: var(--text-muted);
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.panel-topbar-sub {
    font-family: var(--mono);
    font-size: 9px;
    color: var(--text-muted);
    margin-top: 2px;
}

/* ── LEFT PANEL (Prompt) ── */
#panel-prompt {
    border-right: 1px solid var(--border);
    background: var(--surface);
}

.panel-scroll {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

/* ── Model Picker Trigger Button ── */
.model-picker-trigger-wrap {
    padding: 10px 16px;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
    background: var(--surface);
}

.model-picker-trigger {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 10px 14px;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    cursor: pointer;
    transition: all 0.15s;
    gap: 10px;
}

.model-picker-trigger:hover {
    border-color: var(--accent);
    background: var(--surface-3);
}

.model-picker-trigger.has-model {
    border-color: var(--border-hover);
}

.mpt-left {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
    flex: 1;
}

.mpt-icon {
    width: 34px;
    height: 34px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--mono);
    font-size: 11px;
    font-weight: 700;
    border: 1px solid var(--border);
    border-radius: var(--radius);
}

.mpt-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
    text-align: left;
}

.mpt-label {
    font-family: var(--mono);
    font-size: 8px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

.mpt-name {
    font-family: var(--sans);
    font-size: 13px;
    font-weight: 600;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.mpt-right {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.mpt-cost {
    font-family: var(--mono);
    font-size: 9px;
    padding: 2px 7px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    white-space: nowrap;
}

.mpt-chevron {
    color: var(--text-muted);
    flex-shrink: 0;
    transition: transform 0.2s;
}

.model-picker-trigger:hover .mpt-chevron {
    color: var(--accent);
    transform: translateY(2px);
}

/* V1 .config-panel-inline and .inline-params-header removed */

/* ── Model Picker Modal ── */
.model-picker-modal {
    position: fixed;
    inset: 0;
    z-index: 500;
    display: flex;
    align-items: center;
    justify-content: center;
}

.model-picker-modal.hidden {
    display: none;
}

.mpm-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(6px);
    animation: mpm-fade-in 0.2s ease;
}

@keyframes mpm-fade-in {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

.mpm-panel {
    position: relative;
    z-index: 10;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    width: min(900px, calc(100vw - 48px));
    max-height: calc(100vh - 80px);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: mpm-slide-up 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
    box-shadow: 0 32px 80px rgba(0, 0, 0, 0.6);
}

@keyframes mpm-slide-up {
    from {
        opacity: 0;
        transform: translateY(24px) scale(0.97);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.mpm-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}

.mpm-title {
    font-family: var(--sans);
    font-size: 16px;
    font-weight: 700;
    color: var(--text);
}

.mpm-subtitle {
    font-family: var(--mono);
    font-size: 10px;
    color: var(--text-muted);
    margin-top: 4px;
    letter-spacing: 0.05em;
}

.mpm-close {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.15s;
    flex-shrink: 0;
}

.mpm-close:hover {
    border-color: var(--accent);
    color: var(--accent);
}

.mpm-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 10px;
    padding: 20px 24px 28px;
    overflow-y: auto;
    flex: 1;
    min-height: 0;
    align-content: start;
}

.mpm-grid::after {
    content: "";
    display: block;
    height: 10px;
    grid-column: 1 / -1;
}

/* Model Picker Card */
.mpm-card {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 14px;
    padding: 20px;
    padding-top: 22px;
    background: rgba(18, 18, 18, 0.5);
    border: 1px solid rgba(220, 38, 38, 0.08);
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.25s ease;
    overflow: hidden;
}

/* ── Provider brand accent stripe ── */
.task-card-accent,
.history-card-accent {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    opacity: 0.7;
    transition: opacity 0.2s;
    z-index: 10;
}

.task-card-accent {
    border-radius: 12px 12px 0 0;
    height: 4px;
}

.history-card-accent {
    border-radius: 6px 6px 0 0;
    height: 3px;
    z-index: 20;
}

.task-card:hover .task-card-accent,
.history-card:hover .history-card-accent {
    opacity: 1;
}

.task-card-accent.mc-yellow,
.history-card-accent.mc-yellow {
    background: linear-gradient(90deg, #ffd600, #ffab00);
}

.task-card-accent.mc-purple,
.history-card-accent.mc-purple {
    background: linear-gradient(90deg, #b44fff, #7c4dff);
}

.task-card-accent.mc-blue,
.history-card-accent.mc-blue {
    background: linear-gradient(90deg, #2979ff, #448aff);
}

.task-card-accent.mc-white,
.history-card-accent.mc-white {
    background: linear-gradient(90deg, #d0d0d0, #9e9e9e);
}

.task-card-accent.mc-orange,
.history-card-accent.mc-orange {
    background: linear-gradient(90deg, #ff8c00, #ff6d00);
}

.task-card-accent.mc-cyan,
.history-card-accent.mc-cyan {
    background: linear-gradient(90deg, #00d4ee, #00bcd4);
}

.task-card-accent.mc-green,
.history-card-accent.mc-green {
    background: linear-gradient(90deg, #00e760, #00c853);
}

.task-card-accent.mc-red,
.history-card-accent.mc-red {
    background: linear-gradient(90deg, #ef4444, #dc2626);
}

.task-card-accent.mc-pink,
.history-card-accent.mc-pink {
    background: linear-gradient(90deg, #ff4081, #e91e63);
}

.task-card-accent.mc-teal,
.history-card-accent.mc-teal {
    background: linear-gradient(90deg, #00bfa5, #009688);
}

.task-card-accent.mc-indigo,
.history-card-accent.mc-indigo {
    background: linear-gradient(90deg, #7986cb, #3f51b5);
}

.task-card-accent.mc-coral,
.history-card-accent.mc-coral {
    background: linear-gradient(90deg, #ff7f50, #ff6347);
}

.task-card-accent.mc-ideogram,
.history-card-accent.mc-ideogram {
    background: linear-gradient(90deg, #FF3B30, #007AFF);
}

.task-card-accent.mc-qwen,
.history-card-accent.mc-qwen {
    background: linear-gradient(90deg, #1C0123, #7B61FF);
}

.task-card-accent.mc-flux,
.history-card-accent.mc-flux {
    background: linear-gradient(90deg, #FFFFFF, #999999);
}

.task-card-accent.mc-bytedance,
.history-card-accent.mc-bytedance {
    background: linear-gradient(90deg, #00C8FF, #0055FF);
}

.task-card-accent.mc-openai,
.history-card-accent.mc-openai {
    background: linear-gradient(90deg, #10A37F, #0E8F6F);
}

.task-card-accent.mc-kling,
.history-card-accent.mc-kling {
    background: linear-gradient(90deg, #0099FF, #00C4B6);
}

.task-card-accent.mc-wan,
.history-card-accent.mc-wan {
    background: linear-gradient(90deg, #026AF0, #14B8FF);
}

.mpm-card:hover {
    border-color: rgba(220, 38, 38, 0.3);
    background: rgba(24, 24, 24, 0.8);
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
}

.mpm-card.active {
    border-color: var(--accent);
    background: var(--accent-dim);
}

.mpm-card[data-color="mc-ideogram"] {
    background: radial-gradient(circle at 100% 0%, rgba(0, 122, 255, 0.05), var(--surface-2) 60%);
}

.mpm-card.active[data-color="mc-ideogram"] {
    border-color: #007AFF;
    background: radial-gradient(circle at 100% 0%, rgba(0, 122, 255, 0.1), var(--surface-2) 70%);
}

.mpm-card[data-color="mc-qwen"] {
    background: radial-gradient(circle at 100% 0%, rgba(123, 97, 255, 0.05), var(--surface-2) 60%);
}

.mpm-card.active[data-color="mc-qwen"] {
    border-color: #7B61FF;
    background: radial-gradient(circle at 100% 0%, rgba(123, 97, 255, 0.1), var(--surface-2) 70%);
}

.mpm-card[data-color="mc-flux"] {
    background: radial-gradient(circle at 100% 0%, rgba(255, 255, 255, 0.03), var(--surface-2) 60%);
}

.mpm-card.active[data-color="mc-flux"] {
    border-color: #FFFFFF;
    background: radial-gradient(circle at 100% 0%, rgba(255, 255, 255, 0.08), var(--surface-2) 70%);
}

.mpm-card[data-color="mc-kling"] {
    background: radial-gradient(circle at 100% 0%, rgba(0, 196, 182, 0.05), var(--surface-2) 60%);
}

.mpm-card.active[data-color="mc-kling"] {
    border-color: #00C4B6;
    background: radial-gradient(circle at 100% 0%, rgba(0, 196, 182, 0.1), var(--surface-2) 70%);
}

.mpm-card[data-color="mc-openai"] {
    background: radial-gradient(circle at 100% 0%, rgba(16, 163, 127, 0.05), var(--surface-2) 60%);
}

.mpm-card.active[data-color="mc-openai"] {
    border-color: #10A37F;
    background: radial-gradient(circle at 100% 0%, rgba(16, 163, 127, 0.1), var(--surface-2) 70%);
}

.mpm-card[data-color="mc-bytedance"] {
    background: radial-gradient(circle at 100% 0%, rgba(0, 85, 255, 0.05), var(--surface-2) 60%);
}

.mpm-card.active[data-color="mc-bytedance"] {
    border-color: #0055FF;
    background: radial-gradient(circle at 100% 0%, rgba(0, 85, 255, 0.1), var(--surface-2) 70%);
}

.mpm-card[data-color="mc-wan"] {
    background: radial-gradient(circle at 100% 0%, rgba(2, 106, 240, 0.05), var(--surface-2) 60%);
}

.mpm-card.active[data-color="mc-wan"] {
    border-color: #026AF0;
    background: radial-gradient(circle at 100% 0%, rgba(2, 106, 240, 0.1), var(--surface-2) 70%);
}



/* V1 card sub-elements removed (.mpm-card-top, .mpm-card-icon, .mpm-card-cost,
   .mpm-card-name, .mpm-card-provider, .mpm-card-desc, .mpm-card-footer,
   .mpm-card-tag, .mpm-card-glow) — all cards now use V2 glassmorphism design */

/* ============================================================
   NANO BANANA V2 — Glassmorphism Experimental Card
   Inspired by modern dark AI studio interfaces
   ============================================================ */

/* ── V2 Glassmorphism Card Design (all image cards) ── */

/* ── Provider color tokens ── */
.mpm-card-v2 {
    --v2-c1: 96, 165, 250;
    --v2-c2: 139, 92, 246;
}

.mpm-card-v2[data-color="mc-yellow"] {
    --v2-c1: 255, 214, 0;
    --v2-c2: 255, 171, 0;
}

.mpm-card-v2[data-color="mc-purple"] {
    --v2-c1: 180, 79, 255;
    --v2-c2: 124, 77, 255;
}

.mpm-card-v2[data-color="mc-blue"] {
    --v2-c1: 41, 121, 255;
    --v2-c2: 68, 138, 255;
}

.mpm-card-v2[data-color="mc-green"] {
    --v2-c1: 0, 231, 96;
    --v2-c2: 0, 200, 83;
}

.mpm-card-v2[data-color="mc-bytedance"] {
    --v2-c1: 0, 200, 255;
    --v2-c2: 0, 85, 255;
}

.mpm-card-v2[data-color="mc-flux"] {
    --v2-c1: 200, 200, 200;
    --v2-c2: 150, 150, 150;
}

.mpm-card-v2[data-color="mc-ideogram"] {
    --v2-c1: 255, 59, 48;
    --v2-c2: 0, 122, 255;
}

.mpm-card-v2[data-color="mc-qwen"] {
    --v2-c1: 123, 97, 255;
    --v2-c2: 80, 50, 200;
}

.mpm-card-v2[data-color="mc-openai"] {
    --v2-c1: 16, 163, 127;
    --v2-c2: 14, 200, 160;
}

.mpm-card-v2[data-color="mc-nano-v2"] {
    --v2-c1: 96, 165, 250;
    --v2-c2: 167, 139, 250;
}

.mpm-card-v2[data-color="mc-kling"] {
    --v2-c1: 0, 153, 255;
    --v2-c2: 0, 196, 182;
}

.mpm-card-v2[data-color="mc-wan"] {
    --v2-c1: 2, 106, 240;
    --v2-c2: 20, 184, 255;
}

.mpm-card-v2[data-color="mc-red"] {
    --v2-c1: 239, 68, 68;
    --v2-c2: 220, 38, 38;
}

.mpm-card-v2[data-color="mc-pink"] {
    --v2-c1: 255, 64, 129;
    --v2-c2: 233, 30, 99;
}

.mpm-card-v2[data-color="mc-teal"] {
    --v2-c1: 0, 191, 165;
    --v2-c2: 0, 150, 136;
}

.mpm-card-v2[data-color="mc-orange"] {
    --v2-c1: 255, 140, 0;
    --v2-c2: 255, 109, 0;
}

.mpm-card-v2[data-color="mc-cyan"] {
    --v2-c1: 0, 212, 238;
    --v2-c2: 0, 188, 212;
}

.mpm-card-v2[data-color="mc-coral"] {
    --v2-c1: 255, 127, 80;
    --v2-c2: 255, 99, 71;
}

.mpm-card-v2[data-color="mc-indigo"] {
    --v2-c1: 121, 134, 203;
    --v2-c2: 63, 81, 181;
}

.mpm-card-v2[data-color="mc-white"] {
    --v2-c1: 208, 208, 208;
    --v2-c2: 158, 158, 158;
}

.mpm-card.mpm-card-v2 {
    position: relative;
    padding: 0;
    background: transparent;
    border: none;
    border-radius: 16px;
    overflow: hidden;
    cursor: pointer;
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.3s ease;
}

.mpm-card.mpm-card-v2:hover {
    transform: translateY(-4px) scale(1.01);
    box-shadow:
        0 20px 60px rgba(var(--v2-c1), 0.15),
        0 0 40px rgba(var(--v2-c2), 0.1);
    background: transparent;
    border: none;
}

.mpm-card.mpm-card-v2.active {
    border: none;
    background: transparent;
}

/* ── Animated gradient border ── */
.mpm-v2-glow-border {
    position: absolute;
    inset: 0;
    border-radius: 16px;
    padding: 1px;
    background: linear-gradient(135deg,
            rgba(var(--v2-c1), 0.6),
            rgba(var(--v2-c2), 0.4),
            rgba(var(--v2-c1), 0.2),
            rgba(var(--v2-c2), 0.6));
    background-size: 300% 300%;
    animation: v2-border-shift 6s ease infinite;
    -webkit-mask:
        linear-gradient(#fff 0 0) content-box,
        linear-gradient(#fff 0 0);
    mask:
        linear-gradient(#fff 0 0) content-box,
        linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    pointer-events: none;
    z-index: 1;
}

@keyframes v2-border-shift {

    0%,
    100% {
        background-position: 0% 50%;
    }

    50% {
        background-position: 100% 50%;
    }
}

.mpm-card.mpm-card-v2:hover .mpm-v2-glow-border {
    background: linear-gradient(135deg,
            rgba(var(--v2-c1), 0.9),
            rgba(var(--v2-c2), 0.7),
            rgba(var(--v2-c1), 0.5),
            rgba(var(--v2-c2), 0.9));
    background-size: 300% 300%;
    animation: v2-border-shift 3s ease infinite;
}

/* ── Inner glass panel ── */
.mpm-v2-inner {
    position: relative;
    z-index: 2;
    display: flex;
    flex-direction: column;
    gap: 14px;
    padding: 20px;
    height: 100%;
    background: linear-gradient(145deg,
            rgba(15, 15, 30, 0.95),
            rgba(10, 10, 25, 0.85));
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border-radius: 16px;
}

/* ── Header: icon + badge ── */
.mpm-v2-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.mpm-v2-icon {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, rgba(var(--v2-c1), 0.15), rgba(var(--v2-c2), 0.15));
    border: 1px solid rgba(var(--v2-c1), 0.2);
    border-radius: 12px;
    color: rgb(var(--v2-c1));
    transition: all 0.3s ease;
}

.mpm-v2-icon svg {
    width: 22px;
    height: 22px;
}

.mpm-card.mpm-card-v2:hover .mpm-v2-icon {
    background: linear-gradient(135deg, rgba(var(--v2-c1), 0.25), rgba(var(--v2-c2), 0.25));
    border-color: rgba(var(--v2-c1), 0.4);
    box-shadow: 0 0 20px rgba(var(--v2-c1), 0.2);
}

.mpm-card.mpm-card-v2.active .mpm-v2-icon {
    background: linear-gradient(135deg, rgba(var(--v2-c1), 0.35), rgba(var(--v2-c2), 0.35));
    border-color: rgba(var(--v2-c1), 0.6);
    box-shadow: 0 0 30px rgba(var(--v2-c1), 0.3);
}

.mpm-v2-badge {
    font-family: var(--mono);
    font-size: 8px;
    font-weight: 700;
    letter-spacing: 0.15em;
    padding: 4px 10px;
    border-radius: 20px;
    background: linear-gradient(135deg, rgba(var(--v2-c1), 0.15), rgba(var(--v2-c2), 0.15));
    border: 1px solid rgba(var(--v2-c1), 0.25);
    color: rgb(var(--v2-c1));
    text-transform: uppercase;
}

/* ── Body: name, provider, desc ── */
.mpm-v2-body {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.mpm-v2-name {
    font-family: var(--sans);
    font-size: 16px;
    font-weight: 800;
    color: #ffffff;
    letter-spacing: -0.02em;
    line-height: 1.2;
    background: linear-gradient(135deg, #ffffff, rgb(var(--v2-c1)));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.mpm-v2-provider {
    font-family: var(--sans);
    font-size: 11px;
    color: rgba(148, 163, 184, 0.8);
    font-weight: 500;
    margin-bottom: 4px;
}

.mpm-v2-desc {
    font-family: var(--sans);
    font-size: 11px;
    color: rgba(148, 163, 184, 0.6);
    line-height: 1.5;
}

/* ── Features list ── */
.mpm-v2-features {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    padding-top: 8px;
    border-top: 1px solid rgba(var(--v2-c1), 0.1);
}

.mpm-v2-feature {
    display: flex;
    align-items: center;
    gap: 6px;
    font-family: var(--mono);
    font-size: 10px;
    color: rgba(148, 163, 184, 0.7);
    letter-spacing: 0.02em;
}

.mpm-v2-dot {
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: linear-gradient(135deg, rgb(var(--v2-c1)), rgb(var(--v2-c2)));
    flex-shrink: 0;
}

/* ── Footer: tag + cost ── */
.mpm-v2-footer {
    display: flex;
    align-items: center;
    gap: 8px;
}

.mpm-v2-tag {
    font-family: var(--mono);
    font-size: 9px;
    font-weight: 700;
    padding: 4px 10px;
    border-radius: 6px;
    background: rgba(var(--v2-c1), 0.12);
    color: rgb(var(--v2-c1));
    text-transform: uppercase;
    letter-spacing: 0.06em;
    border: 1px solid rgba(var(--v2-c1), 0.15);
}

.mpm-v2-cost {
    font-family: var(--mono);
    font-size: 9px;
    font-weight: 600;
    padding: 4px 10px;
    border-radius: 6px;
    background: rgba(34, 197, 94, 0.1);
    color: #4ade80;
    border: 1px solid rgba(34, 197, 94, 0.15);
}

/* ── Ambient glow behind card ── */
.mpm-v2-ambient {
    position: absolute;
    bottom: -40px;
    left: 50%;
    transform: translateX(-50%);
    width: 80%;
    height: 80px;
    background: radial-gradient(ellipse,
            rgba(var(--v2-c1), 0.15),
            rgba(var(--v2-c2), 0.08) 40%,
            transparent 70%);
    opacity: 0;
    transition: opacity 0.4s ease;
    pointer-events: none;
    z-index: 0;
}

.mpm-card.mpm-card-v2:hover .mpm-v2-ambient {
    opacity: 1;
}

.mpm-card.mpm-card-v2.active .mpm-v2-ambient {
    opacity: 0.8;
}

/* ── Active state: enhanced glow ── */
.mpm-card.mpm-card-v2.active .mpm-v2-glow-border {
    background: linear-gradient(135deg,
            rgba(var(--v2-c1), 1),
            rgba(var(--v2-c2), 0.8),
            rgba(var(--v2-c1), 0.6),
            rgba(var(--v2-c2), 1));
    background-size: 300% 300%;
    animation: v2-border-shift 2s ease infinite;
}

.mpm-card.mpm-card-v2.active .mpm-v2-inner {
    background: linear-gradient(145deg,
            rgba(20, 20, 45, 0.95),
            rgba(15, 15, 35, 0.9));
}

.mpm-card.mpm-card-v2.active .mpm-v2-badge {
    background: linear-gradient(135deg, rgba(var(--v2-c1), 0.25), rgba(var(--v2-c2), 0.25));
    border-color: rgba(var(--v2-c1), 0.5);
    color: #bfdbfe;
}

/* ── Accent stripe color for v2 ── */
.task-card-accent.mc-nano-v2,
.history-card-accent.mc-nano-v2 {
    background: linear-gradient(90deg, #60a5fa, #a78bfa);
}

.model-selector-grid {
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
}

.model-chip {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    cursor: pointer;
    transition: all 0.15s;
    font-size: 0;
    line-height: 1;
}

.model-chip:hover {
    border-color: rgba(220, 38, 38, 0.3);
    background: rgba(24, 24, 24, 0.8);
}

.model-chip.active {
    border-color: var(--accent);
    background: var(--accent-dim);
}

.model-chip .mc-icon {
    width: 24px;
    height: 24px;
    font-size: 9px;
}

.model-chip-name {
    font-family: var(--sans);
    font-size: 10px;
    font-weight: 600;
    color: var(--text);
    white-space: nowrap;
}

.model-chip.active .model-chip-name {
    color: var(--accent);
}

.model-chip-provider {
    font-family: var(--mono);
    font-size: 8px;
    color: var(--text-muted);
    display: none;
}

.model-context-desc {
    font-family: var(--sans);
    font-size: 11px;
    color: var(--text-dim);
    line-height: 1.5;
    margin-top: 10px;
    min-height: 33px;
    /* 2 lines approx */
    padding: 0 4px;
}

/* Prompt word count & shortcuts */
.prompt-wrapper {
    position: relative;
    display: flex;
    flex-direction: column;
}

.prompt-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 6px;
    padding: 0 4px;
}

.shortcut-legend {
    font-family: var(--mono);
    font-size: 9px;
    color: var(--text-muted);
}

.kbd {
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 3px;
    padding: 1px 4px;
    font-size: 9px;
    color: var(--text-dim);
}

.btn-text-only {
    background: none;
    border: none;
    color: var(--text-muted);
    font-family: var(--mono);
    font-size: 9px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    cursor: pointer;
    padding: 2px 4px;
    transition: color 0.15s;
}

.btn-text-only:hover {
    color: var(--accent);
}

/* Tab pulse animation */
.tab-pulse {
    position: relative;
}

.tab-pulse::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 100%;
    height: 100%;
    background: var(--accent);
    border-radius: 50%;
    transform: translate(-50%, -50%) scale(0.5);
    opacity: 0;
    pointer-events: none;
    animation: tab-pulse-anim 0.8s ease-out;
}

@keyframes tab-pulse-anim {
    0% {
        transform: translate(-50%, -50%) scale(0.8);
        opacity: 0.5;
    }

    100% {
        transform: translate(-50%, -50%) scale(2);
        opacity: 0;
    }
}

/* ============================================================
   CATEGORY FILTER
   ============================================================ */
.cat-filter {
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
}

.cat-btn {
    padding: 5px 10px;
    font-family: var(--mono);
    font-size: 9px;
    font-weight: 600;
    color: var(--text-muted);
    background: transparent;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    cursor: pointer;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    transition: all 0.15s;
    white-space: nowrap;
}

.cat-btn:hover {
    color: var(--text-dim);
    border-color: var(--border-hover);
}

.cat-btn.active {
    color: var(--bg);
    background: var(--text);
    border-color: var(--text);
}

/* ============================================================
   MODEL CATALOG (kept for legacy compat)
   ============================================================ */
.model-catalog {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.model-group-label {
    font-family: var(--mono);
    font-size: 9px;
    font-weight: 700;
    color: var(--accent);
    text-transform: uppercase;
    letter-spacing: 0.12em;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.model-group-label::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--border);
}

.model-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4px;
}

.model-card {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
    padding: 10px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    cursor: pointer;
    transition: all 0.15s;
    text-align: left;
    width: 100%;
    position: relative;
}

.model-card:hover {
    background: var(--surface-2);
    border-color: var(--border-hover);
}

.model-card.active {
    border-color: var(--accent);
    background: var(--accent-dim);
}

/* Model icon — text badge */
.mc-icon {
    width: 32px;
    height: 32px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--mono);
    font-size: 11px;
    font-weight: 700;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    letter-spacing: 0;
}

.model-card.active .mc-icon {
    box-shadow: 0 0 10px currentColor;
    opacity: 1;
}

.mc-top {
    display: flex;
    align-items: center;
    gap: 7px;
    width: 100%;
    min-width: 0;
}

.mc-info {
    flex: 1;
    min-width: 0;
    overflow: hidden;
}

.mc-bottom {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
}

/* Provider color variants */
.mc-purple {
    background: rgba(148, 0, 211, 0.15);
    color: #b44fff;
    border-color: rgba(148, 0, 211, 0.3);
}

.mc-blue {
    background: rgba(41, 121, 255, 0.15);
    color: #5b9aff;
    border-color: rgba(41, 121, 255, 0.3);
}

.mc-cyan {
    background: rgba(0, 188, 212, 0.15);
    color: #00d4ee;
    border-color: rgba(0, 188, 212, 0.3);
}

.mc-green {
    background: rgba(0, 200, 83, 0.15);
    color: #00e760;
    border-color: rgba(0, 200, 83, 0.3);
}

.mc-teal {
    background: rgba(0, 150, 136, 0.15);
    color: #00bfa5;
    border-color: rgba(0, 150, 136, 0.3);
}

.mc-yellow {
    background: rgba(255, 214, 0, 0.15);
    color: #ffd600;
    border-color: rgba(255, 214, 0, 0.3);
}

.mc-orange {
    background: rgba(255, 109, 0, 0.15);
    color: #ff8c00;
    border-color: rgba(255, 109, 0, 0.3);
}

.mc-red {
    background: rgba(220, 38, 38, 0.15);
    color: #DC2626;
    border-color: rgba(220, 38, 38, 0.3);
}

.mc-pink {
    background: rgba(233, 30, 99, 0.15);
    color: #ff4081;
    border-color: rgba(233, 30, 99, 0.3);
}

.mc-indigo {
    background: rgba(63, 81, 181, 0.15);
    color: #7986cb;
    border-color: rgba(63, 81, 181, 0.3);
}

.mc-white {
    background: rgba(240, 240, 240, 0.1);
    color: #d0d0d0;
    border-color: rgba(240, 240, 240, 0.2);
}

.mc-coral {
    background: rgba(255, 127, 80, 0.15);
    color: #ff7f50;
    border-color: rgba(255, 127, 80, 0.3);
}

.mc-name {
    font-size: 10px;
    font-weight: 600;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-family: var(--sans);
    line-height: 1.2;
    display: block;
}

.mc-provider {
    font-family: var(--mono);
    font-size: 8px;
    color: var(--text-muted);
    margin-top: 1px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: block;
}

.mc-type {
    font-family: var(--mono);
    font-size: 7px;
    padding: 2px 5px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text-muted);
    text-transform: uppercase;
    white-space: nowrap;
    flex-shrink: 0;
    letter-spacing: 0.05em;
}

.mc-type-file {
    background: rgba(0, 200, 83, 0.08);
    color: var(--green);
    border-color: rgba(0, 200, 83, 0.2);
}

.mc-type-text {
    background: rgba(41, 121, 255, 0.08);
    color: #5b9aff;
    border-color: rgba(41, 121, 255, 0.2);
}

.model-card.active .mc-type {
    border-color: var(--accent);
    color: var(--accent);
}

/* ============================================================
   CONFIG PANEL
   ============================================================ */
.config-panel {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.config-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 10px 12px;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}

.config-selected {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
    min-width: 0;
}

.config-cost-tag {
    font-family: var(--mono);
    font-size: 9px;
    padding: 2px 6px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text-muted);
    white-space: nowrap;
}

.cost-low {
    color: var(--green);
    border-color: rgba(0, 200, 83, 0.3);
}

.cost-mid {
    color: var(--yellow);
    border-color: rgba(255, 214, 0, 0.3);
}

.cost-high {
    color: var(--accent);
    border-color: rgba(220, 38, 38, 0.3);
}

/* Params Empty */
.params-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    padding: 40px 20px;
    text-align: center;
}

.params-empty svg {
    color: var(--text-muted);
    opacity: 0.4;
}

.params-empty p {
    font-family: var(--mono);
    font-size: 10px;
    color: var(--text-muted);
    line-height: 1.5;
}

/* Forms */
.form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.form-label {
    font-family: var(--mono);
    font-size: 9px;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

.form-input,
.form-textarea,
.form-select {
    padding: 10px 12px;
    font-size: 12px;
    font-family: var(--mono);
    color: var(--text);
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    outline: none;
    transition: border-color 0.15s;
    width: 100%;
}

.form-textarea {
    resize: vertical;
    min-height: 80px;
    line-height: 1.6;
}

.form-input:focus,
.form-textarea:focus,
.form-select:focus {
    border-color: var(--accent);
}

.form-textarea::placeholder,
.form-input::placeholder {
    color: var(--text-muted);
}

/* Radio Pills */
.radio-group {
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
}

.radio-pill {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    font-size: 10px;
    font-family: var(--mono);
    color: var(--text-muted);
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    cursor: pointer;
    transition: all 0.15s;
    user-select: none;
}

.radio-pill:hover {
    border-color: var(--border-hover);
    color: var(--text-dim);
}

.radio-pill:has(input:checked) {
    border-color: var(--accent);
    color: var(--accent);
    background: var(--accent-dim);
}

.radio-pill input[type="radio"] {
    display: none;
}

/* Upload Zone */
.upload-zone {
    border: 2px dashed var(--border);
    border-radius: var(--radius);
    padding: 28px 20px;
    text-align: center;
    cursor: pointer;
    transition: all 0.15s;
    background: var(--surface-2);
    position: relative;
    overflow: hidden;
}

.upload-zone:hover,
.upload-zone.dragover {
    border-color: var(--accent);
    background: var(--accent-dim);
}

.upload-icon {
    color: var(--text-muted);
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.upload-zone:hover .upload-icon {
    color: var(--accent);
}

.upload-text {
    font-family: var(--mono);
    font-size: 11px;
    color: var(--text-muted);
}

.upload-hint {
    font-family: var(--mono);
    font-size: 9px;
    color: var(--text-muted);
    margin-top: 4px;
    opacity: 0.6;
}

.upload-link {
    color: var(--text-dim);
    text-decoration: underline;
}

/* File Preview */
.file-preview {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}

.file-preview-thumb {
    width: 36px;
    height: 36px;
    background: #000;
    border-radius: var(--radius);
    overflow: hidden;
    flex-shrink: 0;
}

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

.file-preview-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.file-preview-name {
    font-family: var(--mono);
    font-size: 11px;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.file-preview-size {
    font-family: var(--mono);
    font-size: 9px;
    color: var(--text-muted);
}

.file-preview-remove {
    background: none;
    border: 1px solid var(--border);
    color: var(--text-muted);
    width: 22px;
    height: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius);
    cursor: pointer;
    flex-shrink: 0;
    transition: all 0.15s;
}

.file-preview-remove:hover {
    border-color: var(--accent);
    color: var(--accent);
}

/* ── Submit Button ── */
.btn-primary {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 13px 20px;
    font-size: 11px;
    font-weight: 700;
    color: #fff;
    background: var(--accent);
    border: none;
    border-radius: var(--radius);
    cursor: pointer;
    transition: all 0.2s;
    font-family: var(--mono);
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

.btn-primary:hover:not(:disabled) {
    background: #ef4444;
    transform: translateY(-1px);
}

.btn-primary:disabled {
    background: var(--surface-2);
    color: var(--text-muted);
    cursor: not-allowed;
    border: 1px solid var(--border);
    transform: none;
}

.btn-primary.loading {
    opacity: 0.7;
    cursor: wait;
    pointer-events: none;
    position: relative;
}

.btn-primary.loading::after {
    content: '';
    display: inline-block;
    width: 14px;
    height: 14px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: btn-spin 0.6s linear infinite;
    margin-left: 6px;
}

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

/* ── Prompt Char Counter ── */
.prompt-char-counter {
    font-family: var(--mono);
    font-size: 10px;
    font-weight: 600;
    transition: color 0.2s;
}

.prompt-char-counter.char-ok {
    color: var(--text-muted);
}

.prompt-char-counter.char-warn {
    color: var(--yellow);
}

.prompt-char-counter.char-over {
    color: #ef4444;
}

/* ── Ghost Button ── */
.btn-ghost {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 5px 10px;
    font-size: 9px;
    font-weight: 600;
    color: var(--text-muted);
    background: transparent;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    cursor: pointer;
    transition: all 0.15s;
    font-family: var(--mono);
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.btn-ghost:hover {
    color: var(--accent);
    border-color: var(--accent);
    background: var(--accent-dim);
}

.btn-ghost.btn-danger:hover {
    color: var(--accent);
    border-color: var(--accent);
}

.btn-sm {
    padding: 4px 8px;
    font-size: 9px;
}

/* ============================================================
   RIGHT PANEL — PARAMETERS
   ============================================================ */
#panel-params {
    border-left: 1px solid var(--border);
    background: var(--surface);
}

/* ============================================================
   CENTER PANEL — RESULTS
   ============================================================ */
#panel-results {
    background: var(--bg);
}

/* Tabs */
.panel-tabs {
    display: flex;
    align-items: center;
    gap: 0;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    padding: 0 20px;
    flex-shrink: 0;
}

.panel-tab {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 16px 16px;
    font-family: var(--mono);
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-muted);
    background: transparent;
    border: none;
    border-bottom: 2px solid transparent;
    cursor: pointer;
    transition: all 0.15s;
    margin-bottom: -1px;
}

.panel-tab:hover {
    color: var(--text-dim);
}

.panel-tab.active {
    color: var(--accent);
    border-bottom-color: var(--accent);
}

.panel-tab-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 18px;
    height: 18px;
    padding: 0 4px;
    font-size: 9px;
    background: var(--surface-2);
    color: var(--text-muted);
    border-radius: var(--radius);
}

.panel-tab.active .panel-tab-count {
    background: var(--accent);
    color: #fff;
}

.panel-tab-actions {
    margin-left: auto;
    display: flex;
    gap: 6px;
}

/* Tab content */
.tab-content {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding: 20px;
}

/* ── Tasks List ── */
.tasks-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

/* ── Empty State ── */
.tasks-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 80px 20px;
    opacity: 0.35;
}

.tasks-empty svg {
    display: block;
    flex-shrink: 0;
    opacity: 0.5;
}

.tasks-empty p {
    font-family: var(--mono);
    font-size: 12px;
    color: var(--text-muted);
    text-align: center;
    line-height: 1.5;
}

.tasks-empty-hint {
    font-size: 10px !important;
    margin-top: -6px;
}

/* ── Task Card (redesigned) ── */
.task-card {
    background: rgba(18, 18, 18, 0.5);
    border: 1px solid rgba(220, 38, 38, 0.08);
    border-radius: 12px;
    overflow: hidden;
    position: relative;
    margin-bottom: 12px;
    transition: all 0.25s ease;
}

.task-card:hover {
    border-color: rgba(220, 38, 38, 0.3);
    background: rgba(24, 24, 24, 0.8);
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
}

/* Status Indicator Strip (Left edge) */
.task-card::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 3px;
    background: transparent;
    z-index: 2;
    transition: background-color 0.3s;
}

.task-card.state-processing::before,
.task-card.state-waiting::before {
    background: var(--yellow);
    box-shadow: 0 0 10px rgba(255, 214, 0, 0.4);
    animation: strip-pulse 2s ease-in-out infinite;
}

.task-card.state-success::before {
    background: var(--green);
    box-shadow: 0 0 10px rgba(0, 200, 83, 0.3);
}

.task-card.state-fail::before {
    background: var(--accent);
    /* Red */
    box-shadow: 0 0 10px rgba(220, 38, 38, 0.3);
}

@keyframes strip-pulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.5;
    }
}

/* ── Card header ── */
.task-card-header {
    padding: 12px 14px 12px 18px;
    /* Extra left padding for strip */
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    background: rgba(0, 0, 0, 0.1);
}

.task-card-left {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
    flex: 1;
}

/* Spinner / status icon */
.task-card-icon {
    width: 34px;
    height: 34px;
    border-radius: 8px;
    background: var(--surface-2);
    border: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 14px;
    position: relative;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.02);
}

.task-card-icon.processing,
.task-card-icon.waiting {
    color: var(--yellow);
}

.task-card-icon.processing::after,
.task-card-icon.waiting::after {
    content: '';
    position: absolute;
    inset: -1px;
    border-radius: 8px;
    border: 2px solid transparent;
    border-top-color: var(--yellow);
    border-right-color: var(--yellow);
    animation: spin-icon 1s linear infinite;
    opacity: 0.8;
}

.task-card-icon.success {
    color: var(--green);
}

.task-card-icon.fail {
    color: var(--accent);
}

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

/* Model + prompt info */
.task-card-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.card-model-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    border-radius: 3px;
    font-size: 9px;
    font-weight: 800;
    margin-right: 6px;
    vertical-align: middle;
}

.task-card-model {
    font-family: var(--mono);
    font-size: 12px;
    font-weight: 700;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.task-card-prompt-preview {
    font-size: 11px;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 220px;
    line-height: 1.3;
}

/* Badge */
.task-card-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-family: var(--mono);
    font-size: 9px;
    font-weight: 700;
    padding: 4px 8px;
    border-radius: 4px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    flex-shrink: 0;
    white-space: nowrap;
    border: 1px solid transparent;
}

.task-card-badge.processing,
.task-card-badge.waiting {
    color: var(--yellow);
    background: rgba(255, 214, 0, 0.08);
    border-color: rgba(255, 214, 0, 0.2);
    animation: badge-pulse 2s ease-in-out infinite;
}

.task-card-badge.success {
    color: var(--green);
    background: rgba(0, 200, 83, 0.08);
    border-color: rgba(0, 200, 83, 0.2);
}

.task-card-badge.fail {
    color: #ef4444;
    background: rgba(220, 38, 38, 0.08);
    border-color: rgba(220, 38, 38, 0.2);
}

@keyframes badge-pulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.6;
    }
}

/* ── Progress bar ── */
.task-progress-bar {
    height: 2px;
    /* Thinner for sleeker look */
    background: var(--border);
    position: relative;
    overflow: hidden;
}

.task-progress-bar-fill {
    height: 100%;
    background: var(--accent);
    transition: width 0.5s ease;
}

.task-progress-bar.indeterminate .task-progress-bar-fill {
    width: 40% !important;
    background: linear-gradient(90deg, transparent, var(--yellow), transparent);
    animation: progress-slide 1.8s ease-in-out infinite;
}

@keyframes progress-slide {
    0% {
        transform: translateX(-100%);
    }

    100% {
        transform: translateX(350%);
    }
}

/* ── Error info inside card ── */
.task-error-info {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    padding: 10px 16px;
    background: rgba(220, 38, 38, 0.06);
    border-top: 1px solid rgba(220, 38, 38, 0.15);
    font-family: var(--mono);
    font-size: 11px;
    color: #ef4444;
    line-height: 1.5;
}

.task-error-info svg {
    flex-shrink: 0;
    margin-top: 1px;
}

/* ── Result area ── */
.task-result {
    padding: 0;
    display: flex;
    flex-direction: column;
}

.task-result:not(:empty) {
    border-top: 1px solid var(--border);
}

.task-result-media {
    overflow: hidden;
    background: #050505;
    /* completely dark for videos/images to span nicely */
    position: relative;
    width: 100%;
}

.task-result-media img,
.task-result-media video,
.task-result-media audio {
    width: 100%;
    display: block;
    max-height: 50vh;
    /* Scalable max height */
    object-fit: contain;
}

/* Multi-image grid (e.g. MJ 4 images) */
.task-result-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 2px;
}

.task-result-grid-img {
    width: 100%;
    height: auto;
    max-height: none !important;
    aspect-ratio: 1;
    object-fit: cover;
    cursor: pointer;
    transition: opacity 0.15s;
}

.task-result-grid-img:hover {
    opacity: 0.85;
}

/* Multi-audio tracks (e.g. Suno 2 tracks) */
.task-result-audio-track {
    padding: 10px 16px;
    border-bottom: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.task-result-audio-track:last-child {
    border-bottom: none;
}

.audio-track-label {
    font-family: var(--mono);
    font-size: 10px;
    font-weight: 700;
    color: var(--text-dim);
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

/* ── Suno Rich Track Cards (task card inline view) ── */
/* ── Suno Track Card ── */
.suno-track-card {
    border-bottom: 1px solid var(--border);
    overflow: hidden;
    background: var(--surface);
}

.suno-track-card:last-child {
    border-bottom: none;
}

/* ── Suno Lightbox Premium Design ── */
.suno-lightbox-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    width: 520px;
    max-width: 92vw;
    padding: 4px 0;
}

.suno-lb-card {
    background: #0d0d0d;
    border: 1px solid rgba(255, 255, 255, 0.07);
    border-radius: 12px;
    overflow: hidden;
    transition: border-color 0.2s;
}

.suno-lb-card:hover {
    border-color: rgba(220, 38, 38, 0.3);
}

/* Hero zone: cover art OR gradient background */
.suno-lb-hero {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 6;
    overflow: hidden;
    background: linear-gradient(135deg, #1a0505 0%, #2a0a0a 50%, #111 100%);
}

.suno-lb-cover {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center top;
    filter: brightness(0.6) saturate(1.1);
}

.suno-lb-hero-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(to right,
            rgba(0, 0, 0, 0.92) 0%,
            rgba(0, 0, 0, 0.5) 55%,
            rgba(0, 0, 0, 0.15) 100%);
    pointer-events: none;
}

.suno-lb-meta {
    position: absolute;
    inset: 0;
    z-index: 2;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 14px 18px;
    gap: 4px;
    min-width: 0;
}

.suno-lb-track-num {
    font-family: var(--mono);
    font-size: 9px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.15em;
    color: var(--accent);
    opacity: 0.9;
}

.suno-lb-title {
    font-family: var(--font);
    font-size: 17px;
    font-weight: 800;
    color: #fff;
    line-height: 1.2;
    letter-spacing: -0.02em;
    text-shadow: 0 2px 12px rgba(0, 0, 0, 0.8);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 70%;
}

.suno-lb-tags {
    font-family: var(--mono);
    font-size: 10px;
    color: rgba(255, 255, 255, 0.5);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 70%;
}

.suno-lb-dur {
    font-family: var(--mono);
    font-size: 10px;
    color: rgba(255, 255, 255, 0.6);
    background: rgba(0, 0, 0, 0.55);
    display: inline-block;
    width: fit-content;
    padding: 2px 7px;
    border-radius: 4px;
    margin-top: 2px;
    border: 1px solid rgba(255, 255, 255, 0.08);
}

/* Decorative waveform bars (no-cover state) */
.suno-lb-waveform {
    position: absolute;
    right: 16px;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    align-items: center;
    gap: 2px;
    height: 44px;
    opacity: 0.25;
    z-index: 1;
}

.suno-lb-waveform span {
    display: block;
    width: 3px;
    border-radius: 2px;
    background: var(--accent);
    min-height: 4px;
}

/* Audio player */
.suno-lb-player {
    padding: 10px 14px 6px;
    background: rgba(0, 0, 0, 0.35);
    border-top: 1px solid rgba(255, 255, 255, 0.04);
}

.suno-lb-player audio {
    width: 100%;
    height: 32px;
    border-radius: 6px;
    accent-color: var(--accent);
    background: transparent;
}

/* Action buttons row */
.suno-lb-actions {
    display: flex;
    gap: 3px;
    padding: 8px 10px;
    background: rgba(0, 0, 0, 0.2);
    border-top: 1px solid rgba(255, 255, 255, 0.04);
    flex-wrap: wrap;
}

.suno-lb-btn {
    flex: 1;
    min-width: 60px;
    padding: 5px 6px;
    font-family: var(--mono);
    font-size: 9px;
    font-weight: 700;
    letter-spacing: 0.02em;
    color: rgba(255, 255, 255, 0.45);
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.15s;
    text-align: center;
    white-space: nowrap;
}

.suno-lb-btn:hover {
    color: var(--accent);
    border-color: rgba(220, 38, 38, 0.4);
    background: rgba(220, 38, 38, 0.08);
}

.suno-lb-btn.loading {
    opacity: 0.4;
    pointer-events: none;
}


/* Full-width cover with overlay */
.suno-track-header {
    position: relative;
    width: 100%;
    aspect-ratio: 16/5;
    overflow: hidden;
    display: block;
}

.suno-track-cover {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    display: block;
    flex-shrink: unset;
    border-radius: 0;
    border: none;
    filter: brightness(0.75);
}

/* Overlay gradient for text readability */
.suno-track-header::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(to right, rgba(0, 0, 0, 0.85) 0%, rgba(0, 0, 0, 0.2) 100%);
    pointer-events: none;
}

.suno-track-info {
    position: absolute;
    inset: 0;
    z-index: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 12px 16px;
    gap: 4px;
    min-width: 0;
}

.suno-track-title {
    font-family: var(--font);
    font-size: 15px;
    font-weight: 800;
    color: #fff;
    line-height: 1.2;
    letter-spacing: -0.01em;
    text-shadow: 0 1px 8px rgba(0, 0, 0, 0.5);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.suno-track-duration {
    font-family: var(--mono);
    font-size: 9px;
    color: rgba(255, 255, 255, 0.7);
    background: rgba(0, 0, 0, 0.5);
    padding: 2px 6px;
    border-radius: 3px;
    display: inline-block;
    width: fit-content;
}

.suno-track-tags {
    font-size: 10px;
    color: rgba(255, 255, 255, 0.6);
    line-height: 1.4;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-family: var(--mono);
}

/* Audio player row */
.suno-track-card audio {
    width: 100%;
    display: block;
    height: 36px;
    background: transparent;
}

.suno-track-lyrics-wrap {
    margin: 0;
    border-top: 1px solid var(--border);
}

.suno-track-lyrics-wrap summary {
    font-family: var(--mono);
    font-size: 9px;
    font-weight: 700;
    color: var(--accent);
    cursor: pointer;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    padding: 8px 12px;
    list-style: none;
    display: flex;
    align-items: center;
    gap: 4px;
    user-select: none;
}

.suno-track-lyrics-wrap summary::before {
    content: '▶';
    font-size: 7px;
    transition: transform 0.15s;
}

.suno-track-lyrics-wrap[open] summary::before {
    transform: rotate(90deg);
}

.suno-track-lyrics-wrap summary:hover {
    background: var(--surface-2);
}

.suno-track-lyrics {
    font-family: var(--font);
    font-size: 12px;
    color: var(--text-dim);
    line-height: 1.7;
    white-space: pre-wrap;
    word-break: break-word;
    max-height: 220px;
    overflow-y: auto;
    padding: 12px 16px;
    margin: 0;
    background: rgba(0, 0, 0, 0.25);
    border-top: 1px solid var(--border);
}

/* ── Suno Action Buttons ── */
.suno-actions-row {
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
}

.suno-actions-row .suno-action {
    flex: 1;
    min-width: 0;
    justify-content: center;
    padding: 6px 6px;
    font-size: 10px;
    font-family: var(--mono);
    font-weight: 600;
    letter-spacing: 0.02em;
    color: var(--text-dim);
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    cursor: pointer;
    transition: all 0.15s;
    white-space: nowrap;
}

.suno-actions-row .suno-action:hover {
    color: var(--accent);
    border-color: var(--accent);
    background: rgba(220, 38, 38, 0.08);
}

.suno-actions-row .suno-action.loading {
    opacity: 0.5;
    pointer-events: none;
}

/* ── Suno Inline Edit Panel ── */
.suno-inline-panel {
    margin-top: 10px;
    padding: 12px 14px;
    background: rgba(0, 0, 0, 0.35);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    animation: fadeSlideIn 0.15s ease;
}

@keyframes fadeSlideIn {
    from {
        opacity: 0;
        transform: translateY(-6px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.suno-panel-fields {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 10px;
}

.suno-panel-field {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.suno-panel-label {
    font-family: var(--mono);
    font-size: 10px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.suno-panel-hint {
    opacity: 0.5;
    font-size: 9px;
    text-transform: none;
    letter-spacing: 0;
}

.suno-panel-input {
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 6px;
    padding: 6px 10px;
    color: var(--text);
    font-size: 12px;
    font-family: var(--mono);
    outline: none;
    transition: border-color 0.15s;
}

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

.suno-panel-radios {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.suno-panel-radio {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 12px;
    color: var(--text-muted);
    cursor: pointer;
}

.suno-panel-radio input {
    accent-color: var(--accent);
    cursor: pointer;
}

.suno-panel-actions {
    display: flex;
    gap: 8px;
}

.suno-panel-confirm {
    padding: 6px 14px;
    background: var(--accent);
    color: #fff;
    border: none;
    border-radius: 6px;
    font-size: 12px;
    cursor: pointer;
    transition: opacity 0.15s;
}

.suno-panel-confirm:hover {
    opacity: 0.85;
}

.suno-panel-confirm:disabled {
    opacity: 0.5;
    pointer-events: none;
}

.suno-panel-cancel {
    padding: 6px 12px;
    background: transparent;
    color: var(--text-muted);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 6px;
    font-size: 12px;
    cursor: pointer;
    transition: border-color 0.15s, color 0.15s;
}

.suno-panel-cancel:hover {
    border-color: rgba(255, 255, 255, 0.25);
    color: var(--text);
}

/* ── Lightbox Grid ── */
.lightbox-grid {
    max-width: 100%;
}

.lightbox-grid .task-result-grid-img {
    max-height: none;
    aspect-ratio: 1;
    object-fit: cover;
    cursor: default;
}

.task-result-actions {
    display: flex;
    gap: 8px;
    padding: 12px 16px;
    background: var(--surface);
    border-top: 1px solid var(--border);
    align-items: center;
    flex-wrap: wrap;
}

.btn-download {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--text);
    background: rgba(18, 18, 18, 0.5);
    border: 1px solid var(--border);
    border-radius: 10px;
    font-size: 11px;
    font-weight: 600;
    font-family: var(--mono);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    text-decoration: none;
    padding: 7px 14px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-download:hover {
    background: rgba(220, 38, 38, 0.1);
    border-color: var(--accent);
    color: var(--accent);
}

.btn-download svg {
    opacity: 0.8;
}

.task-result-json {
    font-family: var(--mono);
    font-size: 10px;
    color: var(--text-muted);
    white-space: pre-wrap;
    word-break: break-all;
    max-height: 200px;
    overflow-y: auto;
    padding: 12px;
    background: #050505;
    border-radius: 6px;
    border: 1px solid var(--border);
    margin: 8px 16px 12px 16px;
    /* Spaced neatly within bottom section */
}

/* ── Empty state ── */
.tasks-empty-hint {
    font-size: 10px !important;
    margin-top: -6px;
}

/* ── History ── */
.history-toolbar {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 14px;
}

.history-filter-select {
    flex: 1;
}

.history-gallery {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 6px;
}

.history-card {
    border: 1px solid rgba(220, 38, 38, 0.08);
    border-radius: 10px;
    background: rgba(18, 18, 18, 0.5);
    overflow: hidden;
    cursor: pointer;
    transition: all 0.25s ease;
    position: relative;
}

.history-card:hover {
    border-color: rgba(220, 38, 38, 0.3);
    background: rgba(24, 24, 24, 0.8);
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
}

.history-card-thumb {
    aspect-ratio: 1;
    background: var(--surface-2);
    overflow: hidden;
    position: relative;
}

.history-card-thumb img,
.history-card-thumb video {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Multi-image mini-grid in history thumbnail (MJ 4 images) */
.history-thumb-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1px;
    width: 100%;
    height: 100%;
}

.history-thumb-grid-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Audio badge overlay on Suno cover art */
.history-thumb-audio-badge {
    position: absolute;
    bottom: 4px;
    right: 4px;
    width: 22px;
    height: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    background: rgba(0, 0, 0, 0.8);
    border-radius: 4px;
    color: var(--accent);
}

/* Audio placeholder for Suno tracks without cover */
.history-thumb-audio {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, rgba(20, 20, 20, 1) 0%, rgba(40, 40, 40, 1) 100%);
    position: relative;
    overflow: hidden;
}

.history-thumb-audio::before {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at center, rgba(var(--accent-rgb), 0.15) 0%, transparent 60%);
}

.history-thumb-audio svg {
    opacity: 0.8;
    position: relative;
    z-index: 1;
    filter: drop-shadow(0 2px 8px rgba(0, 0, 0, 0.5));
}

.history-play-icon {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.3);
    opacity: 0;
    transition: opacity 0.2s ease;
    pointer-events: none;
}

.history-play-icon svg {
    filter: drop-shadow(0 4px 12px rgba(0, 0, 0, 0.5));
}

.history-card:hover .history-play-icon {
    opacity: 1;
}

.history-card-type {
    position: absolute;
    top: 4px;
    right: 4px;
    font-family: var(--mono);
    font-size: 7px;
    padding: 2px 5px;
    background: rgba(0, 0, 0, 0.8);
    color: var(--text-muted);
    border-radius: 2px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.history-card-footer {
    padding: 8px;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.history-card-model {
    font-family: var(--mono);
    font-size: 9px;
    font-weight: 700;
    color: var(--text-dim);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.history-card-time {
    font-family: var(--mono);
    font-size: 8px;
    color: var(--text-muted);
}

.history-card-dl {
    position: absolute;
    bottom: 36px;
    right: 4px;
    opacity: 0;
    transition: opacity 0.15s;
    background: rgba(0, 0, 0, 0.85);
    border: none;
    color: var(--text);
    width: 24px;
    height: 24px;
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.history-card:hover .history-card-dl {
    opacity: 1;
}

/* ============================================================
   TOAST
   ============================================================ */
.toast-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.toast {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-left: 3px solid var(--border);
    border-radius: var(--radius);
    font-family: var(--mono);
    font-size: 11px;
    color: var(--text);
    animation: slideUp 0.25s ease;
    max-width: 300px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
}

.toast.success {
    border-left-color: var(--green);
}

.toast.error {
    border-left-color: var(--accent);
}

.toast.info {
    border-left-color: var(--blue);
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(8px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ============================================================
   FORM RANGE
   ============================================================ */
.form-range {
    -webkit-appearance: none;
    appearance: none;
    height: 2px;
    background: var(--border);
    border-radius: 0;
    outline: none;
    cursor: pointer;
    flex: 1;
}

.form-range::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 10px;
    height: 10px;
    border-radius: 2px;
    background: var(--accent);
    cursor: pointer;
    border: none;
}

.range-value {
    font-family: var(--mono);
    font-size: 11px;
    color: var(--text-dim);
    min-width: 36px;
    text-align: right;
}

/* ============================================================
   CONFIG MODEL PARAMS
   ============================================================ */
.config-model-params {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* ============================================================
   SCROLLBARS
   ============================================================ */
::-webkit-scrollbar {
    width: 5px;
    height: 5px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 2px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--border-hover);
}

/* ============================================================
   UTILITIES
   ============================================================ */
.hidden {
    display: none !important;
}

/* ============================================================
   TRANSITIONS
   ============================================================ */
.lobby {
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.lobby.exit {
    opacity: 0;
    transform: scale(0.98);
    pointer-events: none;
}

#app-main {
    animation: fadeIn 0.4s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(8px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ============================================================
   HISTORY LIGHTBOX PLAYBACK
   ============================================================ */
.lightbox-overlay {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
    padding: 20px;
}

.lightbox-overlay.open {
    opacity: 1;
    pointer-events: auto;
}

.lightbox-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.92);
    backdrop-filter: blur(12px);
}

.lightbox-content {
    position: relative;
    z-index: 10000;
    display: flex;
    flex-direction: column;
    align-items: center;
    width: min(90vw, 960px);
    max-height: 92vh;
    animation: slideUp 0.3s ease;
}

.lightbox-header {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 0 10px;
}

.lightbox-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.lightbox-model {
    font-family: var(--mono);
    font-size: 13px;
    font-weight: 700;
    color: var(--text);
    letter-spacing: 0.01em;
}

.lightbox-date {
    font-family: var(--mono);
    font-size: 11px;
    color: var(--text-dim);
}

.lightbox-close {
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.2s;
    width: 30px;
    height: 30px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.lightbox-close:hover {
    color: #fff;
    background: rgba(220, 38, 38, 0.25);
    border-color: rgba(220, 38, 38, 0.4);
}

.lightbox-body {
    position: relative;
    border-radius: 10px;
    overflow: hidden;
    background: #050505;
    box-shadow: 0 24px 80px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.06);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 1;
    min-height: 0;
    width: 100%;
}

.lightbox-media {
    width: 100%;
    max-width: min(88vw, 960px);
    max-height: 75vh;
    height: auto;
    display: block;
    object-fit: contain;
}

.lightbox-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 42px;
    height: 42px;
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, 0.22);
    background: rgba(0, 0, 0, 0.45);
    color: #fff;
    font-size: 30px;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 3;
    transition: all 0.18s ease;
}

.lightbox-nav:hover {
    background: rgba(220, 38, 38, 0.35);
    border-color: rgba(220, 38, 38, 0.7);
}

.lightbox-nav-prev {
    left: 12px;
}

.lightbox-nav-next {
    right: 12px;
}

@media (max-width: 768px) {
    .lightbox-nav {
        width: 36px;
        height: 36px;
        font-size: 26px;
    }

    .lightbox-nav-prev {
        left: 8px;
    }

    .lightbox-nav-next {
        right: 8px;
    }
}

.lightbox-prompt {
    font-family: var(--sans);
    font-size: 12px;
    color: var(--text-dim);
    margin-top: 12px;
    text-align: center;
    max-width: min(88vw, 800px);
    line-height: 1.5;
    opacity: 0.7;
}

.lightbox-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 14px;
    flex-wrap: wrap;
    justify-content: center;
}

.lightbox-actions .btn-download,
.lightbox-actions [class*="btn"] {
    font-size: 12px;
    padding: 7px 16px;
    border-radius: 7px;
}

.lightbox-cost {
    font-family: var(--mono);
    font-size: 11px;
    color: var(--accent);
    background: rgba(220, 38, 38, 0.1);
    padding: 3px 8px;
    border-radius: 4px;
    border: 1px solid rgba(220, 38, 38, 0.2);
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 1100px) {
    #app-main {
        grid-template-columns: 300px 1fr 280px;
    }
}

@media (max-width: 900px) {
    .lobby-grid {
        grid-template-columns: 1fr 1fr;
    }

    .lobby-card-wide {
        grid-column: span 2;
    }

    #app-main {
        grid-template-columns: 1fr;
        height: auto;
        overflow: auto;
    }

    #panel-prompt {
        border-right: none;
        border-bottom: 1px solid var(--border);
    }

    #panel-params {
        border-left: none;
        border-top: 1px solid var(--border);
    }

    body {
        overflow: auto;
    }

    /* ── Header mobile ── */
    .header-left {
        padding: 0 12px;
        gap: 0;
    }

    .header-right {
        padding: 0 12px;
        gap: 8px;
    }

    .credits-label {
        display: none;
    }

    .header-center {
        display: none;
    }

    .version-tag {
        display: none;
    }

    /* ── Model Picker Modal — tablet ── */
    .mpm-panel {
        width: calc(100vw - 24px);
        max-height: calc(100vh - 40px);
        border-radius: 8px;
    }

    .mpm-grid {
        grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
        gap: 8px;
        padding: 16px;
    }

    .mpm-header {
        padding: 16px;
    }

    .mpm-card {
        padding: 14px;
        gap: 10px;
    }

    /* V1 .mpm-card-name, .mpm-card-desc responsive rules removed */
}

@media (max-width: 600px) {
    .lobby-grid {
        grid-template-columns: 1fr;
    }

    .lobby-card-wide {
        grid-column: span 1;
    }

    .lobby-slim-card {
        flex-direction: column;
        height: auto;
        padding: 24px;
        gap: 16px;
    }

    .lsc-left {
        width: 100%;
        justify-content: center;
        padding-bottom: 8px;
        border-bottom: 1px solid var(--border);
    }

    .lsc-center {
        flex-wrap: wrap;
        width: 100%;
        justify-content: center;
    }

    .lsc-right {
        width: 100%;
        justify-content: center;
        padding-top: 8px;
    }

    /* ── Header — compact mobile ── */
    :root {
        --header-h: 48px;
    }

    #app-header {
        height: 48px;
    }

    .header-left {
        padding: 0 10px;
    }

    .logo-text {
        font-size: 11px;
    }

    .logo-sub {
        font-size: 8px;
    }

    .header-divider {
        margin: 0 6px;
    }

    .header-right {
        padding: 0 10px;
        gap: 6px;
    }

    .credits-badge {
        padding: 4px 8px;
        gap: 5px;
    }

    .credits-value {
        font-size: 10px;
    }

    /* ── Model Picker Modal — full-screen bottom sheet on phone ── */
    .model-picker-modal {
        align-items: flex-end;
    }

    .mpm-panel {
        width: 100vw;
        max-height: 92vh;
        border-radius: 16px 16px 0 0;
        border: none;
        border-top: 1px solid var(--border);
    }

    .mpm-header {
        padding: 14px 16px;
    }

    .mpm-title {
        font-size: 14px;
    }

    .mpm-subtitle {
        font-size: 9px;
    }

    .mpm-close {
        width: 32px;
        height: 32px;
    }

    .mpm-grid {
        grid-template-columns: 1fr 1fr;
        gap: 8px;
        padding: 12px;
    }

    .mpm-card {
        padding: 12px;
        padding-top: 14px;
        gap: 8px;
    }

    /* V1 card responsive styles removed (.mpm-card-icon, -name, -provider, -desc, -cost, -footer, -tag, -glow) */

    /* ── Lobby ── */
    .lobby {
        padding: 24px 16px;
    }

    .lobby-hero-badge {
        font-size: 9px;
    }

    .lobby-title {
        font-size: 28px;
    }

    .lobby-subtitle {
        font-size: 13px;
    }

    .lobby-card {
        padding: 18px 16px;
        gap: 10px;
    }

    /* ── Workspace panels ── */
    .panel-topbar {
        padding: 10px 14px;
    }

    .panel-scroll {
        padding: 12px;
    }

    .model-picker-trigger-wrap {
        padding: 8px 12px;
    }

    .model-picker-trigger {
        padding: 8px 12px;
    }

    .submit-dock {
        padding: 10px 12px;
    }

    /* ── Results panel tabs ── */
    .panel-tab {
        font-size: 10px;
        padding: 10px 12px;
    }
}

/* ── Extra-small phones (≤ 380px) ── */
@media (max-width: 380px) {
    .mpm-grid {
        grid-template-columns: 1fr;
        gap: 6px;
        padding: 10px;
    }

    .mpm-card {
        padding: 10px;
        gap: 8px;
    }

    /* V1 .mpm-card-desc responsive rule removed */

    .lobby-title {
        font-size: 24px;
    }
}

/* ============================================================
   MODEL ACTIVE STRIP  — persistent "you are working with X" bar
   ============================================================ */
.model-active-strip {
    flex-shrink: 0;
    padding: 10px 16px;
    background: var(--surface-2);
    border-bottom: 1px solid var(--border);
    min-height: 46px;
    display: flex;
    align-items: center;
}

.mas-empty {
    display: flex;
    align-items: center;
    gap: 7px;
    font-family: var(--mono);
    font-size: 10px;
    color: var(--text-muted);
    letter-spacing: 0.04em;
    opacity: 0.5;
}

.mas-empty svg {
    flex-shrink: 0;
    color: var(--text-muted);
}

.mas-model {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
}

.mas-icon {
    width: 28px;
    height: 28px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--mono);
    font-size: 10px;
    font-weight: 700;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    letter-spacing: 0;
}

.mas-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.mas-name {
    font-family: var(--sans);
    font-size: 12px;
    font-weight: 700;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    letter-spacing: -0.01em;
}

.mas-provider {
    font-family: var(--mono);
    font-size: 9px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.mas-cost {
    font-family: var(--mono);
    font-size: 9px;
    padding: 2px 7px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text-muted);
    white-space: nowrap;
    flex-shrink: 0;
}

/* ============================================================
   SUBMIT DOCK  — always-visible submit footer in left panel
   ============================================================ */
.submit-dock {
    flex-shrink: 0;
    padding: 12px 16px;
    border-top: 1px solid var(--border);
    background: var(--surface);
}

/* ============================================================
   MODEL CHIP — enhanced active state + readability
   ============================================================ */

/* Slightly larger chip text */
.model-chip-name {
    font-size: 11px;
}

/* Stronger active state: left accent bar + bolder background */
.model-chip.active {
    border-color: var(--accent);
    background: var(--accent-dim);
    box-shadow: inset 2px 0 0 var(--accent);
}

.model-chip.active .model-chip-name {
    color: var(--text);
    font-weight: 700;
}

/* ============================================================
   CONFIG HEADER — more prominence when model selected
   ============================================================ */
.config-header {
    border: 1px solid var(--border-hover);
}

/* Right panel uses same topbar style as left panel */
#panel-params .panel-topbar {
    background: var(--surface);
}

/* ── V2 Cards — Mobile responsive ── */
@media (max-width: 600px) {
    .mpm-v2-inner {
        padding: 14px;
        gap: 10px;
    }

    .mpm-v2-name {
        font-size: 14px;
    }

    .mpm-v2-features {
        gap: 8px;
    }

    .mpm-v2-feature {
        font-size: 9px;
    }
}

/* ── Video Duration buttons (3-col grid, same pattern as resolution) ── */
.v2-duration-btns {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
}

/* ── Video Aspect Ratio buttons (3-col grid) ── */
.v2-video-ar-btns {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
}



/* ── Video gallery items ── */
.v2-gallery-item.video-item {
    aspect-ratio: 16 / 9;
}

.v2-gallery-item video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* ============================================================
   IMAGE V2 — FULL WORKSPACE OVERLAY
   3-column layout inspired by modern AI studio UIs
   ============================================================ */

.v2-ws {
    position: fixed;
    inset: 0;
    top: var(--header-h);
    z-index: 90;
    display: grid;
    grid-template-columns: 340px 1fr;
    overflow: hidden;
}

.v2-ws.hidden {
    display: none;
}

/* ── Animated background ── */
.v2-ws-bg {
    position: absolute;
    inset: 0;
    background: linear-gradient(145deg, #050505 0%, #0a0a0a 40%, #080808 70%, #050505 100%);
    z-index: 0;
}

.v2-ws-bg::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background:
        radial-gradient(ellipse at 20% 50%, rgba(220, 38, 38, 0.06) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 20%, rgba(220, 38, 38, 0.05) 0%, transparent 50%),
        radial-gradient(ellipse at 50% 80%, rgba(220, 38, 38, 0.04) 0%, transparent 50%);
}

/* ── Left Column ── */
.v2-ws-left {
    position: relative;
    z-index: 2;
    overflow-y: auto;
    padding: 20px;
    border-right: 1px solid rgba(220, 38, 38, 0.08);
}

.v2-ws-panel {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

/* ── Back button ── */
.v2-back-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    font-family: var(--mono);
    font-size: 11px;
    color: rgba(148, 163, 184, 0.7);
    background: none;
    border: none;
    cursor: pointer;
    padding: 6px 0;
    transition: color 0.2s;
    align-self: flex-start;
}

.v2-back-btn:hover {
    color: #DC2626;
}

/* ── Model badge ── */
.v2-model-badge {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 14px;
    background: rgba(220, 38, 38, 0.06);
    border: 1px solid rgba(220, 38, 38, 0.12);
    border-radius: 12px;
}

.v2-model-badge-icon {
    width: 32px;
    height: 32px;
    flex-shrink: 0;
}

.v2-model-badge-icon svg {
    width: 100%;
    height: 100%;
}

.v2-model-badge-info {
    display: flex;
    flex-direction: column;
    flex: 1;
}

.v2-model-badge-name {
    font-family: var(--sans);
    font-size: 13px;
    font-weight: 700;
    color: #ffffff;
}

.v2-model-badge-provider {
    font-family: var(--mono);
    font-size: 10px;
    color: rgba(148, 163, 184, 0.6);
}

.v2-model-badge-tag {
    font-family: var(--mono);
    font-size: 8px;
    font-weight: 700;
    letter-spacing: 0.12em;
    padding: 3px 8px;
    border-radius: 12px;
    background: linear-gradient(135deg, rgba(220, 38, 38, 0.15), rgba(220, 38, 38, 0.15));
    border: 1px solid rgba(220, 38, 38, 0.2);
    color: #DC2626;
}

/* ── Form elements ── */
.v2-form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.v2-label {
    font-family: var(--sans);
    font-size: 12px;
    font-weight: 600;
    color: rgba(226, 232, 240, 0.9);
}

.v2-label-hint {
    font-weight: 400;
    color: rgba(148, 163, 184, 0.4);
}

.v2-textarea {
    font-family: var(--sans);
    font-size: 13px;
    color: #e2e8f0;
    background: rgba(15, 15, 15, 0.6);
    border: 1px solid rgba(220, 38, 38, 0.12);
    border-radius: 10px;
    padding: 12px 14px;
    resize: vertical;
    min-height: 120px;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
    line-height: 1.6;
}

.v2-textarea::placeholder {
    color: rgba(148, 163, 184, 0.35);
}

.v2-textarea:focus {
    border-color: rgba(220, 38, 38, 0.4);
    box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.08);
}

.v2-prompt-meta {
    display: flex;
    justify-content: flex-end;
}

.v2-char-counter {
    font-family: var(--mono);
    font-size: 10px;
    color: rgba(148, 163, 184, 0.4);
}

/* ── Upload zone ── */
.v2-upload-zone {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 20px;
    border: 1px dashed rgba(220, 38, 38, 0.2);
    border-radius: 10px;
    background: rgba(15, 15, 15, 0.3);
    cursor: pointer;
    transition: all 0.2s;
    color: rgba(148, 163, 184, 0.5);
    font-family: var(--sans);
    font-size: 12px;
}

.v2-upload-zone:hover {
    border-color: rgba(220, 38, 38, 0.4);
    background: rgba(220, 38, 38, 0.04);
    color: rgba(148, 163, 184, 0.8);
}

.v2-upload-zone.dragover {
    border-color: rgba(220, 38, 38, 0.6);
    background: rgba(220, 38, 38, 0.08);
}

/* ── Label row (label + counter side by side) ── */
.v2-label-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.v2-file-counter {
    font-family: var(--mono);
    font-size: 10px;
    color: rgba(148, 163, 184, 0.4);
    transition: color 0.2s;
}

.v2-file-counter.has-files {
    color: #DC2626;
}

.v2-file-counter.full {
    color: #f59e0b;
}

.v2-upload-hint {
    font-size: 10px;
    color: rgba(148, 163, 184, 0.3);
}

/* ── Multi-file preview grid ── */
.v2-files-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 6px;
}

.v2-files-grid:empty {
    display: none;
}

.v2-file-card {
    position: relative;
    aspect-ratio: 1;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid rgba(220, 38, 38, 0.12);
    background: rgba(15, 15, 15, 0.5);
    transition: all 0.2s;
}

.v2-file-card:hover {
    border-color: rgba(220, 38, 38, 0.3);
}

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

.v2-file-card-remove {
    position: absolute;
    top: 3px;
    right: 3px;
    width: 18px;
    height: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.7);
    border: 1px solid rgba(239, 68, 68, 0.4);
    border-radius: 50%;
    color: #ef4444;
    cursor: pointer;
    transition: all 0.2s;
    opacity: 0;
    padding: 0;
}

.v2-file-card:hover .v2-file-card-remove {
    opacity: 1;
}

.v2-file-card-remove:hover {
    background: rgba(239, 68, 68, 0.3);
    transform: scale(1.1);
}

.v2-file-card-index {
    position: absolute;
    bottom: 3px;
    left: 3px;
    font-family: var(--mono);
    font-size: 8px;
    font-weight: 700;
    color: rgba(255, 255, 255, 0.8);
    background: rgba(0, 0, 0, 0.6);
    padding: 1px 5px;
    border-radius: 4px;
}

/* ── Upload zone: full state ── */
.v2-upload-zone.v2-upload-full {
    padding: 10px;
    border-style: solid;
    border-color: rgba(245, 158, 11, 0.3);
    background: rgba(245, 158, 11, 0.04);
    opacity: 0.6;
    pointer-events: none;
}

/* ── Frame dropzone: hide upload area when a file is set ── */
.v2-frame-dropzone .v2-upload-zone.v2-frame-has-file {
    display: none;
}

/* ── Frame dropzone: thumbnail grid replaces zone ── */
.v2-frame-dropzone .v2-files-grid:not(:empty) {
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.15);
    grid-template-columns: 1fr;
}

.v2-frame-dropzone .v2-files-grid .v2-file-card {
    height: auto;
    aspect-ratio: 16 / 9;
    border-radius: 8px;
}

.v2-frame-dropzone .v2-files-grid .v2-file-card img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 8px;
    display: block;
    background: rgba(0, 0, 0, 0.3);
}

/* ── Upload zone: uploading state ── */
.v2-upload-zone.uploading {
    pointer-events: none;
    opacity: 0.5;
}

/* ── Select ── */
.v2-select {
    font-family: var(--sans);
    font-size: 13px;
    color: #e2e8f0;
    background: rgba(15, 15, 15, 0.6);
    border: 1px solid rgba(220, 38, 38, 0.12);
    border-radius: 10px;
    padding: 10px 14px;
    outline: none;
    cursor: pointer;
    transition: border-color 0.2s;
    -webkit-appearance: none;
    appearance: none;
    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='%2394a3b8' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
}

.v2-select:focus {
    border-color: rgba(220, 38, 38, 0.4);
}

.v2-select option {
    background: #0f172a;
    color: #e2e8f0;
}

/* ── Generate button ── */
.v2-generate-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 14px 24px;
    background: linear-gradient(135deg, #DC2626, #b91c1c);
    border: none;
    border-radius: 12px;
    color: #ffffff;
    font-family: var(--sans);
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.25s;
    margin-top: 8px;
    position: relative;
    overflow: hidden;
}

.v2-generate-btn::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.1), transparent);
    opacity: 0;
    transition: opacity 0.2s;
}

.v2-generate-btn:hover:not(:disabled)::before {
    opacity: 1;
}

.v2-generate-btn:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 8px 24px rgba(220, 38, 38, 0.3);
}

.v2-generate-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.v2-generate-btn.loading {
    pointer-events: none;
}

.v2-generate-btn.loading span {
    opacity: 0.7;
}

/* ── Center Column: Gallery ── */
.v2-ws-center {
    position: relative;
    z-index: 2;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.v2-gallery-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 24px;
    border-bottom: 1px solid rgba(220, 38, 38, 0.08);
    flex-shrink: 0;
}

.v2-gallery-title {
    font-family: var(--sans);
    font-size: 13px;
    font-weight: 700;
    color: rgba(226, 232, 240, 0.9);
}

.v2-gallery-count {
    font-family: var(--mono);
    font-size: 10px;
    color: rgba(148, 163, 184, 0.5);
}

.v2-gallery {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 12px;
    align-content: start;
}

.v2-gallery-empty {
    grid-column: 1 / -1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 60px 20px;
    color: rgba(148, 163, 184, 0.3);
    text-align: center;
}

.v2-gallery-empty p {
    font-family: var(--sans);
    font-size: 14px;
    color: rgba(148, 163, 184, 0.4);
}

.v2-gallery-empty-hint {
    font-size: 12px !important;
    color: rgba(148, 163, 184, 0.25) !important;
}

/* ── Gallery items ── */
.v2-gallery-item {
    position: relative;
    border-radius: 10px;
    overflow: hidden;
    background: rgba(15, 15, 15, 0.5);
    border: 1px solid rgba(220, 38, 38, 0.08);
    transition: all 0.25s;
    cursor: pointer;
    aspect-ratio: 1;
}

.v2-gallery-item:hover {
    border-color: rgba(220, 38, 38, 0.3);
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
}

.v2-gallery-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.v2-gallery-item-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 8px 10px;
    background: linear-gradient(transparent, rgba(0, 0, 0, 0.7));
    opacity: 0;
    transition: opacity 0.2s;
}

.v2-gallery-item:hover .v2-gallery-item-overlay {
    opacity: 1;
}

.v2-gallery-item-status {
    font-family: var(--mono);
    font-size: 9px;
    color: rgba(255, 255, 255, 0.8);
}

/* ── Per-item hover action bar ── */
.v2-item-actions {
    position: absolute;
    top: 6px;
    right: 6px;
    display: flex;
    gap: 4px;
    opacity: 0;
    transition: opacity 0.15s;
    z-index: 10;
}

.v2-gallery-item:hover .v2-item-actions {
    opacity: 1;
}

.v2-item-btn {
    width: 26px;
    height: 26px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    border: 1px solid rgba(255, 255, 255, 0.15);
    background: rgba(0, 0, 0, 0.55);
    color: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(4px);
    transition: background 0.15s, border-color 0.15s, color 0.15s;
    text-decoration: none;
}

.v2-item-dl:hover {
    background: rgba(220, 38, 38, 0.6);
    border-color: rgba(220, 38, 38, 0.8);
    color: #fff;
}

.v2-item-del:hover {
    background: rgba(239, 68, 68, 0.6);
    border-color: rgba(239, 68, 68, 0.8);
    color: #fff;
}

/* Processing state */
.v2-gallery-item.processing {
    display: flex;
    align-items: center;
    justify-content: center;
}

.v2-gallery-item.processing::after {
    content: '';
    width: 28px;
    height: 28px;
    border: 2px solid rgba(220, 38, 38, 0.2);
    border-top-color: #DC2626;
    border-radius: 50%;
    animation: v2-spin 0.8s linear infinite;
}

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

.v2-gallery-item.failed {
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(239, 68, 68, 0.06);
    border: 1px solid rgba(239, 68, 68, 0.25);
    padding: 12px;
    position: relative;
}

.v2-fail-body {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    text-align: center;
}

.v2-fail-title {
    color: #ef4444;
    font-family: var(--mono);
    font-size: 11px;
    font-weight: 600;
}

.v2-fail-detail {
    color: rgba(239, 68, 68, 0.75);
    font-size: 10px;
    font-family: var(--mono);
    line-height: 1.4;
    word-break: break-word;
    max-width: 100%;
}

.v2-fail-dismiss {
    position: absolute;
    top: 6px;
    right: 6px;
    opacity: 0;
    transition: opacity 0.15s;
}

.v2-gallery-item.failed:hover .v2-fail-dismiss {
    opacity: 1;
}

/* ── Right Column: Settings ── */
.v2-ws-right {
    position: relative;
    z-index: 2;
    overflow-y: auto;
    padding: 20px;
    border-left: 1px solid rgba(220, 38, 38, 0.08);
}

.v2-ws-panel-right {
    gap: 20px;
}

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

.v2-settings-title {
    font-family: var(--sans);
    font-size: 14px;
    font-weight: 700;
    color: #ffffff;
}

.v2-settings-reset {
    font-family: var(--mono);
    font-size: 10px;
    color: rgba(148, 163, 184, 0.5);
    background: none;
    border: 1px solid rgba(148, 163, 184, 0.15);
    border-radius: 6px;
    padding: 4px 10px;
    cursor: pointer;
    transition: all 0.2s;
}

.v2-settings-reset:hover {
    color: #DC2626;
    border-color: rgba(220, 38, 38, 0.3);
}

/* ── Setting groups ── */
.v2-setting-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

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

.v2-setting-value {
    font-family: var(--mono);
    font-size: 10px;
    color: #DC2626;
}

/* ── Dimension buttons (aspect ratio grid) ── */
.v2-dimensions-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 6px;
}

.v2-dim-btn,
.v2-res-btn,
.v2-fmt-btn,
.v2-dur-btn,
.v2-var-btn {
    padding: 8px 4px;
    font-family: var(--mono);
    font-size: 11px;
    font-weight: 600;
    color: rgba(148, 163, 184, 0.7);
    background: rgba(15, 15, 15, 0.5);
    border: 1px solid rgba(220, 38, 38, 0.1);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    text-align: center;
}

.v2-dim-btn:hover,
.v2-res-btn:hover,
.v2-fmt-btn:hover,
.v2-dur-btn:hover,
.v2-var-btn:hover {
    border-color: rgba(220, 38, 38, 0.3);
    color: #e2e8f0;
}

.v2-dim-btn.active,
.v2-res-btn.active,
.v2-fmt-btn.active,
.v2-dur-btn.active,
.v2-var-btn.active {
    background: linear-gradient(135deg, rgba(220, 38, 38, 0.2), rgba(220, 38, 38, 0.2));
    border-color: rgba(220, 38, 38, 0.5);
    color: #DC2626;
    box-shadow: 0 0 12px rgba(220, 38, 38, 0.1);
}

/* ── Resolution & Format buttons ── */
.v2-resolution-btns,
.v2-format-btns {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
}

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

/* ── Seed input ── */
.v2-input-number {
    font-family: var(--mono);
    font-size: 12px;
    color: #e2e8f0;
    background: rgba(15, 15, 15, 0.5);
    border: 1px solid rgba(220, 38, 38, 0.1);
    border-radius: 8px;
    padding: 8px 12px;
    outline: none;
    width: 100%;
    transition: border-color 0.2s;
}

.v2-input-number::placeholder {
    color: rgba(148, 163, 184, 0.3);
}

.v2-input-number:focus {
    border-color: rgba(220, 38, 38, 0.4);
}

/* ── Dynamic V2 Params ── */
#v2-dynamic-params {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.v2-param-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

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

.v2-param-value {
    font-family: var(--mono);
    font-size: 10px;
    color: #DC2626;
}

/* Radio pill grid */
.v2-param-pills {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(60px, 1fr));
    gap: 6px;
}

.v2-param-pill {
    padding: 8px 4px;
    font-family: var(--mono);
    font-size: 11px;
    font-weight: 600;
    color: rgba(148, 163, 184, 0.7);
    background: rgba(15, 15, 15, 0.5);
    border: 1px solid rgba(220, 38, 38, 0.1);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    text-align: center;
}

.v2-param-pill:hover {
    border-color: rgba(220, 38, 38, 0.3);
    color: #e2e8f0;
}

.v2-param-pill.active {
    background: linear-gradient(135deg, rgba(220, 38, 38, 0.2), rgba(220, 38, 38, 0.2));
    border-color: rgba(220, 38, 38, 0.5);
    color: #DC2626;
    box-shadow: 0 0 12px rgba(220, 38, 38, 0.1);
}

/* Select dropdown */
.v2-param-select {
    font-family: var(--mono);
    font-size: 12px;
    color: #e2e8f0;
    background: rgba(15, 15, 15, 0.5);
    border: 1px solid rgba(220, 38, 38, 0.1);
    border-radius: 8px;
    padding: 8px 12px;
    outline: none;
    width: 100%;
    cursor: pointer;
    transition: border-color 0.2s;
    appearance: none;
    -webkit-appearance: none;
    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='%2394a3b8' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    padding-right: 30px;
}

.v2-param-select:focus {
    border-color: rgba(220, 38, 38, 0.4);
}

.v2-param-select option {
    background: #0f172a;
    color: #e2e8f0;
}

/* Range slider */
.v2-param-range-wrap {
    display: flex;
    align-items: center;
    gap: 12px;
}

.v2-param-range {
    flex: 1;
    -webkit-appearance: none;
    appearance: none;
    height: 4px;
    background: rgba(220, 38, 38, 0.15);
    border-radius: 2px;
    outline: none;
}

.v2-param-range::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: #DC2626;
    border: 2px solid rgba(15, 15, 15, 0.8);
    cursor: pointer;
    box-shadow: 0 0 8px rgba(220, 38, 38, 0.3);
}

.v2-param-range::-moz-range-thumb {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: #DC2626;
    border: 2px solid rgba(15, 15, 15, 0.8);
    cursor: pointer;
    box-shadow: 0 0 8px rgba(220, 38, 38, 0.3);
}

.v2-param-range-val {
    font-family: var(--mono);
    font-size: 12px;
    color: rgba(148, 163, 184, 0.7);
    min-width: 40px;
    text-align: right;
}

/* Toggle switch */
.v2-param-toggle {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
}

.v2-param-toggle-track {
    position: relative;
    width: 36px;
    height: 20px;
    background: rgba(15, 15, 15, 0.6);
    border: 1px solid rgba(220, 38, 38, 0.15);
    border-radius: 10px;
    transition: all 0.2s;
    flex-shrink: 0;
}

.v2-param-toggle-track::after {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: rgba(148, 163, 184, 0.5);
    transition: all 0.2s;
}

.v2-param-toggle.active .v2-param-toggle-track {
    background: rgba(220, 38, 38, 0.2);
    border-color: rgba(220, 38, 38, 0.5);
}

.v2-param-toggle.active .v2-param-toggle-track::after {
    left: 18px;
    background: #DC2626;
    box-shadow: 0 0 6px rgba(220, 38, 38, 0.4);
}

.v2-param-toggle-label {
    font-family: var(--mono);
    font-size: 11px;
    color: rgba(148, 163, 184, 0.6);
}

.v2-param-toggle.active .v2-param-toggle-label {
    color: #DC2626;
}

/* Text input */
.v2-param-text {
    font-family: var(--mono);
    font-size: 12px;
    color: #e2e8f0;
    background: rgba(15, 15, 15, 0.5);
    border: 1px solid rgba(220, 38, 38, 0.1);
    border-radius: 8px;
    padding: 8px 12px;
    outline: none;
    width: 100%;
    transition: border-color 0.2s;
}

.v2-param-text::placeholder {
    color: rgba(148, 163, 184, 0.3);
}

.v2-param-text:focus {
    border-color: rgba(220, 38, 38, 0.4);
}

/* No params message */
.v2-no-params {
    font-family: var(--mono);
    font-size: 11px;
    color: rgba(148, 163, 184, 0.4);
    text-align: center;
    padding: 16px 0;
}

/* ── Credits box ── */
.v2-credits-box {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 14px;
    background: rgba(34, 197, 94, 0.06);
    border: 1px solid rgba(34, 197, 94, 0.12);
    border-radius: 10px;
    margin-top: 4px;
}

.v2-credits-label {
    font-family: var(--sans);
    font-size: 12px;
    color: rgba(148, 163, 184, 0.6);
}

.v2-credits-amount {
    font-family: var(--mono);
    font-size: 13px;
    font-weight: 700;
    color: #4ade80;
}

/* ── Model info ── */
.v2-model-info {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    background: rgba(15, 15, 15, 0.4);
    border: 1px solid rgba(220, 38, 38, 0.06);
    border-radius: 8px;
}

.v2-model-info-label {
    font-family: var(--sans);
    font-size: 11px;
    color: rgba(148, 163, 184, 0.4);
}

.v2-model-info-value {
    font-family: var(--mono);
    font-size: 11px;
    color: rgba(148, 163, 184, 0.6);
}

/* ── V2 Workspace scrollbar ── */
.v2-ws-left::-webkit-scrollbar,
.v2-ws-right::-webkit-scrollbar,
.v2-gallery::-webkit-scrollbar {
    width: 4px;
}

.v2-ws-left::-webkit-scrollbar-track,
.v2-ws-right::-webkit-scrollbar-track,
.v2-gallery::-webkit-scrollbar-track {
    background: transparent;
}

.v2-ws-left::-webkit-scrollbar-thumb,
.v2-ws-right::-webkit-scrollbar-thumb,
.v2-gallery::-webkit-scrollbar-thumb {
    background: rgba(220, 38, 38, 0.15);
    border-radius: 4px;
}

/* ── V2 Workspace — Responsive ── */
@media (max-width: 1100px) {
    .v2-ws {
        grid-template-columns: 280px 1fr 260px;
    }
}

@media (max-width: 900px) {
    .v2-ws {
        grid-template-columns: 1fr;
        grid-template-rows: auto 1fr auto;
        overflow-y: auto;
    }

    .v2-ws-left {
        border-right: none;
        border-bottom: 1px solid rgba(220, 38, 38, 0.08);
    }

    .v2-ws-right {
        border-left: none;
        border-top: 1px solid rgba(220, 38, 38, 0.08);
    }

    .v2-gallery {
        min-height: 300px;
    }
}

@media (max-width: 600px) {

    .v2-ws-left,
    .v2-ws-right {
        padding: 14px;
    }

    .v2-dimensions-grid {
        grid-template-columns: repeat(3, 1fr);
    }

    .v2-gallery {
        grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
        padding: 14px;
    }
}

/* ============================================================
   VIDEO LIGHTBOX — CINEMA MODE
   ============================================================ */

/* Wider, immersive layout when showing a video */
.lightbox-overlay.video-mode .lightbox-content {
    max-width: 96vw;
    width: 96vw;
    background: var(--surface);
    border-radius: 10px;
    overflow: hidden;
    border: 1px solid var(--border);
    box-shadow: 0 24px 80px rgba(0, 0, 0, 0.8);
}

/* Header bar with surface background */
.lightbox-overlay.video-mode .lightbox-header {
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    padding: 14px 20px;
}

/* Larger, clearly readable model badge */
.lightbox-overlay.video-mode .lightbox-model {
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0.02em;
    color: var(--text);
}

.lightbox-overlay.video-mode .lightbox-date {
    font-size: 11px;
    color: var(--text-dim);
}

/* Prominent close button */
.lightbox-overlay.video-mode .lightbox-close {
    width: 34px;
    height: 34px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    background: var(--surface-3);
    border: 1px solid var(--border);
    color: var(--text-muted);
    transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.lightbox-overlay.video-mode .lightbox-close:hover {
    background: var(--accent-dim);
    border-color: var(--accent);
    color: var(--accent);
}

/* Video body — pure black cinema background */
.lightbox-overlay.video-mode .lightbox-body {
    border-radius: 0;
    background: #000;
    width: 100%;
    max-height: 74vh;
}

/* Video element — full width, tall */
.lightbox-overlay.video-mode .lightbox-media {
    max-width: 100%;
    max-height: 74vh;
    width: 100%;
    height: auto;
}

/* Prompt — single line below video */
.lightbox-overlay.video-mode .lightbox-prompt {
    width: 100%;
    max-width: 100%;
    text-align: left;
    padding: 11px 20px;
    margin-top: 0;
    background: var(--surface-2);
    border-top: 1px solid var(--border);
    font-size: 11px;
    color: var(--text-dim);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-family: var(--mono);
}

/* Actions bar — full width toolbar */
.lightbox-overlay.video-mode .lightbox-actions {
    width: 100%;
    margin-top: 0;
    padding: 12px 20px;
    background: var(--surface);
    border-top: 1px solid var(--border);
    gap: 8px;
    flex-wrap: wrap;
    align-items: center;
}

/* Download — primary red accent button */
.lightbox-overlay.video-mode .btn-download {
    padding: 9px 20px;
    background: var(--accent);
    border-color: var(--accent);
    color: #fff;
    border-radius: 6px;
    font-size: 12px;
    font-family: var(--mono);
    font-weight: 700;
    letter-spacing: 0.04em;
}

.lightbox-overlay.video-mode .btn-download:hover {
    background: var(--accent-dark, #b91c1c);
    border-color: var(--accent-dark, #b91c1c);
    color: #fff;
}

/* Ghost action buttons (HD, 4K, Extend, Reutilizar, etc.) */
.lightbox-overlay.video-mode .btn-ghost.btn-sm {
    padding: 7px 14px;
    font-size: 10px;
    border-radius: 6px;
    color: var(--text-dim);
    border-color: var(--border-hover);
    background: var(--surface-3);
}

.lightbox-overlay.video-mode .btn-ghost.btn-sm:hover {
    color: var(--accent);
    border-color: var(--accent);
    background: var(--accent-dim);
}

/* Delete button — push to far right */
.lightbox-overlay.video-mode .lightbox-delete {
    margin-left: auto;
}

/* .lightbox-delete:hover is handled by .btn-ghost.btn-sm:hover above */

/* Veo special model actions — subtle highlight */
.lightbox-overlay.video-mode .veo-action {
    background: var(--surface-2);
    border-color: var(--border);
}

/* Cost badge in video header */
.lightbox-overlay.video-mode .lightbox-cost {
    font-size: 10px;
    padding: 3px 8px;
    border-radius: 4px;
}

/* Mobile: stack actions */
@media (max-width: 600px) {
    .lightbox-overlay.video-mode .lightbox-content {
        max-width: 100vw;
        width: 100vw;
        border-radius: 0;
        border-left: none;
        border-right: none;
    }

    .lightbox-overlay.video-mode .lightbox-media {
        max-height: 55vw;
    }

    .lightbox-overlay.video-mode .lightbox-body {
        max-height: 55vw;
    }

    .lightbox-overlay.video-mode .lightbox-actions {
        gap: 6px;
        padding: 10px 14px;
    }

    .lightbox-overlay.video-mode .lightbox-delete {
        margin-left: 0;
    }
}
/* ============================================================
   DIALOGUE EDITOR & VOICE PICKER
   ============================================================ */

.v2-dialogue-card {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 10px;
    padding: 14px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    animation: v2-fade-in-slide 0.3s ease-out;
}

@keyframes v2-fade-in-slide {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

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

.v2-dialogue-label {
    font-weight: 600;
    font-size: 13px;
    color: var(--text);
    font-family: var(--sans);
}

.v2-dialogue-remove {
    background: none;
    border: none;
    color: #ef4444;
    cursor: pointer;
    font-size: 14px;
    padding: 4px;
    opacity: 0.6;
    transition: opacity 0.2s;
}

.v2-dialogue-remove:hover {
    opacity: 1;
}

.v2-voice-selector {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
}

.v2-voice-selector:hover {
    border-color: var(--accent);
    background: var(--surface-3);
}

.v2-voice-icon {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: var(--accent-dim);
    color: var(--accent);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    font-weight: 700;
}

.v2-voice-name {
    font-size: 13px;
    font-weight: 500;
    color: var(--text);
    flex: 1;
}

.voice-picker-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    padding: 20px;
}

.voice-card {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    text-align: left;
}

.voice-card:hover {
    border-color: var(--accent);
    background: var(--surface-3);
    transform: translateY(-1px);
}

.voice-card.active {
    border-color: var(--accent);
    background: var(--accent-dim);
}

.voice-card-icon {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--surface-3);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-dim);
    font-weight: 700;
    font-size: 12px;
    border: 1px solid var(--border);
}

.voice-card.active .voice-card-icon {
    background: var(--accent);
    color: #fff;
    border-color: var(--accent);
}

.voice-card-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.voice-card-name {
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
}

.voice-card-desc {
    font-size: 10px;
    color: var(--text-muted);
    font-family: var(--mono);
}
