/* DasBlatt eReader – Reader-Design
 * Leitbild: das gedruckte Blatt liegt unter einer Leselampe. Ruhige Bühne,
 * schlanke Bedienleiste, die zurücktritt – das Papier ist der Star.
 */
.dbe-root {
	--dbe-accent: #0b4f8a;
	--dbe-stage-1: #171c25;
	--dbe-stage-2: #0e1218;
	--dbe-ink: #e9ecf1;
	--dbe-ink-dim: #9aa3b0;
	--dbe-bar: rgba(18, 22, 30, 0.82);
	--dbe-line: rgba(255, 255, 255, 0.09);
	--dbe-height: 820px;

	position: relative;
	display: flex;
	flex-direction: column;
	height: var(--dbe-height);  /* Ausgangsgröße; JS überschreibt Stage-Höhe */
	border-radius: 14px;
	overflow: hidden;
	background: var(--dbe-stage-2);
	color: var(--dbe-ink);
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
	box-shadow: 0 24px 60px -28px rgba(0, 0, 0, 0.55), 0 0 0 1px rgba(0, 0, 0, 0.05);
	-webkit-font-smoothing: antialiased;
}
.dbe-root.dbe-standalone {
	position: fixed;
	inset: 0;
	height: 100dvh;
	border-radius: 0;
	box-shadow: none;
}

/* Vollbild: eigenes Overlay – kein Browser-Fullscreen-API, kein StPageFlip-Problem */
.dbe-fs-overlay {
	display: none;
	position: fixed;
	inset: 0;
	z-index: 99999;
	background: #0a0c11;
	flex-direction: column;
}
.dbe-fs-overlay.open { display: flex; }

