/* The homepage on phones (2026-11-03, phone nav Phase C; the user's
   reference: a banking app's home). Only html.cz-app (phones ≤700px and the
   iOS app); desktop keeps home-hero.css's poster and the part picker.
   The scene (hub.css .hub-home, fixed at the sheet's data-scene-phone height
   by hub.js): your greeting and the site's line top left, Mali on the right
   with a speech bubble, three labelled sticker bubbles bottom left
   (home-phone.js fills them). The big CHAMIZ word and the floating stickers
   go: the app bar's logo is the brand now. Then the sheet: the search box,
   MaliTools as a 4-across sticker grid, MaliWikis as a row of cards you
   swipe, and the Today card last. Loaded after hub.css and home-hero.css. */

.ph-scene, .ph-sec { display: none; }

/* ---------- the scene ---------- */
html.cz-app:not(.hub-off) .hub-home :is(.hub-word, .hub-f, .hub-go) { display: none; }
html.cz-app:not(.hub-off) .hub-home::after { left: auto; right: -110px; bottom: 30px; margin: 0; width: 340px; height: 340px; }
html.cz-app:not(.hub-off) .hub-home:is(*, .hub-short, .hub-tiny) .hub-mid {
  top: calc(var(--hub-up, 70px) + 4px); bottom: auto; left: 0; right: calc(var(--ph-m) + 30px);
  align-items: flex-start; text-align: left; padding: 0 0 0 16px; }
html.cz-app:not(.hub-off):root:root:root body .hub-home h1.hub-h1 { align-items: flex-start; }
html.cz-app:not(.hub-off) .hub-home:is(*, .hub-short, .hub-tiny) .hub-hi small { display: none; }  /* one greeting line (hub.js) */
html.cz-app:not(.hub-off) .hub-home:is(*, .hub-short, .hub-tiny) .hub-hi b {
  display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 1; overflow: hidden; font-size: 22px; line-height: 1.35; }
html.cz-app:not(.hub-off) .hub-home:is(*, .hub-short, .hub-tiny) .hub-tag {
  display: block; max-width: none; margin-top: 4px; text-wrap: balance; font-size: 13.5px; line-height: 1.4; }

/* Mali's width: her column on the right, which her bubble shares (2026-11-08) */
.hub-home { --ph-m: min(124px, 32vw); }
/* sparkles: two, beside Mali, never on the words (one used to sit on "เกม") */
html.cz-app:not(.hub-off) .hub-home .hub-tw:nth-of-type(n+3) { display: none; }
html.cz-app:not(.hub-off) .hub-home .hub-tw:nth-of-type(1) { left: auto; top: auto; right: calc(var(--ph-m) - 2px); bottom: 64px; }
html.cz-app:not(.hub-off) .hub-home .hub-tw:nth-of-type(2) { left: auto; top: auto; right: 6px; bottom: 112px; }

html.cz-app:not(.hub-off) .hub-home .ph-scene { display: block; position: absolute; inset: var(--hub-up, 70px) 0 0; z-index: 1; pointer-events: none; }
.ph-scene > * { pointer-events: auto; }

/* Mali, standing on the wave */
.ph-mali { position: absolute; right: 4px; bottom: 24px; width: var(--ph-m); height: auto; aspect-ratio: 1;
  filter: drop-shadow(0 8px 0 rgba(0, 0, 0, .18)); transform-origin: 50% 90%;
  animation: phIn .42s cubic-bezier(.2, 1.3, .4, 1) .1s both, phSway 5.4s ease-in-out .6s infinite; }
@keyframes phIn { from { opacity: 0; transform: translateY(18px) scale(.85); } }
@keyframes phSway { 0%, 100% { transform: rotate(-2deg); } 50% { transform: rotate(2deg); } }

/* her speech bubble: one thing that matters now, with a ›. It sits on her
   head inside her column, so it can't reach the greeting (2026-11-08) */
