/* Magazin Flipbook 1.2.0 */
.mfb {
  --mfb-bg: #2b2d31;
  --mfb-bar: #1e1f22;
  --mfb-fg: #e8e8ea;
  --mfb-accent: #e0a526;
  position: relative;
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 80vh;
  min-height: 360px;
  background: var(--mfb-bg);
  background-image: radial-gradient(ellipse at center, rgba(255,255,255,.07), transparent 70%);
  color: var(--mfb-fg);
  border-radius: 8px;
  overflow: hidden;
  font: 14px/1.3 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  outline: none;
  box-sizing: border-box;
  user-select: none;
  -webkit-user-select: none;
}
.mfb *, .mfb *::before, .mfb *::after { box-sizing: border-box; }
.mfb:focus-visible { box-shadow: 0 0 0 3px var(--mfb-accent); }

.mfb.mfb-fs, .mfb.mfb-pseudo-fs { height: 100% !important; border-radius: 0; }
.mfb.mfb-pseudo-fs { position: fixed; inset: 0; z-index: 2147483000; }
html.mfb-noscroll { overflow: hidden; }

/* Bühne */
.mfb-stage { position: relative; flex: 1 1 auto; min-height: 0; }
.mfb-viewport {
  position: absolute; inset: 0;
  display: flex;
  overflow: hidden;
  padding: 12px;
  touch-action: pan-y pinch-zoom;
  cursor: pointer;
}
.mfb-zoomed .mfb-viewport { overflow: auto; cursor: grab; touch-action: none; }
.mfb-grabbing .mfb-viewport { cursor: grabbing; }

.mfb-book {
  position: relative;
  margin: auto;
  flex: 0 0 auto;
  perspective: 2600px;
  transition: transform .5s cubic-bezier(.45,.05,.35,1);
}
.mfb-zoomed .mfb-book, .mfb-noanim .mfb-book { transition: none; }

