/* ===== Design System ===== */
:root {
  --bg-base: #060818;
  --bg-surface: #0c1024;
  --bg-card: rgba(255, 255, 255, 0.03);
  --bg-card-hover: rgba(255, 255, 255, 0.06);
  --bg-glass: rgba(12, 16, 36, 0.6);
  --border: rgba(255, 255, 255, 0.08);
  --border-strong: rgba(255, 255, 255, 0.15);
  --border-accent: rgba(0, 212, 255, 0.3);
  --text-primary: #e8ecf4;
  --text-secondary: #8b95b0;
  /* 由 #5a6478 提亮至 #737e94：原值在深色底上仅 3.34:1，未达 WCAG AA 4.5:1 */
  --text-muted: #737e94;
  --accent-cyan: #00d4ff;
  --accent-purple: #7c3aed;
  --accent-green: #10b981;
  --accent-amber: #f59e0b;
  --accent-red: #ef4444;
  --gradient-primary: linear-gradient(135deg, #00d4ff 0%, #7c3aed 100%);
  --gradient-cyan: linear-gradient(135deg, #00d4ff 0%, #0ea5e9 100%);
  --gradient-purple: linear-gradient(135deg, #7c3aed 0%, #a855f7 100%);
  --gradient-green: linear-gradient(135deg, #10b981 0%, #34d399 100%);
  --gradient-text: linear-gradient(135deg, #00d4ff 0%, #a855f7 100%);
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 20px;
  --shadow-glow: 0 0 40px rgba(0, 212, 255, 0.15);
  --shadow-card: 0 4px 24px rgba(0, 0, 0, 0.3);
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'PingFang SC', sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', 'SF Mono', Consolas, monospace;

  /* ---- 装饰层（原为硬编码，改为变量以便双主题切换）---- */
  --glow-1: rgba(0, 212, 255, 0.08);
  --glow-2: rgba(124, 58, 237, 0.08);
  --grid-line: rgba(255, 255, 255, 0.015);
  --nav-bg: rgba(6, 8, 24, 0.7);
  --code-bg: #0a0d1a;
}

/* ============================================================
   浅色主题（data-theme="light"）
   - 所有强调色统一降饱和/加深，保证白底上正文对比度 ≥ 4.5:1（WCAG AA）
   - 实测对比度（相对 --bg-base #f4f6fa）：
     text-primary #0f172a ≈ 15.9:1 / text-secondary #475569 ≈ 6.7:1
     text-muted   #5a6781 ≈ 5.3:1 / accent-cyan #0e7490 ≈ 4.95:1
     accent-green #047857 ≈ 5.1:1 / accent-red #b91c1c ≈ 6.0:1
     accent-amber #b45309 ≈ 4.6:1 / accent-purple #6d28d9 ≈ 6.6:1
   ============================================================ */
:root[data-theme="light"] {
  --bg-base: #f4f6fa;
  --bg-surface: #ffffff;
  --bg-card: #ffffff;
  --bg-card-hover: #eef2f8;
  --bg-glass: rgba(255, 255, 255, 0.82);
  --border: rgba(15, 23, 42, 0.14);
  --border-strong: rgba(15, 23, 42, 0.24);
  --border-accent: rgba(14, 116, 144, 0.35);

  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-muted: #5a6781;

  --accent-cyan: #0e7490;
  --accent-purple: #6d28d9;
  --accent-green: #047857;
  --accent-amber: #b45309;
  --accent-red: #b91c1c;

  --gradient-primary: linear-gradient(135deg, #0e7490 0%, #6d28d9 100%);
  --gradient-cyan: linear-gradient(135deg, #0e7490 0%, #0284c7 100%);
  --gradient-purple: linear-gradient(135deg, #6d28d9 0%, #7c3aed 100%);
  --gradient-green: linear-gradient(135deg, #047857 0%, #059669 100%);
  --gradient-text: linear-gradient(135deg, #0e7490 0%, #6d28d9 100%);

  --shadow-glow: 0 0 40px rgba(14, 116, 144, 0.14);
  --shadow-card: 0 4px 24px rgba(15, 23, 42, 0.10);

  /* 浅色下光晕与网格改为极淡的冷色，避免脏灰 */
  --glow-1: rgba(14, 116, 144, 0.06);
  --glow-2: rgba(109, 40, 217, 0.05);
  --grid-line: rgba(15, 23, 42, 0.035);
  --nav-bg: rgba(255, 255, 255, 0.78);
  --code-bg: #eef2f8;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  font-family: var(--font-sans);
  background: var(--bg-base);
  color: var(--text-primary);
  line-height: 1.6;
  font-size: 15px;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

body::before {
  content: '';
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background:
    radial-gradient(ellipse at 20% 0%, var(--glow-1), transparent 50%),
    radial-gradient(ellipse at 80% 100%, var(--glow-2), transparent 50%);
  pointer-events: none;
  z-index: 0;
}

body::after {
  content: '';
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background-image:
    linear-gradient(var(--grid-line) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid-line) 1px, transparent 1px);
  background-size: 40px 40px;
  pointer-events: none;
  z-index: 0;
}

a { color: inherit; text-decoration: none; }

/* ===== Navbar ===== */
.navbar {
  position: fixed; top: 0; left: 0; right: 0;
  z-index: 100;
  padding: 16px 0;
  background: var(--nav-bg);
  backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
  transition: padding 0.3s;
}
.navbar .container {
  max-width: 1200px; margin: 0 auto; padding: 0 24px;
  display: flex; align-items: center; justify-content: space-between;
  position: relative; /* 供移动端主题按钮绝对定位使用 */
}
.nav-logo {
  display: flex; align-items: center; gap: 10px;
  font-size: 18px; font-weight: 700;
}
.nav-logo .logo-icon {
  width: 32px; height: 32px; border-radius: 8px;
  background: var(--gradient-primary);
  display: flex; align-items: center; justify-content: center;
  font-size: 16px; color: #fff;
  box-shadow: 0 0 20px rgba(0, 212, 255, 0.3);
}
.nav-logo .gradient-text {
  background: var(--gradient-text);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  background-clip: text;
}
.nav-links { display: flex; gap: 16px; align-items: center; margin-left: auto; }
.nav-links a {
  font-size: 13px; color: var(--text-secondary);
  transition: color 0.2s; white-space: nowrap;
}
.nav-links a:hover { color: var(--accent-cyan); }
/* margin-left:auto 吸收弹性剩余空间：使「余额/铃铛/控制台/退出」组与右侧主题按钮
   贴合为一组（间距 = 主题按钮的 12px 左距 = .nav-cta 内部 gap），不再被 space-between 拉开 */
.nav-cta { display: flex; gap: 12px; align-items: center; margin-left: auto; }

/* ===== Buttons ===== */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 10px 22px;
  border-radius: var(--radius-sm);
  font-size: 14px; font-weight: 600;
  cursor: pointer; border: none;
  transition: all 0.2s;
  font-family: inherit;
}
.btn-primary {
  background: var(--gradient-primary);
  color: #fff;
  box-shadow: 0 4px 16px rgba(0, 212, 255, 0.3);
}
.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 24px rgba(0, 212, 255, 0.4);
}
.btn-outline {
  background: transparent;
  color: var(--text-primary);
  border: 1px solid var(--border-strong);
}
.btn-outline:hover {
  border-color: var(--accent-cyan);
  color: var(--accent-cyan);
}
.btn-ghost {
  background: var(--bg-card);
  color: var(--text-primary);
  border: 1px solid var(--border);
}
.btn-ghost:hover { background: var(--bg-card-hover); border-color: var(--border-strong); }
.btn-sm { padding: 6px 14px; font-size: 13px; }
.btn-lg { padding: 14px 32px; font-size: 16px; }

/* ===== Layout ===== */
.container { max-width: 1200px; margin: 0 auto; padding: 0 24px; position: relative; z-index: 1; }
section { padding: 80px 0; position: relative; z-index: 1; }
.section-tag {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 14px; border-radius: 20px;
  font-size: 12px; font-weight: 600;
  background: rgba(0, 212, 255, 0.1);
  border: 1px solid var(--border-accent);
  color: var(--accent-cyan);
  margin-bottom: 16px;
}
.section-title {
  font-size: 36px; font-weight: 700;
  letter-spacing: -0.5px; margin-bottom: 12px;
}
.section-subtitle {
  font-size: 17px; color: var(--text-secondary);
  max-width: 640px; margin-bottom: 48px;
}
.gradient-text {
  background: var(--gradient-text);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  background-clip: text;
}
.show-when-logged-in { display: none; }

/* ===== Hero ===== */
.hero {
  min-height: 100vh; display: flex; align-items: center;
  padding-top: 80px;
  position: relative; overflow: hidden;
}
.hero-bg {
  position: absolute; top: 0; left: 0; right: 0; bottom: 0;
  z-index: 0; pointer-events: none;
}
.hero-bg .orb {
  position: absolute; border-radius: 50%;
  filter: blur(80px); opacity: 0.3;
}
.hero-bg .orb-1 {
  width: 400px; height: 400px;
  background: var(--accent-cyan);
  top: 10%; left: -10%;
  animation: float 8s ease-in-out infinite;
}
.hero-bg .orb-2 {
  width: 350px; height: 350px;
  background: var(--accent-purple);
  bottom: 10%; right: -5%;
  animation: float 10s ease-in-out infinite reverse;
}
@keyframes float {
  0%, 100% { transform: translate(0, 0); }
  50% { transform: translate(30px, -30px); }
}
.hero-content { max-width: 820px; }
.hero h1 {
  font-size: 56px; font-weight: 800;
  line-height: 1.15; letter-spacing: -1px;
  margin-bottom: 24px;
}
.hero .subtitle {
  font-size: 20px; color: var(--text-secondary);
  max-width: 620px; margin-bottom: 36px;
  line-height: 1.6;
}
.hero-cta { display: flex; gap: 16px; flex-wrap: wrap; }
.hero-bonus {
  margin-top: 32px;
  display: inline-flex; align-items: center; gap: 16px;
  padding: 16px 24px;
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.1), rgba(239, 68, 68, 0.1));
  border: 1px solid rgba(245, 158, 11, 0.3);
  border-radius: var(--radius-md);
}
.hero-bonus .bonus-icon {
  width: 44px; height: 44px; border-radius: 10px;
  background: linear-gradient(135deg, #f59e0b, #ef4444);
  display: flex; align-items: center; justify-content: center;
  font-size: 22px;
  animation: pulse 2s ease-in-out infinite;
}
@keyframes pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.08); }
}
.hero-bonus .bonus-text strong {
  font-size: 16px; color: var(--accent-amber);
}
.hero-bonus .bonus-text span {
  font-size: 13px; color: var(--text-secondary);
}

/* ===== Stats Bar ===== */
.stats-bar {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 24px;
  padding: 40px 0;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}
.stat-item { text-align: center; }
.stat-val {
  font-size: 36px; font-weight: 800;
  background: var(--gradient-text);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  background-clip: text;
}
.stat-label { font-size: 14px; color: var(--text-secondary); margin-top: 4px; }

/* ===== Feature Grid ===== */
.feature-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
}
.feature-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 28px;
  transition: all 0.3s;
}
.feature-card:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-strong);
  transform: translateY(-2px);
}
.feature-icon {
  width: 48px; height: 48px; border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 22px; margin-bottom: 16px;
}
.feature-card h3 { font-size: 17px; font-weight: 600; margin-bottom: 8px; }
.feature-card p { font-size: 14px; color: var(--text-secondary); }

