/*
  path: /css/
  file: style.css
  desc: 数独秘境 Sudoku Realm 全站样式（终版）。
        设计系统变量、玻璃拟态、按钮体系、棋盘与笔记网格、数字面板、
        工具面板、主界面入口、子页面、复盘时间轴、图表、成就、商店、
        排行榜、签到、设置、模态、Toast、可访问性、iPhone 安全区适配。
        全部内联，无外部字体、无外部图片。

  修复点（相对上一版）：
    1. #app 与 .screen 使用 min-height:100%，配合 body 的 safe-area padding，
       避免在 iPhone 刘海屏上内容被整体顶出视口。
    2. .bottom-nav 与 .toolbar 改为 height:auto + min-height，避免
       safe-bottom 在 body 已处理的情况下被重复计算。
    3. .replay-board 宽高一致，避免复盘棋盘被拉伸。
    4. .board[data-n="6"] .cell-note 字号调小，防止 6 宫格笔记溢出。
    5. 补 .replay-item / .step-item 的 text-align:left，保证按钮内容左对齐。
    6. 补 .num-btn.is-disabled 的 pointer-events:none，避免误触。
    7. 补 .modal-layer / .toast-layer / .offline-banner / .update-banner
       的 z-index 与 fixed 定位，覆盖所有内容。
    8. .ring-chart / .bar-fill / .progress-fill 支持行内 width/background 覆盖。
    9. 删除未使用的冗余规则，保持类名与 JS 完全一致。
*/

/* ============================================================
   1. 设计系统变量
   ============================================================ */
:root {
  /* 字号 */
  --fs-title: 28px;
  --fs-section: 20px;
  --fs-body: 16px;
  --fs-aux: 14px;
  --fs-small: 12px;
  --fs-cell: 24px;
  --fs-note: 10px;

  /* 间距 */
  --sp-1: 4px;
  --sp-2: 8px;
  --sp-3: 12px;
  --sp-4: 16px;
  --sp-5: 24px;
  --sp-6: 32px;

  /* 圆角 */
  --r-1: 4px;
  --r-2: 8px;
  --r-3: 12px;
  --r-full: 999px;

  /* 颜色 */
  --c-bg: #0D1117;
  --c-board: #161B22;
  --c-grid: #30363D;
  --c-box: #484F58;
  --c-given: #E6EDF3;
  --c-player: #58A6FF;
  --c-select: #D29922;
  --c-hl: rgba(210, 153, 34, 0.25);
  --c-peers: rgba(88, 166, 255, 0.10);
  --c-same: rgba(88, 166, 255, 0.22);
  --c-error: #F85149;
  --c-note: #8B949E;
  --c-primary: #1F6FEB;
  --c-primary-lt: #58A6FF;
  --c-secondary: #21262D;
  --c-success: #3FB950;
  --c-points: #D29922;
  --c-text: #E6EDF3;
  --c-text-dim: #8B949E;
  --c-line: rgba(255, 255, 255, 0.08);
  --c-line-2: rgba(255, 255, 255, 0.14);

  /* 三规格主题色 */
  --t-4: #7EE787;
  --t-6: #58A6FF;
  --t-9: #D29922;
  --t-accent: var(--c-primary-lt);

  /* 层级 */
  --z-screen: 1;
  --z-modal: 60;
  --z-toast: 80;
  --z-banner: 90;

  /* 动画时长 */
  --dur-fast: 150ms;
  --dur: 200ms;
  --dur-slow: 300ms;

  /* 安全区 */
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
  --safe-right: env(safe-area-inset-right, 0px);
}

/* 主题作用域：由 JS 在 #app 上切换 data-theme */
#app[data-theme="4"] { --t-accent: var(--t-4); }
#app[data-theme="6"] { --t-accent: var(--t-6); }
#app[data-theme="9"] { --t-accent: var(--t-9); }

/* ============================================================
   2. 基础重置与全局
   ============================================================ */
* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  overscroll-behavior: none;
  -webkit-text-size-adjust: 100%;
  touch-action: manipulation;
}

body {
  min-height: 100dvh;
  padding-top: var(--safe-top);
  padding-bottom: var(--safe-bottom);
  padding-left: var(--safe-left);
  padding-right: var(--safe-right);
  font-family: system-ui, -apple-system, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  font-size: var(--fs-body);
  color: var(--c-text);
  background:
    radial-gradient(circle at 20% 10%, #1F6FEB22, transparent 40%),
    radial-gradient(circle at 80% 90%, #D2992222, transparent 40%),
    var(--c-bg);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
  user-select: none;
  -webkit-user-select: none;
}

.svg-defs {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}

.hidden { display: none !important; }

button {
  font-family: inherit;
  font-size: inherit;
  color: inherit;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
}

input {
  font-family: inherit;
  font-size: inherit;
}

.ico {
  width: 24px;
  height: 24px;
  display: block;
  flex: none;
  color: currentColor;
}

/* ============================================================
   3. 屏幕容器与路由
   ============================================================ */
#app {
  position: relative;
  width: 100%;
  max-width: 720px;
  margin: 0 auto;
  min-height: 100%;
}

.screen {
  display: none;
  flex-direction: column;
  width: 100%;
  min-height: 100%;
}

.screen.active {
  display: flex;
  animation: screenIn var(--dur) ease both;
}

@keyframes screenIn {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: none; }
}

/* ============================================================
   4. 通用卡片 / 按钮 / 表单
   ============================================================ */
.card {
  background: rgba(22, 27, 34, 0.72);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--c-line);
  border-radius: 16px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
}

@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .card { background: rgba(22, 27, 34, 0.96); }
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-2);
  min-height: 44px;
  padding: 0 var(--sp-4);
  border-radius: var(--r-3);
  font-size: var(--fs-body);
  font-weight: 600;
  transition: transform var(--dur-fast) ease, opacity var(--dur-fast) ease, box-shadow var(--dur) ease;
  border: 1px solid transparent;
  text-align: center;
  line-height: 1.2;
}

.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: 0.45; pointer-events: none; }

