:root {
  --bg: #343434;
  --panel: #565656;
  --panel-dark: #252525;
  --panel-soft: #6a6a6a;
  --line: #777;
  --page-line: rgba(255, 255, 255, 0.24);
  --text: #f4f4f4;
  --muted: #c7c7c7;
  --accent: #44c7d8;
  --shadow: rgba(0, 0, 0, 0.48);
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
  margin: 0;
}

body {
  overflow: hidden;
  background: var(--bg);
  color: var(--text);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    Arial, sans-serif;
}

button,
input,
a {
  font: inherit;
}

.viewer-shell {
  position: relative;
  display: grid;
  grid-template-rows: auto 1fr;
  min-height: 100vh;
  background:
    radial-gradient(circle at 50% -20%, rgba(255, 255, 255, 0.08), transparent 38rem),
    linear-gradient(180deg, #3f3f3f, #303030 52%, #2a2a2a);
  isolation: isolate;
}

.viewer-shell::before {
  position: absolute;
  inset: 0;
  z-index: -1;
  content: "";
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.018) 1px, transparent 1px);
  background-size: 34px 34px;
  opacity: 0.4;
}

.topbar {
  position: relative;
  z-index: 20;
  justify-self: center;
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: min(1320px, calc(100vw - 32px));
  min-height: 56px;
  margin: 18px 12px 4px;
  padding: 9px 11px;
  background: rgba(25, 27, 29, 0.97);
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 8px;
  box-shadow: 0 14px 38px rgba(0, 0, 0, 0.42), inset 0 1px rgba(255, 255, 255, 0.025);
  backdrop-filter: blur(12px);
  transition:
    opacity 180ms ease,
    transform 220ms ease;
}

.toolbar-primary,
.toolbar-overflow,
.nav-controls,
.toolbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.nav-controls {
  transition: width 180ms ease, opacity 180ms ease;
}

.mobile-toolbar-c {
  display: none;
}

.toolbar-overflow {
  flex: 1 1 auto;
  justify-content: flex-end;
  min-width: 0;
}

.toolbar-actions {
  gap: 2px;
  padding-left: 7px;
  border-left: 1px solid rgba(255, 255, 255, 0.09);
}

.more-menu-button,
.command-label {
  display: none;
}

.mobile-fullscreen-button,
.more-menu-button {
  display: none !important;
}

.icon-button,
.mini-button,
.toolbar-label-button,
.search-box button,
.tab,
.film-toggle {
  display: inline-grid;
  place-items: center;
  color: var(--text);
  background: transparent;
  border: 0;
  border-radius: 6px;
  cursor: pointer;
  text-decoration: none;
  transition:
    background 150ms ease,
    color 150ms ease,
    transform 150ms ease;
}

.icon-button {
  width: 34px;
  height: 34px;
  font-size: 17px;
  line-height: 1;
  border: 1px solid transparent;
}

.toolbar-label-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  height: 36px;
  padding: 0 12px;
  color: var(--text);
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  background: #24272a;
  border: 1px solid rgba(255, 255, 255, 0.105);
  box-shadow: inset 0 1px rgba(255, 255, 255, 0.025);
}

.toolbar-label-button i {
  width: 16px;
  color: #d9f7fb;
  font-size: 15px;
  text-align: center;
}

.icon-button:hover,
.mini-button:hover,
.toolbar-label-button:hover,
.search-box button:hover,
.tab:hover,
.film-toggle:hover {
  background: #2b2f32;
  border-color: rgba(255, 255, 255, 0.1);
}

.icon-button.is-active,
.mini-button.is-active,
.toolbar-label-button.is-active {
  color: #fff;
  background: rgba(68, 199, 216, 0.24);
}

.bookmark-button.is-active {
  color: #f1cf67;
  background: rgba(241, 207, 103, 0.16);
}

.bookmark-button.is-active i {
  color: #f1cf67;
}

.icon-button:active,
.mini-button:active,
.toolbar-label-button:active,
.search-box button:active,
.film-toggle:active {
  transform: translateY(1px);
}

.icon-button[disabled],
.mini-button[disabled] {
  cursor: not-allowed;
  opacity: 0.4;
}

.zoom-strip {
  display: flex;
  align-items: center;
  gap: 5px;
  width: 184px;
  height: 36px;
  padding: 0 6px;
  background: #202326;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 6px;
}

.zoom-title {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: #eafcff;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
}

.mini-button {
  width: 24px;
  height: 24px;
  color: #fff;
}

.zoom-strip input[type="range"] {
  min-width: 48px;
  width: 74px;
  accent-color: var(--accent);
}

.page-jump {
  display: flex;
  align-items: center;
  gap: 5px;
  height: 32px;
  padding: 0 6px;
  color: var(--text);
}

.page-jump input {
  width: 58px;
  height: 30px;
  padding: 0 5px;
  color: #f7f7f7;
  text-align: center;
  background: #2b2f33;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 6px;
  appearance: textfield;
}

.page-jump input::-webkit-inner-spin-button,
.page-jump input::-webkit-outer-spin-button {
  margin: 0;
  appearance: none;
}

.page-total {
  min-width: 42px;
  color: #e7e7e7;
  font-size: 13px;
  white-space: nowrap;
}

.search-box {
  position: relative;
  display: flex;
  align-items: center;
  width: 76px;
  height: 36px;
  overflow: hidden;
  background: #272a2e;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 6px;
  transition:
    width 220ms ease,
    border-color 150ms ease,
    box-shadow 150ms ease;
}

.search-box.is-expanded {
  width: min(330px, 28vw);
}

.search-box:not(.is-expanded) .search-leading-icon,
.search-box:not(.is-expanded) input,
.search-box:not(.is-expanded) .search-clear,
.search-box:not(.is-expanded) .search-meta {
  width: 0;
  min-width: 0;
  margin: 0;
  padding: 0;
  opacity: 0;
  pointer-events: none;
}

.topbar.search-expanded .nav-controls .page-jump {
  display: none;
}

.topbar.search-expanded .nav-controls {
  gap: 0;
}

.search-box:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(68, 199, 216, 0.25);
}

.search-leading-icon {
  flex: 0 0 auto;
  margin-left: 10px;
  color: #aeb4b8;
  font-size: 13px;
}

