:root {
  --bg: #0f1115;
  --panel: #171a21;
  --panel2: #1e2330;
  --border: #2a3142;
  --text: #e8ecf4;
  --muted: #9aa3b5;
  --accent: #6ea8ff;
  --accent2: #3dd68c;
  --danger: #ff7b72;
  --radius: 10px;
  --font: "Inter", "SF Pro Text", system-ui, -apple-system, sans-serif;
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  display: flex;
  flex-direction: column;
}
a { color: var(--accent); }
header.app-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.85rem 1.25rem;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(180deg, #151922, #10131a);
  position: sticky;
  top: 0;
  z-index: 10;
}
header h1 {
  font-size: 1.05rem;
  margin: 0;
  font-weight: 650;
  letter-spacing: 0.01em;
}
header h1 span { color: var(--muted); font-weight: 500; }
#search {
  flex: 1;
  max-width: 420px;
  background: var(--panel2);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 8px;
  padding: 0.55rem 0.85rem;
  font-size: 0.95rem;
}
#search:focus { outline: 2px solid #3b6fd9; border-color: transparent; }
#stats { color: var(--muted); font-size: 0.8rem; white-space: nowrap; }
#now-playing { color: var(--accent2); font-size: 0.8rem; min-width: 10rem; }
.layout {
  display: grid;
  grid-template-columns: 280px 1fr;
  min-height: 0;
  flex: 1;
}
#sidebar {
  overflow: auto;
  border-right: 1px solid var(--border);
  background: var(--panel);
  padding: 0.5rem 0.4rem 2rem;
}
.cat { margin: 0.15rem 0; }
.cat > summary {
  cursor: pointer;
  list-style: none;
  padding: 0.45rem 0.65rem;
  border-radius: 6px;
  font-weight: 600;
  font-size: 0.92rem;
}
.cat > summary::-webkit-details-marker { display: none; }
.cat > summary:hover { background: var(--panel2); }
.cat[open] > summary { color: var(--accent); }
.cat ul { list-style: none; margin: 0; padding: 0 0 0.35rem 0.4rem; }
.sub {
  width: 100%;
  text-align: left;
  background: transparent;
  border: 0;
  color: var(--muted);
  padding: 0.32rem 0.55rem;
  border-radius: 6px;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
  font-size: 0.86rem;
}
.sub:hover { background: var(--panel2); color: var(--text); }
.sub.active { background: #24304a; color: var(--text); }
.badge {
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 0.1rem 0.35rem;
  border-radius: 4px;
  background: #333;
}
.badge.miss { background: #3a1f22; color: var(--danger); }
main {
  overflow: auto;
  padding: 1rem 1.25rem 3rem;
}
#crumb {
  color: var(--muted);
  font-size: 0.85rem;
  margin-bottom: 0.85rem;
}
#sample-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 0.85rem;
}
.card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.9rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}
.card.missing { opacity: 0.7; border-style: dashed; }
.card-top { display: flex; justify-content: space-between; gap: 0.5rem; }
.card h3 { margin: 0; font-size: 0.98rem; font-weight: 600; }
.path, .meta { margin: 0.25rem 0 0; color: var(--muted); font-size: 0.78rem; }
.dur { color: var(--muted); font-size: 0.8rem; font-variant-numeric: tabular-nums; }
.actions { display: flex; gap: 0.5rem; }
.btn {
  appearance: none;
  border: 1px solid var(--border);
  background: var(--panel2);
  color: var(--text);
  border-radius: 7px;
  padding: 0.4rem 0.75rem;
  font-size: 0.85rem;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
}
.btn.play { background: #1d3a2a; border-color: #2d5a42; color: var(--accent2); }
.btn.play:hover { background: #244a35; }
.btn.dl:hover { background: #2a3348; }
.license {
  margin: 0;
  font-size: 0.72rem;
  color: var(--muted);
  word-break: break-all;
  line-height: 1.35;
}
.license a { color: #8eb6ff; }
.reuse-note, .note { margin: 0; color: var(--muted); font-size: 0.72rem; line-height: 1.35; }
.reuse-note { color: #b9a9d8; }
.empty {
  color: var(--muted);
  padding: 2rem;
  text-align: center;
}
footer.note {
  border-top: 1px solid var(--border);
  padding: 0.55rem 1.25rem;
  font-size: 0.75rem;
  color: var(--muted);
  background: #0c0e12;
}
@media (max-width: 800px) {
  .layout { grid-template-columns: 1fr; }
  #sidebar { max-height: 40vh; border-right: 0; border-bottom: 1px solid var(--border); }
}

.sort-label {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  color: var(--muted);
  font-size: 0.8rem;
  white-space: nowrap;
}
.sort-label select {
  appearance: none;
  background: var(--panel2);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.35rem 1.6rem 0.35rem 0.55rem;
  font: inherit;
  font-size: 0.82rem;
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%),
    linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 12px) 55%, calc(100% - 7px) 55%;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
  cursor: pointer;
}
.sort-label select:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
#refresh-hint {
  font-size: 0.78rem;
  color: var(--accent2);
  min-width: 7rem;
}
#refresh-hint[hidden] { display: none !important; }
.card-meta {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.2rem;
  flex-shrink: 0;
}
.card .added {
  font-size: 0.72rem;
  color: var(--muted);
  white-space: nowrap;
}
@media (max-width: 900px) {
  header.app-header { flex-wrap: wrap; }
  .sort-label { order: 3; }
}

.last-updated {
  font-size: 0.78rem;
  color: var(--muted);
  white-space: nowrap;
}
