*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  touch-action: pan-x pan-y;
}

@media (hover: none) {
  *:focus { outline: none; }
}

:root {
  --bg:           #ffffff;
  --bg-header:    rgba(255,255,255,0.85);
  --border:       #e5e5e5;
  --text:         #1d1d1f;
  --text-muted:   #6e6e73;
  --card-bg:      #f0f0f0;
  --input-bg:     #f5f5f7;
  --skeleton-a:   #f2f2f2;
  --skeleton-b:   #e8e8e8;
  --shadow:       rgba(0,0,0,0.14);
  --chip-active-bg: #1d1d1f;
  --chip-active-text: #ffffff;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg:           #0a0a0a;
    --bg-header:    rgba(10,10,10,0.85);
    --border:       #1f1f1f;
    --text:         #f0f0f0;
    --text-muted:   #6e6e73;
    --card-bg:      #1c1c1e;
    --input-bg:     #1c1c1e;
    --skeleton-a:   #1c1c1e;
    --skeleton-b:   #2c2c2e;
    --shadow:       rgba(0,0,0,0.5);
    --chip-active-bg: #f0f0f0;
    --chip-active-text: #0a0a0a;
  }
}

html {
  overflow-x: clip;
}

body {
  touch-action: pan-x pan-y;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  overflow-x: clip;
}

/* Header */
header {
  padding: 0 40px;
  height: 52px;
  border-bottom: 1px solid rgba(0, 0, 0, 0.08);
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  background: var(--bg-header);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  z-index: 10;
}

@media (prefers-color-scheme: dark) {
  header { border-bottom-color: rgba(255, 255, 255, 0.08); }
}

.header-top {
  display: contents;
}

header .name {
  font-size: 20px;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: inherit;
  text-decoration: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
}

.name-short { display: none; }

.name-info {
  position: relative;
  width: 14px;
  min-width: 14px;
  height: 14px;
  min-height: 14px;
  border-radius: 50%;
  border: 1.5px solid var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 9px;
  font-weight: 600;
  line-height: 1;
  color: var(--text-muted);
  opacity: 0.5;
  transition: opacity 0.15s;
  flex-shrink: 0;
  cursor: pointer;
  margin-left: 10px;
  align-self: center;
}

.name-info::before {
  content: '';
  position: absolute;
  inset: -10px;
}

@media (hover: hover) { .name-info:hover { opacity: 0.8; } }

.name-info--mobile { display: none; }

header .count {
  font-size: 13px;
  color: var(--text-muted);
}

.site-nav {
  display: flex;
  gap: 0;
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  height: 100%;
  align-items: stretch;
}

.nav-link {
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
  opacity: 0.45;
  text-decoration: none;
  padding: 0 14px;
  display: flex;
  align-items: center;
  border-bottom: 1px solid transparent;
  transition: opacity 0.15s;
}

@media (hover: hover) { .nav-link:hover { opacity: 0.7; } }

.nav-link--active { opacity: 1; border-bottom-color: var(--text); }

@media (prefers-color-scheme: dark) {
  .nav-link--active { opacity: 1; border-bottom-color: var(--text); }
}

.nav-count { display: none; }

/* Hero */
.hero {
  padding: 48px 40px 48px;
}

.hero h1 {
  font-size: clamp(1.1rem, 3.3vw, 2.3rem);
  font-weight: 700;
  letter-spacing: -0.04em;
  line-height: 1.1;
  margin-bottom: 16px;
  overflow-wrap: break-word;
}

.hero p {
  font-size: 1.05rem;
  color: var(--text-muted);
  line-height: 1.65;
  text-wrap: balance;
}

/* Controls */
.controls {
  padding: 0 40px 28px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.controls-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* Search */
.search-wrap {
  position: relative;
  flex: 1;
}

.search-wrap > svg {
  position: absolute;
  left: 11px;
  top: 50%;
  transform: translateY(-50%);
  width: 14px;
  height: 14px;
  fill: none;
  stroke: var(--text-muted);
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  pointer-events: none;
}

.search {
  width: 100%;
  padding: 9px 56px 9px 32px;
  background: var(--input-bg);
  border: none;
  border-radius: 8px;
  font-size: 13px;
  color: var(--text);
  font-family: inherit;
  outline: none;
}

.search::placeholder { color: var(--text-muted); }

/* Search filter dropdown */
.search-filter-btn {
  position: absolute;
  right: 0;
  top: 0;
  bottom: 0;
  width: 34px;
  border-radius: 0 8px 8px 0;
  border: none;
  border-left: 1px solid rgba(128, 128, 128, 0.1);
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  z-index: 1;
  transition: background 0.15s, color 0.15s;
  font-size: 14px;
  font-weight: 600;
  font-family: ui-monospace, SFMono-Regular, monospace;
}

@media (hover: hover) { .search-filter-btn:hover { background: var(--card-bg); color: var(--text); } }
.search-filter-btn.active { background: var(--card-bg); color: var(--text); }

.search-filter-menu {
  display: none;
  position: absolute;
  right: 0;
  top: calc(100% + 4px);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: 0 8px 24px var(--shadow);
  z-index: 20;
  min-width: 180px;
  padding: 4px;
  flex-direction: column;
}

.search-filter-menu.open { display: flex; }

.search-filter-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border: none;
  background: none;
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px;
  font-family: inherit;
  color: var(--text);
  text-align: left;
  width: 100%;
  transition: background 0.12s;
}

