/* 华溯 Stitch UI — White Card Utility (light/dark) */
:root, html[data-theme="light"] {
  --hs-bg: #f6f7fa;
  --hs-surface: #ffffff;
  --hs-surface-low: #f1f3f6;
  --hs-surface-high: #e7e8ea;
  --hs-border: #d5d8e4;
  --hs-border-soft: #e6e7ec;
  --hs-text: #191c1e;
  --hs-text-secondary: #434654;
  --hs-text-muted: #737686;
  --hs-primary: #0052d9;
  --hs-primary-dark: #003da6;
  --hs-primary-soft: rgba(0, 82, 217, 0.08);
  --hs-primary-grad: linear-gradient(135deg, #0b63f6, #0046c0);
  --hs-success: #2da44e;
  --hs-warning: #d97706;
  --hs-error: #ba1a1a;
  --hs-shadow: 0 1px 2px rgba(25, 28, 30, 0.05), 0 4px 16px rgba(25, 28, 30, 0.05);
  --hs-shadow-lift: 0 2px 6px rgba(25, 28, 30, 0.07), 0 10px 28px rgba(25, 28, 30, 0.09);
  --hs-header-h: 56px;
  --hs-sidebar-w: 200px;
  --hs-sidebar-w-collapsed: 0px;
  --hs-bottom-nav-h: 64px;
  --hs-beian-h: 1.625rem;
  --hs-radius: 10px;
  --hs-radius-lg: 14px;
  --hs-modal-overlay: rgba(23, 26, 32, 0.5);
}

html[data-theme="dark"] {
  --hs-bg: #0c1016;
  --hs-surface: #151b23;
  --hs-surface-low: #1b222b;
  --hs-surface-high: #222a35;
  --hs-border: #2e3a47;
  --hs-border-soft: #202834;
  --hs-text: #e8eef5;
  --hs-text-secondary: #94a1b0;
  --hs-text-muted: #6f7b88;
  --hs-primary: #4a97ff;
  --hs-primary-dark: #6cabff;
  --hs-primary-soft: rgba(74, 151, 255, 0.14);
  --hs-primary-grad: linear-gradient(135deg, #58a2ff, #2f7bee);
  --hs-success: #3fb950;
  --hs-warning: #d29922;
  --hs-error: #f85149;
  --hs-shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 6px 20px rgba(0, 0, 0, 0.35);
  --hs-shadow-lift: 0 4px 12px rgba(0, 0, 0, 0.4), 0 14px 40px rgba(0, 0, 0, 0.45);
  --hs-modal-overlay: rgba(2, 4, 8, 0.68);
}

html { color-scheme: light; }
html[data-theme="dark"] { color-scheme: dark; }

.stitch-app {
  background: var(--hs-bg) !important;
  color: var(--hs-text) !important;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
  min-height: 100dvh;
  position: relative;
}

/* 背景氛围光斑：柔化纯色背景，提升高级感（不影响布局与交互） */
.stitch-app::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background:
    radial-gradient(560px circle at 8% -6%, color-mix(in srgb, var(--hs-primary) 14%, transparent), transparent 60%),
    radial-gradient(620px circle at 108% 12%, color-mix(in srgb, var(--hs-primary) 9%, transparent), transparent 55%);
}
.stitch-shell, .stitch-header, .stitch-bottom-nav, .hs-site-beian-footer { position: relative; z-index: 1; }

.stitch-app ::-webkit-scrollbar { width: 6px; height: 6px; }
.stitch-app ::-webkit-scrollbar-thumb { background: var(--hs-border); border-radius: 99px; }

/* Layout */
.stitch-shell { display: flex; flex: 1; min-height: 0; width: 100%; }
.stitch-app-main {
  flex: 1; min-width: 0; display: flex; flex-direction: column;
  width: 100%;
}
@media (min-width: 1024px) {
  .stitch-app-main { margin-left: var(--hs-sidebar-w); }
}

.stitch-sidebar {
  display: none;
  position: fixed; left: 0; top: 0; bottom: 0; width: var(--hs-sidebar-w);
  background: var(--hs-surface); border-right: 1px solid var(--hs-border);
  flex-direction: column; z-index: 45; padding: 12px 0;
  transition: width 0.2s ease;
  overflow: hidden;
}
@media (min-width: 1024px) {
  .stitch-sidebar { display: flex; }
}

.stitch-sidebar-brand {
  width: 100%;
  box-sizing: border-box;
  padding: 12px 10px 16px 14px;
  font-weight: 700;
  font-size: 15px;
  border-bottom: 1px solid var(--hs-border-soft);
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--hs-text);
  min-height: 56px;
}
.stitch-sidebar-brand-text {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.stitch-nav-label {
  overflow: hidden;
  white-space: nowrap;
}

/* 侧栏品牌最右侧：仅图标开关 */
.stitch-sidebar-toggle {
  width: 32px;
  height: 32px;
  flex: 0 0 auto;
  margin-left: auto; /* 顶到这一块最右边 */
  display: none;
  place-items: center;
  border: 1px solid var(--hs-border);
  border-radius: 10px;
  background: var(--hs-surface-low);
  color: var(--hs-text-secondary);
  cursor: pointer;
}
.stitch-sidebar-toggle:hover {
  color: var(--hs-text);
  border-color: color-mix(in srgb, var(--hs-primary) 45%, transparent);
  background: color-mix(in srgb, var(--hs-primary) 16%, var(--hs-surface-low));
}
@media (min-width: 1024px) {
  .stitch-sidebar-toggle { display: grid; }
}

/* 收起 = 仅图标轨，文字全部隐藏 */
@media (min-width: 1024px) {
  html.hs-sidebar-collapsed {
    --hs-sidebar-w: 72px !important;
  }
  html.hs-sidebar-collapsed #desktopSidebar,
  html.hs-sidebar-collapsed .stitch-sidebar {
    width: 72px !important;
    min-width: 72px !important;
    max-width: 72px !important;
    overflow: hidden !important;
    transform: none !important;
    opacity: 1 !important;
    visibility: visible !important;
    pointer-events: auto !important;
    display: flex !important;
  }
  html.hs-sidebar-collapsed .stitch-sidebar-brand {
    justify-content: center;
    padding: 12px 8px 14px;
    gap: 0;
  }
  html.hs-sidebar-collapsed .stitch-sidebar-brand-text,
  html.hs-sidebar-collapsed .stitch-nav-label {
    display: none !important;
    width: 0 !important;
    height: 0 !important;
    overflow: hidden !important;
    opacity: 0 !important;
  }
  html.hs-sidebar-collapsed .stitch-sidebar-brand .logo {
    display: none !important;
  }
  html.hs-sidebar-collapsed .stitch-sidebar-toggle {
    margin: 0 auto;
  }
  html.hs-sidebar-collapsed .stitch-nav-item {
    justify-content: center;
    padding-left: 0;
    padding-right: 0;
    margin-left: 8px;
    margin-right: 8px;
    width: calc(100% - 16px);
    gap: 0;
  }
  html.hs-sidebar-collapsed .stitch-nav-item svg,
  html.hs-sidebar-collapsed .stitch-nav-item i {
    margin: 0;
  }
  html.hs-sidebar-collapsed .stitch-app-main {
    margin-left: 72px !important;
  }
  html.hs-sidebar-collapsed .hs-site-beian-footer {
    left: 72px !important;
  }

  /* 工作站打开：侧栏完全让开 */
  body.hs-studio-open #desktopSidebar,
  body.hs-studio-open .stitch-sidebar {
    transform: translateX(-110%) !important;
    width: 0 !important;
    min-width: 0 !important;
    opacity: 0 !important;
    pointer-events: none !important;
    visibility: hidden !important;
  }
  body.hs-studio-open .stitch-app-main {
    margin-left: 0 !important;
  }
  body.hs-studio-open .hs-site-beian-footer {
    left: 0 !important;
  }
}
.stitch-sidebar-brand .logo {
  width: 28px; height: 28px; border-radius: 8px; background: var(--hs-primary-grad, var(--hs-primary));
  display: grid; place-items: center; color: #fff; font-size: 11px; font-weight: 800;
  box-shadow: 0 2px 6px rgba(0, 82, 217, 0.35);
}

.stitch-nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 14px; margin: 2px 8px; border-radius: var(--hs-radius);
  border: none; background: none; color: var(--hs-text-secondary);
  font-size: 13px; cursor: pointer; text-align: left; width: calc(100% - 16px);
  position: relative;
  transition: background 0.18s, color 0.18s, transform 0.18s;
}
.stitch-nav-item:hover { background: var(--hs-surface-low); color: var(--hs-text); }
.stitch-nav-item:active { transform: scale(0.98); }
.stitch-nav-item.active { background: var(--hs-primary-soft); color: var(--hs-primary); font-weight: 600; }
.stitch-nav-item.active::before {
  content: '';
  position: absolute; left: -8px; top: 20%; bottom: 20%;
  width: 3px; border-radius: 0 3px 3px 0;
  background: var(--hs-primary);
}
.stitch-nav-item svg { width: 18px; height: 18px; flex-shrink: 0; }

.stitch-sidebar-foot {
  margin-top: auto; padding: 12px 8px; border-top: 1px solid var(--hs-border-soft);
}

.stitch-bottom-nav {
  position: fixed; left: 0; right: 0; z-index: 50;
  bottom: calc(var(--hs-beian-h) + env(safe-area-inset-bottom, 0px));
  height: calc(var(--hs-bottom-nav-h) + env(safe-area-inset-bottom, 0px));
  padding-bottom: env(safe-area-inset-bottom, 0px);
  background: var(--hs-surface); border-top: 1px solid var(--hs-border);
  box-shadow: 0 -4px 16px rgba(0, 0, 0, 0.06);
  display: flex; align-items: stretch;
}
@media (min-width: 1024px) {
  .stitch-bottom-nav { display: none !important; }
}

/* 手机：焚决不盖住底栏，方便直接切到创作/历史/模型/我的 */
@media (max-width: 1023px) {
  .hs-color-guide-modal {
    z-index: 45 !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: calc(var(--hs-bottom-nav-h) + var(--hs-beian-h) + env(safe-area-inset-bottom, 0px)) !important;
    padding: 0.5rem !important;
  }
  .hs-color-guide-modal .hs-color-guide-panel {
    height: 100% !important;
    max-height: none !important;
    border-radius: 1rem !important;
  }
  .stitch-bottom-nav {
    z-index: 60;
  }
}

.stitch-tab {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 2px; border: none; background: none; color: var(--hs-text-muted);
  font-size: 10px; padding: 6px 4px; cursor: pointer;
  position: relative;
  transition: color 0.18s, transform 0.12s;
}
.stitch-tab:active { transform: scale(0.94); }
.stitch-tab svg { width: 20px; height: 20px; transition: transform 0.18s; }
.stitch-tab.active { color: var(--hs-primary); font-weight: 600; }
.stitch-tab.active svg { transform: translateY(-1px); }
.stitch-tab.active::before {
  content: '';
  position: absolute; top: 0; left: 50%; transform: translateX(-50%);
  width: 28px; height: 3px; border-radius: 0 0 3px 3px;
  background: var(--hs-primary);
}

/* Header */
.stitch-header {
  position: sticky; top: 0; z-index: 40;
  background: color-mix(in srgb, var(--hs-surface) 88%, transparent) !important;
  border-bottom: 1px solid var(--hs-border) !important;
  box-shadow: none !important;
  backdrop-filter: blur(10px) saturate(1.4) !important;
  -webkit-backdrop-filter: blur(10px) saturate(1.4) !important;
  padding: 12px 16px !important;
  min-height: var(--hs-header-h);
}
.stitch-header h1 { color: var(--hs-text) !important; letter-spacing: 0.02em !important; }
.stitch-header .header-logo {
  width: 32px; height: 32px; border-radius: 8px; background: var(--hs-primary-grad, var(--hs-primary)) !important;
  box-shadow: 0 2px 8px rgba(0, 82, 217, 0.3) !important;
}

.stitch-chip {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 6px 12px; border-radius: 999px; font-size: 12px;
  border: 1px solid var(--hs-border); background: var(--hs-surface);
  color: var(--hs-text-secondary); cursor: pointer;
  transition: border-color 0.18s, color 0.18s, background 0.18s, box-shadow 0.18s, transform 0.12s;
  white-space: nowrap;
}
.stitch-chip:hover {
  border-color: var(--hs-primary); color: var(--hs-primary); background: var(--hs-primary-soft);
  box-shadow: 0 2px 8px rgba(0, 82, 217, 0.12);
}
.stitch-chip:active { transform: scale(0.97); }
.stitch-chip-pro {
  font-size: 10px; font-weight: 700; text-transform: uppercase;
  color: var(--hs-warning); background: rgba(217, 119, 6, 0.1);
  border-color: rgba(217, 119, 6, 0.35); padding: 4px 8px;
}

/* Pro 标识：与风格按钮同高对齐 */
.hs-pro-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  flex-shrink: 0;
  height: 36px;
  min-height: 36px;
  padding: 0 12px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.06em;
  line-height: 1;
  color: #fbbf24 !important;
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.32), rgba(180, 83, 9, 0.22));
  border: 1px solid rgba(251, 191, 36, 0.65);
  box-shadow: 0 0 0 1px rgba(251, 191, 36, 0.12), 0 0 14px rgba(245, 158, 11, 0.28);
  white-space: nowrap;
  vertical-align: middle;
  box-sizing: border-box;
}
.hs-pro-badge svg { width: 14px; height: 14px; flex-shrink: 0; }
.hs-pro-badge.hidden { display: none !important; }
.stitch-chip-logout { color: var(--hs-error) !important; border-color: rgba(186, 26, 26, 0.3) !important; }
.stitch-chip-logout:hover { background: rgba(186, 26, 26, 0.08) !important; color: var(--hs-error) !important; }

