:root {
  color-scheme: light;
  --bg: #f4f6f8;
  --panel: #ffffff;
  --panel-strong: #eef3f2;
  --text: #17202a;
  --muted: #6a7481;
  --line: #dbe2e8;
  --accent: #0f766e;
  --accent-strong: #0b5f59;
  --blue: #2563eb;
  --orange: #f97316;
  --shadow: 0 16px 42px rgba(31, 41, 55, 0.12);
  font-family: "Microsoft YaHei", "Segoe UI", system-ui, -apple-system, sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  width: min(1240px, calc(100% - 32px));
  min-height: 100vh;
  margin: 0 auto;
  padding: 24px 0;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 72px;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--accent);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: clamp(24px, 4vw, 38px);
  line-height: 1.15;
}

.topbar-actions {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.text-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: 0 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--text);
  font-weight: 700;
  text-decoration: none;
  white-space: nowrap;
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.8) inset;
}

.text-button:hover,
.text-button:focus-visible {
  border-color: var(--accent);
  outline: none;
}

.import-button {
  position: relative;
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.import-button:hover,
.import-button:focus-within {
  background: var(--accent-strong);
  border-color: var(--accent-strong);
}

.import-button input {
  position: absolute;
  inset: 0;
  width: 100%;
  opacity: 0;
  cursor: pointer;
}

.player-layout {
  display: grid;
  grid-template-columns: minmax(300px, 0.9fr) minmax(0, 1.5fr);
  gap: 20px;
  align-items: stretch;
  height: calc(100vh - 120px);
  min-height: 560px;
}

.library-panel,
.now-playing {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.library-panel {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
  overflow: hidden;
}

.search-box {
  padding: 16px 16px 10px;
}

.search-box input {
  width: 100%;
  height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 12px;
  color: var(--text);
  background: #fbfcfd;
}

.search-box input:focus {
  border-color: var(--blue);
  outline: 3px solid rgba(37, 99, 235, 0.14);
}

.library-summary {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 0 16px 12px;
  color: var(--muted);
  font-size: 13px;
}

.library-summary span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.playlist {
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1;
  min-height: 0;
  overflow: auto;
  padding: 0 10px 10px;
}

.track-row {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr) 48px;
  gap: 12px;
  align-items: center;
  width: 100%;
  min-width: 0;
  min-height: 88px;
  padding: 8px 10px 8px 8px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: inherit;
  text-align: left;
}

.track-row:hover {
  background: #f7faf9;
}

.track-row.active {
  background: var(--panel-strong);
  border-color: rgba(15, 118, 110, 0.28);
}

.track-thumb,
.thumb-placeholder {
  width: 72px;
  height: 72px;
  border-radius: 6px;
  object-fit: cover;
  background: #dfe6ed;
}

.thumb-placeholder {
  display: grid;
  place-items: center;
  color: var(--muted);
  font-weight: 800;
}

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

.track-title {
  display: -webkit-box;
  overflow: hidden;
  color: var(--text);
  font-size: 15px;
  font-weight: 800;
  line-height: 1.35;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.track-subtitle {
  display: -webkit-box;
  overflow: hidden;
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.3;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 1;
}

.track-duration {
  color: var(--muted);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.empty-state {
  display: grid;
  place-items: center;
  min-height: 240px;
  padding: 24px;
  color: var(--muted);
  text-align: center;
}

.now-playing {
  display: grid;
  grid-template-columns: minmax(220px, 320px) minmax(0, 1fr);
  grid-template-rows: auto auto auto minmax(0, 1fr);
  gap: 18px 24px;
  height: 100%;
  min-height: 0;
  padding: 24px;
}

.cover-stage {
  position: relative;
  grid-row: 1 / 4;
  align-self: start;
  width: 100%;
  aspect-ratio: 1;
  overflow: hidden;
  border-radius: 8px;
  background: #e5ebef;
}

.cover-stage img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.cover-stage img[src=""] {
  display: none;
}

.cover-placeholder {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: #6f7d87;
  font-size: 80px;
  font-weight: 900;
  background: #e5ebef;
}

.cover-stage.has-cover .cover-placeholder {
  display: none;
}

.track-info {
  min-width: 0;
}

.folder-label {
  overflow: hidden;
  margin-bottom: 8px;
  color: var(--orange);
  font-size: 12px;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.track-info h2 {
  overflow-wrap: anywhere;
  font-size: clamp(24px, 4vw, 42px);
  line-height: 1.1;
}

.track-info p:last-child {
  margin-top: 10px;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.5;
}

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

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

.control-row {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  align-items: start;
}

.controls {
  display: grid;
  grid-template-columns: 52px 52px 58px 52px 52px;
  gap: 10px;
  align-items: center;
}

.icon-button,
.play-button {
  display: grid;
  place-items: center;
  height: 52px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--text);
  line-height: 1;
}

.icon-button,
.play-button {
  width: 52px;
  border-radius: 50%;
  font-size: 20px;
}

.play-button {
  width: 58px;
  height: 58px;
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
  font-size: 22px;
}

.icon-button:hover,
.icon-button:focus-visible,
.play-button:hover,
.play-button:focus-visible {
  border-color: var(--accent);
  outline: none;
}

.icon-button.active {
  border-color: var(--blue);
  color: var(--blue);
  background: #eef4ff;
}

.volume-row {
  display: flex;
  gap: 8px;
  align-items: center;
  color: var(--muted);
  font-size: 13px;
}

.volume-row input {
  width: min(260px, 100%);
}

.lyrics-panel {
  grid-column: 1 / -1;
  grid-row: 4;
  min-height: 0;
  overflow: hidden;
  border-top: 1px solid var(--line);
  padding-top: 16px;
}

.lyrics-list {
  height: 100%;
  min-height: 0;
  overflow: auto;
  scroll-behavior: smooth;
  padding-right: 0;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.lyrics-list::-webkit-scrollbar {
  display: none;
}

.lyric-line {
  width: 100%;
  min-height: 36px;
  padding: 8px 10px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font-size: 16px;
  line-height: 1.45;
  text-align: left;
  overflow-wrap: anywhere;
  white-space: pre-line;
}

.lyric-line:hover {
  color: var(--text);
  background: #f7faf9;
}

.lyric-line.active {
  color: var(--accent-strong);
  background: var(--panel-strong);
  font-size: 19px;
  font-weight: 900;
}

@media (max-width: 900px) {
  .app-shell {
    width: min(100% - 20px, 720px);
    padding: 14px 0;
  }

  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .topbar-actions {
    width: 100%;
    justify-content: stretch;
  }

  .text-button {
    flex: 1;
  }

  .player-layout {
    grid-template-columns: 1fr;
    height: auto;
    min-height: auto;
  }

  .library-panel {
    height: 430px;
    max-height: 58vh;
    min-height: 320px;
  }

  .now-playing {
    grid-template-columns: 1fr;
    grid-template-rows: auto;
    height: auto;
    padding: 16px;
  }

  .cover-stage {
    grid-row: auto;
    width: min(100%, 360px);
    justify-self: center;
  }

  .lyrics-panel {
    grid-column: auto;
    grid-row: auto;
  }

  .control-row {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .controls {
    grid-template-columns: 52px 52px 58px 52px 52px;
    justify-content: center;
  }

  .lyrics-list {
    min-height: 260px;
    max-height: 360px;
  }
}

@media (max-width: 520px) {
  .playlist {
    gap: 8px;
    padding: 0 10px 10px;
  }

  .track-row {
    grid-template-columns: 58px minmax(0, 1fr);
    min-height: 72px;
    padding: 7px;
  }

  .track-thumb,
  .thumb-placeholder {
    width: 58px;
    height: 58px;
  }

  .track-title {
    font-size: 13px;
  }

  .track-duration {
    display: none;
  }

  .track-subtitle {
    font-size: 11px;
  }

  .timeline {
    grid-template-columns: 38px minmax(0, 1fr) 38px;
    gap: 8px;
  }

  .controls {
    grid-template-columns: 52px 44px 52px 44px 52px;
    gap: 7px;
  }

  .icon-button {
    width: 44px;
    height: 44px;
  }

  .play-button {
    width: 52px;
    height: 52px;
  }

  .volume-row input {
    flex: 1;
    width: auto;
  }
}
