:root {
    color-scheme: dark;
    --bg-color: #050505;
    --card-bg: #121212;
    --input-bg: #1a1a1a;
    --border-color: #333;
    --accent-color: #d4ff00; /* Neon Lime Green (V1-inspired) */
    --accent-hover: #bde600;
    --text-main: #f0f0f0;
    --text-muted: #888;
    --danger-color: #ff4d4d;
    --glow-strong: rgba(212, 255, 0, 0.34);
    --glow-soft: rgba(212, 255, 0, 0.13);
    --panel-bg: rgba(10, 10, 10, 0.78);
    --panel-border: rgba(255, 255, 255, 0.11);
    
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 24px;
    --radius-pill: 9999px;
    /* 分段切换：未选中轨上块（与「我的生成」参考稿 #262626 一致） */
    --ui-segment-inactive-bg: #262626;
    --ui-segment-inactive-hover-bg: #2e2e2e;

    /* Typography：Inter 界面 / JetBrains 等宽 / VT323 仅系统日志 */
    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --font-mono: 'JetBrains Mono', ui-monospace, 'Cascadia Code', 'Consolas', monospace;
    --font-log: 'VT323', var(--font-mono);

    /* 字号阶梯（少而清晰；全站用变量，避免零碎 rem） */
    --fs-display: clamp(1.65rem, 3.2vw, 2rem);
    --fs-title: 1.125rem;
    --fs-subtitle: 1rem;
    --fs-body: 1rem;
    --fs-label: 0.875rem;
    --fs-caption: 0.75rem;
    --fs-code: 0.875rem;

    --leading-tight: 1.25;
    --leading-snug: 1.35;
    --leading-normal: 1.5;
}

html {
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* 行内 code/kbd 与正文同字号，仅字体族用等宽 */
code, kbd, pre, samp {
    font-family: var(--font-mono);
}

/* --------------------------------------------------------------------------
   分段切换（ui-segmented）— 登录 tab、我的生成 tab 等同源单选样式
   选中：荧光绿实底 + 深色字；未选：深灰底 + 弱化字；外圈浅绿胶囊轨
   -------------------------------------------------------------------------- */
.ui-segmented {
    display: flex;
    align-items: stretch;
    gap: 6px;
    padding: 4px;
    background: rgba(212, 255, 0, 0.07);
    border: 1px solid rgba(212, 255, 0, 0.22);
    border-radius: var(--radius-pill);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05);
    box-sizing: border-box;
}

.ui-segmented .ui-segment {
    flex: 1;
    min-width: 0;
    margin: 0;
    padding: 10px 14px;
    font-size: var(--fs-body);
    font-weight: 600;
    letter-spacing: 0.02em;
    font-family: inherit;
    line-height: var(--leading-tight);
    text-align: center;
    cursor: pointer;
    color: var(--text-muted);
    border: none;
    border-radius: var(--radius-pill);
    background: var(--ui-segment-inactive-bg);
    transition: color 0.2s ease, background 0.2s ease, box-shadow 0.2s ease, filter 0.2s ease;
}

.ui-segmented .ui-segment:hover:not(.is-active):not(.active) {
    color: var(--text-main);
    background: var(--ui-segment-inactive-hover-bg);
}

.ui-segmented .ui-segment.is-active,
.ui-segmented .ui-segment.active {
    color: #0a0a0a;
    background: var(--accent-color);
    box-shadow: 0 4px 20px var(--glow-strong);
}

.ui-segmented .ui-segment.is-active:hover,
.ui-segmented .ui-segment.active:hover {
    background: var(--accent-hover);
    filter: brightness(1.03);
}

.ui-segmented .ui-segment:focus-visible {
    outline: 2px solid var(--accent-color);
    outline-offset: 2px;
}

/* 「我的生成」弹窗：分段控件略放大、轨底加深，与面板层次一致 */
.archive-modal-tabs.ui-segmented {
    margin: 12px 22px 16px;
    padding: 5px;
    border-radius: var(--radius-md);
    background: rgba(0, 0, 0, 0.38);
    border: 1px solid rgba(212, 255, 0, 0.14);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.archive-modal-tabs.ui-segmented .ui-segment {
    font-size: var(--fs-body);
    font-weight: 600;
    padding: 11px 18px;
    border-radius: calc(var(--radius-md) - 4px);
}

body {
    background:
        radial-gradient(circle at 16% 8%, rgba(212, 255, 0, 0.08) 0%, rgba(212, 255, 0, 0) 30%),
        radial-gradient(circle at 84% 12%, rgba(212, 255, 0, 0.05) 0%, rgba(212, 255, 0, 0) 34%),
        var(--bg-color);
    color: var(--text-main);
    font-family: var(--font-sans);
    font-size: var(--fs-body);
    line-height: var(--leading-normal);
    margin: 0;
    padding: 20px;
    min-height: 100vh;
    box-sizing: border-box;
    position: relative;
    overflow-x: hidden;
}

/* V1-inspired background grid overlay */
body::before,
body::after {
    content: "";
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 0;
}

body::before {
    background-image:
        linear-gradient(to right, rgba(255, 255, 255, 0.07) 1px, transparent 1px),
        linear-gradient(to bottom, rgba(255, 255, 255, 0.06) 1px, transparent 1px);
    background-size: calc(100vw / 4) 50vh;
    opacity: 0.18;
}

body::after {
    background:
        radial-gradient(circle at 76% 40%, var(--glow-soft) 0%, transparent 40%),
        radial-gradient(circle at 18% 72%, rgba(255, 255, 255, 0.03) 0%, transparent 36%);
    animation: ambient-float 13s ease-in-out infinite;
}

@keyframes ambient-float {
    0%, 100% { transform: translateY(0px) scale(1); opacity: 0.9; }
    50% { transform: translateY(-10px) scale(1.02); opacity: 1; }
}

/* Icon Button Styles */
.icon-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    padding: 0;
    margin: 0;
    border: none;
    background-color: transparent;
    color: #666;
    cursor: pointer;
    transition: color 0.2s ease, transform 0.2s ease;
    vertical-align: middle;
    line-height: 0;
}

.icon-btn:hover {
    background-color: transparent;
    color: #fff;
    transform: scale(1.1);
}

.icon-btn svg {
    width: 16px;
    height: 16px;
}

#restore-prompt-btn {
    color: #f39c12; 
}

#restore-prompt-btn:hover {
    background-color: transparent;
    color: #ffb833;
}

