/* 手机版播放器样式：移动优先，支持 iOS / Android / HarmonyOS 浏览器
   设计取舍：不含频谱 canvas、不含全屏按钮（按需求移除） */

:root {
  --accent: #6c5ce7;
  --accent-soft: rgba(108, 92, 231, 0.18);
  --bg: #0e1117;
  --panel: #161b24;
  --panel-solid: #1b212c;
  --text: #eef1f6;
  --text-dim: #aeb6c2;
  --text-faint: #6b7480;
  --line: rgba(255, 255, 255, 0.08);
  --line-strong: rgba(255, 255, 255, 0.16);
  --hover: rgba(255, 255, 255, 0.06);
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}
html[data-theme="light"] {
  --bg: #f3f5f9;
  --panel: #ffffff;
  --panel-solid: #ffffff;
  --text: #1b212c;
  --text-dim: #5a6472;
  --text-faint: #97a1b0;
  --line: rgba(0, 0, 0, 0.08);
  --line-strong: rgba(0, 0, 0, 0.14);
  --hover: rgba(0, 0, 0, 0.05);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body {
  margin: 0; padding: 0; height: 100%;
  background: var(--bg); color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", Roboto, Helvetica, Arial, sans-serif;
  overflow: hidden;
  -webkit-user-select: none; user-select: none;
  touch-action: manipulation;
}

/* 背景：封面模糊 */
#m-bg {
  position: fixed; inset: 0; z-index: 0;
  background-size: cover; background-position: center;
  filter: blur(38px) saturate(1.2); transform: scale(1.25);
  transition: background-image .4s ease;
}
#m-bg-mask {
  position: fixed; inset: 0; z-index: 1;
  background: linear-gradient(180deg, rgba(0,0,0,.35) 0%, rgba(0,0,0,.55) 100%);
}
html[data-theme="light"] #m-bg-mask {
  background: linear-gradient(180deg, rgba(255,255,255,.55) 0%, rgba(255,255,255,.7) 100%);
}

/* 顶部栏 */
#m-top {
  position: fixed; top: 0; left: 0; right: 0; z-index: 10;
  height: calc(52px + var(--safe-top));
  padding: var(--safe-top) 12px 0;
  display: flex; align-items: center; gap: 10px;
}
.m-top-title { flex: 1; text-align: center; font-size: 15px; font-weight: 600; opacity: .9; }
.m-top-right { display: flex; align-items: center; gap: 8px; }
.m-icon-btn {
  width: 38px; height: 38px; border: none; border-radius: 50%;
  background: var(--hover); color: var(--text); cursor: pointer;
  display: flex; align-items: center; justify-content: center;
}
.m-icon-btn svg { width: 20px; height: 20px; fill: currentColor; }
.m-link {
  font-size: 13px; color: var(--text-dim); text-decoration: none;
  padding: 6px 10px; border-radius: 18px; background: var(--hover);
}

/* 主体 */
#m-main {
  position: fixed; left: 0; right: 0; z-index: 5;
  top: calc(52px + var(--safe-top));
  bottom: calc(150px + var(--safe-bottom));
  display: flex; flex-direction: column; align-items: center;
  padding: 8px 18px 0;
  overflow: hidden;
}
#m-cover-wrap {
  margin-top: 6px; flex-shrink: 0;
  width: min(62vw, 260px); aspect-ratio: 1 / 1;
  border-radius: 18px; overflow: hidden;
  box-shadow: 0 18px 50px rgba(0,0,0,.45);
  background: var(--panel);
}
#m-cover { width: 100%; height: 100%; object-fit: cover; display: block; }
#m-meta { width: 100%; text-align: center; margin-top: 16px; flex-shrink: 0; }
#m-title {
  font-size: 19px; font-weight: 700; line-height: 1.3;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding: 0 8px;
}
#m-artist { font-size: 13px; color: var(--text-dim); margin-top: 6px; }

