/* ── Free Library, Comics & Manga Explorer ──────────────────────────────── */
.library-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(12, 12, 14, 0.65);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  z-index: 400;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
  box-sizing: border-box;
  opacity: 0;
  pointer-events: none;
  transition: opacity 220ms cubic-bezier(0.16, 1, 0.3, 1);
}

.library-modal-backdrop.open {
  opacity: 1;
  pointer-events: auto;
}

.library-modal {
  background: var(--liquid-card-bg);
  backdrop-filter: var(--liquid-blur);
  -webkit-backdrop-filter: var(--liquid-blur);
  border: 1px solid var(--liquid-glass-border);
  border-radius: var(--apple-squircle-xl);
  width: 100%;
  max-width: 960px;
  height: 86vh;
  max-height: 850px;
  display: flex;
  flex-direction: column;
  position: relative;
  box-shadow: var(--liquid-specular), 0 24px 60px -12px rgba(0, 0, 0, 0.45);
  transform: translateY(16px) scale(0.98);
  transition: transform 220ms var(--apple-ease);
  overflow: hidden;
  box-sizing: border-box;
}

.library-modal-backdrop.open .library-modal {
  transform: translateY(0) scale(1);
}

/* Header */
.library-modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: 20px 24px 16px;
  border-bottom: 1px solid var(--liquid-glass-border-subtle);
  background: var(--liquid-glass-bg);
  backdrop-filter: var(--liquid-blur);
  -webkit-backdrop-filter: var(--liquid-blur);
  flex-shrink: 0;
}

.library-title-wrap {
  display: flex;
  align-items: flex-start;
  gap: 14px;
}

.library-header-icon {
  color: var(--accent);
  margin-top: 2px;
  flex-shrink: 0;
}

.library-modal-title {
  font-family: var(--font-serif);
  font-size: 21px;
  font-weight: 500;
  color: var(--ink);
  margin: 0 0 3px;
  line-height: 1.2;
}

.library-modal-subtitle {
  font-size: 13px;
  color: var(--muted);
  margin: 0;
  line-height: 1.4;
}

.library-header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
  margin-top: -2px;
}

/* Safe Search Toggle Button — Clean Monochrome B/W with Crisp Status Indicator */
.library-safesearch-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 32px;
  padding: 0 12px;
  border-radius: var(--radius-pill);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  user-select: none;
  transition: all 140ms ease;
  border: 1px solid var(--line-strong);
  background: var(--surface);
  color: var(--ink);
}

.library-safesearch-btn:hover {
  background: var(--surface-2);
  border-color: var(--ink);
}

.safesearch-icon-shield {
  color: var(--ink);
  opacity: 0.8;
  transition: opacity 140ms ease;
  flex-shrink: 0;
}

.library-safesearch-btn:hover .safesearch-icon-shield {
  opacity: 1;
}

.library-safesearch-btn .safesearch-indicator {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background-color: #10b981;
  box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.25);
  transition: all 160ms ease;
  flex-shrink: 0;
}

/* Active (ON) state — Clean B/W body with green indicator dot */
.library-safesearch-btn.active {
  background: var(--surface);
  border-color: var(--line-strong);
  color: var(--ink);
}

.library-safesearch-btn.active .safesearch-indicator {
  background-color: #10b981;
  box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.25);
}

/* Off state — Clean B/W body with red indicator dot */
.library-safesearch-btn.safesearch-off {
  background: var(--surface);
  border-color: var(--line-strong);
  color: var(--ink);
}

.library-safesearch-btn.safesearch-off .safesearch-indicator {
  background-color: #ef4444;
  box-shadow: 0 0 0 2px rgba(239, 68, 68, 0.25);
}

:root[data-resolved-theme="dark"] .library-safesearch-btn {
  background: var(--surface);
  border-color: var(--line);
  color: var(--ink);
}

:root[data-resolved-theme="dark"] .library-safesearch-btn:hover {
  background: var(--surface-2);
  border-color: var(--line-strong);
}

.library-modal-close {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-pill);
  border: none;
  background: transparent;
  color: var(--muted);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: background 150ms ease, color 150ms ease;
}

.library-modal-close:hover {
  background: var(--surface-2);
  color: var(--ink);
}

/* Controls Bar (Search + Category Tabs) */
.library-controls-bar {
  padding: 14px 24px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: var(--bg);
  border-bottom: 1px solid var(--line);
  flex-shrink: 0;
}

.library-search-box {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
}

.library-search-box .search-icon {
  position: absolute;
  left: 14px;
  color: var(--muted);
  pointer-events: none;
}

