/* ============================================================
   APIFlux Global Theme v1.0 — adapted to Sub2API real DOM
   Design: Claude 网页版设计稿 v1.0 | Implementation: injected via
   our own nginx layer, Sub2API source untouched.
   ============================================================ */

/* ---------- 0. 字体：JetBrains Mono 自托管子集（仅 Latin/数字/符号） ---------- */
@font-face {
  font-family: "JetBrains Mono";
  src: url("/apiflux-assets/fonts/jbmono-500.woff2") format("woff2");
  font-weight: 500; font-style: normal; font-display: swap;
  unicode-range: U+0020-007E, U+00D7, U+2013, U+2014, U+2192;
}
@font-face {
  font-family: "JetBrains Mono";
  src: url("/apiflux-assets/fonts/jbmono-600.woff2") format("woff2");
  font-weight: 600; font-style: normal; font-display: swap;
  unicode-range: U+0020-007E, U+00D7, U+2013, U+2014, U+2192;
}

/* ---------- 1. 设计令牌：浅色为框架默认，深色在 .dark 下 ---------- */
:root {
  --afx-bg-0: #F6F8FA;
  --afx-bg-1: #FFFFFF;
  --afx-surface: #FFFFFF;
  --afx-surface-2: #F1F4F8;
  --afx-field: #FFFFFF;
  --afx-border: #E3E8EE;
  --afx-border-strong: #CBD3DD;
  --afx-text: #0E1520;
  --afx-text-2: #4B5767;
  --afx-text-3: #8A94A3;
  --afx-accent: #0A8576;          /* 青色（浅色下加深保对比度） */
  --afx-cyan: #2DE2C6;
  --afx-cyan-deep: #19B6A4;
  --afx-violet: #7C6BFF;
  --afx-amber: #D98200;
  --afx-amber-hi: #B86E00;
  --afx-success: #0E9F6E;
  --afx-danger: #E0243A;
  --afx-tier-hot: #B86E00;
  --afx-tier-hot-bg: rgba(217,130,0,.12);
  --afx-tier-cyan: #0A8576;
  --afx-tier-cyan-bg: rgba(15,168,150,.10);
  --afx-tier-blue: #3B63C9;
  --afx-tier-blue-bg: rgba(59,99,201,.10);
  --afx-tier-plain: #4B5767;
  --afx-tier-plain-bg: rgba(75,87,103,.08);
  --afx-glass: rgba(255,255,255,.75);
  --afx-edge: inset 0 1px 0 rgba(255,255,255,.8);
  --afx-focus-ring: 0 0 0 3px rgba(15,168,150,.18);
  --afx-glow-1: rgba(45,226,198,.07);
  --afx-glow-2: rgba(124,107,255,.06);
  --afx-dot: rgba(14,21,32,.055);
  --afx-font-sans: "Inter", -apple-system, BlinkMacSystemFont, "SF Pro Text",
    "PingFang SC", "HarmonyOS Sans SC", "MiSans", "Microsoft YaHei UI",
    "Noto Sans SC", "Source Han Sans SC", sans-serif;
  --afx-font-mono: "JetBrains Mono", "SF Mono", ui-monospace, "Cascadia Code",
    "Roboto Mono", Consolas, "Liberation Mono", monospace;
  --afx-ease: cubic-bezier(.2,.7,.2,1);
}

