/* ============================================================================
 * stories.css — the stories row in the chat list's head and the story viewer.
 *
 * Rendered by public/js/stories/ (view.js builds the markup, addon.js runs it).
 * Token-only (--hz-*): every colour, radius, duration and easing comes from
 * the design system, so both themes and the Telegram host follow on their own.
 * Avatars ride the app's `.av` tile (app.css) — photo, emoji and the
 * failed-image fallback included — and skill tiles ride `.ag-chip-spark`, the
 * same gradient tiles the composer chips and the skill grid use.
 *
 * Motion is compositor-only (opacity / transform) and switched off by
 * prefers-reduced-motion. Touch targets meet --hz-tap-min. Story-specific
 * values (ring, portrait, veil, glass, CTA) live in tokens.css under --hz-story-*.
 * ========================================================================== */

/* ── The row ──────────────────────────────────────────────────────────────── */
/* It lives in the chat list's head (.sb-head), between the brand row and the
   search field, full bleed (.hz-panel-head-bleed): the head's gap spaces it
   from both, so the row adds only the clearance its focus ring needs above and
   below, and no rule of its own — the search field under it is the edge. */
.hz-stories { flex-shrink: 0; }

.hz-st-row {
  list-style: none;
  margin: 0;
  padding: var(--hz-space-1) var(--hz-space-4);
  display: flex;
  gap: var(--hz-space-3);
  overflow-x: auto;
  overscroll-behavior-x: contain;
  scroll-snap-type: x proximity;
  scroll-padding-inline: var(--hz-space-4);
  scrollbar-width: none;
  /* No -webkit-overflow-scrolling: touch here. The row starts hidden and is
     shown once the feed arrives; on iOS WebKit a touch-scrolling layer that
     appears that way can stay blank (height, no paint) until it is scrolled —
     the PWA showed a white strip. Momentum scrolling is iOS's default anyway;
     the skill rail (.hz-srail, skills.css) scrolls the same way. */
}
.hz-st-row::-webkit-scrollbar { display: none; }
.hz-st-li { flex: 0 0 auto; scroll-snap-align: start; display: flex; }

.hz-st {
  width: var(--hz-story-tile-w);
  min-height: var(--hz-tap-min);
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--hz-text);
  font-family: var(--hz-font-body);   /* a <button> does not inherit it */
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--hz-space-1);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}
.hz-st:focus-visible { outline: none; }
.hz-st:focus-visible .hz-st-ring { box-shadow: 0 0 0 var(--hz-focus-width) var(--hz-brand-glow); }

/* The ring: a gradient for a story not yet watched, a hairline once watched. */
.hz-st-ring {
  position: relative;
  width: var(--hz-story-ring-size);
  height: var(--hz-story-ring-size);
  border-radius: var(--hz-radius-avatar);
  padding: var(--hz-story-ring-pad);
  background: var(--hz-story-ring);
}
.hz-st--seen .hz-st-ring { background: var(--hz-story-ring-seen); padding: var(--hz-story-ring-pad-seen); }
.hz-st-av.av {
  width: 100%;
  height: 100%;
  border-radius: var(--hz-radius-avatar);
  border: var(--hz-story-ring-cut) solid var(--hz-surface-canvas);
  font-size: var(--hz-story-face-glyph);
  box-sizing: border-box;
}
.hz-st--seen .hz-st-av.av { border-width: var(--hz-story-ring-cut-seen); }