.ph-say { position: absolute; top: auto; bottom: calc(24px + var(--ph-m) - 14px); right: 4px; z-index: 1; display: flex; align-items: center; gap: 6px; box-sizing: border-box;
  width: calc(var(--ph-m) + 22px); min-height: 46px; padding: 6px 6px 6px 10px; border-radius: 16px;
  background: #f3eee3; color: #111111; text-decoration: none; border: 2px solid #111111;
  box-shadow: 0 3px 0 var(--ink-sh, #111111); -webkit-tap-highlight-color: transparent;
  animation: phIn .4s cubic-bezier(.2, 1.3, .4, 1) .25s both; transition: opacity .2s; }
.ph-say::after { /* the tail, down towards Mali */
  content: ""; position: absolute; right: calc(var(--ph-m) / 2 - 2px); bottom: -8px; width: 12px; height: 12px; background: #f3eee3;
  border: solid #111111; border-width: 0 2px 2px 0; transform: rotate(45deg); border-radius: 0 0 3px 0; }
.ph-say > span { display: grid; min-width: 0; }
.ph-say b { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; font-size: 13px; font-weight: 800; line-height: 1.3; }
.ph-say small { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; font-size: 11px; font-weight: 600; line-height: 1.3; color: #7a5a48; }
.ph-say i { flex: none; display: grid; place-items: center; width: 24px; height: 24px; border-radius: 50%;
  background: #ff4b2b; color: #fff; font-style: normal; font-weight: 800; font-size: 17px; line-height: 1; padding-bottom: 2px; box-sizing: border-box; }
.ph-say.ph-swap { opacity: 0; }
.ph-say:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--ink-sh, #111111); }

/* three sticker bubbles with a label each */
.ph-bubs { position: absolute; left: 10px; bottom: 26px; right: calc(var(--ph-m) + 30px); display: flex; gap: 8px; }
.ph-bub { flex: 1 1 0; min-width: 0; max-width: 78px; display: flex; flex-direction: column; align-items: center; gap: 4px;
  color: #f3eee3; text-decoration: none; -webkit-tap-highlight-color: transparent;
  animation: phIn .4s cubic-bezier(.2, 1.3, .4, 1) .2s both; }
.ph-bub:nth-child(2) { animation-delay: .28s; }
.ph-bub:nth-child(3) { animation-delay: .36s; }
.ph-bub-ic { position: relative; display: grid; place-items: center; width: 54px; height: 54px; border-radius: 50%;
  background: #f3eee3; border: 2.5px solid #111111; box-shadow: 0 4px 0 var(--ink-sh, #111111);
  animation: phBob 5s ease-in-out var(--dl, 0s) infinite; }
.ph-bub-ic img { width: 34px; height: 34px; }
.ph-bub-t { white-space: nowrap; padding: 2px 7px; border-radius: 999px;
  background: rgba(22, 13, 9, .55); font-size: 11.5px; font-weight: 700; line-height: 1.35; }
.ph-bub:active .ph-bub-ic { transform: translateY(2px) scale(.96); }
@keyframes phBob { 0%, 100% { transform: translate3d(0, 0, 0); } 50% { transform: translate3d(0, -5px, 0); } }
.hub-idle :is(.ph-mali, .ph-bub-ic) { animation-play-state: paused; }

/* ---------- the sheet ---------- */
html.cz-app:not(.hub-off) .hub-home-sheet .hub-pick { display: none; }
html.cz-app:not(.hub-off) body .hub-home-sheet { gap: 14px; padding-bottom: 8px; }
html.cz-app:not(.hub-off) .hub-home-sheet .ph-sec { display: block; flex: none; }  /* never squeezed by the sheet's flex column */
.ph-hrow { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; margin: 0 2px 10px; }
html:root:root body .ph-sec .ph-h { margin: 0 2px 10px; padding: 0; font: 700 18px/1.2 var(--sp-display, "Chakra Petch", system-ui, sans-serif);
  letter-spacing: normal; text-transform: none; color: var(--text); }
html:root:root body .ph-hrow .ph-h { margin: 0; }
.ph-all { display: inline-flex; align-items: center; gap: 4px; font-size: 13.5px; font-weight: 700; color: var(--accent, #ff4b2b); text-decoration: none; }
.ph-all i { font-style: normal; font-size: 17px; line-height: 1; }

/* MaliTools: big stickers, four across, a label under each */
/* home.css's .hm section { padding: 0 } used to win and the last row sat on the edge */
html .hm section.ph-tools { padding: 16px 10px 18px; border-radius: 26px; border: 1px solid var(--line, rgba(127, 127, 127, .2)); background: var(--surface); }
.ph-tools .ph-h { margin-left: 8px !important; }
.ph-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 18px 4px; }
.ph-t { display: flex; flex-direction: column; align-items: center; gap: 6px; min-width: 0; color: var(--text); text-decoration: none;
  -webkit-tap-highlight-color: transparent; }
.ph-ic { position: relative; display: grid; place-items: center; width: 58px; height: 58px; border-radius: 20px;
  background: var(--surface-2, rgba(127, 127, 127, .1)); transition: transform .15s; }
.ph-ic img { width: 40px; height: 40px; }
.ph-t > span:last-child { max-width: 100%; font-size: 12.5px; font-weight: 700; line-height: 1.25; text-align: center; overflow-wrap: anywhere; }
.ph-t:active .ph-ic { transform: scale(.94); }
.ph-new { position: absolute; top: -5px; right: -10px; padding: 1px 6px; border-radius: 999px; background: #ff4b2b; color: #fff;
  font-size: 10px; font-weight: 800; font-style: normal; line-height: 1.5; box-shadow: 0 0 0 2px var(--surface); }

/* the five MaliTools parts (2026-11-14): one even strip over the tool grid, all five in view,
   a small sticker over the name (pills that swiped hid Health off the edge at 390) */
.ph-cats { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 2px; margin: 0 0 16px; padding: 4px; border-radius: 20px;
  background: var(--surface-2, rgba(127, 127, 127, .08)); }
.ph-cat { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; min-width: 0; min-height: 60px; box-sizing: border-box;
  padding: 6px 2px; border-radius: 16px; color: var(--text); text-decoration: none; font-size: 12px; font-weight: 800; line-height: 1.2;
  -webkit-tap-highlight-color: transparent; transition: transform .15s, background .15s; }
.ph-cat img { width: 30px; height: 30px; }
.ph-cat span { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ph-cat:active { transform: scale(.95); background: var(--surface); }
@media (max-width: 374px) { .ph-cats { gap: 0; padding: 3px; } .ph-cat { padding: 6px 0; font-size: 11px; letter-spacing: -.01em; } }
/* the parts are tabs since phase 31 (2026-11-14): the picked one is a Rocket Orange cell with ink words */
.ph-grid[hidden], .ph-all[hidden] { display: none; }
.ph-cat[aria-selected="true"] { background: #ff4b2b; color: #111; box-shadow: 0 2px 0 var(--ink-sh, var(--ink)); }
.ph-cat:focus-visible { outline: 2.5px solid var(--text, #111); outline-offset: 1px; }
.ph-tools { scroll-margin-top: calc(env(safe-area-inset-top, 0px) + 72px); }
html.cz-app[data-theme="dark"] .ph-cats { background: rgba(243, 238, 227, .07); }

/* MaliWikis: a row of cards that swipes sideways */
.ph-row { display: flex; gap: 10px; margin: 0 -16px; padding: 0 16px 4px; overflow-x: auto; scroll-snap-type: x mandatory; scroll-padding: 0 16px;
  scrollbar-width: none; -webkit-overflow-scrolling: touch; }
.ph-row::-webkit-scrollbar { display: none; }
.ph-c { flex: 0 0 148px; scroll-snap-align: start; display: flex; flex-direction: column; gap: 4px; box-sizing: border-box; min-height: 128px;
  padding: 12px 12px 12px; border-radius: 20px; border: 1px solid var(--line, rgba(127, 127, 127, .2)); background: var(--surface);
  color: var(--text); text-decoration: none; -webkit-tap-highlight-color: transparent; }
.ph-c img { width: 38px; height: 38px; margin-bottom: 4px; }
.ph-c b { font-size: 14.5px; font-weight: 800; line-height: 1.25; }
.ph-c small { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; font-size: 12px; line-height: 1.4; color: var(--muted); }
.ph-c:active { transform: scale(.98); }

/* the dark theme: a touch lighter tiles on the dark sheet */
html.cz-app[data-theme="dark"] .ph-ic { background: rgba(243, 238, 227, .07); }

@media (max-width: 359px) {
  .ph-bub-ic { width: 48px; height: 48px; }
  .ph-bub-ic img { width: 30px; height: 30px; }
  .ph-bub-t { padding: 2px 5px; font-size: 10.5px; }
  .ph-say b { font-size: 12.5px; }
}
@media (prefers-reduced-motion: reduce) {
  .ph-mali, .ph-say, .ph-bub, .ph-bub-ic { animation: none !important; }
}
