/* 하늘다리앱 시연판 — 고령 성도 배려: 큰 글씨, 큰 버튼, 높은 대비 */
:root {
  --primary: #2f5d8a;
  --primary-dark: #214466;
  --accent: #e8a33d;
  --bg: #ececec;
  --card: #ffffff;
  --text: #1f2328;
  --muted: #6b6f76;
  --line: #e2ddd2;
  --danger: #b3403a;
  --ok: #2e7d4f;
  --radius: 16px;
  --soft-warm: #fff6e8; --warm-line: #f0d3a2; --soft-blue: #eef3f8; --soft-green: #f6f9f4;
  --notice-row: #fffaf1; --cat-bg: #e8eef5; --mine-bubble: #fbe7a1; --toast: #222; --scripture-text: #214466;
}
* { box-sizing: border-box; }
html { font-size: 17px; }
html.fs-s { font-size: 15.5px; }
html.fs-l { font-size: 19px; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font-family: "SUITE", -apple-system, "Apple SD Gothic Neo", "Noto Sans KR", "Malgun Gothic", sans-serif;
  font-weight: 300;
  line-height: 1.6; -webkit-text-size-adjust: 100%;
}
#topbar {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; gap: 8px;
  padding: calc(10px + env(safe-area-inset-top)) 12px 10px;
  background: var(--primary); color: #fff;
}
#topbar h1 { flex: 1; margin: 0; font-size: 1.25rem; font-weight: 700;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.icon-btn { background: none; border: 0; color: #fff; font-size: 1.8rem;
  width: 48px; height: 48px; line-height: 1; cursor: pointer; border-radius: 12px; }
.icon-btn:active { background: rgba(255,255,255,.15); }

#app { max-width: 680px; margin: 0 auto; padding: 16px 16px 120px; }

.menu { position: fixed; top: 68px; right: 12px; z-index: 20; background: var(--card);
  border-radius: var(--radius); box-shadow: 0 8px 30px rgba(0,0,0,.2);
  padding: 8px; min-width: 240px; }
.menu button { display: block; width: 100%; text-align: left; background: none; border: 0;
  font-size: 1.05rem; padding: 14px 16px; border-radius: 10px; cursor: pointer; color: var(--text); }
.menu button:active { background: var(--bg); }
.menu-user { padding: 10px 16px; color: var(--muted); font-size: .95rem;
  border-bottom: 1px solid var(--line); margin-bottom: 4px; }

h2 { font-size: 1.3rem; margin: 8px 0 12px; }
h3 { font-size: 1.1rem; margin: 20px 0 10px; }
p { margin: 0 0 10px; }
.muted { color: var(--muted); }
.center { text-align: center; padding: 40px 0; }
.small { font-size: .85rem; }

.card { background: var(--card); border-radius: var(--radius); padding: 18px;
  margin-bottom: 14px; box-shadow: 0 1px 3px rgba(0,0,0,.06); }

label { display: block; font-weight: 600; margin: 14px 0 6px; }
input, select, textarea {
  width: 100%; font-size: 1.1rem; padding: 14px; border: 2px solid var(--line);
  border-radius: 12px; background: var(--card); color: var(--text); font-family: inherit;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--primary); }
textarea { min-height: 180px; resize: vertical; }

.btn { display: block; width: 100%; font-size: 1.15rem; font-weight: 700; padding: 16px;
  border: 0; border-radius: 14px; background: var(--primary); color: #fff; cursor: pointer;
  margin-top: 16px; text-align: center; text-decoration: none; }
.btn:active { background: var(--primary-dark); }
.btn:disabled { opacity: .5; }
.btn.secondary { background: var(--card); color: var(--primary); border: 2px solid var(--primary); }
.btn.danger { background: var(--danger); }
.btn.ok { background: var(--ok); }
.btn.inline { display: inline-block; width: auto; padding: 10px 18px; font-size: 1rem; margin: 0; }
.row { display: flex; gap: 10px; align-items: center; }
.row > * { flex: 1; }

.hero { text-align: center; padding: 30px 0 10px; }
.hero .logo { font-size: 4rem; }
.hero h2 { font-size: 1.6rem; margin: 6px 0; }

/* 방 카드 */
.room { display: flex; align-items: center; gap: 14px; cursor: pointer; }
.room .ic { font-size: 2.2rem; width: 56px; height: 56px; display: grid; place-items: center;
  background: var(--bg); border-radius: 14px; flex: none; }
