/* ============================================================
   四年级趣味闯关 —— 全局样式（响应式：手机 / 平板 / 电脑）
   ============================================================ */
:root {
  --blue: #3b82f6;
  --cyan: #06b6d4;
  --green: #22c55e;
  --orange: #f97316;
  --pink: #ec4899;
  --red: #ef4444;
  --yellow: #facc15;
  --purple: #8b5cf6;
  --ink: #1f2937;
  --sub: #6b7280;
  --bg: #f0f7ff;
  --card: #ffffff;
  --line: #e5edf7;
  --radius: 18px;
  --shadow: 0 4px 14px rgba(30, 64, 175, .10);
  --shadow-lg: 0 10px 30px rgba(30, 64, 175, .16);
  --font: "PingFang SC", "Microsoft YaHei", "YouYuan", "幼圆", "Hiragino Sans GB", sans-serif;
}

* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; }
body {
  font-family: var(--font);
  background:
    radial-gradient(1200px 500px at 100% -10%, #dbeafe 0%, transparent 60%),
    radial-gradient(900px 420px at -10% 110%, #fce7f3 0%, transparent 55%),
    var(--bg);
  color: var(--ink);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
button { font-family: inherit; cursor: pointer; border: none; background: none; color: inherit; }
input, select, textarea { font-family: inherit; font-size: 16px; }

#app { max-width: 980px; margin: 0 auto; padding: 0 12px calc(76px + env(safe-area-inset-bottom)); min-height: 100vh; }

/* ---------- 顶栏 ---------- */
#topBar {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 10px 14px; margin: 6px 0 10px;
  background: linear-gradient(135deg, #3b82f6, #06b6d4);
  border-radius: 16px; color: #fff;
  box-shadow: 0 4px 16px rgba(59, 130, 246, .35);
}
#topBar .brand { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 17px; letter-spacing: .5px; }
#topBar .brand .logo { font-size: 22px; }
#topBar .side { display: flex; align-items: center; gap: 10px; }
#topBar .pts {
  display: flex; align-items: center; gap: 4px; background: rgba(255,255,255,.2);
  padding: 4px 10px; border-radius: 999px; font-weight: 700; font-size: 14px;
}
#topBar .avatar { font-size: 24px; line-height: 1; filter: drop-shadow(0 2px 2px rgba(0,0,0,.2)); }
#topBar.hidden, #bottomNav.hidden { display: none; }

/* ---------- 底部导航 ---------- */
#bottomNav {
  position: fixed; left: 50%; transform: translateX(-50%);
  bottom: 0; z-index: 40;
  width: 100%; max-width: 980px;
  display: flex; justify-content: space-around;
  background: rgba(255,255,255,.96);
  border-top: 1px solid var(--line);
  padding: 6px 4px calc(8px + env(safe-area-inset-bottom));
  box-shadow: 0 -4px 20px rgba(30,64,175,.08);
}
#bottomNav a {
  flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px;
  text-decoration: none; color: var(--sub); font-size: 11px; padding: 4px 2px;
  border-radius: 12px; transition: transform .15s;
}
#bottomNav a .ic { font-size: 22px; line-height: 1.2; }
#bottomNav a.on { color: var(--blue); font-weight: 700; }
#bottomNav a.on .ic { transform: translateY(-1px) scale(1.12); }
#bottomNav a:active { transform: scale(.94); }

