/*
 * HAFR live screens kit: base.css
 *
 * The shared parts of every live screen: the frame (a solid white bezel, no glass of any kind:
 * the founder's "remove the glass", 2026-11-27), the solid app window and its header (the agent
 * character doing the work, the title, a live status line that says plainly what is happening,
 * the "Example data" label), panes and cards (solid, calm, readable), rows, status chips (always
 * a dot and a word), quiet tags, demo buttons, inputs, avatars, a chat thread with message bubbles for both
 * directions (translations, drafts, typing), file and document parts, skeletons, mono log lines,
 * tables, a small chart frame, a progress bar, a segmented control, the amber seal, a bottom
 * sheet for narrow screens, and the dark "instrument" variant (only for one full-bleed dark
 * chapter, never a floating box).
 *
 * Reads /assets/css/tokens.css (the --hf-color-*, --hf-font-*, --hf-ease-*, --hf-dur-* tokens).
 * The kit's own values are declared once under NEW TOKENS, to be promoted into tokens.css; the
 * rules below read only custom properties (0, 50% and 100% are geometry, not values).
 * Class prefix: .hf-screen (block) and its __elements; each screen adds its own block (for
 * example .hf-ac for agent-conversation) in kit/screens/<name>.css.
 *
 * Contract and rules: knowledge/50-design-system/Live Screens Kit.md
 */

/* NEW TOKENS ----------------------------------------------------------------------------
   Declared on .hf-screen as well as :root: a custom property that reads another (for example
   --hf-screen-ink: var(--hf-color-text-1)) is resolved where it is declared, so re-declaring
   it on the screen lets the instrument surface (data-surface on the figure) recolour it. */