#ai-expand-btn {
    color: var(--accent-color);
}

#ai-expand-btn:hover {
    color: var(--accent-hover);
}

.loading-spinner {
    border-color: #f3f3f3;
    border-top-color: #3498db;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

h1 {
    text-align: center;
    font-weight: 800;
    letter-spacing: -0.03em;
    margin-bottom: 40px;
    font-size: var(--fs-display);
    line-height: var(--leading-tight);
    color: #fff;
}

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

.container {
    max-width: 1400px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: 350px 1fr;
    gap: 30px;
    align-items: start;
    position: relative;
    z-index: 2;
}

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

.panel {
    background: linear-gradient(180deg, rgba(19, 19, 19, 0.9) 0%, var(--panel-bg) 100%);
    border-radius: var(--radius-lg);
    padding: 30px;
    border: 1px solid var(--panel-border);
    display: flex;
    flex-direction: column;
    transition: transform 0.25s ease, box-shadow 0.25s ease, border-color 0.25s ease;
    backdrop-filter: blur(16px);
    box-shadow: 0 18px 40px rgba(0, 0, 0, 0.5);
    position: relative;
    overflow: hidden;
}

.panel::before {
    content: "";
    position: absolute;
    top: -100px;
    right: -80px;
    width: 240px;
    height: 240px;
    border-radius: 50%;
    background: radial-gradient(circle, var(--glow-soft) 0%, transparent 70%);
    pointer-events: none;
}

.panel:hover {
    border-color: rgba(212, 255, 0, 0.35);
    transform: translateY(-2px);
    box-shadow: 0 24px 54px rgba(0, 0, 0, 0.58), 0 0 0 1px rgba(212, 255, 0, 0.12);
}

h2 {
    font-size: var(--fs-title);
    font-weight: 700;
    line-height: var(--leading-tight);
    margin-bottom: 25px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

/* Form Elements */
label {
    display: block;
    font-size: var(--fs-label);
    line-height: var(--leading-snug);
    color: var(--text-muted);
    margin-bottom: 8px;
    font-weight: 500;
}

input[type="text"],
input[type="number"],
textarea,
select {
    width: 100%;
    background-color: var(--input-bg);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: var(--radius-md);
    padding: 12px 16px;
    color: var(--text-main);
    font-family: inherit;
    font-size: var(--fs-body);
    line-height: var(--leading-snug);
    box-sizing: border-box;
    transition: all 0.2s ease;
}

input:focus,
textarea:focus,
select:focus {
    outline: none;
    border-color: var(--accent-color);
    background-color: #202020;
    box-shadow: 0 0 0 2px rgba(212, 255, 0, 0.2);
}

/*
 * 上传、单选、多选不应套用上面的文字框焦点样式，否则会出现整片绿框 / 圆点后方矩形光晕（易被当成显示 BUG）。
 * 鼠标点击聚焦不画环；键盘 Tab 时用 :focus-visible 显示细环。
 */
input[type="file"]:focus {
    outline: none;
    box-shadow: none;
    border-color: transparent;
    background-color: transparent;
}

input[type="radio"]:focus,
input[type="checkbox"]:focus {
    outline: none;
    box-shadow: none;
    background-color: transparent;
}

input[type="file"]:focus-visible {
    outline: 2px solid rgba(212, 255, 0, 0.4);
    outline-offset: 3px;
    border-radius: var(--radius-sm);
}

input[type="radio"]:focus-visible,
input[type="checkbox"]:focus-visible {
    outline: 2px solid rgba(212, 255, 0, 0.45);
    outline-offset: 2px;
}

textarea {
    resize: vertical;
    min-height: 120px;
}

/* 提示词：高度由脚本随内容撑开，避免内部滚动条与右下角拖拽 */
.prompt-field-group .prompt-field-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
    gap: 10px;
}

.prompt-field-group .prompt-field-head label {
    margin-bottom: 0;
    font-size: var(--fs-label);
    font-weight: 600;
    color: rgba(210, 210, 210, 0.92);
    letter-spacing: 0.06em;
}

.prompt-field-actions {
    display: flex;
    gap: 6px;
    align-items: center;
    flex-shrink: 0;
}

#prompt-text {
    resize: none;
    overflow-y: hidden;
    min-height: 120px;
    max-height: min(80vh, 960px);
    font-size: var(--fs-body);
    line-height: 1.55;
    padding: 11px 13px;
}

/* 高级模式：工作流 JSON 等宽 */
#workflow-json {
    font-family: var(--font-mono);
    font-size: var(--fs-code);
    line-height: var(--leading-snug);
}

/* Ensure select options are readable */
select {
    color-scheme: dark;
}

select option {
    background-color: #1a1a1a !important;
    color: #f0f0f0 !important;
}

/* File Input Styling */
input[type="file"] {
    padding: 10px 0;
    background: transparent;
    color: var(--text-muted);
}

/* Main upload: drag & drop affordance */
#batch-upload-container {
    border-radius: var(--radius-md);
    transition: box-shadow 0.15s ease, border-color 0.15s ease, background 0.15s ease;
    border: 1px dashed rgba(255,255,255,0.16);
    padding: 10px 12px;
}

#batch-upload-container.is-dragover {
    background: rgba(196, 248, 42, 0.06);
    box-shadow: 0 0 0 2px rgba(196, 248, 42, 0.25);
    border-color: rgba(196, 248, 42, 0.55);
}

/* 双图融合 / 言出法随PLUS / Hunyuan3D：与主上传区一致的拖入区域样式 */
#merge-upload-container,
#yanchu-plus-slots-container,
#hunyuan-upload-container {
    transition: box-shadow 0.15s ease, border-color 0.15s ease, background 0.15s ease;
    border-style: dashed;
    border-color: rgba(255, 255, 255, 0.16);
}

#merge-upload-container.is-dragover,
#yanchu-plus-slots-container.is-dragover,
#hunyuan-upload-container.is-dragover {
    background: rgba(196, 248, 42, 0.06);
    box-shadow: 0 0 0 2px rgba(196, 248, 42, 0.25);
    border-color: rgba(196, 248, 42, 0.55);
}

input[type="file"]::file-selector-button {
    background-color: var(--input-bg);
    color: var(--text-main);
    border: 1px solid var(--border-color);
    padding: 8px 16px;
    border-radius: var(--radius-pill);
    cursor: pointer;
    margin-right: 15px;
    transition: all 0.2s;
}
input[type="file"]::file-selector-button:hover {
    background-color: var(--accent-color);
    color: #000;
    border-color: var(--accent-color);
}

