/* ============================================================
   小朋友学习乐园 · 儿童向设计系统
   原则：大按钮（≥96px 触达区）、大 emoji + 大字、玩具式按压反馈、
   学科色彩分区（英语=蓝绿 / 语文=橙 / 数学=紫）、层级清晰可返回。
   ============================================================ */

:root {
  --bg: #fdf6e9;
  --card: #ffffff;
  --ink: #3b3630;
  --muted: #8d8375;
  --line: #f0e6d4;

  --english: #14b8a6;
  --english-deep: #0c8f80;
  --english-soft: #d9f6f1;
  --chinese: #fb923c;
  --chinese-deep: #e2761b;
  --chinese-soft: #ffedd5;
  --math: #a78bfa;
  --math-deep: #8b5cf6;
  --math-soft: #ede9fe;

  --play: #4ade80;
  --play-deep: #22b45e;
  --danger: #ef4444;
  --danger-soft: #fee2e2;

  --radius: 24px;
  --radius-sm: 16px;
  --shadow-toy: 0 6px 0 rgba(0, 0, 0, 0.14);
  --shadow-card: 0 10px 24px rgba(120, 90, 30, 0.1);
}

* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB",
    "Microsoft YaHei", "Noto Sans CJK SC", sans-serif;
  background:
    radial-gradient(900px 420px at 85% -8%, rgba(20, 184, 166, 0.1), transparent 60%),
    radial-gradient(700px 380px at -10% 30%, rgba(251, 146, 60, 0.08), transparent 55%),
    var(--bg);
  color: var(--ink);
  min-height: 100vh;
  -webkit-tap-highlight-color: transparent;
}

body.player-page { overscroll-behavior: none; }

.wrap {
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 20px;
}

button {
  font-family: inherit;
  touch-action: manipulation;
  cursor: pointer;
}

a[data-route] { touch-action: manipulation; }

:focus-visible {
  outline: 4px solid rgba(20, 184, 166, 0.55);
  outline-offset: 2px;
  border-radius: 12px;
}

/* ---------- 顶栏：🏠 + 面包屑 + 右侧槽位 ---------- */

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(8px);
  border-bottom: 2px solid var(--line);
}

.topbar .wrap {
  display: flex;
  align-items: center;
  gap: 14px;
  min-height: 76px;
}

.btn-home {
  flex: none;
  width: 58px;
  height: 58px;
  border-radius: 50%;
  border: none;
  background: #fff;
  box-shadow: var(--shadow-toy);
  font-size: 28px;
  line-height: 1;
  display: grid;
  place-items: center;
  text-decoration: none;
  transition: transform 0.08s ease, box-shadow 0.08s ease;
}

.btn-home:active {
  transform: translateY(4px);
  box-shadow: 0 2px 0 rgba(0, 0, 0, 0.14);
}

.crumb {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  font-size: 19px;
  min-width: 0;
}

.crumb .sep { color: var(--muted); font-size: 16px; }

.crumb-link {
  color: var(--muted);
  text-decoration: none;
  font-weight: 600;
  padding: 6px 10px;
  border-radius: 12px;
}

.crumb-link:hover { color: var(--ink); background: var(--line); }

.crumb-now { color: var(--ink); font-weight: 800; padding: 6px 4px; }

.head-right {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.story-title {
  font-size: 20px;
  font-weight: 800;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.btn-fullscreen {
  flex: none;
  width: 52px;
  height: 52px;
  border-radius: 18px;
  border: none;
  background: var(--english-soft);
  color: var(--english-deep);
  font-size: 24px;
  box-shadow: var(--shadow-toy);
  transition: transform 0.08s ease, box-shadow 0.08s ease;
}

.btn-fullscreen:active {
  transform: translateY(3px);
  box-shadow: 0 2px 0 rgba(0, 0, 0, 0.14);
}

/* ---------- 音量控制 ---------- */

.volume-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: none;
}

.btn-vol {
  width: 52px;
  height: 52px;
  border-radius: 18px;
  border: none;
  background: var(--english-soft);
  font-size: 24px;
  box-shadow: var(--shadow-toy);
  transition: transform 0.08s ease, box-shadow 0.08s ease;
}

.btn-vol:active {
  transform: translateY(3px);
  box-shadow: 0 2px 0 rgba(0, 0, 0, 0.14);
}

.volume-slider {
  -webkit-appearance: none;
  appearance: none;
  width: 130px;
  height: 40px;
  background: transparent;
  cursor: pointer;
  touch-action: manipulation;
}

.volume-slider::-webkit-slider-runnable-track {
  height: 12px;
  border-radius: 999px;
  background: var(--line);
}

.volume-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 30px;
  height: 30px;
  margin-top: -9px;
  border-radius: 50%;
  border: none;
  background: var(--english);
  box-shadow: 0 3px 0 rgba(0, 0, 0, 0.18);
}

