/**
 * SxryS Music Player - dreamy skin for APlayer.
 *
 * IMPORTANT DOM note: APlayer 1.10.x renders its whole UI INTO the container
 * element it is given. The [data-sxry-player] box itself receives the
 * "aplayer" / "aplayer-fixed" / "aplayer-narrow" ... classes - there is no
 * nested .aplayer element. So the root selectors below start from
 * .sxry-player (which doubles as .aplayer) and the inner parts are matched
 * as plain descendants.
 *
 * The player root exposes two CSS variables:
 *   --sxry-accent       main accent (settings > Accent color)
 *   --sxry-accent-deep  darkened accent for text and hover states
 * Extra tweaks can be added under Settings > Custom CSS.
 */

.sxry-player.aplayer {
	--sxry-accent: #8a6cf0;
	--sxry-accent-deep: #6d4ae0;
	--sxry-accent-soft: #f2a3c8;
	--sxry-radius: 16px;
	--sxry-shadow: 0 10px 30px rgba(109, 74, 224, 0.12);
	--sxry-border: rgba(126, 100, 226, 0.16);
	--sxry-surface: #ffffff;
	background: var(--sxry-surface);
	border: 1px solid var(--sxry-border);
	border-radius: var(--sxry-radius);
	box-shadow: var(--sxry-shadow);
	font-family: "Quicksand", "PingFang SC", "Microsoft YaHei", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
	overflow: hidden;
}

/* --- Card shell -------------------------------------------------------- */

.sxry-player .aplayer-info {
	border-bottom: 1px solid var(--sxry-border);
}

.sxry-player .aplayer-music {
	color: #3a3154;
}

.sxry-player .aplayer-music .aplayer-title {
	font-weight: 700;
}

.sxry-player .aplayer-music .aplayer-author {
	color: #716a8e;
}

/* --- Cover + play button ---------------------------------------------- */

/* The cover square doubles as the play/pause button. APlayer paints it with
   the theme color inline (background-color: <accent>), which shows as a
   purple/pink block whenever a track has no cover. Drop that backdrop so
   only the cover artwork - or nothing - shows behind the play circle. */
.sxry-player .aplayer-pic {
	background-color: transparent !important;
	border-radius: 0;
}

