/* Nest layout and shell. Message and tool presentation lives in chat.css, the egg code's cells in
   code.css, the status line in powerline.css, the menu in sidebar.css.

   The look: matt black, no rounded corners anywhere, a border around every
   surface, and the accent used sparingly. */

:root {
  --bg: #0a0a0a;
  --panel: #101010;
  --panel-2: #161616;
  --panel-3: #1c1c1c;
  --hover: #1f1f1f;
  --border: #2c2c2c;
  --border-2: #3d3d3d;
  --border-soft: #1e1e1e;
  --text: #ececec;
  --muted: #9d9d9d;
  --muted-2: #6e6e6e;
  --accent: #d8a53f;
  /* The goal colour: a goal being pursued is not a queued message, so it is not the queue's
     grey or the accent's orange. It is the one purple on the page. */
  --goal: #a97fe0;
  --goal-dim: #4a3a63;
  --pl-model: #d787af;
  --pl-path: #00afaf;
  /* Every figure the chat counts — the window, what was cached, the characters, the tool calls,
     the reasoning, the rates — is this one light blue. It is a kind of figure rather than a
     state, so a colour per figure would be a colour that means nothing. */
  --pl-tokens: #7fb3dd;
  --accent-dim: #7d6122;
  --ok: #57b473;
  --err: #d9574e;
  /* The badge on an egg that gives the agent root, and the fill a system message wears: two
     blues, and the only ones. */
  --admin: #4a7fb5;
  --system: #16263a;
  /* A goal prompt is the nest's own words like the system prompt, so it wears the same shape in
     light purple rather than blue. */
  --system-goal: #2b2140;
  --goal-soft: #cbb4f2;
  /* What somebody said: a plain grey fill, lighter than the page it sits on and nothing else.
     It is the lightest of the panel's greys, which is what makes a message read as a surface
     without anything being drawn round it — the fill is the whole of what marks it out, and one
     grey is the whole of the fill. */
  --user: var(--panel-3);
  --radius: 0;
  --radius-sm: 0;
  /* The system's own monospace, which is what the pages that do not link font.css draw in: the
     front door, and the hatch page a machine on the other end of an egg link opens. Those two are
     not handed a font to download — and they are not handed the one the site serves either, so
     what they look like does not depend on what is installed on the machine reading them. The
     pages behind the login load font.css, which puts the served Fira Code in front of this. */
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
  --ui: var(--mono);
}

* {
  box-sizing: border-box;
}

/* What is selected is the panel's own colour rather than the browser's blue. The selection that
   matters is a name being renamed: the whole of it is selected so that typing replaces it, and the
   browser's blue there is the loudest thing on the row. */
::selection {
  background: var(--accent-dim);
  color: var(--text);
}

html,
body {
  height: 100%;
  margin: 0;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--ui);
  font-size: 1rem;
  line-height: 1.55;
  /* Fira Code's own addition: the arrows, comparisons and pipes that a person reads as one
     shape are drawn as one shape. It is a contextual feature, so it only fires where the
     characters really do sit next to each other, and prose is left alone. */
  font-variant-ligatures: common-ligatures contextual;
  font-feature-settings: "calt" 1, "liga" 1;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior: none;
  overflow-x: hidden;
}

button {
  font: inherit;
  color: inherit;
  cursor: pointer;
}

/* ── app shell ─────────────────────────────────────────────────────────── */

#app {
  display: grid;
  /* The chat list, the second panel when it is open, and the chat. The middle column is the
     panel's own width, so a closed panel — `hidden`, and nothing to draw — leaves no column
     behind it. */
  grid-template-columns: 375px auto 1fr;
  height: 100dvh;
}

#sidebar {
  background: var(--panel);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  min-height: 0;
}

/* The picture at the top of the menu: a farm, 16:9, edge to edge. It is the
   only decoration in the panel and it carries the name the brand text used to.
   It is the owner's own dither, made by hand at its own size (1693x953, 16:9) and
   committed as it is rather than baked, so `cover` fits it to a panel of any
   width — the one dithered picture here that is scaled, which is why it keeps
   image-rendering: pixelated. */