.stitch-theme-btn {
  width: 36px; height: 36px; border-radius: 999px; border: 1px solid var(--hs-border);
  background: var(--hs-surface-low); color: var(--hs-text-secondary);
  display: grid; place-items: center; cursor: pointer;
  transition: border-color 0.18s, color 0.18s, transform 0.35s;
}
.stitch-theme-btn:hover { border-color: var(--hs-primary); color: var(--hs-primary); transform: rotate(20deg); }

.stitch-balance-pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 12px; border-radius: 999px;
  border: 1px solid rgba(0, 82, 217, 0.25); background: var(--hs-primary-soft);
  font-size: 12px; font-weight: 700; color: var(--hs-primary);
  font-variant-numeric: tabular-nums;
  transition: box-shadow 0.2s;
}
.stitch-balance-pill:hover { box-shadow: 0 0 0 3px color-mix(in srgb, var(--hs-primary) 12%, transparent); }
html[data-theme="dark"] .stitch-balance-pill {
  border-color: rgba(74, 151, 255, 0.3);
}

/* Cards & glass replacement */
.stitch-app .tech-glass {
  background: var(--hs-surface) !important;
  border: 1px solid var(--hs-border) !important;
  box-shadow: var(--hs-shadow) !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
  border-radius: var(--hs-radius-lg) !important;
  transition: box-shadow 0.25s, border-color 0.25s, transform 0.25s;
}

.stitch-app .text-gradient {
  background: none !important;
  -webkit-text-fill-color: var(--hs-primary) !important;
  color: var(--hs-primary) !important;
}

.stitch-app .glow-border::before { display: none !important; }
.stitch-app .glow-border {
  background: var(--hs-primary) !important;
  border: none !important;
  box-shadow: var(--hs-shadow) !important;
}
.stitch-app .glow-border:hover { opacity: 0.92; }

/* Panels */
.stitch-panel-hero { text-align: center; padding: 32px 16px 16px; }
.stitch-panel-hero h2 {
  font-size: 1.75rem; font-weight: 800; color: var(--hs-text); margin-bottom: 8px;
  letter-spacing: -0.01em;
}
.stitch-panel-hero p { font-size: 14px; color: var(--hs-text-secondary); }
.stitch-tool-btn {
  background: var(--hs-surface) !important;
  border: 1px solid var(--hs-border) !important;
  border-radius: var(--hs-radius-lg) !important;
  box-shadow: var(--hs-shadow) !important;
  transition: border-color 0.2s, box-shadow 0.2s, transform 0.2s !important;
}
.stitch-tool-btn:hover {
  border-color: var(--hs-primary) !important;
  box-shadow: var(--hs-shadow-lift, var(--hs-shadow)) !important;
  transform: translateY(-2px);
}
.stitch-tool-btn:active { transform: translateY(0); }

.stitch-footer-bar {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 30;
  background: var(--hs-surface) !important;
  border-top: 1px solid var(--hs-border) !important;
  backdrop-filter: none !important;
  padding-bottom: env(safe-area-inset-bottom, 0px);
}

/* 工信部备案悬挂 — 屏幕最底；移动端底部导航在其上方 */
.hs-site-beian-footer {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 35;
  text-align: center;
  padding: 0.3rem 0.75rem;
  padding-bottom: max(0.3rem, env(safe-area-inset-bottom, 0px));
  background: var(--hs-surface-low, var(--hs-surface));
  border-top: 1px solid var(--hs-border);
  font-size: 10px;
  line-height: 1.35;
  color: var(--hs-text-secondary);
  transition: opacity 0.15s ease, visibility 0.15s ease;
}
html.hs-hide-beian-footer .hs-site-beian-footer {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}
.hs-site-beian-line {
  margin: 0;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0.25rem 0.35rem;
}
.hs-site-beian-footer a {
  color: var(--hs-text-secondary);
  text-decoration: none;
}
.hs-site-beian-footer a:hover {
  color: var(--hs-primary);
  text-decoration: underline;
}
.hs-beian-sep { opacity: 0.45; user-select: none; }
.hs-site-beian-copy { opacity: 0.85; }

@media (max-width: 1023px) {
  .stitch-footer-bar { bottom: calc(var(--hs-bottom-nav-h) + var(--hs-beian-h) + env(safe-area-inset-bottom, 0px)); }
  #mainSystemPanel .stitch-home-main {
    padding-bottom: calc(8.5rem + var(--hs-bottom-nav-h) + var(--hs-beian-h) + env(safe-area-inset-bottom, 0px)) !important;
  }
  #genHistoryPanel main,
  #modelPlazaPanel main {
    padding-bottom: calc(4rem + var(--hs-bottom-nav-h) + var(--hs-beian-h)) !important;
  }
  #authPanel { padding-bottom: calc(2rem + var(--hs-bottom-nav-h) + var(--hs-beian-h)); }
}

@media (min-width: 1024px) {
  .hs-site-beian-footer { left: var(--hs-sidebar-w, 240px); }
  .stitch-footer-bar { bottom: var(--hs-beian-h); }
  #mainSystemPanel .stitch-home-main,
  #genHistoryPanel main,
  #modelPlazaPanel main { padding-bottom: calc(6rem + var(--hs-beian-h)) !important; }
}

@media (max-width: 1023px) {
  #appGrid .stitch-app-card-cover { height: 9.5rem; }
}

.stitch-btn-primary {
  background: var(--hs-primary-grad, var(--hs-primary)) !important;
  color: #fff !important;
  border: none !important;
  border-radius: var(--hs-radius) !important;
  box-shadow: 0 4px 14px color-mix(in srgb, var(--hs-primary) 35%, transparent) !important;
  transition: box-shadow 0.2s, transform 0.15s, opacity 0.2s;
}
.stitch-btn-primary:hover { opacity: 0.94; box-shadow: 0 6px 20px color-mix(in srgb, var(--hs-primary) 45%, transparent) !important; }
.stitch-btn-primary:active { transform: scale(0.98); }

.stitch-btn-success {
  background: linear-gradient(135deg, color-mix(in srgb, var(--hs-success) 118%, white 0%), var(--hs-success)) !important;
  color: #fff !important;
  border: none !important;
  box-shadow: 0 4px 14px color-mix(in srgb, var(--hs-success) 30%, transparent) !important;
  transition: box-shadow 0.2s, opacity 0.2s, transform 0.15s;
}
.stitch-btn-success:hover { opacity: 0.94; }
.stitch-btn-success:active { transform: scale(0.98); }

.stitch-btn-outline {
  background: var(--hs-surface) !important;
  border: 1px solid var(--hs-border) !important;
  color: var(--hs-text) !important;
  transition: border-color 0.18s, background 0.18s, transform 0.15s;
}
.stitch-btn-outline:not(:disabled):hover { border-color: var(--hs-primary) !important; }
.stitch-btn-outline:not(:disabled):active { transform: scale(0.98); }

/* Auth */
.stitch-auth-card { max-width: 420px; width: 100%; padding: 32px !important; }
.stitch-auth-card h2 { color: var(--hs-text) !important; }
.stitch-auth-card input {
  background: var(--hs-surface-low) !important;
  border: 1px solid var(--hs-border) !important;
  color: var(--hs-text) !important;
  border-radius: var(--hs-radius) !important;
  transition: border-color 0.18s, box-shadow 0.18s;
}
.stitch-auth-card input:focus { border-color: var(--hs-primary) !important; outline: none; box-shadow: 0 0 0 3px var(--hs-primary-soft); }

/* Modals */
.stitch-app #termsModal,
.stitch-app #rechargeModal,
.stitch-app #proSubModal,
.stitch-app #profileModal,
.stitch-app #creatorStudioModal,
.stitch-app #promptModal,
.stitch-app #imageToPromptModal,
.stitch-app #videoClipModal,
.stitch-app #gptImageModal,
.stitch-app #adminWithdrawModal,
.stitch-app #genHistoryPreviewModal {
  background: var(--hs-modal-overlay) !important;
  backdrop-filter: none !important;
}

.stitch-app #rechargeModal .recharge-modal-panel,
.stitch-app #proSubModal > div,
.stitch-app #profileModal > div,
.stitch-app #termsModal > div,
.stitch-app #imageToPromptModal > div,
.stitch-app #videoClipModal > div {
  background: var(--hs-surface) !important;
  border: 1px solid var(--hs-border) !important;
  color: var(--hs-text) !important;
  border-radius: var(--hs-radius-lg) !important;
  box-shadow: var(--hs-shadow-lift, var(--hs-shadow)) !important;
}

/* 手机端弹窗：避免超出视口、底部被挡 */
.stitch-app #imageToPromptModal,
.stitch-app #videoClipModal {
  padding-bottom: max(0.75rem, env(safe-area-inset-bottom));
}
.stitch-app #imageToPromptModal > div,
.stitch-app #videoClipModal > div {
  -webkit-overflow-scrolling: touch;
}
.stitch-app #gptImageModal .max-h-\[420px\] {
  max-height: min(420px, 38vh);
}
@media (min-width: 640px) {
  .stitch-app #gptImageModal .max-h-\[420px\] {
    max-height: 420px;
  }
}
.stitch-app .pkg-inactive {
  border-color: var(--hs-border) !important;
  background: var(--hs-surface) !important;
}
.stitch-app .pkg-active {
  border-color: var(--hs-primary) !important;
  background: var(--hs-primary-soft) !important;
  box-shadow: 0 0 0 1px var(--hs-primary);
}
.stitch-app .recharge-pkg.pkg-active::after {
  background: var(--hs-primary) !important;
  color: #fff !important;
  box-shadow: none !important;
}
.stitch-app .recharge-tier-hero {
  background: var(--hs-surface) !important;
  border-color: var(--hs-border) !important;
}
.stitch-app .recharge-tier-hero.pkg-active {
  border-color: var(--hs-warning) !important;
  background: rgba(217, 119, 6, 0.08) !important;
  box-shadow: 0 0 0 2px rgba(217, 119, 6, 0.35) !important;
}
.stitch-app .recharge-tier-studio.pkg-active {
  border-color: var(--hs-primary) !important;
  background: var(--hs-primary-soft) !important;
}

.stitch-app .recharge-pay-btn {
  background: var(--hs-primary) !important;
  box-shadow: var(--hs-shadow) !important;
}

/* Studio */
.stitch-app #creatorStudioModal {
  background: var(--hs-bg) !important;
}
.stitch-app #creatorStudioModal > div:first-child {
  background: var(--hs-surface) !important;
  border-color: var(--hs-border) !important;
}
.stitch-app #creatorStudioModal h2 { color: var(--hs-text) !important; }
.stitch-app #creatorStudioModal .bg-slate-900,
.stitch-app #creatorStudioModal .bg-slate-950 {
  background: var(--hs-surface) !important;
  border-color: var(--hs-border) !important;
}
.stitch-app #creatorStudioModal input,
.stitch-app #creatorStudioModal select,
.stitch-app #creatorStudioModal textarea {
  background: var(--hs-surface-low) !important;
  border-color: var(--hs-border) !important;
  color: var(--hs-text) !important;
}
.stitch-app #renderScreen {
  background: var(--hs-surface-low) !important;
  border: 1px solid var(--hs-border) !important;
  border-radius: var(--hs-radius-lg) !important;
}
.stitch-app #modeSwitcher { background: var(--hs-surface-low) !important; border-color: var(--hs-border) !important; }

.stitch-mode-active {
  background: var(--hs-primary) !important;
  color: #fff !important;
  box-shadow: none !important;
}
.stitch-mode-inactive {
  background: transparent !important;
  color: var(--hs-text-secondary) !important;
}
.stitch-mode-inactive:hover { color: var(--hs-text) !important; background: var(--hs-surface-high) !important; }

/* Model plaza */
.stitch-app .model-plaza-card {
  border-color: var(--hs-border) !important;
  border-radius: var(--hs-radius) !important;
  overflow: hidden;
}
.stitch-app .model-plaza-card:hover {
  border-color: var(--hs-primary) !important;
  box-shadow: var(--hs-shadow-lift, var(--hs-shadow)) !important;
  transform: translateY(-3px);
}

/* App grid card */
.stitch-app-card-cover { position: relative; height: 14rem; overflow: hidden; }
.stitch-app-card-cover img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.4s ease; }
.tech-glass:hover .stitch-app-card-cover img { transform: scale(1.04); }
.stitch-app-card-cover .overlay {
  position: absolute; inset: 0;
  background: linear-gradient(to top, rgba(25,28,30,0.75), transparent 55%);
}
.stitch-app-card-cover h3 {
  position: absolute; bottom: 16px; left: 20px; right: 20px;
  font-size: 1.25rem; font-weight: 700; color: #fff;
  text-shadow: 0 2px 8px rgba(0,0,0,0.35);
}

/* Toast */
.stitch-app #toast {
  pointer-events: none !important;
  background: var(--hs-surface) !important;
  border: 1px solid var(--hs-border) !important;
  color: var(--hs-text) !important;
  box-shadow: var(--hs-shadow) !important;
}
.stitch-app #toast.opacity-0 {
  visibility: hidden;
}
.stitch-app #toast.bg-rose-600 {
  background: var(--hs-error) !important;
  color: #fff !important;
  border-color: transparent !important;
}

/* Dark mode text overrides for legacy tailwind classes */
html[data-theme="light"] .stitch-app .text-slate-100,
html[data-theme="light"] .stitch-app .text-slate-200,
html[data-theme="light"] .stitch-app .text-white { color: var(--hs-text) !important; }
html[data-theme="light"] .stitch-app .text-slate-300,
html[data-theme="light"] .stitch-app .text-slate-400,
html[data-theme="light"] .stitch-app .text-slate-500 { color: var(--hs-text-secondary) !important; }
html[data-theme="light"] .stitch-app .text-cyan-300,
html[data-theme="light"] .stitch-app .text-cyan-400 { color: var(--hs-primary) !important; }

html[data-theme="dark"] .stitch-app .bg-slate-800,
html[data-theme="dark"] .stitch-app .bg-slate-900,
html[data-theme="dark"] .stitch-app .bg-slate-950 {
  background-color: var(--hs-surface) !important;
}
html[data-theme="dark"] .stitch-app .border-slate-700,
html[data-theme="dark"] .stitch-app .border-slate-800 {
  border-color: var(--hs-border) !important;
}

