/* ============================================================
   main.css —— 布局与组件
   ============================================================ */

/* IPA 补字形字体：DejaVu Sans Mono 的子集（仅 ASCII + 音标用到的 17 个
   非 ASCII 字符，woff2 约 12KB）。
   背景：安卓默认等宽字体（Roboto Mono）不含 IPA Extensions 与
   U+02C8/02CC/02D0，音标里的 ˈ ː ɑ ə 等会显示成方框（tofu）。
   iOS/macOS 的系统字体自带这些字形，走前面的字体栈，不受影响。 */
@font-face {
  font-family: "IPAMono";
  src: url("../fonts/ipa-mono.woff2") format("woff2");
  font-weight: normal;
  font-style: normal;
  font-display: swap;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text-1);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Noto Sans SC",
               "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior-y: none;
}

body { min-height: 100vh; }

button { font-family: inherit; cursor: pointer; }

.serif { font-family: Georgia, "Times New Roman", "Songti SC", serif; }

/* ---------- 顶栏 ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  background: var(--bg-glass);
  -webkit-backdrop-filter: saturate(180%) blur(18px);
  backdrop-filter: saturate(180%) blur(18px);
  border-bottom: 1px solid var(--border);
  padding-top: env(safe-area-inset-top, 0px);
}

.topbar-inner {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  padding: 12px 16px 8px;
}

.brand { display: flex; flex-direction: column; gap: 1px; }

.brand-en {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei",
               "Noto Sans SC", "Source Han Sans SC", sans-serif;
  font-size: 17px;
  font-weight: 500;
  letter-spacing: 0.03em;
  color: var(--text-1);
  line-height: 1.2;
}

.brand-cn {
  font-size: 11px;
  letter-spacing: 0.08em;
  color: var(--text-3);
  line-height: 1.2;
}


/* ---------- 分类横滑条 ---------- */
.chips {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 6px 16px 12px;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
  scroll-behavior: smooth;
}
.chips::-webkit-scrollbar { display: none; }

.chip {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 7px 14px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-2);
  font-size: 13px;
  letter-spacing: 0.02em;
  transition: background .18s ease, color .18s ease, border-color .18s ease;
}
.chip:active { transform: scale(.97); }
.chip.active {
  background: var(--primary);
  border-color: var(--primary);
  color: var(--on-primary);
  font-weight: 500;
}
.chip .chip-emoji { font-size: 14px; line-height: 1; }

/* ---------- 主体 ---------- */
main { padding: 4px 14px calc(88px + env(safe-area-inset-bottom, 0px)); }

.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  padding: 8px 2px 12px;
}
.sh-title {
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.06em;
  color: var(--text-1);
}
.sh-count {
  font-size: 11px;
  letter-spacing: 0.12em;
  color: var(--text-3);
  font-variant-numeric: tabular-nums;
}

/* ---------- 卡片网格 ---------- */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(158px, 1fr));
  gap: 12px;
}

.card {
  position: relative;
  text-align: center;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 14px 12px 14px;
  box-shadow: var(--shadow);
  transition: transform .16s ease, box-shadow .2s ease, border-color .2s ease;
}
.card:active { transform: scale(.985); }
/* 切分类/切词包时数据已在内存，不再播放入场动画，否则会像“加载慢” */
.card.no-anim { animation: none; }
.card.playing {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-soft), var(--shadow-lift);
}

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

.emoji {
  width: 48px;
  height: 48px;
  margin: 0 auto;
  border-radius: 15px;
  background: var(--primary-soft);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 27px;
  line-height: 1;
}

/* 喇叭：视觉 19px，触摸区撑到 40px */
.speak {
  position: absolute;
  top: 7px;
  right: 7px;
  width: 40px;
  height: 40px;
  border: none;
  border-radius: 50%;
  background: transparent;
  color: var(--text-3);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  transition: background .18s ease, color .18s ease;
}
.speak:active { background: var(--surface-2); color: var(--primary); }
.speak svg { width: 19px; height: 19px; }
.speak.speaking { color: var(--accent); }
.speak.speaking svg { animation: pulse .9s ease-in-out infinite; }

