/* ─────────────────────────────────────────────────────────────
 * 可简 Studio — Design System: Dark Glass Atelier
 *
 * 设计哲学:
 *   1. 内容是主角, UI 是画框 — 每个像素都为用户作品让位
 *   2. 深色不是科技, 是剧场 — 像电影院一样把内容捧上舞台
 *   3. 极简到能数清元素, 但每一个都精确 — "可简"不是粗糙, 是删繁就简
 *
 * 这是全站底层契约, 不要在迭代中修改 CSS 变量值,
 * 那会让所有已写的页面碎裂.
 * 详见 plan: silly-painting-babbage.md
 * ───────────────────────────────────────────────────────────── */

:root {
  /* ─── 背景层 (ink scale, 越大越亮) ─── */
  --ink-0: #08090b;
  --ink-1: #0d0e11;
  --ink-2: #14161b;
  --ink-3: #1e2128;
  --ink-4: #2a2e38;

  /* ─── 字色 ─── */
  --text-1: #f5f6f7;
  --text-2: #a8aeb8;
  --text-3: #5b6271;

  /* ─── 强调色 (KJ 红 + 电光感) ─── */
  --flame: #FF5A5F;
  --flame-hi: #FF7E83;
  --flame-lo: rgba(255, 90, 95, 0.13);
  --ember: #FFB199;
  --spark: rgba(255, 90, 95, 0.35);

  /* ─── 中性 (玻璃 / 发丝线) ─── */
  --glass: rgba(255, 255, 255, 0.04);
  --glass-strong: rgba(255, 255, 255, 0.07);
  --glass-edge: rgba(255, 255, 255, 0.08);
  --hairline: rgba(255, 255, 255, 0.06);
  --hairline-strong: rgba(255, 255, 255, 0.10);

  /* ─── 语义色 ─── */
  --success: #3fb950;
  --warning: #d29922;
  --danger: #f85149;
  --info: #58a6ff;

  /* ─── 几何 ─── */
  --r-sm: 6px;
  --r-md: 10px;
  --r-lg: 16px;
  --r-xl: 22px;
  --r-full: 9999px;

  /* ─── 阴影 ─── */
  --shadow-card: 0 1px 0 var(--glass-edge) inset, 0 24px 60px -20px rgba(0, 0, 0, 0.6);
  --shadow-pop: 0 1px 0 var(--glass-edge) inset, 0 40px 80px -20px rgba(0, 0, 0, 0.8);
  --shadow-flame: 0 0 0 1px var(--flame-lo), 0 0 40px -10px var(--spark);

  /* ─── 缓动 ─── */
  --ease: cubic-bezier(0.2, 0.7, 0.2, 1);
  --t-fast: 180ms;
  --t-base: 240ms;
  --t-slow: 380ms;

  /* ─── 字体 ─── */
  --font-sans: -apple-system, BlinkMacSystemFont, "Inter", "HarmonyOS Sans SC", "PingFang SC", "Microsoft YaHei", "Segoe UI", sans-serif;
  --font-mono: "JetBrains Mono", "SF Mono", "Cascadia Code", ui-monospace, Consolas, monospace;
  --font-serif: "Noto Serif SC", "Source Han Serif SC", "PingFang SC", serif;

  /* ─── 旧变量兼容 (避免老页面崩) ─── */
  --bg-primary: var(--ink-0);
  --bg-card: var(--ink-1);
  --bg-card-hover: var(--ink-2);
  --border: var(--hairline);
  --text-primary: var(--text-1);
  --text-secondary: var(--text-2);
  --accent: var(--flame);
  --accent-hover: var(--flame-hi);
  --accent-dim: var(--flame-lo);
  --radius: var(--r-lg);
}

/* ─── Reset ─── */

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

