/* ==========================================================================
   PSYGUILD BOOK READER - PREMIUM 3D BOOK INTERFACE CSS (OPTIMIZED V2)
   ========================================================================== */

/* Khống chế chiều cao Wrapper khít màn hình (Viewport-Fit) */
.pg-book-layout-wrapper {
	width: 100%;
	height: calc(100vh - var(--pg-header-height, 80px));
	padding: 0;
	background: 
		radial-gradient(circle at 70% 10%, rgba(18, 199, 244, 0.08), transparent 32%),
		linear-gradient(180deg, #f5fbff, #eefaff);
	transition: background 0.4s ease, color 0.4s ease;
	display: flex;
	align-items: center;
	justify-content: center;
	position: relative;
	overflow: hidden;
}

@media screen and (max-width: 0px) {
	/* Theme consistency patch: keep the reader UI tied to shared PsyGuild tokens. */
	.pg-book-layout-wrapper {
		--pg-book-ui-surface: rgba(255, 255, 255, 0.92);
		--pg-book-ui-surface-soft: rgba(255, 255, 255, 0.72);
		--pg-book-ui-surface-strong: rgba(255, 255, 255, 0.98);
		--pg-book-ui-text: var(--pg-text, #1e293b);
		--pg-book-ui-muted: var(--pg-muted, #475569);
		--pg-book-ui-border: var(--pg-border, rgba(28, 36, 52, 0.10));
		--pg-book-ui-border-strong: var(--pg-border-strong, rgba(28, 36, 52, 0.16));
		--pg-book-stage-bg: rgba(255, 255, 255, 0.46);
		--pg-book-stage-border: rgba(18, 199, 244, 0.12);
		--pg-book-stage-shadow: inset 0 0 40px rgba(18, 199, 244, 0.03), 0 12px 34px rgba(15, 23, 42, 0.04);
		--pg-book-paper-glow: rgba(255, 255, 255, 0.92);
		--pg-book-paper-bg-end: #fffaf0;
		--pg-book-page-border: rgba(16, 24, 40, 0.07);
		--pg-book-footer-text: #667085;
		--pg-book-cover-badge-bg: rgba(18, 199, 244, 0.10);
		--pg-book-cover-badge-text: #0f7490;
		--pg-book-cover-badge-border: rgba(18, 199, 244, 0.18);
		background:
			radial-gradient(circle at 70% 10%, rgba(18, 199, 244, 0.08), transparent 32%),
			linear-gradient(180deg, var(--pg-bg, #f4f8fc), #eefaff);
		color: var(--pg-book-ui-text);
		color-scheme: light;
	}

	body.pg-theme-dark .pg-book-layout-wrapper {
		--pg-book-ui-surface: rgba(15, 23, 42, 0.84);
		--pg-book-ui-surface-soft: rgba(15, 23, 42, 0.68);
		--pg-book-ui-surface-strong: rgba(15, 23, 42, 0.96);
		--pg-book-ui-text: var(--pg-text, #ffffff);
		--pg-book-ui-muted: var(--pg-muted, rgba(255, 255, 255, 0.74));
		--pg-book-ui-border: rgba(255, 255, 255, 0.14);
		--pg-book-ui-border-strong: rgba(255, 255, 255, 0.24);
		--pg-book-stage-bg: rgba(15, 23, 42, 0.42);
		--pg-book-stage-border: rgba(18, 199, 244, 0.16);
		--pg-book-stage-shadow: inset 0 0 42px rgba(18, 199, 244, 0.06), 0 16px 42px rgba(0, 0, 0, 0.22);
		background:
			radial-gradient(circle at 70% 10%, rgba(18, 199, 244, 0.12), transparent 34%),
			linear-gradient(180deg, #07111f, #020617);
		color-scheme: dark;
	}

	.pg-book-layout-wrapper.book-theme-light {
		--book-paper-bg: #fffdf7;
		--book-paper-text: #201a15;
		--book-paper-text-title: #151923;
		--book-paper-text-quote: #3f352d;
		--book-muted: #667085;
		--book-line: rgba(17, 24, 39, 0.12);
		--pg-book-paper-glow: rgba(255, 255, 255, 0.94);
		--pg-book-paper-bg-end: #fff7e8;
		--pg-book-page-border: rgba(16, 24, 40, 0.07);
		--pg-book-footer-text: #667085;
		--pg-book-cover-badge-bg: rgba(18, 199, 244, 0.10);
		--pg-book-cover-badge-text: #0f7490;
		--pg-book-cover-badge-border: rgba(18, 199, 244, 0.18);
	}

	.pg-book-layout-wrapper.book-theme-dark {
		--book-paper-bg: #18202c;
		--book-paper-text: #e2e8f0;
		--book-paper-text-title: #f8fafc;
		--book-paper-text-quote: #cbd5e1;
		--book-muted: rgba(226, 232, 240, 0.72);
		--book-line: rgba(255, 255, 255, 0.14);
		--book-accent-soft: rgba(18, 199, 244, 0.12);
		--book-purple-soft: rgba(122, 92, 255, 0.14);
		--pg-book-paper-glow: rgba(255, 255, 255, 0.05);
		--pg-book-paper-bg-end: #111827;
		--pg-book-page-border: rgba(255, 255, 255, 0.10);
		--pg-book-footer-text: rgba(226, 232, 240, 0.70);
		--pg-book-cover-badge-bg: rgba(18, 199, 244, 0.14);
		--pg-book-cover-badge-text: #a5f3fc;
		--pg-book-cover-badge-border: rgba(18, 199, 244, 0.24);
	}

	.pg-book-layout-wrapper.book-theme-night {
		--book-paper-bg: #090c10;
		--book-paper-text: #cbd5e1;
		--book-paper-text-title: #f8fafc;
		--book-paper-text-quote: #aab7c8;
		--book-muted: rgba(203, 213, 225, 0.68);
		--book-line: rgba(255, 255, 255, 0.12);
		--book-accent-soft: rgba(18, 199, 244, 0.10);
		--book-purple-soft: rgba(122, 92, 255, 0.12);
		--pg-book-paper-glow: rgba(255, 255, 255, 0.035);
		--pg-book-paper-bg-end: #05070a;
		--pg-book-page-border: rgba(255, 255, 255, 0.08);
		--pg-book-footer-text: rgba(203, 213, 225, 0.64);
		--pg-book-cover-badge-bg: rgba(18, 199, 244, 0.12);
		--pg-book-cover-badge-text: #8eeeff;
		--pg-book-cover-badge-border: rgba(18, 199, 244, 0.20);
	}

	.pg-book-layout-wrapper .pg-book-stage {
		background: var(--pg-book-stage-bg) !important;
		border-color: var(--pg-book-stage-border) !important;
		box-shadow: var(--pg-book-stage-shadow) !important;
	}

	.pg-book-sidebar .pg-card,
	.pg-book-related-card,
	.pg-book-quick-toc-dropdown,
	.pg-book-toolbar-inner {
		background: var(--pg-book-ui-surface) !important;
		border-color: var(--pg-book-ui-border) !important;
		color: var(--pg-book-ui-text) !important;
		box-shadow: var(--pg-shadow-soft, 0 18px 55px rgba(15, 23, 42, 0.08)) !important;
	}

	.pg-book-card-title,
	.pg-book-meta-author-name,
	.pg-book-toc-title,
	.pg-book-tools-title,
	.pg-book-related-title,
	.pg-book-related-card-title a,
	.pg-book-related-card-author span,
	.pg-book-quick-toc-header {
		color: var(--pg-book-ui-text) !important;
		overflow-wrap: anywhere;
	}

	.pg-book-meta-author-desc,
	.pg-book-meta-detail-item,
	.pg-book-tool-label,
	.pg-book-toc-item,
	.pg-book-related-card-excerpt,
	.pg-book-related-card-date,
	.pg-book-related-empty,
	.pg-book-quick-toc-close,
	.pg-book-quick-toc-item,
	.pg-book-quick-toc-page-num,
	.pg-book-sidebar-progress-label,
	.pg-book-progress-label {
		color: var(--pg-book-ui-muted) !important;
	}

	.pg-book-meta-author-link,
	.pg-book-sidebar-progress,
	.pg-book-related-card-footer,
	.pg-book-related-card-media,
	.pg-book-toolbar-actions {
		border-color: var(--pg-book-ui-border) !important;
	}

	.pg-book-btn-group,
	.pg-book-tool-btn-full,
	.pg-book-toolbar-action-btn,
	.pg-book-mobile-left-btn {
		background: var(--pg-book-ui-surface-soft) !important;
		border-color: var(--pg-book-ui-border) !important;
		color: var(--pg-book-ui-text) !important;
	}

	.pg-book-tool-btn {
		color: var(--pg-book-ui-muted) !important;
	}

	.pg-book-tool-btn:hover,
	.pg-book-tool-btn.is-active,
	.pg-book-toolbar-action-btn:hover,
	.pg-book-toolbar-action-btn.is-active,
	.pg-book-quick-toc-item:hover,
	.pg-book-quick-toc-item.is-active {
		background: var(--pg-book-ui-surface-strong) !important;
		color: var(--pg-primary, #00d4ff) !important;
	}

	.pg-book-tool-btn-full:hover,
	.pg-book-mobile-left-btn:hover,
	.pg-book-mobile-left-btn:active {
		background: var(--pg-gradient, linear-gradient(135deg, #00d4ff, #a855f7)) !important;
		border-color: transparent !important;
		color: #ffffff !important;
	}

	.pg-book-layout-wrapper .pg-book-pages-wrap {
		background: var(--book-paper-bg, #fffdf7) !important;
	}

	.pg-book-layout-wrapper .pg-book-page {
		background:
			radial-gradient(circle at 50% 12%, var(--pg-book-paper-glow), transparent 36%),
			linear-gradient(180deg, var(--book-paper-bg, #fffdf7), var(--pg-book-paper-bg-end, var(--book-paper-bg, #fffdf7))) !important;
		border-color: var(--pg-book-page-border) !important;
		color: var(--book-paper-text, #201a15) !important;
	}

	.pg-book-layout-wrapper .pg-book-page-content,
	.pg-book-layout-wrapper .pg-book-page-content p,
	.pg-book-layout-wrapper .pg-book-page-content li,
	.pg-book-layout-wrapper .pg-book-page-content td,
	.pg-book-layout-wrapper .pg-book-page-content th {
		color: var(--book-paper-text, #201a15);
	}

	.pg-book-layout-wrapper .pg-book-page-footer {
		color: var(--pg-book-footer-text) !important;
		border-top-color: var(--pg-book-page-border) !important;
		text-shadow: none !important;
	}

	.pg-book-cover-logo,
	.pg-book-page-content a {
		color: var(--pg-primary, #00d4ff) !important;
	}

	.pg-book-cover-series-badge {
		max-width: 100%;
		white-space: normal;
		color: var(--pg-book-cover-badge-text) !important;
		background: var(--pg-book-cover-badge-bg) !important;
		border-color: var(--pg-book-cover-badge-border) !important;
		text-shadow: none !important;
		overflow-wrap: anywhere;
	}

	.pg-book-cover-divider,
	.pg-book-cover-meta-time,
	.pg-book-cover-author-meta,
	.pg-book-img-caption,
	.pg-book-page-content figcaption,
	.pg-book-page-content .wp-element-caption {
		color: var(--pg-book-footer-text) !important;
	}

	.pg-book-cover-title,
	.pg-book-cover-author-name,
	.pg-book-page-content .book-heading--h2,
	.pg-book-page-content .book-heading--h3,
	.pg-book-page-content .book-heading--h4,
	.pg-book-page-content .book-heading--h5,
	.pg-book-page-content .book-heading--h6 {
		color: var(--book-paper-text-title, #151923) !important;
		overflow-wrap: anywhere;
	}

	.pg-book-cover-quote,
	.pg-book-page-content blockquote {
		color: var(--book-paper-text-quote, #3f352d) !important;
		border-color: var(--pg-book-cover-badge-border, rgba(18, 199, 244, 0.20)) !important;
		background: linear-gradient(135deg, var(--book-accent-soft, rgba(17, 199, 243, 0.10)), var(--book-purple-soft, rgba(122, 92, 255, 0.10))) !important;
	}

	.book-table-wrap,
	.pg-book-page-content pre {
		border-color: var(--book-line, rgba(17, 24, 39, 0.12)) !important;
		background: color-mix(in srgb, var(--book-paper-bg, #fffdf7) 82%, var(--book-cyan, #11c7f3) 18%) !important;
	}

	.pg-book-page-content table,
	.pg-book-page-content th,
	.pg-book-page-content td {
		color: var(--book-paper-text, #201a15) !important;
		border-color: var(--book-line, rgba(17, 24, 39, 0.12)) !important;
	}

	.reader-audio-controls--book .reader-audio-btn {
		color: var(--pg-book-ui-text) !important;
		background: linear-gradient(135deg, rgba(18, 199, 244, 0.12), rgba(122, 92, 255, 0.12)) !important;
		border-color: var(--pg-book-ui-border) !important;
	}

	.reader-audio-controls--book .reader-audio-btn.is-playing,
	.reader-audio-controls--book .reader-audio-btn.is-paused {
		color: #ffffff !important;
		background: var(--pg-gradient, linear-gradient(135deg, #00d4ff, #a855f7)) !important;
		border-color: transparent !important;
	}

	.reader-audio-controls--book .reader-audio-btn:disabled {
		color: var(--pg-book-ui-muted) !important;
		background: var(--pg-book-ui-surface-soft) !important;
	}

	@media (max-width: 1024px) {
		.pg-book-layout-wrapper .pg-book-stage {
			background: transparent !important;
			border-color: transparent !important;
			box-shadow: none !important;
		}

		.pg-book-cover-title,
		.pg-book-page-content .book-heading,
		.pg-book-page-content p,
		.pg-book-page-content li {
			overflow-wrap: anywhere;
			word-break: normal;
		}
	}
}

@media screen and (min-width: 1025px) {
	.pg-book-layout-inner {
		grid-template-columns: clamp(280px, 24vw, 340px) minmax(0, 1fr);
		gap: clamp(1rem, 2vw, 2rem);
		max-width: min(var(--pg-container, 1280px), calc(100vw - 2rem));
	}

	.pg-book-stage,
	.pg-book-stage-inner {
		min-width: 0;
		max-width: 100%;
	}

	.pg-book-stage {
		padding: clamp(1rem, 1.6vw, 1.5rem);
	}

	.pg-book-stage-inner {
		width: 100%;
	}

	.pg-book-container {
		width: min(100%, 900px, calc((100vh - var(--pg-header-height, 80px) - 4rem) * 900 / 590));
		height: auto;
		aspect-ratio: 900 / 590;
		max-height: none;
	}
}

@media screen and (min-width: 1025px) and (max-width: 1180px) {
	.pg-book-layout-inner {
		grid-template-columns: minmax(260px, 300px) minmax(0, 1fr);
		padding-inline: 1rem;
	}
}

.pg-book-layout-inner {
	display: grid;
	grid-template-columns: 340px 1fr;
	gap: 2rem;
	width: 100%;
	height: 100%;
	max-width: var(--pg-container, 1280px);
	margin: 0 auto;
	padding: 0 1.5rem;
	align-items: center;
	box-sizing: border-box;
}

/* Sidebar Card Style: Đồng bộ Soft Card của PsyGuild */
.pg-book-sidebar .pg-card {
	background: #ffffff !important;
	border: 1px solid rgba(16, 24, 40, 0.08) !important;
	border-radius: 24px !important;
	box-shadow: 0 16px 40px rgba(15, 23, 42, 0.04) !important;
	padding: 1.5rem !important;
	overflow: hidden;
	flex-shrink: 0 !important; /* Ngăn trình duyệt co chiều cao làm cắt card */
	transition: all 0.3s ease;
	box-sizing: border-box;
}

/* Riêng pg-book-card-info padding 0 để ảnh tràn viền ở phía trên */
.pg-book-sidebar .pg-book-card-info {
	padding: 0 !important;
}

/* ==========================================================================
   CỘT TRÁI: SIDEBAR CÔNG CỤ & MỤC LỤC (CUỘN ĐỘC LẬP)
   ========================================================================== */
.pg-book-sidebar {
	width: 100%;
	height: 100%;
	display: flex;
	align-items: center;
}

.pg-book-sidebar-sticky {
	width: 100%;
	display: flex;
	flex-direction: column;
	gap: 1.25rem;
	max-height: calc(100vh - var(--pg-header-height, 80px) - 3rem);
	overflow-y: auto;
	padding-right: 0.5rem;
	box-sizing: border-box;
}

/* Tùy chỉnh thanh cuộn sidebar */
.pg-book-sidebar-sticky::-webkit-scrollbar {
	width: 5px;
}
.pg-book-sidebar-sticky::-webkit-scrollbar-track {
	background: transparent;
}
.pg-book-sidebar-sticky::-webkit-scrollbar-thumb {
	background: var(--pg-border-strong);
	border-radius: 99px;
}

/* Thẻ Card tiện ích kính mờ */
.pg-book-sidebar .pg-card {
	background: var(--pg-surface);
	border: 1px solid var(--pg-border);
	border-radius: var(--pg-radius-lg, 1rem);
	padding: 1.25rem;
	box-shadow: var(--pg-shadow-soft);
	backdrop-filter: blur(20px);
	-webkit-backdrop-filter: blur(20px);
	transition: background 0.3s ease, border-color 0.3s ease;
}

/* Card Thông tin Bài viết */
.pg-book-card-info {
	padding: 0 !important;
	overflow: hidden;
	clip-path: inset(0 round var(--pg-radius-lg, 1rem));
}

.pg-book-card-media {
	width: 100%;
	aspect-ratio: 16/9;
	overflow: hidden;
}

.pg-book-card-media img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	transition: transform 0.5s ease;
}

.pg-book-card-info:hover .pg-book-card-media img {
	transform: scale(1.04);
}

.pg-book-card-body {
	padding: 1.25rem;
}

.pg-book-badge-cat {
	display: inline-block;
	font-size: 0.7rem;
	font-weight: 700;
	text-transform: uppercase;
	color: var(--pg-primary);
	background: rgba(var(--pg-primary-rgb, 62, 123, 250), 0.08);
	padding: 0.3rem 0.65rem;
	border-radius: 99px;
	margin-bottom: 0.5rem;
	letter-spacing: 0.05em;
}

.pg-book-card-title {
	font-size: 1.15rem;
	font-weight: 800;
	line-height: 1.35;
	color: var(--pg-text);
	margin-bottom: 0.75rem;
}

/* Tác giả */
.pg-book-meta-author-link {
	display: flex;
	align-items: center;
	gap: 0.65rem;
	text-decoration: none !important;
	margin-bottom: 1rem;
	padding-bottom: 1rem;
	border-bottom: 1px solid var(--pg-border);
}

.pg-book-meta-avatar {
	width: 38px;
	height: 38px;
	border-radius: 50%;
	object-fit: cover;
	border: 2px solid var(--pg-primary);
}

.pg-book-meta-author-info {
	display: flex;
	flex-direction: column;
	gap: 0.1rem;
}

.pg-book-meta-author-name {
	font-size: 0.85rem;
	font-weight: 700;
	color: var(--pg-text);
}

.pg-book-meta-author-desc {
	font-size: 0.7rem;
	color: var(--pg-muted);
}

/* Meta Details */
.pg-book-meta-details {
	display: flex;
	flex-direction: column;
	gap: 0.4rem;
}

.pg-book-meta-detail-item {
	font-size: 0.775rem;
	color: var(--pg-muted);
	display: flex;
	align-items: center;
	gap: 0.35rem;
}

/* Timeline Mục lục (ToC) */
.pg-book-toc-title,
.pg-book-tools-title {
	font-size: 0.9rem;
	font-weight: 800;
	text-transform: uppercase;
	letter-spacing: 0.05em;
	color: var(--pg-text);
	margin-bottom: 1rem;
	padding-bottom: 0.4rem;
	border-bottom: 2px solid var(--pg-border-strong);
	width: fit-content;
}

.pg-book-toc-timeline {
	display: flex;
	flex-direction: column;
	position: relative;
	padding-left: 1.25rem;
	max-height: 240px;
	overflow-y: auto;
}

.pg-book-toc-timeline::before {
	content: '';
	position: absolute;
	left: 3px;
	top: 6px;
	bottom: 6px;
	width: 2px;
	background: var(--pg-border-strong);
}

.pg-book-toc-item {
	position: relative;
	padding-bottom: 0.85rem;
	font-size: 0.825rem;
	font-weight: 600;
	color: var(--pg-muted);
	cursor: pointer;
	transition: color 0.3s ease;
	line-height: 1.35;
	display: block;
}

.pg-book-toc-item:last-child {
	padding-bottom: 0;
}

.pg-book-toc-item::before {
	content: '';
	position: absolute;
	left: -1.25rem;
	left: calc(-1.25rem + 1px);
	top: 5px;
	width: 6px;
	height: 6px;
	border-radius: 50%;
	background: var(--pg-muted);
	border: 1px solid var(--pg-bg);
	transition: all 0.3s ease;
}

.pg-book-toc-item:hover {
	color: var(--pg-primary);
}

.pg-book-toc-item.is-active {
	color: var(--pg-primary);
	font-weight: 700;
}

.pg-book-toc-item.is-active::before {
	background: var(--pg-primary);
	box-shadow: 0 0 0 3px rgba(var(--pg-primary-rgb, 62, 123, 250), 0.24);
	width: 8px;
	height: 8px;
	left: calc(-1.25rem);
	top: 4px;
}

/* Bộ công cụ đọc sách */
.pg-book-tools-group {
	display: flex;
	flex-direction: column;
	gap: 1rem;
}

.pg-book-tool-item {
	display: flex;
	flex-direction: column;
	gap: 0.4rem;
}

.pg-book-tool-label {
	font-size: 0.725rem;
	font-weight: 700;
	text-transform: uppercase;
	color: var(--pg-muted);
}

.pg-book-btn-group {
	display: flex;
	background: var(--pg-bg-soft);
	border: 1px solid var(--pg-border);
	border-radius: 0.5rem;
	padding: 0.2rem;
	width: 100%;
}

.pg-book-tool-btn {
	flex: 1;
	border: none;
	background: transparent;
	padding: 0.4rem 0.5rem;
	font-size: 0.775rem;
	font-weight: 700;
	color: var(--pg-muted);
	border-radius: 0.35rem;
	cursor: pointer;
	transition: all 0.2s ease;
	text-align: center;
}

.pg-book-tool-btn:hover {
	color: var(--pg-text);
}

.pg-book-tool-btn.is-active {
	background: var(--pg-surface);
	color: var(--pg-primary);
	box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.pg-book-tool-btn-full {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 0.5rem;
	width: 100%;
	border: 1px solid var(--pg-border);
	background: var(--pg-bg-soft);
	color: var(--pg-text);
	padding: 0.55rem;
	font-size: 0.8rem;
	font-weight: 700;
	border-radius: 0.5rem;
	cursor: pointer;
	transition: all 0.25s ease;
}

.pg-book-tool-btn-full:hover {
	background: var(--pg-primary);
	color: #fff !important;
	border-color: var(--pg-primary);
	box-shadow: 0 4px 12px rgba(var(--pg-primary-rgb, 62, 123, 250), 0.2);
}

/* ==========================================================================
   CỘT PHẢI: QUYỂN SÁCH 3D STAGE (VIỀN TRANG GIẤY CHỒNG PREMIUM)
   ========================================================================== */
.pg-book-stage {
	width: 100%;
	height: 100%;
	display: flex;
	justify-content: center;
	align-items: center;
	position: relative;
	box-sizing: border-box;
	background: rgba(255, 255, 255, 0.42); /* Nền trắng mờ cao cấp */
	border: 1px solid rgba(18, 199, 244, 0.10); /* Viền cyan nhạt mờ */
	border-radius: 32px; /* Bo tròn lớn theo mockup */
	padding: 2rem;
	backdrop-filter: blur(12px); /* Blur kính mờ nhẹ */
	-webkit-backdrop-filter: blur(12px);
	box-shadow: inset 0 0 40px rgba(18, 199, 244, 0.02), 0 8px 32px rgba(15, 23, 42, 0.02);
}

.pg-book-stage-inner {
	width: 100%;
	max-width: 920px;
	height: 100%;
	display: flex;
	flex-direction: column;
	justify-content: center;
	align-items: center;
	position: relative;
	padding: 2rem 0;
	box-sizing: border-box;
}

.pg-book-container {
	position: relative;
	height: calc(100vh - var(--pg-header-height, 80px) - 4rem);
	max-height: 620px;
	width: calc((100vh - var(--pg-header-height, 80px) - 4rem) * 900 / 590);
	max-width: 900px;
	aspect-ratio: 900/590;
	perspective: 2000px;
	user-select: none;
	-webkit-user-select: none;
	z-index: 10;
}

/* Bìa da cứng quyển sách bao ngoài */
.pg-book-el {
	position: absolute;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	background: #0a1931; /* Bìa xanh navy Premium nhã nhặn của PsyGuild Reader */
	border-radius: 24px; /* Tăng bo góc mềm mại tinh tế theo mockup */
	box-shadow: 
		0 28px 80px rgba(15, 23, 42, 0.16), /* Shadow cực mềm của PsyGuild */
		0 10px 30px rgba(15, 23, 42, 0.08),
		inset 0 0 0 1px rgba(255, 255, 255, 0.08);
	padding: 8px 12px 12px 12px; /* Chừa lề viền bìa cứng mỏng tinh tế */
	box-sizing: border-box;
	display: flex;
	transition: transform 0.3s ease;
	transform-style: preserve-3d;
	z-index: 5;
}

/* Các lớp viền trang giấy chồng (Page Stack Effect) tạo độ dày thật */
.pg-book-paper-stack {
	position: absolute;
	top: 10px;
	bottom: 14px;
	width: calc(50% - 14px);
	background: #fffefc;
	border-radius: 4px;
	z-index: 2;
	pointer-events: none;
	border: 1px solid rgba(16, 24, 40, 0.05);
	box-sizing: border-box;
}

.pg-book-paper-stack.is-left {
	left: 14px;
	transform-origin: right center;
	box-shadow: 
		-2px 2px 0 #fffefb,
		-4px 4px 0 #fffaf0,
		-6px 6px 0 #f5f8fc,
		-8px 8px 12px rgba(15, 23, 42, 0.08);
	border-right: none;
	border-radius: 6px 0 0 6px;
}

.pg-book-paper-stack.is-right {
	right: 14px;
	transform-origin: left center;
	box-shadow: 
		2px 2px 0 #fffefb,
		4px 4px 0 #fffaf0,
		6px 6px 0 #f5f8fc,
		8px 8px 12px rgba(15, 23, 42, 0.08);
	border-left: none;
	border-radius: 0 6px 6px 0;
}

/* ==========================================================================
   CÁC TRANG GIẤY SÁCH (PAPER STYLE & SHADOWS)
   ========================================================================== */
.pg-book-pages-wrap {
	position: relative;
	width: 100%;
	height: 100%;
	background: #fdfbf7; /* Màu trắng ngà dịu mắt, không trắng gắt */
	border-radius: 6px;
	box-shadow: inset 0 0 30px rgba(0, 0, 0, 0.05);
	transform-style: preserve-3d;
	z-index: 10;
}

/* Gáy sách ở giữa (Spine) sâu và cong mịn */
.pg-book-pages-wrap::after {
	content: '';
	position: absolute;
	left: 50%;
	top: 0;
	bottom: 0;
	width: 26px; /* Thu hẹp từ 48px xuống 26px cho thanh thoát */
	transform: translateX(-50%);
	background: linear-gradient(to right, 
		rgba(15, 23, 42, 0.08) 0%, 
		rgba(15, 23, 42, 0.02) 25%, 
		rgba(15, 23, 42, 0.15) 48%, 
		rgba(15, 23, 42, 0.15) 52%, 
		rgba(15, 23, 42, 0.02) 75%, 
		rgba(15, 23, 42, 0.08) 100%);
	z-index: 15;
	pointer-events: none;
}

.pg-book-sheet {
	position: absolute;
	width: 50%;
	height: 100%;
	top: 0;
	left: 50%;
	transform-origin: left center;
	transform-style: preserve-3d;
	transition: transform 0.75s cubic-bezier(0.2, 0.75, 0.25, 1);
	z-index: 3;
	pointer-events: none;
}

.pg-book-sheet.is-flipped {
	transform: rotateY(-180deg);
	z-index: 4;
}

.pg-book-page {
	position: absolute;
	width: 100%;
	height: 100%;
	top: 0;
	left: 0;
	background: 
		radial-gradient(circle at 50% 12%, rgba(255,255,255,0.92), transparent 36%),
		linear-gradient(180deg, #fffefb, #fffaf0); /* Màu giấy trắng ngà cao cấp sạch sẽ */
	border: 1px solid rgba(16, 24, 40, 0.06); /* Viền cực mảnh theo mockup */
	color: var(--pg-ink, #111827); /* Màu navy đậm đà sang trọng */
	padding: 3rem 3.5rem; /* Căn chỉnh lại khoảng cách thoải mái */
	box-sizing: border-box;
	border-radius: 6px;
	overflow: hidden;
	display: flex;
	flex-direction: column;
	justify-content: space-between;
	box-shadow: inset 40px 0 40px rgba(15, 23, 42, 0.02); /* Shadow gáy sách ảo siêu mềm */
	pointer-events: auto;
}

/* Only apply backface visibility in flipping 3D sheets context */
.pg-book-sheet .pg-book-page {
	backface-visibility: hidden;
	-webkit-backface-visibility: hidden;
}

.pg-book-page.is-front {
	z-index: 2;
	transform: rotateY(0deg);
}

.pg-book-page.is-back {
	z-index: 1;
	transform: rotateY(180deg);
	box-shadow: inset -40px 0 40px rgba(0, 0, 0, 0.03);
}

/* Các sheet tĩnh bên dưới */
.pg-book-sheet-static {
	position: absolute;
	width: 50%;
	height: 100%;
	top: 0;
	pointer-events: auto;
	box-sizing: border-box;
}

.pg-book-sheet-static.is-left {
	left: 0;
	border-right: 1px solid rgba(0,0,0,0.03);
}

.pg-book-sheet-static.is-right {
	left: 50%;
}

/* ==========================================================================
   TYPOGRAPHY & TRÌNH BÀY CHỮ DỄ ĐỌC
   ========================================================================== */
.pg-book-page-content {
	flex: 1;
	display: flex;
	flex-direction: column;
	font-family: 'Source Sans 3', 'Noto Sans', sans-serif;
	font-size: 1.025rem;
	line-height: 1.62; /* Khoảng cách dòng lý tưởng theo đề xuất */
	text-align: left; /* Canh lề trái tự nhiên */
	gap: 1rem;
}

/* Điều chỉnh font-size */
.pg-book-layout-wrapper.font-small .pg-book-page-content { font-size: 0.925rem; line-height: 1.55; }
.pg-book-layout-wrapper.font-normal .pg-book-page-content { font-size: 1.025rem; line-height: 1.62; }
.pg-book-layout-wrapper.font-large .pg-book-page-content { font-size: 1.125rem; line-height: 1.72; }

/* Tiêu đề Chương */
.pg-book-chap-title {
	font-family: 'Roboto', 'Noto Sans', sans-serif;
	font-size: 1.55rem;
	font-weight: 900;
	color: var(--pg-primary);
	line-height: 1.25;
	margin-top: 0.75rem;
	margin-bottom: 0.75rem;
	letter-spacing: -0.02em;
	text-align: center; /* Tiêu đề chương căn giữa nghệ thuật */
}

/* Đã vô hiệu hóa Dropcap chữ cái đầu to theo yêu cầu người dùng — chuyển sang lùi dòng 1cm */
.pg-book-article-first-p::first-letter,
.pg-book-chapter-first-p::first-letter {
	float: none;
	font-family: inherit;
	font-size: inherit;
	font-weight: inherit;
	line-height: inherit;
	margin: 0;
	color: inherit;
	text-shadow: none;
}

.pg-book-page-content p {
	margin-bottom: 0;
	line-height: 1.72; /* Giãn dòng thoáng 1.72 bảo vệ mắt theo mockup */
	text-align: left;
	text-indent: 1cm; /* Lùi dòng đầu 1cm như sách in theo yêu cầu người dùng */
}

/* Khối Quote trong sách */
.pg-book-page-content blockquote {
	margin: 0.5rem 0;
	padding: 1.25rem 1.5rem;
	background: rgba(var(--pg-primary-rgb, 62, 123, 250), 0.03);
	border-left: 4px solid var(--pg-primary);
	border-radius: 0 0.75rem 0.75rem 0;
	font-style: italic;
	font-size: 1.025rem;
	line-height: 1.65;
	color: var(--book-paper-text-quote, #463b31);
	text-align: left;
}

/* Hình ảnh trong sách */
.pg-book-page-content img {
	width: 100%;
	max-height: 220px;
	object-fit: cover;
	border-radius: 0.5rem;
	margin: 0.5rem 0 0.15rem 0;
	box-shadow: 0 4px 15px rgba(0,0,0,0.06);
}

.pg-book-img-caption {
	display: block;
	font-size: 0.8rem;
	font-style: italic;
	color: var(--pg-muted);
	text-align: center;
	margin-top: -0.5rem;
	margin-bottom: 0.5rem;
}

/* Danh sách */
.pg-book-page-content ul,
.pg-book-page-content ol {
	padding-left: 1.5rem;
	margin: 0.5rem 0;
	display: flex;
	flex-direction: column;
	gap: 0.4rem;
}

.pg-book-page-footer {
	display: flex;
	justify-content: center;
	align-items: center;
	font-size: 0.75rem;
	font-weight: 700;
	color: var(--pg-muted);
	border-top: 1px solid rgba(0, 0, 0, 0.05);
	padding-top: 0.65rem;
	margin-top: 1rem;
	letter-spacing: 0.1em;
}

/* ==========================================================================
   TRANG 1: TRANG BÌA SÁCH (COVER PAGE DESIGN) - CHỐNG TRÀN PREMIUM
   ========================================================================== */
.pg-book-page-cover {
	display: flex;
	flex-direction: column;
	justify-content: space-between;
	height: 100%;
	width: 100%;
	padding: 1.25rem 1.5rem; /* Giảm nhẹ padding từ 1.5rem 2rem xuống 1.25rem 1.5rem để thêm không gian chống tràn */
	box-sizing: border-box;
	text-align: center;
	overflow: hidden;
}

.pg-book-cover-top {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 0.3rem; /* Giảm nhẹ gap */
}

.pg-book-cover-logo {
	font-family: 'Roboto', sans-serif;
	font-size: 1.05rem;
	font-weight: 900;
	color: var(--pg-primary);
	text-transform: uppercase;
	letter-spacing: 0.15em;
	margin: 0;
}

.pg-book-cover-series-badge {
	font-size: 0.675rem;
	font-weight: 700;
	text-transform: uppercase;
	color: var(--pg-muted);
	letter-spacing: 0.05em;
	background: rgba(var(--pg-primary-rgb, 62, 123, 250), 0.06);
	border: 1px solid var(--pg-border);
	padding: 0.2rem 0.6rem;
	border-radius: 99px;
	margin-top: 0.2rem; /* Giảm nhẹ */
}

.pg-book-cover-divider {
	font-size: 0.65rem;
	font-weight: 700;
	color: var(--pg-muted);
	letter-spacing: 0.08em;
	text-transform: uppercase;
	margin-top: 0.35rem; /* Giảm nhẹ */
	margin-bottom: 0;
	display: flex;
	align-items: center;
	gap: 0.5rem;
}

.pg-book-cover-title {
	font-family: 'Roboto', 'Noto Sans', sans-serif;
	font-size: clamp(1.05rem, 2.7vw, 1.3rem); /* Giảm nhẹ font-size tối đa từ 1.35rem xuống 1.3rem */
	font-weight: 900;
	line-height: 1.3;
	color: var(--book-paper-text-title, #1e293b);
	margin: 0.35rem 0; /* Giảm margin dọc từ 0.5rem xuống 0.35rem */
	letter-spacing: -0.02em;
	display: -webkit-box;
	-webkit-line-clamp: 3;
	-webkit-box-orient: vertical;
	overflow: hidden;
	text-overflow: ellipsis;
}

.pg-book-cover-bottom {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 0.4rem; /* Giảm gap từ 0.5rem xuống 0.4rem */
	margin-top: auto;
}

.pg-book-cover-author {
	display: flex;
	flex-direction: row;
	align-items: center;
	justify-content: center;
	gap: 0.65rem;
	width: 100%;
}

.pg-book-cover-avatar {
	width: 34px;
	height: 34px;
	border-radius: 50%;
	object-fit: cover;
	border: 1.5px solid var(--pg-primary);
	flex-shrink: 0;
}

.pg-book-cover-author-meta {
	display: flex;
	flex-direction: column;
	align-items: flex-start;
	gap: 0.05rem;
	line-height: 1.2;
}

.pg-book-cover-author-name {
	font-size: 0.8rem;
	font-weight: 700;
	color: var(--book-paper-text-title, #1e293b);
}

.pg-book-cover-meta-time {
	font-size: 0.65rem;
	color: var(--pg-muted);
	white-space: nowrap;
}

.pg-book-cover-media {
	width: 80%; /* Rộng 80% trang bìa theo mockup */
	height: auto;
	max-height: 180px;
	aspect-ratio: 16/9;
	border-radius: 0.75rem; /* Bo góc mềm mại hơn */
	overflow: hidden;
	box-shadow: 0 8px 24px rgba(15, 23, 42, 0.08); /* Shadow mượt */
	margin: 0.6rem auto; /* Căn giữa tự động và giãn khoảng cách */
	flex-shrink: 0;
	align-self: center;
}

.pg-book-cover-media img,
.pg-book-cover-media svg {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
}

.pg-book-cover-quote {
	font-size: 0.75rem;
	font-style: italic;
	color: var(--pg-soft-ink, #344054);
	max-width: 82%; /* Giảm nhẹ để vừa vặn */
	line-height: 1.45;
	background: rgba(18, 199, 244, 0.03); /* Nền xanh mờ ảo nhẹ nhàng */
	border: 1px dashed rgba(18, 199, 244, 0.15); /* Viền nét đứt cực mảnh */
	border-radius: 0.75rem;
	padding: 0.55rem 0.85rem;
	margin: 0.6rem auto 0;
	position: relative;
	box-sizing: border-box;
	width: 100%;
	display: -webkit-box;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
	overflow: hidden;
	text-overflow: ellipsis;
	text-align: center;
}

/* ==========================================================================
   CÁNH LẬT & TRIGGERS (ẨN NÚT MŨI TÊN - HOVER LỘ DIỆN)
   ========================================================================== */
.pg-book-flip-trigger {
	position: absolute;
	top: 10px;
	bottom: 14px;
	width: 50%; /* Click nửa phải = lật tiếp, nửa trái = lật lại */
	border: none;
	background: transparent;
	z-index: 20;
	cursor: pointer;
	outline: none;
	display: flex;
	align-items: center;
	transition: all 0.3s ease;
	opacity: 0;
	box-sizing: border-box;
}

.pg-book-flip-trigger.is-prev {
	left: 14px;
	justify-content: flex-start;
}

.pg-book-flip-trigger.is-next {
	right: 14px;
	justify-content: flex-end;
}

/* Hiện chỉ dẫn bàn tay click khi hover */
.pg-book-flip-trigger:hover {
	opacity: 1;
}

.pg-flip-indicator {
	display: none !important;
}

.pg-book-flip-trigger:hover .pg-flip-indicator {
	background: var(--pg-primary);
	border-color: var(--pg-primary);
	transform: scale(1.05);
}

.pg-flip-hand-icon {
	font-size: 1rem;
}

.pg-flip-text {
	font-size: 0.7rem;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.05em;
}

/* ==========================================================================
   DROPDOWN MỤC LỤC NHANH (floating Quick ToC)
   ========================================================================== */
.pg-book-quick-toc-dropdown {
	position: absolute;
	top: 5rem; /* Nằm dưới thanh công cụ nổi ở trên đầu */
	left: 50%;
	transform: translateX(-50%);
	width: 90%;
	max-width: 440px;
	background: rgba(var(--pg-surface-rgb, 255, 255, 255), 0.94);
	backdrop-filter: blur(25px);
	-webkit-backdrop-filter: blur(25px);
	border: 1px solid var(--pg-border);
	border-radius: 1.25rem;
	padding: 1.25rem;
	box-shadow: var(--pg-shadow-strong);
	z-index: 60;
	display: none; /* Khởi đầu ẩn, hiển thị bằng JS */
	flex-direction: column;
	gap: 1rem;
	box-sizing: border-box;
	animation: pg-slide-down 0.3s cubic-bezier(0.2, 0.8, 0.2, 1);
}

@keyframes pg-slide-down {
	from { opacity: 0; transform: translate(-50%, -15px); }
	to { opacity: 1; transform: translate(-50%, 0); }
}

.pg-book-quick-toc-header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	font-size: 0.9rem;
	font-weight: 800;
	text-transform: uppercase;
	letter-spacing: 0.05em;
	color: var(--pg-text);
	border-bottom: 2px solid var(--pg-border-strong);
	padding-bottom: 0.5rem;
}

.pg-book-quick-toc-close {
	border: none;
	background: transparent;
	font-size: 1.4rem;
	font-weight: 300;
	color: var(--pg-muted);
	cursor: pointer;
	padding: 0;
	line-height: 1;
}

.pg-book-quick-toc-close:hover {
	color: var(--pg-primary);
}

.pg-book-quick-toc-list {
	list-style: none;
	padding: 0;
	margin: 0;
	max-height: 220px;
	overflow-y: auto;
	display: flex;
	flex-direction: column;
	gap: 0.5rem;
}

/* Custom scrollbar cho dropdown */
.pg-book-quick-toc-list::-webkit-scrollbar {
	width: 4px;
}
.pg-book-quick-toc-list::-webkit-scrollbar-thumb {
	background: var(--pg-border-strong);
	border-radius: 99px;
}

.pg-book-quick-toc-item {
	font-size: 0.825rem;
	font-weight: 600;
	color: var(--pg-muted);
	padding: 0.5rem 0.75rem;
	border-radius: 0.5rem;
	cursor: pointer;
	transition: all 0.2s ease;
	line-height: 1.35;
	display: grid;
	grid-template-columns: minmax(0, 1fr) auto;
	gap: 0.75rem;
	align-items: center;
	text-align: left;
}

.pg-book-quick-toc-item:hover {
	background: var(--pg-bg-soft);
	color: var(--pg-primary);
}

.pg-book-quick-toc-item.is-active {
	background: rgba(var(--pg-primary-rgb, 62, 123, 250), 0.08);
	color: var(--pg-primary);
	font-weight: 700;
}

.pg-book-quick-toc-page-num {
	font-size: 0.75rem;
	color: var(--pg-muted);
	font-weight: 700;
	opacity: 0.7;
	white-space: nowrap;
	flex-shrink: 0;
}

/* ==========================================================================
   THANH ĐIỀU HƯỚNG NỔI CHÂN SÁCH AN TOÀN (FLOATING TOOLBAR)
   ========================================================================== */
/* ==========================================================================
   THANH TIẾN ĐỘ ĐỌC TRONG SIDEBAR (GRADIENT HỆ THỐNG)
   ========================================================================== */
.pg-book-sidebar-progress {
	display: flex;
	flex-direction: column;
	gap: 0.5rem;
	padding: 0.85rem 0;
	border-bottom: 1px solid var(--pg-border);
	margin-bottom: 0.75rem;
}

.pg-book-sidebar-progress-header {
	display: flex;
	align-items: center;
	justify-content: space-between;
}

.pg-book-sidebar-progress-label {
	font-size: 0.7rem;
	font-weight: 700;
	text-transform: uppercase;
	color: var(--pg-muted);
	letter-spacing: 0.05em;
}

.pg-book-sidebar-progress-percent {
	font-size: 0.85rem;
	font-weight: 800;
	background: var(--pg-gradient);
	-webkit-background-clip: text;
	-webkit-text-fill-color: transparent;
	background-clip: text;
	min-width: 32px;
	text-align: right;
}

.pg-book-sidebar-progress-bar {
	height: 6px;
	background: var(--pg-border);
	border-radius: 99px;
	overflow: hidden;
	width: 100%;
}

.pg-book-sidebar-progress-fill {
	height: 100%;
	width: 0%;
	background: var(--pg-gradient);
	border-radius: 99px;
	transition: width 0.4s cubic-bezier(0.2, 0.8, 0.2, 1);
}

/* ==========================================================================
   FLOATING TOOLBAR — ẨN HOÀN TOÀN TRÊN DESKTOP, CHỈ DÙNG TRÊN MOBILE
   ========================================================================== */
.pg-book-floating-toolbar {
	display: none !important;
}

/* Thanh công cụ nhanh di động cũ — đã thay bằng left sidebar */

.pg-book-toolbar-inner {
	display: flex;
	align-items: center;
	justify-content: space-between;
	width: 100%;
	background: rgba(var(--pg-surface-rgb, 255,255,255), 0.88);
	backdrop-filter: blur(20px);
	-webkit-backdrop-filter: blur(20px);
	border: 1px solid var(--pg-border);
	border-radius: 99px;
	padding: 0.55rem 1.25rem;
	box-shadow: 
		0 12px 35px rgba(15, 23, 42, 0.06),
		0 4px 15px rgba(15, 23, 42, 0.04);
	transition: background 0.3s ease, border-color 0.3s ease;
	box-sizing: border-box;
}

.pg-book-toolbar-progress-group {
	display: flex;
	align-items: center;
	gap: 0.65rem;
	flex: 1;
	max-width: 260px;
}

.pg-book-progress-percent {
	font-size: 0.775rem;
	font-weight: 800;
	color: var(--pg-primary);
	min-width: 28px;
	text-align: right;
}

.pg-book-progress-bar-container {
	flex: 1;
	height: 5px;
	background: var(--pg-border);
	border-radius: 99px;
	overflow: hidden;
}

.pg-book-progress-bar-fill {
	height: 100%;
	width: 0%;
	background: var(--pg-primary);
	border-radius: 99px;
	transition: width 0.3s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.pg-book-progress-label {
	font-size: 0.65rem;
	font-weight: 700;
	text-transform: uppercase;
	color: var(--pg-muted);
	letter-spacing: 0.05em;
}

.pg-book-toolbar-actions {
	display: flex;
	align-items: center;
	gap: 0.4rem;
	border-left: 1px solid var(--pg-border);
	padding-left: 0.65rem;
	margin-left: 0.65rem;
}

.pg-book-toolbar-action-btn {
	border: none;
	background: transparent;
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 0.1rem;
	padding: 0.3rem 0.55rem;
	cursor: pointer;
	border-radius: 0.5rem;
	color: var(--pg-muted);
	transition: all 0.2s ease;
}

.pg-book-toolbar-action-btn:hover,
.pg-book-toolbar-action-btn.is-active {
	background: var(--pg-bg-soft);
	color: var(--pg-primary);
}

.pg-action-icon {
	font-size: 0.95rem;
}

.pg-action-text {
	font-size: 0.6rem;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.05em;
}

/* ==========================================================================
   PAPER THEMES - CHẾ ĐỘ GIẤY ĐỌC SÁCH
   ========================================================================== */

/* Chế độ Sáng (Light) */
.pg-book-layout-wrapper.book-theme-light {
	--book-paper-bg: #fdfbf7;
	--book-paper-text: #201a15;
	--book-paper-text-title: #161b26;
	--book-paper-text-quote: #463b31;
}

/* Chế độ Tối (Dark) */
.pg-book-layout-wrapper.book-theme-dark {
	--book-paper-bg: #1a202c;
	--book-paper-text: #cbd5e1;
	--book-paper-text-title: #f8fafc;
	--book-paper-text-quote: #94a3b8;
}

.pg-book-layout-wrapper.book-theme-dark .pg-book-pages-wrap {
	box-shadow: inset 0 0 30px rgba(0, 0, 0, 0.25);
}

.pg-book-layout-wrapper.book-theme-dark .pg-book-paper-stack {
	background: #151a24;
	border-color: rgba(255,255,255,0.03);
}

.pg-book-layout-wrapper.book-theme-dark .pg-book-paper-stack.is-left {
	box-shadow: 
		-2px 2px 0 #151a24,
		-4px 4px 0 #11151d,
		-6px 6px 0 #0d1017,
		-8px 8px 15px rgba(0, 0, 0, 0.4);
}

.pg-book-layout-wrapper.book-theme-dark .pg-book-paper-stack.is-right {
	box-shadow: 
		2px 2px 0 #151a24,
		4px 4px 0 #11151d,
		6px 6px 0 #0d1017,
		8px 8px 15px rgba(0, 0, 0, 0.4);
}

.pg-book-layout-wrapper.book-theme-dark .pg-book-page {
	box-shadow: inset 40px 0 40px rgba(0, 0, 0, 0.18);
	background-image: radial-gradient(rgba(255, 255, 255, 0.015) 1px, transparent 0), radial-gradient(rgba(255, 255, 255, 0.015) 1px, transparent 0);
}

.pg-book-layout-wrapper.book-theme-dark .pg-book-page.is-back {
	box-shadow: inset -40px 0 40px rgba(0, 0, 0, 0.18);
}

.pg-book-layout-wrapper.book-theme-dark .pg-book-page-footer {
	border-color: rgba(255,255,255,0.04);
}

.pg-book-layout-wrapper.book-theme-dark .pg-book-cover-quote {
	border-color: rgba(255,255,255,0.05);
}

.pg-book-layout-wrapper.book-theme-dark .pg-book-quick-toc-dropdown {
	background: rgba(30, 41, 59, 0.94);
	border-color: rgba(255,255,255,0.08);
}

.pg-book-layout-wrapper.book-theme-dark .pg-book-toolbar-inner {
	background: rgba(30, 41, 59, 0.88);
}

/* Chế độ Đêm (Night) */
.pg-book-layout-wrapper.book-theme-night {
	--book-paper-bg: #090c10;
	--book-paper-text: #94a3b8;
	--book-paper-text-title: #e2e8f0;
	--book-paper-text-quote: #64748b;
}

.pg-book-layout-wrapper.book-theme-night .pg-book-pages-wrap {
	box-shadow: inset 0 0 35px rgba(0, 0, 0, 0.45);
}

.pg-book-layout-wrapper.book-theme-night .pg-book-paper-stack {
	background: #06080b;
	border-color: rgba(255,255,255,0.02);
}

.pg-book-layout-wrapper.book-theme-night .pg-book-paper-stack.is-left {
	box-shadow: 
		-2px 2px 0 #06080b,
		-4px 4px 0 #040507,
		-6px 6px 15px rgba(0, 0, 0, 0.5);
}

.pg-book-layout-wrapper.book-theme-night .pg-book-paper-stack.is-right {
	box-shadow: 
		2px 2px 0 #06080b,
		4px 4px 0 #040507,
		6px 6px 15px rgba(0, 0, 0, 0.5);
}

.pg-book-layout-wrapper.book-theme-night .pg-book-page {
	box-shadow: inset 40px 0 40px rgba(0, 0, 0, 0.28);
	background-image: radial-gradient(rgba(255, 255, 255, 0.01) 1px, transparent 0), radial-gradient(rgba(255, 255, 255, 0.01) 1px, transparent 0);
}

.pg-book-layout-wrapper.book-theme-night .pg-book-page.is-back {
	box-shadow: inset -40px 0 40px rgba(0, 0, 0, 0.28);
}

.pg-book-layout-wrapper.book-theme-night .pg-book-page-footer {
	border-color: rgba(255,255,255,0.03);
}

.pg-book-layout-wrapper.book-theme-night .pg-book-cover-quote {
	border-color: rgba(255,255,255,0.04);
}

.pg-book-layout-wrapper.book-theme-night .pg-book-quick-toc-dropdown {
	background: rgba(15, 23, 42, 0.94);
	border-color: rgba(255,255,255,0.06);
}

.pg-book-layout-wrapper.book-theme-night .pg-book-toolbar-inner {
	background: rgba(15, 23, 42, 0.88);
}

/* ==========================================================================
   LOẠI HÌNH PHÂN TRANG LOADER
   ========================================================================== */
.pg-book-paginating-loader {
	position: absolute;
	top: 0;
	left: 0;
	right: 0;
	bottom: 0;
	background: var(--pg-surface-strong);
	z-index: 30;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 1.25rem;
}

.pg-book-spinner {
	width: 40px;
	height: 40px;
	border: 3px solid var(--pg-border);
	border-top-color: var(--pg-primary);
	border-radius: 50%;
	animation: pg-spin 0.8s linear infinite;
}

.pg-book-paginating-loader p {
	font-size: 0.85rem;
	font-weight: 700;
	color: var(--pg-muted);
}

/* ==========================================================================
   RESPONSIVE DESIGN: TABLET & MOBILE
   ========================================================================== */

@media (max-width: 1024px) {
	/* Layout: Sách chiếm toàn bộ màn hình, cuộn xuống xem bài liên quan */
	.pg-book-layout-wrapper {
		height: auto;
		min-height: unset;
		overflow: visible;
		padding-bottom: 0;
	}

	.pg-book-layout-inner {
		display: flex;
		flex-direction: column;
		gap: 0;
		padding: 0 0.75rem;
		height: auto;
		align-items: start;
	}
	
	/* Stage (vùng chứa sách) chiếm đúng 100dvh - header */
	.pg-book-stage {
		order: 1;
		width: 100%;
		height: calc(100dvh - var(--pg-header-height, 70px));
		min-height: 420px;
		background: transparent !important;
		border: none !important;
		border-radius: 0 !important;
		padding: 0.5rem !important;
		box-shadow: none !important;
		backdrop-filter: none !important;
	}
	
	.pg-book-sidebar {
		order: 2;
		display: flex;
		width: 100%;
		height: auto;
		margin-top: 2rem;
		padding-bottom: 3rem;
	}

	.pg-book-sidebar-sticky {
		max-height: none;
		overflow-y: visible;
		padding-right: 0;
		display: flex;
		flex-direction: column;
		gap: 1.5rem;
		width: 100%;
	}

	.pg-book-sidebar .pg-book-card-info,
	.pg-book-sidebar .pg-book-tools-section {
		display: none !important;
	}
	
	.pg-book-stage-inner {
		height: 100%;
		padding: 0.65rem 0;
		box-sizing: border-box;
	}
	
	/* Quyển sách: bỏ aspect-ratio, chiếm toàn bộ chiều cao stage */
	.pg-book-container {
		width: 100%;
		max-width: 100%;
		height: calc(100% - 1.3rem);
		max-height: none;
		aspect-ratio: unset;
	}
	
	.pg-book-el {
		background: transparent;
		box-shadow: none;
		padding: 0;
	}
	
	.pg-book-pages-wrap {
		border-radius: var(--pg-radius-lg, 1rem);
		box-shadow: var(--pg-shadow-soft);
		border: 1px solid var(--pg-border);
	}
	
	.pg-book-pages-wrap::after {
		display: none;
	}
	
	.pg-book-paper-stack {
		display: none; /* Ẩn xếp chồng trang 3D trên mobile */
	}
	
	.pg-book-sheet {
		width: 100%;
		left: 0;
		transform-origin: center center;
	}
	
	.pg-book-page {
		width: 100%;
		box-shadow: none !important;
		padding: 2.5rem;
		background-image: none; /* tắt texture thô trên di động để tăng độ mượt rendering */
	}
	
	.pg-book-page.is-back {
		transform: rotateY(0deg);
		display: none;
	}
	
	.pg-book-page.is-active-single {
		display: flex !important;
		z-index: 5;
	}
	
	.pg-book-flip-trigger {
		width: 30%; /* chạm 30% bên cạnh trái/phải để lật */
		opacity: 0.15;
	}
	
	.pg-book-flip-trigger:hover {
		opacity: 0.75;
	}
	
	.pg-book-flip-trigger.is-prev { left: 0; }
	.pg-book-flip-trigger.is-next { right: 0; }
	
	.pg-flip-indicator {
		width: 34px;
		height: 34px;
		padding: 0;
		justify-content: center;
		margin: 0 0.5rem;
	}
	
	.pg-book-flip-trigger:hover .pg-flip-indicator {
		width: 34px;
		border-radius: 50%;
	}
	
	.pg-flip-text {
		display: none;
	}
	
	.pg-book-quick-toc-dropdown {
		position: fixed;
		top: calc(var(--pg-book-top-offset, 95px) + 4rem);
		bottom: auto;
		left: 50%;
		transform: translateX(-50%);
		width: calc(100vw - 24px);
		max-width: 440px;
		border-radius: 1.25rem;
		border: 1px solid var(--pg-border);
		box-shadow: var(--pg-shadow-strong);
		padding: 1.25rem;
		animation: pg-slide-down 0.3s cubic-bezier(0.2, 0.8, 0.2, 1);
	}

	/* Tablet Cover Page Optimization to prevent overflow */
	.pg-book-page-cover {
		padding: 1rem 1.5rem !important;
	}
	.pg-book-cover-logo {
		font-size: 0.95rem;
	}
	.pg-book-cover-series-badge {
		font-size: 0.6rem;
		padding: 0.15rem 0.5rem;
	}
	.pg-book-cover-divider {
		margin-top: 0.25rem;
	}
	.pg-book-cover-title {
		font-size: 1.35rem;
		line-height: 1.25;
	}
	.pg-book-cover-author {
		gap: 0.45rem;
	}
	.pg-book-cover-avatar {
		width: 30px;
		height: 30px;
	}
	.pg-book-cover-media {
		max-height: 180px;
	}
	.pg-book-cover-quote {
		font-size: 0.725rem;
		max-width: 95%;
		padding-top: 0.35rem;
	}
}

@media (max-width: 576px) {
	.pg-book-page {
		padding: 1.25rem !important; /* Đều đặn lề 4 phía trên di động, không bị đè bởi rule cuối file */
	}
	
	.pg-book-page-content {
		font-size: 0.95rem;
		gap: 1rem;
	}
	
	.pg-book-chap-title {
		font-size: 1.35rem;
	}
	
	.pg-book-page-cover {
		padding: 0 !important; /* Bỏ padding riêng để kế thừa padding đều của pg-book-page cha, chống cộng dồn lệch */
		width: 100% !important;
		display: flex !important;
		flex-direction: column !important;
		align-items: center !important; /* Ép toàn bộ logo, badge, tiêu đề, ảnh, tác giả căn giữa tuyệt đối theo chiều ngang */
		justify-content: space-between !important;
		height: 100% !important;
		box-sizing: border-box !important;
	}
	
	.pg-book-cover-logo {
		font-size: 0.8rem;
	}
	
	.pg-book-cover-series-badge {
		font-size: 0.55rem;
		padding: 0.1rem 0.4rem;
	}

	.pg-book-cover-divider {
		display: none !important; /* Ẩn divider trên điện thoại để lấy chỗ */
	}

	.pg-book-cover-title {
		font-size: 1.1rem !important;
		line-height: 1.25;
		display: -webkit-box;
		-webkit-line-clamp: 3;
		-webkit-box-orient: vertical;
		overflow: hidden;
		width: 100% !important;
		text-align: center !important;
	}

	.pg-book-cover-bottom {
		gap: 0.25rem;
		width: 100% !important;
		display: flex !important;
		flex-direction: column !important;
		align-items: center !important;
	}

	.pg-book-cover-author {
		gap: 0.4rem;
		display: flex !important;
		justify-content: center !important;
		align-items: center !important;
	}

	.pg-book-cover-avatar {
		width: 28px;
		height: 28px;
	}

	.pg-book-cover-media {
		display: block !important; /* Hiện lại hình ảnh bìa trên mobile để giao diện đẹp đẽ và đủ định dạng */
		width: 90% !important; /* Chiếm 90% chiều rộng trang sách mobile cho đầy đặn cân đối */
		height: auto !important;
		aspect-ratio: 16/9 !important;
		max-height: 140px !important; /* Giới hạn chiều cao an toàn chống tràn */
		margin: 0.5rem auto !important;
		align-self: center !important; /* Ép căn giữa tuyệt đối trong cột dọc Flexbox */
	}

	.pg-book-cover-quote {
		display: none !important; /* Giữ ẩn quote trên mobile để nhường không gian dọc cho ảnh bìa */
	}
}

/* ==========================================================================
   SIDEBAR DỌC TRÁI MOBILE — CÔNG CỤ ĐỌC MỞ/ĐÓNG (SLIDE-IN PANEL)
   ========================================================================== */

/* Ẩn hoàn toàn trên desktop */
.pg-book-mobile-left-sidebar,
.pg-book-mobile-left-overlay {
	display: none;
}

/* ── Hiện trên tablet & mobile ── */
@media (max-width: 1024px) {
	/* Wrapper: chỉ là vùng chứa không có kích thước */
	.pg-book-mobile-left-sidebar {
		display: block;
	}

	/* Tab mỏng luôn nổi bên trái màn hình */
	.pg-book-mobile-left-tab {
		position: fixed;
		left: 0;
		top: 50%;
		transform: translateY(-50%);
		z-index: 202;
		width: 30px;
		height: 76px;
		background: rgba(255, 255, 255, 0.88);
		backdrop-filter: blur(16px);
		-webkit-backdrop-filter: blur(16px);
		border: 1px solid var(--pg-border);
		border-left: none;
		border-radius: 0 0.85rem 0.85rem 0;
		display: flex;
		align-items: center;
		justify-content: center;
		cursor: pointer;
		box-shadow: 3px 0 14px rgba(15, 23, 42, 0.1);
		color: var(--pg-primary);
		padding: 0;
		transition: background 0.2s, box-shadow 0.2s;
	}

	.pg-book-mobile-left-tab:hover,
	.pg-book-mobile-left-tab.is-open {
		background: rgba(255, 255, 255, 0.97);
		box-shadow: 4px 0 18px rgba(15, 23, 42, 0.14);
	}

	/* Chevron › xoay thành ‹ khi mở */
	.pg-left-tab-chevron {
		display: inline-block;
		font-size: 1.4rem;
		line-height: 1;
		font-weight: 900;
		color: var(--pg-primary);
		transition: transform 0.3s cubic-bezier(0.2, 0.8, 0.2, 1);
		user-select: none;
	}

	.pg-book-mobile-left-tab.is-open .pg-left-tab-chevron {
		transform: scaleX(-1);
	}

	/* Panel dọc trượt ra từ cạnh trái (ngay cạnh phải của tab) */
	.pg-book-mobile-left-panel {
		position: fixed;
		left: 30px; /* bằng đúng chiều rộng tab */
		top: 50%;
		transform: translateY(-50%) translateX(calc(-100% - 30px)); /* ẩn sang trái */
		z-index: 201;
		width: 142px;
		background: rgba(255, 255, 255, 0.96);
		backdrop-filter: blur(22px);
		-webkit-backdrop-filter: blur(22px);
		border: 1px solid var(--pg-border);
		border-left: none;
		border-radius: 0 1.1rem 1.1rem 0;
		padding: 1rem 0.7rem;
		box-shadow: 6px 0 28px rgba(15, 23, 42, 0.12);
		display: flex;
		flex-direction: column;
		gap: 0.55rem;
		transition: transform 0.32s cubic-bezier(0.2, 0.8, 0.2, 1), opacity 0.25s;
		pointer-events: none;
		opacity: 0;
	}

	.pg-book-mobile-left-panel.is-open {
		transform: translateY(-50%) translateX(0);
		pointer-events: auto;
		opacity: 1;
	}

	/* Nút bên trong panel */
	.pg-book-mobile-left-btn {
		display: flex;
		align-items: center;
		gap: 0.55rem;
		width: 100%;
		padding: 0.6rem 0.65rem;
		border: 1px solid var(--pg-border);
		background: var(--pg-bg-soft);
		border-radius: 0.65rem;
		cursor: pointer;
		color: var(--pg-text);
		font-size: 0.8rem;
		font-weight: 700;
		text-align: left;
		box-sizing: border-box;
		transition: all 0.2s ease;
		outline: none;
	}

	.pg-book-mobile-left-btn:hover,
	.pg-book-mobile-left-btn:active {
		background: var(--pg-primary);
		color: #fff;
		border-color: var(--pg-primary);
		box-shadow: 0 4px 12px rgba(var(--pg-primary-rgb, 62, 123, 250), 0.25);
	}

	.pg-left-btn-icon {
		font-size: 1.05rem;
		flex-shrink: 0;
		line-height: 1;
	}

	.pg-left-btn-label {
		font-size: 0.75rem;
		font-weight: 700;
		line-height: 1.2;
	}

	/* Overlay mờ nhẹ — click để đóng */
	.pg-book-mobile-left-overlay {
		display: none;
		position: fixed;
		inset: 0;
		z-index: 199;
		background: rgba(15, 23, 42, 0.12);
		backdrop-filter: none;
	}

	.pg-book-mobile-left-overlay.is-active {
		display: block;
		animation: pg-fade-in 0.2s ease;
	}
}

/* Dark mode support for mobile left sidebar */
.pg-book-layout-wrapper.book-theme-dark .pg-book-mobile-left-tab,
.pg-book-layout-wrapper.book-theme-night .pg-book-mobile-left-tab {
	background: rgba(15, 23, 42, 0.88);
	border-color: rgba(255, 255, 255, 0.1);
}

.pg-book-layout-wrapper.book-theme-dark .pg-book-mobile-left-panel,
.pg-book-layout-wrapper.book-theme-night .pg-book-mobile-left-panel {
	background: rgba(15, 23, 42, 0.95);
	border-color: rgba(255, 255, 255, 0.08);
}

.pg-book-layout-wrapper.book-theme-dark .pg-book-mobile-left-btn,
.pg-book-layout-wrapper.book-theme-night .pg-book-mobile-left-btn {
	background: rgba(255, 255, 255, 0.05);
	border-color: rgba(255, 255, 255, 0.08);
	color: rgba(255, 255, 255, 0.85);
}

/* ==========================================================================
   BÀI VIẾT LIÊN QUAN (RELATED POSTS IN SIDEBAR) - PREMIUM post cards
   ========================================================================== */
.pg-book-related-section {
	margin-top: 1.25rem;
	width: 100%;
}

.pg-book-related-title {
	font-size: 0.85rem;
	font-weight: 800;
	text-transform: uppercase;
	letter-spacing: 0.05em;
	color: var(--pg-text);
	border-bottom: 2px solid var(--pg-border-strong);
	padding-bottom: 0.5rem;
	margin-bottom: 1.25rem;
}

.pg-book-related-list {
	display: flex;
	flex-direction: column;
	gap: 1.25rem;
}

.pg-book-related-card {
	display: flex;
	flex-direction: column;
	border-radius: 1rem;
	background: rgba(var(--pg-surface-rgb, 255, 255, 255), 0.35);
	border: 1px solid var(--pg-border);
	overflow: hidden;
	transition: all 0.3s cubic-bezier(0.2, 0.8, 0.2, 1);
	box-shadow: var(--pg-shadow-soft);
	backdrop-filter: blur(10px);
	-webkit-backdrop-filter: blur(10px);
}

.pg-book-related-card:hover {
	background: rgba(var(--pg-surface-rgb, 255, 255, 255), 0.65);
	border-color: var(--pg-border-strong);
	transform: translateY(-4px);
	box-shadow: 
		0 12px 28px rgba(0, 0, 0, 0.08),
		0 4px 12px rgba(0, 0, 0, 0.04);
}

.pg-book-related-card-media {
	width: 100%;
	aspect-ratio: 16/9;
	overflow: hidden;
	position: relative;
	display: block;
	border-bottom: 1px solid var(--pg-border);
}

.pg-book-related-card-media img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	transition: transform 0.6s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.pg-book-related-card:hover .pg-book-related-card-media img {
	transform: scale(1.05);
}

.pg-book-related-card-placeholder {
	width: 100%;
	height: 100%;
	background: linear-gradient(135deg, #0f172a, #1e293b);
	display: flex;
	align-items: center;
	justify-content: center;
}

.pg-book-related-card-placeholder span {
	font-family: 'Roboto', sans-serif;
	font-size: 1rem;
	font-weight: 800;
	letter-spacing: 0.1em;
	color: var(--pg-primary);
	opacity: 0.7;
}

.pg-book-related-card-badge {
	position: absolute;
	top: 0.75rem;
	left: 0.75rem;
	font-size: 0.625rem;
	font-weight: 800;
	text-transform: uppercase;
	letter-spacing: 0.05em;
	color: #fff;
	background: var(--pg-primary);
	padding: 0.25rem 0.6rem;
	border-radius: 99px;
	box-shadow: 0 4px 10px rgba(var(--pg-primary-rgb, 62, 123, 250), 0.3);
}

.pg-book-related-card-body {
	padding: 1rem;
	display: flex;
	flex-direction: column;
	gap: 0.5rem;
}

.pg-book-related-card-title {
	font-size: 0.875rem;
	font-weight: 800;
	line-height: 1.35;
	margin: 0;
	display: -webkit-box;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
	overflow: hidden;
	text-overflow: ellipsis;
}

.pg-book-related-card-title a {
	color: var(--pg-text) !important;
	text-decoration: none !important;
	transition: color 0.2s ease;
}

.pg-book-related-card-title a:hover {
	color: var(--pg-primary) !important;
}

.pg-book-related-card-excerpt {
	font-size: 0.75rem;
	line-height: 1.45;
	color: var(--pg-muted);
	margin: 0;
	display: -webkit-box;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
	overflow: hidden;
	text-overflow: ellipsis;
}

.pg-book-related-card-footer {
	display: flex;
	align-items: center;
	justify-content: space-between;
	margin-top: 0.25rem;
	padding-top: 0.65rem;
	border-top: 1px solid var(--pg-border);
}

.pg-book-related-card-author {
	display: flex;
	align-items: center;
	gap: 0.45rem;
}

.pg-book-related-card-author img {
	width: 22px;
	height: 22px;
	border-radius: 50%;
	object-fit: cover;
	border: 1px solid var(--pg-primary);
}

.pg-book-related-card-author span {
	font-size: 0.725rem;
	font-weight: 700;
	color: var(--pg-text);
}

.pg-book-related-card-date {
	font-size: 0.675rem;
	color: var(--pg-muted);
	font-weight: 500;
}

.pg-book-related-empty {
	font-size: 0.8rem;
	color: var(--pg-muted);
	text-align: center;
	padding: 1.5rem 0;
}

/* ==========================================================================
   CONTENT-AWARE BOOK LAYOUT V3
   ========================================================================== */
.pg-book-layout-wrapper {
	--book-space-xs: 6px;
	--book-space-sm: 10px;
	--book-space-md: 16px;
	--book-space-lg: 24px;
	--book-space-xl: 36px;
	--book-cyan: #11c7f3;
	--book-blue: #3ba7ff;
	--book-purple: #7a5cff;
	--book-ink: #111827;
	--book-ink-soft: #374151;
	--book-muted: #6b7280;
	--book-line: rgba(17, 24, 39, 0.12);
	--book-accent-soft: rgba(17, 199, 243, 0.1);
	--book-purple-soft: rgba(122, 92, 255, 0.1);
}

.pg-book-el {
	background: #111827;
	box-shadow:
		0 18px 46px rgba(15, 23, 42, 0.28),
		0 8px 20px rgba(15, 23, 42, 0.18),
		inset 0 0 0 1px rgba(255, 255, 255, 0.06);
}

.pg-book-pages-wrap::after {
	width: 34px;
	background: linear-gradient(to right,
		rgba(15, 23, 42, 0.12) 0%,
		rgba(15, 23, 42, 0.03) 28%,
		rgba(15, 23, 42, 0.22) 49%,
		rgba(15, 23, 42, 0.22) 51%,
		rgba(15, 23, 42, 0.03) 72%,
		rgba(15, 23, 42, 0.12) 100%);
}

.pg-book-page {
	padding: 2.7rem 3.25rem 2.35rem;
}

.pg-book-page-content {
	font-family: var(--pg-font-body, var(--font-system, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif));
	font-size: clamp(15.5px, 1.02vw, 17px);
	line-height: 1.62;
	gap: 0;
	color: var(--book-paper-text, var(--book-ink));
	overflow: hidden;
}

.pg-book-page-content .book-block {
	max-width: 100%;
}

.pg-book-page-content p {
	margin: 0 0 var(--book-space-md);
	line-height: 1.72; /* Giãn dòng thoáng 1.72 bảo vệ mắt theo mockup */
	text-align: left;
	text-indent: 1cm; /* Lùi dòng đầu 1cm như sách in theo yêu cầu người dùng */
}

.pg-book-page-content p:last-child {
	margin-bottom: 0;
}

.pg-book-page-content .book-heading--h2 {
	margin: 0 0 22px;
	font-family: inherit;
	font-size: clamp(1.45rem, 2vw, 1.9rem);
	line-height: 1.18;
	font-weight: 850;
	color: var(--book-paper-text-title, var(--book-ink));
	letter-spacing: 0;
}

.pg-book-page-content .book-heading--h2::after {
	content: "";
	display: block;
	width: 56px;
	height: 3px;
	margin-top: 12px;
	border-radius: 99px;
	background: linear-gradient(90deg, var(--book-cyan), var(--book-purple));
}

.pg-book-page-content .book-heading--h3 {
	margin: 28px 0 14px;
	font-family: inherit;
	font-size: clamp(1.17rem, 1.5vw, 1.45rem);
	line-height: 1.26;
	font-weight: 800;
	color: var(--book-paper-text-title, var(--book-ink));
	letter-spacing: 0;
}

.pg-book-page-content .book-heading--h4,
.pg-book-page-content .book-heading--h5,
.pg-book-page-content .book-heading--h6 {
	margin: 22px 0 10px;
	font-family: inherit;
	font-size: 1.03rem;
	line-height: 1.3;
	font-weight: 780;
	color: var(--book-paper-text-title, var(--book-ink));
}

/* Vô hiệu hóa Dropcap start ::first-letter theo yêu cầu của người dùng */
.pg-book-page-content .pg-book-dropcap-start::first-letter {
	float: none;
	margin: 0;
	font-size: inherit;
	line-height: inherit;
	font-weight: inherit;
	color: inherit;
}

.pg-book-page-content blockquote {
	margin: var(--book-space-lg) 0;
	padding: 18px 20px;
	border-left: 4px solid var(--book-cyan);
	border-radius: 14px;
	background: linear-gradient(135deg, var(--book-accent-soft), var(--book-purple-soft));
	color: var(--book-paper-text-quote, var(--book-ink-soft));
	font-size: 0.96em;
	line-height: 1.6;
	font-style: italic;
}

.pg-book-page-content blockquote p {
	margin: 0;
}

.pg-book-page-content ul,
.pg-book-page-content ol {
	margin: var(--book-space-md) 0 var(--book-space-lg);
	padding-left: 1.35rem;
	gap: 0.35rem;
}

.pg-book-page-content li {
	margin: 0;
	line-height: 1.58;
}

.pg-book-page-content a {
	color: var(--book-cyan);
	text-decoration-thickness: 1px;
	text-underline-offset: 3px;
}

.pg-book-page-content figure {
	margin: var(--book-space-lg) 0;
}

.pg-book-page-content figcaption,
.pg-book-page-content .wp-element-caption {
	margin-top: 8px;
	font-size: 0.78em;
	line-height: 1.45;
	color: var(--book-muted);
	text-align: center;
	font-style: italic;
}

.pg-book-page-content img {
	display: block;
	width: 100%;
	max-height: 190px;
	object-fit: cover;
	border-radius: 12px;
	margin: 0;
	box-shadow: 0 8px 22px rgba(15, 23, 42, 0.1);
}

.book-table-wrap {
	max-width: 100%;
	overflow-x: auto;
	margin: var(--book-space-lg) 0;
	border: 1px solid var(--book-line);
	border-radius: 12px;
	background: rgba(255, 255, 255, 0.42);
}

.pg-book-page-content table {
	width: 100%;
	min-width: 100%;
	border-collapse: separate;
	border-spacing: 0;
	margin: 0;
	font-size: 0.86em;
	line-height: 1.45;
	color: var(--book-paper-text, var(--book-ink));
}

.pg-book-page-content th {
	background: linear-gradient(135deg, var(--book-accent-soft), var(--book-purple-soft));
	color: var(--book-paper-text-title, var(--book-ink));
	font-weight: 750;
}

.pg-book-page-content th,
.pg-book-page-content td {
	border-right: 1px solid var(--book-line);
	border-bottom: 1px solid var(--book-line);
	padding: 9px 11px;
	vertical-align: top;
}

.pg-book-page-content tr:last-child td {
	border-bottom: 0;
}

.pg-book-page-content th:last-child,
.pg-book-page-content td:last-child {
	border-right: 0;
}

.pg-book-page-content pre,
.pg-book-page-content code {
	font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.pg-book-page-content pre {
	max-width: 100%;
	overflow: auto;
	margin: var(--book-space-lg) 0;
	padding: 14px;
	border-radius: 12px;
	background: rgba(15, 23, 42, 0.06);
	border: 1px solid var(--book-line);
	font-size: 0.83em;
	line-height: 1.5;
}

@media (max-width: 1024px) {
	.pg-book-page {
		padding: 2rem;
	}

	.pg-book-page-content {
		font-size: 0.96rem;
		line-height: 1.58;
	}

	.pg-book-page-content .book-heading--h2 {
		font-size: 1.35rem;
		margin-bottom: 18px;
	}

	.pg-book-page-content .book-heading--h3 {
		font-size: 1.12rem;
		margin: 22px 0 12px;
	}
}

@media (max-width: 576px) {
	.pg-book-page {
		padding: 1.5rem;
	}

	.pg-book-page-content {
		font-size: 0.9rem;
		line-height: 1.54;
	}

	.pg-book-page-content img {
		max-height: 150px;
	}

	.book-table-wrap {
		margin: 18px 0;
	}

	.pg-book-page-content table {
		font-size: 0.78em;
	}
}

/* ==========================================================================
   KEYFRAMES ANIMATIONS
   ========================================================================== */
@keyframes pg-spin {
	from { transform: rotate(0deg); }
	to { transform: rotate(360deg); }
}

@keyframes pg-fade-in {
	from { opacity: 0; }
	to { opacity: 1; }
}

@keyframes pg-slide-down {
	from {
		opacity: 0;
		transform: translateX(-50%) translateY(-12px);
	}
	to {
		opacity: 1;
		transform: translateX(-50%) translateY(0);
	}
}

/* Loại trừ thụt lề cho blockquote, danh sách, bảng, hình ảnh để giữ giao diện chuẩn */
.pg-book-page-content blockquote p,
.pg-book-page-content li p,
.pg-book-page-content li,
.pg-book-page-content figcaption,
.pg-book-page-content .book-heading,
.pg-book-page-content table p,
.pg-book-page-content td,
.pg-book-page-content th,
.pg-book-page-content pre,
.pg-book-page-content code {
	text-indent: 0 !important;
}

/* ==========================================================================
   BOOK PRINT / SAVE PDF MODE
   ========================================================================== */
.book-print-root {
	display: none;
}

@media print {
	@page {
		size: A4 portrait;
		margin: 16mm 18mm;
	}

	html,
	body {
		width: auto !important;
		height: auto !important;
		overflow: visible !important;
		background: #fff !important;
		color: #111827 !important;
	}

	body.pg-book-printing > :not(#bookPrintRoot) {
		display: none !important;
	}

	#bookPrintRoot,
	#bookPrintRoot * {
		visibility: visible !important;
		-webkit-print-color-adjust: exact;
		print-color-adjust: exact;
	}

	#bookPrintRoot {
		display: block !important;
		position: static !important;
		width: 100% !important;
		height: auto !important;
		margin: 0 !important;
		padding: 0 !important;
		background: #fff !important;
		color: #111827 !important;
	}

	.site-header,
	.pg-site-header,
	.topbar,
	.sidebar,
	.reader-sidebar,
	.reader-controls,
	.controls,
	.book-toolbar,
	.pg-book-layout-wrapper,
	#pg-book-raw-content,
	.pg-book-sidebar,
	.pg-book-floating-toolbar,
	.pg-book-related-section,
	.related-posts,
	.comments-area,
	.footer,
	.site-footer,
	#wpadminbar {
		display: none !important;
	}

	.book-print-page {
		display: block !important;
		width: 100% !important;
		min-height: calc(297mm - 32mm);
		page-break-after: always;
		break-after: page;
		background: #fffef9 !important;
		color: #111827 !important;
		margin: 0 !important;
		padding: 0 !important;
		box-shadow: none !important;
		border: 0 !important;
		overflow: visible !important;
	}

	.book-print-page:last-child {
		page-break-after: auto;
		break-after: auto;
	}

	.print-page-inner {
		min-height: calc(297mm - 32mm);
		display: grid;
		grid-template-rows: auto 1fr auto;
	}

	.print-page-body,
	.print-page-body .pg-book-page-content {
		display: block !important;
		height: auto !important;
		min-height: 0 !important;
		overflow: visible !important;
		font-family: var(--pg-font-body, var(--font-system, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif)) !important;
		font-size: 12pt !important;
		line-height: 1.65 !important;
		color: #111827 !important;
		text-align: left !important;
	}

	.print-page-body p {
		margin: 0 0 10pt !important;
		text-indent: 1cm !important;
		line-height: 1.65 !important;
	}

	.print-page-body h1,
	.print-page-body h2,
	.print-page-body h3,
	.print-page-body h4,
	.print-page-body h5,
	.print-page-body h6 {
		text-indent: 0 !important;
		page-break-after: avoid;
		break-after: avoid;
		color: #111827 !important;
		letter-spacing: 0 !important;
	}

	.print-page-body h2,
	.print-page-body .book-heading--h2 {
		font-size: 20pt !important;
		line-height: 1.25 !important;
		margin: 0 0 18pt !important;
		font-weight: 800 !important;
	}

	.print-page-body h2::after,
	.print-page-body .book-heading--h2::after {
		content: "";
		display: block;
		width: 42mm;
		height: 2pt;
		margin-top: 8pt;
		border-radius: 99pt;
		background: linear-gradient(90deg, #12c7f4, #7a5cff) !important;
	}

	.print-page-body h3,
	.print-page-body .book-heading--h3 {
		font-size: 15pt !important;
		line-height: 1.35 !important;
		margin: 18pt 0 10pt !important;
		font-weight: 760 !important;
	}

	.print-page-body h4,
	.print-page-body h5,
	.print-page-body h6 {
		font-size: 13pt !important;
		line-height: 1.35 !important;
		margin: 14pt 0 8pt !important;
		font-weight: 740 !important;
	}

	.print-page-body blockquote,
	.print-page-body ul,
	.print-page-body ol,
	.print-page-body table,
	.print-page-body figure,
	.print-page-body pre,
	.print-page-body code,
	.print-page-body figcaption,
	.print-page-body li,
	.print-page-body td,
	.print-page-body th {
		text-indent: 0 !important;
	}

	.print-page-body blockquote {
		margin: 16pt 0 !important;
		padding: 12pt 14pt !important;
		border-left: 4px solid #12c7f4 !important;
		border-radius: 8pt !important;
		background: rgba(18, 199, 244, 0.08) !important;
		color: #374151 !important;
		font-size: 11.5pt !important;
		line-height: 1.6 !important;
		page-break-inside: avoid;
		break-inside: avoid;
	}

	.print-page-body blockquote p {
		margin: 0 !important;
	}

	.print-page-body ul,
	.print-page-body ol {
		margin: 10pt 0 14pt !important;
		padding-left: 18pt !important;
	}

	.print-page-body li {
		margin: 0 0 5pt !important;
		line-height: 1.55 !important;
	}

	.print-page-body a {
		color: #0ea5e9 !important;
		text-decoration: underline !important;
		text-underline-offset: 2pt;
	}

	.print-page-body .book-table-wrap {
		max-width: 100% !important;
		overflow: visible !important;
		margin: 16pt 0 !important;
		border: 1px solid rgba(16, 24, 40, 0.18) !important;
		border-radius: 8pt !important;
		background: transparent !important;
		page-break-inside: avoid;
		break-inside: avoid;
	}

	.print-page-body table {
		width: 100% !important;
		min-width: 0 !important;
		border-collapse: collapse !important;
		border-spacing: 0 !important;
		margin: 0 !important;
		font-size: 10.5pt !important;
		line-height: 1.4 !important;
		color: #111827 !important;
	}

	.print-page-body th,
	.print-page-body td {
		border: 1px solid rgba(16, 24, 40, 0.18) !important;
		padding: 7pt 8pt !important;
		vertical-align: top !important;
	}

	.print-page-body th {
		background: rgba(18, 199, 244, 0.10) !important;
		font-weight: 700 !important;
	}

	.print-page-body img {
		display: block !important;
		max-width: 100% !important;
		width: auto !important;
		height: auto !important;
		max-height: 110mm !important;
		object-fit: contain !important;
		margin: 0 auto !important;
		border-radius: 8pt !important;
		box-shadow: none !important;
		page-break-inside: avoid;
		break-inside: avoid;
	}

	.print-page-body figure {
		margin: 16pt 0 !important;
		page-break-inside: avoid;
		break-inside: avoid;
	}

	.print-page-body figcaption,
	.print-page-body .wp-element-caption {
		margin-top: 7pt !important;
		font-size: 9.5pt !important;
		line-height: 1.45 !important;
		color: #667085 !important;
		text-align: center !important;
		font-style: italic !important;
	}

	.print-page-body pre {
		white-space: pre-wrap !important;
		margin: 14pt 0 !important;
		padding: 10pt !important;
		border-radius: 8pt !important;
		border: 1px solid rgba(16, 24, 40, 0.14) !important;
		background: rgba(16, 24, 40, 0.04) !important;
		font-size: 9.5pt !important;
		line-height: 1.45 !important;
	}

	.print-page-footer {
		border-top: 1px solid rgba(16, 24, 40, 0.12);
		padding-top: 8pt;
		text-align: center;
		font-size: 10pt;
		color: #667085;
	}

	.print-cover {
		text-align: center;
	}

	.print-cover-body {
		align-self: center;
		text-align: center !important;
	}

	.print-cover-brand {
		color: #12c7f4;
		letter-spacing: 0.16em;
		text-transform: uppercase;
		font-weight: 800;
		font-size: 16pt;
		margin-bottom: 10pt;
	}

	.print-cover-kicker,
	.print-cover-meta {
		color: #667085;
		font-size: 10.5pt;
		margin-bottom: 10pt;
		text-indent: 0 !important;
	}

	.print-cover-title {
		color: #111827 !important;
		font-size: 24pt !important;
		line-height: 1.22 !important;
		margin: 16pt auto !important;
		max-width: 88%;
		text-align: center !important;
	}

	.print-cover-subtitle {
		max-width: 78%;
		margin: 0 auto 14pt !important;
		text-indent: 0 !important;
		color: #374151;
	}

	.print-cover-image {
		width: 80% !important;
		max-height: 90mm !important;
		aspect-ratio: 16 / 9;
		object-fit: cover !important;
		border-radius: 10pt !important;
		margin: 14pt auto !important;
	}

	.print-cover-placeholder {
		width: 80%;
		aspect-ratio: 16 / 9;
		display: flex;
		align-items: center;
		justify-content: center;
		margin: 14pt auto;
		border-radius: 10pt;
		background: linear-gradient(135deg, #0f172a, #1e293b) !important;
		color: #12c7f4 !important;
		font-weight: 800;
		letter-spacing: 0.12em;
	}

	.print-cover-quote {
		max-width: 78%;
		margin: 14pt auto 0 !important;
		text-align: left;
	}

	.print-copyright {
		margin-top: 18pt;
		font-size: 10pt;
		color: #667085;
		text-transform: uppercase;
		letter-spacing: 0.08em;
	}
}

@media screen {
	/* Final theme consistency layer. Keep it last so legacy hard-coded rules cannot win. */
	.pg-book-layout-wrapper {
		--pg-book-ui-surface: rgba(255, 255, 255, 0.92);
		--pg-book-ui-surface-soft: rgba(255, 255, 255, 0.72);
		--pg-book-ui-surface-strong: rgba(255, 255, 255, 0.98);
		--pg-book-ui-text: var(--pg-text, #1e293b);
		--pg-book-ui-muted: var(--pg-muted, #475569);
		--pg-book-ui-border: var(--pg-border, rgba(28, 36, 52, 0.10));
		--pg-book-ui-border-strong: var(--pg-border-strong, rgba(28, 36, 52, 0.16));
		--pg-book-stage-bg: rgba(255, 255, 255, 0.46);
		--pg-book-stage-border: rgba(18, 199, 244, 0.12);
		--pg-book-stage-shadow: inset 0 0 40px rgba(18, 199, 244, 0.03), 0 12px 34px rgba(15, 23, 42, 0.04);
		--pg-book-paper-glow: rgba(255, 255, 255, 0.92);
		--pg-book-paper-bg-end: #fffaf0;
		--pg-book-page-border: rgba(16, 24, 40, 0.07);
		--pg-book-footer-text: #667085;
		--pg-book-cover-badge-bg: rgba(18, 199, 244, 0.10);
		--pg-book-cover-badge-text: #0f7490;
		--pg-book-cover-badge-border: rgba(18, 199, 244, 0.18);
		background:
			radial-gradient(circle at 70% 10%, rgba(18, 199, 244, 0.08), transparent 32%),
			linear-gradient(180deg, var(--pg-bg, #f4f8fc), #eefaff);
		color: var(--pg-book-ui-text);
		color-scheme: light;
	}

	body.pg-theme-dark .pg-book-layout-wrapper {
		--pg-book-ui-surface: rgba(15, 23, 42, 0.84);
		--pg-book-ui-surface-soft: rgba(15, 23, 42, 0.68);
		--pg-book-ui-surface-strong: rgba(15, 23, 42, 0.96);
		--pg-book-ui-text: var(--pg-text, #ffffff);
		--pg-book-ui-muted: var(--pg-muted, rgba(255, 255, 255, 0.74));
		--pg-book-ui-border: rgba(255, 255, 255, 0.14);
		--pg-book-ui-border-strong: rgba(255, 255, 255, 0.24);
		--pg-book-stage-bg: rgba(15, 23, 42, 0.42);
		--pg-book-stage-border: rgba(18, 199, 244, 0.16);
		--pg-book-stage-shadow: inset 0 0 42px rgba(18, 199, 244, 0.06), 0 16px 42px rgba(0, 0, 0, 0.22);
		background:
			radial-gradient(circle at 70% 10%, rgba(18, 199, 244, 0.12), transparent 34%),
			linear-gradient(180deg, #07111f, #020617);
		color-scheme: dark;
	}

	.pg-book-layout-wrapper.book-theme-light {
		--book-paper-bg: #fffdf7;
		--book-paper-text: #201a15;
		--book-paper-text-title: #151923;
		--book-paper-text-quote: #3f352d;
		--book-muted: #667085;
		--book-line: rgba(17, 24, 39, 0.12);
		--pg-book-paper-glow: rgba(255, 255, 255, 0.94);
		--pg-book-paper-bg-end: #fff7e8;
		--pg-book-page-border: rgba(16, 24, 40, 0.07);
		--pg-book-footer-text: #667085;
		--pg-book-cover-badge-bg: rgba(18, 199, 244, 0.10);
		--pg-book-cover-badge-text: #0f7490;
		--pg-book-cover-badge-border: rgba(18, 199, 244, 0.18);
	}

	.pg-book-layout-wrapper.book-theme-dark {
		--book-paper-bg: #18202c;
		--book-paper-text: #e2e8f0;
		--book-paper-text-title: #f8fafc;
		--book-paper-text-quote: #cbd5e1;
		--book-muted: rgba(226, 232, 240, 0.72);
		--book-line: rgba(255, 255, 255, 0.14);
		--book-accent-soft: rgba(18, 199, 244, 0.12);
		--book-purple-soft: rgba(122, 92, 255, 0.14);
		--pg-book-paper-glow: rgba(255, 255, 255, 0.05);
		--pg-book-paper-bg-end: #111827;
		--pg-book-page-border: rgba(255, 255, 255, 0.10);
		--pg-book-footer-text: rgba(226, 232, 240, 0.70);
		--pg-book-cover-badge-bg: rgba(18, 199, 244, 0.14);
		--pg-book-cover-badge-text: #a5f3fc;
		--pg-book-cover-badge-border: rgba(18, 199, 244, 0.24);
	}

	.pg-book-layout-wrapper.book-theme-night {
		--book-paper-bg: #090c10;
		--book-paper-text: #cbd5e1;
		--book-paper-text-title: #f8fafc;
		--book-paper-text-quote: #aab7c8;
		--book-muted: rgba(203, 213, 225, 0.68);
		--book-line: rgba(255, 255, 255, 0.12);
		--book-accent-soft: rgba(18, 199, 244, 0.10);
		--book-purple-soft: rgba(122, 92, 255, 0.12);
		--pg-book-paper-glow: rgba(255, 255, 255, 0.035);
		--pg-book-paper-bg-end: #05070a;
		--pg-book-page-border: rgba(255, 255, 255, 0.08);
		--pg-book-footer-text: rgba(203, 213, 225, 0.64);
		--pg-book-cover-badge-bg: rgba(18, 199, 244, 0.12);
		--pg-book-cover-badge-text: #8eeeff;
		--pg-book-cover-badge-border: rgba(18, 199, 244, 0.20);
	}

	.pg-book-layout-wrapper .pg-book-stage {
		background: var(--pg-book-stage-bg) !important;
		border-color: var(--pg-book-stage-border) !important;
		box-shadow: var(--pg-book-stage-shadow) !important;
	}

	.pg-book-sidebar .pg-card,
	.pg-book-related-card,
	.pg-book-quick-toc-dropdown,
	.pg-book-toolbar-inner {
		background: var(--pg-book-ui-surface) !important;
		border-color: var(--pg-book-ui-border) !important;
		color: var(--pg-book-ui-text) !important;
		box-shadow: var(--pg-shadow-soft, 0 18px 55px rgba(15, 23, 42, 0.08)) !important;
	}

	.pg-book-card-title,
	.pg-book-meta-author-name,
	.pg-book-toc-title,
	.pg-book-tools-title,
	.pg-book-related-title,
	.pg-book-related-card-title a,
	.pg-book-related-card-author span,
	.pg-book-quick-toc-header {
		color: var(--pg-book-ui-text) !important;
		overflow-wrap: anywhere;
	}

	.pg-book-meta-author-desc,
	.pg-book-meta-detail-item,
	.pg-book-tool-label,
	.pg-book-toc-item,
	.pg-book-related-card-excerpt,
	.pg-book-related-card-date,
	.pg-book-related-empty,
	.pg-book-quick-toc-close,
	.pg-book-quick-toc-item,
	.pg-book-quick-toc-page-num,
	.pg-book-sidebar-progress-label,
	.pg-book-progress-label {
		color: var(--pg-book-ui-muted) !important;
	}

	.pg-book-meta-author-link,
	.pg-book-sidebar-progress,
	.pg-book-related-card-footer,
	.pg-book-related-card-media,
	.pg-book-toolbar-actions {
		border-color: var(--pg-book-ui-border) !important;
	}

	.pg-book-btn-group,
	.pg-book-tool-btn-full,
	.pg-book-toolbar-action-btn,
	.pg-book-mobile-left-btn {
		background: var(--pg-book-ui-surface-soft) !important;
		border-color: var(--pg-book-ui-border) !important;
		color: var(--pg-book-ui-text) !important;
	}

	.pg-book-tool-btn {
		color: var(--pg-book-ui-muted) !important;
	}

	.pg-book-tool-btn:hover,
	.pg-book-tool-btn.is-active,
	.pg-book-toolbar-action-btn:hover,
	.pg-book-toolbar-action-btn.is-active,
	.pg-book-quick-toc-item:hover,
	.pg-book-quick-toc-item.is-active {
		background: var(--pg-book-ui-surface-strong) !important;
		color: var(--pg-primary, #00d4ff) !important;
	}

	.pg-book-tool-btn-full:hover,
	.pg-book-mobile-left-btn:hover,
	.pg-book-mobile-left-btn:active {
		background: var(--pg-gradient, linear-gradient(135deg, #00d4ff, #a855f7)) !important;
		border-color: transparent !important;
		color: #ffffff !important;
	}

	.pg-book-layout-wrapper .pg-book-pages-wrap {
		background: var(--book-paper-bg, #fffdf7) !important;
	}

	.pg-book-layout-wrapper .pg-book-page {
		background:
			radial-gradient(circle at 50% 12%, var(--pg-book-paper-glow), transparent 36%),
			linear-gradient(180deg, var(--book-paper-bg, #fffdf7), var(--pg-book-paper-bg-end, var(--book-paper-bg, #fffdf7))) !important;
		border-color: var(--pg-book-page-border) !important;
		color: var(--book-paper-text, #201a15) !important;
	}

	.pg-book-layout-wrapper .pg-book-page-content,
	.pg-book-layout-wrapper .pg-book-page-content p,
	.pg-book-layout-wrapper .pg-book-page-content li,
	.pg-book-layout-wrapper .pg-book-page-content td,
	.pg-book-layout-wrapper .pg-book-page-content th {
		color: var(--book-paper-text, #201a15);
	}

	.pg-book-layout-wrapper .pg-book-page-footer {
		color: var(--pg-book-footer-text) !important;
		border-top-color: var(--pg-book-page-border) !important;
		text-shadow: none !important;
	}

	.pg-book-cover-logo,
	.pg-book-page-content a {
		color: var(--pg-primary, #00d4ff) !important;
	}

	.pg-book-cover-series-badge {
		max-width: 100%;
		white-space: normal;
		color: var(--pg-book-cover-badge-text) !important;
		background: var(--pg-book-cover-badge-bg) !important;
		border-color: var(--pg-book-cover-badge-border) !important;
		text-shadow: none !important;
		overflow-wrap: anywhere;
	}

	.pg-book-cover-divider,
	.pg-book-cover-meta-time,
	.pg-book-cover-author-meta,
	.pg-book-img-caption,
	.pg-book-page-content figcaption,
	.pg-book-page-content .wp-element-caption {
		color: var(--pg-book-footer-text) !important;
	}

	.pg-book-cover-title,
	.pg-book-cover-author-name,
	.pg-book-page-content .book-heading--h2,
	.pg-book-page-content .book-heading--h3,
	.pg-book-page-content .book-heading--h4,
	.pg-book-page-content .book-heading--h5,
	.pg-book-page-content .book-heading--h6 {
		color: var(--book-paper-text-title, #151923) !important;
		overflow-wrap: anywhere;
	}

	.pg-book-cover-quote,
	.pg-book-page-content blockquote {
		color: var(--book-paper-text-quote, #3f352d) !important;
		border-color: var(--pg-book-cover-badge-border, rgba(18, 199, 244, 0.20)) !important;
		background: linear-gradient(135deg, var(--book-accent-soft, rgba(17, 199, 243, 0.10)), var(--book-purple-soft, rgba(122, 92, 255, 0.10))) !important;
	}

	.book-table-wrap,
	.pg-book-page-content pre {
		border-color: var(--book-line, rgba(17, 24, 39, 0.12)) !important;
		background: color-mix(in srgb, var(--book-paper-bg, #fffdf7) 82%, var(--book-cyan, #11c7f3) 18%) !important;
	}

	.pg-book-page-content table,
	.pg-book-page-content th,
	.pg-book-page-content td {
		color: var(--book-paper-text, #201a15) !important;
		border-color: var(--book-line, rgba(17, 24, 39, 0.12)) !important;
	}

	.reader-audio-controls--book .reader-audio-btn {
		color: var(--pg-book-ui-text) !important;
		background: linear-gradient(135deg, rgba(18, 199, 244, 0.12), rgba(122, 92, 255, 0.12)) !important;
		border-color: var(--pg-book-ui-border) !important;
	}

	.reader-audio-controls--book .reader-audio-btn.is-playing,
	.reader-audio-controls--book .reader-audio-btn.is-paused {
		color: #ffffff !important;
		background: var(--pg-gradient, linear-gradient(135deg, #00d4ff, #a855f7)) !important;
		border-color: transparent !important;
	}

	.reader-audio-controls--book .reader-audio-btn:disabled {
		color: var(--pg-book-ui-muted) !important;
		background: var(--pg-book-ui-surface-soft) !important;
	}

	@media (min-width: 1025px) {
		.pg-book-layout-inner {
			grid-template-columns: clamp(280px, 24vw, 340px) minmax(0, 1fr);
			gap: clamp(1rem, 2vw, 2rem);
			max-width: min(var(--pg-container, 1280px), calc(100vw - 2rem));
		}

		.pg-book-stage,
		.pg-book-stage-inner {
			min-width: 0;
			max-width: 100%;
		}

		.pg-book-stage {
			padding: clamp(1rem, 1.6vw, 1.5rem);
		}

		.pg-book-stage-inner {
			width: 100%;
		}

		.pg-book-container {
			width: min(100%, 900px, calc((100vh - var(--pg-header-height, 80px) - 4rem) * 900 / 590));
			height: auto;
			aspect-ratio: 900 / 590;
			max-height: none;
		}
	}

	@media (min-width: 1025px) and (max-width: 1180px) {
		.pg-book-layout-inner {
			grid-template-columns: minmax(260px, 300px) minmax(0, 1fr);
			padding-inline: 1rem;
		}
	}

	@media (max-width: 1024px) {
		.pg-book-layout-wrapper .pg-book-stage {
			background: transparent !important;
			border-color: transparent !important;
			box-shadow: none !important;
		}

		.pg-book-cover-title,
		.pg-book-page-content .book-heading,
		.pg-book-page-content p,
		.pg-book-page-content li {
			overflow-wrap: anywhere;
			word-break: normal;
		}
	}
}
