/* ============================================================
   小楠不会取名 · Xiaonan Studio — styles.css
   Step 1: design tokens, glass tiers, 3-layer shadows,
   cursor vars, theme vars, reduced-motion fallback.
   Rule: JS springs drive ALL interaction — no CSS transitions
   on interactive elements.
   ============================================================ */

/* ---------- 1. Theme tokens ---------- */
:root {
  /* color tokens (light default) */
  --bg: #f5f5f7;
  --bg-2: #ececf0;
  --text: #1d1d1f;
  --text-2: rgba(29, 29, 31, .62);
  --text-3: rgba(29, 29, 31, .4);

  /* brand gradient: bilibili pink -> violet -> cyan */
  --brand-1: #fb7299;
  --brand-2: #7c5cff;
  --brand-3: #35d0ff;
  --brand-grad: linear-gradient(120deg, var(--brand-1), var(--brand-2) 55%, var(--brand-3));

  /* 背景光晕色（随配色方案 data-palette 联动） */
  --glow-1: rgba(251, 114, 153, .10);
  --glow-2: rgba(53, 208, 255, .10);
  --glow-3: rgba(124, 92, 255, .12);
  --cursor-glow: rgba(124, 92, 255, .16);

  /* glass tints */
  --glass-tint: rgba(255, 255, 255, .10);   /* tier 1 */
  --glass-tint-deep: rgba(255, 255, 255, .20); /* tier 2 */
  --glass-border: rgba(255, 255, 255, .35);
  --glass-blur: 10px;
  --glass-blur-deep: 20px;
  --glass-sat: 170%;
  --glass-sat-deep: 190%;

  /* 3-layer shadow (interactive elements) */
  --shadow-outer: 0 8px 32px -8px rgba(0, 0, 0, .18);
  --shadow-inset-top: inset 0 1px 0 rgba(255, 255, 255, .6);
  --shadow-inset-bottom: inset 0 -1px 0 rgba(255, 255, 255, .15);
  --shadow-3: var(--shadow-outer), var(--shadow-inset-top), var(--shadow-inset-bottom);
  /* intensified ~30% for hover (JS may override via spring) */
  --shadow-3-hover: 0 12px 40px -8px rgba(0, 0, 0, .24), var(--shadow-inset-top), var(--shadow-inset-bottom);

  /* cursor spotlight vars (updated on mousemove) */
  --mx: 50%;
  --my: 50%;
  --spot-size: 340px;
  --spot-alpha: .10;

  /* layout */
  --radius-s: 12px;
  --radius-m: 18px;
  --radius-l: 26px;
  --nav-h: 64px;
  --page-w: 1200px;

  /* type */
  --font-sys: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI",
    "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", Roboto, sans-serif;

  color-scheme: light;
}

[data-theme="dark"] {
  --bg: #0a0b0e;
  --bg-2: #0f0f12;
  --text: #f5f5f7;
  --text-2: rgba(245, 245, 247, .6);
  --text-3: rgba(245, 245, 247, .38);

  --brand-1: #ff85a8;
  --brand-2: #947dff;
  --brand-3: #52d9ff;

  --glow-1: rgba(251, 114, 153, .07);
  --glow-2: rgba(53, 208, 255, .06);
  --glow-3: rgba(124, 92, 255, .09);
  --cursor-glow: rgba(148, 125, 255, .20);

  --glass-tint: rgba(255, 255, 255, .07);
  --glass-tint-deep: rgba(255, 255, 255, .12);
  --glass-border: rgba(255, 255, 255, .14);

  --shadow-outer: 0 8px 32px -8px rgba(0, 0, 0, .55);
  --shadow-inset-top: inset 0 1px 0 rgba(255, 255, 255, .12);
  --shadow-inset-bottom: inset 0 -1px 0 rgba(255, 255, 255, .05);
  --shadow-3-hover: 0 12px 40px -8px rgba(0, 0, 0, .7), var(--shadow-inset-top), var(--shadow-inset-bottom);

  --spot-alpha: .14;

  color-scheme: dark;
}

/* ---------- 2. Reset / base ---------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
  scroll-behavior: auto; /* JS-driven smooth scroll instead */
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font-sys);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

