:root {
  --ys-blue: #0064fa;
  --ys-blue-hover: #0062d6;
  --ys-cyan: #00a6ff;
  --ys-blue-soft: #eaf5ff;
  --ys-blue-wash: rgba(234, 245, 255, 0.42);
  --ys-blue-line: rgba(0, 100, 250, 0.1);
  --ys-glass: rgba(255, 255, 255, 0.72);
  --ys-glass-strong: rgba(255, 255, 255, 0.84);
  --ys-text: #1c1f23;
  --ys-muted: #6b7075;
  --ys-border: #e6e8ea;
  --ys-bg: #f7f8fa;
  --ys-shell-max: 1280px;
  --ys-shell-pad: 24px;
  color-scheme: light;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--ys-bg);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
  color: var(--ys-text);
  background:
    linear-gradient(180deg, rgba(234, 245, 255, 0.46) 0%, rgba(255, 255, 255, 0.76) 24%, var(--ys-bg) 100%),
    linear-gradient(115deg, rgba(255, 255, 255, 0.92), rgba(243, 246, 250, 0.92));
  background-attachment: fixed;
}

button,
input,
textarea,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
}

.app {
  display: grid;
  grid-template-rows: auto 1fr auto;
  min-height: 100vh;
}

.topbar {
  display: flex;
  justify-content: center;
  margin: 0 auto;
  max-width: var(--ys-shell-max);
  padding: 18px var(--ys-shell-pad) 8px;
  width: 100%;
}

.topbar-inner {
  align-items: center;
  backdrop-filter: blur(22px) saturate(1.18);
  background: rgba(255, 255, 255, 0.68);
  border: 1px solid rgba(255, 255, 255, 0.88);
  border-radius: 22px;
  box-shadow: 0 14px 36px rgba(28, 31, 35, 0.08);
  display: flex;
  gap: 18px;
  justify-content: space-between;
  max-width: none;
  padding: 10px 14px;
  width: 100%;
  -webkit-backdrop-filter: blur(22px) saturate(1.18);
}

.brand {
  align-items: center;
  display: flex;
  gap: 11px;
  min-width: 0;
}

.brand-logo {
  display: block;
  flex: 0 0 40px;
  height: 40px;
  object-fit: contain;
  width: 40px;
}

.brand-mark {
  align-items: center;
  background: #18181b;
  border-radius: 13px;
  color: white;
  display: grid;
  font-size: 14px;
  font-weight: 900;
  height: 34px;
  letter-spacing: 0;
  width: 34px;
}

.brand h1 {
  font-size: 18px;
  font-weight: 900;
  line-height: 1.1;
  margin: 0;
}

.brand p {
  color: var(--ys-muted);
  font-size: 12px;
  font-weight: 600;
  margin: 3px 0 0;
}

.top-actions {
  align-items: center;
  display: flex;
  gap: 10px;
}

.ghost-button,
.primary-button,
.icon-button,
.pill-button {
  align-items: center;
  border: 0;
  display: inline-flex;
  justify-content: center;
  transition: transform 0.16s ease, background 0.16s ease, border-color 0.16s ease, color 0.16s ease, opacity 0.16s ease;
}

.ghost-button {
  backdrop-filter: blur(14px);
  background: rgba(255, 255, 255, 0.64);
  border: 1px solid rgba(230, 232, 234, 0.86);
  border-radius: 12px;
  color: #41464c;
  font-size: 13px;
  font-weight: 800;
  gap: 7px;
  height: 38px;
  padding: 0 13px;
  -webkit-backdrop-filter: blur(14px);
}

.ghost-button:hover,
.pill-button:hover {
  background: white;
  border-color: var(--ys-blue);
  color: var(--ys-blue);
}

.primary-button {
  background: linear-gradient(135deg, var(--ys-blue), var(--ys-cyan));
  border-radius: 999px;
  box-shadow: 0 10px 26px rgba(0, 100, 250, 0.26);
  color: white;
  font-weight: 900;
  height: 44px;
  min-width: 44px;
  padding: 0 18px;
}

