/* The pocket edition (R15-A): the wall's paper and type on a phone. Every color is a token from tokens.css; the
   phone's own light or dark setting picks the light mode (js/pocket.js sets data-mode). Touch targets are 48px or more. */
:root { --p-gap: 14px; --p-tap: 48px; --p-pad: 18px; }
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-bottom: calc(96px + env(safe-area-inset-bottom)); } /* nothing scrolled to hides under the tab bar */
body {
  margin: 0;
  min-height: 100dvh;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 17px;
  line-height: 1.4;
}
.defs { position: absolute; width: 0; height: 0; }
svg { fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
svg.ink { filter: url(#ink); }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a.p-btn { color: inherit; text-decoration: none; } /* Text it and Email it (stage R2) look like the buttons beside them */
a.p-btn.p-primary { color: var(--accent-ink); }

#pocket { max-width: 520px; margin: 0 auto; padding: 0 var(--p-gap) calc(96px + env(safe-area-inset-bottom)); }

.p-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; padding: calc(18px + env(safe-area-inset-top)) 4px 14px; }
.p-kicker { margin: 0; font-size: 12px; font-weight: 800; letter-spacing: 0.14em; text-transform: uppercase; color: var(--accent); }
.p-title { margin: 2px 0 0; font-family: var(--font-story); font-size: 27px; font-weight: 600; line-height: 1.15; }
.p-who { flex-shrink: 0; padding: 6px 12px; border-radius: 999px; background: var(--accent-soft); color: var(--ink); font-size: 14px; font-weight: 800; }
.p-body { display: grid; gap: var(--p-gap); }
.p-loading, .p-quiet { margin: 0; color: var(--muted); font-size: 15px; }

.p-card { padding: var(--p-pad); border-radius: var(--radius); background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow);
  display: grid; gap: 12px; animation: p-settle 420ms var(--ease-out) backwards; }
.p-card:nth-child(2) { animation-delay: 50ms; } .p-card:nth-child(3) { animation-delay: 100ms; } .p-card:nth-child(4) { animation-delay: 150ms; }
@keyframes p-settle { from { opacity: 0; transform: translateY(10px); } }
.p-card-title { margin: 0; font-size: 20px; font-weight: 800; }

/* Today */
.p-events, .p-kids, .p-notes { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.p-event { display: grid; grid-template-columns: 74px 1fr auto; gap: 0 12px; align-items: center; width: 100%; min-height: var(--p-tap);
  padding: 10px 12px; border: 0; border-radius: var(--radius-sm); text-align: start;
  background: color-mix(in oklab, var(--c) 12%, var(--surface)); border-left: 5px solid var(--c); }
.p-event .p-chevron { grid-row: 1 / span 2; grid-column: 3; }
.p-event-time { grid-row: span 2; font-weight: 800; font-size: 15px; color: color-mix(in oklab, var(--c) 55%, var(--ink)); }
.p-event-title { font-weight: 700; }
.p-event-who { font-size: 14px; color: var(--ink-soft); }
.p-dinner { display: flex; align-items: center; gap: 12px; margin: 0; font-size: 19px; font-weight: 700; }
.p-dinner > span { flex: 1; }
/* A card's part that opens what it summarizes (stage R item 2): a plain button with a chevron at its end */
.p-card-link { width: 100%; min-height: var(--p-tap); padding: 4px 0; border: 0; background: none; text-align: start; }
.p-chevron { width: 18px; height: 18px; flex-shrink: 0; color: var(--muted); }
.p-event:active, .p-card-link:active { transform: scale(0.985); }
.p-event:focus-visible, .p-card-link:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.p-card-more { justify-self: start; }
.p-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

/* The phone's one popup: paper rising from the bottom edge, settling back down as it closes */
.p-sheet { width: min(520px, 100%); max-width: 100%; max-height: 86dvh; margin: auto auto 0; padding: var(--p-pad) var(--p-pad) calc(var(--p-pad) + env(safe-area-inset-bottom));
  border: 1px solid var(--line); border-bottom: 0; border-radius: var(--radius) var(--radius) 0 0; background: var(--surface); color: var(--ink);
  box-shadow: var(--shadow-lift); overflow-y: auto; display: grid; gap: 12px; animation: p-sheet-in 360ms var(--ease-spring); }
.p-sheet::backdrop { background: var(--scrim, rgb(46 43 38 / 0.3)); /* the mode's own scrim: dims by day and by night */ animation: p-fade-in 260ms var(--ease-out); }
.p-sheet.is-closing { animation: p-sheet-out 220ms var(--ease-out) forwards; }
.p-sheet.is-closing::backdrop { animation: p-fade-out 220ms var(--ease-out) forwards; }
@keyframes p-sheet-in { from { transform: translateY(40px); opacity: 0; } }
@keyframes p-sheet-out { to { transform: translateY(40px); opacity: 0; } }
@keyframes p-fade-in { from { opacity: 0; } }
@keyframes p-fade-out { to { opacity: 0; } }
.p-sheet-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.p-sheet-title { margin: 6px 0 0; font-family: var(--font-story); font-size: 24px; font-weight: 600; line-height: 1.2; }
.p-detail { display: grid; grid-template-columns: 92px 1fr; gap: 12px; padding: 8px 0; border-top: 1px solid var(--line); }
.p-detail-label { font-size: 14px; font-weight: 800; color: var(--ink-soft); }
.p-dinners { list-style: none; margin: 0; padding: 0; }
.p-dinners li { display: grid; grid-template-columns: 92px 1fr; gap: 12px; padding: 10px 0; border-top: 1px solid var(--line); }
.p-steps { padding: 12px; border-radius: var(--radius-sm); background: color-mix(in oklab, var(--k) 10%, var(--surface)); }
.p-steps-name { margin: 0 0 6px; font-size: 17px; font-weight: 800; color: color-mix(in oklab, var(--k) 45%, var(--ink)); }
.p-steps ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.p-steps li { display: flex; align-items: center; gap: 10px; }
.p-step-check { display: inline-grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; border: 2px solid var(--k);
  font-size: 14px; font-weight: 900; color: var(--surface); }
.p-steps li.is-done .p-step-check { background: var(--k); }
.p-steps li.is-done > span:nth-child(2) { color: var(--ink-soft); }
@media (prefers-reduced-motion: reduce) { .p-sheet, .p-sheet::backdrop, .p-sheet.is-closing, .p-sheet.is-closing::backdrop { animation: none; } }
.p-dinner svg:not(.p-chevron) { width: 30px; height: 30px; flex-shrink: 0; color: var(--accent); }
.p-kid { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 6px 12px; padding: 10px 12px; border-radius: var(--radius-sm);
  background: color-mix(in oklab, var(--k) 10%, var(--surface)); }
.p-kid.is-done { background: color-mix(in oklab, var(--k) 26%, var(--surface)); }
.p-kid-name { font-weight: 800; color: color-mix(in oklab, var(--k) 45%, var(--ink)); }
.p-kid-count { font-size: 15px; font-weight: 700; color: var(--ink-soft); }
.p-bar { grid-column: 1 / -1; height: 10px; border-radius: 999px; background: color-mix(in oklab, var(--k) 20%, var(--surface)); overflow: hidden; }
.p-bar-fill { display: block; height: 100%; border-radius: 999px; background: var(--k); transition: width 500ms var(--ease-out); }
.p-cheer { grid-column: 1 / -1; justify-self: start; display: inline-flex; align-items: center; gap: 8px; min-height: var(--p-tap); padding: 0 18px;
  border-radius: 999px; border: 2px solid var(--cheer); background: var(--surface); color: color-mix(in oklab, var(--cheer) 70%, var(--ink)); font-weight: 800; }
.p-cheer svg { width: 22px; height: 22px; fill: color-mix(in oklab, var(--cheer) 30%, var(--surface)); }
.p-cheer:active { transform: scale(0.96); }
.p-cheer.is-sent { border-style: dashed; opacity: 0.8; }
.p-cheer.is-sent svg { fill: var(--cheer); animation: p-beat 700ms var(--ease-spring); }
@keyframes p-beat { 40% { transform: scale(1.35); } }

/* Forms */
.p-form { display: grid; gap: 12px; }
.p-field { display: grid; gap: 6px; font-size: 14px; font-weight: 800; color: var(--ink-soft); }
.p-row { display: flex; gap: 12px; }
.p-row > .p-field { flex: 1; }
.p-between { justify-content: space-between; align-items: center; }
.p-input { width: 100%; min-height: var(--p-tap); padding: 10px 14px; border-radius: var(--radius-sm); border: 1px solid var(--line);
  background: var(--surface-sunk); color: var(--ink); font-size: 17px; font-weight: 600; }
.p-input:focus-visible, .p-btn:focus-visible, .p-chip:focus-visible, .p-tab:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.p-code { font-size: 26px; font-weight: 900; letter-spacing: 0.18em; text-align: center; text-transform: uppercase; }
textarea.p-input { resize: none; font-family: var(--font-story); font-style: italic; }
.p-toggle { display: flex; align-items: center; gap: 12px; min-height: var(--p-tap); font-weight: 700; }
.p-check { width: 24px; height: 24px; accent-color: var(--accent); }
.p-seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; padding: 4px; border-radius: 999px; background: var(--surface-sunk); }
.p-seg.p-seg-fit { grid-auto-columns: auto; } /* Add's four choices: each as wide as its words, so all fit a phone on one line (stage R2) */
.p-seg-btn { min-height: 44px; border: 0; border-radius: 999px; background: none; font-weight: 800; color: var(--ink-soft); }
.p-seg-fit .p-seg-btn { padding: 0 10px; white-space: nowrap; }
.p-seg-btn[aria-selected="true"] { background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }
.p-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.p-chip { min-height: 44px; padding: 0 16px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); font-weight: 700; }
.p-chip[aria-pressed="true"], .p-chip[aria-checked="true"] { background: color-mix(in oklab, var(--k, var(--accent)) 22%, var(--surface)); border-color: var(--k, var(--accent)); }
.p-chip:disabled { opacity: 0.4; }
.p-amounts { display: grid; grid-template-columns: repeat(6, 1fr); gap: 6px; }
.p-amount { min-width: 0; padding: 0; font-variant-numeric: tabular-nums; font-weight: 900; }
.p-swatch { width: 44px; height: 44px; border-radius: 999px; border: 3px solid var(--surface); background: var(--c); box-shadow: 0 0 0 1px var(--line); }
.p-swatch[aria-checked="true"] { box-shadow: 0 0 0 3px var(--ink); }
.p-btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: var(--p-tap); padding: 0 20px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--surface); font-weight: 800; }
.p-btn svg { width: 20px; height: 20px; }
.p-btn:active { transform: scale(0.97); }
.p-primary { border-color: transparent; background: var(--accent); color: var(--accent-ink); }
.p-small { min-height: 44px; padding: 0 14px; font-size: 15px; }
/* Add › Invite (stage R2): the invite just made, its link to share or copy, and the ones waiting to be opened */
.p-invite { display: grid; gap: 10px; margin-top: 14px; padding: 14px; border-radius: var(--radius-sm); background: var(--surface-sunk); }
.p-invite p { margin: 0; }
.p-invite-link { font-size: 14px; font-weight: 700; overflow-wrap: anywhere; user-select: all; color: var(--ink); }
.p-invite .p-row { flex-wrap: wrap; }
.p-subhead { margin: 18px 0 6px; font-size: 15px; font-weight: 800; color: var(--ink-soft); }
.p-invites { display: grid; gap: 8px; margin: 0; padding: 0; list-style: none; }
.p-invites li { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.p-invites .p-quiet { display: inline; }

/* Points */
.p-points { border-top: 6px solid var(--k); }
.p-points-head { display: flex; align-items: center; justify-content: space-between; }
.p-points .p-card-title { color: color-mix(in oklab, var(--k) 45%, var(--ink)); }
.p-balance { display: inline-flex; align-items: center; gap: 6px; font-size: 26px; }
.p-balance svg { width: 28px; height: 28px; color: var(--cal-amber); fill: color-mix(in oklab, var(--cal-amber) 40%, var(--surface)); }
.p-shelf { display: grid; gap: 8px; padding-top: 10px; border-top: 1px dashed var(--line); }
.p-reward { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.p-reward-name { display: inline-flex; align-items: center; gap: 8px; font-weight: 700; }
.p-reward-name svg { width: 24px; height: 24px; color: var(--accent); }

/* Notes and postcards: the wall's note face (js/note-face.js), drawn at phone size */
.p-notes { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 16px; --note-size: 112px; --postcard-width: 164px; }
.p-note { display: grid; justify-items: center; gap: 8px; }
.p-note .note-text { font-size: 16px; }

/* The sitter's page (css/care.css draws the cards at phone size by default) */
.care-page { --care-gap: var(--p-gap); --care-pad: var(--p-pad); }
.care-card { animation: p-settle 420ms var(--ease-out) backwards; }

/* Pairing */
.p-pair { display: grid; gap: 16px; justify-items: center; padding: calc(48px + env(safe-area-inset-top)) 8px 0; text-align: center; }
.p-pair .p-title { font-size: 34px; }
.p-pair-art { display: grid; place-items: center; width: 120px; height: 140px; padding: 10px; background: var(--stamp-paper);
  mask: radial-gradient(5px at 7px 7px, #0000 96%, #000) -7px -7px / 14px 14px, linear-gradient(#000 0 0) content-box;
  filter: drop-shadow(0 6px 14px rgb(40 30 20 / 0.2)); transform: rotate(-4deg); }
.p-pair-art svg { width: 64px; height: 64px; color: var(--cheer); fill: color-mix(in oklab, var(--cheer) 25%, var(--stamp-paper)); }
.p-lead { margin: 0; max-width: 34ch; color: var(--ink-soft); }
.p-pair .p-field { width: 100%; max-width: 320px; text-align: left; }
.p-pair .p-btn { width: 100%; max-width: 320px; }
.p-warn { margin: 0; padding: 10px 14px; border-radius: var(--radius-sm); background: color-mix(in oklab, var(--alarm) 12%, var(--surface)); color: var(--ink); font-weight: 700; }

/* The tab bar */
.p-tabs { position: fixed; inset: auto 0 0; z-index: 2; display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; max-width: 520px; margin: 0 auto;
  padding: 6px 10px calc(6px + env(safe-area-inset-bottom)); background: color-mix(in oklab, var(--surface) 92%, transparent);
  backdrop-filter: blur(10px); border-top: 1px solid var(--line); }
.p-tab { display: grid; justify-items: center; gap: 2px; min-height: 58px; padding: 6px 0; border: 0; border-radius: var(--radius-sm); background: none;
  color: var(--muted); font-size: 13px; font-weight: 800; }
.p-tab svg { width: 26px; height: 26px; }
.p-tab[aria-selected="true"] { color: var(--accent); background: var(--accent-soft); }

/* The toast (js/toast.js), above the tab bar */
.toast { position: fixed; left: 50%; bottom: calc(84px + env(safe-area-inset-bottom)); z-index: 3; display: flex; align-items: center; gap: 14px;
  width: max-content; max-width: calc(100vw - 28px); padding: 12px 16px 12px 18px; border-radius: 999px; background: var(--ink); color: var(--bg); font-weight: 700;
  box-shadow: var(--shadow-lift); opacity: 0; transform: translate(-50%, 16px); transition: opacity 260ms var(--ease-out), transform 360ms var(--ease-spring); }
.toast.open { opacity: 1; transform: translate(-50%, 0); }
.toast-action { min-height: 40px; padding: 0 14px; border: 0; border-radius: 999px; background: var(--accent); color: var(--accent-ink); font-weight: 800; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition-duration: 1ms !important; }
}

/* A child's inside weather on a grown-up's phone (R15-D): the same two weeks as the wall's popup (css/inside.css), smaller */
.p-inside { align-self: flex-start; }
.p-points .inside-weeks { --inside-pic: 28px; gap: 4px; }
.p-points .inside-day { min-height: 78px; padding: 6px 2px; border-radius: 10px; gap: 4px; }
.p-points .inside-date { font-size: 11px; }
.p-points .inside-pick .inside-word { font-size: 10px; }
.p-points .inside-pick.is-empty { font-size: 18px; line-height: 28px; }
