/* ==========================================================
   小新的快乐星球 · 样式表
   风格：明亮卡通 + 圆角贴纸 + 弹性动画
   ========================================================== */

:root {
  --ink:      #3a2f5e;
  --ink-soft: #6f6494;
  --paper:    #fffaf0;
  --blue:     #4fc3f7;
  --yellow:   #ffd23f;
  --green:    #7ed957;
  --coral:    #ff7a6b;
  --purple:   #a66cff;
  --pink:     #ff8fab;
  --sky:      #d6f3ff;
  --radius:   24px;
  --shadow:   0 8px 0 rgba(58, 47, 94, .12), 0 16px 32px rgba(58, 47, 94, .10);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  font-family: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei",
               "Comic Sans MS", "Chalkboard SE", sans-serif;
  color: var(--ink);
  background: var(--paper);
  line-height: 1.7;
  overflow-x: hidden;
}

::selection { background: var(--yellow); }

h1, h2, h3, h4 { line-height: 1.3; }

/* ---------------- 通用元素 ---------------- */

.section {
  max-width: 1100px;
  margin: 0 auto;
  padding: 80px 24px 40px;
}

.section-tint {
  max-width: none;
  background: linear-gradient(180deg, #fff6dd 0%, #fffaf0 100%);
}
.section-tint > * { max-width: 1100px; margin-left: auto; margin-right: auto; }

.section-title {
  text-align: center;
  font-size: clamp(1.7rem, 4vw, 2.4rem);
  margin-bottom: 10px;
}

.section-desc {
  text-align: center;
  color: var(--ink-soft);
  margin-bottom: 36px;
  font-size: 1.05rem;
}

.card {
  background: #fff;
  border: 3px solid var(--ink);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 28px;
  transition: transform .25s ease, box-shadow .25s ease;
}
.card:hover { transform: translateY(-4px); }

.btn {
  display: inline-block;
  border: 3px solid var(--ink);
  border-radius: 999px;
  padding: 12px 26px;
  font-size: 1.05rem;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  text-decoration: none;
  color: var(--ink);
  box-shadow: 0 5px 0 var(--ink);
  transition: transform .12s ease, box-shadow .12s ease;
}
.btn:hover  { transform: translateY(-2px); box-shadow: 0 7px 0 var(--ink); }
.btn:active { transform: translateY(4px); box-shadow: 0 1px 0 var(--ink); }

.btn-yellow { background: var(--yellow); }
.btn-green  { background: var(--green); }
.btn-white  { background: #fff; }
.btn-coral  { background: var(--coral); }
.btn-blue   { background: var(--blue); }
.btn-purple { background: var(--purple); color: #fff; }

.muted { color: var(--ink-soft); font-size: .92rem; }

/* 滚动出现动画 */
[data-reveal] {
  opacity: 0;
  transform: translateY(28px);
  transition: opacity .6s ease, transform .6s cubic-bezier(.2, .8, .3, 1.2);
}
[data-reveal].is-visible { opacity: 1; transform: none; }

/* ---------------- 导航栏 ---------------- */

.navbar {
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 28px;
  background: rgba(255, 255, 255, .85);
  backdrop-filter: blur(10px);
  border-bottom: 3px solid rgba(58, 47, 94, .08);
}

.nav-logo {
  font-weight: 800;
  font-size: 1.1rem;
  text-decoration: none;
  color: var(--ink);
  white-space: nowrap;
}

.nav-links { display: flex; gap: 6px; flex-wrap: wrap; }

.nav-links a {
  text-decoration: none;
  color: var(--ink-soft);
  font-weight: 700;
  font-size: .95rem;
  padding: 6px 14px;
  border-radius: 999px;
  transition: background .2s, color .2s;
}
.nav-links a:hover { background: var(--sky); color: var(--ink); }
.nav-links a.is-active { background: var(--yellow); color: var(--ink); }

/* ---------------- Hero ---------------- */

.hero {
  position: relative;
  min-height: 92vh;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 60px 24px 120px;
  background: linear-gradient(180deg, #aee6ff 0%, #d9f5ff 55%, #f0fbff 100%);
  overflow: hidden;
}

.hero-inner { position: relative; z-index: 2; }

.avatar {
  width: 140px;
  height: 140px;
  margin: 0 auto 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 84px;
  background: #fff;
  border: 4px solid var(--ink);
  border-radius: 50%;
  box-shadow: 0 10px 0 rgba(58, 47, 94, .15);
  animation: bob 3s ease-in-out infinite;
}

.hero-hi { font-size: 1.2rem; font-weight: 700; }

.hero-title { font-size: clamp(2.6rem, 8vw, 4.5rem); margin: 6px 0; }

.name-rainbow {
  background: linear-gradient(90deg, #ff7a6b, #ffd23f, #7ed957, #4fc3f7, #a66cff);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.hero-sub { font-size: clamp(1rem, 2.6vw, 1.25rem); color: var(--ink-soft); margin-bottom: 30px; }

.hero-btns { display: flex; gap: 16px; justify-content: center; flex-wrap: wrap; }

/* 太阳 */
.sun {
  position: absolute;
  top: 60px;
  right: 8%;
  width: 90px;
  height: 90px;
  border-radius: 50%;
  background: var(--yellow);
  border: 3px solid var(--ink);
  box-shadow: 0 0 0 14px rgba(255, 210, 63, .25);
  animation: spin 24s linear infinite;
}
.sun::before {
  content: "";
  position: absolute;
  inset: -22px;
  background:
    conic-gradient(from 0deg,
      var(--yellow) 0 6%, transparent 6% 19%,
      var(--yellow) 19% 25%, transparent 25% 44%,
      var(--yellow) 44% 50%, transparent 50% 69%,
      var(--yellow) 69% 75%, transparent 75% 94%,
      var(--yellow) 94% 100%);
  border-radius: 50%;
  z-index: -1;
}

/* 云朵 */
.cloud {
  position: absolute;
  font-size: 3.4rem;
  opacity: .9;
  animation: drift linear infinite;
}
.cloud1 { top: 14%; left: -10%; animation-duration: 38s; }
.cloud2 { top: 32%; left: -10%; font-size: 2.4rem; animation-duration: 52s; animation-delay: -18s; }
.cloud3 { top: 60%; left: -10%; font-size: 4rem; animation-duration: 64s; animation-delay: -40s; }

/* 漂浮的兴趣泡泡 */
.float-bubble {
  position: absolute;
  font-size: 2.6rem;
  width: 64px;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, .8);
  border: 3px solid var(--ink);
  border-radius: 50%;
  animation: bob 4s ease-in-out infinite;
  z-index: 1;
}
.b1 { top: 18%; left: 12%; animation-delay: -.5s; }
.b2 { top: 64%; left: 16%; animation-delay: -1.4s; }
.b3 { top: 24%; right: 14%; animation-delay: -2.2s; }
.b4 { bottom: 16%; right: 18%; animation-delay: -3s; }

/* Hero 底部波浪 */
.wave {
  position: absolute;
  bottom: -2px;
  left: 0;
  width: 100%;
  height: 90px;
  background: var(--paper);
  clip-path: ellipse(52% 100% at 50% 100%);
}

@keyframes bob {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(-14px); }
}
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes drift {
  from { transform: translateX(0); }
  to   { transform: translateX(120vw); }
}

/* ---------------- 关于我 ---------------- */

.about-grid {
  display: grid;
  grid-template-columns: 1fr 1.3fr;
  gap: 24px;
  margin-bottom: 28px;
}

.about-card { text-align: center; }
.about-avatar { font-size: 64px; }

.about-card h3, .day-card h3 { margin: 8px 0 14px; font-size: 1.3rem; }

.about-list { list-style: none; text-align: left; display: inline-block; }
.about-list li { padding: 5px 0; }

.timeline { list-style: none; }
.timeline li {
  display: grid;
  grid-template-columns: 76px 36px 1fr;
  align-items: center;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 2px dashed rgba(58, 47, 94, .12);
}
.timeline li:last-child { border-bottom: none; }
.t-time {
  font-size: .85rem;
  font-weight: 700;
  color: #fff;
  background: var(--purple);
  border-radius: 999px;
  text-align: center;
  padding: 2px 8px;
}
.t-icon { font-size: 1.4rem; text-align: center; }

.chips { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }

.chip {
  font-weight: 700;
  padding: 8px 18px;
  border-radius: 999px;
  border: 3px solid var(--ink);
  box-shadow: 0 4px 0 rgba(58, 47, 94, .15);
}
.chip-blue   { background: #dff4ff; }
.chip-yellow { background: #fff3c4; }
.chip-green  { background: #e4fbd7; }
.chip-purple { background: #ede1ff; }
.chip-pink   { background: #ffe4ec; }

/* ---------------- 2026 生日回忆 ---------------- */

.birthday-layout {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 24px;
  align-items: start;
}

.story-badge {
  display: inline-block;
  font-size: .82rem;
  font-weight: 700;
  background: var(--yellow);
  border: 2px solid var(--ink);
  border-radius: 999px;
  padding: 3px 14px;
  margin-bottom: 12px;
}

.story-card h3 { font-size: 1.35rem; margin-bottom: 10px; }
.story-lead { margin-bottom: 16px; }

.story-list { list-style: none; }
.story-list li {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  padding: 12px 0;
  border-bottom: 2px dashed rgba(58, 47, 94, .12);
}
.story-list li:last-child { border-bottom: none; }

.story-emoji {
  width: 48px;
  height: 48px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  background: #f1ecff;
  border: 2px solid var(--ink);
  border-radius: 14px;
}
.story-list strong { display: block; }

.story-end {
  margin-top: 14px;
  font-weight: 700;
  text-align: center;
  color: var(--purple);
}

.gift-card { text-align: center; }

.gift-emoji {
  font-size: 3.4rem;
  animation: bob 2.6s ease-in-out infinite;
}
.gift-card h3 { margin: 6px 0 10px; }
.gift-big {
  font-size: 1.35rem;
  font-weight: 800;
  line-height: 1.5;
  margin-bottom: 10px;
  color: var(--coral);
}

.gift-note {
  margin-top: 18px;
  background: #fff8e6;
  border: 2px dashed var(--ink);
  border-radius: 16px;
  padding: 16px;
  text-align: left;
}
.note-to { font-weight: 700; margin-bottom: 8px; }
.gift-note p { font-size: .95rem; }
.gift-sign { text-align: right; margin-top: 10px; font-weight: 700; }

/* ---------------- 阅读角 ---------------- */

.reading-layout {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 24px;
  align-items: start;
}

.challenge-card { text-align: center; }
.challenge-card h3 { margin-bottom: 18px; }

.ring {
  width: 150px;
  height: 150px;
  margin: 0 auto 18px;
  border-radius: 50%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background:
    radial-gradient(closest-side, #fff 76%, transparent 77% 100%),
    conic-gradient(var(--green) 0deg, #eee 0deg);
  border: 3px solid var(--ink);
  transition: background .4s;
}
.ring span { font-size: 2.2rem; font-weight: 800; }
.ring small { color: var(--ink-soft); }

.progress {
  height: 18px;
  background: #eeeaf7;
  border: 2px solid var(--ink);
  border-radius: 999px;
  overflow: hidden;
  margin: 12px 0 8px;
}
.progress-bar {
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, var(--green), #4dd0e1);
  border-radius: 999px;
  transition: width 1s cubic-bezier(.2, .8, .3, 1);
}

.bookshelf {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 18px;
}

.book {
  background: #fff;
  border: 3px solid var(--ink);
  border-radius: 18px;
  padding: 16px 12px;
  text-align: center;
  box-shadow: 0 6px 0 rgba(58, 47, 94, .12);
  transition: transform .2s;
}
.book:hover { transform: rotate(-2deg) translateY(-4px); }

.book-cover {
  font-size: 2.6rem;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 6px;
}
.book h4 { font-size: .95rem; min-height: 42px; display: flex; align-items: center; justify-content: center; }

.book-tag {
  display: inline-block;
  font-size: .78rem;
  font-weight: 700;
  padding: 2px 12px;
  border-radius: 999px;
  background: #e4fbd7;
  margin: 6px 0;
}
.tag-reading { background: #fff3c4; }
.tag-want    { background: #ede1ff; }
.stars { font-size: .8rem; letter-spacing: -2px; }

/* ---------------- 数学闯关 ---------------- */

.math-layout {
  display: grid;
  grid-template-columns: 1.5fr 1fr;
  gap: 24px;
  align-items: start;
}

.math-settings { display: flex; flex-direction: column; gap: 10px; margin-bottom: 22px; }
.setting-group { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.setting-label { font-weight: 700; font-size: .92rem; }

.opt {
  font-family: inherit;
  font-weight: 700;
  font-size: .9rem;
  padding: 6px 14px;
  border: 2px solid var(--ink);
  border-radius: 999px;
  background: #fff;
  color: var(--ink);
  cursor: pointer;
  transition: background .15s, transform .12s;
}
.opt:hover { transform: translateY(-2px); }
.opt.is-active { background: var(--yellow); }

.question-box {
  background: var(--sky);
  border: 3px dashed var(--ink);
  border-radius: 20px;
  text-align: center;
  font-size: clamp(1.6rem, 7vw, 3rem);
  font-weight: 800;
  padding: 26px 12px;
  margin-bottom: 18px;
  min-height: 100px;
  max-width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow-wrap: anywhere;   /* 长表达式在窄屏上随时可换行，绝不顶宽卡片 */
  word-break: break-word;
}

.answer-row { display: flex; gap: 12px; }
#answerInput {
  flex: 1;
  min-width: 0;
  font-family: inherit;
  font-size: 1.3rem;
  font-weight: 700;
  text-align: center;
  padding: 10px 14px;
  border: 3px solid var(--ink);
  border-radius: 16px;
  outline: none;
}
#answerInput:focus { box-shadow: 0 0 0 4px rgba(79, 195, 247, .35); }

.feedback {
  text-align: center;
  font-weight: 700;
  font-size: 1.1rem;
  min-height: 32px;
  margin: 14px 0 18px;
}
.feedback.good { color: #2e9e44; }
.feedback.bad  { color: #e0524a; }

.math-stats { display: flex; justify-content: space-around; gap: 10px; }
.stat { text-align: center; }
.stat-num { display: block; font-size: 1.9rem; font-weight: 800; }
.stat-label { font-size: .88rem; color: var(--ink-soft); }

.math-tips ul { list-style: none; }
.math-tips li {
  padding: 10px 0;
  border-bottom: 2px dashed rgba(58, 47, 94, .12);
  font-size: .95rem;
}
.math-tips li:last-child { border-bottom: none; }

/* ---------------- 足球营 ---------------- */

.soccer-layout {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 24px;
  align-items: start;
}

.field-card h3, .skills-card h3 { margin-bottom: 18px; text-align: center; }

.field {
  position: relative;
  height: 200px;
  border-radius: 18px;
  border: 3px solid var(--ink);
  background:
    repeating-linear-gradient(90deg, #6cc94a 0 60px, #62bd43 60px 120px);
  margin-bottom: 18px;
  overflow: hidden;
}
.field::before {
  content: "";
  position: absolute;
  top: 0; bottom: 0; left: 50%;
  border-left: 3px dashed rgba(255,255,255,.8);
}
.field::after {
  content: "";
  position: absolute;
  top: 50%; left: 50%;
  width: 60px; height: 60px;
  transform: translate(-50%, -50%);
  border: 3px solid rgba(255,255,255,.8);
  border-radius: 50%;
}

.goal {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  font-size: 2.4rem;
  z-index: 2;
}
.goal-left  { left: 6px; }
.goal-right { right: 6px; }

.ball {
  position: absolute;
  left: 50%; bottom: 24px;
  font-size: 2.2rem;
  transform: translateX(-50%);
  animation: kickBall 3s ease-in-out infinite;
  z-index: 3;
}
@keyframes kickBall {
  0%   { left: 14%; bottom: 20px; transform: rotate(0deg); }
  45%  { left: 50%; bottom: 110px; transform: rotate(360deg); }
  55%  { left: 50%; bottom: 110px; transform: rotate(360deg); }
  100% { left: 86%; bottom: 20px; transform: rotate(720deg); }
}

.training-days { display: flex; gap: 12px; }
.day {
  flex: 1;
  text-align: center;
  background: #e4fbd7;
  border: 2px solid var(--ink);
  border-radius: 16px;
  padding: 10px;
}
.day strong { display: block; }
.day span { font-size: .85rem; color: var(--ink-soft); }

.skill { margin-bottom: 18px; }
.skill-head { display: flex; justify-content: space-between; font-weight: 700; margin-bottom: 4px; }

.bar-green  { background: linear-gradient(90deg, var(--green), #43c6ac); }
.bar-blue   { background: linear-gradient(90deg, var(--blue), #38bdf8); }
.bar-coral  { background: linear-gradient(90deg, var(--coral), #ffa07a); }
.bar-purple { background: linear-gradient(90deg, var(--purple), #c39bff); }

.soccer-rules { list-style: none; margin-top: 22px; font-size: .92rem; }
.soccer-rules li { padding: 4px 0; }

/* ---------------- 编程实验室 ---------------- */

.coding-layout {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 24px;
  align-items: start;
}

.maze-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.maze-head h3 { flex: 1; }

.maze-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  grid-template-rows: repeat(6, 1fr);   /* 固定行高，防止部分浏览器行高塌陷把星星挤出 */
  gap: 4px;
  max-width: 420px;
  margin: 0 auto 14px;
}

.cell {
  position: relative;
  border-radius: 10px;
  background: #f1ecff;
  border: 2px solid rgba(58, 47, 94, .15);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: clamp(1rem, 4vw, 1.6rem);
  transition: background .15s;
}
.cell.wall { background: #8d83b8; border-color: var(--ink); }
.cell.wall::after { content: "🧱"; font-size: clamp(.8rem, 3vw, 1.2rem); }
.cell.goal { background: #fff3c4; }
.cell.goal::before {
  content: "⭐";
  animation: bob 1.6s ease-in-out infinite;
}
.cell.player { background: #dff4ff; }
.cell.player::after { content: "🤖"; }
/* 机器人到达星星格：星星缩到左上角闪光，两个都能看到 */
.cell.goal.player { background: #ffe89a; }
.cell.goal.player::before {
  position: absolute;
  top: 1px; left: 2px;
  font-size: clamp(.6rem, 2.2vw, .85rem);
  animation: bob .8s ease-in-out infinite;
}
.cell.bump { animation: bump .35s ease; }
@keyframes bump {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-5px); }
  75% { transform: translateX(5px); }
}

.maze-msg {
  text-align: center;
  font-weight: 700;
  min-height: 30px;
  margin-bottom: 12px;
}

.cmd-buttons {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  max-width: 320px;
  margin: 0 auto 14px;
}
.cmd {
  font-size: 1.4rem;
  padding: 10px 0;
  border: 2px solid var(--ink);
  border-radius: 14px;
  background: #fff;
  cursor: pointer;
  box-shadow: 0 4px 0 rgba(58, 47, 94, .2);
  transition: transform .1s;
}
.cmd:active { transform: translateY(3px); box-shadow: 0 1px 0 rgba(58, 47, 94, .2); }

.program-box {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  background: #f7f4ff;
  border: 2px dashed var(--ink);
  border-radius: 16px;
  padding: 12px;
  margin-bottom: 14px;
  min-height: 60px;
}
.program-label { font-weight: 700; white-space: nowrap; font-size: .9rem; }
.program-list { display: flex; flex-wrap: wrap; gap: 6px; }
.program-step {
  background: #fff;
  border: 2px solid var(--ink);
  border-radius: 10px;
  width: 34px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
}
.program-step.running { background: var(--yellow); }
.program-step.done    { background: var(--green); }

.program-actions { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
#stepInfo { text-align: center; margin-top: 10px; }

.project {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  padding: 12px 0;
  border-bottom: 2px dashed rgba(58, 47, 94, .12);
}
.project:last-child { border-bottom: none; }
.project-icon {
  font-size: 2rem;
  width: 56px;
  height: 56px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #f1ecff;
  border: 2px solid var(--ink);
  border-radius: 16px;
}
.project h4 { font-size: 1rem; }
.project p { font-size: .88rem; color: var(--ink-soft); }

/* ---------------- 点球大战 ---------------- */

.penalty-card { margin-top: 24px; text-align: center; }
.penalty-card h3 { margin-bottom: 6px; }
.penalty-hint { margin-bottom: 14px; }

.penalty-goal {
  position: relative;
  height: 240px;
  max-width: 560px;
  margin: 0 auto 16px;
  border: 3px solid var(--ink);
  border-radius: 18px;
  background: linear-gradient(180deg, #8fd96a 0%, #6cc94a 70%, #57ad3c 100%);
  overflow: hidden;
}

.goal-net {
  position: absolute;
  top: 0; left: 50%;
  transform: translateX(-50%);
  width: 86%;
  height: 132px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  border: 4px solid #fff;
  border-bottom: none;
  background:
    repeating-linear-gradient(0deg,  rgba(255,255,255,.55) 0 2px, transparent 2px 26px),
    repeating-linear-gradient(90deg, rgba(255,255,255,.55) 0 2px, transparent 2px 56px);
}
.zone {
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: 700;
  font-size: .85rem;
  text-shadow: 0 1px 3px rgba(0,0,0,.35);
}

.keeper {
  position: absolute;
  bottom: 22px;
  left: 50%;
  font-size: 2.6rem;
  line-height: 1;
  transform: translateX(-50%);
  transition: left .42s cubic-bezier(.2,.8,.3,1.1), bottom .42s ease, transform .5s;
  z-index: 4;
}
.penalty-goal.dive-left  .keeper { left: 17%; bottom: 58px; transform: translateX(-50%) rotate(-12deg); }
.penalty-goal.dive-mid   .keeper { bottom: 70px; }
.penalty-goal.dive-right .keeper { left: 83%; bottom: 58px; transform: translateX(-50%) rotate(12deg); }

.penalty-ball {
  position: absolute;
  bottom: 12px;
  left: 50%;
  font-size: 2.2rem;
  line-height: 1;
  transform: translateX(-50%);
  transition: left .48s cubic-bezier(.2,.8,.3,1), bottom .48s ease, transform .6s;
  z-index: 3;
}
.penalty-goal.shoot-left  .penalty-ball { left: 17%; bottom: 92px; transform: translateX(-50%) rotate(360deg) scale(.85); }
.penalty-goal.shoot-mid   .penalty-ball { left: 50%; bottom: 98px; transform: translateX(-50%) rotate(360deg) scale(.85); }
.penalty-goal.shoot-right .penalty-ball { left: 83%; bottom: 92px; transform: translateX(-50%) rotate(360deg) scale(.85); }

.penalty-result {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.7rem;
  font-weight: 800;
  color: #fff;
  text-shadow: 0 2px 0 rgba(0,0,0,.28), 0 4px 14px rgba(0,0,0,.25);
  opacity: 0;
  pointer-events: none;
  transition: opacity .25s;
  z-index: 6;
}
.penalty-goal.show-result .penalty-result { opacity: 1; }
.penalty-goal.is-goal .penalty-result { color: #fff6c4; }

.penalty-controls {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
}
.penalty-stats { max-width: 560px; margin: 18px auto 0; }

/* ---------------- 趣味乐园 / 记忆翻牌 ---------------- */

.fun-layout {
  display: grid;
  grid-template-columns: 1.5fr 1fr;
  gap: 24px;
  align-items: start;
}

.memory-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
  flex-wrap: wrap;
}
.memory-head h3 { flex: 1; }

.memory-stats {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  justify-content: center;
  font-size: .92rem;
  margin-bottom: 14px;
}

.memory-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  max-width: 440px;
  margin: 0 auto;
}

.mcard {
  position: relative;
  aspect-ratio: 3 / 4;
  cursor: pointer;
  perspective: 700px;
}
.mcard-inner {
  position: absolute;
  inset: 0;
  transform-style: preserve-3d;
  transition: transform .45s cubic-bezier(.2,.8,.3,1.1);
}
.mcard.flipped .mcard-inner,
.mcard.matched .mcard-inner { transform: rotateY(180deg); }

.mcard-face {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 3px solid var(--ink);
  border-radius: 14px;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
}
.mcard-front {
  background: linear-gradient(135deg, var(--purple), #c39bff);
  font-size: clamp(1.4rem, 6vw, 2rem);
}
.mcard-back {
  background: #fff;
  transform: rotateY(180deg);
  font-size: clamp(1.6rem, 6.5vw, 2.4rem);
}
.mcard.matched { cursor: default; }
.mcard.matched .mcard-back { background: #e4fbd7; }
.mcard.matched { animation: matchedPop .5s ease; }

@keyframes matchedPop {
  0%   { transform: scale(1); }
  50%  { transform: scale(1.12); }
  100% { transform: scale(1); }
}

.fun-tips { list-style: none; }
.fun-tips li {
  padding: 9px 0;
  border-bottom: 2px dashed rgba(58, 47, 94, .12);
  font-size: .95rem;
}
.fun-tips li:last-child { border-bottom: none; }
.fun-best { margin-top: 20px; }

/* ---------------- 成长留言板 ---------------- */

.guest-layout {
  display: grid;
  grid-template-columns: 300px 1fr;
  gap: 24px;
  align-items: start;
  margin-bottom: 24px;
}

.checkin-card { text-align: center; }
.checkin-card h3 { margin-bottom: 6px; }

.checkin-ring {
  width: 140px;
  height: 140px;
  margin: 12px auto;
  border-radius: 50%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background:
    radial-gradient(closest-side, #fff 76%, transparent 77% 100%),
    conic-gradient(var(--yellow) 0deg, #eee 0deg);
  border: 3px solid var(--ink);
  transition: background .4s;
}
.checkin-ring span { font-size: 2.1rem; font-weight: 800; }
.checkin-ring small { color: var(--ink-soft); }

#checkinBtn { margin: 8px 0 14px; }
#checkinBtn:disabled {
  opacity: .65;
  cursor: default;
  transform: none;
  box-shadow: 0 5px 0 var(--ink);
}

.checkin-week {
  display: flex;
  justify-content: space-between;
  gap: 6px;
  margin-top: 10px;
}
.checkin-week span {
  flex: 1;
  font-size: .76rem;
  font-weight: 700;
  padding: 5px 0;
  border: 2px solid var(--ink);
  border-radius: 10px;
  background: #f1ecff;
}
.checkin-week span.done { background: var(--green); }
.checkin-week span.today { outline: 2px dashed var(--coral); outline-offset: 2px; }

.message-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 18px;
}
#messageName, #messageText {
  font-family: inherit;
  font-size: .98rem;
  padding: 10px 14px;
  border: 3px solid var(--ink);
  border-radius: 14px;
  outline: none;
  background: #fff;
}
#messageText { resize: vertical; }
#messageName:focus, #messageText:focus { box-shadow: 0 0 0 4px rgba(166, 108, 255, .25); }

.message-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: 340px;
  overflow-y: auto;
}
.msg-bubble {
  background: #f7f4ff;
  border: 2px solid var(--ink);
  border-radius: 14px;
  padding: 10px 14px;
}
.msg-head {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  font-size: .82rem;
  font-weight: 700;
}
.msg-head time { color: var(--ink-soft); font-weight: 400; }
.msg-text { font-size: .95rem; overflow-wrap: anywhere; }

/* ---------------- 成就徽章 ---------------- */

.badge-card { text-align: center; }
.badge-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(124px, 1fr));
  gap: 14px;
  margin-top: 16px;
}
.badge {
  border: 3px solid var(--ink);
  border-radius: 16px;
  padding: 14px 8px;
  background: #f2eff8;
  filter: grayscale(1);
  opacity: .55;
  transition: transform .2s;
}
.badge.unlocked {
  background: #fff;
  filter: none;
  opacity: 1;
  animation: badgePop .5s ease;
}
.badge-emoji { font-size: 2rem; display: block; }
.badge-name { font-weight: 700; font-size: .88rem; margin: 4px 0 2px; }
.badge-desc { font-size: .74rem; color: var(--ink-soft); }

@keyframes badgePop {
  0%   { transform: scale(.6); }
  60%  { transform: scale(1.12); }
  100% { transform: scale(1); }
}

/* 成就解锁提示 */
.badge-toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  transform: translate(-50%, 150%);
  display: flex;
  align-items: center;
  gap: 12px;
  background: #fff;
  border: 3px solid var(--ink);
  border-radius: 18px;
  padding: 12px 20px;
  box-shadow: 0 8px 0 rgba(58, 47, 94, .2);
  z-index: 210;
  text-align: left;
  transition: transform .4s cubic-bezier(.2,.8,.3,1.2);
}
.badge-toast.show { transform: translate(-50%, 0); }
.toast-emoji { font-size: 2rem; }
.toast-title { font-size: .76rem; color: var(--ink-soft); font-weight: 700; }
.toast-name { font-weight: 800; font-size: 1.02rem; }

/* ---------------- 页脚 ---------------- */

.footer {
  margin-top: 60px;
  padding: 50px 24px 40px;
  text-align: center;
  background: var(--ink);
  color: #fff;
}
.footer-emoji { font-size: 1.8rem; letter-spacing: 8px; margin-bottom: 10px; }
.footer-small { font-size: .85rem; opacity: .7; margin-top: 6px; }

/* ---------------- 回到顶部 & 彩带 ---------------- */

.back-top {
  position: fixed;
  right: 22px;
  bottom: 22px;
  width: 54px;
  height: 54px;
  font-size: 1.5rem;
  border: 3px solid var(--ink);
  border-radius: 50%;
  background: var(--yellow);
  cursor: pointer;
  box-shadow: 0 5px 0 rgba(58, 47, 94, .25);
  opacity: 0;
  pointer-events: none;
  transform: translateY(16px);
  transition: opacity .25s, transform .25s;
  z-index: 90;
}
.back-top.show { opacity: 1; pointer-events: auto; transform: none; }

.confetti-layer {
  position: fixed;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
  z-index: 200;
}
.confetti {
  position: absolute;
  top: -20px;
  width: 12px;
  height: 12px;
  border-radius: 3px;
  animation: fall linear forwards;
}
@keyframes fall {
  to { transform: translateY(105vh) rotate(720deg); opacity: .9; }
}

/* ---------------- 响应式 ---------------- */

@media (max-width: 480px) {
  /* 数学闯关窄屏防溢出 */
  #math .card { padding: 20px 16px; }
  .math-settings { gap: 8px; }
  .setting-label { width: 100%; }
  .question-box { font-size: clamp(1.5rem, 8vw, 2rem); padding: 20px 10px; }
  .answer-row { flex-wrap: wrap; }
  .answer-row .btn { flex: 1; }
  .math-stats { gap: 4px; }
  .stat-num { font-size: 1.5rem; }
  .stat-label { font-size: .78rem; }

  /* 点球大战 */
  .penalty-goal { height: 200px; }
  .goal-net { height: 110px; width: 92%; }
  .penalty-goal.shoot-left  .penalty-ball { left: 15%; bottom: 76px; }
  .penalty-goal.shoot-mid   .penalty-ball { bottom: 82px; }
  .penalty-goal.shoot-right .penalty-ball { left: 85%; bottom: 76px; }
  .penalty-goal.dive-left  .keeper { left: 15%; bottom: 48px; }
  .penalty-goal.dive-mid   .keeper { bottom: 58px; }
  .penalty-goal.dive-right .keeper { left: 85%; bottom: 48px; }
  .penalty-controls .btn { flex: 1; padding: 10px 14px; }
  .penalty-result { font-size: 1.35rem; }

  /* 记忆翻牌 */
  .memory-grid { gap: 8px; }

  /* 徽章 */
  .badge-grid { grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 10px; }
  .badge { padding: 10px 6px; }

  /* 成就提示 */
  .badge-toast { width: calc(100vw - 32px); justify-content: center; }
}

@media (max-width: 860px) {
  .about-grid,
  .birthday-layout,
  .reading-layout,
  .math-layout,
  .soccer-layout,
  .coding-layout,
  .fun-layout,
  .guest-layout {
    grid-template-columns: 1fr;
  }

  .navbar { flex-direction: column; padding: 10px 14px; }
  .nav-links { justify-content: center; }

  .section { padding-top: 56px; }

  .sun { width: 64px; height: 64px; top: 90px; right: 5%; }
  .float-bubble { display: none; }

  .training-days { flex-direction: column; }
}
