:root {
  --bg-color: #121212;
  --text-primary: #ffffff;
  --text-secondary: #b3b3b3;
  --glass-bg: rgba(24, 24, 24, 0.8);
  --glass-border: rgba(255, 255, 255, 0.1);
  --accent-color: #619aa9; /* Bandcamp-ish Blue */
  --accent-hover: #4a7d8a;
  --card-bg: #181818;
  --font-family: 'Outfit', 'Noto Sans JP', sans-serif;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  background-color: var(--bg-color);
  color: var(--text-primary);
  font-family: var(--font-family);
  min-height: 100vh;
  overflow-x: hidden;
  position: relative;
}

/* Animated Background Shapes */
.bg-shape {
  position: fixed;
  border-radius: 50%;
  z-index: -1;
  opacity: 0.4;
  animation: float 25s infinite alternate ease-in-out;
  will-change: transform;
  pointer-events: none;
}

.shape1 {
  width: 600px; /* Increased size to compensate for lack of blur expansion */
  height: 600px;
  background: radial-gradient(circle, rgba(249,115,22,0.3) 0%, rgba(249,115,22,0) 80%);
  top: -100px;
  left: -100px;
  animation-delay: 0s;
}

.shape2 {
  width: 500px;
  height: 500px;
  background: radial-gradient(circle, rgba(236,72,153,0.2) 0%, rgba(236,72,153,0) 80%);
  bottom: -100px;
  right: -50px;
  animation-delay: -5s;
}

.shape3 {
  width: 700px;
  height: 700px;
  background: radial-gradient(circle, rgba(56,189,248,0.15) 0%, rgba(56,189,248,0) 80%);
  top: 40%;
  left: 30%;
  animation-delay: -10s;
}

@keyframes float {
  0% { transform: translate(0, 0) scale(1); }
  100% { transform: translate(50px, 50px) scale(1.1); }
}

.app-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* Header & Filters */
.glass-header {
  background: rgba(24, 24, 24, 0.85); /* Slightly more opaque to reduce backdrop dependency */
  backdrop-filter: blur(8px); /* Reduced blur for performance */
  -webkit-backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--glass-border);
  position: sticky;
  top: 0;
  z-index: 100;
  padding: 15px 0; /* Reduced padding for more viewport space */
  margin-bottom: 30px;
  border-radius: 0 0 16px 16px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
}

.header-content {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
}

.header-content h1 {
  font-size: 1.5rem;
  font-weight: 800;
  margin-bottom: 20px;
  color: var(--text-primary);
  letter-spacing: -0.04em;
}

.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 15px;
}

.search-box {
  position: relative;
  flex: 1 1 300px;
}

.search-box input {
  width: 100%;
  padding: 10px 16px 10px 40px;
  background: #202020;
  border: 1px solid var(--glass-border);
  border-radius: 8px;
  color: var(--text-primary);
  font-family: var(--font-family);
  font-size: 1rem;
  transition: all 0.3s ease;
}

.search-box input:focus {
  outline: none;
  border-color: var(--accent-color);
  box-shadow: 0 0 0 2px rgba(249, 115, 22, 0.2);
}

.search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-secondary);
}

.select-wrapper {
  position: relative;
  flex: 1 1 200px;
}

select {
  width: 100%;
  appearance: none;
  padding: 10px 36px 10px 16px;
  background: #202020;
  border: 1px solid var(--glass-border);
  border-radius: 8px;
  color: var(--text-primary);
  font-family: var(--font-family);
  font-size: 1rem;
  cursor: pointer;
  transition: all 0.3s ease;
}

select:focus {
  outline: none;
  border-color: var(--accent-color);
}

select option {
  background: var(--bg-color);
  color: var(--text-primary);
}

.select-wrapper::after {
  content: '▼';
  font-size: 0.8rem;
  position: absolute;
  right: 16px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-secondary);
  pointer-events: none;
}

.reset-btn {
  padding: 12px 24px;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid var(--glass-border);
  border-radius: 8px;
  color: var(--text-primary);
  font-weight: 500;
  cursor: pointer;
  transition: all 0.3s ease;
}

.reset-btn:hover {
  background: rgba(255, 255, 255, 0.2);
}

/* Main Content */
main {
  flex: 1;
}

#mainContent {
  padding-bottom: 50px;
}

.category-section {
  margin-bottom: 60px;
}

.category-title {
  font-size: 1.8rem;
  font-weight: 800;
  margin-bottom: 25px;
  color: var(--text-primary);
  border-left: 4px solid var(--accent-color);
  padding-left: 15px;
  letter-spacing: -0.02em;
}

.cd-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 40px 20px;
}

#mainContent:has(.song-view-container) {
  display: block;
}

/* View Header and Back Button */
.view-header {
  display: flex;
  align-items: center;
  gap: 20px;
  margin-bottom: 20px;
}