img, svg, canvas { display: block; max-width: 100%; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
a { color: inherit; text-decoration: none; }
ul, ol { list-style: none; }

::selection { background: rgba(124, 92, 255, .28); }

/* focus ring for keyboard users only */
:focus-visible {
  outline: 2px solid var(--brand-2);
  outline-offset: 3px;
  border-radius: 6px;
}

/* ---------- 3. Background layers ---------- */
/* base frosted backdrop */
.bg-base {
  position: fixed;
  inset: 0;
  z-index: -3;
  background:
    radial-gradient(1200px 800px at 15% -10%, var(--glow-1), transparent 60%),
    radial-gradient(1000px 700px at 110% 20%, var(--glow-2), transparent 55%),
    radial-gradient(900px 900px at 50% 120%, var(--glow-3), transparent 60%),
    var(--bg);
  pointer-events: none;
}
[data-theme="dark"] .bg-base {
  background:
    radial-gradient(1200px 800px at 15% -10%, var(--glow-1), transparent 60%),
    radial-gradient(1000px 700px at 110% 20%, var(--glow-2), transparent 55%),
    radial-gradient(900px 900px at 50% 120%, var(--glow-3), transparent 60%),
    var(--bg);
}

/* canvas particle layer */
#bg-canvas {
  position: fixed;
  inset: 0;
  z-index: -2;
  pointer-events: none;
}

/* soft glow ball following cursor (JS-positioned) */
.cursor-glow {
  position: fixed;
  z-index: -1;
  width: 520px;
  height: 520px;
  left: 0;
  top: 0;
  border-radius: 50%;
  pointer-events: none;
  background: radial-gradient(circle, var(--cursor-glow), transparent 65%);
  will-change: transform;
}
[data-theme="dark"] .cursor-glow {
  background: radial-gradient(circle, var(--cursor-glow), transparent 65%);
}

/* ---------- 3.5 主题扩展包配色（兑换项 themes 解锁） ----------
   只覆盖品牌色与光晕令牌，不动 light/dark 基底；
   未解锁时 JS 不会写入 data-palette，样式自然回退默认品牌色。 */
[data-palette="aurora"] {
  --brand-1: #8b5cf6;
  --brand-2: #c084fc;
  --brand-3: #60a5fa;
  --glow-1: rgba(139, 92, 246, .12);
  --glow-2: rgba(96, 165, 250, .10);
  --glow-3: rgba(192, 132, 252, .12);
  --cursor-glow: rgba(139, 92, 246, .16);
}
[data-palette="aurora"][data-theme="dark"],
[data-theme="dark"] [data-palette="aurora"] {
  --brand-1: #a78bfa;
  --brand-2: #d8b4fe;
  --brand-3: #93c5fd;
  --glow-1: rgba(167, 139, 250, .10);
  --glow-2: rgba(147, 197, 253, .08);
  --glow-3: rgba(216, 180, 254, .10);
  --cursor-glow: rgba(167, 139, 250, .20);
}
[data-palette="cyber"] {
  --brand-1: #06b6d4;
  --brand-2: #22d3ee;
  --brand-3: #34d399;
  --glow-1: rgba(6, 182, 212, .12);
  --glow-2: rgba(52, 211, 153, .10);
  --glow-3: rgba(34, 211, 238, .12);
  --cursor-glow: rgba(6, 182, 212, .16);
}
[data-palette="cyber"][data-theme="dark"],
[data-theme="dark"] [data-palette="cyber"] {
  --brand-1: #22d3ee;
  --brand-2: #67e8f9;
  --brand-3: #6ee7b7;
  --glow-1: rgba(34, 211, 238, .10);
  --glow-2: rgba(110, 231, 183, .08);
  --glow-3: rgba(103, 232, 249, .10);
  --cursor-glow: rgba(34, 211, 238, .20);
}
[data-palette="sunset"] {
  --brand-1: #f97316;
  --brand-2: #fb7185;
  --brand-3: #fbbf24;
  --glow-1: rgba(249, 115, 22, .12);
  --glow-2: rgba(251, 191, 36, .10);
  --glow-3: rgba(251, 113, 133, .12);
  --cursor-glow: rgba(249, 115, 22, .16);
}
[data-palette="sunset"][data-theme="dark"],
[data-theme="dark"] [data-palette="sunset"] {
  --brand-1: #fb923c;
  --brand-2: #fda4af;
  --brand-3: #fcd34d;
  --glow-1: rgba(251, 146, 60, .10);
  --glow-2: rgba(252, 211, 77, .08);
  --glow-3: rgba(253, 164, 175, .10);
  --cursor-glow: rgba(251, 146, 60, .20);
}