/* Hide header nav duplicates on mobile when bottom nav shows（Pro 用 hs-pro-badge，不受影响） */
@media (max-width: 1023px) {
  .stitch-header .header-nav-chips { display: none !important; }
  #userInfoHeader .stitch-chip:not(.stitch-chip-logout):not(.stitch-balance-pill) { display: none !important; }
  #headerProBadge.hs-pro-badge:not(.hidden) {
    display: inline-flex !important;
  }
}

.stitch-nav-hidden { display: none !important; }

/* 首页：历史生成入口 — 浅色模式提高对比度 */
html[data-theme="light"] .hs-history-label { color: #191c1e; }
html[data-theme="light"] .hs-history-icon { color: #0052d9; }
html[data-theme="light"] .hs-history-hint { color: #434654; }
html[data-theme="light"] .hs-history-entry:hover .hs-history-label { color: #0052d9; }
html[data-theme="dark"] .hs-history-label { color: #e6edf3; }
html[data-theme="dark"] .hs-history-icon { color: #4493f8; }
html[data-theme="dark"] .hs-history-hint { color: #8b949e; }

/* 运行溯币徽章 — 浅色模式深色字，避免黄字看不清 */
html[data-theme="light"] .hs-run-badge-pro {
  color: #78350f; background: #fef3c7; border: 1px solid #d97706;
}
html[data-theme="light"] .hs-run-badge-pro .hs-run-badge-tag {
  color: #92400e; border: 1px solid #f59e0b; background: #fffbeb;
}
html[data-theme="light"] .hs-run-badge-normal {
  color: #1e3a8a; background: #eff6ff; border: 1px solid #3b82f6;
}
html[data-theme="light"] .hs-run-badge-normal .hs-run-badge-sub { color: #1d4ed8; }

html[data-theme="dark"] .hs-run-badge-pro {
  color: #fde68a; background: rgba(245, 158, 11, 0.15); border: 1px solid rgba(245, 158, 11, 0.45);
}
html[data-theme="dark"] .hs-run-badge-pro .hs-run-badge-tag {
  color: #fcd34d; border: 1px solid rgba(251, 191, 36, 0.35); background: rgba(0,0,0,0.15);
}
html[data-theme="dark"] .hs-run-badge-normal {
  color: #c4b5fd; background: rgba(99, 102, 241, 0.15); border: 1px solid rgba(129, 140, 248, 0.45);
}
html[data-theme="dark"] .hs-run-badge-normal .hs-run-badge-sub { color: #a5b4fc; }

input[type=file]::file-selector-button {
  margin-right: 1rem; padding: 0.5rem 1rem; border-radius: var(--hs-radius);
  border: none; background: var(--hs-primary); color: #fff; cursor: pointer;
}
input[type="checkbox"] { accent-color: var(--hs-primary); }

/* =========================================================
   华溯视觉系统 3.0 — 星云紫 / 深空黑 / 云雾白
   data-style: nebula | midnight | cloud
   ========================================================= */
html[data-style="nebula"] {
  --hs-bg: #080611;
  --hs-bg-deep: #05040a;
  --hs-surface: rgba(19, 15, 31, 0.84);
  --hs-surface-low: rgba(27, 21, 43, 0.82);
  --hs-surface-high: rgba(38, 29, 59, 0.9);
  --hs-border: rgba(176, 145, 255, 0.2);
  --hs-border-soft: rgba(176, 145, 255, 0.1);
  --hs-text: #f5f1ff;
  --hs-text-secondary: #b9afca;
  --hs-text-muted: #817890;
  --hs-primary: #a78bfa;
  --hs-primary-dark: #c4b5fd;
  --hs-secondary: #f472b6;
  --hs-accent: #67e8f9;
  --hs-primary-soft: rgba(167, 139, 250, 0.14);
  --hs-primary-grad: linear-gradient(135deg, #8b5cf6 0%, #a855f7 48%, #ec4899 115%);
  --hs-card-grad: linear-gradient(145deg, rgba(28, 22, 44, 0.92), rgba(15, 12, 26, 0.82));
  --hs-grid-line: rgba(167, 139, 250, 0.055);
  --hs-glow-one: rgba(124, 58, 237, 0.23);
  --hs-glow-two: rgba(236, 72, 153, 0.13);
  --hs-shadow: 0 1px 0 rgba(255,255,255,0.035) inset, 0 12px 36px rgba(2, 0, 12, 0.28);
  --hs-shadow-lift: 0 1px 0 rgba(255,255,255,0.065) inset, 0 20px 54px rgba(23, 6, 48, 0.48);
  --hs-modal-overlay: rgba(5, 3, 10, 0.78);
}

html[data-style="midnight"] {
  --hs-bg: #08090d;
  --hs-bg-deep: #040508;
  --hs-surface: rgba(17, 18, 25, 0.9);
  --hs-surface-low: rgba(24, 25, 35, 0.88);
  --hs-surface-high: rgba(34, 35, 48, 0.94);
  --hs-border: rgba(164, 155, 255, 0.17);
  --hs-border-soft: rgba(164, 155, 255, 0.085);
  --hs-text: #f4f3fa;
  --hs-text-secondary: #aaa8b7;
  --hs-text-muted: #71707d;
  --hs-primary: #9287ff;
  --hs-primary-dark: #b8b1ff;
  --hs-secondary: #d4d0ff;
  --hs-accent: #9adcf7;
  --hs-primary-soft: rgba(146, 135, 255, 0.12);
  --hs-primary-grad: linear-gradient(135deg, #6258dc 0%, #8578f3 52%, #aaa1ff 115%);
  --hs-card-grad: linear-gradient(145deg, rgba(26, 27, 37, 0.94), rgba(11, 12, 17, 0.9));
  --hs-grid-line: rgba(164, 155, 255, 0.034);
  --hs-glow-one: rgba(104, 90, 230, 0.15);
  --hs-glow-two: rgba(130, 184, 255, 0.07);
  --hs-shadow: 0 1px 0 rgba(255,255,255,0.035) inset, 0 14px 38px rgba(0, 0, 0, 0.34);
  --hs-shadow-lift: 0 1px 0 rgba(255,255,255,0.06) inset, 0 22px 58px rgba(0, 0, 0, 0.58);
  --hs-modal-overlay: rgba(2, 3, 5, 0.84);
}

html[data-style="cloud"] {
  --hs-bg: #f4f3f9;
  --hs-bg-deep: #ecebf3;
  --hs-surface: rgba(255, 255, 255, 0.9);
  --hs-surface-low: rgba(247, 246, 251, 0.94);
  --hs-surface-high: rgba(235, 233, 244, 0.96);
  --hs-border: rgba(83, 70, 125, 0.18);
  --hs-border-soft: rgba(83, 70, 125, 0.09);
  --hs-text: #201d2b;
  --hs-text-secondary: #5e586c;
  --hs-text-muted: #8d8799;
  --hs-primary: #7259d9;
  --hs-primary-dark: #5e45c4;
  --hs-secondary: #b94f8c;
  --hs-accent: #287da1;
  --hs-primary-soft: rgba(114, 89, 217, 0.1);
  --hs-primary-grad: linear-gradient(135deg, #6650c7 0%, #8267e6 48%, #b85b9a 115%);
  --hs-card-grad: linear-gradient(145deg, rgba(255,255,255,0.96), rgba(244,243,249,0.92));
  --hs-grid-line: rgba(94, 75, 155, 0.052);
  --hs-glow-one: rgba(119, 92, 220, 0.12);
  --hs-glow-two: rgba(194, 88, 148, 0.08);
  --hs-shadow: 0 1px 0 rgba(255,255,255,0.9) inset, 0 12px 34px rgba(52, 43, 80, 0.08);
  --hs-shadow-lift: 0 1px 0 rgba(255,255,255,0.95) inset, 0 20px 52px rgba(52, 43, 80, 0.14);
  --hs-modal-overlay: rgba(28, 24, 40, 0.42);
}

html[data-style] {
  background: var(--hs-bg-deep);
}
html[data-style="nebula"],
html[data-style="midnight"] { color-scheme: dark; }
html[data-style="cloud"] { color-scheme: light; }

html[data-style] .stitch-app {
  background:
    linear-gradient(180deg, color-mix(in srgb, var(--hs-bg) 96%, transparent), var(--hs-bg-deep)) !important;
  color: var(--hs-text) !important;
  font-family: "HarmonyOS Sans SC", "MiSans", "PingFang SC", "Microsoft YaHei", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

/* 主题化网格 + 双层环境光，不使用常见的单一径向渐变模板 */
html[data-style] .stitch-app::before {
  opacity: 1;
  background-image:
    linear-gradient(var(--hs-grid-line) 1px, transparent 1px),
    linear-gradient(90deg, var(--hs-grid-line) 1px, transparent 1px),
    radial-gradient(900px circle at 12% -4%, var(--hs-glow-one), transparent 62%),
    radial-gradient(760px circle at 94% 8%, var(--hs-glow-two), transparent 58%) !important;
  background-size: 40px 40px, 40px 40px, auto, auto !important;
  -webkit-mask-image: linear-gradient(to bottom, #000 0%, rgba(0,0,0,0.92) 48%, transparent 96%);
  mask-image: linear-gradient(to bottom, #000 0%, rgba(0,0,0,0.92) 48%, transparent 96%);
}

html[data-style] .stitch-app::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  opacity: 0.2;
  background-image: radial-gradient(rgba(255,255,255,0.18) 0.55px, transparent 0.7px);
  background-size: 4px 4px;
  mix-blend-mode: soft-light;
}

html[data-style="midnight"] .stitch-app::before {
  background-size: 48px 48px, 48px 48px, auto, auto !important;
  transform: perspective(720px) rotateX(0.02deg);
}

html[data-style="cloud"] .stitch-app::before {
  background-image:
    linear-gradient(var(--hs-grid-line) 1px, transparent 1px),
    linear-gradient(90deg, var(--hs-grid-line) 1px, transparent 1px),
    radial-gradient(840px circle at 16% -6%, var(--hs-glow-one), transparent 64%),
    radial-gradient(700px circle at 92% 8%, var(--hs-glow-two), transparent 62%) !important;
  background-size: 44px 44px, 44px 44px, auto, auto !important;
}

html[data-style="cloud"] .stitch-app::after {
  opacity: 0.13;
  background-image: radial-gradient(rgba(48, 38, 77, 0.24) 0.5px, transparent 0.7px);
  mix-blend-mode: multiply;
}

/* 登录时侧栏隐藏，桌面端不再保留一块无意义空位 */
@media (min-width: 1024px) {
  #desktopSidebar.stitch-nav-hidden + .stitch-shell .stitch-app-main {
    margin-left: 0;
  }
}

/* 品牌与顶栏 */
html[data-style] .stitch-header {
  min-height: 64px;
  padding: 11px clamp(14px, 3vw, 30px) !important;
  background: color-mix(in srgb, var(--hs-bg-deep) 72%, transparent) !important;
  border-bottom-color: var(--hs-border-soft) !important;
  box-shadow: 0 8px 34px rgba(0,0,0,0.12) !important;
  backdrop-filter: blur(22px) saturate(1.35) !important;
  -webkit-backdrop-filter: blur(22px) saturate(1.35) !important;
}

html[data-style] .stitch-header .header-logo,
html[data-style] .stitch-sidebar-brand .logo {
  position: relative;
  overflow: hidden;
  border: 1px solid color-mix(in srgb, var(--hs-primary) 52%, white 8%);
  background: var(--hs-primary-grad) !important;
  box-shadow:
    0 0 0 4px color-mix(in srgb, var(--hs-primary) 8%, transparent),
    0 8px 24px color-mix(in srgb, var(--hs-primary) 24%, transparent) !important;
}

html[data-style] .stitch-header .header-logo::after,
html[data-style] .stitch-sidebar-brand .logo::after {
  content: "";
  position: absolute;
  width: 140%;
  height: 45%;
  left: -20%;
  top: -15%;
  background: rgba(255,255,255,0.28);
  transform: rotate(-22deg);
}

.hs-brand-subtitle {
  margin-top: -1px;
  color: var(--hs-text-muted);
  font-size: 8px;
  font-weight: 700;
  line-height: 1;
  letter-spacing: 0.17em;
  white-space: nowrap;
}

html[data-style] .stitch-sidebar {
  background: color-mix(in srgb, var(--hs-surface) 88%, transparent);
  border-right-color: var(--hs-border-soft);
  backdrop-filter: blur(22px);
  -webkit-backdrop-filter: blur(22px);
}

html[data-style] .stitch-sidebar-brand {
  min-height: 58px;
  border-bottom-color: var(--hs-border-soft);
  letter-spacing: 0.04em;
}

html[data-style] .stitch-nav-item {
  border: 1px solid transparent;
  border-radius: 12px;
}

html[data-style] .stitch-nav-item:hover {
  border-color: var(--hs-border-soft);
  background: color-mix(in srgb, var(--hs-surface-high) 68%, transparent);
}

html[data-style] .stitch-nav-item.active {
  border-color: color-mix(in srgb, var(--hs-primary) 22%, transparent);
  background: linear-gradient(90deg, var(--hs-primary-soft), transparent);
  box-shadow: 0 8px 24px color-mix(in srgb, var(--hs-primary) 7%, transparent);
}

html[data-style] .stitch-bottom-nav {
  background: color-mix(in srgb, var(--hs-bg-deep) 82%, transparent);
  border-top-color: var(--hs-border-soft);
  box-shadow: 0 -12px 34px rgba(0,0,0,0.18);
  backdrop-filter: blur(22px) saturate(1.3);
  -webkit-backdrop-filter: blur(22px) saturate(1.3);
}

/* 三主题选择器 */
.hs-theme-picker {
  position: relative;
  z-index: 70;
  flex: none;
}

html[data-style] .stitch-theme-btn {
  position: relative;
  width: 38px;
  height: 38px;
  border-color: var(--hs-border);
  background: color-mix(in srgb, var(--hs-surface-low) 86%, transparent);
  color: var(--hs-primary);
  box-shadow: 0 8px 24px rgba(0,0,0,0.16), inset 0 1px rgba(255,255,255,0.04);
  backdrop-filter: blur(12px);
}

html[data-style] .stitch-theme-btn::after {
  content: "";
  position: absolute;
  right: 3px;
  bottom: 3px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--hs-secondary);
  border: 1px solid var(--hs-bg-deep);
  box-shadow: 0 0 8px var(--hs-secondary);
}

html[data-style] .stitch-theme-btn:hover {
  transform: translateY(-1px) rotate(8deg);
  box-shadow: 0 10px 28px color-mix(in srgb, var(--hs-primary) 17%, transparent);
}

.hs-theme-menu {
  position: absolute;
  top: calc(100% + 12px);
  right: 0;
  width: 250px;
  padding: 10px;
  border: 1px solid var(--hs-border);
  border-radius: 16px;
  background:
    linear-gradient(145deg, color-mix(in srgb, var(--hs-primary) 7%, transparent), transparent 46%),
    var(--hs-bg-deep);
  box-shadow: var(--hs-shadow-lift);
  backdrop-filter: blur(28px) saturate(1.35);
  -webkit-backdrop-filter: blur(28px) saturate(1.35);
  transform-origin: top right;
  animation: hs-theme-menu-in 0.18s ease-out both;
}

.hs-theme-menu::before {
  content: "";
  position: absolute;
  top: -5px;
  right: 14px;
  width: 9px;
  height: 9px;
  border-left: 1px solid var(--hs-border);
  border-top: 1px solid var(--hs-border);
  background: var(--hs-bg-deep);
  transform: rotate(45deg);
}

.hs-theme-menu-title {
  padding: 3px 7px 8px;
  color: var(--hs-text-muted);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.hs-theme-option {
  width: 100%;
  display: grid;
  grid-template-columns: 36px 1fr 16px;
  align-items: center;
  gap: 10px;
  padding: 9px;
  border: 1px solid transparent;
  border-radius: 11px;
  background: transparent;
  color: var(--hs-text);
  text-align: left;
  cursor: pointer;
  transition: background 0.18s ease, border-color 0.18s ease, transform 0.18s ease;
}

.hs-theme-option:hover {
  transform: translateX(2px);
  border-color: var(--hs-border-soft);
  background: var(--hs-surface-low);
}

.hs-theme-option.active {
  border-color: color-mix(in srgb, var(--hs-primary) 30%, transparent);
  background: var(--hs-primary-soft);
}

.hs-theme-option strong,
.hs-theme-option small {
  display: block;
}

.hs-theme-option strong { font-size: 12px; }
.hs-theme-option small {
  margin-top: 2px;
  color: var(--hs-text-muted);
  font-size: 9px;
}

.hs-theme-preview {
  width: 34px;
  height: 34px;
  border: 1px solid rgba(255,255,255,0.14);
  border-radius: 10px;
  box-shadow: inset 0 1px rgba(255,255,255,0.16), 0 5px 14px rgba(0,0,0,0.2);
}
.hs-theme-preview-nebula { background: linear-gradient(145deg, #120a24, #8b5cf6 58%, #ec4899); }
.hs-theme-preview-midnight { background: linear-gradient(145deg, #05060a, #242438 58%, #8d82fb); }
.hs-theme-preview-cloud { background: linear-gradient(145deg, #ffffff, #eceaf5 58%, #9d89e8); }

.hs-theme-check {
  width: 15px;
  height: 15px;
  color: var(--hs-primary);
  opacity: 0;
}
.hs-theme-option.active .hs-theme-check { opacity: 1; }

@keyframes hs-theme-menu-in {
  from { opacity: 0; transform: translateY(-5px) scale(0.97); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

/* 首页首屏 */
.hs-home-hero {
  max-width: 880px;
  margin: 0 auto;
  padding: clamp(34px, 6vw, 66px) 16px 25px;
}

.hs-hero-kicker {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 15px;
  padding: 6px 11px;
  border: 1px solid var(--hs-border);
  border-radius: 999px;
  background: color-mix(in srgb, var(--hs-surface-low) 66%, transparent);
  color: var(--hs-text-secondary);
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.17em;
  box-shadow: inset 0 1px rgba(255,255,255,0.035);
  backdrop-filter: blur(14px);
}

.hs-hero-kicker > span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--hs-primary);
  box-shadow: 0 0 0 4px var(--hs-primary-soft), 0 0 14px var(--hs-primary);
  animation: hs-status-pulse 2.4s ease-in-out infinite;
}

.stitch-panel-hero .hs-hero-title {
  max-width: 820px;
  margin: 0 auto;
  color: var(--hs-text);
  font-size: clamp(2rem, 6vw, 3.75rem);
  font-weight: 850;
  line-height: 1.1;
  letter-spacing: -0.045em;
  text-wrap: balance;
}

html[data-style] .stitch-app .text-gradient {
  color: transparent !important;
  background: linear-gradient(110deg, var(--hs-text) 0%, var(--hs-primary-dark) 42%, var(--hs-secondary) 100%) !important;
  -webkit-background-clip: text !important;
  background-clip: text !important;
  -webkit-text-fill-color: transparent !important;
}

.hs-hero-copy {
  max-width: 570px;
  margin: 15px auto 0;
  color: var(--hs-text-secondary);
  font-size: clamp(13px, 2vw, 15px);
  line-height: 1.75;
}

.hs-hero-metrics {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin-top: 20px;
}

.hs-hero-metrics span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  color: var(--hs-text-muted);
  font-size: 10px;
  font-weight: 600;
}

.hs-hero-metrics svg {
  width: 13px;
  height: 13px;
  color: var(--hs-primary);
}

@keyframes hs-status-pulse {
  0%, 100% { opacity: 0.7; transform: scale(0.9); }
  50% { opacity: 1; transform: scale(1.08); }
}

/* 快捷工具：统一信息结构，但每张有自己的光谱识别色 */
.hs-tool-grid { max-width: 920px; }

html[data-style] .stitch-app .tech-glass,
html[data-style] .stitch-tool-btn {
  position: relative;
  overflow: hidden;
  background: var(--hs-card-grad) !important;
  border-color: var(--hs-border) !important;
  box-shadow: var(--hs-shadow) !important;
  backdrop-filter: blur(18px) saturate(1.18) !important;
  -webkit-backdrop-filter: blur(18px) saturate(1.18) !important;
}

html[data-style] .stitch-app .tech-glass::after,
html[data-style] .stitch-tool-btn::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  border-radius: inherit;
  background: linear-gradient(120deg, rgba(255,255,255,0.045), transparent 28%, transparent 75%, rgba(255,255,255,0.02));
}

.hs-quick-tool {
  --tool-tone: var(--hs-primary);
  min-height: 108px;
  display: grid;
  grid-template-columns: 42px 1fr 18px;
  align-items: center;
  gap: 12px;
  padding: 18px !important;
  text-align: left;
  isolation: isolate;
}

.hs-quick-tool::before {
  content: "";
  position: absolute;
  width: 120px;
  height: 120px;
  right: -58px;
  top: -65px;
  z-index: -1;
  border-radius: 50%;
  background: color-mix(in srgb, var(--tool-tone) 20%, transparent);
  filter: blur(26px);
  opacity: 0.72;
  transition: opacity 0.25s ease, transform 0.35s ease;
}

.hs-quick-tool-violet { --tool-tone: #a78bfa; }
.hs-quick-tool-cyan { --tool-tone: #22d3ee; }
.hs-quick-tool-amber { --tool-tone: #fbbf24; }

.hs-tool-icon {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border: 1px solid color-mix(in srgb, var(--tool-tone) 34%, transparent);
  border-radius: 13px;
  color: var(--tool-tone);
  background: color-mix(in srgb, var(--tool-tone) 11%, transparent);
  box-shadow: inset 0 1px rgba(255,255,255,0.055), 0 8px 22px color-mix(in srgb, var(--tool-tone) 8%, transparent);
}
.hs-tool-icon svg { width: 20px; height: 20px; }

.hs-tool-content { min-width: 0; }
.hs-tool-content strong {
  display: block;
  color: var(--hs-text);
  font-size: 14px;
  font-weight: 750;
  letter-spacing: 0.01em;
}
.hs-tool-content small {
  display: block;
  margin-top: 5px;
  color: var(--hs-text-muted);
  font-size: 10px;
  white-space: nowrap;
}

.hs-tool-arrow {
  width: 16px;
  height: 16px;
  color: var(--hs-text-muted);
  transition: color 0.22s ease, transform 0.22s ease;
}

html[data-style] .hs-quick-tool:hover {
  border-color: color-mix(in srgb, var(--tool-tone) 38%, transparent) !important;
  box-shadow: var(--hs-shadow-lift) !important;
  transform: translateY(-4px);
}
.hs-quick-tool:hover::before { opacity: 1; transform: scale(1.18); }
.hs-quick-tool:hover .hs-tool-arrow { color: var(--tool-tone); transform: translate(2px, -2px); }

.hs-history-entry {
  max-width: 920px;
  min-height: 62px;
}
.hs-history-label > span:last-child { display: flex; flex-direction: column; text-align: left; }
.hs-history-label strong { color: var(--hs-text); font-size: 12px; }
.hs-history-label small { margin-top: 2px; color: var(--hs-text-muted); font-size: 9px; font-weight: 400; }
.hs-history-icon-wrap {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border: 1px solid var(--hs-border);
  border-radius: 11px;
  background: var(--hs-primary-soft);
}
.hs-history-hint { display: inline-flex; align-items: center; gap: 4px; }
.hs-history-hint svg { width: 13px; height: 13px; }

/* 登录 / 注册：更强的品牌焦点与空间层次 */
html[data-style] #authPanel {
  min-height: calc(100dvh - 64px);
  padding: clamp(22px, 5vw, 52px);
}

html[data-style] #authPanel::before {
  content: "";
  position: absolute;
  width: min(58vw, 720px);
  height: min(58vw, 720px);
  left: 50%;
  top: 46%;
  z-index: -1;
  border-radius: 50%;
  background: radial-gradient(circle, var(--hs-glow-one), transparent 66%);
  filter: blur(20px);
  transform: translate(-50%, -50%);
  opacity: 0.62;
}

html[data-style] .stitch-auth-card {
  position: relative;
  isolation: isolate;
  width: min(100%, 440px);
  max-width: 440px;
  padding: clamp(26px, 5vw, 42px) !important;
  overflow: hidden;
  border-color: color-mix(in srgb, var(--hs-primary) 25%, var(--hs-border)) !important;
  border-radius: 22px !important;
  box-shadow:
    0 1px 0 rgba(255,255,255,0.075) inset,
    0 30px 90px rgba(0,0,0,0.38),
    0 0 70px color-mix(in srgb, var(--hs-primary) 8%, transparent) !important;
}

html[data-style] .stitch-auth-card::before {
  content: "";
  position: absolute;
  left: 12%;
  right: 12%;
  top: 0;
  height: 1px;
  z-index: 2;
  background: linear-gradient(90deg, transparent, var(--hs-primary), var(--hs-secondary), transparent);
  box-shadow: 0 0 16px var(--hs-primary);
}

html[data-style] .stitch-auth-card::after {
  content: "";
  position: absolute;
  width: 190px;
  height: 190px;
  right: -95px;
  top: -100px;
  z-index: -1;
  border-radius: 50%;
  background: color-mix(in srgb, var(--hs-primary) 18%, transparent);
  filter: blur(28px);
}

html[data-style] .stitch-auth-card > div { position: relative; z-index: 1; }

#loginForm h2::before,
#registerForm h2::before {
  content: "WELCOME // HUASU";
  display: block;
  margin-bottom: 9px;
  color: var(--hs-primary);
  font-size: 8px;
  font-weight: 800;
  letter-spacing: 0.2em;
}

html[data-style] .stitch-auth-card h2 {
  font-size: 25px;
  letter-spacing: -0.025em;
}

html[data-style] .stitch-auth-card input {
  min-height: 48px;
  border-color: var(--hs-border-soft) !important;
  background: color-mix(in srgb, var(--hs-surface-low) 80%, transparent) !important;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.025);
}

html[data-style] .stitch-auth-card input:hover { border-color: var(--hs-border) !important; }
html[data-style] .stitch-auth-card input:focus {
  border-color: color-mix(in srgb, var(--hs-primary) 65%, transparent) !important;
  box-shadow: 0 0 0 3px var(--hs-primary-soft), inset 0 1px rgba(255,255,255,0.025);
}

/* 通用卡片、按钮与应用卡 */
html[data-style] .stitch-chip,
html[data-style] .stitch-balance-pill {
  border-color: var(--hs-border);
  background: color-mix(in srgb, var(--hs-surface-low) 68%, transparent);
  backdrop-filter: blur(12px);
}

html[data-style] .stitch-btn-primary {
  position: relative;
  overflow: hidden;
  box-shadow:
    0 10px 28px color-mix(in srgb, var(--hs-primary) 22%, transparent),
    inset 0 1px rgba(255,255,255,0.18) !important;
}

html[data-style] .stitch-btn-primary:hover {
  box-shadow:
    0 14px 34px color-mix(in srgb, var(--hs-primary) 32%, transparent),
    inset 0 1px rgba(255,255,255,0.22) !important;
  transform: translateY(-1px);
}

html[data-style] .stitch-btn-outline {
  background: color-mix(in srgb, var(--hs-surface-low) 78%, transparent) !important;
}

html[data-style] #appGrid > .tech-glass {
  border-radius: 22px !important;
}

html[data-style] .stitch-app-card-cover {
  border-bottom: 1px solid var(--hs-border-soft);
}

html[data-style] .stitch-app-card-cover .overlay {
  background:
    linear-gradient(to top, color-mix(in srgb, var(--hs-bg-deep) 94%, transparent), transparent 70%),
    linear-gradient(120deg, color-mix(in srgb, var(--hs-primary) 15%, transparent), transparent 48%);
}

html[data-style] .stitch-app-card-cover h3 {
  bottom: 18px;
  font-size: 1.35rem;
  letter-spacing: -0.02em;
}

/* 工作站：与主站保持主题一致 */
html[data-style] .stitch-app #creatorStudioModal {
  background:
    linear-gradient(var(--hs-grid-line) 1px, transparent 1px),
    linear-gradient(90deg, var(--hs-grid-line) 1px, transparent 1px),
    radial-gradient(700px circle at 85% 0%, var(--hs-glow-one), transparent 62%),
    var(--hs-bg-deep) !important;
  background-size: 40px 40px, 40px 40px, auto, auto !important;
}

html[data-style] .stitch-app #creatorStudioModal > div:first-child {
  background: color-mix(in srgb, var(--hs-surface) 82%, transparent) !important;
  backdrop-filter: blur(20px);
}

html[data-style] .stitch-app #creatorStudioModal .bg-slate-900,
html[data-style] .stitch-app #creatorStudioModal .bg-slate-950 {
  background: color-mix(in srgb, var(--hs-surface) 90%, transparent) !important;
}

html[data-style] .stitch-app #creatorStudioModal input,
html[data-style] .stitch-app #creatorStudioModal select,
html[data-style] .stitch-app #creatorStudioModal textarea {
  border-color: var(--hs-border-soft) !important;
  background: color-mix(in srgb, var(--hs-surface-low) 88%, transparent) !important;
  box-shadow: inset 0 1px rgba(255,255,255,0.025);
}

html[data-style] .stitch-app #renderScreen {
  background:
    radial-gradient(circle at 50% 45%, color-mix(in srgb, var(--hs-primary) 8%, transparent), transparent 42%),
    var(--hs-bg-deep) !important;
  border-color: var(--hs-border) !important;
  box-shadow: inset 0 1px rgba(255,255,255,0.035), 0 24px 70px rgba(0,0,0,0.25);
}

html[data-style] .stitch-mode-active {
  background: var(--hs-primary-grad) !important;
  box-shadow: 0 8px 24px color-mix(in srgb, var(--hs-primary) 20%, transparent) !important;
}

/* 固定栏与备案减少“白条感” */
html[data-style] .stitch-footer-bar {
  background: color-mix(in srgb, var(--hs-bg-deep) 80%, transparent) !important;
  border-top-color: var(--hs-border-soft) !important;
  box-shadow: 0 -14px 40px rgba(0,0,0,0.18);
  backdrop-filter: blur(22px) saturate(1.25) !important;
  -webkit-backdrop-filter: blur(22px) saturate(1.25) !important;
}

html[data-style] .hs-site-beian-footer {
  background: color-mix(in srgb, var(--hs-bg-deep) 92%, transparent);
  border-top-color: var(--hs-border-soft);
  color: var(--hs-text-muted);
}

/* 保留 Tailwind 旧色类的可读性，同时让青色强调跟随主题 */
html[data-style] .stitch-app .text-cyan-300,
html[data-style] .stitch-app .text-cyan-400 {
  color: var(--hs-primary) !important;
}
html[data-style] .stitch-app .focus\:border-cyan-500:focus { border-color: var(--hs-primary) !important; }

/* 手机端重新压缩信息密度 */
@media (max-width: 639px) {
  .hs-brand-subtitle { display: none; }
  .stitch-header {
    gap: 8px !important;
    padding-inline: 12px !important;
  }
  .hs-header-brand {
    flex: 0 0 auto;
    gap: 10px !important;
  }
  .hs-header-brand-title {
    overflow: visible;
    text-overflow: clip;
    white-space: nowrap;
    font-size: 16px !important;
  }
  .hs-header-actions {
    flex: 1 1 auto;
    justify-content: flex-end;
    gap: 6px !important;
  }
  .hs-header-user {
    display: inline-flex !important;
    align-items: center;
    max-width: 7.5rem;
    min-width: 0;
    overflow: hidden;
    font-size: 12px;
    line-height: 1.2;
  }
  .hs-header-user #displayUsername {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  #userInfoHeader {
    flex-wrap: nowrap !important;
    gap: 6px !important;
  }
  .stitch-chip-logout {
    padding-inline: 9px;
    font-size: 11px;
  }
  .hs-theme-menu {
    position: fixed;
    top: 66px;
    left: 12px;
    right: 12px;
    width: auto;
  }
  .hs-theme-menu::before { right: 17px; }
  .hs-home-hero { padding-top: 32px; }
  .stitch-panel-hero .hs-hero-title { font-size: 2rem; }
  .hs-hero-copy { max-width: 320px; }
  .hs-hero-metrics { gap: 2px 8px; margin-top: 14px; }
  .hs-hero-metrics span { padding: 4px 5px; font-size: 9px; }
  .hs-quick-tool {
    min-height: 102px;
    grid-template-columns: 38px minmax(0, 1fr);
    gap: 10px;
    padding: 12px !important;
  }
  .hs-tool-icon { width: 38px; height: 38px; border-radius: 11px; }
  .hs-tool-content strong { white-space: nowrap; }
  .hs-tool-content small { white-space: normal; line-height: 1.35; }
  .hs-tool-arrow { display: none; }
  .hs-history-hint { font-size: 8px; }
}

@media (prefers-reduced-motion: reduce) {
  .hs-hero-kicker > span,
  .hs-theme-menu { animation: none !important; }
  .hs-quick-tool,
  .hs-quick-tool::before,
  .hs-tool-arrow { transition: none !important; }
}

/* =========================================================
   内部界面 3.0 — 工作站、工具弹窗、账户与收银台
   ========================================================= */

/* 所有弹窗先统一空间、材质和遮罩，避免每个工具像来自不同模板 */
html[data-style] :is(
  #termsModal,
  #rechargeModal,
  #proSubModal,
  #profileModal,
  #wechatCashModal,
  #genHistoryPreviewModal,
  #imageToPromptModal,
  #gptImageModal,
  #videoClipModal
) {
  background: var(--hs-modal-overlay) !important;
  backdrop-filter: blur(18px) saturate(1.12) !important;
  -webkit-backdrop-filter: blur(18px) saturate(1.12) !important;
}

html[data-style] :is(
  #termsModal,
  #rechargeModal,
  #proSubModal,
  #profileModal,
  #wechatCashModal,
  #genHistoryPreviewModal,
  #imageToPromptModal,
  #gptImageModal,
  #videoClipModal
) > div {
  color: var(--hs-text) !important;
  background: var(--hs-card-grad) !important;
  border: 1px solid var(--hs-border) !important;
  border-radius: 24px !important;
  box-shadow:
    0 1px 0 rgba(255,255,255,0.055) inset,
    0 32px 100px rgba(0,0,0,0.34),
    0 0 72px color-mix(in srgb, var(--hs-primary) 6%, transparent) !important;
}

html[data-style="cloud"] :is(
  #termsModal,
  #rechargeModal,
  #proSubModal,
  #profileModal,
  #wechatCashModal,
  #genHistoryPreviewModal,
  #imageToPromptModal,
  #gptImageModal,
  #videoClipModal
) > div {
  box-shadow:
    0 1px 0 rgba(255,255,255,0.95) inset,
    0 30px 90px rgba(48, 38, 78, 0.2),
    0 0 0 1px rgba(255,255,255,0.35) !important;
}

/* 旧 Tailwind 深色块在三主题下统一映射为主题表面 */
html[data-style] :is(
  #rechargeModal,
  #proSubModal,
  #profileModal,
  #wechatCashModal,
  #genHistoryPreviewModal,
  #imageToPromptModal,
  #gptImageModal,
  #videoClipModal
) :is(.bg-slate-800, .bg-slate-900, .bg-slate-950, .bg-slate-950\/50, .bg-slate-950\/80, .bg-slate-900\/50, .bg-slate-900\/60) {
  background-color: var(--hs-surface-low) !important;
}

html[data-style] :is(
  #rechargeModal,
  #proSubModal,
  #profileModal,
  #wechatCashModal,
  #genHistoryPreviewModal,
  #imageToPromptModal,
  #gptImageModal,
  #videoClipModal
) :is(.border-slate-600, .border-slate-700, .border-slate-800, .border-gray-700\/50) {
  border-color: var(--hs-border) !important;
}

html[data-style] :is(
  #rechargeModal,
  #proSubModal,
  #profileModal,
  #wechatCashModal,
  #genHistoryPreviewModal,
  #imageToPromptModal,
  #gptImageModal,
  #videoClipModal
) :is(.text-white, .text-slate-100, .text-slate-200, .text-gray-200) {
  color: var(--hs-text) !important;
}

html[data-style] :is(
  #rechargeModal,
  #proSubModal,
  #profileModal,
  #wechatCashModal,
  #genHistoryPreviewModal,
  #imageToPromptModal,
  #gptImageModal,
  #videoClipModal
) :is(.text-slate-300, .text-slate-400, .text-slate-500, .text-slate-600, .text-gray-400, .text-gray-500, .text-gray-600) {
  color: var(--hs-text-secondary) !important;
}

/* 弹窗输入控件 */
html[data-style] :is(
  #rechargeModal,
  #proSubModal,
  #profileModal,
  #imageToPromptModal,
  #gptImageModal,
  #videoClipModal
) :is(input:not([type="checkbox"]):not([type="radio"]):not([type="file"]), select, textarea) {
  color: var(--hs-text) !important;
  border: 1px solid var(--hs-border) !important;
  border-radius: 12px !important;
  background: color-mix(in srgb, var(--hs-surface-low) 92%, transparent) !important;
  box-shadow: inset 0 1px rgba(255,255,255,0.025);
  transition: border-color 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}

html[data-style] :is(
  #rechargeModal,
  #proSubModal,
  #profileModal,
  #imageToPromptModal,
  #gptImageModal,
  #videoClipModal
) :is(input:not([type="checkbox"]):not([type="radio"]):not([type="file"]), select, textarea):focus {
  border-color: color-mix(in srgb, var(--hs-primary) 62%, transparent) !important;
  box-shadow: 0 0 0 3px var(--hs-primary-soft), inset 0 1px rgba(255,255,255,0.03);
  outline: none;
}

html[data-style] :is(
  #imageToPromptModal,
  #gptImageModal,
  #videoClipModal,
  #creatorStudioModal
) label {
  color: var(--hs-text-secondary) !important;
  font-weight: 650;
  letter-spacing: 0.01em;
}

/* 通用工具弹窗壳 */
html[data-style] .hs-tool-modal-panel {
  position: relative;
  isolation: isolate;
  gap: 20px !important;
  padding: clamp(18px, 3vw, 28px) !important;
  overflow-x: hidden;
  border-radius: 26px !important;
}

html[data-style] .hs-tool-modal-panel::before {
  content: "";
  position: absolute;
  left: 8%;
  right: 8%;
  top: 0;
  height: 1px;
  z-index: 4;
  background: linear-gradient(90deg, transparent, var(--hs-primary), var(--hs-secondary), transparent);
  box-shadow: 0 0 18px color-mix(in srgb, var(--hs-primary) 58%, transparent);
}

html[data-style] .hs-tool-modal-header {
  min-height: 48px;
  margin: clamp(-28px, -3vw, -18px) clamp(-28px, -3vw, -18px) 0;
  padding: 16px clamp(18px, 3vw, 28px);
  border-bottom: 1px solid var(--hs-border-soft);
  background: color-mix(in srgb, var(--hs-surface) 92%, transparent) !important;
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
}

html[data-style] .hs-tool-modal-header h2 {
  color: var(--hs-text) !important;
  font-size: clamp(17px, 2vw, 20px);
  letter-spacing: -0.02em;
}

html[data-style] .hs-modal-icon {
  color: #fff;
  border: 1px solid color-mix(in srgb, var(--hs-primary) 55%, white 10%);
  background: var(--hs-primary-grad);
  box-shadow:
    inset 0 1px rgba(255,255,255,0.2),
    0 8px 20px color-mix(in srgb, var(--hs-primary) 23%, transparent);
}

html[data-style] .hs-tool-modal-header > button:last-child {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  padding: 0 !important;
  border: 1px solid var(--hs-border);
  border-radius: 11px;
  color: var(--hs-text-secondary) !important;
  background: var(--hs-surface-low);
  font-size: 20px;
  line-height: 1;
}

html[data-style] .hs-tool-modal-header > button:last-child:hover {
  color: var(--hs-text) !important;
  border-color: color-mix(in srgb, var(--hs-primary) 42%, transparent);
  background: var(--hs-primary-soft);
}

html[data-style] .hs-tool-primary-action {
  min-height: 46px;
  background: var(--hs-primary-grad) !important;
  border-radius: 13px !important;
  box-shadow:
    0 11px 28px color-mix(in srgb, var(--hs-primary) 25%, transparent),
    inset 0 1px rgba(255,255,255,0.18) !important;
}

html[data-style] .hs-upload-drop {
  position: relative;
  border-color: color-mix(in srgb, var(--hs-primary) 35%, transparent) !important;
  border-radius: 16px !important;
  background:
    linear-gradient(145deg, color-mix(in srgb, var(--hs-primary) 7%, transparent), transparent),
    var(--hs-surface-low) !important;
  box-shadow: inset 0 1px rgba(255,255,255,0.025);
}

html[data-style] .hs-upload-drop:hover {
  border-color: color-mix(in srgb, var(--hs-primary) 68%, transparent) !important;
  background:
    linear-gradient(145deg, color-mix(in srgb, var(--hs-primary) 12%, transparent), transparent),
    var(--hs-surface-low) !important;
}

html[data-style] .hs-result-textarea {
  background:
    linear-gradient(145deg, color-mix(in srgb, var(--hs-primary) 5%, transparent), transparent),
    var(--hs-surface-low) !important;
}

html[data-style] .hs-result-stage {
  position: relative;
  border-color: rgba(255,255,255,0.09) !important;
  border-radius: 17px !important;
  color: #8d91a2 !important;
  background:
    linear-gradient(rgba(255,255,255,0.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.025) 1px, transparent 1px),
    radial-gradient(circle at 50% 48%, color-mix(in srgb, var(--hs-primary) 9%, transparent), transparent 43%),
    #080910 !important;
  background-size: 28px 28px, 28px 28px, auto, auto !important;
  box-shadow: inset 0 1px rgba(255,255,255,0.035), 0 16px 38px rgba(0,0,0,0.18);
}

html[data-style] .hs-result-stage :is(#gptImageResultPh, #gptImageRevisedHint) {
  color: #727688 !important;
}

/* GPT 生图：参数区与结果区均形成完整工作面板 */
html[data-style] #gptImageModal .hs-gpt-panel { max-width: 1080px; }

/* 桌面宽屏：生成按钮固定在弹窗底部，避免滚出可视区点不到 */
html[data-style] #gptImageModal .hs-gpt-panel {
  display: flex;
  flex-direction: column;
  max-height: min(92vh, 920px);
  overflow: hidden !important;
  padding-bottom: 0 !important;
}
html[data-style] #gptImageModal .hs-gpt-scroll-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding-right: 2px;
}
html[data-style] #gptImageModal .hs-gpt-action-dock {
  position: sticky;
  bottom: 0;
  z-index: 20;
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  margin: 0 -6px 0;
  padding: 12px 6px calc(12px + env(safe-area-inset-bottom, 0px));
  border-top: 1px solid var(--hs-border-soft);
  background: color-mix(in srgb, var(--hs-surface) 96%, transparent);
  box-shadow: 0 -10px 28px rgba(0, 0, 0, 0.18);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}
html[data-style] #gptImageModal .hs-gpt-action-dock > .hs-tool-primary-action {
  width: 100%;
  min-height: 48px;
}

html[data-style] #gptImageModal .hs-mode-tabs {
  padding: 5px;
  border-color: var(--hs-border) !important;
  border-radius: 14px;
  background: var(--hs-surface-low) !important;
}

html[data-style] #gptImageModal .hs-mode-tabs button {
  min-height: 40px;
  border-radius: 10px;
  color: var(--hs-text-secondary) !important;
  transition: color 0.18s ease, background 0.18s ease, box-shadow 0.18s ease;
}

html[data-style] #gptImageModal .hs-mode-tabs button.bg-fuchsia-600 {
  color: #fff !important;
  background: var(--hs-primary-grad) !important;
  box-shadow: 0 7px 20px color-mix(in srgb, var(--hs-primary) 20%, transparent);
}

html[data-style] #gptImageModal .hs-field-stack > div:not(.hs-mobile-action-dock) {
  padding: 14px;
  border: 1px solid var(--hs-border-soft);
  border-radius: 15px;
  background: color-mix(in srgb, var(--hs-surface-low) 70%, transparent);
}

html[data-style] #gptImageModal .hs-field-stack > #gptImageUploadZone.hidden { display: none; }
html[data-style] #gptImageModal .hs-field-stack > #gptImageUploadZone:not(.hidden) { display: block; }

html[data-style] #gptImageModal :is(#gptImageSize, #gptImageOutputN) {
  min-height: 44px;
  padding-inline: 13px;
}