/* ===== Table ===== */
.model-table-wrapper {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
}
.model-table { width: 100%; border-collapse: collapse; }
.model-table th {
  text-align: left; padding: 14px 20px;
  font-size: 12px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.5px;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
  background: var(--bg-card);
}
.model-table td {
  padding: 14px 20px;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
}
.model-table tr:last-child td { border-bottom: none; }
.model-table tr:hover td { background: rgba(0, 212, 255, 0.03); }
.model-name { font-weight: 600; }
.model-badge {
  display: inline-block; padding: 2px 8px;
  border-radius: 4px; font-size: 11px; font-weight: 600;
}
.badge-hot { background: rgba(239, 68, 68, 0.15); color: #f87171; }
.badge-new { background: rgba(16, 185, 129, 0.15); color: #34d399; }
.badge-pro { background: rgba(124, 58, 237, 0.15); color: #a78bfa; }
.price-cell { font-family: var(--font-mono); font-size: 13px; color: var(--text-secondary); }
.price-cell strong { color: var(--accent-cyan); }

/* ===== Architecture ===== */
.arch-diagram {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 40px;
  position: relative;
}
.arch-layer {
  display: flex; align-items: center; gap: 16px;
  padding: 16px 20px;
  border-radius: var(--radius-sm);
  margin-bottom: 12px;
  border: 1px solid var(--border);
}
.arch-layer-label {
  min-width: 120px; font-weight: 600; font-size: 14px;
}
.arch-layer-modules {
  display: flex; gap: 8px; flex-wrap: wrap;
}
.arch-module {
  padding: 4px 12px; border-radius: 6px;
  font-size: 12px; color: var(--text-secondary);
  background: var(--bg-card-hover);
  border: 1px solid var(--border);
}
.arch-arrow {
  text-align: center; color: var(--text-muted);
  font-size: 18px; margin: 4px 0;
}

/* ===== Pricing ===== */
.pricing-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
}
.pricing-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 32px;
  position: relative;
  transition: all 0.3s;
}
.pricing-card:hover { border-color: var(--border-strong); }
.pricing-card.featured {
  border-color: var(--border-accent);
  box-shadow: var(--shadow-glow);
}
.pricing-card.featured::before {
  content: 'POPULAR';
  position: absolute; top: -10px; right: 24px;
  padding: 2px 12px; border-radius: 20px;
  font-size: 11px; font-weight: 700;
  background: var(--gradient-primary); color: #fff;
}
.pricing-card h3 { font-size: 18px; font-weight: 600; margin-bottom: 8px; }
.pricing-card .desc { font-size: 13px; color: var(--text-secondary); margin-bottom: 20px; }
.pricing-card .price { font-size: 42px; font-weight: 800; }
.pricing-card .price .unit { font-size: 14px; color: var(--text-secondary); font-weight: 400; }
.pricing-card ul {
  list-style: none; margin: 24px 0;
}
.pricing-card li {
  padding: 8px 0; font-size: 14px; color: var(--text-secondary);
  display: flex; align-items: center; gap: 8px;
}
.pricing-card li::before {
  content: ''; width: 16px; height: 16px; border-radius: 50%;
  background: rgba(16, 185, 129, 0.2);
  flex-shrink: 0;
}

/* ===== Promotions (logged-in CTA) ===== */
.promo-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
}
.promo-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 28px 22px;
  position: relative;
  transition: all 0.3s;
  text-align: center;
}
.promo-card:hover {
  border-color: var(--border-strong);
  transform: translateY(-4px);
}
.promo-badge {
  position: absolute; top: -10px; right: 18px;
  padding: 3px 12px; border-radius: 20px;
  font-size: 11px; font-weight: 700;
  color: #fff;
}
.promo-badge-hot { background: linear-gradient(135deg, #ff6b6b, #f43f5e); }
.promo-badge-new { background: linear-gradient(135deg, #06b6d4, #0ea5e9); }
.promo-badge-cash { background: linear-gradient(135deg, #10b981, #22c55e); }
.promo-badge-edu { background: linear-gradient(135deg, #8b5cf6, #a855f7); }
.promo-icon {
  width: 56px; height: 56px;
  margin: 8px auto 16px;
  background: rgba(0, 212, 255, 0.08);
  border-radius: 16px;
  display: flex; align-items: center; justify-content: center;
  font-size: 28px;
}
.promo-card h3 { font-size: 16px; font-weight: 700; margin-bottom: 10px; }
.promo-card p {
  font-size: 13px; color: var(--text-secondary);
  line-height: 1.6; margin-bottom: 20px; min-height: 62px;
}

/* ===== Footer ===== */
.footer {
  border-top: 1px solid var(--border);
  padding: 48px 0 32px;
  position: relative; z-index: 1;
}
.footer-grid {
  display: grid; grid-template-columns: 2fr 1fr 1fr 1fr 1fr;
  gap: 40px; margin-bottom: 32px;
}
.footer-brand p { font-size: 13px; color: var(--text-secondary); margin-top: 12px; max-width: 280px; }
.footer-col h4 { font-size: 13px; font-weight: 600; margin-bottom: 12px; color: var(--text-primary); }
.footer-col a { display: block; font-size: 13px; color: var(--text-secondary); padding: 4px 0; }
.footer-col a:hover { color: var(--accent-cyan); }
/* 首帧登录态预判（head 内联脚本写入 html.ch-logged）：
   已登录用户刷新/加载时，在 JS 执行前就隐藏访客促销区块（注册送红包等），
   避免「未登录内容闪一下再被 JS 隐藏」的闪烁。JS 对账后由 applyGuestVisibility 维护该 class。 */
html.ch-logged .hide-when-logged-in { display: none !important; }

/* 登录版内容：默认隐藏；已登录时首帧即显示（配合服务端注入的 html.ch-logged，
   避免登录用户刷新时先出现空白/游客内容，再由 JS 补上登录版造成的跳动）。 */
.show-when-logged-in { display: none; }
html.ch-logged .show-when-logged-in { display: block; }

/* 红包活动首帧状态（由服务端在 <head> 注入 html.ch-rp-off）：
   活动未生效（后台已关闭 / 金额为 0 / 不在有效期）或用户已登录时，
   [data-redpacket-hide] 促销块必须在首帧就隐藏 —— 否则页面会先画出
   「新用户注册即送 N 元红包」，等 JS 异步拉到 /api/activity 后才消失（刷新闪烁）。
   判定与 js/main.js 的 CH.redpacket.apply() 保持一致。 */
html.ch-rp-off [data-redpacket-hide] { display: none !important; }

.footer-bottom {
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: center;
  gap: 8px 24px;
  padding-top: 24px; border-top: 1px solid var(--border);
  font-size: 13px; color: var(--text-muted);
  line-height: 20px;
}
/* 三列网格：© 左 · 备案行居中 · Powered 右，全部同一基线（显式定位避免自动换行） */
.footer-bottom > span:first-child { grid-column: 1; grid-row: 1; text-align: left; }
.footer-bottom .footer-icp { grid-column: 2; grid-row: 1; margin-top: 0; white-space: nowrap; }
.footer-bottom > span:last-of-type { grid-column: 3; grid-row: 1; text-align: right; }
.footer-icp {
  margin-top: 16px;
  text-align: center;
  font-size: 13px;
  color: var(--text-muted);
  line-height: 20px;
}
.footer-icp-row {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  flex-wrap: wrap;
}
.footer-icp-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--text-secondary);
  text-decoration: none;
  transition: color 0.2s;
}
.footer-icp-link:hover {
  color: var(--accent-cyan);
  text-decoration: underline;
}
.footer-icp-icon {
  height: 18px;
  width: auto;
  object-fit: contain;
  vertical-align: middle;
  flex-shrink: 0;
}
.footer-icp-sep {
  color: var(--border-strong);
  user-select: none;
}
@media (max-width: 600px) {
  .footer-icp-row { gap: 10px; }
}


/* ===== Dashboard ===== */
.dash-layout {
  display: flex; min-height: 100vh; padding-top: 64px;
}
.dash-sidebar {
  width: 240px; flex-shrink: 0;
  border-right: 1px solid var(--border);
  padding: 24px 16px;
  position: fixed; top: 64px; bottom: 0; left: 0;
  overflow-y: auto;
  background: var(--bg-surface);
  z-index: 50;
}
.dash-nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 14px; border-radius: var(--radius-sm);
  font-size: 14px; color: var(--text-secondary);
  margin-bottom: 4px; cursor: pointer;
  transition: all 0.2s;
}
.dash-nav-item:hover { background: var(--bg-card); color: var(--text-primary); }
.dash-nav-item.active {
  background: rgba(0, 212, 255, 0.1);
  color: var(--accent-cyan);
  border-left: 2px solid var(--accent-cyan);
}
.dash-main {
  flex: 1; margin-left: 240px;
  padding: 32px;
  max-width: calc(100% - 240px);
  min-height: calc(100vh - 64px);
}

/* ===== Unified Left Sidebar (billing/invoice/recharge) ===== */
.dash-nav-group {
  border-radius: var(--radius-md);
  margin-bottom: 4px;
  overflow: hidden;
}
.dash-nav-group.active,
.dash-nav-group.expanded {
  background: var(--bg-card);
}
.dash-nav-group-toggle {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-size: 14px; color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.2s;
}
.dash-nav-group-toggle:hover { background: var(--bg-card); color: var(--text-primary); }
.dash-nav-group.active > .dash-nav-group-toggle,
.dash-nav-group.expanded > .dash-nav-group-toggle {
  color: var(--text-primary);
}
.dash-nav-sub {
  padding: 2px 8px 8px 40px;
  display: none;
}
.dash-nav-group.expanded > .dash-nav-sub,
.dash-nav-group.active > .dash-nav-sub {
  display: block;
}
.dash-nav-subitem {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  font-size: 14px; color: var(--text-secondary);
  margin-bottom: 2px;
  transition: all 0.2s;
}
.dash-nav-subitem:hover { background: var(--bg-card); color: var(--text-primary); }
.dash-nav-subitem.active {
  background: rgba(0, 212, 255, 0.12);
  color: var(--accent-cyan);
  border-left: 3px solid var(--accent-cyan);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}
.dash-nav-subitem.active:hover {
  background: rgba(0, 212, 255, 0.18);
}

/* 旧 dash-nav-item 保持统一高亮 */
.dash-nav-item.active {
  background: rgba(0, 212, 255, 0.12);
  border-left: 3px solid var(--accent-cyan);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}
.dash-header {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 28px;
}
.dash-title { font-size: 24px; font-weight: 700; }
.dash-subtitle { font-size: 14px; color: var(--text-secondary); }

.dash-cards {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px;
  margin-bottom: 28px;
}
.dash-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 20px;
}
.dash-card .label { font-size: 13px; color: var(--text-secondary); }
.dash-card .value { font-size: 28px; font-weight: 700; margin: 6px 0; }
.dash-card .change { font-size: 12px; }
.change-up { color: var(--accent-green); }
.change-down { color: var(--accent-red); }
.dash-card .icon {
  width: 36px; height: 36px; border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-size: 16px; float: right;
}

.dash-panel {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 24px;
  margin-bottom: 20px;
}
.dash-panel-header {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 20px;
}
.dash-panel-title { font-size: 16px; font-weight: 600; }

/* ===== Forms ===== */
.form-group { margin-bottom: 20px; }
.form-label {
  display: block; font-size: 13px; font-weight: 500;
  margin-bottom: 6px; color: var(--text-primary);
}
.form-input {
  width: 100%; padding: 12px 16px;
  background: var(--bg-base);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 14px; font-family: inherit;
  transition: border-color 0.2s;
}
.form-input:focus {
  outline: none; border-color: var(--accent-cyan);
  box-shadow: 0 0 0 3px rgba(0, 212, 255, 0.1);
}
.form-input::placeholder { color: var(--text-muted); }

/* ===== Auth Page ===== */
.auth-page {
  min-height: 100vh; display: flex;
  padding-top: 64px;
}
.auth-visual {
  flex: 1; display: flex; flex-direction: column;
  justify-content: center; padding: 48px;
  background: linear-gradient(135deg, rgba(0, 212, 255, 0.05), rgba(124, 58, 237, 0.05));
  border-right: 1px solid var(--border);
  position: relative; overflow: hidden;
}
.auth-form-side {
  width: 480px; flex-shrink: 0;
  display: flex; flex-direction: column;
  justify-content: center; padding: 48px;
}
.auth-form { max-width: 360px; margin: 0 auto; width: 100%; }
.auth-form h2 { font-size: 28px; font-weight: 700; margin-bottom: 8px; }
.auth-form .desc { font-size: 14px; color: var(--text-secondary); margin-bottom: 32px; }

.bonus-card {
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.08), rgba(239, 68, 68, 0.08));
  border: 1px solid rgba(245, 158, 11, 0.25);
  border-radius: var(--radius-md);
  padding: 24px; margin-bottom: 24px;
}
.bonus-card .bonus-amount {
  font-size: 42px; font-weight: 800;
  background: linear-gradient(135deg, #f59e0b, #ef4444);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  background-clip: text;
}
.bonus-card .bonus-desc { font-size: 13px; color: var(--text-secondary); margin-top: 4px; }

.benefit-list { list-style: none; }
.benefit-list li {
  display: flex; align-items: flex-start; gap: 12px;
  padding: 12px 0; font-size: 14px; color: var(--text-secondary);
  border-bottom: 1px solid var(--border);
}
.benefit-list li:last-child { border-bottom: none; }
.benefit-list .check {
  width: 20px; height: 20px; border-radius: 50%;
  background: rgba(16, 185, 129, 0.15);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; font-size: 12px; color: var(--accent-green);
}

/* ===== Code Block ===== */
.code-block {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
}
.code-header {
  display: flex; justify-content: space-between; align-items: center;
  padding: 8px 16px;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  font-size: 12px; color: var(--text-secondary);
}
.code-tabs { display: flex; gap: 4px; }
.code-tab {
  padding: 4px 12px; border-radius: 6px;
  font-size: 12px; cursor: pointer;
  color: var(--text-secondary);
  transition: all 0.2s;
}
.code-tab.active { background: var(--bg-card); color: var(--accent-cyan); }
.code-block pre {
  padding: 16px 20px;
  font-family: var(--font-mono);
  font-size: 13px; line-height: 1.6;
  color: #c8d3f5;
  overflow-x: auto;
}
.code-block .k { color: #c792ea; }
.code-block .s { color: #c3e88d; }
.code-block .c { color: #546e7a; font-style: italic; }
.code-block .n { color: #f78c6c; }
.code-block .t { color: #82aaff; }
.code-block .f { color: #ffcb6b; }

/* ===== Tables in dashboard ===== */
.data-table { width: 100%; border-collapse: collapse; }
.data-table th {
  text-align: left; padding: 10px 16px;
  font-size: 12px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.5px;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
}
.data-table td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}
.data-table tr:last-child td { border-bottom: none; }
.status-dot {
  display: inline-block; width: 8px; height: 8px;
  border-radius: 50%; margin-right: 6px;
}
.status-online { background: var(--accent-green); box-shadow: 0 0 8px rgba(16, 185, 129, 0.5); }
.status-degraded { background: var(--accent-amber); }
.status-offline { background: var(--accent-red); }

/* ===== Responsive ===== */
@media (max-width: 968px) {
  .feature-grid, .pricing-grid, .promo-grid { grid-template-columns: repeat(2, 1fr); }
  .stats-bar { grid-template-columns: repeat(2, 1fr); }
  .dash-cards { grid-template-columns: repeat(2, 1fr); }
  .footer-grid { grid-template-columns: 1fr 1fr; }
  .auth-visual { display: none; }
  .auth-form-side { width: 100%; }
  .hero h1 { font-size: 40px; }
  .dash-sidebar { display: none; }
  .dash-main { margin-left: 0; max-width: 100%; }
  /* 移动端：功能链接保持隐藏（与原侧边栏一致）；铃铛作为导航栏直接子元素保持可见，
     导航栏允许换行避免内容被固定栏遮挡，下拉菜单因不在滚动容器内而不会被裁剪 */
  .nav-links { display: none; }
  .navbar .container { flex-wrap: wrap; row-gap: 6px; }
  .nav-cta { margin-left: auto; }
  .dash-layout { padding-top: 112px; }
  .auth-page { padding-top: 112px; }
}

/* ===== Animations ===== */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}
.fade-up { animation: fadeUp 0.6s ease-out; }

/* ===== Toast ===== */
.toast {
  position: fixed; bottom: 32px; right: 32px;
  padding: 16px 24px;
  background: var(--bg-surface);
  border: 1px solid var(--border-accent);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-card);
  z-index: 200;
  display: flex; align-items: center; gap: 12px;
  font-size: 14px;
  transform: translateY(100px); opacity: 0;
  transition: all 0.3s;
}
.toast.show { transform: translateY(0); opacity: 1; }
.toast .toast-icon {
  width: 24px; height: 24px; border-radius: 50%;
  background: var(--accent-green);
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 14px;
}

/* ===== Notification Bell ===== */
.notify-bell-wrap {
  position: relative;
  margin-right: 16px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
}
.notify-bell-wrap.in-cta {
  /* 在 .nav-cta 内部时由 flex gap 控制间距，无需额外右外边距 */
  margin-right: 0;
}
/* 顶部导航栏余额旁的铃铛：紧邻余额值，间距合理，垂直居中 */
.nav-balance,
.dash-balance-wrap {
  white-space: nowrap;
}
.nav-balance .notify-bell-wrap,
.dash-balance-wrap .notify-bell-wrap {
  margin: 0 0 0 8px;
  vertical-align: middle;
}
/* 铃铛直接放在 .nav-cta 内（子页面无余额显示时）：贴近控制台按钮，无额外外边距 */
.nav-cta > .notify-bell-wrap {
  margin-right: 0;
}
.nav-cta > .notify-bell-wrap .notify-bell {
  width: 32px; height: 32px;
  font-size: 16px;
}
.nav-balance .notify-bell,
.dash-balance-wrap .notify-bell {
  width: 30px; height: 30px;
  font-size: 15px;
}
.nav-balance .notify-bell-wrap,
.nav-balance .notify-bell-wrap *,
.dash-balance-wrap .notify-bell-wrap,
.dash-balance-wrap .notify-bell-wrap * {
  flex-shrink: 0;
}
@media (max-width: 600px) {
  /* 窄屏回退：flex 纵向堆叠（绕开桌面 grid 列定位），三行居中 */
  .footer-bottom { display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center; }
  .footer-bottom > span:first-child,
  .footer-bottom > span:last-of-type,
  .footer-bottom .footer-icp { grid-column: auto; grid-row: auto; text-align: center; }
  .footer-bottom .footer-icp { margin-top: 4px; white-space: normal; }
  .nav-balance,
  .dash-balance-wrap {
    font-size: 12px;
  }
  .nav-balance .notify-bell,
  .dash-balance-wrap .notify-bell {
    width: 26px; height: 26px;
    font-size: 13px;
  }
  .nav-balance .notify-bell-wrap,
  .dash-balance-wrap .notify-bell-wrap {
    margin-left: 4px;
  }
}
.notify-bell {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: var(--bg-card);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  color: var(--text-secondary);
  transition: all 0.2s;
  position: relative;
}
.notify-bell:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-strong);
  color: var(--accent-cyan);
}
.notify-bell .bell-icon {
  transition: transform 0.3s;
}
.notify-bell-wrap.active .bell-icon {
  animation: bellRing 0.5s ease-in-out;
}
.notify-badge {
  position: absolute;
  top: 0; right: -2px;
  min-width: 18px; height: 18px;
  background: var(--accent-red);
  color: #fff;
  font-size: 10px; font-weight: 700;
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 5px;
  border: 2px solid var(--bg-base);
  line-height: 1;
}
.notify-badge:empty { display: none; }

/* Dropdown Panel */
.notify-dropdown {
  position: absolute;
  top: calc(100% + 12px);
  right: 0;
  width: 380px;
  max-height: 480px;
  background: var(--bg-surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  box-shadow: 0 16px 48px rgba(0,0,0,0.5), 0 0 0 1px var(--border);
  display: none;
  flex-direction: column;
  z-index: 200;
  overflow: hidden;
  animation: dropIn 0.2s ease-out;
}
.notify-dropdown.show { display: flex; }

.notify-dropdown-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}
.notify-dropdown-title {
  font-size: 15px; font-weight: 700;
  color: var(--text-primary);
}
.notify-dropdown-actions {
  display: flex; gap: 8px;
}
.notify-dropdown-actions button {
  background: none; border: none;
  color: var(--text-muted);
  font-size: 12px; cursor: pointer;
  padding: 4px 8px; border-radius: 4px;
  font-family: inherit;
  transition: all 0.2s;
}
.notify-dropdown-actions button:hover {
  color: var(--accent-cyan);
  background: rgba(0,212,255,0.06);
}

.notify-list {
  flex: 1;
  overflow-y: auto;
  max-height: 380px;
}
.notify-item {
  display: flex; gap: 12px;
  padding: 14px 20px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background 0.15s;
  align-items: flex-start;
}
.notify-item:hover {
  background: var(--bg-card-hover);
}
.notify-item.unread {
  background: rgba(0,212,255,0.04);
}
.notify-item.unread::before {
  content: '';
  position: absolute;
  left: 8px; top: 50%;
  transform: translateY(-50%);
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--accent-cyan);
}
.notify-item-icon {
  width: 36px; height: 36px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 16px;
  flex-shrink: 0;
}
.notify-icon-success { background: rgba(16,185,129,0.12); color: var(--accent-green); }
.notify-icon-recharge { background: rgba(0,212,255,0.12); color: var(--accent-cyan); }
.notify-icon-activity { background: rgba(245,158,11,0.12); color: var(--accent-amber); }
.notify-icon-info { background: rgba(124,58,237,0.12); color: var(--accent-purple); }
.notify-icon-warn { background: rgba(239,68,68,0.12); color: var(--accent-red); }
.notify-item-content {
  flex: 1; min-width: 0;
}
.notify-item-title {
  font-size: 13px; font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 4px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.notify-item-desc {
  font-size: 12px; color: var(--text-muted);
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden;
}
.notify-item-time {
  font-size: 11px; color: var(--text-muted);
  margin-top: 4px;
}

.notify-empty {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-muted);
  font-size: 14px;
}

@keyframes dropIn {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes bellRing {
  0%, 100% { transform: rotate(0); }
  15% { transform: rotate(12deg); }
  30% { transform: rotate(-10deg); }
  45% { transform: rotate(8deg); }
  60% { transform: rotate(-6deg); }
  75% { transform: rotate(3deg); }
  90% { transform: rotate(-2deg); }
}

@media (max-width: 600px) {
  .notify-dropdown {
    width: 300px;
    right: -60px;
  }
  .promo-grid { grid-template-columns: 1fr; }
  .pkg-grid { grid-template-columns: 1fr; }
}

/* ===== Modal ===== */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.7);
  backdrop-filter: blur(4px);
  z-index: 300;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.modal-overlay.show { display: flex; }
.modal {
  background: var(--bg-surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  width: 100%; max-width: 520px;
  max-height: 90vh;
  overflow: hidden;
  display: flex; flex-direction: column;
  box-shadow: 0 24px 64px rgba(0,0,0,0.5);
  animation: dropIn 0.2s ease-out;
}
.modal-header {
  display: flex; justify-content: space-between; align-items: center;
  padding: 18px 24px;
  border-bottom: 1px solid var(--border);
}
.modal-title { font-size: 17px; font-weight: 700; }
.modal-close {
  background: none; border: none; color: var(--text-muted);
  font-size: 20px; cursor: pointer; padding: 4px;
}
.modal-close:hover { color: var(--text-primary); }
.modal-body { padding: 24px; overflow-y: auto; }
.modal-footer {
  display: flex; justify-content: flex-end; gap: 12px;
  padding: 16px 24px;
  border-top: 1px solid var(--border);
}

/* ===== API Key Management ===== */
.api-key-cell {
  display: flex; align-items: center; gap: 10px;
  font-family: var(--font-mono);
  font-size: 13px;
}
.api-key-value {
  color: var(--accent-cyan);
  background: rgba(0, 212, 255, 0.05);
  padding: 4px 10px; border-radius: 4px;
  border: 1px solid rgba(0, 212, 255, 0.15);
  min-width: 260px;
  max-width: 360px;
  word-break: break-all;
  user-select: all;
}
.api-key-actions {
  display: flex; gap: 6px;
}
.api-key-actions button {
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  border-radius: 4px;
  padding: 4px 8px;
  font-size: 12px;
  cursor: pointer;
  transition: all 0.2s;
}
.api-key-actions button:hover {
  border-color: var(--border-strong);
  color: var(--text-primary);
  background: var(--bg-card-hover);
}
.api-key-empty {
  text-align: center; padding: 48px 20px; color: var(--text-muted);
}
.key-name { white-space: nowrap; }

/* ===== Scrollbar ===== */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: var(--bg-base); }
::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* ===== Customer Service Modal ===== */
@keyframes spin {
  to { transform: rotate(360deg); }
}
.cs-modal {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.7);
  backdrop-filter: blur(8px);
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.cs-modal-content {
  background: var(--bg-surface);
  border: 1px solid var(--border-strong);
  border-radius: 20px;
  width: 100%;
  max-width: 480px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 0 60px rgba(0,212,255,0.12);
}
.cs-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 24px 24px 16px;
  border-bottom: 1px solid var(--border);
}
.cs-close {
  width: 32px; height: 32px;
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text-secondary);
  border-radius: 8px;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  transition: all 0.2s;
}
.cs-close:hover {
  border-color: var(--accent-cyan);
  color: var(--accent-cyan);
}
.cs-body {
  padding: 20px 24px 24px;
}
.cs-section {
  margin-bottom: 24px;
}
.cs-section:last-child {
  margin-bottom: 0;
}
.cs-section-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.cs-quick-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.cs-quick-item {
  padding: 8px 14px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 20px;
  color: var(--text-secondary);
  font-size: 13px;
  cursor: pointer;
  transition: all 0.2s;
  font-family: inherit;
}
.cs-quick-item:hover {
  border-color: var(--accent-cyan);
  color: var(--accent-cyan);
  background: rgba(0,212,255,0.06);
}
.cs-form-row {
  margin-bottom: 16px;
}
.cs-label {
  display: block;
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 6px;
}
.cs-select, .cs-input, .cs-textarea {
  width: 100%;
  padding: 12px 14px;
  background: var(--bg-base);
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  color: var(--text-primary);
  font-size: 14px;
  font-family: inherit;
  outline: none;
  transition: border-color 0.2s;
}
.cs-select:focus, .cs-input:focus, .cs-textarea:focus {
  border-color: var(--accent-cyan);
}
.cs-textarea {
  resize: vertical;
  min-height: 100px;
  line-height: 1.6;
}
.cs-success {
  text-align: center;
  padding: 40px 20px;
}
.cs-success-icon {
  width: 64px; height: 64px;
  margin: 0 auto 16px;
  background: rgba(16,185,129,0.15);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 32px;
  color: var(--accent-green);
}

/* ===== 预充值套餐（首页与定价页共用，保证价格一致） ===== */
.pkg-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 22px; align-items: stretch; }
.pkg-card { position: relative; background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); padding: 30px; display:flex; flex-direction:column; }
.pkg-card.popular { border-color: var(--accent-cyan); box-shadow: 0 0 0 1px var(--accent-cyan), 0 12px 50px rgba(0,212,255,0.12); }
.pkg-badge { position:absolute; top:26px; right:26px; font-size:11px; font-weight:700; padding:3px 9px; border-radius:6px; background:var(--accent-cyan); color:#04121a; }
.pkg-name { font-size: 20px; font-weight: 700; }
.pkg-price { font-size: 40px; font-weight: 800; margin: 14px 0 4px; }
.pkg-price small { font-size:16px; color:var(--text-muted); font-weight:600; }
.pkg-tokens { color: var(--accent-green); font-weight:600; font-size:15px; margin-bottom:6px; }
.pkg-desc { color: var(--text-muted); font-size: 13px; margin-bottom: 20px; }
.pkg-card .btn { margin-top: auto; text-align:center; }
.pkg-per { font-size:12px; color:var(--text-muted); margin-top:10px; }
.pkg-constraint { font-size:12px; color:var(--text-muted); line-height:1.6; margin:4px 0 18px; padding:8px 10px; background:var(--bg-card); border:1px solid var(--border); border-radius:8px; }

/* 预充值套餐移动端：窄屏下改为单列，避免三列挤压导致卡片被过度拉长 */
@media (max-width: 760px) {
  .pkg-grid { grid-template-columns: 1fr; gap: 16px; }
  .pkg-card { padding: 22px 18px; }
  .pkg-name { font-size: 18px; }
  .pkg-price { font-size: 32px; margin: 10px 0 4px; }
  .pkg-price small { font-size: 14px; }
  .pkg-tokens { font-size: 14px; }
  .pkg-desc { margin-bottom: 12px; }
  .pkg-badge { top: 18px; right: 18px; }
  .pkg-constraint { font-size: 11px; padding: 6px 8px; line-height: 1.5; }
}

/* ============================================================
   Anti-flicker: smooth navigation & load (ComputerHub)
   - Cross-document View Transitions cross-fade board switches
     (Chromium 126+). Degrades gracefully on other browsers.
   - Load-fade only when View Transitions are unsupported, so we
     never double-animate on Chromium. Both respect reduced-motion.
   ============================================================ */
@media (prefers-reduced-motion: no-preference) {
  /* 关闭跨文档 View Transitions：VT 在重新加载时会把旧/新页面整页交叉淡入，
     与 Google Fonts 的字形替换叠加后会产生明显的“重影/变形”。
     关闭后重新加载为即时渲染，配合稳定的背景色与字体 optional，不再重影。 */
  /* @view-transition { navigation: auto; } */

  /* html.ch-fade body {
    animation: ch-fade-in 0.16s ease both;
  }
  @keyframes ch-fade-in {
    from { opacity: 0; }
    to   { opacity: 1; }
  } */
}

/* 加载失败降级：确保页面始终可见、不陷入空白/闪烁，提供单次重试 */
html.ch-degraded body {
  opacity: 1 !important;
  animation: none !important;
}
#ch-load-fallback {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%);
  z-index: 9999;
  max-width: 92vw;
  background: rgba(15, 23, 42, 0.96);
  color: #e8ecf4;
  border: 1px solid rgba(120, 140, 200, 0.35);
  border-radius: 12px;
  padding: 14px 18px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.45);
  font-size: 14px;
  backdrop-filter: blur(6px);
}
#ch-load-fallback .ch-fallback-inner strong {
  display: block;
  margin-bottom: 4px;
  font-size: 15px;
}
#ch-load-fallback p {
  margin: 0 0 10px;
  color: #aab3c5;
}
#ch-load-fallback button {
  background: linear-gradient(135deg, #6366f1, #22d3ee);
  color: #fff;
  border: 0;
  padding: 8px 16px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
}
#ch-load-fallback button:hover {
  filter: brightness(1.08);
}

