/* ==========================================================================
   多模型工具套件 — 前端样式（作用域：.apidot-app / .apidot-*）
   ========================================================================== */

.apidot-app {
  --ap-bg: #f7f5f1;
  --ap-surface: #ffffff;
  --ap-surface-2: #faf7f2;
  --ap-border: #e8e2d8;
  --ap-border-strong: #d8d0c2;
  --ap-text: #1f1c19;
  --ap-muted: #7b7267;
  --ap-faint: #a89f92;
  --ap-accent: #b45309;
  --ap-accent-hover: #92400e;
  --ap-accent-soft: #fdf0e2;
  --ap-danger: #b91c1c;
  --ap-danger-soft: #fbecec;
  --ap-info: #1d4ed8;
  --ap-info-soft: #eef3ff;
  --ap-ok: #15803d;
  --ap-radius: 14px;
  --ap-radius-sm: 10px;
  --ap-shadow: 0 1px 2px rgba(31, 28, 25, 0.04), 0 8px 24px rgba(31, 28, 25, 0.05);
  --ap-font: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;

  box-sizing: border-box;
  font-family: var(--ap-font);
  color: var(--ap-text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-align: left;
  margin: 0px 10px 10px 10px;
}

.apidot-app *,
.apidot-app *::before,
.apidot-app *::after {
  box-sizing: border-box;
}

.apidot-app img,
.apidot-app video,
.apidot-app audio {
  max-width: 100%;
  vertical-align: middle;
}

/* 页面模板外层容器：适配主题内容区宽度并留白 */
.apidot-tools-container {
  width: 100%;
  max-width: 1120px;
  margin: 0 auto;
}

.is-hidden {
  display: none !important;
}

/* --------------------------------------------------------------------------
   首页（index）
   -------------------------------------------------------------------------- */

.apidot-index {
  max-width: 1080px;
  margin: 0 auto;
  padding: 0px 20px 20px;
}

.apidot-hero {
  border: 1px solid var(--ap-border);
  background: var(--ap-surface);
  border-radius: var(--ap-radius);
  padding: 32px;
  box-shadow: var(--ap-shadow);
  margin-bottom: 15px;
}

.apidot-hero-badge {
  display: inline-block;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.4px;
  color: var(--ap-accent-hover);
  background: var(--ap-accent-soft);
  border: 1px solid #f3d5b3;
  border-radius: 999px;
  padding: 4px 12px;
  margin-bottom: 14px;
}

.apidot-hero-title {
  font-size: 28px;
  font-weight: 700;
  line-height: 1.25;
  margin: 0 0 10px;
  letter-spacing: -0.3px;
}

.apidot-hero-sub {
  color: var(--ap-muted);
  font-size: 15px;
  margin: 0;
  max-width: 720px;
}

.apidot-alert {
  border: 1px solid var(--ap-border);
  background: var(--ap-surface-2);
  color: var(--ap-text);
  border-radius: var(--ap-radius);
  padding: 12px 16px;
  margin: 0 0 18px;
  font-size: 14px;
}

.apidot-alert-warning {
  background: #fff8ee;
  border-color: #f1d9ae;
  color: #7c4a03;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.apidot-alert-error {
  background: var(--ap-danger-soft);
  border-color: #f1c6c6;
  color: var(--ap-danger);
  position: fixed;
  top: 75px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 10000;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  max-width: 600px;
  min-width: 300px;
  animation: apidot-slide-down 0.3s ease-out;
}

@keyframes apidot-slide-down {
  from {
    opacity: 0;
    transform: translateX(-50%) translateY(-20px);
  }
  to {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
  }
}

.apidot-alert-info {
  background: var(--ap-info-soft);
  border-color: #c7d4f8;
  color: var(--ap-info);
}

.apidot-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px;
}

.apidot-grid-3 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px 20px;
}

.apidot-card {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--ap-border);
  background: var(--ap-surface);
  border-radius: var(--ap-radius);
  padding: 24px;
  text-decoration: none;
  color: inherit;
  box-shadow: var(--ap-shadow);
  transition: transform 0.16s ease, border-color 0.16s ease, box-shadow 0.16s ease;
}

.apidot-card:hover {
  transform: translateY(-2px);
  border-color: var(--ap-border-strong);
  box-shadow: 0 2px 4px rgba(31, 28, 25, 0.05), 0 14px 34px rgba(31, 28, 25, 0.08);
}

.apidot-card-top {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
}

.apidot-card-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: 12px;
  flex: 0 0 auto;
}

.apidot-card-icon svg {
  width: 22px;
  height: 22px;
}

.apidot-icon-image {
  background: #f3ecff;
  color: #7c3aed;
}

.apidot-icon-move {
  background: #ffe9ed;
  color: #e11d48;
}

.apidot-icon-video {
  background: #e9f1ff;
  color: #2563eb;
}

.apidot-icon-music {
  background: #e7f7ef;
  color: #059669;
}

.apidot-card-tag {
  margin-left: auto;
  font-size: 12px;
  font-weight: 600;
  color: var(--ap-muted);
  background: var(--ap-surface-2);
  border: 1px solid var(--ap-border);
  border-radius: 999px;
  padding: 2px 10px;
}

.apidot-card-title {
  font-size: 18px;
  font-weight: 700;
  margin: 0 0 6px;
  letter-spacing: -0.2px;
}

.apidot-card-desc {
  color: var(--ap-muted);
  font-size: 14px;
  margin: 0 0 18px;
  flex: 1;
}

.apidot-card-cta {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 14px;
  font-weight: 600;
  color: var(--ap-accent-hover);
}

.apidot-card-cta svg {
  width: 16px;
  height: 16px;
  transition: transform 0.16s ease;
}

.apidot-card:hover .apidot-card-cta svg {
  transform: translateX(2px);
}

/* --------------------------------------------------------------------------
   功能页头部
   -------------------------------------------------------------------------- */