.dark {
  --afx-bg-0: #07090C;
  --afx-bg-1: #0C0F14;
  --afx-surface: #11151B;
  --afx-surface-2: #171C24;
  --afx-field: #0A0D11;
  --afx-border: #1F2630;
  --afx-border-strong: #2B3441;
  --afx-text: #E8EDF3;
  --afx-text-2: #9AA6B5;
  --afx-text-3: #66717F;
  --afx-accent: #2DE2C6;
  --afx-amber: #FFB547;
  --afx-amber-hi: #FFC857;
  --afx-success: #3DDC97;
  --afx-danger: #FF5C6C;
  --afx-tier-hot: #FFC857;
  --afx-tier-hot-bg: rgba(255,181,71,.14);
  --afx-tier-cyan: #2DE2C6;
  --afx-tier-cyan-bg: rgba(45,226,198,.12);
  --afx-tier-blue: #8FB4FF;
  --afx-tier-blue-bg: rgba(143,180,255,.12);
  --afx-tier-plain: #9AA6B5;
  --afx-tier-plain-bg: rgba(154,166,181,.10);
  --afx-glass: rgba(17,21,27,.72);
  --afx-edge: inset 0 1px 0 rgba(255,255,255,.04);
  --afx-focus-ring: 0 0 0 3px rgba(45,226,198,.16);
  --afx-glow-1: rgba(45,226,198,.13);
  --afx-glow-2: rgba(124,107,255,.11);
  --afx-dot: rgba(255,255,255,.035);
}

/* ---------- 2. 基础 ---------- */
body {
  font-family: var(--afx-font-sans) !important;
  background-color: var(--afx-bg-0) !important;
  background-image:
    radial-gradient(640px 320px at 18% -60px, var(--afx-glow-1), transparent 70%),
    radial-gradient(560px 300px at 82% -80px, var(--afx-glow-2), transparent 70%),
    radial-gradient(var(--afx-dot) 1px, transparent 1px) !important;
  background-size: auto, auto, 24px 24px !important;
  background-repeat: no-repeat, no-repeat, repeat !important;
  color: var(--afx-text);
}
::selection { background: rgba(45,226,198,.28); }
* { scrollbar-width: thin; scrollbar-color: var(--afx-border-strong) transparent; }
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: var(--afx-border-strong); border-radius: 8px; }
::-webkit-scrollbar-track { background: transparent; }

a { color: var(--afx-accent); }
code, pre, kbd, .font-mono { font-family: var(--afx-font-mono) !important; }
:focus-visible { outline: 2px solid var(--afx-accent); outline-offset: 2px; }

/* ---------- 3. 按钮（框架真实类） ---------- */
.btn { border-radius: 8px !important; }
.btn-primary {
  background: linear-gradient(180deg, var(--afx-cyan), var(--afx-cyan-deep)) !important;
  color: #04110F !important;
  font-weight: 600;
  border: 1px solid rgba(255,255,255,.18) !important;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.35) !important;
}
.btn-primary:hover {
  filter: brightness(1.07);
  box-shadow: 0 6px 24px -6px rgba(45,226,198,.55), inset 0 1px 0 rgba(255,255,255,.4) !important;
}
.btn-secondary {
  background: var(--afx-surface) !important;
  border: 1px solid var(--afx-border-strong) !important;
  color: var(--afx-text) !important;
}
.btn-secondary:hover { background: var(--afx-surface-2) !important; }
.btn-ghost { color: var(--afx-text-2) !important; }
.btn-ghost:hover { background: var(--afx-surface-2) !important; color: var(--afx-text) !important; }

/* ---------- 4. 输入框 ---------- */
.input {
  background: var(--afx-field) !important;
  border: 1px solid var(--afx-border) !important;
  border-radius: 8px !important;
  color: var(--afx-text) !important;
}
.input::placeholder { color: var(--afx-text-3); }
.input:hover { border-color: var(--afx-border-strong) !important; }
.input:focus {
  outline: none !important;
  border-color: var(--afx-accent) !important;
  box-shadow: var(--afx-focus-ring) !important;
}

/* ---------- 5. 卡片 / 统计卡 ---------- */
.card, .stat-card {
  background: var(--afx-surface) !important;
  border: 1px solid var(--afx-border) !important;
  border-radius: 12px !important;
  box-shadow: var(--afx-edge) !important;
  color: var(--afx-text);
}
.card-glass {
  background: var(--afx-glass) !important;
  backdrop-filter: saturate(140%) blur(12px);
  border: 1px solid var(--afx-border) !important;
  border-radius: 12px !important;
}
.stat-value, .stat-trend-up, .stat-trend-down {
  font-family: var(--afx-font-mono) !important;
  font-variant-numeric: tabular-nums;
}
.stat-label { color: var(--afx-text-3) !important; letter-spacing: .04em; }