/* 歌词窗口 */
#m-lyrics {
  position: relative; flex: 1; width: 100%; margin-top: 14px;
  overflow: hidden; -webkit-mask-image: linear-gradient(180deg, transparent 0%, #000 22%, #000 78%, transparent 100%);
  mask-image: linear-gradient(180deg, transparent 0%, #000 22%, #000 78%, transparent 100%);
}
#m-lyric-inner { position: absolute; left: 0; right: 0; top: 0; transition: transform .35s cubic-bezier(.22,.61,.36,1); will-change: transform; }
.m-lyric-line {
  text-align: center; font-size: 15px; line-height: 1.45;
  padding: 9px 14px; color: var(--text-faint);
  transition: color .25s, opacity .25s, transform .25s;
  opacity: .55;
}
.m-lyric-line.cur {
  color: var(--text); opacity: 1; font-weight: 600; font-size: 16.5px;
  transform: scale(1.02);
}
.m-lyric-line.near { opacity: .8; }
#m-lyric-empty {
  position: absolute; top: 50%; left: 0; right: 0; transform: translateY(-50%);
  text-align: center; color: var(--text-faint); font-size: 14px;
}

/* 进度条 */
#m-seek-row {
  position: fixed; left: 0; right: 0; z-index: 10;
  bottom: calc(104px + var(--safe-bottom));
  display: flex; align-items: center; gap: 10px; padding: 0 20px;
}
.m-time { font-size: 11px; color: var(--text-dim); font-variant-numeric: tabular-nums; width: 38px; text-align: center; }
.m-time:last-child { width: 38px; }
.m-seek, #m-vol {
  -webkit-appearance: none; appearance: none; height: 4px; border-radius: 2px;
  background: linear-gradient(to right, var(--accent) var(--pct, 0%), var(--line) var(--pct, 0%));
  outline: none; cursor: pointer; flex: 1;
}
.m-seek::-webkit-slider-thumb, #m-vol::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none; width: 14px; height: 14px; border-radius: 50%;
  background: #fff; box-shadow: 0 1px 4px rgba(0,0,0,.4); border: none;
}
.m-seek::-moz-range-thumb, #m-vol::-moz-range-thumb {
  width: 14px; height: 14px; border-radius: 50%; background: #fff; border: none;
}

/* 主控制 */
#m-controls {
  position: fixed; left: 0; right: 0; z-index: 10;
  bottom: calc(46px + var(--safe-bottom));
  display: flex; align-items: center; justify-content: center; gap: 28px; padding: 0 20px;
}
.m-round {
  width: 54px; height: 54px; border-radius: 50%; border: none; cursor: pointer;
  background: var(--hover); color: var(--text);
  display: flex; align-items: center; justify-content: center;
  transition: transform .12s, background .15s;
}
.m-round:active { transform: scale(.92); }
.m-round svg { width: 24px; height: 24px; fill: currentColor; }
.m-round.m-play {
  width: 66px; height: 66px; background: var(--accent); color: #fff;
  box-shadow: 0 8px 24px var(--accent-soft);
}
.m-round.m-play svg { width: 30px; height: 30px; }

/* 音量 */
#m-vol-row {
  position: fixed; left: 0; right: 0; z-index: 10;
  bottom: calc(14px + var(--safe-bottom));
  display: flex; align-items: center; gap: 10px; padding: 0 24px;
}
#m-vol { flex: 1; }

