/* =========================================================
   重力场研习室 —— 全站样式（手机优先 · 轻松沉浸版）
   设计思路：
   - 背景：天空蓝渐变 + 两团柔光色斑，呼应"大气与重力场"主题，
     低饱和不抢戏，长时间阅读不累
   - 文字：深蓝灰主色 + 加大行距 + 标题层级分明，重点一眼可辨
   - 组件：圆角卡片、柔和投影、毛玻璃底栏，交互有呼吸感
   ========================================================= */
* { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  font-family: -apple-system, 'PingFang SC', 'HarmonyOS Sans SC', 'Microsoft YaHei', sans-serif;
  background: linear-gradient(180deg, #e8effa 0%, #f4f7fb 45%, #eef0f7 100%);
  background-attachment: fixed; /* 渐变跟随视口，滚动时背景稳定不闪 */
  color: #3a4358;
  font-size: 16px;
  line-height: 1.75;
  padding-bottom: 76px; /* 给底部导航留空间 */
  -webkit-font-smoothing: antialiased;
}

/* 背景装饰：两团大而柔的色斑（纯装饰，不参与交互） */
body::before {
  content: '';
  position: fixed;
  z-index: -1;
  top: -120px; right: -100px;
  width: 340px; height: 340px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(46, 90, 172, 0.10) 0%, rgba(46, 90, 172, 0) 70%);
  pointer-events: none;
}
body::after {
  content: '';
  position: fixed;
  z-index: -1;
  bottom: 60px; left: -120px;
  width: 380px; height: 380px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(56, 152, 176, 0.09) 0%, rgba(56, 152, 176, 0) 70%);
  pointer-events: none;
}

/* 顶部横幅：深空蓝渐变，缀柔光圆斑，营造"仰望星空"的沉浸感 */
.hero {
  position: relative;
  overflow: hidden;
  background: linear-gradient(150deg, #2c5aa8 0%, #1e3f7e 55%, #16325f 100%);
  color: #fff;
  padding: 38px 20px 30px;
}
/* 横幅上的装饰光斑 */
.hero::before {
  content: '';
  position: absolute;
  top: -60px; right: -50px;
  width: 200px; height: 200px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.07);
}
.hero::after {
  content: '';
  position: absolute;
  bottom: -80px; left: 30%;
  width: 180px; height: 180px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.05);
}
.hero h1 {
  position: relative; /* 让文字浮在光斑之上 */
  font-size: 26px;
  letter-spacing: 3px;
  font-weight: 700;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.18);
}
.hero p {
  position: relative;
  margin-top: 10px;
  font-size: 14px;
  letter-spacing: 1px;
  opacity: 0.82;
}

/* 主容器 */
.container { max-width: 640px; margin: 0 auto; padding: 18px 16px; }