.btn-primary {
  background: linear-gradient(135deg, #1F6FEB, #58A6FF);
  box-shadow: 0 4px 16px #1F6FEB66;
  border-radius: var(--r-3);
  color: #fff;
}

.btn-secondary {
  background: var(--c-secondary);
  border: 1px solid var(--c-line-2);
  color: var(--c-text);
}

.btn-ghost {
  background: transparent;
  border: 1px solid var(--c-line-2);
  color: var(--c-text-dim);
}

.btn-success {
  background: linear-gradient(135deg, #2EA043, #3FB950);
  color: #fff;
}

.btn-danger {
  background: linear-gradient(135deg, #B62324, #F85149);
  color: #fff;
}

.btn-accent {
  background: linear-gradient(135deg, var(--t-accent), rgba(255, 255, 255, 0.35));
  color: #0D1117;
  font-weight: 700;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
}

.btn-block { width: 100%; }

.btn-mini {
  min-height: 32px;
  padding: 0 var(--sp-3);
  font-size: var(--fs-small);
  border-radius: var(--r-2);
}

.icon-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  min-width: 44px;
  border-radius: var(--r-2);
  color: var(--c-text);
  transition: background var(--dur-fast) ease, transform var(--dur-fast) ease;
}

.icon-btn:active { transform: scale(0.92); background: var(--c-secondary); }

.dot-badge {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 8px;
  height: 8px;
  border-radius: var(--r-full);
  background: var(--c-error);
  box-shadow: 0 0 8px var(--c-error);
}

.field {
  display: block;
  margin-bottom: var(--sp-3);
}

.field-label {
  display: block;
  font-size: var(--fs-small);
  color: var(--c-text-dim);
  margin-bottom: var(--sp-1);
  letter-spacing: 0.4px;
}

.input {
  width: 100%;
  min-height: 44px;
  padding: 0 var(--sp-3);
  border-radius: var(--r-2);
  background: var(--c-secondary);
  border: 1px solid var(--c-line-2);
  color: var(--c-text);
  outline: none;
  transition: border-color var(--dur-fast) ease, box-shadow var(--dur-fast) ease;
}

.input:focus {
  border-color: var(--c-primary);
  box-shadow: 0 0 0 3px #1F6FEB33;
}

.err-msg {
  min-height: 18px;
  margin: 0 0 var(--sp-2);
  font-size: var(--fs-small);
  color: var(--c-error);
}

/* ============================================================
   5. 账号界面
   ============================================================ */
.auth-wrap {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: var(--sp-5) var(--sp-4);
  gap: var(--sp-4);
}

.brand-block { text-align: center; }

.brand-title {
  margin: 0;
  font-size: var(--fs-title);
  font-weight: 800;
  letter-spacing: 2px;
  background: linear-gradient(135deg, #7EE787, #58A6FF 45%, #D29922);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.brand-sub {
  margin: var(--sp-1) 0 0;
  font-size: var(--fs-small);
  letter-spacing: 6px;
  color: var(--c-text-dim);
}

.auth-card { padding: var(--sp-4); }

.tab-row {
  display: flex;
  gap: var(--sp-1);
  padding: 3px;
  background: var(--c-secondary);
  border-radius: var(--r-2);
  margin-bottom: var(--sp-4);
}

.tab {
  flex: 1;
  min-height: 38px;
  border-radius: var(--r-1);
  font-size: var(--fs-aux);
  font-weight: 600;
  color: var(--c-text-dim);
  transition: all var(--dur-fast) ease;
}

.tab.is-active {
  background: var(--c-primary);
  color: #fff;
  box-shadow: 0 2px 10px #1F6FEB66;
}

.avatar-grid {
  display: grid;
  grid-template-columns: repeat(10, 1fr);
  gap: var(--sp-1);
  max-height: 200px;
  overflow-y: auto;
  padding: var(--sp-1);
  background: var(--c-secondary);
  border-radius: var(--r-2);
  border: 1px solid var(--c-line);
  -webkit-overflow-scrolling: touch;
}

.avatar-opt {
  display: flex;
  align-items: center;
  justify-content: center;
  aspect-ratio: 1;
  border-radius: var(--r-1);
  font-size: 18px;
  line-height: 1;
  transition: transform var(--dur-fast) ease, background var(--dur-fast) ease;
}

.avatar-opt:active { transform: scale(0.9); }

.avatar-opt.is-active {
  background: var(--c-primary);
  box-shadow: 0 0 0 2px var(--c-primary-lt);
}

.auth-foot {
  margin: 0;
  text-align: center;
  font-size: var(--fs-small);
  color: var(--c-text-dim);
}

/* ============================================================
   6. 主界面
   ============================================================ */
.home-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 56px;
  padding: 0 var(--sp-3);
  flex: none;
  gap: var(--sp-2);
}

.user-chip {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  min-height: 44px;
  padding: 2px var(--sp-2) 2px 2px;
  border-radius: var(--r-full);
  transition: background var(--dur-fast) ease;
  max-width: 55%;
}

.user-chip:active { background: var(--c-secondary); }

.avatar {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  flex: none;
  border-radius: var(--r-full);
  background: var(--c-secondary);
  border: 1px solid var(--c-line-2);
  font-size: 20px;
  line-height: 1;
  overflow: hidden;
}

.user-meta {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  min-width: 0;
  gap: 1px;
}

.user-name {
  font-size: var(--fs-aux);
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

.user-title {
  font-size: var(--fs-small);
  color: var(--c-points);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

.home-top-right {
  display: flex;
  align-items: center;
  gap: var(--sp-1);
  flex: none;
}

.points-pill {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-1);
  height: 32px;
  padding: 0 var(--sp-3);
  border-radius: var(--r-full);
  background: rgba(210, 153, 34, 0.12);
  border: 1px solid rgba(210, 153, 34, 0.3);
  color: var(--c-points);
  font-size: var(--fs-aux);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.points-dot {
  width: 8px;
  height: 8px;
  border-radius: var(--r-full);
  background: var(--c-points);
  box-shadow: 0 0 8px var(--c-points);
  flex: none;
}

.home-scroll {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: var(--sp-1) var(--sp-3) var(--sp-3);
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
}

.home-spacer { height: var(--sp-3); flex: none; }

.btn-continue {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  min-height: 64px;
  padding: 0 var(--sp-4);
  border-radius: var(--r-3);
  background: linear-gradient(135deg, rgba(31, 111, 235, 0.28), rgba(88, 166, 255, 0.14));
  border: 1px solid rgba(88, 166, 255, 0.4);
  box-shadow: 0 6px 20px rgba(31, 111, 235, 0.25);
  color: var(--c-text);
  text-align: left;
  transition: transform var(--dur-fast) ease;
}

.btn-continue:active { transform: scale(0.98); }

.continue-main { display: flex; flex-direction: column; gap: 2px; min-width: 0; }

.continue-label { font-size: var(--fs-body); font-weight: 700; }

.continue-sub {
  font-size: var(--fs-small);
  color: var(--c-text-dim);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sec-title {
  margin: var(--sp-3) 0 var(--sp-1);
  font-size: var(--fs-section);
  font-weight: 700;
  letter-spacing: 1px;
}

.entry-row {
  display: grid;
  gap: var(--sp-2);
}

.entry-row-3 { grid-template-columns: repeat(3, 1fr); }
.entry-row-2 { grid-template-columns: repeat(2, 1fr); }

.entry {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--sp-1);
  min-height: 80px;
  padding: var(--sp-2) var(--sp-1);
  border-radius: var(--r-3);
  background: rgba(22, 27, 34, 0.72);
  border: 1px solid var(--c-line);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.35);
  transition: transform var(--dur-fast) ease, border-color var(--dur-fast) ease;
  overflow: hidden;
}

.entry::before {
  content: "";
  position: absolute;
  inset: 0;
  opacity: 0.10;
  pointer-events: none;
}

.entry-4::before { background: radial-gradient(circle at 50% 0%, var(--t-4), transparent 70%); }
.entry-6::before { background: radial-gradient(circle at 50% 0%, var(--t-6), transparent 70%); }
.entry-9::before { background: radial-gradient(circle at 50% 0%, var(--t-9), transparent 70%); }

.entry:active { transform: scale(0.96); }

.entry-sm { min-height: 64px; }
.entry-wide { min-height: 72px; }

.entry-ico {
  width: 28px;
  height: 28px;
  display: block;
}

.entry-4 .entry-ico { color: var(--t-4); }
.entry-6 .entry-ico { color: var(--t-6); }
.entry-9 .entry-ico { color: var(--t-9); }

.entry-name {
  font-size: var(--fs-aux);
  font-weight: 600;
  text-align: center;
  line-height: 1.2;
}

.entry-sub {
  font-size: var(--fs-small);
  color: var(--c-text-dim);
  font-variant-numeric: tabular-nums;
}

.entry-row-3 .entry-sm .entry-name { font-size: var(--fs-small); }

.btn-mixed {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  width: 100%;
  min-height: 72px;
  padding: 0 var(--sp-4);
  border-radius: var(--r-3);
  background: linear-gradient(135deg, rgba(126, 231, 135, 0.14), rgba(88, 166, 255, 0.14) 50%, rgba(210, 153, 34, 0.14));
  border: 1px solid var(--c-line-2);
  box-shadow: 0 6px 22px rgba(0, 0, 0, 0.45);
  text-align: left;
  transition: transform var(--dur-fast) ease;
}

.btn-mixed:active { transform: scale(0.98); }

.mixed-rings {
  position: relative;
  width: 40px;
  height: 40px;
  flex: none;
}

.ring {
  position: absolute;
  width: 22px;
  height: 22px;
  border-radius: var(--r-full);
  border: 2px solid;
  mix-blend-mode: screen;
}

.ring-4 { top: 0; left: 0; border-color: var(--t-4); }
.ring-6 { top: 0; right: 0; border-color: var(--t-6); }
.ring-9 { bottom: 0; left: 9px; border-color: var(--t-9); }

.mixed-text { display: flex; flex-direction: column; gap: 2px; flex: 1; min-width: 0; }
.mixed-name { font-size: var(--fs-body); font-weight: 700; }
.mixed-sub { font-size: var(--fs-small); color: var(--c-text-dim); }

/* ============================================================
   7. 底部导航
   ============================================================ */
.bottom-nav {
  flex: none;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  height: auto;
  min-height: 64px;
  padding-bottom: 0;
  background: rgba(13, 17, 23, 0.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-top: 1px solid var(--c-line);
}

.nav-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  min-height: 44px;
  padding: 6px 0;
  font-size: var(--fs-small);
  color: var(--c-text-dim);
  transition: color var(--dur-fast) ease, transform var(--dur-fast) ease;
}

.nav-btn .ico { width: 22px; height: 22px; }
.nav-btn:active { color: var(--c-primary-lt); transform: scale(0.94); }

/* ============================================================
   8. 子页面
   ============================================================ */
.sub-top {
  flex: none;
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  height: 56px;
  padding: 0 var(--sp-2);
  border-bottom: 1px solid var(--c-line);
  background: rgba(13, 17, 23, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.sub-title {
  flex: 1;
  font-size: var(--fs-section);
  font-weight: 700;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sub-right {
  display: flex;
  align-items: center;
  gap: var(--sp-1);
  min-width: 44px;
  justify-content: flex-end;
  font-size: var(--fs-aux);
  color: var(--c-points);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.sub-body {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: var(--sp-3);
  display: flex;
  flex-direction: column;
  gap: var(--sp-3);
}

.chapter-card {
  padding: var(--sp-3);
  border-radius: var(--r-3);
  background: rgba(22, 27, 34, 0.72);
  border: 1px solid var(--c-line);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.35);
}

.chapter-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-2);
  margin-bottom: var(--sp-2);
}

.chapter-name { font-size: var(--fs-body); font-weight: 700; }

.chapter-count {
  font-size: var(--fs-small);
  color: var(--c-text-dim);
  font-variant-numeric: tabular-nums;
}

.chapter-story {
  font-size: var(--fs-aux);
  color: var(--c-text-dim);
  line-height: 1.6;
  margin: 0 0 var(--sp-3);
}

.level-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: var(--sp-2);
}

.level-btn {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  aspect-ratio: 1;
  min-height: 44px;
  border-radius: var(--r-2);
  background: var(--c-secondary);
  border: 1px solid var(--c-line-2);
  font-size: var(--fs-aux);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  transition: transform var(--dur-fast) ease, border-color var(--dur-fast) ease;
}

.level-btn:active { transform: scale(0.93); }
.level-btn.is-done { background: rgba(63, 185, 80, 0.18); border-color: var(--c-success); color: var(--c-success); }
.level-btn.is-locked { opacity: 0.4; }
.level-btn.is-boss { border-color: var(--c-points); box-shadow: 0 0 12px rgba(210, 153, 34, 0.35); }
.level-btn.is-current { border-color: var(--t-accent); box-shadow: 0 0 12px rgba(88, 166, 255, 0.4); }

.level-btn .lock-ico {
  width: 14px;
  height: 14px;
  position: absolute;
  bottom: 4px;
  right: 4px;
  color: var(--c-text-dim);
}

.mode-card {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  width: 100%;
  min-height: 72px;
  padding: var(--sp-3);
  border-radius: var(--r-3);
  background: rgba(22, 27, 34, 0.72);
  border: 1px solid var(--c-line);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.35);
  text-align: left;
  transition: transform var(--dur-fast) ease, border-color var(--dur-fast) ease;
}

.mode-card:active { transform: scale(0.98); }
.mode-card.is-locked { opacity: 0.5; }

.mode-ico {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  flex: none;
  border-radius: var(--r-2);
  background: var(--c-secondary);
}

.mode-ico .ico { width: 26px; height: 26px; color: var(--t-accent); }

.mode-meta { flex: 1; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.mode-name { font-size: var(--fs-body); font-weight: 700; }
.mode-desc { font-size: var(--fs-small); color: var(--c-text-dim); line-height: 1.4; }
.mode-side { font-size: var(--fs-small); color: var(--c-points); font-weight: 700; flex: none; }

.section-label {
  font-size: var(--fs-small);
  letter-spacing: 1px;
  color: var(--c-text-dim);
  margin: var(--sp-2) 0 calc(var(--sp-1) * -1);
  text-transform: uppercase;
}

.empty-tip {
  padding: var(--sp-5) var(--sp-3);
  text-align: center;
  color: var(--c-text-dim);
  font-size: var(--fs-aux);
  line-height: 1.7;
}

/* ============================================================
   9. 游戏界面
   ============================================================ */
#screen-game {
  justify-content: flex-start;
}

.game-status {
  flex: none;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  height: 40px;
  padding: 0 var(--sp-2);
  align-items: center;
  gap: var(--sp-1);
}

.stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0;
  line-height: 1.15;
}

.stat-label { font-size: 10px; color: var(--c-text-dim); letter-spacing: 0.5px; }
.stat-value {
  font-size: var(--fs-aux);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.stat-value.is-warn { color: var(--c-error); }
.stat-value.is-good { color: var(--c-success); }

.mixed-info {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-2);
  height: 36px;
  padding: 0 var(--sp-3);
  font-size: var(--fs-small);
}

.mixed-round { color: var(--c-text); font-weight: 700; }

.mixed-pips { display: flex; gap: 6px; }

.pip {
  width: 26px;
  height: 6px;
  border-radius: var(--r-full);
  background: var(--c-secondary);
  transition: background var(--dur) ease, box-shadow var(--dur) ease;
}

.pip-4.is-on { background: var(--t-4); box-shadow: 0 0 8px var(--t-4); }
.pip-6.is-on { background: var(--t-6); box-shadow: 0 0 8px var(--t-6); }
.pip-9.is-on { background: var(--t-9); box-shadow: 0 0 8px var(--t-9); }

.mixed-size-tag {
  padding: 2px var(--sp-2);
  border-radius: var(--r-full);
  background: var(--c-secondary);
  border: 1px solid var(--c-line-2);
  font-size: 11px;
  color: var(--t-accent);
  font-weight: 700;
}

.board-wrap {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--sp-2) var(--sp-2);
  min-height: 0;
}

