/* ============================================================================
 * ai-image-input.css — AI 图片生成区块样式 (深色系)
 *
 * 设计:
 *   - 翻译自 ai-studio-app 的 AiImageBoxInputBlock + AiImageBoxInputForm +
 *     SeedanceResultPanel 的 scoped 样式, 适配 omnivideo 的深色主题
 *   - 顶部声明 CSS 变量, 主色复用站点 --theme-color / --theme-btn-color
 *   - 全套类名都以 ai-block- 前缀, 与 seedance-input 完全隔离
 * ========================================================================== */

/* root 变量同时声明在两个根选择器上 — image / video 共用 .ai-block-* 全套基础样式,
 * video 只在 ai-video-input.css 里加 mode-switch / frame-zone / audio-toggle 等特化部分.
 * 拆 root 不抽公共文件是因为两条 island 各自独立维护更直观 (与 SeedanceInput 同款决策) */
.ai-image-input-root,
.ai-video-input-root {
	--ai-surface:        rgb(24 24 27);     /* zinc-900 */
	--ai-surface-2:      rgb(39 39 42);     /* zinc-800 */
	--ai-surface-3:      rgb(63 63 70);     /* zinc-700 */
	--ai-text:           rgb(244 244 245);  /* zinc-100 */
	--ai-text-muted:     rgb(161 161 170);  /* zinc-400 */
	--ai-text-dim:       rgb(113 113 122);  /* zinc-500 */
	--ai-border:         rgba(255, 255, 255, 0.08);
	--ai-border-strong:  rgba(255, 255, 255, 0.16);
	/* 强调色固定走黑白灰素色 — 不引入 theme-color 蓝色, 让操作区融入 omnivideo 整体黑白氛围 */
	--ai-accent:         rgb(244 244 245);  /* zinc-100 (近白) — 主按钮底色 */
	--ai-accent-fg:      rgb(24 24 27);     /* zinc-900 (近黑) — 主按钮字色 */
	--ai-highlight-bg:   rgba(255, 255, 255, 0.10); /* 选项 active 态半透白 */
	/* sticky header 高度: JS 在 mount 时读 #site-nav 实测高度并覆盖,
	 * 作为兜底用 80 (omnivideo 默认 navbar py-4 ≈ 64-80px) */
	--ai-block-header-h: 80px;
	color: var(--ai-text);
}

.ai-block-hidden-input {
	display: none;
}

/* ──────────────────────────── frame / grid ─────────────────────────── */

.ai-block-frame {
	margin: 0 auto;
	width: 100%;
	max-width: 72rem;
	box-sizing: border-box;
}

/* sidebar 模式下撑满主区域: 不再限宽 1152px, 左右边距完全由 anchor padding 控制
 * (与上下边距对等) */
#app-content[data-with-sidebar="true"] .ai-block-frame {
	max-width: none;
}

.ai-block-grid {
	display: grid;
	grid-template-columns: 1fr 1.5fr;
	gap: 16px;
	/* 固定高度: 视口 - sticky header - anchor 上下 padding (py-4 = 32px 总).
	 * grid 撑到 anchor 内框, 上下视觉留白完全由 anchor py 控制. */
	height: calc(100vh - var(--ai-block-header-h) - 32px);
	min-height: 480px;
}

.ai-block-card {
	display: flex;
	flex-direction: column;
	height: 100%;
	min-height: 0;
	background: var(--ai-surface);
	border: 1px solid var(--ai-border);
	border-radius: 16px;
	overflow: hidden;
}

.ai-block-card-output {
	padding: 20px;
	position: relative;
}

@media (max-width: 768px) {
	.ai-block-grid {
		grid-template-columns: 1fr;
		/* 移动端栈式布局, 高度交还自然流; 输入卡按内容自适应, 输出卡撑首屏 */
		height: auto;
		min-height: 0;
		gap: 12px;
	}
	.ai-block-card {
		height: auto;
	}
	.ai-block-card-output {
		height: calc(100vh - var(--ai-block-header-h) - 32px);
		min-height: 360px;
	}
}

/* ──────────────────────────── form layout ─────────────────────────── */

.ai-block-form-header {
	flex-shrink: 0;
	padding: 16px 16px 0;
}

.ai-block-form-body {
	flex: 1;
	min-height: 0;
	overflow-y: auto;
	overflow-x: hidden;
	padding: 12px 16px;
	display: flex;
	flex-direction: column;
	gap: 14px;
}

.ai-block-form-footer {
	flex-shrink: 0;
	padding: 12px 16px 16px;
	border-top: 1px solid var(--ai-border);
	background: var(--ai-surface);
}

