.reader-canvas-wrap { position: relative; }
.book-reader .reader-canvas-wrap[hidden], .book-reader .reader-continuous-pages[hidden] { display: none; }
.reader-highlight-layer, .reader-highlight-marks { position: absolute; inset: 0; pointer-events: none; }
.reader-highlight-layer { direction: ltr; }
.reader-highlight-layer[hidden] { display: none; }
.book-reader .reader-highlight-mark {
  position: absolute;
  display: block;
  min-width: 0;
  min-height: 0;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 2px;
  background: rgb(88 174 80 / .16);
  mix-blend-mode: multiply;
  pointer-events: auto;
  touch-action: pan-x pan-y pinch-zoom;
}
.book-reader .reader-highlight-mark[aria-pressed=true] { outline: 1px solid rgb(69 146 64 / .5); outline-offset: 1px; }
.book-reader .reader-highlight-draft { pointer-events: none; }
.book-reader .reader-highlight-draft[hidden] { display: none; }
.book-reader .reader-highlight-note {
  position: absolute;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  min-width: 0;
  padding: 5px;
  border: 1px solid #a4bd99;
  border-radius: 6px;
  background: #eff7e9;
  color: #385532;
  pointer-events: auto;
  touch-action: manipulation;
}
.reader-highlight-note svg { width: 17px; height: 17px; flex-shrink: 0; }
.reader-highlight-note::after { content: ''; position: absolute; inset: -8px; }
.book-reader.is-highlighting .reader-highlight-layer { pointer-events: auto; touch-action: none; cursor: crosshair; user-select: none; -webkit-user-select: none; }
.book-reader.is-highlighting .reader-highlight-mark { cursor: crosshair; touch-action: none; }
.reader-highlight-marks { isolation: auto; }
.book-reader .reader-view-controls .reader-highlight-button {
  width: auto;
  min-width: 80px;
  height: 44px;
  padding: 8px 10px;
  gap: 6px;
  border: 1px solid var(--border, #dfdfd2);
  background: var(--card, #faf8f2);
  font-size: 12px;
  white-space: nowrap;
}
.book-reader .reader-highlight-button[aria-pressed=true] { background: #dfecda; border-color: #91b185; color: #2a4a2d; }
.book-reader .reader-highlight-help {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 3px 14px;
  padding: 7px 28px;
  border-top: 1px solid var(--border, #dfdfd2);
  font-size: 11px;
  line-height: 1.8;
  color: var(--ink, #26392e);
}
.book-reader .reader-highlight-help[hidden] { display: none; }
.reader-highlight-status { color: var(--muted, #7a7c70); }
.book-reader .reader-highlight-filter {
  width: auto;
  min-width: 0;
  min-height: 44px;
  height: 44px;
  flex: 0 0 auto;
  padding: 8px 10px;
  gap: 6px;
  border: 1px solid var(--border, #dfdfd2);
  background: var(--card, #faf8f2);
  font-size: 12px;
  white-space: nowrap;
}
.book-reader .reader-highlight-filter svg { width: 18px; height: 18px; }
.book-reader .reader-highlight-filter[aria-pressed=true] { background: #dfecda; border-color: #91b185; color: #2a4a2d; }
.reader-filter-count { font-size: 11px; opacity: .75; }
.reader-filter-count::before { content: '('; }
.reader-filter-count::after { content: ')'; }
.reader-filter-short { display: none; }
.book-reader .reader-highlight-empty {
  width: min(460px, 100%);
  margin: 30px auto;
  padding: 28px 16px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  align-items: center;
  justify-content: center;
  direction: rtl;
  color: var(--ink, #26392e);
  text-align: center;
  line-height: 1.9;
  font-size: 13px;
}
.book-reader .reader-highlight-empty[hidden] { display: none; }
.reader-highlight-empty strong { font-size: 20px; font-family: 'Amiri', serif; font-weight: 400; }
.reader-highlight-empty span { color: var(--muted, #7a7c70); }
.book-reader .reader-highlight-empty button {
  min-height: 44px;
  padding: 8px 16px;
  border: 1px solid var(--reader-accent, #596342);
  border-radius: 7px;
  background: var(--card, #faf8f2);
  color: inherit;
}
.book-reader.is-fullscreen .reader-highlight-empty { margin-block: auto; }
.book-reader.is-highlight-filtered .reader-page-context > span:last-child { visibility: hidden; }
.reader-highlight-menu {
  position: fixed;
  z-index: 30;
  display: flex;
  flex-direction: column;
  direction: rtl;
  gap: 2px;
  padding: 3px;
  max-width: calc(100% - 8px);
  border: 1px solid var(--border, #dfdfd2);
  border-radius: 7px;
  box-shadow: 0 3px 16px #26392e20;
  background: var(--card, #faf8f2);
  color: var(--ink, #26392e);
  pointer-events: auto;
  overflow: auto;
  overscroll-behavior: contain;
  user-select: text;
  -webkit-user-select: text;
  font-family: 'Noto Sans Arabic', sans-serif;
}
.reader-highlight-menu-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 2px; }
.reader-highlight-menu.is-note-editor { width: 320px; padding: 12px; gap: 10px; }
.reader-highlight-menu label { color: inherit; font-size: 12px; line-height: 1.8; }
.book-reader .reader-highlight-note-input {
  display: block;
  box-sizing: border-box;
  width: 100%;
  min-height: 96px;
  max-height: 180px;
  resize: vertical;
  padding: 9px;
  border: 1px solid var(--border, #dfdfd2);
  border-radius: 6px;
  background: var(--paper, #f7f4ec);
  color: var(--ink, #26392e);
  font: inherit;
  font-size: 16px;
  line-height: 1.8;
  user-select: text;
  -webkit-user-select: text;
  touch-action: auto;
}
.reader-highlight-note-preview { width: 290px; max-width: 100%; max-height: 180px; overflow: auto; margin: 0; padding: 10px; white-space: pre-wrap; overflow-wrap: anywhere; font-size: 14px; line-height: 1.9; touch-action: auto; }
.reader-highlight-note-error { color: var(--ink, #26392e); font-size: 11px; line-height: 1.7; }
.reader-highlight-note-error:empty { display: none; }
.book-reader .reader-highlight-menu.is-note-editor .reader-highlight-menu-actions button:first-child { background: #dfecda; color: #2a4a2d; }
.book-reader .reader-highlight-menu button {
  min-height: 44px;
  padding: 5px 10px;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: inherit;
  font-size: 12px;
  white-space: nowrap;
}
.book-reader .reader-highlight-menu button:hover { background: var(--paper-deep, #eeece2); }
.book-reader.is-drawing-highlight .reader-stage { scroll-behavior: auto; }
html[data-theme=dark] .book-reader .reader-highlight-button[aria-pressed=true] { background: #344d33; border-color: #6e9864; color: #e2f0dd; }
html[data-theme=dark] .book-reader .reader-highlight-filter[aria-pressed=true] { background: #344d33; border-color: #6e9864; color: #e2f0dd; }
@media (max-width: 640px), (max-width: 999px) and (max-height: 500px) and (orientation: landscape) {
  .book-reader .reader-view-controls .reader-highlight-button { min-width: 44px; width: 44px; padding: 10px; }
  .book-reader .reader-highlight-button span { display: none; }
  .book-reader .reader-view-controls .reader-controls-divider { display: none; }
  .book-reader .reader-view-controls .reader-zoom-label { min-width: 34px; }
  .book-reader .reader-highlight-help { padding: 6px 12px; }
  .book-reader .reader-highlight-filter { padding-inline: 8px; font-size: 11px; }
  .reader-filter-full { display: none; }
  .reader-filter-short { display: inline; }
}
