/* Kynsays mobile shell: loaded last on every page (pwa_head.js), so equal-specificity rules here win.
   1. Safe areas (notch, rounded corners, home indicator) with viewport-fit=cover.
   2. No rubber-band bounce or pull-to-refresh when running as an installed app.
   3. Tap targets at least 44 px on touch screens.
   4. The install hint (pwa.js). */

/* ---------- 1. safe areas ----------
   The status bar style is "black" (opaque), so the top inset is 0 in the installed app; the top padding
   only matters if that ever changes. Left/right insets apply in landscape on notched iPhones.
   Scrolling pages already end with more bottom padding (48 px or more) than the home indicator needs (34 px). */
html{padding-left:env(safe-area-inset-left,0px);padding-right:env(safe-area-inset-right,0px);}
.ws-top,.k-top{padding-top:env(safe-area-inset-top,0px);}
.wizard-foot .wiz-main-inner{padding-bottom:calc(16px + env(safe-area-inset-bottom,0px));}
#adminFab,#savedViewsFab{bottom:calc(22px + env(safe-area-inset-bottom,0px));}
.toast{bottom:calc(24px + env(safe-area-inset-bottom,0px));}
.kyn-ls-fab{bottom:calc(24px + env(safe-area-inset-bottom,0px));}
.kyn-ls-signedout{bottom:calc(20px + env(safe-area-inset-bottom,0px));}
body.kyn-listening .kyn-ls-run{bottom:calc(12px + env(safe-area-inset-bottom,0px));}
@media (min-width:761px){
  :is(body.kyn-listening,body.kyn-research) .kyn-start-bar{bottom:calc(16px + env(safe-area-inset-bottom,0px));}
}

/* ---------- 2. installed app: no bounce, no pull-to-refresh ---------- */
@media (display-mode: standalone), (display-mode: fullscreen){
  html,body{overscroll-behavior:none;}
  body{-webkit-tap-highlight-color:transparent;}
}

/* ---------- 3. tap targets on touch screens ---------- */
@media (pointer: coarse){
  :root{--kyn-control-h:44px;--kyn-control-h-sm:44px;}
  .ws-nav a,.ws-btn,.ws-btn.sm,.ws-brand,.k-btn,.kyn-logo,.brand,.kyn-ls-navlink,.kyn-signout{min-height:44px;}
  .ws-nav a{height:44px;}
  .ws-theme{width:44px;height:44px;}
  .k-btn{display:inline-flex;align-items:center;justify-content:center;}
  .k-link-more{display:inline-flex;align-items:center;min-height:44px;}
  .wizard-overlay .close-x{width:44px;height:44px;}
  /* App sidebar drawer: these carry more specific rules in the app file and listening.css. */
  #sidebar .kyn-logo{min-height:44px;}
  #sidebarFooter .kyn-signout{height:44px;}
  :is(body.kyn-listening, body.mode-performance) .kyn-ls-nav .kyn-ls-navlink{min-height:44px;}
  body.kyn-listening .kyn-ls-run,.kyn-ls-signedout .kyn-ls-run{min-height:44px;height:44px;}
  :is(body.kyn-listening,body.kyn-research) .kyn-start-bar .kyn-ls-run{min-height:44px;height:44px !important;}
  input:not([type=checkbox]):not([type=radio]):not([type=range]):not([type=hidden]):not([type=file]),select{min-height:44px;}
}

/* ---------- 4. install hint ---------- */
.kyn-install{position:fixed;z-index:5000;left:max(12px,env(safe-area-inset-left,0px));right:max(12px,env(safe-area-inset-right,0px));bottom:calc(12px + env(safe-area-inset-bottom,0px));
  max-width:480px;margin:0 auto;box-sizing:border-box;display:flex;align-items:center;gap:12px;padding:12px 8px 12px 14px;
  background:#0F1629;color:#fff;border:1px solid rgb(255 255 255 / .12);border-radius:16px;box-shadow:0 12px 32px rgb(0 0 0 / .35);
  font:14px/1.4 Inter,system-ui,-apple-system,"Segoe UI",Roboto,sans-serif;letter-spacing:0;animation:kyn-install-in .25s ease-out;}
.kyn-install img{width:40px;height:40px;border-radius:10px;flex:0 0 auto;}
.kyn-install p{margin:0;flex:1 1 auto;min-width:0;display:flex;flex-direction:column;gap:2px;}
.kyn-install p b{font-weight:700;}
.kyn-install p span{color:#B4BCD0;}
.kyn-install p span b{color:#fff;font-weight:600;}
.kyn-install-share{width:16px;height:16px;vertical-align:-3px;color:#5C8DFF;}
.kyn-install button{flex:0 0 auto;width:auto;height:auto;min-width:44px;min-height:44px;border-radius:12px;font:inherit;cursor:pointer;box-shadow:none;}
.kyn-install p span{display:block;}
.kyn-install-go{padding:0 16px;border:0;background:#2F6BFF;color:#fff;font-weight:600 !important;}
.kyn-install-x,.kyn-install-x:hover,.kyn-install-x:active{display:inline-flex;align-items:center;justify-content:center;padding:0;border:0;background:transparent;color:#B4BCD0;}
.kyn-install-x svg{width:20px;height:20px;}
.kyn-install button:focus-visible{outline:3px solid #00D1D1;outline-offset:2px;}
@keyframes kyn-install-in{from{opacity:0;transform:translateY(12px);}to{opacity:1;transform:none;}}
@media (prefers-reduced-motion: reduce){.kyn-install{animation:none;}}
@media print{.kyn-install{display:none !important;}}
