* {
  box-sizing: border-box;
}

:root {
  color-scheme: dark;
  --bg: #09090b;
  --panel: rgba(24, 24, 27, 0.82);
  --panel-border: rgba(255, 255, 255, 0.08);
  --text: #f4f4f5;
  --muted: #a1a1aa;
  --accent: #34d399;
  --accent-strong: #10b981;
  --danger: #f87171;
  --shadow: 0 24px 80px rgba(0, 0, 0, 0.4);
}

html,
body {
  margin: 0;
  min-height: 100%;
  background:
    radial-gradient(circle at top left, rgba(52, 211, 153, 0.16), transparent 28%),
    radial-gradient(circle at top right, rgba(59, 130, 246, 0.15), transparent 25%),
    var(--bg);
  color: var(--text);
  font-family: "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
}

button,
input,
select {
  font: inherit;
}

.app-shell {
  max-width: 1320px;
  margin: 0 auto;
  padding: 32px 20px 40px;
}

.hero {
  display: flex;
  align-items: stretch;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 24px;
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--accent);
  letter-spacing: 0.18em;
  text-transform: uppercase;
  font-size: 12px;
}

.hero h1 {
  margin: 0;
  font-size: clamp(32px, 5vw, 54px);
  line-height: 1.02;
}

.subtitle {
  margin: 12px 0 0;
  max-width: 620px;
  color: var(--muted);
  font-size: 16px;
}

.hero-card,
.panel {
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: 24px;
  backdrop-filter: blur(20px);
  box-shadow: var(--shadow);
}

.hero-card {
  min-width: 260px;
  padding: 18px 20px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 10px;
}

.hero-label,
.meta-label {
  color: var(--muted);
  font-size: 13px;
}

.layout {
  display: grid;
  grid-template-columns: 1.4fr 0.9fr;
  gap: 24px;
}

.panel {
  padding: 22px;
}

.status-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.panel-head {
  margin-bottom: 18px;
}

.panel-head h2,
.status-head h3,
.manual-panel h3 {
  margin: 0;
  font-size: 20px;
}

.panel-head h2 {
  margin-bottom: 14px;
}

.toolbar {
  display: flex;
  gap: 12px;
  flex-wrap: nowrap;
  align-items: flex-end;
  min-width: 0;
}

.search-form {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) 92px auto auto;
  gap: 12px;
  align-items: end;
  flex: 1;
  min-width: 0;
}

#clear-search-btn {
  align-self: end;
  white-space: nowrap;
}

.search-field,
.quality-field,
.volume-row {
  display: flex;
  flex-direction: column;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
}

.search-field-wide {
  min-width: 0;
}

.search-field-wide input {
  width: 100%;
  min-width: 0;
}

.source-field select {
  min-width: 92px;
}

.toolbar > .quality-field {
  width: 92px;
  flex: 0 0 92px;
}

#search-btn {
  white-space: nowrap;
}

.search-field input,
.quality-field select,
.manual-form input,
.manual-form select {
  min-width: 0;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  border-radius: 14px;
  padding: 12px 14px;
  outline: none;
}

.search-field input:focus,
.quality-field select:focus,
.manual-form input:focus,
.manual-form select:focus {
  border-color: rgba(52, 211, 153, 0.45);
  box-shadow: 0 0 0 3px rgba(52, 211, 153, 0.12);
}

.list-caption {
  margin: -2px 0 18px;
  color: var(--muted);
  font-size: 14px;
}

.search-meta {
  display: none;
  margin: -8px 0 16px;
  padding: 10px 14px;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.03);
  color: var(--muted);
  font-size: 13px;
}

.search-meta.visible {
  display: block;
}

.search-meta[data-tone="success"] {
  border-color: rgba(52, 211, 153, 0.2);
  background: rgba(52, 211, 153, 0.08);
  color: #d1fae5;
}

.search-meta[data-tone="error"] {
  border-color: rgba(248, 113, 113, 0.24);
  background: rgba(248, 113, 113, 0.08);
  color: #fecaca;
}

.track-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 520px;
}

.track-list-animate {
  animation: trackListFadeIn 0.28s ease;
}

@keyframes trackListFadeIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.pagination {
  display: none;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 20px;
  justify-content: center;
  align-items: center;
}

.pagination.visible {
  display: flex;
}

.page-btn,
.pagination-ellipsis {
  min-width: 40px;
  height: 40px;
  border-radius: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
}

.page-btn {
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  cursor: pointer;
  transition: transform 0.18s ease, border-color 0.18s ease, background 0.18s ease;
}

.page-btn:hover {
  transform: translateY(-1px);
  border-color: rgba(52, 211, 153, 0.28);
  background: rgba(255, 255, 255, 0.08);
}

.page-btn.active {
  border-color: rgba(52, 211, 153, 0.48);
  background: linear-gradient(135deg, rgba(52, 211, 153, 0.2), rgba(16, 185, 129, 0.28));
  color: #ecfdf5;
  font-weight: 700;
}

.page-nav-btn {
  min-width: 74px;
  padding: 0 14px;
}

