:root {
  --bar-bg: #fbfcfd;
  --text: #333333;
  --control: #0B678B;
  --control-dark: #074a69;
  --edge-bg: #ececec;
  --edge-bg-active: #dfe7ec;
  --edge-width: max(34px, calc(100vw * var(--flip-edge-ratio, 0.037)));
  --muted: #4a5a66;
  --input-bg: #ffffff;
  --search-mark: #FFD400;
  --annotation-mark: #0B678B;
  --annotation-fill: color-mix(in srgb, var(--control) 15%, transparent);
  --annotation-tip-gap: 8px;
  --note-fill: #aad5ff;
  --note-border: #2b6cb0;
  --note-box-width: 13.75rem;
  --note-box-height: 6.5rem;
  --note-place-bar-height: 62px;
  --danger: #b3261e;
  --header-h: 0px;
  --footer-h: 0px;
}

* {
  box-sizing: border-box;
}

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

body {
  color: var(--text);
  font-family: sans-serif;
  overflow: hidden;
}

.book-stage {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  background: #e9eff4;
}

#slideViewport {
  display: grid;
  width: 100%;
  height: 100%;
  padding: 10px var(--edge-width);
  overflow: hidden;
  place-items: center;
  scrollbar-width: none;
  touch-action: none;
}

#slideViewport::-webkit-scrollbar {
  display: none;
}

#slideViewport.zoomed {
  display: block;
  padding: 50vh 50vw;
  overflow: auto;
}

#holderCurrent {
  position: relative;
  display: grid;
  width: 100%;
  height: 100%;
  min-width: 0;
  min-height: 0;
  place-items: center;
  container-type: size;
}

#slideViewport.zoomed #holderCurrent {
  width: var(--zoomed-page-width);
  height: var(--zoomed-page-height);
  margin: auto;
  place-items: stretch;
}

#slideViewport.zoomed #pageImage {
  width: 100%;
  height: 100%;
  max-width: none;
  max-height: none;
}

#slideViewport.zoomed #pageHighlightLayer,
#slideViewport.zoomed #noteTagLayer,
#slideViewport.zoomed #annotationLayer,
#slideViewport.zoomed #linkLayer {
  width: 100%;
  height: 100%;
}

#pageImage,
#holderIncoming img {
  display: block;
  width: min(100cqw, calc(100cqh * var(--page-width) / var(--page-height)));
  height: auto;
  max-width: 100%;
  max-height: 100%;
  aspect-ratio: var(--page-width) / var(--page-height);
  border: 1px solid #c6ced5;
  background: #ffffff;
  box-shadow: 0 2px 8px rgb(40 55 70 / 25%);
  object-fit: contain;
}

#pageImage {
  position: relative;
  z-index: 0;
  user-select: none;
  -webkit-user-drag: none;
}

#pageHighlightLayer,
#noteTagLayer,
#annotationLayer,
#linkLayer {
  position: absolute;
  z-index: 4;
  inset: 0;
  pointer-events: none;
}

#annotationLayer {
  z-index: 5;
}

#linkLayer {
  z-index: 5;
}

#noteTagLayer {
  z-index: 6;
}

#slideViewport[data-page-error="true"] #noteTagLayer {
  display: none;
}

#slideViewport[data-placing="true"] #annotationLayer,
#slideViewport[data-placing="true"] #linkLayer {
  pointer-events: none;
}

#slideViewport[data-placing="true"] .annotation-rect,
#slideViewport[data-placing="true"] .page-link {
  pointer-events: none;
}

body:has(#slideViewport[data-placing="true"]) #annotationTip::before {
  pointer-events: none;
}

.annotation-mark {
  position: absolute;
  inset: 0;
  z-index: 0;
  display: block;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  pointer-events: none;
}

.annotation-rect {
  position: absolute;
  box-sizing: border-box;
  display: block;
  pointer-events: auto;
}

.annotation-rect::after {
  position: absolute;
  right: 0;
  bottom: 20%;
  left: 0;
  border-bottom: 2px dotted var(--annotation-mark);
  content: '';
  pointer-events: none;
}

.annotation-mark.active .annotation-rect,
.annotation-rect:hover {
  background: linear-gradient(
    to top,
    transparent 0 37%,
    var(--annotation-fill) 37% 65%,
    transparent 65% 100%
  );
}

