/* 웹툰 바이블 <룻기> 1-5화 독자용 공용 스타일 */
:root, [data-theme="light"] {
  --bg: #f3f0e8;
  --surface: #fbf9f4;
  --line: #e3dccf;
  --line-strong: #cfc6b6;
  --text: #2b2621;
  --text-soft: #4a433b;
  --muted: #8c8378;
  --label: #7a6a58;
  --progress: #2b2621;
  --bar-bg: rgba(243, 240, 232, 0.92);
  --press: rgba(43, 38, 33, 0.06);
  --disabled: #c2b9ac;
  --btn-line: #d6cebf;
  --cta-bg: #2b2621;
  --cta-text: #f3f0e8;
  --toast-bg: #2b2621;
  --toast-text: #f3f0e8;
  --desk: #f3f0e8;
}
[data-theme="dark"] {
  --bg: #141312;
  --surface: #1c1b19;
  --line: #2b2926;
  --line-strong: #3a3733;
  --text: #ebe7e0;
  --text-soft: #cfc9bf;
  --muted: #8e8981;
  --label: #a9a297;
  --progress: #ebe7e0;
  --bar-bg: rgba(20, 19, 18, 0.90);
  --press: rgba(255, 255, 255, 0.06);
  --disabled: #4d4944;
  --btn-line: #3a3733;
  --cta-bg: #f3f0e8;
  --cta-text: #1b1815;
  --toast-bg: #f3f0e8;
  --toast-text: #1b1815;
  --desk: #0d0c0b;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #141312;
    --surface: #1c1b19;
    --line: #2b2926;
    --line-strong: #3a3733;
    --text: #ebe7e0;
    --text-soft: #cfc9bf;
    --muted: #8e8981;
    --label: #a9a297;
    --progress: #ebe7e0;
    --bar-bg: rgba(20, 19, 18, 0.90);
    --press: rgba(255, 255, 255, 0.06);
    --disabled: #4d4944;
    --btn-line: #3a3733;
    --cta-bg: #f3f0e8;
    --cta-text: #1b1815;
    --toast-bg: #f3f0e8;
    --toast-text: #1b1815;
    --desk: #0d0c0b;
  }
}