.search-box input {
  flex: 1 1 auto;
  width: auto;
  min-width: 0;
  height: 100%;
  padding: 0 8px;
  color: #f4f4f4;
  background: transparent;
  border: 0;
  outline: 0;
}

.search-box button {
  flex: 0 0 auto;
  width: 32px;
  height: 100%;
  color: #d8dde0;
  border-radius: 0;
}

.search-box button[hidden],
.search-meta[hidden] {
  display: none;
}

.search-clear {
  color: #aeb4b8 !important;
}

.search-submit {
  color: #fff !important;
  background: #327f89 !important;
}

.search-submit:hover {
  background: #286b74 !important;
}

.search-submit[disabled] {
  cursor: wait;
  opacity: 0.8;
}

.search-meta {
  flex: 0 0 auto;
  padding: 2px 5px;
  color: #286b74;
  font-size: 10px;
  font-weight: 700;
  background: rgba(68, 199, 216, 0.14);
  border-radius: 3px;
  white-space: nowrap;
}

.stage {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 0;
  padding: 10px 72px 8px;
  overflow: hidden;
  perspective: 1900px;
}

.book {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: min(100%, 1120px);
  height: 100%;
  max-height: calc(100vh - 78px);
  overflow: auto;
  padding: 22px;
  scrollbar-width: none;
  -ms-overflow-style: none;
  cursor: default;
  overscroll-behavior: contain;
}

.book::-webkit-scrollbar,
.surah-list::-webkit-scrollbar {
  display: none;
  width: 0;
  height: 0;
}

.viewer-shell.is-zoomed .book {
  width: 100vw;
  max-width: none;
  height: 100vh;
  max-height: none;
  align-items: flex-start;
  justify-content: flex-start;
  padding: var(--toolbar-clearance, 82px) 0 20px;
  scroll-padding-top: var(--toolbar-clearance, 82px);
  cursor: grab;
  touch-action: none;
  -webkit-overflow-scrolling: touch;
}

.viewer-shell.is-zoomed {
  display: block;
  width: 100vw;
  height: 100vh;
  min-height: 0;
}

.viewer-shell.is-zoomed .topbar {
  position: absolute;
  top: 0;
  left: 50%;
  z-index: 35;
  margin: 10px 0 0;
  transform: translateX(-50%);
}

.viewer-shell.is-zoomed .stage {
  position: absolute;
  inset: 0;
  width: 100vw;
  height: 100vh;
  padding: 0;
}

.viewer-shell.is-zoomed .edge-arrow {
  z-index: 30;
  color: #fff;
  background: rgba(28, 28, 28, 0.58);
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 4px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.32);
  backdrop-filter: blur(6px);
  opacity: 1;
}

.viewer-shell.controls-hidden .topbar {
  pointer-events: none;
  opacity: 0;
  transform: translateY(calc(-100% - 18px));
}

.viewer-shell.is-zoomed.controls-hidden .topbar {
  transform: translate(-50%, calc(-100% - 18px));
}

.viewer-shell.controls-hidden .edge-arrow {
  pointer-events: none;
  opacity: 0;
}

.viewer-shell.is-zoomed .book.is-panning {
  cursor: grabbing;
}

.book.is-corner-ready {
  cursor: grab;
}

.book.is-turn-dragging {
  cursor: grabbing;
}

.viewer-shell.is-zoomed .page-spread {
  margin: 0;
}

.viewer-shell.is-zoomed .flip-book {
  margin: 0;
}

.viewer-shell.is-zoomed .flip-book .stf__block {
  pointer-events: none;
  touch-action: none !important;
}

.flip-book {
  --pinch-scale: 1;
  position: relative;
  flex: 0 0 auto;
  margin: auto;
  background: transparent;
  filter: drop-shadow(0 24px 36px rgba(0, 0, 0, 0.45));
  transform: scale(var(--pinch-scale)) translateZ(0);
  transition: transform 900ms cubic-bezier(0.22, 0.72, 0.18, 1);
}

.viewer-shell.is-cover .flip-book {
  transform: translateX(-25%) scale(var(--pinch-scale)) translateZ(0);
}

.viewer-shell.is-back-cover .flip-book {
  transform: translateX(25%) scale(var(--pinch-scale)) translateZ(0);
}

.book.is-pinching .flip-book {
  transition: none;
}

.flip-book::before {
  position: absolute;
  right: 4%;
  bottom: -22px;
  left: 4%;
  z-index: -1;
  height: 34px;
  pointer-events: none;
  content: "";
  background: radial-gradient(ellipse at center, rgba(0, 0, 0, 0.5), rgba(0, 0, 0, 0) 68%);
  filter: blur(8px);
}

.viewer-shell.is-cover .flip-book::before {
  right: 2%;
  left: 52%;
}

.viewer-shell.is-back-cover .flip-book::before {
  right: 52%;
  left: 2%;
}

.viewer-shell.is-double:not(.is-cover):not(.is-back-cover) .flip-book .stf__block::after {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 50%;
  z-index: 6;
  width: 46px;
  pointer-events: none;
  content: "";
  background: linear-gradient(
    90deg,
    transparent 0%,
    rgba(0, 0, 0, 0.025) 22%,
    rgba(0, 0, 0, 0.1) 46%,
    rgba(0, 0, 0, 0.14) 49%,
    rgba(255, 255, 255, 0.34) 50%,
    rgba(0, 0, 0, 0.09) 54%,
    rgba(0, 0, 0, 0.025) 78%,
    transparent 100%
  );
  transform: translateX(-50%);
}

.viewer-shell.is-dark-pages.is-double:not(.is-cover):not(.is-back-cover) .flip-book .stf__block::after {
  background: linear-gradient(
    90deg,
    transparent 0%,
    rgba(255, 255, 255, 0.02) 32%,
    rgba(255, 255, 255, 0.1) 49%,
    rgba(0, 0, 0, 0.5) 50%,
    rgba(255, 255, 255, 0.08) 52%,
    transparent 100%
  );
}

.flip-book .stf__wrapper,
.flip-book .stf__block {
  position: relative;
  width: 100%;
  height: 100%;
}

.flip-book .stf__block {
  overflow: visible;
  perspective: 2200px;
}

.flip-book .stf__outerShadow,
.flip-book .stf__innerShadow,
.flip-book .stf__hardShadow,
.flip-book .stf__hardInnerShadow {
  pointer-events: none;
}

