/* === Self-hosted Inter Font === */
@font-face { font-family: 'Inter'; font-style: normal; font-weight: 300; font-display: swap; src: url('/fonts/inter-300.ttf') format('truetype'); }
@font-face { font-family: 'Inter'; font-style: normal; font-weight: 400; font-display: swap; src: url('/fonts/inter-400.ttf') format('truetype'); }
@font-face { font-family: 'Inter'; font-style: normal; font-weight: 500; font-display: swap; src: url('/fonts/inter-500.ttf') format('truetype'); }
@font-face { font-family: 'Inter'; font-style: normal; font-weight: 600; font-display: swap; src: url('/fonts/inter-600.ttf') format('truetype'); }

/* === Design Tokens === */
:root {
    --bg-base: #09090b;
    --bg-raised: #111113;
    --bg-card: rgba(255, 255, 255, 0.025);
    --bg-card-hover: rgba(255, 255, 255, 0.05);
    --bg-glass: rgba(255, 255, 255, 0.03);
    --border: rgba(255, 255, 255, 0.07);
    --border-hover: rgba(255, 255, 255, 0.14);
    --border-accent: rgba(196, 163, 90, 0.3);
    --text-1: #e8e8ec;
    --text-2: #8b8b8e;
    --text-3: #4e4e52;
    --accent: #c4a35a;
    --accent-dim: rgba(196, 163, 90, 0.1);
    --success: #34d399;
    --success-dim: rgba(52, 211, 153, 0.1);
    --warning: #fbbf24;
    --error: #f87171;
    --error-dim: rgba(248, 113, 113, 0.1);
    --radius: 14px;
    --radius-sm: 8px;
    --radius-xs: 6px;
    --blur: 24px;
    --transition: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    --shadow: 0 1px 3px rgba(0,0,0,0.4);
}

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

body {
    font-family: 'Inter', -apple-system, 'Segoe UI', sans-serif;
    font-size: 13px;
    line-height: 1.55;
    color: var(--text-1);
    background: var(--bg-base);
    -webkit-font-smoothing: antialiased;
}

/* === Header === */
.header {
    position: sticky;
    top: 0;
    z-index: 100;
    background: rgba(9, 9, 11, 0.85);
    backdrop-filter: blur(var(--blur));
    border-bottom: 1px solid var(--border);
}

.header-inner {
    max-width: 1080px;
    margin: 0 auto;
    padding: 14px 24px;
    display: flex;
    align-items: center;
    gap: 20px;
}

.header-nav {
    display: flex;
    gap: 4px;
    margin-left: 20px;
}
.nav-btn {
    padding: 7px 14px;
    background: transparent;
    border: none;
    border-radius: var(--radius-xs);
    color: var(--text-2);
    font-size: 13px;
    font-family: inherit;
    letter-spacing: 0.04em;
    cursor: pointer;
    transition: color 0.15s, background 0.15s;
}
.nav-btn:hover { color: var(--text-1); background: var(--bg-card-hover); }
.nav-btn.active {
    background: rgba(255, 255, 255, 0.06);
    color: var(--accent);
}

.header-ctx {
    display: flex;
    align-items: center;
    gap: 18px;
    margin-left: auto;
}

.header-ctx:empty {
    display: none;
}

.header-ctx .back-nav {
    margin-bottom: 0;
}

.logo {
    font-size: 15px;
    font-weight: 600;
    letter-spacing: 0.04em;
    color: var(--text-1);
}

.logo-sub {
    font-weight: 300;
    color: var(--text-3);
    margin-left: 6px;
}

/* === Main === */
.main {
    max-width: 1000px;
    margin: 0 auto;
    padding: 28px 24px 80px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* === Card === */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    backdrop-filter: blur(var(--blur));
    overflow: hidden;
}

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

.card-header h2 {
    font-size: 13px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-2);
}

/* === Back Nav === */
.back-nav {
    font-size: 13px;
    color: var(--text-3);
    cursor: pointer;
    margin-bottom: 12px;
    transition: var(--transition);
}

.back-nav:hover { color: var(--accent); }

.model-detail-header {
    display: flex;
    align-items: center;
    gap: 18px;
    margin-bottom: 20px;
}

.model-detail-header .back-nav {
    margin-bottom: 0;
}

.model-detail-id {
    font-size: 15px;
    font-weight: 600;
    letter-spacing: 0.08em;
    color: var(--text-1);
}

.model-results {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.model-results .results-section {
    padding: 0;
}

.model-results .results-section + .results-section {
    border-top: 0;
}

.model-results .grid-item {
    border: 0;
    border-radius: 0;
    overflow: visible;
}

.model-results .tile-card {
    border: 0;
}

.model-results .tile-card:hover {
    border-color: transparent;
    transform: none;
}

.model-results .tiles-grid {
    padding: 0;
    gap: 12px;
}

.model-results .grid-header {
    margin-bottom: 0;
}

.model-results .grid-status {
    margin-bottom: 0;
}

.model-source-grid {
    grid-template-columns: repeat(4, 1fr) !important;
}

@media (max-width: 800px) {
    .model-source-grid { grid-template-columns: repeat(2, 1fr) !important; }
}

/* === SKU List === */
.sku-list-body { padding: 0; }

.sku-row {
    padding: 0;
    transition: var(--transition);
    border-bottom: 1px solid var(--border);
}

.sku-row:last-child { border-bottom: none; }
.sku-row:hover { background: var(--bg-card-hover); }

.sku-row-head {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 14px 6px;
}

.sku-row-id {
    font-family: 'SF Mono', 'Cascadia Code', monospace;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-1);
    min-width: 90px;
    cursor: pointer;
}

.sku-row-info {
    flex: 1;
    font-size: 12px;
    color: var(--text-3);
    cursor: pointer;
}

.sku-row-cat {
    display: inline-flex;
    align-items: center;
    padding: 3px 10px;
    background: var(--bg-2);
    border: 1px solid var(--border);
    border-radius: 999px;
    font-size: 12px;
    color: var(--text-2);
    line-height: 1.4;
}

.sku-row-cat-empty {
    color: var(--text-3);
    border-style: dashed;
}

.sku-row-spacer {
    flex: 1;
}

.sku-row-thumbs {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 0;
    width: 100%;
}

.sku-row-thumb {
    width: 100%;
    aspect-ratio: 1 / 1;
    object-fit: cover;
    display: block;
    background: var(--bg-2);
    cursor: pointer;
}

.sku-row-thumb-empty {
    cursor: default;
}

/* === Model List Row === */
.model-row {
    padding: 0;
    transition: var(--transition);
}

.model-row + .model-row { border-top: 1px solid var(--border); }
.model-row:hover { background: var(--bg-card-hover); }

.model-row-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px 8px;
}

.model-row-thumbs {
    display: grid;
    grid-template-columns: 16fr repeat(4, 9fr);
    gap: 0;
    width: 100%;
    align-items: stretch;
}

.model-row-thumb {
    display: block;
    background: var(--bg-2);
}

.model-row-face-col {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    grid-template-rows: repeat(2, 1fr);
    gap: 0;
    width: 100%;
    height: 100%;
}

.model-row-face {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.model-row-body-cell {
    position: relative;
    width: 100%;
    aspect-ratio: 9 / 16;
    background: var(--bg-2);
    overflow: hidden;
}

.model-row-body {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center top;
    display: block;
}

.model-row-body-redo {
    position: absolute;
    top: 6px;
    right: 6px;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.55);
    color: #fff;
    border: 0;
    border-radius: 6px;
    cursor: pointer;
    padding: 0;
    transition: background 0.15s;
}

.model-row-body-redo:hover { background: rgba(0, 0, 0, 0.85); }

.model-row-body-redo svg { width: 16px; height: 16px; }

.model-row-body-cell.is-regen .model-row-body { opacity: 0.4; }

.model-row-body-cell.is-regen::after {
    content: "重做中…";
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    background: rgba(0, 0, 0, 0.5);
    font-size: 12px;
    font-variant-numeric: tabular-nums;
    pointer-events: none;
}

/* Scene library list — 5 equal-width thumbs (source + 4 generated) below, info above. */
/* Use scene-lib-* prefix to avoid conflict with .scene-card in SKU detail page (3:4 aspect img). */
.scene-lib-card {
    background: var(--bg-1);
    border-radius: var(--radius-md);
    padding: 16px;
    margin-bottom: 12px;
    border: 1px solid transparent;
    transition: var(--transition);
    display: flex;
    flex-direction: column;
    gap: 14px;
}
.scene-lib-card:hover {
    border-color: var(--accent);
}
.scene-lib-thumbs {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 6px;
}
.scene-lib-cell {
    width: 100%;
    aspect-ratio: 1 / 1;
    object-fit: cover;
    display: block;
    background: var(--bg-2);
    border-radius: var(--radius-xs);
}
.scene-lib-cell.empty {
    background: var(--bg-2);
}
.scene-lib-info {
    display: flex;
    align-items: baseline;
    gap: 12px;
    min-width: 0;
}
.scene-lib-info > * {
    flex: none;
    white-space: nowrap;
}
.scene-lib-seq {
    font-family: 'SF Mono', 'Cascadia Code', monospace;
    font-size: 12px;
    color: var(--text-2);
    font-weight: 500;
}
.scene-lib-name {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-1);
    line-height: 1.3;
}
.scene-lib-subtitle {
    font-size: 13px;
    color: var(--text-2);
    font-family: 'SF Mono', 'Cascadia Code', monospace;
    flex: 0 1 auto;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
}
.scene-lib-info .btn-row-action-danger {
    margin-left: auto;
    align-self: center;
}

