:root {
  --bg: #fafafa;
  --fg: #1a1a1a;
  --dim: #666;
  --muted: #999;
  --faint: #e0e0e0;
  --border: #e4e4e7;

  --chart-bg: #141414;
  --chart-fg: #e0e0e0;
  --chart-dim: #888;
  --chart-border: rgba(255,255,255,0.08);
}

[data-theme="dark"] {
  --bg: #161616;
  --fg: #e0e0e0;
  --dim: #888;
  --muted: #666;
  --faint: #333;
  --border: #333;
}

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

body {
  font-family: ui-monospace, 'SF Mono', Menlo, Monaco, 'Cascadia Code', monospace;
  font-size: 12px;
  background: var(--bg);
  color: var(--fg);
  line-height: 1.5;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

.container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 24px 32px 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

header {
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--faint);
}

.header-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 16px;
}

h1 {
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0;
  margin-bottom: 0;
  color: var(--fg);
}

.subtitle {
  color: var(--dim);
  font-size: 12px;
  font-weight: 400;
}


.sort-toggle {
  display: none;
  align-items: center;
  gap: 6px;
}

.sort-toggle.visible {
  display: flex;
}

.sort-label {
  font-size: 11px;
  color: var(--chart-dim);
  font-weight: 500;
}

.sort-btn {
  background: transparent;
  border: none;
  color: var(--chart-dim);
  padding: 4px 8px;
  font-family: inherit;
  font-size: 11px;
  font-weight: 500;
  cursor: pointer;
  transition: color 0.15s ease;
}

.sort-btn:hover {
  color: var(--chart-fg);
}

.sort-btn.active {
  background: rgba(255,255,255,0.1);
  color: var(--chart-fg);
}

/* Play count */
.play-count {
  font-size: 10px;
  color: var(--chart-dim);
}

/* Search modal */
.search-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  z-index: 1000;
  justify-content: center;
  padding-top: 10vh;
}

.search-overlay.visible {
  display: flex;
}

.search-modal {
  background: #fff;
  border: 1px solid var(--faint);
  border-radius: 12px;
  corner-shape: squircle;
  width: 100%;
  max-width: 560px;
  max-height: 70vh;
  overflow: hidden;
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.15);
}

[data-theme="dark"] .search-modal {
  background: #1e1e1e;
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.5);
}

[data-theme="dark"] .search-result:hover {
  background: rgba(255,255,255,0.06);
}

[data-theme="dark"] .tooltip {
  background: #1e1e1e;
  border-color: var(--faint);
  box-shadow: 0 4px 12px rgba(0,0,0,0.4);
}

.search-input-wrapper {
  padding: 12px 16px;
  border-bottom: 1px solid var(--faint);
  display: flex;
  align-items: center;
  gap: 12px;
}

.search-icon {
  color: var(--dim);
  font-size: 16px;
  flex-shrink: 0;
}

.search-input {
  width: 100%;
  background: transparent;
  border: none;
  outline: none;
  font-family: inherit;
  font-size: 13px;
  color: var(--fg);
}

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

.search-shortcut {
  font-size: 10px;
  color: var(--muted);
  padding: 2px 6px;
  border: 1px solid var(--faint);
  flex-shrink: 0;
  font-weight: 400;
}

.search-results {
  max-height: calc(70vh - 56px);
  overflow-y: auto;
  padding: 8px 0;
}

.search-results::-webkit-scrollbar {
  width: 8px;
}

.search-results::-webkit-scrollbar-track {
  background: transparent;
}

.search-results::-webkit-scrollbar-thumb {
  background: var(--faint);
}

.search-result {
  padding: 10px 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 12px;
  transition: background 0.1s ease;
  margin: 0;
}

.search-result:hover {
  background: #f5f5f5;
}

.search-result-type {
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  color: #fff;
  background: var(--dim);
  padding: 3px 6px;
  width: 48px;
  text-align: center;
  flex-shrink: 0;
  font-weight: 600;
}