.flip-page {
  overflow: hidden;
  background: #fff;
  border: 0;
  box-shadow: none;
}

.flip-page.is-search-target::after {
  position: absolute;
  inset: 0;
  z-index: 24;
  pointer-events: none;
  content: "";
  border: 3px solid rgba(68, 199, 216, 0.9);
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.72),
    inset 0 0 34px rgba(68, 199, 216, 0.18);
  animation: searchTargetReveal 1150ms ease-out forwards;
}

@keyframes searchTargetReveal {
  0% {
    opacity: 0;
  }

  18% {
    opacity: 1;
  }

  100% {
    opacity: 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  .flip-page.is-search-target::after {
    animation-duration: 1ms;
  }
}

.flip-page.--left {
  box-shadow: none;
}

.flip-page.--right {
  box-shadow: none;
}

.flip-page-surface {
  position: absolute;
  inset: 0;
  overflow: hidden;
  background: #fff;
}

.pdf-page-image {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  object-fit: fill;
  user-select: none;
  -webkit-user-drag: none;
  transition: filter 180ms ease;
}

.back-cover-inner,
.back-cover-inner .flip-page-surface {
  background: #fff;
}

.back-cover-outer,
.back-cover-outer .flip-page-surface {
  background: #43060d;
}

.viewer-shell.is-dark-pages .flip-page:not(.back-cover):not([data-page="1"]),
.viewer-shell.is-dark-pages .flip-page:not(.back-cover):not([data-page="1"]) .flip-page-surface {
  background: #1e1e1e;
}

.viewer-shell.is-dark-pages .flip-page:not(.back-cover):not([data-page="1"]) .pdf-page-image {
  filter: invert(0.85) hue-rotate(180deg) contrast(1.12) brightness(1.08) saturate(0.92);
}

.viewer-shell.is-dark-pages .flip-page:not(.back-cover):not([data-page="1"]) .flip-page-loader {
  color: #8f9699;
  background: #1e1e1e;
}

.flip-page-loader {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: #9a9a9a;
  font-size: 13px;
  background: linear-gradient(135deg, #fff, #f1f1ee);
}

.flip-page.is-rendered .flip-page-loader {
  display: none;
}

.book.is-turning .flip-book {
  filter: drop-shadow(0 30px 44px rgba(0, 0, 0, 0.5));
}

.page-spread {
  position: relative;
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0;
  width: max-content;
  height: max-content;
  min-width: min-content;
  min-height: min-content;
  margin: auto;
  transform-style: preserve-3d;
  transition:
    transform 210ms ease,
    opacity 180ms ease;
}

.viewer-shell.is-double .page-spread::before {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 50%;
  z-index: 4;
  width: 54px;
  pointer-events: none;
  content: "";
  background:
    linear-gradient(
      90deg,
      rgba(0, 0, 0, 0.18),
      rgba(255, 255, 255, 0.1) 38%,
      rgba(0, 0, 0, 0.16)
    );
  filter: blur(2px);
  transform: translateX(-50%);
}

.book.is-flipping-next .page-spread {
  transform: translateX(-8px);
}

.book.is-flipping-prev .page-spread {
  transform: translateX(8px);
}

.page-frame {
  position: relative;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  overflow: hidden;
  background: #fff;
  border: 0;
  outline: 0;
  box-shadow:
    0 18px 38px rgba(0, 0, 0, 0.46),
    0 0 0 1px rgba(255, 255, 255, 0.16);
}

.page-frame::before,
.page-frame::after {
  position: absolute;
  top: 0;
  bottom: 0;
  z-index: 2;
  width: 28px;
  pointer-events: none;
  content: "";
}

.page-frame::before {
  left: 0;
  background: linear-gradient(90deg, rgba(0, 0, 0, 0.08), transparent);
}

.page-frame::after {
  right: 0;
  background: linear-gradient(270deg, rgba(0, 0, 0, 0.08), transparent);
}

.page-frame canvas {
  display: block;
  max-width: none;
  max-height: none;
  background: #fff;
}

.viewer-shell.is-double .primary-page {
  border-right: 0;
  box-shadow:
    -15px 20px 36px rgba(0, 0, 0, 0.42),
    inset -18px 0 26px rgba(0, 0, 0, 0.08);
}

.viewer-shell.is-double .secondary-page {
  border-left: 0;
  box-shadow:
    15px 20px 36px rgba(0, 0, 0, 0.42),
    inset 18px 0 26px rgba(0, 0, 0, 0.07);
}

.viewer-shell.is-cover .page-frame {
  box-shadow:
    0 20px 44px rgba(0, 0, 0, 0.52),
    -6px 0 0 rgba(232, 229, 217, 0.9),
    -10px 0 0 rgba(36, 36, 36, 0.26);
}

.page-frame.is-turn-source {
  visibility: visible;
}

.page-spread.is-turn-rendering .page-frame {
  visibility: visible;
}

.corner-curl {
  position: absolute;
  z-index: 8;
  display: none;
  pointer-events: none;
  opacity: 0;
  filter: drop-shadow(-12px 12px 16px rgba(0, 0, 0, 0.3));
  transition:
    opacity 140ms ease,
    transform 160ms ease;
}

.corner-curl.is-visible {
  display: block;
  opacity: 1;
}

.corner-curl::before,
.corner-curl::after {
  position: absolute;
  content: "";
  pointer-events: none;
}

.corner-curl::before {
  inset: 0;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.98), rgba(245, 245, 241, 0.94) 48%, rgba(196, 196, 188, 0.9) 100%);
  box-shadow:
    inset 8px -8px 20px rgba(255, 255, 255, 0.7),
    inset -10px 10px 18px rgba(0, 0, 0, 0.16);
}

.corner-curl::after {
  width: 86%;
  height: 14px;
  background: linear-gradient(90deg, transparent, rgba(0, 0, 0, 0.2), transparent);
  filter: blur(1.2px);
  opacity: 0.72;
}

.corner-curl.curl-next.curl-top::before {
  clip-path: polygon(100% 0, 100% 100%, 0 0);
}

.corner-curl.curl-next.curl-top::after {
  top: 27%;
  right: -19%;
  transform: rotate(45deg);
}

.corner-curl.curl-next.curl-bottom::before {
  clip-path: polygon(100% 0, 100% 100%, 0 100%);
}