.annotation-mark:focus-visible .annotation-rect {
  outline: 2px solid var(--control);
  outline-offset: 1px;
  background: linear-gradient(
    to top,
    transparent 0 37%,
    var(--annotation-fill) 37% 65%,
    transparent 65% 100%
  );
}

.page-link {
  position: absolute;
  box-sizing: border-box;
  display: block;
  border: 0;
  background: transparent;
  cursor: pointer;
  pointer-events: auto;
}

.page-link:hover,
.page-link:focus-visible {
  border: 2px solid var(--control);
  background: var(--annotation-fill);
}

#annotationTip {
  position: fixed;
  z-index: 20;
  max-width: min(24rem, calc(100vw - 1rem));
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--control);
  border-radius: 0.5rem;
  color: var(--text);
  background: var(--bar-bg);
  box-shadow: 0 2px 8px rgb(40 55 70 / 25%);
  overflow-wrap: anywhere;
}

#annotationTip::before {
  position: absolute;
  right: -1px;
  left: -1px;
  height: calc(var(--annotation-tip-gap) + 1px);
  content: '';
  pointer-events: auto;
}

#annotationTip[data-placement="above"]::before {
  top: 100%;
}

#annotationTip[data-placement="below"]::before {
  bottom: 100%;
}

.note-box {
  position: absolute;
  box-sizing: border-box;
  display: grid;
  grid-template-rows: 1.75rem minmax(0, 1fr);
  left: max(0px, min(var(--note-left), calc(100% - var(--note-box-width))));
  top: max(0px, min(var(--note-top), calc(100% - var(--note-box-height))));
  width: var(--note-box-width);
  height: var(--note-box-height);
  overflow: hidden;
  border: 1px solid var(--note-border);
  border-radius: 0.5rem;
  background: var(--note-fill);
  color: var(--text);
  pointer-events: auto;
}

.note-box.flash {
  animation: note-flash 1.5s ease-in-out;
}

.note-box:focus-within {
  z-index: 1;
  outline: 2px solid var(--control);
  outline-offset: 2px;
}

.note-box.is-front {
  z-index: 2;
}

.note-bar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  height: 1.75rem;
  min-height: 1.75rem;
  padding-left: 0.25rem;
  align-items: center;
  font-size: 0.75rem;
}

.note-box [data-note-delete],
.note-delete {
  display: inline-grid;
  width: 2.75rem;
  min-width: 1.5rem;
  height: 2.75rem;
  min-height: 1.5rem;
  padding: 0;
  border: 0;
  border-radius: 0.5rem;
  place-items: center;
  color: var(--danger);
  background: transparent;
}

.note-box [data-note-delete] {
  width: 1.75rem;
  height: 1.75rem;
}

.note-box [data-note-delete]:hover,
.note-delete:hover,
.note-box [data-note-delete]:focus-visible,
.note-delete:focus-visible {
  background: color-mix(in srgb, var(--danger) 10%, transparent);
}

.note-count.at-limit,
.note-limit {
  color: var(--danger);
}

.note-limit {
  margin-right: 0.25rem;
}

.note-text {
  box-sizing: border-box;
  width: 100%;
  min-height: 0;
  resize: none;
  border: 0;
  padding: 0.25rem;
  overflow-y: auto;
  overscroll-behavior: contain;
  color: inherit;
  font: inherit;
  background: transparent;
}

.note-box .note-text:focus-visible {
  outline: none;
}

@keyframes note-flash {
  0%, 100% { outline-color: transparent; }
  50% { outline: 0.25rem solid var(--control); outline-offset: 0.125rem; }
}

.page-hl {
  position: absolute;
  background: linear-gradient(
    to top,
    transparent 0 37%,
    color-mix(in srgb, var(--highlight-color) var(--highlight-opacity), transparent) 37% 65%,
    transparent 65% 100%
  );
  mix-blend-mode: multiply;
}

.page-hl.is-vertical {
  background: color-mix(in srgb, var(--highlight-color) var(--highlight-opacity), transparent);
}

.page-hl.is-search {
  --highlight-color: var(--search-mark);
  --highlight-opacity: 55%;
}

.page-hl.is-reading {
  --highlight-color: var(--control);
  --highlight-opacity: 32%;
}

#holderIncoming {
  position: absolute;
  z-index: 1;
  inset: 0;
  display: none;
  place-items: center;
  pointer-events: none;
}

#holderIncoming.staged {
  display: grid;
}