.apidot-page {
  max-width: 1040px;
  margin: 0 auto;
  padding: 32px 20px 64px;
}

.apidot-page-head {
  margin-bottom: 0px;
}

.apidot-top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
  padding: 12px 16px;
  background: #ffffff;
  border: 1px solid var(--ap-border);
  border-radius: 12px;
}

.apidot-announcement {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  flex: 1;
}

.apidot-announcement-label {
  flex-shrink: 0;
  font-size: 12px;
  font-weight: 600;
  color: #0f172a;
  background: linear-gradient(135deg, #38bdf8, #ffffff);
  padding: 4px 10px;
  border-radius: 999px;
}

.apidot-announcement-content {
  font-size: 14px;
  color: var(--ap-text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.apidot-announcement-content p {
  margin: 0;
}

.apidot-top-bar-actions {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 8px;
}

.apidot-home-link,
.apidot-history-link {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 14px;
  font-weight: 600;
  color: var(--ap-text);
  text-decoration: none;
  padding: 6px 12px;
  border-radius: 8px;
  border: 1px solid var(--ap-border);
  background: rgba(255,255,255,0.04);
  transition: all 0.2s ease;
}

.apidot-home-link:hover,
.apidot-history-link:hover {
  background: rgba(255,255,255,0.08);
  border-color: rgba(148,163,184,0.3);
}

.apidot-home-link svg,
.apidot-history-link svg {
  width: 18px;
  height: 18px;
}

.apidot-page-title {
  font-size: 26px;
  font-weight: 700;
  margin: 0 0 6px;
  letter-spacing: -0.3px;
}

.apidot-page-sub {
  color: var(--ap-muted);
  font-size: 15px;
  margin: 0;
  max-width: 760px;
}

/* --------------------------------------------------------------------------
   表单
   -------------------------------------------------------------------------- */

.apidot-form {
  border: 1px solid var(--ap-border);
  background: var(--ap-surface);
  border-radius: var(--ap-radius);
  padding: 28px;
  box-shadow: var(--ap-shadow);
}

.apidot-field {
  margin-bottom: 20px;
}

.apidot-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px 20px;
}

.apidot-row-3 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.apidot-label {
  display: block;
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 8px;
}

.apidot-required {
  color: var(--ap-danger);
  margin-left: 2px;
}

.apidot-help {
  color: var(--ap-muted);
  font-size: 12.5px;
  margin: 6px 0 0;
}

.apidot-upload-tip {
  color: var(--ap-muted);
  font-size: 11.5px;
  margin: 6px 0 0;
}

.apidot-input,
.apidot-select,
.apidot-textarea {
  width: 100%;
  border: 1px solid var(--ap-border-strong);
  background: #fff;
  color: var(--ap-text);
  border-radius: var(--ap-radius-sm);
  font-size: 14px;
  font-family: inherit;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.apidot-input,
.apidot-select {
  height: 44px;
  padding: 0 14px;
}

.apidot-textarea {
  padding: 12px 14px;
  min-height: 110px;
  resize: vertical;
}

.apidot-input:focus,
.apidot-select:focus,
.apidot-textarea:focus {
  outline: none;
  border-color: var(--ap-accent);
  box-shadow: 0 0 0 3px var(--ap-accent-soft);
}

.apidot-textarea[data-counted] {
  min-height: 110px;
}

.apidot-form textarea[name="prompt"] {
  min-height: 120px;
  height: 120px;
  resize: vertical;
}

/* 分段选择 */
.apidot-seg {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 4px;
  background: var(--ap-surface-2);
  border: 1px solid var(--ap-border);
  border-radius: 12px;
}

.apidot-seg-item {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--ap-muted);
  font-size: 14px;
  font-weight: 500;
  padding: 8px 16px;
  border-radius: 9px;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}

.apidot-seg-item:hover {
  color: var(--ap-text);
}

.apidot-seg-item.is-active {
  background: var(--ap-surface);
  color: var(--ap-text);
  font-weight: 600;
  box-shadow: 0 1px 3px rgba(31, 28, 25, 0.12);
}

/* 复选框 */
.apidot-check {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  cursor: pointer;
  color: var(--ap-text);
}

.apidot-check input {
  width: 16px;
  height: 16px;
  accent-color: var(--ap-accent);
  cursor: pointer;
}

/* --------------------------------------------------------------------------
   文件上传 / URL 列表
   -------------------------------------------------------------------------- */

.apidot-upload {
  border: 1px dashed var(--ap-border-strong);
  background: var(--ap-surface-2);
  border-radius: var(--ap-radius-sm);
  padding: 14px;
  margin-top: 8px;
}

.apidot-upload + .apidot-upload {
  margin-top: 10px;
  margin-bottom: 10px;
}

.apidot-upload > .apidot-upload-drop {
  margin-right: 8px;
  margin-bottom: 8px;
}

.apidot-upload-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
}

.apidot-upload-label {
  font-size: 13px;
  font-weight: 600;
}

.apidot-upload-count {
  font-size: 12px;
  color: var(--ap-faint);
}

.apidot-upload-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.apidot-media-list {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 12px 0 0;
  padding: 0;
}

.apidot-media-list:empty {
  margin: 0;
}

.apidot-media-item {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 72px;
  height: 72px;
  background: #fff;
  border: 1px solid var(--ap-border);
  border-radius: var(--ap-radius-sm, 8px);
  padding: 0;
  font-size: 13px;
  overflow: hidden;
}

.apidot-media-item.is-uploading {
  opacity: 0.7;
}

.apidot-media-preview {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.apidot-media-preview img,
.apidot-media-preview video,
.apidot-media-preview audio {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.apidot-media-preview audio::-webkit-media-controls-panel {
  background: rgba(255, 255, 255, 0.95);
}

.apidot-media-preview-audio,
.apidot-media-preview-file {
  font-size: 28px;
  color: var(--ap-accent, #4f46e5);
}

.apidot-media-progress {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.85);
  font-size: 11px;
  color: var(--ap-muted, #6b7280);
  z-index: 1;
}

.apidot-media-name {
  display: none;
}

.apidot-media-remove {
  position: absolute;
  top: 4px;
  right: 4px;
  appearance: none;
  border: 0;
  background: rgba(0, 0, 0, 0.5);
  color: #fff;
  width: 20px;
  height: 20px;
  line-height: 1;
  border-radius: 50%;
  cursor: pointer;
  font-size: 14px;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s ease, color 0.15s ease;
}

.apidot-media-remove:hover {
  background: var(--ap-danger);
  color: #fff;
}

/* --------------------------------------------------------------------------
   按钮与操作区
   -------------------------------------------------------------------------- */

.apidot-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid var(--ap-border);
  flex-wrap: wrap;
}

.apidot-result-toolbar {
  display: flex;
  gap: 8px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--ap-border);
  background: rgba(255, 255, 255, 0.4);
}

.apidot-result-toolbar.apidot-hidden {
  display: none;
}

.apidot-btn {
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border-radius: var(--ap-radius-sm);
  font-size: 14px;
  font-weight: 600;
  font-family: inherit;
  padding: 11px 20px;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease,
    box-shadow 0.15s ease, opacity 0.15s ease;
  text-decoration: none;
}

.apidot-btn:disabled {
  cursor: not-allowed;
  opacity: 0.6;
}

.apidot-btn-outline {
  border: 1px solid var(--ap-border-strong);
  background: #fff;
  color: var(--ap-text);
}

.apidot-btn-outline:hover:not(:disabled) {
  border-color: var(--ap-accent);
  color: var(--ap-accent-hover);
}

.apidot-btn-primary {
  border: 1px solid var(--ap-accent);
  background: var(--ap-accent);
  color: #fff;
}

.apidot-btn-primary:hover:not(:disabled) {
  background: var(--ap-accent-hover);
  border-color: var(--ap-accent-hover);
}

.apidot-btn-secondary {
  border: 1px solid var(--ap-border-strong);
  background: #fff;
  color: var(--ap-text);
}

.apidot-btn-secondary:hover:not(:disabled) {
  border-color: var(--ap-accent);
  color: var(--ap-accent);
}

.apidot-btn-ghost {
  border: 1px solid transparent;
  background: transparent;
  color: var(--ap-muted);
}

.apidot-btn-ghost:hover:not(:disabled) {
  color: var(--ap-accent);
  background: var(--ap-accent-soft);
}

.apidot-btn-sm {
  padding: 7px 12px;
  font-size: 12.5px;
}

.apidot-file-input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
}

.apidot-generate {
  min-width: 100%;
}

.apidot-generate.is-loading {
  pointer-events: none;
}

/* --------------------------------------------------------------------------
   结果区
   -------------------------------------------------------------------------- */

.apidot-result {
  margin-top: 24px;
  padding: 16px;
  background: var(--ap-surface-2, #f8fafc);
  border: 1px solid var(--ap-border, #e5e7eb);
  border-radius: var(--ap-radius, 12px);
  display: flex;
  flex-direction: column;
}

.apidot-result.has-result {
  min-height: 360px;
  max-height: 70vh;
  overflow: auto;
}

.apidot-result-empty,
.apidot-status {
  flex: 1;
}

.apidot-result-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  align-items: flex-start;
}

.apidot-result-item {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: auto;
  max-width: 100%;
  height: 320px;
  aspect-ratio: auto;
  background: #0f172a;
}

.apidot-result-item img,
.apidot-result-item video {
  width: auto;
  max-width: 100%;
  height: 100%;
  object-fit: contain;
}

.apidot-result-loading {
  padding: 20px;
  text-align: center;
  color: var(--ap-muted);
  font-size: 14px;
}

.apidot-status {
  padding: 14px 16px;
  background: var(--ap-info-soft);
  border: 1px solid #c7d4f8;
  color: var(--ap-info);
  border-radius: var(--ap-radius-sm);
  font-size: 13.5px;
  word-break: break-all;
}

.apidot-media-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 16px;
}

.apidot-media-card {
  border: 1px solid var(--ap-border);
  border-radius: var(--ap-radius-sm);
  overflow: hidden;
  background: #fff;
}

.apidot-media-card img,
.apidot-media-card video {
  display: block;
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  background: #14110d;
}

.apidot-media-card video {
  aspect-ratio: auto;
  max-height: 360px;
  object-fit: contain;
}

.apidot-media-card audio {
  display: block;
  width: 100%;
}

.apidot-media-fallback {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 120px;
  padding: 16px;
  color: var(--ap-muted);
  font-size: 13px;
  word-break: break-all;
  text-align: center;
}

.apidot-media-actions {
  padding: 10px;
  border-top: 1px solid var(--ap-border);
}

.apidot-media-actions .apidot-btn {
  width: 100%;
  padding: 9px 14px;
}

.apidot-result-empty {
  padding: 24px;
  text-align: center;
  color: var(--ap-muted);
  background: var(--ap-surface-2);
  border: 1px dashed var(--ap-border-strong);
  border-radius: var(--ap-radius-sm);
  font-size: 14px;
}

.apidot-result-empty-debug {
  text-align: left;
  word-break: break-all;
}
.apidot-result-empty-debug p { margin: 0 0 8px; }
.apidot-result-empty-debug code {
  background: rgba(0,0,0,0.06);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 12px;
}
.apidot-result-debug-title { margin-top: 8px; color: var(--ap-text); font-weight: 600; }
.apidot-result-debug {
  max-height: 260px;
  overflow: auto;
  margin: 0;
  padding: 12px;
  background: #0f172a;
  color: #e2e8f0;
  border-radius: var(--ap-radius-sm);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-all;
}

.apidot-result-error {
  color: #ef4444;
  border-color: rgba(239,68,68,0.4);
}

/* --------------------------------------------------------------------------
   历史记录
   -------------------------------------------------------------------------- */

.apidot-history-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.apidot-history-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 64px 24px;
  color: var(--ap-muted);
  background: var(--ap-surface);
  border: 1px dashed var(--ap-border);
  border-radius: var(--ap-radius);
}

