/* HRMXN player — app pieces on top of hrmxn.com/style.css.
   Only tokens from style.css are used (no new colors, fonts or sizes).
   If a variation is chosen, these rules move into style.css as a "Player app" section. */

/* ── One-screen app shell: the page itself never scrolls ── */
html,
body {
	height: 100%;
	overflow: hidden;
}
.app {
	height: 100vh;
	height: 100dvh;
	display: grid;
	overflow: hidden;
	background: var(--paper);
}
.app-head {
	display: flex;
	align-items: center;
	gap: var(--s8);
	height: var(--head);
	padding: 0 var(--s8);
	border-bottom: 1px solid var(--line);
	font-size: 13px;
}
.pane {
	display: flex;
	flex-direction: column;
	min-width: 0;
	min-height: 0;
	overflow: hidden;
}
/* the part of a pane that gets filled with as many rows/covers as fit */
.pane-fill {
	flex: 1;
	min-height: 0;
	overflow: hidden;
}


/* ── Song rows ── */
.hx-list {
	width: 100%;
	table-layout: fixed;
}
.hx-list tr[data-key] {
	cursor: pointer;
}
.hx-list td {
	padding-top: 9px;
	padding-bottom: 9px;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}
.hx-n {
	width: 44px;
}
.hx-time {
	width: 56px;
	text-align: right;
}
.hx-thumb {
	width: 48px;
}
.hx-thumb img {
	display: block;
	width: 36px;
	height: 36px;
	object-fit: cover;
	background: var(--n-300);
}
.hx-title b {
	font-weight: 700;
}
.hx-title span {
	display: block;
	font-size: 12px;
	overflow: hidden;
	text-overflow: ellipsis;
}
.hx-ell {
	overflow: hidden;
	text-overflow: ellipsis;
}
/* the playing row: red text, and the number turns into moving bars */
.hx-list tr.is-playing td,
.hx-list tr.is-playing td.muted {
	color: var(--a-700);
}
.hx-n .eq {
	display: none;
}
tr.is-playing .hx-n .eq {
	display: inline-flex;
}
tr.is-playing .hx-n .hx-num {
	display: none;
}
tr.is-paused .eq i {
	animation-play-state: paused;
}

/* ── Album covers ── */
.hx-grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(var(--cw, 150px), 1fr));
	gap: var(--s5) var(--s4);
	align-content: start;
}
.hx-album {
	display: flex;
	flex-direction: column;
	gap: 4px;
	min-width: 0;
	color: var(--ink);
	text-decoration: none;
	font-size: 13px;
}
.hx-album b,
.hx-album span {
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}
.hx-album span {
	color: var(--muted);
	font-size: 12px;
}
.hx-cover {
	display: block;
	width: 100%;
	aspect-ratio: 1;
	object-fit: cover;
	background: var(--n-300);
	margin-bottom: 4px;
}
.hx-album:hover .hx-cover {
	outline: 2px solid var(--accent);
	outline-offset: -2px;
}
.hx-album:hover b {
	color: var(--a-700);
}

/* ── Now playing ── */
/* .np-art keeps the square even before anything plays; the <img> inside shows the cover */
.np-art {
	width: 100%;
	aspect-ratio: 1;
	background: var(--n-300);
	flex: none;
}
.np-art img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
}
.np-art img[hidden] {
	display: none;
}
/* " · " only between parts that have text */
[data-np="album"]:not(:empty)::before,
[data-np="count"]:not(:empty)::before {
	content: " · ";
}
/* repeat-one shows a small "1" next to the repeat icon */
[data-act="repeat"][data-mode="one"]::after {
	content: "1";
	font-size: 10px;
	font-weight: 800;
	margin-left: -4px;
}
.act.is-on {
	color: var(--accent);
}
.vol {
	display: flex;
	align-items: center;
	gap: var(--s2);
	color: var(--muted);
}
.vol .range {
	width: 110px;
}

/* ════════════════════════════════════════════════════════════
   Player app (final layout, from variation A)
   Everything below is scoped to .hx-app, so the website is not affected.
   Spacing: every column uses the same padding (--s8 sides/top, --s6 bottom),
   so the three columns share one top line and one bottom line.
   ════════════════════════════════════════════════════════════ */
