/* =========================================================
   数学乐园 · 先易后难三阶徽章 & 9 大互动网页小游戏样式
   ========================================================= */

/* 1. 答题进度栏里的三阶难度徽章 (.tier-pill) */
.progress .tier-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.02em;
  white-space: nowrap;
  border: 2px solid rgba(43, 196, 138, 0.35);
  background: #e9fbf3;
  color: #157a54;
  box-shadow: 0 2px 0 rgba(21, 122, 84, 0.1);
}
.progress .tier-pill[data-tier="2"] {
  background: #eaf4ff;
  border-color: rgba(56, 139, 253, 0.38);
  color: #175cd3;
}
.progress .tier-pill[data-tier="3"] {
  background: #fff3e6;
  border-color: rgba(245, 130, 32, 0.45);
  color: #b95000;
}
.progress .tier-pill[data-adapted="1"] {
  background: #f3eeff;
  border-color: rgba(124, 77, 255, 0.4);
  color: #5b2ecc;
}

/* 2. 游戏介绍页「互动小游戏」卡片 & 首页章节面板直达卡 */
.in-card.in-mini {
  background: linear-gradient(135deg, #fff9e6 0%, #fff1cc 100%);
  border: 2px solid #ffd166;
}

.mg-chap-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 12px;
  padding: 12px 16px;
  border-radius: 18px;
  background: linear-gradient(135deg, #fff9e8 0%, #ffefc2 100%);
  border: 2px solid #f7c95c;
  box-shadow: 0 4px 12px rgba(245, 158, 11, 0.12);
}
.mg-chap-info {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}
.mg-chap-emo {
  font-size: 32px;
  line-height: 1;
  flex-shrink: 0;
}
.mg-chap-title {
  font-weight: 900;
  font-size: 16px;
  color: #7c3a00;
}
.mg-chap-desc {
  font-size: 13px;
  color: #8c541d;
  margin-top: 2px;
}

/* 3. 通用小游戏外壳 (.mg-shell) */
.mg-shell {
  padding: 20px;
  border-radius: 24px;
  background: #ffffff;
  border: 3px solid #f0e6d2;
  box-shadow: 0 8px 24px rgba(56, 40, 18, 0.08);
}
.mg-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding-bottom: 14px;
  border-bottom: 2px dashed #eee4d3;
}
.mg-title-wrap {
  display: flex;
  align-items: center;
  gap: 12px;
}
.mg-emo {
  font-size: 40px;
  line-height: 1;
}
.mg-title {
  margin: 0;
  font-size: 22px;
  font-weight: 900;
  color: #2c2218;
}
.mg-sub {
  margin: 3px 0 0;
  font-size: 14px;
  color: #6b5b4b;
}

.mg-stages {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.mg-stage-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: 999px;
  border: 2px solid #e2d8c5;
  background: #faf6ef;
  color: #5c4d3c;
  font-size: 14px;
  font-weight: 800;
  cursor: pointer;
  transition: transform 0.15s ease, background-color 0.15s ease, border-color 0.15s ease;
}
.mg-stage-pill:hover {
  transform: translateY(-1px);
  border-color: #f4b740;
}
.mg-stage-pill.active {
  background: #fff3cd;
  border-color: #f59e0b;
  color: #92400e;
  box-shadow: 0 3px 0 rgba(245, 158, 11, 0.25);
}
.mg-stage-pill.done {
  background: #e7f9f0;
  border-color: #34d399;
  color: #065f46;
}
.mg-st-check {
  font-weight: 900;
  color: #10b981;
}

.mg-prompt-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 14px 0;
  padding: 12px 16px;
  border-radius: 16px;
  background: #f5f9ff;
  border: 2px solid #d4e4ff;
  font-size: 16px;
  color: #1e3a5f;
}
.mg-board {
  min-height: 220px;
  padding: 16px;
  border-radius: 20px;
  background: #fdfbf7;
  border: 2px solid #efe7d8;
}