.flip-stage {
  position: absolute;
  z-index: 2;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  pointer-events: none;
  visibility: visible;
}

#holderCurrent.flipping {
  z-index: 8;
}

#holderCurrent.flipping > #pageImage,
#holderCurrent.flipping > #pageHighlightLayer,
#holderCurrent.flipping > #noteTagLayer,
#holderCurrent.flipping > #annotationLayer,
#holderCurrent.flipping > #linkLayer {
  visibility: hidden;
}

.flip-remain {
  position: absolute;
  inset: 0;
  transform-origin: 0 0;
  will-change: clip-path, transform, opacity;
  background-position: center;
  background-repeat: no-repeat;
  background-size: 100% 100%;
}

.flip-back {
  position: absolute;
  inset: 0;
  transform-origin: 0 0;
  will-change: clip-path, transform, opacity;
  background: linear-gradient(115deg, #ffffff, #f4f4f4 55%, #dddddd);
  box-shadow: 0.25rem 0.25rem 0.75rem rgb(40 55 70 / 30%);
}

#pageError {
  position: absolute;
  z-index: 3;
  inset: 0;
  display: grid;
  padding: 1rem;
  place-content: center;
  color: var(--text);
  text-align: center;
  background: rgb(255 255 255 / 88%);
}

#pageError a {
  color: var(--control);
}

#pageError[hidden] {
  display: none;
}

#cursorTip {
  position: fixed;
  z-index: 30;
  max-width: calc(100vw - 1rem);
  padding: 0.375rem 0.625rem;
  border: 1px solid var(--control);
  border-radius: 0.5rem;
  color: var(--bar-bg);
  font-size: 0.75rem;
  white-space: nowrap;
  background: var(--text);
  pointer-events: none;
}

#cursorTip.show {
  display: block;
}

.edge {
  position: fixed;
  z-index: 7;
  top: 0;
  bottom: 0;
  left: 0;
  width: var(--edge-width);
  background: var(--edge-bg);
}

.edge-next {
  right: 0;
  left: auto;
}

.edge button {
  width: 100%;
  height: 100%;
  padding: 0;
  border: 0;
  color: var(--control);
  background: transparent;
  cursor: pointer;
}

.edge .ui-icon {
  width: 1.375rem;
  height: 1.375rem;
  margin: auto;
}

.edge button:not(:disabled):hover,
.edge button:focus-visible {
  background: var(--edge-bg-active);
}

.edge[data-disabled="true"] {
  pointer-events: auto;
}

#toast {
  position: fixed;
  z-index: 100;
  bottom: calc(var(--footer-h) + 1rem);
  left: 50%;
  max-width: calc(100vw - 2rem);
  padding: 0.75rem 1rem;
  border-radius: 0.5rem;
  color: var(--bar-bg);
  background: var(--text);
  transform: translateX(-50%);
}

#toast:not(.show) {
  pointer-events: none;
}

#chromeHeader {
  position: fixed;
  z-index: 10;
  top: 0;
  right: 0;
  left: 0;
  display: flex;
  gap: 8px;
  align-items: center;
  padding: 8px 12px;
  background: var(--bar-bg);
  transition: transform 120ms ease;
  transform: translateY(-100%);
}

#chromeFooter {
  position: fixed;
  z-index: 10;
  right: 0;
  bottom: 0;
  left: 0;
  display: flex;
  gap: 8px;
  flex-direction: column;
  align-items: center;
  padding: 8px 12px;
  background: var(--bar-bg);
  transition: transform 120ms ease;
  transform: translateY(100%);
}

#chromeHeader.show,
#chromeFooter.show {
  transform: translateY(0);
}

#chromeHeader.placing,
#chromeFooter.placing {
  transition: none;
}

#chromeHeader input,
#chromeHeader button,
#chromeHeader a,
#chromeFooter input,
#chromeFooter button {
  min-width: 24px;
  min-height: 24px;
}

#chromeHeader a,
#chromeHeader button,
#chromeFooter button,
#drawerClose {
  display: inline-flex;
  flex-direction: column;
  gap: 2px;
  align-items: center;
  justify-content: center;
  min-width: 2.75rem;
  min-height: 2.75rem;
  border: 0;
  border-radius: 0.5rem;
  color: var(--control);
  background: transparent;
  text-decoration: none;
}

