/* ===== Stay Frosty — chrome: the brand bar, large title and hood, docked style bar, floating glass tab bar and its
   lens, page sheets, the PDF viewer sheet, the share sheet frame, the menu drawer, menus, notices, toast, pull to
   refresh, boot, level-up layer, and all navigation motion (design/reskin/SPEC.md §3–§6; DESIGN.md §4.3–4.8, §7 where
   the spec is silent). Every offset is position: absolute inside #app; nothing is position: fixed. ===== */

/* ---------- brand bar (SPEC §3.1) ---------- */
.navbar {
  position: absolute; top: 0; left: 0; right: 0; z-index: var(--z-nav);
  height: calc(var(--safe-t) + var(--bar-h)); padding: var(--safe-t) max(6px, var(--safe-r)) 0 max(6px, var(--safe-l));
  display: grid; grid-template-columns: 44px minmax(0, 1fr) 44px; align-items: center;
  pointer-events: none;                       /* the box is 56pt tall even when it looks 44: taps fall through */
}
.navbar > * { pointer-events: auto; }
.navbar > .nav-lead { grid-column: 1; }
.navbar > .brand { grid-column: 2; }
.navbar > .nav-gear { grid-column: 3; }
.nav-lead, .nav-gear { display: grid; place-items: center; width: 44px; height: 44px; }
/* scroll-edge glass: invisible at rest, the bar material once content runs under it (§3.5) */
.navbar::before {
  content: ''; position: absolute; inset: 0 0 -14px; z-index: -1; pointer-events: none;
  background: var(--glass-regular); -webkit-backdrop-filter: var(--blur-regular); backdrop-filter: var(--blur-regular);
  -webkit-mask-image: linear-gradient(#000 calc(100% - 26px), transparent);
          mask-image: linear-gradient(#000 calc(100% - 26px), transparent);
  opacity: 0; transform: translateY(0);
}
/* glass glyph button: 44 hit, 36 visual thin-glass disc */
.gbtn {
  position: relative; isolation: isolate; width: 44px; height: 44px; display: grid; place-items: center; color: var(--blue);
}
.gbtn::before {
  content: ''; position: absolute; z-index: -1; inset: 4px; border-radius: 50%;
  background: var(--glass-thin);   /* no blur of its own: it sits on its bar's glass or the still ground (§4.1 budget) */
  box-shadow: var(--spec), 0 4px 12px rgba(0, 0, 0, .35);
  transition: transform 320ms var(--spring-pop);
}
.gbtn > svg {
  position: relative; width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8;
  stroke-linecap: round; stroke-linejoin: round; filter: var(--glow-glyph);
}
.gbtn:active::before { transform: scale(.92); transition-duration: var(--dur-press); transition-timing-function: var(--ease-out); }
.gbtn[aria-current="page"]::before, .gbtn[aria-expanded="true"]::before { background: var(--lens-fill), var(--glass-thin); box-shadow: var(--glow-accent); }
/* the lit gear (on Intel) keeps a visible focus ring: the rule above would otherwise replace base.css's */
.gbtn:is([aria-current="page"], [aria-expanded="true"]):focus-visible::before { box-shadow: 0 0 0 2px var(--blue), var(--glow-accent); }
/* the Intel badge mirrored on the gear */
.gbtn > .tab-dot {
  position: absolute; top: 7px; right: 7px; width: 9px; height: 9px; border-radius: 50%;
  background: var(--red); box-shadow: 0 0 0 2px rgba(8, 16, 29, .95); pointer-events: none;
}

/* the lockup: Jay's mascot and the STAY FROSTY wordmark (assets/brand), centred */
.brand {
  justify-self: center; display: flex; align-items: flex-end; gap: 0; height: calc(var(--brand-w) + 4px);
  padding: 0; transform-origin: 50% 100%; -webkit-tap-highlight-color: transparent;
}
.brand > picture { display: block; flex: none; }
.brand img { display: block; max-width: none; pointer-events: none; }   /* the button takes the tap, never a stray image edge */
.brand-m { height: var(--brand-m); width: auto; margin: 0 -2px 0 0; filter: drop-shadow(0 4px 10px rgba(0, 0, 0, .6)); }
.brand-w { height: var(--brand-w); width: auto; filter: drop-shadow(0 0 10px rgba(56, 160, 255, .35)); }
.brand:focus-visible { outline-offset: 2px; border-radius: 12px; }

/* CSS-only wordmark fallback (§3.6): lettering and the four-lens glyph, nothing figurative */
.brand-fb { display: none; }
.brand.fb > picture { display: none; }
.brand.fb .brand-fb { display: flex; align-items: center; gap: 8px; align-self: center; }
.brand-fb svg { width: 30px; height: 10px; fill: var(--blue); filter: drop-shadow(0 0 4px rgba(124, 214, 255, .8)); }
.brand-fb b {
  display: block; font: 800 22px/1 var(--font-ui); font-stretch: 75%; text-transform: uppercase;
  letter-spacing: .02em; transform: skewX(-10deg);
}
.brand-fb b:first-of-type { background: linear-gradient(180deg, #FFFFFF, #C9D6E2); -webkit-background-clip: text; background-clip: text; color: transparent; }
.brand-fb b:last-of-type {
  background: linear-gradient(180deg, #A8E6FF, #3AA8F0 60%, #1C6FD2); -webkit-background-clip: text; background-clip: text; color: transparent;
  filter: drop-shadow(0 0 8px rgba(56, 160, 255, .55));
}
.brand-fb b + b { margin-left: -2px; }

/* ---------- collapse on scroll (§3.5): transforms and opacity only; the bar's box never resizes ---------- */
@supports (animation-timeline: scroll()) and (timeline-scope: --a) {
  .navbar::before { animation: sf-bar-glass linear both; animation-timeline: --sf-scroll; animation-range: 16px 56px; }
  .navbar .brand  { animation: sf-brand-compact linear both; animation-timeline: --sf-scroll; animation-range: 0 56px; }
  .navbar .gbtn   { animation: sf-btn-compact linear both; animation-timeline: --sf-scroll; animation-range: 0 56px; }
}
@supports not ((animation-timeline: scroll()) and (timeline-scope: --a)) {
  .navbar::before, .navbar .brand, .navbar .gbtn { transition: transform 220ms var(--ease-out), opacity 220ms var(--ease-out); }
  #app.compact .navbar::before { opacity: 1; transform: translateY(-12px); }
  #app.compact .navbar .brand { transform: translateY(-8px) scale(.76); }
  #app.compact .navbar .gbtn { transform: translateY(-6px); }
}
@keyframes sf-bar-glass { from { opacity: 0; transform: none; } to { opacity: 1; transform: translateY(-12px); } }
@keyframes sf-bar-glass-l { from { opacity: 0; } to { opacity: 1; } }
@keyframes sf-brand-compact { to { transform: translateY(-8px) scale(.76); } }
@keyframes sf-btn-compact { to { transform: translateY(-6px); } }
#navTitle { display: none; }   /* kept for the contract (render() still writes it); the brand bar never shows a title */

/* ---------- large title, title-row actions, status line and the title hood (§3.3) ---------- */
.topbar { position: relative; isolation: isolate; min-width: 0; }
.topbar::before, .topbar::after {
  content: ''; position: absolute; z-index: -1; pointer-events: none;
  left: calc(var(--panel-x) - var(--g)); right: calc(var(--panel-x) - var(--g)); top: 2px; height: calc(100% + 64px);
  border-radius: var(--r-panel) var(--r-panel) 0 0;
}
.topbar::before { background: linear-gradient(180deg, rgba(18, 36, 64, .72), rgba(11, 22, 38, .35) 55%, rgba(11, 22, 38, 0)); }
.topbar::after {                      /* the frost rim, brightest on top, gone by 90% */
  padding: 1px; background: var(--edge-frost-hi);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0); -webkit-mask-composite: xor;
          mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0); mask-composite: exclude;
}
.lt-row {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0 8px;
  min-height: 44px; padding-top: 6px;
}
#ltTitle, .lt-title {
  flex: 1 1 auto; min-width: 0; margin: 0; padding: 0; color: var(--ink);
  font: 800 clamp(28px, var(--fs-large), 44px)/1.18 var(--font-ui); font-stretch: var(--wd-cond); letter-spacing: .01em;
  text-transform: uppercase; text-shadow: 0 2px 14px rgba(0, 0, 0, .45);
  overflow-wrap: anywhere;
  pointer-events: none;   /* not interactive: taps on its glyphs fall through to the status button's top hit slop */
}
/* per-tab actions (#navTrail, same id): glass discs and capsules in the title row. They scroll with the page and sit
   on the hood's still gradient, so they take the thin-glass fill and edge without a backdrop-filter (§4.1 budget) */
.lt-actions, #navTrail {
  display: flex; align-items: center; justify-content: flex-end; gap: 6px; flex: none; margin-left: auto; margin-right: -4px;
  position: relative; z-index: 1;   /* above the status button's 44pt hit slop, which reaches 13pt up into this row */
}
.lt-actions .icon-btn { isolation: isolate; color: var(--blue); }
.lt-actions .icon-btn::before {
  content: ''; position: absolute; z-index: -1; inset: 4px; border-radius: 50%;
  background: var(--glass-thin);
  box-shadow: var(--spec), 0 4px 12px rgba(0, 0, 0, .35);
  transition: transform 320ms var(--spring-pop);
}
.lt-actions .icon-btn > svg { filter: var(--glow-glyph); }
.lt-actions .nav-pull {
  position: relative; isolation: isolate; min-height: 44px; padding: 0 12px; gap: 6px;
  font: 600 15px/20px var(--font-ui); color: var(--blue);
}
.lt-actions .nav-pull::before {
  content: ''; position: absolute; z-index: -1; inset: 4px 0; border-radius: 18px;
  background: var(--glass-thin);
  box-shadow: var(--spec), 0 4px 12px rgba(0, 0, 0, .35);
  transition: transform 320ms var(--spring-pop);
}
.lt-actions .nav-pull svg { width: 10px; height: 6px; }
.lt-actions :is(.icon-btn, .nav-pull):active { opacity: 1; }
.lt-actions :is(.icon-btn, .nav-pull):active::before { transform: scale(.94); transition-duration: var(--dur-press); transition-timing-function: var(--ease-out); }
.lt-actions :is(.icon-btn, .nav-pull)[aria-expanded="true"]::before { background: var(--lens-fill), var(--glass-thin); box-shadow: var(--glow-accent); }
.lt-actions :is(.icon-btn, .nav-pull):focus-visible { outline-offset: -2px; border-radius: 22px; }

/* The status line is a sentence, so it is set in the UI face; numbers alone are mono. It never cuts its facts: at
   larger text it wraps between segments, and only the sync phrase may ellipsize. */
.lt-status {
  --sep: 1.05em;   /* room for the status dot between the facts and the sync phrase */
  display: flex; flex-wrap: wrap; align-items: center; column-gap: var(--sep); row-gap: 0;
  width: 100%; min-height: 44px; margin: -13px 0; padding: 13px 0;   /* 44 hit, 18 visual */
  overflow: hidden;   /* clips the dot of a segment that starts a line (the button's own focus ring is unaffected) */
  text-align: left; color: var(--ink-2); white-space: normal;
  font: 500 var(--fs-footnote)/var(--lh-footnote) var(--font-ui); font-stretch: 100%; font-variant-numeric: tabular-nums;
  transition: opacity var(--dur-press) linear;
}
.lt-status:active { opacity: .5; }
/* .lt-dot stays in the markup for the contract; #syncText::before draws the sync state dot in the flex gap. Gaps
   never open a line, so when the phrase wraps the dot falls outside the button and is clipped. */
.lt-status > .lt-dot { display: none; white-space: pre; }
.lt-status > #ltMeta:empty, .lt-status > #syncText:empty { display: none; }
.lt-status > #ltMeta { flex: 0 1 auto; min-width: 0; max-width: 100%; white-space: normal; overflow: visible; text-overflow: clip; }
.lt-status > #syncText { position: relative; flex: 0 1 auto; min-width: 0; max-width: 100%; white-space: normal; }
.lt-status > #syncText::before {
  content: ''; position: absolute; top: 50%; right: calc(100% + var(--sep) / 2 - 3px); width: 6px; height: 6px; margin-top: -3px;
  border-radius: 50%; background: var(--green); box-shadow: 0 0 6px var(--green);
}
.lt-status.spinning > #syncText::before { background: var(--ink-2); box-shadow: none; }
.lt-status.err > #syncText::before { background: var(--red); box-shadow: 0 0 6px rgba(255, 122, 107, .7); }
.lt-status > .lt-sync { flex: none; }
.lt-sync {
  display: inline-block; width: 13px; height: 13px; margin-left: -4px; vertical-align: -1px;
  fill: none; stroke: var(--blue); stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round;
}
.lt-status.spinning .lt-sync { animation: spin 600ms linear infinite; }
.lt-status.err #syncText { color: var(--red); }

