/* [h7] The phone's home screen, made easy to search: a search box at the top, a Recent row, the apps in labelled sections, the dock
   (your most-opened four). phone.js builds it. Loaded last, so it wins over the older home-screen rules (index.html, theme.css, mob-c.css). */

body.phone-on #mwrap .ph-home{display:flex;flex-direction:column}
#mwrap .ph-home .ph-now{margin:0 0 10px}
#mwrap .ph-home .ph-now b{font-size:34px}

/* the search box: stays at the top while the sections scroll under it */
#mwrap .ph-srch{position:sticky;top:-12px;z-index:3;flex:none;display:flex;align-items:center;gap:6px;margin:0 0 12px;padding:0 2px 0 12px;min-height:46px;border-radius:14px;
  background:rgba(20,12,8,.62);border:1px solid rgba(255,255,255,.22);color:#fff;-webkit-backdrop-filter:blur(10px);backdrop-filter:blur(10px);box-shadow:0 4px 14px rgba(0,0,0,.25);cursor:text}
#mwrap .ph-srch:focus-within{border-color:rgba(255,255,255,.7)}
#mwrap .ph-srch .ph-si{display:inline-flex;line-height:0;opacity:.85;flex:none}
#mwrap .ph-srch input{flex:1;min-width:0;height:44px;margin:0;padding:0;background:none;border:0;outline:0;box-shadow:none;color:#fff;font:500 15px var(--body);-webkit-appearance:none;appearance:none}
#mwrap .ph-srch input::placeholder{color:rgba(255,255,255,.62)}
#mwrap .ph-srch input::-webkit-search-cancel-button{display:none}
#mwrap .ph-clr{flex:none;display:inline-flex;align-items:center;justify-content:center;width:44px;height:44px;margin:0;padding:0;border:0;border-radius:12px;background:none;color:#fff;cursor:pointer;touch-action:manipulation}
#mwrap .ph-clr[hidden]{display:none}
#mwrap .ph-clr:hover,#mwrap .ph-clr:active{background:rgba(255,255,255,.14)}

/* sections: a small heading with an icon, then the usual grid of icons */
#mwrap .ph-body{flex:1}
#mwrap .ph-sec{margin:0 0 14px}
#mwrap .ph-sh{display:flex;align-items:center;gap:6px;margin:0 2px 8px;padding:0 0 5px;border-bottom:1px solid rgba(255,255,255,.14);color:rgba(255,255,255,.86);font:700 12.5px/1.1 var(--body);letter-spacing:.05em;text-transform:uppercase}
#mwrap .ph-sh .ph-si{display:inline-flex;line-height:0;opacity:.9}
#mwrap .ph-home .ph-grid{flex:none;gap:12px 4px}
#mwrap .ph-home .ph-app{position:relative;min-height:44px}
#mwrap .ph-home .ph-lb{font-size:12px;line-height:1.2;text-align:center;max-width:100%;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
#mwrap .ph-rec{padding:8px 8px 2px;margin-left:-4px;margin-right:-4px;border-radius:16px;background:rgba(255,255,255,.08)}
#mwrap .ph-rec .ph-sh{border-bottom:0;padding:0}
#mwrap .ph-rec .ph-app:nth-child(n+5){display:none}

/* searching: only the results (the clock, the sections and the dock step aside) */
#mwrap .ph-searching .ph-now,#mwrap .ph-searching .ph-body,#mwrap .ph-searching .ph-dock{display:none}
#mwrap .ph-res:empty{display:none}
#mwrap .ph-none{display:flex;flex-direction:column;align-items:center;gap:6px;padding:22px 8px;text-align:center;color:#fff}
#mwrap .ph-none b{font:700 15px var(--body);overflow-wrap:anywhere}
#mwrap .ph-none span{font-size:13px;opacity:.8}
#mwrap .ph-try{display:flex;flex-wrap:wrap;justify-content:center;gap:8px;margin-top:6px}
#mwrap .ph-tryb{min-height:44px;padding:0 16px;border-radius:22px;border:1px solid rgba(255,255,255,.3);background:rgba(255,255,255,.1);color:#fff;font:600 14px var(--body);cursor:pointer;touch-action:manipulation}

