/**
 * 站点视觉增强层 — 色系不变，加强层次/阴影/AI 气泡；由 _middleware.js 注入。
 */
html.staging-visual-rich {
  --line: rgba(23, 32, 51, 0.14);
  --paper: rgba(255, 255, 255, 0.94);
  --shadow: 0 28px 72px rgba(84, 54, 25, 0.17);
  --shadow-soft: 0 14px 36px rgba(84, 54, 25, 0.11);
  --shadow-card: 0 18px 44px rgba(17, 24, 39, 0.09);
  --surface-highlight: inset 0 1px 0 rgba(255, 255, 255, 0.92);
  --surface-depth: inset 0 -1px 0 rgba(23, 32, 51, 0.04);
}

html.staging-visual-rich body {
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  background:
    radial-gradient(circle at 12% 6%, rgba(236, 72, 153, 0.17), transparent 34%),
    radial-gradient(circle at 90% 0%, rgba(249, 115, 22, 0.15), transparent 36%),
    radial-gradient(ellipse 130% 70% at 50% 108%, rgba(236, 72, 153, 0.07), transparent 58%),
    linear-gradient(180deg, #fff8f2 0%, var(--bg) 46%, #ffffff 100%);
}

html.staging-visual-rich body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  opacity: 0.28;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.5'/%3E%3C/svg%3E");
  background-size: 160px 160px;
  mix-blend-mode: multiply;
}

/* 画像素描嵌入 iframe：透明底 + 无噪点，避免卡片下出现渐变接缝 */
html.staging-visual-rich.page-pixel-sketch-embed-root,
html.staging-visual-rich.page-pixel-sketch-embed-root body {
  background: transparent !important;
}

html.staging-visual-rich.page-pixel-sketch-embed-root body::before {
  display: none !important;
  content: none !important;
  opacity: 0 !important;
}

html.staging-visual-rich .poe-app-shell,
html.staging-visual-rich .preview-shell,
html.staging-visual-rich .preview-nav {
  position: relative;
  z-index: 1;
}

/* —— 导航 —— */
html.staging-visual-rich .preview-nav {
  background: rgba(255, 248, 242, 0.92);
  border-bottom-color: rgba(23, 32, 51, 0.12);
  box-shadow: 0 10px 28px rgba(84, 54, 25, 0.06);
  backdrop-filter: blur(22px) saturate(1.08);
}

html.staging-visual-rich .brand-mark,
html.staging-visual-rich .poe-brand__mark,
html.staging-visual-rich .poe-logo__mark {
  box-shadow:
    var(--surface-highlight),
    0 14px 28px rgba(236, 72, 153, 0.32);
}

html.staging-visual-rich .preview-nav-auth__btn--primary,
html.staging-visual-rich .btn-primary {
  box-shadow:
    var(--surface-highlight),
    0 14px 32px rgba(236, 72, 153, 0.28);
}

html.staging-visual-rich .preview-nav-auth__btn--outline,
html.staging-visual-rich .btn:not(.btn-primary):not(.btn-green) {
  background: rgba(255, 255, 255, 0.96);
  border-color: rgba(23, 32, 51, 0.12);
  box-shadow: var(--surface-highlight), var(--shadow-card);
}

/* 深色 CTA 带上的次按钮需半透明白，不能沿用全局白底 */
html.staging-visual-rich .cta-band .btn:not(.btn-primary) {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  border-color: rgba(255, 255, 255, 0.18);
  box-shadow: none;
}

/* —— Poe 侧栏 —— */
html.staging-visual-rich .poe-sidebar {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.98) 0%, rgba(255, 251, 246, 0.96) 100%);
  border-right-color: rgba(23, 32, 51, 0.12);
  box-shadow:
    6px 0 32px rgba(84, 54, 25, 0.08),
    inset -1px 0 0 rgba(255, 255, 255, 0.6);
  backdrop-filter: blur(16px) saturate(1.05);
}

