/* =====================================================================
   儿童编程启蒙营 · 自然有机风格样式表
   配色严格遵循视觉规范（草木调·蓝紫生机），定义为 CSS 变量贯穿全站
   ===================================================================== */

:root {
  /* ---- 规范配色 ---- */
  --c-primary: #3e79a3;          /* 主色 */
  --c-secondary: #5657b3;        /* 辅助色 */
  --c-accent: #5039c6;           /* 强调色 CTA */
  --c-bg: #f8fafb;               /* 页面背景 */
  --c-surface: #ffffff;          /* 卡片/表面 */
  --c-text: #1b252c;             /* 正文文字 */
  --c-text2: #5c6e7a;            /* 次要文字 */
  --c-line: #dbe1e6;             /* 描边 */

  /* ---- 同色系柔化（仅用于背景/装饰，保持同色相） ---- */
  --c-primary-soft: rgba(62, 121, 163, .14);
  --c-primary-softer: rgba(62, 121, 163, .07);
  --c-secondary-soft: rgba(86, 87, 179, .14);
  --c-accent-soft: rgba(80, 57, 198, .14);

  /* ---- 字体 ---- */
  --font-head: 'Quicksand', 'PingFang SC', 'Hiragino Sans GB', system-ui, sans-serif;
  --font-body: system-ui, -apple-system, 'PingFang SC', 'Microsoft YaHei', 'Segoe UI', sans-serif;

  /* ---- 圆角 ---- */
  --radius: 24px;
  --radius-s: 16px;

  /* ---- 阴影 ---- */
  --shadow: 0 10px 30px rgba(27, 37, 44, .06);
  --shadow-lg: 0 18px 44px rgba(80, 57, 198, .16);

  --header-h: 66px;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--font-body);
  color: var(--c-text);
  background: var(--c-bg);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}

h1, h2, h3, h4 {
  font-family: var(--font-head);
  margin: 0;
  line-height: 1.25;
  letter-spacing: .2px;
}

p { margin: 0; }

button {
  font-family: var(--font-head);
  cursor: pointer;
}

.hidden { display: none !important; }

/* =====================================================================
   背景有机 blob 装饰
   ===================================================================== */
.bg-blobs {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
}
.blob { position: absolute; display: block; opacity: .5; }
.blob-1 {
  width: 520px; height: 520px; top: -170px; right: -140px;
  background: radial-gradient(circle at 35% 35%, var(--c-primary-soft), transparent 72%);
  border-radius: 58% 42% 55% 45% / 48% 60% 40% 52%;
  animation: blobFloat 20s ease-in-out infinite alternate;
}
.blob-2 {
  width: 420px; height: 420px; top: 28%; left: -180px;
  background: radial-gradient(circle at 40% 40%, var(--c-secondary-soft), transparent 70%);
  border-radius: 40% 60% 63% 37% / 55% 40% 60% 45%;
  animation: blobFloat 26s ease-in-out infinite alternate-reverse;
}
.blob-3 {
  width: 360px; height: 360px; bottom: -120px; right: 8%;
  background: radial-gradient(circle at 50% 50%, var(--c-accent-soft), transparent 70%);
  border-radius: 63% 37% 42% 58% / 40% 55% 45% 60%;
  animation: blobFloat 23s ease-in-out infinite alternate;
}
.blob-4 {
  width: 280px; height: 280px; bottom: 16%; left: 20%;
  background: radial-gradient(circle at 40% 60%, var(--c-primary-softer), transparent 72%);
  border-radius: 50% 50% 60% 40% / 60% 45% 55% 40%;
  animation: blobFloat 30s ease-in-out infinite alternate-reverse;
}

@keyframes blobFloat {
  0%   { transform: translate(0, 0) rotate(0deg) scale(1); }
  100% { transform: translate(30px, -24px) rotate(8deg) scale(1.06); }
}

main { position: relative; z-index: 1; }

/* =====================================================================
   通用卡片 / 按钮
   ===================================================================== */
.card {
  background: var(--c-surface);
  border: 1px solid var(--c-line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 22px;
  transition: transform .25s cubic-bezier(.34, 1.3, .64, 1), box-shadow .25s;
}
.card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); }