/* Buttons */
button {
    background-color: rgba(255, 255, 255, 0.03);
    color: var(--text-main);
    border: 1px solid var(--border-color);
    padding: 14px 24px;
    border-radius: var(--radius-pill);
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: var(--fs-subtitle);
    line-height: var(--leading-tight);
    letter-spacing: 0.02em;
    position: relative;
    overflow: hidden;
}

button:hover {
    background-color: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.18);
}

/* Removed sweep highlight from selection-related buttons */

button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Primary Button (Run) */
#run-btn {
    background-color: var(--accent-color);
    color: #000;
    border-color: var(--accent-color);
    box-shadow: 0 8px 28px var(--glow-strong);
    isolation: isolate;
    contain: paint;
}

#run-btn::after {
    content: "";
    position: absolute;
    inset: 0;
    transform: translateX(-120%);
    background: linear-gradient(120deg, transparent 35%, rgba(255, 255, 255, 0.45) 50%, transparent 65%);
    transition: transform 0.6s ease;
}

#run-btn:hover {
    background-color: var(--accent-hover);
    transform: translateY(-1px);
    box-shadow: 0 10px 34px var(--glow-strong);
}

#run-btn:hover::after {
    transform: translateX(120%);
}

#run-btn:disabled {
    background-color: #555;
    color: #888;
    border-color: #555;
    box-shadow: none;
    transform: none;
}

/* Stop Button */
#stop-btn {
    background-color: transparent;
    border-color: var(--danger-color);
    color: var(--danger-color);
}

#stop-btn:hover:not(:disabled) {
    background-color: var(--danger-color);
    color: #fff;
}

/* 开始生成 + 状态 + 进度：同一卡片，进度为底边细线，避免「多一块」 */
.dynamic-inputs-compact .prompt-field-group {
    margin-bottom: 4px;
}

.execution-dock {
    margin-top: 22px;
    border-radius: var(--radius-md);
    border: 1px solid rgba(255, 255, 255, 0.09);
    background: linear-gradient(180deg, rgba(22, 22, 24, 0.92) 0%, rgba(12, 12, 14, 0.98) 100%);
    box-shadow: 0 8px 28px rgba(0, 0, 0, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.04);
    overflow: hidden;
}

.execution-dock-actions {
    display: flex;
    gap: 12px;
    padding: 12px 12px 10px;
    box-sizing: border-box;
}

.execution-dock-actions #run-btn {
    flex: 2;
    margin: 0;
}

.execution-dock-actions #stop-btn {
    flex: 1;
    margin: 0;
}

/* Status & Progress */
#execution-status {
    margin: 0;
    padding: 10px 12px 0;
    background: rgba(0, 0, 0, 0.22);
    border: none;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 0;
    box-shadow: none;
}

.execution-status-lines {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 4px;
    margin-bottom: 0;
    min-width: 0;
    padding-bottom: 10px;
}

#queue-count.execution-status-state,
.execution-status-state {
    flex: 0 1 auto;
    min-width: 0;
    max-width: 100%;
    font-weight: 600;
    font-size: var(--fs-label);
    line-height: var(--leading-tight);
    color: var(--accent-color);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

#progress-text.execution-status-detail,
.execution-status-detail {
    flex: 1 1 auto;
    min-width: 0;
    font-size: var(--fs-label);
    line-height: var(--leading-snug);
    color: rgba(160, 160, 160, 0.95);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.execution-status-detail .loading-spinner {
    display: inline-block;
    vertical-align: -0.15em;
    width: 12px;
    height: 12px;
    margin-right: 5px;
    border-width: 2px;
    border-style: solid;
}

.execution-status-track {
    width: auto;
    height: 2px;
    margin: 0 -12px 0;
    background-color: rgba(255, 255, 255, 0.06);
    border-radius: 0;
    overflow: hidden;
}

#progress-bar {
    width: 0%;
    height: 100%;
    background: linear-gradient(90deg, var(--accent-color), rgba(212, 255, 0, 0.55));
    box-shadow: 0 0 10px rgba(212, 255, 0, 0.22);
    transition: width 0.3s ease;
}

/* 完成态仅一行主文案时隐藏副行，避免空白占位 */
#progress-text.execution-status-detail:empty {
    display: none;
}

.execution-status-lines:has(#progress-text:empty) {
    padding-bottom: 8px;
}

.status-indicator {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    margin-left: 10px;
    vertical-align: middle;
    background-color: #666;
    transition: background-color 0.3s ease;
}

.status-connected {
    background-color: var(--accent-color);
    box-shadow: 0 0 8px var(--glow-strong);
}

.status-disconnected {
    background-color: #e74c3c; /* Red */
    box-shadow: none;
}

/* 系统日志：终端感等宽 + 主体荧光绿；小字号、隐藏滚动条但仍可滚动 */
#status-log {
    margin-top: 20px;
    background: linear-gradient(180deg, rgba(8, 10, 4, 0.98) 0%, #050505 100%);
    border: 1px solid rgba(212, 255, 0, 0.18);
    box-shadow: inset 0 0 18px rgba(212, 255, 0, 0.05);
    padding: 8px 10px;
    height: 150px;
    overflow-y: auto;
    font-family: var(--font-log);
    font-size: var(--fs-caption);
    line-height: var(--leading-snug);
    color: var(--accent-color);
    text-shadow:
        0 0 3px var(--glow-soft),
        0 0 8px rgba(212, 255, 0, 0.12);
    border-radius: var(--radius-md);
    white-space: pre-wrap;
    letter-spacing: 0.02em;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

#status-log::-webkit-scrollbar {
    display: none;
    width: 0;
    height: 0;
}

/* Image Results */
#image-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 20px;
    min-height: 200px;
}

/* 花丝提取：位图 + SVG 横排，占满一整行网格（避免窄格子把两栏压成上下） */
#image-container .result-item.result-item--huasi {
    grid-column: 1 / -1;
    width: 100%;
    max-width: 100%;
    justify-self: stretch;
    align-items: stretch;
}

/* 位图 | SVG 两列均分整行，行高随较高一侧拉伸（避免 JS 固定高度导致右侧预览高度为 0） */
.huasi-result-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 16px;
    align-items: stretch;
    width: 100%;
    box-sizing: border-box;
}

.huasi-result-left,
.huasi-result-right {
    display: flex;
    flex-direction: column;
    gap: 10px;
    min-width: 0;
    min-height: 0;
}

