/* =========================================================
   开口说 SpeakUp · 样式
   设计目标：大字号、大按钮、强反馈，适合 9-11 岁孩子
   ========================================================= */

:root {
  --ink: #2b2839;
  --ink-2: #5a566e;
  --muted: #8b879c;
  --paper: #fff8f0;
  --card: #ffffff;
  --line: #ece8f2;

  --coral: #ff7a59;
  --coral-dark: #e0532f;
  --mint: #2ec4b6;
  --mint-dark: #1a9c90;
  --sun: #ffc93c;
  --sun-dark: #e0a712;
  --grape: #8e7cff;
  --grape-dark: #6c58e0;
  --sky: #4cc9f0;
  --pink: #ff8fab;

  --ok: #17a673;
  --bad: #ef4f5f;

  --radius: 22px;
  --shadow-soft: 0 6px 18px rgba(43, 40, 57, 0.07);
  --shadow-card: 0 2px 0 rgba(43, 40, 57, 0.04), 0 8px 22px rgba(43, 40, 57, 0.06);

  --font: "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei",
          system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
}

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

/* 作者样式里的 display 会盖掉浏览器默认的 [hidden]，这里强制回来 */
[hidden] { display: none !important; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
}

body {
  font-family: var(--font);
  color: var(--ink);
  background: var(--paper);
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}

/* 背景装饰 */
body::before,
body::after {
  content: "";
  position: fixed;
  z-index: 0;
  border-radius: 50%;
  filter: blur(48px);
  opacity: 0.55;
  pointer-events: none;
}
body::before {
  width: 46vw; height: 46vw;
  max-width: 420px; max-height: 420px;
  top: -12vw; right: -10vw;
  background: radial-gradient(circle, #ffd9c9, transparent 70%);
}
body::after {
  width: 52vw; height: 52vw;
  max-width: 480px; max-height: 480px;
  bottom: -16vw; left: -14vw;
  background: radial-gradient(circle, #cdf3ee, transparent 70%);
}

#app {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 720px;
  margin: 0 auto;
  height: 100vh;
  height: 100dvh;
  display: flex;
  flex-direction: column;
}

.screen {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 16px 18px calc(18px + env(safe-area-inset-bottom));
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
}

/* 对话类页面：固定头部和底部，中间滚动 */
.screen.chatlike {
  overflow: hidden;
  gap: 10px;
  padding-bottom: calc(10px + env(safe-area-inset-bottom));
}

/* 内容少时垂直居中，底部操作区依然贴底；内容多了自动回到顶部滚动 */
.screen.mid > .tabs,
.screen.mid > .quiz-card { margin-top: auto; }
.screen.mid > .nav-row,
.screen.mid > .quiz-status { margin-bottom: auto; }

/* =========================================================
   通用按钮 / 控件
   ========================================================= */
button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  background: none;
  color: inherit;
}

