.doc-reader {
  background: #fff;
  border: 1px solid #dfe6f0;
  border-radius: 12px;
  min-height: calc(100vh - 165px);
  padding: 16px;
  position: relative;
}
.doc-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  position: sticky;
  top: 0;
  z-index: 20;
  background: #fff;
  border-bottom: 1px solid #e4ebf4;
  padding-bottom: 12px;
}
.doc-toolbar .tool {
  min-width: 38px;
  min-height: 36px;
  font-size: 16px;
  line-height: 1;
}
.doc-toolbar .tool:disabled {
  opacity: .45;
  transform: none;
}
.doc-toolbar .form-select {
  width: 150px;
}
.doc-emoji-toggle { white-space: nowrap; }
.doc-emoji-toggle.active { background: #fff0df; border-color: #ff9b55; color: #a94b1d; }
.doc-emoji-picker {
  position: absolute;
  top: 62px;
  left: 16px;
  z-index: 40;
  width: min(360px, calc(100% - 32px));
  padding: 12px;
  border: 1px solid #d7e2f0;
  border-radius: 14px;
  background: #fff;
  box-shadow: 0 16px 38px #1e3c7230;
}
.doc-emoji-picker-title { color: #5e7391; font-size: 11px; line-height: 1.4; margin-bottom: 9px; }
.doc-emoji-grid { display: grid; grid-template-columns: repeat(8, 1fr); gap: 5px; max-height: 300px; overflow-y: auto; padding: 2px; }
.doc-emoji { display: grid; place-items: center; width: 34px; height: 34px; padding: 0; border: 1px solid transparent; border-radius: 8px; background: #f5f8fc; font-size: 20px; line-height: 1; }
.doc-emoji:hover { background: #fff0df; border-color: #ffb477; transform: translateY(-1px); }
.doc-toolbar-sep {
  width: 1px;
  height: 28px;
  background: #e4ebf4;
}
.doc-position,
.doc-zoom {
  min-width: 72px;
  text-align: center;
  color: #1e3c72;
  font-weight: 700;
  font-size: 12px;
}
.doc-viewport {
  height: calc(100vh - 265px);
  min-height: 520px;
  overflow: auto;
  border-radius: 9px;
  background: #fff;
  padding: 22px;
}
.pdf-page {
  position: relative;
  margin: 0 auto;
  box-shadow: 0 8px 22px #1e3c7224;
}
.pdf-page canvas {
  display: block;
}
.pdf-text-layer {
  position: absolute;
  inset: 0;
  overflow: hidden;
  opacity: .01;
  line-height: 1;
}
.pdf-text-layer span {
  color: transparent;
  position: absolute;
  white-space: pre;
  transform-origin: 0% 0%;
  cursor: text;
}
.pdf-annotation {
  position: absolute;
  z-index: 4;
  pointer-events: none;
}
.pdf-annotation.highlight {
  background: var(--mark-color, #ffcf33);
  mix-blend-mode: multiply;
  opacity: .45;
}
.pdf-annotation.underline {
  border-bottom: 3px solid var(--mark-color, #ff6b35);
}
.pdf-annotation.emoji {
  z-index: 6;
  transform: translate(-50%, -50%);
  font-family: "Segoe UI Emoji", "Noto Color Emoji", sans-serif;
  line-height: 1;
  pointer-events: none;
  user-select: none;
  filter: drop-shadow(0 2px 2px #0004);
}
.epub-area {
  width: min(940px, 100%);
  height: 100%;
  min-height: 510px;
  margin: 0 auto;
  background: transparent;
}
.reader-theme-white { background: #fff; color: #202124; }
.reader-theme-papyrus { background: #f4e3bd; color: #402d1f; }
.reader-theme-cold { background: #e8f4ff; color: #173759; }
.reader-theme-warm { background: #fff0db; color: #4b2f1d; }
.reader-theme-terminal { background: #09120e; color: #7cff9b; }
.reader-theme-tired { background: #dfeadd; color: #233629; }
.reader-theme-inverted { background: #05070c; color: #fff; }
.pdf-page.reader-theme-inverted { filter: invert(1) hue-rotate(180deg); }
.doc-epub-emoji { position: absolute; z-index: 20; transform: translate(-50%, -50%); font-family: "Segoe UI Emoji", "Noto Color Emoji", sans-serif; line-height: 1; pointer-events: none; user-select: none; filter: drop-shadow(0 2px 2px #0004); }
#docQuotes blockquote {
  border-left: 3px solid #ff6b35;
  margin: 9px 0;
  padding: 8px 10px;
  background: #f8fafc;
  border-radius: 6px;
  color: #536986;
  font-size: 11px;
  line-height: 1.5;
}
@media(max-width:960px) {
  .doc-reader { min-height: 70vh; }
  .doc-viewport { height: 62vh; min-height: 380px; padding: 12px; }
}
@media(max-width:650px) {
  .doc-toolbar .form-select { width: 125px; }
  .doc-position, .doc-zoom { min-width: 48px; }
  .doc-emoji-picker { left: 8px; top: 56px; width: calc(100% - 16px); }
  .doc-emoji-grid { grid-template-columns: repeat(9, 1fr); }
  .doc-emoji { width: 29px; height: 29px; font-size: 18px; }
}

.reader-focus-toggle{border:1px solid #ffffff55;background:#ffffff12;color:inherit;border-radius:8px;min-width:38px;height:34px;font-size:20px;line-height:1;display:grid;place-items:center;margin-left:4px}.reader-focus-toggle:hover{background:#ffffff25}
#readerModal.reader-focus-mode .reader-body{display:block;padding:0;background:#eef2f8;overflow:hidden}
#readerModal.reader-focus-mode .reader-side{display:none}
#readerModal.reader-focus-mode .reader-workspace{height:calc(100vh - 84px);width:100%;padding:16px;overflow:auto}
#readerModal.reader-focus-mode .reader-hint{display:none}
#readerModal.reader-focus-mode .page-scroll{max-height:calc(100vh - 170px);min-height:0;padding-top:0}
#readerModal.reader-focus-mode .reading-page{max-width:900px}
#readerModal.reader-focus-mode #fileWorkspace{height:calc(100vh - 84px);padding:0;overflow:auto}
#readerModal.reader-focus-mode .doc-reader{min-height:100%;height:100%;border:0;border-radius:0;padding:12px 18px}
#readerModal.reader-focus-mode .doc-viewport{height:calc(100vh - 155px);min-height:0}
#readerModal.reader-focus-mode #docStatus{display:none}
@media(max-width:650px){#readerModal.reader-focus-mode .reader-workspace{padding:8px}#readerModal.reader-focus-mode .doc-reader{padding:8px}#readerModal.reader-focus-mode .doc-viewport{height:calc(100vh - 145px);padding:8px}}
/* Fullscreen is a real browser fullscreen mode with one clear control at the start of the reading bar. */
.reader-focus-toggle{order:-10;display:inline-flex!important;align-items:center;justify-content:center;gap:7px;min-width:128px;height:38px;padding:8px 14px;border:1px solid #ff6b35;background:#ff6b35;color:#fff;border-radius:8px;font-size:12px;font-weight:700;line-height:1;box-shadow:0 5px 12px #ff6b3533;margin:0}
.reader-focus-toggle:hover{background:#e85b2a;border-color:#e85b2a;color:#fff}
.doc-toolbar .reader-focus-toggle{margin-right:8px}
#readerModal.reader-focus-mode .modal-header{display:none}
#readerModal:fullscreen{display:flex!important;position:fixed;inset:0;background:#eef2f8}
#readerModal:fullscreen .modal-dialog{width:100%;max-width:none;height:100%;margin:0}
#readerModal:fullscreen .modal-content{height:100%;border:0;border-radius:0}
#readerModal.reader-focus-mode .reader-body{min-height:100vh}
#readerModal.reader-focus-mode .reader-workspace{height:100vh;padding:14px 20px}
#readerModal.reader-focus-mode .reader-toolbar,#readerModal.reader-focus-mode .doc-toolbar{position:sticky;top:0;z-index:12;background:#fff;border-bottom:1px solid #dfe7f2;padding:10px 0;margin-bottom:10px}
#readerModal.reader-focus-mode .page-scroll{max-height:calc(100vh - 128px)}
#readerModal.reader-focus-mode #fileWorkspace{height:100vh}
#readerModal.reader-focus-mode .doc-reader{height:100vh;min-height:0;padding:0 16px}
#readerModal.reader-focus-mode .doc-viewport{height:calc(100vh - 78px);min-height:0}
@media(max-width:650px){.reader-focus-toggle{min-width:116px;padding:8px 10px;font-size:11px}#readerModal.reader-focus-mode .reader-workspace{height:100vh;padding:8px}#readerModal.reader-focus-mode .reader-toolbar,#readerModal.reader-focus-mode .doc-toolbar{padding:8px 0;margin-bottom:6px;overflow-x:auto;flex-wrap:nowrap}#readerModal.reader-focus-mode .doc-viewport{height:calc(100vh - 72px)}}

/* Keep the book in view while the longer information panel scrolls independently. */
@media(min-width:961px){
  #readerModal:not(.reader-focus-mode) .reader-body{min-height:0;overflow:hidden;align-items:stretch}
  #readerModal:not(.reader-focus-mode) .reader-workspace{height:100%;min-height:0;overflow:hidden}
  #readerModal:not(.reader-focus-mode) .reader-side{height:100%;min-height:0;align-self:stretch;overflow-y:auto;overscroll-behavior:contain}
  #readerModal:not(.reader-focus-mode) .doc-reader{display:flex;flex-direction:column;height:100%;min-height:0}
  #readerModal:not(.reader-focus-mode) .doc-toolbar,
  #readerModal:not(.reader-focus-mode) .reader-toolbar,
  #readerModal:not(.reader-focus-mode) .reader-hint,
  #readerModal:not(.reader-focus-mode) .page-navigation{flex-shrink:0}
  #readerModal:not(.reader-focus-mode) .doc-viewport{flex:1;min-height:0;height:auto;overscroll-behavior:contain}
  #readerModal:not(.reader-focus-mode) .epub-area{min-height:0}
  #readerModal:not(.reader-focus-mode) #sampleWorkspace:not([hidden]){display:flex;flex-direction:column}
  #readerModal:not(.reader-focus-mode) .page-scroll{flex:1;min-height:0;max-height:none;overscroll-behavior:contain}
}
