:root {
  --green: #2ecc71;
  --green-dark: #27ae60;
  --green-soft: #e8f6ef;
  --ink: #1f2933;
  --muted: #7b8794;
  --bg: #f2f7f4;
  --card: #ffffff;
  --line: #e3ece7;
  --shadow: 0 12px 32px rgba(23, 93, 58, 0.08);
  --radius: 16px;
  --font: "Microsoft YaHei UI", "Microsoft YaHei", "PingFang SC",
    "Noto Sans CJK SC", "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
}

body {
  min-height: 100vh;
  padding-bottom: 126px;
  color: var(--ink);
  background: var(--bg);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

button,
input,
select {
  font: inherit;
}

a {
  color: inherit;
}

/* ---------------------------------------------------------------- header */
.hero {
  position: relative;
  overflow: hidden;
  color: #fff;
  background: linear-gradient(135deg, #2ecc71 0%, #16a085 100%);
  box-shadow: 0 6px 24px rgba(22, 160, 133, 0.22);
}

.hero::before,
.hero::after {
  position: absolute;
  content: "";
  border-radius: 50%;
  pointer-events: none;
  background: rgba(255, 255, 255, 0.1);
}

.hero::before {
  top: -90px;
  right: 8%;
  width: 260px;
  height: 260px;
}

.hero::after {
  bottom: -120px;
  left: 22%;
  width: 220px;
  height: 220px;
}

.hero-inner {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  width: min(1120px, 100%);
  margin: 0 auto;
  padding: 24px 20px;
}

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

.logo {
  display: grid;
  flex: 0 0 auto;
  width: 50px;
  height: 50px;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.45);
  border-radius: 15px;
  background: rgba(255, 255, 255, 0.16);
  font-size: 28px;
  line-height: 1;
}

.brand-text h1 {
  margin: 0;
  font-size: 23px;
  font-weight: 700;
  letter-spacing: 0.5px;
}

.brand-text p {
  margin: 3px 0 0;
  color: rgba(255, 255, 255, 0.85);
  font-size: 13px;
}

.site-link {
  flex: 0 0 auto;
  padding: 8px 14px;
  border: 1px solid rgba(255, 255, 255, 0.5);
  border-radius: 999px;
  color: #fff;
  font-size: 13px;
  text-decoration: none;
  transition: background 0.18s ease;
}

.site-link:hover {
  background: rgba(255, 255, 255, 0.16);
}

/* ---------------------------------------------------------------- layout */
.container {
  width: min(1120px, 100%);
  margin: 0 auto;
  padding: 22px 20px 12px;
}

.search-card,
.results-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--card);
  box-shadow: var(--shadow);
}

.search-card {
  padding: 18px;
}

.search-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.input-wrap {
  position: relative;
  flex: 1 1 340px;
  min-width: 0;
}

.search-icon {
  position: absolute;
  top: 50%;
  left: 14px;
  width: 18px;
  height: 18px;
  color: #9aa8a0;
  pointer-events: none;
  transform: translateY(-50%);
}

#keyword {
  width: 100%;
  height: 44px;
  padding: 0 14px 0 42px;
  border: 1px solid var(--line);
  border-radius: 12px;
  outline: none;
  background: #fbfdfc;
  color: var(--ink);
  font-size: 15px;
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
}

#keyword::placeholder {
  color: #a6b2ab;
}

#keyword:focus {
  border-color: var(--green);
  background: #fff;
  box-shadow: 0 0 0 4px rgba(46, 204, 113, 0.12);
}

#mode,
#pages {
  height: 44px;
  padding: 0 30px 0 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  outline: none;
  background: #fbfdfc;
  color: var(--ink);
  cursor: pointer;
}

#mode:focus,
#pages:focus {
  border-color: var(--green);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 44px;
  padding: 0 22px;
  border: 0;
  border-radius: 12px;
  cursor: pointer;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
  transition: background 0.18s ease, color 0.18s ease, opacity 0.18s ease;
}

.btn.primary {
  background: var(--green);
  color: #fff;
  box-shadow: 0 8px 18px rgba(46, 204, 113, 0.25);
}

.btn.primary:hover {
  background: var(--green-dark);
}

.btn.primary:disabled {
  cursor: wait;
  opacity: 0.65;
}

.btn.ghost {
  height: 38px;
  padding: 0 16px;
  border: 1px solid var(--line);
  background: #fff;
  color: #44524a;
  font-size: 13px;
}

.btn.ghost:hover {
  border-color: var(--green);
  color: var(--green-dark);
}

.btn.ghost.active {
  border-color: var(--green);
  background: var(--green-soft);
  color: var(--green-dark);
}

.btn.is-disabled {
  pointer-events: none;
  opacity: 0.45;
}