/* 1px marker the docking observer watches; the style bar sits 8px under it */
#styleSentinel { height: 1px; margin-top: 3px; pointer-events: none; }

/* ---------- docked style bar (Meta; SPEC §7.2): a floating glass segmented control once stuck ---------- */
.style-bar {
  position: sticky; top: calc(var(--stick) + 4px); z-index: var(--z-dock);
  margin: 8px 0 0; padding: 0; background: transparent; box-shadow: none;
}
.style-bar.hidden { display: none; }
.style-bar > .seg {
  position: relative; display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); align-items: stretch;
  height: 36px; margin: 0; padding: 3px; border-radius: var(--r-seg);
  background: var(--glass-faux); box-shadow: var(--spec);
  transition: box-shadow 200ms var(--ease-out);
}
.style-bar.stuck > .seg {
  background: var(--glass-regular); -webkit-backdrop-filter: var(--blur-regular); backdrop-filter: var(--blur-regular);
  box-shadow: var(--spec), var(--sh-float);
}
.style-bar > .seg > button {
  position: relative; z-index: 1; min-width: 0; margin: -4px 0; padding: 4px 8px; border-radius: var(--r-seg-thumb);
  font: 600 var(--fs-seg)/22px var(--font-ui); color: var(--ink-2); text-align: center;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  transition: color 160ms var(--ease-out);
}
.style-bar > .seg > button::before { content: none; }   /* no separators: the faux track carries enough contrast */
.style-bar > .seg > button:is(.on, [aria-selected="true"]) { font-weight: 700; color: var(--on-accent); }
/* .style-glider plays the .seg-thumb role and keeps the [data-on] transform contract */
.style-bar > .seg > .style-glider {
  position: absolute; z-index: 0; top: 3px; bottom: 3px; left: 3px; width: calc((100% - 6px) / 3);
  border-radius: var(--r-seg-thumb); background: var(--accent-fill); box-shadow: var(--glow-accent);
  pointer-events: none; transform: none; opacity: 1;
  transition: transform 420ms var(--spring-lens), scale 320ms var(--spring-pop);
}
.style-bar[data-on="balanced"] > .seg > .style-glider { transform: translateX(100%); }
.style-bar[data-on="range"] > .seg > .style-glider { transform: translateX(200%); }
.style-bar > .seg:has(> button.on:active) > .style-glider { scale: .96; transition-duration: 420ms, var(--dur-press); }

/* ---------- floating glass tab bar (SPEC §5) ---------- */
.tabbar {
  position: absolute; z-index: var(--z-nav); left: max(var(--tab-x), var(--safe-l)); right: max(var(--tab-x), var(--safe-r));
  bottom: var(--tab-bottom); height: var(--tab-h); padding: 0 4px; border-radius: var(--r-tabbar);
  display: grid; grid-template-columns: repeat(5, minmax(0, 1fr));
  background: var(--glass-regular); -webkit-backdrop-filter: var(--blur-regular); backdrop-filter: var(--blur-regular);
  box-shadow: var(--spec), var(--sh-float);
  transition: transform var(--dur-present) var(--spring-sheet), opacity 260ms var(--ease-out);
}
.tabbar::after {   /* the .rim recipe: a refractive specular edge */
  content: ''; position: absolute; inset: 0; border-radius: inherit; padding: 1px; pointer-events: none;
  background: var(--rim);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0); -webkit-mask-composite: xor;
          mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0); mask-composite: exclude;
}
.tabbar button {
  position: relative; z-index: 1; height: var(--tab-h); min-width: 0; padding: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  color: var(--ink-2); text-align: center; border-radius: var(--r-lens);
  transition: color 200ms var(--ease-out);
}
.tabbar button > svg {
  width: 26px; height: 26px; flex: none;
  fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round;
  transition: transform 320ms var(--spring-pop);
}
.tabbar button > svg .f { fill: currentColor; fill-opacity: 0; }
.tabbar button > span:not(.tab-dot) {
  display: block; max-width: calc(100% - 4px);
  font: 700 var(--fs-tab)/var(--lh-tab) var(--font-ui); font-stretch: var(--wd-cond); letter-spacing: .1em; text-transform: uppercase;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.tabbar button.on { color: var(--blue); }
.tabbar button.on > svg { filter: var(--glow-glyph); }
.tabbar button.on > svg .f { fill-opacity: .18; }
.tabbar button.on::before { content: none; }
.tabbar button:active > svg { transform: scale(.9); transition-duration: var(--dur-press); transition-timing-function: var(--ease-out); }
/* badge: an element inside the button, or the class on the button itself */
@media (min-height: 501px) and (max-height: 700px) {
  .tabbar button { gap: 2px; }
  .tabbar button > svg { width: 24px; height: 24px; }
}
.tabbar button > .tab-dot,
.tabbar button.tab-dot::after,
.tabbar-mini > .tab-dot {
  content: ''; position: absolute; top: 8px; left: calc(50% + 8px);
  width: 9px; height: 9px; margin: 0; border-radius: 50%; background: var(--red); pointer-events: none;
  box-shadow: 0 0 0 2px rgba(8, 16, 29, .95);
}
.tabbar-mini > .tab-dot { top: 9px; left: auto; right: 9px; }

/* the lens: the selection, which slides and squashes like a drop of liquid (§5.2) */
.tab-lens {
  position: absolute; z-index: 0; top: 4px; bottom: 4px; left: 4px; width: calc((100% - 8px) / 5);
  border-radius: var(--r-lens); background: var(--lens-fill);   /* the rim (5.4:1 on the bar) marks the selected tab without relying on hue (WCAG 1.4.11) */
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .35), inset 0 0 0 1.5px rgba(150, 215, 255, .62), 0 0 18px rgba(40, 140, 255, .30);
  transform: translateX(calc(var(--tab-i, 0) * 100%));
  transition: transform var(--dur-lens) var(--spring-lens);
  will-change: transform; pointer-events: none;
}
:root[data-vt] .tab-lens { transition: none; }   /* during a View Transition the lens is a shared element (§6.2) */

/* minimise while reading (§5.3): the capsule sinks away and a 52pt glass button keeps the current tab */
.tabbar-mini {
  position: absolute; z-index: var(--z-nav); left: max(var(--tab-x), var(--safe-l)); bottom: calc(var(--tab-bottom) + 5px);
  width: var(--mini); height: var(--mini); border-radius: 50%;
  display: grid; place-items: center; color: var(--blue);
  opacity: 0; transform: scale(.6); visibility: hidden; pointer-events: none; transform-origin: 50% 50%;
  transition: transform 160ms var(--ease-in), opacity 160ms var(--ease-in), visibility 0s linear 160ms;
}
.tabbar-mini > svg {
  width: 26px; height: 26px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round;
  filter: var(--glow-glyph);
}
.tabbar-mini > svg .f { fill: currentColor; fill-opacity: .18; }
.tabbar-mini:active { scale: .94; }
#app.tabs-mini .tabbar {
  transform: translateY(calc(100% + var(--tab-bottom) + 8px)); opacity: 0; pointer-events: none;
  transition: transform 260ms var(--ease-in), opacity 200ms var(--ease-in);
}
#app.tabs-mini .tabbar-mini {
  opacity: 1; transform: none; visibility: visible; pointer-events: auto;
  transition: transform var(--dur-mini) var(--spring-pop), opacity 200ms var(--ease-out), visibility 0s, scale 320ms var(--spring-pop);
}

