:root {
  --bg: #000; --bar: #0d0d0d; --line: #262626; --line-2: #333;
  --text: #f4f4f4; --muted: #9a9a9a; --dim: #8a8a8a;
  --ok: #5fbf6a; --warn: #ff6b5e;
  --sans: "Space Grotesk", system-ui, -apple-system, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, Menlo, monospace;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); font: 15px/1.35 var(--sans); -webkit-font-smoothing: antialiased; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; padding: 0; }
img { display: block; }
:focus-visible { outline: 2px solid var(--text); outline-offset: 2px; }

/* ---------- header ---------- */
.top { position: sticky; top: 0; z-index: 5; background: rgba(0,0,0,.88); backdrop-filter: saturate(1.4) blur(14px);
  -webkit-backdrop-filter: saturate(1.4) blur(14px); padding: max(18px, env(safe-area-inset-top)) 16px 12px; }
.bar { display: flex; justify-content: space-between; align-items: center; max-width: 1240px; margin: 0 auto; }
h1 { margin: 0; font-size: 22px; font-weight: 700; letter-spacing: -.03em; }
.status { margin: 0; font: 11px var(--mono); color: var(--muted); }
.status::before { content: "●"; color: var(--ok); margin-right: 6px; }
.status.stale { color: var(--warn); }
.status.stale::before { color: var(--warn); }

.tabs { display: flex; gap: 20px; max-width: 1240px; margin: 14px auto 12px; }
.tabs button { font-size: 15px; font-weight: 500; color: var(--muted); padding: 4px 0; }
.tabs button.on { color: var(--text); }
.tabs span { font: 11px var(--mono); color: var(--dim); margin-left: 2px; }

