.pfb-flipbook {
	--pfb-ratio: 0.75;
	position: relative;
	width: 100%;
	height: 600px;
	max-width: 100%;
	border-radius: 6px;
	overflow: hidden;
	box-sizing: border-box;
	color: #fff;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
	font-size: 13px;
	line-height: 1.3;
}

.pfb-flipbook * {
	box-sizing: border-box;
}

/* Neutralize theme button styles inside the viewer (zero specificity, so
   the component rules below still apply). */
.pfb-flipbook :where(button) {
	margin: 0;
	font: inherit;
	letter-spacing: normal;
	text-transform: none;
	box-shadow: none;
	min-width: 0;
	min-height: 0;
	line-height: 1;
}

.pfb-flipbook svg {
	display: block;
	fill: none;
	stroke: currentColor;
	stroke-width: 1.6;
	stroke-linecap: round;
	stroke-linejoin: round;
}

.pfb-flipbook svg .pfb-fill {
	fill: currentColor;
	stroke: none;
}

.pfb-flipbook:fullscreen {
	width: 100vw;
	height: 100vh;
	border-radius: 0;
}

/* Loading */

.pfb-loading {
	position: absolute;
	top: 50%;
	left: 50%;
	transform: translate(-50%, -50%);
	color: rgba(255, 255, 255, 0.85);
	font-size: 14px;
	text-align: center;
}

.pfb-spinner {
	display: block;
	width: 36px;
	height: 36px;
	border: 2px solid rgba(255, 255, 255, 0.18);
	border-top-color: rgba(255, 255, 255, 0.85);
	border-radius: 50%;
	animation: pfb-spin 0.9s linear infinite;
}

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

.pfb-stage-error {
	position: absolute;
	top: 50%;
	left: 50%;
	z-index: 9;
	transform: translate(-50%, -50%);
	padding: 10px 14px;
	background: rgba(0, 0, 0, 0.7);
	border-radius: 4px;
}

/* Layout */

.pfb-wrapper {
	display: flex;
	flex-direction: column;
	width: 100%;
	height: 100%;
}

.pfb-stage {
	position: relative;
	display: flex;
	flex: 1 1 auto;
	min-height: 0;
}

.pfb-book-holder {
	position: relative;
	display: flex;
	flex: 1 1 auto;
	align-items: center;
	justify-content: center;
	width: 100%;
	min-height: 0;
	padding: 16px 64px;
	overflow: hidden;
	touch-action: none;
}

.pfb-book-holder.pfb-zoomed {
	cursor: grab;
}

.pfb-book-holder.pfb-zoomed.pfb-dragging {
	cursor: grabbing;
}

.pfb-book-holder.pfb-zoomed.pfb-follow {
	cursor: move;
}

.pfb-book-holder:not(.pfb-zoomed) .stf__item {
	cursor: pointer;
}

.pfb-zoom-layer {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 100%;
	height: 100%;
	transform-origin: center center;
	will-change: transform;
}

.pfb-book {
	position: relative;
}

/* Pages */

.pfb-page {
	overflow: hidden;
	background-color: rgba(255, 255, 255, 0.7);
}

.pfb-page:not(.pfb-page-ready)::after {
	content: "";
	position: absolute;
	top: 50%;
	left: 50%;
	width: 24px;
	height: 24px;
	margin: -12px 0 0 -12px;
	border: 2px solid rgba(0, 0, 0, 0.12);
	border-top-color: rgba(0, 0, 0, 0.45);
	border-radius: 50%;
	animation: pfb-spin 0.9s linear infinite;
}

.pfb-page-preview {
	position: absolute;
	top: 0;
	right: 0;
	bottom: 0;
	left: 0;
	background-repeat: no-repeat;
}

.pfb-detail {
	position: absolute;
	z-index: 2;
	display: block;
	pointer-events: none;
}

.pfb-page img {
	position: relative;
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
	-webkit-user-drag: none;
	user-select: none;
}

.pfb-protected .pfb-page img,
.pfb-protected .pfb-book {
	-webkit-user-select: none;
	-moz-user-select: none;
	user-select: none;
}

/* Side navigation */

