/*
  디자인 메모 (토스 TDS·카카오·네이버 패턴 참고)
  - 회색 단계는 TDS grey(50~900)를 그대로 쓰고, 파랑은 토스 blue500(#3182F6)에서
    색상을 하늘색 쪽으로 약 7도 옮긴 #1F88E5 를 쓴다
  - 버튼: 채움(fill)과 연한(weak) 두 가지. 누르면 어두운 막이 덮이고 살짝 작아진다 (100ms)
  - 선택은 드롭다운 대신 바텀시트. 바깥(딤)을 누르거나 Esc로 닫힌다
  - 입력칸은 회색 채움 + 테두리 없음, 포커스 때만 파란 테두리
  - 하단 탭: 선택은 파랑, 나머지는 회색
  - 그라데이션·이모지 없음, 그림자는 깊이를 줄 때만. 성경 본문만 세리프
*/
:root {
  --grey50: #f9fafb;
  --grey100: #f2f4f6;
  --grey200: #e5e8eb;
  --grey300: #d1d6db;
  --grey500: #8b95a1;
  --grey600: #6b7684;
  --grey700: #4e5968;
  --grey900: #191f28;

  --ground: #ffffff;
  --surface: var(--grey100);
  --border: var(--grey200);
  --text: var(--grey900);
  --sub: var(--grey700);       /* 해설 등 두 번째 글자 */
  --muted: #646e7b;            /* 날짜, 메타 (회색 바탕 위에서도 4.5:1) */
  --primary: #1f88e5;          /* 버튼 채움 */
  --primary-ink: #ffffff;
  --primary-fill: #1976d2;     /* 흰 글자를 얹는 채움 버튼 (4.5:1). 브랜드 파랑은 아이콘, 테두리, 스위치에 쓴다 */
  --danger-ink: #ffffff;
  --accent: #1569c7;           /* 글자로 쓰는 파랑 (흰 바탕 4.5:1 이상) */
  --accent-soft: #e7f3fd;      /* weak 버튼, 선택된 칩 */
  --press: rgba(0, 0, 0, 0.08);
  --dim: rgba(0, 0, 0, 0.45);
  --notice-bg: #fff0f0;
  --notice-line: #ffd6d6;
  --notice-ink: #b0161b;

  --radius-sm: 10px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --pad: 20px;
  --col: 560px;                /* 본문 영역 폭. 넓은 화면에서는 맨 아래 규칙이 넓힌다 */
  --read: 560px;               /* 읽는 칸 폭 */
  --font: "Pretendard Variable", Pretendard, -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", system-ui, sans-serif;
  /* 성경 본문은 언어별 글꼴: 라틴 글자는 Source Serif 4, 한글은 그 글꼴에 없으니 마루부리로 넘어간다 */
  --scripture: "Source Serif 4", "MaruBuri", "AppleMyungjo", "Noto Serif KR", serif;
  /* AI 해석과 쉬운 풀이처럼 길게 읽는 글. 말씀(마루부리)과 구분된다 */
  --reading: "Gowun Dodum", "Pretendard Variable", Pretendard, -apple-system, "Apple SD Gothic Neo", sans-serif;
  --fs-verse: 19px;
  --fs-scale: 1;               /* 글자 크기 버튼: 보통(19px)을 1로 본 배율. 묵상의 다른 글도 같이 커진다 */
  --hl-yellow: #fff1a6;
  --hl-green: #d4f3de;
  --hl-blue: #d7ebfd;
  --hl-pink: #ffdde6;
  --hl-purple: #e9e0fc;
  --avatar-bg: #d1d6db;
  --avatar-fg: #ffffff;
  --sel-grey: #c2c9d1;         /* 고른 구절 */
  --sel-blue: #bcdaf7;         /* 머문 구절, 찾아간 구절 */
  --verse-line: 30px;          /* 본문 한 줄 높이(글자의 1.6배): 절 번호를 여기에 맞춘다 */
}
@media (prefers-color-scheme: dark) {
  :root {
    --ground: #17181c;
    --surface: #23252b;
    --border: #2e3138;
    --text: #f2f4f6;
    --sub: #c3c9d0;
    --muted: #9aa3ad;
    --primary: #3d9bf2;
    --grey300: #4e5968;
    --primary-fill: #2477cc;
    --danger-ink: #3a1a1b;
    --accent: #6db3f7;
    --accent-soft: #16283c;
    --press: rgba(255, 255, 255, 0.08);
    --dim: rgba(0, 0, 0, 0.6);
    --notice-bg: #3a1a1b;
    --notice-line: #5c2a2c;
    --notice-ink: #ffb3b5;
    --avatar-bg: #3a3d44;
    --avatar-fg: #6b7684;
    --sel-grey: #3d414a;
    --sel-blue: #1f3d5e;
    --hl-yellow: rgba(255, 214, 10, 0.26);
    --hl-green: rgba(52, 199, 120, 0.26);
    --hl-blue: rgba(61, 155, 242, 0.3);
    --hl-pink: rgba(255, 99, 140, 0.26);
    --hl-purple: rgba(150, 110, 240, 0.3);
  }
}

