/* ═══════════ 옛길성경 — 스타일 (5역본) ═══════════ */
:root {
  --bg: #f6f1e6;
  --paper: #fffcf4;
  --ink: #1f1b16;
  --ink-2: #5d5446;
  --ink-3: #8d8270;
  --rule: #dcd1bc;
  --rule-2: #ebe3d3;
  --accent: #9a2a1c;
  --accent-ink: #fff;
  --vnum: #a0402e;
  --jesus: #c0201a;
  --hl-y: rgba(255, 214, 64, .42);
  --hl-g: rgba(120, 210, 120, .36);
  --hl-b: rgba(110, 175, 255, .34);
  --hl-p: rgba(255, 140, 190, .36);
  --sel: rgba(154, 42, 28, .10);
  --bar: rgba(255, 252, 244, .92);
  --shadow: 0 10px 30px rgba(40, 25, 10, .18);
  --fs: 17px;
  --lh: 1.8;
  --font: 'Noto Serif KR', 'Noto Serif', 'AppleMyungjo', 'Batang', serif;
  --font-en: 'Noto Serif', 'Noto Serif KR', Georgia, 'Times New Roman', serif;
  --ui: 'Noto Sans KR', -apple-system, 'Apple SD Gothic Neo', 'Malgun Gothic', sans-serif;
  --top: 52px;
  --verbar: 42px;
  --tab: 58px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
  color-scheme: light;
}
:root[data-theme="white"] { --bg: #ffffff; --paper: #ffffff; --rule: #e2e2e2; --rule-2: #efefef; --bar: rgba(255,255,255,.94); }
:root[data-theme="sepia"] { --bg: #efe3c8; --paper: #f6ebd2; --ink: #3a2c1a; --ink-2: #6a5638; --rule: #d3c09a; --rule-2: #e3d4b3; --bar: rgba(246,235,210,.94); }
:root[data-theme="dark"] {
  --bg: #121110; --paper: #181715; --ink: #e8e1d3; --ink-2: #b2a895; --ink-3: #7f7666;
  --rule: #34302a; --rule-2: #26231f; --accent: #e0826f; --vnum: #d98d76; --accent-ink: #1a1410;
  --jesus: #ff7d70;
  --hl-y: rgba(255, 214, 64, .25); --hl-g: rgba(120, 210, 120, .22); --hl-b: rgba(110, 175, 255, .24); --hl-p: rgba(255, 140, 190, .24);
  --sel: rgba(224, 130, 111, .14); --bar: rgba(24, 23, 21, .92); --shadow: 0 10px 30px rgba(0,0,0,.5);
  color-scheme: dark;
}
:root[data-font="sans"] {
  --font: 'Noto Sans KR', -apple-system, 'Apple SD Gothic Neo', 'Malgun Gothic', sans-serif;
  --font-en: 'Noto Sans KR', -apple-system, 'Segoe UI', sans-serif;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--ink); }
body { font-family: var(--ui); overscroll-behavior-y: none; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; padding: 0; }
input { font: inherit; color: inherit; }
[hidden] { display: none !important; }
.ico { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

/* ── 상단 바 ── */
.topbar {
  position: fixed; inset: 0 0 auto 0; z-index: 30;
  height: calc(var(--top) + var(--safe-t)); padding: var(--safe-t) 8px 0 14px;
  display: flex; align-items: center; justify-content: space-between;
  background: var(--bar); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--rule);
  transition: transform .25s ease;
}
.topbar.hide { transform: translateY(-100%); }
.tb-title { display: flex; align-items: center; gap: 6px; font-family: var(--font); font-weight: 700; font-size: 19px; color: var(--accent); padding: 8px 4px; }
.tb-chap { color: var(--ink); }
.caret { width: 18px; height: 18px; color: var(--ink-3); }
.tb-actions { display: flex; gap: 2px; }
.icon-btn { width: 44px; height: 44px; display: grid; place-items: center; border-radius: 12px; color: var(--ink-2); }
.icon-btn:active { background: var(--sel); }
.aa { font-family: var(--font); font-weight: 700; font-size: 18px; }
.aa small { font-size: 12px; }

/* ── 화면 공통 ── */
.view { min-height: 100%; padding: calc(var(--top) + var(--safe-t)) 0 calc(var(--tab) + var(--safe-b) + 24px); }

/* ── 역본 선택 바 ── */
.verbar {
  position: sticky; top: calc(var(--top) + var(--safe-t)); z-index: 15;
  background: var(--bar); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--rule-2);
  transition: top .25s ease;
}
.verbar-inner {
  max-width: 1180px; margin: 0 auto; padding: 6px 12px;
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
}
body[data-cols="1"] .verbar-inner, body[data-layout="stack"] .verbar-inner { max-width: 760px; }
body[data-cols="3"][data-layout="side"] .verbar-inner { max-width: 1360px; }
body[data-cols="4"][data-layout="side"] .verbar-inner { max-width: 1520px; }
body[data-cols="5"][data-layout="side"] .verbar-inner { max-width: 1680px; }

.ver-pills { display: flex; align-items: center; gap: 5px; overflow-x: auto; scrollbar-width: none; }
.ver-pills::-webkit-scrollbar { display: none; }
.ver-pills button {
  flex: none; padding: 4px 11px; border-radius: 999px;
  font-size: 12.5px; font-weight: 500; color: var(--ink-3);
  border: 1px solid var(--rule); background: transparent;
  transition: background .15s, color .15s, border-color .15s;
}
.ver-pills button.on {
  background: var(--paper); color: var(--accent); border-color: var(--accent);
  font-weight: 700; box-shadow: 0 1px 3px rgba(0,0,0,.07);
}
.ver-pills button:active { background: var(--sel); }
.layout-toggle {
  flex: none; padding: 4px 10px; border-radius: 8px;
  font-size: 12px; font-weight: 700; color: var(--ink-2);
  border: 1px solid var(--rule); background: var(--bg);
  white-space: nowrap;
}
.layout-toggle:active { background: var(--sel); }