.primary-button:hover {
  background: linear-gradient(135deg, var(--ys-blue-hover), #0090e6);
  transform: translateY(-1px);
}

.primary-button:disabled {
  background: #e4e4e7;
  color: #a1a1aa;
  transform: none;
}

#openSettings,
#submitButton {
  background: linear-gradient(135deg, #0b72ff, var(--ys-cyan));
  border-color: transparent;
  box-shadow: 0 10px 26px rgba(0, 100, 250, 0.24);
  color: white;
}

#openSettings:hover,
#submitButton:hover {
  background: linear-gradient(135deg, var(--ys-blue-hover), #0097ee);
  color: white;
  transform: translateY(-1px);
}

#submitButton {
  min-width: 76px;
}

.icon-button {
  background: #f6f8fa;
  border-radius: 999px;
  color: #4f5862;
  height: 30px;
  width: 30px;
}

.icon-button:hover {
  background: var(--ys-blue-soft);
  color: var(--ys-blue);
}

.workspace {
  display: block;
  margin: 0 auto;
  max-width: var(--ys-shell-max);
  padding: 12px var(--ys-shell-pad) 24px;
  width: 100%;
}

.stage {
  backdrop-filter: blur(24px) saturate(1.14);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.82), rgba(250, 251, 253, 0.74));
  border: 1px solid rgba(255, 255, 255, 0.82);
  border-radius: 28px;
  box-shadow: 0 18px 58px rgba(28, 31, 35, 0.08);
  min-height: 440px;
  overflow: hidden;
  position: relative;
  -webkit-backdrop-filter: blur(24px) saturate(1.14);
}

.stage-empty {
  align-items: center;
  color: var(--ys-muted);
  display: flex;
  flex-direction: column;
  gap: 14px;
  height: 100%;
  justify-content: center;
  min-height: 440px;
  padding: 34px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.52), rgba(246, 248, 251, 0.62));
  text-align: center;
}

.stage-empty strong {
  color: var(--ys-text);
  font-size: 24px;
  font-weight: 900;
}

.stage-layout {
  display: grid;
  gap: 16px;
  padding: 20px;
}

.stage-heading,
.stage-details,
.history-heading {
  align-items: center;
  display: flex;
  justify-content: space-between;
}

.stage-heading {
  gap: 18px;
}