html.staging-visual-rich .poe-new-chat {
  background: linear-gradient(180deg, #ffffff 0%, #fff9fc 100%);
  border-color: rgba(23, 32, 51, 0.12);
  box-shadow: var(--surface-highlight), 0 10px 26px rgba(236, 72, 153, 0.12);
}

html.staging-visual-rich .poe-search {
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid rgba(23, 32, 51, 0.1);
  box-shadow: var(--surface-highlight), inset 0 1px 2px rgba(23, 32, 51, 0.04);
}

html.staging-visual-rich .poe-thread-row {
  border-radius: 12px;
  /* 去掉 background/box-shadow transition，避免悬停时与侧栏 blur 叠加闪烁 */
}

html.staging-visual-rich .poe-thread-row:hover {
  background: #ffffff;
  box-shadow: inset 0 0 0 1px rgba(236, 72, 153, 0.1);
}

html.staging-visual-rich .poe-thread-row.is-active {
  background: #fff1f7;
  box-shadow: inset 0 0 0 1px rgba(236, 72, 153, 0.16);
}

html.staging-visual-rich .poe-sidebar__links a,
html.staging-visual-rich .poe-sidebar__links .poe-sidebar__link {
  border: 1px solid transparent;
  box-shadow: none;
}

html.staging-visual-rich .poe-sidebar__links a:hover,
html.staging-visual-rich .poe-sidebar__links .poe-sidebar__link:hover {
  background: rgba(255, 255, 255, 0.85);
  border-color: rgba(23, 32, 51, 0.08);
  box-shadow: var(--surface-highlight), 0 6px 16px rgba(84, 54, 25, 0.06);
}

html.staging-visual-rich .poe-sidebar__links a.is-active {
  background: linear-gradient(180deg, #fff5fa 0%, #ffffff 100%);
  border-color: rgba(236, 72, 153, 0.22);
  box-shadow: var(--surface-highlight), 0 8px 20px rgba(236, 72, 153, 0.1);
}

html.staging-visual-rich .poe-sidebar-collapse,
html.staging-visual-rich .poe-sidebar-expand {
  background: linear-gradient(180deg, #ffffff, #fff8fb);
  border-color: rgba(23, 32, 51, 0.12);
  box-shadow: var(--surface-highlight), 0 8px 18px rgba(84, 54, 25, 0.08);
}

/* —— 首页 / 工具卡片 —— */
html.staging-visual-rich .poe-bot-card__icon {
  box-shadow:
    var(--surface-highlight),
    0 14px 28px rgba(84, 54, 25, 0.18);
  border: 1px solid rgba(255, 255, 255, 0.22);
}

html.staging-visual-rich .poe-bot-card__name {
  font-weight: 700;
  color: #374151;
}

/* —— 输入框 / Composer —— */
html.staging-visual-rich .poe-composer__box {
  background: linear-gradient(180deg, #ffffff 0%, #fffbf8 100%);
  border-color: rgba(23, 32, 51, 0.14);
  box-shadow:
    var(--surface-highlight),
    var(--surface-depth),
    0 16px 40px rgba(84, 54, 25, 0.12);
}

html.staging-visual-rich .poe-composer__model {
  background: linear-gradient(180deg, #ffffff, #fff5fa);
  border-color: rgba(236, 72, 153, 0.24);
  box-shadow: var(--surface-highlight), 0 4px 12px rgba(236, 72, 153, 0.08);
}

html.staging-visual-rich .poe-composer__send {
  box-shadow:
    var(--surface-highlight),
    0 10px 24px rgba(236, 72, 153, 0.28);
}

html.staging-visual-rich .poe-composer-model-menu {
  border-color: rgba(23, 32, 51, 0.1);
  box-shadow: 0 22px 56px rgba(17, 24, 39, 0.16);
  scrollbar-gutter: stable;
  isolation: isolate;
}

/* 内测：模型下拉悬停稳定（避免滚动条挤宽、transform 命中偏移、夜间选中态跳色） */
html.staging-visual-rich .poe-composer-model-menu__item {
  transition: none;
  margin: 1px 0;
}

html.staging-visual-rich .poe-composer-model-menu__item:hover {
  background: rgba(236, 72, 153, 0.1);
}

html.theme-night.staging-visual-rich .poe-composer-model-menu__item.is-active {
  background: rgba(236, 72, 153, 0.16);
}

html.theme-night.staging-visual-rich .poe-composer-model-menu__item.is-active .poe-composer-model-menu__label {
  color: #fbcfe8;
}

html.theme-night.staging-visual-rich .poe-composer-model-menu__item:hover,
html.theme-night.staging-visual-rich .poe-composer-model-menu__item.is-active:hover {
  background: rgba(236, 72, 153, 0.24);
}

html.theme-night.staging-visual-rich .poe-composer-model-menu__item.is-active:hover .poe-composer-model-menu__label {
  color: #fce7f3;
}

/* —— 聊天区 —— */
html.staging-visual-rich .poe-chat-head {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(255, 251, 247, 0.94));
  border-bottom-color: rgba(23, 32, 51, 0.12);
  box-shadow: 0 8px 24px rgba(84, 54, 25, 0.05);
}

html.staging-visual-rich .poe-app .message.user .bubble {
  box-shadow:
    var(--surface-highlight),
    0 12px 28px rgba(236, 72, 153, 0.28);
}

html.staging-visual-rich .poe-app .message.ai .message-body--ai {
  max-width: min(calc(var(--poe-content-width) * 0.92), 100%);
}

html.staging-visual-rich .poe-app .message.ai .bubble.ai-rich {
  display: grid;
  gap: 10px;
  max-width: min(680px, 100%);
  padding: 14px 16px;
  white-space: normal;
  font-size: 15px;
  line-height: 1.78;
  letter-spacing: 0.01em;
  color: #243044;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.99) 0%, rgba(255, 251, 246, 0.96) 100%),
    radial-gradient(circle at 100% 0%, rgba(236, 72, 153, 0.06), transparent 38%);
  border: 1px solid rgba(23, 32, 51, 0.11);
  border-radius: 6px 18px 18px 18px;
  box-shadow:
    var(--surface-highlight),
    var(--surface-depth),
    0 14px 32px rgba(84, 54, 25, 0.1);
}

html.staging-visual-rich .poe-app .message.ai .bubble.ai-rich .ai-paragraph,
html.staging-visual-rich .poe-app .message.ai .bubble.ai-rich .ai-list,
html.staging-visual-rich .poe-app .message.ai .bubble.ai-rich .ai-list-line {
  color: #243044;
}

html.staging-visual-rich .poe-app .message-assistant-head {
  margin-bottom: 2px;
}

html.staging-visual-rich .poe-app .message-assistant-head__avatar {
  box-shadow: 0 6px 14px rgba(236, 72, 153, 0.24);
}

html.staging-visual-rich .poe-app .message.ai .bubble.ai-rich .ai-callout,
html.staging-visual-rich .poe-app .message.ai .bubble.ai-rich .ai-quote-block {
  background: rgba(255, 255, 255, 0.72);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.92);
}

html.staging-visual-rich .bubble {
  border: 1px solid rgba(23, 32, 51, 0.06);
  box-shadow: var(--surface-highlight), var(--shadow-card);
}

/* —— 内容页卡片 / Hero —— */
html.staging-visual-rich .card,
html.staging-visual-rich .hero-card,
html.staging-visual-rich .value-panel {
  background: linear-gradient(165deg, rgba(255, 255, 255, 0.98) 0%, rgba(255, 250, 245, 0.94) 100%);
  border-color: rgba(23, 32, 51, 0.12);
  box-shadow:
    var(--surface-highlight),
    var(--surface-depth),
    var(--shadow-card);
}

html.staging-visual-rich .hero-card {
  border-color: rgba(236, 72, 153, 0.2);
  box-shadow:
    var(--surface-highlight),
    0 28px 72px rgba(84, 54, 25, 0.14);
}

html.staging-visual-rich .hero h1,
html.staging-visual-rich .section-title {
  letter-spacing: -0.045em;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.8);
}

html.staging-visual-rich .eyebrow,
html.staging-visual-rich .tag,
html.staging-visual-rich .tool-pill {
  border: 1px solid rgba(236, 72, 153, 0.12);
  box-shadow: var(--surface-highlight);
}

html.staging-visual-rich .compare,
html.staging-visual-rich .client-download-panel {
  border-color: rgba(23, 32, 51, 0.12);
  box-shadow: var(--surface-highlight), var(--shadow-soft);
}

/* —— 嵌入面板背景 —— */
html.staging-visual-rich .poe-member-panel,
html.staging-visual-rich .poe-translate-panel,
html.staging-visual-rich .poe-rpa-panel,
html.staging-visual-rich .poe-fbreply-panel,
html.staging-visual-rich .poe-tools-panel,
html.staging-visual-rich .poe-account-panel,
html.staging-visual-rich .poe-embed-panel {
  background: linear-gradient(180deg, rgba(255, 252, 248, 0.72) 0%, rgba(255, 255, 255, 0.58) 100%);
}

/* —— 弹层 —— */
html.staging-visual-rich .poe-prompt-modal__panel,
html.staging-visual-rich .vault-modal__panel {
  border: 1px solid rgba(23, 32, 51, 0.1);
  box-shadow:
    var(--surface-highlight),
    0 34px 90px rgba(84, 54, 25, 0.18);
}

/* —— 内测：用户中心用量仪表盘嵌入高度贴合 —— */
html.staging-visual-rich .poe-account-subnav {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  width: min(1180px, calc(100% - 20px));
  max-width: min(1180px, calc(100% - 20px));
  margin: 0 auto;
  padding: 0 16px 10px;
  border-bottom: 1px solid rgba(23, 32, 51, 0.06);
  background: rgba(255, 255, 255, 0.42);
  flex-shrink: 0;
  box-sizing: border-box;
}

html.staging-visual-rich .poe-account-subnav__btn {
  border: 1px solid rgba(23, 32, 51, 0.08);
  border-radius: 999px;
  padding: 8px 14px;
  background: rgba(255, 255, 255, 0.72);
  color: #475569;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

html.staging-visual-rich .poe-account-subnav__btn:hover,
html.staging-visual-rich .poe-account-subnav__btn.is-active {
  color: #be185d;
  border-color: rgba(225, 29, 138, 0.22);
  background: linear-gradient(135deg, #fff1f7, #fff7ed);
}

/* 内测夜间：用户中心 Tab 与深色面板统一，避免白底粉字冲突 */
html.theme-night.staging-visual-rich .poe-account-subnav {
  background: linear-gradient(180deg, rgba(22, 27, 36, 0.98), rgba(18, 22, 30, 0.92));
  border-bottom-color: rgba(255, 255, 255, 0.08);
}

html.theme-night.staging-visual-rich .poe-account-subnav__btn {
  background: var(--night-bg-input, rgba(255, 255, 255, 0.06));
  border-color: rgba(255, 255, 255, 0.12);
  color: #cbd5e1;
  box-shadow: none;
}

html.theme-night.staging-visual-rich .poe-account-subnav__btn:hover:not(.is-active) {
  background: rgba(255, 255, 255, 0.09);
  border-color: rgba(236, 72, 153, 0.28);
  color: #e2e8f0;
}

html.theme-night.staging-visual-rich .poe-account-subnav__btn.is-active {
  background: linear-gradient(135deg, var(--brand, #ec4899), var(--brand-2, #f97316));
  border-color: transparent;
  color: #fff;
  box-shadow: none;
}

html.staging-visual-rich .poe-account-panel.is-usage-fit {
  height: 100%;
  min-height: 0;
  overflow: hidden;
}

html.staging-visual-rich .poe-account-inner.is-usage-fit {
  height: auto !important;
  max-height: 100% !important;
  min-height: 0 !important;
  overflow-x: hidden !important;
  overflow-y: auto !important;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  padding-bottom: 8px !important;
  scrollbar-gutter: stable;
}

html.staging-visual-rich .poe-account-inner.is-usage-fit .poe-account-frame {
  flex: 0 0 auto !important;
  min-height: 0 !important;
  overflow: hidden;
}

html.staging-visual-rich .poe-chat-more-menu {
  border-color: rgba(23, 32, 51, 0.1);
  box-shadow: 0 18px 44px rgba(17, 24, 39, 0.14);
}