@keyframes pulse {
  0%, 100% { transform: scale(1); opacity: .9; }
  50% { transform: scale(1.14); opacity: 1; }
}

.word {
  margin: 11px 0 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 21px;
  font-weight: 500;
  letter-spacing: 0.005em;
  color: var(--text-1);
  line-height: 1.22;
  word-break: break-word;
}
/* 长单词自动降字号，避免换行把卡片撑高 */
.word.md { font-size: 18px; letter-spacing: 0; }
.word.sm { font-size: 16px; letter-spacing: 0; }

.ipa {
  margin: 4px 0 0;
  /* IPAMono 放在通用 monospace 之前：安卓会用到它补 IPA 字形，
     iOS/macOS 的系统字体自带这些字形，仍走前面的 */
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, "IPAMono", monospace;
  font-size: 12.5px;
  color: var(--text-3);
  /* 加了音节中点后长音标更宽（/ˌbaɪ·oʊ·dɪ·ˈɡreɪ·də·bl/），
     窄屏上允许断行，避免顶出卡片 */
  overflow-wrap: anywhere;
  letter-spacing: 0.01em;
}

.zh {
  margin: 6px 0 0;
  font-size: 14px;
  color: var(--text-2);
  letter-spacing: 0.03em;
}

/* ---------- 底部 TabBar ---------- */
.tabbar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 40;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  background: var(--bg-glass);
  -webkit-backdrop-filter: saturate(180%) blur(18px);
  backdrop-filter: saturate(180%) blur(18px);
  border-top: 1px solid var(--border);
  padding-bottom: env(safe-area-inset-bottom, 0px);
}

.tab {
  border: none;
  background: transparent;
  color: var(--text-3);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  height: 58px;
  padding: 0;
  font-size: 11px;
  letter-spacing: 0.06em;
  transition: color .18s ease;
}
.tab:active { background: var(--surface-2); }
.tab svg { width: 22px; height: 22px; }
.tab.active { color: var(--primary); }
.tab .tab-num { font-variant-numeric: tabular-nums; }
.tab .i-pause { display: none; }
.tab.is-playing .i-play { display: none; }
.tab.is-playing .i-pause { display: block; }
/* 可一键安装时给第 4 个按钮一点提示色 */
.tab.can-install { color: var(--primary); }

/* 已从桌面图标启动（全屏模式）→ 隐藏安装按钮，回到三栏 */
.tabbar.no-install { grid-template-columns: repeat(4, 1fr); }
.tabbar.no-install #tabInstall { display: none; }

/* ---------- 装到桌面引导 ----------
   目标读者是「不知道什么是添加到主屏幕」的人：
   大图标 + 一句短话，一眼对上手机上的那个按钮。 */
.ins-hero {
  display: flex;
  align-items: center;
  gap: 11px;
  background: var(--primary-soft);
  border-radius: 14px;
  padding: 11px 13px;
  margin-bottom: 12px;
}
.ins-hero-ico {
  flex: 0 0 auto;
  width: 38px;
  height: 38px;
  border-radius: 11px;
  background: var(--surface);
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
}
.ins-hero-ico svg { width: 21px; height: 21px; }
.ins-hero p {
  margin: 0;
  font-size: 13.5px;
  font-weight: 500;
  line-height: 1.55;
  color: var(--text-1);
}

.ins-who {
  margin: 0 0 4px;
  font-size: 11.5px;
  color: var(--text-3);
}
.ins-who b { font-weight: 500; color: var(--text-2); }

.ins-steps {
  list-style: none;
  margin: 0;
  padding: 0;
  counter-reset: ins;
}
.ins-step {
  counter-increment: ins;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 0;
  border-top: 1px solid var(--border);
}
.ins-step:first-child { border-top: none; padding-top: 8px; }

