/* Pengyu: one stylesheet, no build step. Three materials only: paper (the ground, with faint grain and
   hand-drawn ink), glossy plastic (Pengu and the train's paint, drawn in js/pengyu/art.js) and liquid glass
   (only on things you can press). Light only, one column, mobile first.
   Sections: 1. Fonts  2. Tokens  3. Base and type  4. Glass  5. Components  6. Shell  7. Today
   8. Sheets  9. Plan  10. Pengu tab  11. History  12. 404 page  13. Motion, transparency and print
   Every colour is a token in section 2; contrast notes are measured against the surface named. */

/* ---------- 1. Fonts (self-hosted Rubik, OFL; one variable file covers every weight) ---------- */
@font-face {
  font-family: "Rubik";
  src: url("fonts/rubik-latin-wght-normal.woff2") format("woff2");
  font-weight: 300 900;
  font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* ---------- 2. Tokens (the locked palette) ---------- */
:root {
  color-scheme: light;
  --paper: #FAF6F0;         /* the ground */
  --paper-2: #F3ECE4;       /* soft panels */
  --card: #FFFFFF;          /* sheets */
  --ink: #2B2628;           /* charcoal text: 13.8:1 on paper */
  --ink-2: #5E5558;         /* secondary text: 6.7:1 on paper */
  --line: #E6DCD3;
  --line-strong: #9A8F88;   /* rings that carry meaning */
  --stage: #141213;         /* the one dark card, lifted to #2B2829 */
  --stage-lift: #2B2829;
  --on-stage: #F7F2EE;
  --on-stage-2: #D9D2CE;    /* 12.5:1 on the stage */
  --coral: #FF6B4A;         /* the accent fill; charcoal text on it is 5.3:1, never white */
  --coral-strong: #E5532F;  /* marks behind white icons: 3.7:1 */
  --coral-ink: #C2391F;     /* coral text on paper: 5.0:1 */
  --coral-on-stage: #FF9673;/* coral text on the stage: 8.7:1 */
  --coral-tint: #FFE3DA;
  --splash: #F2541B;        /* white wordmark only, large text */
  --sun: #FFCE3A;           /* charcoal on it is 10:1 */
  --sun-2: #FFE07A;
  --sun-3: #FF9A52;
  --pengu-hi: #FDE6F3;
  --pengu: #F7BFDF;
  --pengu-shade: #E99BCB;
  --pengu-edge: #D9779F;
  --base: #8A4E22;
  --base-hi: #B8763A;
  --base-lo: #5E3414;
  --navy-1: #4A5876;
  --navy-2: #2F3A52;
  --navy-3: #1D2537;
  --brass: #E9A825;
  --danger: #B42318;        /* only on the last Reset step; white on it is 6.6:1 */
  --font: "Rubik", ui-rounded, "SF Pro Rounded", system-ui, sans-serif;
  --s1: 4px; --s2: 8px; --s3: 12px; --s4: 16px; --s5: 24px; --s6: 32px; --s7: 48px;
  --gutter: 20px;
  --r-card: 28px;
  --r-pill: 999px;
  --tap: 44px;
  --shadow: 0 1px 2px rgba(43, 38, 40, 0.06), 0 12px 32px -16px rgba(43, 38, 40, 0.28);
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --tabbar-h: 4rem;         /* 64px; grows with larger text, so the page still clears the bar */
  /* Paper grain: tiled SVG noise at about 3.5% (the CSP allows data: images). */
  --grain: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.8' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .17 0 0 0 0 .15 0 0 0 0 .16 0 0 0 1 0'/%3E%3C/filter%3E%3Crect width='180' height='180' filter='url(%23n)' opacity='.06'/%3E%3C/svg%3E");
}

/* ---------- 3. Base and type ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
/* Keyboard focus never hides behind the floating tab bar: a focused control scrolls into view above it. */
html { scroll-padding-bottom: calc(var(--tabbar-h) + 32px + env(safe-area-inset-bottom, 0px)); }
body {
  margin: 0; min-height: 100vh; overflow-x: clip;
  background: var(--paper) var(--grain); color: var(--ink);
  font-family: var(--font); font-size: 1rem; line-height: 1.5; font-weight: 400;
  -webkit-font-smoothing: antialiased; -webkit-tap-highlight-color: transparent;
}
@supports not (overflow-x: clip) { body { overflow-x: hidden; } }
img, svg { display: block; max-width: 100%; }
button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
h1, h2, h3, p, ul, ol, figure { margin: 0; }
:where(ul, ol)[class] { padding: 0; list-style: none; }
a { color: var(--coral-ink); text-underline-offset: 3px; }
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid var(--coral-ink); outline-offset: 3px; }
.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.sr-only { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.skip { position: absolute; left: var(--gutter); top: -80px; z-index: 100; padding: 10px 16px; border-radius: 14px; background: var(--ink); color: #FFFFFF; font-weight: 600; text-decoration: none; }
.skip:focus { top: var(--gutter); }
html:not(.js) .js-only { display: none !important; }
.js .nojs-only { display: none !important; }
.small { font-size: 0.8125rem; line-height: 1.45; }
.muted { color: var(--ink-2); }
.eyebrow, .stat-label { font-size: 0.8125rem; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink-2); }
.eyebrow { color: var(--coral-ink); }
.num { font-variant-numeric: tabular-nums; }
/* Hand-drawn line icons: round caps, a pencil-weight stroke. */
.icon { width: 20px; height: 20px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
/* The PENGYU wordmark: Rubik at its heaviest, leaning forward. */
.py-wordmark { font-size: clamp(3.4rem, 17vw, 5.4rem); font-weight: 900; letter-spacing: -0.03em; line-height: 1; text-transform: uppercase; color: #FFFFFF; transform: skewX(-8deg); }
.py-wordmark.is-ink { color: var(--ink); font-size: 2.5rem; }

/* ---------- 4. Liquid glass: only on things you can press ---------- */
.glass, .glass-coral, .glass-pink { position: relative; isolation: isolate; overflow: hidden; }
.glass {
  background: rgba(255, 255, 255, 0.55);
  -webkit-backdrop-filter: blur(18px) saturate(1.4); backdrop-filter: blur(18px) saturate(1.4);
  border: 1px solid rgba(255, 255, 255, 0.7);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.9), inset 0 -10px 18px rgba(43, 38, 40, 0.04), 0 10px 28px -14px rgba(43, 38, 40, 0.3);
}
.glass-coral {
  background: linear-gradient(180deg, #FF8768 0%, var(--coral) 52%, #F45E3D 100%);
  border: 1px solid rgba(255, 255, 255, 0.45);
  color: var(--ink);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.6), inset 0 -10px 18px rgba(194, 57, 31, 0.2), 0 14px 34px -10px rgba(255, 107, 74, 0.55);
}
.glass-pink {
  background: radial-gradient(circle at 34% 26%, var(--pengu-hi) 0%, var(--pengu) 52%, var(--pengu-shade) 100%);
  border: 1px solid rgba(255, 255, 255, 0.7);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.9), inset 0 -8px 14px rgba(217, 119, 159, 0.25), 0 8px 22px -10px rgba(217, 119, 159, 0.6);
}
/* The specular highlight: a soft, hand-shaped white across the top third, a little off-centre. */
.glass::before, .glass-coral::before, .glass-pink::before {
  content: ""; position: absolute; z-index: -1; left: 8%; right: 15%; top: 4%; height: 36%;
  border-radius: 46% 54% 38% 62% / 72% 66% 34% 28%;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.95), rgba(255, 255, 255, 0));
  opacity: 0.35; pointer-events: none;
  transition: transform 260ms var(--spring);
}
.glass-coral::before { opacity: 0.45; }
/* Pressed: squash to 97% in 120ms, highlight 2px lower; spring back out in about 260ms. */
button.glass, button.glass-coral, button.glass-pink { transition: transform 260ms var(--spring); }
button.glass:active:not([aria-disabled="true"]), button.glass-coral:active:not([aria-disabled="true"]), button.glass-pink:active { transform: scale(0.97); transition: transform 120ms var(--ease-out); }
button:active.glass::before, button:active.glass-coral::before, button:active.glass-pink::before { transform: translateY(2px); transition: transform 120ms var(--ease-out); }