@media (hover: hover) { .search-filter-item:hover { background: var(--card-bg); } }

.search-filter-item-label { flex: 1; }

.search-filter-item-hint {
  font-size: 11px;
  color: var(--text-muted);
  font-family: ui-monospace, SFMono-Regular, monospace;
}

.search-clear {
  display: none;
  position: absolute;
  right: 42px;
  top: 50%;
  transform: translateY(-50%);
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: none;
  background: var(--text-muted);
  color: var(--input-bg);
  cursor: pointer;
  padding: 0;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  line-height: 1;
  opacity: 0.5;
}

.search-clear.visible { display: flex; }
.search::-webkit-search-cancel-button { display: none; -webkit-appearance: none; }

/* Sort */
.sort-wrap {
  position: relative;
  flex-shrink: 0;
}

.sort-wrap svg {
  position: absolute;
  right: 9px;
  top: 50%;
  transform: translateY(-50%);
  width: 12px;
  height: 12px;
  fill: var(--text-muted);
  pointer-events: none;
}

.sort {
  appearance: none;
  -webkit-appearance: none;
  padding: 9px 28px 9px 12px;
  background: var(--input-bg);
  border: none;
  border-radius: 8px;
  font-size: 13px;
  color: var(--text);
  font-family: inherit;
  cursor: pointer;
  outline: none;
}

/* Empty state */
.empty {
  grid-column: 1 / -1;
  padding: 48px 0;
  text-align: center;
  color: var(--text-muted);
  font-size: 14px;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

/* About button */
.about-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  background: none;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 4px 10px;
  height: 30px;
  cursor: pointer;
  color: var(--text-muted);
  transition: color 0.15s, border-color 0.15s;
  flex-shrink: 0;
  font-family: inherit;
}

@media (hover: hover) { .about-btn:hover { color: var(--text); } }

.about-btn-label {
  font-size: 11px;
  display: none;
}


/* Stats toggle */
.stats-toggle {
  display: flex;
  align-items: center;
  gap: 6px;
  background: none;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 4px 10px;
  height: 30px;
  cursor: pointer;
  color: var(--text-muted);
  transition: color 0.15s, border-color 0.15s;
  flex-shrink: 0;
  font-family: inherit;
}

.stats-toggle .count {
  font-size: 11px;
  position: static;
  transform: none;
}

.stats-toggle svg { display: none; }

@media (hover: hover) { .stats-toggle:hover { color: var(--text); } }

/* Stats modal */
.stats-modal { max-width: 720px; }

.stats-modal-body {
  padding: 0;
  overflow-y: auto;
  max-height: calc(85dvh - 50px);
}

.stats-modal .stats-section {
  display: flex;
  flex-direction: column;
  padding: 28px 24px;
}
.stats-modal .stats-grid {
  position: relative;
}
.stats-modal .stats-grid::after {
  display: none;
}
/* Horizontal divider — sits between row 1 and row 2 */
.stats-modal .stats-section:nth-child(-n+2) {
  border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}
@media (prefers-color-scheme: dark) {
  .stats-modal .stats-section:nth-child(-n+2) { border-bottom-color: rgba(255, 255, 255, 0.1); }
}
.stats-modal .vbar-chart { flex: 1; height: auto; min-height: 72px; gap: 4px; }
.stats-modal .vbar-bar { max-width: 14px; border-radius: 2px 2px 1px 1px; }
.stats-modal .vbar-labels { gap: 4px; }
.stats-modal .hbar-track { height: 5px; border-radius: 3px; }
.stats-modal .hbar-fill { border-radius: 3px; }
.stats-modal .hbar-chart { gap: 10px 30px; margin-left: -10px; }
.stats-modal .country-list { gap: 10px 30px; margin-left: -10px; }

@media (max-width: 500px) {
  .country-list {
    display: flex !important;
    flex-direction: column;
    gap: 8px;
  }
  .country-list::after { display: none; }
  .stats-numbers {
    grid-template-columns: 1fr 1fr;
  }
}

.stats-section-full {
  grid-column: 1 / -1;
  border-top: 1px solid rgba(0, 0, 0, 0.05);
  position: relative;
  z-index: 1;
}
@media (prefers-color-scheme: dark) {
  .stats-section-full { border-top-color: rgba(255, 255, 255, 0.1); }
}

