/* ============================================================
 * style.css — WordQuest 视觉系统 v2
 * 设计语言：明亮游戏化（Duolingo 式）
 *   1. 白底 + 大量负空间，卡片用粗边框 + 底部 4px 硬阴影模拟"可按的实体"
 *   2. 主色是活力绿，功能色只有 4 个（绿/黄/红/蓝），不用灰阶铺满
 *   3. 大圆角(16~24) + 粗字重(700~900)，字号阶梯拉开
 *   4. 图标一律 SVG，不用 emoji
 * ============================================================ */

:root {
  /* 明亮底 */
  --bg: #ffffff;
  --bg-soft: #f7f9fc;
  --bg-sky: #e8f4ff;
  --line: #e5e9f0;
  --line-strong: #d4dae4;

  /* 文字 */
  --ink: #1f2937;
  --ink-2: #4b5563;
  --ink-3: #9ca3af;

  /* 主色 —— 活力绿 */
  --green: #58cc02;
  --green-d: #46a302;
  --green-l: #d7ffb8;
  --green-bg: #f0fdf0;

  /* 功能色 */
  --blue: #1cb0f6;
  --blue-d: #1899d6;
  --blue-l: #ddf4ff;
  --gold: #ffc800;
  --gold-d: #e5a500;
  --gold-l: #fff5cc;
  --red: #ff4b4b;
  --red-d: #e03e3e;
  --red-l: #ffe4e4;
  --purple: #ce82ff;

  /* 卡片硬阴影（游戏化关键：让按钮像实体块） */
  --sh: 0 4px 0 var(--line-strong);
  --sh-green: 0 4px 0 var(--green-d);
  --sh-blue: 0 4px 0 var(--blue-d);
  --sh-gold: 0 4px 0 var(--gold-d);
  --sh-red: 0 4px 0 var(--red-d);

  --r-sm: 12px;
  --r: 16px;
  --r-lg: 22px;
}

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

html, body {
  margin: 0; padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: "Nunito", -apple-system, "PingFang SC", "Microsoft YaHei", "Segoe UI", system-ui, sans-serif;
  min-height: 100%;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior-y: none;
}

#app {
  max-width: 560px;
  margin: 0 auto;
  padding: 0 16px 104px;
  min-height: 100vh;
}

/* SVG 图标统一尺寸 */
.ico { display: inline-flex; align-items: center; justify-content: center; }
.ico svg { width: 1em; height: 1em; display: block; }

.mono { font-family: ui-monospace, "SF Mono", Consolas, monospace; }

/* 页面切换 */
.fade-out { opacity: 0; transition: .08s; }
.fade-in { animation: fadeIn .22s ease-out; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* ============================================================
   按钮 —— 3D 可按压实体块
   ============================================================ */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 2px solid var(--line-strong);
  background: var(--bg);
  color: var(--ink);
  padding: 12px 20px;
  border-radius: var(--r);
  font-size: 15px; font-weight: 800;
  font-family: inherit;
  cursor: pointer;
  box-shadow: var(--sh);
  transition: transform .06s, box-shadow .06s, background .14s;
  user-select: none;
}
.btn:hover { background: var(--bg-soft); }
.btn:active { transform: translateY(4px); box-shadow: 0 0 0 var(--line-strong); }

