/* ════════════════════════════════════════
   CSS 变量 · 铅笔便签主题
   ════════════════════════════════════════ */
:root {
  --bg:            #fdfbf7;
  --bg-alt:        #f5f0e1;
  --bg-panel:      #f9f6f0;
  --text:          #3a3028;
  --text-sub:      #6a5e52;
  --text-dim:      #9a8878;
  --border-thin:   #d0c8ba;
  --border-box:    #7a6e60;
  --border-outer:  #4a4038;
  --cell-given:    #2c2420;
  --cell-player:   #1e5bb5;
  --cell-hint:     #1a7a40;
  --cell-note:     #9a8070;
  --cell-sel-bg:   #d0e8f8;
  --cell-rel-bg:   #f0ebe0;
  --cell-same-bg:  #c8dff5;
  --cell-err-bg:   #fde0e0;
  --cell-err-text: #c0392b;
  --cell-hint-bg:  #d0f0de;
  --btn-bg:        #f0ebe0;
  --btn-border:    #c0b4a0;
  --btn-text:      #4a3e30;
  --btn-primary:   #3a6ea8;
  --btn-primary-t: #fff;
  --btn-active:    #2d5a8a;
  --btn-danger:    #b03030;
  --ad-bg:         #ececec;
  --ad-border:     #ccc;
  --tabbar-h:      52px;
  --hdr-h:         48px;
  --numpad-h:      148px;
  --ad-h:          44px;
  --radius:        6px;
  --shadow:        0 2px 8px rgba(60,50,40,.12);
}

/* ════════════════════════════════════════
   重置 & 基础
   ════════════════════════════════════════ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { height: 100%; font-size: 16px; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC',
               'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
  min-height: 100%;
  overflow-x: hidden;
}
a { color: var(--btn-primary); text-decoration: none; }
a:hover { text-decoration: underline; }
button {
  cursor: pointer;
  border: none;
  background: none;
  font: inherit;
  color: inherit;
  -webkit-tap-highlight-color: transparent;
}

/* ════════════════════════════════════════
   #app 根容器
   ════════════════════════════════════════ */
#app {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}
/* 移动端：撑满首屏，底部导航固定 */
#app.is-mobile {
  min-height: 100dvh;
  padding-bottom: var(--tabbar-h);
}

/* ════════════════════════════════════════
   顶部导航栏
   ════════════════════════════════════════ */
.app-hdr {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 16px;
  height: var(--hdr-h);
  background: var(--bg-alt);
  border-bottom: 1px solid var(--border-thin);
  flex-shrink: 0;
}
.hdr-back {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: var(--radius);
  color: var(--text-sub);
  font-size: 18px;
  transition: background .15s;
  text-decoration: none;
  flex-shrink: 0;
}
.hdr-back:hover { background: var(--border-thin); text-decoration: none; }
.hdr-logo {
  display: flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  flex: 1;
  min-width: 0;
}
.hdr-logo-link {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.hdr-logo img { width: 28px; height: 28px; flex-shrink: 0; }
.hdr-logo h1 {
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.3;
}
.hdr-right {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}
.timer-box {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-sub);
  font-variant-numeric: tabular-nums;
  letter-spacing: .5px;
  background: var(--btn-bg);
  border: 1px solid var(--btn-border);
  border-radius: var(--radius);
  padding: 2px 8px;
}

/* 副标题 */
.subtitle-bar {
  background: var(--bg-alt);
  border-bottom: 1px solid var(--border-thin);
  padding: 4px 16px;
  flex-shrink: 0;
}
.subtitle-bar h2 {
  font-size: 14px;
  font-weight: 400;
  color: var(--text-dim);
  letter-spacing: .3px;
}

/* ════════════════════════════════════════
   主游戏区域 (PC: flex-row, Mobile: flex-col)
   ════════════════════════════════════════ */
main {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
}
.game-area {
  display: flex;
  flex-direction: row;
  gap: 0;
  flex: 1;
  min-height: 0;
  padding: 16px;
  max-width: 960px;
  width: 100%;
  margin: 0 auto;
  align-items: flex-start;
}

