/* ===========================================================
   VocaWhale · 浅色视觉
   参考苹果设计语言：大留白、克制配色、柔和阴影、毛玻璃
   =========================================================== */

:root {
  /* 底色与表面 */
  --bg:          #F5F7FB;
  --surface:     #FFFFFF;

  /* 文字 */
  --text:        #1C1C1E;
  --text-2:      #6E6E73;
  --text-3:      #A6A6AB;

  /* 描边 */
  --line:        rgba(60, 60, 67, .10);

  /* 主色（呼应鲸鱼娘的蓝） */
  --accent:      #3B7DD8;
  --accent-soft: rgba(59, 125, 216, .10);

  /* 语义色 */
  --bad:   #E5646B;
  --warn:  #D99A2B;
  --ok:    #34A97B;
  --easy:  #3B82C4;

  /* 形状 */
  --r-lg: 22px;
  --r-md: 16px;
  --r-sm: 11px;

  /* 阴影：轻、分层 */
  --sh-1: 0 1px 2px rgba(24, 39, 75, .05), 0 4px 14px rgba(24, 39, 75, .05);
  --sh-2: 0 2px 6px rgba(24, 39, 75, .06), 0 14px 40px rgba(24, 39, 75, .10);
  --sh-float: 0 18px 50px rgba(24, 39, 75, .18);

  --safe-top:    env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  overscroll-behavior: none;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro SC", "PingFang SC",
               "Helvetica Neue", "Microsoft YaHei", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  font-size: 16px;
  line-height: 1.5;
  user-select: none;
}

/* ---------------- 背景柔光（给毛玻璃提供模糊内容） ---------------- */
.ambient {
  position: fixed;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  z-index: 0;
}
.blob {
  position: absolute;
  border-radius: 50%;
  filter: blur(70px);
  opacity: .55;
}
.b1 { width: 320px; height: 320px; top: -90px;  left: -80px;   background: #BFD8F5; }
.b2 { width: 280px; height: 280px; top: 180px;  right: -110px; background: #D8CCF2; }
.b3 { width: 300px; height: 300px; bottom: -100px; left: 40px; background: #C8E8E0; }

#app {
  position: relative;
  height: 100%;
  max-width: 560px;
  margin: 0 auto;
  overflow: hidden;
  z-index: 1;
}

/* ---------------- 屏幕切换 ---------------- */
.screen {
  position: absolute;
  inset: 0;
  display: none;
  flex-direction: column;
  padding: calc(var(--safe-top) + 10px) 20px calc(84px + var(--safe-bottom));
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}
.screen.active { display: flex; animation: screenIn .28s ease; }
@keyframes screenIn {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: none; }
}

body.study-mode .tabbar { display: none; }
body.study-mode .screen { padding-bottom: calc(var(--safe-bottom) + 14px); }

/* ---------------- 顶栏 ---------------- */
.topbar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 4px 0 16px;
  flex-shrink: 0;
}

.brand { display: flex; align-items: center; gap: 9px; font-weight: 650; letter-spacing: -.2px; }
.brand-mark {
  width: 30px;
  height: 30px;
  border-radius: 9px;
  overflow: hidden;
  background: #fff;
  box-shadow: var(--sh-1);
  display: block;
}
.brand-mark img { width: 100%; height: 100%; display: block; object-fit: cover; }
.brand-name { font-size: 17px; }

.chip {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: var(--surface);
  border: 1px solid var(--line);
  color: var(--text);
  border-radius: 999px;
  padding: 6px 14px;
  font-size: 14px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  box-shadow: var(--sh-1);
  cursor: pointer;
}
.chip-fire { font-size: 13px; }

.page-title { margin: 0; font-size: 26px; font-weight: 700; letter-spacing: -.5px; }

/* ---------------- 首页 ---------------- */
.home-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding-top: 4px;
}