.room .nm { font-size: 1.2rem; font-weight: 700; }
.room .ds { color: var(--muted); font-size: .9rem; }
.room .grow { flex: 1; min-width: 0; }
.badge { background: var(--accent); color: #fff; font-size: .8rem; font-weight: 700;
  padding: 3px 10px; border-radius: 999px; }

/* 게시글 */
.post { cursor: pointer; }
.post .meta { color: var(--muted); font-size: .9rem; margin-bottom: 6px; }
.post .ttl { font-size: 1.15rem; font-weight: 700; margin-bottom: 4px; }
.post .body { white-space: pre-wrap; word-break: break-word; }
.post .preview { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.post img.thumb { width: 100%; max-height: 240px; object-fit: cover; border-radius: 12px; margin-top: 10px; }
.post img.full { width: 100%; border-radius: 12px; margin-top: 12px; }
.counts { color: var(--muted); font-size: .9rem; margin-top: 8px; }

.reactions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 14px; }
.react { flex: 1 1 0; min-width: 0; font-size: .9rem; padding: 10px 4px; border-radius: 12px;
  border: 2px solid var(--line); background: var(--card); cursor: pointer; color: var(--text);
  display: flex; flex-direction: column; align-items: center; gap: 2px; white-space: nowrap; }
.react .e { font-size: 1.6rem; line-height: 1.2; }
.react.on { border-color: var(--accent); background: var(--soft-warm); font-weight: 700; }

.comment { border-top: 1px solid var(--line); padding: 12px 0; }
.comment .who { font-weight: 700; font-size: .95rem; }
.comment .when { color: var(--muted); font-size: .8rem; margin-left: 6px; }
.comment .txt { white-space: pre-wrap; word-break: break-word; }
.linkbtn { background: none; border: 0; color: var(--danger); font-size: .85rem; cursor: pointer; padding: 4px 0; }

.fab { position: fixed; right: 20px; bottom: calc(24px + env(safe-area-inset-bottom)); z-index: 5;
  background: var(--accent); color: #fff; border: 0; border-radius: 999px;
  padding: 18px 26px; font-size: 1.15rem; font-weight: 700; box-shadow: 0 6px 18px rgba(0,0,0,.25); cursor: pointer; }