/* 左边这一块就是「要去点的那个按钮」，画得比文字大，先被眼睛抓到 */
.ins-ico {
  position: relative;
  flex: 0 0 auto;
  width: 44px;
  height: 44px;
  border-radius: 13px;
  background: var(--primary-soft);
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
}
.ins-ico svg { width: 23px; height: 23px; }
.ins-ico::after {
  content: counter(ins);
  position: absolute;
  top: -5px;
  left: -5px;
  width: 17px;
  height: 17px;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  font-size: 10.5px;
  line-height: 17px;
  text-align: center;
  font-weight: 600;
}

.ins-txt { display: flex; flex-direction: column; gap: 2px; }
.ins-txt b {
  font-size: 13.5px;
  font-weight: 500;
  color: var(--text-1);
  line-height: 1.45;
}
.ins-txt i {
  font-style: normal;
  font-size: 11.5px;
  color: var(--text-3);
  line-height: 1.4;
}

.ins-cta {
  display: block;
  width: 100%;
  margin: 14px 0 0;
  padding: 14px;
  border: none;
  border-radius: 14px;
  background: var(--primary);
  color: #fff;
  font-size: 14.5px;
  font-weight: 600;
  letter-spacing: 0.02em;
}
.ins-cta:active { transform: scale(.985); }
.ins-cta[disabled] { opacity: .6; }
.ins-cta.ghost {
  background: var(--surface-2);
  color: var(--primary);
}
.ins-note {
  margin: 8px 0 0;
  text-align: center;
  font-size: 12px;
  line-height: 1.6;
  color: var(--text-3);
}

.ins-lead {
  font-size: 13.5px;
  line-height: 1.75;
  color: var(--text-2);
  margin: 0;
}

.ins-more {
  margin-top: 14px;
  padding-top: 10px;
  border-top: 1px dashed var(--border);
}
.ins-more summary {
  font-size: 12px;
  color: var(--text-3);
  cursor: pointer;
  list-style: none;
}
.ins-more summary::-webkit-details-marker { display: none; }
.ins-more summary::after {
  content: " ›";
  color: var(--primary);
}
.ins-more[open] summary::after { content: " ﹀"; }
.ins-more p {
  margin: 8px 0 0;
  font-size: 12px;
  line-height: 1.7;
  color: var(--text-3);
}
.ins-more .ins-steps { margin-top: 4px; }

/* ---------- 弹层 ---------- */
.mask {
  position: fixed;
  inset: 0;
  z-index: 50;
  background: rgba(0, 0, 0, 0.36);
  opacity: 0;
  visibility: hidden;
}
.mask.show { opacity: 1; visibility: visible; }

.sheet {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 60;
  background: var(--surface);
  border-radius: 22px 22px 0 0;
  border-top: 1px solid var(--border);
  box-shadow: 0 -8px 40px rgba(0, 0, 0, 0.12);
  padding: 8px 16px calc(20px + env(safe-area-inset-bottom, 0px));
  max-height: 78vh;
  overflow-y: auto;
  transform: translateY(101%);
}
.sheet.show { transform: translateY(0); }

/* 分类总览：域导航 + 分组滚动 */
.sheet.tall {
  max-height: 88vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding-bottom: 0;
}
.sheet.tall .sheet-body {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}
/* 标题与手势条不参与压缩，否则会被挤掉 */
.sheet.tall .sheet-handle,
.sheet.tall .sheet-title { flex: 0 0 auto; }