.btn {
  border: none;
  border-radius: 999px;
  font-weight: 700;
  font-size: 15px;
  padding: 11px 22px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: transform .16s cubic-bezier(.34, 1.56, .64, 1), box-shadow .2s, background .2s, color .2s, border-color .2s;
  will-change: transform;
}
.btn:active { transform: scale(.95); }
.btn-lg { padding: 15px 30px; font-size: 17px; }
.btn-sm { padding: 7px 16px; font-size: 14px; }

.btn-primary { background: var(--c-primary); color: #fff; box-shadow: 0 8px 20px rgba(62, 121, 163, .28); }
.btn-primary:hover { background: #376d94; }
.btn-secondary { background: var(--c-secondary); color: #fff; }
.btn-accent { background: var(--c-accent); color: #fff; box-shadow: 0 10px 24px rgba(80, 57, 198, .3); }
.btn-accent:hover { box-shadow: 0 14px 30px rgba(80, 57, 198, .4); transform: translateY(-1px); }
.btn-ghost { background: transparent; color: var(--c-primary); border: 2px solid var(--c-primary); }
.btn-ghost:hover { background: var(--c-primary-soft); }
.btn-danger { background: var(--c-accent); color: #fff; box-shadow: 0 8px 20px rgba(80, 57, 198, .28); }
.btn-danger:hover { filter: brightness(1.08); }

/* =====================================================================
   页头 / 顶部导航
   ===================================================================== */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  height: var(--header-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 0 clamp(18px, 4vw, 40px);
  background: rgba(248, 250, 251, .82);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(219, 225, 230, .6);
}
.logo {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--c-text);
}
.logo-mark {
  font-size: 26px;
  display: grid;
  place-items: center;
  width: 42px; height: 42px;
  border-radius: 46% 54% 55% 45% / 52% 44% 56% 48%;
  background: linear-gradient(135deg, var(--c-primary-soft), var(--c-secondary-soft));
}
.logo-text { font-family: var(--font-head); font-weight: 700; font-size: 19px; letter-spacing: .5px; }

.topnav { display: flex; gap: 6px; }
.nav-btn {
  background: transparent;
  border: none;
  font-family: var(--font-head);
  font-weight: 600;
  font-size: 15px;
  color: var(--c-text2);
  padding: 9px 16px;
  border-radius: 999px;
  transition: background .2s, color .2s;
}
.nav-btn:hover { color: var(--c-primary); background: var(--c-primary-soft); }
.nav-btn.active { color: #fff; background: var(--c-primary); box-shadow: 0 6px 16px rgba(62, 121, 163, .3); }

.header-cta { white-space: nowrap; }

/* =====================================================================
   页面切换
   ===================================================================== */
.page {
  display: none;
  max-width: 1120px;
  margin: 0 auto;
  padding: 34px clamp(16px, 4vw, 36px) 90px;
  animation: pageIn .42s cubic-bezier(.22, 1, .36, 1);
}
.page.active { display: block; }

@keyframes pageIn {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: translateY(0); }
}

.page-head { margin-bottom: 26px; }
.page-head h1 { font-size: clamp(26px, 4vw, 34px); color: var(--c-text); }
.page-head p { color: var(--c-text2); margin-top: 6px; }

/* =====================================================================
   首页 Hero
   ===================================================================== */
.hero {
  display: grid;
  grid-template-columns: 1.15fr .85fr;
  gap: 30px;
  align-items: center;
  padding: 28px 0 40px;
}
.hero-chip {
  display: inline-block;
  font-family: var(--font-head);
  font-size: 14px;
  font-weight: 600;
  color: var(--c-primary);
  background: var(--c-primary-soft);
  border: 1px solid rgba(62, 121, 163, .25);
  padding: 6px 14px;
  border-radius: 999px;
  margin-bottom: 18px;
}
.hero-copy h1 {
  font-size: clamp(34px, 5.4vw, 54px);
  color: var(--c-text);
  margin-bottom: 14px;
}
.hero-copy > p { color: var(--c-text2); font-size: 16.5px; margin-bottom: 26px; }
.hero-actions { display: flex; gap: 14px; flex-wrap: wrap; margin-bottom: 30px; }

.hero-stats { display: flex; gap: 26px; flex-wrap: wrap; }
.stat { display: flex; flex-direction: column; align-items: center; }
.stat b {
  font-family: var(--font-head);
  font-size: 30px;
  font-weight: 700;
  color: var(--c-accent);
  background: linear-gradient(135deg, var(--c-primary), var(--c-accent));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}
.stat span { font-size: 13px; color: var(--c-text2); }

.hero-visual { display: grid; place-items: center; }
.mascot-blob {
  position: relative;
  width: min(330px, 78vw);
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  background: linear-gradient(140deg, var(--c-primary-soft), var(--c-secondary-soft) 55%, var(--c-accent-soft));
  border-radius: 46% 54% 60% 40% / 50% 44% 56% 50%;
  animation: blobFloat 9s ease-in-out infinite alternate;
  box-shadow: var(--shadow-lg);
}
.mascot { font-size: clamp(90px, 12vw, 130px); animation: bob 3.2s ease-in-out infinite; }
.float-emoji { position: absolute; font-size: 28px; animation: bob 4s ease-in-out infinite; }
.float-emoji.e1 { top: 10%; left: 8%; animation-delay: .3s; }
.float-emoji.e2 { top: 18%; right: 10%; animation-delay: 1.1s; }
.float-emoji.e3 { bottom: 16%; left: 6%; animation-delay: 1.8s; }
.float-emoji.e4 { bottom: 10%; right: 16%; animation-delay: .7s; }
.float-emoji.e5 { top: 46%; right: 2%; animation-delay: 2.3s; }

@keyframes bob {
  0%, 100% { transform: translateY(0) rotate(-2deg); }
  50%      { transform: translateY(-12px) rotate(3deg); }
}

/* =====================================================================
   首页区块
   ===================================================================== */
.home-block { margin-top: 44px; }
.block-title {
  font-size: 26px;
  color: var(--c-text);
  margin-bottom: 18px;
  position: relative;
  display: inline-block;
}
.block-title::after {
  content: '';
  position: absolute;
  left: 0; bottom: -4px;
  width: 46px; height: 8px;
  border-radius: 50%;
  background: linear-gradient(90deg, var(--c-primary), var(--c-accent));
  opacity: .25;
}

.feature-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 18px;
}
.feature { text-align: left; }
.feature-ico {
  width: 54px; height: 54px;
  display: grid;
  place-items: center;
  font-size: 26px;
  border-radius: 48% 52% 55% 45% / 50% 44% 56% 50%;
  background: var(--tint, var(--c-primary-soft));
  margin-bottom: 14px;
}
.feature h3 { font-size: 18px; margin-bottom: 6px; }
.feature p { color: var(--c-text2); font-size: 14px; }

.concept-chips { display: flex; flex-wrap: wrap; gap: 12px; margin-bottom: 20px; }
.chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-head);
  font-weight: 600;
  font-size: 14px;
  color: var(--c-text);
  padding: 9px 16px;
  border-radius: 999px;
  border: 1px solid var(--c-line);
  background: var(--c-surface);
  box-shadow: var(--shadow);
}
.chip i {
  font-style: normal;
  font-size: 12.5px;
  color: var(--c-text2);
  background: var(--c-primary-softer);
  padding: 2px 9px;
  border-radius: 999px;
}

.course-teaser { margin-top: 6px; }
.teaser-next, .teaser-done {
  display: flex;
  align-items: center;
  gap: 18px;
  flex-wrap: wrap;
}
.teaser-emoji {
  font-size: 40px;
  width: 72px; height: 72px;
  display: grid;
  place-items: center;
  border-radius: 46% 54% 60% 40% / 50% 44% 56% 50%;
  background: var(--c-accent-soft);
  flex-shrink: 0;
}
.teaser-next h3, .teaser-done h3 { font-size: 18px; margin-bottom: 4px; }
.teaser-next p, .teaser-done p { color: var(--c-text2); font-size: 14px; }
.course-teaser .btn { margin-left: auto; }

/* =====================================================================
   课程页
   ===================================================================== */
.course-list { display: flex; flex-direction: column; gap: 24px; }

.concept-section { padding: 26px; }
.concept-head {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 18px;
  flex-wrap: wrap;
}
.concept-ico {
  width: 54px; height: 54px;
  display: grid;
  place-items: center;
  font-size: 26px;
  border-radius: 48% 52% 55% 45% / 55% 45% 55% 45%;
  background: var(--tint, var(--c-primary-soft));
  flex-shrink: 0;
}
.concept-title { flex: 1; min-width: 180px; }
.concept-title h3 { font-size: 20px; }
.concept-title p { color: var(--c-text2); font-size: 13.5px; margin-top: 2px; }
.concept-progress {
  font-family: var(--font-head);
  font-weight: 700;
  font-size: 15px;
  color: var(--c-primary);
  background: var(--c-primary-soft);
  padding: 5px 14px;
  border-radius: 999px;
}

.level-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 14px;
}
.level-card {
  display: flex;
  align-items: center;
  gap: 14px;
  border: 1.5px solid var(--c-line);
  border-radius: var(--radius-s);
  padding: 16px;
  background: var(--c-surface);
  cursor: pointer;
  transition: transform .22s cubic-bezier(.34, 1.3, .64, 1), box-shadow .22s, border-color .22s;
}
.level-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); border-color: var(--c-primary); }
.level-card.is-locked { opacity: .6; cursor: not-allowed; }
.level-card.is-locked:hover { transform: none; box-shadow: none; border-color: var(--c-line); }

