/* ===== 基础 ===== */
* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
:root {
  --bg: #FFF7F0;
  --card: #FFFFFF;
  --primary: #FF8A65;
  --primary-d: #F4714B;
  --accent: #4FC3F7;
  --accent2: #FFD166;
  --green: #66BB6A;
  --purple: #BA68C8;
  --text: #4A4A4A;
  --muted: #9AA0A6;
  --shadow: 0 6px 24px rgba(0,0,0,.08);
  --radius: 22px;
}
html { font-size: 16px; }
body {
  font-family: -apple-system, "PingFang SC", "Microsoft YaHei", "Segoe UI", sans-serif;
  background: linear-gradient(180deg, #FFE9DC 0%, #FFF7F0 30%, #F2F9FF 100%);
  color: var(--text);
  min-height: 100vh;
  padding-bottom: 40px;
  line-height: 1.6;
}
#app { max-width: 720px; margin: 0 auto; padding: 0 16px; }
button { font-family: inherit; cursor: pointer; border: none; outline: none; }
img { max-width: 100%; }

/* ===== 顶部栏 ===== */
.topbar {
  display: flex; align-items: center; gap: 10px;
  padding: 16px 4px 12px;
}
.topbar .back {
  width: 40px; height: 40px; border-radius: 50%;
  background: #fff; box-shadow: var(--shadow);
  font-size: 20px; color: var(--primary); display: flex; align-items: center; justify-content: center;
}
.topbar .title { font-size: 20px; font-weight: 800; flex: 1; }
.topbar .title small { display:block; font-size: 12px; font-weight: 500; color: var(--muted); }

/* 教材切换 */
.tb-switch {
  display: flex; flex-direction: column; gap: 6px; background: #fff; border-radius: 999px; padding: 4px; box-shadow: var(--shadow);
}
.tb-grades, .tb-terms { display: flex; flex-wrap: wrap; gap: 4px; justify-content: center; }
.tb-switch button {
  border-radius: 999px; padding: 8px 16px; font-size: 14px; font-weight: 700; color: var(--muted); background: transparent;
}
.tb-switch button.active { background: var(--primary); color: #fff; }

/* ===== 首页 ===== */
.home-hero {
  background: linear-gradient(135deg, #FF8A65, #FFB74D);
  border-radius: 28px; padding: 26px 22px; color: #fff; box-shadow: 0 10px 30px rgba(255,138,101,.35);
  margin-bottom: 18px;
}
.home-hero h1 { font-size: 26px; margin-bottom: 6px; }
.home-hero p { font-size: 14px; opacity: .92; }
.home-hero .tb-row { margin-top: 16px; display:flex; align-items:center; gap:10px; }
.home-hero .tb-row span { font-size: 13px; opacity:.9; }
.home-hero .tb-switch { background: rgba(255,255,255,.25); }
.home-hero .tb-switch button { color: #fff; }
.home-hero .tb-switch button.active { background: #fff; color: var(--primary); }

.section-title { font-size: 17px; font-weight: 800; margin: 18px 4px 12px; display:flex; align-items:center; gap:8px; }

.module-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.module-card {
  background: var(--card); border-radius: var(--radius); padding: 18px 16px; box-shadow: var(--shadow);
  display: flex; flex-direction: column; gap: 8px; transition: transform .12s; border: 2px solid transparent;
}
.module-card:active { transform: scale(.97); }
.module-card .m-icon { font-size: 38px; }
.module-card .m-name { font-size: 17px; font-weight: 800; }
.module-card .m-desc { font-size: 12px; color: var(--muted); }
.module-card.c1 { background: linear-gradient(135deg,#FFF3E0,#FFE0B2); }
.module-card.c2 { background: linear-gradient(135deg,#E3F2FD,#B3E5FC); }
.module-card.c3 { background: linear-gradient(135deg,#F3E5F5,#E1BEE7); }
.module-card.c4 { background: linear-gradient(135deg,#E8F5E9,#C8E6C9); }
.module-card.c5 { background: linear-gradient(135deg,#FFF9C4,#FFE082); }

.home-tip { text-align:center; color: var(--muted); font-size: 12px; margin-top: 22px; }

/* ===== 通用卡片/按钮 ===== */
.card { background: var(--card); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); margin-bottom: 14px; }
.btn {
  border-radius: 999px; padding: 14px 18px; font-size: 16px; font-weight: 800;
  background: var(--primary); color: #fff; box-shadow: 0 6px 16px rgba(255,138,101,.35); width: 100%;
}
.btn:active { transform: scale(.98); }
.btn.accent { background: var(--accent); box-shadow: 0 6px 16px rgba(79,195,247,.35); }
.btn.green { background: var(--green); box-shadow: 0 6px 16px rgba(102,187,106,.35); }
.btn.ghost { background: #fff; color: var(--primary); border: 2px solid var(--primary); box-shadow:none; }
.btn.small { width: auto; padding: 10px 16px; font-size: 14px; }
.btn:disabled { opacity: .5; }

.row { display:flex; gap: 10px; }
.row .btn { flex: 1; }
.spacer { height: 14px; }

/* ===== 列表选择 ===== */
.list-item {
  display: flex; align-items: center; gap: 12px; background: #fff; border-radius: 18px; padding: 16px; margin-bottom: 10px;
  box-shadow: var(--shadow); transition: transform .12s;
}
.list-item:active { transform: scale(.98); }
.list-item .li-emoji { font-size: 30px; width: 46px; text-align:center; }
.list-item .li-main { flex: 1; }
.list-item .li-title { font-size: 16px; font-weight: 800; }
.list-item .li-sub { font-size: 12px; color: var(--muted); }
.list-item .li-score { font-size: 13px; font-weight: 800; color: var(--green); }
.list-item .li-arrow { font-size: 22px; color: var(--muted); }

/* ===== 学习/展示大字 ===== */
.big-char {
  font-size: 120px; text-align: center; font-weight: 800; color: var(--primary);
  line-height: 1.1; padding: 20px 0;
}
.big-pinyin { text-align:center; font-size: 34px; color: var(--accent); font-weight: 700; }
.big-word { text-align:center; font-size: 22px; font-weight: 700; margin-top: 6px; }
.big-meaning { text-align:center; color: var(--muted); font-size: 15px; margin-top: 4px; }
.speak { display:inline-flex; align-items:center; justify-content:center; width: 34px; height:34px; border-radius:50%; background: var(--accent); color:#fff; font-size: 16px; margin-left: 8px; vertical-align: middle; }

.pager { text-align:center; color: var(--muted); font-size: 13px; margin: 10px 0; }

/* ===== 测验 ===== */
.quiz-q { font-size: 30px; font-weight: 800; text-align:center; margin: 18px 0 6px; }
.quiz-hint { text-align:center; color: var(--muted); font-size: 14px; margin-bottom: 16px; }
.options { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.opt {
  background: #fff; border: 2px solid #FFE0B2; border-radius: 16px; padding: 18px 10px; text-align:center;
  font-size: 22px; font-weight: 800; color: var(--text); transition: all .12s;
}
.opt:active { transform: scale(.97); }
.opt.correct { background: #E8F5E9; border-color: var(--green); color: var(--green); }
.opt.wrong { background: #FFEBEE; border-color: #EF9A9A; color: #E53935; }
.opt.dim { opacity: .45; pointer-events: none; }
.opt.disabled { pointer-events: none; }

.quiz-progress { display:flex; align-items:center; justify-content:space-between; font-size: 13px; color: var(--muted); margin-bottom: 6px; }
.progress-bar { height: 8px; background: #FFE0B2; border-radius: 999px; overflow:hidden; margin-bottom: 14px; }
.progress-bar > i { display:block; height:100%; background: var(--primary); border-radius:999px; transition: width .3s; }

/* 古诗 */
.poem-title { text-align:center; font-size: 22px; font-weight: 800; }
.poem-author { text-align:center; color: var(--muted); font-size: 13px; margin-bottom: 14px; }
.poem-body { font-size: 22px; line-height: 2.1; text-align:center; }
.poem-body .blank { display:inline-block; min-width: 1.4em; border-bottom: 3px solid var(--primary); color: var(--primary); font-weight:800; }
.poem-body .blank.filled { border-color: var(--green); color: var(--green); }

/* 英语 */
.word-en { font-size: 34px; font-weight: 800; color: var(--primary); text-align:center; }
.word-cn { text-align:center; font-size: 22px; font-weight:700; margin-top:4px; }
.word-sentence { background:#F2F9FF; border-radius:14px; padding:12px; margin-top:14px; font-size:15px; }
.word-sentence .cn { color: var(--muted); font-size: 13px; margin-top:4px; }

/* 数学 */
.math-q { font-size: 46px; font-weight: 900; text-align:center; margin: 20px 0; letter-spacing: 2px; }
.category-list .math-card {
  display:flex; align-items:center; gap:14px; background:#fff; border-radius:20px; padding:18px; margin-bottom:12px; box-shadow: var(--shadow);
}
.category-list .math-card:active { transform: scale(.98); }
.math-icon-wrap { width:54px; height:54px; border-radius:16px; background:#FFF0E8; display:flex; align-items:center; justify-content:center; font-size:30px; }
.math-info { flex:1; }
.math-name { font-size:17px; font-weight:800; }
.math-desc { font-size:12px; color: var(--muted); }
.math-card-actions { display:flex; gap:8px; margin-top:10px; }
.mini-btn { border-radius: 999px; padding: 8px 14px; font-size: 13px; font-weight:700; background:#FFF0E8; color:var(--primary); }
.mini-btn.timed { background:#E3F2FD; color: var(--accent); }

.multi-table { display:flex; flex-direction:column; gap:6px; margin-top:8px; }
.multi-row { display:flex; gap:6px; }
.multi-cell { flex:1; background:#FFF3E0; border-radius:10px; padding:8px 4px; text-align:center; }
.multi-formula { display:block; font-size:14px; font-weight:800; color:var(--primary); }
.multi-text { display:block; font-size:11px; color:var(--muted); }

.shape-card, .money-card { background:#fff; border-radius:18px; padding:16px; margin-bottom:12px; box-shadow: var(--shadow); }
.shape-name { font-size:18px; font-weight:800; }
.shape-desc { color: var(--muted); font-size:14px; margin:4px 0; }
.shape-ex { font-size:13px; color: var(--accent); }
.money-card { display:flex; align-items:center; gap:14px; }
.money-emoji { width:48px; height:48px; border-radius:10px; display:flex; align-items:center; justify-content:center; font-size:22px; color:#fff; font-weight:800; }
.money-val { font-size:18px; font-weight:800; }
.money-desc { font-size:12px; color: var(--muted); }

/* 计时 */
.timer-bar { text-align:center; font-size: 22px; font-weight:800; color: var(--accent); margin-bottom: 10px; }

/* ===== 结果页 ===== */
.result-wrap { text-align:center; padding: 24px 8px; }
.result-emoji { font-size: 64px; }
.result-score { font-size: 40px; font-weight: 900; color: var(--primary); margin: 6px 0; }
.result-percent { font-size: 16px; color: var(--muted); }
.result-detail { font-size: 14px; color: var(--muted); margin: 8px 0 18px; }

/* 听读提示 */
.speak-note { text-align:center; color: var(--muted); font-size: 12px; margin-top: 10px; }

/* 书法：本地文件打开提示 */
.ca-tip { background: #FFF7E6; border: 1px solid #FFE0A3; color: #9A6700; border-radius: 12px; padding: 12px 16px; font-size: 12px; line-height: 1.6; margin: 0 16px 12px; }
.ca-tip b { color: #D48806; }

/* ===== 书法课堂 ===== */
.module-card.c6 { background: linear-gradient(135deg,#E0F2F1,#B2DFDB); }
.ca-folder-tb { border-color: var(--accent); }
.ca-folder .li-tag { font-size: 11px; font-weight: 800; color: var(--accent); background: #E1F5FE; border-radius: 999px; padding: 2px 10px; margin-left: 8px; }
.ca-search { display:flex; align-items:center; gap:8px; background:#fff; border-radius:999px; padding:6px 8px 6px 18px; box-shadow: var(--shadow); margin-bottom: 14px; }
.ca-search-input { flex:1; border:none; outline:none; font-size:16px; font-family:inherit; background:transparent; }
.ca-search-clear { width:32px; height:32px; border-radius:50%; border:none; background:rgba(0,0,0,.06); color:#999; font-size:15px; }
.ca-grid { display:grid; grid-template-columns: repeat(4, 1fr); gap:10px; }
.ca-char {
  background:#fff; border-radius:18px; padding:14px 6px 10px; box-shadow: var(--shadow);
  display:flex; flex-direction:column; align-items:center; gap:2px; transition: transform .12s; border:2px solid transparent;
}
.ca-char:active { transform: scale(.96); border-color: var(--accent); }
.ca-char-text { font-size: 40px; font-weight: 900; color: #2B2B2B; line-height:1.1; }
.ca-char-stroke { font-size: 11px; color: var(--muted); }
.ca-char .speak { width:28px; height:28px; font-size:13px; margin-top:2px; }
.no-result { text-align:center; color: var(--muted); padding: 30px; }

.ca-modal {
  position: fixed; inset: 0; background: rgba(0,0,0,.92); z-index: 9999;
  display: none; align-items: center; justify-content: center; flex-direction: column; padding: 16px;
}
.ca-modal-inner { position: relative; width: 100%; max-width: 680px; }
.ca-video { width: 100%; max-height: 78vh; border-radius: 16px; background:#000; }
.ca-close {
  position: absolute; top: -52px; right: 0; width: 42px; height: 42px; border-radius: 50%;
  background: rgba(255,255,255,.2); color:#fff; font-size: 20px; border:none;
}
.ca-close:active { background: rgba(255,138,101,.6); }
.ca-cap { text-align:center; color:#fff; font-size: 18px; font-weight: 800; margin-top: 12px; }