.back-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  background: transparent;
  border: 1px solid var(--glass-border);
  border-radius: 4px;
  color: var(--text-secondary);
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
}

.back-btn:hover {
  background: var(--glass-border);
  color: var(--text-primary);
}

.results-info {
  color: var(--text-secondary);
  font-size: 0.9rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* CD Item (Bandcamp Style Grid) */
.cd-item {
  cursor: pointer;
  transition: transform 0.2s ease;
  display: flex;
  flex-direction: column;
  will-change: transform;
}

.cd-item:hover {
  transform: translateY(-5px);
}

.cd-cover {
  width: 100%;
  aspect-ratio: 1 / 1;
  border-radius: 4px;
  overflow: hidden;
  box-shadow: 0 8px 25px rgba(0,0,0,0.5);
  background: #1a1a1a;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

.cd-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.5s ease;
}

.cd-item:hover .cd-cover img {
  transform: scale(1.05);
}

.cd-cover.no-cover {
  font-size: 4rem;
  color: #333;
}

.cd-info {
  padding: 4px 0;
}

.cd-title {
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--text-primary);
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* CD Detail View (Song List) */
.song-view-container {
  display: grid;
  grid-template-columns: minmax(250px, 350px) 1fr;
  gap: 40px;
  width: 100%;
  animation: fadeIn 0.5s ease;
}

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

.cover-column {
  position: sticky;
  top: 100px;
}

.large-cover {
  width: 100%;
  aspect-ratio: 1 / 1;
  border-radius: 8px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.7);
  object-fit: cover;
}

.large-cover.no-cover {
  background: #1a1a1a;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10rem;
}

.tracks-column {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.cd-detail-title {
  font-size: 2.5rem;
  font-weight: 800;
  margin-bottom: 5px;
  color: var(--text-primary);
  letter-spacing: -0.03em;
  line-height: 1.1;
}

.cd-detail-artist {
  font-size: 1.2rem;
  color: var(--text-secondary);
  margin-bottom: 30px;
}

.tracklist-header {
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-secondary);
  margin-bottom: 15px;
  border-bottom: 1px solid var(--glass-border);
  padding-bottom: 5px;
}

.track-item {
  display: grid;
  grid-template-columns: 24px 20px minmax(0, 1.5fr) minmax(0, 1fr) 40px;
  grid-template-areas: 
    "num play title meta link"
    ". . credits credits .";
  gap: 4px 15px;
  padding: 12px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  align-items: center;
}

.track-num {
  grid-area: num;
  font-size: 0.85rem;
  color: var(--text-secondary);
  opacity: 0.6;
}

.track-play {
  grid-area: play;
  color: var(--text-secondary);
  opacity: 0.3;
  display: flex;
  align-items: center;
}

.track-item:hover .track-play {
  opacity: 0.8;
  color: var(--accent-color);
}

.track-title-cell {
  grid-area: title;
  font-weight: 500;
  font-size: 1rem;
  color: var(--text-primary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.track-meta-cell {
  grid-area: meta;
  font-size: 0.85rem;
  color: var(--text-secondary);
  opacity: 0.7;
  text-align: right;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.track-link-cell {
  grid-area: link;
  display: flex;
  justify-content: flex-end;
}

.track-credits-row {
  grid-area: credits;
  font-size: 0.75rem;
  color: var(--text-secondary);
  opacity: 0.4;
  margin-top: -2px;
}

.track-link {
  color: var(--text-secondary);
  opacity: 0.5;
  transition: all 0.2s ease;
  padding: 5px;
}

.track-link:hover {
  color: var(--accent-color);
  opacity: 1;
}

.singer-name {
  opacity: 0.8;
}

/* Hide CD Select as it's redundant now */
.select-wrapper:has(#cdSelect) {
  display: none;
}

/* Responsive */
@media (max-width: 768px) {
  .header-content h1 {
    font-size: 1.5rem;
  }
  
  .filters {
    flex-direction: column;
  }
  
  .search-box, .select-wrapper, .reset-btn {
    width: 100%;
    flex: none;
  }

  .song-view-container {
    grid-template-columns: 1fr;
    gap: 30px;
  }

  .cover-column {
    position: static;
    max-width: 300px;
    margin: 0 auto;
  }

  .cd-detail-title {
    font-size: 1.6rem;
    text-align: center;
  }

  #mainContent:has(.song-view-container) {
    display: block;
  }

  .view-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }

  .track-item {
    grid-template-columns: 20px 20px 1fr auto;
    grid-template-areas: 
      "num play title link"
      ". . meta meta"
      ". . credits credits";
    gap: 2px 10px;
  }

  .track-meta-cell {
    text-align: left;
    font-size: 0.8rem;
  }
}