/* Blätterkatalog — a page-turning viewer for print PDFs.
   Dark "reading room" around the pages, light panels for reading text. */

.fb {
  --fb-accent: #e61e28;
  --fb-accent-dark: #c9151e;
  --fb-bg: #2a2b2f;
  --fb-bg-deep: #1c1d20;
  --fb-bar: #1c1d20;
  --fb-fg: #f3f3f3;
  --fb-fg-dim: #a8aab0;
  --fb-line: rgba(255, 255, 255, 0.12);
  --fb-panel: #ffffff;
  --fb-panel-fg: #040606;
  --fb-panel-dim: #6b6e73;
  --fb-panel-line: #e3e4e6;
  --fb-hover: rgba(255, 255, 255, 0.1);
  --fb-mark: rgba(255, 214, 0, 0.45);
  --fb-mark-current: rgba(255, 140, 0, 0.55);
  --fb-font: "EuclidCircularB", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --fb-bar-h: 52px;
  --fb-panel-w: 360px;
  --fb-radius: 10px;
  --fb-pw: 400px; /* page width, set by the script */
  --fb-ph: 566px;

  position: fixed;
  inset: 0;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  background: var(--fb-bg-deep);
  color: var(--fb-fg);
  font-family: var(--fb-font);
  font-size: 15px;
  line-height: 1.4;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overflow: hidden;
}
.fb *, .fb *::before, .fb *::after { box-sizing: border-box; }
.fb [hidden] { display: none !important; }
.fb button, .fb input { font: inherit; color: inherit; }
.fb h1, .fb h2, .fb h3, .fb h4 { margin: 0; font-weight: 600; }
.fb-icons { position: absolute; width: 0; height: 0; overflow: hidden; }
.fb svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.fb :focus-visible { outline: 2px solid var(--fb-accent); outline-offset: 2px; }

/* ---------------------------------------------------------------- bars */

.fb-bar {
  display: flex;
  align-items: center;
  gap: 4px;
  min-height: var(--fb-bar-h);
  padding: 0 10px;
  padding-left: max(10px, env(safe-area-inset-left));
  padding-right: max(10px, env(safe-area-inset-right));
  background: var(--fb-bar);
  position: relative;
  z-index: 20;
}
.fb-top { border-bottom: 1px solid var(--fb-line); padding-top: env(safe-area-inset-top); }
.fb-bottom { border-top: 1px solid var(--fb-line); padding-bottom: env(safe-area-inset-bottom); gap: 2px; }