.cat-nav {
  flex: 0 0 auto;            /* 关键：不参与 flex 压缩，否则按钮被下方滚动区遮住 */
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 6px 0 14px;
  margin-bottom: 10px;
  border-bottom: 1px solid var(--border);
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.cat-nav::-webkit-scrollbar { display: none; }

.cat-tab {
  flex: 0 0 auto;
  border: 1px solid var(--border);
  background: var(--bg);
  border-radius: 999px;
  min-height: 34px;
  padding: 0 11px;
  font-size: 12.5px;
  color: var(--text-2);
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  -webkit-tap-highlight-color: transparent;
  transition: background .18s ease, color .18s ease, border-color .18s ease;
}
.cat-tab:active { transform: scale(.97); }
.cat-tab-emoji { font-size: 13.5px; line-height: 1; }
.cat-tab.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

.cat-scroll {
  position: relative;
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  padding: 12px 0 calc(18px + env(safe-area-inset-bottom, 0px));
}
.cat-group { margin-bottom: 20px; }
.cat-group-title {
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.08em;
  color: var(--text-2);
  margin: 0 0 10px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.cat-group-count {
  font-size: 11px;
  font-weight: 400;
  color: var(--text-3);
  font-variant-numeric: tabular-nums;
}

.sheet-handle {
  width: 38px;
  height: 4px;
  border-radius: 999px;
  background: var(--surface-3);
  margin: 0 auto 14px;
}

.sheet-title {
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.08em;
  color: var(--text-2);
  margin-bottom: 14px;
}

/* 分类宫格 */
.cat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(88px, 1fr));
  gap: 10px;
}
.cat-item {
  border: 1px solid var(--border);
  background: var(--bg);
  border-radius: 16px;
  padding: 12px 6px 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  color: var(--text-2);
  transition: border-color .18s ease, background .18s ease;
}
.cat-item:active { transform: scale(.97); }
.cat-item.active { border-color: var(--primary); background: var(--primary-soft); }
.cat-emoji { font-size: 26px; line-height: 1.1; }
.cat-name { font-size: 12.5px; color: var(--text-1); letter-spacing: 0.03em; }
.cat-count { font-size: 10.5px; color: var(--text-3); font-variant-numeric: tabular-nums; }

/* 主题列表 */
.theme-item {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 12px;
  border: 1px solid var(--border);
  background: var(--bg);
  border-radius: 16px;
  padding: 12px 14px;
  margin-bottom: 10px;
  text-align: left;
  transition: border-color .18s ease, background .18s ease;
}
.theme-item:active { transform: scale(.99); }
.theme-item.active { border-color: var(--primary); background: var(--primary-soft); }
.theme-info { flex: 1; min-width: 0; }
.theme-name { font-size: 14px; color: var(--text-1); letter-spacing: 0.03em; }
.theme-desc { font-size: 11.5px; color: var(--text-3); margin-top: 2px; letter-spacing: 0.02em; }
.theme-dots { display: flex; gap: 5px; flex: 0 0 auto; }
.theme-dot { width: 16px; height: 16px; border-radius: 50%; border: 1px solid rgba(0,0,0,.06); }
.theme-check { flex: 0 0 auto; color: var(--primary); display: none; }
.theme-item.active .theme-check { display: block; }

/* ---------- 词包选择 ---------- */
.pack-item {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 12px;
  border: 1px solid var(--border);
  background: var(--bg);
  border-radius: 16px;
  padding: 14px;
  margin-bottom: 10px;
  text-align: left;
  transition: border-color .18s ease, background .18s ease;
}
.pack-item:active { transform: scale(.99); }
.pack-item.active { border-color: var(--primary); background: var(--primary-soft); }
.pack-emoji {
  flex: 0 0 auto;
  width: 38px; height: 38px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 12px;
  background: var(--surface-2);
  font-size: 19px;
}
.pack-info { flex: 1; min-width: 0; }
.pack-name { display: block; font-size: 14.5px; color: var(--text-1); letter-spacing: 0.03em; }
.pack-desc { display: block; font-size: 11.5px; color: var(--text-3); margin-top: 3px; letter-spacing: 0.02em; }
.pack-count {
  flex: 0 0 auto;
  font-size: 12px;
  color: var(--text-3);
  font-variant-numeric: tabular-nums;
}
.pack-check { flex: 0 0 auto; color: var(--primary); display: none; }
.pack-item.active .pack-check { display: block; }
.pack-item.active .pack-count { color: var(--primary); }
.pack-tip {
  margin: 4px 2px 12px;
  font-size: 11.5px;
  line-height: 1.7;
  color: var(--text-3);
  letter-spacing: 0.02em;
}

/* ---------- 单词详情大卡 ---------- */
body.no-scroll { overflow: hidden; }