/* Country-of-origin world map */
.country-map {
  --cmap-land:   #e4e4e7;
  --cmap-stroke: #f7f7f8;
  --cmap-accent: #1e8a38;
  position: relative;
  margin: 2px 0 18px;
}
@media (prefers-color-scheme: dark) {
  .country-map {
    --cmap-land:   #303035;
    --cmap-stroke: #1c1c20;
    --cmap-accent: #26a344;
  }
}
.country-map-svg {
  display: block;
  width: 100%;
  height: auto;
  overflow: hidden;
}
.cmap-country {
  fill: var(--cmap-land);
  stroke: var(--cmap-stroke);
  stroke-width: 0.4;
  vector-effect: non-scaling-stroke;
}
.cmap-on {
  fill: color-mix(in srgb, var(--cmap-accent) calc(var(--t) * 80% + 20%), var(--cmap-land));
  transition: fill 0.12s ease;
}
@media (hover: hover) {
  .cmap-on { cursor: default; }
  .cmap-on:hover { fill: var(--cmap-accent); }
}
.country-map-tip {
  position: absolute;
  transform: translate(-50%, calc(-100% - 8px));
  pointer-events: none;
  background: var(--modal-header-bg, #1c1c20);
  color: var(--text, #f0f0f0);
  border: 1px solid var(--border, rgba(128,128,128,0.2));
  border-radius: 6px;
  padding: 4px 8px;
  font-size: 11px;
  white-space: nowrap;
  z-index: 5;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.25);
}
.country-map-tip[hidden] { display: none; }

/* Country list (two-column) */
.country-list {
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-auto-flow: column;
  gap: 8px 20px;
  position: relative;
}

.country-list::after {
  content: '';
  position: absolute;
  left: 50%;
  top: 0;
  bottom: 0;
  width: 1px;
  background: rgba(128, 128, 128, 0.15);
}

.country-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.country-row .country-name {
  flex: 1;
}

.country-row .country-flag {
  width: 16px;
  height: 16px;
}

.country-row .country-pct {
  opacity: 0.5;
  font-weight: 400;
  font-size: 11px;
  width: 30px;
  text-align: right;
}

/* Country pie chart */
.country-chart {
  display: flex;
  align-items: flex-start;
  gap: 24px;
}
.country-pie-wrap {
  flex-shrink: 0;
  width: 130px;
}
.country-pie {
  width: 100%;
  height: auto;
  display: block;
}
.country-legend {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 5px;
  min-width: 0;
}
.country-legend-item {
  display: flex;
  align-items: center;
  gap: 8px;
}
.country-legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}
.country-flag {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}
.country-name {
  font-size: 12px;
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.country-count {
  font-size: 11px;
  color: var(--text-muted);
  width: 24px;
  flex-shrink: 0;
  text-align: right;
}
.country-pct {
  font-size: 10px;
  color: var(--text-muted);
  opacity: 0.6;
  width: 32px;
  flex-shrink: 0;
  text-align: right;
}

.year-dist { overflow: hidden; }
.year-dist-bars {
  display: flex;
  align-items: flex-end;
  height: 80px;
  gap: 1px;
}
.year-dist-col {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: flex-end;
  height: 100%;
}
.year-dist-bar {
  width: 100%;
  background: var(--bar-color, #5e8cc7);
  border-radius: 1px 1px 0 0;
  transition: opacity 0.15s;
}
@media (hover: hover) { .year-dist-col:hover .year-dist-bar { opacity: 0.7; } }
.year-dist-col.active .year-dist-bar { opacity: 1; filter: brightness(1.2); }
.year-dist-detail {
  font-weight: 400;
  font-size: 11px;
  color: var(--text-muted);
}
.year-dist-divider {
  border-left: 1px solid rgba(0, 0, 0, 0.1);
}
.year-dist-divider-mid {
  border-left: 1px dashed rgba(0, 0, 0, 0.06);
}
@media (prefers-color-scheme: dark) {
  .year-dist-divider { border-left-color: rgba(255, 255, 255, 0.12); }
  .year-dist-divider-mid { border-left-color: rgba(255, 255, 255, 0.08); }
}
.year-dist-labels {
  position: relative;
  height: 14px;
  margin-top: 4px;
}
.year-dist-labels span {
  position: absolute;
  font-size: 9px;
  color: var(--text-muted);
  transform: translateX(-50%);
  white-space: nowrap;
}

.stats-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0;
  align-items: stretch;
}

.stats-section-title {
  font-size: 11px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin-bottom: 14px;
}

/* Vertical bar chart (decades, added over time) */
.vbar-chart {
  display: flex;
  align-items: flex-end;
  gap: 6px;
  height: 100px;
}

.vbar-col {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  height: 100%;
  justify-content: flex-end;
}

.vbar-count {
  font-size: 9px;
  color: var(--text-muted);
  margin-bottom: 3px;
}

.vbar-bar {
  width: 100%;
  border-radius: 3px 3px 1px 1px;
  min-height: 2px;
  background: var(--bar-color, #007aff);
}

.vbar-labels {
  display: flex;
  gap: 6px;
  margin-top: 6px;
}

.vbar-labels span {
  flex: 1;
  text-align: center;
  font-size: 10px;
  color: var(--text-muted);
}

/* Horizontal bar chart */
.hbar-chart {
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-rows: repeat(5, auto);
  grid-auto-flow: column;
  gap: 8px 20px;
  position: relative;
}

.hbar-chart::after {
  content: '';
  position: absolute;
  left: calc(50% + 10px);
  top: 0;
  bottom: 0;
  width: 1px;
  background: rgba(128, 128, 128, 0.15);
}

.hbar-rank {
  font-size: 11px;
  font-weight: 500;
  color: var(--text-muted);
  opacity: 0.5;
  width: 18px;
  text-align: right;
  flex-shrink: 0;
  font-variant-numeric: tabular-nums;
}

.hbar-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.hbar-label {
  font-size: 12px;
  width: 90px;
  text-align: left;
  flex-shrink: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.hbar-track {
  flex: 1;
  height: 8px;
  background: transparent;
  border-radius: 4px;
  overflow: hidden;
}

.hbar-fill {
  height: 100%;
  background: var(--bar-color, #007aff);
  border-radius: 4px;
  transition: width 0.3s ease;
}

.hbar-count {
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
  width: 30px;
  flex-shrink: 0;
  text-align: right;
}

/* Quick numbers */
.stats-numbers {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 16px;
}

.stat-number {
  text-align: left;
}

.stat-number .stat-value {
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.1;
}

.stat-number .stat-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  margin-top: 5px;
}

@media (max-width: 500px) {
  .stats-modal .stats-grid::after { display: none; }
  .stats-modal .stats-grid::before { display: none; }
  .stats-modal .stats-section {
    padding-bottom: 24px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
  }
  .stats-modal .stats-section:last-child {
    border-bottom: none;
  }
  .stats-section-full {
    border-top: none;
  }
  .stats-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 500px) and (prefers-color-scheme: dark) {
  .stats-modal .stats-section {
    border-bottom-color: rgba(255, 255, 255, 0.1);
  }
}
@media (max-width: 500px) {
  .country-chart {
    flex-direction: column;
    align-items: center;
  }
  .country-pie-wrap {
    width: 150px;
  }
  .country-legend {
    width: 100%;
  }
}

@media (max-width: 500px) {
  .controls-row {
    flex-wrap: wrap;
  }
  .search-wrap {
    flex: unset;
    width: 100%;
  }
  .sort-wrap {
    flex: 1;
  }
  .sort {
    width: 100%;
  }
}

/* View toggle */
.view-toggle {
  display: flex;
  border-radius: 8px;
  overflow: hidden;
  background: var(--input-bg);
  flex-shrink: 0;
}

.view-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border: none;
  background: transparent;
  cursor: pointer;
  color: var(--text-muted);
  transition: background 0.15s, color 0.15s;
}

.view-btn.active {
  background: var(--chip-active-bg);
  color: var(--chip-active-text);
}

/* List table */
.list-table {
  width: 100%;
  border-collapse: collapse;
  padding: 0;
}

.list-table th {
  text-align: left;
  font-size: 11px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  padding: 0 12px 8px;
  border-bottom: 1px solid var(--border);
}

.list-table th:last-child {
  text-align: right;
}

.list-table td {
  padding: 10px 12px;
  vertical-align: middle;
  border-bottom: 1px solid var(--border);
}

.list-table td:first-child {
  width: 40px;
}

.list-table tbody tr {
  cursor: pointer;
  transition: background 0.12s;
}

@media (hover: hover) {
  .list-table tbody tr:hover {
    background: var(--card-bg);
  }
}

.list-table .list-art {
  width: 40px;
  height: 40px;
  border-radius: 4px;
  overflow: hidden;
  background: var(--card-bg);
  flex-shrink: 0;
}

.list-table .list-art img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.list-table .list-artist {
  font-weight: 600;
  font-size: 14px;
  text-wrap: balance;
}

.list-table .list-album {
  font-size: 14px;
  color: var(--text-muted);
  text-wrap: balance;
}

.list-table .list-genre,
.list-table .list-year,
.list-table .list-added {
  font-size: 14px;
  color: var(--text-muted);
}

.list-table .list-year,
.list-table .list-added {
  text-align: right;
}

.list-table .list-added,
.list-table th.col-added {
  width: 120px;
  white-space: nowrap;
}

.list-album-year {
  display: none;
  color: var(--text-muted);
}


.list-wrap {
  padding: 4px 0 80px;
  max-width: 1200px;
  margin: 0 auto;
}

@media (max-width: 600px) {
  .list-wrap { padding: 4px 0 40px; }
  .list-table .col-genre,
  .list-table .col-year,
  .list-table .col-added { display: none; }
  .list-album-year { display: inline; }
  .list-table .list-artist,
  .list-table .list-album { width: 50%; }
  .list-table th.col-genre,
  .list-table th.col-year,
  .list-table th.col-added { display: none; }
  .list-table td { padding: 8px 8px; }
  .list-table .list-art { width: 36px; height: 36px; }
}

/* Grid — mobile first */
.grid {
  padding: 4px 16px 60px;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px 12px;
}

@media (min-width: 600px) {
  .grid {
    padding: 4px 40px 80px;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 28px 20px;
  }
}

/* Card */
.card {
  cursor: pointer;
  min-width: 0;
}

.card-art {
  width: 100%;
  aspect-ratio: 1;
  border-radius: 10px;
  overflow: hidden;
  margin-bottom: 10px;
  background: var(--card-bg);
  transition: transform 0.25s ease, box-shadow 0.25s ease;
  will-change: transform;
}

@media (hover: hover) {
  .card:hover .card-art {
    transform: scale(1.04);
    box-shadow: 0 12px 32px var(--shadow);
  }
}

.card-art img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.card-art img.loaded { opacity: 1; }

.card-title {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.4;
}

.fav-star {
  color: #c9a040;
  margin-left: 4px;
  vertical-align: middle;
  flex-shrink: 0;
  transform: translateY(-1px);
}

.card-artist {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.card-meta,
.card-date {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 3px;
  opacity: 0.6;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Skeleton */
@keyframes shimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

.skeleton {
  background: linear-gradient(90deg, var(--skeleton-a) 25%, var(--skeleton-b) 50%, var(--skeleton-a) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.4s infinite;
  border-radius: 10px;
}

.skeleton-text { border-radius: 4px; }

/* Error */
.error {
  padding: 40px;
  color: var(--text-muted);
  font-size: 14px;
}

/* Modal — theme variables (scoped to noteModal so about/stats modals are unaffected) */
dialog#noteModal {
  --modal-bg:          rgba(255, 255, 255, 0.88);
  --modal-header-bg:   rgba(255, 255, 255, 1);
  --modal-border:      rgba(0, 0, 0, 0.07);
  --modal-text:        #1d1d1f;
  --modal-text-muted:  #6e6e73;
  --modal-accent:      #145a23;
  --modal-divider:     #e5e5e5;
  --modal-close-bg:    rgba(0, 0, 0, 0.1);
  --modal-close-hover: rgba(0, 0, 0, 0.18);
  --modal-link-border: #e5e5e5;
  --modal-notes-color: #4a4a50;
  transition: background 0.4s, color 0.4s;
}

@media (prefers-color-scheme: dark) {
  dialog#noteModal {
    --modal-bg:          rgba(28, 28, 32, 0.82);
    --modal-header-bg:   rgba(28, 28, 32, 1);
    --modal-border:      rgba(255, 255, 255, 0.08);
    --modal-text:        #f0f0f0;
    --modal-text-muted:  #6e6e73;
    --modal-accent:      #1e8a38;
    --modal-divider:     rgba(255, 255, 255, 0.1);
    --modal-close-bg:    rgba(255, 255, 255, 0.1);
    --modal-close-hover: rgba(255, 255, 255, 0.18);
    --modal-link-border: rgba(255, 255, 255, 0.15);
    --modal-notes-color: #b0b0ba;
  }
}

/* Custom scroll indicator (works on iOS Safari) */
.scroll-indicator-track {
  position: absolute;
  right: 2px;
  width: 4px;
  pointer-events: none;
  z-index: 10;
  overflow: hidden;
  border-radius: 2px;
}
.scroll-indicator-thumb {
  width: 100%;
  border-radius: 2px;
  background: rgba(0, 0, 0, 0.2);
  opacity: 0;
  transition: opacity 0.3s;
}
.scroll-indicator-track.visible .scroll-indicator-thumb { opacity: 1; }
@media (prefers-color-scheme: dark) {
  .scroll-indicator-thumb { background: rgba(255, 255, 255, 0.25); }
}
/* Hide native scrollbar */
.modal-scroll::-webkit-scrollbar,
.stats-modal-body::-webkit-scrollbar,
.about-body::-webkit-scrollbar { display: none; }
.modal-scroll, .stats-modal-body, .about-body { scrollbar-width: none; }

/* Modal */
html:has(dialog[open]) { overflow: hidden; }

dialog { outline: none; }

dialog {
  border-radius: 24px;
  padding: 0;
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(48px) saturate(180%);
  -webkit-backdrop-filter: blur(48px) saturate(180%);
  border: 1px solid rgba(255, 255, 255, 0.8);
  color: var(--text);
  max-width: 720px;
  width: calc(100% - 32px);
  max-height: 85dvh;
  box-shadow:
    0 32px 80px rgba(0, 0, 0, 0.2),
    inset 0 1px 0 rgba(255, 255, 255, 0.7);
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  overflow: hidden;
}

dialog#noteModal {
  background: var(--modal-bg);
  color: var(--modal-text);
  border: none;
  box-shadow: var(--modal-shadow, 0 32px 80px rgba(0,0,0,0.2), inset 0 1px 0 rgba(255,255,255,0.7));
}

dialog[open] {
  display: block;
}

@media (prefers-color-scheme: dark) {
  dialog {
    background: rgba(28, 28, 32, 0.82);
    border-color: rgba(255, 255, 255, 0.1);
    box-shadow:
      0 32px 80px rgba(0, 0, 0, 0.55),
      inset 0 1px 0 rgba(255, 255, 255, 0.07);
  }
}

dialog::backdrop {
  background: rgba(0, 0, 0, 0.10);
  backdrop-filter: blur(60px) saturate(130%);
  -webkit-backdrop-filter: blur(60px) saturate(130%);
}

/* Modal header */
.modal-header {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  padding: 14px 18px;
  background: transparent;
  border-bottom: 1px solid transparent;
  position: sticky;
  top: 0;
  z-index: 1;
  transition: background 0.3s, backdrop-filter 0.3s, -webkit-backdrop-filter 0.3s, border-color 0.3s;
}

.modal-header--scrolled {
  background: rgba(255, 255, 255, 1);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border-bottom-color: rgba(0, 0, 0, 0.07);
}

dialog#noteModal .modal-header {
  background: transparent;
}

dialog#noteModal .modal-header--scrolled {
  background: var(--modal-header-bg, rgba(255, 255, 255, 1));
  border-bottom-color: var(--modal-border, rgba(0, 0, 0, 0.07));
}


