.tfe-flipbook-wrap {
	--tfe-bg: #ece7dc;         /* warm paper tone, low blue-light */
	--tfe-panel: #f4f1e8;
	--tfe-ink: #3a362e;
	--tfe-accent: #6d8a5e;
	--tfe-border: #d8d0bd;
	position: relative;
	width: 100%;
	max-width: 1100px;
	margin: 0 auto;
	background: var(--tfe-bg);
	border-radius: 14px;
	padding: 14px;
	box-sizing: border-box;
	user-select: none;
	-webkit-user-select: none;
	-webkit-touch-callout: none;
}

.tfe-toolbar {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 10px;
	padding: 8px 0 14px;
	flex-wrap: wrap;
}
.tfe-btn {
	background: var(--tfe-panel);
	border: 1px solid var(--tfe-border);
	color: var(--tfe-ink);
	font-size: 18px;
	line-height: 1;
	width: 38px;
	height: 38px;
	border-radius: 8px;
	cursor: pointer;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	transition: background .15s ease;
}
.tfe-btn:hover { background: var(--tfe-accent); color: #fff; }
.tfe-page-indicator { font-size: 14px; color: var(--tfe-ink); min-width: 70px; text-align: center; font-variant-numeric: tabular-nums; }
.tfe-toolbar-sep { width: 1px; height: 22px; background: var(--tfe-border); margin: 0 4px; }

.tfe-stage {
	position: relative;
	background: var(--tfe-panel);
	border-radius: 10px;
	height: var(--tfe-height, 80vh);
	max-height: 900px;
	display: flex;
	align-items: center;
	justify-content: center;
	overflow: hidden;
	perspective: 2400px;
}

.tfe-book {
	position: relative;
	height: 92%;
	max-width: 92%;
	box-shadow: 0 10px 34px rgba(0, 0, 0, .18);
	border-radius: 4px;
	overflow: hidden;
	background: #fff;
	cursor: grab;
}
.tfe-book.tfe-zoomed { cursor: move; }

.tfe-page-img,
.tfe-flip-face img {
	display: block;
	height: 100%;
	width: auto;
	max-width: none;
	pointer-events: none; /* blocks native drag-to-save of the <img> */
	-webkit-user-drag: none;
	user-drag: none;
}

/* Flip animation layer: two faces glued back-to-back, rotated on Y axis */
.tfe-flip-layer {
	position: absolute;
	top: 0; left: 0; height: 100%; width: 100%;
	transform-style: preserve-3d;
	transform-origin: left center;
	transition: transform .55s cubic-bezier(.4, .1, .2, 1);
	pointer-events: none;
	display: none;
}
.tfe-flip-layer.tfe-flip-active { display: block; }
.tfe-flip-face {
	position: absolute;
	top: 0; left: 0; height: 100%; width: 100%;
	backface-visibility: hidden;
	overflow: hidden;
	background: #fff;
}
.tfe-flip-face.tfe-face-back { transform: rotateY(180deg); }

.tfe-watermark-note {
	position: absolute;
	bottom: 8px;
	right: 14px;
	font-size: 11px;
	color: rgba(90, 85, 70, .55);
	pointer-events: none;
	letter-spacing: .02em;
}

.tfe-protect-hint {
	font-size: 11.5px;
	color: #7c7563;
	text-align: center;
	margin: 10px 4px 2px;
}

.tfe-error { color: #a04f00; font-weight: 600; }

/* Fullscreen mode */
.tfe-flipbook-wrap:fullscreen,
.tfe-flipbook-wrap:-webkit-full-screen {
	max-width: none;
	width: 100vw;
	height: 100vh;
	display: flex;
	flex-direction: column;
}
.tfe-flipbook-wrap:fullscreen .tfe-stage,
.tfe-flipbook-wrap:-webkit-full-screen .tfe-stage {
	flex: 1;
	height: auto;
	max-height: none;
}

@media (max-width: 640px) {
	.tfe-btn { width: 34px; height: 34px; font-size: 16px; }
	.tfe-stage { height: 70vh; }
}
