/* The shell: four pages side by side (swipe between them), page dots, the gear, and the You sheet.
   Each page scrolls on its own: the scene fills the first screen, the details sit below it. */
html, body { height: 100%; overflow: hidden; }
body.imp-root { margin: 0; background: var(--imp-bg); background-image: none; overscroll-behavior: none; }

.pager { position: fixed; inset: 0; display: flex; overflow-x: auto; overflow-y: hidden; scroll-snap-type: x mandatory; scrollbar-width: none; overscroll-behavior: contain; }
.pager::-webkit-scrollbar { display: none; }
.pager.is-locked { overflow-x: hidden; }
.pg { flex: 0 0 100%; width: 100%; height: 100%; overflow-x: hidden; overflow-y: auto; scroll-snap-align: start; scroll-snap-stop: always; overscroll-behavior-y: contain; -webkit-overflow-scrolling: touch; scrollbar-width: none; }
.pg::-webkit-scrollbar { display: none; }
.pg-root { min-height: 100%; }
.pg .screen { display: block; }

/* What sits under each scene: the details, on that page's own surface */
.pg-details { display: grid; gap: var(--imp-gap); max-width: 520px; margin: 0 auto; padding: 22px var(--imp-gutter) calc(env(safe-area-inset-bottom) + 48px); }
.food-sub .pg-details, .money-sub .pg-details { padding-top: calc(env(safe-area-inset-top) + 10px); }

/* Page dots: top centre; the open page shows its name */
.dots { position: fixed; z-index: 40; top: calc(env(safe-area-inset-top) + 8px); left: 50%; transform: translateX(-50%); display: flex; align-items: center; gap: 2px; padding: 3px;
  border-radius: 99px; background: rgba(10, 20, 15, .55); border: 1px solid rgba(242, 236, 220, .1); backdrop-filter: blur(14px) saturate(1.4); -webkit-backdrop-filter: blur(14px) saturate(1.4);
  transition: opacity .2s, transform .25s var(--imp-ease); }
.dot { height: 28px; min-width: 22px; display: grid; place-items: center; border-radius: 99px; padding: 0 2px; transition: background .25s, padding .25s var(--imp-ease); }
.dot::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: rgba(242, 236, 220, .45); grid-area: 1 / 1; transition: opacity .2s; }
.dot span { grid-area: 1 / 1; font: 800 12px var(--imp-font-head); letter-spacing: .04em; color: var(--imp-on-accent); max-width: 0; overflow: hidden; white-space: nowrap; opacity: 0; transition: max-width .3s var(--imp-ease), opacity .2s; }
.dot.is-on { background: var(--imp-accent); padding: 0 11px; }
.dot.is-on::before { opacity: 0; }
.dot.is-on span { max-width: 80px; opacity: 1; }

/* Gear: You (profile + backups) */
.gear { position: fixed; z-index: 40; top: calc(env(safe-area-inset-top) + 6px); right: 12px; width: 38px; height: 38px; display: grid; place-items: center; border-radius: 50%;
  color: var(--imp-text); background: rgba(10, 20, 15, .55); border: 1px solid rgba(242, 236, 220, .1); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); transition: transform .3s var(--imp-ease), opacity .2s; }
.gear .imp-icon { width: 19px; height: 19px; }
.gear:active { transform: rotate(60deg) scale(.92); }

/* A sub-page is open (a Food form, Money's payday): no swiping, no dots */
body.in-sub .dots, body.in-sub .gear { opacity: 0; pointer-events: none; transform: translate(-50%, -12px); }
body.in-sub .gear { transform: translateY(-12px); }

/* You */
.ov { position: fixed; inset: 0; z-index: 60; display: flex; flex-direction: column; background: var(--imp-bg); transform: translateY(100%); transition: transform .26s var(--imp-ease); }
.ov.is-open { transform: none; }
.ov__head { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; padding: calc(env(safe-area-inset-top) + 8px) var(--imp-gutter) 8px; border-bottom: 1px solid var(--imp-divider); }
.ov__back { justify-self: start; display: inline-flex; align-items: center; font: 700 16px var(--imp-font-head); color: var(--imp-accent); padding: 8px 8px 8px 0; }
.ov__back .imp-icon { width: 22px; height: 22px; }
.ov__title { font: 700 20px var(--imp-font-display); }
.ov__body { flex: 1; overflow-y: auto; overscroll-behavior: contain; }
.ov__body .screen { display: grid; gap: var(--imp-gap); max-width: 520px; margin: 0 auto; padding: 16px var(--imp-gutter) calc(env(safe-area-inset-bottom) + 40px); }

/* Things that swipe sideways themselves keep the pager still */
[data-book], .wk { touch-action: pan-y; }

@media (prefers-reduced-motion: reduce) { .ov, .dot, .dot span, .dots { transition: none; } }