.volume-slider::-moz-range-track {
  height: 12px;
  border-radius: 999px;
  background: var(--line);
}

.volume-slider::-moz-range-thumb {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: none;
  background: var(--english);
  box-shadow: 0 3px 0 rgba(0, 0, 0, 0.18);
}

/* ---------- 门户首页 ---------- */

.portal-hero {
  text-align: center;
  padding: 52px 20px 20px;
}

.hero-emoji { font-size: 64px; line-height: 1; }

.hero-title {
  margin: 14px 0 0;
  font-size: 40px;
  letter-spacing: 2px;
}

.portal-grid {
  max-width: 1080px;
  margin: 28px auto 12px;
  padding: 0 20px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 26px;
}

.subject-card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 240px;
  padding: 30px 20px;
  border-radius: var(--radius);
  border: none;
  text-decoration: none;
  box-shadow: var(--shadow-toy);
  transition: transform 0.1s ease, box-shadow 0.1s ease;
}

.subject-card:active {
  transform: translateY(5px);
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.14);
}

.subject-english { background: var(--english); }
.subject-chinese { background: var(--chinese); }
.subject-math { background: var(--math); }

.subject-card .sc-emoji { font-size: 72px; line-height: 1; }

.subject-card .sc-name {
  color: #fff;
  font-size: 32px;
  font-weight: 800;
  letter-spacing: 6px;
}

.subject-card .sc-sub {
  color: rgba(255, 255, 255, 0.85);
  font-size: 16px;
  font-weight: 600;
}

.subject-card .sc-badge {
  position: absolute;
  top: 16px;
  right: 16px;
  background: rgba(255, 255, 255, 0.92);
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
  padding: 6px 14px;
  border-radius: 999px;
}

.subject-card.is-disabled {
  filter: grayscale(0.35);
  opacity: 0.82;
}

.page-foot {
  text-align: center;
  color: var(--muted);
  font-size: 14px;
  padding: 36px 20px 44px;
}

/* ---------- 学科页 / 占位页 ---------- */

.main-pad { padding: 30px 20px 48px; }

.section-title {
  margin: 10px 0 18px;
  font-size: 24px;
  font-weight: 800;
}

.material-card {
  display: flex;
  align-items: center;
  gap: 20px;
  width: 100%;
  padding: 26px 26px;
  border-radius: var(--radius);
  border: none;
  text-decoration: none;
  background: var(--card);
  box-shadow: var(--shadow-card), var(--shadow-toy);
  transition: transform 0.1s ease, box-shadow 0.1s ease;
}

.material-card:active {
  transform: translateY(4px);
  box-shadow: 0 2px 0 rgba(0, 0, 0, 0.12);
}

.mc-emoji {
  flex: none;
  width: 92px;
  height: 92px;
  border-radius: 26px;
  background: var(--english-soft);
  display: grid;
  place-items: center;
  font-size: 52px;
}

.mc-body { min-width: 0; flex: 1; }

.mc-name { font-size: 28px; font-weight: 800; }

.mc-sub { color: var(--muted); font-size: 16px; font-weight: 600; margin-top: 6px; }

.mc-go {
  flex: none;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--english);
  color: #fff;
  font-size: 20px;
  display: grid;
  place-items: center;
}

.center-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 55vh;
}

.soon-card {
  text-align: center;
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow-card);
  padding: 56px 64px;
}

.soon-card .sc-emoji { font-size: 72px; }
.soon-card .sc-name { font-size: 28px; font-weight: 800; margin-top: 16px; }
.soon-card .sc-sub { color: var(--muted); font-size: 17px; margin-top: 8px; }