.ring-wrap { position: relative; width: 166px; height: 166px; flex-shrink: 0; }
.ring { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring-track { fill: none; stroke: rgba(60, 60, 67, .10); stroke-width: 9; }
.ring-fill {
  fill: none;
  stroke: var(--accent);
  stroke-width: 9;
  stroke-linecap: round;
  stroke-dasharray: 327;
  stroke-dashoffset: 327;
  transition: stroke-dashoffset .7s cubic-bezier(.22, 1, .36, 1);
}
.ring-center {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}
.ring-num {
  font-size: 42px;
  font-weight: 700;
  line-height: 1;
  letter-spacing: -1px;
  font-variant-numeric: tabular-nums;
}
.ring-label { font-size: 12.5px; color: var(--text-2); margin-top: 5px; }

.mascot-area {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-height: 0;
}
.mascot {
  width: 176px;
  height: auto;
  display: block;
  filter: drop-shadow(0 14px 26px rgba(24, 39, 75, .16));
  animation: float 3.6s ease-in-out infinite;
}
@keyframes float {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(-9px); }
}
.mascot.happy     { animation: bounce .55s cubic-bezier(.28, 1.6, .5, 1) 2; }
.mascot.annoyed   { animation: shake .45s ease-in-out 2; }
.mascot.impatient { animation: tremor .18s linear infinite; }

@keyframes bounce {
  0%, 100% { transform: translateY(0) scale(1); }
  40%      { transform: translateY(-22px) scale(1.05); }
}
@keyframes shake {
  0%, 100% { transform: translateX(0) rotate(0); }
  25%      { transform: translateX(-9px) rotate(-3deg); }
  75%      { transform: translateX(9px) rotate(3deg); }
}
@keyframes tremor {
  0%, 100% { transform: translate(0, 0); }
  25%      { transform: translate(-1.5px, 1px); }
  75%      { transform: translate(1.5px, -1px); }
}

/* 对话气泡（毛玻璃） */
.bubble {
  position: relative;
  background: rgba(255, 255, 255, .74);
  -webkit-backdrop-filter: blur(22px) saturate(180%);
  backdrop-filter: blur(22px) saturate(180%);
  border: 1px solid rgba(255, 255, 255, .85);
  border-radius: var(--r-md);
  padding: 11px 16px;
  font-size: 14.5px;
  line-height: 1.5;
  color: var(--text);
  max-width: 320px;
  text-align: center;
  margin-top: 12px;
  box-shadow: var(--sh-1);
  min-height: 20px;
}
.bubble::before {
  content: "";
  position: absolute;
  top: -7px;
  left: 50%;
  transform: translateX(-50%);
  border: 7px solid transparent;
  border-bottom-color: rgba(255, 255, 255, .85);
  border-top: 0;
}
.bubble.pop { animation: bubblePop .34s cubic-bezier(.28, 1.5, .5, 1); }
@keyframes bubblePop {
  0%   { transform: scale(.92); opacity: .5; }
  100% { transform: scale(1);   opacity: 1; }
}

.home-actions { width: 100%; margin-top: auto; padding-top: 18px; }
.home-meta {
  text-align: center;
  color: var(--text-2);
  font-size: 12.5px;
  margin-top: 13px;
  min-height: 20px;
  letter-spacing: -.1px;
}