.page-btn:disabled {
  opacity: 0.42;
  cursor: not-allowed;
  transform: none;
  border-color: rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.03);
}

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

.track-card {
  display: grid;
  grid-template-columns: 56px 1fr auto;
  gap: 16px;
  align-items: center;
  padding: 15px 16px;
  border-radius: 22px;
  border: 1px solid rgba(255, 255, 255, 0.04);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.035), rgba(255, 255, 255, 0.018));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
  transition: transform 0.18s ease, border-color 0.18s ease, background 0.18s ease, box-shadow 0.18s ease;
  cursor: pointer;
}

.track-card:hover {
  transform: translateY(-2px);
  border-color: rgba(52, 211, 153, 0.22);
  background: rgba(255, 255, 255, 0.05);
  box-shadow: 0 18px 30px rgba(0, 0, 0, 0.16);
}

.track-card.active {
  border-color: rgba(52, 211, 153, 0.42);
  background:
    linear-gradient(135deg, rgba(16, 185, 129, 0.14), rgba(37, 99, 235, 0.08));
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.05),
    0 20px 34px rgba(16, 185, 129, 0.08);
}

.track-card:focus-visible {
  outline: 2px solid rgba(52, 211, 153, 0.52);
  outline-offset: 2px;
}

.cover {
  width: 56px;
  height: 56px;
  display: grid;
  place-items: center;
  border-radius: 18px;
  background: linear-gradient(135deg, rgba(52, 211, 153, 0.95), rgba(37, 99, 235, 0.75));
  color: #04130e;
  font-size: 22px;
  font-weight: 700;
  overflow: hidden;
}

.cover-art {
  position: relative;
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.05), rgba(255, 255, 255, 0.02));
}

.track-cover-fallback {
  position: absolute;
  left: 8px;
  top: 6px;
  width: 31px;
  height: 44px;
  border-radius: 10px;
  background:
    linear-gradient(135deg, rgba(52, 211, 153, 0.92), rgba(37, 99, 235, 0.82)),
    linear-gradient(180deg, rgba(255, 255, 255, 0.12), rgba(255, 255, 255, 0.02));
  border: 1px solid rgba(255, 255, 255, 0.18);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.16),
    0 8px 16px rgba(0, 0, 0, 0.24);
  z-index: 1;
}

.track-cover-fallback::before {
  content: "";
  position: absolute;
  left: 20px;
  top: 7px;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background:
    radial-gradient(circle, rgba(255, 255, 255, 0.9) 0 2px, rgba(15, 23, 42, 0.96) 2px 6px, rgba(255, 255, 255, 0.15) 6px 7px, transparent 7px),
    radial-gradient(circle, rgba(255, 255, 255, 0.07) 0 58%, rgba(255, 255, 255, 0.14) 59%, rgba(9, 9, 11, 0.96) 60%, rgba(9, 9, 11, 0.99) 100%);
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.28);
  z-index: -1;
}

.track-cover-fallback::after {
  content: "";
  position: absolute;
  left: 5px;
  top: 5px;
  width: 6px;
  height: calc(100% - 10px);
  border-radius: 999px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.42), rgba(255, 255, 255, 0.08));
  opacity: 0.7;
}

.track-cover-image {
  position: relative;
  z-index: 2;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.track-title {
  margin: 0 0 6px;
  font-size: 17px;
  font-weight: 700;
}

.track-desc {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.5;
}

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

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

.badge {
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  color: var(--muted);
  font-size: 12px;
}

.track-card.active .badge {
  background: rgba(16, 185, 129, 0.16);
  color: #d1fae5;
}

.track-card.active .track-title {
  color: #f0fdf4;
}

.primary-btn,
.ghost-btn {
  border: 0;
  border-radius: 14px;
  padding: 11px 16px;
  cursor: pointer;
  transition: transform 0.18s ease, opacity 0.18s ease, background 0.18s ease;
}

.primary-btn:hover,
.ghost-btn:hover {
  transform: translateY(-1px);
}

.primary-btn {
  background: linear-gradient(135deg, var(--accent), var(--accent-strong));
  color: #032013;
  font-weight: 700;
}

.ghost-btn {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
}

.primary-btn:disabled,
.ghost-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
}

.side-panel {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.now-playing {
  display: flex;
  align-items: center;
  gap: 18px;
}

.now-playing-rich {
  align-items: flex-start;
}

.cover-frame {
  position: relative;
  width: 168px;
  min-width: 168px;
  height: 168px;
  border-radius: 26px;
  overflow: hidden;
  background: linear-gradient(135deg, rgba(52, 211, 153, 0.16), rgba(37, 99, 235, 0.12));
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: inset 0 0 30px rgba(255, 255, 255, 0.05);
}

.cover-image {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  z-index: 1;
}

.cover-image.hidden {
  display: none;
}

.disc {
  position: relative;
  z-index: 2;
  width: 100%;
  height: 100%;
  display: grid;
  place-items: center;
  border-radius: 0;
  background:
    linear-gradient(180deg, rgba(9, 9, 11, 0.08), rgba(9, 9, 11, 0.42)),
    radial-gradient(circle at center, rgba(9, 9, 11, 0.5) 0 14px, transparent 14px),
    radial-gradient(circle at center, rgba(52, 211, 153, 0.15), rgba(37, 99, 235, 0.12));
  font-size: 42px;
  box-shadow: inset 0 0 40px rgba(255, 255, 255, 0.03);
  transition: opacity 0.2s ease;
}

.cover-frame.has-cover .disc {
  opacity: 0;
  pointer-events: none;
}

.disc.spinning {
  animation: spin 8s linear infinite;
}

.track-meta h2 {
  margin: 4px 0 8px;
  font-size: 28px;
}

.track-meta p {
  margin: 0;
  color: var(--muted);
}

.album-meta {
  margin-top: 10px;
  font-size: 13px;
}

.playback-meta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}

