/* Screen layouts. Components come from components.css; this file only arranges them. */

.section { margin-top: var(--s-16); }
.section__head { display: grid; gap: var(--s-2); margin-bottom: var(--s-6); }
.section__head p { color: var(--ink-2); }
@media (min-width: 1080px) { .section { margin-top: var(--s-20); } }

.back { display: inline-flex; align-items: center; gap: 6px; min-height: var(--tap-min); color: var(--ink-2); text-decoration: none; font-weight: 500; margin: calc(var(--s-2) * -1) 0 var(--s-2) -4px; }
button.back { border: 0; background: none; font: inherit; cursor: pointer; padding: 0; }
.back:hover { color: var(--ink); }

/* ── Home: the valley — a 3D story of one request (js/valley.js) ── */
/* Still layout by default (no WebGL, reduced motion, before three.js loads): the picture with the
   headline over it, and the four steps under it. With WebGL and motion allowed the section grows
   tall, the stage sticks under the top bar, and the steps take turns over the scene as you scroll. */
.valley {
  --night: #f4f7fb; --on-night: #1a1514; --on-night-2: #4b4542; --night-red: #b91c2c;
  /* The foot of the stage: the story captions and the scroll hint keep clear of it (and of the home indicator). */
  --stage-foot: calc(var(--s-10) + env(safe-area-inset-bottom));
  position: relative; background: var(--night); color: var(--on-night);
  overflow-x: clip;
}
.valley__stage { position: relative; display: grid; grid-template-columns: minmax(0, 1fr); overflow: clip; }
.valley__view { position: relative; grid-area: 1 / 1; height: clamp(520px, 78svh, 900px); overflow: hidden; contain: paint; }
.valley__host { position: absolute; inset: 0; }
.valley__host > svg, .valley__host > canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.valley__host > canvas { opacity: 0; transition: opacity 1.2s var(--ease-out); }
.valley__host.is-ready > canvas { opacity: 1; }
.valley__intro { grid-area: 1 / 1; align-self: start; position: relative; z-index: 2; padding-top: var(--s-10); }
/* Text over the 3D: every text on the valley has its own dark backing, strong enough that AA holds even
   over a white light (a veil of ≥ .66 night under body text). Measured on screenshots with the text
   hidden; see README → Accessibility. The hero's veil belongs to the intro, so it fades out with it when
   the story starts. Phones: a band down the text column; wide screens: a gradient from the left. */
