:root {
  --bg: var(--theme-bg-body, #DCE8DC);
  --panel: var(--theme-bg-main, #E5F2E5);
  --card: rgba(255, 255, 255, .78);
  --text: var(--theme-text-main, #000);
  --muted: #6D665D;
  --line: rgba(47, 92, 47, .22);
  --accent: var(--theme-primary-color, #2F5C2F);
  --accent-text: #fff;
  --accent2: rgba(255, 255, 255, .72);
  --shadow: 0 10px 28px rgba(0, 0, 0, .10);
  --player-h: 112px;
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif;
}

body.sg-player-page {
  max-width: 1180px;
  margin: 0 auto;
}

h1,
h2,
h3,
p {
  margin: 0;
}

button,
input {
  font: inherit;
}

button {
  padding: .65rem 1rem;
  border: 0;
  border-radius: 999px;
  background: var(--accent2);
  color: var(--text);
  cursor: pointer;
}

button:hover {
  filter: brightness(.98);
}

button:focus-visible,
a:focus-visible,
input:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 3px;
}

button:disabled {
  cursor: not-allowed;
  opacity: .45;
}

.hidden {
  display: none !important;
}

.muted {
  color: var(--muted);
}

.row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .75rem;
}

.ghost {
  border: 1px solid var(--line);
  background: var(--card);
}

.primary {
  border: 1px solid var(--accent);
  background: var(--accent);
  color: var(--accent-text);
}

.danger {
  background: #7B2D26;
  color: #fff;
}

.mini {
  padding: .25rem .6rem;
}

.icon {
  display: inline-grid;
  place-items: center;
  min-width: 44px;
  height: 44px;
  padding: 0;
}

.play {
  display: inline-grid;
  place-items: center;
  min-width: 54px;
  height: 54px;
  padding: 0;
  background: var(--accent);
  color: var(--accent-text);
  font-weight: 700;
}

/* 顶部栏 */

.sg-site-header.header {
  min-height: 46px;
  padding: .2em 0;
  background: url(/images/line.png) 50% top var(--accent);
  color: var(--accent-text);
  text-align: center;
  font-size: 1.4em;
}

.sg-site-header.header--fixed {
  position: fixed;
  z-index: 9999;
  top: 0;
  right: 0;
  left: 0;
  transition: transform .22s ease, opacity .22s ease;
  will-change: transform;
}

.sg-site-header.header-hidden {
  transform: translateY(-110%);
  opacity: .96;
}

.leaveTop {
  height: 3.5em;
}

.sg-site-header .topBack {
  position: absolute;
  top: 0;
  left: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 50px;
  height: 50px;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.sg-site-header .topBack:hover,
.sg-site-header .topBack:active,
.sg-site-header .topBack:focus-visible {
  background: transparent;
  box-shadow: none;
}

.sg-site-header .topBack img {
  display: block;
  width: 50px;
  height: 50px;
}

.sg-site-header .box-button,
.sg-site-header .sg-home-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 110px;
  height: 30px;
  margin-top: 3px;
  padding: 0 10px;
  border-top: 1px solid rgba(255, 255, 255, .55);
  border-left: 1px solid rgba(255, 255, 255, .55);
  border-right: 1px solid rgba(0, 0, 0, .35);
  border-bottom: 1px solid rgba(0, 0, 0, .35);
  border-radius: 3px;
  color: var(--accent-text);
  font-weight: 700;
  line-height: 30px;
  text-decoration: none;
}

/* 主布局 */

.app {
  display: grid;
  grid-template-columns: minmax(340px, 370px) minmax(0, 1fr);
  align-items: start;
  gap: 18px;
  padding: 0 18px calc(var(--player-h) + 28px);
}

.sidebar,
.content {
  border: 1px solid var(--line);
  border-radius: 24px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.sidebar {
  position: static;
  align-self: start;
  padding: 16px;
}

.content {
  min-height: 62vh;
  padding: 18px;
}

.sidebar,
.content,
.player,
.drawer-card,
.modal-card,
.lyrics-card,
.song-item,
.queue-item {
  transition: background-color .18s ease, color .18s ease, border-color .18s ease;
}

/* 搜索、快捷入口和同步 */

.search span,
.section-title {
  display: block;
  margin: 10px 4px 8px;
  color: var(--muted);
  font-size: .9rem;
}

.search input,
.modal input {
  width: 100%;
  padding: .8rem .9rem;
  border: 1px solid var(--line);
  border-radius: 16px;
  outline: none;
  appearance: none;
  background: var(--card);
  color: var(--text);
}

.search input:focus,
.modal input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(47, 92, 47, .15);
}

.nav,
.category-list,
.playlist-list {
  display: grid;
  gap: 8px;
  margin: 12px 0 18px;
}

.nav.quick-nav {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
}

.playlist-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 42px;
  gap: 6px;
}

.playlist-rename-btn {
  width: 42px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--card);
  color: var(--muted);
  font-size: 18px;
}

