/* 心理训练资源库 H5 —— 浅色主题（与 IDE 浅色主题一致）
 * 主色 #3B7BFF / 渐变 #4A86FF → #7FC4FF / 底色 #F4F7FC / 点缀 #2FC7A8
 */

:root {
  --brand: #3B7BFF;
  --brand-2: #7FC4FF;
  --mint: #2FC7A8;
  --bg: #F4F7FC;
  --card: #FFFFFF;
  --text: #1B2333;
  --muted: #6B7A90;
  --line: #E6EDF7;
  --radius: 16px;
  --shadow: 0 6px 20px rgba(28, 63, 124, .08);
  --shadow-lg: 0 14px 34px rgba(28, 63, 124, .14);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html {
  margin: 0;
  padding: 0;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  padding: 0;
  font-family: -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif;
  color: var(--text);
  background: #E9EEF6;
  -webkit-font-smoothing: antialiased;
  line-height: 1.5;
}

#app {
  position: relative;
  max-width: 480px;
  margin: 0 auto;
  min-height: 100vh;
  background: var(--bg);
  /* 必须用 clip 而非 hidden：hidden 会把 overflow-y 计算成 auto，#app 变成滚动容器，
     导致内部 .nav / .chips 的 position:sticky 相对 #app 而非视口，吸顶失效 */
  overflow-x: clip;
}

@media (min-width: 520px) {
  #app { box-shadow: 0 0 44px rgba(28, 63, 124, .10); }
}

a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; }
input { font-family: inherit; }

/* ---------- 视图淡入 ---------- */
.view { animation: viewFade .15s ease both; }
@keyframes viewFade { from { opacity: 0; transform: translateY(3px); } to { opacity: 1; transform: none; } }

.loading {
  padding: 90px 0;
  text-align: center;
  color: var(--muted);
  font-size: 14px;
}

