/* ============================================================================
   主题曲播放器（门户「主题曲」栏目 + 全站右下角悬浮条）
   ----------------------------------------------------------------------------
   设计原则（与门户既有规范一致）：
     · 卡片底 rgba(255,255,255,.03)、描边 .09，悬停 .055 / .2
     · 圆角：大卡 22px、小件 15px
     · 品牌色只用在图标 / 链接 / 强调条上，绝不整块铺蓝
     · 竖线 + 数字的"编号"语言与首页四步流程保持一致
   ========================================================================== */

/* ---------------------------------------------------------------- 门户栏目 */
.tm-section { position: relative; }
.tm-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  flex-wrap: wrap;
  margin-bottom: 26px;
}
.tm-head-l { min-width: 0; }
.tm-kicker {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 12.5px;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--c-blue-2, #2997ff);
  margin-bottom: 10px;
}
.tm-kicker i { font-size: 13px; }
.tm-head h2 {
  font-size: clamp(26px, 3.1vw, 36px);
  font-weight: 600;
  letter-spacing: -.03em;
  margin: 0 0 8px;
}
.tm-head p {
  margin: 0;
  color: var(--c-text-2, rgba(245, 245, 247, .7));
  font-size: 15.5px;
  line-height: 1.7;
  max-width: 560px;
}

/* 两首曲子的网格 */
.tm-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