/* Style library list — left 280x280 thumb + right single-column info */
.style-card {
    background: var(--bg-1);
    border-radius: var(--radius-md);
    padding: 16px;
    margin-bottom: 12px;
    transition: var(--transition);
    border: 1px solid transparent;
    display: flex;
    gap: 24px;
    align-items: stretch;
    min-height: 280px;
}
.style-card:hover {
    border-color: var(--accent);
}
.style-thumb-cell {
    width: 280px;
    height: 280px;
    background: var(--bg-2);
    border-radius: var(--radius-sm);
    flex: none;
    position: relative;
    overflow: hidden;
}
.style-thumb-cell.empty {
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-2);
    font-size: 12px;
}
.style-thumb-img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 0;
    transition: opacity 0.6s ease;
}
.style-thumb-img.active {
    opacity: 1;
}
.style-thumb-dots {
    position: absolute;
    left: 50%;
    bottom: 10px;
    transform: translateX(-50%);
    display: flex;
    gap: 6px;
    z-index: 2;
}
.style-thumb-dots span {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.55);
    color: rgba(255, 255, 255, 0.85);
    font-size: 11px;
    line-height: 24px;
    text-align: center;
    font-family: 'SF Mono', 'Cascadia Code', monospace;
    cursor: pointer;
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    transition: var(--transition);
    user-select: none;
}
.style-thumb-dots span:hover {
    background: rgba(0, 0, 0, 0.78);
}
.style-thumb-dots span.active {
    background: var(--accent);
    color: var(--bg-0);
}
.style-card-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.style-card-meta {
    display: flex;
    align-items: flex-start;
    gap: 12px;
}
.style-card-title {
    flex: 1;
    min-width: 0;
    display: flex;
    align-items: baseline;
    gap: 12px;
    flex-wrap: wrap;
}
.style-card-seq {
    font-family: 'SF Mono', 'Cascadia Code', monospace;
    font-size: 12px;
    color: var(--text-2);
    font-weight: 500;
    flex: none;
}
.style-card-era {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-1);
    line-height: 1.3;
}
.style-row-status {
    font-size: 12px;
    color: var(--accent);
    flex: none;
}
.style-row-status.err { color: var(--err, #c44); }
.btn-row-action {
    background: transparent;
    color: var(--text-2);
    border: 1px solid var(--bg-2);
    border-radius: var(--radius-xs);
    cursor: pointer;
    transition: var(--transition);
    flex: none;
}
.btn-row-action:hover { background: var(--accent); color: var(--bg-0); border-color: var(--accent); }
.btn-row-action-danger {
    width: 24px;
    height: 24px;
    padding: 0;
    text-align: center;
    font-size: 16px;
    line-height: 22px;
}
.btn-row-action-danger:hover { background: var(--err, #c44); color: #fff; border-color: var(--err, #c44); }
.style-card-segs {
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.style-card-seg {
    display: flex;
    gap: 12px;
    font-size: 13px;
    line-height: 1.5;
    align-items: baseline;
}
.style-card-seg .seg-k {
    flex: none;
    width: 32px;
    font-size: 12px;
    color: var(--text-2);
    font-weight: 500;
}
.style-card-seg .seg-v {
    flex: 1;
    color: var(--text-1);
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}
.style-row-preview {
    font-size: 12px;
    color: var(--text-2);
    line-height: 1.6;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    margin-top: auto;
    padding-top: 10px;
    border-top: 1px solid var(--bg-2);
    cursor: help;
}
@media (max-width: 900px) {
    .style-card { flex-direction: column; min-height: 0; }
    .style-thumb-cell { width: 100%; height: 240px; }
}

.model-row-placeholder {
    background: var(--bg-1);
}

.model-row-id {
    font-family: 'SF Mono', 'Cascadia Code', monospace;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-1);
}

.model-row .btn-delete {
    opacity: 0;
    transition: var(--transition);
}

.model-row:hover .btn-delete { opacity: 1; }

.btn-delete {
    padding: 4px 10px;
    border: 1px solid var(--border);
    border-radius: var(--radius-xs);
    background: none;
    color: var(--text-3);
    font-size: 11px;
    font-family: inherit;
    cursor: pointer;
    transition: var(--transition);
}

.btn-delete:hover {
    border-color: var(--error);
    color: var(--error);
}

.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-3);
    font-size: 13px;
}

/* === Upload Zone === */
.upload-zone {
    margin: 20px;
    padding: 48px 24px;
    border: 1.5px dashed var(--border-hover);
    border-radius: var(--radius-sm);
    text-align: center;
    cursor: pointer;
    transition: var(--transition);
}

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

.upload-icon {
    color: var(--text-3);
    margin-bottom: 12px;
    transition: var(--transition);
}

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

.upload-text {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-2);
    margin-bottom: 4px;
}

.upload-hint {
    font-size: 12px;
    color: var(--text-3);
}

/* === Upload Meta === */
.upload-meta {
    padding: 0 20px 20px;
}

.input-group {
    margin-bottom: 14px;
}

.input-group label {
    display: block;
    font-size: 11px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-3);
    margin-bottom: 6px;
}

.input {
    width: 100%;
    max-width: 280px;
    padding: 8px 12px;
    background: var(--bg-raised);
    border: 1px solid var(--border);
    border-radius: var(--radius-xs);
    color: var(--text-1);
    font-family: inherit;
    font-size: 13px;
    outline: none;
    transition: var(--transition);
}

.input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 2px var(--accent-dim);
}

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

.action-row {
    display: flex;
    align-items: center;
    gap: 20px;
}

.toggle-switch {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    user-select: none;
}

.toggle-switch input { display: none; }

.toggle-slider {
    width: 36px;
    height: 20px;
    border-radius: 10px;
    background: var(--border-hover);
    position: relative;
    transition: var(--transition);
}

.toggle-slider::after {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--text-3);
    transition: var(--transition);
}

.toggle-switch input:checked + .toggle-slider {
    background: var(--accent-dim);
    border: 1px solid var(--accent);
}

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

.toggle-label {
    font-size: 13px;
    color: var(--text-2);
}

.file-count {
    font-size: 12px;
    color: var(--text-2);
    margin-bottom: 12px;
}

.file-thumbs {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 6px;
    margin-bottom: 16px;
}

.file-thumb {
    width: 100%;
    aspect-ratio: 1;
    border-radius: var(--radius-xs);
    object-fit: cover;
    border: 1px solid var(--border);
}

/* === Progress Bar === */
.progress-bar-wrap {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 14px;
    height: 22px;
}

.progress-bar-wrap .progress-bar {
    flex: 1;
    height: 4px;
    background: var(--accent);
    border-radius: 2px;
    transition: width 0.3s ease;
}

.progress-bar-wrap::before {
    content: '';
    position: absolute;
}

.progress-bar-wrap {
    position: relative;
    background: var(--bg-raised);
    border-radius: var(--radius-xs);
    padding: 0 12px;
    overflow: hidden;
}

.progress-bar {
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    background: var(--accent-dim);
    border-radius: var(--radius-xs);
    transition: width 0.3s ease;
    z-index: 0;
}

.progress-text {
    position: relative;
    z-index: 1;
    font-size: 11px;
    font-weight: 500;
    color: var(--accent);
    font-family: 'SF Mono', 'Cascadia Code', monospace;
}

.progress-status {
    font-size: 12px;
    color: var(--text-2);
    margin-top: 8px;
}

/* === Selection Toggle === */
.select-toggle {
    position: absolute;
    top: 6px;
    right: 6px;
    cursor: pointer;
    z-index: 2;
}

.check-badge {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: var(--accent);
    color: #0a0a0a;
    font-size: 14px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

.check-badge.empty {
    background: rgba(255,255,255,0.1);
    border: 1.5px solid var(--border-hover);
    color: var(--text-3);
    font-size: 12px;
}

.check-badge:hover { transform: scale(1.15); }

.select-hint {
    font-size: 11px;
    color: var(--text-3);
    font-weight: 400;
    margin-left: 8px;
}

/* === Button === */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 9px 20px;
    border: 1px solid var(--accent);
    border-radius: var(--radius-xs);
    font-family: inherit;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    background: var(--accent-dim);
    color: var(--accent);
}
.btn:hover { background: var(--accent); color: #0a0a0a; }

.btn-primary {
    background: var(--accent);
    color: #0a0a0a;
}

.btn-primary:hover { filter: brightness(1.1); }
.btn-primary:active { filter: brightness(0.95); }
.btn-primary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-loader {
    width: 14px;
    height: 14px;
    border: 2px solid rgba(0,0,0,0.2);
    border-top-color: #0a0a0a;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

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

/* === SKU List === */
.sku-list {
    padding: 4px;
}

.sku-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: var(--transition);
}

.sku-item:hover { background: var(--bg-card-hover); }
.sku-item.active { background: var(--accent-dim); border: 1px solid var(--border-accent); }

.sku-id {
    font-family: 'SF Mono', 'Cascadia Code', monospace;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-1);
}

.sku-count {
    font-size: 12px;
    color: var(--text-3);
}

/* === Status === */
.status-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border-radius: 100px;
    font-size: 11px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.status-pill::before {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 50%;
}

.status-pill[data-status="uploading"],
.status-pill[data-status="classifying"],
.status-pill[data-status="selecting"],
.status-pill[data-status="removing_bg"] {
    background: var(--accent-dim);
    color: var(--accent);
}