/* ---------- 通用缩略图（图 + 渐变兜底） ---------- */
.thumb {
  position: relative;
  overflow: hidden;
  background: linear-gradient(150deg, #4A86FF 0%, #7FC4FF 100%);
}
.thumb .img-fb {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: rgba(255, 255, 255, .92);
}
.thumb img {
  position: relative;
  z-index: 1;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* ---------- 首页 ---------- */
.hero {
  position: relative;
  /* 自行裁剪右上角装饰圆（不依赖 #app 的 overflow-x，避免影响 sticky） */
  overflow: hidden;
  padding: calc(var(--safe-t) + 28px) 18px 52px;
  color: #fff;
  background: linear-gradient(160deg, #4A86FF 0%, #7FC4FF 100%);
  border-radius: 0 0 26px 26px;
}
.hero::after {
  content: "";
  position: absolute;
  right: -40px;
  top: -30px;
  width: 160px;
  height: 160px;
  border-radius: 50%;
  background: rgba(255, 255, 255, .12);
  pointer-events: none;
}
.hero-title {
  font-size: 23px;
  font-weight: 700;
  letter-spacing: .5px;
}
.hero-sub {
  margin-top: 8px;
  font-size: 13px;
  color: rgba(255, 255, 255, .86);
  max-width: 300px;
  line-height: 1.6;
}
.search {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 20px;
  height: 44px;
  padding: 0 14px;
  border-radius: 22px;
  background: #fff;
  box-shadow: 0 8px 22px rgba(20, 55, 120, .16);
}
.search .s-ico { color: var(--muted); display: flex; }
.search input {
  flex: 1;
  min-width: 0;
  height: 100%;
  border: none;
  outline: none;
  background: transparent;
  font-size: 14px;
  color: var(--text);
}
.search input::placeholder { color: #A8B6C9; }
.search input::-webkit-search-cancel-button { -webkit-appearance: none; }

.home-body {
  margin-top: 0;
  /* 底部留白下放到 .grid（见 .grid 注释），此处不再重复计数，避免出现 180px 死白 */
  padding: 14px 16px 0;
  position: relative;
  z-index: 2;
}

/* 继续收听（首个子元素上移，压住头图下沿；无此卡时不影响标题可读性） */
.continue {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  margin: -46px 0 20px;
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
}
.continue .thumb { width: 56px; height: 56px; border-radius: 12px; flex: 0 0 auto; }
.continue-body { flex: 1; min-width: 0; }
.continue-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--mint);
  letter-spacing: .4px;
}
.continue-name {
  margin-top: 3px;
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.continue-bar {
  margin-top: 8px;
  height: 4px;
  border-radius: 2px;
  background: var(--line);
  overflow: hidden;
}
.continue-bar i {
  display: block;
  height: 100%;
  border-radius: 2px;
  background: linear-gradient(90deg, var(--brand) 0%, var(--brand-2) 100%);
}
.continue-btn {
  flex: 0 0 auto;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  background: linear-gradient(150deg, #4A86FF, #7FC4FF);
  box-shadow: 0 6px 16px rgba(59, 123, 255, .34);
}

.sec-title {
  font-size: 15px;
  font-weight: 700;
  margin: 4px 2px 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.sec-title::before {
  content: "";
  width: 3px;
  height: 14px;
  border-radius: 2px;
  background: linear-gradient(180deg, var(--brand), var(--brand-2));
}

.grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  /* 首页科目网格容器（选择器就叫 .grid，别名为易记的「cat-grid」；卡片本身是 .cat-card）。
     底部留白给内容滚到底时留呼吸位，避免最后一行贴着视口下沿。 */
  padding-bottom: calc(84px + var(--safe-b));
}
.cat-card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  transition: transform .16s ease, box-shadow .16s ease;
}
.cat-card:active { transform: scale(.976); box-shadow: 0 3px 12px rgba(28, 63, 124, .10); }
.cat-cover { aspect-ratio: 16 / 10; border-radius: 14px; }
.cat-cover.thumb { border-radius: 0; }
.cat-info { padding: 10px 12px 13px; }
.cat-name {
  font-size: 15px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.cat-meta {
  margin-top: 4px;
  font-size: 11.5px;
  color: var(--muted);
}

.empty {
  padding: 26px 0;
  text-align: center;
  color: var(--muted);
  font-size: 13px;
}

/* 顶部「我的」入口（原右下角悬浮按钮改为标题行右侧，彻底避免浮层压住卡片文字） */
.home-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.me-btn {
  position: relative;
  flex: 0 0 auto;
  width: 38px;
  height: 38px;
  padding: 0;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, .45);
  background: rgba(255, 255, 255, .22);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  transition: transform .16s ease, background .16s ease;
}
.me-btn:active { transform: scale(.94); background: rgba(255, 255, 255, .32); }
.me-dot {
  position: absolute;
  top: 1px;
  right: 1px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--mint);
  box-shadow: 0 0 0 2px rgba(74, 134, 255, .5);
}

/* ---------- 吸顶导航 ---------- */
.nav {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: calc(var(--safe-t) + 10px) 12px 10px;
  background: rgba(244, 247, 252, .95);
  backdrop-filter: saturate(180%) blur(10px);
  -webkit-backdrop-filter: saturate(180%) blur(10px);
}
.nav.solid { background: rgba(255, 255, 255, .96); box-shadow: 0 1px 0 rgba(230, 237, 247, .9); }
.nav-back {
  width: 36px;
  height: 36px;
  flex: 0 0 auto;
  border: none;
  border-radius: 12px;
  background: transparent;
  color: var(--text);
  display: flex;
  align-items: center;
  justify-content: center;
}
.nav-back:active { background: #E8EEF9; }
.nav-title {
  flex: 1;
  min-width: 0;
  font-size: 16px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.nav-right { flex: 0 0 auto; display: flex; gap: 6px; }

/* ---------- 二级分类 chips（横向滚动，吸附在返回栏下方） ---------- */
.chips {
  position: sticky;
  /* 返回栏高度 = safe-t + 10 + 36 + 10 */
  top: calc(var(--safe-t) + 56px);
  z-index: 15;
  display: flex;
  gap: 8px;
  /* 下内边距 2px：chips 底部与下方媒体页签行之间只留 2px，让两行贴合但可分辨 */
  padding: 10px 16px 2px;
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  background: rgba(244, 247, 252, .96);
  backdrop-filter: saturate(180%) blur(10px);
  -webkit-backdrop-filter: saturate(180%) blur(10px);
}
.chips::-webkit-scrollbar { display: none; width: 0; height: 0; }
.chip {
  flex: 0 0 auto;
  height: 32px;
  padding: 0 14px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  border: 1px solid #E3EAF6;
  border-radius: 16px;
  background: #fff;
  color: #52627A;
  font-size: 13px;
  white-space: nowrap;
  transition: all .16s ease;
}
.chip:active { transform: scale(.96); }
.chip-count { font-size: 11px; opacity: .7; }
.chip.active {
  color: #fff;
  border-color: transparent;
  background: linear-gradient(135deg, #3B7BFF, #6FA8FF);
  box-shadow: 0 4px 12px rgba(59, 123, 255, .28);
}

/* ---------- 媒体筛选：下划线文字页签 ----------
 * 与上方二级分类 chips（白底胶囊 + 渐变选中）形成明确层级区分：
 * 计数只出现在 chips 上，这里不再重复数字，避免两行「全部 15」看起来像重复渲染。
 */
.tabs {
  display: flex;
  align-items: stretch;
  height: 38px;
  padding: 0 16px;
  margin: 0 0 8px;          /* 与第一张卡片间隔 8px */
  background: transparent;
}
.tab {
  position: relative;
  flex: 0 0 auto;
  height: 38px;
  padding: 0 4px;
  margin-right: 22px;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: #6B7A90;
  font-size: 13px;
  font-weight: 400;
  line-height: 38px;
  transition: color .16s ease;
}
.tab:last-child { margin-right: 0; }
.tab.active {
  color: #3B7BFF;
  font-weight: 600;
  background: transparent;
  box-shadow: none;
}
/* 选中态下划线：宽 16px、水平居中、2px 圆角 */
.tab.active::after {
  content: '';
  position: absolute;
  left: 50%;
  bottom: 0;
  width: 16px;
  height: 2px;
  margin-left: -8px;
  border-radius: 2px;
  background: #3B7BFF;
}

/* ---------- 课程列表项 ---------- */
.list { padding: 0 16px; display: flex; flex-direction: column; gap: 10px; }

.ep {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px;
  background: var(--card);
  border-radius: 14px;
  box-shadow: var(--shadow);
  transition: transform .16s ease;
}
.ep:active { transform: scale(.985); }
.ep-thumb {
  position: relative;
  flex: 0 0 auto;
  width: 64px;
  height: 64px;
  border-radius: 10px;
}
.ep-thumb .badge {
  position: absolute;
  right: 3px;
  bottom: 3px;
  z-index: 3;
  width: 20px;
  height: 20px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  background: rgba(15, 25, 45, .58);
  backdrop-filter: blur(4px);
}
.ep-body { flex: 1; min-width: 0; }
.ep-name {
  font-size: 14px;
  font-weight: 600;
  line-height: 1.42;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  word-break: break-all;
}
.ep-meta {
  margin-top: 5px;
  font-size: 11.5px;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 5px;
}
.ep-progress {
  margin-top: 7px;
  height: 3px;
  border-radius: 2px;
  background: var(--line);
  overflow: hidden;
}
.ep-progress i {
  display: block;
  height: 100%;
  border-radius: 2px;
  background: linear-gradient(90deg, var(--brand), var(--brand-2));
}
.ep-play {
  flex: 0 0 auto;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--brand);
  background: rgba(59, 123, 255, .10);
  border: 1px solid rgba(59, 123, 255, .16);
}
.ep-done {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  margin-top: 5px;
  padding: 1px 7px;
  border-radius: 999px;
  font-size: 10.5px;
  font-weight: 600;
  color: #148A72;
  background: rgba(47, 199, 168, .14);
}

.loadmore-wrap { padding: 16px 16px calc(30px + var(--safe-b)); text-align: center; }
.loadmore {
  width: 100%;
  height: 44px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  color: var(--muted);
  font-size: 13.5px;
  box-shadow: var(--shadow);
}
.loadmore:disabled { opacity: .55; }
.list-end { padding: 6px 0 20px; text-align: center; font-size: 12px; color: #A8B6C9; }

/* ---------- 播放页 ---------- */
.play-view { padding-bottom: calc(28px + var(--safe-b)); }

.play-nav {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: calc(var(--safe-t) + 10px) 12px 10px;
  background: #fff;
  box-shadow: 0 1px 0 rgba(230, 237, 247, .9);
}
.play-nav .nav-title { font-size: 15px; font-weight: 600; }

.media {
  position: relative;
  color: #fff;
  background: linear-gradient(170deg, #131A2A 0%, #1E2C45 100%);
  padding: 18px 18px 24px;
  overflow: hidden;
}
.media.video { padding: 0; background: #0B1220; }
.video-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  background: #000;
}
.video-wrap video { width: 100%; height: 100%; display: block; background: #000; }

/* ---- 缓冲指示：只出现在播放/暂停按钮内部 ----
   弱网时不再用遮罩盖住画面，而是把按钮里的「暂停」两竖线换成一个小加载环：
   图标仍是 26px、按钮外径仍是 64px，位置和大小都不变。 */
.bigplay.is-buffering { box-shadow: 0 10px 26px rgba(59, 123, 255, .30); }

.mini-load-track { fill: none; stroke: rgba(255, 255, 255, .30); stroke-width: 2.2; }
.mini-load-arc {
  fill: none;
  stroke: #fff;
  stroke-width: 2.4;
  stroke-linecap: round;
  transform-box: fill-box;
  transform-origin: center;
  animation: miniSpin 1.5s linear infinite,
             miniBreathe 1.5s ease-in-out infinite;
}
@keyframes miniSpin { to { transform: rotate(360deg); } }
@keyframes miniBreathe {
  0%, 100% { stroke-dasharray: 9 43; }
  50%      { stroke-dasharray: 30 22; }
}

.disc-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px 0 18px;
}
.disc {
  position: relative;
  width: 196px;
  height: 196px;
  border-radius: 50%;
  overflow: hidden;
  box-shadow: 0 18px 44px rgba(0, 0, 0, .48), inset 0 0 0 7px rgba(255, 255, 255, .06);
  animation: discSpin 22s linear infinite;
  animation-play-state: paused;
  background: linear-gradient(150deg, #4A86FF, #7FC4FF);
}
.disc.playing { animation-play-state: running; }
.disc img { width: 100%; height: 100%; object-fit: cover; display: block; }
.disc .disc-hole {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 40px;
  height: 40px;
  margin: -20px 0 0 -20px;
  border-radius: 50%;
  background: rgba(11, 18, 32, .82);
  box-shadow: 0 0 0 6px rgba(255, 255, 255, .10);
}
@keyframes discSpin { to { transform: rotate(360deg); } }

.seek-row {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 11.5px;
  color: rgba(255, 255, 255, .72);
  font-variant-numeric: tabular-nums;
}
.seek {
  flex: 1;
  min-width: 0;
  height: 4px;
  -webkit-appearance: none;
  appearance: none;
  border-radius: 3px;
  background: rgba(255, 255, 255, .24);
  outline: none;
  margin: 0;
}
.seek::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 13px;
  height: 13px;
  border-radius: 50%;
  background: #fff;
  border: 3px solid var(--brand);
  box-shadow: 0 1px 5px rgba(0, 0, 0, .35);
}
.seek::-moz-range-thumb {
  width: 13px;
  height: 13px;
  border: 3px solid var(--brand);
  border-radius: 50%;
  background: #fff;
}

.ctrl-row {
  margin-top: 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.ctl {
  width: 44px;
  height: 44px;
  border: none;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: rgba(255, 255, 255, .90);
  background: rgba(255, 255, 255, .10);
}
.ctl:disabled { opacity: .3; }
.ctl:active { background: rgba(255, 255, 255, .18); }
.skip {
  width: 46px;
  height: 46px;
  border: none;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: rgba(255, 255, 255, .90);
  background: rgba(255, 255, 255, .10);
  font-size: 11px;
  font-weight: 600;
}
.bigplay {
  width: 64px;
  height: 64px;
  border: none;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  background: linear-gradient(150deg, #4A86FF, #7FC4FF);
  box-shadow: 0 10px 26px rgba(59, 123, 255, .46);
}
.bigplay:active { transform: scale(.95); }

.media-foot {
  margin-top: 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.speed {
  padding: 5px 13px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, .22);
  background: rgba(255, 255, 255, .08);
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.media-tip { font-size: 11.5px; color: rgba(255, 255, 255, .52); }

/* ---- 视频底部条（画面模式下的上一首/倍速/下一首）---- */
.video-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

/* ---- 音频面板：纯音频课常显；视频仅在「听」模式下显示 ---- */
.listen-panel { display: none; }
.media:not(.video) .listen-panel { display: block; }
.media.video.listening .listen-panel { display: block; }

/* 视频「听」模式：画面隐去但不卸载（媒体继续出声，进度不中断），换成音频面板 */
.media.video.listening {
  padding: 18px 18px 24px;
  background: linear-gradient(170deg, #131A2A 0%, #1E2C45 100%);
}
.media.video.listening .video-wrap {
  position: absolute;
  inset: 0;
  opacity: 0;
  pointer-events: none;
}
.media.video.listening .video-foot { display: none; }

/* ---- 播放页导航右侧「听 / 看」切换按钮 ---- */
.mode-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 30px;
  padding: 0 11px;
  border-radius: 999px;
  border: 1px solid #DCE7F8;
  background: #F5F8FE;
  color: var(--brand);
  font-size: 12.5px;
  font-weight: 600;
  line-height: 1;
  transition: background .16s, color .16s, border-color .16s;
}
.mode-btn:active { transform: scale(.96); }
.mode-btn.on {
  background: linear-gradient(135deg, #3B7BFF, #6FA8FF);
  border-color: transparent;
  color: #fff;
}

.play-info { padding: 18px 18px 4px; background: var(--bg); }
.play-title {
  margin: 0;
  font-size: 18px;
  font-weight: 700;
  line-height: 1.45;
}
.play-cat {
  margin-top: 8px;
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12.5px;
  color: var(--muted);
}
.play-cat .cat-chip {
  padding: 2px 9px;
  border-radius: 999px;
  background: rgba(59, 123, 255, .10);
  color: #2C63D6;
  font-weight: 600;
  font-size: 11.5px;
}
.play-desc {
  margin-top: 14px;
  padding: 14px;
  border-radius: 14px;
  background: #fff;
  box-shadow: var(--shadow);
  font-size: 13px;
  color: #43506A;
  line-height: 1.75;
  white-space: pre-wrap;
  word-break: break-word;
}

/* 顶部右上「播放记录已保存」轻提示 */
.save-hint {
  position: fixed;
  top: calc(var(--safe-t) + 60px);
  right: max(14px, calc(50% - 240px + 14px));
  z-index: 80;
  padding: 7px 13px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  color: #148A72;
  background: rgba(47, 199, 168, .14);
  border: 1px solid rgba(47, 199, 168, .30);
  backdrop-filter: blur(6px);
  opacity: 0;
  transform: translateY(-6px);
  transition: opacity .24s ease, transform .24s ease;
  pointer-events: none;
}
.save-hint.show { opacity: 1; transform: none; }

/* ---------- 我的 ---------- */
.me-card {
  margin: 6px 16px 20px;
  padding: 18px;
  display: flex;
  align-items: center;
  gap: 14px;
  border-radius: var(--radius);
  background: linear-gradient(150deg, #4A86FF 0%, #7FC4FF 100%);
  color: #fff;
  box-shadow: 0 12px 28px rgba(59, 123, 255, .28);
}
.avatar {
  width: 52px;
  height: 52px;
  flex: 0 0 auto;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  font-weight: 700;
  color: #fff;
  background: rgba(255, 255, 255, .22);
  border: 1px solid rgba(255, 255, 255, .40);
}
.me-info { flex: 1; min-width: 0; }
.me-name { font-size: 16px; font-weight: 700; }
.me-sub { margin-top: 3px; font-size: 12px; color: rgba(255, 255, 255, .82); }
.btn-logout {
  flex: 0 0 auto;
  padding: 7px 13px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, .48);
  background: rgba(255, 255, 255, .14);
  color: #fff;
  font-size: 12.5px;
  font-weight: 600;
}

.empty-box {
  margin: 40px 16px;
  padding: 40px 22px;
  text-align: center;
  background: #fff;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.empty-box .ico {
  width: 62px;
  height: 62px;
  margin: 0 auto 14px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--brand);
  background: rgba(59, 123, 255, .10);
}
.empty-box .t { font-size: 15px; font-weight: 600; }
.empty-box .d { margin-top: 7px; font-size: 13px; color: var(--muted); }
/* 错误页两个出口按钮：主「返回上一页」+ 次「回到首页」 */
.empty-box .btn-primary { margin-top: 20px; }
.empty-box .btn-ghost { margin-top: 10px; }

/* ---------- 按钮 ---------- */
.btn-primary {
  width: 100%;
  height: 48px;
  border: none;
  border-radius: 14px;
  color: #fff;
  font-size: 15.5px;
  font-weight: 600;
  background: linear-gradient(150deg, #4A86FF, #7FC4FF);
  box-shadow: 0 10px 24px rgba(59, 123, 255, .32);
}
.btn-primary:active { transform: scale(.985); }
.btn-primary:disabled { opacity: .6; box-shadow: none; }
.btn-ghost {
  margin-top: 12px;
  width: 100%;
  height: 44px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
  color: var(--brand);
  font-size: 14px;
  font-weight: 600;
}

/* ---------- 登录 ---------- */
.login-view {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: calc(var(--safe-t) + 28px) 20px calc(28px + var(--safe-b));
  background: linear-gradient(180deg, #EAF2FF 0%, var(--bg) 46%);
}
.login-card {
  padding: 26px 20px 22px;
  background: #fff;
  border-radius: 20px;
  box-shadow: var(--shadow-lg);
}
.login-logo {
  width: 56px;
  height: 56px;
  margin: 0 auto 14px;
  border-radius: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  background: linear-gradient(150deg, #4A86FF, #7FC4FF);
  box-shadow: 0 10px 24px rgba(59, 123, 255, .34);
}
.login-h { margin: 0; text-align: center; font-size: 20px; font-weight: 700; }
.login-p { margin: 8px 0 22px; text-align: center; font-size: 13px; color: var(--muted); }
.field { margin-bottom: 14px; }
.field label { display: block; font-size: 12.5px; font-weight: 600; color: var(--muted); margin-bottom: 7px; }
.field input {
  width: 100%;
  height: 46px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: #F8FAFE;
  font-size: 15px;
  color: var(--text);
  outline: none;
  transition: border-color .16s ease, background .16s ease;
}
.field input:focus { border-color: rgba(59, 123, 255, .55); background: #fff; }
.pwd-wrap { position: relative; }
.pwd-wrap input { padding-right: 46px; }
/* 隐藏浏览器自带的密码显示/清除按钮，只用自绘的切换按钮 */
input::-ms-reveal, input::-ms-clear { display: none; width: 0; height: 0; }
.pwd-wrap input::-webkit-credentials-auto-fill-button,
.pwd-wrap input::-webkit-textfield-decoration-container { display: none !important; visibility: hidden; pointer-events: none; }
.pwd-eye {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  width: 36px;
  height: 36px;
  border: none;
  border-radius: 10px;
  background: transparent;
  color: var(--muted);
  display: flex;
  align-items: center;
  justify-content: center;
}
.login-foot {
  margin-top: 18px;
  text-align: center;
  font-size: 13px;
  color: var(--muted);
}
.login-foot a { color: var(--brand); font-weight: 600; }
/* 演示环境账号提示：比「去注册」更弱，避免抢视觉 */
.login-hint {
  margin-top: 12px;
  text-align: center;
  font-size: 12px;
  line-height: 1.5;
  color: #8A97AB;
}

/* ---------- toast ---------- */
.toast {
  position: fixed;
  left: 50%;
  bottom: calc(80px + var(--safe-b));
  transform: translate(-50%, 10px);
  z-index: 120;
  max-width: 78vw;
  padding: 10px 18px;
  border-radius: 999px;
  font-size: 13px;
  color: #fff;
  background: rgba(27, 35, 51, .92);
  box-shadow: 0 10px 26px rgba(11, 18, 32, .30);
  opacity: 0;
  pointer-events: none;
  transition: opacity .24s ease, transform .24s ease;
  text-align: center;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- 底部菜单（训练 / 我的） ---------- */
.tabbar {
  position: fixed;
  left: 50%;
  bottom: 0;
  transform: translateX(-50%);
  width: 100%;
  max-width: 480px;
  z-index: 60;
  display: flex;
  background: rgba(255, 255, 255, .97);
  backdrop-filter: saturate(180%) blur(12px);
  -webkit-backdrop-filter: saturate(180%) blur(12px);
  box-shadow: 0 -1px 0 rgba(228, 236, 248, .95), 0 -8px 24px rgba(28, 63, 124, .06);
  padding-bottom: var(--safe-b);
}
.tabbar-item {
  flex: 1;
  height: 54px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  font-size: 11px;
  color: #90A0B5;
  text-decoration: none;
  transition: color .16s;
}
.tabbar-item.active { color: var(--brand); font-weight: 600; }
.tabbar-item:active { opacity: .65; }

/* 有底部菜单的页面要预留高度，避免最后一条被遮住（首页 / 科目列表 / 播放页 / 我的 / 编辑资料） */
.view.has-tab { padding-bottom: calc(76px + var(--safe-b)); }

/* ---------- 头像 ---------- */
.avatar { overflow: hidden; }
.avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }

/* ---------- 我的（新版） ---------- */
.me-hero {
  margin: 6px 16px 14px;
  padding: 18px;
  display: flex;
  align-items: center;
  gap: 14px;
  border-radius: var(--radius);
  background: linear-gradient(150deg, #4A86FF 0%, #7FC4FF 100%);
  color: #fff;
  box-shadow: 0 12px 28px rgba(59, 123, 255, .26);
}
.me-hero .me-avatar {
  border: 2px solid rgba(255, 255, 255, .55);
  background: rgba(255, 255, 255, .22);
  box-shadow: 0 6px 16px rgba(11, 18, 32, .18);
}
.me-edit {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 7px 12px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, .50);
  background: rgba(255, 255, 255, .16);
  color: #fff;
  font-size: 12.5px;
  font-weight: 600;
  text-decoration: none;
}
.me-edit:active { background: rgba(255, 255, 255, .28); }

.me-stats {
  margin: 0 16px 16px;
  display: flex;
  padding: 14px 0;
  background: #fff;
  border-radius: 14px;
  box-shadow: var(--shadow);
}
.me-stats .stat { flex: 1; text-align: center; }
.me-stats .stat + .stat { border-left: 1px solid var(--line); }
.me-stats b { display: block; font-size: 19px; font-weight: 700; color: var(--text); }
.me-stats span { font-size: 11.5px; color: var(--muted); }

/* 我的页两个页签吸在标题栏下方 */
.me-tabs {
  position: sticky;
  top: calc(var(--safe-t) + 56px);
  z-index: 15;
  background: var(--bg);
}

/* 收藏条目右侧的取消收藏 */
.fav-del {
  flex: 0 0 auto;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--brand);
  background: #F1F6FF;
}
.fav-del svg { fill: currentColor; }
.fav-del:active { transform: scale(.94); }

/* 我的页底部「退出登录」 */
.btn-outline {
  display: block;
  width: calc(100% - 32px);
  margin: 26px 16px 6px;
  height: 46px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: #fff;
  color: #6B7A90;
  font-size: 14.5px;
  font-weight: 600;
}
.btn-outline:active { background: #F5F8FE; }

/* ---------- 播放页收藏按钮 ---------- */
.fav-btn {
  width: 34px;
  height: 34px;
  border: none;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  color: #9AA8BC;
  transition: color .16s, transform .12s;
}
.fav-btn.on { color: #FF5A79; }
.fav-btn.on svg { fill: currentColor; }
.fav-btn:active { transform: scale(.9); }
.fav-btn:disabled { opacity: .6; }

/* ---------- 编辑资料 ---------- */
.edit-view { padding-bottom: calc(28px + var(--safe-b)); }
.edit-body { padding: 20px 16px 0; }
.avatar-pick {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 8px 0 22px;
  background: transparent;
  border: none;
}
.avatar-88 {
  border: 3px solid #fff;
  background: linear-gradient(150deg, #4A86FF, #7FC4FF);
  color: #fff;
  box-shadow: 0 10px 26px rgba(59, 123, 255, .28);
}
.avatar-tip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--brand);
}
.edit-body .field { margin-bottom: 16px; }
.edit-hint {
  margin-top: 14px;
  text-align: center;
  font-size: 12px;
  line-height: 1.5;
  color: #8A97AB;
}

/* 编辑资料里只读的账号框 */
.field input:disabled {
  color: #8A97AB;
  background: #F1F4F9;
  border-color: #E9EFF8;
  -webkit-text-fill-color: #8A97AB;
}