.apidot-history-empty svg {
  width: 48px;
  height: 48px;
  margin-bottom: 12px;
  opacity: 0.5;
}

.apidot-history-item {
  background: var(--ap-surface);
  border: 1px solid var(--ap-border);
  border-radius: var(--ap-radius-sm);
  padding: 16px;
  transition: border-color 0.2s ease, background 0.2s ease;
}

.apidot-history-item:hover {
  background: rgba(255,255,255,0.03);
  border-color: rgba(148,163,184,0.25);
}

.apidot-history-main {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px 16px;
}

.apidot-history-page {
  font-weight: 600;
  color: var(--ap-text);
}

.apidot-history-status {
  font-size: 12px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--ap-surface-2);
  color: var(--ap-muted);
}

.apidot-status-success .apidot-history-status,
.apidot-status-completed .apidot-history-status,
.apidot-status-finished .apidot-history-status,
.apidot-status-succeed .apidot-history-status {
  background: rgba(16,185,129,0.12);
  color: #34d399;
}

.apidot-status-failed .apidot-history-status,
.apidot-status-failure .apidot-history-status,
.apidot-status-error .apidot-history-status {
  background: rgba(239,68,68,0.12);
  color: #f87171;
}

.apidot-status-pending .apidot-history-status {
  background: rgba(56,189,248,0.12);
  color: #38bdf8;
}

