/* TK Media Player — modal overlay (video + PDF) */

html.tkmp-locked,
body.tkmp-locked { overflow: hidden; }

.tkmp-root {
	position: fixed;
	inset: 0;
	z-index: 999999;
	display: flex;
	align-items: stretch;
	justify-content: stretch;
}
.tkmp-root[hidden] { display: none; }

.tkmp-backdrop {
	position: absolute;
	inset: 0;
	background: rgba(0,0,0,0.86);
	backdrop-filter: blur(6px);
	-webkit-backdrop-filter: blur(6px);
}

.tkmp-modal {
	position: relative;
	z-index: 1;
	display: flex;
	flex-direction: column;
	width: 100%;
	height: 100%;
	/* Unified dark token #1a1a1d across modal/stage/pdf-wrap and the
	   PDF.js viewer iframe (via injectViewerCSS). Without this, the
	   letterbox edges on aspect-mismatched PDFs (e.g. 16:9 PDF on iPad
	   portrait 3:4) would show three meeting shades of black —
	   subtle but visible. Codex UX M2 deferred fix, applied v0.2.19. */
	background: #1a1a1d;
}
/* :fullscreen rules — when the modal is the browser-fullscreen element,
   Safari (and to a lesser extent Chrome) sometimes lay it out at a smaller
   size than the viewport because the parent .tkmp-root is position:fixed.
   Force 100vw / 100vh on the actual fullscreen element so the layout
   always fills the screen edge-to-edge. (v0.2.21 — operator reported
   Safari macOS image not "loading fullscreen.") */
.tkmp-modal:fullscreen,
.tkmp-modal:-webkit-full-screen {
	width: 100vw;
	height: 100vh;
	max-width: 100vw;
	max-height: 100vh;
	background: #1a1a1d;
	color: #f1f1f3;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
}

