:root {
  color-scheme: dark;
  --bg: #15171C;
  --surface: #1D2027;
  --line: #2A2E37;
  --text: #ECEDEF;
  --muted: #8B909C;

  /* mood families — the only colors on the page, always tied to data */
  --calm: #5FB3C8;
  --bright: #E6B84F;
  --dark: #D2506F;
  --epic: #EA7A3E;
  --funny: #A6CF63;
  --mystic: #9583E6;
  --tender: #D99AC0;

  --display: "Unbounded", "Onest", system-ui, sans-serif;
  --body: "Onest", system-ui, -apple-system, "Segoe UI", sans-serif;
  --wrap: 920px;
  --gutter: clamp(16px, 4vw, 40px);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 400 16px/1.55 var(--body);
  font-variant-numeric: tabular-nums;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; }
button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--text); outline-offset: 2px; border-radius: 4px; }
[hidden] { display: none !important; }
/* Russian readers: the English text in the HTML stays invisible until the script switches language (no flash) */
html[lang="ru"]:not(.ready) [data-i18n] { visibility: hidden; }
main { min-height: 100vh; }  /* the footer does not jump while the catalog loads */
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* header */
.top, main, .foot {
  max-width: calc(var(--wrap) + 2 * var(--gutter));
  margin: 0 auto;
  padding-inline: var(--gutter);
}
.top { display: flex; align-items: center; justify-content: space-between; padding-block: 22px; }
.mark { font: 700 18px/1 var(--display); letter-spacing: -0.02em; text-decoration: none; }
.top-nav { display: flex; align-items: center; gap: 20px; font-size: 14px; color: var(--muted); }
.top-nav a { text-decoration: none; }
.top-nav a:hover { color: var(--text); }
.lang { display: flex; border: 1px solid var(--line); border-radius: 999px; padding: 2px; }
.lang button { border: 0; background: none; padding: 4px 10px; border-radius: 999px; font-size: 13px; color: var(--muted); }
.lang button[aria-pressed="true"] { background: var(--line); color: var(--text); }

