/* lost.fm — three styles on the same markup, picked via <html data-style>:
     lastfm   last.fm-ish: black masthead, red accents (default)
     minimal  airy, white, one accent, big covers
     rym      RateYourMusic-ish: dense, blue links, grey section bars
   Each has a light and a dark palette (data-theme / prefers-color-scheme). */

/* ================================================================ tokens */

:root {
  --font: Jost, Inter, "Noto Sans", "DejaVu Sans", ui-sans-serif, system-ui, sans-serif;
  --font-head: "League Spartan", Jost, ui-sans-serif, system-ui, sans-serif;
  --fs: 16px;
  --lh: 1.55;

  --bg: #ffffff;
  --surface: #ffffff;
  --ink: #111111;
  --dim: #737373;
  --line: #e6e6e6;
  --soft: #f3f3f3;
  --link: #111111;
  --accent: #111111;
  --accent-ink: #ffffff;
  --star: #f59e0b;
  --star-empty: #dedede;
  --love: #e11d48;
  --flash: #f3f3f3;
  --err: #c62828;
  --cover-bg: #ececec;
  --cover-ink: #a3a3a3;

  --nav-bg: #ffffff;
  --nav-ink: #111111;
  --nav-dim: #8a8a8a;
  --nav-line: #e6e6e6;

  --radius: 8px;
  --cover-radius: 6px;
  --box-bg: transparent;
  --box-border: var(--line);
  --box-pad: 20px;
  --head: 34px;
  --sec-size: 13px;
  --sec-weight: 600;
  --sec-color: var(--dim);
  --sec-bg: transparent;
  --sec-pad: 0 0 10px;
  --sec-line: 1px solid var(--line);
  --grid-min: 160px;
  --grid-gap: 28px 22px;
  --wrap: 1120px;
  --tab-accent: #d51007;
  color-scheme: light;
}

:root[data-theme="dark"] {
  --bg: #0f0f10; --surface: #161618; --ink: #ededed; --dim: #8c8c8c;
  --line: #27272a; --soft: #1c1c1f; --link: #ededed; --accent: #ededed; --accent-ink: #111111;
  --star: #fbbf24; --star-empty: #3a3a3e; --love: #fb7185; --flash: #1c1c1f; --err: #f87171;
  --cover-bg: #1f1f22; --cover-ink: #55555a;
  --nav-bg: #0f0f10; --nav-ink: #ededed; --nav-dim: #8c8c8c; --nav-line: #27272a;
  color-scheme: dark;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0f0f10; --surface: #161618; --ink: #ededed; --dim: #8c8c8c;
    --line: #27272a; --soft: #1c1c1f; --link: #ededed; --accent: #ededed; --accent-ink: #111111;
    --star: #fbbf24; --star-empty: #3a3a3e; --love: #fb7185; --flash: #1c1c1f; --err: #f87171;
    --cover-bg: #1f1f22; --cover-ink: #55555a;
    --nav-bg: #0f0f10; --nav-ink: #ededed; --nav-dim: #8c8c8c; --nav-line: #27272a;
    color-scheme: dark;
  }
}

/* ---- rym */
:root[data-style="rym"] {
  --font: Jost, Inter, "Noto Sans", "DejaVu Sans", ui-sans-serif, system-ui, sans-serif;
  --font-head: "League Spartan", Jost, ui-sans-serif, system-ui, sans-serif;
  --fs: 15px;
  --lh: 1.45;
  --bg: #f4f4f4; --surface: #ffffff; --ink: #222222; --dim: #6b6b6b;
  --line: #d4d4d4; --soft: #ececec; --link: #1f56a8; --accent: #1f56a8; --accent-ink: #ffffff;
  --star: #e8a317; --star-empty: #d6d6d6; --love: #c62828; --flash: #fff8dc; --err: #c62828;
  --cover-bg: #dcdfe4; --cover-ink: #8b95a3;
  --nav-bg: #26323f; --nav-ink: #ffffff; --nav-dim: #b5c0cc; --nav-line: #26323f;
  --radius: 3px;
  --cover-radius: 0;
  --box-bg: var(--surface);
  --box-pad: 14px;
  --head: 26px;
  --sec-size: 14px;
  --sec-weight: 700;
  --sec-color: var(--ink);
  --sec-bg: #e4e6e9;
  --sec-pad: 6px 10px;
  --sec-line: 0;
  --grid-min: 128px;
  --grid-gap: 18px 14px;
  --wrap: 1180px;
  --tab-accent: var(--link);
  color-scheme: light;
}
:root[data-style="rym"][data-theme="dark"] {
  --bg: #161718; --surface: #1e2022; --ink: #e2e2e2; --dim: #999999;
  --line: #34373b; --soft: #26292c; --link: #79aef2; --accent: #3d7fd6; --accent-ink: #ffffff;
  --star: #f2b630; --star-empty: #44484d; --love: #ef5350; --flash: #2c2814; --err: #ef5350;
  --cover-bg: #2a2e33; --cover-ink: #5d6670;
  --nav-bg: #0f1215; --nav-ink: #ffffff; --nav-dim: #9aa5b1; --nav-line: #0f1215;
  --sec-bg: #2a2d31;
  color-scheme: dark;
}
@media (prefers-color-scheme: dark) {
  :root[data-style="rym"]:not([data-theme="light"]) {
    --bg: #161718; --surface: #1e2022; --ink: #e2e2e2; --dim: #999999;
    --line: #34373b; --soft: #26292c; --link: #79aef2; --accent: #3d7fd6; --accent-ink: #ffffff;
    --star: #f2b630; --star-empty: #44484d; --love: #ef5350; --flash: #2c2814; --err: #ef5350;
    --cover-bg: #2a2e33; --cover-ink: #5d6670;
    --nav-bg: #0f1215; --nav-ink: #ffffff; --nav-dim: #9aa5b1; --nav-line: #0f1215;
    --sec-bg: #2a2d31;
    color-scheme: dark;
  }
}

