/* ==========================================================================
 * 小雨词汇通 · 卡通风格
 *   造型语言：粗描边 + 硬阴影 + 大圆角 + 糖果色
 *   交互语言：按下去真的会「陷进去」（硬阴影消失 + 下移），松手弹回
 *   主色只有四个，每个板块一个：薄荷 / 天蓝 / 柠檬 / 葡萄
 * ========================================================================== */

/* ---------------------------------------------------------------- 设计令牌 */
:root {
  /* 墨色：描边与正文，不用纯黑，偏蓝一点更柔和 */
  --ink: #2b3a55;
  --ink-2: #4a5b78;
  --ink-3: #8a97ad;

  /* 纸感底色 */
  --paper: #fffdf6;
  --paper-2: #fff6e2;
  --paper-3: #fdf1d6;

  /* 四个板块主色 */
  --mint: #34d399;
  --mint-d: #0d9f6e;
  --mint-l: #d1fae5;

  --sky: #38bdf8;
  --sky-d: #0284c7;
  --sky-l: #dbeafe;

  --lemon: #fbbf24;
  --lemon-d: #d97706;
  --lemon-l: #fef3c7;

  --grape: #a78bfa;
  --grape-d: #7c3aed;
  --grape-l: #ede9fe;

  --peach: #fb7185;
  --peach-d: #e11d48;

  /* 语义 */
  --ok: #10b981;
  --bad: #ef4444;
  --warn: #f59e0b;

  /* 描边与阴影 —— 卡通感的核心 */
  --bw: 3px;
  --bw-thin: 2px;
  --sh-1: 0 3px 0 var(--ink);
  --sh-2: 0 5px 0 var(--ink);
  --sh-3: 0 7px 0 var(--ink);
  --sh-4: 0 10px 0 var(--ink), 0 16px 30px rgba(43, 58, 85, .16);
  --sh-soft: 0 4px 14px rgba(43, 58, 85, .1);
  --sh-focus: 0 0 0 4px rgba(56, 189, 248, .35);

  /* 圆角：统一放大，圆润才卡通 */
  --r-sm: 12px;
  --r-md: 18px;
  --r-lg: 24px;
  --r-xl: 32px;
  --r-pill: 999px;

  /* 弹性曲线：带一点点过冲，像橡皮 */
  --bounce: cubic-bezier(.34, 1.56, .64, 1);
  --ease: cubic-bezier(.22, .68, .35, 1);

  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", "Source Han Sans SC", sans-serif;
  --font-en: "Iowan Old Style", "Palatino Linotype", Georgia, "Times New Roman", serif;
  --font-num: "SF Mono", "JetBrains Mono", ui-monospace, monospace;

  --maxw: 1000px;
}

/* ---------------------------------------------------------------- 基础 */
*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.65;
  color: var(--ink);
  /* 天空渐变 + 淡淡的云，呼应「小雨」 */
  background:
    radial-gradient(1200px 600px at 50% -10%, #e0f2fe 0%, transparent 62%),
    linear-gradient(180deg, #f0f9ff 0%, var(--paper) 46%);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  overflow-x: hidden;
}

h1, h2, h3, p { margin: 0; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; -webkit-tap-highlight-color: transparent; }

:focus-visible { outline: none; box-shadow: var(--sh-focus); border-radius: var(--r-sm); }
::selection { background: #bae6fd; }

/* 波纹特效（由 sound.js 插入） */
.ripple {
  position: absolute;
  border-radius: 50%;
  background: rgba(255, 255, 255, .55);
  pointer-events: none;
  transform: scale(0);
  animation: rippleOut .6s var(--ease) forwards;
  z-index: 5;
}
@keyframes rippleOut {
  to { transform: scale(1); opacity: 0; }
}

/* ---------------------------------------------------------------- 顶部栏 */
.topbar {
  position: sticky;
  top: 0;
  z-index: 60;
  background: rgba(255, 253, 246, .92);
  backdrop-filter: saturate(150%) blur(10px);
  -webkit-backdrop-filter: saturate(150%) blur(10px);
  border-bottom: var(--bw) solid var(--ink);
}
.topbar-inner {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 11px 22px;
  display: flex;
  align-items: center;
  gap: 14px;
  min-height: 66px;
}

/* 品牌：水滴 + 名字 */
.brand {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 3px 6px 3px 3px;
  border-radius: var(--r-pill);
  transition: transform .2s var(--bounce);
}
.brand:hover { transform: rotate(-2deg) scale(1.02); }
.brand:active { transform: scale(.96); }

.brand .drop {
  width: 40px;
  height: 40px;
  flex: 0 0 40px;
  position: relative;
  display: grid;
  place-items: center;
  filter: drop-shadow(0 2px 0 rgba(43, 58, 85, .22));
  animation: dropFloat 3.4s ease-in-out infinite;
}
/* 水滴本体：SVG 画，尖端朝上 */
.brand .drop svg { width: 100%; height: 100%; display: block; }
.brand .drop b {
  position: absolute;
  font-size: 17px;
  font-weight: 800;
  color: #fff;
  top: 52%;
  left: 50%;
  transform: translate(-50%, -50%);
  letter-spacing: 0;
  text-shadow: 0 1px 2px rgba(2, 132, 199, .45);
}
@keyframes dropFloat {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  50% { transform: translateY(-4px) rotate(-3deg); }
}

.brand .txt b {
  display: block;
  font-size: 20px;
  font-weight: 800;
  letter-spacing: .03em;
  color: var(--ink);
  line-height: 1.15;
}
.brand .txt small {
  display: block;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--ink-3);
  letter-spacing: .02em;
}

.topbar .spacer { flex: 1 1 auto; }

/* 顶部栏的连续学习徽章 */
.streak-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 7px 15px;
  border-radius: var(--r-pill);
  border: var(--bw-thin) solid var(--ink);
  background: linear-gradient(150deg, #fff, #fef3c7);
  box-shadow: 0 2px 0 var(--ink);
  font-size: 13px;
  font-weight: 800;
  color: var(--ink);
  user-select: none;
}
.streak-pill .fire { font-size: 15px; line-height: 1; }
.streak-pill .n {
  font-family: var(--font-num);
  font-size: 16px;
  font-weight: 800;
  letter-spacing: -.02em;
}
.streak-pill .t { font-size: 12px; color: var(--ink-2); }

/* 返回按钮 */
.btn-back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px 8px 12px;
  border-radius: var(--r-pill);
  border: var(--bw-thin) solid var(--ink);
  background: #fff;
  box-shadow: var(--sh-1);
  font-size: 13.5px;
  font-weight: 700;
  color: var(--ink);
  transition: transform .12s var(--ease), box-shadow .12s var(--ease);
}
.btn-back:hover { transform: translateY(-2px); box-shadow: var(--sh-2); }
.btn-back:active { transform: translateY(3px); box-shadow: 0 0 0 var(--ink); }
.btn-back .arw { font-size: 16px; line-height: 1; }