.corner-curl.curl-next.curl-bottom {
  filter: drop-shadow(-12px -12px 16px rgba(0, 0, 0, 0.3));
}

.corner-curl.curl-next.curl-bottom::after {
  right: -19%;
  bottom: 27%;
  transform: rotate(-45deg);
}

.corner-curl.curl-prev.curl-top {
  filter: drop-shadow(12px 12px 16px rgba(0, 0, 0, 0.3));
}

.corner-curl.curl-prev.curl-top::before {
  clip-path: polygon(0 0, 100% 0, 0 100%);
}

.corner-curl.curl-prev.curl-top::after {
  top: 27%;
  left: -19%;
  transform: rotate(-45deg);
}

.corner-curl.curl-prev.curl-bottom {
  filter: drop-shadow(12px -12px 16px rgba(0, 0, 0, 0.3));
}

.corner-curl.curl-prev.curl-bottom::before {
  clip-path: polygon(0 0, 0 100%, 100% 100%);
}

.corner-curl.curl-prev.curl-bottom::after {
  bottom: 27%;
  left: -19%;
  transform: rotate(45deg);
}

.turn-sheet {
  position: absolute;
  z-index: 9;
  display: none;
  pointer-events: none;
  transform-style: preserve-3d;
  transform: translateZ(24px);
  perspective: 1800px;
  will-change: transform;
}

.turn-sheet.is-visible {
  display: block;
}

.turn-sheet.is-turning,
.turn-sheet.drag-turn,
.turn-sheet.drag-settle {
  filter: drop-shadow(0 22px 28px rgba(0, 0, 0, 0.34));
}

.turn-sheet.turn-next {
  transform-origin: left center;
}

.turn-sheet.turn-prev {
  transform-origin: right center;
}

.turn-face,
.turn-paper-back {
  position: absolute;
  inset: 0;
  overflow: hidden;
  background-color: #f9f9f7;
  background-position: center;
  background-repeat: no-repeat;
  background-size: 100% 100%;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  border: 1px solid rgba(28, 28, 28, 0.28);
  border-radius: 1px 8px 8px 1px;
  box-shadow:
    0 18px 42px rgba(0, 0, 0, 0.38),
    inset -24px 0 40px rgba(0, 0, 0, 0.16),
    inset 10px 0 20px rgba(255, 255, 255, 0.18);
}

.turn-front {
  z-index: 4;
  opacity: 1;
  transform: translateZ(2px);
}

.turn-paper-back {
  z-index: 3;
  background:
    linear-gradient(
      105deg,
      rgba(255, 255, 255, 0.98) 0%,
      rgba(244, 244, 241, 0.98) 42%,
      rgba(218, 218, 214, 0.98) 72%,
      rgba(255, 255, 255, 0.98) 100%
    );
  opacity: 1;
  transform: rotateY(180deg) translateZ(2px);
  animation: none;
}

.turn-paper-back::before {
  position: absolute;
  inset: 0;
  content: "";
  background:
    linear-gradient(90deg, rgba(0, 0, 0, 0.18), transparent 18%, transparent 72%, rgba(0, 0, 0, 0.16)),
    repeating-linear-gradient(0deg, rgba(0, 0, 0, 0.018) 0 1px, transparent 1px 7px);
  opacity: 0.55;
}

.turn-paper-back::after {
  position: absolute;
  top: -8%;
  bottom: -8%;
  width: 36px;
  content: "";
  background: linear-gradient(90deg, rgba(255, 255, 255, 0.78), rgba(255, 255, 255, 0.08), rgba(0, 0, 0, 0.18));
  filter: blur(1px);
}

.turn-next .turn-paper-back::after {
  right: 12%;
  transform: rotate(8deg);
  opacity: 0.95;
}

.turn-prev .turn-paper-back::after {
  left: 12%;
  transform: rotate(-8deg) scaleX(-1);
  opacity: 0.95;
}

.turn-face::after {
  position: absolute;
  inset: 0;
  content: "";
  background:
    linear-gradient(
      90deg,
      rgba(255, 255, 255, 0.38) 0%,
      rgba(255, 255, 255, 0.1) 17%,
      rgba(0, 0, 0, 0.05) 45%,
      rgba(0, 0, 0, 0.38) 100%
    );
  opacity: 0;
  animation: turnShade 1080ms ease-in-out forwards;
}

.turn-face::before {
  position: absolute;
  top: -2%;
  bottom: -2%;
  z-index: 2;
  width: 38px;
  content: "";
  background:
    linear-gradient(90deg, rgba(255, 255, 255, 0.68), rgba(255, 255, 255, 0.05), rgba(0, 0, 0, 0.28));
  filter: blur(0.3px);
  opacity: 0;
  animation: curlRidge 1080ms cubic-bezier(0.2, 0.66, 0.2, 1) forwards;
}

.turn-next .turn-face::before {
  right: -5px;
  border-radius: 70% 45% 45% 70%;
}

.turn-prev .turn-face::before {
  left: -5px;
  border-radius: 45% 70% 70% 45%;
  transform: scaleX(-1);
}

.turn-next.is-turning {
  animation: turnNext 820ms cubic-bezier(0.2, 0.72, 0.18, 1) forwards;
}

.turn-prev.is-turning {
  animation: turnPrev 820ms cubic-bezier(0.2, 0.72, 0.18, 1) forwards;
}

.turn-next .turn-front {
  animation: none;
}

.turn-prev .turn-front {
  animation: none;
}

.turn-next.is-turning .turn-front,
.turn-prev.is-turning .turn-front {
  animation: frontFaceSwap 820ms linear forwards;
}

.turn-next.is-turning .turn-paper-back,
.turn-prev.is-turning .turn-paper-back {
  animation: backFaceSwap 820ms linear forwards;
}

.turn-sheet.drag-turn,
.turn-sheet.drag-settle {
  animation: none;
  will-change: transform, filter;
}

.turn-sheet.drag-turn .turn-front,
.turn-sheet.drag-settle .turn-front,
.turn-sheet.drag-turn .turn-paper-back,
.turn-sheet.drag-settle .turn-paper-back {
  animation: none;
  transform-origin: center center;
  transition:
    border-radius 120ms ease,
    box-shadow 120ms ease,
    clip-path 120ms ease;
}

