/* Venus Chat: the chat app on its own host, behind an account.
   Strictly monochrome: black, white and greys in both themes, so the only colour on screen is what is
   inside a generated image. Type is the site's (Instrument Sans, Fragment Mono). Surfaces are flat;
   the composer keeps a light blur because text scrolls under it, and menus and dialogs keep a soft
   edge so they read as being on top.

   Corners come from one scale and nest: an inner radius is the outer radius minus the padding between
   them (sidebar 22 - 8 = 14 for its rows, composer 24 - 10 = 14 for its chips, a 10px field with its
   Show button 4px in gives 6, a code block 14 - 4 = 10 for its copy button). */

/* ------------------------------------------------------------------ tokens */
:root {
  color-scheme: light;
  --bg: #ffffff;
  --bg-2: #f4f4f4;
  --bg-3: #ebebeb;
  --card: #ffffff;
  --ink: #0d0d0d;
  --ink-2: #3b3b3b;
  --ink-3: #5f5f5f;
  --line: rgba(0, 0, 0, .1);
  --line-strong: rgba(0, 0, 0, .24);
  --rule: rgba(0, 0, 0, .12);
  --rule-strong: rgba(0, 0, 0, .3);
  --venus-1: #ffffff;
  --venus-2: #b8b8b8;
  --venus-3: #3a3a3a;
  --glow: rgba(0, 0, 0, .07);
  --star: transparent;
  --focus: #0d0d0d;
  --ring: rgba(0, 0, 0, .45);
  --ring-soft: rgba(0, 0, 0, .1);
  --sel-bg: #d4d4d4;
  --sel-ink: #000000;

  --panel: #f5f5f5;
  --hover: rgba(0, 0, 0, .05);
  --active: rgba(0, 0, 0, .08);
  --field: rgba(0, 0, 0, .05);
  --field-bg: #ffffff;
  --wash: rgba(0, 0, 0, .035);
  --wash-strong: rgba(0, 0, 0, .065);

  --glass: rgba(255, 255, 255, .88);
  --glass-line: rgba(0, 0, 0, .13);
  --glass-ink: #0d0d0d;
  --glass-ink-2: #3b3b3b;
  --glass-ink-3: #666666;
  --glass-hover: rgba(0, 0, 0, .05);
  --meter: rgba(0, 0, 0, .12);
  --meter-fill: #0d0d0d;

  --bubble: #f1f1f1;
  --bubble-ink: #0d0d0d;
  --bubble-ink-2: #555555;
  --menu-bg: #ffffff;
  --menu-ink: #0d0d0d;
  --menu-ink-2: #555555;
  --menu-hover: rgba(0, 0, 0, .05);
  --menu-shadow: 0 0 0 1px rgba(0, 0, 0, .08), 0 18px 40px -18px rgba(0, 0, 0, .25);
  --send-bg: #0d0d0d;
  --send-ink: #ffffff;
  --inverse: #0d0d0d;
  --inverse-ink: #ffffff;
  --code-bg: #f6f6f6;
  --code-ink: #0d0d0d;
  --code-ink-2: #5f5f5f;
  --code-rule: rgba(0, 0, 0, .08);
  --hatch: rgba(0, 0, 0, .05);
  --scrim: rgba(0, 0, 0, .3);
  --shadow-disc: inset -16px -20px 40px rgba(0, 0, 0, .18);

  --font-text: "Instrument Sans", "Helvetica Neue", Arial, system-ui, sans-serif;
  --font-mono: "Fragment Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

  --r-1: 6px;
  --r-2: 10px;
  --r-3: 14px;
  --r-4: 22px;
  --r-5: 24px;

  --gutter: 16px;
  --col: 46rem;
  --side-w: 272px;
  --rail-w: 60px;
  --ease: cubic-bezier(.2, .7, .2, 1);
  --swing: cubic-bezier(.32, .72, 0, 1);
  --spring: cubic-bezier(.34, 1.4, .64, 1);
  --spring-soft: cubic-bezier(.3, 1.22, .5, 1);
  --t-fast: 160ms;
  --t-slow: 420ms;
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0a0a0a;
  --bg-2: #141414;
  --bg-3: #1c1c1c;
  --card: #111111;
  --ink: #f2f2f2;
  --ink-2: #c8c8c8;
  --ink-3: #9b9b9b;
  --line: rgba(255, 255, 255, .1);
  --line-strong: rgba(255, 255, 255, .26);
  --rule: rgba(255, 255, 255, .12);
  --rule-strong: rgba(255, 255, 255, .3);
  --venus-1: #ffffff;
  --venus-2: #9a9a9a;
  --venus-3: #262626;
  --glow: rgba(255, 255, 255, .07);
  --star: rgba(255, 255, 255, .6);
  --focus: #f2f2f2;
  --ring: rgba(255, 255, 255, .5);
  --ring-soft: rgba(255, 255, 255, .14);
  --sel-bg: #3d3d3d;
  --sel-ink: #ffffff;

  --panel: #121212;
  --hover: rgba(255, 255, 255, .06);
  --active: rgba(255, 255, 255, .1);
  --field: rgba(255, 255, 255, .06);
  --field-bg: #0a0a0a;
  --wash: rgba(255, 255, 255, .04);
  --wash-strong: rgba(255, 255, 255, .08);

  --glass: rgba(22, 22, 22, .88);
  --glass-line: rgba(255, 255, 255, .12);
  --glass-ink: #f2f2f2;
  --glass-ink-2: #c8c8c8;
  --glass-ink-3: #9b9b9b;
  --glass-hover: rgba(255, 255, 255, .07);
  --meter: rgba(255, 255, 255, .14);
  --meter-fill: #f2f2f2;

  --bubble: #1e1e1e;
  --bubble-ink: #f2f2f2;
  --bubble-ink-2: #b5b5b5;
  --menu-bg: #161616;
  --menu-ink: #f2f2f2;
  --menu-ink-2: #a8a8a8;
  --menu-hover: rgba(255, 255, 255, .07);
  --menu-shadow: 0 0 0 1px rgba(255, 255, 255, .09), 0 18px 40px -18px rgba(0, 0, 0, .8);
  --send-bg: #f2f2f2;
  --send-ink: #0a0a0a;
  --inverse: #f2f2f2;
  --inverse-ink: #0a0a0a;
  --code-bg: #141414;
  --code-ink: #f2f2f2;
  --code-ink-2: #9b9b9b;
  --code-rule: rgba(255, 255, 255, .08);
  --hatch: rgba(255, 255, 255, .05);
  --scrim: rgba(0, 0, 0, .6);
  --shadow-disc: 0 0 60px 4px rgba(255, 255, 255, .06), inset -18px -22px 44px rgba(0, 0, 0, .5);
}

/* ------------------------------------------------------------------ base */
*, *::before, *::after { box-sizing: border-box; }
html { background: var(--bg); -webkit-text-size-adjust: 100%; }
body {
  margin: 0; height: 100%; overflow: hidden; overscroll-behavior: none;
  background: var(--bg); color: var(--ink);
  font-family: var(--font-text); font-size: 1rem; line-height: 1.5;
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
}
h1, h2, h3 { font-family: var(--font-text); font-weight: 600; margin: 0; letter-spacing: -.02em; }
p { margin: 0; }
em, i { font-style: normal; }
a { color: inherit; text-decoration-color: var(--rule-strong); text-underline-offset: .18em; text-decoration-thickness: 1px; }
button { font: inherit; color: inherit; }
img { display: block; max-width: 100%; height: auto; }
code, kbd, pre { font-family: var(--font-mono); }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
::selection { background: var(--sel-bg); color: var(--sel-ink); }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }
.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.i { display: block; flex: none; width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.skip {
  position: fixed; left: 16px; top: -80px; z-index: 100; padding: 10px 16px; border-radius: 999px;
  background: var(--inverse); color: var(--inverse-ink); text-decoration: none; font-weight: 500;
}
.skip:focus-visible { top: 12px; }
.mark {
  flex: none; width: 12px; height: 12px; border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, var(--venus-1), var(--venus-2) 55%, var(--venus-3));
  box-shadow: 0 0 0 1px var(--line);
}