@font-face { font-family: "MaruBuri"; font-weight: 400; font-display: swap;
  src: url(https://hangeul.pstatic.net/hangeul_static/webfont/MaruBuri/MaruBuri-Regular.woff2) format("woff2"); }
@font-face { font-family: "MaruBuri"; font-weight: 700; font-display: swap;
  src: url(https://hangeul.pstatic.net/hangeul_static/webfont/MaruBuri/MaruBuri-Bold.woff2) format("woff2"); }
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
/* 앱처럼: 화면 전체는 움직이지 않고 본문(main)만 스크롤한다.
   위 막대와 아래 탭은 제자리에 있고, 본문은 끝에서 부드럽게 튕긴다 */
html, body { margin: 0; height: 100%; overflow: hidden; overscroll-behavior: none; }
body {
  background: var(--ground);
  color: var(--text);
  font-family: var(--font);
  font-size: 16px;
  font-weight: 500;
  line-height: 1.55;
  word-break: keep-all;
  overflow-wrap: anywhere;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  -webkit-text-size-adjust: 100%;
}
body.sheet-open main { overflow: hidden; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
button, input, textarea { font: inherit; color: inherit; }
input, textarea { font-size: max(16px, 1em); } /* 16px보다 작으면 아이폰이 입력할 때 화면을 확대한다 */
:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.pointer :focus { outline: none; }

/* 버튼: 누르면 어두운 막 + 살짝 작아짐 */
button {
  position: relative; border: none; background: var(--surface); color: var(--text);
  border-radius: var(--radius-md); padding: 0 16px; min-height: 44px; font-weight: 600; cursor: pointer;
  transition: transform .1s var(--ease);
}
button::after {
  content: ""; position: absolute; inset: 0; border-radius: inherit; background: var(--press);
  opacity: 0; transition: opacity .1s var(--ease); pointer-events: none;
}
button:active { transform: scale(0.97); }
button:active::after { opacity: 1; }
button:disabled { opacity: .4; cursor: default; transform: none; }
button.primary { background: var(--primary-fill); color: var(--primary-ink); }
button.weak { background: var(--accent-soft); color: var(--accent); }
button.text { background: none; color: var(--sub); padding: 0 6px; min-height: 44px; }
button.cta { width: 100%; min-height: 56px; font-size: 17px; font-weight: 700; }
button.sm { min-height: 44px; padding: 0 12px; font-size: 14px; border-radius: var(--radius-sm); }
/* 보이는 크기는 작게 두고 누르는 영역만 44px로 넓힌다 */
button.sm::before, button.text::before, .swatch::before, .switch::before { content: ""; position: absolute; inset: -4px -2px; }

input, textarea {
  width: 100%; border: 2px solid transparent; background: var(--surface); border-radius: var(--radius-md);
  padding: 12px 14px; min-height: 48px; font-weight: 500;
}
input:focus, textarea:focus { border-color: var(--primary); outline: none; }
textarea { resize: none; line-height: 1.6; }
::placeholder { color: var(--muted); }

/* 상단 */
.topbar {
  position: sticky; top: 0; z-index: 5; flex-shrink: 0; display: flex; align-items: center; justify-content: space-between;
  padding: calc(8px + env(safe-area-inset-top)) max(var(--pad), calc((100% - var(--col)) / 2)) 8px; background: var(--ground);
}
.brand { display: flex; align-items: center; gap: 8px; font-size: 18px; font-weight: 700; margin: 0; padding: 4px 0; letter-spacing: -0.02em; background: none; border: 0; color: inherit; cursor: pointer; }
.brand svg { width: 22px; height: 22px; color: var(--primary); }

main {
  flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior-y: contain;
  padding: 4px max(var(--pad), calc((100% - var(--col)) / 2)) calc(96px + env(safe-area-inset-bottom));
}
.view { display: none; }
.view.active { display: block; }
h1, h2, h3 { letter-spacing: -0.02em; line-height: 1.35; }
.greeting { font-size: 26px; font-weight: 700; margin: 12px 0 6px; }
.greeting-sub { margin: 0 0 32px; color: var(--sub); }
.comfort-title { margin-bottom: 16px; }
.view-title { font-size: 24px; font-weight: 700; margin: 12px 0 16px; }
.muted { color: var(--muted); font-size: 14px; margin: 0; }

/* 마음 고르기 */
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
#emotion-chips { flex-wrap: nowrap; gap: 6px; overflow-x: auto; scrollbar-width: none; }
#emotion-chips::-webkit-scrollbar { display: none; }
.chip { min-height: 44px; padding: 0 16px; border-radius: 999px; font-size: 15px; }
#emotion-chips .chip { padding: 0 14px; flex-shrink: 0; }
.chip[aria-pressed="true"] { background: var(--accent-soft); color: var(--accent); box-shadow: inset 0 0 0 1.5px var(--primary); }
.comfort-form { display: grid; gap: 12px; }

/* 결과 */
#comfort-result:empty { display: none; }
#comfort-result, .daily { margin-top: 40px; }
.daily[hidden] { display: none; }
.match-head { display: flex; align-items: baseline; gap: 10px; margin: 36px 0 12px; }
.match-head:first-child { margin-top: 0; }
.match-head h2, .match-head h3 { margin: 0; font-size: 18px; font-weight: 700; }
.match-head p { margin: 0; color: var(--muted); font-size: 14px; }
.comfort-head { align-items: center; justify-content: space-between; }
.comfort-head .segmented { flex: none; width: 136px; margin: 0; }
.comfort-head .segmented button { min-height: 36px; padding: 0 4px; font-size: 14px; white-space: nowrap; }
.easy-src { margin: -4px 0 12px; color: var(--muted); font-size: 13px; }
.lead-verse .verse-text { font-size: 23px; line-height: 1.7; }
.verse-text { font-family: var(--scripture); font-weight: 400; font-size: var(--fs-verse); line-height: 1.8; margin: 0 0 10px; }
.verse-text sup { font-family: var(--font); color: var(--muted); font-size: 11px; margin-right: 3px; }
.ref { color: var(--accent); font-weight: 700; margin: 0; font-size: 15px; }
.note { color: var(--sub); margin: 6px 0 0; font-size: 15px; }
.verse-item { padding: 22px 0; border-top: 1px solid var(--border); }
.more-verses { width: 100%; min-height: 48px; margin-top: 8px; }

/* 함께 기도 */
.pray-lead { margin-bottom: 20px; }
.pray-notice { width: 100%; display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 12px; padding: 14px 16px; background: var(--accent-soft); color: var(--accent); text-align: left; }
.pray-notice[hidden] { display: none; }
.pray-notice svg { width: 18px; height: 18px; fill: none; transform: rotate(-90deg); flex-shrink: 0; }
.pray-tabs { margin: 20px 0 4px; }
.pray-list { list-style: none; padding: 0; margin: 0; }
.pray-card { padding: 20px 0; border-top: 1px solid var(--border); }
.pray-card:first-child { border-top: none; }
.pray-meta { display: flex; gap: 8px; align-items: center; color: var(--muted); font-size: 13px; margin-bottom: 2px; }
.pray-tag { color: var(--accent); font-weight: 700; }
.pray-tag.alone { color: var(--sub); }
.pray-text { margin: 0 0 14px; white-space: pre-wrap; line-height: 1.7; }
.pray-btn { display: inline-flex; align-items: center; gap: 6px; min-height: 44px; padding: 0 16px; border-radius: 999px; font-size: 15px; color: var(--sub); }
.pray-btn svg { width: 18px; height: 18px; fill: none; }
.pray-btn.done, .pray-btn.done:disabled { background: var(--accent-soft); color: var(--accent); opacity: 1; }
.pray-count { margin: 0 0 10px; color: var(--accent); font-weight: 600; font-size: 14px; }
.pray-thanked { font-size: 14px; margin: 0; }
.pray-menu { margin-left: auto; background: none; min-height: 44px; min-width: 44px; padding: 0; color: var(--muted); display: inline-grid; place-items: center; }
.pray-hint { font-size: 14px; margin: 8px 0 16px; }
.pray-notice-item { display: grid; gap: 4px; padding: 12px 0; }
.pray-notice-item strong { font-size: 15px; }
.tabbar .dot { position: absolute; top: 8px; left: calc(50% + 8px); width: 7px; height: 7px; border-radius: 999px; background: var(--primary); }
.verse-actions { display: flex; flex-wrap: wrap; gap: 4px 8px; margin-top: 10px; }
.verse-actions > :first-child { margin-left: -8px; } /* 첫 단추의 아이콘이 본문 글자와 같은 줄에서 시작하게 */
.helpful { display: inline-flex; align-items: center; gap: 4px; }
.helpful svg { width: 16px; height: 16px; fill: none; }
.helpful.on { color: var(--accent); opacity: 1 !important; }

/* 저장 버튼 (아이콘 + 글자) */
.fav-btn { display: inline-flex; align-items: center; gap: 4px; background: none; padding: 0 8px; min-height: 44px; color: var(--sub); border-radius: var(--radius-sm); }
.fav-btn svg { width: 18px; height: 18px; fill: none; }
.fav-btn[aria-pressed="true"] { color: var(--primary); }
.fav-btn[aria-pressed="true"] svg { fill: currentColor; }

/* 위기 안내: 오류처럼 붉게 겁주지 않고, 눌러야 할 전화 하나를 크게 */
.crisis { background: var(--surface); border-radius: var(--radius-lg); padding: 20px; margin-bottom: 32px; }
.crisis h3 { margin: 0 0 6px; font-size: 18px; font-weight: 700; }
.crisis h3:focus { outline: none; }
.crisis p { margin: 0 0 16px; color: var(--sub); }
.crisis a { color: inherit; text-decoration: none; display: flex; justify-content: space-between; align-items: center; gap: 12px; min-height: 56px; }
.crisis a strong { font-size: 20px; font-variant-numeric: tabular-nums; display: inline-flex; align-items: center; gap: 6px; }
.crisis a strong svg { width: 20px; height: 20px; }
.crisis small { display: block; font-size: 13px; color: var(--muted); font-weight: 500; }
.crisis .crisis-main { background: var(--primary-fill); color: var(--primary-ink); border-radius: var(--radius-md); padding: 0 18px; }
.crisis .crisis-main small { color: inherit; }
.crisis-more { margin-top: 8px; }
.crisis-more summary { cursor: pointer; min-height: 44px; color: var(--accent); font-weight: 600; }
.crisis-more ul { list-style: none; padding: 0; margin: 0; }
.crisis-more li + li { border-top: 1px solid var(--border); }

/* 성경 */
.search-field { position: relative; margin: 8px 0 20px; }
.search-field svg { position: absolute; left: 14px; top: 50%; width: 20px; height: 20px; transform: translateY(-50%); color: var(--grey500); fill: none; }
.search-field input { padding-left: 42px; }
.bible-bar { display: grid; gap: 6px; position: sticky; top: -4px; z-index: 4; background: var(--ground); padding: 4px 0 8px; margin-top: -4px; } /* 스크롤해도 장과 번역본이 남는다 */
.bible-bar { transform: translateZ(0); } /* 아이폰에서 스크롤할 때 고정 막대가 떨리지 않게 따로 그린다 */
.title-picker { justify-self: start; display: inline-flex; align-items: center; gap: 6px; background: none; padding: 0 4px; margin-left: -4px; white-space: nowrap; font-size: 24px; font-weight: 700; letter-spacing: -0.02em; min-height: 48px; border-radius: var(--radius-sm); }
.title-picker svg, .bar-actions svg { width: 16px; height: 16px; fill: none; }
.bar-actions { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; padding: 4px; margin: -4px; } /* 초점 테두리가 잘리지 않게 */
.bar-actions::-webkit-scrollbar { display: none; }
.bar-actions button { display: inline-flex; align-items: center; gap: 4px; white-space: nowrap; flex-shrink: 0; }
.chapter { margin: 12px 0 24px; }
.verse { display: grid; grid-template-columns: 28px 1fr; align-items: start; gap: 2px; padding: 6px 8px; margin: 0 -8px; border-radius: var(--radius-sm); }
.verse .num { color: var(--muted); font-size: 12px; line-height: var(--verse-line); font-variant-numeric: tabular-nums; }
.verse .body { font-family: var(--scripture); font-weight: 400; font-size: var(--fs-verse); line-height: var(--verse-line); }
.verse .txt, .verse .compare { white-space: pre-line; } /* 쉬운 풀이의 시는 줄을 나눈다 */
.verse .gloss { display: block; margin: 6px 0 2px; color: var(--sub); font-size: 14px; line-height: 1.55; } /* 쉬운 풀이의 한 줄 풀이 */
.verse .compare { display: block; font-family: var(--scripture); font-weight: 400; color: var(--sub); font-size: 16px; line-height: 1.6; margin: 2px 0 6px; }
.verse.merged .body, .flow-verse.merged { font-family: var(--font); font-size: 13px; color: var(--muted); line-height: 1.6; }
.verse.highlight { background: var(--sel-blue); }
.pager { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.result-count { margin: 0 0 4px; }

.list { list-style: none; padding: 0; margin: 0; }
.list li { border-top: 1px solid var(--border); padding: 16px 0; }
.list li:first-child { border-top: none; }
.list button.linklike { background: none; border-radius: 0; padding: 0; min-height: 0; text-align: left; width: 100%; line-height: 1.6; font-weight: 500; }
.list button.linklike:active { transform: none; }
.list .snippet { display: block; font-family: var(--scripture); font-weight: 400; margin-top: 2px; }
.hist-meta { display: flex; gap: 10px; color: var(--muted); font-size: 14px; margin-bottom: 2px; }

.field-label { display: block; font-weight: 700; font-size: calc(18px * var(--fs-scale)); margin: 32px 0 10px; }
.flow-body textarea { font-size: max(16px, calc(17px * var(--fs-scale))); }
.row-end { display: flex; gap: 8px; justify-content: flex-end; align-items: center; margin-top: 12px; }
.row-end .muted { margin-right: auto; }
.sub-title { font-size: 18px; margin: 40px 0 4px; }

/* 계정 */
.auth-form { display: grid; gap: 16px; }
.auth-form label { display: grid; gap: 8px; font-weight: 600; font-size: 15px; }
.about { margin-top: 40px; background: var(--surface); border-radius: var(--radius-lg); padding: 16px 20px; }
.about summary { cursor: pointer; font-weight: 600; min-height: 44px; }
.about ul { padding-left: 18px; color: var(--sub); font-size: 15px; }

/* 글자 크기 버튼 */
.font-btn { font-weight: 700; letter-spacing: -0.02em; }
.font-btn small { font-size: .72em; margin-right: 1px; }

/* 읽음 표시 */
.read-area { display: flex; justify-content: center; margin: 4px 0 16px; }
.read-mark, .read-done { display: inline-flex; align-items: center; gap: 6px; }
.read-mark svg, .read-done svg { width: 18px; height: 18px; fill: none; }
.read-done { margin: 0; min-height: 44px; color: var(--accent); font-weight: 600; font-size: 15px; }

/* 오늘의 보금자리: 상자 안에 상자를 두지 않고, 오늘 말씀 하나를 크게 */
.today-word { padding: 8px 0 4px; }
.today-label { display: flex; gap: 10px; margin: 0 0 6px; color: var(--muted); font-size: 14px; }
.today-title { font-weight: 700; font-size: 26px; line-height: 1.35; letter-spacing: -0.02em; margin: 0 0 6px; }
.today-verse { font-family: var(--scripture); font-size: 26px; line-height: 1.65; margin: 4px 0 10px; }
.today-word.done .ref { margin-bottom: 20px; }
.today-actions { display: flex; gap: 8px; align-items: center; }
.share-icon { width: 18px; height: 18px; fill: none; vertical-align: -3px; margin-right: 4px; flex-shrink: 0; }
.read-card { padding: 20px 22px; }
.read-card:empty { display: none; }
.read-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; min-height: 28px; }
.read-head h2 { margin: 0; font-size: 18px; font-weight: 700; letter-spacing: -0.02em; }
.read-head button { min-height: 28px; padding: 0; margin: 0; background: none; color: var(--accent); font-size: 14px; font-weight: 600; }
.read-sub { margin: 4px 0 0; color: var(--muted); font-size: 14px; }
.read-plan { margin: 14px 0 0; font-weight: 700; }
.read-next { margin: 2px 0 0; color: var(--sub); font-size: 15px; }
.read-head + .read-next { margin-top: 14px; color: var(--text); font-weight: 700; font-size: 16px; }
.read-card .plan-bar { height: 6px; margin-top: 10px; }
.read-go { width: 100%; margin-top: 14px; font-size: 15px; }
button.read-pick { display: block; margin: 6px auto -6px; color: var(--accent); }
.held-quote { margin: 4px 0 24px; padding: 0; }
.held-quote p { font-family: var(--scripture); font-size: calc(24px * var(--fs-scale)); line-height: 1.65; margin: 0 0 8px; }
.held-quote cite { font-style: normal; color: var(--accent); font-weight: 700; font-size: 14px; }
.sheet-lead { margin: -4px 0 12px; }
.share-in-sheet { margin: -4px 0 8px -6px; }

/* 성경통독 */
.plan-bar { height: 8px; border-radius: 999px; background: var(--grey200); overflow: hidden; }
.plan-bar span { display: block; height: 100%; background: var(--primary); border-radius: 999px; }

/* 단계별 묵상 */
.flow { position: fixed; inset: 0; z-index: 15; background: var(--ground); display: grid; grid-template-rows: auto 1fr auto; }
.flow[hidden] { display: none; }
.flow-top { display: flex; justify-content: space-between; align-items: center; padding: calc(8px + env(safe-area-inset-top)) 12px 4px; max-width: 640px; width: 100%; margin: 0 auto; }
.icon-btn { background: none; min-height: 44px; min-width: 44px; padding: 0 10px; font-size: 18px; border-radius: 999px; display: inline-grid; place-items: center; }
.icon-btn svg, .pray-menu svg, .login-head button svg { width: 22px; height: 22px; }
.flow-body { overflow-y: auto; padding: 20px var(--pad) 120px; max-width: 640px; width: 100%; margin: 0 auto; }
.flow-title { font-size: 24px; font-weight: 700; margin: 4px 0 16px; }
.flow-date { color: var(--sub); margin: 0 0 28px; }
.flow-verse { display: block; width: 100%; text-align: left; background: none; border-radius: 6px; min-height: 0; padding: 4px 8px; width: calc(100% + 16px); margin: 0 -8px; font-family: var(--scripture); font-weight: 400; font-size: var(--fs-verse); line-height: var(--verse-line); }
.flow-verse:active { transform: none; }
.flow-verse .num { font-family: var(--font); color: var(--muted); font-size: 12px; margin-right: 6px; }
.flow-foot { position: fixed; left: 0; right: 0; bottom: 0; display: grid; grid-template-columns: 1fr 2.4fr; gap: 8px; padding: 12px var(--pad) calc(12px + env(safe-area-inset-bottom)); max-width: 640px; margin: 0 auto; background: var(--ground); }
.flow-foot button { min-height: 52px; font-size: 16px; }
.flow-foot #flow-next:only-of-type, .flow-foot #flow-prev[hidden] + #flow-next { grid-column: 1 / -1; }

/* 말씀에 머물기 */
.flow-lead { color: var(--sub); margin: -6px 0 16px; font-size: calc(16px * var(--fs-scale)); }
.flow-tools { display: flex; gap: 2px; }
.word-btn { font-size: 15px; font-weight: 600; color: var(--accent); }
.word-btn[hidden] { display: none; }
.ponder-text { font-size: calc(17px * var(--fs-scale)); line-height: 1.85; color: var(--text); margin: 0 0 8px; }
.read-passage .passage-ref { margin: 0 0 8px; }
.flow-verse.held { background: var(--border); } /* 머문 구절도 성경에서 고른 구절과 같은 회색 */
.flow-verse.held .num { color: var(--text); }
.flow-verse.held .num svg { width: 14px; height: 14px; fill: none; vertical-align: -2px; }
.prayer-help summary { cursor: pointer; color: var(--accent); font-weight: 600; }
.prayer-help[open] summary { margin-bottom: 10px; }
.rest { display: grid; justify-items: center; text-align: center; gap: 20px; padding-top: 24px; }
.rest-lead { color: var(--sub); margin: 0; font-size: calc(17px * var(--fs-scale)); line-height: 1.6; }
.rest-quote { margin: 0; }
.rest-quote p { font-family: var(--scripture); font-size: calc(24px * var(--fs-scale)); line-height: 1.75; margin: 0 0 12px; }
.rest-quote cite { font-style: normal; color: var(--accent); font-weight: 700; }

/* 시트 안 버튼 */
.sheet-head h2:empty { display: none; }
.done-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.done-actions button { min-height: 52px; }
.sheet-verses p { font-family: var(--scripture); font-size: var(--fs-verse); line-height: 1.8; margin: 0 0 6px; }
.sheet-verses sup { font-family: var(--font); color: var(--muted); font-size: 11px; margin-right: 4px; }

/* 내 페이지 */
.profile { display: flex; align-items: center; gap: 14px; width: 100%; background: none; padding: 4px 0; margin: -4px 0 28px; text-align: left; border-radius: var(--radius-md); }
.avatar { width: 56px; height: 56px; border-radius: 999px; background: var(--avatar-bg); color: var(--avatar-fg); overflow: hidden; flex-shrink: 0; }
.avatar svg { display: block; width: 100%; height: 100%; }
.profile-text { display: grid; gap: 2px; flex: 1; min-width: 0; }
.profile-text strong { font-size: 19px; }
.profile-text .muted { font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.profile-go { width: 20px; height: 20px; color: var(--muted); fill: none; transform: rotate(-90deg); flex-shrink: 0; }
.name-actions { margin-top: 16px; }
.login-head { display: flex; align-items: center; gap: 4px; margin: 12px 0 8px; }
.login-head button { background: none; padding: 0; min-width: 44px; margin-left: -10px; display: inline-grid; place-items: center; }
.login-head .view-title { margin: 0; }
.calendar { margin-top: 32px; }
.cal-head { display: grid; grid-template-columns: 44px 1fr 44px; align-items: center; text-align: center; margin-bottom: 8px; }
.cal-head h3 { margin: 0; font-size: 18px; font-weight: 700; }
.cal-head button { width: 44px; padding: 0; font-size: 20px; background: none; border-radius: 999px; }
.cal-week, .cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); text-align: center; }
.cal-week span { color: var(--muted); font-size: 13px; padding: 6px 0; }
.cal-week .sun { color: var(--notice-ink); }
.cal-week .sat { color: var(--accent); }
.cal-grid { row-gap: 4px; }
.cal-grid .day { display: grid; justify-items: center; align-content: start; gap: 1px; min-height: 54px; padding: 4px 0 0; background: none; border-radius: 0; font-weight: 600; }
.cal-grid .n { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 999px; font-size: 15px; font-variant-numeric: tabular-nums; }
.cal-grid .future .n { color: var(--grey500); font-weight: 500; }
.cal-grid .today .n { box-shadow: inset 0 0 0 1.5px var(--primary); }
.cal-grid button.day:active { transform: scale(0.94); }
.account-actions { display: flex; justify-content: space-between; margin-top: 24px; }
.policy-link { margin: 16px 0 0; font-size: 14px; }
.policy-link a { color: var(--muted); display: inline-block; padding: 14px 0; }
.policy-link a + a { margin-left: 12px; }
.cal-heading { margin-top: 0; }
.cal-summary { margin: -2px 0 12px; }
.cal-streak { display: block; color: var(--accent); font-size: 17px; font-weight: 700; margin-bottom: 2px; }
.cal-grid .stamped { padding-top: 4px; }
.stamp { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 999px; background: var(--primary); color: var(--primary-ink); transform: rotate(-8deg); }
.stamp svg { width: 22px; height: 22px; fill: none; }
.cal-grid button.stamped:active .stamp { transform: rotate(-8deg) scale(.92); }

/* 노트 */
.note-tiles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.note-tiles button { display: grid; justify-items: start; gap: 4px; min-height: 92px; padding: 14px; text-align: left; border-radius: var(--radius-lg); }
.note-tiles span { color: var(--sub); font-size: 14px; }
.note-tiles strong { font-size: 24px; font-variant-numeric: tabular-nums; }
.verse .body[data-note-verse] { cursor: pointer; }
.note-mark { width: 15px; height: 15px; margin-left: 4px; vertical-align: -1px; color: var(--accent); fill: none; }
.saved-mark { fill: currentColor; }
/* 구절 선택과 색칠 */
.verse.selected { background: var(--border); } /* 고른 구절은 회색 바탕. 이어서 고르면 바탕이 끊기지 않고 이어진다 */
.verse.selected + .verse.selected { border-top-left-radius: 0; border-top-right-radius: 0; }
.verse.selected:has(+ .verse.selected) { border-bottom-left-radius: 0; border-bottom-right-radius: 0; }
.verse[data-hl] .txt { -webkit-box-decoration-break: clone; box-decoration-break: clone; padding: 2px 0; border-radius: 3px; }
.verse[data-hl="yellow"] .txt { background: var(--hl-yellow); }
.verse[data-hl="green"] .txt { background: var(--hl-green); }
.verse[data-hl="blue"] .txt { background: var(--hl-blue); }
.verse[data-hl="pink"] .txt { background: var(--hl-pink); }
.verse[data-hl="purple"] .txt { background: var(--hl-purple); }
body.verse-bar-open main { padding-bottom: 280px; }
body.verse-bar-open .tabbar { visibility: hidden; } /* 도구 막대가 덮은 탭이 초점을 받지 않게 */
body.verse-bar-open .toast { bottom: calc(260px + env(safe-area-inset-bottom)); }
.verse-bar[hidden] { display: none; }
.verse-bar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 10; max-width: 600px; margin: 0 auto;
  background: var(--ground); border-radius: 24px 24px 0 0; border-top: 1px solid var(--border);
  padding: 16px var(--pad) calc(16px + env(safe-area-inset-bottom)); animation: rise .24s var(--ease);
}
.verse-bar-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; }
.verse-bar-head strong { font-size: 18px; }
.verse-bar-head .text { min-height: 44px; padding: 0 4px; color: var(--accent); font-weight: 600; }
.swatches { display: flex; gap: 10px; margin-bottom: 16px; }
.swatch { width: 44px; height: 44px; min-height: 0; padding: 0; border-radius: 999px; display: grid; place-items: center; color: var(--grey900); box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.06); }
.swatch svg { width: 20px; height: 20px; fill: none; opacity: 0; }
.swatch[aria-pressed="true"] svg { opacity: 1; }
.swatch[data-color="yellow"] { background: #ffd84d; }
.swatch[data-color="green"] { background: #6fd39a; }
.swatch[data-color="blue"] { background: #74b9f7; }
.swatch[data-color="pink"] { background: #ff97b2; }
.swatch[data-color="purple"] { background: #b99df2; }
.verse-tools { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.verse-tools button { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; min-height: 68px; background: var(--surface); border-radius: var(--radius-md); font-size: 14px; font-weight: 600; color: var(--sub); }
.verse-tools svg { width: 24px; height: 24px; fill: none; }
.verse-tools [aria-pressed="true"] { color: var(--accent); }
.verse-tools [aria-pressed="true"] svg { fill: currentColor; }
.note-verse { font-family: var(--scripture); font-size: 17px; line-height: 1.7; margin: 0 0 12px; color: var(--sub); }
#note-text { margin-bottom: 12px; }
.answered-toggle { display: flex; align-items: center; gap: 6px; width: 100%; margin-bottom: 12px; color: var(--sub); }
.answered-toggle svg { width: 18px; height: 18px; fill: none; }
.answered-toggle.on { background: var(--accent-soft); color: var(--accent); }
.note-list { list-style: none; padding: 0; margin: 12px 0 0; }
.note-list li + li { border-top: 1px solid var(--border); }
.note-list button { display: grid; gap: 2px; width: 100%; background: none; text-align: left; padding: 14px 4px; border-radius: 0; min-height: 0; font-weight: 500; }
.note-list button:active { transform: none; }
.note-body { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.answered { color: var(--accent); font-weight: 700; }

/* 설정 */
.setting { background: var(--surface); border-radius: var(--radius-lg); padding: 6px 18px; }
.setting-row { display: flex; justify-content: space-between; align-items: center; gap: 16px; min-height: 64px; }
.setting-row + .setting-row { border-top: 1px solid var(--border); }
.setting-row[hidden] { display: none; }
.setting-title { margin: 0; font-weight: 600; }
.setting .muted { margin-top: 2px; }
.setting input[type="time"] { width: auto; min-height: 40px; background: var(--ground); }
#push-test { margin: 0 0 8px -6px; }
#push-test[hidden] { display: none; }
/* 스위치: 아이폰 기본 스위치 크기(51x31). 누르는 자리는 ::before로 44px을 지킨다 */
.switch { flex-shrink: 0; width: 51px; min-height: 31px; height: 31px; padding: 0; border-radius: 999px; background: var(--grey300); transition: background-color .2s var(--ease); }
.switch::before { inset: -7px -4px; }
.switch span { position: absolute; top: 2px; left: 2px; width: 27px; height: 27px; border-radius: 999px; background: #fff; box-shadow: 0 3px 8px rgba(0, 0, 0, 0.15), 0 3px 1px rgba(0, 0, 0, 0.06); transition: transform .2s var(--ease); }
.switch[aria-checked="true"] { background: var(--primary); }
.switch[aria-checked="true"] span { transform: translateX(20px); }
.switch:active { transform: none; }

/* 바텀시트 */
.sheet[hidden] { display: none; }
.sheet { position: fixed; inset: 0; z-index: 20; }
.sheet-dim { position: absolute; inset: 0; background: var(--dim); animation: fade .2s var(--ease); }
.sheet-panel {
  position: absolute; left: 0; right: 0; bottom: 0; max-height: 82vh; overflow-y: auto; max-width: 600px; margin: 0 auto;
  background: var(--ground); border-radius: 24px 24px 0 0; padding: 10px var(--pad) calc(20px + env(safe-area-inset-bottom));
  animation: rise .28s var(--ease);
}
.sheet-head { display: flex; align-items: center; gap: 4px; margin-bottom: 14px; }
.sheet-head h2 { font-size: 20px; font-weight: 700; margin: 0; }
.sheet-head button { background: none; padding: 0 6px; min-height: 44px; min-width: 44px; font-size: 20px; }
.segmented { display: grid; grid-template-columns: 1fr 1fr; background: var(--surface); border-radius: var(--radius-sm); padding: 3px; margin-bottom: 14px; }
.segmented button { min-height: 44px; background: none; color: var(--muted); border-radius: 8px; font-size: 15px; }
.segmented button[aria-pressed="true"] { background: var(--ground); color: var(--text); font-weight: 700; }
.pick-grid { display: grid; gap: 8px; }
.pick-grid.books { grid-template-columns: repeat(3, 1fr); }
.pick-grid.nums { grid-template-columns: repeat(5, 1fr); }
.pick-grid button { min-height: 48px; padding: 0 6px; font-size: 15px; }
.pick-grid button[aria-pressed="true"] { background: var(--accent-soft); color: var(--accent); box-shadow: inset 0 0 0 1.5px var(--primary); }
/* 직접 고르기: 종류별 묶음마다 이름과 모두 고르기, 아래에 고른 권 수 버튼이 붙어 있다 */
.book-group + .book-group { margin-top: 18px; }
.book-group-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 4px; }
.book-group-head h3 { margin: 0; font-size: 15px; font-weight: 700; color: var(--sub); }
.book-group-head .text { color: var(--accent); font-weight: 600; font-size: 14px; padding-right: 0; }
.sheet-foot {
  position: sticky; bottom: calc(-20px - env(safe-area-inset-bottom)); margin: 18px 0 calc(-20px - env(safe-area-inset-bottom));
  padding: 12px 0 calc(20px + env(safe-area-inset-bottom)); background: var(--ground);
}
.sheet-foot button { width: 100%; min-height: 52px; font-size: 16px; font-weight: 700; }
.sheet-foot button:disabled { opacity: 1; background: var(--surface); color: var(--sub); }
.pick-list { list-style: none; padding: 0; margin: 0; }
.pick-list button { width: 100%; display: flex; justify-content: space-between; align-items: center; gap: 12px; min-height: 56px; background: none; text-align: left; border-radius: var(--radius-md); padding: 0 8px; }
.pick-list small { display: block; color: var(--muted); font-size: 13px; font-weight: 500; }
.pick-list svg { width: 22px; height: 22px; color: var(--primary); fill: none; flex-shrink: 0; }
@keyframes rise { from { transform: translateY(100%); } }
@keyframes fade { from { opacity: 0; } }

/* 하단 탭 */
.tabbar {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 5; display: grid; grid-template-columns: repeat(5, 1fr);
  background: var(--ground); border-top: 1px solid var(--border); padding-bottom: env(safe-area-inset-bottom);
  max-width: 600px; margin: 0 auto;
}
.tabbar button {
  border-radius: 0; background: none; display: grid; justify-items: center; gap: 2px;
  padding: 8px 0 6px; min-height: 56px; font-size: 12px; font-weight: 600; color: var(--muted);
}
.tabbar button:active { transform: none; }
.tabbar button::after { display: none; } /* 누를 때 회색 막을 남기지 않는다 */
.tabbar svg { width: 24px; height: 24px; fill: none; }
.tabbar button.active { color: var(--accent); }

.toast {
  position: fixed; left: 50%; bottom: calc(76px + env(safe-area-inset-bottom)); transform: translateX(-50%);
  background: var(--grey900); color: #fff; padding: 12px 18px; border-radius: var(--radius-md);
  font-size: 14px; z-index: 30; max-width: calc(100% - 40px);
}
.empty { color: var(--muted); padding: 24px 0; }
.error-box { background: var(--surface); border-radius: var(--radius-lg); padding: 20px; display: grid; gap: 12px; justify-items: start; }
.error-box p { margin: 0; color: var(--sub); }

@media (prefers-reduced-motion: reduce) {
  *, *::after { transition: none !important; animation: none !important; }
  button:active { transform: none; }
}

/* AI 해석 */
.ai { margin: 0 0 24px; }
.ai-open { width: 100%; }
.ai-head { display: flex; align-items: center; justify-content: space-between; }
.ai-head h3 { font-size: 20px; margin: 0; }
.ai-note { color: var(--muted); font-size: 14px; margin: 2px 0 4px; }
.ai-sec { border-top: 1px solid var(--border); padding: 20px 0 4px; margin-top: 12px; }
.ai-range { color: var(--accent); font-size: 14px; font-weight: 600; margin: 0 0 2px; }
.ai-sec h4 { font-size: calc(18px * var(--fs-scale)); margin: 0 0 10px; }
.ai-sec > p:not(.ai-range), .ai-rest p { font-family: var(--reading); font-weight: 400; font-size: calc(16px * var(--fs-scale)); line-height: 1.75; margin: 0 0 12px; }
.ai-sec sup { color: var(--accent); font-size: .68em; margin-left: 1px; }
.ai-src summary { color: var(--muted); font-size: 14px; cursor: pointer; min-height: 44px; }
.ai-src ol { margin: 4px 0 8px; padding-left: 20px; font-size: 14px; color: var(--sub); }
.ai-src li { margin: 6px 0; overflow-wrap: anywhere; }
.ai-src a { color: var(--accent); }
.ai-src small { display: block; color: var(--muted); }

/* 함께 기도 이용 약속, 계정 삭제 */
.terms-list { padding-left: 20px; margin: 0 0 8px; color: var(--sub); line-height: 1.65; }
.terms-list li { margin: 6px 0; }
button.primary.danger { background: var(--notice-ink); color: var(--danger-ink); }

/* Apple, Google 로그인 (각 회사의 버튼 지침: Apple은 검정, Google은 흰 바탕과 회색 테두리) */
.social-login { display: grid; gap: 8px; margin: 8px 0 4px; }
.social { display: flex; align-items: center; justify-content: center; gap: 8px; min-height: 52px; font-weight: 600; }
.social svg { width: 18px; height: 18px; }
.social.apple { background: #000; color: #fff; }
.social.google { background: #fff; color: #1f1f1f; border: 1px solid #747775; }
.social-or { text-align: center; margin: 12px 0 0; font-size: 14px; }

/* 쉬운 풀이 안내, 구절 키보드 초점 */
.easy-note { margin: 0 0 12px; padding: 12px 14px; background: var(--surface); border-radius: var(--radius-sm); color: var(--sub); font-size: 14px; line-height: 1.6; }
.verse .body:focus-visible { outline: 2px solid var(--primary); outline-offset: 4px; border-radius: 4px; }

/* 함께 기도 소개 (로그인 전) */
.pray-how { margin: 0 0 20px; padding-left: 20px; color: var(--sub); line-height: 1.7; }
.pray-how li { margin: 4px 0; }

/* 장절을 누르면 앞뒤 본문으로 */
.ref-link { display: inline-flex; align-items: center; gap: 2px; background: none; padding: 0; min-height: 44px; border-radius: var(--radius-sm); }
.ref-link svg { width: 16px; height: 16px; }
.ref-link:active { transform: none; }
/* AI 해석: 단락마다 첫 문단만, 나머지는 더 읽기로 */
.ai-more { padding: 0; color: var(--accent); font-weight: 600; margin: -4px 0 8px; }
/* 묵상 화면의 글자 크기 버튼은 가로로 */
.icon-btn.font-btn { display: inline-flex; align-items: baseline; justify-content: center; }
/* 꺼진 스위치도 바탕과 구분되게 (3:1) */
.switch[aria-checked="false"], .switch:not([aria-checked]) { background: #7d8794; }
/* 아이폰에서는 아이폰 기본 스위치 색 */
.ios .switch[aria-checked="false"], .ios .switch:not([aria-checked]) { background: rgba(120, 120, 128, 0.24); } /* 회색 카드 위라 아이폰 기본보다 조금 진하게 */
.ios .switch[aria-checked="true"] { background: #34c759; }
@media (prefers-color-scheme: dark) {
  .switch[aria-checked="false"], .switch:not([aria-checked]) { background: #77818e; }
  .ios .switch[aria-checked="false"], .ios .switch:not([aria-checked]) { background: #39393d; }
  .ios .switch[aria-checked="true"] { background: #30d158; }
  .toast { background: #3a3d44; box-shadow: inset 0 0 0 1px #5d6673; }
}

/* 쉬운 풀이는 AI 풀이라 성경 본문 세리프 대신 본문 글꼴로 */
.chapter.easy .verse .body { font-family: var(--reading); font-weight: 400; }
/* 처음 성경을 열 때 한 줄 안내 */
.tap-hint { margin: 10px 0 0; color: var(--muted); font-size: 14px; }
/* 묵상: 아직 고를 수 없는 다음 버튼은 흐린 파랑이 아니라 회색 버튼으로, 안내 글은 읽히게 */
.flow-foot button.primary:disabled { opacity: 1; background: var(--surface); color: var(--sub); }
/* 손님이 마친 묵상 */
.guest-note { margin: -12px 0 16px; color: var(--muted); font-size: 14px; }
/* 펼치기 표시는 브라우저 기본 ▶ 대신 아래쪽 꺾쇠 */
details > summary { list-style: none; display: flex; align-items: center; gap: 6px; }
details > summary::-webkit-details-marker { display: none; }
details > summary::after { content: ""; width: 8px; height: 8px; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: rotate(45deg) translateY(-2px); margin-left: 2px; transition: transform .2s var(--ease); }
details[open] > summary::after { transform: rotate(-135deg) translateY(-2px); }
/* AI 해석은 장 넘김 버튼과 간격을 둔다 */
.ai { margin-top: 24px; }

.sheet-close { margin-left: auto; margin-right: -10px; }
.verse.selected .num { color: var(--text); } /* 회색 바탕 위 절 번호도 4.5:1 */
.reset-btn { justify-self: start; padding: 0; }

/* 로그인 또는 회원가입 */
.auth-mode { margin: 16px 0; }
.auth-form .muted[hidden], .reset-btn[hidden] { display: none; }
/* 기도 탭 미리보기 */
.pray-sample { margin: 0 0 24px; padding: 18px 20px; background: var(--surface); border-radius: var(--radius-lg); }
.pray-sample .pray-text { margin-bottom: 12px; }

/* hidden 속성이 display 규칙에 지지 않게 */
.social-login[hidden], .social[hidden], .swatches[hidden] { display: none; }
.verse-bar-head > span { display: flex; gap: 4px; }
.verse.highlight .num, .verse.selected .num { color: var(--text); }
.cal-grid .future .n { color: var(--muted); }
.prayer-help summary { min-height: 44px; }
.ai-src li { min-height: 44px; display: flex; flex-direction: column; justify-content: center; }
.ai-src a { display: inline-block; padding: 8px 0; }
.auth-form .muted[hidden] { display: none; }
#auth-terms a { color: var(--accent); }
.crisis-more[open] summary::after { transform: rotate(-135deg) translateY(-2px); }
.back-comfort { display: inline-flex; align-items: center; gap: 4px; margin: 8px 0 0; }
.back-comfort[hidden] { display: none; }
.back-comfort svg { width: 16px; height: 16px; }
.help ul { list-style: none; padding: 0; }
.help li { margin: 10px 0; line-height: 1.6; }
.help strong { color: var(--text); margin-right: 6px; }
@media (hover: none) { .kbd-help { display: none; } }
[tabindex="-1"]:focus { outline: none; }
.flow-verse:not(.held) { border-bottom: 1px solid var(--border); border-radius: 0; }
.back-comfort { position: absolute; right: 0; top: 6px; display: inline-flex; align-items: center; gap: 4px; margin: 0; }
.cal-grid .n { font-weight: 500; }
.cal-grid .stamp { font-weight: 600; }
#ai-area, #crisis-title, .match-head h3 { scroll-margin-top: 140px; }
small { font-size: 13px; }
.about.help { margin: 40px 0 8px; }
#auth-terms a { display: inline-block; padding: 12px 2px; }
.ai-head .text { min-width: 44px; }

/* ── 1.1: 한 겹 더, 움직임 ─────────────────────────────────
   - 모든 화면을 연회색 바탕에 두고, 칸과 버튼과 입력칸은 흰색으로 올린다. 흰 카드 안의 버튼과 입력칸은 다시 회색
   - 움직임은 iOS 기본을 따른다: 줄은 누르면 회색, 상세 화면은 오른쪽에서 밀려 들어오고, 시트는 스프링으로 올라온다
   - 선택된 탭은 꽉 찬 아이콘, 제목은 더 크고 굵게 */
:root {
  --page: var(--grey100);
  --card: #ffffff;
  --fill: var(--grey100);      /* 흰 카드 안의 버튼, 입력칸 */
  --spring: cubic-bezier(0.32, 0.72, 0, 1);
  --push: cubic-bezier(0.2, 0.85, 0.25, 1);
}
/* 감쇠 0.86, 반응 0.45초 스프링 (끝에서 0.5%만 넘었다 돌아온다) */
@supports (animation-timing-function: linear(0, 1)) {
  :root { --spring: linear(0, 0.0332, 0.1133, 0.2173, 0.3298, 0.4407, 0.5437, 0.6354, 0.7146, 0.7812, 0.8358, 0.8797, 0.9143, 0.9409, 0.961, 0.9759, 0.9865, 0.994, 0.9989, 1.0021, 1.0039, 1.0048, 1.005, 1.0049, 1.0045, 1.004, 1.0034, 1.0028, 1.0023, 1.0018, 1); }
}
@media (prefers-color-scheme: dark) {
  :root { --page: #101114; --card: #1c1e23; --fill: #23252b; }
}

/* 한 겹 더: 연회색 바탕 위 흰 카드 */
body, .topbar, .bible-bar, .flow, .flow-foot { background: var(--page); }
.topbar { --icon-cut: var(--page); }
/* 바탕 위의 버튼, 입력칸, 안내 상자는 흰색 (회색 바탕에 회색이 묻히지 않게) */
main, .flow { --surface: var(--card); }
main .segmented, .flow .segmented { background: var(--border); }
main .segmented button[aria-pressed="true"] { background: var(--card); }
/* 흰 카드 안에서는 다시 회색 */
.today-word, #view-home .daily, .read-card, #view-me .profile, #view-me .calendar, #view-me .setting, #view-me .about, #saved-list, #view-me .note-tiles button, .crisis, .pray-sample, .error-box, .about { --surface: var(--fill); }
.crisis, .pray-sample, .error-box, .about, .easy-note { background: var(--card); }
.today-word, #view-home .daily, .read-card, #view-me .profile, #view-me .calendar, #view-me .setting, #view-me .about, #saved-list:has(li) {
  background: var(--card); border-radius: var(--radius-lg);
}
#view-me .note-tiles button { background: var(--card); }
#view-me .setting input[type="time"] { background: var(--surface); }

/* 홈: 맨 위에 오늘의 묵상 카드를 크게 */
.greeting { font-size: 22px; font-weight: 700; letter-spacing: -0.02em; margin: 12px 0 14px; }
.today-word { padding: 24px 22px 22px; }
.today-label { font-size: 17px; font-weight: 700; letter-spacing: -0.02em; color: var(--accent); margin-bottom: 6px; }
.today-word .ref { color: var(--sub); }
.today-title { font-size: 22px; font-weight: 700; letter-spacing: -0.02em; }
.today-word .cta { margin-top: 20px; }
/* 마친 날: 카드 모양은 같고, 날짜 옆에 마침 표시, 제목 아래에 머문 말씀을 조용히 */
.done-mark { display: inline-flex; align-items: center; gap: 3px; margin-left: 8px; color: var(--accent); }
.done-mark svg { width: 15px; height: 15px; fill: none; }
.stay-quote { margin: 16px 0 18px; padding: 14px 16px; background: var(--fill); border-radius: var(--radius-md); }
.stay-quote p { font-family: var(--scripture); font-size: 18px; line-height: 1.7; margin: 0 0 6px; }
.stay-quote cite { font-style: normal; color: var(--muted); font-size: 13px; font-weight: 600; }
.today-word.done .ref { margin-bottom: 0; }
.read-card { margin-top: 12px; }
#view-home .daily { margin-top: 12px; padding: 22px; }
#view-home .daily .match-head { display: block; margin: 0 0 12px; }
#view-home .daily .match-head p { margin-top: 4px; }
#view-home .daily .verse-item { padding: 0; border-top: none; }

/* 불러오는 동안: 빈 회색 상자 대신 카드 모양 자리 */
.skeleton span { display: block; height: 14px; width: 32%; border-radius: 7px; background: var(--surface); margin-bottom: 14px; animation: breathe 1.1s ease-in-out infinite alternate; }
.skeleton span:nth-child(2) { height: 30px; width: 72%; border-radius: 9px; }
.skeleton span:nth-child(3) { width: 24%; margin-bottom: 40px; }
.skeleton span:nth-child(4) { height: 56px; width: 100%; border-radius: var(--radius-md); margin: 0; }
@keyframes breathe { to { opacity: .45; } }

/* 내 페이지: 칸마다 카드 */
#view-me .profile { padding: 16px 18px; margin: 0 0 12px; }
#view-me .calendar { padding: 18px 12px 12px; margin-top: 12px; }
#view-me .calendar .cal-heading, #view-me .calendar .cal-summary, #cal-guest { padding: 0 8px; }
#saved-list:has(li) { padding: 0 18px; overflow: hidden; }
#view-me .about { margin-top: 12px; }
#view-me .about.help { margin-top: 32px; }

/* 글자: 제목과 숫자는 더 크고 굵게, 본문과 차이를 키운다 */
.view-title { font-size: 22px; font-weight: 700; letter-spacing: -0.02em; }
.sub-title { font-size: 18px; font-weight: 700; letter-spacing: -0.02em; }
.match-head h2, .match-head h3 { font-size: 17px; }
.note-tiles strong { font-size: 24px; font-weight: 700; }
.cal-streak { font-size: 18px; font-weight: 700; }
.title-picker { font-size: 22px; font-weight: 700; }

/* 목록 한 줄: 넉넉한 높이, 누르면 크기는 그대로 두고 바탕만 회색 */
.list li { padding: 18px 0; }
.note-list button { min-height: 60px; padding: 16px 4px; }
.list button.linklike::after { inset: -18px -18px; border-radius: 0; }
.pick-list button:active, .profile:active, .pray-notice:active { transform: none; }
/* 누르면 바로 어두워지고, 떼면 iOS처럼 천천히 걷힌다 */
button::after { transition-duration: .25s; }
button:active::after { transition-duration: 0s; }
/* 손가락(터치)에서는 :active 대신 .is-pressed: 스크롤하다 닿은 손가락에는 반응하지 않고,
   누르면 폭신하게 들어갔다가(0.12초) 떼면 살짝 튕기며 돌아온다(0.4초). 회색 막은 옅게 */
@media (hover: none) {
  button:active { transform: none; }
  button:active::after { opacity: 0; }
  button, #saved-list, .note-list { transition: transform .4s cubic-bezier(0.34, 1.56, 0.64, 1); }
  button::after { transition: opacity .25s ease-out; }
  button.is-pressed { transform: scale(0.96); transition: transform .12s ease-out; }
  button.is-pressed::after { opacity: .5; transition-duration: .08s; }
  /* 카드 안의 줄은 줄 대신 카드 전체가 눌린다 */
  #saved-list:has(.is-pressed) { transform: scale(0.98); transition: transform .12s ease-out; }
  #saved-list .is-pressed, .note-list .is-pressed, .pick-list .is-pressed, .list .is-pressed { transform: none; }
  #saved-list .is-pressed::after { opacity: .35; }
  .switch.is-pressed, .chip.is-pressed { transform: none; }
}

/* 하단 탭: 뒤가 비치는 막대, 선택된 탭은 꽉 찬 아이콘 */
.tabbar {
  --tab-bg: var(--ground); --icon-cut: var(--ground);
  background: color-mix(in srgb, var(--ground) 86%, transparent);
  -webkit-backdrop-filter: saturate(180%) blur(20px); backdrop-filter: saturate(180%) blur(20px);
  border-top: 0.5px solid rgba(0, 0, 0, 0.16);
}
.tabbar svg.on, .tabbar button.active svg.off { display: none; }
.native-tabs .tabbar { display: none; } /* 1.1 앱은 iOS 탭 바를 직접 그린다 */
/* 1.1 앱: 장 막대는 본문과 함께 올라가고, 다 지나가면 위에 장 이름만 작게 접힌다 (아이폰 큰 제목이 접히는 것처럼) */
.bible-mini[hidden] { display: none; }
.native-tabs .bible-bar { position: static; transform: none; }
.bible-mini {
  position: fixed; top: 0; left: 0; right: 0; z-index: 7; padding-top: env(safe-area-inset-top);
  background: color-mix(in srgb, var(--page) 88%, transparent);
  -webkit-backdrop-filter: saturate(180%) blur(20px); backdrop-filter: saturate(180%) blur(20px);
  box-shadow: 0 0.5px 0 rgba(0, 0, 0, 0.14);
  opacity: 0; transform: translateY(-8px); pointer-events: none;
  transition: opacity .16s ease-out, transform .22s var(--spring);
}
.bible-mini.show { opacity: 1; transform: none; pointer-events: auto; }
.mini-title {
  display: block; width: 100%; min-height: 44px; padding: 0 max(var(--pad), calc((100% - var(--read)) / 2)); background: none; border-radius: 0;
  text-align: left; font-size: 17px; font-weight: 700; letter-spacing: -0.02em;
}
.mini-title:active { transform: none; }
@media (prefers-color-scheme: dark) { .bible-mini { box-shadow: 0 0.5px 0 rgba(255, 255, 255, 0.12); } }
/* 1.1 앱: 시트, 구절 도구 막대, 묵상 화면의 오르내림은 앱이 그린다 (웹 애니메이션은 60Hz에 묶인다) */
.native-sheets .sheet-panel, .native-sheets .sheet-dim, .native-sheets .verse-bar, .native-sheets .flow { animation: none; }
/* 1.1 앱: 시트와 도구 막대 위의 손잡이 (아래로 쓸어 닫을 수 있다는 표시) */
.native-sheets .sheet-panel::before, .native-sheets .verse-bar::before {
  content: ""; display: block; width: 36px; height: 5px; border-radius: 3px; background: var(--grey300); margin: -4px auto 10px;
}
.native-sheets .sheet-panel, .native-sheets .verse-bar { touch-action: pan-y; }
/* 1.1 앱: 위쪽 흐린 띠와 접힌 장 제목은 앱이 iOS 재질로 그린다. 웹 것은 자리만 잡는다 */
.native-chrome body::before { display: none; }
.native-chrome .bible-mini { visibility: hidden; }
/* 1.1 앱: iOS 글자 크기 설정 (앱이 --text-adjust를 넘긴다) */
.native-chrome body { -webkit-text-size-adjust: var(--text-adjust, 100%); text-size-adjust: var(--text-adjust, 100%); }
.native-pending { visibility: hidden; }
.ghost-still { pointer-events: none; }
.sheet.ghost-still { z-index: 19; }
/* 1.1 앱: 위 '보금자리' 막대를 빼고 화면마다 제목부터 보여 준다. 상태 막대 뒤만 비치는 띠로 가린다 */
.native-tabs .topbar { display: none; }
.native-tabs main { padding-top: calc(4px + env(safe-area-inset-top)); } /* 고정 막대(sticky)는 이 여백 아래에 붙는다 */
.native-tabs body::before {
  content: ""; position: fixed; top: 0; left: 0; right: 0; height: env(safe-area-inset-top); z-index: 6; pointer-events: none;
  background: color-mix(in srgb, var(--page) 86%, transparent);
  -webkit-backdrop-filter: saturate(180%) blur(20px); backdrop-filter: saturate(180%) blur(20px);
}
.tabbar button.active svg.on { display: block; }
@media (prefers-color-scheme: dark) { .tabbar { border-top-color: rgba(255, 255, 255, 0.14); } }

/* 바텀시트와 묵상 화면: 스프링으로 올라오고, 닫을 때는 복사본이 아래로 내려간다 */
.sheet-panel { animation: rise .28s var(--spring); }
.sheet-dim { animation: fade .18s ease-out; }
.verse-bar { animation: rise .22s var(--spring); }
.flow { animation: rise .3s var(--spring); }
.leaving { pointer-events: none; }
.sheet.leaving { z-index: 19; } /* 곧바로 새 시트가 열리면 그 아래로 */
.sheet.leaving .sheet-panel, .flow.leaving { animation: sink .18s cubic-bezier(0.4, 0, 1, 1) forwards; }
.sheet.leaving .sheet-dim { animation: fade-out .18s ease-in forwards; }
@keyframes sink { to { transform: translateY(100%); } }
@keyframes fade-out { to { opacity: 0; } }

/* 상세 화면: 오른쪽에서 밀려 들어오고(push), 돌아갈 때 오른쪽으로 빠진다(pop). 위 막대와 탭은 제자리 */
.topbar { view-transition-name: topbar; }
.tabbar { view-transition-name: tabbar; }
::view-transition-group(topbar), ::view-transition-group(tabbar),
::view-transition-old(topbar), ::view-transition-new(topbar),
::view-transition-old(tabbar), ::view-transition-new(tabbar) { animation: none; }
::view-transition-old(root), ::view-transition-new(root) { animation-duration: .28s; animation-timing-function: var(--push); }
[data-nav="push"]::view-transition-old(root) { animation-name: nav-behind; }
[data-nav="push"]::view-transition-new(root) { animation-name: nav-from-right; box-shadow: 0 0 24px rgba(0, 0, 0, 0.12); }
[data-nav="pop"]::view-transition-old(root) { animation-name: nav-to-right; z-index: 1; box-shadow: 0 0 24px rgba(0, 0, 0, 0.12); }
[data-nav="pop"]::view-transition-new(root) { animation-name: nav-from-behind; }
@keyframes nav-from-right { from { transform: translateX(100%); } }
@keyframes nav-behind { to { transform: translateX(-30%); filter: brightness(0.92); } }
@keyframes nav-to-right { to { transform: translateX(100%); } }
@keyframes nav-from-behind { from { transform: translateX(-30%); filter: brightness(0.92); } }

@media (prefers-reduced-motion: reduce) {
  *::before, .skeleton span { animation: none !important; }
  ::view-transition-group(*), ::view-transition-old(*), ::view-transition-new(*) { animation: none !important; }
}

/* 성경 본문: 줄 간격 1.6, 한글 자간을 조금 좁혀 한 줄에 더 담는다 */
.verse .body, .flow-verse, .verse-text, .today-verse, .held-quote p, .rest-quote p, .stay-quote p, .sheet-verses p, .list .snippet, .verse .compare {
  letter-spacing: -0.01em;
}
.verse-text, .sheet-verses p, .verse .compare { line-height: 1.6; }
.today-verse, .held-quote p, .rest-quote p, .stay-quote p, .lead-verse .verse-text { line-height: 1.55; }

/* AI 해석: 장 막대의 'AI 해석' 단추로 본문 대신 펼친다. 보고서처럼 장 요약(사이에 지도) 다음에 절마다 자세히, 그림은 그 절 안에 */
#view-bible.ai-mode #chapter-view, #view-bible.ai-mode #read-area, #view-bible.ai-mode #tap-hint { display: none; }
/* 해석을 펴면 검색칸은 위로 부드럽게 접어 넣는다 */
#search-form { max-height: 64px; overflow: hidden; transition: max-height .26s var(--spring), opacity .18s ease-out, margin .26s var(--spring); }
#view-bible.ai-mode #search-form { max-height: 0; opacity: 0; margin-top: 0; margin-bottom: 0; pointer-events: none; }
#ai-area { margin: 12px 0 24px; }
#ai-area[hidden] { display: none; }
.ai-overview { background: var(--card); border-radius: var(--radius-lg); padding: 20px 18px 6px; margin: 12px 0 28px; }
.ai-overview h3 { font-size: 18px; margin: 0 0 12px; }
.ai-overview > p { font-family: var(--reading); font-weight: 400; font-size: calc(16px * var(--fs-scale)); line-height: 1.75; margin: 0 0 14px; color: var(--text); }
.ai-detail-title { font-size: 18px; margin: 0 0 4px; }
.ai-figure { margin: 4px 0 14px; }
.ai-figure img { display: block; width: 100%; height: auto; aspect-ratio: 4 / 3; object-fit: cover; border-radius: var(--radius-md); background: var(--border); }
.ai-figure figcaption, .ai-map figcaption { margin-top: 8px; font-size: 13px; line-height: 1.5; color: var(--sub); }
.ai-figure figcaption small, .ai-map figcaption small { display: block; margin-top: 2px; font-size: 11px; color: var(--muted); }
.ai-figure figcaption a { color: inherit; text-decoration: none; }
.ai-map { margin: 4px 0 18px; }
.ai-map figcaption strong { color: var(--text); font-weight: 700; }
.ai-map-art { aspect-ratio: 640 / 517; border-radius: var(--radius-md); overflow: hidden; background: #cfe4f9; }
.ai-map-art svg { display: block; width: 100%; height: auto; }
/* 연표: 시대 아홉 개를 점으로, 이 장의 시대만 파랑 */
.ai-timeline { margin: 0 0 18px; }
.tl-now { margin: 0 0 8px; font-size: 13px; color: var(--muted); white-space: nowrap; }
.tl-now strong { color: var(--text); font-weight: 700; }
.tl-now span { display: inline-block; }
/* 글자의 x 지점이 점 위에 오게, 양옆 빈칸을 x : 1-x로 나눈다. 글자가 칸 밖으로 넘치면 화면이 옆으로 밀린다 */
.tl-now.mid { display: flex; padding: 0 6px; }
.tl-now.mid::before { content: ""; flex-grow: var(--x); }
.tl-now.mid::after { content: ""; flex-grow: calc(1 - var(--x)); }
.tl-now.end { text-align: right; }
.tl-track { position: relative; display: flex; justify-content: space-between; align-items: center; height: 12px; }
.tl-track::before { content: ""; position: absolute; left: 6px; right: 6px; top: 5px; height: 2px; border-radius: 1px; background: var(--border); }
.tl-track i { position: relative; width: 12px; height: 12px; display: grid; place-items: center; }
.tl-track i::after { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--grey300); }
.tl-track i.on::after { width: 12px; height: 12px; background: var(--primary); }
.tl-ends { display: flex; justify-content: space-between; margin: 6px 0 0; font-size: 11px; color: var(--muted); }
/* 표, 족보, 구조도 */
.ai-x { margin: 4px 0 18px; }
.ai-x h4 { font-size: 15px; margin: 0 0 6px; }
.ai-x-cap { margin: 8px 0 0; font-size: 13px; line-height: 1.5; color: var(--sub); }

/* 해석 속 그림: 흰 카드(장 요약) 안이면 회색 칸, 회색 바탕(절 해석)이면 흰 칸. x-on은 칸 위에 얹는 것, x-ctl은 칸 밖의 단추 */
#ai-area { --x-bg: var(--card); --x-on: var(--fill); --x-ctl: var(--card); }
.ai-overview { --x-bg: var(--fill); --x-on: var(--card); --x-ctl: var(--fill); }
.ai-x-art .st-nav { background: var(--x-on); }
/* 한 구간씩 넘기는 막대 (지도, 단계 구조도) */
.st-bar { display: flex; align-items: center; gap: 10px; margin-top: 10px; }
.st-text { flex: 1; min-width: 0; display: grid; line-height: 1.4; }
.st-no { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.st-title { font-size: 15px; font-weight: 700; color: var(--text); word-break: keep-all; }
.st-ref { font-size: 13px; font-weight: 600; color: var(--accent); }
.st-nav { flex: none; width: 40px; height: 40px; min-height: 0; border-radius: 12px; background: var(--x-ctl); color: var(--text); display: grid; place-items: center; padding: 0; }
.st-nav svg { width: 18px; height: 18px; }
.st-nav:disabled { opacity: .35; }
.st-dots { display: flex; gap: 4px; margin-top: 10px; }
.st-dots i { flex: 1; height: 3px; border-radius: 2px; background: var(--border); transition: background .2s; }
.st-dots i.done { background: var(--grey300); }
.st-dots i.on { background: var(--primary); }
.ai-map-steps:empty { display: none; }

/* 크기 비교 */
.ai-x-cap.top { margin: 0 0 10px; }
.ai-x-art { background: var(--x-bg); border-radius: var(--radius-md); padding: 14px; }
.sz-seg { display: flex; background: var(--x-ctl); border-radius: 10px; padding: 2px; margin-bottom: 10px; }
.sz-seg button { flex: 1; min-height: 32px; font-size: 14px; font-weight: 600; color: var(--sub); padding: 7px 0; border-radius: 8px; background: none; }
.sz-seg button[aria-selected="true"] { background: var(--x-on); color: var(--text); box-shadow: 0 1px 3px rgba(0, 0, 0, .08); }
.sz-row { margin-bottom: 12px; }
.sz-name { display: flex; justify-content: space-between; gap: 8px; font-size: 14px; margin-bottom: 6px; }
.sz-name span { color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.sz-bar { height: 20px; border-radius: 6px; background: var(--grey300); transform-origin: left; }
.sz-row.key .sz-bar { background: var(--primary); }
.sz-row.key .sz-name span { color: var(--accent); font-weight: 600; }
.sz-people { display: flex; align-items: flex-end; justify-content: space-around; height: 180px; border-bottom: 2px solid var(--grey300); }
.sz-person { width: 64px; display: flex; flex-direction: column; align-items: center; color: var(--grey300); transform-origin: bottom; }
.sz-person.key { color: var(--primary); }
.sz-head { border-radius: 50%; background: currentColor; }
.sz-body { border-radius: 10px 10px 2px 2px; background: currentColor; margin-top: 3px; }
.sz-hoop { width: 44px; height: 26px; border: 4px solid currentColor; border-radius: 4px; }
.sz-pole { width: 6px; background: currentColor; }
.sz-names { display: flex; justify-content: space-around; padding-top: 6px; font-size: 12px; color: var(--muted); text-align: center; }
.sz-names div { width: 64px; }
.sz-names b { display: block; font-size: 14px; color: var(--text); }
.sz-names .key b { color: var(--accent); }
.grow .sz-bar { animation: sz-grow .7s cubic-bezier(.2, .8, .2, 1) both; }
.grow .sz-person { animation: sz-rise .7s cubic-bezier(.2, .8, .2, 1) both; }
.grow .sz-row:nth-child(2) .sz-bar, .grow .sz-person:nth-child(2) { animation-delay: .12s; }
.grow .sz-row:nth-child(3) .sz-bar, .grow .sz-person:nth-child(3) { animation-delay: .24s; }
@keyframes sz-grow { from { transform: scaleX(0); } }
@keyframes sz-rise { from { transform: scaleY(0); } }

/* 왕과 예언자 연표 */
.ai-kings .ai-x-art { padding: 0; overflow: hidden; }
.kg-scroll { overflow-x: auto; scrollbar-width: none; }
.kg-scroll::-webkit-scrollbar { display: none; }
.kg-scroll svg { display: block; }
.kg-grid { stroke: var(--border); }
.kg-tick { font-size: 11px; fill: var(--muted); }
.kg-item { cursor: pointer; }
.kg-item rect { fill: var(--border); }
.kg-item text { font-size: 12px; font-weight: 600; fill: var(--sub); pointer-events: none; }
.kg-item.key rect { fill: var(--primary); }
.kg-item.key text { fill: #fff; }
.kg-lane rect { fill: var(--x-bg); }
.kg-lane text { font-size: 12px; font-weight: 700; fill: var(--muted); }
.kg-info { margin: 0; padding: 10px 14px 12px; border-top: 1px solid var(--border); font-size: 14px; line-height: 1.5; color: var(--sub); min-height: 66px; }
.kg-info b, .fm-info b { color: var(--text); font-size: 15px; }

/* 족보 */
.ai-family .ai-x-art { padding: 10px; display: grid; gap: 10px; }
.fm-root { text-align: center; font-weight: 700; font-size: 17px; padding: 8px; background: var(--x-on); border-radius: 12px; }
.fm-root small { display: block; font-size: 12px; font-weight: 500; color: var(--muted); }
.fm-groups { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.fm-group:first-child { grid-column: 1 / -1; } /* 사람이 가장 많은 묶음은 한 줄을 다 쓴다 */
.fm-group { background: var(--x-on); border-radius: 12px; padding: 10px; }
.fm-group p { margin: 0 0 8px; font-size: 13px; color: var(--muted); }
.fm-group p b { color: var(--text); font-size: 14px; }
.fm-kids { display: flex; flex-wrap: wrap; gap: 6px; }
.fm-kid { position: relative; min-height: 34px; font-size: 14px; font-weight: 600; color: var(--text); background: var(--x-bg); border-radius: 9px; padding: 0 10px 0 26px; }
.fm-kid i { position: absolute; left: 7px; top: 50%; transform: translateY(-50%); font-style: normal; font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums; }
.fm-kid.plain { padding-left: 10px; color: var(--muted); font-weight: 500; }
.fm-kid.sel { background: var(--primary-fill); color: #fff; }
.fm-kid.sel i { color: rgba(255, 255, 255, .8); }
.pop .fm-kid { animation: fm-pop .3s cubic-bezier(.34, 1.56, .64, 1) both; animation-delay: calc(var(--o) * 120ms); }
@keyframes fm-pop { from { transform: scale(.6); opacity: 0; } }
.fm-info { margin: 0; background: var(--x-on); border-radius: 12px; padding: 10px 12px; font-size: 14px; color: var(--sub); line-height: 1.5; min-height: 66px; }

/* 단계 구조도 */
.sg-art svg { display: block; width: 100%; height: auto; }
.sg-art text { font-size: 10.5px; font-weight: 600; fill: var(--sub); }
.sg-art .sg-room { font-size: 11px; font-weight: 700; fill: var(--muted); }
.sg-court { fill: var(--x-on); stroke: var(--grey300); stroke-width: 1.5; }
.sg-gap { fill: var(--x-on); }
.sg-tent { fill: var(--x-bg); stroke: var(--grey300); stroke-width: 1.5; }
.sg-veil { stroke: var(--grey500); stroke-width: 2; stroke-dasharray: 3 3; }
.sg-thing { fill: var(--grey300); }
.sg-thing.hot { fill: var(--primary); }
.sg-trail { fill: none; stroke: var(--primary); stroke-width: 2.5; stroke-linecap: round; stroke-linejoin: round; opacity: .45; }
.sg-who { fill: var(--primary); stroke: var(--x-on); stroke-width: 2; }
.sg-goat { fill: var(--sub); stroke: var(--x-on); stroke-width: 2; opacity: 0; }
.sg-smoke { fill: var(--grey500); opacity: 0; }
@media (prefers-reduced-motion: reduce) { .grow .sz-bar, .grow .sz-person, .pop .fm-kid { animation: none; } }
.ai-table table { width: 100%; border-collapse: collapse; font-size: calc(14px * var(--fs-scale)); }
.ai-table th { text-align: left; font-size: 12px; font-weight: 600; color: var(--muted); padding: 6px 8px 6px 0; border-bottom: 1px solid var(--border); }
.ai-table td { padding: 10px 8px 10px 0; border-bottom: 1px solid var(--border); vertical-align: top; line-height: 1.45; word-break: keep-all; color: var(--sub); }
.ai-table td:last-child, .ai-table th:last-child { padding-right: 0; }
.ai-table td.n { width: 22px; white-space: nowrap; color: var(--muted); font-variant-numeric: tabular-nums; }
.ai-table td.n + td { color: var(--text); font-weight: 700; white-space: nowrap; }
.ai-table td.n + td + td { white-space: nowrap; font-size: 13px; font-variant-numeric: tabular-nums; }
.ai-tree ol { list-style: none; margin: 0; padding: 0; }
.ai-tree li { position: relative; display: flex; justify-content: space-between; align-items: baseline; gap: 12px; padding: 7px 0 7px 22px; font-size: calc(15px * var(--fs-scale)); font-weight: 600; }
.ai-tree li::before { content: ""; position: absolute; z-index: 1; left: 2px; top: 50%; width: 10px; height: 10px; margin-top: -5px; border-radius: 50%; background: var(--card); box-shadow: inset 0 0 0 2px var(--grey300); }
.ai-tree li::after { content: ""; position: absolute; left: 6px; top: 50%; height: 100%; width: 2px; background: var(--border); }
.ai-tree li:last-child::after { display: none; }
.ai-tree.has-branch li:last-child::after { display: block; height: calc(50% + 24px); }
.ai-tree li small { font-size: 13px; font-weight: 500; color: var(--muted); text-align: right; }
.ai-tree li.mark::before { background: var(--primary); box-shadow: none; }
.ai-tree li.mark small { color: var(--accent); }
.tr-branch { position: relative; display: flex; gap: 6px; margin: 4px 0 0 22px; }
.tr-branch::before { content: ""; position: absolute; left: -16px; top: 50%; width: 12px; height: 2px; background: var(--border); }
.tr-branch span { background: var(--fill); border-radius: 8px; padding: 5px 12px; font-size: 14px; font-weight: 600; }
.ai-diagram-art { aspect-ratio: 640 / 360; border-radius: var(--radius-md); overflow: hidden; background: var(--fill); }
.ai-diagram-art svg { display: block; width: 100%; height: auto; }
.ai-diagram-art text { font-family: inherit; }
.dg-court { fill: var(--card); }
.dg-wall { fill: none; stroke: var(--grey300); stroke-width: 3; }
.dg-holy { fill: var(--accent-soft); stroke: var(--primary); stroke-width: 2.5; }
.dg-mhp { fill: color-mix(in srgb, var(--primary) 20%, var(--card)); stroke: var(--primary); stroke-width: 2.5; }
.dg-veil { stroke: var(--primary); stroke-width: 6; }
.dg-item { fill: var(--sub); }
.dg-room { font-size: 30px; font-weight: 700; fill: var(--text); }
.dg-label { font-size: 26px; font-weight: 600; fill: var(--text); }
.dg-sub { font-size: 22px; font-weight: 600; fill: var(--muted); }
.dg-accent { font-size: 26px; font-weight: 700; fill: var(--accent); }
@media (prefers-color-scheme: dark) {
  .tl-track i::after, .dg-wall { background: #3a3e46; stroke: #3a3e46; }
  .ai-tree li::before { box-shadow: inset 0 0 0 2px #3a3e46; }
}
@media (prefers-color-scheme: dark) {
  .ai-map-art { --map-sea: #1b2c40; --map-land: #23252b; --map-coast: #3a5675; --map-text: #f2f4f6; --map-halo: #23252b;
    --map-sub: #9aa3ad; --map-route: #3d9bf2; --map-route-soft: #2c5e8f; --map-sea-text: #4f7aa6; background: #1b2c40; }
}

/* 넓은 화면(아이패드, 컴퓨터): 글은 읽기 좋은 폭의 칸에 두고, 홈과 내 페이지는 카드를 두 줄로 놓는다. 시트는 iOS 폼 시트처럼 화면 가운데에.
   높이 조건은 가로로 눕힌 아이폰(Safari)을 빼려는 것이다. 아이폰 앱은 세로로 잠겨 있어서 이 규칙에 걸리지 않는다.
   아이패드 창을 좁히면 이 규칙이 풀려 아이폰 모양이 된다 */
@media (min-width: 700px) and (min-height: 500px) {
  :root { --pad: 28px; --col: 1000px; --read: 680px; }
  #view-bible, #view-comfort, #view-pray { max-width: var(--read); margin-inline: auto; }
  #view-login { max-width: 480px; margin-inline: auto; }
  .native-tabs .bible-bar { position: relative; } /* '위로 결과로 돌아가기'가 칸 오른쪽에 붙게 */

  /* 홈: 왼쪽에 오늘의 묵상과 읽기, 오른쪽에 오늘의 한 구절 */
  #view-home.active { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); grid-template-rows: auto auto 1fr; column-gap: 16px; align-items: start; }
  #view-home .greeting { grid-column: 1 / -1; }
  #qt-today, #qt-read { grid-column: 1; }
  #view-home .daily { grid-column: 2; grid-row: 2 / 4; align-self: stretch; margin-top: 0; }

  /* 내 페이지: 왼쪽에 프로필과 기록, 오른쪽에 알림과 안내. 마지막 줄이 왼쪽 칸의 남는 높이를 받아 오른쪽 칸이 벌어지지 않는다 */
  #view-me.active { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); grid-template-rows: repeat(6, auto) 1fr; column-gap: 16px; align-items: start; }
  #view-me.active > * { grid-column: 2; }
  #view-me.active > #me-title { grid-column: 1 / -1; }
  #view-me.active > #me-out, #view-me.active > #me-in { grid-column: 1; grid-row: 2 / -1; }
  #view-me > .sub-title { margin-top: 0; }
  #view-me .about.help { margin: 12px 0 0; }

  /* 시트: 화면 가운데에 떠 있는 폼 시트 */
  .sheet-panel {
    top: 0; bottom: 0; margin: auto; width: 560px; max-width: calc(100% - 48px); height: fit-content; max-height: min(82vh, 760px);
    border-radius: 24px; padding: 20px var(--pad) 24px; animation-name: rise-far;
  }
  .sheet.leaving .sheet-panel { animation-name: sink-far; }
  .native-sheets .sheet-panel { animation: none; }
  .native-sheets .sheet-panel::before { display: none; }
  .pick-grid.books { grid-template-columns: repeat(4, 1fr); }
  .pick-grid.nums { grid-template-columns: repeat(6, 1fr); }

  .verse-bar { max-width: var(--read); }
  .flow-top, .flow-body, .flow-foot { max-width: var(--read); }
}
@keyframes rise-far { from { transform: translateY(100vh); } }
@keyframes sink-far { to { transform: translateY(100vh); } }

/* 이야기 그림(story)과 바탕 그림: 2D는 SVG, 3D는 /viz3d.js. 오른쪽 위 분할 단추로 바꾼다 */
.ai-x.has-seg { position: relative; }
.ai-x.has-seg h4 { padding-right: 96px; }
.sy-seg { position: absolute; top: -3px; right: 0; display: grid; grid-template-columns: 1fr 1fr; background: var(--x-bg); border-radius: 9px; padding: 2px; }
.ai-x .sy-seg button { position: relative; z-index: 1; border: 0; background: none; box-shadow: none; min-height: 0; height: auto; border-radius: 7px; font-size: 13px; font-weight: 600; line-height: 1; color: var(--text); padding: 7px 11px; min-width: 42px; }
.sy-seg i { position: absolute; top: 2px; bottom: 2px; left: 2px; width: calc(50% - 2px); border-radius: 7px; background: var(--x-on); box-shadow: 0 1px 3px rgba(0, 0, 0, .12); transition: transform .26s cubic-bezier(.3, .7, .2, 1); }
.sy-seg[data-m="3d"] i { transform: translateX(100%); }
.sy-stage { position: relative; }
.sy-layer { transition: opacity .22s ease; }
.sy-layer.off { position: absolute; inset: 0; opacity: 0; pointer-events: none; }
.sy-3d { min-height: 240px; aspect-ratio: 4 / 3.4; border-radius: 10px; overflow: hidden; background: #2a2230; position: relative; }
.sy-3d.off { min-height: 0; }
.sy-3d canvas { display: block; width: 100% !important; height: 100% !important; }
.sy-loading { position: absolute; inset: 0; display: grid; place-items: center; color: rgba(255, 255, 255, .85); font-size: 13px; }
.sy-tag { position: absolute; left: 0; top: 0; padding: 4px 10px; border-radius: 12px; font-size: 12px; font-weight: 700; color: #fff; background: rgba(10, 16, 32, .55);
  -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); white-space: nowrap; pointer-events: none; opacity: 0; transition: opacity .4s; }
.sy-tag.on { opacity: 1; }
.sy-tag.say { background: rgba(255, 255, 255, .92); color: #191f28; }
.sy-svg { display: block; width: 100%; height: auto; overflow: visible; }
.sy-svg text { font-size: 12px; font-weight: 600; fill: var(--sub); }
.sy-svg .sy-name, .sy-svg .pl-room { font-size: 13px; font-weight: 700; fill: var(--sub); }
.sy-svg .sy-who-name { font-size: 11.5px; fill: var(--muted); transition: x 1.3s cubic-bezier(.3, .7, .3, 1), y 1.3s cubic-bezier(.3, .7, .3, 1); }
.sy-shape { fill: var(--x-on); stroke: var(--grey300); stroke-width: 1.5; transition: fill .3s, stroke .3s; }
.sy-water .sy-shape { fill: color-mix(in srgb, var(--primary) 18%, var(--x-on)); }
.sy-mountain .sy-shape { fill: color-mix(in srgb, var(--grey300) 60%, var(--x-on)); }
.sy-altar .sy-shape { fill: var(--grey300); }
.sy-joint { stroke: var(--x-on); stroke-width: 1.2; }
.sy-place.hot .sy-shape { fill: color-mix(in srgb, var(--primary) 16%, var(--x-on)); stroke: var(--primary); }
.sy-place, .sy-actor, .pl-thing { transition: opacity .4s; }
.gone { opacity: 0; pointer-events: none; }
.sy-m { transition: transform 1.3s cubic-bezier(.3, .7, .3, 1); }
.sy-m circle { fill: var(--primary); stroke: var(--x-on); stroke-width: 1.5; transition: fill .3s; }
.sy-t-ally .sy-m circle { fill: var(--sub); }
.sy-t-enemy .sy-m circle, .sy-t-crowd .sy-m circle { fill: var(--grey500); }
.sy-actor.hot .sy-m circle { fill: var(--primary); }
.sy-actor.blind .sy-m circle { fill: none; stroke: var(--grey500); stroke-dasharray: 2 2; }
.sy-actor.bow .sy-m circle { transform: scale(1, .6) translateY(4px); transition: transform .5s; }
.sy-actor.down .sy-m circle { transform: scale(1.25, .4) translateY(6px); fill: var(--grey500); stroke: none; transition: transform .5s, fill .5s; }
.sy-stair { stroke: var(--grey500); stroke-width: 1; }
.sy-wall { stroke: var(--grey300); stroke-width: 1.5; }
.sy-fire { fill: #f08a24; transform-box: fill-box; transform-origin: bottom; }
.sy-fire.pop { animation: sy-pop .6s cubic-bezier(.3, .7, .3, 1.4); }
.sy-light { fill: color-mix(in srgb, #f6c445 45%, transparent); }
.sy-smoke { fill: var(--grey300); opacity: .7; }
.sy-water .sy-ditch { fill: none; stroke: color-mix(in srgb, var(--primary) 55%, var(--x-on)); stroke-width: 5; }
.sy-water .sy-wet { fill: color-mix(in srgb, var(--primary) 30%, transparent); }
.sy-water.dry, .sy-fx.dry { animation: sy-dry 1.2s .5s ease-in forwards; }
.sy-fire.fall { animation: sy-fall .7s cubic-bezier(.5, 0, .6, 1.3); }
@keyframes sy-dry { to { opacity: 0; } }
@keyframes sy-fall { from { transform: translateY(-90px) scale(.5, 1.6); opacity: 0; } 30% { opacity: 1; } }
.sy-wave { fill: none; stroke: color-mix(in srgb, var(--primary) 70%, var(--x-on)); stroke-width: 2.5; stroke-linecap: round; animation: sy-wave .9s ease-in-out infinite alternate; }
@keyframes sy-wave { to { transform: translate(9px, -3px); } }
.sy-hit { fill: var(--grey700, #4e5968); animation: sy-hit .9s ease-in infinite; }
.sy-hit-line { stroke: var(--grey300); stroke-width: 1; stroke-dasharray: 2 4; }
@keyframes sy-hit { 0% { transform: translate(0, 0); opacity: 0; } 15% { opacity: 1; } 100% { transform: translate(var(--dx), var(--dy)); opacity: 1; } }
.sy-rain { stroke: color-mix(in srgb, var(--primary) 60%, var(--x-on)); stroke-width: 1.5; stroke-linecap: round; }
.sy-bub { fill: var(--x-on); stroke: var(--grey300); stroke-width: 1.2; }
.sy-svg .sy-say-t { font-size: 12.5px; font-weight: 700; fill: var(--text); }
.sy-say.pop { animation: sy-pop .35s cubic-bezier(.3, .7, .3, 1.3); transform-box: fill-box; transform-origin: bottom; }
@keyframes sy-pop { from { transform: scale(.6); opacity: 0; } }
.sy-svg.still *, .sy-svg.still { transition: none !important; animation: none !important; }
.pl-area { fill: var(--x-on); stroke: var(--grey300); stroke-width: 1.5; transition: fill .3s; }
.pl-in { fill: var(--x-bg); stroke: var(--grey300); stroke-width: 1.5; transition: fill .3s; }
.pl-strip { fill: var(--grey200); transition: fill .3s; }
.pl-line { fill: none; stroke: var(--grey500); stroke-width: 1.5; stroke-dasharray: 4 3; transition: stroke .3s; }
.pl-veil { stroke: var(--grey500); stroke-width: 1.5; stroke-dasharray: 3 3; }
.pl-thing rect, .pl-thing circle { fill: var(--grey300); transition: fill .3s; }
.pl-thing { transition: transform 1.3s cubic-bezier(.3, .7, .3, 1), opacity .4s; }
.hot.pl-area, .hot.pl-in, .hot.pl-strip { fill: color-mix(in srgb, var(--primary) 18%, var(--x-on)); }
.hot.pl-line { stroke: var(--primary); stroke-width: 2.5; }
.pl-thing.hot rect, .pl-thing.hot circle { fill: var(--primary); }
.pl-trail { fill: none; stroke: var(--primary); stroke-width: 2.5; stroke-linecap: round; stroke-linejoin: round; opacity: .35; }
.th-svg { aspect-ratio: 300 / 270; }
.th-svg text { font-size: 12px; }
.th-svg .halo { paint-order: stroke; stroke: var(--x-bg); stroke-width: 4px; stroke-linejoin: round; }
@media (prefers-reduced-motion: reduce) { .sy-m, .pl-thing, .sy-svg .sy-who-name { transition: none; } .sy-fire.pop, .sy-fire.fall, .sy-say.pop { animation: none; } .sy-water.dry, .sy-fx.dry { animation: none; opacity: 0; } .sy-wave, .sy-hit { animation: none; } .sy-hit { transform: translate(var(--dx), var(--dy)); } }
.sy-hint { position: absolute; right: 10px; bottom: 8px; font-size: 11px; color: rgba(255, 255, 255, .85); pointer-events: none; text-shadow: 0 1px 2px rgba(0, 0, 0, .4); }
.sy-tag.sy-pl { background: rgba(255, 255, 255, .82); color: #191f28; }
.sy-tag.sy-who { font-size: 11px; padding: 2px 8px; }
.sy-t-fire .sy-m circle { fill: #f08a24; stroke: color-mix(in srgb, #f08a24 40%, var(--x-on)); }
/* 본문 절 아래 '그림 보기' 단추 */
.verse .fig-open { grid-column: 2; justify-self: start; display: inline-flex; align-items: center; gap: 6px; margin: 4px 0 2px; max-width: 100%; min-height: 34px; padding: 0 12px; border-radius: 17px;
  background: var(--accent-soft); color: var(--accent); font-size: 14px; font-weight: 700; }
.verse .fig-open svg { width: 12px; height: 12px; flex: none; }
.verse .fig-open span { font-weight: 500; color: var(--sub); max-width: 52vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fig-sheet { --x-bg: var(--fill); --x-on: var(--card); --x-ctl: var(--fill); padding-bottom: 8px; }
.fig-sheet .ai-x { margin: 0; }