/* ---------- page sheets (SPEC §4.4, §4.6): full height and opaque, their chrome is glass ---------- */
.sheet {
  position: absolute; top: 0; left: 0; right: 0; bottom: 0; z-index: var(--z-sheet);
  transform-origin: 50% 0;   /* a sheet under the PDF viewer scales back from its top edge (and returns the same way) */
  overflow-x: hidden; overflow-y: auto; -webkit-overflow-scrolling: touch; overscroll-behavior: contain;
  border-radius: 0;
  background: var(--aura), linear-gradient(180deg, var(--bg-top), var(--bg) 38%);
  background-color: var(--bg);
  box-shadow: var(--sh-sheet);
  transform: translateY(100%); visibility: hidden;
  transition: transform var(--dur-dismiss) var(--ease-in), visibility 0s linear var(--dur-dismiss);
}
.sheet.open {
  transform: none; visibility: visible;
  transition: transform var(--dur-present) var(--spring-sheet), visibility 0s linear 0s;
}
.sheet:is(.presenting, .dragging) { border-radius: var(--r-sheet); }   /* a card while it moves, a page at rest */
/* grows from the tapped tile or row (app.js presents it with WAAPI; the CSS slide must not start) */
.sheet.presenting { transition: none; visibility: visible; overflow: hidden; will-change: transform, opacity; }
.sheet.dragging { transition: none !important; }
/* keyboard focus and scrollIntoView land clear of the sticky header and of the bottom bar */
.sheet { scroll-padding-top: calc(var(--safe-t) + 58px); }
.sheet:has(.sh-bar) { scroll-padding-bottom: calc(var(--sheet-bar) + 12px); }
/* sticky chrome is always on screen, so focusing its own controls never scrolls the content behind it
   (each negative margin cancels the scroll-padding on that side; #scroller's is in base.css) */
.style-bar * { scroll-margin-top: calc(-1 * (var(--stick-col) + 36px)); }
.sh-top * { scroll-margin-top: calc(-1 * (var(--safe-t) + 58px)); }
.sh-bar * { scroll-margin-bottom: calc(-1 * (var(--sheet-bar) + 12px)); }
#sheet { z-index: 20; } #lsheet { z-index: 22; } #editor { z-index: 24; } #tsheet { z-index: 26; } #csheet { z-index: 28; }

/* the sheet is the scroll container; the inner column keeps the bottom bar pinned when content is short */
.sheet-inner {
  min-height: 100%; min-width: 0; display: flex; flex-direction: column;
  padding: 0 var(--g) calc(24px + var(--safe-b));
  overflow-x: clip;   /* nothing (a long word at the largest text sizes) can make the sheet scroll sideways */
}
.sheet-inner > * { flex-shrink: 0; min-width: 0; }
.sheet-inner > :where(button, a, span, img, svg) { align-self: flex-start; }
.sheet-inner:has(> .sh-bar) { padding-bottom: 0; }

/* header (§3.2): grabber, leading action, the brand lockup (drawn here), trailing action */
.sh-top {
  position: sticky; top: 0; z-index: 5; isolation: isolate;
  height: calc(var(--safe-t) + 50px); padding-top: calc(var(--safe-t) + 6px); margin-inline: calc(var(--g) * -1);
  padding-inline: max(4px, calc(var(--g) - 11px));
  display: flex; align-items: center; gap: 4px;
  background: transparent; box-shadow: none;
}
.sh-top > * { flex: none; }
/* a pull on the header dismisses the sheet at any scroll position (app.js setupSheet), so it never scrolls first */
.sheet .sh-top { touch-action: none; }
/* trailing actions sit right; the compact title is centered over the bar */
.sh-top > .sh-ctitle + :not(.sh-grab),
.sh-top > .sh-ctitle + .sh-grab + *,
.sh-top:not(:has(> .sh-ctitle)) > :last-child:not(:first-child) { margin-left: auto; }
.sh-grab {
  position: absolute; top: calc(var(--safe-t) + 3px); left: 50%; width: 36px; height: 4px; margin-left: -18px; z-index: 1;
  border-radius: 3px; background: var(--ink-2); opacity: .5; pointer-events: none;
}
/* scroll-edge glass behind the header: fades in as soon as content runs under it */
.sheet .sh-top::before {
  content: ''; position: absolute; inset: 0 0 -16px; z-index: -1; pointer-events: none; opacity: 0;
  background: var(--glass-regular); -webkit-backdrop-filter: var(--blur-regular); backdrop-filter: var(--blur-regular);
  -webkit-mask-image: linear-gradient(#000 calc(100% - 22px), transparent); mask-image: linear-gradient(#000 calc(100% - 22px), transparent);
  transition: opacity 150ms var(--ease-out);
}
.sheet:is(.edge, .scrolled) .sh-top::before { opacity: 1; }
/* the lockup, centred in the 44pt row (behind the buttons, never takes taps) */
.sheet .sh-top::after {
  content: ''; position: absolute; left: 50%; top: calc(var(--safe-t) + 11px); width: 138px; height: 40px;
  margin-left: -69px; pointer-events: none; z-index: -1;
  background:
    image-set(url("../assets/brand/mascot.webp") type("image/webp") 3x, url("../assets/brand/mascot.png") 3x) left bottom / 44px auto no-repeat,
    image-set(url("../assets/brand/wordmark.webp") type("image/webp") 3x, url("../assets/brand/wordmark.png") 3x) right 0 top 0 / 96px auto no-repeat;
  filter: drop-shadow(0 0 8px rgba(56, 160, 255, .28));
  transition: opacity 180ms var(--ease-out), transform 180ms var(--ease-out);
}
.sheet.scrolled .sh-top::after { opacity: 0; transform: translateY(-6px) scale(.94); }
/* compact title: the mascot stays as its badge, so the brand never leaves */
.sh-ctitle {
  position: absolute; top: calc(var(--safe-t) + 6px); left: 50%;
  max-width: 56%; height: 44px; margin: 0; padding-left: 34px;
  background: image-set(url("../assets/brand/mascot.webp") type("image/webp") 3x, url("../assets/brand/mascot.png") 3x) left center / 28px auto no-repeat;
  font: 700 var(--fs-nav)/44px var(--font-ui); font-stretch: var(--wd-cond); letter-spacing: .04em; text-transform: uppercase;
  color: var(--ink); text-align: center;   /* chrome: fixed size */
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  opacity: 0; transform: translate(-50%, 6px); pointer-events: none;
  transition: opacity 180ms var(--ease-out), transform 180ms var(--ease-out);
}
.sheet.scrolled .sh-ctitle { opacity: 1; transform: translate(-50%, 0); }
/* a sheet with a large title shows the lockup at rest even where its module pinned the title on (inline opacity) */
.sheet:not(.scrolled) .sheet-inner:has(.sh-h1) > .sh-top > .sh-ctitle { opacity: 0 !important; }
/* a sheet without a large title (the editor, the composer, the PDF viewer): its compact title is its only heading,
   so it shows at rest with the mascot badge, and the wordmark stays out of its way */
.sheet-inner:not(:has(.sh-h1)) > .sh-top::after { display: none; }
.sheet-inner:not(:has(.sh-h1)) > .sh-top > .sh-ctitle { opacity: 1; transform: translate(-50%, 0); }

.sh-h1 {
  margin: 0; color: var(--ink); overflow-wrap: anywhere;
  font: 800 var(--fs-large)/var(--lh-large) var(--font-ui); font-stretch: var(--wd-cond); letter-spacing: -0.2px;
}
#tsheet .sh-h1 { font: 700 var(--fs-title2)/var(--lh-title2) var(--font-ui); font-stretch: 100%; letter-spacing: 0; }

/* header actions are chrome (fixed size), restyled as glass: icon actions wear the disc, text actions a capsule */
.sh-top :is(button, .btn) { font-size: var(--fs-nav); }
.sheet .sh-top .icon-btn { isolation: isolate; color: var(--blue); }
.sheet .sh-top .icon-btn::before {
  content: ''; position: absolute; z-index: -1; inset: 4px; border-radius: 50%;
  background: var(--glass-thin);   /* no blur of its own: it sits on its bar's glass or the still ground (§4.1 budget) */
  box-shadow: var(--spec), 0 4px 12px rgba(0, 0, 0, .35);
  transition: transform 320ms var(--spring-pop);
}
.sheet .sh-top .btn.plain {
  position: relative; isolation: isolate; min-height: 44px; padding: 0 14px; gap: 2px;
  font: 600 var(--fs-nav)/22px var(--font-ui); color: var(--blue);
}
.sheet .sh-top .btn.plain:is([data-sq="closeE"], [data-sx="closeC"], .cancel) { font-weight: 400; }
.sheet .sh-top .btn.plain.sh-back { padding: 0 14px 0 8px; font-weight: 400; }
.sheet .sh-top .btn.plain::before {
  content: ''; position: absolute; z-index: -1; inset: 4px 0; border-radius: 18px;
  background: var(--glass-thin);   /* no blur of its own: it sits on its bar's glass or the still ground (§4.1 budget) */
  box-shadow: var(--spec), 0 4px 12px rgba(0, 0, 0, .35);
  transition: transform 320ms var(--spring-pop);
}
.sheet .sh-top :is(.icon-btn, .btn.plain):active { opacity: 1; filter: none; }
.sheet .sh-top :is(.icon-btn, .btn.plain):active::before { transform: scale(.94); transition-duration: var(--dur-press); transition-timing-function: var(--ease-out); }
.sheet .sh-top .btn.plain:disabled { opacity: .45; }
.sheet .sh-top :is(.icon-btn, .btn.plain):focus-visible { outline-offset: -2px; border-radius: 22px; }

/* bottom bar: glass that fades in upward, no hairline */
.sh-bar {
  position: sticky; bottom: 0; z-index: 5; isolation: isolate;
  margin: auto calc(var(--g) * -1) 0; padding: 10px var(--g) max(var(--safe-b), 12px);
  background: none; box-shadow: none;
}
.sh-bar::before {
  content: ''; position: absolute; inset: -18px 0 0; z-index: -1; pointer-events: none;
  background: var(--glass-regular); -webkit-backdrop-filter: var(--blur-regular); backdrop-filter: var(--blur-regular);
  -webkit-mask-image: linear-gradient(transparent, #000 18px); mask-image: linear-gradient(transparent, #000 18px);
}
.sheet-inner > .sh-bar { margin-top: auto; }
.sh-bar .btn { font-size: min(1rem, 22px); white-space: nowrap; }
.sheet-inner > :has(+ .sh-bar) { margin-bottom: 24px; }   /* flex margins add, so the bar keeps a 24px gap */

/* card stack: the page behind a sheet dims, and on phones recedes (seen while a sheet presents, dismisses or drags) */
/* transform only: the corner radius snaps (at scale 1 it sits under the screen's own corners), so the clipped stage
   isn't repainted every frame */
#stage { transition: transform var(--dur-present) var(--spring-sheet); }
#stage::after {
  content: ''; position: absolute; inset: 0; z-index: 30; background: var(--scrim);
  opacity: 0; pointer-events: none; transition: opacity var(--dur-present) var(--ease-out);
}
#app:has(.sheet.open) #stage::after { opacity: 1; }
@media (max-width: 600px) and (prefers-reduced-motion: no-preference) {
  :root:not([data-motion="reduce"]) #app:has(.sheet.open) #stage {
    transform: translateY(calc(var(--safe-t) + 6px)) scale(.94); border-radius: var(--r-stage); overflow: hidden;
  }
  /* a sheet under the PDF viewer or the player card recedes too (its .open transition animates it both ways) */
  :root:not([data-motion="reduce"]) #app:has(#pdfview.open) .sheet.open:not(#pdfview),
  :root:not([data-motion="reduce"]) #app:has(#psheet.open) .sheet.open:not(#psheet, #pdfview) { transform: scale(.94); border-radius: var(--r-sheet); }
}