@media (max-width: 768px) {
	.ai-block-form-body { overflow: visible; }
	.ai-block-form-footer { border-top: none; padding: 8px 16px 16px; }
}

/* ──────────────────────────── tabs ─────────────────────────── */

.ai-block-tabs {
	display: flex;
	gap: 8px;
	padding: 4px;
	margin-bottom: 12px;
	background: rgba(255, 255, 255, 0.05);
	border-radius: 12px;
}

.ai-block-tab {
	flex: 1;
	padding: 8px 12px;
	font-size: 14px;
	font-weight: 500;
	color: var(--ai-text-muted);
	background: transparent;
	border: none;
	border-radius: 8px;
	cursor: pointer;
	transition: background 160ms ease, color 160ms ease;
}
.ai-block-tab:hover { color: var(--ai-text); }
.ai-block-tab.is-active {
	background: var(--ai-surface-2);
	color: var(--ai-text);
	box-shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
}

/* ──────────────────────────── field 容器 ─────────────────────────── */

.ai-block-field {
	display: flex;
	flex-direction: column;
	gap: 6px;
}
.ai-block-field-label {
	font-size: 13px;
	color: var(--ai-text-muted);
	font-weight: 500;
	line-height: 1.2;
}
.ai-block-field-count {
	margin-left: 6px;
	font-size: 12px;
	font-weight: 400;
	color: var(--ai-text-dim);
	font-variant-numeric: tabular-nums;
}

/* ──────────────────────────── 模型选择行 ─────────────────────────── */

.ai-block-model-row {
	width: 100%;
	position: relative;
}
.ai-block-model-row .ai-block-select {
	width: 100%;
}
.ai-block-model-row .ai-block-select-btn {
	width: 100%;
	min-width: 0;
	height: 40px;
}
.ai-block-model-icon {
	width: 18px;
	height: 18px;
	border-radius: 4px;
	flex-shrink: 0;
	object-fit: cover;
}

/* aspect-ratio 选项前的迷你图标: 居中绘制对应比例的矩形,
 * 颜色继承父按钮 currentColor (默认 muted, 选中/hover 同步变白) */
.ai-block-ratio-icon {
	width: 16px;
	height: 16px;
	flex-shrink: 0;
	color: var(--ai-text-muted);
	transition: color 160ms ease;
}
.ai-block-select-btn:hover .ai-block-ratio-icon,
.ai-block-select-option:hover .ai-block-ratio-icon,
.ai-block-select-option.is-active .ai-block-ratio-icon {
	color: var(--ai-text);
}

/* ──────────────────────────── 上传区 ─────────────────────────── */

.ai-block-material-zone {
	border-radius: 10px;
	box-sizing: border-box;
	min-height: 80px;
	border: 1px dashed transparent;
	background: transparent;
	transition: border-color 160ms ease, background 160ms ease;
}
.ai-block-material-zone.is-empty {
	border-color: var(--ai-border-strong);
	background: rgba(12, 12, 15, 0.5);
}
.ai-block-material-zone.is-drag-over {
	border-color: var(--ai-accent);
	background: rgba(56, 189, 248, 0.08);
}

.ai-block-material-scroll {
	display: flex;
	align-items: center;
	gap: 8px;
	padding: 8px;
	overflow-x: auto;
	overflow-y: hidden;
	scrollbar-width: none;
}
.ai-block-material-scroll::-webkit-scrollbar { display: none; }

.ai-block-empty-state {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 12px;
	width: 100%;
	min-height: 80px;
	padding: 12px;
	cursor: pointer;
	color: var(--ai-text-muted);
	transition: color 160ms ease;
}
.ai-block-empty-state:hover { color: var(--ai-text); }
.ai-block-empty-icon {
	width: 24px;
	height: 24px;
	color: var(--ai-text-muted);
}
.ai-block-empty-text {
	font-size: 13px;
	color: inherit;
}

.ai-block-thumb-card,
.ai-block-add-card {
	width: 64px;
	height: 64px;
	border-radius: 8px;
	flex-shrink: 0;
	box-sizing: border-box;
	overflow: hidden;
	position: relative;
	cursor: pointer;
}
.ai-block-thumb-card {
	border: 1px solid var(--ai-border);
	background: var(--ai-surface-2);
}
.ai-block-thumb-card img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
}
.ai-block-card-remove {
	position: absolute;
	top: 2px;
	right: 2px;
	width: 18px;
	height: 18px;
	border-radius: 50%;
	border: none;
	background: rgba(0, 0, 0, 0.7);
	color: #fff;
	font-size: 14px;
	line-height: 1;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
}
.ai-block-card-remove:hover { background: rgba(0, 0, 0, 0.92); }