/* 过关横幅与通关总结卡 */
.mg-win-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 16px;
  padding: 14px 18px;
  border-radius: 18px;
  background: linear-gradient(135deg, #e6faef 0%, #d1f4e0 100%);
  border: 2px solid #34d399;
}
.mg-win-msg {
  font-size: 16px;
  font-weight: 800;
  color: #065f46;
}
.mg-victory {
  text-align: center;
  padding: 24px 16px;
}
.mg-vic-emo {
  font-size: 56px;
  margin-bottom: 8px;
}
.mg-victory h3 {
  font-size: 22px;
  margin: 6px 0;
  color: #92400e;
}
.mg-victory p {
  font-size: 16px;
  color: #4b5563;
  margin-bottom: 18px;
}
.mg-vic-acts {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
}

/* 4. 🫧 口诀泡泡消消乐 */
.mg-bubble-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(135px, 1fr));
  gap: 12px;
}
.mg-bubble {
  min-height: 82px;
  padding: 12px;
  border-radius: 22px;
  border: 3px solid #7cc4fa;
  background: radial-gradient(circle at 30% 25%, #ffffff 0%, #e0f2fe 65%, #bae6fd 100%);
  color: #0c4a6e;
  font-size: 18px;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 5px 0 rgba(56, 189, 248, 0.35);
  transition: transform 0.15s ease, opacity 0.2s ease, border-color 0.15s ease;
}
.mg-bubble.selected {
  border-color: #f59e0b;
  background: radial-gradient(circle at 30% 25%, #ffffff 0%, #fef3c7 70%, #fde68a 100%);
  transform: scale(1.04);
}
.mg-bubble.popped {
  opacity: 0.28;
  transform: scale(0.92);
  border-style: dashed;
  cursor: default;
}

/* 5. 🐿️ 森林野餐分果果 & 通用印章行 */
.mg-picnic-basket,
.mg-sticks-status,
.mg-shop-tag,
.mg-frog-trail,
.mg-compass-badge {
  padding: 12px 16px;
  border-radius: 14px;
  background: #fff8e7;
  border: 2px solid #f6d58e;
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 14px;
}
.mg-plates-row,
.mg-bags-row,
.mg-beakers-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 14px;
  margin: 14px 0;
}
.mg-plate,
.mg-bag,
.mg-beaker {
  flex: 1 1 160px;
  min-height: 90px;
  padding: 14px;
  border-radius: 18px;
  background: #ffffff;
  border: 2px solid #dfd3be;
  text-align: center;
  font-size: 18px;
  font-weight: 800;
}
.mg-plate-items {
  font-size: 24px;
  margin-top: 8px;
  min-height: 32px;
}
.mg-act-row {
  display: flex;
  justify-content: center;
  margin: 14px 0;
}
.mg-eq-ask {
  font-size: 16px;
  font-weight: 800;
  color: #374151;
  margin: 12px 0 8px;
  text-align: center;
}
.mg-stamp-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
}
.mg-stamp.ok,
.mg-piece-btn.ok {
  background: #d1fae5;
  border-color: #10b981;
  color: #065f46;
}