#chromeHeader a:hover,
#chromeHeader button:not(:disabled):hover,
#chromeFooter button:not(:disabled):hover,
#drawerClose:not(:disabled):hover {
  background: color-mix(in srgb, var(--control) 10%, transparent);
}

:is(#chromeFooter, #footerMorePop) #tocButton[aria-expanded="true"],
:is(#chromeFooter, #footerMorePop) #thumbsButton[aria-expanded="true"],
:is(#chromeFooter, #footerMorePop) #notesButton[aria-expanded="true"],
:is(#chromeFooter, #footerMorePop) #textButton[aria-expanded="true"],
:is(#footerPrimaryControls, #footerMorePop) #searchSubmit[aria-expanded="true"] {
  color: var(--bar-bg);
  background: var(--control);
}

:is(#chromeFooter, #footerMorePop) #tocButton[aria-expanded="true"]:hover,
:is(#chromeFooter, #footerMorePop) #thumbsButton[aria-expanded="true"]:hover,
:is(#chromeFooter, #footerMorePop) #notesButton[aria-expanded="true"]:hover,
:is(#chromeFooter, #footerMorePop) #textButton[aria-expanded="true"]:hover,
:is(#footerPrimaryControls, #footerMorePop) #searchSubmit[aria-expanded="true"]:hover {
  background: var(--control-dark);
}

#chromeFooter #firstButton,
#chromeFooter #prevButton,
#chromeFooter #nextButton,
#chromeFooter #lastButton {
  width: 2.75rem;
  height: 2.75rem;
  color: var(--bar-bg);
  background: var(--control);
}

#chromeFooter #firstButton:not(:disabled):hover,
#chromeFooter #prevButton:not(:disabled):hover,
#chromeFooter #nextButton:not(:disabled):hover,
#chromeFooter #lastButton:not(:disabled):hover {
  background: var(--control-dark);
}

#chromeHeader #searchSubmit {
  width: 2.75rem;
  height: 2.75rem;
  border-radius: 0 0.5rem 0.5rem 0;
  color: var(--bar-bg);
  background: var(--control);
}

#chromeHeader #searchSubmit:not(:disabled):hover {
  background: var(--control-dark);
}

.ui-icon {
  display: block;
  width: 1rem;
  height: 1rem;
  flex: 0 0 1rem;
  fill: currentcolor;
}

.button-label {
  font-size: 0.75rem;
}

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

button:disabled {
  cursor: not-allowed;
  opacity: 0.4;
}

button:not(:disabled),
a[href],
#pdfButton {
  cursor: pointer;
}

.edge button:disabled {
  cursor: not-allowed;
  opacity: 0.4;
}

#bookTitle {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#pageInput {
  width: 4rem;
}

.page-field {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

#pageInput,
#searchInput,
#drawerSearchInput {
  height: 2.75rem;
  min-height: 2.75rem;
  border: 1px solid var(--control);
  border-radius: 0.5rem;
  color: var(--text);
  background: var(--input-bg);
  font-size: 1rem;
}

#pageInput::placeholder,
#searchInput::placeholder,
#drawerSearchInput::placeholder {
  color: var(--muted);
}

#searchForm {
  display: flex;
  gap: 0;
  align-items: center;
}

#searchForm label {
  margin-right: 0.5rem;
}

label[for="pageInput"],
label[for="searchInput"] {
  font-size: 0.875rem;
}

#searchInput {
  min-width: 8rem;
  border-right: 0;
  border-radius: 0.5rem 0 0 0.5rem;
}

.slider-row,
.control-group {
  display: flex;
  gap: 6px;
  align-items: center;
}

.slider-row {
  width: 100%;
}

.footer-controls {
  display: flex;
  width: 100%;
  gap: 6px;
  align-items: center;
  justify-content: space-between;
}

#pageSlider {
  flex: 1;
  height: 1.5rem;
  margin: 0;
  appearance: none;
  color: var(--control);
}

#pageSlider::-webkit-slider-runnable-track {
  height: 0.5rem;
  border: 1px solid var(--control);
  border-radius: 999rem;
  background: linear-gradient(
    to right,
    var(--control) 0 var(--slider-fill, 0%),
    var(--input-bg) var(--slider-fill, 0%) 100%
  );
}

#pageSlider::-webkit-slider-thumb {
  width: 1.5rem;
  height: 1.5rem;
  margin-top: -0.5625rem;
  border: 0.125rem solid var(--input-bg);
  border-radius: 50%;
  appearance: none;
  background: var(--control);
}