#library-search-input {
  width: 100%;
  height: 42px;
  padding: 0 40px 0 42px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--liquid-card-border);
  background: var(--liquid-card-bg);
  backdrop-filter: var(--liquid-blur);
  -webkit-backdrop-filter: var(--liquid-blur);
  color: var(--ink);
  font-family: inherit;
  font-size: 14px;
  outline: none;
  box-sizing: border-box;
  box-shadow: var(--liquid-specular-sm);
  transition: border-color 160ms var(--apple-ease), box-shadow 160ms ease;
}

#library-search-input:focus {
  border-color: var(--ink);
  box-shadow: var(--liquid-specular);
}

#library-search-input::placeholder {
  color: var(--muted);
}

.search-clear-btn {
  position: absolute;
  right: 12px;
  background: transparent;
  border: none;
  font-size: 18px;
  color: var(--muted);
  cursor: pointer;
  padding: 4px;
  line-height: 1;
}

.search-clear-btn:hover {
  color: var(--ink);
}

/* Category Tabs */
.library-category-tabs {
  display: flex;
  align-items: center;
  gap: 8px;
  overflow-x: auto;
  scrollbar-width: none;
}

.library-category-tabs::-webkit-scrollbar {
  display: none;
}

.library-tab {
  height: 32px;
  padding: 0 14px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--liquid-glass-border-subtle);
  background: var(--liquid-pill-bg);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  color: var(--ink-2);
  font-size: 12.5px;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 160ms var(--apple-ease);
}

.library-tab:hover {
  background: var(--surface);
  color: var(--ink);
}

.library-tab.active {
  background: var(--liquid-pill-active);
  color: var(--ink);
  border-color: var(--liquid-glass-border);
  box-shadow: var(--liquid-pill-shadow);
  font-weight: 600;
}

.library-tab .tab-icon {
  flex-shrink: 0;
  stroke: currentColor;
}

.library-tab.active .tab-icon {
  stroke: var(--bg);
}

/* Multi-Provider Source Filter Pills */
.library-source-pills {
  display: flex;
  align-items: center;
  gap: 6px;
  overflow-x: auto;
  scrollbar-width: none;
  margin-top: 6px;
}

.library-source-pills::-webkit-scrollbar {
  display: none;
}

.source-pill {
  height: 26px;
  padding: 0 11px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--line);
  background: var(--surface-2);
  color: var(--muted);
  font-size: 11px;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: all 140ms ease;
}

.source-pill:hover {
  color: var(--ink);
  background: var(--surface);
  border-color: var(--line-strong);
}

.source-pill.active {
  background: var(--ink);
  color: var(--bg);
  border-color: var(--ink);
  font-weight: 600;
}

/* Quick Search Discovery Chips */
.library-quick-chips {
  padding: 8px 24px;
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  overflow-x: auto;
  scrollbar-width: none;
  flex-shrink: 0;
}

.library-quick-chips::-webkit-scrollbar {
  display: none;
}

.quick-chip-label {
  font-size: 11.5px;
  color: var(--muted);
  font-weight: 500;
  white-space: nowrap;
  margin-right: 2px;
}

.quick-chip {
  padding: 3px 10px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--line);
  background: var(--surface-2);
  color: var(--ink-2);
  font-size: 11.5px;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  transition: all 140ms ease;
}

.quick-chip:hover {
  background: var(--ink);
  color: var(--bg);
  border-color: var(--ink);
}

/* Results Wrap & Grid */
.library-results-wrap {
  flex: 1;
  overflow-y: auto;
  padding: 20px 24px 32px;
  position: relative;
  background: var(--surface);
}

.library-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 18px;
}

/* Book / Comic Card */
.library-card {
  display: flex;
  flex-direction: column;
  background: var(--liquid-card-bg);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border: 1px solid var(--liquid-card-border);
  border-radius: var(--apple-squircle-md);
  box-shadow: var(--liquid-specular-sm);
  overflow: hidden;
  cursor: pointer;
  transition: transform 220ms var(--apple-ease), box-shadow 220ms var(--apple-ease), border-color 220ms ease;
  position: relative;
}

.library-card:hover {
  transform: translateY(-4px) scale(1.01);
  box-shadow: var(--liquid-specular), 0 16px 36px rgba(0, 0, 0, 0.12);
  border-color: var(--liquid-glass-border);
}

.library-card-thumb-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 3 / 4;
  background: var(--surface-2);
  overflow: hidden;
}

.library-card-thumb {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 260ms ease;
}

