/*
 * Dhivehi TTS player.
 * Palette is taken from the site itself (green #54bb6e, deep green #255244,
 * mint #e9f6e9) so the player reads as part of the page. Right-to-left: the
 * play control sits on the reading-start side and the waveform fills from there.
 */
.dtts-player,
.dtts-mini {
	--dtts-green: #54bb6e;
	--dtts-green-dark: #3da457;
	--dtts-ink: #255244;
	--dtts-muted: #6f8d80;
	--dtts-surface: #ffffff;
	--dtts-mint: #e9f6e9;
	--dtts-border: #dcefe1;
	--dtts-track: #cfe6d5;
	--dtts-num: -apple-system, "Inter", "Segoe UI", system-ui, sans-serif;
}

.dtts-player {
	display: flex;
	align-items: center;
	gap: 14px;
	margin: 0 0 26px;
	padding: 12px 14px;
	background: var(--dtts-surface);
	border: 1px solid var(--dtts-border);
	border-radius: 14px;
	box-sizing: border-box;
}

.dtts-player *,
.dtts-mini * {
	box-sizing: border-box;
}

/* Play / pause */
.dtts-play {
	flex: 0 0 auto;
	width: 46px;
	height: 46px;
	border: 0;
	border-radius: 9999px;
	background: var(--dtts-green);
	color: #fff;
	cursor: pointer;
	display: grid;
	place-items: center;
	padding: 0;
	transition: background .15s ease, transform .15s ease;
}
.dtts-play:hover { background: var(--dtts-green-dark); }
.dtts-play:active { transform: scale(.96); }
.dtts-play:focus-visible { outline: 2px solid var(--dtts-green-dark); outline-offset: 2px; }
.dtts-play svg { width: 20px; height: 20px; fill: currentColor; display: block; }
.dtts-ic { display: none; line-height: 0; }
.dtts-ic--play { display: block; }
.dtts-player.is-playing .dtts-ic--play,
.dtts-mini.is-playing .dtts-ic--play { display: none; }
.dtts-player.is-playing .dtts-ic--pause,
.dtts-mini.is-playing .dtts-ic--pause { display: block; }

/* Body */
.dtts-body { flex: 1 1 auto; min-width: 0; }
.dtts-row {
	display: flex;
	align-items: baseline;
	justify-content: space-between;
	gap: 10px;
	margin-bottom: 6px;
}
.dtts-label {
	color: var(--dtts-ink);
	font-weight: 600;
	font-size: .95rem;
	line-height: 1.3;
	/* Thaana font is inherited from the theme. */
}
.dtts-time {
	flex: 0 0 auto;
	font-family: var(--dtts-num);
	font-size: 12px;
	color: var(--dtts-muted);
	font-variant-numeric: tabular-nums;
	direction: ltr;
}

/* Waveform */
.dtts-wave {
	position: relative;
	height: 28px;
	cursor: pointer;
	touch-action: none;
	outline: none;
}
.dtts-wave-base,
.dtts-wave-played-inner {
	position: absolute;
	inset-block: 0;
	inset-inline: 0;
	display: flex;
	align-items: center;
	gap: 2px;
}
.dtts-wave-played {
	position: absolute;
	inset-block: 0;
	inset-inline-start: 0;
	inline-size: 0%;
	overflow: hidden;
	pointer-events: none;
}
.dtts-wave-played-inner { inset-inline: auto; inset-inline-start: 0; }
.dtts-bar {
	flex: 1 1 0;
	min-width: 2px;
	border-radius: 2px;
	background: var(--dtts-track);
}
.dtts-wave-played-inner .dtts-bar { background: var(--dtts-green); }
.dtts-wave:focus-visible { box-shadow: 0 0 0 2px var(--dtts-green); border-radius: 6px; }