.modal-header-art {
  display: none;
  width: 52px;
  height: 52px;
  border-radius: 8px;
  overflow: hidden;
  background: var(--card-bg);
  flex-shrink: 0;
}

.modal-header-art img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.modal-header-info {
  display: none;
}

dialog#noteModal .modal-header-artist {
  color: var(--modal-text-muted);
}

.modal-header-artist {
  font-size: 11px;
  color: var(--text-muted);
  letter-spacing: 0.03em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.modal-header-title {
  font-size: 14px;
  font-weight: 600;
  letter-spacing: -0.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Scrollable content area — height = dialog max-height minus header (~58px) */
.modal-scroll {
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  max-height: calc(85dvh);
  border-radius: 24px 24px 0 0;
}

.modal-inner {
  display: flex;
  gap: 28px;
  padding: 24px 28px 28px;
}

.modal-art {
  position: sticky;
  top: 70px;
  width: 240px;
  height: 240px;
  border-radius: 12px;
  overflow: hidden;
  background: var(--card-bg);
  flex-shrink: 0;
  align-self: flex-start;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.15), 0 2px 8px rgba(0, 0, 0, 0.1);
}

.modal-art img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.modal-art::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 120px;
  pointer-events: none;
  display: none;
}

.modal-body { flex: 1; min-width: 0; }

