/* ============================================================
   En Buddy 2.0 · design system
   面向 8–10 岁：大圆角、厚边框、软阴影、低饱和高对比
   ============================================================ */
*,
*::before,
*::after { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

:root {
  --ink: #25233a;
  --ink-2: #3d3a57;
  --sub: #6f6b8a;
  --muted: #9b97b5;
  --line: #ece5f5;
  --cream: #fdf8f0;
  --paper: #ffffff;

  --blue: #4aa8ff;
  --blue-d: #2f7fe0;
  --blue-l: #e8f3ff;
  --green: #22bd8b;
  --green-d: #159a70;
  --green-l: #e9fbf3;
  --yellow: #ffc94d;
  --yellow-d: #f0a800;
  --coral: #ff7a59;
  --coral-d: #d9492a;
  --coral-l: #fff0ec;
  --purple: #8b7cff;
  --pink: #ff8fb1;

  --r-sm: 14px;
  --r: 20px;
  --r-lg: 26px;
  --r-xl: 32px;
  --shadow-s: 0 4px 12px rgba(37, 35, 58, .07);
  --shadow: 0 10px 24px rgba(37, 35, 58, .09);
  --shadow-l: 0 18px 38px rgba(37, 35, 58, .13);
  --ease: cubic-bezier(.22, .61, .36, 1);
  --pop: cubic-bezier(.34, 1.56, .64, 1);
}

html, body { margin: 0; height: 100%; }
body {
  font-family: "PingFang SC", "Microsoft YaHei", system-ui, -apple-system, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--cream);
  -webkit-font-smoothing: antialiased;
  overscroll-behavior-y: none;
}
body::before {
  content: "";
  position: fixed; inset: 0; z-index: -1;
  background:
    radial-gradient(800px 460px at 8% -8%, #dcebff 0%, rgba(220, 235, 255, 0) 62%),
    radial-gradient(700px 520px at 96% 4%, #ffe8d3 0%, rgba(255, 232, 211, 0) 58%),
    var(--cream);
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; }
a { color: var(--blue-d); text-decoration: none; }
h1, h2, h3, h4, p { margin: 0; }
img { display: block; max-width: 100%; }
::selection { background: #ffdba8; }

/* ---------- layout ---------- */
.app { min-height: 100%; display: flex; flex-direction: column; }
.wrap { width: 100%; max-width: 560px; margin: 0 auto; padding: 0 16px; }
.wrap.wide { max-width: 1120px; }
.page { flex: 1; padding-bottom: 96px; animation: pageIn .32s var(--ease) both; }
@keyframes pageIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.page.tight { padding-bottom: 24px; }

.topbar {
  display: flex; align-items: center; gap: 10px;
  padding: max(10px, env(safe-area-inset-top)) 16px 10px;
  width: 100%; max-width: 560px; margin: 0 auto;
}
.topbar.wide { max-width: 1120px; }
.topbar .spacer { flex: 1; }
.brand { display: flex; align-items: center; gap: 10px; }
.brand .logo { width: 40px; height: 40px; border-radius: 50%; border: 3px solid #fff; box-shadow: var(--shadow-s); object-fit: cover; }
.brand b { font-size: 16px; letter-spacing: .2px; }
.brand span { display: block; font-size: 11px; color: var(--muted); margin-top: 1px; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 0; border-radius: 18px; padding: 14px 18px;
  font-weight: 900; font-size: 16px; color: #fff;
  background: linear-gradient(145deg, #5fd3a4, var(--green));
  box-shadow: 0 5px 0 var(--green-d), 0 12px 22px rgba(34, 189, 139, .28);
  transition: transform .12s var(--ease), box-shadow .12s var(--ease), filter .2s;
  user-select: none;
}
.btn:active { transform: translateY(3px); box-shadow: 0 2px 0 var(--green-d); }
.btn:disabled { opacity: .5; filter: grayscale(.3); box-shadow: none; }
.btn.blue { background: linear-gradient(145deg, #6fc0ff, var(--blue)); box-shadow: 0 5px 0 var(--blue-d), 0 12px 22px rgba(74, 168, 255, .3); }
.btn.blue:active { box-shadow: 0 2px 0 var(--blue-d); }
.btn.coral { background: linear-gradient(145deg, #ff9a72, var(--coral)); box-shadow: 0 5px 0 var(--coral-d), 0 12px 22px rgba(255, 122, 89, .3); }
.btn.ghost { background: #fff; color: var(--ink); box-shadow: var(--shadow-s); border: 2px solid var(--line); }
.btn.ghost:active { transform: translateY(2px); box-shadow: none; }
.btn.sm { padding: 9px 14px; font-size: 13px; border-radius: 14px; box-shadow: 0 3px 0 var(--green-d); }
.btn.blue.sm { box-shadow: 0 3px 0 var(--blue-d); }
.btn.block { width: 100%; }
.btn.icon { width: 44px; height: 44px; padding: 0; border-radius: 14px; }
.btn .ico { width: 20px; height: 20px; }

.iconbtn {
  width: 42px; height: 42px; border-radius: 14px; display: grid; place-items: center;
  background: #fff; box-shadow: var(--shadow-s); border: 1px solid var(--line); color: var(--ink);
  transition: transform .12s var(--ease);
}
.iconbtn:active { transform: scale(.94); }
.iconbtn svg { width: 21px; height: 21px; }

.chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 13px; border-radius: 999px; background: #fff;
  box-shadow: var(--shadow-s); font-size: 13px; font-weight: 800; color: var(--sub);
  border: 1px solid transparent; white-space: nowrap;
}
.chip.on { background: var(--ink); color: #fff; }
.chip.line { background: #fff; border-color: var(--line); }
.chip.blue { background: var(--blue-l); color: var(--blue-d); }
.chip.green { background: var(--green-l); color: var(--green-d); }
.chip.coral { background: var(--coral-l); color: var(--coral-d); }

/* ---------- inputs ---------- */
.field { margin-bottom: 14px; }
.field label { display: block; font-size: 12.5px; font-weight: 800; color: var(--sub); margin: 0 4px 6px; }
.input, .select, .textarea {
  width: 100%; border: 2px solid var(--line); background: #fff;
  border-radius: 16px; padding: 13px 15px; font-size: 16px; font-weight: 700; color: var(--ink);
  outline: none; transition: border-color .2s, box-shadow .2s;
}
.input:focus, .select:focus, .textarea:focus { border-color: var(--blue); box-shadow: 0 0 0 4px rgba(74, 168, 255, .12); }
.input::placeholder { color: #c3bfd4; font-weight: 600; }
.textarea { min-height: 120px; resize: vertical; line-height: 1.6; font-weight: 600; font-size: 14px; }
.select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%236f6b8a' stroke-width='2.4' stroke-linecap='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 14px center; padding-right: 40px; }

/* ---------- cards ---------- */
.card { background: #fff; border-radius: var(--r-lg); box-shadow: var(--shadow-s); padding: 16px; min-width: 0; }
.card.pad-lg { padding: 20px; }
.card.flat { box-shadow: none; border: 2px solid var(--line); }
.card.hover { transition: transform .18s var(--pop), box-shadow .2s; }
.card.hover:active { transform: translateY(-2px); box-shadow: var(--shadow); }

.row { display: flex; align-items: center; gap: 10px; }
.row.between { justify-content: space-between; }
.col { display: flex; flex-direction: column; gap: 10px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.grid2 > * { min-width: 0; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.mt8 { margin-top: 8px; } .mt12 { margin-top: 12px; } .mt16 { margin-top: 16px; } .mt20 { margin-top: 20px; }
.mb8 { margin-bottom: 8px; } .mb12 { margin-bottom: 12px; }
.muted { color: var(--muted); }
.sub { color: var(--sub); }
.small { font-size: 12px; }
.center { text-align: center; }
.hide { display: none !important; }

/* ---------- rings & progress ---------- */
.ring {
  --p: 0; --size: 64px; --stroke: 7px; --fill: var(--green);
  width: var(--size); height: var(--size); border-radius: 50%; flex: 0 0 auto;
  background: conic-gradient(var(--fill) calc(var(--p) * 1%), #eee8f6 0);
  display: grid; place-items: center; position: relative;
}
.ring::after { content: ""; position: absolute; inset: var(--stroke); border-radius: 50%; background: #fff; }
.ring > * { position: relative; z-index: 1; font-weight: 900; font-size: calc(var(--size) * .26); }
.ring.blue { --fill: var(--blue); }
.ring.yellow { --fill: var(--yellow-d); }
.ring.coral { --fill: var(--coral); }
.ring.onhero { --fill: #fff; background: conic-gradient(#fff calc(var(--p) * 1%), rgba(255,255,255,.28) 0); }
.ring.onhero::after { background: #4b95ff; }
.ring.onhero > * { color: #fff; font-size: calc(var(--size) * .22); }

.bar { height: 8px; border-radius: 999px; background: #f0ecf8; overflow: hidden; }
.bar > i { display: block; height: 100%; border-radius: 999px; background: linear-gradient(90deg, #5bd6a8, var(--green)); transition: width .5s var(--ease); }
.bar.blue > i { background: linear-gradient(90deg, #7cc7ff, var(--blue)); }
.bar.coral > i { background: linear-gradient(90deg, #ffab8f, var(--coral)); }
.bar.yellow > i { background: linear-gradient(90deg, #ffd873, var(--yellow-d)); }

/* ---------- toast / modal ---------- */
.toast {
  position: fixed; left: 50%; bottom: calc(96px + env(safe-area-inset-bottom)); transform: translateX(-50%);
  background: rgba(37, 35, 58, .94); color: #fff; padding: 11px 16px; border-radius: 14px;
  font-size: 13.5px; font-weight: 700; z-index: 90; box-shadow: var(--shadow); max-width: 88vw;
  animation: toastIn .24s var(--pop) both;
}
@keyframes toastIn { from { opacity: 0; transform: translate(-50%, 10px); } to { opacity: 1; transform: translate(-50%, 0); } }

.overlay {
  position: fixed; inset: 0; z-index: 80; background: rgba(28, 24, 44, .45);
  display: flex; align-items: flex-end; justify-content: center; padding: 0;
  animation: fadeIn .2s both;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.sheet {
  width: 100%; max-width: 560px; max-height: 88vh; overflow: auto;
  background: var(--cream); border-radius: 28px 28px 0 0; padding: 20px 18px calc(20px + env(safe-area-inset-bottom));
  animation: sheetIn .3s var(--ease) both;
}
@keyframes sheetIn { from { transform: translateY(24px); opacity: .6; } to { transform: none; opacity: 1; } }
.sheet .grab { width: 44px; height: 5px; border-radius: 99px; background: #ded6ee; margin: -6px auto 14px; }
.modal { background: var(--cream); border-radius: 28px; width: min(92vw, 520px); max-height: 88vh; overflow: auto; padding: 20px 18px; animation: popIn .28s var(--pop) both; margin: 0 0 8vh; }
.overlay.center { align-items: center; }

/* ---------- bottom nav ---------- */
.tabbar {
  position: fixed; left: 50%; bottom: calc(10px + env(safe-area-inset-bottom)); transform: translateX(-50%);
  width: min(calc(100% - 24px), 536px); height: 68px; z-index: 40;
  background: rgba(255, 255, 255, .94); backdrop-filter: blur(12px);
  border-radius: 24px; box-shadow: 0 12px 26px rgba(37, 35, 58, .15);
  display: flex; align-items: center; justify-content: space-around; padding: 0 8px;
}
.tab { display: flex; flex-direction: column; align-items: center; gap: 3px; font-size: 10px; font-weight: 800; color: #b3aecb; min-width: 56px; }
.tab.on { color: var(--blue-d); }
.tab svg { width: 23px; height: 23px; }
.tab .fab {
  width: 48px; height: 48px; border-radius: 17px; margin-top: -24px;
  background: linear-gradient(145deg, #ff9a72, var(--coral)); color: #fff;
  display: grid; place-items: center; box-shadow: 0 8px 16px rgba(255, 107, 61, .36);
}
.tab .fab svg { width: 24px; height: 24px; }
.tabbar.teacher { justify-content: space-around; }

/* ============================================================
   学生端
   ============================================================ */
.hello { display: flex; align-items: center; gap: 10px; }
.hello .ava { width: 44px; height: 44px; border-radius: 50%; background: #fff; border: 3px solid #fff; box-shadow: var(--shadow-s); display: grid; place-items: center; font-size: 22px; overflow: hidden; flex: 0 0 auto; }
.hello .ava img { width: 100%; height: 100%; object-fit: cover; }
.hello .txt { line-height: 1.2; }
.hello .txt span { font-size: 11.5px; color: var(--muted); }
.hello .txt b { display: block; font-size: 17px; margin-top: 2px; }
.stat-pill { display: flex; align-items: center; gap: 4px; background: #fff; border-radius: 999px; padding: 7px 11px; font-size: 13px; font-weight: 900; box-shadow: var(--shadow-s); }
.stat-pill.fire { color: #ff6b3d; }
.stat-pill.coin { color: #e79b00; }

.hero {
  position: relative; border-radius: var(--r-xl); padding: 18px; color: #fff; overflow: hidden;
  background: linear-gradient(135deg, #5cb4ff 0%, #3f8bff 55%, #6f7cff 100%);
  box-shadow: 0 16px 30px rgba(63, 139, 255, .3);
}
.hero::before, .hero::after { content: ""; position: absolute; border-radius: 50%; background: rgba(255, 255, 255, .14); }
.hero::before { width: 190px; height: 190px; right: -50px; top: -70px; }
.hero::after { width: 120px; height: 120px; right: 40px; bottom: -64px; }
.hero .tag { position: relative; display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 800; background: rgba(255, 255, 255, .22); padding: 5px 10px; border-radius: 999px; }
.hero h2 { position: relative; margin: 9px 0 3px; font-size: 22px; letter-spacing: .2px; }
.hero p { position: relative; margin: 0; font-size: 12px; line-height: 1.5; opacity: .9; }
.hero .row { position: relative; margin-top: 12px; }
.hero .row .txt { flex: 1; font-size: 12px; line-height: 1.45; opacity: .95; }
.hero .go { border: 0; background: #fff; color: var(--blue-d); font-weight: 900; font-size: 14px; padding: 12px 18px; border-radius: 999px; box-shadow: 0 4px 0 #d8e6fb; white-space: nowrap; }
.hero .go:active { transform: translateY(2px); box-shadow: 0 2px 0 #d8e6fb; }

.sec-head { display: flex; align-items: center; justify-content: space-between; margin: 18px 2px 10px; }
.sec-head h3 { font-size: 16px; letter-spacing: .2px; }
.sec-head a, .sec-head button { font-size: 12px; color: var(--muted); font-weight: 800; }

.books { display: flex; gap: 8px; margin-bottom: 12px; }
.books .chip { flex: 1; justify-content: center; padding: 9px 0; font-size: 13px; }

.path { position: relative; }
.path .link { height: 18px; width: 0; border-left: 4px dotted #ddd5ee; margin: 0 0 0 31px; }
.unit-node { display: flex; align-items: center; gap: 12px; margin-bottom: 10px; }
.unit-node.right { flex-direction: row-reverse; text-align: right; }
.unit-node .bubble {
  width: 62px; height: 62px; border-radius: 21px; flex: 0 0 auto; display: grid; place-items: center;
  font-weight: 900; font-size: 18px; background: #fff; border: 3px solid #fff; box-shadow: var(--shadow); position: relative;
}
.unit-node .bubble.done { background: linear-gradient(145deg, #63e0b4, var(--green)); color: #fff; box-shadow: 0 8px 18px rgba(34, 189, 139, .35); }
.unit-node .bubble.now { background: linear-gradient(145deg, #ffd873, #ffb020); color: #7a4b00; box-shadow: 0 10px 22px rgba(255, 176, 32, .4); transform: scale(1.05); }
.unit-node .bubble.lock { background: #efeaf6; color: #b3aecb; box-shadow: none; }
.unit-node .bubble .badge { position: absolute; right: -6px; top: -6px; background: #fff; border-radius: 999px; font-size: 10px; padding: 3px 6px; color: #e79b00; box-shadow: var(--shadow-s); }
.unit-node .meta { flex: 1; min-width: 0; }
.unit-node .meta b { display: block; font-size: 14px; margin-bottom: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.unit-node .meta span { font-size: 11.5px; color: var(--muted); }
.unit-node .meta .bar { margin-top: 7px; }

.tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.tile { position: relative; background: #fff; border-radius: var(--r); padding: 14px; box-shadow: var(--shadow-s); overflow: hidden; }
.tile .ic { width: 36px; height: 36px; border-radius: 12px; display: grid; place-items: center; font-size: 18px; margin-bottom: 9px; }
.tile b { display: block; font-size: 14px; margin-bottom: 2px; }
.tile span { font-size: 10.5px; color: var(--muted); }
.tile .count { position: absolute; right: 12px; top: 12px; font-size: 11px; font-weight: 900; color: #fff; background: var(--coral); padding: 3px 7px; border-radius: 999px; }

/* ---------- unit detail ---------- */
.unit-hero { background: #fff; border-radius: var(--r-lg); padding: 16px; box-shadow: var(--shadow-s); display: flex; align-items: center; gap: 14px; }
.unit-hero .t { flex: 1; min-width: 0; }
.unit-hero .t h1 { font-size: 19px; line-height: 1.25; }
.unit-hero .t p { font-size: 12px; color: var(--muted); margin-top: 3px; }
.tabs { display: flex; gap: 6px; background: #fff; border-radius: 16px; padding: 5px; box-shadow: var(--shadow-s); margin: 14px 0; overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tabs button { flex: 1; min-width: 64px; padding: 9px 10px; border-radius: 12px; font-size: 13px; font-weight: 800; color: var(--sub); }
.tabs button.on { background: var(--ink); color: #fff; }

.word-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.word-card { background: #fff; border-radius: 20px; padding: 13px 12px; box-shadow: var(--shadow-s); text-align: left; position: relative; transition: transform .15s var(--pop); }
.word-card:active { transform: scale(.97); }
.word-card .em { font-size: 24px; line-height: 1; margin-bottom: 6px; }
.word-card b { display: block; font-size: 16px; letter-spacing: -.2px; word-break: break-word; }
.word-card span { display: block; font-size: 11.5px; color: var(--muted); margin-top: 2px; line-height: 1.35; }
.word-card .star { position: absolute; top: 9px; right: 10px; font-size: 11px; color: #f0a800; }
.word-card .spk { position: absolute; right: 9px; bottom: 9px; width: 28px; height: 28px; border-radius: 10px; background: var(--blue-l); color: var(--blue-d); display: grid; place-items: center; }
.word-card .spk svg { width: 15px; height: 15px; }

.sent-list { display: flex; flex-direction: column; gap: 9px; }
.sent-row { background: #fff; border-radius: 16px; padding: 12px 13px; box-shadow: var(--shadow-s); display: flex; align-items: flex-start; gap: 10px; }
.sent-row .txt { flex: 1; min-width: 0; }
.sent-row .en { font-size: 14.5px; font-weight: 800; line-height: 1.4; }
.sent-row .zh { font-size: 11.5px; color: var(--muted); margin-top: 3px; }
.sent-row .acts { display: flex; gap: 6px; }
.sent-row .acts .iconbtn { width: 34px; height: 34px; border-radius: 11px; }
.sent-row .acts .iconbtn svg { width: 17px; height: 17px; }
.sent-row .acts .iconbtn.green { background: var(--green-l); color: var(--green-d); border-color: #c9f0e1; }

.phonics-group { background: #fff; border-radius: 20px; padding: 14px; box-shadow: var(--shadow-s); margin-bottom: 10px; }
.phonics-group h4 { font-size: 14px; margin-bottom: 8px; }
.phonics-group .words { display: flex; flex-wrap: wrap; gap: 7px; }
.phonics-group .pw { background: #f7f3fd; border-radius: 10px; padding: 6px 9px; font-size: 12px; font-weight: 700; }
.phonics-group .pw span { color: var(--muted); font-weight: 600; margin-left: 4px; }

.quiz-box { background: #fff; border-radius: 20px; padding: 14px; box-shadow: var(--shadow-s); margin-bottom: 10px; }
.quiz-box .q { font-size: 14px; font-weight: 800; line-height: 1.5; margin-bottom: 10px; }
.quiz-box .opt { display: block; width: 100%; text-align: left; border: 2.5px solid var(--line); background: #fff; border-radius: 14px; padding: 12px 13px; font-size: 14px; font-weight: 700; margin-bottom: 8px; box-shadow: 0 3px 0 var(--line); transition: transform .12s; }
.quiz-box .opt:active { transform: translateY(2px); box-shadow: none; }
.quiz-box .opt.ok { border-color: var(--green); background: var(--green-l); color: var(--green-d); box-shadow: 0 3px 0 #b7ecd7; }
.quiz-box .opt.bad { border-color: var(--coral); background: var(--coral-l); color: var(--coral-d); box-shadow: 0 3px 0 #ffcfc4; }
.quiz-box .exp { font-size: 12px; color: var(--green-d); font-weight: 700; margin-top: 4px; }

.sticky-cta { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(14px + env(safe-area-inset-bottom)); width: min(calc(100% - 32px), 528px); z-index: 30; }
.unit-detail .page { padding-bottom: 28px; }

/* ---------- review ---------- */
.review { min-height: 100vh; display: flex; flex-direction: column; background: linear-gradient(180deg, #eaf4ff 0%, var(--cream) 46%); }
.review-top { display: flex; align-items: center; gap: 10px; padding: max(10px, env(safe-area-inset-top)) 16px 8px; width: 100%; max-width: 560px; margin: 0 auto; }
.review-top .bar { flex: 1; height: 12px; background: #e9e3f4; }
.review-top .hearts { font-size: 13px; letter-spacing: 1px; }
.review-main { flex: 1; width: 100%; max-width: 560px; margin: 0 auto; padding: 4px 16px 20px; display: flex; flex-direction: column; }
.ask { font-size: 17px; font-weight: 900; line-height: 1.4; padding: 2px 4px 12px; }
.ask em { font-style: normal; color: var(--blue-d); }

.flashcard { background: #fff; border-radius: 30px; padding: 22px 18px; text-align: center; box-shadow: var(--shadow-l); border: 3px solid #fff; position: relative; }
.flashcard .em { font-size: 48px; line-height: 1; }
.flashcard .w { font-size: 38px; font-weight: 900; letter-spacing: -.8px; margin: 6px 0 2px; word-break: break-word; }
.flashcard .zh { font-size: 16px; color: var(--sub); font-weight: 800; margin-top: 4px; }
.flashcard .hint { font-size: 11.5px; color: var(--muted); margin-top: 8px; font-weight: 700; }
.bigspeaker {
  width: 76px; height: 76px; border-radius: 50%; margin: 14px auto 4px; border: 0; color: #fff;
  background: linear-gradient(145deg, #6fc0ff, var(--blue)); display: grid; place-items: center;
  box-shadow: 0 9px 0 var(--blue-d), 0 18px 28px rgba(63, 139, 255, .35);
  transition: transform .1s;
}
.bigspeaker:active { transform: translateY(4px); box-shadow: 0 4px 0 var(--blue-d); }
.bigspeaker svg { width: 32px; height: 32px; }
.bigspeaker.small { width: 58px; height: 58px; box-shadow: 0 6px 0 var(--blue-d); margin: 8px auto; }
.bigspeaker.small svg { width: 25px; height: 25px; }

.options { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 14px; }
.option {
  border: 2.5px solid var(--line); background: #fff; border-radius: 20px; padding: 16px 8px;
  font-size: 17px; font-weight: 900; color: var(--ink); box-shadow: 0 4px 0 var(--line);
  transition: transform .1s; min-height: 64px; word-break: break-word;
}
.option:active { transform: translateY(3px); box-shadow: none; }
.option small { display: block; font-size: 10px; color: var(--muted); margin-top: 3px; font-weight: 700; }
.option.ok { border-color: var(--green); background: var(--green-l); color: var(--green-d); box-shadow: 0 4px 0 #b7ecd7; }
.option.bad { border-color: var(--coral); background: var(--coral-l); color: var(--coral-d); box-shadow: 0 4px 0 #ffcfc4; }
.option:disabled { opacity: .85; }

.spell-slots { display: flex; justify-content: center; gap: 6px; margin: 14px 0 10px; flex-wrap: wrap; }
.slot { width: 34px; height: 44px; border-radius: 10px; background: #f5f1fb; border: 2px solid #e6dff3; display: grid; place-items: center; font-size: 22px; font-weight: 900; text-transform: lowercase; }
.slot.filled { background: #fff; border-color: var(--blue); color: var(--blue-d); }
.slot.cursor { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(74, 168, 255, .15); }
.slot.ok { border-color: var(--green); background: var(--green-l); color: var(--green-d); }
.slot.bad { border-color: var(--coral); background: var(--coral-l); color: var(--coral-d); }
.keyboard { display: grid; grid-template-columns: repeat(6, 1fr); gap: 7px; margin-top: 10px; }
.key { height: 46px; border-radius: 12px; background: #fff; border: 2px solid var(--line); box-shadow: 0 3px 0 var(--line); font-size: 20px; font-weight: 900; text-transform: lowercase; }
.key:active { transform: translateY(2px); box-shadow: none; }
.key.used { opacity: .25; }
.spell-actions { display: flex; gap: 8px; justify-content: center; margin-top: 10px; }

.feedback {
  display: flex; gap: 10px; align-items: center; border-radius: 18px; padding: 11px 13px;
  font-size: 12.5px; font-weight: 700; line-height: 1.5; margin-top: 12px;
  border: 2px dashed #9fe6c8; background: var(--green-l); color: #147d5b;
  animation: popIn .3s var(--pop) both;
}
.feedback.bad { border-color: #ffc1b2; background: var(--coral-l); color: var(--coral-d); }
.feedback .mascot { width: 38px; height: 38px; border-radius: 50%; overflow: hidden; flex: 0 0 auto; border: 2px solid #fff; background: #fff; }
.feedback .mascot img { width: 100%; height: 100%; object-fit: cover; }
.feedback b { font-weight: 900; }

.review-bottom { width: 100%; max-width: 560px; margin: 0 auto; padding: 10px 16px calc(16px + env(safe-area-inset-bottom)); }
.result { text-align: center; padding: 30px 18px; }
.result .trophy { font-size: 64px; animation: float 2.4s ease-in-out infinite; }
@keyframes float { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-8px); } }
.result h2 { font-size: 26px; margin: 10px 0 4px; }
.result p { color: var(--sub); font-size: 13px; }
.result .score { display: flex; justify-content: center; gap: 26px; margin: 18px 0; }
.result .score b { display: block; font-size: 28px; }
.result .score span { font-size: 11px; color: var(--muted); }
.wrong-list { text-align: left; margin-top: 14px; }
.wrong-list .item { display: flex; align-items: center; gap: 8px; padding: 9px 0; border-bottom: 1px dashed var(--line); font-size: 13px; }
.wrong-list .item:last-child { border-bottom: 0; }
.wrong-list .item b { font-size: 14px; }

.empty { text-align: center; padding: 40px 20px; color: var(--muted); font-size: 13px; }
.empty .em { font-size: 44px; margin-bottom: 8px; }

/* ---------- chat ---------- */
.chat { min-height: 100%; display: flex; flex-direction: column; background: linear-gradient(180deg, #eef6ff, var(--cream) 50%); }
.chat-head { display: flex; align-items: center; gap: 10px; padding: 10px 16px; width: 100%; max-width: 560px; margin: 0 auto; }
.chat-head .ava { width: 42px; height: 42px; border-radius: 50%; overflow: hidden; border: 3px solid #fff; box-shadow: var(--shadow-s); }
.chat-head .ava img { width: 100%; height: 100%; object-fit: cover; }
.chat-head b { font-size: 15px; display: block; }
.chat-head span { font-size: 11px; color: var(--muted); }
.chat-body { flex: 1; overflow-y: auto; padding: 8px 16px 150px; width: 100%; max-width: 560px; margin: 0 auto; display: flex; flex-direction: column; gap: 10px; }
.msg { display: flex; gap: 8px; align-items: flex-end; max-width: 100%; }
.msg.user { flex-direction: row-reverse; }
.msg .head { width: 32px; height: 32px; border-radius: 50%; background: #fff; display: grid; place-items: center; font-size: 17px; box-shadow: var(--shadow-s); flex: 0 0 auto; overflow: hidden; }
.msg .head img { width: 100%; height: 100%; object-fit: cover; }
.msg .bubble { max-width: 78%; background: #fff; border-radius: 18px 18px 18px 6px; padding: 10px 13px; font-size: 14px; line-height: 1.55; box-shadow: var(--shadow-s); white-space: pre-wrap; word-break: break-word; }
.msg.user .bubble { background: var(--blue); color: #fff; border-radius: 18px 18px 6px 18px; }
.msg .tools { display: flex; gap: 4px; margin-top: 4px; }
.msg .tools button { font-size: 10px; color: var(--muted); background: #f6f2fc; border-radius: 999px; padding: 3px 8px; font-weight: 700; }
.quick { display: flex; gap: 6px; flex-wrap: wrap; padding: 0 16px 8px; width: 100%; max-width: 560px; margin: 0 auto; }
.quick button { background: #fff; border-radius: 999px; padding: 7px 11px; font-size: 11.5px; font-weight: 800; color: var(--sub); box-shadow: var(--shadow-s); }
.chat-input { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(12px + env(safe-area-inset-bottom)); width: min(calc(100% - 24px), 536px); display: flex; gap: 8px; align-items: center; background: rgba(255,255,255,.96); border-radius: 22px; padding: 8px; box-shadow: var(--shadow); z-index: 30; }
.chat-input input { flex: 1; border: 0; outline: none; background: #f6f2fb; border-radius: 14px; padding: 12px 14px; font-size: 14px; font-weight: 600; }
.chat-input .send { width: 46px; height: 46px; border-radius: 15px; background: linear-gradient(145deg, #6fc0ff, var(--blue)); color: #fff; display: grid; place-items: center; box-shadow: 0 4px 0 var(--blue-d); }
.chat-input .send:active { transform: translateY(2px); box-shadow: 0 2px 0 var(--blue-d); }
.typing { display: inline-flex; gap: 3px; }
.typing i { width: 6px; height: 6px; border-radius: 50%; background: #b9b3cc; animation: blink 1s infinite; }
.typing i:nth-child(2) { animation-delay: .15s; } .typing i:nth-child(3) { animation-delay: .3s; }
@keyframes blink { 0%, 100% { opacity: .3; transform: translateY(0); } 50% { opacity: 1; transform: translateY(-2px); } }

/* ---------- report ---------- */
.report-hero { display: flex; align-items: center; gap: 14px; background: linear-gradient(135deg, #fff3cf, #ffe3a8); border-radius: var(--r-lg); padding: 16px; box-shadow: 0 10px 22px rgba(240, 168, 0, .18); }
.report-hero .t { flex: 1; }
.report-hero .t b { display: block; font-size: 16px; }
.report-hero .t span { display: block; font-size: 11.5px; color: #8a6a2e; line-height: 1.5; margin-top: 3px; }
.mini-kpis { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 12px; }
.mini-kpis .k { background: #fff; border-radius: 18px; padding: 11px 8px; text-align: center; box-shadow: var(--shadow-s); }
.mini-kpis .k b { display: block; font-size: 20px; line-height: 1.1; }
.mini-kpis .k span { font-size: 10px; color: var(--muted); font-weight: 800; }
.weak-row { display: flex; align-items: center; gap: 9px; padding: 10px 0; border-bottom: 1px dashed var(--line); }
.weak-row:last-child { border-bottom: 0; }
.weak-row .em { width: 34px; height: 34px; border-radius: 11px; background: #f7f3fd; display: grid; place-items: center; font-size: 18px; flex: 0 0 auto; }
.weak-row .n { width: 92px; }
.weak-row .n b { display: block; font-size: 13.5px; }
.weak-row .n span { font-size: 10.5px; color: var(--muted); }
.weak-row .bar { flex: 1; }
.weak-row .pct { width: 38px; text-align: right; font-size: 11px; font-weight: 900; color: var(--muted); }
.heat { display: grid; grid-template-columns: repeat(7, 1fr); gap: 5px; }
.heat .d { aspect-ratio: 1; border-radius: 7px; background: #f1ecf8; display: grid; place-items: center; font-size: 9px; color: #b3aecb; }
.heat .d.on1 { background: #d9f7ec; color: #128059; }
.heat .d.on2 { background: #9fe8cc; color: #0c6546; }
.heat .d.on3 { background: #45d6a3; color: #fff; }

/* ---------- radar ---------- */
.radar-wrap { display: flex; justify-content: center; }
.radar { width: 100%; max-width: 340px; }
.radar .grid { fill: none; stroke: #eee8f6; stroke-width: 1.2; }
.radar .axis { stroke: #e2dbf0; stroke-width: 1; }
.radar .shape { fill: rgba(74, 168, 255, .2); stroke: var(--blue); stroke-width: 2.2; stroke-linejoin: round; }
.radar .shape.class { fill: none; stroke: var(--purple); stroke-width: 1.6; stroke-dasharray: 4 4; opacity: .8; }
.radar .dot { fill: var(--blue); }
.radar .lbl { font-size: 9.5px; font-weight: 800; fill: var(--sub); }
.radar .lbl b { font-weight: 900; }

/* ============================================================
   教师端
   ============================================================ */
.teacher-shell { display: flex; min-height: 100vh; }
.side {
  width: 210px; flex: 0 0 auto; padding: 22px 14px; background: #fff; border-right: 1px solid var(--line);
  position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: 6px;
}
.side .brand { padding: 0 8px 18px; }
.side a { display: flex; align-items: center; gap: 10px; padding: 11px 12px; border-radius: 13px; font-size: 13.5px; font-weight: 800; color: var(--sub); }
.side a.on { background: var(--blue-l); color: var(--blue-d); }
.side a svg { width: 19px; height: 19px; }
.side .spacer { flex: 1; }
.teacher-main { flex: 1; min-width: 0; padding: 22px 26px 60px; }
.teacher-head { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.teacher-head h1 { font-size: 22px; }
.teacher-head p { font-size: 12px; color: var(--muted); }
.kpi-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.kpi { background: #fff; border-radius: 20px; padding: 15px 16px; box-shadow: var(--shadow-s); }
.kpi span { font-size: 11px; color: var(--muted); font-weight: 800; }
.kpi b { display: block; font-size: 27px; margin-top: 4px; line-height: 1.1; }
.kpi em { font-style: normal; font-size: 10.5px; font-weight: 800; color: var(--green-d); }
.panel-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 14px; align-items: start; }
.panel-grid .full { grid-column: 1 / -1; }
.panel { background: #fff; border-radius: 22px; padding: 16px; box-shadow: var(--shadow-s); min-width: 0; }
.panel h3 { font-size: 14px; margin-bottom: 3px; }
.panel .desc { font-size: 11px; color: var(--muted); margin-bottom: 10px; }
.stu-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 10px; }
.stu-card { background: #fff; border-radius: 18px; padding: 12px; box-shadow: var(--shadow-s); position: relative; cursor: pointer; transition: transform .16s var(--pop); min-width: 0; overflow: hidden; }
.stu-card:active { transform: scale(.98); }
.stu-card .hd { display: flex; align-items: center; gap: 8px; }
.stu-card .fa { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; color: #fff; font-weight: 900; font-size: 13px; flex: 0 0 auto; }
.stu-card .nm { font-size: 13px; font-weight: 900; line-height: 1.15; }
.stu-card .nm span { display: block; font-size: 9.5px; color: var(--muted); margin-top: 1px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 130px; }
.stu-card .pct { position: absolute; right: 11px; top: 11px; font-size: 13px; font-weight: 900; }
.stu-card .bars { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 3px; margin-top: 9px; }
.stu-card .bars .bar { height: 5px; }
.stu-card .tag { display: inline-block; margin-top: 7px; font-size: 8.5px; font-weight: 900; padding: 2.5px 6px; border-radius: 999px; background: var(--coral-l); color: var(--coral-d); }
.stu-card .tag.ok { background: var(--green-l); color: var(--green-d); }
.trend { display: flex; align-items: flex-end; gap: 4px; height: 96px; }
.trend .col { flex: 1; display: flex; flex-direction: column-reverse; gap: 2px; height: 100%; justify-content: flex-start; }
.trend .bar2 { border-radius: 4px 4px 0 0; background: var(--blue); min-height: 0; }
.trend .bar2.r { background: var(--green); }
.trend .bar2.f { background: var(--yellow); }
.trend .bar2.c { background: var(--purple); }
.trend-x { display: flex; gap: 4px; margin-top: 4px; }
.trend-x span { flex: 1; font-size: 8px; color: var(--muted); text-align: center; }
.table { width: 100%; border-collapse: collapse; font-size: 12px; }
.table th { text-align: left; font-size: 10.5px; color: var(--muted); font-weight: 900; padding: 6px 8px; border-bottom: 1px solid var(--line); }
.table td { padding: 9px 8px; border-bottom: 1px dashed var(--line); }
.table tr:last-child td { border-bottom: 0; }
.pin { font-family: ui-monospace, Consolas, monospace; font-weight: 800; letter-spacing: 1px; color: var(--blue-d); }
.teacher-form { display: grid; grid-template-columns: 1fr 1fr auto; gap: 8px; }
.teacher-form input, .teacher-form select { padding: 10px 12px; font-size: 13px; border-radius: 12px; }
.settings-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 0; border-bottom: 1px dashed var(--line); }
.settings-row:last-child { border-bottom: 0; }
.settings-row b { display: block; font-size: 13px; }
.settings-row span { display: block; font-size: 11px; color: var(--muted); margin-top: 2px; line-height: 1.45; }
.switch { width: 50px; height: 30px; border-radius: 999px; background: #ded6ee; position: relative; flex: 0 0 auto; transition: background .2s; }
.switch.on { background: var(--green); }
.switch::after { content: ""; position: absolute; width: 24px; height: 24px; border-radius: 50%; background: #fff; top: 3px; left: 3px; transition: left .2s var(--pop); box-shadow: 0 2px 5px rgba(0,0,0,.15); }
.switch.on::after { left: 23px; }
.lock-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.lock-item { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border-radius: 10px; background: #faf7ff; font-size: 12px; font-weight: 700; }
.lock-item input { width: 17px; height: 17px; accent-color: var(--green); }

/* ---------- login ---------- */
.login { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 28px 18px; }
.login .mascot { width: 104px; height: 104px; border-radius: 50%; border: 5px solid #fff; box-shadow: var(--shadow-l); object-fit: cover; animation: float 3.2s ease-in-out infinite; }
.login h1 { font-size: 30px; margin: 14px 0 4px; letter-spacing: .5px; }
.login .slogan { font-size: 13px; color: var(--sub); margin-bottom: 20px; }
.login .card { width: 100%; max-width: 420px; padding: 20px; }
.login .alt { display: flex; justify-content: center; gap: 16px; margin-top: 16px; font-size: 12px; color: var(--muted); font-weight: 800; }
.login .alt button { color: var(--blue-d); font-weight: 900; }
.tiny { font-size: 10.5px; color: #bdb8cf; text-align: center; margin-top: 18px; line-height: 1.5; }

/* ---------- classroom ---------- */
.classroom { min-height: 100vh; background: linear-gradient(160deg, #eef6ff, #fff6ec); display: flex; flex-direction: column; }
.classroom .board-card { width: 100%; max-width: 900px; margin: 0 auto; background: #fff; border-radius: 30px; box-shadow: var(--shadow-l); padding: 28px; }
.classroom .word-big { font-size: clamp(40px, 9vw, 86px); font-weight: 900; letter-spacing: -1px; text-align: center; }
.classroom .zh-big { font-size: 22px; color: var(--sub); text-align: center; font-weight: 800; margin-top: 6px; }
.classroom .nav-row { display: flex; justify-content: center; gap: 10px; margin-top: 22px; }

/* ---------- responsive ---------- */
@media (max-width: 860px) {
  .teacher-head { display: block; }
  .teacher-head .spacer { display: none; }
  .teacher-head .row { margin-top: 8px; }
  .teacher-shell { display: block; }
  .side { position: fixed; bottom: 0; left: 0; right: 0; top: auto; height: 64px; width: 100%; border-right: 0; border-top: 1px solid var(--line); flex-direction: row; align-items: center; justify-content: space-around; padding: 6px 8px; z-index: 30; }
  .side .brand, .side .spacer { display: none; }
  .side a { flex-direction: column; gap: 2px; font-size: 9.5px; padding: 6px 8px; }
  .side a svg { width: 20px; height: 20px; }
  .teacher-main { padding: 16px 14px 90px; }
  .kpi-grid { grid-template-columns: 1fr 1fr; }
  .panel-grid { grid-template-columns: 1fr; }
  .teacher-form { grid-template-columns: 1fr; }
}
@media (max-width: 380px) {
  .word-grid { grid-template-columns: 1fr; }
  .option { font-size: 15px; }
  .flashcard .w { font-size: 32px; }
  .keyboard { grid-template-columns: repeat(5, 1fr); }
}

/* ---------- animations ---------- */
@keyframes popIn { 0% { transform: scale(.92); opacity: 0; } 100% { transform: scale(1); opacity: 1; } }
.pop { animation: popIn .3s var(--pop) both; }
@keyframes shake { 0%, 100% { transform: translateX(0); } 25% { transform: translateX(-5px); } 75% { transform: translateX(5px); } }
.shake { animation: shake .3s both; }
@keyframes confetti { 0% { transform: translateY(0) rotate(0); opacity: 1; } 100% { transform: translateY(160px) rotate(360deg); opacity: 0; } }
.confetti { position: fixed; top: 20%; width: 8px; height: 12px; border-radius: 2px; z-index: 100; animation: confetti 1.2s ease-in forwards; pointer-events: none; }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

.content-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 10px; }
.content-head > div:first-child { flex: 1; min-width: 240px; }
.unit-chips { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 6px; margin-bottom: 12px; scrollbar-width: none; }
.unit-chips::-webkit-scrollbar { display: none; }
@media (max-width: 860px) {
  .content-head { display: block; }
  .content-head .row { margin-top: 8px; flex-wrap: wrap; }
}

.sticky-cta::before {
  content: "";
  position: absolute;
  left: -16px; right: -16px; top: -26px; bottom: -16px;
  background: linear-gradient(180deg, rgba(253,248,240,0), var(--cream) 42%);
  z-index: -1;
  pointer-events: none;
}
