
/* ============================================================
   MAHROZ'S SECRET LIBRARY
   THE READING ROOM — COMPLETE READER.CSS

   Cinematic Edition
   A little world from Ahad to Mahroz

   Responsive:
   Mobile | Tablet | Laptop | Desktop
   ============================================================ */


/* ============================================================
   01 — DESIGN TOKENS
   ============================================================ */

:root {
  --night: #171116;
  --plum: #241b22;
  --burgundy: #632c40;
  --burgundy-light: #88435c;

  --gold: #c9a574;
  --gold-light: #e4c99e;
  --ivory: #f4e9d8;
  --paper: #f7eedf;
  --muted: #c0aeb4;
  --line: rgba(201, 165, 116, 0.25);

  --font-heading: "Playfair Display", Georgia, serif;
  --font-display: "Cormorant Garamond", Georgia, serif;
  --font-body: "DM Sans", Arial, sans-serif;
  --font-urdu: "Noto Nastaliq Urdu", serif;

  --ease: cubic-bezier(0.22, 1, 0.36, 1);

  --header-height: 78px;
  --sidebar-width: 310px;
  --reader-width: 760px;

  --reading-font-size: 22px;
  --reading-line-height: 1.85;

  --reading-background: #f7eedf;
  --reading-color: #34272d;
}


/* ============================================================
   02 — RESET
   ============================================================ */

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  width: 100%;
  max-width: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: 100px;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  width: 100%;
  min-width: 0;
  max-width: 100%;
  min-height: 100vh;

  margin: 0;

  background: var(--night);
  color: var(--ivory);

  font-family: var(--font-body);
  line-height: 1.7;

  overflow-x: hidden;
}

@supports (overflow: clip) {
  html,
  body {
    overflow-x: clip;
  }
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

a {
  color: inherit;
  text-decoration: none;
}

button,
a,
select {
  outline-offset: 4px;
}

:focus-visible {
  outline: 2px solid var(--gold);
}

img,
svg,
video {
  max-width: 100%;
}

[hidden] {
  display: none !important;
}

::selection {
  background: var(--gold);
  color: var(--night);
}


/* ============================================================
   03 — AMBIENT BACKGROUND
   ============================================================ */

.reader-ambient {
  position: fixed;
  inset: 0;
  z-index: -1;

  overflow: hidden;
  pointer-events: none;

  background:
    radial-gradient(
      ellipse at 50% 0%,
      rgba(99, 44, 64, 0.27),
      transparent 58%
    ),
    var(--night);
}

.ambient-orb {
  position: absolute;

  width: 420px;
  height: 420px;

  border-radius: 50%;
  filter: blur(85px);
  opacity: 0.25;

  animation:
    orbFloat 18s ease-in-out infinite alternate;
}

.orb-one {
  top: 7%;
  left: -180px;
  background: var(--burgundy);
}

.orb-two {
  right: -180px;
  bottom: 5%;

  background: #6b4b37;
  animation-delay: -9s;
}

.ambient-grain {
  position: absolute;
  inset: 0;

  opacity: 0.025;

  background-image:
    repeating-linear-gradient(
      0deg,
      transparent 0,
      transparent 3px,
      #fff 4px
    );
}

@keyframes orbFloat {
  from {
    transform: translate3d(0, 0, 0);
  }

  to {
    transform: translate3d(40px, -45px, 0);
  }
}


/* ============================================================
   04 — READING PROGRESS BAR
   ============================================================ */

.reading-progress-track {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 1000;

  width: 100%;
  height: 3px;

  background: rgba(201, 165, 116, 0.1);
  pointer-events: none;
}

.reading-progress-fill {
  width: 0%;
  height: 100%;

  background:
    linear-gradient(
      90deg,
      var(--burgundy-light),
      var(--gold-light)
    );

  transition: width 0.12s linear;
}


/* ============================================================
   05 — READER HEADER
   ============================================================ */

.reader-header {
  position: sticky;
  top: 0;
  z-index: 100;

  width: 100%;
  min-height: var(--header-height);

  border-bottom: 1px solid var(--line);

  background: rgba(23, 17, 22, 0.96);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}

.reader-header-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;

  width: 100%;
  min-height: var(--header-height);

  padding: 12px clamp(16px, 3vw, 45px);
}

.reader-back-link {
  display: inline-flex;
  align-items: center;
  gap: 10px;

  flex-shrink: 0;

  color: var(--gold-light);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.13em;

  transition: color 0.3s ease;
}

.reader-back-link:hover {
  color: #fff;
}

.reader-back-link span:first-child {
  font-size: 22px;
  line-height: 1;
}

.reader-header-brand {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;

  min-width: 0;

  color: var(--gold-light);
  text-align: center;
}

.header-brand-symbol {
  color: var(--gold);
  font-size: 20px;
}

.header-brand-name {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.19em;
  line-height: 1.5;
}

