/* ---------- Chế độ app (PWA) ---------- */
:root{--topbar:calc(64px + env(safe-area-inset-top, 0px))}
.topbar{padding-top:env(safe-area-inset-top, 0px)}
html.standalone,html.standalone body{overscroll-behavior:none}
html.standalone .hint{bottom:calc(22px + env(safe-area-inset-bottom, 0px))}
html.standalone .reader-bar{bottom:calc(56px + env(safe-area-inset-bottom, 0px))}
html.standalone .composer{padding-bottom:calc(48px + env(safe-area-inset-bottom, 0px))}

/* Nút cài app */
.install-btn{display:inline-flex;align-items:center;gap:6px;height:36px;padding:0 14px;border-radius:99px;border:1px solid var(--wine);background:var(--wine);color:#fff;font:500 13px var(--ui);white-space:nowrap;transition:background .2s}
.install-btn:hover{background:var(--wine-dark)}
.install-btn[hidden]{display:none}
body.reading .install-btn{display:none}

/* Hướng dẫn cài trên iPhone */
.install-sheet{position:fixed;inset:0;z-index:70;display:flex;align-items:flex-end;justify-content:center;padding:16px 16px calc(16px + env(safe-area-inset-bottom, 0px));background:rgba(40,30,25,.38);animation:fade .25s}
.install-card{width:min(420px,100%);background:var(--paper);border-radius:18px;padding:22px 22px 18px;box-shadow:0 24px 50px rgba(40,25,15,.3);animation:rise .35s ease;text-align:left}
.install-card img{display:block;border-radius:13px;margin-bottom:10px}
.install-title{font:500 22px/1.2 var(--serif);margin:0 0 10px}
.install-card ol{margin:0 0 16px;padding-left:20px;color:var(--ink-soft);font-size:14.5px;line-height:1.6}
.install-card b{color:var(--ink);font-weight:600}
.install-card .btn{width:100%}

@media (max-width:480px){
  .install-btn{width:30px;height:30px;padding:0;justify-content:center;font-size:14px}
  .install-btn .txt{display:none}
}

/* Keep the opened card's action bar in document flow in installed mode. */
html.standalone body.reading-experience .reader-bar{bottom:auto;padding-bottom:calc(22px + env(safe-area-inset-bottom,0px))}
@media(max-width:380px){.topbar{gap:6px;padding-left:10px;padding-right:10px}.toggles{gap:3px}.steps button{padding:2px}.brand{font-size:20px}}
