/**
 * ANY Lifestyle Audioplayer – Frontend Styles
 *
 * Eingebetteter Player (Shortcode), Play-Trigger-Buttons.
 * Keine Sticky-Bar, keine fixierten Elemente – der Player wird ganz
 * normal in den Content-Flow eingebettet und stört kein Layout.
 *
 * Skins: Dark (default), Light, Custom (via CSS Custom Properties).
 */

/* ============================================================================
   CSS Custom Properties – strictly scoped to AAP elements (no :root bleed)
   ========================================================================== */

.aap-embed-player,
.aap-play-trigger,
.aap-popup-trigger,
.aap-play-button,
.aap-play-link,
.aap-play-icon {
	--aap-primary:    #6d28d9;
	--aap-primary-h:  #7c3aed;
	--aap-bg:         #1e1b2e;
	--aap-bg-2:       #2a2640;
	--aap-border:     rgba(255,255,255,.1);
	--aap-text:       #f1f5f9;
	--aap-text-muted: #94a3b8;
}

/* ============================================================================
   Hidden audio element – override any theme styles on bare <audio>
   ========================================================================== */

#aap-audio {
	display: none !important;
	position: absolute !important;
	width: 0 !important;
	height: 0 !important;
	visibility: hidden !important;
	pointer-events: none !important;
}

/* ============================================================================
   @keyframes
   ========================================================================== */

@keyframes aap-spin {
	to { transform: rotate(360deg); }
}

@keyframes aap-marquee {
	0%   { transform: translateX(100%); }
	100% { transform: translateX(-100%); }
}

@keyframes aap-eq {
	0%, 100% { transform: scaleY(.4); }
	50%       { transform: scaleY(1); }
}

/* ============================================================================
   Embedded Player
   ========================================================================== */

.aap-embed-player {
	background: var( --aap-bg );
	border-radius: 12px;
	overflow: hidden;
	color: var( --aap-text );
	font-family: inherit;
}

/* Light skin override – scoped strictly to our player elements */
.aap-embed-player.aap-skin-light {
	--aap-bg:         #ffffff;
	--aap-bg-2:       #f1f5f9;
	--aap-border:     #e2e8f0;
	--aap-text:       #1e293b;
	--aap-text-muted: #64748b;
}

.aap-embed-header {
	display: flex;
	align-items: center;
	gap: 16px;
	padding: 20px;
	background: linear-gradient(135deg, var( --aap-bg ), var( --aap-bg-2 ));
}

.aap-embed-cover {
	position: relative;
	width: 72px;
	height: 72px;
	border-radius: 8px;
	overflow: hidden;
	background: var( --aap-bg-2 );
	flex-shrink: 0;
}

.aap-embed-cover .aap-cover-img { width: 100%; height: 100%; object-fit: cover; }

.aap-cover-placeholder {
	position: absolute;
	inset: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	color: var( --aap-text-muted );
}

.aap-cover-placeholder svg { width: 32px; height: 32px; }

.aap-embed-info { flex: 1; min-width: 0; }

.aap-embed-stream-title {
	font-size: 16px;
	font-weight: 700;
	color: var( --aap-text );
	margin-bottom: 4px;
}

.aap-marquee-wrapper {
	overflow: hidden;
	height: 20px;
	position: relative;
}

.aap-marquee-text {
	display: inline-block;
	font-size: 13px;
	color: var( --aap-text-muted );
	white-space: nowrap;
	line-height: 20px;
}

.aap-marquee-text.aap-marquee-active {
	animation: aap-marquee 18s linear infinite;
}

.aap-embed-artist { font-size: 12px; color: var( --aap-text-muted ); margin-top: 2px; }

/* External track links – "Open in Spotify / Apple Music / YouTube Music" */
.aap-embed-links {
	display: none;
	gap: 8px;
	margin-top: 6px;
	align-items: center;
}
.aap-embed-links.is-visible { display: flex; }

.aap-track-link {
	--aap-link-color: #6d28d9;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 22px;
	height: 22px;
	text-decoration: none;
	transition: transform .15s ease, filter .15s ease;
	background: transparent;
	border: 0;
	padding: 0;
	border-radius: 50%;
}
.aap-track-link img {
	width: 100%;
	height: 100%;
	display: block;
	object-fit: contain;
	/* Slight neutralisation in resting state so different brand colours
	   don't visually fight with each other, then crisp on hover. */
	filter: saturate( .9 );
	transition: filter .15s ease;
}
.aap-track-link:hover img,
.aap-track-link:focus-visible img {
	filter: saturate( 1.15 ) brightness( 1.05 );
}
.aap-track-link:hover,
.aap-track-link:focus-visible {
	transform: translateY( -1px );
	outline: none;
}
.aap-track-link:focus-visible {
	box-shadow: 0 0 0 2px var( --aap-link-color );
}

/* Compact embed: shrink the link row so it doesn't push controls out */
.aap-compact .aap-embed-links { margin-top: 4px; gap: 6px; }
.aap-compact .aap-track-link  { width: 18px; height: 18px; }

/* Track history rows: smaller, right-aligned next to the timestamp */
.aap-track-history .aap-embed-links {
	margin-top: 2px;
	gap: 6px;
}
.aap-track-history .aap-track-link {
	width: 18px;
	height: 18px;
}

