/* goodnews 화면 모양
   원칙: 빈 화면 + 가운데 글자만. 꾸밈은 최소로. */

/* 말씀 글꼴: 나눔명조에서 말씀에 쓰인 글자만 골라 담은 것 (tools/content.py fonts, 글꼴 사용 허락: fonts/OFL.txt)
   굵은 글꼴은 설정에서 "말씀 굵게"를 켰을 때만 불러옴 */
@font-face {
  font-family: 'Goodnews Bible Serif';
  src: url('fonts/bible-serif.woff') format('woff');
  font-weight: 400;
  font-display: swap;
}

@font-face {
  font-family: 'Goodnews Bible Serif';
  src: url('fonts/bible-serif-bold.woff') format('woff');
  font-weight: 700;
  font-display: swap;
}

:root {
  --bg: #ffffff;
  --text: #1c1c1e;
  --muted: #6e6e73;
  --line: #d1d1d6;
  --button-bg: #f4f4f6;
  --button-pressed: #e4e4e8;
  --memo-bg: #1c1c1e;
  --memo-text: #f2f2f2;
  --panel-bg: #f2f2f5;
  --card-bg: #ffffff;
  --accent: #0e9f94;
  --accent-text: #ffffff;
  --font: system-ui, -apple-system, "Apple SD Gothic Neo", "Malgun Gothic", "Noto Sans KR", sans-serif;
  --serif: 'Goodnews Bible Serif', "Noto Serif KR", "AppleMyungjo", "Batang", serif;
  /* 글씨 크기: 화면 크기에 따라 기준을 정하고 (휴대폰 약 20px ~ PC 32px), 설정의 배율(--scale)을 곱함.
     화면마다 크기가 바뀌지 않고, 길면 아래로 밀어서 봄 */
  --base: clamp(19px, calc(2.6vmin + 10px), 32px);
  --scale: 1;
  --verse-size: calc(var(--base) * var(--scale));
  --text-size: calc(var(--base) * var(--scale) * 1.15);
  /* 글씨 모양과 구석 버튼 진하기: 설정에 따라 app.js 가 바꿈 (--text-color, --verse-color 는 "기본"이면 없음) */
  --text-weight: 500;
  --text-strong-weight: 700;
  --verse-weight: 400;
  --corner-opacity: .35;
  color-scheme: light;
}

/* 어두운 모드: 설정에서 "다크 모드"를 골랐을 때 */
:root[data-theme="dark"] {
  --bg: #121212;
  --text: #f2f2f2;
  --muted: #9a9aa0;
  --line: #3a3a3c;
  --button-bg: #1e1e20;
  --button-pressed: #2c2c2e;
  --memo-bg: #2c2c2e;
  --memo-text: #f2f2f2;
  --panel-bg: #0b0b0c;
  --card-bg: #1c1c1e;
  --accent: #2bb5a9;
  --accent-text: #ffffff;
  color-scheme: dark;
}

/* 어두운 모드: "기기 설정"이고 휴대폰이 어두운 모드일 때 (위와 같은 색) */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #121212;
    --text: #f2f2f2;
    --muted: #9a9aa0;
    --line: #3a3a3c;
    --button-bg: #1e1e20;
    --button-pressed: #2c2c2e;
    --memo-bg: #2c2c2e;
    --memo-text: #f2f2f2;
    --panel-bg: #0b0b0c;
    --card-bg: #1c1c1e;
    --accent: #2bb5a9;
    --accent-text: #ffffff;
    color-scheme: dark;
  }
}

* {
  box-sizing: border-box;
  /* 두 번 눌러 확대되는 것 막기 (두 손가락으로 벌려 확대는 됨). 가로 밀기는 이 앱이 처리.
     글 칸처럼 위아래로 밀리는 칸 안에서도 적용되도록 모든 요소에 줌 */
  touch-action: pan-y pinch-zoom;
}

[hidden] { display: none !important; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  overscroll-behavior: none; /* 휴대폰에서 아래로 당겨 새로 고침 막기 */
  -webkit-text-size-adjust: 100%;
}

body { overflow: hidden; }

/* 화면 전체 = 누르는 곳. 위아래 여백은 구석 버튼(목차, 이전, 다음) 자리 */
#stage {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  padding:
    max(44px, calc(env(safe-area-inset-top) + 36px))
    max(20px, env(safe-area-inset-right))
    max(48px, calc(env(safe-area-inset-bottom) + 40px))
    max(20px, env(safe-area-inset-left));
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
}

.screen {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: clamp(12px, 3vmin, 28px);
}

/* 화면 전환: 앞 화면은 빨리 흐려지고, 새 화면은 은은하게 밝아짐 */
.screen.entering { animation: fade-in .55s ease .1s both; }
.screen.leaving {
  position: fixed;
  z-index: 1;
  margin: 0;
  pointer-events: none;
  animation: fade-out .22s ease forwards;
}

@keyframes fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes fade-out {
  from { opacity: 1; }
  to { opacity: 0; }
}

@media (prefers-reduced-motion: reduce) {
  .screen.entering, .screen.leaving { animation: none; }
}

/* 글이 들어가는 칸. 길면 위아래로 밀어서 봄 (아래에 더 있으면 흐려짐으로 알려줌) */
.text-area {
  flex: 1 1 auto;
  min-height: 0;
  width: 100%;
  max-width: 44rem;
  display: flex;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: none;
}

.text-area::-webkit-scrollbar { display: none; }

