/* Riff. The player follows YouTube Music's layout and measurements: a
   72px bar on a wide screen and the 2025 Now Playing on a phone. It is
   always dark. Rows in the post use the theme's own colours through
   currentcolor. Animate only transform and opacity. */

/* Roboto, shipped with the plugin (SIL Open Font License, see
   fonts/roboto/OFL.txt) rather than fetched from Google, so a listener's
   address never leaves the site. One variable file, Latin only.

   Optional, so it is never swapped in after the first paint: the app at app/
   preloads it (Riff\Listen\Fonts), which a browser waits a moment for, and
   its service worker keeps it for every launch after; elsewhere the bar is
   hidden until something plays, and the player fetches the font while the
   page is idle (riff.js). Where it still isn't there in time, the fallback
   below stands in at its size for the rest of the page's life. */
@font-face {
	font-family: "Riff Roboto";
	font-style: normal;
	font-weight: 100 900;
	font-display: optional;
	src: url(fonts/roboto/roboto.woff2) format("woff2");
}

/* Arial, or the Liberation Sans that stands in for it on Linux, sized and
   spaced to Roboto's measurements, so the text does not move when Roboto
   arrives and takes its place. */
@font-face {
	font-family: "Riff Roboto Fallback";
	src: local("Arial"), local("ArialMT"), local("Liberation Sans"), local("Arimo");
	size-adjust: 100.53%;
	ascent-override: 92.28%;
	descent-override: 24.28%;
	line-gap-override: 0%;
}

:root {
	/* stylelint-disable-next-line length-zero-no-unit -- calc() needs a length. */
	--riff-safe-b: env(safe-area-inset-bottom, 0px);
	/* stylelint-disable-next-line length-zero-no-unit -- calc() needs a length. */
	--riff-safe-t: env(safe-area-inset-top, 0px);

	/* and the sides, where a phone on its side or an unfolded one keeps its
	   status bar and its camera */
	/* stylelint-disable-next-line length-zero-no-unit -- calc() needs a length. */
	--riff-safe-l: env(safe-area-inset-left, 0px);
	/* stylelint-disable-next-line length-zero-no-unit -- calc() needs a length. */
	--riff-safe-r: env(safe-area-inset-right, 0px);
}

/* While Now Playing is open the page under it stays still, as in the apps:
   it does not scroll behind the dialog, and its scrollbar does not show
   beside the view's. */
html:has(#riff.is-open) {
	overflow: hidden;
}

/* Once Now Playing covers the page, the page is neither styled nor painted
   until it starts to close. */
[data-riff-covered] {
	content-visibility: hidden;
}

/* Room at the end of the page, so the bar never covers a post's last line. */
html.has-riff body::after {
	content: "";
	display: block;
	height: calc(var(--riff-bar-h) + var(--riff-safe-b));
}

/* And room above the bar when the page scrolls to something: the browser
   brings a focused link or a target into view clear of the bar rather than
   just under it (WCAG 2.4.11, focus not obscured). */
html.has-riff {
	scroll-padding-bottom: calc(var(--riff-bar-h) + var(--riff-safe-b) + 16px);
}

/* ---- Rows in the post */

.riff-track > audio[hidden],
.riff-track > video[hidden] {
	display: none !important;
}

/* A playlist block (WordPress 7.1): its own player and its track buttons step
   aside for the rows, and its item hover gives way to the row's. One class more
   than core's own rules, which a page prints after this stylesheet when the
   block renders after the head, as standalone mode's does. */
/* stylelint-disable selector-class-pattern -- core's own BEM class names. */
.wp-block-playlist.riff-tracks > .wp-block-playlist__waveform-player,
.wp-block-playlist-track.riff-track > .wp-block-playlist-track__button {
	display: none;
}
/* stylelint-enable selector-class-pattern */

.riff-tracks .wp-block-playlist-track.riff-track,
.riff-tracks .wp-block-playlist-track.riff-track:hover {
	background: none;
}

.riff-row {
	all: unset;
	box-sizing: border-box;
	display: grid;
	grid-template-columns: 48px minmax(0, 1fr) auto auto;
	align-items: center;
	gap: 16px;
	width: 100%;
	padding: 8px;
	border-radius: 4px;
	color: inherit;
	font: inherit;
	cursor: pointer;
	-webkit-tap-highlight-color: transparent;
	transition: background-color 0.15s;
}

.riff-row:hover,
.riff-row[data-current] {
	background: color-mix(in srgb, currentcolor 8%, transparent);
}

.riff-row:focus-visible {
	outline: 2px solid currentcolor;
	outline-offset: 2px;
}

/* The track a shared link names. */
.riff-row[data-shared] {
	background: color-mix(in srgb, currentcolor 8%, transparent);
	box-shadow: inset 3px 0 0 currentcolor;
}

.riff-row-art {
	position: relative;
	display: block;
	width: 48px;
	height: 48px;
	border-radius: 4px;
	overflow: hidden;
	background: color-mix(in srgb, currentcolor 12%, transparent);
}

.riff-row-art img {
	display: block;
	width: 100%;
	height: 100%;
	max-width: none;
	margin: 0;
	object-fit: cover;
}

/* Bars over the art of the playing track. */
.riff-row-state {
	position: absolute;
	inset: 0;
	display: flex;
	align-items: flex-end;
	justify-content: center;
	gap: 2px;
	padding-bottom: 30%;

	/* Dark enough that white bars read on a pale cover, too. */
	background: rgb(0 0 0 / 0.6);
	opacity: 0;
	transition: opacity 0.15s;
}

.riff-row-state i {
	width: 3px;
	height: 40%;
	background: #fff;
	border-radius: 1px;
	box-shadow: 0 0 2px rgb(0 0 0 / 0.4);
	transform-origin: bottom;
	transform: scaleY(0.35);
}

[data-current] .riff-row-state,
[aria-current] .riff-row-state,
.riff-row:hover .riff-row-state {
	opacity: 1;
}

[data-playing="true"] .riff-row-state i {
	animation: riff-eq 0.9s ease-in-out infinite alternate;
}

[data-playing="true"] .riff-row-state i:nth-child(2) {
	animation-delay: -0.3s;
}

[data-playing="true"] .riff-row-state i:nth-child(3) {
	animation-delay: -0.6s;
}

@keyframes riff-eq {

	to {
		transform: scaleY(1);
	}
}

.riff-row-text {
	display: grid;
	min-width: 0;
}

.riff-row-title,
.riff-row-sub {
	overflow: hidden;
	white-space: nowrap;
	text-overflow: ellipsis;
}

.riff-row-title {
	font-weight: 500;
}

/* The second line and the time step back from the title, but not past
   4.5:1 on a theme whose own text is translucent: Ipsum's is black at 75%,
   and 0.7 of that on its base came out at 4.3:1. */
.riff-row-sub,
.riff-row-time {
	opacity: 0.8;
}

.riff-row-time {
	font-variant-numeric: tabular-nums;
}

/* A track that could not be played, in words under its title. */
.riff-row-note {
	font-size: 0.875em;
}

/* A track this visitor may not play: dimmed, with a lock by its length. */
.riff-row-locked {
	text-decoration: none;
}

.riff-row-locked .riff-row-text {
	opacity: 0.55;
}

div.riff-row-locked {
	cursor: default;
}

.riff-row-lock {
	width: 16px;
	height: 16px;
	margin-right: 8px;
	vertical-align: -3px;
}

/* The player's areas (docs/player.md, "Areas"): badges and controls
   from Riff's own listeners. An empty area takes no room. */
.riff-area {
	display: inline-flex;
	align-items: center;
	gap: 8px;
}

/* In the bar an area is .riff-desk too, an inline grid: it runs across. */
.riff-bar-end .riff-area {
	grid-auto-flow: column;
	align-items: center;
	gap: 8px;
}

#riff .riff-area:empty {
	display: none !important;
}

/* The bar's controls (registry.js): each sits in the bar's end as if it
   were written there. One that says it doesn't show stays hidden, even
   where .riff-desk shows the rest. */
.riff-controls {
	display: contents;
}

#riff [data-riff-control][hidden] {
	display: none !important;
}

/* A badge is a pill, set at the right end of the
   bar. Riff's own is the quality: format and bit rate for the playing
   track. Centred with the controls. */
.riff-badge {
	display: inline-flex;
	align-items: center;
	flex: none;
	height: 28px;
	padding: 0 12px;
	border-radius: 999px;
	background: color-mix(in srgb, currentcolor 10%, transparent);
	color: var(--riff-accent);
	font-size: 12px;
	font-weight: 500;
	letter-spacing: 0.02em;
	white-space: nowrap;
	font-variant-numeric: tabular-nums;
}

/* The tier's colour, as a colour, so a change of tier moves the words
   and the light under them to the new one rather than switching at once. */
@property --riff-quality-ink {
	syntax: "<color>";
	inherits: true;
	initial-value: #c9d3db;
}

/* How far the light under the words reaches: low along the lower edge at
   rest, filling the well under a pointer. */
@property --riff-quality-lift {
	syntax: "<percentage>";
	inherits: true;
	initial-value: 0%;
}

/* The quality: a capsule pressed into the bar, its well
   dark at the top and lit from below, as a lamp under smoked glass, a bevel
   catching the light round its rim, and the words glowing in the colour of
   the tier (paint.js): pale for a lossy file, green at CD quality, amber past
   it. */
.riff-quality {
	--riff-quality-ink: #c9d3db;
	height: 42px;
	padding: 0 22px;
	border: 2px solid #000;
	background: radial-gradient(calc(70% + var(--riff-quality-lift)) calc(80% + var(--riff-quality-lift)) at 50% 100%, color-mix(in srgb, var(--riff-quality-ink) calc(30% + var(--riff-quality-lift) / 2), #0b0a08), color-mix(in srgb, var(--riff-quality-ink) calc(10% + var(--riff-quality-lift) / 3), #0a0a09) calc(55% + var(--riff-quality-lift) / 2), #080808 92%);
	box-shadow:
		inset 0 4px 8px rgb(0 0 0 / 0.85),
		inset 0 -1px 1px color-mix(in srgb, var(--riff-quality-ink) 18%, transparent),
		0 0 0 1px rgb(255 255 255 / 0.09),
		0 -1px 0 1px rgb(255 255 255 / 0.05),
		0 2px 5px rgb(0 0 0 / 0.55);
	color: var(--riff-quality-ink);
	font-size: 14px;
	font-weight: 400;
	letter-spacing: 0.01em;
	text-shadow: 0 0 8px color-mix(in srgb, var(--riff-quality-ink) 55%, transparent);
	transition:
		--riff-quality-ink 0.4s ease,
		--riff-quality-lift 0.25s ease;
}

.riff-quality:hover {
	--riff-quality-lift: 32%;
}

@media (prefers-reduced-motion: reduce) {

	.riff-quality {
		transition: none;
	}
}

/* a lossy file's capsule is lit less: no glow round its words */
.riff-quality-lossy {
	text-shadow: none;
}

.riff-quality-lossless {
	--riff-quality-ink: #4fdcaa;
}

.riff-quality-hires {
	--riff-quality-ink: #f2b844;
}

.riff-bar-end .riff-area {
	margin-inline-end: 8px;
}

#riff .riff-np-quality {
	display: flex;
	margin: 8px 0 0;
	color: var(--riff-fg-2);
	line-height: 1;
}

.riff-row .riff-row-dot {
	display: none;
}

/* Something visitors can't see, for someone signed in who can: WordPress's
   lock, its body filled so it is not a locked track's outline lock, in the
   line's own ink, which already passes 4.5:1, with the word said beside it
   (Ui::private_mark(), rows.js). Rows mark it only in the
   Listen app; a private post's own page says so in its title. */
.riff-private {
	display: inline-flex;
	gap: 0.25em;
	align-items: center;
	margin-inline-end: 0.35em;
	vertical-align: -0.15em;
}

.riff-private svg {
	flex: none;
	width: 1.35em;
	height: 1.35em;
}

.riff-row .riff-private {
	display: none;
}

.riff-app .riff-row .riff-private {
	display: inline-flex;
}

/* The video mark: a small film icon after the title, in the row's ink. */
.riff-row-video {
	display: inline-block;
	width: 1em;
	height: 1em;
	margin-inline-start: 0.4em;
	vertical-align: -0.15em;
	opacity: 0.55;
}

.riff-row-video svg {
	display: block;
	width: 100%;
	height: 100%;
}

/* ---- The player. Theme styles stop at #riff. */

#riff {
	--riff-tint: #303030;
	--riff-p: 0;
	position: relative;
	z-index: 100000;
	color: var(--riff-fg);

	/* Dark on any page, so the browser draws scrollbars dark too. */
	color-scheme: dark;
	font: 400 16px/1.2 "Riff Roboto", Roboto, "Riff Roboto Fallback", system-ui, -apple-system, "Segoe UI", sans-serif;
	-webkit-font-smoothing: antialiased;
}

#riff[hidden],
#riff [hidden] {
	display: none !important;
}

#riff *,
#riff *::before,
#riff *::after {
	box-sizing: border-box;
}

/* Button classes below are written as #riff .class so they outweigh this reset
   and any theme's. */
#riff button {
	all: unset;
	box-sizing: border-box;
	cursor: pointer;
	-webkit-tap-highlight-color: transparent;
}

/* One ring for every control of the player's that has the keyboard's focus,
   outside its edge and round its corners (tokens.css). */