.reader-settings-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;

  flex-shrink: 0;

  min-height: 40px;
  padding: 9px 14px;

  border: 1px solid var(--line);
  border-radius: 30px;

  background: transparent;
  color: var(--gold-light);

  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.1em;

  transition:
    background 0.3s ease,
    border-color 0.3s ease;
}

.reader-settings-toggle:hover {
  background: rgba(201, 165, 116, 0.1);
  border-color: var(--gold);
}

.reader-settings-toggle span:first-child {
  font-family: var(--font-heading);
  font-size: 17px;
  letter-spacing: 0;
}


/* ============================================================
   06 — MAIN LAYOUT
   ============================================================ */

.reader-layout {
  display: grid;
  grid-template-columns:
    var(--sidebar-width)
    minmax(0, 1fr);

  align-items: start;

  width: 100%;
  min-width: 0;
}

.reader-main {
  position: relative;

  width: 100%;
  min-width: 0;
  min-height: calc(100vh - var(--header-height));
}

.reader-content-wrapper {
  width: 100%;
  min-width: 0;

  padding:
    35px
    clamp(20px, 5vw, 80px)
    100px;
}


/* ============================================================
   07 — CHAPTER SIDEBAR
   ============================================================ */

.chapter-sidebar {
  position: sticky;
  top: var(--header-height);

  width: 100%;
  height: calc(100vh - var(--header-height));
  height: calc(100dvh - var(--header-height));

  overflow-y: auto;
  overscroll-behavior: contain;

  border-right: 1px solid var(--line);

  background:
    linear-gradient(
      180deg,
      #241b22,
      #1a141a
    );

  scrollbar-width: thin;
  scrollbar-color: var(--burgundy) transparent;
}

.sidebar-inner {
  display: flex;
  flex-direction: column;

  min-height: 100%;
  padding: 30px 23px;
}

.sidebar-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;

  margin-bottom: 30px;
}

.sidebar-brand {
  display: inline-flex;
  align-items: center;
  gap: 9px;

  color: var(--gold);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.15em;
}

.sidebar-brand span:first-child {
  font-size: 17px;
}

.sidebar-close {
  display: none;

  width: 38px;
  height: 38px;

  border: 1px solid var(--line);
  border-radius: 50%;

  background: transparent;
  color: var(--gold-light);

  font-size: 17px;
}


/* ============================================================
   08 — SIDEBAR BOOK DETAILS
   ============================================================ */

.sidebar-book {
  text-align: center;
}

.sidebar-book-cover {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 14px;

  width: 145px;
  max-width: 100%;
  min-height: 205px;

  margin: 0 auto 27px;
  padding: 22px 15px;

  border: 1px solid rgba(228, 201, 158, 0.55);
  border-radius: 3px 8px 8px 3px;

  background:
    linear-gradient(
      145deg,
      #50344c,
      #231928
    );

  color: var(--gold-light);

  box-shadow:
    -6px 6px 0 rgba(0, 0, 0, 0.2),
    9px 13px 25px rgba(0, 0, 0, 0.3),
    inset 6px 0 10px rgba(0, 0, 0, 0.3);
}

