/* ==========================================================
 * 오늘의 서신 - 크래프트지 + 손글씨 테마
 * ========================================================== */

:root {
  /* 베이스 톤 — 오늘의큐티는 크래프트지 톤 (warm tan brown). 서신과 동일 텍스처지만 색상 차별화. */
  --kraft-base:  #d9c0a0;
  --kraft-light: #ece0c8;
  --kraft-dark:  #b09870;
  --ink:        #28282a;
  --ink-soft:   #4a4a4c;
  --rule:       #7c7c7e;
  --accent-red:   #b13b34;
  --accent-blue:  #4a6790;
  --accent-green: #6e8a5a;
  --shadow: 0 6px 18px rgba(40, 40, 42, 0.14);
  /* 종이 박스/입력 위에 깔리는 옅은 흰끼 — 무채색 */
  --paper-tint:    rgba(248, 248, 246, 0.55);
  --paper-tint-2:  rgba(248, 248, 246, 0.7);
  --paper-tint-3:  rgba(248, 248, 246, 0.92);
  --max-w: 760px;
  /* 시스템 기본 폰트 — 커스텀 패밀리 모두 제거. (에디터 안에서 사용자가 고른 폰트는 inline style 로 그대로 살아남음) */
  --hand:      system-ui, -apple-system, "Apple SD Gothic Neo", "Malgun Gothic", "맑은 고딕", sans-serif;
  --hand-soft: system-ui, -apple-system, "Apple SD Gothic Neo", "Malgun Gothic", "맑은 고딕", sans-serif;
  --hand-cute: system-ui, -apple-system, "Apple SD Gothic Neo", "Malgun Gothic", "맑은 고딕", sans-serif;
}

/* 종이 텍스처 — kraft tan(d9c0a0) base 위에 paper-bg luminosity blend.
   서신과 동일 텍스처(미세 결) 유지하되 색상만 따뜻한 크래프트지 톤.
   `body::before { position: fixed }` 별도 레이어로 두는 이유: iOS Safari 등 일부 모바일이
   `background-attachment: fixed` 를 무시해 스크롤 시 배경이 따라 올라가던 문제 회피. */
html {
  background-color: #d9c0a0;   /* overscroll 영역(고무줄 효과) 의 색 */
}
html, body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  color: var(--ink);
  font-family: var(--hand);
  font-size: 18px;
  letter-spacing: 0.005em;
  -webkit-font-smoothing: antialiased;
}
body::before {
  content: "";
  position: fixed;
  inset: 0;
  background-color: var(--theme-bg, #d9c0a0);
  background-image: var(--theme-bg-image, url('/images/paper-bg.jpg'));
  background-repeat: repeat;
  background-size: 600px auto;
  background-blend-mode: luminosity;
  z-index: -1;
  pointer-events: none;
}

html { scroll-behavior: smooth; }

a { color: inherit; text-decoration: none; }
a:hover {
  text-decoration: none;
  border-bottom: 1.5px solid currentColor;
}
button { font-family: inherit; }
.link-btn:hover,
.nav-btn:hover { border-bottom: 1.5px solid currentColor; }
/* 카드/원형 버튼은 hover 밑줄을 빼고 배경 톤만 변화 */
.card-link:hover,
.cal-link:hover,
.family-card-link:hover,
.fab a:hover,
.fab summary:hover,
.topbar a:hover,
.topbar button:hover { border-bottom: 0; }
/* pill 형태 anchor 버튼은 hover 시 전체 테두리 유지(밑줄 추가 방지) */
a.btn-pill:hover { border-bottom: 1px solid var(--accent-red); }

.topbar {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 16px;
  padding: 18px 20px 12px;
  max-width: var(--max-w);
  margin: 0 auto;
  border-bottom: 1px solid rgba(70, 70, 72, 0.4);
}
.topbar .brand { justify-self: start; }
.topbar .nav { justify-self: end; }
.topbar-title {
  margin: 0;
  font-family: var(--hand-soft);
  font-size: 20px;
  font-weight: 700;
  color: var(--ink);
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.brand {
  display: inline-flex;
  align-items: center;
  line-height: 1;
}
.brand:hover { text-decoration: none; border-bottom: 0; }
/* 로고+텍스트 통합 SVG (brand-mark-qt.svg). 한 viewBox 안에 글리프 + "오늘의큐티"
   포함. width:auto + height 만 지정해 비율 유지. */
.brand-mark {
  height: 34px;
  width: auto;
  display: block;
}
.nav {
  display: flex;
  gap: 14px;
  align-items: center;
  font-size: 18px;
}
.nav a {
  color: var(--ink-soft);
  padding-bottom: 2px;
  border-bottom: 1.5px solid transparent;
}
.nav a.active {
  color: var(--ink);
  border-bottom-color: var(--rule);
}
.logout-form { margin: 0; }
.link-btn {
  background: none;
  border: 0;
  color: var(--ink-soft);
  cursor: pointer;
  padding: 0;
  font-size: inherit;
}

.page {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 16px 6px 64px;
}
/* 사용자 페이지 — FAB 가 펼쳤을 때(가이드 + 나눔 + 서브메뉴 펼친 상태) viewport
   하단에서 약 380px 차지. 댓글/공감 버튼이 FAB 에 가려지지 않도록 padding-bottom 확보. */
body.is-user .page { padding-bottom: 380px; }

/* 종이 카드: 종이 위 종이 느낌이 너무 강하지 않게 — 얇은 외곽선만 */
.paper {
  position: relative;
  padding: 0 8px 32px;
}
.paper + .paper { margin-top: 18px; }

.muted { color: var(--ink-soft); opacity: 0.8; }
.small { font-size: 16px; }
.hand { font-family: var(--hand-soft); font-weight: 700; font-size: 28px; margin: 0 0 12px; }

/* ===== 서신 카드 ===== */
.letter-head {
  display: flex;
  align-items: baseline;
  gap: 6px 14px;
  flex-wrap: wrap;
  padding-bottom: 6px;
  margin-bottom: 14px;
}
/* 제목까지 포함한 헤더 — 아래에 줄(구분선) */
.letter-head--titled {
  border-bottom: 1px solid rgba(70, 70, 72, 0.4);
  padding-bottom: 12px;
  margin-bottom: 18px;
  /* 좌측 정렬: 제목 → 태그 → 날짜 위에서 아래로 쌓임 */
  flex-direction: column;
  align-items: stretch;
  gap: 6px;
  text-align: left;
}
.letter-head--titled .letter-title {
  margin: 0;
  text-align: left;
  width: 100%;
}
.letter-head--titled .tags {
  margin: 0;
  justify-content: flex-start;
}
.letter-head--titled .date-stamp {
  display: block;
  text-align: left;
}
/* 메인 화면: 날짜 숨김 */
.letter-head--main .date-stamp { display: none; }

/* 중앙 정렬 헤더 — 홈 "오늘의 QT" 화면: 밑줄 없이 날짜만 중앙 */
.letter-head--center {
  align-items: center;
  text-align: center;
  border-bottom: 0;
  padding-bottom: 4px;
}
.letter-head--center .date-stamp,
.letter-head--center .letter-title { text-align: center; }

/* ===== 상세 화면 — 헤더 위에 별도 날짜 라인 =====
   헤더 자체는 메인(letter-head--main) 과 동일하게 제목 풀폭 + 태그 stack */
.letter-date-line {
  display: flex;
  justify-content: flex-end;
  padding-bottom: 8px;
}
.letter-date-line .date-stamp {
  font-size: 12px;
  white-space: nowrap;
  color: var(--ink-soft);
}
.date-stamp {
  font-family: var(--hand-cute);
  color: var(--ink-soft);
  font-size: 18px;
  letter-spacing: 0.03em;
}
.letter-title {
  font-family: var(--hand-soft);
  font-size: 18px;
  margin: 8px 0 4px;
  font-weight: 700;
  letter-spacing: 0.02em;
}
.letter-body {
  white-space: normal;
  word-break: keep-all;
  font-size: 19px;
  line-height: 1.85;
}
.letter-body p { margin: 0.4em 0; padding: 0; }
.letter-body img {
  max-width: 100%;
  height: auto;
  margin: 12px 0;
  border-radius: 2px;
}
/* 에디터에서 지정한 폰트/사이즈/색을 그대로 살리기 위해 본문 영역은 inline 스타일을 우선시 */
.letter-body--rich { font-family: inherit; }
.letter-body--rich .ql-font-serif    { font-family: Georgia, "Times New Roman", serif; }
.letter-body--rich .ql-font-monospace { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }

/* Quill 의 정렬/들여쓰기 클래스 — 사용자 화면에선 quill.snow.css 를 안 부르므로 직접 정의 */
.letter-body--rich .ql-align-center  { text-align: center; }
.letter-body--rich .ql-align-right   { text-align: right; }
.letter-body--rich .ql-align-justify { text-align: justify; }
.letter-body--rich .ql-indent-1 { padding-left: 3em; }
.letter-body--rich .ql-indent-2 { padding-left: 6em; }
.letter-body--rich .ql-indent-3 { padding-left: 9em; }
.letter-body--rich .ql-indent-4 { padding-left: 12em; }
.letter-body--rich .ql-indent-5 { padding-left: 15em; }
.letter-body--rich .ql-indent-6 { padding-left: 18em; }
.letter-body--rich .ql-indent-7 { padding-left: 21em; }
.letter-body--rich .ql-indent-8 { padding-left: 24em; }
.letter-body--rich blockquote {
  border-left: 4px solid rgba(70, 70, 72, 0.4);
  padding-left: 14px;
  margin: 12px 0;
  color: var(--ink-soft);
}
.letter-body--rich img {
  max-width: 100%;
  height: auto;
  display: block;
  margin: 12px auto;
}

.tags {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 6px 10px;
  padding: 0;
  margin: 6px 0 0;
  font-family: var(--hand-cute);
  color: var(--ink-soft);
  font-size: 17px;
}
.tags li::before { content: ""; }
.tags.small { font-size: 15px; }

.verse {
  margin-top: 22px;
  padding: 12px 14px;
  border-left: 3px solid var(--rule);
  background: rgba(248, 248, 246, 0.35);
}
.verse-top {
  margin: 0 0 18px;
  padding: 12px 14px;
  border-left: 3px solid var(--rule);
  background: rgba(248, 248, 246, 0.45);
}
.verse-text { margin: 0; }
.verse-ref { margin: 0 0 6px; font-size: 16px; color: var(--ink-soft); font-weight: 700; }

/* 기도문 — 본문 아래에 verse 와 같은 톤. 줄바꿈 보존. */
.verse-prayer { margin-top: 22px; }
.prayer-text { white-space: pre-wrap; word-break: keep-all; }

.empty { padding: 40px 0; text-align: center; }

.card-actions {
  display: flex;
  gap: 16px;
  margin-top: 22px;
  font-family: var(--hand-cute);
}
.back {
  font-family: var(--hand-cute);
  color: var(--ink-soft);
}

/* ===== 캘린더 ===== */
.calendar-card { padding: 0; }
.calendar { font-family: var(--hand); }
.admin-cal-help { margin: 0 0 4px; }
.cal-legend-row { display: flex; gap: 14px; margin-bottom: 10px; flex-wrap: wrap; }
.cal-divider {
  border: 0;
  border-top: 1px solid rgba(70, 70, 72, 0.3);
  margin: 18px 0 8px;
}
.month-letters { margin-top: 4px; }
.cal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}
.cal-title {
  font-family: var(--hand-soft);
  font-weight: 700;
  font-size: 26px;
  margin: 0;
}
.nav-btn {
  background: transparent;
  border: 1.5px solid rgba(70, 70, 72, 0.45);
  border-radius: 50%;
  width: 44px;
  height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--ink);
  cursor: pointer;
  padding: 0;
  font-family: var(--hand);
  transition: background 150ms ease, transform 120ms ease, border-color 150ms ease;
}
.nav-btn:hover { background: rgba(248, 248, 246, 0.5); border-color: var(--ink); }
.nav-btn:active { transform: scale(0.94); }
.nav-btn[disabled] {
  opacity: 0.3;
  cursor: not-allowed;
  pointer-events: none;
}
.nav-btn svg {
  width: 24px;
  height: 24px;
  stroke: currentColor;
  stroke-width: 2.6;          /* 두꺼운 화살표 */
  stroke-linecap: round;
  stroke-linejoin: round;
  fill: none;
  pointer-events: none;
}

