/* AI 图片工坊 · 前台 UI（从线上 DOM 还原） */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

html,
body {
  margin: 0;
  min-height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', sans-serif;
  color: #1f2329;
  background: linear-gradient(145deg, #f3e8ff 0%, #fce7f3 35%, #e0e7ff 70%, #f5f3ff 100%);
  background-attachment: fixed;
  touch-action: manipulation;
}

button,
textarea,
input {
  font: inherit;
}

#root {
  min-height: 100vh;
}

.semi-layout {
  width: 100%;
}

/* ========== 顶栏 ========== */
.aip-studio-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(124, 58, 237, 0.08);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.8), 0 4px 24px rgba(76, 29, 149, 0.06);
}

.aip-header-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 12px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  flex-wrap: wrap;
}

.aip-studio-user {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}

.aip-studio-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: linear-gradient(135deg, #7c3aed 0%, #a78bfa 100%);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  font-weight: 700;
  box-shadow: 0 4px 12px rgba(124, 58, 237, 0.35);
  border: 2px solid #fff;
}

.aip-studio-user-meta {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.aip-studio-name {
  font-size: 14px;
  font-weight: 600;
  color: #1f2329;
}

.aip-studio-balance {
  font-size: 12px;
  color: #8f959e;
}

.aip-studio-balance em {
  font-style: normal;
  font-weight: 600;
  color: #d97706;
}

.aip-studio-nav {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  justify-content: flex-end;
  flex: 1;
}

.aip-studio-nav-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: none;
  background: transparent;
  padding: 8px 16px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 500;
  color: #646a73;
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
}

.aip-studio-nav-btn:hover {
  background: #f5f3ff;
  color: #5b21b6;
}