.search-result-type.artist { background: #2a7d6a; }
.search-result-type.album { background: #6b4fba; }
.search-result-type.song { background: #c4556e; }

.search-result-name {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 12px;
  font-weight: 500;
}

.search-result-meta {
  font-size: 11px;
  color: var(--dim);
}

.search-hint {
  padding: 48px 24px;
  text-align: center;
  color: var(--muted);
  font-size: 12px;
}

.search-hint-icon {
  font-size: 24px;
  margin-bottom: 12px;
  opacity: 0.5;
}

.back {
  font-size: 11px;
  color: var(--dim);
  text-decoration: none;
  display: block;
  margin-bottom: 12px;
}

.back:hover {
  color: var(--fg);
}

.nav {
  position: fixed;
  top: calc(50vh - 140px);
  right: 20px;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: .25rem;
  font-size: .9rem;
  line-height: 1.2;
  font-family: 'Times New Roman', Times, Georgia, serif;
  z-index: 100;
}

.nav a {
  color: var(--dim);
  text-decoration: none;
}

.nav a:hover {
  color: var(--fg);
}

.nav a.active {
  color: var(--fg);
}

.nav-home {
  display: none;
}

.theme-toggle{cursor:pointer;color:var(--dim);font-size:.9rem;background:none;border:none;font-family:'Times New Roman',Times,Georgia,serif;padding:0}
.theme-toggle:hover{color:var(--fg)}

/* Search button in header */
.search-btn {
  background: none;
  border: none;
  color: var(--dim);
  padding: 0;
  font-family: inherit;
  font-size: 12px;
  cursor: pointer;
  transition: color 0.15s ease;
  display: flex;
  align-items: center;
  gap: 6px;
}

.search-btn:hover {
  color: var(--fg);
}

.search-btn-key {
  font-size: 11px;
  color: var(--muted);
  font-weight: 400;
}

.chart-wrapper {
  position: relative;
  background: var(--chart-bg);
  border: none;
  border-top: 1px solid rgba(255,255,255,0.06);
  border-radius: 12px;
  corner-shape: squircle;
  padding: 0;
  overflow: hidden;
  margin: 0 24px;
  box-shadow: 0 25px 50px rgba(0,0,0,0.25), 0 8px 16px rgba(0,0,0,0.15);
  min-height: 600px;
}
[data-theme="dark"] .chart-wrapper {
  border: 1px solid rgba(255,255,255,0.1);
}

.chart-wrapper.loading {
  display: none;
}

/* Loading state */
.loading-indicator {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 200px;
  color: var(--dim);
  font-size: 12px;
}

.loading-indicator.hidden {
  display: none;
}

/* Integrated table toolbar - navigation lives here */
.table-toolbar {
  display: flex;
  align-items: center;
  padding: 10px 24px;
  background: #1a1a1a;
  border-bottom: 1px solid var(--chart-border);
  gap: 12px;
  min-height: 40px;
  border-radius: 12px 12px 0 0;
  corner-shape: squircle;
}


.toolbar-breadcrumb {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  flex: 1;
}

.breadcrumb-link {
  color: var(--chart-fg);
  cursor: pointer;
  transition: color 0.15s ease;
  padding: 4px 0;
}

.breadcrumb-link:hover {
  color: var(--chart-fg);
  text-decoration: underline;
}

.breadcrumb-sep {
  margin: 0 6px;
  color: var(--chart-dim);
  font-size: 11px;
}

.breadcrumb-current {
  color: var(--chart-fg);
  font-weight: 600;
}

.toolbar-stats {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
  font-size: 12px;
  color: var(--chart-dim);
}

.toolbar-stat {
  color: var(--chart-fg);
  font-weight: 500;
}



.toolbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: 16px;
}

/* Column headers */
.column-headers {
  display: flex;
  align-items: center;
  padding: 8px 24px;
  background: var(--chart-bg);
  border-bottom: 1px solid var(--chart-border);
}

.col-header {
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--chart-dim);
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 4px;
}

.col-header-icon {
  font-size: 12px;
  opacity: 0.7;
}

.col-name { width: 160px; padding-right: 16px; flex-shrink: 0; }
.col-timeline { flex: 1; text-align: center; }
.col-hours { width: 60px; text-align: right; padding-left: 12px; flex-shrink: 0; }

/* Song view specific columns */
.col-track { width: 32px; text-align: center; flex-shrink: 0; }
.col-plays { width: 60px; text-align: left; }
.col-link { width: 24px; }

/* Album view extras */
.col-year { width: 50px; text-align: center; }
.col-tracks { width: 50px; text-align: center; }

.time-axis {
  display: flex;
  align-items: center;
  padding: 6px 24px;
  border-bottom: 1px solid var(--chart-border);
}

.time-axis-spacer {
  flex-shrink: 0;
}

.time-axis-spacer.artists,
.time-axis-spacer.albums,
.time-axis-spacer.songs { width: 196px; }

.time-axis-labels {
  flex: 1;
  display: flex;
  position: relative;
  height: 16px;
}

/* Year axis ticks */
.year-mark::before {
  content: '';
  position: absolute;
  top: -8px;
  left: 50%;
  transform: translateX(-50%);
  width: 1px;
  height: 6px;
  background: var(--muted);
}

.time-axis-end {
  flex-shrink: 0;
}

.time-axis-end.artists,
.time-axis-end.albums,
.time-axis-end.songs { width: 90px; }

.year-mark {
  position: absolute;
  transform: translateX(-50%);
  font-size: 9px;
  color: var(--chart-dim);
  font-weight: 500;
  text-transform: uppercase;
}

.chart-content {
  padding: 8px 16px 16px;
}

.horizon-row {
  display: flex;
  align-items: center;
  height: 48px;
  margin-bottom: 0;
  cursor: pointer;
  transition: background 0.1s ease;
  padding: 0 8px;
}

.horizon-row + .horizon-row {
  border-top: 1px solid rgba(255,255,255,0.05);
}
.horizon-row:hover {
  background: rgba(255,255,255,0.04);
}

.horizon-row.clickable::after {
  content: '';
  display: none;
}

.item-label {
  width: 160px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  overflow-x: visible;
  overflow-y: clip;
  position: relative;
  z-index: 1;
}

.item-name {
  font-size: 12px;
  font-weight: 500;
  color: var(--chart-fg);
  white-space: nowrap;
  background: linear-gradient(90deg, rgba(20, 20, 20, 0.7) 0%, rgba(20, 20, 20, 0.4) 80%, transparent 100%);
  padding: 1px 16px 1px 4px;
  width: fit-content;
}

.item-secondary {
  font-size: 11px;
  color: var(--chart-dim);
  white-space: nowrap;
  background: linear-gradient(90deg, rgba(20, 20, 20, 0.5) 0%, rgba(20, 20, 20, 0.3) 80%, transparent 100%);
  padding: 1px 16px 1px 4px;
  width: fit-content;
}

.horizon-chart {
  flex: 1;
  height: 20px;
  position: relative;
  overflow: hidden;
}

.horizon-chart canvas {
  width: 100%;
  height: 100%;
  display: block;
}

.item-hours {
  width: 60px;
  text-align: right;
  font-size: 11px;
  color: var(--chart-dim);
  padding-left: 12px;
  flex-shrink: 0;
  font-weight: 500;
}

/* Album art thumbnails */
.album-art {
  width: 32px;
  height: 32px;
  flex-shrink: 0;
  margin-right: 12px;
  background: rgba(255,255,255,0.05);
  object-fit: cover;
}

.album-art-placeholder {
  width: 32px;
  height: 32px;
  flex-shrink: 0;
  margin-right: 12px;
  background: rgba(255,255,255,0.05);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--chart-dim);
  font-size: 14px;
}

