/* ============================================
   Quality & Aspect Ratio Selector Styles
   ============================================ */
.ui-schema-renderer {
  position: relative;
  display: inline-block;
}
.ui-schema-quality-ratio-pill {
  display: flex;
  align-items: center;
}
.img-pill-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 8px;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 6px;
  color: var(--theme-text-secondary);
  font-size: 12px;
  cursor: pointer;
  transition: var(--transition-colors);
  font-family: inherit;
}
.img-pill-btn:hover {
  color: var(--theme-text);
  background: var(--white-alpha-03);
}
.img-pill-btn svg {
  color: var(--theme-text-secondary);
}
.img-ratio-popup {
  position: absolute;
  bottom: 100%;
  right: 0;
  margin-bottom: 6px;
  width: 290px;
  background: var(--theme-surface);
  border: 1px solid var(--theme-border);
  border-radius: 12px;
  box-shadow: 0 16px 40px var(--black-alpha-60), 0 0 0 1px var(--white-alpha-03);
  z-index: 110;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  transform-origin: bottom right;
  animation: popoverIn var(--dur-normal) var(--ease-spring);
}
/* 向下弹出（适合顶部工具栏，如合成器），避免向上溢出屏幕 */
.img-ratio-popup.img-ratio-popup--down {
  bottom: auto;
  top: 100%;
  margin-bottom: 0;
  margin-top: 6px;
  transform-origin: top right;
}
.img-rp-section-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--theme-text-muted);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0;
}
.img-rp-quality-segmented {
  display: flex;
  background: var(--theme-bg);
  padding: 3px;
  border-radius: 8px;
  border: 1px solid var(--theme-card);
  gap: 2px;
}
.img-rp-quality-item {
  flex: 1;
  border: none;
  background: transparent;
  padding: 6px 12px;
  font-size: 12px;
  color: var(--theme-text-secondary);
  cursor: pointer;
  border-radius: 6px;
  transition:
    var(--transition-colors),
    transform var(--transition-base),
    box-shadow var(--transition-base);
  font-family: inherit;
  font-weight: 500;
}
.img-rp-quality-item:hover {
  color: var(--theme-text);
  background: rgba(255, 255, 255, 0.02);
}
.img-rp-quality-item:active {
  transform: scale(0.95);
}
.img-rp-quality-item.active {
  color: #ffffff;
  background: var(--brand);
  box-shadow: 0 2px 8px var(--brand-alpha-30);
}
.img-rp-ratio-split {
  display: flex;
  gap: 8px;
}
.img-rp-ratio-left {
  flex-shrink: 0;
}
.img-rp-large-adaptive {
  width: 60px;
  height: 100%;
  min-height: 80px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: 1px solid var(--theme-border);
  background: var(--theme-bg);
  color: var(--theme-text-secondary);
  border-radius: 8px;
  cursor: pointer;
  transition:
    var(--transition-colors),
    transform var(--transition-base);
  font-family: inherit;
  font-size: 11px;
}
.img-rp-large-adaptive svg {
  color: var(--theme-text-secondary);
  transition: color 0.15s ease;
}
.img-rp-large-adaptive:hover {
  color: var(--theme-text);
  border-color: var(--border-secondary);
  background: rgba(255, 255, 255, 0.02);
}
.img-rp-large-adaptive.active {
  color: #ffffff;
  border-color: var(--brand);
  background: var(--brand-alpha-15);
}
.img-rp-large-adaptive.active svg {
  color: var(--brand-hover);
}
.img-rp-ratio-right {
  flex: 1;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 4px;
  max-height: 160px;
  overflow-y: auto;
  padding: 4px 0;
}
.img-rp-ratio-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 6px 4px;
  border: 1px solid var(--theme-card);
  background: var(--theme-bg);
  color: var(--theme-text-secondary);
  border-radius: 6px;
  cursor: pointer;
  transition:
    var(--transition-colors),
    transform var(--transition-base);
  font-family: inherit;
  font-size: 10px;
}
.img-rp-ratio-item:hover {
  color: var(--theme-text);
  border-color: var(--theme-border);
  background: rgba(255, 255, 255, 0.02);
}
.img-rp-ratio-item:active,
.img-rp-large-adaptive:active {
  transform: scale(0.95);
}
.img-rp-ratio-item.active {
  color: #ffffff;
  border-color: var(--brand);
  background: var(--brand-alpha-12);
}
.img-rp-icon {
  display: inline-block;
  border: 1.5px solid currentColor;
  border-radius: 1.5px;
  opacity: 0.7;
  transition: opacity 0.15s ease;
}
.img-rp-ratio-item.active .img-rp-icon {
  opacity: 1;
  color: var(--brand-hover);
}
[data-theme='light'] .img-rp-ratio-item.active,
[data-theme='light'] .img-rp-large-adaptive.active {
  color: color-mix(in srgb, var(--brand) 78%, var(--theme-text));
  background: var(--brand-alpha-20);
}
[data-theme='light'] .img-rp-ratio-item.active .img-rp-icon,
[data-theme='light'] .img-rp-large-adaptive.active svg {
  color: inherit;
}
.img-rp-sq { width: 12px; height: 12px; }
.img-rp-tall { width: 8px; height: 14px; }
.img-rp-wide { width: 14px; height: 8px; }
.img-rp-p34 { width: 9px; height: 12px; }
.img-rp-l43 { width: 12px; height: 9px; }
.img-rp-l32 { width: 13px; height: 9px; }
.img-rp-p23 { width: 9px; height: 13px; }
.img-rp-l54 { width: 12px; height: 10px; }
.img-rp-p45 { width: 10px; height: 12px; }
.img-rp-ultra { width: 16px; height: 7px; }
.img-rp-p14 { width: 5px; height: 15px; }
.img-rp-l41 { width: 15px; height: 5px; }
.img-rp-p18 { width: 3px; height: 16px; }
.img-rp-l81 { width: 16px; height: 3px; }
.img-rp-pano { width: 16px; height: 8px; }

