.esgfv {
	--esgfv-height: 900px;
	--esgfv-toolbar: #3c3c3c;
	--esgfv-bg: #525659;
	--esgfv-accent: #ffffff;
	position: relative;
	display: flex;
	flex-direction: column;
	width: 100%;
	height: var(--esgfv-height);
	max-height: 100vh;
	background: var(--esgfv-bg);
	overflow: hidden;
	box-sizing: border-box;
	-webkit-user-select: none;
	user-select: none;
	-webkit-touch-callout: none;
	outline: none;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}
.esgfv *, .esgfv *::before, .esgfv *::after { box-sizing: border-box; }
.esgfv:focus-visible { box-shadow: 0 0 0 2px var(--esgfv-accent) inset; }

.esgfv:fullscreen { height: 100vh; max-height: none; }
.esgfv.esgfv-pseudo-fs { position: fixed; inset: 0; z-index: 999999; height: 100vh; height: 100dvh; max-height: none; }

/* ---- Barra strumenti ---- */
.esgfv-bar {
	flex: 0 0 48px;
	display: grid;
	grid-template-columns: 1fr auto 1fr;
	align-items: center;
	padding: 0 12px;
	background: var(--esgfv-toolbar);
	color: var(--esgfv-accent);
	box-shadow: 0 1px 4px rgba(0, 0, 0, .35);
	z-index: 3;
}
.esgfv-bar-l { justify-self: start; display: flex; align-items: center; min-width: 0; }
.esgfv-bar-c { display: flex; align-items: center; gap: 4px; }
.esgfv-bar-r { justify-self: end; display: flex; align-items: center; }
.esgfv-logo { max-height: 36px; max-width: 140px; width: auto; display: block; pointer-events: none; }

.esgfv-btn {
	display: inline-flex; align-items: center; justify-content: center;
	width: 36px; height: 36px; padding: 0; margin: 0;
	background: transparent; border: 0; border-radius: 4px;
	color: var(--esgfv-accent); cursor: pointer; line-height: 0;
	transition: background-color .15s;
}
.esgfv-btn:hover:not(:disabled) { background: rgba(255, 255, 255, .12); }
.esgfv-btn:focus-visible { outline: 2px solid var(--esgfv-accent); outline-offset: -2px; }
.esgfv-btn:disabled { opacity: .35; cursor: default; }
.esgfv-sep { width: 12px; }

.esgfv-page {
	width: 66px; height: 30px; margin: 0 6px; padding: 0 4px;
	border: 0; border-radius: 3px; background: #fff; color: #222;
	font-size: 14px; text-align: center;
	-webkit-user-select: text; user-select: text;
}

/* ---- Area pagine ---- */
.esgfv-stage {
	position: relative;
	flex: 1 1 auto;
	display: flex;
	overflow: hidden;
	perspective: 2200px;
	padding: 16px;
}
.esgfv.esgfv-zoomed .esgfv-stage { overflow: auto; }

.esgfv-view {
	position: relative;
	margin: auto;
	display: flex;
	transform-style: preserve-3d;
	backface-visibility: hidden;
}
.esgfv-leaving { position: absolute; z-index: 2; }

.esgfv-sheet {
	background: #fff;
	box-shadow: 0 2px 10px rgba(0, 0, 0, .45);
	line-height: 0;
}
.esgfv-canvas { display: block; pointer-events: none; -webkit-user-drag: none; }

.esgfv-double .esgfv-view .esgfv-sheet + .esgfv-sheet { box-shadow: 0 2px 10px rgba(0, 0, 0, .45), inset 12px 0 18px -12px rgba(0, 0, 0, .35); }

/* Effetto sfogliatura */
.esgfv-turn-next { transform-origin: left center; animation: esgfv-next .55s ease-in forwards; }
.esgfv-turn-prev { transform-origin: right center; animation: esgfv-prev .55s ease-in forwards; }
@keyframes esgfv-next {
	0%   { transform: rotateY(0); opacity: 1; filter: brightness(1); }
	100% { transform: rotateY(-95deg); opacity: .2; filter: brightness(.6); }
}
@keyframes esgfv-prev {
	0%   { transform: rotateY(0); opacity: 1; filter: brightness(1); }
	100% { transform: rotateY(95deg); opacity: .2; filter: brightness(.6); }
}

.esgfv-msg { margin: auto; color: var(--esgfv-accent); font-size: 15px; opacity: .85; }

@media (max-width: 600px) {
	.esgfv-bar { padding: 0 6px; grid-template-columns: auto 1fr auto; }
	.esgfv-bar-c { justify-content: center; gap: 0; }
	.esgfv-logo { max-width: 60px; max-height: 28px; }
	.esgfv-btn { width: 32px; }
	.esgfv-sep { width: 4px; }
	.esgfv-page { width: 56px; margin: 0 2px; }
	.esgfv-stage { padding: 8px; }
}

/* In stampa lo sfogliatore non esce */
@media print {
	.esgfv { display: none !important; }
}