/* ---------- 6. 侧栏 ---------- */
.sidebar {
  background: var(--afx-bg-1) !important;
  border-right: 1px solid var(--afx-border) !important;
}
.sidebar-link {
  color: var(--afx-text-2) !important;
  border-radius: 8px !important;
  transition: background .15s, color .15s;
}
.sidebar-link:hover { background: var(--afx-surface-2) !important; color: var(--afx-text) !important; }
.sidebar-link-active {
  background: rgba(45,226,198,.10) !important;
  color: var(--afx-accent) !important;
}
.sidebar-link-active:hover { background: rgba(45,226,198,.16) !important; }
.sidebar-section-title { color: var(--afx-text-3) !important; letter-spacing: .05em; }

/* ---------- 7. Tab / 徽章 / 进度 / 开关 ---------- */
.tab { color: var(--afx-text-2) !important; border-radius: 8px !important; }
.tab:hover { color: var(--afx-text) !important; }
.tab-active {
  background: var(--afx-surface-2) !important;
  color: var(--afx-text) !important;
  box-shadow: inset 0 0 0 1px var(--afx-border-strong) !important;
}
.badge { border-radius: 6px !important; }
.progress { background: var(--afx-border) !important; }

/* ---------- 8. 表格 ---------- */
.table { font-variant-numeric: tabular-nums; }
.table thead th, table thead th {
  background: var(--afx-bg-1) !important;
  color: var(--afx-text-3) !important;
  border-color: var(--afx-border) !important;
}
.table tbody td, table tbody td { border-color: var(--afx-border) !important; }
.table tbody tr, table tbody tr { transition: background .12s; }
.table tbody tr:hover, table tbody tr:hover { background: var(--afx-surface-2) !important; }

/* ---------- 9. 弹窗 / 提示 ---------- */
.modal-content {
  background: var(--afx-surface) !important;
  border: 1px solid var(--afx-border-strong) !important;
  border-radius: 16px !important;
  box-shadow: 0 24px 64px -16px rgba(0,0,0,.55) !important;
  color: var(--afx-text);
}
.toast {
  background: var(--afx-surface) !important;
  border: 1px solid var(--afx-border-strong) !important;
  border-radius: 12px !important;
  color: var(--afx-text) !important;
}

/* ---------- 10. 倍率徽章（全站核心组件，首页与自有 HTML 使用） ---------- */
.afx-ratio {
  display: inline-flex; align-items: center; gap: 6px;
  height: 22px; padding: 0 8px;
  font-family: var(--afx-font-mono);
  font-variant-numeric: tabular-nums;
  font-size: 12px; font-weight: 600; line-height: 1;
  border-radius: 6px;
  color: var(--afx-tier-plain);
  background: var(--afx-tier-plain-bg);
  border: 1px solid var(--afx-border-strong);
  white-space: nowrap;
}
.afx-ratio--hot  { color: var(--afx-tier-hot);  background: var(--afx-tier-hot-bg);  border-color: var(--afx-tier-hot); position: relative; overflow: hidden; }
.afx-ratio--cyan { color: var(--afx-tier-cyan); background: var(--afx-tier-cyan-bg); border-color: var(--afx-tier-cyan); }
.afx-ratio--blue { color: var(--afx-tier-blue); background: var(--afx-tier-blue-bg); border-color: var(--afx-tier-blue); }
.afx-ratio--hot::before {
  content: ""; width: 6px; height: 6px; border-radius: 50%;
  background: var(--afx-amber); box-shadow: 0 0 8px var(--afx-amber);
  animation: afx-pulse 2.4s ease-in-out infinite;
}
.afx-ratio--lg { height: 32px; padding: 0 14px; font-size: 18px; border-radius: 8px; }
@keyframes afx-pulse { 0%,100% { opacity: 1; transform: scale(1); } 50% { opacity: .45; transform: scale(.8); } }

