:root {
  color-scheme: dark;
  --background: #0b0b0b;
  --text: #e8e1d9;
  --accent: #b43b4d;
  --header-height: 56px;
}

* { box-sizing: border-box; }
html { background: var(--background); }
body {
  margin: 0;
  padding-top: calc(var(--header-height) + env(safe-area-inset-top));
  color: var(--text);
  background: var(--background);
  font-family: -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Malgun Gothic", sans-serif;
  -webkit-text-size-adjust: 100%;
}
a { color: inherit; text-decoration: none; }
a:focus-visible { outline: 2px solid var(--accent); outline-offset: 5px; }
[hidden] { display: none !important; }

.skip-link {
  position: fixed;
  top: -100px;
  left: 16px;
  z-index: 10;
  padding: 12px 18px;
  background: var(--background);
}
.skip-link:focus { top: 12px; }
.reading-progress {
  position: fixed;
  inset: 0 0 auto;
  height: 2px;
  z-index: 8;
  pointer-events: none;
}
.reading-progress span {
  display: block;
  height: 100%;
  background: var(--accent);
  transform: scaleX(0);
  transform-origin: left;
}
.reader-header {
  position: fixed;
  inset: 0 0 auto;
  z-index: 5;
  padding-top: env(safe-area-inset-top);
  background: var(--background);
  border-bottom: 1px solid #ffffff0b;
  transition: transform 180ms ease;
}
.reader-header.is-hidden { transform: translateY(-100%); }
.reader-header:focus-within { transform: translateY(0); }
.header-inner {
  height: var(--header-height);
  width: min(100%, 880px);
  margin: 0 auto;
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
h1 {
  margin: 0;
  font-family: "Iowan Old Style", "AppleMyungjo", "Batang", serif;
  font-size: 16px;
  font-weight: 400;
  letter-spacing: -0.025em;
  line-height: 1.4;
}
.placeholder { font-size: 12px; letter-spacing: 0.08em; padding: 0 2px; color: #ac9e9a; }
.edition { font: 9px/1.5 Georgia, serif; letter-spacing: 0.2em; color: #8e7e79; }
.webtoon {
  width: min(100%, 832px);
  margin: 0 auto;
  padding: 0;
  background: #fff;
  outline: none;
}
.webtoon img {
  display: block;
  width: 100%;
  height: auto;
  margin: 0;
  padding: 0;
  border: 0;
  color: #333;
  background: #fff;
}
.reader-footer {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 160px;
  padding: 48px 24px calc(48px + env(safe-area-inset-bottom));
}
.reread-link {
  display: inline-flex;
  align-items: center;
  gap: 14px;
  min-height: 44px;
  padding: 12px 21px;
  border: 1px solid #ffffff24;
  border-radius: 999px;
  font-size: 12px;
  color: #b8aca5;
}
.reread-link span { color: var(--accent); font-size: 18px; }
.reread-link:hover { color: var(--text); border-color: #ffffff50; }
.back-to-top {
  position: fixed;
  right: max(18px, calc((100vw - 940px) / 2));
  bottom: calc(22px + env(safe-area-inset-bottom));
  z-index: 4;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  color: #d4c8c0;
  background: #151313eb;
  border: 1px solid #ffffff26;
  border-radius: 50%;
}
.back-to-top:hover { color: #fff; border-color: var(--accent); }
@media (max-width: 480px) {
  :root { --header-height: 50px; }
  .header-inner { padding-inline: 18px; }
  h1 { font-size: 15px; }
  .edition { font-size: 8px; letter-spacing: 0.14em; }
  .back-to-top { right: 12px; bottom: calc(16px + env(safe-area-inset-bottom)); }
}
@media (prefers-reduced-motion: reduce) {
  .reader-header { transition: none; }
}
