/* The fork's page in DS1 track A "Full width" (decisions item 328, owner Nov 18): the fork's skin. templates/coach.html
   links it only while config fork.live is on, right after fork.css, so the old system's page (fork off) never loads it.
   Part 1 (this part): the shared tokens and classes that UI-B, UI-C and UI-D build on. The values are A1 Full width's
   (handoff/ds1/A1/full-width/index.html, lines 13-100) with a --ui- prefix. The chat-page skin follows in later parts.
   Dark mode: coach.css switches its palette only with prefers-color-scheme (no class or attribute for a user choice),
   so the tokens follow the same media query and match the theme of the page around them.
   Phone or wide: the app's breakpoint (coach.js matchMedia('(max-width:699px)'); coach.css 699.98px), so a phone is
   under 700 px and a wide screen 700 px and over (A1 drew its wide layout at 900 px; the app's own number wins).
   Shape (owner, Nov 18: square, Apple-like, no capsules): buttons, fields and segments have 6 px corners (--ui-r-2);
   only cards, sheets and the student's bubble have 10 px (--ui-r-3); nothing in this file is a pill or a circle.
   Specificity: every class rule here starts with body[data-fork="1"], so it outranks the parent-scoped button rules of
   coach.css and fork.css (`.profile-page button`, `.fk-map button`, `.fk-profile button`, `.header-actions button`)
   and ties-then-wins against their `:disabled` ones by coming later. Later rows that change a .ui-* look write their
   rule with the same prefix and the same or more classes. */

/* ---- Tokens ---- */
body[data-fork="1"] {
  --ui-font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, "Helvetica Neue", Helvetica, Arial,
    system-ui, sans-serif;
  --ui-font-math: "STIX Two Math", "Cambria Math", "Latin Modern Math", math, serif;
  --ui-t-title: 28px;
  --ui-t-head: 20px;
  --ui-t-body: 17px;
  --ui-t-read: 16px; /* Coach's reply */
  --ui-t-sub: 15px;
  --ui-t-foot: 13px;
  --ui-t-cap: 12px;
  --ui-r-1: 4px; /* focus rings */
  --ui-r-2: 6px; /* every button and field */
  --ui-r-3: 10px; /* cards, sheets, the student's bubble */
  --ui-s-1: 4px;
  --ui-s-2: 8px;
  --ui-s-3: 12px;
  --ui-s-4: 16px;
  --ui-s-5: 20px;
  --ui-s-6: 24px;
  --ui-s-7: 32px;
  --ui-hit: 44px;
  --ui-gut: 14px; /* the phone's side margin; 0 on a wide screen */
  --ui-col: 680px;
  --ui-bar: 44px; /* the top row's height, for panes that sit under it */
  --ui-bg: #ffffff;
  --ui-bg-2: #f5f5f7; /* pressed rows, the student's bubble */
  --ui-bg-3: #e8e8ed;
  --ui-ink: #1d1d1f;
  --ui-ink-2: #636366;
  --ui-line: #d2d2d7; /* hairlines */
  --ui-line-2: #8a8a8f; /* outlines, 3.4:1 on --ui-bg */
  --ui-accent: #4f46e5;
  --ui-accent-fill: #4f46e5;
  --ui-on-accent: #ffffff;
  --ui-danger: #c4161c;
  --ui-fig: #ffffff; /* the plate under figures */
  --ui-scrim: rgba(0, 0, 0, .32);
  --ui-shadow: 0 12px 40px rgba(0, 0, 0, .16);
  --ui-me-bg: var(--ui-bg-2); /* the student's bubble: one token to change if the owner wants a coloured tint */
  /* The › of .ui-row.go, .send and .open, used as a mask so it takes the row's colour. */
  --ui-chev: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M9 5.5l6.5 6.5L9 18.5' fill='none' stroke='%23000' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
}
@media (prefers-color-scheme: dark) {
  body[data-fork="1"] {
    --ui-bg: #000000;
    --ui-bg-2: #1c1c1e;
    --ui-bg-3: #2c2c2e;
    --ui-ink: #f5f5f7;
    --ui-ink-2: #a1a1a6;
    --ui-line: #303033;
    --ui-line-2: #77777c; /* 4.7:1 on --ui-bg */
    --ui-accent: #a5a1ff;
    --ui-accent-fill: #5e5ce6;
    --ui-on-accent: #ffffff;
    --ui-danger: #ff6961;
    --ui-fig: #e2e2e7;
    --ui-scrim: rgba(0, 0, 0, .6);
    --ui-shadow: 0 12px 40px rgba(0, 0, 0, .6);
    --ui-me-bg: var(--ui-bg-2);
  }
}
@media (min-width: 700px) {
  body[data-fork="1"] {
    --ui-gut: 0px;
    --ui-bar: 52px;
  }
}
/* The same tokens on the page itself (html), so its canvas and ::backdrop can read them. A separate rule, not a
   selector list with the body rule: a browser without :has() (Firefox before 121, Safari before 15.4) drops a whole
   list that names it, and would lose the body tokens too. tests.test_fork_skin checks the two copies are equal. */