dialog#noteModal .modal-artist {
  color: var(--modal-text);
}

.modal-artist {
  font-size: 15px;
  font-weight: 500;
  color: var(--text);
  margin-bottom: 4px;
}

.modal-title {
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.2;
  text-wrap: balance;
  margin-bottom: 16px;
}

.modal-rank {
  font-size: 28px;
  font-weight: 700;
  color: #145a23;
  letter-spacing: -0.03em;
  margin-bottom: 14px;
}

dialog#noteModal .modal-rank {
  color: var(--modal-accent);
}

@media (prefers-color-scheme: dark) {
  .modal-rank { color: #1e8a38; }
}

.modal-meta {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 5px 12px;
  font-size: 13px;
  margin-bottom: 16px;
  border-top: 1px solid var(--modal-divider, var(--border));
  padding-top: 15px;
  margin-top: 15px;
}

.modal-meta .meta-label {
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
}

.modal-meta .meta-value { color: var(--text-muted); }
dialog#noteModal .modal-meta .meta-value { color: var(--modal-text-muted); }

dialog#noteModal .modal-tracklist {
  border-top-color: var(--modal-divider);
}

.modal-tracklist {
  border-top: 1px solid var(--border);
  padding-top: 15px;
  padding-bottom: 15px;
}

dialog#noteModal .modal-meta .meta-label {
  color: var(--modal-text);
}