.icon-btn {
  display: inline-grid; place-items: center; flex: none; width: 40px; height: 40px; padding: 0;
  border: 0; border-radius: 50%; background: transparent; color: var(--ink-2); cursor: pointer;
  transition: background var(--t-fast) var(--ease), color var(--t-fast) var(--ease);
}
.icon-btn:hover { background: var(--hover); color: var(--ink); }
.icon-btn--small { width: 32px; height: 32px; }
.icon-btn--small .i { width: 18px; height: 18px; }
.theme .moon { display: none; }
:root[data-theme="dark"] .theme .sun { display: none; }
:root[data-theme="dark"] .theme .moon { display: block; }

/* While the page asks the server who is signed in, only the mark shows, and only if it takes a while. */
.boot { display: none; position: fixed; inset: 0; place-items: center; color: var(--ink-3); }
.boot .saturn { height: 30px; }
:root[data-auth="pending"] .boot { display: grid; animation: boot-in 600ms var(--ease) 320ms both; }
@keyframes boot-in { from { opacity: 0; transform: translateY(6px) scale(.96); } to { opacity: 1; transform: none; } }

/* ------------------------------------------------------------------ frame
   The app is exactly the visible viewport (chat.js keeps --app-h in step with the iOS keyboard). */
.app {
  display: grid; grid-template-columns: auto minmax(0, 1fr);
  height: 100vh; height: var(--app-h, 100dvh);
  transform: translateY(var(--app-y, 0));
}

/* ------------------------------------------------------------------ sidebar: a flat inset panel that folds into a rail */
.side {
  position: relative; z-index: 20; display: flex; flex-direction: column; min-height: 0;
  width: var(--side-w); margin: 10px 0 10px 10px; padding: 8px;
  border-radius: var(--r-4); background: var(--panel);
  overflow: hidden;
  transition: width 560ms var(--swing);
}
.side__head { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 44px; padding-left: 10px; }
.brand {
  display: inline-flex; align-items: center; gap: 9px; min-width: 0; height: 40px;
  font-size: 1.3125rem; font-weight: 600; letter-spacing: -.025em; line-height: 1; color: var(--ink); text-decoration: none;
  border-radius: var(--r-2);
}
.saturn { display: block; flex: none; height: 26px; width: auto; aspect-ratio: 431.59 / 314.57; fill: currentColor; }
.side__toggle .i { transition: transform 560ms var(--spring); }
.side__close { display: none; }

.side__tools { display: grid; gap: 2px; margin-top: 8px; }
.row {
  display: flex; align-items: center; gap: 10px; width: 100%; min-height: 40px; padding: 0 12px;
  border: 0; border-radius: var(--r-3); background: transparent; color: var(--ink); cursor: pointer;
  font-size: .9375rem; font-weight: 500; text-align: left; white-space: nowrap;
  transition: background var(--t-fast) var(--ease);
}
.row:hover { background: var(--hover); }
.row__label { overflow: hidden; text-overflow: ellipsis; }

.search { position: relative; display: flex; align-items: center; border-radius: var(--r-3); }
.search__icon { position: absolute; left: 0; top: 0; width: 44px; padding: 0 12px; background: transparent; pointer-events: none; }
.search input {
  width: 100%; min-height: 40px; margin: 0; padding: 0 12px 0 42px;
  border: 0; border-radius: var(--r-3); background: var(--field); color: var(--ink);
  font: inherit; font-size: 1rem; outline: none; -webkit-appearance: none; appearance: none;
  transition: background var(--t-fast) var(--ease), box-shadow var(--t-fast) var(--ease);
}
.search input::placeholder { color: var(--ink-3); opacity: 1; }
.search input:focus-visible { box-shadow: inset 0 0 0 2px var(--focus); }
.search input::-webkit-search-cancel-button { -webkit-appearance: none; }