:root:has(body[data-fork="1"]) {
  --ui-font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, "Helvetica Neue", Helvetica, Arial,
    system-ui, sans-serif;
  --ui-font-math: "STIX Two Math", "Cambria Math", "Latin Modern Math", math, serif;
  --ui-t-title: 28px;
  --ui-t-head: 20px;
  --ui-t-body: 17px;
  --ui-t-read: 16px; /* Coach's reply */
  --ui-t-sub: 15px;
  --ui-t-foot: 13px;
  --ui-t-cap: 12px;
  --ui-r-1: 4px; /* focus rings */
  --ui-r-2: 6px; /* every button and field */
  --ui-r-3: 10px; /* cards, sheets, the student's bubble */
  --ui-s-1: 4px;
  --ui-s-2: 8px;
  --ui-s-3: 12px;
  --ui-s-4: 16px;
  --ui-s-5: 20px;
  --ui-s-6: 24px;
  --ui-s-7: 32px;
  --ui-hit: 44px;
  --ui-gut: 14px; /* the phone's side margin; 0 on a wide screen */
  --ui-col: 680px;
  --ui-bar: 44px; /* the top row's height, for panes that sit under it */
  --ui-bg: #ffffff;
  --ui-bg-2: #f5f5f7; /* pressed rows, the student's bubble */
  --ui-bg-3: #e8e8ed;
  --ui-ink: #1d1d1f;
  --ui-ink-2: #636366;
  --ui-line: #d2d2d7; /* hairlines */
  --ui-line-2: #8a8a8f; /* outlines, 3.4:1 on --ui-bg */
  --ui-accent: #4f46e5;
  --ui-accent-fill: #4f46e5;
  --ui-on-accent: #ffffff;
  --ui-danger: #c4161c;
  --ui-fig: #ffffff; /* the plate under figures */
  --ui-scrim: rgba(0, 0, 0, .32);
  --ui-shadow: 0 12px 40px rgba(0, 0, 0, .16);
  --ui-me-bg: var(--ui-bg-2); /* the student's bubble: one token to change if the owner wants a coloured tint */
  /* The › of .ui-row.go, .send and .open, used as a mask so it takes the row's colour. */
  --ui-chev: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M9 5.5l6.5 6.5L9 18.5' fill='none' stroke='%23000' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
}
@media (prefers-color-scheme: dark) {
  :root:has(body[data-fork="1"]) {
    --ui-bg: #000000;
    --ui-bg-2: #1c1c1e;
    --ui-bg-3: #2c2c2e;
    --ui-ink: #f5f5f7;
    --ui-ink-2: #a1a1a6;
    --ui-line: #303033;
    --ui-line-2: #77777c; /* 4.7:1 on --ui-bg */
    --ui-accent: #a5a1ff;
    --ui-accent-fill: #5e5ce6;
    --ui-on-accent: #ffffff;
    --ui-danger: #ff6961;
    --ui-fig: #e2e2e7;
    --ui-scrim: rgba(0, 0, 0, .6);
    --ui-shadow: 0 12px 40px rgba(0, 0, 0, .6);
    --ui-me-bg: var(--ui-bg-2);
  }
}
@media (min-width: 700px) {
  :root:has(body[data-fork="1"]) {
    --ui-gut: 0px;
    --ui-bar: 52px;
  }
}

/* ---- Shared classes (for DOM that UI-B, UI-C and UI-D build). Each base rule states its own box, font, colour and
   opacity, so a browser's default button and the app's button rules (coach.css's 10 px indigo fill, its disabled
   opacity .5 and wait cursor; fork.css's square zero-padding map and profile buttons) do not leak in. ---- */

/* A button: 6 px corners, a 44 px target. .fill is the one main action; .line an outlined second one; .block spans
   its container. */