.icon-btn {
  flex: 0 0 auto;
  width: 44px; height: 44px;
  border-radius: 15px;
  background: var(--card);
  border: 1.5px solid var(--line);
  font-size: 19px;
  line-height: 1;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 3px 0 rgba(43, 40, 57, 0.05);
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}
.icon-btn:active { transform: translateY(2px); box-shadow: none; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 50px;
  padding: 0 22px;
  border-radius: 16px;
  background: linear-gradient(135deg, var(--coral), #ff9576);
  color: #fff;
  font-size: 16px;
  font-weight: 800;
  letter-spacing: 0.3px;
  box-shadow: 0 4px 0 var(--coral-dark), 0 8px 16px rgba(255, 122, 89, 0.25);
  transition: transform 0.1s ease, box-shadow 0.1s ease;
}
.btn:active {
  transform: translateY(3px);
  box-shadow: 0 1px 0 var(--coral-dark);
}
.btn.ghost {
  background: #fff;
  color: var(--ink);
  border: 1.5px solid var(--line);
  box-shadow: 0 3px 0 rgba(43, 40, 57, 0.06);
  font-weight: 700;
}
.btn.sm { min-height: 40px; padding: 0 14px; font-size: 14px; border-radius: 13px; }
.btn.danger { color: var(--bad); border-color: #ffd9dd; }

.pill {
  margin-left: auto;
  flex: 0 0 auto;
  background: #fff;
  border: 1.5px solid var(--line);
  border-radius: 999px;
  padding: 8px 14px;
  font-size: 14px;
  font-weight: 800;
  color: var(--ink-2);
  box-shadow: 0 3px 0 rgba(43, 40, 57, 0.04);
  white-space: nowrap;
}

/* =========================================================
   首页
   ========================================================= */
.home-head {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding-top: 6px;
}
.brand { display: flex; gap: 12px; align-items: center; }
.logo {
  width: 52px; height: 52px;
  border-radius: 18px;
  background: linear-gradient(135deg, #ffd67a, #ffb347);
  display: flex; align-items: center; justify-content: center;
  font-size: 28px;
  box-shadow: 0 4px 0 #e09a25;
}
.brand h1 {
  margin: 0;
  font-size: 24px;
  font-weight: 900;
  letter-spacing: 0.5px;
  line-height: 1.15;
}
.brand h1 span { color: var(--coral); font-size: 15px; font-weight: 800; letter-spacing: 0; }
.brand .sub { margin: 3px 0 0; font-size: 12.5px; color: var(--muted); }
.gear { margin-left: auto; }

.hero {
  display: flex;
  align-items: center;
  gap: 14px;
  background: linear-gradient(135deg, #ffe9df 0%, #fff3d6 100%);
  border-radius: var(--radius);
  padding: 16px 18px;
  border: 1.5px solid #ffe0d2;
}
.hero-text { flex: 1 1 auto; min-width: 0; }
.hero .hello {
  margin: 0 0 8px;
  font-size: 15px;
  font-weight: 800;
  color: #b3542f;
}
.mascot-bubble {
  position: relative;
  background: #fff;
  border-radius: 16px;
  padding: 11px 14px;
  font-size: 15.5px;
  font-weight: 700;
  line-height: 1.4;
  box-shadow: 0 4px 0 rgba(43, 40, 57, 0.05);
}
.mascot {
  flex: 0 0 auto;
  width: 82px; height: 82px;
  border-radius: 50%;
  font-size: 46px;
  background: radial-gradient(circle at 32% 28%, #fff6e3, #ffd9a8);
  box-shadow: 0 6px 0 #e8b673, 0 10px 20px rgba(232, 182, 115, 0.35);
  display: flex; align-items: center; justify-content: center;
  animation: bob 2.6s ease-in-out infinite;
  transition: transform 0.1s ease;
}
.mascot:active { transform: scale(0.94); }
@keyframes bob {
  0%, 100% { transform: translateY(0) rotate(-2deg); }
  50% { transform: translateY(-5px) rotate(2deg); }
}

.stat-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.stat {
  background: #fff;
  border-radius: 16px;
  padding: 10px 6px;
  text-align: center;
  border: 1.5px solid var(--line);
  box-shadow: 0 3px 0 rgba(43, 40, 57, 0.04);
}
.stat b { display: block; font-size: 17px; font-weight: 900; letter-spacing: 0.3px; }
.stat span { font-size: 11.5px; color: var(--muted); font-weight: 600; }

.card-grid { display: grid; gap: 12px; }

.mod-card {
  display: grid;
  grid-template-columns: auto 1fr auto auto;
  align-items: center;
  gap: 12px;
  text-align: left;
  padding: 14px;
  border-radius: var(--radius);
  background: #fff;
  border: 1.5px solid var(--line);
  border-bottom-width: 4px;
  box-shadow: var(--shadow-card);
  transition: transform 0.12s ease, border-color 0.12s ease;
}
.mod-card:active { transform: translateY(2px); }
.mod-card .mc-emoji {
  width: 54px; height: 54px;
  border-radius: 17px;
  display: flex; align-items: center; justify-content: center;
  font-size: 28px;
  background: #fff2ec;
}
.mod-card.coral .mc-emoji { background: #ffe9e1; }
.mod-card.mint .mc-emoji { background: #dcf7f3; }
.mod-card.grape .mc-emoji { background: #ece7ff; }
.mod-card.sun .mc-emoji { background: #fff5cc; }
.mod-card .mc-body { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.mod-card .mc-body b { font-size: 17px; font-weight: 900; }
.mod-card .mc-body small { font-size: 12.5px; color: var(--muted); line-height: 1.35; }
.mod-card .mc-meta {
  font-size: 11.5px;
  font-weight: 800;
  color: var(--ink-2);
  background: #f7f5fb;
  border-radius: 999px;
  padding: 5px 9px;
  white-space: nowrap;
}
.mod-card .mc-go { font-size: 22px; color: #c9c4d8; font-weight: 900; }

.home-tip {
  margin: 2px 0 0;
  font-size: 12.5px;
  line-height: 1.6;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.7);
  border-radius: 14px;
  padding: 10px 12px;
}

/* 今天的句子 */
.daily {
  background: #fff;
  border: 1.5px solid var(--line);
  border-bottom-width: 4px;
  border-radius: var(--radius);
  padding: 13px 15px;
  box-shadow: var(--shadow-card);
}
.dc-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  font-size: 12px;
  font-weight: 800;
  color: var(--muted);
  letter-spacing: 0.3px;
}
.dc-say {
  font-size: 12px;
  font-weight: 800;
  color: var(--coral-dark);
  background: #fff0ea;
  border-radius: 999px;
  padding: 6px 11px;
  white-space: nowrap;
}
.dc-say:active { transform: translateY(1px); }
.dc-en {
  margin: 9px 0 3px;
  font-size: 18px;
  font-weight: 800;
  line-height: 1.4;
}
.dc-zh { margin: 0; font-size: 12.5px; color: var(--muted); }

/* =========================================================
   顶部栏
   ========================================================= */
.topbar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 0 0 auto;
}
.tb-title { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.tb-title span {
  font-size: 16.5px;
  font-weight: 900;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.tb-title small { font-size: 11.5px; color: var(--muted); font-weight: 600; }

/* =========================================================
   气泡对话
   ========================================================= */
.chat-log {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 9px;
  padding: 2px 2px 6px;
  overscroll-behavior: contain;
}
/* 内容少的时候贴着底部，像真实聊天；内容多了自动顶部对齐并可滚动 */
.chat-log > :first-child { margin-top: auto; }

.bubble {
  max-width: 87%;
  padding: 10px 13px;
  border-radius: 18px;
  font-size: 16.5px;
  line-height: 1.45;
  animation: pop-in 0.18s ease-out;
  word-break: break-word;
}
@keyframes pop-in {
  from { opacity: 0; transform: translateY(6px) scale(0.98); }
  to { opacity: 1; transform: none; }
}
.bubble.ai {
  align-self: flex-start;
  background: #fff;
  border: 1.5px solid var(--line);
  border-bottom-left-radius: 6px;
  box-shadow: 0 3px 10px rgba(43, 40, 57, 0.05);
}
.bubble.you {
  align-self: flex-end;
  background: linear-gradient(135deg, #ffe3d6, #ffd3c2);
  border-bottom-right-radius: 6px;
  font-weight: 600;
  color: #7a3319;
}
.b-text { font-weight: 600; }
.bubble.ai .b-text { font-weight: 600; }

.b-tools { display: flex; gap: 6px; margin-top: 6px; }
.bubble.you .b-tools { justify-content: flex-end; }
.mini {
  width: 28px; height: 28px;
  border-radius: 9px;
  background: #f5f3fa;
  border: 1px solid #eae6f3;
  font-size: 13px;
  font-weight: 800;
  color: var(--ink-2);
  display: inline-flex; align-items: center; justify-content: center;
  transition: background 0.12s ease;
}
.mini:active { background: #e9e4f6; }
.mini.on { background: #ffe9a8; border-color: #f6d372; }

.b-zh {
  margin-top: 7px;
  padding: 7px 9px;
  border-radius: 10px;
  background: #f6f4fb;
  color: #6c6880;
  font-size: 13.5px;
  font-weight: 500;
  line-height: 1.5;
}

.tip-bubble {
  align-self: flex-start;
  max-width: 92%;
  background: #fff8de;
  border: 1.5px solid #ffe9a8;
  border-radius: 14px;
  padding: 9px 12px;
  font-size: 13.5px;
  line-height: 1.55;
  color: #7a5c12;
  animation: pop-in 0.18s ease-out;
}
.tip-bubble b { font-weight: 800; }

.scene-intro {
  align-self: center;
  max-width: 94%;
  text-align: center;
  background: rgba(255, 255, 255, 0.8);
  border: 1px dashed #e2dbe8;
  border-radius: 12px;
  padding: 7px 12px;
  font-size: 12.5px;
  line-height: 1.55;
  color: var(--muted);
}
.tip-bubble .fix { color: #5c4a10; }
.tip-bubble .fix i { font-style: normal; font-weight: 800; color: #a0600a; }
.tip-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 7px;
}
.tip-bubble .mini { margin-left: 6px; vertical-align: middle; }

.chip {
  display: block;
  width: 100%;
  text-align: left;
  background: #fff;
  border: 1.5px solid #ffd98a;
  border-radius: 12px;
  padding: 10px 12px;
  font-size: 14.5px;
  font-weight: 700;
  color: #6a4d0d;
  line-height: 1.4;
  transition: transform 0.1s ease;
}
.chip:active { transform: scale(0.985); }
.chip.sm {
  display: inline-block;
  width: auto;
  padding: 7px 11px;
  font-size: 13px;
  border-color: #efe9d2;
  background: #fffdf4;
  color: #6a5a2a;
}
.topic-chip { background: #fff; border-color: #d9d3ea; color: var(--ink-2); }

/* =========================================================
   底部操作区
   ========================================================= */
.feedback {
  flex: 0 0 auto;
  max-height: 44vh;
  overflow-y: auto;
  display: none;
  animation: slide-up 0.2s ease-out;
}
.feedback.show { display: block; }
@keyframes slide-up {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: none; }
}
.fb {
  background: #fff;
  border: 1.5px solid var(--line);
  border-radius: 18px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  box-shadow: 0 -2px 14px rgba(43, 40, 57, 0.05);
}
.fb-title { font-size: 13.5px; font-weight: 800; color: var(--ink-2); }
.fb-row { display: flex; gap: 8px; justify-content: flex-end; margin-top: 2px; }

.hearing {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 8px;
  background: #eafaf7;
  border: 1.5px solid #bfeee7;
  border-radius: 14px;
  padding: 8px 12px;
  font-size: 13.5px;
  color: #16756a;
}
.hearing b { font-weight: 700; max-height: 42px; overflow: hidden; }
.pulse-dot {
  width: 9px; height: 9px;
  border-radius: 50%;
  background: var(--mint);
  animation: blink 0.9s ease-in-out infinite;
  flex: 0 0 auto;
}
@keyframes blink {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.35; transform: scale(0.8); }
}

.type-row { flex: 0 0 auto; display: flex; gap: 8px; }
.type-row input {
  flex: 1 1 auto;
  min-width: 0;
  height: 46px;
  border-radius: 14px;
  border: 1.5px solid var(--line);
  background: #fff;
  padding: 0 14px;
  font-family: inherit;
  font-size: 16px;
  color: var(--ink);
}
.type-row input:focus {
  outline: none;
  border-color: var(--coral);
  box-shadow: 0 0 0 3px rgba(255, 122, 89, 0.15);
}

.action-bar {
  flex: 0 0 auto;
  display: flex;
  gap: 8px;
  align-items: stretch;
}

.mic-main {
  flex: 1 1 auto;
  min-height: 58px;
  border-radius: 999px;
  background: linear-gradient(135deg, #ff8a63, #ff6a45);
  color: #fff;
  font-size: 17px;
  font-weight: 900;
  letter-spacing: 0.4px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  box-shadow: 0 5px 0 var(--coral-dark), 0 10px 20px rgba(255, 106, 69, 0.28);
  transition: transform 0.1s ease, box-shadow 0.1s ease;
}
.mic-main:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--coral-dark); }
.mic-main .mic-emoji { font-size: 22px; }
.mic-main.wide { width: 100%; }

.mic-main.listening {
  background: linear-gradient(135deg, #35d0bf, #14a898);
  box-shadow: 0 5px 0 var(--mint-dark), 0 0 0 6px rgba(46, 196, 182, 0.18);
  animation: mic-pulse 1.1s ease-in-out infinite;
}
@keyframes mic-pulse {
  0%, 100% { box-shadow: 0 5px 0 var(--mint-dark), 0 0 0 4px rgba(46, 196, 182, 0.18); }
  50% { box-shadow: 0 5px 0 var(--mint-dark), 0 0 0 12px rgba(46, 196, 182, 0.06); }
}

.act {
  flex: 0 0 62px;
  border-radius: 17px;
  background: #fff;
  border: 1.5px solid var(--line);
  border-bottom-width: 3px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  font-size: 10.5px;
  font-weight: 800;
  color: var(--ink-2);
  transition: transform 0.1s ease;
}
.act span { font-size: 19px; line-height: 1; }
.act i { font-style: normal; }
.act:active { transform: translateY(2px); }

/* =========================================================
   进度圆点
   ========================================================= */
.dots {
  flex: 0 0 auto;
  display: flex;
  gap: 6px;
  justify-content: center;
  padding: 2px 0;
}
.dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: #ddd8e8;
  transition: all 0.2s ease;
}
.dot.done { background: var(--mint); }
.dot.now { background: var(--coral); width: 22px; border-radius: 4px; }

/* =========================================================
   场景列表 / 关卡列表
   ========================================================= */
.scene-list { display: grid; gap: 10px; }
.scene-card {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 12px;
  text-align: left;
  background: #fff;
  border: 1.5px solid var(--line);
  border-bottom-width: 4px;
  border-radius: 18px;
  padding: 12px 14px;
  box-shadow: var(--shadow-card);
  transition: transform 0.12s ease;
}
.scene-card:active { transform: translateY(2px); }
.sc-emoji {
  width: 46px; height: 46px;
  border-radius: 14px;
  background: #fff4e6;
  display: flex; align-items: center; justify-content: center;
  font-size: 25px;
}
.sc-body { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.sc-body b { font-size: 16px; font-weight: 800; }
.sc-body small { font-size: 12px; color: var(--muted); }
.sc-right { display: flex; align-items: center; }
.lv {
  font-size: 11px;
  font-weight: 800;
  color: #9a7b2c;
  background: #fff6d8;
  border-radius: 999px;
  padding: 4px 8px;
}

.lv-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.lv-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 18px 10px 14px;
  border-radius: var(--radius);
  background: #fff;
  border: 1.5px solid var(--line);
  border-bottom-width: 4px;
  box-shadow: var(--shadow-card);
  transition: transform 0.12s ease;
}
.lv-card:active { transform: translateY(2px); }
.lv-card .lv-emoji {
  width: 60px; height: 60px;
  border-radius: 20px;
  display: flex; align-items: center; justify-content: center;
  font-size: 32px;
  margin-bottom: 4px;
}
.lv-card.mint .lv-emoji { background: #ddf7f3; }
.lv-card.coral .lv-emoji { background: #ffe8e0; }
.lv-card.grape .lv-emoji { background: #ebe6ff; }
.lv-card.sky .lv-emoji { background: #dff3fc; }
.lv-card.sun .lv-emoji { background: #fff4c9; }
.lv-card.pink .lv-emoji { background: #ffe4ec; }
.lv-card b { font-size: 16px; font-weight: 900; }
.lv-card small { font-size: 11.5px; color: var(--muted); }
.lv-card .lv-tip { font-size: 11px; color: #b6b1c6; font-weight: 700; margin-top: 3px; }

.mini-stars { display: inline-flex; gap: 1px; }

.ket-badge {
  font-style: normal;
  font-size: 9.5px;
  font-weight: 900;
  letter-spacing: 0.3px;
  color: #9a5b00;
  background: #ffeec2;
  border: 1px solid #f7d47a;
  border-radius: 5px;
  padding: 1px 4px;
  margin-left: 5px;
  vertical-align: 1px;
}

.star { color: #ded9e9; font-size: 15px; line-height: 1; }
.star.on { color: #ffc93c; text-shadow: 0 1px 0 #e0a712; }
.star.sm { font-size: 12px; }

/* =========================================================
   跟读
   ========================================================= */
.tabs {
  display: flex;
  gap: 6px;
  background: #f1eef8;
  padding: 5px;
  border-radius: 15px;
  flex: 0 0 auto;
}
.tab {
  flex: 1 1 0;
  min-height: 40px;
  border-radius: 11px;
  font-size: 14px;
  font-weight: 800;
  color: #7b7690;
  transition: all 0.15s ease;
}
.tab.on {
  background: #fff;
  color: var(--ink);
  box-shadow: 0 2px 8px rgba(43, 40, 57, 0.09);
}

.shadow-card {
  background: #fff;
  border: 1.5px solid var(--line);
  border-radius: var(--radius);
  padding: 18px 16px 16px;
  text-align: center;
  box-shadow: var(--shadow-card);
  flex: 0 0 auto;
}
.shadow-count { font-size: 12px; font-weight: 800; color: var(--muted); letter-spacing: 1px; }
.shadow-en {
  margin: 12px 0 6px;
  font-size: 24px;
  font-weight: 800;
  line-height: 1.4;
  letter-spacing: 0.2px;
}
.shadow-zh { margin: 0 0 14px; font-size: 13.5px; color: var(--muted); }
.listen { margin: 0 auto; }

.marks {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 34vh;
  overflow-y: auto;
}
.prev-best { font-size: 12px; color: var(--muted); text-align: center; }
.prev-best .mini-stars { vertical-align: middle; }
.heard-line {
  font-size: 13px;
  color: var(--ink-2);
  background: #f7f5fb;
  border-radius: 10px;
  padding: 8px 10px;
}
.heard-label { color: var(--muted); font-weight: 700; margin-right: 4px; }
.heard-text { font-weight: 600; }

.word-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.wchip {
  padding: 5px 10px;
  border-radius: 999px;
  font-size: 13.5px;
  font-weight: 700;
}
.wchip.ok { background: #ddf7ee; color: #0f7a5c; }
.wchip.miss { background: #ffe6e9; color: #c22f42; text-decoration: line-through; }

.score-line {
  font-size: 14px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
.score-line b { font-size: 20px; font-weight: 900; }
.score-line.great b { color: var(--ok); }
.score-line.good b { color: var(--sun-dark); }
.score-line.try b { color: var(--bad); }
.gained-inline {
  font-style: normal;
  font-size: 12px;
  font-weight: 800;
  color: #b07d00;
  background: #fff6d8;
  border-radius: 999px;
  padding: 3px 8px;
}
.pron-tip { margin: 0; font-size: 12.5px; color: var(--muted); line-height: 1.5; }

.shadow-actions { flex: 0 0 auto; display: flex; }
.nav-row { flex: 0 0 auto; display: flex; gap: 8px; justify-content: space-between; }
.nav-row .btn { flex: 1 1 0; padding: 0 10px; }

/* =========================================================
   单词闯关
   ========================================================= */
.quiz-card {
  background: #fff;
  border: 1.5px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  text-align: center;
  box-shadow: var(--shadow-card);
  flex: 0 0 auto;
}
.quiz-emoji { font-size: 64px; line-height: 1.1; }
.quiz-zh { font-size: 26px; font-weight: 900; margin-top: 4px; }
.quiz-ask { font-size: 13px; color: var(--muted); margin-top: 6px; }

.options {
  flex: 0 0 auto;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.opt {
  min-height: 58px;
  border-radius: 16px;
  background: #fff;
  border: 1.5px solid var(--line);
  border-bottom-width: 4px;
  font-size: 19px;
  font-weight: 800;
  color: var(--ink);
  transition: transform 0.1s ease, background 0.15s ease;
}
.opt:active { transform: translateY(2px); }
.opt.ok { background: #ddf7ee; border-color: #a9e5cf; color: #0d7355; }
.opt.bad { background: #ffe6e9; border-color: #ffc9d0; color: #c22f42; animation: shake 0.28s ease; }
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-5px); }
  75% { transform: translateX(5px); }
}

.quiz-status {
  flex: 0 0 auto;
  min-height: 0;
  font-size: 14px;
  font-weight: 700;
  line-height: 1.5;
  text-align: center;
  border-radius: 12px;
  padding: 0;
}
.quiz-status:not(:empty) { padding: 10px 12px; background: #f7f5fb; }
.quiz-status.good { background: #e3f8ef; color: #0f7a5c; }
.quiz-status.try { background: #fff1f3; color: #b5303f; }
.quiz-status.hint { background: #fff8de; color: #7a5c12; }

/* =========================================================
   弹窗 / 结果页
   ========================================================= */
#modal-root { position: fixed; inset: 0; z-index: 60; pointer-events: none; }
#modal-root.open { pointer-events: auto; }
.modal-mask {
  position: absolute;
  inset: 0;
  background: rgba(33, 30, 46, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  animation: fade 0.16s ease;
}
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
.modal {
  width: 100%;
  max-width: 400px;
  max-height: 88vh;
  overflow-y: auto;
  background: #fff;
  border-radius: 26px;
  padding: 22px;
  box-shadow: 0 20px 50px rgba(20, 18, 30, 0.25);
  animation: pop 0.22s cubic-bezier(0.2, 1.2, 0.5, 1);
}
@keyframes pop {
  from { opacity: 0; transform: scale(0.92) translateY(10px); }
  to { opacity: 1; transform: none; }
}

.result { text-align: center; }
.result-emoji { font-size: 54px; line-height: 1; animation: bob 2s ease-in-out infinite; }
.result h2 { margin: 10px 0 4px; font-size: 20px; font-weight: 900; }
.result-sub { margin: 0 0 10px; font-size: 13.5px; color: var(--muted); }
.result-stars { display: flex; justify-content: center; gap: 6px; margin: 10px 0 6px; }
.result-stars .star { font-size: 40px; }
.result-stars .star.on { animation: star-pop 0.5s backwards; }
.result-stars .star.on:nth-child(2) { animation-delay: 0.14s; }
.result-stars .star.on:nth-child(3) { animation-delay: 0.28s; }
@keyframes star-pop {
  0% { transform: scale(0) rotate(-40deg); opacity: 0; }
  70% { transform: scale(1.25) rotate(6deg); }
  100% { transform: scale(1) rotate(0); opacity: 1; }
}
.gained { font-size: 13px; font-weight: 800; color: #b07d00; margin: 4px 0 16px; }
.gained.muted { color: var(--muted); font-weight: 600; }
.result-actions { display: flex; gap: 10px; }
.result-actions .btn { flex: 1 1 0; }

/* 设置 */
.settings h2 { margin: 0 0 14px; font-size: 20px; font-weight: 900; }
.set-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}
.set-row.column { flex-direction: column; align-items: stretch; }
.set-row:last-child { border-bottom: none; }
.set-row label { font-size: 14px; font-weight: 800; color: var(--ink-2); }
.set-note { margin: 0; font-size: 12px; color: var(--muted); line-height: 1.5; }
.set-row .btn { align-self: flex-start; }

.seg { display: flex; gap: 4px; background: #f1eef8; padding: 4px; border-radius: 12px; }
.seg button {
  min-height: 36px;
  padding: 0 11px;
  border-radius: 9px;
  font-size: 12.5px;
  font-weight: 800;
  color: #7b7690;
}
.seg button.on { background: #fff; color: var(--ink); box-shadow: 0 2px 6px rgba(43, 40, 57, 0.1); }

.switch {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  background: #f1eef8;
  border-radius: 999px;
  padding: 5px 12px 5px 5px;
  font-size: 12.5px;
  font-weight: 800;
  color: #7b7690;
  transition: background 0.15s ease;
}
.switch i {
  width: 26px; height: 26px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 4px rgba(43, 40, 57, 0.15);
  transition: transform 0.15s ease;
}
.switch.on { background: #ddf7f3; color: #0f7a5c; }
.switch.on i { transform: translateX(2px); background: var(--mint); }

select {
  width: 100%;
  min-height: 44px;
  border-radius: 12px;
  border: 1.5px solid var(--line);
  background: #fff;
  padding: 0 10px;
  font-family: inherit;
  font-size: 13.5px;
  color: var(--ink);
  margin-bottom: 8px;
}

/* =========================================================
   AI 外教
   ========================================================= */
.ai-badge {
  font-style: normal;
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.5px;
  color: #fff;
  background: linear-gradient(135deg, #8e7cff, #6c58e0);
  border-radius: 6px;
  padding: 2px 5px;
  vertical-align: 2px;
  margin-left: 3px;
}

.set-block {
  background: #f8f6ff;
  border: 1.5px solid #e6e1fa;
  border-radius: 16px;
  padding: 12px;
  margin-bottom: 10px;
}
.set-block-title {
  font-size: 13.5px;
  font-weight: 900;
  color: #5b4bc4;
  margin-bottom: 8px;
}
.ai-row { display: flex; gap: 8px; margin-bottom: 8px; align-items: stretch; }
.ai-row input {
  flex: 1 1 auto;
  min-width: 0;
  height: 42px;
  border-radius: 12px;
  border: 1.5px solid #ddd6f5;
  background: #fff;
  padding: 0 12px;
  font-family: inherit;
  font-size: 14px;
  color: var(--ink);
}
.ai-row input:focus {
  outline: none;
  border-color: var(--grape);
  box-shadow: 0 0 0 3px rgba(142, 124, 255, 0.15);
}
.ai-row select { margin-bottom: 0; }
.ai-row .btn { flex: 0 0 auto; }
.set-note.ok { color: #0f7a5c; font-weight: 700; }

.ai-hint {
  font-size: 12.5px;
  line-height: 1.6;
  color: #5b4bc4;
  background: #f2eefe;
  border: 1.5px dashed #cfc4f7;
  border-radius: 14px;
  padding: 10px 12px;
}

.bubble.typing { display: flex; align-items: center; gap: 4px; padding: 14px 16px; }
.bubble.typing span {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #c9c4d8;
  animation: typing-dot 1s infinite ease-in-out;
}
.bubble.typing span:nth-child(2) { animation-delay: 0.15s; }
.bubble.typing span:nth-child(3) { animation-delay: 0.3s; }
@keyframes typing-dot {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.45; }
  30% { transform: translateY(-4px); opacity: 1; }
}

/* =========================================================
   Toast / 撒花
   ========================================================= */
#toast {
  position: fixed;
  left: 50%;
  bottom: calc(96px + env(safe-area-inset-bottom));
  transform: translate(-50%, 16px);
  z-index: 80;
  max-width: min(88vw, 480px);
  background: rgba(43, 40, 57, 0.94);
  color: #fff;
  font-size: 13.5px;
  font-weight: 600;
  line-height: 1.45;
  padding: 11px 16px;
  border-radius: 14px;
  text-align: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
}
#toast.show { opacity: 1; transform: translate(-50%, 0); }

#confetti { position: fixed; inset: 0; z-index: 90; pointer-events: none; overflow: hidden; }
.confetti-piece {
  position: absolute;
  top: -24px;
  animation-name: fall;
  animation-timing-function: linear;
  animation-fill-mode: forwards;
}
@keyframes fall {
  0% { transform: translateY(0) rotate(0deg); opacity: 1; }
  100% { transform: translateY(105vh) rotate(540deg); opacity: 0.85; }
}

/* =========================================================
   窄屏 / 大屏适配
   ========================================================= */
@media (max-width: 370px) {
  .screen { padding-left: 13px; padding-right: 13px; }
  .shadow-en { font-size: 21px; }
  .mod-card .mc-meta { display: none; }
  .act { flex-basis: 54px; }
  .mic-main { font-size: 15.5px; }
  .quiz-emoji { font-size: 54px; }
  .opt { font-size: 17px; min-height: 52px; }
}

@media (min-width: 620px) {
  .screen { padding: 22px 26px 26px; }
  .card-grid { grid-template-columns: 1fr 1fr; }
  .home-tip { font-size: 13px; }
}

@media (min-height: 800px) {
  .chat-log { gap: 11px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}