/* ════════════════════════════════════════
   棋盘区域
   ════════════════════════════════════════ */
.board-section {
  flex: 2;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

/* 难度选择（棋盘上方，PC可见） */
.diff-row {
  display: flex;
  gap: 6px;
  align-items: center;
  flex-wrap: wrap;
}
.diff-label {
  font-size: 14px;
  color: var(--text-dim);
  margin-right: 4px;
}
.diff-btn {
  padding: 4px 12px;
  border: 1px solid var(--btn-border);
  border-radius: 20px;
  font-size: 14px;
  background: var(--btn-bg);
  color: var(--btn-text);
  transition: all .15s;
}
.diff-btn:hover { background: var(--border-thin); }
.diff-btn.active {
  background: var(--btn-primary);
  color: var(--btn-primary-t);
  border-color: var(--btn-primary);
}

/* ────────────────────────────────────────
   数独棋盘
   ──────────────────────────────────────── */
.sudoku-board {
  display: grid;
  grid-template-columns: repeat(9, 1fr);
  grid-template-rows: repeat(9, 1fr);
  border: 2.5px solid var(--border-outer);
  border-radius: 4px;
  background: var(--bg);
  width: 100%;
  max-width: 480px;
  aspect-ratio: 1;
  box-shadow: var(--shadow);
  user-select: none;
}

/* 单元格 */
.cell {
  display: flex;
  align-items: center;
  justify-content: center;
  border-right: 1px solid var(--border-thin);
  border-bottom: 1px solid var(--border-thin);
  cursor: pointer;
  position: relative;
  transition: background .1s;
  background: var(--bg);
  overflow: hidden;
}
.cell:nth-child(9n)          { border-right: none; }
.cell:nth-last-child(-n+9)   { border-bottom: none; }
/* 宫格粗边框 */
.cell[data-col="2"] { border-right: 2px solid var(--border-box); }
.cell[data-col="5"] { border-right: 2px solid var(--border-box); }
.cell[data-row="2"] { border-bottom: 2px solid var(--border-box); }
.cell[data-row="5"] { border-bottom: 2px solid var(--border-box); }

/* 状态 */
.cell.related  { background: var(--cell-rel-bg); }
.cell.same-num { background: var(--cell-same-bg); }
.cell.selected { background: var(--cell-sel-bg); }
.cell.conflict { background: var(--cell-err-bg); }
.cell.hint-anim { background: var(--cell-hint-bg); }

/* 数值显示 */
.cv {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  font-size: clamp(14px, 3.2vmin, 28px);
  font-weight: 500;
  line-height: 1;
  color: var(--cell-player);
}
.cell.given .cv {
  font-weight: 800;
  color: var(--cell-given);
}
.cell.conflict .cv { color: var(--cell-err-text); }
.cell.hint-anim .cv { color: var(--cell-hint); }

/* 笔记（候选数）3×3小格 */
.cn {
  display: none;
  grid-template-columns: repeat(3, 1fr);
  grid-template-rows: repeat(3, 1fr);
  width: 100%;
  height: 100%;
  padding: 1px;
}
.cn.show { display: grid; }
.cn > span {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: clamp(5px, 1vmin, 8px);
  color: var(--cell-note);
  line-height: 1;
  opacity: 0;
}
.cn > span.on { opacity: 1; }

/* ════════════════════════════════════════
   AI 信息栏
   ════════════════════════════════════════ */
.info-bar {
  width: 100%;
  max-width: 480px;
  min-height: 36px;
  padding: 6px 10px;
  background: #eef6ee;
  border: 1px solid #b2d8b2;
  border-radius: var(--radius);
  font-size: 14px;
  line-height: 1.5;
  color: #2a6030;
  transition: all .3s;
}
.info-bar.warn {
  background: #fef9ec;
  border-color: #e8d080;
  color: #7a5800;
}
.info-bar.err {
  background: var(--cell-err-bg);
  border-color: #e0a0a0;
  color: var(--cell-err-text);
}

/* ════════════════════════════════════════
   右侧控制面板（PC）
   ════════════════════════════════════════ */
.ctrl-panel {
  flex: 0 0 220px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding-left: 20px;
}

/* 操作按钮组 */
.action-btns {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 12px;
  border: 1px solid var(--btn-border);
  border-radius: var(--radius);
  background: var(--btn-bg);
  color: var(--btn-text);
  font-size: 14px;
  transition: all .15s;
  white-space: nowrap;
}
.btn:hover { background: var(--border-thin); }
.btn.primary {
  background: var(--btn-primary);
  color: var(--btn-primary-t);
  border-color: var(--btn-primary);
}
.btn.primary:hover { background: var(--btn-active); }
.btn.active {
  background: var(--btn-active);
  color: var(--btn-primary-t);
  border-color: var(--btn-active);
}
.btn.note-active {
  background: #e8f0fc;
  border-color: #6090d0;
  color: #1a4a8a;
}
.btn:disabled { opacity: .45; cursor: default; pointer-events: none; }
.btn-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}

