* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Segoe UI", sans-serif; background: linear-gradient(180deg, #f0f7ff 0%, #f8fafc 100%); color: #1e293b; -webkit-tap-highlight-color: transparent; min-height: 100vh; }
img, video { display: block; max-width: 100%; }

.reveal { opacity: 0; transform: translateY(24px); transition: opacity 0.6s cubic-bezier(0.4, 0, 0.2, 1), transform 0.6s cubic-bezier(0.4, 0, 0.2, 1); }
.reveal.active { opacity: 1; transform: translateY(0); }

.hover-lift { transition: transform 0.3s ease, box-shadow 0.3s ease; }
.hover-lift:hover { transform: translateY(-3px); box-shadow: 0 16px 32px -12px rgba(59, 130, 246, 0.2); }

.filter-btn {
  flex-shrink: 0;
  padding: 7px 20px;
  border-radius: 24px;
  font-size: 13px;
  font-weight: 600;
  border: none;
  cursor: pointer;
  background: #e2e8f0;
  color: #64748b;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}
.filter-btn.active {
  background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
  color: #fff;
  box-shadow: 0 4px 12px -2px rgba(59, 130, 246, 0.4);
}
.filter-btn:not(.active):hover {
  background: #cbd5e1;
  transform: translateY(-1px);
}
#filterBar::-webkit-scrollbar { display: none; }
#filterBar { -ms-overflow-style: none; scrollbar-width: none; padding-top: 16px; padding-bottom: 8px; }

.video-card {
  background: #fff;
  border-radius: 20px;
  overflow: hidden;
  box-shadow: 0 4px 20px -6px rgba(0, 0, 0, 0.08);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  border: 1px solid rgba(226, 232, 240, 0.5);
}
.video-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 16px 40px -10px rgba(59, 130, 246, 0.2);
}
.video-card.hidden-card {
  display: none;
}
.video-card .thumb-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  background: #000;
  cursor: pointer;
  overflow: hidden;
}
.video-card .thumb-wrap video {
  width: 100%; height: 100%;
  object-fit: contain;
  display: block;
}
.video-card .thumb-wrap .play-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(15, 23, 42, 0.3);
  z-index: 2;
  transition: all 0.3s ease;
}
.video-card .thumb-wrap:hover .play-overlay {
  background: rgba(15, 23, 42, 0.4);
}
.video-card .thumb-wrap .play-overlay.hide { display: none; }
.video-card .thumb-wrap .play-overlay .btn {
  width: 60px; height: 60px;
  background: rgba(255, 255, 255, 0.95);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 24px;
  color: #2563eb;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  padding-left: 4px;
}
.video-card .thumb-wrap:hover .play-overlay .btn {
  transform: scale(1.1);
}
.video-card .thumb-wrap:active .play-overlay .btn { transform: scale(0.92); }
.video-card .thumb-wrap .duration {
  position: absolute;
  bottom: 10px; right: 12px;
  background: rgba(15, 23, 42, 0.75);
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
  color: #fff;
  font-size: 11px;
  font-weight: 500;
  padding: 3px 10px;
  border-radius: 8px;
  z-index: 2;
}
.video-card .thumb-wrap .duration.hide { display: none; }
.video-card .thumb-wrap .bottom-bar {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  padding: 28px 14px 10px;
  background: linear-gradient(transparent, rgba(15, 23, 42, 0.6));
  z-index: 3;
  display: none;
  align-items: center;
  gap: 10px;
}
.video-card .thumb-wrap .bottom-bar.show { display: flex; }
.video-card .thumb-wrap .bottom-bar .fs-btn {
  position: relative;
  background: rgba(0, 0, 0, 0.4);
  border: none;
  color: #fff;
  width: 34px; height: 34px;
  border-radius: 10px;
  cursor: pointer;
  font-size: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  transition: background 0.2s;
  margin-left: auto;
  flex-shrink: 0;
}
.video-card .thumb-wrap .bottom-bar .fs-btn:hover { background: rgba(0, 0, 0, 0.6); }
/* 视觉尺寸不变，把点击热区撑到 iOS 推荐的 44px 以上 */
.video-card .thumb-wrap .bottom-bar .fs-btn::after {
  content: '';
  position: absolute;
  left: -6px;
  right: -6px;
  top: -6px;
  bottom: -6px;
}
.video-card .thumb-wrap .bottom-bar .progress-mini {
  flex: 1;
  height: 4px;
  background: rgba(255, 255, 255, 0.25);
  border-radius: 3px;
  overflow: hidden;
}
.video-card .thumb-wrap .bottom-bar .progress-mini .fill {
  height: 100%;
  background: linear-gradient(90deg, #60a5fa, #3b82f6);
  border-radius: 3px;
  width: 0%;
  transition: width 0.3s;
}
.video-card .thumb-wrap .bottom-bar .time-mini {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.85);
  white-space: nowrap;
  flex-shrink: 0;
  font-variant-numeric: tabular-nums;
}
.video-card .info {
  padding: 16px 18px 8px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.video-card .info .info-row {
  display: flex;
  align-items: center;
  gap: 12px;
}
.video-card .info .tag {
  flex-shrink: 0;
  background: linear-gradient(135deg, #dbeafe 0%, #bfdbfe 100%);
  color: #1d4ed8;
  font-size: 14px;
  font-weight: 700;
  padding: 4px 12px;
  border-radius: 8px;
}
.video-card .info .title {
  flex: 1;
  font-size: 20px;
  font-weight: 600;
  color: #1e293b;
  line-height: 1.4;
}
.video-card .info .desc-text {
  font-size: 16px;
  color: #475569;
  line-height: 1.625;
  padding-left: 20px;
}
.video-card .info .status {
  flex-shrink: 0;
  font-size: 11px;
  color: #94a3b8;
  font-weight: 500;
}
.video-card .info .status.playing {
  color: #2563eb;
  font-weight: 600;
}
.video-card .info .freq-row {
  text-align: right;
}
.video-card .info .freq-text {
  font-size: 18px;
  color: #94a3b8;
  white-space: nowrap;
}

/* progress bar clickable */
.video-card .thumb-wrap .bottom-bar .progress-mini { cursor: pointer; }

/* ===== 训练计时 HUD ===== */
#hud {
  position: fixed;
  inset: 0;
  z-index: 60;
  pointer-events: none;
}
#hud.in-fs { position: absolute; inset: 0; }
#hud .hud-pill {
  pointer-events: auto;
  position: absolute;
  top: 70px;
  right: 16px;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  background: rgba(15, 23, 42, 0.5);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  color: #fff;
  padding: 8px 16px;
  border-radius: 999px;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25);
  font-size: 13px;
}
#hud.in-fs .hud-pill { top: 16px; right: 16px; }
#hud .hud-pill .hud-session { font-weight: 700; color: #93c5fd; }
#hud .hud-pill .hud-time { font-variant-numeric: tabular-nums; font-weight: 600; font-size: 15px; }
#hud .hud-pill .hud-ring-wrap { position: relative; width: 44px; height: 44px; display: flex; align-items: center; justify-content: center; }
#hud .hud-pill .hud-ring { display: block; }
#hud .hud-pill .hud-ring #hudArc { transition: stroke-dashoffset 0.4s linear; }
#hud .hud-pill .hud-time {
  position: absolute;
  font-size: 12px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: #fff;
}
#hud .hud-pill.warn { background: rgba(234, 88, 12, 0.92); }
#hud .hud-pill.warn .hud-session { color: #fde68a; }
#hud .hud-pill.warn #hudArc { stroke: #fbbf24; }
#hud .hud-pill.done { background: rgba(22, 163, 94, 0.94); }
#hud .hud-pill.done .hud-session { color: #d1fae5; }
#hud .hud-pill.done #hudArc { stroke: #4ade80; }

