:root {
  color-scheme: dark;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans KR", "Malgun Gothic", sans-serif;
  font-synthesis: none;
  background: #151518;
  color: #f3f1ec;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; }
a { color: inherit; }

.skip-link {
  position: fixed;
  top: 12px;
  left: 12px;
  z-index: 10;
  padding: 12px 18px;
  border-radius: 4px;
  background: #fff;
  color: #151518;
  transform: translateY(-160%);
}
.skip-link:focus { transform: translateY(0); }

.reading-progress {
  position: fixed;
  inset: 0 0 auto;
  height: 2px;
  z-index: 5;
  pointer-events: none;
}
.reading-progress span {
  display: block;
  width: 100%;
  height: 100%;
  background: #d5c4a8;
  transform: scaleX(0);
  transform-origin: left;
}

.chapter-header,
.chapter-footer {
  width: min(100%, 780px);
  margin-inline: auto;
  text-align: center;
}
.chapter-header {
  display: flex;
  height: 44px;
  align-items: center;
  justify-content: center;
  padding: 0 16px;
}
.chapter-label {
  margin: 0;
  color: #aaa6a0;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: .18em;
}
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
.chapter {
  display: block;
  width: min(100%, 780px);
  margin: 0 auto;
  background: #fff;
  outline: none;
}
.panel { margin: 0; padding: 0; }
.panel img {
  display: block;
  width: 100%;
  height: auto;
  margin: 0;
  padding: 0;
}
.chapter-footer { padding: 44px 20px 64px; }
.chapter-footer p {
  margin: 0 0 24px;
  color: #aaa6a0;
  font-size: 12px;
  letter-spacing: .06em;
}
.back-to-top {
  display: inline-flex;
  min-height: 44px;
  align-items: center;
  justify-content: center;
  gap: 20px;
  padding: 11px 20px;
  border: 1px solid #535154;
  border-radius: 999px;
  color: #e6e2dc;
  text-decoration: none;
  font-size: 13px;
  line-height: 1.5;
}
.back-to-top:hover { border-color: #b4aaa0; background: #222124; }
.back-to-top:focus-visible,
.skip-link:focus-visible { outline: 2px solid #e6d8c1; outline-offset: 5px; }
.load-message {
  margin: 0 auto;
  max-width: 780px;
  padding: 56px 24px;
  color: #222;
  background: #fff;
  text-align: center;
  line-height: 1.7;
}

@media (max-width: 480px) {
  .chapter-label { font-size: 10px; }
  .chapter-footer { padding: 36px 20px 48px; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}
@media print {
  :root { color-scheme: light; background: #fff; }
  .chapter-header, .chapter-footer, .reading-progress, .skip-link { display: none; }
  .chapter { max-width: none; width: 100%; }
}