/* 6. 🚀 星际口诀靶场 */
.mg-space-stage {
  background: linear-gradient(180deg, #0f172a 0%, #1e293b 100%);
  color: #f8fafc;
  padding: 18px;
  border-radius: 18px;
}
.mg-radar {
  padding: 10px 16px;
  border-radius: 12px;
  background: rgba(16, 185, 129, 0.18);
  border: 2px solid #34d399;
  color: #a7f3d0;
  font-size: 18px;
  text-align: center;
  margin-bottom: 16px;
}
.mg-ufo-sky {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px;
}
.mg-ufo {
  padding: 14px 20px;
  border-radius: 999px;
  border: 2px solid #60a5fa;
  background: rgba(30, 58, 138, 0.75);
  color: #ffffff;
  font-size: 18px;
  font-weight: 800;
  cursor: pointer;
}
.mg-ufo.hit {
  background: #059669;
  border-color: #6ee7b7;
}

/* 7. 🧩 七巧板光影工坊 */
.mg-shadow-canvas {
  padding: 16px;
  border-radius: 16px;
  background: #27272a;
  color: #fafafa;
  margin-bottom: 14px;
}
.mg-shadow-title {
  font-weight: 800;
  margin-bottom: 10px;
}
.mg-shadow-slots {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}
.mg-slot {
  flex: 1 1 140px;
  padding: 12px;
  border-radius: 12px;
  border: 2px dashed #a1a1aa;
  text-align: center;
  font-weight: 700;
}
.mg-slot.filled {
  border-style: solid;
  border-color: #34d399;
  background: rgba(16, 185, 129, 0.2);
  color: #a7f3d0;
}
.mg-tray {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
}

/* 8. 🧭 小镇寻宝小导游 */
.mg-town-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  max-width: 360px;
  margin: 0 auto 14px;
}
.mg-town-cell {
  min-height: 76px;
  padding: 8px;
  border-radius: 14px;
  background: #f0fdf4;
  border: 2px solid #bbf7d0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  font-weight: 700;
}
.mg-town-cell.is-target {
  border-color: #f59e0b;
  background: #fffbeb;
}
.mg-town-cell.is-bear {
  border-color: #2563eb;
  background: #dbeafe;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.2);
}
.mg-cell-bear {
  margin-top: 4px;
  font-size: 14px;
  font-weight: 900;
  color: #1d4ed8;
}
.mg-dpad {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}
.mg-dpad-mid {
  display: flex;
  gap: 8px;
}