.stage-heading-copy {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.stage-heading-copy span,
.history-heading span {
  color: var(--ys-muted);
  font-size: 11px;
  font-weight: 800;
}

.stage-heading-copy strong {
  display: block;
  font-size: 18px;
  font-weight: 900;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.task-status {
  border: 1px solid transparent;
  border-radius: 999px;
  flex: 0 0 auto;
  font-size: 11px;
  font-weight: 900;
  padding: 6px 10px;
}

.task-status.success {
  background: rgba(223, 250, 239, 0.82);
  border-color: rgba(30, 170, 114, 0.14);
  color: #087a52;
}

.task-status.progress {
  background: rgba(234, 245, 255, 0.84);
  border-color: rgba(0, 100, 250, 0.12);
  color: var(--ys-blue-hover);
}

.task-status.error {
  background: rgba(254, 242, 242, 0.88);
  border-color: rgba(185, 28, 28, 0.1);
  color: #991b1b;
}

.stage-player {
  align-items: center;
  aspect-ratio: 16 / 9;
  background: #090c11;
  border: 1px solid rgba(12, 20, 31, 0.12);
  border-radius: 16px;
  display: flex;
  justify-content: center;
  max-height: 680px;
  min-height: 320px;
  overflow: hidden;
  position: relative;
  width: 100%;
}

.stage-player video {
  background: #090c11;
  display: block;
  height: 100%;
  object-fit: contain;
  pointer-events: auto;
  position: relative;
  width: 100%;
  z-index: 2;
}

.stage-player.is-progress {
  background: linear-gradient(145deg, #111820, #182433);
}

.stage-player.is-error {
  background: linear-gradient(145deg, #1c1518, #211a1d);
}

.stage-state {
  align-items: center;
  color: rgba(255, 255, 255, 0.68);
  display: flex;
  flex-direction: column;
  gap: 10px;
  justify-content: center;
  padding: 28px;
  text-align: center;
}

.stage-state strong {
  color: white;
  font-size: 18px;
}

.stage-state-mark,
.stage-spinner {
  align-items: center;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 50%;
  display: flex;
  height: 42px;
  justify-content: center;
  width: 42px;
}

.stage-spinner::before {
  animation: stage-spin 0.9s linear infinite;
  border: 2px solid rgba(255, 255, 255, 0.22);
  border-radius: 50%;
  border-top-color: #4eb8ff;
  content: "";
  height: 20px;
  width: 20px;
}

@keyframes stage-spin {
  to { transform: rotate(360deg); }
}

.stage-details {
  gap: 14px;
}

.stage-detail-list {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  min-width: 0;
}

.stage-detail-list span {
  background: rgba(245, 247, 250, 0.72);
  border: 1px solid rgba(230, 232, 234, 0.72);
  border-radius: 999px;
  color: #565d65;
  font-size: 11px;
  font-weight: 800;
  padding: 5px 8px;
}

.stage-actions {
  display: flex;
  flex: 0 0 auto;
  gap: 8px;
}

.stage-action {
  align-items: center;
  background: rgba(255, 255, 255, 0.58);
  border: 1px solid rgba(218, 223, 230, 0.86);
  border-radius: 10px;
  color: #454c54;
  display: inline-flex;
  font-size: 12px;
  font-weight: 900;
  height: 36px;
  justify-content: center;
  padding: 0 12px;
  text-decoration: none;
}

.stage-action:hover {
  border-color: var(--ys-blue);
  color: var(--ys-blue);
}

.stage-action.primary {
  background: var(--ys-blue);
  border-color: var(--ys-blue);
  color: white;
}

.history-section {
  border-top: 1px solid rgba(224, 228, 234, 0.72);
  display: grid;
  gap: 10px;
  min-width: 0;
  padding-top: 14px;
}

.history-heading strong {
  font-size: 13px;
  font-weight: 900;
}

.history-heading-copy {
  align-items: baseline;
  display: flex;
  gap: 8px;
}

.history-clear {
  align-items: center;
  backdrop-filter: blur(14px) saturate(1.14);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.86), rgba(248, 250, 252, 0.78));
  border: 1px solid rgba(218, 223, 230, 0.86);
  border-radius: 999px;
  box-shadow: 0 8px 22px rgba(28, 31, 35, 0.06);
  color: #4f5862;
  display: inline-flex;
  font-size: 12px;
  font-weight: 850;
  gap: 6px;
  height: 34px;
  justify-content: center;
  padding: 0 13px;
  transition: background 0.16s ease, border-color 0.16s ease, box-shadow 0.16s ease, color 0.16s ease, transform 0.16s ease;
  -webkit-backdrop-filter: blur(14px) saturate(1.14);
}

.history-clear::before {
  border: 1.7px solid currentColor;
  border-radius: 2px 2px 4px 4px;
  content: "";
  height: 10px;
  opacity: 0.72;
  position: relative;
  width: 9px;
}

.history-clear:hover {
  background: linear-gradient(180deg, rgba(255, 247, 247, 0.94), rgba(255, 241, 242, 0.88));
  border-color: rgba(190, 24, 24, 0.22);
  box-shadow: 0 10px 24px rgba(190, 24, 24, 0.09);
  color: #a11b1b;
  transform: translateY(-1px);
}

.history-strip {
  display: flex;
  gap: 8px;
  min-width: 0;
  overflow-x: auto;
  padding: 3px 2px 7px;
  scrollbar-color: rgba(90, 101, 115, 0.24) transparent;
  scrollbar-width: thin;
}

.history-entry {
  flex: 0 0 246px;
  min-width: 0;
  padding: 2px;
  position: relative;
}

.history-item {
  align-items: center;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 8px;
  color: var(--ys-text);
  display: grid;
  gap: 9px;
  grid-template-columns: 88px minmax(0, 1fr);
  min-height: 66px;
  padding: 6px;
  text-align: left;
  transition: background 0.16s ease, border-color 0.16s ease;
  width: 100%;
}

.history-item:hover {
  background: rgba(255, 255, 255, 0.7);
  border-color: rgba(0, 100, 250, 0.12);
}

.history-item.active {
  background: rgba(234, 245, 255, 0.64);
  border-color: rgba(0, 100, 250, 0.26);
}

.history-delete {
  align-items: center;
  backdrop-filter: blur(12px) saturate(1.12);
  background: rgba(255, 255, 255, 0.78);
  border: 1px solid rgba(255, 255, 255, 0.88);
  border-radius: 50%;
  box-shadow: 0 5px 14px rgba(28, 31, 35, 0.12);
  color: #616a73;
  display: flex;
  font-size: 17px;
  height: 24px;
  justify-content: center;
  line-height: 1;
  opacity: 0;
  padding: 0 0 2px;
  pointer-events: none;
  position: absolute;
  right: 7px;
  top: 7px;
  transform: translateY(-4px) scale(0.92);
  transition: opacity 0.16s ease, transform 0.16s ease, background 0.16s ease, color 0.16s ease;
  width: 24px;
  z-index: 3;
  -webkit-backdrop-filter: blur(12px) saturate(1.12);
}

.history-entry:hover .history-delete,
.history-entry:focus-within .history-delete {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0) scale(1);
}

.history-delete:hover {
  background: rgba(255, 239, 239, 0.94);
  color: #b91c1c;
}

.history-thumb {
  align-items: center;
  aspect-ratio: 16 / 9;
  background: #151a20;
  border-radius: 6px;
  display: flex;
  justify-content: center;
  overflow: hidden;
  position: relative;
  width: 88px;
}

.history-thumb video {
  height: 100%;
  object-fit: cover;
  pointer-events: none;
  width: 100%;
}

.history-thumb.is-progress::before {
  animation: stage-spin 0.9s linear infinite;
  border: 2px solid rgba(255, 255, 255, 0.22);
  border-radius: 50%;
  border-top-color: #4eb8ff;
  content: "";
  height: 15px;
  width: 15px;
}

.history-thumb-mark {
  color: #ffb4b4;
  font-size: 16px;
  font-weight: 900;
}

.history-copy {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.history-copy strong,
.history-copy small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.history-copy strong {
  font-size: 12px;
  font-weight: 900;
}

.history-copy small {
  color: var(--ys-muted);
  font-size: 10px;
  font-weight: 700;
}

.composer-wrap {
  display: flex;
  justify-content: center;
  margin: 0 auto;
  max-width: var(--ys-shell-max);
  padding: 0 var(--ys-shell-pad) 22px;
  width: 100%;
}

.composer {
  backdrop-filter: blur(26px) saturate(1.18);
  background: rgba(255, 255, 255, 0.8);
  border: 1px solid rgba(255, 255, 255, 0.82);
  border-radius: 30px;
  box-shadow: 0 22px 70px rgba(28, 31, 35, 0.12), inset 0 1px 0 rgba(255, 255, 255, 0.76);
  display: grid;
  gap: 12px;
  max-width: none;
  padding: 12px;
  position: relative;
  width: 100%;
  z-index: 20;
  -webkit-backdrop-filter: blur(26px) saturate(1.18);
}

.mode-row,
.control-row,
.ref-row,
.input-row {
  align-items: center;
  display: flex;
  gap: 10px;
}

.mode-group {
  background: rgba(246, 248, 250, 0.86);
  border-radius: 16px;
  display: grid;
  flex: 1;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  padding: 4px;
}

.mode-button {
  background: transparent;
  border: 0;
  border-radius: 12px;
  color: var(--ys-muted);
  font-size: 13px;
  font-weight: 900;
  height: 34px;
}

.mode-button.active {
  background: rgba(255, 255, 255, 0.9);
  box-shadow: 0 4px 14px rgba(28, 31, 35, 0.08);
  color: var(--ys-blue);
}

.mode-button:disabled {
  color: #c4c4c8;
}

.intent-row {
  align-items: center;
  backdrop-filter: blur(18px) saturate(1.16);
  background: rgba(248, 250, 252, 0.62);
  border: 1px solid rgba(255, 255, 255, 0.9);
  border-radius: 16px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.92);
  display: flex;
  gap: 14px;
  justify-content: space-between;
  min-height: 48px;
  padding: 6px 8px 6px 12px;
  -webkit-backdrop-filter: blur(18px) saturate(1.16);
}

.intent-copy {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.intent-copy span {
  color: #7c858f;
  font-size: 10px;
  font-weight: 800;
}

.intent-copy strong {
  color: #343a40;
  font-size: 12px;
  font-weight: 850;
}

.intent-group {
  background: rgba(235, 239, 244, 0.76);
  border-radius: 12px;
  display: grid;
  flex: 0 1 330px;
  grid-template-columns: repeat(var(--intent-count, 2), minmax(0, 1fr));
  padding: 3px;
  width: min(100%, 330px);
}

.intent-button {
  background: transparent;
  border: 0;
  border-radius: 9px;
  color: #6d7680;
  font-size: 12px;
  font-weight: 850;
  height: 32px;
}

.intent-button.active {
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 4px 13px rgba(28, 31, 35, 0.08), inset 0 1px 0 white;
  color: var(--ys-blue);
}

.control-row {
  position: relative;
  z-index: 40;
}

.custom-select {
  backdrop-filter: blur(18px) saturate(1.18);
  background: rgba(255, 255, 255, 0.58);
  border: 1px solid rgba(255, 255, 255, 0.94);
  border-radius: 16px;
  box-shadow: 0 8px 22px rgba(28, 31, 35, 0.07), inset 0 1px 0 rgba(255, 255, 255, 0.9);
  display: grid;
  grid-template-rows: auto 1fr;
  height: 52px;
  min-width: 0;
  padding: 7px 10px 6px 12px;
  position: relative;
  transition: border-color 0.16s ease, box-shadow 0.16s ease, background 0.16s ease, transform 0.16s ease;
  -webkit-backdrop-filter: blur(18px) saturate(1.18);
}

.custom-select:hover {
  background: rgba(255, 255, 255, 0.76);
  border-color: rgba(0, 100, 250, 0.2);
  transform: translateY(-1px);
}

.custom-select.open,
.custom-select:focus-within {
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.9), rgba(235, 247, 255, 0.78));
  border-color: rgba(0, 100, 250, 0.36);
  box-shadow: 0 10px 26px rgba(0, 100, 250, 0.12), 0 0 0 3px rgba(0, 100, 250, 0.08), inset 0 1px 0 white;
}

