:root {
  color-scheme: light;
  --ivory: #f4eee6;
  --ivory-deep: #efe4d6;
  --peach: #f4d9c8;
  --lavender: #d7cce8;
  --lavender-deep: #b9a6d6;
  --gold: #dfc089;
  --gold-bright: #f0d7a8;
  --teal: #9dc4bf;
  --ink: #2b261f;
  --muted: #7a7268;
  --user: rgba(214, 201, 232, 0.72);
  --assistant: rgba(255, 252, 247, 0.94);
  --error: #9d2f2f;
  --error-bg: #fff0ef;
  --text: var(--ink);
  --surface: #fffaf4;
  --border: rgba(90, 72, 58, 0.1);
  --accent: #8f6fbe;
  --display: "Cormorant Garamond", Palatino, Georgia, serif;
  --sans: Outfit, "Segoe UI", sans-serif;
  font-family: var(--sans);
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100dvh;
  margin: 0;
  color: var(--ink);
  background: var(--ivory);
}

/*
 * The document is what scrolls here (.app-shell grows past the viewport), so
 * its scrollbar appears only once the conversation has content. Without a
 * reserved gutter that arrival narrows the centring box by 15px and drags the
 * whole centred column 7.5px left. Reserving both edges keeps the column on
 * the window axis whether the bar is there or not; it is a no-op wherever
 * scrollbars overlay.
 */
html {
  scrollbar-gutter: stable both-edges;
}

body {
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  background:
    radial-gradient(58% 42% at 8% 12%, rgba(240, 215, 168, 0.38), transparent 64%),
    radial-gradient(52% 38% at 94% 8%, rgba(186, 160, 220, 0.3), transparent 60%),
    radial-gradient(70% 40% at 86% 100%, rgba(196, 178, 226, 0.18), transparent 56%),
    radial-gradient(48% 30% at 18% 92%, rgba(244, 217, 200, 0.22), transparent 52%),
    var(--ivory);
}

html[data-bium-atmosphere="finding"] body,
html[data-bium-atmosphere="map"] body {
  background:
    radial-gradient(60% 44% at 6% 16%, rgba(240, 215, 168, 0.46), transparent 62%),
    radial-gradient(54% 40% at 96% 6%, rgba(186, 160, 220, 0.36), transparent 58%),
    radial-gradient(64% 34% at 78% 100%, rgba(157, 196, 191, 0.12), transparent 52%),
    var(--ivory);
}

button,
textarea,
select {
  font: inherit;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
}

.app-wisp {
  position: fixed;
  pointer-events: none;
  filter: blur(36px);
  opacity: 0.64;
  animation: wisp-breathe 10s ease-in-out infinite;
}

.app-wisp.is-gold {
  top: 6%;
  left: -8%;
  width: 58%;
  height: 34%;
  background: radial-gradient(circle, rgba(240, 215, 168, 0.5), transparent 72%);
}

.app-wisp.is-lavender {
  top: -4%;
  right: -12%;
  width: 62%;
  height: 40%;
  animation-delay: -4.5s;
  background: radial-gradient(circle, rgba(186, 160, 220, 0.36), transparent 70%);
}

.app-glow {
  position: fixed;
  inset: 18% 10% auto 10%;
  height: 34%;
  pointer-events: none;
  background: radial-gradient(ellipse at center, rgba(240, 215, 168, 0.16), transparent 68%);
  opacity: 0;
  transition: opacity 700ms ease;
}

html[data-bium-atmosphere="finding"] .app-glow,
html[data-bium-atmosphere="map"] .app-glow {
  opacity: 1;
}

html.is-awakening .app-glow {
  animation: glow-wave 1.4s ease;
}

.app-shell {
  display: flex;
  flex-direction: column;
  width: min(430px, 100%);
  min-height: 100dvh;
  margin: 0 auto;
  /* The shell ended flush against the bottom of the screen. That was livable
   * while the last thing in it was a footnote; with the session actions down
   * there too it put a live control against the edge, under the phone chrome. */
  padding: 14px 20px calc(18px + env(safe-area-inset-bottom, 0px));
}

/* Two columns since the tagline between them went: the mark on the left, the
 * safety badge held to the right edge. Three columns with the middle one empty
 * would have dropped the badge into the gap where the tagline used to be. */
.app-header {
  display: grid;
  grid-template-columns: minmax(72px, auto) minmax(0, 1fr);
  align-items: start;
  gap: 10px;
  margin-bottom: 10px;
}

/* Sized to the mark, because the mark is now the only thing in here. It is
 * absolutely positioned and centred on this box, and the wordmark used to be
 * what gave the box its width -- with max-content and no wordmark the box
 * collapsed to nothing and the mark hung off the left edge of the page. */
.brand {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 68px;
  justify-self: start;
}

.brand-mark {
  position: relative;
  width: 100%;
  height: 22px;
}