.huasi-result-left .result-image {
    width: 100%;
    height: auto;
    object-fit: contain;
}

@media (max-width: 640px) {
    .huasi-result-row {
        grid-template-columns: 1fr;
    }
}

/* 实时生成框内：花丝同样横排占满宽度 */
.rlf-content .result-item--huasi {
    width: 100%;
    max-width: 100%;
    align-items: stretch;
}

.result-live-frame {
    min-height: 250px;
    border: 1px dashed rgba(212, 255, 0, 0.35);
    border-radius: var(--radius-md);
    background: linear-gradient(180deg, rgba(9, 10, 9, 0.78) 0%, rgba(6, 6, 6, 0.78) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
}

.rlf-spinner {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    min-height: 250px;
    position: relative;
}

.rlf-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
}

.rlf-content .result-item {
    width: 100%;
    padding: 0;
}

.rlf-content .result-image {
    width: 100%;
    height: auto;
    border-radius: var(--radius-sm);
}

.rlf-content .download-btn {
    margin-top: 10px;
    width: 100%;
}

.result-live-frame.has-result {
    border-color: transparent;
    background: transparent;
    min-height: 0;
}

.result-waiting-radar {
    position: relative;
    width: 170px;
    height: 170px;
    border-radius: 50%;
    opacity: 0.95;
}

.rw-ring {
    position: absolute;
    inset: 0;
    border-radius: 50%;
    border: 1px solid #222;
}

.rw-ring-mid {
    inset: 12%;
    border-style: dashed;
    border-color: #2a2a2a;
}

.rw-ring-inner {
    inset: 25%;
    border-color: #333;
    background: radial-gradient(circle, #0a0a0a 0%, #050505 100%);
}

.rw-arc-glow,
.rw-arc-sharp {
    position: absolute;
    inset: 0;
    border-radius: 50%;
    transform-origin: 50% 50%;
}

.rw-arc-glow {
    background: conic-gradient(from 230deg, transparent 0%, transparent 40%, rgba(212, 255, 0, 0.13) 60%, #d4ff00 82%, transparent 100%);
    -webkit-mask-image: radial-gradient(transparent 63%, black 64%);
    mask-image: radial-gradient(transparent 63%, black 64%);
    filter: blur(7px);
    opacity: 0.8;
}

.rw-arc-sharp {
    background: conic-gradient(from 230deg, transparent 0%, transparent 42%, rgba(212, 255, 0, 0) 62%, #d4ff00 82%, transparent 100%);
    -webkit-mask-image: radial-gradient(transparent 69%, black 70%);
    mask-image: radial-gradient(transparent 69%, black 70%);
}

.rw-scanner {
    position: absolute;
    width: 50%;
    height: 1px;
    left: 50%;
    top: 50%;
    background: #d4ff00;
    transform-origin: 0 0;
    opacity: 0.5;
    box-shadow: 0 0 9px rgba(212, 255, 0, 0.5);
}

.rw-dot {
    display: none;
}

.rw-spin-slow { animation: rw-rotate 8s linear infinite; }
.rw-spin-fast { animation: rw-rotate 4s linear infinite; }
.rw-ping { animation: rw-ping 2s ease-in-out infinite; }

@keyframes rw-rotate {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

@keyframes rw-ping {
    0%, 100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.55); opacity: 0.45; }
}

.result-waiting-text {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    font-size: var(--fs-body);
    color: rgba(255, 255, 255, 0.82);
    letter-spacing: 0.08em;
    text-shadow: 0 1px 8px rgba(0, 0, 0, 0.6);
    user-select: none;
}

.result-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    background: transparent;
    padding: 0;
    border-radius: var(--radius-md);
    border: none;
    transition: all 0.3s ease;
    width: fit-content;
    justify-self: center;
    position: relative;
}

.result-item:hover {
    transform: translateY(-2px);
    box-shadow: none;
}

.result-image {
    width: 100%;
    height: auto;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: transform 0.2s;
    /* iOS Long Press Fix */
    -webkit-touch-callout: default !important;
    -webkit-user-select: auto !important;
    user-select: auto !important;
    pointer-events: auto !important;
}

.result-image:hover {
    transform: scale(1.02);
}

.result-image[draggable="true"] {
    cursor: grab;
}

.result-image[draggable="true"]:active {
    cursor: grabbing;
}

.result-image--external {
    max-height: 360px;
    object-fit: contain;
    background: rgba(0, 0, 0, 0.18);
}

.download-btn {
    display: inline-block;
    padding: 8px 16px;
    background-color: transparent;
    border: 1px solid var(--accent-color);
    color: var(--accent-color);
    text-decoration: none;
    border-radius: var(--radius-pill);
    font-size: var(--fs-label);
    font-weight: 600;
    transition: all 0.2s ease;
    width: 100%;
    text-align: center;
    box-sizing: border-box;
    position: relative;
    overflow: hidden;
    isolation: isolate;
    contain: paint;
}

.download-btn:hover {
    background-color: var(--accent-color);
    color: #000;
    box-shadow: none;
    transform: scale(1.015);
}

.download-btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
    pointer-events: none;
}

/* 本地 3D 查看器说明（无重复 GLB→STL 横栏，与下方预览条 STL 一致） */
.model-import-hint {
    margin: 8px 0 0;
    font-size: var(--fs-caption);
    color: var(--text-muted);
    line-height: 1.45;
}

/* 3D 模型预览卡片底部：全屏 / 下载 GLB / STL / 关闭 */
.result-3d-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    width: 100%;
    margin-top: 10px;
    align-items: stretch;
}

.result-3d-actions .result-3d-btn {
    flex: 1;
    min-width: 0;
}

.result-3d-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px 14px;
    font-family: inherit;
    font-size: var(--fs-caption);
    font-weight: 600;
    letter-spacing: 0.02em;
    border-radius: var(--radius-pill);
    cursor: pointer;
    transition:
        background 0.2s ease,
        color 0.2s ease,
        border-color 0.2s ease,
        transform 0.15s ease,
        box-shadow 0.2s ease;
    box-sizing: border-box;
    border: 1px solid transparent;
    line-height: 1.25;
    -webkit-tap-highlight-color: transparent;
}

a.result-3d-btn {
    text-decoration: none;
}

