/* 말씀 Bible v4.6.0 — iPhone standalone / browser layout correction.
   Keep the v4.5 cinematic visual design; adjust viewport ownership and safe areas only. */
:root{
  --mb-safe-top:env(safe-area-inset-top, 0px);
  --mb-safe-bottom:env(safe-area-inset-bottom, 0px);
}
*,*::before,*::after{box-sizing:border-box}
html,body{
  height:100%; min-height:0; width:100%; max-width:100%;
  overflow:hidden!important;
  overscroll-behavior:none;
}
body{margin:0;position:relative}
#app{
  width:100%; height:var(--mb-app-height,100dvh);
  min-height:0; max-width:100%; overflow:hidden;
}
.app-shell{
  display:flex; flex-direction:column;
  width:100%; max-width:720px;
  min-height:0!important;
  height:100%; max-height:100%;
  margin:0 auto; border-radius:0;
  overflow:hidden!important;
  isolation:isolate;
}
.topbar{
  position:relative!important; top:auto!important;
  flex:0 0 auto;
  height:calc(63px + var(--mb-safe-top))!important;
  min-height:calc(63px + var(--mb-safe-top));
  padding:var(--mb-safe-top) 19px 0!important;
  z-index:30;
}
main#main{
  flex:1 1 0; min-height:0!important;
  width:100%; max-width:100%;
  overflow-y:auto; overflow-x:hidden;
  -webkit-overflow-scrolling:touch;
  overscroll-behavior-y:contain;
  scroll-behavior:auto;
  scroll-padding-top:12px;
  padding-bottom:calc(24px + var(--mb-safe-bottom))!important;
  scrollbar-width:none;
}
main#main::-webkit-scrollbar{display:none}
.bottombar{
  position:relative!important;
  left:auto!important;right:auto!important;bottom:auto!important;
  transform:none!important;
  flex:0 0 auto;
  width:100%!important;max-width:100%!important;
  height:calc(66px + var(--mb-safe-bottom))!important;
  min-height:calc(66px + var(--mb-safe-bottom));
  margin:0; padding:0 0 var(--mb-safe-bottom)!important;
  border-radius:0!important;
  z-index:40;
}
.bottombar .nav-btn{
  min-width:0; min-height:0; height:66px; padding-inline:2px;
  display:flex;flex-direction:column;
  justify-content:center;align-items:center;
  touch-action:manipulation;
}
/* On real iPhones, the top OS inset and the bottom home indicator are reserved.
   Never overlay scripture text with the navbar. */
.v45-cover{max-width:100%}
.v45-tray-label{min-width:0;flex:0 0 60px;overflow:hidden;text-overflow:clip}
.v45-cover-content{min-width:0}
.v45-cover h1{overflow-wrap:anywhere}
.v45-reader .verse-body{min-width:0;overflow-wrap:anywhere}
.v45-reader .chapter-controls{min-width:0}
.v45-reader .chapter-controls button{max-width:100%}
/* Sheets and search must cover the nav and respect the OS insets. */
.sheet-back{z-index:1100!important;max-height:var(--mb-app-height,100dvh)}
.sheet{
  max-height:calc(var(--mb-app-height,100dvh) - var(--mb-safe-top) - 12px)!important;
  padding-bottom:calc(25px + var(--mb-safe-bottom))!important;
  overscroll-behavior-y:contain;
}
.search-dialog{
  z-index:1200!important;
  top:0!important;bottom:auto!important;
  height:var(--mb-app-height,100dvh)!important;
  max-height:var(--mb-app-height,100dvh);
  padding-top:var(--mb-safe-top)!important;
  padding-bottom:var(--mb-safe-bottom)!important;
  border-radius:0!important;
  overscroll-behavior-y:contain;
}
.v4-overlay{
  max-height:var(--mb-app-height,100dvh)!important;
  padding-top:var(--mb-safe-top)!important;
  padding-bottom:var(--mb-safe-bottom)!important;
  overscroll-behavior-y:contain;
}
.place-mask{padding-top:calc(8px + var(--mb-safe-top));padding-bottom:calc(8px + var(--mb-safe-bottom))}
.place-dialog{max-height:calc(var(--mb-app-height,100dvh) - var(--mb-safe-top) - var(--mb-safe-bottom) - 16px)}
#toast{position:fixed;bottom:calc(77px + var(--mb-safe-bottom));z-index:16000}
html.mb-keyboard .bottombar{display:none}
html.mb-keyboard main#main{padding-bottom:14px!important}
html.mb-keyboard .sheet{padding-bottom:16px!important}
html.mb-keyboard .search-dialog{padding-bottom:8px!important}
html.modal-open main#main,body.modal-open main#main{overscroll-behavior:none}
@media (min-width:721px){
  .app-shell{
    height:calc(100% - 32px);
    margin:16px auto;
    border-radius:20px;
    box-shadow:0 20px 80px rgba(6,25,36,.17);
  }
}
/* Short phones should show the chapter and the opening passage without
   forcing a full-height image to take most of the screen. */