/* ---------- PDF viewer #pdfview (§7.17; pdfview.js) ---------- */
/* a full-height page sheet over the weapon sheet (it opens from that sheet's share sheet), under #xsheet and the
   toast. Paper scrolls under its header, so the header and bar are always thick glass. */
#pdfview { z-index: 30; top: 0; }
.pdfv .sh-top::after { display: none; }
.pdfv .sh-ctitle { opacity: 1; transform: translate(-50%, 0); max-width: calc(100% - 140px); }
.pdfv .sh-top::before {
  opacity: 1; inset: 0; -webkit-mask-image: none; mask-image: none; box-shadow: inset 0 -1px 0 rgba(150, 215, 255, .12);
  background: var(--glass-thick); -webkit-backdrop-filter: var(--blur-thick); backdrop-filter: var(--blur-thick);
}
.pdfv .sh-bar::before {
  inset: 0; -webkit-mask-image: none; mask-image: none; box-shadow: inset 0 1px 0 rgba(150, 215, 255, .12);
  background: var(--glass-thick); -webkit-backdrop-filter: var(--blur-thick); backdrop-filter: var(--blur-thick);
}
.pv-pages { display: flex; flex-direction: column; gap: var(--s-6); padding-top: var(--s-2); }
.pv-page { position: relative; min-width: 0; }
/* paper on the frost ground: the page slot is already paper with a spinner until its canvas lands, then the page
   fades in over it */
.pv-sheet {
  position: relative; display: grid; place-items: center; width: 100%; aspect-ratio: 612 / 792;
  overflow: hidden; border-radius: var(--r-thumb);
  background: var(--pdf-page); color: var(--pdf-ink3);
  box-shadow: 0 0 0 1px rgba(150, 215, 255, .14), 0 14px 30px -12px rgba(0, 0, 0, .7);
  touch-action: manipulation;   /* a double tap is ours (zoom), not the browser's */
}
.pv-sheet > canvas {
  position: absolute; inset: 0; display: block; width: 100%; height: 100%; max-width: none;
  animation: fade-in var(--dur-state) var(--ease-out) both;
}
.pv-sheet > canvas.again { animation: none; }   /* a redraw (zoom, rotation) swaps in place */
/* double-tap zoom: the page at twice the width, edge to edge, scrolling sideways on its own (its caption stays) */
.pv-page.zoom > .pv-zoom {
  overflow-x: auto; overflow-y: hidden; overscroll-behavior-x: contain; scrollbar-width: none;
  margin-inline: calc(var(--g) * -1); padding: var(--s-2) var(--g); margin-block: calc(var(--s-2) * -1);
}
.pv-page.zoom > .pv-zoom::-webkit-scrollbar { display: none; }
.pv-page.zoom .pv-sheet { width: 200%; }
/* the VoiceOver text copy: transparent, untouchable, each stop over its own text on the page */
.pv-sheet > .pv-text {
  position: absolute; inset: 0; z-index: 1; overflow: hidden;
  color: transparent; font: 400 var(--fs-caption)/1.25 var(--font-ui);
  pointer-events: none; -webkit-user-select: none; user-select: none;
}
.pv-text > * { position: absolute; margin: 0; overflow: hidden; font: inherit; }
.pv-text > h3 { left: 0; top: 0; width: 100%; height: 4%; }
.pv-spin { display: grid; place-items: center; }
.pv-spin svg { width: 22px; height: 22px; animation: spin 800ms steps(8) infinite; }
.pv-cap {
  margin-top: var(--s-2); text-align: center;
  font: 400 var(--fs-footnote)/var(--lh-footnote) var(--font-ui); color: var(--ink-2);
}
/* "Page 1 of 4": the numerals are data, Martian Mono at the footnote's size */
.pv-n { font-family: var(--font-data); font-weight: 500; font-size: var(--fs-ds); font-variant-numeric: tabular-nums; font-stretch: var(--wd-semi); }
.pv-err { padding: var(--s-12) var(--s-4); text-align: center; color: var(--ink-2); font: 400 var(--fs-callout)/var(--lh-callout) var(--font-ui); }
.pv-err p + p { margin-top: var(--s-1); color: var(--ink-3); font-size: var(--fs-footnote); line-height: var(--lh-footnote); }
.pv-err .link { margin-top: var(--s-4); }
/* the viewer that can't save files: a footnote over the pages, and only a secondary Copy link in the bar */
.pv-foot { margin: var(--s-2) 0 var(--s-3); font: 400 var(--fs-footnote)/var(--lh-footnote) var(--font-ui); color: var(--ink-2); text-align: center; }
/* a toast clears the bottom bar, whatever its height (pdfview.js measures it into --pv-bar) */
#app:has(#pdfview.open) .toast { bottom: calc(var(--pv-bar, var(--sheet-bar)) + 10px); }