.playlist-rename-btn:hover,
.playlist-rename-btn:focus-visible {
  border-color: var(--accent);
  color: var(--accent);
}

.nav-btn,
.category-btn,
.playlist-btn {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--text);
  text-align: left;
}

.nav.quick-nav .nav-btn {
  min-height: 40px;
  justify-content: center;
  padding: .55rem .3rem;
  font-weight: 700;
  text-align: center;
  white-space: nowrap;
}

.nav.quick-nav .queue-shortcut {
  background: var(--accent2);
}

.nav-btn.active,
.category-btn.active,
.playlist-btn.active {
  border-color: var(--accent);
  background: var(--accent);
  color: var(--accent-text);
}

.tiny {
  font-size: .78rem;
  line-height: 1.45;
}

.sync-box {
  margin: 12px 0 18px;
}

.sync-box .nav-btn {
  justify-content: center;
  background: var(--card);
  text-align: center;
}

.sync-desc {
  margin-bottom: 14px;
  font-size: .9rem;
  line-height: 1.6;
}

.sync-label {
  display: grid;
  gap: 8px;
  margin: 12px 0;
}

.sync-label span {
  color: var(--muted);
  font-size: .9rem;
}

.sync-code-box {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin: 12px 0;
  padding: .75rem .9rem;
  border: 1px dashed var(--accent);
  border-radius: 16px;
  background: var(--card);
}

.sync-code-box span {
  font-weight: 800;
  letter-spacing: .08em;
  word-break: break-all;
}

.sync-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin: 14px 0;
}

/* 大类和小类 */

.category-list {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  align-items: stretch;
}

.category-btn {
  display: grid;
  grid-template-rows: auto auto;
  place-items: center;
  row-gap: 4px;
  min-width: 0;
  min-height: 46px;
  padding: 3px 4px;
  border-radius: 12px;
  overflow: hidden;
  font-size: 1.05rem;
  line-height: 1.15;
  text-align: center;
  white-space: normal;
}

.category-name {
  display: -webkit-box;
  width: 100%;
  min-width: 0;
  min-height: 2.2em;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  overflow-wrap: anywhere;
  font-weight: 700;
  line-height: 1.2;
}

.category-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 3em;
  padding: 2px 6px;
  border: 1px solid #EFD4AA;
  border-radius: 999px;
  background: #FFF3DF;
  color: #8A5A18;
  font-size: .72rem;
  font-weight: 700;
  line-height: 1.25;
}

.category-btn.active .category-count {
  border-color: rgba(0, 0, 0, .2);
  background: rgba(0, 0, 0, .45);
  color: #fff;
}

.subcategory-panel {
  grid-column: 1 / -1;
  width: 100%;
  margin: 4px 0 10px;
  padding: 12px;
  border-radius: 14px;
  background: rgba(0, 0, 0, .04);
}

.subcategory-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
  font-size: .95rem;
}

.sub-toggle-btn {
  position: relative;
  z-index: 2;
  padding: 6px 12px;
  border: 1px solid var(--line);
  background: var(--card);
  user-select: none;
}

.subcategory-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.subcategory-panel.sub-collapsed .subcategory-list {
  display: none;
}

.sub-category-btn {
  min-width: 0;
  min-height: 42px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--card);
  color: var(--text);
  font-size: .88rem;
  line-height: 1.25;
  text-align: center;
  white-space: normal;
  overflow-wrap: anywhere;
}

.sub-category-btn.active {
  border-color: var(--accent);
  background: var(--accent);
  color: var(--accent-text);
  font-weight: 700;
}