.fb-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  height: 40px;
  min-width: 40px;
  padding: 0 9px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: inherit;
  text-decoration: none;
  cursor: pointer;
  white-space: nowrap;
  transition: background-color .15s, color .15s;
}
.fb-btn:hover { background: var(--fb-hover); }
.fb-btn[aria-expanded="true"], .fb-btn.is-active { background: var(--fb-accent); color: #fff; }
.fb-btn:disabled { opacity: .35; cursor: default; background: transparent; }
.fb-btn span { font-size: 14px; }

.fb-home { color: var(--fb-fg-dim); }
.fb-title { flex: 1 1 auto; min-width: 0; display: flex; align-items: baseline; gap: 10px; padding: 0 6px; }
.fb-title h1 { font-size: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fb-subtitle { color: var(--fb-fg-dim); font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fb-subtitle:empty { display: none; }
.fb-tools { display: flex; gap: 2px; flex: none; }

.fb-scrub { position: relative; flex: 1 1 auto; display: flex; align-items: center; min-width: 60px; padding: 0 10px; height: 40px; }
.fb-scrub input {
  width: 100%;
  height: 28px;
  margin: 0;
  background: transparent;
  -webkit-appearance: none;
  appearance: none;
  cursor: pointer;
  --fill: 0%;
}
.fb-scrub input::-webkit-slider-runnable-track { height: 4px; border-radius: 2px; background: linear-gradient(to right, var(--fb-accent) var(--fill), rgba(255,255,255,.22) var(--fill)); }
.fb-scrub input::-moz-range-track { height: 4px; border-radius: 2px; background: rgba(255,255,255,.22); }
.fb-scrub input::-moz-range-progress { height: 4px; border-radius: 2px; background: var(--fb-accent); }
.fb-scrub input::-webkit-slider-thumb { -webkit-appearance: none; width: 18px; height: 18px; margin-top: -7px; border-radius: 50%; background: #fff; border: 0; box-shadow: 0 1px 4px rgba(0,0,0,.5); }
.fb-scrub input::-moz-range-thumb { width: 18px; height: 18px; border-radius: 50%; background: #fff; border: 0; box-shadow: 0 1px 4px rgba(0,0,0,.5); }
.fb-scrub-preview {
  position: absolute;
  bottom: calc(100% + 10px);
  left: 0;
  transform: translateX(-50%);
  padding: 6px 6px 4px;
  border-radius: 8px;
  background: #fff;
  color: #111;
  box-shadow: 0 8px 28px rgba(0,0,0,.45);
  text-align: center;
  font-size: 13px;
  pointer-events: none;
  opacity: 0;
  transition: opacity .12s;
}
.fb-scrub-preview.is-visible { opacity: 1; }
.fb-scrub-thumbs { display: flex; justify-content: center; }
.fb-scrub-thumbs img { display: block; width: 72px; height: auto; background: #eee; }

.fb-goto { display: flex; align-items: center; gap: 6px; padding: 0 4px 0 8px; color: var(--fb-fg-dim); font-size: 14px; white-space: nowrap; }
.fb-goto label { display: flex; align-items: center; gap: 6px; }
.fb-goto input {
  width: 4.2em;
  height: 32px;
  padding: 0 6px;
  border: 1px solid var(--fb-line);
  border-radius: 6px;
  background: rgba(255,255,255,.06);
  color: var(--fb-fg);
  text-align: center;
}
.fb-goto input:focus { border-color: var(--fb-accent); outline: none; background: rgba(255,255,255,.1); }

/* --------------------------------------------------------------- stage */

.fb-body { position: relative; display: flex; min-height: 0; }
.fb-stage {
  position: relative;
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  background: radial-gradient(ellipse at 50% 42%, #3a3c41 0%, var(--fb-bg) 55%, var(--fb-bg-deep) 100%);
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}
.fb-viewport { position: absolute; inset: 0; overflow: hidden; }
.fb-book {
  position: absolute;
  left: 0;
  top: 0;
  width: calc(var(--fb-pw) * 2);
  height: var(--fb-ph);
  transform-origin: 0 0;
  perspective: calc(var(--fb-pw) * 6);
  perspective-origin: 50% 50%;
}
.fb[data-mode="single"] .fb-book { width: var(--fb-pw); perspective: none; }

.fb-half { position: absolute; top: 0; width: var(--fb-pw); height: var(--fb-ph); }
.fb-half-l { left: 0; }
.fb-half-r { left: var(--fb-pw); }
.fb[data-mode="single"] .fb-half { left: 0; }
.fb-half.is-filled { box-shadow: 0 16px 40px rgba(0,0,0,.42), 0 3px 10px rgba(0,0,0,.28); }
.fb-half-l.is-filled { border-radius: 3px 0 0 3px; }
.fb-half-r.is-filled { border-radius: 0 3px 3px 0; }

.fb-page { position: absolute; inset: 0; overflow: hidden; background: #fff; border-radius: inherit; }
.fb-page img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  user-select: none;
  -webkit-user-drag: none;
  pointer-events: none;
}
.fb-page .fb-lo { filter: blur(0.4px); }
.fb-page .fb-img { opacity: 0; transition: opacity .25s; }
.fb-page .fb-img.is-loaded { opacity: 1; }
.fb-page .fb-hi { opacity: 0; transition: opacity .2s; }
.fb-page .fb-hi.is-loaded { opacity: 1; }
/* the fold: a soft shadow along the spine of an open spread */
.fb[data-mode="spread"] .fb-half-l .fb-page::after,
.fb[data-mode="spread"] .fb-half-r .fb-page::after,
.fb[data-mode="spread"] .fb-face .fb-page::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 3;
}
.fb[data-mode="spread"] .fb-half-l .fb-page::after,
.fb[data-mode="spread"] .fb-face-back .fb-page::after {
  background: linear-gradient(to left, rgba(0,0,0,.20) 0, rgba(0,0,0,.06) 2.2%, rgba(0,0,0,0) 7%, rgba(0,0,0,0) 97%, rgba(0,0,0,.05) 100%);
}
.fb[data-mode="spread"] .fb-half-r .fb-page::after,
.fb[data-mode="spread"] .fb-face-front .fb-page::after {
  background: linear-gradient(to right, rgba(0,0,0,.20) 0, rgba(0,0,0,.06) 2.2%, rgba(0,0,0,0) 7%, rgba(0,0,0,0) 97%, rgba(0,0,0,.05) 100%);
}

/* the turning leaf */
.fb-leaf {
  position: absolute;
  top: 0;
  width: var(--fb-pw);
  height: var(--fb-ph);
  transform-style: preserve-3d;
  z-index: 10;
  will-change: transform;
}
.fb-face {
  position: absolute;
  inset: 0;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  overflow: hidden;
  box-shadow: 0 0 20px rgba(0,0,0,.25);
}
.fb-face-back { transform: rotateY(180deg); }
.fb-shade { position: absolute; inset: 0; pointer-events: none; z-index: 4; opacity: 0; }
.fb-face-front .fb-shade { background: linear-gradient(to left, rgba(0,0,0,.45), rgba(0,0,0,.08) 60%, rgba(255,255,255,.12)); }
.fb-face-back .fb-shade { background: linear-gradient(to right, rgba(0,0,0,.4), rgba(0,0,0,.05) 55%, rgba(255,255,255,.1)); }
.fb-leaf-l .fb-face-front .fb-shade { background: linear-gradient(to right, rgba(0,0,0,.45), rgba(0,0,0,.08) 60%, rgba(255,255,255,.12)); }
.fb-leaf-l .fb-face-back .fb-shade { background: linear-gradient(to left, rgba(0,0,0,.4), rgba(0,0,0,.05) 55%, rgba(255,255,255,.1)); }
/* shadow the leaf throws on the pages below it */
.fb-cast { position: absolute; top: 0; bottom: 0; pointer-events: none; z-index: 6; opacity: 0; }
.fb-half-r .fb-cast { left: 0; width: 60%; background: linear-gradient(to right, rgba(0,0,0,.5), rgba(0,0,0,0)); }
.fb-half-l .fb-cast { right: 0; width: 60%; background: linear-gradient(to left, rgba(0,0,0,.5), rgba(0,0,0,0)); }

/* single-page mode: pages slide */
.fb-track { position: absolute; inset: 0; will-change: transform; }

/* links and search hits on the page */
.fb-links, .fb-marks { position: absolute; inset: 0; z-index: 5; pointer-events: none; }
.fb-link {
  position: absolute;
  display: block;
  pointer-events: auto;
  border-radius: 3px;
  cursor: pointer;
  transition: background-color .15s, box-shadow .15s;
}
.fb-link:focus-visible { background: rgba(230, 30, 40, .12); box-shadow: 0 0 0 2px rgba(230, 30, 40, .55); outline: none; }
.fb-link-qr:focus-visible { background: rgba(230, 30, 40, .08); }
/* only for a real mouse: some phones (with a pen) say they can hover, and a
   tapped link would then keep its frame */
@media (hover: hover) and (pointer: fine) {
  .fb-link:hover { background: rgba(230, 30, 40, .12); box-shadow: 0 0 0 2px rgba(230, 30, 40, .55); }
  .fb-link-qr:hover { background: rgba(230, 30, 40, .08); }
}
/* no mouse to hover with: a link lights up when it is tapped, not all the time */
.fb-link:active { background: rgba(230, 30, 40, .16); box-shadow: 0 0 0 2px rgba(230, 30, 40, .55); }

.fb-mark { position: absolute; background: var(--fb-mark); mix-blend-mode: multiply; border-radius: 2px; }
.fb-mark.is-current { background: var(--fb-mark-current); box-shadow: 0 0 0 2px rgba(255,140,0,.6); }

/* side arrows */
.fb-nav {
  position: absolute;
  top: 50%;
  z-index: 15;
  width: 48px;
  height: 96px;
  margin-top: -48px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 10px;
  background: rgba(0,0,0,.28);
  color: #fff;
  cursor: pointer;
  opacity: .85;
  transition: opacity .15s, background-color .15s, transform .15s;
}
.fb-nav svg { width: 32px; height: 32px; stroke-width: 2; }
.fb-nav:hover { opacity: 1; background: var(--fb-accent); }
.fb-nav:active { transform: scale(.96); }
.fb-nav:disabled { opacity: 0; pointer-events: none; }
.fb-nav-prev { left: 12px; }
.fb-nav-next { right: 12px; }
.fb.is-narrow .fb-nav { display: none; }
.fb-stage.is-zoomed .fb-nav { opacity: .45; }
.fb-stage.is-zoomed .fb-nav:hover { opacity: 1; }

/* cursors */
.fb-stage { cursor: default; }
.fb-stage.can-zoom .fb-viewport { cursor: zoom-in; }
.fb-stage.is-edge .fb-viewport { cursor: pointer; }
.fb-stage.is-zoomed .fb-viewport { cursor: grab; }
.fb-stage.is-dragging .fb-viewport { cursor: grabbing; }

/* zoom bar */
.fb-zoombar {
  position: absolute;
  right: 12px;
  bottom: 12px;
  z-index: 16;
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 3px;
  border-radius: 10px;
  background: rgba(20,21,24,.82);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  box-shadow: 0 4px 18px rgba(0,0,0,.35);
}
.fb-zoombar .fb-btn { height: 36px; min-width: 36px; padding: 0 6px; }
.fb-zoomlevel { min-width: 4.2em; text-align: center; font-size: 13px; font-variant-numeric: tabular-nums; color: var(--fb-fg-dim); }
@media (hover: none) { .fb-zoombar:not(.is-zoomed) { display: none; } }

.fb-hint {
  position: absolute;
  left: 50%;
  bottom: 6px;
  z-index: 16;
  transform: translateX(-50%);
  padding: 7px 14px;
  border-radius: 999px;
  background: rgba(20,21,24,.86);
  color: #fff;
  font-size: 13px;
  width: max-content;
  max-width: calc(100% - 24px);
  text-align: center;
  pointer-events: none;
  animation: fb-fade 5s ease forwards;
}
@keyframes fb-fade { 0% { opacity: 0; } 8%, 80% { opacity: 1; } 100% { opacity: 0; } }

/* loading */
.fb[data-loading] .fb-book { opacity: 0; }
.fb .fb-book { transition: opacity .3s; }
.fb[data-loading] .fb-stage::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 36px;
  height: 36px;
  margin: -18px 0 0 -18px;
  border: 3px solid rgba(255,255,255,.2);
  border-top-color: var(--fb-accent);
  border-radius: 50%;
  animation: fb-spin .8s linear infinite;
}
@keyframes fb-spin { to { transform: rotate(360deg); } }

/* --------------------------------------------------------------- panels */

.fb-panel {
  flex: none;
  width: var(--fb-panel-w);
  display: flex;
  flex-direction: column;
  min-height: 0;
  background: var(--fb-panel);
  color: var(--fb-panel-fg);
  z-index: 18;
  box-shadow: 0 0 30px rgba(0,0,0,.3);
}
.fb-panel-left { order: -1; }
.fb-panel-head, .fb-overlay-head {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 56px;
  padding: 8px 8px 8px 18px;
  border-bottom: 1px solid var(--fb-panel-line);
}
.fb-panel-head h2, .fb-overlay-head h2 { flex: 1; font-size: 17px; }
.fb-panel .fb-btn:hover, .fb-reader .fb-btn:hover { background: rgba(0,0,0,.06); }

.fb-toc-list { list-style: none; margin: 0; padding: 8px; overflow-y: auto; }
.fb-toc-list a {
  display: grid;
  grid-template-columns: 54px 1fr auto;
  gap: 14px;
  align-items: center;
  padding: 8px 10px;
  border-radius: 8px;
  color: inherit;
  text-decoration: none;
}
.fb-toc-list a:hover, .fb-toc-list a:focus-visible { background: #f3f3f3; }
.fb-toc-list a.is-current { background: #fde8e9; }
.fb-toc-list img { width: 54px; height: auto; display: block; border-radius: 2px; box-shadow: 0 1px 4px rgba(0,0,0,.25); background: #eee; }
.fb-toc-title { font-size: 15px; font-weight: 600; line-height: 1.3; }
.fb-toc-page { color: var(--fb-panel-dim); font-size: 13px; font-variant-numeric: tabular-nums; }

.fb-search-form { position: relative; margin: 14px 14px 6px; }
.fb-search-form svg { position: absolute; left: 12px; top: 50%; margin-top: -10px; width: 20px; height: 20px; color: var(--fb-panel-dim); pointer-events: none; }
.fb-search-form input {
  width: 100%;
  height: 44px;
  padding: 0 12px 0 40px;
  border: 1.5px solid #cfd1d4;
  border-radius: 10px;
  background: #fff;
  color: var(--fb-panel-fg);
  font-size: 16px; /* 16px keeps iOS from zooming in */
}
.fb-search-form input:focus { border-color: var(--fb-accent); outline: none; box-shadow: 0 0 0 3px rgba(230,30,40,.15); }
.fb-search-status { margin: 4px 18px 8px; min-height: 1.3em; color: var(--fb-panel-dim); font-size: 13px; }
.fb-search-results { list-style: none; margin: 0; padding: 0 8px 16px; overflow-y: auto; }
.fb-search-results > li + li { border-top: 1px solid var(--fb-panel-line); }
.fb-result {
  display: block;
  width: 100%;
  padding: 10px 10px;
  border: 0;
  border-radius: 8px;
  background: none;
  text-align: left;
  cursor: pointer;
  color: inherit;
}
.fb-result:hover, .fb-result:focus-visible { background: #f3f3f3; }
.fb-result.is-current { background: #fff4d6; }
.fb-result-page { display: block; margin-bottom: 3px; color: var(--fb-accent); font-size: 12px; font-weight: 600; letter-spacing: .02em; text-transform: uppercase; }
.fb-result-text { display: block; font-size: 14px; line-height: 1.45; color: #2b2d31; }
.fb-result mark { background: #ffe066; color: inherit; border-radius: 2px; padding: 0 1px; }

/* overlays: page grid and text version */
.fb-overlay {
  position: absolute;
  inset: 0;
  z-index: 40;
  display: flex;
  flex-direction: column;
  background: rgba(22, 23, 26, .97);
  color: var(--fb-fg);
  animation: fb-in .18s ease;
}
@keyframes fb-in { from { opacity: 0; } to { opacity: 1; } }
.fb-overlay .fb-overlay-head { border-bottom-color: var(--fb-line); padding-top: max(8px, env(safe-area-inset-top)); }
.fb-grid {
  list-style: none;
  margin: 0;
  padding: 24px max(24px, env(safe-area-inset-left)) 40px;
  overflow-y: auto;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 28px 22px;
  align-content: start;
}
.fb-grid a { display: flex; flex-direction: column; align-items: center; gap: 8px; color: var(--fb-fg-dim); text-decoration: none; font-size: 13px; font-variant-numeric: tabular-nums; }
.fb-grid .fb-grid-pages { display: flex; justify-content: center; min-height: 40px; }
.fb-grid img { display: block; width: 110px; height: auto; background: #444; box-shadow: 0 4px 14px rgba(0,0,0,.45); transition: transform .15s; }
.fb-grid .fb-grid-pages img:only-child { width: 110px; }
.fb-grid a:hover img, .fb-grid a:focus-visible img { transform: translateY(-3px); }
.fb-grid a:hover, .fb-grid a:focus-visible { color: #fff; outline: none; }
.fb-grid a:focus-visible .fb-grid-pages { outline: 2px solid var(--fb-accent); outline-offset: 4px; }
.fb-grid a.is-current .fb-grid-pages { outline: 3px solid var(--fb-accent); outline-offset: 4px; }
.fb-grid a.is-current { color: #fff; }

.fb-reader { background: #f6f6f4; color: #1d1e20; }
.fb-reader .fb-overlay-head { background: #fff; border-bottom-color: var(--fb-panel-line); }
.fb-reader-title { text-align: center; }
.fb-reader-body { flex: 1; overflow-y: auto; padding: 28px 22px 60px; outline: none; }
.fb-reader-body article { max-width: 42rem; margin: 0 auto; font-size: 18px; line-height: 1.62; }
.fb-reader-body article + article { margin-top: 48px; padding-top: 32px; border-top: 1px solid #ddd; }
.fb-reader-body .fb-reader-page { display: block; margin-bottom: 18px; color: var(--fb-accent); font-size: 13px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; }
.fb-reader-body h2 { font-size: 34px; line-height: 1.15; margin: 0 0 18px; }
.fb-reader-body h3 { font-size: 22px; line-height: 1.3; margin: 26px 0 12px; }
.fb-reader-body h4 { font-size: 18px; line-height: 1.35; margin: 22px 0 6px; }
.fb-reader-body p { margin: 0 0 14px; }
.fb-reader-body p.lead { font-size: 20px; font-weight: 600; line-height: 1.5; }
.fb-reader-body p.small { font-size: 14px; color: #555; }
.fb-reader-body a { color: var(--fb-accent-dark); }
.fb-reader-body .fb-empty { color: #777; font-style: italic; }

.fb-toast {
  position: absolute;
  left: 50%;
  bottom: calc(var(--fb-bar-h) + 24px + env(safe-area-inset-bottom));
  z-index: 60;
  transform: translateX(-50%);
  max-width: calc(100% - 32px);
  padding: 10px 16px;
  border-radius: 10px;
  background: #fff;
  color: #111;
  box-shadow: 0 8px 30px rgba(0,0,0,.4);
  font-size: 14px;
  animation: fb-in .15s ease;
}
.fb-live { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.fb-noscript { position: absolute; inset: 0; z-index: 100; overflow: auto; padding: 24px; background: #fff; color: #111; }
.fb-noscript img { max-width: 100%; height: auto; display: block; margin: 16px 0; box-shadow: 0 2px 10px rgba(0,0,0,.2); }

/* ------------------------------------------------------------- responsive */

@media (max-width: 1180px) { .fb-tools .fb-btn span { display: none; } }
/* the language switch shows its two letters at every width */
.fb-tools .fb-lang span { display: inline; font-size: 12px; font-weight: 600; letter-spacing: .06em; }
.fb-lang { min-width: 40px; }
@media (max-width: 1000px) {
  .fb-panel {
    position: absolute;
    top: 0;
    bottom: 0;
    width: min(var(--fb-panel-w), 88vw);
  }
  .fb-panel-left { left: 0; }
  .fb-panel-right { right: 0; }
}
@media (max-width: 720px) {
  .fb { --fb-bar-h: 48px; }
  .fb-subtitle, .fb-home { display: none; }
  .fb-bar { padding-left: max(4px, env(safe-area-inset-left)); padding-right: max(4px, env(safe-area-inset-right)); }
  .fb-btn { min-width: 38px; padding: 0 7px; }
  .fb-tools { gap: 0; }
  .fb-tools [data-action="share"] { display: none; }
  .fb-bottom [data-action="first"], .fb-bottom [data-action="last"] { display: none; }
  .fb-goto-label { display: none; }
  .fb-goto { padding-right: 14px; } /* "/ 16" as far from the edge as the arrow on the left */
  .fb-panel { top: auto; left: 0 !important; right: 0 !important; width: auto; height: min(78%, 620px); border-radius: 14px 14px 0 0; }
  .fb-grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 22px 12px; padding: 16px 12px 32px; }
  .fb-grid img, .fb-grid .fb-grid-pages img:only-child { width: 80px; }
  .fb-reader-body { padding: 20px 18px 48px; }
  .fb-reader-body article { font-size: 17px; }
  .fb-reader-body h2 { font-size: 28px; }
}
@media (max-width: 400px) {
  .fb-tools [data-action="fullscreen"] { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .fb-overlay, .fb-toast { animation: none; }
}

/* reaching things by keyboard: the links on a page show where the focus is */
.fb-link:focus-visible { outline: 3px solid #e61e28; outline-offset: 2px; background: rgba(230, 30, 40, .12); }
/* first in the tab order: straight to the plain text version (screen readers, keyboard) */
.fb-skip { position: absolute; left: 12px; top: -60px; z-index: 100; padding: 10px 16px; border-radius: 10px; background: #fff; color: #111; font-weight: 600; text-decoration: none; box-shadow: 0 6px 24px rgba(0,0,0,.35); transition: top .15s; }
.fb-skip:focus { top: 12px; outline: 3px solid #e61e28; outline-offset: 2px; }

/* Phones. The grid is never wider than the screen, whatever the bars hold
   (before, the top bar's minimum width made the whole reader wider than a
   phone, so the page sat off-centre and the toolbar was cut off); the title
   gives way first. */
.fb { grid-template-columns: minmax(0, 1fr); touch-action: pan-x pan-y; overscroll-behavior: none; }
.fb-bar { min-width: 0; }
html, body { overscroll-behavior: none; }
/* iPhones zoom the whole page into any field with text under 16 px and stay
   zoomed in — the page jumps up and to the left. */
@media (hover: none) { .fb input { font-size: 16px; } }