body[data-fork="1"] .ui-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--ui-s-2); box-sizing: border-box;
  min-height: var(--ui-hit); min-width: var(--ui-hit); margin: 0; padding: 0 var(--ui-s-4);
  border: 0; border-radius: var(--ui-r-2); background: none; box-shadow: none; color: var(--ui-ink); opacity: 1;
  font-family: var(--ui-font); font-size: var(--ui-t-body); font-style: normal; font-weight: 600; line-height: 1.2;
  text-align: center; white-space: nowrap; cursor: pointer; -webkit-tap-highlight-color: transparent;
}
body[data-fork="1"] .ui-btn.fill { background: var(--ui-accent-fill); color: var(--ui-on-accent); }
body[data-fork="1"] .ui-btn.fill:active { filter: brightness(.86); }
body[data-fork="1"] .ui-btn.line { box-shadow: inset 0 0 0 1px var(--ui-line-2); color: var(--ui-ink); }
body[data-fork="1"] .ui-btn.line:active { background: var(--ui-bg-3); }
body[data-fork="1"] .ui-btn.block { display: flex; width: 100%; }
body[data-fork="1"] .ui-btn:disabled, body[data-fork="1"] .ui-btn[aria-disabled="true"] {
  background: var(--ui-bg-3); box-shadow: none; color: var(--ui-ink-2); filter: none; opacity: 1; cursor: default;
}

/* An icon button: 44 x 44, no fill until pressed; aria-pressed marks a pane that is open. */
body[data-fork="1"] .ui-ib {
  display: inline-flex; align-items: center; justify-content: center; flex: none; box-sizing: border-box;
  width: var(--ui-hit); height: var(--ui-hit); min-width: 0; min-height: 0; margin: 0; padding: 0;
  border: 0; border-radius: var(--ui-r-2); background: transparent; box-shadow: none; color: var(--ui-ink);
  opacity: 1; font-family: var(--ui-font); font-size: var(--ui-t-body); line-height: 1;
  cursor: pointer; -webkit-tap-highlight-color: transparent;
}
body[data-fork="1"] .ui-ib:active { background: var(--ui-bg-3); }
body[data-fork="1"] .ui-ib[aria-pressed="true"] { background: var(--ui-bg-2); color: var(--ui-accent); }
body[data-fork="1"] .ui-ib:disabled, body[data-fork="1"] .ui-ib[aria-disabled="true"] {
  background: transparent; color: var(--ui-line-2); opacity: 1; cursor: default;
}