/* ── 열 머리 ── */
.colhead {
  position: sticky; top: calc(var(--top) + var(--safe-t) + var(--verbar)); z-index: 5;
  display: grid; grid-template-columns: repeat(var(--cols, 2), minmax(0, 1fr));
  max-width: 1180px; margin: 0 auto;
  font-size: 11.5px; font-weight: 700; letter-spacing: .08em; color: var(--ink-3);
  background: var(--bg); border-bottom: 1px solid var(--rule-2);
  transition: top .25s ease;
}
.colhead span { padding: 7px 14px 6px; min-width: 0; }
.colhead span + span { border-left: 1px solid var(--rule); }
body[data-layout="stack"] .colhead, body[data-cols="1"] .colhead { display: none; }
body[data-cols="3"][data-layout="side"] .colhead { max-width: 1360px; }
body[data-cols="4"][data-layout="side"] .colhead { max-width: 1520px; }
body[data-cols="5"][data-layout="side"] .colhead { max-width: 1680px; }

/* ── 본문 ── */
.reader {
  max-width: 1180px; margin: 0 auto; background: var(--paper);
  font-family: var(--font); font-size: var(--fs); line-height: var(--lh); color: var(--ink);
  padding: 10px 0 30px; min-height: 70vh;
  border-left: 1px solid var(--rule-2); border-right: 1px solid var(--rule-2);
}
body[data-cols="1"] .reader, body[data-layout="stack"] .reader { max-width: 760px; }
body[data-cols="3"][data-layout="side"] .reader { max-width: 1360px; font-size: calc(var(--fs) * .94); }
body[data-cols="4"][data-layout="side"] .reader { max-width: 1520px; font-size: calc(var(--fs) * .88); }
body[data-cols="5"][data-layout="side"] .reader { max-width: 1680px; font-size: calc(var(--fs) * .83); }

.book-banner {
  text-align: center; font-weight: 700; letter-spacing: .3em;
  color: var(--accent); font-size: calc(var(--fs) * .85); padding: 14px 12px 6px;
}
.book-banner small {
  display: block; font-family: var(--font-en); font-weight: 600;
  letter-spacing: .16em; font-size: .72em; color: var(--ink-3); margin-top: 2px;
}

.row { display: grid; grid-template-columns: repeat(var(--cols, 2), minmax(0, 1fr)); }
.row > .cell { padding: 0 18px; min-width: 0; }
.row > .cell + .cell { border-left: 1px solid var(--rule); }
.row.para > .cell { padding-top: .45em; }

/* 시편 표제 */
.row.drow > .cell { padding-top: .3em; padding-bottom: .45em; }
.psalm-d {
  font-family: var(--font); font-size: .84em; line-height: 1.55;
  color: var(--ink-2); font-style: italic; text-align: center;
}

.cell[lang="en"] { font-family: var(--font-en); }
.cell[lang="en"] .verse { text-align: left; overflow-wrap: break-word; word-break: normal; }

.verse { position: relative; text-align: justify; word-break: normal; overflow-wrap: anywhere; border-radius: 4px; padding: 1px 3px; margin: 0 -3px; transition: background .15s; }
.verse .vn { font-family: var(--ui); font-weight: 700; font-size: .62em; color: var(--vnum); margin-right: .28em; vertical-align: .32em; letter-spacing: -.02em; user-select: none; }
.verse.sel { background: var(--sel); box-shadow: inset 2px 0 0 var(--accent); }
.verse.hl-y { background: var(--hl-y); } .verse.hl-g { background: var(--hl-g); } .verse.hl-b { background: var(--hl-b); } .verse.hl-p { background: var(--hl-p); }
.verse.flash { animation: flash 1.8s ease; }
@keyframes flash { 0%,40% { background: var(--hl-y); } 100% { background: transparent; } }
.verse .bm { display: inline-block; width: 7px; height: 11px; background: var(--accent); clip-path: polygon(0 0,100% 0,100% 100%,50% 72%,0 100%); margin-left: 4px; vertical-align: .1em; }
.verse.empty { color: var(--ink-3); font-size: .82em; }

/* 인라인 역본 배지 */
.vtag {
  display: none; font-family: var(--ui); font-size: 10.5px; font-weight: 700;
  letter-spacing: .04em; color: var(--ink-3); margin-right: 6px;
  vertical-align: .08em; user-select: none;
}

/* 예수님 말씀 색 */
body.c-jesus .sp1 { color: var(--jesus); }

/* 소제목 */
.head { font-family: var(--font); font-weight: 700; font-size: .92em; color: var(--accent); line-height: 1.45; margin: 1.05em 0 .35em; text-align: center; }
.head .refs { display: block; font-family: var(--ui); font-weight: 500; font-size: .74em; color: var(--ink-3); margin-top: 2px; }
body:not(.show-head) .head { display: none; }

/* 장 번호 (큰 숫자 dropcap) */
.dropcap { float: left; font-family: var(--font); font-weight: 700; color: var(--accent); font-size: 3.15em; line-height: .9; margin: .06em .14em -.05em 0; }
.verse.first .vn { display: none; }

/* 각주 표시 */
.fn { font-family: var(--ui); font-size: .6em; font-weight: 700; color: var(--accent); vertical-align: .55em; padding: 0 2px; cursor: pointer; font-style: italic; }
body:not(.show-notes) .fn { display: none; }
.xref { color: var(--accent); text-decoration: none; border-bottom: 1px dotted currentColor; cursor: pointer; white-space: nowrap; }