.ai-block-add-card {
	border: 1px dashed var(--ai-border-strong);
	background: transparent;
	color: var(--ai-text-muted);
	font-size: 24px;
	display: flex;
	align-items: center;
	justify-content: center;
	transition: border-color 160ms ease, color 160ms ease;
}
.ai-block-add-card:hover {
	border-color: var(--ai-text);
	color: var(--ai-text);
}

/* ──────────────────────────── prompt 输入框 ─────────────────────────── */

.ai-block-prompt-shell {
	background: var(--ai-surface-2);
	border: 1px solid var(--ai-border);
	border-radius: 10px;
	transition: border-color 160ms ease;
	display: flex;
	flex-direction: column;
}
.ai-block-prompt-shell:focus-within {
	border-color: var(--ai-border-strong);
}
.ai-block-prompt-textarea {
	width: 100%;
	min-height: 120px;
	max-height: 360px;
	padding: 12px 14px;
	font-size: 14px;
	line-height: 1.5;
	color: var(--ai-text);
	background: transparent;
	border: none;
	border-radius: 10px 10px 0 0;
	outline: none;
	resize: vertical;
	box-sizing: border-box;
	font-family: inherit;
}
.ai-block-prompt-textarea::placeholder { color: var(--ai-text-dim); }

/* ──────────────────────────── prompt toolbar (字数 + 放大) ─────────────────────────── */

.ai-block-prompt-toolbar {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 8px;
	padding: 4px 6px;
	border-top: 1px solid var(--ai-border);
	background: rgba(255, 255, 255, 0.02);
	border-radius: 0 0 10px 10px;
}
.ai-block-prompt-toolbar-left,
.ai-block-prompt-toolbar-right {
	display: flex;
	align-items: center;
	gap: 4px;
}
.ai-block-prompt-toolbar-counter {
	font-size: 12px;
	color: var(--ai-text-dim);
	font-variant-numeric: tabular-nums;
	padding: 0 4px;
}
.ai-block-prompt-toolbar-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 4px;
	height: 28px;
	padding: 0;
	width: 28px;
	color: var(--ai-text-muted);
	background: transparent;
	border: none;
	border-radius: 6px;
	cursor: pointer;
	transition: background 160ms ease, color 160ms ease, opacity 160ms ease;
	font-size: 12px;
	font-weight: 500;
}
/* 带文字的版本 (AI 改善): 自动撑开宽度容纳 label */
.ai-block-prompt-toolbar-btn-text {
	width: auto;
	padding: 0 8px;
}
.ai-block-prompt-toolbar-btn:hover:not(:disabled) {
	background: rgba(255, 255, 255, 0.06);
	color: var(--ai-text);
}
.ai-block-prompt-toolbar-btn:disabled {
	cursor: not-allowed;
	opacity: 0.4;
}
.ai-block-prompt-toolbar-btn.is-loading {
	color: var(--ai-text);
	cursor: wait;
}
.ai-block-prompt-toolbar-btn-label {
	white-space: nowrap;
}
@media (max-width: 480px) {
	.ai-block-prompt-toolbar-btn-label { display: none; }
	.ai-block-prompt-toolbar-btn-text { width: 28px; padding: 0; }
}
.ai-block-prompt-toolbar-icon {
	width: 16px;
	height: 16px;
	flex: 0 0 auto;
	display: block;
}
/* SVG <img> 元素无法继承 currentColor (svg 内部 fill 已 hardcode), 用 filter 强制翻白
 * 让 ai-edit.svg / loading.svg / img-recognition.svg 等不同来源的 SVG 都呈现统一白色,
 * 与 toolbar 上其他 inline svg (用 currentColor) 视觉对齐. opacity 0.85 → 1 hover 区分态 */
img.ai-block-prompt-toolbar-icon {
	filter: brightness(0) invert(1);
	opacity: 0.78;
	transition: opacity 160ms ease;
}
.ai-block-prompt-toolbar-btn:hover:not(:disabled) img.ai-block-prompt-toolbar-icon,
.ai-block-prompt-toolbar-btn.is-loading img.ai-block-prompt-toolbar-icon {
	opacity: 1;
}
.ai-block-prompt-toolbar-icon.is-spinning {
	animation: ai-block-prompt-toolbar-spin 0.9s linear infinite;
}
@keyframes ai-block-prompt-toolbar-spin {
	to { transform: rotate(360deg); }
}

/* ──────────────────────────── 骨架屏 (Vue mount 前的 SSR 占位) ─────────────────────────── */

