:root {
  color-scheme: light;
  --navy: #18315f;
  --navy-deep: #102446;
  --navy-soft: #e9eef7;
  --gold: #b88a32;
  --gold-soft: #ead9ae;
  --paper: #fffdf8;
  --canvas: #edf1f7;
  --ink: #242222;
  --muted: #647085;
  --line: #d8dde7;
  --reader-scale: 1;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--canvas);
  color: var(--ink);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  min-height: 100%;
  scroll-behavior: smooth;
}

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  background: var(--canvas);
}

button {
  font: inherit;
}

button:focus-visible,
[tabindex]:focus-visible,
a:focus-visible {
  outline: 3px solid #d19b35;
  outline-offset: 3px;
}

.visually-hidden {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

.topbar {
  position: sticky;
  z-index: 50;
  top: 0;
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr) auto;
  align-items: center;
  min-height: 68px;
  padding: 8px clamp(14px, 3vw, 34px);
  color: #fff;
  background: var(--navy);
  border-bottom: 3px solid var(--gold);
}

.icon-button,
.text-button,
.brand-button,
.primary-button,
.secondary-button,
.nav-button,
.chapter-counter,
.chapter-link,
.toc-install-button,
.dialog-close {
  border: 0;
  cursor: pointer;
}

.icon-button {
  display: inline-grid;
  width: 44px;
  height: 44px;
  padding: 10px;
  place-items: center;
  color: inherit;
  background: transparent;
  border-radius: 6px;
}

.icon-button:hover {
  background: rgba(255, 255, 255, 0.12);
}

.icon-button svg,
.offline-note svg {
  width: 24px;
  height: 24px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.brand-button {
  justify-self: start;
  min-width: 0;
  padding: 4px 12px;
  color: #fff;
  text-align: left;
  background: transparent;
}

.brand-kicker,
.brand-title {
  display: block;
}

.brand-kicker {
  margin-bottom: 2px;
  color: var(--gold-soft);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

.brand-title {
  overflow: hidden;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.05rem;
  font-weight: 700;
  line-height: 1.1;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.reading-tools {
  display: flex;
  gap: 6px;
}

.text-button {
  min-width: 42px;
  min-height: 40px;
  padding: 7px 9px;
  color: #fff;
  font-size: 0.9rem;
  font-weight: 800;
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.35);
  border-radius: 6px;
}

.text-button:hover {
  background: rgba(255, 255, 255, 0.12);
}

.cover-screen {
  display: flex;
  min-height: 100vh;
  padding: clamp(20px, 4vw, 48px) 18px 28px;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 22px;
  background: #dfe5ef;
}

.cover-frame {
  position: relative;
  width: min(485px, calc(100vw - 54px));
  padding: 10px 10px 12px 17px;
  background: var(--navy-deep);
  border: 1px solid #0a1830;
  border-radius: 8px 13px 13px 8px;
  box-shadow: 0 22px 55px rgba(21, 38, 71, 0.26), -8px 7px 0 #0d1f3d;
}

.cover-frame::before {
  position: absolute;
  z-index: 2;
  top: 13px;
  bottom: 15px;
  left: 10px;
  width: 3px;
  content: "";
  background: var(--gold);
  border-radius: 4px;
}

.cover-image {
  display: block;
  width: 100%;
  max-height: calc(100vh - 145px);
  object-fit: contain;
  background: #fff;
  border-radius: 2px 7px 7px 2px;
}

.primary-button {
  min-height: 50px;
  padding: 13px 30px;
  color: #fff;
  font-weight: 800;
  letter-spacing: 0.025em;
  background: var(--navy);
  border: 2px solid var(--navy);
  border-radius: 7px;
  box-shadow: 0 6px 0 var(--navy-deep);
}

.primary-button:hover {
  background: #204078;
}

.primary-button:active {
  transform: translateY(3px);
  box-shadow: 0 3px 0 var(--navy-deep);
}

.cover-actions {
  display: flex;
  width: min(485px, calc(100vw - 54px));
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 12px;
}

.cover-actions .primary-button,
.cover-actions .secondary-button {
  flex: 1 1 190px;
}

.secondary-button {
  display: inline-flex;
  min-height: 50px;
  padding: 12px 22px;
  align-items: center;
  justify-content: center;
  gap: 9px;
  color: var(--navy);
  font-weight: 800;
  background: #fff;
  border: 2px solid var(--navy);
  border-radius: 7px;
}

.secondary-button:hover {
  background: var(--navy-soft);
}

.secondary-button svg,
.toc-install-button svg,
.dialog-close svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.install-hint {
  width: 100%;
  margin: 0;
  color: #526077;
  font-size: 0.84rem;
  line-height: 1.4;
  text-align: center;
}

.reader {
  position: relative;
  display: grid;
  min-height: calc(100vh - 68px);
  grid-template-columns: 286px minmax(0, 1fr);
}

.toc {
  position: sticky;
  z-index: 30;
  top: 68px;
  display: flex;
  height: calc(100vh - 68px);
  padding: 26px 18px 20px;
  flex-direction: column;
  color: #fff;
  background: var(--navy-deep);
  border-right: 1px solid #08152a;
  overflow-y: auto;
}

.toc-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 0 8px 18px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.16);
}