html {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

body {
  background: var(--ink-0);
  color: var(--text-1);
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.6;
  min-height: 100vh;
  font-feature-settings: "cv11", "ss01";
}

/* ambient gradient — 给整站一层若隐若现的电影感 (不打扰, 但有氛围) */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  background:
    radial-gradient(1200px 600px at 50% -10%, rgba(255, 90, 95, 0.07), transparent 60%),
    radial-gradient(800px 400px at 100% 110%, rgba(255, 90, 95, 0.03), transparent 60%);
  pointer-events: none;
  z-index: -1;
}

a {
  color: var(--text-1);
  text-decoration: none;
  transition: color var(--t-fast) var(--ease);
}
a:hover { color: var(--flame); }

img { display: block; max-width: 100%; }

button { font: inherit; cursor: pointer; }

::selection {
  background: var(--flame-lo);
  color: var(--text-1);
}

/* ─── 字号系统 ─── */

.t-display { font-size: clamp(36px, 6vw, 64px); font-weight: 800; letter-spacing: -0.03em; line-height: 1.05; }
.t-h1 { font-size: clamp(28px, 4vw, 44px); font-weight: 700; letter-spacing: -0.02em; line-height: 1.15; }
.t-h2 { font-size: clamp(22px, 2.6vw, 30px); font-weight: 700; letter-spacing: -0.01em; line-height: 1.25; }
.t-h3 { font-size: 18px; font-weight: 600; line-height: 1.4; }
.t-body { font-size: 14px; line-height: 1.6; color: var(--text-2); }
.t-lead { font-size: 16px; line-height: 1.7; color: var(--text-2); }
.t-small { font-size: 12px; color: var(--text-3); }
.t-mono { font-family: var(--font-mono); font-feature-settings: "zero", "ss01"; }
.t-eyebrow {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--text-3);
}

/* ─── 按钮 ─── */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 18px;
  border: 1px solid transparent;
  border-radius: var(--r-md);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.01em;
  cursor: pointer;
  transition: all var(--t-base) var(--ease);
  background: transparent;
  color: var(--text-1);
  white-space: nowrap;
  position: relative;
  isolation: isolate;
}
.btn:focus-visible {
  outline: none;
  box-shadow: 0 0 0 2px var(--ink-0), 0 0 0 4px var(--flame-lo);
}
.btn-primary {
  background: var(--flame);
  color: #0a0a0a;
  font-weight: 700;
}
.btn-primary:hover {
  background: var(--flame-hi);
  box-shadow: var(--shadow-flame);
  transform: translateY(-1px);
}
.btn-primary:active { transform: translateY(0); }
.btn-primary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.btn-ghost {
  color: var(--text-2);
  border-color: var(--hairline);
  background: transparent;
}
.btn-ghost:hover {
  color: var(--text-1);
  border-color: var(--hairline-strong);
  background: var(--glass);
}

.btn-outline {
  color: var(--flame);
  border-color: var(--flame);
  background: transparent;
}
.btn-outline:hover {
  background: var(--flame-lo);
  box-shadow: var(--shadow-flame);
}

.btn-lg { padding: 13px 26px; font-size: 14px; border-radius: var(--r-md); }
.btn-sm { padding: 6px 12px; font-size: 12px; border-radius: var(--r-sm); }
.btn-icon { padding: 8px; min-width: 36px; min-height: 36px; }

/* ─── 卡片 / 玻璃面板 ─── */

.card {
  background: var(--ink-1);
  border: 1px solid var(--hairline);
  border-radius: var(--r-lg);
  padding: 20px;
  transition: border-color var(--t-base) var(--ease), box-shadow var(--t-base) var(--ease);
}
.card:hover { border-color: var(--hairline-strong); }

.glass {
  background: var(--glass);
  backdrop-filter: blur(20px) saturate(140%);
  -webkit-backdrop-filter: blur(20px) saturate(140%);
  border: 1px solid var(--glass-edge);
  border-radius: var(--r-lg);
}

.glass-strong {
  background: var(--glass-strong);
  backdrop-filter: blur(28px) saturate(160%);
  -webkit-backdrop-filter: blur(28px) saturate(160%);
  border: 1px solid var(--glass-edge);
  border-radius: var(--r-lg);
}