/* 骨架屏与实际操作区共用 .ai-block-frame / .ai-block-grid / .ai-block-card 骨架,
 * 高度由相同 calc() 计算 — Vue mount 后 el 的 children 被 template 替换, 视觉无跳变.
 * 灰色脉冲块用单一 .ai-block-skeleton 类承载 shimmer 动画, 不同形状用 modifier */
.ai-block-skeleton {
	background: linear-gradient(
		90deg,
		rgba(255, 255, 255, 0.04) 0%,
		rgba(255, 255, 255, 0.10) 50%,
		rgba(255, 255, 255, 0.04) 100%
	);
	background-size: 200% 100%;
	border-radius: 8px;
	animation: ai-block-skeleton-shimmer 1.4s ease-in-out infinite;
	display: block;
}
@keyframes ai-block-skeleton-shimmer {
	0%   { background-position: 200% 0; }
	100% { background-position: -200% 0; }
}
/* 形状 modifier */
.ai-block-skeleton-tabs    { height: 36px; width: 65%; border-radius: 999px; }
.ai-block-skeleton-line    { height: 14px; }
.ai-block-skeleton-line-sm { height: 12px; width: 40%; }
.ai-block-skeleton-block   { width: 100%; }
.ai-block-skeleton-button  { height: 48px; width: 100%; border-radius: 12px; }
.ai-block-skeleton-pill    { width: 90px; height: 32px; border-radius: 999px; }
.ai-block-skeleton-stage   { flex: 1; min-height: 240px; border-radius: 12px; }

/* 左卡内骨架占位的间距 — 与真实 form-body gap: 14px 对齐 */
.ai-block-skeleton-input-body {
	display: flex;
	flex-direction: column;
	gap: 14px;
}
.ai-block-skeleton-output {
	display: flex;
	flex-direction: column;
	gap: 12px;
	height: 100%;
}
.ai-block-skeleton-actions-row {
	display: flex;
	gap: 8px;
	justify-content: center;
}

/* ──────────────────────────── floating tooltip (JS 驱动) ─────────────────────────── */

/* 系统 title="" 的 tooltip 触发延迟 ≈ 1.5s, 用户根本等不到 → 自写 floating tooltip.
 * 第一版用 CSS ::after, 但 .ai-block-form-body / fs modal 等父级 overflow:auto/hidden
 * 会把 absolute tooltip clip 看不见 — 改成 fixed 定位, JS 在 mount 时挂一个全局元素到
 * body 末尾, mouseover/out 时计算坐标显示, 与 dropdown menu 同款脱离 overflow 思路. */
.ai-block-floating-tt {
	position: fixed;
	left: 0;
	top: 0;
	padding: 5px 9px;
	font-size: 12px;
	font-weight: 400;
	line-height: 1.3;
	color: rgb(244 244 245);
	background: rgba(0, 0, 0, 0.92);
	border-radius: 5px;
	white-space: nowrap;
	pointer-events: none;
	z-index: 10000;
	opacity: 0;
	transform: translateY(2px);
	transition: opacity 100ms ease, transform 100ms ease;
	box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
}
.ai-block-floating-tt.is-visible {
	opacity: 1;
	transform: translateY(0);
}

/* sweetalert2 toast 默认 z-index 1060, 低于 .ai-block-prompt-fs-mask (1100) →
 * AI 改善完成时 toast 被全屏弹窗挡住. 全局 override 把 toast 抬到最顶层
 * (与 .ai-block-floating-tt 同级 10000), 让所有 modal 之上始终能看到反馈 */
body .swal2-container {
	z-index: 12000 !important;
}

/* ==========================================================================
 * 完整定价区样式 (ai_image / ai_video 页 show_pricing_section 块)
 *
 * 与 subscribe.mustache 内 inline `<style>` 同源 — 那里的样式只在 /pricing
 * 单页生效, ai_image / ai_video 拿不到. 这里把 .billing-tab / .plan-card /
 * .plan-price-slider / .carousel-track 全套补一份, 让 ai-block-pricing.js
 * 渲染出的卡片在 ai_image / ai_video 也有正确视觉.
 *
 * 后续 subscribe.mustache 升级样式时, 这里要同步迁移.
 * ========================================================================== */

.billing-tab {
	color: #9ca3af;
	background: transparent;
}
.billing-tab.active {
	color: #ffffff;
	background: #374151;
	box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.3);
}

.plan-card {
	transition: all 0.3s ease;
}
.plan-card.border-theme {
	box-shadow: 0 0 20px color-mix(in srgb, var(--theme-color) 30%, transparent);
}

