/* ===== 小学习闯关游戏 · 共用样式 ===== */
:root {
  --bg1: #eef7ff;
  --bg2: #fff6e5;
  --accent: #ff8a3d;
  --accent-2: #ffc453;
  --ink: #2c2a3d;
  --ink-soft: #6b6880;
  --card: #ffffff;
  --ok: #2fbf71;
  --bad: #f2545b;
  --radius: 24px;
  --shadow: 0 10px 24px rgba(60, 50, 100, .10);
  --shadow-sm: 0 4px 10px rgba(60, 50, 100, .08);
}

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

html, body {
  margin: 0;
  padding: 0;
  min-height: 100%;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Segoe UI", sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at 12% 8%, rgba(255, 255, 255, .85), transparent 42%),
    radial-gradient(circle at 88% 92%, rgba(255, 255, 255, .7), transparent 46%),
    linear-gradient(150deg, var(--bg1), var(--bg2));
  background-attachment: fixed;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

button { font-family: inherit; cursor: pointer; border: 0; }

#app { max-width: 720px; margin: 0 auto; padding: 16px 16px 40px; }

.screen { animation: fadeUp .32s ease both; }
@keyframes fadeUp { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

/* ---------- 顶部 ---------- */
.topbar {
  display: flex; align-items: center; gap: 10px;
  margin-bottom: 14px;
}
.icon-btn {
  width: 48px; height: 48px; flex: 0 0 48px;
  border-radius: 16px; background: rgba(255, 255, 255, .92);
  box-shadow: var(--shadow-sm);
  font-size: 22px; display: flex; align-items: center; justify-content: center;
  text-decoration: none; color: var(--ink);
  transition: transform .12s ease;
}
.icon-btn:active { transform: scale(.92); }

.brand { flex: 1; display: flex; align-items: center; gap: 10px; }
.brand-emoji { font-size: 34px; line-height: 1; filter: drop-shadow(0 3px 4px rgba(0,0,0,.12)); animation: bob 2.6s ease-in-out infinite; }
@keyframes bob { 0%,100% { transform: translateY(0) rotate(-3deg); } 50% { transform: translateY(-5px) rotate(3deg); } }
.brand h1 { font-size: 24px; margin: 0; letter-spacing: .5px; }
.brand p { margin: 2px 0 0; font-size: 13px; color: var(--ink-soft); }

.star-pill {
  display: flex; align-items: center; gap: 4px;
  background: #fff; border-radius: 999px; padding: 8px 14px;
  box-shadow: var(--shadow-sm); font-weight: 800; font-size: 17px; color: #f0a500;
  white-space: nowrap;
}

/* ---------- 首页 ---------- */
.hero {
  background: var(--card); border-radius: var(--radius); padding: 18px 18px 16px;
  box-shadow: var(--shadow); margin-bottom: 18px;
  display: flex; align-items: center; gap: 14px;
}
.hero-emoji { font-size: 52px; line-height: 1; }
.hero h2 { margin: 0 0 4px; font-size: 19px; }
.hero p { margin: 0; font-size: 14px; color: var(--ink-soft); line-height: 1.5; }

.progress-line { height: 10px; border-radius: 999px; background: #eceaf5; overflow: hidden; margin-top: 10px; }
.progress-line i { display: block; height: 100%; border-radius: 999px; background: linear-gradient(90deg, var(--accent), var(--accent-2)); transition: width .5s ease; }

.level-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }

.level-card {
  position: relative; text-align: left;
  background: var(--card); border-radius: 22px; padding: 16px 14px 14px;
  box-shadow: var(--shadow-sm); border: 2px solid transparent;
  display: flex; flex-direction: column; gap: 2px; min-height: 132px;
  transition: transform .14s ease, box-shadow .14s ease;
}
.level-card:active { transform: scale(.97); }
.level-card:not(.locked):hover { box-shadow: var(--shadow); border-color: rgba(255,138,61,.35); }
.level-card .lv-emoji { font-size: 38px; line-height: 1.1; }
.level-card .lv-num { font-size: 12px; font-weight: 700; color: var(--ink-soft); letter-spacing: .5px; }
.level-card .lv-name { font-size: 16px; font-weight: 800; margin-top: 2px; }
.level-card .lv-stars { font-size: 15px; letter-spacing: 2px; color: #ffc93c; margin-top: 4px; }
.level-card.locked { opacity: .55; filter: grayscale(.5); }
.level-card.locked::after {
  content: "🔒"; position: absolute; right: 14px; top: 14px; font-size: 18px;
}
.level-card.done { border-color: rgba(47,191,113,.28); background: linear-gradient(180deg, #fff, #f4fff9); }

.challenge-btn {
  width: 100%; margin-top: 16px; padding: 18px;
  border-radius: 22px; font-size: 18px; font-weight: 900; color: #fff;
  background: linear-gradient(135deg, #ff7a59, #ff4d6d);
  box-shadow: 0 8px 0 #d93b57, 0 12px 22px rgba(217,59,87,.28);
  transition: transform .1s ease, box-shadow .1s ease;
}
.challenge-btn:active { transform: translateY(5px); box-shadow: 0 3px 0 #d93b57; }
.challenge-btn[disabled] { background: #d8d5e4; box-shadow: 0 6px 0 #c2bfd0; color: #fff; }

.section-title { font-size: 14px; font-weight: 800; color: var(--ink-soft); margin: 22px 4px 10px; letter-spacing: .5px; }

.badge-strip { display: flex; flex-wrap: wrap; gap: 8px; }
.badge-item {
  width: 54px; height: 54px; border-radius: 18px; background: #fff;
  display: flex; align-items: center; justify-content: center; font-size: 26px;
  box-shadow: var(--shadow-sm);
}
.badge-item.empty { background: rgba(255,255,255,.45); box-shadow: none; color: #cfcbe0; font-size: 20px; }
.badge-item.pop { animation: pop .5s ease; }
@keyframes pop { 0% { transform: scale(.4) rotate(-18deg); } 70% { transform: scale(1.15) rotate(6deg); } 100% { transform: none; } }

/* ---------- 答题页 ---------- */
.hud { display: flex; align-items: center; gap: 10px; margin-bottom: 16px; }
.hud-mid { flex: 1; }
.progress { height: 14px; border-radius: 999px; background: rgba(255,255,255,.75); box-shadow: inset 0 2px 4px rgba(60,50,100,.08); overflow: hidden; }
.progress i { display: block; height: 100%; width: 0; border-radius: 999px; background: linear-gradient(90deg, var(--accent), var(--accent-2)); transition: width .3s ease; }
.hud-label { font-size: 12px; color: var(--ink-soft); margin-top: 5px; font-weight: 700; }
.hearts { font-size: 17px; letter-spacing: 1px; }

.qcard {
  background: var(--card); border-radius: 28px; padding: 26px 20px 22px;
  box-shadow: var(--shadow); text-align: center; margin-bottom: 18px;
  position: relative; overflow: hidden;
}
.qcard::before {
  content: ""; position: absolute; inset: -60% -30% auto -30%; height: 160%;
  background: radial-gradient(circle at 50% 0%, color-mix(in srgb, var(--accent) 16%, transparent), transparent 62%);
  pointer-events: none;
}
.q-pic { font-size: 82px; line-height: 1.1; margin-bottom: 6px; position: relative; animation: pop .5s ease; }
.q-text { font-size: 26px; font-weight: 900; line-height: 1.45; position: relative; word-break: break-word; }
.q-sub { font-size: 15px; color: var(--ink-soft); margin-top: 8px; position: relative; }
.q-word { font-size: 40px; font-weight: 900; letter-spacing: 1px; }
.speak-btn {
  position: relative; margin-top: 14px; padding: 10px 18px; border-radius: 999px;
  background: #fff3e6; color: #d2691e; font-weight: 800; font-size: 15px;
  box-shadow: 0 3px 0 #f2d6bd;
}
.speak-btn:active { transform: translateY(2px); box-shadow: 0 1px 0 #f2d6bd; }

.options { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.options.one-row { grid-template-columns: repeat(4, 1fr); }
.opt {
  min-height: 76px; border-radius: 22px; background: #fff; color: var(--ink);
  font-size: 24px; font-weight: 800; box-shadow: 0 5px 0 #e3e0ef, 0 8px 16px rgba(60,50,100,.08);
  display: flex; align-items: center; justify-content: center; padding: 10px 8px;
  transition: transform .1s ease, box-shadow .1s ease, background .18s ease;
  word-break: break-word; text-align: center; line-height: 1.25;
}
.opt:active { transform: translateY(4px); box-shadow: 0 1px 0 #e3e0ef; }
.opt.correct { background: linear-gradient(180deg, #6ee7a8, #2fbf71); color: #fff; box-shadow: 0 5px 0 #1f9c59; animation: pop .35s ease; }
.opt.wrong { background: linear-gradient(180deg, #ff8e94, #f2545b); color: #fff; box-shadow: 0 5px 0 #c53b42; animation: shake .35s ease; }
.opt.dim { opacity: .45; }
.opt[disabled] { cursor: default; }
.opt .opt-label { font-size: 11px; font-weight: 800; opacity: .5; display: block; margin-bottom: -2px; }
@keyframes shake { 0%,100% { transform: translateX(0); } 25% { transform: translateX(-6px); } 75% { transform: translateX(6px); } }

.feedback {
  margin-top: 16px; border-radius: 20px; padding: 14px 16px; font-size: 16px; font-weight: 700;
  line-height: 1.55; display: none; animation: fadeUp .25s ease both;
}
.feedback.show { display: block; }
.feedback.ok { background: #e9fbf1; color: #1c8b52; }
.feedback.no { background: #fff0f1; color: #c23a42; }
.feedback .tip { display: block; font-weight: 600; font-size: 14px; margin-top: 6px; color: var(--ink-soft); }

.continue-btn {
  width: 100%; margin-top: 14px; padding: 17px; border-radius: 20px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: #fff;
  font-size: 18px; font-weight: 900;
  box-shadow: 0 6px 0 rgba(0,0,0,.14), 0 10px 20px rgba(255,138,61,.28);
}
.continue-btn:active { transform: translateY(4px); box-shadow: 0 2px 0 rgba(0,0,0,.14); }

.combo {
  position: fixed; left: 50%; top: 22%; transform: translate(-50%, 0) scale(.6);
  font-size: 34px; font-weight: 900; color: #ff8a3d; pointer-events: none; opacity: 0;
  text-shadow: 0 3px 0 #fff, 0 6px 14px rgba(255,138,61,.35); z-index: 50;
}
.combo.show { animation: comboPop .9s ease forwards; }
@keyframes comboPop {
  0% { opacity: 0; transform: translate(-50%, 10px) scale(.5); }
  30% { opacity: 1; transform: translate(-50%, -6px) scale(1.1); }
  70% { opacity: 1; transform: translate(-50%, -14px) scale(1); }
  100% { opacity: 0; transform: translate(-50%, -34px) scale(.95); }
}

/* ---------- 结算页 ---------- */
.result-card {
  background: var(--card); border-radius: 30px; padding: 30px 22px 26px;
  box-shadow: var(--shadow); text-align: center; margin-top: 10px;
}
.result-emoji { font-size: 76px; line-height: 1; animation: pop .6s ease; }
.result-card h2 { font-size: 26px; margin: 10px 0 4px; }
.result-card .sub { color: var(--ink-soft); font-size: 15px; margin: 0 0 16px; }
.big-stars { font-size: 44px; letter-spacing: 6px; color: #ffc93c; line-height: 1; margin-bottom: 14px; }
.big-stars .off { color: #e6e2f0; }
.stat-row { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; margin-bottom: 18px; }
.stat {
  background: #f7f5fd; border-radius: 16px; padding: 10px 16px; min-width: 92px;
}
.stat b { display: block; font-size: 20px; }
.stat span { font-size: 12px; color: var(--ink-soft); }

.reward {
  display: inline-flex; align-items: center; gap: 8px; background: #fffbe8;
  border-radius: 16px; padding: 10px 16px; font-size: 15px; font-weight: 800; color: #b07d00;
  margin-bottom: 18px;
}

.actions { display: grid; gap: 10px; }
.btn-primary, .btn-ghost {
  padding: 16px; border-radius: 20px; font-size: 17px; font-weight: 900;
}
.btn-primary {
  background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: #fff;
  box-shadow: 0 6px 0 rgba(0,0,0,.14);
}
.btn-primary:active { transform: translateY(4px); box-shadow: 0 2px 0 rgba(0,0,0,.14); }
.btn-ghost { background: #fff; color: var(--ink); box-shadow: var(--shadow-sm); }

/* ---------- 彩带 ---------- */
.confetti { position: fixed; inset: 0; pointer-events: none; overflow: hidden; z-index: 60; }
.confetti i {
  position: absolute; top: -8vh; font-size: 20px; will-change: transform;
  animation: fall linear forwards;
}
@keyframes fall {
  0% { transform: translateY(0) rotate(0); opacity: 1; }
  100% { transform: translateY(112vh) rotate(720deg); opacity: .9; }
}

/* ---------- 首页入口（家长页） ---------- */
.launcher { max-width: 900px; margin: 0 auto; padding: 30px 18px 50px; }
.launcher-head { text-align: center; margin-bottom: 26px; }
.launcher-head .big { font-size: 46px; }
.launcher-head h1 { font-size: 30px; margin: 8px 0 6px; }
.launcher-head p { color: var(--ink-soft); margin: 0; font-size: 15px; }

.stats-bar {
  display: flex; justify-content: center; gap: 10px; flex-wrap: wrap; margin: 18px 0 8px;
}
.stats-bar .stat { background: #fff; box-shadow: var(--shadow-sm); }

.game-cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-top: 16px; }
.game-card {
  display: block; text-decoration: none; color: var(--ink);
  border-radius: 26px; padding: 26px 20px; min-height: 240px;
  box-shadow: var(--shadow); position: relative; overflow: hidden;
  transition: transform .16s ease, box-shadow .16s ease;
}
.game-card:hover { transform: translateY(-4px); box-shadow: 0 16px 34px rgba(60,50,100,.16); }
.game-card:active { transform: scale(.98); }
.game-card .gc-emoji { font-size: 56px; display: block; margin-bottom: 10px; }
.game-card h3 { margin: 0 0 6px; font-size: 22px; }
.game-card p { margin: 0; font-size: 13px; color: rgba(0,0,0,.55); line-height: 1.5; }
.game-card .gc-foot { position: absolute; left: 20px; right: 20px; bottom: 18px; display: flex; justify-content: space-between; align-items: center; font-size: 13px; font-weight: 800; }
.gc-bar { height: 8px; border-radius: 999px; background: rgba(255,255,255,.6); overflow: hidden; margin-top: 12px; }
.gc-bar i { display: block; height: 100%; background: #fff; border-radius: 999px; }

.card-cn { background: linear-gradient(160deg, #d7f5e3, #fff7d6); }
.card-ma { background: linear-gradient(160deg, #dfe6ff, #e9f7ff); }
.card-en { background: linear-gradient(160deg, #ffe4d6, #fff2d9); }

.tips {
  margin-top: 26px; background: rgba(255,255,255,.75); border-radius: 20px; padding: 16px 18px;
  font-size: 13px; color: var(--ink-soft); line-height: 1.7;
}
.tips b { color: var(--ink); }
.reset-link { background: none; color: #b9b5cc; font-size: 12px; text-decoration: underline; padding: 8px; }

.toast {
  position: fixed; left: 50%; bottom: 26px; transform: translate(-50%, 20px);
  background: rgba(44,42,61,.94); color: #fff; padding: 12px 20px; border-radius: 999px;
  font-size: 14px; font-weight: 700; opacity: 0; transition: all .3s ease; z-index: 80;
  pointer-events: none;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- 移动端 ---------- */
@media (max-width: 640px) {
  #app { padding: 12px 12px 32px; }
  .brand h1 { font-size: 20px; }
  .brand p { display: none; }
  .q-text { font-size: 22px; }
  .q-pic { font-size: 66px; }
  .opt { min-height: 66px; font-size: 21px; }
  .options { gap: 10px; }
  .level-grid { gap: 10px; }
  .level-card { min-height: 120px; padding: 14px 12px; }
  .level-card .lv-emoji { font-size: 32px; }
  .game-cards { grid-template-columns: 1fr; }
  .game-card { min-height: 170px; }
  .launcher-head h1 { font-size: 24px; }
}