.aip-studio-nav-btn.is-active {
  background: linear-gradient(180deg, #ede9fe 0%, #e9d5ff 100%);
  color: #5b21b6;
  box-shadow: inset 0 0 0 1px rgba(124, 58, 237, 0.15);
}

.aip-studio-nav-icon {
  display: flex;
  align-items: center;
}

/* ========== 主内容 ========== */
.aip-app-content {
  max-width: 720px;
  margin: 0 auto;
  padding: 24px 20px 48px;
}

.istudio-content {
  animation: ipage-enter 0.45s ease;
}

@keyframes ipage-enter {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.aip-hero {
  text-align: center;
  margin-bottom: 20px;
}

.aip-hero h1 {
  margin: 0 0 8px;
  font-size: 28px;
  font-weight: 700;
  color: #5b21b6;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

.aip-sparkle {
  color: #a78bfa;
}

.aip-hero p {
  margin: 0;
  font-size: 15px;
  color: #b45309;
  font-weight: 500;
}

/* ========== 模式切换 ========== */
.aip-mode-switch {
  display: flex;
  justify-content: center;
  gap: 0;
  margin-bottom: 20px;
  background: #fff;
  border-radius: 999px;
  padding: 4px;
  width: fit-content;
  margin-left: auto;
  margin-right: auto;
  box-shadow: 0 2px 12px rgba(124, 58, 237, 0.08);
  border: 1px solid rgba(124, 58, 237, 0.1);
}

.aip-mode-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: none;
  background: transparent;
  padding: 10px 22px;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 600;
  color: #646a73;
  cursor: pointer;
  transition: all 0.2s;
}

.aip-mode-btn.is-active {
  background: linear-gradient(180deg, #3d3550 0%, #2a2438 100%);
  color: #fff;
  box-shadow: 0 4px 14px rgba(42, 36, 56, 0.35);
}

/* ========== 上方预览区（参考图 / 生成加载） ========== */
.aip-preview-section {
  margin: 8px 0 32px;
}

.aip-preview-stage {
  width: 100%;
  max-width: 720px;
  margin: 0 auto;
}

.aip-preview-media {
  position: relative;
  width: 100%;
  box-sizing: border-box;
  padding: 16px;
  border-radius: 20px;
  background: linear-gradient(145deg, #f5f3ff 0%, #fce7f3 45%, #e0e7ff 100%);
  border: 1px solid rgba(167, 139, 250, 0.2);
  box-shadow: 0 12px 40px rgba(124, 58, 237, 0.12);
  transition:
    border-color 0.25s ease,
    box-shadow 0.25s ease;
}

.aip-preview-media.is-preview-glow {
  border-color: rgba(124, 58, 237, 0.5);
  box-shadow:
    0 0 0 1px rgba(124, 58, 237, 0.2),
    0 12px 40px rgba(124, 58, 237, 0.18),
    0 0 32px rgba(167, 139, 250, 0.28);
}

/* 外框固定高度，内部比例区域随「比例」选项变化 */
.aip-preview-frame {
  --frame-h: clamp(200px, 42vw, 280px);
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: var(--frame-h);
  min-height: 200px;
  max-height: 280px;
}

.aip-preview-ratio-wrap {
  position: relative;
  aspect-ratio: var(--preview-aspect, 1 / 1);
  width: min(100%, calc(var(--frame-h, 280px) * var(--fit-w, 1) / var(--fit-h, 1)));
  max-width: 100%;
  max-height: 100%;
  height: auto;
  transition:
    aspect-ratio 0.4s ease,
    width 0.4s ease;
}

.aip-preview-ratio-wrap.is-split {
  aspect-ratio: var(--preview-split-aspect, 2 / 1);
  width: min(100%, calc(var(--frame-h, 280px) * 2 * var(--fit-w, 1) / var(--fit-h, 1)));
  max-width: 100%;
  max-height: min(52vh, 420px);
  margin: 0 auto;
}

.aip-preview-ratio-box {
  position: relative;
  z-index: 2;
  width: 100%;
  height: 100%;
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 4px 20px rgba(124, 58, 237, 0.12);
  cursor: pointer;
}

.aip-preview-split {
  display: block;
  width: 100%;
  height: 100%;
  min-height: 0;
}

/* 图生图：左右两格对称并排 */
.aip-preview-split.is-dual,
body.is-img2img-mode .aip-preview-split {
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap;
  align-items: stretch;
}

.aip-preview-split:not(.is-dual) .aip-preview-pane-divider,
.aip-preview-split:not(.is-dual) .aip-preview-pane--out {
  display: none !important;
}

.aip-preview-split.is-dual .aip-preview-pane,
body.is-img2img-mode .aip-preview-split .aip-preview-pane {
  flex: 1 1 0;
  min-width: 0;
  min-height: 0;
}

.aip-preview-split.is-dual .aip-preview-pane-divider,
body.is-img2img-mode .aip-preview-split .aip-preview-pane-divider {
  display: block;
  width: 1px;
  flex-shrink: 0;
  align-self: stretch;
}

/* 文生图：单格预览 */
body:not(.is-img2img-mode) .aip-preview-split {
  display: block;
}

body:not(.is-img2img-mode) .aip-preview-pane--ref {
  width: 100%;
  height: 100%;
  min-height: 100%;
}

body:not(.is-img2img-mode) .aip-preview-pane-label {
  display: none;
}

body:not(.is-img2img-mode) .aip-preview-pane--ref .aip-preview-upload {
  font-size: clamp(36px, 10vw, 52px);
}

body.is-img2img-mode .aip-preview-stage {
  max-width: min(100%, 720px);
}

body.is-img2img-mode .aip-preview-frame {
  max-height: none;
  height: auto;
  min-height: clamp(200px, 42vw, 280px);
}

.aip-preview-pane {
  position: relative;
  flex: 1;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  background: linear-gradient(160deg, #f8fafc 0%, #f1f5f9 100%);
  transition:
    box-shadow 0.22s ease,
    background 0.22s ease;
}

.aip-preview-pane.is-pane-active {
  z-index: 1;
  background: linear-gradient(160deg, #faf5ff 0%, #ede9fe 55%, #f3e8ff 100%);
  box-shadow:
    inset 0 0 0 2px rgba(124, 58, 237, 0.55),
    inset 0 0 32px rgba(124, 58, 237, 0.14);
}

.aip-preview-pane--out.is-pane-active {
  background: linear-gradient(160deg, #f5f3ff 0%, #ede9fe 100%);
}

.aip-preview-pane-divider {
  flex-shrink: 0;
  width: 1px;
  background: rgba(124, 58, 237, 0.18);
  box-shadow: 0 0 8px rgba(124, 58, 237, 0.08);
}

.aip-preview-pane-label {
  position: absolute;
  top: 8px;
  left: 8px;
  z-index: 4;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: #fff;
  background: rgba(15, 23, 42, 0.52);
  pointer-events: none;
}

.aip-preview-pane-img {
  position: absolute;
  inset: 0;
  z-index: 1;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.aip-preview-pane-empty {
  position: absolute;
  inset: 0;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}

.aip-preview-pane.has-image .aip-preview-pane-empty {
  display: none;
}

.aip-preview-pane--ref .aip-preview-upload {
  width: 100%;
  height: 100%;
  border-radius: 0;
  border: none;
  background: transparent;
  font-size: 42px;
  transition:
    color 0.2s ease,
    background 0.2s ease,
    box-shadow 0.2s ease;
}

.aip-preview-pane--ref.is-pane-active .aip-preview-upload:not(:disabled),
.aip-preview-pane--ref .aip-preview-upload:hover:not(:disabled) {
  color: #7c3aed;
  background: rgba(237, 233, 254, 0.45);
  box-shadow: inset 0 0 36px rgba(124, 58, 237, 0.12);
}

.aip-preview-pane--ref .aip-preview-upload:focus-visible {
  outline: 2px solid rgba(124, 58, 237, 0.55);
  outline-offset: -6px;
}

.aip-preview-out-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  font-size: 12px;
  font-weight: 500;
  color: #9ca3af;
  padding: 0 12px;
  text-align: center;
  line-height: 1.45;
  background: linear-gradient(160deg, #f8fafc 0%, #f1f5f9 100%);
}

.aip-preview-split.is-dual .aip-preview-pane--ref .aip-preview-upload {
  width: 100%;
  height: 100%;
  min-height: 0;
  border-radius: 0;
  border: none;
  background: transparent;
  font-size: clamp(28px, 6vw, 42px);
}

.aip-preview-pane--ref .aip-preview-ref-nav {
  width: 36px;
}

.aip-preview-pane--ref .aip-preview-ref-nav--prev {
  left: 0;
  border-radius: 0;
}

.aip-preview-pane--ref .aip-preview-ref-nav--next {
  right: 0;
  left: auto;
  border-radius: 0;
}

.aip-preview-pane--ref .aip-preview-ref-indicator {
  bottom: 8px;
}

.aip-preview-stage.is-generating .aip-preview-ratio-box {
  cursor: default;
}

.aip-preview-stage.is-generating .aip-preview-ratio-wrap,
.aip-preview-stage.is-generating .aip-preview-ratio-box {
  overflow: visible;
}

.aip-preview-stage.is-generating .aip-preview-pane-empty {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

/* 生成中卡片：外圈霓虹粒子边框 + 内层进度 */
.aip-gen-card {
  position: absolute;
  inset: 0;
  z-index: 5;
  border-radius: 16px;
  isolation: isolate;
}

.aip-gen-border {
  position: absolute;
  inset: 0;
  border-radius: 16px;
  pointer-events: none;
  z-index: 1;
  filter: drop-shadow(0 0 12px rgba(34, 211, 238, 0.35)) drop-shadow(0 0 20px rgba(74, 222, 128, 0.2));
}

.aip-gen-card__inner {
  position: absolute;
  inset: 4px;
  z-index: 2;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  border-radius: 13px;
  background: rgba(6, 10, 20, 0.55);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  box-shadow: inset 0 0 32px rgba(0, 0, 0, 0.28);
  overflow: hidden;
}

.aip-gen-card__stage {
  flex: 1;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 10px 14px 6px;
  overflow: hidden;
  text-align: center;
}

.aip-gen-card__stage:empty {
  display: none;
}

#preview-prompt-slot {
  width: 100%;
  max-height: 100%;
  font-size: clamp(12px, 2.4vw, 14px);
  line-height: 1.55;
  font-weight: 500;
  letter-spacing: 0.02em;
  word-break: break-word;
  overflow: hidden;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 5;
  background: linear-gradient(
    125deg,
    rgba(186, 230, 253, 0.95) 0%,
    rgba(103, 232, 249, 0.88) 35%,
    rgba(134, 239, 172, 0.9) 70%,
    rgba(190, 242, 100, 0.85) 100%
  );
  background-size: 200% auto;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  animation: aip-prompt-gradient-shift 4s ease-in-out infinite;
  text-shadow: 0 0 24px rgba(34, 211, 238, 0.25);
}

.aip-preview-stage.is-generating .aip-gen-card__inner {
  justify-content: space-between;
}

.aip-prompt-fly-layer {
  position: fixed;
  inset: 0;
  z-index: 10050;
  pointer-events: none;
  overflow: visible;
}

.aip-prompt-fly {
  position: fixed;
  left: 0;
  top: 0;
  z-index: 10051;
  margin: 0;
  padding: 0;
  white-space: nowrap;
  font-weight: 500;
  letter-spacing: 0.02em;
  line-height: 1.4;
  pointer-events: none;
  will-change: transform, opacity;
  background: linear-gradient(
    120deg,
    rgba(224, 242, 254, 0.92) 0%,
    rgba(34, 211, 238, 0.85) 45%,
    rgba(74, 222, 128, 0.88) 100%
  );
  background-size: 180% auto;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  opacity: 0;
  transform: translate3d(0, 0, 0) scale(1);
  transition:
    transform 0.92s cubic-bezier(0.22, 1, 0.36, 1),
    opacity 0.55s ease;
  filter: drop-shadow(0 2px 8px rgba(34, 211, 238, 0.35));
}

.aip-prompt-fly.is-active {
  opacity: 0.94;
}

.aip-prompt-fly.is-done {
  opacity: 0;
  transition-duration: 0.28s;
}

@keyframes aip-prompt-gradient-shift {
  0%,
  100% {
    background-position: 0% 50%;
  }
  50% {
    background-position: 100% 50%;
  }
}

.aip-gen-border__aura {
  position: absolute;
  inset: -8px;
  border-radius: 20px;
  background: linear-gradient(
    120deg,
    #22d3ee 0%,
    #4ade80 38%,
    #a3e635 58%,
    #22d3ee 100%
  );
  background-size: 220% 220%;
  filter: blur(18px);
  opacity: 0.55;
  animation: aip-gen-aura-shift 5s ease-in-out infinite;
}

.aip-gen-border__frame {
  position: absolute;
  inset: 0;
  border-radius: 20px;
  overflow: hidden;
}

.aip-gen-border__flow {
  position: absolute;
  inset: -130%;
  background: conic-gradient(
    from 0deg,
    #0891b2 0deg,
    #22d3ee 55deg,
    #4ade80 140deg,
    #a3e635 220deg,
    #22d3ee 300deg,
    #0891b2 360deg
  );
  animation: aip-gen-spin 5.5s linear infinite;
}

.aip-gen-border__spark {
  position: absolute;
  inset: -4px;
  border-radius: 18px;
  background: repeating-conic-gradient(
    from 0deg at 50% 50%,
    transparent 0deg 10deg,
    rgba(125, 249, 255, 0.95) 10deg 11.5deg,
    transparent 11.5deg 22deg,
    rgba(74, 222, 128, 0.9) 22deg 23.5deg,
    transparent 23.5deg 34deg,
    rgba(163, 230, 53, 0.75) 34deg 35deg,
    transparent 35deg 45deg
  );
  animation: aip-gen-spin 5.5s linear infinite;
  mix-blend-mode: screen;
  opacity: 0.92;
  -webkit-mask:
    linear-gradient(#000 0 0) content-box,
    linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask:
    linear-gradient(#000 0 0) content-box,
    linear-gradient(#000 0 0);
  mask-composite: exclude;
  padding: 3px;
  box-sizing: border-box;
}

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

@keyframes aip-gen-aura-shift {
  0%,
  100% {
    background-position: 0% 50%;
    opacity: 0.48;
  }
  50% {
    background-position: 100% 50%;
    opacity: 0.68;
  }
}

.aip-preview-frame-hint {
  margin: 10px 0 0;
  text-align: center;
  font-size: 12px;
  color: #9ca3af;
  line-height: 1.5;
}

.aip-preview-ref-nav {
  position: absolute;
  top: 0;
  bottom: 0;
  z-index: 3;
  width: 44px;
  border: none;
  padding: 0;
  background: transparent;
  color: rgba(255, 255, 255, 0.92);
  font-size: 28px;
  line-height: 1;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.2s ease, background 0.2s ease;
}

.aip-preview-pane--ref:hover .aip-preview-ref-nav,
.aip-preview-ratio-box:hover .aip-preview-ref-nav,
.aip-preview-ref-nav:focus-visible {
  opacity: 1;
}

@media (hover: none) {
  .aip-preview-ref-nav {
    opacity: 0.55;
  }
}

.aip-preview-ref-nav:hover {
  background: rgba(15, 23, 42, 0.28);
}

.aip-preview-ref-nav[hidden] {
  display: none !important;
}

.aip-preview-ref-indicator {
  position: absolute;
  left: 50%;
  bottom: 10px;
  z-index: 3;
  transform: translateX(-50%);
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  color: #fff;
  background: rgba(15, 23, 42, 0.45);
  pointer-events: none;
}

.aip-preview-ref-indicator[hidden] {
  display: none !important;
}

.aip-preview-stage.is-generating .aip-preview-ref-nav,
.aip-preview-stage.is-generating .aip-preview-ref-indicator {
  display: none !important;
}

.aip-ref-thumb.is-active {
  border-color: #7c3aed;
  box-shadow: 0 0 0 2px rgba(124, 58, 237, 0.35);
}

.aip-preview-upload {
  transition:
    transform 0.35s cubic-bezier(0.34, 1.4, 0.64, 1),
    opacity 0.35s ease,
    box-shadow 0.35s ease;
}

.aip-preview-stage.is-preview-reset .aip-preview-upload {
  animation: aip-preview-upload-pop 0.48s cubic-bezier(0.34, 1.4, 0.64, 1);
}

@keyframes aip-preview-upload-pop {
  0% {
    opacity: 0;
    transform: scale(0.82);
  }
  60% {
    opacity: 1;
    transform: scale(1.04);
  }
  100% {
    opacity: 1;
    transform: scale(1);
  }
}

.aip-preview-loader {
  position: absolute;
  inset: 0;
  z-index: 4;
  pointer-events: none;
  border-radius: 16px;
}

.aip-preview-loader[hidden] {
  display: none !important;
}

/* 底部横向进度条 + 右侧百分比 */
.aip-gen-progress-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 12px 14px 14px;
  box-sizing: border-box;
  background: linear-gradient(180deg, transparent 0%, rgba(6, 10, 20, 0.88) 35%);
}

.aip-gen-progress__track {
  flex: 1;
  min-width: 0;
  height: 10px;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.08);
  overflow: hidden;
  box-shadow: inset 0 2px 6px rgba(0, 0, 0, 0.45);
}

.aip-gen-progress__fill {
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #0891b2, #22d3ee 35%, #4ade80 70%, #a3e635);
  background-size: 200% 100%;
  animation: aip-gen-progress-shine 1.1s ease-in-out infinite;
  transition: width 0.28s ease-out;
  box-shadow: 0 0 14px rgba(34, 211, 238, 0.5);
}

.aip-preview-stage.is-generating .aip-gen-progress__fill {
  transition: width 0.62s ease-out;
}

.aip-gen-progress__fill.is-slow {
  transition-duration: 0.78s;
}

.aip-gen-progress__pct {
  flex-shrink: 0;
  min-width: 3.2em;
  font-size: 15px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: #e0f2fe;
  text-align: right;
  text-shadow: 0 0 12px rgba(34, 211, 238, 0.45);
}

#preview-progress-value {
  font-size: 16px;
}

.aip-preview-stage.is-done-preview .aip-preview-loader {
  display: none !important;
}

.aip-preview-stage.is-done-preview .aip-preview-pane.has-image .aip-preview-pane-empty {
  display: none;
}

@keyframes aip-gen-progress-shine {
  0%,
  100% {
    background-position: 0% 50%;
  }
  50% {
    background-position: 100% 50%;
  }
}

.aip-preview-stage.is-generating .aip-preview-media {
  box-shadow:
    0 0 0 1px rgba(34, 211, 238, 0.2),
    0 0 32px rgba(74, 222, 128, 0.22),
    0 12px 40px rgba(8, 145, 178, 0.18);
}

.aip-preview-stage.is-generating .aip-preview-ratio-box {
  box-shadow: none;
  background: transparent;
}

@media (prefers-reduced-motion: reduce) {
  .aip-prompt-fly {
    transition: none;
  }

  #preview-prompt-slot {
    animation: none;
  }

  .aip-preview-ratio-wrap {
    transition: none;
  }

  .aip-gen-border__flow,
  .aip-gen-border__spark,
  .aip-gen-border__aura {
    animation: none;
  }

  .aip-gen-border__aura {
    opacity: 0.45;
  }

  .aip-gen-progress__fill {
    animation: none;
  }
}

/* ========== 主卡片（下移） ========== */
.aip-studio-card {
  background: #fff;
  border-radius: 24px;
  padding: 20px;
  box-shadow: 0 8px 40px rgba(124, 58, 237, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.9);
  margin-bottom: 24px;
}

.aip-studio-card--lower {
  margin-top: 4px;
}

.aip-prompt-box {
  position: relative;
  margin-bottom: 16px;
}

.aip-prompt-input {
  width: 100%;
  min-height: 120px;
  border: none;
  border-radius: 16px;
  background: #f3f4f6;
  padding: 16px 16px 32px;
  font-size: 15px;
  line-height: 1.6;
  color: #1f2329;
  resize: vertical;
  outline: none;
  transition: box-shadow 0.2s;
}

.aip-prompt-input:focus {
  box-shadow: 0 0 0 2px rgba(124, 58, 237, 0.25);
}

.aip-prompt-input::placeholder {
  color: #9ca3af;
}

.aip-prompt-count {
  position: absolute;
  right: 14px;
  bottom: 10px;
  font-size: 12px;
  color: #9ca3af;
}

/* ========== 参考图 ========== */
.aip-ref-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-bottom: 18px;
}

.aip-ref-add {
  width: 72px;
  height: 72px;
  border: 2px dashed #d1d5db;
  border-radius: 12px;
  background: #fafafa;
  color: #9ca3af;
  font-size: 28px;
  line-height: 1;
  cursor: pointer;
  transition: border-color 0.2s, color 0.2s;
}

.aip-ref-add:hover:not(:disabled) {
  border-color: #a78bfa;
  color: #7c3aed;
}

.aip-ref-add:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.aip-ref-add.aip-preview-upload {
  flex: 1;
  width: 100%;
  height: 100%;
  min-height: 0;
  border-radius: 16px;
  font-size: clamp(32px, 8vw, 48px);
  font-weight: 300;
  transition:
    border-color 0.2s,
    color 0.2s,
    background 0.2s;
}

.aip-ref-add.aip-preview-upload:hover:not(:disabled) {
  background: #f5f3ff;
}

.aip-ref-thumbs {
  display: flex;
  gap: 10px;
}

.aip-ref-thumb {
  position: relative;
  width: 72px;
  height: 72px;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid #e5e7eb;
}

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

.aip-ref-thumb button {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 20px;
  height: 20px;
  border: none;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.55);
  color: #fff;
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
}

.aip-ref-hint {
  flex: 1 1 100%;
  margin: 0;
  font-size: 12px;
  color: #9ca3af;
}

/* ========== 控制条 ========== */
.aip-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  margin-bottom: 20px;
}

.aip-ctrl-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border-radius: 12px;
  background: #f9fafb;
  border: 1px solid #e5e7eb;
  font-size: 13px;
  color: #374151;
}

.aip-ctrl-label {
  color: #9ca3af;
  font-size: 12px;
}

.aip-ctrl-dropdown {
  position: relative;
}

/* 比例选择器 */
.aip-ctrl-dropdown-ratio {
  padding: 0;
  border: none;
  background: transparent;
}

.aip-ctrl-dropdown-ratio .aip-ratio-trigger {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: 12px;
  background: #fff;
  border: 1px solid #e5e7eb;
  transition: background 0.2s, color 0.2s, border-color 0.2s;
}

.aip-ctrl-dropdown-ratio.is-open .aip-ratio-trigger {
  background: linear-gradient(180deg, #3d3550 0%, #1a1b2e 100%);
  border-color: #2a2438;
  color: #fff;
  box-shadow: 0 4px 16px rgba(26, 27, 46, 0.35);
}

.aip-ratio-trigger-label {
  font-size: 13px;
  font-weight: 500;
  color: #9ca3af;
}

.aip-ctrl-dropdown-ratio.is-open .aip-ratio-trigger-label {
  color: rgba(255, 255, 255, 0.75);
}

.aip-ratio-trigger-value {
  font-size: 13px;
  font-weight: 700;
  color: #6366f1;
}

.aip-ctrl-dropdown-ratio.is-open .aip-ratio-trigger-value {
  color: #a5b4fc;
}

.aip-ctrl-dropdown-ratio.is-open .aip-caret {
  color: rgba(255, 255, 255, 0.7);
}

.aip-dropdown-ratio-grid {
  min-width: 520px;
  max-width: min(92vw, 560px);
  background: #fff;
  border-radius: 14px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.14);
  border: 1px solid #e8eaed;
  padding: 12px;
}

.aip-ratio-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 8px;
}

.aip-ratio-option {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  min-height: 64px;
  padding: 10px 6px;
  border: none;
  border-radius: 10px;
  background: #f3f4f6;
  cursor: pointer;
  transition: background 0.15s;
}

.aip-ratio-option:hover:not(.is-active) {
  background: #e8eaed;
}

.aip-ratio-option.is-active {
  background: linear-gradient(180deg, #3d3550 0%, #1a1b2e 100%);
  cursor: default;
}

.aip-ratio-option-name {
  font-size: 14px;
  font-weight: 700;
  color: #1f2329;
  line-height: 1.2;
}

.aip-ratio-option.is-active .aip-ratio-option-name {
  color: #d4a574;
}

.aip-ratio-option-desc {
  font-size: 11px;
  color: #9ca3af;
  line-height: 1.2;
}

.aip-ratio-option.is-active .aip-ratio-option-desc {
  color: rgba(255, 255, 255, 0.75);
}

.aip-ctrl-trigger {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  border: none;
  background: transparent;
  font-weight: 600;
  color: #1f2329;
  cursor: pointer;
  padding: 0;
}

.aip-caret {
  font-size: 10px;
  color: #9ca3af;
  transition: transform 0.2s;
}

.aip-ctrl-dropdown.is-open .aip-caret {
  transform: rotate(180deg);
}

/* 模型选择器 */
.aip-ctrl-dropdown-model {
  padding: 0;
  border: none;
  background: transparent;
}

.aip-ctrl-dropdown-model .aip-model-trigger {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: 12px;
  background: #fff;
  border: 1px solid #e5e7eb;
  transition: background 0.2s, color 0.2s, border-color 0.2s;
}

.aip-ctrl-dropdown-model.is-open .aip-model-trigger {
  background: linear-gradient(180deg, #3d3550 0%, #1a1b2e 100%);
  border-color: #2a2438;
  color: #fff;
  box-shadow: 0 4px 16px rgba(26, 27, 46, 0.35);
}

.aip-model-icon {
  display: flex;
  color: #1f2329;
}

.aip-ctrl-dropdown-model.is-open .aip-model-icon {
  color: #fff;
}

.aip-model-trigger-label {
  font-size: 13px;
  font-weight: 500;
  color: #9ca3af;
}

.aip-ctrl-dropdown-model.is-open .aip-model-trigger-label {
  color: rgba(255, 255, 255, 0.75);
}

.aip-model-trigger-value {
  font-size: 13px;
  font-weight: 700;
  color: #1f2329;
}

.aip-ctrl-dropdown-model.is-open .aip-model-trigger-value {
  color: #d4a574;
}

.aip-ctrl-dropdown-model.is-open .aip-caret {
  color: rgba(255, 255, 255, 0.7);
}

.aip-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  z-index: 50;
}

.aip-dropdown-model {
  min-width: 220px;
  background: #fff;
  border-radius: 14px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.14);
  border: 1px solid #e8eaed;
  padding: 6px;
  overflow: hidden;
}

.aip-model-option {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  text-align: left;
  border: none;
  background: #f3f4f6;
  padding: 12px 14px;
  border-radius: 10px;
  cursor: pointer;
  transition: background 0.15s;
  margin-bottom: 4px;
}

.aip-model-option:last-child {
  margin-bottom: 0;
}

.aip-model-option.is-active {
  background: linear-gradient(180deg, #3d3550 0%, #1a1b2e 100%);
  cursor: default;
}

.aip-model-option.is-disabled {
  opacity: 1;
  cursor: not-allowed;
}

.aip-model-option-icon {
  flex-shrink: 0;
  display: flex;
  color: #6b7280;
}

.aip-model-option.is-active .aip-model-option-icon {
  color: #fff;
}

.aip-model-option-icon.is-sparkle {
  color: #c4c8cf;
}

.aip-model-option-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.aip-model-option-name {
  font-size: 14px;
  font-weight: 700;
  color: #6b7280;
}

.aip-model-option.is-active .aip-model-option-name {
  color: #d4a574;
}

.aip-model-option-desc {
  font-size: 11px;
  color: #9ca3af;
}

.aip-model-option.is-active .aip-model-option-desc {
  color: rgba(255, 255, 255, 0.85);
}

.aip-model-option.is-disabled .aip-model-option-name,
.aip-model-option.is-disabled .aip-model-option-desc {
  color: #b0b5bd;
}

.aip-gen-mode {
  display: flex;
  justify-content: center;
  width: fit-content;
  max-width: 100%;
  gap: 8px;
  margin: 0 auto 14px;
  padding: 4px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid rgba(124, 58, 237, 0.12);
  box-shadow: 0 4px 20px rgba(76, 29, 149, 0.06);
}

.aip-gen-mode-btn {
  border: none;
  background: transparent;
  color: #6b7280;
  font-size: 13px;
  font-weight: 600;
  padding: 8px 18px;
  border-radius: 999px;
  cursor: pointer;
  transition: background 0.2s, color 0.2s, box-shadow 0.2s;
}

.aip-gen-mode-btn.is-active {
  color: #5b21b6;
  background: linear-gradient(135deg, #ede9fe 0%, #fce7f3 100%);
  box-shadow: 0 2px 10px rgba(124, 58, 237, 0.15);
}

body.is-img2img-mode .aip-ref-hint,
body.is-img2img-mode .aip-preview-frame-hint {
  color: #7c3aed;
  font-weight: 500;
}

body.is-img2img-mode .aip-preview-pane--ref:not(.has-image) {
  box-shadow: inset 0 0 0 1px rgba(124, 58, 237, 0.22);
}

body.is-img2img-mode .aip-preview-pane--ref:not(.has-image) .aip-preview-upload {
  color: #7c3aed;
}

body.is-img2img-mode .aip-preview-pane--out:not(.has-image) {
  box-shadow: inset 0 0 0 1px rgba(236, 72, 153, 0.22);
}

body.is-img2img-mode .aip-preview-pane--out:not(.has-image) .aip-preview-upload--out {
  color: #db2777;
}

body.is-img2img-mode .aip-preview-out-placeholder {
  font-size: 12px;
  color: #9ca3af;
  margin-top: 6px;
}

.aip-ref-thumb-tag {
  position: absolute;
  left: 4px;
  bottom: 4px;
  padding: 1px 5px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 700;
  color: #fff;
  background: rgba(124, 58, 237, 0.85);
  pointer-events: none;
}

.aip-tier-pills {
  display: inline-flex;
  gap: 6px;
  align-items: center;
}

.aip-tier-pill {
  border: 1px solid #e5e7eb;
  background: #fff;
  width: 36px;
  height: 36px;
  padding: 0;
  border-radius: 50%;
  font-size: 12px;
  font-weight: 700;
  color: #6b7280;
  cursor: pointer;
  transition: all 0.2s;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.aip-tier-pill.is-active {
  background: linear-gradient(180deg, #3d3550 0%, #2a2438 100%);
  border-color: #2a2438;
  color: #fff;
  box-shadow: 0 4px 12px rgba(42, 36, 56, 0.3);
}

.aip-tier-pill.is-disabled,
.aip-tier-pill:disabled {
  opacity: 0.38;
  cursor: not-allowed;
  pointer-events: none;
  text-decoration: line-through;
}

.aip-ratio-option.is-disabled,
.aip-ratio-option:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  pointer-events: none;
  filter: grayscale(0.6);
}

.aip-ratio-option.is-disabled .aip-ratio-option-desc {
  color: #b91c1c;
  font-size: 11px;
}

.aip-ctrl-count-label {
  color: #6b7280;
  font-size: 12px;
  white-space: nowrap;
}

.aip-count-input {
  width: 64px;
  height: 32px;
  padding: 0 10px;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  background: #fff;
  font-size: 14px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: #1f2329;
  text-align: center;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.aip-count-input:hover {
  border-color: #c4b5fd;
}

.aip-count-input:focus {
  outline: none;
  border-color: #a78bfa;
  box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.15);
}

.aip-count-input::-webkit-outer-spin-button,
.aip-count-input::-webkit-inner-spin-button {
  opacity: 1;
}

/* ========== 生成按钮 ========== */
.aip-action-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.aip-price {
  font-size: 14px;
  color: #92400e;
}

.aip-price strong {
  font-size: 18px;
  color: #b45309;
}

.aip-generate-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: none;
  padding: 14px 28px;
  border-radius: 999px;
  background: linear-gradient(180deg, #4a4158 0%, #2a2438 100%);
  color: #fff;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 6px 20px rgba(42, 36, 56, 0.35);
  transition: transform 0.15s, opacity 0.2s;
}

.aip-generate-btn:hover:not(:disabled) {
  transform: translateY(-1px);
}

.aip-generate-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* ========== 底部 Tab ========== */
.aip-bottom-tabs {
  display: flex;
  gap: 24px;
  margin-bottom: 16px;
  border-bottom: 1px solid rgba(124, 58, 237, 0.12);
}

.aip-bottom-tab {
  border: none;
  background: transparent;
  padding: 10px 4px;
  font-size: 15px;
  font-weight: 600;
  color: #9ca3af;
  cursor: pointer;
  position: relative;
}

.aip-bottom-tab.is-active {
  color: #5b21b6;
}

.aip-bottom-tab.is-active::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  bottom: -1px;
  height: 2px;
  background: #7c3aed;
  border-radius: 2px;
}

.aip-template-empty {
  text-align: center;
  color: #9ca3af;
  padding: 32px;
  font-size: 14px;
}

.aip-task-filters {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
  padding: 4px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.65);
  border: 1px solid rgba(124, 58, 237, 0.1);
}

.aip-task-filter {
  flex: 1;
  border: none;
  background: transparent;
  color: #6b7280;
  font-size: 13px;
  font-weight: 600;
  padding: 8px 10px;
  border-radius: 999px;
  cursor: pointer;
  transition: background 0.2s, color 0.2s, box-shadow 0.2s;
  white-space: nowrap;
}

.aip-task-filter.is-active {
  color: #5b21b6;
  background: linear-gradient(135deg, #ede9fe 0%, #fce7f3 100%);
  box-shadow: 0 2px 8px rgba(124, 58, 237, 0.12);
}

.aip-task-empty {
  text-align: center;
  color: #9ca3af;
  font-size: 13px;
  padding: 24px 12px 8px;
  margin: 0;
}

.aip-task-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 12px;
}

.aip-task-card {
  border-radius: 12px;
  overflow: hidden;
  background: #fff;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
}

.aip-task-card img.aip-task-preview {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  display: block;
  cursor: pointer;
  transition: opacity 0.2s;
  -webkit-user-drag: none;
  user-select: none;
  -webkit-touch-callout: none;
}

.aip-task-card img.aip-task-preview:hover {
  opacity: 0.92;
}

.aip-task-card.is-failed {
  cursor: pointer;
  box-shadow: 0 2px 12px rgba(239, 68, 68, 0.12);
}

.aip-task-card.is-failed .meta {
  color: #b91c1c;
}

.aip-task-card .meta-prompt {
  color: #6b7280;
  font-size: 11px;
  margin-bottom: 2px;
}

.aip-task-card .meta-error {
  color: #b91c1c;
  font-size: 12px;
  line-height: 1.35;
  font-weight: 500;
}

.aip-task-failed {
  aspect-ratio: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: linear-gradient(145deg, #fef2f2 0%, #fee2e2 100%);
  color: #b91c1c;
  text-align: center;
  padding: 12px;
}

.aip-task-failed__icon {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  line-height: 1;
  font-weight: 700;
  background: rgba(239, 68, 68, 0.15);
}

.aip-task-failed__text {
  font-size: 13px;
  font-weight: 600;
}

.aip-task-placeholder {
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #f3f4f6;
  color: #9ca3af;
  font-size: 13px;
}

.aip-lightbox-failed {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  background: linear-gradient(160deg, #fef2f2 0%, #fff 55%);
  color: #991b1b;
  text-align: center;
  padding: 24px;
}

.aip-lightbox-failed__icon {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 36px;
  font-weight: 700;
  background: rgba(239, 68, 68, 0.12);
}

.aip-lightbox-failed__title {
  margin: 0;
  font-size: 18px;
  font-weight: 700;
}

.aip-lightbox-failed__msg {
  margin: 0;
  font-size: 14px;
  color: #b91c1c;
  max-width: 280px;
}

.aip-lightbox-preview {
  position: relative;
}

.aip-detail-kv .v.is-failed {
  color: #dc2626;
  font-weight: 600;
}

/* ========== 图片预览灯箱 + 详情侧栏 ========== */
body.aip-lightbox-open {
  overflow: hidden;
}

.aip-lightbox {
  position: fixed;
  inset: 0;
  z-index: 1000;
}

.aip-lightbox[hidden] {
  display: none !important;
}

.aip-lightbox-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(10, 12, 20, 0.88);
  backdrop-filter: blur(8px);
}

.aip-lightbox-panel {
  position: relative;
  z-index: 1;
  width: min(96vw, 1180px);
  height: min(92vh, 820px);
  margin: 4vh auto;
  display: flex;
  flex-direction: column;
  background: #12151f;
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.5);
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.aip-lightbox-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 18px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  flex-shrink: 0;
}

.aip-lightbox-topbar-left {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.aip-lightbox-title {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
  color: #f3f4f6;
  white-space: nowrap;
}

.aip-lightbox-tags {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.aip-lightbox-tag {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.08);
  color: #9ca3af;
}

.aip-lightbox-tag.is-tier {
  background: rgba(234, 179, 8, 0.2);
  color: #fbbf24;
}

.aip-lightbox-topbar-actions {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}

.aip-lightbox-action {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  border: none;
  background: transparent;
  color: #d1d5db;
  font-size: 13px;
  padding: 6px 10px;
  border-radius: 8px;
  cursor: pointer;
}

.aip-lightbox-action:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
}

.aip-lightbox-action.is-danger {
  color: #f87171;
}

.aip-lightbox-action.is-danger:hover {
  background: rgba(248, 113, 113, 0.12);
}

.aip-lightbox-action svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

.aip-lightbox-close {
  width: 36px;
  height: 36px;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: #9ca3af;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  margin-left: 4px;
}

.aip-lightbox-close:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
}

.aip-lightbox-body {
  flex: 1;
  min-height: 0;
  display: flex;
}

.aip-lightbox-preview {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(0, 0, 0, 0.25);
}

.aip-lightbox-img {
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
  border-radius: 8px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
  -webkit-user-drag: none;
  user-select: none;
  -webkit-touch-callout: none;
  touch-action: manipulation;
}

.aip-lightbox-detail {
  width: 320px;
  flex-shrink: 0;
  overflow-y: auto;
  padding: 16px 18px 20px;
  background: #161b28;
  border-left: 1px solid rgba(255, 255, 255, 0.06);
}

.aip-detail-section {
  margin-bottom: 18px;
}

.aip-detail-section h3 {
  margin: 0 0 10px;
  font-size: 13px;
  font-weight: 600;
  color: #9ca3af;
}

.aip-detail-prompt {
  margin: 0;
  padding: 12px 14px;
  background: rgba(0, 0, 0, 0.25);
  border-radius: 10px;
  font-size: 13px;
  line-height: 1.55;
  color: #e5e7eb;
  word-break: break-word;
  max-height: 120px;
  overflow-y: auto;
}

.aip-detail-prompt-actions {
  display: flex;
  gap: 8px;
  margin-top: 10px;
}

.aip-detail-btn {
  flex: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 12px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.04);
  color: #d1d5db;
  font-size: 13px;
  cursor: pointer;
}

.aip-detail-btn:hover {
  background: rgba(255, 255, 255, 0.08);
}

.aip-detail-btn.is-primary {
  border-color: rgba(99, 102, 241, 0.4);
  background: rgba(99, 102, 241, 0.15);
  color: #a5b4fc;
}

.aip-detail-kv {
  list-style: none;
  margin: 0;
  padding: 0;
}

.aip-detail-kv li {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  font-size: 13px;
}

.aip-detail-kv li:last-child {
  border-bottom: none;
}

.aip-detail-kv .k {
  color: #6b7280;
  flex-shrink: 0;
}

.aip-detail-kv .v {
  color: #f3f4f6;
  text-align: right;
  word-break: break-all;
}

.aip-detail-kv .v.is-link {
  color: #60a5fa;
}

.aip-detail-kv .v.is-cost {
  color: #fbbf24;
  font-weight: 600;
}

.aip-detail-card {
  background: rgba(0, 0, 0, 0.2);
  border-radius: 12px;
  padding: 4px 14px;
}

@media (max-width: 900px) {
  .aip-lightbox-panel {
    width: 100vw;
    height: 100vh;
    margin: 0;
    border-radius: 0;
  }

  .aip-lightbox-body {
    flex-direction: column;
  }

  .aip-lightbox-detail {
    width: 100%;
    max-height: 42vh;
    border-left: none;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
  }

  .aip-lightbox-topbar-actions .aip-lightbox-action span {
    display: none;
  }
}

.aip-task-card .meta {
  padding: 8px 10px;
  font-size: 12px;
  color: #6b7280;
}

/* Toast 提示 */
.aip-toast {
  position: fixed;
  bottom: 28px;
  left: 50%;
  z-index: 9999;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  max-width: min(92vw, 400px);
  padding: 14px 18px 14px 14px;
  border-radius: 16px;
  color: #fff;
  font-size: 14px;
  line-height: 1.45;
  pointer-events: none;
  opacity: 0;
  transform: translateX(-50%) translateY(16px) scale(0.96);
  transition:
    opacity 0.32s cubic-bezier(0.34, 1.2, 0.64, 1),
    transform 0.32s cubic-bezier(0.34, 1.2, 0.64, 1);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  box-shadow:
    0 12px 40px rgba(15, 23, 42, 0.28),
    0 0 0 1px rgba(255, 255, 255, 0.08) inset;
}

.aip-toast.is-visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0) scale(1);
}

