:root {
  color-scheme: light;
  --bg: #e8eef5;
  --surface: #f5f8fc;
  --surface-2: #edf3f9;
  --surface-3: #dfe7f0;
  --ink: #1d3044;
  --muted: #718092;
  --line: rgba(93, 111, 130, 0.18);
  --blue: #4f8cff;
  --pink: #ff5d9c;
  --green: #18d66f;
  --warn: #b77816;
  --danger: #ef3f5d;
  --shadow: 0 16px 34px rgba(65, 82, 105, 0.14);
  --inner-shadow: inset 0 2px 12px rgba(100, 122, 148, 0.12);
}

* {
  box-sizing: border-box;
}
[hidden] {
  display: none !important;
}


body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font-family: "Microsoft YaHei", "Segoe UI", sans-serif;
  letter-spacing: 0;
}

button,
input,
textarea,
select {
  font: inherit;
}

button {
  min-height: 38px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: #f5f8fc;
  color: var(--ink);
  padding: 0 16px;
  cursor: pointer;
  box-shadow: 0 8px 18px rgba(93, 111, 130, 0.12);
}

button:hover {
  border-color: rgba(79, 140, 255, 0.45);
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.48;
}

.primary-button {
  border-color: transparent;
  background: var(--pink);
  color: #fff;
  font-weight: 700;
}
.primary-button:hover {
  border-color: transparent;
  background: linear-gradient(135deg, #ff4f96, #ff667f);
  color: #fff;
  box-shadow: var(--pressed-shadow);
  transform: translateY(1px);
}

.tool-button {
  width: 46px;
  min-width: 46px;
  height: 46px;
  min-height: 46px;
  padding: 0;
  display: inline-grid;
  place-items: center;
  color: #647385;
  font-size: 26px;
  line-height: 1;
}

input,
textarea,
select {
  width: 100%;
  border: 1px solid transparent;
  border-radius: 8px;
  background: #f7fafd;
  color: var(--ink);
  padding: 12px 14px;
  outline: none;
  box-shadow: var(--inner-shadow);
}

textarea {
  min-height: 136px;
  resize: vertical;
}

input:focus,
textarea:focus,
select:focus {
  border-color: rgba(79, 140, 255, 0.55);
  box-shadow: 0 0 0 3px rgba(79, 140, 255, 0.14), var(--inner-shadow);
}

input.is-invalid,
textarea.is-invalid,
select.is-invalid {
  border-color: rgba(189, 63, 69, 0.72);
  box-shadow: 0 0 0 3px rgba(189, 63, 69, 0.14), var(--inner-shadow);
}

.app-shell {
  min-height: 100vh;
  padding: 18px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 86px;
  padding: 14px 20px;
  border: 1px solid rgba(255, 255, 255, 0.68);
  border-radius: 8px;
  background: rgba(246, 249, 253, 0.78);
  box-shadow: var(--shadow);
  backdrop-filter: blur(12px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}

.brand img {
  width: 54px;
  height: 54px;
  border-radius: 8px;
  object-fit: cover;
  box-shadow: 0 10px 22px rgba(255, 93, 156, 0.18);
}

.brand h1 {
  margin: 0;
  color: var(--pink);
  font-size: 28px;
  font-weight: 800;
  line-height: 1.1;
}

.brand p,
.small-copy {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.top-actions,
.status-strip,
.status-row,
.button-row,
.panel-head,
.form-head,
.module-rail-head,
.studio-head,
.results-head,
.drawer-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.top-actions {
  justify-content: flex-end;
  flex-wrap: wrap;
}

.toolbar-divider {
  display: block;
  width: 1px;
  height: 38px;
  background: var(--line);
}

.status-strip {
  margin-top: 12px;
  justify-content: flex-start;
  flex-wrap: wrap;
  padding: 0 4px;
}

.status-message {
  color: var(--muted);
  font-size: 13px;
}

/* 紧凑圆环进度：避免宽进度条盖住右侧重叠的模块标题 */
.update-progress-ring {
  --update-progress: 0;
  position: relative;
  display: inline-grid;
  place-items: center;
  width: 34px;
  height: 34px;
  flex: 0 0 34px;
  margin: 0;
  vertical-align: middle;
}

.update-progress-ring[hidden] {
  display: none !important;
}

.update-progress-ring svg {
  width: 34px;
  height: 34px;
  transform: rotate(-90deg);
}

.update-progress-ring circle {
  fill: none;
  stroke-width: 3.2;
  stroke-linecap: round;
}

.update-progress-track {
  stroke: rgba(122, 139, 158, 0.22);
}

.update-progress-value {
  stroke: var(--blue);
  stroke-dasharray: 97.4;
  stroke-dashoffset: calc(97.4 - (97.4 * var(--update-progress) / 100));
  transition: stroke-dashoffset 0.22s ease;
}

.update-progress-ring em {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  margin: 0;
  font-style: normal;
  font-size: 9px;
  font-weight: 700;
  line-height: 1;
  color: var(--ink);
  letter-spacing: -0.02em;
  pointer-events: none;
}

.status-pill,
.tag {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 10px;
  background: rgba(247, 250, 253, 0.86);
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}

.status-pill.ok,
.tag.ok {
  border-color: rgba(72, 185, 90, 0.28);
  background: rgba(72, 185, 90, 0.1);
  color: #238138;
}

.status-pill.warn,
.tag.warn {
  border-color: rgba(183, 120, 22, 0.26);
  background: rgba(183, 120, 22, 0.1);
  color: var(--warn);
}

.status-pill.error,
.tag.error {
  border-color: rgba(189, 63, 69, 0.24);
  background: rgba(189, 63, 69, 0.1);
  color: var(--danger);
}

.studio-layout {
  display: grid;
  grid-template-columns: minmax(230px, 260px) minmax(0, 1fr);
  gap: 24px;
  margin-top: 14px;
}

.module-rail,
.compose-card,
.results-panel,
.release-panel,
.log-drawer,
.activation-dialog {
  border: 1px solid rgba(255, 255, 255, 0.64);
  border-radius: 8px;
  background: rgba(239, 245, 251, 0.88);
  box-shadow: var(--shadow);
}

.module-rail {
  min-height: calc(100vh - 154px);
  padding: 14px;
}

.module-rail-head {
  align-items: flex-start;
  margin-bottom: 12px;
}

.module-rail h2,
.studio-head h2,
.results-head h2,
.drawer-head h2,
.activation-dialog h2 {
  margin: 0;
  font-size: 18px;
}

.module-rail-head span,
.studio-head p,
.drawer-head p,
#modeHint {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.module-list {
  display: grid;
  gap: 12px;
}

.module-card {
  position: relative;
  min-height: 64px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: rgba(245, 248, 252, 0.9);
  padding: 14px 34px 14px 14px;
  text-align: left;
  box-shadow: 0 8px 20px rgba(94, 112, 135, 0.12);
}

.module-card::after {
  content: "";
  position: absolute;
  top: 50%;
  right: 14px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--pink);
  transform: translateY(-50%);
}

.module-card.is-active {
  border-color: rgba(137, 115, 255, 0.5);
  box-shadow: 0 0 0 3px rgba(137, 115, 255, 0.16), 0 10px 24px rgba(94, 112, 135, 0.16);
}

.module-card strong {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 15px;
  line-height: 1.25;
}

.module-card p {
  margin: 7px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.studio-main {
  min-width: 0;
}

.studio-head {
  min-height: 48px;
  border-bottom: 0;
  padding: 6px 0 8px;
}

.studio-head h2 {
  color: transparent;
  background: linear-gradient(90deg, #3b82f6 0%, #60a5fa 28%, #3b82f6 56%, #818cf8 78%, #3b82f6 100%);
  background-size: 240% 100%;
  background-clip: text;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  font-size: 22px;
  font-weight: 800;
  animation: headingBlueShift 3.2s ease-in-out infinite;
  filter: drop-shadow(0 0 0 rgba(59, 130, 246, 0));
  transition: filter 0.24s ease, transform 0.24s ease;
}

.studio-head:hover h2 {
  filter: drop-shadow(0 5px 14px rgba(59, 130, 246, 0.26));
  transform: translateY(-1px);
}

@keyframes headingBlueShift {
  0%, 100% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
}

.work-grid {
  display: grid;
  grid-template-columns: minmax(320px, 0.82fr) minmax(360px, 1fr);
  gap: 24px;
  padding-top: 0;
}

.compose-card,
.results-panel {
  min-width: 0;
  padding: 16px;
}

.compose-card {
  align-self: start;
  display: grid;
  gap: 12px;
  align-content: start;
}

.form-head {
  align-items: flex-start;
  min-width: 0;
  max-width: 100%;
  flex-wrap: wrap;
  gap: 8px 12px;
}

.form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
  flex: 0 0 auto;
  margin-left: auto;
  min-width: 0;
}

.form-actions .primary-button,
.form-actions .secondary-button {
  flex: 0 0 auto;
  white-space: nowrap;
}

.form-head h3 {
  margin: 0;
  font-size: 18px;
  font-weight: 700;
}

.segmented {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.segmented:empty {
  display: none;
}

.segmented button {
  min-height: 34px;
  border: 0;
  border-radius: var(--control-radius);
  background: var(--surface);
  box-shadow: var(--shadow-soft);
  color: var(--ink);
  font-weight: 700;
  padding: 0 18px;
}

.segmented button.is-active {
  border-color: transparent;
  background: var(--surface-2);
  box-shadow: var(--pressed-shadow);
  color: var(--ink);
}

.input-stack {
  display: grid;
  gap: 14px;
  min-width: 0;
  max-width: 100%;
  width: 100%;
  box-sizing: border-box;
}

label span {
  display: block;
  margin-bottom: 8px;
  color: var(--ink);
  font-size: 13px;
  font-weight: 700;
}

.voicebound-panel {
  display: grid;
  gap: 10px;
  margin: 0;
  padding: 12px 12px 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface-2);
  min-width: 0;
  max-width: 100%;
  width: 100%;
  box-sizing: border-box;
  overflow: hidden;
}

.voicebound-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  min-width: 0;
  max-width: 100%;
  flex-wrap: wrap;
}

.voicebound-head > div {
  flex: 1 1 140px;
  min-width: 0;
  max-width: 100%;
}

.voicebound-head strong {
  display: block;
  font-size: 13px;
}

.voicebound-head span {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
  line-height: 1.4;
  word-break: break-word;
  overflow-wrap: anywhere;
}

.voicebound-add {
  flex: 0 0 auto;
  min-height: 34px;
  padding: 0 12px;
  border-color: rgba(79, 140, 255, 0.28);
  background: rgba(79, 140, 255, 0.1);
  color: var(--blue);
  cursor: pointer;
  white-space: nowrap;
}

.voicebound-play {
  flex: 0 0 auto;
  min-height: 34px;
  padding: 0 12px;
  border: 1px solid rgba(34, 197, 94, 0.35);
  border-radius: 8px;
  background: rgba(34, 197, 94, 0.1);
  color: #16a34a;
  cursor: pointer;
  white-space: nowrap;
  font: inherit;
}

.voicebound-play:hover:not(:disabled) {
  background: rgba(34, 197, 94, 0.16);
}

.voicebound-play:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.voicebound-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  min-width: 0;
  max-width: 100%;
}

.voicebound-empty {
  color: var(--muted);
  font-size: 12px;
  word-break: break-word;
}

.voicebound-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  max-width: 100%;
  min-height: 32px;
  padding: 0 8px 0 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--ink);
  cursor: pointer;
  box-sizing: border-box;
}

.voicebound-chip > span {
  display: block;
  margin: 0;
  min-width: 0;
  max-width: 9em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 13px;
  font-weight: 600;
}

.voicebound-chip.is-active {
  border-color: rgba(79, 140, 255, 0.45);
  background: rgba(79, 140, 255, 0.12);
  color: var(--blue);
}

.voicebound-chip i {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  color: var(--muted);
  font-style: normal;
  line-height: 1;
}

.voicebound-chip i:hover {
  background: rgba(239, 63, 93, 0.12);
  color: var(--danger);
}

.voicebound-chip.is-incomplete {
  border-style: dashed;
  opacity: 0.92;
}

.voicebound-create {
  display: grid;
  gap: 10px;
  margin-top: 2px;
  padding: 12px;
  border: 1px dashed rgba(79, 140, 255, 0.35);
  border-radius: 10px;
  background: rgba(79, 140, 255, 0.05);
  min-width: 0;
  max-width: 100%;
  box-sizing: border-box;
}

.voicebound-create-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--ink);
}

.voicebound-create-field {
  display: grid;
  gap: 6px;
  margin: 0;
  min-width: 0;
}

.voicebound-create-field > span {
  font-size: 12px;
  font-weight: 600;
  color: var(--ink);
}

