/* =====================================================================
   전주홍산교회 휴대폰 앱 화면 (2026-11-28, 홍보팀)
   - html.app 일 때만 적용 (휴대폰 폭 760px 이하 또는 홈 화면 앱으로 열 때)
   - PC 화면에는 아무 영향 없음. 되돌리기: index.html에서 app/ 두 줄만 빼면 됨
   ===================================================================== */
.app-only, .app-tabbar, .app-back, .app-title, .app-install, .app-sheet { display: none; }

html.app {
  --app-bar: 58px;
  --app-tab: 64px;
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --c-gold: #c98a12; --c-violet: #7446c8; --c-green: #2f8a4c; --c-coral: #d0604a;
  --c-teal: #12808f; --c-blue: #2f62c8; --c-navy: #0b2a5b; --c-rose: #c2416e;
  -webkit-tap-highlight-color: transparent;
}
html.app body { padding-top: calc(var(--app-bar) + var(--safe-t)); padding-bottom: calc(var(--app-tab) + var(--safe-b)); background: #f3f5f9; overscroll-behavior-y: none; }
html.app.intro-on body { padding: 0; }

/* ---------- 위 앱 막대 ---------- */
html.app header.top { position: fixed !important; left: 0; right: 0; top: 0; z-index: 950;
  padding-top: var(--safe-t); background: #fff !important; -webkit-backdrop-filter: none !important; backdrop-filter: none !important; transform: none !important; filter: none !important;
  border-bottom: 1px solid #e6e9ef; box-shadow: none; }
html.app header.top .wrap { height: var(--app-bar) !important; width: 100%; padding: 0 12px 0 16px; display: flex; align-items: center; gap: 8px; }
html.app header.top nav.quick, html.app #menuBtn { display: none !important; }
html.app .brand { flex: 1; min-width: 0; display: flex; align-items: center; gap: 9px; }
html.app .brand::before { width: 30px !important; height: 30px !important; }
html.app .brand b { font-size: 1.18rem !important; white-space: nowrap; }
html.app .brand small { display: none; }
html.app .app-install { display: inline-flex; align-items: center; gap: 4px; border: 0; cursor: pointer; font: inherit; font-size: .86rem; font-weight: 700;
  color: #fff; background: linear-gradient(135deg, #0b2a5b, #2f62c8); padding: .46rem .8rem; border-radius: 999px; white-space: nowrap; }
html.app.standalone .app-install { display: none; }
/* 안쪽 화면일 때: 뒤로 단추 + 화면 이름 */
html.app.app-page .brand { display: none; }
html.app.app-page .app-back { display: grid; place-items: center; width: 40px; height: 40px; margin-left: -8px; border: 0; background: none; cursor: pointer; color: #0b2a5b; border-radius: 50%; }
html.app.app-page .app-back svg { width: 26px; height: 26px; fill: none; stroke: currentColor; stroke-linecap: round; stroke-linejoin: round; }
html.app.app-page .app-title { display: block; flex: 1; min-width: 0; font-size: 1.12rem; font-weight: 800; color: #13253a; letter-spacing: -.02em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---------- 전체 메뉴 = 앱 화면 한 장 ---------- */
html.app #mainNav { position: fixed !important; top: calc(var(--app-bar) + var(--safe-t)) !important; bottom: calc(var(--app-tab) + var(--safe-b)); left: 0; right: 0;
  max-height: none !important; overflow-y: auto; background: #f3f5f9 !important; box-shadow: none; z-index: 940; -webkit-overflow-scrolling: touch; }
html.app #mainNav .menu-grid { width: auto; padding: 14px 14px 24px !important; gap: 12px !important; }
html.app #mainNav .menu-grid > div { background: #fff !important; border-radius: 18px; box-shadow: 0 1px 3px rgba(16,30,54,.06); }
html.app #mainNav a { padding: .78rem .2rem !important; font-size: 1.05rem !important; }

/* ---------- 아래 탭 ---------- */
html.app .app-tabbar { display: grid; grid-template-columns: repeat(5, 1fr); position: fixed; left: 0; right: 0; bottom: 0; z-index: 960;
  height: calc(var(--app-tab) + var(--safe-b)); padding-bottom: var(--safe-b); background: rgba(255,255,255,.97);
  -webkit-backdrop-filter: saturate(180%) blur(14px); backdrop-filter: saturate(180%) blur(14px); border-top: 1px solid #e6e9ef; }
html.app.intro-on .app-tabbar { display: none; }
.app-tabbar a, .app-tabbar button { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; border: 0; background: none; font: inherit; cursor: pointer;
  color: #6b7686; text-decoration: none; font-size: .74rem; font-weight: 700; letter-spacing: -.02em; }
.app-tabbar i { display: grid; place-items: center; width: 46px; height: 30px; border-radius: 999px; transition: background .2s, color .2s; }
.app-tabbar svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.app-tabbar .on { color: var(--tc, #0b2a5b); }
.app-tabbar .on i { background: color-mix(in srgb, var(--tc, #0b2a5b) 14%, transparent); }

/* ---------- 첫 화면: 교회 전경 카드 (잘림 없이 2칸) ---------- */
html.app .sh-hero { border-radius: 0 0 26px 26px; overflow: hidden; }
html.app .sh-home { display: none; }
html.app .sh-in { padding: 1.1rem 0 1.2rem !important; }
html.app .sh-head b { font-size: 1.12rem; line-height: 1.4; }
html.app .sh-cards { display: grid !important; grid-template-columns: 1fr 1fr; gap: 12px 10px !important; overflow: visible !important; padding: 0 14px !important; }
html.app .sh-cards::after { display: none; }
html.app .sh-card, html.app .sh-paper, html.app .sh-board { flex: none !important; min-width: 0; }
html.app .sh-thumb, html.app .sh-paper .sh-thumb { aspect-ratio: 16 / 10 !important; border-radius: 12px; }
html.app .sh-card b { font-size: .92rem !important; margin-top: .45rem; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
html.app .sh-card small { font-size: .76rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
html.app .sh-lab { margin-bottom: .45rem; padding-bottom: .3rem; font-size: .86rem; }
html.app .sh-lab em { font-size: .72rem; }
html.app .sh-board { grid-column: 1 / -1; background: rgba(0,0,0,.28); border-radius: 14px; padding: .8rem .9rem .5rem; -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); }

/* ---------- 첫 화면: 바로가기 타일 ---------- */
html.app .app-only { display: block; }
.app-home { padding: 18px 14px 6px; }
.app-hello { display: flex; align-items: center; justify-content: space-between; margin: 0 4px 12px; }
.app-hello b { font-size: 1.2rem; font-weight: 800; color: #13253a; letter-spacing: -.03em; }
.app-hello small { color: #6b7686; font-size: .85rem; font-weight: 600; }
.app-tiles { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px 6px; background: #fff; border-radius: 22px; padding: 18px 8px 16px; box-shadow: 0 1px 3px rgba(16,30,54,.06), 0 8px 24px rgba(16,30,54,.05); }
.app-tiles a { display: flex; flex-direction: column; align-items: center; gap: 7px; text-decoration: none; color: #26364a; font-size: .8rem; font-weight: 700; letter-spacing: -.04em; text-align: center; line-height: 1.2; }
.app-tiles i { display: grid; place-items: center; width: 54px; height: 54px; border-radius: 17px; color: #fff; background: var(--tc);
  box-shadow: 0 6px 14px color-mix(in srgb, var(--tc) 32%, transparent); transition: transform .15s; }
.app-tiles a:active i { transform: scale(.92); }
.app-tiles svg { width: 27px; height: 27px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.app-quick { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 12px; }
.app-quick a { display: flex; align-items: center; gap: 10px; padding: 14px; border-radius: 18px; text-decoration: none; color: #fff; font-weight: 800; font-size: .98rem; letter-spacing: -.03em; line-height: 1.25; }
.app-quick a small { display: block; font-weight: 600; font-size: .76rem; opacity: .9; }
.app-quick a span:first-child { font-size: 1.5rem; }
.app-quick .yt { background: linear-gradient(135deg, #d93a3a, #b5233c); }
.app-quick .nf { background: linear-gradient(135deg, #12808f, #2f8a4c); }

/* 첫 화면 아래쪽 기존 띠·카드는 앱 카드 모양으로 */
html.app .sh-sec { background: transparent !important; padding-top: 18px !important; padding-bottom: 18px !important; }
html.app .sh-sec .sh-wrap { width: auto !important; margin: 0 14px !important; }
html.app .sh-split > div, html.app .sh-col { min-width: 0; }
html.app .sh-icons { display: none !important; } /* 위 바로가기 타일과 같은 단추 (PC에는 그대로) */

/* ---------- 화면 나누기: 첫 화면 / 안쪽 화면 ---------- */
html.app:not(.app-page) main > section.block { display: none !important; }
html.app.app-page .sh-hero,
html.app.app-page main > section:not(.app-cur),
html.app.app-page main > .sh-banner,
html.app.app-page .app-home { display: none !important; }
html.app.app-page main > section.app-cur { display: block !important; padding-top: 22px; min-height: calc(100svh - var(--app-bar) - var(--app-tab)); animation: appIn .28s ease; }
html.app.app-page main > section.app-cur .wrap { width: auto; margin: 0 16px; }
@keyframes appIn { from { opacity: 0; transform: translateX(14px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { html.app.app-page main > section.app-cur { animation: none; } }

/* ---------- 떠 있는 단추들은 아래 탭 위로 ---------- */
html.app .music-dock { bottom: calc(var(--app-tab) + var(--safe-b) + 10px) !important; right: 12px !important; }
html.app .mo-chip { bottom: calc(var(--app-tab) + var(--safe-b) + 10px) !important; left: 12px !important; font-size: .86rem; }
html.app .music-btn { padding: .5rem .85rem !important; font-size: .86rem !important; max-width: 44vw; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
html.app .mo-chip { max-width: 44vw; }
html.app .mo-chip .mo-open { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; padding-left: .8rem !important; }
html.app footer { padding-bottom: 1.2rem; }

/* ---------- 설치 안내 시트 ---------- */
html.app .app-sheet { display: none; position: fixed; inset: 0; z-index: 10050; background: rgba(10,20,35,.45); align-items: flex-end; }
html.app .app-sheet.open { display: flex; }
.app-sheet .in { width: 100%; background: #fff; border-radius: 24px 24px 0 0; padding: 22px 20px calc(20px + env(safe-area-inset-bottom, 0px)); animation: sheetUp .25s ease; }
@keyframes sheetUp { from { transform: translateY(40px); opacity: .6; } to { transform: none; opacity: 1; } }
.app-sheet .hd { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.app-sheet .hd img { width: 54px; height: 54px; border-radius: 14px; box-shadow: 0 2px 8px rgba(0,0,0,.12); }
.app-sheet .hd b { display: block; font-size: 1.15rem; color: #13253a; }
.app-sheet .hd small { color: #6b7686; }
.app-sheet ol { margin: 0 0 16px; padding-left: 1.3rem; color: #26364a; font-size: 1rem; line-height: 1.75; }
.app-sheet .ok { width: 100%; border: 0; border-radius: 14px; padding: .9rem; font: inherit; font-weight: 800; font-size: 1rem; color: #fff; background: #0b2a5b; cursor: pointer; }

@media (prefers-color-scheme: dark) {
  html.app body { background: #f3f5f9; }
}