/* ---------------- 按钮 ---------------- */
.btn {
  border: 0;
  border-radius: var(--r-md);
  font-family: inherit;
  font-size: 16px;
  font-weight: 600;
  padding: 13px 20px;
  cursor: pointer;
  transition: transform .14s ease, box-shadow .2s ease, opacity .14s ease;
  color: var(--text);
}
.btn:active { transform: scale(.976); }
.btn-primary {
  background: linear-gradient(180deg, #4A88DE 0%, var(--accent) 100%);
  color: #fff;
  box-shadow: 0 6px 18px rgba(59, 125, 216, .32), 0 1px 2px rgba(59, 125, 216, .3);
}
.btn-lg { width: 100%; padding: 16px; font-size: 17px; border-radius: 17px; }
.btn-ghost {
  background: transparent;
  border: 1px solid rgba(229, 100, 107, .38);
  color: var(--bad);
  width: 100%;
}

.icon-btn {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 50%;
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  color: var(--text-2);
  cursor: pointer;
  box-shadow: var(--sh-1);
  flex-shrink: 0;
}
.icon-btn svg { width: 16px; height: 16px; }
.icon-btn:active { transform: scale(.94); }

/* ---------------- 学习页 ---------------- */
.topbar-study { gap: 13px; }
.progress-bar {
  flex: 1;
  height: 6px;
  background: rgba(60, 60, 67, .10);
  border-radius: 999px;
  overflow: hidden;
}
.progress-inner {
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, var(--accent), #5B9BE8);
  border-radius: 999px;
  transition: width .35s cubic-bezier(.22, 1, .36, 1);
}
.study-count {
  font-size: 13px;
  color: var(--text-2);
  font-variant-numeric: tabular-nums;
  min-width: 42px;
  text-align: right;
  font-weight: 600;
}

.study-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

/* 卡片容器 */
.card {
  position: relative;
  flex: 1;
  min-height: 250px;
  cursor: pointer;
}

/* 正面：单词 */
.card-word-layer {
  position: absolute;
  inset: 0;
  background: var(--surface);
  border-radius: var(--r-lg);
  box-shadow: var(--sh-2);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 26px 22px;
  transition: opacity .3s ease, transform .35s cubic-bezier(.22, 1, .36, 1);
}
.card.flipped .card-word-layer {
  opacity: 0;
  transform: scale(.965);
  pointer-events: none;
}

.word {
  font-size: 38px;
  font-weight: 700;
  letter-spacing: -.8px;
  text-align: center;
  word-break: break-word;
  line-height: 1.15;
}
.phonetic {
  color: var(--text-2);
  font-size: 15.5px;
  margin-top: 10px;
  font-family: "SF Mono", ui-monospace, Menlo, monospace;
  letter-spacing: -.2px;
}
.hint {
  position: absolute;
  bottom: 18px;
  font-size: 12.5px;
  color: var(--text-3);
  letter-spacing: -.1px;
}

.speak-btn {
  background: var(--accent-soft);
  border: 0;
  color: var(--accent);
  border-radius: 50%;
  width: 50px;
  height: 50px;
  margin-top: 22px;
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: transform .14s ease, background .18s ease;
}
.speak-btn svg { width: 22px; height: 22px; }
.speak-btn:active { transform: scale(.9); background: rgba(59, 125, 216, .18); }
.speak-sm { width: 38px; height: 38px; margin: 0; flex-shrink: 0; }
.speak-sm svg { width: 17px; height: 17px; }

/* 反面：毛玻璃释义窗 */
.glass-window {
  position: absolute;
  inset: 0;
  border-radius: var(--r-lg);
  background: rgba(255, 255, 255, .58);
  -webkit-backdrop-filter: blur(28px) saturate(180%);
  backdrop-filter: blur(28px) saturate(180%);
  border: 1px solid rgba(255, 255, 255, .9);
  box-shadow: var(--sh-float);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  opacity: 0;
  transform: scale(.94) translateY(10px);
  pointer-events: none;
  transition: opacity .3s ease, transform .42s cubic-bezier(.22, 1.2, .36, 1);
}
.card.flipped .glass-window {
  opacity: 1;
  transform: none;
  pointer-events: auto;
}

.gw-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 16px 18px 12px;
  flex-shrink: 0;
  border-bottom: 1px solid rgba(255, 255, 255, .8);
}
.gw-word {
  font-size: 21px;
  font-weight: 700;
  letter-spacing: -.4px;
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.gw-scroll {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 4px 18px 18px;
}

.defs { width: 100%; }
.def-item {
  display: flex;
  gap: 9px;
  padding: 10px 0;
  border-bottom: 1px solid rgba(60, 60, 67, .08);
  font-size: 14.5px;
  line-height: 1.55;
}
.def-item:last-child { border-bottom: 0; }
.def-pos {
  flex-shrink: 0;
  color: var(--accent);
  font-weight: 700;
  font-size: 12.5px;
  padding-top: 2px;
  min-width: 42px;
  font-style: italic;
  letter-spacing: -.2px;
}
.def-text { color: var(--text); }

/* 显示中文按钮 */
.zh-toggle {
  width: 100%;
  margin-top: 14px;
  background: rgba(255, 255, 255, .7);
  border: 1px solid rgba(60, 60, 67, .10);
  border-radius: var(--r-sm);
  padding: 11px 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  color: var(--text-2);
  font-family: inherit;
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  transition: background .18s ease, color .18s ease, border-color .18s ease;
}
.zh-toggle:active { background: rgba(59, 125, 216, .10); }
.zh-toggle.open {
  color: var(--accent);
  background: var(--accent-soft);
  border-color: rgba(59, 125, 216, .22);
}
.zh-toggle-chev {
  width: 15px;
  height: 15px;
  transition: transform .28s cubic-bezier(.22, 1, .36, 1);
}
.zh-toggle.open .zh-toggle-chev { transform: rotate(180deg); }

/* 中文面板 */
.zh-panel {
  margin-top: 12px;
  padding: 14px 15px;
  border-radius: var(--r-md);
  background: rgba(255, 255, 255, .78);
  border: 1px solid rgba(59, 125, 216, .16);
  animation: zhReveal .34s cubic-bezier(.22, 1, .36, 1);
}
.zh-panel[hidden] { display: none; }
@keyframes zhReveal {
  from { opacity: 0; transform: translateY(-6px); }
  to   { opacity: 1; transform: none; }
}
.zh-line {
  font-size: 14.5px;
  line-height: 1.6;
  color: var(--text);
  display: flex;
  gap: 9px;
  padding: 3px 0;
}
.zh-pos {
  flex-shrink: 0;
  min-width: 42px;
  color: var(--text-3);
  font-size: 12.5px;
  font-style: italic;
  padding-top: 2px;
  letter-spacing: -.2px;
}

.tags { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 14px; }
.tag {
  font-size: 11px;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  border: 1px solid rgba(59, 125, 216, .18);
  font-weight: 600;
  letter-spacing: -.1px;
}
.tag.oxford {
  background: rgba(217, 154, 43, .11);
  color: var(--warn);
  border-color: rgba(217, 154, 43, .24);
}

/* 学习页吉祥物条 */
.mascot-strip {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 0 10px;
  flex-shrink: 0;
}
.mascot-sm {
  width: 54px;
  height: auto;
  flex-shrink: 0;
  filter: drop-shadow(0 6px 12px rgba(24, 39, 75, .14));
  animation: float 3.6s ease-in-out infinite;
}
.bubble-sm {
  margin: 0;
  text-align: left;
  font-size: 13.5px;
  padding: 9px 13px;
  max-width: none;
  flex: 1;
}
.bubble-sm::before {
  top: 50%;
  left: -7px;
  transform: translateY(-50%);
  border: 7px solid transparent;
  border-right-color: rgba(255, 255, 255, .85);
  border-left: 0;
}

/* 评分按钮 */
.grades {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  flex-shrink: 0;
  transition: opacity .28s ease, transform .28s ease;
}
.grade {
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text);
  border-radius: var(--r-md);
  padding: 12px 4px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  cursor: pointer;
  font-family: inherit;
  transition: transform .14s ease, box-shadow .18s ease;
  box-shadow: var(--sh-1);
}
.grade:active { transform: scale(.95); }
.grade span { font-size: 14px; font-weight: 700; letter-spacing: -.2px; }
.grade small { font-size: 10.5px; color: var(--text-3); }
.grade.g0 span { color: var(--bad); }
.grade.g1 span { color: var(--warn); }
.grade.g2 span { color: var(--ok); }
.grade.g3 span { color: var(--easy); }