.board {
  --n: 9;
  display: grid;
  grid-template-columns: repeat(var(--n), 1fr);
  width: min(92vw, 360px, calc(100dvh - 320px));
  height: min(92vw, 360px, calc(100dvh - 320px));
  background: var(--c-board);
  border: 2px solid var(--c-box);
  border-radius: var(--r-3);
  box-shadow: 0 0 32px rgba(0, 0, 0, 0.5), inset 0 0 24px rgba(0, 0, 0, 0.38);
  overflow: hidden;
  touch-action: manipulation;
}

.board.is-done {
  animation: boardRipple 500ms ease both;
}

@keyframes boardRipple {
  0%   { box-shadow: 0 0 32px rgba(0, 0, 0, 0.5), inset 0 0 24px rgba(0, 0, 0, 0.38); }
  40%  { box-shadow: 0 0 48px var(--t-accent), inset 0 0 40px rgba(255, 255, 255, 0.10); }
  100% { box-shadow: 0 0 32px rgba(0, 0, 0, 0.5), inset 0 0 24px rgba(0, 0, 0, 0.38); }
}

.cell {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  border-right: 1px solid var(--c-grid);
  border-bottom: 1px solid var(--c-grid);
  font-size: var(--fs-cell);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: var(--c-player);
  transition: background var(--dur-fast) ease, color var(--dur-fast) ease;
  overflow: hidden;
  min-width: 0;
  min-height: 0;
}