.aip-toast.is-leaving {
  opacity: 0;
  transform: translateX(-50%) translateY(8px) scale(0.98);
  transition-duration: 0.28s;
}

.aip-toast--error {
  background: linear-gradient(135deg, rgba(127, 29, 29, 0.94) 0%, rgba(69, 10, 10, 0.92) 100%);
  border: 1px solid rgba(252, 165, 165, 0.35);
  box-shadow:
    0 12px 40px rgba(185, 28, 28, 0.35),
    0 0 24px rgba(239, 68, 68, 0.15),
    0 0 0 1px rgba(255, 255, 255, 0.06) inset;
}

.aip-toast--success {
  background: linear-gradient(135deg, rgba(6, 78, 59, 0.94) 0%, rgba(4, 47, 46, 0.92) 100%);
  border: 1px solid rgba(110, 231, 183, 0.35);
  box-shadow:
    0 12px 40px rgba(5, 150, 105, 0.3),
    0 0 20px rgba(52, 211, 153, 0.12),
    0 0 0 1px rgba(255, 255, 255, 0.06) inset;
}

.aip-toast--warn {
  background: linear-gradient(135deg, rgba(120, 53, 15, 0.94) 0%, rgba(69, 26, 3, 0.92) 100%);
  border: 1px solid rgba(253, 186, 116, 0.38);
  box-shadow:
    0 12px 40px rgba(180, 83, 9, 0.28),
    0 0 0 1px rgba(255, 255, 255, 0.06) inset;
}