.grades.hidden { opacity: 0; pointer-events: none; transform: translateY(6px); }

/* ---------------- 结算页 ---------------- */
.done-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  text-align: center;
}
.bubble-done { max-width: 340px; margin-top: 4px; }
.done-stats {
  display: flex;
  gap: 26px;
  color: var(--text-2);
  font-size: 12.5px;
  margin-top: 4px;
}
.done-stats b {
  display: block;
  color: var(--text);
  font-size: 23px;
  font-weight: 700;
  letter-spacing: -.5px;
  font-variant-numeric: tabular-nums;
}

/* ---------------- 统计页 ---------------- */
.page-body { flex: 1; }
.section-title {
  font-size: 13px;
  color: var(--text-2);
  font-weight: 650;
  margin: 26px 0 10px;
  letter-spacing: -.1px;
}

.stat-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 11px; }
.stat-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: 16px;
  box-shadow: var(--sh-1);
}
.stat-card .k { font-size: 12.5px; color: var(--text-2); }
.stat-card .v {
  font-size: 27px;
  font-weight: 700;
  margin-top: 3px;
  letter-spacing: -.6px;
  font-variant-numeric: tabular-nums;
}

.chart {
  display: flex;
  align-items: flex-end;
  gap: 5px;
  height: 118px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: 13px;
  box-shadow: var(--sh-1);
}
.chart-col {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  height: 100%;
  justify-content: flex-end;
}
.chart-bar {
  width: 100%;
  background: linear-gradient(180deg, #5B9BE8 0%, var(--accent) 100%);
  border-radius: 4px 4px 2px 2px;
  min-height: 3px;
  transition: height .45s cubic-bezier(.22, 1, .36, 1);
}
.chart-lbl { font-size: 9.5px; color: var(--text-3); }

.lib-progress { display: flex; flex-direction: column; gap: 14px; }
.lib-row .lib-head {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  margin-bottom: 7px;
  color: var(--text);
}
.lib-row .lib-head .n { color: var(--text-2); font-variant-numeric: tabular-nums; }
.lib-track {
  height: 8px;
  background: rgba(60, 60, 67, .09);
  border-radius: 999px;
  overflow: hidden;
}
.lib-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), #5B9BE8);
  border-radius: 999px;
  transition: width .55s cubic-bezier(.22, 1, .36, 1);
}