/* Seiten */
.mfb-page {
  position: absolute;
  top: 0;
  width: var(--mfb-pw);
  height: 100%;
  background: #fff;
  overflow: hidden;
}
.mfb-page canvas { display: block; width: 100%; height: 100%; }
.mfb-left { left: 0; box-shadow: -6px 6px 24px rgba(0,0,0,.35); }
.mfb-right { left: var(--mfb-pw); box-shadow: 6px 6px 24px rgba(0,0,0,.35); }
.mfb-single .mfb-right { left: 0; box-shadow: 0 6px 28px rgba(0,0,0,.4); }
.mfb-single .mfb-left { display: none; }
.mfb-page.mfb-empty { background: transparent; box-shadow: none; }
.mfb-page.mfb-pending {
  background: linear-gradient(100deg, #f3f3f3 30%, #fafafa 50%, #f3f3f3 70%) 0 0 / 300% 100%;
  animation: mfb-shimmer 1.4s linear infinite;
}
@keyframes mfb-shimmer { to { background-position: -150% 0; } }

/* Falz in der Mitte */
.mfb-double .mfb-left:not(.mfb-empty)::after,
.mfb-double .mfb-right:not(.mfb-empty)::after,
.mfb-double .mfb-face::after {
  content: ""; position: absolute; top: 0; bottom: 0; width: 12%;
  pointer-events: none;
}
.mfb-double .mfb-left::after, .mfb-double .mfb-flip-back .mfb-front::after, .mfb-double .mfb-flip-fwd .mfb-back::after {
  right: 0; background: linear-gradient(to left, rgba(0,0,0,.22), transparent);
}
.mfb-double .mfb-right::after, .mfb-double .mfb-flip-fwd .mfb-front::after, .mfb-double .mfb-flip-back .mfb-back::after {
  left: 0; background: linear-gradient(to right, rgba(0,0,0,.22), transparent);
}
.mfb-shade { position: absolute; inset: 0; background: #000; opacity: 0; pointer-events: none; }

/* Umblättern */
.mfb-flipper {
  position: absolute; top: 0;
  width: var(--mfb-pw); height: 100%;
  transform-style: preserve-3d;
  z-index: 5;
  pointer-events: none;
}
.mfb-flip-fwd { left: var(--mfb-pw); transform-origin: left center; }
.mfb-flip-back { left: 0; transform-origin: right center; }
.mfb-flip-single { left: 0; transform-origin: left center; }
.mfb-face {
  left: 0 !important;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  box-shadow: 0 0 30px rgba(0,0,0,.3);
}
.mfb-face.mfb-empty { background: #fff; }
.mfb-back { transform: rotateY(180deg); }

/* Pfeile links/rechts */
.mfb-nav {
  position: absolute; top: 50%; transform: translateY(-50%);
  width: 44px; height: 64px;
  display: flex; align-items: center; justify-content: center;
  border: 0; border-radius: 6px;
  background: rgba(0,0,0,.35); color: #fff;
  cursor: pointer; z-index: 10;
  opacity: .75; transition: opacity .2s, background .2s;
}
.mfb-nav svg { width: 28px; height: 28px; }
.mfb-nav:hover { opacity: 1; background: rgba(0,0,0,.6); }
.mfb-nav:disabled { opacity: 0; pointer-events: none; }
.mfb-nav-prev { left: 8px; }
.mfb-nav-next { right: 8px; }

/* Laden */
.mfb-loader {
  position: absolute; inset: 0; z-index: 20;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px;
  background: var(--mfb-bg); text-align: center; padding: 20px;
}
.mfb-loader[hidden] { display: none; }
.mfb-spinner {
  width: 38px; height: 38px; border-radius: 50%;
  border: 3px solid rgba(255,255,255,.2); border-top-color: var(--mfb-accent);
  animation: mfb-spin .9s linear infinite;
}
@keyframes mfb-spin { to { transform: rotate(360deg); } }
.mfb-progress { width: 180px; height: 4px; background: rgba(255,255,255,.15); border-radius: 2px; overflow: hidden; }
.mfb-progress span { display: block; height: 100%; width: 0; background: var(--mfb-accent); transition: width .2s; }
.mfb-fallback { color: var(--mfb-accent); }

/* Seitenübersicht */
.mfb-thumbs {
  flex: 0 0 auto;
  display: flex; gap: 10px;
  overflow-x: auto; overflow-y: hidden;
  padding: 10px 12px;
  background: rgba(0,0,0,.25);
  scrollbar-width: thin;
}
.mfb-thumbs[hidden] { display: none; }
.mfb-thumb {
  flex: 0 0 auto; width: 72px;
  padding: 0; border: 2px solid transparent; border-radius: 3px;
  background: none; color: var(--mfb-fg); cursor: pointer;
  display: flex; flex-direction: column; align-items: center; gap: 4px;
}
.mfb-thumb canvas { width: 100%; background: #fff; display: block; }
.mfb-thumb span { font-size: 11px; opacity: .8; }
.mfb-thumb:hover canvas { outline: 2px solid rgba(255,255,255,.4); }
.mfb-thumb.mfb-current canvas { outline: 2px solid var(--mfb-accent); }

/* Werkzeugleiste */
.mfb-toolbar {
  flex: 0 0 auto;
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 6px 10px;
  background: var(--mfb-bar);
}
.mfb-group { display: flex; align-items: center; gap: 2px; }
.mfb-btn, .mfb-nav, .mfb-lb-close {
  font: inherit; line-height: 1; letter-spacing: normal; text-transform: none;
  min-width: 0; min-height: 0; margin: 0; padding: 0; box-shadow: none; text-shadow: none;
}
.mfb canvas { max-width: none; }
.mfb-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 36px; height: 36px; padding: 0;
  border: 0; border-radius: 6px;
  background: transparent; color: var(--mfb-fg);
  cursor: pointer;
}
.mfb-btn:hover:not(:disabled) { background: rgba(255,255,255,.1); }
.mfb-btn:disabled { opacity: .3; cursor: default; }
.mfb-btn.mfb-active { color: var(--mfb-accent); }
.mfb-btn:focus-visible, .mfb-nav:focus-visible { outline: 2px solid var(--mfb-accent); outline-offset: 1px; }
.mfb-pager { display: inline-flex; align-items: center; gap: 6px; margin: 0 6px; white-space: nowrap; }
.mfb-page-input {
  width: 64px; height: 30px; padding: 0 6px;
  border: 1px solid rgba(255,255,255,.2); border-radius: 5px;
  background: rgba(255,255,255,.06); color: inherit;
  text-align: center; font: inherit;
}
.mfb-page-input:focus { outline: none; border-color: var(--mfb-accent); }
.mfb-page-total { opacity: .75; }

@media (max-width: 560px) {
  .mfb-btn-first, .mfb-btn-last, .mfb-btn-zoomOut, .mfb-btn-zoomIn { display: none; }
  .mfb-nav { width: 34px; height: 52px; }
  .mfb-toolbar { padding: 4px 6px; }
}
@media (prefers-reduced-motion: reduce) {
  .mfb-book { transition: none; }
}

/* Overlay (Lightbox) */
.mfb-lightbox {
  position: fixed; inset: 0; z-index: 2147483000;
  display: flex;
  background: rgba(18, 18, 22, .94);
  animation: mfb-fade .2s ease-out;
}
@keyframes mfb-fade { from { opacity: 0; } }
.mfb-lightbox .mfb {
  height: 100% !important; min-height: 0;
  border-radius: 0;
  background-color: transparent;
}
.mfb-lb-close {
  position: absolute; top: 10px; right: 10px; z-index: 30;
  width: 44px; height: 44px; padding: 0;
  display: flex; align-items: center; justify-content: center;
  border: 0; border-radius: 50%;
  background: rgba(0,0,0,.55); color: #fff; cursor: pointer;
}
.mfb-lb-close svg { width: 24px; height: 24px; }
.mfb-lb-close:hover { background: rgba(0,0,0,.8); }
.mfb-lb-close:focus-visible { outline: 2px solid var(--mfb-accent, #e0a526); outline-offset: 2px; }
