.fb-reader-wrap {
	max-width: 1520px; /* was 1300px - widened to fit the new sidebar */
	margin: 0 auto;
	text-align: center;
}

/* Breadcrumb - shown above the toolbar, and (unlike the theme's own
   breadcrumb) still visible while the reader is in fullscreen, since
   that's the one moment the rest of the page's header disappears. */
.fb-breadcrumb {
	display: flex;
	align-items: center;
	justify-content: flex-start;
	gap: 8px;
	text-align: left;
	font-size: 13px;
	color: #666;
	margin: 0 0 14px;
	padding: 6px 4px;
}

.fb-breadcrumb a {
	color: #2271b1;
	text-decoration: none;
}

.fb-breadcrumb a:hover {
	text-decoration: underline;
}

.fb-breadcrumb-sep {
	color: #aaa;
}

.fb-breadcrumb-current {
	color: #444;
	font-weight: 600;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
	max-width: 60vw;
}

.fb-reader-wrap:fullscreen .fb-breadcrumb,
.fb-reader-wrap:-webkit-full-screen .fb-breadcrumb,
.fb-reader-wrap.fb-fullscreen-fallback .fb-breadcrumb {
	flex-shrink: 0;
	color: #ddd;
	padding: 12px 24px;
}

.fb-reader-wrap:fullscreen .fb-breadcrumb a,
.fb-reader-wrap:-webkit-full-screen .fb-breadcrumb a,
.fb-reader-wrap.fb-fullscreen-fallback .fb-breadcrumb a {
	color: #9cc4e4;
}

.fb-reader-wrap:fullscreen .fb-breadcrumb-current,
.fb-reader-wrap:-webkit-full-screen .fb-breadcrumb-current,
.fb-reader-wrap.fb-fullscreen-fallback .fb-breadcrumb-current {
	color: #eee;
}

/* Two-column layout: the reader on the left, a "keep reading" sidebar on
   the right (page thumbnails + other books). Outside fullscreen only -
   in fullscreen the book is the whole point, so the sidebar steps aside
   entirely (see the :fullscreen rule further down). */
.fb-reader-layout {
	display: flex;
	align-items: flex-start;
	gap: 28px;
	text-align: left;
}

.fb-reader-main {
	flex: 1 1 auto;
	min-width: 0;
	text-align: center;
}

.fb-reader-sidebar {
	flex: 0 0 260px;
	width: 260px;
	position: sticky;
	top: 90px;
	max-height: calc(100vh - 110px);
	overflow-y: auto;
	padding-right: 4px;
}

.fb-sidebar-section {
	margin-bottom: 26px;
}

.fb-sidebar-section:last-child {
	margin-bottom: 0;
}

.fb-sidebar-heading {
	font-family: 'IBM Plex Mono', 'Courier New', monospace;
	font-size: 12px;
	font-weight: 500;
	text-transform: uppercase;
	letter-spacing: .12em;
	color: #A97C34;
	margin: 0 0 14px;
}

/* Page thumbnails ("Contents") - click one to jump straight to that page. */
.fb-toc-list {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
}

.fb-toc-loading {
	font-size: 12px;
	color: #999;
	font-style: italic;
	margin: 0;
}

.fb-toc-thumb {
	position: relative;
	width: 54px;
	height: 72px;
	padding: 0;
	border: 2px solid transparent;
	border-radius: 3px;
	overflow: hidden;
	background: #eee;
	cursor: pointer;
}

.fb-toc-thumb img {
	width: 100% !important;
	height: 100% !important;
	max-width: none !important;
	object-fit: cover;
	display: block;
	margin: 0 !important;
	border-radius: 0 !important;
}

.fb-toc-thumb .fb-toc-num {
	position: absolute;
	bottom: 0;
	right: 0;
	background: rgba(0, 0, 0, .65);
	color: #fff;
	font-size: 9px;
	line-height: 1.6;
	padding: 0 4px;
	border-top-left-radius: 3px;
}

.fb-toc-thumb:hover {
	border-color: #2271b1;
}

.fb-toc-thumb.fb-toc-active {
	border-color: #2271b1;
	box-shadow: 0 0 0 1px #2271b1;
}

/* Other books, so a reader can switch titles without leaving the reader. */
.fb-sidebar-books {
	display: flex;
	flex-direction: column;
	gap: 16px;
}

.fb-sidebar-book {
	display: flex;
	align-items: center;
	gap: 12px;
	text-decoration: none !important;
	color: inherit !important;
}

