:root {
  --bg: #eaf4ff;
  --panel: rgba(247, 251, 255, 0.93);
  --panel-strong: rgba(255, 255, 255, 0.95);
  --line: rgba(28, 93, 153, 0.16);
  --text: #10243a;
  --muted: #58718b;
  --accent: #2388e8;
  --accent-deep: #0e63b6;
  --shadow: 0 18px 50px rgba(9, 50, 94, 0.18);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  overflow-x: hidden;
  font-family: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  color: var(--text);
  background:
    linear-gradient(rgba(231, 244, 255, 0.78), rgba(205, 229, 250, 0.9)),
    url("/static/img/background.jpg"),
    linear-gradient(160deg, #eaf6ff 0%, #b9dcfb 48%, #74b4f1 100%);
  background-attachment: fixed;
  background-position: center;
  background-size: cover;
}

button,
input {
  font: inherit;
}

button {
  border: 0;
  cursor: pointer;
}

input[type="text"],
input[type="file"] {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.8);
  color: var(--text);
}

.app-shell {
  max-width: 1180px;
  margin: 0 auto;
  padding: 10px 10px 228px;
}

.app-header,
.content-section,
.player-dock {
  background: var(--panel);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  backdrop-filter: blur(16px);
}

.app-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-radius: 18px;
  min-width: 0;
  flex-wrap: wrap;
}

.header-copy,
.header-pill {
  min-width: 0;
}

.header-copy h1,
.content-section h2 {
  margin: 0;
}

.header-copy h1 {
  font-size: 1rem;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--accent);
  font-size: 0.64rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.subtext {
  margin: 0;
  color: var(--muted);
  line-height: 1.45;
  font-size: 0.86rem;
}

.header-pill {
  flex: 1 1 240px;
  max-width: 100%;
  min-width: 0;
  padding: 7px 10px;
  border-radius: 999px;
  background: rgba(35, 136, 232, 0.12);
  color: var(--accent-deep);
  font-size: 0.82rem;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  text-align: right;
}

#folderIndicator {
  display: inline;
  white-space: nowrap;
}