.result-3d-btn--primary {
    background: rgba(212, 255, 0, 0.11);
    border-color: rgba(212, 255, 0, 0.42);
    color: var(--accent-color);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

.result-3d-btn--primary:hover {
    background: var(--accent-color);
    color: #0a0a0a;
    border-color: var(--accent-color);
    box-shadow: 0 4px 20px var(--glow-soft);
    transform: translateY(-1px);
}

.result-3d-btn--secondary {
    background: rgba(255, 255, 255, 0.04);
    border-color: rgba(212, 255, 0, 0.32);
    color: #e6ffb3;
}

.result-3d-btn--secondary:hover {
    background: rgba(212, 255, 0, 0.14);
    border-color: rgba(212, 255, 0, 0.55);
    color: var(--accent-color);
    transform: translateY(-1px);
}

.result-3d-btn--stl {
    background: linear-gradient(165deg, rgba(212, 255, 0, 0.14), rgba(212, 255, 0, 0.05));
    border-color: rgba(212, 255, 0, 0.38);
    color: #efffcc;
}

.result-3d-btn--stl:hover {
    background: var(--accent-color);
    color: #0a0a0a;
    border-color: var(--accent-color);
    box-shadow: 0 0 22px var(--glow-soft);
    transform: translateY(-1px);
}

.result-3d-btn--danger {
    flex: 0.62 !important;
    min-width: 76px !important;
    background: rgba(255, 77, 77, 0.09);
    border-color: rgba(255, 77, 77, 0.42);
    color: #ff8a8a;
}

.result-3d-btn--danger:hover {
    background: rgba(255, 77, 77, 0.22);
    border-color: var(--danger-color);
    color: #fff;
    transform: translateY(-1px);
}

.result-item {
    position: relative;
}

.result-select {
    position: absolute;
    top: 8px;
    left: 8px;
    z-index: 2;
    display: inline-flex;
    align-items: center;
    gap: 0;
    padding: 0;
    border: none;
    background: transparent;
    backdrop-filter: none;
    user-select: none;
}

.result-select input[type="checkbox"] {
    width: 22px;
    height: 22px;
    margin: 1px;
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    border: 1px solid rgba(255, 255, 255, 0.45);
    border-radius: 5px;
    background: rgba(0, 0, 0, 0.68);
    display: inline-grid;
    place-content: center;
    overflow: hidden;
    box-sizing: border-box;
    transition: border-color 0.18s ease, background-color 0.18s ease, transform 0.18s ease;
}

.result-select input[type="checkbox"]::before {
    content: "";
    width: 12px;
    height: 12px;
    transform: scale(0);
    transform-origin: center;
    transition: transform 0.14s ease;
    background: var(--accent-color);
    border-radius: 2px;
}

.result-select input[type="checkbox"]:checked {
    border-color: var(--accent-color);
    background: rgba(212, 255, 0, 0.12);
    box-shadow: none;
    transform: scale(1.04);
}

.result-select input[type="checkbox"]:checked::before {
    transform: scale(1);
}

.result-select input[type="checkbox"]:focus-visible {
    outline: 2px solid rgba(212, 255, 0, 0.55);
    outline-offset: 1px;
}

.result-item.is-selected {
    outline: none;
    box-shadow: none;
    border-radius: 0;
}

/* Modal — 须高于「我的生成」归档层 (.archive-modal z-index: 20000)，否则大图压在面板后面 */
#image-modal.modal {
    z-index: 21001;
}

/* Modal */
.modal {
    display: none; 
    position: fixed; 
    z-index: 1000; 
    left: 0;
    top: 0;
    width: 100%; 
    height: 100%; 
    overflow: auto; 
    background-color: rgba(0,0,0,0.9); 
    backdrop-filter: blur(5px);
}

.modal-nav {
    position: fixed;
    top: 50%;
    transform: translateY(-50%);
    z-index: 1002;
    width: 52px;
    height: 52px;
    border-radius: 9999px;
    border: 1px solid rgba(196, 248, 42, 0.35);
    background: rgba(0, 0, 0, 0.35);
    color: var(--accent-color);
    font-size: 34px;
    line-height: 1;
    cursor: pointer;
    display: none; /* only when modal open */
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(6px);
    transition: transform 0.15s ease, background 0.15s ease, border-color 0.15s ease;
}

.modal-nav:hover {
    background: rgba(196, 248, 42, 0.12);
    border-color: rgba(196, 248, 42, 0.6);
    transform: translateY(-50%) scale(1.05);
}

.modal-prev { left: 18px; }
.modal-next { right: 18px; }

.modal-toolbar {
    position: fixed;
    left: 50%;
    top: 16px;
    transform: translateX(-50%);
    z-index: 1002;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    border-radius: 9999px;
    border: 1px solid rgba(255,255,255,0.12);
    background: rgba(0,0,0,0.35);
    backdrop-filter: blur(6px);
}

.modal-counter {
    color: rgba(255,255,255,0.75);
    font-size: var(--fs-label);
    padding: 0 8px;
    user-select: none;
}

.modal-download-btn {
    width: auto;
    padding: 8px 12px;
    font-size: var(--fs-label);
}

.modal-content {
    margin: auto;
    display: block;
    max-width: 90%;
    max-height: 90vh;
    border-radius: var(--radius-sm);
    box-shadow: 0 0 30px rgba(0,0,0,0.5);
    position: relative;
    top: 50%;
    transform: translateY(-50%);
    cursor: zoom-in;
    transition: transform 0.2s ease;
    /* iOS Long Press Fix */
    -webkit-touch-callout: default !important;
    -webkit-user-select: auto !important;
    user-select: auto !important;
    pointer-events: auto !important;
}

.modal-content.full-size {
    max-width: none !important;
    max-height: none !important;
    width: auto !important;
    height: auto !important;
    position: relative !important;
    top: 0 !important;
    transform: none !important;
    margin: 40px auto !important;
    cursor: zoom-out !important;
    box-shadow: 0 0 50px rgba(0,0,0,0.8);
}

.close-modal {
    position: absolute;
    top: 20px;
    right: 35px;
    color: #f1f1f1;
    font-size: 40px;
    font-weight: bold;
    transition: 0.3s;
    cursor: pointer;
    z-index: 1001;
}

.close-modal:hover,
.close-modal:focus {
    color: var(--accent-color);
    text-decoration: none;
    cursor: pointer;
}

/* Workflow Grid */
.workflow-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    margin-top: 10px;
}