#riff button:focus-visible,
#riff input:focus-visible,
#riff a:focus-visible,
#riff summary:focus-visible,
#riff :where([tabindex]:not([tabindex="-1"])):focus-visible {
	outline: var(--riff-focus-ring);
	outline-offset: var(--riff-focus-ring-offset);
}

#riff h2,
#riff h3,
#riff p {
	margin: 0;
	padding: 0;
	color: inherit;
	font: inherit;
	letter-spacing: normal;
	text-transform: none;
}

#riff img {
	max-width: none;
	margin: 0;
	border: 0;
	box-shadow: none;
}

#riff svg {
	display: block;
	width: 24px;
	height: 24px;
}

#riff .riff-btn {
	display: inline-grid;
	place-items: center;
	flex: none;
	width: 40px;
	height: 40px;
	border-radius: 50%;
	color: var(--riff-fg);
	transition: background-color 0.15s;
}

#riff .riff-btn:hover {
	background: var(--riff-hover);
}

#riff .riff-btn[aria-pressed="false"],
#riff [data-riff-action="repeat"][data-repeat="off"] {
	color: var(--riff-fg-2);
}

/* Repeat shows its "one" glyph only in that mode. By type, not by child: the
   deck's repeat key ends with its reach (.riff-hit), not its glyph. */
#riff [data-riff-action="repeat"] svg:last-of-type,
#riff [data-riff-action="repeat"][data-repeat="one"] svg:first-of-type {
	display: none;
}

#riff [data-riff-action="repeat"][data-repeat="one"] svg:last-of-type {
	display: block;
}

/* Play and pause share a button; the state picks the glyph. */
#riff .riff-play svg:last-child,
#riff[data-playing="true"] .riff-play svg:first-child {
	display: none;
}

#riff[data-playing="true"] .riff-play svg:last-child {
	display: block;
}

#riff[data-waiting] .riff-play {
	animation: riff-pulse 1s ease-in-out infinite alternate;
}

@keyframes riff-pulse {

	to {
		opacity: 0.5;
	}
}

/* ---- Seek lines. A native range sits on top of a drawn line: a thin
   track, how far the file has loaded in a quieter shade, and the played
   part in the accent. Nothing on it moves but the played part and the knob,
   by transform. */

.riff-line {
	position: absolute;
	left: 0;
	right: 0;
	top: 50%;
	height: 2px;
	margin-top: -1px;
	background: var(--riff-line);
	pointer-events: none;
	transition: transform 0.1s;
}

.riff-line i {
	position: absolute;
	inset: 0;
	background: var(--riff-cover-accent);
	transform-origin: left;
	transform: scaleX(var(--riff-p));
}

/* How far the file has loaded, a lighter band under the played part. */
.riff-line::before {
	content: "";
	position: absolute;
	inset: 0;
	background: color-mix(in srgb, var(--riff-fg) 22%, transparent);
	transform-origin: left;
	transform: scaleX(var(--riff-buffered, 0));
}

.riff-seek {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	margin: 0;
	opacity: 0;
	cursor: pointer;
}

.riff-knob,
.riff-tip {
	display: none;
}

/* The seek input is invisible, so its focus ring is drawn on the bar
   around it. */
#riff .riff-seek:focus-visible {
	outline: none;
}

.riff-bar-seek:has(> .riff-seek:focus-visible),
.riff-np-seek:has(> .riff-seek:focus-visible) {
	outline: var(--riff-focus-ring, 2px solid var(--riff-fg));
	outline-offset: var(--riff-focus-ring-offset, 2px);
	border-radius: 4px;
}

/* Right to left: the played part grows from the right, and the knob
   sits at its end. */
[dir="rtl"] .riff-line i,
[dir="rtl"] .riff-line::before {
	transform-origin: right;
}

[dir="rtl"] .riff-knob {
	transform: translateX(calc((1 - var(--riff-p)) * 100%));
}

[dir="rtl"] .riff-knob::after {
	right: auto;
	left: -7px;
}

/* With a live reading the bars follow it; the keyframes are for when there
   is none. */
html:has(#riff[data-live]) [data-playing="true"] .riff-row-state i {
	animation: none;
}

/* ---- The bar. On a phone: art, title and artist, Cast, play. Swipe it to
   skip. */

.riff-bar {
	position: fixed;
	left: 0;
	right: 0;
	bottom: 0;
	display: flex;
	align-items: center;
	gap: 4px;
	height: calc(var(--riff-bar-h) + var(--riff-safe-b));
	padding: 0 8px var(--riff-safe-b) 8px;
	background: var(--riff-surface);
}

/* On a phone the line runs along the top edge and is a readout, not a
   control. */
.riff-bar-seek {
	position: absolute;
	left: 0;
	right: 0;
	top: 0;
	height: 2px;
}

.riff-bar-seek .riff-line {
	top: 0;
	margin: 0;
}

.riff-bar-seek .riff-seek {
	pointer-events: none;
}

.riff-bar-center,
.riff-bar-end {
	display: flex;
	align-items: center;
}

/* On a phone the transport and the times are only Play: their wrappers
   step out of the row. */
.riff-bar-transport,
.riff-bar-progress {
	display: contents;
}

.riff-bar-center {
	order: 3;
}

.riff-bar-end {
	order: 2;
}

#riff .riff-bar-info {
	order: 1;
	display: flex;
	flex: 1;
	align-items: center;
	gap: 12px;
	min-width: 0;
	height: 100%;
	touch-action: pan-y;
	transition: transform 0.2s;
}

#riff .riff-bar-info.is-dragging {
	transition: none;
}

.riff-thumb {
	flex: none;
	width: 40px;
	height: 40px;
	border-radius: 2px;
	overflow: hidden;
	background: var(--riff-hover);
}

.riff-thumb img {
	width: 100%;
	height: 100%;
	object-fit: cover;
}

.riff-bar-text {
	display: grid;
	min-width: 0;
}

.riff-title,
.riff-sub {
	overflow: hidden;
	white-space: nowrap;
	text-overflow: ellipsis;
}

.riff-title {
	font-size: 15px;
	font-weight: 500;
}

.riff-sub {
	color: var(--riff-fg-2);
	font-size: 14px;
}

.riff-desk {
	display: none !important;
}

/* Wide, but not a phone on its side, however wide its screen: that keeps
   the phone's bar, beside its tabs, as it does at 899px. */
@media (min-width: 900px) and (not ((pointer: coarse) and (min-aspect-ratio: 5 / 4) and (max-height: 500px))) {

	.riff-desk {
		display: inline-grid !important;
	}

	.riff-mobile {
		display: none !important;
	}

	/* Three columns: the track, the transport with the
	   seek line under it, then volume, the quality pill and the caret. */
	.riff-bar {
		display: grid;

		/* The track and the end share alike either side of the transport, so it
		   stays in the middle whatever each track's end holds: the quality
		   pill's text and the views' buttons change from track to track. Where
		   the end's controls outgrow their share, the end keeps room for them
		   and the track's column gives way, its text trimming, instead of the
		   controls running out of sight. */
		grid-template-columns: minmax(0, 1fr) clamp(320px, 40%, 640px) minmax(max-content, 1fr);
		gap: 16px;

		/* for the end's cap below, as wide as the bar */
		container-type: inline-size;
		padding: 0 4px var(--riff-safe-b) 16px;
	}

	.riff-bar-center,
	.riff-bar-end,
	#riff .riff-bar-info {
		order: 0;
	}

	.riff-bar-center {
		flex-direction: column;
		justify-content: center;
		align-items: stretch;
		gap: 2px;
		height: 100%;
	}

	.riff-bar-transport {
		display: flex;
		justify-content: center;
		align-items: center;
		gap: 8px;
	}

	.riff-bar-progress {
		display: flex;
		align-items: center;
		gap: 8px;
	}

	/* Never past half the bar, however many views and controls it holds, so
	   they can't push the bar past the window's edge: past that it scrolls. */
	.riff-bar-end {
		justify-content: flex-end;

		/* at the end, but from the start where it scrolls, so nothing is
		   out of reach */
		justify-content: safe flex-end;
		gap: 8px;
		min-width: 0;
		max-width: 50cqi;
		height: 100%;
		padding-right: 8px;
		overflow-x: auto;
		scrollbar-width: none;
	}

	#riff .riff-bar-info {
		justify-content: flex-start;
		gap: 16px;
	}

	.riff-bar-text {
		max-width: 520px;
	}

	.riff-title,
	.riff-sub {
		font-size: 16px;
		line-height: 19.2px;
	}

	#riff .riff-skip-sm {
		width: 36px;
		height: 36px;
	}

	#riff .riff-bar .riff-play svg {
		width: 32px;
		height: 32px;
	}

	/* Each time beside its end of the line, wide enough for an hour. */
	.riff-time {
		display: inline-block !important;
		min-width: 4ch;
		color: #aaa;
		font-size: 12px;
		line-height: 14.4px;
		font-variant-numeric: tabular-nums;
		white-space: nowrap;
	}

	.riff-time[data-riff-text="current"] {
		text-align: right;
	}

	/* The seek line under the transport: 2px, 4px with a knob and the time
	   while pointed at, in a taller strip that is easy to hit. */
	.riff-bar-seek {
		position: relative;
		flex: 1;
		top: auto;
		height: 16px;
	}

	.riff-bar-seek .riff-line {
		top: 7px;
	}

	.riff-bar-seek .riff-seek {
		pointer-events: auto;
	}

	.riff-bar-seek:hover .riff-line,
	#riff[data-seeking] .riff-bar-seek .riff-line {
		transform: scaleY(2);
	}

	/* The knob is a rail as wide as the line, slid by transform, with the
	   dot at its end: it moves on the compositor with the line it sits on,
	   never by a layout. It shows only while the line is pointed at, in focus
	   or held. */
	.riff-knob {
		position: absolute;
		top: 8px;
		left: 0;
		right: 0;
		display: block;
		height: 14px;
		margin-top: -7px;
		pointer-events: none;
		opacity: 0;
		transform: translateX(calc((var(--riff-p) - 1) * 100%));
		transition: opacity 0.1s;
		will-change: opacity;
	}

	.riff-knob::after {
		content: "";
		position: absolute;
		top: 0;
		right: -7px;
		width: 14px;
		height: 14px;
		border-radius: 50%;
		background: var(--riff-cover-accent);
	}

	.riff-bar-seek:hover .riff-knob,
	.riff-bar-seek:has(> .riff-seek:focus-visible) .riff-knob,
	#riff[data-seeking] .riff-bar-seek .riff-knob {
		opacity: 1;
	}

	/* Over the transport, so lighter than the bar, as a tooltip. */
	.riff-tip {
		position: absolute;
		bottom: 18px;
		display: block;
		padding: 4px 8px;
		border-radius: 4px;
		background: #424242;
		color: var(--riff-fg);
		font-size: 12px;
		transform: translateX(-50%);
		pointer-events: none;
		white-space: nowrap;
	}

	/* the bar's own colour, whatever a theme or the app makes it, down
	   through the end and its controls */
	.riff-bar-end,
	.riff-bar-end [data-riff-controls] {
		background: inherit;
	}

	/* Volume: the mute button and a short slider beside it, in a slot of
	   its own whose width never changes, so nothing opens over the controls
	   next to it or moves them. The slider is drawn as the seek line is: a
	   thin track, the level filled in the accent, and a thumb only while it
	   is pointed at, in focus or held. */
	.riff-volume {
		display: flex !important;
		flex: none;
		align-items: center;
		color: var(--riff-fg-2);
	}

	#riff .riff-volume-mute svg:last-child,
	#riff .riff-volume-mute[aria-pressed="true"] svg:first-child {
		display: none;
	}

	#riff .riff-volume-mute[aria-pressed="true"] svg:last-child {
		display: block;
	}

	.riff-volume input {
		--riff-vol-fill: var(--riff-cover-accent, var(--riff-accent));
		-webkit-appearance: none;
		appearance: none;
		flex: none;
		width: 104px;
		height: 24px;
		margin: 0 8px 0 0;
		background: transparent;
		cursor: pointer;
	}

	.riff-volume input[hidden] {
		display: none;
	}

	.riff-volume input:focus-visible {
		outline: var(--riff-focus-ring, 2px solid var(--riff-fg));
		outline-offset: var(--riff-focus-ring-offset, 2px);
		border-radius: 4px;
	}

	/* muted, the level stays, quieter, for unmuting to come back to */
	.riff-volume:has([aria-pressed="true"]) input {
		opacity: 0.5;
	}

	.riff-volume input::-webkit-slider-runnable-track {
		height: 2px;
		border-radius: 1px;
		/* stylelint-disable-next-line @stylistic/max-line-length */
		background: linear-gradient(90deg, var(--riff-vol-fill) calc(var(--riff-vol, 1) * 100%), var(--riff-line) 0);
	}

	[dir="rtl"] .riff-volume input::-webkit-slider-runnable-track {
		/* stylelint-disable-next-line @stylistic/max-line-length */
		background: linear-gradient(270deg, var(--riff-vol-fill) calc(var(--riff-vol, 1) * 100%), var(--riff-line) 0);
	}

	.riff-volume input::-moz-range-track {
		height: 2px;
		border-radius: 1px;
		background: var(--riff-line);
	}

	.riff-volume input::-moz-range-progress {
		height: 2px;
		border-radius: 1px;
		background: var(--riff-vol-fill);
	}

	.riff-volume input::-webkit-slider-thumb {
		-webkit-appearance: none;
		appearance: none;
		width: 12px;
		height: 12px;
		margin-top: -5px;
		border: 0;
		border-radius: 50%;
		background: var(--riff-vol-fill);
		opacity: 0;
		transition: opacity 0.1s;
	}

	.riff-volume input::-moz-range-thumb {
		width: 12px;
		height: 12px;
		border: 0;
		border-radius: 50%;
		background: var(--riff-vol-fill);
		opacity: 0;
		transition: opacity 0.1s;
	}

	.riff-volume input:hover::-webkit-slider-thumb,
	.riff-volume input:focus-visible::-webkit-slider-thumb,
	.riff-volume input[data-held]::-webkit-slider-thumb {
		opacity: 1;
	}

	.riff-volume input:hover::-moz-range-thumb,
	.riff-volume input:focus-visible::-moz-range-thumb,
	.riff-volume input[data-held]::-moz-range-thumb {
		opacity: 1;
	}

	/* Volume, repeat and shuffle sit back in #909090; the caret is white. */
	#riff .riff-bar-end .riff-btn,
	#riff .riff-bar .riff-mode,
	.riff-volume {
		color: #909090;
	}

	#riff .riff-bar-end .riff-btn[aria-pressed="true"],
	#riff .riff-bar .riff-mode[aria-pressed="true"],
	#riff .riff-bar .riff-mode[data-repeat="all"],
	#riff .riff-bar .riff-mode[data-repeat="one"] {
		color: var(--riff-fg);
	}
}