/* ============================================================
   主题切换入口（由 js/theme.js 注入）
   全部使用主题变量，浅色/深色下均保持足够对比度
   ============================================================ */
.ch-theme { position: relative; display: inline-flex; align-items: center; margin-right: 12px; flex-shrink: 0; }
/* 导航栏中的主题按钮：作为容器最后一个 flex 子元素参与 align-items:center 垂直居中，
   与「退出」等导航文字/按钮处于同一水平线；右距 24px 与容器内边距一致，左间距 12px 与相邻按钮一致 */
.navbar .container > .ch-theme { margin: 0 0 0 12px; }
/* ≤968px：导航允许换行为多行，此时改为绝对定位钉在第一行（logo 行）右上角，
   并为容器预留右距，避免与换行后的按钮组重叠；绝对定位子元素不参与 flex 换行 */
@media (max-width: 968px) {
  .navbar .container { padding-right: 104px; }
  .navbar .container > .ch-theme { position: absolute; right: 24px; top: 16px; margin: 0; }
}
.ch-theme-btn {
  display: inline-flex; align-items: center; gap: 6px;
  height: 34px; padding: 0 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-card);
  color: var(--text-secondary);
  font-size: 13px; font-family: inherit; cursor: pointer;
  transition: all 0.2s;
}
.ch-theme-btn:hover {
  border-color: var(--border-accent);
  background: var(--bg-card-hover);
  color: var(--text-primary);
}
.ch-theme-ico { display: inline-flex; align-items: center; }
.ch-theme-txt { white-space: nowrap; }