.voicebound-create-field > span small {
  color: var(--muted);
  font-weight: 500;
}

.voicebound-create-field input[type="text"],
.voicebound-create-field textarea {
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  padding: 8px 10px;
  font: inherit;
  resize: vertical;
}

.voicebound-create-file {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  min-width: 0;
}

.voicebound-create-file em {
  font-style: normal;
  color: var(--muted);
  font-size: 12px;
  word-break: break-all;
}

.voicebound-create-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.voicebound-cancel {
  min-height: 34px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--muted);
  cursor: pointer;
}

.file-box[data-input-key="audio"] .input-help,
.file-box.is-voice-applied .input-help,
.text-field.is-voice-applied .input-help {
  color: var(--muted);
}

.file-box.is-voice-applied .file-drop strong {
  color: var(--blue);
}

.text-field.is-voice-applied textarea {
  border-color: rgba(79, 140, 255, 0.4);
  background: rgba(79, 140, 255, 0.06);
}

.file-box {
  display: grid;
  gap: 8px;
}

.file-box input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.file-upload-frame {
  display: grid;
  gap: 8px;
  border-radius: var(--control-radius);
}

.file-drop {
  min-height: 58px;
  display: flex;
  align-items: center;
  gap: 14px;
  border-radius: 8px;
  background: #f7fafd;
  padding: 12px 14px;
  color: var(--ink);
  box-shadow: var(--inner-shadow);
}

.file-drop b {
  width: 36px;
  min-width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: #fff;
  color: var(--ink);
  font-size: 26px;
  box-shadow: 0 8px 18px rgba(93, 111, 130, 0.16);
}

.file-drop strong {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 14px;
}

.file-choose-button {
  width: 100%;
  min-height: 44px;
  padding: 0 14px;
  border: 0;
  border-radius: var(--control-radius);
  background: var(--surface);
  color: var(--ink);
  box-shadow: var(--shadow-soft);
  font-weight: 800;
  cursor: pointer;
}

.file-choose-button:hover {
  color: var(--accent);
}

.file-choose-button:active {
  transform: translateY(1px);
  box-shadow: var(--pressed-shadow);
}

.reference-add-button {
  justify-self: start;
  margin: 0;
}

.file-local-preview-note strong,
.file-local-preview-note small {
  display: block;
}

.file-local-preview-note small {
  margin-top: 4px;
  color: var(--muted);
}

.file-local-preview-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(112px, 1fr));
  gap: 8px;
  width: min(100%, 560px);
  padding: 10px;
  box-sizing: border-box;
}

.file-local-preview-thumb {
  display: grid;
  grid-template-rows: 112px auto;
  gap: 5px;
  min-width: 0;
  padding: 5px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--control-radius);
  background: rgba(255, 255, 255, 0.35);
}

.file-local-preview-thumb img,
.file-local-preview-thumb-empty > div {
  display: grid;
  place-items: center;
  width: 100%;
  height: 112px;
  border-radius: calc(var(--control-radius) - 2px);
  background: var(--surface);
  object-fit: contain;
  color: var(--muted);
  font-size: 12px;
}

.file-local-preview-thumb span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.3;
}

.file-local-preview {
  cursor: default;
  display: grid;
  justify-items: start;
}

.mask-painter {
  display: grid;
  gap: 8px;
  width: min(100%, 560px);
}

.mask-painter-empty,
.mask-painter-status {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.mask-painter-empty {
  padding: 12px;
  border: 1px dashed var(--line);
  border-radius: var(--control-radius);
  background: rgba(255, 255, 255, 0.38);
}

.mask-painter-stage {
  width: 100%;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--control-radius);
  background: #111;
  box-shadow: var(--inner-shadow);
}

.mask-painter-stage[hidden] {
  display: none;
}

.mask-painter-canvas {
  display: block;
  width: 100%;
  height: auto;
  max-height: min(62vh, 560px);
  object-fit: contain;
  cursor: crosshair;
  touch-action: none;
}

.mask-painter-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.mask-brush-size {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: min(100%, 260px);
  color: var(--muted);
  font-size: 12px;
}

.mask-painter .mask-brush-size input[type="range"] {
  position: static;
  width: min(40vw, 160px);
  height: 20px;
  opacity: 1;
  pointer-events: auto;
}

.mask-brush-size output {
  min-width: 42px;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}

.mask-painter-status {
  display: block;
}

.file-local-preview[hidden] {
  display: none;
}

.file-local-preview-card {
  display: grid;
  place-items: center;
  width: min(100%, 320px);
  aspect-ratio: 1 / 1;
  max-width: 100%;
  padding: 10px;
  overflow: hidden;
  border-radius: var(--control-radius);
  background: rgba(255, 255, 255, 0.45);
  box-shadow: var(--inner-shadow);
}

.file-local-preview-card span,
.file-local-preview-note {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
  word-break: break-word;
}

.file-local-preview-media {
  display: block;
  width: var(--file-preview-media-width, auto);
  height: var(--file-preview-media-height, auto);
  max-width: 100%;
  max-height: 100%;
  border-radius: var(--control-radius);
  background: transparent;
  object-fit: contain;
}

video.file-local-preview-media {
  background: #111;
}

/* —— 音频上传预览：紧凑条，禁止 1:1 方框撑高 —— */
.file-local-preview-audio-wrap {
  display: block;
  width: 100%;
  max-width: 100%;
  min-height: 0;
  padding: 0 10px 10px;
  box-sizing: border-box;
}

audio.file-local-preview-media,
audio.file-local-preview-audio {
  display: block;
  width: 100% !important;
  max-width: 100% !important;
  height: 36px !important;
  max-height: 40px !important;
  min-height: 32px;
  aspect-ratio: auto !important;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  object-fit: unset;
}

.file-box.has-file-preview[data-preview-kind="audio"] {
  gap: 6px;
}

.file-box.has-file-preview[data-preview-kind="audio"] .file-upload-frame {
  display: block;
  min-height: 0 !important;
  height: auto !important;
  aspect-ratio: auto !important;
  overflow: visible;
}

.file-box.has-file-preview[data-preview-kind="audio"] .file-drop {
  min-height: 44px;
  height: auto;
  padding: 8px 12px;
  gap: 10px;
}

.file-box.has-file-preview[data-preview-kind="audio"] .file-drop b {
  width: 28px;
  min-width: 28px;
  height: 28px;
  font-size: 20px;
}

.file-box.has-file-preview[data-preview-kind="audio"] .file-local-preview {
  display: block;
  width: 100%;
  min-height: 0;
  height: auto;
  aspect-ratio: auto;
}

.file-box.has-file-preview[data-preview-kind="audio"] .file-local-preview-card {
  display: none !important; /* 兼容旧 DOM，避免方卡残留 */
}

.file-box.has-file-preview[data-preview-kind="audio"] .file-local-preview-note {
  padding: 6px 10px 10px;
  min-height: 0;
}

html[data-theme="dark"] .file-box.has-file-preview[data-preview-kind="audio"] .file-local-preview-audio-wrap {
  background: transparent;
}

.file-local-preview-note {
  padding: 10px;
  border-radius: var(--control-radius);
  background: rgba(255, 255, 255, 0.42);
  box-shadow: var(--inner-shadow);
}

.file-box.has-file-preview {
  gap: 8px;
}

.file-box.has-file-preview > span:first-child {
  margin-bottom: 0;
}

.file-box.has-file-preview .file-upload-frame {
  overflow: hidden;
  background: #f7fafd;
  box-shadow: var(--inner-shadow);
}

.file-box.has-file-preview .file-drop {
  background: transparent;
  box-shadow: none;
  border-bottom-right-radius: 0;
  border-bottom-left-radius: 0;
}

.file-box.has-file-preview .file-local-preview-card,
.file-box.has-file-preview .file-local-preview-note {
  border-top: 0;
  border-top-right-radius: 0;
  border-top-left-radius: 0;
  background: transparent;
  box-shadow: none;
}

.file-box.has-file-preview .input-toolbox:not(:empty),
.file-box.has-file-preview .input-limit-message:not([hidden]) {
  margin-top: 8px;
}

html[data-theme="dark"] .file-local-preview-card,
html[data-theme="dark"] .file-local-preview-note {
  border: 1px solid var(--line);
  background: var(--surface);
  box-shadow: var(--inner-shadow);
}

html[data-theme="dark"] .file-local-preview-thumb {
  background: rgba(255, 255, 255, 0.04);
}

html[data-theme="dark"] .file-box.has-file-preview .file-upload-frame {
  background: linear-gradient(180deg, #111212 0%, #101111 100%);
  box-shadow: var(--inner-shadow);
}

html[data-theme="dark"] .file-box.has-file-preview .file-local-preview-card,
html[data-theme="dark"] .file-box.has-file-preview .file-local-preview-note {
  border-top: 0;
  border-right: 0;
  border-bottom: 0;
  border-left: 0;
  background: transparent;
  box-shadow: none;
}

html[data-theme="dark"] .file-local-preview-card span,
html[data-theme="dark"] .file-local-preview-note {
  color: var(--muted);
}

.text-field {
  display: grid;
  gap: 8px;
}

.boolean-field {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 8px 12px;
  min-height: 56px;
  padding: 12px 14px;
  border: 1px solid rgba(255, 255, 255, 0.48);
  border-radius: var(--control-radius, 8px);
  background: var(--surface);
  color: var(--ink);
  box-shadow: var(--inner-shadow);
}

.boolean-field-copy {
  min-width: 0;
  color: var(--ink);
  font-size: 14px;
  line-height: 1.35;
}

.boolean-field-copy strong {
  font-weight: 700;
}

.boolean-switch-input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.boolean-switch {
  position: relative;
  display: inline-block;
  width: 52px;
  height: 28px;
  border-radius: 999px;
  background: rgba(120, 135, 158, 0.24);
  box-shadow: var(--inner-shadow);
  transition: background 0.18s ease, box-shadow 0.18s ease;
}

.boolean-switch::after {
  content: "";
  position: absolute;
  top: 4px;
  left: 4px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 4px 10px rgba(29, 48, 68, 0.22);
  transition: transform 0.18s ease;
}

.boolean-switch-input:checked + .boolean-switch {
  background: var(--pink);
  box-shadow: 0 8px 18px rgba(255, 93, 156, 0.22);
}

.boolean-switch-input:checked + .boolean-switch::after {
  transform: translateX(24px);
}

.boolean-switch-input:focus-visible + .boolean-switch {
  outline: 3px solid rgba(79, 140, 255, 0.24);
  outline-offset: 2px;
}

.boolean-switch-state {
  min-width: 52px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  text-align: right;
}

html[data-theme="dark"] .boolean-field {
  border-color: rgba(255, 255, 255, 0.06);
  background: var(--surface);
  box-shadow: var(--inner-shadow);
}

html[data-theme="dark"] .boolean-switch {
  background: rgba(255, 255, 255, 0.10);
}

html[data-theme="dark"] .boolean-switch::after {
  background: #f8fbff;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.58);
}

html[data-theme="dark"] .boolean-switch-state {
  color: var(--muted);
}

.boolean-field .input-help,
.boolean-field .input-limit-message {
  grid-column: 1 / -1;
}

@media (max-width: 720px) {
  .boolean-field {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .boolean-switch-state {
    grid-column: 1 / -1;
    text-align: left;
  }
}

.number-field input {
  min-height: 56px;
  font-size: 18px;
}

.ready-bar {
  min-height: 42px;
  display: flex;
  align-items: center;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.72);
  color: var(--muted);
  padding: 0 14px;
  font-size: 13px;
}

.results-panel {
  max-height: calc(100vh - 196px);
  overflow: auto;
  overscroll-behavior: contain;
}

.task-list {
  display: grid;
  gap: 14px;
  margin-top: 14px;
  padding: 2px 0 10px;
  contain: layout;
}

.task-row {
  display: grid;
  gap: 8px;
  border-radius: 8px;
  background: rgba(246, 249, 253, 0.86);
  padding: 14px;
  box-shadow: 0 8px 22px rgba(93, 111, 130, 0.12);
  contain: layout style;
  contain-intrinsic-size: 260px;
}

.task-row.is-empty {
  color: var(--muted);
}

.task-row-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: start;
}

.task-cost {
  min-height: 18px;
  color: var(--blue, #5c6cff);
  font-size: 12px;
  font-weight: 600;
}

.task-row-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  min-width: 0;
}