.text-area.more {
  -webkit-mask-image: linear-gradient(to bottom, #000 calc(100% - 3em), transparent);
  mask-image: linear-gradient(to bottom, #000 calc(100% - 3em), transparent);
}

.fit {
  margin: auto; /* 가운데 정렬 (넘칠 때는 위에서부터) */
  width: 100%;
}

/* 일반 글 (고딕) */
.text {
  margin: 0;
  text-align: center;
  font-size: var(--text-size);
  line-height: 1.65;
  font-weight: var(--text-weight);
  color: var(--text-color, var(--text));
  letter-spacing: -0.01em;
  word-break: keep-all;
  overflow-wrap: anywhere;
  text-wrap: balance;
}

.text strong { font-weight: var(--text-strong-weight); }

/* 1-03의 괄호 안 말씀 주소 목록: 본문 아래 작고 연하게 */
.text .reference-list {
  display: inline-block;
  margin-top: .65em;
  font-size: .65em;
  font-weight: 400;
  opacity: .65;
  text-wrap: pretty;
}

/* 말씀 (명조) */
.verse-text {
  margin: 0;
  text-align: center;
  font-family: var(--serif);
  font-size: var(--verse-size);
  font-weight: var(--verse-weight);
  line-height: 1.85;
  color: var(--verse-color, var(--text));
  word-break: keep-all;
  overflow-wrap: anywhere;
}

.verse-text.long { text-align: left; }

/* 절마다 새 줄 */
.verse-line { display: block; }
.verse-line + .verse-line { margin-top: .3em; }

/* 절 번호 (작은 글씨) */
.vnum {
  margin-right: .2em;
  font-family: var(--font);
  font-size: .55em;
  font-weight: 600;
  line-height: 0;
  vertical-align: super;
  color: var(--muted);
}

/* 장절 (말씀 위) */
.ref {
  margin: 0 0 .9em;
  text-align: center;
  font-size: max(.875rem, calc(var(--verse-size) * .62));
  font-weight: 600;
  letter-spacing: .02em;
  color: var(--muted);
}

/* 성도 모드: 메모의 설명을 화면 아래 여백에 연하고 작게 */
.side-note {
  margin: 1.6em 0 0;
  padding-top: .9em;
  border-top: 1px solid var(--line);
  font-family: var(--font);
  font-size: max(13px, calc(var(--base) * .66));
  font-weight: 400;
  line-height: 1.6;
  text-align: left;
  color: var(--muted);
  opacity: .85;
  word-break: keep-all;
  overflow-wrap: anywhere;
}

/* "말씀 주소만" 모드 */
.verse-ref-only {
  margin: 0;
  text-align: center;
  font-family: var(--serif);
  font-size: calc(var(--verse-size) * 1.6);
  font-weight: var(--verse-weight);
  color: var(--verse-color, var(--text));
}

/* 예시 화면 */
.figure {
  flex: 0 1 42%;
  min-height: 0;
  width: 100%;
  max-width: 36rem;
  display: flex;
}

.figure { position: relative; }

.figure-pic {
  flex: 1;
  min-width: 0;
  min-height: 0;
  display: flex;
}

/* 그림은 비율을 지키며 칸 안에 들어가게, 모서리는 둥글게 */
.figure-pic img {
  display: block;
  margin: auto;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  border-radius: 16px;
  -webkit-user-drag: none;
}

/* 공식 그림이 여러 장이면: 같은 자리에 겹쳐 두고 2초마다 다음 그림이 은은하게 나타남 */
.slides {
  position: relative;
  flex: 1;
  min-width: 0;
  min-height: 0;
}

.slides img {
  position: absolute;
  inset: 0;
  opacity: 0;
  transition: opacity .6s ease;
}

.slides img.on { opacity: 1; }

@media (prefers-reduced-motion: reduce) {
  .slides img { transition: none; }
}

/* 사진 편집 모드: 그림 위의 표시와 버튼 */
.photo-source {
  position: absolute;
  top: 8px;
  left: 8px;
  padding: 3px 9px;
  border-radius: 8px;
  background: rgba(0, 0, 0, .55);
  color: #ffffff;
  font-size: .75rem;
  pointer-events: none;
}

.photo-tools {
  position: absolute;
  left: 8px;
  right: 8px;
  bottom: 8px;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px;
}

.photo-tools button {
  min-height: 38px;
  padding: 6px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--card-bg);
  color: var(--text);
  font: inherit;
  font-size: .875rem;
  box-shadow: 0 2px 8px rgba(0, 0, 0, .18);
  cursor: pointer;
}

.placeholder {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 16px;
  border: 2px dashed var(--line);
  border-radius: 16px;
  color: var(--muted);
  text-align: center;
  word-break: keep-all;
}

.placeholder small { font-size: .8125rem; letter-spacing: .04em; }
.placeholder span { font-size: 1rem; }

/* 가로 화면(휴대폰 가로, PC): 그림 왼쪽, 글 오른쪽 */
@media (orientation: landscape) {
  .screen.example {
    flex-direction: row;
    align-items: stretch;
    justify-content: center;
  }
  .screen.example .figure {
    flex: 0 1 45%;
    height: min(100%, 30rem);
    align-self: center;
  }
  .screen.example .text-area { flex: 1 1 55%; }
}

/* 선택 버튼: 글씨는 화면이 클수록 조금씩 커지고 (휴대폰 17px ~ 큰 PC 24px), 버튼 크기도 글씨에 맞춰 커짐 */
.choices {
  flex: 0 1 auto;
  min-height: 0;
  overflow-y: auto; /* 버튼이 아주 많고 화면이 작으면 버튼 칸만 위아래로 밀림 */
  scrollbar-width: none;
  width: 100%;
  display: grid;
  gap: 10px;
  /* 글씨 크기 설정에 따라 버튼 글씨도 조금씩 커짐 */
  font-size: calc(clamp(1.0625rem, .75rem + .9vmin, 1.5rem) * (.4 + .5 * var(--scale)));
}

/* 선택 화면에 들어온 뒤 0.5초 동안: 흐리게, 눌리지 않음 */
.choices button { transition: opacity .4s ease; }
.choices.locked button { opacity: .4; cursor: default; }

.choices.few { max-width: 20em; grid-template-columns: 1fr; }
/* 버튼이 많을 때: 옆으로 채워 나가고, 글씨가 긴 버튼은 그만큼 넓어짐 (글씨가 잘리거나 두 줄로 나뉘지 않게) */
.choices.many { max-width: 32em; display: flex; flex-wrap: wrap; justify-content: center; }
.choices.many button { flex: 1 1 6em; padding: .5em .7em; }

/* 선택 화면의 질문은 버튼이 많아도 가려지지 않게 자리를 남김 */
.screen.choice .text-area { min-height: min(35%, 7em); }
/* 버튼 글씨: 단어 중간에서는 줄이 안 바뀜 (길면 단어 사이에서만 두 줄로) */
.choices .word { white-space: nowrap; }

/* 가로 화면: 버튼을 옆으로 넓게 펼쳐서 줄 수를 줄임 */
@media (orientation: landscape) {
  .choices.few { max-width: 36em; grid-auto-flow: column; grid-auto-columns: 1fr; }
  .choices.many { max-width: 48em; }
}

/* 큰 화면(PC, 가로 태블릿): 질문과 버튼을 가운데에 모아서 보여줌.
   휴대폰은 엄지로 누르기 쉽게 버튼을 아래에 둠 */
@media (min-width: 900px) and (min-height: 600px) {
  .screen.choice,
  .screen.message { justify-content: center; }
  .screen.choice .text-area,
  .screen.message .text-area { flex: 0 1 auto; }
  .text-area { max-width: 52rem; }
}

/* 버튼 공통 모양 */
.choices button,
.toc-items button,
.toc-close {
  min-height: 48px;
  padding: 12px 16px;
  font: inherit;
  font-size: 1.125rem;
  font-weight: 500;
  color: var(--text);
  background: var(--button-bg);
  border: 1px solid var(--line);
  border-radius: 14px;
  word-break: keep-all;
  cursor: pointer;
}

.choices button {
  min-height: max(48px, 2.9em);
  padding: .55em 1em;
  font-size: 1em;
}

.choices button:active,
.toc-items button:active,
.toc-close:active { background: var(--button-pressed); }

button:focus-visible { outline: 2px solid var(--text); outline-offset: 2px; }

/* 첫 화면 아래 작은 안내 */
.footnote {
  flex: none;
  margin: 0;
  font-size: .8125rem;
  color: var(--muted);
}

/* 끝, 준비 중, 오류 안내 */
.screen.message .text { color: var(--muted); }

/* ---------- 구석 버튼: 목차(오른쪽 위), 이전(왼쪽 아래), 다음(오른쪽 아래) ----------
   상대방 눈에 잘 안 띄게 모두 흐리게 */
.corner {
  position: fixed;
  z-index: 10;
  min-width: 40px;
  height: 40px;
  padding: 0 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--muted);
  opacity: var(--corner-opacity);
  font: inherit;
  font-size: 13px;
  white-space: nowrap;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.corner .chev { font-size: 20px; line-height: 1; }

#toc-button {
  top: max(4px, env(safe-area-inset-top));
  right: max(4px, env(safe-area-inset-right));
  padding: 0;
}