.custom-select.open {
  z-index: 80;
}

.control-label {
  color: #7c858f;
  font-size: 10px;
  font-weight: 800;
  line-height: 1;
}

.custom-select-trigger {
  align-items: center;
  background: transparent;
  border: 0;
  color: var(--ys-text);
  display: flex;
  gap: 8px;
  height: 25px;
  justify-content: space-between;
  min-width: 0;
  outline: 0;
  padding: 2px 2px 0 0;
  text-align: left;
  width: 100%;
}

.custom-select-value {
  font-size: 14px;
  font-weight: 850;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.select-chevron {
  border-bottom: 1.5px solid #69737e;
  border-right: 1.5px solid #69737e;
  flex: 0 0 7px;
  height: 7px;
  margin: -3px 3px 0 0;
  transform: rotate(45deg);
  transition: transform 0.16s ease, margin 0.16s ease;
  width: 7px;
}

.custom-select.open .select-chevron {
  margin-top: 3px;
  transform: rotate(225deg);
}

.custom-select-menu {
  backdrop-filter: blur(24px) saturate(1.38) brightness(1.02);
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.15), rgba(205, 231, 249, 0.06));
  border: 1px solid rgba(255, 255, 255, 0.46);
  border-radius: 20px;
  box-shadow: 0 26px 72px rgba(28, 31, 35, 0.2), 0 3px 12px rgba(0, 100, 250, 0.08), inset 0 1px 0 rgba(255, 255, 255, 0.96);
  display: grid;
  gap: 3px;
  isolation: isolate;
  overflow: auto;
  padding: 8px;
  position: fixed;
  transform: translateZ(0);
  -webkit-backdrop-filter: blur(24px) saturate(1.38) brightness(1.02);
  z-index: 120;
}