/* 状态点 */
.afx-dot { display: inline-block; width: 6px; height: 6px; border-radius: 50%; margin-right: 6px; background: var(--afx-text-3); vertical-align: middle; }
.afx-dot--ok { background: var(--afx-success); box-shadow: 0 0 8px rgba(61,220,151,.6); }

/* ============================================================
   11. 首页自定义 HTML 区（.afx-*）
   ============================================================ */
.afx-hero { text-align: center; padding: 84px 16px 48px; position: relative; }
.afx-pill {
  display: inline-flex; align-items: center; gap: 8px; height: 28px; padding: 0 12px;
  border-radius: 999px; font-size: 12px; color: var(--afx-text-2);
  border: 1px solid var(--afx-border-strong); background: var(--afx-glass);
}
.afx-hero h1 {
  margin: 22px 0 16px; font-size: clamp(36px, 6vw, 60px); line-height: 1.12;
  font-weight: 700; letter-spacing: -0.02em; color: var(--afx-text);
}
.afx-deal {
  font-style: normal; font-family: var(--afx-font-mono); font-size: 1.12em;
  background: linear-gradient(135deg, #FFC857, #FF9F43);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
/* 按次计费：Hero 副标题与独立横幅 */
.afx-strap--sub { font-size: clamp(15px, 2.2vw, 20px); font-weight: 600; color: var(--afx-text-2); margin: -6px 0 18px; }
.afx-percall { max-width: 960px; margin: 0 auto 64px; padding: 0 16px; }
.afx-percall .afx-tier { text-align: center; padding: 34px 28px; }
.afx-percall .afx-mult { font-size: 40px; }
.afx-percall .afx-mult small { font-size: .42em; font-weight: 600; color: var(--afx-text-2); font-family: inherit; }
.afx-percall .afx-tier p { max-width: 640px; margin: 0 auto 12px; }
/* 顶部 1:1 充值说明条 */
.afx-topnote { max-width: 960px; margin: 0 auto 28px; padding: 12px 20px; border-radius: 12px;
  background: linear-gradient(90deg, rgba(61,220,151,.14), rgba(61,220,151,.06));
  border: 1px solid rgba(61,220,151,.45); text-align: center;
  font-size: 15px; font-weight: 600; color: var(--afx-text); line-height: 1.6; }
.afx-topnote b { color: #3DDC97; font-family: var(--afx-font-mono); font-size: 1.08em; }
.afx-topnote-sub { font-weight: 400; font-size: 12.5px; color: var(--afx-text-2); margin-top: 4px; }
.afx-brand-grad {
  background: linear-gradient(120deg, var(--afx-cyan) 10%, var(--afx-violet) 95%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.afx-strap {
  font-size: clamp(22px, 3.6vw, 34px); font-weight: 600; line-height: 1.3;
  letter-spacing: -0.01em; color: var(--afx-text); margin: 4px 0 16px;
}
.afx-hero p { max-width: 580px; margin: 0 auto 30px; color: var(--afx-text-2); font-size: 16px; line-height: 1.7; }
.afx-cta { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }
.afx-btn {
  display: inline-flex; align-items: center; justify-content: center; height: 44px; padding: 0 24px;
  border-radius: 8px; font-weight: 600; font-size: 15px; transition: all .15s var(--afx-ease);
}
.afx-btn-primary {
  background: linear-gradient(180deg, var(--afx-cyan), var(--afx-cyan-deep)); color: #04110F !important;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.35);
}
.afx-btn-primary:hover { filter: brightness(1.08); box-shadow: 0 8px 28px -8px rgba(45,226,198,.6); color: #04110F !important; }
.afx-btn-ghost { border: 1px solid var(--afx-border-strong); color: var(--afx-text) !important; }
.afx-btn-ghost:hover { background: var(--afx-surface-2); color: var(--afx-text) !important; }

/* 价格跑马灯 */
.afx-marquee { overflow: hidden; mask-image: linear-gradient(90deg, transparent, #000 10%, #000 90%, transparent); -webkit-mask-image: linear-gradient(90deg, transparent, #000 10%, #000 90%, transparent); margin: 8px auto 56px; max-width: 1080px; }
.afx-marquee-track { display: flex; gap: 44px; width: max-content; animation: afx-scroll 46s linear infinite; font-family: var(--afx-font-mono); font-size: 13px; color: var(--afx-text-2); white-space: nowrap; }
.afx-marquee-track b { color: var(--afx-text); font-weight: 600; }
.afx-marquee-track .afx-hl { color: var(--afx-amber-hi); }
@keyframes afx-scroll { to { transform: translateX(-50%); } }

/* 三档价格卡 */
.afx-tiers { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; max-width: 960px; margin: 0 auto 64px; padding: 0 16px; }
.afx-tier {
  position: relative; padding: 28px 24px; border-radius: 16px;
  background: var(--afx-surface); border: 1px solid var(--afx-border); box-shadow: var(--afx-edge);
  text-align: left; transition: transform .25s var(--afx-ease), border-color .2s;
}
.afx-tier::before { content: ""; position: absolute; left: 24px; right: 24px; top: -1px; height: 2px; border-radius: 2px; background: var(--afx-tier-plain); }
.afx-tier--hot::before  { background: linear-gradient(90deg, #FFC857, #FF9F43); }
.afx-tier--cyan::before { background: var(--afx-cyan); }
.afx-tier--blue::before { background: var(--afx-tier-blue); }
.afx-tier--hot {
  transform: translateY(-6px); border-color: rgba(255,181,71,.4);
}
.afx-tier:hover { border-color: var(--afx-border-strong); }
.afx-tier h3 { margin: 0 0 8px; font-size: 14px; color: var(--afx-text-2); font-weight: 500; }
.afx-mult { font-family: var(--afx-font-mono); font-size: 44px; font-weight: 700; line-height: 1.1; margin-bottom: 10px; }
.afx-tier--hot .afx-mult  { color: var(--afx-tier-hot); }
.afx-tier--cyan .afx-mult { color: var(--afx-tier-cyan); }
.afx-tier--blue .afx-mult { color: var(--afx-tier-blue); }
.afx-tier p { margin: 0 0 10px; font-size: 13px; color: var(--afx-text-3); line-height: 1.6; }
.afx-tier .afx-ex { font-family: var(--afx-font-mono); font-size: 12px; color: var(--afx-text-2); }
.afx-tag {
  position: absolute; top: 16px; right: 16px; font-size: 11px; padding: 2px 8px; border-radius: 999px;
  color: #1A1100; background: #FFB547; font-weight: 600;
}

/* 全系倍率一览 */
.afx-rates { max-width: 960px; margin: 0 auto 64px; padding: 0 16px; }
.afx-rates h2, .afx-sec-title { text-align: center; font-size: 24px; font-weight: 600; color: var(--afx-text); margin: 0 0 8px; letter-spacing: -0.01em; }
.afx-sec-sub { text-align: center; color: var(--afx-text-3); font-size: 14px; margin: 0 0 28px; }
.afx-rates-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.afx-rate-row {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 14px 18px; border-radius: 12px;
  background: var(--afx-surface); border: 1px solid var(--afx-border);
}
.afx-rate-row .afx-vendor { display: inline-block; width: 8px; height: 8px; border-radius: 50%; }
.afx-rate-row .afx-name { font-weight: 600; color: var(--afx-text); font-size: 15px; margin-right: auto; }
.afx-rate-row .afx-note { width: 100%; font-size: 12px; color: var(--afx-text-3); }

/* 三步接入 + 代码块 */
.afx-steps { max-width: 960px; margin: 0 auto 16px; padding: 0 16px; display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.afx-step { padding: 18px; border-radius: 12px; background: var(--afx-surface); border: 1px solid var(--afx-border); text-align: left; }
.afx-step .afx-step-n { font-family: var(--afx-font-mono); color: var(--afx-accent); font-weight: 600; font-size: 13px; }
.afx-step h4 { margin: 6px 0 4px; font-size: 15px; color: var(--afx-text); font-weight: 600; }
.afx-step p { margin: 0; font-size: 13px; color: var(--afx-text-3); line-height: 1.6; }
.afx-code {
  max-width: 720px; margin: 20px auto 64px; padding: 20px 24px; text-align: left; overflow-x: auto;
  background: #0A0D11; border: 1px solid var(--afx-border-strong); border-radius: 12px;
  font-family: var(--afx-font-mono); font-size: 13px; line-height: 1.7; color: #9AA6B5;
}
.afx-code .afx-k { color: #2DE2C6; }
.afx-code .afx-s { color: #FFC857; }

/* 特性 */
.afx-feats { max-width: 960px; margin: 0 auto 64px; padding: 0 16px; display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.afx-feat { padding: 20px; border-radius: 12px; background: var(--afx-surface); border: 1px solid var(--afx-border); text-align: left; }
.afx-feat h4 { margin: 0 0 6px; font-size: 15px; font-weight: 600; color: var(--afx-text); }
.afx-feat p { margin: 0; font-size: 13px; color: var(--afx-text-3); line-height: 1.65; }

/* FAQ */
.afx-faq { max-width: 760px; margin: 0 auto 64px; padding: 0 16px; }
.afx-faq details { border: 1px solid var(--afx-border); border-radius: 12px; background: var(--afx-surface); padding: 14px 18px; margin-bottom: 10px; text-align: left; }
.afx-faq summary { cursor: pointer; font-weight: 600; color: var(--afx-text); font-size: 14px; }
.afx-faq details p { margin: 8px 0 2px; font-size: 13px; color: var(--afx-text-2); line-height: 1.7; }

.afx-final { text-align: center; padding: 8px 16px 84px; }
.afx-final h2 { font-size: 28px; font-weight: 700; color: var(--afx-text); margin: 0 0 18px; }

/* ---------- 12. 响应式 & 无障碍 ---------- */
@media (max-width: 768px) {
  .afx-tiers, .afx-steps { grid-template-columns: 1fr; }
  .afx-rates-grid, .afx-feats { grid-template-columns: 1fr; }
  .afx-tier--hot { transform: none; }
  .afx-hero { padding: 56px 16px 40px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ---------- CDK entry card (injected by apiflux-cdk-link.js, v20261002-4) ---------- */
.afx-cdk { border: 1px solid var(--afx-border); border-radius: 16px; background: var(--afx-surface); }
.afx-cdk-head { display: flex; align-items: flex-start; gap: 12px; }
.afx-cdk-icon { flex: none; width: 40px; height: 40px; border-radius: 12px; display: flex; align-items: center; justify-content: center; color: var(--afx-accent); background: color-mix(in srgb, var(--afx-accent) 12%, transparent); }
.afx-cdk-title { font-weight: 700; font-size: 16px; color: var(--afx-text); }
.afx-cdk-desc { color: var(--afx-text-2); font-size: 13px; margin-top: 4px; line-height: 1.6; }
.afx-cdk-btns { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-top: 14px; }
.afx-cdk-btn { display: block; text-align: center; padding: 10px 0; border-radius: 12px; border: 1px solid var(--afx-border-strong); font-weight: 700; font-size: 15px; color: var(--afx-text); text-decoration: none; background: var(--afx-surface-2); transition: border-color .15s, color .15s; }
.afx-cdk-btn:hover { border-color: var(--afx-accent); color: var(--afx-accent); }
.afx-cdk-note { margin-top: 10px; font-size: 12px; color: var(--afx-text-3); }
@media (max-width: 480px) { .afx-cdk-btns { grid-template-columns: repeat(2, 1fr); } }
