/* ================================================================
   📌 CSS 구조 안내
   ① 색상 변수 ② 기본 레이아웃 ③ 상단 카테고리 탭
   ④ 섹션 블록 ⑤ 컴포넌트    ⑥ 하단 네비게이션
   ⑦ 관리자 스타일 ⑧ 모달
================================================================ */

  /* ① 색상 변수 ──────────────────────────────────────────── */
  :root {
    --gold: #c9a84c;
    --gold-light: #e8c96a;
    --gold-dark: #8a6a1e;
    --deep: #1a1206;
    --warm: #2e2010;
    --cream: #fdf8ef;
    --cream2: #f5ead4;
    --text: #2a1a08;
    --text-light: #6b4f2a;
    --green: #2d6a4f;
    --green-light: #e8f5ee;
    --blue: #1a4a7a;
    --blue-light: #e8f0fa;
    --yellow-light: #fffbe6;
    --font-sans: Pretendard, -apple-system, BlinkMacSystemFont, system-ui, 'Segoe UI', sans-serif;
    --font-display: SUIT, Pretendard, -apple-system, sans-serif;
  }


  /* ② 기본 레이아웃 (body, header, content) ─────────────── */
  * { margin: 0; padding: 0; box-sizing: border-box; }

  body {
    font-family: var(--font-sans);
    background: #f4f0e8;
    color: var(--text);
    min-height: 100vh;
    padding-bottom: calc(80px + env(safe-area-inset-bottom, 0px));
  }

  /* 배경 사진 레이어 (콘텐츠·탭 뒤) */
  #site-bg-layer {
    position: fixed;
    inset: 0;
    z-index: -1;
    pointer-events: none;
    min-height: 100vh;
    min-height: 100dvh;
    transform: translateZ(0);
    -webkit-transform: translateZ(0);
  }
  #site-bg-image {
    position: absolute;
    inset: 0;
    background-size: cover;
    background-position: center top;
    background-repeat: no-repeat;
    display: none;
  }
  #site-bg-layer.has-image #site-bg-image { display: block; }
  #site-bg-overlay {
    position: absolute;
    inset: 0;
    background: var(--cream);
    opacity: 0;
    transition: opacity 0.2s ease;
  }
  #site-bg-layer.has-image #site-bg-overlay { opacity: var(--bg-overlay, 0.65); }

  header {
    position: relative;
    overflow: hidden;
    background: linear-gradient(135deg, var(--deep) 0%, var(--warm) 100%);
    padding: 16px 20px 14px;
    text-align: center;
    box-shadow: 0 3px 16px rgba(0,0,0,0.35);
  }
  .header-bg {
    position: absolute;
    inset: 0;
    z-index: 0;
    background-size: 100% 100%;
    background-position: center center;
    background-repeat: no-repeat;
    display: none;
  }
  header.has-header-image .header-bg { display: block; }
  .header-bg-overlay {
    position: absolute;
    inset: 0;
    z-index: 1;
    background: linear-gradient(135deg, var(--deep) 0%, var(--warm) 100%);
    pointer-events: none;
    display: none;
    transition: opacity 0.2s ease;
  }
  header.has-header-image .header-bg-overlay {
    display: block;
    opacity: var(--header-overlay, 0.55);
  }
  .header-inner {
    position: relative;
    z-index: 2;
  }
  .header-font-ctrl {
    position: absolute;
    top: 10px;
    right: 10px;
    display: flex;
    align-items: center;
    gap: 4px;
    z-index: 2;
  }
  .header-font-btn {
    background: rgba(201,168,76,0.15);
    border: 1px solid rgba(201,168,76,0.45);
    color: var(--gold-light);
    font-size: 14px;
    font-weight: 700;
    padding: 4px 10px;
    min-width: 32px;
    border-radius: 8px;
    cursor: pointer;
    font-family: inherit;
    line-height: 1.2;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
  }
  .header-font-btn:disabled,
  .header-font-btn.at-limit {
    opacity: 0.35;
    cursor: default;
  }
  .header-font-label {
    font-size: 11px;
    font-weight: 700;
    color: var(--gold-light);
    min-width: 38px;
    text-align: center;
    user-select: none;
  }
  .header-title {
    font-family: var(--font-display);
    font-size: 17px; font-weight: 900;
    color: var(--cream);
  }
  .header-sub { font-size: 13px; color: var(--gold-light); margin-top: 3px; }


  /* ③ 상단 카테고리 탭 ───────────────────────────────────── */
  .cat-nav {
    background: var(--deep);
    display: flex; overflow-x: auto; scrollbar-width: none;
    border-bottom: 2px solid rgba(201,168,76,0.3);
    position: sticky; top: 0; z-index: 100;
  }
  .cat-nav::-webkit-scrollbar { display: none; }
  .cat-btn {
    flex: none; padding: 13px 16px 12px;
    font-size: 15px; font-weight: 600;
    color: rgba(253,248,239,0.45); cursor: pointer;
    white-space: nowrap;
    border-bottom: 2.5px solid transparent; margin-bottom: -2px;
    transition: all 0.2s;
  }
  .cat-btn.active { color: var(--cream); border-bottom-color: var(--gold); }
  .cat-btn.drag-over { background: rgba(201,168,76,0.2); border-radius: 8px; }
  .cat-btn.dragging { opacity: 0.4; }
  .cat-order-hint {
    display: none;
    text-align: center;
    font-size: 11px;
    color: var(--gold);
    padding: 4px 0 2px;
    background: #1a1206;
    max-width: 480px; margin: 0 auto;
  }
  body.admin-mode .cat-order-hint { display: block; }

  .content { max-width: 480px; margin: 0 auto; padding: 16px 14px 20px; }

  .page { display: none; }
  .page.active { display: block; animation: fadein 0.25s ease; }
  @keyframes fadein { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; } }

  .page-title {
    font-family: var(--font-display);
    font-size: 22px; font-weight: 900;
    color: var(--text); margin-bottom: 14px; margin-top: 4px;
  }


  /* ④ 섹션 블록 ──────────────────────────────────────────── */
  /* SECTION BLOCKS */
  .section-block {
    background: white; border-radius: 14px;
    margin-bottom: 12px; overflow: hidden;
    box-shadow: 0 2px 10px rgba(0,0,0,0.06);
  }
  .section-header {
    padding: 13px 16px 11px;
    display: flex; align-items: center; gap: 8px;
    cursor: pointer; user-select: none;
  }
  .section-header.orange { background: linear-gradient(135deg, #3d1a00, #7a3500); }
  .section-header.green  { background: linear-gradient(135deg, #0d2d1a, #1a4d2e); }
  .section-header.blue   { background: linear-gradient(135deg, #0d1e33, #1a3355); }
  .section-header.yellow { background: linear-gradient(135deg, #2a1e00, #4a3600); }

  .section-num {
    font-size: 13px; font-weight: 700;
    padding: 2px 8px; border-radius: 10px; flex-shrink: 0;
  }
  .orange .section-num { background: rgba(224,123,42,0.3); color: #ffb570; }
  .green  .section-num { background: rgba(45,106,79,0.4);  color: #7fddaa; }
  .blue   .section-num { background: rgba(26,74,122,0.5);  color: #88bbff; }
  .yellow .section-num { background: rgba(201,168,76,0.3); color: var(--gold-light); }

  .section-title-text {
    font-family: var(--font-display);
    font-size: 14px; font-weight: 700;
    color: var(--cream); flex: 1; line-height: 1.3;
  }
  .section-arrow { font-size: 12px; color: rgba(253,248,239,0.4); transition: transform 0.25s; }
  .section-arrow.open { transform: rotate(180deg); }

  .section-body { padding: 16px 18px; display: none; border-top: 1px solid rgba(0,0,0,0.05); }
  .section-body.open { display: block; animation: fadein 0.2s ease; }

  /* INFO ROW */
  .info-row { display: flex; gap: 8px; margin-bottom: 10px; font-size: 16px; align-items: flex-start; line-height: 1.7; }
  .info-row:last-child { margin-bottom: 0; }
  .lbl {
    background: var(--cream2); color: var(--gold-dark);
    font-size: 11px; font-weight: 700;
    padding: 2px 8px; border-radius: 10px;
    white-space: nowrap; margin-top: 2px; flex-shrink: 0;
  }
  .lbl.green { background: var(--green-light); color: var(--green); }
  .lbl.blue  { background: var(--blue-light);  color: var(--blue); }

  /* NOTICE */
  .notice-item {
    background: #fffbf0; border: 1px solid rgba(201,168,76,0.25);
    border-radius: 10px; padding: 10px 14px; margin-bottom: 8px;
    font-size: 16px; line-height: 1.85; color: var(--text);
  }
  .notice-item:last-child { margin-bottom: 0; }
  .notice-item b { color: var(--gold-dark); }

  /* BULLET */
  .bullet-list { list-style: none; padding: 0; }
  .bullet-list li {
    font-size: 16px; line-height: 1.9; color: var(--text);
    padding: 6px 0 6px 20px; position: relative;
    border-bottom: 1px solid rgba(0,0,0,0.04);
  }
  .bullet-list li:last-child { border-bottom: none; }
  .bullet-list li::before { content: '•'; position: absolute; left: 4px; color: var(--gold); }
  .bullet-list li b { font-weight: 600; }
  .bullet-list li small { color: var(--text-light); font-size: 15px; }

  /* NUM SECTION */
  .num-section { margin-bottom: 12px; }
  .num-section:last-child { margin-bottom: 0; }
  .num-title {
    font-size: 16px; font-weight: 700; color: var(--text);
    margin-bottom: 8px; display: flex; align-items: center; gap: 6px;
  }
  .num-badge {
    background: var(--cream2); color: var(--gold-dark);
    font-size: 14px; font-weight: 700;
    padding: 3px 10px; border-radius: 8px;
  }

  /* PRAYER */
  .prayer-group-title {
    font-family: var(--font-display);
    font-size: 17px; font-weight: 700; color: var(--text);
    margin: 16px 0 10px; padding-left: 8px;
    border-left: 3px solid var(--gold);
  }
  .prayer-item {
    background: var(--yellow-light); border-radius: 10px;
    padding: 10px 14px; margin-bottom: 6px;
    font-size: 16px; line-height: 1.9; color: var(--text);
    border-left: 3px solid var(--gold);
  }

  /* MINISTRY APPLY */
  .ministry-apply-block {
    background: #fafafa; border-radius: 12px;
    margin-bottom: 12px; overflow: hidden;
    border: 1px solid rgba(201,168,76,0.2);
  }
  .ministry-apply-header {
    background: linear-gradient(135deg, #2a1e00, #4a3600);
    padding: 12px 14px; display: flex; align-items: center; gap: 10px;
  }
  .ministry-icon {
    width: 38px; height: 38px;
    background: rgba(201,168,76,0.2); border-radius: 10px;
    display: flex; align-items: center; justify-content: center;
    font-size: 19px; flex-shrink: 0;
  }
  .ministry-name { font-family: var(--font-display); font-size: 17px; font-weight: 700; color: var(--cream); }
  .ministry-target { font-size: 14px; color: var(--gold-light); margin-top: 2px; }
  .ministry-apply-body { padding: 12px 14px; }
  .ministry-date { font-size: 16px; color: var(--text-light); margin-bottom: 10px; }
  .ministry-date b { color: var(--text); }

  /* BUTTONS */
  .apply-btn {
    display: flex; align-items: center; justify-content: center; gap: 6px;
    width: 100%;
    background: linear-gradient(135deg, var(--gold), var(--gold-dark));
    color: white; border: none; padding: 12px; border-radius: 10px;
    font-size: 17px; font-weight: 700; font-family: var(--font-sans);
    cursor: pointer; text-decoration: none; transition: filter 0.2s;
  }
  .link-btn {
    display: flex; align-items: center; justify-content: center; gap: 6px;
    width: 100%; background: white; color: var(--blue);
    border: 1.5px solid var(--blue); padding: 11px; border-radius: 10px;
    font-size: 16px; font-weight: 600; font-family: var(--font-sans);
    cursor: pointer; text-decoration: none; margin-top: 8px;
  }


  /* ⑤ 컴포넌트 (notice, prayer, ministry, goods, note 등) ── */
  /* GOODS */
  .goods-item {
    display: flex; justify-content: space-between; align-items: center;
    padding: 10px 0; border-bottom: 1px solid rgba(0,0,0,0.06);
    font-size: 17px;
  }
  .goods-item:last-child { border-bottom: none; }
  .goods-price {
    font-weight: 700; color: var(--gold-dark);
    background: var(--cream2); padding: 2px 10px; border-radius: 10px;
  }

  .note {
    background: #fffbf0; border: 1px dashed rgba(201,168,76,0.4);
    border-radius: 10px; padding: 10px 14px;
    font-size: 15px; color: var(--text-light); line-height: 1.8; margin-top: 10px;
  }


  /* ⑥ 하단 네비게이션 ────────────────────────────────────── */
  /* BOTTOM NAV */
  .bottom-nav {
    position: fixed; bottom: 0; left: 0; right: 0;
    background: var(--deep); border-top: 1.5px solid rgba(201,168,76,0.25);
    display: flex; z-index: 200;
    padding-bottom: env(safe-area-inset-bottom, 0px);
  }
  @media (min-width: 480px) {
    .bottom-nav { left: 50%; transform: translateX(-50%); width: 480px; }
  }
  .nav-item {
    flex: 1; padding: 9px 4px 7px;
    display: flex; flex-direction: column; align-items: center; gap: 2px;
    cursor: pointer;
  }
  .nav-icon { font-size: 18px; }
  .nav-label {
    font-size: 12px;
    color: rgba(253,248,239,0.35);
    font-weight: 500;
    text-align: center;
    line-height: 1.25;
    word-break: keep-all;
    max-width: 100%;
  }
  .nav-item.active .nav-label { color: var(--gold); }

  a { color: inherit; text-decoration: none; }

  /* PWA 설치 안내 (1-4 양식 · 하단 배너) */
  .pwa-install {
    position: fixed;
    left: 0;
    right: 0;
    bottom: calc(72px + env(safe-area-inset-bottom, 0px));
    z-index: 12000;
    padding: 0.75rem 0.85rem;
    pointer-events: none;
    animation: pwaInstallSlideUp 0.4s ease;
  }
  .pwa-install.hidden { display: none; }
  @media (min-width: 480px) {
    .pwa-install { left: 50%; transform: translateX(-50%); width: 480px; }
  }
  @keyframes pwaInstallSlideUp {
    from { opacity: 0; transform: translateY(14px); }
    to   { opacity: 1; transform: translateY(0); }
  }
  @media (min-width: 480px) {
    @keyframes pwaInstallSlideUp {
      from { opacity: 0; transform: translateX(-50%) translateY(14px); }
      to   { opacity: 1; transform: translateX(-50%) translateY(0); }
    }
  }
  .pwa-install-inner {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    background: linear-gradient(135deg, #1a1206, #2e2010);
    border: 1px solid rgba(201,168,76,0.35);
    border-radius: 14px;
    padding: 0.85rem 1rem;
    box-shadow: 0 10px 36px rgba(0, 0, 0, 0.35);
    pointer-events: auto;
  }
  .pwa-install-icon img {
    border-radius: 10px;
    display: block;
    width: 48px;
    height: 48px;
    object-fit: cover;
  }
  .pwa-install-text { flex: 1; min-width: 0; }
  .pwa-install-title {
    font-weight: 700;
    font-size: 0.95em;
    color: var(--gold-light);
  }
  .pwa-install-desc {
    font-size: 0.78em;
    color: rgba(253,248,239,0.75);
    margin-top: 0.15rem;
    line-height: 1.4;
  }
  .pwa-ios-hint {
    font-size: 0.75em;
    color: rgba(253,248,239,0.85);
    margin-top: 0.35rem;
    line-height: 1.45;
  }
  .pwa-install-actions {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    flex-shrink: 0;
  }
  .pwa-install-btn {
    white-space: nowrap;
    padding: 0.45rem 0.75rem;
    font-size: 0.82em;
    border-radius: 10px;
    border: none;
    background: linear-gradient(135deg, var(--gold), var(--gold-dark));
    color: white;
    font-weight: 700;
    cursor: pointer;
    font-family: inherit;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
  }
  .pwa-install-btn:disabled {
    opacity: 0.55;
    cursor: default;
  }
  .pwa-install-dismiss {
    white-space: nowrap;
    padding: 0.4rem 0.75rem;
    font-size: 0.78em;
    border-radius: 10px;
    border: 1px solid rgba(253,248,239,0.25);
    background: rgba(255,255,255,0.06);
    color: rgba(253,248,239,0.75);
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
  }


  /* ⑦ 관리자 모드 스타일 ─────────────────────────────────── */
  /* ===== 관리자 모드 ===== */
  .admin-bar {
    background: #1a1206;
    border-bottom: 1px solid rgba(201,168,76,0.2);
    padding: 7px 16px;
    display: flex; align-items: center; justify-content: space-between;
    max-width: 480px; margin: 0 auto;
  }
  .admin-bar-label { font-size: 11px; color: rgba(253,248,239,0.4); }
  .admin-login-btn {
    background: rgba(201,168,76,0.2); border: 1px solid var(--gold);
    color: var(--gold); font-size: 11px; font-weight: 700;
    padding: 4px 12px; border-radius: 8px; cursor: pointer;
    font-family: var(--font-sans);
  }
  .admin-logout-btn {
    background: rgba(255,80,80,0.15); border: 1px solid #ff6060;
    color: #ff8080; font-size: 11px; font-weight: 700;
    padding: 4px 12px; border-radius: 8px; cursor: pointer;
    font-family: var(--font-sans);
  }
  .edit-btn {
    display: none;
    background: rgba(201,168,76,0.15); border: 1px solid var(--gold);
    color: var(--gold-dark); font-size: 11px; font-weight: 700;
    padding: 3px 10px; border-radius: 8px; cursor: pointer;
    font-family: var(--font-sans); flex-shrink: 0;
  }
  body.admin-mode .edit-btn { display: inline-flex; align-items: center; gap: 3px; }
  body.admin-mode .section-block { border: 1.5px dashed rgba(201,168,76,0.3); }
  body.admin-mode .notice-item  { border: 1.5px dashed rgba(201,168,76,0.3); }


  /* ⑧ 모달 (로그인 / 편집창 등) ─────────────────────────── */
  /* 편집 모달 */
  .modal-overlay {
    display: none; position: fixed; inset: 0;
    background: rgba(0,0,0,0.65); z-index: 2000;
    align-items: center; justify-content: center; padding: 16px;
  }
  .modal-overlay.open { display: flex; }
  .modal-box {
    background: white; border-radius: 16px;
    width: 100%; max-width: 460px;
    max-height: 88vh;
    display: flex; flex-direction: column;
    padding: 0; box-shadow: 0 10px 40px rgba(0,0,0,0.3);
    overflow: hidden;
  }
  .modal-box h3 {
    font-family: var(--font-sans);
    font-size: 15px; font-weight: 700; color: var(--text);
    margin-bottom: 0; padding: 18px 20px 14px;
    border-bottom: 1px solid rgba(201,168,76,0.25);
    flex-shrink: 0;
  }
  .modal-box-body {
    flex: 1; overflow-y: auto; padding: 16px 20px 8px;
    -webkit-overflow-scrolling: touch;
    min-height: 0;
  }
  .modal-box-footer {
    flex-shrink: 0; padding: 12px 20px 16px;
    border-top: 1px solid rgba(201,168,76,0.15);
    background: white;
    border-radius: 0 0 16px 16px;
  }
  .edit-field { margin-bottom: 11px; }
  .edit-field label {
    display: block; font-size: 11px; font-weight: 700;
    color: var(--text-light); margin-bottom: 4px;
  }
  .edit-field input, .edit-field textarea {
    width: 100%; border: 1.5px solid rgba(201,168,76,0.3);
    border-radius: 8px; padding: 8px 10px;
    font-size: 13px; font-family: var(--font-sans);
    color: var(--text); background: #fdfaf5; resize: vertical;
  }
  .edit-field input:focus, .edit-field textarea:focus {
    outline: none; border-color: var(--gold);
  }
  .modal-btns { display: flex; gap: 8px; margin-top: 0; }
  .btn-save {
    flex: 1; background: linear-gradient(135deg, var(--gold), var(--gold-dark));
    color: white; border: none; padding: 12px; border-radius: 10px;
    font-size: 16px; font-weight: 700; cursor: pointer;
    font-family: var(--font-sans);
  }
  .btn-cancel {
    flex: 1; background: white; color: var(--text-light);
    border: 1.5px solid #ddd; padding: 12px; border-radius: 10px;
    font-size: 14px; cursor: pointer; font-family: var(--font-sans);
  }
  .toast {
    position: fixed; bottom: 90px; left: 50%; transform: translateX(-50%);
    background: #2d6a4f; color: white; padding: 10px 22px;
    border-radius: 20px; font-size: 13px; font-weight: 700;
    z-index: 9999; box-shadow: 0 4px 14px rgba(0,0,0,0.25);
    opacity: 0; transition: opacity 0.3s;
  }
  .toast.show { opacity: 1; }

  /* ⑨ 첫방문 글자크기 모달 버튼 hover */
  #fontsize-modal .modal-box button:hover {
    opacity: 0.88; transform: translateY(-1px); transition: all 0.15s;
  }

  /* ⑨ 관리자 모드 - edit-btn-area 표시 */
  body.admin-mode .edit-btn-area { display: block !important; }
  /* 관리자 모드에서 헤더 편집 버튼 표시 */
  body.admin-mode #header-edit-btn,
  body.admin-mode #header-sub-edit-btn { display: inline-block !important; }

  /* ⑩ 사진 갤러리 */
  .photo-gallery {
    display: flex;
    flex-wrap: wrap;
    gap: 8px; margin-top: 8px;
    justify-content: center;
  }
  .photo-thumb {
    position: relative; border-radius: 10px; overflow: hidden;
    aspect-ratio: 4/3; cursor: pointer;
    box-shadow: 0 2px 8px rgba(0,0,0,0.12);
    width: calc(50% - 4px);
    max-width: 220px;
    flex-shrink: 0;
  }
  /* 사진 1장이면 가운데 크게 */
  .photo-thumb:only-child {
    width: 80%;
    max-width: 340px;
  }
  [id^="schedule-photos"], [id^="facility-photos"], [id^="goods-photos-"] {
    text-align: center;
  }
  .photo-thumb img { width:100%; height:100%; object-fit:cover; }
  /* 일정표·시설: 가로 긴 문서형 — 잘리지 않고 전체 너비 표시 */
  .photo-gallery--document {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }
  .photo-gallery--document .photo-thumb {
    width: 100%;
    max-width: 100%;
    aspect-ratio: unset;
    height: auto;
  }
  .photo-gallery--document .photo-thumb:only-child {
    width: 100%;
    max-width: 100%;
  }
  .photo-gallery--document .photo-thumb img {
    width: 100%;
    height: auto;
    object-fit: unset;
    display: block;
  }
  .photo-del-btn {
    display: none; position: absolute; top:4px; right:4px;
    background: rgba(192,57,43,0.85); color: white;
    border: none; border-radius: 50%; width:24px; height:24px;
    font-size:13px; cursor:pointer; line-height:24px; text-align:center;
  }
  body.admin-mode .photo-del-btn { display: block; }

  /* ⑨-2 관리자에게만 보이는 숨김 메뉴 표시 */
  .cat-btn.menu-hidden-admin,
  .nav-item.menu-hidden-admin { opacity: 0.45; }
  .cat-btn.menu-hidden-admin { border: 1px dashed rgba(201,168,76,0.45); }

  /* ⑪ 사진 전체화면 뷰어 */
  #photo-viewer {
    display: none;
    position: fixed; inset: 0;
    width: 100%;
    height: 100vh;
    height: 100dvh;
    padding: env(safe-area-inset-top) env(safe-area-inset-right)
             env(safe-area-inset-bottom) env(safe-area-inset-left);
    box-sizing: border-box;
    background: rgba(0,0,0,0.95); z-index: 99999;
    overflow: auto;
    -webkit-overflow-scrolling: touch;
  }
  #photo-viewer.open { display: block; }
  #photo-viewer-inner {
    min-height: 100%;
    min-width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    padding: 8px 0;
  }
  #photo-viewer-img {
    display: block;
    max-width: 100%;
    max-height: calc(100dvh - env(safe-area-inset-top) - env(safe-area-inset-bottom) - 24px);
    max-height: calc(100vh - env(safe-area-inset-top) - env(safe-area-inset-bottom) - 24px);
    width: auto;
    height: auto;
    object-fit: contain;
    flex-shrink: 0;
    min-width: 0;
    touch-action: pan-x pan-y pinch-zoom;
    user-select: none; -webkit-user-select: none;
  }
  #photo-viewer-close {
    position: fixed; top:16px; right:16px;
    background: rgba(255,255,255,0.15); color: white;
    border: none; border-radius: 50%; width:40px; height:40px;
    font-size:20px; cursor:pointer; z-index:100000;
  }
  /* ── 초기 로딩 오버레이 애니메이션 ── */
  @keyframes pmOverlayPulse { 0%,100%{transform:scale(1);opacity:1} 50%{transform:scale(1.12);opacity:0.75} }
  @keyframes pmLoadBar { from{width:8%} to{width:92%} }
  /* ⑩ 셔틀 시간표 테이블 */
  .shuttle-table { width:100%; border-collapse:collapse; font-size:15px; margin-top:8px; margin-bottom:4px; }
  .shuttle-table th { background:linear-gradient(135deg,#0d1e33,#1a3355); color:var(--cream); padding:8px 10px; text-align:center; font-size:13px; font-weight:700; }
  .shuttle-table td { padding:8px 10px; border-bottom:1px solid rgba(0,0,0,0.06); text-align:center; color:var(--text); vertical-align:middle; }
  .shuttle-table tr:last-child td { border-bottom:none; }
  .shuttle-table tr:nth-child(even) td { background:#f8f5ee; }
  .shuttle-table .warn-row td { background:#fff3cd; color:#856404; font-weight:700; }
  .shuttle-badge { display:inline-block; background:var(--blue-light); color:var(--blue); font-size:11px; font-weight:700; padding:1px 7px; border-radius:8px; margin-bottom:3px; }

  /* ⑪ 리치텍스트 에디터 (글 수정 툴바) ─────────────────── */
  .rte-wrap {
    position: relative;
    border: 1.5px solid rgba(201,168,76,0.3);
    border-radius: 8px;
    background: #fff;
    overflow: visible;
  }
  .rte-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 4px;
    padding: 6px 8px;
    background: #f3f3f3;
    border-bottom: 1px solid #e5e5e5;
    border-radius: 7px 7px 0 0;
  }
  .rte-sep {
    width: 1px;
    height: 20px;
    background: #ddd;
    margin: 0 2px;
    flex-shrink: 0;
  }
  .rte-btn, .rte-size {
    appearance: none;
    -webkit-appearance: none;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 6px;
    height: 30px;
    min-width: 30px;
    padding: 0 7px;
    font-size: 13px;
    font-family: var(--font-sans);
    color: #333;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    box-sizing: border-box;
    touch-action: manipulation;
  }
  .rte-size {
    font-weight: 700;
    padding: 0 4px 0 8px;
    min-width: 44px;
  }
  .rte-btn:hover, .rte-size:hover { border-color: #bbb; background: #fafafa; }
  .rte-btn:active, .rte-btn.active { background: #eee; border-color: #aaa; }
  .rte-btn b { font-weight: 800; }
  .rte-btn i { font-style: italic; }
  .rte-btn .rte-u { text-decoration: underline; }
  .rte-btn .rte-s { text-decoration: line-through; }
  .rte-color-swatch {
    width: 16px;
    height: 16px;
    border-radius: 3px;
    background: #000;
    border: 1px solid rgba(0,0,0,0.15);
    display: block;
  }
  .rte-editor {
    min-height: 66px;
    max-height: 280px;
    overflow-y: auto;
    padding: 10px 12px;
    font-size: 14px;
    font-family: var(--font-sans);
    line-height: 1.7;
    color: var(--text);
    outline: none;
    -webkit-user-select: text;
    user-select: text;
    word-break: break-word;
  }
  .rte-editor:focus { background: #fffcf7; }
  .rte-editor:empty:before {
    content: attr(data-placeholder);
    color: #bbb;
    pointer-events: none;
  }
  .rte-panel {
    display: none;
    position: absolute;
    z-index: 40;
    top: 42px;
    left: 8px;
    right: 8px;
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 10px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.14);
    padding: 10px 12px;
    max-height: 260px;
    overflow-y: auto;
  }
  .rte-panel.open { display: block; }
  .rte-panel-title {
    font-size: 11px;
    font-weight: 700;
    color: #888;
    margin: 8px 0 6px;
  }
  .rte-panel-title:first-child { margin-top: 0; }
  .rte-swatch-row {
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    gap: 4px;
    margin-bottom: 2px;
  }
  .rte-swatch {
    width: 100%;
    aspect-ratio: 1;
    border-radius: 4px;
    border: 1px solid rgba(0,0,0,0.12);
    cursor: pointer;
    padding: 0;
    box-sizing: border-box;
  }
  .rte-swatch:hover { transform: scale(1.08); box-shadow: 0 0 0 2px rgba(201,168,76,0.45); }
  .rte-align-row { display: flex; gap: 6px; }
  .rte-align-row .rte-btn { flex: 1; height: 34px; font-size: 12px; }

  /* ⑨ UI 모드 선택 UI */
  .uimode-modal-box {
    max-width: 360px;
    padding: 22px 20px 20px;
    text-align: left;
  }
  .uimode-modal-title {
    border: none !important;
    padding: 0 0 6px !important;
    font-family: var(--font-display) !important;
    font-size: 20px !important;
    letter-spacing: -0.03em;
  }
  .uimode-modal-desc {
    font-size: 13px;
    color: var(--text-light);
    line-height: 1.6;
    margin-bottom: 16px;
  }
  .uimode-pick-grid {
    display: flex;
    flex-direction: column;
    gap: 10px;
  }
  .uimode-pick-btn {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
    width: 100%;
    padding: 16px 16px;
    border-radius: 12px;
    border: 1.5px solid var(--line-strong);
    background: #fff;
    cursor: pointer;
    font-family: inherit;
    text-align: left;
    touch-action: manipulation;
    transition: border-color 0.15s ease, background 0.15s ease;
  }
  .uimode-pick-btn:active { background: var(--accent-soft); }
  .uimode-pick-btn--senior {
    border-color: var(--accent);
    background: linear-gradient(180deg, #fff 0%, var(--accent-soft) 140%);
  }
  .uimode-pick-kicker {
    font-size: 11px;
    font-weight: 700;
    color: var(--accent);
    letter-spacing: 0.04em;
  }
  .uimode-pick-name {
    font-size: 17px;
    font-weight: 800;
    color: var(--text);
  }
  .uimode-pick-hint {
    font-size: 12px;
    color: var(--text-light);
  }

  .uimode-settings-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
  }
  .uimode-settings-btn {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 2px;
    padding: 14px 12px;
    border-radius: 10px;
    border: 2px solid rgba(201, 168, 76, 0.45);
    background: #fff;
    box-shadow: 0 1px 0 rgba(0, 0, 0, 0.03);
    cursor: pointer;
    font-family: inherit;
    text-align: left;
    touch-action: manipulation;
    transition: border-color 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
  }
  .uimode-settings-btn.is-active {
    border-color: var(--gold-dark, #b8922a);
    background: #f9f6ee;
    box-shadow: inset 0 0 0 1px rgba(201, 168, 76, 0.35);
  }
  .uimode-settings-name {
    font-size: 14px;
    font-weight: 800;
    color: var(--text);
  }
  .uimode-settings-hint {
    font-size: 11px;
    color: var(--text-light);
  }


  /* ⑨-b compact (30–40) — 기본 세련 톤 유지, 약간 타이트 */
  html.ui-compact .section-title-text { font-size: 14px; }
  html.ui-compact .nav-label { font-size: 11px; }
  html.ui-compact .apply-btn,
  html.ui-compact .link-btn { font-size: 15px; }


  /* ⑨-c senior (50–60) — 2번 풀와이드 리스트 */
  html.ui-senior body {
    padding-bottom: calc(92px + env(safe-area-inset-bottom, 0px));
  }
  html.ui-senior .content {
    padding: 14px 12px 24px;
  }
  html.ui-senior .page-title {
    font-size: 24px;
    margin-bottom: 16px;
  }
  html.ui-senior .section-block {
    margin-bottom: 10px;
    border-radius: 10px;
    box-shadow: none;
    border: 1px solid var(--line-strong);
  }
  html.ui-senior .section-header {
    padding: 18px 16px;
    min-height: 64px;
    gap: 12px;
  }
  html.ui-senior .section-title-text {
    font-size: 18px;
    font-weight: 700;
    line-height: 1.4;
  }
  html.ui-senior .section-num {
    font-size: 13px;
    padding: 4px 10px;
  }
  html.ui-senior .section-arrow {
    font-size: 16px;
    color: rgba(253,248,239,0.55);
  }
  html.ui-senior .section-body {
    padding: 18px 16px 20px;
  }
  html.ui-senior .info-row,
  html.ui-senior .bullet-list li,
  html.ui-senior .notice-item,
  html.ui-senior .prayer-item,
  html.ui-senior .ministry-date,
  html.ui-senior .goods-item {
    font-size: 18px;
    line-height: 1.85;
  }
  html.ui-senior .lbl {
    font-size: 13px;
    padding: 4px 10px;
  }
  html.ui-senior .apply-btn,
  html.ui-senior .link-btn {
    justify-content: space-between;
    padding: 18px 18px;
    min-height: 60px;
    font-size: 18px;
    border-radius: 12px;
    margin-top: 10px;
  }
  html.ui-senior .apply-btn::after,
  html.ui-senior .link-btn::after {
    content: '›';
    font-size: 22px;
    font-weight: 400;
    line-height: 1;
    opacity: 0.85;
  }
  html.ui-senior .link-btn {
    margin-top: 10px;
  }
  html.ui-senior .ministry-name {
    font-size: 19px;
  }
  html.ui-senior .ministry-target {
    font-size: 15px;
  }
  html.ui-senior .nav-item {
    padding: 11px 4px 10px;
    gap: 3px;
  }
  html.ui-senior .nav-icon {
    font-size: 20px;
  }
  html.ui-senior .nav-label {
    font-size: 13px;
    font-weight: 600;
  }
  html.ui-senior .header-font-btn,
  html.ui-senior .header-font-label {
    font-size: 13px;
  }
  html.ui-senior .header-font-btn {
    padding: 8px 11px;
  }
  html.ui-senior .header-title {
    font-size: 18px;
  }
  html.ui-senior .header-sub {
    font-size: 14px;
  }
  html.ui-senior .cat-btn {
    padding: 15px 18px 14px;
    font-size: 16px;
  }
  html.ui-senior .btn-save,
  html.ui-senior .btn-cancel {
    padding: 16px;
    font-size: 17px;
    min-height: 54px;
  }
  html.ui-senior .pwa-install-btn,
  html.ui-senior .pwa-install-dismiss {
    min-height: 54px;
    font-size: 17px;
  }
  html.ui-senior .uimode-settings-btn {
    min-height: 64px;
    padding: 16px 14px;
  }
  html.ui-senior .uimode-settings-name {
    font-size: 15px;
  }

  /* 셀프 체크인 결과 카드 — 배경 사진 위에서도 불투명 */
  .checkin-result {
    background: #fff;
    border: 1.5px solid rgba(201, 168, 76, 0.35);
    border-radius: 14px;
    overflow: hidden;
    box-shadow: 0 4px 18px rgba(26, 18, 6, 0.12);
  }
  .checkin-result__head {
    background: var(--deep);
    color: #fff;
    padding: 14px 16px;
    font-size: 16px;
    font-weight: 700;
  }
  .checkin-result__head--ok { background: var(--green); }
  .checkin-result__head--done { background: var(--blue); }
  .checkin-result__msg {
    padding: 12px 16px 4px;
    font-size: 14px;
    line-height: 1.7;
    color: var(--text);
    background: #fff;
  }
  .checkin-result__list {
    list-style: none;
    margin: 0;
    padding: 0;
    background: #fff;
  }
  .checkin-result__row {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
    padding: 14px 16px;
    border-top: 1px solid rgba(0, 0, 0, 0.08);
    font-size: 16px;
    line-height: 1.5;
    background: #fff;
  }
  .checkin-result__label {
    flex-shrink: 0;
    color: var(--text-light);
    font-weight: 700;
    font-size: 13px;
    min-width: 7.5em;
  }
  .checkin-result__value {
    flex: 1;
    text-align: right;
    color: var(--text);
    font-weight: 700;
    word-break: keep-all;
  }
  .checkin-result__value.is-empty {
    color: #8a7a62;
    font-weight: 500;
  }
  .checkin-result__value a.checkin-tel {
    color: var(--blue);
    text-decoration: underline;
    font-weight: 800;
    touch-action: manipulation;
  }
  .checkin-result__foot {
    padding: 12px 16px 16px;
    font-size: 13px;
    color: var(--text-light);
    line-height: 1.6;
    background: #faf7f0;
    border-top: 1px solid rgba(0, 0, 0, 0.06);
  }
  .checkin-result__foot a.checkin-tel {
    color: var(--blue);
    text-decoration: underline;
    font-weight: 700;
    touch-action: manipulation;
  }
  html.ui-senior .checkin-result__row {
    padding: 16px;
    font-size: 18px;
  }
  html.ui-senior .checkin-result__label {
    font-size: 15px;
  }

  @media (prefers-reduced-motion: reduce) {
    .page.active,
    .section-body.open,
    .pwa-install-popup {
      animation: none;
    }
  }
