/* =====================================================================
   AI 详情图工作台 · 统一专业设计系统
   - 风格：现代 SaaS 工作台 (深色顶栏 + 浅色卡片主体)
   - 主色：indigo/blue 主调 + amber 强调
   - 字体：Inter + PingFang/Microsoft YaHei
   ===================================================================== */

:root {
    --bg: #f4f6fb;
    --bg-soft: #eef1f7;
    --surface: #ffffff;
    --surface-2: #f8fafc;
    --surface-3: #eef2f7;

    --ink: #0f172a;
    --ink-2: #1e293b;
    --muted: #64748b;
    --muted-2: #94a3b8;
    --hint: #b2becd;

    --line: #e2e8f0;
    --line-2: #d8e0ec;

    --primary: #2563eb;
    --primary-2: #1d4ed8;
    --primary-soft: #eff5ff;
    --accent: #f59e0b;
    --accent-2: #d97706;
    --success: #10b981;
    --success-soft: #ecfdf5;
    --danger: #ef4444;
    --danger-soft: #fef2f2;
    --warn: #f59e0b;
    --warn-soft: #fffbeb;
    --info: #0ea5e9;
    --info-soft: #ecfeff;

    --header-bg: #0f172a;
    --header-bg-2: #111827;

    --radius-sm: 8px;
    --radius: 12px;
    --radius-lg: 16px;
    --radius-xl: 20px;

    --shadow-sm: 0 1px 2px rgba(15,23,42,.04);
    --shadow: 0 1px 2px rgba(15,23,42,.04), 0 8px 24px rgba(15,23,42,.06);
    --shadow-lg: 0 12px 40px rgba(15,23,42,.10);

    --font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI",
            "PingFang SC", "Microsoft YaHei", "Hiragino Sans GB",
            "Helvetica Neue", Arial, sans-serif;
    --font-mono: "JetBrains Mono", "SF Mono", Consolas, "Courier New", monospace;
}

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

html, body { height: 100%; }

body {
    font-family: var(--font);
    background: var(--bg);
    color: var(--ink);
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
    font-size: 14px;
    line-height: 1.5;
}

a { color: inherit; text-decoration: none; }
button, input, select, textarea { font-family: inherit; }

/* =====================================================================
   顶部导航 Header
   ===================================================================== */
.header {
    height: 56px;
    padding: 0 24px;
    background: var(--header-bg);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    position: sticky;
    top: 0;
    z-index: 100;
    overflow: hidden;
    border-bottom: 1px solid rgba(255,255,255,.06);
    box-shadow: 0 1px 0 rgba(255,255,255,.04), 0 8px 24px rgba(15,23,42,.18);
}
.header-left {
    display: flex;
    align-items: center;
    gap: 28px;
    flex: 1;
    height: 100%;
    min-width: 0;
}
.header-right {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 0 0 auto;
    height: 100%;
}
.logo {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    flex: 0 0 auto;
    font-size: 15px;
    font-weight: 700;
    letter-spacing: .2px;
    color: #fff;
    white-space: nowrap;
}
.logo::before {
    content: "";
    width: 22px;
    height: 22px;
    border-radius: 7px;
    background:
        linear-gradient(135deg, #3b82f6 0%, #6366f1 100%);
    box-shadow: 0 2px 8px rgba(59,130,246,.45);
}

/* 主导航：下划线式 tab，简洁专业 */
.nav-links {
    display: flex;
    align-items: center;
    gap: 4px;
    flex: 1;
    height: 100%;
    min-width: 0;
    overflow-x: auto;
    overflow-y: hidden;
    scrollbar-width: thin;
}
.nav-link {
    position: relative;
    padding: 0 14px;
    height: 100%;
    display: inline-flex;
    align-items: center;
    flex: 0 0 auto;
    color: rgba(255,255,255,.62);
    font-size: 13.5px;
    font-weight: 500;
    transition: color .15s;
    white-space: nowrap;
}
.nav-link:hover { color: #fff; }
.nav-link.active { color: #fff; font-weight: 600; }
.nav-link.active::after {
    content: "";
    position: absolute;
    left: 12px;
    right: 12px;
    bottom: -1px;
    height: 2px;
    background: linear-gradient(90deg, #3b82f6, #6366f1);
    border-radius: 2px 2px 0 0;
}

.btn-logout {
    display: inline-flex;
    align-items: center;
    height: 32px;
    padding: 0 12px;
    color: rgba(255,255,255,.78);
    font-size: 13px;
    border: 1px solid rgba(255,255,255,.16);
    border-radius: 8px;
    background: rgba(255,255,255,.03);
    transition: all .15s;
}
.btn-logout:hover {
    background: rgba(255,255,255,.10);
    color: #fff;
    border-color: rgba(255,255,255,.28);
}

.local-user-badge {
    display: inline-flex;
    align-items: center;
    height: 32px;
    padding: 0 12px;
    border-radius: 8px;
    color: #dbeafe;
    font-size: 13px;
    background: rgba(37,99,235,.2);
    border: 1px solid rgba(147,197,253,.26);
}

@media (max-width: 1380px) {
    .header {
        padding: 0 14px;
        gap: 10px;
    }
    .header-left {
        gap: 14px;
    }
    .nav-link {
        padding: 0 9px;
        font-size: 13px;
    }
    .logo {
        font-size: 14px;
    }
    .local-user-badge,
    .btn-logout {
        padding: 0 10px;
    }
}

/* =====================================================================
   通用页面容器
   ===================================================================== */
.page-shell {
    width: min(1500px, calc(100vw - 32px));
    margin: 0 auto;
    padding: 24px 0 32px;
}

/* Hero 区：所有功能页统一风格 */
.hero {
    display: grid;
    grid-template-columns: minmax(0,1fr) 360px;
    gap: 16px;
    margin-bottom: 16px;
}
.hero-main, .hero-side {
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
}
.hero-main {
    position: relative;
    overflow: hidden;
    padding: 24px 28px;
    background: var(--surface);
    border: 1px solid var(--line);
}
.hero-main::after {
    content: "";
    position: absolute;
    right: -80px;
    top: -80px;
    width: 240px;
    height: 240px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(59,130,246,.12), transparent 70%);
    pointer-events: none;
}
.eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 10px;
    border-radius: 999px;
    background: var(--primary-soft);
    color: var(--primary-2);
    font-size: 12px;
    font-weight: 600;
    margin-bottom: 12px;
    letter-spacing: .2px;
}
.eyebrow::before {
    content: "";
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--primary);
    box-shadow: 0 0 0 3px rgba(37,99,235,.18);
}
.hero h1 {
    margin: 0 0 8px;
    max-width: 820px;
    font-size: 26px;
    line-height: 1.25;
    letter-spacing: -.02em;
    font-weight: 700;
    color: var(--ink);
}
.hero p {
    margin: 0;
    max-width: 880px;
    color: var(--muted);
    font-size: 14px;
    line-height: 1.65;
}

.hero-side {
    padding: 22px;
    background: linear-gradient(155deg, #1e293b 0%, #0f172a 100%);
    color: #f1f5f9;
    display: flex;
    flex-direction: column;
    gap: 12px;
    position: relative;
    overflow: hidden;
}
.hero-side::after {
    content: "";
    position: absolute;
    right: -40px;
    bottom: -40px;
    width: 180px;
    height: 180px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(99,102,241,.32), transparent 70%);
    pointer-events: none;
}
.hero-side strong {
    font-size: 22px;
    line-height: 1.2;
    color: #fff;
    font-weight: 700;
    letter-spacing: -.01em;
}
.hero-side span {
    color: rgba(241,245,249,.72);
    font-size: 13px;
    line-height: 1.6;
}
.hero-side .status-pill { align-self: flex-start; }

.capability-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    position: relative;
    z-index: 1;
}
.capability {
    border: 1px solid rgba(255,255,255,.10);
    background: rgba(255,255,255,.04);
    border-radius: 10px;
    padding: 10px 12px;
}
.capability b {
    display: block;
    color: #fff;
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 2px;
}
.capability small {
    color: rgba(241,245,249,.62);
    font-size: 11.5px;
    line-height: 1.4;
}

/* Pipeline 步骤条 */
.pipeline {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    margin-bottom: 16px;
}
.step-chip {
    display: flex;
    gap: 12px;
    align-items: center;
    padding: 14px 16px;
    border-radius: var(--radius);
    background: var(--surface);
    border: 1px solid var(--line);
    box-shadow: var(--shadow-sm);
    transition: all .15s;
}
.step-chip:hover {
    border-color: var(--line-2);
    box-shadow: var(--shadow);
}
.step-chip b {
    width: 32px;
    height: 32px;
    display: grid;
    place-items: center;
    border-radius: 9px;
    background: var(--primary-soft);
    color: var(--primary-2);
    font-weight: 700;
    font-size: 14px;
    flex: 0 0 auto;
}
.step-chip > div {
    font-size: 12.5px;
    color: var(--muted);
    line-height: 1.4;
}
.step-chip > div strong {
    display: block;
    color: var(--ink);
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 2px;
}

/* =====================================================================
   App Grid / Layout
   ===================================================================== */
.app-grid, .layout {
    display: grid;
    gap: 16px;
    align-items: start;
}
.app-grid {
    grid-template-columns: minmax(420px, .86fr) minmax(520px, 1.14fr) 340px;
}
.layout {
    grid-template-columns: 380px minmax(0, 1fr) 320px;
}
.queue-panel {
    margin-bottom: 16px;
}
.queue-panel .panel-head {
    align-items: center;
}
.queue-panel .panel-body {
    padding-top: 14px;
}
.side-stack {
    display: grid;
    gap: 16px;
}

/* =====================================================================
   Panel 卡片
   ===================================================================== */
.panel {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
    transition: box-shadow .2s;
}
.panel:hover { box-shadow: var(--shadow); }
.panel-head {
    display: flex;
    justify-content: space-between;
    gap: 14px;
    align-items: flex-start;
    padding: 16px 18px;
    border-bottom: 1px solid var(--line);
    background: var(--surface);
}
.panel-title {
    display: flex;
    gap: 12px;
    align-items: flex-start;
}
.panel-title .num {
    width: 34px;
    height: 34px;
    display: grid;
    place-items: center;
    border-radius: 10px;
    background: linear-gradient(135deg, var(--primary), #6366f1);
    color: #fff;
    font-weight: 700;
    font-size: 13px;
    flex: 0 0 auto;
    box-shadow: 0 4px 12px rgba(37,99,235,.28);
}
.panel-title h2 {
    margin: 0 0 2px;
    font-size: 15px;
    line-height: 1.3;
    font-weight: 600;
    color: var(--ink);
}
.panel-title p {
    margin: 0;
    color: var(--muted);
    font-size: 12.5px;
    line-height: 1.45;
}
.panel-body { padding: 18px; }

/* =====================================================================
   表单
   ===================================================================== */
label {
    display: block;
    color: var(--ink-2);
    font-size: 12.5px;
    font-weight: 600;
    margin-bottom: 6px;
    letter-spacing: .1px;
}
.form-line { margin-bottom: 14px; }
.form-line:last-child { margin-bottom: 0; }
.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

textarea, input[type="text"], input[type="number"], input[type="search"], select {
    width: 100%;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: var(--surface);
    color: var(--ink);
    outline: none;
    font: inherit;
    font-size: 13.5px;
    padding: 10px 12px;
    transition: border-color .15s, box-shadow .15s, background .15s;
}
textarea {
    min-height: 110px;
    resize: vertical;
    line-height: 1.6;
}
textarea:focus, input:focus, select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37,99,235,.14);
    background: #fff;
}
input::placeholder, textarea::placeholder {
    color: var(--hint);
}
select {
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'><polyline points='6 9 12 15 18 9'/></svg>");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 14px;
    padding-right: 36px;
}

input[type="range"] {
    width: 100%;
    accent-color: var(--primary);
}

.input-row {
    display: flex;
    gap: 8px;
}
.input-row input { flex: 1; min-width: 0; }
.input-row button { flex: 0 0 auto; }

.size-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.resolution-preset {
    width: 100%;
    margin-bottom: 8px;
}
.size-row input {
    width: 90px;
    text-align: center;
}
.size-x { color: var(--muted-2); font-weight: 500; }
.size-unit { color: var(--muted-2); font-size: 13px; }

/* Radio 单选 */
.radio-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.radio-label {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    padding: 10px 12px;
    border-radius: 10px;
    border: 1px solid var(--line);
    background: var(--surface);
    transition: all .15s;
    font-size: 13px;
    color: var(--ink-2);
}
.radio-label:hover { border-color: var(--line-2); background: var(--surface-2); }
.radio-label:has(input:checked) {
    border-color: var(--primary);
    background: var(--primary-soft);
    color: var(--primary-2);
    font-weight: 500;
}
.radio-label input[type="radio"] { accent-color: var(--primary); }
.radio-text {
    display: grid;
    gap: 2px;
}
.radio-text b {
    font-size: 13.5px;
    color: inherit;
}
.radio-text small {
    color: var(--muted);
    font-size: 12px;
    line-height: 1.45;
    font-weight: 400;
}
.radio-label:has(input:checked) .radio-text small {
    color: #315fbb;
}
.prompt-input-card {
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
}
.prompt-mode-banner {
    margin-bottom: 12px;
    padding: 12px;
    border-radius: 12px;
    background: var(--primary-soft);
    border: 1px solid rgba(37,99,235,.18);
    display: grid;
    gap: 3px;
}
.prompt-mode-banner b {
    color: var(--primary-2);
    font-size: 14px;
}
.prompt-mode-banner span,
.prompt-example span {
    color: var(--muted);
    font-size: 12.5px;
    line-height: 1.55;
}
.prompt-example {
    margin-top: 9px;
    padding: 10px 12px;
    border-radius: 10px;
    background: #fff;
    border: 1px dashed var(--line-2);
    display: grid;
    gap: 2px;
}
.prompt-example b {
    color: var(--ink-2);
    font-size: 12.5px;
}