/* 9. 🐸 三位数跳跳石过河 */
.mg-river-pads {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px;
  padding: 18px;
  border-radius: 18px;
  background: linear-gradient(180deg, #e0f2fe 0%, #bae6fd 100%);
}
.mg-pad {
  padding: 16px 20px;
  border-radius: 999px;
  border: 3px solid #16a34a;
  background: #dcfce7;
  color: #14532d;
  font-size: 18px;
  font-weight: 900;
  cursor: pointer;
}
.mg-pad.jumped {
  background: #16a34a;
  color: #ffffff;
}

/* 10. 🧪 凑十能量工坊 & 🏪 收银台 & 🪄 小棒围栏 */
.mg-bk-num {
  font-size: 26px;
  font-weight: 900;
  color: #1d4ed8;
  margin: 6px 0;
}
.mg-bk-plus {
  font-size: 28px;
  font-weight: 900;
  color: #6b7280;
}
.mg-tray-box {
  padding: 14px;
  border-radius: 16px;
  background: #f8fafc;
  border: 2px dashed #94a3b8;
  text-align: center;
  margin-bottom: 14px;
}
.mg-tray-chip,
.mg-poly-chip {
  display: inline-block;
  margin: 4px;
  padding: 6px 12px;
  border-radius: 999px;
  background: #fef3c7;
  border: 2px solid #f59e0b;
  font-weight: 800;
}
.mg-drawer {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
}

/* 11. 六年级题目可视化图解 (.g6v-box) & 六年级数学思维进阶岛 */
.g6v-box {
  margin: 8px auto 12px;
  padding: 12px 16px;
  border-radius: 16px;
  background: linear-gradient(180deg, #f8fbff 0%, #eef5ff 100%);
  border: 2px solid #cbdcf7;
  max-width: 520px;
}
.g6v-svg {
  display: block;
  width: 100%;
  max-height: 115px;
  margin: 0 auto;
}

.g6-sw-home-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 14px;
  margin: 18px 0;
  padding: 18px 22px;
  border-radius: 22px;
  background: linear-gradient(135deg, #fffbeb 0%, #fef3c7 100%);
  border: 2px solid #f59e0b;
  box-shadow: 0 6px 18px rgba(245, 158, 11, 0.14);
}
.g6-sw-home-main {
  display: flex;
  align-items: center;
  gap: 14px;
  flex: 1 1 320px;
}
.g6-sw-home-emo {
  font-size: 42px;
  line-height: 1;
}
.g6-sw-home-main h3 {
  margin: 0 0 4px;
  font-size: 19px;
  color: #78350f;
}
.g6-sw-home-main p {
  margin: 0;
  font-size: 14px;
  color: #92400e;
}
.g6-sw-home-acts {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.g6-sw-hero {
  display: grid;
  grid-template-columns: 1.25fr 1fr;
  gap: 20px;
  padding: 22px;
  border-radius: 24px;
  background: linear-gradient(135deg, #eff6ff 0%, #e0f2fe 100%);
  border: 2px solid #bae6fd;
  margin-bottom: 22px;
}
.g6-sw-tree-box {
  padding: 14px;
  border-radius: 18px;
  background: #ffffff;
  border: 2px solid #dbeafe;
  text-align: center;
}
.g6-sw-tree-title {
  font-size: 14px;
  font-weight: 800;
  color: #1e40af;
  margin-bottom: 8px;
}
.g6-sw-constellation {
  width: 100%;
  max-height: 210px;
}

.g6-sw-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(290px, 1fr));
  gap: 16px;
}
.g6-sw-card {
  padding: 18px;
  border-radius: 20px;
  background: #ffffff;
  border: 2px solid #e2e8f0;
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.05);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}
.g6-sw-card-head {
  display: flex;
  align-items: center;
  gap: 12px;
}
.g6-sw-emo {
  font-size: 34px;
}
.g6-sw-dim {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  background: #dbeafe;
  color: #1d4ed8;
  font-size: 12px;
  font-weight: 800;
}
.g6-sw-card-head h3 {
  margin: 3px 0 0;
  font-size: 18px;
  color: #0f172a;
}
.g6-sw-stars {
  margin-left: auto;
  font-weight: 900;
  color: #d97706;
}
.g6-sw-desc {
  font-size: 14px;
  color: #475569;
  margin: 10px 0 14px;
}
.g6-sw-lvls {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.g6-sw-lvl-btn {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
}

.g6-sw-dim-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 14px;
}
.g6-sw-dim-card {
  padding: 16px;
  border-radius: 18px;
  background: #ffffff;
  border: 2px solid #dbeafe;
}
.g6-sw-dim-top {
  display: flex;
  justify-content: space-between;
  font-size: 15px;
}

/* 12. 六年级每节知识点专属 4 步交互式动画播放器 (.g6-sec-anim) */
.g6-sec-anim {
  margin: 14px 0 16px;
  padding: 16px 18px;
  border-radius: 20px;
  background: linear-gradient(180deg, #f8fbff 0%, #eef5ff 100%);
  border: 2px solid #bfdbfe;
  box-shadow: 0 8px 24px rgba(30, 64, 175, 0.08);
}
.g6-sec-anim .g6-la-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 10px;
}
.g6-sec-anim .g6-la-kicker {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 999px;
  background: #dbeafe;
  color: #1d4ed8;
  font-size: 12px;
  font-weight: 800;
  margin-bottom: 4px;
}
.g6-sec-anim .g6-la-head h3 {
  margin: 0;
  font-size: 17px;
  color: #0f172a;
}
.g6-sec-anim .g6-la-head p {
  margin: 2px 0 0;
  font-size: 13px;
  color: #475569;
}
.g6-sec-anim [data-la-count] {
  padding: 4px 10px;
  border-radius: 999px;
  background: #eff6ff;
  border: 1px solid #93c5fd;
  color: #1e40af;
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}
.g6-sec-anim .g6-la-scene {
  background: #ffffff;
  border-radius: 16px;
  border: 1.5px solid #dbeafe;
  padding: 8px;
  overflow: hidden;
}
.g6-sec-anim .g6-la-scene svg {
  display: block;
  width: 100%;
  height: auto;
  max-height: 235px;
}
.g6-sec-param-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 10px;
  padding: 8px 14px;
  border-radius: 12px;
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  font-size: 13px;
  font-weight: 700;
  color: #1e3a8a;
}
.g6-sec-param-bar input[type="range"] {
  flex: 1 1 160px;
  accent-color: #2563eb;
  cursor: pointer;
}
.g6-sec-param-val {
  padding: 2px 8px;
  border-radius: 8px;
  background: #2563eb;
  color: #ffffff;
  font-weight: 800;
  font-size: 12px;
}