/* ---------- 5. Components ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 48px; padding: 0 24px; border: 0; border-radius: var(--r-pill);
  font-weight: 600; line-height: 1.2; text-decoration: none; text-align: center;
}
.btn:disabled, .btn[aria-disabled="true"] { opacity: 0.45; cursor: not-allowed; }
.btn-primary { background: linear-gradient(180deg, #FF8768 0%, var(--coral) 52%, #F45E3D 100%); color: var(--ink); box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.6), 0 10px 26px -12px rgba(255, 107, 74, 0.6); }
.btn-secondary { background: var(--card); color: var(--ink); box-shadow: inset 0 0 0 1.5px var(--ink); }
.btn-ghost { background: transparent; color: var(--ink); text-decoration: underline; text-underline-offset: 3px; }
.btn-danger { background: var(--danger); color: #FFFFFF; }
.btn-sm { min-height: var(--tap); padding: 0 18px; font-size: 0.9375rem; }
.btn-block { width: 100%; }
.btn .icon { width: 18px; height: 18px; }
.link { padding: 0; border: 0; background: none; color: var(--ink); font: inherit; font-weight: 600; text-decoration: underline; text-decoration-thickness: 1.5px; text-underline-offset: 3px; }
.link:hover { color: var(--coral-ink); }
.chip {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: var(--tap); padding: 6px 16px; border-radius: 16px; font-weight: 600; color: var(--ink);
  background: rgba(255, 255, 255, 0.6); border: 1.5px solid var(--line);
}
.chip[aria-pressed="true"] { background: var(--coral-tint); border-color: var(--coral-strong); }
.chip:disabled { opacity: 0.4; cursor: not-allowed; }
.chip > span { display: grid; justify-items: center; line-height: 1.2; }
.chip small { font-size: 0.75rem; font-weight: 400; color: var(--ink-2); }
.field { display: grid; gap: 6px; }
.field label { font-size: 0.8125rem; font-weight: 600; }
.input { width: 100%; min-height: var(--tap); padding: 0 14px; border: 1.5px solid var(--line-strong); border-radius: 14px; background: var(--card); }
.banner { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 12px; align-items: start; padding: 14px 16px; border-radius: 20px; background: var(--coral-tint); color: var(--ink); }
.banner-icon { display: grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; background: var(--coral-strong); color: #FFFFFF; }
.banner-icon .icon { width: 16px; height: 16px; }
.bump { animation: py-bump 460ms var(--spring); }
@keyframes py-bump { 0% { transform: scale(1); } 40% { transform: scale(1.16); } 100% { transform: scale(1); } }
/* Toasts: small notes on paper glass, at the top. */
.toasts { position: fixed; left: 50%; top: calc(10px + env(safe-area-inset-top, 0px)); z-index: 80; transform: translateX(-50%); display: grid; gap: 8px; width: min(400px, calc(100% - 24px)); pointer-events: none; }
.toast {
  display: flex; align-items: center; gap: 12px; padding: 10px 14px; border-radius: 20px;
  background: rgba(255, 255, 255, 0.92); color: var(--ink); font-weight: 600;
  box-shadow: 0 0 0 1px var(--line), 0 14px 32px -12px rgba(43, 38, 40, 0.35);
  animation: py-toast-in 260ms var(--spring);
}
.toast small { display: block; font-weight: 400; color: var(--ink-2); }
.toast.is-leaving { opacity: 0; transform: translateY(-8px); transition: opacity 180ms, transform 180ms; }
@keyframes py-toast-in { from { opacity: 0; transform: translateY(-12px) scale(0.98); } to { opacity: 1; transform: none; } }
.py-art { display: block; height: auto; user-select: none; -webkit-user-select: none; }
.py-toast-art { width: 40px; flex: none; }
/* Pengu's moving parts (motion.js): every part turns around its own anchor. */
.py-pengu { transform-box: fill-box; transform-origin: 50% 100%; }
.py-eye { transform-box: fill-box; transform-origin: 50% 50%; }
.py-flipper-l { transform-box: fill-box; transform-origin: 85% 6%; }
.py-flipper-r { transform-box: fill-box; transform-origin: 15% 6%; }
.py-scarf-tail { transform-box: fill-box; transform-origin: 40% 0; }
.py-scarf-tail.is-wind { transform-origin: 100% 40%; }
.py-belly-glow { transform-box: fill-box; }
.py-rider { transform-box: fill-box; transform-origin: 50% 100%; }
.py-spokes { transform-box: fill-box; transform-origin: 50% 50%; }
.py-puff { transform-box: fill-box; transform-origin: 50% 50%; }
.py-lamp { transform-box: fill-box; transform-origin: 0 50%; }
.py-sparkles { position: fixed; z-index: 90; width: 0; height: 0; pointer-events: none; }
.py-spark { position: absolute; left: calc(var(--s) / -2); top: calc(var(--s) / -2); width: var(--s); height: var(--s); clip-path: polygon(50% 0, 62% 38%, 100% 50%, 62% 62%, 50% 100%, 38% 62%, 0 50%, 38% 38%); }
.py-spark.is-coral { background: var(--coral); }
.py-spark.is-sun { background: var(--sun); }
.py-spark.is-white { background: #FFFFFF; box-shadow: 0 0 0 1px rgba(43, 38, 40, 0.08); }

/* ---------- 6. Shell: one column, centred at 430px on wider screens ---------- */
.app {
  max-width: 430px; margin: 0 auto;
  padding: calc(8px + env(safe-area-inset-top, 0px)) var(--gutter) calc(var(--tabbar-h) + 32px + env(safe-area-inset-bottom, 0px));
}
.app.is-planning { padding-bottom: calc(32px + env(safe-area-inset-bottom, 0px)); }
.py-view { display: grid; gap: var(--s4); }
.py-view-title { padding-top: var(--s2); font-size: 2.125rem; line-height: 2.5rem; font-weight: 700; letter-spacing: -0.02em; }
.py-section-title { font-size: 1.125rem; font-weight: 600; line-height: 1.3; }
.nojs { display: grid; gap: var(--s3); padding-top: var(--s6); }
/* Splash: PENGYU on the splash orange, once per session. */
.py-splash { position: fixed; inset: 0; z-index: 200; display: none; place-items: center; background: var(--splash); transition: opacity 260ms var(--ease-out); }
html.is-splash .py-splash { display: grid; }
.py-splash.is-leaving { opacity: 0; }
/* The glass tab bar: four tabs, floating above the safe area. With large text a label wraps onto a
   second line at its break point (app.js), or anywhere if even that is too wide, never cut off. */
.tabbar {
  position: fixed; z-index: 50; left: 50%; bottom: calc(10px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%);
  width: min(406px, calc(100% - 24px)); border-radius: 26px;
}
.tabbar-list { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); }
.tabbar-btn {
  position: relative; display: grid; justify-items: center; align-content: start; gap: 2px; width: 100%; min-height: var(--tabbar-h);
  padding: 7px 0 10px; border: 0; background: none; color: var(--ink-2); font-size: 0.8125rem; font-weight: 600;
}
.tabbar-btn .icon { width: 24px; height: 24px; }
.tabbar-btn span { max-width: 100%; padding: 0 3px; text-align: center; overflow-wrap: anywhere; }
.tabbar-btn[aria-current="page"] { color: var(--ink); }
.tabbar-btn[aria-current="page"]::after { content: ""; position: absolute; bottom: 6px; left: 50%; width: 5px; height: 5px; margin-left: -2.5px; border-radius: 50%; background: var(--coral); }
.tabbar-btn:focus-visible { outline-offset: -4px; border-radius: 20px; }
.app.is-planning ~ .tabbar { display: none; }