.library-card:hover .library-card-thumb {
  transform: scale(1.03);
}

.library-card-badges {
  position: absolute;
  top: 8px;
  left: 8px;
  right: 8px;
  display: flex;
  justify-content: space-between;
  pointer-events: none;
}

.library-badge {
  font-size: 10.5px;
  font-weight: 600;
  padding: 3px 7px;
  border-radius: 6px;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25);
  display: inline-flex;
  align-items: center;
  gap: 4.5px;
  line-height: 1;
}

.library-badge svg {
  flex-shrink: 0;
  stroke: currentColor;
}

.library-badge.cat {
  background: rgba(18, 18, 20, 0.78);
  color: #FFFFFF;
}

.library-badge.provider.archive {
  background: rgba(55, 65, 81, 0.88);
  color: #FFFFFF;
}

.library-badge.provider.gutenberg {
  background: rgba(29, 78, 216, 0.88);
  color: #FFFFFF;
}

.library-badge.provider.openlibrary {
  background: rgba(14, 116, 144, 0.88);
  color: #FFFFFF;
}

.library-badge.provider.mangadex {
  background: rgba(255, 103, 64, 0.92);
  color: #FFFFFF;
}

.library-badge.legal.pd {
  background: rgba(16, 149, 93, 0.92);
  color: #FFFFFF;
}

.library-badge.legal.cdl {
  background: rgba(100, 116, 139, 0.92);
  color: #FFFFFF;
}

.library-badge.legal.ext {
  background: rgba(124, 58, 237, 0.92);
  color: #FFFFFF;
}

.library-badge.downloads {
  background: rgba(232, 93, 34, 0.88);
  color: #FFFFFF;
}

.library-card-body {
  padding: 12px;
  display: flex;
  flex-direction: column;
  flex: 1;
}

.library-card-title {
  font-family: var(--font-serif);
  font-size: 14.5px;
  font-weight: 600;
  color: var(--ink);
  margin: 0 0 4px;
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.library-card-author {
  font-size: 12px;
  color: var(--muted);
  margin: 0 0 12px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.library-card-footer {
  margin-top: auto;
  display: flex;
  gap: 6px;
  align-items: center;
}

.library-btn {
  width: 100%;
  height: 32px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  cursor: pointer;
  border: none;
  transition: background 150ms ease, opacity 150ms ease;
  box-sizing: border-box;
}

.library-btn.primary {
  background: var(--ink);
  color: var(--bg);
}

.library-btn.primary:hover {
  opacity: 0.92;
}

.library-btn.secondary {
  background: var(--surface-2);
  color: var(--ink);
  border: 1px solid var(--line);
  text-decoration: none;
}

.library-btn.secondary:hover {
  background: var(--surface);
}

/* Loading & Empty states */
.library-loading,
.library-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 16px;
  color: var(--muted);
  text-align: center;
  gap: 12px;
}

.library-spinner,
.download-spinner {
  width: 28px;
  height: 28px;
  border: 2.5px solid var(--line);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: library-spin 0.8s linear infinite;
}

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

/* Volume / Issue Picker Sub-view */
.library-volume-picker {
  position: absolute;
  inset: 0;
  background: var(--surface);
  z-index: 30;
  display: flex;
  flex-direction: column;
  border-radius: 0 0 18px 18px;
}

.volume-picker-header {
  padding: 16px 24px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  gap: 16px;
}

.volume-back-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: transparent;
  border: 1px solid var(--line);
  border-radius: var(--radius-pill);
  padding: 6px 12px;
  font-size: 12.5px;
  color: var(--ink-2);
  cursor: pointer;
  transition: all 150ms ease;
}

.volume-back-btn:hover {
  background: var(--surface-2);
  color: var(--ink);
}