.track-side {
  font-size: 10px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.07em;
  margin-top: 10px;
  margin-bottom: 4px;
}

.track-side:first-child { margin-top: 0; }

.track-row {
  display: grid;
  grid-template-columns: 28px 1fr auto;
  gap: 0 8px;
  align-items: baseline;
  padding: 2.5px 0;
}

.track-pos {
  font-size: 11px;
  color: var(--text-muted);
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.track-title {
  font-size: 13px;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.track-dur {
  font-size: 11px;
  color: var(--text-muted);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.track-row.has-preview { grid-template-columns: 24px 28px 1fr auto; }

.track-play {
  width: 20px;
  height: 20px;
  padding: 0;
  border: none;
  background: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  align-self: center;
  color: var(--modal-accent);
  opacity: 0.8;
  transition: opacity 0.15s ease, transform 0.1s ease;
}
@media (hover: hover) { .track-play:hover { opacity: 1; } }
.track-play:active { transform: scale(0.88); }
.track-play.playing { opacity: 1; }
.track-play svg { width: 15px; height: 15px; fill: currentColor; display: block; }
.track-play .preview-pause,
.track-play.playing .preview-play { display: none; }
.track-play.playing .preview-pause { display: block; }

/* Empty placeholder on button-less rows — mirrors the play button's box
   (height + centering) so every tracklist row stays the same height. */
.track-play-spacer { display: block; height: 20px; align-self: center; }

.track-loading {
  font-size: 13px;
  color: var(--text-muted);
  padding: 2px 0;
}

dialog#noteModal .track-side,
dialog#noteModal .track-pos,
dialog#noteModal .track-dur,
dialog#noteModal .track-loading {
  color: var(--modal-text-muted);
}
dialog#noteModal .track-title {
  color: var(--modal-text);
}

.modal-notes-wrap {
  border-top: 1px solid var(--border);
  padding-top: 20px;
}

.modal-notes-wrap::before {
  content: "Jorge:";
  display: block;
  font-size: 14px;
  color: #4a4a50;
  margin-bottom: 16px;
}

.modal-notes {
  font-size: 14px;
  line-height: 1.7;
  color: #4a4a50;
  white-space: pre-wrap;
  text-wrap: pretty;
  border-left: 2px solid var(--border);
  padding-left: 16px;
}

dialog#noteModal .modal-notes-wrap {
  border-top-color: var(--modal-divider);
}
dialog#noteModal .modal-notes-wrap::before {
  color: var(--modal-notes-color);
}
dialog#noteModal .modal-notes {
  color: var(--modal-notes-color);
  border-left-color: var(--modal-divider);
}

@media (prefers-color-scheme: dark) {
  .modal-notes-wrap::before { color: #b0b0ba; }
  .modal-notes { color: #b0b0ba; }
  .modal-tracklist   { border-top-color:  rgba(255, 255, 255, 0.1); }
  .modal-notes-wrap  { border-top-color:  rgba(255, 255, 255, 0.1); }
  .modal-notes       { border-left-color: rgba(255, 255, 255, 0.1); }
}

.modal-links {
  display: flex;
  gap: 8px;
  margin-top: 20px;
  flex-wrap: wrap;
}

.modal-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text-muted);
  text-decoration: none;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 6px 12px;
  cursor: pointer;
}

dialog#noteModal .modal-link {
  color: var(--modal-text-muted);
  border-color: var(--modal-link-border);
}

.modal-link svg { flex-shrink: 0; }

@media (hover: hover) {
  .modal-link:hover {
    color: var(--text);
    border-color: var(--text-muted);
  }
  dialog#noteModal .modal-link:hover {
    color: var(--modal-text);
    border-color: var(--modal-text-muted);
  }
}

.modal-close {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: none;
  background: rgba(0, 0, 0, 0.15);
  color: rgba(0, 0, 0, 0.45);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background 0.15s;
  -webkit-tap-highlight-color: transparent;
}

@media (hover: hover) { .modal-close:hover { background: rgba(0, 0, 0, 0.22); } }

.modal-apple-music {
  height: 28px;
  padding: 0 10px;
  border-radius: 14px;
  border: none;
  background: rgba(0, 0, 0, 0.07);
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  flex-shrink: 0;
  transition: background 0.15s;
  text-decoration: none;
  display: none;
  font-size: 11px;
  font-weight: 500;
  font-family: inherit;
  white-space: nowrap;
}

.modal-apple-music.visible {
  display: flex;
}

@media (hover: hover) { .modal-apple-music:hover { background: rgba(0, 0, 0, 0.13); } }

dialog#noteModal .modal-apple-music {
  background: transparent;
  border: 1px solid var(--modal-link-border, var(--border));
  color: var(--modal-text-muted);
  border-radius: 6px;
  padding: 6px 12px;
  font-size: 12px;
}
@media (hover: hover) {
  dialog#noteModal .modal-apple-music:hover {
    background: transparent;
    color: var(--modal-text);
    border-color: var(--modal-text-muted);
  }
}

@media (prefers-color-scheme: dark) {
  .modal-close { background: rgba(255, 255, 255, 0.15); color: rgba(255, 255, 255, 0.5); }
  .modal-apple-music { background: rgba(255, 255, 255, 0.1); }
  .modal-link { border-color: rgba(255, 255, 255, 0.15); color: rgba(255, 255, 255, 0.6); }
}

/* About modal */
.about-modal { max-width: 420px; }

.about-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px 14px 24px;
  border-bottom: 1px solid rgba(0, 0, 0, 0.07);
}

.about-header-title {
  font-size: 14px;
  font-weight: 600;
}

@media (prefers-color-scheme: dark) {
  .about-header { border-bottom-color: rgba(255, 255, 255, 0.08); }
}