.bium-mark {
  position: absolute;
  left: 50%;
  top: 0;
  width: 68px;
  height: 22px;
  overflow: visible;
  transform: translateX(-50%);
}

.bium-mark-point {
  fill: #d7b87a;
  filter: drop-shadow(0 0 3px rgba(223, 192, 137, 0.4));
  transform-box: fill-box;
  transform-origin: center;
  opacity: 0.78;
}

.bium-mark-link {
  fill: none;
  stroke: url(#bium-link-grad);
  stroke-width: 1.35;
  stroke-linecap: round;
  stroke-dasharray: 1;
  stroke-dashoffset: 1;
  opacity: 0;
}

.bium-mark-full {
  fill: none;
  stroke: none;
}

html[data-bium-ceremony="travel-a"] .bium-mark-link.is-a,
html[data-bium-ceremony="lit-2"] .bium-mark-link.is-a,
html[data-bium-ceremony="draw-b"] .bium-mark-link.is-a,
html[data-bium-ceremony="travel-b"] .bium-mark-link.is-a,
html[data-bium-ceremony="complete"] .bium-mark-link.is-a,
html[data-bium-ceremony="finale"] .bium-mark-link.is-a,
html[data-bium-ceremony="settled"] .bium-mark-link.is-a,
html[data-bium-mark="1"] .bium-mark-link.is-a,
html[data-bium-mark="2"] .bium-mark-link.is-a,
html[data-bium-mark="2"] .bium-mark-link.is-b,
html[data-bium-ceremony="travel-b"] .bium-mark-link.is-b,
html[data-bium-ceremony="complete"] .bium-mark-link.is-b,
html[data-bium-ceremony="finale"] .bium-mark-link.is-b,
html[data-bium-ceremony="settled"] .bium-mark-link.is-b {
  stroke-dashoffset: 0;
  opacity: 0.95;
}

html[data-bium-ceremony="draw-a"] .bium-mark-link.is-a,
html[data-bium-ceremony="draw-b"] .bium-mark-link.is-b {
  opacity: 1;
  stroke-width: 2.15;
  filter: drop-shadow(0 0 3px rgba(240, 215, 168, 1));
}

html[data-bium-restore="1"] .bium-mark-link,
html[data-bium-motion="reduce"] .bium-mark-link {
  transition: none;
}

html[data-bium-ceremony="lit-1"] .bium-mark-point.is-1,
html[data-bium-ceremony="draw-a"] .bium-mark-point.is-1,
html[data-bium-ceremony="travel-a"] .bium-mark-point.is-1,
html[data-bium-ceremony="lit-2"] .bium-mark-point.is-1,
html[data-bium-ceremony="draw-b"] .bium-mark-point.is-1,
html[data-bium-ceremony="travel-b"] .bium-mark-point.is-1,
html[data-bium-ceremony="complete"] .bium-mark-point.is-1,
html[data-bium-ceremony="finale"] .bium-mark-point.is-1,
html[data-bium-ceremony="settled"] .bium-mark-point.is-1,
html[data-bium-mark="1"] .bium-mark-point.is-1,
html[data-bium-mark="2"] .bium-mark-point.is-1 {
  fill: #f3e2bc;
  opacity: 1;
}

html[data-bium-ceremony="lit-1"] .bium-mark-point.is-1 {
  animation: point-lit 420ms ease 1 both;
}

html[data-bium-ceremony="lit-2"] .bium-mark-point.is-2,
html[data-bium-ceremony="draw-b"] .bium-mark-point.is-2,
html[data-bium-ceremony="travel-b"] .bium-mark-point.is-2,
html[data-bium-ceremony="complete"] .bium-mark-point.is-2,
html[data-bium-ceremony="finale"] .bium-mark-point.is-2,
html[data-bium-ceremony="settled"] .bium-mark-point.is-2,
html[data-bium-mark="1"] .bium-mark-point.is-2,
html[data-bium-mark="2"] .bium-mark-point.is-2 {
  fill: #c4b7de;
  opacity: 1;
}

html[data-bium-ceremony="lit-2"] .bium-mark-point.is-2 {
  animation: point-lit 380ms ease 1 both;
}

html[data-bium-ceremony="complete"] .bium-mark-point.is-3,
html[data-bium-ceremony="finale"] .bium-mark-point.is-3,
html[data-bium-ceremony="settled"] .bium-mark-point.is-3,
html[data-bium-mark="2"] .bium-mark-point.is-3 {
  fill: #9db8b3;
  opacity: 1;
}

html[data-bium-ceremony="complete"] .bium-mark-point.is-3 {
  animation: point-lit 380ms ease 1 both;
}

html[data-bium-ceremony="lit-1"] .bium-mark-point.is-1,
html[data-bium-ceremony="lit-2"] .bium-mark-point.is-2,
html[data-bium-ceremony="complete"] .bium-mark-point.is-3,
html[data-bium-mark="1"] .bium-mark-point.is-1,
html[data-bium-mark="1"] .bium-mark-point.is-2,
html[data-bium-mark="2"] .bium-mark-point {
  filter: drop-shadow(0 0 6px rgba(240, 215, 168, 0.85));
}

.bium-traveler {
  display: none;
  pointer-events: none;
}

.bium-traveler.is-active {
  display: inline;
}

.bium-traveler-core {
  fill: #fff8ea;
  filter: drop-shadow(0 0 2.2px rgba(255, 248, 234, 1)) drop-shadow(0 0 5px rgba(240, 215, 168, 0.85));
}

.bium-traveler-halo {
  fill: rgba(240, 215, 168, 0.55);
  filter: url(#bium-halo);
}

.bium-traveler-tail {
  fill: rgba(255, 248, 234, 0.5);
}

.bium-light {
  position: absolute;
  top: 0;
  left: 0;
  z-index: 4;
  width: 11px;
  height: 11px;
  margin: -5.5px 0 0 -5.5px;
  border-radius: 50%;
  background: #fff8ea;
  box-shadow:
    0 0 7px 2px rgba(255, 248, 234, 0.95),
    0 0 14px 5px rgba(240, 215, 168, 0.8);
  opacity: 0;
  pointer-events: none;
}

.bium-light.is-on {
  opacity: 1;
}

.bium-light::after {
  position: absolute;
  top: 50%;
  left: -8px;
  width: 9px;
  height: 3px;
  margin-top: -1.5px;
  border-radius: 99px;
  background: linear-gradient(90deg, transparent, rgba(255, 248, 234, 0.8));
  content: "";
}

html[data-bium-restore="1"] .bium-light,
html[data-bium-motion="reduce"] .bium-light,
html[data-bium-ceremony="settled"] .bium-light {
  display: none;
}

/* The wordmark and tagline rules were removed with the elements they styled.
 * Nothing else on any page used them: h1 appeared once, and it was the name. */
.safe-badge {
  display: flex;
  align-items: center;
  justify-self: end;
  gap: 5px;
  margin-top: 10px;
  color: #8a8176;
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.03em;
}

.safe-badge svg {
  width: 15px;
  height: 15px;
  fill: currentColor;
}

.header-actions {
  display: flex;
  flex-shrink: 0;
  gap: 4px;
}

.button {
  min-height: 36px;
  padding: 7px 12px;
  border: 0;
  border-radius: 999px;
  font-weight: 500;
  cursor: pointer;
  background: transparent;
}

.button:disabled {
  cursor: wait;
  opacity: 0.6;
}

.button.ghost {
  color: var(--muted);
  font-size: 0.78rem;
  letter-spacing: 0.04em;
}

.button.secondary {
  color: var(--ink);
  background: rgba(255, 250, 244, 0.7);
}

.lab-drawer {
  margin: 6px 0 0;
  /*
   * This is the bottom of the whole app: the shell has no bottom padding and
   * the composer is pushed down by `margin-top: auto`, so raising this lifts
   * the composer and Session Tools together. The safe-area term keeps the
   * same visual breathing above a home indicator.
   */
  padding-bottom: max(140px, calc(env(safe-area-inset-bottom) + 124px));
  color: rgba(122, 114, 104, 0.48);
  font-size: 0.68rem;
}

.lab-drawer[open] {
  margin: 8px 0 0;
  padding: 4px 0 max(28px, calc(env(safe-area-inset-bottom) + 16px));
}

.lab-drawer .header-actions {
  margin: 8px 0;
}

.lab-drawer summary {
  cursor: pointer;
  padding: 6px 0 2px;
  letter-spacing: 0.1em;
  text-align: center;
  text-transform: uppercase;
}

.status-panel,
.smoke-panel {
  margin-top: 8px;
  padding: 10px 0 0;
}

.status-panel dl {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px 12px;
  margin: 0;
}

.status-panel dt {
  margin-bottom: 2px;
  font-size: 0.68rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.status-panel dd {
  margin: 0;
  overflow-wrap: anywhere;
  color: var(--ink);
  font-size: 0.8rem;
}

.api-status.missing,
.safety-route.routed {
  color: #8a4c18;
}

.safety-route {
  margin: 8px 0 0;
  font-size: 0.72rem;
}

.smoke-controls {
  display: grid;
  gap: 8px;
}

.smoke-controls label {
  display: grid;
  gap: 4px;
}

select {
  width: 100%;
  min-height: 40px;
  padding: 8px 10px;
  color: var(--ink);
  border: 0;
  border-radius: 12px;
  background: rgba(255, 250, 244, 0.8);
}

.error-panel {
  margin-bottom: 8px;
  padding: 10px 12px;
  color: var(--error);
  border-radius: 14px;
  background: var(--error-bg);
}

.conversation {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  min-height: 0;
  overflow: auto;
  padding: 8px 0 16px;
}

.transcript {
  flex: 0 0 auto;
  min-height: 0;
  padding: 6px 2px 8px;
}

.empty-state {
  display: grid;
  min-height: 140px;
  place-content: center;
  color: var(--muted);
  text-align: center;
}

/*
 * Before anything has been said, the question and the box for the answer sit
 * together just past the middle of the screen.
 *
 * The shell is a column that fills the viewport and the composer is held to
 * the bottom of it by `margin-top: auto`, which is right the moment there is
 * a conversation above it and wrong before there is one: it puts the question
 * at the top of the screen and the only thing to do about it a thumb's reach
 * away at the very bottom, with nothing in between.
 *
 * So while the transcript is still holding its empty state, the flexible space
 * moves from above the composer to below it. The empty state takes a share of
 * the viewport rather than a fixed 140px, which is what puts the pair a little
 * below centre rather than at the top, and the note at the foot keeps the
 * bottom of the shell.
 *
 * All of it hangs off `:has()`, so a browser without it simply gets today's
 * layout -- the question at the top, the composer at the bottom -- which is a
 * worse first screen and not a broken one. Nothing here applies once a message
 * exists, because the empty state is gone by then.
 */
.app-shell:has(.empty-state) .conversation {
  flex: 0 0 auto;
  overflow: visible;
}

.app-shell:has(.empty-state) .empty-state {
  min-height: 42dvh;
}

.app-shell:has(.empty-state) .composer {
  position: static;
  margin-top: 0;
}

/* The foot takes the slack the composer gave up. */
.app-shell:has(.empty-state) .app-note {
  margin-top: auto;
}

.empty-state p {
  margin: 0 0 6px;
  color: var(--ink);
  font-family: var(--display);
  font-size: 1.45rem;
}

/*
 * The onboarding line, when there is one. Sits under the existing two and
 * reads as guidance rather than as part of the greeting. Styled now so that
 * writing the sentence is only writing the sentence.
 */
.empty-guide {
  display: block;
  max-width: 30ch;
  margin: 14px auto 0;
  font-size: 0.92rem;
  line-height: 1.5;
  opacity: 0.85;
  text-wrap: balance;
}

.message {
  display: grid;
  align-items: start;
  max-width: 92%;
  margin-bottom: 18px;
  gap: 8px;
}

.message.user {
  grid-template-columns: minmax(0, 1fr) auto;
  margin-left: auto;
}

.message.assistant {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  max-width: 92%;
  margin-right: auto;
}

.message.assistant .message-avatar {
  margin: 0 0 2px 4px;
}

.message-avatar {
  display: grid;
  width: 28px;
  height: 28px;
  margin-top: 2px;
  place-items: center;
  border-radius: 50%;
}

.message-avatar.is-user {
  color: #fff;
  background: linear-gradient(160deg, #b7a0d8, #8f6fbe);
  box-shadow: 0 4px 10px rgba(143, 111, 190, 0.25);
}

.message-avatar.is-bium {
  background: rgba(255, 250, 244, 0.95);
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.8) inset,
    0 4px 12px rgba(90, 68, 48, 0.06);
}

.message-avatar svg {
  width: 16px;
  height: 16px;
  fill: currentColor;
}

.message-avatar.is-bium svg {
  width: 18px;
  height: 8px;
}

.message-main {
  display: grid;
  gap: 5px;
  min-width: 0;
}

.message.user .message-main {
  justify-items: end;
}

.message-content {
  padding: 13px 17px;
  border: 0;
  border-radius: 20px 20px 20px 9px;
  background: var(--assistant);
  box-shadow: 0 8px 24px rgba(90, 68, 48, 0.045);
  font-size: 0.98rem;
  line-height: 1.52;
  white-space: pre-wrap;
}

.message.user .message-content {
  border-radius: 20px 20px 9px 20px;
  background: var(--user);
  box-shadow: 0 8px 22px rgba(140, 118, 176, 0.09);
}

.message-time {
  color: var(--muted);
  font-size: 0.66rem;
  letter-spacing: 0.03em;
}

.exploring {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 4px 8px 16px 36px;
  color: var(--muted);
  font-size: 0.88rem;
}

.exploring[hidden] {
  display: none;
}

.exploring-dots {
  display: flex;
  gap: 5px;
}

.exploring-dots i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #d7b87a;
  box-shadow: 0 0 8px rgba(223, 192, 137, 0.8);
  animation: exploring-pulse 1.3s ease-in-out infinite;
}

.exploring-dots i:nth-child(2) {
  animation-delay: 0.16s;
}

.exploring-dots i:nth-child(3) {
  animation-delay: 0.32s;
}

.composer {
  position: sticky;
  bottom: 0;
  z-index: 3;
  margin-top: auto;
  padding: 12px 0 4px;
}

.composer-row {
  /* Tuning knobs: layout gap, invisible hit area, painted circle. */
  --composer-gap: 4px;
  --control-touch: 44px;
  --control-visual: 34px;
  /*
   * Mic sits outside the pill and is smaller than Send on purpose: it reads as
   * the secondary input. It is also the only thing taking layout width in the
   * row, so its footprint used to push the pill's centre left by
   * (--mic-touch + --composer-gap) / 2. The ::before below mirrors it and the
   * pill is centred; see Composer geometry in the design decision ledger for
   * what that costs and why it is paid.
   */
  --mic-touch: 32px;
  --mic-visual: 26px;
  /* Gap from the pill's right edge to the Send touch box. */
  --send-inset: 4px;
  /* Pill's own horizontal padding, reused by the Send clearance maths. */
  --pill-pad-x: 16px;
  /*
   * Nudges the pill off the column axis. Positive moves it right.
   *
   * The knob is the shift itself, not the spacer width, so this number is what
   * you would say out loud. It costs twice its value in pill width, because
   * the spacer below has to grow on one side only.
   */
  --pill-shift: 8px;
  display: flex;
  align-items: center;
  gap: var(--composer-gap);
}

/*
 * Invisible mirror of the mic, so the pill's centre lands on the column axis.
 *
 * A pseudo-element rather than markup: it is pure layout ballast and has no
 * business in the accessibility tree. It has to track --mic-touch exactly --
 * if the mic's footprint changes and this does not, the offset comes back at
 * half the difference.
 */
.composer-row::before {
  flex-shrink: 0;
  width: calc(var(--mic-touch) + var(--pill-shift) * 2);
  content: "";
}

/*
 * Send and Mic share one geometry: the button IS the touch target, and the
 * visible circle is painted by ::before at --control-visual. Nothing that
 * paints may carry a shadow spread, or it leaks past the column edge the way
 * the old 56px mic did.
 */
.composer-send,
.mic {
  position: relative;
  display: grid;
  flex-shrink: 0;
  width: var(--control-touch);
  height: var(--control-touch);
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: none;
  cursor: pointer;
}

.composer-send::before,
.mic::before {
  position: absolute;
  top: 50%;
  left: 50%;
  width: var(--control-visual);
  height: var(--control-visual);
  border-radius: 50%;
  content: "";
  transform: translate(-50%, -50%);
}

.composer-send svg,
.mic svg {
  position: relative;
  z-index: 1;
  width: 16px;
  height: 16px;
}

/*
 * Ivory on ivory cannot carry contrast in the fill, so the ring is what makes
 * this control readable. The muted state is expressed with colour, never with
 * `opacity` -- fading the whole button also fades the ring, which is the only
 * thing proving a button is there at all.
 */
/*
 * Send rides inside the pill; Mic stays out in the row. Absolute so the 44px
 * touch box can overhang the textarea without taking layout width from it.
 */
.composer-send {
  position: absolute;
  top: 50%;
  right: var(--send-inset);
  transform: translateY(-50%);
  color: #8f7b57;
  transform: translateY(-50%);
  transition:
    transform 180ms ease,
    color 180ms ease;
}

.composer-send svg {
  fill: none;
  stroke: currentColor;
  stroke-width: 2.1;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.composer-send::before {
  background: rgba(255, 252, 247, 0.95);
  box-shadow:
    0 2px 6px rgba(90, 68, 48, 0.07),
    0 0 0 1px rgba(178, 146, 92, 0.38) inset;
  transition:
    background 180ms ease,
    box-shadow 180ms ease;
}

/*
 * Text present: the quiet gold activation cue. This gold is deliberately
 * darker than the muted brown above -- a more saturated but lighter gold
 * would read as *less* present than the resting state.
 */
.composer-send:not(:disabled) {
  color: #96681f;
}

.composer-send:not(:disabled)::before {
  box-shadow:
    0 2px 8px rgba(90, 68, 48, 0.08),
    0 0 0 1px rgba(178, 146, 92, 0.6) inset,
    0 0 9px rgba(223, 192, 137, 0.28);
}

.composer-send:hover:not(:disabled) {
  color: #7d5512;
}

.composer-send:hover:not(:disabled)::before {
  box-shadow:
    0 2px 10px rgba(90, 68, 48, 0.09),
    0 0 0 1px rgba(178, 146, 92, 0.72) inset,
    0 0 13px rgba(223, 192, 137, 0.36);
}

.composer-send:active:not(:disabled) {
  transform: translateY(-50%) scale(0.97);
}

.composer-send:disabled {
  cursor: default;
}

.composer-shell {
  display: flex;
  flex: 1 1 auto;
  align-items: center;
  position: relative;
  min-width: 0;
  /* Matches the 44px control boxes so the row reads as one 44px band. */
  min-height: 44px;
  padding: 3px var(--pill-pad-x);
  border-radius: 999px;
  background: rgba(255, 250, 244, 0.94);
  box-shadow:
    0 10px 32px rgba(90, 68, 48, 0.06),
    0 0 0 1px rgba(255, 255, 255, 0.74) inset;
  transition: box-shadow 220ms ease;
}

.composer-shell:focus-within {
  box-shadow:
    0 10px 32px rgba(90, 68, 48, 0.06),
    0 0 0 1px rgba(255, 255, 255, 0.9) inset,
    0 0 0 3px rgba(223, 192, 137, 0.16);
}

textarea {
  flex: 1 1 auto;
  /* One 23.2px line + 14px padding. Font stays 16px for readability. */
  min-height: 36px;
  max-height: 140px;
  resize: none;
  /*
   * Right padding clears the Send circle with 7px to spare:
   * inset + (touch - visual)/2 + visual - pill padding + 7 = 34px today.
   */
  padding: 7px
    calc(
      var(--send-inset) + (var(--control-touch) - var(--control-visual)) / 2 +
        var(--control-visual) - var(--pill-pad-x) + 7px
    )
    7px 0;
  color: var(--ink);
  border: 0;
  outline: none;
  background: transparent;
  line-height: 1.45;
}

textarea::placeholder {
  color: #a39a90;
}

.voice-status {
  margin: 0 0 6px;
  color: #6d5a96;
  font-size: 0.72rem;
  font-weight: 500;
  text-align: center;
}

.voice-status[hidden] {
  display: none;
}

.mic {
  width: var(--mic-touch);
  height: var(--mic-touch);
  color: white;
  transition: transform 160ms ease;
}

.mic::before {
  width: var(--mic-visual);
  height: var(--mic-visual);
}

.mic svg {
  width: 14px;
  height: 14px;
  fill: currentColor;
}

.mic::before {
  background: linear-gradient(165deg, #a392d8 0%, #7383cc 58%, #6674c0 100%);
  box-shadow: 0 2px 8px rgba(111, 126, 200, 0.28);
  transition: box-shadow 180ms ease;
}

.mic:hover::before {
  box-shadow:
    0 2px 10px rgba(111, 126, 200, 0.34),
    0 0 10px rgba(186, 176, 226, 0.3);
}

.mic:active {
  transform: scale(0.97);
}

.mic.recording::before {
  background: linear-gradient(160deg, #e7b8c4 0%, #c97a8e 100%);
  animation: mic-pulse 1.4s ease-in-out infinite;
}

.mic.transcribing {
  opacity: 1;
}

/*
 * Sheen rides the painted circle, not the touch box, so it is inset by
 * (--control-touch - --control-visual) / 2.
 */
.mic.transcribing::after {
  position: absolute;
  inset: calc((var(--mic-touch) - var(--mic-visual)) / 2);
  border-radius: 50%;
  background: linear-gradient(115deg, transparent 30%, rgba(255, 255, 255, 0.28) 50%, transparent 70%);
  content: "";
  animation: mic-sheen 1.15s ease-in-out infinite;
}

/* Composer right-click menu ------------------------------------------- */

.bium-context-menu {
  position: fixed;
  z-index: 40;
  min-width: 168px;
  padding: 5px;
  border-radius: 12px;
  background: rgba(255, 252, 247, 0.92);
  box-shadow:
    0 10px 30px rgba(90, 68, 48, 0.14),
    0 0 0 1px rgba(201, 165, 106, 0.18);
  font-family: var(--sans);
  font-size: 0.78rem;
  backdrop-filter: blur(14px) saturate(1.1);
  animation: context-menu-in 110ms ease both;
}

.bium-context-menu[hidden] {
  display: none;
}

.bium-context-item {
  display: flex;
  width: 100%;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 7px 10px;
  border: 0;
  border-radius: 8px;
  color: var(--ink);
  background: none;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.bium-context-item:hover:not(:disabled),
.bium-context-item:focus-visible {
  background: rgba(215, 204, 232, 0.34);
  outline: none;
}

.bium-context-item:disabled {
  color: var(--muted);
  opacity: 0.45;
  cursor: default;
}

.bium-context-shortcut {
  color: var(--muted);
  font-size: 0.7rem;
  letter-spacing: 0.02em;
}

@keyframes context-menu-in {
  from { opacity: 0; transform: translateY(-3px); }
  to { opacity: 1; transform: translateY(0); }
}

.message.assistant.is-settling .message-content {
  animation: message-settle 480ms ease both;
}

.lab-drawer summary:active {
  transform: scale(0.98);
}

.muted {
  color: var(--muted);
}

@keyframes point-lit {
  0% { filter: drop-shadow(0 0 3px rgba(223, 192, 137, 0.35)); transform: scale(1); }
  45% { filter: drop-shadow(0 0 9px rgba(240, 215, 168, 1)); transform: scale(1.08); }
  100% { filter: drop-shadow(0 0 6px rgba(240, 215, 168, 0.85)); transform: scale(1); }
}

@keyframes travel-seg {
  0% { offset-distance: 0%; opacity: 0; }
  12% { opacity: 1; }
  86% { opacity: 1; }
  100% { offset-distance: 100%; opacity: 0; }
}

@keyframes message-settle {
  from { transform: translateY(2px); }
  to { transform: none; }
}

@keyframes mic-sheen {
  0% { transform: translateX(-40%); }
  100% { transform: translateX(40%); }
}

@keyframes wisp-breathe {
  0%,
  100% { opacity: 0.5; }
  50% { opacity: 0.7; }
}

@keyframes glow-wave {
  0% { opacity: 0.15; transform: scale(0.92); }
  45% { opacity: 0.8; transform: scale(1.04); }
  100% { opacity: 1; transform: scale(1); }
}

/* Rings stay within 3px -- (32 - 26) / 2 -- so breathing never paints past the touch box. */
@keyframes mic-pulse {
  0%,
  100% { box-shadow: 0 0 0 2px rgba(201, 122, 142, 0.2), 0 2px 8px rgba(201, 122, 142, 0.28); }
  50% { box-shadow: 0 0 0 3px rgba(201, 122, 142, 0.12), 0 2px 10px rgba(201, 122, 142, 0.36); }
}

@keyframes exploring-pulse {
  0%,
  100% { opacity: 0.35; transform: scale(0.88); }
  50% { opacity: 1; transform: scale(1); }
}

@media (min-width: 860px) {
  .app-shell {
    width: 430px;
    padding-top: 28px;
  }
}

@media (max-width: 360px) {
  .app-shell {
    padding-left: 12px;
    padding-right: 12px;
  }

  .app-header {
    gap: 4px;
  }

  .message {
    max-width: 96%;
  }

  .composer-row {
    --composer-gap: 3px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .bium-mark-point,
  .bium-traveler,
  .bium-traveler-core,
  .bium-traveler-halo,
  .bium-traveler-tail,
  .app-glow,
  .app-wisp,
  .mic.recording::before,
  .mic.transcribing::after,
  .bium-context-menu,
  .exploring-dots i,
  .message.assistant.is-settling .message-content {
    animation: none !important;
  }

  .bium-mark-link,
  .composer-send,
  .mic,
  .composer-shell {
    transition: none;
  }
}

html[data-bium-motion="reduce"] .bium-mark-link {
  transition: none;
}

html[data-bium-restore="1"] .bium-traveler,
html[data-bium-motion="reduce"] .bium-traveler,
html[data-bium-ceremony="settled"] .bium-traveler {
  display: none !important;
}

/* ------------------------------------------------------------- disclosure
 *
 * Five sentences before the first conversation. Styled as a quiet card rather
 * than a compliance banner: the point is that somebody reads it, and a wall of
 * legal chrome is read by nobody. It is the only thing on screen while it is
 * open, and it never appears again once acknowledged.
 */
.disclosure {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  background: color-mix(in oklab, var(--bg, #0f0e13) 82%, transparent);
  backdrop-filter: blur(6px);
}

.disclosure[hidden] {
  display: none;
}

.disclosure-card {
  width: min(30rem, 100%);
  max-height: 85vh;
  overflow-y: auto;
  padding: 1.75rem;
  border-radius: 1rem;
  border: 1px solid color-mix(in oklab, var(--ink, #efe9df) 14%, transparent);
  background: var(--surface, #17161d);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.35);
}

.disclosure-card h2 {
  margin: 0 0 1rem;
  font-size: 1.25rem;
  font-weight: 500;
}

.disclosure-points {
  margin: 0 0 1.5rem;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
}

.disclosure-points li {
  font-size: 0.94rem;
  line-height: 1.5;
  color: color-mix(in oklab, var(--ink, #efe9df) 82%, transparent);
}

/* The way back to it, and the only permanent trace it leaves on the page. */
.app-note {
  margin: 1.5rem 0 0;
  text-align: center;
}

.app-note-link {
  padding: 0;
  border: 0;
  background: none;
  font: inherit;
  font-size: 0.78rem;
  color: color-mix(in oklab, var(--ink, #efe9df) 40%, transparent);
  cursor: pointer;
}

.app-note-link:hover,
.app-note-link:focus-visible {
  color: color-mix(in oklab, var(--ink, #efe9df) 70%, transparent);
  text-decoration: underline;
  text-underline-offset: 0.2em;
}

/* ------------------------------------------------------------------- entry
 *
 * Three elements and a lot of nothing.
 *
 * Opaque rather than a scrim: the conversation interface is behind this, and
 * somebody arriving from an advertisement should meet the offer rather than a
 * half-visible product they have not agreed to yet. It sits above the notice's
 * layer for the same reason, though the two never appear together -- this one
 * stands down before that one is asked for.
 *
 * The promise is the largest thing on any screen in this application, on
 * purpose. The line under it is quiet enough to be read second and sharp
 * enough to be worth reading. Start looks like a way in rather than a
 * conversion button: one pill, ink on ivory, no shadow, no gradient, no arrow.
 */
.entry {
  position: fixed;
  inset: 0;
  z-index: 70;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem 1.5rem calc(2rem + env(safe-area-inset-bottom, 0px));
  /* The body's own field, copied rather than invented, so the entry screen and
   * the application are the same surface and stepping between them is not a
   * change of place. An earlier version used its own two gradients and left a
   * visible seam where they ended. */
  background:
    radial-gradient(58% 42% at 8% 12%, rgba(240, 215, 168, 0.38), transparent 64%),
    radial-gradient(52% 38% at 94% 8%, rgba(186, 160, 220, 0.3), transparent 60%),
    radial-gradient(70% 40% at 86% 100%, rgba(196, 178, 226, 0.18), transparent 56%),
    radial-gradient(48% 30% at 18% 92%, rgba(244, 217, 200, 0.22), transparent 52%),
    var(--ivory);
}

.entry[hidden] {
  display: none;
}

/* Left-aligned rather than centred. Centred text reads as a splash screen; a
 * left edge reads as something addressed to the person. */
.entry-inner {
  width: min(34rem, 100%);
}

.entry-promise {
  margin: 0 0 0.85rem;
  font-size: clamp(2.6rem, 13vw, 4.75rem);
  font-weight: 600;
  line-height: 0.98;
  letter-spacing: -0.035em;
  color: var(--ink);
}

.entry-line {
  margin: 0 0 2.6rem;
  max-width: 24ch;
  font-size: clamp(1.02rem, 4.4vw, 1.2rem);
  line-height: 1.45;
  color: var(--muted);
}

.entry-start {
  min-height: 52px;
  padding: 0 2.5rem;
  border: 0;
  border-radius: 999px;
  background: var(--ink);
  color: var(--ivory);
  font: inherit;
  font-size: 1rem;
  font-weight: 500;
  letter-spacing: 0.01em;
  cursor: pointer;
  transition: opacity 200ms ease;
}

.entry-start:hover,
.entry-start:focus-visible {
  opacity: 0.86;
}

@media (min-width: 720px) {
  .entry {
    padding: 3rem;
  }

  .entry-line {
    /* Wide enough for the sentence to hold together. At 24ch it broke after
     * "wrong" and left "problem." alone on a second line, which reads as a
     * stumble in the one line that has to land. */
    max-width: none;
    margin-bottom: 3rem;
  }
}

/* -------------------------------------------------------- session actions
 *
 * What a person does between problems. Deliberately the quietest live control
 * on the page: the conversation is the product and this is the door out of it,
 * so it reads as a utility line under the composer rather than a call to
 * action. Same weight as "About this test", which is its actual peer.
 */
.session-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 1.25rem;
  margin: 0.9rem 0 0;
}

.session-actions[hidden] {
  display: none;
}

.session-action {
  padding: 4px 0;
  border: 0;
  background: none;
  font: inherit;
  font-size: 0.82rem;
  letter-spacing: 0.02em;
  color: color-mix(in srgb, var(--ink) 52%, transparent);
  cursor: pointer;
}

.session-action:hover,
.session-action:focus-visible {
  color: color-mix(in srgb, var(--ink) 82%, transparent);
  text-decoration: underline;
  text-underline-offset: 0.22em;
}

.session-action[hidden] {
  display: none;
}

/*
 * The research entry marker.
 *
 * Only ever visible when the page was opened at /research/fresh, which is the
 * one path that declines to send this browser's owner id. It sits above
 * everything, including the entry screen and the notice, because the thing it
 * warns about -- seating a new participant in a browser that already belongs
 * to someone -- is decided before either of those is answered.
 */
.research-banner {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 9999;
  padding: 0.5rem 1rem;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.75rem;
  letter-spacing: 0.04em;
  text-align: center;
  color: #241a00;
  background: #ffc94d;
  border-bottom: 1px solid #b8891f;
}

.research-banner[hidden] {
  display: none;
}
/* ------------------------------------------------------------ wide result
 *
 * Desktop is the result experience's visual master, and the master is not the
 * phone column stretched.
 *
 * The shell is 430px wide at every size, which is right for a conversation and
 * wrong for the artifact underneath it: the approved reference gives What We
 * Found a page, not a strip. So past 900px the shell takes the reference's
 * width and everything that is NOT the artifact is capped back to the measure
 * it always had. The transcript, the header and the session actions are
 * unchanged in width, wrapping and rhythm; only the result gets the room.
 *
 * Capping here rather than widening there is deliberate. One rule sets the
 * page width and one list says what keeps the old measure, so a component
 * added later inherits the narrow default and cannot silently become a
 * full-width band nobody designed.
 */
@media (min-width: 900px) {
  .app-shell {
    width: min(1024px, 100%);
    padding: 18px 30px calc(20px + env(safe-area-inset-bottom, 0px));
  }

  .app-header,
  .error-panel,
  .transcript,
  .exploring,
  .voice-status,
  .session-actions,
  .carry {
    width: min(30rem, 100%);
    margin-right: auto;
    margin-left: auto;
  }

  .composer-row {
    max-width: 30rem;
    margin-right: auto;
    margin-left: auto;
  }
}