/* ---------------- 设置页 ---------------- */
.setting {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: 16px;
  margin-bottom: 11px;
  box-shadow: var(--sh-1);
}
.setting > label {
  display: block;
  font-size: 14.5px;
  font-weight: 600;
  margin-bottom: 12px;
  letter-spacing: -.2px;
}
.setting-ctl { display: flex; align-items: center; gap: 14px; }
.setting-toggle { display: flex; align-items: center; justify-content: space-between; }
.setting-toggle > label { margin: 0; }

input[type="range"] {
  flex: 1;
  -webkit-appearance: none;
  appearance: none;
  height: 5px;
  background: rgba(60, 60, 67, .12);
  border-radius: 999px;
  outline: none;
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 23px;
  height: 23px;
  border-radius: 50%;
  background: #fff;
  cursor: pointer;
  box-shadow: 0 1px 4px rgba(24, 39, 75, .22), 0 0 0 1px rgba(60, 60, 67, .06);
}
output {
  font-size: 14.5px;
  font-weight: 700;
  min-width: 46px;
  text-align: right;
  font-variant-numeric: tabular-nums;
  color: var(--accent);
}

.seg {
  display: flex;
  gap: 5px;
  background: rgba(60, 60, 67, .06);
  padding: 3px;
  border-radius: 12px;
}
.seg-wrap { flex-wrap: wrap; }
.seg button {
  flex: 1;
  min-width: 66px;
  padding: 9px 6px;
  border-radius: 9px;
  border: 0;
  background: transparent;
  color: var(--text-2);
  font-family: inherit;
  font-size: 13.5px;
  cursor: pointer;
  transition: all .18s ease;
  font-weight: 600;
}
.seg button.active {
  background: var(--surface);
  color: var(--accent);
  box-shadow: 0 1px 3px rgba(24, 39, 75, .12);
}

