/* 音频媒体插件 */

/* ========== 顶部按钮：均衡器图标（暂停静态 / 播放动画） ========== */
.bar-actions .audio-bar-btn,
.audio-bar-btn{
  position:relative;
  display:inline-grid;
  place-items:center;
  padding:0;
  line-height:0;
  box-sizing:border-box;
}
/* 移动端榜单替换位：PC 必须隐藏（勿被上面的 display:inline-grid 盖掉） */
.bar-rank-btn.audio-bar-btn{
  display:none!important;
}
.audio-bar-slot{
  position:relative;
  width:18px;height:18px;
  display:grid;place-items:center;
}
.audio-bar-btn .audio-eq{
  display:inline-flex;
  align-items:flex-end;
  justify-content:center;
  gap: 4px;
  width:14px;
  height:14px;
  margin:0;
  padding:0;
  line-height:0;
}
.audio-bar-btn .audio-eq i{
  display:block;width:2px;border-radius:1px;background:currentColor;
  transform-origin:center bottom;
  transform:scaleY(1);
  animation:none;
}
.audio-bar-btn .audio-eq i:nth-child(1){height:7px}
.audio-bar-btn .audio-eq i:nth-child(2){height:12px}
.audio-bar-btn .audio-eq i:nth-child(3){height:8px}
.audio-bar-btn.is-playing .audio-eq i{
  animation:audioEq .9s ease-in-out infinite;
}
.audio-bar-btn.is-playing .audio-eq i:nth-child(1){animation-delay:0s}
.audio-bar-btn.is-playing .audio-eq i:nth-child(2){animation-delay:.15s}
.audio-bar-btn.is-playing .audio-eq i:nth-child(3){animation-delay:.3s}
@keyframes audioEq{
  0%,100%{transform:scaleY(.45)}
  50%{transform:scaleY(1)}
}
/* 仅移动端显示榜单替换的音乐按钮 */
@media (max-width:720px){
  .bar-rank-btn.audio-bar-btn{
    display:inline-grid!important;
  }
  .audio-bar-slot{width:22px;height:22px}
  .audio-bar-btn .audio-eq{width:16px;height:16px;gap: 4px;}
  .bar-rank-btn.audio-bar-btn .audio-eq i,
  .audio-bar-btn .audio-eq i{
    width:2px!important;
    max-width:2px!important;
    font-size:0!important;
    line-height:0!important;
    display:block!important;
  }
  .bar-rank-btn.audio-bar-btn .audio-eq i:nth-child(1),
  .audio-bar-btn .audio-eq i:nth-child(1){height:8px!important}
  .bar-rank-btn.audio-bar-btn .audio-eq i:nth-child(2),
  .audio-bar-btn .audio-eq i:nth-child(2){height:14px!important}
  .bar-rank-btn.audio-bar-btn .audio-eq i:nth-child(3),
  .audio-bar-btn .audio-eq i:nth-child(3){height:10px!important}
}