.fb-sidebar-book-cover {
	flex: 0 0 48px;
	width: 48px !important;
	height: 64px !important;
	border-radius: 3px;
	overflow: hidden;
	background: #eee;
	display: flex;
	align-items: center;
	justify-content: center;
}

.fb-sidebar-book-cover img {
	width: 100% !important;
	height: 100% !important;
	max-width: none !important;
	object-fit: cover;
	display: block;
	margin: 0 !important;
	border-radius: 0 !important;
}

.fb-sidebar-book-fallback {
	font-size: 16px;
}

.fb-sidebar-book-title {
	font-family: 'Source Serif 4', Georgia, 'Times New Roman', serif;
	font-weight: 600;
	font-size: 15px;
	line-height: 1.35;
	color: #20242B !important;
	text-decoration: none !important;
}

.fb-sidebar-book:hover .fb-sidebar-book-title {
	color: #A97C34 !important;
}

.fb-reader-wrap:fullscreen .fb-reader-sidebar,
.fb-reader-wrap:-webkit-full-screen .fb-reader-sidebar,
.fb-reader-wrap.fb-fullscreen-fallback .fb-reader-sidebar {
	display: none;
}

@media (max-width: 960px) {
	.fb-reader-layout {
		flex-direction: column;
	}
	.fb-reader-sidebar {
		width: 100%;
		flex-basis: auto;
		position: static;
		max-height: none;
		order: 3;
	}
	.fb-toc-list {
		justify-content: center;
	}
}

/* Real browser fullscreen (via the Fullscreen API) - fill the whole screen
   and let the book itself grow to fit, instead of staying at its normal
   in-page size. */
.fb-reader-wrap:fullscreen {
	max-width: none;
	width: 100vw;
	height: 100vh;
	background: #2c2c2c;
	display: flex;
	flex-direction: column;
	justify-content: center;
	padding: 20px 0;
}

.fb-reader-wrap:-webkit-full-screen {
	max-width: none;
	width: 100vw;
	height: 100vh;
	background: #2c2c2c;
	display: flex;
	flex-direction: column;
	justify-content: center;
	padding: 20px 0;
}

/* Manual fallback fullscreen - used whenever the real Fullscreen API is
   unavailable or blocked (common inside page-builder iframes, some
   security/Permissions-Policy setups, or older browsers). This guarantees
   the fullscreen button always visibly works, even when the browser API
   silently refuses the request. */
.fb-reader-wrap.fb-fullscreen-fallback {
	position: fixed;
	inset: 0;
	z-index: 999999;
	max-width: none;
	width: 100vw;
	height: 100vh;
	background: #2c2c2c;
	display: flex;
	flex-direction: column;
	justify-content: center;
	padding: 20px 0;
	overflow-y: auto;
}

body.fb-fullscreen-lock {
	overflow: hidden;
}

.fb-reader-wrap:fullscreen .fb-book-container,
.fb-reader-wrap:-webkit-full-screen .fb-book-container,
.fb-reader-wrap.fb-fullscreen-fallback .fb-book-container {
	margin: 0 auto;
}

.fb-reader-wrap:fullscreen .fb-toolbar,
.fb-reader-wrap:-webkit-full-screen .fb-toolbar,
.fb-reader-wrap.fb-fullscreen-fallback .fb-toolbar {
	flex-shrink: 0;
}

.fb-book-cover {
	position: relative;
	display: block;
	width: 100%;
	max-width: 1160px;
	margin: 0 auto;
	box-sizing: border-box;
	background: #6b4226;
	padding: 16px;
	border-radius: 20px;
	overflow: hidden;
	box-shadow: 0 20px 40px rgba(0, 0, 0, 0.25), 0 4px 10px rgba(0, 0, 0, 0.15);
}

.fb-reader-wrap:fullscreen .fb-book-cover,
.fb-reader-wrap:-webkit-full-screen .fb-book-cover,
.fb-reader-wrap.fb-fullscreen-fallback .fb-book-cover {
	margin: 0 auto;
}

.fb-spine-shadow {
	position: absolute;
	top: 16px;
	bottom: 16px;
	left: 50%;
	width: 46px;
	margin-left: -23px;
	pointer-events: none;
	z-index: 5;
	background: linear-gradient(
		to right,
		rgba(0, 0, 0, 0.14),
		rgba(0, 0, 0, 0) 20%,
		rgba(0, 0, 0, 0) 80%,
		rgba(0, 0, 0, 0.14)
	);
}

.fb-turn-hint {
	font-size: 13px;
	color: #777;
	margin: 12px 0 0;
	transition: opacity 0.4s ease;
}