/* 主题切换涟漪层（clip-path 由 JS 弹簧驱动，无 CSS transition） */
.theme-ripple {
  position: fixed;
  inset: 0;
  z-index: 999;
  pointer-events: none;
  background: var(--bg);
  clip-path: circle(0% at 50% 50%);
  visibility: hidden;
}

/* ---------- 4. Glass tiers ---------- */
.glass-1,
.glass-2 {
  position: relative;
  -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(var(--glass-sat));
  backdrop-filter: blur(var(--glass-blur)) saturate(var(--glass-sat));
  background: var(--glass-tint);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-m);
  box-shadow: var(--shadow-3);
  isolation: isolate;
}

.glass-2 {
  -webkit-backdrop-filter: blur(var(--glass-blur-deep)) saturate(var(--glass-sat-deep));
  backdrop-filter: blur(var(--glass-blur-deep)) saturate(var(--glass-sat-deep));
  background: var(--glass-tint-deep);
  border-radius: var(--radius-l);
}

/* liquid-glass specular highlight (top edge light) */
.glass-1::before,
.glass-2::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: linear-gradient(180deg, rgba(255, 255, 255, .22), rgba(255, 255, 255, 0) 34%);
  pointer-events: none;
  z-index: 0;
}
[data-theme="dark"] .glass-1::before,
[data-theme="dark"] .glass-2::before {
  background: linear-gradient(180deg, rgba(255, 255, 255, .08), rgba(255, 255, 255, 0) 34%);
}

/* radial spotlight following --mx/--my (hover feedback) */
.spotlight::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: radial-gradient(
    var(--spot-size) circle at var(--mx) var(--my),
    rgba(255, 255, 255, var(--spot-alpha)),
    transparent 65%
  );
  opacity: 0;
  pointer-events: none;
  z-index: 1;
}
.spotlight.is-hover::after { opacity: 1; }

/* ---------- 5. Interactive base (spring-driven, no CSS transition) ---------- */
.spring-el {
  will-change: transform;
  transform: translateZ(0);
}

/* buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 22px;
  border-radius: 999px;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: .01em;
  -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(var(--glass-sat));
  backdrop-filter: blur(var(--glass-blur)) saturate(var(--glass-sat));
  background: var(--glass-tint);
  border: 1px solid var(--glass-border);
  box-shadow: var(--shadow-3);
  will-change: transform;
  user-select: none;
  -webkit-user-select: none;
  touch-action: manipulation;
}

.btn-primary {
  background: var(--brand-grad);
  color: #fff;
  border-color: transparent;
  box-shadow: 0 8px 32px -8px rgba(124, 92, 255, .45),
    inset 0 1px 0 rgba(255, 255, 255, .45),
    inset 0 -1px 0 rgba(255, 255, 255, .15);
}

.btn-sm { padding: 8px 16px; font-size: 13.5px; }

/* icon buttons (nav toggles) */
.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(var(--glass-sat));
  backdrop-filter: blur(var(--glass-blur)) saturate(var(--glass-sat));
  background: var(--glass-tint);
  border: 1px solid var(--glass-border);
  box-shadow: var(--shadow-3);
  will-change: transform;
}
.icon-btn svg { width: 19px; height: 19px; fill: currentColor; }

