:root {
	--aa-bg: #fff8f0;
	--aa-surface: #ffffff;
	--aa-text: #000000;
	--aa-text-muted: #8a8070;
	--aa-accent: #c8972a;
	--aa-player-bg: #1a1a1a;
	--aa-player-text: #ffffff;
	--aa-radius: 12px;
	--aa-safe-bottom: env(safe-area-inset-bottom, 0px);
}

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

body.audio-app-template {
	margin: 0;
	padding: 0;
	background: var(--aa-bg);
	color: var(--aa-text);
	font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
	-webkit-font-smoothing: antialiased;
	overflow-x: hidden;
}

.aa-shell {
	min-height: 100dvh;
	max-width: 600px;
	margin: 0 auto;
	display: flex;
	flex-direction: column;
}

/* Header */
.aa-header {
	position: sticky;
	top: 0;
	z-index: 10;
	padding: 20px 20px 12px;
	background: var(--aa-bg);
	text-align: center;
}

.aa-logo-link {
	display: inline-block;
	line-height: 0;
}

.aa-logo {
	max-height: 80px;
	width: auto;
}

.aa-site-name {
	margin: 0;
	font-size: 1.25rem;
	font-weight: 600;
}

/* No access states */
.aa-no-access {
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	min-height: 60dvh;
	padding: 40px 20px;
	text-align: center;
}

.aa-no-access p {
	color: var(--aa-text-muted);
	margin-bottom: 24px;
}

.aa-cta {
	display: inline-block;
	padding: 14px 32px;
	background: var(--aa-accent);
	color: #050505;
	text-decoration: none;
	border-radius: var(--aa-radius);
	font-weight: 600;
	transition: opacity 0.2s;
}

.aa-cta:hover {
	opacity: 0.85;
}

/* ══════════════════════════════
   LIST VIEW
   ══════════════════════════════ */

.aa-episode-list {
	flex: 1;
	padding: 0 16px;
	padding-bottom: calc(72px + var(--aa-safe-bottom) + 20px);
}

.aa-episode-item {
	display: flex;
	align-items: center;
	gap: 12px;
	width: 100%;
	padding: 4px 4px;
	border-bottom: 1px solid rgba(0, 0, 0, 0.07);
}

.aa-episode-item:last-of-type {
	border-bottom: none;
}

.aa-episode-title-btn {
	display: flex;
	align-items: center;
	flex: 1;
	gap: 12px;
	min-width: 0;
	padding: 10px 0;
	background: none;
	border: none;
	color: var(--aa-text);
	cursor: pointer;
	text-align: left;
	font: inherit;
	transition: opacity 0.15s;
}

.aa-episode-title-btn:hover {
	opacity: 0.7;
}

.aa-now-playing {
	flex-shrink: 0;
	width: 20px;
	display: flex;
	align-items: center;
	color: var(--aa-accent);
}

.aa-episode-title {
	flex: 1;
	font-size: 0.95rem;
	font-weight: 500;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
	min-width: 0;
}

.aa-active .aa-episode-title {
	color: var(--aa-accent);
	font-weight: 600;
}

.aa-episode-duration {
	flex-shrink: 0;
	font-size: 0.85rem;
	color: var(--aa-text-muted);
	margin-right: 4px;
}

.aa-episode-btn {
	flex-shrink: 0;
	background: none;
	border: none;
	color: var(--aa-accent);
	cursor: pointer;
	padding: 4px;
	line-height: 0;
}

.aa-load-more {
	display: block;
	width: 100%;
	padding: 14px;
	margin-top: 8px;
	background: transparent;
	color: var(--aa-text-muted);
	border: 1px solid rgba(0, 0, 0, 0.1);
	border-radius: var(--aa-radius);
	cursor: pointer;
	font: inherit;
	font-weight: 500;
}

.aa-load-more:hover {
	background: rgba(0, 0, 0, 0.03);
}

/* ══════════════════════════════
   MINI PLAYER (list view bottom bar)
   ══════════════════════════════ */

.aa-mini-player {
	position: fixed;
	bottom: 0;
	left: 50%;
	transform: translateX(-50%);
	width: 100%;
	max-width: 600px;
	z-index: 20;
	background: var(--aa-player-bg);
	color: var(--aa-player-text);
	border-radius: 16px 16px 0 0;
	padding-bottom: var(--aa-safe-bottom);
}

.aa-mini-player.aa-hidden {
	display: none;
}

.aa-mini-row {
	display: flex;
	align-items: center;
	gap: 12px;
	padding: 10px 16px;
	cursor: pointer;
}