.hero {
  position: relative;
  overflow: hidden;
  flex: 0 0 auto;
  width: 100%;
  aspect-ratio: 16 / 9;
  background-color: var(--panel-2);
  background-image: url("/art/landscape.png");
  background-repeat: no-repeat;
  background-position: top center;
  background-size: cover;
  /* the panel is any width and the picture is 1693px wide, so it is scaled: a
     scaled dither has to stay hard-edged rather than blur back into grey */
  image-rendering: pixelated;
  /* A stacking context of its own, so the figures' depths stop at the picture: a figure
     is drawn at the depth it stands at, and without this those z-indices reach the page
     itself and a wandering chicken is painted over anything with a lower one — the
     darkness of a dialog, for one. */
  isolation: isolate;
  /* no border of its own: the first accordion's top line is the separator */
}

/* The little figures that wander the picture. They are decoration, so they do
   not take a click and do not take focus. The size is written here and in
   avatars.js, and a test holds the two together: it is the size the sprites are
   baked at, because a sprite the browser scales is a blurred one. */
.hero .avatar {
  position: absolute;
  width: 36px;
  height: 36px;
  pointer-events: none;
  user-select: none;
  /* Scaling happens about the feet, so a stretched figure grows upwards from
     where it stands and a flattened one squashes onto the ground instead of
     sinking through it. Facing left is the same scale mirrored. */
  transform-origin: 50% 100%;
  /* a soft shadow so a pale figure stays readable over a pale field */
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.55));
}

/* The shadow a figure casts on the ground. It is drawn where the figure's feet
   are — not where the figure is — so it stays put while the figure jumps, and the
   client shrinks and fades it as the figure rises. The size is written here and
   in avatars.js, and TestTheAvatarShadowIsTheSizeItIsDrawn holds the two
   together.

   It is also the one round thing in the panel: the no-rounded-corners rule is
   about surfaces and borders, and a shadow with corners is a rectangle. */
.hero .avatar-shadow {
  position: absolute;
  width: 27px;
  height: 9px;
  z-index: 0;
  border-radius: 50%;
  background: #000;
  /* Darkest on the ground; the client writes the opacity it wants from there. */
  opacity: 0.55;
  pointer-events: none;
}

/* The connection has been gone for longer than a reconnect takes. Everything
   behind this is unreachable, so it is covered rather than left half-working —
   and the tint is the news: red, and faint enough to read a line of text over. */
#offline {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: grid;
  place-items: center;
  background: rgba(150, 32, 34, 0.22);
}

/* The one place the panel does explain itself, because for those seconds there
   is nothing else it can say and nothing else that works. Red words on the tint
   and nothing else: no box around them, so the sentence reads as a state the
   whole screen is in rather than as a dialog waiting to be dismissed. */
#offline p {
  margin: 0;
  color: var(--err);
  font-size: 18pt;
}

/* A display value beats the hidden attribute, so hiding has to be said out loud. */
#offline[hidden] {
  display: none;
}

/* The one word a copy gets. It floats in the strip the composer keeps clear under itself — the
   block's own margin is fifty pixels — so it covers nothing that is being read or typed, and it
   is never pointed at, so it can never take a press away from the page. */
.toast {
  position: fixed;
  left: 50%;
  bottom: 8px;
  z-index: 30;
  padding: 6px 14px;
  border: 1px solid var(--border-2);
  background: var(--panel-3);
  color: var(--text);
  font-size: 1rem;
  opacity: 0;
  transform: translate(-50%, 8px);
  pointer-events: none;
  transition: opacity 160ms ease, transform 160ms ease;
}

.toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

/* ── main column ───────────────────────────────────────────────────────── */

#main {
  position: relative;
  display: grid;
  /* The header, and then one area the transcript and the composer share: the transcript scrolls
     in it and the composer sits at its foot, so the scrollbar runs the whole column rather than
     stopping where the composer begins. */
  grid-template-rows: auto minmax(0, 1fr);
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  background: var(--bg);
}

#topbar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px clamp(12px, 4vw, 28px);
  border-bottom: 1px solid var(--border);
  background: var(--panel);
}


.title-block {
  min-width: 0;
  flex: 1;
}

#chat-title {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 620;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* A name that is not the chat's last one: the model names a chat after the first answer and
   again after the second, and the italics say which of the two this is. */
#chat-title.provisional {
  font-style: italic;
}