.dbe-fs-bar {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 8px 14px;
	background: rgba(18, 22, 30, 0.92);
	border-bottom: 1px solid rgba(255,255,255,0.08);
	flex-shrink: 0;
}
.dbe-fs-title {
	font-size: 14px;
	font-weight: 600;
	color: var(--dbe-ink, #e9ecf1);
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
	max-width: 55%;
}
.dbe-fs-controls { display: flex; align-items: center; gap: 4px; }

.dbe-fs-stage {
	flex: 1;
	display: flex;
	align-items: center;
	justify-content: center;
	position: relative;
	overflow: hidden;
	padding: 16px;
}
.dbe-fs-img {
	max-width: 100%;
	max-height: 100%;
	object-fit: contain;
	border-radius: 3px;
	box-shadow: 0 12px 48px -8px rgba(0,0,0,0.7);
	display: block;
}
.dbe-fs-edge {
	position: absolute;
	top: 50%;
	transform: translateY(-50%);
	width: 50px;
	height: 90px;
	border: 0;
	border-radius: 12px;
	background: rgba(10,13,18,0.5);
	color: #fff;
	font-size: 28px;
	cursor: pointer;
	opacity: 0;
	transition: opacity 0.2s;
	z-index: 2;
	backdrop-filter: blur(4px);
}
.dbe-fs-edge-prev { left: 10px; }
.dbe-fs-edge-next { right: 10px; }
.dbe-fs-stage:hover .dbe-fs-edge { opacity: 0.85; }
.dbe-fs-edge:hover { background: var(--dbe-accent, #0b4f8a); opacity: 1 !important; }

/* ---------- Bedienleiste ---------- */
.dbe-toolbar {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	padding: 10px 14px;
	background: var(--dbe-bar);
	backdrop-filter: saturate(150%) blur(10px);
	-webkit-backdrop-filter: saturate(150%) blur(10px);
	border-bottom: 1px solid var(--dbe-line);
	z-index: 5;
}
.dbe-title {
	font-size: 14px;
	font-weight: 600;
	letter-spacing: 0.03em;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
	max-width: 55%;
}
.dbe-title::before {
	content: "";
	display: inline-block;
	width: 8px;
	height: 8px;
	margin-right: 9px;
	border-radius: 2px;
	background: var(--dbe-accent);
	transform: translateY(-1px);
}
.dbe-controls {
	display: flex;
	align-items: center;
	gap: 4px;
}
.dbe-btn {
	appearance: none;
	border: 0;
	background: transparent;
	color: var(--dbe-ink);
	font-size: 17px;
	line-height: 1;
	width: 38px;
	height: 38px;
	border-radius: 9px;
	cursor: pointer;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	text-decoration: none;
	transition: background 0.15s ease, transform 0.15s ease, color 0.15s ease;
}
.dbe-btn:hover { background: rgba(255, 255, 255, 0.08); }
.dbe-btn:active { transform: scale(0.94); }
.dbe-btn:focus-visible { outline: 2px solid var(--dbe-accent); outline-offset: 2px; }
.dbe-pageinfo {
	font-size: 12.5px;
	color: var(--dbe-ink-dim);
	font-variant-numeric: tabular-nums;
	letter-spacing: 0.04em;
	padding: 0 4px;
	white-space: nowrap;
}
.dbe-cur { color: var(--dbe-ink); font-weight: 600; }
.dbe-sep { width: 1px; height: 22px; background: var(--dbe-line); margin: 0 6px; }

/* ---------- Lesebühne ---------- */
.dbe-stage {
	position: relative;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: clamp(10px, 2vw, 28px);
	/* Höhe wird per JS auf Seitenhöhe gesetzt */
	overflow: hidden;
	background:
		radial-gradient(120% 90% at 50% 8%, rgba(255, 246, 224, 0.06), transparent 55%),
		radial-gradient(140% 120% at 50% 50%, var(--dbe-stage-1), var(--dbe-stage-2) 78%);
}
.dbe-flip {
	/* Breite + Höhe werden per JS gesetzt */
	position: relative;
	flex-shrink: 0;
}
/* Flip-Struktur füllt den Block vollständig aus */
.dbe-flip .stf__wrapper,
.dbe-flip .stf__block { width: 100% !important; height: 100% !important; }

/* Seiten – Papier hebt sich mit weichem Schlagschatten von der Bühne ab. */
.dbe-page {
	background: #fff;
	overflow: hidden;
}
.dbe-page .dbe-pageimg {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
	background: #fff;
}
/* StPageFlip zeichnet eigene Schatten; wir ergänzen dezente Papier-Tiefe. */
.dbe-flip .stf__item { box-shadow: 0 10px 40px -12px rgba(0, 0, 0, 0.5); }

/* Rand-Navigation (Desktop, erscheint beim Überfahren) */
.dbe-edge {
	position: absolute;
	top: 50%;
	transform: translateY(-50%);
	width: 46px;
	height: 84px;
	border: 0;
	border-radius: 12px;
	background: rgba(10, 13, 18, 0.4);
	color: #fff;
	font-size: 26px;
	cursor: pointer;
	opacity: 0;
	transition: opacity 0.2s ease, background 0.2s ease;
	z-index: 4;
	backdrop-filter: blur(4px);
}
.dbe-edge-prev { left: 10px; }
.dbe-edge-next { right: 10px; }
.dbe-stage:hover .dbe-edge { opacity: 0.9; }
.dbe-edge:hover { background: var(--dbe-accent); }
.dbe-edge:focus-visible { opacity: 1; outline: 2px solid #fff; }

/* Ladezustand */
.dbe-loading {
	position: absolute;
	inset: 0;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 14px;
	color: var(--dbe-ink-dim);
	font-size: 13.5px;
	letter-spacing: 0.03em;
	z-index: 6;
}
.dbe-ready .dbe-loading { display: none; }
.dbe-spinner {
	width: 30px;
	height: 30px;
	border-radius: 50%;
	border: 2.5px solid rgba(255, 255, 255, 0.14);
	border-top-color: var(--dbe-accent);
	animation: dbe-spin 0.8s linear infinite;
}
@keyframes dbe-spin { to { transform: rotate(360deg); } }

/* ---------- Miniaturen-Schublade ---------- */
.dbe-thumbs {
	position: absolute;
	left: 0;
	right: 0;
	bottom: 0;
	max-height: 0;
	overflow-x: auto;
	overflow-y: hidden;
	display: flex;
	gap: 10px;
	padding: 0 14px;
	background: var(--dbe-bar);
	backdrop-filter: blur(10px);
	border-top: 1px solid transparent;
	transition: max-height 0.28s ease, padding 0.28s ease, border-color 0.28s ease;
	z-index: 7;
}
.dbe-thumbs.open {
	max-height: 168px;
	padding: 14px;
	border-top-color: var(--dbe-line);
}
.dbe-thumb {
	flex: 0 0 auto;
	border: 0;
	background: transparent;
	padding: 0;
	cursor: pointer;
	position: relative;
	border-radius: 4px;
}
.dbe-thumb img {
	display: block;
	height: 120px;
	width: auto;
	border-radius: 3px;
	box-shadow: 0 4px 14px -6px rgba(0, 0, 0, 0.6);
	outline: 2px solid transparent;
	transition: outline-color 0.15s ease, transform 0.15s ease;
	background: #fff;
}
.dbe-thumb:hover img { transform: translateY(-3px); outline-color: var(--dbe-accent); }
.dbe-thumb span {
	position: absolute;
	bottom: 4px;
	right: 4px;
	font-size: 10px;
	background: rgba(0, 0, 0, 0.6);
	color: #fff;
	padding: 1px 5px;
	border-radius: 6px;
	font-variant-numeric: tabular-nums;
}

/* ---------- Zoom-Lightbox ---------- */
.dbe-lightbox {
	position: absolute;
	inset: 0;
	display: none;
	align-items: center;
	justify-content: center;
	background: rgba(6, 8, 11, 0.94);
	z-index: 10;
	overflow: hidden;
	touch-action: none;
}
.dbe-lightbox.open { display: flex; }
.dbe-lb-stage { width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; }
.dbe-lb-stage img {
	max-width: 100%;
	max-height: 100%;
	transform-origin: center center;
	cursor: grab;
	will-change: transform;
	user-select: none;
	-webkit-user-drag: none;
}
.dbe-lb-stage img:active { cursor: grabbing; }
.dbe-lb-close {
	position: absolute;
	top: 14px;
	right: 16px;
	width: 42px;
	height: 42px;
	border: 0;
	border-radius: 50%;
	background: rgba(255, 255, 255, 0.12);
	color: #fff;
	font-size: 17px;
	cursor: pointer;
	z-index: 2;
}
.dbe-lb-close:hover { background: var(--dbe-accent); }

/* ---------- Standalone / nicht gefunden ---------- */
.dbe-notfound {
	color: #dfe3ea;
	text-align: center;
	padding: 18vh 20px;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}
.dbe-missing {
	padding: 16px;
	border: 1px dashed #c9ced6;
	border-radius: 10px;
	color: #5a6472;
	font-size: 14px;
}

/* ---------- Mobil ---------- */
@media (max-width: 640px) {
	.dbe-root { --dbe-height: 78vh; border-radius: 10px; }
	.dbe-title { max-width: 40%; font-size: 13px; }
	.dbe-btn { width: 34px; height: 34px; font-size: 16px; }
	.dbe-edge { display: none; }
	.dbe-thumb img { height: 96px; }
}

@media (prefers-reduced-motion: reduce) {
	.dbe-btn, .dbe-edge, .dbe-thumbs, .dbe-thumb img { transition: none; }
	.dbe-spinner { animation-duration: 1.6s; }
}

/* ---------- Archiv-Leiste (unter dem Reader) ---------- */
.dbe-wrap {
	display: flex;
	flex-direction: column;
	gap: 0;
}

.dbe-archive-panel {
	background: #13171f;
	border-top: 1px solid rgba(255,255,255,0.07);
	border-radius: 0 0 14px 14px;
	padding: 10px 12px 12px;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}
.dbe-archive-head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	margin-bottom: 8px;
}
.dbe-archive-head-label {
	font-size: 10px;
	font-weight: 700;
	letter-spacing: 0.1em;
	text-transform: uppercase;
	color: #6b7585;
}
.dbe-archive-head-count {
	font-size: 10px;
	color: #4a5163;
}
.dbe-archive-list {
	display: flex;
	flex-direction: row;
	gap: 6px;
	overflow-x: auto;
	overflow-y: hidden;
	paddding-bottom: 2px;
	-webkit-overflow-scrolling: touch;
	scrollbar-width: thin;
	scrollbar-color: rgba(255,255,255,0.12) transparent;
}
.dbe-archive-list::-webkit-scrollbar { height: 3px; }
.dbe-archive-list::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.12); border-radius: 2px; }
.dbe-archive-item {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 5px;
	min-width: 58px;
	max-width: 58px;
	padding: 6px 5px;
	border-radius: 6px;
	border: 1px solid transparent;
	background: transparent;
	cursor: pointer;
	transition: background 0.15s;
}
.dbe-archive-item:hover { background: rgba(255,255,255,0.05); }
.dbe-archive-item--active {
	background: rgba(11,79,138,0.25);
	border-color: #0b4f8a;
}
.dbe-archive-thumb {
	width: 38px;
	height: 54px;
	object-fit: cover;
	object-position: top;
	border-radius: 2px;
	background: #2a2f3a;
	flex-shrink: 0;
}
.dbe-archive-label {
	font-size: 9px;
	color: #6b7585;
	text-align: center;
	line-height: 1.3;
	word-break: break-word;
	max-width: 52px;
}
.dbe-archive-item--active .dbe-archive-label { color: #a8c4e8; font-weight: 500; }