.turn-sheet.drag-turn .turn-face::after,
.turn-sheet.drag-settle .turn-face::after {
  opacity: var(--turn-shade-opacity, 0.16);
  animation: none;
}

.turn-sheet.drag-turn .turn-face::before,
.turn-sheet.drag-settle .turn-face::before {
  opacity: var(--turn-ridge-opacity, 0.28);
  animation: none;
}

.turn-sheet.drag-turn .turn-front,
.turn-sheet.drag-settle .turn-front {
  transform:
    translateZ(3px)
    rotateY(calc(var(--turn-side, -1) * var(--drag-flex, 0) * 7deg))
    skewY(calc(var(--turn-side, -1) * var(--turn-corner, 1) * var(--drag-flex, 0) * 2.4deg))
    scaleX(calc(1 - var(--drag-flex, 0) * 0.035))
    scaleY(calc(1 + var(--drag-flex, 0) * 0.012));
  box-shadow:
    0 24px 58px rgba(0, 0, 0, calc(0.36 + var(--drag-flex, 0) * 0.2)),
    inset -42px 0 58px rgba(0, 0, 0, calc(0.08 + var(--drag-flex, 0) * 0.18)),
    inset 18px 0 30px rgba(255, 255, 255, 0.18);
}

.turn-sheet.drag-turn .turn-paper-back,
.turn-sheet.drag-settle .turn-paper-back {
  transform:
    rotateY(180deg)
    translateZ(3px)
    rotateY(calc(var(--turn-side, -1) * var(--drag-flex, 0) * -5deg))
    skewY(calc(var(--turn-side, -1) * var(--turn-corner, 1) * var(--drag-flex, 0) * -1.8deg))
    scaleX(calc(1 - var(--drag-flex, 0) * 0.02))
    scaleY(calc(1 + var(--drag-flex, 0) * 0.018));
  box-shadow:
    0 28px 70px rgba(0, 0, 0, calc(0.34 + var(--drag-flex, 0) * 0.18)),
    inset -34px 0 58px rgba(0, 0, 0, calc(0.1 + var(--drag-flex, 0) * 0.13)),
    inset 22px 0 34px rgba(255, 255, 255, 0.34);
}

.turn-sheet.turn-next.drag-turn .turn-front,
.turn-sheet.turn-next.drag-settle .turn-front,
.turn-sheet.turn-next.drag-turn .turn-paper-back,
.turn-sheet.turn-next.drag-settle .turn-paper-back {
  border-radius: 2px 16px 12px 2px;
  clip-path: polygon(0 0, 100% 1.8%, 97% 100%, 0 100%);
}

.turn-sheet.turn-prev.drag-turn .turn-front,
.turn-sheet.turn-prev.drag-settle .turn-front,
.turn-sheet.turn-prev.drag-turn .turn-paper-back,
.turn-sheet.turn-prev.drag-settle .turn-paper-back {
  border-radius: 16px 2px 2px 12px;
  clip-path: polygon(0 1.8%, 100% 0, 100% 100%, 3% 100%);
}

@keyframes turnNext {
  0% {
    opacity: 1;
    transform: translateZ(26px) rotateY(0deg) rotateZ(0deg) skewY(0deg) scale(1);
    filter: brightness(1);
  }

  22% {
    opacity: 1;
    transform: translateZ(40px) rotateX(-1.5deg) rotateY(-34deg) rotateZ(-1.8deg) skewY(-0.8deg) scale(0.995, 1.006);
    filter: brightness(1.02);
  }

  48% {
    opacity: 1;
    transform: translateZ(56px) rotateX(-2.2deg) rotateY(-86deg) rotateZ(-3deg) skewY(-1.5deg) scale(0.982, 1.012);
    filter: brightness(0.92);
  }

  72% {
    opacity: 1;
    transform: translateZ(44px) rotateX(-1.2deg) rotateY(-136deg) rotateZ(-1.9deg) skewY(-0.7deg) scale(0.992, 1.006);
    filter: brightness(0.97);
  }

  92% {
    opacity: 1;
    transform: translateZ(28px) rotateY(-164deg) rotateZ(-0.4deg) skewY(0deg) scale(1);
    filter: brightness(1);
  }

  100% {
    opacity: 1;
    transform: translateZ(24px) rotateY(-168deg) rotateZ(0deg) skewY(0deg) scale(1);
    filter: brightness(1);
  }
}

@keyframes turnPrev {
  0% {
    opacity: 1;
    transform: translateZ(26px) rotateY(0deg) rotateZ(0deg) skewY(0deg) scale(1);
    filter: brightness(1);
  }

  22% {
    opacity: 1;
    transform: translateZ(40px) rotateX(-1.5deg) rotateY(34deg) rotateZ(1.8deg) skewY(0.8deg) scale(0.995, 1.006);
    filter: brightness(1.02);
  }

  48% {
    opacity: 1;
    transform: translateZ(56px) rotateX(-2.2deg) rotateY(86deg) rotateZ(3deg) skewY(1.5deg) scale(0.982, 1.012);
    filter: brightness(0.92);
  }

  72% {
    opacity: 1;
    transform: translateZ(44px) rotateX(-1.2deg) rotateY(136deg) rotateZ(1.9deg) skewY(0.7deg) scale(0.992, 1.006);
    filter: brightness(0.97);
  }

  92% {
    opacity: 1;
    transform: translateZ(28px) rotateY(164deg) rotateZ(0.4deg) skewY(0deg) scale(1);
    filter: brightness(1);
  }

  100% {
    opacity: 1;
    transform: translateZ(24px) rotateY(168deg) rotateZ(0deg) skewY(0deg) scale(1);
    filter: brightness(1);
  }
}

@keyframes frontFaceSwap {
  0%,
  49% {
    opacity: 1;
  }

  50%,
  100% {
    opacity: 0;
  }
}

@keyframes backFaceSwap {
  0%,
  49% {
    opacity: 0;
  }

  50%,
  100% {
    opacity: 1;
  }
}

@keyframes frontInkFade {
  0%,
  36% {
    opacity: 1;
  }

  54% {
    opacity: 0.34;
  }

  68%,
  100% {
    opacity: 0;
  }
}

@keyframes paperBackReveal {
  0%,
  34% {
    opacity: 0;
  }

  50% {
    opacity: 0.82;
  }

  66%,
  100% {
    opacity: 1;
  }
}