/* ---- Now Playing */

.riff-np {
	position: fixed;
	inset: 0;
	display: flex;
	flex-direction: column;
	padding: var(--riff-safe-t) 0 var(--riff-safe-b);
	background: var(--riff-bg);
	overflow: hidden;
	transform: translateY(100%);
	transition: transform 0.32s cubic-bezier(0.2, 0, 0, 1);

	/* its shape says whether the album is the cover or the turntable */
	container: riff-np / size;
}

.riff-np.is-in {
	transform: none;
}

/* The whole screen takes the artwork's colour, a little darker towards the
   bottom. */
.riff-np-bg {
	position: absolute;
	inset: 0;
	background: linear-gradient(var(--riff-tint), color-mix(in srgb, var(--riff-tint) 70%, #000));
	pointer-events: none;
}

/* Over it, a soft wash of the cover's accent from the top. When the track
   changes the last one's (::before) fades out as this one's (::after) fades
   in, by their opacity alone (now-playing.js). */
.riff-np-bg::before,
.riff-np-bg::after {
	content: "";
	position: absolute;
	inset: 0;
	background-color: var(--riff-cover-accent);
	opacity: 0.14;
	-webkit-mask-image: radial-gradient(120% 70% at 50% 0%, #000, transparent 75%);
	mask-image: radial-gradient(120% 70% at 50% 0%, #000, transparent 75%);
}

.riff-np-bg::before {
	background-color: var(--riff-cover-accent-was, var(--riff-cover-accent));
	opacity: 0;
}

.riff-np-bg[data-riff-fading]::before {
	animation: riff-wash-out 0.6s ease-out;
}

.riff-np-bg[data-riff-fading]::after {
	animation: riff-wash-in 0.6s ease-out;
}

@keyframes riff-wash-out {

	from {
		opacity: 0.14;
	}

	to {
		opacity: 0;
	}
}

@keyframes riff-wash-in {

	from {
		opacity: 0;
	}

	to {
		opacity: 0.14;
	}
}

.riff-np-head,
.riff-np-body {
	position: relative;
}

.riff-np-head {
	display: grid;
	flex: none;
	grid-template-columns: 1fr auto 1fr;
	align-items: center;
	height: 56px;
	padding: 0 12px;
	touch-action: none;
}

/* The right end: Captions, for a video version that has them. */
.riff-np-end {
	grid-column: 3;
	justify-self: end;
	display: flex;
	align-items: center;
	gap: 4px;
}


/* Song and Video: two icons on a phone, two words on a wide screen. */
.riff-modes {
	grid-column: 2;
	display: flex;
	padding: 2px;
	border-radius: 999px;
	background: rgb(0 0 0 / 0.3);
}

#riff .riff-modes button {
	display: grid;
	place-items: center;
	width: 48px;
	height: 32px;
	border-radius: 999px;
	color: var(--riff-fg-3);
}

#riff .riff-modes button[aria-checked="true"] {
	background: var(--riff-hover);
	color: var(--riff-fg);
}

#riff .riff-modes svg {
	width: 20px;
	height: 20px;
}

.riff-modes span {
	position: absolute;
	width: 1px;
	height: 1px;
	overflow: hidden;
	clip-path: inset(50%);
	white-space: nowrap;
}

/* While a video plays untouched, the switch and the bar fade away, and come
   back at the first move (now-playing.js). The bar fades into Now Playing's
   own black under a veil, rather than to the page behind it. Faded, they let
   a tap through to the picture, which brings them back, rather than pressing
   what can't be seen. */
.riff-bar::before {
	content: "";
	position: absolute;
	z-index: 1;
	inset: 0;
	background: var(--riff-bg);
	opacity: 0;
	pointer-events: none;
}

#riff[data-riff-idle] .riff-bar {
	pointer-events: none;
}

#riff[data-riff-idle] .riff-bar::before {
	opacity: 1;
}

#riff[data-riff-idle] .riff-modes {
	opacity: 0;
	pointer-events: none;
}

@media (prefers-reduced-motion: no-preference) {

	#riff .riff-bar::before,
	#riff .riff-modes {
		transition: opacity 0.3s ease;
	}
}

.riff-np-body {

	/* the space either side of the art on a wide screen */
	--riff-np-gutter: 56px;
	display: flex;
	flex: 1;
	flex-direction: column;
	min-height: 0;
}

.riff-stage {
	display: grid;
	flex: 1;
	place-items: center;
	min-height: 0;
	padding: 34px 32px 24px;
	container: riff-stage / size;
	touch-action: none;
}

.riff-cover,
.riff-video {
	grid-area: 1 / 1;
	border-radius: 8px;
}

.riff-cover {
	width: min(100cqw, 100cqh);
	height: min(100cqw, 100cqh);
	object-fit: cover;
	user-select: none;
}

/* The record behind the cover, as in its sleeve, and the turntable it comes
   out onto, which is the record's size and stands where the record goes:
   its plinth and platter under the record, its arm over it. While the album
   plays the record slides out onto the platter, far enough to show its
   label, the cover moving left to make room. Its label is printed in the
   cover's own colours. */
.riff-record,
.riff-deck-part {
	position: relative;
	grid-area: 1 / 1;
	width: min(100cqw, 100cqh);
	height: min(100cqw, 100cqh);
	pointer-events: none;
	container-type: inline-size;
}

/* The record's cut, by its share of the radius, a 12-inch LP's unless
   now-playing.js says it is a 7-inch single: the label and the lead-out
   groove. */
#riff {
	--riff-label-inset: 33.5%;
	--riff-lead-out: 40%;
}

/* A 7-inch single at 45: a label half its width round a hole for a jukebox's
   spindle, and 60s / 45 = 1.33s a turn. */
#riff[data-riff-format="7"] {
	--riff-label-inset: 25%;
	--riff-lead-out: 56%;
}

.riff-record {
	transition: translate 0.75s var(--riff-hand), scale 0.75s var(--riff-hand);

	/* its transform is its height above the mat as it is set down
	   (now-playing.js) */
	will-change: translate, scale, transform;
}

/* A side turned over (now-playing.js, flip()): the record lifted clear of
   the spindle, 0 on the mat to 1 off it, and turned about its diameter,
   0deg to 180deg, edge-on at 90deg. Typed, so they move between frames;
   deck-gl.js draws the record from them at its own size throughout. */
@property --riff-lift {
	syntax: "<number>";
	inherits: false;
	initial-value: 0;
}

@property --riff-turn {
	syntax: "<angle>";
	inherits: false;
	initial-value: 0deg;
}

/* The way a record, its sleeve and the arm move: carried by a hand, on the
   minimum-jerk path reaching movements follow, x = 10t³ − 15t⁴ + 6t⁵,
   setting off and arriving with neither speed nor acceleration
   (now-playing.js, hand()). Drawn with linear() where a browser has it;
   elsewhere the cubic Bézier within 1% of it. */
#riff {
	--riff-hand: cubic-bezier(0.5, 0, 0.5, 1);
}

@supports (transition-timing-function: linear(0, 1)) {

	#riff {
		--riff-hand: linear(0, 0.001, 0.009, 0.027, 0.058, 0.104, 0.163, 0.235, 0.317, 0.407, 0.5, 0.593, 0.683, 0.765, 0.837, 0.896, 0.942, 0.973, 0.991, 0.999, 1);
	}
}

/* the label: a disc that turns as one at 33⅓, an LP's speed (60s / 33⅓ =
   1.8s a turn, at an even speed), printed as a record's label is, in
   zones round the spindle that nothing crosses: the album across the top
   half, the side and speed beside the hole, the artist and the side's
   tracks across the bottom half, the round edge clipping what runs long,
   on paper printed in the cover's own colour, its average (now-playing.js),
   the words dark on a light colour and light on a dark one so they read.
   It is flat, as printed paper is: the only light on it is the record's,
   which stays still. */
.riff-spin {
	position: absolute;
	inset: var(--riff-label-inset);
	border-radius: 50%;

	/* the round edge as a clip on the turning layer itself, which every
	   engine keeps on the compositor; an overflow clip on a turning layer
	   is one Safari has dropped */
	clip-path: circle(50%);
	container-type: inline-size;
}

.riff-label {
	position: absolute;
	inset: 0;
	display: grid;
	grid-template-columns: minmax(0, 1fr);
	grid-template-rows: 38% 24% auto auto;
	justify-items: center;
	padding: 0 16%;
	background: var(--riff-label-paper, #3a3a3a);
	color: var(--riff-label-ink, #fff);
	font-family: var(--riff-font, inherit);
	line-height: 1.15;
	text-align: center;
}

.riff-label b {
	display: -webkit-box;
	grid-row: 1;
	align-self: end;
	margin-bottom: 2%;
	overflow: hidden;
	font-size: 9cqi;
	font-weight: 700;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
}

.riff-label i {
	display: -webkit-box;
	grid-row: 3;
	max-width: 100%;
	overflow: hidden;
	font-size: 6cqi;
	font-style: normal;
	opacity: 0.85;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
}

/* the side's tracks, as a pressed label lists them, where the label is
   drawn large enough for its smallest type to be read */
.riff-label-tracks {
	display: none;
	grid-row: 4;
	max-width: 100%;
	margin: 3% 0 0;
	padding: 0;
	list-style: none;
	font-size: 3.4cqi;
	line-height: 1.35;
	white-space: pre;
	opacity: 0.8;
}

.riff-label-tracks li {
	overflow: hidden;
	text-overflow: ellipsis;
}

@container (min-width: 200px) {

	.riff-label-tracks {
		display: block;
	}
}

/* a long side in two columns, smaller, as a pressed label sets it */
.riff-label-tracks:has(li:nth-child(6)) {
	columns: 2;
	column-gap: 6%;
	width: 84%;
	font-size: 2.5cqi;
}

/* the side and speed to the left of the hole */
.riff-label small {
	grid-row: 2;
	align-self: center;
	justify-self: start;
	margin-left: -6%;
	font-size: 4.5cqi;
	letter-spacing: 0.06em;
	opacity: 0.7;
}

.riff-cover {
	position: relative;
	transition: translate 0.75s var(--riff-hand) 0.08s, scale 0.75s var(--riff-hand) 0.08s;
	will-change: translate, scale;
}

/* Out of the sleeve (now-playing.js, once the album first plays): the record
   slides onto the platter, and the sleeve, a beat behind, is laid flat
   beside the turntable, as on the desk it stands on, a little apart from its
   plinth. A record and its sleeve are one
   size, so they stay one size. It stays out when paused, as a record on the
   platter does; it goes back in when the album changes. The turntable is
   always where the record goes, and shows once there is a record for it:
   small enough, with the sleeve, to fit where the cover alone did, the two
   centred as one, the plinth reaching further on its arm side. Where Now
   Playing is wide the sleeve goes once the record is out, and the deck
   stands alone in the middle (below). */
.riff-stage {
	--riff-out-scale: 0.42;
	--riff-out-cover: -28.5%;
	--riff-out-record: 17.6%;

	/* the plinth reaches further above the record than below it: down a
	   little, so the turntable is in the middle */
	--riff-out-drop: 4%;
}

#riff[data-riff-deck="out"] .riff-cover {
	translate: var(--riff-out-cover) 0;
	scale: var(--riff-out-scale);
}

#riff[data-riff-deck="out"] .riff-record,
.riff-deck-part {
	translate: var(--riff-out-record) var(--riff-out-drop);
	scale: var(--riff-out-scale);
}

.riff-deck-part {
	opacity: 0;
	transition: opacity 0.4s;
}

#riff:is([data-riff-deck="out"], [data-riff-arriving]) .riff-deck-part {
	opacity: 1;
}

#riff[data-mode="video"] .riff-deck-part {
	display: none;
}

/* The record's grooves under a mouse or a pen (now-playing.js): a press
   puts the needle down in the groove pointed at, and the band and the
   moment there are said beside the pointer, as they are for the groove
   under the stylus while the arm is in the hand. Under the arm, which is
   taken first. */
.riff-cue {
	position: absolute;
	inset: 0;
	border-radius: 50%;
}

@media (hover: hover) and (pointer: fine) {

	#riff[data-riff-deck="out"] .riff-cue {
		pointer-events: auto;
	}

	.riff-cue[data-riff-over] {
		cursor: crosshair;
	}
}