.sub {
  color: var(--muted-2);
  font-size: 1rem;
  font-family: var(--mono);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chips {
  display: flex;
  gap: 8px;
  align-items: center;
  min-width: 0;
}

.chip {
  border: 1px solid var(--border);
  background: var(--panel-2);
  color: var(--muted);
  padding: 3px 9px;
  font-size: 1rem;
  font-family: var(--mono);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 34vw;
}

/* The model selector is a button in the topbar — the same border, the same fill and the same
   hover as the ones in the composer — and it is a ghost: it wears none of that until it is
   pointed at or being used, because what is read in that corner of the topbar is the model's
   name rather than a control. The border is painted with nothing rather than left off, so the
   box is the same box in both states and the row does not move when the edge appears.

   A select has no state in CSS for its list being down, and while its list is down it has the
   focus, which is what the second and third selectors are for. Fifty pixels tall: it is a
   control of the page's own size and it sits in a row of them.

   The name is flush with the right edge of the row. A select is as wide as its longest option,
   so a chat on a model with a short name would sit against the left of that width and leave the
   gap between the name and the edge of the page — the name would read as a label in the middle
   of the corner rather than as the corner itself. */
#model-select {
  appearance: none;
  -webkit-appearance: none;
  cursor: pointer;
  height: 50px;
  padding: 0 12px;
  text-align: right;
  border: 1px solid transparent;
  background: transparent;
  color: var(--muted);
  transition: background 120ms ease, border-color 120ms ease, color 120ms ease;
}

#model-select:hover,
#model-select:focus-visible,
#model-select:active {
  border-color: var(--accent-dim);
  background: var(--hover);
  color: var(--text);
}

/* ── messages ──────────────────────────────────────────────────────────── */

.messages {
  grid-area: 2 / 1;
  overflow-y: auto;
  /* The room the composer takes is kept clear at the bottom, so the last thing said is not behind
     it. The value is measured from the composer itself — it grows with the tall box and with what
     is waiting — and the fallback is the ordinary bottom gap before the first measurement. */
  padding: 26px clamp(12px, 5vw, 44px) var(--composer-space, 18px);
  scroll-behavior: smooth;
  min-height: 0;
}

.messages > * {
  width: 100%;
  max-width: 860px;
  margin: 0 auto 18px;
}

.msg.user {
  display: flex;
  justify-content: flex-end;
}

/* A message is the width of the transcript rather than a chip at its right edge, and nothing is
   drawn round it: no border, no accent down the side. The fill is the whole of what marks it
   out, and the system prompt wears the same shape in blue. */