#toc-button svg { fill: currentColor; }

#prev-button {
  left: max(4px, env(safe-area-inset-left));
  bottom: max(4px, env(safe-area-inset-bottom));
}

#next-button {
  right: max(4px, env(safe-area-inset-right));
  bottom: max(4px, env(safe-area-inset-bottom));
}

/* 개발자 모드: 지금 페이지 번호 (목차 버튼 왼쪽) */
#page-label {
  top: max(4px, env(safe-area-inset-top));
  right: calc(max(4px, env(safe-area-inset-right)) + 40px);
  pointer-events: none;
  font-variant-numeric: tabular-nums;
}

/* 처음 화면은 오른쪽에 목차·설정이 있어 번호를 왼쪽에 표시 */
#page-label.home-label {
  left: max(4px, env(safe-area-inset-left));
  right: auto;
}

.screen.return-home { justify-content: center; }
.screen.return-home > .choices { flex: 0 0 auto; }

/* ---------- 전도자 메모: 길게 누르는 동안만 보임 ---------- */
#memo {
  position: fixed;
  z-index: 20;
  left: 0;
  right: 0;
  width: min(36rem, calc(100% - 24px));
  max-height: 70%;
  margin: 0 auto;
  padding: 14px 18px;
  overflow: hidden;
  background: var(--memo-bg);
  color: var(--memo-text);
  border-radius: 16px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, .3);
  font-size: 15px;
  line-height: 1.6;
  word-break: keep-all;
  pointer-events: none; /* 메모가 손가락 아래에 떠도 누르기를 방해하지 않게 */
}

#memo.top { top: max(12px, env(safe-area-inset-top)); }
#memo.bottom { bottom: max(12px, env(safe-area-inset-bottom)); }

.memo-where { margin: 0 0 6px; font-size: .87em; opacity: .65; }
.memo-note { margin: 0 0 10px; }
.memo-next { margin: 0; padding: 0; list-style: none; font-size: .87em; opacity: .8; }
.memo-note:last-child { margin-bottom: 0; }
.memo-check {
  margin: 0 0 10px;
  padding: 8px 10px;
  border-radius: 10px;
  background: rgba(255, 196, 0, .16);
  color: #ffd75e;
  font-size: .87em;
}
.memo-check:last-child { margin-bottom: 0; }

/* ---------- 숨은 목차 + 설정 (점 3개 버튼) ---------- */
#toc {
  position: fixed;
  inset: 0;
  z-index: 30;
  overflow-y: auto;
  background: var(--panel-bg);
  padding:
    max(16px, env(safe-area-inset-top))
    max(16px, env(safe-area-inset-right))
    max(24px, env(safe-area-inset-bottom))
    max(16px, env(safe-area-inset-left));
}

.toc-box { max-width: 30rem; margin: 0 auto; }

.panel-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
}