html[data-style] #gptImageModal #gptImagePrompt {
  min-height: 148px;
  line-height: 1.7;
}

html[data-style] #gptImageModal .hs-result-column {
  min-height: 100%;
  padding: 14px;
  border: 1px solid var(--hs-border-soft);
  border-radius: 17px;
  background: color-mix(in srgb, var(--hs-surface-low) 60%, transparent);
}

html[data-style] #gptImageModal #gptImageResultBox { min-height: 410px; }

html[data-style] #gptImageModal #gptImagePriceBadge {
  color: var(--hs-primary-dark) !important;
  border-color: color-mix(in srgb, var(--hs-primary) 40%, transparent) !important;
  background: var(--hs-primary-soft);
}

html[data-style] #gptImageModal .text-amber-400\/90 {
  padding: 9px 10px;
  border: 1px solid rgba(245, 158, 11, 0.18);
  border-radius: 10px;
  background: rgba(245, 158, 11, 0.055);
}

/* 看图反推：上传与结果变成两个独立工作区 */
html[data-style] #imageToPromptModal .hs-prompt-panel { max-width: 940px; }

html[data-style] #imageToPromptModal .hs-prompt-panel > .flex.flex-col.md\:flex-row > div {
  padding: 15px;
  border: 1px solid var(--hs-border-soft);
  border-radius: 17px;
  background: color-mix(in srgb, var(--hs-surface-low) 68%, transparent);
}