.switch {
  -webkit-appearance: none;
  appearance: none;
  width: 51px;
  height: 31px;
  background: rgba(60, 60, 67, .16);
  border-radius: 999px;
  position: relative;
  cursor: pointer;
  transition: background .22s ease;
  flex-shrink: 0;
}
.switch::after {
  content: "";
  position: absolute;
  width: 27px;
  height: 27px;
  border-radius: 50%;
  background: #fff;
  top: 2px;
  left: 2px;
  box-shadow: 0 1px 3px rgba(24, 39, 75, .2);
  transition: transform .22s cubic-bezier(.22, 1, .36, 1);
}
.switch:checked { background: var(--ok); }
.switch:checked::after { transform: translateX(20px); }

.time-input {
  background: rgba(60, 60, 67, .06);
  border: 0;
  color: var(--text);
  border-radius: 10px;
  padding: 9px 13px;
  font-family: inherit;
  font-size: 15px;
  font-weight: 600;
}
.danger-zone { background: transparent; border-style: dashed; box-shadow: none; }
.version-note {
  text-align: center;
  color: var(--text-3);
  font-size: 12px;
  margin: 20px 0 0;
}

/* ---------------- 底部导航 ---------------- */
.tabbar {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  background: rgba(255, 255, 255, .76);
  -webkit-backdrop-filter: blur(26px) saturate(180%);
  backdrop-filter: blur(26px) saturate(180%);
  border-top: 1px solid rgba(60, 60, 67, .10);
  padding: 8px 0 calc(8px + var(--safe-bottom));
  z-index: 20;
}
.tab {
  flex: 1;
  background: transparent;
  border: 0;
  color: var(--text-3);
  font-family: inherit;
  font-size: 10.5px;
  font-weight: 600;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 4px 0;
  cursor: pointer;
  transition: color .2s ease;
  letter-spacing: -.1px;
}
.tab .ti {
  width: 25px;
  height: 25px;
  transition: transform .25s cubic-bezier(.22, 1.4, .36, 1);
}
.tab.active { color: var(--accent); }
.tab.active .ti { transform: translateY(-1px); }

/* 首页图标：整体轻弹 + 门闪烁 */
.tab.active .ti-home { animation: homePop .55s cubic-bezier(.3, 1.5, .5, 1); }
@keyframes homePop {
  0%   { transform: translateY(-1px) scale(1); }
  45%  { transform: translateY(-4px) scale(1.09); }
  100% { transform: translateY(-1px) scale(1); }
}
.tab.active .ti-home .door { animation: doorGlow .6s ease; }
@keyframes doorGlow {
  0%, 100% { opacity: 1; }
  50%      { opacity: .35; }
}

/* 统计图标：柱子依次长高 */
.ti-stats .bar { transform-box: fill-box; transform-origin: bottom; }
.tab.active .ti-stats .bar1 { animation: barGrow .6s cubic-bezier(.3, 1.4, .5, 1) 0s    backwards; }
.tab.active .ti-stats .bar2 { animation: barGrow .6s cubic-bezier(.3, 1.4, .5, 1) .08s  backwards; }
.tab.active .ti-stats .bar3 { animation: barGrow .6s cubic-bezier(.3, 1.4, .5, 1) .16s  backwards; }
@keyframes barGrow {
  0%   { transform: scaleY(.15); }
  100% { transform: scaleY(1); }
}