.sub-category-btn span {
  margin-left: 3px;
  white-space: nowrap;
  opacity: .72;
  font-size: .86em;
}

/* 歌曲列表 */

.content-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 14px;
}

.view-heading,
.view-title-row,
.view-title-row #viewTitle {
  min-width: 0;
}

.view-title-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.content-head h2 {
  font-size: 1.4rem;
  line-height: 1.35;
}

#viewCount {
  line-height: 1.5;
}

.song-list {
  display: grid;
  gap: 10px;
}

.song-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--card);
}

.song-item.song-sortable {
  grid-template-columns: auto minmax(0, 1fr) auto;
}

.song-drag-handle {
  width: 46px;
  height: 52px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: transparent;
  color: var(--muted);
  font-size: 20px;
  line-height: 1;
  cursor: grab;
  touch-action: none;
  user-select: none;
}

@media (max-width: 860px) {
  .song-drag-handle {
    width: 52px;
    height: 58px;
    margin: -4px 0;
    font-size: 24px;
  }
}

.song-drag-handle:active {
  cursor: grabbing;
}

.song-item.dragging {
  z-index: 2;
  border-color: var(--accent);
  box-shadow: var(--shadow);
  opacity: .88;
}

body.song-reordering {
  user-select: none;
}

.song-item.playing {
  outline: 2px solid var(--accent);
}


.song-main {
  min-width: 0;
}

.song-title,
.song-meta {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.song-title {
  font-weight: 700;
}

.song-meta {
  margin-top: 4px;
  color: var(--muted);
  font-size: .86rem;
}

.song-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px;
}

.song-actions button {
  padding: .45rem .7rem;
}

.lyrics-link,
.song-actions .legacy-like-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  padding: .42rem .72rem;
  border-top: 1px solid rgba(255, 255, 255, .88);
  border-left: 1px solid rgba(255, 255, 255, .88);
  border-right: 1px solid rgba(0, 0, 0, .28);
  border-bottom: 1px solid rgba(0, 0, 0, .28);
  border-radius: 999px;
  background: var(--card);
  color: var(--text);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .55), 0 2px 5px rgba(0, 0, 0, .12);
  font-weight: 700;
  line-height: 1;
  text-decoration: none;
}

.lyrics-link:hover,
.song-actions .legacy-like-btn:hover {
  filter: none;
  transform: translateY(-1px);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .7), 0 4px 8px rgba(0, 0, 0, .16);
}

.lyrics-link:active,
.song-actions .legacy-like-btn:active {
  transform: translateY(1px);
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, .18);
}

.song-actions .action-play {
  background: var(--accent);
  color: var(--accent-text);
}

.empty {
  padding: 40px;
  color: var(--muted);
  text-align: center;
}

/* 播放器 */

.player {
  position: fixed;
  z-index: 20;
  right: 0;
  bottom: 0;
  left: 0;
  display: grid;
  grid-template-columns: minmax(220px, 320px) minmax(0, 1fr);
  align-items: center;
  gap: 16px;
  min-height: var(--player-h);
  padding: 12px max(16px, env(safe-area-inset-right))
    calc(12px + env(safe-area-inset-bottom))
    max(16px, env(safe-area-inset-left));
  border-top: 1px solid var(--line);
  background: rgba(229, 242, 229, .94);
  backdrop-filter: blur(18px);
}

.now {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.cover {
  width: 54px;
  height: 54px;
  padding: 0;
  border-radius: 18px;
  background: var(--accent);
  color: var(--accent-text);
  font-weight: 800;
}

.now-text {
  min-width: 0;
}

.now-text strong,
.now-text span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-bottom: 6px;
}

.progress-row {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr) 48px;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  font-size: .88rem;
  font-variant-numeric: tabular-nums;
}

input[type="range"] {
  width: 100%;
  accent-color: var(--accent);
}

/* 抽屉、弹窗和歌谱 */

.drawer,
.modal,
.lyrics-overlay {
  position: fixed;
  z-index: 40;
  inset: 0;
  background: rgba(47, 35, 24, .38);
  backdrop-filter: blur(8px);
}

.drawer {
  display: flex;
  justify-content: flex-end;
}