/* ---- last.fm */
:root[data-style="lastfm"] {
  --font: Jost, Inter, "Noto Sans", "DejaVu Sans", ui-sans-serif, system-ui, sans-serif;
  --font-head: "League Spartan", Jost, ui-sans-serif, system-ui, sans-serif;
  --fs: 14px;
  --lh: 1.5;
  --bg: #ffffff; --surface: #ffffff; --ink: #222222; --dim: #707070;
  --line: #e5e5e5; --soft: #f4f4f4; --link: #222222; --accent: #d51007; --accent-ink: #ffffff;
  --star: #d51007; --star-empty: #dcdcdc; --love: #d51007; --flash: #fdf0ef; --err: #d51007;
  --cover-bg: #e9e9e9; --cover-ink: #a5a5a5;
  --nav-bg: #141414; --nav-ink: #ffffff; --nav-dim: #b5b5b5; --nav-line: #141414;
  --hero-star: #ff6a5e;
  --radius: 3px;
  --cover-radius: 0;
  --box-pad: 0;
  --head: 28px;
  --sec-size: 24px;
  --sec-weight: 400;
  --more: #1d63b5;
  --sec-color: var(--ink);
  --sec-bg: transparent;
  --sec-pad: 0 0 12px;
  --sec-line: 0;
  --grid-min: 160px;
  --grid-gap: 24px 18px;
  --wrap: 1180px;
  --tab-accent: #d51007;
  color-scheme: light;
}
:root[data-style="lastfm"][data-theme="dark"] {
  --bg: #121212; --surface: #1a1a1a; --ink: #f0f0f0; --dim: #9a9a9a;
  --line: #2c2c2c; --soft: #1f1f1f; --link: #f0f0f0; --accent: #e31b0e; --accent-ink: #ffffff;
  --star: #ff3b2f; --star-empty: #3a3a3a; --love: #ff3b2f; --flash: #2a1614; --err: #ff5a4f;
  --cover-bg: #242424; --cover-ink: #555555;
  --nav-bg: #000000; --nav-ink: #ffffff; --nav-dim: #a0a0a0; --nav-line: #000000;
  --tab-accent: #ff3b2f; --more: #7ab0f0;
  color-scheme: dark;
}
@media (prefers-color-scheme: dark) {
  :root[data-style="lastfm"]:not([data-theme="light"]) {
    --bg: #121212; --surface: #1a1a1a; --ink: #f0f0f0; --dim: #9a9a9a;
    --line: #2c2c2c; --soft: #1f1f1f; --link: #f0f0f0; --accent: #e31b0e; --accent-ink: #ffffff;
    --star: #ff3b2f; --star-empty: #3a3a3a; --love: #ff3b2f; --flash: #2a1614; --err: #ff5a4f;
    --cover-bg: #242424; --cover-ink: #555555;
    --nav-bg: #000000; --nav-ink: #ffffff; --nav-dim: #a0a0a0; --nav-line: #000000;
    --tab-accent: #ff3b2f; --more: #7ab0f0;
    color-scheme: dark;
  }
}


/* Koito's fonts: Jost for text, League Spartan for headings (both OFL, self-hosted). */
@font-face { font-family: Jost; font-style: normal; font-weight: 100 900; font-display: swap; src: url("fonts/jost.woff2") format("woff2"); }
@font-face { font-family: "League Spartan"; font-style: normal; font-weight: 100 900; font-display: swap; src: url("fonts/league-spartan.woff2") format("woff2"); }

/* ================================================================ base */

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: var(--fs)/var(--lh) var(--font);
  -webkit-font-smoothing: antialiased;
}
a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
code { background: var(--soft); padding: .1em .35em; border-radius: 4px; font-size: .9em; }
h1, h2, h3 { margin: 0; line-height: 1.2; }
h1, h2, h3, .sec, .page-h, .hero-stats dd, .k-num { font-family: var(--font-head); }
img { display: block; }
[hidden] { display: none !important; }
.defs { position: absolute; }