#pageSlider::-moz-range-track {
  height: 0.5rem;
  border: 1px solid var(--control);
  border-radius: 999rem;
  background: linear-gradient(
    to right,
    var(--control) 0 var(--slider-fill, 0%),
    var(--input-bg) var(--slider-fill, 0%) 100%
  );
}

#pageSlider::-moz-range-thumb {
  width: 1.5rem;
  height: 1.5rem;
  border: 0.125rem solid var(--input-bg);
  border-radius: 50%;
  background: var(--control);
}

#segmentCount,
#speechProgress {
  visibility: hidden;
}

#segmentCount.is-visible,
#speechProgress.is-visible {
  visibility: visible;
}

#speechProgress {
  width: 2.5rem;
  height: 0.5rem;
  border: 1px solid var(--control);
  border-radius: 999rem;
  background: linear-gradient(
    to right,
    var(--control) 0 var(--speech-fill, 0%),
    #ffffff var(--speech-fill, 0%) 100%
  );
}

#sliderThumb {
  position: fixed;
  z-index: 12;
  display: grid;
  width: 7rem;
  padding: 0.25rem;
  border: 1px solid var(--control);
  border-radius: 0.25rem;
  gap: 0.125rem;
  color: var(--text);
  background: var(--bar-bg);
  box-shadow: 0 0.125rem 0.375rem color-mix(in srgb, var(--text) 20%, transparent);
  pointer-events: auto;
  transform: translate(-50%, -100%);
}

#sliderThumbImage {
  width: 100%;
  height: auto;
}

#sliderThumbLabel {
  text-align: center;
}

#settingsPop {
  position: fixed;
  z-index: 12;
  right: 0.5rem;
  bottom: calc(var(--footer-h) + 0.5rem);
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  padding: 0.5rem;
  border: 1px solid var(--control);
  border-radius: 0.5rem;
  gap: 0.5rem;
  background: var(--bar-bg);
}

#settingsPop label {
  font-size: 0.75rem;
}

#settingsPop #rateSelect,
#settingsPop #voiceSelect {
  min-height: 2.75rem;
  padding-left: 0.9375rem;
  padding-right: 2.5rem;
  border: 1px solid var(--control);
  border-radius: 0.5rem;
  color: var(--text);
  background-color: var(--input-bg);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 -960 960 960' fill='%230B678B'%3E%3Cpath d='M480-345 240-585l56-56 184 184 184-184 56 56-240 240Z'/%3E%3C/svg%3E");
  background-position: right 0.5rem center;
  background-repeat: no-repeat;
  background-size: 1.5rem;
  font-size: 1rem;
  appearance: none;
  -webkit-appearance: none;
}

#settingsPop .settings-auto-next {
  grid-column: 1 / -1;
  display: flex;
  min-height: 2.75rem;
  gap: 0.5rem;
  align-items: center;
  cursor: pointer;
}

#headerMorePop,
#footerMorePop {
  position: fixed;
  z-index: 12;
  display: grid;
  gap: 6px;
  padding: 6px;
  border: 1px solid var(--control);
  border-radius: 0.5rem;
  background: var(--bar-bg);
  box-shadow: 0 0.25rem 0.75rem rgb(0 0 0 / 18%);
}

#headerMorePop a,
#headerMorePop button,
#footerMorePop a,
#footerMorePop button {
  display: inline-flex;
  flex-direction: column;
  gap: 2px;
  align-items: center;
  justify-content: center;
  min-width: 2.75rem;
  min-height: 2.75rem;
  padding: 1px 6px;
  border: 0;
  border-radius: 0.5rem;
  color: var(--control);
  background: transparent;
  text-decoration: none;
}

#headerMorePop a:hover,
#headerMorePop button:not(:disabled):hover,
#footerMorePop button:not(:disabled):hover {
  background: color-mix(in srgb, var(--control) 10%, transparent);
}

#panelBackdrop {
  position: fixed;
  z-index: 20;
  inset: 0;
  background: color-mix(in srgb, var(--text) 35%, transparent);
}

