.bv-native-sheet-dialog-overlay[hidden],
.bv-native-sheet-shell[hidden] {
  display: none !important;
}

.bv-native-sheet-dialog-overlay {
  position: fixed;
  inset: 0;
  z-index: 13000;
  display: grid;
  place-items: center;
  padding: 24px;
  box-sizing: border-box;
  background: rgba(18, 22, 30, 0.58);
  backdrop-filter: blur(3px);
}

.bv-native-sheet-dialog {
  width: min(620px, calc(100vw - 32px));
  padding: 24px;
  box-sizing: border-box;
  color: var(--bv-text-main, #172235);
  background: var(--bv-paper, #fffdf7);
  border: 2px solid var(--bv-border-main, #172235);
  border-radius: 12px;
  box-shadow: 8px 9px 0 rgba(15, 24, 38, 0.42);
}

.bv-native-sheet-dialog__head,
.bv-native-sheet-toolbar {
  display: flex;
  align-items: center;
  gap: 16px;
  justify-content: space-between;
}

.bv-native-sheet-dialog__head h3 {
  margin: 4px 0 0;
}

.bv-native-sheet-dialog__eyebrow,
.bv-native-sheet-toolbar__eyebrow {
  color: var(--bv-text-subtle, #6f7783);
  font: 700 11px/1.2 "Courier Prime", monospace;
  letter-spacing: 0.12em;
}

.bv-native-sheet-field {
  display: grid;
  gap: 7px;
  margin-top: 24px;
  font: 700 12px/1.2 "Courier Prime", monospace;
  letter-spacing: 0.06em;
}

.bv-native-sheet-orientation {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin: 20px 0;
  padding: 0;
  border: 0;
}

.bv-native-sheet-orientation legend {
  grid-column: 1 / -1;
  margin-bottom: 7px;
  font: 700 12px/1.2 "Courier Prime", monospace;
  letter-spacing: 0.06em;
}

.bv-native-sheet-orientation label {
  display: grid;
  grid-template-columns: auto 54px 1fr;
  align-items: center;
  gap: 12px;
  min-height: 76px;
  padding: 12px;
  background: rgba(255, 255, 255, 0.58);
  border: 1px solid var(--bv-border-subtle, rgba(23, 34, 53, 0.28));
  border-radius: 8px;
  cursor: pointer;
}

.bv-native-sheet-orientation label:has(input:checked) {
  border-color: var(--bv-accent-primary, #3156d9);
  box-shadow: inset 4px 0 0 var(--bv-accent-primary, #3156d9);
}

.bv-native-sheet-orientation__paper {
  display: block;
  background: #fffef9;
  border: 1px solid #172235;
  box-shadow: 2px 2px 0 rgba(23, 34, 53, 0.28);
}

.bv-native-sheet-orientation__paper.is-portrait {
  width: 31px;
  height: 44px;
}

.bv-native-sheet-orientation__paper.is-landscape {
  width: 44px;
  height: 31px;
}

.bv-native-sheet-card {
  cursor: pointer;
  transition: transform 90ms ease, opacity 90ms ease, box-shadow 90ms ease;
}

.bv-native-sheet-card:hover {
  transform: translateY(-1px);
}

.bv-native-sheet-card.is-opening {
  opacity: 0.72;
  cursor: progress;
}

.bv-native-sheet-card .bv-card__media {
  display: grid;
  place-items: center;
  background:
    linear-gradient(rgba(72, 86, 107, 0.08) 1px, transparent 1px),
    linear-gradient(90deg, rgba(72, 86, 107, 0.08) 1px, transparent 1px),
    #e9e5d9;
  background-size: 22px 22px;
}

.bv-native-sheet-card__paper {
  position: relative;
  width: 70%;
  aspect-ratio: 210 / 297;
  overflow: hidden;
  background: #fffef9;
  border: 1px solid rgba(23, 34, 53, 0.52);
  box-shadow: 6px 7px 0 rgba(23, 34, 53, 0.24);
}

.bv-native-sheet-card__paper.is-landscape {
  width: 86%;
  aspect-ratio: 297 / 210;
}

.bv-native-sheet-card__preview {
  display: block;
  width: 100%;
  height: 100%;
  background: #fffef9;
  object-fit: contain;
}

.bv-native-sheet-card__preview[hidden] {
  display: none;
}

.bv-native-sheet-card__paper.has-preview {
  background: #f8f5eb;
}

.bv-native-sheet-shell {
  width: 100%;
  min-width: 0;
  background: var(--bv-bg-main, #e8e5dc);
}

.bv-native-sheet-toolbar {
  margin: 0 0 14px;
  padding: 12px 14px;
  background: var(--bv-paper, #fffdf7);
  border: 2px solid var(--bv-border-main, #172235);
  border-radius: 8px;
  box-shadow: 4px 5px 0 rgba(23, 34, 53, 0.24);
}

.bv-native-sheet-toolbar__title {
  margin-top: 3px;
  font: 700 17px/1.25 "Courier Prime", monospace;
}

.bv-native-sheet-toolbar__status {
  display: flex;
  gap: 8px;
  margin-left: auto;
  color: var(--bv-text-subtle, #6f7783);
  font: 700 11px/1.2 "Courier Prime", monospace;
}

.bv-native-sheet-stage {
  min-height: calc(100vh - 265px);
  overflow: auto;
  display: grid;
  place-items: start center;
  padding: 30px;
  box-sizing: border-box;
  background:
    linear-gradient(rgba(255,255,255,.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,.035) 1px, transparent 1px),
    #20231f;
  background-size: 54px 54px;
  border: 1px solid rgba(218, 205, 170, 0.52);
}

.bv-native-sheet-paper {
  position: relative;
  width: min(76vw, 860px);
  aspect-ratio: 210 / 297;
  box-sizing: border-box;
  background: #fffef9;
  border: 1px solid #cfc7b5;
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.38);
}

.bv-native-sheet-paper.is-landscape {
  width: min(86vw, 1080px);
  aspect-ratio: 297 / 210;
}

.bv-native-sheet-paper__hint {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  gap: 8px;
  max-width: 440px;
  margin: auto;
  padding: 40px;
  text-align: center;
  color: rgba(23, 34, 53, 0.48);
  font: 400 14px/1.55 "Spectral", serif;
}

.bv-native-sheet-paper__hint b {
  font: 700 15px/1.3 "Courier Prime", monospace;
  letter-spacing: 0.04em;
}

.bv-native-sheet-shell.is-opening #bvNativeSheetObjectLayer,
.bv-native-sheet-shell.is-opening #bvNativeSheetInkCanvas,
.bv-native-sheet-shell.is-opening #bvNativeSheetCommittedInkCanvas {
  opacity: 0 !important;
  pointer-events: none !important;
}

.bv-native-sheet-paper.is-loading::after {
  position: absolute;
  z-index: 30;
  left: 50%;
  top: calc(50% + 54px);
  width: 22px;
  height: 22px;
  margin: -11px 0 0 -11px;
  border: 2px solid rgba(49, 86, 217, 0.18);
  border-top-color: #3156d9;
  border-radius: 50%;
  content: "";
  animation: bvNativeSheetOpenSpin 720ms linear infinite;
}

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

body.bv-native-sheet-active #viewer .viewer-controls-shell,
body.bv-native-sheet-active #viewer #singlePageViewerShell,
body.bv-native-sheet-active #viewer #scrollReaderShell,
body.bv-native-sheet-active #viewer #viewerSearchRail,
body.bv-native-sheet-active #viewer #bvFullPageToolbar,
body.bv-native-sheet-active #viewer .reader-mode-header {
  display: none !important;
}

body.bv-native-sheet-active #viewer .viewer-workspace {
  display: block;
}

@media (max-width: 760px) {
  .bv-native-sheet-orientation {
    grid-template-columns: 1fr;
  }

  .bv-native-sheet-toolbar {
    align-items: flex-start;
    flex-wrap: wrap;
  }

  .bv-native-sheet-toolbar__status {
    margin-left: 0;
  }

  .bv-native-sheet-stage {
    padding: 16px;
  }

  .bv-native-sheet-paper,
  .bv-native-sheet-paper.is-landscape {
    width: 100%;
  }
}

@media (prefers-reduced-motion: reduce) {
  .bv-native-sheet-card {
    transition: none;
  }

  .bv-native-sheet-paper.is-loading::after {
    animation-duration: 1400ms;
  }
}

/* Blank Sheet lives inside the Reader's recessed Document Bay. The Reader bay
   intentionally has padding and a grid gap on every side; with only the native
   sheet mounted, the lower padding/gap becomes the dead dark band above the
   expandable progress drawer. Keep the top/side frame, but collapse the lower
   recess so the drawer sits directly against the Blank Sheet container. */
html body.bv-native-sheet-active.bv-c43-final-ui.bv-c43k-reader-signposted
#viewer .viewer-workspace {
  padding-bottom: 0 !important;
  row-gap: 0 !important;
}