.plan-price-slider {
	-webkit-appearance: none;
	appearance: none;
	width: 100%;
	height: 6px;
	border-radius: 999px;
	background: #3f3f46;
	outline: none;
	cursor: pointer;
}
.plan-price-slider::-webkit-slider-runnable-track {
	height: 6px;
	border-radius: 999px;
	background: transparent;
}
.plan-price-slider::-webkit-slider-thumb {
	-webkit-appearance: none;
	appearance: none;
	width: 18px;
	height: 18px;
	border-radius: 50%;
	background: #ffffff;
	border: none;
	box-shadow: none;
	margin-top: -6px;
	transition: transform 120ms ease;
}
.plan-price-slider::-webkit-slider-thumb:active {
	transform: scale(1.05);
}
.plan-price-slider::-moz-range-track {
	height: 6px;
	border-radius: 999px;
	background: #3f3f46;
}
.plan-price-slider::-moz-range-thumb {
	width: 18px;
	height: 18px;
	border-radius: 50%;
	background: #ffffff;
	border: none;
	box-shadow: none;
	transition: transform 120ms ease;
}
.plan-price-slider:focus-visible::-webkit-slider-thumb,
.plan-price-slider:focus-visible::-moz-range-thumb {
	box-shadow: none;
}

/* 价格卡片轮播轨道 (移动端) */
.carousel-track {
	transition: transform 300ms ease;
	touch-action: pan-y;
}

/* ──────────────────────────── recognize file input ─────────────────────────── */

/* 隐藏的 file input — display:none 在 Safari 下 click() 失效,
 * 改用 absolute + 0 尺寸 + opacity:0 (与 ai-studio-app 同款) */
.ai-block-recognize-file-input {
	position: absolute;
	width: 1px;
	height: 1px;
	opacity: 0;
	pointer-events: none;
}

/* ──────────────────────────── prompt ideas row ─────────────────────────── */

.ai-block-prompt-ideas-row {
	display: flex;
	align-items: center;
	gap: 8px;
}
.ai-block-prompt-ideas-label {
	flex-shrink: 0;
	font-size: 12px;
	color: var(--ai-text-dim);
	font-weight: 500;
}
.ai-block-prompt-ideas-scroll {
	flex: 1;
	display: flex;
	align-items: center;
	gap: 6px;
	overflow-x: auto;
	scrollbar-width: none;
	scroll-behavior: smooth;
}
.ai-block-prompt-ideas-scroll::-webkit-scrollbar { display: none; }
.ai-block-prompt-ideas-chip {
	flex-shrink: 0;
	max-width: 240px;
	padding: 6px 10px;
	font-size: 12px;
	color: var(--ai-text-muted);
	background: rgba(255, 255, 255, 0.04);
	border: none;
	border-radius: 999px;
	cursor: pointer;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
	transition: background 160ms ease, color 160ms ease;
}
.ai-block-prompt-ideas-chip:hover {
	background: rgba(255, 255, 255, 0.10);
	color: var(--ai-text);
}
.ai-block-prompt-ideas-shuffle {
	flex-shrink: 0;
	width: 28px;
	height: 28px;
	border-radius: 999px;
	background: transparent;
	border: 1px solid var(--ai-border);
	color: var(--ai-text-muted);
	display: flex;
	align-items: center;
	justify-content: center;
	cursor: pointer;
	transition: background 160ms ease, color 160ms ease, border-color 160ms ease;
}
.ai-block-prompt-ideas-shuffle:hover {
	background: rgba(255, 255, 255, 0.05);
	color: var(--ai-text);
	border-color: var(--ai-border-strong);
}
.ai-block-prompt-ideas-shuffle svg {
	width: 14px;
	height: 14px;
	transition: transform 280ms ease;
}
.ai-block-prompt-ideas-shuffle:hover svg {
	transform: rotate(90deg);
}

/* ──────────────────────────── prompt fullscreen modal ─────────────────────────── */