/* hero: the search is the hero */
.hero { padding-block: clamp(20px, 4vw, 44px) 8px; }
.hero h1 {
  font: 500 clamp(26px, 3.6vw, 38px)/1.1 var(--display);
  letter-spacing: -0.035em;
  margin: 0 0 12px;
  max-width: 26ch;
  text-wrap: balance;
}
.lede { color: var(--muted); margin: 0 0 22px; max-width: 56ch; font-size: 17px; }
.search input {
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 18px 20px;
  font-size: clamp(17px, 2.2vw, 20px);
  outline: none;
  transition: border-color .15s;
}
.search input::placeholder { color: #7A7F8B; }
.search input:focus { border-color: var(--muted); }
.search input::-webkit-search-cancel-button { filter: invert(1) opacity(.5); }
.examples {
  display: flex; flex-wrap: nowrap; gap: 8px; margin-top: 12px; overflow-x: auto; scrollbar-width: none;
  -webkit-mask-image: linear-gradient(90deg, #000 calc(100% - 32px), transparent);
  mask-image: linear-gradient(90deg, #000 calc(100% - 32px), transparent);
}
.examples::-webkit-scrollbar { display: none; }
.examples button { flex: none; white-space: nowrap; }
.examples button {
  background: none; border: 1px dashed var(--line); border-radius: 999px;
  padding: 6px 12px; font-size: 14px; color: var(--muted);
}
.examples button:hover { color: var(--text); border-color: var(--muted); }

/* filters */
.filters { border-top: 1px solid var(--line); padding-top: 18px; margin-top: 18px; }
.moods { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; scrollbar-width: none; }
.moods::-webkit-scrollbar { display: none; }
.mood {
  flex: none; display: inline-flex; align-items: center; gap: 8px;
  background: none; border: 1px solid var(--line); border-radius: 999px;
  padding: 7px 14px 7px 11px; font-size: 14px; color: var(--muted);
}
.mood i { width: 9px; height: 9px; border-radius: 50%; background: var(--c); }
.mood:hover, .genre:hover, .seg button:not(:disabled):hover, .lang button:hover { color: var(--text); }
.mood[aria-pressed="true"] { color: var(--text); border-color: var(--c); background: color-mix(in oklab, var(--c) 14%, transparent); }
.genres { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.genres::-webkit-scrollbar { display: none; }
.genre {
  flex: none; background: none; border: 1px solid var(--line); border-radius: 8px;
  padding: 5px 11px; font-size: 13px; color: var(--muted); white-space: nowrap;
}
.genre[aria-pressed="true"] { color: var(--bg); background: var(--text); border-color: var(--text); }
.filter-row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 18px; margin-top: 12px; }
.seg { display: flex; border: 1px solid var(--line); border-radius: 10px; padding: 2px; }
.seg button { border: 0; background: none; padding: 5px 11px; border-radius: 8px; font-size: 14px; color: var(--muted); }
.seg button[aria-pressed="true"] { background: var(--line); color: var(--text); }
.chips { display: flex; gap: 6px; }
.more-toggle::after { content: " ▾"; color: var(--muted); }
.more-toggle[aria-expanded="true"]::after { content: " ▴"; }
.more-filters { display: grid; grid-template-columns: minmax(0, 1fr); gap: 10px; margin-top: 10px; justify-items: start; }
.more-filters > * { max-width: 100%; min-width: 0; }
.more-filters .genres { margin-top: 0; }
.filter-row .genre { padding-block: 5px; }
.toggle { display: inline-flex; align-items: center; gap: 8px; font-size: 14px; color: var(--muted); cursor: pointer; }
.toggle input { accent-color: var(--text); width: 16px; height: 16px; margin: 0; }
.toggle.small { font-size: 13px; margin-top: 12px; }

#results-top { scroll-margin-top: 0; height: 0; }
.result-head {
  position: sticky; top: 0; z-index: 5; margin-top: 18px;
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px;
  padding: 10px 0; background: var(--bg); border-bottom: 1px solid var(--line);
}
.active { display: flex; flex-wrap: wrap; gap: 6px; }
.chip-x, .reset {
  display: inline-flex; align-items: center; gap: 6px; background: var(--surface);
  border: 1px solid var(--line); border-radius: 999px; padding: 3px 10px; font-size: 13px; color: var(--text);
}
.chip-x span { color: var(--muted); font-size: 15px; line-height: 1; }
.chip-x:hover span { color: var(--text); }
.reset { background: none; color: var(--muted); }
.reset:hover { color: var(--text); }
.sort { margin-left: auto; }
.sort select {
  background: var(--surface); border: 1px solid var(--line); border-radius: 8px;
  padding: 5px 8px; font-size: 13px; color: var(--text);
}
.to-filters { display: none; background: none; border: 0; padding: 4px 0; font-size: 13px; color: var(--muted); }
#legend { margin: 10px 0 0; }
.count { color: var(--text); font-size: 14px; font-weight: 500; margin: 0; }
.legend { color: var(--muted); font-size: 13px; margin: 0; max-width: 72ch; }
.meter[data-t]:hover::after {
  content: attr(data-t); position: absolute; left: var(--x); top: -26px; transform: translateX(-50%);
  background: var(--text); color: var(--bg); font-size: 12px; padding: 2px 6px; border-radius: 6px; pointer-events: none;
}

/* results */
.results { list-style: none; margin: 0; padding: 0; }
.track {
  --c: var(--calm);
  display: grid; grid-template-columns: 44px 1fr; gap: 0 16px;
  padding: 22px 0; border-bottom: 1px solid var(--line);
}
.play {
  width: 44px; height: 44px; border-radius: 50%;
  border: 1px solid var(--line); background: none; display: grid; place-items: center;
}
.play:hover, .track.current .play { border-color: var(--c); }
.play svg { width: 14px; height: 14px; fill: var(--text); }
.head { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.head h3 { margin: 0; font-size: 18px; font-weight: 600; letter-spacing: -0.01em; }
.artist { color: var(--muted); font-size: 14px; }
.meta { margin-left: auto; display: inline-flex; align-items: baseline; gap: 8px; color: var(--muted); font-size: 14px; }
.tag { font-size: 12px; color: var(--muted); border: 1px solid var(--line); border-radius: 6px; padding: 0 6px; }
.track .play { margin-top: -8px; }
.sum { margin: 6px 0 12px; max-width: 70ch; color: #C9CBD1; }

/* the meter: one bar per few seconds, height = energy, color = mood family */
.meter {
  --gap: 2px;
  position: relative; display: flex; align-items: flex-end; gap: var(--gap);
  height: 44px; cursor: pointer; touch-action: manipulation;
}
.meter span {
  flex: 1 1 0; min-width: 1px; height: var(--h); border-radius: 1.5px;
  background: #3B404B;
  transform-origin: bottom;
}
.meter span.pk { background: var(--c); }
.track.current .meter span.on, .p-meter span.on { background: var(--c); }
.meter .peak-mark {
  position: absolute; bottom: -9px; height: 2px; background: var(--c); border-radius: 2px; pointer-events: none;
}
.rise .meter span { animation: rise .7s cubic-bezier(.2, .8, .2, 1) both; animation-delay: calc(var(--i) * 6ms); }
@keyframes rise { from { transform: scaleY(0); } }

.uses { margin: 18px 0 0; font-size: 14px; color: var(--muted); max-width: 72ch; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.actions button, .actions a {
  background: none; border: 1px solid var(--line); border-radius: 8px;
  padding: 6px 12px; font-size: 14px; text-decoration: none; color: var(--text);
}
.actions button:hover, .actions a:hover { border-color: var(--muted); }
.details { margin-top: 14px; display: grid; gap: 10px; font-size: 14px; color: #C9CBD1; max-width: 72ch; }
.details h4 { margin: 0 0 2px; font-size: 13px; font-weight: 500; color: var(--muted); }
.details .narrow { display: none; margin-top: 0; }
.en-note { color: var(--muted); font-size: 13px; }
.details p { margin: 0; }

.more-btn {
  display: block; margin: 28px auto 0; background: none; border: 1px solid var(--line);
  border-radius: 10px; padding: 10px 20px; color: var(--text);
}
.more-btn:hover { border-color: var(--muted); }
.more-btn[hidden] { display: none; }
.empty { padding: 32px 0; color: var(--muted); }
.empty button { background: none; border: 0; padding: 0; text-decoration: underline; color: var(--text); }

/* footer */
.foot {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 28px;
  padding-block: 64px 140px; margin-top: 56px;
  background: linear-gradient(var(--line), var(--line)) top center / calc(100% - 2 * var(--gutter)) 1px no-repeat;
  font-size: 14px; color: var(--muted);
}
.foot h2 { font-size: 14px; font-weight: 600; color: var(--text); margin: 0 0 6px; }
.foot p { margin: 0; }

/* sticky player */
.player {
  position: fixed; left: 50%; bottom: 14px; transform: translateX(-50%);
  width: min(calc(100% - 24px), 920px);
  display: grid; grid-template-columns: 40px minmax(0, 1fr) auto auto; align-items: center; gap: 12px;
  background: color-mix(in oklab, var(--surface) 92%, transparent);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border: 1px solid var(--line); border-radius: 16px; padding: 10px 16px 10px 10px;
}
.player[hidden] { display: none; }
.pp { width: 40px; height: 40px; border-radius: 50%; border: 0; background: var(--text); display: grid; place-items: center; }
.pp svg { width: 13px; height: 13px; fill: var(--bg); }
.p-title { font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-bottom: 4px; }
.p-info { min-width: 0; }
.p-meter { height: 22px; --gap: 1px; min-width: 0; }
.p-time { font-size: 13px; color: var(--muted); min-width: 4.5ch; text-align: right; }
.p-close { width: 40px; height: 40px; border: 0; background: none; color: var(--muted); font-size: 20px; line-height: 1; border-radius: 50%; }
.p-close:hover { color: var(--text); background: var(--line); }
body.has-player .toast { bottom: 108px; }

.toast {
  position: fixed; left: 50%; bottom: 92px; transform: translate(-50%, 8px);
  background: var(--text); color: var(--bg); font-size: 14px; padding: 8px 14px; border-radius: 10px;
  opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

@media (max-width: 640px) {
  .top { padding-block: 16px; }
  .top-nav { gap: 14px; }
  .lede { font-size: 16px; }
  .track { grid-template-columns: 40px 1fr; gap: 0 12px; }
  .play { width: 40px; height: 40px; }
  .dur { margin-left: 0; }
  .meter { height: 38px; --gap: 1px; }
  .foot { grid-template-columns: 1fr; padding-bottom: 120px; }
  .examples, .filter-row { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin-inline: calc(-1 * var(--gutter)); padding-inline: var(--gutter); }
  .examples::-webkit-scrollbar, .filter-row::-webkit-scrollbar { display: none; }
  .examples button, .seg, .toggle { flex: none; }
  .seg button { white-space: nowrap; }
  .moods, .genres { margin-inline: calc(-1 * var(--gutter)); padding-inline: var(--gutter); }
  .genres { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; padding-bottom: 4px; }
}
@media (max-width: 640px) {
  .filter-row { flex-wrap: wrap; overflow: visible; margin-inline: 0; padding-inline: 0; gap: 8px; }
  .filter-row .seg, .more-filters .seg { max-width: 100%; overflow-x: auto; scrollbar-width: none; }
  .filter-row .seg::-webkit-scrollbar, .more-filters .seg::-webkit-scrollbar { display: none; }
  .more-filters { justify-items: stretch; }
  .more-filters .seg { justify-self: start; }
  /* sticky bar stays two short lines: count · sort · filters, then the chosen filters in one scrolling row */
  .active { order: 5; width: 100%; flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none;
    -webkit-mask-image: linear-gradient(90deg, #000 calc(100% - 28px), transparent);
    mask-image: linear-gradient(90deg, #000 calc(100% - 28px), transparent); }
  .active::-webkit-scrollbar { display: none; }
  .active:empty { display: none; }
  .chip-x, .reset { flex: none; white-space: nowrap; }
  .moods, .genres, .examples, .trend-ctl .seg, .tops-groups, .filter-row .seg {
    -webkit-mask-image: linear-gradient(90deg, #000 calc(100% - 28px), transparent);
    mask-image: linear-gradient(90deg, #000 calc(100% - 28px), transparent);
  }
  .seg button, .genre, .mood, .examples button, .chip-x, .reset, .sort select { min-height: 40px; }
  .actions button, .actions a { min-height: 44px; display: inline-flex; align-items: center; }
  .lang button { min-height: 40px; padding-inline: 12px; }
  .to-filters { display: inline-flex; align-items: center; min-height: 40px; margin-left: auto; }
  .sort { margin-left: 0; }
  .sum { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
  .uses { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; margin-top: 14px; }
  .actions .wide { display: none; }
  .details .narrow { display: flex; }
  .meta { margin-left: 0; width: 100%; }
  .track .play { margin-top: -6px; }
}
@media (prefers-reduced-motion: reduce) {
  .rise .meter span { animation: none; }
  .toast { transition: none; }
}

/* tops */
.lang.view { margin-right: 4px; }
.tops { padding-block: clamp(20px, 4vw, 44px) 8px; }
.tops-h { font: 500 clamp(28px, 4.6vw, 46px)/1.08 var(--display); letter-spacing: -0.035em; margin: 0 0 10px; }
.tops-groups { display: inline-flex; margin: 18px 0 12px; }
.tops-lists .genre { cursor: pointer; }
.trow { display: grid; grid-template-columns: 44px 1fr; gap: 0 16px; padding: 18px 0; border-bottom: 1px solid var(--line); }
.trow .rank { color: var(--muted); font-size: 15px; padding-top: 2px; text-align: center; }
.trow h3 { margin: 0; font-size: 17px; font-weight: 600; }
.trow .sub { color: var(--muted); font-size: 14px; }
.trow p { margin: 6px 0 0; color: #C9CBD1; font-size: 14px; max-width: 72ch; }
.badges { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.badge { font-size: 12px; color: var(--muted); border: 1px solid var(--line); border-radius: 6px; padding: 2px 7px; }
.trow p.tags { color: var(--muted); font-size: 13px; margin-top: 6px; }
.legend-line { color: var(--muted); font-size: 13px; margin: 6px 0 0; max-width: 72ch; }
.badge.hot { color: var(--text); border-color: var(--muted); }
.badge.warn { color: var(--text); border-style: dashed; border-color: var(--muted); }
@media (max-width: 640px) {
  .trow { grid-template-columns: 32px 1fr; gap: 0 10px; }
  .tops-groups { display: flex; overflow-x: auto; scrollbar-width: none; max-width: 100%; }
  .tops-groups::-webkit-scrollbar { display: none; }
  .tops-groups button { flex: none; white-space: nowrap; }
  .top-nav > a { display: none; }  /* GitHub link stays in the footer on phones */
}
.trend-ctl { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 12px; }
.trend-ctl .seg button.na { opacity: .45; }
.acts .genre small { color: var(--muted); margin-left: 4px; font-size: 12px; }
.badge.new { color: var(--text); border-color: var(--muted); }
#sfx-view .search { margin-top: 14px; }
@media (max-width: 640px) {
  .trend-ctl { flex-wrap: nowrap; flex-direction: column; align-items: stretch; }
  .trend-ctl .seg { overflow-x: auto; scrollbar-width: none; max-width: 100%; }
  .trend-ctl .seg::-webkit-scrollbar { display: none; }
  .trend-ctl .seg button { flex: none; white-space: nowrap; }
}
@media (max-width: 480px) {  /* logo on its own row, then view tabs + language: nothing clipped at 375 px */
  .top { flex-wrap: wrap; row-gap: 12px; }
  .top-nav { width: 100%; justify-content: space-between; gap: 8px; }
  .lang.view { margin-right: 0; }
}
.sfx-count, #sfx-count { margin-top: 12px; }