.task-id-button {
  max-width: min(360px, 34vw);
  min-height: 38px;
  padding: 0 14px;
  border: 0;
  border-radius: var(--control-radius);
  background: var(--surface);
  box-shadow: var(--shadow-soft);
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.task-id-button:hover {
  color: var(--ink);
  background: var(--surface-2);
  box-shadow: var(--pressed-shadow);
}
.task-title-module {
  color: transparent;
  display: inline-block;
  background: linear-gradient(90deg, var(--pink) 0%, #ff8bc5 26%, var(--blue) 58%, #58c3d0 82%, var(--pink) 100%);
  background-size: 240% 100%;
  background-clip: text;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: titleGradientFlow 3.4s ease-in-out infinite;
}

.task-status-button {
  min-height: 34px;
  padding: 0 14px;
  border: 0;
  border-radius: var(--control-radius);
  background: var(--surface);
  box-shadow: var(--shadow-soft);
  color: var(--ink);
  font-size: 13px;
  font-weight: 700;
}

.task-status-button.is-failed {
  color: var(--danger);
  cursor: pointer;
}

.task-status-button:hover {
  background: var(--surface-2);
  box-shadow: var(--pressed-shadow);
}
.task-row h3 {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  margin: 0;
  font-size: 16px;
}

.task-row time,
.task-row p,
.task-meta {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.task-row time {
  display: block;
  margin-top: 5px;
}

.danger-button {
  color: var(--danger);
  font-weight: 700;
}

.progress {
  height: 8px;
  overflow: hidden;
  border-radius: 8px;
  background: rgba(122, 139, 158, 0.18);
}

.progress span {
  display: block;
  height: 100%;
  width: 0;
  border-radius: inherit;
  background: var(--green);
}
.progress.is-live span {
  width: 38%;
  min-width: 72px;
  animation: task-progress-live 1.25s ease-in-out infinite;
}

.progress.is-error span {
  background: var(--danger);
}

.progress.is-complete span {
  background: var(--green);
}

@keyframes task-progress-live {
  0% { transform: translateX(-110%); }
  100% { transform: translateX(265%); }
}

.task-progress-detail {
  display: grid;
  gap: 7px;
}

.task-progress-line {
  display: grid;
  grid-template-columns: 76px minmax(0, 1fr);
  align-items: center;
  gap: 8px 12px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.task-progress-line strong {
  color: var(--ink);
  font-size: 12px;
}

.task-progress-line > span:not(.task-progress-mini) {
  min-width: 0;
  overflow-wrap: anywhere;
}

.task-failure-detail {
  border-radius: 8px;
  background: rgba(255, 77, 109, 0.1);
  color: var(--danger);
  font-size: 12px;
  font-weight: 700;
  line-height: 1.55;
  padding: 9px 11px;
  overflow-wrap: anywhere;
}

.task-result-pending {
  border-radius: 8px;
  background: rgba(59, 130, 246, 0.1);
  color: #1d4ed8;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.55;
  padding: 9px 11px;
  overflow-wrap: anywhere;
}

.task-progress-mini {
  grid-column: 1 / -1;
  height: 5px;
  overflow: hidden;
  border-radius: 6px;
  background: rgba(122, 139, 158, 0.14);
}

.task-progress-mini span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--green);
}

.task-progress-source {
  color: var(--muted);
  font-size: 11px;
}

.task-fields {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 8px 18px;
}

.task-fields strong {
  color: var(--ink);
  font-size: 13px;
}

.task-fields span,
.task-fields a {
  min-width: 0;
  color: var(--muted);
  font-size: 13px;
  text-decoration: none;
  word-break: break-word;
}

.task-input-preview-button {
  display: inline-flex;
  align-items: center;
  min-width: 0;
  width: fit-content;
  max-width: 100%;
  min-height: 38px;
  border: 0;
  border-radius: 999px;
  padding: 0 22px;
  background: var(--surface);
  box-shadow: var(--shadow-soft);
  color: var(--ink);
  font: inherit;
  font-size: 13px;
  line-height: 1.25;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
  overflow-wrap: anywhere;
}

.task-input-preview-button:hover {
  color: var(--ink);
  background: var(--surface-2);
  box-shadow: var(--pressed-shadow);
  text-decoration: none;
  transform: translateY(1px);
}

.task-input-audio {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  min-width: 0;
}

.task-input-audio > span {
  flex: 1 1 auto;
  min-width: min(170px, 100%);
  color: var(--muted);
  line-height: 1.25;
  overflow-wrap: anywhere;
  word-break: normal;
}

.task-input-audio-control {
  flex: 1 1 300px;
  min-width: min(260px, 100%);
  width: min(360px, 100%) !important;
  height: 38px !important;
  max-height: 38px;
}

.task-input-audio-control::-webkit-media-controls-panel {
  height: 38px;
}

.task-input-audio-control::-webkit-media-controls-mute-button,
.task-input-audio-control::-webkit-media-controls-volume-slider,
.task-input-audio-control::-webkit-media-controls-volume-control-container,
.task-input-audio-control::-webkit-media-controls-overflow-button {
  display: none !important;
}


@media (max-width: 720px) {
  .task-row-head {
    grid-template-columns: 1fr;
  }

  .task-row-actions {
    justify-content: flex-start;
  }

  .task-id-button {
    max-width: 100%;
  }

  .task-input-audio {
    flex-wrap: wrap;
  }

  .task-input-audio-control {
    flex-basis: 100%;
    min-width: 0;
    width: 100% !important;
  }
}
.task-media-lightbox[hidden] {
  display: none;
}

.task-media-lightbox {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  padding: 28px;
}

.task-media-lightbox-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(18, 24, 34, 0.74);
  backdrop-filter: blur(5px);
}

.task-media-lightbox-body {
  position: relative;
  z-index: 1;
  display: grid;
  gap: 12px;
  width: min(920px, calc(100vw - 44px));
  max-height: calc(100vh - 56px);
  padding: 14px;
  border-radius: var(--control-radius);
  background: var(--surface);
  box-shadow: var(--shadow-strong);
}

.task-media-lightbox-close {
  display: none;
}

.task-media-lightbox-title {
  padding-right: 0;
  color: var(--ink);
  font-size: 13px;
  font-weight: 700;
  overflow-wrap: anywhere;
}

.task-media-lightbox-media {
  display: block;
  width: 100%;
  max-height: calc(100vh - 150px);
  border-radius: var(--small-radius);
  background: #111;
  object-fit: contain;
}
.media-preview {
  width: min(100%, 420px);
  max-height: 300px;
  border-radius: 8px;
  background: #111;
}

audio.media-preview {
  background: transparent;
}

.release-panel,
.log-drawer {
  position: fixed;
  right: 22px;
  top: 116px;
  z-index: 40;
  width: min(460px, calc(100vw - 44px));
  max-height: calc(100vh - 140px);
  overflow: auto;
  padding: 16px;
}

.release-panel[hidden],
.log-drawer[hidden] {
  display: none;
}

.stack {
  display: grid;
  gap: 12px;
}

.two-column {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 12px;
}

.compact-stack textarea {
  min-height: 96px;
}

.check-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.check-row input {
  width: auto;
}

.check-row span {
  margin: 0;
}

.release-auth-actions {
  justify-content: flex-start;
  align-items: center;
  flex-wrap: wrap;
}

.release-advanced {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  background: rgba(255, 255, 255, 0.54);
}

.release-advanced summary {
  cursor: pointer;
  color: var(--muted);
  font-size: 12px;
}

.release-advanced label {
  margin-top: 10px;
}

.release-advanced button {
  margin-top: 10px;
}

.release-log,
.log-box {
  overflow: auto;
  margin: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #15202b;
  color: #e6f0f7;
  padding: 12px;
  font-size: 12px;
  line-height: 1.6;
  white-space: pre-wrap;
}

.release-log {
  min-height: 110px;
  max-height: 180px;
}

.log-box {
  min-height: 360px;
  max-height: 55vh;
  margin-top: 12px;
}

.release-preview {
  min-height: 62px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.68);
  color: var(--muted);
  padding: 10px;
  font-size: 12px;
  line-height: 1.55;
  white-space: pre-wrap;
  word-break: break-word;
}

.muted {
  color: var(--muted);
  font-size: 12px;
}

.activation-overlay {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(27, 42, 58, 0.42);
}

.activation-overlay[hidden] {
  display: none;
}

.account-overlay {
  position: fixed;
  inset: 0;
  z-index: 70;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(27, 42, 58, 0.42);
}

.account-overlay[hidden] {
  display: none;
}