.drawer-card {
  width: min(460px, 92vw);
  height: 100%;
  padding: 18px;
  overflow: auto;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.drawer-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.queue-list {
  display: grid;
  gap: 8px;
}

.queue-list .muted {
  line-height: 1.7;
}

.queue-item {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 10px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--card);
}

.queue-item.playing {
  outline: 2px solid var(--accent);
}

.modal {
  display: grid;
  place-items: center;
  padding: 20px;
}

.modal-card {
  width: min(430px, 92vw);
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 24px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.modal-card h3 {
  margin-bottom: 14px;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 16px;
}

.playlist-picker {
  display: grid;
  gap: 8px;
}

.lyrics-overlay {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  padding: max(14px, env(safe-area-inset-top))
    max(14px, env(safe-area-inset-right))
    max(14px, env(safe-area-inset-bottom))
    max(14px, env(safe-area-inset-left));
}

.lyrics-toolbar {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
  margin-bottom: 12px;
}


.lyrics-card {
  padding: 24px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 24px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.lyrics-card h2,
.lyrics-card p {
  text-align: center;
}

.lyrics-card h2 {
  margin-bottom: 6px;
}

.lyrics-card p {
  margin-bottom: 18px;
}

#lyricsText {
  max-width: 860px;
  margin: 0 auto;
  color: var(--text);
  font-family: inherit;
  font-size: var(--lyrics-size, 20px);
  line-height: 1.9;
  white-space: pre-wrap;
}

.sheet {
  display: block;
  max-width: min(860px, 100%);
  margin: 20px auto 0;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
}

/* 返回顶部 */

.back-top-btn {
  position: fixed;
  z-index: 9998;
  right: 16px;
  bottom: 92px;
  width: 46px;
  height: 46px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--accent);
  color: var(--accent-text);
  box-shadow: var(--shadow);
  font-size: 28px;
  font-weight: 900;
  opacity: 0;
  pointer-events: none;
  transform: translateY(12px) scale(.92);
  transition: opacity .18s ease, transform .18s ease;
}

.back-top-btn.show {
  opacity: .92;
  pointer-events: auto;
  transform: translateY(0) scale(1);
}

.title-top-btn {
  display: none;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  width: 31px;
  min-width: 31px;
  height: 31px;
  padding: 0;
  border-top: 1px solid rgba(255, 255, 255, .9);
  border-left: 1px solid rgba(255, 255, 255, .9);
  border-right: 1px solid rgba(0, 0, 0, .28);
  border-bottom: 1px solid rgba(0, 0, 0, .28);
  border-radius: 999px;
  background: var(--accent);
  color: var(--accent-text);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .42), 0 2px 5px rgba(0, 0, 0, .14);
  font-size: 20px;
  font-weight: 800;
  line-height: 1;
}

/* 提示 */

.toast {
  position: fixed;
  z-index: 80;
  bottom: calc(var(--player-h) + 22px);
  left: 50%;
  max-width: min(92vw, 520px);
  padding: .75rem 1rem;
  transform: translateX(-50%);
  border-radius: 999px;
  background: #30261C;
  color: #fff;
  box-shadow: var(--shadow);
  text-align: center;
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: .01ms !important;
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
  }
}

/* 蓝色和黑色高对比主题 */

html[data-sg-theme="8"] body.sg-player-page,
html[data-sg-theme="9"] body.sg-player-page {
  max-width: none;
}

html[data-sg-theme="8"] .sidebar,
html[data-sg-theme="8"] .content,
html[data-sg-theme="8"] .player,
html[data-sg-theme="8"] .drawer-card,
html[data-sg-theme="8"] .modal-card,
html[data-sg-theme="8"] .lyrics-card,
html[data-sg-theme="9"] .sidebar,
html[data-sg-theme="9"] .content,
html[data-sg-theme="9"] .player,
html[data-sg-theme="9"] .drawer-card,
html[data-sg-theme="9"] .modal-card,
html[data-sg-theme="9"] .lyrics-card {
  box-shadow: none;
}

html[data-sg-theme="8"] .sg-site-header.header {
  background: #0000FF;
  color: #FFFD37;
}

html[data-sg-theme="9"] .sg-site-header.header {
  background: #000;
  color: #fff;
}

