/* =============================================================
   Sonder · 水墨液态玻璃主题
   浅色=宣纸水墨 | 深色=墨黑山水
   液态玻璃：backdrop-filter blur+saturate+brightness + rgba 半透明
   不支持 backdrop-filter 时自动退化为实底（@supports fallback）
   ============================================================= */

:root {
  color-scheme: light;
  /* 浅色 · 宣纸水墨 */
  --bg: #f2efe6;
  --ink-blob-1: rgba(128, 116, 92, 0.20);
  --ink-blob-2: rgba(100, 104, 130, 0.18);
  --ink-mount: rgba(80, 76, 66, 0.10);

  --glass: rgba(255, 255, 255, 0.62);
  --glass-2: rgba(255, 255, 255, 0.52);
  --glass-sober: rgba(252, 249, 242, 0.92);

  --text: #2b2620;
  --muted: #8d8578;
  --soft-text: rgba(43, 38, 32, 0.9);
  --border: rgba(120, 108, 88, 0.26);
  --border-hi: rgba(255, 255, 255, 0.85);

  --accent: #c23b2e;          /* 朱砂红 */
  --accent-soft: rgba(194, 59, 46, 0.10);
  --danger: #a83225;
  --ok: #2e7d63;              /* 石绿 */
  --warn: #b0723f;            /* 赭石 */
  --huaqing: #3b4a6b;         /* 花青 */

  --shadow: 0 14px 44px rgba(40, 30, 20, 0.22), inset 0 1px 0 var(--border-hi);
  --radius: 20px;
  --wallpaper-opacity: 0.4;   /* 壁纸透明度默认 40%（js 按设置覆盖） */
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-ink: cubic-bezier(0.4, 0, 0.2, 1);
}
[data-theme="dark"] {
  color-scheme: dark;
  /* 深色 / 墨黑山水 */
  --bg: #171410;
  --ink-blob-1: rgba(226, 214, 190, 0.06);
  --ink-blob-2: rgba(190, 200, 220, 0.05);
  --ink-mount: rgba(230, 220, 200, 0.05);

  --glass: rgba(42, 35, 27, 0.62);
  --glass-2: rgba(48, 40, 31, 0.5);
  --glass-sober: rgba(26, 22, 17, 0.94);

  --text: #e8e2d8;
  --muted: #a29b8c;
  --border: rgba(255, 245, 225, 0.14);
  --border-hi: rgba(255, 255, 255, 0.22);

  --accent: #e0643f;
  --accent-soft: rgba(224, 100, 63, 0.16);
  --shadow: 0 14px 44px rgba(0, 0, 0, 0.55), inset 0 1px 0 rgba(255, 255, 255, 0.12);
  --wallpaper-opacity: 0.4;
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  font-family: "Segoe UI", "Microsoft YaHei", system-ui, sans-serif;
  background-color: var(--bg);
  background-image:
    radial-gradient(1200px 800px at 88% -8%, var(--ink-blob-1), transparent 62%),
    radial-gradient(950px 650px at -12% 104%, var(--ink-blob-2), transparent 55%),
    radial-gradient(700px 400px at 30% 18%, var(--ink-mount), transparent 70%);
  color: var(--text);
  font-size: 14px;
}
/* 壁纸背景层：透明度由设置控制（默认 var(--wallpaper-opacity)=0.4） */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  background-image: url("../img/wallpaper.jpg");
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  opacity: var(--wallpaper-opacity, 0.4);
  transition: opacity .2s var(--ease);
  pointer-events: none;
}
body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  background-color: var(--bg);
  opacity: 0.35;
  pointer-events: none;
}
.app { display: flex; height: 100vh; height: 100dvh; overflow: hidden; }

/* ---------- 液态玻璃基类 ---------- */
.glass {
  background: var(--glass);
  -webkit-backdrop-filter: blur(20px) saturate(1.6) brightness(1.05);
  backdrop-filter: blur(20px) saturate(1.6) brightness(1.05);
  border: 1px solid var(--border);
  box-shadow: inset 0 1px 0 var(--border-hi);
}
/* 不支持 backdrop-filter 的浏览器：降级为较实的底色，保证可读 */
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .glass { background: var(--glass-sober); }
  .card, .list-item, .rank-card, .modal, .nav button { background: var(--glass-sober); }
}