.page-content {
  margin-top: 12px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.view-stack {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.is-hidden {
  display: none !important;
}

.content-section {
  border-radius: 24px;
  padding: 16px;
}

.slim-hero {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 14px 16px;
}

.hero-metrics {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.metric-card {
  padding: 12px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.8);
}

.metric-card strong {
  display: block;
  font-size: 1.25rem;
  margin-bottom: 2px;
}

.metric-card span {
  color: var(--muted);
  font-size: 0.84rem;
}

.section-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
  min-width: 0;
  flex-wrap: wrap;
}

.section-head h2 {
  font-size: 1rem;
  min-width: 0;
}

.section-head span {
  color: var(--muted);
  font-size: 0.8rem;
  min-width: 0;
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.library-tabs {
  display: inline-flex;
  gap: 8px;
  padding: 4px;
  border-radius: 999px;
  background: rgba(35, 136, 232, 0.08);
}

.library-tab {
  min-width: 92px;
  padding: 9px 16px;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font-weight: 600;
}

.library-tab.is-active {
  background: linear-gradient(135deg, var(--accent), #5db8ff);
  color: #f7fbff;
  box-shadow: 0 8px 18px rgba(35, 136, 232, 0.22);
}

.featured-list,
.song-list,
.ranking-list,
.queue-list,
.playlist-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.album-grid,
.stack-section {
  display: grid;
  gap: 10px;
}

.album-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.stack-section {
  grid-template-columns: 1fr;
}

.feature-card,
.album-card,
.song-row,
.ranking-card,
.playlist-item,
.empty-state,
.detail-header {
  border: 1px solid rgba(123, 104, 84, 0.12);
  background: var(--panel-strong);
  border-radius: 20px;
}

.feature-card {
  overflow: hidden;
}

.feature-card-inner {
  display: grid;
  grid-template-columns: 108px 1fr;
  min-height: 176px;
}

.album-cover,
.feature-cover,
.detail-cover-wrap {
  position: relative;
  overflow: hidden;
  background: linear-gradient(145deg, rgba(35, 136, 232, 0.95), rgba(14, 99, 182, 0.94));
  color: #f7fbff;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  font-weight: 700;
}

.feature-cover {
  padding: 14px;
}

.album-cover {
  min-height: 118px;
  padding: 12px;
  border-bottom: 1px solid rgba(123, 104, 84, 0.12);
}

.cover-image,
.detail-cover-image {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.cover-name,
.detail-cover-fallback {
  position: relative;
  z-index: 1;
  line-height: 1.3;
}

.feature-body,
.album-body {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 12px;
  min-width: 0;
}

.feature-body h3,
.album-body h3,
.ranking-card h3,
.track-name,
.detail-copy h2 {
  margin: 0;
  white-space: normal;
  word-break: break-word;
  overflow-wrap: anywhere;
}

.meta-row,
.track-path,
.playlist-item p,
.ranking-note {
  margin: 0;
  color: var(--muted);
  font-size: 0.84rem;
  word-break: break-word;
  overflow-wrap: anywhere;
}

.card-actions,
.track-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.album-card .card-actions {
  flex-wrap: nowrap;
}

.album-card .card-actions button {
  flex: 1 1 0;
  min-width: 0;
  padding: 7px 8px;
  font-size: 0.78rem;
}

.compact-actions {
  flex-wrap: nowrap;
}

.primary-btn,
.secondary-btn,
.text-btn,
.back-btn {
  padding: 9px 13px;
  border-radius: 999px;
}

.primary-btn {
  background: linear-gradient(135deg, var(--accent), #5db8ff);
  color: #f7fbff;
}

.secondary-btn {
  background: rgba(35, 136, 232, 0.12);
  color: var(--accent-deep);
}

.text-btn,
.back-btn {
  background: rgba(123, 104, 84, 0.08);
  color: var(--text);
}

.song-row,
.ranking-card,
.playlist-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  padding: 12px;
  min-width: 0;
  overflow: hidden;
}

.compact-list .song-row {
  padding: 10px 12px;
}

.compact-list .track-name {
  font-size: 0.92rem;
}

.compact-list .track-path {
  font-size: 0.76rem;
}

.song-copy,
.ranking-main {
  min-width: 0;
  flex: 1;
}

.song-copy {
  overflow: hidden;
}

.queue-list .song-row.is-active {
  border-color: rgba(35, 136, 232, 0.5);
  box-shadow: inset 0 0 0 1px rgba(35, 136, 232, 0.16);
}

.rank-badge {
  width: 34px;
  height: 34px;
  flex: 0 0 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 14px;
  background: rgba(35, 136, 232, 0.12);
  color: var(--accent-deep);
  font-weight: 700;
}

.detail-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 88px;
  align-items: center;
  gap: 10px;
  padding: 10px;
}

.detail-cover-wrap {
  width: 88px;
  aspect-ratio: 1 / 1;
  border-radius: 16px;
}

.detail-copy {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
  overflow: hidden;
}

.detail-copy .card-actions {
  gap: 6px;
}

.detail-copy .card-actions button {
  flex: 1 1 calc(50% - 3px);
  padding: 7px 9px;
  font-size: 0.78rem;
}

.detail-copy .card-actions .detail-back-home {
  flex-basis: 100%;
  background: rgba(35, 136, 232, 0.18);
  color: var(--accent-deep);
  font-weight: 700;
}

.pager {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-top: 2px;
  padding: 6px 0 0;
}

.pager-meta {
  color: var(--muted);
  font-size: 0.82rem;
}

.pager .text-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.detail-track-row {
  padding: 8px 10px;
  border-radius: 14px;
  border-left: 3px solid rgba(35, 136, 232, 0.28);
  gap: 8px;
  align-items: flex-start;
}

.detail-track-row .song-copy {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.detail-track-row .track-name {
  font-size: 0.88rem;
  line-height: 1.15;
}

.detail-track-row .track-path {
  font-size: 0.72rem;
  line-height: 1.15;
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.detail-track-row .track-actions {
  gap: 4px;
  flex-wrap: wrap;
  justify-content: flex-end;
  flex: 0 0 auto;
  max-width: 96px;
}

.detail-track-row .small-icon-btn {
  width: 28px;
  height: 28px;
}

.detail-track-row .small-icon-btn svg {
  width: 14px;
  height: 14px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 12px;
  color: var(--muted);
  font-size: 0.9rem;
}

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

.player-dock {
  position: fixed;
  left: 50%;
  right: auto;
  bottom: max(8px, env(safe-area-inset-bottom, 0px));
  transform: translateX(-50%);
  width: min(calc(100vw - 16px), 1180px);
  max-width: calc(100vw - 16px);
  z-index: 999;
  padding: 12px 14px;
  border-radius: 24px;
  box-sizing: border-box;
  background:
    linear-gradient(180deg, rgba(247, 251, 255, 0.97), rgba(231, 243, 255, 0.99)),
    var(--panel);
}

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

.dock-cover-wrap {
  position: relative;
  width: 50px;
  height: 50px;
  flex: 0 0 50px;
}

.dock-cover-image,
.dock-cover-fallback {
  width: 100%;
  height: 100%;
  border-radius: 16px;
}

.dock-cover-image {
  object-fit: cover;
}

.dock-cover-fallback {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #45a6f5, #0e63b6);
  color: #f7fbff;
  font-size: 1rem;
  font-weight: 700;
}

.dock-copy {
  min-width: 0;
}

.dock-copy strong,
.dock-copy p {
  display: block;
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.dock-copy p {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 0.82rem;
}

.player-progress {
  display: grid;
  grid-template-columns: 40px 1fr 40px;
  gap: 8px;
  align-items: center;
  margin-top: 10px;
  color: var(--muted);
  font-size: 0.76rem;
  min-width: 0;
}

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

.icon-actions {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  align-items: center;
  margin-top: 12px;
  gap: 8px;
}

.icon-btn {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: rgba(123, 104, 84, 0.08);
  color: var(--text);
  position: relative;
  flex: 0 0 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  justify-self: center;
}

.icon-btn.active {
  background: rgba(35, 136, 232, 0.12);
  color: var(--accent-deep);
}

.play-toggle {
  width: 54px;
  height: 54px;
  flex-basis: 54px;
  background: linear-gradient(135deg, var(--accent), #5db8ff);
  color: #f7fbff;
}

.small-icon-btn {
  width: 30px;
  height: 30px;
  flex-basis: 30px;
}

.icon-btn svg {
  width: 22px;
  height: 22px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.icon-btn svg text {
  fill: currentColor;
  font-size: 8px;
  font-weight: 700;
  stroke: none;
}

.icon-btn svg .thick-icon-path {
  stroke-width: 2.6;
}

.small-icon-btn svg {
  width: 16px;
  height: 16px;
  stroke-width: 2.1;
}

.play-toggle svg {
  width: 26px;
  height: 26px;
}

.play-toggle .icon-play {
  margin-left: 2px;
}

.play-toggle svg path {
  fill: currentColor;
  stroke: none;
}

.icon-toast {
  position: fixed;
  left: 50%;
  bottom: 152px;
  transform: translateX(-50%);
  z-index: 1200;
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(44, 34, 24, 0.88);
  color: #fffaf5;
  font-size: 0.78rem;
  white-space: nowrap;
}

audio {
  display: none;
}

.album-menu-overlay {
  position: fixed;
  inset: 0;
  z-index: 1100;
  background: rgba(8, 31, 55, 0.2);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 12px;
}

.album-menu {
  width: min(460px, 100%);
  max-height: 52vh;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(247, 251, 255, 0.98);
  box-shadow: var(--shadow);
}

.album-menu-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
}

.album-menu-actions {
  display: flex;
  gap: 8px;
}

.album-menu-actions button {
  padding: 7px 10px;
  font-size: 0.78rem;
}

.album-menu-list {
  max-height: calc(52vh - 54px);
  overflow-y: auto;
  padding: 8px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.album-menu-item {
  min-width: 0;
  max-width: 100%;
  padding: 9px 10px;
  border-radius: 12px;
  background: rgba(35, 136, 232, 0.1);
  color: var(--text);
  text-align: left;
  overflow: hidden;
}

.album-menu-item span,
.album-menu-item small {
  display: block;
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.album-menu-item small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 0.72rem;
}

@media (min-width: 760px) {
  .app-shell {
    padding: 12px 14px 212px;
  }

  .stack-section {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .detail-cover-wrap {
    width: 96px;
  }
}

@media (max-width: 480px) {
  .detail-track-row {
    flex-direction: column;
  }

  .detail-track-row .track-actions {
    width: 100%;
    max-width: none;
    justify-content: flex-start;
  }
}

@supports (-webkit-touch-callout: none) {
  .player-dock {
    bottom: max(10px, env(safe-area-inset-bottom, 0px));
  }
}

.settings-bar {
  background: rgba(247, 251, 255, 0.97);
  border-bottom: 1px solid var(--line);
  padding: 10px 12px 12px;
  position: sticky;
  top: 0;
  z-index: 200;
  backdrop-filter: blur(16px);
}
.settings-bar-inner {
  display: flex;
  align-items: center;
  gap: 8px;
  max-width: 1180px;
  margin: 0 auto;
}
.settings-bar-label {
  font-size: 0.85rem;
  color: var(--muted);
  white-space: nowrap;
  flex-shrink: 0;
}
.settings-bar input[type="text"] {
  flex: 1;
  min-width: 0;
  padding: 8px 12px;
  font-size: 0.9rem;
  border-radius: 10px;
}
.settings-save-btn {
  padding: 8px 16px;
  font-size: 0.88rem;
  white-space: nowrap;
  flex-shrink: 0;
}
.settings-open-btn {
  background: none;
  border: none;
  cursor: pointer;
  padding: 6px;
  margin-left: 4px;
  color: var(--muted);
  flex-shrink: 0;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 0;
}
.settings-open-btn:hover {
  background: rgba(35, 136, 232, 0.08);
  color: var(--accent);
}