html[data-sg-theme="8"] .whiteButtonLink,
html[data-sg-theme="8"] .lyrics-link {
  color: #FFFD37;
  border-color: #FFFD37;
}

html[data-sg-theme="9"] .whiteButtonLink,
html[data-sg-theme="9"] .lyrics-link {
  color: #fff;
  border-color: #fff;
}

html[data-sg-theme="8"] .primary,
html[data-sg-theme="8"] .play,
html[data-sg-theme="8"] .nav-btn.active,
html[data-sg-theme="8"] .category-btn.active,
html[data-sg-theme="8"] .playlist-btn.active,
html[data-sg-theme="8"] .song-actions .action-play,
html[data-sg-theme="8"] .back-top-btn,
html[data-sg-theme="8"] .title-top-btn {
  border-color: #FFFD37;
  background: #FFFD37;
  color: #0000FF;
  box-shadow: none;
}

html[data-sg-theme="9"] .primary,
html[data-sg-theme="9"] .play,
html[data-sg-theme="9"] .nav-btn.active,
html[data-sg-theme="9"] .category-btn.active,
html[data-sg-theme="9"] .playlist-btn.active,
html[data-sg-theme="9"] .song-actions .action-play,
html[data-sg-theme="9"] .back-top-btn,
html[data-sg-theme="9"] .title-top-btn {
  border-color: #fff;
  background: #fff;
  color: #212121;
  box-shadow: none;
}

/* 手机 */

@media (max-width: 860px) {
  :root {
    --player-h: 164px;
  }

  .app {
    grid-template-columns: 1fr;
    padding: 0 12px calc(var(--player-h) + 18px);
  }

  .app > .sync-box {
    margin: 0;
    padding: 16px;
    border: 1px solid var(--line);
    border-radius: 24px;
    background: var(--panel);
    box-shadow: var(--shadow);
  }

  .player {
    grid-template-columns: 1fr;
  }

  .content-head {
    align-items: center;
  }

  .song-item {
    grid-template-columns: 1fr;
  }

  .song-item.song-sortable {
    grid-template-columns: auto minmax(0, 1fr);
  }

  .song-item.song-sortable .song-actions {
    grid-column: 1 / -1;
  }

  .song-actions {
    grid-column: 1;
    justify-content: flex-start;
  }

  .category-list {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 6px;
  }

  .category-btn {
    min-height: 60px;
    padding: 7px 3px;
    font-size: .82rem;
  }

  .category-name {
    min-height: 2.25em;
    font-size: .82rem;
  }

  .subcategory-panel {
    margin-top: 8px;
    padding: 10px;
  }

  .subcategory-panel::before {
    display: block;
    margin-bottom: 8px;
    color: var(--accent);
    content: "请选择小类";
    font-size: .92rem;
    font-weight: 700;
  }

  .subcategory-list {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 6px;
  }

  .sub-category-btn {
    min-height: 40px;
    padding: 8px 6px;
    font-size: .86rem;
    line-height: 1.15;
  }

  .content-head,
  #songList,
  .song-list,
  .subcategory-panel {
    scroll-margin-top: 8px;
  }

  .view-title-row {
    justify-content: flex-start;
    gap: 6px;
  }

  .title-top-btn:not(.hidden) {
    display: inline-flex;
    order: -1;
  }

  .song-actions .legacy-like-btn,
  .lyrics-link {
    min-height: 32px;
    padding: .4rem .66rem;
  }
}

@media (max-width: 560px) {
  .sync-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 520px) {
  .sg-site-header .sg-home-link {
    min-width: 96px;
    font-size: .85em;
  }

  .back-top-btn {
    right: 12px;
    bottom: 84px;
    width: 42px;
    height: 42px;
    font-size: 25px;
  }
}

@media (max-width: 420px) {
  .nav.quick-nav .nav-btn {
    padding-right: .15rem;
    padding-left: .15rem;
    font-size: .9rem;
  }
}




