:root {
  --cream: #FFFDF7;
  --cream-2: #F5FCF9;
  --card: #FFFFFF;
  --mint: #7BD3B8;
  --mint-deep: #3FAE8E;
  --mint-soft: #E7F8F1;
  --peach: #FFB3A0;
  --peach-soft: #FFEDE8;
  --sun: #FFD86F;
  --sun-soft: #FFF6DC;
  --ink: #3F4B47;
  --muted: #8B9A95;
  --line: #EFEDE5;
  --radius: 22px;
  --shadow: 0 10px 30px rgba(93, 140, 124, 0.10);
  --font: "Nunito", "Quicksand", "PingFang SC", "Microsoft YaHei", system-ui, -apple-system, sans-serif;
}

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

html, body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  font-family: var(--font);
  color: var(--ink);
  background: linear-gradient(180deg, #FFFDF7 0%, #F3FBF7 55%, #EFF9F5 100%);
  background-attachment: fixed;
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
}

button, input, select, textarea { font-family: inherit; font-size: 16px; color: inherit; }
button { cursor: pointer; border: none; background: none; }
a { color: var(--mint-deep); text-decoration: none; }

.boot {
  min-height: 100vh;
  display: grid;
  place-items: center;
  color: var(--muted);
  font-size: 15px;
}

.app {
  min-height: 100vh;
  max-width: 480px;
  margin: 0 auto;
  padding: 18px 18px calc(92px + env(safe-area-inset-bottom));
  position: relative;
}

/* ---------- 通用组件 ---------- */
.card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 54px;
  padding: 0 22px;
  border-radius: 999px;
  font-weight: 700;
  font-size: 17px;
  letter-spacing: .3px;
  transition: transform .12s ease, box-shadow .12s ease, opacity .12s ease;
  background: #F1F5F3;
  color: var(--ink);
}
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .45; pointer-events: none; }
.btn.primary {
  background: linear-gradient(160deg, #8FE0C5, #56BFA3);
  color: #fff;
  box-shadow: 0 8px 20px rgba(86, 191, 163, .35);
}
.btn.peach { background: linear-gradient(160deg, #FFC7B8, #FF9E86); color: #fff; box-shadow: 0 8px 20px rgba(255, 158, 134, .3); }
.btn.ghost { background: #fff; border: 2px solid var(--line); }
.btn.block { width: 100%; }
.btn.small { min-height: 40px; padding: 0 16px; font-size: 14px; font-weight: 600; }
.btn.link { min-height: 0; padding: 6px 4px; font-size: 14px; color: var(--muted); font-weight: 600; }

.input, .select, .textarea {
  width: 100%;
  min-height: 52px;
  padding: 0 16px;
  border-radius: 16px;
  border: 2px solid var(--line);
  background: #fff;
  outline: none;
  transition: border-color .15s ease;
}
.textarea { min-height: 120px; padding: 12px 16px; line-height: 1.6; resize: vertical; }
.input:focus, .select:focus, .textarea:focus { border-color: var(--mint); }
.field { margin-bottom: 12px; }
.field label { display: block; font-size: 13px; color: var(--muted); margin: 0 0 6px 6px; }
.row { display: flex; gap: 10px; align-items: center; }
.row > * { flex: 1; min-width: 0; }
.row.tight { gap: 6px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 999px;
  background: var(--mint-soft);
  color: var(--mint-deep);
  font-size: 13px;
  font-weight: 700;
}
.chip.sun { background: var(--sun-soft); color: #B98A12; }
.chip.gray { background: #F4F4F2; color: var(--muted); }

.title { font-size: 22px; font-weight: 800; margin: 0 0 4px; }
.subtitle { color: var(--muted); font-size: 14px; margin: 0; }
.section-title { font-size: 16px; font-weight: 800; margin: 20px 0 10px; }
.muted { color: var(--muted); font-size: 13px; }
.center { text-align: center; }
.spacer { height: 12px; }

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(110px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  background: rgba(63, 75, 71, .92);
  color: #fff;
  padding: 10px 18px;
  border-radius: 999px;
  font-size: 14px;
  z-index: 90;
  animation: toastIn .2s ease;
}
@keyframes toastIn { from { opacity: 0; transform: translate(-50%, 10px); } }

.err-banner {
  background: var(--peach-soft);
  color: #B85C3F;
  border-radius: 14px;
  padding: 10px 14px;
  font-size: 13px;
  margin-bottom: 12px;
  word-break: break-all;
}

/* ---------- 登录 ---------- */
.auth { padding-top: 48px; }
.auth .logo { font-size: 64px; text-align: center; margin-bottom: 6px; }
.auth h1 { font-size: 30px; text-align: center; margin: 0 0 6px; letter-spacing: 2px; }
.auth .sub { text-align: center; color: var(--muted); font-size: 14px; margin: 0 0 26px; }
.tabs { display: flex; background: #F1F5F3; border-radius: 999px; padding: 5px; margin-bottom: 18px; }
.tabs button {
  flex: 1;
  min-height: 42px;
  border-radius: 999px;
  font-weight: 700;
  color: var(--muted);
  transition: all .15s ease;
}
.tabs button.active { background: #fff; color: var(--ink); box-shadow: 0 3px 10px rgba(0,0,0,.05); }

/* ---------- 首页 ---------- */
.topbar { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.who { display: flex; align-items: center; gap: 10px; }
.avatar {
  width: 46px; height: 46px; border-radius: 50%;
  background: #fff; display: grid; place-items: center; font-size: 24px;
  box-shadow: var(--shadow);
}
.who .name { font-weight: 800; font-size: 17px; }
.who .meta { font-size: 12px; color: var(--muted); }
.icon-btn {
  width: 44px; height: 44px; border-radius: 50%; background: #fff;
  display: grid; place-items: center; font-size: 18px; box-shadow: var(--shadow);
}

.task-card { position: relative; overflow: hidden; padding: 22px; }
.task-card::after {
  content: "";
  position: absolute; right: -40px; top: -40px; width: 140px; height: 140px;
  background: radial-gradient(circle, rgba(123,211,184,.28), transparent 70%);
  border-radius: 50%;
}
.task-ring { display: flex; align-items: center; gap: 18px; }
.ring { position: relative; width: 92px; height: 92px; flex: none; }
.ring svg { display: block; }
.ring .pct {
  position: absolute; inset: 0; display: grid; place-items: center;
  font-weight: 800; font-size: 18px; color: var(--mint-deep);
}
.task-nums { display: flex; gap: 18px; }
.task-nums .n { font-size: 26px; font-weight: 800; line-height: 1.1; }
.task-nums .l { font-size: 12px; color: var(--muted); margin-top: 2px; }
.task-line { display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: 13px; margin-top: 14px; }

.quick-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 14px; }
.quick {
  background: #fff; border-radius: 20px; padding: 16px; box-shadow: var(--shadow);
  display: flex; flex-direction: column; gap: 4px; text-align: left;
}
.quick .e { font-size: 22px; }
.quick .t { font-weight: 800; font-size: 15px; }
.quick .s { font-size: 12px; color: var(--muted); }

/* ---------- 底部导航 ---------- */
.nav {
  position: fixed;
  left: 50%; transform: translateX(-50%);
  bottom: 0;
  width: 100%; max-width: 480px;
  padding: 8px 16px calc(8px + env(safe-area-inset-bottom));
  background: rgba(255, 253, 247, .92);
  backdrop-filter: blur(14px);
  border-top: 1px solid rgba(239, 237, 229, .9);
  display: flex; justify-content: space-around; z-index: 80;
}
.nav button { display: flex; flex-direction: column; align-items: center; gap: 2px; color: var(--muted); font-size: 12px; padding: 6px 10px; border-radius: 14px; }
.nav button .i { font-size: 20px; }
.nav button.active { color: var(--mint-deep); font-weight: 800; }

/* ---------- 学习页 ---------- */
.study-top { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; }
.progress { flex: 1; height: 10px; background: #EBEFEC; border-radius: 99px; overflow: hidden; }
.progress > i { display: block; height: 100%; border-radius: 99px; background: linear-gradient(90deg, #8FE0C5, #56BFA3); transition: width .25s ease; }
.study-count { font-size: 13px; color: var(--muted); font-weight: 700; }

.word-card { text-align: center; padding: 26px 20px 22px; position: relative; }
.word-card .emoji { font-size: 54px; line-height: 1; margin-bottom: 8px; }
.word-card .spell { font-size: 34px; font-weight: 800; letter-spacing: .5px; }
.word-card .phon { color: var(--muted); font-size: 14px; margin-top: 4px; }
.sound {
  margin: 12px auto 0; width: 56px; height: 56px; border-radius: 50%;
  background: var(--mint-soft); color: var(--mint-deep); font-size: 24px;
  display: grid; place-items: center; transition: transform .15s ease;
}
.sound:active { transform: scale(.92); }
.word-card .ask { margin-top: 14px; font-size: 13px; color: var(--muted); }

.options { display: grid; gap: 10px; margin-top: 16px; }
.option {
  min-height: 60px;
  border-radius: 18px;
  background: #fff;
  border: 2px solid var(--line);
  display: flex; align-items: center; gap: 12px;
  padding: 0 16px;
  font-size: 17px; font-weight: 700;
  text-align: left;
  transition: all .15s ease;
}
.option .k {
  width: 28px; height: 28px; border-radius: 50%; flex: none;
  background: #F2F5F3; color: var(--muted);
  display: grid; place-items: center; font-size: 14px; font-weight: 800;
}
.option.correct { background: var(--mint-soft); border-color: var(--mint); color: var(--mint-deep); }
.option.correct .k { background: var(--mint); color: #fff; }
.option.wrong { background: var(--peach-soft); border-color: var(--peach); color: #D2694B; }
.option.wrong .k { background: var(--peach); color: #fff; }
.option.dim { opacity: .55; }

.spell-box { display: flex; gap: 10px; margin-top: 16px; }
.spell-box .input { font-size: 22px; text-align: center; letter-spacing: 2px; }

.feedback {
  margin-top: 16px; border-radius: 20px; padding: 16px;
  background: var(--mint-soft); animation: popIn .18s ease;
}
.feedback.bad { background: var(--peach-soft); }
.feedback .head { font-weight: 800; font-size: 16px; margin-bottom: 6px; }
.feedback .ex { font-size: 14px; color: var(--muted); line-height: 1.6; }
@keyframes popIn { from { transform: scale(.96); opacity: 0; } }

/* ---------- 结算 ---------- */
.result-hero { text-align: center; padding: 34px 20px 26px; position: relative; overflow: hidden; }
.result-hero .big { font-size: 60px; }
.result-hero h2 { font-size: 26px; margin: 8px 0 4px; }
.stars { display: flex; justify-content: center; gap: 10px; font-size: 34px; margin-top: 10px; }
.stars span { animation: starPop .35s ease backwards; }
.stars span:nth-child(2) { animation-delay: .1s; }
.stars span:nth-child(3) { animation-delay: .2s; }
@keyframes starPop { from { transform: scale(0) rotate(-30deg); } }
.stat-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 14px; }
.stat { background: #fff; border-radius: 18px; padding: 14px 10px; text-align: center; box-shadow: var(--shadow); }
.stat .v { font-size: 22px; font-weight: 800; }
.stat .l { font-size: 12px; color: var(--muted); }

/* ---------- 列表 ---------- */
.list-item {
  display: flex; align-items: center; gap: 12px;
  background: #fff; border-radius: 18px; padding: 14px; box-shadow: var(--shadow);
  margin-bottom: 10px;
}
.list-item .lead { font-size: 26px; }
.list-item .body { flex: 1; min-width: 0; }
.list-item .t { font-weight: 800; font-size: 16px; }
.list-item .s { font-size: 13px; color: var(--muted); margin-top: 2px; }
.list-item .tail { font-size: 13px; color: var(--muted); text-align: right; }

/* ---------- 家长端 ---------- */
.pin-pad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 16px; }
.key {
  min-height: 58px; border-radius: 18px; background: #fff; font-size: 22px; font-weight: 800;
  box-shadow: var(--shadow);
}
.pin-dots { display: flex; justify-content: center; gap: 14px; margin: 18px 0; }
.pin-dots i { width: 14px; height: 14px; border-radius: 50%; background: #E4E9E6; }
.pin-dots i.on { background: var(--mint); }

.ptabs { display: flex; gap: 6px; margin: 14px 0 16px; overflow-x: auto; }
.ptabs button {
  padding: 9px 14px; border-radius: 999px; background: #fff; color: var(--muted);
  font-size: 13px; font-weight: 700; white-space: nowrap; box-shadow: 0 4px 12px rgba(93,140,124,.07);
}
.ptabs button.active { background: var(--mint); color: #fff; }

.book-card { display: flex; gap: 12px; align-items: center; background: #fff; border-radius: 20px; padding: 14px; box-shadow: var(--shadow); margin-bottom: 10px; }
.book-card .e { font-size: 30px; }
.book-card .b { flex: 1; min-width: 0; }
.book-card .b .n { font-weight: 800; }
.book-card .b .m { font-size: 12px; color: var(--muted); margin-top: 2px; }

.word-row { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px dashed var(--line); }
.word-row:last-child { border-bottom: none; }
.word-row .w { font-weight: 800; min-width: 92px; }
.word-row .m { flex: 1; font-size: 14px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.err-list { background: var(--peach-soft); border-radius: 14px; padding: 10px 14px; font-size: 13px; color: #B85C3F; margin-top: 10px; }
.err-list div { padding: 2px 0; }

.bars { display: flex; align-items: flex-end; gap: 8px; height: 120px; padding: 10px 4px 0; }
.bars .b { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; }
.bars .b i { width: 100%; border-radius: 8px 8px 4px 4px; background: var(--mint-soft); min-height: 4px; }
.bars .b b { font-size: 11px; color: var(--muted); font-weight: 600; }

.modal-mask {
  position: fixed; inset: 0; background: rgba(63,75,71,.35); z-index: 95;
  display: flex; align-items: flex-end; justify-content: center;
}
.modal {
  width: 100%; max-width: 480px; max-height: 88vh; overflow: auto;
  background: var(--cream); border-radius: 26px 26px 0 0; padding: 20px 18px calc(20px + env(safe-area-inset-bottom));
  animation: slideUp .22s ease;
}
@keyframes slideUp { from { transform: translateY(30px); opacity: .6; } }
.modal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.modal-head h3 { margin: 0; font-size: 18px; }

.empty { text-align: center; color: var(--muted); padding: 34px 10px; font-size: 14px; }
.empty .e { font-size: 44px; display: block; margin-bottom: 8px; }

/* 动画 */
.fade-up { animation: fadeUp .25s ease; }
@keyframes fadeUp { from { opacity: 0; transform: translateY(8px); } }
.shake { animation: shake .3s ease; }
@keyframes shake { 0%,100% { transform: translateX(0); } 25% { transform: translateX(-6px); } 75% { transform: translateX(6px); } }

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}