:root {
  --col: 690px;
  --bar: 52px;
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
}
@media (min-width: 760px) and (max-height: 860px) {
  :root {
    --col: 640px;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Noto Serif KR", "Nanum Myeongjo", "AppleMyungjo", Georgia, serif;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; }
button { font: inherit; color: inherit; }

/* Progress & Bars */
.progress {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  z-index: 30;
  pointer-events: none;
}
.progress i {
  display: block;
  height: 100%;
  width: 0;
  background: var(--progress);
}

.bar {
  position: fixed;
  left: 0;
  right: 0;
  z-index: 20;
  background: var(--bar-bg);
  -webkit-backdrop-filter: saturate(1.2) blur(12px);
  backdrop-filter: saturate(1.2) blur(12px);
  transition: transform 0.25s ease;
}
.top {
  top: 0;
  padding-top: var(--safe-t);
  border-bottom: 1px solid var(--line);
}
.bottom {
  bottom: 0;
  padding-bottom: var(--safe-b);
  border-top: 1px solid var(--line);
}
.bars-hidden .top { transform: translateY(-110%); }
.bars-hidden .bottom,
.bottom-off .bottom { transform: translateY(110%); }

.bar-in {
  max-width: var(--col);
  margin: 0 auto;
  height: var(--bar);
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 0 6px;
}
.ib {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 44px;
  height: 44px;
  padding: 0 10px;
  border: 0;
  background: none;
  border-radius: 8px;
  text-decoration: none;
  font-size: 14px;
  color: var(--text);
  cursor: pointer;
}
.ib:active { background: var(--press); }
.ib[aria-disabled="true"] {
  color: var(--disabled);
  pointer-events: none;
}
.ib--spacer { pointer-events: none; }

.t {
  flex: 1;
  min-width: 0;
  text-align: center;
  line-height: 1.2;
  cursor: pointer;
}
.t--static { cursor: default; }
.t b {
  display: block;
  font-size: 15px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.t span {
  display: block;
  font-size: 11px;
  color: var(--muted);
  margin-top: 2px;
  letter-spacing: 0.02em;
}
.bottom .bar-in { justify-content: space-between; }

/* Theme Toggle Icons */
.mode svg { display: block; }
.mode .icon-sun { display: none; }
.mode .icon-moon { display: block; }
[data-theme="dark"] .mode .icon-sun { display: block; }
[data-theme="dark"] .mode .icon-moon { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .mode .icon-sun { display: block; }
  :root:not([data-theme="light"]) .mode .icon-moon { display: none; }
}

/* Strip Column & Auto End Fade */
.col {
  max-width: var(--col);
  margin: calc(var(--bar) + var(--safe-t)) auto 0;
  background: var(--bg);
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}
.col img {
  display: block;
  width: 100%;
  height: auto;
  border: 0;
  background: transparent;
}

.end-fade {
  max-width: var(--col);
  margin: 0 auto;
  height: 0;
}
.end-fade[data-end-tone="dark"] {
  height: 140px;
  background: linear-gradient(to bottom, var(--strip-end) 0%, var(--bg) 100%);
}
[data-theme="dark"] .end-fade[data-end-tone="dark"] {
  height: 0;
  background: none;
  box-shadow: none;
}
[data-theme="dark"] .end-fade[data-end-tone="light"] {
  height: 140px;
  background: linear-gradient(to bottom, var(--strip-end) 0%, var(--bg) 100%);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .end-fade[data-end-tone="dark"] {
    height: 0;
    background: none;
    box-shadow: none;
  }
  :root:not([data-theme="light"]) .end-fade[data-end-tone="light"] {
    height: 140px;
    background: linear-gradient(to bottom, var(--strip-end) 0%, var(--bg) 100%);
  }
}

/* Episode End Area */
.end-wrap { background: var(--bg); }
.end {
  max-width: var(--col);
  margin: 0 auto;
  padding: 44px 22px calc(88px + var(--safe-b));
}
.fin {
  text-align: center;
  color: var(--muted);
  font-size: 12.5px;
  letter-spacing: 0.35em;
  margin: 0 0 36px;
}
.fin:before,
.fin:after {
  content: "";
  display: inline-block;
  width: 28px;
  height: 1px;
  background: var(--line-strong);
  vertical-align: middle;
  margin: 0 12px;
}

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 22px 20px;
  margin: 0 0 14px;
}
.btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 48px;
  margin-top: 16px;
  padding: 0 14px;
  border: 1px solid var(--btn-line);
  background: transparent;
  border-radius: 12px;
  font-size: 14.5px;
  cursor: pointer;
  text-decoration: none;
  color: var(--text);
}
.btn:active { background: var(--press); }
.btn--solid {
  background: var(--cta-bg);
  color: var(--cta-text);
  border-color: transparent;
  font-weight: 600;
}
.btn--solid:active { opacity: 0.9; }

.next {
  display: flex;
  gap: 16px;
  align-items: center;
  text-decoration: none;
  background: var(--cta-bg);
  color: var(--cta-text);
  border-radius: 16px;
  padding: 14px;
  margin: 0 0 14px;
}
.next-thumb {
  width: 76px;
  height: 95px;
  object-fit: cover;
  border-radius: 10px;
  flex: none;
  background: #2a2622;
}
.next-txt { min-width: 0; }
.next-txt small {
  display: block;
  font-size: 12px;
  opacity: 0.72;
  letter-spacing: 0.04em;
}
.next-txt b {
  display: block;
  font-size: 17px;
  line-height: 1.4;
  margin: 5px 0 6px;
  font-weight: 700;
  word-break: keep-all;
}
.next-txt span {
  display: block;
  font-size: 13px;
  line-height: 1.6;
  opacity: 0.82;
  word-break: keep-all;
}

.next-upcoming small {
  display: block;
  font-size: 12px;
  color: var(--label);
  letter-spacing: 0.03em;
  margin-bottom: 6px;
}
.next-upcoming b {
  display: block;
  font-size: 17.5px;
  line-height: 1.45;
  font-weight: 700;
  word-break: keep-all;
  margin-bottom: 8px;
}
.next-upcoming p {
  margin: 0;
  font-size: 14px;
  line-height: 1.65;
  color: var(--text-soft);
  word-break: keep-all;
}

.share-one { margin: 0 0 10px; }
.nav3 {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 8px;
  margin: 0 0 32px;
}
.nav3 .btn {
  margin: 0;
  font-size: 14px;
}
.nav3 .btn[aria-disabled="true"] {
  color: var(--disabled);
  border-color: var(--line);
  pointer-events: none;
}

/* Accordion & Think Block */
details {
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}
details + details { border-top: 0; }
summary {
  list-style: none;
  cursor: pointer;
  padding: 17px 2px;
  font-size: 14.5px;
  font-weight: 600;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
summary::-webkit-details-marker { display: none; }
summary:after {
  content: "+";
  color: var(--muted);
  font-size: 18px;
  line-height: 1;
  font-weight: 400;
}
details[open] summary:after { content: "−"; }

.acc {
  padding: 0 2px 18px;
  font-size: 14.5px;
  line-height: 1.95;
  color: var(--text-soft);
  white-space: pre-line;
  word-break: keep-all;
}
.acc .h {
  color: var(--label);
  font-size: 13px;
  margin: 0 0 8px;
}
.acc .fn {
  color: var(--muted);
  font-size: 13px;
  margin: 12px 0 0;
}
.acc.think { white-space: normal; }
.acc.think .note {
  margin: 0;
  font-size: 15px;
  line-height: 1.85;
  color: var(--text);
  word-break: keep-all;
}
.acc.think .q {
  margin: 18px 0 0;
  padding: 16px 0 0;
  border-top: 1px solid var(--line);
}
.acc.think .q small {
  display: block;
  font-size: 11.5px;
  color: var(--label);
  margin-bottom: 6px;
  letter-spacing: 0.04em;
}
.acc.think .q p {
  margin: 0;
  font-size: 16.5px;
  line-height: 1.75;
  font-weight: 600;
  color: var(--text);
  word-break: keep-all;
}
.acc.think .btn { margin-top: 18px; }

/* Channel Links & Copyright */
.links {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 4px 18px;
  margin-top: 30px;
  font-size: 12.5px;
}
.links a {
  color: var(--muted);
  text-decoration: none;
  padding: 6px 0;
}
.links a:hover { color: var(--text); }

.fine {
  margin: 26px 0 0;
  text-align: center;
  font-size: 11px;
  line-height: 1.7;
  color: var(--muted);
  opacity: 0.72;
}
.fine p { margin: 0; }
.fine-d,
.fine-d:last-of-type { border: 0; }
.fine-d summary {
  display: inline-block;
  padding: 4px 0;
  font-size: 11px;
  font-weight: 400;
  color: inherit;
  text-decoration: underline;
  text-underline-offset: 2px;
}
.fine-d summary:after { content: none; }
.fine-txt {
  margin: 6px auto 0;
  max-width: 32em;
  white-space: pre-line;
  word-break: keep-all;
}

.to-top {
  display: block;
  width: 100%;
  margin: 28px 0 0;
  padding: 14px 0;
  border: 0;
  border-top: 1px solid var(--line);
  background: none;
  color: var(--muted);
  font-size: 13px;
  letter-spacing: 0.08em;
  cursor: pointer;
}

/* Resume Pill & Toast */
.resume {
  position: fixed;
  left: 50%;
  top: calc(var(--bar) + var(--safe-t) + 12px);
  transform: translateX(-50%);
  z-index: 25;
  border: 0;
  border-radius: 999px;
  padding: 11px 18px;
  background: var(--toast-bg);
  color: var(--toast-text);
  font-size: 13.5px;
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.18);
  cursor: pointer;
  white-space: nowrap;
}
.toast {
  position: fixed;
  left: 50%;
  bottom: calc(72px + var(--safe-b));
  transform: translate(-50%, 16px);
  opacity: 0;
  background: var(--toast-bg);
  color: var(--toast-text);
  font-size: 13.5px;
  padding: 11px 16px;
  border-radius: 999px;
  z-index: 40;
  transition: 0.25s;
  pointer-events: none;
  white-space: nowrap;
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.18);
}
.toast.on {
  opacity: 1;
  transform: translate(-50%, 0);
}