/* Album type badge */
.album-type-badge {
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  padding: 2px 5px;
  background: rgba(255,255,255,0.08);
  color: var(--chart-dim);
  margin-left: 8px;
  font-weight: 600;
}

.album-type-badge.single {
  background: rgba(255,255,255,0.1);
  color: var(--chart-dim);
}

.album-type-badge.compilation {
  background: rgba(255,255,255,0.1);
  color: var(--chart-dim);
}

/* Album metadata row */
.album-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
  padding-left: 12px;
}

.album-year {
  font-size: 11px;
  color: var(--chart-dim);
}

.album-tracks {
  font-size: 10px;
  color: var(--chart-dim);
}


.tooltip {
  position: fixed;
  pointer-events: none;
  background: #fff;
  color: var(--fg);
  padding: 10px 14px;
  border: 1px solid var(--faint);
  border-radius: 12px;
  corner-shape: squircle;
  font-size: 11px;
  z-index: 1000;
  opacity: 0;
  transition: opacity 0.1s ease;
  max-width: 280px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.tooltip.visible { opacity: 1; }
.tooltip-title { font-weight: 600; margin-bottom: 2px; font-size: 12px; }
.tooltip-subtitle { color: var(--dim); margin-bottom: 6px; }
.tooltip-week { color: var(--dim); font-size: 11px; }
.tooltip-hours { color: var(--fg); font-weight: 600; }


/* Song-specific styles */
.track-number {
  width: 32px;
  text-align: center;
  font-size: 11px;
  color: var(--chart-dim);
  flex-shrink: 0;
}

.song-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-left: auto;
  padding-left: 12px;
}