/* 数字键盘 */
.numpad {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 5px;
}
.num-btn {
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--btn-border);
  border-radius: var(--radius);
  background: var(--btn-bg);
  font-size: 18px;
  font-weight: 600;
  color: var(--btn-text);
  transition: all .12s;
}
.num-btn:hover { background: var(--cell-sel-bg); border-color: var(--btn-primary); }
.num-btn.erase-btn {
  font-size: 14px;
  font-weight: 400;
  color: var(--text-dim);
}
.num-btn.erase-btn:hover { background: var(--cell-err-bg); border-color: #e0a0a0; }

/* PC 侧边栏里的AI信息框 */
.ai-panel-box {
  padding: 10px;
  background: var(--bg-panel);
  border: 1px solid var(--border-thin);
  border-radius: var(--radius);
  font-size: 14px;
  line-height: 1.6;
  color: var(--text-sub);
}
.ai-panel-box h3 {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 4px;
}

/* ════════════════════════════════════════
   广告位
   ════════════════════════════════════════ */
.ad-bar {
  height: var(--ad-h);
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--ad-bg);
  /* border-top: 1px dashed var(--ad-border);
  border-bottom: 1px dashed var(--ad-border); */
  font-size: 14px;
  color: var(--text-dim);
  flex-shrink: 0;
}
.ad-bar a { color: var(--text-dim); }
.ad-bar a:hover { color: var(--text); }

/* ════════════════════════════════════════
   底部 TabBar（移动端）
   ════════════════════════════════════════ */
.tab-bar {
  display: none;
  height: var(--tabbar-h);
  background: var(--bg);
  border-top: 1px solid var(--border-thin);
  box-shadow: 0 -1px 4px rgba(60,50,40,.08);
  flex-shrink: 0;
}
.tab-btn {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1px;
  font-size: 11px;
  font-weight: 500;
  color: var(--text-dim);
  transition: color .15s, background .15s;
  padding: 2px 0;
  border-radius: 0;
}
.tab-btn:active { background: var(--bg-alt); }
.tab-btn.active { color: var(--btn-primary); }
.tab-icon { font-size: 20px; line-height: 1; }

/* ════════════════════════════════════════
   Tab 面板（移动端弹层）
   ════════════════════════════════════════ */
.tab-panel {
  display: none;
  position: fixed;
  inset: 0;
  bottom: var(--tabbar-h);
  background: var(--bg);
  overflow-y: auto;
  z-index: 50;
  padding: 20px 16px 56px;
  animation: slideUp .2s ease;
}
.tab-panel.visible { display: block; }
.tab-panel h3 {
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 12px;
  color: var(--text);
}
.tab-panel h2 {
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border-thin);
}
.tab-panel p, .tab-panel li {
  font-size: 14px;
  line-height: 1.8;
  color: var(--text-sub);
  margin-bottom: 8px;
}
.tab-panel ul { padding-left: 1.2em; }
.tab-panel dl { margin-top: 8px; }
.tab-panel dt {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
  margin-top: 10px;
  margin-bottom: 4px;
}
.tab-panel dd {
  font-size: 14px;
  line-height: 1.8;
  color: var(--text-sub);
  margin-bottom: 8px;
}