.filters {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-top: 14px;
}

.filter-label {
  margin-right: 2px;
  color: var(--muted);
  font-size: 13px;
}

.chip {
  position: relative;
  cursor: pointer;
  user-select: none;
}

.chip input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.chip span {
  display: inline-block;
  padding: 5px 13px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fbfdfc;
  color: #5d6b63;
  font-size: 13px;
  transition: all 0.16s ease;
}

.chip:hover span {
  border-color: #b9e6cd;
  color: var(--green-dark);
}

.chip input:checked + span {
  border-color: var(--green);
  background: var(--green);
  color: #fff;
}

.chip input:focus-visible + span {
  box-shadow: 0 0 0 3px rgba(46, 204, 113, 0.22);
}

.hint {
  margin-left: auto;
  color: #9aa8a0;
  font-size: 12px;
}

/* --------------------------------------------------------------- results */
.results-card {
  margin-top: 20px;
  overflow: hidden;
}

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

.results-head h2 {
  margin: 0;
  font-size: 16px;
  font-weight: 700;
}

.muted {
  color: var(--muted);
  font-size: 13px;
}

.results {
  min-height: 180px;
}

.empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 56px 20px;
  color: #95a39b;
  text-align: center;
}

.empty-icon {
  display: grid;
  width: 58px;
  height: 58px;
  margin-bottom: 12px;
  place-items: center;
  border-radius: 50%;
  background: var(--green-soft);
  color: var(--green);
  font-size: 28px;
}

.empty p {
  margin: 0;
  font-size: 14px;
}

.song-row {
  display: grid;
  grid-template-columns: 34px 48px minmax(0, 1fr) 84px 86px;
  align-items: center;
  gap: 12px;
  padding: 10px 20px;
  border-bottom: 1px solid #f0f5f2;
  transition: background 0.15s ease;
}

.song-row:last-child {
  border-bottom: 0;
}

.song-row:hover {
  background: #f8fcfa;
}

.song-row.current {
  background: #f0fbf5;
}

.song-index {
  color: #a3b0a8;
  font-size: 12px;
  text-align: center;
}

.song-cover {
  position: relative;
  display: grid;
  width: 48px;
  height: 48px;
  overflow: hidden;
  place-items: center;
  border-radius: 10px;
  background: var(--green-soft);
  color: var(--green);
  font-size: 20px;
}

.song-cover::before {
  content: "♪";
}

.song-cover img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

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