.board[data-n="4"] .cell { font-size: 32px; }
.board[data-n="6"] .cell { font-size: 28px; }
.board[data-n="9"] .cell { font-size: var(--fs-cell); }

.cell.bt { border-top: 2px solid var(--c-box); }
.cell.bl { border-left: 2px solid var(--c-box); }
.cell.br { border-right: 2px solid var(--c-box); }
.cell.bb { border-bottom: 2px solid var(--c-box); }

.board[data-n="4"] .cell:nth-child(4n) { border-right: none; }
.board[data-n="4"] .cell:nth-last-child(-n+4) { border-bottom: none; }
.board[data-n="6"] .cell:nth-child(6n) { border-right: none; }
.board[data-n="6"] .cell:nth-last-child(-n+6) { border-bottom: none; }
.board[data-n="9"] .cell:nth-child(9n) { border-right: none; }
.board[data-n="9"] .cell:nth-last-child(-n+9) { border-bottom: none; }

.cell.is-given { color: var(--c-given); font-weight: 700; }
.cell.is-player { color: var(--c-player); }
.cell.is-peer { background: var(--c-peers); }
.cell.is-same { background: var(--c-same); }
.cell.is-selected {
  background: var(--c-hl);
  box-shadow: inset 0 0 0 2px var(--c-select);
  z-index: 2;
}
.cell.is-error { color: var(--c-error); animation: shake 200ms ease both; }
.cell.is-hint { color: var(--c-success); animation: pop 150ms ease both; }
.cell.is-flash { animation: pop 150ms ease both; }