#hud .hud-overlay {
  pointer-events: auto;
  position: absolute;
  inset: 0;
  background: rgba(2, 6, 23, 0.74);
  -webkit-backdrop-filter: blur(3px);
  backdrop-filter: blur(3px);
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  color: #fff;
  padding: 24px;
}
#hud .hud-overlay.show { display: flex; }
#hud .hud-overlay .ov-title { font-size: 22px; font-weight: 800; margin-bottom: 10px; }
#hud .hud-overlay .ov-sub { font-size: 14px; color: rgba(255, 255, 255, 0.88); margin-bottom: 18px; line-height: 1.6; }
#hud .hud-overlay .ov-timer { font-size: 60px; font-weight: 800; font-variant-numeric: tabular-nums; margin: 4px 0 18px; }
#hud .hud-overlay .ov-btn {
  pointer-events: auto;
  margin-top: 10px;
  background: linear-gradient(135deg, #3b82f6, #2563eb);
  color: #fff;
  border: none;
  padding: 11px 28px;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
}
#hud .hud-overlay .ov-btn.ghost { background: rgba(255, 255, 255, 0.16); }
#hud .hud-toast {
  position: absolute;
  top: 22px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(34, 197, 94, 0.96);
  color: #fff;
  padding: 9px 20px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  opacity: 0;
  transition: opacity 0.3s;
  pointer-events: none;
  white-space: nowrap;
}
#hud .hud-toast.show { opacity: 1; }