.ch-theme-menu {
  position: absolute; top: calc(100% + 8px); right: 0;
  min-width: 148px; padding: 6px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-card);
  z-index: 200; display: none;
}
.ch-theme.open .ch-theme-menu { display: block; }

.ch-theme-item {
  display: flex; align-items: center; gap: 8px;
  width: 100%; padding: 8px 10px;
  background: none; border: none; border-radius: var(--radius-sm);
  color: var(--text-secondary); font-size: 13px;
  font-family: inherit; cursor: pointer; text-align: left;
  transition: all 0.15s;
}
.ch-theme-item:hover { background: var(--bg-card-hover); color: var(--text-primary); }
.ch-theme-item[aria-checked="true"] { color: var(--accent-cyan); font-weight: 600; }
.ch-theme-check { width: 13px; opacity: 0; font-size: 12px; }
.ch-theme-item[aria-checked="true"] .ch-theme-check { opacity: 1; }
.ch-theme-item-ico { display: inline-flex; align-items: center; opacity: 0.9; }

/* 无导航栏页面（如 admin.html）：右下角悬浮，避免遮挡内容 */
.ch-theme-floating { position: fixed; right: 18px; bottom: 18px; margin: 0; z-index: 9999; }
.ch-theme-floating .ch-theme-btn {
  height: 38px; padding: 0 12px;
  background: var(--bg-glass);
  backdrop-filter: blur(12px);
  box-shadow: var(--shadow-card);
}
.ch-theme-floating .ch-theme-menu { top: auto; bottom: calc(100% + 8px); right: 0; }