.dsheet {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 60;
  background: var(--surface);
  border-radius: 24px 24px 0 0;
  border-top: 1px solid var(--border);
  box-shadow: 0 -10px 46px rgba(0, 0, 0, 0.16);
  padding: 6px 20px calc(20px + env(safe-area-inset-bottom, 0px));
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  transform: translateY(103%);
}
.dsheet.show { transform: translateY(0); }

.dsheet-handle {
  width: 40px;
  height: 4px;
  border-radius: 999px;
  background: var(--surface-3);
  margin: 0 auto 10px;
  flex: 0 0 auto;
}

.ds-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex: 0 0 auto;
}

.ds-nav-btn {
  width: 42px;
  height: 42px;
  flex: 0 0 auto;
  border: 1px solid var(--border);
  border-radius: 50%;
  background: var(--surface-2);
  color: var(--text-1);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  transition: transform .14s ease, opacity .18s ease;
}
.ds-nav-btn svg { width: 20px; height: 20px; }
.ds-nav-btn:active { transform: scale(.9); }
.ds-nav-btn:disabled { opacity: .3; }

.ds-pos {
  flex: 1;
  text-align: center;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--text-3);
  letter-spacing: 0.04em;
  font-variant-numeric: tabular-nums;
}

.ds-body {
  flex: 1 1 auto;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  text-align: center;
  padding: 14px 0 4px;
}

.ds-emoji {
  width: 92px;
  height: 92px;
  margin: 0 auto 12px;
  border-radius: 26px;
  background: var(--primary-soft);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 50px;
  line-height: 1;
}

.ds-word {
  font-family: Georgia, "Times New Roman", serif;
  font-size: 36px;
  font-weight: 600;
  line-height: 1.15;
  letter-spacing: 0.005em;
  color: var(--text-1);
  word-break: break-word;
}

.ds-ipa {
  margin-top: 8px;
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, "IPAMono", monospace;
  font-size: 17px;
  color: var(--text-2);
  letter-spacing: 0.02em;
}

.ds-zh {
  margin-top: 10px;
  font-size: 25px;
  font-weight: 600;
  color: var(--primary);
  letter-spacing: 0.04em;
}

.ds-split {
  height: 1px;
  background: var(--border);
  margin: 20px 0 16px;
}

.ds-label {
  text-align: left;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.14em;
  color: var(--text-3);
  text-transform: uppercase;
  margin-bottom: 7px;
}

.ds-sen-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  text-align: left;
}

.ds-sen-en {
  flex: 1;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 19px;
  line-height: 1.55;
  font-weight: 500;
  color: var(--text-1);
}

.ds-sen-zh {
  text-align: left;
  margin-top: 9px;
  font-size: 16px;
  line-height: 1.65;
  color: var(--text-2);
}

.ds-mini {
  flex: 0 0 auto;
  width: 42px;
  height: 42px;
  border: none;
  border-radius: 50%;
  background: var(--primary-soft);
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  transition: transform .14s ease;
}
.ds-mini svg { width: 21px; height: 21px; }
.ds-mini:active { transform: scale(.9); }
.ds-mini.speaking { color: var(--accent); }
.ds-mini.speaking svg { animation: pulse .9s ease-in-out infinite; }

.ds-actions {
  flex: 0 0 auto;
  display: flex;
  gap: 10px;
  padding-top: 16px;
}

.ds-btn {
  flex: 1;
  height: 50px;
  border: none;
  border-radius: 16px;
  background: var(--primary);
  color: var(--on-primary);
  font-size: 15.5px;
  font-weight: 600;
  letter-spacing: 0.04em;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: transform .14s ease, opacity .18s ease;
}
.ds-btn svg { width: 20px; height: 20px; }
.ds-btn:active { transform: scale(.975); }
.ds-btn[disabled] { opacity: .55; }

.ds-btn.ghost {
  background: var(--surface-2);
  color: var(--text-1);
  border: 1px solid var(--border);
}

/* ---------- Toast ---------- */
/* 130：必须高于登录浮层（.authview 是 100）。曾经是 80，
   导致登录面板打开时的所有提示（Passkey 失败、验证码发送失败…）都被挡在面板后面，
   用户看到的是「点了没反应」。 */