/* ---------- 7. Today: "good evening." → the route → the count → Begin ---------- */
.py-today { display: grid; gap: var(--s3); }
.py-topbar { display: flex; align-items: center; justify-content: space-between; min-height: 44px; }
.py-fishpill { display: inline-flex; align-items: center; gap: 6px; height: 38px; padding: 0 16px 0 12px; border-radius: var(--r-pill); font-weight: 600; font-variant-numeric: tabular-nums; }
.py-fishpill .icon { width: 22px; height: 22px; color: var(--coral-ink); }
.py-fish-n { display: inline-block; min-width: 1ch; }
.py-avatar-btn { width: 44px; height: 44px; padding: 0; border-radius: 50%; display: grid; place-items: center; }
.py-avatar-btn svg { width: 38px; margin-top: 7px; }
.py-greet { font-size: 2.125rem; line-height: 2.5rem; font-weight: 700; letter-spacing: -0.02em; overflow-wrap: anywhere; }   /* "afternoon." at 200% text on a narrow phone */
/* The stage: the one dark card, with a warm lift where the train rides. */
.py-stage {
  position: relative; display: grid; gap: var(--s3); padding: 18px var(--s4) var(--s4); border-radius: var(--r-card);
  background: radial-gradient(130% 80% at 46% 22%, var(--stage-lift) 0%, var(--stage) 64%); color: var(--on-stage);
  box-shadow: var(--shadow); contain: paint;
}
.py-stage :focus-visible { outline-color: var(--sun); }
.py-streak-chip { justify-self: start; display: inline-flex; align-items: baseline; gap: 6px; padding: 4px 12px; border-radius: var(--r-pill); background: rgba(247, 242, 238, 0.1); color: var(--on-stage); font-size: 0.8125rem; font-weight: 600; }
.py-streak-chip strong { font-variant-numeric: tabular-nums; }
/* The route: the train rides a hand-drawn rail; the stations sit on the route line below. Stations and
   the train share --at, from 0 (the depot) to 1 (the last station). The train is --tw wide and its front
   is --front from its left edge, so its front stops right above the station it has reached. */