/* Speed — plain text, no chrome */
.dtts-speed {
	flex: 0 0 auto;
	border: 0;
	background: none;
	color: var(--dtts-muted);
	padding: 6px 2px;
	font-family: var(--dtts-num);
	font-size: 12px;
	font-weight: 600;
	cursor: pointer;
	direction: ltr;
	transition: color .15s ease;
}
.dtts-speed:hover { color: var(--dtts-ink); }
.dtts-speed:focus-visible { outline: 2px solid var(--dtts-green); outline-offset: 2px; border-radius: 6px; }

/* ------------------------------------------------------------------ */
/* Floating mini pill, shown once the main player scrolls out of view   */
/* ------------------------------------------------------------------ */
.dtts-mini {
	position: fixed;
	bottom: 18px;
	left: 50%;
	transform: translateX(-50%) translateY(14px);
	z-index: 9999;
	display: flex;
	align-items: center;
	gap: 12px;
	padding: 7px 8px;
	background: var(--dtts-surface);
	border: 1px solid var(--dtts-border);
	border-radius: 9999px;
	box-shadow: 0 6px 24px rgba(37, 82, 68, .16);
	opacity: 0;
	visibility: hidden;
	transition: opacity .2s ease, transform .2s ease, visibility .2s;
	direction: rtl;
	max-width: calc(100vw - 32px);
}
.dtts-mini.is-visible {
	opacity: 1;
	visibility: visible;
	transform: translateX(-50%) translateY(0);
}
.dtts-mini-play {
	flex: 0 0 auto;
	width: 38px;
	height: 38px;
	border: 0;
	border-radius: 9999px;
	background: var(--dtts-green);
	color: #fff;
	cursor: pointer;
	display: grid;
	place-items: center;
	padding: 0;
	transition: background .15s ease;
}
.dtts-mini-play:hover { background: var(--dtts-green-dark); }
.dtts-mini-play:focus-visible { outline: 2px solid var(--dtts-green-dark); outline-offset: 2px; }
.dtts-mini-play svg { width: 16px; height: 16px; fill: currentColor; display: block; }

/* Label and progress share one column so their edges line up. Tapping it
   returns to the article player. */
.dtts-mini-jump {
	flex: 1 1 auto;
	min-width: 118px;
	display: flex;
	flex-direction: column;
	align-items: stretch;
	justify-content: center;
	gap: 6px;
	border: 0;
	background: none;
	padding: 0;
	margin: 0;
	cursor: pointer;
	text-align: start;
}
.dtts-mini-label {
	display: block;
	color: var(--dtts-ink);
	font-weight: 600;
	font-size: .85rem;
	line-height: 1.1;
	white-space: nowrap;
	text-align: start;
}
.dtts-mini-track {
	display: block;
	position: relative;
	height: 4px;
	border-radius: 999px;
	background: var(--dtts-track);
	overflow: hidden;
}
/* Anchored to the right so progress runs right-to-left like the waveform,
   whatever direction the surrounding page inherits. */
.dtts-mini-fill {
	position: absolute;
	top: 0;
	bottom: 0;
	right: 0;
	left: auto;
	width: 0%;
	background: var(--dtts-green);
	border-radius: 999px;
}
.dtts-mini-speed {
	flex: 0 0 auto;
	border: 0;
	background: none;
	color: var(--dtts-muted);
	padding: 6px 6px;
	font-family: var(--dtts-num);
	font-size: 12px;
	font-weight: 600;
	cursor: pointer;
	direction: ltr;
	line-height: 1;
	transition: color .15s ease;
}
.dtts-mini-speed:hover { color: var(--dtts-ink); }
.dtts-mini-speed:focus-visible { outline: 2px solid var(--dtts-green); outline-offset: 2px; border-radius: 6px; }

@media (max-width: 480px) {
	.dtts-player { gap: 10px; padding: 10px; }
	.dtts-play { width: 42px; height: 42px; }
	.dtts-mini { bottom: 12px; padding: 6px 6px; gap: 10px; }
	.dtts-mini-jump { min-width: 96px; }
}

@media (prefers-reduced-motion: reduce) {
	.dtts-play, .dtts-mini, .dtts-mini-play, .dtts-speed { transition: none; }
}