.cell.is-error::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: repeating-linear-gradient(
    45deg,
    rgba(248, 81, 73, 0.28) 0 3px,
    transparent 3px 7px
  );
}

body.cb-pattern .cell.is-error::before {
  content: "!";
  position: absolute;
  top: 2px;
  right: 3px;
  font-size: 10px;
  font-weight: 900;
  color: var(--c-error);
  line-height: 1;
}

.cell-val {
  position: relative;
  z-index: 1;
  animation: pop 150ms ease both;
}

@keyframes pop {
  0%   { transform: scale(0.55); opacity: 0.3; }
  70%  { transform: scale(1.12); }
  100% { transform: scale(1); opacity: 1; }
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-3px); }
  40% { transform: translateX(3px); }
  60% { transform: translateX(-2px); }
  80% { transform: translateX(2px); }
}

@keyframes glowLine {
  0%   { box-shadow: inset 0 0 0 0 rgba(63, 185, 80, 0); }
  50%  { box-shadow: inset 0 0 18px rgba(63, 185, 80, 0.6); }
  100% { box-shadow: inset 0 0 0 0 rgba(63, 185, 80, 0); }
}

.cell.is-line-done { animation: glowLine 300ms ease both; }

.cell-notes {
  position: absolute;
  inset: 2px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-template-rows: repeat(3, 1fr);
  z-index: 1;
}

.board[data-n="4"] .cell-notes { grid-template-columns: repeat(2, 1fr); grid-template-rows: repeat(2, 1fr); }
.board[data-n="6"] .cell-notes { grid-template-columns: repeat(3, 1fr); grid-template-rows: repeat(2, 1fr); }
.board[data-n="9"] .cell-notes { grid-template-columns: repeat(3, 1fr); grid-template-rows: repeat(3, 1fr); }

.cell-note {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--fs-note);
  font-weight: 600;
  color: var(--c-note);
  line-height: 1;
}

.board[data-n="4"] .cell-note { font-size: 12px; }
.board[data-n="6"] .cell-note { font-size: 9px; }

.cell-note.is-on { color: var(--c-note); opacity: 1; }
.cell-note.is-off { opacity: 0; }

.numpad {
  flex: none;
  display: grid;
  grid-template-columns: repeat(var(--np-cols, 9), 1fr);
  gap: var(--sp-2);
  padding: 0 var(--sp-3) var(--sp-2);
}

.num-btn {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  border-radius: var(--r-2);
  background: var(--c-secondary);
  border: 1px solid var(--c-line-2);
  font-size: var(--fs-body);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--c-text);
  transition: transform var(--dur-fast) ease, background var(--dur-fast) ease;
}

.num-btn:active { transform: scale(0.92); background: var(--c-primary); color: #fff; }
.num-btn.is-disabled { opacity: 0.3; pointer-events: none; }
.num-btn .num-count {
  position: absolute;
  bottom: 2px;
  right: 4px;
  font-size: 9px;
  color: var(--c-text-dim);
  font-weight: 600;
}

.toolbar {
  flex: none;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--sp-2);
  height: auto;
  min-height: 56px;
  padding: var(--sp-1) var(--sp-3) var(--sp-2);
  margin-bottom: var(--sp-1);
}

.tool-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  min-height: 44px;
  border-radius: var(--r-2);
  background: var(--c-secondary);
  border: 1px solid var(--c-line-2);
  font-size: 10px;
  color: var(--c-text-dim);
  transition: transform var(--dur-fast) ease, color var(--dur-fast) ease, background var(--dur-fast) ease;
}

.tool-btn .ico { width: 20px; height: 20px; }
.tool-btn:active { transform: scale(0.93); }
.tool-btn.is-active {
  background: rgba(31, 111, 235, 0.22);
  border-color: var(--c-primary);
  color: var(--c-primary-lt);
}

/* ============================================================
   10. 复盘
   ============================================================ */
.replay-board {
  width: min(88vw, 320px);
  height: min(88vw, 320px);
  margin: 0 auto;
}

.replay-timeline {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  padding: var(--sp-2) 0;
}

.replay-slider {
  flex: 1;
  -webkit-appearance: none;
  appearance: none;
  height: 4px;
  border-radius: var(--r-full);
  background: var(--c-secondary);
  outline: none;
}

.replay-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 18px;
  height: 18px;
  border-radius: var(--r-full);
  background: var(--c-primary);
  box-shadow: 0 0 8px #1F6FEB99;
}

.replay-slider::-moz-range-thumb {
  width: 18px;
  height: 18px;
  border: none;
  border-radius: var(--r-full);
  background: var(--c-primary);
}

.replay-controls {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--sp-2);
}

.replay-controls .btn {
  padding: 0 var(--sp-2);
  font-size: var(--fs-small);
}

