/* ============================================================
   英语跟读乐园 · 样式表
   支持 PC 与手机(H5)，明亮活泼的学生风格
   ============================================================ */

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

:root {
  --ink:      #1d2b53;
  --muted:    #64748f;
  --accent:   #4f7bfd;
  --accent2:  #7a5bff;
  --pink:     #ff5fa0;
  --mint:     #21bd85;
  --sun:      #ffab2e;
  --line:     #e5ebfa;
  --bg-card:  #ffffff;
  --radius:   22px;
  --shadow-sm: 0 6px 18px -8px rgba(47, 91, 234, .18);
  --shadow-lg: 0 18px 44px -14px rgba(47, 91, 234, .30);
}

html { scroll-behavior: smooth; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei UI",
    "Microsoft YaHei", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: var(--ink);
  background:
    radial-gradient(900px 500px at 8% -4%, #ffe9f3 0%, transparent 60%),
    radial-gradient(900px 520px at 102% 8%, #e3ecff 0%, transparent 55%),
    radial-gradient(700px 500px at 50% 110%, #e4fbff 0%, transparent 55%),
    linear-gradient(180deg, #f7faff 0%, #eef4ff 100%);
  background-attachment: fixed;
  overflow-x: hidden;
}

/* ---------- 背景装饰气泡 ---------- */
.bg-decor { position: fixed; inset: 0; z-index: 0; pointer-events: none; overflow: hidden; }
.blob { position: absolute; border-radius: 50%; filter: blur(2px); opacity: .55; }
.blob-1 { width: 300px; height: 300px; left: -110px; top: 32%; background: radial-gradient(circle at 35% 35%, #ffe3a8, #ffb6e0 70%); animation: blobFloat 16s ease-in-out infinite; }
.blob-2 { width: 260px; height: 260px; right: -90px; top: 8%; background: radial-gradient(circle at 40% 40%, #bfe3ff, #b3c9ff 72%); animation: blobFloat 19s ease-in-out infinite reverse; }
.blob-3 { width: 220px; height: 220px; left: 42%; bottom: -120px; background: radial-gradient(circle at 40% 40%, #c4ffe4, #9de6ff 72%); opacity: .4; animation: blobFloat 22s ease-in-out infinite; }
@keyframes blobFloat {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  50%      { transform: translateY(-26px) rotate(6deg); }
}

.page {
  position: relative;
  z-index: 1;
  max-width: 1080px;
  margin: 0 auto;
  padding: 22px 20px 232px;
}

/* ============================================================
   Hero 横幅
   ============================================================ */
.hero {
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  border-radius: 30px;
  padding: 36px 40px;
  color: #fff;
  background:
    radial-gradient(480px 300px at 88% -30%, rgba(255, 255, 255, .32), transparent 60%),
    radial-gradient(400px 300px at -10% 120%, rgba(122, 91, 255, .5), transparent 60%),
    linear-gradient(130deg, #4465f4 0%, #5b8def 46%, #2ec4d6 100%);
  box-shadow: var(--shadow-lg);
}
.hero::after { /* 底部柔光 */
  content: "";
  position: absolute; inset: auto 0 -60% 0; height: 80%;
  background: radial-gradient(50% 60% at 50% 0%, rgba(255, 255, 255, .20), transparent 70%);
}
.hero-inner { position: relative; z-index: 2; min-width: 0; }

.eyebrow {
  display: inline-block;
  margin: 0 0 12px;
  padding: 7px 14px;
  border-radius: 999px;
  background: rgba(255, 255, 255, .18);
  border: 1px solid rgba(255, 255, 255, .28);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: .5px;
  backdrop-filter: blur(4px);
}
.hero-title {
  margin: 0;
  font-size: clamp(32px, 5.5vw, 50px);
  line-height: 1.15;
  letter-spacing: 1px;
  text-shadow: 0 3px 14px rgba(29, 43, 83, .22);
}
.hero-sub {
  margin: 12px 0 0;
  max-width: 560px;
  font-size: clamp(14px, 1.8vw, 16px);
  line-height: 1.7;
  color: rgba(255, 255, 255, .94);
}
.chips { display: flex; flex-wrap: wrap; gap: 9px; margin-top: 18px; }
.chip {
  padding: 8px 15px;
  border-radius: 999px;
  background: rgba(255, 255, 255, .16);
  border: 1px solid rgba(255, 255, 255, .3);
  font-size: 13px;
  font-weight: 500;
}

/* Hero 右侧插画 */
.hero-art {
  position: relative;
  flex: 0 0 172px;
  height: 172px;
  z-index: 2;
}
.art-disc {
  position: absolute;
  inset: 8px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 84px;
  background: radial-gradient(circle at 32% 28%, #ffffff, #d7e4ff);
  box-shadow: inset 0 -8px 18px rgba(68, 101, 244, .25), 0 16px 30px -10px rgba(20, 40, 120, .45);
  animation: bob 4.5s ease-in-out infinite;
}
.art-face { transform: translateY(-4px); }
.bubble {
  position: absolute;
  top: -6px; right: -14px;
  padding: 6px 12px;
  border-radius: 14px 14px 14px 4px;
  background: #fff;
  color: var(--ink);
  font-size: 13px;
  font-weight: 700;
  box-shadow: 0 6px 16px -6px rgba(20, 40, 120, .4);
  animation: popIn 5s ease-in-out infinite;
}
@keyframes bob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-12px); } }
@keyframes popIn {
  0%, 62%, 100% { transform: scale(1) translateY(0); opacity: 1; }
  70% { transform: scale(1.12); }
  78% { transform: scale(.95); }
}
.deco { position: absolute; font-size: 26px; animation: decoFloat 6s ease-in-out infinite; filter: drop-shadow(0 4px 6px rgba(0,0,0,.12)); }
.deco-1 { top: -18px; right: 6px; font-size: 34px; }
.deco-2 { left: -42px; bottom: -6px; animation-delay: 1.2s; }
.deco-3 { right: -30px; bottom: -14px; font-size: 22px; animation-delay: 2.2s; }
@keyframes decoFloat {
  0%, 100% { transform: translateY(0) rotate(-4deg); }
  50%      { transform: translateY(-12px) rotate(6deg); }
}

/* ============================================================
   单元列表
   ============================================================ */
.units { margin-top: 34px; }
.section-head h2 { margin: 0; font-size: clamp(20px, 3vw, 26px); }
.section-head p { margin: 6px 0 0; color: var(--muted); font-size: 14px; }

/* ---------- 累计跟读打卡卡 ---------- */
.stat-banner {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-top: 16px;
  padding: 14px 20px;
  border-radius: 20px;
  background:
    radial-gradient(160px 90px at 100% 0%, rgba(255, 214, 107, .18), transparent 70%),
    linear-gradient(135deg, #fffdf6, #fff4e0);
  border: 2px solid #ffe3ae;
  box-shadow: var(--shadow-sm);
}
.stat-ico {
  flex: 0 0 auto;
  width: 54px; height: 54px;
  display: grid;
  place-items: center;
  font-size: 28px;
  border-radius: 50%;
  background: linear-gradient(140deg, #ffd66b, #ffab2e);
  box-shadow: 0 6px 14px -6px rgba(255, 171, 46, .6);
}
.stat-info { display: flex; flex-direction: column; line-height: 1.25; min-width: 0; }
.stat-ttl { font-size: 12px; font-weight: 600; color: #b07b16; }
.stat-time {
  font-size: clamp(22px, 3.6vw, 30px);
  font-weight: 900;
  color: #e0851a;
  letter-spacing: .5px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.stat-pulse {
  margin-left: auto;
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 7px 13px;
  border-radius: 999px;
  background: #e9f9f0;
  color: #12874f;
  font-size: 12px;
  font-weight: 700;
}
.stat-pulse i {
  width: 9px; height: 9px;
  border-radius: 50%;
  background: #2fd281;
  animation: dotPulse 1.3s ease-out infinite;
}
.stat-pulse.is-hidden { display: none; }
.stat-warn { font-size: 12px; font-weight: 700; color: #d33a2c; margin-top: 2px; }
.stat-warn.is-hidden { display: none; }
@keyframes dotPulse {
  0%   { box-shadow: 0 0 0 0 rgba(47, 210, 129, .5); }
  70%, 100% { box-shadow: 0 0 0 7px rgba(47, 210, 129, 0); }
}

.unit-grid {
  margin-top: 18px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(215px, 1fr));
  gap: 18px;
}

.unit-card {
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 24px 14px 20px;
  border: 0;
  border-radius: var(--radius);
  color: #fff;
  font-family: inherit;
  text-align: center;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: transform .2s ease, box-shadow .2s ease;
}
.unit-card::before { /* 右上角光斑 */
  content: "";
  position: absolute;
  width: 130px; height: 130px;
  right: -46px; top: -46px;
  border-radius: 50%;
  background: rgba(255, 255, 255, .18);
}
.unit-card::after { /* 底部半透明大图标水印 */
  content: attr(data-ghost);
  position: absolute;
  right: 10px; bottom: -14px;
  font-size: 66px;
  opacity: .16;
  transform: rotate(-8deg);
}
.unit-card:hover { transform: translateY(-6px); box-shadow: var(--shadow-lg); }
.unit-card:active { transform: translateY(-1px) scale(.97); }
.unit-card:focus-visible { outline: 3px solid #fff; outline-offset: 2px; }

.uc-emoji {
  position: relative;
  z-index: 1;
  width: 78px; height: 78px;
  display: grid;
  place-items: center;
  font-size: 42px;
  border-radius: 50%;
  background: rgba(255, 255, 255, .26);
  border: 2px solid rgba(255, 255, 255, .5);
  box-shadow: inset 0 -4px 10px rgba(0, 0, 0, .06), 0 6px 14px -6px rgba(0, 0, 0, .22);
  margin-bottom: 8px;
  transition: transform .2s ease;
}
.unit-card:hover .uc-emoji { transform: scale(1.1) rotate(-6deg); }

.uc-num {
  position: relative; z-index: 1;
  font-size: 20px;
  font-weight: 800;
  letter-spacing: 1px;
  text-shadow: 0 1px 4px rgba(0, 0, 0, .14);
}
.uc-cn {
  position: relative; z-index: 1;
  margin-top: 3px;
  font-size: 13px;
  opacity: .92;
}
.uc-hint {
  position: relative; z-index: 1;
  margin-top: 10px;
  padding: 5px 13px;
  border-radius: 999px;
  background: rgba(255, 255, 255, .24);
  border: 1px solid rgba(255, 255, 255, .4);
  font-size: 12px;
  opacity: .95;
  transition: opacity .2s;
}
.unit-card:not(.is-active) .uc-hint { opacity: 0; }
.unit-card:hover .uc-hint, .unit-card:focus-visible .uc-hint { opacity: .95; }

/* 正在播放：白色描边 + 顶部声波动画 */
.unit-card.is-active {
  box-shadow: 0 0 0 3px #fff, 0 0 0 6px rgba(255, 255, 255, .55), var(--shadow-lg);
  transform: translateY(-3px);
}
.unit-card.is-active .eq-mini {
  display: flex;
  position: absolute;
  top: 12px; left: 14px;
  align-items: flex-end;
  gap: 3px;
  height: 16px;
  z-index: 2;
}
.unit-card.is-active .eq-mini i {
  width: 4px;
  height: 8px;
  border-radius: 3px;
  background: #fff;
  animation: eqBar 1s ease-in-out infinite;
}
.unit-card.is-active .eq-mini i:nth-child(2) { animation-delay: .22s; }
.unit-card.is-active .eq-mini i:nth-child(3) { animation-delay: .44s; }
@keyframes eqBar { 0%, 100% { height: 5px; } 50% { height: 15px; } }
.eq-mini { display: none; }

/* 各卡片配色 */
.uc-0 { background: linear-gradient(145deg, #6db3ff, #3f7bfd); }
.uc-1 { background: linear-gradient(145deg, #ffb27a, #ff7e5f); }
.uc-2 { background: linear-gradient(145deg, #4fe0ae, #21bd85); }
.uc-3 { background: linear-gradient(145deg, #b7a4ff, #7a5bff); }
.uc-4 { background: linear-gradient(145deg, #ffd66b, #ffab2e); }
.uc-5 { background: linear-gradient(145deg, #ff9ecb, #ff5fa0); }
.uc-6 { background: linear-gradient(145deg, #63d7e6, #24aeca); }
.uc-7 { background: linear-gradient(145deg, #ffb977, #ff8f4f); }
.uc-8 { background: linear-gradient(145deg, #94a4ff, #6b7bff); }

/* ============================================================
   课文动画入口（首页）
   ============================================================ */

/* Hero 内的大按钮 */
.hero-cta {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin-top: 22px;
  padding: 14px 28px 14px 20px;
  border-radius: 999px;
  background: #fff;
  color: #3a53c9;
  font-size: 17px;
  font-weight: 800;
  text-decoration: none;
  box-shadow: 0 14px 30px -10px rgba(10, 30, 90, .5);
  transition: transform .2s ease, box-shadow .2s ease;
}
.hero-cta:hover { transform: translateY(-3px) scale(1.03); box-shadow: 0 20px 38px -12px rgba(10, 30, 90, .55); }
.hero-cta:active { transform: translateY(0) scale(.98); }
.hero-cta:focus-visible { outline: 3px solid #fff; outline-offset: 4px; }
.hc-ico {
  display: grid;
  place-items: center;
  width: 34px; height: 34px;
  border-radius: 50%;
  font-size: 18px;
  background: linear-gradient(140deg, #ffb057, #ff5f6d);
  box-shadow: inset 0 -2px 6px rgba(0, 0, 0, .12);
}
.hc-num {
  margin-left: 2px;
  padding: 3px 10px;
  border-radius: 999px;
  background: #eef2ff;
  color: #5b6bb5;
  font-size: 11.5px;
  font-weight: 800;
}
.hc-num[hidden] { display: none; }

/* 底部播放器 */
.player-shell {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 30;
  padding: 0 14px calc(14px + env(safe-area-inset-bottom));
  pointer-events: none;
}
.player {
  pointer-events: auto;
  max-width: 860px;
  margin: 0 auto;
  padding: 15px 22px 16px;
  border-radius: 26px;
  background: rgba(255, 255, 255, .92);
  -webkit-backdrop-filter: blur(16px);
  backdrop-filter: blur(16px);
  border: 1px solid rgba(255, 255, 255, .9);
  box-shadow: 0 -4px 24px -8px rgba(47, 91, 234, .12), 0 18px 40px -16px rgba(47, 91, 234, .3);
}

/* 顶部信息行 */
.p-top { display: flex; align-items: center; gap: 10px; min-width: 0; }
.p-badge {
  flex: 0 0 auto;
  padding: 5px 12px;
  border-radius: 999px;
  background: linear-gradient(120deg, var(--accent), var(--accent2));
  color: #fff;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .5px;
}
.p-badge.is-hidden { display: none; }
.p-name {
  flex: 1;
  min-width: 0;
  font-size: 15px;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
/* 等化器动画（正在播放时） */
.eq { display: flex; align-items: flex-end; gap: 3px; height: 16px; flex: 0 0 auto; }
.eq i {
  width: 4px;
  border-radius: 3px;
  background: linear-gradient(180deg, var(--accent), var(--pink));
  animation: eqBar 1s ease-in-out infinite;
}
.eq i:nth-child(2) { animation-delay: .2s; }
.eq i:nth-child(3) { animation-delay: .4s; }
.eq.is-paused i { animation-play-state: paused; height: 5px !important; }
.eq.is-hidden { display: none; }

/* 进度行 */
.p-row { display: flex; align-items: center; gap: 12px; margin-top: 10px; }
.t {
  font-size: 12px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  flex: 0 0 auto;
  min-width: 38px;
}
.t:last-child { text-align: right; }

.progress {
  position: relative;
  flex: 1;
  height: 26px;
  display: flex;
  align-items: center;
  cursor: pointer;
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
}
.p-track {
  position: absolute;
  left: 0; right: 0;
  height: 10px;
  border-radius: 999px;
  background: #e6ecfb;
}
.p-fill {
  position: absolute;
  left: 0;
  height: 10px;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--accent), #59a2ff);
  width: 0%;
}
.p-knob {
  position: absolute;
  left: 0%;
  top: 50%;
  width: 20px; height: 20px;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  background: #fff;
  border: 6px solid var(--accent);
  box-shadow: 0 2px 8px rgba(47, 91, 234, .35);
  pointer-events: none;
  transition: box-shadow .15s;
}
.progress.dragging .p-knob { box-shadow: 0 0 0 8px rgba(79, 123, 253, .15); }
.progress:hover .p-knob, .progress.dragging .p-knob { transform: translate(-50%, -50%) scale(1.18); }

/* 控制按钮 */
.p-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  margin-top: 6px;
}
.ctl {
  width: 46px; height: 46px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: #eef2ff;
  color: #44518f;
  cursor: pointer;
  transition: transform .15s, background .15s, color .15s;
}
.ctl svg { width: 20px; height: 20px; }
.ctl:hover { background: #dfe7ff; }
.ctl:active { transform: scale(.88); }
.mode-btn {
  width: auto;
  min-width: 88px;
  padding: 0 12px;
  border-radius: 999px;
  font-size: 12.5px;
  font-weight: 800;
  letter-spacing: .3px;
  font-family: inherit;
  white-space: nowrap;
}
.ctl.on { background: var(--accent); color: #fff; }
.ctl.is-danger { background: #fff1f3; color: #f2507a; }
.ctl.is-danger.on { background: linear-gradient(120deg, #ff8b60, #f2507a); color: #fff; }

.rate-btn {
  min-width: 66px;
  padding: 0 12px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: .3px;
  font-family: inherit;
  background: linear-gradient(120deg, #eef2ff, #e7fbff);
  color: #44518f;
}
.rate-btn.slow { background: #fff3e0; color: #d97b00; }
.rate-btn.fast { background: #ffe9f3; color: #e03e7d; }

.play-btn {
  width: 64px; height: 64px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: linear-gradient(140deg, #ff9a56, #ff5f6d);
  color: #fff;
  cursor: pointer;
  box-shadow: 0 12px 22px -8px rgba(255, 95, 109, .55);
  transition: transform .18s, box-shadow .18s;
}
.play-btn svg { width: 26px; height: 26px; }
.play-btn:hover { transform: scale(1.07); box-shadow: 0 16px 28px -8px rgba(255, 95, 109, .6); }
.play-btn:active { transform: scale(.92); }
.play-btn.is-loading { pointer-events: none; animation: pulseGlow .85s ease-in-out infinite; }
@keyframes pulseGlow {
  0%, 100% { box-shadow: 0 12px 22px -8px rgba(255, 95, 109, .55), 0 0 0 0 rgba(255, 95, 109, .35); }
  50% { box-shadow: 0 12px 22px -8px rgba(255, 95, 109, .55), 0 0 0 12px rgba(255, 95, 109, 0); }
}

/* 提示气泡 */
.toast {
  position: fixed;
  left: 50%;
  bottom: 176px;
  transform: translateX(-50%) translateY(12px);
  z-index: 50;
  max-width: calc(100vw - 40px);
  padding: 10px 18px;
  border-radius: 999px;
  background: rgba(29, 43, 83, .92);
  color: #fff;
  font-size: 13px;
  box-shadow: 0 8px 20px -8px rgba(0, 0, 0, .35);
  opacity: 0;
  pointer-events: none;
  transition: opacity .25s, transform .25s;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

.footer {
  margin-top: 40px;
  text-align: center;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.8;
}

/* ============================================================
   响应式：手机 / 平板
   ============================================================ */
@media (max-width: 760px) {
  .page { padding: 14px 12px 216px; }
  .hero { padding: 26px 22px 24px; border-radius: 24px; }
  .hero-art { display: none; }
  .unit-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
  .unit-card { padding: 18px 8px 16px; border-radius: 18px; }
  .uc-emoji { width: 60px; height: 60px; font-size: 32px; margin-bottom: 6px; }
  .uc-num { font-size: 16px; }
  .stat-banner { padding: 12px 14px; border-radius: 16px; gap: 11px; }
  .stat-ico { width: 44px; height: 44px; font-size: 23px; }
  .stat-time { font-size: 22px; }
  .hero-cta { width: 100%; justify-content: center; padding: 13px 20px; font-size: 16px; }
  .player-shell { padding: 0 0 calc(0px + env(safe-area-inset-bottom)); }
  .player {
    border-radius: 24px 24px 0 0;
    padding: 13px 14px calc(14px + env(safe-area-inset-bottom));
  }
  .p-name { font-size: 14px; }
  .ctl { width: 42px; height: 42px; }
  .mode-btn { min-width: 74px; padding: 0 10px; font-size: 11.5px; }
  .rate-btn { min-width: 58px; padding: 0 10px; font-size: 12px; }
  .play-btn { width: 58px; height: 58px; }
  .toast { bottom: 168px; }
}

@media (max-width: 360px) {
  .unit-card .uc-hint { font-size: 11px; padding: 4px 9px; }
  .ctl { width: 38px; height: 38px; }
  .mode-btn { min-width: 62px; font-size: 10.5px; padding: 0 8px; }
  .rate-btn { min-width: 52px; font-size: 11.5px; padding: 0 8px; }
}

/* 减弱动画偏好 */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001s !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001s !important;
  }
}