.song-name {
  overflow: hidden;
  color: var(--ink);
  font-size: 14px;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.song-artist {
  overflow: hidden;
  margin-top: 2px;
  color: var(--muted);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.badge {
  justify-self: start;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 11px;
  white-space: nowrap;
}

.source-netease {
  background: #fdecea;
  color: #c0392b;
}

.source-qq {
  background: #e8f3ff;
  color: #1e6fd9;
}

.source-kugou {
  background: #e8f8ff;
  color: #0b84c9;
}

.source-kuwo {
  background: #fff4e5;
  color: #d97706;
}

.song-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

.play-btn,
.download-btn {
  display: grid;
  width: 38px;
  height: 38px;
  padding: 0;
  place-items: center;
  border: 0;
  border-radius: 50%;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.16s ease, color 0.16s ease, transform 0.16s ease;
}

.play-btn {
  background: var(--green);
  color: #fff;
  box-shadow: 0 5px 12px rgba(46, 204, 113, 0.28);
}

.play-btn:hover {
  background: var(--green-dark);
  transform: scale(1.05);
}

.play-btn svg {
  width: 18px;
  height: 18px;
  fill: currentColor;
}

.download-btn {
  background: #f3f7f5;
  color: #6b7a71;
}

.download-btn:hover {
  background: var(--green-soft);
  color: var(--green-dark);
}

.download-btn svg {
  width: 18px;
  height: 18px;
}

/* ---------------------------------------------------------------- player */
.player {
  position: fixed;
  z-index: 40;
  right: 0;
  bottom: 0;
  left: 0;
  border-top: 1px solid rgba(227, 236, 231, 0.9);
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 -10px 30px rgba(23, 93, 58, 0.08);
  backdrop-filter: blur(14px);
}

.player-inner {
  display: flex;
  align-items: center;
  gap: 14px;
  width: min(1120px, 100%);
  margin: 0 auto;
  padding: 11px 20px;
}

.player-cover {
  position: relative;
  display: grid;
  flex: 0 0 auto;
  width: 56px;
  height: 56px;
  overflow: hidden;
  place-items: center;
  border-radius: 12px;
  background: var(--green-soft);
  color: var(--green);
  font-size: 24px;
}

.player-cover::before {
  content: "♪";
}

.player-cover img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.player-meta {
  flex: 0 0 220px;
  min-width: 0;
}

.player-title {
  overflow: hidden;
  font-size: 14px;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.player-artist {
  overflow: hidden;
  margin-top: 2px;
  color: var(--muted);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#audio {
  flex: 1 1 auto;
  width: 100%;
  min-width: 220px;
  height: 40px;
}

.player-actions {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 8px;
}

/* ---------------------------------------------------------------- lyrics */
.lyrics-panel {
  position: fixed;
  z-index: 45;
  right: 22px;
  bottom: 92px;
  display: flex;
  flex-direction: column;
  width: 370px;
  max-height: min(62vh, 560px);
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.98);
  box-shadow: 0 18px 50px rgba(23, 93, 58, 0.18);
  opacity: 0;
  pointer-events: none;
  transform: translateY(14px);
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.lyrics-panel.open {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

.lyrics-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
}

.lyrics-head h3 {
  margin: 0;
  font-size: 14px;
  font-weight: 700;
}

.icon-close {
  display: grid;
  width: 28px;
  height: 28px;
  padding: 0;
  place-items: center;
  border: 0;
  border-radius: 50%;
  background: #f3f7f5;
  color: #6b7a71;
  cursor: pointer;
  font-size: 18px;
  line-height: 1;
}

.icon-close:hover {
  background: var(--green-soft);
  color: var(--green-dark);
}

.lyrics-body {
  overflow-y: auto;
  padding: 10px 18px 22px;
  scroll-behavior: smooth;
}

.lyric-line {
  padding: 7px 0;
  color: #7d8b83;
  font-size: 13px;
  text-align: center;
  transition: color 0.16s ease, transform 0.16s ease;
}

.lyric-line.active {
  color: var(--green-dark);
  font-size: 14px;
  font-weight: 700;
  transform: scale(1.02);
}

.lyrics-empty {
  padding: 34px 10px;
  color: #9aa8a0;
  font-size: 13px;
  text-align: center;
}

/* ----------------------------------------------------------------- toast */
.toast {
  position: fixed;
  z-index: 60;
  bottom: 104px;
  left: 50%;
  max-width: min(90vw, 520px);
  padding: 10px 18px;
  border-radius: 999px;
  background: rgba(31, 41, 51, 0.92);
  color: #fff;
  font-size: 13px;
  opacity: 0;
  pointer-events: none;
  text-align: center;
  transform: translate(-50%, 10px);
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

/* ------------------------------------------------------------- responsive */
@media (max-width: 860px) {
  .hint {
    flex-basis: 100%;
    margin-left: 0;
  }

  .player-meta {
    flex-basis: 160px;
  }
}

@media (max-width: 720px) {
  body {
    padding-bottom: 190px;
  }

  .hero-inner {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }

  .site-link {
    align-self: flex-end;
  }

  .container {
    padding: 16px 12px 8px;
  }

  .search-card {
    padding: 14px;
  }

  .search-row {
    flex-wrap: wrap;
  }

  .input-wrap {
    flex-basis: 100%;
  }

  #mode,
  #pages {
    flex: 1;
  }

  .search-row .btn.primary {
    flex: 1 1 100%;
  }

  .song-row {
    grid-template-columns: 40px minmax(0, 1fr) 82px;
    gap: 10px;
    padding: 10px 14px;
  }

  .song-index,
  .badge {
    display: none;
  }

  .player-inner {
    flex-wrap: wrap;
    gap: 10px;
    padding: 10px 14px;
  }

  .player-meta {
    flex: 1 1 auto;
  }

  #audio {
    flex-basis: 100%;
    order: 4;
    min-width: 0;
  }

  .lyrics-panel {
    right: 12px;
    bottom: 168px;
    width: calc(100% - 24px);
  }

  .toast {
    bottom: 196px;
  }
}

@media (max-width: 420px) {
  .brand-text h1 {
    font-size: 19px;
  }

  .brand-text p {
    font-size: 12px;
  }

  .logo {
    width: 44px;
    height: 44px;
    font-size: 24px;
  }

  .song-row {
    grid-template-columns: 40px minmax(0, 1fr) 78px;
  }

  .play-btn,
  .download-btn {
    width: 34px;
    height: 34px;
  }
}

/* ---------------------------------------------------------------- focus */
:focus-visible {
  outline: 2px solid var(--green);
  outline-offset: 2px;
}

/* ------------------------------------------------------------ scrollbar */
.lyrics-body::-webkit-scrollbar {
  width: 6px;
}

.lyrics-body::-webkit-scrollbar-thumb {
  border-radius: 999px;
  background: #d4e3da;
}

.lyrics-body::-webkit-scrollbar-track {
  background: transparent;
}