.volume-picker-title {
  font-family: var(--font-serif);
  font-size: 18px;
  color: var(--ink);
  margin: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.volume-picker-list {
  flex: 1;
  overflow-y: auto;
  padding: 16px 24px 32px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.volume-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 12px;
  gap: 16px;
  transition: border-color 150ms ease, background 150ms ease;
}

.volume-row:hover {
  border-color: var(--line-strong);
  background: var(--surface);
}

.volume-info {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  flex: 1;
}

.volume-index {
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
  width: 28px;
  flex-shrink: 0;
}

.volume-name-wrap {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.volume-name {
  font-size: 13.5px;
  font-weight: 500;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.volume-size {
  font-size: 11.5px;
  color: var(--muted);
}

.volume-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.volume-read-btn {
  height: 32px;
  padding: 0 14px;
  border-radius: var(--radius-pill);
  border: none;
  background: var(--ink);
  color: var(--bg);
  font-size: 12px;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  transition: opacity 150ms ease;
}

.volume-read-btn:hover {
  opacity: 0.9;
}

.volume-download-btn {
  height: 32px;
  padding: 0 12px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink-2);
  font-size: 12px;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  text-decoration: none;
  transition: all 150ms ease;
}

.volume-download-btn:hover {
  background: var(--surface-2);
  color: var(--ink);
}

.volume-loading,
.volume-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 48px 16px;
  color: var(--muted);
  text-align: center;
  gap: 12px;
}

/* Download / Stream Progress Overlay */
.library-download-overlay {
  position: absolute;
  inset: 0;
  background: rgba(12, 12, 14, 0.75);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.download-progress-card {
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: 18px;
  padding: 28px 24px;
  width: 100%;
  max-width: 420px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 14px;
  box-shadow: 0 20px 48px -10px rgba(0, 0, 0, 0.5);
}

.download-progress-status {
  font-family: var(--font-serif);
  font-size: 16px;
  font-weight: 500;
  color: var(--ink);
  line-height: 1.3;
}

.download-progress-bar-wrap {
  width: 100%;
  height: 6px;
  background: var(--surface-2);
  border-radius: var(--radius-pill);
  overflow: hidden;
}

.download-progress-bar {
  height: 100%;
  background: var(--accent);
  border-radius: var(--radius-pill);
  transition: width 200ms ease;
}

.download-progress-hint {
  font-size: 12px;
  color: var(--muted);
  margin: 0;
  line-height: 1.4;
}

/* Mobile Responsiveness */
@media (max-width: 640px) {
  .library-modal {
    height: 94vh;
    border-radius: 16px;
  }
  .library-modal-header {
    padding: 16px 18px;
  }
  .library-controls-bar {
    padding: 12px 18px;
  }
  .library-quick-chips {
    padding: 8px 18px;
  }
  .library-results-wrap {
    padding: 14px 18px 24px;
  }
  .library-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
  }
  .volume-row {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }
  .volume-actions {
    width: 100%;
    justify-content: flex-end;
  }
}

/* ── Open Information Sources & Archival Credits ────────────────────────── */
.library-sources-wrap {
  margin-top: 52px;
  margin-bottom: 24px;
}

.library-sources-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-card, 16px);
  padding: 24px 28px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.library-sources-header {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--accent);
}

.library-sources-title {
  font-family: var(--font-sans);
  font-size: 14px;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--ink);
  margin: 0;
}

.library-sources-desc {
  font-size: 13.5px;
  line-height: 1.65;
  color: var(--muted);
  margin: 0;
  max-width: 840px;
}

.library-sources-desc a {
  color: var(--ink);
  text-decoration: underline;
  text-underline-offset: 3px;
  font-weight: 500;
}

.library-sources-desc a:hover {
  color: var(--accent);
}

.library-modal-footer {
  padding: 10px 24px;
  background: var(--surface-2);
  border-top: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  font-size: 11.5px;
  color: var(--muted);
  flex-shrink: 0;
}

.library-disclaimer-text {
  display: flex;
  align-items: center;
  gap: 6px;
  line-height: 1.4;
}

.library-disclaimer-text svg {
  flex-shrink: 0;
  stroke: var(--muted);
}

.library-legal-link {
  color: var(--ink-2);
  text-decoration: underline;
  text-underline-offset: 3px;
  white-space: nowrap;
  font-weight: 500;
  transition: color 140ms ease;
}

.library-legal-link:hover {
  color: var(--accent);
}

@media (max-width: 640px) {
  .library-modal-footer {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
    padding: 10px 16px;
  }
}

/* ── In-Page Embedded Reader Overlay (Instant Reading on Library & Book Pages) ── */
.inpage-reader-overlay {
  position: fixed;
  inset: 0;
  z-index: 10000;
  background: var(--bg);
  color: var(--ink);
  display: flex;
  flex-direction: column;
  opacity: 1;
  transition: opacity 200ms ease;
}

.inpage-reader-overlay.hidden {
  display: none !important;
}

.inpage-reader-topbar {
  height: 56px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  flex-shrink: 0;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.inpage-topbar-left {
  display: flex;
  align-items: center;
  gap: 16px;
  min-width: 0;
}

.inpage-back-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 36px;
  padding: 0 14px;
  border-radius: var(--radius-pill);
  background: var(--surface-2);
  color: var(--ink);
  border: 1px solid var(--line-strong);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 140ms ease;
  flex-shrink: 0;
}

