/* ============================================================
   5TV 音乐 App — 移动端样式
   对齐 Ardot 设计稿：#121212 画布 / #181818 卡片 / #1DB954 信号色
   ============================================================ */

:root {
  --canvas: #121212;
  --card: #181818;
  --card-hover: #282828;
  --green: #1DB954;
  --white: #FFFFFF;
  --text-2: #A1A1AA;
  --text-3: #71717A;
  --danger: #FB7185;
  --radius: 8px;
  --radius-lg: 12px;
  --pill: 36px;
  --safe-b: 21px;
}

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

html, body {
  height: 100%;
  background: var(--canvas);
  color: var(--white);
  font-family: "PingFang SC", "Noto Sans SC", "Microsoft YaHei", -apple-system, sans-serif;
  font-size: 15px;
  line-height: 1.5;
  overscroll-behavior: none;
}

body {
  display: flex;
  justify-content: center;
  align-items: stretch;
  overflow-x: hidden;
  overflow-y: hidden;
  width: 100vw;
}

/* ---------- 手机外框（桌面预览用，真机全屏） ---------- */
.phone {
  width: 393px;
  max-width: 100vw;
  flex: 0 0 auto;
  height: 100vh;
  max-height: 100vh;
  background: var(--canvas);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: relative;
}
/* 关键：允许弹性子项收缩，避免内容撑破 393px */
.phone .scroll, .phone .header, .phone .sheet { min-width: 0; }
@media (max-width: 480px) {
  .phone { width: 100vw; }
}

/* ---------- 状态栏 ---------- */
.statusbar {
  height: 62px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 18px 0 22px;
}
.statusbar .time { font-size: 15px; font-weight: 600; letter-spacing: 0.2px; }
.statusbar .icons { display: flex; align-items: center; gap: 5px; }
.statusbar .icons svg { display: block; }

/* ---------- 页面容器 ---------- */
.screen { flex: 1; display: none; flex-direction: column; overflow: hidden; }
.screen.active { display: flex; }

.scroll {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding-bottom: 118px;
}
.scroll::-webkit-scrollbar { width: 0; }

/* ---------- 标题区 ---------- */
.header { padding: 0 20px 10px; flex-shrink: 0; }
.header h1 { font-size: 28px; font-weight: 700; line-height: 1.15; }
.header p { font-size: 13px; color: var(--text-2); margin-top: 6px; }
.header .row { display: flex; align-items: center; justify-content: space-between; }