.tabs {
  display: flex;
  gap: 2px;
  padding: 4px;
  border-radius: 12px;
  background: var(--button-bg);
  border: 1px solid var(--line);
}

.tabs button {
  min-height: 36px;
  padding: 6px 18px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: .9375rem;
  font-weight: 600;
  cursor: pointer;
}

.tabs button[aria-selected="true"] {
  background: var(--card-bg);
  color: var(--text);
  box-shadow: 0 1px 3px rgba(0, 0, 0, .12);
}

.toc-close { margin-left: auto; min-height: 40px; padding: 6px 14px; font-size: 1rem; }

.card {
  margin-top: 12px;
  padding: 16px;
  border-radius: 18px;
  background: var(--card-bg);
}

.set-title {
  display: flex;
  justify-content: space-between;
  margin: 22px 6px -2px;
  font-size: .875rem;
  font-weight: 600;
  color: var(--muted);
}

.set-title .value { color: var(--accent); }

.divider { height: 1px; margin: 14px -16px; background: var(--line); }

/* 목차 */
.toc-list { padding-top: 4px; padding-bottom: 4px; }
.toc-stage { padding: 14px 0; border-top: 1px solid var(--line); }
.toc-stage:first-child { border-top: 0; }
.toc-stage h2 { margin: 0; font-size: 1.0625rem; font-weight: 700; }
.toc-stage-title { margin: 2px 0 12px; font-size: .9375rem; color: var(--muted); word-break: keep-all; }
.toc-stage.pending { opacity: .5; }
.toc-stage.pending .toc-stage-title { margin-bottom: 4px; }
.toc-pending { margin: 0; font-size: .875rem; color: var(--muted); }

.toc-items {
  display: grid;
  gap: 8px;
  grid-template-columns: repeat(auto-fit, minmax(8.5rem, 1fr));
}

.toc-items button { min-height: 46px; font-size: 1rem; }
.toc-items button[aria-current] { border-color: var(--text); }