/* 卡片：白色浮起的"学习纸片"，圆角更大、投影更柔 */
.card {
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid rgba(255, 255, 255, 0.7);
  border-radius: 16px;
  padding: 20px 18px;
  margin-bottom: 16px;
  box-shadow: 0 4px 18px rgba(46, 90, 172, 0.08);
  animation: riseIn 0.45s ease both; /* 轻量入场动画 */
}
@keyframes riseIn {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* 文字层级 */
.card h2 {
  font-size: 18px;
  margin-bottom: 8px;
  color: #1f2d4d;
  font-weight: 700;
  letter-spacing: 0.5px;
}
.card .muted { color: #8a94a8; font-size: 13px; line-height: 1.7; }
b, strong { color: #1f2d4d; }

/* 章节标签 */
.tag {
  display: inline-block;
  font-size: 12px;
  color: #2E5AAC;
  background: rgba(46, 90, 172, 0.08);
  border-radius: 999px;
  padding: 3px 12px;
  margin-top: 8px;
}
.tag-warn { color: #b27b16; background: rgba(178, 123, 22, 0.10); }

/* 按钮：圆润胶囊形，带过渡与按压反馈 */
.btn {
  display: inline-block;
  border: none;
  border-radius: 999px;
  padding: 11px 24px;
  font-size: 15px;
  cursor: pointer;
  text-align: center;
  text-decoration: none;
  transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}
.btn:active { transform: scale(0.97); }
.btn-primary {
  background: linear-gradient(135deg, #2E5AAC 0%, #27509b 100%);
  color: #fff;
  box-shadow: 0 3px 10px rgba(46, 90, 172, 0.28);
}
.btn-primary:hover { box-shadow: 0 5px 14px rgba(46, 90, 172, 0.36); }
.btn-ghost { background: rgba(46, 90, 172, 0.08); color: #2E5AAC; }
.btn-ghost:hover { background: rgba(46, 90, 172, 0.13); }
.btn-block { display: block; width: 100%; }

/* 底部导航栏：毛玻璃质感，浮在内容之上 */
.tabbar {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  max-width: 640px;
  margin: 0 auto;
  background: rgba(255, 255, 255, 0.82);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  border-top: 1px solid rgba(46, 90, 172, 0.08);
  display: flex;
  height: 60px;
  box-shadow: 0 -4px 16px rgba(46, 90, 172, 0.06);
}
.tabbar a {
  position: relative;
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  color: #98a0b3;
  font-size: 14px;
  letter-spacing: 1px;
  transition: color 0.2s ease;
}
.tabbar a.active { color: #2E5AAC; font-weight: bold; }
.tabbar a.active::after {
  content: '';
  position: absolute;
  bottom: 7px; left: 50%;
  transform: translateX(-50%);
  width: 18px; height: 3px;
  border-radius: 2px;
  background: #2E5AAC;
}

/* 答题页 */
.question-stem {
  font-size: 16px;
  margin: 10px 0 18px;
  line-height: 1.8;
  color: #2c3550;
}
.option-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  background: rgba(46, 90, 172, 0.045);
  border: 2px solid transparent;
  border-radius: 12px;
  padding: 13px 14px;
  margin-bottom: 10px;
  cursor: pointer;
  font-size: 15px;
  line-height: 1.7;
  transition: background 0.15s ease, border-color 0.15s ease, transform 0.15s ease;
}
.option-item:active { transform: scale(0.99); }
.option-item.selected { border-color: #2E5AAC; background: rgba(46, 90, 172, 0.09); }
.option-item.correct { border-color: #2e9e5b; background: #eaf7ef; }
.option-item.wrong { border-color: #d64541; background: #fdeaea; }
.option-key { font-weight: bold; color: #2E5AAC; }

/* 判分结果 */
.result-box {
  border-radius: 12px;
  padding: 15px;
  margin-top: 14px;
  font-size: 14px;
  line-height: 1.8;
  animation: riseIn 0.35s ease both;
}
.result-correct { background: #eaf7ef; color: #2e7d4f; }
.result-wrong { background: #fdeaea; color: #c0392b; }
.result-correct b, .result-wrong b { color: inherit; }
.analysis { margin-top: 10px; color: #55617a; }

/* 表单 */
input[type=text], input[type=password] {
  width: 100%;
  padding: 13px 14px;
  border: 1.5px solid #dbe2ee;
  border-radius: 12px;
  font-size: 15px;
  margin-bottom: 12px;
  background: #fff;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
input[type=text]:focus, input[type=password]:focus {
  outline: none;
  border-color: #2E5AAC;
  box-shadow: 0 0 0 3px rgba(46, 90, 172, 0.12);
}
label { font-size: 14px; color: #6a7488; display: block; margin-bottom: 6px; }

/* 提示条 */
.notice {
  background: rgba(46, 90, 172, 0.07);
  border: 1px dashed rgba(46, 90, 172, 0.25);
  border-radius: 12px;
  padding: 11px 15px;
  font-size: 13px;
  color: #2E5AAC;
  margin-bottom: 16px;
  line-height: 1.7;
}

/* 题目配图（SVG 示意图） */
.question-img {
  display: block;
  width: 100%;
  max-width: 360px;
  margin: 10px auto 4px;
  background: #fff;
  border: 1px solid #E3E8F0;
  border-radius: 12px;
  padding: 8px;
  box-sizing: border-box;
}

/* 教师端数据数字 */
.stat-num {
  font-size: 28px;
  color: #2E5AAC;
  font-weight: bold;
  letter-spacing: 1px;
}

/* 选中文字的颜色（小细节，全局统一） */
::selection { background: rgba(46, 90, 172, 0.18); }

/* =========================================================
   背景模式（在"我的"页面选择，默认经典纯色）
   ========================================================= */
/* 模式一：经典纯色（默认）——原来的淡蓝纯色 */
body.bg-solid {
  background: #f5f6fa;
  background-attachment: scroll;
}
body.bg-solid::before, body.bg-solid::after { display: none; } /* 纯色模式不带柔光色斑 */

/* 模式二：沉浸渐变——天空蓝渐变 + 柔光色斑（即美化版的默认效果） */
body.bg-gradient { /* 用 body 默认的渐变与色斑，无需额外定义 */ }

/* 模式三：自定义图片 —— 用户选择的本地图片铺满全屏 */
body.bg-image {
  background-image: linear-gradient(rgba(245, 247, 251, 0.88), rgba(245, 247, 251, 0.88)), var(--bg-img);
  background-size: cover;
  background-position: center;
  background-attachment: fixed;
}
/* 图片模式：柔光色斑换成整层白雾罩，保证卡片上的文字始终可读 */
body.bg-image::before {
  display: none;
}
body.bg-image::after {
  display: none;
}

/* =========================================================
   排行榜页
   ========================================================= */
.rank-top3 { display: flex; gap: 8px; margin-bottom: 16px; }
.rank-top3 .podium {
  flex: 1;
  text-align: center;
  background: rgba(255, 255, 255, 0.92);
  border-radius: 14px;
  padding: 14px 6px 12px;
  box-shadow: 0 4px 14px rgba(46, 90, 172, 0.10);
}
.rank-top3 .podium .medal { font-size: 26px; }
.rank-top3 .podium .name { font-size: 14px; font-weight: bold; color: #1f2d4d; margin-top: 4px; }
.rank-top3 .podium .pts { font-size: 13px; color: #b27b16; font-weight: bold; }

.rank-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 6px;
  border-bottom: 1px dashed #e3e8f0;
}
.rank-row:last-child { border-bottom: none; }
.rank-row .no {
  width: 34px;
  text-align: center;
  font-weight: bold;
  color: #8a94a8;
  font-size: 15px;
  flex-shrink: 0;
}
.rank-row .who { flex: 1; min-width: 0; }
.rank-row .who .rname { font-size: 15px; font-weight: bold; color: #1f2d4d; }
.rank-row .who .rinfo { font-size: 12px; color: #8a94a8; margin-top: 2px; }
.rank-row .rpts { font-size: 16px; font-weight: bold; color: #b27b16; flex-shrink: 0; }
.rank-row.me {
  background: rgba(46, 90, 172, 0.07);
  border-radius: 12px;
  border-bottom: none;
  padding-left: 10px;
  padding-right: 10px;
}
.rank-row.me .no { color: #2E5AAC; }