.aip-toast--info {
  background: linear-gradient(135deg, rgba(49, 46, 129, 0.94) 0%, rgba(30, 27, 75, 0.92) 100%);
  border: 1px solid rgba(167, 139, 250, 0.35);
  box-shadow:
    0 12px 40px rgba(91, 33, 182, 0.28),
    0 0 0 1px rgba(255, 255, 255, 0.06) inset;
}

.aip-toast__icon {
  flex-shrink: 0;
  width: 22px;
  height: 22px;
  margin-top: 1px;
  opacity: 0.95;
}

.aip-toast__icon svg {
  display: block;
  width: 100%;
  height: 100%;
}

.aip-toast--error .aip-toast__icon {
  color: #fecaca;
}

.aip-toast--success .aip-toast__icon {
  color: #6ee7b7;
}

.aip-toast--warn .aip-toast__icon {
  color: #fcd34d;
}

.aip-toast--info .aip-toast__icon {
  color: #c4b5fd;
}

.aip-toast__body {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.aip-toast__title {
  font-weight: 600;
  font-size: 15px;
  letter-spacing: 0.02em;
}

.aip-toast__hint {
  font-size: 12px;
  font-weight: 400;
  opacity: 0.88;
  line-height: 1.5;
  color: rgba(255, 255, 255, 0.82);
}

@media (prefers-reduced-motion: reduce) {
  .aip-toast {
    transition: opacity 0.2s ease;
    transform: translateX(-50%);
  }

  .aip-toast.is-visible {
    transform: translateX(-50%);
  }
}

/* Mock 调试 · 参数校验弹窗 */
.aip-mock-debug-modal {
  position: fixed;
  inset: 0;
  z-index: 1100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.aip-mock-debug-modal[hidden] {
  display: none !important;
}

.aip-mock-debug-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 10, 30, 0.55);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

.aip-mock-debug-panel {
  position: relative;
  z-index: 1;
  width: min(100%, 420px);
  max-height: min(80vh, 520px);
  overflow: auto;
  background: #fff;
  border-radius: 18px;
  box-shadow: 0 20px 60px rgba(124, 58, 237, 0.25);
  border: 1px solid rgba(239, 68, 68, 0.25);
}

.aip-mock-debug-head {
  padding: 18px 20px 10px;
  border-bottom: 1px solid #fee2e2;
  background: linear-gradient(180deg, #fef2f2 0%, #fff 100%);
}

.aip-mock-debug-head h3 {
  margin: 0 0 6px;
  font-size: 17px;
  font-weight: 700;
  color: #b91c1c;
}

.aip-mock-debug-sub {
  margin: 0;
  font-size: 13px;
  color: #6b7280;
}

.aip-mock-debug-list {
  margin: 0;
  padding: 14px 20px;
  list-style: none;
}

.aip-mock-debug-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 10px 12px;
  margin-bottom: 8px;
  border-radius: 10px;
  background: #fef2f2;
  border: 1px solid #fecaca;
}

.aip-mock-debug-item:last-child {
  margin-bottom: 0;
}

.aip-mock-debug-label {
  font-size: 14px;
  font-weight: 700;
  color: #dc2626;
}

.aip-mock-debug-msg {
  font-size: 13px;
  color: #7f1d1d;
  line-height: 1.5;
}

.aip-mock-debug-foot {
  padding: 12px 20px 18px;
  display: flex;
  justify-content: flex-end;
}

.aip-mock-debug-close-btn {
  border: none;
  border-radius: 10px;
  padding: 10px 18px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  color: #fff;
  background: linear-gradient(180deg, #3d3550 0%, #2a2438 100%);
}

@media (max-width: 768px) {
  html,
  body,
  #root {
    touch-action: pan-x pan-y;
    overscroll-behavior-x: none;
  }

  #tab-mine,
  #tab-mine .aip-task-grid,
  .aip-lightbox,
  .aip-lightbox-preview {
    touch-action: pan-y;
  }

  .aip-header-inner {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 10px 12px;
    padding-top: max(10px, env(safe-area-inset-top));
  }

  .aip-studio-user {
    min-width: 0;
    flex: 0 1 auto;
  }

  .aip-studio-name {
    font-size: 13px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 28vw;
  }

  .aip-header-actions {
    flex: 1 1 auto;
    min-width: 0;
    justify-content: flex-end;
    flex-wrap: nowrap;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    gap: 6px;
    padding-bottom: 2px;
  }

  .aip-header-actions::-webkit-scrollbar {
    display: none;
  }

  .aip-studio-nav-btn,
  .aip-auth-guest-tag {
    flex-shrink: 0;
    padding: 7px 10px;
    font-size: 12px;
  }

  .aip-support-btn__icon,
  .aip-consumption-btn__icon {
    width: 14px;
    height: 14px;
  }

  .aip-studio-nav {
    justify-content: flex-start;
    overflow-x: auto;
    flex-wrap: nowrap;
  }

  .aip-studio-nav-btn {
    flex-shrink: 0;
  }

  .aip-app-content {
    padding: 14px 12px max(28px, env(safe-area-inset-bottom));
  }

  .aip-gen-mode {
    display: flex;
    width: 100%;
    max-width: 100%;
    margin-bottom: 12px;
  }

  .aip-gen-mode-btn {
    flex: 1;
    padding: 10px 8px;
  }

  .aip-hero {
    margin-bottom: 14px;
  }

  .aip-hero h1 {
    font-size: 20px;
    gap: 6px;
  }

  .aip-hero p {
    font-size: 13px;
  }

  .aip-mode-switch {
    width: 100%;
    max-width: 100%;
  }

  .aip-mode-btn {
    flex: 1;
    font-size: 13px;
    padding: 10px 8px;
  }

  .aip-preview-section {
    margin-bottom: 12px;
  }

  .aip-preview-media {
    border-radius: 14px;
  }

  .aip-preview-ratio-wrap {
    max-height: min(52vh, 420px);
  }

  .aip-preview-ratio-wrap.is-split {
    width: 100%;
    max-height: min(48vh, 360px);
  }

  .aip-preview-split.is-dual {
    flex-direction: row;
  }

  body.is-img2img-mode .aip-preview-frame {
    min-height: clamp(160px, 38vw, 240px);
  }

  .aip-preview-pane-label {
    font-size: 9px;
    top: 6px;
    left: 6px;
  }

  .aip-preview-out-placeholder {
    font-size: 11px;
  }

  .aip-preview-frame-hint {
    font-size: 11px;
    padding: 0 4px;
  }

  .aip-studio-card,
  .aip-studio-card--lower {
    padding: 14px 12px;
    border-radius: 16px;
  }

  .aip-prompt-input {
    min-height: 96px;
    font-size: 15px;
  }

  .aip-ref-hint {
    font-size: 11px;
  }

  .aip-controls {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    align-items: stretch;
    gap: 8px;
    margin-bottom: 14px;
  }

  .aip-ctrl-dropdown-ratio,
  .aip-ctrl-dropdown-model {
    width: auto;
    min-width: 0;
  }

  .aip-ctrl-dropdown-ratio .aip-ratio-trigger,
  .aip-ctrl-dropdown-model .aip-model-trigger {
    width: 100%;
    min-height: 34px;
    padding: 6px 10px;
    gap: 4px;
    justify-content: space-between;
    border-radius: 10px;
  }

  .aip-ratio-trigger-label,
  .aip-model-trigger-label {
    font-size: 11px;
    flex-shrink: 0;
  }

  .aip-ratio-trigger-value,
  .aip-model-trigger-value {
    font-size: 12px;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .aip-model-icon {
    flex-shrink: 0;
  }

  .aip-model-icon svg {
    width: 14px;
    height: 14px;
  }

  .aip-caret {
    font-size: 9px;
    flex-shrink: 0;
  }

  .aip-dropdown-ratio-grid {
    min-width: 0;
    width: min(calc(100vw - 24px), 560px);
    left: 50%;
    transform: translateX(-50%);
  }

  .aip-dropdown-ratio-grid,
  .aip-dropdown-model {
    max-height: min(60vh, 420px);
    overflow-y: auto;
  }

  .aip-ratio-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .aip-tier-pills {
    grid-column: 1 / -1;
    width: 100%;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 6px;
  }

  .aip-tier-pill {
    width: 100%;
    height: 32px;
    min-width: 0;
    padding: 0;
    border-radius: 10px;
    font-size: 11px;
  }

  .aip-ctrl-count {
    grid-column: 1 / -1;
    width: auto;
    justify-self: start;
    padding: 6px 10px;
    gap: 6px;
    border-radius: 10px;
    font-size: 12px;
  }

  .aip-ctrl-count-label {
    font-size: 11px;
  }

  .aip-count-input {
    width: 52px;
    height: 28px;
    padding: 0 6px;
    font-size: 13px;
    border-radius: 8px;
  }

  .aip-action-row {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
  }

  .aip-price {
    text-align: center;
    width: 100%;
  }

  .aip-generate-btn {
    width: 100%;
    justify-content: center;
    padding: 15px 20px;
  }

  .aip-task-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }

  .aip-bottom-tabs {
    gap: 16px;
    overflow-x: auto;
    flex-wrap: nowrap;
    -webkit-overflow-scrolling: touch;
  }

  .aip-task-filters {
    gap: 6px;
    margin-bottom: 10px;
  }

  .aip-task-filter {
    font-size: 12px;
    padding: 8px 6px;
  }

  .aip-auth-overlay,
  .aip-contact-overlay {
    padding: 12px;
    padding-bottom: max(12px, env(safe-area-inset-bottom));
    align-items: flex-end;
  }

  .aip-auth-panel {
    max-width: 100%;
    max-height: min(88vh, 640px);
    border-radius: 20px 20px 0 0;
  }

  .aip-contact-wrap {
    width: 100%;
    max-width: 100%;
  }

  .aip-contact-card {
    max-width: 100%;
  }

  .aip-auth-captcha-row {
    flex-wrap: wrap;
  }

  .aip-auth-captcha-row input {
    min-width: 0;
    flex: 1 1 120px;
  }

  .aip-mock-debug-panel {
    width: calc(100vw - 24px);
    max-width: 100%;
  }
}

@media (max-width: 380px) {
  .aip-task-grid {
    grid-template-columns: 1fr 1fr;
  }

  .aip-hero h1 {
    font-size: 18px;
  }

  .aip-ratio-trigger-label,
  .aip-model-trigger-label {
    display: none;
  }

  .aip-ctrl-dropdown-ratio .aip-ratio-trigger,
  .aip-ctrl-dropdown-model .aip-model-trigger {
    min-height: 32px;
    padding: 5px 8px;
  }

  .aip-tier-pill {
    height: 30px;
    font-size: 10px;
  }

  .aip-count-input {
    width: 46px;
    height: 26px;
    font-size: 12px;
  }
}

/* ========== 注册 / 登录弹窗 ========== */
.aip-header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}