/* v49: 手机端大类每行四个，只显示名称 */
@media (max-width: 860px) {
  .category-list {
    display: grid !important;
    grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
    gap: 7px !important;
    align-items: stretch !important;
  }

  .category-list .category-btn {
    width: 100% !important;
    min-width: 0 !important;
    min-height: 44px !important;
    padding: 3px 2px !important;
    border-radius: 11px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    overflow: hidden !important;
    text-align: center !important;
  }

  .category-list .category-name {
    display: -webkit-box !important;
    width: 100% !important;
    min-height: 0 !important;
    margin: 0 !important;
    overflow: hidden !important;
    -webkit-box-orient: vertical !important;
    -webkit-line-clamp: 2 !important;
    line-clamp: 2 !important;
    text-align: center !important;
    white-space: normal !important;
    word-break: break-word !important;
    overflow-wrap: anywhere !important;
    font-size: .96rem !important;
    font-weight: 700 !important;
    line-height: 1.2 !important;
  }

  .category-list .subcategory-panel {
    grid-column: 1 / -1 !important;
    width: 100% !important;
  }
}

/* 大类数量不再显示 */
.category-count {
  display: none !important;
}

/* 收藏和加入歌单按钮 */
.song-actions .song-icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 38px;
  min-height: 38px;
  padding: 0 8px !important;
  border: 0;
  background: transparent;
  color: var(--text);
  box-shadow: none;
  font-size: 1.35rem;
  font-weight: 800;
  line-height: 1;
}

.song-actions .song-icon-btn:hover {
  transform: scale(1.08);
  filter: none;
}

.song-actions .song-icon-btn:active {
  transform: scale(.96);
}

.song-actions .action-like.liked {
  color: #D91E18 !important;
}

.song-actions .action-add {
  font-size: 1.45rem;
}

/* 底部播放器收藏按钮 */
#btnFav {
  font-size: 1.45rem;
  font-weight: 800;
}

#btnFav.liked {
  color: #D91E18 !important;
}

html[data-sg-theme="8"] .song-actions .action-like.liked,
html[data-sg-theme="8"] #btnFav.liked,
html[data-sg-theme="9"] .song-actions .action-like.liked,
html[data-sg-theme="9"] #btnFav.liked {
  color: #FF3030 !important;
}

@media (max-width: 420px) {
  .category-list {
    gap: 5px !important;
  }

  .category-list .category-btn {
    min-height: 42px !important;
    padding: 2px !important;
  }

  .category-list .category-name {
    font-size: .9rem !important;
  }
}


/* v50: 歌谱工具栏 */
.lyrics-toolbar {
  align-items: center;
}

.lyrics-page-link,
.lyrics-tool-btn,
.lyrics-close-btn,
.lyrics-nav-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: .65rem 1rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--card);
  color: var(--text);
  box-shadow: 0 2px 6px rgba(0, 0, 0, .10);
  font-weight: 700;
  line-height: 1;
  text-decoration: none;
}

.lyrics-page-link {
  border-color: var(--accent);
  color: var(--accent);
}

.lyrics-nav-btn {
  min-width: 112px;
  border-color: var(--accent);
  background: var(--accent);
  color: var(--accent-text);
  box-shadow: 0 4px 10px rgba(0, 0, 0, .18);
  font-size: 1rem;
  font-weight: 800;
}

.lyrics-nav-btn:hover,
.lyrics-page-link:hover,
.lyrics-tool-btn:hover,
.lyrics-close-btn:hover {
  filter: none;
  transform: translateY(-1px);
}

.lyrics-nav-btn:active,
.lyrics-page-link:active,
.lyrics-tool-btn:active,
.lyrics-close-btn:active {
  transform: translateY(1px);
}

.lyrics-close-btn {
  min-width: 42px;
  padding: 0;
  font-size: 1.15rem;
}

html[data-sg-theme="8"] .lyrics-nav-btn {
  border-color: #FFFD37;
  background: #FFFD37;
  color: #0000FF;
}

html[data-sg-theme="9"] .lyrics-nav-btn {
  border-color: #FFFFFF;
  background: #FFFFFF;
  color: #212121;
}

html[data-sg-theme="8"] .lyrics-page-link {
  border-color: #FFFD37;
  color: #FFFD37;
}

html[data-sg-theme="9"] .lyrics-page-link {
  border-color: #FFFFFF;
  color: #FFFFFF;
}



/* v51: 歌谱工具栏固定单行 */
.lyrics-toolbar {
  display: flex !important;
  flex-wrap: nowrap !important;
  align-items: center !important;
  justify-content: flex-end !important;
  gap: 8px !important;
  overflow-x: auto;
  white-space: nowrap;
  -webkit-overflow-scrolling: touch;
}