.spotify-link {
  color: var(--chart-dim);
  text-decoration: none;
  font-size: 12px;
  opacity: 0;
  transition: opacity 0.1s ease, color 0.1s ease;
}

.horizon-row:hover .spotify-link {
  opacity: 1;
}

.spotify-link:hover {
  color: var(--chart-fg);
}

.explicit-badge {
  background: rgba(255,255,255,0.1);
  color: var(--chart-dim);
  font-size: 9px;
  padding: 1px 4px;
  margin-left: 6px;
  text-transform: uppercase;
  font-weight: 600;
}

.horizon-row {
  position: relative;
}

.horizon-row.album-row {
  height: 48px;
  margin-bottom: 0;
}

.horizon-row.album-row .horizon-chart {
  height: 28px;
}

.horizon-row:hover .spotify-link {
  opacity: 1;
}

/* Mobile responsive styles */
@media (max-width: 768px) {
  .back{display:none}
  .nav-home{display:inline}
  .container{display:flex;flex-direction:column}
  .nav{position:static;order:99;flex-direction:row;justify-content:center;align-items:center;gap:1.5rem;padding:1rem 0;margin-top:.5rem}

  .tooltip {
    display: none !important;
  }

  .container {
    padding: 16px 1px;
  }

  .back {
    padding-left: 16px;
  }

  header {
    padding: 0 16px;
    margin-bottom: 16px;
  }

  h1 {
    font-size: 13px;
  }

  .search-btn span:last-child {
    display: none;
  }

  .chart-wrapper {
    margin: 12px 0;
    border-radius: 12px;
    corner-shape: squircle;
  }

  .table-toolbar {
    padding: 12px 10px;
    gap: 8px;
    background: #1a1a1a;
    border-bottom: 1px solid var(--chart-border);
    flex-wrap: wrap;
    border-radius: 12px 12px 0 0;
    corner-shape: squircle;
  }

  .toolbar-breadcrumb {
    display: flex;
    flex: none;
    flex-wrap: nowrap;
    width: 100%;
    order: 1;
    overflow: hidden;
    line-height: 1.5;
    margin-bottom: 4px;
  }

  .toolbar-breadcrumb .breadcrumb-link,
  .toolbar-breadcrumb .breadcrumb-sep {
    flex-shrink: 0;
    white-space: nowrap;
  }

  .toolbar-breadcrumb .breadcrumb-current {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    min-width: 0;
  }


  .toolbar-stats {
    font-size: 12px;
    order: 2;
    margin-left: 0;
  }

  .toolbar-actions {
    display: flex;
    order: 3;
    margin-left: auto;
    gap: 4px;
  }

  .column-headers {
    display: none;
  }

  .time-axis {
    display: flex;
    padding: 8px 10px;
    background: transparent;
  }

  .time-axis-spacer {
    width: 70px !important;
    flex-shrink: 0;
  }

  .time-axis-labels {
    flex: 1;
    margin-right: 60px;
  }

  .time-axis-end {
    display: none;
  }

  .year-mark {
    font-size: 10px;
  }

  .chart-content {
    padding: 0;
    background: transparent;
  }

  /* List rows with chart as background */
  .horizon-row {
    flex-direction: row;
    align-items: center;
    height: 64px;
    padding: 0 10px;
    margin-bottom: 2px;
    background: transparent;
    position: relative;
    overflow: hidden;
  }

  .horizon-row:active {
    background: rgba(255,255,255,0.04);
  }

  .horizon-row.album-row {
    height: 72px;
  }

  /* Chart as full background */
  .horizon-chart {
    position: absolute !important;
    top: 4px;
    left: 70px;
    right: 60px;
    bottom: 4px;
    width: calc(100% - 130px) !important;
    height: calc(100% - 8px) !important;
    z-index: 0;
    opacity: 0.7;
  }

  .horizon-row.album-row .horizon-chart {
    height: calc(100% - 8px);
  }

  .item-label {
    position: relative;
    z-index: 1;
    width: auto;
    flex: 1;
    padding: 0;
    background: none;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    overflow: hidden;
  }

  .item-name {
    font-size: 12px;
    font-weight: 500;
    color: var(--chart-fg);
    margin-bottom: 2px;
    background: linear-gradient(90deg, rgba(20, 20, 20, 0.7) 0%, rgba(20, 20, 20, 0.4) 80%, transparent 100%);
    padding: 2px 16px 2px 6px;
    max-width: calc(100% - 70px);
    width: auto;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .item-secondary {
    font-size: 11px;
    color: var(--chart-dim);
    background: linear-gradient(90deg, rgba(20, 20, 20, 0.7) 0%, rgba(20, 20, 20, 0.4) 80%, transparent 100%);
    padding: 2px 16px 2px 6px;
    max-width: calc(100% - 70px);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .item-hours {
    position: relative;
    z-index: 1;
    width: auto;
    padding: 3px 6px;
    font-size: 11px;
    font-weight: 600;
    color: var(--chart-fg);
    text-align: right;
    background: rgba(20, 20, 20, 0.5);
  }

  /* Show small album art on mobile */
  .album-art,
  .album-art-placeholder {
    display: flex;
    position: relative;
    z-index: 1;
    width: 40px;
    height: 40px;
    margin-right: 12px;
    flex-shrink: 0;
  }

  .horizon-row.album-row .item-label {
    width: auto;
    flex: 1;
  }

  /* Album meta on mobile */
  .album-meta {
    position: absolute;
    top: 12px;
    right: 16px;
    padding: 0;
    gap: 8px;
  }

  .album-year,
  .album-tracks {
    display: none;
  }

  /* Song meta on mobile */
  .song-meta {
    position: absolute;
    top: 12px;
    right: 16px;
    padding: 0;
    gap: 8px;
  }

  .spotify-link {
    display: none;
  }

  .track-number {
    display: block;
    position: relative;
    z-index: 1;
    width: 24px;
    margin-right: 8px;
    font-size: 11px;
    color: var(--chart-dim);
  }

  /* Search modal mobile */
  .search-modal {
    max-width: 100%;
    margin: 0 12px;
  }

  .search-overlay {
    padding-top: 8vh;
  }

  .search-input-wrapper {
    padding: 12px 16px;
  }

  .search-result {
    padding: 12px 16px;
    margin: 0;
    border-radius: 0;
  }
}

/* Even smaller screens */
@media (max-width: 480px) {
  .toolbar-breadcrumb {
    font-size: 11px;
  }

  .breadcrumb-sep {
    margin: 0 4px;
  }

  .horizon-row {
    height: 56px;
    padding: 0 10px;
  }

  .horizon-row.album-row {
    height: 64px;
  }

  .item-name {
    font-size: 11px;
  }

  .item-secondary {
    font-size: 10px;
  }

  .item-hours {
    font-size: 10px;
    padding: 2px 5px;
  }

  .album-art,
  .album-art-placeholder {
    width: 36px;
    height: 36px;
  }
}

/* --- Static-site additions (generated pages use real links + SVG charts) --- */
a.horizon-row { color: inherit; text-decoration: none; }
a.breadcrumb-link { text-decoration: none; }

.horizon-chart svg {
  width: 100%;
  height: 100%;
  display: block;
}

.horizon-chart rect {
  stroke: rgba(100,100,100,0.2);
  stroke-width: 0.5;
  vector-effect: non-scaling-stroke;
}
a.search-result { color: inherit; text-decoration: none; }