.replay-speed {
  display: flex;
  gap: var(--sp-1);
  justify-content: center;
  padding: var(--sp-1) 0;
}

.speed-btn {
  min-width: 44px;
  min-height: 32px;
  border-radius: var(--r-2);
  background: var(--c-secondary);
  border: 1px solid var(--c-line-2);
  font-size: var(--fs-small);
  color: var(--c-text-dim);
}

.speed-btn.is-active { background: var(--c-primary); color: #fff; border-color: var(--c-primary); }

.step-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
  max-height: 220px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  border-radius: var(--r-2);
  background: rgba(22, 27, 34, 0.6);
  border: 1px solid var(--c-line);
  padding: var(--sp-1);
}

.step-item {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  padding: 6px var(--sp-2);
  border-radius: var(--r-1);
  font-size: var(--fs-small);
  color: var(--c-text-dim);
  font-variant-numeric: tabular-nums;
  text-align: left;
  width: 100%;
}

.step-item.is-active { background: var(--c-secondary); color: var(--c-text); }

.step-dot {
  width: 8px;
  height: 8px;
  border-radius: var(--r-full);
  flex: none;
  background: var(--c-note);
}

.step-dot.t-place { background: var(--c-player); }
.step-dot.t-error { background: var(--c-error); }
.step-dot.t-hint { background: var(--c-points); }
.step-dot.t-undo { background: var(--c-text-dim); }
.step-dot.t-line { background: var(--c-success); }

.replay-item {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  width: 100%;
  min-height: 64px;
  padding: var(--sp-2) var(--sp-3);
  border-radius: var(--r-2);
  background: rgba(22, 27, 34, 0.72);
  border: 1px solid var(--c-line);
  text-align: left;
}

.replay-item:active { background: var(--c-secondary); }

.replay-meta { flex: 1; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.replay-name { font-size: var(--fs-aux); font-weight: 600; }
.replay-sub { font-size: var(--fs-small); color: var(--c-text-dim); }
.replay-res { font-size: var(--fs-small); font-weight: 700; flex: none; }
.replay-res.ok { color: var(--c-success); }
.replay-res.bad { color: var(--c-error); }

/* ============================================================
   11. 统计与图表
   ============================================================ */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--sp-2);
}

.stat-card {
  padding: var(--sp-3);
  border-radius: var(--r-3);
  background: rgba(22, 27, 34, 0.72);
  border: 1px solid var(--c-line);
  display: flex;
  flex-direction: column;
  gap: var(--sp-1);
}

.stat-card-label { font-size: var(--fs-small); color: var(--c-text-dim); }
.stat-card-value {
  font-size: var(--fs-section);
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  color: var(--t-accent);
}
.stat-card-sub { font-size: var(--fs-small); color: var(--c-text-dim); }

.chart-block {
  padding: var(--sp-3);
  border-radius: var(--r-3);
  background: rgba(22, 27, 34, 0.72);
  border: 1px solid var(--c-line);
}

.chart-title {
  font-size: var(--fs-aux);
  font-weight: 700;
  margin-bottom: var(--sp-3);
  color: var(--c-text);
}

.chart-ring-row {
  display: flex;
  align-items: center;
  gap: var(--sp-4);
  flex-wrap: wrap;
}

.ring-chart {
  width: 96px;
  height: 96px;
  border-radius: var(--r-full);
  flex: none;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  transition: background var(--dur-slow) ease;
}

.ring-chart::after {
  content: "";
  position: absolute;
  inset: 12px;
  border-radius: var(--r-full);
  background: var(--c-board);
}

.ring-chart-label {
  position: relative;
  z-index: 1;
  font-size: var(--fs-aux);
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.bar-row {
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
}

.bar-item { display: flex; align-items: center; gap: var(--sp-2); }

.bar-name {
  width: 64px;
  flex: none;
  font-size: var(--fs-small);
  color: var(--c-text-dim);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.bar-track {
  flex: 1;
  height: 12px;
  border-radius: var(--r-full);
  background: var(--c-secondary);
  overflow: hidden;
}

.bar-fill {
  height: 100%;
  border-radius: var(--r-full);
  background: linear-gradient(90deg, var(--c-primary), var(--t-accent));
  width: 0;
  transition: width var(--dur-slow) ease;
}

.bar-value {
  width: 48px;
  flex: none;
  text-align: right;
  font-size: var(--fs-small);
  font-variant-numeric: tabular-nums;
  color: var(--c-text);
}

.heat-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
}

.heat-cell {
  aspect-ratio: 1;
  border-radius: 3px;
  background: var(--c-secondary);
}

.heat-cell.l1 { background: rgba(88, 166, 255, 0.25); }
.heat-cell.l2 { background: rgba(88, 166, 255, 0.45); }
.heat-cell.l3 { background: rgba(88, 166, 255, 0.7); }
.heat-cell.l4 { background: var(--c-primary-lt); }

.radar-wrap { display: flex; justify-content: center; }
.radar-wrap svg { width: 220px; height: 220px; }

.trend-wrap { width: 100%; overflow: hidden; }
.trend-wrap svg { width: 100%; height: 120px; display: block; }

/* ============================================================
   12. 成就 / 商店 / 排行榜 / 签到
   ============================================================ */
.ach-filter {
  display: flex;
  gap: var(--sp-1);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  padding-bottom: var(--sp-1);
}

.ach-filter::-webkit-scrollbar { display: none; }

.chip {
  flex: none;
  min-height: 32px;
  padding: 0 var(--sp-3);
  border-radius: var(--r-full);
  background: var(--c-secondary);
  border: 1px solid var(--c-line-2);
  font-size: var(--fs-small);
  color: var(--c-text-dim);
  white-space: nowrap;
}

.chip.is-active { background: var(--c-primary); color: #fff; border-color: var(--c-primary); }

.ach-item {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-2) var(--sp-3);
  border-radius: var(--r-2);
  background: rgba(22, 27, 34, 0.72);
  border: 1px solid var(--c-line);
}

.ach-item.is-locked { opacity: 0.55; }
.ach-item.is-done { border-color: rgba(63, 185, 80, 0.45); }

.ach-ico {
  width: 40px;
  height: 40px;
  flex: none;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--r-2);
  background: var(--c-secondary);
  color: var(--c-points);
}