.workflow-card {
    /* 介于 body / label 之间：略小于正文，避免「傻大」，仍保证可读 */
    font-size: 0.9375rem;
    background-color: var(--input-bg);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-sm);
    padding: 11px 10px;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    text-align: center;
    color: var(--text-muted);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 56px;
    word-break: break-word;
    position: relative;
    overflow: hidden;
    gap: 5px;
}

.workflow-title {
    font-size: 1em;
    font-weight: 600;
    line-height: 1.2;
    letter-spacing: 0.045em;
    color: var(--accent-color);
}

.workflow-desc {
    font-size: 0.86em;
    font-weight: 400;
    opacity: 0.66;
    line-height: 1.38;
    letter-spacing: 0.055em;
}

.workflow-card:hover {
    border-color: var(--accent-color);
    color: var(--text-main);
    background-color: #202020;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}

.workflow-card:hover .workflow-desc {
    opacity: 0.9;
}

.workflow-card.active {
    background-color: var(--accent-color);
    color: #000;
    border-color: var(--accent-color);
    box-shadow: none;
    transform: scale(1.02);
}

.workflow-card.active .workflow-title {
    font-weight: 600;
    color: #0a0a0a;
    letter-spacing: 0.03em;
}

.workflow-card.active .workflow-desc {
    color: #000;
    opacity: 0.7;
    font-weight: 500;
}

.workflow-card.active::after {
    content: '●';
    position: absolute;
    top: 5px;
    right: 5px;
    font-size: 8px;
    color: #000;
    opacity: 0.5;
}

/* Workflow Toggle & Header */
.workflow-toggle-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 16px;
    background-color: var(--input-bg);
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.2s ease;
    user-select: none;
    position: relative;
    overflow: hidden;
    isolation: isolate;
    contain: paint;
}

.workflow-toggle-header.is-primary-selector {
    background: var(--accent-color);
    color: #000;
    border-color: rgba(196, 248, 42, 0.95);
    box-shadow: none;
}

.workflow-toggle-header:hover {
    border-color: #444;
    background-color: #222;
}

.workflow-toggle-header.is-primary-selector:hover {
    background: var(--accent-hover);
    border-color: rgba(196, 248, 42, 1);
    transform: translateY(-1px);
}

.workflow-toggle-header.is-primary-selector.open {
    background: var(--accent-hover);
    border-color: rgba(196, 248, 42, 1);
    box-shadow: none;
    transform: scale(1.015);
}

.brand-title {
    position: relative;
    z-index: 2;
}

/* 品牌放在左侧 panel 顶部：同栏全宽，大字 + 大 Logo 撑满视觉宽度 */
.controls-panel-compact > .brand-title.brand-title-stack {
    width: 100%;
    max-width: none;
    margin: 0 0 16px;
    padding: 0 0 16px;
    min-width: 0;
    min-height: 72px;
    box-sizing: border-box;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    flex-wrap: nowrap;
    gap: 14px;
    align-items: center;
}

.controls-panel-compact > .brand-title .brand-logo-pixel {
    height: 68px;
    width: auto;
}

.controls-panel-compact > .brand-title .brand-headline-block {
    flex: 1 1 0;
    min-width: 0;
    gap: 8px;
    align-items: stretch;
    justify-content: center;
    width: auto;
}

.controls-panel-compact > .brand-title .brand-line-primary {
    font-size: clamp(1rem, 6vw, 1.52rem);
    font-weight: 900;
    line-height: 1.14;
    width: 100%;
}

.controls-panel-compact > .brand-title .brand-line-en {
    font-size: clamp(0.82rem, 4.6vw, 1.12rem);
    font-weight: 700;
    letter-spacing: 0.08em;
    line-height: 1.22;
    width: 100%;
}

.brand-title-stack {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 12px;
    flex-wrap: nowrap;
}

.brand-logo-pixel {
    flex-shrink: 0;
    display: block;
    height: 68px;
    width: auto;
    filter: drop-shadow(0 0 10px rgba(255, 255, 255, 0.3));
}

.brand-headline-block {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
    min-width: 0;
    flex: 0 1 auto;
}

.brand-line-primary {
    margin: 0;
    font-size: clamp(1.05rem, 2.2vw, 1.5rem);
    font-weight: 800;
    letter-spacing: 0.04em;
    color: rgba(255, 255, 255, 0.98);
    line-height: 1.2;
    text-align: left;
    overflow-wrap: break-word;
}

.brand-name-zh,
.brand-product-zh {
    letter-spacing: 0.06em;
}

.brand-dot {
    color: rgba(255, 255, 255, 0.42);
    font-weight: 800;
}

.brand-line-en {
    margin: 0;
    font-family: var(--font-sans);
    font-size: clamp(0.78rem, 1.35vw, 0.95rem);
    font-weight: 600;
    letter-spacing: 0.1em;
    color: rgba(196, 248, 42, 0.92);
    line-height: 1.3;
    text-align: left;
    width: 100%;
    padding-left: 0.06em;
}

/* 窄屏：panel 全宽，品牌再放大一档 */
@media (max-width: 900px) {
    .controls-panel-compact > .brand-title .brand-logo-pixel {
        height: 72px;
    }

    .controls-panel-compact > .brand-title .brand-line-primary {
        font-size: clamp(1.08rem, 4.5vw, 1.68rem);
    }

    .controls-panel-compact > .brand-title .brand-line-en {
        font-size: clamp(0.9rem, 3.6vw, 1.22rem);
    }
}

@media (max-width: 520px) {
    .brand-title-stack {
        flex-direction: row;
        align-items: center;
        justify-content: flex-start;
        gap: 8px;
    }

    .brand-headline-block {
        gap: 4px;
        align-items: flex-start;
        width: auto;
    }

    .brand-line-primary,
    .brand-line-en {
        text-align: left;
    }

    .brand-line-en {
        padding-left: 0.08em;
    }
}

/* Keep motion subtle for production usage */
@media (prefers-reduced-motion: no-preference) {
    .panel,
    .result-item,
    .workflow-card {
        animation: rise-in 0.5s ease both;
    }

    .panel:nth-child(2) { animation-delay: 0.08s; }
}