@media (max-width:720px) and (max-height:760px){
  .v45-cover{height:clamp(205px,33dvh,245px)!important}
  .v45-cover-content{padding-top:12px;padding-bottom:13px}
  .v45-cover h1{font-size:clamp(28px,7.5vw,38px)}
  .v45-cover-bottom>p{margin:4px 0 8px}
  .v45-cover-kicker{margin-bottom:5px}
  .v45-cinema-action{min-height:55px;padding:5px 10px}
  .v45-action-icon{width:36px;height:36px}
  .v45-cover-caption{margin-bottom:7px}
  .v45-chapter-tray{min-height:59px;padding-top:6px;padding-bottom:6px}
  .v45-reader-toolbar{padding-top:2px;padding-bottom:4px}
  .v45-reading-heading{padding-top:11px;padding-bottom:9px}
}
@media (max-width:720px) and (max-height:740px){
  .v45-cover{height:185px!important}
  .v45-cover-top{font-size:8px;letter-spacing:1.4px}
  .v45-cover-bottom>p{display:none}
  .v45-chapter-tray{min-height:53px}
  .v45-reader-toolbar .reader-audio-fold summary{min-height:32px}
  .v45-reading-heading{padding-top:8px;padding-bottom:7px}
  .v45-reading-index{font-size:37px;min-width:44px}
}
@media (max-width:720px) and (max-height:620px){
  .v45-cover{height:155px!important}
  .v45-cover-top{display:none}
  .v45-cover-kicker{font-size:8px;letter-spacing:1.3px}
  .v45-cover h1{font-size:26px!important}
  .v45-cinema-action{min-height:44px;padding:4px 8px;margin-top:7px}
  .v45-action-icon{width:31px;height:31px}
  .v45-action-copy strong{font-size:11px}
  .v45-action-copy small{font-size:8px}
  .v45-reading-index{font-size:34px;min-width:39px}
  .v45-reading-meta strong{font-size:16px}
  .v45-reader-toolbar .reader-audio-fold summary small{display:none}
  .v45-reader-toolbar .reader-audio-fold summary{min-height:30px}
  .v45-cover-content{padding-top:9px;padding-bottom:10px}
  .v45-cover-bottom>p{display:none}
  .v45-cover h1{font-size:clamp(27px,7vw,34px)}
  .topbar{height:calc(58px + var(--mb-safe-top))!important;min-height:calc(58px + var(--mb-safe-top))}
  .bottombar{height:calc(58px + var(--mb-safe-bottom))!important;min-height:calc(58px + var(--mb-safe-bottom))}
  .bottombar .nav-btn{height:58px}
}
@media (max-width:345px){
  .topbar{padding-left:12px!important;padding-right:12px!important}
  .brand-mini{font-size:20px;gap:7px}
  .header-actions{gap:1px}
  .header-actions .icon-btn{width:35px}
  .v45-cover-content{padding-left:14px;padding-right:14px}
}