/* ---------------------------------------------------------------- 布局 */
.main { max-width: var(--maxw); margin: 0 auto; padding: 26px 22px 40px; }

.view { display: none; }
.view.on { display: block; animation: viewIn .38s var(--bounce) both; }
@keyframes viewIn {
  from { opacity: 0; transform: translateY(14px) scale(.99); }
  to { opacity: 1; transform: none; }
}

/* ---------------------------------------------------------------- 首页 */
.hero-home {
  text-align: center;
  padding: 30px 0 44px;
}
.hero-home h1 {
  font-size: clamp(28px, 5vw, 42px);
  font-weight: 800;
  letter-spacing: -.01em;
  color: var(--ink);
  line-height: 1.2;
}
.hero-home h1 .hl {
  color: var(--sky-d);
  position: relative;
  white-space: nowrap;
}
/* 名字下面一条手绘感的下划波浪 */
.hero-home h1 .hl::after {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: -6px;
  height: 7px;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='60' height='7' viewBox='0 0 60 7'%3E%3Cpath d='M0 4.5c7.5-4 15-4 22.5 0S45 8.5 60 4.5' fill='none' stroke='%23fbbf24' stroke-width='3' stroke-linecap='round'/%3E%3C/svg%3E") repeat-x center / 60px 7px;
}
.hero-home p {
  margin-top: 16px;
  font-size: 14.5px;
  color: var(--ink-2);
}

/* 四个板块 */
.tiles {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 26px;
  margin-top: 6px;
}

.tile {
  position: relative;
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 30px 30px;
  min-height: 132px;
  text-align: left;
  border-radius: var(--r-xl);
  border: var(--bw) solid var(--ink);
  background: #fff;
  box-shadow: var(--sh-4);
  overflow: hidden;
  transition: transform .18s var(--bounce), box-shadow .18s var(--ease);
  animation: tileIn .5s var(--bounce) both;
}
.tile:nth-child(1) { animation-delay: 0s; }
.tile:nth-child(2) { animation-delay: .06s; }
.tile:nth-child(3) { animation-delay: .12s; }
.tile:nth-child(4) { animation-delay: .18s; }
/* 只动 transform，不把 opacity 从 0 起步：
   否则动画延迟期间整块是不可见的，禁动画或慢机器上会看到格子「一块块冒出来」 */
@keyframes tileIn {
  from { transform: translateY(22px) scale(.95); }
  to { transform: none; }
}
.tile:hover {
  transform: translateY(-7px) rotate(-1deg);
  box-shadow: 0 14px 0 var(--ink), 0 22px 38px rgba(43, 58, 85, .2);
}
.tile:active {
  transform: translateY(6px) rotate(0deg) scale(.985);
  box-shadow: 0 2px 0 var(--ink);
}

