/* =========================
   Global Base & Tokens
   ========================= */
@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+KR:wght@400;600;700;800;900&display=swap');

:root{
  --brand:#166534;           /* 로고 딥그린 */
  --nav:#0f3e66;             /* 네비 활성 네이비 */
  --ink:#0f172a;             /* 본문 글자 */
  --muted:#6b7280;           /* 보조 텍스트 */
  --bg:#f6f9fc;              /* 페이지 배경 */
  --line:#e5e7eb;

  --accent-bg:#eef4fb;
  --accent-border:#cfe0f0;

  --header-h:56px;
  --radius:12px;
  --radius-pill:999px;

  --shadow-sm: 0 6px 16px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 14px 30px rgba(0, 0, 0, 0.10);

  --font:'Noto Sans KR', system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, "Apple SD Gothic Neo", "Malgun Gothic", sans-serif;

  --content-max-w: min(1440px, 100%);
  /* 카드 높이를 모든 페이지에서 동일하게 강제하고 싶다면 아래 값을 사용하세요.
     기본은 자동 높이(내용에 따라 증가). */
  --card-fixed-h: auto; /* 예: 220px */
  /* --card-min-w: 480px; *//* 데스크톱 기본 */
  --card-min-w: clamp(260px, 28vw, 320px);
  --footer-h: 82px; /* 현재 푸터 높이 */

  --label-color: #0a2540;
}

@media (max-width: 768px) {
  :root{ --card-min-w: clamp(240px, 90vw, 320px); }
}

*{ box-sizing:border-box; }
html, body {
  /* height: 100%; */
  margin: 0;
  padding: 0;
  overflow-x: hidden; /* 가로 스크롤 방지 */
}

body{
  min-height: 100dvh;            /* 한 화면 채움 */
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.55;
  font-family: var(--font);
  background-color: #f7fbff;
}

/* Common containers */
.section{ max-width:var(--content-max-w); margin:28px auto 64px; padding:0 16px; }
.container{ max-width:var(--content-max-w); margin:0 auto; padding:0 16px; }
main{ flex:1; }

/* A11y */
.sr-only{
  position:absolute; width:1px; height:1px; padding:0; margin:-1px;
  overflow:hidden; clip:rect(0,0,0,0); white-space:nowrap; border:0;
}

/* =========================
   Header
   ========================= */
.topbar{
  position: sticky; top: 0; z-index: 50;
  background: #fff; border-bottom: 1px solid var(--line);
}
.topbar .wrap{
  max-width:var(--content-max-w); margin:0 auto; height:var(--header-h); padding:0 16px;
  display:flex; align-items:center; justify-content:space-between;
}
.brand img{ height:32px; width:auto; display:block; }

.nav-main{ display:flex; gap:16px; }
.nav-main a{
  text-decoration:none; color:#203a4a;
  font-weight:700; font-size:15px;
  padding:8px 14px; border-radius:var(--radius-pill);
  transition:background .18s, color .18s, box-shadow .18s;
}
.nav-main a:hover{ background:var(--accent-bg); color:var(--nav); }
.nav-main a.active{ background:var(--nav); color:#fff; box-shadow:var(--shadow-sm); position:relative; }
.nav-main a:focus-visible{ outline:2px solid var(--nav); outline-offset:2px; }
@media (max-width:640px){
  .brand img{ height:28px; }
  .nav-main a{ font-size:14px; padding:7px 10px; }
}

/* =========================
   Page Title
   ========================= */
.page-title{ margin:24px auto 6px; padding:0 16px; max-width:var(--content-max-w); }
.page-title .h1{
  margin:0; font-weight:800;
  font-size:clamp(26px, 4vw, 36px);
  letter-spacing:-0.02em; line-height:1.25;
  color:#0f3e66;
}
.page-title .h1::before,
.page-title .h1::after{ content:none !important; }

/* =========================
   Filter Bar (공용) – 오른쪽 끝 정렬
   ========================= */
.section.date-filter{
  margin-top:0; 
  margin-bottom:16px;
  width:100%;
  display:flex;
  justify-content:flex-end;
  text-align:right;
}
.section.date-filter .filter-row{
  display:flex; 
  gap:12px; 
  align-items:center; 
  flex-wrap:wrap;
  margin-left:auto;
}
.filter-row label{
  display:flex; 
  align-items:center; 
  gap:8px;
  background:#fff; 
  border:1px solid var(--line); 
  border-radius:10px;
  padding:8px 12px; 
  box-shadow:0 2px 8px rgba(0, 0, 0, 0.04);
}
.filter-row span{ color:#5b6b76; font-size:13px; font-weight:700; }
.filter-row select{ border:0; outline:0; background:transparent; font-weight:700; color:var(--nav); }

/* =========================
   Cards Grid (주보/드림 공통)
   ========================= */
.month-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(var(--card-min-w), 1fr));
  gap: 20px;
  justify-content: center;
}

 /* 데스크톱에서  1 열고정 */
@media (min-width:800px) {
  .month-grid { grid-template-columns: repeat(auto-fill, minmax(var(--card-min-w), 1fr)); }
}
@media (min-width:1120px) {
  .month-grid { grid-template-columns: repeat(auto-fill, minmax(var(--card-min-w), 1fr)); }
}

/* =========================
   Card (공통 스타일)
   - 가로 고정 안정화: min-width:0
   - 긴 텍스트 줄바꿈/말줄임, 이미지 폭 제한
   ========================= */