.ach-meta { flex: 1; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.ach-name { font-size: var(--fs-aux); font-weight: 700; }
.ach-desc { font-size: var(--fs-small); color: var(--c-text-dim); line-height: 1.4; }
.ach-side { font-size: var(--fs-small); color: var(--c-points); font-weight: 700; flex: none; }

.progress-track {
  height: 6px;
  border-radius: var(--r-full);
  background: var(--c-secondary);
  overflow: hidden;
  margin-top: var(--sp-1);
}

.progress-fill {
  height: 100%;
  border-radius: var(--r-full);
  background: linear-gradient(90deg, var(--c-primary), var(--t-accent));
  width: 0;
  transition: width var(--dur-slow) ease;
}

.shop-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--sp-2);
}

.shop-item {
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
  padding: var(--sp-3);
  border-radius: var(--r-3);
  background: rgba(22, 27, 34, 0.72);
  border: 1px solid var(--c-line);
}

.shop-name { font-size: var(--fs-aux); font-weight: 700; }
.shop-desc { font-size: var(--fs-small); color: var(--c-text-dim); line-height: 1.4; flex: 1; }
.shop-price {
  font-size: var(--fs-small);
  font-weight: 700;
  color: var(--c-points);
  font-variant-numeric: tabular-nums;
}

.shop-preview {
  width: 48px;
  height: 48px;
  border-radius: var(--r-2);
  background: var(--c-secondary);
  border: 1px solid var(--c-line-2);
}

.lb-row {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-2) var(--sp-3);
  border-radius: var(--r-2);
  background: rgba(22, 27, 34, 0.72);
  border: 1px solid var(--c-line);
}

.lb-row.is-me { border-color: var(--c-primary); background: rgba(31, 111, 235, 0.14); }

.lb-rank {
  width: 30px;
  flex: none;
  text-align: center;
  font-size: var(--fs-aux);
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  color: var(--c-text-dim);
}

.lb-rank.top1 { color: #FFD700; }
.lb-rank.top2 { color: #C0C0C0; }
.lb-rank.top3 { color: #CD7F32; }

.lb-avatar {
  width: 32px;
  height: 32px;
  flex: none;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--r-full);
  background: var(--c-secondary);
  font-size: 18px;
  line-height: 1;
}

.lb-meta { flex: 1; display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.lb-name {
  font-size: var(--fs-aux);
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.lb-sub { font-size: var(--fs-small); color: var(--c-text-dim); font-variant-numeric: tabular-nums; }
.lb-score {
  font-size: var(--fs-aux);
  font-weight: 800;
  color: var(--c-points);
  font-variant-numeric: tabular-nums;
  flex: none;
}

.checkin-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--sp-2);
}

.checkin-day {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  padding: var(--sp-2) var(--sp-1);
  border-radius: var(--r-2);
  background: var(--c-secondary);
  border: 1px solid var(--c-line-2);
  min-height: 64px;
}

.checkin-day.is-done {
  background: rgba(63, 185, 80, 0.16);
  border-color: var(--c-success);
}

.checkin-day.is-today {
  border-color: var(--c-points);
  box-shadow: 0 0 12px rgba(210, 153, 34, 0.35);
}

.checkin-day-name { font-size: 10px; color: var(--c-text-dim); }
.checkin-day-val { font-size: var(--fs-aux); font-weight: 700; color: var(--c-points); font-variant-numeric: tabular-nums; }
.checkin-day-item { font-size: 10px; color: var(--c-text-dim); }

/* 设置 */
.set-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-3);
  min-height: 56px;
  padding: var(--sp-2) var(--sp-3);
  border-radius: var(--r-2);
  background: rgba(22, 27, 34, 0.72);
  border: 1px solid var(--c-line);
}

.set-meta { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.set-name { font-size: var(--fs-aux); font-weight: 600; }
.set-desc { font-size: var(--fs-small); color: var(--c-text-dim); }

.switch {
  position: relative;
  width: 48px;
  height: 28px;
  flex: none;
  border-radius: var(--r-full);
  background: var(--c-secondary);
  border: 1px solid var(--c-line-2);
  transition: background var(--dur) ease, border-color var(--dur) ease;
}

.switch::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 22px;
  height: 22px;
  border-radius: var(--r-full);
  background: var(--c-text-dim);
  transition: transform var(--dur) ease, background var(--dur) ease;
}

.switch.is-on { background: rgba(31, 111, 235, 0.35); border-color: var(--c-primary); }
.switch.is-on::after { transform: translateX(20px); background: var(--c-primary-lt); }

.seg {
  display: flex;
  gap: 2px;
  padding: 2px;
  border-radius: var(--r-2);
  background: var(--c-secondary);
  border: 1px solid var(--c-line-2);
  flex: none;
}

.seg-btn {
  min-width: 44px;
  min-height: 30px;
  padding: 0 var(--sp-2);
  border-radius: var(--r-1);
  font-size: var(--fs-small);
  color: var(--c-text-dim);
}

.seg-btn.is-active { background: var(--c-primary); color: #fff; }

/* ============================================================
   13. 模态 / 提示 / 横幅
   ============================================================ */
.modal-layer {
  position: fixed;
  inset: 0;
  z-index: var(--z-modal);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--sp-4);
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  animation: fadeIn var(--dur) ease both;
}

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.modal {
  width: 100%;
  max-width: 380px;
  max-height: 82dvh;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: var(--sp-4);
  border-radius: var(--r-3);
  background: #161B22;
  border: 1px solid var(--c-line-2);
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.6);
  animation: modalIn var(--dur) ease both;
}

@keyframes modalIn {
  from { opacity: 0; transform: translateY(12px) scale(0.96); }
  to   { opacity: 1; transform: none; }
}

.modal-title {
  margin: 0 0 var(--sp-3);
  font-size: var(--fs-section);
  font-weight: 700;
  text-align: center;
}