/* 单首曲子 = 一张卡 */
.tm-card {
  position: relative;
  display: flex;
  gap: 16px;
  padding: 18px;
  border-radius: 22px;
  background: rgba(255, 255, 255, .03);
  border: 1px solid rgba(255, 255, 255, .09);
  transition: background .28s, border-color .28s, transform .28s;
  min-width: 0;
}
.tm-card:hover {
  background: rgba(255, 255, 255, .055);
  border-color: rgba(255, 255, 255, .2);
  transform: translateY(-2px);
}
/* 正在播放的那首：加一条左侧强调条（不是整块变色） */
.tm-card.is-playing { border-color: rgba(0, 113, 227, .42); }
.tm-card.is-playing::before {
  content: '';
  position: absolute;
  left: 0; top: 22px; bottom: 22px;
  width: 2px;
  border-radius: 2px;
  background: linear-gradient(180deg, #2997ff, rgba(41, 151, 255, .15));
}

/* 封面槽位：MV 做出来以后换成封面图 */
.tm-cover {
  position: relative;
  flex-shrink: 0;
  width: 74px;
  height: 74px;
  border-radius: 15px;
  overflow: hidden;
  background: linear-gradient(140deg, rgba(0, 113, 227, .26),
              rgba(120, 80, 220, .18) 62%, rgba(255, 255, 255, .04));
  border: 1px solid rgba(255, 255, 255, .1);
  display: grid;
  place-items: center;
}
.tm-cover i { font-size: 23px; color: #7fc0ff; }
.tm-cover img { width: 100%; height: 100%; object-fit: cover; display: block; }
/* 播放中的声波（三条竖线跳动） */
.tm-wave {
  position: absolute;
  inset: 0;
  display: none;
  align-items: flex-end;
  justify-content: center;
  gap: 3px;
  padding-bottom: 20px;
  background: rgba(6, 10, 18, .55);
  backdrop-filter: blur(2px);
}
.tm-card.is-playing .tm-wave { display: flex; }
.tm-wave span {
  width: 3px;
  border-radius: 2px;
  background: #7fc0ff;
  animation: tmWave 1s ease-in-out infinite;
}
.tm-wave span:nth-child(1) { height: 10px; animation-delay: 0s; }
.tm-wave span:nth-child(2) { height: 18px; animation-delay: .16s; }
.tm-wave span:nth-child(3) { height: 13px; animation-delay: .32s; }
@keyframes tmWave {
  0%, 100% { transform: scaleY(.45); opacity: .7; }
  50%      { transform: scaleY(1);   opacity: 1; }
}
/* 用户要求减少动效时不动 */
@media (prefers-reduced-motion: reduce) {
  .tm-wave span { animation: none; }
  .tm-card { transition: none; }
  .tm-card:hover { transform: none; }
}

.tm-body { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.tm-sub {
  font-size: 11.6px;
  letter-spacing: .08em;
  color: rgba(245, 245, 247, .45);
  text-transform: uppercase;
  margin-bottom: 4px;
}
.tm-title {
  font-size: 15.6px;
  font-weight: 600;
  color: var(--c-text-1, #f5f5f7);
  margin: 0 0 3px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.tm-note {
  font-size: 12.8px;
  color: rgba(245, 245, 247, .5);
  margin-bottom: 12px;
}

/* 进度条 */
.tm-prog {
  position: relative;
  height: 4px;
  border-radius: 4px;
  background: rgba(255, 255, 255, .12);
  cursor: pointer;
  margin-bottom: 6px;
}
.tm-prog::after {                 /* 加大点击热区（手机好按） */
  content: '';
  position: absolute;
  inset: -9px 0;
}
.tm-prog-fill {
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 0;
  border-radius: 4px;
  background: linear-gradient(90deg, #2997ff, #5fb0ff);
}
.tm-prog-dot {
  position: absolute;
  top: 50%;
  left: 0;
  width: 10px; height: 10px;
  margin: -5px 0 0 -5px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 6px rgba(0, 0, 0, .5);
  opacity: 0;
  transition: opacity .2s;
}
.tm-prog:hover .tm-prog-dot,
.tm-prog.is-drag .tm-prog-dot { opacity: 1; }

.tm-times {
  display: flex;
  justify-content: space-between;
  font-size: 11.4px;
  font-variant-numeric: tabular-nums;
  color: rgba(245, 245, 247, .42);
  margin-bottom: 2px;
}

/* 播放按钮 */
.tm-play {
  flex-shrink: 0;
  align-self: center;
  width: 46px; height: 46px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, .14);
  background: rgba(255, 255, 255, .07);
  color: #f5f5f7;
  display: grid;
  place-items: center;
  cursor: pointer;
  font-size: 17px;
  transition: background .22s, border-color .22s, transform .2s;
}
.tm-play:hover {
  background: rgba(0, 113, 227, .26);
  border-color: rgba(0, 113, 227, .5);
}
.tm-play:active { transform: scale(.94); }
.tm-play:disabled { opacity: .45; cursor: not-allowed; }

/* MV 占位（以后填了 mv 字段就变成链接） */
.tm-mv {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 10px;
  font-size: 12.4px;
  color: rgba(245, 245, 247, .45);
  text-decoration: none;
}
.tm-mv i { font-size: 12px; }
.tm-mv.is-live { color: #2997ff; }
.tm-mv.is-live:hover { text-decoration: underline; }

/* 版权/来源说明 */
.tm-foot {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 18px;
  font-size: 12.4px;
  color: rgba(245, 245, 247, .4);
}
.tm-foot i { font-size: 12px; }
.tm-foot-src { margin-left: 2px; }
.tm-foot-links {
  display: inline-flex;
  align-items: center;
  gap: 4px 14px;
  flex-wrap: wrap;
}
.tm-foot a {
  color: rgba(245, 245, 247, .62);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.tm-foot a i { font-size: 10px; opacity: .6; }
.tm-foot a:hover { color: #2997ff; text-decoration: underline; }

/* ---------------------------------------------------------------- 悬浮播放条 */
.tm-dock {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 900;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 10px;
  pointer-events: none;      /* 只有内部可点，避免挡住页面 */
}
.tm-dock > * { pointer-events: auto; }

/* 收起态 = 一颗小胶囊 */
.tm-pill {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  height: 46px;
  padding: 0 16px 0 6px;
  border-radius: 23px;
  background: rgba(16, 18, 26, .82);
  border: 1px solid rgba(255, 255, 255, .12);
  color: #f5f5f7;
  cursor: pointer;
  backdrop-filter: blur(14px) saturate(1.3);
  box-shadow: 0 8px 28px rgba(0, 0, 0, .42);
  font-size: 13.2px;
  transition: background .24s, border-color .24s, transform .2s;
  max-width: 240px;
}
.tm-pill:hover {
  background: rgba(24, 27, 38, .9);
  border-color: rgba(255, 255, 255, .22);
}
.tm-pill:active { transform: scale(.97); }
.tm-pill-ic {
  flex-shrink: 0;
  width: 34px; height: 34px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: rgba(0, 113, 227, .22);
  color: #7fc0ff;
  font-size: 14px;
}
.tm-pill.is-playing .tm-pill-ic {
  background: rgba(0, 113, 227, .32);
  color: #a8d4ff;
}
.tm-pill-tx {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
/* 胶囊上的 mini 波纹 */
.tm-pill.is-playing .tm-pill-ic i { animation: tmPill 1.6s ease-in-out infinite; }
@keyframes tmPill {
  0%, 100% { transform: scale(1); opacity: .85; }
  50%      { transform: scale(1.12); opacity: 1; }
}

/* 展开态 = 一张卡 */
.tm-panel {
  width: 308px;
  max-width: calc(100vw - 36px);
  border-radius: 22px;
  background: rgba(16, 18, 26, .9);
  border: 1px solid rgba(255, 255, 255, .12);
  backdrop-filter: blur(18px) saturate(1.3);
  box-shadow: 0 18px 48px rgba(0, 0, 0, .55);
  padding: 15px 15px 13px;
  display: none;
  animation: tmIn .24s ease-out;
}
.tm-dock.is-open .tm-panel { display: block; }
@keyframes tmIn {
  from { opacity: 0; transform: translateY(8px) scale(.98); }
  to   { opacity: 1; transform: none; }
}
@media (prefers-reduced-motion: reduce) {
  .tm-panel { animation: none; }
  .tm-pill.is-playing .tm-pill-ic i { animation: none; }
}

.tm-panel-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
  font-size: 12.4px;
  letter-spacing: .04em;
  color: rgba(245, 245, 247, .55);
}
.tm-panel-head b {
  font-size: 13px;
  font-weight: 600;
  color: #f5f5f7;
}
.tm-panel-x {
  margin-left: auto;
  width: 26px; height: 26px;
  border-radius: 8px;
  border: 1px solid transparent;
  background: transparent;
  color: rgba(245, 245, 247, .5);
  cursor: pointer;
  display: grid;
  place-items: center;
  font-size: 12px;
}
.tm-panel-x:hover {
  background: rgba(255, 255, 255, .08);
  color: #f5f5f7;
}

/* 面板里的曲目行 */
.tm-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 9px;
  border-radius: 12px;
  cursor: pointer;
  transition: background .2s;
}
.tm-row:hover { background: rgba(255, 255, 255, .06); }
.tm-row.is-playing { background: rgba(0, 113, 227, .14); }
.tm-row-n {
  flex-shrink: 0;
  width: 26px; height: 26px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  font-size: 11.4px;
  font-variant-numeric: tabular-nums;
  background: rgba(255, 255, 255, .07);
  color: rgba(245, 245, 247, .65);
}
.tm-row.is-playing .tm-row-n {
  background: rgba(0, 113, 227, .3);
  color: #a8d4ff;
}
.tm-row-tx { flex: 1; min-width: 0; }
.tm-row-tx b {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: #f5f5f7;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.tm-row-tx span {
  display: block;
  font-size: 11.4px;
  color: rgba(245, 245, 247, .45);
}
.tm-row-ic {
  flex-shrink: 0;
  font-size: 12px;
  color: rgba(245, 245, 247, .55);
}

/* 面板底部进度 + 控制 */
.tm-panel-prog { margin-top: 10px; }
.tm-panel-acts {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
}
.tm-mini {
  width: 32px; height: 32px;
  border-radius: 9px;
  border: 1px solid rgba(255, 255, 255, .1);
  background: rgba(255, 255, 255, .05);
  color: #f5f5f7;
  display: grid;
  place-items: center;
  cursor: pointer;
  font-size: 13px;
  transition: background .2s, border-color .2s;
}
.tm-mini:hover {
  background: rgba(255, 255, 255, .1);
  border-color: rgba(255, 255, 255, .2);
}
.tm-mini.tm-mini-main {
  width: 38px; height: 38px;
  border-radius: 50%;
  background: rgba(0, 113, 227, .24);
  border-color: rgba(0, 113, 227, .45);
  font-size: 15px;
}
.tm-mini.tm-mini-main:hover { background: rgba(0, 113, 227, .38); }
.tm-panel-time {
  margin-left: auto;
  font-size: 11.4px;
  font-variant-numeric: tabular-nums;
  color: rgba(245, 245, 247, .45);
}

/* 出错提示 */
.tm-err {
  display: none;
  margin-top: 9px;
  padding: 8px 10px;
  border-radius: 10px;
  font-size: 12px;
  line-height: 1.6;
  background: rgba(255, 159, 10, .12);
  border: 1px solid rgba(255, 159, 10, .28);
  color: #ffc46b;
}
.tm-dock.has-err .tm-err { display: block; }

/* ---------------------------------------------------------------- 响应式 */
@media (max-width: 820px) {
  .tm-grid { grid-template-columns: 1fr; gap: 14px; }
  .tm-head { margin-bottom: 20px; gap: 14px; }
  .tm-head p { font-size: 14.6px; }
  .tm-card { padding: 15px; gap: 13px; border-radius: 18px; }
  .tm-cover { width: 62px; height: 62px; border-radius: 13px; }
  .tm-cover i { font-size: 20px; }
  .tm-play { width: 42px; height: 42px; font-size: 15px; }
  .tm-title { font-size: 14.8px; }

  /* 手机上的位置：抬到**底栏上方**。
     论坛移动端有固定底栏 .f-mobilebar（约 64px 高），原来 bottom:14px
     正好压住它的按钮 —— 用户就是反馈这个（「遮盖论坛页的功能」）。
     这里用 64px + 安全区 + 8px 呼吸位，避不开的情况还能直接拖走。 */
  .tm-dock {
    right: 14px;
    /* ⚠ 实测论坛底栏高度是 **73px**（min-height 56 + 上下 padding 7+7），
       不是我以为的 64px。按 64+8=72 算的话胶囊底边会正好压在底栏上——
       实测 pill.bottom=772 / bar.top=771，差 1px 相交。
       改成 84px，留 11px 呼吸位；iPhone 的安全区再额外加。 */
    bottom: calc(84px + env(safe-area-inset-bottom, 0px));
  }
  .tm-pill { height: 42px; padding: 0 14px 0 5px; font-size: 12.6px; }
  .tm-pill-ic { width: 32px; height: 32px; font-size: 13px; }
  .tm-panel { width: 286px; padding: 13px 13px 11px; border-radius: 18px; }
}

/* 超窄屏：胶囊只留图标 */
@media (max-width: 400px) {
  .tm-pill-tx { display: none; }
  .tm-pill { padding: 0 6px; }
}


/* ============================================================================
   降级：网易云官方播放器（iframe）
   ----------------------------------------------------------------------------
   用户反馈过「播放不了」—— 那是我方音频代理（服务器去拉网易云）失败。
   这条降级路径由**玩家浏览器**直接加载官方 iframe，绕开服务器网络，
   是"一定能听"的最后一道。默认隐藏，只有真出错时才由 JS 显示。
   ========================================================================== */
.tm-official {
  display: none;
  margin-top: 12px;
}
.tm-official-tip {
  font-size: 12px;
  line-height: 1.65;
  color: rgba(245, 245, 247, .5);
  margin-bottom: 8px;
}
.tm-official-tip i { color: #6cb6ff; margin-right: 3px; }
.tm-official-tip b { color: rgba(245, 245, 247, .72); font-weight: 500; }
.tm-official iframe {
  display: block;
  width: 100%;
  border: 0;
  border-radius: 10px;
  background: transparent;
}
/* 面板里的 iframe 窄一些，避免撑破面板宽度 */
.tm-panel .tm-official iframe { max-width: 100%; }


/* ============================================================================
   胶囊可拖拽（本轮新增）
   ----------------------------------------------------------------------------
   用户反馈：「胶囊在移动端会遮盖论坛页的功能，适当修改一下
             或者可以拖拽这个胶囊」

   · 拖动时有 .is-dragging（放大一点、加投影，给"我在拖它"的反馈）
   · touch-action:none 只在拖动中生效，避免影响页面滚动
   · 拖到上半屏时 .is-up → 面板往下展开（否则面板会被视口顶上切掉）
   ========================================================================== */
.tm-pill {
  cursor: grab;
  /* 允许触摸拖动而不触发页面滚动（仅在按下后由 JS 加到 body） */
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}
.tm-dock.is-dragging .tm-pill {
  cursor: grabbing;
  transform: scale(1.06);
  box-shadow: 0 12px 34px rgba(0, 0, 0, .55);
}
body.tm-dragging { touch-action: none; }
body.tm-dragging { cursor: grabbing; }

/* 面板翻转：胶囊靠近顶部时，面板改为在胶囊下方展开 */
.tm-dock.is-up { flex-direction: column-reverse; }
.tm-dock.is-up .tm-panel { animation-name: tmInDown; }
@keyframes tmInDown {
  from { opacity: 0; transform: translateY(-8px) scale(.98); }
  to   { opacity: 1; transform: none; }
}