.side__list {
  flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain;
  margin: 12px -8px 0; padding: 0 8px 16px; scrollbar-width: thin; scrollbar-color: var(--rule-strong) transparent;
  -webkit-mask-image: linear-gradient(to bottom, transparent, #000 8px, #000 calc(100% - 20px), transparent);
  mask-image: linear-gradient(to bottom, transparent, #000 8px, #000 calc(100% - 20px), transparent);
}
.group + .group { margin-top: 16px; }
.group__title { padding: 6px 12px 4px; font-size: .8125rem; font-weight: 500; letter-spacing: 0; color: var(--ink-3); }
.group ul { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: minmax(0, 1fr); gap: 1px; }
.item { position: relative; min-width: 0; display: flex; align-items: center; border-radius: var(--r-3); transition: background var(--t-fast) var(--ease); }
.item:hover { background: var(--hover); }
.item.is-current { background: var(--active); }
.item__link {
  flex: 1; min-width: 0; display: block; padding: 9px 40px 9px 12px; border-radius: inherit;
  font-size: .9375rem; line-height: 22px; color: var(--ink-2); text-decoration: none;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.item.is-current .item__link, .item:hover .item__link { color: var(--ink); }
.item__link:focus-visible { outline-offset: -2px; border-radius: var(--r-3); }
.item__more {
  position: absolute; right: 4px; top: 50%; width: 32px; height: 32px; margin-top: -16px;
  border-radius: var(--r-2); opacity: 0; transition: opacity var(--t-fast) var(--ease), background var(--t-fast) var(--ease);
}
.item__more .i { width: 18px; height: 18px; }
.item:hover .item__more, .item:focus-within .item__more, .item.is-current .item__more, .item__more[aria-expanded="true"] { opacity: 1; }
@media (hover: none) { .item__more { opacity: 1; } }
.item__dot {
  position: absolute; right: 16px; top: 50%; width: 7px; height: 7px; margin-top: -3.5px; border-radius: 50%;
  background: var(--ink); animation: pulse 1.8s var(--ease) infinite alternate;
}
.item:hover .item__dot, .item:focus-within .item__dot, .item.is-current .item__dot { opacity: 0; }
@keyframes pulse { from { transform: scale(.7); opacity: .5; } to { transform: scale(1); opacity: 1; } }
.item__input--title { flex: none; width: min(28rem, 100%); margin: 0; font-weight: 500; }
.item__input {
  flex: 1; min-width: 0; margin: 2px; padding: 7px 10px; border: 0; border-radius: var(--r-2);
  background: var(--field-bg); color: var(--ink); font: inherit; font-size: 1rem; line-height: 22px;
  outline: 2px solid var(--focus); outline-offset: -2px;
}
.list-empty { padding: 10px 12px; font-size: .875rem; line-height: 1.45; color: var(--ink-3); text-wrap: pretty; }

.side__foot { display: grid; gap: 6px; width: calc(var(--side-w) - 16px); margin: 0 -8px -8px; padding: 12px 8px 8px; border-top: 1px solid var(--line); }
.store-note { padding: 0 12px; font-size: .8125rem; line-height: 1.4; color: var(--ink-3); text-wrap: pretty; }
.side__links { display: flex; flex-wrap: wrap; gap: 0 10px; padding: 0 12px; }
.side__links a { padding: 4px 0; font-size: .75rem; color: var(--ink-2); text-decoration: none; white-space: nowrap; }
.side__links a:hover { color: var(--ink); text-decoration: underline; }
.side__meta { display: flex; align-items: center; gap: 4px; margin-top: 2px; }
.side__theme { display: none; }

/* the account: a button with the address that opens upward into a small menu */
.account {
  flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px; height: 44px; padding: 0 10px 0 7px;
  border: 0; border-radius: var(--r-3); background: transparent; color: var(--ink); cursor: pointer; text-align: left;
  transition: background var(--t-fast) var(--ease);
}
.account:hover, .account[aria-expanded="true"] { background: var(--hover); }
.avatar {
  display: grid; place-items: center; flex: none; width: 30px; height: 30px; border-radius: 50%;
  background: var(--inverse); color: var(--inverse-ink); font-size: .8125rem; font-weight: 600; line-height: 1;
}
.account__email { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .875rem; }
.account__chev { width: 16px; height: 16px; color: var(--ink-3); transform: rotate(180deg); transition: transform 360ms var(--spring); }
.account[aria-expanded="true"] .account__chev { transform: none; }

/* Folding: what does not fit the rail fades first, then the panel narrows. Opening runs the other way. */
.brand__word, .row__label, .search input, .side__list {
  transition: opacity 260ms var(--ease) 220ms, visibility 0s var(--ease) 0s, transform 420ms var(--spring) 200ms;
}
@media (min-width: 768px) {
  :root[data-side="closed"] .side { width: var(--rail-w); }
  :root[data-side="closed"] .side__toggle .i { transform: scaleX(-1); }
  :root[data-side="closed"] .side__head { padding-left: 0; justify-content: center; }
  :root[data-side="closed"] .brand { display: none; }
  :root[data-side="closed"] .brand__word,
  :root[data-side="closed"] .row__label,
  :root[data-side="closed"] .search input,
  :root[data-side="closed"] .side__list {
    opacity: 0; visibility: hidden; transform: translate(-6px, 2px);
    transition: opacity 120ms var(--ease), visibility 0s var(--ease) 120ms, transform 160ms var(--ease);
  }
  :root[data-side="closed"] .search__icon { pointer-events: auto; position: relative; }
  :root[data-side="closed"] .search input { position: absolute; }
  :root[data-side="closed"] .store-note, :root[data-side="closed"] .side__links,
  :root[data-side="closed"] .account__email, :root[data-side="closed"] .account__chev { display: none; }
  :root[data-side="closed"] .side__foot { border-top-color: transparent; }
  :root[data-side="closed"] .account { flex: none; width: 44px; padding: 0 7px; }
}

/* ------------------------------------------------------------------ main column */
.main { position: relative; display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.top { display: flex; align-items: center; gap: 6px; flex: none; height: 64px; padding: 10px 16px 0 22px; }
.top__title { display: flex; align-items: center; gap: 2px; flex: 1; min-width: 0; }
.top__title h1 { min-width: 0; font-size: 1rem; line-height: 1.3; font-weight: 600; letter-spacing: -.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.top__drawer, .top__new { display: none; }
.top .theme { margin-right: -4px; }
.save-state { display: inline-flex; align-items: center; gap: 7px; flex: none; margin-left: 8px; font-size: .8125rem; color: var(--ink-3); white-space: nowrap; }
.save-state:empty { display: none; }
.save-state::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--ink-3); animation: pulse 1.4s var(--ease) infinite alternate; }

.stage { position: relative; flex: 1; min-height: 0; overflow: hidden; }
.scroller {
  position: absolute; inset: 0; overflow-y: auto; overflow-x: hidden; overscroll-behavior: contain;
  scrollbar-gutter: stable both-edges; scrollbar-width: thin; scrollbar-color: var(--rule-strong) transparent;
  /* text leaves under the title bar softly rather than being cut */
  -webkit-mask-image: linear-gradient(to bottom, transparent, #000 22px);
  mask-image: linear-gradient(to bottom, transparent, #000 22px);
}
.thread {
  display: flex; flex-direction: column; gap: 26px;
  width: min(100% - 2 * var(--gutter), var(--col)); margin: 0 auto;
  padding: 18px 0 calc(var(--dock-h, 150px) + 36px);
}
.thread-state { display: flex; align-items: center; gap: 10px; padding: 24px 0; font-size: .9375rem; color: var(--ink-3); }
.thread-state .gone__btn { margin-left: 4px; }

/* ------------------------------------------------------------------ dock: intro, composer and suggestions
   With no messages the dock centres on the stage (on a phone the composer stays down by the thumb);
   once the chat starts it sits on the bottom edge and chat.js animates the move. */
.dock {
  position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: flex-end;
  pointer-events: none;
}
.dock > * { pointer-events: auto; }
.intro { display: none; justify-items: center; text-align: center; padding: 0 var(--gutter) 30px; }
.main[data-empty="true"] .intro { display: grid; }
.intro__title { margin-top: 26px; font-size: clamp(1.75rem, 1.2rem + 1.6vw, 2.375rem); line-height: 1.08; letter-spacing: -.03em; text-wrap: balance; }
.intro__text { margin-top: 10px; max-width: 46ch; font-size: 1.0625rem; line-height: 1.5; color: var(--ink-2); text-wrap: pretty; }
.intro.is-swapping .intro__title, .intro.is-swapping .intro__text { animation: swap 520ms var(--spring-soft); }
.intro.is-swapping .intro__text { animation-delay: 40ms; animation-fill-mode: backwards; }
@keyframes swap { from { opacity: 0; transform: translate(-8px, 6px); } 60% { opacity: 1; } to { opacity: 1; transform: none; } }

/* Venus on the site's graduated horizon, in greys. It rises along an arc when the page opens. */
.horizon {
  position: relative; width: 300px; height: 112px; overflow: hidden;
  -webkit-mask-image: radial-gradient(58% 100% at 50% 100%, #000 45%, transparent 98%);
  mask-image: radial-gradient(58% 100% at 50% 100%, #000 45%, transparent 98%);
}
.horizon::before {
  content: ""; position: absolute; left: 50%; bottom: -150%; width: 200%; aspect-ratio: 1; transform: translateX(-50%);
  background: radial-gradient(closest-side, var(--glow), transparent 70%);
}
.horizon__stars { position: absolute; inset: 0; width: 100%; height: 100%; }
.horizon__stars circle { fill: var(--star); }
.horizon__disc {
  position: absolute; left: 50%; bottom: -52px; width: 108px; height: 108px; margin-left: -54px; border-radius: 50%;
  background: radial-gradient(circle at 32% 28%, var(--venus-1) 0%, var(--venus-2) 48%, var(--venus-3) 100%);
  box-shadow: var(--shadow-disc);
  animation: rise 1400ms var(--ease) both;
}
@keyframes rise {
  0% { transform: translate(-34px, 58px); opacity: 0; }
  35% { opacity: 1; }
  60% { transform: translate(-9px, 9px); }
  100% { transform: none; }
}
.horizon__scale {
  position: absolute; left: 0; right: 0; bottom: 0; height: 12px;
  background:
    repeating-linear-gradient(90deg, var(--rule) 0 1px, transparent 1px 12px) left bottom / 100% 5px no-repeat,
    repeating-linear-gradient(90deg, var(--rule-strong) 0 1px, transparent 1px 60px) left bottom / 100% 11px no-repeat,
    linear-gradient(var(--rule-strong), var(--rule-strong)) left bottom / 100% 1px no-repeat;
}

.composer {
  position: relative; z-index: 2; display: flex; flex-direction: column;
  width: min(100% - 2 * var(--gutter), var(--col));
  padding-bottom: max(10px, env(safe-area-inset-bottom));
}
/* the thread fades out before it passes under the composer */
.composer::before {
  content: ""; position: absolute; z-index: -1; left: -50vw; right: -50vw; top: -30px; bottom: 0; pointer-events: none;
  background: linear-gradient(to bottom, transparent, var(--bg) 40px);
}
.main[data-empty="true"] .composer::before { display: none; }

/* The composer keeps a light blur because text slides under it; otherwise it is a flat panel with a hairline. */
.composer__box {
  position: relative; display: grid; gap: 2px; padding: 10px;
  border-radius: var(--r-5); background: var(--glass); color: var(--glass-ink);
  -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px);
  box-shadow: inset 0 0 0 1px var(--glass-line);
  transition: box-shadow var(--t-slow) var(--ease);
}
.composer__box:focus-within { box-shadow: inset 0 0 0 1px var(--glass-line), 0 0 0 1.5px var(--ring); }
.composer textarea {
  display: block; width: 100%; min-height: 34px; max-height: min(40vh, 280px); margin: 0; padding: 6px 8px 4px;
  border: 0; border-radius: 0; resize: none; background: transparent; color: var(--glass-ink);
  font: inherit; font-size: 1.0625rem; line-height: 1.5; outline: none; overflow-y: auto; scrollbar-width: thin;
}
.composer textarea::placeholder { color: var(--glass-ink-3); opacity: 1; }
.composer__bar { display: flex; align-items: center; gap: 4px; min-width: 0; }

.pop { position: relative; min-width: 0; }
.chip {
  display: inline-flex; align-items: center; gap: 6px; max-width: 100%; height: 36px; padding: 0 10px;
  border: 0; border-radius: var(--r-3); background: transparent; color: var(--glass-ink-2); cursor: pointer;
  font-size: .875rem; font-weight: 500; white-space: nowrap;
  transition: background var(--t-fast) var(--ease), color var(--t-fast) var(--ease);
}
.chip:hover, .chip[aria-expanded="true"] { background: var(--glass-hover); color: var(--glass-ink); }
.chip .i { width: 18px; height: 18px; }
.chip > span { overflow: hidden; text-overflow: ellipsis; }
.chip__chev { width: 16px !important; height: 16px !important; margin-left: -2px; opacity: .7; transition: transform 360ms var(--spring); }
.chip[aria-expanded="true"] .chip__chev { transform: rotate(180deg); }
.chip__key { color: var(--glass-ink-3); }
.chip__val { max-width: 11rem; }
.ratio { display: grid; place-items: center; width: 18px; height: 18px; flex: none; }
.ratio i { display: block; border: 1.6px solid currentColor; border-radius: 3px; }

.allow {
  display: inline-flex; align-items: center; gap: 8px; margin-left: auto; padding: 0 8px; min-width: 0;
  font-size: .8125rem; color: var(--glass-ink-3); white-space: nowrap; font-variant-numeric: tabular-nums;
}
.allow__bar {
  --n: 1; display: block; flex: none; width: 46px; height: 4px; border-radius: 2px; background: var(--meter); overflow: hidden;
  -webkit-mask: repeating-linear-gradient(90deg, #000 0 calc(100% / var(--n) - 2px), transparent 0 calc(100% / var(--n)));
  mask: repeating-linear-gradient(90deg, #000 0 calc(100% / var(--n) - 2px), transparent 0 calc(100% / var(--n)));
}
.allow__bar[data-solid] { -webkit-mask: none; mask: none; }
.allow__bar i { display: block; height: 100%; background: var(--meter-fill); transition: width var(--t-slow) var(--ease); }
.allow[data-full="true"] { color: var(--glass-ink); }
.allow__short { display: none; }

.send {
  position: relative; display: grid; place-items: center; flex: none; width: 36px; height: 36px; margin-left: 2px;
  border: 0; border-radius: 50%; background: var(--send-bg); color: var(--send-ink); cursor: pointer;
  transition: transform 300ms var(--spring), opacity var(--t-fast) var(--ease), background var(--t-fast) var(--ease);
}
.send .i { grid-area: 1 / 1; width: 20px; height: 20px; stroke-width: 2; transition: transform 380ms var(--spring), opacity 180ms var(--ease); }
.send__stop { opacity: 0; transform: scale(.4) rotate(-45deg); }
.send[data-state="stop"] .send__go { opacity: 0; transform: translateY(-8px) scale(.6); }
.send[data-state="stop"] .send__stop { opacity: 1; transform: none; }
.send:hover:not(:disabled) { transform: scale(1.06); }
.send:active:not(:disabled) { transform: scale(.94); }
.send:disabled { background: var(--meter); color: var(--glass-ink-3); cursor: not-allowed; transform: none; }

.composer__note { margin-top: 8px; padding: 0 8px; text-align: center; font-size: .75rem; line-height: 1.4; color: var(--ink-3); text-wrap: pretty; }
.composer__note[data-spent="true"] { color: var(--ink); font-size: .8125rem; }
.main[data-empty="true"] .composer__note { margin-top: 10px; }
@media (hover: none) { .composer__keys { display: none; } }

.suggest { display: none; list-style: none; margin: 0; padding: 0; order: 2; }
.main[data-empty="true"] .suggest { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin-top: 14px; }
.suggest button {
  width: 100%; height: 100%; min-height: 44px; padding: 10px 14px; text-align: left;
  border: 0; border-radius: var(--r-3); background: var(--wash); color: var(--ink-2); cursor: pointer;
  font-size: .875rem; line-height: 1.4;
  display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden;
  transition: background var(--t-fast) var(--ease), color var(--t-fast) var(--ease), transform 360ms var(--spring);
}
.suggest button:hover { background: var(--wash-strong); color: var(--ink); transform: translateY(-2px); }
.composer__box { order: 1; }
.composer__note { order: 3; }

/* ------------------------------------------------------------------ menus: buttons that open upward or beside their anchor */
.menu {
  position: absolute; z-index: 40; min-width: 232px; padding: 8px;
  border-radius: var(--r-4); background: var(--menu-bg); color: var(--menu-ink); box-shadow: var(--menu-shadow);
  transform-origin: var(--origin, 0 100%);
}
.menu:not([hidden]) { animation: open 420ms var(--spring) both; }
.menu.is-closing { animation: shut 160ms var(--ease) both; }
@keyframes open { from { opacity: 0; transform: translate(-4px, 10px) scale(.92); } 50% { opacity: 1; } to { opacity: 1; transform: none; } }
@keyframes shut { to { opacity: 0; transform: translate(-2px, 6px) scale(.96); } }
.menu--model { left: -2px; bottom: calc(100% + 12px); width: min(376px, calc(100vw - 2 * var(--gutter))); max-height: min(68vh, 560px); overflow-y: auto; overscroll-behavior: contain; }
.menu--model[data-flip="true"], .menu--genre[data-flip="true"], .menu--aspect[data-flip="true"] { bottom: auto; top: calc(100% + 12px); --origin: 0 0; }
.menu--genre { left: -2px; bottom: calc(100% + 12px); width: min(320px, calc(100vw - 2 * var(--gutter))); padding: 14px; }
.menu--aspect { left: -2px; bottom: calc(100% + 12px); min-width: 200px; }
.menu--chat, .menu--account { position: fixed; min-width: 212px; --origin: 100% 0; }

.menu__group + .menu__group { margin-top: 6px; padding-top: 6px; border-top: 1px solid var(--line); }
.menu__head { padding: 8px 12px 4px; font-size: .8125rem; font-weight: 500; color: var(--menu-ink-2); }
.menu__item {
  display: flex; align-items: center; gap: 12px; width: 100%; min-height: 40px; padding: 8px 12px;
  border: 0; border-radius: var(--r-3); background: transparent; color: var(--menu-ink); cursor: pointer;
  font-size: .9375rem; text-align: left;
  transition: background var(--t-fast) var(--ease);
}
.menu__item:hover { background: var(--menu-hover); }
.menu__item:focus-visible { background: var(--menu-hover); outline: 2px solid var(--focus); outline-offset: -2px; }
.menu__item .i { color: var(--menu-ink-2); }
.menu__text { display: grid; grid-template-columns: minmax(0, 1fr) auto; column-gap: 10px; flex: 1; min-width: 0; }
.menu__name { font-weight: 500; line-height: 1.3; }
.menu__desc { grid-column: 1 / -1; font-size: .8125rem; line-height: 1.35; color: var(--menu-ink-2); text-wrap: pretty; }
.menu__left { align-self: baseline; font-size: .75rem; color: var(--menu-ink-2); font-variant-numeric: tabular-nums; white-space: nowrap; }
.menu__left[data-out="true"] { color: var(--menu-ink); }
.menu__tick { width: 18px !important; height: 18px !important; flex: none; color: var(--menu-ink) !important; opacity: 0; transform: scale(.5); transition: opacity 160ms var(--ease), transform 360ms var(--spring); }
.menu__item[aria-checked="true"] .menu__tick { opacity: 1; transform: none; }

.field__label { display: block; font-size: .8125rem; font-weight: 500; color: var(--menu-ink-2); margin: 0 0 6px 2px; }
.field {
  display: block; width: 100%; min-height: 42px; margin: 0; padding: 8px 12px;
  border: 0; border-radius: var(--r-2); background: var(--field); color: var(--menu-ink);
  font: inherit; font-size: 1rem; outline: none;
}
.field:focus-visible { box-shadow: inset 0 0 0 2px var(--focus); }
.field__hint { margin: 8px 2px 0; font-size: .8125rem; line-height: 1.4; color: var(--menu-ink-2); }
.presets { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.presets button {
  min-height: 32px; padding: 0 12px; border: 1px solid var(--line-strong); border-radius: 999px; background: transparent;
  color: var(--menu-ink); font-size: .8125rem; cursor: pointer; transition: background var(--t-fast) var(--ease);
}
.presets button:hover { background: var(--menu-hover); }
.presets button[aria-pressed="true"] { background: var(--inverse); color: var(--inverse-ink); border-color: transparent; }

/* ------------------------------------------------------------------ the thread */
.msg { position: relative; min-width: 0; }
.msg.is-new.msg--you { animation: arrive-you 560ms var(--spring-soft) both; transform-origin: 100% 100%; }
.msg.is-new.msg--venus { animation: arrive-venus 640ms var(--spring-soft) both; }
@keyframes arrive-you {
  0% { opacity: 0; transform: translate(26px, 34px) scale(.94); }
  45% { opacity: 1; transform: translate(6px, 5px) scale(.99); }
  100% { opacity: 1; transform: none; }
}
@keyframes arrive-venus {
  0% { opacity: 0; transform: translate(-14px, 18px); }
  55% { opacity: 1; transform: translate(-2px, 2px); }
  100% { opacity: 1; transform: none; }
}
.msg.is-filled > :not(.who) { animation: arrive-venus 620ms var(--spring-soft) both; }
.msg.is-filled > :nth-child(3) { animation-delay: 50ms; }
.msg.is-filled > :nth-child(4) { animation-delay: 100ms; }

.msg--you { align-self: flex-end; display: grid; justify-items: end; gap: 6px; max-width: min(82%, 36rem); }
.bubble {
  padding: 10px 16px 11px; border-radius: var(--r-4) var(--r-4) var(--r-1) var(--r-4);
  background: var(--bubble); color: var(--bubble-ink);
  font-size: 1.0625rem; line-height: 1.5; white-space: pre-wrap; overflow-wrap: anywhere;
}
.bubble__opts { display: block; margin-top: 4px; font-size: .8125rem; color: var(--bubble-ink-2); }

.msg--venus { display: grid; grid-template-columns: minmax(0, 1fr); justify-items: start; gap: 12px; }
.msg--venus > * { max-width: 100%; }
.who { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 9px; min-height: 22px; font-size: .875rem; color: var(--ink-2); }
.who__name { font-weight: 500; }
.who__time { font-family: var(--font-mono); font-size: .75rem; color: var(--ink-3); }
.who.is-working .mark { animation: breathe 2.6s var(--ease) infinite; }
@keyframes breathe {
  0%, 100% { box-shadow: 0 0 0 2px var(--glow); transform: scale(.9); }
  50% { box-shadow: 0 0 0 6px var(--glow), 0 0 18px 4px var(--glow); transform: scale(1); }
}
.working {
  font-family: var(--font-mono); font-size: .8125rem; font-variant-numeric: tabular-nums; color: var(--ink-2);
  background: linear-gradient(90deg, var(--ink-3) 0 35%, var(--ink) 50%, var(--ink-3) 65% 100%) 0 0 / 300% 100%;
  -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
  animation: shimmer 2.2s cubic-bezier(.45, 0, .55, 1) infinite;
}
@keyframes shimmer { from { background-position: 100% 0; } to { background-position: 0 0; } }

.acts { display: flex; align-items: center; gap: 2px; margin: -4px 0 0 -8px; transition: opacity var(--t-fast) var(--ease); }
.msg--you .acts { margin: -2px -6px -8px 0; opacity: 0; }
.msg--you:hover .acts, .msg--you:focus-within .acts { opacity: 1; }
.msg--venus:not(.is-last) .acts { opacity: 0; }
.msg--venus:hover .acts, .msg--venus:focus-within .acts { opacity: 1; }
@media (hover: none) { .msg--venus .acts, .msg--you .acts { opacity: 1 !important; } }
.act {
  display: inline-grid; place-items: center; width: 34px; height: 34px; padding: 0;
  border: 0; border-radius: var(--r-2); background: transparent; color: var(--ink-3); cursor: pointer; text-decoration: none;
  transition: background var(--t-fast) var(--ease), color var(--t-fast) var(--ease);
}
.act .i { width: 18px; height: 18px; }
.act:hover { background: var(--hover); color: var(--ink); }
.act:disabled { opacity: .4; cursor: not-allowed; background: transparent; }
.act[data-state="done"] { color: var(--ink); }

.err { display: flex; align-items: flex-start; gap: 10px; max-width: 60ch; font-size: 1rem; line-height: 1.5; color: var(--ink); }
.err .i { margin-top: 2px; width: 19px; height: 19px; }
.stopped { font-size: .9375rem; color: var(--ink-3); }

/* reply typography: the playground's, at chat width */
.body { width: 100%; min-width: 0; font-size: 1.0625rem; line-height: 1.65; color: var(--ink); overflow-wrap: anywhere; }
.body > * { margin: 0; }
.body > * + * { margin-top: .85em; }
.body h3 { font-size: 1.3125rem; line-height: 1.2; letter-spacing: -.02em; text-wrap: balance; }
.body > * + h3 { margin-top: 1.4em; }
.body ul, .body ol { padding-left: 1.5em; }
.body ol { padding-left: 2em; }
.body li { padding-left: .25em; }
.body li + li { margin-top: .3em; }
.body ul li::marker { color: var(--ink-3); }
.body ol li::marker { font-family: var(--font-mono); font-size: .8125em; color: var(--ink-2); }
.body strong { font-weight: 600; }
.body em { font-weight: inherit; }
.body a { color: var(--ink); text-decoration-color: var(--ink-3); }
.body a:hover { text-decoration-color: var(--ink); }
.body code { font-size: .875em; color: var(--ink); background: var(--field); padding: 1px 6px; border-radius: var(--r-1); }
.body hr { height: 0; border: 0; border-top: 1px solid var(--rule); }
.body > .snippet, .body > .table { margin-top: 1.1em; }
.body > .snippet + *, .body > .table + * { margin-top: 1.1em; }
.body > :first-child { margin-top: 0; }

.snippet { width: 100%; border-radius: var(--r-3); background: var(--code-bg); color: var(--code-ink); overflow: hidden; box-shadow: inset 0 0 0 1px var(--code-rule); }
.snippet__head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 4px 4px 4px 16px; border-bottom: 1px solid var(--code-rule); }
.snippet__head > span { font-family: var(--font-mono); font-size: .75rem; color: var(--code-ink-2); }
.snippet__copy {
  display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 10px;
  border: 0; border-radius: var(--r-2); background: transparent; color: var(--code-ink-2); cursor: pointer; font-size: .8125rem;
  transition: background var(--t-fast) var(--ease), color var(--t-fast) var(--ease);
}
.snippet__copy:hover { background: var(--hover); color: var(--code-ink); }
.snippet__copy .i { width: 16px; height: 16px; }
.snippet pre { margin: 0; padding: 14px 16px 16px; font-size: .875rem; line-height: 1.6; white-space: pre-wrap; overflow-wrap: anywhere; tab-size: 2; }
.snippet--scroll pre { white-space: pre; overflow-x: auto; overflow-wrap: normal; scrollbar-width: thin; scrollbar-color: var(--rule-strong) transparent; }
.snippet code { font-size: inherit; background: none; padding: 0; color: inherit; }

.table { overflow-x: auto; border-top: 1px solid var(--rule-strong); border-bottom: 1px solid var(--rule-strong); }
.table table { width: 100%; border-collapse: collapse; font-size: .9375rem; line-height: 1.45; font-variant-numeric: tabular-nums; }
.table th { padding: 10px 20px 9px 0; text-align: left; vertical-align: bottom; white-space: nowrap; font-size: .8125rem; font-weight: 500; color: var(--ink-2); border-bottom: 1px solid var(--rule); }
.table td { padding: 10px 20px 10px 0; vertical-align: top; color: var(--ink-2); border-top: 1px solid var(--rule); overflow-wrap: normal; }
.table tr:first-child td { border-top: 0; }
.table td:first-child { color: var(--ink); }
.table th:last-child, .table td:last-child { padding-right: 0; }
.table:focus-visible { outline-offset: 2px; }

.sources { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.sources a {
  display: inline-flex; align-items: center; gap: 7px; max-width: min(100%, 18rem); min-height: 32px; padding: 0 12px 0 6px;
  border-radius: 999px; background: var(--field); text-decoration: none;
  font-size: .8125rem; color: var(--ink-2);
  transition: background var(--t-fast) var(--ease), color var(--t-fast) var(--ease);
}
.sources a:hover { background: var(--hover); color: var(--ink); box-shadow: inset 0 0 0 1px var(--rule); }
.sources b { display: grid; place-items: center; flex: none; width: 21px; height: 21px; border-radius: 50%; background: var(--inverse); color: var(--inverse-ink); font-family: var(--font-mono); font-size: .6875rem; font-weight: 400; }
.sources span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* images: a figure in the thread; a placeholder keeps the shape when the file has expired */
.shot { margin: 0; display: grid; gap: 8px; width: fit-content; max-width: min(100%, 36rem); }
.shot__link { position: relative; display: block; border-radius: var(--r-3); overflow: hidden; background: var(--bg-2); box-shadow: inset 0 0 0 1px var(--line); }
.shot img { width: auto; max-width: 100%; height: auto; max-height: min(66vh, 620px); }
.shot__link:focus-visible { outline-offset: 3px; }
.shot__cap { display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: .8125rem; color: var(--ink-3); }
.shot__cap span + span::before { content: "·"; margin-right: 12px; }

/* a page Venus built: its name and an Open link above a live preview */
.artifact { margin: 0; display: grid; width: 100%; border-radius: var(--r-3); overflow: hidden; background: var(--bg-2); box-shadow: inset 0 0 0 1px var(--line); }
.artifact__head { display: flex; align-items: center; gap: 10px; min-width: 0; padding: 4px 4px 4px 14px; border-bottom: 1px solid var(--line); }
.artifact__head > .i { flex: none; width: 18px; height: 18px; color: var(--ink-3); }
.artifact__title { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .875rem; font-weight: 500; color: var(--ink); }
.artifact__open {
  display: inline-flex; align-items: center; gap: 6px; flex: none; min-height: 32px; padding: 0 10px;
  border-radius: var(--r-2); color: var(--ink-2); text-decoration: none; font-size: .8125rem;
  transition: background var(--t-fast) var(--ease), color var(--t-fast) var(--ease);
}
.artifact__open:hover { background: var(--hover); color: var(--ink); }
.artifact__open .i { width: 16px; height: 16px; }
/* the browser's own page canvas, which is what an unstyled page expects to sit on */
.artifact__frame { display: block; width: 100%; aspect-ratio: 16 / 10; max-height: min(70vh, 640px); border: 0; background: #fff; }

.gone {
  display: grid; place-items: center; align-content: center; gap: 10px; text-align: center;
  width: min(100%, 26rem); aspect-ratio: var(--ar, 4 / 3); max-height: 340px; padding: 22px;
  border-radius: var(--r-3); border: 1.5px dashed var(--rule-strong); color: var(--ink-2);
  background: repeating-linear-gradient(135deg, transparent 0 11px, var(--hatch) 11px 12px);
}
.gone .i { width: 30px; height: 30px; stroke-width: 1.4; color: var(--ink-3); }
.gone p { max-width: 30ch; font-size: .9375rem; line-height: 1.45; text-wrap: pretty; }
.gone__btn {
  display: inline-flex; align-items: center; gap: 8px; min-height: 36px; padding: 0 14px; margin-top: 2px;
  border: 1px solid var(--rule-strong); border-radius: 999px; background: transparent; color: var(--ink); cursor: pointer; font-size: .875rem; font-weight: 500;
  transition: background var(--t-fast) var(--ease);
}
.gone__btn:hover { background: var(--hover); }
.gone__btn .i { width: 16px; height: 16px; }
.gone--track { aspect-ratio: auto; width: min(100%, 36rem); min-height: 0; padding: 18px; grid-auto-flow: column; justify-content: start; text-align: left; }

/* an image on its way: a soft light drifting across a blank plate */
.develop {
  position: relative; overflow: hidden; width: min(100%, 26rem); aspect-ratio: var(--ar, 1);
  border-radius: var(--r-3); background: var(--bg-2);
}
.develop::before {
  content: ""; position: absolute; inset: -40%;
  background: radial-gradient(closest-side, var(--glow), transparent 70%);
  animation: drift 3.4s cubic-bezier(.45, 0, .55, 1) infinite alternate;
}
.develop::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 10px;
  background:
    repeating-linear-gradient(90deg, var(--rule) 0 1px, transparent 1px 12px) left bottom / 100% 5px no-repeat,
    repeating-linear-gradient(90deg, var(--rule-strong) 0 1px, transparent 1px 60px) left bottom / 100% 9px no-repeat;
}
@keyframes drift {
  0% { transform: translate(-18%, 14%); }
  50% { transform: translate(0, -6%); }
  100% { transform: translate(18%, 12%); }
}

/* a track: the evening sky as its cover, the prompt as its title, then the player */
.track { margin: 0; width: min(100%, 36rem); display: grid; gap: 10px; }
.track__art { position: relative; isolation: isolate; overflow: hidden; height: clamp(140px, 22vw, 184px); border-radius: var(--r-3); background: var(--bg-2); }
.track__art::before {
  content: ""; position: absolute; left: 70%; bottom: -150%; width: 160%; aspect-ratio: 1; transform: translateX(-50%); z-index: -1;
  background: radial-gradient(closest-side, var(--glow), transparent 72%);
}
.track__art .stars { position: absolute; inset: 0; width: 100%; height: 100%; }
.track__art .stars circle { fill: var(--star); }
.track__disc {
  position: absolute; left: 76%; bottom: -46%; width: clamp(100px, 16vw, 132px); aspect-ratio: 1; border-radius: 50%; transform: translateX(-50%);
  background: radial-gradient(circle at 32% 28%, var(--venus-1) 0%, var(--venus-2) 48%, var(--venus-3) 100%);
  box-shadow: var(--shadow-disc);
}
.track__title {
  position: absolute; left: 18px; right: 42%; bottom: 22px;
  font-size: clamp(1.0625rem, .9rem + .8vw, 1.375rem); font-weight: 600; line-height: 1.15; letter-spacing: -.02em; color: var(--ink); text-wrap: balance;
  display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 3; overflow: hidden;
}
.track audio { display: block; width: 100%; height: 44px; }

.brief { width: 100%; border-radius: var(--r-3); background: var(--field); }
.brief summary {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 44px; padding: 0 8px 0 14px;
  border-radius: var(--r-3); cursor: pointer; list-style: none; font-size: .9375rem; color: var(--ink-2);
}
.brief summary::-webkit-details-marker { display: none; }
.brief summary:hover { color: var(--ink); }
.brief summary .i { width: 18px; height: 18px; transition: transform 360ms var(--spring); }
.brief[open] summary .i { transform: rotate(180deg); }
.brief[open] summary { border-radius: var(--r-3) var(--r-3) 0 0; }
.brief .snippet { border-radius: 0 0 var(--r-3) var(--r-3); }
.note-line { font-size: .9375rem; color: var(--ink-2); }

/* ------------------------------------------------------------------ floating bits */
.to-end {
  position: absolute; z-index: 5; left: 50%; bottom: calc(var(--dock-h, 150px) + 12px); width: 40px; height: 40px; margin-left: -20px;
  display: grid; place-items: center; padding: 0; border: 0; border-radius: 50%;
  background: var(--glass); color: var(--glass-ink); box-shadow: inset 0 0 0 1px var(--glass-line); cursor: pointer;
  -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
  animation: pop-in 420ms var(--spring) both;
}
.to-end .i { width: 18px; height: 18px; }
.main[data-pop="true"] .to-end { visibility: hidden; }
@keyframes pop-in { from { opacity: 0; transform: translateY(10px) scale(.7); } to { opacity: 1; transform: none; } }

.toast {
  position: fixed; z-index: 60; left: 50%; bottom: calc(var(--dock-h, 150px) + 18px);
  display: flex; align-items: center; gap: 6px; max-width: calc(100vw - 32px); padding: 6px 6px 6px 18px; min-height: 46px;
  border-radius: var(--r-4); background: var(--inverse); color: var(--inverse-ink);
  font-size: .9375rem; opacity: 0; visibility: hidden; transform: translate(-50%, 16px) scale(.96);
  transition: opacity 200ms var(--ease), transform 460ms var(--spring), visibility 0s var(--ease) 460ms;
}
.toast:not(:has(button)) { padding-right: 18px; }
.toast.is-on { opacity: 1; visibility: visible; transform: translate(-50%, 0); transition: opacity 200ms var(--ease), transform 460ms var(--spring), visibility 0s var(--ease); }
.toast button {
  display: inline-flex; align-items: center; gap: 6px; min-height: 34px; padding: 0 12px; margin-left: 6px;
  border: 0; border-radius: var(--r-3); background: color-mix(in srgb, var(--inverse-ink) 16%, transparent); color: var(--inverse-ink); cursor: pointer; font-size: .875rem; font-weight: 500;
}
.toast button .i { width: 16px; height: 16px; }
:root[data-auth="out"] .toast { bottom: 24px; }

.scrim { display: none; }

/* ------------------------------------------------------------------ the sign in screens */
.auth {
  position: fixed; left: 0; right: 0; top: var(--app-y, 0); z-index: 30;
  height: 100vh; height: var(--app-h, 100dvh);
  display: flex; flex-direction: column; padding: 64px var(--gutter) max(24px, env(safe-area-inset-bottom));
  overflow-y: auto; overscroll-behavior: contain; background: var(--bg);
}
.auth__theme { position: absolute; top: 12px; right: 12px; }
.auth__card {
  margin: auto; width: 100%; max-width: 408px; padding: 28px 28px 26px;
  border-radius: var(--r-5); background: var(--card); box-shadow: inset 0 0 0 1px var(--line);
}
.auth__brand { display: flex; align-items: center; gap: 10px; margin-bottom: 22px; font-size: 1.0625rem; font-weight: 600; letter-spacing: -.015em; }
.auth__brand .saturn { height: 22px; }
.auth__notice { margin-bottom: 18px; padding: 10px 12px; border-radius: var(--r-2); background: var(--field); font-size: .9375rem; line-height: 1.45; }
.auth__screens { margin: -4px; padding: 4px; overflow: hidden; }
.screen { display: grid; gap: 16px; }
.screen__title { font-size: 1.625rem; line-height: 1.15; letter-spacing: -.03em; outline: none; }
.screen__text { margin-top: -6px; font-size: .9375rem; line-height: 1.5; color: var(--ink-2); text-wrap: pretty; overflow-wrap: anywhere; }
.screen__email { color: var(--ink); }
.screen__msg { padding: 10px 12px; border-radius: var(--r-2); background: var(--field); font-size: .9375rem; line-height: 1.45; color: var(--ink); }
.screen__msg:empty { display: none; }
.screen__msg[data-tone="error"]::before {
  content: ""; float: left; width: 16px; height: 16px; margin: 2px 8px 0 0;
  background: currentColor;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='1.8' stroke-linecap='round'%3E%3Ccircle cx='12' cy='12' r='8.5'/%3E%3Cpath d='M12 7.75v5'/%3E%3Cpath d='M12 16.1h.01' stroke-width='2.2'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='1.8' stroke-linecap='round'%3E%3Ccircle cx='12' cy='12' r='8.5'/%3E%3Cpath d='M12 7.75v5'/%3E%3Cpath d='M12 16.1h.01' stroke-width='2.2'/%3E%3C/svg%3E") center / contain no-repeat;
}
.screen__alt { text-align: center; font-size: .875rem; color: var(--ink-3); }
.screen__legal { font-size: .8125rem; line-height: 1.45; color: var(--ink-3); text-wrap: pretty; }
.screen__legal a { color: var(--ink-2); }
.screen__legal a:hover { color: var(--ink); text-decoration-color: var(--ink); }
.screen__links { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 6px 16px; }

.field-group { display: grid; }
.label { display: block; margin-bottom: 6px; font-size: .875rem; font-weight: 500; color: var(--ink-2); }
.label-row { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 6px; }
.label-row .label { margin: 0; }
.input {
  display: block; width: 100%; height: 46px; margin: 0; padding: 0 14px;
  border: 1px solid var(--line-strong); border-radius: var(--r-2); background: var(--field-bg); color: var(--ink);
  font: inherit; font-size: 1rem; -webkit-appearance: none; appearance: none;
  transition: border-color var(--t-fast) var(--ease), box-shadow var(--t-fast) var(--ease);
}
.input:hover { border-color: var(--ink-3); }
.input:focus-visible { outline: none; border-color: var(--ink); box-shadow: 0 0 0 3px var(--ring-soft); }
.pw { position: relative; }
.pw .input { padding-right: 72px; }
.pw__toggle {
  position: absolute; top: 4px; right: 4px; height: 38px; min-width: 56px; padding: 0 12px;
  border: 0; border-radius: var(--r-1); background: transparent; color: var(--ink-2); cursor: pointer;
  font-size: .8125rem; font-weight: 500; transition: background var(--t-fast) var(--ease), color var(--t-fast) var(--ease);
}
.pw__toggle:hover { background: var(--hover); color: var(--ink); }
.pw__toggle:focus-visible { outline-offset: -2px; }

.rules { list-style: none; display: grid; gap: 3px; margin: 10px 0 0; padding: 0 2px; font-size: .8125rem; color: var(--ink-3); }
.rules li { display: flex; align-items: center; gap: 8px; transition: color var(--t-fast) var(--ease); }
.rules .i { width: 16px; height: 16px; stroke-width: 1.8; }
.rules li[data-done="true"] { color: var(--ink); }
.rules li[data-done="true"] .i { animation: tick 380ms var(--spring); }
@keyframes tick { from { transform: scale(.4) rotate(-20deg); opacity: .3; } to { transform: none; opacity: 1; } }

/* the code: one input over six drawn cells */
.code__box { position: relative; }
.code__cells { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 8px; pointer-events: none; }
.code__cell {
  display: grid; place-items: center; height: 56px;
  border: 1px solid var(--line-strong); border-radius: var(--r-2); background: var(--field-bg);
  font-family: var(--font-mono); font-size: 1.375rem; color: var(--ink);
  transition: border-color var(--t-fast) var(--ease), box-shadow var(--t-fast) var(--ease), transform 300ms var(--spring);
}
.code__cell.is-filled { border-color: var(--ink-3); }
.code__cell.is-active { border-color: var(--ink); box-shadow: 0 0 0 3px var(--ring-soft); }
.code__cell.is-active:empty::after { content: ""; width: 1.5px; height: 24px; background: var(--ink); animation: caret 1.1s cubic-bezier(.45, 0, .55, 1) infinite; }
@keyframes caret { 0%, 100% { opacity: 1; } 50% { opacity: 0; } }
.code__input {
  position: absolute; inset: 0; z-index: 1; width: 100%; height: 100%; margin: 0; padding: 0;
  border: 0; background: transparent; color: transparent; caret-color: transparent;
  font-size: 16px; letter-spacing: 0; outline: none;
}
.code__input::selection { background: transparent; }

.primary {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; width: 100%; height: 48px; padding: 0 18px;
  border: 0; border-radius: var(--r-2); background: var(--inverse); color: var(--inverse-ink); cursor: pointer;
  font-size: 1rem; font-weight: 500; letter-spacing: -.005em;
  transition: transform 300ms var(--spring), opacity var(--t-fast) var(--ease);
}
.primary .i { width: 18px; height: 18px; }
.primary:hover:not(:disabled) { opacity: .88; }
.primary:active:not(:disabled) { transform: scale(.985); }
.primary:disabled { opacity: .55; cursor: progress; }
.secondary {
  display: inline-flex; align-items: center; justify-content: center; height: 44px; padding: 0 16px;
  border: 1px solid var(--line-strong); border-radius: var(--r-2); background: transparent; color: var(--ink); cursor: pointer;
  font-size: .9375rem; font-weight: 500; transition: background var(--t-fast) var(--ease);
}
.secondary:hover { background: var(--hover); }
.link {
  display: inline; padding: 4px 0; border: 0; background: none; cursor: pointer;
  font: inherit; font-size: .875rem; font-weight: 500; color: var(--ink);
  text-decoration: underline; text-decoration-color: var(--line-strong); text-underline-offset: 3px; text-decoration-thickness: 1px;
  transition: text-decoration-color var(--t-fast) var(--ease);
}
.link:hover { text-decoration-color: var(--ink); }
.link:disabled { color: var(--ink-3); text-decoration: none; cursor: default; font-variant-numeric: tabular-nums; }

/* ------------------------------------------------------------------ dialogs */
.dialog {
  width: min(440px, calc(100vw - 2 * var(--gutter))); max-height: calc(var(--app-h, 100dvh) - 32px); padding: 0; margin: auto;
  border: 0; border-radius: var(--r-4); background: var(--card); color: var(--ink); box-shadow: var(--menu-shadow);
  overflow-y: auto;
}
.dialog::backdrop { background: var(--scrim); }
.dialog[open] { animation: dialog-in 480ms var(--spring-soft); }
.dialog[open]::backdrop { animation: fade 320ms var(--ease); }
.dialog.is-closing { animation: dialog-out 180ms var(--ease) forwards; }
.dialog.is-closing::backdrop { animation: fade 180ms var(--ease) reverse forwards; }
@keyframes dialog-in { from { opacity: 0; transform: translate(-6px, 18px) scale(.95); } 55% { opacity: 1; } to { opacity: 1; transform: none; } }
@keyframes dialog-out { to { opacity: 0; transform: translate(-2px, 8px) scale(.97); } }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
.dialog__form { display: grid; gap: 16px; padding: 24px; }
.dialog h2 { font-size: 1.25rem; line-height: 1.2; }
.dialog__text { margin-top: -6px; font-size: .9375rem; line-height: 1.5; color: var(--ink-2); text-wrap: pretty; }
.dialog__actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 4px; }
.dialog__actions .primary { width: auto; height: 44px; }

/* ------------------------------------------------------------------ phones: the sidebar becomes a drawer that swings in */
@media (max-width: 767px) {
  .app { grid-template-columns: minmax(0, 1fr); }
  .side {
    position: fixed; z-index: 30; top: 8px; bottom: 8px; left: 8px; width: min(86vw, 330px); margin: 0;
    transform-origin: 0 100%; transform: translateX(calc(-100% - 30px)) rotate(-6deg); visibility: hidden;
    transition: transform 460ms var(--swing), visibility 0s var(--ease) 460ms;
  }
  :root[data-drawer="open"] .side { transform: none; visibility: visible; transition: transform 640ms var(--spring-soft), visibility 0s var(--ease); }
  .side__toggle { display: none; }
  .side__close { display: inline-grid; }
  .scrim {
    display: block; position: fixed; inset: 0; z-index: 25; background: var(--scrim);
    opacity: 0; visibility: hidden; transition: opacity 360ms var(--ease), visibility 0s var(--ease) 360ms;
  }
  :root[data-drawer="open"] .scrim { opacity: 1; visibility: visible; transition: opacity 360ms var(--ease), visibility 0s var(--ease); }
  .row, .item__link { min-height: 44px; }
  .item__link { padding-block: 11px; }

  .top { height: 60px; padding: 8px 10px 0; gap: 4px; }
  .top__drawer, .top__new { display: inline-grid; width: 44px; height: 44px; }
  .top__theme { display: none; }
  .side__theme { display: inline-grid; width: 44px; height: 44px; }
  .side__foot { width: auto; }
  .top__title { justify-content: center; }
  .top__title h1 { text-align: center; }
  .icon-btn--small { width: 36px; height: 36px; }
  .save-state { position: absolute; top: 56px; left: 50%; transform: translateX(-50%); margin: 0; }

  .main[data-empty="true"] .intro { flex: 1; align-content: center; padding-bottom: 12px; }
  .horizon { width: 240px; height: 92px; }
  .horizon__disc { width: 88px; height: 88px; margin-left: -44px; bottom: -42px; }
  .intro__title { margin-top: 20px; }

  .main[data-empty="true"] .suggest {
    order: 0; display: flex; gap: 8px; margin: 0 calc(-1 * var(--gutter)) 10px; padding: 0 var(--gutter);
    overflow-x: auto; scrollbar-width: none; scroll-snap-type: x mandatory; scroll-padding-inline: var(--gutter);
  }
  .suggest::-webkit-scrollbar { display: none; }
  .suggest li { flex: none; width: min(74vw, 260px); scroll-snap-align: start; }
  .suggest button:hover { transform: none; }

  .msg--you { max-width: 88%; }
  .allow__long { display: none; }
  .allow__short { display: inline; }
  .chip__key { display: none; }
  .chip__family { display: none; }
  .composer__bar:has(.pop[data-for]:not([hidden])) .allow__bar { display: none; }
  .chip__val { max-width: 6.5rem; }
  .chip--model #model-name { max-width: 7.5rem; }
  .composer__note { margin-top: 6px; }

  .auth { padding-top: 60px; }
  .auth__card { padding: 24px 20px 22px; }
  .screen__title { font-size: 1.5rem; }
  .code__cells { gap: 6px; }
  .code__cell { height: 52px; }
  .dialog__form { padding: 22px 20px 20px; }
  .dialog__actions { flex-direction: column-reverse; }
  .dialog__actions > * { width: 100%; }
}
@media (max-width: 379px) {
  .allow__bar { display: none; }
}

/* ------------------------------------------------------------------ laptops: a little less air */
@media (min-width: 768px) and (max-width: 1099px) {
  :root { --side-w: 248px; }
}
@media (min-width: 768px) {
  :root { --gutter: 24px; }
  .main[data-empty="true"] .dock { justify-content: center; padding-bottom: 7vh; }
}

/* ------------------------------------------------------------------ motion preference */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 1ms !important; animation-delay: 0s !important; animation-iteration-count: 1 !important;
    transition-duration: 1ms !important; transition-delay: 0s !important; scroll-behavior: auto !important;
  }
  .working { background: none; -webkit-text-fill-color: currentColor; }
}