.modal-body {
  font-size: var(--fs-aux);
  color: var(--c-text-dim);
  line-height: 1.7;
  margin-bottom: var(--sp-4);
  white-space: pre-wrap;
}

.modal-body strong { color: var(--c-points); }

.modal-actions { display: flex; flex-direction: column; gap: var(--sp-2); }

.result-big {
  text-align: center;
  font-size: 40px;
  font-weight: 800;
  color: var(--c-points);
  font-variant-numeric: tabular-nums;
  margin: var(--sp-2) 0;
  animation: pop var(--dur-slow) ease both;
}

.result-rows { display: flex; flex-direction: column; gap: var(--sp-1); margin-bottom: var(--sp-3); }

.result-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: var(--fs-aux);
  padding: 6px 0;
  border-bottom: 1px dashed var(--c-line);
}

.result-row:last-child { border-bottom: none; }
.result-row span:first-child { color: var(--c-text-dim); }
.result-row span:last-child { font-weight: 700; font-variant-numeric: tabular-nums; }

.toast-layer {
  position: fixed;
  left: 0;
  right: 0;
  bottom: calc(80px + var(--safe-bottom));
  z-index: var(--z-toast);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--sp-2);
  pointer-events: none;
  padding: 0 var(--sp-4);
}

.toast {
  max-width: 100%;
  padding: var(--sp-2) var(--sp-4);
  border-radius: var(--r-full);
  background: rgba(33, 38, 45, 0.96);
  border: 1px solid var(--c-line-2);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
  font-size: var(--fs-aux);
  color: var(--c-text);
  animation: toastIn var(--dur) ease both;
  text-align: center;
}

.toast.is-points { color: var(--c-points); border-color: rgba(210, 153, 34, 0.5); }
.toast.is-success { color: var(--c-success); border-color: rgba(63, 185, 80, 0.5); }
.toast.is-error { color: var(--c-error); border-color: rgba(248, 81, 73, 0.5); }

@keyframes toastIn {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: none; }
}

.toast.is-out { animation: toastOut var(--dur) ease both; }

@keyframes toastOut {
  from { opacity: 1; }
  to   { opacity: 0; transform: translateY(-6px); }
}

.offline-banner,
.update-banner {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  z-index: var(--z-banner);
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-2) var(--sp-4);
  border-radius: var(--r-full);
  font-size: var(--fs-small);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
  animation: toastIn var(--dur) ease both;
}

.offline-banner {
  bottom: calc(76px + var(--safe-bottom));
  background: rgba(210, 153, 34, 0.18);
  border: 1px solid rgba(210, 153, 34, 0.5);
  color: var(--c-points);
}

.update-banner {
  top: calc(12px + var(--safe-top));
  background: rgba(31, 111, 235, 0.2);
  border: 1px solid rgba(88, 166, 255, 0.5);
  color: var(--c-primary-lt);
}

/* 连击放大动画 */
.combo-pop { animation: comboPop var(--dur) ease both; }

@keyframes comboPop {
  0%   { transform: scale(1); }
  50%  { transform: scale(1.35); color: var(--c-points); }
  100% { transform: scale(1); }
}

/* 成就金光 */
.ach-gold { animation: achGold 800ms ease both; }

@keyframes achGold {
  0%   { box-shadow: 0 0 0 0 rgba(210, 153, 34, 0.8); }
  60%  { box-shadow: 0 0 28px 8px rgba(210, 153, 34, 0.55); }
  100% { box-shadow: 0 0 0 0 rgba(210, 153, 34, 0); }
}

/* ============================================================
   14. 小屏 / 横屏适配
   ============================================================ */
@media (max-width: 340px) {
  :root { --fs-cell: 20px; --fs-note: 9px; }
  .avatar-grid { grid-template-columns: repeat(8, 1fr); }
  .entry-row-3 .entry-name { font-size: 11px; }
}

@media (max-height: 640px) {
  .board {
    width: min(88vw, 320px, calc(100dvh - 300px));
    height: min(88vw, 320px, calc(100dvh - 300px));
  }
}

@media (orientation: landscape) and (max-height: 480px) {
  .board {
    width: min(60vw, 300px, calc(100dvh - 220px));
    height: min(60vw, 300px, calc(100dvh - 220px));
  }
  .home-scroll { padding-bottom: var(--sp-2); }
}

/* ============================================================
   15. 可访问性
   ============================================================ */
body.reduce-motion *,
body.reduce-motion *::before,
body.reduce-motion *::after {
  animation-duration: 0.001ms !important;
  animation-iteration-count: 1 !important;
  transition-duration: 0.001ms !important;
}

/* 色盲模式：用蓝色替代绿色成功指示，用斜纹 + 图标替代纯红 */
body.cb-mode .cell.is-error { color: #FF9F0A; }
body.cb-mode .cell.is-error::after {
  background: repeating-linear-gradient(
    -45deg,
    rgba(255, 159, 10, 0.35) 0 3px,
    transparent 3px 7px
  );
}
body.cb-mode .cell.is-hint { color: #0A84FF; }
body.cb-mode .level-btn.is-done { background: rgba(10, 132, 255, 0.18); border-color: #0A84FF; color: #0A84FF; }
body.cb-mode .replay-res.ok { color: #0A84FF; }
body.cb-mode .stat-value.is-good { color: #0A84FF; }

/* 键盘焦点 */
:focus-visible {
  outline: 2px solid var(--c-primary-lt);
  outline-offset: 2px;
}

/* 滚动条 */
.sub-body::-webkit-scrollbar,
.home-scroll::-webkit-scrollbar,
.step-list::-webkit-scrollbar,
.avatar-grid::-webkit-scrollbar {
  width: 6px;
}

.sub-body::-webkit-scrollbar-thumb,
.home-scroll::-webkit-scrollbar-thumb,
.step-list::-webkit-scrollbar-thumb,
.avatar-grid::-webkit-scrollbar-thumb {
  background: var(--c-line-2);
  border-radius: var(--r-full);
}