/* TOC Page Layout */
.toc-wrap {
  max-width: var(--col);
  margin: calc(var(--bar) + var(--safe-t)) auto 0;
  padding: 24px 18px calc(64px + var(--safe-b));
}
.hero {
  display: flex;
  gap: 18px;
  align-items: center;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 18px;
  margin-bottom: 14px;
}
.hero-cover {
  width: 112px;
  height: 140px;
  object-fit: cover;
  border-radius: 10px;
  flex: none;
  border: 1px solid var(--line);
}
.hero-meta {
  min-width: 0;
  flex: 1;
}
.hero-eyebrow {
  margin: 0 0 6px;
  font-size: 11.5px;
  color: var(--label);
  letter-spacing: 0.04em;
}
.hero-title {
  margin: 0 0 8px;
  font-size: 22px;
  line-height: 1.3;
  font-weight: 700;
  word-break: keep-all;
}
.hero-subtitle {
  margin: 0 0 8px;
  font-size: 13.5px;
  line-height: 1.6;
  color: var(--text-soft);
  word-break: keep-all;
}
.hero-status {
  display: block;
  margin: 0 0 12px;
  font-size: 12px;
  color: var(--muted);
}
.hero .btn {
  margin-top: 0;
  min-height: 44px;
}

.resume-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  text-decoration: none;
  background: var(--cta-bg);
  color: var(--cta-text);
  border-radius: 16px;
  padding: 16px 18px;
  margin: 0 0 22px;
}
.resume-card[hidden] { display: none; }
.resume-label {
  font-size: 11.5px;
  opacity: 0.72;
  margin-bottom: 4px;
}
.resume-title {
  font-size: 16px;
  font-weight: 700;
  line-height: 1.4;
}
.resume-sub {
  font-size: 12.5px;
  opacity: 0.8;
  margin-top: 2px;
}
.resume-arrow {
  font-size: 13.5px;
  font-weight: 600;
  white-space: nowrap;
}

