/* PWA 설치 모달·새 버전 토스트 (spec docs/superpowers/specs/2026-09-24-pwa-design.md §2.5·§3, 앱 카드 모양 2026-10-01).
   시트의 모바일 모양은 mobile-shell.css(.m-sheet, 폰)가 준다. 여기서는 안의 내용과 데스크톱 모달만.
   [data-pwa-form] 은 시트의 data-form(pwa.js — 폰 · 데스크톱)에 맞는 문구 · 미리보기만 남긴다. */
.pwa-sheet[data-form="phone"] [data-pwa-form="desktop"], .pwa-sheet[data-form="desktop"] [data-pwa-form="phone"] { display: none; }
.pwa-sheet [hidden] { display: none !important; }
.pwa-panel { position: relative; word-break: keep-all; overflow-wrap: anywhere; }
.pwa-x { position: absolute; top: 12px; right: 12px; z-index: 1; display: grid; place-items: center; width: 32px; height: 32px; padding: 0; border: 0; border-radius: 50%;
         background: none; color: var(--color-text-muted); cursor: pointer; }
.pwa-x:hover { background: var(--gray-100, #f3f4f6); color: var(--color-text); }
.pwa-x:focus-visible { outline: 2px solid var(--color-primary); outline-offset: 1px; }

/* 앱 카드 머리 */
.pwa-app { display: flex; align-items: center; gap: 14px; padding-right: 36px; }
.pwa-app-icon { flex: none; width: 64px; height: 64px; border-radius: 16px; box-shadow: 0 4px 14px rgba(0, 82, 163, .25); }
.pwa-app-text { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.pwa-sheet .pwa-app-name { margin: 0; font-size: 20px; font-weight: 700; letter-spacing: -.01em; line-height: 1.2; }
.pwa-app-host { color: var(--color-text-muted); font-size: 12.5px; }
.pwa-app-host:empty { display: none; }
.pwa-app-desc { margin: 2px 0 0; color: var(--color-text-secondary); font-size: 13.5px; line-height: 1.45; }

/* 미리보기 줄 — 매니페스트 screenshots 와 같은 그림 */
.pwa-shots { display: flex; gap: 10px; margin: 18px -24px 0; padding: 2px 24px 6px; overflow-x: auto; overscroll-behavior-x: contain;
             scroll-snap-type: x mandatory; scroll-padding-inline: 24px; scrollbar-width: thin; }
.pwa-shots:focus-visible { outline: 2px solid var(--color-primary); outline-offset: -2px; border-radius: 8px; }
.pwa-shot { flex: none; scroll-snap-align: start; border: 1px solid var(--color-border); border-radius: 10px; background: var(--gray-100, #f3f4f6);
            box-shadow: 0 2px 8px rgba(15, 23, 42, .08); object-fit: cover; }
.pwa-shot[data-pwa-form="desktop"] { width: 78%; height: auto; aspect-ratio: 1280 / 800; }
.pwa-shot[data-pwa-form="phone"] { width: auto; height: 236px; aspect-ratio: 780 / 1688; }

/* 좋은 점 */
.pwa-benefits { display: grid; gap: 10px; margin: 16px 0 0; padding: 0; list-style: none; }
.pwa-benefits li { display: flex; align-items: center; gap: 12px; font-size: 14px; line-height: 1.45; color: var(--color-text); }
.pwa-benefit-icon { flex: none; display: grid; place-items: center; width: 32px; height: 32px; border-radius: 10px; background: var(--color-primary-light, #eef4ff); color: var(--color-primary); }

/* 설치하는 길 */
.pwa-how { margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--color-border); }
.pwa-lead { display: flex; align-items: center; gap: 8px; margin: 0 0 12px; font-size: 15px; font-weight: 600; color: var(--color-text); }
.pwa-lead-ok svg { flex: none; color: var(--success-600, #16a34a); }
.pwa-body { margin: 0 0 12px; color: var(--color-text-secondary); font-size: 14.5px; line-height: 1.55; }
.pwa-note { margin: 8px 0 0; color: var(--color-text-muted); font-size: 13px; line-height: 1.5; }
.pwa-steps { margin: 0; padding: 0; list-style: none; counter-reset: pwa-step; }
.pwa-step { display: flex; align-items: center; gap: 12px; min-height: 46px; border-bottom: 1px solid var(--color-border); font-size: 14.5px; counter-increment: pwa-step; }
.pwa-step:last-child { border-bottom: 0; }
.pwa-step::before { content: counter(pwa-step); display: grid; place-items: center; flex: 0 0 24px; height: 24px; border-radius: 50%; background: var(--color-primary-light); color: var(--color-primary); font-size: 13px; font-weight: 700; }
.pwa-step svg { flex: none; color: var(--color-primary); }
/* 시크릿 · 게스트 창 안내 — 크롬 계열 경우에만(설치 창이 오면 data-case 가 prompt 라 숨는다) */
.pwa-sheet .pwa-private-note { display: none; margin-top: 12px; }
.pwa-sheet:is([data-case="chromium"], [data-case="android"]) .pwa-private-note { display: block; }

/* 주소창 그림 (데스크톱 크롬 · 에지) — 설치 아이콘을 맥박 고리로 짚고 그 아래 말풍선 */
.pwa-omnibox { position: relative; padding: 14px 14px 46px; border-radius: 12px; background: linear-gradient(180deg, var(--gray-100, #f3f4f6), var(--gray-50, #f9fafb)); }
.pwa-omni-bar { display: flex; align-items: center; gap: 8px; height: 36px; padding: 0 8px 0 14px; border: 1px solid var(--color-border); border-radius: 18px;
                background: var(--color-surface, #fff); color: var(--color-text-muted); font-size: 13px; box-shadow: 0 1px 2px rgba(15, 23, 42, .06); }
.pwa-omni-host { flex: 1; min-width: 0; overflow: hidden; color: var(--color-text); text-overflow: ellipsis; white-space: nowrap; }
.pwa-omni-install { position: relative; display: grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; background: var(--color-primary-light); color: var(--color-primary); }
.pwa-omni-install::after { content: ''; position: absolute; inset: -4px; border: 2px solid var(--color-primary); border-radius: 50%; animation: pwa-omni-pulse 1.8s ease-out infinite; }
.pwa-omni-star { flex: none; margin-right: 2px; }
.pwa-omni-tip { position: absolute; right: 28px; bottom: 10px; padding: 5px 10px; border-radius: 6px; background: #1f2937; color: #fff; font-size: 12px; font-weight: 600; white-space: nowrap; }
.pwa-omni-tip::before { content: ''; position: absolute; top: -5px; right: 12px; border: 5px solid transparent; border-top: 0; border-bottom-color: #1f2937; }
@keyframes pwa-omni-pulse { 0% { opacity: .9; transform: scale(.85); } 70% { opacity: 0; transform: scale(1.35); } 100% { opacity: 0; transform: scale(1.35); } }
@media (prefers-reduced-motion: reduce) { .pwa-omni-install::after { animation: none; opacity: .6; } }

/* 설치 창이 준비되면 나타나는 「설치」 */
.pwa-ready { margin: 14px 0 0; color: var(--color-primary); font-size: 13px; font-weight: 600; }
.pwa-ready:empty { display: none; }
.pwa-sheet-actions { display: flex; justify-content: flex-end; gap: 8px; padding-top: 18px; }
.pwa-sheet .pwa-chrome, .pwa-install-now { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 40px; }
.pwa-install-now { animation: pwa-ready-in .25s ease-out; }
@keyframes pwa-ready-in { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .pwa-install-now { animation: none; } }

/* 푸시 알림 권한 시트 (partials/push-sheet.html · push-permission.js) — 설치 시트의 앱 카드 모양을 빌린다 */
.push-icon { flex: none; display: grid; place-items: center; width: 56px; height: 56px; border-radius: 16px; background: var(--color-primary-light, #eef4ff); color: var(--color-primary); }
.push-icon-off { background: var(--warning-50, #fff7ed); color: var(--warning-600, #c2410c); }
.push-sheet .pwa-step { min-height: 0; padding: 11px 0; line-height: 1.45; }
.push-status { margin: 14px 0 0; color: var(--color-text-secondary); font-size: 13px; font-weight: 600; line-height: 1.5; }
.push-status:empty { display: none; }
.push-sheet[aria-busy="true"] .push-ask, .push-sheet[aria-busy="true"] .push-recheck { cursor: progress; }

.pwa-update-toast .notification-content { display: flex; align-items: center; gap: 12px; }
.pwa-update-toast .pwa-reload { flex: 0 0 auto; }
@media screen and (min-width: 769px) and (pointer: fine), screen and (min-width: 769px) and (pointer: none), screen and (min-width: 769px) and (min-height: 501px), screen and (min-width: 1001px) {
    :is(#pwaInstallSheet, #pushSheet, #attLocSheet):not([hidden]) { display: block; position: fixed; inset: 0; z-index: var(--z-modal); }
    :is(#pwaInstallSheet, #pushSheet, #attLocSheet) .m-sheet-backdrop { position: absolute; inset: 0; background: rgba(15, 23, 42, .5); animation: pwa-fade .18s ease-out; }
    :is(#pwaInstallSheet, #pushSheet, #attLocSheet) .m-sheet-panel { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); width: min(520px, calc(100vw - 32px)); max-height: calc(100vh - 48px);
                                      overflow-y: auto; overscroll-behavior: contain; padding: 24px; border-radius: 18px; background: var(--color-surface, #fff); color: var(--color-text);
                                      box-shadow: 0 24px 60px rgba(15, 23, 42, .3); animation: pwa-pop .2s ease-out; }
    :is(#pwaInstallSheet, #pushSheet, #attLocSheet) .m-sheet-grip { display: none; }
    :is(#pwaInstallSheet, #pushSheet, #attLocSheet) .pwa-x { top: 16px; right: 16px; }
}
@keyframes pwa-fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes pwa-pop { from { opacity: 0; transform: translate(-50%, calc(-50% + 8px)) scale(.98); } to { opacity: 1; transform: translate(-50%, -50%); } }
@media (prefers-reduced-motion: reduce) { :is(#pwaInstallSheet, #pushSheet, #attLocSheet) .m-sheet-panel, :is(#pwaInstallSheet, #pushSheet, #attLocSheet) .m-sheet-backdrop { animation: none; } }
/* 폰 바텀 시트: 손잡이 아래로 머리, 미리보기 줄은 시트 여백(16px)에 맞춘다 */
@media screen and (max-width: 768px), screen and (pointer: coarse) and (max-height: 500px) and (max-width: 1000px) {
    :is(#pwaInstallSheet, #pushSheet, #attLocSheet) .m-sheet-panel { padding-left: 20px; padding-right: 20px; }
    :is(#pwaInstallSheet, #pushSheet, #attLocSheet) .pwa-x { top: 14px; right: 10px; }
    .pwa-app-icon { width: 56px; height: 56px; border-radius: 14px; }
    .pwa-shots { margin-left: -20px; margin-right: -20px; padding-left: 20px; padding-right: 20px; scroll-padding-inline: 20px; }
    .pwa-sheet-actions { position: sticky; bottom: calc(-16px - env(safe-area-inset-bottom, 0px)); margin: 0 -20px calc(-16px - env(safe-area-inset-bottom, 0px)); padding: 12px 20px calc(16px + env(safe-area-inset-bottom, 0px));
                         background: var(--color-surface, #fff); border-top: 1px solid var(--color-border); }
    .pwa-sheet-actions .btn { flex: 1; }
}

/* ── 설치 안내 배너 (2026-09-30, partials/pwa.html pwa-banner · pwa.js syncBanner) ──
   데스크톱은 왼쪽 아래 카드(오른쪽 아래는 알림 토스트 자리), 폰은 탭바 · 주소 줄 위 전체 폭. 떠 있는 요소라 자리를 밀지 않는다. */
.pwa-banner { position: fixed; left: 20px; bottom: 20px; z-index: calc(var(--z-sticky) + 3); display: flex; align-items: center; gap: 12px;
              width: min(440px, calc(100vw - 40px)); box-sizing: border-box; padding: 12px 14px; border: 1px solid var(--color-border);
              border-radius: 14px; background: var(--color-surface, #fff); color: var(--color-text); box-shadow: 0 12px 32px rgba(15, 23, 42, .18); }
.pwa-banner[hidden] { display: none; }
.pwa-banner-icon { flex: none; width: 40px; height: 40px; border-radius: 10px; }
.pwa-banner-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.pwa-banner-title { font-size: 14px; }
.pwa-banner-body { color: var(--color-text-secondary); font-size: 12.5px; line-height: 1.45; }
.pwa-banner-body[hidden] { display: none; }
.pwa-banner-actions { flex: none; display: flex; flex-direction: column; gap: 4px; }
@media screen and (max-width: 768px), screen and (pointer: coarse) and (max-height: 500px) and (max-width: 1000px) {
    .pwa-banner { left: 12px; right: 12px; width: auto; bottom: calc(var(--m-tabbar-h) + 12px); }
    html:has(#appsContainer[data-m-view="app"]) .pwa-banner { display: none; }
}
@media (pointer: coarse) { html.m-typing .pwa-banner { display: none; } }
@media print { .pwa-banner { display: none !important; } }

/* 로그인 화면의 「앱으로 설치하기」 — 설치한 앱에서는 머리의 인라인 스크립트(html.is-standalone)가 첫 페인트 전에 걷는다 */
.login-install { margin-top: 18px; text-align: center; }
.login-install-btn { display: inline-flex; align-items: center; gap: 6px; padding: 6px 10px; border: 0; border-radius: 8px; background: none;
                     color: var(--color-text-secondary); font: inherit; font-size: 13px; cursor: pointer; }
.login-install-btn:hover { background: var(--gray-100, #f3f4f6); color: var(--color-text); }
.login-install-btn:focus-visible { outline: 2px solid var(--color-primary); outline-offset: 2px; }
html.is-standalone .login-install { display: none; }
.login-install-btn[hidden] { display: none; }