/* A quiet text button: accent words, a 44 px target, no box. .quiet is grey; .danger is for an action that removes. */
body[data-fork="1"] .ui-link {
  display: inline-flex; align-items: center; box-sizing: border-box; min-height: var(--ui-hit);
  min-width: var(--ui-hit); margin: 0; padding: 0; border: 0; border-radius: var(--ui-r-2); background: none;
  box-shadow: none; color: var(--ui-accent); opacity: 1; font-family: var(--ui-font); font-size: var(--ui-t-sub);
  font-style: normal; font-weight: 400; line-height: 1.2; text-align: left; cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
body[data-fork="1"] .ui-link.quiet { color: var(--ui-ink-2); }
body[data-fork="1"] .ui-link.danger { color: var(--ui-danger); }
body[data-fork="1"] .ui-link:active { opacity: .55; }
body[data-fork="1"] .ui-link:disabled, body[data-fork="1"] .ui-link[aria-disabled="true"] {
  color: var(--ui-ink-2); opacity: .6; cursor: default;
}

/* Joined segments (a choice of two or three, and On/Off with .onoff): one 6 px outline around square segments; the
   chosen one is marked with aria-pressed="true" and drawn with a fill, bold words and a 2 px ink bar at its foot. */
body[data-fork="1"] .ui-seg {
  display: inline-flex; margin: 0; padding: 0; border: 1px solid var(--ui-line-2); border-radius: var(--ui-r-2);
  box-shadow: none; overflow: hidden; /* a border, not an inset shadow, so a chosen segment's fill sits inside it */
}
body[data-fork="1"] .ui-seg.wide { display: flex; }
body[data-fork="1"] .ui-seg > button {
  flex: 1 1 auto; box-sizing: border-box; min-width: 64px; min-height: var(--ui-hit); margin: 0; padding: 4px 10px;
  border: 0; border-radius: 0; background: none; box-shadow: none; color: var(--ui-ink); opacity: 1;
  font-family: var(--ui-font); font-size: var(--ui-t-sub); font-style: normal; font-weight: 400; line-height: 1.2;
  text-align: center; white-space: nowrap; cursor: pointer; -webkit-tap-highlight-color: transparent;
}
body[data-fork="1"] .ui-seg > button + button { box-shadow: inset 1px 0 0 var(--ui-line-2); }
body[data-fork="1"] .ui-seg > button:active { background: var(--ui-bg-3); }
body[data-fork="1"] .ui-seg > button[aria-pressed="true"] {
  background: var(--ui-bg-2); font-weight: 600; box-shadow: inset 0 -2px 0 var(--ui-ink);
}
body[data-fork="1"] .ui-seg > button + button[aria-pressed="true"] {
  box-shadow: inset 0 -2px 0 var(--ui-ink), inset 1px 0 0 var(--ui-line-2);
}
body[data-fork="1"] .ui-seg > button:disabled { color: var(--ui-ink-2); opacity: .6; cursor: default; }
body[data-fork="1"] .ui-seg.onoff > button { min-width: 56px; }

/* Rows between hairlines (.ui-rows draws the top one). The › is a drawn chevron (a CSS mask), not a text character.
   .go: accent words and an accent ›, Coach's choices, "this sends as your message"; .send: ink words and an accent ›,
   the map's rows that send ("a › in the brand colour sends"); .open: ink words and a grey ›, "this opens". The first
   child (the words) takes the room and wraps, so a long label never pushes the › off the row. */
body[data-fork="1"] .ui-rows { border-top: 1px solid var(--ui-line); }
body[data-fork="1"] .ui-row {
  display: flex; align-items: center; gap: var(--ui-s-3); box-sizing: border-box; width: 100%;
  min-height: var(--ui-hit); margin: 0; padding: 6px 0; border: 0; border-bottom: 1px solid var(--ui-line);
  border-radius: 0; background: none; box-shadow: none; color: var(--ui-ink); opacity: 1;
  font-family: var(--ui-font); font-size: inherit; font-style: normal; font-weight: 400; line-height: 1.3;
  text-align: left; text-decoration: none; -webkit-tap-highlight-color: transparent;
}
body[data-fork="1"] .ui-row > :first-child { flex: 1; min-width: 0; overflow-wrap: anywhere; }
body[data-fork="1"] button.ui-row, body[data-fork="1"] a.ui-row { cursor: pointer; }
body[data-fork="1"] button.ui-row:active, body[data-fork="1"] a.ui-row:active { background: var(--ui-bg-2); }
body[data-fork="1"] .ui-row.go { color: var(--ui-accent); }
body[data-fork="1"] .ui-row.go::after, body[data-fork="1"] .ui-row.send::after,
body[data-fork="1"] .ui-row.open::after {
  content: ""; flex: none; width: 16px; height: 16px; margin-left: auto; background: var(--ui-accent);
  -webkit-mask: var(--ui-chev) center / 16px 16px no-repeat; mask: var(--ui-chev) center / 16px 16px no-repeat;
}
body[data-fork="1"] .ui-row.open::after { background: var(--ui-ink-2); }
body[data-fork="1"] .ui-row:disabled, body[data-fork="1"] .ui-row[aria-disabled="true"] {
  color: var(--ui-ink-2); background: none; opacity: 1; cursor: default;
}
body[data-fork="1"] .ui-row:disabled::after, body[data-fork="1"] .ui-row[aria-disabled="true"]::after { opacity: .4; }

/* A card: a hairline box with 10 px corners. */
body[data-fork="1"] .ui-card {
  border: 1px solid var(--ui-line); border-radius: var(--ui-r-3); padding: var(--ui-s-3) var(--ui-s-4) var(--ui-s-4);
}

/* The student's words: a tinted bubble at the right (A1 plain-page .me). */
body[data-fork="1"] .ui-me {
  align-self: flex-end; max-width: 86%; padding: 7px var(--ui-s-3); border-radius: var(--ui-r-3);
  background: var(--ui-me-bg); color: var(--ui-ink); overflow-wrap: anywhere;
}
@media (min-width: 700px) {
  body[data-fork="1"] .ui-me { max-width: 76%; }
}

/* Focus: a 3 px accent ring with 4 px corners (A1). Rows and segments draw it inside, so a full-width row's ring does
   not overflow the screen and a segment's is not cut off by the group's clipped corners. */
body[data-fork="1"] .ui-btn:focus-visible, body[data-fork="1"] .ui-ib:focus-visible,
body[data-fork="1"] .ui-link:focus-visible {
  outline: 3px solid var(--ui-accent); outline-offset: 2px; border-radius: var(--ui-r-1);
}
body[data-fork="1"] .ui-seg > button:focus-visible, body[data-fork="1"] .ui-row:focus-visible {
  outline: 3px solid var(--ui-accent); outline-offset: -3px; border-radius: var(--ui-r-1);
}

/* ==== Part 2: the page frame (decisions item 328). Each rule below starts with body[data-fork="1"] (on <body> from the
   template, so it holds at first paint) and owns its component whole, so coach.css's layered rules (rewritten many
   times over: base, Messages-style, chrome tokens, phone row) do not show through. coach.css itself is not edited. ---- */

/* The old palette on the new tokens, while the fork serves: coach.css and fork.css colour the map, the Menu, the
   dialogs and the cards with --chrome-* (and fork.css's --fk-* from them), so pointing them at --ui-* gives those
   parts the new palette without a rule each. coach.css redefines --chrome-* on :root (light and dark) and, in dark,
   on #bug-dialog, #bug-toast, #report-problem, .invite-panel and .scene-card; each gets the mapping back here with
   a stronger selector. --chrome-on-brand is the page colour: white on the light accent, black on the dark one. */
body[data-fork="1"], body[data-fork="1"] #bug-dialog, body[data-fork="1"] #bug-toast,
body[data-fork="1"] #report-problem, body[data-fork="1"] .invite-panel, body[data-fork="1"] .scene-card {
  --chrome-bg: var(--ui-bg); --chrome-card: var(--ui-bg); --chrome-ink: var(--ui-ink); --chrome-mute: var(--ui-ink-2);
  --chrome-line: var(--ui-line); --chrome-brand: var(--ui-accent); --chrome-soft: var(--ui-bg-2);
  --chrome-disabled: var(--ui-bg-3); --chrome-disabled-ink: var(--ui-ink-2); --chrome-on-brand: var(--ui-bg);
}
:root:has(body[data-fork="1"]) {
  --chrome-bg: var(--ui-bg); --chrome-card: var(--ui-bg); --chrome-ink: var(--ui-ink); --chrome-mute: var(--ui-ink-2);
  --chrome-line: var(--ui-line); --chrome-brand: var(--ui-accent); --chrome-soft: var(--ui-bg-2);
  --chrome-disabled: var(--ui-bg-3); --chrome-disabled-ink: var(--ui-ink-2); --chrome-on-brand: var(--ui-bg);
  background: var(--ui-bg); color: var(--ui-ink);
}
body[data-fork="1"] .fk-map, body[data-fork="1"] .fk-cc, body[data-fork="1"] .fk-ask, body[data-fork="1"] .fl-steps {
  --fk-row: var(--ui-bg); --fk-press: var(--ui-bg-2); --fk-soft: var(--ui-bg-2); --fk-card: var(--ui-bg);
}
body[data-fork="1"].lang-map .side {
  --lm-ink: var(--ui-ink); --lm-ink2: var(--ui-ink); --lm-mute: var(--ui-ink-2); --lm-bg: var(--ui-bg);
  --lm-card: var(--ui-bg); --lm-line: var(--ui-line); --lm-brand: var(--ui-accent); --lm-soft: var(--ui-bg-2);
  --lm-soft2: var(--ui-bg-2);
}
body[data-fork="1"] { background: var(--ui-bg); color: var(--ui-ink); font-family: var(--ui-font); }