/* 설정: 화면 모드 (라이트 / 다크 미리 보기) */
.theme-cards { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.theme-cards.system .theme-card { opacity: .5; }

.theme-card {
  display: grid;
  justify-items: center;
  gap: 8px;
  padding: 0;
  border: 0;
  background: none;
  color: var(--text);
  font: inherit;
  cursor: pointer;
}

.mock {
  display: grid;
  align-content: start;
  gap: 6px;
  width: 100%;
  max-width: 140px;
  aspect-ratio: 3 / 4;
  padding: 12px 10px;
  border: 1px solid #d9d9de;
  border-radius: 14px;
}

.mock.light { background: #fafafa; }
.mock.dark { background: #141416; border-color: #333336; }
.mock i { display: block; height: 14px; border: 1px solid #e3e3e6; border-radius: 5px; background: #ffffff; }
.mock.dark i { border-color: #3a3a3e; background: #26262a; }
.mock i.on { border-color: #9fd6d1; background: #d8efed; }
.mock.dark i.on { border-color: #2a6b67; background: #17393a; }

.theme-name { font-size: 1rem; }

.radio {
  width: 24px;
  height: 24px;
  border: 2px solid var(--line);
  border-radius: 50%;
  background: var(--card-bg);
}

.radio.on { border: 7px solid var(--accent); }

/* 설정: 한 줄 (이름 + 켜기/끄기) */
.row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.row-label { font-size: 1rem; }
.row-desc { margin: 4px 0 0; font-size: .8125rem; color: var(--muted); word-break: keep-all; }

.switch {
  position: relative;
  flex: none;
  width: 52px;
  height: 32px;
  padding: 0;
  border: 0;
  border-radius: 16px;
  background: var(--line);
  cursor: pointer;
  transition: background .2s;
}

.switch::after {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: #ffffff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, .25);
  transition: transform .2s;
}

.switch[aria-checked="true"] { background: var(--accent); }
.switch[aria-checked="true"]::after { transform: translateX(20px); }

/* 설정: 여러 칸 중 하나 고르기 (글씨 크기, 모드) */
.segmented {
  display: flex;
  gap: 2px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--button-bg);
}

.segmented button {
  flex: 1 1 0;
  min-height: 42px;
  padding: 4px 6px;
  border: 0;
  border-radius: 11px;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: .9375rem;
  line-height: 1.2;
  word-break: keep-all;
  cursor: pointer;
}

.segmented button[aria-checked="true"] {
  background: var(--accent);
  color: var(--accent-text);
  font-weight: 600;
  box-shadow: 0 2px 6px rgba(0, 0, 0, .15);
}

.seg-label { margin: 0 2px 8px; font-size: 1rem; }

/* 미리 보기 칸: 실제 화면과 같은 바탕색 */
.size-preview,
.style-preview {
  margin: 12px 0 0;
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--bg);
  word-break: keep-all;
}

.size-preview,
.style-preview.verse-sample {
  font-family: var(--serif);
  font-weight: var(--verse-weight);
  line-height: 1.85;
  color: var(--verse-color, var(--text));
}

.size-preview { font-size: var(--verse-size); }

/* 설정: 글씨 모양 (본문 / 말씀) */
.style-preview { margin: 0 0 12px; font-size: 1.25rem; }

.style-preview.text-sample {
  font-weight: var(--text-weight);
  line-height: 1.65;
  color: var(--text-color, var(--text));
}

.style-section .row { margin-bottom: 14px; }
.color-label { margin: 0 2px 8px; }

.swatches {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(34px, 1fr)); /* 작은 휴대폰(320px)에서도 7가지가 한 줄에 */
  gap: 6px 2px;
}

.swatch {
  display: grid;
  justify-items: center;
  gap: 4px;
  padding: 4px 0;
  border: 0;
  border-radius: 10px;
  background: none;
  color: var(--muted);
  font: inherit;
  font-size: .75rem;
  cursor: pointer;
}

.swatch .dot {
  width: 30px;
  height: 30px;
  border: 2px solid var(--card-bg);
  border-radius: 50%;
  box-shadow: 0 0 0 1px var(--line);
}

.swatch[aria-checked="true"] { color: var(--text); font-weight: 600; }
.swatch[aria-checked="true"] .dot { box-shadow: 0 0 0 2px var(--accent); }

/* 설정: 구석 버튼 진하기 (미리 보기 + 조절 바) */
.corner-preview {
  position: relative;
  height: 76px;
  margin-bottom: 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--bg);
}

.cp {
  position: absolute;
  display: flex;
  align-items: center;
  color: var(--muted);
  opacity: var(--corner-opacity);
  font-size: 13px;
}

.cp svg { fill: currentColor; }
.cp-dots { top: 10px; right: 10px; }
.cp-prev { left: 12px; bottom: 10px; }
.cp-next { right: 12px; bottom: 10px; }

.range {
  display: block;
  width: 100%;
  height: 32px;
  margin: 0;
  accent-color: var(--accent);
  touch-action: none; /* 미는 동안 설정 화면이 위아래로 움직이지 않게 */
  cursor: pointer;
}

.range-ends {
  display: flex;
  justify-content: space-between;
  margin: 2px 2px 0;
  font-size: .8125rem;
  color: var(--muted);
}

.range-ends + .row-desc { margin-top: 10px; }

/* ---------- 목차 순서도 (목록에서 두 손가락으로 벌리거나 휠을 올리면) ---------- */
.toc-hint {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 12px 4px 0;
}

.toc-hint p { flex: 1; margin: 0; font-size: .8125rem; color: var(--muted); word-break: keep-all; }

.toc-hint button {
  flex: none;
  min-height: 38px;
  padding: 6px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--card-bg);
  color: var(--text);
  font: inherit;
  font-size: .9375rem;
  font-weight: 600;
  cursor: pointer;
}

/* 목록 위에서 두 손가락 벌리기는 화면 확대 대신 순서도 열기 */
.toc-list { touch-action: pan-y; }

#toc.map-mode { overflow: hidden; }

/* 순서도 색 (2026-12-01: 회색 바깥 카드 + 흰 안쪽 카드, 진한 선. 다크 모드는 어두운 카드 + 밝은 선) */
.flow-map {
  --flow-bg: #f4f5f7;
  --flow-outer: #e2e5ea;
  --flow-inner: #ffffff;
  --flow-line: #4a5265;
  --flow-cap: #6b7487;
  --flow-bar: #c7ccd5;
  --flow-shadow: 0 1px 2px rgba(30, 40, 60, .08);
  --ic-question: #1f8ef1;
  --ic-verse: #9b51e0;
  --ic-example: #3f9d2f;
  --ic-choice: #f08a24;
  position: fixed;
  top: var(--map-top, 64px);
  left: 0;
  right: 0;
  bottom: 0;
  overflow: hidden;
  background: var(--flow-bg);
  border-top: 1px solid var(--line);
  touch-action: none; /* 밀기·벌리기는 순서도가 직접 처리 */
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  cursor: grab;
}

:root[data-theme="dark"] .flow-map {
  --flow-bg: #111317;
  --flow-outer: #252a32;
  --flow-inner: #31373f;
  --flow-line: #9aa4b6;
  --flow-cap: #8d97a8;
  --flow-bar: #3d444f;
  --flow-shadow: 0 1px 3px rgba(0, 0, 0, .4);
  --ic-question: #3a9cf5;
  --ic-verse: #a868e8;
  --ic-example: #4fae3e;
  --ic-choice: #f39a3c;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .flow-map {
    --flow-bg: #111317;
    --flow-outer: #252a32;
    --flow-inner: #31373f;
    --flow-line: #9aa4b6;
    --flow-cap: #8d97a8;
    --flow-bar: #3d444f;
    --flow-shadow: 0 1px 3px rgba(0, 0, 0, .4);
    --ic-question: #3a9cf5;
    --ic-verse: #a868e8;
    --ic-example: #4fae3e;
    --ic-choice: #f39a3c;
  }
}

.flow-map * { touch-action: none; }
.flow-map.dragging { cursor: grabbing; }

.flow-world {
  position: absolute;
  left: 0;
  top: 0;
  transform-origin: 0 0;
}

.flow-world.smooth { transition: transform .3s ease; }

.flow-lines { position: absolute; left: 0; top: 0; overflow: visible; pointer-events: none; }

.flow-lines path {
  fill: none;
  stroke: var(--flow-line);
  stroke-width: calc(1.8px / max(var(--s, 1), .5)); /* 확대·축소해도 선 굵기는 비슷하게 */
  stroke-linecap: round;
  stroke-linejoin: round;
}

.flow-lines .fl-port { fill: var(--flow-line); stroke: var(--flow-inner); stroke-width: 1.5px; }
.flow-lines .fl-join { stroke-width: calc(2.6px / max(var(--s, 1), .5)); } /* 단계 끝 → 다음 단계 */

/* 단계 제목: 작게 줄여 봐도 읽을 수 있는 크기 */
.flow-title {
  position: absolute;
  white-space: nowrap;
  font-size: 18px;
  color: var(--text);
  transform-origin: 0 100%;
  transform: translateY(-100%) scale(var(--inv, 1));
  pointer-events: none;
}

.flow-title span { color: var(--flow-cap); font-size: .85em; }

/* 화면 상자: 바깥 회색 카드 + 안쪽 흰 카드(종류 그림 + 글) + 아래 화면 번호 */
.fn {
  position: absolute;
  width: 196px;
  height: 84px;
  padding: 5px;
  display: flex;
  flex-direction: column;
  border: 0;
  border-radius: 12px;
  background: var(--flow-outer);
  color: var(--text);
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.fn-card {
  height: 52px;
  flex: none;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 0 10px 0 8px;
  overflow: hidden;
  border-radius: 8px;
  background: var(--flow-inner);
  box-shadow: var(--flow-shadow);
}

.fn-ic {
  flex: none;
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border-radius: 7px;
  background: var(--ic-question);
}

.fn-ic svg { width: 20px; height: 20px; fill: none; stroke: #fff; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.fn-verse .fn-ic { background: var(--ic-verse); }
.fn-example .fn-ic { background: var(--ic-example); }
.fn-choice .fn-ic { background: var(--ic-choice); }

.fn-text {
  min-width: 0;
  font-size: 13.5px;
  line-height: 1.3;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  word-break: keep-all;
}

.lod1 .fn-text,
.lod2 .fn-text {
  white-space: normal;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.fn-verse .fn-text { font-family: var(--serif); }

.fn-cap {
  display: flex;
  gap: 6px;
  min-width: 0;
  padding: 5px 4px 0;
  font-size: 11.5px;
  line-height: 1.2;
  color: var(--flow-cap);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.fn-name { overflow: hidden; text-overflow: ellipsis; font-weight: 700; color: var(--accent); }
.fn-big { box-shadow: inset 0 0 0 2px var(--accent); }
.fn-current { background: var(--accent); }
.fn-current .fn-cap,
.fn-current .fn-name { color: var(--accent-text); }
.fn-flash { animation: fn-flash 1.2s ease; }

@keyframes fn-flash {
  0%, 60% { box-shadow: 0 0 0 4px var(--accent); }
  100% { box-shadow: 0 0 0 0 transparent; }
}

/* 큰 줄기 이름표: 작게 줄였을 때만, 늘 같은 크기로 (상자 위에) */
.fn-flag {
  position: absolute;
  display: none;
  padding: 2px 8px;
  border-radius: 8px;
  background: var(--flow-bg);
  color: var(--accent);
  font-size: 14px;
  font-weight: 700;
  white-space: nowrap;
  transform-origin: 0 100%;
  transform: translateY(-100%) scale(var(--inv, 1));
  pointer-events: none;
}

/* 이미 그린 화면이나 다른 단계로 가는 곳 (↩ 돌아가기, → 가기, 끝): 작은 카드 */
.fm {
  position: absolute;
  width: 160px;
  height: 40px;
  padding: 0 10px;
  overflow: hidden;
  border: 5px solid var(--flow-outer);
  border-radius: 12px;
  background: var(--flow-inner);
  color: var(--flow-cap);
  font: inherit;
  font-size: 12.5px;
  line-height: 30px;
  text-align: center;
  white-space: nowrap;
  text-overflow: ellipsis;
  cursor: pointer;
}

.fm-end { cursor: default; }

/* 선택 버튼 글씨 (선 위에) */
.fe {
  position: absolute;
  padding: 0 4px;
  overflow: hidden;
  border-radius: 4px;
  background: var(--flow-bg);
  color: var(--flow-cap);
  font-size: 11.5px;
  line-height: 15px;
  white-space: nowrap;
  text-overflow: ellipsis;
  transform: translateY(-100%);
  pointer-events: none;
}

.fe-end { transform: translate(-100%, -100%); text-align: right; } /* 선 끝(상자 바로 앞)에 맞춤 */

/* 작게 줄였을 때: 큰 줄기 이름만 보이고, 작은 화면은 글 없이 막대로 */
.lod0 .fn { padding: 0; background: var(--flow-bar); box-shadow: none; }
.lod0 .fn > * { visibility: hidden; }
.lod0 .fn-big { background: var(--accent); }
.lod0 .fn-current { background: var(--text); }
.lod0 .fn-flag { display: block; }
.lod0 .fe { display: none; }
.lod0 .fm { color: transparent; }

/* 아래: 단계 단추 + 가로 스크롤 막대 */
.flow-nav {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 14px max(16px, env(safe-area-inset-right)) max(14px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
  background: linear-gradient(to bottom, transparent, var(--flow-bg) 28%);
  cursor: default;
}

.flow-stages { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; }

.flow-stages button {
  min-width: 64px;
  min-height: 38px;
  padding: 0 14px;
  border: 0;
  border-radius: 10px;
  background: var(--flow-outer);
  color: var(--text);
  font: inherit;
  font-size: .875rem;
  font-weight: 600;
  cursor: pointer;
}

.flow-stages button[aria-current="true"] { background: var(--accent); color: var(--accent-text); }

.flow-scroll {
  position: relative;
  width: min(100%, 760px);
  height: 16px;
  border-radius: 8px;
  background: var(--flow-outer);
  cursor: pointer;
}

.flow-thumb {
  position: absolute;
  top: 3px;
  bottom: 3px;
  min-width: 28px;
  border-radius: 5px;
  background: var(--flow-line);
  opacity: .55;
  cursor: grab;
}

/* 높이가 낮은 화면(휴대폰 가로): 단계 단추와 스크롤 막대를 한 줄로 */
@media (max-height: 520px) {
  .flow-nav { flex-direction: row; gap: 12px; padding-top: 8px; padding-bottom: max(10px, env(safe-area-inset-bottom)); }
  .flow-stages { flex-wrap: nowrap; }
  .flow-stages button { min-width: 52px; min-height: 34px; padding: 0 10px; }
  .flow-scroll { flex: 1; width: auto; }
}

.flow-scroll:hover .flow-thumb,
.flow-scroll.dragging .flow-thumb { opacity: .8; }
.flow-scroll.dragging .flow-thumb { cursor: grabbing; }

/* 순서도 단추 (오른쪽 위) */
.flow-tools {
  position: absolute;
  top: 10px;
  right: max(10px, env(safe-area-inset-right));
  display: flex;
  gap: 6px;
}

.flow-tools button {
  min-width: 44px;
  min-height: 40px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--card-bg);
  color: var(--text);
  font: inherit;
  font-size: .9375rem;
  font-weight: 600;
  box-shadow: 0 2px 8px rgba(0, 0, 0, .12);
  cursor: pointer;
}

@media (prefers-reduced-motion: reduce) {
  .flow-world.smooth { transition: none; }
  .fn-flash { animation: none; }
}

/* ---------- 순서도에서 글 고치기 (내 컴퓨터 미리 보기에서만) ---------- */
#toc { --editor-w: min(440px, 46vw); }
#toc.editor-open .flow-map { right: var(--editor-w); }

.flow-tools .flow-edit[aria-pressed="true"] {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-text);
}

.flow-map.editing .fn { cursor: text; }
.fn-editing { box-shadow: 0 0 0 3px var(--accent), 0 4px 14px rgba(0, 0, 0, .18); }

.flow-edit-hint {
  position: absolute;
  left: 10px;
  bottom: 104px; /* 아래 단계 단추·스크롤 막대 위 */
  margin: 0;
  padding: 6px 12px;
  border-radius: 10px;
  background: var(--card-bg);
  color: var(--muted);
  font-size: .8125rem;
  box-shadow: 0 2px 8px rgba(0, 0, 0, .12);
  pointer-events: none;
}

.flow-editor {
  position: fixed;
  top: var(--map-top, 64px);
  right: 0;
  bottom: 0;
  width: var(--editor-w);
  display: flex;
  flex-direction: column;
  border-left: 1px solid var(--line);
  background: var(--card-bg);
  color: var(--text);
  box-shadow: -6px 0 18px rgba(0, 0, 0, .08);
}

.flow-editor * { touch-action: auto; }

.ed-head,
.ed-foot {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
}

.ed-head { border-bottom: 1px solid var(--line); }
.ed-foot { border-top: 1px solid var(--line); }

.ed-title { flex: 1; display: flex; align-items: baseline; gap: 8px; min-width: 0; }
.ed-id { font-size: 1.125rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.ed-type { font-size: .8125rem; color: var(--muted); }

.ed-head button,
.ed-foot button {
  min-height: 38px;
  padding: 6px 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--button-bg);
  color: var(--text);
  font: inherit;
  font-size: .9375rem;
  cursor: pointer;
}

.ed-head .ed-close { min-width: 38px; padding: 0; }

.ed-body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  display: grid;
  align-content: start;
  gap: 18px;
  padding: 16px 14px 24px;
}

.ed-field label { display: block; margin: 0 0 6px; font-size: .875rem; font-weight: 600; }
.ed-hint { margin: 5px 2px 0; font-size: .75rem; color: var(--muted); word-break: keep-all; }

.ed-field textarea,
.ed-field input {
  width: 100%;
  padding: 9px 11px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--bg);
  color: var(--text);
  font: inherit;
  font-size: 1rem;
  line-height: 1.55;
  user-select: text;
  -webkit-user-select: text;
}

.ed-field textarea { resize: vertical; field-sizing: content; min-height: 2.9em; max-height: 45vh; }
.ed-field textarea:focus,
.ed-field input:focus { outline: 2px solid var(--accent); outline-offset: 0; border-color: transparent; }
.ed-field input::placeholder { color: var(--muted); opacity: .8; }

.ed-verse {
  padding: 10px 12px;
  border-radius: 10px;
  background: var(--button-bg);
  font-family: var(--serif);
  line-height: 1.7;
  white-space: pre-line;
  word-break: keep-all;
}

.ed-choices {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 8px;
}

.ed-num { min-width: 1.4em; font-size: .8125rem; color: var(--muted); text-align: right; font-variant-numeric: tabular-nums; }
.ed-next { font-size: .75rem; color: var(--muted); white-space: nowrap; }

.ed-status { flex: 1; min-width: 0; font-size: .8125rem; color: var(--muted); word-break: keep-all; }
.ed-status.ok { color: var(--accent); font-weight: 600; }
.ed-status.error { color: #d93025; font-weight: 600; }

.ed-foot .ed-save {
  min-width: 84px;
  border-color: var(--accent);
  background: var(--accent);
  color: var(--accent-text);
  font-weight: 700;
}

.ed-foot .ed-save:disabled { opacity: .45; cursor: default; }

/* 좁은 화면: 편집 칸은 아래쪽에 */
@media (max-width: 720px) {
  #toc.editor-open .flow-map { right: 0; bottom: 58%; }
  .flow-editor {
    top: auto;
    left: 0;
    width: auto;
    height: 58%;
    border-left: 0;
    border-top: 1px solid var(--line);
    box-shadow: 0 -6px 18px rgba(0, 0, 0, .1);
  }
}

/* ---------- 처음 화면: 네 단계 고르기 ---------- */
.screen.home .text { font-weight: 700; }

.home-stages { max-width: 26em; }

.home-stages button {
  min-height: 3.4em;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: .1em;
  line-height: 1.35;
}

/* 가로 화면: 두 줄 두 칸으로 */
@media (orientation: landscape) {
  .home-stages { max-width: 44em; grid-template-columns: 1fr 1fr; }
}

.home-no { font-size: .78em; font-weight: 700; color: var(--accent); letter-spacing: .02em; }
.home-name { word-break: keep-all; }
.home-pending { font-size: .75em; color: var(--muted); }

/* 처음 화면 오른쪽 위: 점 3개 대신 "목차", "설정" 글자 단추 */
#home-menu {
  position: fixed;
  z-index: 10;
  top: max(4px, env(safe-area-inset-top));
  right: max(4px, env(safe-area-inset-right));
  display: flex;
  gap: 2px;
  opacity: max(var(--corner-opacity), .7);
}

#home-menu button {
  min-height: 40px;
  padding: 0 12px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

#home-menu button:active { background: var(--button-pressed); }

/* 편집 칸: 말씀 절 고르기 (체크를 끄면 그 절이 빠짐) */
.ed-verses { display: grid; gap: 4px; margin-top: 8px; }
.ed-verses.outside { opacity: .45; }

.ed-verse-preview {
  margin-top: 8px;
  padding: 8px 10px;
  border-radius: 8px;
  background: var(--button-bg);
  font-family: var(--serif);
  font-size: .9375rem;
  line-height: 1.6;
}

.ed-verse-preview p { margin: 0; }

.ed-field .ed-verse-row {
  display: grid;
  grid-template-columns: auto auto 1fr;
  align-items: start;
  gap: 8px;
  margin: 0;
  padding: 7px 10px;
  border-radius: 8px;
  background: var(--button-bg);
  font-family: var(--serif);
  font-size: .9375rem;
  font-weight: 400;
  line-height: 1.6;
  word-break: keep-all;
  cursor: pointer;
}

.ed-verse-row.off { opacity: .45; }
.ed-field .ed-verse-row input { width: 18px; height: 18px; margin: .2em 0 0; padding: 0; accent-color: var(--accent); }
.ed-vnum { min-width: 1.4em; margin-top: .25em; font-family: var(--font); font-size: .75rem; color: var(--muted); text-align: right; }
.ed-hint.warn { color: #d93025; font-weight: 600; }

/* 말씀 아래 글 (영어 등 — texts.txt 의 "아래글:") */
.verse-below {
  margin: .9em 0 0;
  text-align: center;
  font-family: Georgia, 'Times New Roman', var(--serif);
  font-size: calc(var(--verse-size) * .78);
  line-height: 1.6;
  color: var(--verse-color, var(--text));
  opacity: .8;
  word-break: keep-all;
  overflow-wrap: anywhere;
}

.verse-below.long { text-align: left; }

.ed-photo-preview { display: block; width: 100%; max-height: 200px; object-fit: contain; border-radius: 8px; background: var(--button-bg); }
.ed-photo-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.ed-photo-actions button { padding: 9px 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--button-bg); color: var(--text); font: inherit; cursor: pointer; }
.ed-photo-actions button:disabled { opacity: .5; }

/* 창조 날짜(2-208~2-214): 일반 본문과 같은 글씨, 스크롤 위 중앙 */
.verse-heading {
  flex: 0 0 auto;
  width: 100%;
  max-height: 30%;
  overflow-y: auto;
  font-family: var(--font);
}

/* ---------- 순서도에서 페이지 추가·연결·지우기 (편집 모드) ---------- */
.fn-new { outline: 2px dashed var(--accent); outline-offset: 2px; }
.fn-new::after {
  content: '새';
  position: absolute;
  top: 4px;
  right: 6px;
  font-size: 10px;
  font-weight: 700;
  color: var(--accent);
}

.fn-dot {
  position: absolute;
  width: 18px;
  height: 18px;
  border: 2px solid var(--accent);
  border-radius: 50%;
  background: var(--card-bg);
  box-shadow: 0 1px 4px rgba(0, 0, 0, .2);
  cursor: crosshair;
}

.fn-dot:hover { background: var(--accent); }
.flow-map.linking,
.flow-map.linking * { cursor: crosshair; }
.fn-drop { box-shadow: 0 0 0 4px var(--accent); }

.flow-lines .flow-drag {
  stroke: var(--accent);
  stroke-width: calc(2px / var(--s, 1));
  stroke-dasharray: 6 4;
  opacity: 1;
}

/* 편집 칸: 버튼 (글씨 + 갈 곳), 페이지 단추, 고르기 칸 */
.ed-label { margin: 0 0 6px; font-size: .875rem; font-weight: 600; }
.ed-badge {
  padding: 1px 7px;
  border-radius: 6px;
  background: var(--accent);
  color: var(--accent-text);
  font-size: .6875rem;
  font-weight: 700;
}

.ed-field select {
  width: 100%;
  min-height: 40px;
  padding: 6px 8px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--bg);
  color: var(--text);
  font: inherit;
  font-size: .9375rem;
}

.ed-choice {
  display: grid;
  grid-template-columns: 1.4em minmax(0, 1fr) auto;
  align-items: center;
  gap: 4px 6px;
  padding: 8px;
  border-radius: 10px;
  background: var(--button-bg);
}

.ed-choice .ed-arrow { grid-column: 1; text-align: right; font-size: .8125rem; color: var(--muted); }
.ed-choice select { grid-column: 2 / 4; }

.ed-body .ed-remove,
.ed-body .ed-more,
.ed-body .ed-danger,
.ed-dialog button {
  min-height: 36px;
  padding: 4px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--card-bg);
  color: var(--text);
  font: inherit;
  font-size: .875rem;
  cursor: pointer;
}