/* ---------- 伊索寓言页：大标签 + 网格/音频 ---------- */

.tabs {
  display: flex;
  gap: 14px;
  margin: 6px 0 22px;
}

.tab {
  flex: 1;
  max-width: 320px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 68px;
  border-radius: 999px;
  border: 3px solid var(--english);
  background: #fff;
  color: var(--english-deep);
  font-size: 22px;
  font-weight: 800;
  box-shadow: var(--shadow-toy);
  transition: transform 0.08s ease, box-shadow 0.08s ease;
}

.tab:active {
  transform: translateY(3px);
  box-shadow: 0 2px 0 rgba(0, 0, 0, 0.14);
}

.tab.is-on {
  background: var(--english);
  color: #fff;
}

.tab-emoji { font-size: 26px; line-height: 1; }

.hint {
  color: var(--muted);
  font-size: 17px;
  font-weight: 600;
  margin: 0 0 18px;
}

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

.card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 12px;
  min-height: 158px;
  padding: 20px;
  border-radius: var(--radius);
  border: none;
  background: var(--card);
  box-shadow: var(--shadow-toy);
  user-select: none;
  transition: transform 0.08s ease, box-shadow 0.08s ease;
}

.card:active {
  transform: translateY(4px);
  box-shadow: 0 2px 0 rgba(0, 0, 0, 0.14);
}

.card .badge {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 21px;
  font-weight: 800;
  color: #fff;
  background: hsl(var(--hue, 160) 55% 45%);
}

.card .t {
  font-size: 19px;
  font-weight: 700;
  line-height: 1.35;
  text-align: left;
}

.card .go {
  margin-top: auto;
  color: var(--english-deep);
  font-size: 15px;
  font-weight: 800;
}

.audioList {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.audioList li {
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: var(--card);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-toy);
  padding: 18px 20px;
}

.audioList .label {
  font-size: 19px;
  font-weight: 700;
  overflow-wrap: anywhere;
}

.audioList audio { width: 100%; height: 44px; }

/* ---------- 播放页 ---------- */

#stage {
  position: relative;
  width: 100%;
  height: calc(100dvh - 78px);
  background: #14120f;
  overflow: hidden;
}

#stage:fullscreen { height: 100dvh; }

.loading-note {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: #d8cfc0;
  font-size: 20px;
  font-weight: 700;
}

.start-overlay {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgba(20, 18, 15, 0.55);
  backdrop-filter: blur(3px);
}

.start-overlay .inner {
  text-align: center;
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow-card);
  padding: 40px 52px;
}

.btn-play {
  width: 128px;
  height: 128px;
  border-radius: 50%;
  border: none;
  background: var(--play);
  color: #fff;
  font-size: 54px;
  box-shadow: 0 8px 0 var(--play-deep);
  transition: transform 0.08s ease, box-shadow 0.08s ease;
}

.btn-play:active {
  transform: translateY(6px);
  box-shadow: 0 2px 0 var(--play-deep);
}

.overlay-name {
  margin: 22px 0 0;
  font-size: 28px;
  font-weight: 800;
}

.start-overlay .sub1 {
  color: var(--muted);
  font-size: 16px;
  font-weight: 600;
  margin: 10px 0 0;
}

.error-note {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  max-width: min(86vw, 560px);
  background: var(--danger-soft);
  color: #991b1b;
  border-radius: var(--radius-sm);
  padding: 22px 26px;
  font-size: 17px;
  font-weight: 700;
  white-space: pre-wrap;
  text-align: center;
  z-index: 5;
}

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

@media (max-width: 640px) {
  .hero-title { font-size: 30px; }
  .portal-grid { gap: 18px; }
  .subject-card { min-height: 190px; }
  .subject-card .sc-emoji { font-size: 56px; }
  .subject-card .sc-name { font-size: 26px; letter-spacing: 4px; }
  .tabs { flex-direction: column; }
  .tab { max-width: none; width: 100%; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
  .crumb { font-size: 16px; }
  .story-title { font-size: 17px; }
  .volume-slider { width: 90px; }
}