/* The band (review 2 G1): coach.css gives main 30 px of top padding on a phone and 55 px on a wide screen, so the chat
   started 30 px under the bar. While the chat shows, the conversation starts directly under the top row; the
   sign-in page keeps its padding. The chat is a column of 680 px on a wide screen (A1), with 24 px of its own
   padding so its text never touches the window's edges between 700 and 730 px. On a phone the page margins are the
   conversation's own (14 px, --ui-gut), so a formula, a figure or a widget can run from edge to edge. */
body[data-fork="1"]:has(#chat:not([hidden])) > main { padding-top: 0; padding-left: 0; padding-right: 0; }
@media (min-width: 700px) {
  body[data-fork="1"]:has(#chat:not([hidden])) > main {
    max-width: calc(var(--ui-col) + 48px); padding-left: 24px; padding-right: 24px;
  }
}
@media (min-width: 1000px) {
  /* With the side panel open the column also fits what is left of the window (1000-1100 px, critic round 1). */
  body[data-fork="1"]:has(#chat:not([hidden])) > main {
    max-width: min(calc(var(--ui-col) + 48px), calc(100vw - var(--aside, 0px) - 16px));
  }
  body[data-fork="1"].chat-on > main {
    margin-left: max(calc(var(--aside) + 16px), calc((100vw - var(--aside) - var(--ui-col) - 48px) / 2 + var(--aside)));
  }
}

/* ---- The top row: one bar (A1 "Top", "Wide screens"; owner's (4)). A phone: 44 px, Menu with its dot, the chats as
   text tabs, New tab, Profile and Map; Report a problem is in the Menu (fork.css). A wide screen: one 52 px bar,
   the brand, the chats, New tab and Closed tabs, then Menu, Report a problem and Sign out (coach.js arrange() keeps
   the tab strip in the header while the fork serves). A hairline under it, drawn as a shadow so the bar keeps its
   height. ---- */
body[data-fork="1"] > header {
  max-width: none; margin: 0; gap: 0; background: var(--ui-bg); color: var(--ui-ink);
  border: 0; box-shadow: 0 1px 0 var(--ui-line); font-family: var(--ui-font);
}
body[data-fork="1"] > header::before { content: none; }
@media (max-width: 699.98px) {
  body[data-fork="1"] > header { justify-content: flex-start; }
}
@media (min-width: 700px) {
  body[data-fork="1"] > header, body[data-fork="1"].shell-on > header {
    height: calc(52px + env(safe-area-inset-top, 0px)); min-height: 0; align-items: stretch;
    padding: env(safe-area-inset-top, 0px) max(8px, env(safe-area-inset-right, 0px)) 0
      max(20px, env(safe-area-inset-left, 0px));
  }
  body[data-fork="1"] > header > .brand {
    flex: none; flex-direction: row; align-self: center; margin: 0 16px 0 0; color: var(--ui-ink);
    font-size: var(--ui-t-body); font-weight: 700; letter-spacing: -.01em; line-height: 1.2;
  }
  body[data-fork="1"] > header > .header-actions { margin-left: auto; gap: 2px; align-items: center; }
}

/* The chats: text tabs. The current one is bold ink with a 2 px ink bar under it and its x; the others are grey. */
body[data-fork="1"] #chat-tabs {
  flex: 1 1 auto; align-items: stretch; min-width: 0; height: 44px; margin: 0;
  padding: 0; gap: 0; border: 0; background: transparent; box-shadow: none; z-index: auto;
}
body[data-fork="1"] #chat-tab-list { flex: 0 1 auto; gap: 0; margin: 0; }
/* A tab cut by the strip's end fades out (A1: 28 px) rather than stopping mid-letter, at every width (coach.css fades
   only on phones); coach.js sets scrolled-start and scrolled-more from the strip's scroll position. */