.riff-cue-tip {
	position: absolute;
	z-index: 3;
	top: 0;
	left: 0;
	padding: 4px 8px;
	border-radius: 4px;
	background: #424242;
	color: var(--riff-fg);
	font-size: 12px;
	font-variant-numeric: tabular-nums;
	transform: translate(-50%, calc(-100% - 16px));
	pointer-events: none;
	white-space: nowrap;
}

/* The deck's keys, on a strip along the front of its plinth, as a deck
   keeps them: start and stop at the left, the largest, then the two
   speeds, the track before and the track after, then shuffle and repeat.
   Each is a button in the page, placed by the record's own width as every
   part of the deck is, with a lamp along its top edge, amber when lit:
   start's while the music plays, the speed's that is chosen, shuffle's
   and repeat's while they are on. They are there while the record is out,
   and are the transport then: the deck is on its own, with no bar
   (below). */
.riff-keys {
	visibility: hidden;
}

#riff:is([data-riff-deck="out"], [data-riff-arriving]) .riff-keys {
	visibility: visible;
}

#riff .riff-keys button {
	position: absolute;
	top: 109%;
	display: grid;
	place-items: center;
	width: 9.5%;
	height: 7.5%;
	padding: 0;
	border: 0;
	border-radius: 0.8cqi;
	background: none;
	color: rgb(255 255 255 / 0.62);
	pointer-events: auto;
}

/* Each key reaches past its drawn cap as far as a finger or a mouse needs
   to press it, and no further than its neighbour's (deck-gl.js sets how
   far, on the page's flat deck). Invisible: what shows is the cap. */
#riff .riff-keys .riff-hit {
	position: absolute;
	inset: calc(-1 * var(--riff-hit-y, 0px)) calc(-1 * var(--riff-hit-x, 0px));
}

#riff .riff-keys svg {
	width: 3.6cqi;
	height: 3.6cqi;
}

#riff .riff-keys .riff-key-start {
	top: 107.5%;
	left: 0;
	width: 18%;
	height: 9.5%;
	font-size: 1.9cqi;
	font-weight: 500;
	letter-spacing: 0.08em;
	text-transform: uppercase;
	white-space: nowrap;
}

/* the two speeds, a radio group whose box is the deck's own */
.riff-keys .riff-speeds {
	position: absolute;
	inset: 0;
	pointer-events: none;
}

/* every small key's legend sits the same way below its lamp's line, lamp or
   not, so the row reads as one printed panel */
#riff .riff-keys :where(button:not(.riff-key-start)) {
	padding-top: 1.2cqi;
}

#riff .riff-keys :is(.riff-key-33, .riff-key-45) {
	width: 7.5%;
	font-size: 2.1cqi;
	font-weight: 500;
	font-variant-numeric: tabular-nums;
	letter-spacing: 0.04em;
}

#riff .riff-keys .riff-key-33 {
	left: 21.5%;
}

#riff .riff-keys .riff-key-45 {
	left: 30%;
}

#riff .riff-keys .riff-key-prev {
	left: 41%;
	width: 8%;
}

#riff .riff-keys .riff-key-next {
	left: 50%;
	width: 8%;
}

#riff .riff-keys .riff-key-shuffle {
	left: 61.5%;
	width: 7.5%;
}

#riff .riff-keys .riff-key-repeat {
	left: 70%;
	width: 7.5%;

	/* its lamp says whether it is on; the glyph stays as legible off */
	opacity: 1;
}

/* The deck's display, in a window on the strip beside its keys, behind
   glass: the band and the time, the speed, and under them a row of lamps
   lit as far as the music is loud, over a scale in decibels (level.js),
   all in the one amber. Dark, but for what it says, while there is
   nothing to read. */
#riff .riff-keys .riff-level {
	position: absolute;
	top: 106.6%;
	left: 80%;
	width: 43%;
	height: 11.2%;
	border-radius: 0.9cqi;
	background:
		linear-gradient(168deg, rgb(255 255 255 / 0.07), transparent 34%),
		radial-gradient(120% 140% at 50% 0%, #15110c, #060504);
	box-shadow: inset 0 0.4cqi 1cqi rgb(0 0 0 / 0.9), 0 0 0 0.25cqi #050505, 0 0.15cqi 0 0.25cqi rgb(255 255 255 / 0.07);
	color: #ffc98a;
}

/* The pitch fader, ±8%, at the plinth's right under the arm's rest, as a
   deck has it: the music, its pitch, the platter, the strobe and the arm
   move together (now-playing.js). deck-gl.js draws its slot, from 60% to
   92% down at 113.5% across, and its cap, 5.4% by 3.3%, which the range's
   thumb is the size of, so a hand takes the cap where it is drawn: −8 at
   the slot's back, +8 toward the listener, as a deck has it. Its scale is
   printed on the plinth at its right, in the keys' legends' ink. */
#riff .riff-keys .riff-pitch {
	position: absolute;
	inset: 0;
	color: rgb(255 255 255 / 0.62);
	font-weight: 500;
	line-height: 1;
	pointer-events: none;
}

#riff .riff-pitch input {
	position: absolute;
	top: 61%;
	left: calc(110.8% - var(--riff-hit-x, 0px));
	width: calc(5.4% + 2 * var(--riff-hit-x, 0px));
	height: 30%;
	margin: 0;
	border-radius: 0.8cqi;
	background: none;
	writing-mode: vertical-lr;
	appearance: none;
	cursor: grab;
	pointer-events: auto;
}

#riff .riff-pitch input:active {
	cursor: grabbing;
}

#riff .riff-pitch input::-webkit-slider-runnable-track {
	background: none;
}

#riff .riff-pitch input::-moz-range-track {
	background: none;
}

#riff .riff-pitch input::-webkit-slider-thumb {
	width: 5.4cqi;
	height: 3.3cqi;
	background: none;
	appearance: none;
}

#riff .riff-pitch input::-moz-range-thumb {
	width: 5.4cqi;
	height: 3.3cqi;
	border: 0;
	background: none;
}

#riff .riff-pitch input:focus-visible {
	outline: var(--riff-focus-ring);
	outline-offset: var(--riff-focus-ring-offset);
}

/* A tick for each 1%, from the cap's middle at one end of its travel to
   its middle at the other, the 4s and 0 longer and numbered. */
#riff .riff-pitch-scale {
	position: absolute;
	top: 62.65%;
	left: 117.4%;
	width: 8%;
	height: 26.7%;
	background: repeating-linear-gradient(currentcolor 0 0.25cqi, transparent 0.25cqi 1.66875cqi) 0 -0.125cqi / 1.4cqi 27cqi no-repeat;
	font-size: 1.9cqi;
	font-variant-numeric: tabular-nums;
}

#riff .riff-pitch-scale i {
	position: absolute;
	left: 3.1cqi;
	font-style: normal;
	translate: 0 -50%;
}

#riff .riff-pitch-scale i::before {
	position: absolute;
	top: 50%;
	left: -3.1cqi;
	width: 2.4cqi;
	height: 0.25cqi;
	margin-top: -0.125cqi;
	background: currentcolor;
	content: "";
}

#riff .riff-pitch-scale i:nth-child(2) {
	top: 25%;
}

#riff .riff-pitch-scale i:nth-child(3) {
	top: 50%;
}

#riff .riff-pitch-scale i:nth-child(4) {
	top: 75%;
}

#riff .riff-pitch-scale i:nth-child(5) {
	top: 100%;
}

/* its name, under the slot */
#riff .riff-pitch-scale b {
	position: absolute;
	top: 36.5cqi;
	left: -3.9cqi;
	font-weight: inherit;
	letter-spacing: 0.08em;
	text-transform: uppercase;
	translate: -50% 0;
}

/* The key that sends the fader back to its middle, at the left of its
   zero: there, risen from the plinth with its lamp lit, only while the
   fader is off its middle and the listener is at it (now-playing.js), and
   out of reach and of a screen reader's hearing otherwise. */
#riff .riff-keys .riff-pitch-zero {
	top: 74.4%;
	left: 105.6%;
	width: 3.8%;
	height: 3.2%;
	padding: 0;
	font-size: 1.7cqi;
	visibility: hidden;
	opacity: 0;
	transition: opacity 0.12s, visibility 0s 0.12s;
}

#riff .riff-keys .riff-pitch-zero[data-riff-offered] {
	visibility: visible;
	opacity: 1;
	transition: opacity 0.12s;
}

@media (prefers-reduced-motion: reduce) {

	#riff .riff-keys .riff-pitch-zero {
		transition: none;
	}
}

/* On a wide screen Now Playing comes up from under the bar, whichever view
   it opens on, as the panels beside it do: the bar is over it, so nothing
   slides across the track, the quality or the views' buttons. A phone's
   Now Playing covers its bar, as does a screen that is the turntable. */
@media (min-width: 900px) and (not ((pointer: coarse) and (min-aspect-ratio: 5 / 4) and (max-height: 760px))) {

	.riff-bar {
		z-index: 1;
	}
}

/* Where the turntable is the album, the deck is all there is: nothing of
   the rest of the player is on the screen with it, so nothing says it is a
   screen. No bar, no panel beside it (now-playing.js puts an open one away
   and brings it back), no strip of controls; the title, the seek line and
   the rest are not here. The deck's own keys, its arm and its display are
   the player, with the keyboard's shortcuts and the system's media keys.
   now-playing.js reads --riff-deck-alone, so the shapes are written down
   once. */
#riff:not([data-riff-turntable="off"])[data-riff-showing="album"]:not([data-mode="video"]) > .riff-np {
	--riff-deck-alone: 1;
}

#riff:not([data-riff-turntable="off"])[data-riff-showing="album"]:not([data-mode="video"]) .riff-np-panel {
	display: none;
}

/* The way out, at the top left of the desk: a cap of the deck's own, as its
   keys are. It is there as the deck arrives and at the first move, key or
   touch, and fades away once the listener is still (now-playing.js, as a
   video's controls do), with the Song and Video switch of a song that has
   a video and what a plugin shows under the deck. It stays while the
   keyboard's focus is on it or a mouse is over it, and faded it lets a tap
   through to the desk. Escape, the browser's Back, a press on the desk
   round the deck and a drag down do the same. Now Playing's head, which
   holds it, lies over the scene rather than above it, so the deck stays
   where it is as the head comes and goes. */
#riff:not([data-riff-turntable="off"])[data-riff-showing="album"]:not([data-mode="video"]) .riff-np-head {
	position: absolute;
	z-index: 2;
	inset: var(--riff-safe-t) var(--riff-safe-r) auto var(--riff-safe-l);
}

#riff:not([data-riff-turntable="off"])[data-riff-showing="album"]:not([data-mode="video"]) .riff-np-head [data-riff-action="close"] {
	display: inline-grid;
	background: linear-gradient(#343434, #232323);
	box-shadow: 0 2px 6px rgb(0 0 0 / 0.6), inset 0 1px 0 rgb(255 255 255 / 0.08);
	color: rgb(255 255 255 / 0.62);
}

#riff:not([data-riff-turntable="off"])[data-riff-showing="album"]:not([data-mode="video"]) .riff-np-head [data-riff-action="close"]:is(:hover, :focus-visible) {
	color: var(--riff-fg);
}

#riff:not([data-riff-turntable="off"])[data-riff-showing="album"]:not([data-mode="video"])[data-riff-idle] :is(.riff-np-head, .riff-turntable-extras) {
	opacity: 0;
	pointer-events: none;
}

@media (prefers-reduced-motion: no-preference) {

	#riff:not([data-riff-turntable="off"])[data-riff-showing="album"]:not([data-mode="video"]) :is(.riff-np-head, .riff-turntable-extras) {
		transition: opacity 0.5s ease;
	}
}

/* On a wide screen, where the bar lies over Now Playing, the bar goes as
   the deck comes up from under it and is back as the deck goes down, one
   move, and Now Playing has the whole window: the stage keeps only a
   margin, so the deck is as large as the window allows. Now Playing
   covers the bar here as a phone's does (--riff-np-covers), so the bar is
   out of the keyboard's and a screen reader's reach as well as out of
   sight. Not where the whole
   screen is the turntable, which has its own shape (below). */
@media (min-width: 900px) and (not ((pointer: coarse) and (min-aspect-ratio: 5 / 4) and (max-height: 760px))) {

	#riff:not([data-riff-turntable="off"])[data-riff-showing="album"]:not([data-mode="video"]) > .riff-np {
		--riff-np-covers: 1;
	}

	#riff:not([data-riff-turntable="off"])[data-riff-showing="album"]:not([data-mode="video"]):has(> .riff-np:not([hidden])) > .riff-np {
		bottom: 0;
	}

	#riff:not([data-riff-turntable="off"])[data-riff-showing="album"]:not([data-mode="video"]):has(> .riff-np:not([hidden])) .riff-stage {
		padding-block: calc(var(--riff-safe-t) + clamp(16px, 3dvh, 36px)) calc(var(--riff-safe-b) + clamp(16px, 3dvh, 36px));
	}

	#riff.is-open:not([data-riff-turntable="off"])[data-riff-showing="album"]:not([data-mode="video"]) > .riff-bar {
		opacity: 0;
		pointer-events: none;
	}
}

@media (min-width: 900px) and (not ((pointer: coarse) and (min-aspect-ratio: 5 / 4) and (max-height: 760px))) and (prefers-reduced-motion: no-preference) {

	#riff:not([data-riff-turntable="off"])[data-riff-showing="album"]:not([data-mode="video"]):has(> .riff-np:not([hidden])) > .riff-bar {
		transition: opacity 0.3s ease;
	}
}