.cal-dow {
  list-style: none;
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  padding: 0;
  margin: 0 0 6px;
  text-align: center;
  color: var(--ink-soft);
  font-size: 16px;
}
.cal-dow li:first-child { color: var(--accent-red); }
.cal-dow li:last-child { color: var(--accent-blue); }

.cal-days {
  list-style: none;
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  padding: 0;
  margin: 0;
  gap: 2px 0;
}
.cal-cell {
  position: relative;
  aspect-ratio: 1 / 1;
  display: flex;
  align-items: center;
  justify-content: center;
}
.cal-link {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  border-radius: 999px;
  position: relative;
}
.cal-link:hover { text-decoration: none; background: rgba(70, 70, 72, 0.06); }
.cal-day-number {
  font-family: var(--hand);
  font-size: 22px;
  color: var(--ink);
}
.cal-cell.out .cal-day-number { color: rgba(70, 70, 72, 0.3); }
.cal-cell:nth-child(7n+1) .cal-day-number { color: var(--accent-red); }
.cal-cell:nth-child(7n) .cal-day-number { color: var(--accent-blue); }
.cal-cell.out:nth-child(7n+1) .cal-day-number,
.cal-cell.out:nth-child(7n) .cal-day-number { color: rgba(70, 70, 72, 0.3); }
/* 사용자 모드: 서신 없는 날짜는 흐리게 (요일 색상도 함께 약화) */
body.is-user .cal-cell:not(.has-letter):not(.today):not(.out) .cal-day-number,
body.is-user .cal-cell:not(.has-letter):not(.today):not(.out):nth-child(7n+1) .cal-day-number,
body.is-user .cal-cell:not(.has-letter):not(.today):not(.out):nth-child(7n) .cal-day-number {
  color: rgba(70, 70, 72, 0.4);
}

/* 오늘: 연필로 슥슥 그린 손글씨 동그라미 — SVG (두 번 겹친 path) 로 들쭉날쭉한 라인 */
.cal-cell.today::before {
  content: "";
  position: absolute;
  inset: 10% 10%;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100'><g fill='none' stroke='%23b13b34' stroke-linecap='round' stroke-linejoin='round'><path d='M50 8 C 78 7 92 27 93 50 C 94 76 71 93 49 92 C 23 94 6 73 8 49 C 6 24 26 6 52 9' stroke-width='2.4' opacity='0.95'/><path d='M52 11 C 76 10 89 30 90 51 C 91 75 69 89 50 90 C 27 90 10 70 11 51 C 9 27 30 11 53 11' stroke-width='1.8' opacity='0.55'/></g></svg>");
  background-size: 100% 100%;
  background-repeat: no-repeat;
  transform: rotate(-4deg);
  pointer-events: none;
  z-index: 0;
}
/* 큐티 등록된 날: 셀 옅은 빨강 워터마크 (배경만). 밑줄은 has-my-comment 로 이관. */
.cal-cell.has-letter {
  background: rgba(177, 59, 52, 0.07);
  border-radius: 8px;
}
/* 내가 나눔을 기록한 날: 손글씨 빨간 실선 밑줄 (옛 has-letter::after 룰 이관) */
.cal-cell.has-my-comment::after {
  content: "";
  position: absolute;
  left: 50%;
  top: calc(50% + 14px);
  transform: translateX(-50%);
  width: 26px;
  height: 6px;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 120 6' preserveAspectRatio='none'><path d='M2 4 Q 20 1, 40 4 T 80 4 T 118 4' stroke='%23b13b34' stroke-width='1.6' fill='none' stroke-linecap='round'/><path d='M3 4.6 Q 22 2, 42 4.4 T 82 4.4 T 117 4.2' stroke='%23b13b34' stroke-width='1' fill='none' stroke-linecap='round' opacity='0.5'/></svg>");
  background-repeat: no-repeat;
  background-size: 100% 100%;
  pointer-events: none;
}
/* 임시저장만 있는 날짜: 셀 옅은 회색 + 우상단 손글씨 점선 밑줄 */
.cal-cell.has-draft:not(.has-letter) {
  background: rgba(70, 70, 72, 0.07);
  border-radius: 8px;
}
.cal-cell.has-draft:not(.has-letter)::after {
  content: "";
  position: absolute;
  left: 50%;
  top: calc(50% + 14px);
  transform: translateX(-50%);
  width: 26px;
  height: 6px;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 120 6' preserveAspectRatio='none'><path d='M2 4 Q 8 2, 14 4 T 26 4' stroke='%23464648' stroke-width='1.4' fill='none' stroke-linecap='round' opacity='0.75'/><path d='M32 4 Q 38 2, 44 4 T 56 4' stroke='%23464648' stroke-width='1.4' fill='none' stroke-linecap='round' opacity='0.75'/><path d='M62 4 Q 68 2, 74 4 T 86 4' stroke='%23464648' stroke-width='1.4' fill='none' stroke-linecap='round' opacity='0.75'/><path d='M92 4 Q 98 2, 104 4 T 116 4' stroke='%23464648' stroke-width='1.4' fill='none' stroke-linecap='round' opacity='0.75'/></svg>");
  background-repeat: no-repeat;
  background-size: 100% 100%;
  pointer-events: none;
}
/* 오늘+나눔: 오늘 동그라미와 밑줄 겹치지 않게 셀 하단으로 */
.cal-cell.today.has-my-comment::after {
  top: auto;
  bottom: 4%;
}
.cal-cell.today.has-draft:not(.has-letter)::after {
  top: auto;
  bottom: 4%;
}
.cal-cell .cal-link,
.cal-cell .cal-day-number { position: relative; z-index: 1; }

/* ===== 목록 ===== */
.list-filter {
  display: grid;
  grid-template-columns: 1fr 140px 130px;
  gap: 10px;
  margin-bottom: 18px;
}
.list-filter input,
.list-filter select {
  font-family: var(--hand);
  font-size: 17px;
  background: rgba(248, 248, 246, 0.5);
  border: 1px solid rgba(70, 70, 72, 0.35);
  border-radius: 4px;
  padding: 8px 10px;
  color: var(--ink);
  box-sizing: border-box;
  width: 100%;
}
.list-filter input.combo-input,
.list-filter select {
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  padding-right: 28px;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%234a3f30' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'><polyline points='6 9 12 15 18 9'/></svg>");
  background-repeat: no-repeat;
  background-position: right 8px center;
  background-size: 14px;
}
/* 데이트리스트 input 의 네이티브 화살표 숨김 (브라우저별 다름) */
input::-webkit-calendar-picker-indicator { opacity: 0; }
input.combo-input::-webkit-calendar-picker-indicator { opacity: 0; }
@media (max-width: 560px) {
  .list-filter { grid-template-columns: 1fr 1fr; }
  /* 검색 인풋만 전체 폭, tag/sort 콤보는 같은 줄에 나란히 */
  .list-filter input[name='q'] { grid-column: 1 / -1; }
}

.card-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 0;
}
.card {
  padding: 18px 8px 20px;
}
.card-list > .card + .card {
  border-top: 1px solid rgba(70, 70, 72, 0.35);
}
.card-link {
  display: grid;
  grid-template-columns: 1fr auto;
  grid-template-areas:
    "title    ."
    "snippet  meta";
  column-gap: 14px;
  row-gap: 6px;
  align-items: center;
}
.card-link:hover { text-decoration: none; }

.card-title {
  grid-area: title;
  font-family: var(--hand-soft);
  font-size: 14px;
  font-weight: 400;
  color: var(--ink-soft);
  margin: 0;
  line-height: 1.3;
}
.card-date {
  grid-area: date;
  font-size: 14px;
  white-space: nowrap;
  align-self: start;
  text-align: right;
  justify-self: end;
}
.card-tags {
  grid-area: tags;
  display: flex;
  flex-wrap: wrap;
  gap: 4px 8px;
  margin: 0;
  padding: 0;
  list-style: none;
  font-size: 14px;
  color: var(--ink-soft);
}
.card-snippet {
  grid-area: snippet;
  margin: 0;
  color: var(--ink);
  font-size: 18px;
  font-weight: 700;
  line-height: 1.4;
  /* 본문 최대 5줄 — 썸네일이 작아진 만큼 본문을 더 노출 */
  display: -webkit-box;
  -webkit-line-clamp: 5;
  -webkit-box-orient: vertical;
  overflow: hidden;
  align-self: start;
}
.card-thumb {
  grid-area: thumb;
  width: 72px;
  aspect-ratio: 1 / 1;
  overflow: hidden;
  margin: 0;
  border: 1px solid rgba(70, 70, 72, 0.25);
  align-self: start;
}
.card-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }

.pager {
  display: flex;
  justify-content: center;
  gap: 16px;
  align-items: center;
  margin-top: 22px;
  font-family: var(--hand-cute);
}
.pg-info { color: var(--ink-soft); }

/* ===== 관리자 로그인/에디터 ===== */
.login-card { max-width: 380px; margin: 60px auto; text-align: center; }
.login-form { display: flex; flex-direction: column; gap: 12px; align-items: stretch; }
.login-form label { display: flex; flex-direction: column; gap: 4px; text-align: left; }
.login-form input[type="password"] {
  font-family: var(--hand);
  font-size: 18px;
  padding: 10px 12px;
  background: rgba(248, 248, 246, 0.6);
  border: 1px solid rgba(70, 70, 72, 0.4);
  border-radius: 4px;
}
.error { color: var(--accent-red); margin: 0; }

.primary {
  background: var(--ink);
  color: var(--kraft-light);
  border: 0;
  padding: 10px 18px;
  font-size: 18px;
  border-radius: 4px;
  cursor: pointer;
  font-family: var(--hand-soft);
  letter-spacing: 0.04em;
}
.primary:hover { background: var(--ink-soft); }
.danger {
  background: transparent;
  color: var(--accent-red);
  border: 1px solid var(--accent-red);
  padding: 9px 16px;
  font-size: 18px;
  border-radius: 4px;
  cursor: pointer;
  font-family: var(--hand-soft);
  font-weight: 700;
  letter-spacing: 0.04em;
}

.editor-card { padding-bottom: 40px; }

/* ===== 에디터 뷰포트 미리보기 토글 (모바일/패드/데스크탑) ===== */
.viewport-toggle {
  display: inline-flex;
  gap: 0;
  margin: 0 auto 16px;
  border: 1px solid rgba(70, 70, 72, 0.35);
  border-radius: 999px;
  overflow: hidden;
  background: rgba(248, 248, 246, 0.6);
}
.editor-card .viewport-toggle { display: flex; width: max-content; margin-left: auto; margin-right: auto; }
.viewport-btn {
  background: transparent;
  border: 0;
  padding: 6px 14px;
  font-family: var(--hand-soft);
  font-size: 13px;
  color: var(--ink-soft);
  cursor: pointer;
  letter-spacing: 0.04em;
}
.viewport-btn + .viewport-btn { border-left: 1px solid rgba(70, 70, 72, 0.2); }
.viewport-btn:hover { background: rgba(70, 70, 72, 0.06); }
.viewport-btn.is-active {
  background: var(--ink);
  color: var(--kraft-light);
}

/* 선택된 뷰포트 기준치(폭). 작은 디바이스에서 큰 모드를 선택하면 body 가 디바이스보다 넓어져서 가로 스크롤이 발생한다. */
body[data-viewport="mobile"]  { min-width: 0; }
body[data-viewport="mobile"]  .page { max-width: 420px;  }
body[data-viewport="tablet"]  { min-width: 820px; }
body[data-viewport="tablet"]  .page { max-width: 820px;  }
body[data-viewport="desktop"] { min-width: 1280px; }
body[data-viewport="desktop"] .page { max-width: 1280px; }
.editor-head {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 8px;
  margin-bottom: 16px;
}
.editor-head > .back         { justify-self: start; grid-column: 1; }
.editor-head > .hand         { justify-self: center; text-align: center; margin: 0; grid-column: 2; }
.editor-head > .status-badge { justify-self: end; grid-column: 3; }
.editor-form { display: flex; flex-direction: column; gap: 14px; }
.field { display: flex; flex-direction: column; gap: 4px; }
.field > span,
.field > .label,
.field > legend {
  font-family: var(--hand-cute);
  color: var(--ink-soft);
  font-size: 16px;
}
.field input[type="text"],
.field input[type="date"],
.field input[type="password"],
.field select,
.field textarea {
  font-family: var(--hand);
  font-size: 18px;
  padding: 8px 10px;
  background: rgba(248, 248, 246, 0.55);
  border: 1px solid rgba(70, 70, 72, 0.4);
  border-radius: 4px;
  color: var(--ink);
  box-sizing: border-box;
  width: 100%;
}
/* 셀렉트 — 네이티브 화살표 끄고 텍스트 가까이 위치한 커스텀 화살표 */
.field select {
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  padding-right: 28px;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%234a3f30' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'><polyline points='6 9 12 15 18 9'/></svg>");
  background-repeat: no-repeat;
  background-position: right 8px center;
  background-size: 14px;
}
.field-row {
  display: grid;
  grid-template-columns: 1fr 80px;
  gap: 10px;
}
/* 3-컬럼 변형 — 날짜 / 요일 / 공개시각 한 줄. 어떤 폭에서도 한 줄 유지 + 높이/정렬 통일.
   라벨·input 폰트는 글로벌 .field 룰(라벨 16, value 18) 그대로 따르고, 모바일도 동일. */