#helpPanel {
  position: fixed;
  z-index: 21;
  top: calc(var(--header-h) + 1rem);
  left: 50%;
  display: grid;
  width: min(42rem, calc(100vw - 2rem));
  max-height: calc(100vh - var(--header-h) - var(--footer-h) - 2rem);
  padding: 1rem;
  border: 0.0625rem solid var(--control);
  border-radius: 0.5rem;
  grid-template-rows: auto minmax(0, 1fr) auto;
  gap: 0.75rem;
  background: var(--bar-bg);
  transform: translateX(-50%);
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

#helpPanelClose {
  display: inline-flex;
  width: 2.75rem;
  height: 2.75rem;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: 0;
  border-radius: 0.5rem;
  color: var(--control);
  background: transparent;
}

#helpPanelClose:not(:disabled):hover {
  background: color-mix(in srgb, var(--control) 10%, transparent);
}

#helpPanelTitle {
  margin: 0;
}

.panel-body {
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.panel-body h3 {
  margin: 2rem 0 0;
  font-size: 1rem;
}

.panel-body h3:first-child {
  margin-top: 0;
}

.panel-body p {
  margin: 0.75rem 0 0;
  line-height: 1.6;
}

.panel-body kbd {
  padding: 0.125rem 0.25rem;
  border: 0.0625rem solid var(--control);
  border-radius: 0.25rem;
  background: var(--input-bg);
  font-family: inherit;
}

.panel-body + [data-close] {
  min-height: 2.75rem;
  padding: 0.5rem 1rem;
  border: 0.0625rem solid var(--control);
  border-radius: 0.5rem;
  justify-self: end;
  color: var(--control);
  background: transparent;
}

.panel-body + [data-close]:not(:disabled):hover {
  background: color-mix(in srgb, var(--control) 10%, transparent);
}

#drawer {
  position: fixed;
  z-index: 9;
  top: var(--header-h);
  bottom: var(--footer-h);
  left: 0;
  width: min(88vw, 340px);
  padding: 1rem;
  overflow: auto;
  background: var(--bar-bg);
  border-right: 1px solid #c6ced5;
  visibility: hidden;
  pointer-events: none;
  transform: translateX(-100%);
  transition: transform 0.25s ease, visibility 0s linear 0.25s;
}

#drawer.open {
  visibility: visible;
  pointer-events: auto;
  transform: translateX(0);
  transition: transform 0.25s ease;
}

#drawerTitle {
  display: flex;
  min-height: 2.75rem;
  margin: 0 3.5rem 1rem 0;
  align-items: center;
}

#drawerClose {
  position: absolute;
  top: 1rem;
  right: 1rem;
}

#tocList {
  display: grid;
  gap: 0.25rem;
}

.toc-item {
  display: flex;
  width: 100%;
  min-height: 2.75rem;
  padding: 0.5rem;
  border: 0;
  border-radius: 0.5rem;
  align-items: center;
  justify-content: space-between;
  color: var(--text);
  text-align: left;
  background: transparent;
}

.toc-item.level-2 {
  padding-left: 1.5rem;
}

.toc-item[aria-current="page"],
.thumb-item[aria-current="page"] {
  outline: 0.125rem solid var(--control);
  background: color-mix(in srgb, var(--control) 10%, transparent);
}

.toc-page {
  margin-left: 1rem;
  color: var(--muted);
}

#thumbGrid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.75rem;
}

#notesView {
  display: grid;
  gap: 0.75rem;
}

#noteAddButton,
[data-note-end] {
  min-height: 2.75rem;
  padding: 0.5rem 0.75rem;
  border: 0;
  border-radius: 0.5rem;
  color: var(--text);
  background: color-mix(in srgb, var(--control) 10%, transparent);
}

#noteStorageNotice {
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
}

#noteList {
  display: grid;
  gap: 0.5rem;
}

.note-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.75rem;
  align-items: start;
}

.note-jump {
  min-width: 1.5rem;
  min-height: 2.75rem;
  border: 0;
  border-radius: 0.5rem;
  padding: 0.5rem;
  color: var(--text);
  text-align: left;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  background: transparent;
}

.note-jump:hover,
.note-jump:focus-visible {
  background: color-mix(in srgb, var(--control) 10%, transparent);
}

.note-empty {
  margin: 0;
  line-height: 1.5;
}

#notePlaceBar {
  position: fixed;
  z-index: 10;
  top: 0.5rem;
  left: 50%;
  display: flex;
  gap: 0.5rem;
  align-items: center;
  height: var(--note-place-bar-height);
  transform: translateX(-50%);
  padding: 0.5rem;
  border: 1px solid var(--control);
  border-radius: 0.5rem;
  color: var(--text);
  background: var(--bar-bg);
  white-space: nowrap;
}

