:root {
  --green: #28b56a;
  --green-dark: #159154;
  --green-soft: #edf9f2;
  --text: #16181d;
  --muted: #8c93a0;
  --line: #eceef1;
  --surface: #f7f8fa;
  --white: #fff;
  --radius-lg: 22px;
  --radius-md: 18px;
  --shadow: 0 8px 28px rgba(20, 28, 38, .045);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  background: #fff;
}
body {
  margin: 0;
  min-width: 320px;
  color: var(--text);
  background: #fff;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
button, input { font: inherit; }
button { border: 0; background: none; color: inherit; cursor: pointer; }
input { outline: 0; }

.app-shell {
  width: min(100%, 760px);
  min-height: 100dvh;
  margin: 0 auto;
  padding: env(safe-area-inset-top) 20px calc(110px + env(safe-area-inset-bottom));
  background: #fff;
}

.view { width: 100%; }

.topbar {
  position: relative;
  min-height: 118px;
  display: grid;
  grid-template-columns: 44px 1fr 44px;
  align-items: start;
  padding-top: 26px;
}
.topbar-title { text-align: center; }
.topbar-title h1 {
  margin: 0;
  font-size: 31px;
  line-height: 1.15;
  font-weight: 750;
  letter-spacing: -.5px;
}
.topbar-title p {
  margin: 11px 0 0;
  color: var(--muted);
  font-size: 15px;
}
.icon-btn {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  padding: 0;
}
.chevron-left {
  width: 15px;
  height: 15px;
  border-left: 2.5px solid #20242a;
  border-bottom: 2.5px solid #20242a;
  transform: rotate(45deg);
}
.more-btn { display: flex; justify-content: center; gap: 4px; align-items: center; }
.more-btn span {
  width: 4px;
  height: 4px;
  background: #23262c;
  border-radius: 50%;
}
.filter-btn { display: flex; flex-direction: column; justify-content: center; gap: 5px; padding: 0 8px; }
.filter-btn span {
  display: block;
  width: 26px;
  height: 2px;
  border-radius: 2px;
  background: #20242a;
}
.filter-btn span:nth-child(2) { width: 18px; align-self: flex-end; }
.filter-btn span:nth-child(3) { width: 22px; }

.advanced-panel {
  margin: -10px 0 18px auto;
  width: 210px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: var(--shadow);
  background: #fff;
  position: relative;
  z-index: 5;
}
.advanced-option {
  width: 100%;
  padding: 11px 12px;
  text-align: left;
  border-radius: 11px;
  color: #5d6470;
}
.advanced-option.is-active {
  color: var(--green-dark);
  background: var(--green-soft);
  font-weight: 650;
}

.search-block { padding-top: 8px; }
.search-input-wrap,
.results-searchbar {
  position: relative;
  display: flex;
  align-items: center;
  min-height: 76px;
  border: 1px solid #e5e8ec;
  background: #fbfbfc;
  border-radius: 22px;
}
.search-icon {
  flex: 0 0 auto;
  width: 24px;
  height: 24px;
  margin-left: 27px;
  border: 2px solid #7f8794;
  border-radius: 50%;
  position: relative;
}
.search-icon::after {
  content: "";
  position: absolute;
  width: 9px;
  height: 2px;
  right: -6px;
  bottom: 1px;
  border-radius: 2px;
  background: #7f8794;
  transform: rotate(45deg);
}
.search-input-wrap input,
.results-searchbar input {
  min-width: 0;
  width: 100%;
  border: 0;
  background: transparent;
  padding: 0 48px 0 22px;
  color: #21242a;
  font-size: 20px;
}
.search-input-wrap input::placeholder { color: #9aa0aa; }
.clear-btn,
.results-clear {
  position: absolute;
  right: 18px;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  color: #fff;
  background: #d8dce2;
  font-size: 23px;
  line-height: 28px;
}

.primary-btn {
  width: 100%;
  min-height: 70px;
  margin-top: 26px;
  border-radius: 21px;
  background: var(--green);
  color: #fff;
  font-size: 21px;
  font-weight: 720;
  box-shadow: 0 10px 24px rgba(40, 181, 106, .13);
}
.primary-btn:active { transform: translateY(1px); }
.primary-btn[disabled] { opacity: .55; }

.source-switcher {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
  margin-top: 24px;
}
.source-pill {
  height: 52px;
  border: 1px solid #e3e6ea;
  border-radius: 999px;
  color: #6c7280;
  background: #fff;
  font-size: 17px;
}
.source-pill.is-active {
  color: #fff;
  border-color: var(--green);
  background: var(--green);
}

.inline-error {
  margin-top: 16px;
  color: #d74a49;
  font-size: 14px;
  text-align: center;
}

.recent-card {
  margin-top: 34px;
  border: 1px solid var(--line);
  border-radius: 22px;
  padding: 24px 25px 10px;
  background: #fff;
}
.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}
.section-head h2 {
  margin: 0;
  font-size: 22px;
  font-weight: 740;
}
.section-head button { color: #a0a6b0; font-size: 15px; }
.recent-row {
  width: 100%;
  min-height: 68px;
  padding: 0;
  text-align: left;
  background: transparent;
  display: grid;
  grid-template-columns: 30px 1fr 18px;
  align-items: center;
  gap: 13px;
  border-top: 1px solid var(--line);
}
.recent-row:first-child { border-top: 0; }
.history-icon {
  width: 22px;
  height: 22px;
  border: 2px solid #a0a6b0;
  border-radius: 50%;
  position: relative;
}
.history-icon::before {
  content: "";
  position: absolute;
  left: 9px;
  top: 4px;
  width: 2px;
  height: 7px;
  background: #a0a6b0;
}
.history-icon::after {
  content: "";
  position: absolute;
  left: 9px;
  top: 10px;
  width: 6px;
  height: 2px;
  background: #a0a6b0;
  transform-origin: left center;
  transform: rotate(24deg);
}
.recent-text {
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  font-size: 17px;
}
.recent-text span { color: #808795; }
.row-chevron {
  width: 9px;
  height: 9px;
  justify-self: end;
  border-right: 2px solid #a2a7b0;
  border-top: 2px solid #a2a7b0;
  transform: rotate(45deg);
}
.recent-empty {
  padding: 22px 0 28px;
  color: var(--muted);
  text-align: center;
}

.helper-line {
  margin: 54px 0 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  color: #9aa0aa;
  font-size: 14px;
  text-align: center;
}
.helper-icon {
  width: 20px;
  height: 20px;
  border: 1.5px solid #a7acb5;
  border-radius: 50%;
  font-size: 13px;
  line-height: 18px;
  font-weight: 700;
}

.results-view { padding-bottom: 18px; }
.results-topbar { min-height: 105px; }
.results-searchbar {
  min-height: 64px;
  margin-top: 5px;
  border: 0;
  background: #f5f6f8;
}
.results-searchbar .search-icon {
  width: 21px;
  height: 21px;
  margin-left: 24px;
}
.results-searchbar input { font-size: 18px; padding-left: 20px; }
.results-clear {
  position: static;
  flex: 0 0 auto;
  margin-right: 16px;
  background: #d4d8de;
}

.results-meta {
  min-height: 74px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: #8d94a0;
  font-size: 15px;
}
.results-source {
  padding: 0;
  color: #8d94a0;
}
.results-source strong {
  color: #666d78;
  font-weight: 500;
}
.down-caret {
  display: inline-block;
  width: 8px;
  height: 8px;
  margin-left: 5px;
  border-right: 1.5px solid #9ca2ac;
  border-bottom: 1.5px solid #9ca2ac;
  transform: rotate(45deg) translateY(-2px);
}

.source-menu {
  margin: -8px 0 16px;
  padding: 8px;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #fff;
  box-shadow: var(--shadow);
}
.source-menu button {
  height: 42px;
  border-radius: 11px;
  color: #707784;
}
.source-menu button.is-active {
  color: var(--green-dark);
  background: var(--green-soft);
  font-weight: 650;
}

.results-list {
  display: flex;
  flex-direction: column;
  gap: 18px;
}
.song-card {
  border: 1px solid #eef0f2;
  border-radius: 22px;
  padding: 18px;
  background: #fff;
  box-shadow: var(--shadow);
}
.song-card.is-active {
  border-color: #ccefdc;
  background: linear-gradient(180deg, #fbfffd 0%, #f4fcf7 100%);
}
.song-main {
  display: grid;
  grid-template-columns: 106px minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}
.song-cover {
  width: 106px;
  height: 106px;
  border-radius: 15px;
  object-fit: cover;
  background: #f0f1f3;
}
.song-body { min-width: 0; }
.song-title {
  margin: 1px 0 5px;
  font-size: 21px;
  line-height: 1.25;
  font-weight: 760;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.song-author {
  color: #727986;
  font-size: 16px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.source-tag {
  display: inline-flex;
  align-items: center;
  height: 25px;
  margin-top: 9px;
  padding: 0 10px;
  border-radius: 999px;
  color: var(--green-dark);
  background: #edf8f2;
  font-size: 13px;
}
.song-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 11px;
  margin-top: 14px;
}
.listen-btn,
.get-btn {
  height: 46px;
  display: grid;
  place-items: center;
  text-decoration: none;
  border-radius: 13px;
  border: 1px solid #dce1e5;
  background: #fff;
  color: var(--green-dark);
  font-size: 16px;
  font-weight: 650;
}
.listen-btn.is-playing {
  border-color: var(--green);
  background: var(--green);
  color: #fff;
}
.listen-btn .play-triangle {
  display: inline-block;
  width: 0;
  height: 0;
  margin-right: 8px;
  border-top: 6px solid transparent;
  border-bottom: 6px solid transparent;
  border-left: 9px solid currentColor;
  vertical-align: -1px;
}
.listen-btn .small-pause {
  display: inline-flex;
  gap: 3px;
  margin-right: 8px;
  vertical-align: -1px;
}
.listen-btn .small-pause i {
  display: block;
  width: 3px;
  height: 13px;
  border-radius: 2px;
  background: currentColor;
}

.song-progress {
  display: none;
  margin-top: 18px;
}
.song-card.is-active .song-progress { display: block; }
.progress-track {
  width: 100%;
  height: 4px;
  border-radius: 999px;
  background: #e1e5e8;
  overflow: visible;
  position: relative;
}
.progress-value {
  width: 0%;
  height: 100%;
  border-radius: 999px;
  background: var(--green);
}
.progress-time {
  margin-top: 8px;
  text-align: right;
  color: #8d94a0;
  font-size: 13px;
}

.load-more {
  width: 100%;
  height: 48px;
  margin-top: 20px;
  border-radius: 999px;
  color: var(--green-dark);
  background: #f1faf5;
  font-weight: 650;
}
.results-empty {
  padding: 50px 0;
  text-align: center;
  color: var(--muted);
}

.mini-player {
  position: fixed;
  z-index: 30;
  left: 50%;
  bottom: max(14px, env(safe-area-inset-bottom));
  transform: translateX(-50%);
  width: min(calc(100% - 22px), 730px);
  min-height: 74px;
  padding: 10px 12px;
  display: grid;
  grid-template-columns: 50px 1fr 48px;
  align-items: center;
  gap: 12px;
  border: 1px solid #edf0f2;
  border-radius: 23px;
  background: rgba(255, 255, 255, .96);
  box-shadow: 0 14px 34px rgba(20, 28, 38, .12);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
}
.mini-player img {
  width: 50px;
  height: 50px;
  border-radius: 11px;
  object-fit: cover;
}
.mini-info {
  min-width: 0;
  font-size: 15px;
  color: #7e8591;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.mini-info strong {
  color: #333840;
  font-weight: 600;
}
.mini-toggle {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--green);
  display: grid;
  place-items: center;
}
.pause-icon,
.pause-icon::after {
  width: 4px;
  height: 16px;
  border-radius: 2px;
  background: #fff;
}
.pause-icon { position: relative; transform: translateX(-4px); }
.pause-icon::after {
  content: "";
  position: absolute;
  left: 8px;
  top: 0;
}
.mini-toggle.is-paused .pause-icon {
  width: 0;
  height: 0;
  background: transparent;
  border-top: 8px solid transparent;
  border-bottom: 8px solid transparent;
  border-left: 12px solid #fff;
  border-radius: 0;
  transform: translateX(2px);
}
.mini-toggle.is-paused .pause-icon::after { display: none; }

@media (max-width: 520px) {
  .app-shell { padding-left: 18px; padding-right: 18px; }
  .topbar { min-height: 110px; padding-top: 20px; }
  .topbar-title h1 { font-size: 27px; }
  .topbar-title p { font-size: 14px; margin-top: 8px; }
  .search-input-wrap { min-height: 66px; border-radius: 19px; }
  .search-input-wrap input { font-size: 18px; }
  .primary-btn { min-height: 62px; border-radius: 18px; font-size: 19px; margin-top: 22px; }
  .source-pill { height: 48px; font-size: 16px; }
  .recent-card { margin-top: 30px; padding: 20px 21px 8px; border-radius: 20px; }
  .section-head h2 { font-size: 20px; }
  .recent-row { min-height: 64px; }
  .song-card { padding: 15px; border-radius: 20px; }
  .song-main { grid-template-columns: 96px minmax(0, 1fr); gap: 15px; }
  .song-cover { width: 96px; height: 96px; border-radius: 14px; }
  .song-title { font-size: 19px; }
  .song-author { font-size: 15px; }
  .listen-btn, .get-btn { height: 43px; font-size: 15px; }
}

@media (max-width: 380px) {
  .app-shell { padding-left: 14px; padding-right: 14px; }
  .source-switcher { gap: 9px; }
  .song-main { grid-template-columns: 84px minmax(0, 1fr); gap: 13px; }
  .song-cover { width: 84px; height: 84px; }
  .song-actions { grid-template-columns: 1fr; gap: 8px; }
}


/* VERIFIED-AUDIO-HOTFIX */
.listen-btn:disabled,
.get-btn:disabled {
  opacity: .46;
  cursor: not-allowed;
  pointer-events: none;
}
.song-error {
  margin-top: 9px;
  color: #bf5a5a;
  font-size: 12px;
  line-height: 1.4;
}