.month-card {
  background:#fff; border:1px solid var(--line); border-radius:12px;
  padding:18px; box-shadow:var(--shadow-sm);
  transition:transform .18s, box-shadow .18s;
  display:flex; flex-direction:column;   /* 내부 정렬 */
  height:var(--card-fixed-h);            /* ← 필요 시 동일 높이 강제 (예: 220px) */
  min-height:unset;                      /* 기본은 자동 */

  /* === 추가: 가로 고정/내부 컨텐츠로 폭 밀림 방지 === */
  width:100%;
  min-width:0;                           /* 핵심 */
  overflow-wrap:anywhere;                /* 긴 단어도 강제 줄바꿈 */
  word-break:break-word;
}
.month-card * { min-width:0; } /* 자식이 폭을 밀지 못하게 */
.month-card img { max-width:100%; height:auto; display:block; }

.month-card:hover { transform:translateY(-3px); box-shadow:var(--shadow-md); }

/* =========================
   Bulletin (주보)
   ========================= */
.month-title{ margin:0 0 12px; font-size:18px; font-weight:800; color:#3f6786; }

.special{ display:flex; flex-wrap:wrap; gap:8px; margin:0 0 10px; }
.special-link{
  display:inline-block; text-decoration:none; font-weight:700; font-size:13px;
  color:var(--nav); background:#eef4fb; border:1px solid #cfe0f0;
  padding:6px 10px; border-radius:10px; transition:background .18s, box-shadow .18s, color .18s;
}
.special-link:hover{ background:#e6f0fb; box-shadow:0 2px 8px rgba(0,0,0,.06); }

.week-buttons{ display:flex; flex-wrap:wrap; gap:10px; margin-top:auto; }
.week-buttons .btn{
  display:inline-block; text-decoration:none; font-weight:700; font-size:14px;
  padding:7px 12px; border-radius:10px; color:#4a6c89; background:#f7fbff; border:1.5px solid #d3dfec;
  transition:background .18s, color .18s, border-color .18s, box-shadow .18s, transform .05s;
}
.week-buttons .btn:hover{
  background:var(--nav); color:#fff; border-color:var(--nav);
  box-shadow:0 2px 8px rgba(15,62,102,.18);
}
.week-buttons .btn:active{ transform:translateY(1px); }

/* =========================
   Dream (찬양단)
   ========================= */
.dream-head{ display:flex; align-items:baseline; justify-content:space-between; gap:12px; }
.dream-date{ margin:0; font-size:18px; font-weight:800; color:#3f6786; }
.dream-note{ margin:0; color:#6b7280; font-size:13px; }

.songlist{
  list-style:none; padding:0; margin:10px 0 14px 0;
  display:grid; row-gap:6px; color:#3b4752;
  font-size:13px; line-height:1.5;
}
@media (max-width:520px){ .songlist{ font-size:12.5px; } }

.action-bar{ display:flex; flex-wrap:wrap; gap:10px; margin-top:auto; }
.chip{
  display:inline-flex; align-items:center; gap:6px;
  padding:8px 12px; border-radius:10px; font-weight:700; font-size:13.5px;
  text-decoration:none; color:#4a6c89; background:#f7fbff; border:1.5px solid #d3dfec;
  transition: background .18s, color .18s, border-color .18s, box-shadow .18s, transform .05s;
}
.chip:hover{ background:var(--nav); color:#fff; border-color:var(--nav); box-shadow:0 2px 8px rgba(15,62,102,.18); }
.chip:active{ transform:translateY(1px); }

.chip-icon{ width:40px; height:40px; padding:0; justify-content:center; border-radius:10px; }
.chip-icon svg{ width:18px; height:18px; display:block; }

.action-bar .chip span:not(.sr-only){ display:none; }

.svg-sprite{ display:none; }

/* =========================
   Footer
   ========================= */
.site-footer{
  border-top:1px solid var(--line);
  background:#fff; color:#8a909a; text-align:center;
}
.site-footer .container{ padding:30px 16px; font-size:13.5px; letter-spacing:.15px; }

/* =========================
   필터적용
   ========================= */
[hidden] { display: none !important; }
.month-card[hidden], .dream-card[hidden]{ display: none !important; }

/* =========================
   동영상 모달(정중앙 고정)
   ========================= */
.video-modal{
  position: fixed; 
  inset: 0; 
  z-index: 9999;
  background: rgba(0,0,0,.6);
}

.video-modal > .video-modal-content{
  position: fixed; 
  top: 50%; 
  left: 50%;
  transform: translate(-50%, -50%);
  width: min(92vw, 960px);
  max-height: 85vh; 
  background: #000;
  border-radius: 12px; 
  padding: 0;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
  overflow: hidden;
}
#videoPlayer{
  display:block; width:100%; height:auto; max-height:85vh;
  margin:0 !important; object-fit:contain;
}
.video-modal-close{
  color:#fff; 
  text-shadow:0 1px 2px rgba(0, 0, 0, 0.6);
}

/* =========================================
   홈 히어로(최소 스타일) – 스크롤 없이 중앙 정렬
   ========================================= */
/* 홈 히어로: 화면 중앙 정렬 */
.home main.section{
  margin: 0;
  padding: 0;
  max-width: 100%;
  flex: 1;              /* 남는 공간 채우기 */
  display: flex;
}

/* 홈 비주얼 배너 */
.home .visual-banner{
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}

.visual-banner-image{
  width: min(18vw, 324px, 100%);
  max-height: 56.25vh;
  height: auto;
  object-fit: contain;
}

@media (max-width: 768px){
  .visual-banner-image{
    width: min(60vw, 324px, 100%);
  }
}

/* 안전망: 가로 스크롤 절대 금지 */
html, body{ overflow-x: hidden; }

/* ===== Hymn: 검색 ===== */
.hymn-search{
  margin:0 0 20px;
  padding:0 16px;
}
.hymn-search-input{
  width:100%;
  padding:14px 16px;
  border-radius:12px;
  border:1.5px solid var(--line);
  font-size:15px;
  font-weight:600;
  background:#fff;
  box-shadow:0 6px 18px rgba(15, 62, 102, 0.08);
  transition:border-color .18s, box-shadow .18s;
}
.hymn-search-input:focus{
  outline:none;
  border-color:var(--nav);
  box-shadow:0 0 0 3px rgba(15, 62, 102, 0.18);
}
.hymn-search-status{
  margin:12px 0 0;
  color:#3f6786;
  font-size:13px;
  font-weight:700;
}
.hymn-search-options{
  margin:16px 0 0;
  display:flex;
  gap:10px;
}
.hymn-search-option{
  display:flex;
  align-items:center;
  gap:6px;
  padding:8px 12px;
  border-radius:12px;
  border:1.5px solid var(--line);
  background:#fff;
  color:#0f3e66;
  font-weight:600;
  font-size:13px;
  cursor:pointer;
  transition:border-color .18s, background .18s, color .18s, box-shadow .18s;
}
.hymn-search-option input{
  accent-color:var(--nav);
}
.hymn-search-option:hover{
  border-color:var(--nav);
  box-shadow:0 4px 14px rgba(15, 62, 102, 0.12);
}
.hymn-search-option input:checked + span{
  color:var(--nav);
  font-weight:700;
}
.hymn-results-wrapper{
  padding:0 16px;
  margin:0 0 20px;
}
.hymn-results{
  list-style:none;
  margin:0;
  padding:0;
  display:flex;
  flex-direction:column;
  gap:8px;
}
.hymn-result{
  display:flex;
  align-items:center;
  justify-content:space-between;
  width:100%;
  padding:12px 16px;
  border-radius:12px;
  border:1.5px solid var(--line);
  background:#fff;
  color:#0f3e66;
  font-weight:700;
  font-size:15px;
  text-align:left;
  cursor:pointer;
  transition:background .18s, color .18s, border-color .18s, box-shadow .18s, transform .05s;
}
.hymn-result:hover{
  background:var(--nav);
  color:#fff;
  border-color:var(--nav);
  box-shadow:0 4px 12px rgba(15, 62, 102, 0.18);
}
.hymn-result:focus-visible{
  outline:2px solid var(--nav);
  outline-offset:2px;
}
.hymn-result.is-active{
  background:var(--nav);
  color:#fff;
  border-color:var(--nav);
  box-shadow:0 4px 14px rgba(15, 62, 102, 0.25);
}
.hymn-results-empty{
  margin:8px 0 0;
  padding:16px 0;
  color:#6b7280;
  font-size:14px;
  text-align:center;
}
.hymn-viewer{
  padding:0 16px 40px;
}
.hymn-viewer-placeholder{
  margin:0;
  color:#6b7280;
  font-size:14px;
}
.hymn-viewer-figure{
  margin:0;
  display:flex;
  flex-direction:column;
  gap:16px;
}
.hymn-viewer-title{
  margin:0;
  font-size:18px;
  font-weight:800;
  color:#0f3e66;
}
.hymn-viewer img{
  width:100%;
  max-width: min(100%, 720px);
  border-radius:14px;
  border:1px solid #d9e2ec;
  box-shadow:0 18px 36px rgba(15, 62, 102, 0.18);
  background:#fff;
}
.hymn-viewer-lyrics{
  margin:0;
  color:#3b4752;
  font-size:14px;
  line-height:1.6;
  white-space:pre-line;
}

.btn-open{background:#0f3e66;color:#fff;border-radius:10px;padding:8px 14px;margin-right:6px;}

.btn-download{border-radius:10px;padding:8px 14px;border:1.5px solid #d3dfec;color:#4a6c89;background:#f7fbff;}
.btn-download:hover{background:#0f3e66;color:#fff;border-color:#0f3e66;}

.week-buttons .btn-open{background:#0f3e66;color:#fff;border:1.5px solid #0f3e66;border-radius:10px;padding:8px 14px;font-weight:700;}
.week-buttons .btn-open:hover{background:#134a84;}
.week-buttons .btn-download{background:#f7fbff;color:#4a6c89;border:1.5px solid #d3dfec;border-radius:10px;padding:8px 14px;font-weight:700;}
.week-buttons .btn-download:hover{background:#0f3e66;color:#fff;border-color:#0f3e66;}

/* =========================
   Card Utility
   ========================= */
.card{
  background:#fff;
  border:1px solid var(--line);
  border-radius:12px;
  padding:24px;
  box-shadow:var(--shadow-sm);
}

@media (max-width:640px){
  .card{ padding:18px; }
}

/* =========================
   Tabs (Bible page)
   ========================= */
.tab-container{ display:flex; flex-direction:column; gap:20px; width:100%; box-sizing:border-box; }
.tab-list{
  display:flex;
  gap:10px;
  align-items:flex-end;
  border-bottom:1px solid var(--line);
  padding-bottom:6px;
}
.tab{
  border:0;
  background:transparent;
  font-weight:700;
  font-size:16px;
  color:var(--muted);
  padding:10px 14px;
  border-radius:0;
  cursor:pointer;
  border-bottom:3px solid transparent;
  transition:color .18s, border-color .18s;
}
.tab:hover{
  color:var(--nav);
  border-bottom-color:rgba(15,62,102,0.4);
}
.tab.active{
  color:var(--nav);
  border-bottom-color:var(--nav);
  box-shadow:none;
}
.tab-panel{
  display:none;
  width:100%;
  box-sizing:border-box;
}
.tab-panel.active{
  display:flex;
  flex-direction:column;
  gap:24px;
  width:100%;
  align-items:stretch;
}
.tab-panel.active > *{
  width:100%;
  flex:0 0 100%;
  box-sizing:border-box;
}
.tab-panel .card{
  width:100%;
  max-width:100%;
  box-sizing:border-box;
}

/* =========================
   Bible Reader
   ========================= */
.bible-reader{ display:flex; flex-direction:column; gap:20px; }
.bible-reader,
.search-card{
  width:100%;
  box-sizing:border-box;
}
/*
.reader-controls{
  display:flex;
  flex-direction:column;
  gap:14px;
}
*/
.reader-controls {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
}

.reader-controls .select-controls {
  display:flex;
  flex-wrap:nowrap;
  gap:14px;
  width:100%;
}

.field{
  display:flex;
  flex-direction:column;
  gap:6px;
  min-width:100px;
  width:auto;
}

.field-label{
  font-size:13px;
  font-weight:700;
  color:#4a6c89;
}

.field select,
.field input,
.field textarea{
  border:1px solid var(--line);
  border-radius:10px;
  padding:10px 12px;
  font-size:15px;
  font-family:var(--font);
  background:#fff;
  color:var(--ink);
  width:100%;
  min-width:0;
}

.field textarea{
  min-height:120px;
  resize:vertical;
  line-height:1.6;
}

.select-controls .field{
  flex:1;
  min-width:0;
}

.font-control-field{
  width:100%;
}
.field-inline .font-control{
  display:flex;
  align-items:center;
  gap:10px;
}
.reader-controls .field-inline{
  flex: 1 1 auto;
  display:flex;
  flex-direction:row;
  align-items:center;
  gap:12px;
  min-width:0;
}
.reader-controls .field-inline .field-label{
  margin:0;
  flex:0 0 auto;
  white-space:nowrap;
}
.reader-controls .field-inline .font-control{
  flex:1 1 auto;
  min-width:0;
}

/* ===== Bible Reader: Compare + Font Size Left-aligned ===== */
/* 두 번째 줄: 대조역본 보기 / 글자 크기 */
.reader-controls-row {
  display: flex;
  flex-direction: row;
  align-items: flex-end;     /* ✅ 아래 라인 기준으로 맞추기 */
  justify-content: flex-start; /* ✅ 왼쪽 정렬 */
  gap: 16px;
  margin-top: 8px;
  width: 100%;
  box-sizing: border-box;
  padding-left: 4px;
}

/* 왼쪽: 대조역본 보기 */
.compare-wrap {
  display: inline-flex;
  align-items: baseline;   /* ✅ 텍스트 기준선 정렬 */
  gap: 6px;
  white-space: nowrap;
  color: #0f3e66;
  font-weight: 600;
}
.compare-wrap input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--nav, #0f3e66);
  cursor: pointer;
  margin: 0;
  transform: translateY(2px); /* ✅ 살짝 아래로 보정 */
}

/* 오른쪽: 글자 크기 */
.font-wrap {
  display: inline-flex;
  align-items: baseline; /* ✅ 라벨과 슬라이더 높이 맞춤 */
  gap: 8px;
  color: #0f3e66;
  font-weight: 600;
}
.font-wrap label {
  font-size: 14px;
}
.font-control {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  width: 160px;
}
#fontSizeControl {
  flex: 1;
  cursor: pointer;
}
#fontSizeValue {
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
}

/* 반응형: 모바일일 때 약간 더 붙여줌 */
@media (max-width: 520px) {
  .reader-controls-row {
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 6px;
  }
  .font-wrap {
    margin-left: 6px;
  }
}

/* compare-toggle styles */

.compare-toggle{
  display:flex;
  align-items:center;
  gap:8px;
  padding:0;
  border:0;
  background:none;
  width:auto;
  flex: 0 0 auto;
  white-space: nowrap;
  min-width:0;
}

.compare-toggle input[type="checkbox"]{
  width:18px;
  height:18px;
  accent-color:var(--nav);
  cursor:pointer;
}

.compare-toggle span{
  font-size:14px;
  font-weight:600;
  color:#0f3e66;
  cursor:pointer;
}

.font-control-field{
  flex: 1 1 auto;
  min-width:0;
}

.bible-reader.compare-active .bible-reader-content{ display:none; }
.bible-reader.compare-active .reader-status{ display:none; }

.bible-reader-compare{
  display:none;
  max-height:70vh;
  overflow-y:auto;
  padding:0;
}

.bible-reader-compare.active{
  display:block;
}

.compare-head{
  display:flex;
  gap:0;
  align-items:center;
  justify-content:stretch;
  margin-bottom:0;
  padding:10px 8px;
  background:#e0e7f3;
  /* border-bottom:1px solid #dde6ef; */
  border:1px solid #dde6ef;
  border-radius:12px 12px 0 0;
  position:sticky;
  top:0;
  z-index:12;
}
.bible-reader-compare .compare-head {
  padding: 4px 8px;
  height: 36px;
}

@media (max-width:619px){
  .compare-head{
    display:none;
  }
}

.compare-label{
  /*
  font-weight:800;
  font-size:16px;
  */
  color:#0f3e66;
  text-align:center;
  padding:6px 0;
  flex:1;
  border-right:1px solid #dde6ef;
}
.bible-reader-compare .compare-label {
  font-size: 16px;
  font-weight: 600;
}

.compare-label:last-child{
  border-right:none;
}

.compare-pairs{
  display:block;
  padding:0;
  border:1px solid #dde6ef;
  border-top:none;
  border-radius:0 0 12px 12px;
  background:#f9fbff;
}

.compare-chapter-title{
  font-weight:800;
  font-size:1.1em;
  color:#0f3e66;
  padding:12px 8px;
  margin-bottom:4px;
  background:#f0f5fa;
  border-bottom:2px solid rgba(15,62,102,0.15);
}

.compare-titles{
  background:#f9fbff !important;
  border-bottom:2px solid #dde6ef !important;
}

.compare-titles .pair-side{
  /*padding:10px 8px;*/
  padding:1px 8px;
  border-right:1px solid #dde6ef;
}

.compare-titles .pair-side:last-child{
  border-right:none;
}
.compare-heading-row{
  background:#f9fbff;
  border-bottom:1px solid #dde6ef;
}
.compare-heading-side{
  padding:6px 8px;
}
.compare-heading-empty{
  padding:6px 8px;
  min-height:18px;
}
.compare-notes{
  background:#f9fbff;
  border-bottom:1px dashed rgba(15,62,102,0.08);
}
.pair-notes-side{
  padding:8px;
}
.pair-notes-side .chapter-note-strip{
  margin:0;
}

.verse-title-text{
  /*
  font-weight:800;
  font-size:1em;
  color:#0f3e66;
  */
  font-weight:600;
  color:#1d4b68;
  display:block;
}
/* Title small parentheses style */
.verse-title-text .alt-title{
  font-size:0.85em;
  font-weight:600;
  color: #557188;
  margin-left:6px;
}

/* Hide title on narrow screens to save space */
@media (max-width:619px){
  .compare-chapter-title{
    display:none;
  }
  .compare-titles{
    display:none;
  }
}

/* Wide screens (>=620px): side-by-side per verse */
@media (min-width:620px){
  .compare-pair{
    display:grid;
    grid-template-columns: 1fr 1fr;
    gap:0;
    align-items:start;
    padding:6px 8px;   /* top/bottom , left/right*/
    background:transparent;
    border-bottom:1px dashed rgba(15,62,102,0.04);
  }

  .compare-pair:last-child{
    border-bottom:none;
  }

  .pair-side{
    display:flex;
    gap:10px;
    align-items:flex-start;
    padding:0 8px;
    border-right:1px solid #dde6ef;
  }

  .pair-side:last-child{
    border-right:none;
  }

  .pair-side .verse-number{
    min-width:36px;
    font-weight:800;
    color:#0f3e66;
  }

  .pair-side .verse-text{
    flex:1;
  }

  .pair-side.is-highlight{
    background-color: #fff4d6;
    border-radius: 4px;
    box-shadow: 0 2px 8px rgba(255, 186, 73, 0.2);
  }
}

/* Narrow screens (<620px): stack vertically */
@media (max-width:619px){
  .compare-titles{
    display:none;
  }

  .compare-pair{
    display:flex;
    flex-direction:column;
    gap:0;
    align-items:stretch;
    padding:4px 8px;   /* top/bottom , left/right*/
    background:transparent;
    border-bottom:1px dashed rgba(15,62,102,0.04);
  }

  .compare-pair:last-child{
    border-bottom:none;
  }

  .pair-side{
    display:flex;
    gap:10px;
    align-items:flex-start;
    padding:10px 8px;
    border-bottom:1px dashed rgba(15,62,102,0.04);
    border-right:none;
    min-width:0;
  }

  /* Swap backgrounds: first-child becomes "comparison" color, last-child becomes "selected" color */
  .pair-side:first-child{
    /* previously selected background, now swapped */
    background:#f5f8fb;
    border-left:4px solid #0f3e66; /* left vertical line: selected color */
  }

  .pair-side:last-child{
    border-bottom:none;
    background:#fafbfc;
    border-left:4px solid #7a9fb5; /* left vertical line: comparison color */
  }

  /* Hide verse-number visually for comparison side but keep spacing so text aligns */
  .pair-side:last-child .verse-number{
    visibility:hidden; /* preserves layout */
  }

  .pair-side .verse-number{
    min-width:36px;
    font-weight:800;
    color:#0f3e66;
  }

  .pair-side .verse-text{
    flex:1;
  }

  .pair-side.is-highlight{
    background-color: #fff4d6;
    border-radius: 4px;
    box-shadow: 0 2px 8px rgba(255, 186, 73, 0.2);
  }
}

.font-control input[type="range"]{
  width:160px;
  accent-color:var(--nav);
}
.reader-controls .field-inline .font-control input[type="range"]{
  width:clamp(100px, 30vw, 200px);
}
.font-size-display{
  font-size:13px;
  font-weight:700;
  color:#0f3e66;
  min-width:44px;
  text-align:right;
}

/* Narrow screen: adjust font control width */
@media (max-width: 600px) {
  .reader-controls .field-inline .font-control input[type="range"]{
    width: clamp(80px, 25vw, 150px);
  }
}

.reader-status{
  font-size:14px;
  font-weight:600;
  color:#4a6c89;
}
.reader-status.is-hidden{ display:none; }
.bible-reader-content{
  display:flex;
  flex-direction:column;
  gap:12px;
  background:#f9fbff;
  border:1px solid #dde6ef;
  border-radius:14px;
  padding:20px;
  max-height:70vh;
  overflow-y:auto;
}
.chapter-header{
  margin-bottom:6px;
  padding-bottom:10px;
  border-bottom:1px solid rgba(15,62,102,0.1);
}
.chapter-title-main{
  margin:0;
  font-weight:800;
  font-size:20px;
  color:#0f3e66;
}
.chapter-subtitle{
  margin:6px 0 0;
  font-weight:600;
  color:#1d4b68;
}
.chapter-note-strip{
  display:flex;
  flex-wrap:wrap;
  gap:8px;
  margin:8px 0 0;
}
.chapter-note-strip .note-inline{
  display:inline-flex;
  align-items:center;
  margin:0;
}
.chapter-note-strip .note-trigger-visual{
  margin:0 4px 0 0;
  transform:none;
}
.chapter-note-strip .note-popover{
  min-width:180px;
}
.verse-line{
  display:flex;
  gap:12px;
  line-height:1.7;
  font-size:var(--reader-font-size, 16px);
  color:#123248;
  border-bottom:none;
}
.verse-line.is-highlight{
  background:#fff4d6;
  border-radius:10px;
  padding:6px 10px;
  box-shadow:0 6px 18px rgba(255, 186, 73, 0.25);
}
.verse-number{
  flex:none;
  min-width:32px;
  font-weight:800;
  color:#0f3e66;
  font-size:calc(var(--reader-font-size, 16px) * 0.9);
}
.verse-text{ flex:1; word-break:keep-all; }
.verse-title{
  display:block;
  font-weight:700;
  font-size:0.95em;
  color:#0f3e66;
  margin-bottom:6px;
}
.reader-nav{
  display:flex;
  justify-content:space-between;
  gap:12px;
  flex-wrap:nowrap;
}
.reader-nav .btn-pill{ flex:1; }
.btn-pill{
  border:1.5px solid #d6e4f5;
  background:#ffffff;
  color:#0f3e66;
  border-radius:var(--radius-pill);
  padding:10px 20px;
  font-weight:700;
  font-size:15px;
  cursor:pointer;
  transition:background .18s, transform .18s;
}
.btn-pill:disabled{
  background:#eef2f8;
  border-color:#dbe3ef;
  color:#94a3b8;
  cursor:not-allowed;
  box-shadow:none;
}
.btn-pill:not(:disabled):hover{
  background:#0f3e66;
  color:#fff;
  border-color:#0f3e66;
  box-shadow:0 4px 12px rgba(15,62,102,0.18);
}
.btn-pill:not(:disabled):active{ transform:translateY(1px); }

.verse-text .note-inline{
  color:#204f8c;
  font-weight:500;
}
.note-inline{
  position:relative;
  display:inline-block;
}
.note-trigger-visual{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  width:18px;
  height:18px;
  min-width:16px;
  border:1px solid rgba(220,38,38,0.9);
  border-radius:4px;
  background:linear-gradient(145deg, #fff5f5 0%, #ffe4e4 100%);
  color:#b91c1c;
  font-weight:700;
  padding:0;
  margin:0 6px 0 4px;
  transform:translateY(3px);
  cursor:pointer;
  box-shadow:0 2px 6px rgba(190,18,60,0.2);
  transition:transform .18s ease, box-shadow .18s ease, background .18s ease, color .18s ease;
  vertical-align:baseline;
}
.note-trigger-visual:hover{
  background:linear-gradient(145deg, #ffecec 0%, #ffd3d3 100%);
  color:#991b1b;
  transform:translateY(-1px);
  box-shadow:0 4px 10px rgba(190,18,60,0.28);
}
.note-inline.open .note-trigger-visual{
  background:linear-gradient(145deg, #fee2e2 0%, #fca5a5 100%);
  color:#7f1d1d;
  box-shadow:0 5px 12px rgba(190,18,60,0.32);
}
.note-trigger-visual:focus-visible{
  outline:2px solid rgba(248,113,113,0.85);
  outline-offset:1px;
}
.note-superscript{
  font-size:0.68em;
  vertical-align:super;
  line-height:0;
}
.note-popover{
  position:absolute;
  top:calc(100% + 14px);
  left:50%;
  transform:translate(calc(-50% + var(--note-popover-shift, 0px)), 0);
  min-width:200px;
  max-width:min(280px, calc(100vw - 48px));
  background:#ffffff;
  border:1px solid #d6e4f5;
  border-radius:12px;
  padding:16px 18px;
  font-size:13px;
  color:#1f3d55;
  box-shadow:0 14px 32px rgba(15,62,102,0.18);
  opacity:0;
  visibility:hidden;
  z-index:40;
  transition:opacity .18s, transform .18s, visibility .18s;
}
.note-popover-text{
  margin:0;
  line-height:1.6;
  word-break:keep-all;
}
.note-popover::before{
  content:"";
  position:absolute;
  top:-12px;
  left:var(--note-popover-arrow, 50%);
  transform:translateX(-50%);
  border-width:0 10px 12px 10px;
  border-style:solid;
  border-color:transparent transparent #ffffff transparent;
  filter:drop-shadow(0 -2px 2px rgba(15,62,102,0.08));
}
.note-inline.open .note-popover{
  opacity:1;
  visibility:visible;
  transform:translate(calc(-50% + var(--note-popover-shift, 0px)), 0);
}
.note-inline.open .note-popover[data-align="start"]{
  left:0;
  right:auto;
  transform:translate(var(--note-popover-shift, 0px), 0);
}
.note-inline.open .note-popover[data-align="end"]{
  left:auto;
  right:0;
  transform:translate(var(--note-popover-shift, 0px), 0);
}
@media (max-width:640px){
  .bible-reader-content{
    max-height:none;
    overflow:visible;
  }
  .bible-reader-compare{
    max-height:none;
    overflow:visible;
  }
  .verse-line{
    padding-bottom:12px;
    border-bottom:none;
    align-items:flex-start;
  }
  .verse-number{ font-size:14px; min-width:28px; }
  .reader-nav{ flex-wrap:nowrap; gap:8px; }
  .reader-nav .btn-pill{ flex:1; }
  .font-control input[type="range"]{ width:100%; }
}

@media (min-width:768px){
  .note-popover-text{
    overflow-wrap:anywhere;
  }
}

/* =========================
   Search (Tab 2)
   ========================= */
.search-card{
  display:flex;
  flex-direction:column;
  gap:22px;
  width:100%;
  max-width:var(--content-max-w);
  box-sizing:border-box;
  align-self:stretch;
}
.search-form,
.search-status,
.search-section,
.search-results{
  width:100%;
  box-sizing:border-box;
}
.search-form{ display:flex; flex-direction:column; gap:18px; }
.search-form > .field{ width:100%; }
.search-grid{
  display:grid;
  grid-template-columns:repeat(2, minmax(0, 1fr));
  gap:16px;
  align-items:flex-end;
}
.search-grid .field{
  width:100%;
}
.search-grid .field:nth-child(odd){ justify-self:stretch; }
.search-grid .field:nth-child(even){ justify-self:stretch; }
.search-grid .field{ min-width:0; }
/* 입력 컨트롤이 칸 안에서 넘치지 않도록 */
.search-grid select,
.search-grid input[type="number"],
.search-grid input[type="text"]{
  width:100%;
  min-width:0;
  box-sizing:border-box;
}

/* 두 칸 전체를 써야 하는 요소 */
.field-checkbox,
.search-actions{
  grid-column:1 / -1;
}


@media (max-width:640px){
  .search-grid{
    grid-template-columns:1fr;
  }
}
.field-caption{
  font-size:13px;
  color:#4a6c89;
  margin-top:6px;
  line-height:1.5;
}
.field-caption strong{
  color:#0a2540;
}
.caption-term{
  color:#0b63ce;
  font-weight:600;
}
.field-warning{
  margin:-6px 0 10px;
  padding:9px 12px;
  border-radius:8px;
  background:#fff7f7;
  color:#dc2626;
  font-size:13px;
  font-weight:600;
  border:1px solid rgba(248,113,113,0.35);
}
.chat-submit{
  align-self:flex-start;
  margin-top:4px;
}

.field-checkbox{
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: auto 1fr;
  /* align-items: start; */
  align-items: center;
  column-gap: 8px;
  width: 100%;
  padding: 6px 10px;
  border: 1px solid #d5e2ff;
  border-radius: 8px;
  background: #f5f8ff;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.6);
  white-space: normal;
  word-break: keep-all;
  overflow-wrap: break-word;
}

.field-checkbox input[type="checkbox"]{
  width: 18px;
  height: 18px;
  min-width: 18px;
  margin: 0;
  accent-color: #2563eb;
  align-self: center;
  flex: 0 0 18px;  
}

.field-checkbox span{
  font-size: 14px;
  font-weight: normal;
  /* color: #0a2540; */
  color: #475569;
  line-height: 1.55;
}

.search-grid .field-checkbox{
  width: 100%;
  justify-self: stretch;
}

.field-checkbox .cb-em{
  color: var(--label-color) !important;   /* 우선순위 충돌 방지 */
  font-weight: normal;
}

.form-hint{
  font-size:13px;
  color:#4a6c89;
  background:#eef4fb;
  border:1px dashed #b7c8d9;
  padding:10px 12px;
  border-radius:10px;
}
.form-hint code{
  font-family:ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, \"Liberation Mono\", \"Courier New\", monospace;
  background:#fff;
  padding:2px 4px;
  border-radius:6px;
}
.search-actions{
  display:flex;
  gap:10px;
  flex-wrap:nowrap;
}
.search-actions .btn-primary,
.search-actions .btn-secondary{
  flex:1 1 0;
  min-width:0;
}
.btn-primary,
.btn-secondary{
  border-radius:var(--radius-pill);
  padding:10px 18px;
  font-weight:700;
  font-size:15px;
  cursor:pointer;
  transition:background .18s, color .18s, transform .18s;
}
.btn-primary{
  background:var(--nav);
  border:1px solid var(--nav);
  color:#fff;
}
.btn-primary:hover{ background:#104d87; }
.btn-primary:active{ transform:translateY(1px); }
.btn-secondary{
  background:#fff;
  border:1px solid #cbd5e1;
  color:#4a6c89;
}
.btn-secondary:hover{
  background:#e8f1fb;
  border-color:#94b4d8;
  color:#104d87;
}
.search-status{
  font-size:14px;
  font-weight:600;
  color:#104d87;
}
.search-section h2{
  margin:0 0 10px;
  font-size:18px;
  font-weight:800;
  color:#0f3e66;
}
.search-results{
  list-style:none;
  margin:0;
  padding:0;
  display:flex;
  flex-direction:column;
  gap:18px;
}
.search-item{
  padding:18px;
  border:1px solid #d9e5f3;
  border-radius:12px;
  background:#f9fcff;
  box-shadow:0 4px 12px rgba(15,62,102,0.04);
}
.search-item[data-clickable="reader"]{
  cursor:pointer;
  transition:background .18s, transform .18s, box-shadow .18s;
}
.search-item[data-clickable="reader"]:hover{
  background:#eef6ff;
  transform:translateY(-1px);
  box-shadow:0 8px 24px rgba(15,62,102,0.12);
}
.search-item[data-clickable="reader"]:focus{
  outline:2px solid #94bfff;
  outline-offset:3px;
}
.search-item.hymn{
  background:#fffaf5;
  border-color:#f7d8b3;
  box-shadow:0 4px 12px rgba(208,138,54,0.12);
}
.search-item.hymn .search-hymn-link{
  display:block;
  text-decoration:none;
  text-decoration-line:none;
  -webkit-text-decoration-line:none;
  text-decoration-color:transparent;
  color:inherit;
}
.search-item.hymn .search-hymn-link:focus-visible{
  outline:2px solid rgba(251,146,60,0.8);
  outline-offset:4px;
  border-radius:10px;
}
.search-item.empty{
  text-align:center;
  color:#6b7280;
  font-weight:600;
  background:#fff;
}
.search-ref{
  margin:0 0 6px;
  font-weight:800;
  color:#0f3e66;
  display:flex;
  align-items:center;
  gap:8px;
  flex-wrap:wrap;
}
.search-ref-text{
  display:inline-flex;
  align-items:center;
}
.search-version-badge{
  display:inline-flex;
  align-items:center;
  padding:2px 9px;
  font-size:12px;
  font-weight:700;
  border-radius:999px;
  background:#e9f2ff;
  color:#1a3e68;
  border:1px solid rgba(52,116,189,0.22);
}
.search-text{
  margin:0;
  color:#1f3d55;
  line-height:1.7;
}
.search-meta{
  margin:10px 0 0;
  font-size:13px;
  color:#52677d;
}
.search-text mark{
  background:#ffedc2;
  border-radius:6px;
  padding:0 3px;
}
.term-context-list{
  list-style:none;
  padding:0;
  margin:0 0 12px;
  display:flex;
  flex-direction:column;
  gap:14px;
}
.term-context-item{
  border:1px solid #d9e5f3;
  border-radius:12px;
  padding:14px;
  background:#ffffff;
  box-shadow:0 3px 10px rgba(15,62,102,0.04);
}
.term-context-head{
  display:flex;
  flex-wrap:wrap;
  align-items:center;
  gap:8px;
  margin-bottom:6px;
  color:#0f3e66;
}
.term-context-head strong{
  font-size:16px;
}
.term-context-tags{
  display:flex;
  flex-wrap:wrap;
  gap:4px;
}
.term-context-tag{
  display:inline-flex;
  align-items:center;
  padding:2px 8px;
  border-radius:999px;
  background:#eef4ff;
  color:#1d3a5f;
  font-size:12px;
  font-weight:600;
}
.term-context-desc{
  margin:0 0 6px;
  font-weight:600;
  color:#1d3553;
}
.term-context-example{
  margin:0 0 6px;
  font-style:italic;
  color:#4a6c89;
}
.term-context-alias{
  margin:0;
  font-size:13px;
  color:#5c6c7d;
}

@media (max-width:640px){
  .search-grid{ grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .search-actions{
    flex-direction:row;
    flex-wrap:nowrap;
  }
}

/* =========================
   Chat (Tab 3)
   ========================= */
.chat-card textarea{
  border:1px solid #cbd5f5;
  background:#fdfefe;
  box-shadow:0 4px 12px rgba(15,62,102,0.04);
}
.chat-card textarea:focus{
  outline:none;
  border-color:#94bfff;
  box-shadow:0 0 0 3px rgba(148,191,255,0.35);
}
.chat-section .chat-answer{
  border:1px solid #d9e5f3;
  border-radius:12px;
  padding:18px;
  background:#f9fcff;
  min-height:80px;
  color:#1f3d55;
  line-height:1.7;
  font-size:15px;
  box-shadow:0 4px 12px rgba(15,62,102,0.04);
}
.chat-answer p{
  margin:0 0 12px;
}
.chat-answer p:last-child{
  margin-bottom:0;
}
.chat-answer.empty{
  display:flex;
  align-items:center;
  justify-content:center;
  text-align:center;
  color:#6b7280;
  background:#fff;
}
.chat-citations{
  list-style:none;
  padding:0;
  margin:0;
  display:flex;
  flex-direction:column;
  gap:12px;
}
.chat-citation{
  border-left:3px solid #94bfff;
  border-radius:10px;
  padding:10px 14px;
  background:#f5f9ff;
  color:#1f3d55;
  box-shadow:0 3px 10px rgba(15,62,102,0.05);
}
.chat-citation[data-clickable="reader"]{
  cursor:pointer;
  transition:background .18s, transform .18s, box-shadow .18s;
}
.chat-citation[data-clickable="reader"]:hover{
  background:#eef6ff;
  transform:translateY(-1px);
  box-shadow:0 6px 18px rgba(15,62,102,0.12);
}
.chat-citation strong{
  display:block;
  font-size:14px;
  color:#0f3e66;
  margin:0 0 6px;
}
.chat-citation p{
  margin:0;
  line-height:1.6;
  color:#1d3553;
}
.chat-citation p mark{
  background:#ffedc2;
  border-radius:4px;
  padding:0 3px;
}

.chapter-fixed-title {
  font-weight: 800;
  font-size: 1.25em;
  color: #0f3e66;
  margin: 8px 0 12px 4px;
  text-align: left;
  border-bottom: 2px solid #e5edf5;
  padding-bottom: 4px;
  display:flex;
  align-items:center;
  gap:10px;
  flex-wrap:wrap;
}
@media (max-width:640px){
  .chapter-fixed-title{
    position:sticky;
    top:0;
    background:#fff;
    z-index:6;
    padding-top:6px;
  }
}

.reader-meta{
  margin:6px 0 18px;
}
.chapter-version-label{
  margin:0 0 6px;
  font-weight:700;
  color:#5a6d82;
  letter-spacing:-0.01em;
}
.section-heading{
  margin:18px 0 8px;
  padding:4px 12px;
  border-left:4px solid #d6e4f5;
  background:#f9fbff;
  border-radius:4px;
}
.section-heading-compact{
  margin:12px 0 4px;
  padding:4px 10px;
}
.section-heading-text{
  margin:0;
  font-weight:700;
  color:#0f3e66;
}
.section-heading-subtitle{
  margin:4px 0 0;
  font-size:0.95em;
  color:#395872;
}
.compare-pair .section-heading{
  border-left-width:3px;
}

.voice-input-group{
  display:flex;
  gap:0.5rem;
  align-items:center;
}
.voice-input-group input{
  flex:1;
}
.voice-btn{
  min-width:2.75rem;
  min-height:2.75rem;
  border-radius:999px;
  border:1px solid #d4d4d8;
  background:#fff;
  font-size:1.1rem;
  line-height:1;
  cursor:pointer;
  transition:background 0.2s ease,border-color 0.2s ease,color 0.2s ease;
}
.voice-btn-icon{
  display:block;
  width:1.5rem;
  height:1.5rem;
  object-fit:contain;
  pointer-events:none;
  margin:0 auto;
}
.voice-btn.is-recording{
  background:#fff3f1;
  color:#b91c1c;
  border-color:#fb923c;
  box-shadow:0 0 0 2px rgba(249,147,60,.2);
}
.voice-btn:disabled{
  opacity:.4;
  cursor:not-allowed;
}
.voice-status{
  font-size:.85rem;
  color:#4c4c4c;
  margin:.25rem 0 0;
}