.pfb-side-nav {
	position: absolute;
	top: 50%;
	z-index: 5;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 48px;
	height: 72px;
	margin-top: -36px;
	padding: 0;
	background: transparent;
	border: none;
	border-radius: 4px;
	color: rgba(255, 255, 255, 0.7);
	cursor: pointer;
	transition: color 0.15s ease, background 0.15s ease;
}

.pfb-side-nav:hover,
.pfb-side-nav:focus-visible {
	color: #fff;
	background: rgba(255, 255, 255, 0.08);
}

.pfb-side-nav svg {
	width: 40px;
	height: 40px;
	stroke-width: 1.5;
}

.pfb-side-nav.pfb-prev {
	left: 8px;
}

.pfb-side-nav.pfb-next {
	right: 8px;
}

.pfb-side-nav.pfb-first,
.pfb-side-nav.pfb-last {
	top: auto;
	bottom: 12px;
	width: 36px;
	height: 36px;
	margin-top: 0;
	color: rgba(255, 255, 255, 0.45);
}

.pfb-side-nav.pfb-first svg,
.pfb-side-nav.pfb-last svg {
	width: 18px;
	height: 18px;
}

.pfb-side-nav.pfb-first {
	left: 14px;
}

.pfb-side-nav.pfb-last {
	right: 14px;
}

/* Toolbar */

.pfb-toolbar {
	display: flex;
	flex: 0 0 auto;
	align-items: center;
	gap: 12px;
	padding: 8px 14px;
	background: rgba(0, 0, 0, 0.25);
}

.pfb-toolbar-group {
	display: flex;
	flex: 0 0 auto;
	align-items: center;
	gap: 2px;
}

.pfb-tool {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 34px;
	height: 34px;
	padding: 0;
	background: transparent;
	border: none;
	border-radius: 4px;
	color: rgba(255, 255, 255, 0.8);
	text-decoration: none;
	cursor: pointer;
	transition: color 0.15s ease, background 0.15s ease;
}

.pfb-tool svg {
	width: 20px;
	height: 20px;
}

.pfb-tool:hover,
.pfb-tool:focus-visible {
	color: #fff;
	background: rgba(255, 255, 255, 0.1);
}

.pfb-tool[aria-pressed="true"] {
	color: #fff;
	background: rgba(255, 255, 255, 0.16);
}

.pfb-page-indicator {
	flex: 0 0 auto;
	min-width: 76px;
	color: #fff;
	font-size: 13px;
	font-variant-numeric: tabular-nums;
	text-align: center;
	white-space: nowrap;
}

/* Timeline */

.pfb-timeline {
	position: relative;
	display: flex;
	flex: 1 1 auto;
	align-items: center;
	min-width: 60px;
	height: 34px;
}

.pfb-range {
	display: block;
	width: 100%;
	height: 16px;
	margin: 0;
	padding: 0;
	background: transparent;
	cursor: pointer;
	-webkit-appearance: none;
	appearance: none;
}

.pfb-range:focus {
	outline: none;
}