.apidot-history-time,
.apidot-history-price {
  font-size: 13px;
  color: var(--ap-muted);
  margin-left: auto;
}

.apidot-history-prompt {
  margin-top: 10px;
  font-size: 14px;
  color: var(--ap-muted);
  line-height: 1.5;
}

.apidot-history-detail {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--ap-border);
}

.apidot-history-summary {
  cursor: default;
}

.apidot-history-expand {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  font-size: 12px;
  font-weight: 600;
  color: var(--ap-accent);
  background: rgba(37, 99, 235, 0.12);
  border: 1px solid rgba(37, 99, 235, 0.45);
  border-radius: 999px;
  cursor: pointer;
  transition: background .15s ease, border-color .15s ease;
}
.apidot-history-expand:hover {
  background: rgba(37, 99, 235, 0.22);
  border-color: var(--ap-accent);
}
.apidot-history-expand[aria-expanded="true"] .apidot-history-expand-text {
  display: none;
}
.apidot-history-expand[aria-expanded="true"]::after {
  content: '收起结果';
}
.apidot-history-expand-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  font-size: 11px;
  font-weight: 700;
  color: #fff;
  background: var(--ap-accent);
  border-radius: 999px;
}
.apidot-history-expand-arrow {
  font-size: 10px;
  transition: transform .2s ease;
}
.apidot-history-expand[aria-expanded="true"] .apidot-history-expand-arrow {
  transform: rotate(180deg);
}

.apidot-history-body {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--ap-border);
}

.apidot-history-media {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 12px;
  margin-bottom: 12px;
}

.apidot-history-media-inline {
  margin-top: 0;
  margin-bottom: 0;
}

.apidot-history-media img,
.apidot-history-media video {
  width: 100%;
  height: 140px;
  object-fit: cover;
  border-radius: var(--ap-radius-sm);
  border: 1px solid var(--ap-border);
  display: block;
  background: #0f172a;
}

.apidot-history-toggle {
  margin-top: 10px;
  padding: 4px 10px;
  font-size: 12px;
  color: var(--ap-muted);
  background: transparent;
  border: 1px solid var(--ap-border);
  border-radius: 999px;
  cursor: pointer;
  transition: color .15s ease, border-color .15s ease;
}
.apidot-history-toggle:hover {
  color: var(--ap-accent);
  border-color: var(--ap-accent);
}

.apidot-admin-history-media {
  display: flex !important;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 8px;
  margin: 0;
  grid-template-columns: none !important;
}
.apidot-admin-history-media .apidot-preview-thumb {
  display: inline-block;
  width: 72px !important;
  height: 72px !important;
  line-height: 0;
  border-radius: 6px;
  overflow: hidden;
  border: 1px solid rgba(148,163,184,0.35);
  background: #0f172a;
  position: relative;
  flex: 0 0 72px;
  max-width: 72px !important;
  max-height: 72px !important;
  margin: 0;
  padding: 0;
  vertical-align: top;
}
.apidot-admin-history-media .apidot-preview-thumb img,
.apidot-admin-history-media .apidot-preview-thumb video {
  width: 72px !important;
  height: 72px !important;
  max-width: 72px !important;
  max-height: 72px !important;
  min-width: 0 !important;
  min-height: 0 !important;
  object-fit: cover;
  display: block;
  border: 0;
  margin: 0;
  padding: 0;
}
.apidot-admin-history-media .apidot-preview-audio-badge {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 72px;
  height: 72px;
  font-size: 22px;
  color: var(--ap-accent);
  background: rgba(37, 99, 235, 0.15);
}

.apidot-history-detail pre {
  margin: 0;
  padding: 14px;
  background: var(--ap-surface-2);
  border-radius: var(--ap-radius-sm);
  font-size: 12px;
  overflow-x: auto;
  max-height: 320px;
  overflow-y: auto;
}

/* --------------------------------------------------------------------------
   响应式
   -------------------------------------------------------------------------- */

@media (max-width: 760px) {
  .apidot-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
  }

  .apidot-row {
    grid-template-columns: 1fr;
    gap: 0;
  }

  .apidot-row-3 {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
  }

  .apidot-row-3 .apidot-field {
    margin-bottom: 0;
  }

  .apidot-grid-3 {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
  }

  .apidot-row .apidot-field {
    margin-bottom: 16px;
  }

  .apidot-hero,
  .apidot-form {
    padding: 20px;
  }

  .apidot-hero-title {
    font-size: 24px;
  }

  .apidot-page-title {
    font-size: 22px;
  }

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

  .apidot-generate {
    width: 100%;
  }
}