:root, .hf-screen {
  /* Frame: Reference Craft Sheet rule 9 (outer 24-32 px with a 4-6 px bezel, inner 8-18 px). */
  --hf-screen-radius: 28px;
  --hf-screen-bezel: 5px;
  --hf-screen-radius-window: calc(var(--hf-screen-radius) - var(--hf-screen-bezel));
  --hf-screen-radius-card: 14px;
  --hf-screen-radius-field: 10px;
  --hf-screen-radius-small: 8px;
  --hf-screen-radius-tiny: 4px;
  --hf-screen-radius-full: 999px;
  --hf-screen-line: 1px;
  --hf-screen-line-dash: 1.25px;

  /* Message first, technology you can trust, no glass (the founder's rules 8 to 11,
     2026-11-27: "remove the glass"). The frame is a plain white bezel, like microdose's product
     frame (radius 32, white, padding 4): opaque, no backdrop blur, no frosting. The window,
     panes, cards and sheets inside it are solid too. Hairlines and soft long tinted shadows do
     the separating. Never add a backdrop-filter anywhere in a screen. */
  --hf-screen-frame-fill: #FFFFFF;
  --hf-screen-frame-ring: rgb(11 13 16 / 0.06);
  --hf-screen-window: #FDFDFC;
  --hf-screen-pane: #F6F7F4;
  --hf-screen-raise: #FFFFFF;
  --hf-screen-sunk: rgb(11 13 16 / 0.035);
  --hf-screen-hairline: rgb(11 13 16 / 0.075);
  --hf-screen-hairline-2: rgb(11 13 16 / 0.13);
  --hf-screen-highlight: rgb(255 255 255 / 0.9);
  --hf-screen-shadow: 0 1px 2px rgb(11 13 16 / 0.06), 0 34px 80px -30px rgb(30 42 54 / 0.3);
  --hf-screen-shadow-card: 0 1px 2px rgb(11 13 16 / 0.05), 0 10px 24px -16px rgb(30 42 54 / 0.26);
  --hf-screen-shadow-pop: 0 1px 2px rgb(11 13 16 / 0.06), 0 22px 44px -20px rgb(30 42 54 / 0.38);
  --hf-screen-shadow-sheet: 0 -1px 0 rgb(11 13 16 / 0.05), 0 -18px 40px -22px rgb(30 42 54 / 0.34);
  --hf-screen-shadow-ink: 0 1px 2px rgb(11 13 16 / 0.2), 0 8px 18px -10px rgb(11 13 16 / 0.55), inset 0 1px 0 rgb(255 255 255 / 0.14);
  /* A dot grid only behind a diagram canvas (a map, a flow), never behind text or a thread. */
  --hf-screen-dots: radial-gradient(rgb(11 13 16 / 0.085) 0.75px, transparent 1.15px);
  --hf-screen-dots-size: 14px;
  --hf-screen-fade: 40px;

  /* Type: Geist and Geist Mono; Alexandria carries Arabic through the same stacks. 12 px floor. */
  --hf-screen-font: var(--hf-font-sans);
  --hf-screen-font-mono: var(--hf-font-mono);
  --hf-screen-fs-micro: 12px;
  --hf-screen-fs-meta: 12.5px;
  --hf-screen-fs-ui: 13.5px;
  --hf-screen-fs-body: 14px;
  --hf-screen-fs-title: 15px;
  --hf-screen-fs-head: 17px;
  --hf-screen-fs-figure: 22px;
  --hf-screen-fs-mono: 12.5px;
  --hf-screen-lh: 1.45;
  --hf-screen-lh-tight: 1.2;
  --hf-screen-lh-msg: 1.52;
  --hf-screen-lh-ar: 1.75;
  --hf-screen-lh-ar-ui: 1.5;
  --hf-screen-ar-scale: 1.07;
  --hf-screen-wt-body: 400;
  --hf-screen-wt-ui: 500;
  --hf-screen-wt-title: 560;
  --hf-screen-wt-ar-tag: 600;
  --hf-screen-tr: -0.006em;
  --hf-screen-tr-title: -0.012em;
  --hf-screen-tr-figure: -0.02em;

  /* Sizes and rhythm (8 px grid, 4 px steps inside controls). */
  --hf-screen-head-h: 56px;
  --hf-screen-pane-head-h: 52px;
  --hf-screen-ctl: 32px;
  --hf-screen-tile: 32px;
  --hf-screen-avatar: 32px;
  --hf-screen-avatar-sm: 24px;
  --hf-screen-chip-h: 24px;
  --hf-screen-chip-gap: 6px;
  --hf-screen-chip-pad-s: 8px;
  --hf-screen-chip-pad-e: 10px;
  --hf-screen-btn-h: 34px;
  --hf-screen-btn-pad: 14px;
  --hf-screen-input-h: 40px;
  --hf-screen-row-h: 34px;
  --hf-screen-log-h: 32px;
  --hf-screen-th-h: 32px;
  --hf-screen-glyph: 16px;
  --hf-screen-glyph-sm: 14px;
  --hf-screen-dot: 6px;
  --hf-screen-mark: 6px;
  --hf-screen-seal: 10px;
  --hf-screen-seal-radius: 1.5px;
  --hf-screen-pad: 16px;
  --hf-screen-pad-sm: 12px;
  --hf-screen-gap: 12px;
  --hf-screen-gap-sm: 8px;
  --hf-screen-gap-xs: 4px;
  --hf-screen-gap-2xs: 2px;
  --hf-screen-stroke: 1.5;
  --hf-screen-progress-h: 4px;
  --hf-screen-seg-pad: 3px;
  --hf-screen-seg-h: 26px;
  --hf-screen-seg-pad-s: 10px;
  --hf-screen-seg-pad-e: 12px;
  --hf-screen-file-h: 48px;
  --hf-screen-file-tile: 32px;
  --hf-screen-doc-w: 26px;
  --hf-screen-doc-h: 32px;
  --hf-screen-doc-line: 2px;
  --hf-screen-doc-inset: 5px;
  --hf-screen-doc-top: 7px;
  --hf-screen-doc-pitch: 5px;
  --hf-screen-scan-h: 40%;
  --hf-screen-scan-o: 0.85;
  --hf-screen-typing-h: 1.5em;
  --hf-screen-typing-o: 0.35;
  --hf-screen-typing-o-lo: 0.3;
  --hf-screen-typing-o-hi: 0.85;
  --hf-screen-skel-h: 8px;
  --hf-screen-skel-w: 64%;
  --hf-screen-sheet-radius: 20px;
  --hf-screen-sheet-handle-w: 36px;
  --hf-screen-sheet-handle-h: 4px;

  /* The agent at work: the character slot that opens every header, and the live status line
     under the title (a dot and a few plain words: "Reading the claim form"). */
  --hf-screen-agent: 40px;
  --hf-screen-agent-sm: 32px;
  --hf-screen-agent-radius: 12px;
  --hf-screen-agent-fill: linear-gradient(180deg, #F8F7F3 0%, #EDEFEB 100%);
  --hf-screen-agent-ink: var(--hf-color-text-1);
  --hf-screen-agent-glyph: 22px;
  --hf-screen-agent-core-lo: 0.35;
  --hf-screen-agent-breathe: 1.4s;
  --hf-screen-now-dot: 6px;
  --hf-screen-now-rise: 4px;
  --hf-screen-now-in: 320ms;

  /* Ink and status. Status is always a dot and a word, never colour alone. */
  --hf-screen-ink: var(--hf-color-text-1);
  --hf-screen-ink-2: var(--hf-color-text-2);
  --hf-screen-ink-3: var(--hf-color-text-3);
  --hf-screen-tile-fill: var(--hf-color-inverse);
  --hf-screen-tile-ink: var(--hf-color-on-inverse);
  --hf-screen-avatar-fill: linear-gradient(180deg, #F3F1EA 0%, #E8EAE6 100%);
  --hf-screen-avatar-ink: var(--hf-color-text-2);
  --hf-screen-ok: var(--hf-color-success);
  --hf-screen-ok-tint: var(--hf-color-success-tint);
  --hf-screen-ok-line: var(--hf-color-success-line);
  --hf-screen-region: var(--hf-color-sea-600);
  --hf-screen-region-tint: rgb(0 135 155 / 0.08);
  --hf-screen-region-line: rgb(0 103 118 / 0.24);
  --hf-screen-info: var(--hf-color-info);
  --hf-screen-info-tint: var(--hf-color-info-tint);
  --hf-screen-info-line: var(--hf-color-info-line);
  --hf-screen-danger: var(--hf-color-danger);
  --hf-screen-danger-tint: var(--hf-color-danger-tint);
  --hf-screen-danger-line: var(--hf-color-danger-line);
  --hf-screen-neutral: var(--hf-color-text-2);
  --hf-screen-neutral-tint: rgb(11 13 16 / 0.045);
  --hf-screen-neutral-line: rgb(11 13 16 / 0.11);
  --hf-screen-skel: rgb(11 13 16 / 0.07);
  --hf-screen-skel-hi: rgb(255 255 255 / 0.75);
  --hf-screen-flash: rgb(0 135 155 / 0.09);
  /* The amber seal: the single accent of a screen. Never text, never a fill larger than 12 px. */
  --hf-screen-seal-fill: var(--hf-color-seal);
  --hf-screen-seal-edge: var(--hf-color-seal-edge);

  /* Message bubbles: the customer in white, the agent in a sea tint, a draft dashed. */
  --hf-screen-msg-in: #FFFFFF;
  --hf-screen-msg-in-ring: rgb(11 13 16 / 0.085);
  --hf-screen-msg-out: linear-gradient(180deg, #EAF5F3 0%, #E1F0EE 100%);
  --hf-screen-msg-out-ring: rgb(0 103 118 / 0.14);
  --hf-screen-msg-draft: rgb(255 255 255 / 0.62);
  --hf-screen-msg-draft-ring: rgb(0 103 118 / 0.5);
  --hf-screen-msg-tr-line: rgb(11 13 16 / 0.08);
  --hf-screen-msg-radius: 18px;
  --hf-screen-msg-tail: 6px;
  --hf-screen-msg-max: 78%;
  --hf-screen-msg-pad-b: 9px;
  --hf-screen-msg-pad-i: 14px;
  --hf-screen-msg-gap: 10px;
  --hf-screen-msg-dash: 5px;

  /* Charts: one series in sea, a muted comparison, hairline axes. */
  --hf-screen-viz-1: var(--hf-color-sea-500);
  --hf-screen-viz-1-fill: rgb(0 135 155 / 0.14);
  --hf-screen-viz-2: var(--hf-color-viz-muted);
  --hf-screen-viz-axis: rgb(11 13 16 / 0.1);
  --hf-screen-viz-stroke: 1.75;
  --hf-screen-viz-stroke-2: 1.25;
  --hf-screen-viz-dash: 3 4;

  /* Motion: rows arrive, chips stamp, the loop clears; all of it rests under reduced motion. */
  --hf-screen-enter: 520ms;
  --hf-screen-grow: 460ms;
  --hf-screen-stamp: 300ms;
  --hf-screen-clear: 480ms;
  --hf-screen-sheet: 560ms;
  --hf-screen-pulse: 1.6s;
  --hf-screen-caret: 1.05s;
  --hf-screen-typing: 1.2s;
  --hf-screen-typing-step: 160ms;
  --hf-screen-shimmer: 1.8s;
  --hf-screen-scan: 1.4s;
  --hf-screen-flash-dur: 1100ms;
  --hf-screen-ease: var(--hf-ease-out);
  --hf-screen-ease-io: var(--hf-ease-in-out);
  --hf-screen-rise: 8px;
  --hf-screen-stamp-from: 0.9;
  --hf-screen-pulse-ring: 3px;
  --hf-screen-typing-lift: -2px;
  --hf-screen-caret-w: 2px;
  --hf-screen-caret-h: 1.05em;
  --hf-screen-caret-o: 0.55;
}

/* Fonts: the site's self-hosted faces (identical to the site's base.css, so a page that already
   declares them pays nothing twice). Each face claims only its own script, so an English screen
   downloads Alexandria only when it actually shows Arabic. */
@font-face {
  font-family: "HF Geist";
  src: url("/assets/fonts/geist@5.3.0/geist-latin-wght-normal.woff2") format("woff2");
  font-weight: 100 900; font-style: normal; font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "HF Geist Mono";
  src: url("/assets/fonts/geist-mono@5.3.0/geist-mono-latin-wght-normal.woff2") format("woff2");
  font-weight: 100 900; font-style: normal; font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "HF Alexandria";
  src: url("/assets/fonts/alexandria@5.3.0/alexandria-arabic-wght-normal.woff2") format("woff2");
  font-weight: 100 900; font-style: normal; font-display: swap;
  size-adjust: 94.5%;
  unicode-range: U+0600-06FF, U+0750-077F, U+0870-08FF, U+200C-200F, U+FB50-FDFF, U+FE70-FEFC;
}

/* The screen ------------------------------------------------------------------------------ */
.hf-screen {
  position: relative;
  container: hf-screen / inline-size;
  margin: 0;
  inline-size: 100%;
  font-family: var(--hf-screen-font);
  font-size: var(--hf-screen-fs-body);
  font-weight: var(--hf-screen-wt-body);
  line-height: var(--hf-screen-lh);
  letter-spacing: var(--hf-screen-tr);
  color: var(--hf-screen-ink);
  text-align: start;
  font-synthesis: none;
  font-kerning: normal;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
.hf-screen *, .hf-screen *::before, .hf-screen *::after { box-sizing: border-box; }
.hf-screen:lang(ar), .hf-screen :lang(ar) { letter-spacing: 0; }
.hf-screen bdi { unicode-bidi: isolate; }
.hf-screen p { margin: 0; }
.hf-screen [hidden] { display: none !important; }

.hf-screen__summary {
  position: absolute !important;
  inline-size: 1px; block-size: 1px;
  margin: -1px; padding: 0; border: 0;
  overflow: hidden; clip-path: inset(50%); white-space: nowrap;
}

/* The frame: a solid white bezel around a solid app window. No glass anywhere: never a
   backdrop-filter, never a frosted or see-through layer, never a screen on a glass panel. */
.hf-screen__frame {
  position: relative;
  padding: var(--hf-screen-bezel);
  border-radius: var(--hf-screen-radius);
  background: var(--hf-screen-frame-fill);
  box-shadow: var(--hf-screen-shadow), 0 0 0 var(--hf-screen-line) var(--hf-screen-frame-ring);
}
.hf-screen__window {
  position: relative;
  overflow: hidden;
  isolation: isolate;
  border-radius: var(--hf-screen-radius-window);
  background: var(--hf-screen-window);
  box-shadow: inset 0 0 0 var(--hf-screen-line) var(--hf-screen-hairline);
}

/* Header: app tile, title and crumb at the start; labels, status and the control at the end. */
.hf-screen__head {
  display: flex; align-items: center; gap: var(--hf-screen-gap);
  min-block-size: var(--hf-screen-head-h);
  padding-block: var(--hf-screen-gap-sm);
  padding-inline: var(--hf-screen-pad) calc(var(--hf-screen-pad) + var(--hf-screen-ctl) + var(--hf-screen-gap-sm));
  border-block-end: var(--hf-screen-line) solid var(--hf-screen-hairline);
  background: linear-gradient(180deg, var(--hf-screen-highlight), transparent);
}
.hf-screen__tile {
  flex: none;
  display: grid; place-items: center;
  inline-size: var(--hf-screen-tile); block-size: var(--hf-screen-tile);
  border-radius: var(--hf-screen-radius-small);
  background: var(--hf-screen-tile-fill); color: var(--hf-screen-tile-ink);
  box-shadow: var(--hf-screen-shadow-card);
}
.hf-screen__tile .hf-glyph { inline-size: var(--hf-screen-glyph); block-size: var(--hf-screen-glyph); }
.hf-screen__titles { display: flex; flex-direction: column; min-inline-size: 0; gap: var(--hf-screen-gap-2xs); }
.hf-screen__title {
  overflow: hidden; white-space: nowrap; text-overflow: ellipsis;
  font-size: var(--hf-screen-fs-ui); font-weight: var(--hf-screen-wt-title);
  letter-spacing: var(--hf-screen-tr-title); line-height: var(--hf-screen-lh-tight);
}
.hf-screen:lang(ar) .hf-screen__title { font-size: var(--hf-screen-fs-body); line-height: var(--hf-screen-lh-ar-ui); }
.hf-screen__crumb {
  display: flex; align-items: center; gap: var(--hf-screen-gap-xs);
  overflow: hidden; white-space: nowrap;
  font-family: var(--hf-screen-font-mono); font-size: var(--hf-screen-fs-micro);
  line-height: var(--hf-screen-lh-tight);
  letter-spacing: 0; color: var(--hf-screen-ink-3);
}
.hf-screen__head-end { display: flex; align-items: center; gap: var(--hf-screen-gap-sm); margin-inline-start: auto; flex: none; }

/* The agent at work ---------------------------------------------------------------------------
   The slot that opens every header (ctx.agent(id) in the runtime) holds the agent character
   doing the work, mounted by the runtime from explorations/characters/characters.js; if that
   module is missing, a neutral placeholder (the agent mark on a pearl plate) stands in.
   data-agent-state (idle | thinking | working | success | blocked | handover) follows the
   score; the status line beside it says the same in words. */
.hf-screen__agent {
  position: relative; flex: none;
  display: grid; place-items: center;
  inline-size: var(--hf-screen-agent); block-size: var(--hf-screen-agent);
  border-radius: var(--hf-screen-agent-radius);
  background: var(--hf-screen-agent-fill);
  color: var(--hf-screen-agent-ink);
  box-shadow: inset 0 0 0 var(--hf-screen-line) var(--hf-screen-hairline);
}
.hf-screen__agent-ph { display: grid; place-items: center; }
.hf-screen__agent-ph .hf-glyph { inline-size: var(--hf-screen-agent-glyph); block-size: var(--hf-screen-agent-glyph); }
/* While the agent works, the core of the placeholder's mark breathes; other states hold still. */
.hf-screen__agent[data-agent-state="working"] .hf-screen__agent-ph .hf-glyph rect + rect {
  animation: hf-screen-breathe var(--hf-screen-agent-breathe) var(--hf-screen-ease-io) infinite;
  animation-play-state: var(--hf-screen-play);
}
/* A mounted character draws its own figure: the plate steps back. */
.hf-screen__agent:has(> .hf-screen__agent-host) { background: none; box-shadow: none; }
.hf-screen__agent-host { position: absolute; inset: 0; display: grid; place-items: center; }
.hf-screen__agent-host > * { max-inline-size: 100%; max-block-size: 100%; }
/* Inside a screen the status line carries the dot and the word, so the character's own status
   badge steps aside (one dot per state, never two side by side). */
.hf-screen__agent-host .hf-agent__badge { display: none; }

/* The live status line: a dot and a few plain words that say what is happening now. Set
   data-tone on it (idle | working | waiting | done | alert): grey, blue pulsing (in progress,
   like the kit's "extracting" chip and the characters' working badge), blue pulsing, green,
   red. A new text rises in when the score flips data-say between "a" and "b". */
.hf-screen__now {
  --hf-now-tone: var(--hf-screen-ink-3);
  display: flex; align-items: center; gap: var(--hf-screen-chip-gap);
  min-inline-size: 0;
  font-size: var(--hf-screen-fs-meta); font-weight: var(--hf-screen-wt-ui);
  line-height: var(--hf-screen-lh-tight); letter-spacing: 0;
  color: var(--hf-screen-ink-2);
}
.hf-screen__now::before {
  content: ""; flex: none;
  inline-size: var(--hf-screen-now-dot); block-size: var(--hf-screen-now-dot);
  border-radius: 50%; background: currentColor; color: var(--hf-now-tone);
}
.hf-screen__now[data-tone="working"] { --hf-now-tone: var(--hf-screen-info); }
.hf-screen__now[data-tone="waiting"] { --hf-now-tone: var(--hf-screen-info); }
.hf-screen__now[data-tone="done"] { --hf-now-tone: var(--hf-screen-ok); }
.hf-screen__now[data-tone="alert"] { --hf-now-tone: var(--hf-screen-danger); }
.hf-screen__now:is([data-tone="working"], [data-tone="waiting"])::before {
  animation: hf-screen-pulse var(--hf-screen-pulse) var(--hf-screen-ease-io) infinite;
  animation-play-state: var(--hf-screen-play);
}
.hf-screen__now-text { min-inline-size: 0; }
.hf-screen__now-text[data-say="a"] { animation: hf-screen-say-a var(--hf-screen-now-in) var(--hf-screen-ease) both; }
.hf-screen__now-text[data-say="b"] { animation: hf-screen-say-b var(--hf-screen-now-in) var(--hf-screen-ease) both; }
.hf-screen:lang(ar) .hf-screen__now { font-size: var(--hf-screen-fs-ui); font-weight: var(--hf-screen-wt-ui); line-height: var(--hf-screen-lh-ar-ui); }

/* "Example data": on every screen, readable, never hidden by motion. */
.hf-screen__example {
  display: inline-flex; align-items: center; gap: var(--hf-screen-gap-xs);
  block-size: var(--hf-screen-chip-h);
  padding-inline: var(--hf-screen-chip-pad-s) var(--hf-screen-chip-pad-e);
  border-radius: var(--hf-screen-radius-full);
  background: var(--hf-screen-raise);
  box-shadow: inset 0 0 0 var(--hf-screen-line) var(--hf-screen-hairline-2);
  font-size: var(--hf-screen-fs-micro); font-weight: var(--hf-screen-wt-ui); letter-spacing: 0;
  line-height: var(--hf-screen-lh-tight);
  color: var(--hf-screen-ink-2); white-space: nowrap;
}
.hf-screen__example::before {
  content: ""; flex: none;
  inline-size: var(--hf-screen-mark); block-size: var(--hf-screen-mark);
  border-radius: var(--hf-screen-line); background: var(--hf-screen-ink-3);
}
.hf-screen:lang(ar) .hf-screen__example { font-size: var(--hf-screen-fs-meta); font-weight: var(--hf-screen-wt-ar-tag); }
/* Phones: the words alone, so the title beside them keeps its room. */
@container hf-screen (max-width: 479px) {
  .hf-screen__example { padding-inline: var(--hf-screen-chip-pad-e); }
  .hf-screen__example::before { display: none; }
}

/* Glyphs: the interim line set (kit/lib/glyphs.js), swapped later for the HAFR icon family. */
.hf-screen .hf-glyph {
  inline-size: var(--hf-screen-glyph); block-size: var(--hf-screen-glyph); flex: none;
  fill: none; stroke: currentColor; stroke-width: var(--hf-screen-stroke);
  stroke-linecap: round; stroke-linejoin: round; overflow: visible;
}
.hf-screen[dir="rtl"] .hf-glyph--dir { transform: scaleX(-1); }

/* The Pause / Play control (WCAG 2.2.2): the only focusable thing in a screen. */
.hf-screen__ctl {
  position: absolute; z-index: 3;
  inset-block-start: calc(var(--hf-screen-bezel) + (var(--hf-screen-head-h) - var(--hf-screen-ctl)) / 2);
  inset-inline-end: calc(var(--hf-screen-bezel) + var(--hf-screen-pad-sm));
  display: grid; place-items: center;
  inline-size: var(--hf-screen-ctl); block-size: var(--hf-screen-ctl);
  padding: 0; border: 0; border-radius: var(--hf-screen-radius-full);
  background: var(--hf-screen-raise); color: var(--hf-screen-ink);
  box-shadow: inset 0 0 0 var(--hf-screen-line) var(--hf-screen-hairline-2), var(--hf-screen-shadow-card);
  cursor: pointer;
  transition: background-color var(--hf-dur-2) var(--hf-ease-out), box-shadow var(--hf-dur-2) var(--hf-ease-out);
}
.hf-screen__ctl::before { content: ""; position: absolute; inset: calc((var(--hf-target) - var(--hf-screen-ctl)) / -2); }
.hf-screen__ctl .hf-glyph { inline-size: var(--hf-screen-glyph-sm); block-size: var(--hf-screen-glyph-sm); fill: none; }
.hf-screen__ctl .hf-screen__ctl-play { display: none; fill: currentColor; }
.hf-screen__ctl[data-paused] .hf-screen__ctl-pause { display: none; }
.hf-screen__ctl[data-paused] .hf-screen__ctl-play { display: block; }
.hf-screen[data-reduced] .hf-screen__ctl { display: none; }
.hf-screen__ctl:focus-visible { outline: var(--hf-focus-width) solid var(--hf-color-focus); outline-offset: var(--hf-focus-offset); }
@media (hover: hover) and (pointer: fine) {
  .hf-screen__ctl:hover { background: var(--hf-color-surface); box-shadow: inset 0 0 0 var(--hf-screen-line) var(--hf-screen-hairline-2), var(--hf-screen-shadow-pop); }
}

/* Panes and cards ------------------------------------------------------------------------ */
.hf-screen__pane { position: relative; min-inline-size: 0; background: var(--hf-screen-pane); }
.hf-screen__pane-head {
  display: flex; align-items: center; gap: var(--hf-screen-gap-sm);
  min-block-size: var(--hf-screen-pane-head-h);
  padding-inline: var(--hf-screen-pad);
  border-block-end: var(--hf-screen-line) solid var(--hf-screen-hairline);
  font-size: var(--hf-screen-fs-meta); font-weight: var(--hf-screen-wt-ui); color: var(--hf-screen-ink-2);
}
.hf-screen__label {
  display: flex; align-items: center; gap: var(--hf-screen-gap-sm);
  margin: 0;
  font-size: var(--hf-screen-fs-micro); font-weight: var(--hf-screen-wt-ui); line-height: var(--hf-screen-lh-tight);
  letter-spacing: 0; color: var(--hf-screen-ink-3);
}
.hf-screen:lang(ar) .hf-screen__label { font-size: var(--hf-screen-fs-meta); font-weight: var(--hf-screen-wt-ar-tag); line-height: var(--hf-screen-lh-ar-ui); }
.hf-screen__card {
  position: relative;
  border-radius: var(--hf-screen-radius-card);
  background: var(--hf-screen-raise);
  box-shadow: inset 0 0 0 var(--hf-screen-line) var(--hf-screen-hairline), var(--hf-screen-shadow-card);
}
.hf-screen__count { font-family: var(--hf-screen-font-mono); font-variant-numeric: tabular-nums; letter-spacing: 0; }
.hf-screen__mono { font-family: var(--hf-screen-font-mono); font-size: var(--hf-screen-fs-mono); letter-spacing: 0; font-variant-numeric: tabular-nums; }

/* Avatars: a person in pearl, the agent in an ink tile. */
.hf-screen__avatar {
  flex: none; display: grid; place-items: center;
  inline-size: var(--hf-screen-avatar); block-size: var(--hf-screen-avatar);
  border-radius: var(--hf-screen-radius-full);
  background: var(--hf-screen-avatar-fill); color: var(--hf-screen-avatar-ink);
  box-shadow: inset 0 0 0 var(--hf-screen-line) var(--hf-screen-hairline);
}
.hf-screen__avatar--agent { border-radius: var(--hf-screen-radius-small); background: var(--hf-screen-tile-fill); color: var(--hf-screen-tile-ink); box-shadow: var(--hf-screen-shadow-card); }
.hf-screen__avatar--sm { inline-size: var(--hf-screen-avatar-sm); block-size: var(--hf-screen-avatar-sm); }
.hf-screen__avatar--sm .hf-glyph { inline-size: var(--hf-screen-glyph-sm); block-size: var(--hf-screen-glyph-sm); }

/* Rows: label and value, hairline between, tabular figures. */
.hf-screen__rows { margin: 0; padding: 0; list-style: none; }
.hf-screen__row {
  position: relative;
  display: grid; grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.25fr) auto;
  align-items: center; column-gap: var(--hf-screen-gap);
  min-block-size: var(--hf-screen-row-h);
  font-variant-numeric: tabular-nums;
}
.hf-screen__row + .hf-screen__row { border-block-start: var(--hf-screen-line) solid var(--hf-screen-hairline); }
.hf-screen__row-k { min-inline-size: 0; font-size: var(--hf-screen-fs-meta); color: var(--hf-screen-ink-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hf-screen__row-v { min-inline-size: 0; font-size: var(--hf-screen-fs-ui); font-weight: var(--hf-screen-wt-ui); color: var(--hf-screen-ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hf-screen:lang(ar) .hf-screen__row-k { font-size: var(--hf-screen-fs-ui); }
/* A row being filled: a short sea flash under it (one-shot, lands as nothing). */
.hf-screen__row[data-flash]::after {
  content: ""; position: absolute; inset: var(--hf-screen-line) calc(var(--hf-screen-gap-sm) * -1);
  border-radius: var(--hf-screen-radius-small); background: var(--hf-screen-flash);
  pointer-events: none; opacity: 0;
  animation: hf-screen-flash var(--hf-screen-flash-dur) var(--hf-screen-ease-io) both;
}
/* A second flash on the same row needs a new animation name to restart: data-flash="again". */
.hf-screen__row[data-flash="again"]::after { animation-name: hf-screen-flash-again; }

/* Status chips: a dot and a word ----------------------------------------------------------- */
.hf-screen__chip {
  --hf-chip-ink: var(--hf-screen-neutral);
  --hf-chip-tint: var(--hf-screen-neutral-tint);
  --hf-chip-line: var(--hf-screen-neutral-line);
  display: inline-flex; align-items: center; gap: var(--hf-screen-chip-gap);
  block-size: var(--hf-screen-chip-h);
  padding-inline: var(--hf-screen-chip-pad-s) var(--hf-screen-chip-pad-e);
  border-radius: var(--hf-screen-radius-full);
  background: var(--hf-chip-tint);
  box-shadow: inset 0 0 0 var(--hf-screen-line) var(--hf-chip-line);
  color: var(--hf-chip-ink);
  font-size: var(--hf-screen-fs-micro); font-weight: var(--hf-screen-wt-ui); letter-spacing: 0;
  line-height: 1; white-space: nowrap;
}
.hf-screen__chip::before {
  content: ""; flex: none;
  inline-size: 0; block-size: 0;
  border: calc(var(--hf-screen-dot) / 2) solid currentColor; border-radius: 50%;
}
.hf-screen:lang(ar) .hf-screen__chip { font-size: var(--hf-screen-fs-meta); font-weight: var(--hf-screen-wt-ar-tag); }
.hf-screen__chip--ok { --hf-chip-ink: var(--hf-screen-ok); --hf-chip-tint: var(--hf-screen-ok-tint); --hf-chip-line: var(--hf-screen-ok-line); }
.hf-screen__chip--region { --hf-chip-ink: var(--hf-screen-region); --hf-chip-tint: var(--hf-screen-region-tint); --hf-chip-line: var(--hf-screen-region-line); }
.hf-screen__chip--info { --hf-chip-ink: var(--hf-screen-info); --hf-chip-tint: var(--hf-screen-info-tint); --hf-chip-line: var(--hf-screen-info-line); }
.hf-screen__chip--danger { --hf-chip-ink: var(--hf-screen-danger); --hf-chip-tint: var(--hf-screen-danger-tint); --hf-chip-line: var(--hf-screen-danger-line); }
/* Denied differs from blocked by more than colour: outline only. */
.hf-screen__chip--denied { --hf-chip-ink: var(--hf-screen-danger); --hf-chip-tint: transparent; --hf-chip-line: var(--hf-screen-danger); }
.hf-screen__chip--wait { --hf-chip-ink: var(--hf-screen-info); --hf-chip-tint: var(--hf-screen-info-tint); --hf-chip-line: var(--hf-screen-info-line); }
.hf-screen__chip--wait::before { animation: hf-screen-pulse var(--hf-screen-pulse) var(--hf-screen-ease-io) infinite; animation-play-state: var(--hf-screen-play); }
/* The seal: the one square status, the screen's single amber accent. */
.hf-screen__chip--seal::before { border-color: var(--hf-screen-seal-fill); border-radius: var(--hf-screen-line); }
.hf-screen__chip--bare { block-size: auto; padding: 0; background: none; box-shadow: none; }
/* A chip arriving: a short stamp, no overshoot (the overshoot belongs to the seal). */
.hf-screen__chip[data-stamp] { animation: hf-screen-stamp var(--hf-screen-stamp) var(--hf-screen-ease) both; }

/* Quiet tags: a glyph and a word for facts that are not a status (languages, file types). */
.hf-screen__tag {
  display: inline-flex; align-items: center; gap: var(--hf-screen-chip-gap);
  block-size: var(--hf-screen-chip-h);
  padding-inline: var(--hf-screen-chip-pad-s) var(--hf-screen-chip-pad-e);
  border-radius: var(--hf-screen-radius-full);
  box-shadow: inset 0 0 0 var(--hf-screen-line) var(--hf-screen-hairline-2);
  font-size: var(--hf-screen-fs-micro); font-weight: var(--hf-screen-wt-ui); letter-spacing: 0;
  line-height: 1; white-space: nowrap; color: var(--hf-screen-ink-2);
}
.hf-screen__tag .hf-glyph { inline-size: var(--hf-screen-glyph-sm); block-size: var(--hf-screen-glyph-sm); }
.hf-screen:lang(ar) .hf-screen__tag { font-size: var(--hf-screen-fs-meta); }

/* Demo buttons: they look pressable but are not controls (the live UI is aria-hidden). */
.hf-screen__btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--hf-screen-chip-gap);
  block-size: var(--hf-screen-btn-h);
  padding-inline: var(--hf-screen-btn-pad);
  border-radius: var(--hf-screen-radius-full);
  font-size: var(--hf-screen-fs-ui); font-weight: var(--hf-screen-wt-ui); letter-spacing: var(--hf-screen-tr);
  white-space: nowrap; user-select: none;
  transition: transform var(--hf-dur-2) var(--hf-ease-out), box-shadow var(--hf-dur-3) var(--hf-ease-out), background-color var(--hf-dur-3) var(--hf-ease-out);
}
.hf-screen__btn .hf-glyph { inline-size: var(--hf-screen-glyph-sm); block-size: var(--hf-screen-glyph-sm); }
.hf-screen__btn--ink { background: var(--hf-screen-tile-fill); color: var(--hf-screen-tile-ink); box-shadow: var(--hf-screen-shadow-ink); }
.hf-screen__btn--ghost { background: var(--hf-screen-raise); color: var(--hf-screen-ink); box-shadow: inset 0 0 0 var(--hf-screen-line) var(--hf-screen-hairline-2); }
.hf-screen__btn[data-pressed] { transform: scale(var(--hf-scale-press)); box-shadow: 0 0 0 var(--hf-screen-gap-xs) var(--hf-screen-neutral-tint), inset 0 0 0 var(--hf-screen-line) var(--hf-screen-hairline-2); }
.hf-screen:lang(ar) .hf-screen__btn { font-size: var(--hf-screen-fs-body); }

/* Inputs: a field with a caret (typing is shown, never real input). */
.hf-screen__input {
  display: flex; align-items: center; gap: var(--hf-screen-gap-sm);
  min-block-size: var(--hf-screen-input-h);
  padding-inline: var(--hf-screen-pad-sm);
  border-radius: var(--hf-screen-radius-field);
  background: var(--hf-screen-raise);
  box-shadow: inset 0 0 0 var(--hf-screen-line) var(--hf-screen-hairline-2), inset 0 var(--hf-screen-line) var(--hf-screen-gap-2xs) var(--hf-screen-sunk);
  font-size: var(--hf-screen-fs-ui); color: var(--hf-screen-ink);
}
.hf-screen__input[data-empty]::before { content: attr(data-placeholder); color: var(--hf-screen-ink-3); }
.hf-screen [data-streaming]::after,
.hf-screen__caret::after {
  content: ""; display: inline-block; vertical-align: -0.15em;
  inline-size: var(--hf-screen-caret-w); block-size: var(--hf-screen-caret-h); margin-inline-start: var(--hf-screen-gap-2xs);
  border-radius: var(--hf-screen-line); background: currentColor; opacity: var(--hf-screen-caret-o);
  animation: hf-screen-caret var(--hf-screen-caret) steps(1, end) infinite;
  animation-play-state: var(--hf-screen-play);
}

/* Skeletons: the shape of a value before the agent fills it. */
.hf-screen__skel {
  display: block; position: relative; overflow: hidden;
  inline-size: var(--hf-skel-w, var(--hf-screen-skel-w)); block-size: var(--hf-screen-skel-h);
  border-radius: var(--hf-screen-radius-full);
  background: var(--hf-screen-skel);
}
.hf-screen__skel::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(90deg, transparent 0%, var(--hf-screen-skel-hi) 50%, transparent 100%);
  transform: translateX(-100%);
  animation: hf-screen-shimmer var(--hf-screen-shimmer) var(--hf-screen-ease-io) infinite;
  animation-play-state: var(--hf-screen-play);
}
.hf-screen[dir="rtl"] .hf-screen__skel::after { animation-direction: reverse; }

/* Chat thread ------------------------------------------------------------------------------
   A column anchored to its end: new items grow in at the bottom and push the older ones up and
   out under a soft fade, as a real conversation does. */
.hf-screen__thread {
  display: flex; flex-direction: column; justify-content: flex-end;
  gap: var(--hf-screen-msg-gap);
  overflow: hidden;
  -webkit-mask-image: linear-gradient(180deg, transparent 0, #000 var(--hf-screen-fade));
  mask-image: linear-gradient(180deg, transparent 0, #000 var(--hf-screen-fade));
}
/* Growing items: the wrapper opens its height, the content rises in. Set data-in to show. */
.hf-screen [data-grow] {
  display: grid; grid-template-rows: 0fr;
  transition: grid-template-rows var(--hf-screen-grow) var(--hf-screen-ease);
}
.hf-screen [data-grow][data-in] { grid-template-rows: 1fr; }
.hf-screen [data-grow] > * { min-block-size: 0; overflow: hidden; }
.hf-screen__thread > [data-grow] { margin-block-start: calc(var(--hf-screen-msg-gap) * -1); }
.hf-screen__thread > [data-grow][data-in] { margin-block-start: 0; }
.hf-screen__thread > [data-grow] { transition: grid-template-rows var(--hf-screen-grow) var(--hf-screen-ease), margin var(--hf-screen-grow) var(--hf-screen-ease); }

/* One message: the bubble, then its meta line, on the side of the person who wrote it. */
.hf-screen__said { display: flex; flex-direction: column; gap: var(--hf-screen-gap-xs); padding-block: var(--hf-screen-gap-2xs); }
.hf-screen__said--in { align-items: flex-start; }
.hf-screen__said--out { align-items: flex-end; }

/* Message bubbles ------------------------------------------------------------------------- */
.hf-screen__msg {
  position: relative;
  max-inline-size: var(--hf-screen-msg-max);
  padding-block: var(--hf-screen-msg-pad-b); padding-inline: var(--hf-screen-msg-pad-i);
  border-radius: var(--hf-screen-msg-radius);
  font-size: var(--hf-screen-fs-body); line-height: var(--hf-screen-lh-msg);
  color: var(--hf-screen-ink);
  overflow-wrap: anywhere;
}
.hf-screen__msg-text:lang(ar) { font-size: calc(var(--hf-screen-fs-body) * var(--hf-screen-ar-scale)); line-height: var(--hf-screen-lh-ar); letter-spacing: 0; }
/* Incoming (the customer) sits at the reading start; outgoing (the agent) at the end. The tail
   corner follows the side the bubble sits on, whatever the language inside it. */
.hf-screen__msg--in {
  background: var(--hf-screen-msg-in);
  box-shadow: inset 0 0 0 var(--hf-screen-line) var(--hf-screen-msg-in-ring), var(--hf-screen-shadow-card);
}
.hf-screen__msg--out {
  background: var(--hf-screen-msg-out);
  box-shadow: inset 0 0 0 var(--hf-screen-line) var(--hf-screen-msg-out-ring);
}
.hf-screen[dir="ltr"] .hf-screen__msg--in { border-end-start-radius: var(--hf-screen-msg-tail); }
.hf-screen[dir="ltr"] .hf-screen__msg--out { border-end-end-radius: var(--hf-screen-msg-tail); }
.hf-screen[dir="rtl"] .hf-screen__msg--in { border-end-start-radius: var(--hf-screen-msg-tail); }
.hf-screen[dir="rtl"] .hf-screen__msg--out { border-end-end-radius: var(--hf-screen-msg-tail); }
/* A bubble's own language may set its direction; the tail stays on the physical side. */
.hf-screen[dir="ltr"] .hf-screen__msg--in[dir="rtl"] { border-end-start-radius: var(--hf-screen-msg-radius); border-end-end-radius: var(--hf-screen-msg-tail); }
.hf-screen[dir="ltr"] .hf-screen__msg--out[dir="rtl"] { border-end-end-radius: var(--hf-screen-msg-radius); border-end-start-radius: var(--hf-screen-msg-tail); }
.hf-screen[dir="rtl"] .hf-screen__msg--in[dir="ltr"] { border-end-start-radius: var(--hf-screen-msg-radius); border-end-end-radius: var(--hf-screen-msg-tail); }
.hf-screen[dir="rtl"] .hf-screen__msg--out[dir="ltr"] { border-end-end-radius: var(--hf-screen-msg-radius); border-end-start-radius: var(--hf-screen-msg-tail); }
/* A draft the agent holds back until a person approves it: dashed and veiled, same shape. Set
   data-sent on it and the veil lifts into an ordinary outgoing bubble. */
.hf-screen__msg--draft {
  isolation: isolate;
  box-shadow: none;
  outline: var(--hf-screen-line-dash) dashed var(--hf-screen-msg-draft-ring);
  outline-offset: calc(var(--hf-screen-line-dash) * -1);
  color: var(--hf-screen-ink-2);
  transition: color var(--hf-screen-enter) var(--hf-screen-ease), outline-color var(--hf-screen-enter) var(--hf-screen-ease), box-shadow var(--hf-screen-enter) var(--hf-screen-ease);
}
.hf-screen__msg--draft::before {
  content: ""; position: absolute; inset: 0; z-index: -1;
  border-radius: inherit; background: var(--hf-screen-msg-draft);
  transition: opacity var(--hf-screen-enter) var(--hf-screen-ease);
}
.hf-screen__msg--draft[data-sent] { color: var(--hf-screen-ink); outline-color: transparent; box-shadow: inset 0 0 0 var(--hf-screen-line) var(--hf-screen-msg-out-ring); }
.hf-screen__msg--draft[data-sent]::before { opacity: 0; }
/* The translation a console shows under a message written in the other language. */
.hf-screen__msg-tr {
  display: block;
  margin-block-start: var(--hf-screen-gap-sm); padding-block-start: var(--hf-screen-gap-sm);
  border-block-start: var(--hf-screen-line) solid var(--hf-screen-msg-tr-line);
  font-size: var(--hf-screen-fs-meta); line-height: var(--hf-screen-lh);
  color: var(--hf-screen-ink-2);
}
.hf-screen__msg-tr:lang(ar) { font-size: var(--hf-screen-fs-ui); line-height: var(--hf-screen-lh-ar-ui); }
.hf-screen__msg-meta {
  display: flex; align-items: center; gap: var(--hf-screen-chip-gap);
  padding-inline: var(--hf-screen-gap-xs);
  font-size: var(--hf-screen-fs-micro); line-height: var(--hf-screen-lh-tight); color: var(--hf-screen-ink-3); letter-spacing: 0;
}
.hf-screen__msg-meta time, .hf-screen__msg-meta bdi { font-family: var(--hf-screen-font-mono); font-variant-numeric: tabular-nums; }
.hf-screen__msg-meta .hf-glyph { inline-size: var(--hf-screen-glyph-sm); block-size: var(--hf-screen-glyph-sm); }

/* Typing: three dots that breathe, inside a bubble. */
.hf-screen__typing { display: inline-flex; align-items: center; gap: var(--hf-screen-gap-xs); block-size: var(--hf-screen-typing-h); color: var(--hf-screen-ink-3); }
.hf-screen__typing i {
  inline-size: var(--hf-screen-dot); block-size: var(--hf-screen-dot); border-radius: 50%;
  background: currentColor; opacity: var(--hf-screen-typing-o);
  animation: hf-screen-typing var(--hf-screen-typing) var(--hf-screen-ease-io) infinite;
  animation-play-state: var(--hf-screen-play);
}
.hf-screen__typing i:nth-child(2) { animation-delay: var(--hf-screen-typing-step); }
.hf-screen__typing i:nth-child(3) { animation-delay: calc(var(--hf-screen-typing-step) * 2); }

/* Files and documents ----------------------------------------------------------------------- */
/* An attachment card in a thread. */
.hf-screen__file {
  display: inline-flex; align-items: center; gap: var(--hf-screen-gap);
  min-block-size: var(--hf-screen-file-h);
  padding-block: var(--hf-screen-gap-sm); padding-inline: var(--hf-screen-gap-sm) var(--hf-screen-pad);
  border-radius: var(--hf-screen-radius-card);
  background: var(--hf-screen-raise);
  box-shadow: inset 0 0 0 var(--hf-screen-line) var(--hf-screen-hairline), var(--hf-screen-shadow-card);
}
.hf-screen__file-tile {
  flex: none; display: grid; place-items: center;
  inline-size: var(--hf-screen-file-tile); block-size: var(--hf-screen-file-tile);
  border-radius: var(--hf-screen-radius-small);
  background: var(--hf-screen-region-tint); color: var(--hf-screen-region);
  box-shadow: inset 0 0 0 var(--hf-screen-line) var(--hf-screen-region-line);
}
.hf-screen__file-name { display: block; font-family: var(--hf-screen-font-mono); font-size: var(--hf-screen-fs-mono); letter-spacing: 0; color: var(--hf-screen-ink); line-height: var(--hf-screen-lh-tight); }
.hf-screen__file-meta { display: block; margin-block-start: var(--hf-screen-gap-2xs); font-size: var(--hf-screen-fs-micro); color: var(--hf-screen-ink-3); line-height: var(--hf-screen-lh-tight); }
.hf-screen:lang(ar) .hf-screen__file-meta { font-size: var(--hf-screen-fs-meta); line-height: var(--hf-screen-lh-ar-ui); }

/* A document page in miniature, with a scan line while the agent reads it (data-scan). */
.hf-screen__doc {
  position: relative; flex: none; overflow: hidden;
  inline-size: var(--hf-screen-doc-w); block-size: var(--hf-screen-doc-h);
  border-radius: var(--hf-screen-radius-tiny);
  background:
    repeating-linear-gradient(180deg, transparent 0 var(--hf-screen-doc-pitch), var(--hf-screen-skel) var(--hf-screen-doc-pitch) calc(var(--hf-screen-doc-pitch) + var(--hf-screen-doc-line)))
      var(--hf-screen-doc-inset) var(--hf-screen-doc-top) / calc(100% - var(--hf-screen-doc-inset) * 2) calc(100% - var(--hf-screen-doc-top) - var(--hf-screen-doc-inset)) no-repeat,
    var(--hf-screen-raise);
  box-shadow: inset 0 0 0 var(--hf-screen-line) var(--hf-screen-hairline-2), var(--hf-screen-shadow-card);
}
.hf-screen__doc::after {
  content: ""; position: absolute; inset-inline: 0; inset-block-start: 0;
  block-size: var(--hf-screen-scan-h);
  background: linear-gradient(180deg, transparent, var(--hf-screen-region-tint) 70%, var(--hf-screen-region));
  opacity: 0; transform: translateY(-100%);
}
.hf-screen__doc[data-scan]::after {
  opacity: var(--hf-screen-scan-o);
  animation: hf-screen-scan var(--hf-screen-scan) var(--hf-screen-ease-io) infinite;
  animation-play-state: var(--hf-screen-play);
}

/* A short line with a glyph (a safeguard, a source, a note). */
.hf-screen__note {
  display: flex; align-items: center; gap: var(--hf-screen-gap-sm);
  font-size: var(--hf-screen-fs-meta); line-height: var(--hf-screen-lh); color: var(--hf-screen-ink-2);
}
.hf-screen__note .hf-glyph { color: var(--hf-screen-region); }
.hf-screen:lang(ar) .hf-screen__note { font-size: var(--hf-screen-fs-ui); line-height: var(--hf-screen-lh-ar-ui); }

/* Mono log lines ---------------------------------------------------------------------------- */
.hf-screen__log { margin: 0; padding: 0; list-style: none; font-family: var(--hf-screen-font-mono); font-size: var(--hf-screen-fs-mono); letter-spacing: 0; }
.hf-screen__log-row {
  display: grid; grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center; column-gap: var(--hf-screen-gap);
  min-block-size: var(--hf-screen-log-h);
  font-variant-numeric: tabular-nums;
}
.hf-screen__log-row + .hf-screen__log-row { border-block-start: var(--hf-screen-line) solid var(--hf-screen-hairline); }
.hf-screen__log-row time { color: var(--hf-screen-ink-3); }
.hf-screen__log-row :lang(ar) { font-family: var(--hf-screen-font); font-size: calc(var(--hf-screen-fs-mono) * var(--hf-screen-ar-scale)); }

/* Tables -------------------------------------------------------------------------------------- */
.hf-screen__table { inline-size: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.hf-screen__table th {
  block-size: var(--hf-screen-th-h); padding-inline: var(--hf-screen-gap-sm);
  text-align: start; font-size: var(--hf-screen-fs-micro); font-weight: var(--hf-screen-wt-ui); color: var(--hf-screen-ink-3);
  border-block-end: var(--hf-screen-line) solid var(--hf-screen-hairline-2);
}
.hf-screen__table td {
  block-size: var(--hf-screen-row-h); padding-inline: var(--hf-screen-gap-sm);
  font-size: var(--hf-screen-fs-ui); color: var(--hf-screen-ink);
  border-block-end: var(--hf-screen-line) solid var(--hf-screen-hairline);
}
.hf-screen__table td[data-num] { text-align: end; font-family: var(--hf-screen-font-mono); font-size: var(--hf-screen-fs-mono); }

/* A small chart frame: an SVG series that draws itself. Time runs left to right in both
   languages (Arabic Typography 8.9); give the <svg> dir="ltr". */
.hf-screen__chart { padding: var(--hf-screen-pad-sm); }
.hf-screen__chart svg { display: block; inline-size: 100%; block-size: auto; overflow: visible; }
.hf-screen__chart-axis { stroke: var(--hf-screen-viz-axis); stroke-width: var(--hf-screen-line); vector-effect: non-scaling-stroke; }
.hf-screen__chart-line { fill: none; stroke: var(--hf-screen-viz-1); stroke-width: var(--hf-screen-viz-stroke); stroke-linecap: round; stroke-linejoin: round; vector-effect: non-scaling-stroke; }
.hf-screen__chart-area { fill: var(--hf-screen-viz-1-fill); }
.hf-screen__chart-muted { fill: none; stroke: var(--hf-screen-viz-2); stroke-width: var(--hf-screen-viz-stroke-2); stroke-dasharray: var(--hf-screen-viz-dash); vector-effect: non-scaling-stroke; }

/* Progress bar. Set --hf-progress (0 to 1) inline. */
.hf-screen__progress {
  position: relative; overflow: hidden;
  block-size: var(--hf-screen-progress-h); border-radius: var(--hf-screen-radius-full);
  background: var(--hf-screen-neutral-tint);
}
.hf-screen__progress::after {
  content: ""; position: absolute; inset: 0;
  border-radius: inherit; background: var(--hf-screen-region);
  transform-origin: left center;
  transform: scaleX(var(--hf-progress, 0));
}
.hf-screen[dir="rtl"] .hf-screen__progress::after { transform-origin: right center; }

/* Segmented control (tabs that a screen switches itself; not interactive). */
.hf-screen__seg {
  display: inline-flex; gap: var(--hf-screen-gap-2xs); padding: var(--hf-screen-seg-pad);
  border-radius: var(--hf-screen-radius-full);
  background: var(--hf-screen-neutral-tint);
  box-shadow: inset 0 0 0 var(--hf-screen-line) var(--hf-screen-hairline);
}
.hf-screen__seg > span {
  display: inline-flex; align-items: center; gap: var(--hf-screen-chip-gap);
  block-size: var(--hf-screen-seg-h); padding-inline: var(--hf-screen-seg-pad-s) var(--hf-screen-seg-pad-e);
  border-radius: var(--hf-screen-radius-full);
  font-size: var(--hf-screen-fs-micro); font-weight: var(--hf-screen-wt-ui); color: var(--hf-screen-ink-3);
  transition: background-color var(--hf-dur-3) var(--hf-ease-out), color var(--hf-dur-3) var(--hf-ease-out), box-shadow var(--hf-dur-3) var(--hf-ease-out);
}
.hf-screen__seg > span[data-on] { background: var(--hf-screen-raise); color: var(--hf-screen-ink); box-shadow: var(--hf-screen-shadow-card), inset 0 0 0 var(--hf-screen-line) var(--hf-screen-hairline); }
.hf-screen__seg .hf-glyph { inline-size: var(--hf-screen-glyph-sm); block-size: var(--hf-screen-glyph-sm); }

/* The seal square (the single amber accent). */
.hf-screen__seal {
  display: inline-block; flex: none;
  inline-size: var(--hf-screen-seal); block-size: var(--hf-screen-seal);
  border-radius: var(--hf-screen-seal-radius);
  background: var(--hf-screen-seal-fill);
  box-shadow: inset 0 0 0 var(--hf-screen-line) var(--hf-screen-seal-edge);
}
.hf-screen__seal[data-stamp] { animation: hf-screen-seal var(--hf-dur-stamp) var(--hf-ease-stamp) both; }

/* A bottom sheet for narrow screens: slides up over the content when data-open is set. */
.hf-screen__sheet {
  position: absolute; z-index: 2; inset-inline: 0; inset-block-end: 0;
  border-start-start-radius: var(--hf-screen-sheet-radius); border-start-end-radius: var(--hf-screen-sheet-radius);
  background: var(--hf-screen-raise);
  box-shadow: var(--hf-screen-shadow-sheet), inset 0 var(--hf-screen-line) 0 var(--hf-screen-highlight);
  transform: translateY(calc(100% + var(--hf-screen-pad)));
  transition: transform var(--hf-screen-sheet) var(--hf-screen-ease);
}
.hf-screen__sheet[data-open] { transform: none; }
.hf-screen__sheet::before {
  content: ""; display: block;
  inline-size: var(--hf-screen-sheet-handle-w); block-size: var(--hf-screen-sheet-handle-h);
  margin: var(--hf-screen-gap-sm) auto 0;
  border-radius: var(--hf-screen-radius-full); background: var(--hf-screen-hairline-2);
}

/* Arrivals: anything marked data-enter rises in when the screen sets data-in on it. */
.hf-screen [data-enter] {
  opacity: 0;
  transform: translateY(var(--hf-screen-rise));
  transition: opacity var(--hf-screen-enter) var(--hf-screen-ease), transform var(--hf-screen-enter) var(--hf-screen-ease);
}
.hf-screen [data-enter][data-in] { opacity: 1; transform: none; }
.hf-screen [data-fade] { opacity: 0; transition: opacity var(--hf-screen-enter) var(--hf-screen-ease); }
.hf-screen [data-fade][data-in] { opacity: 1; }

/* Clearing before the loop restarts: live content fades, the chrome stays. */
.hf-screen__live { transition: opacity var(--hf-screen-clear) var(--hf-screen-ease-io); }
.hf-screen[data-phase="clearing"] .hf-screen__live { opacity: 0; }

/* Seeking: land on the state, do not animate to it. Resetting (under the faded live layer at
   the loop's end): the live content snaps back to t = 0 while the layer itself fades back in. */
.hf-screen[data-seeking] *, .hf-screen[data-seeking] *::before, .hf-screen[data-seeking] *::after { transition: none !important; }
.hf-screen[data-resetting] .hf-screen__live *, .hf-screen[data-resetting] .hf-screen__live *::before, .hf-screen[data-resetting] .hf-screen__live *::after { transition: none !important; animation: none !important; }

/* Paused, off-screen, hidden tab: ambient loops (typing dots, pulses, carets) stop with the clock.
   Every infinite animation reads var(--hf-screen-play); one-shot arrivals (stamps) do not, so a
   chip that was arriving when the visitor paused still lands. Still (reduced motion, autoplay
   off) and held (a moment chosen with seek()): nothing moves at all. */
.hf-screen { --hf-screen-play: paused; }
.hf-screen[data-state="playing"] { --hf-screen-play: running; }
.hf-screen:is([data-state="still"], [data-state="held"]) *,
.hf-screen:is([data-state="still"], [data-state="held"]) *::before,
.hf-screen:is([data-state="still"], [data-state="held"]) *::after { animation: none !important; transition: none !important; }

@media (prefers-reduced-motion: reduce) {
  .hf-screen *, .hf-screen *::before, .hf-screen *::after { animation: none !important; transition: none !important; }
}

@keyframes hf-screen-pulse { 0%, 100% { box-shadow: 0 0 0 0 currentColor; } 50% { box-shadow: 0 0 0 var(--hf-screen-pulse-ring) transparent; } }
@keyframes hf-screen-stamp { 0% { transform: scale(var(--hf-screen-stamp-from)); opacity: 0; } 100% { transform: none; opacity: 1; } }
@keyframes hf-screen-seal { 0% { transform: scale(var(--hf-scale-stamp-from)); } 60% { transform: scale(var(--hf-scale-stamp-peak)); } 100% { transform: scale(1); } }
@keyframes hf-screen-caret { 0%, 49% { opacity: var(--hf-screen-caret-o); } 50%, 100% { opacity: 0; } }
@keyframes hf-screen-typing { 0%, 70%, 100% { opacity: var(--hf-screen-typing-o-lo); transform: none; } 35% { opacity: var(--hf-screen-typing-o-hi); transform: translateY(var(--hf-screen-typing-lift)); } }
@keyframes hf-screen-shimmer { 0% { transform: translateX(-100%); } 60%, 100% { transform: translateX(100%); } }
@keyframes hf-screen-scan { 0% { transform: translateY(-100%); } 100% { transform: translateY(250%); } }
@keyframes hf-screen-flash { 0% { opacity: 0; } 25% { opacity: 1; } 100% { opacity: 0; } }
@keyframes hf-screen-flash-again { 0% { opacity: 0; } 25% { opacity: 1; } 100% { opacity: 0; } }
@keyframes hf-screen-breathe { 0%, 100% { opacity: 1; } 50% { opacity: var(--hf-screen-agent-core-lo); } }
@keyframes hf-screen-say-a { 0% { opacity: 0; transform: translateY(var(--hf-screen-now-rise)); } 100% { opacity: 1; transform: none; } }
@keyframes hf-screen-say-b { 0% { opacity: 0; transform: translateY(var(--hf-screen-now-rise)); } 100% { opacity: 1; transform: none; } }

/* The dark "instrument" variant ------------------------------------------------------------
   Only for a full-bleed dark chapter (theme: 'dark' sets data-surface="instrument", so the
   tokens.css colour tokens switch too). Never a floating dark box on a light page. */
.hf-screen[data-hf-theme="dark"] {
  --hf-screen-frame-fill: #121922;
  --hf-screen-frame-ring: rgb(233 238 244 / 0.1);
  --hf-screen-window: #0B1016;
  --hf-screen-pane: #0F151C;
  --hf-screen-raise: #111821;
  --hf-screen-sunk: rgb(0 0 0 / 0.3);
  --hf-screen-hairline: rgb(233 238 244 / 0.08);
  --hf-screen-hairline-2: rgb(233 238 244 / 0.14);
  --hf-screen-highlight: rgb(255 255 255 / 0.03);
  --hf-screen-shadow: 0 24px 48px -20px rgb(0 0 0 / 0.6), 0 0 0 1px rgb(233 238 244 / 0.06);
  --hf-screen-shadow-card: 0 1px 2px rgb(0 0 0 / 0.4), 0 10px 24px -16px rgb(0 0 0 / 0.6);
  --hf-screen-shadow-pop: 0 1px 2px rgb(0 0 0 / 0.45), 0 22px 44px -20px rgb(0 0 0 / 0.7);
  --hf-screen-shadow-sheet: 0 -1px 0 rgb(233 238 244 / 0.06), 0 -18px 40px -22px rgb(0 0 0 / 0.7);
  --hf-screen-shadow-ink: 0 1px 2px rgb(0 0 0 / 0.4), 0 8px 18px -10px rgb(0 0 0 / 0.7);
  --hf-screen-dots: radial-gradient(rgb(233 238 244 / 0.07) 0.75px, transparent 1.15px);
  --hf-screen-tile-fill: #E9EEF4;
  --hf-screen-tile-ink: #05070A;
  --hf-screen-avatar-fill: linear-gradient(180deg, #1C2530 0%, #151C25 100%);
  --hf-screen-avatar-ink: #A9B2BE;
  --hf-screen-agent-fill: linear-gradient(180deg, #1A222C 0%, #141B23 100%);
  --hf-screen-agent-ink: #E9EEF4;
  --hf-screen-region: var(--hf-color-map-fence);
  --hf-screen-region-tint: rgb(72 221 177 / 0.08);
  --hf-screen-region-line: rgb(72 221 177 / 0.28);
  --hf-screen-neutral-tint: rgb(233 238 244 / 0.05);
  --hf-screen-neutral-line: rgb(233 238 244 / 0.14);
  --hf-screen-skel: rgb(233 238 244 / 0.08);
  --hf-screen-skel-hi: rgb(233 238 244 / 0.12);
  --hf-screen-flash: rgb(72 221 177 / 0.1);
  --hf-screen-msg-in: #141C26;
  --hf-screen-msg-in-ring: rgb(233 238 244 / 0.09);
  --hf-screen-msg-out: linear-gradient(180deg, rgb(72 221 177 / 0.12), rgb(72 221 177 / 0.07));
  --hf-screen-msg-out-ring: rgb(72 221 177 / 0.22);
  --hf-screen-msg-draft: rgb(233 238 244 / 0.03);
  --hf-screen-msg-draft-ring: rgb(72 221 177 / 0.45);
  --hf-screen-msg-tr-line: rgb(233 238 244 / 0.1);
  --hf-screen-viz-1: var(--hf-color-map-fence);
  --hf-screen-viz-1-fill: rgb(72 221 177 / 0.14);
  --hf-screen-viz-axis: rgb(233 238 244 / 0.1);
  color-scheme: dark;
}

@media (forced-colors: active) {
  .hf-screen__frame, .hf-screen__window, .hf-screen__card, .hf-screen__msg, .hf-screen__file, .hf-screen__sheet { border: 1px solid CanvasText; }
  .hf-screen__chip::before { border-color: CanvasText; }
  .hf-screen__seal { forced-color-adjust: none; }
}
