/* ===== 테마 색: 기본(아이보리) · 다크 · 블루 · 노랑 =====
   색은 여기서만 바꾸면 화면 전체에 적용됩니다. */
:root, [data-theme="ivory"] {
  --bg: #e9e7dd;        /* 화면 바탕 */
  --card: #f6f4ea;      /* 절 카드 */
  --panel: #f2f0e5;     /* 위쪽 막대 · 단어 칸 · 상자 */
  --ink: #2b2b26;       /* 글자 */
  --text2: #3b3b35;     /* 보조 글자 (영어 · 헬라어) */
  --muted: #6d6c62;
  --line: #d6d3c2;
  --accent: #4d5b2a;    /* 올리브: 테두리 · 버튼 */
  --accent-2: #6b7a3c;
  --on-accent: #fff;
  --soft: #dfe5cf;
  --soft-2: #ebeee0;
  --hint: #7b8a55;
  --blue: #1f5fa8;
  --photo-bg: #e4e1d4;
  --hit-bg: #fff4cf; --hit-line: #d9a400; --hit-cell: #ffe28a;
  --shadow: rgba(0,0,0,.08);
}
[data-theme="blue"] {
  --bg: #dde6ef; --card: #ecf2f8; --panel: #e6eef6; --ink: #1e2933; --text2: #2c3a47; --muted: #5d6b78; --line: #c4d3e2;
  --accent: #2f5d8a; --accent-2: #4677a8; --on-accent: #fff; --soft: #d2e1ef; --soft-2: #e2ecf6; --hint: #5a7ea3;
  --blue: #1d5fa0; --photo-bg: #d8e2ec;
}
[data-theme="teal"] {   /* 청록: 검색 결과 탭 */
  --bg: #d9ece9; --card: #eaf5f3; --panel: #e2f1ee; --ink: #1c2b29; --text2: #2a3d3a; --muted: #5a716d; --line: #bcd9d3;
  --accent: #1f6f66; --accent-2: #2f8a7f; --on-accent: #fff; --soft: #cce6e0; --soft-2: #ddefeb; --hint: #4d8f86;
  --blue: #1d5fa0; --photo-bg: #d3e7e3;
}
[data-theme="sage"] {   /* 연녹색(세이지): 눈이 편한 낮은 대비의 초록빛 바탕 */
  --bg: #dfe8d8; --card: #edf3e8; --panel: #e6eee0; --ink: #24301f; --text2: #33402d; --muted: #63705b; --line: #c6d4bb;
  --accent: #4f6b3c; --accent-2: #66844f; --on-accent: #fff; --soft: #d5e3c9; --soft-2: #e3ecdb; --hint: #6f8a5a;
  --blue: #1d5fa0; --photo-bg: #dae4d2;
}
[data-theme="gray"] {   /* 회색: 검정(다크)을 쓰는 사람의 검색 결과 탭 */
  --bg: #cfd2d5; --card: #e3e5e7; --panel: #dcdfe2; --ink: #22262a; --text2: #33383d; --muted: #5f666d; --line: #b9bec3;
  --accent: #4a5158; --accent-2: #5f676f; --on-accent: #fff; --soft: #c9cdd1; --soft-2: #d9dcdf; --hint: #6d757d;
  --blue: #1d5fa0; --photo-bg: #c8cbcf;
}
[data-theme="orange"] {   /* 주황: 노랑을 쓰는 사람의 검색 결과 탭 */
  --bg: #f3dcc4; --card: #fbecdc; --panel: #f7e4cf; --ink: #3a2616; --text2: #4a3220; --muted: #7d5e44; --line: #e6c4a0;
  --accent: #a4521a; --accent-2: #c06a2c; --on-accent: #fff; --soft: #f0d2b2; --soft-2: #f6e2cc; --hint: #b36a33;
  --blue: #1f5c95; --photo-bg: #efd6bc;
}
[data-theme="lav"] {   /* 연보라: 흰색(아이보리)을 쓰는 사람의 검색 결과 탭 */
  --bg: #e4def0; --card: #f1edf8; --panel: #ebe6f4; --ink: #262233; --text2: #353046; --muted: #686078; --line: #d0c7e2;
  --accent: #5b4a8a; --accent-2: #7362a6; --on-accent: #fff; --soft: #ddd4ef; --soft-2: #e9e3f5; --hint: #7a6aa8;
  --blue: #1d5fa0; --photo-bg: #e0d9ee;
}
[data-theme="yellow"] {
  --bg: #ece2c6; --card: #f7efd8; --panel: #f2e8cc; --ink: #3a2f1c; --text2: #4a3d27; --muted: #7a6a4c; --line: #dccb9f;
  --accent: #7a5a1e; --accent-2: #96722f; --on-accent: #fff; --soft: #e9d9ad; --soft-2: #f1e6c4; --hint: #96722f;
  --blue: #1f5c95; --photo-bg: #e8dcbc;
}
[data-theme="dark"] {
  --bg: #171916; --card: #22251f; --panel: #1d201b; --ink: #e4e3da; --text2: #cfcfc4; --muted: #a2a294; --line: #3a3f33;
  --accent: #a3ba6b; --accent-2: #b8cd84; --on-accent: #1a1d14; --soft: #2c3324; --soft-2: #262b20; --hint: #9fb36a;
  --blue: #7fb3ff; --photo-bg: #11130f;
  --hit-bg: #3a3315; --hit-line: #c9a227; --hit-cell: #5c4c12;
  --shadow: rgba(0,0,0,.4);
}
:root {
  --scale: 1;
  --hebrew: "SBL Hebrew", "Ezra SIL", "Times New Roman", serif;
  --qumran: "QR_HRrw", "QR_HBrw", "SBL Hebrew", serif;
  --greek: "SBL Greek", "Gentium Plus", "Times New Roman", serif;
  --kor: "맑은 고딕", "Malgun Gothic", sans-serif;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { font-size: calc(16px * var(--scale)); }
body { margin: 0; background: var(--bg); color: var(--ink); font-family: var(--kor); transition: background .2s, color .2s; }
button { font: inherit; }

/* ---------- 위쪽 막대 ---------- */
.bar { position: sticky; top: 0; z-index: 20; background: var(--panel); border-bottom: 2px solid var(--accent); box-shadow: 0 2px 6px var(--shadow); }
.bar-in { max-width: 1100px; margin: 0 auto; padding: 5px 16px; display: flex; flex-wrap: wrap; gap: 5px 12px; align-items: center; font-size: 12.5px; }
.brand { font-weight: 700; color: var(--accent); font-size: 14px; margin-right: 2px; text-decoration: none; }
.brand:hover { text-decoration: underline; }
/* 홈 버튼 (집 아이콘) */
.home { display: inline-flex; align-items: center; justify-content: center; width: 28px; height: 26px; margin-right: -6px; border-radius: 6px; color: var(--accent); border: 1px solid var(--accent); background: var(--card); }
.home:hover { background: var(--accent); color: var(--on-accent); }
.home svg { width: 17px; height: 17px; }
.nav, .search, .font, .theme { display: flex; gap: 4px; align-items: center; }
.search { flex: 1 1 240px; }
.search input { flex: 1; min-width: 120px; font: inherit; height: 26px; padding: 0 9px; border: 1px solid var(--line); border-radius: 6px; background: var(--card); color: var(--ink); }
.search input:focus { outline: 2px solid var(--accent-2); border-color: transparent; }
.btn { border: 1px solid var(--accent); background: var(--card); color: var(--accent); border-radius: 6px; height: 26px; padding: 0 8px; line-height: 24px; cursor: pointer; white-space: nowrap; }
.btn:hover { background: var(--soft); }
.btn.icon { padding: 0 6px; min-width: 26px; }
.btn.pick { background: var(--accent); color: var(--on-accent); }
.btn.pick:hover { background: var(--accent-2); }
.btn.rec { background: #c0392b; border-color: #c0392b; color: #fff; }
.font .lbl, .theme .lbl { color: var(--muted); }
#fontVal { min-width: 40px; text-align: center; color: var(--muted); }
/* 테마 고르기 (동그란 색 버튼) */
.sw { width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--line); cursor: pointer; padding: 0; }
.sw.on { border-color: var(--accent); box-shadow: 0 0 0 2px var(--panel), 0 0 0 4px var(--accent); }
.sw-ivory { background: #f3f0e2; } .sw-dark { background: #22251f; } .sw-blue { background: #cfe0f1; } .sw-yellow { background: #f0dfae; } .sw-teal { background: #bfe0da; } .sw-sage { background: #cfdcc4; }

/* ---------- ⚙ 설정 창 (보일 줄 고르기) ---------- */
.set-btn { margin-left: auto; }                         /* 막대 맨 오른쪽 */
.setpanel { position: absolute; right: max(16px, calc(50% - 534px)); top: 100%; z-index: 25; background: var(--panel); color: var(--ink); border: 1px solid var(--accent); border-radius: 8px; box-shadow: 0 8px 24px var(--shadow); padding: 10px 12px; font-size: 13px; max-width: calc(100vw - 16px); max-height: calc(100vh - 90px); overflow-y: auto; }
.sp-presets { display: flex; gap: 6px; margin-bottom: 8px; flex-wrap: wrap; }
.sp-size { display: grid; grid-template-columns: repeat(2, auto); gap: 4px 22px; justify-content: start; margin-bottom: 10px; padding-bottom: 8px; border-bottom: 1px solid var(--line); }
.sp-row { display: flex; align-items: center; gap: 5px; }
.sp-row .nm { min-width: 6.5em; }
.sp-row .val { min-width: 3em; text-align: center; font-weight: 700; }
.sp-row .val.chg { color: var(--accent); }
.sp-reset { height: 20px; line-height: 18px; font-size: 11px; padding: 0 6px; margin-left: 8px; font-weight: 400; }
@media (max-width: 560px) { .sp-size { grid-template-columns: 1fr; } }
.sp-cols { display: grid; grid-template-columns: auto auto; gap: 4px 22px; }
.sp-h { font-weight: 700; color: var(--accent); border-bottom: 1px solid var(--line); margin-bottom: 4px; padding-bottom: 2px; }
.setpanel label { display: block; padding: 2px 0; cursor: pointer; white-space: nowrap; }
.setpanel input { accent-color: var(--accent); vertical-align: -2px; margin-right: 4px; }
@media (max-width: 560px) { .sp-cols { grid-template-columns: 1fr; } }

/* ---------- 책·장·절 선택 창 ---------- */
.picker { position: absolute; left: max(16px, calc(50% - 534px)); top: 100%; display: flex; background: var(--panel); border: 1px solid var(--accent); border-radius: 8px; box-shadow: 0 8px 24px var(--shadow); overflow: hidden; font-size: 14px; max-width: calc(100vw - 16px); overflow-x: auto; }
.picker .col { width: max-content; min-width: 84px; border-left: 1px solid var(--line); }
.picker .col:first-child { border-left: 0; }
.picker .col-h { background: var(--soft); color: var(--accent); font-weight: 700; padding: 6px 10px; font-size: 13px; white-space: nowrap; }
.picker .col-h small { font-weight: 700; color: var(--hint); font-size: 10.5px; margin-left: 3px; }
.picker ul { list-style: none; margin: 0; padding: 0; height: min(490px, 70vh); overflow-y: auto; }
.picker li { padding: 3px 10px; cursor: pointer; line-height: 1.45; }
.picker li:hover { background: var(--soft-2); }
.picker li.on { background: var(--accent); color: var(--on-accent); }
/* 성경 칸 · 책 칸(종류별 묶음) · 장/절 칸(번호 격자) */
.picker .col-set { min-width: 96px; background: var(--soft-2); }
.picker .col-set li { padding: 7px 12px; font-weight: 700; }
.picker .col-book { min-width: 118px; }
.picker li.grp { cursor: default; font-size: 11px; font-weight: 700; color: var(--hint); background: transparent; padding: 6px 10px 1px; border-top: 1px dashed var(--line); }
.picker li.grp:first-child { border-top: 0; }
.picker li.grp.sep { padding: 0; height: 0; margin: 4px 8px; border-top: 1px dashed var(--line); }
.picker ul.nums { display: grid; grid-template-columns: repeat(5, 36px); grid-auto-rows: 28px; align-content: start; gap: 2px; padding: 4px; }
.picker ul.nums li { padding: 0; text-align: center; line-height: 28px; border-radius: 4px; border: 1px solid var(--line); background: var(--card); }
.picker ul.nums li:hover { border-color: var(--accent); }
.picker ul.nums li.on { border-color: var(--accent); background: var(--accent); color: var(--on-accent); font-weight: 700; }
@media (max-width: 560px) {
  .picker .col-set li { padding: 6px 8px; } .picker .col-set { min-width: 78px; } .picker .col-book { min-width: 96px; }
  .picker ul.nums { grid-template-columns: repeat(3, 34px); }
  .picker .col-h small { display: none; }
}

/* ---------- 본문 ---------- */
main { max-width: 1100px; margin: 0 auto; padding: 14px 16px 60px; }
.status { color: var(--muted); font-size: .85rem; margin: 2px 0 10px; }
.verse { background: var(--card); border-radius: 10px; box-shadow: 0 1px 4px var(--shadow); margin-bottom: 18px; overflow: hidden; scroll-margin-top: 80px; }
.verse.flash { animation: flash 1.6s ease-out; }
@keyframes flash { from { box-shadow: 0 0 0 4px var(--blue); } to { box-shadow: 0 1px 4px var(--shadow); } }
.sep { height: 8px; background: var(--soft); }
.photo { padding: 12px 12px 0; }
.photo img { display: block; width: 100%; aspect-ratio: 9 / 2; height: auto; object-fit: contain; background: var(--photo-bg); border: 2px solid var(--panel); border-radius: 10px; box-shadow: 0 3px 8px rgba(0,0,0,.35); }
.vhead { display: flex; justify-content: flex-end; padding: 10px 14px 0; }
.ref { font-weight: 700; color: var(--accent); background: var(--soft-2); border: 1px solid var(--line); border-radius: 999px; padding: 2px 12px; cursor: pointer; font-size: .9rem; }
.ref:hover { background: var(--soft); }
.text { margin: 10px 12px 12px; border: 2.5px solid var(--accent); border-radius: 8px; padding: 8px 14px; }
/* 본문 상자 바탕: 단어 대조 칸(--panel)보다 조금 진하게 (테마 색을 살짝 섞음) */
.text, .ot-head { background: color-mix(in srgb, var(--accent) 9%, var(--panel)); }
.t-qum { font-family: var(--qumran); font-size: 1.55rem; direction: rtl; text-align: right; line-height: 1.6; }
.t-heb { font-family: var(--hebrew); font-size: 1.55rem; direction: rtl; text-align: right; line-height: 1.7; }
.t-kjv { font-size: .9rem; line-height: 1.45; margin-top: 4px; }
.t-lxx { font-family: var(--greek); font-size: .95rem; line-height: 1.45; margin-top: 3px; color: var(--text2); }
.t-kor { font-size: calc(var(--kor-pt, 15) * 1rem / 12); line-height: 1.55; margin-top: 4px; color: #c0151b; font-weight: 700; }   /* 구약처럼 빨강 굵게 */
.t-kor b { color: #c0151b; font-weight: 700; }
[data-theme="dark"] .t-kor, [data-theme="dark"] .t-kor b { color: #ff7b7b; }

/* ---------- 단어 분석 ---------- */
/* 한 줄 7칸 고정 (글자 크기를 바꿔도 칸 수는 그대로, 넘치는 글만 줄어듦) */
.words { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); direction: rtl; gap: 8px; padding: 0 12px 14px; }
.word { direction: ltr; min-width: 0; border: 1px solid var(--line); border-radius: 8px; padding: 6px 4px; text-align: center; background: var(--panel); }
/* 줄마다 높이 고정: 빈 칸이어도, 글자를 줄여도 어근은 어근끼리 · 본문은 본문끼리 같은 높이에 나란히 */
.word > div { height: var(--h); line-height: var(--h); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.w-r  { --h: 1.35rem; font-family: var(--hebrew); font-size: .875rem; direction: rtl; color: #6f2da8; }   /* 어근 = 본문 단어(1.25rem)의 70%, 창세기처럼 보라 */
[data-theme="dark"] .w-r { color: #c99bff; }
.w-s  { --h: .95rem; font-size: .56rem; font-weight: 700; color: var(--muted); }   /* 쿰란: 어근 음독 = 본문 한글 음독(.8rem)의 70% */
.w-q  { --h: 1.85rem; font-family: var(--qumran); font-size: 1.25rem; direction: rtl; }
.w-q.w-bhs { font-family: var(--hebrew); }             /* 구약 화면: 쿰란 자리에 BHS */
.w-h  { --h: 1.85rem; font-family: var(--hebrew); font-size: 1.25rem; direction: rtl; }
.w-b  { --h: 1.35rem; font-family: var(--hebrew); font-size: .875rem; direction: rtl; color: var(--text2); }   /* 쿰란: BHS 분해 (4번째 줄) */
/* 쿰란 이사야: 3번째 줄(쿰란 사본 글자)에 창세기처럼 옅은 파란 띠 */
.word:not(.otw) .w-q { background: #dde3f5; color: #1c1c1c; margin: 0 -4px; padding: 0 4px; }
[data-theme="dark"] .word:not(.otw) .w-q { background: #2f3650; color: #f0f0f0; }
.w-k  { --h: 1.35rem; font-size: .8rem; cursor: pointer; border-radius: 4px; }
.w-g  { --h: 1.15rem; font-size: .72rem; color: var(--blue); cursor: help; text-decoration: underline dotted; }
.w-ko { --h: 1.25rem; font-size: .78rem; }
.w-en { --h: 1.15rem; font-size: .72rem; color: var(--text2); }
.w-gr { --h: 1.25rem; font-family: var(--greek); font-size: .78rem; color: var(--text2); }
.w-sp { --h: .55rem; }                                   /* 70인역 아래 한 칸 띄움 */
.w-d  { --h: 1.25rem; font-size: .74rem; color: var(--accent); font-weight: 700; cursor: pointer; }
.w-d:not(.none) { text-decoration: underline dotted; }
.w-d:hover { background: var(--soft-2); border-radius: 4px; }
.w-k:hover { background: var(--soft-2); }
.w-k.aud { color: var(--blue); font-weight: 700; }
.w-k.aud::after { content: " 🔊"; font-size: .7em; }
/* 쿰란 십계명: 쿰란 · 출애굽기 · 신명기 비교 버튼 */
.cmp3 { display: flex; flex-wrap: wrap; gap: 6px; justify-content: flex-end; margin: 6px 0 8px; }
.c3 { font: inherit; font-size: .85rem; padding: 4px 12px; border-radius: 999px; cursor: pointer;
      border: 1.5px solid var(--accent, #8a6a2a); background: transparent; color: var(--accent, #8a6a2a); }
html:not(.c3-noq) .c3[data-k="q"], html.c3-e .c3[data-k="e"], html.c3-d .c3[data-k="d"] { background: var(--accent, #8a6a2a); color: #fff; }
html.c3-noq .text.c3-q { display: none; }
.c3p { display: none; margin: 6px 0; padding: 8px 12px; border-radius: 6px; border-right: 4px solid var(--accent, #8a6a2a);
       background: color-mix(in srgb, var(--accent, #8a6a2a) 8%, transparent); }
html.c3-e .c3p.c3-e, html.c3-d .c3p.c3-d { display: block; }
.c3p.c3-d { border-right-color: #5b7a9a; }
.c3h { font-weight: 700; font-size: .9rem; margin-bottom: 4px; text-align: right; }
.c3h span { font-weight: 400; opacity: .75; margin-right: 6px; }
.c3heb { font-family: var(--hebrew); direction: rtl; text-align: right; font-size: 1.45rem; line-height: 1.7; }
.c3kor { font-size: .95rem; margin-top: 2px; text-align: right; }
.c3none { font-size: .9rem; opacity: .75; text-align: right; }
.q-extra { margin-top: 18px; padding-top: 10px; border-top: 2px dashed var(--accent, #b08a3e); }   /* 쿰란 십계명 10절: 출애굽기에 없는 부분 */
.q-extra-h { font-weight: 700; color: var(--accent, #8a6a2a); margin: 0 0 8px; text-align: right; }
.photo-cap { font-size: .85rem; color: var(--ink-2, #6b5a3a); text-align: right; margin: 2px 4px 0; }   /* 쿰란 십계명: 출애굽기에 없는 부분 사진 설명 */
.ntw .w-k:not(.none)::after { content: " 🔊"; font-size: .7em; }   /* 신약: 음성 합성으로 듣기 */
.word .playing { background: var(--hit-cell); }
.w-r, .w-q, .w-h { cursor: zoom-in; user-select: none; border-radius: 4px; }      /* 더블클릭 검색 */
.w-r:hover, .w-q:hover, .w-h:hover { background: var(--soft-2); }
html.set-ot .w-q { cursor: default; }                       /* 구약 분해 줄은 검색 안 함 */
html.set-ot .w-q:hover { background: transparent; }
.nil { color: var(--muted); opacity: .45; font-family: var(--kor); font-size: .75rem; font-weight: 400; direction: ltr; }
.w-k.none, .w-g.none { pointer-events: none; text-decoration: none; }
.w-k.none::after { content: none; }

/* ---------- 검색 결과 ---------- */
.shead { background: var(--panel); border: 2px solid var(--accent); border-radius: 10px; padding: 10px 14px; margin-bottom: 14px; box-shadow: 0 2px 8px var(--shadow); }
.shead .st { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.shead .big { font-size: 1.7rem; }
.shead .sm { color: var(--muted); font-weight: 700; }
.shead .sc { margin-top: 2px; font-size: .95rem; }
.shead .sc b { color: var(--accent); }
.shead .sx { color: var(--muted); font-size: .78rem; margin-top: 2px; }
/* 검색 결과 탭: 진한 파랑 막대 + 표시 */
.search-tab .bar { background: #1f6f66; border-bottom-color: #124a44; }
.search-tab .bar .lbl, .search-tab .bar #fontVal, .search-tab .bar .brand { color: #fff; }
.search-tab .bar .btn.pick { background: #fff; color: #1f6f66; border-color: #fff; }
[data-theme="gray"].search-tab .bar { background: #4a5158; border-bottom-color: #2e3338; }
[data-theme="gray"].search-tab .bar .btn.pick, [data-theme="gray"] .srch-badge { color: #4a5158; }
[data-theme="lav"].search-tab .bar { background: #5b4a8a; border-bottom-color: #3e3166; }
[data-theme="lav"].search-tab .bar .btn.pick, [data-theme="lav"] .srch-badge { color: #5b4a8a; }
[data-theme="orange"].search-tab .bar { background: #b85c1e; border-bottom-color: #8a4212; }
[data-theme="orange"].search-tab .bar .btn.pick, [data-theme="orange"] .srch-badge { color: #a4521a; }
.srch-badge { background: #fff; color: #1f6f66; font-weight: 700; font-size: 12px; border-radius: 999px; padding: 2px 10px; white-space: nowrap; }
/* 도마복음: "다른번역" — 마우스를 올리거나 누르면 영어 번역 · 번역1·2 · 대역 */
.cp-alt { white-space: nowrap; flex-shrink: 0; }
/* "다른번역" 버튼: 본문 상자 위쪽 테두리에 걸친 탭 — 구약은 왼쪽 위, 신약·도마복음은 오른쪽 위 (글이 없는 쪽) */
.ot-head { position: relative; margin-top: 18px; }
.ot-head > .cp-alt.corner { position: absolute; top: -13px; left: 14px; margin: 0; z-index: 6; box-shadow: 0 1px 3px var(--shadow); }
.nt-head > .cp-alt.corner { left: auto; right: 14px; }
.nt-head > .cp-alt.corner .cp-pop { left: auto; right: 0; }
.cp-pop { white-space: normal; }
.cp-alt { position: relative; display: inline-block; margin-left: 10px; font-size: .82rem; font-weight: 700; color: var(--accent);
          border: 1px solid var(--accent); border-radius: 999px; padding: 1px 10px; cursor: pointer; background: var(--card); outline: none; }
.cp-alt:hover, .cp-alt:focus-within { background: var(--accent); color: var(--on-accent); }
.cp-pop { display: none; position: absolute; left: 0; top: 100%; z-index: 26; width: min(560px, 86vw); padding-top: 6px; cursor: default; }
.cp-alt:hover .cp-pop, .cp-alt:focus-within .cp-pop { display: block; }
.cp-pop > .cp-row:first-child { border-top-left-radius: 10px; border-top-right-radius: 10px; }
.cp-pop > .cp-row:last-child { border-bottom-left-radius: 10px; border-bottom-right-radius: 10px; border-bottom: 2px solid var(--accent); }
.cp-row { display: grid; grid-template-columns: 4.6rem 1fr; gap: 8px; align-items: start; text-align: left; padding: 8px 12px;
          background: var(--panel); color: var(--ink); font-weight: 400; font-size: .9rem; line-height: 1.55;
          border-left: 2px solid var(--accent); border-right: 2px solid var(--accent); border-bottom: 1px dashed var(--line); box-shadow: 0 10px 24px rgba(0,0,0,.18); }
.cp-pop > .cp-row:first-child { border-top: 2px solid var(--accent); }
.cp-k { font-size: .74rem; font-weight: 700; color: var(--on-accent); background: var(--accent); border-radius: 5px; padding: 1px 6px; text-align: center; margin-top: 2px; }
.cpv { overflow: visible; }
/* 도마복음 본문: 콥트어 → AI 영어 → AI 한글 */
.cp-aien { font-size: 1.05rem; line-height: 1.55; margin-top: 6px; color: var(--text2); }
.cp-ko { margin-top: 6px; }
.ot-ai { font-size: .95rem; line-height: 1.55; margin-top: 4px; color: var(--ink); font-weight: 600; }   /* 구약: 히브리어에서 옮긴 AI 번역 (흠정역 자리) */
.cp-lt { display: inline-block; font-family: var(--kor); font-size: .66rem; font-weight: 700; color: var(--on-accent); background: var(--accent);
         border-radius: 4px; padding: 0 5px; margin-right: 6px; vertical-align: 2px; letter-spacing: 0; }
.cp-pt { color: var(--accent); }
.cp-link { color: var(--blue); font-weight: 700; text-decoration: underline; }
.cp-mt { font-size: .78rem; font-weight: 700; color: var(--accent); margin-bottom: 2px; }
.cp-mat { font-size: .95rem; line-height: 1.6; }
.cp-matko { font-weight: 700; color: var(--ink); }
.cp-pop { max-height: 70vh; overflow-y: auto; }
.cp-src { font-size: .74rem; color: var(--muted); margin-top: 4px; }
.cp-ai { color: #c0151b; font-weight: 700; font-size: 1rem; }
[data-theme="dark"] .cp-ai { color: #ff7b7b; }
.cp-note > div { color: var(--muted); font-size: .8rem; }

/* 🔒 복사 · 캡처 막기 */
#main, .tip, .dict { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
#main img { pointer-events: none; }
@media print { body > * { display: none !important; } body::after { content: "이 본문은 인쇄할 수 없습니다."; display: block; padding: 40px; font-size: 20px; } }
.guard { position: fixed; inset: 0; z-index: 60; background: rgba(0,0,0,.45); display: flex; align-items: center; justify-content: center; padding: 16px; }
.gd-box { background: var(--panel); color: var(--ink); border: 2px solid var(--accent); border-radius: 12px; box-shadow: 0 10px 30px rgba(0,0,0,.35); padding: 16px 20px; width: min(380px, 100%); font-size: 14px; line-height: 1.6; text-align: center; }
.gd-h { font-weight: 700; font-size: 17px; color: var(--accent); margin-bottom: 6px; }
.gd-box p { margin: 4px 0; }
.gd-t { margin: 10px auto; border-collapse: collapse; min-width: 220px; }
.gd-t th, .gd-t td { border: 1px solid var(--line); padding: 4px 12px; }
.gd-t th { background: var(--soft); }
.gd-t b { color: #c0151b; }
.gd-ok { margin-top: 6px; padding: 0 24px; }
/* 워터마크: 본문 위에 연하게 깔림 (클릭·선택은 그대로 통과), 위쪽 막대·설정창보다는 아래 */
.wm { position: fixed; inset: 0; z-index: 15; pointer-events: none; background-repeat: repeat; }
/* 🕘 히스토리 */
.hist-btn { margin-left: auto; }
.histpanel { width: min(420px, calc(100vw - 16px)); }
.histpanel .sp-h small { font-weight: 400; color: var(--muted); }
.hist-tabs { display: flex; gap: 0; margin: 6px 0 2px; border-bottom: 2px solid var(--accent); }
.htab { flex: 1; font: inherit; font-size: 13px; font-weight: 700; padding: 6px 0; cursor: pointer; border: 1px solid var(--line); border-bottom: 0;
        background: var(--soft-2); color: var(--muted); border-radius: 6px 6px 0 0; }
.htab.on { background: var(--accent); color: var(--on-accent); border-color: var(--accent); }
.htab b { font-size: 11px; opacity: .85; margin-left: 2px; }
#histList { list-style: none; margin: 4px 0 0; padding: 0; }
#histList li { display: flex; align-items: baseline; gap: 6px; padding: 5px 6px; border-bottom: 1px dashed var(--line); cursor: pointer; border-radius: 4px; }
#histList li:hover { background: var(--soft-2); }
#histList li.empty { color: var(--muted); cursor: default; }
#histList small { color: var(--muted); }
#histList .heb { font-family: var(--hebrew), var(--greek), var(--coptic); font-size: 1.05rem; }
#histList .ht { margin-left: auto; color: var(--muted); font-size: 11px; white-space: nowrap; }
.hk { font-size: 11px; font-weight: 700; color: #fff; border-radius: 4px; padding: 0 5px; }
.hk-v { background: var(--accent); } .hk-s { background: #b0581c; }
.sbooks { display: flex; flex-wrap: wrap; gap: 4px; margin: 8px 0 4px; }
.sbk { border: 1px solid var(--accent); background: var(--card); color: var(--ink); border-radius: 999px; padding: 1px 9px; font: inherit; font-size: .8rem; cursor: pointer; }
.sbk b { color: var(--accent); }
.sbk.on { background: var(--accent); color: #fff; } .sbk.on b { color: #fff; }
.sbk.zero { border-color: var(--line); color: var(--muted); cursor: default; opacity: .6; } .sbk.zero b { color: var(--muted); }
.sbook-h { font-weight: 700; color: var(--accent); margin: 4px 2px 10px; font-size: 1rem; }
.sk { color: #fff; border-radius: 5px; padding: 1px 8px; font-size: .8rem; font-weight: 700; }
.sk-r { background: #b7791f; } .sk-q { background: #2b6cb0; } .sk-h { background: #6b46c1; }
.sref { display: flex; justify-content: space-between; align-items: center; padding: 8px 14px 0; font-weight: 700; }
.sref a { color: var(--accent); text-decoration: none; }
.sref a:hover { text-decoration: underline; }
.sref span { color: var(--muted); font-size: .85rem; }
.word.hit { border: 2px solid var(--hit-line); background: var(--hit-bg); }
.word.hit-r .w-r, .word.hit-q .w-q, .word.hit-h .w-h { background: var(--hit-cell); border-radius: 4px; font-weight: 700; }

/* ---------- 사전 상자 ---------- */
.dict { position: absolute; z-index: 31; width: min(500px, 94vw); max-height: 66vh; overflow-y: auto; background: var(--panel); color: var(--ink); border: 2px solid var(--accent); border-radius: 12px; box-shadow: 0 10px 28px rgba(0,0,0,.3); padding: 0 0 8px; font-size: .95rem; line-height: 1.6; }
.dhead { position: sticky; top: 0; display: flex; align-items: center; gap: 12px; background: var(--soft); padding: 8px 14px; border-bottom: 1px solid var(--line); }
.dhead .big { font-size: 2rem; line-height: 1.2; }
.dmeta { color: var(--accent); font-size: .95rem; font-weight: 700; flex: 1; }
.dclose { border: 0; background: var(--panel); color: var(--muted); cursor: pointer; font-size: 1rem; border-radius: 6px; width: 28px; height: 28px; }
.dclose:hover { color: var(--ink); }
.dsec { display: grid; grid-template-columns: 3.4rem 1fr; gap: 4px 10px; align-items: start; padding: 9px 14px; border-bottom: 1px dashed var(--line); }
.dsec:last-child { border-bottom: 0; }
.dsec > .chips, .dsec > .dtxt { grid-column: 2; }
.dlab { grid-column: 1; grid-row: 1 / span 2; justify-self: start; font-size: .8rem; font-weight: 700; color: #fff; background: var(--accent); border-radius: 5px; padding: 1px 8px; margin-top: 2px; }
.dtxt { margin: 0; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 0; }
.chips span { background: var(--card); border: 1px solid var(--line); border-radius: 999px; padding: 1px 11px; font-size: .9rem; }
.hb { display: inline-block; background: #eef4ff; border: 1px solid #c9daf5; border-radius: 6px; padding: 1px 8px; margin: 1px 0; color: #1e2a3a; }
.hb .heb { font-size: 1.15rem; }
.hb b { color: #1f5fa8; }
.heb { font-family: var(--hebrew); direction: rtl; unicode-bidi: isolate; }
/* 항목별 색: 뜻(노랑) · 어원(파랑) · 관련(보라) */
.d-mean { background: #fffaf0; }  .d-mean .dlab { background: #b7791f; }
.d-mean .chips span { background: #fff3d6; border-color: #f0d49a; color: #6b4a0f; }
.d-etym { background: #f3f8ff; }  .d-etym .dlab { background: #2b6cb0; }
.d-rel  { background: #f7f3ff; }  .d-rel .dlab { background: #6b46c1; }
.d-rel .chips span { background: #efe8ff; border-color: #d4c6f5; color: #45307d; }
.d-rel .hb { background: #fff; }

/* ---------- 문법 설명 상자 ---------- */
.tip { position: absolute; z-index: 30; max-width: min(420px, 94vw); background: var(--panel); color: var(--ink); border: 2px solid var(--accent); border-radius: 12px; padding: 0; box-shadow: 0 8px 22px rgba(0,0,0,.28); font-size: .92rem; line-height: 1.5; overflow: hidden; }
.tip .src { background: var(--soft); color: var(--accent); font-weight: 700; font-size: .9rem; padding: 6px 12px; border-bottom: 1px solid var(--line); }
.tip .gbody { padding: 9px 12px 10px; display: flex; flex-wrap: wrap; align-items: center; gap: 6px 4px; }
.ggrp { display: inline-flex; flex-wrap: wrap; gap: 4px; }
.gplus { color: var(--muted); font-weight: 700; padding: 0 3px; }
.gc { border-radius: 6px; padding: 1px 8px; font-size: .88rem; border: 1px solid transparent; white-space: nowrap; }
.g-pos  { background: #e9f0dc; border-color: #c7d4a8; color: #3c4a1c; font-weight: 700; }   /* 품사 */
.g-stem { background: #efe8ff; border-color: #d4c6f5; color: #4b2f8f; }                      /* 동사 어간 */
.g-form { background: #e6f0ff; border-color: #bcd3f5; color: #1f4f8f; }                      /* 시제·형태 */
.g-pgn  { background: #fff1e0; border-color: #f2cf9f; color: #8a4a00; }                      /* 인칭·성·수·상태 */
.g-suf  { background: #dff5f1; border-color: #a9e0d6; color: #11655a; font-weight: 700; }    /* 접미사 */
.g-suf2 { background: #f0fbf9; border-color: #c6ece5; color: #11655a; }
.g-etc  { background: #f3f3f3; border-color: #ddd; color: #444; }

/* 다크 테마: 상자 안 색칸을 어둡게 */
[data-theme="dark"] .d-mean { background: #2d2716; } [data-theme="dark"] .d-mean .chips span { background: #3b3019; border-color: #6b5524; color: #f3d48e; }
[data-theme="dark"] .d-etym { background: #18263a; }
[data-theme="dark"] .d-rel  { background: #251d38; } [data-theme="dark"] .d-rel .chips span { background: #322651; border-color: #5a4690; color: #d9cbff; }
[data-theme="dark"] .hb, [data-theme="dark"] .d-rel .hb { background: #1b2a40; border-color: #33507a; color: #dbe7ff; }
[data-theme="dark"] .hb b { color: #8cbcff; }
[data-theme="dark"] .g-pos  { background: #2c3622; border-color: #4f6235; color: #cfe3a4; }
[data-theme="dark"] .g-stem { background: #2e2545; border-color: #54448a; color: #d6c8ff; }
[data-theme="dark"] .g-form { background: #1b2b44; border-color: #355585; color: #b9d4ff; }
[data-theme="dark"] .g-pgn  { background: #3a2a16; border-color: #7a5726; color: #ffd39b; }
[data-theme="dark"] .g-suf, [data-theme="dark"] .g-suf2 { background: #17332f; border-color: #2f6b61; color: #9fe6d8; }
[data-theme="dark"] .g-etc  { background: #2b2b2b; border-color: #444; color: #ddd; }

/* ===== 구약 화면 (쿰란TV 슬라이드 모양) ===== */
.otv { padding: 14px 14px 16px; }
.ot-head { text-align: right; margin: 10px 12px 12px; border: 2.5px solid var(--accent); border-radius: 8px; padding: 8px 14px; }   /* 쿰란 본문처럼 테두리 */
.ot-top { display: flex; justify-content: flex-end; align-items: baseline; gap: 18px; }
.ot-kor { color: #c0151b; font-weight: 700; font-size: calc(var(--kor-pt, 15) * 1rem / 12); }   /* 본문 한글: 기본 15pt, ⚙ 설정에서 고객이 −/+ 로 바꿈 */
.ot-ref { white-space: nowrap; flex-shrink: 0; font-size: 1.15rem; color: #c0151b; background: transparent; border: 0; padding: 0; }
[data-theme="dark"] .ot-kor, [data-theme="dark"] .ot-ref { color: #ff7b7b; }
.ot-heb { font-family: var(--hebrew); font-size: 2.15rem; direction: rtl; line-height: 1.5; margin-top: 4px; }
.ot-lxx { font-family: var(--greek); font-size: 1.2rem; line-height: 1.5; }
.ot-kjv { font-size: 1.05rem; line-height: 1.5; }
/* 단어 칸: 표처럼 빈틈 없이 */
/* 단어 칸: 쿰란처럼 칸마다 둥근 경계선 */
.otws { gap: 14px; padding: 4px 16px 18px; border-top: 0; }
.word.otw { border: 1px solid var(--line); border-radius: 8px; padding: 8px 0; background: var(--panel); overflow: hidden; }
.word > div { margin: 2px 0; }   /* 줄과 줄 사이 숨 쉴 틈 (모든 칸에 똑같이 → 줄 맞춤 유지) */
.words { gap: 14px; }
.word.otw > div { padding: 0 3px; }
/* 검색 결과: 찾은 단어 칸을 진하게 칠함 (위 .word.otw 바탕보다 우선) */
.word.otw.hit { border: 2.5px solid var(--hit-line); background: var(--hit-bg); box-shadow: 0 0 0 2px var(--hit-cell); }
.word.otw.hit .w-r, .word.otw.hit .w-q, .word.otw.hit .w-h, .word.otw.hit .w-b { background: var(--hit-cell); font-weight: 700; }
/* 본문 문장 안에서 찾은 단어 */
mark.hl { background: var(--hit-cell); color: inherit; border-radius: 4px; padding: 0 3px; box-shadow: 0 0 0 1.5px var(--hit-line); }
.o-s  { --h: 1.35rem; color: #c0151b; font-weight: 700; font-size: .85rem; }
[data-theme="dark"] .o-s { color: #ff7b7b; }
.o-r  { --h: 2.3rem; color: #6f2da8; font-size: 1.6rem; }
[data-theme="dark"] .o-r { color: #c99bff; }
.o-rr { --h: 1.05rem; font-size: .595rem; font-weight: 700; }            /* 어근 음독 = 본문 한글 음독(.85rem)의 70% */
.o-b  { --h: 1.35rem; font-size: .875rem; color: var(--text2); }   /* 분해: 쿰란 분해 줄과 같은 크기로 작게 */
.word.otw .o-h { --h: 3.6rem; font-family: var(--hebrew); font-size: 2.5rem; background: #dde3f5; color: #1c1c1c; }   /* WLC 띠 */
[data-theme="dark"] .word.otw .o-h { background: #2f3650; color: #f0f0f0; }
.o-k  { --h: 1.4rem; font-size: .85rem; }
.o-g  { --h: 1.35rem; font-size: .85rem; font-weight: 700; color: var(--ink); text-decoration: none; }
.o-ko { --h: 1.35rem; font-size: .85rem; }
.o-en { --h: 1.35rem; font-size: .85rem; font-weight: 700; color: var(--ink); }
.o-gr { --h: 1.45rem; font-family: var(--greek); font-size: .9rem; }
/* ===== 신약 화면: 왼쪽부터, 8칸 ===== */
.nt-head { text-align: left; }
.nt-head .ot-top { justify-content: flex-start; }
.nt-grk { font-family: var(--greek); font-size: 1.5rem; line-height: 1.5; margin-top: 4px; }
.nt-kjvko { font-size: .9rem; color: var(--muted); margin-top: 2px; }
.ntws { direction: ltr; grid-template-columns: repeat(8, minmax(0, 1fr)); }   /* 신약 · 콥트어: 한 줄 8칸 (9칸은 글자가 너무 작아짐) */
.n-r  { font-family: var(--greek); font-size: 1.35rem; direction: ltr; }
.word.otw .n-st { --h: 3.4rem; font-family: var(--greek); font-size: 2.1rem; background: #dbe8f6; color: #1c1c1c; direction: ltr; }   /* 스테판 띠 */
[data-theme="dark"] .word.otw .n-st { background: #283a52; color: #f0f0f0; }
.n-al { --h: 3rem; font-family: var(--greek); font-size: 1.817rem; direction: ltr; }   /* 알랜드 26판: 스테판보다 한 단계 작게 (1.9rem 에서 1pt 줄임) */
@media (max-width: 760px) { .ntws { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.ot-note { font-size: .82rem; color: var(--muted); margin-top: 2px; }
.ot-tag { font-family: var(--kor); font-size: .7rem; color: var(--muted); border: 1px solid var(--line); border-radius: 4px; padding: 0 5px; margin-left: 6px; vertical-align: middle; }

/* ===== 콥트어 사본 (도마복음) ===== */
/* 콥트어 글꼴: Antinoou(PC에 설치돼 있으면) → Noto Sans Coptic(웹폰트) → Segoe UI Historic(윈도우 기본) */
:root { --coptic: "Antinoou", "Noto Sans Coptic", "Segoe UI Historic", serif; }
.cpv .photo img { aspect-ratio: auto; max-height: 520px; object-fit: contain; }
.cp-label { color: var(--accent); font-weight: 700; }
.cp-cop { font-family: var(--coptic); font-size: 1.45rem; line-height: 1.6; margin-top: 6px; }
.cp-ko { margin-top: 4px; }
.cp-pro { background: var(--soft-2); border-radius: 6px; padding: 6px 10px; margin: 6px 0; font-size: .92rem; }
.cp-pro .cp-en { color: var(--muted); font-size: .85rem; }
.cp-inter { font-style: italic; }
.ntws.ntws { }
.cpw .c-gk { --h: 1.15rem; font-family: var(--greek); font-size: .72rem; color: #6f2da8; }
[data-theme="dark"] .cpw .c-gk { color: #c99bff; }
.cpw .c-r  { font-family: var(--coptic); direction: ltr; font-size: 1.35rem; }
.word.otw .c-c { --h: 3.2rem; font-family: var(--coptic); font-size: 1.85rem; background: #f3e3c3; color: #2a1d0c; direction: ltr; }   /* 콥트어 띠 */
[data-theme="dark"] .word.otw .c-c { background: #4a3a1c; color: #f6ead2; }
.cpw .c-seg { --h: 1.5rem; font-family: var(--coptic); font-size: .95rem; color: var(--muted); }
.cpw .c-g { --h: 1.35rem; font-size: .72rem; color: var(--text2); }
.dict .cop { font-family: var(--coptic); }
.dict .dhead .cop.big { font-size: 1.8rem; }
.dict .grk { font-family: var(--greek); }
.cp-pro { color: #c0151b; font-weight: 700; }            /* 1장 서문 한글도 빨강 굵게 */
.cp-pro .cp-en, .cp-pro b { font-weight: 400; color: var(--muted); }
.cp-pro b { color: var(--accent); font-weight: 700; }
[data-theme="dark"] .cp-pro { color: #ff7b7b; }

.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: #333; color: #fff; padding: 9px 16px; border-radius: 8px; font-size: 14px; z-index: 40; max-width: 90vw; }

@media (max-width: 760px) {
  .words { grid-template-columns: repeat(3, minmax(0, 1fr)); }   /* 휴대폰: 3칸 고정 */
  .bar-in { gap: 6px 8px; }
  .brand { display: none; }
}