@keyframes slideUp {
  from { transform: translateY(20px); opacity: 0; }
  to   { transform: translateY(0);    opacity: 1; }
}

/* AI推理面板 */
.ai-tab-box {
  background: var(--bg-panel);
  border: 1px solid var(--border-thin);
  border-radius: var(--radius);
  padding: 12px;
  margin-bottom: 12px;
}
.ai-tab-box .ai-reason {
  font-size: 14px;
  line-height: 1.7;
  color: #1a5030;
  min-height: 60px;
}

/* 游戏记录列表 */
.record-list { display: flex; flex-direction: column; gap: 6px; }
.record-item {
  display: flex;
  gap: 8px;
  align-items: center;
  padding: 6px 10px;
  background: var(--bg-panel);
  border: 1px solid var(--border-thin);
  border-radius: var(--radius);
  font-size: 14px;
}
.record-diff {
  padding: 1px 6px;
  border-radius: 10px;
  font-size: 14px;
  background: var(--bg-alt);
  color: var(--text-sub);
}
.record-time { font-weight: 600; margin-left: auto; }

/* ════════════════════════════════════════
   文章区域
   ════════════════════════════════════════ */
.page-article {
  max-width: 960px;
  width: 100%;
  margin: 0 auto;
  padding: 24px 16px;
}
.page-article h2 {
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
  margin: 20px 0 10px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border-thin);
}
.page-article h2:first-child { margin-top: 0; }
.page-article h3 {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
  margin: 14px 0 6px;
}
.page-article p {
  font-size: 14px;
  line-height: 1.85;
  color: var(--text-sub);
  margin-bottom: 10px;
}
.page-article ul, .page-article ol {
  padding-left: 1.5em;
  margin-bottom: 10px;
}
.page-article li {
  font-size: 14px;
  line-height: 1.85;
  color: var(--text-sub);
  margin-bottom: 4px;
}
.page-article dt {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
  margin-top: 12px;
}
.page-article dd {
  font-size: 14px;
  line-height: 1.85;
  color: var(--text-sub);
  margin: 4px 0 0 1em;
}
.feature-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin: 12px 0;
}
.feature-card {
  background: var(--bg-panel);
  border: 1px solid var(--border-thin);
  border-radius: var(--radius);
  padding: 12px;
}
.feature-card .f-icon { font-size: 22px; display: block; margin-bottom: 4px; }
.feature-card .f-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 3px;
}
.feature-card .f-desc { font-size: 14px; color: var(--text-sub); line-height: 1.5; }

/* ════════════════════════════════════════
   页脚
   ════════════════════════════════════════ */
.app-footer {
  padding: 16px;
  border-top: 1px solid var(--border-thin);
  text-align: center;
  font-size: 14px;
  color: var(--text-dim);
  background: var(--bg-alt);
  flex-shrink: 0;
  margin-top: auto;
}
.app-footer a { color: var(--text-dim); }
.app-footer a:hover { color: var(--text); }
.app-footer p + p { margin-top: 4px; }

/* ════════════════════════════════════════
   完成庆祝动画
   ════════════════════════════════════════ */
.win-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.45);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: fadeIn .3s ease;
}
.win-box {
  background: var(--bg);
  border-radius: 12px;
  padding: 32px 40px;
  text-align: center;
  box-shadow: 0 8px 32px rgba(0,0,0,.3);
  max-width: 320px;
  width: 90%;
  animation: popIn .4s cubic-bezier(.34,1.56,.64,1);
}
.win-icon { font-size: 48px; display: block; margin-bottom: 12px; }
.win-title { font-size: 22px; font-weight: 800; color: var(--text); margin-bottom: 8px; }
.win-sub   { font-size: 14px; color: var(--text-sub); margin-bottom: 20px; line-height: 1.6; }
.win-btns  { display: flex; gap: 10px; justify-content: center; }

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes popIn  {
  from { transform: scale(.7); opacity: 0; }
  to   { transform: scale(1);  opacity: 1; }
}