/* 歌单抽屉 */
.m-drawer-mask {
  position: fixed; inset: 0; z-index: 40; background: rgba(0,0,0,.5);
  opacity: 0; visibility: hidden; transition: opacity .25s;
}
.m-drawer-mask.show { opacity: 1; visibility: visible; }
.m-drawer {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 41;
  max-height: 78vh; background: var(--panel-solid);
  border-radius: 18px 18px 0 0; padding: 10px 14px calc(14px + var(--safe-bottom));
  transform: translateY(100%); transition: transform .28s cubic-bezier(.22,.61,.36,1);
  display: flex; flex-direction: column;
  box-shadow: 0 -10px 40px rgba(0,0,0,.4);
}
.m-drawer.show { transform: translateY(0); }
.m-drawer-head { display: flex; align-items: center; gap: 10px; padding: 4px 2px 10px; }
#m-pl-select {
  flex: 1; height: 38px; border-radius: 10px; border: 1px solid var(--line);
  background: var(--panel); color: var(--text); font-size: 14px; padding: 0 10px; outline: none;
}
.m-drawer-count { font-size: 12px; color: var(--text-faint); padding: 0 2px 8px; }
#m-pl-list { overflow-y: auto; flex: 1; -webkit-overflow-scrolling: touch; }
.m-pl-item {
  display: flex; align-items: center; gap: 12px; padding: 10px 8px; border-radius: 12px;
  cursor: pointer; transition: background .15s;
}
.m-pl-item:active { background: var(--hover); }
.m-pl-item.playing { background: var(--accent-soft); }
.m-pl-idx { width: 22px; text-align: center; font-size: 12px; color: var(--text-faint); flex-shrink: 0; }
.m-pl-cover { width: 42px; height: 42px; border-radius: 8px; object-fit: cover; flex-shrink: 0; background: var(--line); }
.m-pl-info { min-width: 0; flex: 1; }
.m-pl-name { font-size: 14px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.m-pl-artist { font-size: 12px; color: var(--text-faint); margin-top: 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.m-pl-eq { width: 16px; flex-shrink: 0; display: flex; align-items: flex-end; gap: 2px; height: 16px; }
.m-pl-eq span { flex: 1; background: var(--accent); border-radius: 1px; animation: m-eq 1s ease-in-out infinite; }
.m-pl-eq span:nth-child(2) { animation-delay: .3s; }
.m-pl-eq span:nth-child(3) { animation-delay: .6s; }
@keyframes m-eq { 0%,100% { height: 30%; } 50% { height: 100%; } }

/* toast */
#m-toast {
  position: fixed; left: 50%; top: 50%; transform: translate(-50%,-50%);
  z-index: 60; max-width: 80vw; padding: 10px 18px; border-radius: 12px;
  background: rgba(0,0,0,.82); color: #fff; font-size: 13px; text-align: center;
  opacity: 0; visibility: hidden; transition: opacity .2s; pointer-events: none;
}
#m-toast.show { opacity: 1; visibility: visible; }
#m-toast.warn { background: #c99700; color: #1a1a1a; font-weight: 600; }

/* ============ 弹层（在线 / 登录 / 设置） ============ */
.m-sheet {
  position: fixed; inset: 0; z-index: 50; background: var(--bg);
  display: flex; flex-direction: column;
  transform: translateY(100%); transition: transform .28s cubic-bezier(.22,.61,.36,1);
  will-change: transform;
}
.m-sheet.show { transform: translateY(0); }
/* 登录 / 设置 为居中卡片浮层 */
#m-login, #m-settings {
  background: rgba(0,0,0,.7); transform: none; opacity: 0; visibility: hidden;
  transition: opacity .2s; align-items: center; justify-content: center; padding: 20px;
}
#m-login.show, #m-settings.show { opacity: 1; visibility: visible; transform: none; }