/* ========== 右侧抽屉（无圆角） ========== */
.audio-drawer[hidden]{display:none!important}
.audio-drawer{position:fixed;inset:0;z-index:1300}
/* 抽屉打开时用 class 锁滚动，避免 soft-nav 后遗留 inline overflow 导致整站无法滚动 */
html.audio-drawer-open{overflow:hidden}
.audio-drawer-mask{
  position:absolute;inset:0;
  background:rgba(15,23,42,.45);
  backdrop-filter:blur(2px);
  animation:audioFadeIn .2s ease;
}
@keyframes audioFadeIn{from{opacity:0}to{opacity:1}}
.audio-drawer-panel{
  position:absolute;top:0;right:0;height:100%;
  width:min(360px,94vw);
  display:flex;flex-direction:column;
  background:var(--surface,#fff);
  color:var(--text,#1f2937);
  box-shadow:-12px 0 40px rgba(15,23,42,.18);
  border-radius:0;
  overflow:hidden;
  transform:translateX(0);
  animation:audioSlideIn .28s cubic-bezier(.22,1,.36,1);
}
@keyframes audioSlideIn{from{transform:translateX(100%)}to{transform:translateX(0)}}

.audio-drawer-hero{
  position:relative;
  padding:28px 22px 22px;
  background:
    radial-gradient(120% 80% at 10% -10%, color-mix(in srgb, var(--accent,#246384) 28%, transparent), transparent 55%),
    linear-gradient(160deg, color-mix(in srgb, var(--accent,#246384) 10%, #fff) 0%, var(--surface,#fff) 70%);
  border-bottom:1px solid var(--line,#e6eef0);
}
.audio-drawer-x{
  position:absolute;
  top:12px;
  right:12px;
  width:34px;
  height:34px;
  border:0;
  border-radius: 99px;
  background:rgba(255,255,255,.72);
  color:var(--muted,#6b7785);
  cursor:pointer;
  display:grid;
  place-items:center;
  transition:background .15s,color .15s;
}
.audio-drawer-x:hover{background:#fff;color:var(--text,#1f2937)}
.audio-drawer-x i{font-size:18px;line-height:1}

.audio-now-cover{
  width:108px;height:108px;margin:8px auto 16px;
  border-radius:50%;
  display:grid;place-items:center;
  overflow:hidden;
  background:linear-gradient(145deg, #3d6b84 0%, #246384 45%, #1a4a63 100%);
  color:#fff;font-size:42px;
  box-shadow:0 14px 28px rgba(36,99,132,.28);
  background-size:cover;
  background-position:center;
  position:relative;
}
.audio-now-cover img{
  position:absolute;inset:0;width:100%;height:100%;
  object-fit:cover;border-radius:50%;
}
.audio-now-cover.has-img i{display:none}
.audio-drawer.is-playing .audio-now-cover,
.audio-now-cover.is-spin{
  animation:audioDisc 10s linear infinite;
}
@keyframes audioDisc{
  from{transform:rotate(0)}
  to{transform:rotate(360deg)}
}
.audio-now-meta{text-align:center;min-width:0;margin:0 0 18px}
.audio-now-meta strong{
  display:block;font-size:17px;font-weight:750;letter-spacing:.01em;
  overflow:hidden;text-overflow:ellipsis;white-space:nowrap;
}
.audio-now-meta span{
  display:block;margin-top:6px;font-size:13px;color:var(--muted,#6b7785);
  overflow:hidden;text-overflow:ellipsis;white-space:nowrap;
}

.audio-progress-wrap{padding:0 4px 14px}
.audio-time-row{
  display:flex;justify-content:space-between;
  margin-top:8px;font-size:11px;color:var(--muted,#6b7785);font-variant-numeric:tabular-nums;
}

.audio-controls{display:flex;justify-content:center;align-items:center;gap:18px}
.audio-ctrl-btn{
  width:44px;height:44px;border-radius:50%;border:0;
  background:color-mix(in srgb, var(--accent,#246384) 8%, #fff);
  color:var(--text-soft,#4b5563);
  display:grid;place-items:center;cursor:pointer;
  transition:transform .15s,background .15s,color .15s;
}
.audio-ctrl-btn i{font-size:20px;line-height:1}
.audio-ctrl-btn:hover{background:color-mix(in srgb, var(--accent,#246384) 16%, #fff);color:var(--text,#1f2937)}
.audio-ctrl-btn:active{transform:scale(.94)}
.audio-ctrl-btn.is-main{
  width:58px;height:58px;
  background:var(--accent,#246384);color:#fff;
  box-shadow:0 10px 22px rgba(36,99,132,.32);
}
.audio-ctrl-btn.is-main:hover{filter:brightness(1.06);color:#fff}
.audio-ctrl-btn.is-main i{font-size:26px}

.audio-drawer-body{
  flex:1;min-height:0;display:flex;flex-direction:column;
  background:var(--chip,#f4f7f8);
}
.audio-drawer-section{
  display:flex;align-items:baseline;justify-content:space-between;
  padding:14px 18px 6px;
}
.audio-drawer-section strong{font-size:13px;font-weight:700;color:var(--text,#1f2937)}
.audio-drawer-section em{font-style:normal;font-size:11px;color:var(--muted,#6b7785)}

.audio-playlist{
  list-style:none;margin:0;padding:4px 12px 24px;overflow:auto;flex:1;
}
.audio-playlist li{
  display:flex;
  align-items:center;
  gap:12px;
  padding:11px 12px;
  border-radius: 16px;
  cursor:pointer;
  margin-bottom:4px;
  background:transparent;
  transition:background .15s;
}
.audio-playlist li:hover{background:rgba(255,255,255,.85)}
.audio-playlist li.is-active{
  background:#fff;
  box-shadow:0 1px 3px rgba(15,23,42,.06);
}
.audio-playlist .cover{
  width:40px;height:40px;border-radius:50%;flex:0 0 auto;
  overflow:hidden;display:grid;place-items:center;
  background:linear-gradient(145deg,#3d6b84,#246384);color:#fff;font-size:16px;
}
.audio-playlist .cover img{width:100%;height:100%;object-fit:cover}
.audio-playlist .idx{
  width:24px;height:24px;
  display:grid;place-items:center;
  font-size:11px;font-weight:650;flex:0 0 auto;
  color:var(--muted,#6b7785);
}
.audio-playlist li.is-active .idx{color:var(--accent,#246384)}
.audio-playlist .meta{min-width:0;flex:1}
.audio-playlist .meta strong{
  display:block;font-size:13px;font-weight:650;
  overflow:hidden;text-overflow:ellipsis;white-space:nowrap;
}
.audio-playlist .meta span{
  display:block;margin-top:2px;font-size:11px;color:var(--muted,#6b7785);
  overflow:hidden;text-overflow:ellipsis;white-space:nowrap;
}
.audio-playlist-empty{
  padding:36px 16px;text-align:center;font-size:12px;line-height:1.6;
  color:var(--muted,#6b7785);
}

/* ========== 发帖拓展编辑器 ========== */
.audio-editor{
  margin:0;background:transparent;padding:16px;
  border:1px solid var(--line, var(--lyear-field-border, #e6eef0));border-radius:14px;
}
.audio-editor.is-admin{
  margin:0 0 16px;padding:16px;
  border:1px solid var(--lyear-field-border, #e5e7eb);border-radius:8px;
  background:var(--lyear-field-bg, transparent);
}
.audio-editor-head{display:flex;flex-direction:column;gap:4px;margin:0 0 12px}
.audio-editor-title{display:flex;align-items:center;gap:8px;min-width:0}
.audio-editor-title i{font-size:18px;line-height:1;color:var(--accent,#246384);flex:0 0 auto}
.audio-editor-title strong{font-size:15px;font-weight:750;line-height:1.3}
.audio-editor-tip{margin:0;font-size:12px;line-height:1.5;color:var(--muted, var(--lyear-muted, #6b7785))}
.audio-editor-actions{display:flex;flex-wrap:wrap;gap:8px;margin:0 0 12px}
.audio-link-form{
  display:grid;grid-template-columns:minmax(0,1.6fr) minmax(0,.9fr) minmax(0,.9fr) auto auto;
  gap:8px;align-items:center;margin:0 0 12px;padding:12px;
  border:1px dashed var(--line, var(--lyear-field-border, #e6eef0));
  border-radius:12px;background:var(--chip, var(--lyear-field-bg, #f4f7f8));
}
.audio-link-form[hidden]{display:none!important}
.audio-link-form input{
  width:100%;height:34px;padding:0 10px;box-sizing:border-box;
  border:1px solid var(--lyear-field-border, #dce4e8);border-radius:8px;font-size:12px;
  background:var(--lyear-field-bg, #fff);color:inherit;
}
.audio-editor.is-admin .audio-link-form{
  border-radius:8px;border:1px dashed var(--lyear-field-border, #d0d7de);
}
.audio-ed-row.is-link{grid-template-columns:48px minmax(0,1fr) minmax(90px,.8fr) minmax(90px,.8fr) minmax(120px,1.2fr) auto}
.audio-editor-list{display:flex;flex-direction:column;gap:8px}
.audio-editor-empty{
  padding:18px 12px;border-radius:12px;border:1px dashed var(--line, var(--lyear-field-border, #e6eef0));
  background:var(--chip, var(--lyear-field-bg, #f4f7f8));text-align:center;font-size:12px;
  color:var(--muted, var(--lyear-muted, #6b7785));line-height:1.5;
}
.audio-ed-row{
  display:grid;grid-template-columns:48px minmax(0,1.2fr) minmax(90px,.9fr) minmax(90px,.9fr) auto;
  gap:8px;align-items:center;padding:10px 12px;border-radius:12px;
  background:var(--chip, var(--lyear-field-bg, #f4f7f8));
}
.audio-ed-icon{
  width:48px;height:48px;border-radius:50%;display:grid;place-items:center;
  background:#fff;border:1px solid var(--line,#e6eef0);color:#246384;font-size:18px;
  overflow:hidden;flex:0 0 auto;
}
.audio-ed-icon img{width:100%;height:100%;object-fit:cover}
.audio-ed-main{min-width:0}
.audio-ed-main strong{display:block;font-size:12px;font-weight:650;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.audio-ed-main span{display:block;margin-top:3px;font-size:11px;color:var(--muted,#6b7785)}
.audio-ed-row input{
  width:100%;height:34px;padding:0 8px;box-sizing:border-box;
  border:1px solid var(--lyear-field-border, #dce4e8);border-radius:8px;font-size:12px;
  background:var(--lyear-field-bg, #fff);color:inherit;
}
.audio-editor.is-admin .audio-ed-row input,
.audio-editor.is-admin .form-control{
  border:1px solid var(--lyear-field-border, #d0d7de)!important;
  background:var(--lyear-field-bg, #fff)!important;border-radius:8px!important;box-shadow:none!important;
}
.audio-ed-progress{height:4px;border-radius:999px;background:#e5e7eb;overflow:hidden;margin-top:6px}
.audio-ed-progress>i{display:block;height:100%;width:0;background:var(--accent,#246384)}
.audio-ed-row.is-uploading{opacity:.85}
.audio-ed-row.is-error .audio-ed-main span{color:#c0392b}
.audio-ed-del{height:32px;padding:0 12px;white-space:nowrap}

/* ========== 帖内音乐 ========== */
.topic-audio-block{
  --ta-cover: clamp(56px, 18vw, 76px);
  --ta-pad: clamp(8px, 2.2vw, 12px);
  --ta-gap: clamp(8px, 2vw, 12px);
  --ta-radius: clamp(10px, 2.4vw, 14px);
  --ta-title: clamp(12px, 3.2vw, 14px);
  --ta-meta: clamp(11px, 2.8vw, 12px);
  --ta-ico: clamp(18px, 5vw, 24px);
  margin:22px 0 0;padding:0;
  border:1px solid var(--line,#e6eef0);border-radius:16px;
  overflow:hidden;
  background:
    linear-gradient(180deg, color-mix(in srgb, var(--accent,#246384) 6%, #fff) 0%, var(--surface,#fff) 48%);
}
.topic-audio-head{
  display:flex;align-items:center;gap:8px;
  padding:14px 16px 10px;
}
.topic-audio-head i{font-size:18px;color:var(--accent,#246384);width:auto;height:auto;background:none;border-radius:0}
.topic-audio-head strong{font-size:15px;font-weight:750}
.topic-audio-head span{margin-left:auto;font-size:12px;color:var(--muted,#6b7785)}
.topic-audio-list{display:flex;flex-direction:column;gap:10px;padding:0 12px 14px}

.topic-audio-card{
  display:grid;
  grid-template-columns:var(--ta-cover) minmax(0,1fr);
  grid-template-rows:var(--ta-cover);
  gap:var(--ta-gap);
  align-items:stretch;
  padding:var(--ta-pad);
  border-radius:var(--ta-radius);
  background:var(--surface,#fff);
  border:1px solid color-mix(in srgb, var(--line,#e6eef0) 80%, transparent);
  box-shadow:0 1px 2px rgba(15,23,42,.03);
  transition:border-color .15s,box-shadow .15s;
  box-sizing:border-box;
}
.topic-audio-card.is-playing{
  border-color:color-mix(in srgb, var(--accent,#246384) 35%, var(--line,#e6eef0));
  box-shadow:0 6px 18px rgba(36,99,132,.1);
}

.topic-audio-cover{
  position:relative;
  width:100%;height:100%;
  border:0;padding:0;margin:0;
  border-radius:calc(var(--ta-radius) - 2px);
  overflow:hidden;cursor:pointer;
  display:grid;place-items:center;
  background:linear-gradient(145deg, #5b8def 0%, #7c5cbf 55%, #246384 100%);
  color:#fff;
  box-shadow:0 6px 14px rgba(36,99,132,.18);
  transition:transform .15s,filter .15s;
  align-self:stretch;justify-self:stretch;
}
.topic-audio-cover:hover{filter:brightness(1.05)}
.topic-audio-cover:active{transform:scale(.97)}
.topic-audio-cover img{
  position:absolute;inset:0;width:100%;height:100%;object-fit:cover;
}
.topic-audio-cover.has-cover::after{
  content:'';position:absolute;inset:0;
  background:rgba(15,23,42,.28);
  pointer-events:none;
}
.topic-audio-play-ico{
  position:relative;z-index:2;
  font-size:var(--ta-ico);line-height:1;margin-left:1px;
  text-shadow:0 1px 6px rgba(0,0,0,.4);
  transition:transform .15s;
}
.topic-audio-card.is-playing .topic-audio-play-ico{transform:scale(1.02)}

.topic-audio-body{
  min-width:0;height:100%;
  display:flex;flex-direction:column;justify-content:space-between;
  gap:6px;padding:1px 0;
  box-sizing:border-box;
}
.topic-audio-main{min-width:0}
.topic-audio-main strong{
  display:block;font-size:var(--ta-title);font-weight:650;line-height:1.3;
  overflow:hidden;text-overflow:ellipsis;white-space:nowrap;
}
.topic-audio-main span{
  display:block;
  margin-top: 8px;
  font-size: 12px;
  color:var(--muted,#6b7785);
  line-height: 1;
  overflow:hidden;
  text-overflow:ellipsis;
  white-space:nowrap;
}
@media (max-width:768px){
  .topic-audio-main span{
    margin-top: 4px;   
    font-size: 8px;    
    line-height:1.1;   
  }
}
.topic-audio-progress-row{
  display:grid;
  grid-template-columns:auto minmax(0,1fr) auto;
  gap:8px;align-items:center;
  flex:0 0 auto;
}
.topic-audio-cur,
.topic-audio-dur{
  font-size:clamp(10px, 2.6vw, 11px);
  color:var(--muted,#6b7785);
  font-variant-numeric:tabular-nums;
  line-height:1;flex:0 0 auto;
  min-width:2.4em;
}
.topic-audio-dur{text-align:right}
.topic-audio-card .ta-audio{display:none}

/* 统一进度条（顶部抽屉 + 帖内） */
.audio-range,
.audio-progress-wrap input[type=range],
.topic-audio-progress-row input[type=range]{
  -webkit-appearance:none;appearance:none;
  width:100%;height:4px;border-radius:999px;
  background:linear-gradient(to right,
    var(--accent,#246384) 0%,
    var(--accent,#246384) var(--audio-pct,0%),
    color-mix(in srgb, var(--accent,#246384) 16%, #e8eef2) var(--audio-pct,0%),
    color-mix(in srgb, var(--accent,#246384) 16%, #e8eef2) 100%);
  outline:none;cursor:pointer;margin:0;padding:0;vertical-align:middle;
}
.audio-range::-webkit-slider-thumb,
.audio-progress-wrap input[type=range]::-webkit-slider-thumb,
.topic-audio-progress-row input[type=range]::-webkit-slider-thumb{
  -webkit-appearance:none;appearance:none;
  width:14px;height:14px;border-radius:50%;
  background:var(--accent,#246384);border:2px solid #fff;
  box-shadow:0 1px 4px rgba(0,0,0,.18);cursor:pointer;
}
.audio-range::-moz-range-thumb,
.audio-progress-wrap input[type=range]::-moz-range-thumb,
.topic-audio-progress-row input[type=range]::-moz-range-thumb{
  width:14px;height:14px;border-radius:50%;
  background:var(--accent,#246384);border:2px solid #fff;cursor:pointer;
}
.audio-range::-moz-range-track,
.audio-progress-wrap input[type=range]::-moz-range-track,
.topic-audio-progress-row input[type=range]::-moz-range-track{
  height:4px;border-radius:999px;background:transparent;
}

@media (max-width:720px){
  .topic-audio-block{
    --ta-cover: clamp(48px, 16vw, 64px);
    --ta-pad: 8px;
    --ta-gap: 8px;
    --ta-radius: 12px;
    --ta-title: 13px;
    --ta-meta: 11px;
    --ta-ico: 20px;
  }
  .topic-audio-list{padding:0 10px 12px}
  .topic-audio-progress-row{gap:6px}
  .audio-link-form{grid-template-columns:1fr}
  .audio-ed-row{grid-template-columns:48px minmax(0,1fr)}
  .audio-ed-row input,.audio-ed-del{grid-column:1 / -1}
  .audio-ed-row.is-link{grid-template-columns:48px minmax(0,1fr)}
  .audio-drawer-panel{width:min(100vw,100%);border-radius:0}
  .audio-now-cover{width:96px;height:96px;font-size:36px}
}
@media (max-width:420px){
  .topic-audio-block{
    --ta-cover: 48px;
    --ta-ico: 18px;
    --ta-title: 12px;
  }
}