/* The lead ring (HzStories.setLead — Picks): its own gradient, a glyph for a face, a progress badge. */
.hz-st--lead .hz-st-ring { background: var(--hz-pick-ring-lead); }
.hz-st--lead.hz-st--seen .hz-st-ring { background: var(--hz-story-ring-seen); }
.hz-st-lead-face.hz-st-svc { background: var(--hz-pick-match-bg); color: var(--hz-text-onbrand); }
.hz-st-lead-face svg { width: 46%; height: 46%; fill: currentColor; stroke: none; }
/* The lead's own picture (Picks: the mascot's logo, its own blue ground) fills the ring's face. */
.hz-st-lead-img { width: 100%; height: 100%; border-radius: 50%; object-fit: cover; pointer-events: none; }
.hz-st-lead-n {
  position: absolute; right: var(--hz-story-badge-nudge); bottom: var(--hz-story-badge-nudge);
  min-width: var(--hz-story-badge-size); height: var(--hz-story-badge-size); padding: 0 var(--hz-space-1);
  border-radius: var(--hz-radius-pill); border: var(--hz-story-badge-border) solid var(--hz-surface);
  background: var(--hz-brand); color: var(--hz-text-onbrand);
  font-size: var(--hz-text-2xs); font-weight: var(--hz-weight-bold); line-height: calc(var(--hz-story-badge-size) - 2 * var(--hz-story-badge-border));
  text-align: center; box-sizing: border-box;
}
/* A service has no portrait: its glyph on its own colours. */
.hz-st-svc { display: flex; align-items: center; justify-content: center; color: var(--hz-text-onbrand); background: var(--hz-ai-gradient); }
.hz-st-av.hz-st-svc svg { width: 44%; height: 44%; }

.hz-st-l {
  width: 100%;
  font-size: var(--hz-text-2xs);
  line-height: var(--hz-story-label-leading);
  font-weight: var(--hz-weight-semibold);
  text-align: center;
  color: var(--hz-text);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  /* A name too wide for the tile (a German compound, a long agent name) breaks
     at a syllable with a hyphen, in the document's language (<html lang>);
     only a word with no break point at all is cut where it must be. */
  overflow-wrap: anywhere;
  -webkit-hyphens: auto;
  hyphens: auto;
}
.hz-st--seen .hz-st-l { color: var(--hz-text-muted); font-weight: var(--hz-weight-medium); }

@media (prefers-reduced-motion: no-preference) {
  .hz-st .hz-st-ring { transition: transform var(--hz-dur-fast) var(--hz-ease); }
  .hz-st:active .hz-st-ring { transform: scale(.94); }
}
/* A lead ring whose door is on its way (the interests survey: up to three
   round trips on a phone connection) says so at once — a tap that seemed to do
   nothing is how people moved on to another story. The face breathes; with
   reduced motion it simply dims. Further taps wait for the first (addon.js). */
.hz-st--busy { cursor: progress; }
.hz-st--busy .hz-st-lead-face { opacity: .6; }
@media (prefers-reduced-motion: no-preference) {
  .hz-st--busy .hz-st-lead-face { opacity: 1; animation: hz-st-busy calc(var(--hz-dur-slow) * 2.5) var(--hz-ease) infinite alternate; }
}
@keyframes hz-st-busy { to { opacity: .45; } }

/* ── The viewer ───────────────────────────────────────────────────────────── */
.hz-stv {
  position: fixed;
  inset: 0;
  z-index: var(--hz-story-z);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  color: var(--hz-story-ink);         /* on the author's colours, in both themes */
  font-family: var(--hz-font-body);
}
.hz-stv--in { opacity: 1; }
/* The dialog takes focus on open (screen readers announce it); it draws no ring. */
.hz-stv:focus { outline: none; }
.hz-stv-scrim { position: absolute; inset: 0; background: var(--hz-story-stage); opacity: var(--stv-pull, 1); }

.hz-stv-card {
  --stv-pad: var(--hz-space-4);
  position: relative;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--hz-story-card);
  touch-action: none;                 /* the card's gestures are its own */
  user-select: none;
  -webkit-user-select: none;
}
.hz-stv-bg { position: absolute; inset: 0; background: var(--stv-bg, var(--hz-ai-gradient)); }
/* The cover: the result the skill makes, filling the card behind the words. */
.hz-stv-cover { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: block; }
/* Legibility: the top and the bottom of any gradient read as dark. */
.hz-stv-bg::after {
  content: '';
  position: absolute;
  inset: 0;
  background: var(--hz-story-veil);
}
.hz-stv-card--cover .hz-stv-bg::after { background: var(--hz-story-cover-veil); }
.hz-stv-tag {
  display: inline-flex;
  align-items: center;
  min-height: var(--hz-space-6);
  padding: 0 var(--hz-space-3);
  border-radius: var(--hz-radius-pill);
  background: var(--hz-story-tag-bg);
  -webkit-backdrop-filter: var(--hz-story-tag-blur);
  backdrop-filter: var(--hz-story-tag-blur);
  font-size: var(--hz-text-xs);
  font-weight: var(--hz-weight-semibold);
}
/* Above the background — the menu keeps its own (absolute) placement. */
.hz-stv-card > :not(.hz-stv-bg):not(.hz-stv-menu):not(.hz-stv-burst) { position: relative; }