/* ---------- share sheet #xsheet frame (SPEC §7.16; rows and preview live in screens.css) ---------- */
/* a full-height opaque page with a back control, over everything but the drawer, menus, level-up and toast */
.xsheet { position: absolute; inset: 0; z-index: var(--z-xsheet); display: none; }
.xsheet.open { display: block; }
.xs-back { position: absolute; inset: 0; background: var(--scrim); animation: fade-in 200ms var(--ease-out) both; }
.xs-panel {
  position: absolute; inset: 0; height: auto; min-height: 0; max-height: none;
  overflow-x: hidden; overflow-y: auto; -webkit-overflow-scrolling: touch; overscroll-behavior: contain;
  border-radius: 0;
  background: var(--aura), linear-gradient(180deg, var(--bg-top), var(--bg) 38%);
  background-color: var(--bg);
  box-shadow: var(--sh-sheet);
  padding: 0 var(--g) calc(16px + var(--safe-b));
  --eyelet: var(--surface);
  transform-origin: 50% 0;
  animation: sheet-up var(--dur-present) var(--spring-sheet) both;
}
/* today's header (grabber + title row) until share.js draws the .xs-top header */
.xs-panel:not(:has(> .xs-top)) { padding-top: calc(var(--safe-t) + 6px); }
.xs-panel.full, .xs-panel.expanded, .xsheet.full .xs-panel { height: auto; }   /* already full: drag-to-expand is a no-op */
.xs-panel.dragging { transition: none !important; animation: none; border-radius: var(--r-sheet); }
.xs-grab { flex: none; width: 36px; height: 5px; margin: 0 auto 12px; border-radius: 3px; background: var(--ink-2); opacity: .5; }
.xs-panel { scroll-padding-bottom: calc(16px + var(--safe-b)); scroll-padding-top: calc(var(--safe-t) + 58px); }
/* the brand header (§7.16, for share.js): grabber, back control, centred lockup, system-share glyph */
.xs-top {
  position: sticky; top: 0; z-index: 5; isolation: isolate;
  height: calc(var(--safe-t) + 50px); padding-top: calc(var(--safe-t) + 6px);
  margin-inline: calc(var(--g) * -1); padding-inline: max(4px, calc(var(--g) - 11px));
  display: grid; grid-template-columns: 44px minmax(0, 1fr) 44px; align-items: center;
}
.xs-top > .icon-btn:first-of-type { grid-column: 1; }
.xs-top > :last-child:not(.sh-grab):not(.xs-brand) { grid-column: 3; }
.xs-top > .xs-brand { grid-column: 2; }
.xs-top::before {
  content: ''; position: absolute; inset: 0 0 -16px; z-index: -1; pointer-events: none; opacity: 0;
  background: var(--glass-thick); -webkit-backdrop-filter: var(--blur-thick); backdrop-filter: var(--blur-thick);
  -webkit-mask-image: linear-gradient(#000 calc(100% - 22px), transparent); mask-image: linear-gradient(#000 calc(100% - 22px), transparent);
  transition: opacity 150ms var(--ease-out);
}
.xs-panel.scrolled .xs-top::before { opacity: 1; }
.xs-top .sh-grab { top: calc(var(--safe-t) + 3px); }
.xs-brand {
  justify-self: center; align-self: end; width: 138px; height: 40px; margin-bottom: -2px; pointer-events: none;
  background:
    image-set(url("../assets/brand/mascot.webp") type("image/webp") 3x, url("../assets/brand/mascot.png") 3x) left bottom / 44px auto no-repeat,
    image-set(url("../assets/brand/wordmark.webp") type("image/webp") 3x, url("../assets/brand/wordmark.png") 3x) right 0 top 0 / 96px auto no-repeat;
  filter: drop-shadow(0 0 8px rgba(56, 160, 255, .28));
}
.xs-top .icon-btn { isolation: isolate; color: var(--blue); }
.xs-top .icon-btn::before {
  content: ''; position: absolute; z-index: -1; inset: 4px; border-radius: 50%;
  background: var(--glass-thin);   /* no blur of its own: it sits on its bar's glass or the still ground (§4.1 budget) */
  box-shadow: var(--spec), 0 4px 12px rgba(0, 0, 0, .35);
  transition: transform 320ms var(--spring-pop);
}
.xs-top .icon-btn:active { opacity: 1; }
.xs-top .icon-btn:active::before { transform: scale(.94); transition-duration: var(--dur-press); }

/* ---------- menu drawer (SPEC §3.4): a floating thick-glass panel from the leading edge ---------- */
.drawer { position: absolute; inset: 0; z-index: var(--z-drawer); display: none; }
.drawer.open { display: block; }
.dr-scrim {
  position: absolute; inset: 0; background: rgba(2, 5, 10, .45);
  opacity: 0; transition: opacity var(--dur-dismiss) var(--ease-in);
}
.drawer.shown .dr-scrim { opacity: 1; transition: opacity 300ms var(--ease-out); }
.dr-panel {
  position: absolute; left: max(8px, var(--safe-l)); top: calc(var(--safe-t) + 8px); bottom: max(8px, var(--safe-b));
  width: min(320px, calc(100% - 56px)); overflow: hidden;
  border-radius: var(--r-drawer);
  background: var(--glass-thick); -webkit-backdrop-filter: var(--blur-thick); backdrop-filter: var(--blur-thick);
  box-shadow: var(--spec), var(--sh-float);
  transform: translateX(calc(-100% - 16px));
  transition: transform var(--dur-dismiss) var(--ease-in);
  touch-action: pan-y;
}
.drawer.shown .dr-panel { transform: none; transition: transform var(--dur-present) var(--spring-sheet); }
.drawer.dragging .dr-panel { transition: none; }
/* the panel's content scrolls inside it, so the glass rim (.rim::after) and the --spec edge stay put on the panel */
.dr-scroll {
  position: absolute; inset: 0; overflow: hidden auto; overscroll-behavior: contain;
  border-radius: inherit; padding: 14px 12px 16px; touch-action: pan-y;
}
.dr-page { position: relative; min-height: 100%; }
.dr-head { position: relative; padding: 6px 4px 14px; }
.dr-brand { justify-self: start; justify-content: flex-start; width: max-content; --brand-m: 44px; --brand-w: 46px; height: 50px; pointer-events: none; }
.dr-brand.fb .brand-fb { align-self: center; }
.dr-tag { margin-top: 6px; font: 500 var(--fs-footnote)/var(--lh-footnote) var(--font-ui); color: var(--ink-2); }
.dr-x { position: absolute; top: 0; right: -4px; }
.dr-x > svg { filter: none; }
.dr-list { margin: 0 -2px; }
.dr-row {
  display: grid; grid-template-columns: 24px minmax(0, 1fr) auto; align-items: center; column-gap: 14px;
  width: 100%; min-height: 60px; padding: 10px 12px; border-radius: 16px; text-align: left; color: var(--ink);
  transition: background-color 200ms linear;
}
.dr-row b { display: block; font: 600 var(--fs-headline)/var(--lh-headline) var(--font-ui); }
.dr-row small { display: block; margin-top: 1px; font: 400 var(--fs-footnote)/var(--lh-footnote) var(--font-ui); color: var(--ink-2); }
button.dr-row:active { background: rgba(92, 200, 255, .10); transition: none; }
.dr-list > li + li { box-shadow: inset 0 1px 0 rgba(150, 215, 255, .08); }
.dr-row.soon { color: var(--ink-2); }
.dr-row.soon b { color: var(--ink-2); }
.dr-g { width: 24px; height: 24px; fill: none; stroke: var(--ink-2); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
button.dr-row .dr-g { stroke: var(--blue); }
.dr-chev { width: 7px; height: 12px; fill: none; stroke: var(--ink-2); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; opacity: .6; }
.dr-chev.dn { width: 10px; height: 6px; transition: transform 300ms var(--spring-pop); }
.dr-row[aria-expanded="true"] .dr-chev.dn { transform: rotate(180deg); }
.soon-tag {
  font: 600 11px/20px var(--font-ui); font-style: normal; padding: 0 8px; border-radius: 10px;
  color: var(--ink-2); background: rgba(150, 215, 255, .10); box-shadow: inset 0 0 0 1px rgba(150, 215, 255, .18); white-space: nowrap;
}
.dr-tip { display: flex; flex-wrap: wrap; gap: 8px; padding: 4px 12px 12px 50px; }
.dr-tip .btn.secondary { flex: 1 1 120px; width: auto; margin: 0; }
.dr-tip .btn + .btn { margin-top: 0; }
.dr-note { flex: 1 1 100%; font: 400 var(--fs-footnote)/var(--lh-footnote) var(--font-ui); color: var(--ink-2); }
/* version and credits under the menu list (version.js fills the text) */
.dr-foot { margin: 18px 12px 4px; padding-top: 12px; box-shadow: inset 0 1px 0 rgba(150, 215, 255, .08); }
.dr-foot p { font: 400 var(--fs-footnote)/var(--lh-footnote) var(--font-ui); color: var(--ink-2); }
.dr-foot .dr-ver { font-weight: 600; color: var(--ink); }
.dr-foot .dr-ver:empty { display: none; }
.dr-about .dr-card p.dr-ver { margin-top: 8px; font-weight: 600; color: var(--ink); }
/* About, pushed inside the drawer */
.dr-about { padding: 2px 2px 8px; }
.dr-back { position: relative; isolation: isolate; display: inline-flex; align-items: center; gap: 4px; min-height: 44px; padding: 0 14px 0 10px;
  font: 400 var(--fs-nav)/22px var(--font-ui); color: var(--blue); }
.dr-back::before {
  content: ''; position: absolute; z-index: -1; inset: 4px 0; border-radius: 18px;
  background: var(--glass-thin); box-shadow: var(--spec);
}
.dr-back > svg { width: 9px; height: 15px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.dr-about h2 { margin: 12px 4px 12px; font: 700 var(--fs-title3)/var(--lh-title3) var(--font-ui); color: var(--ink); }
.dr-about .group {
  margin: 0; border-radius: var(--r-group); overflow: hidden;
  background: linear-gradient(180deg, var(--panel-top), var(--panel-bot)); box-shadow: var(--edge-frost);
}
.dr-about .dr-card { padding: 14px 16px; }
.dr-about .dr-card b { display: block; font: 600 var(--fs-headline)/var(--lh-headline) var(--font-ui); color: var(--ink); }
.dr-about .dr-card p { margin-top: 2px; font: 400 var(--fs-callout)/var(--lh-callout) var(--font-ui); color: var(--ink-2); }
.dr-about .dr-card p.dr-data { margin-top: 8px; font-size: var(--fs-footnote); line-height: var(--lh-footnote); }
.dr-about .grow.dr-act {
  display: flex; align-items: center; width: 100%; min-height: 48px; padding: 0 16px; text-align: left;
  font: 500 var(--fs-headline)/22px var(--font-ui); color: var(--blue);
  box-shadow: inset 0 1px 0 rgba(150, 215, 255, .08);
}
.dr-about .grow.dr-act:active { background: rgba(92, 200, 255, .10); }
.dr-about .dr-legal { margin: 14px 4px 0; font: 400 var(--fs-footnote)/var(--lh-footnote) var(--font-ui); color: var(--ink-2); }

/* ---------- pull-down menu (§7.18): thick glass, grows from its anchor ---------- */
.menu-layer { position: absolute; inset: 0; z-index: var(--z-menu); display: none; background: transparent; }
.menu-layer.open, .menu-layer.show, .menu-layer:not([hidden]):not(:empty) { display: block; }
.menu {
  position: absolute; width: 250px; max-width: calc(100% - 2 * var(--g));
  max-height: calc(100% - var(--safe-t) - var(--safe-b) - 120px); overflow: hidden auto; overscroll-behavior: contain;
  background: var(--glass-thick); -webkit-backdrop-filter: var(--blur-thick); backdrop-filter: var(--blur-thick);
  border-radius: var(--r-menu); box-shadow: var(--spec), var(--sh-menu);
  --eyelet: var(--surface);
  transform-origin: var(--menu-origin, top right);
  animation: menu-in var(--dur-menu) var(--spring-pop) both;
}
.menu::after {   /* rim */
  content: ''; position: absolute; inset: 0; border-radius: inherit; padding: 1px; pointer-events: none;
  background: var(--rim);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0); -webkit-mask-composite: xor;
          mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0); mask-composite: exclude;
}
.menu.ghost { pointer-events: none; animation: menu-out 160ms var(--ease-in) forwards; z-index: var(--z-menu); }
.menu.left, .menu.from-left { --menu-origin: top left; }
.menu-item {
  position: relative; display: flex; align-items: center; gap: 8px;
  width: 100%; min-height: 48px; padding: 13px 16px;
  font: 400 var(--fs-nav)/22px var(--font-ui); color: var(--ink); text-align: left;
  transition: background-color var(--dur-state) linear;
}
.menu-item:active { background: rgba(92, 200, 255, .10); transition: none; }
.menu-item + .menu-item { box-shadow: inset 0 1px 0 rgba(150, 215, 255, .08); }
.menu-item.danger, .menu-item.destructive { color: var(--red); }
.menu-item > svg { order: 1; width: 16px; height: 16px; margin-left: auto; flex: none; }   /* trailing glyph */
/* current item: a frost check at the leading edge (an element, or drawn here); every item lines up after it */
.menu-item > .menu-check {
  order: -1; position: absolute; left: 16px; top: 50%; width: 16px; height: 16px; margin: -8px 0 0; color: var(--blue);
}
.menu:has(.menu-item.on, .menu-item[aria-checked="true"], .menu-check) .menu-item { padding-left: 40px; }
/* drawn check. No :has() on the item: an attribute test inside :has() made every class
   change in the document restyle the whole tree (about 46ms a toggle with a sheet open) */
.menu-item:is(.on, [aria-checked="true"])::before {
  content: ''; position: absolute; left: 20px; top: 50%; width: 6px; height: 11px; margin-top: -7px;
  border: solid var(--blue); border-width: 0 2px 2px 0; transform: rotate(45deg);
  filter: drop-shadow(0 0 4px rgba(92, 200, 255, .6));
}
.menu-item:disabled, .menu-item[aria-disabled="true"] { opacity: .4; pointer-events: none; }

/* ---------- notices (§7.20): a thick-glass banner with a leading state dot ---------- */
/* Anchored above the floating tab capsule, clear of the toast (which sits just over the capsule): the large-title row
   now carries each tab's actions (#navTrail), and a slip at the top covered them until dismissed */
.flash-layer {
  position: absolute; bottom: calc(var(--tab-space) + 54px); left: var(--g); right: var(--g); z-index: var(--z-flash);
  display: flex; flex-direction: column; gap: 8px; pointer-events: none;
}
.flash-layer > * { pointer-events: auto; }
/* the drawer is modal: a notice waits behind it (out of the Tab order and the accessibility tree) and comes back
   when the drawer closes */
#app:has(#drawer.open) .flash-layer { visibility: hidden; }
.notice {
  position: relative; display: flex; align-items: center; gap: 12px;
  min-height: 52px; padding: 10px 14px 10px 30px; border: 0; border-radius: 18px;
  background: var(--glass-thick); -webkit-backdrop-filter: var(--blur-thick); backdrop-filter: var(--blur-thick);
  box-shadow: var(--spec), var(--sh-float);
  color: var(--ink-2); text-align: left;
  font: 400 var(--fs-footnote)/var(--lh-footnote) var(--font-ui);
}
.notice::before {   /* state dot: info (frost); live and errors red */
  content: ''; position: absolute; left: 12px; top: 50%; width: 8px; height: 8px; margin-top: -4px; border-radius: 50%;
  background: var(--blue); box-shadow: 0 0 6px rgba(92, 200, 255, .6);
}
.notice:is(.live, .error)::before { background: var(--red); box-shadow: 0 0 6px rgba(255, 122, 107, .6); }
.notice.ok::before, .notice.success::before { background: var(--green); box-shadow: 0 0 6px rgba(111, 224, 166, .5); }
.notice:has(.dot, .live-dot, .n-dot)::before { content: none; }
.flash-layer > .notice { animation: notice-in 360ms var(--spring-pop) both; }
.notice.out, .notice.hide { animation: notice-out 160ms var(--ease-in) forwards; }
/* a status banner inside a list: a solid panel with the same dot */
.notice.inline {
  margin-block: 12px; animation: none;
  background: linear-gradient(180deg, var(--panel-top), var(--panel-bot)); -webkit-backdrop-filter: none; backdrop-filter: none;
  box-shadow: var(--edge-frost);
}
.notice > :is(div, p, span):first-of-type { flex: 1 1 auto; min-width: 0; }
.notice :is(b, strong, .lead, .n-lead, .notice-lead) { font-weight: 600; color: var(--ink); }
.notice :is(button, a) {
  flex: none; display: inline-flex; align-items: center; justify-content: center;
  min-width: 44px; min-height: 44px; margin-block: -6px; padding: 0 4px;
  font: 600 15px/20px var(--font-ui); color: var(--blue);
  transition: opacity var(--dur-press) linear;
}
.notice :is(button, a):active { opacity: .5; }
.notice > :is(button, a):first-of-type { margin-left: auto; }
.notice :is(button, a) > svg { width: 16px; height: 16px; color: var(--ink-2); }
.notice.error :is(b, strong, .lead, .n-lead, .notice-lead) { color: var(--red); }
@media (prefers-reduced-motion: no-preference) {
  :root:not([data-motion="reduce"]) .notice.live::before,
  :root:not([data-motion="reduce"]) .notice.live :is(.dot, .live-dot, .n-dot) { animation: breathe 2s ease-in-out infinite alternate; }
}

/* ---------- toast (§7.19, §5.5): a thick-glass capsule over the tab capsule ---------- */
.toast {
  position: absolute; left: var(--g); right: var(--g); bottom: calc(var(--tab-bottom) + var(--tab-h) + 10px); z-index: var(--z-toast);
  width: -webkit-fit-content; width: fit-content; max-width: calc(100% - 2 * var(--g)); margin-inline: auto;
  display: flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 11px 18px; border-radius: var(--r-pill);
  background: var(--toast-bg); -webkit-backdrop-filter: var(--blur-thick); backdrop-filter: var(--blur-thick);
  color: var(--toast-text); box-shadow: var(--spec), var(--sh-menu);
  font: 600 var(--fs-subhead)/var(--lh-subhead) var(--font-ui); text-align: center;
  opacity: 0; transform: translateY(12px) scale(.96); pointer-events: none;
  /* opacity and transform only: the lift over a sheet's bottom bar (bottom) snaps, it isn't animated per frame */
  transition: opacity 180ms var(--ease-in), transform 180ms var(--ease-in);
}
.toast::after {   /* rim */
  content: ''; position: absolute; inset: 0; border-radius: inherit; padding: 1px; pointer-events: none;
  background: var(--rim);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0); -webkit-mask-composite: xor;
          mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0); mask-composite: exclude;
}
.toast:empty { visibility: hidden; }
.toast.show {
  opacity: 1; transform: none;
  transition: opacity 200ms var(--ease-out), transform 360ms var(--spring-pop);
}
.toast svg { width: 18px; height: 18px; flex: none; color: var(--toast-ok); filter: drop-shadow(0 0 4px rgba(111, 224, 166, .5)); }
#app:has(.sheet.open) .toast { bottom: calc(var(--sheet-bar) + 10px); }
/* over the share sheet the toast drops in below its header, so it never covers the action rows */
#app:has(#xsheet.open) .toast { bottom: auto; top: calc(var(--safe-t) + 60px); }
@media (prefers-reduced-motion: no-preference) {
  :root:not([data-motion="reduce"]) #app:has(#xsheet.open) .toast:not(.show) { transform: translateY(-12px) scale(.96); }
}

