.cm-flipbook {
	background: radial-gradient(circle at top, var(--cm-base), var(--cm-base-ultra-dark) 68%);
	border-radius: 22px;
	padding: 22px;
	box-shadow: 0 24px 50px var(--cm-overlay-strong, rgba(18, 28, 43, 0.24));
	overflow: hidden;
	position: relative;
	color: var(--cm-white, #fff);
}

.cm-embedpdf {
	position: relative;
}

.cm-embedpdf__toolbar {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 16px;
	padding: 14px 16px;
	margin-bottom: 16px;
	background: var(--cm-white-alpha-42, rgba(7, 16, 31, 0.42));
	border: 1px solid var(--cm-white-alpha-12, rgba(255, 255, 255, 0.12));
	border-radius: 16px;
	color: var(--cm-white, #fff);
}

.cm-embedpdf__title {
	font-size: 15px;
	font-weight: 700;
	min-width: 0;
}

.cm-embedpdf__download {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 10px;
	min-width: 42px;
	height: 40px;
	padding: 0 14px;
	border: 0;
	border-radius: 12px;
	background: var(--cm-white-alpha-14, rgba(255, 255, 255, 0.14));
	color: var(--cm-white, #fff);
	cursor: pointer;
	font-size: 14px;
	font-weight: 700;
	text-decoration: none;
	transition: background 0.2s ease, transform 0.2s ease;
}

.cm-embedpdf__download:hover,
.cm-embedpdf__download:focus-visible {
	background: var(--cm-white-alpha-22, rgba(255, 255, 255, 0.22));
	transform: translateY(-1px);
}

.cm-embedpdf__download-icon {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 18px;
	height: 18px;
}

.cm-embedpdf__download-icon svg {
	display: block;
	width: 18px;
	height: 18px;
}

.cm-embedpdf__download-text {
	white-space: nowrap;
}

.cm-embedpdf__viewer {
	border-radius: 22px;
	overflow: hidden;
	box-shadow: 0 24px 50px var(--cm-overlay-strong, rgba(18, 28, 43, 0.24));
	background: var(--cm-base-ultra-dark, #111827);
}

.cm-embedpdf__viewer[hidden],
.cm-embedpdf__fallback[hidden] {
	display: none;
}

.cm-embedpdf__fallback {
	margin-top: 16px;
}

.cm-embedpdf__fallback--visible {
	display: block;
}

.cm-embedpdf__error {
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 14px;
	min-height: 220px;
	padding: 28px 20px;
	background: var(--cm-white-alpha-08, rgba(255, 255, 255, 0.08));
	border: 1px solid var(--cm-white-alpha-12, rgba(255, 255, 255, 0.12));
	border-radius: 18px;
	color: var(--cm-white, #fff);
	text-align: center;
}

.cm-embedpdf__error p {
	margin: 0;
	max-width: 520px;
	color: var(--cm-white-alpha-78, rgba(255, 255, 255, 0.78));
}

.cm-flipbook__stage {
	margin-bottom: 16px;
	display: flex;
	justify-content: center;
	align-items: center;
	min-height: 70vh;
	max-height: 70vh;
	overflow: hidden;
}

.cm-flipbook__loading,
.cm-flipbook__error {
	display: flex;
	align-items: center;
	justify-content: center;
	min-height: 420px;
	color: var(--cm-white, #fff);
	font-size: 18px;
	font-weight: 600;
}

.cm-flipbook__error a {
	color: var(--cm-white, #fff);
}

.cm-flipbook__book {
	margin: 0 auto;
	width: 100%;
}

.cm-flipbook__single-page {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 100%;
	height: 100%;
}

.cm-flipbook.is-zoomed .cm-flipbook__single-page {
	width: max-content;
	min-width: 100%;
	height: auto;
	justify-content: flex-start;
	align-items: flex-start;
}

.cm-flipbook__single-page.is-animating.is-next {
	animation: cm-page-fade-next 0.38s ease;
}

.cm-flipbook__single-page.is-animating.is-prev {
	animation: cm-page-fade-prev 0.38s ease;
}

.cm-flipbook__page {
	background: linear-gradient(180deg, var(--cm-white, #ffffff), var(--cm-surface-alt, #f4f7fb));
	border-radius: 8px;
	overflow: hidden;
}

.cm-flipbook__page canvas {
	display: block;
	width: 100%;
	height: auto;
}

.cm-flipbook__page-image {
	display: block;
	width: auto;
	max-width: 100%;
	max-height: 70vh;
	height: auto;
	margin: 0 auto;
	box-shadow: 0 16px 40px var(--cm-black-alpha-18, rgba(0, 0, 0, 0.18));
	border-radius: 8px;
	background: #ffffff;
}

@keyframes cm-page-fade-next {
	0% {
		opacity: 0;
		transform: translateX(24px) scale(0.985);
	}
	100% {
		opacity: 1;
		transform: translateX(0) scale(1);
	}
}

@keyframes cm-page-fade-prev {
	0% {
		opacity: 0;
		transform: translateX(-24px) scale(0.985);
	}
	100% {
		opacity: 1;
		transform: translateX(0) scale(1);
	}
}

.cm-flipbook__controls {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 16px;
	padding: 14px 16px;
	background: var(--cm-white-alpha-42, rgba(7, 16, 31, 0.42));
	border: 1px solid var(--cm-white-alpha-12, rgba(255, 255, 255, 0.12));
	border-radius: 16px;
	color: var(--cm-white, #fff);
}

.cm-flipbook__meta {
	display: flex;
	flex-direction: column;
	gap: 4px;
	min-width: 0;
}

.cm-flipbook__title {
	font-size: 15px;
	font-weight: 700;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

.cm-flipbook__counter {
	color: var(--cm-white-alpha-78, rgba(255, 255, 255, 0.78));
	font-size: 13px;
}

.cm-flipbook__actions {
	display: flex;
	flex-wrap: wrap;
	justify-content: flex-end;
	gap: 8px;
}

.cm-flipbook.is-single-view .cm-flipbook__stage {
	justify-content: center;
}

.cm-flipbook.is-single-view .cm-flipbook__book {
	margin-left: auto;
	margin-right: auto;
}

.cm-flipbook__button {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-width: 42px;
	height: 40px;
	padding: 0 14px;
	border: 0;
	border-radius: 12px;
	background: var(--cm-white-alpha-14, rgba(255, 255, 255, 0.14));
	color: var(--cm-white, #fff);
	cursor: pointer;
	font-size: 15px;
	font-weight: 700;
	text-decoration: none;
	transition: background 0.2s ease, transform 0.2s ease;
}

.cm-flipbook__button--floating {
	position: absolute;
	top: 16px;
	right: 16px;
	z-index: 3;
	background: var(--cm-white-alpha-42, rgba(7, 16, 31, 0.42));
	border: 1px solid var(--cm-white-alpha-12, rgba(255, 255, 255, 0.12));
}

.cm-flipbook__button svg {
	display: block;
	width: 18px;
	height: 18px;
}

.cm-flipbook__button:hover {
	background: var(--cm-white-alpha-22, rgba(255, 255, 255, 0.22));
	transform: translateY(-1px);
}

.cm-flipbook.is-fullscreen {
	border-radius: 0;
	padding: 18px;
}

.cm-flipbook.is-fullscreen .cm-flipbook__stage {
	min-height: calc(100dvh - 136px);
	max-height: calc(100dvh - 136px);
}

.cm-flipbook.is-fullscreen .cm-flipbook__page-image {
	max-height: calc(100dvh - 136px);
}

.cm-flipbook__button.is-link {
	font-size: 0;
}

@media (max-width: 767px) {
	.cm-flipbook {
		border-radius: 18px;
		padding: 12px;
	}

	.cm-embedpdf {
		padding: 0;
	}

	.cm-embedpdf__viewer {
		border-radius: 18px;
		height: min(72dvh, calc((100vw - 24px) * 1.42)) !important;
	}

	.cm-embedpdf__toolbar {
		flex-direction: column;
		align-items: stretch;
		padding: 12px;
	}

	.cm-embedpdf__download {
		width: 100%;
	}

	.cm-flipbook__loading,
	.cm-flipbook__error {
		min-height: 280px;
		font-size: 15px;
	}

	.cm-flipbook__stage {
		min-height: min(56dvh, 560px);
		max-height: calc(100dvh - 190px);
		margin-bottom: 12px;
	}

	.cm-flipbook__page-image {
		width: auto;
		max-width: 100%;
		max-height: calc(100dvh - 190px);
	}

	.cm-flipbook__controls {
		flex-direction: column;
		align-items: stretch;
		padding: 12px;
	}

	.cm-flipbook__actions {
		display: grid;
		grid-template-columns: repeat(5, minmax(0, 1fr));
		justify-content: stretch;
		width: 100%;
		gap: 6px;
		padding-bottom: 0;
	}

	.cm-flipbook__meta {
		align-items: center;
		text-align: center;
	}

	.cm-flipbook__button {
		min-width: 0;
		width: 100%;
		height: 34px;
		padding: 0;
	}

	.cm-flipbook__button svg {
		width: 16px;
		height: 16px;
	}

	.cm-flipbook__button--floating {
		top: 12px;
		right: 12px;
		width: 40px;
	}

	.cm-flipbook.is-fullscreen {
		padding: 10px;
	}

	.cm-flipbook.is-fullscreen .cm-flipbook__stage {
		min-height: calc(100dvh - 160px);
		max-height: calc(100dvh - 160px);
	}

	.cm-flipbook.is-fullscreen .cm-flipbook__page-image {
		max-height: calc(100dvh - 160px);
	}
}
