/*
 * 给 10 岁孩子看的：颜色亮、按钮厚（带底边，按下去会「陷」一下）、emoji 当图标、字大。
 * 每个区一种颜色（蓝/绿/橙/紫），金色留给综合挑战和印章。
 */
:root {
  --bg: #eef4ff;
  --surface: #ffffff;
  --ink: #1e2a44;
  --ink-soft: #66718c;
  --line: #d9e2f5;
  --blue: #4f86f7;   --blue-dk: #2f63d6;   --blue-lt: #e3edff;
  --green: #3fb96a;  --green-dk: #2b9553;  --green-lt: #e2f7e9;
  --orange: #f59e3b; --orange-dk: #d47f1f; --orange-lt: #fff1df;
  --purple: #9b6cf6; --purple-dk: #7a4de0; --purple-lt: #efe8ff;
  --gold: #f5b301;   --gold-dk: #d09600;   --gold-lt: #fff6d6;  --gold-ink: #8a6200;
  --right: #22a35a;
  --wrong: #e5484d;
  --star-off: #d5dbe8;
  --radius: 18px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  color: var(--ink);
  background: var(--bg) radial-gradient(circle at 20% 0%, #ffffff 0, transparent 45%);
  font: 500 17px/1.6 "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", system-ui, sans-serif;
  -webkit-text-size-adjust: 100%;
}

#app { max-width: 720px; margin: 0 auto; padding: 20px 18px 72px; }

h1, h2, h3 { margin: 0; line-height: 1.3; }
h2 { font-size: 20px; font-weight: 800; }
h3 { font-size: 17px; font-weight: 800; margin-bottom: 8px; }
p { margin: 0 0 8px; }
button { font: inherit; color: inherit; cursor: pointer; border: none; background: none; }
.muted { color: var(--ink-soft); }

/* ---------- 按钮：厚底边，按下去会陷 ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 50px; padding: 0 22px;
  border-radius: 14px;
  background: var(--blue); color: #fff;
  border-bottom: 4px solid var(--blue-dk);
  font-size: 17px; font-weight: 700;
  transition: transform .08s ease, border-bottom-width .08s ease;
}
.btn:active { transform: translateY(3px); border-bottom-width: 1px; }
.btn[disabled] { background: #c5cbd8; border-color: #aab2c3; cursor: not-allowed; }
.btn--big { min-height: 56px; padding: 0 28px; font-size: 19px; }
.btn--ghost { background: #fff; color: var(--blue-dk); border: 2px solid var(--blue); border-bottom-width: 4px; }
.btn--danger { background: #fff; color: var(--wrong); border: 2px solid var(--wrong); border-bottom-width: 4px; }

.chip {
  display: inline-flex; align-items: center; gap: 6px;
  min-height: 40px; padding: 0 14px;
  border-radius: 999px; background: #fff;
  border: 2px solid var(--line); border-bottom-width: 3px;
  font-size: 15px; font-weight: 700;
}
.chip:active { transform: translateY(1px); border-bottom-width: 2px; }
.chip--alert { border-color: var(--wrong); color: var(--wrong); }
.chip--icon { width: 40px; padding: 0; justify-content: center; }

.card {
  background: var(--surface);
  border: 2px solid var(--line); border-bottom-width: 5px;
  border-radius: var(--radius);
  padding: 20px;
}
.card--flat { border-bottom-width: 2px; padding: 14px 16px; margin-bottom: 10px; }
.topbar { display: flex; gap: 8px; margin-bottom: 16px; }
.page-head { margin-bottom: 16px; }
.page-head h1 { font-size: 26px; font-weight: 800; }
.empty { padding: 40px 20px; text-align: center; }
.actions { margin-top: 16px; display: flex; gap: 10px; flex-wrap: wrap; }
.actions--center { justify-content: center; }

/* ---------- 首页 ---------- */
.hero { text-align: center; margin-bottom: 14px; }
.hero__title { font-size: 30px; font-weight: 800; letter-spacing: 1px; }
.hero__sub { color: var(--ink-soft); font-size: 14px; margin: 2px 0 0; }

.status {
  background: #fff;
  border: 2px dashed var(--blue);
  border-radius: var(--radius);
  padding: 14px 16px;
  margin-bottom: 12px;
}
.pills { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.pill {
  padding: 6px 12px; border-radius: 999px;
  font-weight: 800; font-size: 15px;
  background: var(--blue-lt); color: var(--blue-dk);
  border: 2px solid #fff; box-shadow: 0 2px 0 var(--line);
}
.pill--coin  { background: var(--gold-lt);   color: var(--gold-ink); }
.pill--rank  { background: var(--purple-lt); color: var(--purple-dk); }
.pill--stamp { background: var(--green-lt);  color: var(--green-dk); }
.goal__bar { height: 12px; background: var(--blue-lt); border-radius: 999px; overflow: hidden; }
.goal__fill { height: 100%; background: linear-gradient(90deg, var(--blue), #86b3ff); border-radius: 999px; transition: width .6s ease; }
.goal__text { font-size: 14px; color: var(--ink-soft); margin-top: 6px; }
.goal__text b { color: var(--ink); }
.status__next { font-size: 13px; color: var(--purple-dk); margin-top: 6px; font-weight: 700; }

.quick { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 22px; }

.chapter { margin-bottom: 26px; }
.chapter__title { font-size: 14px; color: var(--ink-soft); margin-bottom: 10px; font-weight: 800; }
.chapter__title span { color: var(--ink); font-size: 16px; margin-left: 4px; }

/* 课文路线：左侧一条虚线把节点串起来 */
.path { list-style: none; margin: 0; padding: 0; position: relative; display: grid; gap: 10px; }
.path::before {
  content: ''; position: absolute; left: 39px; top: 24px; bottom: 24px;
  border-left: 4px dotted var(--line);
}
.node {
  position: relative;
  display: flex; align-items: center; gap: 14px;
  width: 100%; text-align: left;
  background: #fff;
  border: 2px solid var(--line); border-bottom-width: 5px;
  border-radius: var(--radius);
  padding: 12px 14px;
  transition: transform .1s ease, border-color .1s ease;
}
.node:hover:not([disabled]) { transform: translateY(-2px); border-color: var(--blue); }
.node:active:not([disabled]) { transform: translateY(2px); border-bottom-width: 2px; }
.node[disabled] { opacity: .5; background: transparent; border-style: dashed; cursor: default; }
.node__badge {
  flex: none; width: 50px; height: 50px; border-radius: 50%;
  display: grid; place-items: center; font-size: 27px;
  background: var(--blue-lt); border: 3px solid #fff; box-shadow: 0 0 0 3px var(--line);
}
.node--active .node__badge { box-shadow: 0 0 0 3px var(--blue); }
.node--done   .node__badge { background: var(--green-lt); box-shadow: 0 0 0 3px var(--green); }
.node--gold   .node__badge { background: var(--gold-lt);  box-shadow: 0 0 0 3px var(--gold); }
.node__body { flex: 1; min-width: 0; }
.node__title { display: block; font-weight: 800; font-size: 18px; }
.node__title small { font-weight: 700; font-size: 12px; color: var(--ink-soft); margin-left: 6px; background: var(--line); padding: 1px 7px; border-radius: 6px; vertical-align: middle; }
.node__meta { display: block; font-size: 13px; color: var(--ink-soft); }
.node__stars { flex: none; font-weight: 800; font-size: 14px; color: var(--gold-ink); background: var(--gold-lt); padding: 4px 10px; border-radius: 999px; }

/* ---------- 一课的关卡地图 ---------- */
.lesson-hero {
  display: flex; gap: 16px; align-items: center;
  background: #fff; border: 2px solid var(--line); border-bottom-width: 5px;
  border-radius: var(--radius); padding: 16px; margin-bottom: 18px;
}
.lesson-hero__emoji {
  flex: none; width: 72px; height: 72px; font-size: 40px;
  display: grid; place-items: center; border-radius: 50%;
  background: var(--blue-lt); box-shadow: 0 0 0 4px var(--line);
}
.lesson-hero__emoji.is-silver { box-shadow: 0 0 0 4px #b8c2d6; }
.lesson-hero__emoji.is-gold { background: var(--gold-lt); box-shadow: 0 0 0 4px var(--gold); }
.lesson-hero small { color: var(--ink-soft); font-size: 13px; font-weight: 700; }
.lesson-hero h1 { font-size: 28px; font-weight: 800; }
.lesson-hero__meta { font-size: 14px; color: var(--ink-soft); font-weight: 700; }

.zone { margin-bottom: 14px; padding: 12px 12px 14px; border-radius: 20px; background: var(--blue-lt); }
.zone--green  { background: var(--green-lt); }
.zone--orange { background: var(--orange-lt); }
.zone--purple { background: var(--purple-lt); }
.zone--gold   { background: var(--gold-lt); }
.zone__title { font-size: 17px; font-weight: 800; margin-bottom: 10px; padding-left: 10px; border-left: 5px solid var(--blue); }
.zone--green  .zone__title { border-color: var(--green); }
.zone--orange .zone__title { border-color: var(--orange); }
.zone--purple .zone__title { border-color: var(--purple); }
.zone--gold   .zone__title { border-color: var(--gold); }

.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 220px)); gap: 12px; }
.tile {
  position: relative;
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  padding: 16px 10px 12px; min-height: 150px;
  border-radius: 18px; text-align: center; color: var(--ink);
  background: #fff; border: 2px solid var(--blue); border-bottom-width: 6px;
  transition: transform .1s ease, border-bottom-width .1s ease;
}
.tile:hover:not(.tile--locked) { transform: translateY(-3px); }
.tile:active:not(.tile--locked) { transform: translateY(2px); border-bottom-width: 2px; }
.tile--green  { border-color: var(--green); }
.tile--orange { border-color: var(--orange); }
.tile--purple { border-color: var(--purple); }
.tile--gold   { border-color: var(--gold); }
.tile--locked { background: #eef0f5; border-color: #cfd6e4; color: var(--ink-soft); cursor: default; }
.tile--next { box-shadow: 0 0 0 4px rgba(79, 134, 247, .28); }
.tile--done::after {
  content: '✓'; position: absolute; top: 8px; right: 8px;
  width: 22px; height: 22px; border-radius: 50%;
  background: var(--right); color: #fff; font-size: 13px; font-weight: 800;
  display: grid; place-items: center;
}
.tile__icon { font-size: 36px; line-height: 1; margin-bottom: 2px; }
.tile__name { font-weight: 800; font-size: 15px; }
.tile__meta { font-size: 12px; color: var(--ink-soft); }
.tile__hint {
  position: absolute; top: -11px; left: 50%; transform: translateX(-50%);
  background: var(--wrong); color: #fff;
  font-size: 12px; font-weight: 800; padding: 2px 10px; border-radius: 999px; white-space: nowrap;
  animation: bob 1.1s ease-in-out infinite;
}
.stars i { font-style: normal; color: var(--star-off); font-size: 18px; letter-spacing: 2px; }
.stars i.on { color: var(--gold); }

/* ---------- 答题 ---------- */
.quiz__top { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.quiz__bar { flex: 1; height: 12px; background: #fff; border: 2px solid var(--line); border-radius: 999px; overflow: hidden; }
.quiz__fill { height: 100%; background: linear-gradient(90deg, var(--green), #8be0a8); transition: width .3s ease; }
.quiz__count { font-weight: 800; color: var(--ink-soft); font-variant-numeric: tabular-nums; }
.quiz__combo { min-width: 44px; font-weight: 800; color: var(--orange-dk); }
.quiz__crumb { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; font-size: 13px; }

.tag { padding: 3px 10px; border-radius: 999px; font-weight: 800; font-size: 13px; background: var(--blue-lt); color: var(--blue-dk); }
.tag--green  { background: var(--green-lt);  color: var(--green-dk); }
.tag--orange { background: var(--orange-lt); color: var(--orange-dk); }
.tag--purple { background: var(--purple-lt); color: var(--purple-dk); }
.tag--gold   { background: var(--gold-lt);   color: var(--gold-ink); }

.pinyin { font-size: 32px; font-weight: 800; letter-spacing: 4px; color: var(--blue-dk); margin-bottom: 6px; }
.stem { font-size: 20px; font-weight: 700; margin-bottom: 18px; }
.stem--light { font-weight: 500; font-size: 18px; }
.context { color: var(--ink-soft); margin: -10px 0 16px; font-size: 17px; }
.passage { background: #f6f8ff; border-radius: 12px; padding: 14px 16px; margin-bottom: 16px; font-size: 16px; line-height: 1.9; }
.passage__title { font-weight: 800; margin-bottom: 6px; }
.passage p { margin: 0 0 6px; text-indent: 2em; }

.options { display: grid; gap: 10px; }
.option {
  display: flex; align-items: flex-start; gap: 12px;
  width: 100%; text-align: left;
  padding: 13px 14px;
  border: 2px solid var(--line); border-bottom-width: 4px; border-radius: 14px;
  background: #fff; font-size: 17px; font-weight: 600;
  transition: transform .08s ease, border-color .08s ease;
}
.option:hover:not([disabled]) { border-color: var(--blue); transform: translateY(-1px); }
.option:active:not([disabled]) { transform: translateY(2px); border-bottom-width: 2px; }
.option[disabled] { cursor: default; }
.option__key {
  flex: none; width: 28px; height: 28px; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--blue-lt); color: var(--blue-dk); font-weight: 800; font-size: 14px;
}
.option--right { border-color: var(--right); background: #ecf9f1; }
.option--right .option__key { background: var(--right); color: #fff; }
.option--wrong { border-color: var(--wrong); background: #fdeeee; }
.option--wrong .option__key { background: var(--wrong); color: #fff; }

.fill { display: flex; gap: 10px; flex-wrap: wrap; }
.fill__input {
  flex: 1; min-width: 200px; min-height: 52px; padding: 0 16px;
  font: inherit; font-size: 20px; font-weight: 600; color: inherit;
  border: 2px solid var(--line); border-bottom-width: 4px; border-radius: 14px; background: #fff;
}
.fill__input:focus { outline: none; border-color: var(--blue); }
.fill__input[disabled] { background: #f6f8ff; }
.fill__input.is-right { border-color: var(--right); }
.fill__input.is-wrong { border-color: var(--wrong); }

.feedback { margin-top: 16px; padding: 16px; border-radius: 14px; background: var(--blue-lt); animation: rise .2s ease; }
.feedback--right { background: var(--green-lt); }
.feedback--wrong { background: #fdeeee; }
.feedback__title { font-weight: 800; font-size: 19px; margin-bottom: 6px; }
.feedback--right .feedback__title { color: var(--right); }
.feedback--wrong .feedback__title { color: var(--wrong); }
.feedback__answer { font-weight: 700; margin-bottom: 4px; }
.feedback__explain { font-size: 15px; color: #3d4760; }

.quiz-card.pop { animation: pop .25s ease; }
.quiz-card.shake { animation: shake .3s ease; }

/* ---------- 结算 ---------- */
.result { text-align: center; padding: 28px 20px; }
.result__stars { font-size: 52px; letter-spacing: 6px; line-height: 1; margin-bottom: 4px; }
.bigstar { display: inline-block; color: var(--star-off); }
.bigstar.on { color: var(--gold); opacity: 0; animation: star-in .45s cubic-bezier(.34, 1.56, .64, 1) forwards; }
.result__title { font-size: 28px; font-weight: 800; margin-top: 6px; }
.result__msg { color: var(--ink-soft); margin: 6px 0 14px; }
.result__score { font-size: 20px; font-weight: 700; }
.result__coins {
  display: inline-block; margin: 10px 0; padding: 6px 16px; border-radius: 999px;
  background: var(--gold-lt); color: var(--gold-ink); font-weight: 800; font-size: 20px;
  animation: rise .4s .6s ease both;
}
.result__badges { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; margin-bottom: 8px; }
.badge { padding: 5px 12px; border-radius: 999px; background: var(--purple-lt); color: var(--purple-dk); font-weight: 700; font-size: 14px; animation: rise .4s .8s ease both; }
.review { margin-top: 24px; text-align: left; }
.review__item { padding: 12px 0; border-top: 1px solid var(--line); font-size: 15px; }
.review__q { font-weight: 700; margin-bottom: 2px; }
.review__a { color: var(--right); font-weight: 700; }

.confetti { position: fixed; inset: 0; pointer-events: none; overflow: hidden; z-index: 5; }
.confetti span { position: absolute; top: -40px; font-size: 26px; animation: fall 2.4s ease-in forwards; }

/* ---------- 集章册 ---------- */
.stamps { display: grid; grid-template-columns: repeat(auto-fill, minmax(100px, 1fr)); gap: 10px; }
.stamp {
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  padding: 12px 6px; border-radius: 14px; text-align: center;
  background: #fff; border: 2px dashed var(--line);
}
.stamp__emoji {
  width: 54px; height: 54px; font-size: 32px;
  display: grid; place-items: center; border-radius: 50%;
  background: #f1f4fb; filter: grayscale(1); opacity: .45;
}
.stamp__name { font-size: 12px; color: var(--ink-soft); font-weight: 700; }
.stamp--silver { border-style: solid; border-color: #b8c2d6; }
.stamp--silver .stamp__emoji { filter: none; opacity: 1; background: #eef1f7; box-shadow: 0 0 0 3px #b8c2d6; }
.stamp--gold { border-style: solid; border-color: var(--gold); background: var(--gold-lt); }
.stamp--gold .stamp__emoji { filter: none; opacity: 1; background: #fff; box-shadow: 0 0 0 3px var(--gold); }
.stamp--gold .stamp__name { color: var(--gold-ink); }
.stamp--todo { opacity: .4; }

/* ---------- 金币 ---------- */
.coin {
  display: inline-grid; place-items: center;
  width: 1.25em; height: 1.25em; border-radius: 50%;
  background: radial-gradient(circle at 34% 28%, #fff1a8, var(--gold) 52%, var(--gold-dk));
  border: .12em solid var(--gold-dk);
  font-size: 0; line-height: 0;
  box-shadow: inset 0 -.1em .16em rgba(0, 0, 0, .22), 0 .06em 0 rgba(0, 0, 0, .12);
  vertical-align: -.16em;
}
.coin::before {
  content: ''; width: .42em; height: .42em; border-radius: 50%;
  border: .1em solid rgba(138, 98, 0, .55);
}

/* ---------- 杂项 ---------- */
.toast {
  position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%);
  background: var(--ink); color: #fff; padding: 12px 22px; border-radius: 999px;
  font-size: 15px; font-weight: 700; z-index: 10; animation: rise .2s ease;
}

@keyframes rise  { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@keyframes pop   { 0% { transform: scale(1); } 40% { transform: scale(1.015); } 100% { transform: scale(1); } }
@keyframes shake { 0%, 100% { transform: translateX(0); } 25% { transform: translateX(-6px); } 75% { transform: translateX(6px); } }
@keyframes bob   { 0%, 100% { transform: translate(-50%, 0); } 50% { transform: translate(-50%, -3px); } }
@keyframes star-in { from { transform: scale(.2) rotate(-30deg); opacity: 0; } to { transform: scale(1) rotate(0); opacity: 1; } }
@keyframes fall  { to { transform: translateY(110vh) rotate(360deg); opacity: .8; } }

@media (max-width: 480px) {
  #app { padding: 14px 12px 60px; }
  .hero__title { font-size: 26px; }
  .tiles { grid-template-columns: repeat(2, 1fr); }
  .stem { font-size: 19px; }
  .node__stars { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
  .bigstar.on { opacity: 1; }
}