.accent-badge,
.badge[data-tone="playing"] {
  background: rgba(16, 185, 129, 0.18);
  color: #d1fae5;
}

.badge[data-tone="resolving"] {
  background: rgba(59, 130, 246, 0.16);
  color: #dbeafe;
}

.badge[data-tone="paused"] {
  background: rgba(250, 204, 21, 0.14);
  color: #fef3c7;
}

.badge[data-tone="ended"] {
  background: rgba(168, 85, 247, 0.16);
  color: #ede9fe;
}

.badge[data-tone="error"] {
  background: rgba(248, 113, 113, 0.14);
  color: #fecaca;
}

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

#audio-player {
  width: 100%;
  filter: saturate(0.9) contrast(1.1);
}

.control-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.progress-meta {
  display: grid;
  grid-template-columns: 52px 1fr 52px;
  align-items: center;
  gap: 12px;
  color: var(--muted);
  font-size: 13px;
}

#progress-input,
#volume-input {
  width: 100%;
}

.manual-panel,
.lyrics-panel,
.status-panel {
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  padding-top: 20px;
}

.lyrics-output {
  min-height: 220px;
  max-height: 300px;
  overflow-y: auto;
  padding: 0 16px;
  border-radius: 18px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.02), rgba(255, 255, 255, 0.01)),
    rgba(0, 0, 0, 0.28);
  color: #e4e4e7;
  font-size: 14px;
  scroll-behavior: smooth;
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.lyric-spacer {
  height: 96px;
  flex-shrink: 0;
}

.lyrics-output::-webkit-scrollbar {
  width: 6px;
}

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

.lyrics-output::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.15);
  border-radius: 3px;
}

.lyrics-output::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.25);
}

.lyric-line {
  padding: 9px 0;
  line-height: 1.9;
  color: rgba(212, 212, 216, 0.46);
  transition: color 0.25s ease, transform 0.25s ease, opacity 0.25s ease, filter 0.25s ease;
  opacity: 0.45;
  filter: blur(0.1px);
}

.lyric-line.past,
.lyric-line.near {
  opacity: 0.8;
  color: rgba(228, 228, 231, 0.7);
}

.lyric-line.far {
  opacity: 0.28;
}

.lyric-line.active {
  color: #f8fafc;
  font-size: 15px;
  font-weight: 700;
  opacity: 1;
  filter: none;
  text-shadow: 0 0 18px rgba(255, 255, 255, 0.08);
  transform: translateX(4px);
}

.lyric-empty {
  color: #a1a1aa;
  text-align: center;
  padding: 60px 20px;
}

.manual-tip {
  margin: 8px 0 16px;
  color: var(--muted);
  font-size: 14px;
}

.manual-form {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.manual-form button {
  grid-column: 1 / -1;
}

.log-output {
  margin: 0;
  min-height: 180px;
  max-height: 240px;
  overflow: auto;
  padding: 14px;
  border-radius: 18px;
  background: rgba(0, 0, 0, 0.28);
  color: #d4d4d8;
  white-space: pre-wrap;
  word-break: break-word;
  font-size: 13px;
  line-height: 1.5;
}

.empty-state {
  display: grid;
  place-items: center;
  min-height: 220px;
  color: var(--muted);
  border: 1px dashed rgba(255, 255, 255, 0.12);
  border-radius: 20px;
}

@keyframes spin {
  from {
    transform: rotate(0deg);
  }

  to {
    transform: rotate(360deg);
  }
}

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

  .hero {
    flex-direction: column;
  }
}

@media (max-width: 720px) {
  .app-shell {
    padding-left: 14px;
    padding-right: 14px;
  }

  .track-card {
    grid-template-columns: 48px 1fr;
  }

  .track-actions {
    grid-column: 1 / -1;
    justify-content: space-between;
  }

  .manual-form {
    grid-template-columns: 1fr;
  }

  .cover-frame {
    width: 128px;
    min-width: 128px;
    height: 128px;
  }

  .now-playing {
    flex-direction: column;
  }

  .search-form {
    display: flex;
    flex-wrap: wrap;
    width: 100%;
  }

  .toolbar {
    flex-wrap: wrap;
  }

  .toolbar > .quality-field {
    width: auto;
    flex: initial;
  }

  .search-field-wide {
    width: 100%;
  }

  .search-field-wide input {
    min-width: 100%;
  }
}