/* 장 끝 각주 목록 */
.notes { margin: 26px 18px 0; padding-top: 10px; border-top: 2px solid var(--rule); font-family: var(--ui); font-size: max(12.5px, calc(var(--fs) * .74)); line-height: 1.65; color: var(--ink-2); }
.notes-grp { margin-bottom: 14px; columns: 2 260px; column-gap: 28px; }
.notes-grp:last-child { margin-bottom: 0; }
.notes-grp h4 { margin: 0 0 6px; font-size: 12px; letter-spacing: .12em; color: var(--ink-3); column-span: all; }
.notes-grp p { margin: 0 0 3px; break-inside: avoid; }
.notes-grp b { color: var(--accent); font-weight: 700; margin-right: 4px; }
.notes-grp i { color: var(--accent); font-weight: 700; margin-right: 4px; font-style: normal; }
body:not(.show-notes) .notes { display: none; }

.chap-nav { display: flex; justify-content: space-between; gap: 12px; margin: 26px 18px 0; font-family: var(--ui); }
.chap-nav button { flex: 1; padding: 13px 10px; border-radius: 12px; border: 1px solid var(--rule); background: var(--bg); color: var(--ink-2); font-size: 14px; }
.chap-nav button:active { background: var(--sel); }
.chap-nav button:disabled { opacity: .4; cursor: default; }

/* ── 보기 방식: 위아래 (stack) 및 단일 역본 ── */
body[data-layout="stack"] .row,
body[data-cols="1"] .row { grid-template-columns: 1fr; max-width: 760px; margin: 0 auto; }
body[data-layout="stack"] .row > .cell + .cell,
body[data-cols="1"] .row > .cell + .cell { border-left: 0; }
body[data-layout="stack"]:not([data-cols="1"]) .row { padding-bottom: .32em; }
body[data-layout="stack"]:not([data-cols="1"]) .row > .cell:not(:first-child) {
  font-size: .92em; color: var(--ink-2); padding-top: .18em; padding-bottom: .18em;
}
body[data-layout="stack"]:not([data-cols="1"]) .row > .cell:not(:first-child) .verse {
  padding-left: .85em; border-left: 2px solid var(--rule); margin-left: 2px; border-radius: 0;
}
body[data-layout="stack"]:not([data-cols="1"]) .row > .cell:not(:first-child) .vn,
body[data-layout="stack"]:not([data-cols="1"]) .row > .cell:not(:first-child) .dropcap,
body[data-layout="stack"]:not([data-cols="1"]) .row > .cell:not(:first-child) .head,
body[data-layout="stack"]:not([data-cols="1"]) .row > .cell:not(:first-child) .psalm-d { display: none; }
body[data-layout="stack"]:not([data-cols="1"]) .row > .cell:not(:first-child) .vtag { display: inline; }
body[data-layout="stack"]:not([data-cols="1"]) .row.hrow,
body[data-layout="stack"]:not([data-cols="1"]) .row.drow { padding-bottom: 0; }

/* 좌우 넘김 화살표 (PC) */
.navarrow { position: fixed; top: 50%; z-index: 10; width: 42px; height: 64px; display: grid; place-items: center; color: var(--ink-3); background: var(--bar); border: 1px solid var(--rule); border-radius: 12px; opacity: .55; transform: translateY(-50%); }
.navarrow:hover { opacity: 1; }
.navarrow.prev { left: 8px; } .navarrow.next { right: 8px; }
@media (max-width: 1279px) { .navarrow { display: none; } }
@media (max-width: 1599px) {
  body[data-layout="side"][data-cols="3"] .navarrow,
  body[data-layout="side"][data-cols="4"] .navarrow,
  body[data-layout="side"][data-cols="5"] .navarrow { display: none; }
}

/* ── 하단 탭 ── */
.tabbar { position: fixed; inset: auto 0 0 0; z-index: 30; height: calc(var(--tab) + var(--safe-b)); padding-bottom: var(--safe-b); display: flex; background: var(--bar); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); border-top: 1px solid var(--rule); transition: transform .25s ease; }
.tabbar.hide { transform: translateY(100%); }
.tabbar button { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; font-size: 11px; color: var(--ink-3); }
.tabbar button.on { color: var(--accent); font-weight: 700; }

/* ── 시트 공통 ── */
.sheet, .pop { position: fixed; inset: 0; z-index: 60; }
.sheet-backdrop, .pop-backdrop { position: absolute; inset: 0; background: rgba(20, 12, 4, .38); animation: fade .2s; }
.sheet-panel { position: absolute; left: 0; right: 0; bottom: 0; max-height: 86vh; overflow: auto; background: var(--paper); border-radius: 20px 20px 0 0; padding: 6px 18px calc(22px + var(--safe-b)); box-shadow: var(--shadow); animation: up .24s ease; max-width: 720px; margin: 0 auto; }
.sheet-panel.tall { height: 86vh; display: flex; flex-direction: column; }
.sheet-grip { width: 40px; height: 4px; border-radius: 4px; background: var(--rule); margin: 4px auto 12px; }
@keyframes up { from { transform: translateY(40px); opacity: 0; } }
@keyframes fade { from { opacity: 0; } }
.close-x { margin-left: auto; width: 38px; height: 38px; border-radius: 10px; color: var(--ink-3); font-size: 16px; }