.hx-app {
	grid-template-columns: 264px minmax(0, 1fr) 384px;
	grid-template-rows: var(--head) minmax(0, 1fr);
}
.hx-app > .app-head {
	grid-column: 1 / -1;
}
.hx-side,
.hx-main,
.hx-np {
	padding: var(--s8) var(--s8) var(--s6);
	gap: var(--s6);
}
.hx-side {
	border-right: 1px solid var(--line);
}
.hx-side .side-group {
	display: flex;
	flex-direction: column;
	gap: var(--s3);
}


/* ── Middle: heading in three lines — kicker (small, red) · title (main) · count (description) ── */
.hx-heading {
	display: flex;
	flex-direction: column;
	gap: var(--s1);
	min-width: 0;
}
.hx-heading .h2 {
	margin: 0;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

.hx-heading .small {
	white-space: nowrap;
}
.hx-main .hx-grid {
	--cw: 150px;
}

/* ── Right: now playing, everything centered (light, like the other columns) ── */
.hx-np {
	align-items: center;
	gap: var(--s5);
	border-left: 1px solid var(--line);
}
.hx-np > * {
	width: 100%;
}
.hx-np .np-art {
	width: min(100%, 28vh);
	background: var(--n-300);
}
.hx-np-text {
	text-align: center;
}
.hx-np-text .track-title {
	font-size: 20px;
}
.hx-np-text .track-sub {
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}
.hx-np .times {
	margin-top: var(--s2);
}

/* transport: five equal round buttons, centered as one group */
.hx-ctrls {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: var(--s4);
}
.hx-ctrls .act {
	width: 40px;
	height: 40px;
	padding: 0;
	justify-content: center;
	border-radius: 50%;
}
.hx-ctrls .act.is-on {
	color: var(--accent);
}
.hx-ctrls .play {
	width: 56px;
	height: 56px;
}
.hx-ctrls .play .i {
	width: 22px;
	height: 22px;
}
/* the play triangle looks off-center; nudge it right a little */
.hx-ctrls .play use[href="#i-play"] {
	transform: translateX(1.5px);
}

/* volume: icon + slider, centered under the controls */
.hx-np .vol {
	justify-content: center;
	gap: var(--s3);
}
.hx-np .vol .range {
	width: 160px;
}

/* up next */
.hx-np .hx-up {
	display: flex;
	justify-content: space-between;
}
.hx-np .pane-fill {
	align-self: stretch;
}

/* ── Round knobs, round play button, softly rounded album art (player only) ── */
.hx-app .play {
	border-radius: 50%;
}
.hx-app .scrub {
	height: 14px;
}
.hx-app .scrub::before,
.hx-app .scrub > span {
	top: 6px;
	border-top-width: 2px;
}
.hx-app .scrub > span::after {
	top: -7px;
	right: -6px;
	width: 12px;
	height: 12px;
	border-radius: 50%;
}
/* slider: 2px track, filled up to the knob (--fill is set by the script) */
.hx-app .range::-webkit-slider-runnable-track {
	height: 2px;
	background: linear-gradient(to right, var(--accent) var(--fill, 80%), var(--line) var(--fill, 80%));
}
.hx-app .range::-moz-range-track {
	height: 2px;
	background: var(--line);
}
.hx-app .range::-moz-range-progress {
	height: 2px;
}
.hx-app .range::-webkit-slider-thumb {
	width: 12px;
	height: 12px;
	margin-top: -5px;
	border-radius: 50%;
}
.hx-app .range::-moz-range-thumb {
	width: 12px;
	height: 12px;
	border-radius: 50%;
}
.hx-app .np-art,
.hx-app .hx-cover {
	border-radius: 6px;
	overflow: hidden;
}
.hx-app .hx-thumb img {
	border-radius: 3px;
}

/* one-line title + artist (up next) */
.hx-title.hx-inline span {
	display: inline;
	font-size: 13px;
}
/* tighter rhythm in the now-playing column so "up next" gets more rows */
.hx-np {
	gap: var(--s4);
}
.hx-np .np-art {
	width: min(100%, 25vh);
}
/* "Track 3 of 50" sits on its own at the right: no " · " in front */
.hx-up [data-np="count"]::before {
	content: none;
}

/* ── Scrolling lists (player app) ──
   The page never scrolls; each list scrolls inside its own box. */
.hx-app .pane-fill {
	overflow-y: auto;
	overscroll-behavior: contain; /* scrolling a list never moves anything else */
	scrollbar-width: thin;
	scrollbar-color: var(--line) transparent;
}
.hx-app .pane-fill::-webkit-scrollbar {
	width: 6px;
}
.hx-app .pane-fill::-webkit-scrollbar-thumb {
	background: var(--line);
	border-radius: 3px;
}
/* the column header row stays on top while the songs scroll under it */
.hx-app .table thead th {
	position: sticky;
	top: 0;
	z-index: 1;
	background: var(--paper);
}
/* the keyboard hint sits at the bottom of the left column */
.hx-hint {
	margin-top: auto;
}

/* left panel: the selected item is shown by bold text only (no red square) */
.hx-app .contents a[aria-current]::after {
	content: none;
}

/* description line ("50 songs"): a little space above it, and more below so the list starts lower */
.hx-heading [data-view-count] {
	margin-top: var(--s2);
	margin-bottom: var(--s4);
}

/* Top songs shows song info only: no Album column (search and history keep it) */
body[data-view="top"] .hx-col-album {
	display: none;
}

/* playlist description (copied from Apple Music): reads like a lede, but quieter */
.hx-desc {
	margin: var(--s2) 0 0;
	max-width: 70ch;
	color: var(--ink-2);
	font-size: 15px;
	line-height: 1.5;
}
[data-view-with]:not([hidden]) {
	margin-top: var(--s1);
}

/* `hidden` must win over the grid's display:grid — otherwise the cover grid shows under a song list */
.hx-grid[hidden] {
	display: none;
}
/* the dark line under the column headers: drawn as an inner shadow, because a normal border
   does not stay on a sticky header cell while the rows scroll under it */
.hx-app .table thead th {
	border-bottom-color: transparent;
	box-shadow: inset 0 -1px 0 var(--ink);
}
/* "← Playlists" above the heading of a sub-page */
.hx-back {
	align-self: flex-start;
	margin-bottom: var(--s3);
	color: var(--muted);
}
.hx-back[hidden] {
	display: none;
}

/* ── Home: sections with a short row of items and "See all →" ── */
.hx-home {
	display: flex;
	flex-direction: column;
	gap: var(--s10);
	padding-bottom: var(--s6);
}
.hx-home[hidden],
.hx-bigsearch[hidden] {
	display: none;
}
.hx-home-head {
	display: flex;
	justify-content: space-between;
	align-items: baseline;
	padding-bottom: var(--s2);
	margin-bottom: var(--s4);
	border-bottom: 1px solid var(--ink);
}
/* one row of six cards */
.hx-grid--row {
	grid-template-columns: repeat(6, minmax(0, 1fr));
}
/* the big search box on the Search page */
.hx-bigsearch {
	display: block;
	max-width: 560px;
	margin-top: var(--s4);
}
.hx-bigsearch .input {
	width: 100%;
}

/* ════════════════════════════════════════════════════════════
   Mobile (≤ 900px): the three panes become three "pages"
   - left panel  -> ☰ menu sliding in from the left
   - middle      -> the main page
   - right panel -> minimised strip at the bottom; tap it for the full player
   ════════════════════════════════════════════════════════════ */

/* desktop: the mobile-only pieces do not exist */
.hx-burger,
.hx-scrim,
.hx-mini,
.hx-np-close,
.hx-title .hx-sub {
	display: none;
}

@media (max-width: 900px) {
	.hx-app {
		grid-template-columns: minmax(0, 1fr);
		grid-template-rows: var(--head) minmax(0, 1fr) auto;
	}
	.hx-app > .app-head {
		gap: var(--s3);
		padding: 0 var(--s4);
	}
	.hx-desktop-only,
	.hx-hint {
		display: none;
	}
	.hx-burger {
		display: inline-flex;
		width: 40px;
		height: 40px;
		padding: 0;
		margin-left: calc(-1 * var(--s2));
		justify-content: center;
	}

	/* ☰ menu: the left panel slides in over the page */
	.hx-side {
		position: fixed;
		top: 0;
		bottom: 0;
		left: 0;
		z-index: 50;
		width: min(84vw, 320px);
		padding: var(--s8) var(--s6);
		background: var(--paper);
		transform: translateX(-100%);
		transition: transform 0.25s ease;
	}
	body.is-menu .hx-side {
		transform: none;
		box-shadow: var(--shadow-lg);
	}
	.hx-scrim {
		display: block;
		position: fixed;
		inset: 0;
		z-index: 40;
		background: var(--overlay);
		opacity: 0;
		pointer-events: none;
		transition: opacity 0.25s ease;
	}
	body.is-menu .hx-scrim {
		opacity: 1;
		pointer-events: auto;
	}

	/* main page */
	.hx-main {
		gap: var(--s4);
		padding: var(--s6) var(--s4) var(--s4);
	}
	.hx-heading [data-view-count] {
		margin-bottom: var(--s2);
	}
	/* song rows: cover + title (artist under it) + time; no #, Artist, Album columns */
	.hx-app .hx-n,
	.hx-app .hx-col-artist,
	.hx-app .hx-col-album {
		display: none;
	}
	.hx-title .hx-sub {
		display: block;
		font-size: 12px;
		overflow: hidden;
		text-overflow: ellipsis;
	}
	.hx-main .hx-grid {
		--cw: 130px;
	}
	/* Home rows: one line of cards that scrolls sideways */
	.hx-grid--row {
		grid-template-columns: none;
		grid-auto-flow: column;
		grid-auto-columns: 128px;
		overflow-x: auto;
		scrollbar-width: none;
	}

	/* minimised player: a strip at the bottom */
	.hx-mini {
		display: grid;
		grid-template-columns: 48px minmax(0, 1fr) auto auto;
		align-items: center;
		gap: var(--s3);
		position: relative;
		padding: var(--s2) var(--s4) calc(var(--s2) + env(safe-area-inset-bottom));
		border-top: 1px solid var(--line);
		background: var(--paper);
		cursor: pointer;
	}
	.hx-mini-progress {
		position: absolute;
		left: 0;
		right: 0;
		top: -1px;
		height: 2px;
	}
	.hx-mini-progress > span {
		display: block;
		height: 100%;
		width: var(--v, 0%);
		background: var(--accent);
	}
	.hx-mini .np-art {
		width: 48px;
	}
	.hx-mini-text {
		min-width: 0;
	}
	.hx-mini .track-title {
		font-size: 15px;
	}
	.hx-mini .track-sub {
		white-space: nowrap;
		overflow: hidden;
		text-overflow: ellipsis;
	}
	.hx-mini .play {
		width: 44px;
		height: 44px;
	}

	/* full player: slides up over everything */
	.hx-np {
		position: fixed;
		inset: 0;
		z-index: 60;
		gap: var(--s4);
		padding: var(--s3) var(--s6) calc(var(--s6) + env(safe-area-inset-bottom));
		border-left: 0;
		background: var(--paper);
		transform: translateY(100%);
		transition: transform 0.3s ease;
	}
	body.is-np .hx-np {
		transform: none;
	}
	.hx-np > .hx-np-close {
		display: inline-flex;
		align-self: flex-start;
		width: 40px;
		height: 40px;
		padding: 0;
		margin-left: calc(-1 * var(--s2));
		justify-content: center;
	}
	.hx-np .np-art {
		width: min(100%, 36vh);
	}
}

/* artist cards: round photo */
.hx-app .hx-artist .hx-cover {
	border-radius: 50%;
}

/* mobile: the stats are hidden, so the theme toggle goes to the right by itself */
@media (max-width: 900px) {
	.hx-app .theme-toggle {
		margin-left: auto;
	}
}