.valley__intro::before {
  content: ''; position: absolute; z-index: -1; pointer-events: none;
  top: 0; bottom: 0; left: calc(-1 * var(--gutter)); right: calc(-1 * var(--gutter));
  background: linear-gradient(180deg, rgba(255, 255, 255, .72) 0%, rgba(255, 255, 255, .55) 42%, rgba(255, 255, 255, .18) 72%, rgba(255, 255, 255, 0) 100%);
}
@media (min-width: 1080px) {
  .valley__intro::before {
    top: 0; bottom: -64px; left: calc(50% - 50vw); right: auto; width: calc(50vw - 50% + var(--gutter) + 50rem);
    background: linear-gradient(90deg, rgba(255, 255, 255, .82) 0%, rgba(255, 255, 255, .55) 58%, rgba(255, 255, 255, 0) 100%);
    -webkit-mask-image: linear-gradient(180deg, #000 78%, transparent);
            mask-image: linear-gradient(180deg, #000 78%, transparent);
  }
}
.valley__kicker { color: var(--night-red); }
.valley__title { font-size: var(--fs-hero); line-height: 1.08; margin: var(--s-3) 0 var(--s-4); max-width: 17ch; color: var(--on-night); text-wrap: balance; }
.valley__lede { max-width: 50ch; color: var(--on-night-2); font-size: var(--fs-lg); }
.valley__intro .btn-row { margin-top: var(--s-6); }
.valley__intro .btn { flex: 1 1 auto; }
.valley :focus-visible { outline-color: var(--night-red); }
.valley .btn--on-dark { background: #fff; color: var(--on-night); border-color: rgba(26, 21, 20, .22); }
.valley .btn--on-dark:hover { background: #f7f4f1; }
.valley__tag {
  position: absolute; left: 0; top: 0; z-index: 1; pointer-events: none; will-change: transform; opacity: 0;
  max-width: min(16rem, 70vw); padding: 6px 10px; border-radius: 10px; white-space: normal; text-align: center;
  background: rgba(255, 255, 255, .94); border: 1px solid rgba(185, 28, 44, .45); color: #1a1514; font: 600 12px/1.3 var(--font-ui);
  box-shadow: 0 4px 16px rgba(26, 21, 20, .12);
}
.valley__steps { grid-row: 2; position: relative; z-index: 2; padding-top: var(--s-8); padding-bottom: var(--s-12); }
.valley__caps { list-style: none; padding: 0; margin: 0; display: grid; gap: var(--s-6); }
.valley__cap { display: grid; grid-template-columns: 44px minmax(0, 1fr); gap: var(--s-4); align-items: start; }
.valley__num { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 50%; border: 2px solid var(--night-red); color: var(--night-red); font: 700 18px/1 var(--font-display); }
.valley__cap b { display: block; font: 600 var(--fs-lg)/1.3 var(--font-display); color: var(--on-night); }
.valley__cap div > span { display: block; margin-top: var(--s-1); color: var(--on-night-2); }
.valley__note {
  grid-area: 1 / 1; align-self: end; justify-self: end; z-index: 2; margin: 0 var(--gutter) var(--s-2); padding: 2px 10px; border-radius: 999px;
  background: rgba(255, 255, 255, .88); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); font-size: var(--fs-xs); color: var(--on-night-2); border: 1px solid rgba(26, 21, 20, .08);
}
.valley__cue, .valley__bar { display: none; }
html[data-theme="dark"] .valley {
  --night: #31445c; --on-night: #f6f1ea; --on-night-2: #ddd2c8; --night-red: #ff8b96;
}
html[data-theme="dark"] .valley__intro::before {
  background: linear-gradient(180deg, rgba(7, 11, 18, .78) 0%, rgba(7, 11, 18, .55) 42%, rgba(7, 11, 18, .16) 72%, rgba(7, 11, 18, 0) 100%);
}
html[data-theme="dark"] .valley .btn--on-dark { background: #1c2430; color: #f6f1ea; border-color: rgba(246, 241, 234, .28); }
html[data-theme="dark"] .valley .btn--on-dark:hover { background: #263140; }
html[data-theme="dark"] .valley__tag,
html[data-theme="dark"] .valley__note { background: rgba(28, 40, 56, .92); color: #f6f1ea; border-color: rgba(246, 241, 234, .2); }
html[data-theme="dark"] .valley.is-live .valley__cap::before {
  background: rgba(28, 40, 56, .9); border-color: rgba(246, 241, 234, .16);
}
html[data-theme="dark"] .valley__cue span {
  background: rgba(28, 40, 56, .92); color: #f6f1ea; border-color: rgba(246, 241, 234, .16);
}
html[data-theme="dark"] .valley__still { filter: brightness(.72) contrast(1.05) saturate(.9); }
@media (min-width: 720px) { .valley__intro .btn { flex: 0 0 auto; } }
@media (min-width: 1080px) {
  .valley__intro { padding-top: var(--s-16); }
  .valley__caps { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--s-8); }
  .valley__cap { grid-template-columns: minmax(0, 1fr); }
}

.valley.is-live { height: 460svh; }
.valley.is-live .valley__stage { position: sticky; top: var(--topbar-offset); height: calc(100svh - var(--topbar-offset)); overflow: hidden; contain: paint; }
.valley.is-live .valley__view { height: 100%; }
.valley.is-live .valley__intro {
  opacity: calc(1 - var(--p, 0) * 12);
  transform: translate3d(0, calc(var(--p, 0) * -120px), 0);
  will-change: opacity, transform;
  transition: none;
}
.valley.is-live .valley__intro:focus-within { opacity: 1; transform: none; }
.valley.is-live .valley__steps { grid-area: 1 / 1; align-self: end; padding-bottom: var(--stage-foot); pointer-events: none; }
/* With the donor's tab bar (phones), the stage ends where the tab bar begins. */
@media (max-width: 1079px) {
  body.has-tabbar .valley.is-live .valley__stage { height: calc(100svh - var(--topbar-offset) - var(--tabbar-h) - env(safe-area-inset-bottom)); }
  .valley.is-live .valley__intro { transform: translate3d(0, calc(var(--p, 0) * -72px), 0); }
  .valley__view { height: clamp(420px, 70svh, 720px); }
}
@media (min-width: 1080px) {
  .valley.is-live .valley__intro { transform: translate3d(0, calc(var(--p, 0) * -220px), 0); }
  .valley__view { height: clamp(600px, 88svh, 900px); }
}
.valley.is-live .valley__caps { grid-template-columns: minmax(0, 1fr); }
.valley.is-live .valley__cap {
  grid-area: 1 / 1; max-width: min(34rem, 100%); grid-template-columns: 44px minmax(0, 1fr);
  opacity: 0; transform: translate3d(0, 14px, 0);
  transition: opacity .45s var(--ease-out), transform .45s var(--ease-out);
}
.valley.is-live .valley__cap.on { opacity: 1; transform: none; }
.valley.is-live .valley__cap { position: relative; isolation: isolate; overflow: visible; }
.valley.is-live .valley__cap::before {
  content: ''; position: absolute; z-index: -1; inset: -16px -12px; border-radius: 28px; pointer-events: none;
  background: rgba(255, 255, 255, .86); filter: blur(10px); border: 1px solid rgba(26, 21, 20, .06);
}
@media (max-width: 719px) {
  .valley.is-live .valley__cap::before { inset: -12px -8px; border-radius: 22px; filter: blur(8px); }
  .valley.is-live .valley__steps { padding-left: var(--gutter); padding-right: var(--gutter); }
  .valley.is-live .valley__cap { max-width: 100%; }
}
.valley.is-live .valley__cap b { font-size: var(--fs-xl); }
/* The scroll hint: the words on a small dark chip (lights in the scene never cross them), and the red
   thread under them, drawing downwards. */
.valley.is-live .valley__cue {
  display: flex; flex-direction: column; align-items: center; gap: var(--s-2);
  grid-area: 1 / 1; align-self: end; justify-self: center; z-index: 2; pointer-events: none;
  margin: 0 var(--gutter) var(--stage-foot); text-align: center; color: var(--on-night); font-size: var(--fs-sm);
  opacity: calc(1 - var(--p, 0) * 20);
}
.valley__cue span {
  padding: 6px 16px; border-radius: 999px; background: rgba(255, 255, 255, .88); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); border: 1px solid rgba(26, 21, 20, .08);
  font-size: var(--fs-xs); color: var(--on-night-2); text-wrap: balance;
}
.valley__cue i { width: 2px; height: 28px; background: linear-gradient(var(--night-red), rgba(255, 107, 122, 0)); transform-origin: top; animation: cue 2s var(--ease-out) infinite; }
@keyframes cue { from { transform: scaleY(0); } }
.valley.is-live .valley__bar { display: block; grid-area: 1 / 1; align-self: end; z-index: 2; height: 3px; background: rgba(26, 21, 20, .08); }
.valley__bar i { display: block; height: 100%; background: var(--night-red); transform-origin: left; transform: scaleX(var(--p, 0)); }

/* Urgent now: the open requests and the lives-saved counter, joined by the thread on wide screens. */
.now { scroll-margin-top: calc(var(--topbar-offset) + var(--s-4)); }
.now:focus:not(:focus-visible) { outline: none; }
.now .section__head .label { display: inline-flex; align-items: center; gap: 6px; }
.now .section__head .label .icon { width: 16px; height: 16px; }
.now__grid { position: relative; display: grid; gap: var(--s-6); }
.now__grid > .req-grid, .now__grid > .card { position: relative; z-index: 1; }
.now__grid .thread { z-index: 0; }
.counter-card { display: grid; gap: var(--s-1); align-content: start; }
.counter-card .caption { margin-top: var(--s-2); }
.now__privacy { margin-top: var(--s-6); max-width: 62ch; }
@media (min-width: 1080px) {
  .now__grid { grid-template-columns: minmax(0, 1fr) 280px; gap: var(--s-16); align-items: center; }
  .now__grid .req-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

.req-grid { display: grid; gap: var(--s-4); }
.donor-grid { list-style: none; padding: 0; margin: var(--s-4) 0 0; display: grid; gap: var(--s-4); }
@media (min-width: 720px) { .donor-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 1080px) { .donor-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.donor-find { max-width: 28rem; margin-bottom: var(--s-4); }
.donor-find .input { font-variant-numeric: tabular-nums; }
.donor-similar { margin: var(--s-5) 0 var(--s-3); }
.donor-card { min-width: 0; }
.donor-card__group { margin: 0 0 var(--s-2); font: 700 22px/1.25 var(--font-ui); color: var(--blood-deep); overflow-wrap: anywhere; }
.donor-card__id { margin: -6px 0 var(--s-2); font-variant-numeric: tabular-nums; }
.donor-card__write { margin-top: var(--s-3); }
textarea.input { padding: 12px var(--s-4); min-height: 120px; resize: vertical; }
.chat { display: flex; flex-direction: column; gap: 8px; max-height: min(42vh, 320px); overflow: auto; margin: 12px 0; }
.chat__row { display: flex; }
.chat__row.is-out { justify-content: flex-end; }
.chat__who { margin: 0 0 2px; }
.chat__bubble { max-width: 85%; margin: 0; padding: 8px 12px; border-radius: 14px; background: var(--paper-2); white-space: pre-wrap; overflow-wrap: anywhere; }
.chat__row.is-out .chat__bubble { background: var(--blush); }
.chat textarea.input { min-height: 72px; }
@media (min-width: 720px) { .req-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 1080px) { .req-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--s-5); } }

/* Request card */
.req { display: grid; gap: var(--s-4); align-content: start; }
.req__top { display: flex; align-items: center; justify-content: space-between; gap: var(--s-2); flex-wrap: wrap; }
.req__when { font-weight: 600; font-size: var(--fs-sm); }
.req__body { display: flex; align-items: center; justify-content: space-between; gap: var(--s-4); }
.req__facts { list-style: none; padding: 0; display: grid; gap: 6px; font-size: var(--fs-sm); color: var(--ink-2); }
.req__facts li { display: flex; gap: var(--s-2); align-items: flex-start; }
.req__facts .icon { width: 18px; height: 18px; margin-top: 1px; }
.req__match { margin-top: -4px; }
.req--mine { border-color: var(--blood); box-shadow: 0 0 0 1px var(--blood) inset; }

@keyframes grow-y { from { transform: scaleY(0); } }

.duo { display: grid; gap: var(--s-4); align-items: start; }
@media (min-width: 1080px) { .duo { grid-template-columns: 1fr 1fr; gap: var(--s-5); } }
.home-gift { display: flex; flex-direction: column; padding: 0; overflow: hidden; text-decoration: none; color: inherit; }
.home-gift:hover { border-color: var(--line-strong); }
.home-gift__img { display: block; width: 100%; aspect-ratio: 1024 / 504; object-fit: cover; background: #c5d0da; }
.home-gift__body { display: grid; gap: var(--s-3); padding: var(--s-6); }
.home-gift__n { font: 700 56px/1 var(--font-display); color: var(--blood); }
.home-gift__h { font: 600 var(--fs-xl)/1.25 var(--font-display); letter-spacing: -.01em; }
.home-gift__text { color: var(--ink); }
.home-gift__cta { color: var(--blood-deep); text-decoration: underline; text-underline-offset: 3px; font-weight: 600; }
.promise { display: grid; gap: var(--s-3); }
.promise__icon { width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; background: var(--blush); color: var(--blood-deep); }
.fact__n { font: 700 56px/1 var(--font-display); color: var(--blood); }
.fact__src { font-size: var(--fs-xs); color: var(--ink-2); }

.place { display: grid; gap: var(--s-3); }
.place__name { font: 600 var(--fs-lg)/1.3 var(--font-ui); }
.place__lines { display: grid; gap: 6px; font-size: var(--fs-sm); color: var(--ink-2); }
.place__lines div { display: flex; gap: var(--s-2); align-items: flex-start; }
.place__lines .icon { width: 18px; height: 18px; margin-top: 1px; }

/* ── Donor feed ──────────────────────────────────────────── */
.feed-head { display: grid; gap: var(--s-3); margin-bottom: var(--s-6); }
.feed-head h1 { margin-top: var(--s-1); }
.feed-status { display: flex; flex-wrap: wrap; gap: var(--s-2); }
.quick { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--s-3); }
.quick a { display: grid; gap: var(--s-2); justify-items: start; padding: var(--s-4); border-radius: var(--r-lg); background: var(--surface); border: 1px solid var(--line); color: var(--ink); text-decoration: none; font-weight: 600; font-size: 15px; line-height: 1.25; min-height: 96px; }
.quick a:hover { border-color: var(--line-strong); }
.quick .icon { width: 24px; height: 24px; color: var(--blood); }
@media (min-width: 1080px) { .feed-head { grid-template-columns: 1fr auto; align-items: end; } }

/* ── Request detail ──────────────────────────────────────── */
.rd__top { display: flex; align-items: center; justify-content: space-between; gap: var(--s-3); flex-wrap: wrap; }
.rd__left { font-weight: 600; color: var(--blood-deep); display: inline-flex; gap: 6px; align-items: center; font-size: var(--fs-sm); }
.rd__left .icon { width: 18px; height: 18px; }
.rd__hero { display: flex; align-items: center; justify-content: space-between; gap: var(--s-4); margin: var(--s-5) 0 var(--s-4); }
.rd__hero .group { --fs-group: 88px; }
.rd__title { font-size: var(--fs-2xl); margin-bottom: var(--s-2); }
.rd__where { color: var(--ink-2); display: flex; gap: 6px; align-items: flex-start; }
.rd__where .icon { width: 18px; height: 18px; margin-top: 3px; }
.rd__actions { display: grid; gap: var(--s-3); margin: var(--s-6) 0 var(--s-4); }
.rd__details { margin-top: var(--s-6); }
.rd__blocked { padding: var(--s-4); border-radius: var(--r-md); background: var(--paper-2); color: var(--ink-2); font-size: var(--fs-sm); }
@media (min-width: 1080px) {
  .rd { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: var(--s-12); max-width: 1040px; }
  .rd__details { margin-top: 0; }
  .rd__hero .group { --fs-group: 112px; }
  .rd__title { font-size: 36px; }
}

/* ── Consent ─────────────────────────────────────────────── */
.consent__top { display: flex; align-items: center; gap: var(--s-4); margin-bottom: var(--s-5); }
.consent__who { display: flex; gap: var(--s-3); align-items: center; font-weight: 600; margin-bottom: var(--s-3); }
.consent__who .list__icon { width: 40px; height: 40px; }
.consent__phone { display: flex; gap: var(--s-2); align-items: center; margin-top: var(--s-4); padding: var(--s-3) var(--s-4); background: var(--paper-2); border-radius: var(--r-md); font-weight: 600; font-variant-numeric: tabular-nums; }
.consent__phone .icon { color: var(--ink-2); }
.consent .btn-stack { margin-top: var(--s-6); }

/* ── Going ("Спасибо") ───────────────────────────────────── */
.going { position: relative; }
/* The thread comes down from the top bar and stops just above the words, ending in a bead: it never
   crosses the text. Its length is the page's top padding + the head's, less a 12 px gap. */
.going__thread {
  position: absolute; left: calc(var(--gutter) + 15px); top: 0; width: 2px; height: calc(var(--s-6) + var(--s-12) - var(--s-3));
  background: linear-gradient(var(--paper), var(--blood)); transform-origin: top; animation: grow-y 1s var(--ease-thread) both;
}
.going__thread::after { content: ''; position: absolute; left: -3px; bottom: -4px; width: 8px; height: 8px; border-radius: 50%; background: var(--blood); animation: fade .3s .85s both; }
@media (min-width: 1080px) { .going__thread { height: calc(var(--s-10) + var(--s-12) - var(--s-3)); } }
.going__head { padding-top: var(--s-12); }

/* ── Donation counted ────────────────────────────────────── */
.donation { display: grid; justify-items: center; text-align: center; gap: var(--s-3); }
.donation .card { width: 100%; text-align: left; }
.next-card { display: flex; align-items: center; justify-content: space-between; gap: var(--s-4); }

/* ── Thank-you: the demo's high point ────────────────────── */
.thanks { text-align: center; padding-top: var(--s-6); overflow-x: clip; }
.thanks__stage { position: relative; width: min(360px, 100%); aspect-ratio: 360 / 380; margin: 0 auto; }
.thanks__stage > svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.thanks__path { fill: none; stroke: var(--blood); stroke-width: 3; stroke-linecap: round; stroke-dasharray: 1; animation: thread-draw 2.2s .25s var(--ease-thread) both; }
.thanks__drop { fill: var(--blood); animation: drop-in .7s var(--ease-out) both; transform-box: fill-box; transform-origin: 50% 0; }
.thanks__orn { color: var(--blood); animation: orn-in .8s 2.25s var(--ease-out) both; transform-box: fill-box; transform-origin: center; }
.thanks__dots { animation: fade .6s 2.5s both; }
.thanks__mid { position: absolute; left: 0; right: 0; top: 52.6%; transform: translateY(-50%); display: grid; justify-items: center; gap: 6px; }
.thanks__n { font: 700 104px/1 var(--font-display); color: var(--blood); font-variant-numeric: lining-nums tabular-nums; animation: rise .8s 1.9s var(--ease-out) both; }
.thanks__l { font: 500 var(--fs-lg)/1.25 var(--font-display); animation: fade .6s 2.2s both; max-width: 12ch; }
.thanks__quote { font: italic 500 clamp(26px, 5.4vw, 40px)/1.25 var(--font-display); margin: var(--s-6) auto var(--s-3); max-width: 18ch; animation: rise .9s 2.7s var(--ease-out) both; }
.thanks__case { color: var(--ink-2); max-width: 36ch; margin: 0 auto; animation: fade .7s 3.2s both; }
.thanks__sign { margin-top: var(--s-2); font-size: var(--fs-sm); color: var(--ink-2); animation: fade .7s 3.3s both; }
.thanks__actions { justify-content: center; margin-top: var(--s-8); animation: fade .7s 3.5s both; }
.thanks .label { margin-top: var(--s-4); animation: fade .6s 2.4s both; }
@keyframes drop-in { from { transform: translateY(-24px) scale(.6); opacity: 0; } }
@keyframes orn-in { from { transform: scale(.4) rotate(-40deg); opacity: 0; } }
@keyframes fade { from { opacity: 0; } }
@media (min-width: 1080px) { .thanks { padding-top: var(--s-10); } .thanks__stage { width: 400px; } .thanks__n { font-size: 120px; } }
/* Phones: the whole moment, buttons included, fits one screen. */
@media (max-width: 719px) {
  .thanks { padding-top: var(--s-3); } .thanks__stage { width: min(300px, 100%); } .thanks__n { font-size: 88px; }
  .thanks__quote { margin-top: var(--s-4); } .thanks__actions { margin-top: var(--s-4); }
}

/* The thank-you film (motion allowed): night → a bead of light runs the thread → the ring closes → day.
   The night colours and the timeline live in film() in js/screens/donor.js; the text delays below follow it. Without motion none of this is drawn: the page above is the last frame. */
.thanks__night {
  position: fixed; inset: 0; z-index: -1; pointer-events: none; overflow: hidden; contain: paint;
  background: linear-gradient(180deg, #0D0B1C 0%, #1B1430 42%, #2E1F44 72%, #58304A 100%);
}
.thanks__stars {
  position: absolute; inset: 0 0 38% 0; opacity: .8;
  background:
    radial-gradient(1.5px 1.5px at 8% 18%, #FFF 50%, transparent 52%), radial-gradient(1px 1px at 17% 52%, #FFF 50%, transparent 52%),
    radial-gradient(1.2px 1.2px at 26% 9%, #FFF 50%, transparent 52%), radial-gradient(1px 1px at 33% 34%, #FFE9D6 50%, transparent 52%),
    radial-gradient(1.6px 1.6px at 41% 71%, #FFF 50%, transparent 52%), radial-gradient(1px 1px at 58% 14%, #FFF 50%, transparent 52%),
    radial-gradient(1.3px 1.3px at 64% 47%, #FFE9D6 50%, transparent 52%), radial-gradient(1px 1px at 72% 26%, #FFF 50%, transparent 52%),
    radial-gradient(1.5px 1.5px at 81% 61%, #FFF 50%, transparent 52%), radial-gradient(1px 1px at 88% 11%, #FFF 50%, transparent 52%),
    radial-gradient(1.2px 1.2px at 94% 39%, #FFE9D6 50%, transparent 52%), radial-gradient(1px 1px at 51% 88%, #FFF 50%, transparent 52%);
}
.thanks__sun {
  position: absolute; left: 50%; bottom: -30vh; width: min(170vmax, 200vw); height: 80vh; margin-left: max(-100vw, -85vmax);
  max-width: 200vw;
  background: radial-gradient(closest-side, rgba(255, 205, 170, .95), rgba(243, 154, 114, .6) 42%, rgba(243, 154, 114, 0) 100%);
  opacity: .25; transform: translate3d(0, 40%, 0);
}
.thanks__halo, .thanks__bead, .thanks__pulse, .thanks__glow { opacity: 0; }
.thanks__halo, .thanks__bead-in, .thanks__pulse, .thanks__sparks circle { transform-box: fill-box; transform-origin: center; }
.thanks__pulse { fill: none; stroke: #FF8A9B; stroke-width: 3; }
.thanks__glow { fill: none; stroke: #FF6F88; stroke-width: 12; stroke-linecap: round; stroke-dasharray: 1; stroke-dashoffset: 1; }
.thanks__sparks circle { fill: #F4C56B; opacity: 0; }
.thanks.is-film .thanks__path, .thanks.is-film .thanks__n { animation: none; }
.thanks.is-film .thanks__drop { animation-delay: .35s; }
.thanks.is-film .thanks__l { animation-delay: 3.1s; }
/* The ornament unfurls: each ram's horn is drawn from its stem out to the curl (the paths have pathLength="1"). */
.thanks.is-film .thanks__orn { animation: orn-rise .9s 3.5s var(--ease-out) both; }
.thanks.is-film .thanks__orn use { stroke-dasharray: 1 2; animation: orn-draw 1.3s 3.5s var(--ease-out) both; }
.thanks.is-film .thanks__orn use:not(:nth-child(2)) { animation-delay: 3.7s; }
@keyframes orn-rise { from { opacity: 0; transform: translateY(8px); } }
@keyframes orn-draw { from { stroke-dashoffset: 1; } }
.thanks.is-film .thanks__dots { animation-delay: 3.75s; }
.thanks.is-film .label { animation-delay: 3.85s; }
.thanks.is-film .thanks__quote { animation-delay: 4s; }
.thanks.is-film .thanks__case { animation-delay: 4.4s; }
.thanks.is-film .thanks__sign { animation-delay: 4.5s; }
.thanks.is-film .thanks__actions { animation-delay: 4.7s; }
.thanks.is-playing .thanks__actions { pointer-events: none; }
.thanks.is-skip, .thanks.is-skip * { animation: none !important; transition: none !important; }

/* ── Profile ─────────────────────────────────────────────── */
.profile-head { display: flex; gap: var(--s-4); align-items: center; margin-bottom: var(--s-6); }
.profile-id { margin: 2px 0 var(--s-2); font-variant-numeric: tabular-nums; }
.profile-edit .field + .field { margin-top: var(--s-4); }
.profile-edit .caption { margin: var(--s-3) 0; }
.profile-edit .input, .profile-edit .select { width: 100%; max-width: 24rem; }
.profile-edit .btn { margin-top: var(--s-4); }
.profile-head .avatar { width: 64px; height: 64px; font-size: 26px; }
.profile-head .feed-status { margin-top: var(--s-2); }
.profile-grid { display: grid; gap: var(--s-4); }
.profile-grid > div { display: grid; gap: var(--s-4); align-content: start; }
@media (min-width: 1080px) { .profile-grid { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: var(--s-5); } .profile-grid > div { gap: var(--s-5); } }
.rank-card { display: flex; gap: var(--s-5); align-items: center; }
.rank-card__main { flex: 1; min-width: 0; display: grid; gap: var(--s-2); }
.rank-card__name { font: 600 var(--fs-xl)/1.2 var(--font-display); }
.big-stat { font: 700 44px/1 var(--font-display); color: var(--blood); }
.lives-share { display: grid; gap: var(--s-2); justify-items: start; margin-top: var(--s-4); }
.lives-share .caption { margin: 0; }
.share-stage { display: grid; place-items: center; margin: 0 0 var(--s-4); }
.share-card, .share-card-skel {
  width: min(220px, 58vw); aspect-ratio: 9 / 16; border-radius: 22px;
  background: #FBF6F1; box-shadow: var(--shadow-2);
}
.share-card { height: auto; display: block; object-fit: cover; }
.share-card-skel { background: linear-gradient(180deg, var(--blush-2), var(--paper-2) 42%, var(--blush)); }
.share-actions { display: grid; gap: var(--s-3); }
.share-actions .btn { width: 100%; }
.share-link-h { margin: var(--s-5) 0 var(--s-2); text-align: center; }
.share-links { display: flex; flex-wrap: wrap; gap: var(--s-3); justify-content: center; }
.share-links button {
  display: grid; place-items: center; gap: 4px; min-width: 64px; min-height: var(--tap-min);
  color: var(--ink-2); font: 600 12px/1.2 var(--font-ui);
}
.share-links .share-mark { width: 44px; height: 44px; font-size: 15px; }
.share-nets .share-mark {
  display: grid; place-items: center; width: 36px; height: 36px; border-radius: 50%;
  background: var(--ink); color: #fff; font: 700 13px/1 var(--font-ui); flex: none;
}
.share-nets .share-mark .icon { width: 18px; height: 18px; color: #fff; }
.share-nets .share-mark--tg { background: #0E6A8C; }
.share-nets .share-mark--wa { background: #0E703C; }
.share-nets .share-mark--ig { background: #8C215C; }
.share-nets .share-mark--fb { background: #0F4C96; }
.share-nets .icon { flex: none; }
.qr-card { display: flex; align-items: center; gap: var(--s-4); width: 100%; text-align: left; }
.qr-card:hover { border-color: var(--line-strong); }
.qr-card__icon { display: grid; place-items: center; width: 52px; height: 52px; border-radius: var(--r-md); background: var(--ink); color: #fff; flex: none; }
.qr-card__icon .icon { width: 28px; height: 28px; }
.card h2.h3 { margin-bottom: var(--s-2); }
.danger { color: var(--blood-deep); }

/* ── Join and login ──────────────────────────────────────── */
.split { display: grid; gap: var(--s-8); }
.split__aside { display: none; }
@media (min-width: 1080px) {
  .split { grid-template-columns: minmax(0, 640px) minmax(0, 380px); gap: var(--s-16); justify-content: center; }
  .split__aside { display: block; position: sticky; top: calc(var(--topbar-offset) + var(--s-8)); align-self: start; }
}
.join h1 { margin-top: var(--s-2); }
.form-actions { display: flex; gap: var(--s-3); margin-top: var(--s-8); }
.form-actions .btn--primary { flex: 1; }
.form-card { padding: var(--s-5); }
@media (min-width: 720px) { .form-card { padding: var(--s-8); } }
.or { display: flex; align-items: center; gap: var(--s-3); color: var(--ink-2); font-size: var(--fs-sm); margin: var(--s-6) 0; }
.or::before, .or::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.or span { flex: none; }
.btn-google {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  width: 100%; min-height: var(--tap-min); padding: 10px 14px; margin-top: 4px;
  background: var(--surface); color: var(--ink); border: 1px solid var(--line-strong);
  border-radius: var(--r-md); font-size: var(--fs-sm); font-weight: 600;
  text-decoration: none; cursor: pointer;
}
.btn-google:hover { background: var(--paper-2); text-decoration: none; }
.btn-google svg { flex: none; }

/* ── Self-check ──────────────────────────────────────────── */
.q-dots { display: flex; gap: 6px; margin: var(--s-4) 0 var(--s-6); }
.q-dots i { width: 28px; height: 4px; border-radius: 2px; background: var(--line); }
.q-dots i.is-done { background: var(--blood); }
.q-dots i.is-now { background: var(--blood); opacity: .45; }
.answer-grid { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s-3); margin-top: var(--s-6); }
.answer-grid .btn { min-height: 64px; font-size: 18px; }
.check-q { animation: rise .4s var(--ease-out) both; }
.result-list { display: grid; gap: var(--s-3); margin-top: var(--s-5); }
.result-item { display: flex; gap: var(--s-3); align-items: flex-start; padding: var(--s-4); border-radius: var(--r-md); background: var(--surface); border: 1px solid var(--line); }
.result-item .list__icon { width: 32px; height: 32px; }

/* ── Content pages (memo, privacy) ───────────────────────── */
.prose h2 { margin: var(--s-10) 0 var(--s-3); font-size: var(--fs-xl); }
.prose p + p { margin-top: var(--s-3); }
.who-table { width: 100%; border-collapse: collapse; font-size: var(--fs-sm); }
.who-table th, .who-table td { text-align: left; vertical-align: top; padding: var(--s-3); border-top: 1px solid var(--line); }
.who-table th { font-weight: 600; width: 34%; }

/* ── Design-system page ──────────────────────────────────── */
.ds-section { margin-top: var(--s-12); }
.ds-section > h2 { margin-bottom: var(--s-4); }
.swatches { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: var(--s-3); }
.swatch { border-radius: var(--r-md); overflow: hidden; border: 1px solid var(--line); background: var(--surface); }
.swatch i { display: block; height: 64px; }
.swatch div { padding: var(--s-2) var(--s-3); font-size: 12px; line-height: 1.4; }
.swatch b { display: block; font-size: 13px; }
.ds-row { display: flex; flex-wrap: wrap; gap: var(--s-4); align-items: center; }
.ds-grid { display: grid; gap: var(--s-4); }
@media (min-width: 1080px) { .ds-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.type-sample { display: grid; gap: var(--s-2); }
.type-sample span { font-size: 12px; color: var(--ink-2); }


/* ── Staff: coordinator, blood centre, admin ─────────────── */
.staff-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: var(--s-4); }
.staff-head .label { margin-bottom: var(--s-2); }
.staff-rule { margin-top: var(--s-8); max-width: 72ch; }
.coord-tg { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--s-4); margin-bottom: var(--s-6); }
.coord-tg[hidden] { display: none; }
.coord-tg__text { flex: 1 1 28ch; min-width: 0; }
.coord-tg__text p { margin: var(--s-1) 0 0; color: var(--ink-2); max-width: 68ch; }
.coord-tg__h { display: flex; align-items: center; gap: var(--s-2); margin: 0; font-size: 1.05rem; }
.coord-tg__h .icon { color: var(--blood); flex: none; }
.coord-typing { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--s-4); margin-bottom: var(--s-6); }
.coord-typing[hidden] { display: none; }
.coord-typing__text { flex: 1 1 28ch; min-width: 0; }
.coord-typing__text p { margin: var(--s-1) 0 0; color: var(--ink-2); max-width: 68ch; }
.coord-typing__h { display: flex; align-items: center; gap: var(--s-2); margin: 0; font-size: 1.05rem; }
.coord-typing__h .icon { color: var(--blood); flex: none; }
.typing-lead { max-width: 68ch; margin-bottom: var(--s-6); }
.typing-list { display: grid; gap: var(--s-4); }
.typing-card { display: grid; gap: var(--s-3); }
.typing-card__top { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: var(--s-3); }
.typing-card__top .muted { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: var(--s-1); }
.typing-card__top .icon { width: 16px; height: 16px; }
.typing-card__call .btn { font-variant-numeric: tabular-nums; }
.typing-card__booked { display: flex; align-items: center; gap: var(--s-2); margin: 0; font-weight: 600; }
.typing-card__booked .icon { width: 18px; height: 18px; color: var(--blood); }
.typing-card__when { display: flex; flex-wrap: wrap; gap: var(--s-3); align-items: flex-end; }
.typing-card__when .field { flex: 1 1 14rem; margin: 0; }
.typing-banner { margin-bottom: var(--s-6); }
.staff-chip { display: inline-flex; align-items: center; gap: 6px; min-height: 36px; padding: 0 12px; border-radius: var(--r-pill); background: var(--paper-2); color: var(--ink-2); font-size: var(--fs-sm); font-weight: 500; white-space: nowrap; }
.staff-chip .icon { width: 16px; height: 16px; }
.section-sm { margin-top: var(--s-10); }
.section-sm > .h3 { margin-bottom: var(--s-3); }

/* New request: the form, and beside it the card donors will see */
.cnew__groups { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.tile--wide { grid-column: 1 / -1; }
.tile--wide .tile__body { min-height: var(--tap); }
.tile--wide .tile__body small { font: 600 var(--fs-md)/1 var(--font-ui); }
.cnew .fieldset + .fieldset, .cnew .fieldset + .field, .cnew .field + .fieldset, .cnew .field + .field { margin-top: var(--s-6); }
.cnew .notice { margin-top: var(--s-6); }
.stepper { display: grid; grid-template-columns: var(--tap) 88px var(--tap); gap: var(--s-2); align-items: center; }
.stepper .btn { min-width: var(--tap); padding: 0; font-size: 22px; }
.stepper .input { text-align: center; font: 600 20px/1 var(--font-ui); -moz-appearance: textfield; }
.stepper .input::-webkit-inner-spin-button, .stepper .input::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
.cnew__aside { display: grid; gap: var(--s-3); align-content: start; }
.cnew__aside .label { margin: 0; }
.cnew__aside .req { pointer-events: none; }
.cnew__reach { display: flex; gap: var(--s-2); align-items: center; font-weight: 600; color: var(--blood-deep); }
.cnew__reach .icon { width: 18px; height: 18px; }
@media (min-width: 1080px) {
  .cnew { grid-template-columns: minmax(0, 1fr) 360px; align-items: start; }
  .cnew__aside { position: sticky; top: calc(var(--topbar-offset) + var(--s-6)); }
}

/* One request, live */
.creq { display: grid; gap: var(--s-4); }
.creq__hero { display: flex; align-items: center; justify-content: space-between; gap: var(--s-4); margin: var(--s-5) 0 var(--s-3); }
.creq__hero .group { --fs-group: 88px; }
.creq__main .h2 { margin-top: var(--s-2); }
.creq__main .muted { display: flex; gap: 6px; align-items: center; margin-top: var(--s-2); }
.creq__main .muted .icon { width: 18px; height: 18px; }
.creq__counts { margin-top: var(--s-4); font-weight: 600; }
.creq__actions { display: flex; justify-content: flex-end; }
.live { display: inline-flex; align-items: center; gap: var(--s-2); margin-top: var(--s-4); font-size: var(--fs-sm); color: var(--sage-ink); font-weight: 600; }
.live__dot { width: 10px; height: 10px; border-radius: 50%; background: var(--sage); box-shadow: 0 0 0 0 rgba(95, 127, 102, .5); animation: live 1.8s var(--ease-out) infinite; }
@keyframes live { from { box-shadow: 0 0 0 0 rgba(95, 127, 102, .55); } to { box-shadow: 0 0 0 10px rgba(95, 127, 102, 0); } }
.people { list-style: none; padding: 0; margin: var(--s-3) 0 var(--s-5); }
.people__row { display: grid; grid-template-columns: 44px minmax(0, 1fr); gap: var(--s-3); align-items: start; padding: var(--s-4) 0; border-top: 1px solid var(--line); }
.people__row:first-child { border-top: 0; }
.people__row > .tag { grid-column: 2; justify-self: start; }
.people__row .avatar { width: 44px; height: 44px; font-size: 18px; }
.people__name { line-height: 1.35; }
.people__phone { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-2) var(--s-3); margin-top: var(--s-2); font-size: var(--fs-sm); }
.people__phone .icon { width: 16px; height: 16px; }
.people__tel { display: inline-flex; align-items: center; gap: 6px; min-height: var(--tap-min); font: 600 var(--fs-lg)/1 var(--font-ui); color: var(--ink); }
.people__empty { margin: var(--s-4) 0; }
.people__row.is-new { animation: people-in .7s var(--ease-out) both; background: linear-gradient(90deg, var(--blush-2), transparent 70%); }
@keyframes people-in { from { opacity: 0; transform: translateY(-8px); } }
.copy-row { display: flex; gap: var(--s-2); align-items: center; margin: var(--s-4) 0 var(--s-3); }
.copy-row > .input { flex: 1; min-width: 0; }
.copy-row__url { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding: 10px 12px; border-radius: var(--r-sm); background: var(--paper-2); font-size: var(--fs-sm); }
@media (min-width: 720px) { .people__row { grid-template-columns: 44px minmax(0, 1fr) auto; } .people__row > .tag { grid-column: 3; grid-row: 1; } }
@media (min-width: 1080px) {
  .creq { grid-template-columns: minmax(0, .9fr) minmax(0, 1.1fr); align-items: start; }
  .creq__main { grid-row: span 2; position: sticky; top: calc(var(--topbar-offset) + var(--s-6)); }
  .creq__actions { grid-column: 2; }
}

/* Blood centre scanner */
.scan { display: grid; gap: var(--s-4); }
.scan__view { position: relative; aspect-ratio: 4 / 3; border-radius: var(--r-lg); overflow: hidden; background: #1E1618; display: grid; place-items: center; }
.scan__view video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: 0; }
.scan__view.is-on video { opacity: 1; }
.scan__frame { position: relative; width: 58%; aspect-ratio: 1; border-radius: 18px;
  background: linear-gradient(#FBF6F1, #FBF6F1) top left / 28px 4px no-repeat, linear-gradient(#FBF6F1, #FBF6F1) top left / 4px 28px no-repeat,
    linear-gradient(#FBF6F1, #FBF6F1) top right / 28px 4px no-repeat, linear-gradient(#FBF6F1, #FBF6F1) top right / 4px 28px no-repeat,
    linear-gradient(#FBF6F1, #FBF6F1) bottom left / 28px 4px no-repeat, linear-gradient(#FBF6F1, #FBF6F1) bottom left / 4px 28px no-repeat,
    linear-gradient(#FBF6F1, #FBF6F1) bottom right / 28px 4px no-repeat, linear-gradient(#FBF6F1, #FBF6F1) bottom right / 4px 28px no-repeat; }
.scan__line { position: absolute; left: 21%; right: 21%; top: 50%; height: 2px; background: #FF6B7A; box-shadow: 0 0 12px #FF6B7A; animation: scanline 2.4s var(--ease-thread) infinite alternate; }
@keyframes scanline { from { transform: translateY(-95px); } }
.scan__hint { position: absolute; bottom: var(--s-3); left: 0; right: 0; text-align: center; color: #DCCBD2; font-size: var(--fs-sm); }
.scan__view.is-hit .scan__frame { animation: scanhit .7s var(--ease-out); }
@keyframes scanhit { from { transform: scale(1.12); filter: drop-shadow(0 0 16px #7BD389); } }
.scan__manual .copy-row { margin: var(--s-2) 0 0; }
.scan-result { margin-top: var(--s-4); }
.scan-result:empty { display: none; }
.scan-hit { display: grid; gap: var(--s-4); }
.scan-hit:focus:not(:focus-visible) { outline: none; }
.scan-hit__who { display: flex; gap: var(--s-3); align-items: center; flex-wrap: wrap; }
.scan-hit__who > div { flex: 1; min-width: 0; }
.scan-hit__req { display: flex; gap: var(--s-2); align-items: flex-start; }
.scan-hit__req .icon { width: 18px; height: 18px; color: var(--blood); margin-top: 3px; }
.avatar--lg { width: 56px; height: 56px; font-size: 22px; }
.used-form { display: flex; gap: var(--s-2); align-items: center; flex-wrap: wrap; justify-content: flex-end; }
.select--sm { min-height: var(--tap-min); font-size: var(--fs-sm); padding-top: 0; padding-bottom: 0; width: auto; }
.notice--error { color: var(--blood-deep); }
.notice--error .icon { color: var(--blood); }
.notice[tabindex]:focus:not(:focus-visible) { outline: none; }
.input--code { letter-spacing: .3em; font-variant-numeric: tabular-nums; max-width: 12ch; }

/* Relative's status page */
.rel__card { display: flex; gap: var(--s-6); align-items: center; margin-bottom: var(--s-4); }
.rel__n { font: 600 var(--fs-xl)/1.25 var(--font-display); }
.rel__state { margin-top: var(--s-3); font-weight: 600; color: var(--blood-deep); }
@media (max-width: 479px) { .rel__card { flex-direction: column; text-align: center; } }

/* Admin */
.org-card { display: grid; gap: var(--s-4); }
.org-card + .org-card { margin-top: var(--s-4); }
.org-card__head { display: flex; gap: var(--s-3); align-items: center; flex-wrap: wrap; }
.org-card__head > div { flex: 1; min-width: 12rem; }
.org-card__facts { list-style: none; padding: 0; display: grid; gap: var(--s-2); color: var(--ink-2); font-size: var(--fs-sm); }
.org-card__facts li { display: flex; gap: var(--s-2); align-items: flex-start; }
.org-card__facts .icon { width: 18px; height: 18px; margin-top: 1px; }
.table-wrap { position: relative; overflow-x: auto; padding: 0; }
.audit { width: 100%; border-collapse: collapse; font-size: var(--fs-sm); min-width: 620px; }
.audit th, .audit td { text-align: left; padding: var(--s-3) var(--s-4); border-top: 1px solid var(--line); vertical-align: top; }
.audit thead th { border-top: 0; color: var(--ink-2); font-weight: 600; background: var(--paper-2); }
.audit td:first-child { white-space: nowrap; font-variant-numeric: tabular-nums; }

/* ── Phone polish (iPhone + Android) ─────────────────────── */
@media (max-width: 719px) {
  .form-actions { flex-direction: column-reverse; }
  .form-actions .btn { width: 100%; }
  .quick { grid-template-columns: 1fr; }
  .quick a { min-height: 72px; grid-auto-flow: column; grid-template-columns: auto 1fr; align-items: center; }
  .cnew__groups { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .answer-grid .btn { min-height: 56px; font-size: 17px; }
  .rd__hero .group, .creq__hero .group { --fs-group: 72px; }
  .profile-head { flex-wrap: wrap; }
  .rank-card { flex-direction: column; align-items: flex-start; gap: var(--s-4); }
  .copy-row { flex-wrap: wrap; }
  .copy-row .btn { flex: 1 1 auto; }
  .table-wrap { -webkit-overflow-scrolling: touch; overscroll-behavior-x: contain; }
  .now__grid .thread { display: none; } /* decorative connector can spill on narrow screens */
  .section { margin-top: var(--s-12); }
}

@media (max-width: 480px) {
  .tiles--5 { --cols: 3 !important; }
}
@media (max-width: 379px) {
  .valley__title { font-size: clamp(28px, 9vw, 34px); max-width: 14ch; }
  .valley__lede { font-size: var(--fs-md); }
  .tiles { gap: 6px; }
  .tiles--5 { --cols: 2 !important; }
  .tile__body { min-height: 44px; padding: 8px 4px; font-size: 14px; }
  .tile--group .tile__body { font-size: 20px; }
}

/* ── Scenario tour (?demo=1) ─────────────────────────────── */
.tour__hero { margin-bottom: var(--s-8); max-width: 40rem; }
.tour-grid { display: grid; gap: var(--s-6); margin-top: var(--s-6); }
@media (min-width: 900px) { .tour-grid { grid-template-columns: 1fr 1fr; align-items: start; } }
.tour-path__head { display: flex; flex-wrap: wrap; gap: var(--s-4); justify-content: space-between; align-items: flex-end; margin-bottom: var(--s-5); }
.tour-path__prog { display: grid; gap: 6px; min-width: 140px; }
.tour-path__bar { display: block; height: 6px; border-radius: 99px; background: var(--paper-2); overflow: hidden; }
.tour-path__bar i { display: block; height: 100%; background: linear-gradient(90deg, var(--blood), #D45A5A); border-radius: 99px; transition: width .4s var(--ease-out); }
.tour-steps { list-style: none; padding: 0; margin: 0; display: grid; gap: var(--s-2); }
.tour-step__btn {
  display: grid; grid-template-columns: 40px minmax(0, 1fr) auto; gap: var(--s-3); align-items: center;
  width: 100%; min-height: var(--tap); padding: var(--s-3) var(--s-4); text-align: left;
  border-radius: var(--r-lg); border: 1.5px solid var(--line); background: var(--surface);
  transition: border-color var(--t-fast) ease, background var(--t-fast) ease, box-shadow var(--t-fast) ease;
}
.tour-step__btn:hover { border-color: var(--line-strong); background: var(--paper-2); }
.tour-step.is-now .tour-step__btn { border-color: var(--blood); box-shadow: inset 0 0 0 1px var(--blood); background: var(--blush-2); }
.tour-step.is-done .tour-step__btn { border-color: var(--sage); }
.tour-step__n {
  display: grid; place-items: center; width: 40px; height: 40px; border-radius: 50%;
  background: var(--paper-2); color: var(--ink-2); font: 700 15px/1 var(--font-ui);
}
.tour-step.is-done .tour-step__n { background: var(--sage-soft); color: var(--sage-ink); }
.tour-step.is-now .tour-step__n { background: var(--blush); color: var(--blood-deep); }
.tour-step__n .icon { width: 18px; height: 18px; }
.tour-step__body { display: grid; gap: 2px; min-width: 0; }
.tour-step__body b { font: 600 15px/1.3 var(--font-ui); color: var(--ink); }
.tour-step__hint { font-size: var(--fs-xs); color: var(--ink-2); line-height: 1.4; }
.tour-step__go { display: inline-flex; align-items: center; gap: 4px; font: 600 13px/1 var(--font-ui); color: var(--blood-deep); white-space: nowrap; }
.tour-step__go .icon { width: 16px; height: 16px; }
.tour-roles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s-2); }
@media (min-width: 720px) { .tour-roles { grid-template-columns: repeat(5, minmax(0, 1fr)); } }
.tour-roles button {
  display: flex; align-items: center; justify-content: center; min-height: var(--tap); padding: 0 var(--s-3);
  border-radius: var(--r-md); border: 1.5px solid var(--line); background: var(--surface);
  font: 500 14px/1.2 var(--font-ui); color: var(--ink);
}
.tour-roles button[aria-pressed="true"] { border-color: var(--blood); background: var(--blush-2); color: var(--blood-deep); font-weight: 600; }
.tour-more__row { display: flex; flex-wrap: wrap; gap: var(--s-3); margin-top: var(--s-4); }

.tour-dock {
  position: fixed; z-index: 70; left: var(--s-3); right: var(--s-3); bottom: calc(var(--s-3) + env(safe-area-inset-bottom));
  pointer-events: none;
}
.tour-dock__in {
  pointer-events: auto; display: grid; gap: var(--s-3);
  padding: var(--s-4); border-radius: var(--r-xl); background: var(--surface);
  border: 1px solid var(--line); box-shadow: var(--shadow-2);
  animation: toast-up var(--t-med) var(--ease-out) both;
}
.tour-dock__meta { display: flex; flex-wrap: wrap; gap: var(--s-2); align-items: center; justify-content: space-between; }
.tour-dock__pill {
  display: inline-flex; align-items: center; padding: 4px 10px; border-radius: var(--r-pill);
  background: var(--blush); color: var(--blood-deep); font: 600 12px/1.2 var(--font-ui);
}
.tour-dock__actions { display: flex; flex-wrap: wrap; gap: var(--s-2); align-items: center; }
@media (min-width: 720px) {
  .tour-dock { left: auto; right: var(--s-6); bottom: var(--s-6); width: min(420px, calc(100vw - 48px)); }
  body.has-tabbar .tour-dock { bottom: calc(var(--tabbar-h) + var(--s-4) + env(safe-area-inset-bottom)); }
}
@media (min-width: 1080px) { body.has-tabbar .tour-dock { bottom: var(--s-6); } }
body.has-tour-dock #main { padding-bottom: calc(140px + env(safe-area-inset-bottom)); }

.valley__cap--play { cursor: pointer; }
.valley__cap--play:focus-visible { outline: 3px solid var(--on-night); outline-offset: 4px; border-radius: 12px; }
.valley__play {
  display: inline-flex; margin-top: 8px; font: 600 13px/1.2 var(--font-ui);
  color: var(--blood); text-decoration: underline; text-underline-offset: 3px;
}
.valley.is-live .valley__play { color: var(--night-red); }

/* ── Blood stock (#/stock and the home block) ── */
.stock .page-head .label, .stock-teaser > .label, .stock-sum > .label { display: flex; align-items: center; gap: 6px; }
.stock .page-head .label .icon, .stock-teaser > .label .icon, .stock-sum > .label .icon { width: 16px; height: 16px; flex: none; }

.stock-pick { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-2); margin-bottom: var(--s-5); }
.stock-pick .caption { margin-right: var(--s-1); }
.stock-pick__b {
  min-width: var(--tap-min); max-width: 100%; min-height: var(--tap-min); padding: 8px 14px; border-radius: var(--r-pill);
  border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink);
  font: 600 14px/1.2 var(--font-ui); text-align: center; cursor: pointer;
  white-space: normal; overflow-wrap: anywhere;
}
.stock-pick__b:hover { background: var(--paper-2); }
.stock-pick__b[aria-pressed="true"] { background: var(--blood); border-color: var(--blood); color: #fff; }
.stock-pick__b:first-of-type { font: 600 14px/1 var(--font-ui); }

.stock-sum { margin-bottom: var(--s-4); min-width: 0; }
.stock-mine { margin-bottom: var(--s-4); }
.stock-short { list-style: none; margin: var(--s-3) 0 0; padding: 0; display: grid; }
.stock-short__i {
  display: grid; grid-template-columns: minmax(0, 11rem) minmax(0, 1fr); gap: var(--s-3); align-items: center; min-width: 0;
  padding: var(--s-2) 0; border-top: 1px solid var(--line);
}
.stock-short__i:first-child { border-top: 0; }
.stock-short__g {
  display: grid; place-items: center; min-height: 40px; padding: 6px 12px; border-radius: var(--r-pill);
  background: var(--blush); color: var(--blood-deep); font: 700 13px/1.2 var(--font-ui); text-align: center;
  overflow-wrap: anywhere;
}
.stock-short__at { display: flex; flex-wrap: wrap; gap: 2px var(--s-3); font-size: var(--fs-sm); color: var(--ink); }
.stock-short__p { white-space: nowrap; }
.stock-short__p b { color: var(--blood-deep); font-variant-numeric: tabular-nums; }

.stock-legend { list-style: none; margin: 0 0 var(--s-4); padding: 0; display: flex; flex-wrap: wrap; gap: var(--s-2) var(--s-4); font-size: var(--fs-xs); color: var(--ink-2); }
.stock-legend__i { display: inline-flex; align-items: center; gap: 6px; }
.stock-legend__i::before { content: ""; width: 10px; height: 10px; border-radius: 50%; background: var(--sage); }
.stock-legend__i--low::before { background: var(--blood); }
.stock-legend__i--mid::before { background: var(--gold); }
.stock-legend__i--norm::before { width: 8px; height: 14px; border-radius: 1px 1px 6px 6px; background: linear-gradient(to top, var(--blood) 0 70%, #fff 70%); box-shadow: inset 0 0 0 1px rgba(120, 90, 85, .45); }

.stock-grid { display: grid; gap: var(--s-4); }
@media (min-width: 760px) { .stock-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.stock-card { display: grid; gap: var(--s-4); align-content: start; min-width: 0; animation: stock-in .7s cubic-bezier(.2, .8, .2, 1) both; }
.stock-card:nth-child(2) { animation-delay: .06s; }
.stock-card:nth-child(3) { animation-delay: .12s; }
.stock-card:nth-child(4) { animation-delay: .18s; }
.stock-card:nth-child(5) { animation-delay: .24s; }
.stock-card:nth-child(6) { animation-delay: .3s; }
.stock-card:nth-child(7) { animation-delay: .36s; }
@keyframes stock-in { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .stock-card { animation: none; } }
.stock-card__head { display: grid; gap: 4px; min-width: 0; }
.stock-card__name { font: 600 var(--fs-lg)/1.3 var(--font-display); overflow-wrap: anywhere; }
.stock-card__status { margin-top: var(--s-1); display: flex; flex-wrap: wrap; gap: 6px; min-width: 0; }
.stock-card__status .tag {
  white-space: normal; max-width: 100%; align-items: flex-start; overflow-wrap: anywhere;
}
.stock-card__status .tag .icon { flex: none; margin-top: 1px; }
.stock-card.is-old .stock-chart { filter: none; }

/* The chart: one glass test tube per group, filled with blood to the stock level; a full tube is 100% of the norm. */
.stock-chart {
  --tube-w: 22px; --tube-h: 104px;
  list-style: none; margin: 0; padding: var(--s-2) 0 0;
  display: grid; grid-template-columns: repeat(8, minmax(0, 1fr)); align-items: end;
}
@media (min-width: 480px) { .stock-chart { --tube-w: 26px; --tube-h: 120px; } }
@media (min-width: 1080px) { .stock-chart { --tube-w: 30px; --tube-h: 132px; } }
.stock-col { display: grid; justify-items: center; gap: 6px; min-width: 0; transition: opacity .25s; }
.stock-col.is-dim { opacity: .22; }
.stock-col__v {
  font: 700 12px/1 var(--font-ui); font-variant-numeric: tabular-nums; white-space: nowrap; letter-spacing: -.01em;
  color: var(--sage-ink);
}
.stock-col--mid .stock-col__v { color: var(--gold-ink); }
.stock-col--low .stock-col__v { color: #fff; background: var(--blood); padding: 3px 4px; border-radius: var(--r-pill); }
@media (min-width: 480px) {
  .stock-col__v { font-size: 13px; letter-spacing: 0; }
  .stock-col--low .stock-col__v { padding: 3px 6px; }
}
.stock-col__g { max-width: 100%; font: 700 12px/1.15 var(--font-ui); color: var(--ink); text-align: center; overflow-wrap: anywhere; }
.stock-col--low .stock-col__g { color: var(--blood-deep); }

/* The tube: a lip on top, a glass body with a round bottom, graduation marks and a highlight. */
.flask { position: relative; display: block; width: var(--tube-w); height: var(--tube-h); padding-top: 5px; }
.flask::before {
  content: ""; position: absolute; top: 0; left: -4px; right: -4px; height: 6px; border-radius: 3px;
  background: linear-gradient(180deg, #fff, #e9dfd9); box-shadow: 0 0 0 1px rgba(120, 90, 85, .28);
}
.flask__glass {
  position: relative; display: block; height: 100%; overflow: hidden;
  border-radius: 2px 2px 999px 999px;
  background:
    repeating-linear-gradient(to top, transparent 0 calc(25% - 1px), rgba(107, 90, 85, .28) calc(25% - 1px) 25%) right 3px top 0 / 6px 100% no-repeat,
    linear-gradient(90deg, rgba(255, 255, 255, .9), rgba(244, 236, 228, .55) 45%, rgba(255, 255, 255, .85));
  box-shadow: inset 0 0 0 1.5px rgba(120, 90, 85, .3), 0 8px 14px -10px rgba(60, 20, 20, .45);
}
/* Glass highlight, above the blood */
.flask__glass::after {
  content: ""; position: absolute; z-index: 2; left: 22%; top: 6px; bottom: 12px; width: 3px; border-radius: 3px;
  background: linear-gradient(180deg, rgba(255, 255, 255, .95), rgba(255, 255, 255, .35));
}
.flask__blood {
  position: absolute; left: 0; right: 0; bottom: 0; height: calc(var(--f) * 100%);
  background: linear-gradient(90deg, #7A0A1D 0%, #B3122E 30%, #D8304C 55%, #A10F28 85%, #6E0819 100%);
}
.stock-col--mid .flask__blood, .stock-col--ok .flask__blood { filter: saturate(1.05); }
/* The surface of the blood: a small wave pattern, drifting sideways */
.flask__wave {
  position: absolute; left: 0; right: 0; bottom: 100%; height: 5px; margin-bottom: -1px;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='5' viewBox='0 0 16 5'%3E%3Cpath d='M0 3 Q4 0 8 3 T16 3 V5 H0Z' fill='%23C51F3C'/%3E%3C/svg%3E") repeat-x 0 0 / 16px 5px;
}
.stock-col.is-empty .flask__wave, .stock-col.is-empty .flask__bubble { display: none; }
.stock-col.is-over .flask__wave { display: none; }
.flask__bubble {
  position: absolute; bottom: 0; width: 4px; height: 4px; border-radius: 50%;
  background: rgba(255, 255, 255, .55); opacity: 0;
}
.flask__bubble:nth-child(2) { left: 55%; }
.flask__bubble:nth-child(3) { left: 30%; width: 3px; height: 3px; }

@keyframes flask-fill { from { height: 0; } }
@keyframes flask-wave { to { background-position-x: 16px; } }
@keyframes flask-bubble {
  0% { bottom: 0; opacity: 0; }
  15% { opacity: .9; }
  85% { opacity: .6; }
  100% { bottom: calc(100% - 6px); opacity: 0; }
}
.flask__blood { animation: flask-fill 1.1s cubic-bezier(.2, .8, .2, 1) both; animation-delay: calc(var(--i, 0) * 70ms); }
@media (prefers-reduced-motion: no-preference) {
  .flask__wave { animation: flask-wave 1.6s linear infinite; }
  .flask__bubble:nth-child(2) { animation: flask-bubble 3.2s ease-in infinite; animation-delay: calc(1.2s + var(--i, 0) * 0.37s); }
  .flask__bubble:nth-child(3) { animation: flask-bubble 4.1s ease-in infinite; animation-delay: calc(2s + var(--i, 0) * 0.53s); }
}
@media (prefers-reduced-motion: reduce) { .flask__blood { animation-duration: .01ms; } }

.stock-wait { padding: var(--s-5) 0; }
.stock-err { display: grid; gap: var(--s-3); justify-items: start; }
.stock-stale { margin-bottom: var(--s-4); }
.stock-note { margin-top: var(--s-5); }
.stock-cta { margin-top: var(--s-6); display: flex; flex-wrap: wrap; gap: var(--s-4); align-items: center; justify-content: space-between; }
.stock-cta p { margin-top: var(--s-1); }
.stock-teaser { display: grid; gap: var(--s-2); }
.stock-teaser__more { margin-top: var(--s-2); }
.stock-teaser__more a { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; }
.stock-teaser__more .icon { width: 16px; height: 16px; }

/* Map lives inside the app, not on the old /map page. */
.appmap__lead { max-width: 40rem; }
.appmap__bar { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 20px; margin-bottom: var(--s-4); }
.appmap__summary { margin: 0; }
.appmap__layout { display: grid; grid-template-columns: minmax(0, 1.7fr) minmax(220px, 0.7fr); gap: var(--s-4); align-items: stretch; }
.appmap__canvas-wrap { background: var(--paper-2); border: 1px solid var(--line); border-radius: var(--r-lg); overflow: hidden; display: flex; flex-direction: column; min-width: 0; }
.appmap__canvas { width: 100%; height: min(68vh, 580px); min-height: 380px; background: var(--paper-2); z-index: 0; }
.appmap__hint { margin: 0; padding: 8px 12px 10px; border-top: 1px solid var(--line); background: var(--surface); }
.appmap__side { min-width: 0; display: flex; flex-direction: column; max-height: min(68vh, 580px); }
.appmap__side h2 { margin-bottom: var(--s-3); }
.appmap__regions { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; overflow: auto; min-height: 0; }
.appmap__region { width: 100%; display: flex; justify-content: space-between; align-items: center; gap: 12px; min-height: 44px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); color: var(--ink); font: inherit; text-align: left; cursor: pointer; }
.appmap__region:hover, .appmap__region.is-active { border-color: var(--blood); background: var(--blush-2); }
.appmap__region-main { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.appmap__region-name { font-weight: 600; }
.appmap__region-cities { color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.appmap__count { font: 700 16px/1 var(--font-display); color: var(--blood-deep); }
.appmap__note { margin: 12px 0 0; }
.appmap .map-marker-wrap { background: transparent !important; border: 0 !important; }
.appmap .map-marker { display: flex; align-items: center; justify-content: center; border-radius: 50%; font: 700 12px/1 var(--font-ui); color: #fff; border: 2px solid #fff; box-sizing: border-box; }
.appmap .map-marker--donors { background: var(--blood); }
.appmap .map-marker--center { width: 28px; height: 28px; background: var(--ink); font-size: 16px; }
.appmap__cities { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.appmap__city { display: inline-flex; align-items: center; gap: 8px; min-height: 40px; padding: 6px 12px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); color: var(--ink); font: inherit; cursor: pointer; }
.appmap__city strong { color: var(--blood-deep); }
.appmap__city.is-active, .appmap__city:hover { border-color: var(--blood); background: var(--blush-2); }
.appmap__center { margin: 0 0 8px; font-weight: 600; }
.appmap__dl { margin: 0; display: grid; gap: 8px; }
.appmap__dl div { display: grid; gap: 2px; }
.appmap__dl dt { font-size: 11px; letter-spacing: .04em; text-transform: uppercase; color: var(--ink-2); }
.appmap__dl dd { margin: 0; }
.appmap__block { margin-top: var(--s-4); padding-top: var(--s-3); border-top: 1px solid var(--line); }
.appmap__block h3 { margin-bottom: 8px; }
@media (max-width: 860px) {
  .appmap__layout { grid-template-columns: 1fr; }
  .appmap__canvas { height: min(52vh, 420px); min-height: 280px; }
  .appmap__side { max-height: none; }
  .appmap__regions { display: grid; grid-template-columns: 1fr 1fr; }
}