.toc-header h2 {
  margin: 2px 0 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.65rem;
}

.toc-kicker {
  margin: 0;
  color: var(--gold-soft);
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.close-menu {
  display: none;
}

.chapter-list {
  display: flex;
  padding: 17px 0;
  flex: 1;
  flex-direction: column;
  gap: 4px;
}

.chapter-link {
  display: grid;
  width: 100%;
  min-height: 52px;
  padding: 9px 12px;
  grid-template-columns: 34px minmax(0, 1fr);
  align-items: center;
  gap: 9px;
  color: rgba(255, 255, 255, 0.82);
  text-align: left;
  background: transparent;
  border-left: 3px solid transparent;
  border-radius: 4px;
}

.chapter-link:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.08);
}

.chapter-link[aria-current="page"] {
  color: #fff;
  background: rgba(255, 255, 255, 0.13);
  border-left-color: var(--gold);
}

.chapter-number {
  display: grid;
  width: 31px;
  height: 31px;
  place-items: center;
  color: var(--navy-deep);
  font-size: 0.76rem;
  font-weight: 900;
  background: var(--gold-soft);
  border-radius: 50%;
}

.chapter-link[aria-current="page"] .chapter-number {
  background: #fff;
}

.chapter-nav-copy {
  min-width: 0;
}

.chapter-nav-label,
.chapter-nav-subtitle {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chapter-nav-label {
  font-size: 0.9rem;
  font-weight: 800;
}

.chapter-nav-subtitle {
  margin-top: 2px;
  color: rgba(255, 255, 255, 0.58);
  font-size: 0.74rem;
}

.offline-note {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 14px 10px 0;
  color: rgba(255, 255, 255, 0.65);
  font-size: 0.78rem;
  line-height: 1.35;
  border-top: 1px solid rgba(255, 255, 255, 0.16);
}

.offline-note svg {
  width: 25px;
  min-width: 25px;
  color: var(--gold-soft);
}

.toc-install-button {
  display: flex;
  width: 100%;
  min-height: 44px;
  margin-top: 14px;
  padding: 9px 11px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  color: #fff;
  font-size: 0.82rem;
  font-weight: 800;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.24);
  border-radius: 6px;
}

.toc-install-button:hover {
  background: rgba(255, 255, 255, 0.17);
}

.install-dialog {
  width: min(520px, calc(100vw - 28px));
  max-height: min(760px, calc(100vh - 28px));
  margin: auto;
  padding: 0;
  color: var(--ink);
  background: var(--paper);
  border: 1px solid #cfd5df;
  border-radius: 12px;
  box-shadow: 0 24px 70px rgba(8, 20, 42, 0.34);
  overflow: auto;
}

.install-dialog::backdrop {
  background: rgba(8, 18, 36, 0.68);
  backdrop-filter: blur(2px);
}

.install-panel {
  padding: clamp(22px, 5vw, 34px);
}

.install-dialog-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--line);
}

.install-dialog-header h2 {
  margin: 2px 0 0;
  color: var(--navy);
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(1.5rem, 6vw, 2rem);
  line-height: 1.15;
}