/* The deck as WebGL draws it (deck-gl.js): one canvas the whole of Now
   Playing, in its background, with the desk lit round the deck and the
   turntable, the record and the arm drawn where the page has them. The
   page's own deck is never painted: it is the drawn one's control layer,
   moved, held and read where the canvas draws it, its keys' legends,
   display and pitch fader on the drawn plinth. Where the canvas can't
   draw, Now Playing is the cover on its own (now-playing.js). */
.riff-deck-gl {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	pointer-events: none;
	opacity: 0;
	transition: opacity 0.3s;
}

#riff[data-riff-gl] .riff-deck-gl {
	opacity: 1;
}

#riff:is([data-riff-turntable="off"], [data-mode="video"]) .riff-deck-gl {
	display: none;
}

.riff-record > *,
.riff-plinth > *,
.riff-arm-base,
.riff-arm-tube > :not(.riff-arm-grip) {
	opacity: 0;
}

@media (prefers-reduced-motion: reduce) {

	.riff-deck-gl {
		transition: none;
	}
}

/* Now Playing landscape, as on a computer's window, an unfolded phone or a
   phone on its side, is the only shape with the turntable (--riff-deck,
   read by now-playing.js, which turns it off for a site without one and
   for less motion); portrait, as on a phone held upright, the cover stands
   alone. It sizes the pair by the stage: each as large as the stage allows,
   side by side at full size, the sleeve and the plinth a tenth of a record
   apart, about what the stage leaves either side of the pair, the
   plinth's height and its arm side inside the stage. The sleeve alone,
   before the record comes out, is as large. */
@container riff-np (orientation: landscape) {

	:root #riff .riff-stage > :is(.riff-cover, .riff-record, .riff-deck-part) {
		width: min(74cqh, 62cqw);
		max-width: none;
		height: min(74cqh, 62cqw);
		max-height: none;
	}

	/* on what the stage holds: a query cannot restyle the stage itself */
	.riff-stage > * {
		--riff-deck: 1;
		--riff-out-scale: 1;
		--riff-out-cover: -90%;

		/* the plinth reaches further to the record's right than its left,
		   by the arm's side: left a little, so the deck is in the middle */
		--riff-out-record: -10.5%;

		/* the plinth reaches further below the record than above it, by
		   the strip its keys stand on: up a little */
		--riff-out-drop: -3%;
	}

	#riff .riff-stage > .riff-sleeve {
		display: block;
	}

	.riff-cover {
		cursor: pointer;
	}

	/* Out, the deck is the whole scene: the record slides onto the
	   platter and its sleeve, a beat behind, is drawn away and gone, as a
	   hand puts a sleeve down out of the picture. It is there again
	   whenever the record is back in it. */
	#riff .riff-stage > .riff-cover {
		transition: translate 0.75s var(--riff-hand) 0.08s, scale 0.75s var(--riff-hand) 0.08s, opacity 0.4s 0.3s;
	}

	#riff:is([data-riff-deck="out"], [data-riff-arriving]) .riff-stage > .riff-cover {
		scale: 0.8;
		opacity: 0;
		pointer-events: none;
	}

	/* and an album leaving has no sleeve to take with it */
	#riff .riff-leaving > .riff-cover {
		opacity: 0;
	}
}

/* The sleeve is tapped to put the record away and tapped again to play it
   (now-playing.js). A pointer taps the sleeve itself; a keyboard and a
   screen reader reach this button, its focus shown on the sleeve. Only where
   the turntable stands. */
#riff .riff-sleeve {
	display: none;
	position: absolute;
	width: 1px;
	height: 1px;
	padding: 0;
	border: 0;
	overflow: hidden;
	clip-path: inset(50%);
	white-space: nowrap;
}

#riff[data-mode="video"] .riff-stage > .riff-sleeve {
	display: none;
}

.riff-stage:has(.riff-sleeve:focus-visible) .riff-cover {
	outline: 2px solid var(--riff-fg);
	outline-offset: 4px;
}

/* with the sleeve drawn away (above), on the record it would put back:
   on its cue, which is laid where the record is drawn */
#riff[data-riff-deck="out"] .riff-stage:has(.riff-sleeve:focus-visible) .riff-cue {
	outline: 2px solid var(--riff-fg);
	outline-offset: 4px;
}

/* The plinth: how far the board reaches past the platter's own box, as
   deck-gl.js draws it, written once (--riff-plinth-edge) for now-playing.js,
   which takes a press beyond it as one on the desk. */
.riff-plinth {
	--riff-plinth-edge: -13% -26% -19% -5%;
}

/* The strobe on the platter's rim: two rows of dots, 216 for 33⅓ and 160
   for 45, which turn with the platter in the room's light and, in the
   patch its lamp lights, by what is left over between the lamp's flashes
   (now-playing.js turns them; deck-gl.js draws them). */
.riff-strobe {
	position: absolute;
	z-index: 1;
	inset: -3.5%;
	border-radius: 50%;
}

.riff-strobe-room,
.riff-strobe-lamp,
.riff-strobe i {
	position: absolute;
	inset: 0;
}

.riff-strobe i {
	will-change: rotate;
}

/* each row its dots, laid out once (now-playing.js) */
#riff .riff-strobe svg {
	display: block;
	width: 100%;
	height: 100%;
}

/* The platter turns at 33⅓, or 45 for a single, while the music sounds
   (now-playing.js marks it turning), and its speed is the music's: coming
   up to speed and winding down, the rate the music bends through is the
   rate it turns at. Below the slowest the music plays at, it turns on its
   own, the music silent (now-playing.js marks it coasting). */
.riff-turns {
	will-change: rotate;
}

/* The run-out: the matrix number scratched by hand into the smooth dead
   wax between the label and the last groove, as every pressing carries,
   on a layer that turns with the label (now-playing.js writes it,
   deck-gl.js draws it round the dead wax). Its layer is the record's
   square whatever the text, so it is painted once and only turned. */
.riff-wax {
	position: absolute;
	inset: 0;
	pointer-events: none;
	contain: strict;
}

#riff .riff-wax svg {
	display: block;
	width: 100%;
	height: 100%;
}

/* The tonearm, on its base just off the record's corner (now-playing.js
   works its angles from this place and length), its counterweight behind the
   base and its headshell angled, as a pivoted arm's is so the stylus sits
   along the groove: its length and the angle are Baerwald's alignment
   (now-playing.js), which draws the tube and the headshell. At rest on
   its post until the needle drops; stopped, the cue lever lifts it once
   the platter is at rest (now-playing.js). Sized by the record, so it
   scales with it. */
.riff-arm {
	position: absolute;
	top: 5%;
	left: 105%;
	width: 0;
	height: 0;
	rotate: -14deg;
	transition: rotate 0.6s var(--riff-hand);
	will-change: rotate;
}

#riff .riff-arm svg {
	position: absolute;
	top: -4cqi;
	left: -6cqi;
	width: 12cqi;
	height: 82cqi;
	overflow: visible;

	/* the base, where the arm turns and a swing to a new track turns it
	   (now-playing.js) */
	transform-origin: 6cqi 4cqi;
}

/* The needle drops once the record is out (now-playing.js marks it down);
   from then on an animation as long as the album turns it, each angle one
   moment of the album, and it swings on its spring to a new track or a
   seek. With reduced motion, it is set where the music is instead. */
#riff[data-riff-deck="out"] .riff-arm[data-riff-down] {
	rotate: var(--riff-arm, -14deg);
}

/* Picked up by hand (now-playing.js), the arm follows the hand with no
   spring, lifted off the record, to wherever it is put down. */
#riff[data-riff-deck="out"] .riff-arm[data-riff-held] {
	rotate: var(--riff-arm, -14deg);
	transition: none;
}

#riff[data-riff-deck="out"] .riff-arm-grip {
	pointer-events: stroke;
	cursor: grab;
}

#riff .riff-arm[data-riff-held] .riff-arm-grip {
	cursor: grabbing;
}

#riff .riff-arm:focus-visible {
	outline: none;
}

#riff .riff-arm:focus-visible .riff-arm-tube {
	outline: var(--riff-focus-ring);
	outline-offset: var(--riff-focus-ring-offset);
	border-radius: 2px;
}

/* Shown while the music already plays (now-playing.js marks it), the record
   is on the platter and the stylus in its groove from the first frame:
   nothing slides, drops or swings in under music already heard. The
   stage's own sleeve is named so this outranks a phone on its side's. */
#riff[data-riff-at] :is(.riff-record, .riff-stage > .riff-cover, .riff-cover, .riff-deck-part, .riff-arm) {
	transition: none;
}

#riff[data-mode="video"] .riff-record {
	display: none;
}

/* A new album (now-playing.js): once the arm is back on its rest, the old
   cover and record, copied, leave over the stage while the new sleeve comes
   in from the right with its record inside, which slides out onto the
   platter once it has arrived. */
.riff-leaving {
	display: grid;
	grid-area: 1 / 1;
	place-items: center;
	width: 100%;
	height: 100%;
	pointer-events: none;
}

.riff-leaving > * {
	grid-area: 1 / 1;
}

#riff[data-riff-arriving] .riff-record {
	translate: 0 0;
}

#riff[data-riff-arriving] :is(.riff-cover, .riff-record) {
	animation: riff-arrive 0.4s 0.65s var(--riff-hand) both;
}

@keyframes riff-arrive {

	from {
		opacity: 0;
		transform: translateX(40%);
	}
}

@media (prefers-reduced-motion: reduce) {

	.riff-record,
	.riff-cover,
	.riff-deck-part,
	.riff-arm {
		transition: none;
	}
}

.riff-video {
	display: none;
	width: 100cqw;
	max-height: 100cqh;
	aspect-ratio: 16 / 9;
	background: #000;
}

#riff[data-mode="video"] .riff-video {
	display: block;
}

#riff[data-mode="video"] .riff-cover {
	display: none;
}

.riff-np-panel {
	flex: none;
	padding: 0 32px;
}

/* A name is never cut short where it has room to wrap: two lines at most,
   balanced so neither ends on a word alone. */
#riff .riff-np-title {
	display: -webkit-box;
	overflow: hidden;
	font-size: 24px;
	font-weight: 700;
	line-height: 1.25;
	text-wrap: balance;
	overflow-wrap: anywhere;
	-webkit-box-orient: vertical;
	-webkit-line-clamp: 2;
	line-clamp: 2;
}

#riff .riff-np-sub {
	display: -webkit-box;
	overflow: hidden;
	margin-top: 2px;
	color: var(--riff-fg-2);
	font-size: 16px;
	line-height: 1.3;
	text-wrap: balance;
	overflow-wrap: anywhere;
	-webkit-box-orient: vertical;
	-webkit-line-clamp: 2;
	line-clamp: 2;
}

/* Boxy and thumbless; it doubles in height while held. */
.riff-np-seek {
	position: relative;
	height: 48px;
	margin-top: 20px;
}

.riff-np-seek .riff-line {
	top: 10px;
	height: 4px;
	margin: 0;
	border-radius: 2px;
	overflow: hidden;
	background: rgb(255 255 255 / 0.2);
	transform-origin: center;
}

.riff-np-seek .riff-line i {
	background: var(--riff-fg);
}

.riff-np-seek .riff-seek {
	height: 24px;
}

#riff[data-seeking] .riff-np-seek .riff-line {
	transform: scaleY(2);
}

.riff-np-times {
	position: absolute;
	left: 0;
	right: 0;
	bottom: 6px;
	display: flex;
	justify-content: space-between;
	color: var(--riff-fg-2);
	font-size: 14px;
	font-variant-numeric: tabular-nums;
	pointer-events: none;
}

.riff-np-controls {
	display: flex;
	align-items: center;
	justify-content: space-between;
	margin: 8px -8px 0;
}

#riff .riff-np-controls .riff-btn {
	width: 48px;
	height: 48px;
}

#riff .riff-skip svg {
	width: 36px;
	height: 36px;
}

#riff .riff-np-controls .riff-play-big {
	width: 72px;
	height: 72px;
	background: var(--riff-fg);
	color: #000;
}

#riff .riff-play-big:hover {
	background: var(--riff-fg);
	opacity: 0.9;
}

#riff .riff-play-big svg {
	width: 36px;
	height: 36px;
}

/* The views' buttons step back from the music: a light row of icons, each
   named under it, sharing the width; more than fit (a plugin's views) and
   the row scrolls. */
.riff-chips {
	display: flex;
	gap: 4px;
	margin: 20px -32px 0;
	padding: 0 28px;
	overflow-x: auto;
	scrollbar-width: none;
}

#riff .riff-chip {
	display: inline-flex;
	flex: 1 0 64px;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 4px;
	min-height: 52px;
	padding: 4px 2px;
	border: 0;
	border-bottom: 2px solid transparent;
	border-radius: 0;
	background: none;
	color: var(--riff-fg-2);
	font-size: 12px;
	font-weight: 500;
	line-height: 1.2;
}

#riff .riff-chip svg {
	width: 22px;
	height: 22px;
}

/* the chip of the view showing, lit as the open view's button is in the bar,
   and underlined (in a contrast theme, below, in its highlight colour) */
#riff .riff-chip[aria-pressed="true"] {
	border-bottom-color: currentcolor;
	color: var(--riff-fg);
}

/* ---- The panels (registry.js): Up next, and any a plugin adds, one at a
   time, each its own thing. On a phone a panel covers the screen, Now
   Playing too, with its name and Close at the top; on a wide screen it
   stands beside the page and Now Playing, above the bar. Where it stands
   is said once, here, for registry.js: a sheet, beside or in the strip. */