.tkmp-toolbar {
	display: flex;
	align-items: center;
	gap: 12px;
	padding: 10px 16px;
	background: linear-gradient(to bottom, rgba(0,0,0,0.85), rgba(0,0,0,0));
	min-height: 56px;
	flex: 0 0 auto;
}
.tkmp-title {
	margin: 0;
	font-size: 16px;
	font-weight: 600;
	letter-spacing: -0.01em;
	flex: 1;
	color: #fff;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}
.tkmp-counter {
	font-size: 12px;
	color: rgba(255,255,255,0.7);
	padding: 4px 10px;
	border-radius: 999px;
	background: rgba(255,255,255,0.08);
	font-variant-numeric: tabular-nums;
}
.tkmp-actions {
	display: inline-flex;
	gap: 6px;
	align-items: center;
}
.tkmp-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 40px;
	height: 40px;
	background: rgba(255,255,255,0.10);
	color: #fff;
	border: 0;
	border-radius: 8px;
	font-size: 16px;
	cursor: pointer;
	transition: background 150ms ease, transform 100ms ease;
}
.tkmp-btn:hover  { background: rgba(255,255,255,0.18); }
.tkmp-btn:active { transform: scale(0.96); }
.tkmp-btn-close  { background: rgba(255,255,255,0.10); }
.tkmp-btn-close:hover { background: rgba(255,90,90,0.85); }
.tkmp-btn-loop.is-active { background: #ffd54a; color: #1d1500; }
.tkmp-btn-loop.is-active:hover { background: #ffcc2e; }

/* Play button — green when slideshow running. */
.tkmp-btn-play { font-size: 14px; }
.tkmp-btn-play.is-active { background: #46c46c; color: #0a2a13; }
.tkmp-btn-play.is-active:hover { background: #3aae5c; }

/* Slideshow interval input inline in the toolbar. */
.tkmp-interval-wrap {
	display: inline-flex;
	align-items: center;
	gap: 4px;
	padding: 4px 8px;
	background: rgba(255,255,255,0.10);
	border-radius: 8px;
	color: #fff;
}
.tkmp-interval {
	width: 48px;
	background: transparent;
	border: 0;
	color: #fff;
	font-size: 13px;
	font-variant-numeric: tabular-nums;
	text-align: center;
	-moz-appearance: textfield;
}
.tkmp-interval::-webkit-outer-spin-button,
.tkmp-interval::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.tkmp-interval:focus { outline: none; }
.tkmp-interval-wrap:focus-within { background: rgba(255,255,255,0.18); }
.tkmp-interval-unit { font-size: 11px; opacity: 0.7; }
@media (max-width: 600px) {
	.tkmp-interval-wrap { display: none; }
}
.tkmp-btn:focus-visible { outline: 3px solid #ffd54a; outline-offset: 2px; }

.tkmp-stage {
	position: relative;
	flex: 1 1 auto;
	display: flex;
	align-items: center;
	justify-content: center;
	background: #1a1a1d; /* matches PDF.js viewer background — see .tkmp-modal */
	overflow: hidden;
}

.tkmp-video {
	max-width: 100%;
	max-height: 100%;
	width: 100%;
	height: 100%;
	background: #000;
	display: block;
}

.tkmp-iframe {
	width: 100%;
	height: 100%;
	border: 0;
	background: #fff;
	display: block;
}

/* Image slide — single <img> centered, aspect-preserved via object-fit. */
.tkmp-image {
	max-width: 100%;
	max-height: 100%;
	width: auto;
	height: auto;
	display: block;
	margin: auto;
	object-fit: contain;
	background: #000;
}

/* PDF clip wrapper — when .tkmp-pdf-cliptop is on, the iframe shifts up
   under an overflow:hidden parent to hide the browser's PDF toolbar
   (~56px tall in Chrome/Edge). The iframe is sized larger to compensate. */
.tkmp-pdf-wrap {
	position: relative;
	width: 100%;
	height: 100%;
	overflow: hidden;
	background: #000;
}
/* Loading overlay — shown while pdf.worker.mjs + the PDF file are still
   downloading. JS removes it on PDF.js's first `pagerendered` event. */
.tkmp-pdf-loading {
	position: absolute;
	inset: 0;
	z-index: 5;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 14px;
	background: #1a1a1d;
	color: rgba(255,255,255,0.85);
	font-size: 14px;
	letter-spacing: 0.06em;
	pointer-events: none;
}
.tkmp-pdf-spinner {
	width: 44px;
	height: 44px;
	border-radius: 50%;
	border: 3px solid rgba(255,255,255,0.18);
	border-top-color: rgba(255,213,74,0.95);
	animation: tkmp-spin 900ms linear infinite;
}
@keyframes tkmp-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) {
	.tkmp-pdf-spinner { animation: none; }
}
.tkmp-pdf-wrap .tkmp-pdf-iframe {
	width: 100%;
	height: 100%;
	border: 0;
	display: block;
}
.tkmp-pdf-wrap.tkmp-pdf-cliptop .tkmp-pdf-iframe {
	position: absolute;
	top: -56px;
	left: 0;
	right: 0;
	width: 100%;
	height: calc(100% + 56px);
}

/* Stage scale modes — apply to the modal stage when a PDF is loaded.
   Defaults to "fill" (iframe 100% width + height). Other modes adjust
   the PDF wrap dimensions to letterbox / crop / distort. */
.tkmp-stage-fill    .tkmp-pdf-wrap { width: 100%; height: 100%; }
.tkmp-stage-contain .tkmp-pdf-wrap {
	width: min(100%, calc(100vh * 0.707));
	height: min(100%, calc(100vw / 0.707));
	margin: auto;
}
.tkmp-stage-cover   .tkmp-pdf-wrap {
	width: max(100%, calc(100vh * 0.707));
	height: max(100%, calc(100vw / 0.707));
	margin: auto;
}
.tkmp-stage-stretch .tkmp-pdf-wrap { width: 100%; height: 100%; }
.tkmp-stage-stretch .tkmp-pdf-iframe { width: 100% !important; height: 100% !important; }

/* Mobile + tablet tweaks — smaller toolbar buttons, tighter padding,
   safe-area inset for iPhone notch when in fullscreen. */
@media (max-width: 900px) {
	.tkmp-toolbar { padding: 8px 10px; gap: 6px; min-height: 48px; flex-wrap: wrap; }
	.tkmp-title   { font-size: 14px; max-width: 60%; }
	.tkmp-btn     { width: 38px; height: 38px; font-size: 14px; }
	.tkmp-counter { font-size: 11px; padding: 3px 8px; }
}
@media (max-width: 600px) {
	.tkmp-counter { display: none; }
	.tkmp-btn     { width: 36px; height: 36px; }
	.tkmp-title   { max-width: 100%; order: 10; flex: 1 1 100%; font-size: 12px; }
}
/* iOS / Android fullscreen — respect safe-area insets so the toolbar isn't
   eaten by the dynamic island / notch. */
.tkmp-modal {
	padding-top: env(safe-area-inset-top, 0);
	padding-bottom: env(safe-area-inset-bottom, 0);
	padding-left: env(safe-area-inset-left, 0);
	padding-right: env(safe-area-inset-right, 0);
}
.tkmp-modal.tkmp-fullscreen {
	/* In fullscreen, the OS handles the inset; reset so PDF goes edge-to-edge. */
	padding: 0;
}
/* iOS-ONLY deterministic video fullscreen fallback. Added by renderVideo's iOS
   branch (tkmp-ios-vfs) ONLY when native webkitEnterFullscreen() never engages
   in a standalone PWA. The existing kiosk toolbar-hide is PDF-only, so video
   needs its own: hide the toolbar and make the stage fill the viewport so the
   <video> plays edge-to-edge with no OS Fullscreen API. This class is never
   added on Android/Chrome, so the selector matches nothing there. */
/* Immersive video fullscreen — iPad CSS-fallback (.tkmp-ios-vfs) AND Android
   modal-fullscreen (.tkmp-video.tkmp-fullscreen): fill the viewport edge-to-edge
   and strip the toolbar chrome, but KEEP a floating, tappable close-X. The X is
   the only control wired to close(); hiding the whole toolbar left NO reachable
   one-tap close, so exiting the video stranded the teacher in the modal shell
   (the tablet double-close bug). Now one tap on the X returns to the lesson.
   PDF kiosk (.tkmp-kiosk) is untouched. */
.tkmp-modal.tkmp-ios-vfs .tkmp-toolbar,
.tkmp-modal.tkmp-video.tkmp-fullscreen .tkmp-toolbar {
	position: absolute; top: env(safe-area-inset-top, 0); right: 0; left: auto;
	min-height: 0; padding: 8px; background: none; z-index: 12; pointer-events: none;
}
.tkmp-modal.tkmp-ios-vfs .tkmp-toolbar > *:not([data-tkmp-close]),
.tkmp-modal.tkmp-video.tkmp-fullscreen .tkmp-toolbar > *:not([data-tkmp-close]) { display: none !important; }
.tkmp-modal.tkmp-ios-vfs [data-tkmp-close],
.tkmp-modal.tkmp-video.tkmp-fullscreen [data-tkmp-close] {
	display: inline-flex !important; pointer-events: auto; background: rgba(0, 0, 0, 0.55);
}
.tkmp-modal.tkmp-ios-vfs .tkmp-stage,
.tkmp-modal.tkmp-video.tkmp-fullscreen .tkmp-stage { position: absolute; inset: 0; }

/* Android video-fullscreen close-X — operator-controllable. ALL of these require
   .tkmp-vclose-android, which player.js adds ONLY when !_isIOSish, so iOS/iPadOS
   (native webkitEnterFullscreen close, or the .tkmp-ios-vfs fallback) is never
   affected. Placed in the LEFT corner (matches iOS's native "Done"). Opacity is
   the user's slider value (--tkmp-vclose-op). Default is AUTO-HIDE
   (.tkmp-vclose-autohide) so the X doesn't sit over bright video: a screen tap
   reveals it (.tkmp-vclose-show) for a few seconds; the "always show" pref removes
   autohide so it stays visible at the chosen opacity. */
.tkmp-modal.tkmp-vclose-android.tkmp-video.tkmp-fullscreen .tkmp-toolbar { right: auto; left: 0; }
.tkmp-modal.tkmp-vclose-android.tkmp-video.tkmp-fullscreen [data-tkmp-close] {
	opacity: var(--tkmp-vclose-op, 1);
	transition: opacity 0.3s ease;
}
.tkmp-modal.tkmp-vclose-android.tkmp-vclose-autohide.tkmp-video.tkmp-fullscreen [data-tkmp-close] {
	opacity: 0;
	pointer-events: none;
}
.tkmp-modal.tkmp-vclose-android.tkmp-vclose-autohide.tkmp-vclose-show.tkmp-video.tkmp-fullscreen [data-tkmp-close] {
	opacity: var(--tkmp-vclose-op, 1);
	pointer-events: auto;
}
/* Touch-friendly tap zones — bigger hit targets on coarse pointers. */
@media (pointer: coarse) {
	.tkmp-tap-hint { width: 64px; height: 64px; font-size: 32px; }
	.tkmp-btn      { min-width: 44px; min-height: 44px; }
}

/* Inline embeds (shortcode inline="1") */
.tkmp-inline {
	position: relative;
	width: 100%;
	background: #000;
	border-radius: 12px;
	overflow: hidden;
}
.tkmp-inline-video { aspect-ratio: 16 / 9; }
.tkmp-inline-pdf   { height: 80vh; }
.tkmp-inline video,
.tkmp-inline iframe {
	width: 100%;
	height: 100%;
	border: 0;
	display: block;
}

/* Tap zones — visible only in kiosk mode. Three regions:
   - top  (--tkmp-top-pct height) → reveal toolbar / exit fullscreen
   - bottom split left/right     → prev/next PDF page
   Pointer events idle until kiosk class flips them on. */
.tkmp-tapzones {
	--tkmp-top-pct: 30%;
	position: absolute;
	inset: 0;
	pointer-events: none;
	display: flex;
	flex-direction: column;
	z-index: 5;
}
/* Tap-zone <button> elements — defeat ALL browser default backgrounds /
   focus rings / active highlights. The blue/gray overlays users saw on
   hover were Chrome's default button :hover state leaking through. */
.tkmp-tap,
.tkmp-tap:hover,
.tkmp-tap:focus,
.tkmp-tap:active,
.tkmp-tap:focus-visible,
.tkmp-tap:focus-within {
	background: transparent !important;
	background-color: transparent !important;
	background-image: none !important;
	border: 0 !important;
	outline: 0 !important;
	outline-offset: 0 !important;
	box-shadow: none !important;
	color: rgba(255,255,255,0);
	-webkit-appearance: none;
	-moz-appearance: none;
	appearance: none;
	-webkit-tap-highlight-color: rgba(0,0,0,0) !important;
	color-scheme: light dark;
}
.tkmp-tap {
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	font-size: 56px;
	font-weight: 700;
	transition: color 200ms ease;
	padding: 0;
	margin: 0;
}
.tkmp-tap-top { flex: 0 0 var(--tkmp-top-pct); width: 100%; }
.tkmp-tap-row { flex: 1 1 auto; display: flex; justify-content: space-between; width: 100%; }
.tkmp-tap-prev   { flex: 0 0 25%; height: 100%; justify-content: flex-start; padding-left: 4vw; touch-action: manipulation; }
.tkmp-tap-center { flex: 0 0 50%; height: 100%; cursor: default; touch-action: manipulation; }
.tkmp-tap-next   { flex: 0 0 25%; height: 100%; justify-content: flex-end;   padding-right: 4vw; touch-action: manipulation; }
.tkmp-tap-hint {
	/* The on-content tap-zone arrow HINTS are hidden by default — they cluttered
	   the PDF/media and only flashed in on mouse-move. Navigation still works:
	   the tap-zone buttons (.tkmp-tap-prev/.tkmp-tap-next) stay clickable, plus
	   the toolbar prev/next and the keyboard arrows. The visual styling below
	   applies only if the hints are ever re-enabled (set display: inline-flex). */
	display: none;
	width: 80px;
	height: 80px;
	align-items: center;
	justify-content: center;
	line-height: 1;
	color: #fff;
	text-shadow: 0 1px 4px rgba(0,0,0,0.75), 0 0 2px rgba(0,0,0,0.9);
	transition: opacity 200ms ease;
}

/* Kiosk mode (PDF loaded) — activates tap zones so taps + arrow keys
   navigate pages. Always on for PDFs regardless of fullscreen state.
   The .tkmp-fullscreen modifier adds the toolbar-hidden behavior. */
.tkmp-modal.tkmp-kiosk .tkmp-tapzones {
	pointer-events: auto;
}
/* PDF / kiosk mode — toolbar overlays the stage (absolute position) so the
   PDF fills the modal edge-to-edge with NO top offset when the toolbar is
   hidden. Toolbar slides DOWN from above on peek and auto-hides. */
.tkmp-modal.tkmp-kiosk {
	display: block; /* override flex column so absolute children behave predictably */
}
.tkmp-modal.tkmp-kiosk .tkmp-stage {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
}
.tkmp-modal.tkmp-kiosk .tkmp-toolbar {
	position: absolute;
	top: 0;
	left: 0;
	right: 0;
	/* Above the tap zones (z-index 5) so toolbar buttons (fullscreen,
	   close, prev / next, etc.) receive clicks during peek instead of
	   the transparent tap-zone catching them. */
	z-index: 10;
	opacity: 0;
	pointer-events: none;
	transform: translateY(-100%);
	transition: opacity 220ms ease, transform 260ms ease;
}
.tkmp-modal.tkmp-kiosk.tkmp-toolbar-peek .tkmp-toolbar {
	opacity: 1;
	pointer-events: auto;
	transform: translateY(0);
}
/* When the toolbar is peeking, suppress the tap zone that sits beneath it
   (top zone) so its click never reaches the toolbar buttons by accident. */
.tkmp-modal.tkmp-kiosk.tkmp-toolbar-peek .tkmp-tap-top {
	pointer-events: none;
}
.tkmp-stage { outline: none; }
/* Persistent tap-zone hints are HIDDEN in kiosk mode — the nav-flash
   glyph (which fires only on actual navigation) is the single source of
   direction feedback. Showing both creates a confusing "two arrows" effect
   (one persistent at low opacity, one flashing) that users reported.
   Keyboard focus state is preserved so a11y users can still see focus. */
.tkmp-modal.tkmp-kiosk .tkmp-tap-hint { opacity: 0 !important; }
.tkmp-modal.tkmp-kiosk .tkmp-tap:focus-visible .tkmp-tap-hint {
	opacity: 1 !important;
	color: #fff;
}
.tkmp-modal.tkmp-kiosk .tkmp-tap:active { background: rgba(255,255,255,0.04); }

/* Idle mouse — fade tap hints + hide cursor for distraction-free reading.
   JS adds .tkmp-mouse-active on mousemove, removes it after ~2.5s idle. */
.tkmp-modal.tkmp-kiosk:not(.tkmp-mouse-active) { cursor: none; }
.tkmp-modal.tkmp-kiosk:not(.tkmp-mouse-active) .tkmp-tap-hint { opacity: 0 !important; }

/* Toolbar reveal — explicit class set by JS when the user taps the top
   zone (or hovers the top edge on desktop). Auto-hides after ~4.5s. */
.tkmp-modal.tkmp-toolbar-peek .tkmp-toolbar,
.tkmp-modal.tkmp-kiosk.tkmp-fullscreen:hover .tkmp-toolbar:hover {
	opacity: 1;
	pointer-events: auto;
	transform: translateY(0);
}
.tkmp-modal.tkmp-toolbar-peek .tkmp-toolbar {
	background: linear-gradient(to bottom, rgba(0,0,0,0.92), rgba(0,0,0,0.55) 70%, rgba(0,0,0,0));
}

/* Page toast — short-lived overlay shown when navigating PDF pages */
.tkmp-toast {
	position: absolute;
	top: 24px;
	left: 50%;
	transform: translateX(-50%);
	background: rgba(0,0,0,0.78);
	color: #fff;
	padding: 8px 18px;
	border-radius: 999px;
	font-size: 14px;
	font-weight: 600;
	letter-spacing: 0.03em;
	z-index: 10;
	opacity: 1;
	transition: opacity 400ms ease;
	pointer-events: none;
}
.tkmp-toast.is-fading { opacity: 0; }

/* Launcher buttons (shortcode) */
.tkmp-launcher {
	display: inline-flex;
	align-items: center;
	gap: 10px;
	padding: 10px 18px;
	border: 0;
	border-radius: 999px;
	background: #2271b1;
	color: #fff;
	font-weight: 600;
	cursor: pointer;
	font-size: 14px;
	transition: background 150ms ease, transform 100ms ease;
}
.tkmp-launcher:hover  { background: #135e96; }
.tkmp-launcher:active { transform: scale(0.97); }
.tkmp-launcher-pdf    { background: #b32d2e; }
.tkmp-launcher-pdf:hover { background: #8a1d1d; }
.tkmp-launcher-icon { font-size: 16px; line-height: 1; }

/* ==========================================================================
   Arrow style + size variants (admin-configurable)
   - tap-zone hint arrows use ::after with content from data attr
   - toolbar prev/next buttons use the same content tokens
   ========================================================================== */

/* Default chevron (kept on .tkmp-tap-hint via inline &#10094; / &#10095;) */

/* Triangle */
.tkmp-modal[data-tkmp-arrow-style="triangle"] .tkmp-tap-prev .tkmp-tap-hint { font-size: 0; }
.tkmp-modal[data-tkmp-arrow-style="triangle"] .tkmp-tap-next .tkmp-tap-hint { font-size: 0; }
.tkmp-modal[data-tkmp-arrow-style="triangle"] .tkmp-tap-prev .tkmp-tap-hint::before,
.tkmp-modal[data-tkmp-arrow-style="triangle"] .tkmp-tap-next .tkmp-tap-hint::before {
	content: ""; display: block; width: 0; height: 0;
	border-top: 22px solid transparent;
	border-bottom: 22px solid transparent;
}
.tkmp-modal[data-tkmp-arrow-style="triangle"] .tkmp-tap-prev .tkmp-tap-hint::before { border-right: 32px solid #fff; }
.tkmp-modal[data-tkmp-arrow-style="triangle"] .tkmp-tap-next .tkmp-tap-hint::before { border-left:  32px solid #fff; }
.tkmp-modal[data-tkmp-arrow-style="triangle"] [data-tkmp-prev] { font-size: 0; }
.tkmp-modal[data-tkmp-arrow-style="triangle"] [data-tkmp-next] { font-size: 0; }
.tkmp-modal[data-tkmp-arrow-style="triangle"] [data-tkmp-prev]::before,
.tkmp-modal[data-tkmp-arrow-style="triangle"] [data-tkmp-next]::before {
	content: ""; display: inline-block; width: 0; height: 0;
	border-top: 10px solid transparent;
	border-bottom: 10px solid transparent;
}
.tkmp-modal[data-tkmp-arrow-style="triangle"] [data-tkmp-prev]::before { border-right: 14px solid currentColor; }
.tkmp-modal[data-tkmp-arrow-style="triangle"] [data-tkmp-next]::before { border-left:  14px solid currentColor; }

/* Circle — solid filled disc with center arrow */
.tkmp-modal[data-tkmp-arrow-style="circle"] .tkmp-tap-hint {
	background: rgba(255,255,255,0.18);
	border-radius: 50%;
	backdrop-filter: blur(6px);
	-webkit-backdrop-filter: blur(6px);
}

/* Square — rounded-rect frame */
.tkmp-modal[data-tkmp-arrow-style="square"] .tkmp-tap-hint {
	background: rgba(255,255,255,0.12);
	border-radius: 8px;
}

/* Minimal — just glyph, no background */
.tkmp-modal[data-tkmp-arrow-style="minimal"] .tkmp-tap-hint {
	background: transparent !important;
	box-shadow: none;
}

/* Arrow size variants — applies to tap hints + toolbar prev/next buttons */
.tkmp-modal[data-tkmp-arrow-size="small"] .tkmp-tap-hint  { width: 44px; height: 44px; font-size: 22px; }
.tkmp-modal[data-tkmp-arrow-size="small"] [data-tkmp-prev],
.tkmp-modal[data-tkmp-arrow-size="small"] [data-tkmp-next] { width: 32px; height: 32px; font-size: 13px; }
.tkmp-modal[data-tkmp-arrow-size="medium"] .tkmp-tap-hint { width: 80px; height: 80px; font-size: 32px; }
.tkmp-modal[data-tkmp-arrow-size="large"]  .tkmp-tap-hint { width: 112px; height: 112px; font-size: 44px; }
.tkmp-modal[data-tkmp-arrow-size="large"]  [data-tkmp-prev],
.tkmp-modal[data-tkmp-arrow-size="large"]  [data-tkmp-next] { width: 56px; height: 56px; font-size: 22px; }

/* Auto-hide — fade BOTH tap-zone arrows and toolbar prev/next when the
   JS-managed timer says they should hide. CSS-only mouseover still re-shows
   the tap hints via .tkmp-mouse-active. */
.tkmp-modal.tkmp-arrows-hidden .tkmp-tap-hint,
.tkmp-modal.tkmp-arrows-hidden [data-tkmp-prev],
.tkmp-modal.tkmp-arrows-hidden [data-tkmp-next] {
	opacity: 0 !important;
	transition: opacity 400ms ease;
	pointer-events: none;
}
.tkmp-modal.tkmp-arrows-hidden.tkmp-mouse-active .tkmp-tap-hint,
.tkmp-modal.tkmp-arrows-hidden.tkmp-mouse-active [data-tkmp-prev],
.tkmp-modal.tkmp-arrows-hidden.tkmp-mouse-active [data-tkmp-next] {
	opacity: 1 !important;
	pointer-events: auto;
}

/* ==========================================================================
   Loading bar — minimal indeterminate progress bar pinned to the top OR
   bottom edge of the TK Media window. Removed on first pagerendered (PDF)
   or loadedmetadata (video). Color / height / style driven by admin opts.
   ========================================================================== */
.tkmp-loading-bar {
	position: absolute;
	left: 0;
	right: 0;
	height: var(--tkmp-loading-height, 3px);
	background: rgba(255,255,255,0.08);
	overflow: hidden;
	z-index: 6;
	pointer-events: none;
}
.tkmp-modal[data-tkmp-loading-position="top"]    .tkmp-loading-bar { top: 0; }
.tkmp-modal[data-tkmp-loading-position="bottom"] .tkmp-loading-bar { bottom: 0; }
.tkmp-loading-bar-fill {
	display: block;
	width: 30%;
	height: 100%;
	background: var(--tkmp-loading-color, #ffd54a);
	border-radius: 0 2px 2px 0;
}

/* Solid — static full fill */
.tkmp-modal[data-tkmp-loading-style="solid"] .tkmp-loading-bar-fill {
	width: 100%;
	opacity: 0.85;
}

/* Gradient sweep (default) — sliding light */
.tkmp-modal[data-tkmp-loading-style="gradient"] .tkmp-loading-bar-fill {
	width: 40%;
	background: linear-gradient(90deg, transparent, var(--tkmp-loading-color, #ffd54a), transparent);
	animation: tkmp-loading-sweep 1400ms ease-in-out infinite;
}
@keyframes tkmp-loading-sweep {
	0%   { transform: translateX(-100%); }
	100% { transform: translateX(350%); }
}

/* Pulse — breathing opacity, full width */
.tkmp-modal[data-tkmp-loading-style="pulse"] .tkmp-loading-bar-fill {
	width: 100%;
	animation: tkmp-loading-pulse 1200ms ease-in-out infinite;
}
@keyframes tkmp-loading-pulse {
	0%, 100% { opacity: 0.3; }
	50%      { opacity: 1;   }
}

/* Stripes — barber-pole */
.tkmp-modal[data-tkmp-loading-style="stripes"] .tkmp-loading-bar-fill {
	width: 100%;
	background-image: linear-gradient(
		45deg,
		var(--tkmp-loading-color, #ffd54a) 25%,
		rgba(0,0,0,0.18) 25%,
		rgba(0,0,0,0.18) 50%,
		var(--tkmp-loading-color, #ffd54a) 50%,
		var(--tkmp-loading-color, #ffd54a) 75%,
		rgba(0,0,0,0.18) 75%
	);
	background-size: 24px 24px;
	animation: tkmp-loading-stripes 700ms linear infinite;
}
@keyframes tkmp-loading-stripes {
	from { background-position: 0 0; }
	to   { background-position: 24px 0; }
}

@media (prefers-reduced-motion: reduce) {
	.tkmp-loading-bar-fill { animation: none !important; }
}

/* Slide reference overlay — translucent "page X / Y" pill on top of the
   PDF iframe. Disabled by default (admin option). Six corner positions. */
.tkmp-slide-ref {
	position: absolute;
	z-index: 6;
	padding: 6px 14px;
	border-radius: 999px;
	background: rgba(0,0,0,0.72);
	color: #fff;
	font-size: 12px;
	font-weight: 600;
	letter-spacing: 0.06em;
	font-variant-numeric: tabular-nums;
	pointer-events: none;
	user-select: none;
	box-shadow: 0 2px 6px rgba(0,0,0,0.35);
}
.tkmp-slide-ref-top-left      { top: 14px;    left: 14px; }
.tkmp-slide-ref-top-center    { top: 14px;    left: 50%; transform: translateX(-50%); }
.tkmp-slide-ref-top-right     { top: 14px;    right: 14px; }
.tkmp-slide-ref-bottom-left   { bottom: 14px; left: 14px; }
.tkmp-slide-ref-bottom-center { bottom: 14px; left: 50%; transform: translateX(-50%); }
.tkmp-slide-ref-bottom-right  { bottom: 14px; right: 14px; }

/* Cache-status badge — lower-left indicator of SW cache hit for the current
   slide. Sits above slide-ref (z-index 6) but below the toolbar peek. Two
   states via data-state: "cached" (green check) and "fetching" (amber spinner).
   Hover reveals a small dismiss X in the upper-right. Hidden entirely for
   cross-origin slides or when the caches API is unavailable (JS handles that
   by never mounting the element). */
:root {
	--tkmp-cache-cached:   #4ade80;
	--tkmp-cache-fetching: #ffd54a;
}
.tkmp-cache-badge {
	position: absolute;
	bottom: 10px;
	left: 10px;
	z-index: 7;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 26px;
	height: 26px;
	padding: 0;
	border-radius: 999px;
	background: rgba(0,0,0,0.72);
	color: #fff;
	box-shadow: 0 2px 6px rgba(0,0,0,0.35);
	user-select: none;
	transition: opacity 200ms ease, transform 150ms ease;
	opacity: 0.85;
}
.tkmp-cache-badge:hover { opacity: 1; }
.tkmp-cache-icon {
	display: block;
	width: 14px;
	height: 14px;
	border-radius: 50%;
}
.tkmp-cache-badge[data-state="cached"] .tkmp-cache-icon {
	background: var(--tkmp-cache-cached);
	/* White check glyph drawn with a CSS mask so it scales cleanly. */
	-webkit-mask: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'><path fill='%23000' d='M6.5 11.2 3.3 8l-1 1 4.2 4.2 7-7-1-1z'/></svg>") no-repeat center / 12px 12px;
	        mask: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'><path fill='%23000' d='M6.5 11.2 3.3 8l-1 1 4.2 4.2 7-7-1-1z'/></svg>") no-repeat center / 12px 12px;
	background-color: var(--tkmp-cache-cached);
}
.tkmp-cache-badge[data-state="fetching"] .tkmp-cache-icon {
	background: transparent;
	border: 2px solid rgba(255,255,255,0.25);
	border-top-color: var(--tkmp-cache-fetching);
	animation: tkmp-cache-spin 900ms linear infinite;
	box-sizing: border-box;
	width: 14px;
	height: 14px;
}
@keyframes tkmp-cache-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) {
	.tkmp-cache-badge[data-state="fetching"] .tkmp-cache-icon { animation: none; }
}
.tkmp-cache-dismiss {
	position: absolute;
	top: -8px;
	right: -8px;
	width: 24px;
	height: 24px;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: rgba(0,0,0,0.85);
	color: #fff;
	font-size: 13px;
	line-height: 24px;
	text-align: center;
	cursor: pointer;
	opacity: 0;
	transform: scale(0.8);
	transition: opacity 150ms ease, transform 150ms ease;
}
.tkmp-cache-badge:hover .tkmp-cache-dismiss,
.tkmp-cache-badge:focus-within .tkmp-cache-dismiss {
	opacity: 1;
	transform: scale(1);
}
/* Touch devices have no hover state — keep the dismiss X visible at low
   opacity so iPad / iPhone users have a reachable affordance. (Codex UX
   H1+H2: 24px touch target + always-visible on touch.) */
@media (pointer: coarse) {
	.tkmp-cache-dismiss {
		opacity: 0.75;
		transform: scale(1);
	}
}
.tkmp-cache-dismiss:hover { background: rgba(255,90,90,0.9); }
.tkmp-cache-dismiss:focus-visible { outline: 2px solid #ffd54a; outline-offset: 1px; }

/* Navigation-direction flash — brief ~400ms pulse on the left or right side
   of the stage whenever next/prev (video) or pdfNextPage/pdfPrevPage fires.
   Independent of mouse activity so keyboard-only users still get direction
   feedback. Used for the church-iPad audience who switch between tapping,
   arrow keys, and keyboard alike. */
.tkmp-nav-flash {
	/* Disabled by default — this is the big arrow that briefly flashed on each
	   page/slide change and cluttered the PDF. The page changing is its own
	   feedback. Set display: flex to bring it back. */
	display: none;
	position: absolute;
	top: 0;
	bottom: 0;
	width: 38%;
	z-index: 8;
	align-items: center;
	pointer-events: none;
	opacity: 0;
	animation: tkmp-nav-flash 400ms cubic-bezier(0.25, 0.46, 0.45, 0.94) forwards;
}
.tkmp-nav-flash-prev {
	left: 0;
	justify-content: flex-start;
	padding-left: 6vw;
	background: linear-gradient(to right, rgba(0,0,0,0.45), rgba(0,0,0,0) 75%);
}
.tkmp-nav-flash-next {
	right: 0;
	justify-content: flex-end;
	padding-right: 6vw;
	background: linear-gradient(to left,  rgba(0,0,0,0.45), rgba(0,0,0,0) 75%);
}
.tkmp-nav-flash-glyph {
	font-size: 72px;
	line-height: 1;
	color: rgba(255,255,255,0.95);
	text-shadow: 0 2px 12px rgba(0,0,0,0.7);
	font-weight: 700;
}
@keyframes tkmp-nav-flash {
	0%   { opacity: 0; }
	30%  { opacity: 1; }
	100% { opacity: 0; }
}
@media (prefers-reduced-motion: reduce) {
	.tkmp-nav-flash { animation: none; opacity: 0; }
}
/* Bottom scrubber overlay — kiosk-mode only. Mirrors the top toolbar's
   slide-from-edge behavior. Driven by .tkmp-bottom-peek class set by JS
   on mouse-near-bottom OR after any pdfGoto. Auto-hides after 4.5s.
   Independent of .tkmp-toolbar-peek — both can be active simultaneously. */
.tkmp-bottom-bar {
	position: absolute;
	left: 0;
	right: 0;
	bottom: 0;
	z-index: 9; /* above tap zones (default), below toolbar (10) */
	display: flex;
	align-items: center;
	gap: 12px;
	padding: 14px 18px 18px;
	background: linear-gradient(to top, rgba(0,0,0,0.88), rgba(0,0,0,0.55) 60%, rgba(0,0,0,0));
	opacity: 0;
	pointer-events: none;
	transform: translateY(100%);
	transition: opacity 220ms ease, transform 260ms ease;
}
.tkmp-modal.tkmp-kiosk.tkmp-bottom-peek .tkmp-bottom-bar {
	opacity: 1;
	pointer-events: auto;
	transform: translateY(0);
}
.tkmp-bottom-progress {
	flex: 1 1 auto;
	height: 4px;
	background: rgba(255,255,255,0.20);
	border-radius: 999px;
	overflow: hidden;
}
.tkmp-bottom-progress-fill {
	height: 100%;
	width: 0;
	background: rgba(255,213,74,0.95);
	border-radius: 999px;
	transition: width 220ms ease;
}
.tkmp-bottom-pageref {
	color: rgba(255,255,255,0.85);
	font-size: 13px;
	font-weight: 600;
	letter-spacing: 0.04em;
	font-variant-numeric: tabular-nums;
	min-width: 56px;
	text-align: right;
	user-select: none;
}
.tkmp-bottom-fs-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 36px;
	height: 36px;
	padding: 0;
	border: 0;
	border-radius: 8px;
	background: rgba(255,255,255,0.10);
	color: #fff;
	font-size: 16px;
	cursor: pointer;
	transition: background 150ms ease, transform 100ms ease;
}
.tkmp-bottom-fs-btn:hover  { background: rgba(255,255,255,0.18); }
.tkmp-bottom-fs-btn:active { transform: scale(0.96); }
.tkmp-bottom-fs-btn:focus-visible { outline: 3px solid #ffd54a; outline-offset: 2px; }
@media (prefers-reduced-motion: reduce) {
	.tkmp-bottom-bar { transition: none; }
	.tkmp-bottom-progress-fill { transition: none; }
}

/* Nav-flash arrow style variants — match the admin "Arrow style" picker.
   Default (chevron) needs no wrapper. Circle and square use a glyph chip. */
.tkmp-nav-flash[data-tkmp-arrow-style="circle"] .tkmp-nav-flash-glyph,
.tkmp-nav-flash[data-tkmp-arrow-style="square"] .tkmp-nav-flash-glyph {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 96px;
	height: 96px;
	background: rgba(0,0,0,0.55);
	box-shadow: 0 6px 18px rgba(0,0,0,0.45);
	font-size: 48px;
}
.tkmp-nav-flash[data-tkmp-arrow-style="circle"] .tkmp-nav-flash-glyph { border-radius: 50%; }
.tkmp-nav-flash[data-tkmp-arrow-style="square"] .tkmp-nav-flash-glyph { border-radius: 14px; }
.tkmp-nav-flash[data-tkmp-arrow-style="minimal"] .tkmp-nav-flash-glyph { font-size: 56px; opacity: 0.78; }