.toast {
  position: fixed;
  left: 50%;
  /* --kb 由 auth-ui.js 的 fitKeyboard() 写入（仅 iOS 键盘弹起时非 0）：
     iOS 不缩布局视口，position:fixed 的元素不会跟着上移，键盘会直接盖住提示条。 */
  bottom: calc(96px + var(--kb, 0px) + env(safe-area-inset-bottom, 0px));
  transform: translate(-50%, 8px);
  /* 必须高于所有浮层（最高是登录面板 100），否则提示被画在面板后面 = 用户以为没反应 */
  z-index: 130;
  background: var(--text-1);
  color: var(--surface);
  font-size: 12.5px;
  letter-spacing: 0.03em;
  padding: 9px 16px;
  border-radius: 999px;
  opacity: 0;
  visibility: hidden;
  max-width: 82vw;
  text-align: center;
}
.toast.show { opacity: .94; visibility: visible; transform: translate(-50%, 0); }

/* ---------- 平板 / 桌面 ---------- */
@media (min-width: 700px) {
  main { max-width: 900px; margin: 0 auto; padding-left: 20px; padding-right: 20px; }
  .grid { gap: 14px; }
  .card { padding: 15px; }
  .emoji { width: 52px; height: 52px; font-size: 29px; }
  .word { font-size: 21px; }
  .dsheet {
    left: 50%;
    right: auto;
    width: 540px;
    transform: translate(-50%, 103%);
    border-radius: 24px 24px 0 0;
  }
  .dsheet.show { transform: translate(-50%, 0); }
}

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

/* JS 用 hidden 控制显隐：作者样式里的 display 会覆盖 [hidden] 的 UA 规则，加固一下 */
[hidden] { display: none !important; }

/* 未完成支付提醒条（支付平台放弃/失败时不跳回本站，由站内提示兜底）
   层级刻意低于 .mask(50)/.sheet(60)：这条提醒是**页面级**的，不是浮层内容。
   它由 JS 动态 append 到 body 末尾，若和 sheet 同为 60，打开设置/详情卡时会
   因为"后插入者优先"压在卡片上，遮住底部按钮。45 = 在 TabBar(40) 之上、
   遮罩(50) 之下，弹出浮层时随页面一起变暗，符合预期。 */
#payHint {
  position: fixed;
  left: 12px;
  right: 12px;
  bottom: calc(74px + env(safe-area-inset-bottom, 0px));
  z-index: 45;
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--primary);
  color: var(--on-primary);
  border-radius: 12px;
  padding: 10px 8px 10px 14px;
  font-size: 13px;
  line-height: 1.45;
  box-shadow: var(--shadow-lift);
}
#payHint .ph-txt { flex: 1; min-width: 0; }
#payHint .ph-go {
  flex: none;
  color: var(--on-primary);
  text-decoration: none;
  font-size: 12.5px;
  padding: 5px 10px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.18);
}
#payHint .ph-x {
  flex: none;
  width: 26px;
  height: 26px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--on-primary);
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
  opacity: 0.75;
}

/* 页脚法务链接（Waffo 审核要求：法务页链接须在页脚、无需登录即可访问） */
.site-foot {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px 14px;
  padding: 22px 6px 4px;
  font-size: 12px;
  line-height: 1.6;
}
.site-foot a {
  color: var(--text-3);
  text-decoration: none;
}
.site-foot a:active { opacity: .6; }

/* ---------- 动效策略（2026-10-27） ----------
   已关闭「一次性入场 / 位移」类动画：
     .card 的 rise 入场（含首屏与整包重载）、.lock-card / .grid-state 的 rise、
     .mask 淡入、.sheet / .dsheet 上滑、.toast 弹出、登录面板淡入与上浮。
   仍然保留：循环动画（朗读脉冲、.spinner、骨架流光、Passkey 光圈）、
             颜色 / 边框过渡、:active 缩放反馈。
   因为这些过渡被删除，transitionend 不再触发，app.js 的 TabBar 高亮清理
   已改为宏任务兜底。回滚步骤见 动画关闭方案.md。 */