/* =====================================================================
   Buttons
   ===================================================================== */
button {
    border: 0;
    border-radius: 10px;
    padding: 10px 14px;
    font: inherit;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: transform .12s, box-shadow .15s, background .15s, opacity .15s;
    line-height: 1.2;
    letter-spacing: .1px;
}
button:active { transform: translateY(1px); }
button:disabled { opacity: .5; cursor: not-allowed; transform: none; }

.btn-primary {
    color: #fff;
    background: linear-gradient(135deg, var(--primary), #4f46e5);
    box-shadow: 0 6px 16px rgba(37,99,235,.22);
}
.btn-primary:hover:not(:disabled) {
    box-shadow: 0 8px 22px rgba(37,99,235,.32);
    transform: translateY(-1px);
}

.btn-orange, .btn-accent {
    color: #fff;
    background: linear-gradient(135deg, var(--accent), var(--accent-2));
    box-shadow: 0 6px 16px rgba(245,158,11,.22);
}
.btn-orange:hover:not(:disabled), .btn-accent:hover:not(:disabled) {
    box-shadow: 0 8px 22px rgba(245,158,11,.32);
    transform: translateY(-1px);
}

.btn-ghost {
    color: var(--ink-2);
    background: var(--surface-2);
    border: 1px solid var(--line);
}
.btn-ghost:hover:not(:disabled) {
    background: var(--surface-3);
    border-color: var(--line-2);
}

.btn-row {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    align-items: center;
}

/* 主"开始生成"按钮（index.html） */
.btn-generate {
    width: 100%;
    padding: 13px;
    background: linear-gradient(135deg, var(--primary), #4f46e5);
    color: #fff;
    border: none;
    border-radius: 12px;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    transition: transform .15s, box-shadow .15s;
    margin-top: 4px;
    box-shadow: 0 6px 16px rgba(37,99,235,.22);
}
.btn-generate:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 10px 26px rgba(37,99,235,.32);
}
.btn-generate:disabled {
    opacity: .55;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.btn-scan {
    padding: 10px 16px;
    background: var(--primary);
    color: #fff;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    white-space: nowrap;
}
.btn-scan:hover { background: var(--primary-2); }

.btn-toggle {
    padding: 5px 12px;
    background: var(--surface-2);
    border: 1px solid var(--line);
    border-radius: 8px;
    cursor: pointer;
    font-size: 12px;
    color: var(--muted);
    font-weight: 500;
}
.btn-toggle:hover { background: var(--surface-3); color: var(--ink-2); }

.btn-download {
    padding: 9px 18px;
    background: linear-gradient(135deg, var(--success), #059669);
    color: #fff;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    transition: transform .15s, box-shadow .15s;
    box-shadow: 0 6px 16px rgba(16,185,129,.22);
}
.btn-download:hover {
    transform: translateY(-1px);
    box-shadow: 0 8px 22px rgba(16,185,129,.32);
}
.btn-download:disabled {
    cursor: wait;
    opacity: .72;
    transform: none;
    box-shadow: none;
}

.btn-confirm {
    flex: 1;
    padding: 13px;
    background: linear-gradient(135deg, var(--success), #059669);
    color: #fff;
    border: none;
    border-radius: 12px;
    font-size: 14.5px;
    font-weight: 700;
    cursor: pointer;
    transition: transform .15s, box-shadow .15s;
    box-shadow: 0 6px 16px rgba(16,185,129,.22);
}
.btn-confirm:hover {
    transform: translateY(-1px);
    box-shadow: 0 10px 26px rgba(16,185,129,.32);
}
.btn-cancel {
    padding: 13px 26px;
    background: var(--surface);
    color: var(--muted);
    border: 1px solid var(--line);
    border-radius: 12px;
    font-size: 14.5px;
    font-weight: 600;
    cursor: pointer;
    transition: all .15s;
}
.btn-cancel:hover {
    border-color: var(--danger);
    color: var(--danger);
    background: var(--danger-soft);
}

.btn-retry {
    padding: 7px 16px;
    background: linear-gradient(135deg, var(--danger), #dc2626);
    color: #fff;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 600;
    transition: transform .15s;
}
.btn-retry:hover { transform: scale(1.04); }

/* =====================================================================
   Status pill / badge
   ===================================================================== */
.status-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 10px;
    border-radius: 999px;
    background: var(--surface-3);
    color: var(--muted);
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
    border: 1px solid var(--line);
}
.status-pill::before {
    content: "";
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--muted-2);
}
.status-pill.is-running { background: var(--info-soft); color: #0369a1; border-color: rgba(14,165,233,.24); }
.status-pill.is-running::before { background: var(--info); animation: pulse 1.4s infinite; }
.status-pill.is-done { background: var(--success-soft); color: #047857; border-color: rgba(16,185,129,.24); }
.status-pill.is-done::before { background: var(--success); }
.status-pill.is-error { background: var(--danger-soft); color: #b91c1c; border-color: rgba(239,68,68,.24); }
.status-pill.is-error::before { background: var(--danger); }
.status-pill.is-warn { background: var(--warn-soft); color: #b45309; border-color: rgba(245,158,11,.28); }
.status-pill.is-warn::before { background: var(--warn); }

.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 12px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
}
.status-badge.pending { background: var(--warn-soft); color: #b45309; }
.status-badge.generating_prompts { background: var(--info-soft); color: #0369a1; }
.status-badge.generating_images { background: var(--primary-soft); color: var(--primary-2); }
.status-badge.done { background: var(--success-soft); color: #047857; }
.status-badge.error { background: var(--danger-soft); color: #b91c1c; }

@keyframes pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50%      { opacity: .55; transform: scale(.85); }
}

/* =====================================================================
   主布局（index.html 双栏）
   ===================================================================== */
.main-container {
    display: flex;
    gap: 0;
    min-height: calc(100vh - 56px);
}
.config-panel {
    width: 380px;
    min-width: 380px;
    background: var(--surface);
    padding: 22px 22px 28px;
    overflow-y: auto;
    border-right: 1px solid var(--line);
    height: calc(100vh - 56px);
    position: sticky;
    top: 56px;
}
.panel-title {
    /* 在 index.html 这里被用做标题文本（兼容老结构） */
    font-size: 16px;
}
aside.config-panel > .panel-title {
    display: block;
    font-size: 16px;
    font-weight: 700;
    color: var(--ink);
    margin-bottom: 18px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--line);
    position: relative;
}
aside.config-panel > .panel-title::after {
    content: "";
    position: absolute;
    left: 0;
    bottom: -1px;
    width: 36px;
    height: 2px;
    background: linear-gradient(90deg, var(--primary), #6366f1);
    border-radius: 2px;
}
.form-group { margin-bottom: 16px; }
.form-group label {
    display: block;
    font-size: 12.5px;
    font-weight: 600;
    color: var(--ink-2);
    margin-bottom: 6px;
}
.form-group input[type="text"],
.form-group input[type="number"],
.form-group textarea,
.form-group select {
    width: 100%;
}
.form-group textarea { resize: vertical; }

.result-panel {
    flex: 1;
    padding: 24px;
    overflow-y: auto;
    height: calc(100vh - 56px);
    background: var(--bg);
}

/* =====================================================================
   详情图/主图套图：三列工作台布局
   ===================================================================== */
.main-container.detail-workspace {
    display: grid;
    grid-template-columns: minmax(430px, 450px) minmax(560px, 1fr) minmax(260px, 300px);
    gap: 12px;
    min-height: calc(100vh - 56px);
    padding: 8px 10px;
    background: #eef3fb;
}
.detail-workspace .detail-config-panel,
.detail-workspace .result-panel,
.detail-workspace .detail-history-panel {
    height: calc(100vh - 72px);
    border: 1px solid var(--line);
    border-radius: 16px;
    background: var(--surface);
    box-shadow: var(--shadow-sm);
}
.detail-workspace .detail-config-panel {
    width: auto;
    min-width: 0;
    padding: 10px;
    overflow-y: auto;
    position: sticky;
    top: 64px;
    border-right: 1px solid var(--line);
}
.detail-workspace .result-panel {
    min-width: 0;
    padding: 12px 14px;
    overflow-y: auto;
    background: #f7faff;
}
.detail-workspace .panel-title,
.detail-workspace .detail-config-panel > .panel-title {
    margin-bottom: 8px;
    padding-bottom: 8px;
    font-size: 15px;
}
.detail-workspace .form-group {
    margin-bottom: 6px;
}
.detail-workspace .form-group label {
    margin-bottom: 3px;
    font-size: 11.5px;
}
.detail-upload-grid,
.detail-preview-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 6px;
}
.detail-field-grid {
    display: grid;
    grid-template-columns: 72px 76px minmax(170px, 1fr);
    gap: 6px 8px;
    align-items: end;
}
.detail-workspace .upload-area {
    min-height: 46px;
    padding: 6px 8px;
    border-radius: 10px;
}
.detail-workspace .upload-area .upload-hint {
    gap: 3px;
    font-size: 11.5px;
}
.detail-workspace .upload-area .upload-icon {
    width: 20px;
    height: 20px;
    font-size: 15px;
}
.detail-workspace .source-preview {
    max-height: 82px;
    padding: 6px;
    gap: 6px;
}
.detail-workspace .source-preview img,
.detail-workspace .source-preview-item {
    width: 52px;
    height: 52px;
}
.detail-field-grid #mainSetSizeGroup {
    grid-column: 1 / -1;
}
.detail-field-count {
    grid-column: 1;
}
.detail-field-ratio {
    grid-column: 2;
}
.detail-field-resolution {
    grid-column: 3;
}
.detail-field-model {
    grid-column: 1 / span 2;
}
.detail-field-threads {
    grid-column: 3;
}
.detail-field-threads label {
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.detail-workspace input,
.detail-workspace select,
.detail-workspace textarea {
    min-height: 32px;
    padding: 7px 9px;
    font-size: 12.5px;
}
.detail-workspace #extraRequirements {
    height: 32px;
    min-height: 32px;
    line-height: 1.35;
    overflow: hidden;
    resize: none;
    white-space: nowrap;
}
.detail-workspace .resolution-preset {
    margin-bottom: 0;
}
.detail-workspace .radio-label {
    display: flex;
    align-items: center;
    padding: 7px 8px;
    border-radius: 10px;
    gap: 7px;
}
.detail-workspace .radio-text b {
    font-size: 13px;
}
.detail-workspace .radio-text small {
    font-size: 11.5px;
    line-height: 1.35;
}
.detail-prompt-type-group .radio-group {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 6px;
}
.detail-workspace .detail-prompt-type-group {
    display: grid;
    grid-template-columns: 52px minmax(0, 1fr);
    gap: 6px;
    align-items: center;
}
.detail-workspace .detail-prompt-type-group > label {
    margin: 0;
}
.detail-prompt-type-group .radio-label {
    min-height: 34px;
    padding: 5px 7px;
}
.detail-prompt-type-group .radio-text {
    gap: 0;
}
.detail-prompt-type-group .radio-text b {
    font-size: 12.5px;
    white-space: nowrap;
}
.detail-prompt-type-group .radio-text small {
    display: none;
}
.detail-workspace .prompt-input-card {
    padding: 7px 8px;
    border-radius: 12px;
}
.detail-workspace .prompt-mode-banner {
    display: none;
    margin-bottom: 6px;
    padding: 7px 9px;
    border-radius: 10px;
}
.detail-extra-inline {
    display: grid;
    grid-template-columns: 118px minmax(0, 1fr);
    gap: 8px;
    align-items: center;
    margin-bottom: 6px;
}
.detail-extra-inline label {
    margin: 0;
    white-space: nowrap;
}
.detail-workspace .prompt-mode-banner span {
    display: none;
}
.detail-workspace .prompt-mode-banner span,
.detail-workspace .prompt-example span {
    font-size: 12px;
    line-height: 1.4;
}
.detail-workspace #promptText {
    height: 78px;
    min-height: 78px;
    line-height: 1.45;
}
.detail-workspace .prompt-example {
    display: none;
}
.detail-workspace .btn-generate {
    margin-top: 2px;
    padding: 11px 14px;
    border-radius: 12px;
}
.detail-workspace .log-panel,
.detail-workspace .progress-section,
.detail-workspace .prompts-confirm-panel {
    margin-bottom: 14px;
}
.detail-workspace .log-content {
    max-height: 180px;
}
.detail-workspace .empty-state {
    min-height: calc(100vh - 126px);
    display: grid;
    align-content: center;
}
.detail-history-panel {
    padding: 12px;
    overflow: hidden;
    position: sticky;
    top: 64px;
}
.detail-history-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 12px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--line);
}
.detail-history-panel h3 {
    margin: 0;
    padding: 0;
    border: 0;
    color: var(--ink);
    font-size: 15px;
    font-weight: 700;
}
.detail-history-panel .history-list {
    max-height: none;
    height: calc(100% - 48px);
    overflow-y: auto;
    padding-right: 2px;
}
.detail-history-panel .history-item {
    padding: 10px;
    border-radius: 12px;
}
.detail-history-panel .history-time {
    font-size: 12.5px;
}
.detail-history-panel .history-info {
    line-height: 1.55;
}
@media (max-width: 1380px) {
    .main-container.detail-workspace {
        grid-template-columns: minmax(400px, 420px) minmax(520px, 1fr) minmax(240px, 280px);
        gap: 8px;
        padding: 6px;
    }
    .detail-workspace .detail-config-panel,
    .detail-workspace .result-panel,
    .detail-workspace .detail-history-panel {
        height: calc(100vh - 68px);
    }
}
@media (max-width: 1120px) {
    .main-container.detail-workspace {
        grid-template-columns: 1fr;
    }
    .detail-workspace .detail-config-panel,
    .detail-workspace .result-panel,
    .detail-workspace .detail-history-panel {
        position: static;
        height: auto;
        max-height: none;
    }
    .detail-history-panel .history-list {
        height: auto;
        max-height: 320px;
    }
}
@media (max-width: 640px) {
    .detail-upload-grid,
    .detail-preview-grid,
    .detail-field-grid,
    .detail-prompt-type-group .radio-group {
        grid-template-columns: 1fr;
    }
}

/* =====================================================================
   Drop zone 上传区（共用）
   ===================================================================== */
.upload-area, .drop-zone {
    border: 1.5px dashed var(--line-2);
    border-radius: 14px;
    background: var(--surface-2);
    text-align: center;
    cursor: pointer;
    transition: all .15s;
    padding: 24px;
    position: relative;
}
.upload-area:hover, .upload-area.dragover,
.drop-zone:hover, .drop-zone.dragover {
    border-color: var(--primary);
    background: var(--primary-soft);
}
.upload-area.has-files,
.drop-zone.has-file {
    border-style: solid;
    border-color: var(--success);
    background: var(--success-soft);
}
.upload-area .upload-hint {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    color: var(--muted);
    font-size: 13px;
}
.upload-area .upload-icon {
    width: 36px;
    height: 36px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    background: var(--surface);
    color: var(--primary);
    font-size: 22px;
    line-height: 1;
    box-shadow: var(--shadow-sm);
}
.upload-area.has-files .upload-hint { color: #047857; }
.upload-area.has-files .upload-icon { color: var(--success); }

.drop-zone {
    min-height: 130px;
    display: grid;
    place-items: center;
}
.drop-zone strong {
    display: block;
    font-size: 14.5px;
    font-weight: 600;
    color: var(--ink);
    margin-bottom: 4px;
}
.drop-zone span {
    color: var(--muted);
    font-size: 12.5px;
    line-height: 1.55;
    display: block;
}
.drop-zone.has-file strong { color: #047857; }

/* 来源图预览 */
.source-preview {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    max-height: 120px;
    overflow-y: auto;
    padding: 8px;
    background: var(--surface-2);
    border-radius: 10px;
    border: 1px solid var(--line);
}
.source-preview img {
    width: 60px;
    height: 60px;
    object-fit: cover;
    border-radius: 8px;
    border: 1px solid var(--line-2);
    cursor: pointer;
    transition: all .15s;
    background: #fff;
}
.source-preview img:hover {
    transform: scale(1.08);
    border-color: var(--primary);
    box-shadow: var(--shadow);
}
.source-preview-item {
    position: relative;
    width: 60px;
    height: 60px;
    flex: 0 0 60px;
}
.source-preview-item img {
    display: block;
}
.source-remove-btn {
    position: absolute;
    top: -6px;
    right: -6px;
    width: 22px;
    height: 22px;
    min-width: 22px;
    min-height: 22px;
    box-sizing: border-box;
    padding: 0;
    display: grid;
    place-items: center;
    border: 1px solid #fecdd3;
    border-radius: 50%;
    background: #fff;
    color: #e11d48;
    font-size: 16px;
    line-height: 1;
    cursor: pointer;
    box-shadow: var(--shadow-sm);
    z-index: 2;
}
.source-remove-btn:hover {
    background: #fff1f2;
    border-color: #fb7185;
}
.preview-row {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin: 10px 0 14px;
}
.preview-row img {
    width: 60px;
    height: 60px;
    object-fit: cover;
    border-radius: 10px;
    border: 1px solid var(--line);
    background: #fff;
}

.image-analyze-shell {
    max-width: 1280px;
    margin: 0 auto;
    padding: 28px 20px 44px;
}
.image-analyze-grid {
    display: grid;
    grid-template-columns: minmax(320px, 420px) minmax(0, 1fr);
    gap: 20px;
    align-items: start;
}
.image-analyze-panel .panel-head {
    align-items: flex-start;
}
.image-analyze-upload {
    min-height: 220px;
}
.image-analyze-preview {
    margin: 12px 0 0;
    max-height: none;
}
.image-analyze-preview.hidden {
    display: none;
}
.image-analyze-preview-item,
.image-analyze-preview-item img {
    width: 120px;
    height: 120px;
}
.image-analyze-submit {
    width: 100%;
    margin-top: 14px;
}
.image-analyze-result {
    width: 100%;
    min-height: 440px;
    box-sizing: border-box;
    resize: vertical;
    line-height: 1.72;
}
.image-analyze-system-prompt {
    white-space: pre-wrap;
    margin: 14px 0 0;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: var(--surface-2);
    color: var(--muted);
    font-family: inherit;
    font-size: 12px;
    line-height: 1.65;
}
@media (max-width: 960px) {
    .image-analyze-grid {
        grid-template-columns: 1fr;
    }
}
.single-export-links {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: center;
    margin-top: 12px;
}
.single-export-links .link-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 34px;
    padding: 0 12px;
    border-radius: 8px;
    border: 1px solid var(--line);
    background: var(--surface);
    color: var(--primary);
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
}
.single-export-links .link-btn:hover {
    border-color: var(--primary);
    background: #eef4ff;
}

/* =====================================================================
   进度条
   ===================================================================== */
.progress-section {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    padding: 18px 20px;
    margin-bottom: 20px;
    box-shadow: var(--shadow-sm);
}
.progress-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    font-size: 13px;
    color: var(--muted);
}
.progress-bar-bg {
    height: 8px;
    background: var(--surface-3);
    border-radius: 999px;
    overflow: hidden;
}
.progress-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--primary), #6366f1);
    border-radius: 999px;
    transition: width .3s ease;
}
.progress-detail {
    margin-top: 10px;
    font-size: 12px;
    color: var(--muted-2);
}
.progress-track {
    height: 8px;
    border-radius: 999px;
    background: var(--surface-3);
    overflow: hidden;
    margin: 10px 0;
}
.progress-fill {
    width: 0%;
    height: 100%;
    background: linear-gradient(90deg, var(--primary), var(--accent));
    transition: width .35s ease;
}

/* =====================================================================
   Section header (右侧通用标题)
   ===================================================================== */
.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}
.section-header h3 {
    font-size: 15px;
    color: var(--ink);
    font-weight: 600;
}

/* AI 提示词预览 */
.prompts-preview {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    padding: 18px 20px;
    margin-bottom: 20px;
    box-shadow: var(--shadow-sm);
}
.prompts-preview pre {
    max-height: 300px;
    overflow-y: auto;
    background: var(--surface-2);
    padding: 14px 16px;
    border-radius: 10px;
    font-size: 13px;
    line-height: 1.65;
    white-space: pre-wrap;
    word-break: break-all;
    font-family: var(--font);
    color: var(--ink-2);
    border: 1px solid var(--line);
}

/* =====================================================================
   提示词确认面板
   ===================================================================== */
.prompts-confirm-panel {
    background: var(--surface);
    border: 1px solid var(--primary);
    border-radius: var(--radius-lg);
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: 0 8px 28px rgba(37,99,235,.10);
}
.prompts-confirm-panel .section-header h3 {
    color: var(--primary-2);
    font-size: 15px;
}
.prompts-confirm-panel .section-header {
    gap: 12px;
}
.prompts-list {
    max-height: 450px;
    overflow-y: auto;
    margin: 14px 0;
}
.prompt-item {
    background: var(--surface-2);
    border: 1px solid var(--line);
    border-left: 3px solid var(--primary);
    border-radius: 10px;
    padding: 12px 14px;
    margin-bottom: 10px;
}
.prompt-item .prompt-title {
    font-weight: 600;
    font-size: 13.5px;
    color: var(--ink);
    margin-bottom: 4px;
}
.prompt-title span {
    margin-left: 8px;
    color: var(--muted);
    font-size: 12px;
    font-weight: 400;
}
.prompt-edit {
    width: 100%;
    min-height: 150px;
    margin-top: 8px;
    border-radius: 12px;
    line-height: 1.65;
    background: #fff;
}
.prompt-item .prompt-body {
    font-size: 13px;
    color: var(--muted);
    line-height: 1.6;
    white-space: pre-wrap;
    max-height: 100px;
    overflow-y: auto;
}
.confirm-actions {
    display: flex;
    gap: 12px;
    margin-top: 14px;
}

/* =====================================================================
   结果区
   ===================================================================== */
.result-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}
.result-header h3 {
    font-size: 17px;
    color: var(--ink);
    font-weight: 700;
}
.result-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 16px;
}
.result-card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    transition: all .2s;
    cursor: pointer;
}
.result-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-lg);
    border-color: var(--line-2);
}
.result-card img {
    width: 100%;
    aspect-ratio: 3/4;
    object-fit: cover;
    display: block;
}
.result-card .card-footer {
    padding: 10px 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 13px;
    background: var(--surface);
    border-top: 1px solid var(--line);
}
.result-card .page-num {
    font-weight: 600;
    color: var(--ink);
}
.result-card .card-status {
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 999px;
    font-weight: 600;
}
.card-status.ok { background: var(--success-soft); color: #047857; }
.card-status.failed { background: var(--danger-soft); color: #b91c1c; }
.card-status.loading {
    background: var(--info-soft); color: #0369a1;
    animation: pulse 1.5s infinite;
}

/* =====================================================================
   空状态
   ===================================================================== */
.empty-state {
    text-align: center;
    padding: 80px 20px;
    color: var(--muted);
    background: var(--surface);
    border: 1px dashed var(--line-2);
    border-radius: var(--radius-lg);
}
.empty-icon {
    font-size: 56px;
    margin-bottom: 16px;
    opacity: .85;
}
.empty-state h3 {
    font-size: 18px;
    color: var(--ink-2);
    margin-bottom: 6px;
    font-weight: 600;
}
.empty-state p {
    font-size: 13.5px;
    color: var(--muted);
}

/* =====================================================================
   日志面板（深色，所有页面共用）
   ===================================================================== */
.log-panel {
    background: #0b1220;
    border: 1px solid #1e293b;
    border-radius: var(--radius-lg);
    padding: 16px 18px;
    margin-bottom: 20px;
    box-shadow: var(--shadow);
}
.log-panel .section-header h3 { color: #e2e8f0; }
.log-panel .btn-toggle {
    background: rgba(255,255,255,.06);
    border-color: rgba(255,255,255,.10);
    color: #cbd5e1;
}
.log-panel .btn-toggle:hover {
    background: rgba(255,255,255,.10);
    color: #fff;
}
.log-content {
    max-height: 240px;
    overflow-y: auto;
    font-family: var(--font-mono);
    font-size: 12px;
    line-height: 1.7;
    color: #94a3b8;
    padding: 8px 0 0;
    white-space: pre-wrap;
    word-break: break-all;
}
.log-content .log-line {
    padding: 2px 0;
    color: #cbd5e1;
    border-bottom: 1px solid rgba(255,255,255,.04);
}
.log-content .log-line:last-child { border-bottom: 0; }
.log-content .log-line.error { color: #fca5a5; }
.log-content .log-line.warn  { color: #fcd34d; }
.log-content .log-line.info  { color: #93c5fd; }
.log-content .log-line.success { color: #86efac; }

/* video.html / video_analyze.html 用的内嵌日志框 */
.log-box {
    background: #0b1220;
    border: 1px solid #1e293b;
    border-radius: 12px;
    padding: 14px;
    color: #e2e8f0;
}
.log-box .status-pill {
    background: rgba(255,255,255,.06);
    color: #cbd5e1;
    border-color: rgba(255,255,255,.10);
}
.log-box .status-pill::before { background: #94a3b8; }
.log-box .status-pill.is-running { background: rgba(14,165,233,.18); color: #93c5fd; border-color: rgba(14,165,233,.30); }
.log-box .status-pill.is-running::before { background: #38bdf8; }
.log-box .status-pill.is-done { background: rgba(16,185,129,.18); color: #6ee7b7; border-color: rgba(16,185,129,.30); }
.log-box .status-pill.is-done::before { background: #34d399; }
.log-box .status-pill.is-error { background: rgba(239,68,68,.20); color: #fca5a5; border-color: rgba(239,68,68,.32); }
.log-box .status-pill.is-error::before { background: #f87171; }
.log-box .progress-track { background: rgba(255,255,255,.06); }

.history-box {
    background: var(--surface-2);
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 12px;
}

.task-list {
    display: grid;
    gap: 10px;
    max-height: 320px;
    overflow: auto;
}
.task-card {
    display: grid;
    grid-template-columns: minmax(220px, 1fr) 112px minmax(150px, 220px) auto;
    gap: 12px;
    align-items: center;
    border: 1px solid rgba(21,60,48,.14);
    border-radius: 14px;
    background: linear-gradient(145deg,#fffdf8,#f3eadc);
    padding: 10px 12px;
    box-shadow: 0 10px 24px rgba(30,40,32,.08);
}
.task-card.has-result {
    border-color: rgba(16,185,129,.36);
}
.task-main b {
    display: block;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: #17231d;
    font-size: 12.5px;
}
.task-main span {
    display: block;
    color: #7b7268;
    font-size: 11px;
    margin-top: 3px;
}
.task-progress {
    height: 7px;
    border-radius: 999px;
    background: rgba(21,60,48,.12);
    overflow: hidden;
}
.task-progress-fill {
    width: 0%;
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg,#153c30,#64e0b0);
    transition: width .35s ease;
}
.task-actions {
    display: flex;
    gap: 7px;
    flex-wrap: wrap;
    justify-content: flex-end;
}
.btn-mini {
    padding: 7px 10px;
    font-size: 11.5px;
    border-radius: 10px;
}
.btn-ready {
    color: #fff !important;
    background: linear-gradient(135deg,#153c30,#2c7b5f) !important;
}
.btn-retry {
    color: #8a3b00 !important;
    border-color: rgba(224,121,0,.36) !important;
    background: #fff8e7 !important;
}
.btn-retry:hover {
    color: #fff !important;
    background: linear-gradient(135deg,#e07900,#f59e0b) !important;
}
.retry-prompt-panel {
    margin-top: 12px;
    padding: 13px 14px;
    border: 1px solid rgba(245,158,11,.30);
    border-radius: 12px;
    background: var(--warn-soft);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}
.retry-prompt-panel b {
    display: block;
    color: #7c2d12;
    font-size: 13px;
    margin-bottom: 2px;
}
.retry-prompt-panel span {
    color: #92400e;
    font-size: 12px;
}
.btn-retry-prompt {
    color: #fff;
    background: linear-gradient(135deg,#e07900,#f59e0b);
    box-shadow: 0 6px 16px rgba(245,158,11,.22);
    white-space: nowrap;
}
.task-log {
    grid-column: 1 / -1;
    margin-top: 9px;
    max-height: 120px;
    overflow: auto;
    border-radius: 12px;
    background: rgba(21,60,48,.08);
    padding: 8px;
    color: #31483e;
    font: 11px/1.55 Consolas, "Courier New", monospace;
}
.task-log div {
    padding: 3px 0;
    border-bottom: 1px dashed rgba(21,60,48,.12);
}
.result-modal {
    position: fixed;
    inset: 0;
    z-index: 10000;
    display: grid;
    place-items: center;
    padding: 24px;
}
.result-modal.hidden {
    display: none;
}
.result-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(15,23,42,.50);
    backdrop-filter: blur(14px);
}
.result-modal-panel {
    position: relative;
    width: min(1120px, calc(100vw - 40px));
    max-height: calc(100vh - 46px);
    display: flex;
    flex-direction: column;
    border-radius: 16px;
    background: #f8fbff;
    border: 1px solid #dbe6f4;
    box-shadow: 0 28px 90px rgba(15,23,42,.34);
    overflow: hidden;
}
.result-modal-head {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    align-items: center;
    padding: 24px 24px 22px;
    border-bottom: 1px solid #dbe6f4;
    background: #fff;
}
.result-modal-title {
    display: flex;
    align-items: center;
    gap: 16px;
}
.result-modal-title .num {
    width: 52px;
    height: 52px;
    display: grid;
    place-items: center;
    border-radius: 14px;
    background: linear-gradient(135deg, #2563eb, #6366f1);
    color: #fff;
    font-size: 22px;
    font-weight: 900;
    box-shadow: 0 10px 24px rgba(37,99,235,.28);
    flex: 0 0 auto;
}
.result-modal-head h2 {
    margin: 6px 0 4px;
    font-size: 22px;
    color: #0f172a;
}
.result-modal-head p {
    margin: 0;
    color: #55708e;
    font-size: 14px;
}
.result-modal-actions {
    display: flex;
    gap: 10px;
    align-items: center;
}
.result-modal-body {
    overflow: auto;
    padding: 20px 24px 24px;
}
.modal-result-section,
.modal-summary {
    white-space: pre-wrap;
    border: 1px solid #dbe6f4;
    border-radius: 16px;
    padding: 18px 20px;
    background: #fff;
    color: #0f172a;
    font-size: 15px;
    line-height: 1.7;
    margin-bottom: 20px;
}
.modal-overview {
    display: grid;
    gap: 18px;
}
.modal-overview b {
    font-weight: 900;
    color: #071327;
}
.modal-shot-list {
    display: grid;
    gap: 20px;
}
.modal-shot-card {
    border: 1px solid #dbe6f4;
    border-radius: 16px;
    background: #fff;
    padding: 20px 22px;
}
.modal-shot-card header {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    align-items: center;
    margin-bottom: 16px;
}
.modal-shot-card h3 {
    margin: 0;
    font-size: 20px;
    color: #071327;
    font-weight: 900;
}
.modal-shot-card .time {
    color: #e07900;
    background: #fff8e7;
    border-radius: 999px;
    padding: 8px 13px;
    font-size: 14px;
    font-weight: 800;
}
.modal-shot-meta {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
    margin-bottom: 14px;
}
.modal-shot-meta div {
    min-height: 58px;
    border: 1px solid #dbe6f4;
    border-radius: 10px;
    background: #fbfdff;
    padding: 10px 14px;
}
.modal-shot-meta b {
    display: block;
    color: #071327;
    font-size: 14px;
    margin-bottom: 4px;
}
.modal-shot-meta span {
    color: #55708e;
    font-size: 15px;
}
.modal-prompt-box {
    white-space: pre-wrap;
    border: 1px solid #dbe6f4;
    border-radius: 14px;
    background: #fff;
    padding: 16px 18px;
    color: #071327;
    font-size: 15px;
    line-height: 1.7;
}
.modal-copy-shot {
    margin-top: 14px;
}
.modal-json-block {
    margin-top: 22px;
    border: 1px solid #dbe6f4;
    border-radius: 16px;
    background: #0f172a;
    overflow: hidden;
}
.modal-json-head {
    display: flex;
    justify-content: space-between;
    gap: 14px;
    align-items: center;
    padding: 14px 16px;
    background: #17233a;
    color: #f8fafc;
}
.modal-json-head b {
    display: block;
    font-size: 15px;
}
.modal-json-head span {
    color: #b8c4d6;
    font-size: 12px;
}
.modal-json-block pre {
    margin: 0;
    max-height: 320px;
    overflow: auto;
    padding: 16px;
    color: #dbeafe;
    font: 12px/1.65 Consolas, "Courier New", monospace;
    white-space: pre-wrap;
}
@media (max-width: 900px) {
    .task-card {
        grid-template-columns: 1fr;
    }
    .task-actions {
        justify-content: flex-start;
    }
    .result-modal {
        padding: 12px;
    }
    .result-modal-panel {
        width: calc(100vw - 18px);
        max-height: calc(100vh - 18px);
        border-radius: 20px;
    }
    .result-modal-head {
        padding: 18px;
        flex-direction: column;
    }
    .result-modal-body {
        padding-left: 18px;
        padding-right: 18px;
    }
    .result-modal-actions {
        flex-wrap: wrap;
        width: 100%;
    }
    .modal-shot-meta {
        grid-template-columns: 1fr;
    }
}

/* =====================================================================
   历史任务列表
   ===================================================================== */
.history-section h3 {
    font-size: 13px;
    color: var(--ink-2);
    font-weight: 600;
    margin-bottom: 10px;
    padding-top: 16px;
    border-top: 1px solid var(--line);
}
.history-list {
    display: grid;
    gap: 8px;
    max-height: 320px;
    overflow: auto;
}
.history-item {
    padding: 10px 12px;
    border: 1px solid var(--line);
    border-radius: 10px;
    margin-bottom: 0;
    cursor: pointer;
    transition: all .15s;
    background: var(--surface);
}
.history-item:hover {
    border-color: var(--primary);
    background: var(--primary-soft);
}
.history-item b {
    display: block;
    color: var(--ink);
    font-size: 12.5px;
    font-weight: 600;
    margin-bottom: 3px;
}
.history-item span {
    display: block;
    color: var(--muted);
    font-size: 11.5px;
    line-height: 1.4;
}
.history-time {
    font-size: 13px;
    font-weight: 600;
    color: var(--ink);
    margin-bottom: 4px;
}
.history-info {
    font-size: 12px;
    color: var(--muted);
    display: flex;
    align-items: center;
    gap: 8px;
}
.history-info .asset-badge {
    display: inline-flex;
    align-items: center;
    padding: 2px 7px;
    border-radius: 999px;
    background: #fff7ed;
    color: #c2410c;
    font-size: 11px;
    font-weight: 700;
    line-height: 1.2;
}
.video-history-item {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 10px;
    align-items: center;
}
.video-history-item .history-row-main {
    min-width: 0;
}
.video-history-item .history-row-actions {
    display: flex;
    align-items: center;
    gap: 6px;
}
.video-history-item .history-row-actions .asset-badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 7px;
    border-radius: 999px;
    background: #fff7ed;
    color: #c2410c;
    font-size: 11px;
    font-weight: 700;
    white-space: nowrap;
}
.video-history-item .history-row-actions .btn-mini {
    height: 28px;
    padding: 0 8px;
    font-size: 11.5px;
}

.mini-note {
    color: var(--muted);
    font-size: 12px;
    line-height: 1.55;
    margin: 8px 0 0;
}

/* =====================================================================
   脚本/分镜（video.html）
   ===================================================================== */
.script-box {
    white-space: pre-wrap;
    min-height: 200px;
    max-height: 420px;
    overflow: auto;
    padding: 14px 16px;
    border-radius: 12px;
    border: 1px solid var(--line);
    background: var(--surface-2);
    color: var(--ink-2);
    font-size: 13px;
    line-height: 1.7;
}
.shots {
    display: grid;
    gap: 12px;
    margin-top: 14px;
}
.shot-card {
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 14px;
    background: var(--surface-2);
    transition: all .15s;
}
.shot-card:hover {
    border-color: var(--line-2);
    background: var(--surface);
    box-shadow: var(--shadow-sm);
}
.shot-card header {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    align-items: center;
    margin-bottom: 10px;
}
.shot-card h3 {
    margin: 0;
    font-size: 14px;
    font-weight: 600;
    color: var(--ink);
}
.shot-card span,
.shot-card .time {
    color: var(--accent-2);
    font-size: 11.5px;
    font-weight: 700;
    background: var(--warn-soft);
    padding: 3px 8px;
    border-radius: 999px;
}
.shot-card textarea { min-height: 90px; }
.shot-meta {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
    margin-bottom: 10px;
}
.shot-meta div {
    border-radius: 8px;
    background: var(--surface);
    border: 1px solid var(--line);
    padding: 8px 10px;
    font-size: 12px;
    color: var(--muted);
}
.shot-meta b {
    display: block;
    color: var(--ink);
    margin-bottom: 2px;
    font-size: 11.5px;
    font-weight: 600;
}
.prompt-box {
    border-radius: 10px;
    background: var(--surface);
    border: 1px solid var(--line);
    padding: 11px 12px;
    font-size: 13px;
    line-height: 1.65;
    color: var(--ink-2);
    white-space: pre-wrap;
}

/* video 结果卡片 */
.video-results {
    display: grid;
    gap: 12px;
}
.video-card {
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--surface);
    padding: 12px;
    box-shadow: var(--shadow-sm);
}
.video-card video {
    width: 100%;
    border-radius: 10px;
    background: #0b1220;
    display: block;
}
.video-card h4 {
    margin: 10px 0 4px;
    font-size: 13.5px;
    font-weight: 600;
    color: var(--ink);
}
.video-card a {
    color: var(--primary-2);
    word-break: break-all;
    font-size: 12px;
}

/* =====================================================================
   video_analyze.html 模式条 + 媒体预览 + 拖拽蒙层
   ===================================================================== */
.mode-strip {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
    margin: 0 0 14px;
}
.mode-pill {
    border-radius: 10px;
    padding: 9px 8px;
    background: var(--surface-2);
    color: var(--muted);
    font-size: 12px;
    font-weight: 600;
    text-align: center;
    border: 1px solid var(--line);
}

.media-preview {
    margin: 14px 0;
    border: 1px solid var(--line);
    border-radius: 12px;
    overflow: hidden;
    background: #0b1220;
    box-shadow: var(--shadow-sm);
}
.preview-top {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    align-items: center;
    padding: 10px 12px;
    color: #e2e8f0;
    background: linear-gradient(90deg, #0b1220, #111827);
    font-size: 12px;
    font-weight: 600;
}
.preview-badge {
    display: inline-flex;
    padding: 3px 8px;
    border-radius: 999px;
    background: rgba(99,102,241,.18);
    color: #c7d2fe;
    border: 1px solid rgba(99,102,241,.32);
    font-size: 11.5px;
}
.media-preview video {
    width: 100%;
    max-height: 250px;
    display: block;
    background: #050807;
}
.preview-meta {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    padding: 10px 12px;
    color: rgba(226,232,240,.72);
    font-size: 12px;
    word-break: break-all;
    background: #0b1220;
}

.summary-box, .raw-box {
    white-space: pre-wrap;
    border: 1px solid var(--line);
    background: var(--surface-2);
    border-radius: 12px;
    padding: 14px;
    color: var(--ink-2);
    font-size: 13px;
    line-height: 1.7;
}
.summary-box {
    min-height: 110px;
    margin-bottom: 14px;
}
.raw-box {
    max-height: 260px;
    overflow: auto;
    margin-top: 14px;
    font-family: var(--font-mono);
    font-size: 12px;
    color: var(--muted);
}
.shot-list {
    display: grid;
    gap: 12px;
}

/* 全屏拖拽蒙层 */
.drag-overlay {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: none;
    place-items: center;
    background: rgba(15,23,42,.72);
    backdrop-filter: blur(12px);
}
.drag-overlay.show { display: grid; }
.drag-card {
    width: min(520px, calc(100vw - 40px));
    border-radius: 24px;
    padding: 32px;
    text-align: center;
    color: #fff;
    background:
        radial-gradient(circle at 50% 0%, rgba(99,102,241,.30), transparent 55%),
        linear-gradient(150deg, #1e293b, #0f172a);
    border: 1px solid rgba(255,255,255,.10);
    box-shadow: 0 24px 80px rgba(0,0,0,.45);
}
.drag-card b {
    display: block;
    font-size: 22px;
    margin-bottom: 8px;
    font-weight: 700;
}
.drag-card span {
    color: rgba(255,255,255,.72);
    font-size: 13.5px;
    line-height: 1.6;
}

/* =====================================================================
   弹窗 / 大图
   ===================================================================== */
.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(15,23,42,.88);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(4px);
}
.modal-overlay.active { display: flex; }
.modal-content {
    position: relative;
    max-width: 90vw;
    max-height: 90vh;
}
.modal-content img {
    max-width: 90vw;
    max-height: 85vh;
    object-fit: contain;
    border-radius: 12px;
    box-shadow: 0 24px 80px rgba(0,0,0,.5);
}
.modal-close {
    position: absolute;
    top: -42px;
    right: 0;
    background: rgba(255,255,255,.10);
    border: 1px solid rgba(255,255,255,.20);
    color: #fff;
    font-size: 22px;
    cursor: pointer;
    padding: 4px 12px;
    border-radius: 8px;
}
.modal-nav {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 24px;
    margin-top: 16px;
}
.modal-prev, .modal-next {
    background: rgba(255,255,255,.10);
    border: 1px solid rgba(255,255,255,.20);
    color: #fff;
    font-size: 16px;
    padding: 8px 18px;
    border-radius: 10px;
    cursor: pointer;
    transition: background .15s;
    font-weight: 600;
}
.modal-prev:hover, .modal-next:hover {
    background: rgba(255,255,255,.20);
}
#modalCounter {
    color: rgba(255,255,255,.78);
    font-size: 13px;
}

/* =====================================================================
   详情页双栏预览（手机+电脑）
   ===================================================================== */
.detail-preview-wrapper {
    display: flex;
    gap: 24px;
    align-items: flex-start;
}
.preview-column {
    display: flex;
    flex-direction: column;
    align-items: center;
}
.preview-label {
    font-size: 12px;
    font-weight: 700;
    color: var(--muted);
    margin-bottom: 10px;
    letter-spacing: 2px;
    text-transform: uppercase;
}

.phone-frame {
    width: 375px;
    min-width: 375px;
    background: #fff;
    border-radius: 32px;
    box-shadow: 0 12px 40px rgba(15,23,42,.18), inset 0 0 0 3px var(--line);
    overflow: hidden;
    position: relative;
}
.phone-notch {
    width: 110px;
    height: 6px;
    background: var(--line-2);
    border-radius: 3px;
    margin: 10px auto 0;
}
.phone-header {
    height: 40px;
    background: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    border-bottom: 1px solid var(--line);
    position: sticky;
    top: 0;
    z-index: 5;
}
.phone-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--ink);
}
.phone-body {
    max-height: calc(100vh - 200px);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}
.phone-body::-webkit-scrollbar { width: 2px; }
.phone-body::-webkit-scrollbar-thumb { background: var(--line-2); border-radius: 1px; }

.pc-column { flex: 1; min-width: 0; }
.pc-frame {
    width: 100%;
    background: #fff;
    border-radius: 12px;
    box-shadow: var(--shadow);
    overflow: hidden;
    border: 1px solid var(--line);
}
.pc-toolbar {
    height: 36px;
    background: var(--surface-2);
    border-bottom: 1px solid var(--line);
    display: flex;
    align-items: center;
    padding: 0 12px;
    gap: 10px;
}
.pc-dots { display: flex; gap: 5px; }
.pc-dots i {
    width: 10px; height: 10px;
    border-radius: 50%;
    display: block;
}
.pc-dots i:nth-child(1) { background: #ff5f57; }
.pc-dots i:nth-child(2) { background: #febc2e; }
.pc-dots i:nth-child(3) { background: #28c840; }
.pc-url {
    flex: 1;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 6px;
    padding: 4px 10px;
    font-size: 11.5px;
    color: var(--muted);
    font-family: var(--font-mono);
}
.pc-body {
    max-height: calc(100vh - 200px);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: 20px;
    background: var(--bg-soft);
}
.pc-body::-webkit-scrollbar { width: 4px; }
.pc-body::-webkit-scrollbar-thumb { background: var(--line-2); border-radius: 2px; }
.pc-body .detail-img-item,
.pc-body .detail-img-placeholder {
    max-width: 790px;
    margin: 0 auto;
}

.detail-img-item {
    position: relative;
    width: 100%;
    display: block;
}
.detail-img-item img {
    width: 100%;
    display: block;
}
.detail-img-item .img-overlay {
    position: absolute;
    top: 8px;
    left: 8px;
    background: rgba(15,23,42,.65);
    color: #fff;
    font-size: 11px;
    padding: 3px 9px;
    border-radius: 999px;
    opacity: 0;
    transition: opacity .15s;
    font-weight: 600;
}
.detail-img-item:hover .img-overlay { opacity: 1; cursor: pointer; }
.detail-img-item .btn-regenerate {
    position: absolute;
    right: 8px;
    bottom: 8px;
    padding: 6px 12px;
    background: rgba(37, 99, 235, .92);
    color: #fff;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 600;
    opacity: .96;
    transition: opacity .15s, transform .15s, background .15s;
    box-shadow: 0 4px 12px rgba(37,99,235,.32);
}
.detail-img-item .btn-regenerate:hover {
    opacity: 1;
    background: var(--primary-2);
    transform: translateY(-1px);
}
.detail-img-item .btn-chat-add {
    position: absolute;
    left: 8px;
    bottom: 8px;
    border: 0;
    border-radius: 8px;
    background: rgba(15, 23, 42, .84);
    color: #fff;
    padding: 6px 12px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(15,23,42,.22);
}
.detail-img-item .btn-text-edit {
    position: absolute;
    left: 8px;
    bottom: 42px;
    border: 0;
    border-radius: 8px;
    background: rgba(5, 150, 105, .92);
    color: #fff;
    padding: 6px 12px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(5,150,105,.24);
}

.detail-img-placeholder {
    width: 100%;
    aspect-ratio: 800/1024;
    background: var(--surface-2);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    border-bottom: 1px dashed var(--line);
}
.detail-img-placeholder .placeholder-num {
    font-size: 32px;
    color: var(--line-2);
    font-weight: 300;
}
.detail-img-placeholder.failed { background: var(--danger-soft); }

/* =====================================================================
   单图生成页
   ===================================================================== */
.single-hero .hero-main::after {
    background:
        radial-gradient(circle, rgba(14,165,233,.14), transparent 70%);
}
.single-grid {
    display: grid;
    grid-template-columns: minmax(360px, .72fr) minmax(320px, .54fr) minmax(520px, 1fr);
    gap: 16px;
    align-items: start;
}
.single-control-panel textarea#singlePrompt {
    min-height: 210px;
}
.single-kind-group {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
}
.single-kind-card {
    position: relative;
    display: flex;
    align-items: stretch;
    gap: 10px;
    margin: 0;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: linear-gradient(180deg, #fff, #f8fafc);
    cursor: pointer;
    transition: border-color .15s, box-shadow .15s, background .15s, transform .15s;
}
.single-kind-card:hover {
    border-color: rgba(37,99,235,.32);
    box-shadow: var(--shadow-sm);
    transform: translateY(-1px);
}
.single-kind-card input {
    margin-top: 3px;
    accent-color: var(--primary);
    flex: 0 0 auto;
}
.single-kind-card span {
    display: grid;
    gap: 3px;
}
.single-kind-card b {
    color: var(--ink);
    font-size: 13.5px;
    line-height: 1.25;
}
.single-kind-card small {
    color: var(--muted);
    font-size: 11.5px;
    line-height: 1.4;
    font-weight: 400;
}
.single-kind-card:has(input:checked) {
    border-color: var(--primary);
    background: linear-gradient(180deg, #eff5ff, #ffffff);
    box-shadow: 0 8px 20px rgba(37,99,235,.12);
}
.single-kind-card:has(input:checked) b {
    color: var(--primary-2);
}
.single-upload-area {
    min-height: 190px;
}
.single-ref-preview {
    display: block;
    margin-top: 14px;
}
.single-ref-toolbar {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    align-items: center;
    margin-bottom: 10px;
}
.single-ref-toolbar span {
    color: var(--muted);
    font-size: 12px;
}
.single-ref-toolbar button {
    padding: 5px 10px;
    border-radius: 8px;
    border: 1px solid var(--line);
    background: #fff;
    color: var(--muted);
    font-size: 12px;
}
.single-ref-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(86px, 1fr));
    gap: 10px;
}
.single-ref-item {
    position: relative;
}
.single-ref-item img {
    width: 100%;
    aspect-ratio: 1;
    object-fit: cover;
    border-radius: 12px;
    border: 1px solid var(--line);
    background: var(--surface-2);
}
.single-ref-item button {
    position: absolute;
    top: -7px;
    right: -7px;
    width: 24px;
    height: 24px;
    padding: 0;
    display: grid;
    place-items: center;
    border-radius: 999px;
    background: var(--danger);
    color: #fff;
    border: 2px solid #fff;
    font-size: 16px;
    line-height: 1;
    box-shadow: var(--shadow-sm);
}
.single-result-panel {
    min-height: 620px;
}
.single-history-panel {
    grid-column: 1 / -1;
}
.single-progress {
    margin-bottom: 14px;
}
.single-queue-top {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    align-items: center;
    margin-bottom: 10px;
}
.single-queue-top h3 {
    margin: 0;
    font-size: 13.5px;
    color: var(--ink);
}
.single-queue-top span {
    color: var(--muted);
    font-size: 12px;
}
.single-task-queue {
    display: grid;
    gap: 8px;
    max-height: 210px;
    overflow: auto;
    margin-bottom: 14px;
}
.single-task-empty {
    border: 1px dashed var(--line-2);
    border-radius: 12px;
    color: var(--muted);
    font-size: 12.5px;
    padding: 14px;
    text-align: center;
    background: var(--surface-2);
}
.single-task-card {
    width: 100%;
    display: grid;
    grid-template-columns: 44px minmax(0, 1fr) auto;
    gap: 10px;
    align-items: center;
    padding: 9px 10px;
    border-radius: 14px;
    border: 1px solid var(--line);
    background: #fff;
    text-align: left;
    box-shadow: none;
}
.single-task-card:hover,
.single-task-card.active {
    border-color: var(--primary);
    background: var(--primary-soft);
}
.single-task-thumb {
    width: 44px;
    height: 44px;
    display: grid;
    place-items: center;
    overflow: hidden;
    border-radius: 12px;
    background: linear-gradient(135deg, #e0f2fe, #eef2ff);
    color: var(--primary-2);
    font-weight: 800;
    font-size: 14px;
}
.single-task-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.single-task-main {
    min-width: 0;
}
.single-task-main b,
.single-task-main small {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.single-task-main b {
    color: var(--ink);
    font-size: 13px;
}
.single-task-main small {
    color: var(--muted);
    font-size: 11.5px;
    margin-top: 2px;
}
.single-task-status {
    padding: 4px 8px;
    border-radius: 999px;
    background: var(--surface-3);
    color: var(--muted);
    font-size: 11.5px;
    font-weight: 700;
}
.single-task-status.generating_images,
.single-task-status.pending {
    background: var(--info-soft);
    color: #0369a1;
}
.single-task-status.done {
    background: var(--success-soft);
    color: #047857;
}
.single-task-status.error {
    background: var(--danger-soft);
    color: #b91c1c;
}
.single-result-box {
    min-height: 430px;
    border: 1px dashed var(--line-2);
    border-radius: 18px;
    background:
        linear-gradient(135deg, rgba(37,99,235,.04), transparent 38%),
        var(--surface-2);
    display: grid;
    place-items: center;
    overflow: hidden;
}
.single-selected-result {
    width: 100%;
}
.single-result-meta {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    align-items: center;
    padding: 12px 16px 0;
}
.single-result-meta b {
    color: var(--ink);
    font-size: 14px;
}
.single-result-meta span {
    color: var(--muted);
    font-size: 12px;
}
.single-result-box .empty-state {
    min-height: 360px;
    box-shadow: none;
    background: transparent;
    border: 0;
}
.single-image-preview {
    width: 100%;
    padding: 18px;
    display: grid;
    place-items: center;
}
.single-image-preview img {
    max-width: 100%;
    max-height: 640px;
    object-fit: contain;
    border-radius: 16px;
    border: 1px solid var(--line);
    box-shadow: var(--shadow-lg);
    background: #fff;
}
.single-waiting,
.single-error-box {
    width: min(420px, calc(100% - 32px));
    min-height: 220px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    text-align: center;
    color: var(--muted);
}
.single-waiting b,
.single-error-box b {
    color: var(--ink);
    font-size: 18px;
}
.single-error-box {
    border: 1px solid rgba(239,68,68,.18);
    background: var(--danger-soft);
    border-radius: 16px;
    padding: 22px;
}
.single-error-box b {
    color: #991b1b;
}
.single-error-box span {
    color: #7f1d1d;
    font-size: 13px;
    line-height: 1.6;
}
.single-spinner {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    border: 4px solid rgba(37,99,235,.14);
    border-top-color: var(--primary);
    animation: spin 1s linear infinite;
}
@keyframes spin {
    to { transform: rotate(360deg); }
}
.single-log-panel {
    margin-top: 14px;
}
.single-history-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 10px;
    max-height: 320px;
    overflow: auto;
}
.single-history-item {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 7px 10px;
    align-items: center;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: #fff;
    text-align: left;
    box-shadow: none;
}
.single-history-item:hover {
    border-color: var(--primary);
    background: var(--primary-soft);
}
.single-history-item span {
    min-width: 0;
}
.single-history-item b,
.single-history-item small {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.single-history-item b {
    color: var(--ink);
    font-size: 13px;
}
.single-history-item small {
    color: var(--muted);
    font-size: 11.5px;
    font-style: normal;
}
.single-history-item em {
    justify-self: end;
    padding: 3px 8px;
    border-radius: 999px;
    background: var(--surface-3);
    color: var(--muted);
    font-size: 11px;
    font-style: normal;
    font-weight: 700;
}
.single-history-item em.done {
    background: var(--success-soft);
    color: #047857;
}
.single-history-item em.error {
    background: var(--danger-soft);
    color: #b91c1c;
}
.single-history-item em.generating_images,
.single-history-item em.pending {
    background: var(--info-soft);
    color: #0369a1;
}

/* =====================================================================
   抄图模式页
   ===================================================================== */
.copy-workbench-shell {
    width: min(1880px, calc(100vw - 28px));
}
.copy-hero {
    grid-template-columns: minmax(0, 1fr) 430px;
}
.copy-hero .hero-main {
    background:
        radial-gradient(circle at 92% 20%, rgba(245,158,11,.16), transparent 28%),
        radial-gradient(circle at 72% 100%, rgba(37,99,235,.12), transparent 34%),
        #fff;
}
.copy-workbench-grid {
    display: grid;
    grid-template-columns: minmax(330px, .82fr) minmax(420px, 1fr) minmax(520px, 1.08fr);
    gap: 16px;
    align-items: start;
}
.copy-history-panel {
    grid-column: 1 / -1;
}
.copy-assets-body {
    display: grid;
    gap: 14px;
}
.copy-upload-card {
    border: 1px solid var(--line);
    border-radius: 18px;
    background: linear-gradient(180deg, #fff, #f8fafc);
    padding: 14px;
}
.copy-upload-title {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    align-items: center;
    margin-bottom: 10px;
}
.copy-upload-title b {
    color: var(--ink);
    font-size: 14px;
}
.copy-upload-title small {
    color: var(--muted);
    font-size: 11.5px;
    text-align: right;
}
.copy-upload-tools {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    flex-wrap: wrap;
}
.copy-paste-btn {
    min-height: 30px;
    border: 1px solid rgba(37,99,235,.28);
    border-radius: 999px;
    padding: 6px 11px;
    background: #eff6ff;
    color: #1d4ed8;
    font-size: 12px;
    font-weight: 700;
    line-height: 1;
    cursor: pointer;
    transition: background .15s, border-color .15s, color .15s, opacity .15s;
}
.copy-paste-btn:hover {
    background: #dbeafe;
    border-color: rgba(37,99,235,.42);
    color: #1e40af;
}
.copy-paste-btn:disabled {
    cursor: wait;
    opacity: .65;
}
.copy-upload-area {
    min-height: 155px;
    border-style: solid;
    background:
        linear-gradient(135deg, rgba(37,99,235,.05), transparent 45%),
        #fff;
}
.copy-upload-area.paste-target {
    border-color: rgba(37,99,235,.72);
    box-shadow: 0 0 0 3px rgba(37,99,235,.12);
}
.copy-upload-area.product {
    background:
        linear-gradient(135deg, rgba(16,185,129,.08), transparent 45%),
        #fff;
}
.copy-upload-area.product.paste-target {
    border-color: rgba(16,185,129,.72);
    box-shadow: 0 0 0 3px rgba(16,185,129,.12);
}
.copy-preview {
    margin-top: 12px;
}
.copy-ref-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 10px;
}
.copy-ref-toolbar span {
    color: var(--muted);
    font-size: 12px;
}
.copy-ref-toolbar button {
    padding: 5px 10px;
    border-radius: 8px;
    border: 1px solid var(--line);
    background: #fff;
    color: var(--muted);
    font-size: 12px;
}
.copy-ref-strip {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(92px, 1fr));
    gap: 10px;
}
.copy-ref-item {
    position: relative;
    overflow: hidden;
    border-radius: 14px;
    border: 1px solid var(--line);
    background: var(--surface-2);
}
.copy-ref-item.large {
    grid-column: 1 / -1;
}
.copy-ref-item img {
    width: 100%;
    aspect-ratio: 1;
    object-fit: cover;
    display: block;
}
.copy-ref-item.large img {
    aspect-ratio: 16 / 10;
}
.copy-ref-item span {
    position: absolute;
    left: 8px;
    bottom: 8px;
    padding: 3px 8px;
    border-radius: 999px;
    background: rgba(15,23,42,.72);
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    backdrop-filter: blur(8px);
}
.copy-ref-item button {
    position: absolute;
    top: 7px;
    right: 7px;
    width: 24px;
    height: 24px;
    padding: 0;
    display: grid;
    place-items: center;
    border-radius: 999px;
    background: var(--danger);
    color: #fff;
    border: 2px solid #fff;
    font-size: 16px;
    line-height: 1;
    box-shadow: var(--shadow-sm);
}
.copy-kind-row {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
}
.copy-kind-row label {
    display: flex;
    align-items: center;
    gap: 8px;
    min-height: 42px;
    padding: 9px 10px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: #fff;
    color: var(--ink-2);
    font-size: 12.5px;
    font-weight: 700;
    cursor: pointer;
}
.copy-kind-row input {
    accent-color: var(--primary);
}
.copy-kind-row label:has(input:checked) {
    border-color: var(--primary);
    background: var(--primary-soft);
    color: var(--primary-2);
}
.copy-options-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}
.copy-text-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}
.copy-preview-card {
    border: 1px solid var(--line);
    border-radius: 16px;
    background: linear-gradient(180deg, #fff, #f8fafc);
    padding: 12px;
    margin-bottom: 12px;
}
.copy-preview-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 10px;
}
.copy-preview-top b {
    color: var(--ink);
    font-size: 13.5px;
}
#copyPromptPreview {
    min-height: 300px;
    resize: vertical;
    line-height: 1.6;
}
.copy-submit-actions {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 10px;
    align-items: center;
    margin: 10px 0 16px;
}
.copy-queue-top {
    padding-top: 12px;
    border-top: 1px solid var(--line);
}
.copy-task-queue {
    max-height: 170px;
}
.copy-result-box {
    min-height: 500px;
}
.copy-history-list {
    max-height: 260px;
}

@media (max-width: 1280px) {
    .single-grid {
        grid-template-columns: 1fr 1fr;
    }
    .single-result-panel {
        grid-column: 1 / -1;
    }
    .copy-workbench-grid {
        grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    }
    .copy-command-panel,
    .copy-history-panel {
        grid-column: 1 / -1;
    }
}
@media (max-width: 820px) {
    .single-grid {
        grid-template-columns: 1fr;
    }
    .single-kind-group {
        grid-template-columns: 1fr;
    }
    .retry-prompt-panel {
        flex-direction: column;
        align-items: flex-start;
    }
    .copy-hero,
    .copy-workbench-grid,
    .copy-options-grid,
    .copy-text-grid,
    .copy-kind-row,
    .copy-submit-actions {
        grid-template-columns: 1fr;
    }
}

/* =====================================================================
   复刻竞品页
   ===================================================================== */
.new-copy-shell {
    width: min(1880px, calc(100vw - 28px));
}
.new-copy-hero {
    grid-template-columns: minmax(0, 1fr) 420px;
}
.new-copy-hero .hero-main {
    background:
        radial-gradient(circle at 90% 20%, rgba(16,185,129,.14), transparent 30%),
        radial-gradient(circle at 72% 100%, rgba(37,99,235,.12), transparent 34%),
        #fff;
}
.new-copy-grid {
    display: grid;
    grid-template-columns: minmax(360px, .84fr) minmax(420px, .9fr) minmax(620px, 1.3fr);
    gap: 16px;
    align-items: start;
}
.new-copy-panel .panel-body {
    min-height: 0;
}
.new-copy-assets {
    display: grid;
    gap: 14px;
}
.new-copy-upload-card {
    border: 1px solid var(--line);
    border-radius: 16px;
    background: linear-gradient(180deg, #fff, #f8fafc);
    padding: 14px;
}
.new-copy-upload-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    margin-bottom: 10px;
}
.new-copy-upload-head label {
    margin: 0;
    color: var(--ink);
    font-size: 14px;
    font-weight: 800;
}
.new-copy-upload-head span,
.new-copy-field-note {
    color: var(--muted);
    font-size: 12px;
    font-weight: 500;
}
.new-copy-field-note {
    margin: -4px 0 10px;
    line-height: 1.5;
}
.new-copy-upload-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
    padding: 2px;
    border-radius: 14px;
}
.new-copy-upload-grid.paste-target {
    box-shadow: 0 0 0 3px rgba(37,99,235,.12);
}
.new-copy-upload-grid.dragover {
    background: rgba(37,99,235,.06);
}
.new-copy-thumb,
.new-copy-upload-tile {
    position: relative;
    min-height: 92px;
    border-radius: 14px;
    border: 1px solid var(--line);
    overflow: hidden;
    background: #fff;
}
.new-copy-thumb img {
    width: 100%;
    height: 92px;
    object-fit: contain;
    display: block;
    background: var(--surface-2);
}
.new-copy-thumb button {
    position: absolute;
    top: 6px;
    right: 6px;
    width: 22px;
    height: 22px;
    padding: 0;
    border: 2px solid #fff;
    border-radius: 999px;
    display: grid;
    place-items: center;
    background: var(--danger);
    color: #fff;
    font-size: 15px;
    line-height: 1;
    cursor: pointer;
}
.new-copy-thumb span {
    position: absolute;
    left: 6px;
    bottom: 6px;
    padding: 3px 7px;
    border-radius: 999px;
    background: rgba(15,23,42,.72);
    color: #fff;
    font-size: 11px;
    font-weight: 800;
}
.new-copy-upload-tile {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    cursor: pointer;
    color: var(--muted);
    border-style: dashed;
    background:
        linear-gradient(135deg, rgba(37,99,235,.06), transparent 50%),
        #fff;
    text-align: center;
}
.new-copy-upload-tile b {
    width: 30px;
    height: 30px;
    border-radius: 999px;
    display: grid;
    place-items: center;
    background: var(--primary-soft);
    color: var(--primary);
    font-size: 22px;
    line-height: 1;
}
.new-copy-upload-tile span {
    color: var(--ink-2);
    font-size: 12px;
    font-weight: 800;
}
.new-copy-upload-tile small {
    color: var(--muted);
    font-size: 11px;
}
.new-copy-form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}
.new-copy-submit-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 10px;
    align-items: center;
}
.new-copy-status {
    margin: 12px 0 0;
    min-height: 20px;
    color: var(--muted);
    font-size: 13px;
}
.new-copy-results-panel {
    min-height: 620px;
}
.new-copy-history-panel {
    grid-column: 1 / -1;
}
.new-copy-result-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 14px;
}
.new-copy-result-grid > .empty-state {
    grid-column: 1 / -1;
}
.new-copy-result-card {
    border: 1px solid var(--line);
    border-radius: 16px;
    background: #fff;
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}
.new-copy-result-card.error {
    border-color: rgba(239,68,68,.35);
}
.new-copy-card-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 11px 12px;
    border-bottom: 1px solid var(--line);
}
.new-copy-card-head span {
    color: var(--ink);
    font-size: 13px;
    font-weight: 900;
}
.new-copy-card-head em {
    padding: 3px 8px;
    border-radius: 999px;
    background: var(--info-soft);
    color: #0369a1;
    font-size: 11px;
    font-style: normal;
    font-weight: 800;
}
.new-copy-card-head em.done {
    background: var(--success-soft);
    color: #047857;
}
.new-copy-card-head em.error {
    background: var(--danger-soft);
    color: #b91c1c;
}
.new-copy-pair {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1px;
    background: var(--line);
}
.new-copy-pair img,
.new-copy-single-ref {
    width: 100%;
    aspect-ratio: 1;
    object-fit: contain;
    display: block;
    background: var(--surface-2);
}
.new-copy-card-meta {
    padding: 9px 12px 0;
    color: var(--muted);
    font-size: 12px;
}
.new-copy-result-card .result-links {
    padding: 10px 12px 12px;
}
.new-copy-result-card p {
    margin: 10px 12px;
    color: #b91c1c;
    font-size: 13px;
    line-height: 1.5;
}
.new-copy-result-card > button {
    margin: 0 12px 12px;
}
.new-copy-result-card .link-btn {
    border: 1px solid var(--line);
    cursor: pointer;
}
.new-copy-history-list {
    display: grid;
    gap: 10px;
    max-height: 320px;
    overflow: auto;
}
.new-copy-history-list > .mini-note {
    grid-column: 1 / -1;
}
.new-copy-history-subtitle {
    color: var(--muted);
    font-size: 12px;
    font-weight: 900;
    letter-spacing: .02em;
}
.new-copy-batch-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 10px;
}
.new-copy-batch-item {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 10px;
    align-items: center;
    padding: 13px 14px;
    border: 1px solid rgba(37,99,235,.22);
    border-radius: 14px;
    background: linear-gradient(180deg, #eff6ff, #fff);
    text-align: left;
    cursor: pointer;
}
.new-copy-batch-item:hover {
    border-color: rgba(37,99,235,.45);
    background: #eef6ff;
}
.new-copy-batch-item span {
    min-width: 0;
}
.new-copy-batch-item b,
.new-copy-batch-item small {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.new-copy-batch-item b {
    color: var(--primary-2);
    font-size: 13.5px;
    font-weight: 900;
}
.new-copy-batch-item small {
    color: var(--muted);
    font-size: 12px;
}
.new-copy-batch-item em {
    padding: 4px 9px;
    border-radius: 999px;
    background: var(--primary);
    color: #fff;
    font-size: 11px;
    font-style: normal;
    font-weight: 900;
}
.new-copy-history-item {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px;
    align-items: center;
    padding: 11px 12px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: #fff;
    text-align: left;
    cursor: pointer;
}
.new-copy-history-item:hover {
    border-color: rgba(37,99,235,.35);
    background: #f8fbff;
}
.new-copy-history-item span {
    min-width: 0;
}
.new-copy-history-item b,
.new-copy-history-item small {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.new-copy-history-item b {
    color: var(--ink);
    font-size: 13px;
}
.new-copy-history-item small {
    color: var(--muted);
    font-size: 11.5px;
}
.new-copy-history-item > small {
    grid-column: 1 / -1;
}
.new-copy-history-item em {
    padding: 3px 8px;
    border-radius: 999px;
    background: var(--info-soft);
    color: #0369a1;
    font-size: 11px;
    font-style: normal;
    font-weight: 800;
}
.new-copy-history-item em.done {
    background: var(--success-soft);
    color: #047857;
}
.new-copy-history-item em.error {
    background: var(--danger-soft);
    color: #b91c1c;
}
.new-copy-modal.hidden {
    display: none;
}
.new-copy-modal {
    position: fixed;
    inset: 0;
    z-index: 1200;
    display: grid;
    place-items: center;
}
.new-copy-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(15,23,42,.78);
    backdrop-filter: blur(6px);
}
.new-copy-modal-card {
    position: relative;
    width: min(80vw, 1480px);
    max-height: 88vh;
    border: 1px solid rgba(255,255,255,.18);
    border-radius: 16px;
    background: #fff;
    box-shadow: 0 24px 80px rgba(15,23,42,.35);
    overflow: hidden;
}
.new-copy-modal-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 14px;
    border-bottom: 1px solid var(--line);
}
.new-copy-modal-head strong {
    color: var(--ink);
    font-size: 14px;
}
.new-copy-modal-head button {
    width: 30px;
    height: 30px;
    padding: 0;
    border: 1px solid var(--line);
    border-radius: 999px;
    display: grid;
    place-items: center;
    background: #fff;
    color: var(--ink);
    font-size: 20px;
    line-height: 1;
    cursor: pointer;
}
.new-copy-modal-body {
    max-height: calc(88vh - 56px);
    overflow: auto;
    padding: 14px;
    background: #f8fafc;
}
.new-copy-large-wrap {
    display: grid;
    place-items: center;
    min-height: min(70vh, 820px);
}
.new-copy-large-wrap img {
    max-width: 100%;
    max-height: 80vh;
    object-fit: contain;
    display: block;
    background: #fff;
}
.new-copy-compare-wrap {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
    min-height: min(70vh, 820px);
}
.new-copy-compare-wrap figure {
    margin: 0;
    min-width: 0;
    display: grid;
    grid-template-rows: auto minmax(0, 1fr);
    gap: 8px;
}
.new-copy-compare-wrap figcaption {
    color: var(--muted);
    font-size: 13px;
    font-weight: 800;
}
.new-copy-compare-wrap img {
    width: 100%;
    max-height: 76vh;
    object-fit: contain;
    display: block;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 12px;
}
.new-copy-modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    flex-wrap: wrap;
    padding-top: 12px;
}

@media (max-width: 1380px) {
    .new-copy-grid {
        grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    }
    .new-copy-results-panel {
        grid-column: 1 / -1;
    }
}
@media (max-width: 820px) {
    .new-copy-hero,
    .new-copy-grid,
    .new-copy-form-grid,
    .new-copy-submit-row,
    .new-copy-compare-wrap {
        grid-template-columns: 1fr;
    }
    .new-copy-modal-card {
        width: min(94vw, 1480px);
    }
}

/* =====================================================================
   图片编辑器
   ===================================================================== */
.editor-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(15,23,42,.88);
    z-index: 2000;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(6px);
}
.editor-overlay.active { display: flex; }
.editor-panel {
    background: #0b1220;
    border: 1px solid #1e293b;
    border-radius: 16px;
    padding: 16px;
    max-width: 95vw;
    max-height: 95vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 24px 80px rgba(0,0,0,.5);
}
.editor-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}
.editor-toolbar h3 {
    color: #e2e8f0;
    font-size: 14.5px;
    font-weight: 600;
}
.editor-btns { display: flex; gap: 8px; }
.btn-editor {
    padding: 6px 14px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 12.5px;
    font-weight: 600;
    transition: all .15s;
}
.btn-editor.undo { background: rgba(255,255,255,.08); color: #cbd5e1; border: 1px solid rgba(255,255,255,.10); }
.btn-editor.undo:hover { background: rgba(255,255,255,.14); }
.btn-editor.save { background: var(--success); color: #fff; }
.btn-editor.save:hover { background: #059669; }
.btn-editor.close { background: var(--danger); color: #fff; }
.btn-editor.close:hover { background: #dc2626; }
.editor-hint {
    color: #94a3b8;
    font-size: 12px;
    margin-bottom: 8px;
    text-align: center;
}
.editor-canvas-wrap {
    overflow: auto;
    max-height: calc(95vh - 100px);
    cursor: crosshair;
    border: 1px solid #1e293b;
    border-radius: 10px;
    background: #050b18;
}
.editor-canvas-wrap canvas { display: block; }

/* =====================================================================
   工具类
   ===================================================================== */
.hidden { display: none !important; }

/* =====================================================================
   滚动条
   ===================================================================== */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
    background: var(--line-2);
    border-radius: 999px;
    border: 2px solid transparent;
    background-clip: padding-box;
}
::-webkit-scrollbar-thumb:hover {
    background: var(--muted-2);
    background-clip: padding-box;
    border: 2px solid transparent;
}

/* =====================================================================
   响应式
   ===================================================================== */
@media (max-width: 1280px) {
    .app-grid { grid-template-columns: 1fr 1fr; }
    .app-grid > .side-stack { grid-column: 1 / -1; grid-template-columns: repeat(2, 1fr); }
    .layout { grid-template-columns: 360px minmax(0,1fr); }
    .layout > .side-stack { grid-column: 1 / -1; grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 1024px) {
    .hero { grid-template-columns: 1fr; }
    .pipeline { grid-template-columns: 1fr; }
}
@media (max-width: 820px) {
    .page-shell { width: calc(100vw - 20px); padding-top: 14px; }
    .app-grid, .layout {
        grid-template-columns: 1fr;
    }
    .app-grid > .side-stack, .layout > .side-stack {
        grid-template-columns: 1fr;
    }
    .hero h1 { font-size: 22px; }
    .hero-main { padding: 20px; }
    .form-grid, .shot-meta { grid-template-columns: 1fr; }
    .nav-links { gap: 0; }
    .nav-link { padding: 0 10px; font-size: 12.5px; }
    .header { padding: 0 14px; }
    .mode-strip { grid-template-columns: 1fr 1fr; }
}

/* =====================================================================
   图片编辑：Fabric.js 五层编辑器
   ===================================================================== */
.image-editor-shell {
    width: min(1640px, calc(100vw - 32px));
}

.image-editor-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 380px;
    gap: 16px;
    align-items: start;
}

.image-editor-stage-panel,
.image-editor-control-panel,
.image-editor-output-panel {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    overflow: hidden;
}

.image-editor-toolbar {
    align-items: center;
}

.image-editor-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: flex-end;
}

.image-editor-canvas-wrap {
    min-height: 560px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background:
        linear-gradient(45deg, #e2e8f0 25%, transparent 25%),
        linear-gradient(-45deg, #e2e8f0 25%, transparent 25%),
        linear-gradient(45deg, transparent 75%, #e2e8f0 75%),
        linear-gradient(-45deg, transparent 75%, #e2e8f0 75%);
    background-size: 28px 28px;
    background-position: 0 0, 0 14px, 14px -14px, -14px 0;
    display: grid;
    place-items: center;
    padding: 18px;
    overflow: auto;
}

.image-editor-canvas-wrap.dragging {
    outline: 2px solid var(--primary);
    outline-offset: 3px;
}

#imageEditorCanvas,
.image-editor-canvas-wrap .canvas-container {
    max-width: 100%;
    max-height: 72vh;
}

.image-editor-canvas-wrap .canvas-container {
    border-radius: 10px;
    box-shadow: 0 16px 48px rgba(15, 23, 42, .18);
    background: #fff;
}

#imageEditorCanvas {
    display: block;
    cursor: move;
}

.image-editor-layer-strip {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 10px;
    margin-top: 14px;
}

.image-editor-layer-card {
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    background: var(--surface-2);
    padding: 8px;
    display: grid;
    gap: 7px;
    cursor: pointer;
    transition: border-color .15s, box-shadow .15s, transform .15s;
}

.image-editor-layer-card:hover,
.image-editor-layer-card.active {
    border-color: rgba(37, 99, 235, .72);
    box-shadow: 0 8px 20px rgba(37, 99, 235, .14);
}

.image-editor-layer-card.active {
    transform: translateY(-1px);
}

.image-editor-layer-card.muted {
    opacity: .48;
}

.image-editor-thumb {
    width: 100%;
    aspect-ratio: 120 / 86;
    border: 1px solid var(--line-2);
    border-radius: 6px;
    background: #fff;
    display: grid;
    place-items: center;
    overflow: hidden;
}

.image-editor-thumb img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.image-editor-thumb b {
    padding: 0 6px;
    font-size: 13px;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.image-editor-thumb i {
    display: block;
    width: 100%;
    height: 100%;
}

.image-editor-layer-card span {
    font-size: 12px;
    font-weight: 800;
    color: var(--ink-2);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.image-editor-controls {
    max-height: calc(100vh - 210px);
    overflow: auto;
}

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

.editor-field,
.editor-toggle {
    display: grid;
    gap: 6px;
    color: var(--muted);
    font-size: 12px;
    font-weight: 800;
}

.editor-toggle {
    grid-column: 1 / -1;
    grid-template-columns: auto 1fr;
    align-items: center;
    color: var(--ink-2);
    font-size: 13px;
}

.editor-field-wide {
    grid-column: 1 / -1;
}

.editor-field input,
.editor-field select,
.editor-field textarea {
    width: 100%;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    color: var(--ink);
    padding: 9px 10px;
    font-size: 13px;
    outline: none;
}

.editor-field input[type="color"] {
    height: 38px;
    padding: 4px;
}

.editor-field input[type="range"] {
    padding: 0;
}

.editor-field textarea {
    min-height: 92px;
    resize: vertical;
}

.editor-inline-button {
    align-self: end;
    min-height: 38px;
}

.image-editor-apply {
    display: grid;
    gap: 10px;
    padding: 16px;
    border-top: 1px solid var(--line);
    background: var(--surface-2);
}

.image-editor-output-panel {
    margin-top: 16px;
}

.image-editor-merged-preview {
    display: none;
    width: min(520px, 100%);
    max-height: 520px;
    object-fit: contain;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: #fff;
}

.image-editor-merged-preview.visible {
    display: block;
}

@media (max-width: 1180px) {
    .image-editor-grid {
        grid-template-columns: 1fr;
    }

    .image-editor-controls {
        max-height: none;
    }
}

@media (max-width: 760px) {
    .image-editor-actions,
    .image-editor-toolbar {
        align-items: stretch;
        flex-direction: column;
    }

    .image-editor-layer-strip {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .editor-control-grid {
        grid-template-columns: 1fr;
    }
}

/* 文字编辑 */
.text-editor-shell {
    display: grid;
    gap: 18px;
}

.text-editor-hero .hero-main::after {
    background:
        radial-gradient(circle, rgba(14, 165, 233, .16), transparent 70%);
}

.text-editor-layout {
    display: grid;
    grid-template-columns: minmax(300px, 360px) minmax(0, 1fr);
    gap: 16px;
}

.text-editor-source-panel,
.text-editor-workspace-panel {
    min-width: 0;
}

.text-editor-preview-wrap {
    display: grid;
    place-items: center;
    min-height: 240px;
    border: 1px dashed var(--line);
    border-radius: 8px;
    background: #fff;
    overflow: hidden;
}

.text-editor-preview-wrap img {
    display: block;
    max-width: 100%;
    max-height: 420px;
    object-fit: contain;
}

.text-editor-actions {
    display: grid;
    gap: 10px;
    margin-top: 14px;
}

.text-editor-actions a {
    display: grid;
    place-items: center;
    text-decoration: none;
}

.text-editor-switch,
.mini-paint-toolbar,
.text-editor-fallback-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}

.text-editor-switch .active {
    border-color: var(--primary);
    color: var(--primary);
}

.text-editor-body {
    min-height: 660px;
}

.text-editor-tool-panel,
.filerobot-container,
.text-editor-fallback,
.mini-paint-toolbar + iframe {
    min-height: 640px;
}

.filerobot-container {
    width: 100%;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    overflow: hidden;
}

.text-editor-fallback {
    display: grid;
    grid-template-rows: auto minmax(0, 1fr);
    gap: 12px;
}

.text-editor-fallback-toolbar {
    padding: 10px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface-2);
}

.text-editor-fallback-toolbar input,
.text-editor-fallback-toolbar select {
    height: 34px;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: #fff;
    color: var(--ink);
    padding: 0 9px;
}

.text-editor-fallback-toolbar input[type="text"] {
    min-width: 220px;
}

.text-editor-fallback-toolbar input[type="number"] {
    width: 82px;
}

.text-editor-canvas-wrap {
    overflow: auto;
    border: 1px solid var(--line);
    border-radius: 8px;
    background:
        linear-gradient(45deg, #f8fafc 25%, transparent 25%),
        linear-gradient(-45deg, #f8fafc 25%, transparent 25%),
        linear-gradient(45deg, transparent 75%, #f8fafc 75%),
        linear-gradient(-45deg, transparent 75%, #f8fafc 75%);
    background-position: 0 0, 0 10px, 10px -10px, -10px 0;
    background-size: 20px 20px;
}

.text-editor-canvas-wrap canvas {
    display: block;
    max-width: none;
}

.mini-paint-toolbar {
    margin-bottom: 10px;
}

.mini-paint-toolbar a {
    text-decoration: none;
}

#miniPaintFrame {
    width: 100%;
    height: 680px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
}

@media (max-width: 1180px) {
    .text-editor-layout {
        grid-template-columns: 1fr;
    }

    .text-editor-body {
        min-height: 560px;
    }
}

/* AI对话生图 */
.chat-image-shell {
    display: grid;
    grid-template-columns: 260px minmax(0, 1fr);
    gap: 16px;
    min-height: calc(100vh - 72px);
    padding: 16px;
    background: var(--surface-2);
}

.chat-sidebar,
.chat-thread-panel {
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    box-shadow: var(--shadow);
}

.chat-sidebar {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 12px;
    overflow: hidden;
}

.chat-new-btn {
    width: 100%;
}

.chat-list {
    display: grid;
    gap: 8px;
    overflow: auto;
}

.chat-list-item {
    display: grid;
    gap: 5px;
    width: 100%;
    border: 1px solid transparent;
    border-radius: 8px;
    background: transparent;
    color: var(--ink);
    padding: 10px;
    text-align: left;
    cursor: pointer;
}

.chat-list-item:hover,
.chat-list-item.active {
    border-color: var(--line);
    background: var(--surface-2);
}

.chat-list-item b,
.chat-list-item span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.chat-list-item span {
    color: var(--muted);
    font-size: 12px;
}

.chat-thread-panel {
    display: grid;
    grid-template-rows: auto minmax(320px, 1fr) auto;
    min-width: 0;
    overflow: hidden;
}

.chat-thread-head {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    align-items: center;
    padding: 18px 20px;
    border-bottom: 1px solid var(--line);
}

.chat-thread-head h1 {
    margin: 4px 0 0;
    font-size: 22px;
}

.chat-settings {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: flex-end;
}

.chat-settings select,
.chat-input-row input,
.chat-composer textarea {
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    color: var(--ink);
    font-size: 14px;
    outline: none;
}

.chat-settings select {
    min-width: 180px;
    padding: 10px 12px;
}

.chat-messages {
    display: flex;
    flex-direction: column;
    gap: 18px;
    overflow: auto;
    padding: 24px min(7vw, 76px);
}

.chat-empty {
    display: grid;
    gap: 8px;
    margin: auto;
    max-width: 420px;
    color: var(--muted);
    text-align: center;
}

.chat-empty b {
    color: var(--ink);
    font-size: 18px;
}

.chat-message {
    display: grid;
    grid-template-columns: 34px minmax(0, 760px);
    gap: 12px;
    align-items: start;
}

.chat-message.user {
    grid-template-columns: minmax(0, 760px) 34px;
    justify-content: end;
}

.chat-message.user .chat-avatar {
    grid-column: 2;
}

.chat-message.user .chat-bubble {
    grid-column: 1;
    grid-row: 1;
    background: #eef4ff;
}

.chat-avatar {
    display: grid;
    place-items: center;
    width: 34px;
    height: 34px;
    border-radius: 8px;
    background: var(--ink);
    color: #fff;
    font-size: 13px;
    font-weight: 700;
}

.chat-bubble {
    display: grid;
    gap: 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    padding: 14px;
}

.chat-text {
    white-space: pre-wrap;
    line-height: 1.7;
}

.chat-image-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 12px;
}

.chat-image-grid figure {
    display: grid;
    gap: 8px;
    margin: 0;
}

.chat-image-grid img {
    width: 100%;
    aspect-ratio: 1 / 1;
    object-fit: contain;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
}

.chat-image-grid figcaption {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.chat-image-grid a,
.chat-image-grid button,
.btn-chat-add {
    border: 1px solid var(--line);
    border-radius: 6px;
    background: #fff;
    color: var(--ink);
    padding: 7px 10px;
    font-size: 12px;
    text-decoration: none;
    cursor: pointer;
}

.chat-running,
.chat-error {
    color: var(--muted);
    font-size: 13px;
}

.chat-running {
    display: flex;
    gap: 8px;
    align-items: center;
}

.chat-running span {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--primary);
    animation: pulse 1s infinite ease-in-out;
}

.chat-error {
    color: var(--danger);
}

.chat-composer {
    display: grid;
    gap: 10px;
    padding: 14px 20px 18px;
    border-top: 1px solid var(--line);
    background: #fff;
}

.chat-ref-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    min-height: 34px;
    align-items: center;
}

.chat-ref-empty {
    color: var(--muted);
    font-size: 13px;
}

.chat-ref-chip {
    position: relative;
    width: 54px;
    height: 54px;
    border: 1px solid var(--line);
    border-radius: 8px;
    overflow: hidden;
    background: #fff;
}

.chat-ref-chip img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.chat-ref-chip button {
    position: absolute;
    top: 3px;
    right: 3px;
    display: grid;
    place-items: center;
    width: 20px;
    height: 20px;
    border: 0;
    border-radius: 50%;
    background: rgba(15, 23, 42, .78);
    color: #fff;
    cursor: pointer;
}

.chat-input-row {
    display: grid;
    grid-template-columns: auto minmax(160px, 1fr) auto;
    gap: 10px;
}

.chat-upload-btn {
    display: grid;
    place-items: center;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface-2);
    color: var(--ink);
    padding: 0 14px;
    font-size: 13px;
    cursor: pointer;
}

.chat-upload-btn input {
    display: none;
}

.chat-input-row input {
    min-height: 40px;
    padding: 0 12px;
}

.chat-input-row .btn-secondary {
    min-height: 40px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface-2);
    color: var(--ink);
    padding: 0 14px;
    cursor: pointer;
}

.chat-composer textarea {
    width: 100%;
    min-height: 84px;
    max-height: 180px;
    padding: 12px;
    resize: vertical;
}

.chat-composer-foot {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    align-items: center;
}

.chat-composer-foot span {
    color: var(--muted);
    font-size: 13px;
}

@keyframes pulse {
    0%, 100% { opacity: .35; transform: scale(.9); }
    50% { opacity: 1; transform: scale(1.15); }
}

@media (max-width: 980px) {
    .chat-image-shell {
        grid-template-columns: 1fr;
    }

    .chat-sidebar {
        max-height: 220px;
    }

    .chat-thread-head {
        align-items: stretch;
        flex-direction: column;
    }

    .chat-settings {
        justify-content: stretch;
    }

    .chat-settings select {
        flex: 1;
        min-width: 160px;
    }
}

@media (max-width: 640px) {
    .chat-image-shell {
        padding: 10px;
    }

    .chat-messages {
        padding: 16px 12px;
    }

    .chat-message,
    .chat-message.user {
        grid-template-columns: 1fr;
    }

    .chat-avatar,
    .chat-message.user .chat-avatar,
    .chat-message.user .chat-bubble {
        grid-column: auto;
        grid-row: auto;
    }

    .chat-input-row,
    .chat-composer-foot {
        grid-template-columns: 1fr;
        flex-direction: column;
        align-items: stretch;
    }
}

/* =====================================================================
   HappyHorse 视频生成页
   ===================================================================== */

.video-gen-shell {
    max-width: 1480px;
}

.video-gen-hero {
    align-items: stretch;
    display: grid;
    gap: 18px;
    grid-template-columns: minmax(0, 1fr) 320px;
}

.video-gen-hero .hero-main p,
.video-gen-hero .hero-side span {
    color: var(--muted);
    display: block;
    line-height: 1.7;
}

.video-gen-hero .hero-side {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 8px;
    padding: 18px;
}

.video-gen-hero .hero-side strong {
    color: var(--ink);
    font-size: 16px;
}

.video-gen-grid {
    display: grid;
    gap: 18px;
    grid-template-columns: minmax(0, 1fr) 430px;
}

.video-gen-control,
.video-guide-panel {
    grid-column: 1;
}

.video-gen-result-panel {
    align-self: start;
    grid-column: 2;
    grid-row: 1 / span 4;
    position: sticky;
    top: 72px;
}

.video-mode-tabs {
    background: var(--surface-3);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    display: grid;
    gap: 6px;
    grid-template-columns: repeat(2, 1fr);
    padding: 6px;
}

.video-mode-tabs button,
.video-mode-card,
.video-drop-zone,
.video-asset-item button {
    transition: border-color .18s ease, background .18s ease, box-shadow .18s ease, color .18s ease;
}

.video-mode-tabs button {
    background: transparent;
    border: 0;
    border-radius: 9px;
    color: var(--muted);
    cursor: pointer;
    font-weight: 700;
    min-height: 38px;
}

.video-mode-tabs button.active {
    background: var(--surface);
    box-shadow: var(--shadow-sm);
    color: var(--primary);
}

.video-mode-grid {
    display: grid;
    gap: 12px;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    margin-top: 14px;
}

.video-mode-card {
    align-items: flex-start;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    color: var(--ink);
    cursor: pointer;
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-height: 96px;
    padding: 14px;
    text-align: left;
}

.video-mode-card span {
    color: var(--muted);
    font-size: 13px;
    line-height: 1.6;
}

.video-mode-card.active,
.video-upload-card.is-required {
    background: var(--primary-soft);
    border-color: rgba(37, 99, 235, .42);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, .08);
}

.video-asset-layout {
    display: grid;
    gap: 16px;
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.video-upload-card {
    background: var(--surface-2);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 14px;
}

.video-upload-head {
    align-items: center;
    display: flex;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 10px;
}

.video-upload-head label {
    color: var(--ink);
    font-weight: 800;
}

.video-drop-zone {
    align-items: center;
    background: var(--surface);
    border: 1px dashed var(--line-2);
    border-radius: var(--radius);
    cursor: pointer;
    display: flex;
    flex-direction: column;
    gap: 6px;
    justify-content: center;
    min-height: 126px;
    padding: 18px;
    text-align: center;
}

.video-drop-zone:hover,
.video-drop-zone.dragover {
    border-color: var(--primary);
    color: var(--primary);
}

.video-drop-zone span {
    color: var(--muted);
    font-size: 13px;
    line-height: 1.6;
}

.video-asset-list {
    display: grid;
    gap: 10px;
    margin-top: 12px;
}

.video-asset-item {
    align-items: center;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    display: grid;
    gap: 10px;
    grid-template-columns: 54px minmax(0, 1fr) 26px;
    padding: 8px;
}

.video-asset-item img,
.video-asset-item video {
    background: var(--surface-3);
    border-radius: 6px;
    height: 46px;
    object-fit: cover;
    width: 54px;
}

.video-asset-item b {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.video-asset-item small,
.mini-note {
    color: var(--muted);
    font-size: 12px;
}

.asset-ref-badge {
    background: var(--primary-soft);
    border: 1px solid rgba(37, 99, 235, .18);
    border-radius: 999px;
    color: var(--primary);
    display: inline-flex;
    font-weight: 800;
    margin-right: 6px;
    padding: 1px 6px;
}

.video-asset-item button {
    align-items: center;
    background: var(--danger-soft);
    border: 1px solid rgba(239, 68, 68, .18);
    border-radius: 50%;
    color: var(--danger);
    cursor: pointer;
    display: grid;
    font-size: 18px;
    height: 26px;
    line-height: 1;
    place-items: center;
    width: 26px;
}

.video-param-grid {
    display: grid;
    gap: 12px;
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

.video-builder-grid {
    display: grid;
    gap: 12px;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    margin-top: 12px;
}

.video-mode-hint,
.video-param-grid small,
.video-tool-row span,
.video-reference-map p {
    color: var(--muted);
    font-size: 13px;
    line-height: 1.6;
}

.video-mode-hint {
    margin-top: 8px;
}

.form-group.is-muted {
    opacity: .58;
}

.form-group.is-muted select {
    cursor: not-allowed;
}

.video-reference-map {
    background: var(--surface-2);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    margin: 12px 0;
    padding: 12px;
}

.video-reference-title {
    color: var(--ink);
    font-weight: 800;
    margin-bottom: 8px;
}

.video-reference-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.video-reference-chips span {
    align-items: center;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 999px;
    color: var(--muted);
    display: inline-flex;
    gap: 6px;
    max-width: 100%;
    padding: 6px 10px;
}

.video-reference-chips b {
    color: var(--primary);
}

.video-tool-row,
.video-check-row {
    align-items: center;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.video-tool-row {
    margin: 12px 0 14px;
}

.video-check-row {
    color: var(--muted);
    font-weight: 700;
    margin-top: 12px;
}

.video-check-row input {
    height: 16px;
    width: 16px;
}

.video-submit-row {
    align-items: center;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 14px;
}

.video-gen-status {
    color: var(--muted);
    font-size: 13px;
    margin-top: 10px;
}

.video-task-list {
    display: grid;
    gap: 14px;
    max-height: calc(100vh - 220px);
    overflow: auto;
    padding-right: 4px;
}

.video-task-card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    padding: 14px;
}

.video-task-card.completed {
    border-color: rgba(16, 185, 129, .38);
}

.video-task-card.error {
    border-color: rgba(239, 68, 68, .38);
}

.video-task-head {
    align-items: center;
    display: flex;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 10px;
}

.video-task-head b,
.video-task-head small {
    display: block;
}

.video-task-head small {
    color: var(--muted);
    font-size: 12px;
    margin-top: 2px;
}

.video-task-head em {
    background: var(--primary-soft);
    border-radius: 999px;
    color: var(--primary);
    font-style: normal;
    font-weight: 800;
    padding: 4px 9px;
    white-space: nowrap;
}

.video-task-card video {
    background: #020617;
    border-radius: var(--radius-sm);
    display: block;
    max-height: 360px;
    object-fit: contain;
    width: 100%;
}

.video-waiting {
    align-items: center;
    background: var(--surface-2);
    border: 1px dashed var(--line);
    border-radius: var(--radius-sm);
    color: var(--muted);
    display: flex;
    flex-direction: column;
    gap: 6px;
    justify-content: center;
    min-height: 150px;
    text-align: center;
}

.video-waiting span {
    animation: pulse 1.2s infinite;
    background: var(--primary);
    border-radius: 50%;
    height: 12px;
    width: 12px;
}

.video-task-prompt {
    color: var(--muted);
    font-size: 13px;
    line-height: 1.6;
    margin: 10px 0;
    white-space: pre-wrap;
}

.video-task-card details {
    margin-top: 8px;
}

.video-task-card summary {
    color: var(--muted);
    cursor: pointer;
    font-size: 13px;
}

.video-task-card pre {
    background: var(--surface-2);
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    color: var(--ink-2);
    font-size: 12px;
    margin-top: 8px;
    max-height: 160px;
    overflow: auto;
    padding: 10px;
    white-space: pre-wrap;
}

.video-guide h3 {
    color: var(--ink);
    font-size: 15px;
    margin: 14px 0 6px;
}

.video-guide h3:first-child {
    margin-top: 0;
}

.video-guide p {
    color: var(--muted);
    line-height: 1.75;
    margin: 6px 0;
}

@media (max-width: 1180px) {
    .video-gen-hero,
    .video-gen-grid {
        grid-template-columns: 1fr;
    }

    .video-gen-result-panel {
        grid-column: auto;
        grid-row: auto;
        position: static;
    }

    .video-task-list {
        max-height: none;
    }
}

@media (max-width: 760px) {
    .video-mode-grid,
    .video-asset-layout,
    .video-builder-grid,
    .video-param-grid {
        grid-template-columns: 1fr;
    }
}