body[data-fork="1"] #chat-tab-list.scrolled-more {
  -webkit-mask-image: linear-gradient(to left, transparent, #000 28px); mask-image: linear-gradient(to left, transparent, #000 28px);
}
body[data-fork="1"] #chat-tab-list.scrolled-start {
  -webkit-mask-image: linear-gradient(to right, transparent, #000 28px); mask-image: linear-gradient(to right, transparent, #000 28px);
}
body[data-fork="1"] #chat-tab-list.scrolled-start.scrolled-more {
  -webkit-mask-image: linear-gradient(to right, transparent, #000 28px, #000 calc(100% - 28px), transparent);
  mask-image: linear-gradient(to right, transparent, #000 28px, #000 calc(100% - 28px), transparent);
}
body[data-fork="1"] #chat-tabs .chat-tab {
  flex: 0 0 auto; min-width: 0; max-width: 200px; height: 44px; margin: 0; border: 0; border-radius: 0;
  background: none; box-shadow: none; color: var(--ui-ink-2);
}
body[data-fork="1"] #chat-tabs .chat-tab:not(.is-current)::after { content: none; }
body[data-fork="1"] #chat-tabs .chat-tab .tab-select {
  height: 44px; min-height: 44px; padding: 0 12px; border: 0; border-radius: 0; background: none; color: inherit;
  /* Reserve Close's hit area even before hover/focus reveals it. */
  margin-left: var(--ui-hit);
  font-family: var(--ui-font); font-size: var(--ui-t-sub); font-weight: 400; line-height: 1.2; white-space: nowrap;
}
body[data-fork="1"] #chat-tabs .chat-tab.is-current { color: var(--ui-ink); }
body[data-fork="1"] #chat-tabs .chat-tab.is-current .tab-select { font-weight: 600; }
body[data-fork="1"] #chat-tabs .chat-tab.is-current::after {
  content: ""; position: absolute; left: 12px; right: 12px; bottom: 0; height: 2px; background: var(--ui-ink);
  pointer-events: none;
}
body[data-fork="1"] #chat-tabs .tab-close {
  left: 0; top: 0; width: var(--ui-hit); height: 44px; min-width: 0; padding: 0 4px 0 0; border-radius: 0; background: none;
  color: var(--ui-ink-2); font-size: 16px; line-height: 1;
}
body[data-fork="1"] #chat-tabs .chat-tab.is-dragging { opacity: .45; }
body[data-fork="1"] #chat-tabs .tab-select:focus-visible, body[data-fork="1"] #chat-tabs .tab-close:focus-visible {
  outline: 3px solid var(--ui-accent); outline-offset: -3px; border-radius: var(--ui-r-1);
}
@media (max-width: 699px) {
  /* Inactive phone tabs never reveal Close, so their full row remains selectable. */
  body[data-fork="1"].chat-on #chat-tabs .chat-tab:not(.is-current) .tab-select { margin-left: 0; }
  /* The current tab's separate Close margin already supplies its left spacing. */
  body[data-fork="1"].chat-on #chat-tabs .chat-tab.is-current .tab-select { padding-left: 0; }
}
@media (min-width: 700px) {
  body[data-fork="1"] #chat-tabs { flex: 0 1 auto; height: auto; }
  body[data-fork="1"] #chat-tabs .chat-tab, body[data-fork="1"] #chat-tabs .chat-tab .tab-select { height: 100%; }
  body[data-fork="1"] #chat-tabs .tab-close { height: 100%; }
}