/* ============================================
   Video Parameter Selector Styles
   ============================================ */
.ui-schema-video-params-popup {
  width: 320px;
}

/* ── 视频参数分辨率/宽高比分段控件：grid 均匀填满 + 自动换行 ── */
.rh-video-resolution-seg {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
}
.rh-video-resolution-seg .img-rp-quality-item {
  flex: none;
  padding: 4px 8px;
  font-size: 11px;
}
.rh-v5-meta-panel {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.rh-vram-adv-row {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.rh-vram-adv-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 600;
  color: var(--theme-text-muted);
  text-transform: uppercase;
  letter-spacing: 0;
}
.rh-vram-adv-label > span:first-child {
  color: var(--theme-text-secondary);
}
.rh-tip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--theme-border);
  color: var(--theme-text-secondary);
  font-size: 10px;
  font-weight: 700;
  cursor: help;
  line-height: 1;
}
.rh-v5-fps-seg .img-rp-quality-item {
  font-size: 11px;
}
.rh-stepper {
  display: flex;
  align-items: center;
  gap: 8px;
}
.rh-v5-source-framecount {
  font-size: 12px;
  color: var(--theme-text-muted);
  min-width: 20px;
  text-align: center;
}
.rh-stepper-value {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 48px;
  padding: 4px 10px;
  background: var(--theme-bg);
  border: 1px solid var(--theme-card);
  border-radius: 6px;
  font-size: 12px;
  color: var(--theme-text);
  cursor: text;
  font-family: inherit;
  outline: none;
  transition: border-color 0.15s;
}
.rh-stepper-value:hover {
  border-color: var(--border-secondary);
}
.rh-stepper-value:focus {
  border-color: var(--brand);
}
.rh-stepper-input {
  display: inline-flex;
  align-items: center;
  min-width: 48px;
  padding: 4px 10px;
  background: var(--theme-bg);
  border: 1px solid var(--brand);
  border-radius: 6px;
  font-size: 12px;
  color: var(--theme-text);
  font-family: inherit;
  outline: none;
  -moz-appearance: textfield;
  appearance: textfield;
}
.rh-stepper-input::-webkit-outer-spin-button,
.rh-stepper-input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

/* ════════════════════════════════════════════
   Seedance 时长拖拽滑块
   ════════════════════════════════════════════ */