.photo-preview { position: relative; margin-top: 10px; }
.photo-preview img { width: 100%; border-radius: 12px; }
.photo-preview button { position: absolute; top: 8px; right: 8px; background: rgba(0,0,0,.6);
  color: #fff; border: 0; border-radius: 999px; width: 40px; height: 40px; font-size: 1.2rem; }
.file-label { display: block; text-align: center; padding: 16px; border: 2px dashed var(--line);
  border-radius: 12px; cursor: pointer; font-weight: 600; color: var(--primary); margin-top: 14px; }

.toast { position: fixed; left: 50%; bottom: 100px; transform: translateX(-50%); z-index: 30;
  background: var(--toast); color: #fff; padding: 14px 22px; border-radius: 12px; font-size: 1rem;
  max-width: 90vw; text-align: center; }

.notice { background: var(--soft-warm); border: 1px solid var(--warm-line); border-radius: 12px; padding: 12px 14px; font-size: .95rem; }
.tag { display: inline-block; background: var(--bg); padding: 2px 10px; border-radius: 999px; font-size: .85rem; margin-right: 4px; }

/* reCAPTCHA 배지 숨김 (로그인 화면에 Google 안내 문구 표시로 대체) */
.grecaptcha-badge { visibility: hidden !important; }
html, body { overflow-x: hidden; }

/* 게시판형 목록 */
.card.board { padding: 4px 16px; }
.brow { padding: 14px 0; border-bottom: 1px solid var(--line); cursor: pointer; }
.brow:last-child { border-bottom: 0; }
.brow:active { background: var(--bg); }
.brow.notice-row { background: var(--notice-row); margin: 0 -16px; padding: 14px 16px; }
.bttl { font-size: 1.05rem; font-weight: 600; line-height: 1.5;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; word-break: keep-all; }
.bttl .cat { margin: 0 4px 0 0; vertical-align: 2px; }
.bttl .ico { font-size: .85rem; margin-left: 2px; }
.bttl .ccount { color: var(--danger); font-size: .9rem; font-weight: 700; margin-left: 4px; }
.bmeta { color: var(--muted); font-size: .85rem; margin-top: 2px; }
.cat { display: inline-block; flex: none; font-size: .75rem; font-weight: 700; padding: 2px 8px;
  border-radius: 6px; background: var(--cat-bg); color: var(--primary); margin-bottom: 4px; }
.cat.cat-notice { background: var(--danger); color: #fff; }

/* 방 형식별 */
.typehint { background: var(--bg); border-radius: 10px; padding: 8px 12px; font-size: .85rem; color: var(--muted); }
.scripture { display: inline-block; background: var(--soft-blue); color: var(--scripture-text); font-weight: 700;
  border-radius: 8px; padding: 4px 10px; margin: 2px 0 8px; }
.appbox { background: var(--soft-green); border-left: 4px solid var(--ok); border-radius: 8px; padding: 10px 12px; margin-top: 12px; }
.eventbox { background: var(--soft-warm); border-radius: 10px; padding: 10px 12px; margin: 6px 0 10px; font-weight: 600; }
.bevent { font-size: .88rem; color: var(--primary); margin-top: 2px; }
.row > div { min-width: 0; }

/* 채팅형 */
.chat-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.chat { padding-bottom: 20px; }
body.chat-open #app { padding-bottom: 110px; }
.daysep { text-align: center; color: var(--muted); font-size: .8rem; margin: 16px 0 8px; }
.msg { margin: 8px 0; display: flex; flex-direction: column; align-items: flex-start; }
.msg.mine { align-items: flex-end; }
.msg .who { font-size: .85rem; font-weight: 700; margin: 0 0 2px 4px; }
.msg .line { display: flex; align-items: flex-end; gap: 6px; max-width: 88%; }
.msg.mine .line { flex-direction: row-reverse; }
.bubble { background: var(--card); border-radius: 16px 16px 16px 4px; padding: 10px 14px; white-space: pre-wrap;
  word-break: break-word; box-shadow: 0 1px 2px rgba(0,0,0,.08); }
.msg.mine .bubble { background: var(--mine-bubble); border-radius: 16px 16px 4px 16px; }
.msg .time { font-size: .72rem; color: var(--muted); flex: none; }
.linkbtn.tiny { font-size: .72rem; padding: 0 4px; color: var(--muted); }
.chatbar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 6; display: flex; gap: 8px; align-items: flex-end;
  background: var(--card); padding: 10px 12px calc(10px + env(safe-area-inset-bottom)); box-shadow: 0 -2px 10px rgba(0,0,0,.08); }
.chatbar textarea { min-height: 50px; max-height: 140px; padding: 12px; resize: none; flex: 1; }
.sendbtn { flex: none; background: var(--primary); color: #fff; border: 0; border-radius: 12px;
  padding: 0 18px; height: 50px; font-size: 1.05rem; font-weight: 700; }

/* 로고 */
#brand { height: 30px; width: auto; flex: none; margin-left: 2px; }
#brand[hidden] { display: none; }
.hero-logo { width: 62%; max-width: 280px; height: auto; display: block; margin: 10px auto 6px; }
/* 설치 안내 */
.install-card { margin-top: 16px; border: 2px solid var(--accent); }
.install-card .btn { margin-top: 12px; background: var(--accent); }
.sheet-bg { position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 40; display: flex; align-items: flex-end; }
.sheet { background: var(--card); width: 100%; border-radius: 20px 20px 0 0; padding: 22px 20px calc(22px + env(safe-area-inset-bottom)); }
.steps { padding-left: 22px; margin: 0; }
.steps li { margin: 10px 0; font-size: 1.05rem; }
.kbd { display: inline-block; background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: 1px 8px; font-weight: 700; }

/* 좋아요 (인스타그램식) */
.reactions { display: flex; align-items: center; gap: 4px; margin-top: 10px; }
.iconbtn { background: none; border: 0; padding: 6px; color: var(--text); cursor: pointer; line-height: 0; border-radius: 50%; }
.iconbtn.heart.on { color: #ed4956; }
.iconbtn.pop svg { animation: pop .35s ease; }
@keyframes pop { 0% { transform: scale(1); } 40% { transform: scale(1.3); } 100% { transform: scale(1); } }
.likecount { font-size: .95rem; margin-left: 6px; }

.postactions { display: flex; gap: 18px; margin-top: 8px; }
.linkbtn.edit { color: var(--primary); }

/* 버튼·방 이름 등을 길게 눌러도 글자 선택/구글 검색 창이 뜨지 않게 (글 본문은 복사 가능) */
#topbar, .menu, .room, .brow, .btn, .iconbtn, .linkbtn, .fab, .react, .tag, .badge, .cat,
.install-card, label, select, .typehint, .sendbtn {
  -webkit-user-select: none; user-select: none; -webkit-touch-callout: none;
}
body { -webkit-tap-highlight-color: transparent; }

/* 비공개 방·멤버 관리 */
.lock { font-size: .9rem; }
.adminroom { display: block; }
.arname { margin-bottom: 8px; }
.arctrl { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: center; }
.arctrl select { width: auto; flex: 1 1 130px; padding: 8px; font-size: .95rem; }
.chk { display: inline-flex; align-items: center; gap: 4px; margin: 0; font-weight: 400; font-size: .92rem; }
.chk input { width: 22px; height: 22px; }
.small-btn { padding: 8px 14px !important; font-size: .92rem !important; }
.mrow { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.mrow[hidden] { display: none; }

/* 아이콘 고르기 */
.iconedit { font-size: 1.5rem; background: var(--bg); border: 2px solid var(--line); border-radius: 12px;
  width: 44px; height: 44px; margin-right: 8px; cursor: pointer; vertical-align: middle; line-height: 1; padding: 0; }
.iconedit.big { width: 100%; height: 54px; font-size: 1.8rem; margin: 0; }
.icongrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(48px, 1fr)); gap: 6px; max-height: 45vh; overflow-y: auto; }
.iconpick { font-size: 1.7rem; background: var(--card); border: 2px solid var(--line); border-radius: 12px; height: 52px; cursor: pointer; }
.iconpick.on { border-color: var(--accent); background: var(--soft-warm); }

/* 화면 맨 아래 버전 표시 */
#app { padding-bottom: 40px; }
.appver { text-align: center; color: #a3a7ad; font-size: .7rem; padding: 0 0 calc(96px + env(safe-area-inset-bottom)); letter-spacing: .5px; }
body.chat-open .appver { display: none; }

/* SUITE Light 본문 + 제목·버튼은 굵게 */
button, input, select, textarea { font-family: inherit; }
input, textarea, select { font-weight: 400; }
b, strong { font-weight: 700; }

/* ===== 다크 모드 (메뉴에서 자동/밝게/어둡게 선택) ===== */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --primary: #3b6a9c; --primary-dark: #2c5480; --accent: #d9983a;
    --bg: #15171a; --card: #22252a; --text: #e6e4e0; --muted: #9aa0a6; --line: #373c43;
    --danger: #e0645c; --ok: #3f9a64;
    --soft-warm: #33291a; --warm-line: #5a4826; --soft-blue: #1f2d3d; --soft-green: #1d2a21;
    --notice-row: #2a2419; --cat-bg: #253447; --mine-bubble: #5b4a1e; --toast: #3a3f46; --scripture-text: #a9c8ea;
    color-scheme: dark;
  }
  :root:not([data-theme="light"]) .hero-logo { filter: brightness(0) invert(1); opacity: .92; }
  :root:not([data-theme="light"]) .btn.secondary { color: #a9c8ea; border-color: #4f7fb0; }
}
:root[data-theme="dark"] {
  --primary: #3b6a9c; --primary-dark: #2c5480; --accent: #d9983a;
  --bg: #15171a; --card: #22252a; --text: #e6e4e0; --muted: #9aa0a6; --line: #373c43;
  --danger: #e0645c; --ok: #3f9a64;
  --soft-warm: #33291a; --warm-line: #5a4826; --soft-blue: #1f2d3d; --soft-green: #1d2a21;
  --notice-row: #2a2419; --cat-bg: #253447; --mine-bubble: #5b4a1e; --toast: #3a3f46; --scripture-text: #a9c8ea;
  color-scheme: dark;
}
:root[data-theme="dark"] .hero-logo { filter: brightness(0) invert(1); opacity: .92; }
:root[data-theme="dark"] .btn.secondary { color: #a9c8ea; border-color: #4f7fb0; }

/* 방별 알림 켜기/끄기 */
.roomtop { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 10px; }
.chat-actions { display: flex; align-items: center; gap: 12px; flex: none; }
.mutebtn { flex: none; background: var(--card); color: var(--primary); border: 1.5px solid var(--line); border-radius: 999px;
  padding: 6px 12px; font-size: .85rem; font-weight: 600; cursor: pointer; font-family: inherit; }
.mutebtn.off { color: #8e8e8e; background: #dedede; border-color: #c6c6c6; font-weight: 500; filter: grayscale(1); }
:root[data-theme="dark"] .mutebtn.off { color: #8a8a8a; background: #2c2c2c; border-color: #444; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .mutebtn.off { color: #8a8a8a; background: #2c2c2c; border-color: #444; } }

/* 종교교회 홈페이지 링크 */
.churchlink { display: block; text-align: center; margin: 18px 0 4px; padding: 12px; color: var(--primary);
  font-weight: 600; text-decoration: none; background: var(--card); border: 1px solid var(--line); border-radius: 14px; }
.churchlink:active { opacity: .7; }