.aip-support-btn {
  color: #0e7490;
  background: linear-gradient(180deg, #ecfeff 0%, #cffafe 100%);
  box-shadow: inset 0 0 0 1px rgba(6, 182, 212, 0.18);
  font-weight: 600;
}

.aip-support-btn:hover {
  filter: brightness(1.04);
  box-shadow: 0 2px 10px rgba(6, 182, 212, 0.18);
}

.aip-support-btn__icon {
  flex-shrink: 0;
}

.aip-consumption-btn {
  color: #92400e;
  background: linear-gradient(180deg, #fffbeb 0%, #fef3c7 100%);
  box-shadow: inset 0 0 0 1px rgba(245, 158, 11, 0.22);
  font-weight: 600;
}

.aip-consumption-btn:hover {
  filter: brightness(1.04);
  box-shadow: 0 2px 10px rgba(245, 158, 11, 0.2);
}

.aip-consumption-btn__icon {
  flex-shrink: 0;
}

.aip-auth-header-btn {
  background: linear-gradient(180deg, #ede9fe 0%, #e9d5ff 100%);
  color: #5b21b6;
  box-shadow: inset 0 0 0 1px rgba(124, 58, 237, 0.15);
  font-weight: 600;
}

.aip-auth-guest-tag {
  display: inline-flex;
  align-items: center;
  padding: 8px 14px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 600;
  color: #5b21b6;
  background: linear-gradient(180deg, #ede9fe 0%, #e9d5ff 100%);
  border: 1px solid rgba(124, 58, 237, 0.15);
  cursor: pointer;
  transition: box-shadow 0.2s, filter 0.2s;
}

.aip-auth-guest-tag:hover {
  filter: brightness(1.03);
  box-shadow: 0 2px 8px rgba(124, 58, 237, 0.12);
}

.aip-auth-guest-tag[hidden] {
  display: none !important;
}

.aip-auth-logout-btn {
  font-size: 13px;
  color: #8f959e;
}

.aip-auth-logout-btn[hidden] {
  display: none !important;
}

body.aip-auth-open,
body.aip-contact-open {
  overflow: hidden;
}

/* ========== 客服 / 充值联系卡弹窗 ========== */
.aip-contact-overlay {
  position: fixed;
  inset: 0;
  z-index: 520;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
}

.aip-contact-overlay[hidden] {
  display: none !important;
}

.aip-contact-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.42);
  backdrop-filter: blur(8px);
}

.aip-contact-wrap {
  position: relative;
  width: 100%;
  max-width: 320px;
  animation: aip-contact-in 0.38s cubic-bezier(0.22, 1, 0.36, 1);
}

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

.aip-contact-close {
  position: absolute;
  top: -8px;
  right: -8px;
  z-index: 3;
  width: 32px;
  height: 32px;
  border: none;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.95);
  color: #64748b;
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(15, 23, 42, 0.15);
}

.aip-contact-card {
  border-radius: 16px;
  overflow: hidden;
  background: #fff;
  box-shadow:
    0 24px 48px rgba(15, 23, 42, 0.14),
    0 8px 20px rgba(15, 23, 42, 0.08);
}

.aip-contact-card__cover {
  position: relative;
  height: 200px;
  background: linear-gradient(145deg, #9ca3af 0%, #6b7280 100%);
  overflow: hidden;
}

.aip-contact-card__cover-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.aip-contact-card__cover-img[hidden] {
  display: none !important;
}

.aip-contact-card__cover-fallback {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 45% 55% at 50% 38%, rgba(255, 255, 255, 0.35) 0%, transparent 70%),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 120 120'%3E%3Ccircle cx='60' cy='42' r='22' fill='rgba(255,255,255,0.45)'/%3E%3Cellipse cx='60' cy='98' rx='36' ry='22' fill='rgba(255,255,255,0.35)'/%3E%3C/svg%3E")
      center 42% / 42% no-repeat;
  opacity: 0.9;
}

.aip-contact-card__cover-fallback[hidden] {
  display: none !important;
}

.aip-contact-card__name {
  position: absolute;
  left: 16px;
  bottom: 14px;
  z-index: 2;
  font-size: 22px;
  font-weight: 700;
  color: #fff;
  text-shadow: 0 2px 12px rgba(0, 0, 0, 0.35);
  letter-spacing: 0.04em;
}

.aip-contact-card__body {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px 16px;
  min-height: 108px;
}

.aip-contact-card__store {
  font-size: 13px;
  color: #6b7280;
  font-weight: 500;
  max-width: 48%;
  line-height: 1.4;
}

.aip-contact-card__store:empty {
  display: none;
}

.aip-contact-card__qr-box {
  position: relative;
  flex-shrink: 0;
  width: 88px;
  height: 88px;
  border-radius: 8px;
  background: #f8fafc;
  border: 1px solid #e5e7eb;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.aip-contact-card__qr {
  width: 100%;
  height: 100%;
  object-fit: contain;
  padding: 4px;
  box-sizing: border-box;
}

.aip-contact-card__qr-placeholder {
  font-size: 11px;
  color: #9ca3af;
  text-align: center;
  padding: 8px;
  line-height: 1.35;
}

.aip-contact-card__hint {
  margin: 14px 0 0;
  text-align: center;
  font-size: 13px;
  color: #9ca3af;
  line-height: 1.5;
}

.aip-contact-card__footer {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin: 10px 0 0;
  font-size: 12px;
  color: #b0b8c4;
}

.aip-contact-card__footer svg {
  opacity: 0.75;
}

.aip-contact-card__extra {
  display: block;
  width: 100%;
  margin-top: 12px;
  padding: 10px;
  border: none;
  border-radius: 10px;
  background: linear-gradient(180deg, #ede9fe 0%, #e9d5ff 100%);
  color: #5b21b6;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}

.aip-contact-card__extra[hidden] {
  display: none !important;
}

.aip-auth-overlay {
  position: fixed;
  inset: 0;
  z-index: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.aip-auth-overlay[hidden] {
  display: none !important;
}

.aip-auth-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
  backdrop-filter: blur(6px);
}

.aip-auth-panel {
  position: relative;
  width: 100%;
  max-width: 420px;
  max-height: min(92vh, 640px);
  overflow-y: auto;
  margin: 0;
  padding: 24px 20px 20px;
  background: #fff;
  border-radius: 16px;
  box-shadow:
    0 24px 48px rgba(15, 23, 42, 0.14),
    0 8px 20px rgba(15, 23, 42, 0.08);
  animation: aip-auth-in 0.35s ease;
}

@keyframes aip-auth-in {
  from {
    opacity: 0;
    transform: translateY(12px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.aip-auth-close {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 32px;
  height: 32px;
  border: none;
  border-radius: 10px;
  background: #f3f4f6;
  color: #6b7280;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  z-index: 2;
}

.aip-auth-close:hover {
  background: #e5e7eb;
}

.aip-auth-hero {
  margin-bottom: 16px;
  padding-top: 8px;
}

.aip-auth-hero h2 {
  font-size: 22px;
  margin: 0 0 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  color: #5b21b6;
}

.aip-auth-tabs-wrap {
  margin-bottom: 8px;
}

.aip-auth-tabs {
  margin-bottom: 0;
}

.aip-auth-tab-panels {
  margin-top: 20px;
  min-height: 200px;
}

.aip-auth-tab-panel[hidden] {
  display: none !important;
}

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

.aip-auth-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.aip-auth-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.aip-auth-field span {
  font-size: 13px;
  font-weight: 600;
  color: #646a73;
}

.aip-auth-field input {
  width: 100%;
  border: none;
  border-radius: 12px;
  background: #f3f4f6;
  padding: 12px 14px;
  font-size: 14px;
  outline: none;
  transition: box-shadow 0.2s;
}

.aip-auth-captcha-row {
  display: flex;
  align-items: stretch;
  gap: 10px;
}

.aip-auth-captcha-row input {
  flex: 1;
  min-width: 0;
  letter-spacing: 0.2em;
  font-variant-numeric: tabular-nums;
}

.aip-auth-captcha-img-btn {
  flex-shrink: 0;
  padding: 0;
  border: none;
  border-radius: 10px;
  background: #e5e7eb;
  cursor: pointer;
  overflow: hidden;
  line-height: 0;
  transition: box-shadow 0.2s;
}

.aip-auth-captcha-img-btn:hover {
  box-shadow: 0 0 0 2px rgba(124, 58, 237, 0.35);
}

.aip-auth-captcha-img-btn img {
  display: block;
  width: 120px;
  height: 44px;
}

.aip-auth-field input:focus {
  box-shadow: 0 0 0 2px rgba(124, 58, 237, 0.25);
}

.aip-auth-err {
  margin: 0;
  padding: 10px 12px;
  border-radius: 10px;
  background: #fef2f2;
  border: 1px solid #fecaca;
  color: #b91c1c;
  font-size: 13px;
}

.aip-auth-err[hidden] {
  display: none !important;
}

.aip-auth-submit {
  width: 100%;
  justify-content: center;
  margin-top: 4px;
}

.aip-auth-guest {
  margin: 16px 0 0;
  text-align: center;
}

.aip-auth-guest-link {
  border: none;
  background: none;
  color: #7c3aed;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.aip-auth-guest-link:hover {
  color: #5b21b6;
}

/* 注册 / 登录弹窗：更紧凑、不透明 */
#auth-modal .aip-auth-backdrop {
  background: #52525b;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}

#auth-modal .aip-auth-panel {
  max-width: 340px;
  padding: 18px 16px 16px;
  background: #ffffff;
  border: 1px solid #e5e7eb;
  box-shadow: 0 16px 40px rgba(15, 23, 42, 0.2);
}

#auth-modal .aip-auth-hero {
  margin-bottom: 12px;
  padding-top: 4px;
}

#auth-modal .aip-auth-hero h2 {
  font-size: 18px;
  margin: 0 0 6px;
}

#auth-modal #auth-modal-subtitle {
  font-size: 12px;
  line-height: 1.45;
  color: #6b7280;
}

#auth-modal .aip-auth-tabs-wrap {
  margin-bottom: 4px;
}

#auth-modal .aip-auth-tab-panels {
  margin-top: 14px;
  min-height: 0;
}