.account-dialog {
  width: min(420px, 100%);
  padding: 18px;
  border: 0;
  border-radius: var(--panel-radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.account-dialog .panel-head {
  align-items: flex-start;
  margin-bottom: 14px;
}

.account-close-button {
  flex: 0 0 auto;
}

.account-tabs {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 6px;
  margin-bottom: 14px;
  padding: 4px;
  border-radius: var(--control-radius);
  background: var(--surface-strong);
}

.account-tabs button {
  min-height: 36px;
  border: 0;
  border-radius: var(--control-radius);
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}

.account-tabs button.is-active {
  background: var(--surface);
  color: var(--ink);
  box-shadow: var(--shadow-soft);
}

.account-note {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.6;
}

.account-status-button {
  cursor: pointer;
  font: inherit;
}

.activation-dialog {
  width: min(420px, 100%);
  padding: 18px;
}

.activation-dialog .panel-head {
  align-items: flex-start;
  margin-bottom: 14px;
}

.toast {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 60;
  max-width: min(420px, calc(100vw - 40px));
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #17202b;
  color: #fff;
  padding: 12px 14px;
  box-shadow: var(--shadow);
  font-size: 13px;
}

@media (max-width: 860px) {
  .studio-layout,
  .work-grid {
    grid-template-columns: 1fr;
  }

  .module-rail {
    min-height: auto;
  }

  .results-panel {
    max-height: none;
  }
}

@media (max-width: 680px) {
  .app-shell {
    padding: 12px;
  }

  .topbar,
  .form-head,
  .studio-head,
  .results-head,
  .drawer-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .brand h1 {
    font-size: 22px;
  }

  .top-actions {
    justify-content: flex-start;
  }

  .form-actions {
    justify-content: flex-start;
    width: 100%;
  }

  .task-row-head,
  .task-fields,
  .two-column {
    grid-template-columns: 1fr;
  }
}

/* Neumorphic desktop skin, based on the previous Creator UI visual language. */
:root {
  color-scheme: light;
  --bg: #e0e5ec;
  --surface: #e0e5ec;
  --surface-2: #e7ebf1;
  --surface-3: #d8e0ea;
  --ink: #2c3e50;
  --muted: #6c757d;
  --line: rgba(120, 135, 158, 0.2);
  --blue: #6e82df;
  --pink: #ff5d9c;
  --green: #22e083;
  --warn: #b77816;
  --danger: #ff4264;
  --panel-radius: 18px;
  --control-radius: 14px;
  --small-radius: 12px;
  --shadow: 8px 8px 16px rgba(163, 177, 198, 0.6), -8px -8px 16px rgba(255, 255, 255, 0.82);
  --shadow-strong: 10px 10px 20px rgba(163, 177, 198, 0.66), -10px -10px 20px rgba(255, 255, 255, 0.88);
  --shadow-soft: 5px 5px 12px rgba(163, 177, 198, 0.42), -5px -5px 12px rgba(255, 255, 255, 0.72);
  --inner-shadow: inset 6px 6px 12px rgba(163, 177, 198, 0.58), inset -6px -6px 12px rgba(255, 255, 255, 0.82);
  --pressed-shadow: inset 3px 3px 7px rgba(163, 177, 198, 0.62), inset -3px -3px 7px rgba(255, 255, 255, 0.82);
}

html[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0e0f0f;
  --surface: #151616;
  --surface-2: #1b1c1d;
  --surface-3: #232426;
  --ink: #fbfdff;
  --muted: #b0b0b0;
  --line: rgba(255, 255, 255, 0.08);
  --blue: #5f7cff;
  --pink: #ff5d9c;
  --green: #35f09a;
  --warn: #e0aa55;
  --danger: #ff4264;
  --shadow: 8px 8px 18px rgba(0, 0, 0, 0.88), -6px -6px 16px rgba(255, 255, 255, 0.025);
  --shadow-strong: 12px 12px 26px rgba(0, 0, 0, 0.92), -10px -10px 22px rgba(255, 255, 255, 0.03);
  --shadow-soft: 5px 5px 12px rgba(0, 0, 0, 0.68), -4px -4px 10px rgba(255, 255, 255, 0.018);
  --inner-shadow: inset 6px 6px 14px rgba(0, 0, 0, 0.88), inset -5px -5px 12px rgba(255, 255, 255, 0.025);
  --pressed-shadow: inset 4px 4px 10px rgba(0, 0, 0, 0.92), inset -3px -3px 8px rgba(255, 255, 255, 0.018);
}

html,
body {
  background: var(--bg);
}

body {
  overflow: hidden;
}

button,
input,
textarea,
select,
.status-pill,
.tag {
  border: 0;
  border-radius: var(--control-radius);
  background: var(--surface);
  color: var(--ink);
  box-shadow: var(--shadow-soft);
}

button {
  transition: color 0.16s ease, background 0.16s ease, box-shadow 0.16s ease, transform 0.16s ease;
}

button:hover {
  border-color: transparent;
  background: var(--surface-2);
  box-shadow: var(--pressed-shadow);
  transform: translateY(1px);
}

button:active {
  box-shadow: var(--pressed-shadow);
  transform: translateY(1px);
}

button:disabled {
  box-shadow: var(--inner-shadow);
}

input,
textarea,
select,
.ready-bar,
.file-drop,
.release-preview {
  background: var(--surface);
  color: var(--ink);
  box-shadow: var(--inner-shadow);
}

input:focus,
textarea:focus,
select:focus {
  border-color: transparent;
  box-shadow: 0 0 0 3px rgba(110, 130, 223, 0.16), var(--inner-shadow);
}

input.is-invalid,
textarea.is-invalid,
select.is-invalid {
  box-shadow: 0 0 0 3px rgba(189, 63, 69, 0.16), var(--inner-shadow);
}

.app-shell {
  height: 100vh;
  min-height: 0;
  overflow: hidden;
  background: var(--bg);
  padding: 12px;
}

.topbar {
  min-height: 76px;
  padding: 12px 20px;
  border: 0;
  border-radius: var(--panel-radius);
  background: var(--surface);
  box-shadow: var(--shadow);
  -webkit-app-region: drag;
  user-select: none;
}

.brand,
.top-actions,
.tool-button,
.window-control-button,
button,
input,
textarea,
select,
a {
  -webkit-app-region: no-drag;
}

.brand img {
  width: 50px;
  height: 50px;
  border-radius: 15px;
  box-shadow: 4px 4px 8px rgba(163, 177, 198, 0.48), -4px -4px 8px rgba(255, 255, 255, 0.74);
}

.brand h1 {
  color: transparent;
  background: linear-gradient(90deg, #ff4f9a 0%, #ff7ac8 28%, #ff4f9a 56%, #d85dff 78%, #ff4f9a 100%);
  background-size: 240% 100%;
  background-clip: text;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  font-size: 28px;
  line-height: 1;
  animation: brandPinkShift 3.2s ease-in-out infinite;
  filter: drop-shadow(0 0 0 rgba(255, 79, 154, 0));
  transition: filter 0.24s ease, transform 0.24s ease;
}

.brand:hover h1 {
  filter: drop-shadow(0 5px 14px rgba(255, 79, 154, 0.26));
  transform: translateY(-1px);
}

@keyframes brandPinkShift {
  0%, 100% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
}

.brand p {
  min-height: 14px;
  margin-top: 8px;
  font-size: 12px;
}

.top-actions {
  flex-wrap: nowrap;
  gap: 10px;
}

.tool-button {
  width: 44px;
  min-width: 44px;
  height: 44px;
  min-height: 44px;
  border-radius: var(--small-radius);
  background: var(--surface);
  color: var(--muted);
  box-shadow: 6px 6px 12px rgba(163, 177, 198, 0.54), -6px -6px 12px rgba(255, 255, 255, 0.78);
  font-size: 0;
}

html[data-theme="dark"] .tool-button {
  box-shadow: 6px 6px 14px rgba(6, 8, 12, 0.62), -6px -6px 14px rgba(72, 80, 94, 0.16);
}

.tool-button:hover {
  color: var(--ink);
  box-shadow: var(--pressed-shadow);
}

.toolbar-divider {
  height: 34px;
  background: var(--line);
  box-shadow: -1px -1px 2px rgba(255, 255, 255, 0.58), 1px 1px 2px rgba(120, 135, 158, 0.28);
}

.window-divider {
  margin-left: 2px;
}

.icon {
  position: relative;
  display: inline-grid;
  width: 22px;
  height: 22px;
  place-items: center;
  color: currentColor;
  font-size: 22px;
  line-height: 1;
}

.icon::before {
  display: block;
  font-size: 22px;
  line-height: 1;
}

.icon-publish::before {
  content: "";
  display: block;
  width: 22px;
  height: 22px;
  background: currentColor;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 19V5M5 12l7-7 7 7'/%3E%3C/svg%3E") no-repeat center / contain;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 19V5M5 12l7-7 7 7'/%3E%3C/svg%3E") no-repeat center / contain;
}

.icon-refresh::before {
  content: "";
  font-size: 22px;
}

.icon-download::before {
  content: "鈬?;
  font-size: 23px;
}

.icon-folder::before {
  content: "鈻?;
  font-size: 25px;
  transform: translateY(-1px);
}

.icon-log::before {
  content: "鈮?;
  font-size: 24px;
}

.icon-theme::before {
  content: "鈼?;
  font-size: 23px;
}

html[data-theme="dark"] .icon-theme::before {
  content: "鈽?;
  font-size: 21px;
}

.icon-sync::before {
  content: "鈫?;
  font-size: 22px;
}

.window-glyph {
  position: relative;
  display: inline-block;
  width: 18px;
  height: 18px;
  color: currentColor;
  flex-shrink: 0;
}

.window-minimize::before {
  content: "";
  position: absolute;
  left: 2px;
  right: 2px;
  top: 9px;
  height: 2px;
  border-radius: 999px;
  background: currentColor;
}

.window-maximize::before {
  content: "";
  position: absolute;
  inset: 3px;
  border: 2px solid currentColor;
  border-radius: 2px;
}

.window-close::before,
.window-close::after {
  content: "";
  position: absolute;
  left: 2px;
  top: 8px;
  width: 15px;
  height: 2px;
  border-radius: 999px;
  background: currentColor;
}

.window-close::before {
  transform: rotate(45deg);
}

.window-close::after {
  transform: rotate(-45deg);
}

.close-window-button:hover {
  color: var(--danger);
}

.status-strip {
  margin-top: 14px;
  padding: 2px 4px;
}

.status-message[hidden] {
  display: none;
}

.status-pill,
.tag {
  min-height: 30px;
  padding: 0 12px;
}

.status-pill.ok,
.tag.ok,
.status-pill.warn,
.tag.warn,
.status-pill.error,
.tag.error {
  background: var(--surface);
  box-shadow: var(--shadow-soft);
}

.studio-layout {
  height: calc(100vh - 118px);
  min-height: 0;
  gap: 18px;
  margin-top: 14px;
}

.module-rail,
.compose-card,
.results-panel,
.release-panel,
.log-drawer,
.activation-dialog,
.task-row {
  border: 0;
  border-radius: var(--panel-radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.module-rail {
  min-height: 0;
  overflow: auto;
  padding: 14px;
}

.module-rail-head {
  display: none;
}

.module-list {
  gap: 14px;
}

.module-card {
  min-height: 62px;
  border: 0;
  border-radius: var(--control-radius);
  background: var(--surface);
  box-shadow: var(--shadow-soft);
}

.module-card:hover {
  box-shadow: var(--pressed-shadow);
}

.module-card.is-active {
  border-color: transparent;
  box-shadow: 0 0 0 2px rgba(137, 115, 255, 0.24), var(--pressed-shadow);
}

.module-card p {
  display: none;
}

.studio-main {
  min-height: 0;
  overflow: hidden;
}

.studio-head {
  min-height: 66px;
  border-bottom-color: var(--line);
  padding: 10px 24px 16px;
  border-radius: var(--panel-radius) var(--panel-radius) 0 0;
  background: transparent;
}

.studio-head h2 {
  color: var(--ink);
  font-size: 23px;
  font-weight: 800;
}

.studio-head p:empty,
#modeHint:empty {
  display: none;
}

.work-grid {
  height: calc(100% - 82px);
  min-height: 0;
  padding: 18px 0 0;
}

.compose-card,
.results-panel {
  min-height: 0;
  padding: 18px;
}

.compose-card {
  max-height: 100%;
  overflow: auto;
}

.results-panel {
  max-height: 100%;
  overflow: auto;
}

.form-head h3 {
  margin: 0;
  color: var(--ink);
  font-size: 19px;
  font-weight: 700;
}

.primary-button {
  min-width: 76px;
  border-radius: 999px;
  background: linear-gradient(135deg, #ff5d9c, #ff6f8c);
  color: #fff;
  box-shadow: 6px 8px 16px rgba(255, 93, 156, 0.24), -4px -4px 10px rgba(255, 255, 255, 0.55);
}

.secondary-button {
  min-width: 86px;
  min-height: 38px;
  padding: 0 14px;
  border-radius: 999px;
  font-weight: 700;
}

.segmented button.is-active {
  border-color: transparent;
  background: var(--surface-2);
  box-shadow: var(--pressed-shadow);
  color: var(--ink);
}

label span {
  color: var(--ink);
}

.file-drop {
  min-height: 62px;
  border-radius: var(--control-radius);
}

.file-drop b {
  background: var(--surface-2);
  box-shadow: var(--shadow-soft);
}

.ready-bar {
  border-radius: var(--control-radius);
}

.ready-bar.ok {
  color: #238138;
  background: rgba(72, 185, 90, 0.10);
}

.ready-bar.warn {
  color: var(--warn);
  background: rgba(183, 120, 22, 0.10);
}

.ready-bar.error {
  color: var(--danger);
  background: rgba(189, 63, 69, 0.10);
}

.limit-hint {
  display: block;
  margin: -2px 0 8px;
  color: var(--warn);
  font-size: 12px;
  font-style: normal;
  line-height: 1.45;
}

.input-help {
  border-radius: var(--small-radius);
  padding: 8px 10px;
  background: rgba(110, 130, 223, 0.08);
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}
.input-limit-message {
  min-height: 30px;
  display: flex;
  align-items: center;
  border-radius: var(--small-radius);
  padding: 8px 10px;
  background: rgba(110, 130, 223, 0.08);
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.input-limit-message[hidden] {
  display: none;
}

.input-limit-message.ok {
  background: rgba(72, 185, 90, 0.10);
  color: #238138;
}

.input-limit-message.warn {
  background: rgba(183, 120, 22, 0.10);
  color: var(--warn);
}

.input-limit-message.error {
  background: rgba(189, 63, 69, 0.12);
  color: var(--danger);
  font-weight: 700;
}

.input-toolbox:empty {
  display: none;
}

.input-tool-row {
  display: grid;
  grid-template-columns: auto minmax(72px, 1fr) minmax(72px, 1fr) auto;
  gap: 8px;
  align-items: center;
  padding: 10px;
  border-radius: var(--control-radius);
  background: rgba(255, 255, 255, 0.42);
  box-shadow: var(--inner-shadow);
}

.input-tool-row span {
  margin: 0;
  white-space: nowrap;
}

.input-tool-row input {
  min-height: 34px;
  padding: 8px 10px;
}

.input-tool-row button {
  min-height: 34px;
  padding: 0 12px;
  box-shadow: var(--shadow-soft);
}

.module-card small {
  display: block;
  margin-top: 7px;
  color: var(--warn);
  font-size: 11px;
  line-height: 1.35;
  overflow-wrap: anywhere;
}
.results-head h2 {
  font-size: 19px;
  font-weight: 700;
}

.task-row {
  gap: 8px;
  padding: 16px;
  background: var(--surface);
}

.task-row-head {
  align-items: start;
}

.task-row-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  min-width: 0;
}

.task-id-button {
  max-width: min(360px, 34vw);
  min-height: 38px;
  padding: 0 14px;
  border: 0;
  border-radius: var(--control-radius);
  background: var(--surface);
  box-shadow: var(--shadow-soft);
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.task-id-button:hover {
  color: var(--ink);
  background: var(--surface-2);
  box-shadow: var(--pressed-shadow);
}
.task-title-module {
  color: transparent;
  display: inline-block;
  background: linear-gradient(90deg, var(--pink) 0%, #ff8bc5 26%, var(--blue) 58%, #58c3d0 82%, var(--pink) 100%);
  background-size: 240% 100%;
  background-clip: text;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: titleGradientFlow 3.4s ease-in-out infinite;
}

.task-status-button {
  min-height: 34px;
  padding: 0 14px;
  border: 0;
  border-radius: var(--control-radius);
  background: var(--surface);
  box-shadow: var(--shadow-soft);
  color: var(--ink);
  font-size: 13px;
  font-weight: 700;
}

.task-status-button.is-failed {
  color: var(--danger);
  cursor: pointer;
}

.task-status-button:hover {
  background: var(--surface-2);
  box-shadow: var(--pressed-shadow);
}
.task-row h3 {
  font-size: 16px;
  line-height: 1.35;
}

.progress {
  height: 9px;
  background: var(--surface);
  box-shadow: var(--inner-shadow);
}

.progress span {
  background: var(--green);
}

.progress.is-error span {
  background: var(--danger);
}

.task-fields {
  gap: 5px 14px;
}

.task-fields strong,
.task-fields span {
  font-size: 13px;
}

.media-stack {
  display: grid;
  gap: 12px;
}

.media-preview-wrap {
  display: grid;
  gap: 8px;
  min-width: 0;
}

.media-preview-name {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
  word-break: break-word;
}

.media-preview,
.file-preview {
  width: min(100%, 520px);
  border-radius: var(--control-radius);
  background: #111;
  box-shadow: var(--shadow-soft);
}
.media-preview {
  max-height: 360px;
  object-fit: contain;
}

audio.media-preview {
  width: min(100%, 520px);
  background: transparent;
  box-shadow: none;
}

.file-preview {
  display: inline-flex;
  width: fit-content;
  max-width: 100%;
  min-height: 38px;
  align-items: center;
  padding: 0 14px;
  color: var(--ink);
  text-decoration: none;
}

.release-panel,
.log-drawer {
  top: 104px;
  background: var(--surface);
}

.release-log,
.log-box {
  border: 0;
  background: #18212d;
  box-shadow: var(--inner-shadow);
}

.toast {
  border: 0;
  border-radius: var(--control-radius);
  box-shadow: var(--shadow-strong);
}

html[data-theme="dark"] .brand img,
html[data-theme="dark"] .primary-button {
  box-shadow: var(--shadow-soft);
}


html[data-theme="dark"] .primary-button:hover {
  border-color: transparent;
  background: linear-gradient(135deg, #ff4f96, #ff667f);
  color: #fff;
  box-shadow: var(--pressed-shadow);
  transform: translateY(1px);
}
html[data-theme="dark"] .release-log,
html[data-theme="dark"] .log-box {
  background: #151923;
}

@media (max-width: 560px) {
  .media-result-row {
    grid-template-columns: minmax(0, 1fr) auto;
  }
}

@media (max-width: 980px) {
  body {
    overflow: auto;
  }

  .app-shell {
    height: auto;
    min-height: 100vh;
    overflow: visible;
  }

  .top-actions {
    flex-wrap: wrap;
  }

  .studio-layout {
    height: auto;
  }

  .work-grid {
    height: auto;
  }
}


/* UI polish 2026-06-19 */
html[data-ui-density="locked"],
html[data-ui-density="locked"] body {
  width: 100%;
  height: 100%;
  overflow: hidden;
}

html[data-ui-density="locked"] .app-shell {
  width: 100vw;
  height: 100vh;
  min-width: 0;
  min-height: 0;
  transform: none;
  transform-origin: 0 0;
}

html[data-theme="dark"] {
  --bg: #0e0f0f;
  --surface: #151616;
  --surface-2: #1b1c1d;
  --surface-3: #232426;
  --ink: #fbfdff;
  --muted: #b0b0b0;
  --line: rgba(255, 255, 255, 0.08);
  --blue: #5f7cff;
  --pink: #ff5d9c;
  --green: #35f09a;
  --warn: #e0aa55;
  --danger: #ff4264;
  --shadow: 8px 8px 18px rgba(0, 0, 0, 0.88), -6px -6px 16px rgba(255, 255, 255, 0.025);
  --shadow-strong: 12px 12px 26px rgba(0, 0, 0, 0.92), -10px -10px 22px rgba(255, 255, 255, 0.03);
  --shadow-soft: 5px 5px 12px rgba(0, 0, 0, 0.68), -4px -4px 10px rgba(255, 255, 255, 0.018);
  --inner-shadow: inset 6px 6px 14px rgba(0, 0, 0, 0.88), inset -5px -5px 12px rgba(255, 255, 255, 0.025);
  --pressed-shadow: inset 4px 4px 10px rgba(0, 0, 0, 0.92), inset -3px -3px 8px rgba(255, 255, 255, 0.018);
}

html[data-theme="dark"] .topbar,
html[data-theme="dark"] .module-rail,
html[data-theme="dark"] .compose-card,
html[data-theme="dark"] .results-panel,
html[data-theme="dark"] .release-panel,
html[data-theme="dark"] .log-drawer,
html[data-theme="dark"] .activation-dialog,
html[data-theme="dark"] .task-row {
  background: linear-gradient(145deg, #181919 0%, #141515 100%);
}

.brand img {
  animation: brandLogoGlow 4.8s ease-in-out infinite;
}

.brand h1,
.studio-head h2 {
  color: transparent;
  display: inline-block;
  background: linear-gradient(90deg, var(--pink) 0%, #ff8bc5 26%, var(--blue) 58%, #58c3d0 82%, var(--pink) 100%);
  background-size: 240% 100%;
  background-clip: text;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: titleGradientFlow 3.4s ease-in-out infinite;
}

.studio-head h2 {
  background-image: linear-gradient(90deg, var(--blue) 0%, #7fd3ff 28%, var(--blue) 56%, var(--pink) 82%, var(--blue) 100%);
}

html[data-theme="dark"] .brand h1 {
  background-image: linear-gradient(90deg, #ff5d9c 0%, #ff4ea3 52%, #ff83bf 100%);
}

@keyframes titleGradientFlow {
  0%, 100% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
}

@keyframes brandLogoGlow {
  0%, 100% { filter: saturate(1.05) hue-rotate(0deg); box-shadow: 0 0 0 rgba(255, 112, 174, 0), var(--shadow-soft); }
  50% { filter: saturate(1.32) hue-rotate(24deg); box-shadow: 0 0 22px rgba(255, 112, 174, 0.32), 0 0 18px rgba(127, 211, 255, 0.18), var(--shadow-soft); }
}

.icon {
  overflow: visible;
}

.icon::before,
.icon::after {
  content: "";
  position: absolute;
  display: block;
  box-sizing: border-box;
}

.icon-publish::before {
  left: 9px;
  top: 4px;
  width: 4px;
  height: 15px;
  border-radius: 999px;
  background: currentColor;
  -webkit-mask: none;
  mask: none;
}

.icon-publish::after {
  left: 4px;
  top: 4px;
  width: 14px;
  height: 14px;
  border-left: 3px solid currentColor;
  border-top: 3px solid currentColor;
  transform: rotate(45deg);
  border-radius: 2px;
}

.icon-refresh::before {
  content: "";
  inset: 5px;
  border: 2.5px solid currentColor;
  border-top-color: transparent;
  border-right-color: transparent;
  border-radius: 50%;
  transform: rotate(45deg);
}

.icon-refresh::after {
  content: "";
  right: 3px;
  top: 2px;
  width: 0;
  height: 0;
  border-left: 5.5px solid currentColor;
  border-top: 4px solid transparent;
  border-bottom: 4px solid transparent;
  transform: rotate(45deg);
}

.icon-download::before {
  left: 3px;
  top: 7px;
  width: 16px;
  height: 12px;
  border: 2.5px solid currentColor;
  border-radius: 3px;
}

.icon-download::after {
  left: 6px;
  top: 3px;
  width: 10px;
  height: 7px;
  border: 2.5px solid currentColor;
  border-bottom: 0;
  border-radius: 3px 3px 0 0;
}

.icon-folder::before {
  content: "";
  left: 3px;
  top: 6px;
  width: 16px;
  height: 12px;
  border: 2px solid currentColor;
  border-radius: 3px;
}

.icon-folder::after {
  left: 3px;
  top: 6px;
  width: 8px;
  height: 5px;
  border: 2px solid currentColor;
  border-bottom: 0;
  border-radius: 3px 3px 0 0;
  background: var(--surface);
}

/* ---- media-preview actions ---- */
.media-result-row {
  display: grid;
  grid-template-columns: auto auto;
  align-items: center;
  gap: 10px;
  max-width: 580px;
}

.media-result-row .media-preview,
.media-result-row .file-preview {
  width: 100%;
}

.media-output-preview-button {
  min-width: 96px;
  justify-content: center;
}

.media-result-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
}

.media-preview-actions {
  display: flex;
  justify-content: flex-end;
  padding: 4px 6px 0 0;
  gap: 6px;
}

.media-folder-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  min-width: 32px;
  height: 32px;
  min-height: 32px;
  padding: 0;
  border-radius: 6px;
  background: var(--surface-2);
  color: var(--muted);
  box-shadow: 0 2px 6px rgba(100, 122, 148, 0.12);
  transition: color 0.15s, box-shadow 0.15s;
}

.media-folder-button:hover {
  color: var(--ink);
  box-shadow: 0 2px 8px rgba(79, 140, 255, 0.25);
}

.mini-folder-icon {
  position: relative;
  display: inline-block;
  width: 14px;
  height: 11px;
  color: currentColor;
  flex-shrink: 0;
}

.mini-folder-icon::before {
  content: "";
  position: absolute;
  left: 1px;
  top: 2px;
  width: 12px;
  height: 9px;
  border: 1.8px solid currentColor;
  border-radius: 2px;
}

.mini-folder-icon::after {
  content: "";
  position: absolute;
  left: 1px;
  top: 2px;
  width: 6px;
  height: 4px;
  border: 1.8px solid currentColor;
  border-bottom: 0;
  border-radius: 2px 2px 0 0;
  background: var(--surface-2);
}

.media-folder-button:hover .mini-folder-icon::after {
  background: var(--surface);
}

html[data-theme="dark"] .media-folder-button {
  background: rgba(255, 255, 255, 0.06);
  color: rgba(255, 255, 255, 0.55);
}

html[data-theme="dark"] .media-folder-button:hover {
  color: var(--ink);
  background: rgba(79, 140, 255, 0.12);
}

html[data-theme="dark"] .mini-folder-icon::after {
  background: rgba(255, 255, 255, 0.06);
}

html[data-theme="dark"] .media-folder-button:hover .mini-folder-icon::after {
  background: rgba(79, 140, 255, 0.12);
}

.icon-log::before {
  content: "";
  left: 3px;
  top: 4px;
  width: 16px;
  height: 2.5px;
  border-radius: 999px;
  background: currentColor;
  box-shadow: 0 6px 0 0 currentColor, 0 12px 0 0 currentColor;
}

.icon-log::after {
  display: none;
}

.icon-theme::before {
  content: "";
  left: 6px;
  top: 6px;
  width: 12px;
  height: 12px;
  border: 2px solid currentColor;
  border-radius: 50%;
  box-shadow: 0 -7px 0 -5px currentColor, 0 7px 0 -5px currentColor, 7px 0 0 -5px currentColor, -7px 0 0 -5px currentColor, 5px 5px 0 -5px currentColor, -5px -5px 0 -5px currentColor, 5px -5px 0 -5px currentColor, -5px 5px 0 -5px currentColor;
}

.icon-theme::after {
  display: none;
}

html[data-theme="dark"] .icon-theme::before {
  content: "";
  left: 4px;
  top: 3px;
  width: 16px;
  height: 16px;
  border: 0;
  border-radius: 50%;
  background: currentColor;
  box-shadow: none;
}

html[data-theme="dark"] .icon-theme::after {
  display: block;
  left: 10px;
  top: 0px;
  width: 15px;
  height: 15px;
  border-radius: 50%;
  background: var(--surface);
}

.studio-layout,
.studio-main {
  overflow: visible;
}

.studio-main {
  position: relative;
  z-index: 1;
}

.studio-head {
  position: absolute;
  left: 10px;
  top: -52px;
  z-index: 2;
  min-height: 34px;
  padding: 0;
  border-bottom: 0;
  pointer-events: none;
}

.studio-head p,
#taskDescription {
  display: none;
}

.work-grid {
  height: 100%;
  padding-top: 0;
  gap: 24px;
}

.module-rail,
.compose-card,
.results-panel {
  position: relative;
}

.module-rail {
  z-index: 3;
}

.compose-card,
.results-panel {
  z-index: 2;
}

/* ---- full-height desktop workspace ---- */
.app-shell {
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
  gap: 14px;
}

.status-strip,
.studio-layout {
  margin-top: 0;
}

.studio-layout {
  height: 100%;
}

/* ---- equal-height workspace panels ---- */
.studio-layout {
  align-items: stretch;
}

.module-rail,
.studio-main {
  height: 100%;
  min-height: 0;
}

.work-grid {
  min-height: 0;
  align-items: stretch;
}

.module-rail,
.compose-card,
.results-panel {
  height: 100%;
  max-height: none;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
}

.compose-card,
.results-panel {
  align-self: stretch;
}


.task-row > button[data-poll] {
  display: none;
}

/* ---- custom scrollbar (neumorphic) ---- */
.module-rail::-webkit-scrollbar,
.compose-card::-webkit-scrollbar,
.results-panel::-webkit-scrollbar,
.task-list::-webkit-scrollbar,
.input-stack::-webkit-scrollbar {
  width: 7px;
}

.module-rail::-webkit-scrollbar-track,
.compose-card::-webkit-scrollbar-track,
.results-panel::-webkit-scrollbar-track,
.task-list::-webkit-scrollbar-track,
.input-stack::-webkit-scrollbar-track {
  background: transparent;
  border-radius: 4px;
  margin: 4px 0;
}

.module-rail::-webkit-scrollbar-thumb,
.compose-card::-webkit-scrollbar-thumb,
.results-panel::-webkit-scrollbar-thumb,
.task-list::-webkit-scrollbar-thumb,
.input-stack::-webkit-scrollbar-thumb {
  background: var(--surface-3);
  border-radius: 4px;
  box-shadow: inset 0 1px 3px rgba(100, 122, 148, 0.18), 0 1px 2px rgba(255, 255, 255, 0.6);
}

.module-rail::-webkit-scrollbar-thumb:hover,
.compose-card::-webkit-scrollbar-thumb:hover,
.results-panel::-webkit-scrollbar-thumb:hover,
.task-list::-webkit-scrollbar-thumb:hover,
.input-stack::-webkit-scrollbar-thumb:hover {
  background: var(--muted);
}

html[data-theme="dark"] .module-rail::-webkit-scrollbar-thumb,
html[data-theme="dark"] .compose-card::-webkit-scrollbar-thumb,
html[data-theme="dark"] .results-panel::-webkit-scrollbar-thumb,
html[data-theme="dark"] .task-list::-webkit-scrollbar-thumb,
html[data-theme="dark"] .input-stack::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.12);
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.3);
}

html[data-theme="dark"] .module-rail::-webkit-scrollbar-thumb:hover,
html[data-theme="dark"] .compose-card::-webkit-scrollbar-thumb:hover,
html[data-theme="dark"] .results-panel::-webkit-scrollbar-thumb:hover,
html[data-theme="dark"] .task-list::-webkit-scrollbar-thumb:hover,
html[data-theme="dark"] .input-stack::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.22);
}

@media (max-width: 980px) {
  .module-rail,
  .compose-card,
  .results-panel {
    height: auto;
    max-height: none;
    overflow: visible;
    scrollbar-gutter: auto;
  }
}

@media (max-width: 980px) {
  html[data-ui-density="locked"] .app-shell {
    width: 100%;
    height: auto;
    transform: none;
  }

  .studio-head {
    position: static;
    pointer-events: auto;
    margin-bottom: 12px;
  }
}


/* ---- proportional desktop scaling ---- */
:root {
  --app-scale: 1;
}

html[data-ui-density] body {
  width: 100%;
  height: 100%;
  overflow: hidden;
}

html[data-ui-density] .app-shell {
  width: calc(100vw / var(--app-scale, 1));
  height: calc(100vh / var(--app-scale, 1));
  transform: scale(var(--app-scale, 1));
  transform-origin: 0 0;
  overflow: hidden;
}

html[data-ui-density] .topbar,
html[data-ui-density] .studio-layout,
html[data-ui-density] .work-grid {
  min-width: 0;
}

html[data-ui-density] .work-grid {
  grid-template-columns: minmax(300px, 0.78fr) minmax(330px, 1fr);
}

html[data-ui-density] .module-rail {
  min-width: 0;
}

html[data-ui-density="scaled"] .studio-layout {
  display: grid;
  grid-template-columns: minmax(230px, 260px) minmax(0, 1fr);
  align-items: stretch;
  gap: 18px;
  height: 100%;
  min-height: 0;
  margin-top: 0;
  overflow: visible;
}

html[data-ui-density="scaled"] .studio-main {
  position: relative;
  z-index: 1;
  height: 100%;
  min-height: 0;
  overflow: visible;
}

html[data-ui-density="scaled"] .studio-head {
  position: absolute;
  left: 10px;
  top: -52px;
  z-index: 2;
  min-height: 34px;
  margin: 0;
  padding: 0;
  border-bottom: 0;
  pointer-events: none;
}

html[data-ui-density="scaled"] .studio-head p,
html[data-ui-density="scaled"] #taskDescription {
  display: none;
}

html[data-ui-density="scaled"] .work-grid {
  display: grid;
  grid-template-columns: minmax(300px, 0.78fr) minmax(330px, 1fr);
  align-items: stretch;
  gap: 24px;
  height: 100%;
  min-height: 0;
  padding-top: 0;
}

html[data-ui-density="scaled"] .module-rail,
html[data-ui-density="scaled"] .compose-card,
html[data-ui-density="scaled"] .results-panel {
  height: 100%;
  min-height: 0;
  max-height: none;
  overflow-x: hidden;
  overflow-y: auto;
  scrollbar-gutter: stable;
}

html[data-ui-density="scaled"] .compose-card,
html[data-ui-density="scaled"] .results-panel {
  align-self: stretch;
}

/* Image2 local API controls */
.image2-controls {
  display: grid;
  gap: 10px;
  padding: 13px 14px;
  border: 1px solid rgba(79, 140, 255, 0.22);
  border-radius: var(--control-radius);
  background: rgba(79, 140, 255, 0.06);
}

.image2-controls-head,
.image2-api-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.image2-controls-head {
  justify-content: space-between;
}

.image2-controls > summary {
  list-style: none;
  cursor: pointer;
}

.image2-controls > summary::-webkit-details-marker {
  display: none;
}

.image2-controls > summary::after {
  content: "";
  width: 8px;
  height: 8px;
  flex: 0 0 8px;
  border-right: 2px solid var(--muted);
  border-bottom: 2px solid var(--muted);
  transform: rotate(45deg) translateY(-2px);
  transition: transform 0.16s ease;
}

.image2-controls[open] > summary::after {
  transform: rotate(225deg) translate(-2px, -1px);
}

.image2-api-body {
  display: grid;
  gap: 10px;
  padding-top: 10px;
}

.image2-controls-head strong,
.image2-controls-head small {
  display: block;
}

.image2-controls-head small,
.image2-control-help,
.image2-balance-text {
  color: var(--muted);
  font-size: 12px;
}

.image2-api-row input {
  flex: 1 1 260px;
  min-width: 180px;
}

.image2-price-hint {
  padding: 10px 12px;
  border-radius: var(--control-radius);
  color: #1f6d3c;
  background: rgba(72, 185, 90, 0.10);
  font-size: 13px;
  font-weight: 700;
}

.image2-control-help {
  margin: 0;
}

.activation-skip-button {
  width: 100%;
}

.activation-note {
  margin: -4px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

html[data-theme="dark"] .image2-price-hint {
  color: #a8e5b2;
  background: rgba(72, 185, 90, 0.14);
}


/* ---- file drop affordance ---- */
.file-box,
.file-drop {
  cursor: pointer;
}

.file-box.is-drag-over .file-drop {
  outline: 2px solid rgba(255, 93, 156, 0.55);
  outline-offset: 3px;
  box-shadow: 0 0 0 4px rgba(255, 93, 156, 0.12), var(--inner-shadow);
}

/* refreshed toolbar icon overrides */
.icon-publish::before,
.icon-publish::after,
.icon-download::before,
.icon-download::after,
.icon-refresh::before,
.icon-refresh::after {
  content: "";
  position: absolute;
  display: block;
  box-sizing: border-box;
}

.icon-publish::before {
  left: 10px;
  top: 5px;
  width: 3px;
  height: 15px;
  border-radius: 999px;
  background: currentColor;
  -webkit-mask: none;
  mask: none;
}

.icon-publish::after {
  left: 5px;
  top: 4px;
  width: 13px;
  height: 13px;
  border-left: 3px solid currentColor;
  border-top: 3px solid currentColor;
  border-radius: 2px;
  transform: rotate(45deg);
}

.icon-download::before {
  left: 10px;
  top: 3px;
  width: 3px;
  height: 13px;
  border-radius: 999px;
  background: currentColor;
}

.icon-download::after {
  left: 5px;
  top: 10px;
  width: 13px;
  height: 13px;
  border-right: 3px solid currentColor;
  border-bottom: 3px solid currentColor;
  border-radius: 2px;
  transform: rotate(45deg);
}

.icon-refresh::before {
  inset: 3px;
  border: 3px solid currentColor;
  border-left-color: transparent;
  border-radius: 50%;
  transform: rotate(-28deg);
}

.icon-refresh::after {
  right: 1px;
  top: 2px;
  width: 0;
  height: 0;
  border-left: 7px solid currentColor;
  border-top: 5px solid transparent;
  border-bottom: 5px solid transparent;
  transform: rotate(18deg);
}
/* plain module titles */
.studio-head h2,
.task-title-module {
  color: var(--ink);
  display: inline;
  background: none;
  background-clip: border-box;
  -webkit-background-clip: border-box;
  -webkit-text-fill-color: currentColor;
  animation: none;
}
/* dark theme contrast and calmer action colors */
html[data-theme="dark"] .primary-button {
  background: linear-gradient(135deg, #ff5d9c, #e84f91);
  color: #fff;
  box-shadow: 5px 6px 14px rgba(0, 0, 0, 0.68), -3px -3px 8px rgba(255, 255, 255, 0.018);
}

html[data-theme="dark"] .primary-button:hover {
  background: linear-gradient(135deg, #f04f90, #d94382);
  color: #fff;
  box-shadow: var(--pressed-shadow);
  transform: translateY(1px);
}

html[data-theme="dark"] .results-panel {
  --pink: #ff5d9c;
  --green: #18aa69;
  --danger: #d94a60;
  --blue: #5f7cff;
  color: var(--ink);
}

html[data-theme="dark"] .results-panel .task-row,
html[data-theme="dark"] .results-panel .task-id-button,
html[data-theme="dark"] .results-panel .task-status-button,
html[data-theme="dark"] .results-panel .task-input-preview-button,
html[data-theme="dark"] .results-panel .media-folder-button {
  background: #151616;
}

html[data-theme="dark"] .results-panel .task-input-preview-button,
html[data-theme="dark"] .results-panel .task-id-button,
html[data-theme="dark"] .results-panel .task-status-button {
  color: #f8fbff;
}

/* toolbar icon redesign */
.icon-publish::before,
.icon-download::before,
.icon-refresh::before {
  content: "";
  position: absolute;
  inset: 0;
  display: block;
  width: 22px;
  height: 22px;
  background: currentColor;
}

.icon-publish::after,
.icon-download::after,
.icon-refresh::after {
  display: none;
}

.icon-publish::before {
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.45' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 16V4'/%3E%3Cpath d='M7 9l5-5 5 5'/%3E%3Cpath d='M5 14v4a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2v-4'/%3E%3C/svg%3E") no-repeat center / contain;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.45' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 16V4'/%3E%3Cpath d='M7 9l5-5 5 5'/%3E%3Cpath d='M5 14v4a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2v-4'/%3E%3C/svg%3E") no-repeat center / contain;
}

.icon-download::before {
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.45' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 4v12'/%3E%3Cpath d='M7 11l5 5 5-5'/%3E%3Cpath d='M5 20h14'/%3E%3C/svg%3E") no-repeat center / contain;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.45' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 4v12'/%3E%3Cpath d='M7 11l5 5 5-5'/%3E%3Cpath d='M5 20h14'/%3E%3C/svg%3E") no-repeat center / contain;
}

.icon-refresh::before {
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.45' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 7v5h-5'/%3E%3Cpath d='M4 17v-5h5'/%3E%3Cpath d='M18.2 9A7 7 0 0 0 6.6 6.4L4 9'/%3E%3Cpath d='M5.8 15A7 7 0 0 0 17.4 17.6L20 15'/%3E%3C/svg%3E") no-repeat center / contain;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.45' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 7v5h-5'/%3E%3Cpath d='M4 17v-5h5'/%3E%3Cpath d='M18.2 9A7 7 0 0 0 6.6 6.4L4 9'/%3E%3Cpath d='M5.8 15A7 7 0 0 0 17.4 17.6L20 15'/%3E%3C/svg%3E") no-repeat center / contain;
}
/* final UI tuning */
.brand img {
  width: 58px;
  height: 58px;
  border-radius: 17px;
}

.brand h1 {
  font-size: 32px;
}

@media (max-width: 720px) {
  .brand img {
    width: 52px;
    height: 52px;
  }

  .brand h1 {
    font-size: 26px;
  }
}

.results-panel {
  --pink: #e84f91;
  --green: #16c866;
  --danger: #e63d58;
}

.task-fields > span {
  padding-left: 8px;
}

.task-input-audio > span,
.task-fields > a,
.task-fields > .task-input-audio,
.task-fields > .task-input-preview-button {
  padding-left: 0;
}

.icon-folder::before,
.icon-folder::after {
  content: "";
  position: absolute;
  display: block;
  box-sizing: border-box;
}

.icon-folder::before {
  left: 2px;
  top: 7px;
  width: 20px;
  height: 13px;
  border: 2.5px solid currentColor;
  border-radius: 3px;
}

.icon-folder::after {
  left: 4px;
  top: 4px;
  width: 9px;
  height: 6px;
  border: 2.5px solid currentColor;
  border-bottom: 0;
  border-radius: 3px 3px 0 0;
}

html[data-theme="dark"] .results-panel {
  --pink: #b64f84;
  --green: #15965d;
  --danger: #c94458;
}
/* final toolbar icon polish */
.top-actions .icon {
  width: 24px;
  height: 24px;
  overflow: visible;
}

.icon-publish::before,
.icon-download::before,
.icon-folder::before,
.icon-theme::before,
.icon-refresh::before,
html[data-theme="dark"] .icon-theme::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  display: block;
  width: 24px;
  height: 24px;
  border: 0;
  border-radius: 0;
  background: currentColor;
  box-shadow: none;
  transform: none;
  box-sizing: border-box;
}

.icon-publish::after,
.icon-download::after,
.icon-folder::after,
.icon-theme::after,
.icon-refresh::after,
html[data-theme="dark"] .icon-theme::after {
  content: "";
  display: none;
  border: 0;
  background: transparent;
  box-shadow: none;
}

.icon-publish::before {
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.95' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 14.8V4.6'/%3E%3Cpath d='M8.3 8.3 12 4.6l3.7 3.7'/%3E%3Cpath d='M5.4 14.6v4.8h13.2v-4.8'/%3E%3C/svg%3E") no-repeat center / contain;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.95' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 14.8V4.6'/%3E%3Cpath d='M8.3 8.3 12 4.6l3.7 3.7'/%3E%3Cpath d='M5.4 14.6v4.8h13.2v-4.8'/%3E%3C/svg%3E") no-repeat center / contain;
}

.icon-download::before {
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.95' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M8.1 16.4H7a4.6 4.6 0 1 1 1.7-8.9A5.8 5.8 0 0 1 20 10.5a3.7 3.7 0 0 1-1.2 5.9h-2.2'/%3E%3Cpath d='M12 12.3v7.1'/%3E%3Cpath d='M8.9 16.4 12 19.5l3.1-3.1'/%3E%3C/svg%3E") no-repeat center / contain;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.95' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M8.1 16.4H7a4.6 4.6 0 1 1 1.7-8.9A5.8 5.8 0 0 1 20 10.5a3.7 3.7 0 0 1-1.2 5.9h-2.2'/%3E%3Cpath d='M12 12.3v7.1'/%3E%3Cpath d='M8.9 16.4 12 19.5l3.1-3.1'/%3E%3C/svg%3E") no-repeat center / contain;
}

.icon-folder::before {
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.95' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M3.8 7.7h5.6l2 2H20.8l-1.9 8.4H3.8z'/%3E%3Cpath d='M3.8 7.7V5.8h5.5l2 1.9h6.5v2'/%3E%3C/svg%3E") no-repeat center / contain;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.95' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M3.8 7.7h5.6l2 2H20.8l-1.9 8.4H3.8z'/%3E%3Cpath d='M3.8 7.7V5.8h5.5l2 1.9h6.5v2'/%3E%3C/svg%3E") no-repeat center / contain;
}

.icon-refresh::before {
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.95' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M19.3 7.5v4.3h-4.3'/%3E%3Cpath d='M4.7 16.5v-4.3H9'/%3E%3Cpath d='M17.8 9.1A6.6 6.6 0 0 0 6.8 6.8L4.7 9'/%3E%3Cpath d='M6.2 14.9a6.6 6.6 0 0 0 11 2.3l2.1-2.2'/%3E%3C/svg%3E") no-repeat center / contain;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.95' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M19.3 7.5v4.3h-4.3'/%3E%3Cpath d='M4.7 16.5v-4.3H9'/%3E%3Cpath d='M17.8 9.1A6.6 6.6 0 0 0 6.8 6.8L4.7 9'/%3E%3Cpath d='M6.2 14.9a6.6 6.6 0 0 0 11 2.3l2.1-2.2'/%3E%3C/svg%3E") no-repeat center / contain;
}

.icon-theme::before {
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.05' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20.9 13.5A8.5 8.5 0 1 1 10.5 3.1 6.6 6.6 0 0 0 20.9 13.5Z'/%3E%3C/svg%3E") no-repeat center / contain;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.05' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20.9 13.5A8.5 8.5 0 1 1 10.5 3.1 6.6 6.6 0 0 0 20.9 13.5Z'/%3E%3C/svg%3E") no-repeat center / contain;
}

html[data-theme="dark"] .icon-theme::before {
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.85' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='3.9'/%3E%3Cpath d='M12 3.2v2.1M12 18.7v2.1M5.6 5.6l1.5 1.5M16.9 16.9l1.5 1.5M3.2 12h2.1M18.7 12h2.1M5.6 18.4l1.5-1.5M16.9 7.1l1.5-1.5'/%3E%3C/svg%3E") no-repeat center / contain;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.85' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='3.9'/%3E%3Cpath d='M12 3.2v2.1M12 18.7v2.1M5.6 5.6l1.5 1.5M16.9 16.9l1.5 1.5M3.2 12h2.1M18.7 12h2.1M5.6 18.4l1.5-1.5M16.9 7.1l1.5-1.5'/%3E%3C/svg%3E") no-repeat center / contain;
}
/* ChatGPT-provided toolbar icon set */
.top-actions .icon {
  width: 30px;
  height: 30px;
}

.icon-publish::before,
.icon-download::before,
.icon-folder::before,
.icon-refresh::before {
  content: "";
  position: absolute;
  inset: 0;
  display: block;
  width: 30px;
  height: 30px;
  border: 0;
  border-radius: 0;
  background-color: transparent;
  background-repeat: no-repeat;
  background-position: center;
  background-size: contain;
  box-shadow: none;
  transform: none;
  -webkit-mask: none;
  mask: none;
}

.icon-publish::after,
.icon-download::after,
.icon-folder::after,
.icon-refresh::after {
  display: none;
}

.icon-publish::before {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 32 32' fill='none'%3E%3Cpath d='M5.2 14.2 25.5 5.5c1.1-.5 2.2.6 1.8 1.8l-7.9 21c-.5 1.3-2.3 1.4-2.9.1l-4.1-8.2-7.4-3.4c-1.2-.5-1.1-2.1.2-2.6Z' stroke='%23515b66' stroke-width='2.8' stroke-linejoin='round'/%3E%3Cpath d='M15.8 20.1v-8.2' stroke='%235a95ff' stroke-width='2.9' stroke-linecap='round'/%3E%3Cpath d='m11.9 15.6 3.9-3.9 3.9 3.9' stroke='%235a95ff' stroke-width='2.9' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
}

.icon-download::before {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 32 32' fill='none'%3E%3Cpath d='M7.6 14.8a10.2 10.2 0 0 0 13.5 9.6' stroke='%23515b66' stroke-width='2.6' stroke-linecap='round'/%3E%3Cpath d='M23.5 12.8h.1M24.5 18.1h.1M21.5 22.5h.1' stroke='%23515b66' stroke-width='3.4' stroke-linecap='round'/%3E%3Cpath d='M16 19.4V7.5' stroke='%235a95ff' stroke-width='3' stroke-linecap='round'/%3E%3Cpath d='m11.5 12.2 4.5-4.5 4.5 4.5' stroke='%235a95ff' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
}

.icon-folder::before {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 32 32' fill='none'%3E%3Cpath d='M5.2 12.2h9.1l2.4 2.7h10.1v9.7c0 1.2-1 2.2-2.2 2.2H7.4c-1.2 0-2.2-1-2.2-2.2V12.2Z' stroke='%23515b66' stroke-width='2.6' stroke-linejoin='round'/%3E%3Cpath d='M5.2 12.2V8.6h8.2l2.6 3.2h10.8v3.1' stroke='%23515b66' stroke-width='2.6' stroke-linejoin='round'/%3E%3C/svg%3E");
}

.icon-refresh::before {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 32 32' fill='none'%3E%3Cpath d='M7.1 15a9.5 9.5 0 0 1 16.1-5.6l2.2 2.2' stroke='%23515b66' stroke-width='2.8' stroke-linecap='round'/%3E%3Cpath d='M25.4 6.9v4.7h-4.7' stroke='%23515b66' stroke-width='2.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3Cpath d='M24.9 17a9.5 9.5 0 0 1-16.1 5.6l-2.2-2.2' stroke='%23515b66' stroke-width='2.8' stroke-linecap='round'/%3E%3Cpath d='M6.6 25.1v-4.7h4.7' stroke='%23515b66' stroke-width='2.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
}

html[data-theme="dark"] .icon-publish::before {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 32 32' fill='none'%3E%3Cpath d='M5.2 14.2 25.5 5.5c1.1-.5 2.2.6 1.8 1.8l-7.9 21c-.5 1.3-2.3 1.4-2.9.1l-4.1-8.2-7.4-3.4c-1.2-.5-1.1-2.1.2-2.6Z' stroke='%23eef3fa' stroke-width='2.8' stroke-linejoin='round'/%3E%3Cpath d='M15.8 20.1v-8.2' stroke='%237fb0ff' stroke-width='2.9' stroke-linecap='round'/%3E%3Cpath d='m11.9 15.6 3.9-3.9 3.9 3.9' stroke='%237fb0ff' stroke-width='2.9' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
}

html[data-theme="dark"] .icon-download::before {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 32 32' fill='none'%3E%3Cpath d='M7.6 14.8a10.2 10.2 0 0 0 13.5 9.6' stroke='%23eef3fa' stroke-width='2.6' stroke-linecap='round'/%3E%3Cpath d='M23.5 12.8h.1M24.5 18.1h.1M21.5 22.5h.1' stroke='%23eef3fa' stroke-width='3.4' stroke-linecap='round'/%3E%3Cpath d='M16 19.4V7.5' stroke='%237fb0ff' stroke-width='3' stroke-linecap='round'/%3E%3Cpath d='m11.5 12.2 4.5-4.5 4.5 4.5' stroke='%237fb0ff' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
}

html[data-theme="dark"] .icon-folder::before {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 32 32' fill='none'%3E%3Cpath d='M5.2 12.2h9.1l2.4 2.7h10.1v9.7c0 1.2-1 2.2-2.2 2.2H7.4c-1.2 0-2.2-1-2.2-2.2V12.2Z' stroke='%23eef3fa' stroke-width='2.6' stroke-linejoin='round'/%3E%3Cpath d='M5.2 12.2V8.6h8.2l2.6 3.2h10.8v3.1' stroke='%23eef3fa' stroke-width='2.6' stroke-linejoin='round'/%3E%3C/svg%3E");
}

html[data-theme="dark"] .icon-refresh::before {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 32 32' fill='none'%3E%3Cpath d='M7.1 15a9.5 9.5 0 0 1 16.1-5.6l2.2 2.2' stroke='%23eef3fa' stroke-width='2.8' stroke-linecap='round'/%3E%3Cpath d='M25.4 6.9v4.7h-4.7' stroke='%23eef3fa' stroke-width='2.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3Cpath d='M24.9 17a9.5 9.5 0 0 1-16.1 5.6l-2.2-2.2' stroke='%23eef3fa' stroke-width='2.8' stroke-linecap='round'/%3E%3Cpath d='M6.6 25.1v-4.7h4.7' stroke='%23eef3fa' stroke-width='2.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
}
/* User-supplied complete SVG toolbar buttons */
#releasePanelButton,
#downloadUpdateButton,
#openResultsButton,
#themeToggleButton,
#refreshButton {
  width: 52px;
  min-width: 52px;
  height: 52px;
  min-height: 52px;
  border-radius: 18px;
  background-color: transparent;
  background-repeat: no-repeat;
  background-position: center;
  background-size: 52px 52px;
  box-shadow: none;
  color: transparent;
  overflow: visible;
}

#releasePanelButton:hover,
#downloadUpdateButton:hover,
#openResultsButton:hover,
#themeToggleButton:hover,
#refreshButton:hover {
  box-shadow: none;
  transform: translateY(1px);
  filter: brightness(0.985) saturate(1.02);
}

#releasePanelButton .icon,
#downloadUpdateButton .icon,
#openResultsButton .icon,
#themeToggleButton .icon,
#refreshButton .icon {
  display: none;
}

#releasePanelButton {
  background-image: url("/assets/toolbar-icons/publish.svg");
  background-size: 28px 28px;
}

#downloadUpdateButton {
  background-image: url("/assets/toolbar-icons/update.svg");
}

#openResultsButton {
  background-image: url("/assets/toolbar-icons/folder.svg");
}

#themeToggleButton {
  background-image: url("/assets/toolbar-icons/moon.svg");
}

html[data-theme="dark"] #themeToggleButton {
  background-image: url("/assets/toolbar-icons/sun.svg");
}