.ed-body .ed-remove { min-width: 36px; padding: 0; color: var(--muted); }
.ed-body .ed-more { margin-top: 8px; }
.ed-action-row { display: flex; flex-wrap: wrap; gap: 8px; }
.ed-action-row .ed-more { margin-top: 0; }
.ed-body .ed-danger { color: #d93025; border-color: currentColor; }
.ed-body .ed-danger:disabled { opacity: .4; cursor: default; }
.ed-actions { padding-top: 14px; border-top: 1px solid var(--line); }

/* 새 페이지 종류 고르기 창 */
.ed-dialog-back {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 16px;
  background: rgba(0, 0, 0, .35);
}

.ed-dialog {
  width: min(420px, 100%);
  padding: 18px;
  border-radius: 16px;
  background: var(--card-bg);
  color: var(--text);
  box-shadow: 0 12px 40px rgba(0, 0, 0, .3);
}

.ed-dialog-title { margin: 0 0 4px; font-size: 1.0625rem; font-weight: 700; }
.ed-kinds { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 14px 0 10px; }
.ed-dialog .ed-kind { display: grid; gap: 2px; min-height: 56px; padding: 8px 10px; text-align: left; background: var(--button-bg); }
.ed-kind strong { font-size: .9375rem; }
.ed-kind span { font-size: .75rem; color: var(--muted); }
.ed-dialog .ed-cancel { width: 100%; }
