/* ============================================================
   小恐龙英语 · 三年级上册
   设计系统：暖奶油底色 + 圆角卡片 + 单元主题色
   ============================================================ */
:root {
  --bg: #FFF8EE;
  --bg-soft: #FFF3E2;
  --ink: #22303C;
  --ink-2: #445563;
  --muted: #74808D;
  --line: #EFE4D4;
  --card: #FFFFFF;
  --brand: #FF8A3D;
  --brand-deep: #E4671A;
  --brand-soft: #FFF1E4;
  --blue: #3D8BFD;
  --green: #16B36B;
  --pink: #F45D9C;
  --purple: #8B6DF6;
  --gold: #F2A20C;
  --red: #EF5B5B;
  --shadow-sm: 0 2px 6px rgba(34, 48, 60, .05);
  --shadow: 0 10px 30px rgba(70, 50, 30, .08);
  --shadow-lg: 0 24px 60px rgba(70, 50, 30, .14);
  --r-sm: 12px;
  --r-md: 18px;
  --r-lg: 24px;
  --r-xl: 32px;
  --safe-b: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  background-image:
    radial-gradient(circle at 12% 8%, rgba(255, 196, 140, .35), transparent 42%),
    radial-gradient(circle at 88% 0%, rgba(160, 200, 255, .30), transparent 40%);
  background-attachment: fixed;
  color: var(--ink);
  font-family: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Nunito", system-ui, sans-serif;
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}
h1, h2, h3, h4, p { margin: 0; }
button, input, select { font: inherit; color: inherit; }
a { color: inherit; text-decoration: none; }
button { cursor: pointer; }
img { max-width: 100%; }
:focus-visible { outline: 3px solid rgba(61, 139, 253, .45); outline-offset: 2px; border-radius: 8px; }