.riff-side {
	--riff-side-place: sheet;
	position: fixed;
	inset: 0;
	z-index: 5;
	display: flex;
	flex-direction: column;
	padding: var(--riff-safe-t) var(--riff-safe-r) var(--riff-safe-b) var(--riff-safe-l);
	background: var(--riff-surface);
}

.riff-side-head {
	display: flex;
	flex: none;
	align-items: center;
	justify-content: space-between;
	gap: 8px;
	height: 56px;
	padding: 0 8px 0 24px;
}

#riff .riff-side-title {
	margin: 0;
	overflow: hidden;
	font-size: 16px;
	font-weight: 700;
	white-space: nowrap;
	text-overflow: ellipsis;
}

/* Focus lands on the name as the panel opens, for a screen reader to say
   where it is; it is not a control, so no ring round it. */
#riff .riff-side-title:focus {
	outline: none;
}

/* Each panel. Up next's holds the queue; a plugin's is empty until its
   script fills it. */
.riff-panel {
	display: flex;
	flex: 1;
	flex-direction: column;
	min-height: 0;
}

.riff-panel:not(.riff-panel-queue) {
	padding: 8px 24px 24px;
	overflow-y: auto;
	overscroll-behavior: contain;
}

/* The Together panel: who is in the session, or who else is listening. */
#riff .riff-together-head {
	margin: 0 0 8px;
	font-size: 16px;
	font-weight: 700;
}

.riff-together-list {
	margin: 0 0 16px;
	padding: 0;
	list-style: none;
}

#riff .riff-together-person {
	display: flex;
	align-items: center;
	gap: 16px;
	min-height: 64px;
	margin: 0;
}

#riff .riff-together-face {
	position: relative;
	flex: none;
	display: grid;
	width: 40px;
	height: 40px;
	border-radius: 50%;
	overflow: hidden;
	background: var(--riff-hover);
}

#riff .riff-together-face svg,
#riff .riff-together-face img {
	grid-area: 1 / 1;
	width: 100%;
	height: 100%;
}

#riff .riff-together-face svg {
	padding: 8px;
	box-sizing: border-box;
	stroke: var(--riff-fg-2);
}

#riff .riff-together-face img {
	object-fit: cover;
}

#riff .riff-together-initial {
	grid-area: 1 / 1;
	place-self: center;
	color: var(--riff-fg-2);
	font-size: 18px;
}

#riff .riff-together-text {
	flex: 1;
	display: grid;
	min-width: 0;
}

#riff .riff-together-name,
#riff .riff-together-sub {
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

#riff .riff-together-name {
	font-size: 16px;
}

#riff .riff-together-sub,
#riff .riff-together-none {
	color: var(--riff-fg-2);
	font-size: 14px;
}

#riff .riff-together-none {
	text-wrap: pretty;
}

#riff .riff-together-button {
	flex: none;
	min-height: 44px;
	padding: 0 16px;
	border: 1px solid var(--riff-line);
	border-radius: 999px;
	color: var(--riff-fg);
	font-size: 14px;
}

#riff .riff-together-button:hover {
	background: var(--riff-hover);
}

/* A link to listen along elsewhere (riff_together_elsewhere), drawn as
   the button is. */
#riff a.riff-together-button {
	display: inline-flex;
	align-items: center;
	text-decoration: none;
}

/* The About panel (about.js): the track, its title over its artist and
   album as links to their pages, then each section under its heading, the
   credits as a name beside what they did, all in a side panel's sizes so a
   track's whole story shows at once. The cover is the panel's own only
   where Now Playing isn't showing it: beside the album's cover or
   turntable it would be the same picture twice, so there the panel starts
   at the title. Where the panel covers everything, as on a phone, beside
   the page with Now Playing closed, over another view, or with the video
   playing, the cover leads, taking at most half the panel's height so the
   words keep the rest. Both follow the panel's place and Now Playing's
   view as they change, the window resizing or the device turning
   included, with nothing to measure. */
.riff-panel-about {
	container: riff-about / size;
}

.riff-about {
	display: grid;
	gap: 20px;
}

#riff .riff-about-body {
	display: grid;
	gap: 4px;
	min-width: 0;
}

/* the track's lines close together, each link its own 24px line */
#riff .riff-about-track .riff-about-body {
	gap: 0;
}

/* the cover, with the deck offered over its foot */
#riff .riff-about-art {
	position: relative;
	width: 100%;
	width: min(100%, 50cqb);
	margin-bottom: 12px;
}

#riff .riff-about-cover {
	display: block;
	width: 100%;
	height: auto;
	aspect-ratio: 1;
	border-radius: 8px;
	object-fit: cover;
}

#riff .riff-about-deck {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	min-height: 32px;
	padding: 0 14px 0 8px;
	border: 0;
	border-radius: 999px;
	background: rgb(0 0 0 / 0.72);
	color: #fff;
	font: inherit;
	font-size: 13px;
	font-weight: 600;
	cursor: pointer;
	backdrop-filter: blur(8px);
}

#riff .riff-about-deck[hidden] {
	display: none;
}

#riff .riff-about-deck svg {
	width: 20px;
	height: 20px;
}

#riff .riff-about-deck:hover {
	background: rgb(0 0 0 / 0.86);
}

#riff .riff-about-deck:focus-visible {
	outline: 2px solid var(--riff-accent, #fff);
	outline-offset: 2px;
}

#riff .riff-about-cover + .riff-about-deck {
	position: absolute;
	bottom: 12px;
	left: 12px;
}

/* beside or in the strip, never a sheet over Now Playing, and the album
   on the stage */
@container not style(--riff-side-place: sheet) {

	#riff.is-open[data-riff-showing="album"]:not([data-mode="video"]) .riff-about-art {
		display: none;
	}
}

#riff .riff-about-heading {
	margin: 0 0 8px;
	font-size: 14px;
	font-weight: 700;
}

#riff .riff-about-title {
	font-size: 18px;
	font-weight: 700;
	line-height: 1.3;
	overflow-wrap: anywhere;
	text-wrap: balance;
}

#riff .riff-about .riff-about-artist,
#riff .riff-about .riff-about-album {
	justify-self: start;
	color: var(--riff-fg-2);
	font-size: 14px;

	/* each link a whole target, 24px apart (WCAG 2.5.8) */
	line-height: 24px;
	text-wrap: pretty;
}

#riff .riff-about a {
	color: inherit;
	text-decoration: none;
}

#riff .riff-about a:hover {
	color: var(--riff-fg);
	text-decoration: underline;
}

#riff .riff-about a:focus-visible {
	outline: var(--riff-focus-ring);
	outline-offset: var(--riff-focus-ring-offset);
	border-radius: 4px;
}

/* A row for each credit: what the tag is (Composer, Genre, Year) in a
   column as wide as the longest (up to two fifths of the panel, past which
   it wraps), what the file says beside it, wrapping in its own column. The
   list, as its section is .riff-about-credits too. */
dl.riff-about-credits {
	display: grid;
	grid-template-columns: fit-content(40%) minmax(0, 1fr);
	gap: 6px 16px;
	margin: 0;
	font-size: 14px;
	line-height: 1.4;
}

dl.riff-about-credits > div {
	display: grid;
	grid-column: 1 / -1;
	grid-template-columns: subgrid;
}

dl.riff-about-credits dt {
	color: var(--riff-fg-2);
	overflow-wrap: break-word;
}

dl.riff-about-credits dd {
	margin: 0;
	overflow-wrap: anywhere;
	text-wrap: pretty;
}

/* Shuffle and repeat in Up next, where the deck's strip has no room for
   them (below); everywhere else they are with the transport. */
.riff-queue-modes {
	display: none;
	gap: 4px;
}

.riff-queue-head {
	padding: 0 24px 16px;
	border-bottom: 1px solid var(--riff-line);
}

/* The track menu: a … beside each row and each track in Up next, and the
   list it opens, drawn the same dark way in a post as in Now Playing. */
.riff-track {
	position: relative;
}

.riff-track > .riff-row,
.riff-app .riff-album-tracks .riff-track > .riff-row {
	padding-right: 52px;
}

.riff-more-button {
	all: unset;
	box-sizing: border-box;
	display: grid;
	place-items: center;
	width: 40px;
	height: 40px;
	border-radius: 50%;
	color: inherit;
	cursor: pointer;
	opacity: 0.75;
}

.riff-track > .riff-more-button {
	position: absolute;
	top: 50%;
	right: 4px;
	transform: translateY(-50%);
}

.riff-more-button:hover,
.riff-more-button:focus-visible,
.riff-more-button[aria-expanded="true"] {
	background: color-mix(in srgb, currentcolor 12%, transparent);
	opacity: 1;
}

.riff-more-button:focus-visible {
	outline: 2px solid var(--riff-accent, var(--riff-app-ink, currentcolor));
	outline-offset: 1px;
}

.riff-more-button svg {
	width: 20px;
	height: 20px;
}

/* ---- Hearts: in the bar, in Now Playing, and beside a row's … for a track
   in the Media Library. Outlined, and filled while liked. A row's shows on
   hover and focus, and always once the track is liked; on
   a touch screen only once it is, and the … menu likes it. */
#riff [aria-pressed="false"] > .riff-heart-on,
#riff [aria-pressed="true"] > .riff-heart-off,
.riff-like-button[aria-pressed="false"] > .riff-heart-on,
.riff-like-button[aria-pressed="true"] > .riff-heart-off,
.riff-app .riff-app-like[aria-pressed="false"] > .riff-heart-on,
.riff-app .riff-app-like[aria-pressed="true"] > .riff-heart-off {
	display: none;
}

#riff .riff-btn.riff-like[aria-pressed="true"],
#riff .riff-bar-end .riff-btn.riff-like[aria-pressed="true"] {
	color: var(--riff-accent);
}

.riff-np-meta {
	position: relative;
	padding-right: 48px;
}

#riff .riff-np-meta .riff-like {
	position: absolute;
	top: 0;
	right: -8px;
}

.riff-like-button {
	all: unset;
	box-sizing: border-box;
	display: grid;
	place-items: center;
	width: 40px;
	height: 40px;
	border-radius: 50%;
	color: inherit;
	cursor: pointer;
	opacity: 0;
}

.riff-track > .riff-like-button {
	position: absolute;
	top: 50%;
	right: 44px;
	transform: translateY(-50%);
}

.riff-track:has(> .riff-like-button) > .riff-row,
.riff-app .riff-album-tracks .riff-track:has(> .riff-like-button) > .riff-row {
	padding-right: 92px;
}

.riff-track:hover > .riff-like-button,
.riff-like-button:focus-visible,
.riff-like-button[aria-pressed="true"] {
	opacity: 0.75;
}

.riff-like-button:hover,
.riff-like-button:focus-visible {
	background: color-mix(in srgb, currentcolor 12%, transparent);
	opacity: 1;
}

.riff-like-button:focus-visible {
	outline: 2px solid var(--riff-accent, var(--riff-app-ink, currentcolor));
	outline-offset: 1px;
}

.riff-like-button svg {
	width: 20px;
	height: 20px;
}

@media (hover: none) {

	.riff-like-button[aria-pressed="false"] {
		display: none;
	}

	.riff-track:has(> .riff-like-button[aria-pressed="false"]) > .riff-row,
	.riff-app .riff-album-tracks .riff-track:has(> .riff-like-button[aria-pressed="false"]) > .riff-row {
		padding-right: 52px;
	}
}

/* The … menu, drawn as WordPress's toolbar draws its menus: square, on the
   toolbar's #2c3338, light grey words that turn the accent under the pointer
   or the keyboard: the player's, or in the Listen app's own document, where
   the menu is outside the player, the app's, as its account menu's are. Its
   rows keep 44px on a touch screen. */
.riff-menu {
	position: fixed;
	z-index: 2147483000;
	display: grid;
	min-width: 200px;
	padding: 6px 0;
	border-radius: 0;
	background: #2c3338;
	box-shadow: 0 3px 5px rgb(0 0 0 / 0.2);
	color: #f0f0f1;
	font: 400 14px/1.3 "Riff Roboto", roboto, "Riff Roboto Fallback", system-ui, sans-serif;
}

.riff-menu[hidden] {
	display: none;
}

.riff-menu > *,
#riff .riff-menu > * {
	all: unset;
	box-sizing: border-box;
	padding: 8px 16px;
	color: inherit;
	cursor: pointer;
}

.riff-menu > :hover,
.riff-menu > :focus-visible,
#riff .riff-menu > :hover,
#riff .riff-menu > :focus-visible {
	color: var(--riff-accent, var(--riff-standalone-accent, var(--riff-app-ink, currentcolor)));
}

.riff-menu > :focus-visible,
#riff .riff-menu > :focus-visible {
	outline: none;
	box-shadow: inset 0 0 0 2px var(--riff-accent, var(--riff-standalone-accent, var(--riff-app-ink, currentcolor)));
}

/* Forced colours drop the shadow, so the item keeps a ring there, inside it. */
@media (forced-colors: active) {

	.riff-menu > :focus-visible,
	#riff .riff-menu > :focus-visible {
		outline: 2px solid Highlight;
		outline-offset: -2px;
	}
}

@media (pointer: coarse) {

	.riff-menu > *,
	#riff .riff-menu > * {
		display: flex;
		align-items: center;
		min-height: 44px;
	}
}

/* A link that opens a new window, as Go to post does in a window of its own:
   WordPress's external icon after the words, their size and colour. */