#auth-modal .aip-auth-form {
  gap: 10px;
}

#auth-modal .aip-auth-field span {
  font-size: 12px;
}

#auth-modal .aip-auth-field input {
  padding: 10px 12px;
  font-size: 14px;
  border-radius: 10px;
  background: #f4f4f5;
}

#auth-modal .aip-auth-submit {
  margin-top: 2px;
  padding: 11px 16px;
  font-size: 14px;
}

#auth-modal .aip-auth-close {
  top: 10px;
  right: 10px;
  width: 28px;
  height: 28px;
  font-size: 20px;
}

@media (max-width: 768px) {
  #auth-modal.aip-auth-overlay {
    align-items: center;
    padding: 16px;
    padding-bottom: max(16px, env(safe-area-inset-bottom));
  }

  #auth-modal .aip-auth-panel {
    max-width: min(340px, calc(100vw - 32px));
    border-radius: 14px;
    max-height: min(85vh, 520px);
  }
}

.aip-balance-clickable {
  cursor: pointer;
  transition: color 0.2s ease;
}

.aip-balance-clickable:hover {
  color: #7c3aed;
}

.aip-credits-overlay .aip-credits-panel {
  max-width: 520px;
  width: calc(100% - 32px);
}

.aip-credits-balance {
  margin: 8px 0 0;
  font-size: 15px;
  font-weight: 600;
  color: #5b21b6;
}

.aip-credits-table-wrap {
  max-height: 320px;
  overflow: auto;
  margin-top: 16px;
  border-radius: 12px;
  border: 1px solid rgba(124, 58, 237, 0.12);
}

.aip-credits-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.aip-credits-table th,
.aip-credits-table td {
  padding: 10px 12px;
  text-align: left;
  border-bottom: 1px solid rgba(124, 58, 237, 0.08);
}

.aip-credits-table th {
  position: sticky;
  top: 0;
  background: #faf5ff;
  font-weight: 600;
  color: #646a73;
}

.aip-credits-table tr:last-child td {
  border-bottom: none;
}

.aip-credits-empty {
  text-align: center;
  color: #9ca3af;
  padding: 24px !important;
}

.aip-credits-amt-plus {
  color: #059669;
  font-weight: 600;
}

.aip-credits-amt-minus {
  color: #dc2626;
  font-weight: 600;
}

.aip-credits-hint {
  margin: 16px 0 0;
  font-size: 12px;
  color: #9ca3af;
  text-align: center;
}