.surface {
  background: var(--ink-1);
  border: 1px solid var(--hairline);
  border-radius: var(--r-lg);
}

/* 卡片可点击的 hover 辉光效果 — 像电路通电 */
.card-interactive {
  cursor: pointer;
  position: relative;
  overflow: hidden;
}
.card-interactive:hover {
  border-color: var(--flame-lo);
  box-shadow: var(--shadow-flame);
  transform: translateY(-2px);
}
.card-interactive::after {
  content: "";
  position: absolute;
  inset: -1px;
  background: linear-gradient(120deg, transparent 30%, var(--flame-lo) 50%, transparent 70%);
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--t-slow) var(--ease);
  mix-blend-mode: screen;
}
.card-interactive:hover::after { opacity: 1; }

/* ─── 输入框 ─── */

.input, textarea.input {
  width: 100%;
  background: var(--ink-2);
  border: 1px solid var(--hairline);
  border-radius: var(--r-md);
  color: var(--text-1);
  font-family: inherit;
  font-size: 14px;
  padding: 11px 14px;
  outline: none;
  transition: border-color var(--t-fast) var(--ease), background var(--t-fast) var(--ease);
}
.input:hover { border-color: var(--hairline-strong); }
.input:focus {
  border-color: var(--flame);
  background: var(--ink-1);
  box-shadow: 0 0 0 3px var(--flame-lo);
}
.input::placeholder { color: var(--text-3); }
textarea.input { resize: vertical; min-height: 96px; line-height: 1.6; }

/* ─── Chip / Badge ─── */

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 11px;
  background: var(--glass);
  border: 1px solid var(--hairline);
  border-radius: var(--r-full);
  font-size: 12px;
  color: var(--text-2);
  transition: all var(--t-fast) var(--ease);
}
.chip:hover { border-color: var(--hairline-strong); color: var(--text-1); }
.chip.is-active {
  background: var(--flame-lo);
  border-color: var(--flame);
  color: var(--flame);
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: var(--r-full);
  font-size: 11px;
  font-weight: 600;
}
.badge-flame { background: var(--flame-lo); color: var(--flame); }
.badge-success { background: rgba(63, 185, 80, 0.13); color: var(--success); }
.badge-danger { background: rgba(248, 81, 73, 0.13); color: var(--danger); }
.badge-warn { background: rgba(210, 153, 34, 0.13); color: var(--warning); }
.badge-gray { background: var(--glass); color: var(--text-2); }

/* ─── Navbar ─── */

.navbar {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(8, 9, 11, 0.72);
  backdrop-filter: blur(20px) saturate(140%);
  -webkit-backdrop-filter: blur(20px) saturate(140%);
  border-bottom: 1px solid var(--hairline);
  height: 60px;
  padding: 0 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.navbar-logo {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 15px;
  font-weight: 700;
  color: var(--text-1);
  letter-spacing: -0.01em;
}
.navbar-logo::before {
  content: "";
  width: 22px;
  height: 22px;
  border-radius: 6px;
  background:
    radial-gradient(circle at 30% 30%, var(--flame-hi), var(--flame) 50%, #b73a3f 100%);
  box-shadow: 0 0 12px var(--spark);
  flex-shrink: 0;
}
.navbar-logo span {
  font-weight: 500;
  color: var(--text-2);
  letter-spacing: 0.06em;
  font-size: 12px;
  text-transform: uppercase;
}

.navbar-nav {
  display: flex;
  align-items: center;
  gap: 4px;
}
.navbar-link {
  padding: 8px 14px;
  font-size: 13px;
  color: var(--text-2);
  border-radius: var(--r-sm);
  transition: all var(--t-fast) var(--ease);
}
.navbar-link:hover { color: var(--text-1); background: var(--glass); }
.navbar-link.is-active { color: var(--flame); }

.navbar-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.credits-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--flame-lo);
  border: 1px solid rgba(255, 90, 95, 0.28);
  border-radius: var(--r-full);
  padding: 6px 14px;
  font-size: 12px;
  font-weight: 700;
  color: var(--flame);
  font-family: var(--font-mono);
  cursor: pointer;
  transition: all var(--t-fast) var(--ease);
}
.credits-badge:hover {
  background: rgba(255, 90, 95, 0.18);
  box-shadow: var(--shadow-flame);
}