.py-route-wrap { --th: 72px; --tw: calc(var(--th) * 1.786); --front: calc(var(--tw) * 0.96); position: relative; height: calc(var(--th) + 22px + 2.5rem); }   /* 62px; the station names grow with larger text */
.py-route-wrap.has-car2 { --th: 62px; --tw: calc(var(--th) * 2.452); --front: calc(var(--tw) * 0.9709); }
/* No plan yet: only the depot sits on the route line, so the empty row for station names goes. */
.py-route-wrap.is-empty { height: calc(var(--th) + 38px); }
.py-rail { position: absolute; left: 0; right: 0; top: calc(var(--th) * 0.9 - 3px); width: 100%; height: 8px; overflow: visible; }
.py-rail path { fill: none; stroke: rgba(247, 242, 238, 0.32); stroke-width: 1.6; stroke-linecap: round; vector-effect: non-scaling-stroke; }
.py-route { position: absolute; left: 0; right: 0; top: calc(var(--th) + 8px); height: calc(14px + 2.5rem); margin: 0; }
.py-route-line { position: absolute; left: 0; right: 0; top: calc(var(--th) + 23px); width: 100%; height: 6px; overflow: visible; }
.py-route-line path { fill: none; stroke: rgba(247, 242, 238, 0.24); stroke-width: 2.4; stroke-linecap: round; vector-effect: non-scaling-stroke; }
.py-station, .py-depot { position: absolute; left: calc(var(--front) + var(--at, 0) * (100% - var(--front) - 18px)); transform: translateX(-50%); }
.py-depot { top: 11px; width: 14px; height: 14px; }
.py-depot path { fill: rgba(247, 242, 238, 0.28); }
.py-station { top: 0; display: grid; justify-items: center; gap: 3px; }
.py-ring { width: 34px; height: 34px; overflow: visible; }
.py-ring-line { fill: none; stroke: var(--line-strong); stroke-width: 2.4; stroke-linejoin: round; }
.py-ring-fill { fill: var(--coral-strong); opacity: 0; transform-box: fill-box; transform-origin: 50% 50%; }
.py-ring-check { fill: none; stroke: #FFFFFF; stroke-width: 3.2; stroke-linecap: round; stroke-linejoin: round; opacity: 0; }
.py-station.is-done .py-ring-line { stroke: var(--coral); }
.py-station.is-done .py-ring-fill, .py-station.is-done .py-ring-check { opacity: 1; }
.py-station.is-done.is-arriving .py-ring-fill, .py-station.is-done.is-arriving .py-ring-check { opacity: 0; }
.py-station.is-today .py-ring-line { stroke: var(--on-stage); stroke-width: 3; }
.py-station.is-today .py-ring { filter: drop-shadow(0 0 6px rgba(247, 242, 238, 0.45)); }
.py-station.is-missed .py-ring-line { stroke-dasharray: 3.2 3.4; }
.py-stop-day { font-size: 0.8125rem; font-weight: 600; line-height: 1.2; color: var(--on-stage-2); white-space: nowrap; }
.py-station.is-today .py-stop-day { color: var(--on-stage); }
.py-station.is-missed .py-stop-day { font-weight: 400; }
/* Large text (a text-size setting or page zoom, both of which shrink the width in em): two-letter days. */
.py-stop-short { display: none; }
@media (max-width: 18em) { .py-stop-long { display: none; } .py-stop-short { display: inline; } }
/* A comeback stamp sits on the ring where the player came back. */
.py-stamp { position: absolute; top: -7px; right: -10px; display: grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; background: var(--sun); color: var(--ink); box-shadow: 0 0 0 2px var(--stage); }
.py-stamp .icon { width: 14px; height: 14px; stroke-width: 2.2; }
.py-stamp.is-new { animation: py-stamp-in 700ms var(--spring) 1.3s both; }
@keyframes py-stamp-in { 0% { transform: scale(2.2) rotate(-28deg); opacity: 0; } 60% { transform: scale(0.9) rotate(6deg); opacity: 1; } 100% { transform: none; opacity: 1; } }
.py-train { position: absolute; top: 0; left: calc(var(--at, 0) * (100% - var(--front) - 18px)); width: var(--tw); height: var(--th); will-change: transform; }
.py-train-svg { width: 100%; height: 100%; overflow: visible; }
/* Tapping the route opens the week: a quiet button laid over the stations. */
.py-route-open { position: absolute; left: 0; right: 0; top: calc(var(--th) + 2px); height: calc(20px + 2.5rem); border: 0; border-radius: 16px; background: transparent; }
@media (max-width: 399px) {
  .py-route-wrap.has-car2 .py-ring { width: 28px; height: 28px; }
  .py-route-wrap.has-car2 .py-station { top: 3px; }
}
@media (max-width: 359px) {
  .py-route-wrap { --th: 54px; }
  .py-route-wrap.has-car2 { --th: 48px; }
  .py-ring { width: 30px; height: 30px; }
  .py-station { top: 2px; }
}
@media (min-width: 400px) {
  .py-route-wrap { --th: 84px; }
  .py-route-wrap.has-car2 { --th: 72px; }
}
.py-count { font-size: 1.375rem; line-height: 1.75rem; font-weight: 600; color: var(--on-stage); }
.py-count:focus:not(:focus-visible) { outline: none; }
.py-count-n { font-variant-numeric: tabular-nums; white-space: nowrap; }
.py-goal { margin-top: 2px; font-size: 0.9375rem; font-weight: 600; color: var(--coral-on-stage); }
.py-goal.is-calm { color: var(--on-stage-2); font-weight: 400; }
/* With no plan this week: how Pengyu works, in three short steps under the heading. */
.py-how { display: grid; gap: 6px; margin: 8px 0 0; padding: 0; list-style: none; font-size: 0.9375rem; line-height: 1.35; color: var(--on-stage-2); }
.py-how li { display: grid; grid-template-columns: 22px minmax(0, 1fr); gap: 10px; align-items: start; }
.py-how .icon { width: 22px; height: 22px; margin-top: -1px; color: var(--coral-on-stage); }
.py-how strong { font-weight: 600; color: var(--on-stage); }
/* One big Begin, and a quiet caption under it. */
.py-begin-btn { display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%; min-height: 64px; margin-top: var(--s1); padding: 0 24px; border-radius: var(--r-pill); font-size: 1.1875rem; font-weight: 700; }
.py-begin-btn.is-logged { background: rgba(247, 242, 238, 0.1); border: 1px solid rgba(247, 242, 238, 0.24); color: var(--on-stage); box-shadow: none; cursor: default; }
.py-begin-btn.is-logged .icon { color: var(--coral-on-stage); stroke-width: 2.4; }
.py-caption { text-align: center; font-size: 0.875rem; color: var(--on-stage-2); }
.py-stage .link { color: var(--on-stage); }
/* "Logged today": the check pops in the moment the tap lands (instant with reduced motion). */
.py-begin-btn.is-logged.is-new .icon { animation: py-pop 420ms var(--spring) both; }
@keyframes py-pop { 0% { transform: scale(0.3); opacity: 0; } 60% { transform: scale(1.25); opacity: 1; } 100% { transform: scale(1); } }
/* The week sheet's visible door, under the route (the route itself stays tappable too). Its box starts
   where the route ends; the strip in ::before keeps the tap area 44px tall. */
.py-days-btn { position: relative; justify-self: start; display: inline-flex; align-items: center; gap: 8px; min-height: 32px; margin: -12px 0 -4px; padding: 0 4px 0 0; border: 0; background: none; color: var(--on-stage); font-size: 0.875rem; font-weight: 600; text-decoration: underline; text-decoration-thickness: 1.5px; text-underline-offset: 3px; }
.py-days-btn::before { content: ""; position: absolute; inset: -6px 0; }
.py-days-btn .icon { width: 18px; height: 18px; color: var(--coral-on-stage); }
/* With the next stop and Pengu's window showing as well, the stage packs a little closer so it still fits
   a small phone (375 × 667) without scrolling. Begin keeps its full 64px. */
.py-stage.is-full { gap: 6px; padding-bottom: 10px; }
.py-stage.is-full .py-days-btn { margin: -8px 0 -6px; }
.py-stage.is-full .py-streak-chip { margin-bottom: -6px; }
.py-stage.is-full .py-begin-btn { margin-top: 0; }
/* No plan yet, after a streak week (where "Review last week's plan" waits): a little closer, to fit a small phone. */
.py-streak-chip + .py-route-wrap.is-empty { margin-top: -6px; }
.py-stage.is-full .py-onward { padding-top: 4px; gap: 2px; }
/* After a log, or between planned days: the next stop and what it pays, then Pengu's next goal. */
/* A first visit: the first goal, drawn (Pengu in the scarf) beside the plain math of a full week. */
.py-first-goal { display: flex; align-items: center; gap: 12px; margin-top: 6px; padding: 4px 12px 4px 4px; border-radius: 18px; background: rgba(247, 242, 238, 0.08); }
.py-first-goal-pic { display: grid; place-items: center; flex: none; width: 46px; height: 46px; border-radius: 14px; background: rgba(247, 242, 238, 0.12); overflow: hidden; }
.py-first-goal-pic svg { width: 42px; margin-top: 6px; }
/* A first visit packs a little closer, so the steps, the goal and "No account needed" fit a small phone. */
.py-stage.is-first { gap: var(--s2); padding-bottom: var(--s3); }
.py-stage.is-first .py-how { gap: 3px; margin-top: 6px; }
.py-first-goal p { font-size: 0.875rem; line-height: 1.35; color: var(--on-stage-2); }
.py-first-goal strong { display: block; color: var(--on-stage); font-weight: 600; }
/* A returning player: last plan on one card, ready to start again. */
.py-repeat { display: grid; gap: 2px; margin-top: 8px; padding: 10px 12px; border-radius: 18px; background: rgba(247, 242, 238, 0.08); }
.py-repeat-days { display: flex; align-items: center; gap: 8px; font-weight: 600; color: var(--on-stage); }
.py-repeat-days .icon { width: 18px; height: 18px; flex: none; color: var(--coral-on-stage); }
.py-repeat-when { padding-left: 26px; font-size: 0.875rem; color: var(--on-stage-2); }
.py-onward { display: grid; justify-items: start; gap: 4px; padding-top: 10px; border-top: 1px solid rgba(247, 242, 238, 0.16); font-size: 0.9375rem; }
.py-onward-stop { font-weight: 600; color: var(--on-stage); }
/* Links here have 32px targets (above the 24px minimum) whose extra height sits in small negative margins,
   with enough gap that one link's target never covers the other's words. */
.py-onward-goal { display: inline-block; padding: 5px 0; margin: -5px 0; text-align: left; }
.py-plan-next { display: inline-flex; align-items: center; gap: 8px; min-height: 32px; margin: -5px 0; }
.py-plan-next .icon { width: 18px; height: 18px; color: var(--coral-on-stage); }
.py-chev { text-decoration: none; }
/* "Look out the window": the quiet door to Pengu's window, a 32px link with a 44px tap strip. */
.py-window-btn { position: relative; display: inline-flex; align-items: center; gap: 8px; min-height: 32px; margin: -3px 0 -5px; text-align: left; }
.py-window-btn::before { content: ""; position: absolute; inset: -6px 0; }
.py-window-btn .icon { width: 18px; height: 18px; flex: none; color: var(--coral-on-stage); }
/* The three-second arrival: the Fish a log paid ("+10") ride to the station, then fly into the Fish pill.
   Placed with left/top once, then moved with transform only; `translate` centres it above the ring. */
.py-fish-token { position: fixed; z-index: 60; display: inline-flex; align-items: center; gap: 4px; padding: 4px 11px 4px 8px; border-radius: var(--r-pill); background: var(--sun); color: var(--ink); font-size: 0.9375rem; font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; box-shadow: 0 0 0 2px var(--stage), 0 8px 18px -8px rgba(0, 0, 0, 0.6); pointer-events: none; translate: -50% -100%; }
.py-fish-token .icon { width: 16px; height: 16px; color: var(--coral-ink); }
.py-goal-n { font-variant-numeric: tabular-nums; }

/* ---------- 8. Sheets: they rise from the bottom edge ---------- */
dialog.py-sheet {
  position: fixed; inset: auto 0 0 0; width: min(430px, 100%); max-width: 100%; max-height: 92vh; margin: 0 auto; padding: 0;
  border: 0; background: transparent; color: var(--ink); overflow: visible;
}
dialog.py-sheet::backdrop { background: rgba(20, 18, 19, 0.42); }
.py-sheet-panel { position: relative; display: grid; gap: var(--s3); max-height: 92vh; overflow: auto; overscroll-behavior: contain; border-radius: var(--r-card) var(--r-card) 0 0; padding: var(--s3) var(--gutter) calc(var(--s5) + env(safe-area-inset-bottom, 0px)); box-shadow: 0 -18px 40px -24px rgba(43, 38, 40, 0.45); touch-action: pan-y; }
.py-sheet-grip { justify-self: center; width: 40px; height: 5px; border-radius: 3px; background: rgba(43, 38, 40, 0.22); }
.py-sheet-head { display: flex; align-items: center; justify-content: space-between; gap: var(--s3); }
.py-sheet-close { flex: none; width: var(--tap); height: var(--tap); border-radius: 50%; display: grid; place-items: center; padding: 0; color: var(--ink); }   /* never squeezed by a long title at large text */
/* The sunny reward sheet: Headspace-style bands with Pengu's face rising like a sun. */
.py-reward .py-sheet-panel { min-height: min(60vh, 560px); align-content: start; overflow: hidden; background: var(--sun); padding-bottom: 0; }
.py-reward-title { font-size: 1.5rem; font-weight: 700; line-height: 1.25; }
.py-reward-lines { display: grid; gap: 4px; font-size: 1.0625rem; font-weight: 600; }
.py-reward-lines .num { font-variant-numeric: tabular-nums; }
.py-reward-next { font-size: 0.9375rem; }
.py-reward-ok { justify-self: start; min-width: 140px; }
.py-reward-stamp { justify-self: start; width: 74px; height: 74px; transform: rotate(-8deg); }
.py-reward-art { position: relative; height: 190px; margin: var(--s2) calc(-1 * var(--gutter)) 0; }
.py-reward-bands { position: absolute; inset: 0; width: 100%; height: 100%; }
.py-reward-face { position: absolute; left: 0; right: 0; bottom: -6px; width: min(320px, 82%); margin: 0 auto; }
.py-reward-face svg { width: 100%; }
/* The next goal on the reward sheet: a preview of the piece, the Fish in hand against its price. */
.py-reward-stop { margin-top: -6px; font-weight: 600; }
.py-reward-goal { display: flex; align-items: center; gap: 14px; padding: 12px 14px; border-radius: 20px; background: rgba(255, 255, 255, 0.6); }
.py-reward-goal-pic { display: grid; place-items: center; flex: none; width: 64px; height: 64px; border-radius: 16px; background: rgba(255, 255, 255, 0.75); overflow: hidden; }
.py-reward-goal-pic svg { width: 54px; margin-top: 2px; }
.py-reward-goal-pic.is-train svg { width: 60px; margin-top: 0; }
.py-reward-goal-text { display: grid; gap: 2px; justify-items: start; min-width: 0; }
.py-reward-goal-text .link { display: inline-flex; align-items: center; min-height: var(--tap); margin: -8px 0 -10px; text-align: left; }   /* "Preview on Pengu": a full 44px target */
.py-reward-goal-name { font-size: 1.0625rem; font-weight: 700; }
.py-reward-goal-sub { font-size: 0.875rem; color: var(--ink-2); }
.py-reward-extra { justify-self: start; display: grid; place-items: center; width: 56px; height: 56px; border-radius: 16px; background: rgba(255, 255, 255, 0.6); }
.py-reward-extra svg { width: 40px; }
.py-reward-postcard { display: flex; align-items: flex-start; gap: 8px; font-weight: 600; }
.py-reward-postcard .icon { flex: none; margin-top: 2px; color: var(--coral-ink); }
/* The one-time Home Screen tip (iPhone Safari): a sunny card. */
.py-tip .py-sheet-panel { background: var(--sun); }
.py-tip-head { display: grid; grid-template-columns: minmax(0, 1fr) 64px; gap: var(--s3); align-items: center; }
.py-tip-title { font-size: 1.375rem; line-height: 1.75rem; font-weight: 700; }
.py-tip-art { width: 64px; }
.py-tip-steps { display: grid; gap: 10px; }
.py-tip-steps li { display: flex; align-items: center; gap: 12px; font-size: 1.0625rem; }
.py-tip-n { display: grid; place-items: center; width: 30px; height: 30px; flex: none; border-radius: 50%; background: rgba(255, 255, 255, 0.6); font-weight: 700; }
.py-tip-share { display: inline-block; width: 20px; height: 20px; margin: 0 3px; vertical-align: -4px; }
.py-tip-note { font-size: 0.9375rem; }
.py-tip-actions { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s2); }
.py-tip-status { min-height: 1.3em; font-size: 0.875rem; font-weight: 600; }
/* The week sheet: this week's sessions as sunny cards. */
.py-weeksheet .py-sheet-panel { background: var(--paper) var(--grain); }
.py-weeksheet-title { font-size: 1.5rem; font-weight: 700; }
.py-invite .py-sheet-panel { background: var(--paper) var(--grain); }
.py-invite-title { font-size: 1.375rem; line-height: 1.75rem; font-weight: 700; }
.py-invite-title:focus:not(:focus-visible) { outline: none; }
.py-session-list { display: grid; gap: var(--s2); }
.py-session { display: grid; grid-template-columns: 50px minmax(0, 1fr) auto; gap: var(--s3); align-items: center; padding: 12px 14px; border-radius: 22px; background: var(--sun-2); }
.py-session.is-today { background: var(--sun); box-shadow: 0 10px 24px -14px rgba(196, 138, 16, 0.8); }
.py-session.is-done { background: var(--sun-2); }
.py-session.is-missed { background: transparent; border: 1.5px dashed var(--line-strong); }
.py-session-day { display: grid; justify-items: center; padding: 6px 0; border-radius: 14px; background: rgba(255, 255, 255, 0.55); line-height: 1.1; }
.py-session.is-missed .py-session-day { background: var(--paper-2); }
.py-session-dow { font-size: 0.75rem; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; }
.py-session-date { font-size: 1.25rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.py-session-text { min-width: 0; }
.py-session-name { font-weight: 600; }
.py-session-when { font-size: 0.875rem; }
.py-session-side { display: grid; justify-items: end; gap: 4px; }
.py-session-status { display: inline-flex; align-items: center; gap: 4px; font-size: 0.875rem; font-weight: 600; white-space: nowrap; }
.py-session-status .icon { width: 16px; height: 16px; stroke-width: 2.4; }
.py-session.is-today .py-session-status { padding: 2px 10px; border-radius: var(--r-pill); background: var(--ink); color: #FFFFFF; }
.py-session.is-missed .py-session-status { color: var(--ink-2); font-weight: 400; }
.py-session-move { min-height: 32px; font-size: 0.875rem; }
.py-move { display: grid; gap: var(--s2); padding: 14px; border-radius: 22px; background: var(--card); box-shadow: var(--shadow); }
.py-move-title { font-weight: 600; }
.py-choices { display: flex; flex-wrap: wrap; gap: var(--s2); }
.py-sheet-note { display: flex; align-items: flex-start; gap: 10px; font-size: 0.875rem; color: var(--ink-2); }
.py-sheet-note .icon { width: 18px; height: 18px; margin-top: 1px; color: var(--ink); }
.py-cal-text { display: grid; gap: 2px; }
.py-cal-text .link { justify-self: start; display: inline-flex; align-items: center; min-height: 32px; }
/* Pengu's window: a train window in the player's own paint (--win), a hand-drawn view with Pengu at the
   sill, one line of story, and Next. The picture is decorative; the line under it says what it shows. */
.py-winsheet .py-sheet-panel { background: var(--paper) var(--grain); }
.py-win-title { font-size: 1.375rem; line-height: 1.75rem; font-weight: 700; }
.py-win-frame { --win: #3C4862; position: relative; padding: 10px; border-radius: 30px; background: var(--win); box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.28), inset 0 -10px 18px rgba(0, 0, 0, 0.2), var(--shadow); }
.py-win-view { position: relative; aspect-ratio: 16 / 10; border-radius: 20px; overflow: hidden; background: var(--paper-2); box-shadow: inset 0 0 0 2px var(--brass); }
.py-win-scene { position: absolute; inset: 0; width: 100%; height: 100%; }
.py-win-pengu { position: absolute; z-index: 1; left: 4%; bottom: -7%; width: 25%; overflow: visible; }
.py-win-tap { position: absolute; inset: 10px; z-index: 1; border: 0; border-radius: 20px; background: transparent; cursor: pointer; }
.py-win-tap:focus { outline: none; }
.py-win-snow circle { animation: py-flake 3.4s ease-in-out infinite alternate; }
.py-win-snow circle:nth-child(3n) { animation-duration: 4.4s; animation-delay: -1.3s; }
.py-win-snow circle:nth-child(3n + 1) { animation-duration: 2.9s; animation-delay: -0.7s; }
@keyframes py-flake { from { transform: translate(-2px, -4px); } to { transform: translate(2px, 5px); } }
.py-win-line { min-height: 2.8em; font-size: 1.0625rem; line-height: 1.4; font-weight: 600; }
.py-win-dots { justify-self: center; }
.py-win-actions { display: flex; flex-wrap: wrap; gap: var(--s2); }
.py-win-actions .btn { flex: 1 1 8rem; }
.py-win-actions .py-win-next { flex-grow: 2; }
.py-win-note { justify-content: center; text-align: center; }

/* ---------- 9. Plan: a full-screen paper view, four quick steps, then a sunny summary ---------- */
.py-plan { display: grid; gap: var(--s5); align-content: start; }
.py-plan-top { display: flex; align-items: center; gap: var(--s4); min-height: 44px; }
.py-back { width: var(--tap); height: var(--tap); border-radius: 50%; display: grid; place-items: center; padding: 0; }
.py-dots { display: flex; gap: 8px; }
.py-dots li { width: 8px; height: 8px; border-radius: 50%; background: var(--line); transition: background-color 200ms var(--ease-out); }
.py-dots li.is-on { background: var(--coral-strong); }
.py-plan-head { display: grid; gap: 6px; }
.py-step-title { font-size: 1.75rem; line-height: 2.125rem; font-weight: 700; letter-spacing: -0.02em; }
.py-step-title:focus:not(:focus-visible) { outline: none; }
.py-hint { color: var(--ink-2); }
.py-step-body { display: grid; gap: var(--s3); }
/* One screen, two questions ("How many workouts?" and "Which days?"; "When?" and "Where?"). */
.py-step-sub { margin-top: var(--s2); font-size: 1.125rem; line-height: 1.4; font-weight: 700; }
.py-step-sub:first-child { margin-top: 0; }
/* Reviewing a returning plan: its days, time and place, then anything that needs a new choice. */
.py-review-facts { display: grid; gap: 4px; margin: 0; }
.py-review-facts div { display: flex; flex-wrap: wrap; gap: 0 8px; }
.py-review-facts dt { font-weight: 700; }
.py-review-facts dt::after { content: ":"; }
.py-review-facts dd { margin: 0; }
.py-review-fix { display: grid; gap: var(--s3); padding: 16px; border: 2px dashed var(--line-strong); border-radius: 22px; }
.py-review-needs { font-weight: 600; }
.py-chip[aria-pressed="true"] { box-shadow: inset 0 0 0 1px var(--coral-strong), 0 8px 20px -12px rgba(229, 83, 47, 0.6); }
/* Columns grow with the text size, so large text gets fewer, wider chips instead of clipped ones. */
.py-targets { display: grid; grid-template-columns: repeat(auto-fit, minmax(6.25rem, 1fr)); gap: 10px; }
.py-targets .chip { min-height: 88px; border-radius: 24px; }
.py-target strong { font-size: 2.5rem; line-height: 1; font-weight: 700; }
.py-target small { font-size: 0.875rem; }
/* Day chips: four a row on a phone and seven from 400px at normal text size; fewer, wider ones as text grows. */
.py-days { display: grid; grid-template-columns: repeat(auto-fit, minmax(4rem, 1fr)); gap: 8px; }
.py-days .chip { min-height: 60px; padding: 6px 2px; }
.py-grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(9rem, 1fr)); gap: 10px; }
.py-grid2 .chip { min-height: 64px; border-radius: 20px; }
.py-counter { font-size: 0.875rem; color: var(--ink-2); }
.py-custom { max-width: 280px; }
.py-plan-actions { display: grid; gap: var(--s3); }
.py-ics-note { font-size: 0.875rem; color: var(--ink-2); text-align: center; }
.py-prefill { justify-self: start; padding: 3px 10px; border-radius: var(--r-pill); background: var(--paper-2); font-size: 0.8125rem; font-weight: 600; color: var(--ink); }
.py-next { width: 100%; min-height: 56px; font-size: 1.0625rem; font-weight: 700; }
.py-plan-ics { width: 100%; padding: 0 14px; font-size: 0.9375rem; }
.py-summary { display: grid; gap: var(--s3); padding: 22px 20px; border-radius: var(--r-card); background: var(--sun); box-shadow: 0 14px 30px -18px rgba(196, 138, 16, 0.9); }
.py-summary-plan { font-size: 1.25rem; line-height: 1.6875rem; font-weight: 700; }
.py-summary-days { display: grid; gap: 6px; }
.py-summary-days li { display: flex; align-items: center; gap: 10px; }
.py-summary-days .icon { width: 18px; height: 18px; stroke-width: 2.4; }
.py-summary-fish { font-size: 0.9375rem; }
@media (min-width: 400px) { .py-days { grid-template-columns: repeat(auto-fit, minmax(2.9rem, 1fr)); gap: 6px; } }

/* ---------- 10. Pengu tab: the lamp-base showcase, the next unlock, gear, train and extras (words, no bars) ---------- */
.py-shop { display: grid; gap: var(--s5); }
.py-shop > .py-topbar { margin-bottom: calc(-1 * var(--s4)); }
.py-show { margin: 0; }
.py-show-stage { display: grid; place-items: end center; padding: var(--s4) var(--s3) var(--s2); border-radius: var(--r-card); background: var(--paper-2); overflow: hidden; }
.py-scene { width: 100%; max-width: 400px; cursor: pointer; }   /* a tap makes Pengu hop */
/* The next unlock: Pengu (or the train) previewed with it, the fixed price, and the distance in words. */
/* The Pengu tab's "Next unlock" card (scoped, so the plan's coral Next button keeps its own look). */
section.py-next { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s3) var(--s4); padding: 16px; border-radius: var(--r-card); background: var(--card); box-shadow: var(--shadow); }
section.py-next.is-ready { box-shadow: inset 0 0 0 2px var(--coral-strong), var(--shadow); }
.py-next-art { display: grid; place-items: center; flex: none; width: 76px; height: 88px; border-radius: 20px; background: var(--paper-2); overflow: hidden; }
.py-next-pengu { width: 56px; }
.py-next-train { width: 70px; }
.py-next-text { display: grid; gap: 4px; justify-items: start; flex: 1 1 10rem; min-width: 0; }
.py-next-name { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; font-size: 1.25rem; line-height: 1.3; font-weight: 700; }
.py-next-name .icon { color: var(--coral-ink); }
.py-next-price { font-weight: 400; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.py-next-short { font-weight: 600; color: var(--coral-ink); font-variant-numeric: tabular-nums; }
.py-next-sub { color: var(--ink-2); }
.py-next > .py-confirm { flex-basis: 100%; }
.py-unlock { min-width: 108px; }
/* Sections and rows: art, name and price, then what you can do. They wrap at large text sizes. */
.py-shop-sec { display: grid; gap: 10px; }
.py-shop-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 2px 12px; }
.py-shop-h { font-size: 1.125rem; font-weight: 600; }
.py-shop-sub { font-size: 0.875rem; color: var(--ink-2); }
.py-rows { display: grid; gap: 10px; }
.py-row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 12px; padding: 12px 14px; border-radius: 22px; background: var(--card); box-shadow: var(--shadow); }
.py-row.is-ready { box-shadow: inset 0 0 0 2px var(--coral-strong), var(--shadow); }
.py-glyph-tile { display: grid; place-items: center; flex: none; width: 48px; height: 48px; border-radius: 16px; background: var(--paper-2); }
.py-glyph { width: 36px; height: 36px; }
.py-row.is-locked .py-glyph { opacity: 0.5; filter: grayscale(0.6); }
.py-row-text { flex: 1 1 7rem; min-width: 0; }
.py-row-name { font-weight: 600; }
.py-row-price { font-size: 0.875rem; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.py-row-side { margin-left: auto; }
.py-row > .py-confirm, .py-row > .py-swatches { flex-basis: 100%; }
.py-row-note { display: inline-flex; align-items: center; gap: 6px; min-height: var(--tap); font-size: 0.875rem; font-weight: 600; color: var(--ink); font-variant-numeric: tabular-nums; }
.py-row-note.is-locked { color: var(--ink-2); font-weight: 400; }
.py-row-note.is-owned .icon { color: var(--coral-ink); }
.py-row-note:focus:not(:focus-visible) { outline: none; }
.py-wear[aria-pressed="true"] { background: var(--coral-tint); box-shadow: inset 0 0 0 1.5px var(--coral-strong); }
/* Owned, previewed and locked never look alike: "Yours" and Wearing; a dashed line while previewed. */
.py-badge { display: inline-block; margin-left: 8px; padding: 1px 8px; border-radius: var(--r-pill); background: var(--coral-tint); font-size: 0.75rem; font-weight: 600; vertical-align: 1px; }
.py-row-side { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 4px 8px; }
.py-preview-btn[aria-pressed="true"] { background: var(--coral-tint); box-shadow: inset 0 0 0 1.5px var(--coral-strong); text-decoration: none; }
.py-row.is-previewing, .py-show.is-preview .py-show-stage { outline: 2px dashed var(--coral-strong); outline-offset: -2px; }
.py-next-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; }
.py-show-stage { position: relative; }
.py-preview-badge { position: absolute; top: 12px; left: 12px; padding: 3px 10px; border-radius: var(--r-pill); background: var(--ink); color: #FFFFFF; font-size: 0.75rem; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; }
.py-preview-bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 12px; padding: 12px 14px; border-radius: 18px; background: var(--coral-tint); }
.py-confirm { display: grid; gap: 10px; padding: 12px 14px; border-radius: 16px; background: var(--paper-2); }
.py-confirm-q { font-weight: 600; }
.py-confirm-actions { display: flex; flex-wrap: wrap; gap: var(--s2); }
.py-swatches { display: flex; flex-wrap: wrap; gap: var(--s2); }
.py-swatch { display: grid; place-items: center; width: var(--tap); height: var(--tap); padding: 0; border: 2px solid var(--line); border-radius: 50%; background: var(--card); }
.py-swatch[aria-pressed="true"] { border-color: var(--ink); box-shadow: 0 0 0 3px var(--coral-tint); }
.py-swatch-dot { width: 28px; height: 28px; border-radius: 50%; background: var(--sw); }
/* Extras: earned ones with Wear toggles; the rest as soft pencil outlines, with no prices. */
.py-shelf { display: grid; grid-template-columns: repeat(auto-fill, minmax(6.5rem, 1fr)); gap: 10px; }
.py-shelf-item { display: grid; justify-items: center; align-content: start; gap: 6px; padding: 12px 8px; border-radius: 20px; background: var(--card); box-shadow: var(--shadow); text-align: center; }
.py-shelf-item .py-glyph { width: 44px; height: 44px; }
.py-shelf-item.is-outline { background: transparent; box-shadow: none; border: 1.5px dashed var(--line-strong); }
.py-shelf-name { font-size: 0.875rem; font-weight: 600; line-height: 1.25; }
.py-shelf-item.is-outline .py-shelf-name { color: var(--ink-2); font-weight: 400; }
.py-shelf-note { font-size: 0.75rem; color: var(--ink-2); }
.py-glyph.is-outline * { fill: none; stroke: var(--line-strong); stroke-width: 1.1; }
.py-shop-note { text-align: center; font-size: 0.8125rem; color: var(--ink-2); }

