/* Shared inbuilt reader — PDF + text (vedpuran / kathayen) */
.reader-modal {
  position: fixed;
  top: 0; left: 0;
  width: 100vw; height: 100vh;
  z-index: 10000;
  display: flex;
  flex-direction: column;
  background: #f4edd8;
  color: #5c3a21;
  font-family: 'Mukta', sans-serif;
}
.reader-modal.theme-light { background: #fff; color: #333; }
.reader-modal.theme-dark { background: #121212; color: #e0e0e0; }

.reader-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 20px;
  background: rgba(0,0,0,.05);
  border-bottom: 1px solid rgba(0,0,0,.1);
}
.reader-modal.theme-dark .reader-header {
  background: rgba(255,255,255,.05);
  border-bottom: 1px solid rgba(255,255,255,.1);
}
.reader-title {
  font-family: 'Rozha One', serif;
  font-size: 1.1rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 55%;
}
.reader-actions { display: flex; gap: 12px; align-items: center; }
.reader-select {
  padding: 5px 8px;
  border-radius: 6px;
  border: 1px solid rgba(0,0,0,.15);
  background: #fff;
  color: #333;
  font-size: .85rem;
}
.reader-close {
  background: rgba(0,0,0,.05);
  border: 1px solid rgba(0,0,0,.1);
  border-radius: 6px;
  font-size: .9rem;
  padding: 5px 10px;
  cursor: pointer;
  color: inherit;
  font-weight: 700;
}
.reader-close:hover { background: rgba(255,0,0,.1); }

.reader-body {
  flex: 1;
  overflow: auto;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding: 20px;
  position: relative;
  user-select: none;
}
.reader-canvas-container {
  box-shadow: 0 4px 20px rgba(0,0,0,.15);
  background: #fff;
  border-radius: 8px;
  max-width: 100%;
  display: flex;
  justify-content: center;
  border: 1px solid rgba(0,0,0,.1);
}
.reader-modal.theme-dark .reader-canvas-container {
  box-shadow: 0 4px 20px rgba(0,0,0,.5);
  background: #1e1e1e;
  border: 1px solid rgba(255,255,255,.1);
}
#readerCanvas { display: block; max-width: 100%; height: auto !important; }

.reader-text-panel {
  width: min(720px, 100%);
  padding: 28px 32px;
  line-height: 1.85;
  font-size: calc(1rem * var(--reader-text-zoom, 1.15));
  text-align: center;
  border-radius: 12px;
  box-shadow: 0 4px 20px rgba(0,0,0,.12);
  background: #fff;
  border: 1px solid #efdcbf;
}
.reader-modal.theme-sepia .reader-text-panel { background: #fffdf6; }
.reader-modal.theme-dark .reader-text-panel {
  background: #1e1e1e;
  border-color: rgba(255,255,255,.12);
  color: #e8e0d0;
}
.reader-text-panel h3 {
  font-family: 'Rozha One', serif;
  color: var(--maroon, #6b0f1a);
  margin-bottom: 18px;
  font-size: 1.35rem;
}
.reader-modal.theme-dark .reader-text-panel h3 { color: #f2c14e; }
.reader-text-panel .doha {
  font-weight: 600;
  margin: 14px 0;
  color: var(--maroon, #6b0f1a);
}
.reader-text-panel .chaupai { margin: 8px 0; }

.reader-footer {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  padding: 10px 20px;
  background: rgba(0,0,0,.05);
  border-top: 1px solid rgba(0,0,0,.1);
  gap: 10px;
}
.reader-modal.theme-dark .reader-footer {
  background: rgba(255,255,255,.05);
  border-top: 1px solid rgba(255,255,255,.1);
}
.reader-nav { display: flex; align-items: center; gap: 8px; }
.reader-btn {
  background: linear-gradient(135deg, var(--saffron-deep, #d96a0b), var(--gold, #d4a017));
  color: #fff;
  border: none;
  border-radius: 6px;
  padding: 5px 12px;
  font-weight: 700;
  cursor: pointer;
  font-size: .85rem;
}
.reader-btn:hover { filter: brightness(1.05); }
.reader-btn:disabled { background: #ccc; cursor: not-allowed; }
.reader-page-info { font-size: .95rem; }
#pageNumInput {
  width: 50px;
  padding: 3px;
  text-align: center;
  border-radius: 4px;
  border: 1px solid rgba(0,0,0,.2);
  background: #fff;
  color: #333;
}
.reader-zoom { display: flex; align-items: center; gap: 8px; font-size: .85rem; }
.reader-progress-container {
  width: 100%;
  height: 4px;
  background: rgba(0,0,0,.1);
  border-radius: 2px;
  overflow: hidden;
  margin-top: 4px;
}
.reader-modal.theme-dark .reader-progress-container { background: rgba(255,255,255,.1); }
.reader-progress-bar {
  height: 100%;
  width: 0%;
  background: var(--saffron-deep, #d96a0b);
  transition: width .2s ease;
}
.reader-loader {
  position: absolute;
  inset: 0;
  background: rgba(244,237,216,.95);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  z-index: 10001;
}
.reader-modal.theme-light .reader-loader { background: rgba(255,255,255,.95); }
.reader-modal.theme-dark .reader-loader { background: rgba(18,18,18,.95); color: #e0e0e0; }
.reader-spinner {
  border: 4px solid rgba(0,0,0,.1);
  width: 36px; height: 36px;
  border-radius: 50%;
  border-left-color: var(--saffron-deep, #d96a0b);
  animation: readerSpin 1s linear infinite;
  margin-bottom: 12px;
}
@keyframes readerSpin { to { transform: rotate(360deg); } }