* {
  box-sizing: border-box;
}

html {
  background: #f3f0e8;
  color: #191919;
}

body {
  margin: 0;
  font-family: Arial, Helvetica, sans-serif;
}

button {
  border: 0;
  border-radius: 999px;
  background: #191919;
  color: white;
  padding: 12px 20px;
  cursor: pointer;
}

button:disabled {
  opacity: .35;
  cursor: not-allowed;
}

.hidden {
  display: none !important;
}

.reader-shell {
  width: min(100% - 32px, 820px);
  min-height: calc(100vh - 100px);
  margin: 32px auto 0;
  background: #fbfaf6;
  border: 1px solid rgba(0, 0, 0, .07);
  border-radius: 22px;
  box-shadow: 0 18px 55px rgba(0, 0, 0, .06);
}

.loading {
  padding: 80px 48px;
}

.book-home,
.chapter-view {
  width: min(100% - 48px, 680px);
  margin: auto;
  padding: 90px 0;
}

.book-home {
  text-align: center;
}

.brand,
.section-label,
.chapter-number {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .2em;
  color: #716d64;
}

.book-home h1 {
  margin: 18px auto 34px;
  font-family: Georgia, "Times New Roman", serif;
  font-weight: 500;
  font-size: clamp(46px, 8vw, 78px);
  line-height: .98;
  letter-spacing: -.04em;
}

.toc {
  margin-top: 80px;
  text-align: left;
  font-size: 14px;
}

.toc ol {
  padding-left: 28px;
}

.toc li {
  border-bottom: 1px solid rgba(0, 0, 0, .09);
}

.toc-link {
  width: 100%;
  border-radius: 0;
  background: transparent;
  color: #191919;
  text-align: left;
  padding: 17px 8px;
  font-size: 16px;
}

.text-button {
  padding: 0;
  margin-bottom: 55px;
  background: transparent;
  color: #716d64;
}

.chapter-view h1 {
  margin: 15px 0 45px;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(44px, 7vw, 68px);
  line-height: 1;
  font-weight: 500;
  letter-spacing: -.035em;
}

.chapter-body {
  font-family: Georgia, "Times New Roman", serif;
  font-size: 20px;
  line-height: 1.72;
}

.chapter-body p {
  margin: 0 0 1.35em;
}

.chapter-nav {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 12px;
  align-items: center;
  margin-top: 70px;
  padding-top: 28px;
  border-top: 1px solid rgba(0, 0, 0, .1);
}

.chapter-nav button:first-child {
  justify-self: start;
}

.chapter-nav button:last-child {
  justify-self: end;
}

.secondary {
  background: transparent;
  color: #191919;
  border: 1px solid rgba(0, 0, 0, .18);
}

.powered {
  padding: 28px;
  text-align: center;
  color: #777268;
  font-size: 13px;
}

.powered strong {
  color: #191919;
}

@media (max-width: 650px) {
  .reader-shell {
    width: 100%;
    margin: 0;
    border-radius: 0;
    border-left: 0;
    border-right: 0;
  }

  .book-home,
  .chapter-view {
    width: min(100% - 32px, 680px);
    padding: 64px 0;
  }

  .chapter-body {
    font-size: 19px;
    line-height: 1.68;
  }

  .chapter-nav {
    grid-template-columns: 1fr 1fr;
  }

  .chapter-nav .secondary {
    grid-column: 1 / -1;
    grid-row: 2;
  }
}

/* === ARLYDOC MOBILE TOC === */
@media (max-width: 650px) {
  .toc ol {
    list-style: none;
    counter-reset: arlydoc-toc;
    padding-left: 0;
  }

  .toc li {
    counter-increment: arlydoc-toc;
    position: relative;
    padding-left: 28px;
  }

  .toc li::before {
    content: counter(arlydoc-toc) ".";
    position: absolute;
    left: 0;
    top: 17px;
    width: 20px;
    font-size: 13px;
    line-height: 1;
    font-weight: 400;
    color: #716d64;
    text-align: right;
  }

  .toc-link {
    font-size: 16px;
    padding: 15px 8px;
  }
}
