/* ============================================================
   小学趣味闯关乐园 · 主样式
   设计：明亮童趣 · 圆润卡片 · 轻动效
   ============================================================ */

:root {
  --brand: #5B6CFF;
  --brand-deep: #4453E8;
  --brand-soft: #EEF0FF;
  --orange: #FF8A3D;
  --orange-soft: #FFF2E8;
  --green: #22C55E;
  --green-soft: #E9FBF0;
  --red: #F43F5E;
  --red-soft: #FFEDF1;
  --yellow: #FFC53D;
  --purple: #8B5CF6;
  --ink: #1F2340;
  --ink-2: #5A6180;
  --ink-3: #9AA1BC;
  --line: #E8EAF4;
  --bg: #F6F7FE;
  --card: #FFFFFF;
  --shadow-sm: 0 2px 8px rgba(31, 35, 64, .05);
  --shadow: 0 10px 28px rgba(31, 35, 64, .08);
  --shadow-lg: 0 22px 60px rgba(31, 35, 64, .14);
  --r-sm: 12px;
  --r: 18px;
  --r-lg: 26px;
  --font: "Nunito", -apple-system, BlinkMacSystemFont, "PingFang SC", "HarmonyOS Sans SC", "Microsoft YaHei", sans-serif;
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  font-family: var(--font);
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  font-size: 15px;
  line-height: 1.6;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(760px 420px at 12% -6%, #E7EBFF 0%, rgba(231, 235, 255, 0) 62%),
    radial-gradient(700px 400px at 96% 2%, #FFF0E1 0%, rgba(255, 240, 225, 0) 60%),
    radial-gradient(600px 500px at 50% 108%, #E6FBF2 0%, rgba(230, 251, 242, 0) 60%);
  pointer-events: none;
}

a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
button, input, select, textarea { font-family: inherit; font-size: inherit; }
.ico { display: inline-block; vertical-align: -3px; flex: none; }

.container { width: min(1180px, 100% - 40px); margin: 0 auto; }
.muted { color: var(--ink-3); }
.small { font-size: 13px; }
.center { text-align: center; }
.row { display: flex; align-items: center; gap: 10px; }
.between { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.wrap { flex-wrap: wrap; }
.grow { flex: 1; }
.mt-0 { margin-top: 0; }
.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
.mt-4 { margin-top: 34px; }
.mb-0 { margin-bottom: 0; }
.hidden { display: none !important; }

/* ============================ 顶栏 ============================ */
.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  backdrop-filter: saturate(1.4) blur(14px);
  background: rgba(255, 255, 255, .82);
  border-bottom: 1px solid rgba(232, 234, 244, .9);
}
.topbar-inner {
  display: flex;
  align-items: center;
  gap: 26px;
  height: 68px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 800;
  font-size: 18px;
  letter-spacing: .2px;
  white-space: nowrap;
}
.brand-mark {
  width: 38px;
  height: 38px;
  border-radius: 12px;
  background: linear-gradient(140deg, #7C8BFF, #5B6CFF 55%, #8B5CF6);
  display: grid;
  place-items: center;
  color: #fff;
  box-shadow: 0 6px 16px rgba(91, 108, 255, .35);
  font-size: 19px;
  font-weight: 800;
}
.brand small {
  display: block;
  font-size: 11px;
  font-weight: 600;
  color: var(--ink-3);
  letter-spacing: .4px;
}
.nav { display: flex; align-items: center; gap: 6px; flex: 1; }
.nav a {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: 12px;
  color: var(--ink-2);
  font-weight: 600;
  font-size: 14.5px;
  transition: .18s;
}
.nav a:hover { background: var(--brand-soft); color: var(--brand-deep); }
.nav a.active { background: var(--brand); color: #fff; box-shadow: 0 6px 16px rgba(91, 108, 255, .3); }

.topbar-right { display: flex; align-items: center; gap: 10px; }
.points-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 13px 6px 9px;
  border-radius: 999px;
  background: linear-gradient(135deg, #FFF6DC, #FFE9B8);
  color: #9A6B00;
  font-weight: 800;
  font-size: 14px;
  border: 1px solid #FFE29A;
}
.user-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 5px 10px 5px 5px;
  border-radius: 999px;
  background: #fff;
  border: 1px solid var(--line);
  font-weight: 700;
  font-size: 14px;
  transition: .18s;
}
.user-chip:hover { border-color: #CBD1F5; box-shadow: var(--shadow-sm); }
.avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: #fff;
  font-weight: 800;
  font-size: 15px;
  background: linear-gradient(140deg, #7C8BFF, #5B6CFF);
  flex: none;
  overflow: hidden;
}
.avatar.av-2 { background: linear-gradient(140deg, #FFB26B, #FF8A3D); }
.avatar.av-3 { background: linear-gradient(140deg, #6EE7B7, #10B981); }
.avatar.av-4 { background: linear-gradient(140deg, #C4B5FD, #8B5CF6); }
.avatar.av-5 { background: linear-gradient(140deg, #7DD3FC, #0EA5E9); }
.avatar.av-6 { background: linear-gradient(140deg, #FDA4AF, #F43F5E); }
.avatar.lg { width: 56px; height: 56px; font-size: 22px; }
.avatar.xl { width: 76px; height: 76px; font-size: 30px; border-radius: 24px; }

.vip-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 800;
  background: linear-gradient(120deg, #2B2F55, #4A4F86);
  color: #FFD98A;
  letter-spacing: .3px;
}

/* ============================ 按钮 ============================ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 10px 20px;
  border-radius: 14px;
  border: 1px solid transparent;
  background: #fff;
  color: var(--ink);
  font-weight: 700;
  font-size: 14.5px;
  cursor: pointer;
  transition: transform .16s, box-shadow .18s, background .18s, border-color .18s;
  white-space: nowrap;
}
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0) scale(.985); }
.btn-primary {
  background: linear-gradient(135deg, #6D7CFF, #5B6CFF 60%, #4F5BE0);
  color: #fff;
  box-shadow: 0 10px 22px rgba(91, 108, 255, .32);
}
.btn-primary:hover { box-shadow: 0 14px 26px rgba(91, 108, 255, .4); }
.btn-orange {
  background: linear-gradient(135deg, #FFA45C, #FF8A3D);
  color: #fff;
  box-shadow: 0 10px 22px rgba(255, 138, 61, .32);
}
.btn-green {
  background: linear-gradient(135deg, #4ADE80, #22C55E);
  color: #fff;
  box-shadow: 0 10px 22px rgba(34, 197, 94, .28);
}
.btn-ghost { background: #fff; border-color: var(--line); color: var(--ink-2); }
.btn-ghost:hover { border-color: #C9D0F7; color: var(--brand-deep); background: #FBFBFF; }
.btn-soft { background: var(--brand-soft); color: var(--brand-deep); }
.btn-lg { padding: 14px 30px; border-radius: 16px; font-size: 16.5px; }
.btn-sm { padding: 7px 14px; border-radius: 11px; font-size: 13px; }
.btn-block { width: 100%; }
.btn[disabled] { opacity: .55; cursor: not-allowed; transform: none !important; }

/* ============================ 卡片 ============================ */
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-sm);
  padding: 24px;
}
.card.tight { padding: 18px; }
.card-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 0 0 16px;
  font-size: 17px;
  font-weight: 800;
}
.card-title .t { display: flex; align-items: center; gap: 8px; }

.section-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin: 40px 0 18px; }
.section-head h2 { margin: 0; font-size: 22px; font-weight: 800; letter-spacing: .2px; }
.section-head p { margin: 4px 0 0; color: var(--ink-3); font-size: 14px; }

/* ============================ 首页 Hero ============================ */
.hero { padding: 46px 0 10px; position: relative; }
.hero-grid { display: grid; grid-template-columns: 1.05fr .95fr; gap: 40px; align-items: center; }
.hero h1 {
  margin: 0 0 14px;
  font-size: clamp(30px, 4vw, 46px);
  line-height: 1.22;
  letter-spacing: -.5px;
  font-weight: 900;
}
.hero h1 em {
  font-style: normal;
  background: linear-gradient(120deg, #5B6CFF, #8B5CF6 50%, #FF8A3D);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.hero p.lead { color: var(--ink-2); font-size: 16.5px; margin: 0 0 26px; max-width: 520px; }
.hero-actions { display: flex; gap: 12px; flex-wrap: wrap; }
.hero-trust { display: flex; gap: 22px; margin-top: 30px; flex-wrap: wrap; }
.hero-trust div { display: flex; flex-direction: column; }
.hero-trust b { font-size: 22px; font-weight: 900; color: var(--brand-deep); }
.hero-trust span { font-size: 12.5px; color: var(--ink-3); }

.hero-art { position: relative; height: 380px; }
.hero-card {
  position: absolute;
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-lg);
  background: #fff;
  border: 1px solid var(--line);
}
.hc-main {
  inset: 30px 20px 36px 30px;
  padding: 22px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  transform: rotate(-1.4deg);
}
.hc-q { font-weight: 800; font-size: 16px; line-height: 1.5; }
.hc-opts { display: grid; gap: 9px; }
.hc-opt {
  padding: 10px 14px;
  border-radius: 12px;
  border: 1.5px solid var(--line);
  font-size: 14px;
  font-weight: 600;
  color: var(--ink-2);
  display: flex;
  align-items: center;
  gap: 9px;
  background: #FCFCFF;
}
.hc-opt i {
  width: 22px; height: 22px; border-radius: 7px; background: var(--brand-soft);
  color: var(--brand-deep); font-style: normal; font-size: 12px; font-weight: 800;
  display: grid; place-items: center;
}
.hc-opt.ok { background: var(--green-soft); border-color: #A7EFC3; color: #0F8A46; }
.hc-opt.ok i { background: var(--green); color: #fff; }
.hc-float {
  position: absolute;
  background: #fff;
  border-radius: 16px;
  padding: 10px 14px;
  box-shadow: var(--shadow);
  border: 1px solid var(--line);
  display: flex;
  align-items: center;
  gap: 9px;
  font-weight: 800;
  font-size: 13.5px;
  animation: floaty 4.6s ease-in-out infinite;
}
.hc-float.p1 { top: 6px; right: 0; color: #B45309; }
.hc-float.p2 { bottom: 8px; left: 0; color: var(--green); animation-delay: -2.2s; }
.hc-float .dot { width: 26px; height: 26px; border-radius: 9px; display: grid; place-items: center; }
.p1 .dot { background: #FFF4D6; }
.p2 .dot { background: var(--green-soft); }

@keyframes floaty {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-9px); }
}

/* ============================ 成绩条 / 统计 ============================ */
.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
.stat-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 18px;
  box-shadow: var(--shadow-sm);
  position: relative;
  overflow: hidden;
}
.stat-card .k { color: var(--ink-3); font-size: 12.5px; font-weight: 700; letter-spacing: .3px; }
.stat-card .v { font-size: 28px; font-weight: 900; margin: 4px 0 2px; letter-spacing: -.5px; }
.stat-card .sub { font-size: 12.5px; color: var(--ink-3); }
.stat-card .badge-ico {
  position: absolute; right: 14px; top: 14px; width: 34px; height: 34px;
  border-radius: 11px; display: grid; place-items: center; background: var(--brand-soft); color: var(--brand);
}

/* ============================ 学科 / 模式 ============================ */
.grade-switch {
  display: inline-flex;
  padding: 4px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 999px;
  gap: 2px;
}
.grade-switch a {
  padding: 7px 16px;
  border-radius: 999px;
  font-weight: 700;
  font-size: 13.5px;
  color: var(--ink-2);
  transition: .18s;
}
.grade-switch a.on { background: var(--brand); color: #fff; box-shadow: 0 5px 14px rgba(91, 108, 255, .3); }

.subject-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 16px; }
.subject-card {
  --sc: var(--brand);
  --sb: var(--brand-soft);
  position: relative;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 20px;
  overflow: hidden;
  transition: transform .2s, box-shadow .24s, border-color .2s;
  display: block;
}
.subject-card:hover { transform: translateY(-4px); box-shadow: var(--shadow); border-color: transparent; }
.subject-card::after {
  content: "";
  position: absolute;
  width: 130px; height: 130px; right: -46px; top: -46px; border-radius: 50%;
  background: var(--sb);
}
.subject-card .s-ico {
  width: 46px; height: 46px; border-radius: 15px; background: var(--sb); color: var(--sc);
  display: grid; place-items: center; position: relative; z-index: 1;
}
.subject-card h3 { margin: 14px 0 4px; font-size: 17px; font-weight: 800; position: relative; z-index: 1; }
.subject-card p { margin: 0; color: var(--ink-3); font-size: 12.5px; position: relative; z-index: 1; }
.subject-card .s-meta {
  margin-top: 14px; display: flex; align-items: center; gap: 10px;
  font-size: 12px; color: var(--ink-3); position: relative; z-index: 1;
}
.subject-card .s-go {
  margin-left: auto; width: 30px; height: 30px; border-radius: 50%;
  display: grid; place-items: center; background: var(--sc); color: #fff;
}

.mode-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.mode-card {
  background: #fff; border: 1px solid var(--line); border-radius: var(--r-lg);
  padding: 20px; display: flex; gap: 14px; align-items: flex-start;
  transition: .2s; position: relative;
}
.mode-card:hover { transform: translateY(-3px); box-shadow: var(--shadow); }
.mode-card .m-ico {
  width: 44px; height: 44px; border-radius: 14px; display: grid; place-items: center; flex: none;
}
.mode-card h4 { margin: 2px 0 3px; font-size: 15.5px; font-weight: 800; }
.mode-card p { margin: 0; font-size: 12.5px; color: var(--ink-3); line-height: 1.5; }
.mode-card .lock { position: absolute; right: 16px; top: 16px; font-size: 11px; font-weight: 800; color: #B45309; background: #FFF4D6; padding: 2px 8px; border-radius: 999px; }

/* ============================ 游戏页 ============================ */
.game-shell { padding: 24px 0 60px; }
.game-top { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 18px; }
.game-hud { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.hud-pill {
  display: inline-flex; align-items: center; gap: 6px;
  background: #fff; border: 1px solid var(--line); border-radius: 999px;
  padding: 7px 14px; font-weight: 800; font-size: 14px;
}
.hud-pill .lbl { color: var(--ink-3); font-weight: 700; font-size: 12px; }
.hud-pill.combo { background: linear-gradient(135deg, #FFF3E6, #FFE5CC); border-color: #FFD3AE; color: #C2410C; }
.hud-pill.time { background: #EEF2FF; border-color: #D6DEFF; color: var(--brand-deep); }
.hud-pill.time.warn { background: var(--red-soft); border-color: #FFC9D4; color: var(--red); animation: pulse .8s infinite; }
.hud-pill.lives span { letter-spacing: 1px; }

.game-progress { height: 9px; background: #E9EBF7; border-radius: 999px; overflow: hidden; margin: 6px 0 22px; }
.game-progress i {
  display: block; height: 100%; width: 0%;
  background: linear-gradient(90deg, #6D7CFF, #8B5CF6, #FF8A3D);
  border-radius: 999px; transition: width .4s cubic-bezier(.4, 0, .2, 1);
}

.quiz-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 28px;
  box-shadow: var(--shadow);
  padding: 30px 32px 26px;
  max-width: 880px;
  margin: 0 auto;
  position: relative;
  animation: cardIn .34s cubic-bezier(.2, .9, .3, 1.1);
}
@keyframes cardIn { from { opacity: 0; transform: translateY(16px) scale(.985); } to { opacity: 1; transform: none; } }

.q-head { display: flex; align-items: center; gap: 10px; margin-bottom: 16px; flex-wrap: wrap; }
.q-tag {
  font-size: 12px; font-weight: 800; padding: 4px 10px; border-radius: 8px;
  background: var(--brand-soft); color: var(--brand-deep);
}
.q-tag.type { background: #F3F4FA; color: var(--ink-2); }
.q-index { margin-left: auto; font-size: 12.5px; color: var(--ink-3); font-weight: 700; }
.q-stem { font-size: 21px; line-height: 1.62; font-weight: 800; letter-spacing: .1px; margin: 4px 0 22px; }
.q-stem .hl { color: var(--brand-deep); }

.options { display: grid; gap: 12px; }
.options.two { grid-template-columns: 1fr 1fr; }
.opt {
  display: flex; align-items: center; gap: 13px;
  padding: 15px 18px;
  border-radius: 16px;
  border: 2px solid var(--line);
  background: #FCFCFF;
  cursor: pointer;
  text-align: left;
  width: 100%;
  font-size: 16px;
  font-weight: 700;
  color: var(--ink);
  transition: border-color .16s, background .16s, transform .12s, box-shadow .16s;
  position: relative;
}
.opt:hover:not(.locked) { border-color: #C3CBFA; background: #F8F9FF; transform: translateY(-1px); box-shadow: 0 6px 16px rgba(91, 108, 255, .09); }
.opt:active:not(.locked) { transform: scale(.995); }
.opt .key {
  width: 30px; height: 30px; border-radius: 10px; background: #EEF0FA;
  display: grid; place-items: center; font-weight: 900; font-size: 14px; color: var(--ink-2); flex: none;
  transition: .16s;
}
.opt .txt { flex: 1; }
.opt .mark { opacity: 0; transition: .2s; }
.opt.correct { border-color: #5ED68F; background: var(--green-soft); }
.opt.correct .key { background: var(--green); color: #fff; }
.opt.correct .mark { opacity: 1; color: var(--green); }
.opt.wrong { border-color: #FF9DB0; background: var(--red-soft); animation: shake .38s; }
.opt.wrong .key { background: var(--red); color: #fff; }
.opt.wrong .mark { opacity: 1; color: var(--red); }
.opt.dim { opacity: .5; }
.opt.locked { cursor: default; }

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-7px); }
  40% { transform: translateX(6px); }
  60% { transform: translateX(-4px); }
  80% { transform: translateX(3px); }
}

.q-analysis {
  margin-top: 18px;
  padding: 15px 18px;
  border-radius: 16px;
  background: #F7F8FE;
  border: 1px dashed #D8DCF2;
  display: none;
  animation: fadeUp .3s;
}
.q-analysis.show { display: block; }
.q-analysis .t { display: flex; align-items: center; gap: 7px; font-weight: 800; font-size: 13.5px; margin-bottom: 5px; }
.q-analysis p { margin: 0; font-size: 14px; color: var(--ink-2); line-height: 1.62; }

@keyframes fadeUp { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

.feedback-bar {
  margin-top: 16px; display: flex; align-items: center; gap: 10px; justify-content: space-between;
}
.fb-msg { font-weight: 800; font-size: 15px; }

/* 连击 / 飘分 */
.combo-pop {
  position: absolute; top: -18px; right: 24px;
  background: linear-gradient(135deg, #FFB25C, #FF7A2F);
  color: #fff; font-weight: 900; font-size: 15px;
  padding: 8px 16px; border-radius: 999px;
  box-shadow: 0 10px 24px rgba(255, 122, 47, .38);
  animation: comboIn .5s cubic-bezier(.2, 1.4, .4, 1);
  pointer-events: none;
}
@keyframes comboIn {
  0% { transform: scale(.4) rotate(-8deg); opacity: 0; }
  60% { transform: scale(1.1) rotate(2deg); opacity: 1; }
  100% { transform: scale(1) rotate(0); opacity: 1; }
}
.float-points {
  position: fixed; z-index: 300; pointer-events: none;
  font-weight: 900; font-size: 26px; color: var(--green);
  text-shadow: 0 4px 14px rgba(34, 197, 94, .35);
  animation: floatUp 1s ease-out forwards;
}
@keyframes floatUp {
  0% { transform: translateY(0) scale(.8); opacity: 0; }
  25% { transform: translateY(-16px) scale(1.15); opacity: 1; }
  100% { transform: translateY(-72px) scale(1); opacity: 0; }
}

/* ============================ 结算弹层 ============================ */
.overlay {
  position: fixed; inset: 0; z-index: 200;
  background: rgba(24, 27, 48, .5);
  backdrop-filter: blur(6px);
  display: none; align-items: center; justify-content: center;
  padding: 20px;
}
.overlay.show { display: flex; animation: fadeIn .24s; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.result-card {
  width: min(560px, 100%);
  background: #fff; border-radius: 30px;
  padding: 32px 30px 26px;
  box-shadow: 0 30px 80px rgba(20, 24, 48, .3);
  text-align: center; position: relative;
  animation: popIn .42s cubic-bezier(.2, 1.3, .4, 1);
  max-height: 92vh; overflow: auto;
}
@keyframes popIn { from { opacity: 0; transform: scale(.86) translateY(20px); } to { opacity: 1; transform: none; } }
.result-card h2 { margin: 7px 0 4px; font-size: 25px; font-weight: 900; letter-spacing: -.3px; }
.result-card .sub { color: var(--ink-3); font-size: 14px; margin: 0 0 18px; }
.result-emoji {
  width: 78px; height: 78px; margin: 0 auto;
  border-radius: 26px; display: grid; place-items: center;
  background: linear-gradient(135deg, #FFF4D6, #FFE3A8);
  animation: floaty 3.4s ease-in-out infinite;
}
.stars { display: flex; justify-content: center; gap: 8px; margin: 6px 0 16px; }
.stars svg { opacity: .18; transform: scale(.85); transition: .3s; }
.stars svg.on { opacity: 1; transform: scale(1); animation: starPop .45s cubic-bezier(.2, 1.5, .4, 1); }
.stars svg:nth-child(2) { transition-delay: .14s; }
.stars svg:nth-child(3) { transition-delay: .28s; }
@keyframes starPop { 0% { transform: scale(.3) rotate(-30deg); } 70% { transform: scale(1.25) rotate(6deg); } 100% { transform: scale(1); } }

.result-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 18px 0 6px; }
.rs-item { background: #F8F9FE; border-radius: 16px; padding: 13px 8px; }
.rs-item b { display: block; font-size: 20px; font-weight: 900; }
.rs-item span { font-size: 11.5px; color: var(--ink-3); font-weight: 700; }
.result-points {
  margin: 16px 0 4px; padding: 14px; border-radius: 18px;
  background: linear-gradient(135deg, #FFF9E8, #FFF0C9);
  border: 1px solid #FFE29A;
  font-weight: 800; color: #9A6B00;
  display: flex; align-items: center; justify-content: center; gap: 8px;
}
.result-actions { display: flex; gap: 10px; margin-top: 20px; }
.result-actions .btn { flex: 1; }
.badge-toast {
  margin-top: 16px; display: flex; align-items: center; gap: 10px;
  background: linear-gradient(120deg, #F5F0FF, #EDE6FF);
  border-radius: 14px; padding: 10px 14px; text-align: left;
  border: 1px solid #E0D6FF;
}
.badge-toast b { display: block; font-size: 13.5px; }
.badge-toast span { font-size: 11.5px; color: var(--ink-3); }

#confetti { position: fixed; inset: 0; pointer-events: none; z-index: 250; }

/* ============================ 首页其他 ============================ */
.feature-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.feature {
  background: #fff; border: 1px solid var(--line); border-radius: var(--r);
  padding: 22px; box-shadow: var(--shadow-sm);
}
.feature .f-ico {
  width: 44px; height: 44px; border-radius: 14px; display: grid; place-items: center;
  background: var(--brand-soft); color: var(--brand); margin-bottom: 12px;
}
.feature h4 { margin: 0 0 6px; font-size: 15.5px; font-weight: 800; }
.feature p { margin: 0; font-size: 13.5px; color: var(--ink-2); line-height: 1.6; }

.rank-list { display: grid; gap: 2px; }
.rank-row {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 12px; border-radius: 14px; transition: .16s;
}
.rank-row:hover { background: #F8F9FE; }
.rank-no {
  width: 26px; height: 26px; border-radius: 9px; display: grid; place-items: center;
  font-weight: 900; font-size: 13px; background: #F1F3FA; color: var(--ink-2); flex: none;
}
.rank-row.top1 .rank-no { background: linear-gradient(135deg, #FFD770, #FFB020); color: #fff; }
.rank-row.top2 .rank-no { background: linear-gradient(135deg, #D8DEF0, #AAB4D4); color: #fff; }
.rank-row.top3 .rank-no { background: linear-gradient(135deg, #FFC9A3, #F09A62); color: #fff; }
.rank-row .nm { font-weight: 700; font-size: 14px; }
.rank-row .gr { font-size: 11.5px; color: var(--ink-3); }
.rank-row .pt { margin-left: auto; font-weight: 900; color: var(--brand-deep); font-size: 14.5px; }

.cta-band {
  margin: 44px 0 10px;
  border-radius: 28px;
  padding: 34px 38px;
  background: linear-gradient(120deg, #3E47A8, #5B6CFF 45%, #8B5CF6);
  color: #fff;
  display: flex; align-items: center; justify-content: space-between; gap: 22px;
  box-shadow: 0 20px 50px rgba(63, 74, 190, .28);
  position: relative; overflow: hidden;
}
.cta-band::after {
  content: ""; position: absolute; width: 340px; height: 340px; right: -90px; top: -140px;
  border-radius: 50%; background: rgba(255, 255, 255, .12);
}
.cta-band h3 { margin: 0 0 6px; font-size: 24px; font-weight: 900; }
.cta-band p { margin: 0; opacity: .85; font-size: 14px; }

/* ============================ 表单 / 登录 ============================ */
.auth-wrap { min-height: calc(100vh - 68px); display: grid; place-items: center; padding: 40px 20px; }
.auth-card {
  width: min(430px, 100%); background: #fff; border: 1px solid var(--line);
  border-radius: 28px; padding: 34px 32px; box-shadow: var(--shadow);
}
.auth-card h1 { margin: 0 0 6px; font-size: 24px; font-weight: 900; }
.auth-card .sub { color: var(--ink-3); font-size: 13.5px; margin: 0 0 24px; }
.field { margin-bottom: 15px; }
.field label { display: block; font-size: 13px; font-weight: 700; color: var(--ink-2); margin-bottom: 6px; }
.input, .select, .textarea {
  width: 100%; padding: 12px 14px; border-radius: 13px;
  border: 1.5px solid var(--line); background: #FBFBFF; color: var(--ink);
  transition: .16s; outline: none; font-size: 15px;
}
.input:focus, .select:focus, .textarea:focus { border-color: #A9B3F8; background: #fff; box-shadow: 0 0 0 4px rgba(91, 108, 255, .1); }
.textarea { min-height: 90px; resize: vertical; line-height: 1.6; }
.form-tip { font-size: 12px; color: var(--ink-3); margin-top: 5px; }
.form-error {
  background: var(--red-soft); color: #B4123B; border-radius: 12px;
  padding: 10px 14px; font-size: 13.5px; font-weight: 600; margin-bottom: 14px;
}
.form-ok { background: var(--green-soft); color: #0E7C3E; border-radius: 12px; padding: 10px 14px; font-size: 13.5px; font-weight: 600; margin-bottom: 14px; }

.seg { display: flex; gap: 8px; }
.seg label { flex: 1; }
.seg input { position: absolute; opacity: 0; }
.seg span {
  display: block; text-align: center; padding: 10px 0; border-radius: 12px;
  border: 1.5px solid var(--line); font-weight: 700; font-size: 14px; cursor: pointer; transition: .16s;
  background: #FBFBFF;
}
.seg input:checked + span { border-color: var(--brand); background: var(--brand-soft); color: var(--brand-deep); box-shadow: 0 0 0 3px rgba(91, 108, 255, .09); }

/* ============================ 表格 ============================ */
.table-wrap { overflow-x: auto; border-radius: 16px; border: 1px solid var(--line); background: #fff; }
table.table { width: 100%; border-collapse: collapse; font-size: 13.5px; min-width: 640px; }
table.table th {
  text-align: left; padding: 12px 14px; background: #F8F9FE; color: var(--ink-2);
  font-weight: 800; font-size: 12.5px; white-space: nowrap; border-bottom: 1px solid var(--line);
}
table.table td { padding: 12px 14px; border-bottom: 1px solid #F1F3FA; vertical-align: middle; }
table.table tr:last-child td { border-bottom: none; }
table.table tbody tr:hover { background: #FBFBFF; }
.score-pill { display: inline-flex; align-items: center; gap: 4px; font-weight: 900; }
.score-pill.hi { color: var(--green); }
.score-pill.mid { color: var(--orange); }
.score-pill.low { color: var(--red); }
.tag { display: inline-block; padding: 2px 9px; border-radius: 7px; font-size: 11.5px; font-weight: 800; background: #F1F3FA; color: var(--ink-2); }
.tag.blue { background: var(--brand-soft); color: var(--brand-deep); }
.tag.green { background: var(--green-soft); color: #0E7C3E; }
.tag.orange { background: var(--orange-soft); color: #B45309; }
.tag.red { background: var(--red-soft); color: #B4123B; }
.tag.dark { background: #2B2F55; color: #FFD98A; }

/* ============================ 勋章 ============================ */
.badge-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.badge-item {
  border: 1px solid var(--line); border-radius: 18px; padding: 16px 12px; text-align: center;
  background: #fff; transition: .2s;
}
.badge-item:hover { transform: translateY(-2px); box-shadow: var(--shadow-sm); }
.badge-item.locked { opacity: .48; filter: grayscale(1); }
.badge-ico-lg {
  width: 48px; height: 48px; margin: 0 auto 8px; border-radius: 16px;
  display: grid; place-items: center;
  background: linear-gradient(135deg, #FFF6DC, #FFE7AF); color: #B4790B;
}
.badge-item b { display: block; font-size: 13.5px; }
.badge-item span { font-size: 11.5px; color: var(--ink-3); }

/* ============================ 会员 ============================ */
.plan-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 18px; }
.plan-card {
  border: 2px solid var(--line); border-radius: 26px; padding: 26px; background: #fff;
  position: relative; transition: .2s;
}
.plan-card.best { border-color: #FFD98A; background: linear-gradient(180deg, #FFFCF3, #fff 40%); }
.plan-card .tag-best {
  position: absolute; top: -12px; right: 22px; background: linear-gradient(135deg, #FFC53D, #FF9F1C);
  color: #fff; font-size: 12px; font-weight: 900; padding: 4px 12px; border-radius: 999px;
  box-shadow: 0 6px 16px rgba(255, 159, 28, .32);
}
.plan-card h3 { margin: 0 0 4px; font-size: 19px; font-weight: 900; }
.plan-price { font-size: 34px; font-weight: 900; letter-spacing: -1px; margin: 10px 0 2px; }
.plan-price small { font-size: 15px; font-weight: 700; color: var(--ink-3); }
.plan-per { font-size: 12.5px; color: var(--ink-3); }
.plan-list { list-style: none; padding: 0; margin: 18px 0 22px; display: grid; gap: 9px; }
.plan-list li { display: flex; gap: 8px; align-items: flex-start; font-size: 13.5px; color: var(--ink-2); }
.plan-list li svg { color: var(--green); margin-top: 2px; flex: none; }

/* ============================ 底栏 ============================ */
.footer { border-top: 1px solid var(--line); margin-top: 60px; padding: 28px 0 40px; color: var(--ink-3); font-size: 13px; }
.footer-inner { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }

/* ============================ 移动端 ============================ */
.mobile-nav { display: none; }

@media (max-width: 900px) {
  .hero-grid { grid-template-columns: 1fr; }
  .hero-art { display: none; }
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
  .mode-grid { grid-template-columns: 1fr; }
  .feature-grid { grid-template-columns: 1fr; }
  .plan-grid { grid-template-columns: 1fr; }
  .nav { display: none; }
  .topbar-inner { height: 60px; gap: 12px; }
  .brand small { display: none; }
  .container { width: calc(100% - 28px); }
  .quiz-card { padding: 22px 18px; border-radius: 22px; }
  .q-stem { font-size: 18px; }
  .opt { font-size: 15px; padding: 13px 14px; }
  .options.two { grid-template-columns: 1fr; }
  .result-stats { grid-template-columns: repeat(3, 1fr); }
  .cta-band { flex-direction: column; align-items: flex-start; padding: 26px; }
  body { padding-bottom: 68px; }
  .mobile-nav {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 80;
    display: flex; background: rgba(255, 255, 255, .96);
    border-top: 1px solid var(--line); backdrop-filter: blur(12px);
    padding: 7px 4px calc(7px + env(safe-area-inset-bottom));
  }
  .mobile-nav a {
    flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px;
    font-size: 10.5px; color: var(--ink-3); font-weight: 700; padding: 4px 0;
  }
  .mobile-nav a.active { color: var(--brand); }
  .mobile-nav a .ico { width: 21px; height: 21px; }
  .footer { margin-top: 30px; }
}

@media (max-width: 560px) {
  .user-chip .uname { display: none; }
  .points-pill { padding: 5px 10px; font-size: 13px; }
  .game-top { flex-direction: column; align-items: flex-start; }
  .hud-pill { font-size: 13px; padding: 6px 11px; }
  .result-actions { flex-direction: column; }
  .stars svg { width: 42px; height: 42px; }
}

/* 动效偏好 */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

/* ============================ 补充：两栏布局与结算适配 ============================ */
@media (max-width: 900px) {
  .dash-grid { grid-template-columns: 1fr !important; }
}
@media (max-width: 560px) {
  .result-stats { grid-template-columns: repeat(2, 1fr) !important; }
  .rs-item b { font-size: 18px; }
  .result-card { padding: 24px 18px 20px; }
  .result-emoji { width: 64px; height: 64px; border-radius: 22px; }
}

/* ============================ 退出登录入口 ============================ */
.logout-btn {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 8px 12px; border-radius: 12px; white-space: nowrap;
  color: var(--ink-3); font-size: 13px; font-weight: 700;
  border: 1px solid var(--line); background: #fff; transition: .18s;
}
.logout-btn:hover, .logout-btn:active { color: var(--red); border-color: #FFC9D2; background: var(--red-soft); }
.logout-btn .ico { width: 16px; height: 16px; }

/* 管理员专用：进入后台入口（仅 role=1 显示） */
.admin-entry {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 8px 12px; border-radius: 12px; white-space: nowrap;
  color: var(--brand-deep); font-size: 13px; font-weight: 800;
  border: 1px solid #D9DEFF; background: var(--brand-soft, #EEF0FF); transition: .18s;
}
.admin-entry:hover, .admin-entry:active { background: #E3E7FF; border-color: #C3CBFF; }
.admin-entry .ico { width: 16px; height: 16px; }

/* ============================ H5 全站适配（安卓 / 苹果 / 平板） ============================ */
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body { min-height: 100vh; min-height: 100dvh; }
a, button, .opt, label, .subject-card, .mode-card, .plan-card { -webkit-tap-highlight-color: transparent; }
button, .btn, .opt, .nav a, .mobile-nav a, .user-chip { touch-action: manipulation; }
.ico { max-width: 100%; }

/* 触屏设备：按钮与选项统一放大触摸热区 */
@media (hover: none) and (pointer: coarse) {
  .btn { min-height: 44px; }
  .btn-sm { min-height: 38px; }
  .opt { min-height: 58px; }
  .input, .textarea, .select { min-height: 44px; }
  .opt:hover:not(.locked) { transform: none; box-shadow: none; }
  .subject-card:hover, .mode-card:hover { transform: none; }
}

@media (max-width: 900px) {
  /* iOS 输入框字号小于 16px 会被自动放大 */
  input, textarea, select, .input, .textarea, .select { font-size: 16px; }
  .quiz-card { max-width: 100%; }
  .hero { padding: 28px 0 4px; }
  .hero h1 { font-size: 34px; }
  .hero p.lead { font-size: 15.5px; margin-bottom: 20px; }
  .hero-trust { gap: 16px; margin-top: 22px; }
  .hero-trust b { font-size: 19px; }
  .section-head { flex-direction: column; align-items: flex-start; gap: 10px; }
  .section-head h2 { font-size: 21px; }
  .table-wrap, .adm-table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .table { min-width: 560px; }
  .card { padding: 18px 16px; border-radius: 18px; }
  .game-top { gap: 10px; margin-bottom: 12px; }
  .game-hud { gap: 8px; }
  .q-stem { line-height: 1.55; }
  .options { gap: 10px; }
  .result-card { max-height: calc(100dvh - 32px); overflow-y: auto; -webkit-overflow-scrolling: touch; }
  .topbar-inner { padding-left: env(safe-area-inset-left); padding-right: env(safe-area-inset-right); }
  .footer { padding-bottom: calc(34px + env(safe-area-inset-bottom)); }
  .logout-txt { display: none; }
  .logout-btn { padding: 9px 10px; }
  .admin-entry-txt { display: none; }
  .admin-entry { padding: 9px 10px; }
  .grade-switch { width: 100%; }
  .grade-switch a { flex: 1; text-align: center; }
}

/* 平板（iPad 竖屏 / 安卓平板）：两栏更饱满 */
@media (min-width: 561px) and (max-width: 1024px) {
  .container { width: calc(100% - 40px); }
  .hero h1 { font-size: 40px; }
  .hero-art { height: 330px; }
  .game-shell { padding: 18px 0 40px; }
  .quiz-card { padding: 24px 22px; }
  .q-stem { font-size: 20px; }
  .opt { font-size: 16px; padding: 15px 16px; }
  .feature-grid { grid-template-columns: 1fr 1fr; }
  .dash-grid { grid-template-columns: 1fr; }
}

/* 手机横屏：压缩纵向留白，保证题目和选项同屏 */
@media (max-height: 540px) and (orientation: landscape) {
  .hero { padding: 16px 0 4px; }
  .hero h1 { font-size: 30px; }
  .hero-art { display: none; }
  .hero p.lead { margin-bottom: 14px; }
  .hero-trust { margin-top: 12px; }
  .game-shell { padding: 12px 0 28px; }
  .quiz-card { padding: 16px 18px; }
  .q-stem { font-size: 17px; }
  .opt { min-height: 46px; padding: 10px 14px; }
  .mobile-nav { padding-top: 4px; }
}

@media (max-width: 560px) {
  .hero h1 { font-size: 29px; }
  .hero-trust { gap: 14px; }
  .topbar-inner { height: 56px; gap: 8px; }
  .brand { font-size: 16px; gap: 8px; }
  .brand-mark { width: 34px; height: 34px; border-radius: 11px; font-size: 17px; }
  .topbar-right { gap: 6px; }
  .points-pill { padding: 5px 9px; }
  .quiz-card { padding: 18px 14px; border-radius: 20px; }
  .q-stem { font-size: 17px; }
  .opt { font-size: 15px; padding: 12px; }
  .result-actions .btn { width: 100%; }
  .plan-price { font-size: 26px; }
  .card-title { flex-wrap: wrap; gap: 8px; }
}

@media (max-width: 380px) {
  .hero h1 { font-size: 25px; }
  .brand > span:last-child { font-size: 15px; }
  .points-pill { padding: 4px 7px; font-size: 12px; }
  .avatar { width: 30px; height: 30px; font-size: 13px; }
  .mobile-nav a { font-size: 10px; }
  .hud-pill { font-size: 12px; padding: 5px 9px; }
}

/* ============================ 顶栏窄屏防溢出 ============================ */
@media (max-width: 560px) {
  .topbar-inner { gap: 8px; }
  .brand { min-width: 0; }
  .brand > span:last-child {
    min-width: 0; max-width: 96px; overflow: hidden;
    text-overflow: ellipsis; white-space: nowrap;
  }
  .topbar-right { flex: none; margin-left: auto; gap: 6px; }
  .points-pill { padding: 4px 8px; }
  .table { min-width: 480px; }
}
@media (max-width: 420px) {
  .brand > span:last-child { display: none; }
  .topbar-inner { gap: 6px; }
}

/* ============================ 窄屏卡片可收缩（防止表格撑破布局） ============================ */
@media (max-width: 900px) {
  .dash-grid > *, .card, .table-wrap, .adm-table-wrap { min-width: 0; }
  .profile-grid > *, .two-col > *, .grid-2 > * { min-width: 0; }
}

/* ============================ 学科头卡（手机上统计换行） ============================ */
@media (max-width: 700px) {
  .subject-hero { flex-wrap: wrap; }
  .subject-hero > .grow { flex: 1 1 calc(100% - 78px); min-width: 0; }
  .subject-hero > .grow h1 { font-size: 20px; }
  .subject-hero .hero-stats { width: 100%; margin-left: 78px; justify-content: flex-start; gap: 28px; }
  .subject-hero .hero-stats b { font-size: 18px; }
}