/* 板块图标：圆角方块 + 内嵌 SVG（不用 emoji，避免依赖系统彩色字体） */
.tile .ic {
  flex: 0 0 74px;
  width: 74px;
  height: 74px;
  border-radius: 24px;
  display: grid;
  place-items: center;
  border: var(--bw-thin) solid var(--ink);
  box-shadow: 0 4px 0 var(--ink);
  position: relative;
  z-index: 1;
  transition: transform .22s var(--bounce);
}
.tile .ic svg { width: 40px; height: 40px; display: block; }
.tile:hover .ic { transform: rotate(-8deg) scale(1.06); }
/* 右上角的小圆点，像贴纸的小气泡 */
.tile .ic::after {
  content: "";
  position: absolute;
  right: -7px; top: -7px;
  width: 18px; height: 18px;
  border-radius: 50%;
  background: #fff;
  border: var(--bw-thin) solid var(--ink);
}

.tile .tx { min-width: 0; position: relative; z-index: 1; }
.tile .tx b {
  display: block;
  font-size: 24px;
  font-weight: 800;
  letter-spacing: .01em;
  color: var(--ink);
}
.tile .tx span {
  display: block;
  font-size: 13.5px;
  color: var(--ink-2);
  margin-top: 6px;
  line-height: 1.55;
}