/* 闪光动画（提示格） */
@keyframes hintPulse {
  0%,100% { background: var(--cell-hint-bg); }
  50%     { background: #a0e8b8; }
}
.cell.hint-anim { animation: hintPulse .6s ease 2; }

/* ════════════════════════════════════════
   加载旋转指示器
   ════════════════════════════════════════ */
.spinner {
  width: 18px;
  height: 18px;
  border: 2px solid var(--border-thin);
  border-top-color: var(--btn-primary);
  border-radius: 50%;
  animation: spin .7s linear infinite;
  flex-shrink: 0;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ════════════════════════════════════════
   PC 端专用样式（≥ 768px）
   ════════════════════════════════════════ */
@media (min-width: 768px) {
  .hdr-logo h1 { font-size: 17px; }
  .subtitle-bar h2 { font-size: 14px; text-align: center;}

  .game-area {
    padding: 20px 16px;
    align-items: flex-start;
  }

  .board-section {
    align-items: center;
    padding-right: 20px;
  }

  .sudoku-board {
    max-width: 460px;
  }

  .ctrl-panel {
    display: flex;
    position: sticky;
    top: 16px;
  }

  .numpad {
    grid-template-columns: repeat(5, 1fr);
  }

  /* PC 上隐藏移动端特有元素 */
  .tab-bar   { display: none !important; }
  .tab-panel { display: none !important; }

  /* PC 上信息栏放在棋盘下方 */
  .info-bar { max-width: 460px; }
}

/* ════════════════════════════════════════
   移动端布局（< 768px）
   ════════════════════════════════════════ */
@media (max-width: 767px) {
  :root { --hdr-h: 44px; }

  .hdr-logo h1  { font-size: 14px; }
  .subtitle-bar { display: none; }

  .game-area {
    flex-direction: column;
    padding: 10px 8px;
    gap: 8px;
    flex: 1;
    min-height: 0;
    align-items: center;
  }

  .board-section {
    width: 100%;
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    gap: 8px;
    padding: 0;
  }

  .sudoku-board {
    /* JS 会动态设置宽高 */
    max-width: 100%;
    flex-shrink: 0;
  }

  .diff-row  { width: 100%; justify-content: center; gap: 8px; }
  .diff-btn  { font-size: 13px; padding: 5px 14px; }
  .info-bar  { width: 100%; max-width: 100%; font-size: 13px; min-height: 32px; padding: 8px 12px; }

  /* 控制面板在移动端作为底部区域 */
  .ctrl-panel {
    width: 100%;
    flex: 0 0 auto;
    padding: 4px 0 0;
    gap: 8px;
    flex-direction: column;
  }

  .numpad {
    grid-template-columns: repeat(5, 1fr);
    gap: 6px;
  }
  .num-btn {
    font-size: 22px;
    height: 46px;
    aspect-ratio: unset;
    border-radius: var(--radius);
    font-weight: 700;
  }

  .action-btns {
    flex-direction: row;
    flex-wrap: wrap;
    gap: 6px;
  }
  .action-btns .btn {
    flex: 1 1 auto;
    min-width: 0;
    padding: 8px 6px;
    font-size: 13px;
    gap: 4px;
    font-weight: 500;
  }
  .btn-row {
    width: 100%;
    gap: 8px;
  }

  .tab-bar {
    display: flex;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 100;
  }

  /* 移动端隐藏 PC 侧边栏内的AI 面板（通过 tab panel 展示） */
  .ai-panel-box { display: none; }

  /* 文章和页脚在移动端通过 Tab 访问，首屏不显示 */
  .page-article { display: none; }
  .app-footer { display: none; }

  /* 广告位紧凑 */
  .ad-bar { height: 40px; font-size: 13px; color: var(--text-dim); background: var(--bg-alt); border-top: 1px dashed var(--border-thin); }
}

/* ════════════════════════════════════════
   极小屏优化（< 360px）
   ════════════════════════════════════════ */
@media (max-width: 359px) {
  :root { --hdr-h: 40px; --tabbar-h: 48px; }
  .num-btn { font-size: 17px; height: 36px; }
  .action-btns .btn { font-size: 14px; padding: 5px 4px; }
}

/* ════════════════════════════════════════
   示例棋盘（用于教程中的解题演示）
   ════════════════════════════════════════ */
.demo-board {
  display: inline-block;
  border: 2px solid var(--border-outer);
  border-radius: 4px;
  overflow: hidden;
  margin: 12px 0;
  background: var(--bg);
}
.demo-row {
  display: flex;
}
.demo-cell {
  width: 34px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-right: 1px solid var(--border-thin);
  border-bottom: 1px solid var(--border-thin);
  font-size: 14px;
  font-weight: 500;
  color: var(--cell-player);
  background: var(--bg);
}
.demo-cell:last-child { border-right: none; }
.demo-row:last-child .demo-cell { border-bottom: none; }
.demo-cell:nth-child(3) { border-right: 2px solid var(--border-box); }
.demo-cell:nth-child(6) { border-right: 2px solid var(--border-box); }
.demo-row-gap { border-bottom: 2px solid var(--border-box); }
.demo-given {
  font-weight: 800;
  color: var(--cell-given);
}
.demo-empty {
  color: transparent;
}
.demo-caption {
  font-size: 14px;
  color: var(--text-dim);
  margin: -4px 0 16px;
}

/* ════════════════════════════════════════
   教程步骤块
   ════════════════════════════════════════ */
.tutorial-steps {
  margin: 16px 0;
}
.tutorial-steps h3 {
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 12px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border-thin);
}
.step-item {
  display: flex;
  gap: 12px;
  margin-bottom: 16px;
  padding: 10px 12px;
  background: var(--bg-panel);
  border: 1px solid var(--border-thin);
  border-radius: var(--radius);
}
.step-num {
  flex-shrink: 0;
  width: 52px;
  font-size: 14px;
  font-weight: 700;
  color: var(--btn-primary);
  padding: 3px 0;
}
.step-body {
  flex: 1;
  min-width: 0;
}
.step-body p {
  font-size: 14px;
  line-height: 1.8;
  color: var(--text-sub);
  margin-bottom: 6px;
}
.step-body p:last-child { margin-bottom: 0; }
.step-body strong { color: var(--text); }

/* ════════════════════════════════════════
   返回顶部按钮
   ════════════════════════════════════════ */
.btn-back-top {
  position: fixed;
  right: 20px;
  bottom: 28px;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--bg-alt);
  color: var(--border-outer);
  font-size: 18px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1.5px solid var(--border-box);
  cursor: pointer;
  opacity: 0;
  visibility: hidden;
  transform: translateY(12px);
  transition: opacity .25s, visibility .25s, transform .25s, background .15s;
  z-index: 200;
  box-shadow: 0 2px 10px rgba(60,50,40,.15);
}
.btn-back-top:hover {
  background: var(--border-thin);
  border-color: var(--border-outer);
}
.btn-back-top.show {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

/* 移动端按钮位置微调 */
@media (max-width: 767px) {
  .btn-back-top {
    right: 12px;
    bottom: calc(var(--tabbar-h) + 16px);
    width: 36px;
    height: 36px;
    font-size: 16px;
  }
}

/* 移动端教程步骤适配 */
@media (max-width: 767px) {
  .demo-cell { width: 28px; height: 28px; font-size: 14px; }
  .step-item { flex-direction: column; gap: 4px; }
  .step-num { width: auto; }
}