/* 设置图标：旋钮错位滑动 */
.ti-settings .knob { transform-box: fill-box; }
.tab.active .ti-settings .knob2 { animation: knobSlide 1s cubic-bezier(.3, 1.3, .5, 1); }
.tab.active .ti-settings .knob4 { animation: knobSlide2 1s cubic-bezier(.3, 1.3, .5, 1); }
@keyframes knobSlide {
  0%, 100% { transform: translateX(0); }
  40%      { transform: translateX(2.5px); }
}
@keyframes knobSlide2 {
  0%, 100% { transform: translateX(0); }
  40%      { transform: translateX(-2.5px); }
}

/* ===========================================================
   每日复习 / 默写考试
   =========================================================== */

/* 首页两个次级入口 */
.home-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 10px;
}
.btn-soft {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  background: var(--surface);
  border: 1px solid var(--line);
  color: var(--accent);
  box-shadow: var(--sh-1);
  padding: 13px 10px;
  font-size: 14.5px;
  border-radius: var(--r-md);
}
.btn-soft svg { width: 17px; height: 17px; }
.btn-soft:active { background: var(--accent-soft); }

/* 角色可点 */
.mascot { cursor: pointer; }
.mascot.poked { animation: pokeBounce .6s cubic-bezier(.28, 1.7, .4, 1); }
@keyframes pokeBounce {
  0%   { transform: scale(1) translateY(0); }
  30%  { transform: scale(.90) translateY(4px); }
  60%  { transform: scale(1.07) translateY(-14px); }
  100% { transform: scale(1) translateY(0); }
}
.mascot.spin { animation: spinOnce .8s cubic-bezier(.3, 1, .4, 1); }
@keyframes spinOnce {
  0%   { transform: rotate(0) scale(1); }
  50%  { transform: rotate(180deg) scale(1.06); }
  100% { transform: rotate(360deg) scale(1); }
}
.mascot.wiggle { animation: wiggle .7s ease-in-out; }
@keyframes wiggle {
  0%, 100% { transform: rotate(0); }
  20%      { transform: rotate(-7deg); }
  45%      { transform: rotate(6deg); }
  70%      { transform: rotate(-3deg); }
}

/* ---------------- 考试 ---------------- */
.exam-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  gap: 12px;
}

.exam-card {
  flex: 1;
  min-height: 200px;
  background: var(--surface);
  border-radius: var(--r-lg);
  box-shadow: var(--sh-2);
  padding: 20px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}
.exam-label {
  font-size: 12px;
  color: var(--text-3);
  letter-spacing: .4px;
  text-transform: uppercase;
  margin-bottom: 14px;
}
.exam-defs { display: flex; flex-direction: column; }

.exam-input-row { flex-shrink: 0; }
.exam-input {
  width: 100%;
  background: var(--surface);
  border: 1.5px solid var(--line);
  border-radius: var(--r-md);
  padding: 15px 18px;
  font-family: -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
  font-size: 20px;
  font-weight: 600;
  letter-spacing: .3px;
  color: var(--text);
  outline: none;
  transition: border-color .18s ease, box-shadow .18s ease;
  box-shadow: var(--sh-1);
}
.exam-input::placeholder { color: var(--text-3); font-weight: 400; font-size: 16px; letter-spacing: 0; }
.exam-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px rgba(59, 125, 216, .12);
}
.exam-input.correct { border-color: var(--ok); box-shadow: 0 0 0 4px rgba(52, 169, 123, .13); }
.exam-input.wrong   { border-color: var(--bad); box-shadow: 0 0 0 4px rgba(229, 100, 107, .13); }

.exam-note {
  text-align: center;
  font-size: 12.5px;
  color: var(--text-3);
  min-height: 18px;
  flex-shrink: 0;
}
.exam-note.ok  { color: var(--ok); font-weight: 600; }
.exam-note.bad { color: var(--bad); font-weight: 600; }