.ai-block-prompt-fs-mask {
	/* 自包含 CSS 变量声明: Teleport 到 body 后失去 .ai-image-input-root 父级作用域,
	 * 不重新声明则 dialog 背景/边框/字色全部 fallback 到空, 用户看到的是
	 * "模糊背景上一个透明卡片". 与 .ai-block-select-menu 同款修复策略. */
	--ai-surface:        rgb(24 24 27);
	--ai-surface-2:      rgb(39 39 42);
	--ai-surface-3:      rgb(63 63 70);
	--ai-text:           rgb(244 244 245);
	--ai-text-muted:     rgb(161 161 170);
	--ai-text-dim:       rgb(113 113 122);
	--ai-border:         rgba(255, 255, 255, 0.08);
	--ai-border-strong:  rgba(255, 255, 255, 0.16);
	--ai-accent:         rgb(244 244 245);
	--ai-accent-fg:      rgb(24 24 27);

	position: fixed;
	inset: 0;
	z-index: 1100;
	background: rgba(0, 0, 0, 0.65);
	backdrop-filter: blur(6px);
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 20px;
	color: var(--ai-text);
}
.ai-block-prompt-fs-dialog {
	width: min(720px, 88vw);
	height: min(480px, 78vh);
	background: var(--ai-surface);
	border: 1px solid var(--ai-border-strong);
	border-radius: 16px;
	display: flex;
	flex-direction: column;
	overflow: hidden;
	box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6);
	color: var(--ai-text);
}
.ai-block-prompt-fs-header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 14px 18px;
	border-bottom: 1px solid var(--ai-border);
}
.ai-block-prompt-fs-title {
	font-size: 15px;
	font-weight: 600;
	color: var(--ai-text);
}
.ai-block-prompt-fs-close {
	width: 28px;
	height: 28px;
	border: none;
	background: transparent;
	font-size: 24px;
	line-height: 1;
	color: var(--ai-text-muted);
	cursor: pointer;
	border-radius: 6px;
	transition: background 160ms ease;
}
.ai-block-prompt-fs-close:hover {
	background: rgba(255, 255, 255, 0.08);
	color: var(--ai-text);
}
.ai-block-prompt-fs-body {
	flex: 1;
	min-height: 0;
	display: flex;
	flex-direction: column;
	padding: 14px 18px 12px;
}
.ai-block-prompt-fs-textarea {
	flex: 1;
	width: 100%;
	min-height: 0;
	padding: 10px 12px;
	font-size: 15px;
	line-height: 1.6;
	color: var(--ai-text);
	background: var(--ai-surface-2);
	border: 1px solid var(--ai-border);
	border-radius: 10px;
	outline: none;
	resize: none;
	font-family: inherit;
	transition: border-color 160ms ease;
}
.ai-block-prompt-fs-textarea:focus {
	border-color: var(--ai-border-strong);
}
.ai-block-prompt-fs-textarea::placeholder { color: var(--ai-text-dim); }
.ai-block-prompt-fs-foot {
	display: flex;
	align-items: center;
	justify-content: flex-end;
	gap: 8px;
	padding-top: 10px;
}
.ai-block-prompt-fs-counter {
	margin-right: auto;
	font-size: 12px;
	color: var(--ai-text-dim);
	font-variant-numeric: tabular-nums;
}
/* fs modal 内 toolbar: 复用 .ai-block-prompt-toolbar 全套样式, 但去掉与 textarea 相邻
 * 的 border-top + 圆角 (fs body 已自带边距, toolbar 视为独立行) */
.ai-block-prompt-fs-toolbar {
	margin-top: 10px;
	padding: 6px;
	border-top: none;
	border-radius: 8px;
	background: var(--ai-surface-2);
}
.ai-block-prompt-fs-done {
	height: 32px;
	padding: 0 16px;
	font-size: 13px;
	font-weight: 600;
	color: var(--ai-accent-fg);
	background: var(--ai-accent);
	border: none;
	border-radius: 8px;
	cursor: pointer;
	transition: opacity 160ms ease;
}
.ai-block-prompt-fs-done:hover { opacity: 0.92; }

@media (max-width: 768px) {
	.ai-block-prompt-fs-mask { padding: 0; }
	.ai-block-prompt-fs-dialog {
		width: 100vw;
		height: 100vh;
		border-radius: 0;
		border-width: 0;
	}
}

/* ──────────────────────────── 参数行 ─────────────────────────── */

.ai-block-params-list {
	display: flex;
	flex-direction: column;
}
.ai-block-param-row {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	padding: 8px 0;
	min-height: 44px;
	position: relative;
}
.ai-block-param-label {
	font-size: 14px;
	color: var(--ai-text-muted);
	flex-shrink: 0;
}
.ai-block-param-row > .ai-block-select {
	flex-shrink: 0;
	margin-left: auto;
	width: 140px;
}

/* ──────────────────────────── select (内联) ─────────────────────────── */