/* ---------- 顶栏 ---------- */
.topbar {
  position: sticky; top: 0; z-index: 40;
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; padding: 10px 16px;
  background: rgba(255, 248, 238, .86);
  backdrop-filter: saturate(180%) blur(14px);
  border-bottom: 1px solid rgba(239, 228, 212, .8);
}
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.brand-logo {
  width: 42px; height: 42px; flex: 0 0 auto;
  display: grid; place-items: center; font-size: 23px;
  background: linear-gradient(150deg, #FFD9AF, #FFB067);
  border-radius: 15px; box-shadow: inset 0 -3px 0 rgba(0, 0, 0, .06);
  transition: transform .35s ease;
}
.brand:hover .brand-logo { transform: rotate(-8deg) scale(1.06); }
.brand-text { display: flex; flex-direction: column; line-height: 1.2; min-width: 0; }
.brand-text strong { font-size: 17px; letter-spacing: .3px; }
.brand-text small { font-size: 11px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar-right { display: flex; gap: 8px; }
.pill {
  display: inline-flex; align-items: center; gap: 5px;
  background: #fff; border: 1px solid var(--line);
  border-radius: 999px; padding: 6px 12px;
  font-size: 14px; font-weight: 800; box-shadow: var(--shadow-sm);
}
.pill span { font-size: 15px; }
.pill-star b { color: var(--gold); }
.pill-fire b { color: var(--red); }

/* ---------- 布局 ---------- */
.layout { display: block; }
.side { display: none; }
.main { padding: 16px 16px calc(96px + var(--safe-b)); max-width: 980px; margin: 0 auto; }
.view { animation: rise .32s cubic-bezier(.22, .9, .3, 1); }
@keyframes rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

/* ---------- 底部标签栏 ---------- */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 45;
  display: grid; grid-template-columns: repeat(5, 1fr);
  gap: 2px; padding: 8px 8px calc(8px + var(--safe-b));
  background: rgba(255, 255, 255, .92);
  backdrop-filter: blur(16px);
  border-top: 1px solid var(--line);
}
.tab {
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 6px 2px; border-radius: 14px; color: var(--muted);
  font-size: 11px; font-weight: 700;
}
.tab span { font-size: 21px; line-height: 1.1; filter: grayscale(.5); transition: transform .2s; }
.tab em { font-style: normal; }
.tab.active { color: var(--brand-deep); background: var(--brand-soft); }
.tab.active span { filter: none; transform: translateY(-1px) scale(1.08); }

/* ---------- 通用组件 ---------- */
.card {
  background: var(--card); border-radius: var(--r-lg);
  border: 1px solid var(--line); box-shadow: var(--shadow);
  padding: 18px;
}
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: none; border-radius: 16px; padding: 12px 18px;
  font-weight: 800; font-size: 15px; letter-spacing: .2px;
  transition: transform .12s ease, box-shadow .2s ease, background .2s;
  white-space: nowrap;
}
.btn:active { transform: scale(.97); }
.btn-primary { background: linear-gradient(140deg, #FFA45C, #FF7A2F); color: #fff; box-shadow: 0 10px 20px rgba(255, 122, 47, .28); }
.btn-primary:hover { box-shadow: 0 14px 26px rgba(255, 122, 47, .34); }
.btn-ghost { background: #fff; border: 2px solid var(--line); color: var(--ink-2); }
.btn-ghost:hover { border-color: #FFCEA6; background: #FFFBF5; }
.btn-soft { background: var(--brand-soft); color: var(--brand-deep); }
.btn-blue { background: #EAF2FF; color: #1E62CC; }
.btn-green { background: #E4F9EF; color: #0C8A50; }
.btn-lg { padding: 15px 24px; font-size: 17px; border-radius: 18px; }
.btn-sm { padding: 8px 13px; font-size: 13px; border-radius: 12px; }
.btn-block { width: 100%; }
.btn[disabled] { opacity: .5; pointer-events: none; }
.icon-btn {
  width: 46px; height: 46px; flex: 0 0 auto; border-radius: 15px;
  display: grid; place-items: center; font-size: 20px;
  background: #fff; border: 2px solid var(--line);
}
.icon-btn:hover { background: #FFFBF5; }
.icon-btn.playing { background: var(--brand-soft); border-color: #FFC79B; }

.row { display: flex; align-items: center; gap: 10px; }
.between { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.wrap { flex-wrap: wrap; }
.grow { flex: 1; min-width: 0; }
.muted { color: var(--muted); }
.center { text-align: center; }
.mt-8 { margin-top: 8px; } .mt-12 { margin-top: 12px; } .mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; } .mb-8 { margin-bottom: 8px; } .mb-16 { margin-bottom: 16px; }

.section-head { display: flex; align-items: baseline; justify-content: space-between; margin: 26px 0 12px; }
.section-head h2 { font-size: 19px; letter-spacing: .3px; }
.section-head .link { font-size: 13px; color: var(--brand-deep); font-weight: 700; }

.chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 11px; border-radius: 999px;
  background: #fff; border: 1px solid var(--line);
  font-size: 12px; font-weight: 700; color: var(--ink-2);
}

/* ---------- 首页 ---------- */
.hero {
  position: relative; overflow: hidden;
  border-radius: var(--r-xl); padding: 22px;
  background: linear-gradient(135deg, #FFE6C9 0%, #FFF6E7 55%, #FFFDF8 100%);
  border: 1px solid #FFE0BE; box-shadow: var(--shadow);
  display: flex; align-items: center; gap: 8px;
}
.hero-copy { position: relative; z-index: 2; min-width: 0; }
.hero h1 { font-size: 23px; line-height: 1.3; letter-spacing: .2px; }
.hero h1 span { color: var(--brand-deep); }
.hero p { color: #8B6B4A; font-size: 13px; margin-top: 6px; }
.hero-dino {
  position: absolute; right: 12px; bottom: -10px; font-size: 96px;
  filter: drop-shadow(0 12px 16px rgba(200, 120, 40, .18));
  animation: bob 4s ease-in-out infinite;
}
@keyframes bob { 0%, 100% { transform: translateY(0) rotate(-2deg); } 50% { transform: translateY(-8px) rotate(2deg); } }
.hero .chip { background: rgba(255, 255, 255, .75); }

.mission { margin-top: 14px; }
.mission-list { display: grid; gap: 14px; margin-top: 6px; }
.mission-row { display: grid; grid-template-columns: 34px 1fr auto; gap: 10px; align-items: center; }
.mission-ico { font-size: 22px; text-align: center; }
.mission-label { display: flex; justify-content: space-between; font-size: 13px; font-weight: 700; margin-bottom: 6px; }
.mission-label em { font-style: normal; color: var(--muted); font-weight: 600; font-size: 12px; }
.progress { height: 10px; border-radius: 999px; background: #F3EADF; overflow: hidden; }
.progress > i {
  display: block; height: 100%; width: 0; border-radius: 999px;
  background: linear-gradient(90deg, #FFC583, #FF8A3D);
  transition: width .5s cubic-bezier(.2, .8, .2, 1);
}
.progress.green > i { background: linear-gradient(90deg, #7FE0AF, #16B36B); }
.progress.blue > i { background: linear-gradient(90deg, #9CC4FF, #3D8BFD); }

.unit-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.unit-card {
  position: relative; overflow: hidden;
  background: #fff; border: 2px solid #fff; border-radius: var(--r-lg);
  padding: 14px; box-shadow: var(--shadow-sm);
  transition: transform .2s ease, box-shadow .2s ease, border-color .2s;
}
.unit-card:hover { transform: translateY(-4px); box-shadow: var(--shadow); border-color: var(--soft); }
.unit-card .u-emoji {
  width: 50px; height: 50px; border-radius: 16px; display: grid; place-items: center;
  font-size: 27px; background: var(--soft); margin-bottom: 8px;
}
.unit-card h3 { font-size: 16px; line-height: 1.25; }
.unit-card .u-num { font-size: 11px; font-weight: 800; color: var(--c); letter-spacing: .6px; }
.unit-card p { font-size: 11.5px; color: var(--muted); margin-top: 3px; min-height: 32px; }
.unit-card .u-foot { display: flex; align-items: center; justify-content: space-between; margin-top: 10px; }
.unit-card .u-words { font-size: 11px; color: var(--muted); font-weight: 700; }
.ring {
  --p: 0; --c: var(--brand);
  width: 42px; height: 42px; border-radius: 50%;
  background: conic-gradient(var(--c) calc(var(--p) * 1%), #F1E9DE 0);
  display: grid; place-items: center; flex: 0 0 auto;
}
.ring b {
  width: 32px; height: 32px; border-radius: 50%; background: #fff;
  display: grid; place-items: center; font-size: 10px; font-weight: 800; color: var(--ink-2);
}

.quick-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.quick {
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  padding: 14px 8px; border-radius: var(--r-md);
  background: #fff; border: 1px solid var(--line); box-shadow: var(--shadow-sm);
  font-size: 12px; font-weight: 700; color: var(--ink-2); text-align: center;
}
.quick span { font-size: 24px; }
.quick:hover { border-color: #FFCEA6; }

/* ---------- 单元页 ---------- */
.unit-hero {
  border-radius: var(--r-xl); padding: 20px; color: #fff;
  background: linear-gradient(135deg, var(--c), color-mix(in srgb, var(--c) 62%, #ffffff));
  box-shadow: 0 16px 34px color-mix(in srgb, var(--c) 28%, transparent);
  position: relative; overflow: hidden;
}
.unit-hero::after {
  content: ""; position: absolute; right: -40px; top: -40px;
  width: 160px; height: 160px; border-radius: 50%; background: rgba(255, 255, 255, .16);
}
.unit-hero h1 { font-size: 26px; letter-spacing: .2px; }
.unit-hero .u-cn { font-size: 14px; opacity: .92; margin-top: 2px; }
.unit-hero .u-goals { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.unit-hero .u-goals span {
  font-size: 11.5px; font-weight: 700; padding: 5px 10px; border-radius: 999px;
  background: rgba(255, 255, 255, .22); backdrop-filter: blur(4px);
}
.unit-hero .u-emoji { position: absolute; right: 16px; bottom: 8px; font-size: 64px; opacity: .95; }

.tabs { display: flex; gap: 6px; margin: 18px 0 12px; overflow-x: auto; padding-bottom: 2px; }
.tabs::-webkit-scrollbar { display: none; }
.tab-btn {
  border: 1px solid var(--line); background: #fff; color: var(--ink-2);
  padding: 9px 15px; border-radius: 999px; font-size: 13.5px; font-weight: 700; white-space: nowrap;
}
.tab-btn.active { background: var(--ink); color: #fff; border-color: var(--ink); }

.word-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.word-chip {
  text-align: left; background: #fff; border: 1px solid var(--line);
  border-radius: var(--r-md); padding: 12px; box-shadow: var(--shadow-sm);
  transition: transform .15s, border-color .2s;
}
.word-chip:hover { transform: translateY(-2px); border-color: color-mix(in srgb, var(--c) 40%, #fff); }
.word-chip .w-top { display: flex; align-items: center; justify-content: space-between; gap: 6px; }
.word-chip .w-em { font-size: 19px; }
.word-chip .w-en { font-size: 16px; font-weight: 900; letter-spacing: .2px; margin-top: 4px; }
.word-chip .w-cn { font-size: 12px; color: var(--muted); margin-top: 1px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: #E8DED2; flex: 0 0 auto; }
.dot.l1 { background: #FFD08A; } .dot.l2 { background: #FFB067; } .dot.l3 { background: #FF8A3D; }
.dot.l4 { background: #16B36B; } .dot.l5 { background: #0C8A50; }

.lesson { background: #fff; border: 1px solid var(--line); border-radius: var(--r-lg); padding: 14px; margin-bottom: 10px; box-shadow: var(--shadow-sm); }
.lesson-head { display: flex; align-items: center; gap: 10px; width: 100%; background: none; border: none; text-align: left; padding: 0; }
.lesson-head .l-num {
  width: 32px; height: 32px; border-radius: 11px; background: var(--soft);
  color: var(--c); font-weight: 900; display: grid; place-items: center; font-size: 14px; flex: 0 0 auto;
}
.lesson-head h3 { font-size: 15.5px; }
.lesson-head small { display: block; color: var(--muted); font-size: 12px; font-weight: 500; }
.lesson-body { margin-top: 12px; display: grid; gap: 2px; }
.line {
  display: grid; grid-template-columns: 26px 1fr auto; gap: 8px; align-items: start;
  padding: 8px 6px; border-radius: 12px; border: none; background: none; text-align: left; width: 100%;
}
.line:hover { background: #FFFAF3; }
.line .l-play { font-size: 15px; color: var(--brand); line-height: 1.4; }
.line .l-en { font-size: 15px; font-weight: 650; line-height: 1.45; }
.line .l-cn { display: none; font-size: 12.5px; color: var(--muted); margin-top: 2px; }
.line.show-cn .l-cn { display: block; }
.line .l-spk { font-size: 15px; opacity: .55; }

.phonics-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.ph-item {
  background: #fff; border: 1px solid var(--line); border-radius: var(--r-md);
  padding: 12px 8px; text-align: center; box-shadow: var(--shadow-sm);
}
.ph-item .ph-l { font-size: 22px; font-weight: 900; color: var(--c); }
.ph-item .ph-emoji { font-size: 22px; }
.ph-item .ph-w { font-size: 12.5px; font-weight: 700; }
.ph-item .ph-s { font-size: 11px; color: var(--muted); }
.phonics-note { font-size: 12.5px; color: var(--muted); margin-bottom: 10px; }

/* ---------- 单词卡 ---------- */
.study-top { display: flex; align-items: center; gap: 10px; margin-bottom: 6px; }
.study-bar { flex: 1; height: 8px; border-radius: 999px; background: #F1E7DA; overflow: hidden; }
.study-bar i { display: block; height: 100%; background: linear-gradient(90deg, #FFC583, #FF8A3D); transition: width .3s; }
.flash-stage { display: grid; place-items: center; min-height: 58vh; padding: 8px 0; }
.flashcard {
  width: min(560px, 100%); background: #fff; border-radius: var(--r-xl);
  padding: 26px 22px; text-align: center; box-shadow: var(--shadow-lg);
  border: 1px solid var(--line); position: relative; overflow: hidden;
}
.flashcard::before {
  content: ""; position: absolute; inset: 0 0 auto 0; height: 6px;
  background: linear-gradient(90deg, var(--c), color-mix(in srgb, var(--c) 30%, #fff));
}
.fc-emoji { font-size: 64px; line-height: 1; margin-top: 6px; animation: pop .4s ease; }
@keyframes pop { 0% { transform: scale(.6); opacity: 0; } 70% { transform: scale(1.08); } 100% { transform: scale(1); } }
.fc-word { font-size: clamp(30px, 7vw, 46px); font-weight: 900; letter-spacing: .5px; margin-top: 8px; line-height: 1.15; }
.fc-ipa { color: var(--muted); font-size: 15px; margin-top: 2px; }
.fc-answer { margin-top: 14px; padding-top: 14px; border-top: 1px dashed var(--line); }
.fc-cn { font-size: 21px; font-weight: 800; color: var(--ink); }
.fc-ex { margin-top: 10px; font-size: 14px; line-height: 1.5; }
.fc-ex b { color: var(--c); }
.fc-ex small { display: block; color: var(--muted); font-size: 12.5px; margin-top: 2px; }
.fc-tip { margin-top: 12px; font-size: 12px; color: #9A7B58; background: #FFF7EA; border-radius: 12px; padding: 8px 10px; }
.fc-hidden { filter: blur(7px); opacity: .55; user-select: none; }
.study-actions { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 18px; }
.study-actions .btn { padding: 14px 8px; font-size: 14px; flex-direction: column; gap: 2px; }
.study-actions .btn small { font-size: 10.5px; font-weight: 600; opacity: .75; }

/* ---------- 练习 ---------- */
.quiz-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.q-count { font-size: 13px; font-weight: 800; color: var(--muted); }
.q-dots { display: flex; gap: 4px; flex: 1; justify-content: center; }
.q-dot { width: 7px; height: 7px; border-radius: 50%; background: #EADFD2; }
.q-dot.done { background: var(--green); }
.q-dot.now { background: var(--brand); transform: scale(1.35); }
.question-card { background: #fff; border-radius: var(--r-xl); padding: 22px; box-shadow: var(--shadow); border: 1px solid var(--line); }
.q-type { font-size: 11px; font-weight: 800; letter-spacing: 1px; color: var(--brand-deep); text-transform: uppercase; }
.q-title { font-size: 20px; font-weight: 850; margin-top: 6px; line-height: 1.4; }
.q-sub { font-size: 13px; color: var(--muted); margin-top: 4px; }
.q-emoji { font-size: 54px; text-align: center; margin: 12px 0; }
.q-audio-btn {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  width: 100%; padding: 18px; border-radius: 20px; border: 2px dashed #FFC79B;
  background: #FFFBF5; font-weight: 800; color: var(--brand-deep); font-size: 16px; margin: 12px 0;
}
.q-audio-btn.playing { border-style: solid; background: #FFF1E4; }
.options { display: grid; gap: 10px; margin-top: 14px; }
.option {
  display: flex; align-items: center; gap: 12px;
  padding: 15px 16px; border-radius: 18px; background: #fff;
  border: 2px solid var(--line); font-size: 17px; font-weight: 750; text-align: left;
  transition: border-color .15s, background .15s, transform .12s;
}
.option:hover:not(:disabled) { border-color: #FFC79B; background: #FFFBF5; transform: translateX(2px); }
.option .o-key {
  width: 28px; height: 28px; border-radius: 9px; background: #F6EFE6;
  display: grid; place-items: center; font-size: 12px; font-weight: 900; color: var(--muted); flex: 0 0 auto;
}
.option.correct { border-color: var(--green); background: #E9FBF2; }
.option.correct .o-key { background: var(--green); color: #fff; }
.option.wrong { border-color: var(--red); background: #FDEDED; animation: shake .35s; }
.option.wrong .o-key { background: var(--red); color: #fff; }
.option.dim { opacity: .55; }
@keyframes shake { 0%, 100% { transform: translateX(0); } 25% { transform: translateX(-5px); } 75% { transform: translateX(5px); } }
.q-feedback { margin-top: 14px; padding: 14px; border-radius: 16px; font-size: 14px; font-weight: 650; display: none; }
.q-feedback.show { display: block; animation: rise .25s; }
.q-feedback.ok { background: #E9FBF2; color: #0C7A45; }
.q-feedback.no { background: #FDEDED; color: #A83232; }
.q-feedback b { font-weight: 900; }

.spell-slots { display: flex; justify-content: center; gap: 8px; margin: 18px 0; flex-wrap: wrap; }
.slot {
  width: 42px; height: 52px; border-radius: 12px; background: #fff;
  border: 2px dashed #E2D6C6; display: grid; place-items: center;
  font-size: 24px; font-weight: 900; text-transform: lowercase;
}
.slot.filled { border-style: solid; border-color: var(--brand); background: #FFFBF5; }
.letter-bank { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-top: 10px; }
.letter-key {
  width: 44px; height: 48px; border-radius: 12px; background: #fff;
  border: 2px solid var(--line); font-size: 20px; font-weight: 900; text-transform: lowercase;
  box-shadow: 0 3px 0 #EFE4D4;
}
.letter-key:hover { background: #FFFBF5; }
.letter-key.used { opacity: .25; pointer-events: none; }
.order-line {
  min-height: 62px; border-radius: 16px; background: #fff; border: 2px dashed #E2D6C6;
  padding: 10px; display: flex; flex-wrap: wrap; gap: 8px; align-items: center;
}
.order-line .placeholder { color: var(--muted); font-size: 13px; }
.word-token {
  padding: 8px 13px; border-radius: 12px; background: #FFF1E4; border: 1px solid #FFD3AC;
  font-weight: 800; font-size: 15px; color: #8A4A14;
}
.word-token:hover { background: #FFE6CC; }
.token-bank { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; min-height: 44px; }
.token-bank .word-token { background: #fff; border-color: var(--line); color: var(--ink); }
.token-bank .word-token:hover { border-color: #FFC79B; background: #FFFBF5; }

/* ---------- 结果页 ---------- */
.result { text-align: center; padding: 26px 18px; }
.result-emoji { font-size: 76px; animation: pop .5s; }
.result h2 { font-size: 24px; margin-top: 6px; }
.result .score { font-size: 46px; font-weight: 900; color: var(--brand); line-height: 1.1; margin: 6px 0; }
.result-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 18px 0; }
.result-stat { background: #FFFBF5; border-radius: 16px; padding: 12px 6px; }
.result-stat b { display: block; font-size: 22px; }
.result-stat small { font-size: 11.5px; color: var(--muted); }

/* ---------- 跟读 ---------- */
.speak-card { background: #fff; border-radius: var(--r-xl); padding: 22px; box-shadow: var(--shadow); border: 1px solid var(--line); text-align: center; }
.speak-en { font-size: clamp(22px, 5.4vw, 30px); font-weight: 850; line-height: 1.4; letter-spacing: .2px; }
.speak-cn { color: var(--muted); font-size: 14px; margin-top: 8px; }
.speak-tools { display: flex; justify-content: center; gap: 10px; margin: 16px 0 4px; flex-wrap: wrap; }
.mic-wrap { display: grid; place-items: center; margin: 22px 0 8px; }
.mic-btn {
  width: 88px; height: 88px; border-radius: 50%; border: none; font-size: 34px;
  background: linear-gradient(140deg, #FF9F5A, #FF6B2C); color: #fff;
  box-shadow: 0 14px 28px rgba(255, 107, 44, .32);
  transition: transform .15s;
}
.mic-btn:active { transform: scale(.94); }
.mic-btn.rec { background: linear-gradient(140deg, #FF6B6B, #E23B3B); animation: pulse 1.2s infinite; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(226, 59, 59, .45); } 70% { box-shadow: 0 0 0 22px rgba(226, 59, 59, 0); } 100% { box-shadow: 0 0 0 0 rgba(226, 59, 59, 0); } }
.mic-hint { font-size: 12.5px; color: var(--muted); margin-top: 8px; min-height: 20px; }
.wave { display: flex; gap: 4px; align-items: flex-end; height: 28px; justify-content: center; margin-top: 8px; }
.wave i { width: 5px; border-radius: 3px; background: #FFB37A; animation: wave .9s ease-in-out infinite; }
.wave i:nth-child(2) { animation-delay: .12s; } .wave i:nth-child(3) { animation-delay: .24s; }
.wave i:nth-child(4) { animation-delay: .36s; } .wave i:nth-child(5) { animation-delay: .48s; }
@keyframes wave { 0%, 100% { height: 8px; } 50% { height: 26px; } }
.score-ring { --p: 0; width: 92px; height: 92px; border-radius: 50%; margin: 10px auto; background: conic-gradient(var(--green) calc(var(--p) * 1%), #F1E9DE 0); display: grid; place-items: center; }
.score-ring b { width: 72px; height: 72px; border-radius: 50%; background: #fff; display: grid; place-items: center; font-size: 24px; font-weight: 900; }
.self-rate { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 10px; }

/* ---------- 复习 / 我的 ---------- */
.list { display: grid; gap: 10px; }
.list-item { background: #fff; border: 1px solid var(--line); border-radius: var(--r-md); padding: 13px 15px; display: flex; align-items: center; gap: 12px; box-shadow: var(--shadow-sm); }
.list-item .li-emoji { font-size: 22px; }
.list-item .li-en { font-weight: 800; }
.list-item .li-cn { font-size: 12px; color: var(--muted); }
.list-item .li-right { margin-left: auto; display: flex; align-items: center; gap: 8px; }

.stat-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.stat-card { background: #fff; border: 1px solid var(--line); border-radius: var(--r-lg); padding: 14px; box-shadow: var(--shadow-sm); }
.stat-card b { display: block; font-size: 26px; line-height: 1.2; }
.stat-card small { color: var(--muted); font-size: 12px; }
.stat-card .s-ico { font-size: 18px; }

.chart { display: flex; align-items: flex-end; gap: 10px; height: 120px; padding: 10px 4px 0; }
.chart .bar-col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; height: 100%; justify-content: flex-end; }
.chart .bar { width: 100%; max-width: 34px; border-radius: 8px 8px 4px 4px; background: linear-gradient(180deg, #FFC583, #FF8A3D); min-height: 4px; transition: height .5s; }
.chart .bar.zero { background: #F1E9DE; }
.chart .bar-label { font-size: 10.5px; color: var(--muted); }

.badge-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.badge-item { background: #fff; border: 1px solid var(--line); border-radius: var(--r-md); padding: 12px 8px; text-align: center; }
.badge-item.locked { filter: grayscale(1); opacity: .45; }
.badge-item .b-emoji { font-size: 30px; }
.badge-item .b-name { font-size: 12px; font-weight: 800; margin-top: 4px; }
.badge-item .b-desc { font-size: 10px; color: var(--muted); line-height: 1.3; margin-top: 2px; }

.empty { text-align: center; padding: 32px 16px; color: var(--muted); }
.empty .e-emoji { font-size: 48px; }

/* ---------- 模态 / toast / 彩带 ---------- */
.modal-root { position: fixed; inset: 0; z-index: 60; display: none; }
.modal-root.open { display: block; }
.modal-mask { position: absolute; inset: 0; background: rgba(34, 48, 60, .38); backdrop-filter: blur(3px); }
.modal-card {
  position: absolute; left: 50%; bottom: 0; transform: translateX(-50%);
  width: min(560px, 100%); max-height: 86vh; overflow: auto;
  background: #fff; border-radius: 26px 26px 0 0; padding: 20px;
  animation: sheet .3s cubic-bezier(.2, .9, .3, 1);
}
@keyframes sheet { from { transform: translate(-50%, 30px); opacity: .6; } to { transform: translate(-50%, 0); opacity: 1; } }
.modal-close { position: absolute; right: 14px; top: 12px; background: #F6EFE6; border: none; width: 34px; height: 34px; border-radius: 50%; font-size: 16px; }

.toast {
  position: fixed; left: 50%; bottom: calc(96px + var(--safe-b)); transform: translate(-50%, 16px);
  background: rgba(34, 48, 60, .94); color: #fff; font-size: 13.5px; font-weight: 650;
  padding: 10px 18px; border-radius: 999px; opacity: 0; pointer-events: none;
  transition: opacity .25s, transform .25s; z-index: 70; max-width: 86vw; text-align: center;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.confetti-layer { position: fixed; inset: 0; pointer-events: none; z-index: 65; overflow: hidden; }
.confetti-piece {
  position: absolute; top: -20px; width: 9px; height: 14px; border-radius: 2px;
  animation: fall linear forwards;
}
@keyframes fall {
  from { transform: translateY(-10vh) rotate(0); opacity: 1; }
  to { transform: translateY(105vh) rotate(720deg); opacity: .9; }
}

/* ---------- 桌面端 ---------- */
@media (min-width: 980px) {
  .topbar { padding: 12px 28px; }
  .brand-text strong { font-size: 18px; }
  .layout {
    display: grid; grid-template-columns: 228px minmax(0, 1fr); gap: 26px;
    max-width: 1180px; margin: 0 auto; padding: 22px 28px 48px;
  }
  .side { display: block; position: sticky; top: 92px; align-self: start; }
  .side-nav { background: #fff; border: 1px solid var(--line); border-radius: var(--r-lg); padding: 8px; box-shadow: var(--shadow-sm); display: grid; gap: 2px; }
  .nav-item { display: flex; align-items: center; gap: 10px; padding: 11px 12px; border-radius: 14px; font-size: 14px; font-weight: 700; color: var(--ink-2); }
  .nav-item:hover { background: #FFF6EA; }
  .nav-item.active { background: var(--brand-soft); color: var(--brand-deep); }
  .nav-ico { font-size: 18px; width: 22px; text-align: center; }
  .side-tip { margin-top: 14px; background: linear-gradient(160deg, #FFF3E2, #FFFCF7); border: 1px solid #F6E3CC; border-radius: var(--r-lg); padding: 14px; font-size: 12.5px; color: #8B6B4A; }
  .side-tip-emoji { font-size: 22px; margin-bottom: 4px; }
  .tabbar { display: none; }
  .main { padding: 0 0 40px; max-width: none; }
  .unit-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .word-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .phonics-grid { grid-template-columns: repeat(6, 1fr); }
  .hero { padding: 28px; }
  .hero h1 { font-size: 27px; }
  .hero-dino { font-size: 122px; right: 26px; }
  .quick-grid { grid-template-columns: repeat(4, 1fr); }
  .stat-grid { grid-template-columns: repeat(4, 1fr); }
  .modal-card { top: 50%; bottom: auto; border-radius: 26px; transform: translate(-50%, -50%); animation: modalIn .25s ease; }
  @keyframes modalIn { from { opacity: 0; transform: translate(-50%, -46%); } to { opacity: 1; transform: translate(-50%, -50%); } }
  .toast { bottom: 40px; }
}

@media (max-width: 380px) {
  .hero-dino { font-size: 76px; opacity: .9; }
  .unit-grid { grid-template-columns: 1fr; }
  .quick-grid { grid-template-columns: repeat(3, 1fr); }
}

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

[hidden]{display:none !important;}

/* 细节修正 */
.flashcard .icon-btn { margin: 14px auto 0; }
.flash-stage { min-height: 48vh; }
@media (max-width: 700px) {
  .hero-dino { font-size: 42px; top: 14px; right: 14px; bottom: auto; opacity: .95; }
  .hero { padding: 18px; padding-top: 20px; }
  .unit-hero .u-emoji { font-size: 52px; opacity: .9; }
}
.chart .bar-col { justify-content: flex-end; }
.chart .bar { flex: 0 0 auto; }

.type-input {
  width: 100%; padding: 16px; border-radius: 16px; border: 2px solid #E9DCCB;
  background: #FFFBF5; font-size: 24px; font-weight: 800; text-align: center;
  letter-spacing: 2px; margin-top: 8px;
}
.type-input:focus { border-color: #FFB067; outline: none; background: #fff; }
.type-input.ok { border-color: #16B36B; background: #E9FBF2; color: #0C7A45; }
.type-input.no { border-color: #EF5B5B; background: #FDEDED; color: #A83232; }
.tabs { flex-wrap: wrap; overflow: visible; }
.result .row { flex-wrap: wrap; gap: 8px; }
@media (max-width: 420px) {
  .result .row .btn { padding: 12px 14px; font-size: 14px; }
}

/* 桌面端：修复 .main 因 auto 外边距不拉伸的问题，并限制阅读宽度 */
@media (min-width: 980px) {
  .layout > .main { width: 100%; margin: 0; }
  .quiz-head, .question-card, .speak-card, .result, .study-top, .flash-stage { max-width: 720px; margin-left: auto; margin-right: auto; }
  .unit-hero { padding-right: 92px; }
  .unit-hero .u-emoji { right: 16px; bottom: 14px; font-size: 56px; }
}
.unit-hero .u-goals { position: relative; z-index: 2; }

/* iPhone 刘海 / 灵动岛安全区 */
@media (max-width: 979px) {
  .topbar { padding-top: calc(10px + env(safe-area-inset-top, 0px)); }
}