/* ---------------- 考试报告 ---------------- */
.report-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding-top: 4px;
}
.score-card {
  margin-top: 6px;
  display: flex;
  flex-direction: column;
  align-items: center;
}
.score-num {
  font-size: 62px;
  font-weight: 800;
  letter-spacing: -2px;
  line-height: 1;
  background: linear-gradient(180deg, #4A88DE, var(--accent));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  font-variant-numeric: tabular-nums;
}
.score-sub { font-size: 13px; color: var(--text-2); margin-top: 6px; }

.report-stats {
  display: flex;
  gap: 26px;
  color: var(--text-2);
  font-size: 12.5px;
  margin-top: 14px;
}
.report-stats b {
  display: block;
  color: var(--text);
  font-size: 21px;
  font-weight: 700;
  letter-spacing: -.4px;
  font-variant-numeric: tabular-nums;
}

.report-list {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 9px;
  text-align: left;
  margin-bottom: 6px;
}
.report-item {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: 13px 15px;
  box-shadow: var(--sh-1);
}
.report-item .ri-head {
  display: flex;
  align-items: baseline;
  gap: 9px;
  margin-bottom: 5px;
}
.report-item .ri-word {
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -.3px;
}
.report-item .ri-phon {
  font-size: 12px;
  color: var(--text-3);
  font-family: "SF Mono", ui-monospace, Menlo, monospace;
}
.report-item .ri-row {
  font-size: 13px;
  line-height: 1.55;
  color: var(--text-2);
  display: flex;
  gap: 8px;
}
.report-item .ri-tag {
  flex-shrink: 0;
  font-size: 11px;
  font-weight: 700;
  min-width: 42px;
  padding-top: 1px;
}
.report-item .ri-tag.yours { color: var(--bad); }
.report-item .ri-tag.def   { color: var(--accent); }
.report-item .ri-zh { color: var(--text-3); font-size: 12.5px; margin-top: 4px; }

.report-empty {
  width: 100%;
  background: rgba(52, 169, 123, .08);
  border: 1px solid rgba(52, 169, 123, .22);
  border-radius: var(--r-md);
  padding: 18px;
  color: var(--ok);
  font-size: 14px;
  font-weight: 600;
}
.report-actions {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 18px;
  padding-bottom: calc(var(--safe-bottom) + 6px);
}

/* ---------------- 考试历史 ---------------- */
.exam-history {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: 6px 15px;
  box-shadow: var(--sh-1);
}
.exam-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 0;
  border-bottom: 1px solid rgba(60, 60, 67, .08);
  font-size: 13.5px;
}
.exam-row:last-child { border-bottom: 0; }
.er-date { color: var(--text-3); font-size: 12.5px; min-width: 84px; }
.er-detail { color: var(--text-2); font-variant-numeric: tabular-nums; flex: 1; }
.er-score {
  font-size: 17px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  letter-spacing: -.3px;
}
.er-score.good { color: var(--ok); }
.er-score.mid  { color: var(--warn); }
.er-score.poor { color: var(--bad); }
.exam-empty {
  padding: 16px 0;
  color: var(--text-3);
  font-size: 13px;
  text-align: center;
}

/* ---------------- Toast ---------------- */
.toast {
  position: fixed;
  left: 50%;
  bottom: calc(102px + var(--safe-bottom));
  transform: translateX(-50%) translateY(14px);
  background: rgba(28, 28, 30, .92);
  -webkit-backdrop-filter: blur(18px);
  backdrop-filter: blur(18px);
  color: #fff;
  padding: 12px 22px;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 500;
  opacity: 0;
  pointer-events: none;
  transition: opacity .26s ease, transform .26s ease;
  z-index: 100;
  max-width: 84vw;
  text-align: center;
  box-shadow: 0 10px 30px rgba(24, 39, 75, .22);
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

::-webkit-scrollbar { width: 0; height: 0; }

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