html[data-style] #imageToPromptModal #uploadArea { max-height: 330px; }
html[data-style] #imageToPromptModal #promptResult {
  min-height: 260px;
  padding: 15px;
  line-height: 1.75;
}

/* 视频裁剪：两列输入卡 + 统一结果舞台 */
html[data-style] #videoClipModal .hs-video-panel { max-width: 920px; }

html[data-style] #videoClipModal .hs-video-panel > .grid > div {
  padding: 15px;
  border: 1px solid var(--hs-border-soft);
  border-radius: 17px;
  background: color-mix(in srgb, var(--hs-surface-low) 68%, transparent);
}

html[data-style] #videoClipModal :is(#videoClipStart, #videoClipEnd, #videoClipDuration) {
  min-height: 43px;
}

/* 超级工作站 */
html[data-style] .hs-studio-header {
  min-height: 68px;
  padding: 13px clamp(14px, 2.5vw, 28px) !important;
  border-bottom-color: var(--hs-border-soft) !important;
  background: color-mix(in srgb, var(--hs-bg-deep) 80%, transparent) !important;
  box-shadow: 0 10px 34px rgba(0,0,0,0.15);
  backdrop-filter: blur(22px) saturate(1.2);
  -webkit-backdrop-filter: blur(22px) saturate(1.2);
}