/* ---------- 6. Nav ---------- */
.nav {
  position: fixed;
  top: 14px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 100;
  width: min(calc(100% - 28px), var(--page-w));
  height: var(--nav-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 10px 0 22px;
  border-radius: 999px;
  will-change: transform;
}

.nav-brand {
  font-size: 17px;
  font-weight: 800;
  letter-spacing: .02em;
  background: var(--brand-grad);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
  white-space: nowrap;
}

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

/* language segmented control */
.lang-seg {
  position: relative;
  display: flex;
  align-items: center;
  height: 36px;
  padding: 3px;
  border-radius: 999px;
  -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(var(--glass-sat));
  backdrop-filter: blur(var(--glass-blur)) saturate(var(--glass-sat));
  background: var(--glass-tint);
  border: 1px solid var(--glass-border);
  box-shadow: var(--shadow-3);
}
.lang-seg button {
  position: relative;
  z-index: 1;
  padding: 0 14px;
  height: 100%;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-2);
}
.lang-seg button[aria-pressed="true"] { color: var(--text); }
.lang-thumb {
  position: absolute;
  top: 3px;
  left: 3px;
  height: calc(100% - 6px);
  border-radius: 999px;
  background: rgba(255, 255, 255, .55);
  box-shadow: 0 2px 8px rgba(0, 0, 0, .12), inset 0 1px 0 rgba(255, 255, 255, .8);
  will-change: transform;
  z-index: 0;
}
[data-theme="dark"] .lang-thumb {
  background: rgba(255, 255, 255, .14);
  box-shadow: 0 2px 8px rgba(0, 0, 0, .4), inset 0 1px 0 rgba(255, 255, 255, .18);
}

/* ---------- 7. Pages / sections ---------- */
.page {
  display: none;
  padding: calc(var(--nav-h) + 40px) 20px 80px;
  max-width: var(--page-w);
  margin: 0 auto;
}
.page.is-active { display: block; }

.section { margin-bottom: 96px; }
.section-title {
  font-size: clamp(26px, 4vw, 40px);
  font-weight: 800;
  letter-spacing: -.01em;
  margin-bottom: 10px;
}
.section-sub {
  font-size: 15.5px;
  color: var(--text-2);
  max-width: 640px;
  line-height: 1.65;
  margin-bottom: 34px;
}

/* hero */
.hero {
  min-height: calc(100vh - var(--nav-h) - 60px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 26px;
  perspective: 1200px;
}
.hero-title {
  font-size: clamp(38px, 7vw, 76px);
  font-weight: 900;
  letter-spacing: -.02em;
  line-height: 1.08;
}
/* 3D letter-flip spans injected by JS */
.hero-title .flip-letter {
  display: inline-block;
  will-change: transform;
  transform-style: preserve-3d;
}
.hero-sub {
  font-size: clamp(15px, 2vw, 18px);
  color: var(--text-2);
  max-width: 560px;
  line-height: 1.7;
}

/* bilibili card（通用 B 站样式卡，/bilibili 面板复用） */
.bili-card {
  width: min(560px, 100%);
  padding: 28px;
  text-align: left;
  will-change: transform, opacity;
  transform-style: preserve-3d;
}

/* ---------- 7b. 首屏个人名片（两层结构） ----------
   外层 .profile-scroll：只挂 perspective（预留滚动挂钩，当前初始即正面）
   内层 .profile-tilt：只做鼠标倾斜 ±8°（JS quickSpring 驱动） */
.profile-scroll {
  width: min(560px, 100%);
  perspective: 1000px;
}
.profile-card {
  position: relative;
  width: 100%;
  padding: 28px;
  text-align: left;
  transform-style: preserve-3d;
  /* 深玻璃 18-25% blur20 saturate170（glass-2 基础上微调） */
  background: rgba(255, 255, 255, .18);
  -webkit-backdrop-filter: blur(20px) saturate(170%);
  backdrop-filter: blur(20px) saturate(170%);
}
[data-theme="dark"] .profile-card { background: rgba(255, 255, 255, .10); }
.profile-tilt {
  position: relative;
  border-radius: inherit;
  transform-style: preserve-3d;
  will-change: transform;
}
/* 光斑：跟随 --mx/--my 的径向聚光 */
.profile-spot {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  z-index: 0;
  --mx: 50%;
  --my: 50%;
  background: radial-gradient(
    420px circle at var(--mx) var(--my),
    rgba(255, 255, 255, .12),
    transparent 62%
  );
}
[data-theme="dark"] .profile-spot {
  background: radial-gradient(
    420px circle at var(--mx) var(--my),
    rgba(255, 255, 255, .08),
    transparent 62%
  );
}
/* 斜角高光 overlay：opacity 淡入允许 transition（规格豁免项），
   位置由 --glare-x/--glare-y 驱动（JS 写，无 transition） */
.profile-glare {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  z-index: 3;
  opacity: 0;
  transition: opacity .25s;
  --glare-x: 50%;
  --glare-y: 50%;
  --glare-a: rgba(255, 255, 255, .35);
  --glare-b: rgba(255, 255, 255, .08);
  background: radial-gradient(
    120% 120% at var(--glare-x) var(--glare-y),
    var(--glare-a), var(--glare-b) 30%, transparent 55%
  );
  mix-blend-mode: overlay;
}
.profile-glare.is-on { opacity: 1; }
/* VIP：金色/霓虹高光变量（仅外观，不改判定/滚动/按钮） */
.profile-glare.vip {
  --glare-a: rgba(255, 214, 110, .5);
  --glare-b: rgba(148, 125, 255, .22);
}
/* 分层视差初始深度（JS pointermove 追加 translate） */
.profile-avatar { transform: translateZ(60px); will-change: transform; }
.profile-idwrap { transform: translateZ(30px); will-change: transform; }
.profile-actions { transform: translateZ(20px); will-change: transform; }
/* 降级：触屏/减动效 → 静态玻璃卡，保留可读高光 */
.profile-static .profile-glare { display: none; }
.profile-static .profile-avatar,
.profile-static .profile-idwrap,
.profile-static .profile-actions { transform: none; }
.bili-card-head { display: flex; align-items: center; gap: 16px; margin-bottom: 16px; }
.bili-avatar {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: var(--brand-grad);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 26px;
  font-weight: 800;
  flex: none;
  box-shadow: var(--shadow-3);
}
.bili-name { font-size: 18px; font-weight: 700; }
.bili-sign { font-size: 13px; color: var(--text-2); margin-top: 3px; }
.bili-tags { display: flex; flex-wrap: wrap; gap: 8px; margin: 14px 0 18px; }
.bili-tag {
  font-size: 12px;
  font-weight: 600;
  padding: 5px 12px;
  border-radius: 999px;
  background: rgba(124, 92, 255, .14);
  color: var(--brand-2);
  border: 1px solid rgba(124, 92, 255, .22);
}
.bili-tag.pink { background: rgba(251, 114, 153, .14); color: var(--brand-1); border-color: rgba(251, 114, 153, .25); }
.bili-desc { font-size: 14px; color: var(--text-2); line-height: 1.7; margin-bottom: 20px; }
.bili-actions { display: flex; flex-wrap: wrap; gap: 12px; }

/* ---------- 8. Cards grid ---------- */
.grid {
  display: grid;
  gap: 18px;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
}
.grid.dense { grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 14px; }

.tool-card {
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  will-change: transform;
  transform-style: preserve-3d;
  cursor: pointer;
}
.tool-card-top { display: flex; align-items: center; gap: 12px; }
.tool-icon {
  width: 46px;
  height: 46px;
  border-radius: 13px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex: none;
  box-shadow: var(--shadow-3);
  will-change: transform;
}
.tool-icon svg { width: 24px; height: 24px; }
.tool-name { font-size: 15.5px; font-weight: 700; }
.tool-meta { font-size: 12px; color: var(--text-3); margin-top: 2px; }
.tool-use { font-size: 13px; color: var(--text-2); line-height: 1.6; }
.tool-stats {
  font-size: 12px;
  color: var(--text-3);
  display: flex;
  flex-wrap: wrap;
  gap: 6px 12px;
}
.tool-stats b { color: var(--text-2); font-weight: 600; }
.tool-actions { display: flex; gap: 8px; margin-top: auto; padding-top: 4px; }

/* ---------- 9. 热门区网格（桌面 4 列 / 平板 3 列 / 移动 2 列） ---------- */
.grid.hot-grid {
  grid-template-columns: repeat(4, 1fr);
  max-width: 1080px;
  margin: 22px auto 0;
}
@media (max-width: 1024px) {
  .grid.hot-grid { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 640px) {
  .grid.hot-grid { grid-template-columns: repeat(2, 1fr); gap: 12px; }
}

/* ---------- 10. Search ---------- */
.search-box {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 18px;
  height: 50px;
  border-radius: 999px;
  margin-bottom: 26px;
}
.search-box svg { width: 18px; height: 18px; fill: var(--text-3); flex: none; }
.search-box input {
  flex: 1;
  border: 0;
  background: none;
  outline: none;
  font: inherit;
  font-size: 15px;
  color: var(--text);
  min-width: 0;
}
.search-box input::placeholder { color: var(--text-3); }
.search-box kbd {
  font-family: inherit;
  font-size: 11px;
  color: var(--text-3);
  border: 1px solid var(--glass-border);
  border-radius: 6px;
  padding: 3px 7px;
  flex: none;
}

/* category chips */
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 26px; }
.chip {
  padding: 8px 16px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-2);
  -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(var(--glass-sat));
  backdrop-filter: blur(var(--glass-blur)) saturate(var(--glass-sat));
  background: var(--glass-tint);
  border: 1px solid var(--glass-border);
  box-shadow: var(--shadow-3);
  will-change: transform;
}
.chip[aria-pressed="true"] {
  background: var(--brand-grad);
  color: #fff;
  border-color: transparent;
}

/* ---------- 11. Modal (FLIP target) ---------- */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(0, 0, 0, .35);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.modal-backdrop.is-open { display: flex; }
.modal {
  width: min(640px, 100%);
  max-height: 84vh;
  overflow: auto;
  padding: 30px;
  will-change: transform;
}

/* ---------- 12. Settings panel ---------- */
.settings-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 0;
  border-bottom: 1px solid var(--glass-border);
}
.settings-row:last-child { border-bottom: 0; }
.settings-label { font-size: 14.5px; font-weight: 600; }
.settings-hint { font-size: 12.5px; color: var(--text-3); margin-top: 3px; }

/* toggle switch */
.toggle {
  position: relative;
  width: 50px;
  height: 30px;
  border-radius: 999px;
  background: rgba(120, 120, 128, .28);
  flex: none;
  will-change: transform;
}
.toggle[aria-checked="true"] { background: var(--brand-2); }
.toggle-knob {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 2px 6px rgba(0, 0, 0, .25);
  will-change: transform;
}

/* segmented (settings options) */
.seg {
  display: inline-flex;
  padding: 3px;
  border-radius: 12px;
  background: rgba(120, 120, 128, .16);
  gap: 2px;
}
.seg button {
  padding: 7px 14px;
  border-radius: 9px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-2);
  will-change: transform;
}
.seg button[aria-pressed="true"] {
  background: rgba(255, 255, 255, .8);
  color: #1d1d1f;
  box-shadow: 0 1px 4px rgba(0, 0, 0, .14);
}
[data-theme="dark"] .seg button[aria-pressed="true"] {
  background: rgba(255, 255, 255, .16);
  color: var(--text);
}

/* range slider */
input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 140px;
  height: 4px;
  border-radius: 4px;
  background: rgba(120, 120, 128, .3);
  outline: none;
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 6px rgba(0, 0, 0, .3);
  cursor: pointer;
}

/* ---------- 13. Toast ---------- */
.toast {
  position: fixed;
  left: 50%;
  bottom: 34px;
  transform: translateX(-50%);
  z-index: 300;
  padding: 12px 22px;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 600;
  pointer-events: none;
  will-change: transform, opacity;
  opacity: 0;
}

/* ---------- 14. Responsive ---------- */
@media (max-width: 1024px) {
  :root { --page-w: 920px; }
}

@media (max-width: 640px) {
  :root { --nav-h: 56px; --radius-l: 20px; }
  .nav { padding: 0 6px 0 16px; }
  .nav-brand { font-size: 15px; }
  .icon-btn { width: 36px; height: 36px; }
  .lang-seg { height: 32px; }
  .lang-seg button { padding: 0 10px; font-size: 12px; }
  .page { padding: calc(var(--nav-h) + 28px) 14px 60px; }
  .section { margin-bottom: 64px; }
  .grid { grid-template-columns: 1fr 1fr; gap: 12px; }
  .grid.dense { grid-template-columns: 1fr 1fr; }
  .tool-card { padding: 14px; }
  .bili-card { padding: 20px; }
  .cursor-glow { display: none; } /* no pointer glow on touch */
}

@media (max-width: 400px) {
  .grid { grid-template-columns: 1fr; }
}

/* ---------- 15. Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  .cursor-glow,
  #bg-canvas { display: none; }
  .bg-base {
    background: var(--bg);
  }
  .hero-title .flip-letter { transform: none !important; }
}

/* JS sets this when user picks reduced/off motion in settings */
[data-motion="reduced"] .cursor-glow,
[data-motion="reduced"] #bg-canvas,
[data-motion="off"] .cursor-glow,
[data-motion="off"] #bg-canvas { display: none; }
[data-motion="reduced"] .bg-base,
[data-motion="off"] .bg-base { background: var(--bg); }

/* ---------- 16. Nav links ---------- */
.nav-links {
  display: flex;
  align-items: center;
  gap: 2px;
  margin: 0 auto;
}
.nav-links a {
  padding: 8px 14px;
  border-radius: 999px;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text-2);
  white-space: nowrap;
  will-change: transform;
}
.nav-links a[aria-current="page"] {
  color: var(--text);
  background: rgba(124, 92, 255, .14);
}
@media (max-width: 900px) {
  .nav-links { display: none; }
}

/* ---------- 17. Icon chip surface (brand-color SVGs stay visible) ---------- */
.tool-icon {
  background: rgba(255, 255, 255, .92);
  overflow: hidden;
}
[data-theme="dark"] .tool-icon {
  background: rgba(240, 240, 245, .94);
}
.icon-letter {
  width: 100%;
  height: 100%;
  border-radius: inherit;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: 800;
  font-size: 1.2em;
}

/* ---------- 18. About / misc sections ---------- */
.settings-card { padding: 8px 26px; max-width: 640px; }
.about-card { padding: 34px; max-width: 720px; }
.about-facts { display: flex; flex-wrap: wrap; gap: 10px; margin: 20px 0 6px; }
.about-facts .bili-tag { font-size: 13px; padding: 7px 14px; }
.about-p { font-size: 15px; color: var(--text-2); line-height: 1.8; margin-top: 14px; }

.ask-card { padding: 30px; max-width: 720px; min-height: 220px; }

.footer {
  text-align: center;
  padding: 40px 20px 46px;
  font-size: 13px;
  color: var(--text-3);
}

/* hero scroll hint */
.scroll-hint {
  font-size: 13px;
  color: var(--text-3);
  letter-spacing: .06em;
  animation: none; /* JS spring bobbing instead */
  will-change: transform;
}

/* home quick links row */
.quick-row { display: flex; flex-wrap: wrap; gap: 12px; justify-content: center; }

/* ---------- 19. Float dock (check-in / back-to-top) ---------- */
.float-dock {
  position: fixed;
  right: 18px;
  bottom: 24px;
  z-index: 150;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.dock-btn { width: 46px; height: 46px; }
.dock-btn svg { width: 21px; height: 21px; fill: currentColor; }
#backtop-btn { opacity: 0; pointer-events: none; } /* JS spring shows it */
@media (max-width: 640px) {
  .float-dock { right: 12px; bottom: 16px; }
  .dock-btn { width: 42px; height: 42px; }
}

/* ---------- 20. Check-in panel & calendar ---------- */
.checkin-panel { width: min(430px, 100%); padding: 26px; }
.checkin-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}
.checkin-points {
  text-align: right;
  font-size: 12px;
  color: var(--text-2);
  flex: none;
}
.checkin-points b {
  display: block;
  font-size: 26px;
  line-height: 1.1;
  background: var(--brand-grad);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
}
.checkin-streak {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
}
.ci-cal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}
.ci-cal-head b { font-size: 14.5px; }
.ci-week,
.ci-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 5px;
}
.ci-week span {
  text-align: center;
  font-size: 11px;
  color: var(--text-3);
  padding-bottom: 4px;
}
.ci-grid { margin-bottom: 4px; }
.ci-day {
  aspect-ratio: 1;
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-2);
  background: rgba(120, 120, 128, .10);
}
.ci-day.empty { background: none; }
.ci-day.future { opacity: .35; }
.ci-day.today { box-shadow: inset 0 0 0 2px var(--brand-2); }
.ci-day.done {
  background: var(--brand-grad);
  color: #fff;
}

/* ---------- 21. 游戏选择页 ---------- */
.games-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 22px;
  max-width: 760px;
  margin: 0 auto;
}
.game-card {
  padding: 30px 26px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}
.game-emoji { font-size: 44px; line-height: 1; }
.game-best { font-size: 13px; color: var(--text-2); }
.game-best b {
  font-size: 18px;
  background: var(--brand-grad);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
}
.game-card .btn { margin-top: 6px; }
@media (max-width: 640px) {
  .games-grid { grid-template-columns: 1fr; gap: 14px; }
  .game-card { padding: 24px 18px; }
}