@keyframes turnShade {
  0%,
  100% {
    opacity: 0.08;
  }

  50% {
    opacity: 0.55;
  }
}

@keyframes curlRidge {
  0%,
  100% {
    opacity: 0.18;
    transform: translateX(0) scaleX(0.8);
  }

  45% {
    opacity: 0.86;
    transform: translateX(-16px) scaleX(1.2);
  }

  66% {
    opacity: 0.52;
    transform: translateX(-7px) scaleX(0.9);
  }
}

.secondary-page {
  display: none;
}

.viewer-shell.is-double .secondary-page {
  display: grid;
}

.loading-panel {
  position: absolute;
  z-index: 12;
  display: grid;
  gap: 12px;
  place-items: center;
  min-width: 220px;
  padding: 22px 26px;
  color: var(--text);
  text-align: center;
  background: rgba(40, 40, 40, 0.92);
  border: 1px solid rgba(255, 255, 255, 0.11);
  border-radius: 6px;
  box-shadow: 0 18px 44px rgba(0, 0, 0, 0.45);
}

.loading-panel[hidden] {
  display: none;
}

.spinner {
  width: 28px;
  height: 28px;
  border: 3px solid rgba(255, 255, 255, 0.24);
  border-top-color: var(--accent);
  border-radius: 999px;
  animation: spin 800ms linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.edge-arrow {
  position: absolute;
  top: 50%;
  z-index: 10;
  display: grid;
  place-items: center;
  width: 46px;
  height: 76px;
  margin-top: -38px;
  color: #fff;
  font-size: 66px;
  line-height: 1;
  background: transparent;
  border: 0;
  cursor: pointer;
  filter: drop-shadow(0 8px 16px rgba(0, 0, 0, 0.55));
  opacity: 0.84;
  transition:
    opacity 180ms ease,
    background-color 180ms ease;
}

.edge-arrow:hover {
  opacity: 1;
}

.edge-arrow i {
  display: block;
  font-size: 34px;
  line-height: 1;
}

.edge-left {
  left: 16px;
}

.edge-right {
  right: 16px;
}

.bottom-film {
  z-index: 16;
  display: flex;
  align-items: center;
  justify-self: center;
  gap: 8px;
  width: min(900px, calc(100vw - 28px));
  min-height: 70px;
  padding: 6px 10px 10px;
}

.film-toggle {
  flex: 0 0 auto;
  width: 38px;
  height: 48px;
  color: #fff;
  font-size: 24px;
  background: rgba(82, 82, 82, 0.82);
}

.thumb-strip {
  display: flex;
  align-items: flex-end;
  gap: 5px;
  min-width: 0;
  max-width: 100%;
  overflow-x: auto;
  padding: 3px 3px 7px;
  scrollbar-color: var(--accent) rgba(255, 255, 255, 0.14);
}

.thumb {
  position: relative;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  width: 43px;
  height: 58px;
  overflow: hidden;
  background: #ecebe6;
  border: 2px solid transparent;
  border-radius: 2px;
  box-shadow: 0 5px 13px rgba(0, 0, 0, 0.35);
  cursor: pointer;
}

.thumb canvas {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.thumb.is-active {
  border-color: var(--accent);
}

.thumb span {
  position: absolute;
  right: 2px;
  bottom: 1px;
  padding: 0 3px;
  color: #fff;
  font-size: 9px;
  background: rgba(0, 0, 0, 0.62);
  border-radius: 2px;
}

.drawer {
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  z-index: 40;
  display: flex;
  flex-direction: column;
  width: min(360px, 90vw);
  padding: 18px;
  background: rgba(34, 34, 34, 0.99);
  border-right: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 18px 0 40px rgba(0, 0, 0, 0.42);
  transform: translateX(-105%);
  transition: transform 220ms ease;
}

.drawer.is-open {
  transform: translateX(0);
}

.drawer-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 38px;
  margin-bottom: 14px;
}

.drawer-title {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  font-size: 17px;
}

.drawer-title i {
  color: var(--accent);
}

.drawer-view {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.drawer-view[hidden] {
  display: none;
}

.drawer-backdrop {
  position: fixed;
  inset: 0;
  z-index: 39;
  display: none;
  padding: 0;
  background: rgba(0, 0, 0, 0.38);
  border: 0;
  cursor: default;
  backdrop-filter: blur(1px);
}

.drawer-backdrop.is-open {
  display: block;
}

.surah-search {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 40px;
  margin-bottom: 12px;
  padding: 0 10px;
  color: #777;
  background: #f6f6f6;
  border: 1px solid transparent;
  border-radius: 4px;
}

.surah-search:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(68, 199, 216, 0.2);
}

.surah-search input {
  flex: 1 1 auto;
  width: 100%;
  height: 38px;
  min-width: 0;
  padding: 0;
  color: #222;
  background: transparent;
  border: 0;
  border-radius: 4px;
  outline: 0;
}

.surah-search input:focus {
  box-shadow: none;
}

.surah-list {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.surah-item {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) 42px;
  align-items: center;
  width: 100%;
  min-height: 40px;
  padding: 5px 7px;
  color: var(--text);
  text-align: left;
  background: transparent;
  border: 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  cursor: pointer;
}

.surah-item:hover,
.surah-item.is-active {
  background: rgba(68, 199, 216, 0.18);
}

.surah-number,
.surah-page {
  color: var(--muted);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

.surah-name {
  min-width: 0;
  overflow: hidden;
  font-size: 14px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.surah-page {
  text-align: right;
}

.bookmark-current {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  gap: 9px;
  width: 100%;
  min-height: 42px;
  margin-bottom: 10px;
  padding: 8px 12px;
  color: #fff;
  font-weight: 650;
  background: rgba(68, 199, 216, 0.17);
  border: 1px solid rgba(68, 199, 216, 0.3);
  border-radius: 4px;
  cursor: pointer;
}

.bookmark-current:hover {
  background: rgba(68, 199, 216, 0.25);
}

.bookmark-current.is-active {
  color: #ffe28a;
  background: rgba(241, 207, 103, 0.14);
  border-color: rgba(241, 207, 103, 0.28);
}

.bookmark-list,
.search-results-list {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(68, 199, 216, 0.64) transparent;
}

.bookmark-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 38px;
  align-items: stretch;
  min-height: 50px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.bookmark-row:hover,
.bookmark-row.is-active {
  background: rgba(68, 199, 216, 0.12);
}

.bookmark-go,
.bookmark-remove,
.search-result-item {
  color: var(--text);
  background: transparent;
  border: 0;
  cursor: pointer;
}

.bookmark-go {
  display: grid;
  gap: 3px;
  align-content: center;
  min-width: 0;
  padding: 7px 9px;
  text-align: left;
}

.bookmark-page {
  font-size: 14px;
  font-weight: 700;
}

.bookmark-surah {
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.bookmark-remove {
  display: grid;
  place-items: center;
  color: #d6d6d6;
  font-size: 14px;
}

.bookmark-remove:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.09);
}

.drawer-empty,
.search-results-summary {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.drawer-empty {
  padding: 18px 8px;
  text-align: center;
}

.search-results-summary {
  flex: 0 0 auto;
  padding: 0 4px 11px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.09);
}

.search-result-item {
  display: grid;
  gap: 7px;
  width: 100%;
  padding: 11px 7px 12px;
  cursor: pointer;
  text-align: left;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.search-result-item > * {
  pointer-events: none;
}

.search-result-item:hover,
.search-result-item.is-active {
  background: rgba(68, 199, 216, 0.13);
}

.search-result-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  color: #fff;
  font-size: 13px;
}

.search-result-heading span {
  overflow: hidden;
  color: var(--accent);
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.search-result-snippet {
  display: -webkit-box;
  overflow: hidden;
  color: #d5d5d5;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 12px;
  line-height: 1.42;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
}

.search-result-snippet mark {
  padding: 0 1px;
  color: #171717;
  background: #ffe28a;
  border-radius: 2px;
}

.tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  margin-bottom: 12px;
}

.tab {
  min-height: 34px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.08);
}

.tab.is-active {
  color: #fff;
  background: rgba(68, 199, 216, 0.28);
}

.drawer-panel {
  display: none;
  min-height: 0;
  overflow: auto;
}

.drawer-panel.is-active {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(62px, 1fr));
  align-content: start;
  gap: 10px;
}