.status-pill[data-status="uploading"]::before,
.status-pill[data-status="classifying"]::before,
.status-pill[data-status="selecting"]::before,
.status-pill[data-status="removing_bg"]::before {
    background: var(--accent);
    animation: pulse 1.2s ease-in-out infinite;
}

.status-pill[data-status="complete"] {
    background: var(--success-dim);
    color: var(--success);
}

.status-pill[data-status="complete"]::before { background: var(--success); }

.status-pill[data-status="error"] {
    background: var(--error-dim);
    color: var(--error);
}

.status-pill[data-status="error"]::before { background: var(--error); }

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.3; }
}

.sku-badge {
    font-family: 'SF Mono', 'Cascadia Code', monospace;
    font-size: 12px;
    font-weight: 400;
    color: var(--text-3);
    margin-left: 8px;
}

.count-badge {
    font-size: 11px;
    color: var(--text-3);
    font-weight: 400;
}

/* === Status Detail === */
.status-detail-text {
    font-size: 13px;
    line-height: 1.8;
    color: var(--text-2);
    padding: 4px 0;
}

.status-detail-text .step {
    display: flex;
    align-items: center;
    gap: 8px;
}

.status-detail-text .step-done { color: var(--success); }
.status-detail-text .step-active { color: var(--accent); }
.status-detail-text .step-pending { color: var(--text-3); }

.step-icon {
    width: 18px;
    text-align: center;
    font-size: 12px;
}

/* === Results === */
.results-section {
    padding: 16px 20px;
}

.results-section + .results-section {
    border-top: 1px solid var(--border);
}

.section-label {
    font-size: 11px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-3);
    margin-bottom: 14px;
}

/* === Image Grid === */
.image-grid {
    display: grid;
    gap: 8px;
}

.model-results .image-grid {
    gap: 12px;
}

.refs-grid {
    grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
}

.ref-pair {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 6px;
    background: var(--bg-glass);
}

.ref-pair .img-card {
    border: 1px solid var(--border);
}

.ref-pair .processing {
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-raised);
}

.all-grid {
    grid-template-columns: repeat(5, 1fr);
}

.img-card {
    position: relative;
    aspect-ratio: 1;
    border-radius: var(--radius-sm);
    overflow: hidden;
    border: 1px solid var(--border);
    cursor: pointer;
    transition: var(--transition);
}

.img-card:hover {
    border-color: var(--border-hover);
    transform: translateY(-1px);
}

.img-card.selected {
    border-color: var(--accent);
    box-shadow: 0 0 0 1px var(--accent);
}

.selecting-mode .img-card:not(.selected)::after {
    content: '';
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    pointer-events: none;
    z-index: 1;
}

.img-card img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.img-card .tag-row {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 5px 6px;
    background: rgba(0, 0, 0, 0.55);
    display: flex;
    z-index: 2;
    gap: 4px;
    flex-wrap: wrap;
}

.tag {
    display: inline-block;
    padding: 2px 7px;
    border-radius: 3px;
    font-size: 11px;
    font-weight: 500;
    color: var(--accent);
    background: none;
}


/* Ref card (larger) */
.ref-card {
    border-color: var(--border-accent);
    background: var(--accent-dim);
}

.ref-card {
    position: relative;
}

.ref-card:hover {
    border-color: var(--accent);
}

.download-btn {
    position: absolute;
    top: 6px;
    right: 6px;
    background: rgba(0, 0, 0, 0.55);
    color: #fff;
    border: none;
    border-radius: 4px;
    padding: 2px 7px;
    font-size: 12px;
    cursor: pointer;
    text-decoration: none;
    opacity: 0;
    transition: opacity 0.15s;
}

.ref-card:hover .download-btn {
    opacity: 1;
}

.download-btn:hover {
    background: rgba(0, 0, 0, 0.8);
}

/* === Lightbox === */
.lightbox {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
}

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

.lightbox-content {
    position: relative;
    max-width: 90vw;
    max-height: 90vh;
}

.lightbox-content img {
    max-width: 90vw;
    max-height: 80vh;
    border-radius: var(--radius);
    box-shadow: 0 8px 40px rgba(0,0,0,0.6);
}

.lightbox-info {
    margin-top: 12px;
    padding: 12px 16px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    backdrop-filter: blur(var(--blur));
    font-size: 12px;
    color: var(--text-2);
    line-height: 1.6;
}

.lightbox-close {
    position: absolute;
    top: -40px;
    right: 0;
    background: none;
    border: none;
    color: var(--text-2);
    font-size: 28px;
    cursor: pointer;
    padding: 4px 8px;
}

.lightbox-close:hover { color: var(--text-1); }

.lightbox.loading .lightbox-content img {
    filter: blur(6px);
    transition: filter 0.3s ease;
}

.lightbox:not(.loading) .lightbox-content img {
    filter: none;
    transition: filter 0.2s ease;
}

.lightbox.loading .lightbox-content::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 28px;
    height: 28px;
    margin: -14px 0 0 -14px;
    border: 2.5px solid rgba(255,255,255,0.15);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
    z-index: 10;
}

/* === Utilities === */
.text-muted { color: var(--text-3); }

/* === Toast === */
.toast {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%) translateY(-100px);
    padding: 10px 24px;
    border-radius: var(--radius-sm);
    background: rgba(30, 30, 34, 0.95);
    border: 1px solid var(--border-hover);
    color: var(--text-1);
    font-size: 13px;
    z-index: 2000;
    pointer-events: none;
    opacity: 0;
    transition: transform 0.3s ease, opacity 0.3s ease;
    backdrop-filter: blur(12px);
}

.toast.show {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}

/* === Modal === */
.modal {
    position: fixed;
    inset: 0;
    z-index: 1500;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
}

.modal-box {
    position: relative;
    background: var(--bg-raised);
    border: 1px solid var(--border-hover);
    border-radius: var(--radius);
    padding: 24px;
    min-width: 320px;
    max-width: 420px;
}

.modal-msg {
    font-size: 14px;
    color: var(--text-1);
    margin-bottom: 20px;
    line-height: 1.6;
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

.modal-cancel {
    background: var(--bg-card);
    border: 1px solid var(--border);
    color: var(--text-2);
}

.modal-cancel:hover {
    border-color: var(--border-hover);
    background: var(--bg-card);
    color: var(--text-2);
}

/* === Nine Grid === */
.grid-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}

.grid-header .section-label { margin-bottom: 0; }

.grid-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.grid-cost {
    display: none;
}

.batch-scene-select {
    background: var(--bg-2);
    border: 1px solid var(--border);
    color: var(--text-1);
    border-radius: 6px;
    padding: 6px 10px;
    font-size: 13px;
    max-width: 220px;
    cursor: pointer;
}

.batch-scene-select:hover {
    border-color: var(--accent);
}

.grid-status {
    font-size: 13px;
    color: var(--accent);
    margin-bottom: 12px;
}

.grid-results {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.grid-item {
    position: relative;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    overflow: hidden;
}

.grid-item img {
    width: 100%;
    display: block;
    cursor: pointer;
}

.grid-item-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px;
    background: var(--bg-raised);
    font-size: 12px;
    color: var(--text-3);
}

/* === Tiles Grid === */
.tiles-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
    padding: 8px;
}

.tile-card {
    position: relative;
    border-radius: var(--radius-xs);
    overflow: hidden;
    border: 1px solid var(--border);
    cursor: pointer;
    transition: var(--transition);
}

.tile-card:hover {
    border-color: var(--accent);
    transform: translateY(-1px);
}

.tile-card img {
    width: 100%;
    aspect-ratio: 3 / 4;
    object-fit: cover;
    display: block;
}

.tile-selected {
    border-color: var(--accent) !important;
    box-shadow: 0 0 0 2px var(--accent);
}

.tile-check, .tile-check-right {
    position: absolute;
    top: 6px;
    z-index: 2;
    cursor: pointer;
}

.tile-check { left: 6px; }
.tile-check-right { right: 6px;
}

.tile-bar {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 4px 8px;
    background: rgba(0, 0, 0, 0.55);
    display: flex;
    align-items: center;
    gap: 6px;
}

.tile-label {
    flex: 1;
    font-size: 11px;
    color: var(--accent);
}

.tile-regen {
    background: none;
    display: none;
}

.tile-btn {
    padding: 6px 12px;
    border: 1px solid rgba(255,255,255,0.2);
    border-radius: var(--radius-xs);
    background: rgba(0,0,0,0.3);
    color: var(--text-1);
    font-size: 13px;
    font-family: inherit;
    cursor: pointer;
    text-decoration: none;
    transition: var(--transition);
}

.tile-btn:hover {
    background: rgba(0,0,0,0.5);
    border-color: var(--accent);
    color: var(--accent);
}

.tile-btn-undo {
    border-color: rgba(251, 191, 36, 0.4);
    color: var(--warning);
}

.tile-btn-undo:hover {
    border-color: var(--warning);
    background: rgba(251, 191, 36, 0.1);
}

.tile-download {
    display: none;
    top: auto;
    right: auto;
    right: 4px;
    width: 24px;
    height: 24px;
    color: var(--text-2);
    font-size: 14px;
    text-decoration: none;
    transition: var(--transition);
}

.tile-download:hover { color: var(--accent); }

/* === Scene Section === */
.scene-results {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.scene-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    padding: 8px;
}

.scene-card {
    position: relative;
    border-radius: var(--radius-sm);
    overflow: hidden;
    border: 1px solid var(--border);
    cursor: pointer;
    transition: var(--transition);
}