.riff-menu > a > svg,
#riff .riff-menu > a > svg {
	display: inline-block;
	flex: none;
	width: 1.25em;
	height: 1.25em;
	margin-inline-start: 0.25em;
	vertical-align: -0.3em;
}

#riff .riff-queue-head {
	display: flex;
	align-items: flex-end;
	justify-content: space-between;
	gap: 16px;
}

#riff .riff-queue-clear {
	flex: none;
	white-space: nowrap;
	padding: 6px 14px;
	border: 1px solid var(--riff-line);
	border-radius: 999px;
	color: var(--riff-fg);
	font-size: 14px;
}

#riff .riff-queue-clear[hidden] {
	display: none;
}

#riff .riff-queue-list li {
	display: flex;
	align-items: center;
	padding-right: 12px;
}

#riff .riff-queue-list li > button:first-child {
	flex: 1;
	min-width: 0;
}

#riff .riff-queue-list .riff-more-button {
	flex: none;
	display: grid;
	grid-template-columns: none;
	width: 40px;
	height: 40px;
	padding: 0;
}

#riff .riff-queue-list li.is-dragging {
	opacity: 0.5;
}

#riff .riff-queue-head p {
	color: var(--riff-fg-2);
	font-size: 14px;
}

#riff .riff-queue-head h3 {
	margin-top: 4px;
	font-size: 16px;
	font-weight: 700;
}

.riff-queue-list {
	flex: 1;
	min-height: 0;
	margin: 0;
	padding: 8px 0 16px;
	overflow-y: auto;
	overscroll-behavior: contain;
	list-style: none;

	/* A thin thumb on no track, the way the platform draws it in a dark app. */
	scrollbar-width: thin;
	scrollbar-color: rgb(255 255 255 / 0.2) transparent;
}

.riff-queue-list li {
	margin: 0;
	padding: 0;
}

/* Positioned, so its hidden words stay inside the list as it scrolls. */
#riff .riff-queue-list button {
	position: relative;
	display: grid;
	grid-template-columns: 48px minmax(0, 1fr);
	align-items: center;
	gap: 16px;
	width: 100%;
	height: 64px;
	padding: 0 24px;
}

#riff .riff-queue-list button:hover {
	background: var(--riff-hover);
}

#riff .riff-queue-list .riff-row-art {
	background: var(--riff-hover);
}

#riff .riff-queue-list .riff-row-sub {
	color: var(--riff-fg-2);
	font-size: 14px;
	opacity: 1;
}

#riff .riff-queue-list .riff-row-time {
	display: none;
}

#riff .riff-queue-list .riff-row-title {
	font-size: 16px;
}

#riff .riff-queue-list button:not([aria-current]) .riff-row-state {
	opacity: 0;
}

/* The track playing in Up next: its title and its bars in the cover's
   accent. */
#riff .riff-queue-list button[aria-current] .riff-row-title {
	color: var(--riff-cover-accent);
}

#riff .riff-queue-list button[aria-current] .riff-row-state i {
	background: var(--riff-cover-accent);
}

/* Under #riff, as the reset above for the player's paragraphs is, so the
   toast keeps its own colours, padding and size. */
#riff .riff-toast {
	position: fixed;
	left: 50%;
	bottom: calc(var(--riff-bar-h) + var(--riff-safe-b) + 16px);
	z-index: 1;
	padding: 12px 16px;
	border-radius: 4px;
	background: #e6e6e6;
	color: #030303;
	font-size: 14px;
	transform: translateX(-50%);
}

/* not where the whole screen is the turntable, which keeps the phone's Now
   Playing under its own layout at any width (below) */
@media (min-width: 900px) and (not ((pointer: coarse) and (min-aspect-ratio: 5 / 4) and (max-height: 760px))) {

	/* On a wide screen Now Playing fills the space above the bar, and the bar
	   keeps the controls; it covers nothing (now-playing.js). */
	.riff-np {
		--riff-np-covers: 0;
		bottom: calc(var(--riff-bar-h) + var(--riff-safe-b));
		padding: 0;
	}

	/* No artwork's colour behind it here, only the cover's accent's wash. */
	.riff-np-bg {
		background: none;
	}

	.riff-np-head {
		height: 64px;
		padding: 0 24px;
		touch-action: auto;
	}

	#riff .riff-modes {
		gap: 0;
		padding: 0;
		background: var(--riff-surface);
	}

	#riff .riff-modes button {
		width: auto;
		height: 32px;
		padding: 0 16px;
		color: var(--riff-fg-3);
		font-size: 16px;
		font-weight: 500;
	}

	#riff .riff-modes button[aria-checked="true"] {
		background: rgb(255 255 255 / 0.15);
		color: var(--riff-fg);
	}

	#riff .riff-modes svg {
		display: none;
	}

	.riff-modes span {
		position: static;
		width: auto;
		height: auto;
		overflow: visible;
		clip-path: none;
	}

	/* The track on its own: Up next and the other panels stand beside it. */
	.riff-np-body {
		display: grid;
		grid-template-columns: minmax(0, 1fr);
		padding: 0 var(--riff-np-gutter);
	}

	/* The turntable turns, slides and swings on layers of its own, and a
	   browser that cannot tell where a moving layer will be gives its own
	   layer to everything painted after it that might overlap. Painted
	   inside the stage, the moving parts can overlap nothing beyond it. The
	   stage reaches out over both gutters, its content box where it was, so
	   a sleeve leaving to the side fades out where it did. */
	.riff-stage {
		margin-inline: calc(-1 * var(--riff-np-gutter));
		padding-block: 0 40px;
		padding-inline: var(--riff-np-gutter);
		contain: paint;
		touch-action: auto;
	}

	/* #riff img clears every theme's max-width; this rule outranks it so the
	   cap holds and the art stays square. */
	#riff .riff-cover,
	.riff-record,
	.riff-deck-part {
		max-width: 640px;
		max-height: 640px;
	}

	/* The caret in the bar and Escape close it; the page itself has no close
	   control. */
	#riff .riff-np-head [data-riff-action="close"] {
		display: none;
	}

	.riff-cover {
		border-radius: 4px;
	}

	.riff-video {
		border-radius: 0;
	}

	.riff-np-panel {
		display: none;
	}

	/* A panel beside the page and Now Playing, above the bar, which the page
	   and Now Playing make room for. */
	.riff-side {
		--riff-side-place: beside;
		inset: var(--riff-side-top, 0) 0 calc(var(--riff-bar-h) + var(--riff-safe-b)) auto;
		width: var(--riff-side-w, 400px);
		padding: 0;
		border-left: 1px solid var(--riff-line);
		background: var(--riff-bg);
	}

	#riff .riff-queue-list li {
		padding-right: 8px;
	}

	html.riff-panel-open {
		--riff-side-w: 400px;
	}

	html.riff-panel-open body {
		margin-right: var(--riff-side-w);
	}

	html.riff-panel-open #riff .riff-np {
		right: var(--riff-side-w);
	}

	.riff-queue-head {
		display: block;
		margin: 0 16px 16px 24px;
		padding: 0;
		border: 0;
	}

	#riff .riff-queue-head p {
		font-size: 12px;
		line-height: 16.8px;
	}

	#riff .riff-queue-head h3 {
		margin: 0;
		font-size: 16px;
		font-weight: 500;
		line-height: 19.2px;
	}

	.riff-queue-list {
		display: block;
		padding: 0 0 24px;
	}

	.riff-queue-list li + li {
		border-top: 1px solid var(--riff-line);
	}

	#riff .riff-queue-list button {
		grid-template-columns: 32px minmax(0, 1fr) auto;
		gap: 16px;
		height: 56px;
		padding: 0 8px 0 24px;
	}

	#riff .riff-queue-list button:hover {
		background: none;
	}

	#riff .riff-queue-list li:hover {
		background: rgb(255 255 255 / 0.05);
	}

	#riff .riff-queue-list li:has(> button[aria-current]) {
		background: var(--riff-hover);
	}

	#riff .riff-queue-list .riff-row-art {
		width: 32px;
		height: 32px;
		border-radius: 2px;
	}

	#riff .riff-queue-list .riff-row-title {
		margin-bottom: 4px;
		font-size: 16px;
		line-height: 19.2px;
	}

	#riff .riff-queue-list .riff-row-sub {
		color: #aaa;
		font-size: 16px;
		line-height: 19.2px;
	}

	#riff .riff-queue-list .riff-row-dot {
		display: none;
	}

	#riff .riff-queue-list .riff-row-time {
		display: block;
		padding-left: 8px;
		color: #aaa;
		font-size: 16px;
		opacity: 1;
	}

	#riff .riff-toast {
		left: 24px;
		transform: none;
	}
}

/* ---- Now Playing on a phone, as YouTube Music lays it out: the art as wide
   as the screen allows, 24px from either edge, with the title, the seek bar
   and the controls lined up under its edges. Everything below the art keeps
   to what it needs, so the art takes the rest. Up next and the other panels
   open from the chips, over it. */
@media (max-width: 899px) {

	.riff-stage {
		padding: 16px 24px 20px;
	}

	.riff-np-panel {
		padding: 0 24px;
	}

	.riff-chips {
		margin: 16px -24px 0;
		padding: 0 24px;
	}

	.riff-np-seek {
		margin-top: 12px;
	}

	/* On a phone the badges leave the title and sit between the times,
	   as a tier: small print in the tier's colour, with no
	   capsule round it. The capsule is the wide screen's. */
	#riff .riff-np-quality {
		display: none;
	}

	#riff .riff-np-tier {
		position: absolute;
		left: 50%;
		top: 50%;
		transform: translate(-50%, -50%);
		gap: 12px;
	}

	#riff .riff-np-tier .riff-badge {
		height: auto;
		padding: 0;
		border: 0;
		border-radius: 0;
		background: none;
		box-shadow: none;
		color: var(--riff-quality-ink, var(--riff-fg-2));
		font-size: 11px;
		font-weight: 500;
		letter-spacing: 0.04em;
		text-shadow: none;
	}

	/* The chips are the last row: Up next and the other panels open from
	   there, over Now Playing. */
	.riff-np-panel {
		padding-bottom: 24px;
	}
}

@media (max-height: 700px) and (max-width: 899px) {

	.riff-stage {
		padding-top: 8px;
	}

	.riff-chips {
		margin-top: 12px;
	}

	.riff-np-panel {
		padding-bottom: 12px;
	}
}

@media (prefers-reduced-motion: reduce) {

	#riff,
	.riff-np,
	#riff .riff-bar-info,
	.riff-line,
	.riff-knob {
		transition: none;
	}

	.riff-np-bg[data-riff-fading]::before,
	.riff-np-bg[data-riff-fading]::after {
		animation: none;
	}

	[data-playing="true"] .riff-row-state i,
	#riff[data-waiting] .riff-play {
		animation: none;
	}
}

/* The sleeve's rack is the turntable screen's alone. */
.riff-rack {
	display: none;
}

/* The turntable turned off (Settings › Media, now-playing.js): the cover on
   its own, where the record would have come out of it onto the deck, and
   on a touch screen on its side the cover beside the controls. */
#riff[data-riff-turntable="off"] :is(.riff-record, .riff-deck-part, .riff-sleeve, .riff-rack, .riff-turntable-extras) {
	display: none !important;
}

#riff[data-riff-turntable="off"] .riff-stage > .riff-cover {
	translate: none;
}

/* ---- The views (registry.js, now-playing.js): Now Playing shows one at a
   time, each taking the whole screen above the bar. A view with a region of
   its own, such as the lyrics, takes the stage's place while it shows; the
   album, the cover or the turntable, is the stage itself. */
.riff-view {
	flex: 1;
	min-height: 0;
	overflow-y: auto;
	overscroll-behavior: contain;
	padding: clamp(16px, 4vw, 56px);
	scrollbar-width: thin;
	color-scheme: dark;
}

.riff-view:focus {
	outline: none;
}

.riff-np[data-riff-screen="own"] .riff-stage {
	display: none;
}

/* The place under the deck, for what a plugin adds with the
   riff_below_turntable action: taking no room unless something in it is
   showing, and only where the turntable is the view, so the deck keeps its
   size as the record comes and goes. On a wide screen it is the view's last
   row; on a touch screen on its side, the foot of the controls. */
.riff-turntable-extras {
	display: none;
}

#riff:not([data-riff-turntable="off"]) .riff-turntable-extras:has(> :not([hidden])) {
	display: flex;
	flex: none;
	grid-area: 2 / 1;
	gap: 16px;
	box-sizing: border-box;
	width: min(100%, 640px);
	height: 56px;
	height: clamp(44px, 9dvh, 72px);
	margin-inline: auto;
	padding: 0 24px 16px;
	color: var(--riff-accent);
}

#riff:not([data-riff-turntable="off"]) .riff-np-body:has(.riff-turntable-extras > :not([hidden])) {
	grid-template-rows: minmax(0, 1fr) auto;
}

/* The screen as a turntable: a touch screen wider than it is tall and no
   taller than a phone, as an unfolded iPhone Duo is (890 by 626) and any
   phone on its side, is the deck itself. The whole screen is the plinth;
   the platter and the record on it fill its height on the left, the arm
   over them, and down the right the strip a deck keeps its controls in:
   the title, the seek line, the transport and the chips. Opening the phone
   brings the record out of its sleeve onto the platter, the sleeve drawn
   away; closing it puts the record back in, and Now Playing is the phone's
   again (now-playing.js, deck()). By the screen's shape, never the device,
   as WebKit and Apple ask. */