.field-row--three {
  grid-template-columns: minmax(0, 5fr) minmax(0, 2fr) minmax(0, 3fr);
  gap: 6px;
  align-items: end;
}
/* grid cell 자체 압축 허용 — iOS Safari 의 native date input intrinsic min-width 가
   column 폭 넘어서 옆 column 침범하는 현상 차단. */
.field-row--three > .field { min-width: 0; }
.field-row--three .date-input-wrap { min-width: 0; overflow: hidden; }
.field-row--three input[type="date"] {
  min-width: 0;
  width: 100%;
  -webkit-appearance: none;
  appearance: none;
}
/* input/button 높이·정렬 통일 — 폰트는 글로벌 룰(value 18) 그대로 사용 */
.field-row--three input[type="date"],
.field-row--three input[type="text"],
.field-row--three .time-picker-btn {
  height: 40px;
  padding: 6px 8px;
  text-align: center;
  box-sizing: border-box;
}
.field-row--three .time-picker-btn {
  min-width: 0;
  width: 100%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  font-size: 18px;
}
.field-row--three .time-icon { font-size: 16px; }
.field-row--three .time-display { font-size: 18px; font-weight: 600; }
/* 날짜 input 우측 안쪽 달력 버튼 */
.field-row--three .date-input-wrap input[type="date"] { padding-right: 32px; }
.field-row--three .date-picker-btn { right: 4px; padding: 4px 4px; font-size: 18px; }

/* 모바일 — 기본 2컬럼만 1열로 펼침. --three 는 그리드 명시로 한 줄 유지(폰트 약간만 축소). */
@media (max-width: 720px) {
  .field-row { grid-template-columns: 1fr; gap: 12px; }
  .field-row--three {
    grid-template-columns: minmax(0, 5fr) minmax(0, 2fr) minmax(0, 3fr);
    gap: 4px;
  }
  .field-row--three input[type="date"],
  .field-row--three input[type="text"],
  .field-row--three .time-picker-btn {
    height: 36px;
    padding: 4px 4px;
    font-size: 16px;
  }
  .field-row--three .time-picker-btn { font-size: 16px; gap: 2px; }
  .field-row--three .time-display { font-size: 16px; }
  .field-row--three .time-icon { font-size: 14px; }
  .field-row--three .date-input-wrap input[type="date"] { padding-right: 26px; }
  .field-row--three .date-picker-btn { right: 2px; padding: 4px 2px; font-size: 16px; }
}
/* viewport-toggle 미리보기 — body[data-viewport="mobile"] 도 동일 모바일 룰 강제 적용 */
body[data-viewport="mobile"] .field-row { grid-template-columns: 1fr; gap: 12px; }
body[data-viewport="mobile"] .field-row--three {
  grid-template-columns: minmax(0, 5fr) minmax(0, 2fr) minmax(0, 3fr);
  gap: 4px;
}
body[data-viewport="mobile"] .field-row--three input[type="date"],
body[data-viewport="mobile"] .field-row--three input[type="text"],
body[data-viewport="mobile"] .field-row--three .time-picker-btn {
  height: 36px;
  padding: 4px 4px;
  font-size: 16px;
}
body[data-viewport="mobile"] .field-row--three .time-picker-btn { font-size: 16px; gap: 2px; }
body[data-viewport="mobile"] .field-row--three .time-display { font-size: 16px; }
body[data-viewport="mobile"] .field-row--three .time-icon { font-size: 14px; }
body[data-viewport="mobile"] .field-row--three .date-input-wrap input[type="date"] { padding-right: 26px; }
body[data-viewport="mobile"] .field-row--three .date-picker-btn { right: 2px; padding: 4px 2px; font-size: 16px; }
.bible {
  border: 1px dashed rgba(70, 70, 72, 0.4);
  padding: 12px;
  border-radius: 4px;
  margin: 0;                /* fieldset 기본 inline-margin 제거 */
  min-width: 0;             /* grid/flex 부모에서 오버플로우 방지 */
  box-sizing: border-box;
}
.bible-row {
  display: grid;
  grid-template-columns: 1.6fr 0.7fr 0.9fr;
  gap: 8px;
}

/* ===== 태그 입력 (칩 형태) ===== */
.tag-input-row {
  display: flex;
  gap: 8px;
}
.tag-input-row input[type="text"] {
  flex: 1;
  font-family: var(--hand);
  font-size: 18px;
  padding: 8px 10px;
  background: rgba(248, 248, 246, 0.55);
  border: 1px solid rgba(70, 70, 72, 0.4);
  border-radius: 4px;
  color: var(--ink);
  box-sizing: border-box;
}
.tag-input-row button {
  flex: 0 0 auto;
  padding: 8px 16px;
}
.tag-chips {
  list-style: none;
  margin: 8px 0 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 6px 8px;
}
.tag-chips:empty { display: none; }
.tag-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 8px 4px 10px;
  background: rgba(248, 248, 246, 0.7);
  border: 1px solid rgba(70, 70, 72, 0.35);
  border-radius: 999px;
  font-size: 14px;
  color: var(--ink);
}
.tag-chip-remove {
  background: transparent;
  border: 0;
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
  color: var(--ink-soft);
  padding: 0 2px;
}
.tag-chip-remove:hover { color: var(--accent-red); }
.verse-preview {
  margin: 8px 0 0;
  font-size: 16px;
  color: var(--ink-soft);
}
.verse-preview:empty { display: none; }

.editor-area {
  background: rgba(248, 248, 246, 0.6);
  border: 1px solid rgba(70, 70, 72, 0.4);
  border-radius: 4px;
  min-height: 450px;
}
.prayer-textarea {
  font-family: var(--hand);
  font-size: 17px;
  line-height: 1.4;
  padding: 10px 12px;
  background: rgba(248, 248, 246, 0.55);
  border: 1px solid rgba(70, 70, 72, 0.4);
  border-radius: 4px;
  color: var(--ink);
  box-sizing: border-box;
  width: 100%;
  resize: vertical;
}

/* ===== SunEditor 톤 보정 — 사이트 크래프트 톤에 맞춤 ===== */
.sun-editor {
  border-color: rgba(70, 70, 72, 0.4) !important;
  border-radius: 4px !important;
  background: transparent;
}
.sun-editor .se-toolbar {
  background: rgba(248, 248, 246, 0.85) !important;
  outline: none;
  border-bottom: 1px solid rgba(70, 70, 72, 0.3) !important;
}
.sun-editor .se-wrapper,
.sun-editor .se-wrapper-inner {
  background: rgba(248, 248, 246, 0.6) !important;
}
.sun-editor .se-wrapper .se-wrapper-inner {
  font-family: var(--hand);
  color: var(--ink);
  line-height: 1.3 !important;
}
.sun-editor .se-wrapper .sun-editor-editable,
.sun-editor .se-wrapper .se-wrapper-wysiwyg.sun-editor-editable {
  line-height: 1.3 !important;
}
.sun-editor .se-wrapper .sun-editor-editable p { padding-bottom: 0; }

.actions { display: flex; gap: 10px; align-items: center; margin-top: 8px; flex-wrap: wrap; }
.actions-spacer { flex: 1; }
.autosave-row { display: flex; justify-content: flex-end; margin-top: 6px; min-height: 1.2em; }
.autosave-status { color: var(--ink-soft); font-size: 14px; }

/* htmx 진행 표시 */
.htmx-indicator { opacity: 0; transition: opacity 200ms; }
.htmx-request .htmx-indicator { opacity: 1; }

/* ===== 플로팅 버튼 (FAB) =====
   - 하단 중앙: 좌(이전) / 위(최상단) / 우(다음) — 서신 이동
   - 하단 우측: 메뉴 트리거(☰) + 좌측 뒤로(‹) + 우리서신/목록/캘린더 펼침
   - 두 그룹 모두 `bottom: 18px` 같은 선상에 위치 */
/* 중앙 그룹 — 좌·↑·우 컴팩트(간격 4px) */
.fab-nav-group {
  position: fixed;
  bottom: 18px;
  left: 50%;
  margin-left: -76px;          /* 폭 152 의 절반 */
  width: 152px;                /* 48 + 4 + 48 + 4 + 48 */
  height: 48px;
  z-index: 50;
  pointer-events: none;
  transition: opacity 240ms ease, transform 280ms cubic-bezier(.2,.7,.3,1.4);
}
.fab-nav-group > * { pointer-events: auto; }

/* 좌측 하단 — 뒤로가기 단독 그룹 */
.fab-back-group {
  position: fixed;
  bottom: 18px;
  left: 18px;
  width: 48px;
  height: 48px;
  z-index: 50;
  transition: opacity 240ms ease, transform 280ms cubic-bezier(.2,.7,.3,1.4);
}
.fab-back-btn { position: relative; }   /* ::after 툴팁 자기 기준 */

/* 우측 하단 — 메뉴 트리거 단독, 펼치면 위로 3개 */
.fab {
  position: fixed;
  bottom: 18px;
  right: 18px;
  width: 48px;
  height: 48px;
  z-index: 50;
  transition: opacity 240ms ease, transform 280ms cubic-bezier(.2,.7,.3,1.4),
              height 200ms ease;
  pointer-events: none;
}
.fab > * { pointer-events: auto; }
.fab.is-open { height: 220px; }

.fab-trigger {
  position: absolute !important;
  bottom: 0;
  right: 0;
}

/* 트리거 햄버거 ↔ 닫기(X) 아이콘 토글 */
.fab-trigger .icon-close { display: none; }
.fab.is-open .fab-trigger .icon-menu  { display: none; }
.fab.is-open .fab-trigger .icon-close { display: inline; }

/* 화면에 한동안 반응이 없을 때 가장자리로 사라지는 효과 */
body.fab-hidden .fab-nav-group { opacity: 0; transform: translateY(80px);  pointer-events: none; }
body.fab-hidden .fab           { opacity: 0; transform: translateX(80px);  pointer-events: none; }
body.fab-hidden .fab-back-group { opacity: 0; transform: translateX(-80px); pointer-events: none; }

/* 페이지별 FAB 노출 제어 */
/* 캘린더 화면: ↑(상단이동) 자체가 무의미 → 숨김 */
body.page-calendar .fab-nav--up { display: none; }
/* 사용자 메인(home): 어디서 온 게 아니라 시작점 → 뒤로가기 무의미 → 숨김 */
body.page-home .fab-back-group { display: none; }

.fab-btn {
  box-sizing: border-box;
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(248, 248, 246, 0.92);
  border: 1px solid rgba(70, 70, 72, 0.45);
  border-radius: 50%;
  color: var(--ink);
  cursor: pointer;
  box-shadow: var(--shadow);
  padding: 0;
  text-decoration: none;
  transition: background 150ms ease, transform 220ms cubic-bezier(.2,.7,.3,1.4),
              opacity 200ms ease, visibility 200ms;
}
.fab-btn:hover { background: rgba(248, 248, 246, 1); }
.fab-btn svg {
  width: 22px;
  height: 22px;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
  fill: none;
  pointer-events: none;
}

/* 하단 중앙 — 좌/위/우 (모두 같은 줄, bottom: 0). gap 4px 컴팩트 */
.fab-nav { position: absolute; }
.fab-nav--left  { bottom: 0; left: 0;     }
.fab-nav--up    { bottom: 0; left: 52px;  }   /* 48 + 4 */
.fab-nav--right { bottom: 0; left: 104px; }   /* 48 + 4 + 48 + 4 */