.lyrics-page-link,
.lyrics-tool-btn,
.lyrics-close-btn,
.lyrics-nav-btn {
  flex: 0 0 auto !important;
  width: auto !important;
  min-width: 0 !important;
  min-height: 40px !important;
  padding: .58rem .86rem !important;
}

.lyrics-nav-btn {
  width: 44px !important;
  min-width: 44px !important;
  padding: 0 !important;
  font-size: 1.55rem !important;
  line-height: 1 !important;
}

.lyrics-close-btn {
  width: 42px !important;
  min-width: 42px !important;
  padding: 0 !important;
}

@media (max-width: 480px) {
  .lyrics-toolbar {
    gap: 6px !important;
  }

  .lyrics-page-link,
  .lyrics-tool-btn {
    min-height: 38px !important;
    padding: .52rem .68rem !important;
    font-size: .9rem !important;
  }

  .lyrics-nav-btn {
    width: 40px !important;
    min-width: 40px !important;
    min-height: 38px !important;
    font-size: 1.45rem !important;
  }

  .lyrics-close-btn {
    width: 38px !important;
    min-width: 38px !important;
    min-height: 38px !important;
  }
}


/* v52: OrigType 和 OrigId 歌词链接 */
.lyrics-link,
.lyrics-page-link {
  text-decoration: none;
}

.lyrics-link {
  color: var(--text);
}

.lyrics-page-link {
  border-color: var(--accent);
  color: var(--accent);
}


/* v53: 删除左侧编号方块，列表按诗歌名称排序 */
.song-main {
  min-width: 0;
}

.song-title {
  white-space: normal;
  word-break: break-word;
  overflow-wrap: anywhere;
}

@media (min-width: 861px) {
  .song-item {
    grid-template-columns: minmax(0, 1fr) auto;
  }
}

@media (max-width: 860px) {
  .song-item {
    grid-template-columns: 1fr;
  }

  .song-actions {
    grid-column: 1;
  }
}

/* v54: 歌谱标题不显示独立编号 */

/* v55: 底部播放器标题不显示独立编号 */

/* v56: 按完整歌名自然排序，包含歌名前面的编号 */

/* v57: 大类列表先按小类顺序，再按完整歌名自然排序 */


/* v58: 无歌词时使用旧播放 */
.legacy-fallback-link {
  border-color: var(--line);
  color: var(--text);
}


/* v59: 水流之音的“播放”直接进入旧播放 */
.song-actions .direct-legacy-play {
  text-decoration: none;
}

.song-actions .direct-legacy-play:visited {
  color: var(--accent-text);
}

/* v60: 跳转歌词或旧播放前停止当前音频 */


/* v61: 修复歌谱全屏后的交互 */
#lyricsOverlay:fullscreen,
#lyricsOverlay:-webkit-full-screen {
  display: grid !important;
  width: 100vw !important;
  height: 100vh !important;
  padding:
    max(12px, env(safe-area-inset-top))
    max(12px, env(safe-area-inset-right))
    max(12px, env(safe-area-inset-bottom))
    max(12px, env(safe-area-inset-left)) !important;
  overflow: hidden !important;
  background: var(--bg) !important;
  color: var(--text) !important;
  pointer-events: auto !important;
}

#lyricsOverlay.is-fullscreen {
  z-index: 2147483647;
}

#lyricsOverlay.is-fullscreen .lyrics-toolbar {
  position: relative;
  z-index: 3;
}

#lyricsOverlay.is-fullscreen .lyrics-card {
  min-height: 0;
  overflow: auto;
  pointer-events: auto;
  overscroll-behavior: contain;
}

#lyricsOverlay.is-fullscreen .lyrics-tool-btn {
  border-color: var(--accent);
  background: var(--accent);
  color: var(--accent-text);
  font-weight: 800;
}

@media (max-width: 480px) {
  #lyricsOverlay:fullscreen,
  #lyricsOverlay:-webkit-full-screen {
    padding:
      max(8px, env(safe-area-inset-top))
      max(8px, env(safe-area-inset-right))
      max(8px, env(safe-area-inset-bottom))
      max(8px, env(safe-area-inset-left)) !important;
  }
}
