   平板适配（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); }
/* 离线状态指示器：复用墨色/危险色 token，不引入新视觉语言 */
.site-footer .net-offline { color: var(--danger); font-weight: 600; }

/* 印章式标签 */
.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); }
/* P4a：mid/lo 原色对浅色卡片对比度 3.6:1 不达 AA（≥4.5），加深至 ≥5:1 */
.pill.mid { color: #7d5316; background: rgba(176, 114, 63, 0.12); }
.pill.lo { color: #23634f; 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; }
/* P4a：暗色主题原红/赭/绿字对深底对比度不足（2.6:1），加亮至 ≥6:1 */
[data-theme="dark"] .pill.hi, [data-theme="dark"] .pill.overdue { color: #e08a7d; }
[data-theme="dark"] .pill.mid { color: #e0b47e; }
[data-theme="dark"] .pill.lo { color: #8fc9b2; }

/* ---------- 按钮 ---------- */
.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; flex-wrap: wrap; }

.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); }
.toast-act { /* P4c 删除撤销按钮 */ background: none; border: none; color: var(--accent); font-weight: 700; margin-left: 12px; padding: 2px 4px; cursor: pointer; text-decoration: underline; }
.toast-act:hover { color: var(--text); }

/* ---------- 进度条 ---------- */
.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; }
.enc-on { color: var(--ok-text); font-weight: 600; }

/* ---------- 自媒体统计图表（水墨配色） ---------- */
.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; }

/* ---------- 阅读统计 ---------- */
.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); }

/* ---------- 表单滑块 ---------- */
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; }

/* =============================================================
   手机适配：侧栏变为底部液态玻璃导航栏
   ⚠ 必须位居本文件末尾——所有基础规则之后。
   同特异性选择器按"后定义者胜"，此块位于文件前部时，以下规则
   全部被后方基础规则覆盖而从未生效（2026-08 验收发现）：
   弹窗底部抽屉(.modal/.overlay/popUpIn) → 居中+popIn
   .field 输入字号 16px → 被 14px 覆盖（iOS 聚焦缩放风险）
   .hbar 输入字号 16px → 被 13px 覆盖
   .st-row / .rd-grid 单列 → 被 160px/220px 双列覆盖
   .modal .body/.foot 边距（≤360px）→ 被 20px 覆盖
   ============================================================= */
@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; height: auto; padding: env(safe-area-inset-top) 14px 2px 14px; flex-wrap: wrap; }
  /* 移动端日期时间：独立一行右对齐小字（搜索+备忘占第一行） */
  .topbar .date {
    display: block; width: 100%; order: 3; margin: 0; padding: 2px 0 6px;
    font-size: 12px; text-align: right; color: var(--muted); white-space: nowrap;
  }
  .topbar .btn { padding: 6px 12px; }
  .btn, .small-btn { min-height: 44px; }
  .topbar .btn { min-height: 44px; }

  .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; }

  /* P4: 七模块移动端适配——卡片收紧/标签值堆叠/stat行换行 */
  .card { padding: 14px; }
  .row > .grow { flex-basis: 100%; }
  .stat-row { flex-wrap: wrap; }
  .hbar .btn, .hbar .small-btn { flex: 1 1 auto; text-align: center; }

  /* 弹窗在手机端为底部抽屉（覆盖基础居中样式，见块头说明） */
  .modal { width: 100%; max-height: 82vh; 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%; }

  /* 扫雷手机端：格子保持 ≥26px 触控尺寸；大棋盘超出视口时横向滑动查看 */
  /* 用 .ms-board-wrap .ms-board 压过基础规则 max-width:min(100%,540px)，否则困难棋盘被钳制回视口宽度 */
  .ms-board-wrap .ms-board { width: max(100%, calc(var(--cols) * 26px)); min-width: 100%; max-width: none; }
  .ms-cell { min-height: 26px; }
}

/* 超小屏手机（≤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: 16px; }
}

/* 手机横屏：压缩高度相关布局 */
@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; }
  .btn, .small-btn { min-height: auto; }
  .nav button .ico { font-size: 17px; }
}
