:root {
  --bg: #000;
  --panel: #121212;
  --elev: #1a1a1a;
  --hover: #232323;
  --fg: #fff;
  --muted: #b3b3b3;
  --dim: #afafaf;
  --line: #2a2a2a;
  --accent: #ee6c3f;
  --accent-hi: #ff8456;
  --radius: 10px;
  --np-h: 84px;
  --on-accent: #140e0b;
  --cancel-filter: invert(1);
  color-scheme: dark;
}

/* ---------- themes ---------- */
/* every palette only sets the core tokens; components stay theme-agnostic */

/* Dracula */
html[data-theme="dracula"] {
  --bg: #21222c;
  --panel: #282a36;
  --elev: #343746;
  --hover: #44475a;
  --fg: #f8f8f2;
  --muted: #b8bcc8;
  --dim: #b4b8c4;
  --line: #44475a;
  --accent: #bd93f9;
  --accent-hi: #ff79c6;
  --on-accent: #21222c;
}

/* Catppuccin — Mocha */
html[data-theme="catppuccin"] {
  --bg: #11111b;
  --panel: #1e1e2e;
  --elev: #313244;
  --hover: #45475a;
  --fg: #cdd6f4;
  --muted: #a6adc8;
  --dim: #a3a9c4;
  --line: #313244;
  --accent: #cba6f7;
  --accent-hi: #f5c2e7;
  --on-accent: #11111b;
}

/* Catppuccin — Macchiato */
html[data-theme="catppuccin-macchiato"] {
  --bg: #181926;
  --panel: #24273a;
  --elev: #363a4f;
  --hover: #494d64;
  --fg: #cad3f5;
  --muted: #a5adcb;
  --dim: #a2aac7;
  --line: #363a4f;
  --accent: #c6a0f6;
  --accent-hi: #f5bde6;
  --on-accent: #181926;
}

/* Catppuccin — Frappé */
html[data-theme="catppuccin-frappe"] {
  --bg: #232634;
  --panel: #303446;
  --elev: #414559;
  --hover: #51576d;
  --fg: #c6d0f5;
  --muted: #acb4d6;
  --dim: #acb4d6;
  --line: #414559;
  --accent: #ca9ee6;
  --accent-hi: #f4b8e4;
  --on-accent: #232634;
}

/* Catppuccin — Latte (light) */
html[data-theme="catppuccin-latte"] {
  --bg: #dce0e8;
  --panel: #eff1f5;
  --elev: #e6e9ef;
  --hover: #ccd0da;
  --fg: #4c4f69;
  --muted: #5d6078;
  --dim: #5d6078;
  --line: #ccd0da;
  --accent: #8839ef;
  --accent-hi: #ea76cb;
  --accent-text: color-mix(in srgb, var(--accent) 60%, var(--fg));
  --cancel-filter: invert(0);
  color-scheme: light;
  --on-accent: #ffffff;
}

/* Nord */
html[data-theme="nord"] {
  --bg: #242933;
  --panel: #2e3440;
  --elev: #3b4252;
  --hover: #434c5e;
  --fg: #eceff4;
  --muted: #d8dee9;
  --dim: #d4dae5;
  --line: #434c5e;
  --accent: #88c0d0;
  --accent-hi: #8fbcbb;
  --on-accent: #242933;
}

/* Rosé Pine */
html[data-theme="rose-pine"] {
  --bg: #191724;
  --panel: #1f1d2e;
  --elev: #26233a;
  --hover: #403d52;
  --fg: #e0def4;
  --muted: #908caa;
  --dim: #908caa;
  --line: #26233a;
  --accent: #c4a7e7;
  --accent-hi: #ebbcba;
  --on-accent: #191724;
}

/* Rosé Pine — Moon */
html[data-theme="rose-pine-moon"] {
  --bg: #232136;
  --panel: #2a273f;
  --elev: #393552;
  --hover: #44415a;
  --fg: #e0def4;
  --muted: #a4a0bc;
  --dim: #a4a0bc;
  --line: #393552;
  --accent: #c4a7e7;
  --accent-hi: #ea9a97;
  --on-accent: #232136;
}

/* Rosé Pine — Dawn (light) */
html[data-theme="rose-pine-dawn"] {
  --bg: #faf4ed;
  --panel: #fffaf3;
  --elev: #f2e9e1;
  --hover: #dfdad9;
  --fg: #575279;
  --muted: #696487;
  --dim: #696487;
  --line: #f2e9e1;
  --accent: #907aa9;
  --accent-hi: #d7827e;
  --accent-text: color-mix(in srgb, var(--accent) 30%, var(--fg));
  --cancel-filter: invert(0);
  color-scheme: light;
  --on-accent: #000000;
}

/* Tokyo Night */
html[data-theme="tokyo-night"] {
  --bg: #1a1b26;
  --panel: #16161e;
  --elev: #292e42;
  --hover: #3b4261;
  --fg: #c0caf5;
  --muted: #a9b1d6;
  --dim: #a5add1;
  --line: #292e42;
  --accent: #7aa2f7;
  --accent-hi: #bb9af7;
  --on-accent: #1a1b26;
}

/* Solarized — Dark */
html[data-theme="solarized-dark"] {
  --bg: #002b36;
  --panel: #073642;
  --elev: #0d4b58;
  --hover: #15505f;
  --fg: #bdc6c6;
  --muted: #aab6b6;
  --dim: #aab6b6;
  --line: #073642;
  --accent: #268bd2;
  --accent-hi: #2aa198;
  --on-accent: #000000;
}

/* Solarized — Light (light) */
html[data-theme="solarized-light"] {
  --bg: #fdf6e3;
  --panel: #eee8d5;
  --elev: #e6dfcb;
  --hover: #d9d2be;
  --fg: #48585e;
  --muted: #51656b;
  --dim: #51656b;
  --line: #eee8d5;
  --accent: #268bd2;
  --accent-hi: #6c71c4;
  --cancel-filter: invert(0);
  color-scheme: light;
  --on-accent: #000000;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font: 14px/1.5 ui-sans-serif, system-ui, -apple-system, "Segoe UI", "Noto Sans", "DejaVu Sans", Roboto, sans-serif;
  -webkit-text-size-adjust: 100%;
  overflow: hidden;
}
a { color: inherit; text-decoration: none; }
a:hover { text-decoration: underline; }
button { font: inherit; color: inherit; }
.ic { width: 1em; height: 1em; flex: none; display: inline-block; vertical-align: -.125em; }
:focus-visible { outline: 2px solid var(--accent-hi); outline-offset: 2px; }

/* ---------- shell ---------- */
.app {
  display: grid;
  grid-template-columns: clamp(250px, 24vw, 340px) minmax(0, 1fr);
  grid-template-rows: minmax(0, 1fr) var(--np-h);
  gap: 8px;
  padding: 8px;
  height: 100vh;
  height: 100dvh;
}
.panel { background: var(--panel); border-radius: var(--radius); }
.side { grid-column: 1; grid-row: 1; display: flex; flex-direction: column; gap: 8px; min-height: 0; }
.nav { padding: 1rem 1.1rem .6rem; display: flex; flex-direction: column; gap: .2rem; }
.brand { display: flex; align-items: center; gap: .6rem; font-weight: 800; font-size: 1.05rem; letter-spacing: -.01em; margin-bottom: .8rem; }
.brand:hover { text-decoration: none; }
.logo {
  display: block; width: 30px; height: 30px; border-radius: 8px; background: var(--accent);
}
/* the Tifinagh yaz, pierced out of the accent block so it follows the theme */
.logo::before {
  content: ""; display: block; width: 100%; height: 100%; background: var(--on-accent);
  -webkit-mask: url(icons/yaz-mask.svg) center / 64% no-repeat;
  mask: url(icons/yaz-mask.svg) center / 64% no-repeat;
}
.nf-note {
  display: block; width: 22px; height: 22px; background: var(--accent-text, var(--accent-hi));
  -webkit-mask: url(icons/yaz-mask.svg) center / contain no-repeat;
  mask: url(icons/yaz-mask.svg) center / contain no-repeat;
}
.navlink {
  display: flex; align-items: center; gap: .9rem; padding: .45rem 0; background: none; border: 0; cursor: pointer;
  color: var(--muted); font-weight: 700; font-size: 1rem; text-align: left; width: 100%;
}
.navlink .ic { font-size: 1.5rem; }
.navlink:hover, .navlink[aria-current="page"] { color: var(--fg); text-decoration: none; }