.chap-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin: 24px 2px 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--line);
}
.chap-head h2 {
  margin: 0;
  font-size: 15.5px;
  font-weight: 700;
}
.chap-head span {
  font-size: 12px;
  color: var(--muted);
}

.ep-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.ep-card {
  display: flex;
  gap: 14px;
  align-items: center;
  text-decoration: none;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 12px;
  transition: background-color 0.15s ease;
}
.ep-card:active { background: var(--press); }
.ep-thumb {
  width: 68px;
  height: 85px;
  object-fit: cover;
  border-radius: 8px;
  flex: none;
  border: 1px solid var(--line);
}
.ep-body {
  min-width: 0;
  flex: 1;
}
.ep-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 4px;
}
.ep-num {
  font-size: 12px;
  color: var(--label);
}
.read-badge {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid var(--line-strong);
  color: var(--label);
}
.read-badge[hidden] { display: none; }
.ep-title {
  margin: 0 0 4px;
  font-size: 16.5px;
  font-weight: 700;
  line-height: 1.35;
}
.ep-hook {
  margin: 0;
  font-size: 13px;
  line-height: 1.55;
  color: var(--text-soft);
  word-break: keep-all;
}

.toc-share { margin: 22px 0 0; }

@media (max-width: 480px) {
  .hero {
    flex-direction: column;
    align-items: stretch;
  }
  .hero-cover {
    width: 104px;
    height: 130px;
    margin: 0 auto;
  }
  .hero-meta { text-align: center; }
}
@media (min-width: 760px) {
  body { background: var(--desk); }
  .col { box-shadow: -1px 0 0 var(--line), 1px 0 0 var(--line); }
  .end-fade { box-shadow: -1px 0 0 var(--line), 1px 0 0 var(--line); }
}
@media (prefers-reduced-motion: reduce) {
  .bar,
  .toast { transition: none; }
}
