:root {
  --base: #DFDCD7;
  --contrast: #191919;
  --accent-2: #ff0000;
  --font-base: "Inconsolata", monospace;
  --font-headings: "Bebas Neue", sans-serif;
  --reader-bg: #101010;
}

* { box-sizing: border-box; }

body.reader-body {
  margin: 0;
  background: var(--reader-bg);
  color: var(--base);
  font-family: var(--font-base);
  padding-top: var(--nav-h, 61px);
}

/* ---- Barre de navigation ---- */

.reader-nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 10px 20px;
  background: rgba(16, 16, 16, 0.96);
  border-bottom: 1px solid #333;
}

.reader-back,
.reader-sibling {
  color: var(--base);
  text-decoration: none;
  font-size: 15px;
  white-space: nowrap;
}

.reader-back:hover,
.reader-sibling:hover {
  color: var(--accent-2);
}

.reader-side {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.reader-side.right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.reader-title {
  font-family: var(--font-headings);
  font-size: 22px;
  letter-spacing: 0.04em;
  color: var(--base);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.reader-actions {
  display: flex;
  gap: 8px;
}

.reader-actions button {
  width: 40px;
  height: 40px;
  background: transparent;
  border: 1px solid #555;
  color: var(--base);
  font-size: 18px;
  cursor: pointer;
}

.reader-actions button:hover,
.reader-actions button.active {
  border-color: var(--accent-2);
  color: var(--accent-2);
}

@media (max-width: 600px) {
  .reader-title {
    font-size: 16px;
  }

  .reader-sibling .label {
    display: none;
  }

  .reader-sibling .arrow {
    font-size: 16px;
  }
}

/* ---- Lecteur vertical (défaut) ---- */

.reader {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding-bottom: 40px;
}

.reader-page img {
  display: block;
  width: 100%;
  max-width: 900px;
  height: auto;
}

/* ---- Lecteur horizontal ---- */

html[data-reader="horizontal"] .reader {
  flex-direction: row;
  align-items: center;
  gap: 0;
  height: calc(100vh - var(--nav-h, 61px));
  overflow-x: auto;
  overflow-y: hidden;
  scroll-snap-type: x mandatory;
  padding-bottom: 0;
}

html[data-reader="horizontal"] .reader-page {
  flex: 0 0 auto;
  height: 100%;
  scroll-snap-align: center;
}

html[data-reader="horizontal"] .reader-page img {
  height: 100%;
  width: auto;
  max-width: none;
}

/* ---- Overlay de chargement ---- */

#reader-loading-overlay {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  background: var(--reader-bg);
  color: var(--base);
}

.spinner {
  width: 48px;
  height: 48px;
  border: 4px solid #333;
  border-top-color: var(--accent-2);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

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

/* ---- Loupe ---- */

.lens-cursor {
  position: fixed;
  width: 300px;
  height: 200px;
  z-index: 60;
  pointer-events: none;
  border: 1px solid #555;
  background-repeat: no-repeat;
  display: none;
}

body.lens-active {
  cursor: crosshair;
}

body.lens-active .lens-cursor {
  display: block;
}

@media (max-width: 600px) {
  .reader-title {
    font-size: 16px;
  }
}