.sidebar-book-cover.garden-cover {
  background: linear-gradient(145deg, #284d3c, #122a24);
}

.sidebar-book-cover.anne-cover {
  background: linear-gradient(145deg, #7c3c2e, #3d1c22);
}

.sidebar-book-cover.dosti-cover {
  background: linear-gradient(145deg, #50344c, #231928);
}

.sidebar-cover-ornament {
  font-size: 25px;
}

.sidebar-cover-title {
  max-width: 100%;

  font-family: var(--font-display);
  font-size: 23px;
  line-height: 1.15;
  text-align: center;

  overflow-wrap: break-word;
}

.sidebar-cover-bottom {
  font-size: 6px;
  letter-spacing: 0.1em;
  text-align: center;
}

.sidebar-book-kicker {
  margin: 0 0 8px;

  color: var(--gold);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.17em;
}

.sidebar-book-title {
  margin: 0 0 6px;

  font-family: var(--font-heading);
  font-size: 22px;
  font-weight: 400;
  line-height: 1.35;

  overflow-wrap: break-word;
}

.sidebar-book-author {
  margin: 0;

  color: var(--muted);
  font-family: var(--font-display);
  font-size: 17px;
  font-style: italic;
}


/* ============================================================
   09 — SIDEBAR PROGRESS
   ============================================================ */

.sidebar-progress {
  margin: 35px 0 33px;
  padding: 24px 0;

  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.sidebar-progress-heading {
  display: flex;
  justify-content: space-between;
  gap: 12px;

  margin-bottom: 12px;

  color: var(--gold-light);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.1em;
}

.sidebar-progress-track {
  width: 100%;
  height: 5px;

  overflow: hidden;
  border-radius: 10px;

  background: rgba(201, 165, 116, 0.15);
}

.sidebar-progress-fill {
  width: 0%;
  height: 100%;

  border-radius: inherit;
  background: var(--gold);

  transition: width 0.4s ease;
}

.sidebar-progress-caption {
  margin: 12px 0 0;

  color: var(--muted);
  font-family: var(--font-display);
  font-size: 16px;
  line-height: 1.4;
}


/* ============================================================
   10 — CHAPTER LIST
   ============================================================ */

.chapter-navigation {
  width: 100%;
  min-width: 0;
}

.chapter-nav-heading {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;

  margin-bottom: 15px;

  color: var(--gold);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.13em;
}

.chapter-count {
  color: var(--muted);
  font-size: 8px;
}

.chapter-list {
  display: flex;
  flex-direction: column;
  gap: 5px;

  margin: 0;
  padding: 0;

  list-style: none;
}

.chapter-list li {
  width: 100%;
  min-width: 0;
}

.chapter-list button {
  display: flex;
  align-items: flex-start;
  gap: 12px;

  width: 100%;
  min-width: 0;

  padding: 13px 11px;

  border: 1px solid transparent;
  border-radius: 4px;

  background: transparent;
  color: var(--muted);

  text-align: left;
  font-size: 12px;
  line-height: 1.6;

  transition:
    background 0.25s ease,
    color 0.25s ease,
    border-color 0.25s ease;
}

.chapter-list button:hover {
  background: rgba(201, 165, 116, 0.07);
  color: var(--ivory);
}

.chapter-list button.is-active,
.chapter-list button[aria-current="true"] {
  border-color: rgba(201, 165, 116, 0.25);
  background: rgba(201, 165, 116, 0.11);
  color: var(--gold-light);
}

.chapter-list button span {
  min-width: 0;
  overflow-wrap: break-word;
}

.chapter-list button span:first-child {
  flex: 0 0 24px;

  color: var(--gold);
  font-family: var(--font-display);
  font-size: 17px;
  line-height: 1.3;
}


/* ============================================================
   11 — SIDEBAR FOOTER
   ============================================================ */

.sidebar-footer {
  margin-top: auto;
  padding-top: 35px;

  text-align: center;
}

.sidebar-footer-symbol {
  color: var(--gold);
  font-size: 24px;
}

.sidebar-footer p {
  margin: 10px 0 18px;

  color: var(--muted);
  font-family: var(--font-display);
  font-size: 18px;
  font-style: italic;
}

.sidebar-footer a {
  color: var(--gold-light);
  font-size: 10px;
  letter-spacing: 0.08em;
}

.sidebar-footer a:hover {
  text-decoration: underline;
}

.sidebar-overlay {
  display: none;
}


/* ============================================================
   12 — READER TOOLBAR
   ============================================================ */

.reader-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 15px;

  width: 100%;
  min-height: 66px;

  padding: 12px clamp(20px, 4vw, 55px);

  border-bottom: 1px solid var(--line);

  background: rgba(36, 27, 34, 0.65);
}

.toolbar-button {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  gap: 9px;

  min-height: 38px;
  padding: 9px 12px;

  border: 1px solid var(--line);
  border-radius: 4px;

  background: transparent;
  color: var(--gold-light);

  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.1em;

  transition:
    background 0.25s ease,
    border-color 0.25s ease;
}

.toolbar-button:hover {
  background: rgba(201, 165, 116, 0.1);
  border-color: var(--gold);
}

.toolbar-icon {
  font-size: 18px;
  line-height: 1;
}

.toolbar-current-chapter {
  min-width: 0;
  text-align: center;
}

.toolbar-chapter-label {
  color: var(--muted);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.12em;
  line-height: 1.6;
}

.bookmark-button[aria-pressed="true"] {
  border-color: var(--gold);
  background: rgba(201, 165, 116, 0.13);
  color: var(--gold-light);
}


/* ============================================================
   13 — LOADING & ERROR STATES
   ============================================================ */

.reader-loading,
.reader-error {
  width: min(100%, 650px);
  margin: 60px auto;
  padding: 75px 25px;

  text-align: center;
}

.loading-ornament {
  color: var(--gold);
  font-size: 44px;

  animation: loadingGlow 2s ease-in-out infinite;
}

@keyframes loadingGlow {
  0%,
  100% {
    opacity: 0.45;
    transform: scale(0.9);
  }

  50% {
    opacity: 1;
    transform: scale(1.08);
  }
}

.reader-loading p {
  color: var(--muted);
  font-family: var(--font-display);
  font-size: 25px;
  font-style: italic;
}

.error-ornament {
  color: var(--gold);
  font-size: 42px;
}

.reader-error h2 {
  font-family: var(--font-heading);
  font-size: clamp(27px, 4vw, 40px);
  font-weight: 400;
}

.reader-error p {
  color: var(--muted);
  font-size: 14px;
}

.reader-error-link {
  display: inline-flex;
  justify-content: center;

  margin-top: 20px;
  padding: 13px 22px;

  border: 1px solid var(--gold);

  color: var(--gold-light);
  font-size: 11px;
  font-weight: 700;
}

.reader-error-link:hover {
  background: var(--gold);
  color: var(--night);
}


/* ============================================================
   14 — READING PAPER
   ============================================================ */

.reading-paper {
  width: 100%;
  max-width: var(--reader-width);

  min-width: 0;
  margin: 0 auto;

  padding:
    clamp(35px, 5vw, 75px)
    clamp(25px, 5vw, 75px)
    55px;

  background: var(--reading-background);
  color: var(--reading-color);

  box-shadow:
    0 22px 80px rgba(0, 0, 0, 0.25);

  transition:
    background 0.3s ease,
    color 0.3s ease;
}

.reading-paper,
.reading-paper * {
  overflow-wrap: break-word;
}


/* ============================================================
   15 — READING THEMES
   ============================================================ */

body[data-reading-theme="paper"] {
  --reading-background: #f7eedf;
  --reading-color: #34272d;
}

body[data-reading-theme="sepia"] {
  --reading-background: #e8d3af;
  --reading-color: #4a3327;
}

body[data-reading-theme="night"] {
  --reading-background: #241d25;
  --reading-color: #f1e5d6;
}

body[data-reading-theme="night"] .reading-paper {
  border: 1px solid rgba(201, 165, 116, 0.2);
}

body[data-reading-theme="night"] .reading-chapter-number,
body[data-reading-theme="night"] .reading-book-label,
body[data-reading-theme="night"] .reading-chapter-ornament,
body[data-reading-theme="night"] .chapter-end-ornament,
body[data-reading-theme="night"] .reading-footnote {
  color: var(--gold-light);
}

body[data-reading-theme="night"] .reading-chapter-title {
  color: var(--ivory);
}

body[data-reading-theme="night"] .chapter-nav-button {
  border-color: rgba(201, 165, 116, 0.3);
  color: var(--gold-light);
}

body[data-reading-theme="night"] .chapter-nav-button:hover {
  background: rgba(201, 165, 116, 0.1);
}


/* ============================================================
   16 — CHAPTER HEADER
   ============================================================ */

.reading-chapter-header {
  margin-bottom: 52px;
  text-align: center;
}

.reading-book-label {
  margin: 0 0 23px;

  color: var(--burgundy);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.2em;
  line-height: 1.8;
}

.reading-chapter-ornament {
  margin-bottom: 18px;
  color: var(--burgundy);
  font-size: 25px;
}

.reading-chapter-number {
  margin: 0 0 12px;

  color: var(--burgundy);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.17em;
}

.reading-chapter-title {
  max-width: 100%;
  margin: 0;

  color: #39272d;
  font-family: var(--font-heading);
  font-size: clamp(30px, 4vw, 48px);
  font-weight: 400;
  line-height: 1.35;
}

.reading-heading-divider,
.chapter-end-ornament {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 14px;

  margin: 30px auto;

  color: var(--burgundy);
}

.reading-heading-divider span,
.chapter-end-ornament span {
  width: 55px;
  max-width: 20vw;
  height: 1px;

  background: currentColor;
  opacity: 0.35;
}

.reading-heading-divider i,
.chapter-end-ornament i {
  font-size: 22px;
  font-style: normal;
}


/* ============================================================
   17 — ACTUAL NOVEL TEXT
   ============================================================ */

.reading-text {
  width: 100%;
  min-width: 0;

  color: var(--reading-color);
  font-family: var(--font-display);
  font-size: var(--reading-font-size);
  line-height: var(--reading-line-height);

  font-weight: 500;
  text-align: left;
  overflow-wrap: break-word;
}

.reading-text p {
  margin: 0 0 1.15em;
}

.reading-text p:last-child {
  margin-bottom: 0;
}

.reading-text h2,
.reading-text h3 {
  margin: 1.5em 0 0.75em;

  font-family: var(--font-heading);
  font-weight: 500;
  line-height: 1.4;
}

.reading-text blockquote {
  margin: 1.5em 0;
  padding: 10px 22px;

  border-left: 3px solid var(--gold);

  font-style: italic;
}

.reading-text hr {
  width: 65px;
  margin: 2em auto;

  border: 0;
  border-top: 1px solid currentColor;
  opacity: 0.35;
}

.reading-text[dir="rtl"] {
  direction: rtl;
  text-align: right;

  font-family: var(--font-urdu);
  font-size: calc(var(--reading-font-size) * 0.95);
  line-height: max(2.35, var(--reading-line-height));
  word-break: normal;
}

.reading-text[dir="rtl"] p {
  margin-bottom: 1.55em;
}

.reading-text[dir="rtl"] blockquote {
  border-left: 0;
  border-right: 3px solid var(--gold);
}

.reading-paper:has(.reading-text[dir="rtl"])
.reading-chapter-title {
  font-family: var(--font-urdu);
  line-height: 2;
}


/* ============================================================
   18 — READING WIDTH SETTINGS
   ============================================================ */

body[data-reading-width="narrow"] {
  --reader-width: 640px;
}

body[data-reading-width="normal"] {
  --reader-width: 760px;
}

body[data-reading-width="wide"] {
  --reader-width: 940px;
}


/* ============================================================
   19 — LINE SPACING SETTINGS
   ============================================================ */

body[data-line-spacing="comfortable"] {
  --reading-line-height: 1.85;
}

body[data-line-spacing="relaxed"] {
  --reading-line-height: 2.05;
}

body[data-line-spacing="spacious"] {
  --reading-line-height: 2.25;
}


/* ============================================================
   20 — END OF CHAPTER
   ============================================================ */

.chapter-end-ornament {
  margin: 55px auto 45px;
}


/* ============================================================
   21 — CHAPTER NAVIGATION
   ============================================================ */

.chapter-bottom-navigation {
  display: grid;
  grid-template-columns:
    repeat(2, minmax(0, 1fr));

  gap: 16px;
  margin-top: 35px;
}

.chapter-nav-button {
  display: flex;
  align-items: center;
  gap: 13px;

  min-width: 0;
  min-height: 83px;

  padding: 16px;

  border: 1px solid rgba(99, 44, 64, 0.25);
  border-radius: 4px;

  background: transparent;
  color: var(--burgundy);

  text-align: left;

  transition:
    background 0.25s ease,
    border-color 0.25s ease,
    transform 0.25s ease;
}

.chapter-nav-button:hover:not(:disabled) {
  background: rgba(99, 44, 64, 0.07);
  border-color: var(--burgundy);
  transform: translateY(-2px);
}

.chapter-nav-button:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.chapter-nav-arrow {
  flex-shrink: 0;
  font-size: 25px;
}

.chapter-nav-text {
  display: flex;
  flex-direction: column;
  gap: 5px;

  min-width: 0;
}

.chapter-nav-text small {
  font-family: var(--font-body);
  font-size: 8px;
  font-weight: 700;
  letter-spacing: 0.1em;
}

.chapter-nav-text strong {
  font-family: var(--font-display);
  font-size: 19px;
  font-weight: 600;
  line-height: 1.3;
  overflow-wrap: break-word;
}

.next-chapter {
  justify-content: flex-end;
  text-align: right;
}


/* ============================================================
   22 — READING FOOTNOTE
   ============================================================ */

.reading-footnote {
  margin-top: 65px;
  padding-top: 35px;

  border-top: 1px solid rgba(99, 44, 64, 0.18);

  color: var(--burgundy);
  text-align: center;
}

.footnote-ornament {
  font-size: 23px;
}

.reading-footnote p {
  margin: 12px 0 8px;

  font-family: var(--font-display);
  font-size: 21px;
  font-style: italic;
}

.footnote-signature {
  font-family: var(--font-display);
  font-size: 18px;
  font-style: italic;
}


/* ============================================================
   23 — MOBILE BOTTOM TOOLBAR
   ============================================================ */

.mobile-reader-toolbar {
  display: none;
}


/* ============================================================
   24 — READING SETTINGS PANEL
   ============================================================ */

.settings-panel {
  position: fixed;
  z-index: 310;

  top: 0;
  right: 0;

  width: min(390px, 100%);
  height: 100vh;
  height: 100dvh;

  padding: 32px 28px;

  overflow-y: auto;
  overscroll-behavior: contain;

  border-left: 1px solid var(--line);

  background: #241b22;
  color: var(--ivory);

  box-shadow:
    -20px 0 65px rgba(0, 0, 0, 0.35);

  transform: translateX(105%);
  visibility: hidden;
  pointer-events: none;

  transition:
    transform 0.4s var(--ease),
    visibility 0.4s;
}

.settings-panel.is-open {
  transform: translateX(0);
  visibility: visible;
  pointer-events: auto;
}

.settings-panel-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 20px;

  margin-bottom: 40px;
}

.settings-kicker {
  color: var(--gold);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.16em;
}

.settings-panel-header h2 {
  margin: 9px 0 0;

  font-family: var(--font-heading);
  font-size: 29px;
  font-weight: 400;
  line-height: 1.3;
}

.settings-close {
  flex-shrink: 0;

  width: 40px;
  height: 40px;

  border: 1px solid var(--line);
  border-radius: 50%;

  background: transparent;
  color: var(--gold-light);

  font-size: 17px;
}

.settings-group {
  margin-bottom: 32px;
  padding-bottom: 30px;

  border-bottom: 1px solid var(--line);
}

.settings-group-label {
  display: block;
  margin-bottom: 17px;

  color: var(--gold-light);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.13em;
}

.font-size-controls {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 15px;
}

.font-size-controls button {
  width: 54px;
  height: 48px;

  border: 1px solid var(--line);
  border-radius: 4px;

  background: rgba(201, 165, 116, 0.06);
  color: var(--gold-light);

  font-family: var(--font-heading);
  font-size: 18px;
}

.font-size-controls button:hover {
  border-color: var(--gold);
}

.font-size-value {
  color: var(--ivory);
  font-size: 15px;
  font-weight: 700;
}


/* ============================================================
   25 — READING THEME BUTTONS
   ============================================================ */

.reading-theme-options {
  display: grid;
  grid-template-columns:
    repeat(3, minmax(0, 1fr));

  gap: 10px;
}

.theme-option {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 10px;

  min-width: 0;
  padding: 15px 7px;

  border: 1px solid var(--line);
  border-radius: 5px;

  background: rgba(201, 165, 116, 0.04);
  color: var(--muted);

  font-size: 10px;
}

.theme-option.is-active,
.theme-option[aria-pressed="true"] {
  border-color: var(--gold);
  background: rgba(201, 165, 116, 0.1);
  color: var(--gold-light);
}

.theme-swatch {
  display: block;

  width: 35px;
  height: 35px;

  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 50%;
}

.theme-paper {
  background: #f7eedf;
}

.theme-sepia {
  background: #e8d3af;
}

.theme-night {
  background: #241d25;
}


/* ============================================================
   26 — SELECT CONTROLS
   ============================================================ */

.settings-select {
  width: 100%;
  min-height: 45px;

  padding: 11px 13px;

  border: 1px solid var(--line);
  border-radius: 4px;

  background: #30242d;
  color: var(--ivory);

  font-size: 13px;
}

.settings-select:focus {
  border-color: var(--gold);
}

.reset-settings-button {
  width: 100%;
  min-height: 47px;

  padding: 12px;

  border: 1px solid var(--gold);

  background: transparent;
  color: var(--gold-light);

  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.1em;

  transition:
    background 0.25s ease,
    color 0.25s ease;
}

.reset-settings-button:hover {
  background: var(--gold);
  color: var(--night);
}

.settings-panel-footer {
  margin-top: 38px;
  text-align: center;
}

.settings-panel-footer span {
  color: var(--gold);
  font-size: 25px;
}

.settings-panel-footer p {
  color: var(--muted);
  font-family: var(--font-display);
  font-size: 20px;
  font-style: italic;
  line-height: 1.4;
}


/* ============================================================
   27 — SETTINGS OVERLAY
   ============================================================ */

.settings-overlay {
  position: fixed;
  inset: 0;
  z-index: 300;

  background: rgba(10, 7, 10, 0.7);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);

  opacity: 0;
  visibility: hidden;
  pointer-events: none;

  transition:
    opacity 0.3s ease,
    visibility 0.3s;
}

.settings-overlay.is-visible {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}


/* ============================================================
   28 — TOAST NOTIFICATIONS
   ============================================================ */

.reader-toast {
  position: fixed;
  z-index: 400;

  left: 50%;
  bottom: 35px;

  width: max-content;
  max-width: calc(100vw - 32px);

  padding: 13px 23px;

  border: 1px solid var(--gold);
  border-radius: 5px;

  background: #30242d;
  color: var(--gold-light);

  font-size: 12px;
  text-align: center;

  box-shadow:
    0 15px 40px rgba(0, 0, 0, 0.35);

  opacity: 0;
  visibility: hidden;
  pointer-events: none;

  transform: translate(-50%, 20px);

  transition:
    opacity 0.3s ease,
    transform 0.3s ease,
    visibility 0.3s;
}

.reader-toast.is-visible {
  opacity: 1;
  visibility: visible;
  transform: translate(-50%, 0);
}


/* ============================================================
   29 — BACK TO TOP
   ============================================================ */

.back-to-top {
  position: fixed;
  z-index: 80;

  right: 26px;
  bottom: 26px;

  display: flex;
  justify-content: center;
  align-items: center;

  width: 47px;
  height: 47px;

  border: 1px solid var(--gold);
  border-radius: 50%;

  background: var(--burgundy);
  color: var(--gold-light);

  font-size: 24px;

  box-shadow:
    0 10px 25px rgba(0, 0, 0, 0.25);

  opacity: 0;
  visibility: hidden;
  pointer-events: none;

  transform: translateY(12px);

  transition:
    opacity 0.3s ease,
    transform 0.3s ease,
    visibility 0.3s;
}

.back-to-top.is-visible {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: translateY(0);
}

.back-to-top:hover {
  background: var(--gold);
  color: var(--night);
}


/* ============================================================
   30 — NO JAVASCRIPT FALLBACK
   ============================================================ */

.reader-noscript {
  position: fixed;
  inset: 0;
  z-index: 1000;

  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 15px;

  padding: 25px;

  background: var(--night);
  color: var(--ivory);
  text-align: center;
}

.reader-noscript h2 {
  font-family: var(--font-heading);
  font-size: 30px;
}

.reader-noscript p {
  color: var(--muted);
}

.reader-noscript a {
  padding: 12px 20px;
  border: 1px solid var(--gold);
  color: var(--gold-light);
}


/* ============================================================
   31 — LARGE DESKTOP
   1600px+
   ============================================================ */

@media (min-width: 1600px) {

  :root {
    --sidebar-width: 350px;
    --reader-width: 830px;
  }

  .reader-content-wrapper {
    padding-top: 50px;
  }

  .reading-paper {
    padding: 80px 85px 65px;
  }
}


/* ============================================================
   32 — SMALL DESKTOP / LAPTOP
   1025px–1399px
   ============================================================ */

@media (min-width: 1025px) and (max-width: 1399px) {

  :root {
    --sidebar-width: 280px;
    --reader-width: 720px;
  }

  .reader-content-wrapper {
    padding: 30px 35px 90px;
  }

  .reading-paper {
    padding: 55px 50px 50px;
  }

  .sidebar-inner {
    padding: 26px 19px;
  }
}


/* ============================================================
   33 — TABLET
   681px–1024px
   ============================================================ */

@media (min-width: 681px) and (max-width: 1024px) {

  :root {
    --sidebar-width: 260px;
    --reader-width: 700px;
  }

  .reader-header-inner {
    padding-inline: 22px;
  }

  .header-brand-name {
    font-size: 9px;
    letter-spacing: 0.12em;
  }

  .reader-content-wrapper {
    padding: 25px 24px 80px;
  }

  .sidebar-inner {
    padding: 25px 16px;
  }

  .sidebar-book-cover {
    width: 125px;
    min-height: 180px;
  }

  .sidebar-book-title {
    font-size: 20px;
  }

  .reading-paper {
    padding: 45px 35px 45px;
  }

  .reading-chapter-title {
    font-size: clamp(28px, 4vw, 40px);
  }

  .reading-text {
    font-size: min(var(--reading-font-size), 21px);
  }

  .chapter-nav-button {
    padding: 12px;
  }

  .chapter-nav-text strong {
    font-size: 17px;
  }
}


/* ============================================================
   34 — MOBILE / SMALL TABLET
   Up to 680px
   ============================================================ */

@media (max-width: 680px) {

  :root {
    --header-height: 65px;
    --sidebar-width: 310px;
    --reader-width: 100%;
  }

  html {
    scroll-padding-top: 75px;
  }

  /* Header */

  .reader-header-inner {
    min-height: var(--header-height);
    padding: 10px 14px;
    gap: 9px;
  }

  .reader-back-link {
    gap: 5px;
    font-size: 9px;
    letter-spacing: 0.06em;
  }

  .reader-back-link span:first-child {
    font-size: 19px;
  }

  .reader-header-brand {
    gap: 4px;
    min-width: 0;
  }

  .header-brand-symbol {
    font-size: 15px;
  }

  .header-brand-name {
    font-size: 8px;
    letter-spacing: 0.07em;
    line-height: 1.4;
  }

  .reader-settings-toggle {
    min-width: 40px;
    min-height: 40px;
    padding: 8px 10px;
  }

  .settings-toggle-label {
    display: none;
  }

  /* Layout */

  .reader-layout {
    display: block;
    width: 100%;
  }

  .reader-main {
    width: 100%;
    min-width: 0;
  }

  /* Sidebar becomes a drawer */

  .chapter-sidebar {
    position: fixed;
    z-index: 220;

    top: 0;
    left: 0;

    width: min(330px, 88vw);
    max-width: 100%;

    height: 100vh;
    height: 100dvh;

    border-right: 1px solid var(--line);

    transform: translateX(-105%);
    visibility: hidden;
    pointer-events: none;

    transition:
      transform 0.4s var(--ease),
      visibility 0.4s;
  }

  .chapter-sidebar.is-open {
    transform: translateX(0);
    visibility: visible;
    pointer-events: auto;
  }

  .sidebar-inner {
    padding: 24px 20px 35px;
  }

  .sidebar-close {
    display: inline-flex;
    justify-content: center;
    align-items: center;
  }

  .sidebar-overlay {
    position: fixed;
    inset: 0;
    z-index: 210;

    display: block;

    background: rgba(10, 7, 10, 0.7);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);

    opacity: 0;
    visibility: hidden;
    pointer-events: none;

    transition:
      opacity 0.3s ease,
      visibility 0.3s;
  }

  .sidebar-overlay.is-visible {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
  }

  /* Toolbar */

  .reader-toolbar {
    min-height: 58px;
    padding: 10px 15px;
    gap: 8px;
  }

  .toolbar-button {
    min-height: 38px;
    padding: 8px 9px;
    gap: 5px;
    font-size: 8px;
  }

  .toolbar-icon {
    font-size: 16px;
  }

  .toolbar-chapter-label {
    font-size: 8px;
    letter-spacing: 0.05em;
  }

  /* Reading paper */

  .reader-content-wrapper {
    width: 100%;
    padding: 16px 12px 110px;
  }

  .reading-paper {
    width: 100%;
    max-width: 100%;

    padding: 40px 25px 45px;

    box-shadow:
      0 12px 45px rgba(0, 0, 0, 0.22);
  }

  .reading-chapter-header {
    margin-bottom: 38px;
  }

  .reading-book-label {
    font-size: 8px;
    letter-spacing: 0.12em;
  }

  .reading-chapter-title {
    font-size: clamp(28px, 7vw, 38px);
    line-height: 1.3;
  }

  .reading-text {
    font-size: var(--reading-font-size);
    line-height: var(--reading-line-height);
  }

  .reading-text[dir="rtl"] {
    font-size: calc(var(--reading-font-size) * 0.95);
  }

  .chapter-end-ornament {
    margin: 45px auto 35px;
  }

  /* Chapter buttons */

  .chapter-bottom-navigation {
    gap: 10px;
  }

  .chapter-nav-button {
    min-height: 75px;
    gap: 8px;
    padding: 12px 10px;
  }

  .chapter-nav-arrow {
    font-size: 21px;
  }

  .chapter-nav-text small {
    font-size: 7px;
  }

  .chapter-nav-text strong {
    font-size: 16px;
  }

  .reading-footnote {
    margin-top: 45px;
  }

  .reading-footnote p {
    font-size: 19px;
  }

  /* Mobile bottom navigation */

  .mobile-reader-toolbar {
    position: fixed;
    z-index: 90;

    left: 0;
    right: 0;
    bottom: 0;

    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));

    min-height: 65px;
    padding-bottom: env(safe-area-inset-bottom, 0px);

    border-top: 1px solid var(--line);

    background: rgba(23, 17, 22, 0.97);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
  }

  .mobile-reader-toolbar button {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 3px;

    min-width: 0;
    min-height: 60px;
    padding: 8px 4px;

    border: 0;
    background: transparent;

    color: var(--gold-light);
  }

  .mobile-reader-toolbar button:disabled {
    opacity: 0.35;
  }

  .mobile-reader-toolbar button span {
    font-size: 20px;
    line-height: 1;
  }

  .mobile-reader-toolbar button small {
    font-size: 9px;
    line-height: 1.3;
  }

  /* Settings panel */

  .settings-panel {
    width: min(390px, 100%);
    padding: 26px 23px 100px;
  }

  /* Back to top */

  .back-to-top {
    right: 16px;
    bottom: calc(80px + env(safe-area-inset-bottom, 0px));

    width: 42px;
    height: 42px;
  }

  /* Toast */

  .reader-toast {
    bottom: calc(82px + env(safe-area-inset-bottom, 0px));
  }
}