.ai-block-select {
	position: relative;
	display: inline-flex;
}
.ai-block-select-btn {
	display: inline-flex;
	align-items: center;
	justify-content: space-between;
	gap: 8px;
	padding: 8px 12px;
	height: 36px;
	font-size: 14px;
	color: var(--ai-text);
	background: var(--ai-surface-2);
	border: 1px solid var(--ai-border);
	border-radius: 8px;
	cursor: pointer;
	transition: border-color 160ms ease, background 160ms ease;
	box-sizing: border-box;
	width: 100%;
	min-width: 0;
}
.ai-block-select-btn:hover {
	border-color: var(--ai-border-strong);
	background: var(--ai-surface-3);
}
.ai-block-select.is-locked .ai-block-select-btn {
	cursor: not-allowed;
	opacity: 0.85;
}
.ai-block-select-value {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	min-width: 0;
	flex: 1;
}
.ai-block-select-text {
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}
.ai-block-select-chevron {
	width: 16px;
	height: 16px;
	color: var(--ai-text-muted);
	flex-shrink: 0;
	transition: transform 160ms ease;
}
.ai-block-select.is-open .ai-block-select-chevron {
	transform: rotate(180deg);
}
/* menu 走 Teleport 到 <body>, position/top/left/width/transform 由 JS 注入 :style.
 * 不走 absolute, 否则被 .ai-block-form-body (overflow-y: auto) clip 看不见.
 * z-index 提高到 1000, 与 omnivideo 全局 modal 的 z-50 错开.
 * 自包含 CSS 变量声明: Teleport 到 body 后失去 .ai-image-input-root 父级作用域,
 *   不重新声明就会 fallback 到空 (背景透明 + 字色继承 body 默认), 完全失效 */
.ai-block-select-menu {
	--ai-surface-2:      rgb(39 39 42);
	--ai-surface-3:      rgb(63 63 70);
	--ai-text:           rgb(244 244 245);
	--ai-text-muted:     rgb(161 161 170);
	--ai-border-strong:  rgba(255, 255, 255, 0.16);
	--ai-highlight-bg:   rgba(255, 255, 255, 0.10);

	z-index: 1000;
	max-height: 240px;
	overflow-y: auto;
	background: var(--ai-surface-2);
	border: 1px solid var(--ai-border-strong);
	border-radius: 8px;
	box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
	padding: 4px;
	box-sizing: border-box;
	color: var(--ai-text);
}
.ai-block-select-option {
	display: flex;
	align-items: center;
	gap: 8px;
	width: 100%;
	padding: 8px 10px;
	font-size: 14px;
	color: var(--ai-text);
	background: transparent;
	border: none;
	border-radius: 6px;
	cursor: pointer;
	text-align: left;
	transition: background 120ms ease;
}
.ai-block-select-option:hover {
	background: var(--ai-surface-3);
}
.ai-block-select-option.is-active {
	background: var(--ai-highlight-bg);
	color: var(--ai-text);
}

/* ──────────────────────────── generate 按钮 ─────────────────────────── */

.ai-block-generate-btn {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 10px;
	width: 100%;
	height: 48px;
	padding: 0 16px;
	font-size: 15px;
	font-weight: 600;
	color: var(--ai-accent-fg);
	background: var(--ai-accent);
	border: none;
	border-radius: 12px;
	cursor: pointer;
	transition: opacity 160ms ease, transform 160ms ease;
}
.ai-block-generate-btn:hover:not(:disabled) {
	transform: translateY(-1px);
	opacity: 0.92;
}
.ai-block-generate-btn:disabled {
	opacity: 0.5;
	cursor: not-allowed;
}
/* 与首页 #credit-cost-container 同款: rounded 方角胶囊 + bg-black/10 + text-sm,
 * 字重继承父 button 的 600 (font-semibold), 让 generate-btn 内积分胶囊跨页一致 */
.ai-block-credit-cost {
	display: inline-flex;
	align-items: center;
	gap: 4px;
	padding: 0 8px;
	font-size: 14px;
	background: rgba(0, 0, 0, 0.10);
	border-radius: 4px;
}
.ai-block-credit-icon {
	width: 16px;
	height: 16px;
}

/* ──────────────────────────── 结果面板 ─────────────────────────── */

.ai-block-result-header {
	display: flex;
	align-items: center;
	gap: 8px;
	padding-bottom: 10px;
	font-size: 14px;
	color: var(--ai-text-muted);
}
.ai-block-result-label {
	font-weight: 500;
	color: var(--ai-text);
}
.ai-block-result-tag {
	padding: 2px 8px;
	font-size: 12px;
	color: var(--ai-text-muted);
	background: var(--ai-surface-3);
	border-radius: 999px;
}
.ai-block-result-count {
	margin-left: auto;
	font-variant-numeric: tabular-nums;
	color: var(--ai-text-muted);
}
.ai-block-result-count-sep {
	margin: 0 4px;
	opacity: 0.5;
}

.ai-block-result-stage {
	flex: 1;
	min-height: 240px;
	border-radius: 12px;
	background: var(--ai-surface-2);
	display: flex;
	align-items: center;
	justify-content: center;
	position: relative;
	overflow: hidden;
}