.pfb-range::-webkit-slider-runnable-track {
	height: 2px;
	background: linear-gradient(to right, #fff var(--pfb-progress, 0%), rgba(255, 255, 255, 0.3) var(--pfb-progress, 0%));
	border-radius: 1px;
}

.pfb-range::-webkit-slider-thumb {
	width: 14px;
	height: 14px;
	margin-top: -6px;
	background: #fff;
	border: none;
	border-radius: 50%;
	-webkit-appearance: none;
	appearance: none;
}

.pfb-range::-moz-range-track {
	height: 2px;
	background: rgba(255, 255, 255, 0.3);
	border-radius: 1px;
}

.pfb-range::-moz-range-progress {
	height: 2px;
	background: #fff;
}

.pfb-range::-moz-range-thumb {
	width: 14px;
	height: 14px;
	background: #fff;
	border: none;
	border-radius: 50%;
}

.pfb-range:focus-visible::-webkit-slider-thumb {
	box-shadow: 0 0 0 4px rgba(255, 255, 255, 0.3);
}

.pfb-timeline-bubble {
	position: absolute;
	bottom: 100%;
	z-index: 7;
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 5px;
	margin-bottom: 8px;
	padding: 6px;
	background: rgba(20, 20, 20, 0.92);
	border-radius: 4px;
	transform: translateX(-50%);
	pointer-events: none;
	white-space: nowrap;
	font-size: 12px;
}

.pfb-timeline-bubble[hidden],
.pfb-timeline-thumb[hidden] {
	display: none;
}

.pfb-timeline-thumb {
	height: 96px;
	aspect-ratio: var(--pfb-ratio);
	background-color: rgba(255, 255, 255, 0.1);
	background-repeat: no-repeat;
}

/* Zoom bar */

.pfb-zoombar {
	position: absolute;
	top: 10px;
	left: 50%;
	z-index: 7;
	display: flex;
	align-items: center;
	gap: 2px;
	padding: 4px 8px;
	background: rgba(38, 38, 38, 0.92);
	border-radius: 4px;
	box-shadow: 0 4px 16px rgba(0, 0, 0, 0.25);
	transform: translateX(-50%);
}

.pfb-zoombar[hidden] {
	display: none;
}

.pfb-zb-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 30px;
	height: 30px;
	padding: 0;
	background: transparent;
	border: none;
	border-radius: 4px;
	color: rgba(255, 255, 255, 0.8);
	cursor: pointer;
	transition: color 0.15s ease, background 0.15s ease;
}

.pfb-zb-btn:hover,
.pfb-zb-btn:focus-visible {
	color: #fff;
	background: rgba(255, 255, 255, 0.1);
}

.pfb-zb-btn[aria-pressed="true"] {
	color: #fff;
	background: rgba(255, 255, 255, 0.16);
}

.pfb-zb-btn svg {
	width: 18px;
	height: 18px;
}

.pfb-zb-sep {
	width: 1px;
	height: 18px;
	margin: 0 6px;
	background: rgba(255, 255, 255, 0.15);
}

.pfb-zb-slider {
	position: relative;
	display: flex;
	align-items: center;
	width: 110px;
	margin: 0 4px;
}

.pfb-zb-value {
	position: absolute;
	top: 100%;
	margin-top: 8px;
	padding: 4px 7px;
	background: rgba(20, 20, 20, 0.95);
	border-radius: 3px;
	font-size: 12px;
	white-space: nowrap;
	transform: translateX(-50%);
	pointer-events: none;
	opacity: 0;
	transition: opacity 0.15s ease;
}

.pfb-zb-slider:hover .pfb-zb-value,
.pfb-zb-slider:focus-within .pfb-zb-value,
.pfb-zb-slider.is-active .pfb-zb-value {
	opacity: 1;
}

@media (hover: none) {
	/* "Follow cursor" needs a mouse. */
	.pfb-zb-follow {
		display: none;
	}
}

/* Thumbnail strip */