.custom-select-option {
  align-items: center;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 11px;
  color: #30363d;
  display: flex;
  font-size: 13px;
  font-weight: 750;
  gap: 10px;
  justify-content: space-between;
  min-height: 39px;
  min-width: 0;
  padding: 8px 10px;
  text-align: left;
  width: 100%;
}

.custom-select-option > span:first-child {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.custom-select-option:hover,
.custom-select-option:focus-visible {
  background: rgba(255, 255, 255, 0.22);
  border-color: rgba(0, 100, 250, 0.14);
  outline: 0;
}

.custom-select-option.selected {
  background: linear-gradient(135deg, rgba(191, 226, 250, 0.32), rgba(248, 252, 255, 0.2));
  border-color: rgba(0, 100, 250, 0.22);
  color: #0058d8;
  font-weight: 850;
}

.option-check {
  color: var(--ys-blue);
  flex: 0 0 auto;
  font-size: 13px;
}

.custom-select-empty {
  color: var(--ys-muted);
  font-size: 12px;
  padding: 12px;
  text-align: center;
}

.model-control {
  flex: 1.35;
  min-width: 240px;
}

.parameter-cluster {
  display: grid;
  flex: 1.65;
  gap: 8px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  min-width: 0;
}

.parameter-cluster.has-preset {
  flex: 2;
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.parameter-control {
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.7), rgba(236, 247, 255, 0.58));
  border-color: rgba(209, 230, 248, 0.84);
}

