:root {
  --font-mono: "Fira Code", monospace;
  --transition-fast: 150ms ease;
}

/* Base layout using design tokens */
.container {
  padding-top: var(--sp-4xl);
  padding-bottom: var(--sp-4xl);
}

.background-glow {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 80vw;
  height: 80vw;
  z-index: -1;
  filter: blur(80px);
  pointer-events: none;
  opacity: 0.4;
}

header {
  margin-bottom: var(--sp-xl);
}

.header-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--sp-sm);
  margin-bottom: var(--sp-xs);
}

.logo {
  flex: 1;
  min-width: 100%;
}

@media (min-width: 800px) {
  .logo {
    flex: initial;
    min-width: auto;
  }
}

.logo h1 {
  color: var(--accent);
  margin: 0;
  font-size: var(--fs-xl);
}

.count-badge {
  flex-shrink: 0;
  background: var(--bg-alt);
  color: var(--accent);
  font-size: var(--fs-xs);
  padding: 0.125rem 0.5rem;
  border-radius: var(--radius-full);
  margin-left: var(--sp-xs);
  font-family: var(--font-mono);
}

.status-banner-wrapper {
  flex: 1;
  display: flex;
}

@media (min-width: 800px) {
  .status-banner-wrapper {
    justify-content: flex-end;
    height: 4rem;
  }
}

.status-banner {
  padding: 0.625rem 0.875rem;
  min-width: 15rem;
  max-width: 20rem;
  cursor: pointer;
}

/* Navigation */
.app-main-nav {
  display: flex;
  gap: var(--sp-xl);
  margin-top: var(--sp-lg);
}

.nav-link {
  color: var(--text-muted);
  text-decoration: none;
  font-weight: 700;
  font-size: var(--fs-sm);
}

@media (min-width: 800px) {
  .nav-link {
    font-size: var(--fs-md);
  }
}

.nav-link:hover,
.nav-link.active {
  color: var(--accent);
}

.page-view {
  display: none;
}

.page-view.active {
  display: block;
}

.view-meta {
  margin-bottom: var(--sp-lg);
  color: var(--text-muted);
  font-size: var(--fs-sm);
}

/* Now Playing Widget */
.now-playing-content {
  display: flex;
  align-items: center;
  gap: var(--sp-md);
}

.now-playing-cover-wrapper {
  position: relative;
  width: 2.625rem;
  height: 2.625rem;
  flex-shrink: 0;
  border-radius: var(--radius-sm);
  overflow: hidden;
}

#now-playing-cover {
  width: 100%;
  aspect-ratio: 1/1;
  object-fit: cover;
}

.now-playing-info {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  justify-content: center;
}

.track-name {
  font-weight: 700;
  font-size: 0.8125rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--text);
  margin-bottom: 0.125rem;
}

.artist-name {
  font-size: 0.6875rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-weight: 500;
}

/* Controls & Filters */
.controls-section {
  margin-bottom: var(--sp-lg);
}

.filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-md);
  align-items: flex-end;
}

.filter-group {
  display: flex;
  flex-direction: column;
  gap: var(--sp-xs);
  width: 100%;
}

@media (min-width: 800px) {
  .filter-group {
    width: auto;
  }
}

.filter-group label {
  font-size: var(--fs-xs);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--accent);
  font-weight: bold;
}

.filter-group select,
.filter-group input {
  background: var(--bg-alt);
  border: none;
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius);
  color: var(--text);
  outline: none;
  cursor: pointer;
}

.search-container input {
  cursor: text;
}

/* Universal Grids & Cards */
.list-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(11rem, 1fr));
  gap: var(--sp-lg);
}

@media (min-width: 800px) {
  .albums-grid, 
  .history-grid,
  .list-grid {
    grid-template-columns: repeat(auto-fill, minmax(13rem, 1fr));
  }
}

.album-card, .playlist-card {
  background: var(--bg);
  padding: 0;
  cursor: pointer;
}

.album-cover, .playlist-cover {
  aspect-ratio: 1/1;
  width: 100%;
  overflow: hidden;
}

.album-cover img, .playlist-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 5px;
}

.album-info, .playlist-info {
  padding: var(--sp-md);
}

.album-name, .playlist-name {
  margin: 0;
  font-size: var(--fs-md);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-weight: 700;
}

.album-artist, .playlist-artist {
  margin: 0.25rem 0 0 0;
  font-size: var(--fs-sm);
  color: var(--text);
}

/* History and Meta specifics */
.album-meta-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 0.5rem;
}

.album-year {
  font-size: var(--fs-xs);
  color: var(--text-muted);
}

.genre-toggle {
  font-size: var(--fs-xs);
  color: var(--accent);
  text-decoration: none;
  border: 0;
}

.genre-list {
  display: none;
  padding-top: 1rem;
  text-align: right;
  font-size: var(--fs-xs);
  color: var(--text-muted);
}

.genre-list.is-visible {
  display: block;
}

/* Track list (Legacy/Minority use) */
.tracklist {
  display: flex;
  flex-direction: column;
  gap: var(--sp-md);
}

.track-item {
  display: flex;
  align-items: center;
  gap: var(--sp-md);
}

.track-thumb {
  width: 2.5rem;
  height: 2.5rem;
  object-fit: cover;
  border-radius: var(--radius-sm);
}

/* Buttons */
.text-btn {
  background: none;
  border: none;
  color: var(--accent);
  cursor: pointer;
  padding: 0;
  font-weight: 700;
  margin-bottom: var(--sp-xl);
}

.footer-btn {
  background: var(--bg-alt);
  color: var(--accent);
  border: none;
  padding: 0.75rem 1.5rem;
  border-radius: var(--radius);
  font-weight: bold;
  cursor: pointer;
}

.footer-btn:hover {
  background: var(--accent);
  color: var(--bg);
}

.footer-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.sync-footer, .load-more-container {
  margin-top: var(--sp-4xl);
  padding: var(--sp-2xl) 0;
  display: flex;
  justify-content: center;
}

/* Shared Utilities */
.empty-state {
  grid-column: 1 / -1;
  padding: var(--sp-4xl) 0;
  text-align: center;
  color: var(--text-muted);
}

.sync-message {
  position: absolute;
  top: 2rem;
  right: 2rem;
  margin-top: 1rem;
  font-size: 0.8125rem;
}