html[data-style] .hs-studio-header h2 {
  color: var(--hs-text) !important;
  letter-spacing: -0.025em;
}

html[data-style] .hs-studio-layout {
  max-width: 1440px;
  gap: clamp(14px, 2vw, 24px) !important;
}

html[data-style] .hs-studio-controls {
  position: relative;
  overflow: hidden;
  border-color: var(--hs-border) !important;
  border-radius: 22px !important;
  background: var(--hs-card-grad) !important;
  box-shadow: var(--hs-shadow-lift) !important;
}

html[data-style] .hs-studio-controls::before {
  content: "";
  position: absolute;
  left: 12%;
  right: 12%;
  top: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--hs-primary), var(--hs-secondary), transparent);
}

html[data-style] #modeSwitcher {
  padding: 5px !important;
  border-color: var(--hs-border-soft) !important;
  border-radius: 15px !important;
  background: var(--hs-surface-low) !important;
}

html[data-style] #modeSwitcher button {
  min-height: 42px;
  border-radius: 10px !important;
}

html[data-style] #modeSwitcher button.bg-cyan-600 {
  color: #fff !important;
  background: var(--hs-primary-grad) !important;
  box-shadow: 0 8px 24px color-mix(in srgb, var(--hs-primary) 20%, transparent) !important;
}

html[data-style] .hs-studio-upload-card {
  padding: 15px !important;
  border-color: var(--hs-border-soft) !important;
  border-radius: 15px !important;
  background: color-mix(in srgb, var(--hs-surface-low) 78%, transparent) !important;
}

html[data-style] .hs-studio-upload-card input[type="file"] {
  width: 100%;
  margin-top: 2px;
  padding: 5px;
  border: 1px dashed color-mix(in srgb, var(--hs-primary) 25%, transparent);
  border-radius: 11px;
  background: var(--hs-surface-low);
}

/* 工作站参考图/视频：ComfyUI 风格预览 */
html[data-style] .hs-studio-media-drop {
  position: relative;
  display: block;
  width: 100%;
  min-height: 148px;
  overflow: hidden;
  cursor: pointer;
  border: 1px dashed color-mix(in srgb, var(--hs-primary) 32%, transparent);
  border-radius: 12px;
  background:
    linear-gradient(180deg, color-mix(in srgb, var(--hs-surface-low) 88%, transparent), color-mix(in srgb, #05060c 70%, transparent));
  transition: border-color 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

html[data-style] .hs-studio-media-drop:hover,
html[data-style] .hs-studio-media-drop:focus-visible {
  outline: none;
  border-color: color-mix(in srgb, var(--hs-primary) 62%, transparent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--hs-primary) 12%, transparent);
}

html[data-style] .hs-studio-media-drop.is-dragover {
  border-color: var(--hs-primary);
  border-style: solid;
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--hs-primary) 18%, transparent);
  background: color-mix(in srgb, var(--hs-primary-soft) 70%, var(--hs-surface-low));
}

html[data-style] .hs-studio-media-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 148px;
  padding: 18px 14px;
  text-align: center;
  color: var(--hs-text-muted);
  pointer-events: none;
}

html[data-style] .hs-studio-media-empty svg {
  color: color-mix(in srgb, var(--hs-primary) 70%, #8b93a7);
  opacity: 0.92;
}

html[data-style] .hs-studio-media-empty strong {
  color: var(--hs-text-secondary);
  font-size: 12px;
  font-weight: 800;
}

html[data-style] .hs-studio-media-empty span {
  font-size: 10px;
  line-height: 1.4;
}

html[data-style] .hs-studio-media-preview {
  position: relative;
  display: block;
  width: 100%;
  background: #05060a;
}

html[data-style] .hs-studio-media-preview.hidden,
html[data-style] .hs-studio-media-empty.hidden {
  display: none !important;
}

html[data-style] .hs-studio-media-preview img,
html[data-style] .hs-studio-media-preview video {
  display: block;
  width: 100%;
  max-height: 220px;
  min-height: 140px;
  object-fit: contain;
  background: #000;
  vertical-align: middle;
}

html[data-style] .hs-studio-media-preview video {
  max-height: 240px;
}

html[data-style] .hs-studio-media-clear {
  position: absolute;
  top: 8px;
  right: 8px;
  z-index: 3;
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 999px;
  color: #fff;
  background: rgba(15, 18, 28, 0.78);
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  touch-action: manipulation;
}

html[data-style] .hs-studio-media-clear:hover {
  background: rgba(220, 38, 38, 0.9);
  border-color: rgba(255, 255, 255, 0.28);
}

html[data-style] .hs-studio-media-replace {
  position: absolute;
  top: 8px;
  right: 44px;
  z-index: 3;
  height: 30px;
  padding: 0 10px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 999px;
  color: #fff;
  background: rgba(15, 18, 28, 0.78);
  font-size: 11px;
  font-weight: 700;
  line-height: 28px;
  cursor: pointer;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  touch-action: manipulation;
}

html[data-style] .hs-studio-media-replace:hover {
  border-color: color-mix(in srgb, var(--hs-primary) 55%, transparent);
  color: #fff;
  background: color-mix(in srgb, var(--hs-primary) 55%, rgba(15, 18, 28, 0.9));
}

html[data-style] .hs-studio-media-meta {
  position: absolute;
  top: auto;
  left: 8px;
  right: 8px;
  bottom: 8px;
  z-index: 2;
  max-width: calc(100% - 16px);
  padding: 5px 8px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  color: #e8ebf3;
  background: rgba(8, 10, 16, 0.78);
  font-size: 10px;
  font-weight: 600;
  line-height: 1.35;
  white-space: nowrap;
  text-overflow: ellipsis;
  pointer-events: none;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

html[data-style] .hs-studio-media-preview video + .hs-studio-media-replace ~ .hs-studio-media-meta,
html[data-style] #refVideoPreviewWrap .hs-studio-media-meta {
  bottom: 42px;
}

html[data-style] #creatorStudioModal :is(#imageLoraZone, #imageSizeZone, #videoProSizeHint, #promptZone) {
  padding: 14px;
  border: 1px solid var(--hs-border-soft);
  border-radius: 15px;
  background: color-mix(in srgb, var(--hs-surface-low) 70%, transparent);
}

html[data-style] #creatorStudioModal :is(select, textarea) {
  min-height: 44px;
  border-radius: 11px !important;
}

html[data-style] #creatorStudioModal #promptInput {
  min-height: 132px;
  padding: 13px;
  line-height: 1.7;
}

html[data-style] #creatorStudioModal #generateBtn {
  min-height: 52px;
  margin-top: 4px;
  border-radius: 14px !important;
  background: var(--hs-primary-grad) !important;
  box-shadow: 0 12px 30px color-mix(in srgb, var(--hs-primary) 26%, transparent) !important;
}

html[data-style] #creatorStudioModal #generateBtn svg { color: #fff !important; }

html[data-style] .stitch-app #renderScreen {
  border-radius: 22px !important;
  background:
    linear-gradient(rgba(255,255,255,0.022) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.022) 1px, transparent 1px),
    radial-gradient(circle at 50% 45%, color-mix(in srgb, var(--hs-primary) 10%, transparent), transparent 42%),
    #07080e !important;
  background-size: 32px 32px, 32px 32px, auto, auto !important;
  box-shadow: inset 0 1px rgba(255,255,255,0.035), 0 28px 80px rgba(0,0,0,0.27);
}

html[data-style] #renderScreen #resultPlaceholder { color: #555a6e !important; }

@media (min-width: 768px) {
  html[data-style] .hs-studio-controls {
    width: clamp(340px, 30vw, 390px) !important;
  }
}

/* 充值、会员、个人中心 */
html[data-style] #rechargeModal .recharge-modal-panel {
  width: min(100%, 760px);
  padding: clamp(18px, 3vw, 30px) !important;
}

html[data-style] #rechargeModal .recharge-pkg,
html[data-style] #proSubModal .pro-sub-pkg {
  border-color: var(--hs-border) !important;
  border-radius: 16px !important;
  background: color-mix(in srgb, var(--hs-surface-low) 75%, transparent) !important;
  box-shadow: inset 0 1px rgba(255,255,255,0.03);
}

html[data-style] #rechargeModal .recharge-pkg:hover,
html[data-style] #proSubModal .pro-sub-pkg:hover {
  border-color: color-mix(in srgb, var(--hs-primary) 45%, transparent) !important;
  transform: translateY(-2px);
}