.advanced-row {
  align-items: stretch;
  display: flex;
  gap: 10px;
}

.audio-toggle,
.negative-field {
  backdrop-filter: blur(18px) saturate(1.16);
  background: rgba(255, 255, 255, 0.42);
  border: 1px solid rgba(255, 255, 255, 0.72);
  border-radius: 16px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.78);
  -webkit-backdrop-filter: blur(18px) saturate(1.16);
}

.audio-toggle {
  align-items: center;
  display: flex;
  flex: 0 0 190px;
  justify-content: space-between;
  min-height: 48px;
  padding: 7px 10px 7px 12px;
}

.advanced-copy {
  display: grid;
  gap: 2px;
}

.advanced-copy small,
.negative-field > span {
  color: #7c858f;
  font-size: 10px;
  font-weight: 800;
}

.advanced-copy strong {
  color: #343a40;
  font-size: 12px;
  font-weight: 850;
}

.audio-toggle input {
  height: 1px;
  opacity: 0;
  position: absolute;
  width: 1px;
}

.toggle-track {
  background: rgba(126, 135, 145, 0.24);
  border: 1px solid rgba(126, 135, 145, 0.16);
  border-radius: 999px;
  display: block;
  height: 24px;
  padding: 2px;
  transition: background 0.16s ease, border-color 0.16s ease;
  width: 42px;
}

.toggle-track span {
  background: white;
  border-radius: 50%;
  box-shadow: 0 2px 7px rgba(28, 31, 35, 0.18);
  display: block;
  height: 18px;
  transition: transform 0.16s ease;
  width: 18px;
}

.audio-toggle input:checked + .toggle-track {
  background: var(--ys-blue);
  border-color: var(--ys-blue);
}

.audio-toggle input:checked + .toggle-track span {
  transform: translateX(18px);
}

.audio-toggle input:focus-visible + .toggle-track {
  box-shadow: 0 0 0 3px rgba(0, 100, 250, 0.16);
}

.negative-field {
  display: grid;
  flex: 1;
  gap: 2px;
  min-width: 0;
  padding: 6px 12px;
}

.negative-field input {
  background: transparent;
  border: 0;
  color: var(--ys-text);
  font-size: 12px;
  font-weight: 750;
  height: 26px;
  min-width: 0;
  outline: 0;
  padding: 0;
  width: 100%;
}

.negative-field input:focus {
  box-shadow: none;
}

.negative-field input::placeholder {
  color: #a1a1aa;
}

textarea:focus,
input:focus {
  border-color: var(--ys-blue);
  box-shadow: 0 0 0 3px rgba(0, 100, 250, 0.14);
}

.pill-button {
  background: rgba(255, 255, 255, 0.7);
  border: 1px solid rgba(230, 232, 234, 0.9);
  border-radius: 999px;
  color: #41464c;
  font-size: 12px;
  font-weight: 900;
  height: 36px;
  padding: 0 12px;
  white-space: nowrap;
}

.ref-row {
  align-items: stretch;
  flex-wrap: wrap;
}