.scene-card:hover {
    border-color: var(--accent);
    transform: translateY(-1px);
}

.scene-card img {
    width: 100%;
    aspect-ratio: 3/4;
    object-fit: cover;
    display: block;
}

.scene-card.closeup-failed {
    border-color: #d97706;
    background: linear-gradient(135deg, rgba(217, 119, 6, 0.08), rgba(217, 119, 6, 0.02));
}

.closeup-fail-placeholder {
    width: 100%;
    aspect-ratio: 3/4;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: #d97706;
    font-size: 13px;
    text-align: center;
    padding: 12px;
    line-height: 1.5;
    gap: 4px;
}

.closeup-fail-placeholder .closeup-fail-icon {
    font-size: 26px;
}

.closeup-fail-placeholder .closeup-fail-hint {
    font-size: 11px;
    opacity: 0.7;
}

.scene-bar {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 6px 8px;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: center;
    gap: 6px;
}

.scene-label {
    flex: 1;
    font-size: 11px;
    color: var(--accent);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.scene-count {
    font-size: 11px;
    color: var(--text-3);
    font-weight: 400;
}

/* === Video Section === */
.video-player-wrap {
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    overflow: hidden;
}

.video-player {
    width: 100%;
    max-height: 540px;
    display: block;
    background: #000;
}

.video-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    background: var(--bg-raised);
    font-size: 13px;
    color: var(--text-3);
}

.video-bar .tile-btn {
    font-size: 13px;
}

.video-cost-label {
    flex: 1;
}

/* === Multi-clip Video Slots (mirrors .scene-grid / .scene-card) === */
.video-slots {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    padding: 8px;
}

.video-slots > * {
    min-width: 0;
}

.video-slot {
    position: relative;
    border-radius: var(--radius-sm);
    overflow: hidden;
    border: 1px solid var(--border);
}

.video-slot video {
    width: 100%;
    aspect-ratio: 3/4;
    object-fit: cover;
    display: block;
    background: #000;
}

.video-slot .video-bar {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 8px;
    background: var(--bg-raised);
    font-size: 13px;
    color: var(--text-3);
}

.video-slot-empty {
    aspect-ratio: 3/4;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-3);
    font-size: 13px;
    border: 1px dashed var(--border);
    border-radius: var(--radius-sm);
}

.video-slot-progress {
    aspect-ratio: 3/4;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    color: var(--text-3);
    font-size: 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--bg-raised);
}

.video-slot-progress .progress-label {
    color: var(--accent);
    font-size: 11px;
}

/* Product video: 3:4 portrait slots */
#videoResults .video-slot video,
#videoResults .video-slot-empty,
#videoResults .video-slot-progress {
    aspect-ratio: 3/4;
}

/* === Image Selection Mode === */
.selecting .scene-card {
    cursor: pointer;
}

/* Selection badge is now a real .select-toggle DOM element (not pseudo-element) */

/* scene-bar stays visible during selection — checkbox is top-right, bar is bottom */

.selection-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 14px 24px;
    background: var(--bg-raised);
    border-top: 1px solid var(--border);
    z-index: 1000;
    font-size: 14px;
    color: var(--text-2);
}

.selection-bar .btn {
    min-width: 80px;
}

/* === List Layout === */
.list-content {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.sku-list-body-flush {
    padding: 0;
}

@media (max-width: 820px) {
    .header-inner { flex-wrap: wrap; padding: 12px 16px; gap: 12px; }
    .header-nav { margin-left: 0; flex-wrap: wrap; }
    .nav-btn { padding: 6px 12px; font-size: 12.5px; }
}

/* === Face Grid === */
.face-grid, .body-grid, .scene-ref-grid {
    grid-template-columns: repeat(4, 1fr) !important;
}

.face-grid .tile-card img { aspect-ratio: 1 / 1; }
.body-grid .tile-card img { aspect-ratio: 9 / 21; }
.scene-ref-grid .tile-card img { aspect-ratio: 1 / 1; }

.scene-ref-grid .tile-card { position: relative; }
.scene-ref-grid .tile-label {
    position: absolute;
    top: 8px;
    left: 8px;
    z-index: 2;
    flex: none;
    padding: 4px 10px;
    background: rgba(0, 0, 0, 0.6);
    color: var(--text-1);
    border-radius: var(--radius-xs);
    font-size: 12px;
    backdrop-filter: blur(4px);
    pointer-events: none;
}

.ref-tile .tile-bar-icons {
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.15s ease;
    background: linear-gradient(to top, rgba(0,0,0,0.7), rgba(0,0,0,0) 100%);
    justify-content: flex-end;
    padding: 28px 8px 8px;
}

.ref-tile:hover .tile-bar-icons {
    opacity: 1;
    pointer-events: auto;
}

.ref-tile .tile-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    padding: 0;
    border-radius: 50%;
    background: rgba(0,0,0,0.55);
    border: 1px solid rgba(255,255,255,0.18);
}

.ref-tile .tile-icon:hover {
    background: rgba(0,0,0,0.8);
    border-color: var(--accent);
    color: var(--accent);
}

.ref-tile.regenerating {
    pointer-events: none;
}

.ref-tile .regen-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    gap: 6px;
    background: rgba(0,0,0,0.6);
    color: var(--accent);
    z-index: 3;
    backdrop-filter: blur(2px);
    animation: tile-pulse 1.4s ease-in-out infinite;
}

.ref-tile .regen-overlay .regen-label,
.ref-tile .regen-overlay .regen-timer {
    font-size: 13px;
    font-weight: 500;
    letter-spacing: 0.08em;
    color: var(--accent);
}

.ref-tile .regen-overlay .regen-timer {
    font-variant-numeric: tabular-nums;
}

@keyframes tile-pulse {
    0%, 100% { opacity: 0.75; }
    50% { opacity: 1; }
}

@media (max-width: 800px) {
    .face-grid, .body-grid, .scene-ref-grid { grid-template-columns: repeat(2, 1fr) !important; }
    .ref-tile .tile-bar-icons { opacity: 1; pointer-events: auto; }
}

.face-badge {
    font-size: 11px;
    color: var(--success);
    margin-left: 8px;
}

.lookbook-actions {
    flex-shrink: 0;
    flex-wrap: nowrap;
}

.model-dropdown {
    position: relative;
    flex-shrink: 0;
}

.model-dropdown-trigger {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 10px 4px 4px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--bg-2);
    cursor: pointer;
    transition: var(--transition);
    min-width: 120px;
}

.model-dropdown-trigger:hover {
    border-color: var(--accent);
}

.model-dropdown-trigger .md-thumb {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    object-fit: cover;
    border: 1px solid var(--border);
    background: #e8e0d8;
}

.model-dropdown-trigger .md-name {
    font-size: 13px;
    color: var(--text-1);
    white-space: nowrap;
    flex: 1;
}

.model-dropdown-trigger .md-caret {
    font-size: 10px;
    color: var(--text-3);
    margin-left: auto;
}

.model-dropdown-menu {
    display: none;
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    min-width: 100%;
    background: #1a1714;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    box-shadow: 0 8px 24px rgba(0,0,0,.6);
    z-index: 100;
    max-height: 240px;
    overflow-y: auto;
}

.model-dropdown.open .model-dropdown-menu {
    display: block;
}

.model-dropdown-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    cursor: pointer;
    transition: background .15s;
}

.model-dropdown-item:hover {
    background: var(--bg-hover);
}

.model-dropdown-item.selected {
    background: var(--accent-dim);
}

.model-dropdown-item .md-thumb {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
    border: 1px solid var(--border);
    background: #e8e0d8;
}

.model-dropdown-item .md-name {
    font-size: 13px;
    color: var(--text-1);
}

.scene-dropdown {
    position: relative;
    flex-shrink: 0;
}

.scene-dropdown-trigger {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 10px 4px 4px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--bg-2);
    cursor: pointer;
    transition: var(--transition);
    min-width: 140px;
}

.scene-dropdown-trigger:hover {
    border-color: var(--accent);
}

.scene-dropdown-trigger .sd-thumb {
    width: 36px;
    height: 28px;
    border-radius: 4px;
    object-fit: cover;
    border: 1px solid var(--border);
    background: #2a2520;
}

.scene-dropdown-trigger .sd-name {
    font-size: 13px;
    color: var(--text-1);
    white-space: nowrap;
    flex: 1;
}

.scene-dropdown-trigger .sd-caret {
    font-size: 10px;
    color: var(--text-3);
    margin-left: auto;
}

.scene-dropdown-menu {
    display: none;
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    min-width: 100%;
    background: #1a1714;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    box-shadow: 0 8px 24px rgba(0,0,0,.6);
    z-index: 100;
    max-height: 280px;
    overflow-y: auto;
}

.scene-dropdown.open .scene-dropdown-menu {
    display: block;
}

.scene-dropdown-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 10px;
    cursor: pointer;
    transition: background .15s;
}

.scene-dropdown-item:hover {
    background: var(--bg-hover);
}

.scene-dropdown-item.selected {
    background: var(--accent-dim);
}

.scene-dropdown-item .sd-thumb {
    width: 48px;
    height: 36px;
    border-radius: 4px;
    object-fit: cover;
    border: 1px solid var(--border);
    background: #2a2520;
}

.scene-dropdown-item .sd-name {
    font-size: 13px;
    color: var(--text-1);
}

