@layer views {

.hidden-file {
  display: none;
}
.file-list {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}
.file-empty,
.file-chip {
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  border-radius: var(--radius-md);
  padding: 0 var(--space-3);
  font-size: 12px;
}
.file-empty {
  border: 1px solid var(--line);
  color: var(--muted);
}
.file-chip {
  gap: var(--space-2);
  background: var(--primary-soft);
  color: var(--primary-text);
  font-weight: 850;
}
.file-chip em {
  color: color-mix(in oklch, var(--primary-text) 68%, var(--muted));
  font-size: 11px;
  font-style: normal;
  font-weight: 700;
}
/* 圆形小按钮规则只属于「×移除」钮——文件名如今也是个 button（点击预览），
   不圈定选择器会把整个文件名压进 20px 圆圈、长名逐字竖排溢出（走查实测 chip 仅 72px 宽） */
.file-chip button[data-remove-file],
.file-chip button[data-remove-pending] {
  width: 40px;
  height: 40px;
  border: 0;
  border-radius: 50%;
  background: color-mix(in oklch, var(--primary) 12%, transparent);
  color: var(--primary-text);
  cursor: pointer;
}
.material-field textarea {
  width: 100%;
  min-height: 170px;
  margin-top: var(--space-2);
  background:
    repeating-linear-gradient(180deg, transparent 0 31px, color-mix(in oklch, var(--line) 36%, transparent) 31px 32px),
    var(--surface);
  font-size: 15px;
}
.model-picker {
  grid-area: models;
  width: max-content;
  max-width: 100%;
  min-height: 42px;
  display: inline-flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 6px;
  min-width: 0;
  overflow: hidden;
}
#skillButton {
  grid-area: skill;
  min-width: 92px;
}
#generateBtn {
  grid-area: generate;
  min-width: 36px;
}
.prompt-inline {
  grid-area: prompt;
  width: 100%;
  min-width: 0;
}@media (max-width: 760px) {
  .model-picker {
    width: 100%;
    flex-wrap: wrap;
  }
  #skillButton,
  #generateBtn {
    width: 100%;
  }}


/* 生成约束（全片时长 / 分镜数）：内嵌动作栏「+」右边的现代胶囊控件，留空=不限 */
.gen-constraints {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}
.gen-chip {
  position: relative; /* 预设菜单相对它向上弹 */
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 30px;
  padding: 0 10px;
  border-radius: 999px;
  background: color-mix(in oklch, var(--primary-soft) 46%, var(--surface));
  border: 1px solid color-mix(in srgb, var(--primary) 16%, var(--line));
  font-size: 12px;
  line-height: 1;
  color: var(--ink);
  cursor: pointer; /* 整颗胶囊可点（点任意处弹出预设） */
  transition: border-color 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
}
.gen-chip input { cursor: text; }
.gen-chip:hover { border-color: color-mix(in srgb, var(--primary) 32%, var(--line)); }
.gen-chip:focus-within {
  background: var(--surface);
  border-color: var(--primary);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--primary) 16%, transparent);
}
.gen-chip-key { color: var(--muted); font-weight: 600; white-space: nowrap; }
.gen-chip-unit { color: var(--muted); white-space: nowrap; }
.gen-chip input {
  width: 38px;
  min-width: 0;
  padding: 0;
  border: 0;
  background: transparent;
  font: inherit;
  font-size: 12px;
  font-weight: 600;
  color: var(--ink);
  text-align: center;
  appearance: textfield;
  -moz-appearance: textfield;
}
.gen-chip input::-webkit-outer-spin-button,
.gen-chip input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.gen-chip input:focus { outline: none; }
.gen-chip input::placeholder { color: var(--muted); font-weight: 400; }
.gen-chip input:disabled { color: var(--muted); cursor: not-allowed; }
/* 常用预设：聚焦胶囊时向上弹出，同款现代设计（圆角软卡片，hover 高亮），点选填值；仍可直接在胶囊里输入 */
.gen-chip-presets {
  position: absolute;
  bottom: calc(100% + 8px);
  left: 0;
  z-index: 40;
  display: none;
  flex-direction: column;
  gap: 2px;
  min-width: 100%;
  padding: 6px;
  border-radius: 14px;
  background: color-mix(in oklch, var(--surface) 98%, transparent);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-paper);
}
.gen-chip:focus-within .gen-chip-presets { display: flex; }
.gen-chip-presets button {
  min-height: 30px;
  padding: 0 12px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--ink);
  font-size: 12px;
  font-weight: 600;
  text-align: left;
  white-space: nowrap;
  cursor: pointer;
}
.gen-chip-presets button:hover {
  background: var(--primary-soft);
  color: var(--primary-text);
}@media (max-width: 720px) {
  .gen-chip-key { display: none; }}