.ai-block-result-empty {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 10px;
	color: var(--ai-text-muted);
	padding: 24px;
}
.ai-block-result-empty-icon {
	width: 36px;
	height: 36px;
	color: var(--ai-text-dim);
}
.ai-block-result-empty-text {
	font-size: 14px;
}

.ai-block-result-media {
	width: 100%;
	height: 100%;
	max-height: 100%;
	object-fit: contain;
	display: block;
}

.ai-block-result-audio-wrap {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 12px;
	padding: 24px;
}
.ai-block-result-audio-icon {
	width: 36px;
	height: 36px;
	color: var(--ai-text-muted);
}

.ai-block-result-state {
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 14px;
	padding: 28px;
	text-align: center;
	max-width: 88%;
}
.ai-block-result-prompt {
	font-size: 14px;
	line-height: 1.5;
	color: var(--ai-text);
	display: -webkit-box;
	-webkit-line-clamp: 3;
	-webkit-box-orient: vertical;
	overflow: hidden;
}
.ai-block-result-state-icon {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 40px;
	height: 40px;
	color: var(--ai-text-muted);
}
.ai-block-result-state.is-failed .ai-block-result-state-icon {
	color: rgb(248 113 113);
}
.ai-block-result-spinner {
	width: 28px;
	height: 28px;
	border: 3px solid rgba(255, 255, 255, 0.18);
	border-top-color: var(--ai-text);
	border-radius: 50%;
	animation: ai-block-spin 1s linear infinite;
}
@keyframes ai-block-spin {
	to { transform: rotate(360deg); }
}
.ai-block-result-state-text {
	font-size: 14px;
	color: var(--ai-text-muted);
}
.ai-block-result-state.is-failed .ai-block-result-state-text {
	color: rgb(252 165 165);
}

/* ──────────────────────────── 结果导航 ─────────────────────────── */

.ai-block-result-nav {
	position: absolute;
	top: 50%;
	transform: translateY(-50%);
	width: 36px;
	height: 36px;
	border-radius: 50%;
	background: rgba(0, 0, 0, 0.5);
	border: 1px solid var(--ai-border);
	color: #fff;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	transition: background 160ms ease;
}
.ai-block-result-nav:hover { background: rgba(0, 0, 0, 0.75); }
.ai-block-result-nav:disabled {
	opacity: 0.35;
	cursor: not-allowed;
}
.ai-block-result-nav-prev { left: 12px; }
.ai-block-result-nav-next { right: 12px; }
.ai-block-result-nav svg { width: 18px; height: 18px; }

/* ──────────────────────────── 结果底部 actions ─────────────────────────── */

.ai-block-result-actions {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	padding-top: 12px;
	margin-top: auto;
	flex-shrink: 0;
}
.ai-block-result-action-btn {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	padding: 8px 14px;
	font-size: 13px;
	color: var(--ai-text);
	background: var(--ai-surface-2);
	border: 1px solid var(--ai-border);
	border-radius: 999px;
	text-decoration: none;
	cursor: pointer;
	transition: background 160ms ease, border-color 160ms ease;
}
.ai-block-result-action-btn:hover {
	background: var(--ai-surface-3);
	border-color: var(--ai-border-strong);
}
.ai-block-result-action-btn svg {
	width: 16px;
	height: 16px;
	color: var(--ai-text-muted);
}
.ai-block-result-action-btn:hover svg {
	color: var(--ai-text);
}

/* ──────────────────────────── 预览弹窗 ─────────────────────────── */

.ai-block-preview-mask {
	position: fixed;
	inset: 0;
	background: rgba(0, 0, 0, 0.75);
	backdrop-filter: blur(6px);
	z-index: 1000;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 24px;
}
.ai-block-preview-dialog {
	position: relative;
	max-width: 90vw;
	max-height: 86vh;
	background: var(--ai-surface);
	border: 1px solid var(--ai-border);
	border-radius: 12px;
	overflow: hidden;
	display: flex;
	flex-direction: column;
}
.ai-block-preview-close {
	position: absolute;
	top: 8px;
	right: 8px;
	z-index: 1;
	width: 32px;
	height: 32px;
	border-radius: 50%;
	background: rgba(0, 0, 0, 0.6);
	color: #fff;
	border: none;
	font-size: 22px;
	line-height: 1;
	cursor: pointer;
}
.ai-block-preview-stage {
	display: flex;
	align-items: center;
	justify-content: center;
	max-height: 86vh;
	background: #000;
}
.ai-block-preview-media {
	max-width: 100%;
	max-height: 86vh;
	object-fit: contain;
	display: block;
}