@keyframes rise-in {
    from {
        opacity: 0;
        transform: translateY(8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.workflow-toggle-left {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
    overflow: hidden;
}

.workflow-toggle-label {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 140px;
}

.workflow-toggle-title {
    font-size: var(--fs-body);
    font-weight: 800;
    letter-spacing: 0.02em;
    color: rgba(255,255,255,0.92);
}

.workflow-toggle-subtitle {
    font-size: var(--fs-caption);
    color: rgba(255,255,255,0.48);
    letter-spacing: 0.02em;
}

/* Primary selector text colors */
.workflow-toggle-header.is-primary-selector .workflow-toggle-title {
    color: rgba(0,0,0,0.92);
}
.workflow-toggle-header.is-primary-selector .workflow-toggle-subtitle {
    color: rgba(0,0,0,0.65);
}

.workflow-current-name {
    color: var(--accent-color);
    font-size: 0.9em;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* 长名靠右与箭头协调；四字等短名用 min-width + 右对齐，避免紧贴左侧栏目标题 */
.workflow-current-name.pill {
    margin-left: auto;
    flex-shrink: 1;
    min-width: 5.75em;
    text-align: right;
    max-width: 55%;
    padding: 0;
    border-radius: 0;
    border: none;
    background: transparent;
    color: rgba(0,0,0,0.95);
    font-weight: 900;
    font-size: var(--fs-body);
}

.workflow-arrow {
    font-size: 0.8em;
    color: var(--text-muted);
    transition: transform 0.3s ease;
}

.workflow-toggle-header.is-primary-selector .workflow-arrow {
    color: rgba(0,0,0,0.75);
}

/* Rotate arrow when open */
.workflow-toggle-header.open .workflow-arrow {
    transform: rotate(180deg);
}

/* 工作流列表尚未从服务器拉取完成时：下三角改为转圈 */
@keyframes workflow-list-arrow-spin {
    to {
        transform: rotate(360deg);
    }
}

.workflow-section.workflow-list-loading .workflow-toggle-header {
    pointer-events: none;
}

.workflow-section.workflow-list-loading .workflow-toggle-header .workflow-arrow {
    font-size: 0;
    color: transparent;
    overflow: hidden;
    width: 15px;
    height: 15px;
    min-width: 15px;
    min-height: 15px;
    box-sizing: border-box;
    border: 2px solid rgba(0, 0, 0, 0.2);
    border-top-color: rgba(0, 0, 0, 0.72);
    border-radius: 50%;
    vertical-align: middle;
    transition: none;
    animation: workflow-list-arrow-spin 0.7s linear infinite;
}

.workflow-section.workflow-list-loading .workflow-toggle-header.open .workflow-arrow {
    transform: none;
    animation: workflow-list-arrow-spin 0.7s linear infinite;
}

@media (prefers-reduced-motion: reduce) {
    .workflow-section.workflow-list-loading .workflow-toggle-header .workflow-arrow {
        animation: none;
        border-color: rgba(0, 0, 0, 0.35);
        border-top-color: rgba(0, 0, 0, 0.72);
        opacity: 0.85;
    }
}

.workflow-grid-wrapper {
    display: none; /* Hidden by default (folded) */
    margin-top: 10px;
    animation: slideDown 0.3s ease-out;
}

.workflow-grid-wrapper.open {
    display: block;
}

@keyframes slideDown {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* --- Compact controls & upload layout (preview | operations) --- */
.controls-panel-compact.panel {
    padding: 22px 20px 26px;
}

.controls-panel-compact h2.controls-heading {
    margin-top: 0;
    margin-bottom: 16px;
    font-size: var(--fs-title);
}

.dynamic-inputs-compact {
    border-top: 1px solid var(--border-color);
    padding-top: 14px;
    margin-top: 8px;
}

.input-image-group-compact {
    margin-top: 12px;
}

.image-mode-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px 14px;
    margin-bottom: 10px;
    padding: 8px 10px;
    font-size: var(--fs-label);
    background-color: var(--input-bg);
    border-radius: var(--radius-sm);
    border: 1px solid rgba(255, 255, 255, 0.06);
}

.image-mode-toolbar-label {
    font-weight: 700;
    color: var(--text-muted);
    margin-right: 4px;
}

.image-mode-option {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    cursor: pointer;
    color: var(--text-main);
}

.batch-upload-layout {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
    align-items: start;
}

/* 勿用 auto + 1fr：多图 flex 时左侧 max-content 极宽，会把右侧压成一条导致文案竖排、文件框畸形 */
.batch-upload-layout.has-previews {
    grid-template-columns: minmax(0, min(320px, 52%)) minmax(0, 1fr);
    gap: 12px;
}

.batch-upload-visual {
    display: none;
    flex-direction: column;
    align-items: flex-start;
    justify-content: flex-start;
    min-width: 0;
    max-width: 100%;
}

.batch-upload-layout.has-previews .batch-upload-visual {
    display: flex;
}

.batch-upload-ops {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

#batch-upload-container .batch-upload-ops input[type="file"] {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}

.batch-upload-label {
    font-size: var(--fs-label);
    font-weight: 600;
    color: var(--text-muted);
    margin: 0;
}

.upload-hint-compact {
    margin: 0;
    font-size: var(--fs-caption);
    color: var(--text-muted);
    line-height: 1.35;
    overflow-wrap: anywhere;
}

.file-input-compact {
    padding: 6px 0 !important;
    font-size: var(--fs-label) !important;
}

.image-preview-mini {
    max-width: 100%;
}

.image-preview-mini > div {
    max-width: 100%;
}

/* 批量预览：与 .batch-upload-visual 同列，需限制宽度避免撑爆 grid */
.batch-preview-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-content: flex-start;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}

.batch-preview-grid .batch-preview-info {
    flex: 1 0 100%;
    margin: 0 0 4px;
    font-size: var(--fs-label);
    color: var(--text-muted);
}

.merge-upload-panel {
    background: var(--input-bg);
    padding: 10px 10px 12px;
    border-radius: var(--radius-sm);
    border: 1px solid rgba(255, 255, 255, 0.06);
}

.merge-upload-title {
    font-weight: 700;
    font-size: var(--fs-label);
    color: var(--text-muted);
    margin-bottom: 10px;
}

.merge-slots-stack {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.merge-slot-compact {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 10px;
    align-items: center;
    padding: 8px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: var(--radius-sm);
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.merge-slot-thumb {
    margin-top: 0 !important;
    width: 88px;
    height: 88px;
    flex-shrink: 0;
    display: none;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.25);
    border-radius: var(--radius-sm);
}

.merge-thumb-img {
    display: block;
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    object-fit: contain;
    border-radius: 4px;
}

.merge-slot-ops {
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 0;
}

.merge-slot-tag {
    font-size: var(--fs-label);
    font-weight: 600;
    color: var(--text-muted);
}

.merge-slot-compact .delete-btn {
    top: 2px;
    right: 2px;
    width: 20px;
    height: 20px;
    font-size: 12px;
}

@media (max-width: 520px) {
    .batch-upload-layout.has-previews {
        grid-template-columns: 1fr;
    }

    .batch-upload-layout.has-previews .batch-upload-visual {
        width: 100%;
        max-width: none;
    }
}

/* --- 内嵌图像标注说明 --- */
.annotate-feature-desc {
    margin: 8px 0 4px;
    font-size: var(--fs-caption);
    line-height: 1.45;
    color: var(--text-muted);
}

.merge-annotate-desc {
    margin-top: 0;
    margin-bottom: 10px;
}

img.preview-annotateable {
    cursor: pointer;
}

.ia-modal {
    position: fixed;
    inset: 0;
    z-index: 20000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    box-sizing: border-box;
}

.ia-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.72);
    backdrop-filter: blur(4px);
}

.ia-modal-dialog {
    position: relative;
    z-index: 1;
    max-width: min(980px, 100%);
    max-height: min(92vh, 900px);
    overflow: auto;
    background: linear-gradient(180deg, #161616 0%, #0d0d0d 100%);
    border: 1px solid var(--panel-border);
    border-radius: var(--radius-md);
    box-shadow: 0 24px 80px rgba(0, 0, 0, 0.65);
    padding: 14px 16px 16px;
}

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

.ia-modal-head h3 {
    margin: 0;
    font-size: var(--fs-subtitle);
    font-weight: 700;
    color: var(--text-main);
}

.ia-close-x {
    width: 36px;
    height: 36px;
    border: none;
    border-radius: var(--radius-sm);
    background: rgba(255, 255, 255, 0.06);
    color: var(--text-main);
    font-size: 1.4rem;
    line-height: 1;
    cursor: pointer;
}

.ia-close-x:hover {
    background: rgba(255, 80, 80, 0.25);
    color: #fff;
}

.ia-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px 8px;
    margin-bottom: 10px;
    padding: 8px 10px;
    background: var(--input-bg);
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-color);
}

.ia-toolbar-label {
    font-size: var(--fs-caption);
    color: var(--text-muted);
    margin-right: 2px;
}

.ia-toolbar .tool,
.ia-overlay-hint {
    margin: 0 0 10px;
    padding: 0 2px;
    font-size: var(--fs-caption);
    line-height: 1.45;
    color: var(--text-muted);
}

.ia-overlay-hint kbd {
    display: inline-block;
    padding: 0 4px;
    font-size: var(--fs-caption);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 3px;
    background: rgba(0, 0, 0, 0.35);
}

.ia-modal-dialog .tool {
    padding: 5px 10px;
    font-size: var(--fs-label);
    border-radius: 6px;
}

.ia-toolbar .tool.active {
    background: rgba(212, 255, 0, 0.18);
    border-color: var(--accent-color);
    color: var(--accent-color);
}

.ia-current-swatch {
    display: inline-block;
    width: 26px;
    height: 26px;
    border-radius: 6px;
    border: 2px solid var(--border-color);
    flex-shrink: 0;
}

.ia-color-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}

.ia-color-tags button.tag {
    width: 26px;
    height: 26px;
    border-radius: 6px;
    border: 2px solid transparent;
    cursor: pointer;
    padding: 0;
}

.ia-color-tags button.tag[data-active="true"] {
    border-color: #fff;
    box-shadow: 0 0 0 1px #000;
}

/* 视口限制在弹窗内，画布保持原图像素（或上限内），避免为「塞进屏幕」而整体降采样导致导出模糊 */
.ia-canvas-scroll {
    max-width: 100%;
    max-height: min(55vh, 720px);
    overflow: auto;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    background: #0a0a0a;
    line-height: 0;
}

.ia-canvas-wrap {
    position: relative;
    display: inline-block;
    border: none;
    border-radius: 0;
    overflow: hidden;
    background: #0a0a0a;
    line-height: 0;
}

.ia-canvas-wrap .layer-shapes,
.ia-canvas-wrap .layer-raster {
    position: absolute;
    left: 0;
    top: 0;
}

.ia-canvas-wrap .layer-shapes {
    z-index: 1;
}

.ia-canvas-wrap .layer-raster {
    z-index: 2;
}

.ia-canvas-wrap .layer-raster canvas {
    display: block;
}

.ia-canvas-wrap .layer-bg {
    pointer-events: none;
}

.ia-eyedropper-overlay {
    position: absolute;
    left: 0;
    top: 0;
    right: 0;
    bottom: 0;
    z-index: 20;
    cursor: crosshair;
    background: transparent;
}

.ia-eyedropper-overlay.hidden {
    display: none !important;
    pointer-events: none !important;
}

.ia-export-preview-panel {
    margin-top: 10px;
    padding: 8px 10px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    background: var(--input-bg);
}

.ia-export-preview-panel.hidden {
    display: none !important;
}

.ia-export-preview-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 6px;
    font-size: var(--fs-label);
    color: var(--text-muted);
}