/* === Responsive === */
@media (max-width: 640px) {
    .main { padding: 16px 12px 60px; }
    .refs-grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
    .all-grid { grid-template-columns: repeat(3, 1fr); }
    .upload-zone { padding: 32px 16px; }
}

.card-header-actions { display: flex; align-items: center; gap: 10px; }

/* === Solo Studio (单图工坊) === */

#tabStudio {
    padding: 0;
    background: transparent;
    border: none;
    box-shadow: none;
    border-radius: 0;
    overflow: visible;
}
#tabStudio .studio-options-pane,
#tabStudio .studio-history-pane,
#tabStudio .studio-current-pane {
    border: none;
}
.studio-hint-text { font-size: 12px; color: var(--text-3); }

/* card-header (生成按钮已移到中栏 head) */
.studio-header {
    position: sticky;
    top: 0;
    z-index: 5;
    background: var(--bg-raised);
}
.studio-header .card-header-actions {
    display: flex;
    align-items: center;
    gap: 14px;
}
.studio-header .studio-validation {
    color: var(--text-3);
    font-size: 12px;
    max-width: 360px;
    text-align: right;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.studio-header #studioGenerateBtn {
    padding: 8px 22px;
    font-size: 13px;
}

.studio-layout {
    display: grid;
    /* 左列：上=历史横向条 / 下=大图
       右列：选项区（跨两行，贯穿全高），槽位/chip 两列布局，需要更宽
       不限制 layout 总高度 — 整页跟随浏览器滚动 */
    grid-template-columns: minmax(0, 1fr) 480px;
    grid-template-rows: auto auto;
    grid-template-areas:
        "history options"
        "current options";
    align-items: stretch;
    gap: 0;
}
.studio-options-pane {
    grid-area: options;
    border-left: 1px solid var(--border);
    align-self: stretch;
}
.studio-current-pane {
    grid-area: current;
    padding: 16px 20px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    align-items: stretch;
    min-width: 0;
    /* 不被 grid 同行拉伸到选项区高度，按内容紧凑；下方 grid 空白由 body 背景填 */
    align-self: start;
}
.studio-current-head {
    display: flex; align-items: center; justify-content: space-between;
    gap: 8px;
    min-height: 24px;
    margin-bottom: 10px;
}
.studio-current-actions {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    margin-bottom: 12px;
    padding: 0 4px;
}
.studio-current-actions-row {
    display: flex; align-items: center; justify-content: center;
    gap: 12px;
}
.studio-current-side-btn {
    background: var(--accent-dim);
    border: 1px solid var(--accent);
    color: var(--accent);
    padding: 7px 18px;
    border-radius: 999px;
    font-size: 12.5px;
    font-weight: 500;
    cursor: pointer;
    font-family: inherit;
    transition: background 0.12s, color 0.12s, border-color 0.12s;
    letter-spacing: 0.3px;
}
.studio-current-side-btn:hover:not(:disabled) {
    background: var(--accent);
    color: #1a1410;
    border-color: var(--accent);
}
.studio-current-side-btn:disabled { opacity: 0.4; cursor: not-allowed; }
.studio-hero-generate {
    padding: 8px 32px;
    font-size: 13px;
    font-weight: 500;
    border-radius: 999px;
}
.studio-current-actions .studio-validation {
    color: var(--text-3);
    font-size: 11.5px;
}
/* 历史列表头部"全新生成"占位卡 */
.studio-history-fresh {
    border-style: dashed !important;
}
.studio-history-fresh-thumb {
    width: 100%;
    aspect-ratio: 3 / 4;
    background: var(--bg-glass);
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    gap: 6px;
}
.studio-history-fresh-icon {
    font-size: 26px;
    color: var(--text-3);
    line-height: 1;
    font-weight: 300;
}
.studio-history-fresh-label {
    font-size: 11px;
    color: var(--text-2);
    letter-spacing: 0.04em;
}
.studio-history-fresh.active {
    border-color: var(--accent) !important;
    background: var(--accent-dim);
}
.studio-history-fresh.active .studio-history-fresh-icon,
.studio-history-fresh.active .studio-history-fresh-label {
    color: var(--accent);
}
.studio-current-title {
    color: var(--text-2);
    font-size: 12px;
    flex: 0 0 auto;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}
.studio-current-clear {
    background: transparent;
    border: 1px solid var(--border);
    border-radius: 4px;
    color: var(--text-3);
    font-size: 11px;
    padding: 3px 10px;
    cursor: pointer;
    font-family: inherit;
}
.studio-current-clear:hover { color: var(--text-1); border-color: var(--border-hover); }
.studio-current-image-wrap {
    position: relative;
    /* 不再 flex:1 — 让 wrap 高度跟 image 自然高度走，避免 image 受限高度后 contain 留左右白边
       占位 / generating 时 min-height 240 即够（spinner+文案）；有图时随图自然撑高 */
    min-height: 240px;
    display: flex; align-items: center; justify-content: center;
    background: transparent;
    /* negative margin 突破 pane 的左右 20px padding，让图真正撑满中栏 */
    margin-left: -20px;
    margin-right: -20px;
    overflow: hidden;
}
/* 有图时解除 min-height — 否则窄屏下图自然高度 < 240，wrap 比图高出一截，视觉"边框高度滞后" */
.studio-current-image-wrap.has-image { min-height: 0; }
.studio-current-image {
    display: block;
    width: 100%;
    height: auto;
    cursor: zoom-in;
}
.studio-prompt-overlay {
    position: fixed; inset: 0;
    background: rgba(0,0,0,0.6);
    display: flex; align-items: center; justify-content: center;
    z-index: 1000;
    backdrop-filter: blur(4px);
}
.studio-prompt-box {
    background: var(--bg-raised);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 20px;
    width: 480px;
    max-width: 92vw;
    display: flex; flex-direction: column; gap: 12px;
    box-shadow: 0 12px 40px rgba(0,0,0,0.6);
}
.studio-prompt-msg { font-size: 13px; color: var(--text-1); }
.studio-prompt-input {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 8px 10px;
    color: var(--text-1);
    font-family: inherit;
    font-size: 13px;
    resize: vertical;
}
.studio-prompt-input:focus { outline: none; border-color: var(--border-accent); }
.studio-prompt-actions { display: flex; justify-content: flex-end; gap: 10px; }