.wrap { max-width: var(--wrap); margin: 0 auto; padding: 0 20px; }
.dim { color: var(--dim); }
.small { font-size: .85em; }
.nowrap { white-space: nowrap; }
.inline { display: inline; margin: 0; }

/* ================================================================ header */

.top { background: var(--nav-bg); color: var(--nav-ink); border-bottom: 1px solid var(--nav-line); }
.top-in { display: flex; align-items: center; gap: 28px; min-height: 60px; flex-wrap: wrap; }
.logo { color: var(--nav-ink); font-weight: 700; font-size: 20px; letter-spacing: -.02em; }
.logo span { color: var(--nav-dim); font-weight: 500; }
.logo:hover { text-decoration: none; }
.dev-badge { margin-left: -8px; padding: 1px 6px; border-radius: 4px; background: #e8a33d; color: #111; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; }
.nav { display: flex; gap: 4px; flex-wrap: wrap; flex: 1; }
.nav a { color: var(--nav-dim); padding: 6px 12px; border-radius: var(--radius); font-weight: 500; }
.nav a:hover { color: var(--nav-ink); text-decoration: none; }
.nav a.on { color: var(--nav-ink); background: color-mix(in srgb, var(--nav-ink) 9%, transparent); }
.top-right { display: flex; align-items: center; gap: 14px; font-size: 14px; }
.top-right a, .link-btn { color: var(--nav-dim); }
.top-right a:hover, .link-btn:hover, .icon-btn:hover { color: var(--nav-ink); text-decoration: none; }
.icon-btn, .link-btn { background: none; border: 0; padding: 0; font: inherit; cursor: pointer; color: var(--nav-dim); }
.icon-btn { font-size: 18px; line-height: 1; }

.banner { background: var(--star); color: #1b1b1b; padding: 8px 0; font-weight: 500; }
.banner a { color: #1b1b1b; text-decoration: underline; }

main.wrap { padding-top: 32px; padding-bottom: 64px; }

.top-search { flex: 1; max-width: 380px; margin: 0; }
.top-search input {
  width: 100%; font-size: 14px; padding: 7px 12px; border: 0; border-radius: 999px;
  background: color-mix(in srgb, var(--nav-ink) 8%, transparent); color: var(--nav-ink);
}
:root[data-style="rym"] .top-search input { border-radius: var(--radius); }
.top-search input::placeholder { color: var(--nav-dim); }
.top-search input:focus { box-shadow: 0 0 0 2px color-mix(in srgb, var(--nav-ink) 25%, transparent); }
.top-right { margin-left: auto; }
.top-right a.on { color: var(--nav-ink); }

/* ---- last.fm style touches */
:root[data-style="lastfm"] .logo, :root[data-style="lastfm"] .logo span { color: #e31b23; font-weight: 700; }
:root[data-style="lastfm"] .sec.sec { text-transform: none; letter-spacing: 0; border-radius: 0; }
:root[data-style="lastfm"] .sec span { display: inline-block; }
:root[data-style="lastfm"] .sec span::first-letter { text-transform: uppercase; }
:root[data-style="lastfm"] .t-artist { color: var(--ink); }
:root[data-style="lastfm"] .card-title { font-weight: 700; }
:root[data-style="lastfm"] .cols { grid-template-columns: minmax(0, 1fr) 370px; gap: 30px; }
:root[data-style="lastfm"] main.wrap { padding-top: 24px; }

.top-avatar {
  width: 34px; height: 34px; flex: none; border-radius: 50%; overflow: hidden;
  display: grid; place-items: center; background: color-mix(in srgb, var(--nav-ink) 15%, transparent);
  color: var(--nav-ink); font-size: 15px; font-weight: 700;
}
.top-avatar img { width: 100%; height: 100%; object-fit: cover; }
.top-avatar:hover { text-decoration: none; opacity: .85; }

/* ================================================================ profile header (last.fm-style) */

.hero { position: relative; height: 152px; color: #fff; background: #1c1c1e; }
.hero-compact { height: 120px; }
.hero-clip { position: absolute; inset: 0; overflow: hidden; }
.hero-bg { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: center 35%; }
.hero-bg.blur { filter: blur(26px) saturate(1.25); transform: scale(1.3); }
.hero-shade { position: absolute; inset: 0; background: rgb(0 0 0 / .42); }
.hero-shade::after { /* last.fm's halftone screen */
  content: ""; position: absolute; inset: 0;
  background-image: radial-gradient(rgb(0 0 0 / .55) 0.9px, transparent 1.3px);
  background-size: 3px 3px;
}
.hero-in { position: relative; height: 100%; display: flex; gap: 30px; }
.hero-avatar {
  position: relative; z-index: 2; align-self: flex-start; margin-top: 42px;
  width: 170px; height: 170px; flex: none; border-radius: 50%; overflow: hidden;
  display: grid; place-items: center; background: #3a3a3e; color: #fff; font-size: 64px; font-weight: 700;
  box-shadow: 0 0 0 1px rgb(0 0 0 / .08);
}
.hero-avatar:hover { text-decoration: none; }
.hero-avatar img { width: 100%; height: 100%; object-fit: cover; }
.hero-main { flex: 1; min-width: 0; display: flex; flex-direction: column; padding-top: 46px; }
.hero-main h1 { font-size: 30px; font-weight: 700; line-height: 1.1; letter-spacing: -.01em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hero-main h1 a { color: #fff; }
.hero-main h1 a:hover { text-decoration: none; }
.hero-sub { margin: 4px 0 0; font-size: 12px; color: rgb(255 255 255 / .7); }
.tabs { margin-top: auto; display: flex; gap: 22px; overflow-x: auto; scrollbar-width: none; }
.tabs a {
  color: rgb(255 255 255 / .85); font-size: 14px; padding: 0 0 9px; white-space: nowrap;
  border-bottom: 4px solid transparent;
}
.tabs a:hover { color: #fff; text-decoration: none; }
.tabs a.on { color: #fff; font-weight: 700; border-bottom-color: var(--tab-accent); }
.hero-top { align-self: center; display: flex; align-items: center; gap: 14px; max-width: 340px; margin-top: -14px; color: #fff; text-align: right; }
.hero-top:hover { text-decoration: none; }
.hero-top:hover b { text-decoration: underline; }
.hero-top-text { display: flex; flex-direction: column; min-width: 0; line-height: 1.25; }
.hero-top-text > * { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hero-top-label { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: rgb(255 255 255 / .6); }
.hero-top-text b { font-size: 18px; }
.hero-top-text span:last-child { font-size: 16px; color: rgb(255 255 255 / .85); }
.hero-top-art { width: 70px; flex: none; }
.hero-top-art .cover { border: 0; border-radius: 0; box-shadow: none; font-size: 24px; }

.hero-below { display: flex; align-items: center; justify-content: space-between; gap: 20px; min-height: 80px; padding-left: 220px; }
.hero-stats { display: flex; gap: 18px; margin: 0; }
.hero-stats dt { font-size: 12px; font-weight: 500; text-transform: uppercase; color: var(--dim); }
.hero-stats dd { margin: 0; font-size: 18px; font-weight: 600; font-variant-numeric: tabular-nums; }
.hero-stats dd a { color: var(--ink); }
.hero-btn { text-transform: uppercase; font-size: 12px; font-weight: 700; letter-spacing: .02em; padding: 10px 20px; }

.hero-compact .hero-avatar { width: 84px; height: 84px; margin-top: 18px; font-size: 32px; }
.hero-compact .hero-main { padding-top: 24px; }
.hero-compact .hero-main h1 { font-size: 24px; }

/* ================================================================ chart rows (recent / top tracks) */

.chart { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--line); }
.chart li {
  display: grid; grid-template-columns: 32px minmax(0, 1fr) 150px 92px;
  align-items: center; gap: 14px; min-height: 50px; padding: 8px 14px; border-bottom: 1px solid var(--line);
}
.chart li:hover { background: var(--soft); }
:root[data-style="rym"] .chart { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
:root[data-style="rym"] .chart li:nth-child(even) { background: color-mix(in srgb, var(--soft) 55%, transparent); }
:root[data-style="rym"] .chart li:last-child { border-bottom: 0; }
.chart-art .cover { width: 32px; font-size: 13px; border-radius: 0; box-shadow: none; }
.chart-rate { justify-self: end; }
.chart-rate .half { width: 8px; height: 16px; }
.chart-rate .half svg { width: 8px; height: 16px; }
.chart-rate .rate-num { display: none; }
.chart-name { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; min-width: 0; font-size: 14px; }
.chart-name a { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chart-name .t-title { font-weight: 700; }
.chart-name .t-artist { font-size: 14px; }
.chart-name.chart-stack { display: flex; flex-direction: column; gap: 0; line-height: 1.3; }
.chart-time { text-align: right; color: var(--dim); font-size: 12px; white-space: nowrap; }
/* Top Tracks: five hand-picked covers, three on top and two centred below */
.top5 { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 20px 16px; max-width: 600px; }
.top5-item { grid-column: span 2; display: flex; flex-direction: column; min-width: 0; color: var(--ink); text-align: center; }
.top5-item:hover { text-decoration: none; }
.top5-item:hover .card-art { opacity: .85; }
.top5-item:nth-child(4) { grid-column: 2 / span 2; }
.top5-item:nth-child(5) { grid-column: 4 / span 2; }
.top5-item .card-title { margin-top: 8px; }
.top5-item .card-title, .top5-item .card-artist { font-size: 14px; }
.more-row { margin: 12px 0 0; text-align: right; }
.more-link { color: var(--more, var(--link)); font-size: 14px; }
.more-link::after { content: " ›"; font-weight: 700; }
.feature-form { margin: 0 0 20px; }




.col-side > section + section, .col-side > .col-side { gap: 32px; }
:root[data-style="lastfm"] .col-side { gap: 36px; }


/* ================================================================ activity + all-time stats (after Koito) */

.koito-row > section + section { margin-top: 0; }
.koito-row { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 24px 56px; margin-bottom: 44px; }
.k-head { font-size: 18px; font-weight: 400; text-transform: uppercase; letter-spacing: .02em; color: var(--dim); margin-bottom: 4px; }
.k-offset { margin-left: 24px; }
.k-card {
  --cell: 13px;
  display: flex; flex-direction: column; align-items: center; padding: 24px 28px;
  background: var(--surface); border: 1px solid var(--line); border-radius: max(var(--radius), 8px);
}
.heat { display: flex; align-items: flex-start; gap: 8px; }
.heat-days { display: grid; grid-template-rows: repeat(7, var(--cell)); gap: 3px; }
.heat-days span { font-size: 11px; line-height: var(--cell); color: var(--dim); text-align: right; }
.heat-grid { display: grid; grid-auto-flow: column; grid-template-rows: repeat(7, var(--cell)); grid-auto-columns: var(--cell); gap: 3px; }
.heat-grid i { display: block; width: var(--cell); height: var(--cell); border-radius: 3px; background: var(--soft); border: 1px solid var(--line); }
.heat-grid i.on { background: var(--tab-accent); border: 0; }
.heat-grid i.future { background: none; border: 0; }
.k-cols { display: flex; gap: 24px; margin-top: 24px; }
.k-cols p { margin: 0; font-size: 15px; line-height: 1.75; }
.k-num { font-size: 20px; font-weight: 700; }

/* ================================================================ blocks */

.box {
  background: var(--box-bg);
  border: 1px solid var(--box-border);
  border-radius: var(--radius);
  padding: var(--box-pad);
}
.narrow { max-width: 420px; margin: 40px auto; }
.page-h { font-size: var(--head); font-weight: 700; letter-spacing: -.02em; margin-bottom: 20px; }
.kicker { margin: 0 0 4px; font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .08em; color: var(--dim); }
.sec {
  display: flex; justify-content: space-between; align-items: baseline; gap: 8px;
  font-size: var(--sec-size); font-weight: var(--sec-weight); color: var(--sec-color);
  background: var(--sec-bg); padding: var(--sec-pad); border-bottom: var(--sec-line);
  border-radius: calc(var(--radius) - 1px);
  margin: 0 0 16px;
}
.sec a { font-size: 13px; font-weight: 500; }
:root:not([data-style="rym"]) .sec { text-transform: uppercase; letter-spacing: .08em; border-radius: 0; }
:root:not([data-style="rym"]) .sec a { text-transform: none; letter-spacing: 0; color: var(--dim); }
section + section { margin-top: 44px; }
:root[data-style="rym"] section + section { margin-top: 28px; }
.flash { background: var(--flash); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 14px; margin: 0 0 24px; }
.error { color: var(--err); font-weight: 600; }
.error.box { border-color: var(--err); }
.empty { color: var(--dim); }
.stars, .star-ink { color: var(--star); letter-spacing: .05em; }
.stars.big { font-size: 26px; }

.bio { margin: 0; white-space: pre-line; overflow-wrap: anywhere; }
.cols { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 48px; align-items: start; }
:root[data-style="rym"] .cols { gap: 24px; }
.col-side { display: grid; gap: 32px; }
:root[data-style="rym"] .col-side { gap: 20px; }
:root .col-side section + section { margin-top: 0; }
.col-side .box { padding: var(--box-pad); }
:root:not([data-style="rym"]) .col-side .box { border: 0; padding: 0; }

.rank { margin: 0; padding: 0 0 0 1.8em; color: var(--dim); }
.rank li { padding: 5px 0; border-bottom: 1px solid var(--soft); }
.rank li > * { vertical-align: middle; }
.rank li:last-child { border-bottom: 0; }
.rank li { display: list-item; }
.rank a { display: inline-block; vertical-align: top; max-width: calc(100% - 3em); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rank li span { float: right; }

/* ================================================================ histogram */

.hist { display: flex; align-items: flex-end; gap: 8px; }
.hist-end { font-size: 12px; white-space: nowrap; padding-bottom: 1px; }
.hist-bars { flex: 1; display: grid; grid-template-columns: repeat(10, 1fr); gap: 2px; height: 72px; align-items: end; border-bottom: 1px solid var(--line); }
.bar { height: 100%; display: flex; align-items: flex-end; }
.bar span { display: block; width: 100%; background: color-mix(in srgb, var(--dim) 35%, transparent); min-height: 1px; border-radius: 2px 2px 0 0; }
.bar:hover span { background: var(--star); }
.artist-hist { width: 280px; max-width: 100%; }

/* ================================================================ covers & cards */

.cover {
  width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: var(--cover-radius);
  background: var(--cover-bg);
  box-shadow: inset 0 0 0 1px rgb(0 0 0 / .06);
}
.cover-none { display: grid; place-items: center; color: var(--cover-ink); font-size: 34px; font-weight: 700; }
:root[data-style="rym"] .cover { border: 1px solid var(--line); }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(var(--grid-min), 1fr)); gap: var(--grid-gap); }
.card { display: flex; flex-direction: column; color: var(--ink); min-width: 0; }
.card:hover { text-decoration: none; }
.card-art { display: block; transition: opacity .15s; }
.card:hover .card-art { opacity: .85; }
.card-title { font-weight: 600; margin-top: 10px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.card-artist { color: var(--dim); font-size: .9em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.card-meta { display: flex; gap: 6px; font-size: .9em; min-height: 1.5em; }
:root[data-style="rym"] .card-title { margin-top: 6px; color: var(--link); font-size: 14px; }
:root[data-style="rym"] .card-artist { font-size: 13px; }

/* ================================================================ library */

.artist-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 24px; flex-wrap: wrap; margin-bottom: 28px; }
.artist-head h1 { font-size: var(--head); letter-spacing: -.02em; }
:root:not([data-style="rym"]) .artist-head { border: 0; padding: 0; }
.filters { display: flex; flex-wrap: wrap; gap: 10px 16px; align-items: center; margin-bottom: 16px; }
.filters input[type="search"] { flex: 1 1 240px; }
:root:not([data-style="rym"]) .filters { border: 0; padding: 0; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 16px 0 20px; }
.chips a { border: 1px solid var(--line); border-radius: 999px; padding: 2px 11px; color: var(--ink); background: var(--surface); font-size: 13px; }
:root[data-style="rym"] .chips a { border-radius: var(--radius); }
.chips a.stars-chip { color: var(--star); }
.chips a:hover { text-decoration: none; border-color: var(--dim); }
.chips a.on { background: var(--ink); border-color: var(--ink); color: var(--bg); }
.chips a.stars-chip.on { background: var(--star); border-color: var(--star); color: #1b1b1b; }
.bar-row { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 16px; }
.bar-row p { margin: 0; }
.view-toggle { display: flex; gap: 4px; align-items: center; margin: 0 0 20px; flex-wrap: wrap; color: var(--dim); font-size: 14px; }
.bar-row .view-toggle { margin: 0; }
.view-toggle a { padding: 3px 10px; border-radius: var(--radius); color: var(--dim); }
.view-toggle a:hover { text-decoration: none; color: var(--ink); }
.view-toggle a.on { background: var(--soft); color: var(--ink); }
.sub-h { font-size: 14px; font-weight: 600; margin: 20px 0 4px; padding-top: 16px; border-top: 1px solid var(--line); }
.pager { display: flex; justify-content: center; align-items: center; gap: 16px; margin-top: 36px; }

.table-wrap { overflow-x: auto; }
:root[data-style="rym"] .table-wrap { border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
table.tracks { width: 100%; border-collapse: collapse; }
.tracks th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--dim); font-weight: 600; border-bottom: 1px solid var(--line); padding: 8px 10px; }
:root[data-style="rym"] .tracks th { background: var(--sec-bg); color: var(--ink); text-transform: none; letter-spacing: 0; font-size: 13px; }
.tracks td { padding: 10px; border-bottom: 1px solid var(--soft); vertical-align: middle; }
:root[data-style="rym"] .tracks td { padding: 6px 10px; }
:root[data-style="rym"] .tracks tbody tr:nth-child(even) { background: color-mix(in srgb, var(--soft) 55%, transparent); }
.tracks tr:last-child td { border-bottom: 0; }
.tracks tbody tr:hover { background: var(--soft); }
.c-art { width: 64px; }
.c-art .cover { width: 48px; font-size: 16px; }
:root[data-style="rym"] .c-art { width: 52px; }
:root[data-style="rym"] .c-art .cover { width: 40px; }
.t-title { font-weight: 600; color: var(--ink); }
:root[data-style="rym"] .t-title { color: var(--link); }
.t-artist { font-size: .9em; color: var(--dim); }
:root[data-style="rym"] .t-artist { color: var(--link); font-weight: 400; }
.num { text-align: right; }

/* ================================================================ rating widget */

.rate { display: inline-flex; align-items: center; gap: 6px; margin: 0; }
.rate-stars { display: inline-flex; }
.half {
  background: none; border: 0; padding: 0; margin: 0; cursor: pointer;
  width: 11px; height: 22px; color: var(--star-empty); line-height: 0;
}
.half svg { width: 11px; height: 22px; fill: currentColor; }
.half.on { color: var(--star); }
.rate-stars:hover .half { color: var(--star-empty); }
.rate-stars:hover .half:hover,
.rate-stars:hover .half:has(~ .half:hover) { color: var(--star); }
.half:focus-visible { outline: 2px solid var(--link); outline-offset: 1px; }
.rate-clear { background: none; border: 0; color: var(--dim); cursor: pointer; font: inherit; font-size: 16px; padding: 0 2px; }
.rate-clear:hover { color: var(--err); }
.rate-num { font-size: 13px; color: var(--dim); min-width: 2ch; font-variant-numeric: tabular-nums; }
.track-actions .half { width: 18px; height: 36px; }
.track-actions .half svg { width: 18px; height: 36px; }


/* ================================================================ track page */

.track { display: grid; grid-template-columns: minmax(0, 340px) minmax(0, 1fr); gap: 44px; align-items: start; margin-bottom: 48px; }
:root[data-style="rym"] .track { gap: 28px; grid-template-columns: minmax(0, 280px) minmax(0, 1fr); }
.track-art .cover { font-size: 96px; box-shadow: 0 10px 30px rgb(0 0 0 / .12); }
:root[data-style="rym"] .track-art .cover { box-shadow: none; }
.track h1 { font-size: 38px; letter-spacing: -.02em; margin: 0 0 4px; overflow-wrap: anywhere; }
:root[data-style="rym"] .track h1 { font-size: 28px; }
.by { margin: 0 0 24px; font-size: 18px; color: var(--dim); }
.by a { color: var(--ink); font-weight: 500; }
:root[data-style="rym"] .by a { color: var(--link); }
.track-actions { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 24px; }
.meta { display: grid; grid-template-columns: max-content 1fr; gap: 6px 24px; margin: 0 0 24px; }
.meta dt { color: var(--dim); font-size: 14px; }
.meta dd { margin: 0; overflow-wrap: anywhere; }
:root[data-style="rym"] .meta { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 14px; gap: 4px 20px; }
:root[data-style="rym"] .meta dt { font-weight: 600; color: var(--ink); }
.note { white-space: pre-wrap; margin-bottom: 24px; }
:root:not([data-style="rym"]) .note { border: 0; border-left: 3px solid var(--line); border-radius: 0; padding: 4px 0 4px 16px; }
.edit summary { cursor: pointer; font-weight: 600; }
.edit[open] summary { margin-bottom: 16px; }
.danger { margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--line); }

/* ================================================================ forms */

input, select, textarea {
  font: inherit; font-size: 15px; color: var(--ink); background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--radius); padding: 8px 10px;
}
:root[data-style="rym"] input, :root[data-style="rym"] select, :root[data-style="rym"] textarea { padding: 5px 8px; font-size: 14px; }
input:focus, select:focus, textarea:focus { outline: 0; border-color: var(--link); box-shadow: 0 0 0 3px color-mix(in srgb, var(--link) 18%, transparent); }
:root:not([data-style="rym"]) input:focus, :root:not([data-style="rym"]) select:focus, :root:not([data-style="rym"]) textarea:focus { border-color: var(--dim); box-shadow: 0 0 0 3px var(--soft); }
textarea { resize: vertical; width: 100%; }
.form { display: grid; gap: 14px; }
.form label { display: grid; gap: 5px; font-size: 13px; font-weight: 500; color: var(--dim); }
.form .row { display: flex; gap: 14px; flex-wrap: wrap; align-items: end; }
label.chk, .form label.chk { display: inline-flex; align-items: center; gap: 7px; cursor: pointer; color: var(--ink); font-size: 15px; font-weight: 400; }
.filters label:not(.chk) { display: inline-flex; gap: 8px; align-items: center; color: var(--dim); font-size: 14px; }
input[type="checkbox"] { width: 16px; height: 16px; accent-color: var(--accent); padding: 0; }
.btn {
  font: inherit; font-size: 15px; font-weight: 600; cursor: pointer; display: inline-block; white-space: nowrap;
  background: var(--accent); color: var(--accent-ink); border: 1px solid var(--accent);
  border-radius: var(--radius); padding: 8px 16px;
}
:root[data-style="rym"] .btn { padding: 5px 12px; font-size: 14px; }
.btn:hover { text-decoration: none; filter: brightness(1.12); }
.btn-ghost { background: transparent; color: var(--ink); border-color: var(--line); }
.btn-ghost:hover { border-color: var(--dim); filter: none; }
.btn-danger { background: var(--err); border-color: var(--err); color: #fff; }

/* ================================================================ add page */

.search { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 28px; }
.search input { flex: 1 1 260px; }
:root:not([data-style="rym"]) .search { border: 0; padding: 0; }
.results { list-style: none; padding: 0; margin: 0 0 24px; display: grid; gap: 0; }
.result { display: grid; grid-template-columns: 64px minmax(0, 1fr) auto; gap: 16px; align-items: center; padding: 12px 0; border: 0; border-bottom: 1px solid var(--line); border-radius: 0; background: none; }
:root[data-style="rym"] .results { border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
:root[data-style="rym"] .result { padding: 8px 12px; }
:root[data-style="rym"] .result:last-child { border-bottom: 0; }
.result-art .cover { width: 64px; font-size: 20px; }
.result-info { display: flex; flex-direction: column; min-width: 0; }
.result-info > * { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.result-add { display: flex; gap: 8px; align-items: center; margin: 0; flex-wrap: wrap; justify-content: flex-end; }

/* ================================================================ settings */

.t-added { display: none; }
.settings { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 32px; align-items: start; }
.settings > *, .stack > *, .form > * { min-width: 0; }
.settings code { overflow-wrap: anywhere; }
.form input, .form select, .form textarea { max-width: 100%; min-width: 0; }
.settings .sec { margin-top: 12px; }
.stack { display: grid; gap: 32px; }
.stack section + section { margin-top: 0; }

.img-row { display: flex; align-items: center; gap: 16px; }
.avatar-prev {
  width: 64px; height: 64px; flex: none; border-radius: 50%; object-fit: cover;
  display: grid; place-items: center; background: var(--soft); color: var(--dim); font-size: 26px; font-weight: 700;
}
.banner-prev { width: 100%; aspect-ratio: 4 / 1; object-fit: cover; border-radius: var(--radius); }
input[type="file"] { padding: 6px; font-size: 14px; }

/* ================================================================ small screens */

@media (max-width: 860px) {
  .cols, .settings, :root[data-style] .cols { grid-template-columns: 1fr; }
  .track, :root[data-style="rym"] .track { grid-template-columns: 1fr; }
  .track-art { max-width: 340px; }
}
@media (max-width: 600px) {
  .wrap { padding: 0 16px; }
  .hide-sm { display: none; }
  .top-in { gap: 8px 16px; padding-top: 10px; padding-bottom: 10px; }
  .nav { order: 3; flex-basis: 100%; margin-left: -12px; }
  .top-right { margin-left: auto; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 20px 14px; }
  :root[data-style="rym"] .grid { grid-template-columns: repeat(auto-fill, minmax(100px, 1fr)); }
  .result { grid-template-columns: 48px minmax(0, 1fr) auto; gap: 12px; padding: 10px 0; }
  .result-art .cover { width: 48px; }
  .result .btn { padding: 6px 10px; font-size: 13px; white-space: nowrap; }
  .search select { flex: 1; }
  .track h1 { font-size: 28px; }
  .top-search { order: 3; flex-basis: 100%; max-width: none; }
  .hero, .hero-compact { height: auto; }
  .hero-in { gap: 16px; padding-bottom: 0; }
  .hero-avatar { width: 92px; height: 92px; margin-top: 22px; font-size: 36px; }
  .hero-main { padding-top: 30px; }
  .hero-main h1 { font-size: 24px; }
  .tabs { margin-top: 18px; gap: 14px; }
  .hero-top { display: none; }
  .hero-compact .hero-avatar { width: 64px; height: 64px; margin-top: 16px; font-size: 26px; }
  .hero-compact .hero-main { padding-top: 22px; }
  .hero-compact .hero-main h1 { font-size: 20px; }
  .hero-below { padding-left: 16px; padding-top: 12px; padding-bottom: 4px; min-height: 0; flex-wrap: wrap; }
  .hero-stats { gap: 14px; flex-wrap: wrap; }
  .hero-stats dt { font-size: 11px; }
  .chart li { grid-template-columns: 32px minmax(0, 1fr) auto; row-gap: 2px; padding: 8px 6px; gap: 10px; }
  .chart-name { grid-template-columns: 1fr; gap: 0; }
  .chart-rate { grid-column: 2; grid-row: 2; justify-self: start; }
  .chart-rate:empty, .chart-rate:not(:has(*)) { display: none; }
  .chart-time { grid-column: 3; grid-row: 1; font-size: 12px; }
  /* last 20 weeks, cells sized to fill the card */
  .heat-grid i:nth-child(-n+112) { display: none; }
  .heat-days span { font-size: 9px; }
  .k-activity { width: 100%; }
  .k-card { --cell: min(15px, calc((100vw - 100px) / 20 - 3px)); padding: 16px; }
  /* library filters: two columns instead of a tall stack, one scrollable chip row */
  .filters { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
  .filters input[type="search"] { grid-column: 1 / -1; }
  .filters label:not(.chk) { display: flex; }
  .filters label select { flex: 1; min-width: 0; }
  .chips { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin: 12px -16px 16px; padding: 0 16px; }
  .chips a { flex: none; }
  .tracks .t-added { display: inline-block; font-size: 12px; white-space: pre; }
  .tracks .half, .tracks .half svg { width: 9px; height: 18px; }
  .tracks .rate-num, .tracks .rate-clear { display: none; }
  .settings .box { padding: 16px; }
  .k-offset { margin-left: 0; }
  .koito-row { gap: 28px; }
}
