:root {
  --bg: #0f0f12;
  --card: #1a1a22;
  --border: #2a2a36;
  --text: #f2f2f4;
  --muted: #9a9aac;
  --accent: #7c6cf0;
  --radius: 12px;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: 'Source Sans 3', system-ui, sans-serif;
  line-height: 1.5;
}

.music-header {
  padding: 1.25rem 1.5rem 0.5rem;
  text-align: center;
  border-bottom: 1px solid var(--border);
}

.back-link {
  display: inline-block;
  margin-bottom: 0.75rem;
  color: var(--accent);
  text-decoration: none;
  font-size: 0.9rem;
}

.back-link:hover {
  text-decoration: underline;
}

.music-header h1 {
  margin: 0 0 0.5rem;
  font-size: clamp(1.35rem, 4vw, 1.85rem);
  font-weight: 700;
}

.music-hint {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
  max-width: 560px;
  margin-left: auto;
  margin-right: auto;
}

.music-main {
  max-width: 1100px;
  margin: 0 auto;
  padding: 1.5rem 1rem 3rem;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.music-search {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
  margin-bottom: 1.25rem;
  padding: 1rem;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.music-search input[type='search'] {
  flex: 1;
  min-width: 200px;
  padding: 0.55rem 0.85rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg);
  color: var(--text);
  font-size: 1rem;
  font-family: inherit;
}

.music-search input[type='search']:focus {
  outline: none;
  border-color: var(--accent);
}

.music-search button {
  padding: 0.55rem 1.1rem;
  font-size: 0.95rem;
  font-weight: 600;
  font-family: inherit;
  border-radius: 8px;
  cursor: pointer;
  border: none;
}

#music-search-btn {
  background: var(--accent);
  color: #fff;
}

#music-search-btn:hover {
  filter: brightness(1.08);
}

.btn-week-popular {
  background: #2d6a4f;
  color: #fff;
}

.btn-week-popular:hover {
  filter: brightness(1.1);
}

.btn-week-popular:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.btn-refresh-batch {
  background: #3d5a80;
  color: #fff;
}

.btn-refresh-batch:hover {
  filter: brightness(1.08);
}

.btn-refresh-batch:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.btn-back-recommend {
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--border) !important;
}

.btn-back-recommend:hover {
  color: var(--text);
  border-color: var(--accent) !important;
}

.music-section-title {
  margin: 0 0 1rem;
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--muted);
}

.search-empty {
  grid-column: 1 / -1;
  text-align: center;
  padding: 2rem 1rem;
  color: var(--muted);
  font-size: 1rem;
}

.music-grid {
  display: grid;
  gap: 1.25rem;
  grid-template-columns: 1fr;
}

@media (min-width: 640px) {
  .music-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (min-width: 960px) {
  .music-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

.music-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
  overflow: hidden;
}

.music-card h2 {
  margin: 0 0 0.75rem;
  font-size: 1rem;
  font-weight: 600;
}

.music-card .artist {
  color: var(--muted);
  font-weight: 400;
}

.music-card .player-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  background: #000;
  border-radius: 8px;
  overflow: hidden;
}

.music-card .player-wrap > div,
.music-card .player-wrap iframe {
  position: absolute;
  inset: 0;
  width: 100% !important;
  height: 100% !important;
}

.music-footer {
  padding: 1.5rem;
  text-align: center;
  color: var(--muted);
  font-size: 0.8rem;
  border-top: 1px solid var(--border);
}

.music-footer p {
  margin: 0 auto 1rem;
  max-width: 640px;
}

.music-footer code {
  font-size: 0.85em;
  padding: 0.15em 0.4em;
  background: var(--card);
  border-radius: 4px;
  border: 1px solid var(--border);
}

.btn-reset-prefs {
  padding: 0.45rem 1rem;
  font-size: 0.85rem;
  color: var(--muted);
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
  font-family: inherit;
}

.btn-reset-prefs:hover {
  color: var(--text);
  border-color: var(--accent);
}