.logofix-box {
    width: 760px;
    max-width: 95vw;
    max-height: 86vh;
    overflow: hidden;
}
.logofix-summary {
    color: var(--text-3);
    font-size: 12px;
    margin: -4px 0 4px;
}
.logofix-body {
    flex: 1 1 auto;
    overflow-y: auto;
    display: flex; flex-direction: column; gap: 14px;
    padding: 4px 6px 4px 0;
    margin: 0 -6px 0 0;
}
.logofix-group {
    display: flex; flex-direction: column; gap: 8px;
}
.logofix-group-title {
    font-size: 12px;
    color: var(--text-2);
    display: flex; align-items: center; gap: 8px;
}
.logofix-cat {
    font-size: 11px;
    color: var(--text-3);
    background: var(--bg-card);
    border: 1px solid var(--border);
    padding: 1px 6px;
    border-radius: 3px;
}
.logofix-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
    gap: 8px;
}
.logofix-item {
    cursor: pointer;
    position: relative;
    border: 1px solid var(--border);
    border-radius: 6px;
    overflow: hidden;
    background: var(--bg-card);
    display: flex; flex-direction: column;
    transition: border-color 0.12s, box-shadow 0.12s;
}
.logofix-item:has(input:checked) {
    border-color: var(--border-accent, #6b8aff);
    box-shadow: 0 0 0 1px var(--border-accent, #6b8aff) inset;
}
.logofix-item input[type="checkbox"] {
    position: absolute;
    top: 6px; left: 6px;
    z-index: 2;
    width: 16px; height: 16px;
    cursor: pointer;
    accent-color: var(--border-accent, #6b8aff);
}
.logofix-item img {
    width: 100%;
    aspect-ratio: 1;
    object-fit: cover;
    display: block;
    background: #1a1a1a;
}
.logofix-label {
    font-size: 11px;
    color: var(--text-3);
    padding: 5px 6px;
    text-align: center;
    line-height: 1.3;
    word-break: break-word;
    border-top: 1px solid var(--border);
}

.studio-image-lens {
    position: absolute;
    width: 360px; height: 360px;
    border: 2px solid rgba(255,255,255,0.85);
    border-radius: 50%;
    box-shadow: 0 6px 24px rgba(0,0,0,0.55), inset 0 0 0 1px rgba(0,0,0,0.4);
    background-repeat: no-repeat;
    pointer-events: none;
    z-index: 20;
}
.studio-current-empty {
    color: var(--text-3);
    font-size: 12.5px;
    padding: 40px 20px;
    text-align: center;
    line-height: 1.6;
}
.studio-current-overlay {
    position: absolute; inset: 0;
    background: rgba(0,0,0,0.45);
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px;
    pointer-events: none;
}
.studio-current-meta {
    color: var(--text-3);
    font-size: 11.5px;
    line-height: 1.6;
    word-break: break-word;
    padding: 14px 4px 0;
}
.studio-current-meta .studio-current-prompt {
    margin-top: 10px;
    color: var(--text-2);
    font-size: 11px;
    line-height: 1.65;
    white-space: pre-wrap;
    word-break: break-word;
}
.studio-current-refs {
    margin-top: 16px;
    padding-top: 12px;
    border-top: 1px dashed var(--border);
    display: flex;
    flex-wrap: wrap;
    gap: 14px 22px;
}
.studio-ref-group {
    display: flex; align-items: center;
    gap: 6px;
}
.studio-ref-group-label {
    font-size: 11px;
    color: var(--text-3);
    margin-right: 2px;
    white-space: nowrap;
}
.studio-ref-thumb {
    width: 32px; height: 32px;
    object-fit: cover;
    border-radius: 4px;
    background: var(--bg-glass);
    display: inline-block;
}
.studio-ref-backdrop {
    border: 1px solid var(--border);
}
.studio-history-pane {
    grid-area: history;
    border-bottom: 1px solid var(--border);
    padding: 12px 16px;
    align-self: stretch;
    overflow-x: auto;
    overflow-y: hidden;
    /* 横向滚动条样式 */
    scrollbar-width: thin;
    scrollbar-color: var(--border-hover) transparent;
}
.studio-history-pane::-webkit-scrollbar { height: 8px; }
.studio-history-pane::-webkit-scrollbar-track { background: transparent; }
.studio-history-pane::-webkit-scrollbar-thumb {
    background: var(--border-hover);
    border-radius: 4px;
}
.studio-history-head {
    margin-bottom: 10px;
}
.studio-history-list {
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    gap: 8px;
    align-items: stretch;
}
.studio-history-list > .studio-history-item,
.studio-history-list > .studio-history-card-new,
.studio-history-list > .empty-state {
    flex: 0 0 auto;
    width: 80px;
}
/* 横向条里的卡片高度由 thumb aspect-ratio 决定，pane 给个容器高度上限 */
.studio-history-pane { max-height: 150px; }

.studio-section { padding: 18px 20px; border-bottom: 1px solid var(--border); }
.studio-section:last-child { border-bottom: none; }
.studio-section-head {
    display: flex; align-items: center;
    margin-bottom: 12px; gap: 12px;
}
.studio-section-head h3 { flex: 0 0 auto; }
.studio-hint {
    margin-left: 8px; font-size: 12px; color: var(--text-3);
    font-weight: normal; letter-spacing: 0.02em;
}
.studio-upload-btn {
    font-size: 12px; padding: 6px 12px;
    flex: 0 0 auto; margin-left: auto;
}
.studio-search {
    flex: 0 1 240px;
    padding: 6px 12px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text-1);
    font-size: 12.5px;
    font-family: inherit;
    outline: none;
}
.studio-search:focus { border-color: var(--border-accent); }
.studio-search::placeholder { color: var(--text-3); }
.studio-search::-webkit-search-cancel-button { cursor: pointer; }

.studio-pick-grid {
    display: flex;
    flex-wrap: nowrap;
    overflow-x: auto;
    overflow-y: hidden;
    gap: 8px;
    padding: 2px 2px 8px;
    scrollbar-width: thin;
    scrollbar-color: var(--border-hover) transparent;
}
.studio-pick-grid::-webkit-scrollbar { height: 6px; }
.studio-pick-grid::-webkit-scrollbar-track { background: transparent; }
.studio-pick-grid::-webkit-scrollbar-thumb {
    background: var(--border-hover);
    border-radius: 3px;
}
.studio-pick-grid::-webkit-scrollbar-thumb:hover { background: var(--text-3); }
.studio-pick-grid.hidden { display: none; }
.studio-pick-grid .empty-state { padding: 20px; }
.studio-pick-card {
    position: relative;
    flex: 0 0 110px;
    width: 110px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 6px;
    overflow: hidden;
    cursor: pointer;
    transition: border-color 0.15s;
}
.studio-pick-card:hover {
    border-color: var(--border-hover);
}
.studio-pick-card.active {
    border-color: var(--accent);
    box-shadow: 0 0 0 1px var(--accent);
}
.studio-pick-thumb {
    width: 100%;
    aspect-ratio: 1 / 1;
    object-fit: cover;
    display: block;
    background: var(--bg-glass);
}
.studio-pick-placeholder { background: var(--bg-glass); }
.studio-pick-meta {
    padding: 5px 7px;
    font-size: 10.5px;
    line-height: 1.3;
}
.studio-pick-id {
    color: var(--text-1);
    letter-spacing: 0.02em;
    font-feature-settings: 'tnum';
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.studio-pick-sub {
    color: var(--text-3);
    margin-top: 1px;
    font-size: 10px;
}

.studio-upload-status {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    margin-bottom: 10px;
    background: var(--bg-card);
    border: 1px solid var(--border-accent);
    border-radius: 8px;
    color: var(--text-2);
    font-size: 12.5px;
}
.studio-upload-status .studio-spinner {
    width: 16px; height: 16px;
    border-width: 2px;
}
.studio-upload-text {
    font-feature-settings: 'tnum';
}

.studio-selected-row {
    display: flex; align-items: center; gap: 12px;
    padding: 8px 10px;
    background: var(--bg-card);
    border: 1px solid var(--accent);
    border-radius: 8px;
}
.studio-selected-thumb {
    width: 48px; height: 48px;
    object-fit: cover;
    border-radius: 4px;
    flex-shrink: 0;
    background: var(--bg-glass);
}
.studio-selected-info {
    flex: 1; min-width: 0;
}
.studio-selected-id {
    color: var(--text-1);
    font-size: 13px;
    letter-spacing: 0.02em;
    font-feature-settings: 'tnum';
}
.studio-selected-sub {
    color: var(--text-3);
    font-size: 11px;
    margin-top: 2px;
}
.studio-reselect-btn {
    background: transparent;
    border: 1px solid var(--border);
    border-radius: 4px;
    color: var(--text-2);
    padding: 5px 12px;
    font-size: 12px;
    cursor: pointer;
    font-family: inherit;
    flex-shrink: 0;
}
.studio-reselect-btn:hover {
    border-color: var(--border-hover);
    color: var(--text-1);
}

.studio-options {
    padding: 18px 20px;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px 14px;
    align-content: start;
    align-items: start;
}
.studio-slot-multi-hint {
    padding: 7px 14px;
    font-size: 11px;
    color: var(--text-3);
    border-bottom: 1px solid var(--border);
    background: var(--bg-card);
    letter-spacing: 0.3px;
}
.studio-subject-hint {
    font-size: 11px;
    color: var(--text-3);
    padding: 6px 0 0;
    line-height: 1.5;
    letter-spacing: 0.2px;
}
.studio-subject-hint.active {
    color: #c8a96a;
}
.studio-options-col {
    display: flex;
    flex-direction: column;
    gap: 14px;
    min-width: 0;
}
.studio-option-group { min-width: 0; }
.studio-option-full { /* legacy, 保留以防有遗漏标记 */ }
.option-label {
    display: block;
    font-size: 12px;
    color: var(--text-2);
    margin-bottom: 8px;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}
.chip-row {
    display: flex; flex-wrap: wrap; gap: 6px;
}
.chip {
    display: inline-flex; align-items: center;
    padding: 7px 14px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 999px;
    font-size: 12.5px;
    color: var(--text-2);
    cursor: pointer;
    transition: all 0.15s;
    font-family: inherit;
}
.chip:hover {
    background: var(--bg-card-hover);
    border-color: var(--border-hover);
    color: var(--text-1);
}
.chip.active {
    background: var(--accent-dim);
    border-color: var(--accent);
    color: var(--accent);
    font-weight: 500;
}
.chip-custom {
    border-style: dashed;
}
.chip[disabled],
.chip.chip-locked {
    opacity: 0.35;
    cursor: not-allowed;
    pointer-events: none;
}

/* Studio: 摄影棚纯色 backdrop 色块 — 替代 thumb */
.studio-backdrop-swatch {
    background: #fff;
    border: 1px solid var(--border-strong, #888);
    box-shadow: inset 0 0 0 1px rgba(255,255,255,0.05);
}

/* Studio: 自然色抽签 — dropdown item 特殊条目 */
.studio-backdrop-roll-thumb {
    display: flex; align-items: center; justify-content: center;
    font-size: 18px;
    background: var(--accent-dim);
    border: 1px dashed var(--accent);
    border-radius: 6px;
}
.studio-dropdown-item.studio-dropdown-item-roll {
    border-bottom: 1px dashed rgba(196, 163, 90, 0.3);
    margin-bottom: 4px;
    padding-bottom: 8px;
}
.studio-dropdown-item.studio-dropdown-item-roll .studio-dropdown-item-primary {
    color: var(--accent);
    font-weight: 500;
}

/* Studio: 抽签卡 — 替换 panel 内容 */
.studio-backdrop-roll-card {
    padding: 16px 14px;
    display: flex; flex-direction: column; gap: 12px;
}
.studio-backdrop-roll-loading {
    display: flex; flex-direction: column; align-items: center; gap: 12px;
    padding: 20px 0;
    color: var(--accent);
    font-size: 13px;
}
.studio-backdrop-roll-spinner {
    width: 28px; height: 28px;
    border: 2px solid rgba(196, 163, 90, 0.2);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: studio-roll-spin 0.8s linear infinite;
}
@keyframes studio-roll-spin {
    to { transform: rotate(360deg); }
}
.studio-backdrop-roll-swatch {
    width: 100%; height: 72px;
    border-radius: 8px;
    border: 1px solid var(--border-strong, #888);
    box-shadow: inset 0 0 0 1px rgba(255,255,255,0.06), 0 2px 12px rgba(0,0,0,0.25);
}
.studio-backdrop-roll-info {
    display: flex; flex-direction: column; gap: 4px;
    text-align: center;
}
.studio-backdrop-roll-name {
    font-size: 15px; font-weight: 600;
    color: var(--accent);
    letter-spacing: 0.5px;
}
.studio-backdrop-roll-hex {
    font-size: 11px; opacity: 0.6;
    font-family: 'SFMono-Regular', Consolas, monospace;
    letter-spacing: 0.5px;
}
.studio-backdrop-roll-reason {
    font-size: 12px; opacity: 0.75;
    line-height: 1.5;
    margin-top: 4px;
}
.studio-backdrop-roll-error {
    font-size: 12px;
    color: #e88;
    padding: 8px 0;
    text-align: center;
}
.studio-backdrop-roll-actions {
    display: flex; gap: 8px;
    justify-content: center;
    flex-wrap: wrap;
}
.studio-backdrop-roll-btn {
    padding: 6px 12px;
    background: transparent;
    border: 1px solid var(--border-strong, #888);
    border-radius: 4px;
    color: inherit;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.15s;
}
.studio-backdrop-roll-btn:hover {
    border-color: var(--accent);
    color: var(--accent);
}
.studio-backdrop-roll-btn.studio-backdrop-roll-btn-primary {
    background: var(--accent-dim);
    border-color: var(--accent);
    color: var(--accent);
    font-weight: 500;
}
.studio-backdrop-roll-btn.studio-backdrop-roll-btn-primary:hover {
    background: var(--accent);
    color: var(--bg-0, #000);
}

/* Studio: 模特下拉灰化（subject_mode product/ghost 时） */
.studio-dropdown-trigger.studio-dropdown-disabled {
    opacity: 0.4;
}

/* Studio: 选项行内头（label + upload-link 一行） */
.studio-option-head {
    display: flex; align-items: center; gap: 10px;
    margin-bottom: 6px;
}
.studio-option-head .option-label { margin-bottom: 0; flex: 1; }
.studio-upload-link {
    background: transparent;
    border: none;
    color: var(--text-2);
    font-size: 11px;
    cursor: pointer;
    padding: 2px 6px;
    border-radius: 4px;
    font-family: inherit;
    letter-spacing: 0.02em;
}
.studio-upload-link:hover {
    color: var(--accent);
    background: var(--accent-dim);
}

/* Studio: 通用下拉组件（产品/模特/风格/场景） */
.studio-dropdown { position: relative; }
.studio-dropdown-trigger {
    display: flex; align-items: center; gap: 10px;
    width: 100%;
    padding: 8px 12px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 6px;
    cursor: pointer;
    font-family: inherit;
    text-align: left;
    transition: border-color 0.15s;
}
.studio-dropdown-trigger:hover { border-color: var(--border-hover); }
.studio-dropdown-current {
    flex: 1; min-width: 0;
    display: flex; align-items: center; gap: 8px;
    overflow: hidden;
}
.studio-dropdown-current-thumb {
    flex: 0 0 32px;
    width: 32px; height: 32px;
    object-fit: cover;
    border-radius: 4px;
    background: var(--bg-glass);
}
.studio-dropdown-current-text {
    flex: 1; min-width: 0;
    color: var(--text-1);
    font-size: 12.5px;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.studio-dropdown-current-text b {
    font-weight: 500;
    margin-right: 4px;
    font-feature-settings: 'tnum';
}
.studio-dropdown-placeholder {
    color: var(--text-3);
    font-size: 12.5px;
}
.studio-dropdown-caret {
    flex: 0 0 auto;
    color: var(--text-3);
    font-size: 11px;
    transition: transform 0.15s;
}
.studio-dropdown-panel {
    position: absolute;
    top: calc(100% + 4px); left: 0; right: 0;
    z-index: 30;
    max-height: 360px;
    overflow-y: auto;
    background: var(--bg-raised);
    border: 1px solid var(--border);
    border-radius: 6px;
    box-shadow: 0 8px 28px rgba(0,0,0,0.6);
    padding: 4px;
}
.studio-dropdown-item {
    display: flex; align-items: center; gap: 10px;
    padding: 6px 8px;
    border-radius: 4px;
    cursor: pointer;
    transition: background 0.1s;
}
.studio-dropdown-item:hover { background: var(--bg-card-hover); }
.studio-dropdown-item.active {
    background: var(--accent-dim);
}
.studio-dropdown-item-thumb {
    flex: 0 0 36px;
    width: 36px; height: 36px;
    object-fit: cover;
    border-radius: 4px;
    background: var(--bg-glass);
}
.studio-dropdown-item-thumbs {
    flex: 0 0 auto;
    display: flex;
    gap: 2px;
}
.studio-dropdown-item-thumbs img {
    width: 28px; height: 28px;
    object-fit: cover;
    border-radius: 3px;
    background: var(--bg-glass);
}
.studio-dropdown-item-text {
    flex: 1; min-width: 0;
}
.studio-dropdown-item-primary {
    color: var(--text-1);
    font-size: 12.5px;
    font-feature-settings: 'tnum';
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.studio-dropdown-item-secondary {
    color: var(--text-3);
    font-size: 11px;
    margin-top: 1px;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.studio-dropdown-empty {
    text-align: center;
    color: var(--text-3);
    font-size: 12px;
    padding: 16px;
}
/* 槽位下拉：分组头 + 勾选标记 + 清空项 + 锁定 trigger */
.studio-dropdown-group-header {
    padding: 6px 10px 4px;
    font-size: 11px;
    color: var(--text-3);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-top: 1px solid var(--border);
}
.studio-dropdown-group-header:first-child { border-top: none; }
.studio-slot-checkmark {
    margin-left: auto;
    width: 18px;
    color: var(--accent, #4a9eff);
    font-weight: 600;
    text-align: center;
}
.studio-slot-clear .studio-dropdown-item-thumb {
    background: var(--bg-card-hover, #2a2a2a);
    color: var(--text-3);
    font-size: 18px;
}
.studio-dropdown-trigger.chip-locked {
    opacity: 0.5;
    cursor: not-allowed;
}
.studio-dropdown-trigger:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}
.studio-custom-input {
    display: block;
    width: 100%;
    margin-top: 8px;
    padding: 8px 12px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text-1);
    font-size: 13px;
    font-family: inherit;
    box-sizing: border-box;
    resize: vertical;
}
.studio-custom-input:focus {
    outline: none;
    border-color: var(--border-accent);
}
.studio-notes {
    min-height: 96px;
    line-height: 1.5;
    padding: 10px 12px;
    resize: vertical;
}

/* === #tabStudio 全局滚动条美化（webkit + firefox 双管） === */
#tabStudio { scrollbar-width: thin; scrollbar-color: var(--border-hover) transparent; }
#tabStudio *::-webkit-scrollbar { width: 8px; height: 8px; }
#tabStudio *::-webkit-scrollbar-track { background: transparent; }
#tabStudio *::-webkit-scrollbar-thumb {
    background: var(--border-hover);
    border-radius: 4px;
    transition: background 0.15s ease;
}
#tabStudio *::-webkit-scrollbar-thumb:hover { background: var(--text-3); }
#tabStudio *::-webkit-scrollbar-corner { background: transparent; }

.studio-actions {
    padding: 18px 20px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}
.studio-validation {
    color: var(--text-3);
    font-size: 12px;
}
.btn-lg {
    padding: 10px 28px;
    font-size: 14px;
}

/* === 历史紧凑列表项（仅缩略图） === */
.studio-history-item {
    position: relative;
    display: block;
    padding: 0;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 6px;
    cursor: pointer;
    overflow: hidden;
    transition: all 0.15s;
}
.studio-history-item:hover {
    border-color: var(--border-hover);
}
.studio-history-item.active {
    border-color: var(--accent);
    background: var(--accent-dim);
}
.studio-history-item.generating {
    border-color: rgba(196, 163, 90, 0.4);
    animation: studio-card-pulse 1.6s ease-in-out infinite;
}
.studio-history-item.failed {
    border-color: rgba(178, 71, 71, 0.4);
    background: rgba(178, 71, 71, 0.06);
}
@keyframes studio-card-pulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(196, 163, 90, 0); }
    50% { box-shadow: 0 0 0 2px rgba(196, 163, 90, 0.18); }
}
.studio-history-thumb {
    width: 100%;
    aspect-ratio: 3 / 4;
    object-fit: cover;
    display: block;
    background: var(--bg-glass);
}
.studio-history-thumb-placeholder {
    width: 100%;
    aspect-ratio: 3 / 4;
    background: var(--bg-glass);
    display: flex; align-items: center; justify-content: center;
}
.studio-history-meta {
    flex: 1; min-width: 0;
    display: flex; flex-direction: column; gap: 4px;
    color: var(--text-2);
    font-size: 11px;
    line-height: 1.35;
    overflow: hidden;
}
.studio-history-meta-line {
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.studio-history-meta-line.primary {
    color: var(--text-1);
    font-size: 11.5px;
    font-feature-settings: 'tnum';
}
.studio-history-meta-status {
    color: var(--accent);
    font-feature-settings: 'tnum';
}
.studio-history-meta-status.fail {
    color: #e8a4a4;
}
.studio-history-actions {
    display: flex; gap: 4px;
    margin-top: auto;
}
.studio-history-btn {
    flex: 1;
    padding: 2px 6px;
    background: transparent;
    border: 1px solid var(--border);
    border-radius: 3px;
    color: var(--text-3);
    font-size: 10px;
    cursor: pointer;
    font-family: inherit;
}
.studio-history-x {
    position: absolute;
    top: 6px; right: 6px;
    width: 18px; height: 18px;
    border-radius: 50%;
    background: rgba(0,0,0,0.55);
    color: var(--text-2);
    border: 1px solid var(--border);
    font-size: 10px; line-height: 1;
    display: flex; align-items: center; justify-content: center;
    cursor: pointer;
    opacity: 0;
    padding: 0;
    transition: opacity 0.12s, background 0.12s, color 0.12s, transform 0.12s;
    z-index: 5;
}
.studio-history-item:hover .studio-history-x { opacity: 0.75; }
.studio-history-x:hover { opacity: 1; background: #d57676; color: white; border-color: #d57676; }
.studio-history-btn:hover:not(:disabled) {
    border-color: var(--border-hover);
    color: var(--text-1);
}
.studio-spinner {
    width: 22px; height: 22px;
    border: 2.5px solid rgba(255,255,255,0.18);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: studio-spin 0.8s linear infinite;
}
.studio-spinner.large { width: 36px; height: 36px; border-width: 3px; }
@keyframes studio-spin { to { transform: rotate(360deg); } }
.studio-current-timer {
    color: var(--text-1);
    font-size: 13px;
    font-feature-settings: 'tnum';
    letter-spacing: 0.02em;
}

@media (max-width: 1280px) {
    .studio-layout { grid-template-columns: minmax(0, 1fr) 420px; }
}
@media (max-width: 1100px) {
    .studio-layout { grid-template-columns: minmax(0, 1fr) 360px; }
    /* 太窄时：把 chip 列堆到下拉列下面，整个选项区单列 */
    .studio-options { grid-template-columns: 1fr; }
}
@media (max-width: 900px) {
    .studio-layout {
        grid-template-columns: 1fr;
        grid-template-areas:
            "history"
            "current"
            "options";
    }
    .studio-options-pane { border-left: none; border-top: 1px solid var(--border); }
    .studio-history-pane { max-height: 200px; }
}

/* === SKU 分类筛选 === */
.sku-category-filter {
    padding: 4px 16px 12px;
    gap: 4px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 4px;
}

.sku-row-category {
    appearance: none;
    -webkit-appearance: none;
    padding: 5px 24px 5px 12px;
    background-color: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 999px;
    font-size: 12px;
    color: var(--text-2);
    cursor: pointer;
    font-family: inherit;
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 12 12'><path fill='none' stroke='%23999' stroke-width='1.5' d='M3 4.5l3 3 3-3'/></svg>");
    background-repeat: no-repeat;
    background-position: right 8px center;
    transition: all 0.15s;
    min-width: 72px;
}
.sku-row-category:hover {
    border-color: var(--border-hover);
    color: var(--text-1);
}
.sku-row-category[data-cur=""] {
    color: var(--text-3);
    border-style: dashed;
}

/* === Ghost Mannequin (8 角度参考图 + 元素特写) === */

.ghost-angles-wrap {
    padding: 0;
}

.ghost-grid-8 {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
    padding: 8px;
}

.ghost-closeups-section {
    margin-top: 16px;
    padding-top: 12px;
    border-top: 1px solid var(--border);
}

.ghost-closeups-header {
    padding: 4px 8px 12px;
}

.section-sub-label {
    font-size: 13px;
    color: var(--text-2);
    margin: 0;
    font-weight: 500;
}

.closeup-wrap {
    padding: 0 8px 8px;
}

.closeup-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
}

.scene-card.ghost-placeholder {
    background: var(--surface-2);
    display: flex;
    align-items: center;
    justify-content: center;
    aspect-ratio: 3/4;
    color: var(--text-3);
    font-size: 12px;
    border: 1px dashed var(--border);
}

.legacy-grid-results .empty-state {
    padding: 12px;
    color: var(--text-3);
    font-size: 12px;
    background: var(--surface-2);
    border-radius: var(--radius-sm);
    margin-bottom: 8px;
}

@media (max-width: 1100px) {
    .ghost-grid-8 { grid-template-columns: repeat(2, 1fr); }
    .closeup-grid { grid-template-columns: repeat(3, 1fr); }
}

/* === Outfit Split (从模特图拆解 SKU) === */

.outfit-split-modal { z-index: 1000; }

.outfit-split-box {
    position: relative;
    background: var(--bg-raised);
    border: 1px solid var(--border-hover);
    border-radius: var(--radius);
    width: min(720px, 92vw);
    max-height: 86vh;
    display: flex;
    flex-direction: column;
}

.outfit-split-head {
    display: flex; align-items: center; justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
}
.outfit-split-head h3 {
    margin: 0;
    font-size: 15px;
    font-weight: 600;
    letter-spacing: 0.03em;
    color: var(--text-1);
}
.outfit-split-close {
    background: transparent;
    border: none;
    color: var(--text-3);
    font-size: 22px;
    cursor: pointer;
    width: 28px; height: 28px;
    line-height: 1;
    padding: 0;
    border-radius: 4px;
}
.outfit-split-close:hover { color: var(--text-1); background: var(--bg-card); }

.outfit-split-body {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
}

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

.outfit-split-tip {
    color: var(--text-2);
    font-size: 13px;
    line-height: 1.6;
    margin: 0;
    max-width: 560px;
}

.outfit-split-tip-warn {
    color: rgba(220, 180, 80, 0.85);
    font-size: 12px;
    background: rgba(220, 180, 80, 0.08);
    border-left: 3px solid rgba(220, 180, 80, 0.5);
    padding: 8px 12px;
    border-radius: 4px;
    margin-top: 4px;
}

.outfit-split-spinner {
    width: 32px; height: 32px;
    border: 3px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.outfit-split-uploaded-thumbs {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    justify-content: center;
    max-width: 600px;
}
.outfit-split-uploaded-thumb {
    width: 56px; height: 72px;
    object-fit: cover;
    border-radius: 4px;
    border: 1px solid var(--border);
}

/* 审核 stage: 列表对齐左 */
#outfitSplitStageReview {
    align-items: stretch;
    text-align: left;
}
#outfitSplitStageReview .outfit-split-tip {
    text-align: left;
    max-width: none;
}

.outfit-split-items-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.outfit-split-item {
    display: grid;
    grid-template-columns: 32px 1fr;
    gap: 12px;
    align-items: center;
    padding: 12px 14px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 8px;
    transition: border-color 0.15s, background 0.15s;
}
.outfit-split-item:hover { border-color: var(--border-hover); }
.outfit-split-item-checked {
    border-color: var(--accent);
    background: var(--accent-dim);
}
.outfit-split-item-dup {
    border-color: rgba(220, 80, 80, 0.5);
    background: rgba(220, 80, 80, 0.06);
}
.outfit-split-item-dup.outfit-split-item-checked {
    border-color: var(--accent);
    background: var(--accent-dim);
}

.outfit-split-check {
    width: 18px; height: 18px;
    accent-color: var(--accent);
    cursor: pointer;
    margin: 0;
    justify-self: center;
}

.outfit-split-thumb {
    width: 96px; height: 96px;
    border-radius: 6px;
    background: #1a1a1a;
    display: block;
}

.outfit-split-item-info {
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 0;
}

.outfit-split-item-head {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.outfit-split-cat-sel {
    background: var(--bg-raised);
    border: 1px solid var(--border);
    color: var(--text-1);
    font-size: 12px;
    font-family: inherit;
    padding: 4px 8px;
    border-radius: 4px;
    cursor: pointer;
}
.outfit-split-cat-sel:hover { border-color: var(--border-hover); }

.outfit-split-app-chip {
    font-size: 11px;
    color: var(--text-3);
    background: var(--bg-raised);
    border: 1px solid var(--border);
    padding: 2px 6px;
    border-radius: 3px;
}

.outfit-split-dup-chip {
    font-size: 11px;
    color: rgba(220, 80, 80, 0.95);
    background: rgba(220, 80, 80, 0.12);
    border: 1px solid rgba(220, 80, 80, 0.4);
    padding: 2px 8px;
    border-radius: 3px;
    cursor: help;
}

.outfit-split-desc {
    font-size: 12px;
    color: var(--text-2);
    line-height: 1.5;
    word-break: break-word;
}

.outfit-split-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding: 14px 20px;
    border-top: 1px solid var(--border);
}

.outfit-split-actions .btn {
    min-width: 100px;
}

/* 工坊产品库 head 双按钮容器 */
.studio-option-head-multi { gap: 6px; }
.studio-upload-actions {
    display: flex;
    gap: 4px;
    flex-shrink: 0;
}

@media (max-width: 600px) {
    .outfit-split-item {
        grid-template-columns: 28px 1fr;
        gap: 8px;
    }
}

/* 工坊主推 ⭐ 按钮 — 槽位 trigger 内（caret 左侧）；点击切换 hero_cat（同一时间最多一个） */
.studio-slot-hero-btn {
    flex: 0 0 auto;
    width: 22px;
    height: 22px;
    padding: 0;
    margin: 0;
    border: 1px solid var(--border);
    background: transparent;
    color: var(--text-3);
    border-radius: 50%;
    cursor: pointer;
    font-family: inherit;
    font-size: 12px;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s ease;
}
.studio-slot-hero-btn:hover {
    border-color: var(--accent);
    color: var(--accent);
    background: var(--accent-dim);
}
.studio-slot-hero-btn.active {
    background: var(--accent);
    border-color: var(--accent);
    color: #0a0a0a;
    box-shadow: 0 0 6px rgba(196, 163, 90, 0.55);
}
.studio-slot-hero-btn.active:hover {
    background: var(--accent);
    color: #0a0a0a;
}