/* ===== 2026-06-05: 输入框 Skill 挂载标签 ===== */
.skill-mount-chip {
  min-width: 0;
  max-width: min(260px, 34vw);
  min-height: 34px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  border: 1px solid color-mix(in oklch, var(--primary) 22%, var(--line));
  border-radius: 999px;
  background: color-mix(in oklch, var(--primary-soft) 72%, var(--surface));
  color: var(--primary-text);
  cursor: pointer;
  padding: 0 12px;
  font-size: 12px;
  font-weight: 850;
  overflow: hidden;
  box-shadow: inset 0 1px 0 color-mix(in oklch, white 60%, transparent);
}

.skill-mount-chip span {
  color: color-mix(in oklch, var(--primary-text) 74%, var(--muted));
  letter-spacing: .08em;
  text-transform: uppercase;
  font-size: 10px;
  flex: 0 0 auto;
}

.skill-mount-chip b {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.skill-mount-chip:hover,
.skill-mount-chip:focus-visible {
  border-color: color-mix(in oklch, var(--primary) 42%, var(--line));
  background: color-mix(in oklch, var(--primary-soft) 88%, var(--surface));
}

/* ===== 2026-06-14: 从素材库选择器（搜索 + 类型筛选 + 分页懒加载） ===== */
.lib-pick-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}
.lib-pick-search {
  flex: 1 1 220px;
  min-width: 0;
  height: 38px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  font-size: 14px;
  background: var(--surface);
  color: var(--ink);
}
.lib-pick-search:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-soft);
}
.lib-pick-tabs { display: inline-flex; gap: 4px; background: var(--bg-soft, var(--primary-soft)); border-radius: 10px; padding: 3px; }
.lib-pick-tab {
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 13px;
  padding: 6px 12px;
  border-radius: 8px;
  cursor: pointer;
  transition: background 120ms ease, color 120ms ease;
}
.lib-pick-tab:hover { color: var(--ink); }
.lib-pick-tab.active { background: var(--surface); color: var(--primary-text); font-weight: 700; box-shadow: var(--shadow-1, 0 1px 2px rgba(0,0,0,0.08)); }
.lib-pick-empty { padding: 28px 0; text-align: center; color: var(--muted); font-size: 13px; }
.lib-pick-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 10px;
}
.lib-pick-count { font-size: 12px; color: var(--muted); }
.lib-pick-more {
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--primary-text);
  font-size: 13px;
  padding: 6px 14px;
  border-radius: 999px;
  cursor: pointer;
}
.lib-pick-more:hover { background: var(--primary-soft); border-color: var(--primary); }
.lib-pick-list {
  display: grid;
  gap: 8px;
  max-height: 48vh;
  overflow: auto;
  padding: 2px;
}
.lib-pick-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  cursor: pointer;
  transition: background 140ms ease, border-color 140ms ease;
}
.lib-pick-item:hover { background: var(--primary-soft); }
.lib-pick-item.is-added { opacity: 0.6; cursor: default; }
.lib-pick-item.is-empty { opacity: 0.55; cursor: default; }
.lib-pick-item input { width: 18px; height: 18px; flex: 0 0 auto; }
.lib-pick-main { flex: 1 1 auto; min-width: 0; display: grid; gap: 2px; }
.lib-pick-main b {
  color: var(--ink);
  font-size: 14px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.lib-pick-main em { color: var(--muted); font-size: 12px; font-style: normal; }
.lib-pick-tag {
  flex: 0 0 auto;
  font-size: 12px;
  color: var(--primary-2);
  background: var(--primary-soft);
  padding: 3px 9px;
  border-radius: 999px;
}
.lib-pick-group {
  flex: 0 0 auto;
  max-width: 180px;
  height: 38px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  font-size: 13px;
  background: var(--surface);
  color: var(--ink);
  cursor: pointer;
}
.lib-pick-group:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }

/* ===== 2026-06-14: 弹窗内已上传文件 chip + 字段提示 ===== */
.uploaded-chip-list { display: flex; flex-wrap: wrap; gap: 8px; margin: 6px 0 2px; }
.uploaded-chip {
  font-size: 12px;
  color: var(--primary-2);
  background: var(--primary-soft);
  padding: 5px 10px;
  border-radius: 999px;
}
.file-chip .chip-warn {
  font-size: 11px;
  font-style: normal;
  color: #9a6b00;
  background: var(--warn-soft);
  padding: 2px 7px;
  border-radius: 999px;
  margin-left: 2px;
}
.file-chip .chip-vision {
  font-size: 11px;
  font-style: normal;
  color: var(--primary-text);
  background: var(--primary-soft);
  padding: 2px 7px;
  border-radius: 999px;
  margin-left: 2px;
}
.file-chip-status {
  min-height: 24px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 0 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
}
.file-chip-status.ready { color: var(--primary-text); background: color-mix(in oklch, var(--primary) 12%, var(--surface)); }
.file-chip-status.working { color: #8a6200; background: var(--warn-soft); }
.file-chip-status.error { color: var(--danger); background: color-mix(in oklch, var(--danger) 10%, var(--surface)); }

/* ===== 2026-06-14: 图片「为何不读取」感叹号 + 悬停小提示 ===== */
.img-tip {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 15px;
  height: 15px;
  margin-left: 1px;
  border-radius: 50%;
  font-size: 11px;
  font-weight: 800;
  font-style: normal;
  line-height: 1;
  color: var(--on-accent);
  background: var(--accent);
  cursor: help;
  outline: none;
}
.img-tip::after {
  content: attr(data-tip);
  position: absolute;
  bottom: calc(100% + 9px);
  left: 50%;
  transform: translateX(-50%) translateY(4px);
  width: max-content;
  max-width: 248px;
  white-space: normal;
  text-align: left;
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0;
  line-height: 1.55;
  color: var(--on-accent);
  background: #20211f;
  padding: 9px 11px;
  border-radius: 9px;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.22);
  opacity: 0;
  pointer-events: none;
  transition: opacity 140ms ease, transform 140ms ease;
  z-index: 80;
}
.img-tip::before {
  content: "";
  position: absolute;
  bottom: calc(100% + 3px);
  left: 50%;
  transform: translateX(-50%);
  border: 6px solid transparent;
  border-top-color: #20211f;
  opacity: 0;
  pointer-events: none;
  transition: opacity 140ms ease;
  z-index: 80;
}
.img-tip:hover::after,
.img-tip:focus-visible::after { opacity: 1; transform: translateX(-50%) translateY(0); }
.img-tip:hover::before,
.img-tip:focus-visible::before { opacity: 1; }

/* 规格选择器 · 选项说明小字（智能字幕等带解释的开关） */
.spec-note { margin: 0 0 6px; font-size: 11px; color: var(--muted); line-height: 1.5; }

/* composer 文件条 · 点击预览（名称区按钮化，长名省略，title 保留全名） */
.file-chip-name { min-height: 40px; display: inline-flex; align-items: center; gap: 6px; border: 0; background: transparent; padding: 0; font: inherit; font-weight: inherit; color: inherit; cursor: pointer; min-width: 0; }
.file-chip-name b { max-width: 320px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.file-chip-name em { white-space: nowrap; }
.file-chip-name:hover b { color: var(--primary); text-decoration: underline; }
/* 素材选择器 · 行内预览按钮 */
.lib-pick-eye { border: 0; background: none; color: var(--primary); font: inherit; font-size: 12px; cursor: pointer; padding: 2px 6px; border-radius: var(--radius-sm); flex-shrink: 0; }
.lib-pick-eye:hover { background: var(--primary-soft); }
}