html[data-style] #rechargeModal .recharge-pkg.pkg-active,
html[data-style] #proSubModal .pro-sub-pkg.pkg-active {
  border-color: var(--hs-primary) !important;
  background:
    linear-gradient(145deg, var(--hs-primary-soft), transparent),
    var(--hs-surface-low) !important;
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--hs-primary) 35%, transparent), 0 12px 30px color-mix(in srgb, var(--hs-primary) 10%, transparent) !important;
}

html[data-style] #proSubModal > div { width: min(100%, 520px); padding: 28px !important; }
html[data-style] #profileModal > div { width: min(100%, 680px); padding: clamp(20px, 3vw, 30px) !important; }

html[data-style] #profileContent > .grid > div,
html[data-style] #profileReferralOn > div,
html[data-style] #profileReferralOff {
  border: 1px solid var(--hs-border) !important;
  border-radius: 16px !important;
  background:
    linear-gradient(145deg, color-mix(in srgb, var(--hs-primary) 5%, transparent), transparent),
    var(--hs-surface-low) !important;
  box-shadow: inset 0 1px rgba(255,255,255,0.035);
}

html[data-style] #profileReferralOn > div:not([class*="p-"]) { padding: 16px; }

/* 关闭按钮统一为可见的圆角方块 */
html[data-style] :is(
  #termsModal,
  #rechargeModal,
  #proSubModal,
  #profileModal,
  #wechatCashModal
) > div > button:first-child,
html[data-style] #genHistoryPreviewModal > div > button:first-child {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 1px solid var(--hs-border);
  border-radius: 11px;
  color: var(--hs-text-secondary) !important;
  background: var(--hs-surface-low) !important;
}

/* 云雾白：彩色实心按钮必须保持白字，媒体预览保持深色 */
html[data-style="cloud"] :is(
  .stitch-btn-primary,
  .hs-tool-primary-action,
  .stitch-mode-active,
  #generateBtn,
  #rechargePayBtn,
  #proSubModal button[class*="bg-gradient"],
  #profileModal button[class*="bg-gradient"],
  #profileModal .bg-emerald-600,
  #profileModal .bg-amber-600,
  #genHistoryPreviewDownload,
  .pay-type-btn,
  .pro-pay-type-btn
) {
  color: #fff !important;
}

html[data-style="cloud"] :is(#gptImageResultBox, #renderScreen, #videoClipResultBox, #genHistoryPreviewModal .bg-black) {
  color: #a7abba !important;
  background-color: #080910 !important;
}

/* 打开沉浸式工具时，底部备案不透过半透明遮罩干扰内容 */
html:has(:is(
  #creatorStudioModal,
  #rechargeModal,
  #proSubModal,
  #profileModal,
  #wechatCashModal,
  #genHistoryPreviewModal,
  #imageToPromptModal,
  #gptImageModal,
  #videoClipModal
):not(.hidden)) .hs-site-beian-footer {
  opacity: 0;
  visibility: hidden;
}

/* 响应式：手机不再出现截图里那种左右栏被压扁的感觉 */
@media (max-width: 767px) {
  html[data-style] .hs-tool-modal-panel {
    gap: 14px !important;
    padding: 16px !important;
    border-radius: 20px !important;
  }

  html[data-style] .hs-tool-modal-header {
    margin: -16px -16px 0;
    padding: 13px 16px;
  }

  html[data-style] #gptImageModal {
    align-items: flex-start !important;
    padding: 8px !important;
  }

  html[data-style] #gptImageModal .hs-gpt-panel {
    max-height: calc(100dvh - 16px);
    margin: 0;
  }

  html[data-style] #gptImageModal .hs-field-stack > div:not(.hs-mobile-action-dock),
  html[data-style] #gptImageModal .hs-result-column,
  html[data-style] #videoClipModal .hs-video-panel > .grid > div,
  html[data-style] #imageToPromptModal .hs-prompt-panel > .flex.flex-col.md\:flex-row > div {
    padding: 12px;
  }

  html[data-style] #gptImageModal #gptImageResultBox { min-height: 300px; }
  html[data-style] #imageToPromptModal #promptResult { min-height: 180px; }

  html[data-style] .hs-studio-header {
    min-height: 58px;
    padding: 9px 12px !important;
  }

  html[data-style] .hs-studio-header h2 { font-size: 15px !important; }

  html[data-style] .hs-studio-layout {
    padding: 10px !important;
    gap: 12px !important;
  }

  html[data-style] .hs-studio-controls {
    padding: 14px !important;
    border-radius: 18px !important;
  }

  html[data-style] #modeSwitcher { margin-bottom: 14px !important; }
  html[data-style] #renderScreen { min-height: 420px; border-radius: 18px !important; }

  html[data-style] #profileModal,
  html[data-style] #rechargeModal {
    padding: 6px !important;
  }

  html[data-style] #profileModal > div,
  html[data-style] #rechargeModal .recharge-modal-panel {
    max-height: calc(100dvh - 12px);
    margin: 0;
    border-radius: 20px !important;
  }
}

/* 2026-07：超级工作站信息架构重排 */
html[data-style] .hs-studio-workspace {
  min-height: 0;
  background:
    radial-gradient(circle at 18% 0%, color-mix(in srgb, var(--hs-primary) 7%, transparent), transparent 30%),
    transparent;
}

html[data-style] .hs-studio-brand-mark {
  width: 40px;
  height: 40px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  border: 1px solid color-mix(in srgb, var(--hs-primary) 38%, transparent);
  border-radius: 13px;
  color: #fff;
  background: var(--hs-primary-grad);
  box-shadow: 0 8px 24px color-mix(in srgb, var(--hs-primary) 22%, transparent);
}

html[data-style] .hs-studio-kicker,
html[data-style] .hs-studio-section-kicker {
  margin: 0 0 2px;
  color: var(--hs-primary);
  font-size: 9px;
  font-weight: 800;
  line-height: 1.2;
  letter-spacing: 0.16em;
}

html[data-style] .hs-studio-actions button {
  min-height: 38px;
  border: 1px solid var(--hs-border-soft);
  color: var(--hs-text-secondary) !important;
  background: color-mix(in srgb, var(--hs-surface-low) 84%, transparent) !important;
}

html[data-style] .hs-studio-actions button:hover {
  border-color: color-mix(in srgb, var(--hs-primary) 45%, transparent);
  color: var(--hs-primary) !important;
}

html[data-style] .hs-studio-toolbar {
  flex: 0 0 auto;
  padding: 12px clamp(14px, 2.5vw, 28px);
  border-bottom: 1px solid var(--hs-border-soft);
  background: color-mix(in srgb, var(--hs-bg-deep) 70%, transparent);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}

html[data-style] .hs-studio-toolbar-inner {
  width: 100%;
  max-width: 1440px;
  margin: 0 auto;
  display: flex;
  align-items: stretch;
  gap: 12px;
}

html[data-style] #modeSwitcher.hs-studio-mode-switcher {
  width: auto;
  min-width: 0;
  flex: 1;
  margin: 0 !important;
  padding: 5px !important;
  border-radius: 16px !important;
}

html[data-style] .hs-studio-mode-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  padding-inline: 12px;
  text-align: left;
}

html[data-style] .hs-studio-mode-btn > svg {
  flex: 0 0 auto;
}

html[data-style] .hs-studio-mode-btn > span {
  min-width: 0;
  display: flex;
  flex-direction: column;
  line-height: 1.2;
}

html[data-style] .hs-studio-mode-btn strong {
  overflow: hidden;
  font-size: 12px;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

html[data-style] .hs-studio-mode-btn small {
  margin-top: 3px;
  overflow: hidden;
  color: currentColor;
  font-size: 9px;
  font-weight: 500;
  opacity: 0.68;
  text-overflow: ellipsis;
  white-space: nowrap;
}

html[data-style] .hs-studio-guide-btn {
  min-width: 158px;
  justify-content: center;
  border-radius: 16px !important;
}

html[data-style] .hs-studio-guide-btn > span {
  display: flex;
  flex-direction: column;
  text-align: left;
  line-height: 1.2;
}

html[data-style] .hs-studio-guide-btn small {
  margin-top: 2px;
  font-size: 9px;
  opacity: 0.65;
}

html[data-style] .hs-studio-layout {
  width: 100%;
  padding-top: 18px !important;
}

html[data-style] .hs-studio-controls {
  padding: 0 !important;
  overflow-x: hidden;
  overflow-y: auto;
}

html[data-style] .hs-studio-panel-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 20px 20px 14px;
}

html[data-style] .hs-studio-panel-heading h3 {
  margin: 0;
  color: var(--hs-text);
  font-size: 18px;
  font-weight: 800;
  letter-spacing: -0.02em;
}

html[data-style] .hs-studio-panel-heading > div > p:last-child {
  max-width: 275px;
  margin: 5px 0 0;
  color: var(--hs-text-muted);
  font-size: 11px;
  line-height: 1.5;
}

html[data-style] .hs-studio-step-badge {
  flex: 0 0 auto;
  padding: 5px 9px;
  border: 1px solid color-mix(in srgb, var(--hs-primary) 25%, transparent);
  border-radius: 999px;
  color: var(--hs-primary);
  background: var(--hs-primary-soft);
  font-size: 10px;
  font-weight: 800;
}

html[data-style] #dynamicInputZone {
  padding: 0 18px;
}

html[data-style] .hs-studio-parameter-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 10px;
}

html[data-style] #creatorStudioModal :is(#imageLoraZone, #imageSizeZone, #videoProSizeHint, #promptZone) {
  padding: 13px;
}

html[data-style] .hs-studio-field-label {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 11px;
  color: var(--hs-text);
}

html[data-style] .hs-studio-field-number {
  width: 26px;
  height: 26px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  border: 1px solid color-mix(in srgb, var(--hs-primary) 30%, transparent);
  border-radius: 9px;
  color: var(--hs-primary);
  background: var(--hs-primary-soft);
  font-size: 11px;
  font-weight: 900;
}

html[data-style] .hs-studio-field-label > span:last-child {
  min-width: 0;
  display: flex;
  flex-direction: column;
  line-height: 1.25;
}

html[data-style] .hs-studio-field-label strong {
  font-size: 12px;
  font-weight: 800;
}

html[data-style] .hs-studio-field-label small {
  margin-top: 3px;
  color: var(--hs-text-muted);
  font-size: 10px;
}

html[data-style] .hs-studio-prompt-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}

html[data-style] .hs-studio-prompt-heading > span {
  color: var(--hs-text-muted);
  font-size: 9px;
  white-space: nowrap;
}

html[data-style] #creatorStudioModal #promptInput {
  min-height: 142px;
}

html[data-style] .hs-studio-generate-dock {
  position: sticky;
  z-index: 3;
  bottom: 0;
  margin-top: auto;
  padding: 11px 18px 18px;
  border-top: 1px solid var(--hs-border-soft);
  background:
    linear-gradient(to bottom, transparent, var(--hs-surface) 18%, var(--hs-surface) 100%);
}

html[data-style] .hs-studio-generate-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
  color: var(--hs-text-muted);
  font-size: 9px;
}

html[data-style] .hs-studio-generate-meta span {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

html[data-style] #creatorStudioModal #generateBtn {
  margin: 0;
}

html[data-style] .hs-studio-preview-card {
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid var(--hs-border);
  border-radius: 22px;
  background: var(--hs-card-grad);
  box-shadow: var(--hs-shadow-lift);
}

html[data-style] .hs-studio-preview-header {
  min-height: 66px;
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--hs-border-soft);
  background: color-mix(in srgb, var(--hs-surface) 86%, transparent);
}

html[data-style] .hs-studio-preview-icon {
  width: 34px;
  height: 34px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  border: 1px solid color-mix(in srgb, var(--hs-primary) 25%, transparent);
  border-radius: 11px;
  color: var(--hs-primary);
  background: var(--hs-primary-soft);
}

html[data-style] .hs-studio-preview-header h3 {
  margin: 0;
  color: var(--hs-text);
  font-size: 13px;
  font-weight: 800;
}

html[data-style] .hs-studio-preview-header p {
  margin: 3px 0 0;
  overflow: hidden;
  color: var(--hs-text-muted);
  font-size: 9px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

html[data-style] .hs-studio-preview-mode {
  flex: 0 0 auto;
  padding: 5px 9px;
  border: 1px solid color-mix(in srgb, var(--hs-primary) 24%, transparent);
  border-radius: 999px;
  color: var(--hs-primary);
  background: var(--hs-primary-soft);
  font-size: 10px;
  font-weight: 800;
}

html[data-style] .stitch-app #renderScreen {
  flex: 1 1 auto;
  min-height: 0;
  border: 0 !important;
  border-radius: 0 !important;
  box-shadow: inset 0 1px rgba(255,255,255,0.025) !important;
}

html[data-style] .hs-studio-empty-state {
  width: min(88%, 360px);
  padding: 28px 20px;
}