#drawerOutline.is-active {
  display: block;
}

.drawer-thumb {
  display: grid;
  gap: 4px;
  color: var(--muted);
  font-size: 11px;
  text-align: center;
  background: transparent;
  border: 0;
  cursor: pointer;
}

.drawer-thumb canvas {
  width: 100%;
  min-height: 84px;
  background: #fff;
  border: 2px solid transparent;
  border-radius: 2px;
  box-shadow: 0 6px 14px rgba(0, 0, 0, 0.4);
}

.drawer-thumb.is-active canvas {
  border-color: var(--accent);
}

.outline-item {
  display: block;
  width: 100%;
  margin: 0 0 5px;
  padding: 8px 10px;
  color: var(--text);
  text-align: left;
  background: rgba(255, 255, 255, 0.07);
  border: 0;
  border-radius: 4px;
  cursor: pointer;
}

.outline-item small {
  display: block;
  color: var(--muted);
}

.empty-state {
  margin: 14px 0;
  color: var(--muted);
  line-height: 1.5;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.share-modal[hidden] { display: none; }

.share-modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 18px;
}

.share-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.62);
  border: 0;
  backdrop-filter: blur(4px);
}

.share-dialog {
  position: relative;
  width: min(440px, 100%);
  padding: 18px;
  color: #f4f6f7;
  background: #1d2022;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.58);
}

.share-dialog-header,
.share-dialog-header > div,
.share-link-row {
  display: flex;
  align-items: center;
}

.share-dialog-header { justify-content: space-between; }
.share-dialog-header > div { gap: 10px; }
.share-dialog-header > div > i { color: var(--accent); }

.share-dialog h2 {
  margin: 0;
  font-size: 17px;
  letter-spacing: 0;
}

.share-close {
  width: 34px;
  height: 34px;
  color: #e7eaec;
  background: transparent;
  border: 0;
  border-radius: 6px;
}

.share-description {
  margin: 12px 0;
  color: #b9c0c4;
  font-size: 13px;
}

.share-link-row { gap: 7px; }

.share-link-row input {
  min-width: 0;
  height: 40px;
  flex: 1 1 auto;
  padding: 0 10px;
  color: #e7eaec;
  background: #292d30;
  border: 1px solid rgba(255, 255, 255, 0.11);
  border-radius: 6px;
}

.share-link-row button {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 40px;
  padding: 0 13px;
  color: #fff;
  background: #327f89;
  border: 0;
  border-radius: 6px;
}

.share-destinations {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 7px;
  margin-top: 12px;
}

.share-destinations a {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-width: 0;
  height: 42px;
  color: #e8ecee;
  font-size: 12px;
  text-decoration: none;
  background: #272a2d;
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 6px;
}