/* 13. 六年级高阶 HTML5 Canvas + 物理/几何实时仿真引擎 (.g6-cyber-stage) */
.g6-cyber-stage {
  border-radius: 22px;
  background: linear-gradient(165deg, #0b1120 0%, #111827 55%, #1e293b 100%);
  border: 2px solid #334155;
  padding: 18px;
  color: #f8fafc;
  box-shadow: 0 14px 32px rgba(15, 23, 42, 0.32), inset 0 1px 0 rgba(255, 255, 255, 0.08);
}
.g6-sim-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}
.g6-sim-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  border-radius: 999px;
  background: rgba(56, 189, 248, 0.14);
  border: 1px solid rgba(56, 189, 248, 0.45);
  color: #7dd3fc;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.4px;
}
.g6-sim-status {
  padding: 4px 12px;
  border-radius: 999px;
  background: rgba(245, 158, 11, 0.16);
  border: 1px solid rgba(245, 158, 11, 0.45);
  color: #fcd34d;
  font-size: 12px;
  font-weight: 800;
}
.g6-sim-status.calibrated {
  background: rgba(16, 185, 129, 0.2);
  border-color: #34d399;
  color: #6ee7b7;
}
.g6-sim-viewport {
  position: relative;
  width: 100%;
  height: 236px;
  border-radius: 16px;
  background: radial-gradient(circle at 50% 35%, #172554 0%, #090d16 100%);
  border: 1.5px solid #1e3a8a;
  overflow: hidden;
  cursor: pointer;
  user-select: none;
}
.g6-sim-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}
.g6-sim-svg-layer {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}
.g6-sim-svg-layer svg {
  width: 100%;
  height: 100%;
  display: block;
}
.g6-sim-hud {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-top: 12px;
}
.g6-hud-card {
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(30, 41, 59, 0.82);
  border: 1px solid rgba(148, 163, 184, 0.24);
  text-align: center;
}
.g6-hud-label {
  display: block;
  font-size: 11px;
  color: #94a3b8;
  margin-bottom: 3px;
}
.g6-hud-val {
  font-size: 15px;
  font-weight: 900;
  color: #38bdf8;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}
.g6-sim-controls {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 12px;
  padding: 12px 14px;
  border-radius: 14px;
  background: rgba(15, 23, 42, 0.75);
  border: 1px solid rgba(56, 189, 248, 0.28);
}
.g6-sim-slider-wrap {
  flex: 1 1 220px;
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.g6-sim-slider-head {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  font-weight: 800;
  color: #e2e8f0;
}
.g6-sim-slider {
  width: 100%;
  accent-color: #38bdf8;
  cursor: pointer;
}
.g6-cyber-stage .g6m-quiz {
  margin-top: 14px;
  padding: 14px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.96);
  color: #0f172a;
  border: 2px solid #38bdf8;
}

@media (max-width: 720px) {
  .g6-sw-hero {
    grid-template-columns: 1fr;
  }
  .g6-sim-hud {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 560px) {
  .mg-chap-card {
    flex-direction: column;
    align-items: stretch;
  }
  .mg-head {
    flex-direction: column;
    align-items: flex-start;
  }
  .mg-prompt-bar {
    flex-direction: column;
    align-items: flex-start;
  }
}

@media (prefers-reduced-motion: reduce) {
  .mg-bubble,
  .mg-stage-pill {
    transition: none !important;
    transform: none !important;
  }
}