.msg.user .bubble,
.msg.system .bubble,
.msg.goal .bubble {
  padding: 10px 14px;
  width: 100%;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.msg.user .bubble {
  background-color: var(--user);
}

.msg.system .bubble {
  background: var(--system);
  color: var(--text);
}

/* A goal prompt: the same bubble as the system prompt, in light purple, and with nothing drawn
   round it either — the fill is the whole of what marks a message out, and what tells a goal
   prompt from the system prompt is the colour it is filled with and where it sits, not an edge
   down one side. */
.msg.goal .bubble {
  background: var(--system-goal);
  color: var(--goal-soft);
}

/* The answer is not inset: it begins where the transcript's own content box begins, so an answer
   and the bubble above it start at the same edge — the padding that used to hold it in from that
   edge put the words of an answer fourteen pixels right of the words of the question they answer.
   Nothing is painted behind it either: the fill is what marks a message out, and an answer is not
   something anybody sent. */
.msg.assistant {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 0;
}

/* ── the queue ─────────────────────────────────────────────────────────── */

/* What is waiting to go, between the status line and the box it was typed in: one row each, oldest
   first, which is the order it will go in. A row is a surface like any other — a border and a fill
   — and it is the one thing in the row that answers the mouse: pointed at it goes back into the
   box, dragged it moves in the order. */
.queue {
  display: flex;
  flex-direction: column;
  gap: 4px;
  width: 100%;
  max-width: 860px;
  margin: 0 auto;
}

/* A queue with nothing in it takes no room at all, so the line above the box keeps its place. */
.queue[hidden] {
  display: none;
}

.queue-item {
  display: flex;
  align-items: baseline;
  gap: 9px;
  padding: 5px 10px;
  border: 1px solid var(--border-2);
  background: var(--panel-2);
  cursor: pointer;
}

.queue-item:hover {
  background: var(--hover);
}

.queue-kind {
  flex: 0 0 auto;
  letter-spacing: 0.4px;
  text-transform: uppercase;
  color: var(--muted-2);
}

.queue-item.steer .queue-kind {
  color: var(--text);
}

.queue-text {
  flex: 1 1 auto;
  min-width: 0;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ── goals ─────────────────────────────────────────────────────────────── */

/* The objective being pursued and the ones behind it, under the queue and above the box. A goal
   row is a queue row in the goal colour: clicking it takes it back into the box, which for the
   active goal is also what stops the chat pursuing it. */
.goals {
  display: flex;
  flex-direction: column;
  gap: 4px;
  width: 100%;
  max-width: 860px;
  margin: 0 auto;
}

.goals[hidden] {
  display: none;
}

.goal-row {
  display: flex;
  align-items: baseline;
  gap: 9px;
  padding: 5px 10px;
  border: 1px solid var(--goal-dim);
  background: color-mix(in srgb, var(--goal) 9%, var(--panel-2));
  cursor: pointer;
}

.goal-row:hover {
  border-color: var(--goal);
  background: color-mix(in srgb, var(--goal) 16%, var(--panel-2));
}

.goal-kind {
  flex: 0 0 auto;
  letter-spacing: 0.4px;
  text-transform: uppercase;
  color: var(--goal);
}

.goal-row.queued .goal-kind {
  color: var(--muted-2);
}

.goal-text {
  flex: 1 1 auto;
  min-width: 0;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ── composer ──────────────────────────────────────────────────────────── */

/* The message block is the last row of the page and the one surface in it: the box is the same
   colour as the transcript behind it and the row draws no line of its own. Its height is fixed
   rather than grown by its content — 80 pixels for one line, 100 once there is more to say, and
   the words scroll after that — because a composer that eats the transcript is worse than one
   that scrolls, and a block whose height changed with every keystroke would move the last answer
   up and down the screen. */
#composer {
  /* The jump button is inside this row and positioned against it, so its thirty pixels above the
     block are thirty whatever height the block is. The row shares the transcript's cell and sits
     at the foot of it, so the transcript scrolls behind the composer rather than above it. */
  position: relative;
  grid-area: 2 / 1;
  align-self: end;
  z-index: 1;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 10px clamp(12px, 5vw, 44px) 0;
  /* The floor the row stands on: room under the block, so the last thing on the page is not
     jammed against the edge. It is padding rather than a margin because the fill below has to
     reach the bottom of the page rather than stop short of it. */
  padding-bottom: 50px;
  /* And the fill is the page's own colour, because the transcript scrolls behind this row: a
     transparent foot is a foot the words show through, and they would be read as part of the
     page rather than as the thing the box is standing on. The colour is the one behind the
     transcript, so the only edge is the box's. */
  background: var(--bg);
  /* But not over the scrollbar. The transcript's scrollbar is at the right edge of the column
     and it has to run the whole page, so the fill stops short of it by the width the browser
     gives the scrollbar — measured on the element, because that width is not a number CSS
     knows. Where the browser gives it no width, there is nothing to keep clear. */
  margin-right: var(--scrollbar-space, 0px);
  /* The fill takes no press: the scrollbar stays reachable through what is left of the row, the
     parts that are pressed take the pointer back, and a press on the bare fill reads as a press
     on the transcript underneath. */
  pointer-events: none;
}

#composer > * {
  pointer-events: auto;
}

/* The block has no padding: the words are given a margin and the button is told nothing at all,
   so the button can be flush with the block's own edge and as tall as the block is. */
.composer-box {
  position: relative;
  display: flex;
  align-items: stretch;
  width: 100%;
  max-width: 860px;
  height: 80px;
  margin: 0 auto;
  background: var(--panel-2);
  border: 1px solid var(--border);
  padding: 0;
  transition: border-color 120ms ease;
}

/* The one other size it has: a second line of text, and one more after that is a scrollbar. */
.composer-box.tall {
  height: 100px;
}

.composer-box.tall #input {
  height: 3em;
}

.composer-box:focus-within {
  border-color: var(--accent-dim);
}

/* The column the words live in, with the margin the block does not have. It is where the text
   starts, at the top of the block rather than centred in it, so that what is typed grows
   downwards and the first line stays where the first line was — which is what the alignment at
   the start is for, and what the field's own height is for: one line while the block is short,
   two while it is tall, and its own scrollbar after that. The two heights are what makes "a
   second line" a thing the block can be told about: the field is as tall as the words it is
   showing, so measuring it is asking whether there is more to say than there is room for. */
.composer-text {
  display: flex;
  align-items: flex-start;
  flex: 1 1 auto;
  min-width: 0;
  margin: 12px 14px;
}