/* ---------- 11. History: words and small tags, no charts ---------- */
.py-weeks-sec { display: grid; gap: 10px; }
.py-weeks { display: grid; gap: 10px; }
.py-week { display: grid; gap: 6px; padding: 14px 16px; border-radius: 22px; background: var(--card); box-shadow: var(--shadow); }
.py-week-top { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 2px var(--s3); }
.py-week-title { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 8px; font-size: 1rem; font-weight: 600; }
.py-week-now { padding: 1px 8px; border-radius: var(--r-pill); background: var(--coral-tint); font-size: 0.75rem; font-weight: 600; }
.py-week-fish { font-weight: 600; color: var(--coral-ink); white-space: nowrap; font-variant-numeric: tabular-nums; }
.py-week-line { font-size: 1.125rem; font-weight: 600; font-variant-numeric: tabular-nums; }
.py-week-tags { display: flex; flex-wrap: wrap; gap: 6px; }
.py-tag { display: inline-flex; align-items: center; gap: 4px; padding: 3px 10px; border-radius: var(--r-pill); background: var(--paper-2); font-size: 0.75rem; font-weight: 600; }
.py-tag .icon { width: 14px; height: 14px; }
.py-tag.is-hit { background: var(--coral-tint); }
.py-tag.is-stamp { background: var(--sun-2); }
/* The first postcard: its condition until then, then a sunny keepsake with optional sharing. */
.py-postcard { display: grid; gap: 12px; }
.py-postcard.is-locked { display: flex; align-items: flex-start; gap: 12px; padding: 14px 16px; border: 2px dashed var(--line-strong); border-radius: 22px; }
.py-postcard-slot { display: grid; place-items: center; flex: none; width: 44px; height: 44px; border-radius: 14px; background: var(--paper-2); color: var(--ink-2); }
.py-postcard-text { display: grid; gap: 4px; }
.py-postcard-card { position: relative; display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: end; gap: 8px; min-height: 150px; padding: 18px; border-radius: 22px; background: var(--sun); box-shadow: inset 0 0 0 6px rgba(255, 255, 255, 0.45), var(--shadow); overflow: hidden; }
.py-postcard-words { display: grid; gap: 4px; align-self: center; }
.py-postcard-caption { font-size: 1.25rem; line-height: 1.3; font-weight: 700; }
.py-postcard-meta { font-size: 0.875rem; color: var(--ink); }
.py-postcard-pengu { display: block; width: 88px; }
.py-postcard-prop { position: absolute; top: 10px; right: 12px; width: 46px; height: 46px; }
.py-share { display: grid; gap: 10px; padding: 16px; border-radius: 22px; background: var(--card); box-shadow: var(--shadow); }
.py-share-h { font-size: 1.125rem; font-weight: 700; }
.py-share-h:focus:not(:focus-visible) { outline: none; }
.py-share-row { display: flex; flex-wrap: wrap; gap: 8px; }
.py-share-label { font-size: 0.875rem; font-weight: 600; }
.py-share-text { width: 100%; padding: 10px 12px; border: 1.5px solid var(--line-strong); border-radius: 14px; background: var(--paper); color: var(--ink); font: inherit; line-height: 1.4; resize: none; }
.py-share-status { min-height: 1.4em; font-size: 0.875rem; font-weight: 600; }
.py-share-figure { display: grid; justify-items: start; gap: 6px; margin: 0; }
.py-share-img { display: block; width: min(100%, 300px); height: auto; aspect-ratio: 1; border-radius: 18px; box-shadow: var(--shadow); }
.py-share-making { font-size: 0.875rem; color: var(--ink-2); }
.py-share-how { margin-top: -4px; }
.py-share-status:focus:not(:focus-visible) { outline: none; }
/* The Pengyu link waits until this version is live: the chip is off, and this says why. */
.py-link-note { display: flex; align-items: flex-start; gap: 8px; }
.py-link-note .icon { width: 16px; height: 16px; flex: none; margin-top: 2px; }
.py-share-friend .link { display: inline-flex; align-items: center; min-height: 32px; text-align: left; }
/* Bring a friend along: the invitation, any time. */
.py-friend { display: grid; gap: 10px; }
/* The local-data note, read first in Your data, with Save a backup and Restore directly under it. */
.py-handoff { font-weight: 600; color: var(--ink); }
.py-data { display: grid; gap: 10px; padding: var(--s4); border-radius: var(--r-card); background: var(--card); box-shadow: var(--shadow); }
.py-data-actions { display: flex; flex-wrap: wrap; gap: var(--s2); }
.py-backup-when { margin-top: -2px; }
/* After an unlock with no backup yet: one tap to keep Pengu's progress safe. */
.py-keep { display: grid; gap: 10px; padding: 14px 16px; border-radius: 20px; background: var(--card); box-shadow: var(--shadow); }
.py-keep.is-saved { display: flex; align-items: center; gap: 8px; font-weight: 600; }
.py-keep.is-saved .icon { width: 18px; height: 18px; color: var(--coral-ink); }
.py-row > .py-keep { flex-basis: 100%; padding: 12px 14px; border-radius: 16px; background: var(--paper-2); box-shadow: none; }
.py-keep:focus:not(:focus-visible) { outline: none; }
.py-reset-confirm { display: grid; gap: 10px; padding: 14px; border-radius: 20px; background: var(--paper-2); }
.py-reset-confirm.is-last { background: var(--coral-tint); }
.py-reset-saved { display: inline-flex; align-items: center; gap: 6px; font-size: 0.875rem; font-weight: 600; }
.py-reset-saved .icon { color: var(--coral-ink); }
.py-restore-confirm { display: grid; gap: 10px; padding: 14px; border-radius: 20px; background: var(--sun-2); }
.py-data-error { display: flex; align-items: flex-start; gap: 8px; padding: 12px 14px; border-radius: 16px; background: var(--coral-tint); font-size: 0.9375rem; }
.py-data-error .icon { margin-top: 2px; color: var(--coral-ink); }

