/* ===== 小小识字王 · 儿童向视觉 ===== */
:root {
  --bg: #FFF7EC;
  --card: #FFFFFF;
  --ink: #3B3226;
  --ink-soft: #7A6A55;
  --line: #EADFCB;
  --brand: #FF8A3D;
  --brand-2: #FFB703;
  --blue: #4DABF7;
  --green: #37B24D;
  --red: #FF6B6B;
  --purple: #9775FA;
  --pink: #F06595;
  --teal: #20C997;
  --shadow: 0 6px 0 rgba(0,0,0,.07), 0 10px 22px rgba(120,90,50,.10);
  --shadow-sm: 0 3px 0 rgba(0,0,0,.06), 0 5px 12px rgba(120,90,50,.08);
  --radius: 22px;
  --grid-line: #E7B7A0;
  --font-ui: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", system-ui, -apple-system, sans-serif;
  --font-kai: "Kaiti SC", "STKaiti", "KaiTi", "Songti SC", "SimSun", serif;
}

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

html, body {
  margin: 0; padding: 0;
  height: 100%;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-ui);
  overscroll-behavior: none;
}

body {
  background-image:
    radial-gradient(circle at 8% 6%, #FFE3C2 0%, transparent 34%),
    radial-gradient(circle at 94% 12%, #D8F0FF 0%, transparent 30%),
    radial-gradient(circle at 50% 100%, #E6FFE9 0%, transparent 42%);
  background-attachment: fixed;
}

button { font-family: inherit; cursor: pointer; border: none; background: none; color: inherit; }
h1, h2, h3 { margin: 0; font-weight: 800; }
small { font-weight: 500; color: var(--ink-soft); }

/* ============ 顶栏 ============ */
.topbar {
  position: sticky; top: 0; z-index: 60;
  display: flex; align-items: center; gap: 10px;
  padding: 10px max(14px, env(safe-area-inset-left)) 10px max(14px, env(safe-area-inset-right));
  background: rgba(255,250,242,.88);
  backdrop-filter: blur(12px);
  border-bottom: 2px solid var(--line);
}
.topbar-title { font-weight: 800; font-size: 17px; flex: 1; text-align: center; }
.icon-btn {
  width: 42px; height: 42px; border-radius: 14px;
  background: #fff; box-shadow: var(--shadow-sm);
  font-size: 19px; display: grid; place-items: center;
  transition: transform .12s;
}
.icon-btn:active { transform: scale(.92); }
.icon-btn.big { width: auto; min-width: 48px; height: 48px; padding: 0 14px; font-size: 16px; font-weight: 700; }
.starcount {
  display: flex; align-items: center; gap: 4px;
  background: #FFF3D6; border: 2px solid #FFE0A3;
  padding: 6px 12px; border-radius: 999px; font-weight: 800; color: #B8860B;
  font-size: 15px;
}
.star-ico { font-size: 17px; }

/* ============ 屏幕切换 ============ */
main { padding: 0 0 40px; }
.screen { display: none; padding: 16px max(14px, env(safe-area-inset-left)) 30px max(14px, env(safe-area-inset-right)); max-width: 960px; margin: 0 auto; }
.screen.active { display: block; animation: fadeUp .26s ease-out; }
@keyframes fadeUp { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

.section-title {
  font-size: 20px; margin: 22px 4px 12px;
  display: flex; align-items: baseline; gap: 8px;
}
.section-title small { font-size: 13px; }

/* ============ 首页 ============ */
.hero {
  display: flex; align-items: center; gap: 14px;
  background: linear-gradient(135deg, #FFE9CC, #FFF6E6 60%, #E7F6FF);
  border: 2px solid #FFE0B8;
  border-radius: var(--radius); padding: 16px 18px; box-shadow: var(--shadow);
}
.hero-emoji { font-size: 46px; animation: bob 2.4s ease-in-out infinite; }
@keyframes bob { 0%,100% { transform: translateY(0) rotate(-4deg); } 50% { transform: translateY(-7px) rotate(4deg); } }
.hero-text h1 { font-size: 25px; letter-spacing: 1px; }
.hero-text p { margin: 4px 0 0; color: var(--ink-soft); font-size: 14px; }

.home-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-top: 14px; }
.stat-pill {
  background: #fff; border: 2px solid var(--line); border-radius: 18px;
  padding: 10px 6px; box-shadow: var(--shadow-sm); text-align: center; min-width: 0;
}
.stat-pill b { display: block; font-size: 20px; color: var(--brand); line-height: 1.25; }
.stat-pill span { font-size: 11.5px; color: var(--ink-soft); display: block; white-space: nowrap; }

.quick-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-top: 14px; }
.quick-btn {
  background: #fff; border: 2px solid var(--line); border-radius: 18px;
  padding: 12px 4px; box-shadow: var(--shadow-sm);
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  font-size: 12.5px; font-weight: 700; transition: transform .12s;
}
.quick-btn:active { transform: scale(.94); }
.qb-ico { font-size: 24px; }

/* 课程卡片 */
.lesson-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(158px, 1fr)); gap: 12px; }
.tier-block .lesson-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
.tier-more { margin-top: 10px; }
@media (max-width: 460px) {
  .lesson-grid, .tier-block .lesson-grid { grid-template-columns: repeat(2, 1fr); gap: 9px; }
}
.lesson-card {
  position: relative; overflow: hidden;
  background: #fff; border: 2px solid var(--line); border-radius: var(--radius);
  padding: 14px 14px 12px; text-align: left; box-shadow: var(--shadow-sm);
  transition: transform .14s;
}
.lesson-card:active { transform: scale(.97); }
.lesson-card .lc-bar { position: absolute; left: 0; top: 0; bottom: 0; width: 7px; }
.lesson-card .lc-ico { font-size: 27px; }
.lesson-card .lc-title { font-weight: 800; font-size: 16px; margin: 5px 0 2px; }
.lesson-card .lc-intro {
  font-size: 11.5px; color: var(--ink-soft); line-height: 1.4; height: 32px;
  overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
}
.lesson-card .lc-foot { display: flex; align-items: center; gap: 6px; margin-top: 8px; }
.lc-track { flex: 1; height: 8px; background: #F0E7D8; border-radius: 99px; overflow: hidden; }
.lc-fill { height: 100%; border-radius: 99px; transition: width .4s; }
.lc-count { font-size: 11px; color: var(--ink-soft); font-weight: 700; }
.lc-done { position: absolute; right: 10px; top: 10px; font-size: 17px; }

/* ============ 课程字表 ============ */
.lesson-head {
  border-radius: var(--radius); padding: 16px 18px; color: #fff;
  box-shadow: var(--shadow); display: flex; align-items: center; gap: 14px;
}
.lesson-head .lh-ico { font-size: 40px; }
.lesson-head h2 { font-size: 22px; }
.lesson-head p { margin: 3px 0 0; font-size: 13px; opacity: .95; }
.lesson-actions { display: flex; gap: 10px; margin-top: 14px; }
.lesson-actions .big-btn { flex: 1; }

.big-btn {
  padding: 14px 18px; border-radius: 18px; background: #fff;
  border: 2px solid var(--line); box-shadow: var(--shadow-sm);
  font-size: 16px; font-weight: 800; transition: transform .12s;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
}
.big-btn:active { transform: scale(.96); }
.big-btn.primary { background: linear-gradient(135deg, var(--brand), var(--brand-2)); color: #fff; border-color: transparent; }
.big-btn.danger { background: #FFF0F0; border-color: #FFC9C9; color: #D6336C; }

.char-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); gap: 10px; margin-top: 16px; }
.char-cell {
  position: relative; background: #fff; border: 2px solid var(--line);
  border-radius: 16px; padding: 8px 4px 6px; text-align: center;
  box-shadow: var(--shadow-sm); transition: transform .12s;
}
.char-cell:active { transform: scale(.95); }
.char-cell .cc-py { font-size: 11px; color: var(--ink-soft); font-weight: 700; }
.char-cell .cc-ch { font-family: var(--font-kai); font-size: 38px; line-height: 1.15; }
.char-cell .cc-stars { font-size: 10px; height: 12px; letter-spacing: -1px; color: #FFB703; }
.char-cell.lv2 { background: #FFFCF3; }
.char-cell.lv3 { background: #F7F9FF; }
.char-cell .cc-lv { position: absolute; left: 5px; top: 4px; font-size: 9px; padding: 1px 4px; border-radius: 6px; background: #F1EADF; color: var(--ink-soft); font-weight: 700; }

/* ============ 学习页 ============ */
.learn-tabs { display: flex; gap: 8px; background: #fff; padding: 6px; border-radius: 18px; border: 2px solid var(--line); box-shadow: var(--shadow-sm); }
.tab { flex: 1; padding: 11px 6px; border-radius: 13px; font-weight: 800; font-size: 14.5px; color: var(--ink-soft); }
.tab.active { background: linear-gradient(135deg, var(--brand), var(--brand-2)); color: #fff; }

.learn-body { margin-top: 14px; }
.grid-wrap {
  display: flex; gap: 18px; align-items: flex-start;
  background: #fff; border: 2px solid var(--line); border-radius: var(--radius);
  padding: 16px; box-shadow: var(--shadow);
}
.tianzige {
  position: relative; flex: 0 0 auto;
  width: min(52vw, 300px); aspect-ratio: 1 / 1;
  border: 4px solid var(--grid-line); border-radius: 10px;
  background:
    linear-gradient(to right, transparent calc(50% - 1px), var(--grid-line) calc(50% - 1px), var(--grid-line) calc(50% + 1px), transparent calc(50% + 1px)),
    linear-gradient(to bottom, transparent calc(50% - 1px), var(--grid-line) calc(50% - 1px), var(--grid-line) calc(50% + 1px), transparent calc(50% + 1px)),
    #FFFDF8;
  overflow: hidden; touch-action: none;
}
.tz-svg { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
#traceCanvas { position: absolute; inset: 0; width: 100%; height: 100%; touch-action: none; }
/* 写字板：实心笔画（不是描边） */
.sb-stroke { stroke: none; }
.sb-outline { fill-opacity: .22; }
.sb-written { fill: #2B2118; }
.sb-current { fill: var(--brand); }
.sb-faint { fill: #F3D4B6; fill-opacity: .75; }
.sb-starthint { pointer-events: none; }
.guide-line { fill: none; stroke: var(--brand-2); stroke-width: 14; stroke-linecap: round; stroke-linejoin: round; opacity: .5; }
.stroke-num-layer { position: absolute; inset: 0; pointer-events: none; }
.stroke-dot {
  position: absolute; width: 26px; height: 26px; margin: -13px 0 0 -13px;
  border-radius: 50%; background: #FF4D6D; color: #fff;
  font-size: 13px; font-weight: 800; display: grid; place-items: center;
  box-shadow: 0 2px 6px #0003; opacity: 0; transition: opacity .25s, transform .25s;
  transform: scale(.4);
}
.stroke-dot.show { opacity: 1; transform: scale(1); }

.char-info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 8px; }
.pinyin { font-size: 34px; font-weight: 800; color: var(--brand); letter-spacing: 2px; }
.char-meta { display: flex; gap: 6px; flex-wrap: wrap; }
.meta-chip { font-size: 11.5px; font-weight: 700; background: #F4EFE6; color: var(--ink-soft); padding: 4px 9px; border-radius: 99px; }
.meta-chip.lv1 { background: #E7F9EC; color: #237A3B; }
.meta-chip.lv2 { background: #FFF6E0; color: #9A6B00; }
.meta-chip.lv3 { background: #EEF1FF; color: #4457C4; }
.char-mean { font-size: 16px; line-height: 1.55; color: var(--ink); background: #FFF9F0; border-left: 5px solid var(--brand-2); padding: 9px 12px; border-radius: 0 12px 12px 0; }
.audio-row { display: flex; gap: 8px; flex-wrap: wrap; }
.audio-btn {
  background: #EEF6FF; border: 2px solid #CFE6FF; color: #1864AB;
  padding: 10px 14px; border-radius: 14px; font-weight: 800; font-size: 14px;
  display: inline-flex; align-items: center; gap: 6px; transition: transform .12s;
}
.audio-btn:active { transform: scale(.94); }
.progress-hint { font-size: 12.5px; color: var(--ink-soft); }

/* 笔顺面板 */
.stroke-panel { background: #fff; border: 2px solid var(--line); border-radius: var(--radius); padding: 12px 14px; box-shadow: var(--shadow-sm); margin-top: 14px; }
.stroke-toolbar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.stroke-toolbar .icon-btn.big { padding: 0 12px; }
#btnSpeed { flex: 0 0 auto; }
.icon-btn.play { background: linear-gradient(135deg, #4DABF7, #339AF0); color: #fff; }
.stroke-now { flex: 1 0 100%; order: 9; text-align: center; font-weight: 800; color: var(--ink-soft); font-size: 15px; padding-top: 2px; }
.stroke-tip { margin-top: 10px; font-size: 13.5px; color: var(--ink-soft); background: #FFFBF3; padding: 9px 12px; border-radius: 12px; }
.stroke-tip b { color: var(--brand); font-size: 15px; }

/* 组词 */
.word-panel { margin-top: 14px; }
.mini-title { font-size: 15.5px; margin: 16px 4px 9px; color: var(--ink-soft); display: flex; align-items: baseline; gap: 7px; }
.mini-title small { font-size: 12px; }
.word-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(146px, 1fr)); gap: 10px; }
.word-card {
  background: #fff; border: 2px solid var(--line); border-radius: 16px;
  padding: 11px 12px; box-shadow: var(--shadow-sm); text-align: center;
  transition: transform .12s;
}
.word-card:active { transform: scale(.96); }
.word-card .wc-py { font-size: 12.5px; color: var(--blue); font-weight: 700; }
.word-card .wc-w { font-family: var(--font-kai); font-size: 26px; letter-spacing: 2px; }
.sentence-card {
  background: linear-gradient(135deg, #F3FBFF, #FFF8EC);
  border: 2px dashed #BFE3FF; border-radius: var(--radius); padding: 16px;
  text-align: center;
}
.sentence-card .sc-py { font-size: 14.5px; color: var(--blue); font-weight: 700; line-height: 1.9; word-spacing: 2px; }
.sentence-card .sc-s { font-family: var(--font-kai); font-size: 27px; line-height: 1.6; margin-top: 6px; }
.sentence-card .sc-play { margin-top: 10px; }
.sentence-card .sc-play .audio-btn { background: #fff; }

.learn-footer { display: flex; gap: 10px; margin-top: 18px; }
.learn-footer .big-btn { flex: 1; }

/* ============ 识字墙 ============ */
.wall-filter { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.filter-chip {
  padding: 8px 14px; border-radius: 99px; background: #fff; border: 2px solid var(--line);
  font-size: 13px; font-weight: 700; color: var(--ink-soft);
}
.filter-chip.active { background: var(--ink); color: #fff; border-color: var(--ink); }
.wall-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(76px, 1fr)); gap: 9px; }
.wall-cell {
  position: relative; background: #fff; border: 2px solid var(--line); border-radius: 14px;
  padding: 6px 3px; text-align: center; box-shadow: var(--shadow-sm);
}
.wall-cell .wc-ch { font-family: var(--font-kai); font-size: 34px; }
.wall-cell .wc-py { font-size: 10.5px; color: var(--ink-soft); height: 14px; overflow: hidden; }
.wall-cell.learned { background: linear-gradient(160deg, #FFF8E8, #FFF); border-color: #FFD98A; }
.wall-cell .wc-dot { position: absolute; right: 5px; top: 5px; font-size: 10px; }
.wall-cell.off { opacity: .38; filter: grayscale(.7); }

/* ============ 游戏 ============ */
.game-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(168px, 1fr)); gap: 12px; }
.game-card {
  background: #fff; border: 2px solid var(--line); border-radius: var(--radius);
  padding: 18px 14px; text-align: left; box-shadow: var(--shadow-sm);
  display: flex; flex-direction: column; gap: 3px; transition: transform .12s;
}
.game-card:active { transform: scale(.96); }
.gc-ico { font-size: 34px; }
.gc-name { font-weight: 800; font-size: 17px; }
.gc-desc { font-size: 12px; color: var(--ink-soft); }
.scope-row { display: flex; gap: 8px; flex-wrap: wrap; }

/* 游戏进行中 */
.play-head { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.play-progress { flex: 1; height: 14px; background: #F0E7D8; border-radius: 99px; overflow: hidden; border: 2px solid #fff; box-shadow: var(--shadow-sm); }
.play-bar { height: 100%; width: 0; background: linear-gradient(90deg, #69DB7C, #37B24D); border-radius: 99px; transition: width .35s; }
.play-score { font-weight: 800; color: var(--brand); font-size: 16px; }
.play-stage { min-height: 300px; }
.play-feedback { text-align: center; font-size: 22px; font-weight: 800; height: 34px; margin-top: 10px; }

.q-prompt { text-align: center; font-size: 15px; color: var(--ink-soft); font-weight: 700; margin-bottom: 12px; }
.q-bigchar {
  font-family: var(--font-kai); font-size: min(30vw, 150px); line-height: 1.05;
  text-align: center; color: var(--ink);
}
.q-bigchar .qb-py { font-family: var(--font-ui); font-size: 15px; color: var(--blue); display: block; font-weight: 700; }
.opt-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; max-width: 460px; margin: 0 auto; }
.opt-grid.four { grid-template-columns: repeat(2, 1fr); }
.opt-btn {
  background: #fff; border: 3px solid var(--line); border-radius: 20px;
  padding: 16px 8px; box-shadow: var(--shadow-sm); transition: transform .12s, border-color .2s;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  min-height: 96px;
}
.opt-btn:active { transform: scale(.95); }
.opt-btn .ob-emoji { font-size: 46px; }
.opt-btn .ob-char { font-family: var(--font-kai); font-size: 52px; line-height: 1.1; }
.opt-btn .ob-py { font-size: 12px; color: var(--ink-soft); font-weight: 700; }
.opt-btn.correct { border-color: var(--green); background: #EBFBEE; animation: pop .35s; }
.opt-btn.wrong { border-color: var(--red); background: #FFF0F0; animation: shake .35s; }
.opt-btn.reveal { border-color: var(--green); border-style: dashed; }
@keyframes pop { 0% { transform: scale(1); } 45% { transform: scale(1.09); } 100% { transform: scale(1); } }
@keyframes shake { 0%,100% { transform: translateX(0); } 25% { transform: translateX(-8px); } 75% { transform: translateX(8px); } }

/* 记忆配对 */
.match-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; max-width: 520px; margin: 0 auto; }
.match-card { aspect-ratio: 3/4; perspective: 800px; }
.match-inner { position: relative; width: 100%; height: 100%; transition: transform .4s; transform-style: preserve-3d; }
.match-card.flipped .match-inner, .match-card.done .match-inner { transform: rotateY(180deg); }
.match-face { position: absolute; inset: 0; backface-visibility: hidden; border-radius: 16px; display: grid; place-items: center; box-shadow: var(--shadow-sm); border: 3px solid #fff; }
.match-front { background: linear-gradient(135deg, #7CB8FF, #4DABF7); color: #fff; font-size: 30px; }
.match-back { background: #fff; transform: rotateY(180deg); border-color: var(--line); }
.match-back .mb-emoji { font-size: min(11vw, 48px); }
.match-back .mb-char { font-family: var(--font-kai); font-size: min(12vw, 52px); }
.match-card.done .match-back { border-color: #8CE99A; background: #F1FDF4; }

/* 笔顺挑战 */
.stroke-challenge { display: flex; flex-direction: column; align-items: center; gap: 10px; }
.stroke-challenge .tianzige { width: min(72vw, 340px); }
.challenge-hint { font-size: 15px; font-weight: 800; color: var(--ink-soft); text-align: center; min-height: 24px; }
.challenge-hint b { color: var(--brand); }

/* ============ 结算 ============ */
.result-card { background: #fff; border: 2px solid var(--line); border-radius: 28px; padding: 26px 20px; text-align: center; box-shadow: var(--shadow); margin-top: 20px; }
.result-emoji { font-size: 64px; animation: bob 1.8s ease-in-out infinite; }
.result-stars { font-size: 40px; letter-spacing: 4px; color: #FFC107; margin: 8px 0; }
.result-line { color: var(--ink-soft); font-size: 15px; }
.result-wrong { margin-top: 14px; display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.wrong-chip { background: #FFF0F0; border: 2px solid #FFC9C9; border-radius: 14px; padding: 8px 12px; display: flex; align-items: center; gap: 7px; }
.wrong-chip .wcc { font-family: var(--font-kai); font-size: 26px; }
.wrong-chip .wcp { font-size: 11px; color: var(--red); font-weight: 700; }
.result-actions { display: flex; gap: 10px; margin-top: 20px; }
.result-actions .big-btn { flex: 1; }

/* ============ 报告 ============ */
.report-summary { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: 10px; }
.rs-card { background: #fff; border: 2px solid var(--line); border-radius: 18px; padding: 14px; text-align: center; box-shadow: var(--shadow-sm); }
.rs-card b { display: block; font-size: 26px; color: var(--brand); }
.rs-card span { font-size: 12px; color: var(--ink-soft); }
.report-lessons { display: flex; flex-direction: column; gap: 9px; }
.rl-row { display: flex; align-items: center; gap: 10px; background: #fff; border: 2px solid var(--line); border-radius: 14px; padding: 10px 12px; box-shadow: var(--shadow-sm); }
.rl-name { width: 96px; font-weight: 800; font-size: 14px; }
.rl-track { flex: 1; height: 10px; background: #F0E7D8; border-radius: 99px; overflow: hidden; }
.rl-fill { height: 100%; border-radius: 99px; }
.rl-num { font-size: 12.5px; color: var(--ink-soft); font-weight: 700; width: 62px; text-align: right; }
.weak-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 9px; }
.weak-item { background: #fff; border: 2px solid var(--line); border-radius: 14px; padding: 9px; text-align: center; box-shadow: var(--shadow-sm); }
.weak-item .wi-ch { font-family: var(--font-kai); font-size: 32px; }
.weak-item .wi-sub { font-size: 11px; color: var(--red); font-weight: 700; }

/* ============ 家长页 ============ */
.parent-note { background: #FFF8E8; border: 2px solid #FFE0A3; border-radius: 18px; padding: 14px 16px; font-size: 14.5px; line-height: 1.65; }
.parent-card { background: #fff; border: 2px solid var(--line); border-radius: var(--radius); padding: 6px 16px 16px; margin-top: 14px; box-shadow: var(--shadow-sm); }
.goal-row { display: flex; gap: 8px; flex-wrap: wrap; }
.switch-row { display: flex; align-items: center; justify-content: space-between; padding: 12px 0; border-bottom: 1px dashed var(--line); font-size: 15px; font-weight: 600; }
.switch { appearance: none; width: 50px; height: 30px; background: #E3D9C8; border-radius: 99px; position: relative; transition: background .2s; flex: 0 0 auto; }
.switch::after { content: ''; position: absolute; top: 3px; left: 3px; width: 24px; height: 24px; background: #fff; border-radius: 50%; transition: transform .2s; box-shadow: 0 2px 5px #0002; }
.switch:checked { background: var(--green); }
.switch:checked::after { transform: translateX(20px); }
.voice-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 0; font-size: 15px; font-weight: 600; }
.voice-row select { flex: 1; max-width: 60%; padding: 9px; border-radius: 12px; border: 2px solid var(--line); background: #FFFDF8; font-family: inherit; font-size: 13px; }
.howto { margin: 8px 0 0; padding-left: 22px; font-size: 14.5px; line-height: 1.85; }
.howto b { color: var(--brand); }
.tip { font-size: 13.5px; color: var(--ink-soft); background: #F6FBFF; border-radius: 12px; padding: 10px 12px; margin-top: 12px; }
.data-row { display: flex; gap: 8px; flex-wrap: wrap; }
.danger-row { margin-top: 14px; }

/* ============ 奖励层 & 弹窗 ============ */
.reward-layer { position: fixed; inset: 0; pointer-events: none; z-index: 200; overflow: hidden; }
.fly-star { position: absolute; font-size: 30px; animation: flyUp 1.1s ease-out forwards; }
@keyframes flyUp { 0% { opacity: 1; transform: translateY(0) scale(.6) rotate(0); } 100% { opacity: 0; transform: translateY(-190px) scale(1.5) rotate(40deg); } }
.confetti { position: absolute; width: 11px; height: 16px; border-radius: 3px; animation: confFall 1.9s linear forwards; }
@keyframes confFall { 0% { opacity: 1; transform: translateY(-30px) rotate(0); } 100% { opacity: 0; transform: translateY(105vh) rotate(680deg); } }

.modal-mask { position: fixed; inset: 0; background: rgba(60,45,25,.42); display: none; place-items: center; z-index: 300; padding: 20px; backdrop-filter: blur(3px); }
.modal-mask.show { display: grid; animation: fadeUp .2s; }
.modal { background: #fff; border-radius: 26px; padding: 24px 22px; max-width: 380px; width: 100%; text-align: center; box-shadow: 0 20px 50px #0004; animation: popIn .3s; }
@keyframes popIn { 0% { transform: scale(.82); opacity: 0; } 100% { transform: scale(1); opacity: 1; } }
.modal-emoji { font-size: 56px; }
.modal h3 { font-size: 21px; margin: 6px 0; }
.modal p { color: var(--ink-soft); font-size: 14.5px; line-height: 1.6; margin: 6px 0 0; }
.modal-btns { display: flex; gap: 9px; margin-top: 18px; }
.modal-btns .big-btn { flex: 1; font-size: 15px; padding: 13px; }

/* ============ 响应式 ============ */
@media (max-width: 620px) {
  .grid-wrap { flex-direction: column; align-items: center; padding: 14px; gap: 12px; }
  .tianzige { width: min(74vw, 300px); }
  .char-info { width: 100%; }
  .pinyin { font-size: 28px; }
  .quick-row { grid-template-columns: repeat(4, 1fr); gap: 7px; }
  .quick-btn { font-size: 11px; padding: 10px 2px; }
  .qb-ico { font-size: 21px; }
  .wall-grid { grid-template-columns: repeat(auto-fill, minmax(64px, 1fr)); }
  .match-grid { grid-template-columns: repeat(4, 1fr); gap: 7px; }
  .opt-grid { gap: 9px; }
  .opt-btn { min-height: 84px; padding: 12px 6px; }
  .opt-btn .ob-emoji { font-size: 38px; }
  .opt-btn .ob-char { font-size: 42px; }
  .lesson-grid { grid-template-columns: repeat(2, 1fr); }
  .stroke-toolbar .icon-btn.big { font-size: 14px; padding: 0 10px; }
  .char-grid { grid-template-columns: repeat(auto-fill, minmax(72px, 1fr)); }
}
@media (max-width: 380px) {
  .learn-tabs .tab { font-size: 13px; padding: 10px 3px; }
  .quick-row { grid-template-columns: repeat(2, 1fr); }
}

/* ============ 分层课程 / 搜索（字库扩充后新增） ============ */
.home-search { margin-top: 14px; }
.search-input {
  width: 100%; padding: 13px 16px; border-radius: 16px;
  border: 2px solid var(--line); background: #fff; font-family: inherit;
  font-size: 15px; color: var(--ink); box-shadow: var(--shadow-sm);
  -webkit-appearance: none; appearance: none;
}
.search-input:focus { outline: none; border-color: var(--brand); }
.search-result { margin-top: 12px; }
.sr-head {
  display: flex; align-items: center; gap: 10px; justify-content: space-between;
  font-size: 14px; color: var(--ink-soft); margin-bottom: 10px;
}
.sr-head b { color: var(--brand); font-size: 16px; }
.muted { color: var(--ink-soft); font-size: 13.5px; }

/* 注意：#lessonGrid 是 grid 容器，tier-block 必须显式跨满整行，
   否则会被当成一个网格项挤在半列里 */
.tier-block { grid-column: 1 / -1; margin-bottom: 18px; }
.tier-head {
  display: flex; align-items: center; gap: 8px; width: 100%;
  padding: 12px 14px; border-radius: 16px; background: #fff;
  border: 2px solid var(--line); box-shadow: var(--shadow-sm);
  font-weight: 800; font-size: 15.5px; text-align: left;
}
.tier-head.open { border-color: var(--brand); background: #FFFBF3; }
.tier-arrow { color: var(--brand); font-size: 13px; width: 12px; }
.tier-name { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tier-meta { font-size: 12px; color: var(--ink-soft); font-weight: 600; }
.tier-tip { font-size: 12px; color: var(--ink-soft); margin: 6px 4px 10px; }
.rl-row:hover { border-color: var(--brand); }
@media (max-width: 620px) {
  .tier-meta { font-size: 11px; }
}

/* 语音自检 */
.voice-check { margin-top: 10px; display: flex; flex-direction: column; gap: 6px; }
.vc-row {
  font-size: 13px; line-height: 1.6; color: var(--ink-soft);
  background: #F7FAFF; border-radius: 12px; padding: 9px 12px;
}
.vc-row b { color: #D6336C; }