/* ============================================================
   35 — SMALL MOBILE
   Up to 390px
   ============================================================ */

@media (max-width: 390px) {

  .reader-header-inner {
    padding-inline: 10px;
    gap: 7px;
  }

  .reader-back-link {
    font-size: 8px;
  }

  .header-brand-name {
    font-size: 7px;
    letter-spacing: 0.04em;
  }

  .reader-settings-toggle {
    padding: 7px 8px;
  }

  .reader-content-wrapper {
    padding-inline: 9px;
  }

  .reading-paper {
    padding: 35px 20px 40px;
  }

  .reading-chapter-title {
    font-size: 28px;
  }

  .reading-chapter-header {
    margin-bottom: 32px;
  }

  .chapter-bottom-navigation {
    gap: 8px;
  }

  .chapter-nav-button {
    min-height: 70px;
    padding: 10px 8px;
  }

  .chapter-nav-text strong {
    font-size: 15px;
  }

  .chapter-nav-arrow {
    font-size: 18px;
  }

  .settings-panel {
    padding-inline: 20px;
  }
}


/* ============================================================
   36 — VERY SMALL MOBILE
   Up to 340px
   ============================================================ */

@media (max-width: 340px) {

  .reader-header-brand {
    display: none;
  }

  .reader-header-inner {
    gap: 10px;
  }

  .reader-toolbar {
    padding-inline: 9px;
  }

  .toolbar-chapter-label {
    font-size: 7px;
  }

  .reading-paper {
    padding: 30px 16px 35px;
  }

  .reading-chapter-title {
    font-size: 25px;
  }

  .chapter-bottom-navigation {
    grid-template-columns: minmax(0, 1fr);
  }

  .chapter-nav-button {
    width: 100%;
  }

  .mobile-reader-toolbar button small {
    font-size: 8px;
  }
}