/* ---------- pull to refresh (§4.8) ---------- */
.ptr {
  --pull: 0px; height: var(--pull); overflow: hidden; margin-inline: calc(var(--g) * -1);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
  color: var(--ink-2); pointer-events: none;
  transition: height 200ms var(--ease-out);
}
.ptr.loading, .ptr.syncing, .ptr.spinning { height: max(var(--pull), 56px); }
.ptr-spin { position: relative; flex: none; width: 20px; height: 20px; }
.ptr-spin > i {
  --i: 0; position: absolute; top: 0; left: 9px; width: 2px; border-radius: 1px; background: currentColor;
  transform-origin: 1px 10px; transform: rotate(calc(var(--i) * 45deg));
  opacity: calc(.3 + var(--i) * .1);
  /* each spoke grows in once the pull passes its threshold, clockwise from the top */
  height: clamp(0px, calc(var(--pull) - 14px - var(--i) * 6px), 5.5px);
}
.ptr-spin > i:nth-child(2) { --i: 1; } .ptr-spin > i:nth-child(3) { --i: 2; } .ptr-spin > i:nth-child(4) { --i: 3; }
.ptr-spin > i:nth-child(5) { --i: 4; } .ptr-spin > i:nth-child(6) { --i: 5; } .ptr-spin > i:nth-child(7) { --i: 6; }
.ptr-spin > i:nth-child(8) { --i: 7; }
.ptr.loading .ptr-spin > i, .ptr.syncing .ptr-spin > i, .ptr.spinning .ptr-spin > i { height: 5.5px; }
.ptr.loading .ptr-spin, .ptr.syncing .ptr-spin, .ptr.spinning .ptr-spin,
#app:has(#syncBtn.spinning) .ptr-spin { animation: spin 800ms steps(8) infinite; }
.ptr-l { font: 400 var(--fs-footnote)/var(--lh-footnote) var(--font-ui); white-space: nowrap; }
.ptr-l > span { display: none; }
.ptr-l > .ptr-pull { display: inline; }
.ptr.ready .ptr-l > .ptr-pull { display: none; }
.ptr.ready .ptr-l > .ptr-rel { display: inline; }
/* while syncing only the spinner shows, centred: the status line under it already says "Syncing…" */
.ptr:is(.loading, .syncing, .spinning) .ptr-l { display: none; }