.aap-embed-controls {
	display: flex;
	align-items: center;
	gap: 8px;
	flex-shrink: 0;
}

/* ============================================================================
   Buttons (embedded player)
   ========================================================================== */

.aap-btn {
	background: none;
	border: none;
	cursor: pointer;
	padding: 6px;
	border-radius: 50%;
	display: flex;
	align-items: center;
	justify-content: center;
	transition: background .15s;
	color: var( --aap-text );
}

.aap-btn:hover { background: rgba(255,255,255,.12); }
.aap-embed-player.aap-skin-light .aap-btn:hover { background: rgba(0,0,0,.06); }

.aap-btn svg { width: 20px; height: 20px; }

.aap-btn-play {
	width: 48px;
	height: 48px;
	background: var( --aap-primary );
	color: #fff;
	border-radius: 50%;
}

.aap-btn-play:hover { background: var( --aap-primary-h ); }

.aap-btn-play .aap-icon-pause,
.aap-btn-play .aap-icon-loading { display: none; }

[data-aap-state="playing"] .aap-btn-play .aap-icon-play    { display: none; }
[data-aap-state="playing"] .aap-btn-play .aap-icon-pause   { display: block; }
[data-aap-state="loading"] .aap-btn-play .aap-icon-play    { display: none; }
[data-aap-state="loading"] .aap-btn-play .aap-icon-loading { display: block; animation: aap-spin .8s linear infinite; }

/* ============================================================================
   Cast / AirPlay button
   --------------------------------------------------------------------------
   Sitzt zwischen Play und Lautstärke und ist *standardmäßig versteckt*
   (hidden-Attribut + .aap-btn-cast[hidden]). Erst wenn der Cast-Adapter
   Empfänger im Netz erkennt, wird das hidden-Attribut entfernt.

   data-aap-cast-kind   = "airplay" | "cast"   – steuert das sichtbare Icon
   data-aap-cast-active = "1"                  – verbunden, Icon = "aktiv"
   ========================================================================== */

.aap-btn-cast[hidden] { display: none; }

.aap-btn-cast .aap-icon-cast,
.aap-btn-cast .aap-icon-airplay,
.aap-btn-cast .aap-icon-cast-active { display: none; }

.aap-btn-cast[data-aap-cast-kind="cast"]    .aap-icon-cast    { display: block; }
.aap-btn-cast[data-aap-cast-kind="airplay"] .aap-icon-airplay { display: block; }

/* Aktiver Zustand übertrumpft das Standard-Icon mit einem
   ausgefüllten Cast-Symbol + farbiger Akzent. Funktioniert für
   beide Protokolle, weil Apple / Google das visuell ähnlich lösen. */
.aap-btn-cast[data-aap-cast-active="1"] .aap-icon-cast,
.aap-btn-cast[data-aap-cast-active="1"] .aap-icon-airplay { display: none; }
.aap-btn-cast[data-aap-cast-active="1"] .aap-icon-cast-active { display: block; }