.fb-turn-hint.fb-hint-hidden {
	opacity: 0;
	height: 0;
	margin: 0;
	overflow: hidden;
}

/* Corner-fold hint - a small persistent pulse showing where to click,
   fades away permanently after the reader's first successful page turn. */
.fb-corner-hint {
	position: absolute;
	bottom: 26px;
	right: 26px;
	width: 22px;
	height: 22px;
	border-radius: 5px;
	background: #2271b1;
	display: flex;
	align-items: center;
	justify-content: center;
	color: #fff;
	font-size: 13px;
	z-index: 6;
	pointer-events: none;
	animation: fb-corner-pulse 1.8s ease-in-out infinite;
	transition: opacity 0.3s ease;
}

.fb-corner-hint.fb-hint-hidden {
	opacity: 0;
}

@keyframes fb-corner-pulse {
	0%, 100% { opacity: 0.4; transform: scale(1); }
	50% { opacity: 0.95; transform: scale(1.18); }
}

/* Click zones overlaid on the book so the whole page is clickable to turn,
   not just the Prev/Next buttons - with a hover arrow so it's obvious. */
.fb-click-zone {
	position: absolute;
	top: 0;
	bottom: 0;
	width: 50%;
	z-index: 4;
	display: flex;
	align-items: center;
	cursor: pointer;
	opacity: 0;
	transition: opacity 0.15s ease;
	color: #2271b1;
	font-size: 26px;
}

.fb-click-zone:hover {
	opacity: 1;
}

.fb-click-zone-prev {
	left: 0;
	justify-content: flex-start;
	padding-left: 14px;
}

.fb-click-zone-next {
	right: 0;
	justify-content: flex-end;
	padding-right: 14px;
}

@media (prefers-reduced-motion: reduce) {
	.fb-corner-hint {
		animation: none;
	}
}

.fb-toolbar {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 16px;
	margin-bottom: 12px;
}

.fb-btn {
	background: #2c3e50;
	color: #fff;
	border: none;
	padding: 8px 16px;
	border-radius: 4px;
	cursor: pointer;
	font-size: 14px;
}

.fb-btn:hover {
	background: #1a252f;
}

.fb-btn-primary {
	background: #2271b1;
}

.fb-fullscreen-btn {
	margin-left: auto;
}

.fb-reader-wrap:fullscreen .fb-page-indicator,
.fb-reader-wrap:-webkit-full-screen .fb-page-indicator,
.fb-reader-wrap.fb-fullscreen-fallback .fb-page-indicator {
	color: #eee;
}

.fb-page-indicator {
	font-size: 14px;
	color: #444;
}

.fb-book-container {
	margin: 0 auto;
	background: #eee;
	visibility: hidden;
}

.fb-book-container.fb-ready {
	visibility: visible;
}

/* Fallback: interactive flip library failed to load. Show pages as a
   plain, scrollable, single-column stack instead of a broken layout. */
.fb-book-container.fb-fallback-mode {
	visibility: visible;
	display: flex;
	flex-direction: column;
	gap: 16px;
	max-height: 80vh;
	overflow-y: auto;
	background: transparent;
}

.fb-fallback-notice {
	font-size: 13px;
	color: #856404;
	background: #fff3cd;
	border: 1px solid #ffeeba;
	border-radius: 6px;
	padding: 8px 12px;
	margin: 0 0 12px;
}

.fb-page {
	background-color: #f6ecd8;
}

.fb-page img {
	width: 100%;
	height: 100%;
	object-fit: contain;
	display: block;
}

.fb-loading {
	padding: 40px;
	font-style: italic;
	color: #666;
}

/* Quiz modal */
.fb-quiz-modal {
	position: fixed;
	inset: 0;
	background: rgba(0, 0, 0, 0.6);
	display: flex;
	align-items: center;
	justify-content: center;
	z-index: 100000;
}

.fb-quiz-box {
	background: #fff;
	max-width: 520px;
	width: 90%;
	padding: 28px;
	border-radius: 8px;
	max-height: 80vh;
	overflow-y: auto;
}

.fb-quiz-box h3 {
	margin-top: 0;
}

.fb-modal-question {
	margin-bottom: 20px;
	text-align: left;
}

.fb-modal-option {
	display: block;
	margin: 6px 0;
	cursor: pointer;
}

.fb-quiz-feedback {
	min-height: 24px;
	font-weight: bold;
	margin: 10px 0;
}

.fb-quiz-feedback.fb-correct {
	color: #1a7f37;
}

.fb-quiz-feedback.fb-incorrect {
	color: #b32d2e;
}