/* ---------- 22. 设置页左侧全屏 ---------- */
#page-settings .section {
  width: 50vw;
  min-height: calc(100vh - var(--nav-h) - 60px);
  margin: 0 auto 40px 0;
  padding: 40px 34px 60px;
}
#page-settings .settings-card { padding: 6px 26px; }
@media (max-width: 1024px) {
  #page-settings .section { width: min(680px, 92vw); margin: 0 auto 40px; padding: 24px 0 40px; }
}
@media (max-width: 640px) {
  #page-settings .section { width: 100vw; padding: 16px 16px 40px; }
  #page-settings .settings-card { padding: 6px 16px; }
}
/* 设置页右侧模式（兑换解锁，JS 加类） */
#page-settings.settings-right .section { margin: 0 0 40px auto; }

/* ---------- 23. 兑换中心 ---------- */
.redeem-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}
.rd-card {
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.rd-card.rd-owned { box-shadow: 0 0 0 2px var(--brand-2), var(--shadow-3); }
.rd-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.rd-name { font-size: 14.5px; font-weight: 700; }
.rd-cost {
  font-size: 12.5px; font-weight: 700; white-space: nowrap;
  background: var(--brand-grad);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
}
.rd-desc { font-size: 12px; color: var(--text-3); line-height: 1.5; }
.rd-card .btn { align-self: flex-start; margin-top: 4px; }
.rd-input {
  width: 100%;
  margin-top: 8px;
  padding: 10px 14px;
  border-radius: 10px;
  border: 1px solid var(--glass-border);
  background: rgba(120, 120, 128, .10);
  color: var(--text);
  font: inherit;
  font-size: 13.5px;
}
.rd-input:focus { outline: 2px solid var(--brand-2); outline-offset: 2px; }
@media (max-width: 640px) {
  .redeem-grid { grid-template-columns: 1fr; }
}

/* ---------- 24. 反馈评论区 ---------- */
.fb-input {
  width: 100%;
  min-height: 84px;
  resize: vertical;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid var(--glass-border);
  background: rgba(120, 120, 128, .10);
  color: var(--text);
  font: inherit;
  font-size: 13.5px;
  line-height: 1.6;
}
.fb-input:focus { outline: 2px solid var(--brand-2); outline-offset: 2px; }
.fb-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin: 10px 0 4px;
}
.fb-list { display: flex; flex-direction: column; gap: 10px; margin-top: 10px; }
.fb-item {
  padding: 12px 14px;
  border-radius: 12px;
  background: rgba(120, 120, 128, .08);
  border: 1px solid var(--glass-border);
}
.fb-item-head { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.fb-name { font-size: 13px; font-weight: 700; }
.fb-item.golden .fb-name {
  background: linear-gradient(120deg, #f7b733, #ffd166);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
}
.fb-badge {
  font-size: 10.5px;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(124, 92, 255, .18);
  color: var(--brand-2);
  font-weight: 700;
}
.fb-badge.gold { background: rgba(247, 183, 51, .2); color: #c98a12; }
.fb-date { font-size: 11px; color: var(--text-3); margin-left: auto; }
.fb-text { font-size: 13px; line-height: 1.6; color: var(--text); word-break: break-word; }
.fb-empty { font-size: 12.5px; color: var(--text-3); text-align: center; padding: 14px 0; }

/* VIP 金色外观（仅视觉） */
[data-vip="on"] .profile-card,
[data-vip="on"] .game-card {
  box-shadow: 0 0 0 2px rgba(247, 183, 51, .55), var(--shadow-3);
}

/* ---------- 25. 主题扩展包配色选择器（兑换项 themes） ---------- */
.palette-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 10px;
}
.palette-swatch {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border-radius: 999px;
  border: 1px solid var(--glass-border);
  background: var(--glass-tint);
  -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(var(--glass-sat));
  backdrop-filter: blur(var(--glass-blur)) saturate(var(--glass-sat));
  box-shadow: var(--shadow-3);
  font-size: 13px;
  font-weight: 600;
  will-change: transform;
}
.palette-dot {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  flex: none;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .5);
}
.palette-swatch.is-active {
  box-shadow: 0 0 0 2px var(--brand-2), var(--shadow-3);
}
.palette-swatch.is-locked {
  opacity: .55;
  cursor: not-allowed;
}
.palette-lock { font-size: 11px; color: var(--text-3); }