@media (pointer: coarse) and (min-aspect-ratio: 5 / 4) and (max-height: 760px) {

	#riff .riff-np {
		bottom: 0;
		z-index: 3;
		padding: var(--riff-safe-t) var(--riff-safe-r) var(--riff-safe-b) var(--riff-safe-l);
		background:
			radial-gradient(120% 90% at 30% 20%, rgb(255 255 255 / 0.035), transparent 60%),
			linear-gradient(160deg, #222 0%, #181818 60%, #141414);
	}

	#riff .riff-np-bg {
		background: none;
	}

	/* the head floats over the plinth's corner: close, and Song or video */
	#riff .riff-np-head {
		position: absolute;
		z-index: 2;
		top: var(--riff-safe-t);
		left: var(--riff-safe-l);
		display: flex;
		gap: 8px;
		height: 56px;
		padding: 0 8px;
	}

	#riff .riff-np-head [data-riff-action="close"] {
		display: inline-flex;
	}

	#riff .riff-np-body {
		display: grid;
		grid-template-columns: minmax(0, 1fr) clamp(224px, 30%, 300px);
		grid-template-rows: minmax(0, 1fr) auto;
		height: 100%;
	}

	/* the deck alone (above) has the whole screen: the strip is for a
	   song's video, another view's panel, or the cover of a site without
	   the turntable */
	#riff:not([data-riff-turntable="off"])[data-riff-showing="album"]:not([data-mode="video"]) .riff-np-body {
		grid-template-columns: minmax(0, 1fr);
	}

	#riff .riff-stage {
		grid-row: 1 / span 2;
		grid-column: 1;
		padding: 4% 2% 4% 4%;
	}

	#riff:not([data-riff-turntable="off"])[data-riff-showing="album"]:not([data-mode="video"]) .riff-stage {
		padding: 12px;
	}

	/* the screen is the turntable: the deck at the size and in the
	   arrangement its stage gives it (above), and where the turntable is
	   off, the cover beside the controls' strip */
	:root #riff .riff-np .riff-stage > :is(.riff-cover, .riff-record, .riff-deck-part) {
		--riff-deck: 1;
		--riff-deck-screen: 1;
		--riff-out-scale: 1;
	}

	:root #riff[data-riff-turntable="off"] .riff-np .riff-stage > .riff-cover {
		width: min(70cqw, 80cqh);
		max-width: none;
		height: min(70cqw, 80cqh);
		max-height: none;
	}

	/* In its sleeve, the record waits off the deck's left with the sleeve
	   round it; out, it slides right onto the platter while the sleeve, a
	   beat behind, is drawn away the other way. */
	#riff .riff-stage > :is(.riff-cover, .riff-record) {
		translate: -58% var(--riff-out-drop);
	}

	#riff .riff-stage > .riff-cover {
		transition: translate 0.75s var(--riff-hand) 0.08s, scale 0.75s var(--riff-hand) 0.08s, opacity 0.4s 0.45s;
	}

	#riff[data-riff-deck="out"] .riff-stage > .riff-record {
		translate: var(--riff-out-record) var(--riff-out-drop);
	}

	#riff[data-riff-deck="out"] .riff-stage > .riff-cover {
		translate: -170% var(--riff-out-drop);
		scale: 0.7;
		opacity: 0;
		pointer-events: none;
	}

	#riff .riff-stage > .riff-sleeve {
		display: block;
	}

	/* the controls' strip: a little apart from the deck, set into the plinth */
	#riff .riff-np-panel {
		display: flex;
		grid-row: 1;
		grid-column: 2;
		flex-direction: column;
		justify-content: center;
		gap: 4px;
		min-height: 0;
		padding: 56px 20px 8px 8px;
	}

	#riff .riff-np-controls {
		margin: 4px -8px 0;
	}

	/* each part of the strip keeps its height, and the names grow and
	   shrink with the screen's, so a long one wraps rather than crowd the
	   seek line */
	#riff .riff-np-panel > * {
		flex-shrink: 0;
	}

	/* and on a screen too short for all of it, the strip scrolls rather
	   than spill onto what is under it */
	#riff .riff-np-panel {
		justify-content: safe center;
		overflow-y: auto;
		scrollbar-width: none;
	}

	#riff .riff-np-title {
		font-size: clamp(18px, 5.6dvh, 24px);
	}

	#riff .riff-np-sub {
		font-size: clamp(13px, 3.8dvh, 16px);
	}

	/* Shuffle and repeat are about the queue, so on the deck they are in Up
	   next, and the strip keeps only the skips. */
	#riff .riff-np-controls :is([data-riff-action="shuffle"], [data-riff-action="repeat"]) {
		display: none;
	}

	#riff .riff-queue-modes {
		display: flex;
	}

	/* in the strip the views' buttons wrap onto a second row rather than
	   scroll, so every one shows beside the deck */
	#riff .riff-chips {
		flex-wrap: wrap;
		justify-content: center;
		gap: 4px 0;
		margin: 12px -8px 0;
		padding: 0;
		overflow: visible;
	}

	#riff .riff-chip {
		flex-basis: 40px;
		min-height: 48px;
		padding: 4px 0;
		font-size: 11px;
	}

	/* what a plugin adds, at the foot of the controls' strip */
	#riff:not([data-riff-turntable="off"]) .riff-turntable-extras:has(> :not([hidden])) {
		grid-area: 2 / 2;
		width: auto;
		height: 48px;
		height: clamp(40px, 10dvh, 56px);
		margin: 0;
		padding: 0 20px 8px 8px;
	}

	/* Up next and the other panels open in the controls' strip, never over
	   the deck: the turntable keeps turning where it is. */
	#riff .riff-side {
		--riff-side-place: strip;

		/* from the window's top, for a wash that lines up with Now Playing's */
		--riff-side-top: 0px;
		inset: 0 0 0 auto;
		width: clamp(224px, 30%, 300px);
		padding: var(--riff-safe-t) var(--riff-safe-r) var(--riff-safe-b) 0;
		background: #181818;
	}

	#riff .riff-queue-head {
		flex-wrap: wrap;
		gap: 8px;
	}

	/* The sleeve, stood in the rack once its record is out on the deck, as
	   a record shop shows what is playing: on a wooden ledge, leaning back
	   a little. */
	#riff .riff-rack {
		display: block;
		position: relative;
		width: min(128px, 46%);
		margin: 0 0 16px;
		opacity: 0;
		transition: opacity 0.4s 0.5s;
	}

	#riff[data-riff-deck="out"] .riff-rack {
		opacity: 1;
	}

	#riff .riff-rack img {
		display: block;
		width: 100%;
		aspect-ratio: 1;
		border-radius: 3px;
		object-fit: cover;
		box-shadow: 0 10px 20px rgb(0 0 0 / 0.5);
		transform: perspective(400px) rotateX(4deg);
		transform-origin: bottom;
	}

	#riff .riff-rack::after {
		content: "";
		position: absolute;
		right: -8%;
		bottom: -6px;
		left: -8%;
		height: 6px;
		border-radius: 2px;
		background: linear-gradient(#8a5a34, #5d3b20);
		box-shadow: 0 3px 6px rgb(0 0 0 / 0.5);
	}

	/* the phone's chips, such as Lyrics, at any width */
	#riff .riff-chips .riff-chip.riff-mobile {
		display: inline-flex !important;
	}

	#riff .riff-chips .riff-chip.riff-mobile[hidden] {
		display: none !important;
	}
}

/* Too small a stage for the deck: the cover. */
@container riff-stage (max-width: 540px) or (max-height: 300px) {

	:root #riff .riff-np .riff-stage > :is(.riff-cover, .riff-record, .riff-deck-part) {
		--riff-deck: 0;
	}
}

/* A phone on its side has no height for the rack: the sleeve stays off. */
@media (pointer: coarse) and (min-aspect-ratio: 5 / 4) and (max-height: 500px) {

	#riff .riff-rack {
		display: none;
	}
}

/* Folded part way (where the browser reports the fold: the Viewport
   Segments API, behind a flag in Safari 27.1), nothing lands in the crease.
   Like a book, two pages side by side: the deck on the left page, as large
   as that page holds it, the controls on the right. */
@media (horizontal-viewport-segments: 2) {

	#riff .riff-np {
		padding-right: 0;
		padding-left: 0;
	}

	#riff .riff-np-body,
	#riff:not([data-riff-turntable="off"])[data-riff-showing="album"]:not([data-mode="video"]) .riff-np-body {
		grid-template-columns: env(viewport-segment-width 0 0) env(viewport-segment-width 1 0);
		column-gap: calc(env(viewport-segment-left 1 0) - env(viewport-segment-right 0 0));
	}

	#riff .riff-np-panel {
		padding-right: calc(20px + var(--riff-safe-r));
		padding-left: 20px;
	}

	/* a panel takes the right page */
	#riff .riff-side {
		width: env(viewport-segment-width 1 0);
	}
}

/* Stood on its edge like a tent or a laptop, one half above the other:
   Now Playing is upright, so the cover stands in the upper half, and the
   lower half, nearer the hand, holds the title, the seek line, the
   transport and Up next. */
@media (vertical-viewport-segments: 2) {

	#riff .riff-np {
		padding-top: 0;
	}

	#riff .riff-np-body,
	#riff:not([data-riff-turntable="off"]) .riff-np-body:has(.riff-turntable-extras > :not([hidden])) {
		display: grid;
		grid-template-rows: env(viewport-segment-height 0 0) env(viewport-segment-height 0 1);
		grid-template-columns: minmax(0, 1fr);
		row-gap: calc(env(viewport-segment-top 0 1) - env(viewport-segment-bottom 0 0));
		height: 100%;
	}

	#riff .riff-stage {
		grid-area: 1 / 1;
		padding: calc(56px + var(--riff-safe-t)) 24px 16px;
	}

	#riff .riff-np-panel {
		grid-area: 2 / 1;
		align-self: start;
		padding-top: 16px;
	}

	/* no row of their own between the halves and the controls */
	#riff:not([data-riff-turntable="off"]) .riff-turntable-extras:has(> :not([hidden])) {
		display: none;
	}


	#riff .riff-np-head {
		position: absolute;
		z-index: 2;
		top: var(--riff-safe-t);
		right: 0;
		left: 0;
	}
}

/* Words for a screen reader only: a badge's label, the search's count, the
   Play before a row's title and the pauses between what it shows. */
.riff-app-sr {
	position: absolute;
	width: 1px;
	height: 1px;
	overflow: hidden;
	clip-path: inset(50%);
	white-space: nowrap;
}

/* Forced colours (Windows contrast themes): the browser replaces backgrounds
   with its own and drops box shadows, which is how the seek line, an open
   panel's button, a checked mode and the current track are drawn. Each gets
   the theme's own colours instead: the line in GrayText played through in
   Highlight, and what is selected or current in Highlight, as the system
   draws a selection. Outlines and borders survive as they are. */
@media (forced-colors: active) {

	.riff-line {
		forced-color-adjust: none;
		background: GrayText;
	}

	.riff-line i {
		background: Highlight;
	}

	.riff-line::before {
		display: none;
	}

	/* the volume as the system draws a slider */
	.riff-volume input {
		-webkit-appearance: auto;
		appearance: auto;
	}

	/* the open panel's button in the bar, as a pressed control is drawn */
	#riff .riff-chip {
		border-bottom-color: Canvas;
	}

	#riff .riff-chip[aria-pressed="true"] {
		border-bottom-color: Highlight;
	}

	#riff [data-riff-control][aria-pressed="true"] {
		outline: 2px solid Highlight;
		outline-offset: -2px;
	}

	#riff .riff-modes button[aria-checked="true"] {
		outline: 2px solid Highlight;
		outline-offset: -2px;
	}

	#riff .riff-queue-list button[aria-current],
	.riff-row[data-current],
	.riff-app .riff-app-tab[aria-current="page"],
	.riff-app .riff-chip-link[aria-current="true"],
	.riff-standalone .riff-app .riff-app-library-chip[aria-pressed="true"],
	.riff-standalone .riff-app .riff-app-item[aria-current="page"] {
		forced-color-adjust: none;

		/* Above every layout's own shade of current, the frame's
		   included: in a contrast theme the theme's colours win. */
		background: Highlight !important;
		color: HighlightText !important;
	}

	/* What is inside takes the selection's text colour, not Riff's own
	   greys, which would not be the theme's. */
	#riff .riff-queue-list button[aria-current] *,
	.riff-row[data-current] *,
	.riff-app .riff-app-tab[aria-current="page"] *,
	.riff-standalone .riff-app .riff-app-item[aria-current="page"] * {
		color: inherit !important;
	}

	/* On and off, told apart by colour alone. */
	#riff .riff-btn[aria-pressed="true"],
	#riff [data-riff-action="repeat"][data-repeat="all"],
	#riff [data-riff-action="repeat"][data-repeat="one"],
	.riff-app .riff-sort-link[aria-current="true"] {
		forced-color-adjust: none;
		color: Highlight !important;
	}

	.riff-app .riff-app-account-menu a:focus-visible,
	.riff-standalone .riff-app .riff-app-account-menu a:focus-visible {
		outline: 2px solid Highlight;
		outline-offset: -2px;
	}
}

/* No lone last word on a line in the player or the Listen app: headings and
   short headings balanced, running text shaped. */
#riff h2,
#riff h3,
.riff-app h1,
.riff-app h2,
.riff-app h3 {
	text-wrap: balance;
}

#riff p,
.riff-app p,
.riff-app li {
	text-wrap: pretty;
}