#input {
  flex: 1 1 auto;
  width: 100%;
  height: 1.5em;
  resize: none;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text);
  font: inherit;
  line-height: 1.5;
  padding: 0;
  overflow-y: auto;
}

#input::placeholder {
  color: var(--muted-2);
}

#input:disabled {
  opacity: 0.5;
}

/* The buttons at the end of the block. The wrapper is a group and not a box of its own: a
   wrapper that is a flex item in its own right sizes itself from what is in it, and what is in
   it is a picture and a fixed width — which is a width a shrink-wrapping parent cannot work
   out, so the button came out 39 pixels past the edge of the block it was supposed to fill. */
.composer-actions {
  display: contents;
}

.btn {
  padding: 8px 14px;
  border: 1px solid var(--border-2);
  background: var(--panel-3);
  transition: background 120ms ease, border-color 120ms ease, opacity 120ms ease;
  white-space: nowrap;
}

.btn:hover:not(:disabled) {
  background: var(--hover);
  border-color: var(--accent-dim);
}

.btn.send {
  background: var(--accent);
  border-color: var(--accent);
  color: #1a1403;
  font-weight: 600;
}

.btn.send:hover:not(:disabled) {
  background: #e6b755;
  border-color: #e6b755;
}

.btn.send:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* The way to send a message is a picture at the end of the block: a paper plane, as wide as the
   golden ratio of one line of the box — the width it has always had, kept — and as tall as the
   block, so the slab and the box are one edge rather than a chip inside one. The width is
   written out rather than asked for by stretching, because `aspect-ratio` needs a definite
   height to give a width from and the height a stretch would give it is only known after the row
   has been measured: asked for that way, the button came out the width of its own picture. It
   sits at the end of the row, with no margin, so what is under it is the block's border. One of
   the two is always there and never both: while the nest is answering, Stop takes Send's place —
   a message typed in that moment waits in the box (Enter steers it, Ctrl+Q makes it a follow-up,
   and both are on the box's own menu), and the button beside it is not one of the ways to send.

   Stopping is the same slab: same width, same height, same centring, so that the two are the same
   button and the row does not jump under the hand that pressed it. */
#send,
#stop {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  align-self: stretch;
  width: calc((1.5rem + 12px) * 1.618);
  padding: 0;
  margin: 0;
  border: 0;
}

/* A display of its own paints over the attribute, so hiding either button has to be said out
   loud. Both buttons are in this rule because both of them are hidden at some point: Send while
   an answer is arriving, Stop while there is nothing to stop. */
#send[hidden],
#stop[hidden] {
  display: none;
}

/* Red throughout: the whole slab, rather than red words on a grey button. It is the one colour in
   the palette that means stop, and it means it at a glance. There is no border to colour — the
   slab has none, like the one it replaces — and the mark on it is the same near-black the plane
   is drawn in. */
.btn.stop {
  background: var(--err);
  color: #1a1403;
}

.btn.stop:hover:not(:disabled) {
  background: #e2645b;
}

/* A button that ends something: removing an account, removing an endpoint. The colour is the
   only thing that says so, because the word on it already does. */
.danger {
  color: var(--err);
  border-color: rgba(217, 87, 78, 0.45);
}

/* The field everything is typed into: the front door's two boxes, the hatch page's code, and
   every field on the settings page. It is a stack rather than a set of boxes — one border
   between two of them, and the last one carries the bottom of the stack — which is why the
   bottom border is nothing here and something on the element below it. */
.gate-input {
  display: block;
  width: 100%;
  padding: 8px 9px;
  border: 1px solid var(--border);
  border-bottom: 0;
  background: var(--panel-2);
  color: var(--text);
  font: inherit;
  font-size: 1rem;
}

.gate-input:focus {
  outline: none;
  border-color: var(--accent-dim);
}

/* ── overlay / mobile ──────────────────────────────────────────────────── */

#overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  z-index: 19;
}

@media (max-width: 760px) {
  #app {
    grid-template-columns: 1fr;
  }

  #sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: min(84vw, 420px);
    transform: translateX(-102%);
    transition: transform 200ms ease;
    z-index: 20;
  }

  body.sidebar-open #sidebar {
    transform: translateX(0);
  }

  body.sidebar-open #overlay {
    display: block;
  }

  /* The same dark behind the second panel, which comes up when the body says that one is open
     rather than because the chat list is: two surfaces over one page, one black. */
  body.panel-open #overlay {
    display: block;
  }

  .messages {
    padding-top: 18px;
  }
}