/* 이전/다음 서신 — 페이지 맨 아래로 스크롤한 시점에만 노출 */
.fab-nav--left, .fab-nav--right {
  visibility: hidden;
  opacity: 0;
  transition: opacity 200ms ease, visibility 200ms;
}
body.at-bottom .fab-nav--left,
body.at-bottom .fab-nav--right {
  visibility: visible;
  opacity: 1;
}

/* 하단 우측 — 트리거 + 펼침 메뉴 (메뉴는 .fab 컨테이너 기준) */
.fab-submenu {
  position: absolute;
  bottom: 60px;
  right: 0;
  width: 48px;
  list-style: none;
  margin: 0;
  padding: 0;
}
.fab-submenu > li {
  position: absolute;
  bottom: 0;
  right: 0;
}
.fab-submenu .fab-btn {
  visibility: hidden;
  opacity: 0;
  transform: translate(0, 0);
  pointer-events: none;
}
.fab.is-open .fab-submenu .fab-btn { visibility: visible; opacity: 1; pointer-events: auto; }
/* 아이템 수가 페이지별로 다름(공유/다운로드 유무). 마지막 아이템부터 60px 간격으로 위로 쌓는다.
   nth-last-child(N) → translate(0, -(N-1)*60px). 최대 5개까지 지원 (-240px). */
.fab.is-open .fab-submenu li:nth-last-child(1) .fab-btn { transform: translate(0, 0); }
.fab.is-open .fab-submenu li:nth-last-child(2) .fab-btn { transform: translate(0, -60px); }
.fab.is-open .fab-submenu li:nth-last-child(3) .fab-btn { transform: translate(0, -120px); }
.fab.is-open .fab-submenu li:nth-last-child(4) .fab-btn { transform: translate(0, -180px); }
.fab.is-open .fab-submenu li:nth-last-child(5) .fab-btn { transform: translate(0, -240px); }

/* 캡처 중인 다운로드 버튼: 살짝 회전하는 다운 화살표로 진행 표시 */
.fab-btn.is-busy { opacity: 0.7; cursor: progress; }
.fab-btn.is-busy svg { animation: capture-spin 1.1s linear infinite; transform-origin: 50% 50%; }
@keyframes capture-spin {
  from { transform: rotate(0); }
  to   { transform: rotate(360deg); }
}

/* ===== FAB 툴팁 =====
   data-tip 속성 텍스트를 버튼 왼쪽에 띄움. PC 는 hover/focus 시, 모바일은 .fab.is-open 시 (펼쳤을 때 라벨 항상 표시).
   ⚠️ position: relative 는 .fab-btn 자체에 주지 말 것 — .fab-nav--up/left/right 의 absolute 좌표를 깨뜨려 ↑/←/→ 가 한 줄에서 어긋남.
   모든 fab-btn 은 이미 absolute 또는 absolute 자식이라 ::after 가 자기 기준으로 잘 잡힘. */
.fab-btn[data-tip]::after {
  content: attr(data-tip);
  position: absolute;
  top: 50%;
  right: calc(100% + 10px);
  transform: translateY(-50%);
  background: rgba(40, 28, 12, 0.92);
  color: #f6efd8;
  font-family: var(--hand-cute);
  font-size: 13px;
  line-height: 1;
  padding: 6px 10px;
  border-radius: 6px;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: opacity 140ms ease;
  z-index: 60;
}
/* 좌측 끝(이전) 버튼은 왼쪽이 화면 밖이라 오른쪽으로 띄움 */
.fab-nav--left[data-tip]::after {
  right: auto;
  left: calc(100% + 10px);
}
/* 우측 끝 트리거 — 화면 오른쪽 가장자리라 좌측으로 띄우면 잘릴 일 없음(기본). 위쪽으로 살짝 옮겨 펼친 메뉴 가리지 않도록 */
.fab-trigger[data-tip]::after {
  top: auto;
  bottom: calc(100% + 10px);
  right: 50%;
  transform: translateX(50%);
}
/* 펼친 메뉴 안 버튼만 좁게 relative 부여 — transform 따라 ::after 도 함께 이동.
   .fab-nav 같은 다른 absolute 버튼에는 영향 없음 (셀렉터가 .fab-submenu 하위로 한정). */
.fab-submenu .fab-btn[data-tip] { position: relative; }
/* 펼친 상태 — 모바일/PC 모두 라벨 노출 (사용자가 어떤 버튼인지 알 수 있게). */
.fab.is-open .fab-btn[data-tip]::after { opacity: 1; }

@media (hover: hover) and (pointer: fine) {
  /* PC 호버/포커스 — 펼치지 않은 상태에서도 라벨 노출 */
  .fab-btn[data-tip]:hover::after,
  .fab-btn[data-tip]:focus-visible::after { opacity: 1; }
}

/* ===== 상태 뱃지 (관리자 전용) — 손글씨 밑줄로 표시 ===== */
.status-badge {
  display: inline-block;
  padding: 2px 4px 6px;
  font-size: 13px;
  font-weight: 700;
  vertical-align: middle;
  letter-spacing: 0.02em;
  line-height: 1.1;
  background-repeat: no-repeat;
  background-position: left bottom;
  background-size: 100% 6px;
}
/* 임시저장: 손글씨 점선 밑줄 (회색) */
.status-draft {
  color: var(--ink-soft);
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 120 6' preserveAspectRatio='none'><path d='M2 4 Q 8 2, 14 4 T 26 4' stroke='%23464648' stroke-width='1.4' fill='none' stroke-linecap='round' opacity='0.75'/><path d='M32 4 Q 38 2, 44 4 T 56 4' stroke='%23464648' stroke-width='1.4' fill='none' stroke-linecap='round' opacity='0.75'/><path d='M62 4 Q 68 2, 74 4 T 86 4' stroke='%23464648' stroke-width='1.4' fill='none' stroke-linecap='round' opacity='0.75'/><path d='M92 4 Q 98 2, 104 4 T 116 4' stroke='%23464648' stroke-width='1.4' fill='none' stroke-linecap='round' opacity='0.75'/></svg>");
}
/* 발행됨: 손글씨 실선 밑줄 (빨강) */
.status-published {
  color: var(--accent-red);
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 120 6' preserveAspectRatio='none'><path d='M2 4 Q 20 1, 40 4 T 80 4 T 118 4' stroke='%23b13b34' stroke-width='1.6' fill='none' stroke-linecap='round'/><path d='M3 4.6 Q 22 2, 42 4.4 T 82 4.4 T 117 4.2' stroke='%23b13b34' stroke-width='1' fill='none' stroke-linecap='round' opacity='0.5'/></svg>");
}

/* ===== 캘린더 범례 (관리자) — 뱃지와 동일한 밑줄 톤 ===== */
.cal-legend {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-left: 12px;
  font-size: 14px;
  color: var(--ink-soft);
}
.legend-dot {
  display: inline-block;
  width: 22px;
  height: 6px;
  background-repeat: no-repeat;
  background-position: left bottom;
  background-size: 100% 6px;
}
.legend-published {
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 120 6' preserveAspectRatio='none'><path d='M2 4 Q 20 1, 40 4 T 80 4 T 118 4' stroke='%23b13b34' stroke-width='1.6' fill='none' stroke-linecap='round'/></svg>");
}
.legend-draft {
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 120 6' preserveAspectRatio='none'><path d='M2 4 Q 8 2, 14 4 T 26 4' stroke='%23b13b34' stroke-width='1.4' fill='none' stroke-linecap='round'/><path d='M32 4 Q 38 2, 44 4 T 56 4' stroke='%23b13b34' stroke-width='1.4' fill='none' stroke-linecap='round'/><path d='M62 4 Q 68 2, 74 4 T 86 4' stroke='%23b13b34' stroke-width='1.4' fill='none' stroke-linecap='round'/><path d='M92 4 Q 98 2, 104 4 T 116 4' stroke='%23b13b34' stroke-width='1.4' fill='none' stroke-linecap='round'/></svg>");
}

/* ===== secondary 버튼 (임시저장 등) ===== */
.secondary {
  background: transparent;
  color: var(--ink);
  border: 1px solid rgba(70, 70, 72, 0.5);
  padding: 9px 16px;
  font-size: 18px;
  border-radius: 4px;
  cursor: pointer;
  font-family: var(--hand-soft);
  font-weight: 700;
  letter-spacing: 0.04em;
}
.secondary:hover { background: rgba(248, 248, 246, 0.6); border-bottom: 1px solid rgba(70, 70, 72, 0.5); }

/* ===== 에러 페이지 ===== */
.error-card {
  text-align: center;
  padding: 64px 24px;
}
.error-reason {
  font-family: var(--hand-soft);
  font-size: 22px;
  color: var(--ink);
  margin: 0 0 28px;
}
.error-actions {
  display: flex;
  justify-content: center;
}
.error-actions .primary {
  display: inline-block;
  text-decoration: none;
}

/* ==========================================================
 * QT 전용 — 운영 wooriletter 테마 변수에 맞춰 색·여백 통일
 * ========================================================== */

/* QT 관리자 — 말씀 영역 */
.qt-verses-field { padding: 12px 14px; }

/* toolbar — 한 줄: 좌측 [말씀보기] · 우측 [+ 영역 추가]. 두 버튼 사이즈 통일. */
.qt-verses-field .qt-verse-toolbar {
  display: flex; align-items: center; gap: 8px;
}
.qt-verses-field .qt-verse-toolbar--actions {
  justify-content: space-between;
  margin: 0 0 12px;
}
.qt-verses-field .qt-verse-toolbar--actions #qtPreviewBoth,
.qt-verses-field .qt-verse-toolbar--actions #qtVerseAdd {
  padding: 10px 22px;
  font-size: 16px;
  border-radius: 6px;
  font-weight: 600;
}

.qt-verses-field .qt-verse-list {
  list-style: none; padding: 0; margin: 0;
  display: flex; flex-direction: column; gap: 20px;
  counter-reset: verse-area;        /* 영역 자동 번호 매김 (1부터) */
}
.qt-verses-field .qt-verse-item {
  background: rgba(248, 248, 246, 0.75);
  border: 1px solid rgba(40, 40, 42, 0.15);
  border-radius: 4px;
  padding: 10px;
  box-shadow: none;
  display: block !important;       /* 부모가 flex 라도 두 row 가 세로로 쌓이게 */
  position: relative;               /* 번호 배지 + X 버튼 absolute 기준 */
  counter-increment: verse-area;
}
/* 카드 좌측 상단 모서리 번호 배지. X 는 우측 상단 모서리 (별도 룰). */
.qt-verses-field .qt-verse-item::before {
  content: counter(verse-area);
  position: absolute;
  top: -10px;
  left: -4px;
  background: var(--ink);
  color: var(--kraft-light);
  min-width: 22px;
  height: 22px;
  padding: 0 6px;
  border-radius: 11px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: var(--hand-soft);
  font-size: 12px;
  font-weight: 600;
  line-height: 1;
  z-index: 2;
}
.qt-verses-field .qt-verse-row {
  display: flex !important;
  align-items: center;
  gap: 6px;
  flex-wrap: nowrap;
  width: 100%;
  min-width: 0;
}
/* 범위 row — Grid 로 컬럼 명시 (flex 보다 예측 가능). 데스크탑: [book 200][start 1fr][end 1fr] */
.qt-verses-field .qt-verse-row--range {
  display: grid !important;
  grid-template-columns: 200px 1fr 1fr;
  gap: 6px;
  align-items: center;
  width: 100%;
  min-width: 0;
}
/* 소제목 row — input 만 (X 는 absolute 로 카드 우측 상단 모서리로 빠짐). input 가로 전부. */
.qt-verses-field .qt-verse-row--title {
  margin-bottom: 6px;
  align-items: stretch;
  gap: 0;
}
.qt-verses-field .qt-verse-row--title .qt-verse-section { flex: 1 1 0; width: 100%; }
/* X 버튼 — 카드 우측 상단 모서리에 floating (번호 배지의 오른쪽). z-index 로 input 위에. */
.qt-verses-field .qt-verse-row--title .qt-verse-actions {
  position: absolute;
  top: -10px;
  right: -4px;
  display: inline-flex;
  margin: 0;
  z-index: 2;
}
.qt-verses-field .qt-verse-row--title .qt-verse-btn--remove {
  width: 22px;
  min-width: 22px;
  height: 22px;
  padding: 0;
  font-size: 14px;
  border-radius: 11px;
  border: 1px solid var(--accent-red);
  color: var(--accent-red);
  background: var(--kraft-light);
  line-height: 1;
}