/* ---------- 屏幕容器 ---------- */
.screen { display: none; animation: fadeIn .28s ease; }
.screen.active { display: block; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* ---------- 卡片与按钮 ---------- */
.card {
  background: var(--card); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 16px; margin-bottom: 14px;
}
.card-title { font-size: 16px; font-weight: 700; margin-bottom: 10px; display: flex; align-items: center; gap: 6px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 12px 20px; border-radius: 14px; font-weight: 700; font-size: 16px;
  color: #fff; transition: transform .12s, box-shadow .12s, filter .12s;
  box-shadow: 0 4px 12px rgba(0,0,0,.12); user-select: none;
}
.btn:active { transform: scale(.96); }
.btn:disabled { opacity: .55; cursor: not-allowed; transform: none; }
.btn-big { width: 100%; padding: 16px; font-size: 18px; border-radius: 16px; }
.btn-blue { background: linear-gradient(135deg, #3b82f6, #2563eb); }
.btn-green { background: linear-gradient(135deg, #22c55e, #16a34a); }
.btn-orange { background: linear-gradient(135deg, #f97316, #ea580c); }
.btn-pink { background: linear-gradient(135deg, #ec4899, #db2777); }
.btn-cyan { background: linear-gradient(135deg, #06b6d4, #0891b2); }
.btn-gray { background: linear-gradient(135deg, #94a3b8, #64748b); }
.btn-ghost { background: #eef2f7; color: var(--ink); box-shadow: none; }

/* ---------- 首页 ---------- */
.hero {
  background: linear-gradient(135deg, #22c55e, #06b6d4);
  color: #fff; border-radius: 22px; padding: 20px 18px; margin-bottom: 14px;
  box-shadow: 0 8px 24px rgba(34,197,94,.28); position: relative; overflow: hidden;
}
.hero::after {
  content: "🎈"; position: absolute; right: 14px; top: -6px; font-size: 64px; opacity: .35; transform: rotate(12deg);
}
.hero .hello { font-size: 20px; font-weight: 700; }
.hero .hello b { font-size: 26px; }
.hero .pts-line { display: flex; align-items: baseline; gap: 8px; margin-top: 6px; }
.hero .pts-num { font-size: 40px; font-weight: 800; line-height: 1; }
.hero .sub { font-size: 13px; opacity: .92; margin-top: 6px; }

.announce {
  background: #fffbeb; border: 1px dashed #fbbf24; color: #92400e;
  border-radius: 14px; padding: 10px 14px; font-size: 14px; margin-bottom: 14px;
}

.menu-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.menu-item {
  background: var(--card); border-radius: 18px; box-shadow: var(--shadow);
  padding: 18px 14px; text-align: center; text-decoration: none; color: var(--ink);
  transition: transform .12s;
}
.menu-item:active { transform: scale(.96); }
.menu-item .m-ic { font-size: 38px; display: block; margin-bottom: 6px; }
.menu-item .m-t { font-weight: 700; font-size: 15px; }
.menu-item .m-d { font-size: 12px; color: var(--sub); margin-top: 2px; }
.menu-item.blue { border-top: 5px solid var(--blue); }
.menu-item.green { border-top: 5px solid var(--green); }
.menu-item.orange { border-top: 5px solid var(--orange); }
.menu-item.pink { border-top: 5px solid var(--pink); }

.link-btn { display: block; text-align: center; color: var(--blue); font-size: 14px; margin-top: 14px; text-decoration: none; }

/* ---------- 闯关地图 ---------- */
.level-map { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.level-node {
  aspect-ratio: 1/1.05; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  border-radius: 18px; font-weight: 700; font-size: 14px; background: var(--card);
  box-shadow: var(--shadow); position: relative; transition: transform .12s;
}
.level-node:active { transform: scale(.94); }
.level-node.locked { background: #e5e9f0; color: #9aa3b2; box-shadow: none; }
.level-node.current {
  background: linear-gradient(135deg, #f97316, #facc15); color: #fff;
  box-shadow: 0 0 0 4px rgba(249,115,22,.22), 0 8px 20px rgba(249,115,22,.35);
  animation: pulse 1.6s infinite;
}
.level-node.done { background: linear-gradient(135deg, #22c55e, #16a34a); color: #fff; }
.level-node .ln-num { font-size: 24px; line-height: 1; }
.level-node .ln-stars { font-size: 12px; letter-spacing: 1px; }
.level-node.locked .ln-ic { font-size: 22px; }
@keyframes pulse { 0%,100% { transform: scale(1); } 50% { transform: scale(1.05); } }

/* ---------- 答题 ---------- */
.quiz-top { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.quiz-top .back {
  width: 40px; height: 40px; border-radius: 12px; background: var(--card);
  box-shadow: var(--shadow); font-size: 18px; display: flex; align-items: center; justify-content: center;
}
.quiz-top .qt-info { flex: 1; }
.quiz-top .qt-title { font-weight: 700; font-size: 16px; }
.quiz-top .qt-progress { font-size: 13px; color: var(--sub); }
.progress-bar { height: 8px; background: #e5edf7; border-radius: 99px; overflow: hidden; margin-top: 6px; }
.progress-bar i { display: block; height: 100%; background: linear-gradient(90deg, #22c55e, #06b6d4); border-radius: 99px; transition: width .3s; }

.timer-box { text-align: center; margin-bottom: 10px; }
.timer-ring {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 58px; padding: 8px 14px; border-radius: 99px; font-weight: 800; font-size: 20px;
  background: #eef2ff; color: var(--blue);
}
.timer-ring.low { background: #fee2e2; color: var(--red); animation: pulse 1s infinite; }

.q-card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow-lg); padding: 20px 18px; margin-bottom: 16px; }
.q-tags { display: flex; gap: 6px; margin-bottom: 10px; flex-wrap: wrap; }
.tag {
  font-size: 12px; padding: 3px 10px; border-radius: 99px; font-weight: 600;
  background: #e0f2fe; color: #0369a1;
}
.tag.d1 { background: #dcfce7; color: #15803d; }
.tag.d2 { background: #fef9c3; color: #a16207; }
.tag.d3 { background: #fee2e2; color: #b91c1c; }
.tag.src { background: #ede9fe; color: #6d28d9; }
/* 首页「我的教材」自选卡 */
.quiz-pref-box {
  background: #fff; border-radius: 16px; padding: 12px 14px; margin: 10px 0;
  box-shadow: 0 1px 6px rgba(0, 0, 0, 0.06);
}
.qp-head { font-size: 15px; font-weight: 700; display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.qp-tip { font-size: 12px; font-weight: 400; color: #d97706; }
.qp-row { display: flex; align-items: center; gap: 10px; margin: 7px 0; flex-wrap: wrap; }
.qp-label { font-size: 13px; color: #6b7280; width: 34px; flex-shrink: 0; }
.qp-pills { display: flex; gap: 8px; flex-wrap: wrap; }
.qp-pill {
  font-size: 13px; padding: 5px 12px; border-radius: 99px; border: 1px solid #e2e8f0;
  background: #f8fafc; color: #475569; cursor: pointer; font-weight: 600; transition: all .15s;
}
.qp-pill.on { background: #1d4ed8; border-color: #1d4ed8; color: #fff; }
@media (max-width: 480px) {
  .qp-row { align-items: flex-start; }
  .qp-label { width: 30px; }
}
.q-text { font-size: 22px; font-weight: 700; line-height: 1.7; word-break: break-word; }
.q-speak {
  margin-top: 10px; display: inline-flex; align-items: center; gap: 6px;
  font-size: 14px; color: var(--blue); background: #eff6ff; padding: 6px 14px; border-radius: 99px;
}

.options { display: grid; grid-template-columns: 1fr; gap: 12px; margin-top: 16px; }
.opt {
  display: flex; align-items: center; gap: 12px; text-align: left;
  background: #f8fafc; border: 2px solid transparent; border-radius: 16px;
  padding: 14px 16px; font-size: 17px; font-weight: 600; transition: transform .1s, border-color .15s, background .15s;
}
.opt:active { transform: scale(.98); }
.opt .letter {
  width: 30px; height: 30px; flex: none; border-radius: 50%;
  background: #e2e8f0; color: var(--ink); display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 14px;
}
.opt .otext { flex: 1; word-break: break-word; }
.opt.right { background: #dcfce7; border-color: #22c55e; }
.opt.right .letter { background: #22c55e; color: #fff; }
.opt.wrong { background: #fee2e2; border-color: #ef4444; animation: shake .4s; }
.opt.wrong .letter { background: #ef4444; color: #fff; }
.opt.dim { opacity: .45; }
@keyframes shake {
  0%,100% { transform: translateX(0); }
  20% { transform: translateX(-6px); } 40% { transform: translateX(6px); }
  60% { transform: translateX(-4px); } 80% { transform: translateX(4px); }
}

.fill-box { display: flex; gap: 10px; margin-top: 16px; }
.fill-box input {
  flex: 1; padding: 14px 16px; border: 2px solid #dbeafe; border-radius: 14px; font-size: 18px; outline: none;
}
.fill-box input:focus { border-color: var(--blue); }

.q-explain {
  margin-top: 14px; background: #fffbeb; border-radius: 14px; padding: 12px 14px;
  font-size: 14px; color: #92400e; line-height: 1.7; display: none;
}
.q-explain.show { display: block; animation: fadeIn .25s; }

/* ---------- 结算页 ---------- */
.result-hero { text-align: center; padding: 26px 16px; }
.result-hero .r-emoji { font-size: 76px; display: block; animation: bounceIn .6s; }
@keyframes bounceIn {
  0% { transform: scale(.2); opacity: 0; }
  60% { transform: scale(1.25); }
  100% { transform: scale(1); opacity: 1; }
}
.result-hero .r-title { font-size: 24px; font-weight: 800; margin-top: 8px; }
.result-hero .r-stars { font-size: 34px; letter-spacing: 6px; margin: 8px 0; }
.result-hero .r-pts { display: inline-block; margin-top: 8px; font-size: 18px; font-weight: 800; color: var(--orange); background: #fff7ed; padding: 6px 18px; border-radius: 99px; }
.result-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin: 14px 0; }
.stat { text-align: center; background: #f8fafc; border-radius: 14px; padding: 12px 6px; }
.stat .v { font-size: 22px; font-weight: 800; color: var(--blue); }
.stat .k { font-size: 12px; color: var(--sub); margin-top: 2px; }

/* 结算框：明细 */
.result-score { max-width: 480px; margin: 0 auto 14px; background: #f8fafc; border-radius: 14px; padding: 12px 16px; }
.rs-row { display: flex; justify-content: space-between; align-items: center; font-size: 14px; padding: 6px 0; color: #334155; }
.rs-row b { font-size: 15px; }
.rs-row.total { border-top: 1px dashed var(--line); margin-top: 4px; padding-top: 10px; font-weight: 700; }
.rs-row.total b { font-size: 17px; color: var(--blue); }

.review-item { padding: 12px 0; border-bottom: 1px dashed var(--line); font-size: 14px; }
.review-item:last-child { border-bottom: none; }
.review-item .rq { font-weight: 600; }
.review-item .ra { color: var(--green); }
.review-item .rg { color: var(--red); }
.review-item .re { color: #92400e; margin-top: 4px; background: #fffbeb; border-radius: 8px; padding: 6px 10px; }

/* ---------- 红心血条（一颗红心 = 一条命） ---------- */
.hearts-bar { display: flex; align-items: center; gap: 3px; padding: 10px 14px; background: linear-gradient(135deg, #fff1f2, #ffe4e6); border: 1px solid #fecdd3; border-radius: 12px; margin-bottom: 8px; }
.hearts-bar .heart { font-size: 22px; line-height: 1; color: #e0245e; font-family: "Segoe UI Emoji", "Apple Color Emoji", "Noto Color Emoji", sans-serif; filter: drop-shadow(0 1px 1px rgba(0,0,0,.15)); }
.hearts-bar .heart.off { filter: grayscale(1) opacity(.35); color: #9ca3af; }
.hearts-bar .hearts-txt { margin-left: 6px; font-weight: 700; color: #be123c; font-size: 14px; }
.hearts-tip { font-size: 12px; color: #9f1239; background: #fff1f2; border-radius: 10px; padding: 8px 10px; margin-top: 8px; line-height: 1.5; }
.quiz-hearts { flex: none; display: flex; align-items: center; gap: 3px; background: #fff1f2; border: 1px solid #fecdd3; color: #be123c; font-weight: 700; font-size: 13px; padding: 4px 10px; border-radius: 20px; }
.quiz-hearts .heart { font-size: 15px; color: #e0245e; font-family: "Segoe UI Emoji", "Apple Color Emoji", "Noto Color Emoji", sans-serif; }
.level-node.noheart { opacity: .6; }
.level-node.noheart .ln-stars { color: #9ca3af; font-size: 12px; }

/* 结算强制停留：错 1 题 10 秒，每多错 1 题再加 10 秒 */
.review-lock { display: flex; align-items: center; justify-content: center; gap: 8px; background: linear-gradient(135deg, #fee2e2, #ffedd5); border: 1px solid #fecaca; color: #991b1b; border-radius: 14px; padding: 12px; font-size: 14px; font-weight: 600; margin-bottom: 14px; animation: lockPulse 1.2s ease-in-out infinite; }
.review-lock .rl-ic { font-size: 20px; }
@keyframes lockPulse { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.02); } }

/* 错题高亮（强制看错题） */
.review-item.review-wrong { background: #fef2f2; border: 1px solid #fecaca; border-radius: 12px; padding: 12px; margin: 8px 0; }
.review-item.review-wrong .rq { color: #b91c1c; }
.review-item .wrong-txt { font-weight: 700; color: #dc2626; }

/* 结算回顾分组：错题在上、对题在下 */
.rv-group-title { font-size: 14px; font-weight: 800; padding: 10px 12px; border-radius: 10px; margin: 10px 0 6px; }
.rv-group-title.wrong { background: #fee2e2; color: #b91c1c; }
.rv-group-title.ok { background: #dcfce7; color: #15803d; }

/* ---------- 商店 ---------- */
.shop-grid { display: grid; grid-template-columns: 1fr; gap: 12px; }
.shop-item { display: flex; align-items: center; gap: 14px; }
.shop-item .si-ic {
  width: 64px; height: 64px; flex: none; border-radius: 16px; background: linear-gradient(135deg, #fef3c7, #fde68a);
  display: flex; align-items: center; justify-content: center; font-size: 34px;
}
.shop-item .si-info { flex: 1; min-width: 0; }
.shop-item .si-name { font-weight: 700; font-size: 16px; }
.shop-item .si-desc { font-size: 13px; color: var(--sub); }
.shop-item .si-cost { font-size: 14px; color: var(--orange); font-weight: 700; margin-top: 2px; }
.shop-item .si-stock { font-size: 12px; color: var(--sub); }
.shop-item .btn { padding: 10px 18px; font-size: 14px; flex: none; }

/* ---------- 抽奖 ---------- */
.lottery-wrap { text-align: center; }
.wheel-box { position: relative; width: min(340px, 88vw); margin: 8px auto 0; }
.wheel-pointer {
  position: absolute; top: -8px; left: 50%; transform: translateX(-50%); z-index: 5;
  width: 0; height: 0; border-left: 16px solid transparent; border-right: 16px solid transparent;
  border-top: 30px solid var(--red); filter: drop-shadow(0 2px 3px rgba(0,0,0,.3));
}
.wheel-pointer::after {
  content: ""; position: absolute; left: -7px; top: -34px; width: 14px; height: 14px;
  background: #fff; border-radius: 50%;
}
#wheelCanvas { width: 100%; height: auto; display: block; border-radius: 50%; box-shadow: var(--shadow-lg); }
.wheel-btn { margin-top: 16px; width: min(340px, 88vw); }
.lottery-cost { margin-top: 8px; font-size: 13px; color: var(--sub); }
.prize-legend { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin-top: 16px; }
.prize-legend span { font-size: 12px; background: #f1f5f9; border-radius: 99px; padding: 4px 12px; color: #475569; }

/* ---------- 我的 ---------- */
.stats-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.setting-row { display: flex; align-items: center; justify-content: space-between; padding: 12px 0; border-bottom: 1px dashed var(--line); }
.setting-row:last-child { border-bottom: none; }
.setting-row .s-label { font-weight: 600; font-size: 15px; }
.switch {
  width: 52px; height: 30px; border-radius: 99px; background: #cbd5e1; position: relative; transition: background .2s; flex: none;
}
.switch::after {
  content: ""; position: absolute; top: 3px; left: 3px; width: 24px; height: 24px; border-radius: 50%;
  background: #fff; transition: left .2s; box-shadow: 0 1px 3px rgba(0,0,0,.25);
}
.switch.on { background: var(--green); }
.switch.on::after { left: 25px; }

.record-item { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px dashed var(--line); font-size: 14px; }
.record-item:last-child { border-bottom: none; }
.record-item .r-ic { font-size: 22px; }
.record-item .r-main { flex: 1; min-width: 0; }
.record-item .r-title { font-weight: 600; }
.record-item .r-time { font-size: 12px; color: var(--sub); }
.record-item .r-pts { font-weight: 800; }
.record-item .r-pts.plus { color: var(--green); }
.record-item .r-pts.minus { color: var(--red); }

/* ---------- 后台 ---------- */
.screen.active.admin-login-screen {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: linear-gradient(160deg, #1e3a8a 0%, #3b82f6 55%, #7dd3fc 100%);
  padding: 20px;
  box-sizing: border-box;
}
.admin-login-box {
  width: 100%; max-width: 380px; background: rgba(255, 255, 255, .97); border-radius: 20px;
  padding: 34px 28px 26px; box-shadow: 0 20px 60px rgba(15, 23, 42, .35); text-align: center;
}
.admin-login-logo {
  width: 64px; height: 64px; margin: 0 auto 12px; border-radius: 18px; font-size: 32px;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #3b82f6, #1d4ed8); box-shadow: 0 8px 20px rgba(29, 78, 216, .35);
}
.admin-login-title { font-size: 22px; font-weight: 800; margin-bottom: 4px; color: #0f172a; }
.admin-login-sub { font-size: 13px; color: #64748b; margin-bottom: 22px; }
.admin-login-box .form-row { text-align: left; }
.admin-login-box #admLogin { width: 100%; margin-top: 6px; font-size: 16px; padding: 12px; }
.admin-login-foot { display: flex; justify-content: space-between; align-items: center; margin-top: 18px; }
.admin-tabs { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 8px; margin-bottom: 12px; }
.admin-tabs button {
  flex: none; padding: 8px 14px; border-radius: 99px; background: #eef2f7; font-size: 14px; font-weight: 600;
}
.admin-tabs button.on { background: var(--blue); color: #fff; }

/* ============ 后台管理：左侧边栏布局 ============ */
.admin-layout { display: flex; align-items: flex-start; gap: 14px; }
.admin-side {
  flex: 0 0 196px; min-width: 0; background: linear-gradient(180deg, #0f172a, #1e293b);
  border-radius: 16px; padding: 14px 10px; color: #fff;
  position: sticky; top: 10px; display: flex; flex-direction: column; gap: 10px;
  box-shadow: 0 10px 30px rgba(15, 23, 42, .25);
}
.admin-side-head { display: flex; align-items: center; gap: 8px; padding: 2px 6px 10px; border-bottom: 1px solid rgba(255,255,255,.12); }
.admin-side-head .ash-ic { font-size: 22px; }
.admin-side-head b { display: block; font-size: 15px; }
.admin-side-head em { display: block; font-style: normal; font-size: 10px; color: #94a3b8; margin-top: 2px; }
.admin-side-nav { display: flex; flex-direction: column; gap: 2px; }
.admin-side-nav button {
  text-align: left; padding: 9px 12px; border-radius: 10px; font-size: 13.5px; font-weight: 600;
  color: #cbd5e1; background: transparent; display: flex; align-items: center; gap: 6px;
}
.admin-side-nav button:hover { background: rgba(255,255,255,.08); color: #fff; }
.admin-side-nav button.on { background: linear-gradient(135deg, #3b82f6, #2563eb); color: #fff; box-shadow: 0 4px 12px rgba(59,130,246,.4); }
.admin-side-foot { display: flex; gap: 6px; border-top: 1px solid rgba(255,255,255,.12); padding-top: 10px; }
.admin-main { flex: 1 1 0; min-width: 0; }
.admin-main-head {
  display: flex; justify-content: space-between; align-items: center; gap: 10px;
  background: #fff; border: 1px solid #e2e8f0; border-radius: 14px;
  padding: 10px 16px; margin-bottom: 12px; box-shadow: 0 1px 3px rgba(15,23,42,.05);
}
.admin-main-head .amh-title { font-size: 15px; font-weight: 800; color: #0f172a; }
@media (max-width: 820px) {
  .admin-layout { flex-direction: column; }
  .admin-side { flex: none; width: 100%; position: static; flex-direction: column; }
  .admin-side-nav { flex-direction: row; overflow-x: auto; padding-bottom: 4px; }
  .admin-side-nav button { white-space: nowrap; }
  .admin-side-foot { flex-direction: row; }
}


/* ============ 后台仪表盘（专业统计） ============ */
.stat-cards { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 14px; }
.stat-card {
  flex: 1 1 150px; min-width: 0; background: linear-gradient(150deg, #fff, #f8fafc);
  border: 1px solid #e2e8f0; border-radius: 14px; padding: 12px 14px;
  box-shadow: 0 1px 3px rgba(15, 23, 42, .06); box-sizing: border-box;
}
.stat-card .sc-ic { font-size: 18px; margin-bottom: 4px; }
.stat-card .sc-val { font-size: 12px; color: #64748b; font-weight: 600; }
.stat-card .sc-num { font-size: 22px; font-weight: 800; color: #0f172a; margin: 2px 0; }
.stat-card .sc-sub { font-size: 11px; color: #94a3b8; line-height: 1.5; }
.dash-grid { display: flex; flex-wrap: wrap; gap: 12px; }
.dash-panel { flex: 1 1 300px; min-width: 0; background: #fff; border: 1px solid #e2e8f0; border-radius: 14px; padding: 14px; box-sizing: border-box; }
.dp-title { font-size: 13px; font-weight: 700; color: #334155; margin-bottom: 12px; }
.trend-bars { display: flex; align-items: flex-end; gap: 8px; height: 120px; padding: 0 4px; }
.tb-col { flex: 1 1 0; display: flex; flex-direction: column; align-items: center; gap: 4px; min-width: 0; }
.tb-bar-wrap { flex: 1; display: flex; align-items: flex-end; width: 100%; max-width: 34px; }
.tb-bar { width: 100%; min-height: 4px; background: linear-gradient(180deg, #3b82f6, #60a5fa); border-radius: 6px 6px 0 0; position: relative; }
.tb-v { position: absolute; top: -18px; left: 50%; transform: translateX(-50%); font-size: 10px; font-weight: 700; color: #475569; white-space: nowrap; }
.tb-l { font-size: 11px; color: #64748b; }
.grade-bar-row { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.gb-name { flex: 0 0 56px; font-size: 12px; color: #475569; text-align: right; }
.gb-track { flex: 1; height: 14px; background: #f1f5f9; border-radius: 8px; overflow: hidden; min-width: 0; }
.gb-fill { height: 100%; background: linear-gradient(90deg, #8b5cf6, #a78bfa); border-radius: 8px; }
.gb-num { flex: 0 0 30px; font-size: 12px; font-weight: 700; color: #0f172a; text-align: right; }
.rec-rows { display: flex; flex-direction: column; gap: 10px; }
.rec-row { display: flex; align-items: center; gap: 8px; font-size: 12px; color: #475569; }
.rec-row b { flex: 0 0 44px; text-align: right; color: #0f172a; }
.rec-bar-wrap { flex: 1; height: 10px; background: #f1f5f9; border-radius: 6px; overflow: hidden; min-width: 0; }
.rec-bar { display: block; height: 100%; background: linear-gradient(90deg, #f97316, #fb923c); border-radius: 6px; }
@media (max-width: 480px) {
  .stat-card { flex: 1 1 44%; }
  .dash-panel { flex: 1 1 100%; }
  .tb-v { font-size: 9px; }
}
.form-row { margin-bottom: 12px; }
.form-row label { display: block; font-size: 13px; color: var(--sub); margin-bottom: 4px; font-weight: 600; }
.form-row input, .form-row select, .form-row textarea {
  width: 100%; padding: 10px 12px; border: 1.5px solid #dbeafe; border-radius: 10px; outline: none; background: #fff;
}
.form-row input:focus, .form-row select:focus, .form-row textarea:focus { border-color: var(--blue); }
.form-grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.form-grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.form-grid4 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.mini-btn { padding: 6px 12px; border-radius: 9px; background: #eef2f7; font-size: 13px; font-weight: 600; }
.mini-btn.blue { background: #dbeafe; color: #1d4ed8; }
.mini-btn.red { background: #fee2e2; color: #b91c1c; }
.mini-btn.green { background: #dcfce7; color: #15803d; }

.bank-item { padding: 10px 0; border-bottom: 1px dashed var(--line); font-size: 14px; display: flex; justify-content: space-between; gap: 8px; }
.bank-item:last-child { border-bottom: none; }
.bank-item .bi-name { font-weight: 700; }
.bank-item .bi-meta { font-size: 12px; color: var(--sub); }

/* ---------- 弹窗 / Toast ---------- */
#modalWrap { position: fixed; inset: 0; z-index: 90; display: none; }
#modalWrap.show { display: flex; align-items: center; justify-content: center; padding: 20px; }
.modal-mask { position: absolute; inset: 0; background: rgba(15, 23, 42, .45); backdrop-filter: blur(2px); }
.modal-box {
  position: relative; width: min(420px, 92vw); max-height: 82vh; overflow-y: auto;
  background: #fff; border-radius: 20px; padding: 20px; box-shadow: var(--shadow-lg);
  animation: bounceIn .3s;
}
.modal-box h3 { font-size: 18px; margin-bottom: 10px; }
.modal-box .modal-actions { display: flex; gap: 10px; margin-top: 16px; }
.modal-box .modal-actions .btn { flex: 1; }
.modal-prize { text-align: center; padding: 10px 0; }
.modal-prize .p-ic { font-size: 72px; animation: bounceIn .5s; }
.modal-prize .p-name { font-size: 24px; font-weight: 800; margin-top: 8px; }
.modal-prize .p-sub { color: var(--sub); font-size: 14px; margin-top: 4px; }

#toastWrap { position: fixed; left: 0; right: 0; top: 14%; z-index: 99; display: flex; flex-direction: column; align-items: center; gap: 8px; pointer-events: none; }
.toast {
  background: rgba(17, 24, 39, .88); color: #fff; font-size: 15px; font-weight: 600;
  padding: 10px 22px; border-radius: 99px; animation: toastIn .25s; max-width: 86vw; text-align: center;
}
.toast.err { background: rgba(220, 38, 38, .92); }
.toast.ok { background: rgba(22, 163, 74, .92); }
@keyframes toastIn { from { opacity: 0; transform: translateY(-10px) scale(.9); } to { opacity: 1; transform: none; } }

#fx { position: fixed; inset: 0; z-index: 80; pointer-events: none; }

.float-score {
  position: absolute; font-size: 22px; font-weight: 800; pointer-events: none;
  animation: floatUp 1.2s ease-out forwards; z-index: 5;
}
@keyframes floatUp { 0% { opacity: 0; transform: translateY(6px); } 20% { opacity: 1; } 100% { opacity: 0; transform: translateY(-46px); } }

/* 选人 */
.user-hero { text-align: center; padding: 34px 0 20px; }
.user-hero .u-logo { font-size: 74px; animation: bounceIn .6s; }
.user-hero h1 { font-size: 26px; margin-top: 8px; }
.user-hero p { color: var(--sub); font-size: 14px; }
.avatar-pick { display: flex; justify-content: center; gap: 10px; flex-wrap: wrap; margin: 16px 0; }
.avatar-pick button {
  font-size: 30px; width: 54px; height: 54px; border-radius: 16px; background: #f1f5f9;
  display: flex; align-items: center; justify-content: center; transition: transform .12s;
}
.avatar-pick button.on { background: #dbeafe; box-shadow: 0 0 0 3px var(--blue); transform: scale(1.08); }

/* 空状态 */
.empty { text-align: center; color: var(--sub); font-size: 14px; padding: 26px 0; }
.empty .e-ic { font-size: 44px; display: block; margin-bottom: 8px; }

/* ---------- 响应式：平板（≥600px） ---------- */
@media (min-width: 600px) {
  #app { padding: 0 20px calc(86px + env(safe-area-inset-bottom)); }
  body { font-size: 16px; }
  .menu-grid { grid-template-columns: repeat(4, 1fr); }
  .menu-item .m-ic { font-size: 44px; }
  .level-map { grid-template-columns: repeat(5, 1fr); gap: 14px; }
  .options { grid-template-columns: 1fr 1fr; }
  .q-text { font-size: 26px; }
  .shop-grid { grid-template-columns: 1fr 1fr; }
  .stats-grid { grid-template-columns: repeat(4, 1fr); }
  .form-grid4 { grid-template-columns: repeat(4, 1fr); }
  .result-stats { max-width: 480px; margin-left: auto; margin-right: auto; }
}

/* ---------- 响应式：电脑（≥1024px） ---------- */
@media (min-width: 1024px) {
  #app { padding-top: 14px; }
  #topBar { padding: 14px 22px; }
  #topBar .brand { font-size: 19px; }
  .menu-item .m-ic { font-size: 48px; }
  .q-card { padding: 28px 26px; }
  .options { gap: 14px; }
  .opt { padding: 16px 18px; font-size: 18px; }
  .shop-grid { grid-template-columns: repeat(2, 1fr); }
  .wheel-box { width: 380px; }
  .level-map { grid-template-columns: repeat(5, 1fr); max-width: 720px; margin: 0 auto; }
}

/* 横屏小屏适配 */
@media (orientation: landscape) and (max-height: 520px) {
  .q-text { font-size: 19px; }
  .opt { padding: 10px 12px; font-size: 15px; }
  #bottomNav { padding: 2px 4px calc(4px + env(safe-area-inset-bottom)); }
}

/* ---------- 家长中心 ---------- */
.parent-links { display: flex; flex-direction: column; gap: 10px; margin-top: 16px; }
.parent-links .link-btn { display: flex; justify-content: space-between; align-items: center; }
.parent-links .link-btn small { color: #6b7280; font-size: 11px; font-weight: 400; }
.link-btn.blue-bg { background: #eff6ff; border: 1px solid #bfdbfe; }
.link-btn.ghost-bg { background: #f8fafc; border: 1px dashed #cbd5e1; }
.parent-hero { display: flex; align-items: center; gap: 12px; background: linear-gradient(135deg, #eff6ff, #fdf2f8); border-radius: 14px; padding: 12px; }
.parent-hero .ph-av { font-size: 40px; }
.parent-hero .ph-info { flex: 1; min-width: 0; }
.parent-hero .ph-name { font-size: 17px; font-weight: 800; }
.parent-hero .ph-grade { font-size: 12px; color: #6b7280; font-weight: 400; margin-left: 4px; }
.parent-hero .ph-bind { font-size: 15px; margin-top: 2px; }
.parent-hero .ph-bind b { color: #f97316; letter-spacing: 2px; }
.parent-hero .ph-tip { font-size: 12px; color: #6b7280; margin-top: 2px; }
.admin-tabs button { padding: 9px 10px; font-size: 13px; }

.parent-quick-link { display:block; color:#3b82f6; font-size:14px; margin-top:4px; }

/* ================= 新功能：年级选择 / 通知 / 反馈 / 考试 / 学习规则 ================= */
.grade-pick { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.grade-pick button { padding: 10px 4px; border-radius: 12px; border: 2px solid var(--line, #e5e7eb); background: #fff; font-size: 14px; font-weight: 600; color: var(--ink, #1f2937); }
.grade-pick button.on { border-color: var(--blue, #3b82f6); background: #eff6ff; color: var(--blue, #3b82f6); }
.grade-chip { display: inline-block; font-size: 12px; font-weight: 600; color: #fff; background: linear-gradient(135deg, #8b5cf6, #7c3aed); border-radius: 999px; padding: 3px 10px; margin-left: 8px; vertical-align: middle; }

/* ============ 我的奖品 / 奖品栏 ============ */
.prize-badge { display: inline-block; font-size: 11px; font-weight: 700; color: #fff; background: #f97316; border-radius: 999px; padding: 2px 8px; margin-left: 6px; vertical-align: middle; }
.prize-tabs { display: flex; gap: 8px; margin-bottom: 10px; }
.prize-tabs button { flex: 1; padding: 9px 4px; border-radius: 12px; border: 2px solid #e5e7eb; background: #fff; font-size: 13px; font-weight: 700; color: #6b7280; }
.prize-tabs button.on { border-color: var(--blue, #3b82f6); background: #eff6ff; color: var(--blue, #3b82f6); }
.prize-list { display: flex; flex-direction: column; gap: 8px; }
.prize-item {
  display: flex; align-items: center; gap: 10px; background: #f8fafc; border: 1px solid #e2e8f0;
  border-radius: 12px; padding: 10px 12px;
}
.prize-item .pi-ic { font-size: 22px; flex: none; }
.prize-item .pi-main { flex: 1; min-width: 0; }
.prize-item .pi-name { font-size: 14px; font-weight: 700; color: #0f172a; display: block; }
.prize-item .pi-meta { font-size: 11px; color: #94a3b8; display: block; margin-top: 2px; }
.prize-item .pi-tag { flex: none; font-size: 12px; font-weight: 700; color: #f97316; background: #fff7ed; border: 1px solid #fdba74; border-radius: 999px; padding: 3px 10px; }
.prize-item .pi-tag.done { color: #16a34a; background: #f0fdf4; border-color: #86efac; }
.prize-item.done { opacity: .72; }
.menu-item.purple { border-top: 5px solid #8b5cf6; background: linear-gradient(145deg, #fff, #f5f3ff); }
.menu-item.cyan { border-top: 5px solid #06b6d4; }
.menu-item.gold { border-top: 5px solid #f59e0b; background: linear-gradient(145deg, #fff, #fffbeb); }
.notif-bar { display: flex; align-items: center; justify-content: center; gap: 6px; width: 100%; margin-top: 10px; padding: 10px; border-radius: 12px; border: 1px dashed #e5e7eb; background: #f8fafc; font-size: 14px; color: #374151; }
.notif-badge { display: inline-flex; align-items: center; justify-content: center; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px; background: #ef4444; color: #fff; font-size: 12px; font-weight: 700; }
.notif-list { max-height: 60vh; overflow-y: auto; }
.notif-item { padding: 10px 0; border-bottom: 1px dashed var(--line, #e5e7eb); }
.notif-item:last-child { border-bottom: none; }
.notif-item .nt-title { font-weight: 700; font-size: 15px; display: flex; align-items: center; gap: 6px; }
.notif-item .nt-content { font-size: 13px; color: #4b5563; margin-top: 4px; }
.notif-item .nt-time { font-size: 11px; color: #9ca3af; margin-top: 4px; }
.notif-item .dot { width: 8px; height: 8px; border-radius: 50%; background: #ef4444; display: inline-block; }
.fb-item { padding: 10px 0; border-bottom: 1px dashed var(--line, #e5e7eb); }
.fb-item:last-child { border-bottom: none; }
.fb-head { display: flex; justify-content: space-between; gap: 8px; font-size: 14px; }
.fb-status { font-size: 11px; color: #d97706; background: #fef3c7; border-radius: 999px; padding: 2px 8px; white-space: nowrap; }
.fb-status.ok { color: #16a34a; background: #dcfce7; }
.fb-reply { font-size: 13px; color: #1d4ed8; background: #eff6ff; border-radius: 10px; padding: 6px 10px; margin-top: 6px; }
.exam-timer { font-size: 20px; font-weight: 800; color: var(--blue, #3b82f6); font-variant-numeric: tabular-nums; white-space: nowrap; }
.exam-timer.low { color: #ef4444; animation: blink 1s infinite; }
@keyframes blink { 50% { opacity: .4; } }
.exam-nav { display: grid; grid-template-columns: repeat(8, 1fr); gap: 6px; margin-top: 12px; }
.exam-nav .en-item {
  width: 34px; height: 34px; margin: 0 auto;
  display: flex; align-items: center; justify-content: center;
  padding: 0; border-radius: 4px;
  border: 2px solid var(--line, #e5e7eb); background: #fff; font-size: 13px; font-weight: 600; color: #6b7280;
}
.exam-nav .en-item.done { border-color: var(--green, #22c55e); background: #f0fdf4; color: var(--green, #16a34a); }
.exam-nav .en-item.cur { border-color: var(--blue, #3b82f6); background: var(--blue, #3b82f6); color: #fff; }
.opt.chosen { border-color: var(--blue, #3b82f6) !important; background: #eff6ff !important; box-shadow: 0 0 0 3px rgba(59,130,246,.15); }
.review-item.ok { border-left: 4px solid #22c55e; }
.review-item.no { border-left: 4px solid #ef4444; }
.form-grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.exam-score { font-size: 28px; }
@media (max-width: 640px) {
  .exam-nav { grid-template-columns: repeat(6, 1fr); }
  .result-stats { grid-template-columns: repeat(2, 1fr); }
  .result-score { padding: 10px 12px; }
}