/* ---------- 底部胶囊导航 ---------- */
/* 播放器与登录页为沉浸态，用 body 类兜底隐藏（不依赖 JS 执行时机） */
body.immersive .tabbar { display: none !important; }
.tabbar {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  padding: 12px var(--safe-b) var(--safe-b);
  pointer-events: none;
  z-index: 50;
}
.tabbar .pill {
  pointer-events: auto;
  height: 62px;
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: var(--pill);
  padding: 4px;
  display: flex;
  gap: 0;
  backdrop-filter: blur(12px);
}
.tabbar .tab {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  border-radius: 26px;
  cursor: pointer;
  transition: background .18s ease;
}
.tabbar .tab span {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.5px;
  color: var(--text-2);
}
.tabbar .tab.on { background: var(--green); }
.tabbar .tab.on span { color: #0A0A0B; }
.tabbar .tab.on svg { stroke: #0A0A0B; }

/* ---------- 首页 ---------- */
.hero {
  border-radius: var(--radius-lg);
  padding: 16px;
  height: 186px;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  position: relative;
  overflow: hidden;
  background: linear-gradient(135deg, #23785A 0%, #0F141F 100%);
}
.hero .badge {
  position: absolute; top: 16px; left: 16px;
  background: var(--green); color: #0A0A0B;
  font-size: 11px; font-weight: 600;
  padding: 4px 10px; border-radius: 11px;
}
.hero h2 { font-size: 26px; font-weight: 700; }
.hero p { font-size: 12px; color: rgba(255,255,255,0.72); margin-top: 4px; }
.hero .play {
  position: absolute; right: 14px; bottom: 14px;
  width: 56px; height: 56px; border-radius: 50%;
  background: var(--green);
  display: flex; align-items: center; justify-content: center;
  border: none; cursor: pointer;
}

.section { margin-top: 26px; }
.section:first-child { margin-top: 0; }
.section > h3 { font-size: 19px; font-weight: 700; margin-bottom: 14px; }
.section > .more { font-size: 12px; color: var(--text-2); font-weight: 500; }

/* 分类标签 */
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  padding: 8px 16px; border-radius: 16px;
  background: var(--card); font-size: 13px; cursor: pointer;
  border: 1px solid transparent; transition: all .18s;
}
.chip.on { background: var(--green); color: #0A0A0B; font-weight: 600; }

/* MV 网格 */
.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px 14px; }
.mv-card { cursor: pointer; }
.mv-card .cover {
  width: 100%; aspect-ratio: 1; border-radius: var(--radius);
  position: relative; overflow: hidden;
  background: linear-gradient(135deg, #3D7A5B, #12212E);
}
.mv-card .cover .flag {
  position: absolute; right: 6px; bottom: 6px;
  width: 34px; height: 34px; border-radius: 50%;
  background: rgba(0,0,0,.45); backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center;
}
.mv-card .cover .dur {
  position: absolute; left: 8px; bottom: 8px;
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 10px; color: var(--white);
}
.mv-card h4 { font-size: 15px; font-weight: 700; margin-top: 8px; line-height: 21px; }
.mv-card p { font-size: 12px; color: var(--text-2); }

/* ---------- 分类页 ---------- */
.cat-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.cat-card {
  height: 124px; border-radius: 10px; padding: 14px;
  display: flex; flex-direction: column; justify-content: flex-end;
  cursor: pointer; position: relative; overflow: hidden;
}
.cat-card h4 { font-size: 16px; font-weight: 700; }
.cat-card p { font-size: 12px; color: rgba(255,255,255,0.78); margin-top: 4px; }
.cat-card.todo { background: var(--card); border: 1px solid rgba(255,255,255,0.10); }
.cat-card.todo h4 { color: var(--text-3); }
.cat-card.todo p { color: #FBBF24; }

.list-card { background: rgba(255,255,255,0.05); border-radius: var(--radius-lg); overflow: hidden; }
.row-item {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 16px; cursor: pointer;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}
.row-item:last-child { border-bottom: none; }
.row-item .thumb {
  width: 48px; height: 48px; border-radius: 6px; flex-shrink: 0;
  background: linear-gradient(135deg, #3D7A5B, #12212E);
  position: relative; overflow: hidden;
}
.row-item .info { flex: 1; min-width: 0; }
.row-item .info h4 { font-size: 14px; font-weight: 600; }
.row-item .info p { font-size: 11px; color: var(--text-2); margin-top: 4px; }
.row-item .val { font-size: 12px; color: var(--text-3); }
.chev { color: var(--text-3); flex-shrink: 0; }

/* ---------- 搜索页 ---------- */
.searchbar {
  display: flex; align-items: center; gap: 10px;
  background: var(--card); border-radius: 25px;
  height: 44px; padding: 0 16px; margin: 0 20px 8px;
}
.searchbar input {
  flex: 1; background: none; border: none; outline: none;
  color: var(--white); font-size: 15px; font-family: inherit;
}
.searchbar input::placeholder { color: var(--text-3); }
.searchbar .clear {
  border: none; background: none; color: var(--text-2);
  cursor: pointer; font-size: 18px; padding: 0; line-height: 1;
}

.tag {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 10px 16px; border-radius: 22px;
  background: var(--card); font-size: 13px; cursor: pointer;
  border: 1px solid transparent; transition: all .18s;
}
.tag.on { background: var(--green); color: #0A0A0B; font-weight: 600; }

/* ---------- 播放器 ---------- */
.player-stage {
  position: relative; flex-shrink: 0;
  aspect-ratio: 16/10; background: #000;
  display: flex; align-items: center; justify-content: center;
  overflow: hidden;
}
.player-stage video { width: 100%; height: 100%; object-fit: contain; background: #000; }
.stage-center {
  position: absolute; width: 66px; height: 66px; border-radius: 50%;
  background: rgba(0,0,0,.45); border: 1px solid rgba(255,255,255,.28);
  display: flex; align-items: center; justify-content: center; cursor: pointer;
}
.stage-badge {
  position: absolute; top: 14px; left: 14px;
  background: rgba(0,0,0,.55); color: var(--white);
  font-size: 11px; font-weight: 600; padding: 4px 10px; border-radius: 11px;
}

.sheet { flex: 1; display: flex; flex-direction: column; overflow: hidden; }
.sheet-head { padding: 18px 20px 10px; display: flex; align-items: flex-start; }
.sheet-head h2 { font-size: 23px; font-weight: 700; line-height: 30px; }
.sheet-head p { font-size: 13px; color: var(--text-2); margin-top: 5px; }
.like-btn {
  margin-left: auto; background: none; border: none; cursor: pointer;
  color: var(--text-2); padding: 4px;
}
.like-btn.on { color: var(--green); }

.progress-box { padding: 6px 20px; }
.track { height: 4px; background: rgba(255,255,255,0.18); border-radius: 2px; cursor: pointer; position: relative; }
.track .fill { height: 100%; background: var(--green); border-radius: 2px; width: 0; }
.times { display: flex; justify-content: space-between; margin-top: 8px; }
.times span { font-family: "JetBrains Mono", ui-monospace, monospace; font-size: 11px; }
.times .cur { color: var(--white); }
.times .tot { color: var(--text-2); }

.ctrl-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 26px;
}
.ctrl-btn {
  background: none; border: none; cursor: pointer; color: var(--text-2);
  display: flex; align-items: center; justify-content: center;
  width: 36px; height: 36px; padding: 0;
}
.ctrl-btn.main {
  width: 66px; height: 66px; border-radius: 50%;
  background: var(--green);
}

/* 歌词区 */
.lyrics {
  flex: 1; overflow-y: auto; padding: 10px 20px 16px;
  display: flex; flex-direction: column; gap: 10px;
  -webkit-mask-image: linear-gradient(180deg, transparent, #000 12%, #000 88%, transparent);
          mask-image: linear-gradient(180deg, transparent, #000 12%, #000 88%, transparent);
}
.lyrics::-webkit-scrollbar { width: 0; }
.lyrics p { font-size: 15px; color: var(--text-3); line-height: 26px; transition: color .2s, font-size .2s; }
/* 当前行：放大 + 主色 + 左侧竖条指示 */
.lyrics p.on {
  color: var(--white); font-size: 17px; font-weight: 700;
  text-shadow: 0 0 18px rgba(29,185,84,.35);
}
.lyrics p.on::before {
  content: ''; display: block;
  width: 3px; height: 15px; border-radius: 2px;
  background: var(--green); margin: 0 auto 7px;
}
/* 相邻行弱化，形成聚焦层次 */
.lyrics p.near { color: var(--text-2); }
.lyrics p.cur { color: var(--white); font-size: 17px; font-weight: 700; }
.lyrics .empty { color: #FBBF24; font-size: 15px; font-weight: 700; }
.lyrics .empty-desc { color: var(--text-2); font-size: 12px; line-height: 19px; }

/* 迷你播放条：保留 iOS 安全区（home indicator） */
.minibar {
  height: 64px;
  flex-shrink: 0;
  margin-bottom: 0;
  padding-bottom: env(safe-area-inset-bottom, 0);
  background: rgba(255,255,255,0.06);
  backdrop-filter: blur(12px);
  display: flex; align-items: center; gap: 12px; padding: 0 16px;
}
.minibar .mini-cover {
  width: 40px; height: 40px; border-radius: 6px; flex-shrink: 0;
  background: linear-gradient(135deg,#3D7A5B,#12212E);
  position: relative; overflow: hidden;
}

/* ---------- 真实封面层 ----------
   容器已有渐变作为底，img 叠在上层。
   onerror 时 JS 移除 img，自动露出渐变，不会出现破图。 */
.cover-img {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  object-fit: cover;
  display: block;
  z-index: 0;
}
/* flag / dur 需要压在封面之上 */
.mv-card .cover .flag,
.mv-card .cover .dur { z-index: 1; }
.minibar .mini-info { flex: 1; min-width: 0; }
.minibar .mini-info b { display: block; font-size: 13px; font-weight: 600; }
.minibar .mini-info span { font-size: 11px; color: var(--text-2); }
.minibar .mini-prog { height: 3px; background: rgba(255,255,255,0.18); border-radius: 2px; margin-top: 5px; }
.minibar .mini-prog i { display: block; height: 100%; background: var(--green); border-radius: 2px; }
.minibar .mini-btn {
  width: 34px; height: 34px; border-radius: 50%; background: var(--green);
  border: none; cursor: pointer; display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}

/* ---------- 我的页 ---------- */
.profile { display: flex; align-items: center; gap: 14px; padding: 12px 0 4px; }
.avatar {
  width: 58px; height: 58px; border-radius: 50%;
  background: rgba(255,255,255,0.08); color: var(--text-3);
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.profile .info { flex: 1; min-width: 0; }
.profile .info b { font-size: 19px; font-weight: 700; display: block; }
.profile .info span { font-size: 12px; color: var(--text-2); }
.btn-primary {
  background: var(--green); color: #0A0A0B; border: none;
  padding: 9px 16px; border-radius: 16px; font-size: 13px;
  font-weight: 600; cursor: pointer; font-family: inherit; flex-shrink: 0;
}
.btn-primary.lg { width: 100%; padding: 15px; border-radius: 14px; font-size: 16px; margin-top: 4px; }

.stat-row {
  display: flex; background: rgba(255,255,255,0.05);
  border-radius: var(--radius-lg); overflow: hidden; margin-top: 22px;
}
.stat-row > div { flex: 1; padding: 16px 8px; text-align: center; }
.stat-row b { display: block; font-size: 22px; font-weight: 700; }
.stat-row span { font-size: 12px; color: var(--text-2); }

.list-card + .list-card { margin-top: 0; }
.row-item .icon { width: 20px; height: 20px; color: var(--white); flex-shrink: 0; }
.row-item .val.ok { color: var(--green); font-size: 12px; }
.notice {
  padding: 12px 14px; border-radius: 10px; font-size: 12px; line-height: 19px;
  display: flex; align-items: center; gap: 10px; margin-top: 14px;
}
.notice.warn { background: rgba(251,191,36,0.09); color: #FBBF24; }
.notice.ok { background: rgba(29,185,84,0.09); color: var(--green); }

/* 首页源状态条 */
.src-bar {
  display: flex; align-items: center; gap: 8px;
  margin: 0 20px; padding: 8px 12px; margin-top: -4px;
  border-radius: 8px; background: rgba(251,191,36,0.09);
  color: #FBBF24; font-size: 12px;
}

/* 播放源失效提示条 */
.source-notice {
  display: flex; align-items: flex-start; gap: 10px;
  margin: 0 20px 10px; padding: 12px 14px;
  border-radius: 10px; background: rgba(251,191,36,0.09);
  color: #FBBF24; flex-shrink: 0;
  animation: fadeUp .25s ease;
}
@keyframes fadeUp { from { opacity:0; transform:translateY(6px); } to { opacity:1; transform:none; } }

/* ---------- 登录/注册 ---------- */
.auth-wrap { padding: 0 24px; }
.auth-head { margin-bottom: 20px; }
.auth-head h1 { font-size: 28px; font-weight: 700; }
.auth-head p { font-size: 14px; color: var(--text-2); margin-top: 8px; }
.auth-tabs {
  display: flex; background: rgba(255,255,255,0.06);
  border-radius: 22px; padding: 4px; height: 44px; margin-bottom: 18px;
}
.auth-tabs div {
  flex: 1; display: flex; align-items: center; justify-content: center;
  border-radius: 18px; font-size: 14px; color: var(--text-2); cursor: pointer;
}
.auth-tabs div.on { background: var(--green); color: #0A0A0B; font-weight: 600; }

.field { margin-bottom: 15px; }
.field > label { display: block; font-size: 12px; color: var(--text-2); margin-bottom: 8px; }
.field .box {
  display: flex; align-items: center; gap: 10px;
  background: rgba(255,255,255,0.06); border-radius: 11px;
  height: 44px; padding: 0 14px;
}
.field input {
  flex: 1; background: none; border: none; outline: none;
  color: var(--white); font-size: 14px; font-family: inherit; min-width: 0;
}
.field input::placeholder { color: var(--text-3); }
.field .pre { font-family: "JetBrains Mono", monospace; font-size: 14px; color: var(--text-2); }
.field .sep { width: 1px; height: 18px; background: #2E2E33; }
.field .mini-btn {
  background: var(--green); color: #0A0A0B; border: none;
  padding: 7px 12px; border-radius: 8px; font-size: 12px;
  font-weight: 600; cursor: pointer; font-family: inherit; flex-shrink: 0;
}
.field .mini-btn:disabled { background: var(--card-hover); color: var(--text-3); cursor: not-allowed; }

.strength { display: flex; align-items: center; gap: 8px; margin-top: 8px; height: 20px; }
.strength i { width: 54px; height: 4px; border-radius: 2px; background: #2E2E33; }
.strength i.on { background: var(--green); }
.strength span { font-size: 11px; font-weight: 500; color: #FBBF24; }

.agree { display: flex; align-items: flex-start; gap: 9px; margin: 16px 0; font-size: 12px; color: var(--text-2); line-height: 19px; }
.agree .box { width: 18px; height: 18px; border-radius: 5px; background: rgba(255,255,255,0.10); border: 1px solid rgba(255,255,255,0.24); flex-shrink: 0; margin-top: 1px; cursor: pointer; }
.agree .box.on { background: var(--green); border-color: var(--green); }

.divider { display: flex; align-items: center; gap: 12px; margin: 20px 0 16px; color: var(--text-3); font-size: 12px; }
.divider i { flex: 1; height: 1px; background: #242428; }
.oauth { display: flex; justify-content: center; gap: 14px; }
.oauth button {
  width: 52px; height: 52px; border-radius: 50%;
  background: rgba(255,255,255,0.07); border: none; cursor: pointer;
  color: var(--text-2); display: flex; align-items: center; justify-content: center;
}

/* ---------- Toast ---------- */
.toast {
  position: fixed; left: 50%; bottom: 120px; transform: translateX(-50%);
  background: rgba(0,0,0,.92); color: var(--white);
  padding: 11px 18px; border-radius: 10px; font-size: 13px;
  z-index: 200; opacity: 0; pointer-events: none; transition: opacity .25s;
  max-width: 320px; text-align: center; line-height: 1.45;
}
.toast.show { opacity: 1; }

.spinner {
  width: 34px; height: 34px; border-radius: 50%;
  border: 2.5px solid rgba(255,255,255,.15); border-top-color: var(--green);
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
/* ---------- 新版本提示条 ----------
   PWA 装到桌面后不会自动刷新代码，必须主动告知用户。
   这条在检测到新 SW 且已有旧版接管时出现。 */
.update-bar {
  position: fixed;
  left: 16px; right: 16px;
  bottom: calc(112px + env(safe-area-inset-bottom, 0px));
  z-index: 900;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 12px 16px;
  background: #1DB954; color: #0A0A0B;
  border-radius: 12px;
  box-shadow: 0 8px 28px rgba(0,0,0,.5);
  font-size: 13px; font-weight: 600;
  animation: updateIn .28s ease;
}
.update-bar button {
  background: rgba(0,0,0,.22);
  color: #0A0A0B;
  border: none;
  border-radius: 8px;
  padding: 7px 14px;
  font-family: inherit;
  font-size: 12px; font-weight: 700;
  cursor: pointer;
  flex-shrink: 0;
}
.update-bar button:active { opacity: .8; }
@keyframes updateIn {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}
/* 播放器页底部是迷你条，提示条要抬高 */
body.on-player .update-bar { bottom: calc(178px + env(safe-area-inset-bottom, 0px)); }