#refreshButton {
  background-image: url("/assets/toolbar-icons/refresh.svg");
}
/* Direct user SVG toolbar icons */
#releasePanelButton,
#downloadUpdateButton,
#openResultsButton,
#themeToggleButton,
#refreshButton {
  width: 44px;
  min-width: 44px;
  height: 44px;
  min-height: 44px;
  border-radius: var(--small-radius);
  background-color: var(--surface);
  background-repeat: no-repeat;
  background-position: center;
  background-size: 25px 25px;
  box-shadow: 6px 6px 12px rgba(163, 177, 198, 0.54), -6px -6px 12px rgba(255, 255, 255, 0.78);
  color: var(--muted);
  filter: none;
  overflow: visible;
}

html[data-theme="dark"] #releasePanelButton,
html[data-theme="dark"] #downloadUpdateButton,
html[data-theme="dark"] #openResultsButton,
html[data-theme="dark"] #themeToggleButton,
html[data-theme="dark"] #refreshButton {
  background-color: var(--surface);
  box-shadow: 6px 6px 14px rgba(6, 8, 12, 0.62), -6px -6px 14px rgba(72, 80, 94, 0.16);
}

#releasePanelButton:hover,
#downloadUpdateButton:hover,
#openResultsButton:hover,
#themeToggleButton:hover,
#refreshButton:hover {
  box-shadow: var(--pressed-shadow);
  transform: translateY(1px);
  filter: none;
}

#downloadUpdateButton:disabled {
  opacity: 1;
  cursor: default;
}

#releasePanelButton .icon,
#downloadUpdateButton .icon,
#openResultsButton .icon,
#themeToggleButton .icon,
#refreshButton .icon {
  display: none;
}

#releasePanelButton {
  background-image: url("/assets/toolbar-icons/publish.svg");
}

#downloadUpdateButton {
  background-image: url("/assets/toolbar-icons/update.svg");
}

#downloadUpdateButton.is-update-available {
  background-image: url("/assets/toolbar-icons/update-active.svg");
}

#openResultsButton {
  background-image: url("/assets/toolbar-icons/folder.svg");
}

#themeToggleButton {
  background-image: url("/assets/toolbar-icons/moon.svg");
}

html[data-theme="dark"] #themeToggleButton {
  background-image: url("/assets/toolbar-icons/sun.svg");
}

#refreshButton {
  background-image: url("/assets/toolbar-icons/refresh.svg");
}
/* Dark theme solid toolbar icons except update state */
html[data-theme="dark"] #releasePanelButton {
  background-image: url("/assets/toolbar-icons/publish-dark.svg");
}

html[data-theme="dark"] #openResultsButton {
  background-image: url("/assets/toolbar-icons/folder-dark.svg");
}

html[data-theme="dark"] #themeToggleButton {
  background-image: url("/assets/toolbar-icons/sun-dark.svg");
}

html[data-theme="dark"] #refreshButton {
  background-image: url("/assets/toolbar-icons/refresh-dark.svg");
}
/* Keep update button muted in dark theme unless an update is available */
html[data-theme="dark"] #downloadUpdateButton {
  background-image: url("/assets/toolbar-icons/update-dark-muted.svg");
}

html[data-theme="dark"] #downloadUpdateButton.is-update-available {
  background-image: url("/assets/toolbar-icons/update-active.svg");
}

/* Task image filename pill alignment */
.task-fields > .task-input-preview-button {
  justify-self: start;
  min-width: min(420px, 100%);
}

.task-input-preview-button {
  justify-content: center;
  min-width: 0;
  max-width: 100%;
  min-height: 30px;
  padding: 5px 24px;
  line-height: 1.15;
  text-align: center;
}

.media-output-preview-button {
  min-width: 96px;
  max-width: 160px;
  padding-left: 18px;
  padding-right: 18px;
}

@media (max-width: 720px) {
  .task-input-preview-button {
    min-width: min(100%, 300px);
  }
}

/* Keep multiple result previews on the same row when space allows. */
.media-stack {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 16px;
}

.media-stack .media-result-row {
  display: inline-grid;
  grid-template-columns: auto auto;
  align-items: center;
  width: auto;
  max-width: none;
  gap: 10px;
}

.media-stack .media-preview-wrap {
  width: auto;
}


.task-text-preview {
  max-height: calc(100vh - 170px);
  min-height: 180px;
  margin: 0;
  padding: 14px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: var(--small-radius);
  background: var(--surface-soft);
  color: var(--ink);
  font: 13px/1.7 ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.task-text-preview.is-loading {
  color: var(--muted);
}

.task-load-more {
  display: grid;
  place-items: center;
  gap: 8px;
  padding: 16px;
  text-align: center;
}

.task-load-more-button {
  min-height: 34px;
  padding: 7px 16px;
  border: 1px solid var(--line);
  border-radius: var(--control-radius);
  background: var(--surface);
  color: var(--ink);
  font-weight: 700;
  cursor: pointer;
}

.task-load-more-button:hover {
  border-color: var(--accent);
  color: var(--accent);
}
/* ---- grouped module rail ---- */
.module-group {
  display: grid;
  gap: 8px;
}

.module-group-toggle {
  width: 100%;
  min-height: 42px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  border: 0;
  border-radius: var(--control-radius, 8px);
  background: var(--surface-2, rgba(245, 248, 252, 0.9));
  padding: 0 12px;
  color: var(--ink);
  text-align: left;
  box-shadow: var(--shadow-soft, 0 8px 20px rgba(94, 112, 135, 0.12));
}

.module-group-toggle::after {
  content: "";
  width: 8px;
  height: 8px;
  border-right: 2px solid var(--muted);
  border-bottom: 2px solid var(--muted);
  transform: rotate(-45deg);
  transition: transform 0.16s ease;
}

.module-group-toggle[aria-expanded="true"]::after {
  transform: rotate(45deg);
}

.module-group-toggle span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 800;
}

.module-group-toggle small {
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.module-group-modules {
  display: grid;
  gap: 10px;
}

.module-card {
  width: 100%;
}

.module-card strong {
  white-space: normal;
  overflow-wrap: anywhere;
}

.module-card .module-card-tag,
.module-card .module-card-desc {
  display: block;
  margin-top: 6px;
  font-size: 11px;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.module-card .module-card-tag {
  color: var(--blue);
  font-weight: 800;
}

.module-card .module-card-desc {
  color: var(--muted);
  font-weight: 500;
}

@media (max-width: 680px) {
  .file-choose-button,
  .reference-add-button {
    min-height: 46px;
    width: 100%;
    margin: 0;
  }

  .file-drop {
    min-height: 66px;
    padding: 14px;
  }

  .file-drop strong {
    white-space: normal;
    line-height: 1.35;
  }

  .file-local-preview-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    padding: 8px 0 0;
  }

  .file-local-preview-thumb {
    grid-template-rows: minmax(104px, 34vw) auto;
  }

  .file-local-preview-thumb img,
  .file-local-preview-thumb-empty > div {
    height: min(34vw, 160px);
  }
}

/* 页面不展示内部激活、API 检查和更新检查状态。 */
#apiStatus,
#licenseStatus,
#updateBadge,
#updateText {
  display: none !important;
}

/* ---- mobile single-column workspace ---- */
@media (max-width: 680px) {
  html[data-ui-density="mobile"],
  html[data-ui-density="mobile"] body {
    width: 100%;
    min-width: 0;
    min-height: 100%;
    overflow-x: hidden;
    overflow-y: auto;
  }

  html[data-ui-density="mobile"] .app-shell {
    width: 100%;
    min-height: 100svh;
    height: auto;
    margin: 0;
    padding: max(10px, env(safe-area-inset-top)) max(10px, env(safe-area-inset-right)) max(16px, env(safe-area-inset-bottom)) max(10px, env(safe-area-inset-left));
    transform: none;
    overflow: visible;
  }

  html[data-ui-density="mobile"] .topbar {
    min-width: 0;
    min-height: 64px;
    padding: 10px 12px;
    gap: 10px;
    align-items: center;
    flex-direction: row;
    justify-content: space-between;
  }

  html[data-ui-density="mobile"] .brand {
    min-width: 0;
    flex: 1 1 auto;
    gap: 10px;
  }

  html[data-ui-density="mobile"] .brand img {
    width: 42px;
    height: 42px;
    flex: 0 0 42px;
    border-radius: 12px;
  }

  html[data-ui-density="mobile"] .brand h1 {
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 19px;
  }

  html[data-ui-density="mobile"] .brand p {
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 10px;
  }

  html[data-ui-density="mobile"] .top-actions {
    flex: 0 0 auto;
    gap: 7px;
  }

  html[data-ui-density="mobile"] .top-actions .tool-button {
    width: 38px;
    min-width: 38px;
    height: 38px;
    min-height: 38px;
  }

  html[data-ui-density="mobile"] #releasePanelButton,
  html[data-ui-density="mobile"] #downloadUpdateButton,
  html[data-ui-density="mobile"] #openResultsButton,
  html[data-ui-density="mobile"] .window-divider,
  html[data-ui-density="mobile"] .window-control-button {
    display: none !important;
  }

  html[data-ui-density="mobile"] .status-strip {
    display: block;
    width: 100%;
    margin-top: 10px;
    padding: 0;
  }

  html[data-ui-density="mobile"] #apiStatus,
  html[data-ui-density="mobile"] #licenseStatus,
  html[data-ui-density="mobile"] #updateBadge,
  html[data-ui-density="mobile"] #updateText {
    display: none !important;
  }

  html[data-ui-density="mobile"] .account-status-button {
    min-width: 0;
    width: 100%;
    min-height: 42px;
    justify-content: center;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  html[data-ui-density="mobile"] .studio-layout {
    display: block;
    width: 100%;
    height: auto;
    min-height: 0;
    margin-top: 10px;
    overflow: visible;
  }

  html[data-ui-density="mobile"] .module-rail {
    display: none !important;
  }

  html[data-ui-density="mobile"] .studio-main {
    width: 100%;
    height: auto;
    min-height: 0;
    overflow: visible;
  }

  html[data-ui-density="mobile"] .studio-head {
    position: static;
    min-height: 0;
    margin: 0 0 10px;
    padding: 0 4px;
    pointer-events: auto;
  }

  html[data-ui-density="mobile"] .studio-head h2 {
    font-size: 20px;
  }

  html[data-ui-density="mobile"] .image2-controls {
    width: 100%;
    margin-bottom: 10px;
  }

  html[data-ui-density="mobile"] .image2-controls > summary {
    min-height: 48px;
    align-items: center;
  }

  html[data-ui-density="mobile"] .image2-controls > summary > span:first-child {
    min-width: 0;
    display: grid;
    gap: 3px;
  }

  html[data-ui-density="mobile"] .image2-controls > summary small,
  html[data-ui-density="mobile"] .image2-balance-text {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  html[data-ui-density="mobile"] .work-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto auto;
    width: 100%;
    height: auto;
    min-height: 0;
    gap: 14px;
    padding: 0;
  }

  html[data-ui-density="mobile"] .compose-card,
  html[data-ui-density="mobile"] .results-panel {
    width: 100%;
    height: auto;
    min-width: 0;
    min-height: 0;
    max-height: none;
    overflow: visible;
    padding: 14px;
    scrollbar-gutter: auto;
  }

  html[data-ui-density="mobile"] .compose-card {
    grid-row: 1;
  }

  html[data-ui-density="mobile"] .results-panel {
    grid-row: 2;
  }

  html[data-ui-density="mobile"] .form-head {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 10px;
  }

  html[data-ui-density="mobile"] .form-actions {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    width: 100%;
    margin: 0;
    gap: 8px;
  }

  html[data-ui-density="mobile"] .form-actions button {
    width: 100%;
    min-height: 46px;
  }

  html[data-ui-density="mobile"] .segmented,
  html[data-ui-density="mobile"] .image2-api-row,
  html[data-ui-density="mobile"] .button-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    width: 100%;
    gap: 8px;
  }

  html[data-ui-density="mobile"] .segmented > *,
  html[data-ui-density="mobile"] .image2-api-row > *,
  html[data-ui-density="mobile"] .button-row > * {
    width: 100%;
    min-width: 0;
  }

  html[data-ui-density="mobile"] .results-head {
    align-items: stretch;
    gap: 10px;
  }

  html[data-ui-density="mobile"] .results-head button {
    width: 100%;
    min-height: 44px;
  }

  html[data-ui-density="mobile"] .task-list {
    max-height: none;
    overflow: visible;
  }

  html[data-ui-density="mobile"] .input-stack {
    overflow: visible;
  }

  html[data-ui-density="mobile"] input,
  html[data-ui-density="mobile"] textarea,
  html[data-ui-density="mobile"] select {
    min-height: 46px;
    font-size: 16px;
  }

  html[data-ui-density="mobile"] textarea {
    min-height: 140px;
  }
}
