:root {
  color-scheme: dark;
  --bg: #101412;
  --panel: #171d1a;
  --panel-2: #202720;
  --text: #f2f7f0;
  --muted: #a7b4aa;
  --green: #1ed760;
  --lime: #c8f56d;
  --coral: #ff7a5c;
  --line: rgba(255, 255, 255, 0.1);
  --shadow: 0 24px 70px rgba(0, 0, 0, 0.35);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at 20% 10%, rgba(30, 215, 96, 0.2), transparent 28rem),
    linear-gradient(135deg, #101412 0%, #182218 48%, #101412 100%);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input,
select {
  font: inherit;
}

.shell {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 32px 0 48px;
}

.hero {
  position: relative;
  min-height: 300px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 28px;
  align-items: end;
  padding: 36px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background:
    linear-gradient(110deg, rgba(16, 20, 18, 0.92), rgba(16, 20, 18, 0.35)),
    url("https://images.unsplash.com/photo-1493225457124-a3eb161ffa5f?auto=format&fit=crop&w=1800&q=80") center/cover;
  box-shadow: var(--shadow);
}

.hero-topline {
  margin-bottom: 10px;
}

.language-picker {
  position: absolute;
  top: 36px;
  right: 36px;
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 170px;
  color: #d9e8dc;
  font-size: 0.76rem;
}

.language-picker select {
  min-height: 34px;
  padding: 0 30px 0 10px;
  border-color: rgba(255, 255, 255, 0.18);
  background-color: rgba(15, 21, 18, 0.82);
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--lime);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 12px;
  font-size: clamp(3.7rem, 12vw, 8.5rem);
  line-height: 0.88;
  letter-spacing: 0;
}

.lede {
  max-width: 620px;
  margin-bottom: 0;
  color: #d9e8dc;
  font-size: 1.1rem;
}

.hero-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(98px, 1fr));
  gap: 10px;
  min-width: min(100%, 410px);
}

.hero-stats div,
.spotlight,
.toolbar,
.spotify-connect,
.embed-player,
.playlist-builder,
.years-panel,
.ranking {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(23, 29, 26, 0.88);
  backdrop-filter: blur(16px);
}

.hero-stats div {
  padding: 18px;
}

.hero-stats span,
.spotlight-metrics span {
  display: block;
  font-size: 1.7rem;
  font-weight: 900;
}

small {
  color: var(--muted);
}

.toolbar {
  display: grid;
  grid-template-columns: 140px 170px minmax(180px, 1fr) 160px 130px auto;
  gap: 14px;
  align-items: end;
  margin: 18px 0;
  padding: 16px;
}

label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 700;
}

select,
input[type="search"] {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #0f1512;
  color: var(--text);
  padding: 0 12px;
}

.file-button {
  min-height: 42px;
  align-self: end;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid transparent;
  border-radius: 8px;
  background: var(--green);
  color: #07110a;
  padding: 0 16px;
  cursor: pointer;
  white-space: nowrap;
}

.file-button input {
  position: absolute;
  inline-size: 1px;
  block-size: 1px;
  opacity: 0;
  pointer-events: none;
}

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

.embed-player {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) minmax(300px, 520px);
  gap: 18px;
  align-items: center;
  margin-bottom: 18px;
  padding: 16px;
}

.embed-player[hidden] {
  display: none;
}

.playlist-builder[hidden],
.spotlight[hidden],
.spotify-connect[hidden],
.content[hidden] {
  display: none;
}

.embed-player p:last-child {
  margin-bottom: 0;
  color: var(--muted);
}

.embed-player iframe,
.spotify-embed-target {
  width: 100%;
  height: 80px;
  border: 0;
  border-radius: 8px;
  background: #0f1512;
}

.spotify-embed-target:empty {
  display: none;
}

.playlist-builder {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) minmax(420px, auto);
  gap: 18px;
  align-items: center;
  margin-bottom: 18px;
  padding: 16px;
  background: linear-gradient(135deg, rgba(30, 215, 96, 0.1), rgba(23, 29, 26, 0.88));
}

.playlist-builder p:last-child {
  margin-bottom: 0;
  color: var(--muted);
}

.playlist-preview {
  margin-top: 10px;
  color: var(--text) !important;
  font-weight: 850;
}