html[data-style] .hs-studio-empty-icon {
  width: 62px;
  height: 62px;
  display: grid;
  place-items: center;
  margin-bottom: 16px;
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 20px;
  color: color-mix(in srgb, var(--hs-primary) 65%, #8b93a7);
  background:
    radial-gradient(circle at 35% 25%, color-mix(in srgb, var(--hs-primary) 24%, transparent), transparent 68%),
    rgba(255,255,255,0.025);
  box-shadow: 0 16px 45px rgba(0,0,0,0.22);
}

html[data-style] .hs-studio-empty-state h3 {
  margin: 0;
  color: #abb3c4;
  font-size: 15px;
  font-weight: 800;
  letter-spacing: 0.02em;
}

html[data-style] .hs-studio-empty-state > p {
  margin: 8px auto 0;
  color: #626b7c;
  font-size: 11px;
  line-height: 1.6;
}

html[data-style] .hs-studio-empty-tags {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  margin-top: 17px;
}

html[data-style] .hs-studio-empty-tags span {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 5px 8px;
  border: 1px solid rgba(255,255,255,0.065);
  border-radius: 999px;
  color: #747e90;
  background: rgba(255,255,255,0.025);
  font-size: 9px;
}

html[data-style] .hs-studio-preview-footer {
  min-height: 40px;
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 14px;
  border-top: 1px solid var(--hs-border-soft);
  color: var(--hs-text-muted);
  background: color-mix(in srgb, var(--hs-surface) 88%, transparent);
  font-size: 9px;
}

html[data-style] .hs-studio-preview-footer span {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

@media (min-width: 768px) {
  html[data-style] .hs-studio-controls {
    width: clamp(390px, 31vw, 430px) !important;
  }
}

@media (max-width: 767px) {
  html[data-style] .hs-studio-header {
    gap: 7px;
  }

  html[data-style] .hs-studio-brand {
    min-width: 0;
    flex: 1 1 auto;
  }

  html[data-style] .hs-studio-brand-mark {
    width: 34px;
    height: 34px;
    border-radius: 11px;
  }

  html[data-style] .hs-studio-kicker {
    display: none;
  }

  html[data-style] .hs-studio-actions button {
    min-height: 34px;
    padding-inline: 9px;
  }

  html[data-style] #studioStatusBar {
    order: 3;
    flex: 1 0 100%;
    flex-wrap: nowrap;
    justify-content: flex-start;
    gap: 6px;
    overflow-x: auto;
    padding-top: 2px;
    scrollbar-width: none;
  }

  html[data-style] #studioStatusBar::-webkit-scrollbar {
    display: none;
  }

  html[data-style] #studioStatusBar > span {
    padding: 5px 8px;
    font-size: 9px;
  }

  html[data-style] .hs-studio-toolbar {
    padding: 8px 10px;
  }

  html[data-style] .hs-studio-toolbar-inner {
    gap: 7px;
  }

  html[data-style] #modeSwitcher.hs-studio-mode-switcher {
    padding: 4px !important;
  }

  html[data-style] #modeSwitcher .hs-studio-mode-btn {
    min-height: 38px;
    gap: 4px;
    padding: 6px 4px;
    text-align: center;
  }

  html[data-style] .hs-studio-mode-btn > svg {
    width: 14px;
    height: 14px;
  }

  html[data-style] .hs-studio-mode-btn strong {
    font-size: 10px;
  }

  html[data-style] .hs-studio-mode-btn small {
    display: none;
  }

  html[data-style] .hs-studio-guide-btn {
    width: 42px;
    min-width: 42px;
    padding: 0;
  }

  html[data-style] .hs-studio-guide-btn > span {
    display: none;
  }

  html[data-style] .hs-studio-layout {
    padding: 10px !important;
    padding-top: 10px !important;
    overflow-y: auto;
  }

  html[data-style] .hs-studio-controls {
    flex: 0 0 auto;
    padding: 0 !important;
    overflow: visible;
  }

  html[data-style] .hs-studio-panel-heading {
    padding: 16px 15px 12px;
  }

  html[data-style] .hs-studio-panel-heading h3 {
    font-size: 16px;
  }

  html[data-style] .hs-studio-panel-heading > div > p:last-child {
    font-size: 10px;
  }

  html[data-style] #dynamicInputZone {
    padding: 0 12px;
  }

  html[data-style] .hs-studio-parameter-grid {
    grid-template-columns: minmax(0, 1fr);
    gap: 0;
  }

  html[data-style] #videoUploadZone {
    gap: 10px !important;
  }

  html[data-style] .hs-studio-upload-card {
    padding: 12px !important;
  }

  html[data-style] .hs-studio-media-drop,
  html[data-style] .hs-studio-media-empty {
    min-height: 132px;
  }

  html[data-style] .hs-studio-media-preview img,
  html[data-style] .hs-studio-media-preview video {
    max-height: 200px;
    min-height: 120px;
  }

  html[data-style] .hs-studio-media-clear {
    width: 34px;
    height: 34px;
    top: 6px;
    right: 6px;
  }

  html[data-style] .hs-studio-media-replace {
    top: 6px;
    right: 46px;
    height: 34px;
    line-height: 32px;
    padding: 0 12px;
    font-size: 12px;
  }

  html[data-style] .hs-studio-media-meta {
    left: 6px;
    right: 6px;
    bottom: 6px;
    max-width: calc(100% - 12px);
    padding: 5px 7px;
    font-size: 9px;
  }

  html[data-style] #refVideoPreviewWrap .hs-studio-media-meta {
    bottom: 40px;
  }

  html[data-style] #creatorStudioModal #promptInput {
    min-height: 120px;
  }

  html[data-style] .hs-studio-generate-dock {
    bottom: -1px;
    padding: 10px 12px 13px;
    border-radius: 0 0 18px 18px;
  }

  html[data-style] .hs-studio-preview-card {
    min-height: 480px;
    flex: 0 0 auto;
    border-radius: 18px;
  }

  html[data-style] .hs-studio-preview-header {
    min-height: 58px;
    padding: 10px 12px;
  }

  html[data-style] .stitch-app #renderScreen {
    min-height: 380px !important;
  }

  html[data-style] .hs-studio-preview-footer {
    padding-inline: 11px;
  }
}

/* 手机工具弹窗：自动采用全屏布局，主操作固定在安全区上方 */
@media (max-width: 1023px) {
  html:has(:is(
    #imageToPromptModal,
    #gptImageModal,
    #videoClipModal
  ):not(.hidden)) {
    overflow: hidden;
  }

  html:has(:is(
    #imageToPromptModal,
    #gptImageModal,
    #videoClipModal
  ):not(.hidden)) .stitch-bottom-nav {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
  }

  html[data-style] :is(
    #imageToPromptModal,
    #gptImageModal,
    #videoClipModal
  ) {
    position: fixed !important;
    inset: 0 !important;
    z-index: 90 !important;
    align-items: stretch !important;
    justify-content: flex-start !important;
    padding: 0 !important;
    overflow: hidden !important;
  }

  html[data-style] :is(
    #imageToPromptModal,
    #gptImageModal,
    #videoClipModal
  ) .hs-tool-modal-panel {
    width: 100%;
    height: 100vh;
    height: 100dvh;
    height: var(--hs-mobile-tool-height, 100dvh);
    max-height: 100vh !important;
    max-height: 100dvh !important;
    max-height: var(--hs-mobile-tool-height, 100dvh) !important;
    margin: 0 !important;
    padding: 14px 14px 0 !important;
    overflow-x: hidden !important;
    overflow-y: auto !important;
    overscroll-behavior: contain;
    border-width: 0 !important;
    border-radius: 0 !important;
    -webkit-overflow-scrolling: touch;
  }

  html[data-style] :is(
    #imageToPromptModal,
    #gptImageModal,
    #videoClipModal
  ) .hs-tool-modal-header {
    position: sticky;
    top: -14px;
    z-index: 30;
    margin: -14px -14px 0 !important;
    padding: 13px 14px 12px !important;
    box-shadow: 0 8px 22px color-mix(in srgb, var(--hs-bg-deep) 28%, transparent);
  }

  html[data-style] :is(
    #imageToPromptModal,
    #gptImageModal,
    #videoClipModal
  ) .hs-mobile-action-dock {
    position: -webkit-sticky;
    position: sticky;
    bottom: 0;
    z-index: 20;
    display: flex;
    justify-content: center;
    margin-inline: -14px;
    padding: 10px 14px calc(10px + env(safe-area-inset-bottom, 0px));
    border-top: 1px solid var(--hs-border);
    background: color-mix(in srgb, var(--hs-surface) 94%, transparent);
    box-shadow: 0 -12px 30px rgba(0, 0, 0, 0.22);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
  }

  html[data-style] :is(
    #imageToPromptModal,
    #gptImageModal,
    #videoClipModal
  ) .hs-mobile-action-dock > .hs-tool-primary-action {
    width: min(100%, 680px);
    min-height: 50px;
    margin: 0 auto;
    justify-content: center;
  }

  html[data-style] #imageToPromptModal #uploadArea {
    max-height: 220px;
  }

  html[data-style] #imageToPromptModal #promptResult {
    min-height: 170px;
  }

  html[data-style] #gptImageModal #gptImagePrompt {
    min-height: 120px;
  }

  html[data-style] #gptImageModal #gptImageResultBox {
    min-height: 280px;
  }

  html[data-style] #videoClipModal #videoClipResultBox {
    margin-bottom: 4px;
  }
}

/* 兼容不支持 :has() / 视口识别异常的手机浏览器：由 JS 显式切换 */
html.hs-tool-modal-open,
html.hs-tool-modal-open body {
  overflow: hidden !important;
}

html.hs-tool-modal-open .stitch-bottom-nav,
html.hs-tool-modal-open .hs-site-beian-footer {
  display: none !important;
}

html.hs-mobile-tool-ui[data-style] :is(
  #imageToPromptModal,
  #gptImageModal,
  #videoClipModal
) {
  position: fixed !important;
  inset: 0 !important;
  z-index: 90 !important;
  align-items: stretch !important;
  justify-content: flex-start !important;
  padding: 0 !important;
  overflow: hidden !important;
}

html.hs-mobile-tool-ui[data-style] :is(
  #imageToPromptModal,
  #gptImageModal,
  #videoClipModal
) .hs-tool-modal-panel {
  width: 100%;
  height: 100vh;
  height: 100dvh;
  height: var(--hs-mobile-tool-height, 100dvh);
  max-height: 100vh !important;
  max-height: 100dvh !important;
  max-height: var(--hs-mobile-tool-height, 100dvh) !important;
  margin: 0 !important;
  padding: 14px 14px 0 !important;
  overflow-x: hidden !important;
  overflow-y: auto !important;
  overscroll-behavior: contain;
  border-width: 0 !important;
  border-radius: 0 !important;
  -webkit-overflow-scrolling: touch;
}

html.hs-mobile-tool-ui[data-style] :is(
  #imageToPromptModal,
  #gptImageModal,
  #videoClipModal
) .hs-tool-modal-header {
  position: sticky;
  top: -14px;
  z-index: 30;
  margin: -14px -14px 0 !important;
  padding: 13px 14px 12px !important;
  box-shadow: 0 8px 22px color-mix(in srgb, var(--hs-bg-deep) 28%, transparent);
}

html.hs-mobile-tool-ui[data-style] :is(
  #imageToPromptModal,
  #gptImageModal,
  #videoClipModal
) .hs-mobile-action-dock {
  position: -webkit-sticky;
  position: sticky;
  bottom: 0;
  z-index: 20;
  display: flex;
  justify-content: center;
  margin-inline: -14px;
  padding: 10px 14px calc(10px + env(safe-area-inset-bottom, 0px));
  border-top: 1px solid var(--hs-border);
  background: color-mix(in srgb, var(--hs-surface) 94%, transparent);
  box-shadow: 0 -12px 30px rgba(0, 0, 0, 0.22);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
}

html.hs-mobile-tool-ui[data-style] :is(
  #imageToPromptModal,
  #gptImageModal,
  #videoClipModal
) .hs-mobile-action-dock > .hs-tool-primary-action {
  width: min(100%, 680px);
  min-height: 50px;
  margin: 0 auto;
  justify-content: center;
}

/* 反推工具：保留独立操作栏，同时允许内容自然上下滑动 */
html.hs-mobile-tool-ui[data-style] #imageToPromptModal .hs-tool-modal-panel {
  padding-bottom: 14px !important;
  overflow-y: auto !important;
  touch-action: pan-y;
}

html.hs-mobile-tool-ui[data-style] #imageToPromptModal .hs-prompt-workspace,
html.hs-mobile-tool-ui[data-style] #imageToPromptModal .hs-prompt-workspace > div {
  flex: 0 0 auto;
  min-height: auto !important;
}

html.hs-mobile-tool-ui[data-style] #imageToPromptModal .hs-mobile-action-dock {
  position: relative !important;
  bottom: auto;
}

/* ===== 侧栏收起：图标轨（覆盖旧规则 + 强藏文字） ===== */
@media (min-width: 1024px) {
  html.hs-sidebar-collapsed {
    --hs-sidebar-w: 72px !important;
  }
  html.hs-sidebar-collapsed #desktopSidebar,
  html.hs-sidebar-collapsed #desktopSidebar.stitch-sidebar,
  html.hs-sidebar-collapsed .stitch-sidebar.is-collapsed {
    display: flex !important;
    width: 72px !important;
    min-width: 72px !important;
    max-width: 72px !important;
    overflow: hidden !important;
    visibility: visible !important;
    opacity: 1 !important;
    pointer-events: auto !important;
    transform: none !important;
  }
  html.hs-sidebar-collapsed #desktopSidebar .stitch-sidebar-brand-text,
  html.hs-sidebar-collapsed #desktopSidebar .stitch-nav-label,
  html.hs-sidebar-collapsed .stitch-sidebar-brand-text,
  html.hs-sidebar-collapsed .stitch-nav-label,
  html[data-style].hs-sidebar-collapsed #desktopSidebar .stitch-sidebar-brand-text,
  html[data-style].hs-sidebar-collapsed #desktopSidebar .stitch-nav-label {
    display: none !important;
    visibility: hidden !important;
    width: 0 !important;
    max-width: 0 !important;
    height: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
    overflow: hidden !important;
    font-size: 0 !important;
    line-height: 0 !important;
    color: transparent !important;
  }
  html.hs-sidebar-collapsed #desktopSidebar .stitch-sidebar-brand .logo,
  html[data-style].hs-sidebar-collapsed #desktopSidebar .stitch-sidebar-brand .logo {
    display: none !important;
  }
  html.hs-sidebar-collapsed #desktopSidebar .stitch-sidebar-brand {
    justify-content: center !important;
    padding-left: 8px !important;
    padding-right: 8px !important;
  }
  html.hs-sidebar-collapsed #desktopSidebar .stitch-sidebar-toggle {
    margin-left: 0 !important;
  }
  html.hs-sidebar-collapsed #desktopSidebar .stitch-nav-item {
    justify-content: center !important;
    gap: 0 !important;
  }
  html.hs-sidebar-collapsed .stitch-app-main {
    margin-left: 72px !important;
  }
  html.hs-sidebar-collapsed .hs-site-beian-footer {
    left: 72px !important;
  }
}