/* ─── 充值面板 / 套餐选择 ─── */

.pkg-opt {
  background: var(--ink-2);
  border: 1.5px solid var(--hairline);
  border-radius: var(--r-md);
  padding: 14px 8px;
  text-align: center;
  cursor: pointer;
  transition: all var(--t-fast) var(--ease);
}
.pkg-opt:hover { border-color: var(--hairline-strong); transform: translateY(-1px); }
.pkg-opt.selected {
  border-color: var(--flame);
  background: var(--flame-lo);
  box-shadow: var(--shadow-flame);
}

.pay-method-btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: var(--ink-2);
  border: 1px solid var(--hairline);
  border-radius: var(--r-md);
  color: var(--text-1);
  font-size: 13px;
  padding: 10px 0;
  cursor: pointer;
  transition: all var(--t-fast) var(--ease);
}
.pay-method-btn:hover { border-color: var(--flame); background: var(--ink-3); }

/* ─── Progress / Spinner ─── */

.progress-track {
  background: var(--ink-2);
  border-radius: var(--r-full);
  height: 4px;
  overflow: hidden;
  position: relative;
}
.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--flame), var(--ember));
  border-radius: var(--r-full);
  box-shadow: 0 0 12px var(--spark);
  transition: width var(--t-slow) var(--ease);
}

.spinner {
  width: 18px;
  height: 18px;
  border: 2px solid var(--hairline);
  border-top-color: var(--flame);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  display: inline-block;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ─── Toast ─── */

#toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
}
.toast {
  background: var(--glass-strong);
  backdrop-filter: blur(28px) saturate(160%);
  -webkit-backdrop-filter: blur(28px) saturate(160%);
  border: 1px solid var(--glass-edge);
  border-radius: var(--r-md);
  padding: 12px 16px;
  font-size: 13px;
  max-width: 360px;
  box-shadow: var(--shadow-pop);
  pointer-events: auto;
  animation: toastIn var(--t-base) var(--ease);
}
.toast.success { border-left: 2.5px solid var(--success); }
.toast.error { border-left: 2.5px solid var(--danger); }
.toast.info { border-left: 2.5px solid var(--flame); }
@keyframes toastIn {
  from { opacity: 0; transform: translateX(24px); }
  to { opacity: 1; transform: translateX(0); }
}

/* ─── Scrollbar ─── */

::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: var(--ink-3);
  border-radius: var(--r-full);
  border: 2px solid var(--ink-0);
}
::-webkit-scrollbar-thumb:hover { background: var(--ink-4); }

/* ─── Layout utilities ─── */

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px;
}
.container-wide {
  max-width: 1440px;
  margin: 0 auto;
  padding: 0 24px;
}

.stack > * + * { margin-top: var(--stack-gap, 16px); }
.row { display: flex; align-items: center; gap: var(--row-gap, 12px); }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 12px; }

.hairline { border: 0; height: 1px; background: var(--hairline); margin: 24px 0; }
.divider-v { width: 1px; height: 100%; background: var(--hairline); }

/* ─── 入场动效 ─── */

.fade-up { animation: fadeUp var(--t-slow) var(--ease) both; }
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

.fade-in { animation: fadeIn var(--t-base) var(--ease) both; }
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* IntersectionObserver 触发, JS 加 .in-view */
.reveal { opacity: 0; transform: translateY(24px); transition: opacity var(--t-slow) var(--ease), transform var(--t-slow) var(--ease); }
.reveal.in-view { opacity: 1; transform: translateY(0); }