.install-kicker {
  margin: 0;
  color: var(--gold);
  font-size: 0.76rem;
  font-weight: 900;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

.dialog-close {
  display: inline-grid;
  width: 42px;
  height: 42px;
  min-width: 42px;
  padding: 9px;
  place-items: center;
  color: var(--navy);
  background: var(--navy-soft);
  border-radius: 50%;
}

.dialog-close:hover {
  background: #dce4f1;
}

.install-platform {
  padding-top: 22px;
}

.install-platform > p {
  margin: 14px 0;
  color: #4d576a;
  line-height: 1.55;
}

.platform-badge {
  display: inline-flex;
  min-height: 31px;
  padding: 6px 11px;
  align-items: center;
  color: var(--navy);
  font-size: 0.78rem;
  font-weight: 900;
  letter-spacing: 0.045em;
  text-transform: uppercase;
  background: var(--gold-soft);
  border-radius: 999px;
}

.install-steps {
  margin: 18px 0 22px;
  padding: 0;
  list-style: none;
  counter-reset: install-step;
}

.install-steps li {
  position: relative;
  min-height: 34px;
  margin: 0 0 13px;
  padding: 5px 0 0 46px;
  color: #3d4658;
  line-height: 1.45;
  counter-increment: install-step;
}

.install-steps li::before {
  position: absolute;
  top: 0;
  left: 0;
  display: grid;
  width: 34px;
  height: 34px;
  content: counter(install-step);
  place-items: center;
  color: #fff;
  font-size: 0.82rem;
  font-weight: 900;
  background: var(--navy);
  border-radius: 50%;
}

.install-confirm {
  width: 100%;
}

.share-symbol {
  display: inline-grid;
  width: 25px;
  height: 25px;
  margin-left: 2px;
  place-items: center;
  color: var(--navy);
  font-size: 1.2rem;
  font-weight: 900;
  line-height: 1;
  background: var(--navy-soft);
  border-radius: 4px;
}

.install-note {
  padding: 11px 13px;
  font-size: 0.86rem;
  background: #f3f5f9;
  border-left: 4px solid var(--gold);
  border-radius: 3px;
}

.desktop-install {
  text-align: center;
}

.install-qr {
  display: block;
  width: min(280px, 75vw);
  height: auto;
  margin: 18px auto 12px;
  background: #fff;
  border: 10px solid #fff;
  box-shadow: 0 0 0 1px #d7dce5;
}

.qr-download {
  display: inline-block;
  padding: 9px 14px;
  color: var(--navy);
  font-size: 0.86rem;
  font-weight: 800;
  text-underline-offset: 3px;
}

.install-status {
  min-height: 1.3em;
  margin: 16px 0 0;
  color: var(--navy);
  font-size: 0.88rem;
  font-weight: 700;
  line-height: 1.4;
  text-align: center;
}

.reading-stage {
  position: relative;
  min-width: 0;
  padding: clamp(24px, 5vw, 58px) clamp(14px, 4vw, 54px) 40px;
}

.progress-track {
  position: absolute;
  top: 0;
  right: 0;
  left: 0;
  height: 4px;
  background: #d5dbe6;
}

.progress-track span {
  display: block;
  width: 0;
  height: 100%;
  background: var(--gold);
  transition: width 180ms ease;
}

.paper {
  position: relative;
  width: min(860px, 100%);
  min-height: min(980px, calc(100vh - 170px));
  margin: 0 auto;
  padding: clamp(44px, 7vw, 78px) clamp(26px, 8vw, 86px) clamp(52px, 8vw, 90px);
  font-size: calc(1.08rem * var(--reader-scale));
  background: var(--paper);
  border: 1px solid #dad7ce;
  border-left: 7px solid var(--navy);
  border-radius: 3px 10px 10px 3px;
  box-shadow: 0 18px 45px rgba(31, 44, 69, 0.13), -5px 5px 0 #d5d1c8;
}

.paper::after {
  position: absolute;
  top: 0;
  right: clamp(20px, 4vw, 42px);
  width: 28px;
  height: 48px;
  content: "";
  background: var(--navy);
  border-bottom: 5px solid var(--gold);
}

.source-paragraph {
  margin: 0 0 0.82em;
  color: var(--ink);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1em;
  line-height: 1.62;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  text-align: left;
  text-wrap: pretty;
}

.source-paragraph.align-center {
  text-align: center;
}

.source-paragraph.align-right {
  text-align: right;
}

.source-paragraph.align-justify {
  text-align: justify;
}

.source-title {
  margin: 0 auto 0.2em;
  max-width: 700px;
  color: var(--navy);
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(1.72rem, calc(2rem * var(--reader-scale)), 2.4rem);
  line-height: 1.15;
  text-align: center !important;
  text-wrap: balance;
}

.source-subtitle {
  margin: 0 auto 2.35em;
  max-width: 690px;
  color: #4e5870;
  font-family: Georgia, "Times New Roman", serif;
  font-size: calc(1.02rem * var(--reader-scale));
  font-weight: 700;
  letter-spacing: 0.065em;
  line-height: 1.35;
  text-align: center !important;
  text-transform: uppercase;
  text-wrap: balance;
}

.source-title:not(:has(+ .source-subtitle)) {
  margin-bottom: 2.1em;
}

.source-section-heading {
  margin-top: 1.65em;
  margin-bottom: 0.38em;
  color: var(--navy);
  font-size: calc(1.02rem * var(--reader-scale));
  line-height: 1.35;
}

.source-music-heading {
  display: flex;
  align-items: baseline;
  gap: 0.38em;
  margin-top: 1.65em;
  margin-bottom: 0.38em;
  color: var(--navy);
  font-weight: 700;
}

.source-music-heading::before {
  content: "♫";
  color: var(--gold);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.15em;
}

.source-bold {
  font-weight: 700;
}

.source-italic {
  font-style: italic;
}

.source-underline {
  text-decoration: underline;
}

.empty-paragraph {
  min-height: 0.5em;
  margin-bottom: 0.35em;
}

.paper.songs-layout .source-paragraph:not(.source-title) {
  break-inside: avoid;
}

.paper.songs-layout .chapter-body {
  column-count: 2;
  column-gap: clamp(32px, 6vw, 62px);
  column-rule: 1px solid #d8d4c9;
}

.page-navigation {
  display: grid;
  width: min(860px, 100%);
  margin: 28px auto 0;
  grid-template-columns: minmax(110px, 1fr) auto minmax(110px, 1fr);
  align-items: center;
  gap: 12px;
}

.nav-button,
.chapter-counter {
  min-height: 46px;
  padding: 10px 16px;
  color: var(--navy);
  font-weight: 800;
  background: #fff;
  border: 1px solid #cbd2df;
  border-radius: 6px;
}

.nav-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
}

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

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