.hz-stv-top { padding: calc(env(safe-area-inset-top, 0px) + var(--hz-space-2)) var(--hz-space-2) 0; }
.hz-stv-bars { display: flex; gap: var(--hz-space-1); padding: 0 var(--hz-space-1); }
.hz-stv-bar { flex: 1; height: var(--hz-story-bar-h); border-radius: var(--hz-radius-2); background: var(--hz-story-track); overflow: hidden; }
.hz-stv-bar i { display: block; height: 100%; background: var(--hz-story-ink); transform: scaleX(0); transform-origin: left center; will-change: transform; }
.hz-stv[dir="rtl"] .hz-stv-bar i { transform-origin: right center; }
.hz-stv-bar--done i { transform: scaleX(1); }

.hz-stv-head { display: flex; align-items: center; gap: var(--hz-space-2); padding: var(--hz-space-2) 0 0 var(--hz-space-2); min-height: var(--hz-tap-min); }
.hz-stv-hav.av { width: var(--hz-story-head-av); height: var(--hz-story-head-av); border-radius: var(--hz-radius-avatar); border: var(--hz-story-hairline); font-size: var(--hz-story-head-av-glyph); box-sizing: border-box; }
.hz-stv-hav.hz-st-svc svg { width: 50%; height: 50%; }
.hz-stv-who { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: var(--hz-story-label-leading); }
/* A long agent name ("Репетитор по английскому") takes a second line rather than an ellipsis. */
.hz-stv-who b { font-size: var(--hz-text-base); font-weight: var(--hz-weight-bold); display: -webkit-box; -webkit-line-clamp: var(--hz-story-name-lines); -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere; }
.hz-stv-who small { font-size: var(--hz-text-xs); opacity: .82; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hz-stv-btn {
  width: var(--hz-tap-min);
  height: var(--hz-tap-min);
  flex: 0 0 auto;
  border: 0;
  border-radius: var(--hz-radius-avatar);
  background: transparent;
  color: var(--hz-story-ink);
  display: grid;
  place-items: center;
  cursor: pointer;
  touch-action: manipulation;
}
.hz-stv-btn svg { width: var(--hz-story-icon); height: var(--hz-story-icon); }
.hz-stv-btn:focus-visible, .hz-stv-cta:focus-visible, .hz-stv-send:focus-visible, .hz-stv-menu button:focus-visible, .hz-stv-nav:focus-visible {
  outline: var(--hz-story-focus);
  outline-offset: var(--hz-story-focus-offset);
}

.hz-stv-menu {
  position: absolute;
  top: calc(env(safe-area-inset-top, 0px) + var(--hz-space-16));
  inset-inline-end: var(--hz-space-3);
  z-index: var(--hz-z-raised);
  min-width: var(--hz-story-menu-w);
  padding: var(--hz-space-1);
  border-radius: var(--hz-radius-lg);
  background: var(--hz-story-menu-bg);
  box-shadow: var(--hz-story-menu-shadow);
  display: flex;
  flex-direction: column;
}
.hz-stv-menu[hidden] { display: none; }
.hz-stv-menu button {
  min-height: var(--hz-tap-min);
  padding: 0 var(--hz-space-3);
  border: 0;
  border-radius: var(--hz-radius-8);
  background: transparent;
  color: var(--hz-story-ink);
  font: inherit;
  font-size: var(--hz-text-base);
  text-align: start;
  cursor: pointer;
}

.hz-stv-body {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  padding: 0 var(--stv-pad);
  overflow: hidden;
}
/* The face in the open space (picks.css .hz-pk-por): what the story is about, before the words. */
.hz-stv-hero { flex: 1 1 auto; min-height: 0; display: flex; align-items: center; justify-content: center; }
.hz-stv-por { position: relative; }
.hz-stv-por-av.av {
  width: var(--hz-story-portrait);
  height: var(--hz-story-portrait);
  border-radius: var(--hz-radius-avatar);
  border: var(--hz-story-portrait-border);
  box-shadow: var(--hz-story-portrait-shadow);
  font-size: var(--hz-story-portrait-glyph);
  box-sizing: border-box;
}
.hz-stv-por-av.hz-st-svc svg { width: 46%; height: 46%; }
/* The words, at the bottom over the darkest part of the veil — the Picks card's order. */
.hz-stv-words {
  flex: 0 0 auto;
  margin-top: auto;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: var(--hz-space-2);
  padding-top: var(--hz-space-3);
  text-align: start;
}
.hz-stv-title {
  margin: 0;
  font-family: var(--hz-font-display);
  font-size: var(--hz-story-title-size);
  line-height: var(--hz-story-title-leading);
  font-weight: var(--hz-weight-bold);
  text-wrap: balance;
  text-shadow: var(--hz-story-title-shadow);
  overflow-wrap: anywhere;
  display: -webkit-box;
  -webkit-line-clamp: var(--hz-story-title-lines);
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.hz-stv-title--long { font-size: var(--hz-story-title-size-long); }
.hz-stv-text {
  margin: 0;
  font-size: var(--hz-text-base);
  line-height: var(--hz-leading-normal);
  opacity: .94;
  display: -webkit-box;
  -webkit-line-clamp: 4;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
/* A skill's message, as the bubble it will be in the chat: the person's own, on the reading end. */
.hz-stv-says {
  position: relative;
  align-self: flex-end;
  max-width: min(88%, var(--hz-story-measure));
  margin: var(--hz-space-1) 0 0;
  padding: var(--hz-space-2) var(--hz-space-3);
  border-radius: var(--hz-radius-xl);
  border-end-end-radius: var(--hz-radius-sm);
  background: var(--hz-story-glass);
  border: var(--hz-story-glass-border);
  -webkit-backdrop-filter: var(--hz-story-glass-blur);
  backdrop-filter: var(--hz-story-glass-blur);
  font-size: var(--hz-text-base);
  line-height: var(--hz-leading-normal);
}
.hz-stv-says-t { display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere; }
.hz-stv-sr { position: absolute; width: var(--hz-space-px); height: var(--hz-space-px); overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; }
.hz-stv-needs { margin: 0; font-size: var(--hz-text-xs); opacity: .85; }

/* ── The growth story — the row's standing ring ──────────────────────────────
   Its face is the person's points, not a glyph; inside, three slides drawn
   from numbers (view.js growthHtml). The level's ring and the week are the
   design system's atoms (.hz-ring, .hz-days) in the story's own ink: the
   tokens they read are re-pointed here, never their rules. */
.hz-st-count b {
  font-family: var(--hz-font-display);
  font-size: var(--hz-story-count-size);
  font-weight: var(--hz-weight-bold);
  line-height: 1;
  letter-spacing: -.02em;
  direction: ltr; unicode-bidi: isolate;
}
.hz-st-count--long b { font-size: var(--hz-story-count-size-long); }
/* Nothing to turn down on a person's own growth: no ⋯ menu. */
.hz-stv--standing [data-stv="more"] { display: none; }

.hz-stv-g {
  flex-direction: column;
  gap: var(--hz-space-4);
  /* the atoms' tokens, in the story's ink */
  --hz-surface-hover: var(--hz-story-g-track);
  --hz-brand: var(--hz-story-ink);
  --hz-text: var(--hz-story-ink);
  --hz-text-muted: var(--hz-story-ink);
  --hz-text-onbrand: var(--hz-ink-900);
  --hz-border-strong: var(--hz-story-g-track);
}
.hz-stv-g-ring { --hz-ring-size: var(--hz-story-g-ring); --hz-ring-stroke: 3; }
.hz-stv-g-num { direction: ltr; unicode-bidi: isolate; }
.hz-stv-g-big {
  display: flex; flex-direction: column; align-items: center; gap: var(--hz-space-1);
  font-family: var(--hz-font-display);
  font-size: var(--hz-story-g-big);
  font-weight: var(--hz-weight-bold);
  line-height: 1;
  text-shadow: var(--hz-story-title-shadow);
}
.hz-stv-g-big small { font-family: var(--hz-font-body, inherit); font-size: var(--hz-text-sm); font-weight: var(--hz-weight-semibold); opacity: .85; }
.hz-stv-g-chips { display: flex; flex-wrap: wrap; justify-content: center; gap: var(--hz-space-2); }
.hz-stv-g-chip {
  padding: var(--hz-space-1) var(--hz-space-3);
  border-radius: var(--hz-radius-pill);
  background: var(--hz-story-glass);
  border: var(--hz-story-glass-border);
  font-size: var(--hz-text-sm);
  font-weight: var(--hz-weight-semibold);
}
.hz-stv-g-days { width: min(100%, var(--hz-story-measure)); --hz-day-size: var(--hz-story-g-dot); }
.hz-stv-g-days .hz-day-dot { width: var(--hz-story-g-dot); height: var(--hz-story-g-dot); }
/* The shared slide — what the person did in the last 30 days. On top, who they
   are here (the ring made small, the level's name, the points and the place);
   under it one glass panel: the window and the points it brought, then a row a
   deed — its picture, its name, how many. Names start at the row's start and
   figures end at its end in either direction. */
.hz-stv-g--month { gap: var(--hz-space-3); justify-content: safe center; }
/* A phone too short for the whole list keeps every row: the cat steps aside, its line stays. */
@media (max-height: 700px) {
  .hz-stv-g--month + .hz-stv-words .hz-stv-g-cat img { display: none; }
  .hz-stv-g--month + .hz-stv-words .hz-stv-g-says { border-end-start-radius: var(--hz-radius-xl); }
  .hz-stv-g--month { gap: var(--hz-space-2); }
  .hz-stv-g--month .hz-stv-g-did { padding-block: var(--hz-space-2); }
}
.hz-stv-g-me {
  width: min(100%, var(--hz-story-measure));
  display: flex; align-items: center; gap: var(--hz-space-3);
}
.hz-stv-g-me .hz-stv-g-ring { flex: 0 0 auto; --hz-ring-size: var(--hz-story-g-ring-sm); --hz-ring-stroke: 3.5; }
.hz-stv-g-me .hz-ring-label { font-size: var(--hz-text-lg); }
.hz-stv-g-me-t { min-width: 0; display: flex; flex-direction: column; gap: var(--hz-space-1); text-align: start; }
.hz-stv-g-me-t b { font-family: var(--hz-font-display); font-size: var(--hz-text-lg); font-weight: var(--hz-weight-bold); line-height: var(--hz-leading-tight, 1.2); text-shadow: var(--hz-story-title-shadow); }
.hz-stv-g-me-t span { font-size: var(--hz-text-sm); font-weight: var(--hz-weight-semibold); opacity: .88; }
.hz-stv-g-did {
  width: min(100%, var(--hz-story-measure));
  padding: var(--hz-space-3) var(--hz-space-4);
  border-radius: var(--hz-radius-xl);
  background: var(--hz-story-glass);
  border: var(--hz-story-glass-border);
}
.hz-stv-g-did-h { display: flex; align-items: baseline; justify-content: space-between; gap: var(--hz-space-3); }
.hz-stv-g-did-h span { font-size: var(--hz-text-xs); font-weight: var(--hz-weight-bold); letter-spacing: .06em; text-transform: uppercase; opacity: .8; }
.hz-stv-g-did-h b { font-family: var(--hz-font-display); font-size: var(--hz-story-g-fig); font-weight: var(--hz-weight-bold); line-height: 1; }
.hz-stv-g-did ul { list-style: none; margin: var(--hz-space-2) 0 0; padding: 0; }
.hz-stv-g-deed {
  display: grid; grid-template-columns: var(--hz-story-g-deed-icon) minmax(0, 1fr) auto; align-items: center; gap: var(--hz-space-2);
  min-height: var(--hz-story-g-deed);
  border-top: var(--hz-story-glass-border);
  text-align: start;
}
.hz-stv-g-deed i { font-style: normal; font-size: var(--hz-text-lg); line-height: 1; text-align: center; }
.hz-stv-g-deed span { font-size: var(--hz-text-sm); font-weight: var(--hz-weight-semibold); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hz-stv-g-deed b { font-family: var(--hz-font-display); font-size: var(--hz-text-lg); font-weight: var(--hz-weight-bold); font-variant-numeric: tabular-nums; }
.hz-stv-g-hello { width: var(--hz-story-g-hello); height: auto; pointer-events: none; }
/* The cat says it: the mascot at the start, its line a bubble beside it. */
.hz-stv-g-cat { display: flex; align-items: flex-end; gap: var(--hz-space-2); align-self: stretch; }
.hz-stv-g-cat img { flex: 0 0 auto; width: var(--hz-story-g-cat); height: var(--hz-story-g-cat); pointer-events: none; }
.hz-stv-g-cat .hz-stv-g-says { align-self: auto; max-width: none; flex: 0 1 auto; margin: 0; border-end-end-radius: var(--hz-radius-xl); border-end-start-radius: var(--hz-radius-sm); }

.hz-stv-foot {
  padding: var(--hz-space-3) var(--stv-pad) calc(env(safe-area-inset-bottom, 0px) + var(--hz-space-3));
  display: flex;
  flex-direction: column;
  gap: var(--hz-space-2);
}
.hz-stv-door:empty { display: none; }
/* The door (picks.css .hz-pk-door): the arrow points the way the swipe that opens it goes. */
.hz-stv-cta {
  width: 100%;
  min-height: var(--hz-tap-min);
  border: 0;
  border-radius: var(--hz-radius-pill);
  background: var(--hz-story-cta-bg);
  color: var(--hz-story-cta-fg);
  font: inherit;
  font-size: var(--hz-text-base);
  font-weight: var(--hz-weight-bold);
  padding: 0 var(--hz-space-4);
  cursor: pointer;
  box-shadow: var(--hz-story-cta-shadow);
  touch-action: manipulation;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--hz-space-2);
}
.hz-stv-cta svg { width: 18px; height: 18px; flex: 0 0 auto; }
/* One line, always: a long agent name is cut, never a two-line button. */
.hz-stv-cta span { min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* The reply bar (an agent's story): write to the agent, or the heart. */
.hz-stv-reply { display: flex; align-items: center; gap: var(--hz-space-1); }
.hz-stv-reply[hidden] { display: none; }
.hz-stv-input {
  flex: 1 1 auto;
  min-width: 0;
  height: var(--hz-tap-min);
  padding: 0 var(--hz-space-4);
  border: var(--hz-story-reply-border);
  border-radius: var(--hz-radius-pill);
  background: var(--hz-story-reply-bg);
  color: var(--hz-story-ink);
  font: inherit;
  font-size: max(16px, var(--hz-text-base));   /* 16px: iOS never zooms the page into a focused field */
  outline: none;
}
.hz-stv-input::placeholder { color: var(--hz-story-ink); opacity: .78; }
.hz-stv-input:focus-visible { border-color: var(--hz-story-ink); }
.hz-stv-send {
  width: var(--hz-tap-min);
  height: var(--hz-tap-min);
  flex: 0 0 auto;
  border: 0;
  border-radius: var(--hz-radius-avatar);
  background: var(--hz-story-cta-bg);
  color: var(--hz-story-cta-fg);
  display: grid;
  place-items: center;
  cursor: pointer;
  touch-action: manipulation;
}
.hz-stv-send[hidden], .hz-stv-like[hidden] { display: none; }
.hz-stv-send svg { width: 20px; height: 20px; }
/* With words to send, Send takes the heart's place. */
.hz-stv--draft .hz-stv-like { display: none; }
.hz-stv-like svg { width: 26px; height: 26px; }
.hz-stv-like--on { color: var(--hz-story-like); }
.hz-stv-like--on svg { fill: currentColor; }

/* The heart's burst: hidden until a heart replays it (addon.js burst). */
.hz-stv-burst {
  position: absolute;
  left: 50%;
  top: 42%;
  width: var(--hz-story-burst-size);
  height: var(--hz-story-burst-size);
  margin: calc(var(--hz-story-burst-size) / -2) 0 0 calc(var(--hz-story-burst-size) / -2);
  color: var(--hz-story-like);
  filter: drop-shadow(var(--hz-story-burst-shadow));
  opacity: 0;
  pointer-events: none;
  z-index: var(--hz-z-raised);
}
.hz-stv-burst svg { width: 100%; height: 100%; fill: currentColor; stroke: none; }

/* Typing on a touch screen: the keyboard takes the bottom of the screen — the words and the bar stay,
   the face and the door step aside. A desktop has no keyboard on screen: only Send takes the heart's place. */
@media (pointer: coarse) {
  .hz-stv--typing .hz-stv-hero, .hz-stv--typing .hz-stv-door { display: none; }
  .hz-stv--typing .hz-stv-bg::after { background: var(--hz-story-typing-veil); }
}

/* Holding to read: everything but the story steps aside. */
.hz-stv--held .hz-stv-top, .hz-stv--held .hz-stv-foot { opacity: 0; }
/* The cube: each face turns about an axis behind the screen; the side turned away is never drawn. */
.hz-stv { perspective: var(--hz-story-perspective); }
.hz-stv-card { backface-visibility: hidden; -webkit-backface-visibility: hidden; }
.hz-stv-card--ghost { pointer-events: none; }

.hz-stv-nav { display: none; }
.hz-stv-live { position: absolute; width: var(--hz-space-px); height: var(--hz-space-px); overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; }

/* Wide screens (tablet, desktop): a 9:16 card on a dark scrim, arrows beside it. */
@media (min-width: 720px) and (min-height: 560px) {
  .hz-stv-scrim { background: var(--hz-story-stage-wide); }
  .hz-stv-card {
    width: auto;
    height: min(92vh, var(--hz-story-card-max-h));
    aspect-ratio: 9 / 16;
    border-radius: var(--hz-radius-22);
    box-shadow: var(--hz-story-card-shadow);
  }
  .hz-stv-top { padding-top: var(--hz-space-3); }
  .hz-stv-foot { padding-bottom: var(--hz-space-5); }
  .hz-stv-menu { top: calc(var(--hz-space-16) + var(--hz-space-2)); }
  .hz-stv-nav {
    display: grid;
    place-items: center;
    position: relative;
    width: var(--hz-space-12);
    height: var(--hz-space-12);
    margin: 0 var(--hz-space-4);
    border: 0;
    border-radius: var(--hz-radius-avatar);
    background: var(--hz-viewer-surface-hover);
    color: var(--hz-story-ink);
    cursor: pointer;
  }
  .hz-stv-nav svg { width: var(--hz-space-6); height: var(--hz-space-6); }
  .hz-stv[dir="rtl"] .hz-stv-nav svg { transform: scaleX(-1); }
}

@media (prefers-reduced-motion: no-preference) {
  .hz-stv { transition: opacity var(--hz-dur-fast) var(--hz-ease-out); }
  /* It grows out of the ring that was tapped, and shrinks back into the ring it ends on (addon.js aimAtRing). */
  .hz-stv-card {
    transform-origin: var(--stv-ox, 50%) var(--stv-oy, 50%);
    transform: scale(var(--stv-from, .96));
    transition: transform var(--hz-dur-slow) var(--hz-ease-out);
  }
  .hz-stv--in .hz-stv-card { transform: none; }
  .hz-stv--out { transition-duration: var(--hz-dur); }
  .hz-stv--out .hz-stv-card { transition-duration: var(--hz-dur); }
  .hz-stv-top, .hz-stv-foot { transition: opacity var(--hz-dur-fast) var(--hz-ease); }
  /* While a finger holds the card, it follows the finger — no easing lag. */
  .hz-stv--drag .hz-stv-card { transition: none; }
  .hz-stv-like.hz-stv-pop svg { animation: hz-stv-pop var(--hz-dur-slow) var(--hz-ease-spring); }
  .hz-stv-burst.hz-stv-pop { animation: hz-stv-burst var(--hz-story-burst-dur) var(--hz-ease-out); }
}
@keyframes hz-stv-pop { 0% { transform: scale(1); } 40% { transform: scale(1.3); } 100% { transform: scale(1); } }
/* The heart blooms over the story, settles, and floats away (Instagram's like). */
@keyframes hz-stv-burst {
  0%   { opacity: 0; transform: scale(.3); }
  15%  { opacity: 1; transform: scale(1.15); }
  30%  { transform: scale(.95); }
  45%  { transform: scale(1); }
  75%  { opacity: 1; transform: scale(1); }
  100% { opacity: 0; transform: translateY(-24px) scale(1.05); }
}