/* 책·장 선택 */
.picker-tabs { display: flex; gap: 6px; align-items: center; margin-bottom: 10px; }
.picker-tabs button:not(.close-x) { padding: 8px 18px; border-radius: 999px; font-weight: 700; color: var(--ink-3); }
.picker-tabs button.on { background: var(--accent); color: var(--accent-ink); }
.picker-body { overflow: auto; flex: 1; padding-bottom: 10px; }
.book-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 7px; }
.book-grid button { padding: 10px 4px; border-radius: 12px; background: var(--bg); border: 1px solid var(--rule-2); font-size: 14.5px; font-weight: 500; line-height: 1.25; }
.book-grid button small { display: block; font-size: 11px; color: var(--ink-3); font-weight: 400; margin-top: 2px; }
.book-grid button.cur { border-color: var(--accent); color: var(--accent); font-weight: 700; }
.group-label { grid-column: 1 / -1; font-size: 11.5px; letter-spacing: .1em; color: var(--ink-3); margin: 8px 2px 0; font-weight: 700; }
.chap-title { display: flex; align-items: center; gap: 10px; margin: 2px 0 12px; font-family: var(--font); font-size: 20px; font-weight: 700; color: var(--accent); }
.chap-title small { font-family: var(--font-en); font-size: 14px; font-weight: 500; color: var(--ink-3); }
.chap-title button { font-family: var(--ui); font-size: 13px; color: var(--ink-3); padding: 6px 10px; border-radius: 8px; border: 1px solid var(--rule); font-weight: 500; }
.chap-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(52px, 1fr)); gap: 7px; }
.chap-grid button { aspect-ratio: 1.15; border-radius: 12px; background: var(--bg); border: 1px solid var(--rule-2); font-size: 16px; font-weight: 500; }
.chap-grid button.cur { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }

/* 설정 */
.set-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--rule-2); }
.set-row.col { flex-direction: column; align-items: stretch; }
.set-row > label { font-size: 14px; font-weight: 700; color: var(--ink-2); white-space: nowrap; }
.set-row > label .sub-lab { font-weight: 400; font-size: 12px; color: var(--ink-3); margin-left: 4px; }
.ver-checks { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.ver-checks button {
  flex: 1 1 88px; padding: 9px 8px; border-radius: 11px; border: 1px solid var(--rule);
  background: var(--bg); font-size: 13.5px; font-weight: 500; color: var(--ink-2);
  transition: .15s; white-space: nowrap;
}
.ver-checks button.on {
  background: var(--accent); color: var(--accent-ink); border-color: var(--accent); font-weight: 700;
}
.seg { display: inline-flex; background: var(--bg); border: 1px solid var(--rule-2); border-radius: 12px; padding: 3px; gap: 2px; flex-wrap: wrap; }
.seg button { padding: 7px 11px; border-radius: 9px; font-size: 13.5px; color: var(--ink-2); }
.seg button.on { background: var(--paper); color: var(--accent); font-weight: 700; box-shadow: 0 1px 3px rgba(0,0,0,.12); }
.seg.small { margin: 8px 0 6px; align-self: flex-start; }
.search-filters { display: flex; flex-wrap: wrap; gap: 4px 8px; align-items: center; }
.stepper { display: flex; align-items: center; gap: 4px; background: var(--bg); border: 1px solid var(--rule-2); border-radius: 12px; padding: 3px; }
.stepper button { width: 52px; height: 34px; border-radius: 9px; font-family: var(--font); font-weight: 700; }
.stepper button:active { background: var(--sel); }
.stepper output { min-width: 34px; text-align: center; font-weight: 700; }
.toggles { display: flex; flex-wrap: wrap; gap: 8px 18px; margin-top: 8px; }
.tg { display: flex; align-items: center; gap: 8px; font-size: 14px; cursor: pointer; }
.tg input { display: none; }
.tg .sw { width: 38px; height: 22px; border-radius: 22px; background: var(--rule); position: relative; transition: .2s; flex: none; }
.tg .sw::after { content: ''; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: .2s; box-shadow: 0 1px 2px rgba(0,0,0,.3); }
.tg input:checked + .sw { background: var(--accent); }
.tg input:checked + .sw::after { left: 19px; }
.lg { font-family: var(--font); font-weight: 600; }
.lg.jesus { color: var(--jesus); }
.wide-btn { margin-top: 8px; padding: 12px; border-radius: 12px; border: 1px solid var(--rule); background: var(--bg); font-weight: 700; color: var(--accent); }
.progress { margin-top: 8px; height: 22px; border-radius: 11px; background: var(--rule-2); position: relative; overflow: hidden; }
.progress i { position: absolute; inset: 0 auto 0 0; width: 0; background: var(--accent); transition: width .2s; }
.progress span { position: relative; display: block; text-align: center; font-size: 12px; line-height: 22px; font-weight: 700; mix-blend-mode: difference; color: #fff; }
.hint { margin: 8px 0 0; font-size: 12.5px; line-height: 1.6; color: var(--ink-3); }

/* 검색 */
.search-bar { display: flex; gap: 8px; }
.search-bar input { flex: 1; min-width: 0; padding: 12px 14px; border-radius: 12px; border: 1px solid var(--rule); background: var(--bg); font-size: 16px; }
.search-bar button, .hymn-search button { padding: 0 18px; border-radius: 12px; background: var(--accent); color: var(--accent-ink); font-weight: 700; }
.search-results { overflow: auto; flex: 1; }
.sr-info { font-size: 13px; color: var(--ink-3); padding: 6px 2px 8px; }
.sr { display: block; width: 100%; text-align: left; padding: 11px 4px; border-bottom: 1px solid var(--rule-2); font-family: var(--font); font-size: 15px; line-height: 1.65; }
.sr b.ref { font-family: var(--ui); font-size: 12.5px; color: var(--accent); display: block; margin-bottom: 2px; }
.sr .ver { font-family: var(--ui); font-size: 11px; color: var(--ink-3); margin-right: 6px; font-weight: 700; }
.sr .sr-en { font-family: var(--font-en); }
.sr mark { background: var(--hl-y); color: inherit; border-radius: 3px; padding: 0 1px; }

/* 절 액션바 */
.verse-bar { position: fixed; z-index: 40; left: 50%; transform: translateX(-50%); bottom: calc(var(--tab) + var(--safe-b) + 10px); display: flex; align-items: center; gap: 8px; padding: 8px 10px 8px 14px; background: var(--paper); border: 1px solid var(--rule); border-radius: 16px; box-shadow: var(--shadow); max-width: calc(100vw - 16px); flex-wrap: wrap; justify-content: center; animation: up .2s ease; }
.vb-ref { font-weight: 700; color: var(--accent); font-size: 14px; }
.vb-hl { display: flex; gap: 5px; }
.vb-hl button { width: 26px; height: 26px; border-radius: 50%; border: 1px solid var(--rule); font-size: 11px; color: var(--ink-3); }
.vb-hl [data-hl="y"] { background: #ffd640; } .vb-hl [data-hl="g"] { background: #86d686; } .vb-hl [data-hl="b"] { background: #79b4ff; } .vb-hl [data-hl="p"] { background: #ff97c6; }
.vb-btn { padding: 7px 12px; border-radius: 10px; background: var(--bg); border: 1px solid var(--rule-2); font-size: 13.5px; font-weight: 700; }
.vb-btn.ghost { border-color: transparent; background: none; color: var(--ink-3); }

/* 관주·각주 팝오버 */
.pop-card { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); width: min(560px, calc(100vw - 24px)); max-height: 72vh; display: flex; flex-direction: column; background: var(--paper); border-radius: 18px; box-shadow: var(--shadow); animation: fade .18s; }
.pop-head { display: flex; align-items: center; padding: 12px 10px 6px 18px; font-family: var(--font); color: var(--accent); font-size: 17px; }
.pop-body { overflow: auto; padding: 4px 18px 10px; font-family: var(--font); font-size: calc(var(--fs) * .92); line-height: 1.75; }
.pop-body .pv { margin: 0 0 10px; }
.pop-body .pv[lang="en"] { font-family: var(--font-en); }
.pop-body .pv .tag { font-family: var(--ui); font-size: 11px; font-weight: 700; color: var(--ink-3); letter-spacing: .08em; display: block; }
.pop-body .pv .vn { font-family: var(--ui); font-weight: 700; font-size: .66em; color: var(--vnum); margin-right: 3px; vertical-align: .3em; }
.pop-body .note-txt { font-family: var(--ui); font-size: 15px; }
.pop-foot { padding: 8px 18px 16px; display: flex; gap: 8px; justify-content: flex-end; }
.pop-foot button { padding: 10px 16px; border-radius: 12px; background: var(--accent); color: var(--accent-ink); font-weight: 700; font-size: 14px; }

/* ── 찬송가 ── */
.hymn-head { position: sticky; top: calc(var(--top) + var(--safe-t)); z-index: 5; background: var(--bg); padding: 12px 16px 8px; max-width: 900px; margin: 0 auto; }
.hymn-search { display: flex; gap: 8px; }
.hymn-search input { flex: 1; min-width: 0; padding: 13px 14px; border-radius: 12px; border: 1px solid var(--rule); background: var(--paper); font-size: 18px; font-weight: 700; }
.chips { display: flex; gap: 6px; overflow-x: auto; padding: 10px 0 2px; scrollbar-width: none; }
.chips:empty { display: none; }
.chips .lab { font-size: 12px; color: var(--ink-3); align-self: center; white-space: nowrap; font-weight: 700; }
.chips button { flex: none; padding: 6px 12px; border-radius: 999px; border: 1px solid var(--rule); background: var(--paper); font-size: 13.5px; font-weight: 500; }
.chips button.fav { border-color: var(--accent); color: var(--accent); }
.hymn-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); column-gap: 18px; padding: 4px 16px 20px; max-width: 980px; margin: 0 auto; }
.hymn-grid .hy { display: flex; align-items: baseline; gap: 12px; padding: 12px 6px; text-align: left; border-bottom: 1px solid var(--rule-2); font-family: var(--font); font-size: 16.5px; line-height: 1.4; min-width: 0; }
.hymn-grid .hy b { flex: none; width: 2.6em; text-align: right; font-family: var(--ui); font-size: 14px; color: var(--accent); font-variant-numeric: tabular-nums; }
.hymn-grid .hy span { flex: 1; min-width: 0; }
.hymn-grid .hy i { font-style: normal; color: #d9a521; font-size: 13px; }
.hymn-grid .hy mark { background: var(--hl-y); color: inherit; border-radius: 3px; }
.hymn-grid .hy:active { background: var(--sel); }
.hymn-grid .grp { grid-column: 1 / -1; font-size: 12px; letter-spacing: .1em; color: var(--ink-3); font-weight: 700; margin-top: 6px; }

.hymn-viewer { position: fixed; inset: 0; z-index: 70; background: #fff; display: flex; flex-direction: column; color: #222; }
:root[data-theme="dark"] .hymn-viewer { background: #e9e6df; }
.hv-bar { display: flex; align-items: center; justify-content: space-between; padding: calc(var(--safe-t) + 4px) 6px 4px; background: #7a1f17; color: #fff; }
.hv-bar .icon-btn { color: #fff; }
.hv-bar b { font-size: 17px; font-family: var(--font); flex: 1; min-width: 0; text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#hvFav.on .ico { fill: #ffd24a; stroke: #ffd24a; }
.hv-stage { flex: 1; min-height: 0; overflow: auto; display: flex; justify-content: safe center; touch-action: pan-x pan-y; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; }
.hv-stage img { display: block; margin: auto; width: calc(min(100%, 960px) * var(--z, 1)); max-width: none; height: auto; flex: none; user-select: none; -webkit-user-drag: none; }
.hv-foot { display: flex; align-items: center; justify-content: space-between; padding: 6px 8px calc(6px + var(--safe-b)); background: #f3eee4; border-top: 1px solid #ddd2bd; }
.hv-nav { padding: 10px 16px; border-radius: 10px; font-weight: 700; color: #7a1f17; }
.hv-hint { font-size: 12px; color: #8a7f6c; text-align: center; }
@media (orientation: landscape) and (max-height: 520px) { .hv-hint { display: none; } .hv-foot { padding-top: 2px; padding-bottom: 2px; } }

/* 책갈피 목록 */
.list-wrap { max-width: 760px; margin: 0 auto; padding: 8px 16px; }
.sec-title { font-size: 13px; letter-spacing: .14em; color: var(--ink-3); margin: 18px 2px 8px; }
.mk { display: flex; align-items: flex-start; gap: 10px; padding: 12px 4px; border-bottom: 1px solid var(--rule-2); }
.mk .go { flex: 1; text-align: left; font-family: var(--font); font-size: 15px; line-height: 1.6; }
.mk .go b { display: block; font-family: var(--ui); font-size: 13px; color: var(--accent); }
.mk .go .sw-c { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 6px; vertical-align: 0; }
.mk .del { color: var(--ink-3); padding: 6px 8px; font-size: 13px; }
.empty-msg { color: var(--ink-3); font-size: 14px; padding: 8px 2px; }

/* 토스트 */
.toast { position: fixed; left: 50%; bottom: calc(var(--tab) + var(--safe-b) + 76px); transform: translateX(-50%); z-index: 90; background: rgba(30,24,18,.9); color: #fff; padding: 10px 18px; border-radius: 999px; font-size: 14px; animation: fade .2s; white-space: nowrap; max-width: calc(100vw - 24px); overflow: hidden; text-overflow: ellipsis; }

/* ── 반응형 ── */
@media (min-width: 1200px) {
  body[data-layout="side"][data-cols="5"] .row > .cell,
  body[data-layout="side"][data-cols="5"] .colhead span { padding-left: 13px; padding-right: 13px; }
  body[data-layout="side"][data-cols="5"] .dropcap { font-size: 2.7em; }
}
@media (min-width: 1024px) {
  body[data-layout="side"][data-cols="4"] .row > .cell,
  body[data-layout="side"][data-cols="4"] .colhead span { padding-left: 16px; padding-right: 16px; }
  body[data-layout="side"][data-cols="3"] .row > .cell,
  body[data-layout="side"][data-cols="3"] .colhead span { padding-left: 22px; padding-right: 22px; }
}
@media (min-width: 900px) {
  body[data-cols="1"] .row > .cell,
  body[data-cols="2"] .row > .cell,
  body[data-layout="stack"] .row > .cell { padding: 0 34px; }
  body[data-cols="2"] .colhead span { padding: 8px 34px 7px; }
  .notes { margin: 30px 34px 0; }
}

/* 태블릿·소형 노트북: 3~4역본(640~1023px) / 5역본(640~1199px) → 2열 카드형 대조 */
@media (min-width: 640px) and (max-width: 1023px) {
  body[data-layout="side"][data-cols="3"] .colhead,
  body[data-layout="side"][data-cols="4"] .colhead { display: none; }
  body[data-layout="side"][data-cols="3"] .reader,
  body[data-layout="side"][data-cols="4"] .reader { max-width: 1024px; font-size: calc(var(--fs) * .94); }
  body[data-layout="side"][data-cols="3"] .row,
  body[data-layout="side"][data-cols="4"] .row { grid-template-columns: 1fr 1fr; border-bottom: 1px solid var(--rule-2); padding: .35em 0 .5em; }
  body[data-layout="side"][data-cols="3"] .row.hrow,
  body[data-layout="side"][data-cols="4"] .row.hrow,
  body[data-layout="side"][data-cols="3"] .row.drow,
  body[data-layout="side"][data-cols="4"] .row.drow { border-bottom: 0; padding: 0; }
  body[data-layout="side"][data-cols="3"] .row > .cell,
  body[data-layout="side"][data-cols="4"] .row > .cell { border-left: 0; padding: .2em 16px; }
  body[data-layout="side"][data-cols="3"] .row > .cell:nth-child(2n),
  body[data-layout="side"][data-cols="4"] .row > .cell:nth-child(2n) { border-left: 1px solid var(--rule); }
  body[data-layout="side"][data-cols="3"] .row > .cell:nth-child(n+3),
  body[data-layout="side"][data-cols="4"] .row > .cell:nth-child(n+3) { border-top: 1px dashed var(--rule-2); padding-top: .4em; margin-top: .25em; }
  body[data-layout="side"][data-cols="3"] .row > .cell .vtag,
  body[data-layout="side"][data-cols="4"] .row > .cell .vtag { display: inline; }
  body[data-layout="side"][data-cols="3"] .row > .cell:not(:first-child) .dropcap,
  body[data-layout="side"][data-cols="4"] .row > .cell:not(:first-child) .dropcap { display: none; }
  body[data-layout="side"][data-cols="3"] .row > .cell:not(:first-child) .verse.first .vn,
  body[data-layout="side"][data-cols="4"] .row > .cell:not(:first-child) .verse.first .vn { display: inline; }
}
@media (min-width: 640px) and (max-width: 1199px) {
  body[data-layout="side"][data-cols="5"] .colhead { display: none; }
  body[data-layout="side"][data-cols="5"] .reader { max-width: 1080px; font-size: calc(var(--fs) * .93); }
  body[data-layout="side"][data-cols="5"] .row { grid-template-columns: 1fr 1fr; border-bottom: 1px solid var(--rule-2); padding: .35em 0 .5em; }
  body[data-layout="side"][data-cols="5"] .row.hrow,
  body[data-layout="side"][data-cols="5"] .row.drow { border-bottom: 0; padding: 0; }
  body[data-layout="side"][data-cols="5"] .row > .cell { border-left: 0; padding: .2em 16px; }
  body[data-layout="side"][data-cols="5"] .row > .cell:nth-child(2n) { border-left: 1px solid var(--rule); }
  body[data-layout="side"][data-cols="5"] .row > .cell:nth-child(n+3) { border-top: 1px dashed var(--rule-2); padding-top: .4em; margin-top: .25em; }
  body[data-layout="side"][data-cols="5"] .row > .cell .vtag { display: inline; }
  body[data-layout="side"][data-cols="5"] .row > .cell:not(:first-child) .dropcap { display: none; }
  body[data-layout="side"][data-cols="5"] .row > .cell:not(:first-child) .verse.first .vn { display: inline; }
}

/* 모바일(<=639px)에서 3~5역본 나란히 → 자동 위아래 대조 */
@media (max-width: 639px) {
  body[data-layout="side"][data-cols="3"] .colhead,
  body[data-layout="side"][data-cols="4"] .colhead,
  body[data-layout="side"][data-cols="5"] .colhead { display: none; }
  body[data-layout="side"][data-cols="3"] .reader,
  body[data-layout="side"][data-cols="4"] .reader,
  body[data-layout="side"][data-cols="5"] .reader { font-size: var(--fs); }
  body[data-layout="side"][data-cols="3"] .row,
  body[data-layout="side"][data-cols="4"] .row,
  body[data-layout="side"][data-cols="5"] .row { grid-template-columns: 1fr; padding-bottom: .35em; }
  body[data-layout="side"][data-cols="3"] .row > .cell + .cell,
  body[data-layout="side"][data-cols="4"] .row > .cell + .cell,
  body[data-layout="side"][data-cols="5"] .row > .cell + .cell { border-left: 0; }
  body[data-layout="side"][data-cols="3"] .row > .cell:not(:first-child),
  body[data-layout="side"][data-cols="4"] .row > .cell:not(:first-child),
  body[data-layout="side"][data-cols="5"] .row > .cell:not(:first-child) {
    font-size: .92em; color: var(--ink-2); padding-top: .16em; padding-bottom: .16em;
  }
  body[data-layout="side"][data-cols="3"] .row > .cell:not(:first-child) .verse,
  body[data-layout="side"][data-cols="4"] .row > .cell:not(:first-child) .verse,
  body[data-layout="side"][data-cols="5"] .row > .cell:not(:first-child) .verse {
    padding-left: .8em; border-left: 2px solid var(--rule); margin-left: 2px; border-radius: 0;
  }
  body[data-layout="side"][data-cols="3"] .row > .cell:not(:first-child) .vn,
  body[data-layout="side"][data-cols="4"] .row > .cell:not(:first-child) .vn,
  body[data-layout="side"][data-cols="5"] .row > .cell:not(:first-child) .vn,
  body[data-layout="side"][data-cols="3"] .row > .cell:not(:first-child) .dropcap,
  body[data-layout="side"][data-cols="4"] .row > .cell:not(:first-child) .dropcap,
  body[data-layout="side"][data-cols="5"] .row > .cell:not(:first-child) .dropcap,
  body[data-layout="side"][data-cols="3"] .row > .cell:not(:first-child) .head,
  body[data-layout="side"][data-cols="4"] .row > .cell:not(:first-child) .head,
  body[data-layout="side"][data-cols="5"] .row > .cell:not(:first-child) .head,
  body[data-layout="side"][data-cols="3"] .row > .cell:not(:first-child) .psalm-d,
  body[data-layout="side"][data-cols="4"] .row > .cell:not(:first-child) .psalm-d,
  body[data-layout="side"][data-cols="5"] .row > .cell:not(:first-child) .psalm-d { display: none; }
  body[data-layout="side"][data-cols="3"] .row > .cell:not(:first-child) .vtag,
  body[data-layout="side"][data-cols="4"] .row > .cell:not(:first-child) .vtag,
  body[data-layout="side"][data-cols="5"] .row > .cell:not(:first-child) .vtag { display: inline; }
}

@media (max-width: 599px) {
  .row > .cell { padding: 0 10px; }
  .colhead span { padding: 6px 10px 5px; }
  .notes { margin: 22px 12px 0; }
  .reader { border: 0; }
  body[data-layout="side"][data-cols="2"] .verse { text-align: left; }
  body[data-layout="side"][data-cols="2"] .dropcap { font-size: 2.6em; }
}

@media print {
  .topbar, .verbar, .tabbar, .navarrow, .chap-nav, .colhead { display: none !important; }
  .view { padding: 0; }
}

/* ═══════════ 시작 화면 (옛길성경) ═══════════ */
#splash {
  position: fixed; inset: 0; z-index: 200;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: var(--safe-t) 24px var(--safe-b);
  background: var(--bg);
  background-image: radial-gradient(ellipse 70% 55% at 50% 44%, var(--paper) 0%, transparent 70%);
  color: var(--ink);
  transition: opacity .6s ease, visibility .6s;
}
#splash.out { opacity: 0; visibility: hidden; }
#splash.out .sp-inner { transform: translateY(-8px) scale(.985); }
.sp-inner { display: flex; flex-direction: column; align-items: center; transition: transform .6s ease; margin-top: -4vh; }
.sp-mark { width: 26px; height: 39px; fill: none; stroke: var(--accent); stroke-width: 1.6; stroke-linecap: round; margin-bottom: 26px; }
.sp-mark path { stroke-dasharray: 60; stroke-dashoffset: 60; animation: spDraw .9s cubic-bezier(.6,0,.2,1) forwards; }
.sp-mark path + path { animation-delay: .35s; }
.sp-title {
  margin: 0; font-family: 'Noto Serif KR', 'AppleMyungjo', 'Batang', serif; font-weight: 600;
  font-size: clamp(34px, 9vw, 52px); letter-spacing: .34em; margin-right: -.34em;
  color: var(--ink); opacity: 0; animation: spUp .9s ease .45s forwards;
}
.sp-rule { width: 0; height: 1px; background: var(--accent); opacity: .55; margin: 22px 0 16px; animation: spRule .8s ease .9s forwards; }
.sp-sub { margin: 0; font-family: var(--ui); font-size: 12px; letter-spacing: .18em; margin-right: -.18em; color: var(--ink-3); opacity: 0; animation: spFade .8s ease 1.05s forwards; text-align: center; line-height: 1.6; }
.sp-verse {
  position: absolute; left: 24px; right: 24px; bottom: calc(40px + var(--safe-b));
  margin: 0; text-align: center; font-family: 'Noto Serif KR', serif; font-size: 13px; line-height: 1.9; color: var(--ink-2);
  opacity: 0; animation: spFade 1s ease 1.2s forwards;
}
.sp-verse span { display: block; font-family: var(--ui); font-size: 11px; letter-spacing: .14em; color: var(--ink-3); }
@keyframes spDraw { to { stroke-dashoffset: 0; } }
@keyframes spUp { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@keyframes spFade { to { opacity: 1; } }
@keyframes spRule { to { width: 56px; } }
@media (prefers-reduced-motion: reduce) {
  .sp-mark path, .sp-title, .sp-rule, .sp-sub, .sp-verse { animation-duration: .01s; animation-delay: 0s; }
}

/* ═══════════ 설치·업데이트 안내 ═══════════ */
.app-banner { position: fixed; z-index: 45; left: 50%; bottom: calc(var(--tab) + var(--safe-b) + 10px); transform: translateX(-50%); width: min(520px, calc(100vw - 20px)); display: flex; align-items: center; gap: 12px; padding: 10px 8px 10px 12px; background: var(--paper); border: 1px solid var(--rule); border-radius: 16px; box-shadow: var(--shadow); font-family: var(--ui); animation: abUp .35s cubic-bezier(.2,.8,.2,1); }
.app-banner[hidden] { display: none; }
.app-banner img { width: 40px; height: 40px; border-radius: 10px; flex: none; }
.ab-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.ab-text b { font-size: 14.5px; color: var(--ink); }
.ab-text span { font-size: 12px; color: var(--ink-3); line-height: 1.4; }
.ab-go { flex: none; padding: 9px 16px; border-radius: 10px; background: var(--accent); color: var(--accent-ink); font-weight: 700; font-size: 14px; }
.ab-x { flex: none; width: 32px; height: 32px; border-radius: 50%; color: var(--ink-3); font-size: 14px; }
@keyframes abUp { from { opacity: 0; transform: translate(-50%, 16px); } to { opacity: 1; transform: translate(-50%, 0); } }

.guide { font-family: var(--ui); font-size: 15px; }
.guide ol { margin: 4px 0 10px; padding-left: 1.3em; }
.guide li { margin: 0 0 10px; line-height: 1.6; }
.guide .k { display: inline-flex; align-items: center; gap: 4px; padding: 1px 8px; border: 1px solid var(--rule); border-radius: 7px; background: var(--bg); font-weight: 700; white-space: nowrap; }
.guide .k svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.guide .note { font-size: 13px; color: var(--ink-3); }

.ver-line { margin: 18px 0 4px; text-align: center; font-family: var(--ui); font-size: 12px; color: var(--ink-3); }
.ver-line button { color: var(--accent); font-weight: 700; font-size: 12px; text-decoration: underline; text-underline-offset: 3px; }
.set-row[hidden] { display: none; }

/* ═══════════ 설치·설정 화면 ═══════════ */
.settings-page { max-width: 640px; padding-top: 12px; }
.install-card { display: flex; align-items: center; gap: 14px; margin: 10px 0 8px; padding: 16px; border-radius: 16px; background: linear-gradient(135deg, #8a2216, #5e150d); color: #fff; box-shadow: 0 8px 22px rgba(94, 21, 13, .25); }
.install-card img { width: 52px; height: 52px; border-radius: 13px; flex: none; box-shadow: 0 2px 8px rgba(0,0,0,.25); }
.ic-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; font-family: var(--ui); }
.ic-text b { font-size: 16px; }
.ic-text span { font-size: 12.5px; line-height: 1.5; opacity: .88; }
.ic-btn { flex: none; padding: 11px 18px; border-radius: 12px; background: #fff; color: #7a1f17; font-weight: 700; font-size: 15px; font-family: var(--ui); }
.ic-btn[hidden] { display: none; }
.install-card.done { background: var(--bg); color: var(--ink); border: 1px solid var(--rule); box-shadow: none; }
.install-card.done .ic-text b::before { content: '✓ '; color: var(--accent); }
@media (max-width: 420px) {
  .install-card { flex-wrap: wrap; }
  .ic-btn { width: 100%; padding: 13px; }
}