.pfb-thumbs {
	display: flex;
	flex: 0 0 auto;
	align-items: center;
	gap: 4px;
	padding: 10px 6px 6px;
	background: rgba(0, 0, 0, 0.25);
	border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.pfb-thumbs[hidden] {
	display: none;
}

.pfb-thumbs-track {
	position: relative;
	display: flex;
	flex: 1 1 auto;
	gap: 14px;
	padding: 4px;
	overflow-x: auto;
	overflow-y: hidden;
	scrollbar-width: none;
}

.pfb-thumbs-track::-webkit-scrollbar {
	display: none;
}

.pfb-thumbs-scroll {
	display: flex;
	flex: 0 0 auto;
	align-items: center;
	justify-content: center;
	width: 28px;
	height: 60px;
	padding: 0;
	background: transparent;
	border: none;
	color: rgba(255, 255, 255, 0.7);
	cursor: pointer;
}

.pfb-thumbs-scroll:hover {
	color: #fff;
}

.pfb-thumbs-scroll svg {
	width: 22px;
	height: 22px;
}

.pfb-thumb-group {
	display: flex;
	flex: 0 0 auto;
	flex-direction: column;
	align-items: center;
	gap: 5px;
	padding: 0;
	background: none;
	border: none;
	color: rgba(255, 255, 255, 0.6);
	font-size: 11px;
	cursor: pointer;
}

.pfb-thumb-pages {
	display: flex;
	outline: 2px solid transparent;
	outline-offset: 2px;
	border-radius: 1px;
	transition: outline-color 0.15s ease;
}

.pfb-thumb-group:hover .pfb-thumb-pages,
.pfb-thumb-group:focus-visible .pfb-thumb-pages {
	outline-color: rgba(255, 255, 255, 0.4);
}

.pfb-thumb-group.is-current {
	color: #fff;
}

.pfb-thumb-group.is-current .pfb-thumb-pages {
	outline-color: #fff;
}

.pfb-thumb {
	display: block;
	height: 84px;
	aspect-ratio: var(--pfb-ratio);
	background-color: rgba(255, 255, 255, 0.12);
	background-repeat: no-repeat;
}

/* Table of contents */

.pfb-toc {
	position: absolute;
	top: 12px;
	right: 12px;
	bottom: 12px;
	z-index: 8;
	display: flex;
	flex-direction: column;
	width: min(320px, calc(100% - 24px));
	background: rgba(38, 38, 38, 0.97);
	border-radius: 6px;
	box-shadow: 0 8px 30px rgba(0, 0, 0, 0.35);
	overflow: hidden;
}

.pfb-toc[hidden] {
	display: none;
}

.pfb-toc-header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 10px 8px 10px 16px;
	border-bottom: 1px solid rgba(255, 255, 255, 0.1);
	font-size: 14px;
	font-weight: 600;
}

.pfb-toc-title {
	display: flex;
	align-items: center;
	gap: 8px;
}

.pfb-toc-title svg {
	width: 18px;
	height: 18px;
}

.pfb-toc-close {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 30px;
	height: 30px;
	padding: 0;
	background: transparent;
	border: none;
	border-radius: 4px;
	color: rgba(255, 255, 255, 0.7);
	cursor: pointer;
}

.pfb-toc-close:hover {
	color: #fff;
	background: rgba(255, 255, 255, 0.1);
}

.pfb-toc-close svg {
	width: 18px;
	height: 18px;
}

.pfb-toc-list {
	flex: 1 1 auto;
	margin: 0;
	padding: 6px;
	list-style: none;
	overflow-y: auto;
}

.pfb-toc-list li {
	margin: 0;
	padding: 0;
}

.pfb-toc-item {
	display: flex;
	justify-content: space-between;
	gap: 12px;
	width: 100%;
	padding: 9px 10px;
	background: none;
	border: none;
	border-radius: 4px;
	color: rgba(255, 255, 255, 0.85);
	font-size: 13px;
	line-height: 1.35;
	text-align: left;
	cursor: pointer;
}

.pfb-toc-item:hover,
.pfb-toc-item:focus-visible {
	color: #fff;
	background: rgba(255, 255, 255, 0.08);
}

.pfb-toc-item.is-current {
	color: #fff;
	background: rgba(255, 255, 255, 0.14);
}

.pfb-toc-page {
	flex: 0 0 auto;
	opacity: 0.6;
	font-variant-numeric: tabular-nums;
}

/* Small screens */

@media (max-width: 600px) {
	.pfb-book-holder {
		padding: 6px 34px;
	}

	.pfb-side-nav {
		width: 30px;
	}

	.pfb-side-nav svg {
		width: 28px;
		height: 28px;
	}

	.pfb-side-nav.pfb-prev {
		left: 2px;
	}

	.pfb-side-nav.pfb-next {
		right: 2px;
	}

	.pfb-side-nav.pfb-first,
	.pfb-side-nav.pfb-last {
		display: none;
	}

	.pfb-zoombar {
		padding: 3px 4px;
	}

	.pfb-zb-slider {
		width: 80px;
	}

	.pfb-zb-sep {
		margin: 0 2px;
	}

	.pfb-toolbar {
		gap: 8px;
		padding: 6px 8px;
	}

	.pfb-page-indicator {
		min-width: 0;
		font-size: 12px;
	}

	.pfb-thumb {
		height: 64px;
	}
}
