@font-face {
  font-family: "Geist";
  src: url("./assets/fonts/797e433ab948586e-s.p.479bea2b.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Geist Mono";
  src: url("./assets/fonts/caa3a2e1cccd8315-s.p.3b6cae6d.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

:root {
  --bg: #f2fbf8;
  --panel: rgba(255, 255, 255, 0.78);
  --panel-strong: rgba(255, 255, 255, 0.94);
  --text: #173a3d;
  --muted: #6b7e82;
  --line: rgba(15, 143, 138, 0.24);
  --line-strong: rgba(15, 143, 138, 0.56);
  --primary: #0f8f8a;
  --primary-dark: #0a6f6a;
  --accent: #f0b23e;
  --success-bg: #eefcf4;
  --success: #08724f;
  --danger: #d64a4a;
  --shadow: 0 4px 16px rgba(15, 73, 76, 0.11);
  --radius: 9px;
  font-family: "Geist", "Inter", ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  min-width: 320px;
  margin: 0;
  color: var(--text);
  background:
    linear-gradient(135deg, rgba(241, 251, 248, 0.96), rgba(232, 248, 246, 0.92)),
    var(--bg);
  font-size: 16px;
  font-weight: 500;
  letter-spacing: 0;
}

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

button,
select {
  cursor: pointer;
}

.page-shell {
  position: relative;
  min-height: 100vh;
  overflow-x: hidden;
  padding: 18px 18px 44px;
}

.page-bg {
  position: absolute;
  inset: 0 0 auto;
  height: 620px;
  background:
    linear-gradient(135deg, rgba(229, 249, 245, 0.96), rgba(255, 249, 229, 0.76)),
    radial-gradient(circle at 14% 9%, rgba(255, 244, 196, 0.82), transparent 28%),
    radial-gradient(circle at 88% 8%, rgba(117, 201, 189, 0.28), transparent 30%),
    linear-gradient(90deg, rgba(15, 143, 138, 0.07) 1px, transparent 1px),
    linear-gradient(0deg, rgba(15, 143, 138, 0.055) 1px, transparent 1px);
  background-size: auto, auto, auto, 56px 56px, 56px 56px;
  pointer-events: none;
}

.topbar {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}

.brand {
  color: var(--primary-dark);
  font-size: clamp(30px, 2.25vw, 42px);
  font-weight: 560;
  line-height: 1;
  text-decoration: none;
  white-space: nowrap;
}

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

.mode-tabs {
  display: grid;
  flex: 0 1 680px;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  width: min(680px, 58vw);
  min-width: 520px;
  height: 54px;
  border: 1px solid rgba(15, 143, 138, 0.18);
  border-radius: 12px;
  padding: 6px;
  background: rgba(255, 255, 255, 0.74);
  box-shadow: var(--shadow);
  backdrop-filter: blur(6px);
}

.mode-tab {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 0;
  border: 0;
  border-radius: 8px;
  color: #4c686c;
  background: transparent;
  font-size: 17px;
  font-weight: 780;
  transition: background-color 160ms ease, color 160ms ease, box-shadow 160ms ease;
}

.mode-tab.active {
  color: #fff;
  background: linear-gradient(135deg, var(--primary), #157c73);
  box-shadow: 0 6px 14px rgba(15, 73, 76, 0.16);
}


.mode-tab-link {
  text-decoration: none;
  color: #0f8f8a;
  background: rgba(15, 143, 138, 0.08);
}

.mode-tab-link:hover {
  color: #fff;
  background: linear-gradient(135deg, var(--primary), #157c73);
  box-shadow: 0 6px 14px rgba(15, 73, 76, 0.16);
}

.detail-gallery[hidden],
.detail-mode-panel[hidden],
.gallery[hidden],
.history-actions[hidden],
.notice[hidden] {
  display: none;
}

.detail-gallery {
  display: flex;
  min-height: 620px;
  flex-direction: column;
  gap: 18px;
}

.detail-gallery-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
}

.detail-gallery-head h2,
.detail-panel-intro h2 {
  margin: 4px 0 6px;
  color: var(--ink, #183c3e);
  font-size: 20px;
  letter-spacing: 0;
}

.detail-gallery-head p,
.detail-panel-intro p {
  margin: 0;
  color: var(--muted, #6a7e7d);
  font-size: 13px;
  line-height: 1.6;
}

.eyebrow {
  color: #0f8f8a;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.detail-plan-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.detail-plan-list li {
  display: flex;
  min-width: 0;
  gap: 8px;
  padding: 9px 10px;
  border: 1px solid rgba(24, 60, 62, 0.1);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.64);
  color: var(--muted, #6a7e7d);
  font-size: 11px;
  line-height: 1.45;
}

.detail-plan-list strong {
  flex: 0 0 auto;
  color: #0f8f8a;
}

.detail-plan-list span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.detail-result-grid {
  display: grid;
  min-height: 0;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.detail-result-card,
.detail-empty {
  display: flex;
  min-width: 0;
  min-height: 150px;
  flex-direction: column;
  justify-content: space-between;
  overflow: hidden;
  border: 1px solid rgba(24, 60, 62, 0.11);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.72);
}

.detail-result-card img {
  display: block;
  width: 100%;
  min-height: 0;
  aspect-ratio: 3 / 4;
  cursor: zoom-in;
  object-fit: cover;
}

.detail-result-card footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 10px;
  color: var(--muted, #6a7e7d);
  font-size: 12px;
}

.detail-result-card footer .icon-button {
  width: 28px;
  height: 28px;
  color: #0f8f8a;
}

.detail-result-actions {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.detail-result-actions svg {
  width: 15px;
  height: 15px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

.detail-pending,
.detail-failed,
.detail-empty {
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 18px;
  text-align: center;
}

.detail-pending span:last-child,
.detail-empty span,
.detail-failed span {
  color: var(--muted, #6a7e7d);
  font-size: 12px;
  line-height: 1.5;
}

.detail-failed {
  border-color: rgba(184, 76, 70, 0.28);
  color: #a34e48;
  cursor: pointer;
}

.detail-retry-button {
  min-height: 34px;
  margin-top: 4px;
  padding: 0 13px;
  color: #0f7773;
  border-color: rgba(15, 143, 138, 0.22);
  background: #e8f6f2;
  font-size: 12px;
}

.detail-retry-button:hover {
  color: #fff;
  background: #0f8f8a;
}

.detail-mode-panel {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.detail-panel-intro {
  padding-bottom: 2px;
}

.detail-panel-heading {
  display: flex;
  align-items: flex-start;
  justify-content: flex-start;
  gap: 18px;
}

.detail-planning-tools {
  display: flex;
  flex: 0 0 auto;
  align-items: flex-end;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
  border: 1px solid rgba(15, 143, 138, 0.14);
  border-radius: 8px;
  padding: 7px;
  background: rgba(232, 247, 244, 0.62);
}

.detail-planning-tools .field-group {
  min-width: 128px;
  margin: 0;
}

.detail-planning-tools select {
  width: 100%;
  min-height: 34px;
}

.detail-planning-tools select,
.detail-control-grid select {
  appearance: none;
  border: 1px solid rgba(15, 143, 138, 0.28);
  border-radius: 8px;
  padding: 0 34px 0 11px;
  color: #294f52;
  background-color: #f8fcfb;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%230f8f8a' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-position: right 10px center;
  background-repeat: no-repeat;
  background-size: 15px;
  box-shadow: 0 1px 2px rgba(15, 73, 76, 0.04);
  font-size: 13px;
  font-weight: 650;
}

.detail-planning-tools select:hover,
.detail-control-grid select:hover {
  border-color: rgba(15, 143, 138, 0.58);
  background-color: #ffffff;
}

.detail-planning-tools select:focus-visible,
.detail-control-grid select:focus-visible {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(15, 143, 138, 0.13);
  outline: none;
}

.detail-system-button {
  min-height: 34px;
  padding-inline: 12px;
  white-space: nowrap;
}

.detail-system-dialog .dialog-card {
  width: min(760px, calc(100vw - 32px));
}

.detail-system-dialog textarea {
  width: 100%;
  min-height: 340px;
  resize: vertical;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 13px;
  line-height: 1.55;
}

.detail-mode-panel .detail-upload-zone {
  display: flex;
  min-height: 112px;
  align-items: center;
  gap: 14px;
  border-width: 1px;
  border-radius: 8px;
  padding: 14px 16px;
  background: rgba(248, 253, 250, 0.55);
  text-align: left;
}

.detail-upload-zone .upload-content {
  display: flex;
  min-width: 0;
  flex: 1 1 auto;
  align-items: center;
  gap: 12px;
}

.detail-upload-zone .upload-icon {
  display: block;
  width: 34px;
  height: 34px;
  flex: 0 0 auto;
  padding: 7px;
  border-radius: 8px;
  color: var(--primary);
  background: rgba(15, 143, 138, 0.1);
}

.detail-upload-zone .upload-title {
  font-size: 15px;
  line-height: 1.3;
}

.detail-upload-zone .upload-subtitle {
  margin: 3px 0 0;
  font-size: 12px;
  font-weight: 560;
  line-height: 1.4;
}

.detail-upload-zone .upload-meta {
  margin: 0;
  color: #587477;
  font-size: 11px;
  font-weight: 650;
  white-space: nowrap;
}

.detail-upload-zone .preview-strip {
  display: flex;
  width: auto;
  margin: 0 0 0 auto;
  gap: 6px;
}

.detail-mode-panel .detail-upload-zone.has-files {
  display: flex;
  min-height: 112px;
  flex-direction: row;
  border: 1px dashed rgba(15, 143, 138, 0.42);
  padding: 14px 16px;
  text-align: left;
}

.detail-upload-zone.has-files .preview-strip {
  order: initial;
}

.detail-upload-zone.has-files .upload-content {
  min-height: 0;
  border: 0;
  border-radius: 0;
  padding: 0;
}

.detail-upload-zone.has-files .upload-title {
  font-size: 15px;
}

.detail-upload-zone.has-files .upload-subtitle,
.detail-upload-zone.has-files .upload-meta {
  display: block;
}

.detail-control-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.detail-settings-card {
  border: 1px solid rgba(24, 60, 62, 0.09);
  border-radius: 8px;
  padding: 11px;
  background: rgba(255, 255, 255, 0.58);
}

.detail-settings-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
  color: #31585b;
  font-size: 12px;
  font-weight: 760;
}

.detail-settings-head span:last-child {
  color: var(--muted);
  font-size: 11px;
  font-weight: 560;
}

.detail-control-grid .field-group {
  margin: 0;
}

.detail-control-grid .field-label,
.detail-prompt-field .field-label {
  margin-bottom: 5px;
  color: #49676a;
  font-size: 12px;
  font-weight: 700;
}

.detail-control-grid select {
  min-height: 36px;
  border-radius: 7px;
  font-size: 13px;
}

.detail-control-grid select:disabled {
  cursor: not-allowed;
  color: #617a7d;
  background: #edf3f2;
}

.detail-prompt-field textarea {
  min-height: 104px;
  border-radius: 8px;
  padding: 11px 12px;
  font-size: 14px;
}

.detail-mode-panel .field-hint {
  margin-top: -5px;
  font-size: 11px;
}

.detail-control-grid select {
  width: 100%;
}

.detail-action-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 92px;
  gap: 10px;
}

.detail-action-row .button {
  min-height: 44px;
}

.detail-action-row .generate-button {
  margin-top: 0;
}

.detail-upload-item {
  position: relative;
  width: 58px;
  height: 58px;
  flex: 0 0 auto;
  overflow: hidden;
  border-radius: 7px;
}

.detail-upload-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.detail-upload-item .remove-upload {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 20px;
  height: 20px;
  border: 0;
  border-radius: 50%;
  background: rgba(20, 34, 35, 0.72);
  color: #fff;
  cursor: pointer;
  line-height: 18px;
}

@media (max-width: 900px) {
  .detail-result-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 620px) {
  .detail-gallery-head {
    flex-direction: column;
  }

  .detail-panel-heading,
  .detail-planning-tools {
    align-items: stretch;
    flex-direction: column;
  }

  .detail-planning-tools .field-group {
    min-width: 0;
  }

  .detail-mode-panel .detail-upload-zone,
  .detail-mode-panel .detail-upload-zone.has-files {
    min-height: 0;
    align-items: flex-start;
    flex-direction: column;
  }

  .detail-upload-zone .upload-meta {
    white-space: normal;
  }

  .detail-upload-zone .preview-strip {
    width: 100%;
    margin: 0;
    flex-wrap: wrap;
  }

  .detail-settings-head {
    align-items: flex-start;
    flex-direction: column;
    gap: 3px;
  }

  .detail-plan-list,
  .detail-control-grid,
  .detail-action-row {
    grid-template-columns: 1fr;
  }

  .detail-result-grid {
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }
}
.mode-panel {
  display: none;
  flex-direction: column;
  width: 100%;
}

.mode-panel.active {
  display: flex;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  border: 1px solid transparent;
  border-radius: 10px;
  padding: 0 18px;
  color: var(--text);
  background: #fff;
  font-weight: 720;
  text-decoration: none;
  transition: background-color 160ms ease, border-color 160ms ease, color 160ms ease, box-shadow 160ms ease, transform 120ms ease;
}

.button:hover {
  transform: translateY(-1px);
}

.button:focus-visible,
select:focus-visible,
textarea:focus-visible,
input:focus-visible,
.upload-zone:focus-within {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(15, 143, 138, 0.2);
}

.button-primary,
.generate-button {
  color: #fff;
  background: linear-gradient(135deg, var(--primary), #157c73);
  border-color: var(--primary);
}

.button-primary:hover,
.generate-button:hover {
  background: linear-gradient(135deg, var(--primary-dark), #10645e);
}

.button-ghost {
  background: var(--panel-strong);
  border-color: rgba(15, 143, 138, 0.16);
  box-shadow: var(--shadow);
}

.button-muted {
  color: #36575a;
  background: #e8efee;
}

.button[disabled] {
  cursor: not-allowed;
  opacity: 0.55;
  transform: none;
}

.workspace {
  position: relative;
  z-index: 1;
  display: flex;
  gap: 20px;
  width: 100%;
  min-height: 780px;
}

.panel {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel);
  box-shadow: var(--shadow);
  backdrop-filter: blur(6px);
}

.gallery-panel {
  flex: 5 1 0;
  min-width: 300px;
  padding: 29px 18px;
}

.form-panel {
  display: flex;
  flex: 4 1 0;
  flex-direction: column;
  min-width: 360px;
  padding: 34px 18px 18px;
}

.notice {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 20px 0 38px;
  border: 1px solid rgba(8, 114, 79, 0.08);
  border-radius: 10px;
  padding: 22px 16px;
  color: var(--success);
  background: var(--success-bg);
  font-size: 16px;
  font-weight: 620;
  line-height: 1.45;
}

.notice svg,
.hint-row svg {
  width: 22px;
  height: 22px;
  display: block;
  flex: 0 0 auto;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2.3;
  vector-effect: non-scaling-stroke;
}

.gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(132px, 1fr));
  gap: 18px;
  align-content: start;
  padding: 0 18px;
}

.empty-card,
.image-card {
  position: relative;
  display: grid;
  place-items: center;
  aspect-ratio: 1;
  overflow: hidden;
  border-radius: 13px;
  background: #f3f6f4;
  box-shadow: var(--shadow);
  transition: border-color 160ms ease, box-shadow 160ms ease, transform 160ms ease, background-color 160ms ease;
}

.image-card {
  content-visibility: auto;
  contain-intrinsic-size: 160px 160px;
}

.empty-card {
  width: min(158px, 100%);
  border: 1px solid rgba(15, 143, 138, 0.08);
  color: #839498;
  cursor: pointer;
}

.empty-card:hover,
.empty-card:focus-visible {
  border-color: rgba(15, 143, 138, 0.42);
  background: #fbfdf9;
  box-shadow: 0 8px 22px rgba(15, 73, 76, 0.17);
  transform: translateY(-2px);
  outline: none;
}

.empty-card:active {
  transform: translateY(0);
}

.empty-content {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  width: 100%;
  height: 100%;
  gap: 12px;
}

.empty-card svg {
  width: 34px;
  height: 34px;
  display: block;
  flex: 0 0 auto;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2.2;
  vector-effect: non-scaling-stroke;
}

.empty-card span {
  display: block;
  margin: 0;
  font-size: 14px;
  font-weight: 720;
  line-height: 1;
  text-align: center;
}

.image-card {
  border: 1px solid rgba(15, 143, 138, 0.12);
  isolation: isolate;
}

.image-card.loading::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, #ecf4f2, #fffaf0, #ecf4f2);
  animation: shimmer 1.15s infinite linear;
}

.pending-card,
.image-card.loading {
  background: linear-gradient(135deg, rgba(235, 249, 246, 0.92), rgba(255, 251, 241, 0.96));
  border-color: rgba(15, 143, 138, 0.2);
}

.image-card.media-loading::after {
  content: "";
  position: absolute;
  z-index: 1;
  width: 24px;
  height: 24px;
  border: 3px solid rgba(15, 143, 138, 0.18);
  border-top-color: rgba(15, 143, 138, 0.9);
  border-radius: 50%;
  animation: spin 0.9s linear infinite;
  pointer-events: none;
}

.image-card.media-loading img {
  opacity: 0;
}

.image-card.media-error::after {
  content: "加载失败";
  position: absolute;
  z-index: 1;
  border-radius: 999px;
  padding: 6px 10px;
  color: #fff;
  background: rgba(190, 50, 50, 0.86);
  font-size: 12px;
  font-weight: 760;
  pointer-events: none;
}

.history-more-card {
  cursor: pointer;
  background: linear-gradient(135deg, rgba(238, 249, 246, 0.96), rgba(255, 252, 244, 0.96));
  color: #255f62;
}

.history-more-card:hover,
.history-more-card:focus-visible {
  border-color: rgba(15, 143, 138, 0.42);
  box-shadow: 0 8px 22px rgba(15, 73, 76, 0.17);
  transform: translateY(-2px);
  outline: none;
}

.history-more-content {
  display: grid;
  justify-items: center;
  gap: 7px;
  padding: 14px;
  text-align: center;
}

.history-more-content strong {
  color: #154d4f;
  font-size: 14px;
  line-height: 1.2;
}

.history-more-content span,
.history-more-content small {
  color: #60787b;
  font-size: 12px;
  font-weight: 720;
  line-height: 1.3;
}

.pending-content {
  position: relative;
  z-index: 1;
  display: grid;
  justify-items: center;
  gap: 8px;
  padding: 14px;
  color: #154d4f;
  text-align: center;
}

.pending-content strong {
  font-size: 14px;
  line-height: 1.2;
}

.pending-content span,
.pending-content small {
  color: #60787b;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.35;
}

.pending-spinner {
  width: 26px;
  height: 26px;
  border: 3px solid rgba(15, 143, 138, 0.2);
  border-top-color: rgba(15, 143, 138, 0.92);
  border-radius: 50%;
  animation: spin 0.9s linear infinite;
}

.pending-actions {
  position: absolute;
  right: 8px;
  bottom: 8px;
  left: 8px;
  z-index: 2;
  display: flex;
  gap: 6px;
  justify-content: center;
}

.pending-button {
  border: 1px solid rgba(15, 143, 138, 0.22);
  border-radius: 8px;
  padding: 6px 8px;
  color: #fff;
  background: rgba(15, 143, 138, 0.92);
  font-size: 12px;
  font-weight: 780;
}

.pending-button.muted {
  color: #315f62;
  background: rgba(255, 255, 255, 0.88);
}

.pending-button:disabled {
  cursor: not-allowed;
  opacity: 0.62;
}

@keyframes shimmer {
  from {
    transform: translateX(-100%);
  }
  to {
    transform: translateX(100%);
  }
}

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

.image-card img,
.image-card video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: opacity 160ms ease;
}

.video-card {
  aspect-ratio: 16 / 10;
  background: #102729;
}

.video-play-hint {
  position: absolute;
  inset: 0;
  z-index: 1;
  display: grid;
  place-items: center;
  color: rgba(255, 255, 255, 0.92);
  font-size: 28px;
  text-shadow: 0 2px 12px rgba(0, 0, 0, 0.35);
  pointer-events: none;
}

.video-card video[src] + .media-badge + .video-play-hint {
  opacity: 0;
}

.media-badge {
  position: absolute;
  left: 8px;
  bottom: 8px;
  z-index: 2;
  border-radius: 8px;
  padding: 5px 8px;
  color: #fff;
  background: rgba(15, 143, 138, 0.92);
  font-size: 12px;
  font-weight: 760;
  line-height: 1;
}

.card-actions {
  position: absolute;
  right: 8px;
  bottom: 8px;
  left: 8px;
  display: flex;
  justify-content: flex-end;
  gap: 6px;
  opacity: 0;
  transform: translateY(6px);
  transition: opacity 140ms ease, transform 140ms ease;
}

.image-card:hover .card-actions,
.image-card:focus-within .card-actions {
  opacity: 1;
  transform: translateY(0);
}

.remove-result {
  position: absolute;
  top: 7px;
  right: 7px;
  z-index: 2;
  display: inline-grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border: 1px solid rgba(255, 255, 255, 0.62);
  border-radius: 50%;
  color: #fff;
  background: rgba(23, 58, 61, 0.78);
  box-shadow: 0 3px 10px rgba(15, 73, 76, 0.2);
  font-size: 18px;
  font-weight: 720;
  line-height: 1;
  transition: background-color 140ms ease, transform 140ms ease, box-shadow 140ms ease;
}

.remove-result:hover,
.remove-result:focus-visible {
  background: rgba(15, 143, 138, 0.95);
  box-shadow: 0 5px 14px rgba(15, 73, 76, 0.28);
  transform: scale(1.04);
  outline: none;
}

.mini-button {
  display: inline-grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border: 1px solid rgba(255, 255, 255, 0.6);
  border-radius: 8px;
  color: #fff;
  background: rgba(23, 58, 61, 0.76);
}

.mini-button svg {
  width: 17px;
  height: 17px;
  display: block;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
  vector-effect: non-scaling-stroke;
}

.upload-zone {
  display: grid;
  min-height: clamp(220px, 28vh, 280px);
  border: 2px dashed rgba(15, 143, 138, 0.5);
  border-radius: 12px;
  padding: 28px;
  text-align: center;
  transition: border-color 160ms ease, background-color 160ms ease, box-shadow 160ms ease;
}

.upload-zone.dragover {
  border-color: var(--primary);
  background: rgba(15, 143, 138, 0.08);
}

.upload-zone.has-files {
  display: flex;
  flex-direction: column;
  min-height: 0;
  border: 0;
  padding: 0;
  text-align: center;
  gap: 0;
}

.upload-zone.has-files:not(.detail-upload-zone) .preview-strip {
  order: -1;
}

.upload-content {
  align-self: center;
}

.upload-zone.has-files:not(.detail-upload-zone) .upload-content {
  display: grid;
  place-items: center;
  width: 100%;
  min-height: 150px;
  border: 2px dashed rgba(15, 143, 138, 0.34);
  border-radius: 12px;
  padding: 20px;
  transition: border-color 160ms ease, background-color 160ms ease;
}

.upload-zone.has-files:not(.detail-upload-zone) .upload-content:hover {
  border-color: var(--primary);
  background: rgba(15, 143, 138, 0.05);
}

.upload-icon {
  display: none;
}

.upload-zone.has-files:not(.detail-upload-zone) .upload-icon {
  display: none;
}

.upload-title {
  margin: 0;
  color: var(--primary);
  font-size: 22px;
  font-weight: 720;
}

.upload-zone.has-files:not(.detail-upload-zone) .upload-title {
  font-size: 19px;
}

.upload-subtitle {
  margin: 28px 0 0;
  color: var(--muted);
  font-size: 16px;
  font-weight: 620;
}

.upload-meta {
  margin: 28px 0 0;
  color: var(--muted);
  font-size: 14px;
  font-weight: 600;
}

.upload-zone.has-files:not(.detail-upload-zone) .upload-subtitle,
.upload-zone.has-files:not(.detail-upload-zone) .upload-meta {
  display: none;
}

.preview-strip {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 12px;
  width: 100%;
  margin: 0 0 16px;
}

.video-preview-strip {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  justify-content: stretch;
}

.video-reference-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 18px;
  margin-bottom: 0;
}

.video-reference-grid.omni-mode,
.video-reference-grid.omni-capable {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.video-reference-grid .upload-zone {
  min-height: clamp(220px, 28vh, 280px);
}

.media-preview-strip {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.material-token {
  border: 0;
  cursor: pointer;
}

.material-token:hover,
.material-token:focus-visible {
  background: rgba(240, 178, 62, 0.96);
  outline: none;
}

.media-reference-card {
  display: grid;
  place-items: stretch;
}

.media-reference-thumb {
  display: grid;
  place-items: center;
  gap: 8px;
  width: 100%;
  height: 100%;
  padding: 18px 10px 12px;
  color: #245f62;
  background: linear-gradient(135deg, rgba(238, 252, 244, 0.96), rgba(232, 248, 246, 0.92));
  text-align: center;
}

.media-reference-thumb svg {
  width: 34px;
  height: 34px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
  vector-effect: non-scaling-stroke;
}

.media-reference-name {
  display: -webkit-box;
  max-width: 100%;
  overflow: hidden;
  color: #43696c;
  font-size: 12px;
  font-weight: 720;
  line-height: 1.25;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  word-break: break-all;
}

#videoDurationField { order: 1; }
#videoRatioField { order: 2; }
#videoModeField { order: 3; }
#videoResolutionField { order: 4; }

.upload-badge {
  position: absolute;
  left: 6px;
  bottom: 6px;
  z-index: 2;
  border-radius: 7px;
  padding: 4px 7px;
  color: #fff;
  background: rgba(15, 143, 138, 0.92);
  font-size: 12px;
  font-weight: 760;
  line-height: 1;
}

.video-control-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px;
}

.image-model-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 132px;
  gap: 12px;
}

.image-count-field .select-trigger {
  min-height: 42px;
  padding-inline: 13px;
}

.image-control-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(140px, 180px);
  gap: 12px;
}

.ratio-select-compact .select-trigger {
  min-height: 38px;
}

.ratio-select-compact .select-value {
  gap: 7px;
  font-size: 14px;
}


.direct-media-toggle {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin: 10px 0 12px;
  border: 1px solid rgba(15, 143, 138, 0.16);
  border-radius: 10px;
  padding: 10px 12px;
  color: #245f62;
  background: rgba(248, 253, 250, 0.88);
  box-shadow: var(--shadow);
  cursor: pointer;
  user-select: none;
}

.direct-media-toggle input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.direct-media-toggle .toggle-box {
  position: relative;
  flex: 0 0 auto;
  width: 20px;
  height: 20px;
  margin-top: 1px;
  border: 2px solid rgba(15, 143, 138, 0.42);
  border-radius: 6px;
  background: #fff;
  transition: background-color 160ms ease, border-color 160ms ease, box-shadow 160ms ease;
}

.direct-media-toggle .toggle-box::after {
  content: "";
  position: absolute;
  left: 5px;
  top: 1px;
  width: 6px;
  height: 11px;
  border: solid #fff;
  border-width: 0 2px 2px 0;
  opacity: 0;
  transform: rotate(45deg) scale(0.86);
  transition: opacity 140ms ease;
}

.direct-media-toggle input:checked + .toggle-box {
  border-color: rgba(15, 143, 138, 0.95);
  background: rgba(15, 143, 138, 0.95);
  box-shadow: 0 0 0 3px rgba(15, 143, 138, 0.16);
}

.direct-media-toggle input:checked + .toggle-box::after {
  opacity: 1;
}

.direct-media-toggle .toggle-text {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.direct-media-toggle strong {
  color: #154d4f;
  font-size: 14px;
  line-height: 1.15;
}

.direct-media-toggle small {
  color: #60787b;
  font-size: 12px;
  font-weight: 650;
  line-height: 1.35;
}

.upload-preview {
  position: relative;
  aspect-ratio: 1;
  width: 100%;
  min-width: 0;
  overflow: hidden;
  border-radius: 10px;
  background: #eef5f2;
  box-shadow: var(--shadow);
}

.upload-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.remove-upload {
  position: absolute;
  top: 5px;
  right: 5px;
  width: 26px;
  height: 26px;
  border: 0;
  border-radius: 50%;
  color: #fff;
  background: rgba(23, 58, 61, 0.78);
  font-size: 18px;
  line-height: 1;
}

.hint-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin: 34px 0 24px;
  font-size: 16px;
  font-weight: 720;
}

.hint-row svg {
  color: var(--accent);
}

.field-group {
  margin-bottom: 14px;
}

.field-label {
  display: block;
  margin-bottom: 7px;
  font-size: 15px;
  font-weight: 720;
}

.field-hint {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 13px;
  font-weight: 620;
  line-height: 1.45;
}

.video-url-panel {
  margin-top: 2px;
}

.video-file-tools {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 10px;
}

.inline-button {
  min-height: 42px;
  padding: 0 16px;
}

.select-wrap {
  position: relative;
}

.native-select {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
  white-space: nowrap;
}

.select-trigger {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  height: 44px;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  padding: 0 14px;
  color: var(--text);
  background: rgba(248, 253, 250, 0.9);
  box-shadow: var(--shadow);
  font-size: 16px;
  font-weight: 520;
  text-align: left;
  transition: border-color 160ms ease, box-shadow 160ms ease, background-color 160ms ease;
}

.select-trigger:hover,
.custom-select.open .select-trigger {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(15, 143, 138, 0.2);
}
.select-trigger:disabled,
.custom-select.is-disabled .select-trigger {
  cursor: not-allowed;
  opacity: 0.68;
  background: rgba(235, 244, 240, 0.92);
  box-shadow: none;
}

.select-trigger:disabled:hover,
.custom-select.is-disabled.open .select-trigger {
  border-color: var(--line-strong);
  box-shadow: none;
}

.custom-select.is-disabled .chevron {
  opacity: 0.35;
}

.select-value {
  display: inline-flex;
  align-items: center;
  min-width: 0;
  gap: 12px;
}

.select-value svg,
.select-option svg {
  width: 20px;
  height: 20px;
  display: block;
  flex: 0 0 auto;
  fill: none;
  stroke: #3f6669;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
  vector-effect: non-scaling-stroke;
}

.chevron {
  width: 20px;
  height: 20px;
  display: block;
  flex: 0 0 auto;
  fill: none;
  stroke: #71868a;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
  vector-effect: non-scaling-stroke;
  transition: transform 160ms ease;
}

.custom-select.open .chevron {
  transform: rotate(180deg);
}

.select-menu {
  position: absolute;
  z-index: 30;
  top: calc(100% + 6px);
  left: 0;
  display: none;
  width: 100%;
  max-height: min(420px, 52vh);
  overflow-y: auto;
  border: 1px solid rgba(15, 143, 138, 0.24);
  border-radius: 10px;
  padding: 6px;
  background: rgba(255, 255, 255, 0.98);
  box-shadow: 0 12px 32px rgba(15, 73, 76, 0.16);
}

.custom-select.open .select-menu {
  display: grid;
  gap: 2px;
}

.select-option {
  display: flex;
  align-items: center;
  width: 100%;
  min-height: 40px;
  border: 0;
  border-radius: 8px;
  padding: 0 12px;
  gap: 12px;
  color: #265b5f;
  background: transparent;
  font-size: 16px;
  text-align: left;
  white-space: nowrap;
}

.select-option:hover,
.select-option:focus-visible,
.select-option.selected {
  background: #d7f1ea;
}

.select-option.selected {
  color: var(--primary-dark);
}

.select-option[hidden],
.select-menu [hidden] {
  display: none !important;
}

.ratio-icon {
  display: block;
  flex: 0 0 auto;
  border: 2px solid var(--primary);
  background: transparent;
  box-sizing: border-box;
}

.ratio-icon.square { width: 30px; height: 30px; }
.ratio-icon.wide { width: 30px; height: 18px; }
.ratio-icon.tall { width: 18px; height: 30px; }
.ratio-icon.landscape { width: 30px; height: 22px; }
.ratio-icon.portrait { width: 22px; height: 30px; }
.ratio-icon.ultrawide { width: 32px; height: 14px; }
.ratio-icon.ultratall { width: 14px; height: 32px; }

textarea,
input {
  width: 100%;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  color: var(--text);
  background: rgba(248, 253, 250, 0.9);
  box-shadow: var(--shadow);
}

textarea {
  display: block;
  min-height: 116px;
  resize: vertical;
  padding: 14px 12px;
  font-size: 16px;
  font-weight: 500;
  line-height: 1.45;
}

textarea::placeholder,
input::placeholder {
  color: #74878b;
}

input {
  height: 46px;
  padding: 0 12px;
}

.generate-button {
  width: 100%;
  min-height: 52px;
  margin-top: 24px;
  font-size: 16px;
  font-weight: 720;
}

dialog {
  border: 0;
  padding: 0;
  background: transparent;
}

dialog::backdrop {
  background: rgba(17, 45, 48, 0.4);
  backdrop-filter: blur(2px);
}

.dialog-card {
  width: min(520px, calc(100vw - 28px));
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 22px;
  background: #f9fdfb;
  box-shadow: 0 18px 60px rgba(15, 73, 76, 0.24);
}

.dialog-head {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 20px;
}

.dialog-head h2 {
  margin: 0 0 6px;
  font-size: 22px;
}

.dialog-head p {
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
}

.icon-button {
  display: inline-grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border: 1px solid rgba(15, 143, 138, 0.16);
  border-radius: 10px;
  color: var(--text);
  background: rgba(255, 255, 255, 0.9);
}

.icon-button svg {
  width: 19px;
  height: 19px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

.dialog-actions {
  justify-content: flex-end;
  margin-top: 20px;
}

.preview-dialog {
  max-width: min(96vw, 1200px);
  max-height: 92vh;
}

.preview-dialog img,
.preview-dialog video {
  display: block;
  max-width: min(96vw, 1200px);
  max-height: 92vh;
  border-radius: 12px;
  object-fit: contain;
  background: #fff;
}

.preview-dialog video {
  min-width: min(920px, 96vw);
  background: #071b1d;
}

.preview-close {
  position: fixed;
  top: 18px;
  right: 18px;
  z-index: 2;
}

.toast-stack {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 20;
  display: grid;
  gap: 10px;
  width: min(380px, calc(100vw - 36px));
}

.toast {
  border: 1px solid rgba(15, 143, 138, 0.2);
  border-radius: 10px;
  padding: 12px 14px;
  color: var(--text);
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 10px 28px rgba(15, 73, 76, 0.16);
  font-weight: 700;
  transition: opacity 180ms ease, transform 180ms ease;
}

.toast.error {
  border-color: rgba(214, 74, 74, 0.35);
  color: var(--danger);
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

@media (max-width: 980px) {
  .workspace {
    flex-direction: column;
  }

  .form-panel,
  .gallery-panel {
    min-width: 0;
  }
}

@media (max-width: 640px) {
  .page-shell {
    padding: 16px 10px 72px;
  }

  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .mode-tabs {
    width: 100%;
    min-width: 0;
    order: 2;
  }

  .top-actions,
  .history-actions {
    width: 100%;
  }

  .top-actions {
    order: 3;
  }

  .top-actions .button,
  .history-actions .button {
    flex: 1 1 0;
    padding-inline: 10px;
  }

  .notice {
    align-items: flex-start;
    font-size: 14px;
  }

  .gallery {
    grid-template-columns: repeat(auto-fill, minmax(116px, 1fr));
    padding: 0;
  }

  .form-panel {
    padding: 24px 12px 14px;
  }

  .video-control-grid,
  .video-reference-grid.omni-mode,
  .video-reference-grid.omni-capable {
    grid-template-columns: 1fr;
    gap: 0;
  }

  .image-model-grid,
  .image-control-grid {
    grid-template-columns: 1fr;
    gap: 0;
  }

  .upload-zone {
    min-height: 230px;
    padding: 20px 12px;
  }

  .upload-title {
    font-size: 20px;
  }
}

@media (max-height: 780px) and (min-width: 981px) {
  .workspace {
    min-height: calc(100vh - 104px);
  }

  .form-panel {
    padding-top: 24px;
  }

  .upload-zone {
    min-height: 200px;
    padding: 18px;
  }

  .upload-icon {
    display: none;
  }

  .upload-title {
    font-size: 20px;
  }

  .upload-subtitle,
  .upload-meta {
    margin-top: 18px;
  }

  .hint-row {
    margin: 20px 0 14px;
  }

  textarea {
    height: 96px;
    min-height: 96px;
  }

  .generate-button {
    margin-top: 14px;
  }
}