#slideViewport[data-placing="true"]:not(.zoomed) {
  padding-top: calc(var(--note-place-bar-height) + 1rem);
}

#slideViewport[data-placing="true"],
#slideViewport[data-placing="true"] #pageImage {
  cursor: crosshair;
}

#drawerSearchForm {
  display: flex;
  margin-bottom: 0.75rem;
}

#drawerSearchInput {
  width: 100%;
  border-right: 0;
  border-radius: 0.5rem 0 0 0.5rem;
}

#drawerSearchSubmit {
  width: 2.75rem;
  min-width: 2.75rem;
  height: 2.75rem;
  border: 0;
  border-radius: 0 0.5rem 0.5rem 0;
  color: var(--bar-bg);
  background: var(--control);
}

#drawerSearchSubmit:not(:disabled):hover {
  background: var(--control-dark);
}

#searchResults {
  display: grid;
  gap: 0.5rem;
}

#searchStatus {
  line-height: 1.5;
}

.search-empty {
  margin: 0;
  overflow-wrap: anywhere;
}

.search-hit-item {
  display: grid;
  width: 100%;
  min-height: 2.75rem;
  padding: 0.5rem;
  border: 0;
  border-radius: 0.5rem;
  gap: 0.25rem;
  color: var(--text);
  text-align: left;
  overflow-wrap: anywhere;
  background: transparent;
}

.search-hit-item:hover,
.search-hit-item:focus-visible {
  background: color-mix(in srgb, var(--control) 10%, transparent);
}

.search-hit-page {
  color: var(--muted);
}

.search-hit-item mark {
  color: inherit;
  background: color-mix(in srgb, var(--control) 25%, transparent);
}

#transcript {
  display: grid;
  gap: 0.5rem;
}

.section-heading {
  margin: 0.5rem 0 0;
  padding: 0.25rem;
  border-radius: 0.25rem;
  overflow-wrap: anywhere;
  cursor: pointer;
}

.section-heading.active {
  background: color-mix(in srgb, var(--control) 25%, transparent);
}

.sentence {
  padding: 0.25rem;
  border-radius: 0.25rem;
  overflow-wrap: anywhere;
}

.sentence.active {
  background: color-mix(in srgb, var(--control) 25%, transparent);
}

.transcript-guide {
  margin: 0;
  color: var(--muted);
}

.thumb-item {
  display: grid;
  min-width: 0;
  padding: 0.375rem;
  border: 0;
  border-radius: 0.5rem;
  gap: 0.25rem;
  color: var(--text);
  background: transparent;
}

.thumb-item img {
  display: block;
  width: 100%;
  height: auto;
}

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

