/* Andika（SIL，OFL 许可）：a、g 是课本上的单层写法，英语单词和语文拼音都用它 */
@font-face { font-family: "Andika"; src: url("/static/fonts/Andika-Regular.ttf") format("truetype"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Andika"; src: url("/static/fonts/Andika-Bold.ttf") format("truetype"); font-weight: 700; font-display: swap; }
:root {
  --bg: #fff8e7;
  --card: #ffffff;
  --ink: #3b3355;
  --muted: #8a82a3;
  --primary: #5b8def;
  --primary-ink: #ffffff;
  --accent: #ffb703;
  --good: #3bb273;
  --soft-wrong: #f4a259;
  --line: #e8e0f5;
  --radius: 24px;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; margin: 0; }
body {
  background: var(--bg);
  color: var(--ink);
  font-family: "Microsoft YaHei", "PingFang SC", "Noto Sans SC", sans-serif;
  touch-action: manipulation;
}
/* 孩子页不让选中文字：iPad 的 Safari 要带 -webkit- 前缀才认，而且要写在每个元素上；长按也不弹“拷贝/查询”菜单。输入框除外 */
body:not(.parent), body:not(.parent) * { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
body:not(.parent) input, body:not(.parent) textarea { -webkit-user-select: text; user-select: text; }
#app { min-height: 100%; max-width: 760px; margin: 0 auto; padding: 16px; display: flex; flex-direction: column; }
button { font: inherit; color: inherit; border: 0; cursor: pointer; }
button:focus-visible { outline: 4px solid var(--accent); outline-offset: 2px; }

.screen { flex: 1; display: flex; flex-direction: column; gap: 16px; }
.center { align-items: center; justify-content: center; text-align: center; }

.big-button {
  background: var(--primary); color: var(--primary-ink);
  font-size: 36px; font-weight: 700; padding: 24px 56px; border-radius: 999px;
  box-shadow: 0 8px 0 #3e6fd1; transition: transform .08s;
}
.big-button:active { transform: translateY(6px); box-shadow: 0 2px 0 #3e6fd1; }
.big-button.green { background: var(--good); box-shadow: 0 8px 0 #2a8a58; }
.big-button.green:active { box-shadow: 0 2px 0 #2a8a58; }
.hero { font-size: 110px; line-height: 1; }
h1 { font-size: 44px; margin: 0; }
.muted { color: var(--muted); font-size: 22px; }

/* 顶部：进度点 + 小按钮 */
.topbar { display: flex; align-items: center; gap: 12px; }
.dots { flex: 1; display: flex; gap: 8px; flex-wrap: wrap; }
.dot { width: 22px; height: 22px; border-radius: 50%; background: var(--line); }
.dot.done { background: var(--good); }
.dot.wrong { background: var(--soft-wrong); }
.dot.now { background: var(--accent); transform: scale(1.25); }
.icon-button { width: 72px; height: 72px; border-radius: 50%; background: var(--card); font-size: 40px; box-shadow: 0 3px 0 var(--line); }
.icon-button.off { opacity: .45; }

/* 题目卡片 */
.card { background: var(--card); border-radius: var(--radius); padding: 24px; box-shadow: 0 6px 0 var(--line); }
.prompt { font-size: 40px; line-height: 1.5; font-weight: 600; min-height: 3em; display: flex; align-items: center; }
.topic-name { font-size: 18px; color: var(--muted); margin-bottom: 8px; }

/* 答案显示 */
.answer-row { display: flex; gap: 16px; justify-content: center; align-items: center; margin: 4px 0; }
.answer-box {
  min-width: 140px; height: 84px; border-radius: 20px; border: 4px dashed var(--line);
  font-size: 52px; font-weight: 700; display: flex; align-items: center; justify-content: center; background: #fbf9ff;
}
.answer-box.active { border-color: var(--primary); background: #eef3ff; }
.answer-box .ph { color: #cfc7e6; }
.answer-label { font-size: 26px; color: var(--muted); min-width: 3.2em; text-align: right; }

/* 数字键盘 */
.numpad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.key {
  height: 76px; border-radius: 20px; background: var(--card); font-size: 40px; font-weight: 700;
  box-shadow: 0 5px 0 var(--line);
}
.key:active { transform: translateY(4px); box-shadow: 0 1px 0 var(--line); }
.key.fn { font-size: 28px; background: #efeafc; }
.key.ok { background: var(--good); color: #fff; box-shadow: 0 5px 0 #2a8a58; }
.key.ok:disabled { background: #cfd8d3; box-shadow: 0 5px 0 #b3beb8; }

/* 选择题 */
.choices { display: grid; gap: 14px; }
.choice {
  display: flex; align-items: center; gap: 16px; text-align: left; padding: 16px 20px; min-height: 84px;
  background: var(--card); border-radius: 22px; box-shadow: 0 5px 0 var(--line); border: 4px solid transparent;
  font-size: 34px; font-weight: 600;
}
.choice .badge { flex: none; width: 52px; height: 52px; border-radius: 50%; background: #efeafc; display: grid; place-items: center; font-size: 28px; }
.choice.selected { border-color: var(--primary); background: #eef3ff; }
.choice.selected .badge { background: var(--primary); color: #fff; }
.choice svg { width: 150px; height: 110px; color: var(--ink); flex: none; }

/* 反馈 */
.overlay { position: fixed; inset: 0; background: rgba(59, 51, 85, .55); display: grid; place-items: center; padding: 16px; z-index: 10; }
.feedback { background: var(--card); border-radius: 32px; padding: 32px 28px; width: min(560px, 100%); text-align: center; animation: pop .25s ease-out; }
.feedback .face { font-size: 120px; line-height: 1.1; }
.feedback h2 { font-size: 42px; margin: 8px 0; }
.feedback.good h2 { color: var(--good); }
.feedback.try h2 { color: var(--soft-wrong); }
.feedback p { font-size: 28px; line-height: 1.5; margin: 8px 0 20px; }
.feedback .show-answer { font-size: 34px; font-weight: 700; }
@keyframes pop { from { transform: scale(.85); opacity: 0; } to { transform: scale(1); opacity: 1; } }

/* 小结 */
.stars { font-size: 56px; letter-spacing: 6px; word-break: break-all; }
.learned { background: var(--card); border-radius: var(--radius); padding: 16px 24px; font-size: 26px; }
.learned li { margin: 6px 0; }

@media (max-width: 520px) {
  .prompt { font-size: 32px; }
  .big-button { font-size: 30px; padding: 20px 40px; }
  .key { height: 66px; font-size: 34px; }
  .answer-box { min-width: 110px; height: 72px; font-size: 44px; }
  .choice { font-size: 28px; }
  .choice svg { width: 110px; height: 80px; }
}
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }

.parent-link { position: fixed; right: 14px; bottom: 10px; color: var(--muted); font-size: 14px; opacity: .6; text-decoration: none; padding: 8px; }


/* ---------- 语文 ---------- */
.big-button.orange { background: #ff8c42; box-shadow: 0 8px 0 #d96a1f; }
.big-button.orange:active { box-shadow: 0 2px 0 #d96a1f; }
.gloss { font-family: "Andika", system-ui, sans-serif; font-size: .66em; font-weight: 500; color: var(--muted); background: none; border: 0; padding: 0 2px; cursor: pointer; }
.prompt.small { font-size: 26px; min-height: 0; color: var(--muted); font-weight: 500; }
.stem { display: flex; flex-direction: column; align-items: center; gap: 12px; padding: 4px 0 8px; text-align: center; }
.big-display { font-size: 56px; font-weight: 700; line-height: 1.3; letter-spacing: .06em; }
.big-display.han { font-size: 140px; line-height: 1.1; font-family: "KaiTi", "楷体", "Kaiti SC", "STKaiti", "AR PL UKai CN", serif; font-weight: 400; }
.listen-button { width: 150px; height: 150px; border-radius: 50%; border: none; background: var(--primary); color: #fff; font-size: 72px; box-shadow: 0 8px 0 #3e6fd1; cursor: pointer; }
.listen-button:active { transform: translateY(6px); box-shadow: 0 2px 0 #3e6fd1; }
.pinyin-hint { font-size: 40px; font-weight: 600; }
.ruby-line { font-size: 36px; line-height: 2.2; font-family: "KaiTi", "楷体", "Kaiti SC", "STKaiti", serif; word-break: keep-all; }
.ruby-line rt { font-size: 17px; font-family: system-ui, "Helvetica Neue", Arial, sans-serif; color: var(--muted); letter-spacing: 0; }
.ruby-line .gap { display: inline-block; width: 1.3em; height: 1em; line-height: 1; vertical-align: -0.12em; border-bottom: 4px solid var(--primary); }
.ruby-line ruby.blank rt { color: var(--primary); font-weight: 700; }
.choices.zh-grid { grid-template-columns: 1fr 1fr; }
.choice.zh { justify-content: center; text-align: center; min-height: 120px; }
.choice.zh.han { font-size: 72px; font-family: "KaiTi", "楷体", "Kaiti SC", "STKaiti", serif; }
.choice.zh.py { font-size: 44px; font-weight: 600; }


/* ---------- 选声音 ---------- */
.voice-link { position: fixed; left: 14px; bottom: 10px; color: var(--muted); font-size: 14px; opacity: .6; background: none; padding: 8px; }
.voice-link.account-link { bottom: 56px; }   /* 和左下角的“声音”叠在一起了，往上放一行 */
.voice-group { display: flex; flex-direction: column; gap: 8px; width: 100%; max-width: 560px; }
.voice { text-align: left; padding: 12px 16px; border-radius: 14px; background: #fff; border: 2px solid var(--line); font-size: 18px; }
.voice.selected { border-color: var(--primary); background: #efeafc; font-weight: 700; }

/* ---------- 英语 ---------- */
.big-button.purple { background: #8e6ce8; box-shadow: 0 8px 0 #6b4cc2; }
.big-button.purple:active { box-shadow: 0 2px 0 #6b4cc2; }
.big-display.emoji { font-size: 170px; line-height: 1.1; }
.big-display.en { font-family: "Andika", system-ui, sans-serif; font-size: 64px; letter-spacing: .02em; }
.en-display { font-family: "Andika", system-ui, sans-serif; font-size: 68px; font-weight: 700; letter-spacing: .04em; }
.choice.zh.en { font-family: "Andika", system-ui, sans-serif; font-size: 44px; font-weight: 700; }
.choice.zh.emo { font-size: 100px; }
.choice.zh.py, .ruby-line rt, .pinyin-hint { font-family: "Andika", system-ui, sans-serif; }

/* ---------- 奥数挑战 ---------- */
.big-button.gold { background: #f5a623; box-shadow: 0 8px 0 #c47f0c; }
.big-button.gold:active { box-shadow: 0 2px 0 #c47f0c; }
.ch-head { display: flex; align-items: center; gap: 12px; }
.ch-head h1 { flex: 1; font-size: 32px; margin: 0; }
.ch-lecture { display: flex; justify-content: space-between; align-items: center; text-align: left; }
.ch-lecture small { font-size: 22px; opacity: .9; }
.ch-intro { font-size: 24px; line-height: 1.6; margin: 0 0 8px; }
.ch-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: 12px; }
.ch-item { background: var(--card); border-radius: 18px; padding: 14px 4px; font-size: 26px; font-weight: 700; box-shadow: 0 4px 0 var(--line); display: grid; gap: 2px; }
.ch-item small { font-size: 22px; min-height: 26px; }
.ch-item.ok { background: #fff4cf; }
.ch-item:disabled { opacity: .5; }
.ch-fig { display: block; max-width: 100%; max-height: 46vh; margin: 12px auto; object-fit: contain; }
.ch-part { margin: 16px 0; }
.ch-label { font-size: 24px; color: var(--muted); margin-bottom: 6px; }
.chips, .blanks { display: flex; flex-wrap: wrap; gap: 10px; }
.chip { min-width: 72px; min-height: 64px; padding: 6px 18px; border-radius: 18px; background: #fff; font-size: 28px; font-weight: 700; box-shadow: 0 4px 0 var(--line); border: 2px solid var(--line); }
.chip.on { background: var(--primary); color: #fff; border-color: var(--primary); }
.chip.fn { background: #efeafc; }
.chip:disabled { opacity: .4; }
.order-line { margin-top: 10px; font-size: 28px; min-height: 40px; }
.blank { width: 84px; height: 64px; font-size: 32px; text-align: center; border: 3px solid var(--line); border-radius: 14px; background: #fff; color: var(--ink); }
.blank:focus { outline: none; border-color: var(--primary); }
.ch-answers { text-align: left; font-size: 26px; margin: 8px 0; padding-left: 28px; }
.ch-solution { font-size: 24px !important; color: var(--muted); text-align: left; }

.listen-button.sm { width: 56px; height: 56px; font-size: 28px; box-shadow: 0 4px 0 #3e6fd1; vertical-align: middle; margin: 4px 8px 4px 0; }
.listen-button.sm:active { transform: translateY(3px); box-shadow: 0 1px 0 #3e6fd1; }

/* 小学词汇：中文意思当选项（可能有好几个字，比语文单字小一些） */
.choice.zh.han.mean { font-size: 40px; font-family: system-ui, "PingFang SC", "Microsoft YaHei", sans-serif; font-weight: 600; }
.big-display.zhmean { font-size: 72px; font-weight: 600; line-height: 1.2; font-family: system-ui, "PingFang SC", "Microsoft YaHei", sans-serif; letter-spacing: .02em; }

/* 手机宽度：图标不要把顶部栏挤成两行 */
@media (max-width: 480px) {
  .icon-button { width: 60px; height: 60px; font-size: 34px; }
  .big-display.emoji { font-size: 140px; }
  .choice.zh.emo { font-size: 84px; }
}
.btn-emoji { font-size: 1.5em; vertical-align: -.1em; }

/* 手写涂画（draw.js） */
.draw-canvas { position: fixed; inset: 0; width: 100vw; height: 100vh; z-index: 50; pointer-events: none; touch-action: none; }
.draw-canvas.on { pointer-events: auto; cursor: crosshair; }
body.drawing { overscroll-behavior: none; -webkit-touch-callout: none; }
.draw-btn { min-width: 44px; height: 44px; border-radius: 22px; border: 2px solid #ccc; background: #fff; font-size: 22px; padding: 0 8px; }
.draw-btn.sel { border-color: #333; box-shadow: 0 0 0 2px #fff, 0 0 0 4px #333; }
.draw-btn.color { min-width: 36px; width: 36px; height: 36px; padding: 0; margin: 4px; }

/* 🔬 科学（science.js） */
.big-button.teal { background: #20a39e; box-shadow: 0 8px 0 #157a76; }
.big-button.teal:active { box-shadow: 0 2px 0 #157a76; }
.big-button.green { background: var(--good); box-shadow: 0 8px 0 #2a8a5a; }
.sci-book-name { font-size: 28px; margin: 8px 0 0; color: var(--muted); }
.sci-unit h3 { font-size: 26px; margin: 14px 0 8px; }
.sci-lessons { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 14px; }
.sci-lesson { background: var(--card); border-radius: 20px; padding: 16px 12px; box-shadow: 0 5px 0 var(--line); display: grid; gap: 4px; justify-items: center; text-align: center; }
.sci-lesson.done { background: #fff4cf; }
.sci-lesson .sci-emoji { font-size: 54px; line-height: 1; }
.sci-lesson .sci-name { font-size: 24px; font-weight: 700; }
.sci-lesson small { font-size: 20px; color: var(--muted); }
.sci-lesson-title { font-size: 26px; font-weight: 700; text-align: center; }
.sci-card { display: grid; gap: 12px; }
.sci-kind { font-size: 22px; color: var(--muted); }
.sci-pic { font-size: 84px; text-align: center; line-height: 1.1; }
.sci-q { font-size: 32px; margin: 0; line-height: 1.4; }
.sci-answer, .sci-result p, .sci-reveal p, .sci-card li, .sci-card p { font-size: 26px; line-height: 1.6; margin: 0; }
.sci-card h3 { font-size: 26px; margin: 8px 0 0; }
.sci-card ul, .sci-card ol { margin: 4px 0; padding-left: 32px; }
.sci-ask { color: #6b4cc2; }
.sci-options { display: grid; gap: 12px; }
.sci-option { background: #fff; border: 3px solid var(--line); border-radius: 20px; padding: 16px; font-size: 28px; font-weight: 700; box-shadow: 0 4px 0 var(--line); }
.sci-option.picked { border-color: var(--primary); }
.sci-option.right { background: #d9f2e4; border-color: var(--good); }
.sci-result { background: #fff8e1; border-radius: 18px; padding: 14px 18px; }
.sci-result h3 { margin: 0 0 6px; }
.sci-level { font-size: 24px; font-weight: 700; padding: 6px 12px; border-radius: 12px; display: inline-block; }
.sci-level.green { background: #d9f2e4; } .sci-level.yellow { background: #fff0c2; } .sci-level.red { background: #fddcc3; }
.sci-safety strong { font-size: 26px; }
.sci-safety { background: #fdeaea; border-radius: 16px; padding: 10px 16px; }
.sci-reveal { background: #e8f4ff; border-radius: 18px; padding: 14px 18px; }
.sci-words { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.sci-word { background: #fff; border-radius: 18px; padding: 12px 6px; box-shadow: 0 4px 0 var(--line); display: grid; justify-items: center; gap: 2px; }
.sci-wemoji { font-size: 44px; } .sci-en { font-size: 26px; font-weight: 700; font-family: "Andika", system-ui, sans-serif; } .sci-word small { font-size: 20px; color: var(--muted); }
.sci-nav { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-top: 4px; }
.sci-toast { position: fixed; left: 50%; bottom: 60px; transform: translateX(-50%); background: rgba(0,0,0,.78); color: #fff; padding: 12px 22px; border-radius: 24px; font-size: 22px; z-index: 70; }

/* 科学：每日一问、徽章、拼音 */
.sci-daily { display: flex; align-items: center; gap: 14px; text-align: left; background: #fff4cf; border-radius: 22px; padding: 14px 18px; box-shadow: 0 5px 0 #f0d88a; }
.sci-daily-pic { font-size: 54px; line-height: 1; }
.sci-daily-text { flex: 1; display: grid; gap: 4px; font-size: 26px; font-weight: 700; }
.sci-daily-text small { font-size: 20px; color: #a06a00; font-weight: 400; }
.sci-daily-go { font-size: 32px; color: #a06a00; }
.sci-sum { font-size: 22px; color: var(--muted); margin: 0; text-align: center; }
.sci-badges { max-width: 640px; max-height: 88vh; overflow: auto; text-align: left; }
.sci-badges h3 { font-size: 24px; margin: 12px 0 6px; }
.sci-badge-row { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 10px; }
.sci-badge { background: #f1eef7; border-radius: 16px; padding: 10px 6px; display: grid; justify-items: center; gap: 2px; text-align: center; opacity: .55; filter: grayscale(.8); }
.sci-badge.on { background: #fff4cf; opacity: 1; filter: none; box-shadow: 0 3px 0 #f0d88a; }
.sci-badge-emoji { font-size: 40px; line-height: 1; } .sci-badge-name { font-size: 20px; font-weight: 700; } .sci-badge small { font-size: 18px; color: var(--muted); }
body.sci-py .sci-card, body.sci-py .sci-lesson-title, body.sci-py .sci-daily-text { line-height: 2.3; }
body.sci-py .sci-card p, body.sci-py .sci-card li, body.sci-py .sci-q, body.sci-py .sci-option { line-height: 2.3; }
ruby { ruby-position: over; }
rt { font-size: .42em; font-weight: 400; color: var(--muted); letter-spacing: 0; }

.big-button rt, .sci-badges rt { color: rgba(255,255,255,.9); }
.sci-option rt, .sci-badge rt { color: var(--muted); }

/* 家庭登录页（孩子页和家长页共用） */
.family-login input { font-size: 22px; padding: 12px 16px; width: min(320px, 80vw); border-radius: 14px; border: 2px solid #d8cdb4; margin: 6px 0; text-align: center; background: #fff; }
.family-login .msg { padding: 8px 12px; border-radius: 10px; font-size: 15px; background: #fde8e0; margin: 6px 0; }
.family-tag { font-size: 15px; margin: 4px 0; color: var(--muted); }