.btn-primary {
  background: var(--green); border-color: var(--green-d);
  color: #fff; box-shadow: var(--sh-green);
  text-shadow: 0 1px 0 rgba(0,0,0,.12);
}
.btn-primary:hover { background: #61d903; }
.btn-primary:active { box-shadow: 0 0 0 var(--green-d); }

.btn-blue { background: var(--blue); border-color: var(--blue-d); color: #fff; box-shadow: var(--sh-blue); }
.btn-blue:hover { background: #2ab8f8; }
.btn-gold { background: var(--gold); border-color: var(--gold-d); color: #6b4a00; box-shadow: var(--sh-gold); }
.btn-danger { background: var(--red-l); border-color: #ffb3b3; color: var(--red-d); box-shadow: 0 4px 0 #ffb3b3; }

.btn-lg { padding: 16px 26px; font-size: 17px; border-radius: var(--r-lg); }
.btn-sm { padding: 8px 14px; font-size: 13px; border-radius: 11px; box-shadow: 0 3px 0 var(--line-strong); }
.btn-wide { width: 100%; }
.btn:disabled { opacity: .45; box-shadow: none; transform: none; cursor: not-allowed; }

.btn-ghost {
  display: inline-flex; align-items: center; justify-content: center;
  background: none; border: none; color: var(--ink-3);
  font-size: 22px; padding: 6px; cursor: pointer; font-family: inherit;
  transition: color .14s;
}
.btn-ghost:hover { color: var(--ink); }

/* ============================================================
   首页
   ============================================================ */
.hero {
  padding: 26px 4px 20px;
  text-align: center;
}
.hero-mascot { width: 92px; height: 92px; margin: 0 auto 10px; }
.hero h1 {
  margin: 0; font-size: 32px; font-weight: 900;
  letter-spacing: -.6px; color: var(--ink);
}
.hero h1 em { font-style: normal; color: var(--green); }
.hero-sub { margin: 8px 0 0; color: var(--ink-3); font-size: 14px; font-weight: 600; }

.hero-stats {
  display: flex; justify-content: center; gap: 8px;
  margin-top: 18px; flex-wrap: wrap;
}
.stat-pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 14px; border-radius: 999px;
  font-size: 13px; font-weight: 800;
  background: var(--bg-soft); border: 2px solid var(--line);
  color: var(--ink-2);
}
.stat-pill .ico { font-size: 16px; }
.stat-pill.fire { background: #fff7ed; border-color: #fed7aa; color: #ea580c; }
.stat-pill.fire .ico { color: #f97316; }
.stat-pill.gold { background: var(--gold-l); border-color: #ffe58a; color: #a16207; }
.stat-pill.gold .ico { color: var(--gold-d); }
.stat-pill.blue { background: var(--blue-l); border-color: #b8e6ff; color: var(--blue-d); }
.stat-pill.blue .ico { color: var(--blue); }

/* 主行动卡 */
.cta-card {
  display: flex; align-items: center; gap: 14px;
  width: 100%; text-align: left;
  background: linear-gradient(135deg, #f0fdf0, #e6fbff);
  border: 2px solid #cdeec0; border-radius: var(--r-lg);
  padding: 18px; margin-top: 20px;
  box-shadow: var(--sh-green);
  cursor: pointer; font-family: inherit; color: var(--ink);
  transition: transform .1s;
}
.cta-card:active { transform: translateY(4px); box-shadow: 0 0 0 var(--green-d); }
.cta-num {
  flex: 0 0 auto; width: 62px; height: 62px; border-radius: 18px;
  background: var(--green); color: #fff;
  display: grid; place-items: center;
  font-size: 26px; font-weight: 900;
  box-shadow: inset 0 -4px 0 rgba(0,0,0,.14);
}
.cta-body { flex: 1; min-width: 0; }
.cta-title { font-size: 17px; font-weight: 900; margin-bottom: 3px; }
.cta-sub { font-size: 13px; color: var(--ink-3); font-weight: 600; }
.cta-arrow { color: var(--green-d); font-size: 22px; }

/* deck 卡片 */
.sec-title {
  display: flex; align-items: center; gap: 7px;
  font-size: 13px; font-weight: 900; color: var(--ink-3);
  text-transform: uppercase; letter-spacing: .8px;
  margin: 28px 4px 12px;
}
.sec-title .ico { font-size: 17px; color: var(--ink-3); flex: 0 0 auto; }
.sec-title .ico svg { stroke-width: 2.2; }

.deck-card {
  display: block; width: 100%; text-align: left;
  background: var(--bg); border: 2px solid var(--line);
  border-radius: var(--r-lg); padding: 16px;
  margin-bottom: 12px; cursor: pointer;
  color: var(--ink); font-family: inherit;
  box-shadow: var(--sh);
  transition: transform .1s, box-shadow .1s, border-color .14s;
}
.deck-card:hover { border-color: var(--line-strong); background: var(--bg-soft); }
.deck-card:active { transform: translateY(4px); box-shadow: 0 0 0 var(--line-strong); }

.deck-head { display: flex; align-items: center; gap: 12px; }
.deck-badge {
  flex: 0 0 auto; width: 46px; height: 46px; border-radius: 14px;
  display: grid; place-items: center; font-size: 15px; font-weight: 900; color: #fff;
}
.deck-badge.junior { background: linear-gradient(135deg, #58cc02, #46a302); box-shadow: inset 0 -3px 0 rgba(0,0,0,.15); }
.deck-badge.senior { background: linear-gradient(135deg, #1cb0f6, #1899d6); box-shadow: inset 0 -3px 0 rgba(0,0,0,.15); }
.deck-title { flex: 1; min-width: 0; }
.deck-title h3 { margin: 0; font-size: 17px; font-weight: 900; }
.deck-title p { margin: 2px 0 0; font-size: 12px; color: var(--ink-3); font-weight: 600; }
.deck-count {
  font-size: 12px; font-weight: 800; color: var(--ink-3);
  background: var(--bg-soft); padding: 4px 10px; border-radius: 999px;
}

.progress-track {
  height: 14px; background: var(--line); border-radius: 999px;
  overflow: hidden; margin-top: 12px; position: relative;
}
.progress-track i {
  display: block; height: 100%; border-radius: 999px;
  background: linear-gradient(90deg, #7ee62e, var(--green));
  transition: width .55s cubic-bezier(.2,.8,.3,1);
  box-shadow: inset 0 -3px 0 rgba(0,0,0,.1);
}
.progress-track.thin { height: 10px; }

.deck-foot { margin-top: 8px; font-size: 12px; color: var(--ink-3); font-weight: 700; }
.foot-note {
  font-size: 12px; color: var(--ink-3); text-align: center;
  padding: 26px 12px 22px; line-height: 1.75; font-weight: 600;
}

/* ============================================================
   地图（蛇形关卡路径）
   ============================================================ */
.map-header {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 0 6px;
}
.map-header h1 { margin: 0; font-size: 20px; font-weight: 900; flex: 1; }

.pet-strip {
  display: flex; align-items: center; gap: 12px;
  background: linear-gradient(135deg, #f0fdf0, #f7fff0);
  border: 2px solid #d8f0c4; border-radius: var(--r-lg);
  padding: 12px 14px; margin: 8px 0 4px;
}
.pet-strip.warn { background: linear-gradient(135deg, #fff7ed, #fffbeb); border-color: #fed7aa; }
.pet-strip.critical { background: linear-gradient(135deg, #fef2f2, #fff7f7); border-color: #fecaca; }
.pet-plant { flex: 0 0 auto; width: 66px; height: 66px; }
.plant { width: 100%; height: 100%; display: block; }
.plant.is-wilted .pl-body { transform: rotate(var(--rot)); transform-origin: 50% 86px; }
.plant.is-dead { filter: saturate(.35); }
.pet-info { flex: 1; min-width: 0; }
.pet-top { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 800; }
.pet-top .ico { font-size: 14px; color: #ef4444; }
.pet-top .streak { margin-left: auto; color: #ea580c; display: inline-flex; align-items: center; gap: 4px; }
.pet-top .streak .ico { color: #f97316; }
.pet-health-track { height: 9px; background: #e8f0e0; border-radius: 999px; margin: 7px 0 5px; overflow: hidden; }
.pet-health-track i { display: block; height: 100%; border-radius: 999px; background: linear-gradient(90deg, #a3e635, #65d600); transition: width .5s; }
.pet-mood { font-size: 11px; color: var(--ink-3); font-weight: 700; }

/* 关卡路径 */
.path { position: relative; padding: 18px 0 10px; }
.path-svg { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }

.level-row {
  position: relative; display: flex; align-items: center;
  min-height: 96px; padding: 6px 0;
}
.level-row.center { justify-content: center; }
.level-row.left { justify-content: flex-start; padding-left: 12%; }
.level-row.right { justify-content: flex-end; padding-right: 12%; }

.level-node {
  position: relative; display: flex; flex-direction: column;
  align-items: center; gap: 8px;
  background: none; border: none; padding: 0;
  cursor: pointer; font-family: inherit; color: var(--ink);
}
.level-node:disabled { cursor: not-allowed; }

.node-btn {
  position: relative;
  width: 76px; height: 76px; border-radius: 50%;
  display: grid; place-items: center;
  font-size: 24px; font-weight: 900; color: #fff;
  background: linear-gradient(180deg, #7ee62e, var(--green));
  border: none; cursor: pointer;
  box-shadow: 0 6px 0 var(--green-d), inset 0 2px 0 rgba(255,255,255,.35);
  transition: transform .08s, box-shadow .08s, filter .14s;
}
.level-node:not(:disabled):hover .node-btn { filter: brightness(1.06); }
.level-node:not(:disabled):active .node-btn {
  transform: translateY(6px);
  box-shadow: 0 0 0 var(--green-d), inset 0 2px 0 rgba(255,255,255,.35);
}
/* 已通关 */
.level-node.cleared .node-btn {
  background: linear-gradient(180deg, #ffd93d, var(--gold));
  color: #6b4a00;
  box-shadow: 0 6px 0 var(--gold-d), inset 0 2px 0 rgba(255,255,255,.45);
}
/* 锁定 */
.level-node.locked .node-btn {
  background: #e5e9f0; color: var(--ink-3);
  box-shadow: 0 6px 0 #cdd4e0, inset 0 2px 0 rgba(255,255,255,.6);
}
.level-node.locked .node-btn .ico { font-size: 26px; }
/* 当前可打（呼吸圈） */
.level-node.current .node-btn::before {
  content: ""; position: absolute; inset: -9px;
  border-radius: 50%; border: 3px solid var(--green);
  opacity: .35; animation: breathe 1.9s ease-in-out infinite;
}
@keyframes breathe {
  0%, 100% { transform: scale(1); opacity: .35; }
  50% { transform: scale(1.1); opacity: .1; }
}

.node-label {
  font-size: 12px; font-weight: 800; color: var(--ink-2);
  max-width: 110px; text-align: center; line-height: 1.3;
}
.node-sub { font-size: 10px; font-weight: 700; color: var(--ink-3); }
.level-node.locked .node-label { color: var(--ink-3); }

/* 关卡小进度环 */
.node-ring {
  position: absolute; inset: -5px; border-radius: 50%;
  transform: rotate(-90deg);
}
.node-ring circle { fill: none; stroke-width: 4; stroke-linecap: round; }
.node-ring .bg { stroke: var(--line-strong); }
.node-ring .fg { stroke: var(--gold); transition: stroke-dasharray .5s; }

/* ============================================================
   学习页
   ============================================================ */
.learn-top {
  display: flex; align-items: center; gap: 14px;
  padding: 14px 0 10px;
}
.learn-top .btn-ghost { font-size: 24px; }
.learn-progress {
  flex: 1; height: 16px; background: var(--line);
  border-radius: 999px; overflow: hidden; position: relative;
}
.learn-progress i {
  display: block; height: 100%; border-radius: 999px;
  background: linear-gradient(90deg, #7ee62e, var(--green));
  transition: width .4s cubic-bezier(.2,.8,.3,1);
  box-shadow: inset 0 -4px 0 rgba(0,0,0,.09);
}
.learn-progress i::after {
  content: ""; position: absolute; top: 3px; left: 6px; right: 6px; height: 4px;
  border-radius: 999px; background: rgba(255,255,255,.4);
}
.learn-heart { display: inline-flex; align-items: center; gap: 4px; font-size: 14px; font-weight: 900; color: var(--red); }
.learn-heart .ico { font-size: 18px; }

.card-stage { min-height: 340px; padding-top: 8px; }
/* 内容少时靠上，但不要顶到进度条；末屏（结算）单独处理 */
.learn-screen .card-stage { display: flex; flex-direction: column; }

.word-badge { display: flex; gap: 6px; justify-content: center; margin-bottom: 14px; }
.wb-stage, .wb-preview, .wb-new {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 11px; font-weight: 900; padding: 5px 11px; border-radius: 999px;
  letter-spacing: .3px;
}
.wb-new { background: var(--blue-l); color: var(--blue-d); border: 2px solid #b8e6ff; }
.wb-stage { background: var(--green-bg); color: var(--green-d); border: 2px solid #cdeec0; }
.wb-preview { background: var(--gold-l); color: #a16207; border: 2px solid #ffe58a; }

.flash-card {
  background: var(--bg); border: 2px solid var(--line);
  border-radius: 26px; padding: 36px 22px; text-align: center;
  box-shadow: var(--sh);
  animation: cardIn .28s cubic-bezier(.2,.8,.3,1);
}
@keyframes cardIn { from { opacity: 0; transform: scale(.95) translateY(10px); } }
.fc-word {
  font-size: 42px; font-weight: 900; letter-spacing: -.8px;
  word-break: break-word; color: var(--ink); line-height: 1.15;
}
.fc-phon { font-size: 14px; color: var(--ink-3); margin-top: 10px; font-weight: 700; }
.fc-tap-hint {
  margin-top: 24px; display: inline-flex; align-items: center; gap: 6px;
  font-size: 13px; color: var(--ink-3); font-weight: 700;
  padding: 8px 16px; border-radius: 999px; background: var(--bg-soft);
}
.fc-tap-hint .ico { font-size: 16px; }

/* 卡片背面信息 */
.back-info {
  margin-top: 16px; background: var(--bg-soft);
  border: 2px solid var(--line); border-radius: var(--r-lg); padding: 16px;
  animation: fadeIn .26s ease-out;
}
.bi-row { display: flex; gap: 10px; margin-bottom: 11px; font-size: 13px; align-items: flex-start; }
.bi-row:last-child { margin-bottom: 0; }
.bi-tag {
  flex: 0 0 auto; display: inline-flex; align-items: center; gap: 4px;
  font-size: 10px; font-weight: 900; padding: 4px 9px;
  border-radius: 7px; letter-spacing: .4px;
  background: var(--blue-l); color: var(--blue-d); border: 2px solid #b8e6ff;
}
.bi-tag.hook { background: var(--gold-l); color: #a16207; border-color: #ffe58a; }
.bi-text { color: var(--ink); line-height: 1.55; font-weight: 600; }

.bi-ex { border-top: 2px dashed var(--line); padding-top: 13px; margin-top: 13px; }
.ex-kind {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 10px; font-weight: 900; padding: 3px 9px; border-radius: 6px;
  background: #f3e8ff; color: #9333ea; border: 2px solid #e9d5ff;
}
.ex-en {
  margin: 9px 0 5px; font-size: 15.5px; line-height: 1.6;
  color: var(--ink); font-weight: 700;
}
.ex-zh { margin: 0; font-size: 13px; color: var(--ink-3); line-height: 1.5; font-weight: 600; }

/* 选择题 */
.quiz-prompt { text-align: center; margin: 4px 0 22px; }
.qp-word { font-size: 38px; font-weight: 900; letter-spacing: -.6px; line-height: 1.2; }
.qp-word.zh { font-size: 30px; }
.qp-sub { font-size: 13px; color: var(--ink-3); margin-top: 10px; font-weight: 700; }
.qp-hint {
  display: inline-flex; gap: 10px; align-items: center;
  font-size: 13px; color: var(--ink-3); margin-top: 12px;
  background: var(--bg-soft); padding: 8px 16px; border-radius: 999px;
  font-weight: 800; letter-spacing: 2px;
}

.options { display: grid; gap: 11px; }
.option {
  position: relative; display: flex; align-items: center; gap: 12px;
  padding: 15px 16px; border-radius: var(--r);
  background: var(--bg); border: 2px solid var(--line);
  color: var(--ink); font-size: 16px; font-weight: 700;
  text-align: left; cursor: pointer; font-family: inherit;
  box-shadow: var(--sh);
  transition: transform .08s, box-shadow .08s, border-color .14s, background .14s;
}
.option:hover:not(:disabled) { border-color: var(--line-strong); background: var(--bg-soft); }
.option:active:not(:disabled) { transform: translateY(4px); box-shadow: 0 0 0 var(--line-strong); }
.option:disabled { cursor: default; }

.opt-key {
  flex: 0 0 auto; width: 28px; height: 28px; border-radius: 9px;
  display: grid; place-items: center;
  font-size: 12px; font-weight: 900; color: var(--ink-3);
  background: var(--bg-soft); border: 2px solid var(--line);
}
.opt-text { flex: 1; min-width: 0; }
.opt-mark { flex: 0 0 auto; font-size: 19px; display: none; }

.option.right {
  background: var(--green-bg); border-color: var(--green);
  color: #2f7a00; box-shadow: 0 4px 0 var(--green-d);
}
.option.right .opt-key { background: var(--green); border-color: var(--green-d); color: #fff; }
.option.right .opt-mark { display: block; color: var(--green); }
.option.wrong {
  background: var(--red-l); border-color: var(--red);
  color: #b91c1c; box-shadow: 0 4px 0 var(--red-d);
}
.option.wrong .opt-key { background: var(--red); border-color: var(--red-d); color: #fff; }
.option.wrong .opt-mark { display: block; color: var(--red); }
.option.compact { padding: 13px 14px; font-size: 15px; }

/* 拼写输入 */
.type-input {
  width: 100%; padding: 18px;
  font-size: 22px; font-weight: 800; text-align: center;
  background: var(--bg); border: 2px solid var(--line);
  border-radius: var(--r); color: var(--ink); font-family: inherit;
  outline: none; transition: border-color .14s, background .14s;
  box-shadow: var(--sh);
  letter-spacing: 1px;
}
.type-input::placeholder { color: #cbd5e1; font-weight: 600; letter-spacing: 0; }
.type-input:focus { border-color: var(--blue); box-shadow: 0 4px 0 var(--blue-d); }
.type-input.right { border-color: var(--green); background: var(--green-bg); box-shadow: 0 4px 0 var(--green-d); }
.type-input.wrong { border-color: var(--red); background: var(--red-l); box-shadow: 0 4px 0 var(--red-d); }

.answer-reveal {
  margin-top: 16px; text-align: center;
  padding: 14px; border-radius: var(--r);
  font-size: 15px; font-weight: 800;
}
.answer-reveal.ok { background: var(--green-bg); color: var(--green-d); border: 2px solid #cdeec0; }
.answer-reveal.no { background: var(--red-l); color: #b91c1c; border: 2px solid #ffb3b3; }
.answer-reveal b { font-size: 19px; margin-left: 6px; }

/* 底部作答栏 */
.learn-footer {
  position: fixed; left: 0; right: 0; bottom: 0;
  background: var(--bg);
  border-top: 2px solid var(--line);
  padding: 14px 16px calc(14px + env(safe-area-inset-bottom));
  display: flex; gap: 12px;
  max-width: 560px; margin: 0 auto;
  z-index: 50;
}
.learn-footer .btn { flex: 1; }
.learn-footer:empty { display: none; }

/* 判定反馈条 */
.feedback-bar {
  position: fixed; left: 0; right: 0; bottom: 0;
  max-width: 560px; margin: 0 auto;
  padding: 16px;
  display: flex; align-items: center; gap: 12px;
  z-index: 60;
  animation: slideUp .22s ease-out;
}
.feedback-bar.ok { background: var(--green-bg); border-top: 2px solid #cdeec0; }
.feedback-bar.no { background: var(--red-l); border-top: 2px solid #ffb3b3; }
@keyframes slideUp { from { transform: translateY(100%); } }
.fb-icon { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; font-size: 20px; flex: 0 0 auto; }
.feedback-bar.ok .fb-icon { background: var(--green); color: #fff; }
.feedback-bar.no .fb-icon { background: var(--red); color: #fff; }
.fb-text { flex: 1; min-width: 0; }
.fb-title { font-size: 15px; font-weight: 900; }
.feedback-bar.ok .fb-title { color: var(--green-d); }
.feedback-bar.no .fb-title { color: #b91c1c; }
.fb-sub { font-size: 12px; color: var(--ink-3); font-weight: 700; margin-top: 2px; }
.feedback-bar .btn { flex: 0 0 auto; }

/* ============================================================
   结算
   ============================================================ */
.result-card { text-align: center; padding: 20px 8px 8px; animation: fadeIn .3s; }
.rc-ring {
  width: 150px; height: 150px; margin: 0 auto 22px;
  border-radius: 50%; position: relative;
  display: grid; place-items: center;
}
.rc-ring svg { position: absolute; inset: 0; width: 100%; height: 100%; transform: rotate(-90deg); }
.rc-ring circle { fill: none; stroke-width: 12; stroke-linecap: round; }
.rc-ring .bg { stroke: var(--line); }
.rc-ring .fg { stroke: var(--green); transition: stroke-dasharray .9s cubic-bezier(.2,.8,.3,1); }
.rc-inner { text-align: center; }
.rc-pct { font-size: 36px; font-weight: 900; color: var(--green); line-height: 1; }
.rc-label { font-size: 11px; color: var(--ink-3); font-weight: 800; margin-top: 3px; }

.result-card h2 { margin: 0 0 10px; font-size: 26px; font-weight: 900; }
.rc-stats { display: flex; gap: 10px; justify-content: center; margin: 20px 0 26px; flex-wrap: wrap; }
.rc-stat {
  background: var(--bg-soft); border: 2px solid var(--line);
  border-radius: var(--r); padding: 12px 18px; min-width: 88px;
}
.rc-stat b { display: block; font-size: 20px; font-weight: 900; color: var(--ink); }
.rc-stat span { font-size: 11px; color: var(--ink-3); font-weight: 800; }
.rc-actions { display: flex; flex-direction: column; gap: 11px; }

.empty-screen { text-align: center; padding: 70px 20px; }
.empty-art { width: 92px; height: 92px; margin: 0 auto 20px; opacity: .9; }
.empty-screen h2 { font-size: 21px; font-weight: 900; margin: 0 0 10px; }
.empty-screen p { color: var(--ink-3); font-size: 14px; margin-bottom: 26px; font-weight: 600; line-height: 1.6; }

/* ============================================================
   PK
   ============================================================ */
.pk-setup {
  background: var(--bg); border: 2px solid var(--line);
  border-radius: var(--r-lg); padding: 20px; box-shadow: var(--sh);
}
.pk-tip { color: var(--ink-3); font-size: 13px; font-weight: 700; line-height: 1.65; margin: 0 0 18px; }

.seg { display: flex; gap: 8px; margin-bottom: 20px; }
.seg-item {
  flex: 1; padding: 12px 8px; border-radius: var(--r-sm);
  font-size: 14px; font-weight: 800;
  background: var(--bg); border: 2px solid var(--line);
  color: var(--ink-3); cursor: pointer; font-family: inherit;
  box-shadow: 0 3px 0 var(--line-strong);
  transition: .1s;
}
.seg-item:active { transform: translateY(3px); box-shadow: 0 0 0 var(--line-strong); }
.seg-item.on {
  background: var(--green-bg); border-color: var(--green); color: var(--green-d);
  box-shadow: 0 3px 0 var(--green-d);
}

.pk-turn-head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 12px; font-size: 15px;
}
.pk-player {
  display: inline-flex; align-items: center; gap: 7px;
  font-weight: 900; color: var(--ink);
}
.pk-player .ico { color: var(--blue); font-size: 18px; }
.pk-live-count { color: var(--ink-3); font-weight: 800; font-variant-numeric: tabular-nums; }
.pk-body { margin-top: 20px; }

.board { list-style: none; padding: 0; margin: 0; }
.board-row {
  display: flex; align-items: center; gap: 12px;
  padding: 13px 15px; background: var(--bg);
  border: 2px solid var(--line); border-radius: var(--r);
  margin-bottom: 9px; font-size: 14px; font-weight: 700;
}
.board-row.top { border-color: var(--gold); background: var(--gold-l); }
.br-rank {
  width: 26px; height: 26px; border-radius: 50%;
  display: grid; place-items: center;
  font-size: 12px; font-weight: 900;
  background: var(--bg-soft); color: var(--ink-3);
}
.board-row.top .br-rank { background: var(--gold); color: #6b4a00; }
.br-name { flex: 1; font-weight: 900; min-width: 0; }
.br-score { color: var(--green-d); font-weight: 900; font-variant-numeric: tabular-nums; }
.br-time { color: var(--ink-3); font-size: 12px; width: 52px; text-align: right; font-weight: 700; }

.pk-result { text-align: center; padding: 16px 0; }
.pkr-vs { display: flex; align-items: stretch; gap: 10px; justify-content: center; }
.pkr-side {
  flex: 1; background: var(--bg); border: 2px solid var(--line);
  border-radius: var(--r-lg); padding: 18px 10px; box-shadow: var(--sh);
}
.pkr-side.win {
  border-color: var(--gold); background: var(--gold-l);
  box-shadow: 0 4px 0 var(--gold-d);
}
.pkr-name { font-size: 13px; color: var(--ink-3); font-weight: 800; margin-bottom: 8px; }
.pkr-score { font-size: 30px; font-weight: 900; color: var(--green-d); }
.pkr-side.win .pkr-score { color: #a16207; }
.pkr-time { font-size: 12px; color: var(--ink-3); margin-top: 6px; font-weight: 700; }
.pkr-acc { font-size: 12px; color: var(--ink-3); font-weight: 700; }
.pkr-mid { align-self: center; font-size: 26px; color: var(--gold-d); }
.pkr-verdict { font-size: 17px; font-weight: 900; margin: 24px 0; }

/* ============================================================
   统计
   ============================================================ */
.stat-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 11px; }
.stat-box {
  background: var(--bg); border: 2px solid var(--line);
  border-radius: var(--r); padding: 16px; text-align: center;
  box-shadow: var(--sh);
}
.stat-box b { display: block; font-size: 27px; font-weight: 900; color: var(--ink); }
.stat-box b.green { color: var(--green-d); }
.stat-box b.gold { color: var(--gold-d); }
.stat-box span { font-size: 11px; color: var(--ink-3); font-weight: 800; }

.dist-card, .week-card, .data-card {
  background: var(--bg); border: 2px solid var(--line);
  border-radius: var(--r-lg); padding: 18px; box-shadow: var(--sh);
}
.dist-row { display: flex; align-items: center; gap: 10px; margin-bottom: 11px; font-size: 12px; }
.dist-row:last-child { margin-bottom: 0; }
.dist-label { width: 48px; color: var(--ink-3); font-weight: 800; }
.dist-bar { flex: 1; height: 11px; background: var(--line); border-radius: 999px; overflow: hidden; }
.dist-bar i {
  display: block; height: 100%; border-radius: 999px;
  background: linear-gradient(90deg, #7ee62e, var(--green));
  transition: width .55s;
}
.dist-num { width: 32px; text-align: right; color: var(--ink-2); font-weight: 900; font-variant-numeric: tabular-nums; }

.week-card { display: flex; gap: 7px; align-items: flex-end; height: 156px; padding: 18px 14px 10px; }
.week-col { flex: 1; display: flex; flex-direction: column; align-items: center; height: 100%; }
.week-bar-wrap { flex: 1; width: 100%; display: flex; align-items: flex-end; }
.week-bar-wrap i {
  display: block; width: 100%; min-height: 4px;
  background: linear-gradient(180deg, #7ee62e, var(--green));
  border-radius: 6px 6px 3px 3px; transition: height .55s;
}
.week-num { font-size: 10px; color: var(--ink-2); height: 14px; font-weight: 800; }
.week-day { font-size: 11px; color: var(--ink-3); margin-top: 2px; font-weight: 800; }

.data-note { font-size: 13px; color: var(--ink-3); line-height: 1.7; margin: 0 0 15px; font-weight: 600; }
.data-actions { display: flex; flex-direction: column; gap: 10px; }

/* ============================================================
   底部 Tab 导航
   ============================================================ */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0;
  background: var(--bg);
  border-top: 2px solid var(--line);
  display: flex; z-index: 40;
  padding-bottom: env(safe-area-inset-bottom);
}
.tabbar-inner {
  display: flex; width: 100%; max-width: 560px; margin: 0 auto;
}
.tab {
  flex: 1; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 3px;
  padding: 10px 0 8px; background: none; border: none;
  color: var(--ink-3); font-family: inherit; cursor: pointer;
  font-size: 10px; font-weight: 800;
  transition: color .14s;
}
.tab .ico { font-size: 23px; }
.tab.on { color: var(--green-d); }
.tab:active { transform: scale(.94); }

/* ============================================================
   toast
   ============================================================ */
.toast-host {
  position: fixed; left: 50%; bottom: 100px; transform: translateX(-50%);
  z-index: 9999; display: flex; flex-direction: column; gap: 8px;
  align-items: center; pointer-events: none; width: max-content; max-width: 88vw;
}
.toast {
  background: var(--ink); color: #fff;
  padding: 13px 20px; border-radius: var(--r);
  font-size: 14px; font-weight: 800;
  opacity: 0; transform: translateY(14px) scale(.96);
  transition: .24s cubic-bezier(.2,.8,.3,1);
  box-shadow: 0 8px 24px rgba(31,41,55,.24);
  text-align: center;
}
.toast.in { opacity: 1; transform: none; }
.toast-ok { background: var(--green-d); }
.toast-warn { background: var(--red-d); }

/* ============================================================
   致命错误
   ============================================================ */
.fatal {
  margin: 60px auto; max-width: 520px;
  background: var(--bg); border: 2px solid var(--red);
  border-radius: var(--r-lg); padding: 26px;
  box-shadow: 0 4px 0 var(--red-d);
}
.fatal h2 { margin: 0 0 12px; color: var(--red-d); font-size: 19px; font-weight: 900; }
.fatal p { font-size: 13px; color: var(--ink-3); line-height: 1.7; font-weight: 600; }
.fatal pre {
  background: var(--bg-soft); border: 2px solid var(--line);
  border-radius: var(--r-sm); padding: 14px;
  font-size: 13px; color: var(--green-d); overflow-x: auto; font-weight: 700;
}
.fatal .btn { margin-top: 14px; }

/* ============================================================
   响应式
   ============================================================ */
@media (max-width: 400px) {
  #app { padding: 0 12px 100px; }
  .hero h1 { font-size: 27px; }
  .fc-word { font-size: 34px; }
  .qp-word { font-size: 30px; }
  .qp-word.zh { font-size: 25px; }
  .option { font-size: 15px; padding: 13px 14px; }
  .node-btn { width: 68px; height: 68px; font-size: 21px; }
  .level-row { min-height: 88px; }
  .level-row.left { padding-left: 6%; }
  .level-row.right { padding-right: 6%; }
}

/* ============================================================
   账号与同步
   ============================================================ */
.acct-card {
  background: var(--bg); border: 2px solid var(--line);
  border-radius: var(--r-lg); padding: 18px; box-shadow: var(--sh);
}
.acct-head { display: flex; align-items: center; gap: 14px; margin-bottom: 14px; }
.acct-avatar {
  width: 52px; height: 52px; border-radius: 16px; flex: 0 0 auto;
  display: grid; place-items: center;
  font-size: 22px; font-weight: 900; color: #fff;
  background: linear-gradient(135deg, #58cc02, #46a302);
  box-shadow: inset 0 -3px 0 rgba(0,0,0,.15);
}
.acct-info { flex: 1; min-width: 0; }
.acct-info b { display: block; font-size: 17px; font-weight: 900; }
.acct-info span { font-size: 12px; color: var(--ink-3); font-weight: 700; }
.acct-hint {
  margin: 10px 0 0; font-size: 12px; color: var(--red-d);
  font-weight: 700; background: var(--red-l);
  padding: 8px 12px; border-radius: 10px;
}

.sync-row {
  display: flex; align-items: center; gap: 9px;
  font-size: 13px; font-weight: 700; color: var(--ink-2);
  padding-top: 12px; border-top: 2px solid var(--line);
}
.sync-dot {
  width: 9px; height: 9px; border-radius: 50%; flex: 0 0 auto;
  background: var(--line-strong);
}
.sync-dot.ok { background: var(--green); box-shadow: 0 0 0 3px rgba(88,204,2,.16); }
.sync-dot.busy {
  background: var(--blue);
  animation: pulse .9s ease-in-out infinite;
}
.sync-dot.pending { background: var(--gold); }
.sync-dot.err { background: var(--red); }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: .3; } }

.auth-hero { text-align: center; padding: 10px 10px 22px; }
.auth-plant { width: 78px; height: 78px; margin: 0 auto 12px; }
.auth-hero h2 { margin: 0 0 8px; font-size: 21px; font-weight: 900; }
.auth-hero p {
  margin: 0; font-size: 13px; color: var(--ink-3);
  line-height: 1.65; font-weight: 600;
}

.form-fields { display: flex; flex-direction: column; gap: 10px; }
.form-fields .type-input { font-size: 16px; padding: 15px; letter-spacing: 0; text-align: left; }
.form-err {
  font-size: 12px; color: var(--red-d); font-weight: 800;
  min-height: 16px; padding-left: 4px;
}
.form-err:empty { min-height: 0; }

/* 顶栏同步小徽章 */
.top-sync {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 11px; font-weight: 800; color: var(--ink-3);
  background: var(--bg-soft); border: 2px solid var(--line);
  padding: 5px 10px; border-radius: 999px; cursor: pointer;
  font-family: inherit;
}
.top-sync .sync-dot { width: 7px; height: 7px; }

/* ============================================================
   发音按钮 & 听写
   ============================================================ */
.fc-word-row {
  display: flex; align-items: center; justify-content: center;
  gap: 12px; flex-wrap: wrap;
}
.speak-btn {
  display: inline-flex; align-items: center; justify-content: center;
  border: 2px solid var(--blue); background: var(--blue-l);
  color: var(--blue-d); cursor: pointer; font-family: inherit;
  width: 40px; height: 40px; border-radius: 13px;
  box-shadow: 0 3px 0 #b8e6ff;
  transition: transform .08s, box-shadow .08s, background .14s;
  flex: 0 0 auto;
}
.speak-btn:active { transform: translateY(3px); box-shadow: 0 0 0 #b8e6ff; }
.speak-btn.lg { width: 48px; height: 48px; border-radius: 15px; }
.speak-btn.lg .ico { font-size: 24px; }
.speak-btn .ico { font-size: 20px; }
.speak-btn.speaking {
  background: var(--blue); color: #fff;
  animation: soundPulse .7s ease-out;
}
@keyframes soundPulse {
  0% { box-shadow: 0 3px 0 #b8e6ff, 0 0 0 0 rgba(28,176,246,.5); }
  100% { box-shadow: 0 3px 0 #b8e6ff, 0 0 0 14px rgba(28,176,246,0); }
}

/* 听写的发声大圆钮 */
.listen-orb { display: flex; justify-content: center; margin: 10px 0 16px; }
.listen-btn {
  width: 108px; height: 108px; border-radius: 50%;
  border: none; cursor: pointer;
  display: grid; place-items: center;
  background: linear-gradient(180deg, #4cc2f8, var(--blue));
  color: #fff;
  box-shadow: 0 7px 0 var(--blue-d), inset 0 3px 0 rgba(255,255,255,.35);
  transition: transform .08s, box-shadow .08s;
}
.listen-btn .ico { font-size: 46px; }
.listen-btn:active {
  transform: translateY(7px);
  box-shadow: 0 0 0 var(--blue-d), inset 0 3px 0 rgba(255,255,255,.35);
}
.listen-btn::after {
  content: ""; position: absolute; width: 108px; height: 108px;
  border-radius: 50%; border: 3px solid var(--blue);
  opacity: .3; animation: breathe 2.1s ease-in-out infinite;
}

/* ============================================================
   APK / 移动端适配
   ============================================================ */

/* 1. 禁用长按选词、高亮、拖拽 —— 网页上这些行为在 App 里显得很"假" */
html, body {
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
  text-rendering: optimizeSpeed;
}

/* 但输入框必须能选、能编辑 */
input, textarea, [contenteditable] {
  -webkit-user-select: text !important;
  user-select: text !important;
}

/* 2. 卡片和按钮加 touch-action，消除 300ms 延迟与双击缩放 */
button, .btn, .option, .level-node, .tab, .speak-btn, .listen-btn,
.cta-card, .deck-card, .seg-item, .node-btn {
  touch-action: manipulation;
}

/* 3. 橡皮筋滚动关掉，更像原生（WebView 里 overscroll 会露出白边） */
body { overscroll-behavior: none; }

/* 4. iOS/Android WebView 的字号自适应修正 */
@media screen and (max-width: 480px) {
  body { -webkit-text-size-adjust: 100%; }
}

/* 5. 安全区：Tab 栏和底部作答栏避开手势条 */
.tabbar {
  padding-bottom: max(8px, env(safe-area-inset-bottom));
}
.learn-footer, .feedback-bar {
  padding-bottom: max(14px, calc(env(safe-area-inset-bottom) + 8px));
}

/* 6. App 内没有"回到顶部"的地址栏，长列表底部留够空间 */
#app { padding-bottom: calc(112px + env(safe-area-inset-bottom)); }

/* 7. 深色下不让系统强制反色 */
@media (prefers-color-scheme: dark) {
  :root { color-scheme: light; }
}

/* 8. 单机模式（APK 没配服务器）时的提示条 */
.standalone-note {
  display: flex; align-items: center; justify-content: center; gap: 7px;
  font-size: 11px; font-weight: 800; color: var(--ink-3);
  background: var(--bg-soft); border: 2px solid var(--line);
  padding: 6px 14px; border-radius: 999px; margin-top: 14px;
  width: fit-content; margin-left: auto; margin-right: auto;
}
.standalone-note .ico { font-size: 13px; }

/* ============================================================
   APK 安全区（由 MainActivity 注入 --sat/--sab/--sal/--sar）
   ------------------------------------------------------------
   为什么不能靠 WebView.setPadding：
     页面里的 .learn-top / .tabbar / .learn-footer 是 position:fixed，
     fixed 相对视口定位，父容器 padding 对它们完全无效。
     所以必须由样式表自己消费 inset。
   ============================================================ */
:root {
  --sat: env(safe-area-inset-top, 0px);
  --sab: env(safe-area-inset-bottom, 0px);
  --sal: env(safe-area-inset-left, 0px);
  --sar: env(safe-area-inset-right, 0px);
}

/* 顶层容器整体让出状态栏 / 手势条 */
.in-app #app {
  padding-top: calc(12px + var(--sat));
  padding-left: calc(16px + var(--sal));
  padding-right: calc(16px + var(--sar));
  padding-bottom: calc(112px + var(--sab));
}

/* 底部固定栏各自让出手势条 */
.in-app .tabbar {
  padding-bottom: calc(8px + var(--sab));
}
.in-app .learn-footer {
  padding-bottom: calc(14px + var(--sab));
}
.in-app .feedback-bar {
  padding-bottom: calc(16px + var(--sab));
}
.in-app .toast-host {
  bottom: calc(100px + var(--sab));
}

/* 学习页顶栏（返回 + 进度条）不再顶到状态栏 */
.in-app .learn-top {
  padding-top: 6px;
}

/* 安全区为 0 时（普通浏览器）保持原样，不加任何额外偏移 */
@supports not (padding: env(safe-area-inset-top)) {
  .in-app #app { padding-top: 16px; }
}