/* 모달 — 화면 90% 폭, two-column (.qt-modal 기본 width 보다 명시도 +1) */
.qt-modal.qt-modal--xlarge {
  width: 90vw;
  max-width: 90vw;
  max-height: 88vh;
  overflow-y: auto;
}
.verse-preview-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
}
.verse-preview-col-title {
  font-family: var(--hand-soft);
  font-size: 17px;
  margin: 0 0 8px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--rule);
  text-align: center;
}
@media (max-width: 720px) {
  .verse-preview-grid { grid-template-columns: 1fr; }
}

/* 말씀보기 버튼 — secondary 톤, guide toolbar 우측에서 크게 표시 */
.qt-verse-btn--preview {
  color: var(--ink);
  border-color: rgba(40, 40, 42, 0.5);
  background: #fff;
  padding: 10px 28px;
  font-size: 18px;
  font-weight: 600;
  border-radius: 6px;
}
.qt-verse-btn--preview:hover { background: rgba(40, 40, 42, 0.06); border-color: rgba(40, 40, 42, 0.8); }

/* input override — `input` element selector 포함해 글로벌 `.field input[type="text"]` (0,2,1)
   와 같은 specificity 로 source order 에서 이김. 가운데 정렬·폰트 키워 숫자 가독성 확보.
   width:auto 로 글로벌 .field input { width: 100% } 부작용 차단 — flex 자식 안에서
   width 100% 가 min-content 로 잡혀 row 가 자식 합으로 강제 확장되던 PC 깨짐 원인. */
.qt-verses-field input.qt-verse-section,
.qt-verses-field input.qt-verse-book,
.qt-verses-field input.qt-verse-num {
  font-family: var(--hand);
  border: 1px solid rgba(70, 70, 72, 0.4);
  border-radius: 4px;
  background: #fff;
  color: var(--ink);
  box-sizing: border-box;
  padding: 6px 8px;
  font-size: 18px;
  width: auto;
  min-width: 0;
}
/* flex 자식 압축 보장 — min-content(기본값) 가 부모 vacate 못하던 문제 차단 */
.qt-verses-field .qt-verse-row > *,
.qt-verses-field .qt-verse-range > * { min-width: 0; }
/* 권 — 최소 200px (7자 "데살로니가전서" + 충분한 여유). 데스크탑에선 고정.
   장/절 — 최소 50px 보장하면서 남은 폭 균등 분배(flex 1 1 0). text-align center · 패딩 좌우 4 로 텍스트 가용 폭 확대. */
.qt-verses-field input.qt-verse-book { flex: 0 0 200px; width: 200px; min-width: 200px; }
/* num — flex 1 1 0 으로 행 남은 폭을 4개가 균등 분배. min-width 0 으로 좁은 viewport 에서도 압축 가능.
   width:auto 와 결합돼 글로벌 width:100% 부작용은 차단되지만 flex grow 는 살아있음. */
.qt-verses-field input.qt-verse-num { flex: 1 1 0; width: auto; min-width: 0; text-align: center; padding: 6px 4px; }
/* datalist 화살표 아이콘 완전 제거 — opacity:0 (공간 차지) → display:none + appearance:none.
   장/절 input 의 우측 화살표 영역이 입력 전후 모두 사라져 텍스트 가용 폭이 일정. */
.qt-verses-field input.combo-input { -webkit-appearance: none; appearance: none; background-image: none; }
.qt-verses-field input.combo-input::-webkit-calendar-picker-indicator { display: none !important; opacity: 0; -webkit-appearance: none; appearance: none; }
.qt-verses-field input.combo-input::-webkit-list-button { display: none !important; -webkit-appearance: none; appearance: none; }

.qt-verse-sep { color: var(--ink-soft); font-weight: 600; padding: 0 2px; user-select: none; }
.qt-verse-actions { display: inline-flex; gap: 6px; align-items: center; flex-shrink: 0; }

/* 시작/끝 범위 wrapper — Grid 셀(1fr) 안에서 내부 num/sep 을 flex 균등 분배.
   overflow:hidden 으로 자식이 어떤 이유든 부모 폭 넘으면 시각적으로 클립 (안전망). */
.qt-verses-field .qt-verse-range {
  display: flex;
  align-items: center;
  gap: 4px;
  min-width: 0;
  overflow: hidden;
}

/* 모바일 — Grid template-areas 로 [book book / start end] 2행 명시. */
@media (max-width: 720px) {
  .qt-verses-field .qt-verse-row--range {
    grid-template-columns: 1fr 1fr;
    grid-template-areas:
      "book book"
      "start end";
    gap: 8px 6px;
  }
  .qt-verses-field .qt-verse-row--range > input.qt-verse-book { grid-area: book; width: 100%; min-width: 0; }
  .qt-verses-field .qt-verse-row--range > .qt-verse-range--start { grid-area: start; }
  .qt-verses-field .qt-verse-row--range > .qt-verse-range--end { grid-area: end; }
}
body[data-viewport="mobile"] .qt-verses-field .qt-verse-row--range {
  grid-template-columns: 1fr 1fr;
  grid-template-areas:
    "book book"
    "start end";
  gap: 8px 6px;
}
body[data-viewport="mobile"] .qt-verses-field .qt-verse-row--range > input.qt-verse-book { grid-area: book; width: 100%; min-width: 0; }
body[data-viewport="mobile"] .qt-verses-field .qt-verse-row--range > .qt-verse-range--start { grid-area: start; }
body[data-viewport="mobile"] .qt-verses-field .qt-verse-row--range > .qt-verse-range--end { grid-area: end; }

.qt-verse-btn {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 4px 10px; border-radius: 4px; font-size: 13px;
  border: 1px solid rgba(40,40,42,0.25); background: #fff;
  cursor: pointer; font-family: inherit; line-height: 1.2;
  transition: background 120ms ease, border-color 120ms ease;
}
.qt-verse-btn--new {
  color: #1f5fab; border-color: rgba(31,95,171,0.4); background: rgba(31,95,171,0.06);
}
.qt-verse-btn--new:hover { background: rgba(31,95,171,0.14); border-color: rgba(31,95,171,0.7); }
.qt-verse-btn--rev {
  color: #6a4b2a; border-color: rgba(106,75,42,0.4); background: rgba(106,75,42,0.06);
}
.qt-verse-btn--rev:hover { background: rgba(106,75,42,0.14); border-color: rgba(106,75,42,0.7); }
.qt-verse-btn--remove {
  color: var(--accent-red); border-color: rgba(177,59,52,0.5); background: rgba(177,59,52,0.06);
  width: 28px; padding: 4px 0; font-size: 16px; font-weight: 700;
}
.qt-verse-btn--remove:hover { background: rgba(177,59,52,0.14); border-color: var(--accent-red); }

/* 사용자 화면 — 영역 단위 소제목 (관리자 입력) */
.qt-verse-group-title {
  font-family: var(--hand-soft);
  font-size: 19px;
  font-weight: 700;
  color: var(--ink);
  margin: 14px 0 4px;
}

/* QT 토스트 — 번역 토글 시 짧게 표시 */
.qt-toast {
  position: fixed;
  bottom: 88px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: rgba(40, 40, 42, 0.92);
  color: #fff;
  padding: 10px 18px;
  border-radius: 6px;
  font-size: 15px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 200ms ease, transform 200ms ease;
  z-index: 1000;
}
.qt-toast.is-visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* 에디터 하단 단축키 + 공개시각 안내 */
.editor-shortcut-help {
  margin: 14px 0 0;
  padding: 10px 14px;
  background: rgba(248, 248, 246, 0.5);
  border-left: 3px solid var(--rule);
  border-radius: 4px;
  line-height: 1.55;
}
.editor-shortcut-help strong {
  color: var(--accent-red);
  font-weight: 700;
}


/* 사용자 화면 번역 토글 toolbar — 좌: 종합 권장절(첫~끝) / 우: 현재 번역 + 변경 버튼 */
.qt-verses-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin: 8px 0 14px;
}
.qt-verses-toolbar .qt-verse-range {
  margin: 0;
  font-size: 17px;
  color: var(--ink);
  font-weight: 600;
}
.qt-verses-toolbar-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-left: auto;
}
.qt-verse-current-wrap {
  display: inline-flex;
  align-items: baseline;
  gap: 6px;
}
.qt-verse-current-prefix {
  color: rgba(40, 40, 42, 0.45);
  font-size: 14px;
}
.qt-verse-current-name {
  color: var(--ink);
  font-weight: 700;
  font-size: 17px;
}
.qt-verse-toggle {
  padding: 9px 22px;
  font-size: 16px;
  font-weight: 600;
  border-radius: 6px;
}
/* 기존 .qt-verse-current (옛 클래스명) 호환 — 미사용 시 영향 없음 */
.qt-verse-current { color: var(--ink-soft); }

/* 새번역 구간 제목 — 절 위에 표시 */
.verse-section-title {
  font-family: var(--hand-soft);
  font-weight: 700;
  font-size: 16px;
  color: var(--ink);
  margin: 12px 0 4px;
}

/* 관리자 미리보기 모달 본문 */
.verse-preview-body {
  max-height: 60vh;
  overflow-y: auto;
  padding-right: 4px;
}
.verse-preview-body .verse-text { margin: 4px 0; }
.verse-preview-body .verse-num { font-weight: 700; color: var(--accent-red); margin-right: 4px; }
.verse-preview-body .verse-preview-section + .verse-preview-section { margin-top: 18px; padding-top: 14px; border-top: 1px dashed rgba(40,40,42,0.18); }
.verse-preview-body .verse-ref { font-weight: 600; color: var(--ink-soft); margin: 0 0 6px; }

/* 옛 갤러리 — 더 이상 사용하지 않지만 historical CSS 잔재 자리표시. */
.qt-gallery_unused {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 6px;
  margin-bottom: 18px;
}
.qt-gallery-item {
  display: block;
  aspect-ratio: 1 / 1;
  overflow: hidden;
  border: 1px solid rgba(40, 40, 42, 0.15);
  background: var(--paper-tint);
}
.qt-gallery-item_unused img { width: 100%; height: 100%; object-fit: cover; display: block; }
.qt-gallery-item_unused:hover { border-bottom: 1px solid rgba(40, 40, 42, 0.15); }

/* QT 사용자 화면: 성경구절 블록 */
.qt-verses { margin: 0 0 18px; display: flex; flex-direction: column; gap: 12px; }
.qt-verse-group {
  padding: 12px 14px;
  background: rgba(248, 248, 246, 0.25);   /* 영역 구분만 — 크래프트 톤 비치게 약한 투명도 */
}
.qt-verse-group .verse-ref {
  margin: 0 0 8px;
  font-size: 17px;
  color: var(--ink-soft);
  font-weight: 700;
}
.qt-verse-group .verse-text { margin: 2px 0; font-size: 18px; line-height: 1.7; }