.playlist-controls {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) 160px 150px auto auto;
  gap: 12px;
  align-items: end;
}

.manual-tools {
  display: flex;
  gap: 8px;
  align-items: end;
}

.manual-tools[hidden] {
  display: none;
}

input[type="text"] {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #0f1512;
  color: var(--text);
  padding: 0 12px;
}

.spotify-connect p:last-child {
  margin-bottom: 0;
  color: var(--muted);
}

.player-actions {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-shrink: 0;
}

.primary-action,
.secondary-action,
.icon-action {
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  cursor: pointer;
}

.primary-action {
  background: var(--green);
  color: #07110a;
  padding: 0 16px;
  font-weight: 900;
}

.secondary-action {
  background: #0f1512;
  color: var(--text);
  padding: 0 14px;
  font-weight: 850;
}

.icon-action {
  display: grid;
  place-items: center;
  width: 42px;
  background: #0f1512;
  color: var(--text);
}

.icon-action svg {
  width: 18px;
  height: 18px;
  fill: currentColor;
}

.icon-action:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.secondary-action:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.spotlight {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  align-items: end;
  margin-bottom: 18px;
  padding: 24px;
  background: linear-gradient(135deg, rgba(30, 215, 96, 0.18), rgba(255, 122, 92, 0.12)), var(--panel);
}

.spotlight h2 {
  margin-bottom: 6px;
  font-size: clamp(1.8rem, 4vw, 3.2rem);
}

.spotlight p {
  margin-bottom: 0;
  color: var(--muted);
}

.spotlight-metrics {
  text-align: right;
}

.content {
  display: grid;
  grid-template-columns: 230px minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}

.years-panel,
.ranking {
  padding: 18px;
}

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

.year-buttons {
  display: grid;
  gap: 8px;
}

.year-buttons button {
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: transparent;
  color: var(--text);
  cursor: pointer;
  text-align: left;
  padding: 0 12px;
}

.year-buttons button.active {
  border-color: rgba(30, 215, 96, 0.75);
  background: rgba(30, 215, 96, 0.16);
}

.ranking-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
}

.ranking-tools {
  display: flex;
  gap: 12px;
  align-items: center;
}

.skip-filter {
  display: flex;
  gap: 8px;
  align-items: center;
  min-width: 0;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 850;
}

.ranking-view .skip-filter {
  display: none;
}

.skip-filter select {
  width: auto;
  min-width: 122px;
  min-height: 34px;
  padding: 0 10px;
  border-color: rgba(30, 215, 96, 0.32);
  background: rgba(15, 21, 18, 0.9);
  font-size: 0.82rem;
}

.ranking-head p {
  margin-bottom: 0;
  color: var(--muted);
}

.track-list {
  display: grid;
  gap: 10px;
}

.track-row {
  display: grid;
  grid-template-columns: 52px minmax(0, 1fr) 180px;
  gap: 14px;
  align-items: center;
  min-height: 72px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-2);
}

.history-row {
  display: grid;
  grid-template-columns: 96px minmax(0, 1fr) 120px;
  gap: 14px;
  align-items: center;
  min-height: 70px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-2);
}

.history-row time {
  display: grid;
  gap: 2px;
  color: var(--lime);
  font-weight: 900;
  white-space: nowrap;
}

.history-row time strong {
  color: var(--text);
  font-size: 1.05rem;
}

.history-meta {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 800;
}

.history-month {
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background: rgba(15, 21, 18, 0.6);
}

.history-month summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  min-height: 54px;
  padding: 0 16px;
  color: var(--lime);
  cursor: pointer;
  font-weight: 950;
  list-style: none;
  text-transform: uppercase;
}

.history-month summary::-webkit-details-marker {
  display: none;
}

.history-month summary::before {
  content: "+";
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--text);
}

.history-month[open] summary::before {
  content: "-";
}

.history-month summary span {
  flex: 1;
}

.history-month-list {
  display: grid;
  gap: 8px;
  padding: 0 10px 10px;
}

.skip-pill {
  display: inline-flex;
  min-height: 24px;
  align-items: center;
  border: 1px solid rgba(255, 122, 92, 0.55);
  border-radius: 999px;
  padding: 0 8px;
  color: #ffd4c9;
  background: rgba(255, 122, 92, 0.12);
}

.rank-cell {
  display: grid;
  gap: 7px;
  justify-items: center;
}