/* 每个板块一个色 */
.tile.mint { background: linear-gradient(150deg, #fff 0%, var(--mint-l) 100%); }
.tile.mint .ic { background: var(--mint); }
.tile.sky { background: linear-gradient(150deg, #fff 0%, var(--sky-l) 100%); }
.tile.sky .ic { background: var(--sky); }
.tile.lemon { background: linear-gradient(150deg, #fff 0%, var(--lemon-l) 100%); }
.tile.lemon .ic { background: var(--lemon); }
.tile.grape { background: linear-gradient(150deg, #fff 0%, var(--grape-l) 100%); }
.tile.grape .ic { background: var(--grape); }

/* 右下角一块淡淡的色斑，让卡片不至于太空 */
.tile::after {
  content: "";
  position: absolute;
  right: -30px;
  bottom: -40px;
  width: 130px;
  height: 130px;
  border-radius: 50%;
  background: currentColor;
  opacity: .07;
  pointer-events: none;
}
.tile.mint::after { color: var(--mint-d); }
.tile.sky::after { color: var(--sky-d); }
.tile.lemon::after { color: var(--lemon-d); }
.tile.grape::after { color: var(--grape-d); }

/* 首页底部小字条 */
.tipbar {
  margin-top: 26px;
  padding: 15px 20px;
  border-radius: var(--r-lg);
  border: var(--bw-thin) dashed var(--ink-3);
  background: rgba(255, 255, 255, .68);
  font-size: 13px;
  color: var(--ink-2);
  display: flex;
  align-items: center;
  gap: 10px;
}
.tipbar .bulb { font-size: 19px; }

/* ---------------------------------------------------------------- 通用卡片 */
.card {
  background: #fff;
  border: var(--bw) solid var(--ink);
  border-radius: var(--r-lg);
  padding: 22px 24px;
  margin-top: 18px;
  box-shadow: var(--sh-2);
}
.card.tight { padding: 8px 22px; }
.card-hd { margin-bottom: 16px; }
.card-hd h2 {
  font-size: 18px;
  font-weight: 800;
  letter-spacing: .01em;
  color: var(--ink);
  display: flex;
  align-items: center;
  gap: 8px;
}
.card-hd .sub { font-size: 13px; color: var(--ink-2); margin-top: 5px; }

.pagehead { margin-bottom: 22px; }
.pagehead h1 {
  font-size: 30px;
  font-weight: 800;
  letter-spacing: -.01em;
  color: var(--ink);
}
.pagehead p { margin-top: 7px; font-size: 14px; color: var(--ink-2); }
.pagehead p b { color: var(--ink); font-weight: 800; }

/* ---------------------------------------------------------------- 按钮 */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 11px 20px;
  border-radius: var(--r-pill);
  font-size: 14.5px;
  font-weight: 700;
  white-space: nowrap;
  background: #fff;
  color: var(--ink);
  border: var(--bw-thin) solid var(--ink);
  box-shadow: var(--sh-1);
  transition: transform .12s var(--ease), box-shadow .12s var(--ease), background .15s var(--ease);
}
.btn:hover { transform: translateY(-2px); box-shadow: var(--sh-2); }
.btn:active { transform: translateY(3px); box-shadow: 0 0 0 var(--ink); }

.btn.primary {
  background: var(--sky);
  color: #fff;
  border-color: var(--ink);
  text-shadow: 0 1px 0 rgba(2, 132, 199, .35);
}
.btn.primary:hover { background: #22b8ee; }
.btn.go {
  background: var(--lemon);
  color: var(--ink);
}
.btn.go:hover { background: #f5b012; }
.btn.ghost {
  background: transparent;
  border-color: transparent;
  box-shadow: none;
  color: var(--ink-2);
}
.btn.ghost:hover { background: rgba(43, 58, 85, .06); box-shadow: none; transform: none; }
.btn.small { padding: 8px 15px; font-size: 13px; }
.btn.lg { padding: 15px 34px; font-size: 17px; border-radius: var(--r-pill); box-shadow: var(--sh-2); }
.btn.danger { color: var(--bad); border-color: var(--bad); }
.btn.danger:hover { background: #fef2f2; }

.btn-row { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 18px; }

kbd {
  display: inline-block;
  padding: 1px 6px;
  font-family: var(--font-num);
  font-size: 10.5px;
  font-weight: 700;
  border-radius: 6px;
  background: rgba(43, 58, 85, .1);
  border: var(--bw-thin) solid rgba(43, 58, 85, .18);
}

/* ---------------------------------------------------------------- 数据格 */
.grid { display: grid; gap: 14px; }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }

.stat {
  padding: 16px 18px;
  border-radius: var(--r-md);
  background: #fff;
  border: var(--bw-thin) solid var(--ink);
  box-shadow: var(--sh-1);
  transition: transform .18s var(--bounce);
}
.stat:hover { transform: translateY(-4px) rotate(-1deg); box-shadow: var(--sh-2); }
.stat .label { font-size: 12.5px; font-weight: 700; color: var(--ink-2); }
.stat .num {
  font-family: var(--font-num);
  font-size: 32px;
  font-weight: 800;
  letter-spacing: -.03em;
  color: var(--ink);
  line-height: 1.15;
  margin-top: 3px;
  font-variant-numeric: tabular-nums;
}
.stat .unit { font-size: 11.5px; color: var(--ink-3); margin-top: 2px; }

/* ---------------------------------------------------------------- 学习舞台 */
.stage {
  max-width: 760px;
  margin: 0 auto;
  min-height: calc(100vh - 190px);
  display: flex;
  flex-direction: column;
}
.stage-bar {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 4px 2px 20px;
}
/* 把答题卡放在剩余高度的靠上位置：太居中会显得空 */
.stage #study-body {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  padding-top: 4vh;
}
.progress {
  flex: 1 1 auto;
  height: 16px;
  border-radius: var(--r-pill);
  background: #fff;
  border: var(--bw-thin) solid var(--ink);
  overflow: hidden;
  box-shadow: inset 0 2px 0 rgba(43, 58, 85, .07);
}
.progress i {
  display: block;
  height: 100%;
  width: 0;
  border-radius: var(--r-pill);
  background: linear-gradient(90deg, var(--mint), var(--sky));
  transition: width .5s var(--bounce);
}
.stage-count {
  font-family: var(--font-num);
  font-size: 13px;
  font-weight: 800;
  color: var(--ink-2);
  min-width: 54px;
  text-align: right;
}

/* 答题卡 */
.qcard {
  position: relative;
  padding: 40px 34px 34px;
  border-radius: var(--r-xl);
  background: #fff;
  border: var(--bw) solid var(--ink);
  box-shadow: var(--sh-4);
  text-align: center;
  animation: cardIn .45s var(--bounce) both;
}
@keyframes cardIn {
  from { opacity: 0; transform: translateY(20px) scale(.95); }
  to { opacity: 1; transform: none; }
}

.tagline { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin-bottom: 18px; }
.tag {
  display: inline-flex;
  align-items: center;
  padding: 4px 12px;
  border-radius: var(--r-pill);
  font-size: 12px;
  font-weight: 700;
  color: var(--ink-2);
  background: #fff;
  border: var(--bw-thin) solid var(--ink);
  box-shadow: 0 2px 0 var(--ink);
}
.tag.type { background: var(--sky-l); color: var(--sky-d); }

.qtype { font-size: 13.5px; color: var(--ink-3); margin-bottom: 12px; font-weight: 600; }

.big-word {
  font-family: var(--font-en);
  font-size: 56px;
  font-weight: 400;
  line-height: 1.1;
  letter-spacing: -.02em;
  color: var(--ink);
  word-break: break-word;
}
.phon {
  font-family: var(--font-num);
  font-size: 14.5px;
  color: var(--ink-3);
  margin-top: 8px;
  font-weight: 600;
}
.big-zh {
  font-size: 38px;
  font-weight: 800;
  letter-spacing: -.02em;
  line-height: 1.3;
  color: var(--ink);
  word-break: break-word;
}
.pos-badge {
  display: inline-block;
  padding: 3px 11px;
  margin-bottom: 12px;
  border-radius: var(--r-pill);
  font-family: var(--font-num);
  font-size: 12px;
  font-weight: 700;
  font-style: italic;
  color: var(--mint-d);
  background: var(--mint-l);
  border: var(--bw-thin) solid var(--ink);
}

.sentence {
  font-size: 21px;
  line-height: 1.75;
  color: var(--ink);
  text-align: left;
  padding: 20px 24px;
  border-radius: var(--r-md);
  background: var(--paper-2);
  border: var(--bw-thin) dashed var(--ink);
  margin-bottom: 10px;
}
.sentence .blank {
  display: inline-block;
  min-width: 90px;
  color: var(--sky-d);
  font-weight: 800;
  letter-spacing: .08em;
  border-bottom: 3px solid var(--lemon);
}
.trans { font-size: 13.5px; color: var(--ink-3); text-align: left; padding: 0 24px 4px; margin-bottom: 8px; }

.actions { display: flex; flex-wrap: wrap; gap: 12px; justify-content: center; align-items: center; margin-top: 26px; }

.answer {
  display: block;
  width: 100%;
  max-width: 340px;
  margin: 24px auto 0;
  padding: 14px 18px;
  font-family: var(--font-num);
  font-size: 21px;
  font-weight: 700;
  text-align: center;
  letter-spacing: .06em;
  color: var(--ink);
  background: #fff;
  border: var(--bw) solid var(--ink);
  border-radius: var(--r-md);
  box-shadow: inset 0 3px 0 rgba(43, 58, 85, .06);
  transition: border-color .16s var(--ease), box-shadow .16s var(--ease), background .18s var(--ease);
}
.answer::placeholder { font-family: var(--font); font-size: 14.5px; letter-spacing: 0; color: var(--ink-3); font-weight: 600; }
.answer:focus { outline: none; box-shadow: var(--sh-focus); }
.answer.ok { background: var(--mint-l); border-color: var(--mint-d); color: var(--mint-d); }
.answer.no { background: #fee2e2; border-color: var(--bad); color: var(--bad); text-decoration: line-through; }

#hint-zone { margin-top: 15px; }
.hint-line {
  font-family: var(--font-num);
  font-size: 17px;
  font-weight: 800;
  letter-spacing: .14em;
  color: var(--ink-2);
  padding: 7px 0;
  animation: cardIn .32s var(--bounce) both;
}
.hint-line small {
  display: block;
  font-family: var(--font);
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0;
  color: var(--ink-3);
  margin-top: 3px;
}

.answer-box { margin-top: 26px; padding-top: 22px; border-top: var(--bw-thin) dashed var(--ink-3); animation: cardIn .4s var(--bounce) both; }
.answer-box .big-word { font-size: 34px; }
.answer-box .phon { font-size: 13px; margin-top: 5px; }
/* 翻转卡翻面后：题干的大字还在上面，答案区直接接分隔线，不重复词头 */
.answer-box.reveal-only { margin-top: 18px; }
.answer-box.reveal-only .reveal { margin-top: 0; }
.reveal { font-size: 23px; font-weight: 800; color: var(--ink); margin-top: 12px; }

.sense-list {
  list-style: none;
  margin: 18px auto 0;
  padding: 0;
  max-width: 440px;
  text-align: left;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.sense-list li {
  display: flex;
  align-items: baseline;
  gap: 11px;
  padding: 8px 14px;
  border-radius: var(--r-sm);
  font-size: 15px;
  font-weight: 600;
  color: var(--ink-2);
  background: var(--paper);
  border: var(--bw-thin) solid rgba(43, 58, 85, .12);
}
.sense-list li b {
  flex: 0 0 46px;
  font-family: var(--font-num);
  font-size: 11.5px;
  font-weight: 700;
  font-style: italic;
  color: var(--mint-d);
}

/* ---------------------------------------------------------------- 四档评分 */
.rate-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin-top: 26px; }
.rate {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 13px 6px 11px;
  border-radius: var(--r-md);
  background: #fff;
  border: var(--bw-thin) solid var(--ink);
  box-shadow: var(--sh-1);
  overflow: hidden;
  transition: transform .14s var(--bounce), box-shadow .14s var(--ease), background .14s var(--ease);
  animation: rateIn .34s var(--bounce) both;
}
.rate:nth-child(2) { animation-delay: .04s; }
.rate:nth-child(3) { animation-delay: .08s; }
.rate:nth-child(4) { animation-delay: .12s; }
/* 评分按钮用纯位移入场：延迟很短，但不该在等待期间整块隐形 */
@keyframes rateIn {
  from { transform: translateY(12px) scale(.96); }
  to { transform: none; }
}
.rate:hover { transform: translateY(-4px) rotate(-1.5deg); box-shadow: var(--sh-2); }
.rate:active { transform: translateY(3px); box-shadow: 0 0 0 var(--ink); }
.rate b { font-family: var(--font-num); font-size: 13.5px; font-weight: 800; }
.rate span { font-size: 11.5px; font-weight: 600; color: var(--ink-3); line-height: 1.4; }
.rate .kbd { margin-top: 3px; }
.rate.r0 { background: #fee2e2; } .rate.r0 b { color: var(--peach-d); }
.rate.r1 { background: #fef3c7; } .rate.r1 b { color: var(--lemon-d); }
.rate.r2 { background: var(--mint-l); } .rate.r2 b { color: var(--mint-d); }
.rate.r3 { background: var(--sky-l); } .rate.r3 b { color: var(--sky-d); }

/* ---------------------------------------------------------------- 结算 */
.done-panel { padding: 50px 34px 42px; }
.done-mark {
  width: 74px; height: 74px;
  margin: 0 auto 20px;
  border-radius: 50%;
  display: grid; place-items: center;
  font-size: 34px;
  background: var(--lemon);
  border: var(--bw) solid var(--ink);
  box-shadow: var(--sh-2);
  animation: popIn .55s var(--bounce) both;
}
@keyframes popIn {
  0% { opacity: 0; transform: scale(.4) rotate(-20deg); }
  60% { transform: scale(1.12) rotate(6deg); }
  100% { opacity: 1; transform: scale(1) rotate(0); }
}
.done-panel .title { font-size: 26px; font-weight: 800; color: var(--ink); }
.done-panel .sub { font-size: 14px; color: var(--ink-2); margin-top: 8px; }
.done-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin: 28px 0 4px; }
.done-stats > div {
  padding: 16px 10px 14px;
  border-radius: var(--r-md);
  background: var(--paper);
  border: var(--bw-thin) solid var(--ink);
  box-shadow: 0 2px 0 var(--ink);
}
.done-stats b {
  display: block;
  font-family: var(--font-num);
  font-size: 27px;
  font-weight: 800;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}
.done-stats span { display: block; font-size: 11.5px; font-weight: 700; color: var(--ink-3); margin-top: 2px; }

/* ---------------------------------------------------------------- 随便看看 */
.browse-card {
  padding: 46px 34px 34px;
  text-align: center;
  position: relative;
}
.browse-card .idx {
  position: absolute;
  top: 16px; right: 20px;
  font-family: var(--font-num);
  font-size: 12px;
  font-weight: 800;
  color: var(--ink-3);
}
.browse-card .em { font-size: 30px; margin-bottom: 4px; }
.browse-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  margin-top: 14px;
}
.browse-sent {
  margin-top: 20px;
  padding: 16px 20px;
  border-radius: var(--r-md);
  background: var(--paper-2);
  border: var(--bw-thin) dashed var(--ink);
  font-size: 17px;
  line-height: 1.7;
  text-align: left;
  color: var(--ink);
}
.browse-sent .tr { display: block; font-size: 13px; color: var(--ink-3); margin-top: 7px; font-weight: 600; }
.browse-nav { display: flex; justify-content: center; gap: 12px; margin-top: 24px; }

/* ---------------------------------------------------------------- 教材选择 */
.book-row {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  padding: 14px 0;
  border-bottom: var(--bw-thin) dashed rgba(43, 58, 85, .16);
}
.book-row:last-child { border-bottom: 0; }
.book-name { flex: 0 0 128px; font-size: 14.5px; font-weight: 800; color: var(--ink); line-height: 1.4; }
.book-name .sub { font-size: 11.5px; font-weight: 600; color: var(--ink-3); margin-top: 2px; }
.unit-chips { display: flex; flex-wrap: wrap; gap: 7px; flex: 1 1 auto; }

.chip {
  display: inline-flex;
  align-items: center;
  padding: 5px 13px;
  border-radius: var(--r-pill);
  font-size: 12.5px;
  font-weight: 700;
  color: var(--ink-2);
  background: #fff;
  border: var(--bw-thin) solid var(--ink);
  box-shadow: 0 2px 0 var(--ink);
  cursor: pointer;
  user-select: none;
  transition: transform .12s var(--bounce), background .14s var(--ease), box-shadow .12s var(--ease);
}
.chip:hover { transform: translateY(-2px); background: var(--paper-2); }
.chip:active { transform: translateY(2px); box-shadow: 0 0 0 var(--ink); }
.chip.on { background: var(--sky); color: #fff; }

/* ---------------------------------------------------------------- 工具条 */
.toolbar { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 16px; }
.toolbar input[type="search"] {
  flex: 1 1 240px;
  min-width: 0;
  padding: 10px 16px;
  border-radius: var(--r-pill);
  background: #fff;
  border: var(--bw-thin) solid var(--ink);
  box-shadow: var(--sh-1);
  font-weight: 600;
}
.toolbar input[type="search"]::placeholder { color: var(--ink-3); }
.toolbar input[type="search"]:focus { outline: none; box-shadow: var(--sh-focus); }
.toolbar select {
  padding: 10px 34px 10px 16px;
  border-radius: var(--r-pill);
  background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5l5 5 5-5' fill='none' stroke='%232b3a55' stroke-width='2.2' stroke-linecap='round'/%3E%3C/svg%3E") no-repeat right 14px center;
  border: var(--bw-thin) solid var(--ink);
  box-shadow: var(--sh-1);
  -webkit-appearance: none;
  appearance: none;
  cursor: pointer;
  font-weight: 700;
}
.toolbar select:focus { outline: none; box-shadow: var(--sh-focus); }

/* ---------------------------------------------------------------- 表格 */
.scroll {
  border-radius: var(--r-lg);
  border: var(--bw) solid var(--ink);
  background: #fff;
  box-shadow: var(--sh-2);
  overflow: auto;
  max-height: 62vh;
}
table.words { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 14px; }
table.words th {
  position: sticky; top: 0; z-index: 2;
  padding: 12px 15px;
  text-align: left;
  font-size: 12px;
  font-weight: 800;
  color: var(--ink);
  background: var(--paper-3);
  border-bottom: var(--bw-thin) solid var(--ink);
  white-space: nowrap;
}
table.words td { padding: 11px 15px; border-bottom: var(--bw-thin) dashed rgba(43, 58, 85, .14); color: var(--ink-2); font-weight: 600; }
table.words tbody tr:last-child td { border-bottom: 0; }
table.words tbody tr:hover td { background: var(--paper); }
table.words td.w { font-family: var(--font-en); font-size: 17px; font-weight: 400; color: var(--ink); }
table.words td .sub { font-size: 11.5px; color: var(--ink-3); font-weight: 600; }

.pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 11px;
  border-radius: var(--r-pill);
  font-size: 11.5px;
  font-weight: 800;
  white-space: nowrap;
  color: var(--ink-2);
  background: #fff;
  border: var(--bw-thin) solid var(--ink);
}
.pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.pill.ok { color: var(--mint-d); background: var(--mint-l); }
.pill.warn { color: var(--lemon-d); background: var(--lemon-l); }
.pill.new { color: var(--ink-3); }

.empty { padding: 34px 20px; text-align: center; font-size: 13.5px; color: var(--ink-3); font-weight: 600; }

/* ---------------------------------------------------------------- 图表 */
.chart { width: 100%; height: auto; display: block; }
.legend { display: flex; flex-wrap: wrap; gap: 8px 18px; margin-bottom: 14px; }
.legend span { display: inline-flex; align-items: center; gap: 7px; font-size: 12.5px; font-weight: 700; color: var(--ink-2); }
.legend i { width: 12px; height: 12px; border-radius: 4px; border: var(--bw-thin) solid var(--ink); }
.legend b { font-family: var(--font-num); font-weight: 800; color: var(--ink); }

/* ---------------------------------------------------------------- 易错词 */
.hard-list { display: flex; flex-wrap: wrap; gap: 9px; }
.hard-item {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  padding: 7px 14px 7px 8px;
  border-radius: var(--r-pill);
  background: #fff;
  border: var(--bw-thin) solid var(--ink);
  box-shadow: 0 2px 0 var(--ink);
  transition: transform .14s var(--bounce);
}
.hard-item:hover { transform: translateY(-3px) rotate(-1deg); }
.hard-item .cnt {
  display: grid; place-items: center;
  width: 22px; height: 22px; flex: 0 0 22px;
  border-radius: 50%;
  font-family: var(--font-num);
  font-size: 11px; font-weight: 800;
  color: #fff;
  background: var(--ink);
}
.hard-item b { font-family: var(--font-en); font-size: 16px; font-weight: 400; color: var(--ink); }
.hard-item > span:last-child { font-size: 12.5px; font-weight: 600; color: var(--ink-3); }
.hard-item:nth-child(-n+3) .cnt { background: var(--peach); }

/* ---------------------------------------------------------------- 设置行 */
.row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 15px 0;
  border-bottom: var(--bw-thin) dashed rgba(43, 58, 85, .16);
}
.row:last-child { border-bottom: 0; }
.row > label:first-child { font-size: 14.5px; font-weight: 800; color: var(--ink); flex: 1 1 auto; min-width: 0; }
.row .desc { display: block; font-size: 12.5px; font-weight: 600; color: var(--ink-3); margin-top: 4px; line-height: 1.5; }
.row > label.danger { color: var(--bad); }
.row input[type="number"] {
  flex: 0 0 96px; width: 96px;
  padding: 9px 11px;
  font-family: var(--font-num);
  font-size: 15px; font-weight: 800;
  text-align: center;
  color: var(--ink);
  background: #fff;
  border: var(--bw-thin) solid var(--ink);
  border-radius: var(--r-sm);
  box-shadow: inset 0 2px 0 rgba(43, 58, 85, .06);
}
.row input[type="number"]:focus { outline: none; box-shadow: var(--sh-focus); }

/* 卡通开关 */
.switch { display: inline-flex; align-items: center; gap: 9px; flex: 0 0 auto; font-size: 13px; font-weight: 800; color: var(--ink-2); cursor: pointer; user-select: none; }
.switch input {
  width: 46px; height: 26px; flex: 0 0 46px;
  -webkit-appearance: none; appearance: none; margin: 0;
  border-radius: var(--r-pill);
  background: #fff;
  border: var(--bw-thin) solid var(--ink);
  box-shadow: inset 0 2px 0 rgba(43, 58, 85, .08);
  position: relative;
  cursor: pointer;
  transition: background .22s var(--ease);
}
.switch input::after {
  content: "";
  position: absolute; top: 2px; left: 2px;
  width: 18px; height: 18px;
  border-radius: 50%;
  background: var(--ink-3);
  transition: transform .26s var(--bounce), background .22s var(--ease);
}
.switch input:checked { background: var(--mint); }
.switch input:checked::after { transform: translateX(20px); background: #fff; }

/* ---------------------------------------------------------------- 音量控件 */
.sfx-dock {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 90;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 10px;
}

.sfx-btn {
  width: 56px; height: 56px;
  border-radius: 50%;
  display: grid; place-items: center;
  font-size: 25px;
  line-height: 1;
  background: var(--lemon);
  border: var(--bw) solid var(--ink);
  box-shadow: var(--sh-2);
  transition: transform .16s var(--bounce), box-shadow .16s var(--ease), background .18s var(--ease);
}
.sfx-btn:hover { transform: translateY(-4px) rotate(-6deg); box-shadow: 0 7px 0 var(--ink); }
.sfx-btn:active { transform: translateY(4px); box-shadow: 0 1px 0 var(--ink); }
.sfx-btn.off { background: #e5e7eb; opacity: .85; }
/* 静音时加一道斜杠 */
.sfx-btn.off::after {
  content: "";
  position: absolute;
  width: 34px; height: 3px;
  background: var(--ink);
  border-radius: 2px;
  transform: rotate(-45deg);
}

.sfx-panel {
  width: 244px;
  padding: 16px 18px 18px;
  border-radius: var(--r-lg);
  background: #fff;
  border: var(--bw) solid var(--ink);
  box-shadow: var(--sh-3);
  transform-origin: bottom right;
  animation: panelIn .26s var(--bounce) both;
}
.sfx-panel[hidden] { display: none; }
@keyframes panelIn {
  from { opacity: 0; transform: scale(.85) translateY(10px); }
  to { opacity: 1; transform: none; }
}
.sfx-panel .hd {
  display: flex; align-items: center; justify-content: space-between;
  font-size: 13.5px; font-weight: 800; color: var(--ink);
  margin-bottom: 13px;
}
.sfx-panel .hd .vol-num {
  font-family: var(--font-num);
  font-size: 12px;
  font-weight: 800;
  color: var(--ink-2);
}

/* 音量滑块：卡通的粗轨道 + 圆胖滑块 */
.sfx-panel input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 14px;
  margin: 0;
  border-radius: var(--r-pill);
  background: var(--paper-3);
  border: var(--bw-thin) solid var(--ink);
  cursor: pointer;
}
.sfx-panel input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 24px; height: 24px;
  border-radius: 50%;
  background: var(--sky);
  border: var(--bw-thin) solid var(--ink);
  box-shadow: 0 2px 0 var(--ink);
  cursor: grab;
}
.sfx-panel input[type="range"]::-webkit-slider-thumb:active { cursor: grabbing; transform: translateY(2px); box-shadow: 0 0 0 var(--ink); }
.sfx-panel input[type="range"]::-moz-range-thumb {
  width: 22px; height: 22px;
  border-radius: 50%;
  background: var(--sky);
  border: var(--bw-thin) solid var(--ink);
  cursor: grab;
}
.sfx-panel .row2 { display: flex; align-items: center; gap: 9px; margin-top: 14px; }
.sfx-panel .row2 .lbl { font-size: 12.5px; font-weight: 800; color: var(--ink-2); flex: 1 1 auto; }
.sfx-panel .mini {
  padding: 6px 12px;
  border-radius: var(--r-pill);
  border: var(--bw-thin) solid var(--ink);
  background: #fff;
  box-shadow: 0 2px 0 var(--ink);
  font-size: 12px; font-weight: 800; color: var(--ink);
  transition: transform .12s var(--ease), box-shadow .12s var(--ease);
}
.sfx-panel .mini:hover { transform: translateY(-2px); box-shadow: 0 4px 0 var(--ink); }
.sfx-panel .mini:active { transform: translateY(2px); box-shadow: 0 0 0 var(--ink); }

/* ---------------------------------------------------------------- 页脚 */
.footnote {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 8px 22px 40px;
  font-size: 11.5px;
  line-height: 1.85;
  color: var(--ink-3);
  text-align: center;
}

/* ---------------------------------------------------------------- 响应式 */
@media (max-width: 860px) {
  .tiles { grid-template-columns: 1fr; gap: 16px; }
  .tile { padding: 20px; }
  .tile .ic { flex: 0 0 58px; width: 58px; height: 58px; font-size: 28px; border-radius: 19px; }
  .tile .tx b { font-size: 19px; }
  .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .main { padding: 20px 16px 34px; }
  .topbar-inner { padding: 10px 16px; min-height: 60px; }
  .brand .txt b { font-size: 17px; }
  .brand .txt small { display: none; }
  .done-stats { grid-template-columns: 1fr; }
  .book-row { flex-direction: column; gap: 10px; }
  .book-name { flex: 0 0 auto; }
  .row { flex-wrap: wrap; gap: 12px; }
  .sfx-dock { right: 14px; bottom: 14px; }
  .sfx-btn { width: 50px; height: 50px; font-size: 22px; }
}

@media (max-width: 560px) {
  .qcard { padding: 30px 20px 26px; border-radius: var(--r-lg); }
  .big-word { font-size: 40px; }
  .big-zh { font-size: 28px; }
  .answer-box .big-word { font-size: 27px; }
  .sentence { font-size: 17px; padding: 15px 16px; }
  .rate-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .hero-home h1 { font-size: 26px; }
  .pagehead h1 { font-size: 24px; }
  .sfx-panel { width: 210px; }
}

/* ---------------------------------------------------------------- 无障碍 */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
    scroll-behavior: auto !important;
  }
}