/* 내 나눔 목록 페이지 */
.my-comments-page .page-title { font-family: var(--hand-soft); font-size: 22px; margin: 0 0 16px; }
.my-comments-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 12px; }
.my-comment-card {
  position: relative;   /* my-comment-actions absolute 기준 */
  background: rgba(248, 248, 246, 0.25);   /* qt-verse-group 과 동일 — 크래프트 톤 비치게 */
  border: 1px solid rgba(40, 40, 42, 0.15);
  border-radius: 6px;
  transition: background 140ms ease;
}
.my-comment-actions {
  position: absolute;
  top: 8px;
  right: 10px;
  display: flex;
  gap: 10px;
  z-index: 2;
}
.my-comment-actions .link-btn {
  font-size: 13px;
  color: var(--ink-soft);
  padding: 2px 0;
  background: transparent;
}
.my-comment-actions .link-btn:hover { color: var(--ink); }
.my-comment-card:hover { background: rgba(248, 248, 246, 0.45); }
.my-comments-more {
  list-style: none;
  display: flex;
  justify-content: center;
  padding: 12px 0 4px;
}
.my-comments-more button {
  background: transparent;
  border: 1px solid rgba(40, 40, 42, 0.35);
  color: var(--ink);
  padding: 8px 22px;
  border-radius: 999px;
  font-family: var(--hand-soft);
  font-size: 15px;
  letter-spacing: 0.04em;
  cursor: pointer;
}
.my-comments-more button:hover { background: rgba(40, 40, 42, 0.08); }
.my-comment-link {
  display: block;
  padding: 14px 16px;
  color: inherit;
  text-decoration: none;
}
.my-comment-link:hover { text-decoration: none; border-bottom: 0; }
.my-comment-range {
  margin: 0 0 4px;
  font-family: var(--hand-soft);
  font-size: 16px;
  font-weight: 700;
  color: var(--ink);
}
.my-comment-meta {
  margin: 0 0 8px;
  font-size: 13px;
  color: var(--ink-soft);
}
.my-comment-content {
  margin: 0;
  font-size: 15px;
  line-height: 1.6;
  color: var(--ink);
  white-space: pre-wrap;
  word-break: keep-all;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.my-comment-title {
  margin: 8px 0 0;
  font-size: 15px;
  font-weight: 700;
  color: var(--ink);
}
.verse-num {
  display: inline-block;
  font-size: 13px;
  vertical-align: super;
  color: var(--accent-red);
  margin-right: 4px;
  font-weight: 700;
}

/* QT 사용자 화면: 본문 (textarea 입력 그대로 pre-wrap) */
.qt-body {
  white-space: pre-wrap;
  word-break: keep-all;
  font-size: 19px;
  line-height: 1.85;
  padding-top: 6px;
}

/* 목록 카드의 meta(나눔 카운트) — 성경구절(snippet) 옆 라인 우측 정렬, snippet 보다 살짝 큼 */
.card-meta {
  grid-area: meta;
  display: flex;
  gap: 12px;
  font-size: 17px;
  color: var(--ink-soft);
  justify-self: end;
  align-self: end;
  white-space: nowrap;
}

/* QT 에디터: 이미지 영역 */
.qt-images-field {
  border: 1px dashed rgba(40, 40, 42, 0.3);
  padding: 12px;
  border-radius: 4px;
}
.qt-image-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 10px;
  margin-bottom: 10px;
}
.qt-image-item {
  position: relative;
  aspect-ratio: 1 / 1;
  overflow: hidden;
  border: 1px solid rgba(40, 40, 42, 0.3);
  background: var(--paper-tint-2);
}
.qt-image-item img { width: 100%; height: 100%; object-fit: cover; display: block; }
.qt-image-actions {
  position: absolute; left: 0; right: 0; bottom: 0;
  display: flex; gap: 6px; justify-content: center;
  background: rgba(0, 0, 0, 0.45);
  padding: 4px 6px;
}
.qt-image-actions .link-btn { color: #fff; font-size: 14px; }
.qt-image-upload { display: flex; align-items: center; gap: 10px; }

/* 시각 선택 모달 — 0~23시 6x4 그리드 + 트리거 버튼 */
.time-input-wrap { display: inline-flex; align-items: center; gap: 6px; }
.time-picker-btn {
  display: inline-flex; align-items: center; gap: 8px;
  background: rgba(248, 248, 246, 0.55);
  border: 1px solid rgba(70, 70, 72, 0.4);
  border-radius: 4px;
  padding: 8px 14px;
  font-family: var(--hand);
  font-size: 18px;
  color: var(--ink);
  cursor: pointer;
  min-width: 130px;
}
.time-picker-btn:hover { background: rgba(40, 40, 42, 0.06); }
.time-picker-btn .time-icon { font-size: 18px; line-height: 1; }
.time-picker-btn .time-display { font-weight: 600; }

.time-modal { width: min(96vw, 420px); }
.time-modal h2 { text-align: center; }
.time-modal-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 6px;
}
.hour-cell {
  background: #fff;
  border: 1px solid rgba(40,40,42,0.15);
  border-radius: 4px;
  padding: 12px 0;
  font-family: var(--hand);
  font-size: 15px;
  color: var(--ink);
  cursor: pointer;
  line-height: 1;
}
.hour-cell:hover { background: rgba(40,40,42,0.06); border-color: rgba(40,40,42,0.4); }
.hour-cell--current { border-color: var(--accent-red); color: var(--accent-red); font-weight: 700; }

/* 날짜 선택 모달 — 월 그리드 + 점유 날짜 disabled */
.date-modal { width: min(96vw, 420px); max-height: 90vh; overflow-y: auto; }
.date-modal h2 { text-align: center; }
.date-modal-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 8px; margin: 4px 0 10px;
}
.date-modal-month {
  font-family: var(--hand-soft); font-size: 20px; font-weight: 700; color: var(--ink);
}
.date-modal-nav {
  background: transparent; border: 1px solid rgba(40,40,42,0.25);
  border-radius: 4px; padding: 4px 14px; font-size: 22px; line-height: 1;
  cursor: pointer; color: var(--ink);
}
.date-modal-nav:hover { background: rgba(40,40,42,0.06); }
.date-modal-weekdays {
  display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px;
  text-align: center; font-family: var(--hand-cute); color: var(--ink-soft); font-size: 14px;
  margin-bottom: 4px;
}
.date-modal-weekdays .dow-sun { color: var(--accent-red); }
.date-modal-weekdays .dow-sat { color: #1f5fab; }
.date-modal-grid {
  display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px;
}
.date-cell {
  background: #fff; border: 1px solid rgba(40,40,42,0.15);
  border-radius: 4px; padding: 10px 0; font-family: var(--hand);
  font-size: 16px; color: var(--ink); cursor: pointer; line-height: 1;
}
.date-cell--blank { background: transparent; border-color: transparent; cursor: default; }
.date-cell:hover:not([disabled]) { background: rgba(40,40,42,0.06); border-color: rgba(40,40,42,0.4); }
.date-cell--occupied {
  background: rgba(40,40,42,0.08); color: rgba(40,40,42,0.35);
  cursor: not-allowed; text-decoration: line-through;
}
.date-cell--current {
  border-color: var(--accent-red); color: var(--accent-red); font-weight: 700;
}
.date-modal-hint { margin: 10px 0 0; text-align: center; }

/* 날짜 input — 우측 안쪽 명시적 달력 버튼 (브라우저 native indicator 가 잘 안 떠서 시인성 보강) */
.date-input-wrap {
  position: relative;
  display: block;
  width: 100%;
}
.field .date-input-wrap input[type="date"] {
  padding-right: 44px;
  width: 100%;
}
.date-input-wrap input[type="date"]::-webkit-calendar-picker-indicator {
  opacity: 0;
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  cursor: pointer;
}
.date-picker-btn {
  position: absolute;
  right: 4px;
  top: 50%;
  transform: translateY(-50%);
  background: transparent;
  border: 0;
  cursor: pointer;
  font-size: 22px;
  padding: 4px 8px;
  line-height: 1;
  color: var(--ink-soft);
  z-index: 1;
}
.date-picker-btn:hover { color: var(--accent-red); }

/* QT 에디터: 본문 textarea (묵상 메모, 짧고 가벼움) */
#qtContent {
  min-height: 160px;
  font-family: var(--hand);
  font-size: 19px;
  line-height: 1.7;
  resize: vertical;
}

/* QT 에디터: 성경구절 영역 — fieldset 변두리만 유지. 나머지 list/item/toolbar 룰은
   상단 `.qt-verses-field .qt-verse-*` (높은 specificity) 가 책임. 옛 chip-style
   `.qt-verse-list { flex-wrap:wrap }` · `.qt-verse-item { display:inline-flex; border-radius:999 }`
   · `.qt-verse-add/.qt-verse-add-row` 룰은 새 인터페이스에서 unused — 제거해 cascade 충돌 차단. */
.qt-verses-field {
  border: 1px dashed rgba(40, 40, 42, 0.3);
  border-radius: 4px;
}
summary.secondary.as-link { display: inline-block; }

/* 댓글 */
.comments-section {
  padding: 28px 8px 32px;
  margin-top: 18px;
  border-top: 1px solid rgba(70, 70, 72, 0.35);
}
.comments-title {
  font-family: var(--hand-soft);
  font-size: 24px;
  margin: 0 0 16px;
  font-weight: 700;
}
.comment-form {
  display: flex; flex-direction: column; gap: 14px;
  padding: 16px;
  background: var(--paper-tint);
  border: 1px solid rgba(40, 40, 42, 0.2);
  border-radius: 4px;
  margin-bottom: 20px;
}
.comment-form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.comment-form .field { gap: 4px; }
.comment-form .actions { justify-content: flex-end; }
.comment-form textarea {
  font-family: var(--hand);
  font-size: 17px;
  line-height: 1.6;
  resize: vertical;
  min-height: 80px;
}
.comment-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; }
.comment { padding: 14px 0; border-top: 1px solid rgba(40, 40, 42, 0.15); }
.comment:first-child { border-top: 0; }
.comment-head { display: flex; align-items: center; gap: 10px; margin-bottom: 6px; }
.comment-avatar {
  width: 28px; height: 28px;
  border-radius: 50%;
  object-fit: cover;
  background: var(--paper-tint);
  flex: 0 0 auto;
}
.comment-name { font-family: var(--hand-soft); font-weight: 700; font-size: 17px; color: var(--ink); }
.comment-date { font-size: 14px; }
.comment-title { font-family: var(--hand-soft); font-size: 19px; margin: 4px 0; font-weight: 700; }
.comment-content { margin: 4px 0 8px; white-space: pre-wrap; word-break: keep-all; font-size: 17px; line-height: 1.6; }
.comment-actions { display: flex; gap: 10px; font-size: 14px; }
.comment-actions .link-btn { color: var(--ink-soft); }
.comment-actions .link-btn:hover { color: var(--accent-red); }

/* 댓글 수정/삭제 모달 */
.qt-modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(0, 0, 0, 0.4);
  z-index: 100;
  display: flex; align-items: center; justify-content: center;
}
.qt-modal {
  background: var(--kraft-light);
  border: 1px solid var(--rule);
  border-radius: 6px;
  padding: 22px;
  width: min(90vw, 420px);
  box-shadow: var(--shadow);
}
.qt-modal h2 { margin: 0 0 14px; font-family: var(--hand-soft); font-size: 22px; }
.qt-modal .field { margin-bottom: 10px; }
.qt-modal .actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 16px; }
.qt-modal .error { margin: 6px 0 0; }

/* ==========================================================
 * QT 추가 — 가이드 모달 / FAB 5칸 / 모달 close 버튼 / 날짜 표시
 * ========================================================== */

/* FAB submenu — 항목 개수에 무관하게 트리거에서 가까운 순으로 배치
   (nth-last-child(1) = 가장 가까움) */
.fab.is-open .fab-submenu li:nth-last-child(1) .fab-btn { transform: translate(0, 0); }
.fab.is-open .fab-submenu li:nth-last-child(2) .fab-btn { transform: translate(0, -60px); }
.fab.is-open .fab-submenu li:nth-last-child(3) .fab-btn { transform: translate(0, -120px); }
.fab.is-open .fab-submenu li:nth-last-child(4) .fab-btn { transform: translate(0, -180px); }
.fab.is-open .fab-submenu li:nth-last-child(5) .fab-btn { transform: translate(0, -240px); }