.m-settings-card {
  width: min(90vw, 420px);
  max-height: 80vh;
  background: var(--panel-solid);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: 0 12px 40px rgba(0,0,0,.35);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.m-settings-card .m-sheet-head {
  padding: calc(var(--safe-top) + 12px) 16px 12px;
  border-bottom: 1px solid var(--line);
}
.m-settings-card .m-set-body {
  padding: 10px 18px calc(18px + var(--safe-bottom));
}

.m-sheet-head {
  display: flex; align-items: center; gap: 10px;
  padding: calc(var(--safe-top) + 8px) 12px 8px; border-bottom: 1px solid var(--line); flex-shrink: 0;
}
.m-sheet-title { flex: 1; font-size: 16px; font-weight: 700; }
.m-sheet-tabs { display: flex; gap: 6px; flex: 1; }
.m-sheet-tabs button {
  flex: 1; height: 34px; border: none; border-radius: 10px; background: var(--hover);
  color: var(--text-dim); font-size: 13px; font-weight: 600; cursor: pointer;
}
.m-sheet-tabs button.active { background: var(--accent); color: #fff; }

.m-source-row { display: flex; gap: 6px; padding: 10px 12px; overflow-x: auto; flex-shrink: 0; }
.m-source-row button {
  flex: 0 0 auto; padding: 6px 14px; border-radius: 16px; border: 1px solid var(--line);
  background: var(--panel); color: var(--text-dim); font-size: 13px; cursor: pointer;
}
.m-source-row button.active { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }

.m-search-row { display: flex; gap: 8px; padding: 0 12px 10px; flex-shrink: 0; }
.m-search-row input {
  flex: 1; height: 40px; border-radius: 12px; border: 1px solid var(--line); background: var(--panel);
  color: var(--text); padding: 0 14px; font-size: 14px; outline: none;
}
.m-search-row button {
  padding: 0 18px; height: 40px; border: none; border-radius: 12px; background: var(--accent);
  color: #fff; font-size: 14px; font-weight: 600; cursor: pointer;
}

.m-board-row { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; padding: 0 12px 10px; flex-shrink: 0; max-height: 32vh; overflow-y: auto; -webkit-overflow-scrolling: touch; }
.m-board-row-btn {
  display: flex; align-items: center; gap: 8px; min-height: 52px; padding: 12px 12px;
  border-radius: 12px; border: 1px solid var(--line);
  background: linear-gradient(135deg, color-mix(in srgb, var(--accent) 14%, var(--panel)), var(--panel));
  color: var(--text); font-size: 13px; font-weight: 700; cursor: pointer; text-align: left; white-space: normal;
  transition: transform .12s ease, border-color .12s ease, background .12s ease;
}
.m-board-row-btn.active { border-color: var(--accent); color: var(--accent); background: linear-gradient(135deg, color-mix(in srgb, var(--accent) 26%, var(--panel)), var(--panel)); }
.m-board-row-btn:active { transform: scale(.98); }

.m-om-back {
  display: flex; align-items: center; gap: 6px;
  margin: 0 12px 8px; padding: 8px 12px; border-radius: 10px;
  background: var(--panel); border: 1px solid var(--line);
  font-size: 14px; font-weight: 600; color: var(--text);
  cursor: pointer; flex-shrink: 0;
}
.m-om-back-arrow { color: var(--accent); font-weight: 700; }
.m-om-back-text { flex: 1; }
.m-om-back:active { background: var(--hover); }

.m-list { flex: 1; overflow-y: auto; padding: 0 12px calc(12px + var(--safe-bottom)); -webkit-overflow-scrolling: touch; }
.m-om-item { display: flex; align-items: center; gap: 12px; padding: 10px 6px; border-radius: 12px; cursor: pointer; }
.m-om-item:active { background: var(--hover); }
.m-om-item.playing { background: var(--accent-soft); }
.m-om-cover { width: 46px; height: 46px; border-radius: 8px; object-fit: cover; flex-shrink: 0; background: var(--line); }
.m-om-info { min-width: 0; flex: 1; }
.m-om-title { font-size: 14px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.m-om-meta { font-size: 12px; color: var(--text-faint); margin-top: 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.m-om-badge {
  display: inline-block; margin-left: 6px; padding: 1px 6px; border-radius: 8px;
  background: var(--accent-soft); color: var(--accent); font-size: 11px;
}

.m-manage-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 0 12px 10px; }
.m-manage-count { font-size: 13px; color: var(--text-faint); }
.m-manage-item { display: flex; align-items: center; gap: 12px; padding: 10px 6px; border-radius: 12px; }
.m-manage-cover { width: 46px; height: 46px; border-radius: 8px; object-fit: cover; flex-shrink: 0; background: var(--line); }
.m-manage-info { min-width: 0; flex: 1; }
.m-manage-title { font-size: 14px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.m-manage-meta { font-size: 12px; color: var(--text-faint); margin-top: 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.m-manage-del { flex-shrink: 0; padding: 6px 12px; border: 1px solid color-mix(in srgb, #ff4d6d 40%, var(--line)); background: transparent; color: #ff4d6d; border-radius: 8px; font-size: 13px; }
.m-manage-del:active { background: color-mix(in srgb, #ff4d6d 14%, transparent); }
.m-manage-empty { font-size: 13px; color: var(--text-faint); padding: 16px 12px; line-height: 1.6; }

.m-loading-row {
  display: flex; align-items: center; gap: 12px; padding: 10px 14px;
  border-radius: 12px; background: color-mix(in srgb, var(--accent) 6%, transparent);
}
.m-loading-bar {
  flex: 1; height: 4px; border-radius: 2px; overflow: hidden;
  background: var(--line); position: relative;
}
.m-loading-bar::after {
  content: ''; position: absolute; left: 0; top: 0; height: 100%; width: 30%;
  background: var(--accent); border-radius: 2px;
  animation: m-slide 1s ease-in-out infinite;
}
@keyframes m-slide { 0% { left: -30%; } 100% { left: 100%; } }
.m-loading-label { font-size: 12px; color: var(--text-dim); white-space: nowrap; }
.m-om-play { width: 34px; height: 34px; border-radius: 50%; border: none; background: var(--hover); color: var(--text); display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.m-om-play svg { width: 18px; height: 18px; fill: currentColor; }
.m-om-empty, .m-om-loading { text-align: center; color: var(--text-faint); font-size: 14px; padding: 40px 0; }
.m-om-loading::after { content: ''; display: block; width: 22px; height: 22px; margin: 10px auto 0; border: 2px solid var(--line-strong); border-top-color: var(--accent); border-radius: 50%; animation: m-spin .8s linear infinite; }
@keyframes m-spin { to { transform: rotate(360deg); } }

.m-om-pager {
  display: flex; align-items: center; gap: 12px; justify-content: center;
  padding: 8px 12px calc(10px + var(--safe-bottom)); border-top: 1px solid var(--line); flex-shrink: 0;
}
.m-om-pager button { padding: 8px 16px; border-radius: 10px; border: 1px solid var(--line); background: var(--panel); color: var(--text); font-size: 13px; cursor: pointer; }
.m-om-pager button:disabled { opacity: .4; }
.m-om-pager span { font-size: 13px; color: var(--text-dim); }

.m-sl-item { display: flex; align-items: center; gap: 12px; padding: 10px 6px; border-radius: 12px; cursor: pointer; }
.m-sl-item:active { background: var(--hover); }
.m-sl-cover { width: 46px; height: 46px; border-radius: 8px; object-fit: cover; flex-shrink: 0; background: var(--line); }
.m-sl-info { min-width: 0; flex: 1; }
.m-sl-name { font-size: 14px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.m-sl-meta { font-size: 11px; color: var(--text-faint); margin-top: 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* 登录 */
.m-login-card {
  width: min(86vw, 340px); background: var(--panel-solid); border: 1px solid var(--line);
  border-radius: 16px; padding: 22px 20px; display: flex; flex-direction: column; gap: 12px;
}
.m-login-title { font-size: 17px; font-weight: 700; text-align: center; margin-bottom: 4px; }
.m-login-card input { height: 42px; border-radius: 10px; border: 1px solid var(--line); background: var(--panel); color: var(--text); padding: 0 14px; font-size: 14px; outline: none; }
.m-login-err { color: #ff6b6b; font-size: 13px; min-height: 16px; text-align: center; }
.m-login-card button#m-login-btn { height: 44px; border: none; border-radius: 10px; background: var(--accent); color: #fff; font-size: 15px; font-weight: 600; cursor: pointer; }
.m-login-card .m-link { text-align: center; }

/* 设置 */
.m-set-body { flex: 1; overflow-y: auto; padding: 10px 16px calc(16px + var(--safe-bottom)); }
.m-field { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 0; border-bottom: 1px solid var(--line); }
.m-field label { font-size: 14px; color: var(--text); }
.m-field input[type=color] { width: 48px; height: 34px; border: none; background: none; border-radius: 8px; cursor: pointer; padding: 0; }
.m-set-btn { padding: 8px 16px; border-radius: 10px; border: 1px solid var(--line); background: var(--panel); color: var(--text); font-size: 13px; cursor: pointer; }
.m-set-btn.m-danger { color: #ff6b6b; border-color: rgba(255,107,107,.4); }
.m-seg { display: flex; gap: 6px; }
.m-seg button { padding: 7px 12px; border-radius: 10px; border: 1px solid var(--line); background: var(--panel); color: var(--text-dim); font-size: 13px; cursor: pointer; }
.m-seg button.active { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }
