/* 七七的学习小助手 —— 样式（零外部字体/图片，系统字体，手机优先） */
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { font-size: 16px; }
body {
  margin: 0; min-height: 100vh; color: #3d2c22;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans CJK SC", sans-serif;
  background: linear-gradient(180deg, #fff6ec 0%, #ffeedd 55%, #ffe3d3 100%);
  overflow-x: hidden;
}
button { font-family: inherit; cursor: pointer; }
input, select, textarea { font-family: inherit; font-size: 1rem; }
.hidden { display: none !important; }

/* 背景漂浮泡泡 */
.bg-bubbles { position: fixed; inset: 0; pointer-events: none; z-index: 0; overflow: hidden; }
.bg-bubbles span { position: absolute; border-radius: 50%; background: rgba(255,170,120,.18); animation: drift 14s ease-in-out infinite; }
.bg-bubbles span:nth-child(1){ width:70px;height:70px; left:6%; top:16%; }
.bg-bubbles span:nth-child(2){ width:44px;height:44px; left:84%; top:10%; animation-delay:-4s; }
.bg-bubbles span:nth-child(3){ width:56px;height:56px; left:72%; top:66%; animation-delay:-8s; }
.bg-bubbles span:nth-child(4){ width:34px;height:34px; left:16%; top:74%; animation-delay:-2s; }
.bg-bubbles span:nth-child(5){ width:90px;height:90px; left:44%; top:88%; animation-delay:-10s; }
@keyframes drift { 0%,100%{ transform: translateY(0) } 50%{ transform: translateY(-18px) } }

/* 顶栏 */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between;
  padding: calc(8px + env(safe-area-inset-top)) 14px 8px;
  background: rgba(255,246,236,.92); backdrop-filter: blur(6px);
  border-bottom: 2px solid #ffd9bd;
}
.brand { display: flex; align-items: center; gap: 8px; min-width: 0; }
.brand-name { font-size: 1.12rem; font-weight: 800; color: #b34a1f; white-space: nowrap; }
.top-actions { display: flex; align-items: center; gap: 8px; }
.icon-btn {
  width: 46px; height: 46px; border-radius: 50%; border: 2px solid #ffd0a8;
  background: #fff; font-size: 1.25rem; line-height: 1;
}
.star-badge {
  display: flex; align-items: center; gap: 5px;
  background: #fff3c4; border: 2px solid #f5c542; border-radius: 999px;
  padding: 7px 14px; font-weight: 800; font-size: 1.1rem; color: #8a6414;
  font-variant-numeric: tabular-nums;
}
.star-badge.bump { animation: bump .5s ease; }
@keyframes bump { 0%{transform:scale(1)} 40%{transform:scale(1.25)} 100%{transform:scale(1)} }

/* 休息提醒 */
.rest-banner {
  position: relative; z-index: 15; margin: 10px 12px 0; padding: 12px;
  background: #e3f4ff; border: 2px solid #9fd3f5; border-radius: 16px;
  display: flex; flex-wrap: wrap; gap: 8px; align-items: center; font-weight: 700;
}
.rest-banner button { border: none; border-radius: 999px; padding: 10px 16px; background: #3d9be9; color: #fff; font-weight: 800; min-height: 44px; }
.rest-banner button.ghost { background: #fff; color: #3d9be9; border: 2px solid #9fd3f5; }

main { position: relative; z-index: 1; max-width: 920px; margin: 0 auto; padding: 14px 12px 40px; }

/* 吉祥物与问候 */
.hero { display: flex; gap: 12px; align-items: center; margin: 6px 0 14px; }
.mascot-wrap { flex: 0 0 auto; width: 104px; }
.mascot-svg { width: 100%; height: auto; animation: floaty 3.2s ease-in-out infinite; }
.mascot-img { width: 100%; height: auto; border-radius: 50%; display: block; animation: floaty 3.2s ease-in-out infinite; box-shadow: 0 4px 10px rgba(200,110,50,.25); }
.mascot-wrap.happy .mascot-img { animation: happyJump .6s ease 2; }
/* 团团动态形象：漂浮 + 眨眼 + 挥手 + 耳朵抖动；答对时开心跳 */
.mascot-anim { width: 100%; height: auto; display: block; animation: floaty 3.2s ease-in-out infinite; }
.mascot-wrap.happy .mascot-anim { animation: happyJump .6s ease 2; }
.mascot-anim .eye { transform-box: fill-box; transform-origin: center; animation: blink 4.4s ease-in-out infinite; }
@keyframes blink { 0%, 91%, 100% { transform: scaleY(1); } 94.5% { transform: scaleY(.06); } }
.mascot-anim .arm { transform-box: fill-box; transform-origin: 50% 92%; animation: wave 2.4s ease-in-out infinite; }
@keyframes wave { 0%, 100% { transform: rotate(-7deg); } 50% { transform: rotate(15deg); } }
.mascot-anim .ear-r { transform-box: fill-box; transform-origin: center; animation: earWiggle 5.2s ease-in-out infinite; }
@keyframes earWiggle { 0%, 88%, 100% { transform: rotate(0); } 92% { transform: rotate(7deg); } 96% { transform: rotate(-5deg); } }
/* 学习/复习状态：团团抱着书，轻轻点头陪读，眨眼放慢 */
.mascot-anim.study { animation: nod 3.2s ease-in-out infinite; transform-origin: 50% 92%; }
@keyframes nod { 0%, 100% { transform: rotate(-1.8deg) translateY(0); } 50% { transform: rotate(1.8deg) translateY(2.5px); } }
.mascot-anim.study .eye { animation-duration: 6.5s; }
.mascot-wrap.happy .mascot-anim.study { animation: happyJump .6s ease 2; }
.quiz-mascot .mascot-wrap { width: 56px; }
.quiz-mascot { display: inline-flex; }
/* 团团视频形象（与 Muse 相同的圆形视频实现） */
.mascot-wrap { position: relative; }
.mascot-video {
  width: 100%; aspect-ratio: 1/1; object-fit: cover; object-position: center 28%;
  border-radius: 50%; display: block; background: #f7ead2;
  box-shadow: 0 4px 12px rgba(200,110,50,.25);
}
.mascot-wrap.happy { animation: happyJump .6s ease 2; }
.mascot-video.study-v { object-position: center 38%; }
/* 答题模式：全程安静 —— 关掉所有入场/弹跳动画，点选项不闪不动 */
.quiz-mode .card, .quiz-mode .hint-box, .quiz-mode .feedback, .quiz-mode .big-card { animation: none !important; }
.quiz-mode .choice-btn, .quiz-mode .progress-inner { transition: none !important; }
/* 作文格纸：像写在方格本子上 */
.big-input.essay-paper {
  background-color: #fffdf6;
  background-image:
    linear-gradient(rgba(238,150,90,.38) 1px, transparent 1px),
    linear-gradient(90deg, rgba(238,150,90,.38) 1px, transparent 1px);
  background-size: 32px 32px;
  background-position: -1px -1px;
  line-height: 32px;
  font-size: 19px;
  letter-spacing: 13px;
  padding: 5px 0 0 7px;
  caret-color: #e86a3c;
}
.essay-view {
  display: block; white-space: pre-wrap; word-break: break-all;
  background-color: #fffdf6;
  background-image:
    linear-gradient(rgba(238,150,90,.30) 1px, transparent 1px),
    linear-gradient(90deg, rgba(238,150,90,.30) 1px, transparent 1px);
  background-size: 30px 30px;
  line-height: 30px; font-size: 17px; letter-spacing: 2px;
  padding: 4px 8px; border-radius: 8px; margin-top: 4px;
}
.celebrate-mascot { width: 132px; margin: 0 auto 4px; }
.celebrate-mascot .mascot-wrap { width: 132px; }
.brand-img { width: 40px; height: 40px; border-radius: 50%; object-fit: cover; display: block; }
@keyframes floaty { 0%,100%{ transform: translateY(0) rotate(-1deg) } 50%{ transform: translateY(-7px) rotate(1.5deg) } }
.mascot-wrap.happy .mascot-svg { animation: happyJump .6s ease 2; }
@keyframes happyJump { 0%,100%{ transform: translateY(0) } 40%{ transform: translateY(-14px) scale(1.05) } }
.speech {
  flex: 1; min-width: 0; background: #fff; border: 2px solid #ffd0a8; border-radius: 18px;
  padding: 12px 14px; position: relative; box-shadow: 0 3px 0 #ffd0a8;
}
.speech:before {
  content: ""; position: absolute; left: -10px; top: 34px;
  border: 6px solid transparent; border-right: 8px solid #ffd0a8;
}
.speech h1 { margin: 0 0 4px; font-size: 1.3rem; color: #b34a1f; }
.speech p { margin: 0; color: #7a5c48; line-height: 1.5; }

/* 大卡片入口 */
.big-cards { display: grid; grid-template-columns: 1fr; gap: 12px; }
.big-card {
  border: none; text-align: left; border-radius: 22px; padding: 18px;
  display: flex; align-items: center; gap: 14px; min-height: 96px; width: 100%;
  box-shadow: 0 4px 0 rgba(0,0,0,.12); transition: transform .12s ease;
  animation: popIn .45s ease both;
}
.big-card:active { transform: scale(.97); }
.big-card .emo { font-size: 2.5rem; line-height: 1; }
.big-card .tt { font-size: 1.35rem; font-weight: 900; color: #fff; display: block; }
.big-card .ds { color: rgba(255,255,255,.92); font-size: .98rem; display: block; margin-top: 3px; }
.big-card.pink { background: linear-gradient(135deg, #ff7d9c, #ff5d7e); }
.big-card.blue { background: linear-gradient(135deg, #4fa8ec, #2f7fd0); }
.big-card.green { background: linear-gradient(135deg, #58c172, #35a355); }
.big-card.purple { background: linear-gradient(135deg, #a678e8, #8757d6); }
.big-card .badge-num {
  margin-left: auto; background: #fff; color: #d33; font-weight: 900; border-radius: 999px;
  min-width: 40px; height: 40px; display: flex; align-items: center; justify-content: center; font-size: 1.15rem; padding: 0 8px;
}
@keyframes popIn { from{ opacity: 0; transform: translateY(10px) scale(.98) } to{ opacity: 1; transform: none } }

.parent-link {
  display: block; margin: 18px auto 0; background: none; border: none; color: #9a7a63;
  font-size: 1rem; padding: 14px 22px; min-height: 48px; text-decoration: underline;
}

/* 通用卡片与按钮 */
.card { background: #fff; border-radius: 20px; padding: 16px; box-shadow: 0 3px 10px rgba(180,110,60,.12); margin-bottom: 12px; animation: popIn .35s ease both; }
.card h2 { margin: 0 0 10px; font-size: 1.2rem; color: #b34a1f; }
.btn {
  border: none; border-radius: 999px; padding: 13px 22px; min-height: 52px;
  font-size: 1.08rem; font-weight: 800; background: #ff8a5c; color: #fff; box-shadow: 0 3px 0 #e06a35;
}
.btn:active { transform: translateY(2px); box-shadow: none; }
.btn.blue { background: #4fa8ec; box-shadow: 0 3px 0 #2f7fd0; }
.btn.green { background: #58c172; box-shadow: 0 3px 0 #35a355; }
.btn.soft { background: #fff; color: #b34a1f; border: 2px solid #ffd0a8; box-shadow: none; }
.btn.small { min-height: 44px; padding: 8px 16px; font-size: .95rem; }
.btn:disabled { opacity: .5; }
.back-btn { background: none; border: none; font-size: 1.05rem; font-weight: 800; color: #2f7fd0; padding: 12px 6px; min-height: 48px; }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.spacer { flex: 1; }
.muted { color: #9a7a63; }
.center { text-align: center; }

/* 今日任务清单 */
.task-item { display: flex; gap: 10px; align-items: flex-start; padding: 12px; border: 2px solid #ffe3cd; border-radius: 14px; margin-bottom: 8px; background: #fffaf5; }
.task-item input[type=checkbox] { width: 28px; height: 28px; flex: 0 0 auto; margin-top: 1px; accent-color: #58c172; }
.task-item .lb { flex: 1; line-height: 1.45; }
.task-item.done .lb { color: #9a7a63; text-decoration: line-through; }
.tag { display: inline-block; font-size: .78rem; font-weight: 800; border-radius: 999px; padding: 2px 9px; margin-left: 6px; vertical-align: 2px; }
.tag.rx { background: #ffe1ec; color: #c22e6d; }
.tag.rt { background: #e3f4ff; color: #2f7fd0; }
.minutes { color: #c98; font-size: .85rem; white-space: nowrap; }
.progress-outer { height: 14px; background: #ffe9d6; border-radius: 999px; overflow: hidden; margin: 8px 0 4px; }
.progress-inner { height: 100%; background: linear-gradient(90deg, #ffb35c, #ff7d5c); border-radius: 999px; transition: width .5s ease; }

/* 陪练 */
.subject-grid { display: grid; grid-template-columns: 1fr; gap: 12px; }
.quiz-head { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.quiz-q { font-size: 1.45rem; font-weight: 800; line-height: 1.5; margin: 8px 0 14px; word-break: break-word; }
.quiz-q .passage { display: block; font-size: 1.08rem; font-weight: 600; background: #fffaf2; border: 2px dashed #ffd0a8; border-radius: 14px; padding: 12px; margin-bottom: 12px; line-height: 1.75; }
.choices { display: grid; grid-template-columns: 1fr; gap: 10px; }
.choice-btn {
  text-align: left; border: 3px solid #e8d9cb; background: #fff; border-radius: 16px;
  padding: 15px 16px; font-size: 1.12rem; font-weight: 700; min-height: 58px; line-height: 1.4;
}
.choice-btn:active { transform: scale(.98); }
.choice-btn.picked { border-color: #4fa8ec; background: #eaf5ff; }
.choice-btn.right { border-color: #58c172; background: #e9f9ee; }
.choice-btn.wrong { border-color: #ff5d7e; background: #ffedf1; }
@keyframes wiggle { 0%,100%{transform:translateX(0)} 25%{transform:translateX(-6px)} 75%{transform:translateX(6px)} }
.answer-row { display: flex; gap: 10px; }
.answer-input {
  flex: 1; min-width: 0; border: 3px solid #e8d9cb; border-radius: 16px; padding: 13px 14px;
  font-size: 1.3rem; font-weight: 700; background: #fff;
}
.answer-input:focus { outline: none; border-color: #4fa8ec; }
.hint-box { background: #fff7d6; border: 2px solid #f5d76a; border-radius: 14px; padding: 12px 14px; margin-top: 12px; line-height: 1.6; animation: popIn .3s ease both; }
.feedback { border-radius: 16px; padding: 14px; margin-top: 14px; line-height: 1.65; font-size: 1.05rem; animation: popIn .3s ease both; }
.feedback.good { background: #e9f9ee; border: 2px solid #8fd79f; }
.feedback.bad { background: #ffedf1; border: 2px solid #ffb3c2; }
.feedback .praise { font-weight: 900; font-size: 1.15rem; }
.listen-btn { font-size: 1.05rem; }

/* 完成庆祝 */
.celebrate { text-align: center; padding: 14px 0; }
.celebrate .big-emo { font-size: 4rem; animation: happyJump .7s ease 3; display: inline-block; }
.celebrate h2 { font-size: 1.6rem; }

/* 徽章墙 */
.badges { display: flex; flex-wrap: wrap; gap: 8px; }
.badge-chip { background: #fff7e0; border: 2px solid #f5d76a; border-radius: 999px; padding: 7px 13px; font-weight: 800; font-size: .95rem; }
.badge-chip.locked { background: #f3ede6; border-color: #ddd; color: #b6a08c; }

/* 休息乐园 */
.break-grid { display: grid; grid-template-columns: 1fr; gap: 12px; }
.timer-big { font-size: 3rem; font-weight: 900; text-align: center; color: #2f7fd0; font-variant-numeric: tabular-nums; }
.tap-zone {
  width: 170px; height: 170px; border-radius: 50%; margin: 8px auto; display: block;
  font-size: 3.2rem; border: none; background: radial-gradient(circle at 35% 30%, #ffd9a8, #ff8a5c);
  box-shadow: 0 6px 0 #e06a35;
}
.tap-zone:active { transform: scale(.94); box-shadow: 0 2px 0 #e06a35; }

/* 家长角 */
.gate-input { width: 100%; border: 3px solid #e8d9cb; border-radius: 14px; padding: 13px; font-size: 1.3rem; text-align: center; font-weight: 800; }
.tabs { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.tab-btn { border: 2px solid #ffd0a8; background: #fff; border-radius: 999px; padding: 10px 18px; font-weight: 800; min-height: 46px; }
.tab-btn.on { background: #ff8a5c; color: #fff; border-color: #ff8a5c; }
table.list { width: 100%; border-collapse: collapse; font-size: .95rem; }
table.list td, table.list th { border-bottom: 1px solid #f3e4d4; padding: 8px 6px; text-align: left; vertical-align: top; }
.form-grid { display: grid; grid-template-columns: 1fr; gap: 10px; }
.form-grid label { font-weight: 700; font-size: .95rem; color: #7a5c48; }
.form-grid input, .form-grid select, .form-grid textarea {
  width: 100%; border: 2px solid #e8d9cb; border-radius: 12px; padding: 11px; margin-top: 4px; background: #fff;
}
.stat-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.stat-box { background: #fffaf5; border: 2px solid #ffe3cd; border-radius: 14px; padding: 12px; text-align: center; }
.stat-box .num { font-size: 1.7rem; font-weight: 900; color: #b34a1f; }
.stat-box .cap { color: #9a7a63; font-size: .88rem; }
.unit-row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; padding: 10px 0; border-bottom: 1px solid #f3e4d4; }
.pill { border-radius: 999px; padding: 3px 11px; font-size: .82rem; font-weight: 800; }
.pill.mastered { background: #e9f9ee; color: #2c7a3f; }
.pill.learning { background: #fff3c4; color: #8a6414; }

/* 特效层 */
#fxLayer { position: fixed; inset: 0; pointer-events: none; z-index: 50; overflow: hidden; }
.fx-star { position: absolute; font-size: 1.6rem; animation: starFly 1s ease-out forwards; }
@keyframes starFly { 0%{ transform: translateY(0) scale(.6); opacity: 1 } 100%{ transform: translateY(-130px) scale(1.3) rotate(40deg); opacity: 0 } }
.fx-confetti { position: absolute; top: -14px; width: 10px; height: 16px; border-radius: 2px; animation: confettiFall linear forwards; }
@keyframes confettiFall { to{ transform: translateY(105vh) rotate(560deg); } }
.toast {
  position: fixed; left: 50%; bottom: calc(22px + env(safe-area-inset-bottom)); transform: translateX(-50%);
  background: rgba(61,44,34,.94); color: #fff; padding: 12px 20px; border-radius: 999px;
  font-weight: 700; z-index: 60; max-width: 92vw; text-align: center; animation: popIn .25s ease both;
}
.loading-card { text-align: center; padding: 30px 10px; }
.loading-card .mascot-wrap { margin: 0 auto; }

/* 平板 */
@media (min-width: 700px) {
  html { font-size: 17px; }
  .big-cards { grid-template-columns: repeat(3, 1fr); }
  .big-card { flex-direction: column; text-align: center; justify-content: center; min-height: 170px; }
  .big-card .badge-num { margin: 4px auto 0; }
  .subject-grid { grid-template-columns: repeat(2, 1fr); }
  .choices { grid-template-columns: repeat(2, 1fr); }
  .break-grid { grid-template-columns: repeat(3, 1fr); }
  .form-grid { grid-template-columns: repeat(2, 1fr); }
  .stat-grid { grid-template-columns: repeat(4, 1fr); }
  .mascot-wrap { width: 128px; }
}
/* 大屏 */
@media (min-width: 1024px) {
  .subject-grid { grid-template-columns: repeat(4, 1fr); }
}
/* 减少动态偏好 */
@media (prefers-reduced-motion: reduce) {
  * { animation-duration: .01s !important; transition-duration: .01s !important; }
}