.inpage-back-btn:hover {
  background: var(--accent);
  color: #FFFFFF;
  border-color: var(--accent);
}

.inpage-doc-info {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.inpage-doc-title {
  font-family: var(--font-serif);
  font-size: 15px;
  font-weight: 600;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 450px;
}

.inpage-doc-meta {
  font-size: 11.5px;
  color: var(--muted);
}

.inpage-topbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.inpage-action-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 34px;
  min-width: 34px;
  padding: 0 8px;
  border-radius: 8px;
  background: var(--surface-2);
  color: var(--ink);
  border: 1px solid var(--line);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 140ms ease;
}

.inpage-action-btn:hover {
  background: var(--line-strong);
}

.inpage-action-btn.active {
  background: var(--ink);
  color: var(--bg);
}

.inpage-action-btn.inpage-txt-btn {
  padding: 0 12px;
  font-size: 11.5px;
  font-weight: 500;
  letter-spacing: -0.01em;
  white-space: nowrap;
}

.inpage-reader-surface {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  position: relative;
  scroll-behavior: smooth;
  background: var(--reader-bg, var(--bg));
  color: var(--reader-ink, var(--ink));
  transition: background 180ms ease, color 180ms ease;
}

/* Themes for reading */
.inpage-reader-overlay[data-reading-theme="sepia"] {
  --reader-bg: #F5EEDB;
  --reader-ink: #2B2317;
  --line: rgba(0, 0, 0, 0.1);
  --surface: #EFE4CC;
  --surface-2: #E5D6B8;
}

.inpage-reader-overlay[data-reading-theme="dark"] {
  --reader-bg: #121212;
  --reader-ink: #E0E0E0;
  --line: #2A2A2A;
  --surface: #1E1E1E;
  --surface-2: #282828;
}

.inpage-reader-overlay[data-reading-theme="light"] {
  --reader-bg: #FDFCFA;
  --reader-ink: #1B1A17;
  --line: #E8E5DF;
  --surface: #F5F2EB;
  --surface-2: #EDE9DF;
}

.inpage-loading-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 60vh;
  gap: 16px;
  color: var(--muted);
  font-size: 14px;
}

.inpage-text-content {
  max-width: 760px;
  margin: 40px auto 100px;
  padding: 0 28px;
  font-family: var(--font-serif);
  font-size: var(--reading-font-size, 19px);
  line-height: 1.75;
  letter-spacing: 0.01em;
  word-break: break-word;
}

.inpage-text-content p {
  margin: 0 0 1.25em;
  text-indent: 1.5em;
}

.inpage-text-content p.no-indent {
  text-indent: 0;
}

.inpage-text-content h1,
.inpage-text-content h2,
.inpage-text-content h3 {
  font-family: var(--font-serif);
  font-weight: 600;
  line-height: 1.25;
  margin: 2.2em 0 0.8em;
  text-align: center;
  color: var(--reader-ink, var(--ink));
}

.inpage-text-content h1 {
  font-size: 1.8em;
  border-bottom: 1px solid var(--line);
  padding-bottom: 0.4em;
}

.inpage-pdf-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 24px;
  padding: 30px 16px 100px;
}

.inpage-pdf-page-canvas {
  max-width: 100%;
  height: auto;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
  border-radius: 4px;
  background: #FFFFFF;
}

@media (max-width: 640px) {
  .inpage-topbar-left {
    gap: 8px;
  }
  .inpage-doc-title {
    max-width: 180px;
    font-size: 13.5px;
  }
  .inpage-back-btn span {
    display: none;
  }
  .inpage-text-content {
    padding: 0 16px;
    margin: 20px auto 60px;
  }
}

/* SafeSearch Protection Shield Banner */
.safesearch-shield-notice {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 40px 24px;
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: 16px;
  gap: 12px;
  max-width: 580px;
  margin: 20px auto;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.03);
}

.safesearch-shield-icon-wrap {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: rgba(16, 185, 129, 0.12);
  color: #10b981;
  display: flex;
  align-items: center;
  justify-content: center;
}

:root[data-resolved-theme="dark"] .safesearch-shield-icon-wrap {
  background: rgba(16, 185, 129, 0.18);
  color: #34d399;
}

.safesearch-shield-title {
  font-family: var(--font-ui);
  font-size: 17px;
  font-weight: 600;
  color: var(--ink);
  margin: 0;
}

.safesearch-shield-desc {
  font-size: 13.5px;
  line-height: 1.55;
  color: var(--ink-2);
  margin: 0;
  max-width: 460px;
}