@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.001ms !important;
    transition-duration: 0.001ms !important;
  }

  .messages {
    scroll-behavior: auto;
  }
}

/* scrollbars: a filled track with a rounded thumb, the way the page this was taken from
   does it. The track is the surface the scroll is over and the thumb is the border colour
   every surface is drawn with, so a scrollbar reads as part of the frame rather than as
   chrome — and the pointer lights the thumb to the muted text colour, because on a black
   track a thumb has nowhere darker to go and only lighter is visible. The scrollbars the
   sidebar and the transcript use are these; nothing sets one of its own.

   Firefox takes scrollbar-width/scrollbar-color, and Chromium ignores every
   ::-webkit-scrollbar rule the moment scrollbar-color is set — so the colours are handed
   to Firefox only, inside an at-rule Chrome does not read, and Chromium is left styling
   the scrollbar with the pseudo-elements below. */
@-moz-document url-prefix() {
  * {
    scrollbar-width: auto;
    scrollbar-color: var(--border-2) var(--panel);
  }

  /* The one scroll that is not over the page: the system prompt scrolls inside its own blue
     bubble, so its scrollbar is the bubble's colours rather than the frame's. */
  .system-prompt .system-body {
    scrollbar-color: var(--admin) var(--system);
  }

  /* And a goal prompt's scroll is the two purples, for the same reason and with the same extra
     class as the pseudo-elements below: inside a goal block it is this one that shows. */
  .msg.goal .system-prompt .system-body {
    scrollbar-color: var(--goal) var(--system-goal);
  }
}

*::-webkit-scrollbar {
  width: 9px;
  height: 9px;
  background-color: var(--panel);
}

*::-webkit-scrollbar-thumb {
  background-color: var(--border-2);
  border-radius: 8px;
  min-height: 40px;
  transition: background-color 0.15s;
}

*::-webkit-scrollbar-thumb:hover {
  background-color: var(--muted-2);
}

*::-webkit-scrollbar-track,
*::-webkit-scrollbar-corner {
  background-color: var(--panel);
}

/* One scroll in the app is not over the page: the system prompt's body scrolls inside the blue
   bubble, and a black bar laid in the middle of a blue panel is a seam. Same shape, the panel's
   own colours — the track is the blue the bubble is, so the scrollbar reads as part of the
   bubble rather than as something sitting on it, and the thumb is `--admin`, which is the one
   other blue there is and the only one lighter than the surface it has to show against. Under
   the pointer it goes to the light blue the figures wear, because the muted grey the others go
   to is not a colour this panel has.

   The three track pseudo-elements are named one by one rather than as the bar alone: the rules
   above are the ones that paint them, and a rule that only set the bar would leave the track
   black underneath it. */
.system-prompt .system-body::-webkit-scrollbar,
.system-prompt .system-body::-webkit-scrollbar-track,
.system-prompt .system-body::-webkit-scrollbar-corner {
  background-color: var(--system);
}

.system-prompt .system-body::-webkit-scrollbar-thumb {
  background-color: var(--admin);
}

.system-prompt .system-body::-webkit-scrollbar-thumb:hover {
  background-color: var(--pl-tokens);
}

/* And the other scroll that sits on its own colour: a goal prompt scrolls inside a purple bubble,
   so its scroll comes in the two purples — the same shape as the blue one, in the goal's colours.
   The selectors are one class longer than the blue rules above, which is what makes the purple
   the one that shows inside a goal block rather than two rules of the same weight fighting over
   the order they were written in. The thumb is `--goal`, the lighter of the two purples, and it
   goes lighter still under the pointer for the same reason the blue one does: the muted grey the
   page's scrollbars light up to is not a colour this panel is made of. */
.msg.goal .system-prompt .system-body::-webkit-scrollbar,
.msg.goal .system-prompt .system-body::-webkit-scrollbar-track,
.msg.goal .system-prompt .system-body::-webkit-scrollbar-corner {
  background-color: var(--system-goal);
}

.msg.goal .system-prompt .system-body::-webkit-scrollbar-thumb {
  background-color: var(--goal);
}

.msg.goal .system-prompt .system-body::-webkit-scrollbar-thumb:hover {
  background-color: var(--goal-soft);
}