/* The bar's buttons: 44 px icons with a 6 px pressed fill; an open pane (Map, Profile) shows --ui-bg-2 and the
   accent. New tab and Closed tabs sit after the chats; Sign out and Menu (wide) are quiet words. */
body[data-fork="1"] #tab-add, body[data-fork="1"] #chat-tabs .tab-closed, body[data-fork="1"] #report-problem,
body[data-fork="1"] > header .hdr-tab, body[data-fork="1"].chat-on #open-progress, body[data-fork="1"] #menu > summary {
  align-items: center; justify-content: center; flex: none; align-self: center;
  width: var(--ui-hit); min-width: var(--ui-hit); height: var(--ui-hit); min-height: var(--ui-hit); margin: 0;
  padding: 0; border: 0; border-radius: var(--ui-r-2); background: transparent; box-shadow: none;
  color: var(--ui-ink); opacity: 1; font-family: var(--ui-font); font-size: 24px; font-weight: 400; line-height: 1;
  -webkit-tap-highlight-color: transparent;
}
body[data-fork="1"] #tab-add { line-height: var(--ui-hit); text-align: center; }
body[data-fork="1"] #tab-add:active, body[data-fork="1"] #chat-tabs .tab-closed:active,
body[data-fork="1"] #report-problem:active, body[data-fork="1"] > header .hdr-tab:active,
body[data-fork="1"].chat-on #open-progress:active,
body[data-fork="1"] #menu > summary:active { background: var(--ui-bg-3); }
body[data-fork="1"] > header .hdr-tab[aria-expanded="true"],
body[data-fork="1"].chat-on #open-progress[aria-expanded="true"] { background: var(--ui-bg-2); color: var(--ui-accent); }
/* coach.css's dark theme fills the globe while the chat shows (body.chat-on #open-progress, an ID rule) and the
   persona's face button (.persona-hdr); the rules above and this one keep them plain until pressed or open. */
