/* ===== 果冻跑酷数学 全局 ===== */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html,
body {
  height: 100%;
}

body {
  font-family: "PingFang SC", "Microsoft YaHei", "Noto Sans SC", sans-serif;
  background: linear-gradient(160deg, #ffb6e8 0%, #c9a4ff 45%, #8ee6ff 100%);
  color: #4a2b52;
  overflow-x: hidden;
}

#app {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 12px;
}

/* ===== 菜单页 ===== */
.jelly-menu {
  width: 100%;
  max-width: 860px;
  text-align: center;
  background: rgba(255, 255, 255, 0.75);
  border-radius: 28px;
  padding: 40px 28px 44px;
  box-shadow: 0 18px 50px rgba(150, 60, 130, 0.28);
  backdrop-filter: blur(6px);
}

.jelly-logo {
  font-size: 64px;
  line-height: 1;
  animation: jelly-bob 2s ease-in-out infinite;
}

@keyframes jelly-bob {
  0%, 100% { transform: translateY(0) scale(1, 1); }
  50% { transform: translateY(-8px) scale(1.06, 0.94); }
}

.jelly-title {
  font-size: 42px;
  font-weight: 900;
  background: linear-gradient(90deg, #f14a9c, #8a4dff);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  margin: 10px 0 6px;
}

.jelly-sub {
  font-size: 16px;
  color: #7a5585;
  margin-bottom: 28px;
}

.jelly-grades {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 16px;
}

.jelly-grade-card {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 20px 14px;
  border: none;
  border-radius: 20px;
  background: linear-gradient(160deg, #fff, #ffe9f6);
  box-shadow: 0 6px 18px rgba(150, 60, 130, 0.18);
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  text-align: left;
}

.jelly-grade-card:hover {
  transform: translateY(-4px) scale(1.02);
  box-shadow: 0 12px 26px rgba(150, 60, 130, 0.3);
}

.jelly-grade-badge {
  font-size: 20px;
  font-weight: 800;
  color: #f14a9c;
}

.jelly-grade-topics {
  font-size: 13px;
  color: #6b4a76;
  line-height: 1.5;
}

.jelly-grade-best {
  font-size: 12px;
  color: #b27ac4;
}

/* ===== 游戏页 ===== */
.jelly-game {
  position: relative;
  width: 100%;
  max-width: 960px;
  border-radius: 22px;
  overflow: hidden;
  box-shadow: 0 18px 50px rgba(60, 40, 90, 0.35);
  background: #dff6ff;
  touch-action: none;
}

.jelly-canvas {
  display: block;
  width: 100%;
  height: auto;
  cursor: pointer;
}

.jelly-hud {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  display: flex;
  justify-content: space-between;
  padding: 12px 16px;
  pointer-events: none;
  text-shadow: 1px 1px 0 rgba(0, 0, 0, 0.15);
}

.jelly-hud-left,
.jelly-hud-right {
  display: flex;
  gap: 12px;
}

.jelly-stat {
  background: rgba(0, 0, 0, 0.35);
  color: #fff;
  font-size: 15px;
  font-weight: 700;
  padding: 6px 12px;
  border-radius: 999px;
  white-space: nowrap;
}

.jelly-stat b {
  color: #ffd700;
  font-size: 17px;
}

/* ===== 答题弹窗 ===== */
.jelly-quiz {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(30, 10, 40, 0.55);
  z-index: 20;
}

.jelly-quiz-box {
  width: min(440px, 88%);
  background: #fff;
  border-radius: 24px;
  padding: 26px 24px;
  text-align: center;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.3);
  animation: quiz-pop 0.25s ease-out;
}

@keyframes quiz-pop {
  0% { transform: scale(0.8); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}

.jelly-quiz-title {
  font-size: 16px;
  font-weight: 800;
  color: #f14a9c;
  margin-bottom: 14px;
}

.jelly-quiz-q {
  font-size: 26px;
  font-weight: 800;
  color: #4a2b52;
  margin-bottom: 18px;
  word-break: break-all;
}

.jelly-quiz-options {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.jelly-quiz-opt {
  font-size: 20px;
  font-weight: 700;
  color: #4a2b52;
  padding: 14px 8px;
  border: 2px solid #e8b8dc;
  border-radius: 14px;
  background: #fff5fb;
  cursor: pointer;
  transition: transform 0.1s ease, background 0.1s ease, border-color 0.1s ease;
  word-break: break-all;
}

.jelly-quiz-opt:hover {
  transform: translateY(-2px);
  background: #ffe3f4;
  border-color: #f14a9c;
}

/* ===== Toast ===== */
.jelly-toast {
  position: absolute;
  top: 72px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 30;
  font-size: 18px;
  font-weight: 800;
  color: #fff;
  padding: 10px 22px;
  border-radius: 999px;
  pointer-events: none;
}

.jelly-toast-ok {
  background: rgba(76, 175, 80, 0.92);
}

.jelly-toast-bad {
  background: rgba(229, 57, 53, 0.92);
}

/* ===== 结束页 ===== */
.jelly-over {
  width: 100%;
  max-width: 620px;
  text-align: center;
  background: rgba(255, 255, 255, 0.82);
  border-radius: 28px;
  padding: 36px 28px 40px;
  box-shadow: 0 18px 50px rgba(150, 60, 130, 0.28);
}

.jelly-over-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  margin: 24px 0;
}

.jelly-over-card {
  background: #fff5fb;
  border: 2px solid #f3cfee;
  border-radius: 18px;
  padding: 16px 8px;
  font-size: 13px;
  color: #7a5585;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.jelly-over-card b {
  font-size: 24px;
  color: #4a2b52;
}

.jelly-over-best {
  background: #fff3d6;
  border-color: #ffd86b;
}

.jelly-new {
  display: inline-block;
  font-size: 12px;
  color: #fff;
  background: #f14a9c;
  border-radius: 999px;
  padding: 2px 10px;
}

.jelly-over-grade {
  color: #7a5585;
  margin-bottom: 22px;
}

.jelly-over-btns {
  display: flex;
  gap: 14px;
  justify-content: center;
  flex-wrap: wrap;
}

.jelly-btn {
  font-size: 16px;
  font-weight: 700;
  color: #4a2b52;
  background: #fff;
  border: 2px solid #e8b8dc;
  border-radius: 999px;
  padding: 12px 26px;
  cursor: pointer;
  transition: transform 0.12s ease, background 0.12s ease;
}

.jelly-btn:hover {
  transform: translateY(-2px);
  background: #ffe3f4;
}

.jelly-btn-primary {
  background: linear-gradient(90deg, #f14a9c, #8a4dff);
  color: #fff;
  border: none;
}

.jelly-btn-primary:hover {
  background: linear-gradient(90deg, #ff5dab, #9a5dff);
}

/* ===== 单元网格（每单元 6 小关） ===== */
.jelly-units {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 14px;
  margin-bottom: 24px;
}

.jelly-unit-card {
  background: linear-gradient(160deg, #fff, #ffe9f6);
  border-radius: 18px;
  padding: 14px 12px;
  box-shadow: 0 6px 16px rgba(150, 60, 130, 0.16);
  text-align: center;
}

.jelly-unit-locked {
  background: #f3edf5;
  opacity: 0.75;
}

.jelly-unit-name {
  font-size: 14px;
  font-weight: 800;
  color: #4a2b52;
  margin-bottom: 4px;
}

.jelly-unit-type {
  font-size: 11px;
  color: #b27ac4;
  margin-bottom: 10px;
}

.jelly-dots {
  display: flex;
  justify-content: center;
  gap: 6px;
}

.jelly-dot {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: none;
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
  transition: transform 0.12s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.jelly-dot:hover {
  transform: scale(1.15);
}

.jelly-dot-play {
  background: linear-gradient(90deg, #f14a9c, #8a4dff);
  color: #fff;
  box-shadow: 0 4px 10px rgba(138, 77, 255, 0.4);
}

.jelly-dot-done {
  background: #7ed07e;
  color: #fff;
  cursor: pointer;
}

.jelly-dot-lock {
  background: #e3d7ea;
  color: #b0a0b8;
  cursor: not-allowed;
  font-size: 12px;
}

.jelly-btn-back {
  margin-top: 8px;
}

/* HUD 关卡标题 */
.jelly-stat-title {
  background: rgba(138, 77, 255, 0.85);
  max-width: 340px;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* 退出按钮（置顶，答题时也可点，点击不触发跳跃） */
.jelly-exit {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 40;
  width: 42px;
  height: 42px;
  border: none;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.45);
  color: #fff;
  font-size: 20px;
  font-weight: 800;
  cursor: pointer;
  line-height: 1;
  transition: transform 0.12s ease, background 0.12s ease;
  pointer-events: auto;
}

.jelly-exit:hover {
  transform: scale(1.12);
  background: rgba(229, 57, 53, 0.85);
}

.jelly-exit:active {
  transform: scale(0.92);
}

@media (max-width: 720px) {
  .jelly-stat-title {
    display: none;
  }
}

/* 移动端适配 */
@media (max-width: 560px) {
  .jelly-title {
    font-size: 32px;
  }
  .jelly-logo {
    font-size: 50px;
  }
  .jelly-quiz-q {
    font-size: 22px;
  }
  .jelly-over-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .jelly-grades {
    grid-template-columns: 1fr 1fr;
  }
}