/* the unread count on an icon */
#mwrap .ph-app .ph-badge{position:absolute;top:-4px;right:calc(50% - 34px);min-width:20px;height:20px;padding:0 6px;border-radius:10px;background:#d93025;color:#fff;font:800 12px/20px var(--body,system-ui);font-style:normal;text-align:center;box-shadow:0 0 0 2px rgba(20,12,8,.9);pointer-events:none}

/* the dock stays at the bottom of the screen */
#mwrap .ph-home .ph-dock{position:sticky;bottom:-16px;z-index:3;flex:none;margin-top:4px;background:rgba(40,26,18,.72)}
#mwrap .ph-home .ph-dock .ph-lb{display:block}
/* the desktop phone is drawn at 94% (index.html): words set a little larger so they stay at 12 px or more */
body.phone-on #mwrap .ph-home .ph-lb{font-size:13px}
body.phone-on #mwrap .ph-home .ph-sh{font-size:13px}

/* ---- a phone held sideways: the phone fills the screen, the clock and the search share one row, the sections scroll, Recent replaces the dock ---- */
@media (pointer:coarse) and (orientation:landscape) and (max-height:500px){
  html body.phone-on #mwrap .ph-home{display:grid;grid-template-columns:auto minmax(0,1fr);grid-template-rows:auto minmax(0,1fr);align-content:stretch;gap:0 12px;padding:6px 10px 0;overflow:hidden}
  html body.phone-on #mwrap .ph-home>.ph-now{grid-column:1;grid-row:1;margin:0 0 8px;align-self:center;display:flex;flex-direction:column;align-items:flex-start;gap:0;line-height:1.1}
  html body.phone-on #mwrap .ph-home>.ph-now b{font-size:22px;line-height:1.1}
  html body.phone-on #mwrap .ph-home>.ph-now span{font-size:12px}
  html body.phone-on #mwrap .ph-home>.ph-srch{grid-column:2;grid-row:1;position:relative;top:0;margin:0 0 8px}
  /* only the sections (or the results) scroll, under a fixed top row */
  html body.phone-on #mwrap .ph-home>.ph-res,html body.phone-on #mwrap .ph-home>.ph-body{grid-column:1/-1;grid-row:2;min-height:0;overflow-y:auto;overscroll-behavior:contain;padding-bottom:10px}
  html body.phone-on #mwrap .ph-searching>.ph-srch{grid-column:1/-1}
  html body.phone-on #mwrap .ph-searching>.ph-now{display:none}
  html body.phone-on #mwrap .ph-home .ph-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(66px,1fr));gap:6px 2px}
  html body.phone-on #mwrap .ph-home .ph-dock{display:none}
  html body.phone-on #mwrap .ph-home .ph-lb{font-size:12px}
  html body.phone-on #mwrap .ph-sec{margin:0 0 8px}
  html body.phone-on #mwrap .ph-sh{margin:0 2px 5px}
  html body.phone-on #mwrap .ph-rec{padding:6px 6px 0;margin-left:0;margin-right:0}
  html body.phone-on #mwrap .ph-rec .ph-app:nth-child(n+5){display:flex}
  html body.phone-on #mwrap .ph-app .ph-badge{right:calc(50% - 32px)}
  /* the on-screen keyboard (kbd.js): the phone ends above it, so the results stay in view under the search box */
  html.kb-open body.phone-on #mwrap,html.h5.kb-open body.phone-on #mwrap{bottom:calc(var(--kb, 0px) + 4px)!important;max-height:none}
  html.typing body.phone-on #mwrap .ph-home>.ph-now{display:none}
  html.typing body.phone-on #mwrap .ph-home>.ph-srch{grid-column:1/-1}
}
/* [m3] the dock sits over the bottom of the home screen: an app scrolled or tabbed into view stops above it, not under it (D17) */
#mwrap .card.ph-home{scroll-padding-bottom:104px}