[hidden] {
  display: none !important;
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
textarea:focus-visible {
  outline: 2px solid var(--control);
  outline-offset: 2px;
}

@media (max-width: 899.98px), (pointer: coarse) {
  .note-box .note-limit {
    position: absolute;
    left: -9999px;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
  }

  :root {
    --edge-width: 26px;
  }

  #chromeHeader,
  #chromeFooter {
    transition: none;
  }

  #drawer,
  #drawer.open {
    transition: none;
  }

  #chromeHeader {
    justify-content: space-between;
  }

  #chromeHeader .page-field,
  #searchForm {
    display: none;
  }

  #headerMorePop {
    top: calc(var(--header-h) + 0.5rem);
    right: 0.5rem;
    width: min(13rem, calc(100vw - 1rem));
    grid-template-columns: 1fr;
  }

  #headerMorePop button,
  #headerMorePop a {
    flex-direction: row;
    justify-content: flex-start;
    gap: 0.5rem;
    width: 100%;
  }

  #chromeFooter {
    align-items: stretch;
  }

  .slider-row {
    gap: 8px;
  }

  #pageNoLabel {
    flex: 0 0 auto;
    white-space: nowrap;
  }

  .footer-controls {
    justify-content: center;
  }

  .footer-controls > .control-group:not(:has(> :not([hidden]))) {
    display: none;
  }

  #slideViewport:not(.zoomed) {
    padding-top: calc(var(--header-h) + 10px);
    padding-bottom: calc(var(--footer-h) + 10px);
  }

  #slideViewport[data-placing="true"]:not(.zoomed) {
    padding-top: 10px;
    padding-bottom: 10px;
  }

  #notePlaceBar {
    width: max-content;
    max-width: calc(100vw - 1rem);
    height: auto;
    white-space: normal;
  }

  #notePlaceBar [data-note-end] {
    flex: 0 0 auto;
    white-space: nowrap;
  }

  .note-box {
    --note-box-width: 10rem;
    --note-box-height: 3.875rem;
  }

  .note-text {
    line-height: 1.5;
  }

  #footerPrimaryControls {
    display: flex;
    width: 100%;
    gap: 2px;
    align-items: center;
    justify-content: space-between;
  }

  #footerPrimaryControls > button {
    flex: 1 1 auto;
    min-width: 2.75rem;
    padding-inline: 0;
  }

  #footerPrimaryControls #speechProgress {
    flex: 1 1 auto;
  }

  #footerPrimaryControls #segmentCount {
    white-space: nowrap;
  }


  #footerMorePop {
    right: 0.5rem;
    bottom: calc(var(--footer-h) + 0.5rem);
    width: min(15rem, calc(100vw - 1rem));
    grid-template-columns: repeat(3, minmax(2.75rem, 1fr));
  }

  #footerMorePop button {
    min-width: 2.75rem;
    padding-inline: 0;
  }

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

  #chromeHeader .button-label,
  #chromeFooter .button-label,
  #headerMorePop .button-label,
  #footerMorePop .button-label {
    position: static;
    width: auto;
    height: auto;
    padding: 0;
    margin: 0;
    overflow: visible;
    clip: auto;
    white-space: normal;
    overflow-wrap: anywhere;
    border: 0;
  }

  #chromeFooter .button-label,
  #footerMorePop .button-label {
    letter-spacing: normal;
  }
}

@media (prefers-reduced-motion: reduce) {
  #drawer,
  #drawer.open {
    transition: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0s !important;
    animation-duration: 0s !important;
  }
}

@page {
  size: A4 landscape;
  margin: 0;
}

@media print {
  body,
  .book-stage {
    overflow: visible;
    background: var(--input-bg);
  }

  #chromeHeader,
  #chromeFooter,
  .edge,
  #drawer,
  #helpPanel,
  #panelBackdrop,
  #toast,
  #cursorTip,
  #settingsPop,
  #headerMorePop,
  #footerMorePop,
  #sliderThumb,
  #notePlaceBar,
  #pageHighlightLayer,
  #noteTagLayer,
  #annotationLayer,
  #linkLayer,
  #annotationTip,
  .note-box,
  #holderIncoming,
  .flip-stage {
    display: none !important;
  }

  #holderCurrent.flipping > #pageImage {
    visibility: visible;
  }

  .book-stage {
    position: static;
    width: auto;
    height: auto;
    min-height: 0;
    margin: 0;
    padding: 0;
    overflow: visible;
  }

  #slideViewport,
  #slideViewport:not(.zoomed),
  #slideViewport.zoomed {
    display: grid;
    width: 297mm;
    height: 210mm;
    min-width: 0;
    min-height: 0;
    margin: 0;
    padding: 0;
    overflow: hidden;
    place-items: center;
  }

  #slideViewport[data-placing="true"]:not(.zoomed) {
    padding: 0;
  }

  html[data-safari="true"],
  html[data-safari="true"] body {
    height: 100%;
  }

  html[data-safari="true"] body {
    display: flex;
  }

  html[data-safari="true"] .book-stage {
    width: 235mm;
    height: 166mm;
    margin: auto;
  }

  html[data-safari="true"] #slideViewport,
  html[data-safari="true"] #slideViewport:not(.zoomed),
  html[data-safari="true"] #slideViewport.zoomed {
    width: 235mm;
    height: 166mm;
  }

  #holderCurrent,
  #slideViewport.zoomed #holderCurrent {
    display: grid;
    width: 100%;
    height: 100%;
    min-width: 0;
    min-height: 0;
    margin: 0;
    padding: 0;
    place-items: center;
    container-type: normal;
  }

  #pageImage,
  #slideViewport.zoomed #pageImage {
    display: block;
    width: 100%;
    height: 100%;
    min-width: 0;
    min-height: 0;
    max-width: none;
    max-height: none;
    border: 0;
    box-shadow: none;
    object-fit: contain;
  }
}