/* ---------- boot (§4.8): three blank ledger rows draw in, then "Opening the ledger…" ---------- */
.boot { position: relative; margin-top: 20px; color: var(--ink-2); font: 400 var(--fs-footnote)/var(--lh-footnote) var(--font-ui); text-align: left; }
.boot::before {
  content: ''; display: block; height: 216px; margin-bottom: 12px; margin-inline: calc(var(--g) * -1);
  background: repeating-linear-gradient(to bottom, transparent 0 71px, var(--rule) 71px 72px);
  transform-origin: 0 50%; animation: grow-x var(--dur-data) var(--ease-out) both;
}
.boot.small::before { height: 144px; }
.boot:has(.boot-row)::before { display: none; }
.boot-row { display: block; height: 72px; margin-inline: calc(var(--g) * -1); box-shadow: inset 0 -1px 0 var(--rule); transform-origin: 0 50%; animation: grow-x var(--dur-data) var(--ease-out) both; }

/* ---------- level-up and patch review layer (§7.14; the dialog lives in screens.css) ---------- */
/* the brand bar and the tab capsule stay undimmed above and below; the whole layer still takes the taps */
.levelup {
  position: absolute; inset: 0; z-index: var(--z-levelup); isolation: isolate;
  display: none; place-items: center;
  padding: calc(var(--safe-t) + var(--nav-h) + 8px) var(--panel-x) calc(var(--tab-space) - 8px);
  background: none;
}
.levelup::before {
  content: ''; position: absolute; inset: 0; z-index: -1; pointer-events: none; background: var(--scrim-strong);
  -webkit-mask-image: linear-gradient(transparent calc(var(--safe-t) + 44px), #000 calc(var(--safe-t) + 64px), #000 calc(100% - var(--tab-space)), transparent calc(100% - var(--tab-space) + 20px));
          mask-image: linear-gradient(transparent calc(var(--safe-t) + 44px), #000 calc(var(--safe-t) + 64px), #000 calc(100% - var(--tab-space)), transparent calc(100% - var(--tab-space) + 20px));
}
.levelup.show, .levelup.open { display: grid; animation: fade-in 200ms var(--ease-out) both; }
.levelup.out { animation: fade-out 200ms var(--ease-in) forwards; }
.levelup:has(> .as-sheet) { place-items: end stretch; padding: 0; }
.levelup:has(> .as-sheet)::before { -webkit-mask-image: none; mask-image: none; }
/* over the stage the scrim leaves the bars crisp; the page itself dims under them, so nothing reads at full
   strength next to the dialog or through the tab glass */
#scroller { transition: filter var(--dur-state) var(--ease-out); }
#app:has(#levelup.show) #scroller { filter: brightness(.45); }
/* over a page sheet there is no brand bar or tab bar to keep clear: the dialog takes the height, and the sheet's
   header and bottom bar dim with everything else (they look inert because they are) */
#app:has(.sheet.open) .levelup:not(:has(> .as-sheet)) { padding: calc(var(--safe-t) + 16px) var(--panel-x) calc(max(var(--safe-b), 8px) + 8px); }
#app:has(.sheet.open) .levelup::before { -webkit-mask-image: none; mask-image: none; }

/* ---------- tab to tab (§6.2): View Transitions, the bars and the lens named ---------- */
:root[data-vt^="tab"] #scroller   { view-transition-name: sf-content; }
:root[data-vt^="tab"] .navbar     { view-transition-name: sf-topbar; }
:root[data-vt^="tab"] .tabbar     { view-transition-name: sf-tabbar; }
:root[data-vt^="tab"] .tab-lens   { view-transition-name: sf-lens; }
::view-transition-old(root) { display: none; }
::view-transition-new(root) { animation: none; }
::view-transition-group(sf-topbar), ::view-transition-group(sf-tabbar) { animation: none; z-index: 2; }
::view-transition-old(sf-topbar), ::view-transition-old(sf-tabbar) { display: none; }
::view-transition-new(sf-topbar), ::view-transition-new(sf-tabbar) { animation: none; }
::view-transition-group(sf-content) { z-index: 1; animation: none; }
/* content never shows through the brand bar mid-transition: the destination bar appears at once (at rest it has
   no glass) and Chromium doesn't draw a named bar's ::before glass in the capture, so both snapshots are clipped to
   below the bar. Static clip, nothing animates but transform and opacity */
::view-transition-old(sf-content), ::view-transition-new(sf-content) { clip-path: inset(calc(var(--safe-t) + var(--bar-h)) 0 0); }
::view-transition-group(sf-lens) { z-index: 3; animation-duration: var(--dur-tab); animation-timing-function: var(--spring-lens); }
::view-transition-image-pair(sf-lens) { animation: sf-lens-squash var(--dur-tab) ease-in-out; }
::view-transition-old(sf-lens), ::view-transition-new(sf-lens) { animation: none; }
::view-transition-old(sf-lens) { display: none; }
:root[data-vt="tab-fwd"]::view-transition-old(sf-content)  { animation: sf-out-l var(--dur-tab-out) var(--ease-out) both; }
:root[data-vt="tab-fwd"]::view-transition-new(sf-content)  { animation: sf-in-r var(--dur-tab) var(--spring-sheet) both; }
:root[data-vt="tab-back"]::view-transition-old(sf-content) { animation: sf-out-r var(--dur-tab-out) var(--ease-out) both; }
:root[data-vt="tab-back"]::view-transition-new(sf-content) { animation: sf-in-l var(--dur-tab) var(--spring-sheet) both; }
@keyframes sf-out-l { to { transform: translateX(-6%); opacity: 0; } }
@keyframes sf-out-r { to { transform: translateX(6%); opacity: 0; } }
@keyframes sf-in-r  { from { transform: translateX(8%); opacity: 0; } }
@keyframes sf-in-l  { from { transform: translateX(-8%); opacity: 0; } }
@keyframes sf-lens-squash { 40% { transform: scale(1.16, .9); } }
/* fallback (no View Transitions): the content swaps at once and slides in from the side it came from */
#view.xfade-fwd, .topbar.xfade-fwd { animation: sf-in-r var(--dur-tab) var(--spring-sheet) both; }
#view.xfade-back, .topbar.xfade-back { animation: sf-in-l var(--dur-tab) var(--spring-sheet) both; }
/* reduced motion: a 120ms fade only */
#view.enter, #view.xfade { animation: fade-in 120ms var(--ease-out) backwards; }

/* ---------- list entrance (§6.6): the first 8 rows rise in, 28ms apart ---------- */
@keyframes sf-rise { from { transform: translateY(10px); opacity: 0; } }
#view.enter-list :is(.wrow, .ltile, .trow, .nrow, .mfit-row):nth-child(-n+8) {
  animation: sf-rise 300ms var(--ease-out) both; animation-delay: calc(var(--n, 0) * 28ms);
}
#view.enter-list :is(.wrow, .ltile, .trow, .nrow, .mfit-row):nth-child(2) { --n: 1; }
#view.enter-list :is(.wrow, .ltile, .trow, .nrow, .mfit-row):nth-child(3) { --n: 2; }
#view.enter-list :is(.wrow, .ltile, .trow, .nrow, .mfit-row):nth-child(4) { --n: 3; }
#view.enter-list :is(.wrow, .ltile, .trow, .nrow, .mfit-row):nth-child(5) { --n: 4; }
#view.enter-list :is(.wrow, .ltile, .trow, .nrow, .mfit-row):nth-child(6) { --n: 5; }
#view.enter-list :is(.wrow, .ltile, .trow, .nrow, .mfit-row):nth-child(7) { --n: 6; }
#view.enter-list :is(.wrow, .ltile, .trow, .nrow, .mfit-row):nth-child(8) { --n: 7; }

/* ---------- pressed states (§6.7): a glass layer scales and springs back; rows only tint ---------- */
@media (prefers-reduced-motion: no-preference) {
  :root:not([data-motion="reduce"]) :is(.chip, .btn.secondary, .btn.ghost) { transition: transform 320ms var(--spring-pop); }
  :root:not([data-motion="reduce"]) :is(.chip, .btn.secondary, .btn.ghost):active { transform: scale(.94); transition-duration: var(--dur-press); transition-timing-function: var(--ease-out); }
  :root:not([data-motion="reduce"]) .btn:not(.plain):not(.danger):not(.secondary):not(.ghost):not(.link) { transition: transform 320ms var(--spring-pop), filter var(--dur-press) var(--ease-out); }
  :root:not([data-motion="reduce"]) .btn:not(.plain):not(.danger):not(.secondary):not(.ghost):not(.link):active { transform: scale(.98); transition-duration: var(--dur-press); }
  :root:not([data-motion="reduce"]) :is(.ltile, .shelf > button, .hero) .paper { transition: transform 320ms var(--spring-pop); }
  :root:not([data-motion="reduce"]) :is(.ltile:active, .shelf > button:active, .hero:active) .paper { transform: scale(.98); transition-duration: var(--dur-press); }
}
/* under reduced motion nothing scales: colour and opacity only */
:root[data-motion="reduce"] :is(.gbtn, .lt-actions .icon-btn, .lt-actions .nav-pull, .sheet .sh-top .icon-btn, .sheet .sh-top .btn.plain, .xs-top .icon-btn):active::before { transform: none; }
:root[data-motion="reduce"] .tabbar button:active > svg, :root[data-motion="reduce"] .tabbar-mini:active { transform: none; scale: none; }
@media (prefers-reduced-motion: reduce) {
  :is(.gbtn, .lt-actions .icon-btn, .lt-actions .nav-pull, .sheet .sh-top .icon-btn, .sheet .sh-top .btn.plain, .xs-top .icon-btn):active::before { transform: none; }
  .tabbar button:active > svg, .tabbar-mini:active { transform: none; scale: none; }
}

/* ---------- the plate in flight (§6.4): a FLIP ghost from the row's thumbnail into the sheet ---------- */
.ghost-plate {
  position: absolute; z-index: var(--z-ghost); margin: 0 !important; transform-origin: 0 0; pointer-events: none;
  will-change: transform; box-sizing: border-box;
}

/* ---------- landscape and short screens (§8.4): compact from the start, glyph-only capsule ---------- */
@media (max-height: 500px) {
  #app .navbar .brand { animation: none; transform: translateY(-6px) scale(.76); }
  #app .navbar .gbtn { animation: none; transform: none; }
  #app .navbar::before { animation-name: sf-bar-glass-l; transform: none; }
  #ltTitle, .lt-title { font-size: var(--fs-title2); }
  .tabbar button > span:not(.tab-dot) { display: none; }
  .tabbar button > svg { width: 24px; height: 24px; }
  .tabbar button > .tab-dot { top: 6px; }
}

/* ---------- reduced motion (system setting, or Intel › Reduce motion): fades at the final position ---------- */
@media (prefers-reduced-motion: reduce) {
  .sheet { transform: none; opacity: 0; transition: opacity var(--dur-dismiss) linear, visibility 0s linear var(--dur-dismiss); }
  .sheet.open { transform: none; opacity: 1; transition: opacity var(--dur-present) linear, visibility 0s linear 0s; }
  .xs-panel { animation-name: fade-in; animation-duration: 200ms; }
  .menu { animation: fade-in 150ms linear both; }
  .menu.ghost { animation: fade-out 150ms linear forwards; }
  .flash-layer > .notice { animation-name: fade-in; }
  .notice.out, .notice.hide { animation-name: fade-out; }
  .toast, .toast.show { transform: none; }
  .boot::before, .boot-row { animation: none; }
  .dr-panel, .drawer.shown .dr-panel { transform: none; opacity: 0; transition: opacity 200ms linear; }
  .drawer.shown .dr-panel { opacity: 1; }
  #app.tabs-mini .tabbar { transform: none; opacity: 1; pointer-events: auto; }
}
:root[data-motion="reduce"] .sheet { transform: none; opacity: 0; transition: opacity var(--dur-dismiss) linear, visibility 0s linear var(--dur-dismiss); }
:root[data-motion="reduce"] .sheet.open { transform: none; opacity: 1; transition: opacity var(--dur-present) linear, visibility 0s linear 0s; }
:root[data-motion="reduce"] .xs-panel { animation-name: fade-in; animation-duration: 200ms; }
:root[data-motion="reduce"] .menu { animation: fade-in 150ms linear both; }
:root[data-motion="reduce"] .menu.ghost { animation: fade-out 150ms linear forwards; }
:root[data-motion="reduce"] .flash-layer > .notice { animation-name: fade-in; }
:root[data-motion="reduce"] .notice.out, :root[data-motion="reduce"] .notice.hide { animation-name: fade-out; }
:root[data-motion="reduce"] .toast, :root[data-motion="reduce"] .toast.show { transform: none; }
:root[data-motion="reduce"] .boot::before, :root[data-motion="reduce"] .boot-row { animation: none; }
:root[data-motion="reduce"] .dr-panel { transform: none; opacity: 0; transition: opacity 200ms linear; }
:root[data-motion="reduce"] .drawer.shown .dr-panel { transform: none; opacity: 1; }
:root[data-motion="reduce"] #app.tabs-mini .tabbar { transform: none; opacity: 1; pointer-events: auto; }

/* ---------- keyframes (§7). Shared by every stylesheet; names are the contract. ---------- */
/* ink-in: strokes with pathLength=1, stroke-dasharray: 1, stroke-dashoffset: 1 (also chart draw-in, red-pencil strike) */
@keyframes ink { to { stroke-dashoffset: 0; } }
@keyframes strike { to { stroke-dashoffset: 0; } }
/* fade: element starts at opacity 0 (legacy-compatible) */
@keyframes fade { to { opacity: 1; } }
@keyframes fade-in { from { opacity: 0; } }
@keyframes fade-out { to { opacity: 0; } }
/* frost wash and caption write-in, left to right */
@keyframes wipe { from { clip-path: inset(0 100% 0 0); } to { clip-path: inset(0 0 0 0); } }
/* callout balloons: scale .8 → 1 */
@keyframes balloon { from { transform: scale(.8); opacity: 0; } to { transform: none; opacity: 1; } }
/* level-up: dialog rises, plate drops, new level stamps then settles 1px */
@keyframes lift { from { transform: translateY(12px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes drop { from { transform: translateY(-12px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes stamp { from { transform: scale(1.18); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes settle { 0%, 100% { transform: none; } 50% { transform: translateY(1px); } }
/* ruler fill from --from to --to (widths), or a 0 → 1 scaleX grow (set transform-origin: left) */
@keyframes ruler-fill { from { width: var(--from, 0%); } to { width: var(--to, 100%); } }
@keyframes grow-x { from { transform: scaleX(0); } to { transform: none; } }
@keyframes underline { from { transform: scaleX(0); } to { transform: none; } }
/* number swaps: 6px slide plus crossfade */
@keyframes digit-in { from { transform: translateY(6px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes digit-out { from { transform: none; opacity: 1; } to { transform: translateY(-6px); opacity: 0; } }
/* sync glyph (600ms linear), 8-spoke spinner (800ms steps(8)) */
@keyframes spin { to { transform: rotate(360deg); } }
/* live dot: .4 ↔ 1 over 2s, alternate (only when motion is allowed) */
@keyframes breathe { from { opacity: .4; } to { opacity: 1; } }
@keyframes notice-in { from { transform: translateY(8px) scale(.97); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes notice-out { from { transform: none; opacity: 1; } to { transform: translateY(8px); opacity: 0; } }
@keyframes sheet-up { from { transform: translateY(100%); } to { transform: none; } }
@keyframes sheet-down { from { transform: none; } to { transform: translateY(100%); } }
/* menus grow from their anchor corner and shrink back a little as they fade */
@keyframes menu-in { from { transform: scale(.86); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes menu-out { to { transform: scale(.96); opacity: 0; } }
/* busy primary button: a 40%-wide 2px hairline across the top edge, 1s linear infinite */
@keyframes busy-line { from { left: -40%; } to { left: 100%; } }
/* star picker tap: .9 → 1 over 120ms */
@keyframes tap-pop { from { transform: scale(.9); } to { transform: none; } }

/* ---------- solid chrome (Reduce Transparency, the Intel toggle, Increase Contrast): no see-through fade ----------
   The bar materials fade to transparent over their last 14-26px so blurred content melts into them. Once the glass
   is an opaque fill, that fade would show sharp content right under the lockup, the one thing these settings ask us
   not to do: the fills end at the bar's edge with a hairline instead (SPEC §4.2's fallback edge). */
:root[data-glass="solid"] :is(.navbar, .sheet .sh-top, .xs-top, .sh-bar)::before {
  inset: 0; -webkit-mask-image: none; mask-image: none; box-shadow: 0 var(--hair) 0 rgba(150, 215, 255, .12);
}
@media (prefers-reduced-transparency: reduce) {
  :is(.navbar, .sheet .sh-top, .xs-top, .sh-bar)::before {
    inset: 0; -webkit-mask-image: none; mask-image: none; box-shadow: 0 var(--hair) 0 rgba(150, 215, 255, .12);
  }
}
@media (prefers-contrast: more) {
  :root:not([data-hc]) :is(.navbar, .sheet .sh-top, .xs-top, .sh-bar)::before {
    inset: 0; -webkit-mask-image: none; mask-image: none; box-shadow: 0 var(--hair) 0 rgba(150, 215, 255, .12);
  }
}
:root[data-glass="solid"] .sh-bar::before { box-shadow: 0 calc(-1 * var(--hair)) 0 rgba(150, 215, 255, .12); }
@media (prefers-reduced-transparency: reduce) { .sh-bar::before { box-shadow: 0 calc(-1 * var(--hair)) 0 rgba(150, 215, 255, .12); } }
@media (prefers-contrast: more) { :root:not([data-hc]) .sh-bar::before { box-shadow: 0 calc(-1 * var(--hair)) 0 rgba(150, 215, 255, .12); } }
/* My loadouts (community.js Squad.drawerHTML): the member's two slots, above the menu rows */
.dr-mine { margin: 0 -2px 14px; padding: 12px 12px 10px; border-radius: 18px; background: rgba(150, 215, 255, .05); box-shadow: inset 0 0 0 1px rgba(150, 215, 255, .10); }
.dr-mine-h { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; font: 700 var(--fs-headline)/var(--lh-headline) var(--font-ui); color: var(--ink); }
.dr-mine-n { font: 600 var(--fs-footnote)/var(--lh-footnote) var(--font-data); color: var(--blue); white-space: nowrap; }
.dr-mine-list { margin: 6px -8px 0; }
.dr-mine-list > li + li { box-shadow: inset 0 1px 0 rgba(150, 215, 255, .08); }
.dr-lo {
  display: grid; grid-template-columns: 64px minmax(0, 1fr) auto; align-items: center; column-gap: 12px;
  width: 100%; min-height: 56px; padding: 8px; border-radius: 14px; text-align: left; color: var(--ink);
  transition: background-color 200ms linear;
}
.dr-lo:active { background: rgba(92, 200, 255, .10); transition: none; }
.dr-lo-m b { display: block; font: 600 var(--fs-subhead)/var(--lh-subhead) var(--font-ui); overflow-wrap: anywhere; }
.dr-lo-m small { display: block; margin-top: 1px; font: 400 var(--fs-footnote)/var(--lh-footnote) var(--font-ui); color: var(--ink-2); }
.dr-lo .chev { color: var(--ink-2); opacity: .6; }
.dr-mine-empty, .dr-mine-note { margin-top: 6px; font: 400 var(--fs-footnote)/var(--lh-footnote) var(--font-ui); color: var(--ink-2); }
.dr-mine .btn.dr-mine-go { margin-top: 10px; min-height: 44px; }
.dr-mine-hint { margin-top: 10px; font: 500 var(--fs-footnote)/var(--lh-footnote) var(--font-ui); color: var(--ink-2); }
.dr-mine-hint::before { content: '✦ '; color: var(--blue); }