.aa-mini-cover {
	width: 40px;
	height: 40px;
	border-radius: 6px;
	object-fit: cover;
	flex-shrink: 0;
}

.aa-mini-cover-empty {
	display: block;
	background: #333;
}

.aa-mini-meta {
	flex: 1;
	min-width: 0;
	display: flex;
	flex-direction: column;
	gap: 1px;
}

.aa-mini-title {
	font-size: 0.85rem;
	font-weight: 600;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

.aa-mini-subtitle {
	font-size: 0.7rem;
	color: rgba(255, 255, 255, 0.5);
}

.aa-mini-toggle {
	flex-shrink: 0;
	background: none;
	border: none;
	color: var(--aa-player-text);
	cursor: pointer;
	padding: 6px;
	display: flex;
	align-items: center;
}

.aa-mini-progress {
	height: 2px;
	background: rgba(255, 255, 255, 0.1);
}

.aa-mini-bar {
	height: 100%;
	width: 0%;
	background: var(--aa-accent);
	transition: width 0.3s linear;
}

/* ══════════════════════════════
   DETAIL VIEW (full-screen player)
   ══════════════════════════════ */

.aa-detail {
	display: flex;
	flex-direction: column;
	align-items: center;
	min-height: 100dvh;
	padding: 0 24px calc(24px + var(--aa-safe-bottom));
	background: var(--aa-bg);
}

.aa-detail-back {
	align-self: flex-start;
	background: none;
	border: none;
	color: var(--aa-text-muted);
	cursor: pointer;
	padding: 16px 4px;
	display: flex;
	align-items: center;
}

.aa-detail-back:hover {
	color: var(--aa-text);
}

.aa-detail-artwork {
	width: 100%;
	max-width: 320px;
	aspect-ratio: 1;
	margin: 8px auto 24px;
	border-radius: 16px;
	overflow: hidden;
	box-shadow: 0 8px 30px rgba(0, 0, 0, 0.12);
}

.aa-detail-cover {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
}

.aa-detail-cover-empty {
	background: linear-gradient(135deg, #e8dcc8, #d4c4a8);
}

.aa-detail-info {
	text-align: center;
	margin-bottom: 24px;
	width: 100%;
}

.aa-detail-title {
	display: block;
	font-size: 1.15rem;
	font-weight: 700;
	margin-bottom: 4px;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

.aa-detail-subtitle {
	display: block;
	font-size: 0.85rem;
	color: var(--aa-text-muted);
}

/* Progress bar (detail) */
.aa-detail-progress {
	width: 100%;
	margin-bottom: 16px;
}

.aa-detail-times {
	display: flex;
	justify-content: space-between;
	margin-top: 4px;
}

.aa-detail-progress .aa-seek {
	width: 100%;
	height: 4px;
	background: rgba(0, 0, 0, 0.1);
}

.aa-detail-progress .aa-time {
	color: var(--aa-text-muted);
}

/* Controls (detail) */
.aa-detail-controls {
	display: flex;
	justify-content: center;
	align-items: center;
	gap: 24px;
	width: 100%;
}

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

.aa-ctrl-btn:hover {
	opacity: 0.7;
}

.aa-ctrl-main {
	color: var(--aa-accent);
}

.aa-skip-icon {
	width: 40px;
	height: 40px;
}

.aa-skip-icon path {
	fill: var(--aa-text-muted);
}

.aa-skip-icon text {
	fill: var(--aa-text-muted);
	font: 800 11px -apple-system, sans-serif;
}

/* Shared seek bar styles */
.aa-seek {
	-webkit-appearance: none;
	appearance: none;
	height: 3px;
	border-radius: 2px;
	background: rgba(255, 255, 255, 0.15);
	outline: none;
}

.aa-seek::-webkit-slider-thumb {
	-webkit-appearance: none;
	appearance: none;
	width: 12px;
	height: 12px;
	border-radius: 50%;
	background: var(--aa-accent);
	cursor: pointer;
}

.aa-seek::-moz-range-thumb {
	width: 12px;
	height: 12px;
	border-radius: 50%;
	background: var(--aa-accent);
	border: none;
	cursor: pointer;
}

.aa-time {
	font-size: 0.7rem;
	min-width: 32px;
	text-align: center;
}

/* Listened episodes */
.aa-listened .aa-episode-title {
	color: var(--aa-text-muted);
}

.aa-listened-icon {
	flex-shrink: 0;
	color: var(--aa-accent);
	opacity: 0.7;
	line-height: 0;
	margin-right: 4px;
}

@media (prefers-reduced-motion: reduce) {
	*,
	*::before,
	*::after {
		transition: none !important;
		animation: none !important;
	}
}