.ref-drop {
  align-items: center;
  backdrop-filter: blur(16px);
  background: rgba(255, 255, 255, 0.6);
  border: 1px dashed rgba(0, 100, 250, 0.2);
  border-radius: 18px;
  color: #4f5862;
  display: inline-flex;
  font-size: 12px;
  font-weight: 900;
  gap: 8px;
  min-height: 72px;
  padding: 0 14px;
  -webkit-backdrop-filter: blur(16px);
}

.ref-drop input {
  display: none;
}

.ref-drop.disabled {
  background: rgba(246, 248, 250, 0.66);
  color: #a1a1aa;
  pointer-events: none;
}

.ref-list {
  display: flex;
  flex: 1;
  flex-wrap: wrap;
  gap: 8px;
  min-width: 220px;
}

.ref-chip {
  backdrop-filter: blur(14px);
  background: rgba(255, 255, 255, 0.66);
  border: 1px solid rgba(230, 232, 234, 0.86);
  border-radius: 18px;
  display: flex;
  gap: 8px;
  min-height: 72px;
  min-width: 190px;
  overflow: hidden;
  padding: 6px;
  position: relative;
  -webkit-backdrop-filter: blur(14px);
}

.ref-chip.invalid {
  border-color: #fca5a5;
}

.ref-thumb {
  align-items: center;
  background: #1c1f23;
  border-radius: 13px;
  color: white;
  display: grid;
  flex: 0 0 58px;
  font-size: 11px;
  font-weight: 900;
  height: 58px;
  overflow: hidden;
  place-items: center;
}

.ref-thumb img {
  height: 100%;
  object-fit: cover;
  width: 100%;
}

.ref-info {
  min-width: 0;
  padding-right: 24px;
}

.ref-name {
  color: var(--ys-text);
  font-size: 12px;
  font-weight: 900;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  width: 100%;
}

.ref-role {
  color: var(--ys-muted);
  font-size: 11px;
  font-weight: 700;
  margin-top: 4px;
}

.ref-remove {
  background: #e6e8ea;
  border: 0;
  border-radius: 999px;
  color: #41464c;
  height: 22px;
  position: absolute;
  right: 6px;
  top: 6px;
  width: 22px;
}

.notice {
  border-radius: 14px;
  font-size: 12px;
  font-weight: 800;
  line-height: 1.45;
  padding: 10px 12px;
}

.notice.error {
  background: #fef2f2;
  color: #991b1b;
}

.notice.info {
  background: rgba(245, 249, 255, 0.78);
  border: 1px solid rgba(0, 100, 250, 0.08);
  color: var(--ys-blue-hover);
}

.notice.warn {
  background: #fffbeb;
  color: #92400e;
}

.notice-with-action {
  align-items: center;
  display: flex;
  gap: 10px;
  justify-content: space-between;
}

.notice-with-action span {
  min-width: 0;
}

.notice-with-action .pill-button {
  flex: 0 0 auto;
}

.input-row {
  align-items: flex-end;
}

textarea {
  background: rgba(255, 255, 255, 0.34);
  border: 1px solid rgba(230, 232, 234, 0.74);
  border-radius: 18px;
  color: var(--ys-text);
  flex: 1;
  font-size: 14px;
  font-weight: 700;
  line-height: 1.6;
  max-height: 160px;
  min-height: 48px;
  outline: 0;
  padding: 12px 14px;
  resize: vertical;
}

textarea::placeholder {
  color: #a1a1aa;
}

.settings {
  align-items: center;
  background: rgba(28, 31, 35, 0.42);
  bottom: 0;
  display: flex;
  justify-content: center;
  left: 0;
  padding: 18px;
  position: fixed;
  right: 0;
  top: 0;
  z-index: 60;
}

.settings-box {
  backdrop-filter: blur(24px) saturate(1.12);
  background: rgba(255, 255, 255, 0.84);
  border: 1px solid rgba(255, 255, 255, 0.72);
  border-radius: 24px;
  box-shadow: 0 24px 80px rgba(28, 31, 35, 0.16);
  max-height: calc(100vh - 36px);
  max-width: 520px;
  overflow: auto;
  padding: 22px;
  width: 100%;
  -webkit-backdrop-filter: blur(24px) saturate(1.12);
}

.settings-box h2 {
  font-size: 20px;
  font-weight: 900;
  margin: 0 0 14px;
}