.about-body {
  padding: 24px;
  overflow-y: auto;
  max-height: calc(85dvh - 50px);
}

.about-figure {
  margin: 24px 0 0;
}

.about-photo {
  width: 100%;
  border-radius: 4px;
  display: block;
}

.about-caption {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 15px;
  text-align: left;
}

.about-bio {
  font-size: 14px;
  line-height: 1.7;
  color: var(--text-muted);
  text-wrap: balance;
  margin-bottom: 10px;
}

.about-translate {
  font-size: 12px;
  color: var(--text-muted);
  opacity: 0.6;
  cursor: pointer;
  background: none;
  border: none;
  padding: 0;
  font-family: inherit;
  margin-bottom: 20px;
  display: block;
}

@media (hover: hover) { .about-translate:hover { opacity: 0.9; } }

.about-setup {
  width: 100%;
  margin-top: 0;
  border-collapse: collapse;
}

.about-setup td {
  font-size: 13px;
  padding: 8px 0 0;
}

.about-setup-label {
  color: var(--text-muted);
  width: 100px;
}

.about-links {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.about-links a {
  font-size: 12px;
  color: var(--text-muted);
  text-decoration: none;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 6px 12px;
  transition: color 0.15s, border-color 0.15s;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

@media (hover: hover) {
  .about-links a:hover {
    color: var(--text);
    border-color: var(--text-muted);
  }
}

@media (prefers-color-scheme: dark) {
  .about-links a { border-color: rgba(255, 255, 255, 0.15); color: rgba(255, 255, 255, 0.6); }
}
@media (hover: hover) and (prefers-color-scheme: dark) {
  .about-links a:hover { color: var(--text); border-color: rgba(255, 255, 255, 0.3); }
}

.about-playlists {
  margin-top: 28px;
}

.about-playlists-title {
  font-size: 11px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin-bottom: 10px;
}

.about-playlists > .about-playlists-title {
  margin-bottom: 20px;
}

.about-playlists-grid {
  display: flex;
  gap: 12px;
}

.about-playlist-item {
  text-decoration: none;
  text-align: center;
  flex: 1;
}

.about-playlist-item img {
  width: 100%;
  aspect-ratio: 1;
  border-radius: 8px;
  object-fit: cover;
}

.about-playlist-item span {
  display: block;
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 6px;
}

.about-playlist-item .about-playlist-desc {
  display: none;
}

@media (hover: hover) {
  .about-playlist-item:hover span { color: var(--text); }
}

/* Content responsive — hero, controls, modal */
@media (max-width: 600px) {
  .hero         { padding: 32px 16px 32px; }
  .hero h1      { font-size: 1.6rem; }
  .hero p       { font-size: 1rem; }
  .controls     { padding: 0 16px 24px; }
  .search       { font-size: 16px; }
  .sort         { font-size: 16px; }
  dialog,
  dialog#noteModal   { width: calc(100% - 40px); border-radius: 20px; border-color: transparent; outline: none; }
  .modal-inner       { display: block; padding: 0 16px 24px; }
  .modal-art         { position: relative; top: auto; align-self: auto; width: 100%; height: auto; aspect-ratio: 1; border-radius: 12px; max-width: 300px; margin: 0 auto; }
  .modal-body        { padding: 16px 2px 0; }
  .modal-artist      { text-align: center; }
  .modal-title       { text-align: center; }
  .modal-meta        { border-top: 1px solid var(--modal-divider, var(--border)); padding-top: 15px; margin-top: 15px; }
  .modal-apple-music {
    background: rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.15);
  }
  dialog#noteModal .modal-apple-music {
    background: transparent;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    color: var(--modal-text-muted, #fff);
    border: 1px solid var(--modal-link-border, rgba(255, 255, 255, 0.15));
  }
  .modal-title       { font-size: 22px; margin-bottom: 12px; }
  .modal-meta        { font-size: 14px; }
  .track-title       { white-space: normal; font-size: 13px; }
  .track-pos         { font-size: 12px; }
  .track-dur         { font-size: 12px; }
}


@media (min-width: 1400px) {
  .grid { grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); }
}

@media (max-width: 899px) {
  body          { }
  header        { padding: 0; height: auto; flex-wrap: wrap; }
  .header-top   { display: flex; align-items: center; width: 100%; padding: 0 16px; }
  header .name  { font-size: 17px; height: 44px; display: flex; align-items: center; }
  .site-nav     { position: static; transform: none; gap: 0; order: 5; width: 100%; padding: 0; }
  .nav-link     { font-size: 13px; padding: 13px 0; flex: 1; text-align: center; border-radius: 0; background: none; display: block; border-bottom: 1px solid transparent; }
  .nav-link--active { background: none; opacity: 1; border-bottom-color: var(--text); }
  .name-info--desktop { display: none; }
  .name-info--mobile  { display: flex; margin-left: 8px; margin-right: 0; }
  .header-actions { margin-left: auto; }
  .about-btn-label { display: none; }
}