/* --------------------------------------------------------------------------
   价格 / 余额
   -------------------------------------------------------------------------- */

.apidot-meta-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-top: 20px;
  margin-bottom: 20px;
  padding: 12px 16px;
  background: var(--ap-surface);
  border: 1px solid var(--ap-border);
  border-radius: var(--ap-radius-sm);
  font-size: 14px;
  color: var(--ap-muted);
}

.apidot-meta-bar strong {
  color: var(--ap-accent);
  font-weight: 600;
}

.apidot-generate {
  position: relative;
}

.apidot-price-badge {
  position: absolute;
  top: -16px;
  background: linear-gradient(1deg, #38bdf8, #ffffff);
  color: #fff;
  font-size: 11px;
  font-weight: 600;
  line-height: 1.3;
  padding: 4px 10px;
  border-radius: 12px;
  white-space: normal;
  text-align: center;
  max-width: 220px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.12);
  pointer-events: none;
  z-index: 10;
}

.apidot-generate.is-loading .apidot-price-badge {
  display: none;
}

/* --------------------------------------------------------------------------
   统一弹窗（不透明）
   -------------------------------------------------------------------------- */

.apidot-modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 999999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.18s ease;
}

.apidot-modal.apidot-modal-show {
  opacity: 1;
  pointer-events: auto;
}

body.apidot-modal-open { overflow: hidden; }

.apidot-modal-overlay {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.55);
  backdrop-filter: blur(2px);
}

.apidot-modal-box {
  position: relative;
  width: 100%;
  max-width: 440px;
  background: #ffffff;
  border: 1px solid rgba(15, 23, 42, 0.08);
  border-radius: 16px;
  box-shadow: 0 30px 80px rgba(15, 23, 42, 0.28), 0 4px 12px rgba(15, 23, 42, 0.08);
  padding: 28px 24px 22px;
  text-align: center;
  transform: translateY(12px) scale(0.96);
  opacity: 0;
  transition: transform 0.22s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.18s ease;
}

.apidot-modal.apidot-modal-show .apidot-modal-box {
  transform: translateY(0) scale(1);
  opacity: 1;
}