.field {
  display: grid;
  gap: 7px;
  margin-top: 12px;
}

.field label {
  color: var(--ys-muted);
  font-size: 12px;
  font-weight: 900;
}

.field input {
  background: rgba(255, 255, 255, 0.78);
  border: 1px solid rgba(230, 232, 234, 0.9);
  border-radius: 14px;
  height: 42px;
  outline: 0;
  padding: 0 12px;
}

.settings-notice {
  margin-top: 12px;
}

.model-summary {
  align-items: center;
  backdrop-filter: blur(16px) saturate(1.12);
  background: rgba(241, 247, 255, 0.62);
  border: 1px solid rgba(0, 100, 250, 0.12);
  border-radius: 14px;
  color: var(--ys-text);
  display: flex;
  gap: 14px;
  justify-content: space-between;
  margin-top: 14px;
  min-height: 66px;
  padding: 11px 13px;
  text-align: left;
  width: 100%;
  -webkit-backdrop-filter: blur(16px) saturate(1.12);
}

.model-summary > span:first-child {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.model-summary strong {
  color: var(--ys-blue-hover);
  font-size: 13px;
  font-weight: 900;
}

.model-summary small {
  color: var(--ys-muted);
  font-size: 10px;
  font-weight: 700;
}

.model-summary-action {
  color: var(--ys-blue);
  flex: 0 0 auto;
  font-size: 11px;
  font-weight: 900;
}

.settings-model-list {
  background: rgba(255, 255, 255, 0.42);
  border: 1px solid rgba(224, 228, 234, 0.74);
  border-radius: 14px;
  display: grid;
  gap: 2px 14px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-top: 8px;
  max-height: 230px;
  overflow: auto;
  padding: 8px;
}

.settings-model-list[hidden] {
  display: none;
}

.settings-model-list span {
  align-items: center;
  display: flex;
  font-size: 11px;
  font-weight: 800;
  gap: 7px;
  min-height: 30px;
  min-width: 0;
  overflow: hidden;
  padding: 0 4px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.settings-model-list i {
  background: var(--ys-blue);
  border-radius: 50%;
  box-shadow: 0 0 0 3px rgba(0, 100, 250, 0.08);
  flex: 0 0 5px;
  height: 5px;
  width: 5px;
}

.modal-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  margin-top: 18px;
}

@media (max-width: 720px) {
  :root {
    --ys-shell-pad: 14px;
  }

  .topbar {
    padding-top: 14px;
    padding-bottom: 6px;
  }

  .topbar-inner,
  .mode-row,
  .control-row,
  .input-row {
    align-items: stretch;
    flex-direction: column;
  }

  .workspace {
    padding-top: 10px;
    padding-bottom: 18px;
  }

  .stage-layout {
    gap: 12px;
    padding: 12px;
  }

  .stage-heading {
    align-items: flex-start;
  }

  .stage-heading-copy strong {
    font-size: 15px;
  }

  .stage-player {
    border-radius: 12px;
    min-height: 0;
  }

  .stage-details {
    align-items: stretch;
    flex-direction: column;
  }

  .stage-actions,
  .stage-action {
    flex: 1;
  }

  .history-entry {
    flex-basis: 220px;
  }

  .history-item {
    grid-template-columns: 78px minmax(0, 1fr);
  }

  .history-thumb {
    width: 78px;
  }

  .composer-wrap {
    padding-top: 0;
    padding-bottom: 16px;
  }

  .primary-button {
    width: 100%;
  }

  .model-control,
  .parameter-cluster {
    min-width: 0;
    width: 100%;
  }

  .parameter-cluster.has-preset {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .advanced-row {
    flex-direction: column;
  }

  .audio-toggle {
    flex-basis: auto;
  }

  .mode-group {
    width: 100%;
  }

  .intent-row {
    align-items: stretch;
    flex-direction: column;
  }

  .intent-group {
    flex-basis: auto;
    width: 100%;
  }

  .notice-with-action {
    align-items: stretch;
    flex-direction: column;
  }

  .settings-box {
    padding: 18px;
  }

  .settings-model-list {
    grid-template-columns: minmax(0, 1fr);
  }

  .modal-actions {
    flex-wrap: wrap;
  }
}