/* accent 버튼 — ?, 💬 */
.fab-btn--accent {
  background: var(--accent-red);
  color: #fff;
  border-color: var(--accent-red);
}
.fab-btn--accent:hover { background: #962e29; }
.fab-btn--accent svg { stroke: #fff; }

/* 가이드 모달 - 넓게 표시 */
.qt-modal--wide { width: min(92vw, 640px); max-height: 85vh; overflow-y: auto; }

.qt-modal-close {
  position: absolute;
  top: 8px;
  right: 12px;
  background: transparent;
  border: 0;
  font-size: 28px;
  line-height: 1;
  color: var(--ink-soft);
  cursor: pointer;
  padding: 4px 8px;
}
.qt-modal-close:hover { color: var(--accent-red); }
.qt-modal { position: relative; }

/* 가이드 본문 타이포 */
.qt-guide { font-size: 16px; line-height: 1.75; }
.qt-guide h3 { margin: 4px 0 14px; font-size: 18px; font-weight: 700; }
.qt-guide-list { padding-left: 22px; margin: 0; display: flex; flex-direction: column; gap: 10px; }
.qt-guide-list > li { padding-left: 2px; }
.qt-guide-list > li strong { color: var(--ink); }
.qt-guide-inner { padding-left: 18px; margin: 6px 0 0; font-size: 15px; color: var(--ink-soft); }
.qt-guide-inner li { margin: 2px 0; }
.qt-guide-sub { margin: 4px 0 0; font-size: 15px; color: var(--ink-soft); }
.qt-guide-note { margin: 4px 0 0; font-size: 14px; color: var(--ink-soft); font-style: italic; }
.qt-guide em { color: var(--accent-red); font-style: normal; font-weight: 500; }

/* 관리자 에디터 날짜 표시 (input 아닌 그냥 텍스트) */
.qt-edit-date {
  margin: 0 0 4px;
  font-size: 16px;
  color: var(--ink-soft);
}

/* ==========================================================
 * 카카오 로그인 / 프로필
 * ========================================================== */

.kakao-btn {
  background: var(--ink);
  color: var(--kraft-light);
  border: 0;
  border-radius: 8px;
  padding: 12px 22px;
  font-size: 17px;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  box-shadow: var(--shadow);
  font-family: var(--hand-soft);
  letter-spacing: 0.04em;
}
.kakao-btn:hover { background: var(--ink-soft); }
.kakao-btn span { font-size: 18px; }

.comment-form-author {
  margin: 0 0 10px;
  padding-bottom: 8px;
  border-bottom: 1px dashed rgba(40, 40, 42, 0.2);
}
.comment-form-author strong { color: var(--ink); font-weight: 700; }
.comment-form-author a,
.comment-form-author .link-btn { color: var(--ink-soft); font-size: 14px; }
.comment-form-author a:hover { color: var(--accent-red); }

.profile-card { padding-bottom: 40px; }
.profile-row { display: flex; align-items: center; gap: 16px; padding: 10px 0; }
.profile-avatar { width: 64px; height: 64px; border-radius: 50%; object-fit: cover; border: 1px solid rgba(40, 40, 42, 0.2); }
.profile-info { flex: 1; }
.profile-status { margin: 4px 0 0; min-height: 1.4em; }

/* hidden 속성이 .qt-modal-backdrop 의 display:flex 에 막히지 않도록 (★ 버그 픽스) */
.qt-modal-backdrop[hidden] { display: none; }

/* 가이드 모달 푸터 액션 */
.qt-modal .actions { display: flex; gap: 10px; align-items: center; margin-top: 18px; }

/* hidden 속성이 어떤 display 도 이기도록 (전역 픽스) */
[hidden] { display: none !important; }

/* ==========================================================
 * FAB — ? 와 💬 항상 노출 + 서브메뉴 오프셋
 * ========================================================== */

/* always-visible 버튼 (햄버거 위) */
.fab-always {
  position: absolute;
  right: 0;
  z-index: 1;
}
/* ? 만 있을 때 */
.fab--has-guide .fab-always--guide { bottom: 60px; }
/* ? 와 💬 둘 다 있을 때: 💬 가 60px (가까움), ? 는 120px (위) */
.fab--has-guide.fab--has-comment .fab-always--guide { bottom: 120px; }
.fab--has-comment .fab-always--comment { bottom: 60px; }

/* 서브메뉴: always-buttons 만큼 위로 밀어줌 */
.fab { --always-offset: 0px; }
.fab--has-guide { --always-offset: 60px; }
.fab--has-guide.fab--has-comment { --always-offset: 120px; }

.fab.is-open .fab-submenu li:nth-last-child(1) .fab-btn { transform: translate(0, calc(-1 * var(--always-offset))) !important; }
.fab.is-open .fab-submenu li:nth-last-child(2) .fab-btn { transform: translate(0, calc(-60px - var(--always-offset))) !important; }
.fab.is-open .fab-submenu li:nth-last-child(3) .fab-btn { transform: translate(0, calc(-120px - var(--always-offset))) !important; }
/* 4~6번째도 --always-offset 적용 (안 하면 오프셋 없는 -180/-240 규칙과 좌표 충돌해 숨겨짐). */
.fab.is-open .fab-submenu li:nth-last-child(4) .fab-btn { transform: translate(0, calc(-180px - var(--always-offset))) !important; }
.fab.is-open .fab-submenu li:nth-last-child(5) .fab-btn { transform: translate(0, calc(-240px - var(--always-offset))) !important; }
.fab.is-open .fab-submenu li:nth-last-child(6) .fab-btn { transform: translate(0, calc(-300px - var(--always-offset))) !important; }

/* 서브메뉴 2칸(우리QT + 캘린더) — 3번째 룰은 사실상 미사용이 됨 */

/* ==========================================================
 * 사용자 우측 상단 — 로그인 / 프로필 칩
 * ========================================================== */

.topbar--user {
  align-items: center;
}
.topbar--user .nav { gap: 8px; }

.login-btn {
  background: var(--ink);
  color: var(--kraft-light);
  border: 0;
  border-radius: 999px;
  padding: 6px 14px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 1px 3px rgba(40, 40, 42, 0.18);
}
.login-btn:hover { background: var(--ink-soft); }

/* 비로그인 상태에선 FAB 의 [내 나눔] 숨김. body.is-guest 는 layout/main.jte 에서 me==null 일 때 부착. */
.is-guest .fab-my-comments-li { display: none; }

.user-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--paper-tint-2);
  border: 1px solid rgba(40, 40, 42, 0.25);
  border-radius: 999px;
  padding: 4px 12px 4px 4px;
  font-size: 14px;
  cursor: pointer;
  color: var(--ink);
}
.user-chip:hover { background: var(--paper-tint-3); }
.user-chip .user-avatar {
  width: 26px; height: 26px;
  border-radius: 50%;
  object-fit: cover;
  background: var(--paper-tint);
}
.user-chip .user-name { font-weight: 700; }

/* ==========================================================
 * 리액션 바 — 카운트 pill + 작은 + 버튼 (picker 펼침)
 * ========================================================== */
.reaction-bar {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  flex-wrap: wrap;
  margin: 14px 0 4px;
  padding-top: 12px;
  position: relative;
}
.comment .reaction-bar { margin: 8px 0 0; padding-top: 6px; }
/* 나눔 카드 하단 줄: [수정 복사 삭제] 좌측, 공감(🙂+) 우측 한 줄 */
.comment-foot { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; margin-top: 8px; }
.comment-foot .comment-actions { margin: 0; }
.comment-foot .reaction-bar { margin: 0 0 0 auto; padding-top: 0; }
.reaction-counts {
  display: inline-flex;
  gap: 6px;
  flex-wrap: wrap;
}
.reaction-counts:empty { display: none; }

/* 누가 누른 type 카운트 pill — 클릭하면 그 type 으로 토글 */
.reaction-pill,
.reaction-add,
.reaction-pick {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 12px;
  background: var(--paper-tint);
  border: 1px solid rgba(40, 40, 42, 0.2);
  border-radius: 999px;
  font-size: 16px;
  color: var(--ink-soft);
  cursor: pointer;
  font-family: inherit;
  line-height: 1.2;
  transition: background 120ms ease, border-color 120ms ease, transform 120ms ease;
}
/* 댓글 안 reaction-bar 는 기존 작은 사이즈 유지 — "본문" 만 키우는 결정 */
.comment .reaction-pill,
.comment .reaction-add,
.comment .reaction-pick {
  padding: 3px 9px;
  font-size: 14px;
  gap: 4px;
}
.reaction-pill:hover,
.reaction-add:hover,
.reaction-pick:hover {
  background: var(--paper-tint-2);
  border-color: rgba(40, 40, 42, 0.45);
  border-bottom: 1px solid rgba(40, 40, 42, 0.45);
}
.reaction-pill:active,
.reaction-add:active,
.reaction-pick:active { transform: scale(0.94); }
.reaction-pill[disabled],
.reaction-pick[disabled] { opacity: 0.5; cursor: wait; }
.reaction-pill.is-mine,
.reaction-pick.is-mine {
  background: rgba(177, 59, 52, 0.12);
  border-color: var(--accent-red);
  color: var(--ink);
}

.reaction-add {
  padding: 3px 8px;
  color: var(--ink-soft);
  opacity: 0.85;
}
.reaction-add:hover { opacity: 1; }

.reaction-picker {
  display: inline-flex;
  gap: 4px;
  padding: 4px 6px;
  background: var(--paper-tint-2);
  border: 1px solid rgba(40, 40, 42, 0.25);
  border-radius: 999px;
  animation: reaction-picker-in 140ms ease-out;
}
.reaction-picker[hidden] { display: none; }
.reaction-picker .reaction-pick {
  padding: 6px 12px;
  background: transparent;
  border: 0;
  font-size: 22px;
  line-height: 1;
}
.comment .reaction-picker .reaction-pick {
  padding: 4px 8px;
  font-size: 18px;
}
.reaction-picker .reaction-pick:hover { background: rgba(70, 70, 72, 0.06); border-bottom: 0; transform: scale(1.15); }
.reaction-picker .reaction-pick.is-mine { background: rgba(177, 59, 52, 0.16); border: 0; }

@keyframes reaction-picker-in {
  from { opacity: 0; transform: translateX(-4px); }
  to   { opacity: 1; transform: translateX(0); }
}

.reaction-emoji { font-size: 15px; line-height: 1; }
.reaction-count { font-variant-numeric: tabular-nums; min-width: 1ch; }

/* ── 패밀리 & 나눔 공개범위 ───────────────────────────────────────────── */

/* 나눔 작성 폼의 공개범위 선택 (전체보이기 / 패밀리에게만 / 나만 보기) */
.comment-visibility {
  display: flex;
  gap: 6px;
  margin: 4px 0 12px;
}
.vis-option { flex: 1 1 0; min-width: 0; cursor: pointer; }
.vis-option input { position: absolute; opacity: 0; pointer-events: none; }
.vis-chip {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 9px 6px;
  border: 1px solid var(--rule);
  border-radius: 8px;
  background: var(--paper-tint);
  color: var(--ink-soft);
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
  transition: all 120ms ease;
}
.vis-option input:checked + .vis-chip {
  border-color: var(--accent-red);
  color: var(--accent-red);
  background: rgba(177, 59, 52, 0.08);
}
.vis-option input:focus-visible + .vis-chip { outline: 2px solid var(--accent-red); outline-offset: 2px; }

/* 나눔 카드의 "나만" 배지 */
.vis-badge {
  font-size: 12px;
  font-weight: 700;
  padding: 1px 7px;
  border-radius: 10px;
  white-space: nowrap;
}
.vis-badge--private { background: rgba(177, 59, 52, 0.12); color: var(--accent-red); }
.vis-badge--public { background: rgba(47, 109, 79, 0.12); color: #2f6d4f; }
.vis-badge--family { background: rgba(70, 70, 72, 0.10); color: var(--ink-soft); }

/* 프로필 모달의 패밀리 관리 링크 */
.profile-family-link {
  display: inline-block;
  margin-top: 6px;
  font-size: 15px;
  font-weight: 600;
  color: var(--accent-red);
}

/* 패밀리 페이지 공통 */
.family-page { max-width: 640px; margin: 0 auto; padding: 22px 22px 28px; }
.family-back { margin: 0 0 10px; }
.family-back a { color: var(--ink-soft); font-size: 15px; }
.family-page-head { margin-bottom: 18px; }
.family-page-title { margin: 0 0 4px; font-size: 24px; color: var(--ink); }
.family-section-title { margin: 26px 0 10px; font-size: 18px; color: var(--ink); border-bottom: 1px solid var(--rule); padding-bottom: 6px; }
.family-subsection-title { margin: 20px 0 8px; font-size: 16px; color: var(--ink-soft); }

.family-create-form { display: flex; gap: 8px; align-items: stretch; margin-bottom: 20px; }
.family-create-form .field { flex: 1 1 auto; margin: 0; }
.family-create-form .primary { flex: 0 0 auto; white-space: nowrap; }
.invite-create-form { display: flex; gap: 8px; align-items: stretch; margin: 12px 0 6px; }
.invite-create-form .field { flex: 1 1 auto; margin: 0; }
.invite-create-form .primary { flex: 0 0 auto; white-space: nowrap; }

/* 패밀리 목록 카드 */
.family-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 12px; }
.family-card {
  border: 1px solid var(--rule);
  border-radius: 10px;
  background: var(--paper-tint);
}
.family-card-link { display: block; padding: 14px 16px; }
.family-card-top { display: flex; align-items: center; gap: 8px; }
.family-card-name { font-size: 18px; font-weight: 700; color: var(--ink); }
.family-card-meta { display: block; margin-top: 4px; }
.family-badge {
  font-size: 12px;
  font-weight: 700;
  padding: 1px 8px;
  border-radius: 10px;
  background: rgba(177, 59, 52, 0.12);
  color: var(--accent-red);
}