/* ============================================================
   37 — LANDSCAPE PHONES
   ============================================================ */

@media (max-height: 500px) and (orientation: landscape) {

  .reader-header {
    position: relative;
  }

  .chapter-sidebar {
    height: 100dvh;
  }

  .settings-panel {
    height: 100dvh;
  }

  .reader-content-wrapper {
    padding-top: 20px;
  }

  .reading-paper {
    padding-top: 35px;
  }

  .mobile-reader-toolbar {
    min-height: 52px;
  }

  .mobile-reader-toolbar button {
    min-height: 48px;
  }
}


/* ============================================================
   38 — TOUCH DEVICES
   ============================================================ */

@media (hover: none) and (pointer: coarse) {

  .chapter-nav-button:hover:not(:disabled) {
    transform: none;
  }

  .reader-back-link,
  .reader-settings-toggle,
  .toolbar-button,
  .chapter-nav-button,
  .settings-close,
  .sidebar-close,
  .reset-settings-button {
    min-height: 44px;
  }
}


/* ============================================================
   39 — REDUCED MOTION
   ============================================================ */

@media (prefers-reduced-motion: reduce) {

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
  }
}


/* ============================================================
   END — MAHROZ'S SECRET LIBRARY
   COMPLETE READER.CSS
   ============================================================ */