/* ===== 返回反馈提醒弹窗 ===== */
#fbModal {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(2, 6, 23, 0.5);
  -webkit-backdrop-filter: blur(2px);
  backdrop-filter: blur(2px);
  padding: 24px;
}
#fbModal.show { display: flex; }
#fbModal .fb-card {
  background: #fff;
  width: 100%;
  max-width: 340px;
  border-radius: 22px;
  padding: 26px 22px 18px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.3);
  text-align: center;
  animation: fbPop 0.28s cubic-bezier(0.34, 1.56, 0.64, 1);
}
@keyframes fbPop { from { transform: scale(0.9); opacity: 0; } to { transform: scale(1); opacity: 1; } }
#fbModal .fb-emoji { font-size: 42px; }
#fbModal .fb-title { font-size: 20px; font-weight: 800; color: #1e293b; margin: 8px 0 6px; }
#fbModal .fb-sub { font-size: 16px; color: #475569; line-height: 1.6; margin-bottom: 20px; }
#fbModal .fb-actions { display: flex; gap: 12px; }
#fbModal .fb-actions button {
  flex: 1;
  border: none;
  border-radius: 14px;
  padding: 12px 0;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
}
#fbModal .fb-actions .later { background: #e2e8f0; color: #475569; }
#fbModal .fb-actions .now { background: linear-gradient(135deg, #3b82f6, #2563eb); color: #fff; }

/* ============================================================
   列表布局样式（替代原 Tailwind 工具类）
   ============================================================ */
.filter-bar { max-width: 42rem; margin: 0 auto; padding: 1rem 1.25rem 0.5rem; display: flex; gap: 0.5rem; overflow-x: auto; -webkit-overflow-scrolling: touch; scrollbar-width: none; }
.filter-bar::-webkit-scrollbar { display: none; }
.video-page { max-width: 42rem; margin: 0 auto; padding: 0 1.25rem 2rem; }
.video-list { display: flex; flex-direction: column; gap: 1rem; }
.video-group { margin-bottom: 0.75rem; }
.video-group-head { display: flex; align-items: center; gap: 0.5rem; padding: 1rem 0.25rem; }
.group-bar { width: 0.25rem; height: 1.25rem; background: linear-gradient(to bottom, #3b82f6, #38bdf8); border-radius: 9999px; }
.group-title { font-size: 20px; font-weight: 700; color: #1e293b; }
.group-count { font-size: 0.75rem; color: #94a3b8; background: #f1f5f9; padding: 0.125rem 0.5rem; border-radius: 9999px; }
.video-group-list { display: flex; flex-direction: column; gap: 1rem; }

/* ============================================================
   iPhone / WKWebView 适配
   ============================================================ */

/* 伪全屏：iOS 不支持对普通元素调用 Fullscreen API，用整屏覆盖层顶上。
   .reveal 上的 transform 会让 fixed 后代改成相对卡片定位，必须先清掉；
   transform 有过渡时计算值仍是 matrix（照样建包含块），所以过渡也得一起关 */
html.in-fs-css body { overflow: hidden; }
html.in-fs-css .reveal,
html.in-fs-css .video-card { transition: none !important; }
html.in-fs-css .reveal { transform: none !important; opacity: 1 !important; }
html.in-fs-css .video-card:hover { transform: none !important; }
.video-card .thumb-wrap.is-fs {
  position: fixed;
  left: 0;
  top: 0;
  z-index: 50;
  width: 100vw;
  height: 100vh;
  aspect-ratio: auto;
  padding-bottom: 0;
  border-radius: 0;
}
.video-card .thumb-wrap.is-fs .bottom-bar {
  padding-left: 16px;
  padding-right: 16px;
  padding-bottom: calc(12px + env(safe-area-inset-bottom));
}

/* 播放被内核拦下时的整屏继续按钮 */
.video-card .thumb-wrap .resume-tip {
  position: absolute;
  inset: 0;
  z-index: 5;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  background: rgba(2, 6, 23, 0.72);
  color: #fff;
  text-align: center;
  padding: 20px;
  cursor: pointer;
}
.video-card .thumb-wrap .resume-tip .rt-name {
  font-size: 16px;
  font-weight: 700;
  line-height: 1.4;
}
.video-card .thumb-wrap .resume-tip .rt-btn {
  background: linear-gradient(135deg, #3b82f6, #2563eb);
  color: #fff;
  font-size: 18px;
  font-weight: 700;
  padding: 14px 34px;
  border-radius: 999px;
  box-shadow: 0 10px 26px rgba(37, 99, 235, 0.45);
}
.video-card .thumb-wrap .resume-tip .rt-sub {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.66);
}

/* iOS 13/14 不认 aspect-ratio，容器会塌成 0 高 */
@supports not (aspect-ratio: 16 / 9) {
  .video-card .thumb-wrap { height: 0; padding-bottom: 56.25%; }
  .video-card .thumb-wrap video { position: absolute; left: 0; top: 0; right: 0; bottom: 0; }
}
