/* 创作台小部件：参考图方块、并排字段、只读框、数量步进、结果区标题、网格视图、帮助浮钮 */

/* 参考图：缩略图与“添加”方块并排 */
.reference-tiles {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.reference-tiles .reference-list {
  display: contents;
}

.reference-tiles .reference-chip {
  width: 92px;
  padding: 4px;
}

.reference-tiles .reference-chip img {
  aspect-ratio: 1;
}

.reference-tiles .dropzone {
  display: grid;
  width: 92px;
  min-height: 92px;
  align-content: center;
  justify-items: center;
  gap: 6px;
  padding: 8px;
  border-radius: 10px;
  text-align: center;
}

.reference-tiles .dropzone-mark {
  width: 30px;
  height: 30px;
  border-radius: 8px;
}

.reference-tiles .dropzone-mark svg {
  width: 16px;
  height: 16px;
}

.reference-tiles .dropzone-text {
  gap: 0;
}

.reference-tiles .dropzone-text strong {
  font-size: 11px;
  line-height: 1.35;
}

.reference-tiles .dropzone-text small {
  display: none;
}

/* 槽里还没有素材 / 视频音频槽：铺满一行的横向上传区（图标在左、说明在右），不再是孤零零一个小方块 */
.reference-tiles:not(:has(.reference-chip, .asset-chip)) .dropzone,
.reference-tiles .dropzone-wide {
  display: flex;
  width: 100%;
  min-height: 84px;
  align-items: center;
  justify-items: start;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 11px;
  text-align: left;
}

.reference-tiles:not(:has(.reference-chip, .asset-chip)) .dropzone-mark,
.reference-tiles .dropzone-wide .dropzone-mark {
  width: 40px;
  height: 40px;
  border-radius: 10px;
}

.reference-tiles:not(:has(.reference-chip, .asset-chip)) .dropzone-mark svg,
.reference-tiles .dropzone-wide .dropzone-mark svg {
  width: 20px;
  height: 20px;
}

.reference-tiles:not(:has(.reference-chip, .asset-chip)) .dropzone-text,
.reference-tiles .dropzone-wide .dropzone-text {
  gap: 3px;
}

.reference-tiles:not(:has(.reference-chip, .asset-chip)) .dropzone-text strong,
.reference-tiles .dropzone-wide .dropzone-text strong {
  font-size: 12.5px;
}

.reference-tiles:not(:has(.reference-chip, .asset-chip)) .dropzone-text small,
.reference-tiles .dropzone-wide .dropzone-text small {
  display: block;
  font-size: 11px;
}

.dropzone-wide {
  min-height: 70px;
}

.option-grid .tier-field {
  grid-column: 1 / -1;
}

/* 高级参数区：按 schema 派生的开关 / 下拉 / 数值 / 短文本，两列排 */
.advanced-options {
  display: grid;
  gap: 12px 14px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin: 0 0 14px;
  padding: 0 0 14px;
  border-bottom: 1px solid var(--line);
}

.advanced-options[hidden] {
  display: none;
}

.advanced-options .text-field {
  grid-column: 1 / -1;
}

.advanced-options textarea {
  min-height: 56px;
  resize: vertical;
  font-size: 13px;
}

.advanced-options .field-head label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.field-range {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 11.5px;
  line-height: 1.4;
  font-variant-numeric: tabular-nums;
}

.field-range:empty {
  display: none;
}

/* 种子这类值域超长的数值框独占一行 */
.advanced-options .number-field:has(input[name="option-seed"]) {
  grid-column: 1 / -1;
}

/* 开关行：名称 ……… 滑块 */
.switch-field {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 42px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--field-bg);
  cursor: pointer;
  font-size: 13px;
}

.switch-field > span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.switch-field input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.switch-knob {
  position: relative;
  flex: none;
  width: 34px;
  height: 20px;
  border-radius: 999px;
  background: var(--line-strong);
  transition: background 0.15s ease;
}

.switch-knob::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: white;
  box-shadow: 0 1px 2px rgb(0 0 0 / 0.2);
  transition: transform 0.15s ease;
}

.switch-field input:checked ~ .switch-knob {
  background: var(--accent);
}

.switch-field input:checked ~ .switch-knob::after {
  transform: translateX(14px);
}

.switch-field input:focus-visible ~ .switch-knob {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* 结果数量步进器 */
.stepper {
  display: inline-grid;
  min-height: 42px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--field-bg);
  grid-template-columns: 40px minmax(0, 1fr) 40px;
}

.stepper button {
  min-height: 40px;
  border: 0;
  color: var(--muted-strong);
  background: none;
  font-size: 18px;
  font-weight: 600;
}

.stepper button:hover {
  color: var(--accent-text);
}

.stepper button:disabled {
  color: var(--line-strong);
}

.stepper output {
  text-align: center;
  font-size: 13px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

/* 结果区标题 */
.results-status > div h2 {
  margin: 0;
  font-size: 17px;
  letter-spacing: -0.02em;
}

.results-lead {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.results-state {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-left: 6px;
  padding: 5px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  white-space: nowrap;
}

/* 网格视图（画廊）：容器在这里，卡片样式在 studio-cards.css */
.stage-grid {
  display: grid;
  width: 100%;
  align-content: start;
}

/* 帮助浮钮 */
.help-fab {
  position: fixed;
  z-index: 80;
  right: 22px;
  bottom: 22px;
  display: grid;
  width: 44px;
  height: 44px;
  border: 0;
  border-radius: 50%;
  color: white;
  background: var(--accent);
  box-shadow: 0 10px 24px rgba(31, 58, 138, 0.3);
  place-items: center;
}

.help-fab svg {
  width: 22px;
  height: 22px;
}

.help-fab:hover {
  background: var(--accent-hover);
}