.chips { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; max-width: 1240px; margin: 0 auto;
  mask-image: linear-gradient(90deg, #000 92%, transparent); }
.chips::-webkit-scrollbar { display: none; }
.chip { flex: none; height: 32px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--line-2);
  font-size: 13px; font-weight: 500; color: #d6d6d6; display: inline-flex; align-items: center; gap: 6px; }
.chip .n { font: 10px var(--mono); color: var(--dim); }
.chip.on { background: var(--text); border-color: var(--text); color: #000; }
.chip.on .n { color: #555; }

/* ---------- feed ---------- */
.feed { max-width: 1240px; margin: 0 auto; padding: 4px 16px 80px; }
.day { display: flex; justify-content: space-between; margin: 26px 0 12px; font: 11px var(--mono);
  text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.day:first-child { margin-top: 10px; }
.grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 22px 12px; }
@media (min-width: 640px) { .grid { grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 28px 18px; } }

.card { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.cover { position: relative; aspect-ratio: 1; border-radius: 4px; overflow: hidden; background: #151515; width: 100%; }
.cover img { width: 100%; height: 100%; object-fit: cover; transition: opacity .2s, transform .3s; }
.cover:hover img { transform: scale(1.02); }
.card.heard .cover img { opacity: .42; }
.cover .none { position: absolute; inset: 0; display: grid; place-items: center; padding: 12px; text-align: center;
  font: 11px/1.4 var(--mono); color: var(--muted); text-decoration: none; }

.meta { display: flex; gap: 6px; align-items: flex-start; }
.titles { flex: 1; min-width: 0; }
.album { font-size: 14px; font-weight: 500; line-height: 1.2; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.artist { font-size: 13px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.genre { font: 10px var(--mono); color: var(--dim); text-transform: uppercase; letter-spacing: .06em; margin-top: 5px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.genre a { color: inherit; text-decoration: none; }
.genre a:hover { color: var(--text); }
.mini { flex: none; width: 30px; height: 30px; display: grid; place-items: center; color: #6f6f6f; border-radius: 6px; margin-top: -4px; }
.mini:hover { color: var(--text); background: #141414; }
.mini.on { color: var(--text); }
.mini.on svg path { fill: currentColor; }
.empty { color: var(--muted); text-align: center; padding: 80px 0; font-size: 14px; }


/* ---------- LINKS menu ---------- */
.titles { position: relative; }
.links { margin-top: 4px; width: max-content; }
.links summary { list-style: none; cursor: pointer; font: 500 10px var(--mono); text-transform: uppercase; letter-spacing: .08em;
  color: var(--text); padding: 4px 0; display: inline-flex; align-items: center; gap: 4px; }
.links summary::-webkit-details-marker { display: none; }
.links summary::after { content: "▾"; font-size: 9px; color: var(--muted); transition: transform .15s; }
.links[open] summary::after { transform: rotate(180deg); }
.links summary:hover { color: #fff; text-decoration: underline; text-underline-offset: 3px; }
.links-menu { position: absolute; z-index: 4; left: 0; margin-top: 4px; min-width: 150px; background: #141414;
  border: 1px solid var(--line-2); border-radius: 8px; padding: 4px; box-shadow: 0 10px 30px rgba(0,0,0,.6); }
.links-menu a { display: flex; justify-content: space-between; align-items: center; gap: 16px; min-height: 40px;
  padding: 0 10px; border-radius: 5px; color: var(--text); text-decoration: none; font-size: 14px; }
.links-menu a:hover, .links-menu a:focus-visible { background: #222; }
.links-menu a span { color: var(--muted); font-size: 12px; }
.cover .none { color: var(--muted); }
button.cover { cursor: pointer; }

/* ---------- pull to refresh ---------- */
html, body { overscroll-behavior-y: contain; }   /* our own pull handling instead of the browser's */
.ptr { position: fixed; z-index: 20; left: 50%; top: calc(env(safe-area-inset-top) + 8px); width: 40px; height: 40px;
  border-radius: 50%; background: #1a1a1a; border: 1px solid var(--line-2); color: var(--muted);
  display: grid; place-items: center; opacity: 0; transform: translate(-50%, -44px); pointer-events: none;
  box-shadow: 0 6px 20px rgba(0,0,0,.5); }
.ptr.ready { color: var(--text); }
.ptr.spinning svg { animation: ptr-spin .7s linear infinite; }
@keyframes ptr-spin { to { transform: rotate(360deg); } }
.toast { position: fixed; z-index: 20; left: 50%; bottom: calc(env(safe-area-inset-bottom) + 24px);
  transform: translate(-50%, 20px); opacity: 0; transition: opacity .2s, transform .2s; pointer-events: none;
  background: var(--text); color: #000; font: 500 13px var(--sans); padding: 9px 16px; border-radius: 999px; white-space: nowrap; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
@media (prefers-reduced-motion: reduce) { .ptr.spinning svg { animation-duration: 2s; } }

/* ---------- search ---------- */
.bar { position: relative; min-height: 40px; }
.bar-right { display: flex; align-items: center; gap: 4px; }
.q-open { width: 40px; height: 40px; margin-right: -10px; display: grid; place-items: center; color: var(--text); border-radius: 50%; }
.q-open:hover { background: #1a1a1a; }
.search { position: absolute; inset: 0; display: flex; align-items: center; background: #000; animation: q-in .15s ease-out; }
.search[hidden] { display: none; }
@keyframes q-in { from { opacity: 0; transform: translateX(12px); } }
.search > svg { position: absolute; left: 13px; color: var(--muted); pointer-events: none; }
.search input { flex: 1; min-width: 0; height: 40px; padding: 0 44px 0 38px; border-radius: 999px; border: 1px solid #8a8a8a;
  background: #141414; color: var(--text); font: 16px var(--sans); outline: none; -webkit-appearance: none; appearance: none; }
.search input::placeholder { color: #777; }
.search input::-webkit-search-cancel-button { display: none; }
.q-clear { position: absolute; right: 2px; width: 36px; height: 36px; display: grid; place-items: center; color: var(--muted); border-radius: 50%; }
.q-clear:hover { color: var(--text); }
.chips[hidden] { display: none; }
@media (prefers-reduced-motion: reduce) { .search { animation: none; } }