.aap-btn-cast[data-aap-cast-active="1"] {
	color: var( --aap-stream-color, var( --aap-primary, #6d28d9 ) );
	background: color-mix( in srgb, var( --aap-stream-color, var( --aap-primary, #6d28d9 ) ) 18%, transparent );
}

/* Fallback für ältere Browser ohne color-mix() */
@supports not ( background: color-mix( in srgb, red 50%, blue ) ) {
	.aap-btn-cast[data-aap-cast-active="1"] {
		background: rgba( 109, 40, 217, .18 );
	}
}

/* ============================================================================
   Volume
   ========================================================================== */

.aap-embed-volume {
	display: flex;
	align-items: center;
	gap: 4px;
}

.aap-embed-volume .aap-icon-vol-off { display: none; }
[data-aap-muted="true"] .aap-embed-volume .aap-icon-vol-on  { display: none; }
[data-aap-muted="true"] .aap-embed-volume .aap-icon-vol-off { display: block; }

.aap-volume-slider {
	-webkit-appearance: none;
	appearance: none;
	width: 80px;
	height: 4px;
	border-radius: 2px;
	background: var( --aap-border );
	outline: none;
	cursor: pointer;
}

.aap-volume-slider::-webkit-slider-thumb {
	-webkit-appearance: none;
	width: 14px;
	height: 14px;
	border-radius: 50%;
	background: var( --aap-primary );
	cursor: pointer;
	transition: transform .15s;
}

.aap-volume-slider::-webkit-slider-thumb:hover { transform: scale( 1.2 ); }
.aap-volume-slider::-moz-range-thumb {
	width: 14px;
	height: 14px;
	border-radius: 50%;
	background: var( --aap-primary );
	cursor: pointer;
	border: none;
}

/* ============================================================================
   Playlist
   ========================================================================== */

.aap-embed-playlist {
	border-top: 1px solid var( --aap-border );
}

.aap-playlist-item {
	display: flex;
	align-items: center;
	gap: 12px;
	padding: 12px 20px;
	border-bottom: 1px solid var( --aap-border );
	cursor: pointer;
	transition: background .15s;
}

.aap-playlist-item:last-child { border-bottom: none; }

.aap-playlist-item:hover { background: rgba(255,255,255,.05); }
.aap-embed-player.aap-skin-light .aap-playlist-item:hover { background: #f8fafc; }

.aap-playlist-item.active { background: rgba(109,40,217,.12); }

.aap-playlist-logo {
	width: 40px;
	height: 40px;
	border-radius: 6px;
	overflow: hidden;
	background: var( --aap-bg-2 );
	flex-shrink: 0;
}

.aap-playlist-logo img { width: 100%; height: 100%; object-fit: contain; }

.aap-playlist-logo-placeholder {
	width: 100%;
	height: 100%;
	display: flex;
	align-items: center;
	justify-content: center;
	color: var( --aap-text-muted );
}

.aap-playlist-logo-placeholder svg { width: 20px; height: 20px; }

.aap-playlist-info { flex: 1; min-width: 0; }

.aap-playlist-name {
	font-size: 14px;
	font-weight: 600;
	color: var( --aap-text );
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.aap-playlist-desc {
	font-size: 12px;
	color: var( --aap-text-muted );
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
	margin-top: 2px;
}

/* Live "now playing" line, shown as soon as the batched poller knows
   what's airing on this stream. Replaces .aap-playlist-desc visually so
   the tile height stays constant. A tiny pulsing dot signals "live".  */
.aap-playlist-now {
	display: flex;
	align-items: center;
	gap: 6px;
	margin-top: 2px;
	font-size: 12px;
	color: var( --aap-text-muted );
	min-width: 0;
}
.aap-playlist-now[hidden] { display: none; }

.aap-playlist-now-text {
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
	flex: 1 1 auto;
	min-width: 0;
}

.aap-playlist-now-dot {
	flex: 0 0 auto;
	width: 6px;
	height: 6px;
	border-radius: 50%;
	background: var( --aap-stream-color, var( --aap-primary, #6d28d9 ) );
	box-shadow: 0 0 0 0 currentColor;
	color: var( --aap-stream-color, var( --aap-primary, #6d28d9 ) );
	animation: aap-live-pulse 1.8s ease-in-out infinite;
}

@keyframes aap-live-pulse {
	0%, 100% { box-shadow: 0 0 0 0   color-mix( in srgb, currentColor 55%, transparent ); opacity: 1; }
	50%      { box-shadow: 0 0 0 6px color-mix( in srgb, currentColor 0%,  transparent ); opacity: .85; }
}

/* Fallback for browsers without color-mix() support (older Safari).
   The dot just pulses opacity – still reads as "live", no shadow halo. */
@supports not ( background: color-mix( in srgb, red 50%, blue ) ) {
	@keyframes aap-live-pulse {
		0%, 100% { opacity: 1; }
		50%      { opacity: .4; }
	}
}

@media ( prefers-reduced-motion: reduce ) {
	.aap-playlist-now-dot { animation: none; }
}

/* Subtle glow on the cover image once a real track-specific cover has
   been loaded (vs. the static stream logo). Optional polish, helps the
   eye spot "this tile is reflecting live data".                       */
.aap-playlist-item.has-live-cover .aap-playlist-logo {
	box-shadow: 0 0 0 1px var( --aap-stream-color, var( --aap-primary, #6d28d9 ) );
}

.aap-playlist-play-btn {
	background: none;
	border: none;
	cursor: pointer;
	padding: 6px;
	border-radius: 50%;
	color: var( --aap-text-muted );
	transition: color .15s, background .15s;
	flex-shrink: 0;
}

.aap-playlist-play-btn:hover { color: var( --aap-primary ); background: rgba(109,40,217,.1); }
.aap-playlist-play-btn svg { width: 20px; height: 20px; }
.aap-playlist-play-btn .aap-icon-eq { display: none; }
.aap-playlist-item.active .aap-playlist-play-btn .aap-icon-play { display: none; }
.aap-playlist-item.active .aap-playlist-play-btn .aap-icon-eq   { display: block; color: var( --aap-primary ); }

/* Compact mode */
.aap-compact .aap-embed-cover { width: 48px; height: 48px; }
.aap-compact .aap-embed-stream-title { font-size: 14px; }
.aap-compact .aap-embed-header { padding: 12px 16px; }

/* ============================================================================
   Play trigger button (shortcode [aap_play])
   ========================================================================== */

.aap-play-trigger,
.aap-popup-trigger {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	cursor: pointer;
	transition: all .2s;
}

/* Popup trigger reuses .aap-play-button / .aap-play-link / .aap-play-icon
   sizes via the second class set in PHP – nothing extra needed visually. */
.aap-popup-trigger.aap-play-button {
	background: var( --aap-stream-color, var( --aap-primary ) );
	color: #fff;
	border: none;
	border-radius: 6px;
	padding: 10px 20px;
	font-size: 14px;
	font-weight: 600;
	font-family: inherit;
}
.aap-popup-trigger.aap-play-button:hover { filter: brightness( 1.1 ); transform: translateY( -1px ); }
.aap-popup-trigger.aap-play-button svg   { width: 18px; height: 18px; }

.aap-popup-trigger.aap-play-link {
	background: none;
	border: none;
	color: var( --aap-stream-color, var( --aap-primary ) );
	font-family: inherit;
	font-size: inherit;
	padding: 0;
	text-decoration: underline;
	cursor: pointer;
}
.aap-popup-trigger.aap-play-link .aap-play-label { text-decoration: underline; }

.aap-popup-trigger.aap-play-icon {
	background: var( --aap-stream-color, var( --aap-primary ) );
	color: #fff;
	border: none;
	width: 44px;
	height: 44px;
	border-radius: 50%;
	padding: 0;
	font-family: inherit;
	cursor: pointer;
	justify-content: center;
}
.aap-popup-trigger.aap-play-icon .aap-play-label { display: none; }
.aap-popup-trigger.aap-play-icon svg { width: 20px; height: 20px; }

.aap-play-button {
	background: var( --aap-stream-color, var( --aap-primary ) );
	color: #fff;
	border: none;
	border-radius: 6px;
	padding: 10px 20px;
	font-size: 14px;
	font-weight: 600;
	font-family: inherit;
}

.aap-play-button:hover { filter: brightness( 1.1 ); transform: translateY( -1px ); }

.aap-play-button svg { width: 18px; height: 18px; }
.aap-play-button .aap-icon-pause { display: none; }
.aap-play-trigger.aap-is-playing .aap-icon-play  { display: none; }
.aap-play-trigger.aap-is-playing .aap-icon-pause { display: block; }

.aap-play-link {
	background: none;
	border: none;
	color: var( --aap-stream-color, var( --aap-primary ) );
	font-family: inherit;
	font-size: inherit;
	padding: 0;
	text-decoration: underline;
	cursor: pointer;
}

.aap-play-icon {
	background: var( --aap-stream-color, var( --aap-primary ) );
	color: #fff;
	border: none;
	width: 44px;
	height: 44px;
	border-radius: 50%;
	padding: 0;
	font-family: inherit;
	cursor: pointer;
}

/* ============================================================================
   Loading state
   ========================================================================== */

.aap-spin { animation: aap-spin .8s linear infinite; }

/* ============================================================================
   Responsive
   ========================================================================== */

@media ( max-width: 600px ) {
	.aap-embed-header { gap: 12px; padding: 16px; }
	.aap-embed-cover  { width: 56px; height: 56px; }
	.aap-volume-slider { width: 60px; }
}

@media ( max-width: 480px ) {
	.aap-embed-volume { display: none; }
	.aap-embed-cover  { width: 48px; height: 48px; }
}

/* ============================================================================
   [aap_track_history]
   ========================================================================== */

.aap-track-history {
	list-style: none;
	margin: 0;
	padding: 0;
	display: flex;
	flex-direction: column;
	gap: 8px;
	transition: opacity .15s ease;
}

.aap-track-history--loading { opacity: .5; }

.aap-track-history-empty {
	list-style: none;
	padding: 14px 16px;
	color: rgba( 0, 0, 0, .55 );
	font-style: italic;
	background: rgba( 0, 0, 0, .03 );
	border-radius: 10px;
	text-align: center;
}
.aap-skin-dark .aap-track-history-empty { color: rgba( 255, 255, 255, .65 ); background: rgba( 255, 255, 255, .05 ); }

.aap-track-history-item {
	display: grid;
	grid-template-columns: 48px 1fr auto;
	align-items: center;
	gap: 12px;
	padding: 10px 12px;
	background: rgba( 0, 0, 0, 0.03 );
	border-radius: 10px;
	transition: background 0.15s ease;
}

.aap-track-history-item:hover {
	background: rgba( 0, 0, 0, 0.06 );
}

.aap-track-history-cover {
	width: 48px;
	height: 48px;
	border-radius: 8px;
	overflow: hidden;
	background: rgba( 0, 0, 0, 0.1 );
	display: flex;
	align-items: center;
	justify-content: center;
}

.aap-track-history-cover img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
}

.aap-track-history-cover-placeholder svg {
	width: 24px;
	height: 24px;
	opacity: 0.4;
}

.aap-track-history-info {
	min-width: 0;
}

.aap-track-history-title {
	font-weight: 600;
	font-size: 0.95rem;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

.aap-track-history-artist {
	font-size: 0.85rem;
	opacity: 0.7;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

.aap-track-history-time {
	font-size: 0.8rem;
	opacity: 0.6;
	font-variant-numeric: tabular-nums;
}

/* ============================================================================
   [aap_track_search] – Interactive search widget
   ========================================================================== */

.aap-track-search {
	display: flex;
	flex-direction: column;
	gap: 16px;
	font-family: inherit;
}

.aap-search-form {
	display: flex;
	flex-direction: column;
	gap: 12px;
	padding: 16px;
	background: rgba( 0, 0, 0, 0.03 );
	border-radius: 12px;
}

.aap-search-field {
	display: flex;
	flex-direction: column;
	gap: 4px;
}

.aap-search-field label {
	font-size: 0.8rem;
	font-weight: 600;
	opacity: 0.7;
	text-transform: uppercase;
	letter-spacing: 0.02em;
}

.aap-search-field select,
.aap-search-field input[type="datetime-local"] {
	padding: 8px 10px;
	border-radius: 8px;
	border: 1px solid rgba( 0, 0, 0, 0.15 );
	background: #fff;
	font-size: 0.95rem;
	font-family: inherit;
}

.aap-search-presets {
	display: flex;
	flex-wrap: wrap;
	gap: 6px;
}

.aap-search-preset {
	border: 1px solid rgba( 0, 0, 0, 0.15 );
	background: #fff;
	color: inherit;
	padding: 6px 12px;
	border-radius: 999px;
	font-size: 0.85rem;
	cursor: pointer;
	transition: all 0.15s ease;
	font-family: inherit;
}

.aap-search-preset:hover {
	background: rgba( 0, 0, 0, 0.06 );
}

.aap-search-preset.is-active {
	background: var( --aap-primary, #6d28d9 );
	color: #fff;
	border-color: var( --aap-primary, #6d28d9 );
}

.aap-search-range {
	display: flex;
	flex-wrap: wrap;
	gap: 12px;
	align-items: flex-end;
	padding-top: 8px;
	border-top: 1px solid rgba( 0, 0, 0, 0.08 );
}

.aap-search-range .aap-search-field { flex: 1; min-width: 180px; }
.aap-search-range .aap-search-submit {
	background: var( --aap-primary, #6d28d9 );
	color: #fff;
	border: 0;
	padding: 9px 18px;
	border-radius: 8px;
	cursor: pointer;
	font-size: 0.95rem;
	font-weight: 600;
}
.aap-search-range .aap-search-submit:hover { filter: brightness( 1.1 ); }

.aap-search-status {
	font-size: 0.85rem;
	opacity: 0.75;
	min-height: 1.2em;
}
.aap-search-status.is-error   { color: #b91c1c; opacity: 1; }
.aap-search-status.is-success { color: #047857; opacity: 1; }

.aap-search-empty {
	background: rgba( 0, 0, 0, 0.04 );
	border: 1px dashed rgba( 0, 0, 0, 0.18 );
	border-radius: 10px;
	padding: 18px 20px;
	text-align: center;
	display: flex;
	flex-direction: column;
	gap: 12px;
	align-items: center;
}
.aap-search-empty p {
	margin: 0;
	font-size: 0.95rem;
	line-height: 1.4;
	max-width: 56ch;
}
.aap-search-empty strong { font-weight: 600; }
.aap-search-zoom {
	background: var( --aap-accent, #2563eb );
	color: #fff;
	border: 0;
	padding: 8px 16px;
	border-radius: 8px;
	cursor: pointer;
	font-size: 0.9rem;
	font-weight: 600;
}
.aap-search-zoom:hover { filter: brightness( 1.1 ); }

.aap-search-footer {
	display: flex;
	justify-content: center;
}

.aap-search-more {
	background: rgba( 0, 0, 0, 0.05 );
	color: inherit;
	border: 1px solid rgba( 0, 0, 0, 0.12 );
	padding: 8px 18px;
	border-radius: 8px;
	cursor: pointer;
	font-size: 0.9rem;
}
.aap-search-more:hover { background: rgba( 0, 0, 0, 0.08 ); }

/* Dark-skin overrides – reuse the existing skin variable */
.aap-skin-dark .aap-search-form,
.aap-skin-dark .aap-search-field input[type="datetime-local"],
.aap-skin-dark .aap-search-field select,
.aap-skin-dark .aap-search-preset {
	background: rgba( 255, 255, 255, 0.06 );
	color: inherit;
	border-color: rgba( 255, 255, 255, 0.12 );
}
.aap-skin-dark .aap-search-preset:hover,
.aap-skin-dark .aap-search-more:hover {
	background: rgba( 255, 255, 255, 0.10 );
}

/* ============================================================================
   [aap_news]
   ========================================================================== */

.aap-news {
	display: flex;
	flex-direction: column;
	gap: 20px;
}

.aap-news-item {
	display: grid;
	grid-template-columns: minmax(0, 240px) 1fr;
	gap: 18px;
	padding: 18px;
	background: rgba( 0, 0, 0, 0.03 );
	border-radius: 12px;
	border-left: 3px solid transparent;
}

.aap-news-item:not(:has(.aap-news-image)) {
	grid-template-columns: 1fr;
}

.aap-news-sticky {
	border-left-color: var( --aap-primary, #6d28d9 );
	background: rgba( 109, 40, 217, 0.05 );
}

.aap-news-image img {
	width: 100%;
	height: auto;
	border-radius: 8px;
	display: block;
	aspect-ratio: 16 / 9;
	object-fit: cover;
}

.aap-news-body { min-width: 0; }

.aap-news-meta {
	display: flex;
	gap: 12px;
	font-size: 0.8rem;
	opacity: 0.6;
	margin-bottom: 6px;
}

.aap-news-title {
	font-size: 1.15rem;
	margin: 0 0 6px;
	line-height: 1.3;
}

.aap-news-title a {
	color: inherit;
	text-decoration: none;
}

.aap-news-title a:hover { text-decoration: underline; }

.aap-news-subtitle {
	margin: 0 0 8px;
	opacity: 0.8;
	font-size: 0.95rem;
}

.aap-news-content {
	font-size: 0.9rem;
	line-height: 1.55;
}

.aap-news-content p:first-child { margin-top: 0; }
.aap-news-content p:last-child  { margin-bottom: 0; }

@media ( max-width: 600px ) {
	.aap-news-item { grid-template-columns: 1fr; }
}

/* ============================================================================
   Autoplay-blocked hint
   --------------------------------------------------------------------------
   Browsers reject audio.play() without a prior user gesture. When we hit
   that wall after a deep-link "?play=ID" landing, we surface this small
   pulsing badge and arm a one-shot listener so the next click anywhere
   on the page starts the stream. It auto-fades after 4 s so it stops
   nagging once the user has clearly seen it, but it stays interactive
   until a real gesture happens.
   ========================================================================== */

.aap-autoplay-hint {
	position: fixed;
	left: 50%;
	bottom: 24px;
	transform: translateX( -50% );
	z-index: 2147483646;
	display: inline-flex;
	align-items: center;
	gap: 10px;
	padding: 12px 18px;
	border-radius: 999px;
	background: rgba( 17, 17, 17, .92 );
	color: #fff;
	font: 600 14px/1 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
	box-shadow: 0 12px 32px rgba( 0, 0, 0, .35 );
	cursor: pointer;
	pointer-events: none; /* purely informational – any gesture suffices */
	animation: aap-hint-pulse 1.8s ease-in-out infinite;
	transition: opacity .22s ease, transform .22s ease;
}

.aap-autoplay-hint svg { width: 18px; height: 18px; flex: 0 0 18px; }
.aap-autoplay-hint__text { white-space: nowrap; }

.aap-autoplay-hint.is-faded   { opacity: .65; animation: none; }
.aap-autoplay-hint.is-gone    { opacity: 0; transform: translate( -50%, 8px ); }

@keyframes aap-hint-pulse {
	0%, 100% { box-shadow: 0 12px 32px rgba( 0, 0, 0, .35 ), 0 0 0 0 rgba( 124, 92, 255, .55 ); }
	50%      { box-shadow: 0 12px 32px rgba( 0, 0, 0, .35 ), 0 0 0 14px rgba( 124, 92, 255, 0 ); }
}

@media ( prefers-reduced-motion: reduce ) {
	.aap-autoplay-hint { animation: none; }
}

/* ============================================================================
   Global "casting to …" pill
   --------------------------------------------------------------------------
   Schwebt fix am unteren Bildschirmrand, sobald eine Cast- oder
   AirPlay-Session aktiv ist – ähnlich wie der Spotify-Connect-
   Indikator. Klick auf die Pille trennt die Verbindung. Wird vom
   Cast-Adapter dynamisch eingefügt/entfernt.
   ========================================================================== */

.aap-cast-pill {
	position: fixed;
	left: 50%;
	bottom: 18px;
	transform: translateX( -50% );
	z-index: 2147483645;
	display: inline-flex;
	align-items: center;
	gap: 10px;
	padding: 10px 16px;
	border-radius: 999px;
	background: rgba( 17, 17, 17, .94 );
	color: #fff;
	font: 600 13px/1 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
	box-shadow: 0 10px 28px rgba( 0, 0, 0, .35 );
	cursor: pointer;
	border: 0;
	max-width: calc( 100vw - 32px );
}

.aap-cast-pill:hover  { background: rgba( 0, 0, 0, .98 ); }
.aap-cast-pill:focus-visible {
	outline: 2px solid var( --aap-primary, #7c5cff );
	outline-offset: 2px;
}

.aap-cast-pill__dot {
	width: 8px;
	height: 8px;
	border-radius: 50%;
	background: #4ade80; /* grün = aktiv – universelles "connected"-Signal */
	flex: 0 0 8px;
	box-shadow: 0 0 0 0 rgba( 74, 222, 128, .6 );
	animation: aap-cast-pulse 1.8s ease-in-out infinite;
}

.aap-cast-pill__text {
	opacity: .75;
	font-weight: 500;
}

.aap-cast-pill__device {
	font-weight: 700;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
	max-width: 40ch;
}

@keyframes aap-cast-pulse {
	0%, 100% { box-shadow: 0 0 0 0   rgba( 74, 222, 128, .55 ); }
	50%      { box-shadow: 0 0 0 8px rgba( 74, 222, 128, 0   ); }
}

@media ( prefers-reduced-motion: reduce ) {
	.aap-cast-pill__dot { animation: none; }
}

@media ( max-width: 480px ) {
	.aap-cast-pill {
		bottom: 12px;
		font-size: 12px;
		padding: 9px 14px;
	}
	.aap-cast-pill__device { max-width: 22ch; }
}

/* ============================================================================
   Popup player – Tabs, Headline-Ticker, News-Liste & News-Detail
   --------------------------------------------------------------------------
   These styles only ever apply inside the standalone popup template
   (rendered by AAP_Shortcodes::maybe_render_popup). They live in the
   shared CSS file so the popup gets them with a single stylesheet load.

   Theme tokens live on body[data-popup-skin]: "dark" (default) and
   "light". Anything that needs to invert for the light skin reads
   from there to keep colour decisions in one place.
   ========================================================================== */

.aap-popup-body { display: flex; flex-direction: column; }
.aap-popup-body[data-popup-skin="light"] { --aap-pop-fg: #1e1b2e; --aap-pop-fg-soft: rgba(0,0,0,.6); --aap-pop-bg: #ffffff; --aap-pop-bg-soft: #fafafa; --aap-pop-border: rgba(0,0,0,.08); --aap-pop-accent: var(--aap-primary, #6d28d9); }
.aap-popup-body[data-popup-skin="dark"], .aap-popup-body:not([data-popup-skin]) { --aap-pop-fg: #ffffff; --aap-pop-fg-soft: rgba(255,255,255,.7); --aap-pop-bg: #1e1b2e; --aap-pop-bg-soft: #1a1727; --aap-pop-border: rgba(255,255,255,.08); --aap-pop-accent: var(--aap-primary, #a78bfa); }

/* ---- Headline ticker --------------------------------------------------- */

.aap-popup-ticker {
	display: flex;
	align-items: stretch;
	gap: 12px;
	background: var(--aap-pop-bg-soft);
	border-bottom: 1px solid var(--aap-pop-border);
	color: var(--aap-pop-fg);
	font-size: 13px;
	flex: 0 0 auto;
	overflow: hidden;
}
.aap-popup-ticker-label {
	flex: 0 0 auto;
	padding: 8px 12px;
	background: var(--aap-pop-accent);
	color: #fff;
	font-weight: 700;
	font-size: 11px;
	letter-spacing: .08em;
	text-transform: uppercase;
	display: flex;
	align-items: center;
}
.aap-popup-ticker-viewport { flex: 1 1 auto; overflow: hidden; position: relative; }
.aap-popup-ticker-track {
	display: inline-flex;
	gap: 32px;
	align-items: center;
	padding: 8px 0;
	white-space: nowrap;
	animation: aap-ticker-scroll 45s linear infinite;
	will-change: transform;
}
.aap-popup-ticker-viewport:hover .aap-popup-ticker-track { animation-play-state: paused; }
.aap-popup-ticker-item {
	background: none;
	border: 0;
	color: inherit;
	font: inherit;
	cursor: pointer;
	padding: 0;
	max-width: 50ch;
	overflow: hidden;
	text-overflow: ellipsis;
}
.aap-popup-ticker-item:hover { color: var(--aap-pop-accent); text-decoration: underline; }
.aap-popup-ticker-item:focus-visible { outline: 2px solid var(--aap-pop-accent); outline-offset: 2px; border-radius: 2px; }

@keyframes aap-ticker-scroll {
	from { transform: translateX( 0 ); }
	/* Track is rendered twice; -50% moves exactly one copy out of view
	   and produces a seamless loop when the animation restarts.       */
	to   { transform: translateX( -50% ); }
}
@media ( prefers-reduced-motion: reduce ) {
	.aap-popup-ticker-track { animation: none; }
}

/* ---- Tab navigation ----------------------------------------------------- */

.aap-popup-tabs {
	display: flex;
	gap: 0;
	background: var(--aap-pop-bg-soft);
	border-bottom: 1px solid var(--aap-pop-border);
	flex: 0 0 auto;
}
.aap-popup-tab {
	flex: 1 1 0;
	background: none;
	border: 0;
	color: var(--aap-pop-fg-soft);
	padding: 12px 14px;
	font: 600 13px/1 inherit;
	cursor: pointer;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 6px;
	border-bottom: 3px solid transparent;
	transition: color .15s ease, border-color .15s ease, background .15s ease;
}
.aap-popup-tab:hover { color: var(--aap-pop-fg); background: rgba(0,0,0,.04); }
.aap-popup-body[data-popup-skin="dark"] .aap-popup-tab:hover { background: rgba(255,255,255,.04); }
.aap-popup-tab.is-active {
	color: var(--aap-pop-fg);
	border-bottom-color: var(--aap-pop-accent);
}
.aap-popup-tab .dashicons { font-size: 16px; width: 16px; height: 16px; }

/* ---- Pane wrapper ------------------------------------------------------- */

.aap-popup-pane {
	flex: 1 1 auto;
	min-height: 0;
	display: flex;
	flex-direction: column;
}
.aap-popup-pane[hidden] { display: none; }

/* ---- News list ---------------------------------------------------------- */

.aap-popup-news-list {
	flex: 1 1 auto;
	min-height: 0;
	overflow-y: auto;
	-webkit-overflow-scrolling: touch;
	padding: 12px;
	display: flex;
	flex-direction: column;
	gap: 10px;
}
.aap-popup-news-empty {
	padding: 24px;
	text-align: center;
	color: var(--aap-pop-fg-soft);
	font-style: italic;
}
.aap-popup-news-card {
	display: grid;
	grid-template-columns: 96px 1fr;
	gap: 12px;
	padding: 10px;
	border-radius: 10px;
	background: var(--aap-pop-bg-soft);
	border: 1px solid var(--aap-pop-border);
	cursor: pointer;
	transition: transform .12s ease, border-color .12s ease, background .12s ease;
}
.aap-popup-news-card:hover {
	border-color: var(--aap-pop-accent);
	transform: translateY( -1px );
}
.aap-popup-news-thumb {
	border-radius: 8px;
	overflow: hidden;
	background: rgba(0,0,0,.08);
	aspect-ratio: 1;
}
.aap-popup-news-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.aap-popup-news-thumb--placeholder {
	background: linear-gradient( 135deg, rgba(124,92,255,.15), rgba(124,92,255,.05) );
}
.aap-popup-news-body { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.aap-popup-news-title {
	margin: 0;
	font-size: 14px;
	line-height: 1.35;
	color: var(--aap-pop-fg);
	display: -webkit-box;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
	overflow: hidden;
}
.aap-popup-news-meta {
	margin: 0;
	font-size: 11px;
	color: var(--aap-pop-fg-soft);
	display: flex;
	gap: 6px;
	align-items: center;
	flex-wrap: wrap;
}
.aap-popup-news-sep { opacity: .5; }
.aap-popup-news-excerpt {
	margin: 0;
	font-size: 12px;
	color: var(--aap-pop-fg-soft);
	display: -webkit-box;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
	overflow: hidden;
}

/* ---- News detail -------------------------------------------------------- */

.aap-popup-news-detail {
	flex: 1 1 auto;
	min-height: 0;
	overflow-y: auto;
	-webkit-overflow-scrolling: touch;
	background: var(--aap-pop-bg);
}
.aap-popup-news-detail[hidden] { display: none; }
.aap-popup-news-detail-head {
	position: sticky;
	top: 0;
	z-index: 2;
	padding: 10px 12px;
	background: var(--aap-pop-bg-soft);
	border-bottom: 1px solid var(--aap-pop-border);
	display: flex;
	align-items: center;
}
.aap-popup-news-back {
	background: none;
	border: 0;
	color: var(--aap-pop-fg);
	font: 600 13px/1 inherit;
	cursor: pointer;
	display: inline-flex;
	align-items: center;
	gap: 4px;
	padding: 6px 10px;
	border-radius: 6px;
}
.aap-popup-news-back:hover { background: rgba(0,0,0,.06); }
.aap-popup-body[data-popup-skin="dark"] .aap-popup-news-back:hover { background: rgba(255,255,255,.08); }

.aap-popup-news-detail-body { padding: 16px 18px 32px; }
.aap-popup-news-hero { margin: 0 0 18px; }
.aap-popup-news-hero img { width: 100%; height: auto; display: block; border-radius: 10px; }
.aap-popup-news-detail-title {
	margin: 0 0 8px;
	font-size: 22px;
	line-height: 1.25;
	color: var(--aap-pop-fg);
}
.aap-popup-news-detail-meta {
	margin: 0 0 18px;
	font-size: 12px;
	color: var(--aap-pop-fg-soft);
	display: flex;
	gap: 6px;
	align-items: center;
	flex-wrap: wrap;
}
.aap-popup-news-cat {
	background: var(--aap-pop-accent);
	color: #fff;
	padding: 2px 8px;
	border-radius: 999px;
	font-weight: 600;
	font-size: 10px;
	letter-spacing: .04em;
	text-transform: uppercase;
}
.aap-popup-news-content {
	color: var(--aap-pop-fg);
	font-size: 15px;
	line-height: 1.6;
}
.aap-popup-news-content p:first-child { margin-top: 0; }
.aap-popup-news-content img { max-width: 100%; height: auto; border-radius: 8px; }
.aap-popup-news-content a { color: var(--aap-pop-accent); }
.aap-popup-news-content blockquote {
	margin: 18px 0;
	padding: 8px 16px;
	border-left: 3px solid var(--aap-pop-accent);
	color: var(--aap-pop-fg-soft);
	font-style: italic;
}
.aap-popup-news-content h2, .aap-popup-news-content h3 { margin-top: 24px; color: var(--aap-pop-fg); }
.aap-popup-news-permalink {
	margin: 24px 0 0;
	padding-top: 16px;
	border-top: 1px solid var(--aap-pop-border);
}
.aap-popup-news-permalink a {
	color: var(--aap-pop-accent);
	font-weight: 600;
	text-decoration: none;
}
.aap-popup-news-permalink a:hover { text-decoration: underline; }

/* ---- Skeleton loading state -------------------------------------------- */

.aap-popup-news-loading { padding: 12px 0; }
.aap-popup-news-skel {
	background: linear-gradient( 90deg, rgba(0,0,0,.05) 25%, rgba(0,0,0,.10) 50%, rgba(0,0,0,.05) 75% );
	background-size: 200% 100%;
	border-radius: 6px;
	height: 14px;
	margin: 8px 0;
	animation: aap-skel-shimmer 1.4s linear infinite;
}
.aap-popup-body[data-popup-skin="dark"] .aap-popup-news-skel {
	background: linear-gradient( 90deg, rgba(255,255,255,.06) 25%, rgba(255,255,255,.12) 50%, rgba(255,255,255,.06) 75% );
	background-size: 200% 100%;
}
.aap-popup-news-skel--title { height: 22px; width: 70%; }
.aap-popup-news-skel--short { width: 60%; }
@keyframes aap-skel-shimmer {
	from { background-position: 200% 0; }
	to   { background-position: -200% 0; }
}
.aap-popup-news-error {
	color: #c0392b;
	padding: 16px;
	border-radius: 8px;
	background: rgba(192,57,43,.08);
}

/* ============================================================================
   Track-history section (popup)
   ========================================================================== */

.aap-popup-history-section {
	flex: 1 1 auto;
	min-height: 0;
	display: flex;
	flex-direction: column;
	padding: 16px 18px 20px;
	border-top: 1px solid var(--aap-pop-border);
	background: var(--aap-pop-bg-soft);
}
.aap-popup-history-section h2 {
	margin: 0 0 12px;
	font-size: 0.78rem;
	letter-spacing: .08em;
	text-transform: uppercase;
	opacity: .65;
	font-weight: 600;
}
.aap-popup-history-section .aap-popup-history {
	flex: 1 1 auto;
	min-height: 0;
	overflow-y: auto;
	-webkit-overflow-scrolling: touch;
}