/* 구성원 목록 */
.member-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.member-row { display: flex; align-items: center; gap: 10px; padding: 8px 2px; border-bottom: 1px solid rgba(124, 124, 126, 0.25); }
.member-avatar { width: 30px; height: 30px; border-radius: 50%; object-fit: cover; }
.member-name { font-size: 16px; color: var(--ink); }
.member-remove { margin-left: auto; display: none; }
.link-btn--danger { color: var(--accent-red); }
/* 내보내기·패밀리 삭제는 수정 모드(.is-editing)에서만 노출 */
.family-page.is-editing .member-remove { display: block; }

/* 패밀리 이름 편집(패밀리장) — 수정 모드에서만 노출, 모드 진입 시 제목 대신 입력폼 */
.family-name-edit { display: none; gap: 8px; align-items: center; margin: 2px 0 6px; flex-wrap: wrap; }
.family-page.is-editing .family-name-edit { display: flex; }
.family-page.is-editing .family-page-title { display: none; }
.family-name-edit input {
  font-family: var(--hand-soft);
  font-size: 20px;
  padding: 6px 10px;
  border: 1px solid var(--rule, #7c7c7e);
  border-radius: 6px;
  background: var(--paper-tint, rgba(248, 248, 246, 0.6));
  color: var(--ink);
  max-width: 240px;
}

/* 초대 */
.invite-fresh {
  border: 1px dashed var(--accent-red);
  border-radius: 10px;
  padding: 14px;
  margin: 8px 0 18px;
  background: rgba(177, 59, 52, 0.05);
}
.invite-link-box { margin: 8px 0; }
.invite-link-input {
  width: 100%;
  padding: 9px 10px;
  border: 1px solid var(--rule);
  border-radius: 8px;
  background: #fff;
  font-size: 14px;
  color: var(--ink-soft);
  box-sizing: border-box;
}
.invite-list { list-style: none; margin: 8px 0 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.invite-row {
  border: 1px solid var(--rule);
  border-radius: 10px;
  padding: 10px 12px;
  background: var(--paper-tint);
}
.invite-row-info { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.invite-label { font-size: 15px; font-weight: 600; color: var(--ink); }
.invite-badge {
  font-size: 12px; font-weight: 700; padding: 1px 8px; border-radius: 10px;
  background: rgba(124, 124, 126, 0.18); color: var(--ink-soft);
}
.invite-row-actions { display: flex; align-items: center; gap: 8px; margin-top: 8px; flex-wrap: wrap; }
.invite-row-actions form { margin: 0; display: inline-flex; }

.family-danger { margin-top: 30px; padding-top: 16px; border-top: 1px solid rgba(124, 124, 126, 0.3); display: none; }
.family-page.is-editing .family-danger { display: block; }
.family-leave { margin-top: 30px; padding-top: 16px; border-top: 1px solid rgba(124, 124, 126, 0.3); }

/* 패밀리 상단 툴바 (추가/초대/수정 버튼 우측, 목록 상세 공통) */
.family-toolbar { display: flex; justify-content: flex-end; margin-bottom: 16px; }
.family-detail-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 8px; row-gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.family-detail-actions { display: flex; align-items: center; gap: 8px; flex: 0 0 auto; }
.family-detail-actions form { margin: 0; display: inline-flex; }
.btn-pill {
  display: inline-flex;
  align-items: center;
  padding: 8px 16px;
  border: 1px solid var(--accent-red);
  border-radius: 999px;
  background: var(--accent-red);
  color: #fff;
  font-size: 14px;
  font-weight: 700;
  white-space: nowrap;
  cursor: pointer;
}
.btn-pill--ghost { background: transparent; color: var(--accent-red); }
.btn-pill--danger { background: var(--accent-red); color: #fff; border-color: var(--accent-red); }
.btn-pill--sm { padding: 5px 12px; font-size: 13px; }
.family-back-btn { text-decoration: none; }

/* 수정 모드: [초대] 숨기고 그 자리에 [패밀리 삭제] 노출.
   .family-detail-actions form 의 display 규칙(0,1,1)을 이기도록 셀렉터 구체화. */
.family-detail-actions .family-delete-top { display: none; }
.family-page.is-editing .family-detail-actions .family-delete-top { display: inline-flex; }
.family-page.is-editing .family-invite-btn { display: none; }

/* 패밀리명 옆 작은 "패밀리" 라벨 */
.family-name-suffix {
  font-size: 14px;
  font-weight: 600;
  color: var(--ink-soft);
  background: rgba(124, 124, 126, 0.15);
  padding: 2px 8px;
  border-radius: 8px;
  vertical-align: middle;
  margin-left: 4px;
}

/* 만료된 초대 링크 */
.invite-row.is-expired { opacity: 0.6; }
.invite-badge--expired { background: rgba(124, 124, 126, 0.18); color: var(--ink-soft); }

/* 초대 랜딩 화면 */
.invite-page { max-width: 480px; margin: 40px auto; padding: 40px 24px; text-align: center; }
.invite-title { margin: 0 0 16px; font-size: 26px; color: var(--ink); }
.invite-page .invite-desc { font-size: 27px; color: var(--ink); line-height: 1.55; margin: 0 0 14px; }
.invite-page .invite-sub { font-size: 21px; line-height: 1.5; margin: 0; }
.invite-actions { display: flex; gap: 12px; justify-content: center; margin-top: 26px; }
.invite-actions--single { margin-top: 18px; }
.invite-actions--single .primary { min-width: 200px; }
.invite-actions form { flex: 1 1 0; max-width: 140px; }
.invite-actions .primary, .invite-actions .secondary { width: 100%; }

@media (max-width: 520px) {
  .family-create-form, .invite-create-form { flex-direction: column; }
  .family-create-form .primary, .invite-create-form .primary { width: 100%; }
}

/* ════════════════════════════════════════════════════════════════════
   테마 — FAB '배경 테마' 에서 선택, localStorage('hwoori:bgTheme').
   라이트/다크(배경+글자색) · 편지지 2종(서신/큐티 종이) · 내 색상(배경+폰트).
   각 테마가 --theme-bg / --theme-bg-image / --ink 설정 → body::before·미리보기 공용. */
html[data-theme="light"] { --theme-bg: #ffffff; --theme-bg-image: none; --ink: #1a1a1a; background-color: #ffffff; }
html[data-theme="dark"]  {
  --theme-bg: #1c1c1e; --theme-bg-image: none; background-color: #1c1c1e;
  --ink: #f2f2f2; --ink-soft: #bcbcc0; --rule: #5a5a5e;
  --paper-tint: rgba(255,255,255,0.06); --paper-tint-2: rgba(255,255,255,0.10); --paper-tint-3: rgba(255,255,255,0.14);
  --accent-red: #e0685f;   /* 다크 배경에서 더 밝은 붉은색 (절번호·accent 버튼 가독) */
}
html[data-theme="letter-image"] { --theme-bg: #e5e6e3; --theme-bg-image: url('/images/paper-bg.jpg'); background-color: #e5e6e3; }
html[data-theme="qt-image"]     { --theme-bg: #d9c0a0; --theme-bg-image: url('/images/paper-bg.jpg'); background-color: #d9c0a0; }
html[data-theme="custom"] {
  --theme-bg: var(--custom-bg, #e5e6e3); --theme-bg-image: none; background-color: var(--custom-bg, #e5e6e3);
  --ink: var(--custom-ink, #28282a);
}

/* 테마 선택 모달 */
.theme-modal { position: fixed; inset: 0; z-index: 1000; display: flex; align-items: center; justify-content: center; background: rgba(0,0,0,0.42); }
.theme-modal[hidden] { display: none; }
.theme-modal-card { background: #f4f2ee; border: 1px solid rgba(40,40,42,0.15); border-radius: 14px; padding: 20px; width: min(92vw, 360px); max-height: 88vh; overflow-y: auto; box-shadow: 0 12px 44px rgba(0,0,0,0.28); }
html[data-theme="dark"] .theme-modal-card { background: #2a2a2e; border-color: rgba(255,255,255,0.16); }
.theme-modal-title { font-family: var(--hand-soft); font-size: 20px; font-weight: 700; color: var(--ink); margin: 0 0 14px; }
.theme-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 12px; }
.theme-opt { display: flex; flex-direction: column; align-items: stretch; gap: 8px; cursor: pointer; border: 2px solid transparent; border-radius: 10px; padding: 8px; background: none; }
.theme-opt.is-active { border-color: var(--accent-red, #b13b34); }
.theme-swatch { height: 52px; border-radius: 8px; border: 1px solid rgba(0,0,0,0.18); background-repeat: repeat; background-size: 600px auto; background-blend-mode: luminosity; }
.theme-swatch--light { background-color: #ffffff; }
.theme-swatch--dark  { background-color: #1c1c1e; }
.theme-swatch--letter-image { background-color: #e5e6e3; background-image: url('/images/paper-bg.jpg'); }
.theme-swatch--qt-image     { background-color: #d9c0a0; background-image: url('/images/paper-bg.jpg'); }
.theme-opt-label { font-size: 14px; font-weight: 600; color: var(--ink); text-align: center; }
/* 내 색상: 배경색 / 폰트색 */
.theme-custom-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 4px; }
.theme-custom-field { display: flex; flex-direction: column; align-items: stretch; gap: 8px; cursor: pointer; border: 2px solid transparent; border-radius: 10px; padding: 8px; position: relative; }
.theme-custom-field.is-active { border-color: var(--accent-red, #b13b34); }
.theme-swatch--custombg  { background-color: var(--custom-bg, #e5e6e3); }
.theme-swatch--customink { background-color: var(--custom-ink, #28282a); }
.theme-color-input { position: absolute; width: 1px; height: 1px; opacity: 0; }
/* 미리보기 */
.theme-preview { margin-top: 12px; padding: 20px 12px; border-radius: 8px; border: 1px solid var(--rule, #7c7c7e); background-color: var(--theme-bg, #e5e6e3); background-image: var(--theme-bg-image, none); background-size: 600px auto; background-repeat: repeat; background-blend-mode: luminosity; color: var(--ink); text-align: center; font-size: 18px; font-weight: 600; }
.theme-modal-close { margin-top: 12px; width: 100%; padding: 10px; border-radius: 8px; border: 1px solid var(--rule, #7c7c7e); background: none; color: var(--ink); font-weight: 600; cursor: pointer; }

/* ── 다크 모드 — 밝은 배경 전제 chrome 보정 (FAB 흰버튼·모달·불투명 흰 인풋/버튼) ── */
html[data-theme="dark"] .fab-btn:not(.fab-btn--accent) { background: rgba(48,48,52,0.96); border-color: rgba(255,255,255,0.22); }
html[data-theme="dark"] .fab-btn:not(.fab-btn--accent):hover { background: rgba(66,66,70,1); }
html[data-theme="dark"] .qt-modal { background: #26262a; border-color: rgba(255,255,255,0.18); }
html[data-theme="dark"] .qt-verse-btn,
html[data-theme="dark"] .qt-verse-btn--preview,
html[data-theme="dark"] .invite-link-input,
html[data-theme="dark"] .field input,
html[data-theme="dark"] .field select,
html[data-theme="dark"] .field textarea,
html[data-theme="dark"] .comment-form textarea,
html[data-theme="dark"] .comment-form input[type="text"] { background: #2a2a2e; color: var(--ink); border-color: rgba(255,255,255,0.22); }
html[data-theme="dark"] input::placeholder,
html[data-theme="dark"] textarea::placeholder { color: rgba(255,255,255,0.42); }
/* 로고: 다크모드 흰색 글자 + glyph 라이트레드 (SVG presentation attr 오버라이드) */
html[data-theme="dark"] .brand-mark text { fill: #f2f2f2; }
html[data-theme="dark"] .brand-mark circle,
html[data-theme="dark"] .brand-mark path { stroke: var(--accent-red); }
/* '현재' 번역 prefix 가독 */
html[data-theme="dark"] .qt-verse-current-prefix { color: rgba(255,255,255,0.55); }
/* --ink 배경 + --kraft-light 글씨 버튼(번역변경·로그인·카카오로그인): 다크에선 배경이 밝아 글씨를 어둡게 */
html[data-theme="dark"] .primary,
html[data-theme="dark"] .primary:hover,
html[data-theme="dark"] .kakao-btn,
html[data-theme="dark"] .kakao-btn:hover,
html[data-theme="dark"] .login-btn,
html[data-theme="dark"] .login-btn:hover { color: #1a1a1a; }