.sxry-player .aplayer-pic .aplayer-play {
	background: rgba(0, 0, 0, 0.45);
	border-radius: 50%;
	box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
	transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.sxry-player .aplayer-pic .aplayer-play:hover {
	background: rgba(0, 0, 0, 0.6);
	box-shadow: 0 4px 14px rgba(0, 0, 0, 0.35);
	transform: scale(1.08);
}

/* --- Progress bar ------------------------------------------------------ */

/* The track stays neutral; only the played fill uses the accent color. The
   bar-wrap flexes to fill the remaining controller width, so the progress
   bar is as long as possible; the thumb is centered on the line. */
.sxry-player .aplayer-controller .aplayer-bar-wrap {
	flex: 1 1 auto;
	min-width: 0;
}

.sxry-player .aplayer-bar-wrap .aplayer-bar {
	height: 5px;
	background: rgba(90, 90, 104, 0.16);
}

.sxry-player .aplayer-bar-wrap .aplayer-bar .aplayer-loaded {
	background: rgba(90, 90, 104, 0.26);
}

.sxry-player .aplayer-bar-wrap .aplayer-bar .aplayer-played {
	background: linear-gradient(90deg, var(--sxry-accent), var(--sxry-accent-soft));
	height: 5px;
}

.sxry-player .aplayer-bar-wrap .aplayer-bar .aplayer-played .aplayer-thumb {
	background: var(--sxry-accent);
	border: 3px solid #ffffff;
	box-shadow: 0 2px 8px color-mix(in srgb, var(--sxry-accent) 55%, transparent);
	height: 12px;
	top: 50%;
	transform: translateY(-50%);
	width: 12px;
}

/* --- Controls / volume -------------------------------------------------- */

/* Small control icons (prev/next/play, volume, loop, order, menu, lyrics,
   expand arrow) stay neutral so they don't read as purple buttons; the
   accent color only appears on hover. APlayer's own icon rules have higher
   specificity, so !important is required to guarantee the override. */
.sxry-player .aplayer-icon path {
	fill: #5a5a68 !important;
}

.sxry-player .aplayer-icon:hover path {
	fill: #3a3154 !important;
}

.sxry-player .aplayer-volume-bar {
	background: rgba(90, 90, 104, 0.2);
}

.sxry-player .aplayer-volume-bar .aplayer-volume {
	background: linear-gradient(180deg, var(--sxry-accent), var(--sxry-accent-deep));
}

/* --- Playlist ------------------------------------------------------------ */

.sxry-player .aplayer-list ol {
	max-height: var(--sxry-list-max-height, 360px);
}

.sxry-player .aplayer-list .aplayer-list-item {
	border-top: 1px dashed var(--sxry-border);
}

.sxry-player .aplayer-list .aplayer-list-item:hover {
	background: color-mix(in srgb, var(--sxry-accent) 8%, transparent);
}

.sxry-player .aplayer-list .aplayer-list-cur,
.sxry-player .aplayer-list .aplayer-list-cur .aplayer-list-index {
	background: linear-gradient(135deg, var(--sxry-accent), var(--sxry-accent-deep));
	color: #ffffff;
}

.sxry-player .aplayer-list .aplayer-list-cur .aplayer-list-title {
	color: #ffffff;
}

.sxry-player .aplayer-list .aplayer-list-cur .aplayer-list-author {
	color: rgba(255, 255, 255, 0.75);
}

/* --- Lyrics -------------------------------------------------------------- */

.sxry-player.aplayer-withlrc .aplayer-lrc {
	background: color-mix(in srgb, var(--sxry-accent) 6%, #ffffff);
	border-top: 1px dashed var(--sxry-border);
}

.sxry-player.aplayer-withlrc .aplayer-lrc p.aplayer-lrc-current {
	color: var(--sxry-accent-deep);
}

/* --- Mini & fixed modes -------------------------------------------------- */

.sxry-player.aplayer-mini .aplayer-info {
	border-bottom: 0;
}

/* Floating (fixed) player: APlayer's bottom-left mini bar, not glued to the
   edge, with a translucent rectangular expand arrow and a always-visible
   play button on the square cover. Draggable via the JS enhancement. */

/* The box itself only hosts the playlist - keep it chrome-free. Its width is
   fixed to match the expanded bar so the playlist always lines up with the
   player, no matter which state the bar is in. */
.sxry-player.aplayer-fixed {
	background: transparent;
	border: none;
	box-shadow: none;
	border-radius: 0 !important;
	bottom: 16px;
	cursor: grab;
	left: 16px;
	overflow: visible !important;
	right: auto;
	width: 400px;
}

.sxry-player.aplayer-fixed .aplayer-body {
	background: var(--sxry-surface);
	border: 1px solid var(--sxry-border);
	border-radius: 0 !important;
	box-shadow: var(--sxry-shadow);
	bottom: 16px;
	left: 16px;
	margin: 0;
	right: auto;
	/* APlayer freezes the bar width at init (measured in mini state, ~48px),
	   which crushes the progress bar and controls once expanded. Give the
	   expanded bar a fixed comfortable width instead of relying on content
	   size, so the progress bar and all controls fit on one row. */
	width: 400px !important;
}

/* Collapsed (narrow) state: back to the square cover bar, and hide the whole
   info area so its controls never squash into a vertical column during or
   after the collapse animation. */
.sxry-player.aplayer-fixed.aplayer-narrow {
	width: 66px;
}

.sxry-player.aplayer-fixed.aplayer-narrow .aplayer-body {
	width: 66px !important;
}

.sxry-player.aplayer-fixed.aplayer-narrow .aplayer-info {
	display: none !important;
}

.sxry-player.aplayer-fixed .aplayer-info {
	border-top: none;
	/* APlayer animates the info area with transform: scaleX on expand/collapse;
	   that horizontal stretch squashes the buttons mid-animation. Show/hide
	   it instantly instead - the collapse already hides it via display:none. */
	transition: none !important;
}

.sxry-player.aplayer-fixed .aplayer-list {
	background: var(--sxry-surface);
	border: 1px solid var(--sxry-border);
	border-bottom: none;
	border-radius: 0 !important;
	box-shadow: var(--sxry-shadow);
	width: 400px;
}

/* Square cover keeps the play/pause button visible. */
.sxry-player.aplayer-fixed .aplayer-pic .aplayer-play {
	opacity: 1;
}

/* Translucent, rectangular (no rounded corners) expand arrow, centered in
   its 18px strip so the block always lines up with the bar. */
.sxry-player.aplayer-fixed .aplayer-miniswitcher {
	align-items: center;
	background: transparent;
	display: flex;
	justify-content: center;
}

.sxry-player.aplayer-fixed .aplayer-miniswitcher .aplayer-icon {
	align-items: center;
	background: transparent;
	border: 0;
	border-radius: 0;
	display: flex;
	height: 26px;
	justify-content: center;
	padding: 0;
	width: 18px;
}

.sxry-player.aplayer-fixed .aplayer-miniswitcher .aplayer-icon svg {
	height: 14px;
	opacity: 0.55;
	width: 14px;
}

/* Drag feedback. */
.sxry-player.aplayer-fixed.is-dragging,
.sxry-player.aplayer-fixed.is-dragging * {
	cursor: grabbing;
	user-select: none;
	-webkit-user-select: none;
}

/* APlayer gives .aplayer-body a transition on all properties; drop it while
   dragging so the bar follows the cursor without lag. */
.sxry-player.aplayer-fixed.is-dragging .aplayer-body {
	transition: none;
}

/* Let touch gestures drag the collapsed mini bar. The playlist is only
   scrollable in the expanded state (aplayer-narrow removed), where
   touch-action returns to auto. */
.sxry-player.aplayer-fixed.aplayer-narrow {
	touch-action: none;
}

.sxry-player.aplayer-fixed .aplayer-list,
.sxry-player.aplayer-fixed .aplayer-list * {
	cursor: auto;
}

/* --- Controller icons (prev / next / volume / mode) ---------------------- */

.sxry-player .aplayer-controller {
	gap: 6px;
}

.sxry-player .aplayer-controller .aplayer-icon {
	height: 20px;
	margin: 0 2px;
	width: 20px;
}

.sxry-player .aplayer-controller .aplayer-icon svg {
	height: 100%;
	width: 100%;
}

.sxry-player .aplayer-controller .aplayer-icon:hover {
	transform: scale(1.15);
}

/* --- No-JS / failed load state ------------------------------------------- */

.sxry-player:empty {
	animation: sxry-music-pulse 1.4s ease-in-out infinite;
	background: rgba(138, 108, 240, 0.07);
	border: 1px dashed var(--sxry-border);
	border-radius: var(--sxry-radius);
	min-height: 54px;
	position: relative;
}

.sxry-player:empty::after {
	align-items: center;
	color: var(--sxry-accent-deep);
	content: "…";
	display: flex;
	font-size: 1.1rem;
	inset: 0;
	justify-content: center;
	position: absolute;
}

@keyframes sxry-music-pulse {

	0%,
	100% {
		opacity: 0.55;
	}

	50% {
		opacity: 1;
	}
}

.sxry-player[data-error] {
	animation: none;
	background: #fdf2f5;
	border: 1px dashed rgba(224, 85, 124, 0.4);
	border-radius: var(--sxry-radius);
	color: #e0557c;
	font-size: 0.9rem;
	min-height: auto;
	padding: 14px 18px;
}

.sxry-player[data-error]::after {
	display: none;
}

/* --- Editor preview ------------------------------------------------------ */
.is-root-container .sxry-player,
.editor-styles-wrapper .sxry-player {
	max-width: 720px;
}