body[data-fork="1"] .persona-hdr { background: transparent; }
body[data-fork="1"] > header .persona-hdr { padding: 0; }
body[data-fork="1"] > header .persona-hdr .persona-face { width: 28px; height: 28px; }
body[data-fork="1"] #menu.menu-unseen > summary::after {
  content: ""; position: absolute; right: 8px; top: 9px; width: 7px; height: 7px; border-radius: 3.5px;
  background: var(--ui-accent);
}
@media (min-width: 700px) {
  body[data-fork="1"] #menu > summary {
    width: auto; padding: 0 10px; gap: 4px; font-size: var(--ui-t-sub); font-weight: 400;
  }
  body[data-fork="1"] #menu.menu-unseen > summary::after { content: none; }
  body[data-fork="1"] .header-actions > #logout {
    min-height: var(--ui-hit); margin: 0; padding: 0 10px; border: 0; border-radius: var(--ui-r-2);
    background: none; color: var(--ui-ink); font-family: var(--ui-font); font-size: var(--ui-t-sub);
    font-weight: 400; white-space: nowrap;
  }
  body[data-fork="1"] .header-actions > #logout:active { background: var(--ui-bg-3); }
}
@media (hover: hover) and (pointer: fine) {
  body[data-fork="1"] #tab-add:hover, body[data-fork="1"] #chat-tabs .tab-closed:hover,
  body[data-fork="1"] #report-problem:hover, body[data-fork="1"] > header .hdr-tab:hover,
  body[data-fork="1"].chat-on #open-progress:hover,
  body[data-fork="1"] #menu > summary:hover, body[data-fork="1"] .header-actions > #logout:hover,
  body[data-fork="1"] #chat-tabs .tab-close:hover { background: var(--ui-bg-2); color: var(--ui-ink); }
  body[data-fork="1"] #chat-tabs .chat-tab:not(.is-current):hover { color: var(--ui-ink); }
}
body[data-fork="1"] #tab-add:focus-visible, body[data-fork="1"] #chat-tabs .tab-closed:focus-visible,
body[data-fork="1"] #report-problem:focus-visible, body[data-fork="1"] > header .hdr-tab:focus-visible,
body[data-fork="1"] #menu > summary:focus-visible, body[data-fork="1"] .header-actions > #logout:focus-visible {
  outline: 3px solid var(--ui-accent); outline-offset: -3px; border-radius: var(--ui-r-1);
}

/* The Menu: a sheet under the bar with square top corners, rows between hairlines with no corners; pressed rows are
   --ui-bg-2. Each row keeps the display coach.css and fork.css give it (hidden rows, Sign out and Report a problem
   are shown or hidden by width there). */
body[data-fork="1"] #menu .pop {
  padding: 0; border: 1px solid var(--ui-line); border-top: 0; border-radius: 0 0 var(--ui-r-3) var(--ui-r-3);
  background: var(--ui-bg); color: var(--ui-ink); box-shadow: var(--ui-shadow); font-family: var(--ui-font);
}
@media (min-width: 700px) {
  body[data-fork="1"] #menu .pop { top: 100%; right: 8px; border-top: 1px solid var(--ui-line); }
}
body[data-fork="1"] #menu .pop a, body[data-fork="1"] #menu .pop button {
  width: 100%; min-height: var(--ui-hit); margin: 0; padding: 10px 16px; border: 0;
  border-bottom: 1px solid var(--ui-line); border-radius: 0; background: none; box-shadow: none;
  color: var(--ui-ink); font-family: var(--ui-font); font-size: var(--ui-t-body); font-weight: 400; line-height: 1.3;
  text-align: left; text-decoration: none;
}
body[data-fork="1"] #menu .pop > :last-child { border-bottom: 0; }
body[data-fork="1"] #menu .pop a:active, body[data-fork="1"] #menu .pop button:active { background: var(--ui-bg-2); }
body[data-fork="1"] #menu .pop small { margin-top: 1px; font-size: var(--ui-t-foot); color: var(--ui-ink-2); }
body[data-fork="1"] #menu .pop .menu-brand { color: var(--ui-ink); font-size: var(--ui-t-body); font-weight: 700; }
body[data-fork="1"] #menu #menu-privacy { margin: 0; color: var(--ui-accent); }
body[data-fork="1"] #menu[open]::before { background: var(--ui-scrim); }
@media (hover: hover) and (pointer: fine) {
  body[data-fork="1"] #menu .pop a:hover, body[data-fork="1"] #menu .pop button:hover {
    background: var(--ui-bg-2); color: var(--ui-ink);
  }
}
body[data-fork="1"] #menu .pop a:focus-visible, body[data-fork="1"] #menu .pop button:focus-visible {
  outline: 3px solid var(--ui-accent); outline-offset: -3px; border-radius: var(--ui-r-1);
}
@media (prefers-color-scheme: dark) {
  body[data-fork="1"] #menu .pop { background: var(--ui-bg-2); }
  body[data-fork="1"] #menu .pop a:active, body[data-fork="1"] #menu .pop button:active { background: var(--ui-bg-3); }
}