.level-emoji {
  font-size: 28px;
  width: 52px; height: 52px;
  display: grid;
  place-items: center;
  border-radius: 46% 54% 58% 42% / 50% 44% 56% 50%;
  background: var(--c-primary-soft);
  flex-shrink: 0;
}
.is-done .level-emoji { background: linear-gradient(140deg, var(--c-primary-soft), var(--c-secondary-soft)); }
.is-locked .level-emoji { background: var(--c-primary-softer); filter: grayscale(.5); }

.level-meta { flex: 1; min-width: 0; }
.level-meta h4 { font-size: 15.5px; margin-bottom: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.level-meta p { color: var(--c-text2); font-size: 12.5px; }
.level-stars { font-size: 13px; letter-spacing: 1px; margin-top: 2px; }
.level-stars i { font-style: normal; }
.level-btn { white-space: nowrap; }
.level-btn[aria-disabled] { pointer-events: none; }

/* =====================================================================
   编程乐园
   ===================================================================== */
.play-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; flex-wrap: wrap; }
.level-pills { display: flex; gap: 8px; flex-wrap: wrap; }
.pill {
  min-width: 38px; height: 38px;
  border-radius: 999px;
  border: 1.5px solid var(--c-line);
  background: var(--c-surface);
  color: var(--c-text2);
  font-family: var(--font-head);
  font-weight: 700;
  transition: all .2s;
}
.pill:hover { border-color: var(--c-primary); color: var(--c-primary); }
.pill.active { background: var(--c-primary); border-color: var(--c-primary); color: #fff; box-shadow: 0 6px 16px rgba(62,121,163,.3); }

.playground-layout {
  display: grid;
  grid-template-columns: 250px minmax(0, 1fr) 300px;
  gap: 18px;
  align-items: start;
}

/* ---- 积木库 ---- */
.palette h3, .program-head h3 { font-size: 17px; margin-bottom: 4px; }
.palette-hint { font-size: 12.5px; color: var(--c-text2); margin-bottom: 14px; }
.palette-blocks { display: flex; flex-direction: column; gap: 12px; }

.pblock {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  font-family: var(--font-head);
  font-weight: 700;
  font-size: 15px;
  color: #fff;
  padding: 12px 14px;
  border-radius: 18px;
  box-shadow: 0 8px 18px rgba(27, 37, 44, .16);
  cursor: grab;
  user-select: none;
  -webkit-user-select: none;
  touch-action: none;
  transition: transform .18s cubic-bezier(.34, 1.56, .64, 1), filter .2s;
}
.pblock:active { cursor: grabbing; }
.pblock:hover { transform: translateY(-2px) rotate(-1deg); filter: brightness(1.06); }
.pblock-icon { font-size: 19px; line-height: 1; }
.pblock-label { flex: 1; }
.pblock-del {
  border: none;
  background: rgba(255,255,255,.28);
  color: #fff;
  width: 22px; height: 22px;
  border-radius: 50%;
  font-size: 12px;
  line-height: 1;
  display: grid;
  place-items: center;
  padding: 0;
  transition: background .2s;
}
.pblock-del:hover { background: rgba(255,255,255,.5); }

.pblock-move   { background: linear-gradient(135deg, #4a87b4, var(--c-primary)); }
.pblock-left   { background: linear-gradient(135deg, #6b6cc0, var(--c-secondary)); }
.pblock-right  { background: linear-gradient(135deg, #6a54d9, var(--c-accent)); }
.pblock-repeat { background: linear-gradient(135deg, #5d84b6, #6b6cc0); }
.pblock-ifwall { background: linear-gradient(135deg, #6a54d9, #4a87b4); }

/* 容器积木 */
.pblock-container {
  flex-direction: column;
  align-items: stretch;
  gap: 8px;
  padding: 12px;
}
.pblock-head { display: flex; align-items: center; gap: 8px; }
.pblock-inner {
  min-height: 58px;
  border: 2px dashed rgba(255,255,255,.55);
  border-radius: 14px;
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.pblock-inner::before {
  content: '把积木拖进来';
  font-size: 12px;
  font-weight: 600;
  opacity: .75;
  text-align: center;
}
.pblock-inner:has(.pblock)::before { display: none; }
.pblock-inner .pblock { box-shadow: none; }

/* 步数调节 */
.stepper {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(255,255,255,.22);
  border-radius: 999px;
  padding: 2px 6px;
}
.stepper button {
  border: none;
  background: rgba(255,255,255,.35);
  color: #fff;
  width: 20px; height: 20px;
  border-radius: 50%;
  font-size: 13px;
  line-height: 1;
  padding: 0;
}
.stepper .step-val { min-width: 18px; text-align: center; font-size: 14px; }

/* 拖拽幽灵 */
.drag-ghost {
  position: fixed;
  top: 0; left: 0;
  z-index: 9999;
  pointer-events: none;
  opacity: .92;
  box-shadow: 0 20px 40px rgba(27,37,44,.28);
  width: 200px;
}
.pblock.drag-ghost { transform: scale(1.05) rotate(3deg); }

/* ---- 游戏地图 ---- */
.board { display: flex; flex-direction: column; }
.board-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
}
.board-badge {
  font-family: var(--font-head);
  font-weight: 700;
  color: var(--c-accent);
  background: var(--c-accent-soft);
  padding: 5px 14px;
  border-radius: 999px;
  font-size: 14px;
}
.board-goal { color: var(--c-text2); font-size: 14px; font-family: var(--font-head); font-weight: 600; }

.grid-board {
  position: relative;
  display: grid;
  gap: 5px;
  aspect-ratio: 1;
  background: linear-gradient(160deg, var(--c-primary-softer), rgba(86,87,179,.06));
  border: 1.5px solid var(--c-line);
  border-radius: var(--radius);
  padding: 12px;
  overflow: hidden;
  touch-action: none;
}
.cell {
  border-radius: 12px;
  background: rgba(255,255,255,.65);
  border: 1px solid rgba(219,225,230,.6);
  display: grid;
  place-items: center;
  font-size: clamp(16px, 2.6vw, 22px);
  transition: background .3s;
}
.cell.deco-cell { background: rgba(255,255,255,.35); font-size: clamp(13px, 2vw, 17px); opacity: .75; }
.cell.goal-cell {
  background: linear-gradient(140deg, var(--c-accent-soft), var(--c-primary-soft));
  border-color: rgba(80,57,198,.4);
  font-size: clamp(18px, 3vw, 26px);
  animation: goalPulse 2.4s ease-in-out infinite;
}
.cell.bush-cell { background: rgba(86,87,179,.18); border-color: rgba(86,87,179,.35); }
.cell.visited { background: rgba(62,121,163,.14); }

@keyframes goalPulse {
  0%, 100% { transform: scale(1); }
  50%      { transform: scale(1.06); }
}

.char {
  position: absolute;
  left: 0; top: 0;
  width: var(--cell, 40px);
  height: var(--cell, 40px);
  z-index: 5;
  transition: left .32s cubic-bezier(.34, 1.56, .64, 1), top .32s cubic-bezier(.34, 1.56, .64, 1);
  display: grid;
  place-items: center;
}
.char-face { font-size: calc(var(--cell, 40px) * .62); line-height: 1; }
.char-arrow {
  position: absolute;
  bottom: 6%; left: 50%;
  margin-left: -5px;
  width: 0; height: 0;
  border-left: 6px solid transparent;
  border-right: 6px solid transparent;
  border-bottom: 10px solid var(--c-accent);
  transition: transform .32s cubic-bezier(.34, 1.56, .64, 1);
}
.char.pop { animation: charPop .5s cubic-bezier(.34, 1.56, .64, 1); }
@keyframes charPop {
  0%   { transform: scale(1); }
  40%  { transform: scale(1.3) rotate(8deg); }
  100% { transform: scale(1); }
}

.board-foot { margin-top: 14px; text-align: center; }
.bump-hint {
  font-size: 13.5px;
  color: var(--c-text2);
  background: var(--c-primary-soft);
  padding: 8px 16px;
  border-radius: 999px;
  display: inline-block;
  transition: all .3s;
}
.bump-hint.bump { color: var(--c-accent); background: var(--c-accent-soft); transform: translateX(-4px); animation: shakeX .4s; }
@keyframes shakeX {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-6px); }
  75% { transform: translateX(6px); }
}

/* ---- 程序区 ---- */
.program { display: flex; flex-direction: column; }
.program-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.block-count {
  font-family: var(--font-head);
  font-size: 13px;
  font-weight: 600;
  color: var(--c-text2);
  background: var(--c-primary-softer);
  padding: 3px 11px;
  border-radius: 999px;
}

.program-drop {
  min-height: 200px;
  border: 2px dashed var(--c-line);
  border-radius: var(--radius-s);
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  transition: border-color .25s, background .25s;
  flex: 1;
}
.program-drop.drag-over { border-color: var(--c-accent); background: var(--c-accent-soft); }
.program-drop .pblock { width: 100%; }
.program-drop .pblock-container .pblock { width: 100%; }
.drop-placeholder {
  color: var(--c-text2);
  font-size: 14px;
  text-align: center;
  padding: 30px 10px;
  opacity: .7;
  pointer-events: none;
}

.program-actions { display: flex; gap: 10px; margin-top: 14px; }
.program-actions .btn { flex: 1; justify-content: center; }

.run-result { margin-top: 12px; text-align: center; min-height: 22px; font-family: var(--font-head); font-weight: 600; font-size: 14px; }
.run-result.ok { color: var(--c-primary); }
.run-result.no { color: var(--c-accent); }

.pblock.running {
  outline: 3px solid rgba(255,255,255,.9);
  outline-offset: 2px;
  animation: runGlow 1s ease-in-out infinite alternate;
}
@keyframes runGlow {
  from { box-shadow: 0 0 0 0 rgba(255,255,255,0); }
  to   { box-shadow: 0 0 18px 2px rgba(255,255,255,.55); }
}

/* =====================================================================
   学习进度
   ===================================================================== */
.progress-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 18px; flex-wrap: wrap; }
.view-toggle { display: flex; gap: 6px; background: var(--c-surface); border: 1px solid var(--c-line); border-radius: 999px; padding: 5px; box-shadow: var(--shadow); }
.vt-btn {
  border: none;
  background: transparent;
  font-family: var(--font-head);
  font-weight: 600;
  font-size: 14px;
  color: var(--c-text2);
  padding: 9px 18px;
  border-radius: 999px;
  transition: all .22s;
}
.vt-btn.active { background: var(--c-primary); color: #fff; box-shadow: 0 6px 14px rgba(62,121,163,.3); }

.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 16px;
  margin-bottom: 18px;
}
.stat-card {
  background: var(--c-surface);
  border: 1px solid var(--c-line);
  border-radius: var(--radius);
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  box-shadow: var(--shadow);
  transition: transform .22s;
}
.stat-card:hover { transform: translateY(-3px); }
.stat-ico { font-size: 22px; }
.stat-card b { font-family: var(--font-head); font-size: 28px; color: var(--c-text); }
.stat-card em { font-style: normal; color: var(--c-text2); font-size: 13.5px; }

.progress-stack { display: flex; flex-direction: column; gap: 18px; }

.name-card { display: flex; align-items: center; gap: 16px; }
.name-emoji {
  font-size: 30px;
  width: 60px; height: 60px;
  display: grid;
  place-items: center;
  border-radius: 48% 52% 55% 45% / 55% 45% 55% 45%;
  background: linear-gradient(140deg, var(--c-primary-soft), var(--c-accent-soft));
  flex-shrink: 0;
}
.name-card p { font-size: 13px; color: var(--c-text2); }
.name-card h3 { font-size: 22px; }
.name-card .btn { margin-left: auto; }
.name-input {
  font-family: var(--font-head);
  font-size: 20px;
  font-weight: 700;
  color: var(--c-text);
  border: 2px solid var(--c-primary);
  border-radius: 12px;
  padding: 4px 10px;
  width: 180px;
  outline: none;
}

.card-head { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; margin-bottom: 16px; flex-wrap: wrap; }
.card-head h3 { font-size: 18px; }
.card-head p { font-size: 13px; color: var(--c-text2); }

.mbar { margin-bottom: 14px; }
.mbar:last-child { margin-bottom: 0; }
.mbar-head { display: flex; justify-content: space-between; font-family: var(--font-head); font-size: 14px; font-weight: 600; margin-bottom: 7px; }
.mbar-head b { color: var(--c-text2); font-size: 13px; }
.mbar-track {
  height: 14px;
  border-radius: 999px;
  background: var(--c-primary-softer);
  overflow: hidden;
}
.mbar-track i {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: var(--c-primary);
  transition: width .8s cubic-bezier(.22, 1, .36, 1);
}

/* 成就 */
.ach-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 12px; }
.ach {
  display: flex;
  align-items: center;
  gap: 10px;
  border: 1px solid var(--c-line);
  border-radius: var(--radius-s);
  padding: 12px;
  background: var(--c-surface);
  opacity: .45;
  filter: grayscale(.7);
  transition: all .22s;
}
.ach.earned { opacity: 1; filter: none; border-color: rgba(62,121,163,.35); background: linear-gradient(140deg, #fff, var(--c-primary-softer)); }
.ach-ico { font-size: 24px; }
.ach b { display: block; font-family: var(--font-head); font-size: 14px; }
.ach p { font-size: 12px; color: var(--c-text2); }
.ach-check { margin-left: auto; color: var(--c-primary); font-weight: 700; }

/* 家长报告 */
.report-overview {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  background: linear-gradient(135deg, var(--c-surface), var(--c-primary-soft));
}
.report-overview h3 { font-size: 21px; }
.report-overview p { color: var(--c-text2); font-size: 14px; margin-top: 4px; }
.ro-score { text-align: center; }
.ro-score b {
  display: block;
  font-family: var(--font-head);
  font-size: 40px;
  background: linear-gradient(135deg, var(--c-primary), var(--c-accent));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}
.ro-score span { font-size: 13px; color: var(--c-text2); }

.week-chart { display: flex; align-items: flex-end; gap: 14px; height: 160px; padding-top: 10px; }
.wbar-col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; height: 100%; justify-content: flex-end; }
.wbar-track { width: 100%; max-width: 44px; height: 118px; border-radius: 999px; background: var(--c-primary-softer); display: flex; align-items: flex-end; overflow: hidden; }
.wbar-track i {
  width: 100%;
  border-radius: 999px;
  background: linear-gradient(180deg, var(--c-accent), var(--c-primary));
  height: 0;
  transition: height .9s cubic-bezier(.22, 1, .36, 1);
}
.wbar-val { font-family: var(--font-head); font-size: 12px; font-weight: 700; color: var(--c-primary); }
.wbar-day { font-size: 12px; color: var(--c-text2); }

.advice-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.advice-list li {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  background: var(--c-primary-softer);
  border-radius: var(--radius-s);
  padding: 12px 14px;
  font-size: 14px;
}
.advice-list li b { font-family: var(--font-head); }

.session-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.session-list li {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 14px;
  border: 1px solid var(--c-line);
  border-radius: var(--radius-s);
  font-size: 13.5px;
}
.session-list li time { color: var(--c-text2); white-space: nowrap; }

.danger-card h3 { font-size: 17px; margin-bottom: 6px; }
.danger-card p { font-size: 13.5px; color: var(--c-text2); margin-bottom: 14px; }

/* =====================================================================
   底部导航（移动端）
   ===================================================================== */
.tabbar {
  display: none;
  position: fixed;
  bottom: 0; left: 0; right: 0;
  z-index: 60;
  background: rgba(255,255,255,.9);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-top: 1px solid var(--c-line);
  padding: 8px 12px calc(8px + env(safe-area-inset-bottom));
  justify-content: space-around;
}
.tab-btn {
  background: transparent;
  border: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  font-family: var(--font-head);
  font-size: 12px;
  font-weight: 600;
  color: var(--c-text2);
  padding: 4px 10px;
  border-radius: 16px;
  transition: color .2s, transform .2s;
}
.tab-ico { font-size: 22px; line-height: 1; transition: transform .2s; }
.tab-btn.active { color: var(--c-accent); }
.tab-btn.active .tab-ico { transform: translateY(-2px) scale(1.12); }

/* =====================================================================
   Toast / Modal / Confetti
   ===================================================================== */
.toast {
  position: fixed;
  left: 50%;
  bottom: 96px;
  transform: translateX(-50%) translateY(20px);
  z-index: 100;
  background: var(--c-text);
  color: #fff;
  font-family: var(--font-head);
  font-weight: 600;
  font-size: 14.5px;
  padding: 12px 22px;
  border-radius: 999px;
  opacity: 0;
  pointer-events: none;
  transition: all .3s cubic-bezier(.34, 1.56, .64, 1);
  box-shadow: 0 12px 30px rgba(27,37,44,.28);
  max-width: 86vw;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

.modal {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: grid;
  place-items: center;
  background: rgba(27,37,44,.42);
  backdrop-filter: blur(4px);
  animation: fadeIn .25s;
}
.modal-card {
  position: relative;
  width: min(420px, 90vw);
  background: var(--c-surface);
  border-radius: var(--radius);
  border: 1px solid var(--c-line);
  box-shadow: var(--shadow-lg);
  padding: 30px 26px 26px;
  text-align: center;
  animation: modalIn .4s cubic-bezier(.34, 1.56, .64, 1);
}
.modal-close {
  position: absolute;
  top: 14px; right: 14px;
  width: 32px; height: 32px;
  border: none;
  border-radius: 50%;
  background: var(--c-primary-softer);
  color: var(--c-text2);
  font-size: 16px;
  transition: background .2s;
}
.modal-close:hover { background: var(--c-primary-soft); color: var(--c-text); }

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes modalIn {
  from { opacity: 0; transform: translateY(24px) scale(.94); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

.success-stars { font-size: 42px; letter-spacing: 4px; margin-bottom: 6px; animation: starPop .6s cubic-bezier(.34, 1.56, .64, 1); }
@keyframes starPop {
  0% { transform: scale(0) rotate(-30deg); }
  70% { transform: scale(1.25) rotate(8deg); }
  100% { transform: scale(1) rotate(0); }
}
.modal-card h2 { font-size: 26px; margin-bottom: 8px; }
.modal-card > p { color: var(--c-text2); font-size: 15px; margin-bottom: 14px; }
.ach-line {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-head);
  font-weight: 700;
  color: var(--c-accent);
  background: var(--c-accent-soft);
  padding: 8px 18px;
  border-radius: 999px;
  margin-bottom: 18px;
}
.modal-actions { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }

.confetti { position: fixed; inset: 0; pointer-events: none; z-index: 95; overflow: hidden; }
.confetti i {
  position: absolute;
  top: -30px;
  border-radius: 3px;
  opacity: .9;
  animation: confettiFall linear forwards;
}
@keyframes confettiFall {
  0%   { transform: translateY(0) translateX(0) rotate(0deg); }
  100% { transform: translateY(110vh) translateX(var(--dx, 0px)) rotate(720deg); }
}

/* =====================================================================
   响应式
   ===================================================================== */
@media (max-width: 960px) {
  .playground-layout {
    grid-template-columns: 1fr;
  }
  .palette-blocks {
    flex-direction: row;
    overflow-x: auto;
    padding-bottom: 8px;
  }
  .palette .pblock { width: auto; min-width: 132px; flex-shrink: 0; }
  .palette .pblock-container { min-width: 190px; }
  .program-drop { min-height: 150px; }
  .hero { grid-template-columns: 1fr; }
  .hero-visual { order: -1; }
  .hero-visual .mascot-blob { width: min(230px, 60vw); }
}

@media (max-width: 720px) {
  .topnav, .header-cta { display: none; }
  .tabbar { display: flex; }
  .page { padding-bottom: 120px; }
  .site-header { justify-content: center; }
  .toast { bottom: 86px; }
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
  .level-grid { grid-template-columns: 1fr; }
  .level-card { padding: 14px; }
  .week-chart { gap: 8px; }
  .grid-board { padding: 8px; gap: 4px; }
  .play-head { flex-direction: column; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001s !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001s !important;
  }
}