/* The quiet footer under the Pengu and History tabs. */
.py-foot { padding-top: var(--s2); text-align: center; font-size: 0.8125rem; color: var(--ink-2); }
.py-foot a, .py-data-privacy a { color: var(--ink); font-weight: 600; }
/* The privacy links are full 44px targets, even though they read as quiet text. */
.py-foot a, .py-data-privacy a { display: inline-flex; align-items: center; min-height: var(--tap); vertical-align: middle; }
.py-data-privacy { font-size: 0.875rem; margin: -10px 0; }

/* ---------- 12. 404 and privacy pages ---------- */
.not-found { min-height: 100vh; display: grid; place-items: center; padding: var(--s7) var(--gutter); text-align: center; }
.not-found-inner { display: grid; gap: var(--s5); justify-items: center; max-width: 30rem; }
.not-found-art { width: 140px; }
.not-found h1 { font-size: 2.125rem; line-height: 2.5rem; font-weight: 700; letter-spacing: -0.02em; }
.lead { font-size: 1.0625rem; color: var(--ink-2); }
/* Privacy: plain words on paper, one card per question. */
.doc-page { display: grid; gap: var(--s4); max-width: 38rem; margin: 0 auto; padding: calc(var(--s4) + env(safe-area-inset-top, 0px)) var(--gutter) calc(var(--s7) + env(safe-area-inset-bottom, 0px)); }
.doc-head { display: grid; gap: var(--s2); }
.doc-top { display: flex; align-items: center; justify-content: space-between; gap: var(--s3); }
.doc-back { display: inline-flex; align-items: center; gap: 4px; min-height: var(--tap); padding: 0 16px 0 10px; border-radius: var(--r-pill); color: var(--ink); font-weight: 600; text-decoration: none; }
.doc-art { width: 64px; }
.doc-head h1 { font-size: 2.125rem; line-height: 2.5rem; font-weight: 700; letter-spacing: -0.02em; }
.doc-date { font-size: 0.875rem; color: var(--ink-2); }
.doc-sec { display: grid; gap: var(--s2); padding: var(--s4); border-radius: var(--r-card); background: var(--card); box-shadow: var(--shadow); }
.doc-sec h2 { font-size: 1.25rem; line-height: 1.3; font-weight: 700; }
.doc-list { display: grid; gap: var(--s2); }
.doc-list li { position: relative; padding-left: 20px; }
.doc-list li::before { content: ""; position: absolute; left: 4px; top: 0.62em; width: 7px; height: 7px; border-radius: 46% 54% 52% 48%; background: var(--coral-strong); }
.doc-sec code { padding: 1px 6px; border-radius: 6px; background: var(--paper-2); font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: 0.875em; overflow-wrap: anywhere; }
.doc-foot { padding-top: var(--s2); }

/* ---------- 13. Motion, transparency and print ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 1ms !important; animation-delay: 0ms !important; animation-iteration-count: 1 !important; transition-duration: 1ms !important; }
}
/* Without backdrop blur, or when the viewer asks for less transparency, glass turns solid. */
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .glass { background: var(--card); }
}
@media (prefers-reduced-transparency: reduce) {
  .glass { background: var(--card); -webkit-backdrop-filter: none; backdrop-filter: none; }
  .glass-coral { background: var(--coral); }
  .glass-pink { background: var(--pengu); }
}
@media print {
  .tabbar, .toasts, .py-splash { display: none !important; }
  body { background: #FFFFFF; }
}