.nav-button span[aria-hidden="true"] {
  font-size: 1.5rem;
  line-height: 0.8;
}

.nav-button:hover,
.chapter-counter:hover {
  background: var(--navy-soft);
  border-color: #aebbd0;
}

.nav-button:disabled {
  color: #9198a5;
  cursor: not-allowed;
  background: #e7eaf0;
  border-color: #d5d9e0;
}

.chapter-counter {
  min-width: 108px;
  color: #697388;
  font-size: 0.84rem;
}

.toc-backdrop {
  position: fixed;
  z-index: 25;
  inset: 68px 0 0;
  background: rgba(8, 18, 36, 0.58);
}

noscript {
  display: block;
  padding: 18px;
  color: #fff;
  text-align: center;
  background: #8c2d2d;
}

@media (max-width: 899px) {
  .reader {
    display: block;
  }

  .toc {
    position: fixed;
    top: 68px;
    bottom: 0;
    left: 0;
    width: min(340px, 88vw);
    height: auto;
    transform: translateX(-105%);
    transition: transform 180ms ease;
    box-shadow: 18px 0 40px rgba(7, 18, 36, 0.35);
  }

  .toc.is-open {
    transform: translateX(0);
  }

  .close-menu {
    display: inline-grid;
  }

  .reading-stage {
    padding-top: 30px;
  }

  .paper {
    min-height: calc(100vh - 188px);
  }
}

@media (max-width: 620px) {
  .topbar {
    min-height: 64px;
    grid-template-columns: 44px minmax(0, 1fr) auto;
    padding-inline: 7px 10px;
  }

  .brand-button {
    padding-inline: 7px;
  }

  .brand-kicker {
    display: none;
  }

  .brand-title {
    font-size: 0.98rem;
  }

  .text-button {
    min-width: 38px;
    min-height: 38px;
    padding-inline: 6px;
  }

  .toc {
    top: 64px;
  }

  .toc-backdrop {
    inset-block-start: 64px;
  }

  .reading-stage {
    padding: 22px 9px 26px;
  }

  .cover-actions {
    width: min(440px, calc(100vw - 36px));
  }

  .cover-actions .primary-button,
  .cover-actions .secondary-button {
    flex-basis: 100%;
  }

  .install-panel {
    padding: 22px 19px 24px;
  }

  .paper {
    min-height: calc(100vh - 160px);
    padding: 47px 22px 54px 26px;
    border-left-width: 5px;
    border-radius: 2px 7px 7px 2px;
    box-shadow: 0 10px 28px rgba(31, 44, 69, 0.11), -3px 4px 0 #d5d1c8;
  }

  .source-paragraph.align-justify {
    text-align: left;
  }

  .paper.songs-layout .chapter-body {
    column-count: 1;
  }

  .page-navigation {
    margin-top: 20px;
    grid-template-columns: 1fr auto 1fr;
    gap: 6px;
  }

  .nav-button {
    min-width: 0;
    padding-inline: 10px;
  }

  .chapter-counter {
    min-width: 74px;
    padding-inline: 8px;
  }
}

@media (max-height: 760px) and (min-width: 700px) {
  .cover-screen {
    justify-content: flex-start;
  }

  .cover-image {
    max-height: 610px;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
  }
}

@media print {
  .topbar,
  .toc,
  .page-navigation,
  .progress-track,
  .toc-backdrop,
  .install-dialog,
  .cover-actions {
    display: none !important;
  }

  body,
  .reader,
  .reading-stage {
    background: #fff;
  }

  .reading-stage {
    padding: 0;
  }

  .paper {
    width: 100%;
    min-height: 0;
    padding: 0;
    border: 0;
    box-shadow: none;
  }
}