.rh-duration-slider {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.rh-duration-track {
  position: relative;
  height: 24px;
  display: flex;
  align-items: center;
}
.rh-duration-fill {
  position: absolute;
  inset: 0;
  height: 6px;
  top: 50%;
  transform: translateY(-50%);
  background: var(--brand);
  border-radius: 3px;
  pointer-events: none;
  transition: width 0.08s linear;
  box-shadow: 0 0 6px var(--brand-alpha-30);
}
.rh-duration-track::before {
  content: '';
  position: absolute;
  inset: 0;
  height: 6px;
  top: 50%;
  transform: translateY(-50%);
  background: var(--theme-card);
  border-radius: 3px;
}
.rh-duration-input {
  position: relative;
  width: 100%;
  height: 24px;
  -webkit-appearance: none;
  appearance: none;
  background: transparent;
  cursor: pointer;
  margin: 0;
  z-index: 1;
}
.rh-duration-input::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #fff;
  border: 2px solid var(--brand);
  box-shadow: 0 0 0 3px var(--brand-alpha-20), 0 2px 8px rgba(0,0,0,0.4);
  cursor: grab;
  transition: box-shadow 0.15s, transform 0.1s;
}
.rh-duration-input::-webkit-slider-thumb:active {
  cursor: grabbing;
  transform: scale(1.15);
  box-shadow: 0 0 0 5px var(--brand-alpha-30), 0 2px 12px rgba(0,0,0,0.5);
}
.rh-duration-input::-moz-range-thumb {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #fff;
  border: 2px solid var(--brand);
  box-shadow: 0 0 0 3px var(--brand-alpha-20), 0 2px 8px rgba(0,0,0,0.4);
  cursor: grab;
}
.rh-duration-input::-moz-range-thumb:active {
  cursor: grabbing;
  transform: scale(1.15);
}
/* Firefox 轨道 */
.rh-duration-input::-moz-range-track {
  background: transparent;
  height: 6px;
}
.rh-duration-labels {
  display: flex;
}
/* 刻度槽按总刻度数均分容器宽度；长时长模型（2.5 的 4~30，共 27 槽）
   不再按 20px 固定宽度，否则 20s/25s/30s 会溢出右侧且滑杆拖不到上限（源 v0.9.19） */
.rh-duration-tick {
  flex: 1 1 0;
  min-width: 0;
  text-align: center;
  font-size: 10px;
  color: var(--theme-text-muted);
  cursor: pointer;
  transition: color 0.15s;
  user-select: none;
  padding: 2px 0;
  border-radius: 3px;
  white-space: nowrap;
}
.rh-duration-tick:hover {
  color: var(--theme-text-secondary);
}
.rh-duration-tick.active {
  color: var(--brand);
  font-weight: 600;
}

/* ════════════════════════════════════════════
   有声视频 Toggle 开关
   ════════════════════════════════════════════ */
.rh-toggle-switch {
  position: relative;
  display: inline-flex;
  align-items: center;
  cursor: pointer;
  user-select: none;
}
.rh-toggle-switch input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}
.rh-toggle-track {
  display: flex;
  align-items: center;
  width: 44px;
  height: 24px;
  padding: 2px;
  background: var(--theme-card);
  border: 1px solid var(--theme-border);
  border-radius: 12px;
  transition: background 0.2s, border-color 0.2s, box-shadow 0.2s;
}
.rh-toggle-switch input:checked + .rh-toggle-track {
  background: var(--brand);
  border-color: var(--brand);
  box-shadow: 0 0 8px var(--brand-alpha-30);
}
.rh-toggle-knob {
  display: block;
  width: 18px;
  height: 18px;
  background: #fff;
  border-radius: 50%;
  box-shadow: 0 1px 3px rgba(0,0,0,0.3);
  transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
  transform: translateX(0);
}
.rh-toggle-switch input:checked + .rh-toggle-track .rh-toggle-knob {
  transform: translateX(20px);
}
.rh-toggle-track:hover {
  border-color: var(--brand-alpha-40);
}
.rh-toggle-switch input:checked + .rh-toggle-track:hover {
  box-shadow: 0 0 12px var(--brand-alpha-40);
}
.rh-toggle-switch:active .rh-toggle-knob {
  transform: translateX(0) scale(0.9);
}
.rh-toggle-switch:active input:checked + .rh-toggle-track .rh-toggle-knob {
  transform: translateX(20px) scale(0.9);
}