.ia-export-preview-frame {
    line-height: 0;
    border-radius: 4px;
    overflow: hidden;
    background: repeating-conic-gradient(#1a1a1a 0% 25%, #222 0% 50%) 50% / 16px 16px;
}

.ia-export-preview-frame img {
    display: block;
    max-width: 100%;
    height: auto;
}

.ia-modal-footer {
    margin-top: 12px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.ia-status {
    font-size: var(--fs-label);
    color: var(--text-muted);
    white-space: pre-wrap;
    min-height: 1.2em;
}

.ia-footer-btns {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: flex-end;
}

.ia-primary {
    background: var(--accent-color) !important;
    color: #000 !important;
    border-color: var(--accent-color) !important;
    font-weight: 700 !important;
}

.ia-primary:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

/* 网站底部备案号（index / auth / admin 共用） */
.site-icp-footer {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 40;
    padding: 6px 12px 10px;
    text-align: center;
    font-size: 11px;
    line-height: 1.4;
    color: rgba(255, 255, 255, 0.4);
    background: linear-gradient(to top, rgba(0, 0, 0, 0.45), rgba(0, 0, 0, 0));
    pointer-events: none;
}
.site-icp-footer a {
    pointer-events: auto;
    color: rgba(255, 255, 255, 0.5);
    text-decoration: none;
}
.site-icp-footer a:hover {
    color: rgba(255, 255, 255, 0.78);
    text-decoration: underline;
}