.lib { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.libhead { margin: 0; padding: .9rem 1.1rem .5rem; font-size: .8rem; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); font-weight: 700; }
.liblist { overflow-y: auto; padding: 0 .5rem .6rem; flex: 1; scrollbar-width: thin; scrollbar-color: color-mix(in srgb, var(--fg) 25%, transparent) transparent; }
.libitem { display: flex; align-items: center; gap: .75rem; padding: .45rem .55rem; border-radius: 8px; }
.libitem:hover { background: var(--hover); text-decoration: none; }
.libitem[aria-current="page"] { background: var(--elev); }
.libitem[aria-current="page"] .libtitle { color: var(--accent-text, var(--accent-hi)); }
.libcover { width: 46px; height: 46px; border-radius: 6px; object-fit: cover; flex: none; background: var(--elev); }
.libtext { display: flex; flex-direction: column; min-width: 0; }
.libtitle { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.libsub { font-size: .8rem; color: var(--muted); }

.main { grid-column: 2; grid-row: 1; display: flex; flex-direction: column; min-height: 0; overflow: hidden; }
.top { display: flex; align-items: center; gap: .8rem; padding: .7rem 1.2rem; flex: none; }
.brand-m { display: none; margin: 0; }
.gsearch { position: relative; flex: 1; max-width: 460px; }
.gsearch .ic { position: absolute; left: .9rem; top: 50%; transform: translateY(-50%); color: var(--muted); font-size: 1.2rem; pointer-events: none; }
.gsearch input {
  width: 100%; padding: .62rem 1rem .62rem 2.7rem; border: 2px solid transparent; border-radius: 999px;
  background: var(--elev); color: var(--fg); font: inherit; font-size: .95rem;
}
.gsearch input:hover { background: var(--hover); }
.gsearch input:focus { outline: none; border-color: var(--fg); background: var(--hover); }
.gsearch input::-webkit-search-cancel-button { filter: var(--cancel-filter); opacity: .6; }
.gh { display: inline-flex; align-items: center; gap: .35rem; font-size: .85rem; color: var(--muted); font-weight: 600; }
.gh:hover { color: var(--fg); }
.topopts { margin-left: auto; display: flex; align-items: center; gap: .6rem; flex: none; }
.optbtn {
  display: inline-flex; align-items: center; gap: .5rem; padding: .45rem .9rem; border: 0; border-radius: 999px;
  background: var(--elev); color: var(--muted); font-size: .82rem; font-weight: 700; cursor: pointer; white-space: nowrap;
}
.optbtn:hover { background: var(--hover); color: var(--fg); }
.optbtn[aria-pressed="true"] { background: var(--accent); color: var(--on-accent); }
.optbtn .ic { font-size: 1.1rem; }
/* ---------- theme picker (hover an entry to preview it) ---------- */
.themepick { position: relative; display: inline-flex; }
.themebtn {
  display: inline-flex; align-items: center; gap: .45rem; padding: .42rem .85rem; border: 1px solid var(--line);
  border-radius: 999px; background: var(--elev); color: var(--fg); font: inherit; font-size: .82rem; font-weight: 700;
  cursor: pointer; white-space: nowrap;
}
.themebtn:hover { background: var(--hover); }
.themebtn .chev { font-size: .9rem; color: var(--muted); transition: transform .18s; }
.themepick.open .themebtn .chev { transform: rotate(180deg); }
.sw {
  flex: none; width: 16px; height: 16px; border-radius: 50%;
  background: linear-gradient(135deg, var(--sw-bg, #000) 0 50%, var(--sw-accent, #ee6c3f) 50% 100%);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--fg) 25%, transparent);
}
.thememenu {
  position: absolute; right: 0; top: calc(100% + .45rem); z-index: 45;
  display: none; flex-direction: column; gap: .1rem;
  min-width: 236px; max-height: min(72vh, 470px); overflow-y: auto; padding: .35rem;
  background: var(--elev); border: 1px solid var(--line); border-radius: 12px;
  box-shadow: 0 18px 50px rgba(0, 0, 0, .55); scrollbar-width: thin;
}
.themepick.open .thememenu { display: flex; }
.themeopt {
  display: flex; align-items: center; gap: .6rem; width: 100%; padding: .42rem .55rem;
  border: 0; border-radius: 8px; background: none; color: var(--fg);
  font: inherit; font-size: .85rem; font-weight: 600; text-align: left; cursor: pointer;
}
.themeopt:hover, .themeopt:focus-visible {
  background: color-mix(in srgb, var(--fg) 10%, transparent); outline: none;
}
.themeopt .sw { width: 18px; height: 18px; }
.themeopt .tname { flex: 1; }
.themeopt .tick { font-size: 1rem; color: var(--accent-text, var(--accent-hi)); opacity: 0; }
.themeopt[aria-selected="true"] .tick { opacity: 1; }
.themepick select:focus-visible { outline: 2px solid var(--accent-hi); outline-offset: 2px; }
#scroll { flex: 1; min-height: 0; overflow-y: auto; scrollbar-width: thin; scrollbar-color: color-mix(in srgb, var(--fg) 25%, transparent) transparent; }
#view { padding: 0 1.5rem 2.5rem; }


/* ---------- headers (home / album / song) ---------- */
.bleed {
  margin: 0 -1.5rem; padding: 2.2rem 1.5rem 1.2rem;
  background: linear-gradient(180deg, color-mix(in srgb, var(--accent) 42%, var(--panel)) 0, var(--panel) 100%);
}
.hero { padding-top: 3rem; padding-bottom: 1.6rem; }
.ahead, .shead { display: flex; align-items: flex-end; gap: 1.5rem; }
.ahead-text { min-width: 0; }
.kind { margin: 0 0 .3rem; font-size: .75rem; font-weight: 700; text-transform: uppercase; letter-spacing: .1em; }
.big { margin: 0; font-size: clamp(2rem, 6vw, 4.6rem); line-height: 1.05; letter-spacing: -.03em; font-weight: 900; overflow-wrap: anywhere; }
.shead .big { font-size: clamp(1.7rem, 4.5vw, 3.2rem); }
.ameta { margin: .7rem 0 0; color: color-mix(in srgb, var(--fg) 88%, transparent); font-size: .92rem; }
.ameta a:hover { text-decoration: underline; }
.bigcover, .midcover { flex: none; object-fit: cover; background: var(--elev); box-shadow: 0 8px 40px rgba(0, 0, 0, .55); border-radius: 6px; }
.bigcover { width: clamp(130px, 18vw, 232px); height: clamp(130px, 18vw, 232px); }
.midcover { width: clamp(96px, 13vw, 168px); height: clamp(96px, 13vw, 168px); }
.ph { display: grid; place-items: center; color: var(--accent-text, var(--accent-hi)); font-size: 2.2rem; }

.actions { display: flex; align-items: center; gap: .8rem; flex-wrap: wrap; margin-top: 1.4rem; }
.actions.bar { display: flex; flex-direction: row; align-items: center; flex-wrap: wrap; gap: 1.1rem; margin: 0; padding: 1.2rem 0 .8rem; height: auto; background: none; border-radius: 0; }
.btn {
  display: inline-flex; align-items: center; gap: .55rem; padding: .7rem 1.5rem; border: 0; border-radius: 999px;
  background: var(--accent); color: var(--on-accent); font-weight: 800; font-size: .95rem; cursor: pointer; transition: transform .1s, background .15s;
}
.btn:hover { background: var(--accent-hi); transform: scale(1.03); text-decoration: none; }
.btn.ghost { background: transparent; color: var(--fg); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--fg) 42%, transparent); }
.btn.ghost:hover { background: var(--hover); box-shadow: inset 0 0 0 1px var(--fg); }
.playbig {
  width: 56px; height: 56px; border-radius: 50%; border: 0; background: var(--accent); color: var(--on-accent); font-size: 1.7rem;
  display: grid; place-items: center; cursor: pointer; transition: transform .1s, background .15s;
}
.playbig:hover { transform: scale(1.06); background: var(--accent-hi); }
.ibtn {
  display: inline-grid; place-items: center; width: 36px; height: 36px; border: 0; background: none; color: var(--muted);
  font-size: 1.25rem; cursor: pointer; border-radius: 50%; position: relative;
}
.ibtn:hover { color: var(--fg); text-decoration: none; }
.ibtn.big { width: 44px; height: 44px; font-size: 1.55rem; }
.ibtn[aria-pressed="true"] { color: var(--accent-text, var(--accent-hi)); }
.ibtn[aria-pressed="true"]::after {
  content: ""; position: absolute; bottom: 2px; left: 50%; width: 4px; height: 4px; margin-left: -2px; border-radius: 50%; background: currentColor;
}
.tip { color: var(--muted); font-size: .82rem; margin: 1.4rem 0 0; }
/* the search tip waits for the user to focus the search box; when it shows it sits tight under the bar */
.hero:has(> .tip:not([hidden])) { padding-top: 0; }
.hero:has(> .tip:not([hidden])) > .tip { margin-top: 0; }
.hero:has(> .tip:not([hidden])) > .kind { margin-top: 1.2rem; }
kbd { font: inherit; font-size: .85em; padding: .05rem .4rem; border: 1px solid color-mix(in srgb, var(--fg) 27%, transparent); border-radius: 5px; background: var(--elev); }

/* ---------- home grid ---------- */
.shelf { font-size: 1.4rem; letter-spacing: -.01em; margin: 2rem 0 .9rem; font-weight: 800; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(165px, 1fr)); gap: .6rem; }
.card { position: relative; border-radius: 8px; background: var(--elev); transition: background .2s; }
.card:hover { background: var(--hover); }
.card-link { display: block; padding: .8rem; }
.card-link:hover { text-decoration: none; }
.card-cover { display: block; width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 6px; background: var(--panel); box-shadow: 0 6px 18px rgba(0, 0, 0, .4); margin-bottom: .75rem; }
.card-cover.ph { font-size: 3rem; }
.ctitle { display: block; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.csub { display: block; color: var(--muted); font-size: .82rem; }
.cardplay {
  position: absolute; right: 1.3rem; bottom: 4.7rem; border: 0; width: 46px; height: 46px; border-radius: 50%;
  background: var(--accent); color: var(--on-accent); font-size: 1.4rem; display: grid; place-items: center; cursor: pointer;
  box-shadow: 0 8px 18px rgba(0, 0, 0, .5); opacity: 0; transform: translateY(8px); transition: opacity .2s, transform .2s, background .15s;
}
.card:hover .cardplay, .cardplay:focus-visible { opacity: 1; transform: none; }
.cardplay:hover { background: var(--accent-hi); transform: scale(1.06); }
@media (hover: none) { .cardplay { display: none; } }

/* ---------- track list ---------- */
.tracks { margin-top: .3rem; }
.volhead { margin: .9rem 0 .1rem; padding: .25rem .9rem 0; font-size: .68rem; line-height: 1.2; text-transform: uppercase; letter-spacing: .08em; color: var(--dim); font-weight: 600; border-top: 1px solid var(--line); }
.tracks > .volhead:first-child { border-top: 0; margin-top: .2rem; }
.trow {
  display: grid; grid-template-columns: 2.6rem minmax(0, 1fr) auto auto; align-items: center; gap: .4rem; padding: .55rem .9rem;
  border-radius: 6px; cursor: pointer; user-select: none; -webkit-tap-highlight-color: transparent;
}
.trow:hover { background: color-mix(in srgb, var(--fg) 8%, transparent); }
.tn { position: relative; display: grid; place-items: center; width: 1.6rem; height: 1.6rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.tplay { display: none; font-size: 1.1rem; color: var(--fg); }
.eq { display: none; gap: 2px; align-items: flex-end; height: 14px; }
.eq i { width: 3px; height: 100%; background: var(--accent-hi); border-radius: 1px; transform-origin: bottom; animation: eq 1s ease-in-out infinite; animation-play-state: paused; }
.eq i:nth-child(2) { animation-delay: -.4s; }
.eq i:nth-child(3) { animation-delay: -.8s; }
@keyframes eq { 0%, 100% { transform: scaleY(.25); } 50% { transform: scaleY(1); } }
.trow:hover .num { display: none; }
.trow:hover .tplay { display: block; }
.trow.is-current .ttitle { color: var(--accent-text, var(--accent-hi)); }
.trow.is-current .num, .trow.is-current:hover .tplay { display: none; }
.trow.is-current .eq { display: flex; }
.trow.is-current.is-playing .eq i { animation-play-state: running; }
.trow.is-current:hover .eq { display: flex; }
.ttitle { font-size: 1rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* the song title is a real link to its page: crawlers and readers both get the name as anchor text */
.ttitle .tlink:hover, .ttitle .tlink:focus-visible { text-decoration: underline; text-underline-offset: 2px; }
.tlyr { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; color: var(--muted); font-size: 1.15rem; opacity: 0; }
.trow:hover .tlyr, .tlyr:focus-visible, .trow.is-current .tlyr { opacity: 1; }
.tlyr:hover { color: var(--fg); background: color-mix(in srgb, var(--fg) 12%, transparent); text-decoration: none; }
@media (hover: none) { .tlyr { opacity: 1; } }

/* ---------- search ---------- */
.sres { padding-top: .6rem; }
.count-line { color: var(--muted); font-size: .85rem; margin: .4rem 0 .7rem; }
.srow { display: grid; grid-template-columns: 44px minmax(0, 1fr); align-items: center; gap: .9rem; padding: .55rem .6rem; border-radius: 8px; }
.srow:hover { background: color-mix(in srgb, var(--fg) 8%, transparent); }
.rplay {
  width: 44px; height: 44px; border-radius: 50%; border: 0; background: var(--elev); color: var(--fg); font-size: 1.2rem;
  display: grid; place-items: center; cursor: pointer;
}
.srow:hover .rplay { background: var(--accent); }
.rlink { display: block; min-width: 0; }
.rlink:hover { text-decoration: none; }
.rt { display: block; font-weight: 700; }
.ra { display: block; font-size: .82rem; color: var(--muted); }
.rs { display: block; margin-top: .15rem; font-size: .92rem; color: color-mix(in srgb, var(--fg) 82%, transparent); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
mark { background: color-mix(in srgb, var(--accent) 30%, transparent); color: var(--accent-text, var(--accent-hi)); border-radius: 3px; padding: 0 .1em; font-weight: 700; }
.empty { color: var(--muted); }

/* ---------- song page ---------- */
.tabs { display: flex; gap: .4rem; }
.tabs button {
  padding: .4rem 1rem; border: 0; border-radius: 999px; background: var(--elev); color: var(--fg);
  font-size: .85rem; font-weight: 600; cursor: pointer;
}
.tabs button:hover { background: var(--hover); }
.tabs button[aria-selected="true"] { background: var(--fg); color: var(--bg); }
.grow { flex: 1; }
.dls { display: inline-flex; flex-wrap: wrap; gap: .5rem; }
.dlbtn {
  display: inline-flex; align-items: center; gap: .45rem; padding: .5rem 1rem; border: 0; border-radius: 12px; font-size: .85rem; font-weight: 700;
  color: var(--fg); background: transparent; box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--fg) 42%, transparent); white-space: nowrap; cursor: pointer; transition: background .15s, box-shadow .15s;
}
.dlbtn:hover { background: var(--hover); box-shadow: inset 0 0 0 1px var(--fg); text-decoration: none; }
.dlbtn .ic { font-size: 1.1em; }
.tools { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; color: var(--muted); font-size: .82rem; padding-bottom: .6rem; }
.offset { display: inline-flex; align-items: center; gap: .4rem; }
.offset button { width: 1.7rem; height: 1.7rem; border-radius: 50%; border: 0; background: var(--elev); color: var(--fg); cursor: pointer; line-height: 1; }
.offset button:hover { background: var(--hover); }
.offset output { min-width: 3.6rem; text-align: center; font-variant-numeric: tabular-nums; }
.check { display: inline-flex; gap: .35rem; align-items: center; cursor: pointer; }
.check input { accent-color: var(--accent); }
.align { display: inline-flex; align-items: center; gap: .4rem; }
.alignbtn { display: inline-flex; align-items: center; justify-content: center; width: 1.7rem; height: 1.7rem; padding: 0; border: 0; border-radius: 50%; background: var(--elev); color: var(--fg); font-size: 1rem; cursor: pointer; }
.alignbtn:hover { background: var(--hover); }
.alignbtn[aria-pressed="true"] { background: var(--fg); color: var(--bg); }

.lyrics { font-size: calc(clamp(1.35rem, 3.2vw, 2.1rem) * var(--lyric-scale, 1)); line-height: 1.35; font-weight: 800; letter-spacing: -.01em; padding: 1.2rem 0 4rem; max-width: 900px; }
.lyrics.plain { font-weight: 600; font-size: calc(1.25rem * var(--lyric-scale, 1)); line-height: 1.65; padding-bottom: 2rem; }
.lyrics.plain p { margin: 0 0 1.4rem; }
.lyrics[data-align="center"] { text-align: center; }
.lyrics[data-align="right"] { text-align: right; }
.inote { color: var(--muted); font-size: 1rem; margin: 1.5rem 0 2rem; }
.line { margin: 0; padding: .25rem .8rem; border-radius: 10px; color: color-mix(in srgb, var(--fg) var(--line-a, 38%), transparent); transition: color .25s, background .25s, box-shadow .25s; }
.js .line:not(.gap) { cursor: pointer; }
.js .line:not(.gap):hover { color: color-mix(in srgb, var(--fg) 70%, transparent); }
.line.past { color: color-mix(in srgb, var(--fg) var(--line-pa, 55%), transparent); }
.line.active { color: var(--accent-text, var(--accent-hi)); background: color-mix(in srgb, var(--accent) 16%, transparent); box-shadow: inset 4px 0 0 var(--accent); }
.line.gap { min-height: 1.4rem; padding-top: 0; padding-bottom: 0; pointer-events: none; display: flex; align-items: center; gap: .6rem; }
/* empty lines are the space between stanzas: while one is playing, fill a bar until the next lyric */
.gapbar { flex: 1 1 auto; height: max(3px, .1em); border-radius: 999px; background: color-mix(in srgb, var(--fg) 18%, transparent); overflow: hidden; opacity: 0; transition: opacity .25s; }
.line.gap.waiting .gapbar { opacity: 1; }
.gapfill { display: block; width: 100%; height: 100%; border-radius: inherit; background: var(--accent); opacity: .7; transform: scaleX(1); transform-origin: 0 50%; }
.gaptime { flex: 0 0 auto; font-size: max(.72rem, .45em); font-weight: 700; font-variant-numeric: tabular-nums; letter-spacing: .03em; color: color-mix(in srgb, var(--fg) 45%, transparent); opacity: 0; transition: opacity .25s; }
.line.gap.waiting .gaptime { opacity: 1; }
.credit { font-size: .8rem; color: var(--dim); margin: 0; }
#song:not([data-current]) .line:not(.active) { color: color-mix(in srgb, var(--fg) var(--line-pa, 55%), transparent); }
#song .i-pause { display: none; }
body[data-state="playing"] #song[data-current] .i-play { display: none; }
body[data-state="playing"] #song[data-current] .i-pause { display: inline-block; }

/* ---------- now playing bar ---------- */
.np {
  grid-column: 1 / -1; grid-row: 2; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 2fr) minmax(0, 1fr);
  align-items: center; gap: 1rem; padding: 0 .6rem;
}
.np-track { display: flex; align-items: center; gap: .8rem; min-width: 0; }
.np-cover { width: 56px; height: 56px; border-radius: 6px; object-fit: cover; flex: none; background: var(--elev); font-size: 1.4rem; }
.np-text { display: flex; flex-direction: column; min-width: 0; }
.np-title { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.np-album { font-size: .78rem; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.np-center { display: flex; flex-direction: column; align-items: center; gap: .35rem; min-width: 0; }
.np-ctrls { display: flex; align-items: center; gap: .5rem; }
.playbtn {
  width: 38px; height: 38px; border-radius: 50%; border: 0; background: var(--fg); color: var(--bg); font-size: 1.3rem;
  display: grid; place-items: center; cursor: pointer; transition: transform .1s;
}
.playbtn:hover { transform: scale(1.07); }
.playbtn .i-pause { display: none; }
body[data-state="playing"] .playbtn .i-play { display: none; }
body[data-state="playing"] .playbtn .i-pause { display: inline-block; }
.np-seek { display: flex; align-items: center; gap: .6rem; width: 100%; max-width: 620px; }
.time { font-size: .72rem; color: var(--muted); font-variant-numeric: tabular-nums; min-width: 2.6rem; }
.np-seek .time:first-child { text-align: right; }
.np-right { display: flex; align-items: center; justify-content: flex-end; gap: .4rem; }
.vol { display: inline-flex; align-items: center; gap: .4rem; color: var(--muted); font-size: 1.15rem; }
.volbtn { display: inline-flex; align-items: center; justify-content: center; width: 1.9rem; height: 1.9rem; padding: 0; border: 0; border-radius: 999px; background: none; color: inherit; cursor: pointer; }
.volbtn:hover { color: var(--fg); background: var(--hover); }
.volbtn .i-muted { display: none; }
.volbtn[aria-pressed="true"] .i-vol { display: none; }
.volbtn[aria-pressed="true"] .i-muted { display: inline-block; }
.volbtn[aria-pressed="true"] { color: var(--accent-text, var(--accent-hi)); }
#np-vol { width: 96px; }
.np-loading #np-title::after { content: " …"; color: var(--muted); }

/* album art opened: image over a blurred background */
#cover-view {
  position: fixed; inset: 0; z-index: 40; display: none;
  align-items: center; justify-content: center;
  background: rgba(0, 0, 0, .72);
  -webkit-backdrop-filter: blur(30px); backdrop-filter: blur(30px);
}
body.cover-open #cover-view { display: flex; }
#cover-view img {
  max-width: min(80vw, 80vh); max-height: 80vh; width: auto; height: auto;
  border-radius: 12px; box-shadow: 0 24px 80px rgba(0, 0, 0, .65);
}
.cover-view-close {
  position: absolute; top: 16px; right: 16px; width: 40px; height: 40px; border: 0; border-radius: 50%;
  background: var(--elev); color: var(--fg); font-size: 1.4rem; line-height: 1; cursor: pointer; display: grid; place-items: center;
}
.cover-view-close:hover { background: var(--hover); }

.range { -webkit-appearance: none; appearance: none; height: 14px; background: transparent; cursor: pointer; --p: 0%; flex: 1; min-width: 0; margin: 0; }
.range::-webkit-slider-runnable-track { height: 4px; border-radius: 2px; background: linear-gradient(to right, var(--fg) var(--p), color-mix(in srgb, var(--fg) 30%, transparent) var(--p)); }
.range::-moz-range-track { height: 4px; border-radius: 2px; background: color-mix(in srgb, var(--fg) 30%, transparent); }
.range::-moz-range-progress { height: 4px; border-radius: 2px; background: var(--fg); }
.range::-webkit-slider-thumb { -webkit-appearance: none; width: 12px; height: 12px; margin-top: -4px; border-radius: 50%; background: var(--fg); opacity: 0; }
.range::-moz-range-thumb { width: 12px; height: 12px; border: 0; border-radius: 50%; background: var(--fg); opacity: 0; }
.range:hover::-webkit-slider-thumb, .range:focus-visible::-webkit-slider-thumb { opacity: 1; }
.range:hover::-moz-range-thumb, .range:focus-visible::-moz-range-thumb { opacity: 1; }
.range:hover::-webkit-slider-runnable-track { background: linear-gradient(to right, var(--accent) var(--p), color-mix(in srgb, var(--fg) 30%, transparent) var(--p)); }
.range:hover::-moz-range-progress { background: var(--accent); }

.toast {
  position: fixed; left: 50%; bottom: calc(var(--np-h) + 24px); transform: translateX(-50%); z-index: 50;
  background: var(--fg); color: var(--bg); padding: .6rem 1.1rem; border-radius: 8px; font-weight: 600; font-size: .9rem;
  box-shadow: 0 8px 30px rgba(0, 0, 0, .5); max-width: 90vw;
}

/* ---------- small screens ---------- */
@media (max-width: 820px) {
  :root { --np-h: auto; }
  .app { grid-template-columns: minmax(0, 1fr); grid-template-rows: minmax(0, 1fr) auto; gap: 0; padding: 0; }
  .side { display: none; }
  .main { grid-column: 1; border-radius: 0; }
  .brand-m { display: flex; }
  .gh { display: none; }
  .optbtn span { display: none; }
  .optbtn { padding: .5rem; }
  .themebtn { padding: .45rem .55rem; }
  .themebtn .tlabel { display: none; }
  .top { padding: .6rem .9rem; }
  .gsearch { max-width: none; }
  #view { padding: 0 1rem 2rem; }
  .bleed { margin: 0 -1rem; padding: 1.4rem 1rem 1rem; }
  .ahead, .shead { flex-direction: column; align-items: flex-start; gap: 1rem; }
  .shead { flex-direction: row; align-items: flex-end; }
  .np {
    grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "track ctrls" "seek seek"; gap: .3rem .6rem;
    padding: .55rem .8rem calc(.55rem + env(safe-area-inset-bottom)); background: var(--elev); border-top: 1px solid var(--line);
  }
  .np-center { display: contents; }
  .np-track { grid-area: track; }
  .np-ctrls { grid-area: ctrls; gap: .1rem; }
  #np-shuffle, #np-repeat { display: none; }
  .np-seek { grid-area: seek; max-width: none; }
  .np-right { display: none; }
  .np-cover { width: 44px; height: 44px; }
  .trow { padding: .7rem .5rem; }
  .actions.bar .grow { display: none; }
  .sortbar { flex-wrap: wrap; }
  .cards { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation-duration: .001s !important; }
}

.coverlink { display: block; flex: none; border-radius: 6px; cursor: zoom-in; position: relative; }
.coverlink:hover { text-decoration: none; }
.coverlink::after {
  content: "Open image"; position: absolute; inset: auto 0 0 0; padding: .35rem; text-align: center; font-size: .72rem; font-weight: 700;
  background: linear-gradient(transparent, #000c); color: #fff; border-radius: 0 0 6px 6px; opacity: 0; transition: opacity .15s;
}
.coverlink:hover::after, .coverlink:focus-visible::after { opacity: 1; }

/* home sort bar */
.sortbar { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin: 1.6rem 0 .9rem; }
.sortbar .shelf { margin: 0; }
.sort { display: inline-flex; align-items: center; gap: .6rem; color: var(--muted); font-size: .85rem; font-weight: 600; }
.sort select {
  appearance: none; -webkit-appearance: none; padding: .5rem 2.2rem .5rem 1rem; border: 0; border-radius: 999px; background: var(--elev)
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' fill='none' stroke='%23b3b3b3' stroke-width='2' stroke-linecap='round'/%3E%3C/svg%3E")
    no-repeat right .9rem center;
  color: var(--fg); font: inherit; font-weight: 600; cursor: pointer;
}
.sort select:hover { background-color: var(--hover); }
.sort select option { background: var(--elev); color: var(--fg); }


/* ---------- queue buttons on song rows ---------- */
.tq { display: inline-flex; gap: .1rem; opacity: 0; }
.tqb { display: grid; place-items: center; width: 34px; height: 34px; border: 0; border-radius: 50%; background: none; color: var(--muted); font-size: 1.1rem; cursor: pointer; }
.tqb:hover { color: var(--fg); background: color-mix(in srgb, var(--fg) 12%, transparent); text-decoration: none; }
.trow:hover .tq, .tq:focus-within, .trow.is-current .tq { opacity: 1; }
@media (hover: none) { .tq { opacity: 1; } .tqb { width: 30px; } }

/* ---------- player extras: queue, sleep timer ---------- */
.sleepleft { position: absolute; top: -2px; right: -4px; min-width: 1.5em; padding: 0 .3em; border-radius: 999px; background: var(--accent); color: var(--on-accent); font-size: .6rem; font-weight: 800; line-height: 1.5; text-align: center; }
.qpanel {
  position: fixed; right: 8px; bottom: calc(var(--np-h) + 16px); top: 8px; width: min(420px, calc(100vw - 16px)); z-index: 18;
  display: flex; flex-direction: column; background: var(--elev); border-radius: var(--radius); box-shadow: 0 12px 40px #000c; overflow: hidden;
}
.qhead { display: flex; align-items: flex-start; justify-content: space-between; gap: .6rem; padding: .8rem 1rem .4rem; }
.qhead h2 { margin: 0; font-size: 1.15rem; }
.qsum { margin: .15rem 0 0; font-size: .78rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.qbody { overflow: auto; padding: 0 .5rem 1rem; }
.qsub { display: flex; align-items: center; justify-content: space-between; margin: 1rem .5rem .3rem; font-size: .75rem; text-transform: uppercase; letter-spacing: .08em; color: var(--dim); }
.qclear { border: 0; background: none; color: var(--muted); font: inherit; font-size: .75rem; text-transform: none; letter-spacing: 0; cursor: pointer; text-decoration: underline; }
.qlist { list-style: none; margin: 0; padding: 0; }
.qitem { position: relative; display: flex; align-items: center; gap: .5rem; padding: .25rem .4rem .25rem .1rem; border-radius: 6px; }
.qitem:hover { background: #ffffff14; }
.qitem.cur .qt { color: var(--accent-text, var(--accent-hi)); }
.qitem.dragging { opacity: .45; }
.qitem.played { opacity: .38; }
.qitem.played:hover { opacity: .7; }
.qgrip { display: grid; place-items: center; flex: none; width: 24px; height: 40px; border-radius: 4px; color: var(--dim); font-size: 1rem; cursor: grab; touch-action: none; user-select: none; }
.qgrip:hover, .qgrip:focus-visible { color: var(--fg); background: #ffffff14; outline: none; }
.qgrip.off { visibility: hidden; cursor: default; }
.qcover { flex: none; width: 40px; height: 40px; border-radius: 4px; object-fit: cover; background: var(--hover); }
.qcover.ph { display: grid; place-items: center; color: var(--muted); }
.qplay { flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: flex-start; padding: .2rem .2rem; border: 0; background: none; text-align: left; cursor: pointer; }
.qt, .qa { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.qt { font-weight: 600; }
.qa { font-size: .78rem; color: var(--muted); }
.qdur { flex: none; font-size: .78rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.qx { display: grid; place-items: center; flex: none; width: 28px; height: 28px; border: 0; border-radius: 50%; background: none; color: var(--muted); font-size: .95rem; cursor: pointer; }
.qx:hover { color: var(--fg); background: #ffffff1f; }
.qempty { margin: 1rem .8rem; color: var(--muted); font-size: .9rem; }
.qbody.dragging, .qbody.dragging * { cursor: grabbing; user-select: none; }
.qitem.drop-above::before, .qitem.drop-below::after {
  content: ""; position: absolute; left: .4rem; right: .4rem; height: 3px; border-radius: 2px; background: var(--accent); pointer-events: none; z-index: 1;
}
.qitem.drop-above::before { top: -2px; }
.qitem.drop-below::after { bottom: -2px; }
.menu {
  position: fixed; z-index: 19; display: flex; flex-direction: column; min-width: 200px; padding: .3rem; border-radius: 8px;
  background: var(--elev); box-shadow: 0 12px 40px #000c; border: 1px solid var(--line);
}
.menuhead { margin: .4rem .7rem .3rem; font-size: .72rem; text-transform: uppercase; letter-spacing: .08em; color: var(--dim); }
.menu button { padding: .55rem .7rem; border: 0; border-radius: 5px; background: none; text-align: left; cursor: pointer; }
.menu button:hover { background: color-mix(in srgb, var(--fg) 8%, transparent); }
.menu .off { color: var(--muted); }

/* ---------- help dialog ---------- */
.modal { position: fixed; inset: 0; z-index: 30; display: grid; place-items: center; padding: 1rem; background: #000a; }
.modalbox { width: min(460px, 100%); max-height: 90vh; overflow: auto; padding: .4rem 1rem 1.2rem; border-radius: var(--radius); background: var(--elev); box-shadow: 0 20px 60px #000; }
.keys { display: grid; grid-template-columns: auto 1fr; gap: .5rem 1.2rem; margin: .4rem 0 0; align-items: center; }
.keys dt { display: flex; gap: .3rem; justify-content: flex-end; white-space: nowrap; }
.keys dd { margin: 0; color: var(--muted); }

/* ---------- lyrics tools, fullscreen ---------- */
.toolbtn { display: inline-flex; align-items: center; gap: .4rem; padding: .3rem .8rem; border: 0; border-radius: 999px; background: var(--elev); color: var(--fg); font-size: inherit; cursor: pointer; }
.toolbtn:hover { background: var(--hover); }
body.lyrics-full #song {
  position: fixed; inset: 0 0 var(--np-real, 84px) 0; z-index: 15; overflow: auto; background: var(--bg); padding: 1.5rem 1.5rem 0;
  display: flex; flex-direction: column; align-items: center; text-align: center;
}
body.lyrics-full #song > .shead { background: none; padding: 0 0 .6rem; justify-content: center; }
body.lyrics-full #song .shead .coverlink, body.lyrics-full #song .shead .kind, body.lyrics-full #song .shead .ameta,
body.lyrics-full #song > .actions, body.lyrics-full #song > .tools,
body.lyrics-full #song > .credit, body.lyrics-full #song .lyrics.plain { display: none !important; }
body.lyrics-full #song .shead .big { font-size: 1.1rem; color: var(--muted); margin: 0; }
body.lyrics-full #song .lyrics.synced { max-width: 1100px; width: 100%; font-size: calc(clamp(1.8rem, 4.2vw, 3.4rem) * var(--lyric-scale, 1)); }
body.lyrics-full #song .line.active { box-shadow: none; }

/* ---------- About page ---------- */
.prose { max-width: 760px; padding-bottom: 2rem; }
.prose h2 { margin: 2rem 0 .6rem; font-size: 1.25rem; }
.prose p { color: var(--muted); line-height: 1.65; }
.prose a { text-decoration: underline; }
.prose code { padding: .05rem .35rem; border-radius: 4px; background: var(--elev); font-size: .88em; }
.stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: .6rem; margin-top: 1.4rem; }
.stat { display: flex; flex-direction: column; gap: .1rem; padding: 1rem; border-radius: 8px; background: var(--elev); }
.stat strong { font-size: 1.6rem; letter-spacing: -.02em; }
.stat span { color: var(--muted); font-size: .8rem; }
.bars { list-style: none; margin: 0; padding: 0; display: grid; gap: .3rem; }
.bars li { display: grid; grid-template-columns: 3rem minmax(0, 1fr) 2.2rem; align-items: center; gap: .6rem; font-size: .85rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.bar { display: block; height: .7rem; width: var(--w); min-width: 4px; border-radius: 999px; background: var(--accent); }
.bn { text-align: right; }
.navlink[aria-current="page"] { color: var(--fg); }

@media (max-width: 820px) {
  .qpanel { left: 0; right: 0; width: 100%; top: 14vh; bottom: 0; border-radius: 16px 16px 0 0; padding-bottom: env(safe-area-inset-bottom); }
  .app { padding-left: env(safe-area-inset-left); padding-right: env(safe-area-inset-right); }
  .np { grid-template-columns: minmax(0, 1fr) auto auto; grid-template-areas: "track lyr ctrls" "seek queue sleep"; gap: .1rem .25rem; }
  .np-right { display: contents; }
  #np-lyrics { grid-area: lyr; }
  #np-queue { grid-area: queue; }
  #np-sleep { grid-area: sleep; justify-self: center; }
  .np-right .vol { display: none; }
  .tq { display: inline-flex; opacity: 1; }
  .tq .tqb:not(.tmore) { display: none; }
  .tq .tmore { display: grid; width: 40px; height: 40px; }
  /* Home: 2x2 action buttons */
  .actions:not(.bar) { display: grid; grid-template-columns: 1fr 1fr; gap: .6rem; }
  .actions:not(.bar) .btn { justify-content: center; padding: .75rem .5rem; white-space: nowrap; font-size: .9rem; }
  .keys { grid-template-columns: 1fr; }
  .keys dt { justify-content: flex-start; }
}

/* ---------- fullscreen lyrics toggle: bottom-right corner ---------- */
.fsbtn {
  position: sticky; bottom: 16px; z-index: 5; display: grid; place-items: center; flex: none; width: 44px; height: 44px; margin: -44px 0 0 auto; /* takes no space in the flow, so no dead gap under the last line */
  border: 0; border-radius: 50%; background: var(--elev); color: var(--fg); font-size: 1.25rem; cursor: pointer; box-shadow: 0 4px 16px #0006;
}
.fsbtn:hover { background: var(--hover); }
.fsbtn .i-compress, body.lyrics-full .fsbtn .i-expand { display: none; }
body.lyrics-full .fsbtn .i-compress { display: inline; }

/* lyrics shortcut in the player bar: always shown, dimmed until a song is loaded */
#np-lyrics[aria-disabled="true"] { opacity: .35; pointer-events: none; }

.qacts { display: flex; align-items: center; gap: .4rem; flex: none; }
.qacts .qclear { padding: .3rem .5rem; }

/* ---------- touch: bigger targets, no keyboard-only hints ---------- */
.tmore { display: none; }
@media (pointer: coarse) {
  .tip { display: none; }
  .ibtn { width: 44px; height: 44px; }
  .offset button { width: 40px; height: 40px; font-size: 1.1rem; }
  .alignbtn { width: 40px; height: 40px; font-size: 1.15rem; }
  .toolbtn, .tabs button { min-height: 40px; display: inline-flex; align-items: center; }
  .check { min-height: 40px; }
  .check input { width: 20px; height: 20px; }
  .tools { gap: .5rem 1rem; }
  .trow { min-height: 56px; }
  .tlyr { width: 40px; height: 40px; display: grid; place-items: center; }
  .libitem { padding: .6rem .55rem; }
}
@media (max-width: 820px) and (pointer: coarse) {
  .np { padding-top: .4rem; }
  .np-cover { width: 40px; height: 40px; }
  .range { height: 28px; }
}

/* bottom sheet with per-song actions (phones; long-press a song too) */
.sheet { position: fixed; inset: 0; z-index: 40; display: flex; align-items: flex-end; background: #000a; }
.sheet[hidden] { display: none; }
.sheet-in { width: 100%; max-width: 560px; margin: 0 auto; background: var(--elev); border-radius: 16px 16px 0 0; padding: .4rem .5rem calc(.7rem + env(safe-area-inset-bottom)); }
.sheet h3 { margin: 0; padding: .8rem .9rem .5rem; font-size: 1rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; border-bottom: 1px solid var(--line); }
.sheet-in > button, .sheet-in > a {
  display: flex; align-items: center; gap: 1rem; width: 100%; min-height: 52px; padding: 0 .9rem; border: 0; border-radius: 10px;
  background: none; color: var(--fg); font-size: 1rem; font-weight: 600; text-align: left; cursor: pointer;
}
.sheet-in > button:hover, .sheet-in > a:hover, .sheet-in > button:focus-visible, .sheet-in > a:focus-visible { background: var(--hover); text-decoration: none; }
.sheet-in .ic { font-size: 1.3rem; color: var(--muted); }

/* ---------- TV mode (html.tv): 10-foot UI, remote/D-pad friendly ---------- */
html.tv { font-size: 22px; --np-h: 124px; }
html.tv body { font-size: 20px; }
html.tv .app { padding: 2.2vh 2.4vw; gap: 14px; grid-template-columns: clamp(300px, 26vw, 460px) minmax(0, 1fr); }
html.tv .gh, html.tv .tip, html.tv .vol, html.tv .cardplay, html.tv .fsbtn { display: none !important; }
html.tv .top { padding: .9rem 1.4rem; gap: 1rem; }
html.tv .gsearch { max-width: 640px; }
html.tv .gsearch input { font-size: 1rem; padding: .8rem 1rem .8rem 3rem; }
html.tv .optbtn, html.tv .themebtn { font-size: 1rem; padding: .7rem 1.1rem; }
html.tv .libcover { width: 64px; height: 64px; }
html.tv .libitem { padding: .55rem .7rem; }
html.tv .navlink { padding: .7rem 0; font-size: 1.15rem; }
html.tv .cards { grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 1rem; }
html.tv .btn { padding: .95rem 2rem; font-size: 1.05rem; }
html.tv .ibtn { width: 64px; height: 64px; font-size: 1.7rem; }
html.tv .playbtn { width: 68px; height: 68px; font-size: 1.9rem; }
html.tv .np-cover { width: 88px; height: 88px; }
html.tv .np-title { font-size: 1.15rem; }
html.tv .np-album, html.tv .time { font-size: 1rem; }
html.tv .np-seek { max-width: 900px; }
html.tv .range { height: 28px; }
html.tv .trow { padding: .9rem 1.2rem; font-size: 1.1rem; min-height: 72px; }
html.tv .trow .tq { opacity: 1; }
html.tv .tqb, html.tv .tlyr { width: 56px; height: 56px; font-size: 1.5rem; }
html.tv .tlyr { opacity: 1; display: grid; place-items: center; }
html.tv .tmore { display: none !important; }
html.tv .tools, html.tv .tabs button { font-size: 1.05rem; }
html.tv .offset button { width: 48px; height: 48px; font-size: 1.2rem; }
html.tv .alignbtn { width: 48px; height: 48px; font-size: 1.3rem; }
html.tv .toolbtn, html.tv .tabs button { min-height: 52px; padding-inline: 1.3rem; display: inline-flex; align-items: center; }
html.tv .lyrics { font-size: calc(clamp(2rem, 3.4vw, 3.4rem) * var(--lyric-scale, 1)); max-width: none; }
html.tv .lyrics.plain { font-size: calc(1.6rem * var(--lyric-scale, 1)); }
html.tv .line { padding: .4rem 1.2rem; }
html.tv body.lyrics-full #song .lyrics.synced { font-size: calc(clamp(2.4rem, 4.6vw, 4.6rem) * var(--lyric-scale, 1)); }
html.tv .qpanel { width: min(560px, 42vw); }
html.tv .toast { font-size: 1.1rem; padding: .9rem 1.6rem; }
/* focus must be obvious from across the room */
html.tv :focus, html.tv :focus-visible { outline: 4px solid var(--accent-hi); outline-offset: 3px; }
html.tv .gsearch input:focus { outline: 4px solid var(--accent-hi); outline-offset: 2px; }
html.tv .trow:focus-visible, html.tv .libitem:focus-visible, html.tv .card:focus-visible, html.tv .navlink:focus-visible, html.tv .themeopt:focus-visible {
  background: color-mix(in srgb, var(--accent) 22%, var(--elev)); outline-offset: -4px;
}
html.tv .btn:focus-visible, html.tv .playbtn:focus-visible { transform: scale(1.08); }
.tvtoggle { margin: 1rem 1.2rem 1.2rem; }

/* ---------- lyric contrast: per-theme alphas (>= 3:1 for large text) ---------- */
html[data-theme="dracula"] { --line-a: 42%; --line-pa: 58%; }
html[data-theme="catppuccin"] { --line-a: 46%; --line-pa: 60%; }
html[data-theme="catppuccin-macchiato"] { --line-a: 47%; --line-pa: 60%; }
html[data-theme="catppuccin-frappe"] { --line-a: 51%; --line-pa: 62%; }
html[data-theme="catppuccin-latte"] { --line-a: 68%; --line-pa: 78%; }
html[data-theme="nord"] { --line-a: 43%; --line-pa: 58%; }
html[data-theme="rose-pine"] { --line-a: 43%; --line-pa: 58%; }
html[data-theme="rose-pine-moon"] { --line-a: 44%; --line-pa: 58%; }
html[data-theme="rose-pine-dawn"] { --line-a: 68%; --line-pa: 78%; }
html[data-theme="tokyo-night"] { --line-a: 47%; --line-pa: 60%; }
html[data-theme="solarized-dark"] { --line-a: 72%; --line-pa: 84%; }
html[data-theme="solarized-light"] { --line-a: 92%; --line-pa: 96%; }
/* active line on themes whose accent text is too faint on the tinted highlight */
html[data-theme="catppuccin-latte"] .line.active, html[data-theme="rose-pine-dawn"] .line.active,
html[data-theme="solarized-light"] .line.active, html[data-theme="solarized-dark"] .line.active { color: var(--fg); }
html[data-theme="solarized-light"] .line:not(.active), html[data-theme="solarized-dark"] .line:not(.active) { font-weight: 700; }

/* ---------- phone: lyrics settings sheet ---------- */
.only-phone { display: none; }
@media (max-width: 820px) {
  .only-phone { display: inline-flex; align-items: center; gap: .4rem; }
  #tools { display: none; }
  body.tools-open #tools {
    display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 40; flex-direction: column; align-items: stretch; gap: .5rem;
    padding: 1.1rem 1.2rem calc(1.1rem + env(safe-area-inset-bottom)); background: var(--elev); border-radius: 16px 16px 0 0;
    box-shadow: 0 0 0 100vmax #0009; font-size: 1rem; max-width: 560px; margin: 0 auto;
  }
  body.tools-open #tools .offset { justify-content: space-between; }
  body.tools-open #tools .align { justify-content: space-between; }
  body.tools-open #tools .check { justify-content: space-between; }
  .np-track { touch-action: none; cursor: pointer; }
  .toast { bottom: calc(var(--np-real, 110px) + 12px); }
}
@media (max-width: 950px) and (max-height: 480px) and (orientation: landscape) {
  .np-album, .np-cover { display: none; }
  .np { padding-top: .2rem; padding-bottom: calc(.2rem + env(safe-area-inset-bottom)); }
  .top { padding-top: .3rem; padding-bottom: .3rem; }
  .bleed { padding-top: .8rem; }
}

/* ---------- phone: Now playing view ---------- */
.nowview {
  position: fixed; inset: 0; z-index: 28; display: flex; flex-direction: column; align-items: center; gap: .8rem; overflow: hidden; touch-action: none;
  padding: calc(.6rem + env(safe-area-inset-top)) max(1.4rem, env(safe-area-inset-right)) calc(1rem + env(safe-area-inset-bottom)) max(1.4rem, env(safe-area-inset-left));
  background: linear-gradient(180deg, color-mix(in srgb, var(--accent) 38%, var(--bg)) 0, var(--bg) 72%);
}
.nowview[hidden] { display: none; }
.nv-grab { display: flex; align-items: center; justify-content: space-between; width: 100%; max-width: 520px; color: var(--muted); font-weight: 700; font-size: .8rem; letter-spacing: .1em; text-transform: uppercase; }
.nv-sp { width: 44px; }
.nv-art { width: min(78vw, 36vh, 420px); aspect-ratio: 1; border-radius: 12px; background: var(--elev); display: grid; place-items: center; font-size: 4rem; overflow: hidden; box-shadow: 0 18px 50px #0008; margin-top: .2rem; flex: none; }
.nv-art img { width: 100%; height: 100%; object-fit: cover; }
.nv-meta { width: 100%; max-width: 520px; }
.nv-meta h2 { margin: 0; font-size: 1.5rem; line-height: 1.2; }
.nv-meta p { margin: .15rem 0 0; color: var(--muted); }
.nv-lyr { width: 100%; max-width: 520px; flex: 1; min-height: 0; display: flex; flex-direction: column; justify-content: center; gap: .45rem; font-weight: 800; overflow: hidden; }
.nv-lyr[hidden] { display: none; }
.nv-lyr p { margin: 0; }
.nv-prev, .nv-next { color: color-mix(in srgb, var(--fg) var(--line-a, 45%), transparent); font-size: 1.05rem; }
.nv-cur { color: var(--accent-text, var(--accent-hi)); font-size: 1.5rem; line-height: 1.25; }
.nv-seek { display: flex; gap: .6rem; align-items: center; width: 100%; max-width: 520px; }
.nv-ctrls { display: flex; align-items: center; justify-content: center; gap: .8rem; }
.nv-more { display: flex; gap: .6rem; flex-wrap: wrap; justify-content: center; }

/* ---------- TV: drawer, quick row, on-screen keyboard, idle ---------- */
.tvonly { display: none; }
html.tv .tvonly { display: inline-flex; }
html.tv .only-phone { display: none; }
html.tv .app { grid-template-columns: minmax(0, 1fr); }
html.tv .main { grid-column: 1; }
html.tv .side { display: none; }
html.tv body.drawer-open .side {
  display: flex; position: fixed; z-index: 26; left: 2.4vw; top: 2.2vh; bottom: calc(var(--np-h) + 4.4vh); width: min(500px, 38vw); box-shadow: 0 0 0 100vmax #000a;
}
html.tv .top, html.tv .np, html.tv .side { transition: opacity 1.4s; }
html.tv body.idle .top, html.tv body.idle .np { opacity: .14; }
html.tv .tvquick { display: flex; flex-wrap: wrap; align-items: center; gap: .8rem; padding: .4rem 0 1.2rem; }
html.tv .tvquick .tvq-l { color: var(--muted); font-weight: 700; margin-left: .6rem; }
html.tv .tvquick .btn { padding: .7rem 1.5rem; }
.osk { width: min(1000px, 94vw); padding: 1.2rem 1.4rem 1.4rem; }
.osk-text { display: block; min-height: 2.6rem; padding: .4rem 1rem; border-radius: 10px; background: var(--panel); font-size: 1.7rem; font-weight: 700; margin-top: .4rem; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.osk-grid { display: grid; grid-template-columns: repeat(10, 1fr); gap: .5rem; margin: 1rem 0 .6rem; }
.osk-row { display: flex; flex-wrap: wrap; gap: .5rem; }
.oskk { min-height: 3.2rem; padding: .5rem .8rem; border: 0; border-radius: 10px; background: var(--panel); color: var(--fg); font-size: 1.35rem; font-weight: 700; cursor: pointer; }
.oskk:hover { background: var(--hover); }
.oskk.wide { flex: 1; font-size: 1.1rem; }
.oskk.primary { background: var(--accent); color: var(--on-accent); }
html.tv .oskk:focus-visible { background: color-mix(in srgb, var(--accent) 30%, var(--elev)); }

/* drawer: solid backing so the page never shows through the gap between its panels */
html.tv body.drawer-open .side { background: var(--bg); padding: .8rem; gap: .8rem; border-radius: var(--radius); overflow-y: auto; }
/* short landscape phones: slim player bar */
@media (max-height: 480px) and (orientation: landscape) {
  :root { --np-h: 72px; }
  .np { padding-top: .15rem; padding-bottom: calc(.15rem + env(safe-area-inset-bottom)); gap: 0 .5rem; }
  .np .ibtn { width: 36px; height: 36px; }
  .np .playbtn { width: 40px; height: 40px; }
  .np .vol { display: none; }
  .np-title { font-size: .95rem; }
  .range { height: 18px; }
}


/* ---------- audit fixes ---------- */
.skip { position: fixed; left: .6rem; top: -4rem; z-index: 200; padding: .6rem 1rem; border-radius: 999px; background: var(--accent); color: var(--on-accent); font-weight: 800; text-decoration: none; transition: top .15s; }
.skip:focus { top: .6rem; }
#view:focus { outline: none; }
::placeholder { color: var(--muted); opacity: 1; }
@media (pointer: coarse) {
  .range { height: 32px; }
  .brand-m { min-width: 44px; min-height: 44px; align-items: center; justify-content: center; }
  .themebtn { min-height: 44px; min-width: 44px; }
}
@media (max-width: 360px) {
  .btn, .card-actions .btn { max-width: 100%; white-space: normal; }
  .top { gap: .4rem; padding-inline: .6rem; }
}
@media print {
  .side, .top, .np, #nowview, .sheet, #queue, .skip, .toast, #help, .actions, .tabs { display: none !important; }
  html, body, .app, .main, #scroll { background: #fff !important; color: #000 !important; height: auto !important; overflow: visible !important; display: block !important; }
  .lyrics, .line { color: #000 !important; opacity: 1 !important; font-size: 12pt !important; }
  a { color: #000; text-decoration: none; }
}


/* ---------- design-review polish ---------- */
/* 1. no seam between the top bar and the tinted header: the bar starts in the gradient's first colour */
.main:has(.bleed) .top { background: color-mix(in srgb, var(--accent) 42%, var(--panel)); }
/* 2. a failed/absent cover is centred, not stuck in the corner */
.card-cover.ph, .bigcover.ph, .midcover.ph { display: grid; place-items: center; align-content: center; }
.card-cover.ph { font-size: clamp(2.4rem, 7vw, 3.4rem); }
/* 3. stat tiles fill their row instead of leaving an orphan gap */
.stats { display: flex; flex-wrap: wrap; }
.stat { flex: 1 1 150px; }
/* 4. GitHub link matches the other top-bar pills */
.gh { padding: .5rem .85rem; border-radius: 999px; background: var(--elev); }
.gh:hover { background: var(--hover); }
/* 5. lyric text aligns with the page gutter; the highlight hangs into it */
.lyrics { margin-left: -.8rem; }
/* 6. numerals don't jitter while the clock runs */
#np-cur, #np-dur, .tm { font-variant-numeric: tabular-nums; }
/* 7. home title scale on phones */
.hero .big { font-size: clamp(2.4rem, 8vw, 4.6rem); }
@media (max-width: 700px) {
  #np-lyrics[aria-disabled="true"] { display: none; }
  .card-cover { margin-bottom: .6rem; }
}
