/* One expandable bottom rail, with the same readable targets in every spoke. */
body,body.today-surface,body.food-hub-surface,body.move-surface,body.sleep-surface,body.money-surface{--category-nav-height:calc(78px + env(safe-area-inset-bottom,0px));--dock-height:var(--category-nav-height);--sound-row-height:0px;--sleep-player-space:var(--sound-row-height)}
body nav#nav.category-navigation{
  height:var(--category-nav-height);
  padding:8px max(24px,calc((100vw - 720px)/2)) calc(8px + env(safe-area-inset-bottom,0px));
  justify-content:flex-start;
  gap:6px;
  overflow-x:auto;
  overflow-y:hidden;
  overscroll-behavior-x:contain;
  touch-action:pan-x pinch-zoom;
  scroll-padding-inline:24px;
  scroll-snap-type:none;
  scrollbar-width:none;
  -webkit-overflow-scrolling:touch;
}
body nav#nav.category-navigation button{
  position:relative;
  flex:0 0 76px;
  min-width:76px;
  max-width:76px;
  min-height:54px;
  padding:6px 8px 9px;
  gap:4px;
  font-size:12px;
  line-height:1.15;
  letter-spacing:0;
  white-space:nowrap;
  touch-action:pan-x pinch-zoom;
}
body nav#nav.category-navigation::-webkit-scrollbar{display:none}
.category-rail-tail{flex:0 0 76px;pointer-events:none}
body nav#nav.category-navigation button svg{width:23px;height:23px;flex:none}
body nav#nav.category-navigation button.active::after{
  content:"";
  position:absolute;
  bottom:3px;
  left:calc(50% - 9px);
  width:18px;
  height:3px;
  border-radius:3px;
  background:var(--orange);
}
body nav#nav.category-navigation button:focus-visible{outline:2px solid var(--ink);outline-offset:-2px}
body nav#nav.category-navigation::before,body nav#nav.category-navigation::after{display:none}
body.sleep-surface nav#nav.category-navigation button:focus-visible{outline-color:var(--paper)}
@media(prefers-reduced-motion:reduce){body nav#nav.category-navigation{scroll-behavior:auto;scroll-snap-type:none}}

/* The center action and edge arrows stay still while the native rail moves. */
body .daily-add.category-log{position:fixed;z-index:54;left:calc(50% - 28px);bottom:calc(11px + env(safe-area-inset-bottom,0px));display:flex!important;flex-direction:column;align-items:center;justify-content:center;gap:0;width:56px;height:56px;min-height:56px;padding:4px;border:1px solid var(--ink);border-radius:18px;background:var(--orange);color:var(--paper);box-shadow:0 0 0 4px var(--paper);font-family:inherit;line-height:1;touch-action:pan-y pinch-zoom;user-select:none}
body .category-log svg{width:26px;height:26px;flex:none}
body .category-log span{font-size:12px;font-weight:700;line-height:1.2}
body .category-log:focus-visible{outline:3px solid var(--ink);outline-offset:3px}
body .category-scroll-arrow{position:fixed;z-index:54;bottom:calc(13px + env(safe-area-inset-bottom,0px));display:grid;place-items:center;width:24px;min-width:24px;height:52px;min-height:52px;padding:0;border:0;border-radius:0;background:var(--paper);color:var(--orange)}
body .category-scroll-arrow[hidden]{display:none}
body #category-prev{left:0}
body #category-next{right:0}
body .category-scroll-arrow svg{width:16px;height:25px;stroke-width:3}
body .category-scroll-arrow:focus-visible{outline:2px solid var(--orange);outline-offset:-3px;border-radius:6px}
body.sleep-surface .category-log{box-shadow:0 0 0 4px var(--ink)}
body.sleep-surface .category-scroll-arrow{background:var(--ink);color:var(--orange)}

/* A quiet position cue follows the actual rail, below its tap targets. */
body .category-scroll-position{position:fixed;z-index:54;left:24px;right:24px;bottom:calc(2px + env(safe-area-inset-bottom,0px));height:3px;border-radius:3px;background:#20201e30;pointer-events:none;overflow:hidden}
body .category-scroll-position[hidden]{display:none}
body .category-scroll-position span{position:absolute;top:0;bottom:0;border-radius:inherit;background:var(--orange)}
body.sleep-surface .category-scroll-position{background:#fff5e640}

/* One persistent category row; page content reserves the running player's actual space. */
body:has(#sound-dock.is-active){--sound-row-height:56px}
body main#app{padding-bottom:24px}
body #toast{bottom:calc(var(--category-nav-height) + var(--sleep-player-space,0px) + 12px)}
.care-tabs{position:static;height:auto;inset:auto;width:auto;padding:0;border:0;z-index:auto;backdrop-filter:none;background:transparent;display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:4px;margin:-8px 0 22px}
.care-tabs button{min-width:0;min-height:44px;padding:10px 4px;background:var(--paper);color:var(--ink);border:1px solid #20201e30;border-radius:24px;font-size:13px;line-height:1.2;font-weight:600;white-space:nowrap}
.care-tabs button:focus-visible{outline:2px solid var(--ink);outline-offset:2px}
body #sound-dock #sleep-player.sleep-mini-player{position:static;transform:none;left:auto;bottom:auto;height:56px;min-height:0;box-sizing:border-box;width:min(720px,100%);margin:0 auto;padding:4px 16px;gap:6px;border:0;border-radius:0;box-shadow:none;background:transparent;color:inherit}
body #sleep-player .sleep-player-title{min-height:44px;justify-content:center;gap:2px}
body #sleep-player .sleep-player-title b{font-size:14px;line-height:1.2}
body #sleep-player .sleep-player-title span{font-size:11px;line-height:1.2}
body #sleep-player .sleep-player-toggle,body #sleep-player .sleep-player-stop{flex:0 0 44px;width:44px;min-width:44px;min-height:44px;height:44px;padding:10px;display:grid;place-items:center}
body #sleep-player .sleep-player-toggle svg{width:20px;height:20px}
@media(max-width:360px){body header{padding-inline:16px}body header .logo{width:140px}}

/* Only page content lives in this frame. Fixed controls are body siblings so
   Safari's momentum scroller cannot clip the navigation below its bounds. */
html,body{height:100%;overflow:hidden}
#page-viewport{position:fixed;top:0;left:0;right:0;height:calc(100dvh - var(--category-nav-height) - var(--sound-row-height));overflow-x:hidden;overflow-y:auto;overscroll-behavior-y:contain;scroll-padding-bottom:16px;-webkit-overflow-scrolling:touch;transition:height 180ms ease}
#sound-dock{position:fixed;left:0;right:0;bottom:var(--category-nav-height);height:var(--sound-row-height);z-index:53;overflow:hidden;background:var(--paper);color:var(--ink);transition:height 180ms ease}
#sound-dock.is-active{box-shadow:0 -1px 0 #20201e30}
body #sound-dock .sleep-player-title,body #sound-dock .sleep-player-stop{color:inherit}
body.sleep-surface #sound-dock{background:var(--ink);color:var(--paper)}
body.sleep-surface #sound-dock.is-active{box-shadow:0 -1px 0 #fff5e640}
body.sleep-surface #sound-dock .sleep-player-toggle{background:var(--paper);color:var(--ink)}
@media(prefers-reduced-motion:reduce){#page-viewport,#sound-dock{transition:none}}