/* ---------- 侧边栏 ---------- */
.sidebar {
  width: 212px; flex: 0 0 212px; display: flex; flex-direction: column;
  padding: 18px 10px;
  border-right: 1px solid var(--border);
  background: var(--glass);
  -webkit-backdrop-filter: blur(20px) saturate(1.6);
  backdrop-filter: blur(20px) saturate(1.6);
  box-shadow: inset 0 1px 0 var(--border-hi);
}
.brand {
  font-family: "STKaiti", "KaiTi", "楷体", serif;
  font-weight: 700; font-size: 20px; letter-spacing: 2px;
  padding: 6px 12px 18px; display: flex; align-items: center; gap: 8px;
}
.brand .dot {
  width: 14px; height: 14px; border-radius: 3px;
  background: linear-gradient(135deg, var(--accent), #8f2d1f);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.nav { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.nav button {
  display: flex; align-items: center; gap: 10px; width: 100%; padding: 10px 12px;
  border: 1px solid var(--border);
  background: var(--glass-2);
  -webkit-backdrop-filter: blur(12px) saturate(1.5) brightness(1.02);
  backdrop-filter: blur(12px) saturate(1.5) brightness(1.02);
  border-radius: 13px;
  box-shadow: inset 0 1px 0 var(--border-hi), 0 2px 10px rgba(40, 30, 20, 0.10);
  color: var(--muted); font-size: 14px; text-align: left; cursor: pointer;
  transition: transform .14s var(--ease), color .18s var(--ease), background .18s var(--ease),
    border-color .18s var(--ease), box-shadow .18s var(--ease);
}
.nav button:hover {
  color: var(--text); transform: translateY(-1px);
  border-color: var(--accent);
  box-shadow: inset 0 1px 0 var(--border-hi), 0 6px 18px rgba(40, 30, 20, 0.12);
}
.nav button:active { transform: scale(.97); }
.nav button.active {
  background: linear-gradient(120deg, var(--accent-soft), rgba(194, 59, 46, 0.05));
  border-color: rgba(194, 59, 46, 0.5);
  color: var(--accent); font-weight: 600;
  box-shadow: inset 3px 0 0 var(--accent), inset 0 1px 0 var(--border-hi), 0 6px 18px rgba(194, 59, 46, 0.16);
}
.nav .ico { width: 18px; text-align: center; }

/* ---------- 主区 ---------- */
.main { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.topbar {
  height: 58px; flex: 0 0 58px; display: flex; align-items: center; gap: 12px; padding: 0 22px;
  border-bottom: 1px solid var(--border);
  background: var(--glass);
  -webkit-backdrop-filter: blur(20px) saturate(1.6);
  backdrop-filter: blur(20px) saturate(1.6);
  box-shadow: inset 0 1px 0 var(--border-hi);
  position: sticky; top: 0; z-index: 5;
}
.topbar .title {
  font-family: "STKaiti", "KaiTi", "楷体", serif;
  font-size: 17px; font-weight: 700; letter-spacing: 1px;
}
.topbar .date { color: var(--muted); font-size: 13px; margin-left: auto; }
.topbar .btn {
  border: 1px solid var(--border); background: var(--accent-soft); color: var(--text);
  padding: 7px 14px; border-radius: 10px; cursor: pointer; font-size: 13px; transition: all .15s;
}
.topbar .btn:hover { background: var(--accent); color: #fff; border-color: var(--accent); }
.topbar .btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.topbar .btn.primary:hover { filter: brightness(1.08); }
.memobox { height: 32px; width: 220px; padding: 0 10px; border: 1px solid var(--border); border-radius: 10px; background: var(--glass); color: var(--text); }

.content { flex: 1; overflow-y: auto; padding: 24px; }

/* ---------- 网格 ---------- */
.grid { display: grid; gap: 16px; }
.grid.cols-7 { grid-template-columns: repeat(7, 1fr); }
.grid.cols-6 { grid-template-columns: repeat(6, 1fr); }
.grid.cols-4 { grid-template-columns: repeat(4, 1fr); }
.grid.cols-3 { grid-template-columns: repeat(3, 1fr); }
.grid.cols-2 { grid-template-columns: repeat(2, 1fr); }
@media (max-width: 1000px) { .grid.cols-7, .grid.cols-6, .grid.cols-4, .grid.cols-3 { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 640px) {
  .grid.cols-7, .grid.cols-6, .grid.cols-4, .grid.cols-3, .grid.cols-2 { grid-template-columns: 1fr; }
}

/* =============================================================
   手机适配：侧栏变为底部液态玻璃导航栏
   ============================================================= */
@media (max-width: 720px) {
  html, body { height: 100vh; height: 100dvh; overscroll-behavior-y: none; }
  .app { flex-direction: column; height: 100vh; height: 100dvh; }
  .main { flex: 1; min-height: 0; }
  .content { padding: 14px 14px 84px; }

  .sidebar {
    width: 100%; flex: 0 0 auto; order: 2;
    flex-direction: row; align-items: center;
    padding: 8px 8px calc(8px + env(safe-area-inset-bottom));
    border-right: 0; border-top: 1px solid var(--border);
    -webkit-backdrop-filter: blur(20px) saturate(1.5);
    backdrop-filter: blur(20px) saturate(1.5);
    z-index: 10;
  }
  .brand { display: none; }
  .nav { flex-direction: row; width: 100%; gap: 6px; overflow-x: auto; scrollbar-width: none; }
  .nav::-webkit-scrollbar { display: none; }
  .nav button {
    flex: 1 0 auto; width: auto; min-height: 44px;
    justify-content: center; font-size: 0; padding: 10px 12px;
  }
  .nav button .ico { font-size: 20px; }
  .nav button.active {
    background: linear-gradient(180deg, var(--accent-soft), rgba(194, 59, 46, 0.05));
    box-shadow: inset 0 -3px 0 var(--accent), inset 0 1px 0 var(--border-hi), 0 6px 18px rgba(194, 59, 46, 0.16);
  }
  .topbar { min-height: 54px; padding: 0 14px; }
  .topbar .date { display: none; }
  .topbar .btn { padding: 6px 12px; }

  .hbar { gap: 8px; }
  .hbar input, .hbar select, .hbar .tool { flex: 1; min-width: 0; font-size: 16px; }
  .field input, .field select, .field textarea { font-size: 16px; }
  .modal { width: 100%; max-height: 82dvh; }
  .overlay { padding: 10px; align-items: flex-end; }
  .overlay .modal { animation: popUpIn .28s var(--ease); }
  .st-row { grid-template-columns: 1fr; }
  .rd-grid { grid-template-columns: 1fr; }
  .toast { font-size: 13px; }

  /* 五子棋大棋盘手机端：压缩边距与格距，15×15 保持方正不溢出 */
  .game-board.big { width: min(97vw, 480px); gap: 2px; padding: 8px; }
  .game-board.big .cell { border-radius: 4px; }
  .game-board.big .stone { width: 86%; height: 86%; }
}

/* 超小屏手机（≤360px）：压缩留白，保证导航不挤爆 */
@media (max-width: 360px) {
  .content { padding: 10px 10px 80px; }
  .game-board.big { gap: 1.5px; padding: 6px; }
  .nav button { padding: 10px 8px; }
  .nav button .ico { font-size: 18px; }
  .topbar .btn { padding: 6px 9px; font-size: 12px; }
  .modal .body, .modal .foot { padding-left: 14px; padding-right: 14px; }
  .hbar input, .hbar select, .hbar .tool { font-size: 15px; }
}

/* 手机横屏：压缩高度相关布局 */
@media (max-width: 900px) and (max-height: 480px) {
  .content { padding: 10px 14px 66px; }
  .topbar { min-height: 46px; }
  .sidebar { padding: 4px 8px calc(4px + env(safe-area-inset-bottom)); }
  .nav button { min-height: 38px; padding: 6px 10px; }
  .nav button .ico { font-size: 17px; }
}

/* =============================================================
   平板适配（721–960px）：侧栏折叠为图标栏，腾出内容空间
   ============================================================= */
@media (min-width: 721px) and (max-width: 960px) {
  .sidebar { width: 70px; flex: 0 0 70px; padding: 18px 8px; align-items: center; }
  .brand { padding: 6px 0 18px; justify-content: center; font-size: 0; }
  .brand .dot { width: 16px; height: 16px; }
  .nav button { font-size: 0; justify-content: center; padding: 12px 0; }
  .nav button .ico { font-size: 20px; }
  .nav button.active {
    box-shadow: inset 0 0 0 2px var(--accent), inset 0 1px 0 var(--border-hi), 0 6px 18px rgba(194, 59, 46, 0.16);
  }
  .content { padding: 20px; }
}

/* 触控细节（全局）：防 iOS 聚焦缩放、点按高亮、触控反馈 */
input, select, textarea, button { font-size: 16px; }
* { -webkit-tap-highlight-color: transparent; }
@media (hover: hover) and (pointer: fine) {
  input, select, textarea, button { font-size: inherit; }
}

/* 手机上提示条从底部弹入 */
@keyframes popUpIn {
  from { opacity: 0; transform: translateY(24px) scale(.98); }
  to { opacity: 1; transform: none; }
}

/* ---------- 玻璃卡片 ---------- */
.card, .list-item, .rank-card, .modal {
  background: var(--glass-2);
  -webkit-backdrop-filter: blur(18px) saturate(1.5) brightness(1.04);
  backdrop-filter: blur(18px) saturate(1.5) brightness(1.04);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  position: relative;
  transition: transform .2s var(--ease), border-color .2s var(--ease), box-shadow .2s var(--ease);
}
.card { padding: 18px; }
.card::before, .list-item::before, .rank-card::before, .modal::before {
  content: ""; position: absolute; top: 0; left: 12px; right: 12px; height: 1px;
  background: linear-gradient(90deg, transparent, var(--border-hi), transparent);
  pointer-events: none;
}
.card { padding: 18px; }
.list-item {
  padding: 13px 15px; display: flex; align-items: center; gap: 12px; margin-bottom: 10px;
}
.list-item:hover { transform: translateX(3px); border-color: var(--accent); }
.list-item .grow { flex: 1; min-width: 0; }
.list-item .title { font-weight: 600; }
.list-item .sub { color: var(--muted); font-size: 12px; margin-top: 3px; }
.rank-card { padding: 15px; cursor: pointer; transition: transform .12s, border-color .12s; }
.rank-card:hover { transform: translateY(-2px); border-color: var(--accent); }
.rank-card .num { font-size: 27px; font-weight: 700; font-family: "STKaiti", "KaiTi", serif; }
.rank-card .lab { color: var(--muted); font-size: 13px; margin-top: 4px; }
.rank-card .sub { color: var(--muted); font-size: 12px; margin-top: 2px; }

.muted { color: var(--muted); }
.small { font-size: 12px; }

/* ---------- 页脚：开源说明与托管链接 ---------- */
.site-footer {
  flex: 0 0 auto; display: flex; align-items: center; justify-content: center; flex-wrap: wrap;
  gap: 4px 10px; padding: 12px 16px 16px; color: var(--muted);
  font-size: 12px; text-align: center; border-top: 1px dashed var(--border);
}
.site-footer a { color: var(--muted); text-decoration: underline; text-underline-offset: 3px; }
.site-footer a:hover { color: var(--accent); }

/* 印章式标签 */
.tag {
  display: inline-block; background: var(--accent-soft); color: var(--accent);
  font-size: 12px; padding: 2px 9px; border-radius: 20px; margin-right: 4px;
}
.pill {
  font-size: 12px; padding: 2px 10px; border-radius: 20px;
  background: var(--glass-2); color: var(--muted);
  border: 1px solid var(--border); white-space: nowrap;
}
.pill.hi { color: #b32a1f; background: rgba(194, 59, 46, 0.12); border-color: rgba(194, 59, 46, 0.3); }
.pill.mid { color: #9a6a1f; background: rgba(176, 114, 63, 0.12); }
.pill.lo { color: #2e7d63; background: rgba(46, 125, 99, 0.12); }
.pill.done { color: var(--muted); text-decoration: line-through; }
.pill.overdue { color: #b32d22; background: rgba(194, 59, 46, 0.14); font-weight: 600; }

/* ---------- 按钮 ---------- */
.small-btn {
  border: 1px solid var(--border); background: var(--glass-2); color: var(--muted);
  padding: 3px 9px; border-radius: 8px; cursor: pointer; font-size: 12px; transition: all .15s;
}
.small-btn:hover { color: var(--accent); border-color: var(--accent); background: var(--accent-soft); transform: translateY(-1px); }
.small-btn:active { transform: scale(.94); }
.small-btn.danger { color: var(--danger); }
.row { display: flex; align-items: center; gap: 8px; }

.hbar { display: flex; align-items: center; gap: 10px; margin-bottom: 16px; flex-wrap: wrap; }
.hbar input, .hbar select, .hbar .tool {
  padding: 7px 11px; border: 1px solid var(--border); border-radius: 10px;
  background: var(--glass-2); color: var(--text); font-size: 13px;
  -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
}
.hbar input:focus, .hbar select:focus { border-color: var(--accent); outline: none; }
.hbar .sp { margin-left: auto; }

/* ---------- 空状态（水墨留白） ---------- */
.empty { text-align: center; color: var(--muted); padding: 52px 20px; }
.empty .big { font-size: 42px; margin-bottom: 10px; opacity: .7; }
.empty .btn { margin-top: 16px; }

.section-title {
  font-family: "STKaiti", "KaiTi", "楷体", serif;
  font-size: 15px; font-weight: 700; letter-spacing: 1px; margin: 22px 0 10px;
  display: flex; align-items: center; gap: 10px;
}
.section-title:first-child { margin-top: 0; }
.section-title::after {
  content: ""; flex: 1; height: 1px;
  background: linear-gradient(90deg, var(--border), transparent);
}

/* ---------- 首页每日金句 ---------- */
.quote {
  font-family: "STKaiti", "KaiTi", "楷体", serif;
  font-size: 14px; color: var(--muted); letter-spacing: 2px;
  text-align: center; padding: 2px 0 4px; margin-bottom: 8px;
  animation: fadeIn .5s var(--ease) both;
}

/* ---------- 弹窗（液态玻璃） ---------- */
.overlay {
  position: fixed; inset: 0; z-index: 50; padding: 20px;
  display: flex; align-items: center; justify-content: center;
  background: rgba(20, 16, 10, 0.35);
  -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px);
}
.modal {
  width: 460px; max-width: 100%; max-height: 86vh; overflow-y: auto;
  background: var(--glass-sober);
  -webkit-backdrop-filter: blur(20px) saturate(1.4);
  backdrop-filter: blur(20px) saturate(1.4);
  padding: 0; box-shadow: var(--shadow);
}
.modal h3 { margin: 0; padding: 16px 20px; border-bottom: 1px solid var(--border); font-size: 15px; font-family: "STKaiti", "KaiTi", serif; letter-spacing: 1px; }
.modal .body { padding: 18px 20px; }
.modal .foot { padding: 12px 20px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 8px; }

.field { margin-bottom: 12px; }
.field label { display: block; font-size: 12px; color: var(--muted); margin-bottom: 5px; }
.field input, .field select, .field textarea {
  width: 100%; padding: 8px 11px; border: 1px solid var(--border); border-radius: 10px;
  background: var(--glass-2); color: var(--text); font-family: inherit; font-size: 14px;
  -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
}
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--accent); outline: none; }
.field textarea { resize: vertical; min-height: 70px; }
.field .hint { font-size: 12px; color: var(--danger); margin-top: 4px; }

.btn {
  border: 1px solid var(--border); background: var(--glass-2); color: var(--text);
  padding: 7px 15px; border-radius: 10px; cursor: pointer; font-size: 13px;
  transition: background .15s var(--ease), border-color .15s var(--ease), color .15s var(--ease), transform .12s var(--ease), filter .15s var(--ease);
  -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
}
.btn:hover { background: var(--accent-soft); border-color: var(--accent); }
.btn:active { transform: scale(.96); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { filter: brightness(1.08); }
.btn.danger { color: var(--danger); border-color: rgba(194, 59, 46, 0.5); }
.rank-card:hover .num { color: var(--accent); }

/* ---------- Toast ---------- */
#toastWrap { position: fixed; top: 16px; right: 16px; z-index: 100; display: flex; flex-direction: column; gap: 8px; }
.toast {
  background: var(--glass-sober);
  -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px);
  border: 1px solid var(--border); border-left: 4px solid var(--ok);
  padding: 10px 15px; border-radius: 10px; box-shadow: var(--shadow); font-size: 13px;
}
.toast.err { border-left-color: var(--danger); }

/* ---------- 进度条 ---------- */
.progress { height: 8px; background: var(--glass-sober); border: 1px solid var(--border); border-radius: 20px; overflow: hidden; }
.progress > i { display: block; height: 100%; background: linear-gradient(90deg, var(--accent), var(--warn)); }

.stat-row { display: flex; align-items: center; gap: 10px; }
.toggle { display: flex; align-items: center; gap: 8px; }
.details { margin-top: 10px; padding-top: 10px; border-top: 1px dashed var(--border); }
.notes-area { font-size: 13px; color: var(--text); white-space: pre-wrap; word-break: break-word; }

/* ---------- 自媒体统计图表（水墨配色） ---------- */
.st-legend { display: flex; gap: 16px; padding: 6px 0 10px; border-bottom: 1px solid var(--border); margin-bottom: 10px; }
.st-row { display: grid; grid-template-columns: 160px 1fr; gap: 10px; align-items: center; padding: 7px 0; border-bottom: 1px dashed var(--border); }
.st-row:last-child { border-bottom: 0; }
.st-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; }
.st-bars { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.st-col { display: flex; align-items: center; gap: 6px; }
.st-bar { flex: 1; height: 14px; background: var(--glass-sober); border: 1px solid var(--border); border-radius: 5px; overflow: hidden; }
.st-bar > i { display: block; height: 100%; }
.st-val { font-size: 12px; color: var(--muted); min-width: 38px; text-align: right; }
@media (max-width: 640px) { .st-row { grid-template-columns: 1fr; } .st-title { margin-bottom: 4px; } }

/* ---------- 阅读统计 ---------- */
.rd-grid { display: grid; grid-template-columns: 220px 1fr; gap: 22px; align-items: start; }
.rd-donut { width: 124px; height: 124px; border-radius: 50%; margin: 0 auto; border: 1px solid var(--border); }
.rd-donut-legend { margin-top: 10px; display: flex; flex-direction: column; gap: 4px; }
.rd-legend { display: flex; align-items: center; gap: 6px; font-size: 13px; }
.rd-legend i { width: 12px; height: 12px; border-radius: 3px; }
.rd-brow { display: grid; grid-template-columns: 120px 1fr 30px; gap: 8px; align-items: center; padding: 5px 0; }
.rd-blabel { font-size: 13px; color: var(--muted); }
@media (max-width: 640px) { .rd-grid { grid-template-columns: 1fr; } }

/* ---------- 表单滑块 ---------- */
input[type="range"] { -webkit-appearance: none; appearance: none; height: 6px; border-radius: 10px; background: var(--glass-sober); border: 1px solid var(--border); }
input[type="range"]::-webkit-slider-thumb { -webkit-appearance: none; appearance: none; width: 16px; height: 16px; border-radius: 50%; background: linear-gradient(135deg, var(--accent), var(--warn)); border: 2px solid #fff; box-shadow: 0 2px 6px rgba(0,0,0,.25); cursor: grab; transition: transform .1s; }
input[type="range"]::-webkit-slider-thumb:hover { transform: scale(1.15); }
input[type="range"]::-moz-range-thumb { width: 16px; height: 16px; border-radius: 50%; background: var(--accent); border: 2px solid #fff; cursor: grab; }

/* =============================================================
   微动态交互：水墨入画感
   入场 = 淡入上浮；图表 = 墨液流出(scaleX)；卡片悬停 = 微抬+朱印
   触摸即缩放反馈；尊重 prefers-reduced-motion
   ============================================================= */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: none; }
}
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}
@keyframes popIn {
  from { opacity: 0; transform: translateY(14px) scale(.97); }
  to { opacity: 1; transform: none; }
}
@keyframes toastIn {
  from { opacity: 0; transform: translateX(24px); }
  to { opacity: 1; transform: none; }
}
@keyframes barsGrow {
  from { transform: scaleX(0); }
  to { transform: scaleX(1); }
}
@keyframes inkBreathe {
  0%, 100% { transform: translateY(0) scale(1); }
  50% { transform: translateY(-6px) scale(1.05); }
}
@keyframes dotPulse {
  0%, 100% { box-shadow: 0 0 0 0 var(--accent-soft); }
  50% { box-shadow: 0 0 0 8px transparent; }
}
@keyframes donutGlow {
  0%, 100% { box-shadow: var(--shadow); }
  50% { box-shadow: var(--shadow), 0 0 0 6px var(--accent-soft); }
}

/* 页面入场：内容区整体淡入，卡片轻微上浮 */
.content > * {
  animation: fadeUp .32s var(--ease) both;
}
.content > *:nth-child(2) { animation-delay: .025s; }
.content > *:nth-child(3) { animation-delay: .05s; }
.content > *:nth-child(4) { animation-delay: .075s; }

/* 图表 "墨液蔓延"：进度条/条形图从 0 滋开到目标值 */
.progress > i, .st-bar > i {
  transform-origin: left center;
  animation: barsGrow .65s var(--ease) both;
}
.rd-donut { animation: fadeIn .6s var(--ease) both, donutGlow 4s ease-in-out 1s infinite; }
.rd-donut-legend, .st-legend { animation: fadeIn .5s var(--ease) both; }

/* 弹窗层级 */
.overlay { animation: fadeIn .18s var(--ease); }
.overlay .modal { animation: popIn .3s var(--ease); }

/* Toast 滑入 */
.toast { animation: toastIn .3s var(--ease); }

/* 空状态喘气（墨晕呼吸） */
.empty .big { display: inline-block; animation: inkBreathe 3.6s var(--ease) infinite; }

/* 品牌印章脉动 */
.brand .dot { animation: dotPulse 3.2s var(--ease) infinite; }

/* 尊重系统减少动效设置 */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001s !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001s !important;
  }
}

/* ---------- 水墨细滚动条 ---------- */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: linear-gradient(var(--border), var(--muted));
  border-radius: 10px; border: 2px solid transparent; background-clip: padding-box;
}
::-webkit-scrollbar-thumb:hover { background: linear-gradient(var(--muted), var(--accent)); background-clip: padding-box; }

/* =============================================================
   娱乐游戏：选游戏卡片 / 分段模式 / 棋盘棋子（水墨液态玻璃一致）
   ============================================================= */
.lg-pick { cursor: pointer; padding: 20px 18px; text-align: left; transition: transform .2s var(--ease), border-color .2s var(--ease), box-shadow .2s var(--ease); }
.lg-pick:hover { transform: translateY(-3px); border-color: var(--accent); box-shadow: var(--shadow), 0 0 0 3px var(--accent-soft); }
.lg-pick .lab { font-size: 21px; font-weight: 700; font-family: "STKaiti", "KaiTi", serif; }
.lg-pick .sub { color: var(--muted); font-size: 12px; margin-top: 6px; line-height: 1.7; }

.lg-seg { display: inline-flex; border: 1px solid var(--border); border-radius: 12px; overflow: hidden; background: var(--glass-2); box-shadow: inset 0 1px 0 var(--border-hi); }
.lg-seg button { border: 0; background: transparent; color: var(--text); padding: 8px 16px; cursor: pointer; font-size: 13px; font-family: inherit; transition: background .15s, color .15s; }
.lg-seg button + button { border-left: 1px solid var(--border); }
.lg-seg button.on { background: var(--accent); color: #fff; }
.lg-seg button:hover:not(.on) { background: var(--accent-soft); }

.gstatus {
  text-align: center; margin: 4px 0 14px; font-size: 14px; color: var(--text);
  min-height: 22px;
}
.board-wrap { display: flex; justify-content: center; }
.game-board {
  display: grid; gap: 3px; padding: 10px;
  width: min(92vw, 480px);
  background: var(--glass-2);
  -webkit-backdrop-filter: blur(18px) saturate(1.5) brightness(1.04);
  backdrop-filter: blur(18px) saturate(1.5) brightness(1.04);
  border: 1px solid var(--border); border-radius: 16px; box-shadow: var(--shadow);
}
.game-board.small { grid-template-columns: repeat(3, 1fr); width: min(92vw, 300px); }
.game-board.big { grid-template-columns: repeat(15, 1fr); }
.game-board.big .cell { min-height: 0; }
.cell {
  position: relative; aspect-ratio: 1/1; min-height: 26px; padding: 0; border: 1px solid var(--border);
  background: transparent; cursor: pointer; display: flex; align-items: center; justify-content: center;
  border-radius: 6px; transition: background .12s var(--ease), transform .1s var(--ease);
}
.cell:hover { background: var(--accent-soft); }
.cell:active { transform: scale(.92); }
.cell:disabled { cursor: default; }
.game-board.done .cell { cursor: default; }
.game-board.done .cell:hover { background: transparent; }
.mk { font-size: 2.3em; line-height: 1; font-weight: 700; font-family: "STKaiti", "KaiTi", serif; }
.mk.x { color: var(--accent); }
.mk.o { color: var(--huaqing); }
[data-theme="dark"] .mk.o { color: #8fa4cc; }
.stone { display: block; width: 82%; height: 82%; border-radius: 50%; }
.stone.b {
  background: radial-gradient(circle at 34% 30%, #575146, #17120d 72%);
  box-shadow: 0 2px 6px rgba(0, 0, 0, .35), inset 0 0 4px rgba(255, 255, 255, .10);
}
.stone.w {
  background: radial-gradient(circle at 34% 30%, #ffffff, #e9e1d2 78%);
  border: 1px solid rgba(90, 80, 70, .38);
  box-shadow: 0 2px 6px rgba(40, 30, 15, .28);
}
.cell.last::after {
  content: ""; position: absolute; width: 22%; height: 22%;
  border-radius: 50%; background: var(--accent); top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  animation: fadeIn .3s var(--ease) both;
}
.cell.win { background: var(--accent-soft); box-shadow: inset 0 0 0 1px var(--accent), 0 0 10px var(--accent-soft); }
.game-board.done .cell.win:hover { background: var(--accent-soft); }

/* 落子 / 胜利的墨染反馈：仅对最后落子格与胜利格播放动画，避免整盘重排 */
.cell.last { animation: fadeUp .25s var(--ease) both; }
.game-board.done .cell.win { animation: cellPulse 1.1s var(--ease) infinite; }
@keyframes cellPulse {
  0%, 100% { background: var(--accent-soft); }
  50% { background: rgba(194, 59, 46, .26); }
}

/* 战绩 */
.btn:disabled { opacity: .45; cursor: not-allowed; transform: none; }