.select-track {
  display: none;
  place-items: center;
  width: 34px;
  height: 28px;
  cursor: pointer;
}

.manual-selecting .select-track {
  display: grid;
}

.select-track input {
  position: absolute;
  inline-size: 1px;
  block-size: 1px;
  opacity: 0;
}

.select-track span {
  width: 22px;
  height: 22px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #0f1512;
}

.select-track input:checked + span {
  border-color: var(--green);
  background: var(--green);
  box-shadow: inset 0 0 0 4px #0f1512;
}

.select-track input:disabled + span {
  opacity: 0.35;
}

.rank {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 999px;
  background: #0e1511;
  color: var(--lime);
  font-weight: 900;
}

.track-title {
  margin: 0 0 5px;
  overflow-wrap: anywhere;
  font-weight: 850;
}

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

.track-links {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 10px;
}

.icon-link {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #0f1512;
  text-decoration: none;
  transition: transform 160ms ease, border-color 160ms ease, background 160ms ease;
}

.icon-link.play-button {
  color: inherit;
  cursor: pointer;
}

.icon-link:hover {
  border-color: rgba(30, 215, 96, 0.8);
  background: #151d18;
  transform: translateY(-1px);
}

.icon-link svg {
  width: 19px;
  height: 19px;
  display: block;
}

.track-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 10px;
}

.track-badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0 9px;
  color: var(--text);
  font-size: 0.72rem;
  font-weight: 850;
}

.track-badge.liked {
  border-color: rgba(30, 215, 96, 0.5);
  background: rgba(30, 215, 96, 0.15);
  color: var(--lime);
}

.track-badge.playlist {
  border-color: rgba(255, 122, 92, 0.55);
  background: rgba(255, 122, 92, 0.12);
}

.track-badge.muted {
  color: var(--muted);
}

.bar-wrap {
  display: grid;
  gap: 8px;
}

.bar-meta {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  color: var(--muted);
  font-size: 0.82rem;
}

.bar {
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: #0f1512;
}

.bar span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--green), var(--coral));
}

.empty {
  padding: 26px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  color: var(--muted);
  text-align: center;
}

.seo-content {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin-top: 18px;
}

.seo-content article {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(23, 29, 26, 0.72);
  padding: 18px;
}

.seo-content h2 {
  margin-bottom: 8px;
  font-size: 1rem;
}

.seo-content p,
.site-disclaimer,
.site-credit {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.55;
}

.seo-content a {
  color: var(--lime);
  font-weight: 800;
  text-decoration: none;
}

.seo-content a.neutral-link {
  color: inherit;
  font-weight: inherit;
}

.seo-content a:hover {
  text-decoration: underline;
}

.site-disclaimer,
.site-credit {
  margin-top: 14px;
  text-align: center;
}

.site-credit {
  margin-top: 8px;
}

.site-credit a {
  color: inherit;
  font-weight: inherit;
  text-decoration: none;
}

.site-credit a:hover {
  text-decoration: underline;
}

@media (max-width: 860px) {
  .hero,
  .content,
  .toolbar,
  .seo-content {
    grid-template-columns: 1fr;
  }

  .hero {
    padding: 28px;
  }

  .hero-topline {
    padding-top: 48px;
  }

  .language-picker {
    top: 28px;
    right: 28px;
    width: 100%;
    max-width: 220px;
  }

  .hero-stats {
    width: 100%;
  }

  .spotlight,
  .spotify-connect,
  .embed-player,
  .playlist-builder,
  .ranking-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .playlist-builder {
    grid-template-columns: 1fr;
  }

  .embed-player {
    grid-template-columns: 1fr;
  }

  .playlist-controls {
    width: 100%;
    grid-template-columns: 1fr 1fr;
  }

  .playlist-controls label:first-child,
  .manual-tools {
    grid-column: 1 / -1;
  }

  .spotlight-metrics {
    text-align: left;
  }
}

@media (max-width: 560px) {
  .shell {
    width: min(100% - 20px, 1180px);
    padding-top: 10px;
  }

  .hero-stats,
  .track-row,
  .history-row {
    grid-template-columns: 1fr;
  }

  .track-row,
  .history-row {
    gap: 10px;
  }

  .history-meta {
    justify-content: flex-start;
  }
}