.apidot-modal-close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 30px;
  height: 30px;
  border: 0;
  background: transparent;
  color: #94a3b8;
  font-size: 22px;
  line-height: 1;
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s ease, color 0.15s ease;
}
.apidot-modal-close:hover { background: #f1f5f9; color: #0f172a; }

@keyframes apidot-modal-in {
  from { opacity: 0; transform: translateY(-16px) scale(0.96); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.apidot-modal-icon {
  width: 56px;
  height: 56px;
  margin: 4px auto 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  font-size: 26px;
  font-weight: 700;
  line-height: 1;
}

.apidot-modal-warning .apidot-modal-icon {
  background: linear-gradient(135deg, #fef3c7, #fde68a);
  color: #b45309;
  box-shadow: 0 6px 16px rgba(245, 158, 11, 0.25);
}
.apidot-modal-error .apidot-modal-icon,
.apidot-modal-danger .apidot-modal-icon {
  background: linear-gradient(135deg, #fee2e2, #fecaca);
  color: #b91c1c;
  box-shadow: 0 6px 16px rgba(239, 68, 68, 0.25);
}
.apidot-modal-info .apidot-modal-icon {
  background: linear-gradient(135deg, #dbeafe, #bfdbfe);
  color: #1d4ed8;
  box-shadow: 0 6px 16px rgba(59, 130, 246, 0.25);
}
.apidot-modal-success .apidot-modal-icon {
  background: linear-gradient(135deg, #dcfce7, #bbf7d0);
  color: #15803d;
  box-shadow: 0 6px 16px rgba(34, 197, 94, 0.25);
}

.apidot-modal-title {
  font-size: 18px;
  font-weight: 700;
  color: #0f172a;
  margin-bottom: 10px;
  letter-spacing: -0.01em;
}

.apidot-modal-message {
  font-size: 14px;
  color: #475569;
  line-height: 1.7;
  margin-bottom: 22px;
  word-break: break-word;
}
.apidot-modal-message strong { color: #0f172a; }

.apidot-modal-field { margin-bottom: 18px; text-align: left; }
.apidot-modal-input {
  width: 100%;
  padding: 11px 14px;
  border: 1.5px solid #e2e8f0;
  border-radius: 10px;
  font-size: 14px;
  line-height: 1.5;
  color: #0f172a;
  background: #f8fafc;
  transition: border-color 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
  font-family: inherit;
  box-sizing: border-box;
  outline: none;
}
.apidot-modal-input:focus {
  border-color: #2563eb;
  background: #fff;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}
.apidot-modal-input-error {
  border-color: #dc2626 !important;
  background: #fef2f2 !important;
  box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.12) !important;
}
.apidot-modal-textarea { min-height: 96px; resize: vertical; }

.apidot-modal-actions {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  flex-wrap: wrap;
}

.apidot-modal-actions .apidot-btn {
  min-width: 108px;
  padding: 10px 20px;
  font-size: 14px;
  border-radius: 10px;
}

/* 弹窗主按钮：使用高特异性渐变样式，避免被主题样式覆盖成无色 */
.apidot-modal .apidot-modal-actions .apidot-btn-primary,
.apidot-modal-box .apidot-modal-actions .apidot-btn-primary {
  background: linear-gradient(135deg, #f59e0b, #d97706);
  background-color: #d97706;
  border: 1px solid #b45309;
  color: #fff !important;
  box-shadow: 0 4px 12px rgba(217, 119, 6, 0.3);
  font-weight: 600;
}
.apidot-modal .apidot-modal-actions .apidot-btn-primary:hover:not(:disabled),
.apidot-modal-box .apidot-modal-actions .apidot-btn-primary:hover:not(:disabled) {
  background: linear-gradient(135deg, #d97706, #b45309);
  background-color: #b45309;
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(180, 83, 9, 0.35);
}

/* 弹窗中的价格金额突出显示 */
.apidot-modal .apidot-modal-price {
  color: #d97706;
  font-weight: 700;
  font-size: 1.05em;
}

/* 危险按钮补充样式（如主题中未定义） */
.apidot-btn-danger {
  background: linear-gradient(135deg, #ef4444, #dc2626);
  color: #fff;
  border: 0;
  box-shadow: 0 4px 12px rgba(220, 38, 38, 0.25);
}
.apidot-btn-danger:hover {
  background: linear-gradient(135deg, #dc2626, #b91c1c);
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(220, 38, 38, 0.3);
}

/* 后台表格中的删除链接统一外观 */
.apidot-confirm-link[data-confirm-danger="1"] { color: #dc2626; }
.apidot-confirm-link[data-confirm-danger="1"]:hover { color: #b91c1c; }

/* --------------------------------------------------------------------------
   模式标签页
   -------------------------------------------------------------------------- */

.apidot-tabs {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 4px;
  background: var(--ap-surface-2);
  border: 1px solid var(--ap-border);
  border-radius: 12px;
  margin-bottom: 20px;
}

.apidot-tab {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--ap-muted);
  font-size: 14px;
  font-weight: 500;
  padding: 8px 16px;
  border-radius: 9px;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}

.apidot-tab:hover {
  color: var(--ap-text);
}

.apidot-tab.is-active {
  background: var(--ap-surface);
  color: var(--ap-text);
  font-weight: 600;
  box-shadow: 0 1px 3px rgba(31, 28, 25, 0.12);
}

.apidot-tab-panel {
  display: none;
}

.apidot-tab-panel.is-active {
  display: block;
}

.apidot-conditional {
  display: block;
}

.apidot-hidden {
  display: none !important;
}

/* --------------------------------------------------------------------------
   图标扩展
   -------------------------------------------------------------------------- */

.apidot-icon-sparkle {
  background: #fff7ed;
  color: #d97706;
}

.apidot-icon-film {
  background: #eff6ff;
  color: #2563eb;
}

@media (max-width: 760px) {
  .apidot-meta-bar {
    align-items: flex-start;
    gap: 6px;
  }

  .apidot-price-badge {
    top: -16px;
    font-size: 11px;
    padding: 4px 10px;
  }
}

/* ==========================================================
 * APIDot 新增：提示词选择器 / 案例展示 / 统一预览弹窗
 * ========================================================== */

/* 提示词选择器 */
.apidot-form {
  position: relative;
}

.apidot-prompt-selector {
  position: absolute;
  top: 16px;
  right: 16px;
  z-index: 30;
}

.apidot-prompt-trigger {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border: 1px solid var(--ap-accent, #4f46e5);
  border-radius: var(--ap-radius-sm, 8px);
  background: rgba(79, 70, 229, 0.08);
  color: var(--ap-accent, #4f46e5);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.2s ease, transform 0.15s ease;
}

.apidot-prompt-trigger:hover {
  background: rgba(79, 70, 229, 0.16);
  transform: translateY(-1px);
}

.apidot-prompt-popup {
  position: absolute;
  top: 100%;
  right: 0;
  width: 360px;
  max-width: calc(100vw - 32px);
  margin-top: 8px;
  background: #fff;
  border: 1px solid var(--ap-border, #e5e7eb);
  border-radius: var(--ap-radius-md, 12px);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.12);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-8px);
  transition: opacity 0.2s ease, transform 0.2s ease, visibility 0.2s;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  max-height: 70vh;
}

.apidot-prompt-popup.is-open {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.apidot-prompt-popup-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid var(--ap-border, #e5e7eb);
}

.apidot-prompt-popup-title {
  font-size: 15px;
  font-weight: 600;
  margin: 0;
  color: var(--ap-text, #111827);
}

.apidot-prompt-popup-close {
  background: none;
  border: none;
  font-size: 22px;
  line-height: 1;
  color: var(--ap-muted, #6b7280);
  cursor: pointer;
  padding: 0;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
}

.apidot-prompt-popup-close:hover {
  background: var(--ap-surface, #f3f4f6);
  color: var(--ap-text, #111827);
}

.apidot-prompt-tabs {
  display: flex;
  gap: 6px;
  padding: 10px 12px 0;
  overflow-x: auto;
  scrollbar-width: none;
}

.apidot-prompt-tabs::-webkit-scrollbar {
  display: none;
}

.apidot-prompt-tab {
  flex: 0 0 auto;
  padding: 5px 10px;
  font-size: 12px;
  border: 1px solid var(--ap-border, #e5e7eb);
  background: #fff;
  border-radius: 999px;
  color: var(--ap-muted, #6b7280);
  cursor: pointer;
  white-space: nowrap;
}

.apidot-prompt-tab-active,
.apidot-prompt-tab:hover {
  border-color: var(--ap-accent, #4f46e5);
  color: var(--ap-accent, #4f46e5);
  background: rgba(79, 70, 229, 0.06);
}

.apidot-prompt-search-wrap {
  padding: 10px 12px;
}

.apidot-prompt-search {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--ap-border, #e5e7eb);
  border-radius: var(--ap-radius-sm, 8px);
  font-size: 13px;
  outline: none;
}

.apidot-prompt-search:focus {
  border-color: var(--ap-accent, #4f46e5);
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.08);
}

.apidot-prompt-list {
  list-style: none;
  margin: 0;
  padding: 0 12px 12px;
  overflow-y: auto;
  flex: 1 1 auto;
}

.apidot-prompt-item {
  padding: 10px 12px;
  border-bottom: 1px solid var(--ap-border, #f3f4f6);
  cursor: pointer;
  border-radius: var(--ap-radius-sm, 8px);
  transition: background 0.15s ease;
}

.apidot-prompt-item:last-child {
  border-bottom: none;
}

.apidot-prompt-item:hover {
  background: var(--ap-surface, #f9fafb);
}

.apidot-prompt-item-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--ap-text, #111827);
  margin-bottom: 3px;
}

.apidot-prompt-item-content {
  font-size: 12px;
  color: var(--ap-muted, #6b7280);
  line-height: 1.45;
}

/* 案例展示 */
.apidot-showcase-section {
  margin-top: 28px;
  padding-top: 24px;
  border-top: 1px solid var(--ap-border, #e5e7eb);
}

.apidot-showcase-title {
  font-size: 16px;
  font-weight: 600;
  margin: 0 0 16px;
  color: var(--ap-text, #111827);
}

.apidot-showcase-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 16px;
  list-style: none;
  margin: 0;
  padding: 0;
}

.apidot-showcase-item {
  position: relative;
  background: #fff;
  border: 1px solid var(--ap-border, #e5e7eb);
  border-radius: var(--ap-radius-md, 12px);
  overflow: hidden;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.apidot-showcase-item:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
}

.apidot-showcase-media {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  display: block;
  background: var(--ap-surface, #f3f4f6);
}

.apidot-showcase-media-audio {
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #ede9fe 0%, #c7d2fe 100%);
}

.apidot-showcase-audio-icon {
  font-size: 36px;
  color: #4f46e5;
}

.apidot-showcase-info {
  padding: 10px 12px;
}

.apidot-showcase-info-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--ap-text, #111827);
  margin-bottom: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.apidot-showcase-info-prompt {
  font-size: 11px;
  color: var(--ap-muted, #6b7280);
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* 历史记录轮询提示 */
.apidot-history-refresh-hint,
.apidot-history-error-hint {
  font-size: 12px;
  margin-left: 8px;
  white-space: nowrap;
}
.apidot-history-refresh-hint {
  color: #059669;
}
.apidot-history-refresh-hint a {
  color: #059669;
  text-decoration: underline;
}
.apidot-history-error-hint {
  color: #dc2626;
  cursor: help;
}

/* 统一预览弹窗 */
.apidot-preview-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  text-decoration: none;
  color: inherit;
}

.apidot-preview-link:hover {
  text-decoration: none;
}

.apidot-preview-thumb {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 140px;
  height: 140px;
  border-radius: var(--ap-radius-sm, 8px);
  overflow: hidden;
  border: 1px solid var(--ap-border, #e5e7eb);
  background: var(--ap-surface, #f3f4f6);
  position: relative;
}

.apidot-preview-thumb img,
.apidot-preview-thumb video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.apidot-preview-audio-badge {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 32px;
  color: var(--ap-accent, #4f46e5);
  background: rgba(255, 255, 255, 0.9);
}

.apidot-preview-label {
  display: inline-block;
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.apidot-preview-modal {
  position: fixed;
  inset: 0;
  z-index: 999999;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.25s ease, visibility 0.25s;
}

.apidot-preview-modal.is-open {
  opacity: 1;
  visibility: visible;
}

.apidot-preview-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.72);
  cursor: pointer;
}

.apidot-preview-container {
  position: relative;
  z-index: 1;
  width: min(92vw, 900px);
  max-height: 90vh;
  background: #fff;
  border-radius: var(--ap-radius-md, 12px);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.25);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.apidot-preview-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  border-bottom: 1px solid var(--ap-border, #e5e7eb);
  flex: 0 0 auto;
}

.apidot-preview-title {
  font-size: 16px;
  font-weight: 600;
  margin: 0;
  color: var(--ap-text, #111827);
}

.apidot-preview-close {
  background: none;
  border: none;
  font-size: 24px;
  line-height: 1;
  color: var(--ap-muted, #6b7280);
  cursor: pointer;
  padding: 0;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
}

.apidot-preview-close:hover {
  background: var(--ap-surface, #f3f4f6);
  color: var(--ap-text, #111827);
}

.apidot-preview-body {
  flex: 1 1 auto;
  min-height: 0;
  padding: 18px;
  overflow: auto;
  background: #0f0f0f;
  display: flex;
  align-items: center;
  justify-content: center;
}

.apidot-preview-body img,
.apidot-preview-body video {
  max-width: 100%;
  max-height: 55vh;
  object-fit: contain;
}

.apidot-preview-body audio {
  max-width: 100%;
}

.apidot-preview-footer {
  flex: 0 0 auto;
  padding: 14px 18px;
  border-top: 1px solid var(--ap-border, #e5e7eb);
  text-align: right;
  background: #fff;
}

@media (max-width: 760px) {
  .apidot-prompt-selector {
    margin-bottom: 12px;
    text-align: right;
  }

  .apidot-prompt-popup {
    position: fixed;
    left: 12px;
    right: 12px;
    top: 10vh;
    width: auto;
  }

  .apidot-showcase-list {
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  }

  .apidot-preview-thumb {
    width: 100px;
    height: 100px;
  }

  /* 移动端：结果卡片铺满宽度，避免横向滚动 */
  .apidot-result-item {
    display: block;
    width: 100%;
    max-width: 100%;
    height: auto;
    aspect-ratio: 4 / 3;
    border-radius: var(--ap-radius-sm, 8px);
    overflow: hidden;
    background: var(--ap-surface, #f3f4f6);
    border: 1px solid var(--ap-border, #e5e7eb);
    cursor: pointer;
  }

  .apidot-result-item img,
  .apidot-result-item video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    pointer-events: none;
  }
}

/* --------------------------------------------------------------------------
   提示词编辑器、@ 提及、扩写按钮
   -------------------------------------------------------------------------- */

.apidot-prompt-field {
  position: relative;
  display: flex;
  flex-direction: column;
  margin-bottom: 16px;
}

.apidot-prompt-editor {
  width: 100%;
  min-height: 120px;
  padding: 12px 14px 22px 14px;
  border: 1px solid var(--ap-border, #e5e7eb);
  border-radius: var(--ap-radius-sm, 8px);
  background: #fff;
  color: var(--ap-text, #111827);
  font-size: 14px;
  line-height: 1.6;
  outline: none;
  overflow: auto;
  resize: vertical;
  white-space: pre-wrap;
  word-break: break-word;
}

.apidot-prompt-editor:empty::before {
  content: attr(data-placeholder);
  color: var(--ap-faint, #9ca3af);
  pointer-events: none;
}

.apidot-prompt-hidden {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  opacity: 0;
  overflow: hidden;
}

.apidot-prompt-editor:focus {
  border-color: var(--ap-accent, #4f46e5);
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.08);
}

.apidot-prompt-tag {
  display: inline;
  color: #ef4444;
  font-weight: 600;
  cursor: default;
  user-select: none;
}

.apidot-mention-popup {
  position: absolute;
  left: 10px;
  z-index: 50;
  background: #fff;
  border: 1px solid var(--ap-border, #e5e7eb);
  border-radius: var(--ap-radius-sm, 8px);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.12);
  padding: 6px 0;
  min-width: 160px;
  max-width: 260px;
}

.apidot-mention-list {
  list-style: none;
  margin: 0;
  padding: 0;
  max-height: 220px;
  overflow-y: auto;
}

.apidot-mention-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  cursor: pointer;
  transition: background 0.12s ease;
}

.apidot-mention-item.is-active,
.apidot-mention-item:hover {
  background: var(--ap-surface, #f9fafb);
}

.apidot-mention-thumb {
  width: 36px;
  height: 36px;
  border-radius: 6px;
  overflow: hidden;
  border: 1px solid var(--ap-border, #e5e7eb);
  background: var(--ap-surface, #f3f4f6);
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
}

.apidot-mention-thumb img,
.apidot-mention-thumb video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.apidot-mention-label {
  font-size: 13px;
  color: var(--ap-text, #111827);
}

.apidot-expand-prompt-btn {
  position: absolute;
  left: 50%;
  bottom: -14px;
  transform: translateX(-50%);
  width: 40px;
  height: 28px;
  border: 0;
  border-radius: 0 0 999px 999px;
  background: var(--ap-accent, #4f46e5);
  color: #fff;
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(79, 70, 229, 0.25);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  z-index: 5;
  transition: transform 0.15s ease, background 0.15s ease;
}

.apidot-expand-prompt-btn:hover:not(:disabled) {
  transform: translateX(-50%) scale(1.08);
  background: var(--ap-accent-hover, #4338ca);
}

.apidot-expand-prompt-btn.is-loading {
  opacity: 1;
  cursor: wait;
  animation: apidot-blink 0.9s ease-in-out infinite;
}

@keyframes apidot-blink {
  0%, 100% { opacity: 1; transform: translateX(-50%) scale(1); }
  50% { opacity: 0.45; transform: translateX(-50%) scale(1.12); }
}

.apidot-result-error {
  color: var(--ap-danger, #dc2626);
  background: #fef2f2;
  border: 1px solid #fecaca;
  border-radius: var(--ap-radius-sm, 8px);
  padding: 14px 16px;
}

.apidot-preview-prompt {
  display: none;
  flex: 0 0 auto;
  margin: 0;
  padding: 10px 14px;
  max-height: 80px;
  overflow-y: auto;
  background: var(--ap-surface, #f9fafb);
  border-top: 1px solid var(--ap-border, #e5e7eb);
  font-size: 13px;
  color: var(--ap-text, #111827);
  line-height: 1.5;
}

.apidot-preview-prompt strong {
  display: block;
  margin-bottom: 4px;
  font-size: 12px;
  color: var(--ap-muted, #6b7280);
}

.apidot-preview-prompt-text {
  display: block;
  white-space: pre-wrap;
  word-break: break-word;
}

.apidot-preview-use-prompt {
  appearance: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border: 0;
  border-radius: var(--ap-radius-sm, 8px);
  background: var(--ap-accent, #4f46e5);
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s ease;
}

.apidot-preview-use-prompt:hover {
  background: var(--ap-accent-hover, #4338ca);
}

/* --------------------------------------------------------------------------
   组合页顶层 Tab 切换（图像生成 / 视频生成 大分类）
   -------------------------------------------------------------------------- */

.apidot-combo-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 15px;
}

.apidot-combo-tab {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 16px 20px;
  border: 1.5px solid var(--ap-border);
  border-radius: 14px;
  background: var(--ap-surface);
  color: var(--ap-muted);
  font-size: 15px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
}

.apidot-combo-tab:hover {
  border-color: var(--ap-border-strong, #d4cfc7);
  color: var(--ap-text);
}

.apidot-combo-tab.is-active {
  border-color: var(--ap-accent, #4f46e5);
  background: linear-gradient(180deg, var(--ap-accent-soft, rgba(79, 70, 229, 0.08)) 0%, var(--ap-surface) 100%);
  color: var(--ap-text);
  font-weight: 600;
  box-shadow: 0 2px 12px rgba(79, 70, 229, 0.08);
}

.apidot-combo-tab-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  color: inherit;
}

.apidot-combo-tab-icon svg {
  width: 22px;
  height: 22px;
  stroke-width: 1.8;
}

.apidot-combo-panel {
  animation: apidot-fade-in 0.25s ease;
}

@keyframes apidot-fade-in {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

@media (max-width: 640px) {
  .apidot-combo-tabs {
    gap: 8px;
    margin-bottom: 15px;
  }
  .apidot-combo-tab {
    gap: 4px;
    padding: 12px 8px;
    font-size: 13px;
  }
  .apidot-combo-tab-icon svg {
    width: 20px;
    height: 20px;
  }
}