@media (max-width: 820px) {
  .viewer-shell {
    grid-template-rows: auto 1fr;
  }

  .topbar {
    display: block;
    width: calc(100vw - 16px);
    min-height: 0;
    margin: 8px 8px 4px;
    padding: 8px;
    background: rgba(27, 29, 31, 0.98);
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.34);
  }

  .mobile-toolbar-c {
    display: grid;
    gap: 0;
  }

  .mobile-c-primary,
  .mobile-c-actions {
    display: grid;
    align-items: center;
  }

  .mobile-c-primary {
    grid-template-columns: 38px minmax(148px, 1fr) 38px;
    gap: 7px;
    padding: 0 0 7px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.09);
  }

  .mobile-c-nav {
    display: grid;
    grid-template-columns: 34px minmax(76px, 1fr) 34px;
    align-items: center;
    height: 38px;
    overflow: hidden;
    background: #24272a;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 6px;
  }

  .mobile-c-page {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-width: 0;
    color: #f5f7f8;
    font-size: 13px;
    white-space: nowrap;
  }

  .mobile-c-button {
    display: inline-grid;
    place-items: center;
    width: 38px;
    height: 38px;
    padding: 0;
    color: #f4f5f6;
    font-size: 16px;
    background: transparent;
    border: 1px solid transparent;
    border-radius: 6px;
  }

  .mobile-c-primary > .mobile-c-button {
    background: #24272a;
    border-color: rgba(255, 255, 255, 0.1);
  }

  .mobile-c-button:active,
  .mobile-c-button.is-active {
    color: #fff;
    background: rgba(68, 199, 216, 0.24);
  }

  .mobile-c-button[disabled] {
    opacity: 0.3;
  }

  .mobile-c-actions {
    grid-template-columns: repeat(6, 1fr);
    padding-top: 5px;
  }

  .mobile-c-actions .mobile-c-button {
    width: 100%;
    height: 34px;
    color: #dde2e4;
    border-radius: 4px;
  }

  .toolbar-primary {
    display: none;
  }

  .zoom-strip {
    grid-column: 1 / -1;
    width: 100%;
    height: 38px;
    margin-bottom: 1px;
    background: #202326;
  }

  .zoom-strip input[type="range"] {
    flex: 1 1 auto;
    width: auto;
  }

  .toolbar-label-button {
    width: 100%;
    min-width: 0;
    padding: 0 8px;
    font-size: 12px;
    background: #24272a;
  }

  .more-menu-button {
    position: absolute;
    top: 0;
    right: 0;
    display: inline-grid !important;
    width: 36px;
    height: 36px;
    background: #24272a;
    border: 1px solid rgba(255, 255, 255, 0.09);
  }

  .mobile-fullscreen-button {
    position: absolute;
    top: 0;
    right: 42px;
    display: inline-grid !important;
    width: 36px;
    height: 36px;
    background: #24272a;
    border: 1px solid rgba(255, 255, 255, 0.09);
  }

  .mobile-fullscreen-button.is-active {
    color: #fff;
    background: rgba(68, 199, 216, 0.28);
  }

  .more-menu-button.is-active {
    color: #fff;
    background: rgba(68, 199, 216, 0.28);
  }

  .toolbar-overflow {
    position: absolute;
    top: calc(100% + 7px);
    right: 0;
    left: 0;
    z-index: 35;
    display: none;
    grid-template-columns: 1fr;
    gap: 10px;
    max-height: calc(100vh - 118px);
    padding: 10px;
    overflow-y: auto;
    background: rgba(25, 27, 29, 0.99);
    border: 1px solid rgba(255, 255, 255, 0.13);
    border-radius: 8px;
    box-shadow: 0 18px 42px rgba(0, 0, 0, 0.52);
    scrollbar-width: none;
  }

  .toolbar-overflow::-webkit-scrollbar {
    display: none;
  }

  .toolbar-overflow.is-open {
    display: grid;
  }

  .nav-controls {
    justify-content: center;
    min-height: 40px;
    padding-bottom: 8px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  }

  .search-box {
    width: 100%;
    height: 40px;
  }

  .search-box:not(.is-expanded) .search-leading-icon,
  .search-box:not(.is-expanded) input,
  .search-box:not(.is-expanded) .search-clear,
  .search-box:not(.is-expanded) .search-meta {
    width: auto;
    min-width: 0;
    margin-left: 10px;
    padding: 0 8px;
    opacity: 1;
    pointer-events: auto;
  }

  .toolbar-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 6px;
    padding: 0;
    border: 0;
  }

  .toolbar-actions .menu-command {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 9px;
    width: 100%;
    height: 40px;
    padding: 0 10px;
    font-size: 13px;
    background: rgba(255, 255, 255, 0.07);
    border: 1px solid rgba(255, 255, 255, 0.07);
  }

  .toolbar-actions .menu-command i {
    width: 18px;
    color: #d9f7fb;
    text-align: center;
  }

  .command-label {
    display: inline;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .stage {
    padding: 8px 42px 6px;
  }

  .book {
    max-height: calc(100vh - 116px);
    padding: 12px;
    touch-action: none;
  }

  .viewer-shell:not(.is-dark-pages).is-flip-portrait .flip-page.is-page-back,
  .viewer-shell:not(.is-dark-pages).is-flip-portrait .flip-page.is-page-back .flip-page-surface {
    background: #fff !important;
  }

  .viewer-shell.is-dark-pages.is-flip-portrait .flip-page.is-page-back,
  .viewer-shell.is-dark-pages.is-flip-portrait .flip-page.is-page-back .flip-page-surface,
  .viewer-shell.is-dark-pages.is-flip-portrait .flip-page.is-page-back .flip-page-loader {
    background: #1e1e1e !important;
  }

  .viewer-shell.is-flip-portrait .flip-page.is-page-back .pdf-page-image,
  .viewer-shell.is-flip-portrait .flip-page.is-page-back .flip-page-loader {
    visibility: hidden !important;
  }

  .page-frame canvas {
    max-width: none;
    max-height: none;
  }

  .viewer-shell.is-double .secondary-page {
    display: none;
  }

  .edge-arrow {
    top: auto;
    bottom: max(10px, env(safe-area-inset-bottom));
    width: 54px;
    height: 46px;
    margin-top: 0;
    color: #fff;
    font-size: 24px;
    background: rgba(28, 28, 28, 0.78);
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: 4px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.38);
    filter: none;
    opacity: 1;
    backdrop-filter: blur(7px);
  }

  .edge-arrow i {
    font-size: 24px;
  }

  .edge-left {
    right: calc(50% + 5px);
    left: auto;
  }

  .edge-right {
    right: auto;
    left: calc(50% + 5px);
  }

  .viewer-shell.is-fullscreen.fullscreen-notice-active .edge-arrow {
    top: 50%;
    bottom: auto;
    z-index: 40;
    width: 48px;
    height: 58px;
    margin-top: 0;
    transform: translateY(-50%);
  }

  .viewer-shell.is-fullscreen.fullscreen-notice-active .edge-left {
    right: auto;
    left: max(10px, env(safe-area-inset-left));
  }

  .viewer-shell.is-fullscreen.fullscreen-notice-active .edge-right {
    right: max(10px, env(safe-area-inset-right));
    left: auto;
  }

  .viewer-shell.controls-hidden .edge-arrow {
    pointer-events: auto;
    opacity: 1;
  }

  .viewer-shell .edge-arrow[disabled],
  .viewer-shell.controls-hidden .edge-arrow[disabled] {
    pointer-events: none;
    cursor: not-allowed;
    opacity: 0.24;
  }

}

@media (max-width: 540px) {
  .topbar {
    width: calc(100vw - 12px);
    margin-right: 6px;
    margin-left: 6px;
  }

  .page-jump input {
    width: 52px;
  }

  .zoom-title span {
    display: none;
  }

  .toolbar-actions {
    grid-template-columns: 1fr;
  }

}
