/* ============================================================================
   FreeGen design system
   Light-first; dark is an equal peer, not an afterthought.
   Deliberately distinct from ShareMyAI (near-black + lime, technical/infra):
   FreeGen is warm paper and electric indigo: consumer, generous, legible.
   ========================================================================= */

/* ---------- Typefaces (self-hosted; CSP allows font-src 'self' only) ------- */
@font-face {
  font-family: "Bricolage Grotesque";
  /* A static instance at 700, the only weight the display face is used at.
     The variable file carried width and optical-size axes nothing here sets,
     and weighed 128 KB; this weighs 21. */
  src: url("/fonts/bricolage-700-latin.woff2") format("woff2");
  font-weight: 700; font-style: normal; font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Bricolage Grotesque";
  src: url("/fonts/bricolage-700-latin-ext.woff2") format("woff2");
  font-weight: 700; font-style: normal; font-display: swap;
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "Instrument Sans";
  src: url("/fonts/instrument-latin.woff2") format("woff2");
  font-weight: 400 700; font-style: normal; font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Instrument Sans";
  src: url("/fonts/instrument-latin-ext.woff2") format("woff2");
  font-weight: 400 700; font-style: normal; font-display: swap;
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "JetBrains Mono";
  src: url("/fonts/jetbrains-latin.woff2") format("woff2");
  font-weight: 400 600; font-style: normal; font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "JetBrains Mono";
  src: url("/fonts/jetbrains-latin-ext.woff2") format("woff2");
  font-weight: 400 600; font-style: normal; font-display: swap;
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

/* ---------- Tokens: light (default) --------------------------------------- */
:root {
  --paper:      #F8F7FB;
  --surface:    #FFFFFF;
  --sunken:     #F0EEF6;
  --overlay:    rgba(18, 15, 30, .45);

  --ink:        #14111F;
  --ink-2:      #474258;
  /* 5.0:1 on paper, 5.2:1 on surface, 4.6:1 on sunken. The previous value
     (#7C746A) sat at 4.45:1 and missed WCAG AA for small text. */
  --ink-3:      #6B6580;
  --ink-4:      #A19BB4;

  --line:       #E5E2EE;
  --line-2:     #D2CDE0;

  --brand:      #4B2EF0;
  --brand-hi:   #3A1FD6;
  --brand-on:   #FFFFFF;
  --brand-soft: #ECE8FE;
  --brand-line: #C6BAFB;

  --heat:       #B8330F;
  --heat-soft:  #FDEDE7;
  --heat-line:  #F5C4B2;

  --ok:         #0B7050;
  --ok-soft:    #E2F4EC;
  --ok-line:    #A9DCC7;

  --warn:       #8C5806;
  --warn-soft:  #FBF0DA;
  --warn-line:  #E7CD97;

  --bad:        #C22C1B;
  --bad-soft:   #FCEBE8;
  --bad-line:   #F1BCB3;

  --shadow-1: 0 1px 2px rgba(20,17,31,.05), 0 1px 1px rgba(20,17,31,.04);
  --shadow-2: 0 2px 4px rgba(20,17,31,.05), 0 6px 16px -6px rgba(20,17,31,.10);
  --shadow-3: 0 4px 8px rgba(20,17,31,.06), 0 18px 40px -12px rgba(20,17,31,.18);

  --display: "Bricolage Grotesque", "Segoe UI", system-ui, -apple-system, sans-serif;
  --sans: "Instrument Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "JetBrains Mono", ui-monospace, "Cascadia Code", "SF Mono", Consolas, monospace;

  --r-xs: 6px; --r-sm: 9px; --r: 13px; --r-lg: 20px; --r-pill: 999px;
  --shell: min(1180px, 100% - 3rem);
  --wide:  min(1400px, 100% - 3rem);
  --header-h: 60px;

  color-scheme: light;
}

/* ---------- Tokens: dark -------------------------------------------------- */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper:      #0F0D16;
    --surface:    #191622;
    --sunken:     #0B0911;
    --overlay:    rgba(6, 5, 10, .64);

    --ink:        #F7F5FA;
    --ink-2:      #B8B1C6;
    --ink-3:      #857D96;
    --ink-4:      #635B73;

    --line:       #2A2436;
    --line-2:     #3B3449;

    --brand:      #A492FF;
    --brand-hi:   #BCAEFF;
    --brand-on:   #16102F;
    --brand-soft: #251D44;
    --brand-line: #43376E;

    --heat:       #FF8A63;
    --heat-soft:  #3A1D14;
    --heat-line:  #63301F;

    --ok:         #4FD3A0;
    --ok-soft:    #102C23;
    --ok-line:    #1D5642;

    --warn:       #E7B25B;
    --warn-soft:  #33240E;
    --warn-line:  #5C441A;

    --bad:        #FF8577;
    --bad-soft:   #371714;
    --bad-line:   #632B24;

    --shadow-1: 0 1px 2px rgba(0,0,0,.40);
    --shadow-2: 0 2px 6px rgba(0,0,0,.42), 0 8px 20px -8px rgba(0,0,0,.50);
    --shadow-3: 0 6px 14px rgba(0,0,0,.45), 0 22px 48px -14px rgba(0,0,0,.62);

    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --paper:      #0F0D16;
  --surface:    #191622;
  --sunken:     #0B0911;
  --overlay:    rgba(6, 5, 10, .64);
  --ink:        #F7F5FA;
  --ink-2:      #B8B1C6;
  --ink-3:      #857D96;
  --ink-4:      #635B73;
  --line:       #2A2436;
  --line-2:     #3B3449;
  --brand:      #A492FF;
  --brand-hi:   #BCAEFF;
  --brand-on:   #16102F;
  --brand-soft: #251D44;
  --brand-line: #43376E;
  --heat:       #FF8A63;
  --heat-soft:  #3A1D14;
  --heat-line:  #63301F;
  --ok:         #4FD3A0;
  --ok-soft:    #102C23;
  --ok-line:    #1D5642;
  --warn:       #E7B25B;
  --warn-soft:  #33240E;
  --warn-line:  #5C441A;
  --bad:        #FF8577;
  --bad-soft:   #371714;
  --bad-line:   #632B24;
  --shadow-1: 0 1px 2px rgba(0,0,0,.40);
  --shadow-2: 0 2px 6px rgba(0,0,0,.42), 0 8px 20px -8px rgba(0,0,0,.50);
  --shadow-3: 0 6px 14px rgba(0,0,0,.45), 0 22px 48px -14px rgba(0,0,0,.62);
  color-scheme: dark;
}

/* ---------- Reset --------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }
/* The clip has to be on the scroll container itself. Setting it only on <body>
   leaves <html> scrolling, so the hero glow still widens the document. */
html {
  min-width: 320px; -webkit-text-size-adjust: 100%; overflow-x: clip;
  /* Hold the scrollbar's width whether or not there is one, so moving between a
     page that scrolls and one that does not stops nudging the whole layout
     sideways. */
  scrollbar-gutter: stable;
}
body {
  margin: 0;
  /* A column so the main view can grow. Without it the footer sits directly
     under whatever the current view happens to be, and every route change of a
     different height drags it up or down the screen. */
  display: flex;
  flex-direction: column;
  min-height: 100dvh;
  background: var(--paper);
  color: var(--ink);
  font: 400 1rem/1.6 var(--sans);
  -webkit-font-smoothing: antialiased;
  /* The hero glow bleeds past the viewport by design. `clip` trims it without
     creating a scroll container, so the sticky header keeps working;
     `overflow-x: hidden` would break it. */
  overflow-x: clip;
}
h1, h2, h3, h4 {
  margin: 0;
  font-family: var(--display);
  font-weight: 700;
  letter-spacing: -.022em;
  line-height: 1.1;
  text-wrap: balance;
}
p { margin: 0; text-wrap: pretty; }
ul, ol, dl, dd { margin: 0; padding: 0; }
li { list-style: none; }
img, svg, canvas, audio, video { display: block; max-width: 100%; }
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; }
a { color: var(--brand); text-underline-offset: 3px; }
:where(button, a, input, textarea, select, [tabindex], summary):focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
}
::selection { background: var(--brand); color: var(--brand-on); }
[hidden] { display: none !important; }

/* The router moves focus to the new view's heading so screen readers land in
   the right place. That heading is not tab-reachable, so it does not need a
   focus ring, and drawing one puts a stray box around every page title. */
h1[tabindex="-1"]:focus, h1[tabindex="-1"]:focus-visible { outline: none; }

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0;
}
.skip-link {
  position: fixed; z-index: 90; inset-block-start: .75rem; inset-inline-start: .75rem;
  padding: .625rem 1rem; border-radius: var(--r-sm);
  background: var(--brand); color: var(--brand-on);
  font-weight: 600; text-decoration: none;
  transform: translateY(calc(-100% - 1.5rem));
}
.skip-link:focus-visible { transform: none; }

/* ---------- Layout primitives --------------------------------------------- */
.shell { width: var(--shell); margin-inline: auto; }
.wide  { width: var(--wide);  margin-inline: auto; }

/* ---------- Type scale ---------------------------------------------------- */
.t-display { font-family: var(--display); font-weight: 700; font-size: clamp(2.6rem, 6.4vw, 5.15rem); line-height: 1.02; letter-spacing: -.036em; }
.t-h1      { font-family: var(--display); font-weight: 700; font-size: clamp(1.95rem, 3.8vw, 2.85rem); line-height: 1.08; letter-spacing: -.03em; }
.t-h2      { font-family: var(--display); font-weight: 700; font-size: clamp(1.45rem, 2.4vw, 1.9rem); letter-spacing: -.024em; }
.t-h3      { font-family: var(--display); font-weight: 700; font-size: 1.175rem; letter-spacing: -.018em; }
.t-lead    { font-size: clamp(1.0625rem, 1.35vw, 1.1875rem); line-height: 1.58; color: var(--ink-2); }
.t-body    { font-size: 1rem; line-height: 1.62; color: var(--ink-2); }
.t-sm      { font-size: .9375rem; line-height: 1.55; color: var(--ink-2); }
.t-xs      { font-size: .8125rem; line-height: 1.5; color: var(--ink-3); }
.t-eyebrow { font: 600 .875rem/1.3 var(--sans); letter-spacing: -.005em; color: var(--brand); }
.t-num     { font-family: var(--mono); font-variant-numeric: tabular-nums; }

/* ---------- Buttons ------------------------------------------------------- */
.btn {
  --btn-bg: var(--surface);
  --btn-fg: var(--ink);
  --btn-bd: var(--line-2);
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  min-height: 2.75rem; padding: 0 1.05rem;
  border: 1px solid var(--btn-bd); border-radius: var(--r-sm);
  background: var(--btn-bg); color: var(--btn-fg);
  font-size: .9375rem; font-weight: 600; letter-spacing: -.006em;
  text-decoration: none; white-space: nowrap;
  box-shadow: var(--shadow-1);
  transition: background-color .16s ease, border-color .16s ease, transform .1s ease, box-shadow .16s ease, color .16s ease;
}
.btn:hover:not(:disabled) { background: var(--sunken); }
.btn:active:not(:disabled) { transform: translateY(1px); box-shadow: none; }
.btn:disabled, .btn[aria-disabled="true"] { opacity: .5; cursor: not-allowed; box-shadow: none; }

.btn-primary { --btn-bg: var(--brand); --btn-fg: var(--brand-on); --btn-bd: var(--brand); }
.btn-primary:hover:not(:disabled) { background: var(--brand-hi); border-color: var(--brand-hi); }

.btn-ghost { --btn-bg: transparent; --btn-bd: transparent; --btn-fg: var(--ink-2); box-shadow: none; }
.btn-ghost:hover:not(:disabled) { background: var(--sunken); color: var(--ink); }

.btn-danger { --btn-fg: var(--bad); --btn-bd: var(--bad-line); --btn-bg: var(--surface); }
.btn-danger:hover:not(:disabled) { background: var(--bad-soft); }

.btn-lg { min-height: 3.25rem; padding: 0 1.5rem; font-size: 1.0625rem; border-radius: var(--r); }
.btn-sm { min-height: 2.125rem; padding: 0 .7rem; font-size: .8125rem; }
.btn-icon { min-height: 2.375rem; width: 2.375rem; padding: 0; }
.btn-block { width: 100%; }
.btn svg { width: 1.05em; height: 1.05em; flex: none; }

/* ---------- Fields -------------------------------------------------------- */
.field { display: grid; gap: .4rem; }
.field > label, .label {
  font-size: .8125rem; font-weight: 600; color: var(--ink-2); letter-spacing: -.004em;
}
.input, .textarea, .select {
  width: 100%; min-height: 2.75rem; padding: .6rem .8rem;
  border: 1px solid var(--line-2); border-radius: var(--r-sm);
  background: var(--surface); color: var(--ink);
  font-size: .9375rem; line-height: 1.5;
  transition: border-color .16s ease, box-shadow .16s ease;
}
.textarea { min-height: 6rem; resize: vertical; }
.input::placeholder, .textarea::placeholder { color: var(--ink-4); }
.input:focus, .textarea:focus, .select:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 20%, transparent);
}
.select {
  appearance: none; padding-inline-end: 2.25rem; cursor: pointer;
  background-image: linear-gradient(45deg, transparent 50%, currentColor 50%), linear-gradient(135deg, currentColor 50%, transparent 50%);
  background-position: calc(100% - 1.05rem) 1.2rem, calc(100% - .75rem) 1.2rem;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
}
.hint { font-size: .8125rem; line-height: 1.45; color: var(--ink-3); }
.range { width: 100%; accent-color: var(--brand); cursor: pointer; }

/* ---------- Chips / badges ------------------------------------------------ */
.chip {
  display: inline-flex; align-items: center; gap: .375rem;
  padding: .175rem .5rem;
  border: 1px solid var(--line-2); border-radius: var(--r-xs);
  background: var(--surface); color: var(--ink-2);
  font: 600 .75rem/1.5 var(--sans); white-space: nowrap;
}
.chip-brand { background: var(--brand-soft); border-color: var(--brand-line); color: var(--brand); }
.chip-ok    { background: var(--ok-soft);    border-color: var(--ok-line);    color: var(--ok); }
.chip-warn  { background: var(--warn-soft);  border-color: var(--warn-line);  color: var(--warn); }
.chip-bad   { background: var(--bad-soft);   border-color: var(--bad-line);   color: var(--bad); }
.chip-heat  { background: var(--heat-soft);  border-color: var(--heat-line);  color: var(--heat); }
.chip .dot { width: .4rem; height: .4rem; border-radius: 50%; background: currentColor; flex: none; }

/* ---------- Cards --------------------------------------------------------- */
.card {
  border: 1px solid var(--line); border-radius: var(--r);
  background: var(--surface);
  box-shadow: var(--shadow-1);
}
.card-pad { padding: 1.25rem; }

/* ---------- Segmented control --------------------------------------------- */
.segmented {
  display: inline-flex; padding: .1875rem; gap: .1875rem;
  border: 1px solid var(--line); border-radius: var(--r-sm);
  background: var(--sunken);
}
.segmented button {
  min-height: 2rem; padding: 0 .75rem;
  border-radius: var(--r-xs);
  color: var(--ink-3); font-size: .8125rem; font-weight: 600;
  transition: background-color .14s ease, color .14s ease;
}
.segmented button:hover:not(:disabled) { color: var(--ink); }
.segmented button:disabled { opacity: .45; cursor: not-allowed; }
.segmented button[aria-pressed="true"], .segmented button.is-active {
  background: var(--surface); color: var(--ink); box-shadow: var(--shadow-1);
}

/* ---------- Meter / progress ---------------------------------------------- */
.meter {
  position: relative; height: .5rem; overflow: hidden;
  border-radius: var(--r-pill); background: var(--sunken);
  border: 1px solid var(--line);
}
.meter > i {
  display: block; height: 100%; width: 0;
  border-radius: inherit; background: var(--brand);
  transition: width .3s cubic-bezier(.25, 1, .4, 1);
}
.meter[data-indeterminate="true"] > i {
  width: 35% !important;
  animation: fg-slide 1.15s ease-in-out infinite;
}
@keyframes fg-slide { 0% { transform: translateX(-110%); } 100% { transform: translateX(320%); } }

/* ---------- Notices ------------------------------------------------------- */
.notice {
  display: flex; gap: .75rem; align-items: flex-start;
  padding: .85rem 1rem;
  border: 1px solid var(--line-2); border-radius: var(--r-sm);
  background: var(--sunken); color: var(--ink-2);
  font-size: .9375rem; line-height: 1.5;
}
.notice strong { color: var(--ink); font-weight: 600; }
.notice-warn { background: var(--warn-soft); border-color: var(--warn-line); color: var(--warn); }
.notice-warn strong { color: inherit; }
.notice-bad  { background: var(--bad-soft);  border-color: var(--bad-line);  color: var(--bad); }
.notice-bad strong { color: inherit; }
.notice-brand { background: var(--brand-soft); border-color: var(--brand-line); color: var(--brand); }
.notice-brand strong { color: inherit; }

/* Toasts: bottom centre, one column, newest on top, gone in a few seconds. */
.toast-stack {
  position: fixed; inset-inline: 0; bottom: max(1rem, env(safe-area-inset-bottom)); z-index: 60;
  display: grid; justify-items: center; gap: .5rem; pointer-events: none;
}
.toast {
  max-width: min(28rem, calc(100% - 2rem)); padding: .65rem 1rem;
  border: 1px solid var(--line-2); border-radius: var(--r-sm);
  background: var(--surface); color: var(--ink); box-shadow: var(--shadow-3);
  font-size: .875rem; font-weight: 500; line-height: 1.4;
  opacity: 0; transform: translateY(8px) scale(.98);
  transition: opacity .2s cubic-bezier(.23, 1, .32, 1), transform .2s cubic-bezier(.23, 1, .32, 1);
}
.toast.is-in { opacity: 1; transform: none; }
.toast-ok { border-color: var(--ok-line); }
.toast-warn { border-color: var(--warn-line); color: var(--warn); }
.toast-bad { border-color: var(--bad-line); color: var(--bad); }
.notice svg { width: 1.15rem; height: 1.15rem; flex: none; margin-top: .125rem; }

/* ---------- Skeleton ------------------------------------------------------ */
.skeleton {
  border-radius: var(--r-xs);
  background: linear-gradient(90deg, var(--sunken) 25%, color-mix(in srgb, var(--sunken) 55%, var(--surface)) 50%, var(--sunken) 75%);
  background-size: 240% 100%;
  animation: fg-shimmer 1.4s linear infinite;
}
@keyframes fg-shimmer { to { background-position: -240% 0; } }

/* ============================================================================
   Header
   ========================================================================= */
.fg-header {
  position: sticky; top: 0; z-index: 40;
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--paper) 88%, transparent);
  backdrop-filter: blur(14px) saturate(150%);
}
.fg-header-inner {
  height: var(--header-h);
  display: flex; align-items: center; gap: 1.25rem;
}
.wordmark {
  display: inline-flex; align-items: center; gap: .5rem;
  color: var(--ink); text-decoration: none; flex: none;
}
.wordmark svg { width: 1.5rem; height: 1.5rem; border-radius: .45rem; }
.wordmark span {
  font-family: var(--display); font-weight: 700; font-size: 1.15rem;
  letter-spacing: -.032em;
}
.wordmark span i { font-style: normal; color: var(--brand); }

.fg-nav { display: flex; align-items: center; gap: .125rem; margin-inline-start: .5rem; flex: 1; min-width: 0; }
.nav-studios { display: flex; align-items: center; gap: .125rem; }
.fg-nav a {
  display: inline-flex; align-items: center; gap: .5rem;
  padding: .4rem .625rem; border-radius: var(--r-xs);
  color: var(--ink-2); font-size: .875rem; font-weight: 600; text-decoration: none;
  transition: background-color .14s ease, color .14s ease;
}
/* Icons are for the phone sheet, where each row needs a shape to scan by. In
   the bar the words are enough. */
.nav-studios a svg { display: none; color: var(--ink-3); }
.fg-nav a:hover { background: var(--sunken); color: var(--ink); }
/* The current page reads as a place, not a hover state: ink plus an
   underline in brand, which survives a screenshot in greyscale. */
.nav-studios a[aria-current="page"] { color: var(--ink); box-shadow: inset 0 -2px 0 var(--brand); border-radius: 0; }

.fg-header-actions { display: flex; align-items: center; gap: .5rem; flex: none; }

/* Search opens the command palette. It looks like a field because that is
   what it becomes. */
.search-trigger {
  display: inline-flex; align-items: center; gap: .5rem;
  height: 2.375rem; min-width: 11rem; padding: 0 .5rem 0 .7rem;
  border: 1px solid var(--line-2); border-radius: var(--r-sm);
  background: var(--sunken); color: var(--ink-3);
  font-size: .875rem; font-weight: 500;
  transition: border-color .14s ease, color .14s ease;
}
.search-trigger:hover { border-color: var(--brand-line); color: var(--ink-2); }
.search-trigger span { flex: 1; text-align: left; }
kbd {
  display: inline-flex; align-items: center; min-height: 1.35rem; padding: 0 .35rem;
  border: 1px solid var(--line-2); border-bottom-width: 2px; border-radius: 5px;
  background: var(--surface); color: var(--ink-3);
  font: 600 .6875rem/1 var(--sans); letter-spacing: .01em; white-space: nowrap;
}

/* The GPU the models run on, named. A link to the capability check. */
.device-tag {
  display: inline-flex; align-items: center; gap: .4rem;
  height: 2.375rem; padding: 0 .7rem;
  border: 1px solid var(--line-2); border-radius: var(--r-sm);
  background: var(--surface); color: var(--ink-2);
  font-size: .8125rem; font-weight: 600; text-decoration: none; white-space: nowrap;
  transition: border-color .14s ease, color .14s ease;
}
.device-tag svg { color: var(--ink-3); }
.device-tag:hover { border-color: var(--brand-line); color: var(--ink); }
.device-tag[data-state="ready"] svg { color: var(--ok); }
.device-tag[data-state="blocked"] { color: var(--bad); border-color: var(--bad-line); background: var(--bad-soft); }
.device-tag[data-state="blocked"] svg { color: currentColor; }

@keyframes fg-pulse { 50% { opacity: .35; } }

.theme-toggle { color: var(--ink-3); border: 1px solid var(--line-2); border-radius: var(--r-sm); background: var(--surface); }
.theme-toggle:hover { background: var(--sunken); color: var(--ink); }
.theme-toggle svg { width: 1.05rem; height: 1.05rem; margin-inline: auto; }
/* The button shows the mode it will switch *to*: a moon while light, a sun
   while dark. Explicit [data-theme] rules come last so the toggle beats the
   system preference in both directions. */
.theme-toggle .i-sun { display: none; }
.theme-toggle .i-moon { display: block; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-toggle .i-sun { display: block; }
  :root:not([data-theme="light"]) .theme-toggle .i-moon { display: none; }
}
:root[data-theme="dark"] .theme-toggle .i-sun { display: block; }
:root[data-theme="dark"] .theme-toggle .i-moon { display: none; }
:root[data-theme="light"] .theme-toggle .i-sun { display: none; }
:root[data-theme="light"] .theme-toggle .i-moon { display: block; }

.nav-toggle { display: none; }

/* The overflow menu. A details element, so it works before any script runs. */
.nav-more { position: relative; }
.nav-more > summary {
  list-style: none; display: inline-flex; align-items: center; gap: .25rem;
  padding: .4rem .625rem; border-radius: var(--r-xs); cursor: pointer;
  color: var(--ink-3); font-size: .875rem; font-weight: 600;
  transition: background-color .14s ease, color .14s ease;
}
.nav-more > summary::-webkit-details-marker { display: none; }
.nav-more > summary svg { transition: transform .16s ease; }
.nav-more[open] > summary svg { transform: rotate(90deg); }
.nav-more > summary:hover, .nav-more[open] > summary, .nav-more.is-current > summary { background: var(--sunken); color: var(--ink); }
.nav-menu {
  position: absolute; top: calc(100% + .375rem); left: 0; z-index: 50;
  display: grid; min-width: 14rem; padding: .375rem;
  border: 1px solid var(--line); border-radius: var(--r-sm);
  background: var(--surface); box-shadow: var(--shadow-3);
  transform-origin: top left;
  animation: fg-pop .16s cubic-bezier(.23, 1, .32, 1) both;
}
@keyframes fg-pop { from { opacity: 0; transform: scale(.96) translateY(-2px); } to { opacity: 1; transform: none; } }
.nav-menu { min-width: 19rem; }
.nav-menu a { display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: start; gap: .7rem; padding: .6rem .7rem; }
.nav-menu a svg { margin-top: .15rem; color: var(--ink-3); }
.nav-menu a span { display: grid; gap: .1rem; }
.nav-menu a b { font-weight: 600; color: var(--ink); }
.nav-menu a small { font-size: .8125rem; font-weight: 500; color: var(--ink-3); }
.nav-menu a[aria-current="page"] { background: var(--brand-soft); }

/* ============================================================================
   Home
   ========================================================================= */

/* Motion. Every animation below is opt-out via prefers-reduced-motion, and
   nothing load-bearing depends on it: the page is complete and readable with
   all of it disabled. */
@keyframes fg-rise {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: none; }
}
@keyframes fg-fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes fg-sweep {
  from { transform: translate3d(-12%, -6%, 0) scale(1); }
  to { transform: translate3d(12%, 6%, 0) scale(1.15); }
}
@keyframes fg-draw { to { stroke-dashoffset: 0; } }

.hero {
  position: relative;
  display: grid; align-items: center;
  grid-template-columns: minmax(0, 1.08fr) minmax(0, .92fr);
  gap: clamp(2rem, 5vw, 4.5rem);
  padding-block: clamp(3rem, 7vw, 5.5rem) clamp(2.5rem, 5vw, 4rem);
  isolation: isolate;
}
.hero-copy { min-width: 0; }
.hero .t-display { font-size: clamp(2.6rem, 5vw, 4.25rem); }

/* A soft, slow-drifting wash behind the headline. Purely atmospheric, drawn
   with gradients rather than an image so it costs nothing to load. */
.hero-glow {
  position: absolute; z-index: -1; inset: -18% -12% auto -22%;
  height: 130%;
  pointer-events: none;
  background:
    radial-gradient(38% 46% at 22% 32%, color-mix(in srgb, var(--brand) 26%, transparent), transparent 70%),
    radial-gradient(32% 40% at 68% 24%, color-mix(in srgb, var(--heat) 16%, transparent), transparent 72%),
    radial-gradient(30% 34% at 48% 68%, color-mix(in srgb, var(--brand) 14%, transparent), transparent 70%);
  filter: blur(14px);
  opacity: .55;
  animation: fg-sweep 24s ease-in-out infinite alternate;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .hero-glow { opacity: .42; }
}
:root[data-theme="dark"] .hero-glow { opacity: .42; }
.hero h1 { margin-block: 1.25rem 1rem; max-width: 19ch; }
/* The one loud thing on the page: the visitor's own hardware, named, set
   like the label on a component. It is live data, not decoration, which is
   why it is the only phrase treated differently. */
/* The server's headline, before the app runs: a cached GPU name is shown in
   place of the default wording (see theme-init.js). */
html[data-gpu] .gpu-name.is-static .gpu-default { display: none; }
html[data-gpu] .gpu-name.is-static::before { content: var(--gpu-name); }
.gpu-name {
  display: inline-block; white-space: nowrap;
  padding: 0 .16em .04em; margin-inline: -.04em;
  border-radius: .16em;
  background: linear-gradient(100deg, color-mix(in srgb, var(--brand) 18%, transparent), color-mix(in srgb, var(--brand) 6%, transparent));
  box-shadow: inset 0 0 0 .035em color-mix(in srgb, var(--brand) 45%, transparent);
  color: var(--brand);
}
.hero-copy > .t-lead { max-width: 54ch; }
.hero-actions { display: flex; flex-wrap: wrap; gap: .75rem; margin-top: 1.75rem; }
.hero-note { margin-top: .75rem; font-size: .875rem; color: var(--ink-3); }
.hero-proof {
  display: flex; flex-wrap: wrap; gap: 1.25rem 1.75rem;
  margin-top: 2rem; padding-top: 1.5rem; border-top: 1px solid var(--line);
}
.hero-proof div { display: grid; gap: .1rem; }
.hero-proof dt { font-size: .8125rem; color: var(--ink-3); }
.hero-proof dd { font-family: var(--display); font-weight: 700; font-size: 1.05rem; letter-spacing: -.02em; }

/* Six real outputs as a contact sheet. The middle column sits lower so the
   block reads as a collection rather than a table; each tile opens its recipe.
   Thumbnails are 256 px and are never shown larger than that. */
.hero-gallery { margin: 0; display: grid; gap: 1rem; justify-items: center; }
.hero-tiles {
  display: grid; gap: clamp(.6rem, 1.2vw, .9rem);
  grid-template-columns: repeat(3, minmax(0, 11rem));
  padding-bottom: 1.75rem;
}
.hero-tile {
  position: relative; display: block; overflow: hidden;
  aspect-ratio: 1; border-radius: var(--r);
  background: var(--sunken); box-shadow: var(--shadow-2);
  outline: 1px solid color-mix(in srgb, var(--ink) 8%, transparent); outline-offset: -1px;
  animation: fg-rise .7s cubic-bezier(.22, 1, .36, 1) both;
  animation-delay: calc(.15s + var(--i, 0) * .06s);
  transition: transform .25s cubic-bezier(.22, 1, .36, 1), box-shadow .25s ease;
}
.hero-tile:nth-child(3n + 2) { translate: 0 1.75rem; }
.hero.is-settled .hero-tile { animation: none; }
.hero-tile:hover, .hero-tile:focus-visible { transform: translateY(-4px) scale(1.02); box-shadow: var(--shadow-3); z-index: 1; }
.hero-tile img { width: 100%; height: 100%; object-fit: cover; }
.hero-tile-caption {
  position: absolute; inset: auto 0 0; display: grid; gap: .15rem;
  padding: 2rem .65rem .6rem;
  background: linear-gradient(to top, rgba(10, 8, 16, .88), rgba(10, 8, 16, 0));
  color: #fff; font-size: .75rem; line-height: 1.3; font-weight: 500;
  opacity: 0; translate: 0 .5rem;
  transition: opacity .2s ease, translate .2s ease;
}
.hero-tile-caption small { font-size: .6875rem; opacity: .7; }
.hero-tile:hover .hero-tile-caption, .hero-tile:focus-visible .hero-tile-caption { opacity: 1; translate: 0 0; }
.hero-gallery-note { max-width: 38ch; text-align: center; font-size: .8125rem; line-height: 1.45; color: var(--ink-3); }

.section { padding-block: clamp(2.5rem, 5vw, 4rem); }

.section-head {
  display: flex; flex-wrap: wrap; align-items: end; justify-content: space-between;
  gap: 1rem; margin-bottom: 1.5rem;
}
.section-head > div { display: grid; gap: .5rem; }
.section-head h2 { max-width: 22ch; }
.section-head p.t-sm { max-width: 52ch; }

/* Seven studios as a bento: the featured one is two by two, the last two are
   two wide, and every row is full. Four tracks on a desk, two on a tablet,
   one on a phone; the spans are dropped as the tracks run out. */
.studio-grid {
  display: grid; gap: 1rem;
  grid-template-columns: repeat(4, minmax(0, 1fr));
}
.studio-card.is-featured { grid-column: span 2; grid-row: span 2; }
.studio-card.studio-edit, .studio-card.studio-shape { grid-column: span 2; }
@media (max-width: 68rem) {
  .studio-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .studio-card.is-featured { grid-row: auto; }
  .studio-card.studio-edit, .studio-card.studio-shape { grid-column: auto; }
}
@media (max-width: 34rem) {
  .studio-grid { grid-template-columns: minmax(0, 1fr); }
  .studio-card.is-featured { grid-column: auto; }
}

/* The featured tile: the studio's idea in one look, a sentence in and a
   picture out, beside the usual card text. */
.studio-card.is-featured {
  display: grid; align-content: start; column-gap: 1.5rem;
  grid-template-columns: minmax(0, 1fr) minmax(9rem, 16rem);
  grid-template-areas: "top cover" "title cover" "text cover" "models cover";
  grid-template-rows: auto auto auto 1fr;
  background:
    radial-gradient(120% 90% at 100% 0%, color-mix(in srgb, var(--brand) 10%, transparent), transparent 60%),
    var(--surface);
}
.studio-card.is-featured > .studio-card-top { grid-area: top; }
.studio-card.is-featured > h3 { grid-area: title; font-size: clamp(1.35rem, 2.2vw, 1.75rem); letter-spacing: -.026em; }
.studio-card.is-featured > p:not(.studio-facts) { grid-area: text; font-size: 1rem; flex: none; }
.studio-models { grid-area: models; align-self: end; display: grid; border-top: 1px solid var(--line); }
.studio-models li {
  display: flex; align-items: baseline; justify-content: space-between; gap: 1rem;
  padding-block: .5rem; border-bottom: 1px solid var(--line); font-size: .875rem;
}
.studio-models li:last-child { border-bottom: 0; }
.studio-models b { font-weight: 600; color: var(--ink); }
.studio-models span { font-size: .8125rem; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.studio-cover { grid-area: cover; align-self: center; margin: 0; display: grid; gap: .55rem; max-width: 16rem; }
.studio-cover img {
  width: 100%; height: auto; aspect-ratio: 1; object-fit: cover; border-radius: var(--r-sm);
  box-shadow: var(--shadow-2);
  transition: transform .35s cubic-bezier(.22, 1, .36, 1);
}
.studio-card.is-featured:hover .studio-cover img { transform: scale(1.03) rotate(.6deg); }
.studio-cover-prompt {
  display: block; padding: .45rem .6rem;
  border: 1px solid var(--line-2); border-radius: var(--r-xs);
  background: var(--sunken); color: var(--ink-2);
  font: 500 .75rem/1.35 var(--mono);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.studio-cover-prompt::after {
  content: ""; display: inline-block; width: .45em; height: 1em; margin-left: .2em;
  vertical-align: -.15em; background: var(--brand);
  animation: fg-caret 1.1s steps(1) infinite;
}
@keyframes fg-caret { 50% { opacity: 0; } }
@media (max-width: 34rem) {
  .studio-card.is-featured {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas: "top" "cover" "title" "text" "models";
    grid-template-rows: none; row-gap: .75rem;
  }
  .studio-cover { max-width: 13rem; }
}
.studio-card {
  position: relative; display: flex; flex-direction: column; gap: .75rem;
  padding: 1.25rem;
  border: 1px solid var(--line); border-radius: var(--r);
  background: var(--surface); color: inherit; text-decoration: none;
  box-shadow: var(--shadow-1);
  transition: border-color .16s ease, box-shadow .16s ease, transform .16s ease;
}
.studio-card:hover { border-color: var(--brand-line); }
.studio-card:hover h3 { color: var(--brand); }
.studio-card-top { display: flex; align-items: center; justify-content: space-between; gap: .75rem; }
.studio-icon {
  display: grid; place-items: center; width: 2.5rem; height: 2.5rem; flex: none;
  border-radius: var(--r-sm); background: var(--brand-soft); color: var(--brand);
}
.studio-icon svg { width: 1.3rem; height: 1.3rem; }
.studio-card h3 { font-size: 1.125rem; }
.studio-card p { font-size: .9375rem; line-height: 1.5; color: var(--ink-2); }
.studio-card h3 { transition: color .14s ease; }
/* Two facts, set as plain words in the card's last line. */
.studio-facts { display: flex; flex-wrap: wrap; gap: .25rem 1rem; margin-top: auto; padding-top: .75rem; border-top: 1px solid var(--line); font-size: .8125rem; color: var(--ink-3); }
.studio-facts span:first-child { color: var(--ink-2); font-weight: 600; }

/* How it works */
.steps {
  display: grid; gap: 1.25rem;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 17rem), 1fr));
  counter-reset: step;
}
.step {
  position: relative;
  display: grid; gap: .65rem;
  padding-top: 1.25rem;
  border-top: 2px solid var(--line-2);
}
.step { border-top-color: var(--brand); align-content: start; }
.step-number {
  display: grid; place-items: center; width: 1.75rem; height: 1.75rem;
  border-radius: 50%; background: var(--brand-soft); color: var(--brand);
  font: 700 .875rem/1 var(--display);
}
.built-on { margin-top: 2rem; max-width: 70ch; font-size: .9375rem; line-height: 1.6; color: var(--ink-3); }
.built-on a { color: var(--ink-2); font-weight: 600; }
.closing-actions { display: flex; flex-wrap: wrap; gap: .75rem; }
.tier-name { font-size: .875rem; font-weight: 600; color: var(--brand); }
.step h3 { font-size: 1.125rem; }
.step p { max-width: 34ch; }

/* The verify page and the changelog on it. */
/* The crawler text the server writes under the home hero. It is replaced as
   soon as the app runs, but a reader without JavaScript should get margins. */
/* Before the app arrives. The server's page carries a plain summary for
   crawlers and readers without scripts; a browser that will run the app skips
   it, and a studio shows the outline of its panels instead, so a reload does
   not flash unstyled text and then rebuild the page. */
.js #fg-main .route-content { display: none; }
html:not(.js) .studio-outline { display: none; }
.outline-panel { box-shadow: none; }
.outline-panel.is-side { min-height: 17rem; }
.outline-panel.is-main { min-height: 30rem; }

#fg-main > .prose { width: var(--shell); margin-inline: auto; padding-block: 1rem 3rem; display: grid; gap: .75rem; color: var(--ink-2); }
#fg-main > .prose ul { display: grid; gap: .5rem; }

/* /privacy and /terms: plain pages that share the header and footer. */
.policy-page { max-width: 46rem; padding-block: 4rem; }
.policy-panel { margin-top: 2.5rem; }

/* /blog and its posts: static articles, sized for reading rather than for studios. */
.blog-page { max-width: 44rem; padding-block: 3.5rem 4rem; }
.blog-crumbs { color: var(--ink-3); }
.blog-crumbs a { color: inherit; }
.blog-title { margin-top: 1rem; }
.blog-page > .t-lead { margin-top: 1rem; max-width: 40rem; }
.blog-list { list-style: none; padding: 0; margin: 2.5rem 0 0; display: grid; }
.blog-item { padding-block: 1.5rem; border-top: 1px solid var(--line); }
.blog-item:last-child { border-bottom: 1px solid var(--line); }
.blog-item a { color: var(--ink); text-decoration: none; }
.blog-item a:hover h2, .blog-item a:focus-visible h2 { color: var(--brand); }
.blog-item h2 { font-family: var(--display); font-size: 1.5rem; line-height: 1.2; letter-spacing: -.02em; }
.blog-item p { margin-top: .5rem; color: var(--ink-2); line-height: 1.6; }
.blog-meta { color: var(--ink-3); font-size: .875rem; font-variant-numeric: tabular-nums; }
.blog-item .blog-meta { margin-top: .625rem; }

.blog-article-head { margin-top: 1.25rem; }
.blog-article-head h1 { font-family: var(--display); font-weight: 700; font-size: clamp(2rem, 4.6vw, 3rem); line-height: 1.08; letter-spacing: -.03em; text-wrap: balance; }
.blog-article-head .blog-meta { margin-top: .875rem; }
.blog-prose { margin-top: 2.25rem; font-size: 1.0625rem; line-height: 1.72; color: var(--ink-2); }
.blog-prose > * + * { margin-top: 1.15em; }
.blog-prose h2 { margin-top: 2.4em; font-family: var(--display); font-size: 1.5rem; line-height: 1.25; letter-spacing: -.015em; color: var(--ink); }
.blog-prose h2 + p { margin-top: .75em; }
.blog-prose a { color: var(--brand); text-underline-offset: .18em; }
.blog-prose em { color: var(--ink); }
.blog-prose code { font-family: var(--mono); font-size: .86em; padding: .08em .35em; border-radius: var(--r-xs); background: var(--sunken); color: var(--ink); overflow-wrap: anywhere; }
.blog-prose pre { padding: 1rem 1.125rem; border-radius: var(--r-sm); background: var(--sunken); border: 1px solid var(--line); overflow-x: auto; font-size: .875rem; line-height: 1.6; }
.blog-prose pre code { padding: 0; background: none; font-size: inherit; overflow-wrap: normal; }
.blog-prose ul, .blog-prose ol { padding-left: 1.25rem; display: grid; gap: .5em; }
.blog-prose table { width: 100%; border-collapse: collapse; font-size: .9375rem; line-height: 1.45; font-variant-numeric: tabular-nums; display: block; overflow-x: auto; }
.blog-prose th, .blog-prose td { padding: .6rem .75rem; text-align: left; border-bottom: 1px solid var(--line); vertical-align: top; }
.blog-prose th { color: var(--ink); font-weight: 600; border-bottom-color: var(--line-2); }
.blog-prose td:not(:first-child), .blog-prose th:not(:first-child) { text-align: right; white-space: nowrap; }
.blog-prose figure img { width: 100%; height: auto; border-radius: var(--r-sm); border: 1px solid var(--line); }
.blog-prose figcaption { margin-top: .5rem; font-size: .875rem; color: var(--ink-3); }
.blog-more { margin-top: 3.5rem; padding-top: 1.5rem; border-top: 1px solid var(--line); color: var(--ink-2); line-height: 1.6; }
.blog-more a { color: var(--brand); }
.blog-more p + p { margin-top: .75rem; }

.prose-page { display: grid; gap: 1rem; padding-block-end: 3rem; }
.prose-page .studio-head { margin-bottom: .5rem; }
.prose-page .steps { counter-reset: none; grid-template-columns: repeat(auto-fit, minmax(min(100%, 13rem), 1fr)); }
.prose-page .step p { max-width: 62ch; }
.plain-list { display: grid; gap: .4rem; margin: 0; padding-left: 1.1rem; font-size: .9375rem; line-height: 1.55; color: var(--ink-2); }
.plain-list a { display: inline-flex; align-items: center; gap: .2rem; text-decoration: underline; }
.log-entry { display: grid; gap: .5rem; padding-block: 1rem; border-top: 1px solid var(--line); }
.log-entry:first-child { border-top: 0; padding-top: 0; }
.log-entry h3 { font-size: 1.125rem; }
.wire-list { display: grid; gap: .75rem; grid-template-columns: repeat(auto-fit, minmax(min(100%, 16rem), 1fr)); }
.wire-item { display: grid; gap: .35rem; padding: .9rem 1rem; border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--sunken); }
.wire-item h3 { font-size: .9375rem; }
.wire-item p { color: var(--ink-2); }

/* The hand-off to ShareMyAI: a quiet row, shown only where it is the honest answer. */
.bridge {
  display: grid; grid-template-columns: auto 1fr auto; gap: .75rem; align-items: center;
  margin-top: .75rem; padding: .8rem .9rem;
  border: 1px dashed var(--line-2); border-radius: var(--r-sm); background: var(--surface);
  color: var(--ink-2); font-size: .875rem; line-height: 1.5;
}
.bridge > svg { color: var(--ink-3); }
.bridge p { margin: 0; }
.bridge .t-xs { margin-top: .2rem; color: var(--ink-3); }
@media (max-width: 640px) { .bridge { grid-template-columns: auto 1fr; } .bridge .btn { grid-column: 2; justify-self: start; } }

/* Closing block */
.closing {
  display: flex; flex-wrap: wrap; align-items: end; justify-content: space-between; gap: 1.5rem;
  padding-top: 2rem; border-top: 1px solid var(--line);
}
.closing > div:first-child { display: grid; gap: .6rem; max-width: 44ch; }

/* Device panel */
.device-panel {
  display: grid; gap: 1.5rem;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, .9fr);
  padding: clamp(1.25rem, 2.5vw, 1.75rem);
  border: 1px solid var(--line); border-radius: var(--r-lg);
  background: var(--surface); box-shadow: var(--shadow-2);
}
.device-copy { display: grid; gap: .85rem; align-content: start; }
.device-copy h2 { max-width: 18ch; }
.device-actions { display: flex; flex-wrap: wrap; align-items: center; gap: .75rem; margin-top: .35rem; }

.device-readout { display: grid; gap: .85rem; align-content: start; }
.tier-gauge { display: grid; gap: .5rem; }
.tier-scale { display: flex; justify-content: space-between; font: 500 .75rem/1 var(--mono); color: var(--ink-3); }
.tier-bar { position: relative; height: 2.5rem; border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--sunken); overflow: hidden; }
.tier-bar > i {
  position: absolute; inset: 0 auto 0 0; width: 0;
  background: linear-gradient(90deg, color-mix(in srgb, var(--brand) 22%, transparent), color-mix(in srgb, var(--brand) 45%, transparent));
  border-right: 2px solid var(--brand);
  transition: width .55s cubic-bezier(.25, 1, .4, 1);
}
.tier-bar > b {
  position: absolute; inset-block: 0; inset-inline-start: .7rem;
  display: flex; align-items: center;
  font: 600 .8125rem/1 var(--sans); color: var(--ink-2);
}
.facts { display: grid; gap: 0; border-top: 1px solid var(--line); }
.facts > div {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  padding: .55rem 0; border-bottom: 1px solid var(--line);
}
.facts dt { font-size: .8125rem; color: var(--ink-3); }
.facts dd { font: 500 .8125rem/1.4 var(--mono); color: var(--ink); text-align: right; }

/* ============================================================================
   Studio shell
   ========================================================================= */
.studio {
  display: grid;
  grid-template-columns: 19rem minmax(0, 1fr);
  gap: 1.25rem;
  padding-block: 1.5rem 3rem;
  align-items: start;
}
.studio-side { display: grid; gap: 1rem; position: sticky; top: calc(var(--header-h) + 1.25rem); }
.studio-main { min-width: 0; display: grid; gap: 1rem; }

.studio-head { display: grid; gap: .5rem; padding-block: 1.75rem 0; }
.studio-head .breadcrumb {
  display: inline-flex; align-items: center; gap: .4rem;
  font-size: .8125rem; color: var(--ink-3);
}
.studio-head .breadcrumb a { color: var(--ink-3); text-decoration: none; font-weight: 600; }
.studio-head .breadcrumb a:hover { color: var(--brand); }
.studio-head h1 { font-size: clamp(1.6rem, 3vw, 2.1rem); }

/* A studio's head: its icon and name on the left, and on the right the one
   line about privacy that every studio shares. */
.studio-head.has-icon {
  grid-template-columns: minmax(0, 1fr) auto; align-items: end; column-gap: 2rem;
}
.studio-head.has-icon .breadcrumb { grid-column: 1 / -1; }
.studio-title { display: flex; align-items: center; gap: 1rem; min-width: 0; }
.studio-title > div { display: grid; gap: .3rem; min-width: 0; }
.studio-title .studio-icon { width: 3.25rem; height: 3.25rem; border-radius: var(--r); }
.studio-title .studio-icon svg { width: 1.5rem; height: 1.5rem; }
.studio-trust {
  display: flex; align-items: center; gap: .5rem; max-width: 30ch;
  font-size: .8125rem; line-height: 1.45; color: var(--ink-3);
}
.studio-trust svg { flex: none; color: var(--ok); }
.studio-trust a { color: var(--ink-2); font-weight: 600; }
@media (max-width: 48rem) {
  .studio-head.has-icon { grid-template-columns: minmax(0, 1fr); row-gap: .75rem; }
  .studio-title { align-items: flex-start; }
  .studio-title .studio-icon { width: 2.75rem; height: 2.75rem; }
  .studio-trust { max-width: none; }
}

.panel {
  border: 1px solid var(--line); border-radius: var(--r);
  background: var(--surface); box-shadow: var(--shadow-1);
}
.panel-head {
  display: flex; align-items: center; justify-content: space-between; gap: .75rem;
  padding: .8rem 1rem; border-bottom: 1px solid var(--line);
}
.panel-head h2, .panel-head h3 { font-size: .9375rem; letter-spacing: -.01em; }
.panel-body { padding: 1rem; display: grid; gap: .9rem; }

/* The step up offered after a first result on a small model. */
.upgrade-offer {
  display: grid; gap: .65rem; padding: .85rem 1rem;
  border: 1px solid var(--brand-line); border-radius: var(--r-sm);
  background: var(--brand-soft); color: var(--ink-2);
  font-size: .9063rem; line-height: 1.5;
}
.upgrade-offer[hidden] { display: none; }
.upgrade-offer strong { color: var(--ink); font-weight: 600; }
.upgrade-actions { display: flex; flex-wrap: wrap; gap: .5rem; }

/* Under a task page's tool: what does the work, and the usual questions. */
.task-about {
  display: grid; gap: .85rem; max-width: 68ch;
  margin-top: 3rem; padding-top: 2rem; border-top: 1px solid var(--line);
  color: var(--ink-2); font-size: 1rem; line-height: 1.65;
}
.task-about h2 { font-size: 1.25rem; color: var(--ink); letter-spacing: -.01em; }
.task-about h2:not(:first-child) { margin-top: 1.25rem; }
.task-about p { margin: 0; }
.faq { display: grid; gap: 1.1rem; }
.faq-item { display: grid; gap: .3rem; }
.faq-item h3 { font-size: 1rem; font-weight: 600; color: var(--ink); }

/* Model loader */
.loader-state { display: grid; gap: .6rem; }
.loader-line { display: flex; align-items: baseline; justify-content: space-between; gap: .75rem; }
.loader-line span:last-child { white-space: nowrap; }
.error-detail { margin-top: .5rem; }
.error-detail summary { cursor: pointer; font-size: .8125rem; font-weight: 600; }
.error-detail code {
  display: block; margin-top: .4rem; padding: .5rem .6rem;
  border-radius: var(--r-xs); background: color-mix(in srgb, var(--ink) 8%, transparent);
  font: 500 .75rem/1.5 var(--mono); overflow-wrap: anywhere;
}
.loader-line span:first-child { font-size: .875rem; font-weight: 600; }
.loader-line span:last-child { font: 500 .8125rem/1 var(--mono); color: var(--ink-3); }
.loader-files { display: grid; gap: .4rem; max-height: 9rem; overflow-y: auto; }
.loader-file { display: grid; gap: .25rem; }
.loader-file-top { display: flex; justify-content: space-between; gap: .5rem; font: 500 .75rem/1.3 var(--mono); color: var(--ink-3); }
.loader-file-top b { font-weight: 500; color: var(--ink-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- Chat ---------------------------------------------------------- */
/* The conversation takes the window's height, less the header, the page title
   and the composer, so a chat reads as a workspace rather than a box on a
   page. It never drops below a usable height on a short window. */
.chat-log {
  display: grid; gap: 1rem; align-content: start;
  height: clamp(22rem, calc(100dvh - 23rem), 60rem);
  overflow-y: auto; overscroll-behavior: contain; padding: 1.25rem;
  scroll-behavior: smooth;
}
.chat-log:has(> .chat-empty) { align-content: center; }
@media (max-width: 60rem) { .chat-log { height: clamp(20rem, 70dvh, 44rem); } }
.chat-empty {
  display: grid; gap: 1rem; place-content: center; justify-items: center;
  text-align: center; padding: 2.5rem 1rem; color: var(--ink-3);
}
.chat-empty .studio-icon { width: 3rem; height: 3rem; }
.chat-empty h3 { color: var(--ink); }
.chat-starters { display: flex; flex-wrap: wrap; gap: .5rem; justify-content: center; max-width: 34rem; }

.msg { display: grid; gap: .375rem; max-width: 46rem; }
.msg-role { font: 600 .75rem/1 var(--mono); letter-spacing: .07em; text-transform: uppercase; color: var(--ink-3); }
.msg-body { font-size: .96875rem; line-height: 1.65; color: var(--ink); white-space: pre-wrap; overflow-wrap: anywhere; }
.msg-user { justify-self: end; }
.msg-user .msg-role { text-align: right; color: var(--brand); }
/* Rendered model output. `white-space: pre-wrap` is dropped here because the
   Markdown pass has already turned the layout into real elements. */
.md { white-space: normal; }
.md > :first-child { margin-top: 0; }
.md > :last-child { margin-bottom: 0; }
.md p { margin-block: .6em; }
.md h3, .md h4, .md h5, .md h6 {
  margin-block: 1em .45em;
  font-family: var(--display); letter-spacing: -.015em;
}
.md h3 { font-size: 1.0625rem; }
.md h4, .md h5, .md h6 { font-size: .96875rem; }
.md ul, .md ol { margin-block: .6em; padding-inline-start: 1.35rem; display: grid; gap: .3em; }
.md ul li { list-style: disc; }
.md ol li { list-style: decimal; }
.md li::marker { color: var(--ink-3); }
.md strong { font-weight: 700; }
.md code {
  padding: .1em .35em; border-radius: var(--r-xs);
  background: color-mix(in srgb, var(--ink) 8%, transparent);
  font: 500 .875em/1.4 var(--mono);
}
.md pre {
  margin-block: .75em; padding: .8rem .9rem; overflow-x: auto;
  border: 1px solid var(--line); border-radius: var(--r-sm);
  background: var(--sunken);
}
.md pre code { padding: 0; background: none; font-size: .8125rem; line-height: 1.6; }
.md blockquote {
  margin-block: .75em; padding: .1em 0 .1em .9rem;
  border-inline-start: 2px solid var(--brand-line); color: var(--ink-2);
}
.md hr { margin-block: 1em; border: 0; border-top: 1px solid var(--line); }
.md a { text-decoration: underline; }

.msg-user .msg-body {
  padding: .7rem .9rem; border-radius: var(--r) var(--r) var(--r-xs) var(--r);
  background: var(--brand-soft); border: 1px solid var(--brand-line); color: var(--ink);
}
.msg-think {
  margin-bottom: .5rem; padding: .6rem .75rem;
  border-inline-start: 2px solid var(--line-2);
  color: var(--ink-3); font-size: .875rem; line-height: 1.55; white-space: pre-wrap;
}
.msg-meta { font: 500 .75rem/1 var(--mono); color: var(--ink-4); }
.caret::after {
  content: ""; display: inline-block; width: .5rem; height: 1.05em;
  margin-inline-start: .15rem; vertical-align: text-bottom;
  background: var(--brand); animation: fg-blink 1s steps(2, start) infinite;
}
@keyframes fg-blink { 50% { opacity: 0; } }

/* Saved conversations */
.thread-list { display: grid; max-height: 22rem; overflow-y: auto; }
.thread-row { display: flex; align-items: center; gap: .25rem; border-bottom: 1px solid var(--line); }
.thread-list .thread-row:last-child { border-bottom: 0; }
.thread-row.is-current { background: var(--brand-soft); border-radius: var(--r-xs); }
.thread-open {
  flex: 1; min-width: 0; display: grid; gap: .1rem; padding: .55rem .5rem;
  border-radius: var(--r-xs); text-align: left;
}
.thread-open:hover { background: var(--sunken); }
.thread-open strong {
  font-size: .875rem; font-weight: 600;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.thread-row .btn { flex: none; }

.composer { display: grid; gap: .625rem; padding: 1rem; border-top: 1px solid var(--line); }
.composer-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: .5rem; align-items: end; }
.composer textarea {
  min-height: 2.75rem; max-height: 12rem; resize: none; overflow-y: auto;
}
.composer-foot { display: flex; align-items: center; justify-content: space-between; gap: .75rem; flex-wrap: wrap; }
.composer.is-over { outline: 2px dashed var(--brand-line); outline-offset: -6px; }

/* Files waiting to go with the next message. */
.attach-row { display: flex; flex-wrap: wrap; gap: .4rem; }
.attach-chip {
  display: inline-flex; align-items: center; gap: .45rem; max-width: 100%;
  padding: .3rem .5rem .3rem .45rem; border: 1px solid var(--line); border-radius: var(--r-xs);
  background: var(--sunken); color: var(--ink-2); font-size: .8125rem;
}
.attach-chip img { width: 1.75rem; height: 1.75rem; object-fit: cover; border-radius: 4px; }
.attach-chip > span { display: grid; line-height: 1.2; min-width: 0; }
.attach-chip b { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 14rem; }
.attach-chip small { color: var(--ink-3); font-size: .7rem; }
.attach-remove { display: grid; place-items: center; width: 1.25rem; height: 1.25rem; border-radius: 50%; color: var(--ink-3); }
.attach-remove:hover { background: var(--line); color: var(--ink); }

/* Per-message actions sit in the footer line, quiet until hovered. */
.msg-foot { display: flex; align-items: center; justify-content: space-between; gap: .75rem; flex-wrap: wrap; }
.msg-actions { display: inline-flex; gap: .25rem; }
.msg-action {
  display: inline-flex; align-items: center; gap: .3rem; padding: .2rem .45rem;
  border-radius: var(--r-xs); color: var(--ink-3); font-size: .75rem; font-weight: 600;
}
.msg-action:hover { background: var(--sunken); color: var(--ink); }
.msg-image { max-width: min(100%, 18rem); max-height: 14rem; border-radius: var(--r-xs); border: 1px solid var(--line); justify-self: end; }

/* The settings disclosure reuses the panel head as its summary. */
.chat-settings > summary { list-style: none; cursor: pointer; }
.chat-settings > summary::-webkit-details-marker { display: none; }
.chat-settings > summary svg { color: var(--ink-3); }
.chat-settings[open] > summary svg { color: var(--brand); }

/* ---------- Dropzone / media --------------------------------------------- */
.dropzone {
  display: grid; gap: .75rem; place-items: center; text-align: center;
  padding: 2.25rem 1.25rem;
  border: 1.5px dashed var(--line-2); border-radius: var(--r);
  background: var(--sunken); color: var(--ink-3);
  transition: border-color .16s ease, background-color .16s ease, color .16s ease;
}
.dropzone:hover, .dropzone.is-over { border-color: var(--brand); background: var(--brand-soft); color: var(--brand); }
.dropzone svg { width: 1.75rem; height: 1.75rem; }
.dropzone strong { color: var(--ink); font-weight: 600; }
.dropzone.is-over strong { color: inherit; }

.media-stage {
  display: grid; gap: 1rem;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 18rem), 1fr));
}
.media-slot { display: grid; gap: .5rem; }
.media-slot h3 { font-size: .875rem; font-family: var(--sans); font-weight: 600; color: var(--ink-2); }
.media-frame {
  position: relative; display: grid; place-items: center;
  min-height: 12rem; padding: .5rem; overflow: hidden;
  border: 1px solid var(--line); border-radius: var(--r-sm);
  background-color: var(--sunken);
  background-image:
    linear-gradient(45deg, color-mix(in srgb, var(--ink) 6%, transparent) 25%, transparent 25%, transparent 75%, color-mix(in srgb, var(--ink) 6%, transparent) 75%),
    linear-gradient(45deg, color-mix(in srgb, var(--ink) 6%, transparent) 25%, transparent 25%, transparent 75%, color-mix(in srgb, var(--ink) 6%, transparent) 75%);
  background-size: 18px 18px;
  background-position: 0 0, 9px 9px;
}
.media-frame img, .media-frame canvas { max-height: 26rem; width: auto; border-radius: var(--r-xs); }

/* Click-to-select: markers are positioned as a percentage of the image box, so
   they stay put no matter what size the browser renders the picture at. */
.click-layer { position: relative; display: inline-block; max-width: 100%; line-height: 0; }
.click-layer.is-armed { cursor: crosshair; }
.click-layer.is-armed img { outline: 2px dashed var(--brand-line); outline-offset: 2px; border-radius: var(--r-xs); }
.click-dot {
  position: absolute; width: .75rem; height: .75rem;
  margin: -.375rem 0 0 -.375rem;
  border: 2px solid #fff; border-radius: 50%;
  background: var(--brand);
  box-shadow: 0 0 0 1px rgba(0,0,0,.35);
  pointer-events: none;
}
.click-dot.is-exclude { background: var(--bad); }
.media-frame .placeholder { color: var(--ink-3); font-size: .875rem; }

/* The trail of sources in Edit. Each step is a thumbnail; the current one is
   outlined. Two or more steps means an operation has been chained. */
.edit-trail { display: flex; flex-wrap: wrap; gap: .5rem; margin: 0; padding: 0; list-style: none; }
.edit-step {
  display: grid; gap: .3rem; justify-items: center; padding: .35rem;
  border: 1px solid var(--line); border-radius: var(--r-xs); background: var(--surface);
  color: var(--ink-3); font-size: .75rem; font-weight: 600; max-width: 6rem;
}
.edit-step img { width: 3.5rem; height: 3.5rem; object-fit: cover; border-radius: 4px; background: var(--sunken); }
.edit-step[aria-current="true"] { border-color: var(--brand); color: var(--ink); }
.edit-step span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }

/* The 3D preview fills its frame rather than sitting inside it like a picture:
   a model is turned around and looked at, so the frame is the interface. The
   chequerboard is dropped because the viewer paints its own ground. */
.shape-stage { min-height: 26rem; padding: 0; background-image: none; }
.shape-canvas {
  display: block; width: 100%; height: 26rem; max-height: none;
  border-radius: var(--r-sm); cursor: grab; touch-action: none;
}
.shape-canvas:active { cursor: grabbing; }

.plain-list { margin: 0; padding-left: 1.1rem; display: grid; gap: .35rem; color: var(--ink-2); font-size: .9rem; }

.waveform {
  width: 100%; height: 4.5rem; border-radius: var(--r-sm);
  border: 1px solid var(--line); background: var(--sunken);
}
.transcript {
  padding: 1rem; border-radius: var(--r-sm);
  border: 1px solid var(--line); background: var(--sunken);
  font-size: .96875rem; line-height: 1.7; color: var(--ink);
  white-space: pre-wrap; min-height: 6rem;
}
.transcript:empty::before { content: attr(data-placeholder); color: var(--ink-4); }

.rec-button {
  display: inline-flex; align-items: center; gap: .55rem;
  min-height: 2.75rem; padding: 0 1.05rem;
  border: 1px solid var(--line-2); border-radius: var(--r-sm);
  background: var(--surface); font-size: .9375rem; font-weight: 600;
  box-shadow: var(--shadow-1);
}
.rec-button .dot { width: .6rem; height: .6rem; border-radius: 50%; background: var(--bad); flex: none; }
.rec-button[data-recording="true"] { border-color: var(--bad-line); background: var(--bad-soft); color: var(--bad); }
.rec-button[data-recording="true"] .dot { animation: fg-pulse .9s ease-in-out infinite; }

/* ---------- Imagine ------------------------------------------------------- */
.chip-row { display: flex; flex-wrap: wrap; gap: .4rem; }
/* The checkerboard means "transparent here". Generated and source images are
   opaque, so they get a plain ground; only the cutouts in Edit keep the pattern. */
.media-frame.is-opaque { background-image: none; }
.imagine-stage { min-height: 20rem; }
.imagine-stage canvas, .imagine-stage img { image-rendering: auto; max-height: 30rem; }
.imagine-working { display: grid; gap: .75rem; justify-items: center; width: min(22rem, 80%); text-align: center; }
.imagine-working .meter { width: 100%; }

/* Several options side by side where the panel is wide enough, stacked where
   it is not. Each is its own field so a narrow screen loses nothing. */
.option-grid { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(min(100%, 13rem), 1fr)); align-items: start; }
.seed-row { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; }

/* Starting from a picture: a slim drop target that becomes a preview row. */
.reference-panel { display: grid; gap: .75rem; }
.dropzone-compact { display: flex; align-items: center; justify-content: center; gap: .6rem; padding: .7rem .9rem; font-size: .875rem; }
.dropzone-compact svg { flex: none; }
.reference-row {
  display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: .875rem; align-items: center;
  padding: .6rem .75rem; border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--sunken);
}
.reference-row img { width: 3.5rem; height: 3.5rem; object-fit: cover; border-radius: var(--r-xs); background: var(--surface); }
.reference-row p { margin: 0; }
@media (max-width: 34rem) { .reference-row { grid-template-columns: auto minmax(0, 1fr); } .reference-row .btn { grid-column: 1 / -1; justify-self: start; } }
.seed-row .input { flex: 1 1 8rem; min-width: 0; }

/* Advanced: closed by default, so the defaults are what most people get. */
.advanced { border-top: 1px solid var(--line); padding-top: .75rem; }
.advanced > summary {
  list-style: none; cursor: pointer; display: inline-flex; align-items: center; gap: .4rem;
  font-size: .875rem; font-weight: 600; color: var(--ink-2);
}
.advanced > summary::-webkit-details-marker { display: none; }
.advanced > summary::before { content: "+"; display: inline-grid; place-items: center; width: 1.1rem; color: var(--ink-3); }
.advanced[open] > summary::before { content: "\2212"; }
.advanced > summary:hover { color: var(--ink); }
.advanced[open] > .option-grid { margin-top: .9rem; }

/* Results. One picture sits large; a batch becomes a grid of equal tiles.
   Every tile carries its seed, because the seed is what makes it repeatable. */
.result-single { margin: 0; display: grid; gap: .6rem; justify-items: center; max-width: 100%; }
.result-grid { display: grid; gap: .75rem; width: 100%; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.result-grid[data-count="4"] { grid-template-columns: repeat(auto-fit, minmax(min(100%, 12rem), 1fr)); }
.result-card { margin: 0; display: grid; gap: .5rem; min-width: 0; }
.result-grid canvas, .result-grid img { width: 100%; height: auto; max-height: none; }
.result-actions { display: flex; align-items: center; justify-content: space-between; gap: .5rem; flex-wrap: wrap; width: 100%; color: var(--ink-3); }
.result-buttons { display: inline-flex; gap: .4rem; flex-wrap: wrap; }
.seed-chip {
  display: inline; padding: 0 .3rem; border-radius: var(--r-xs);
  color: var(--ink-2); background: var(--sunken); font-size: inherit;
}
.seed-chip:hover { color: var(--brand); background: var(--brand-soft); }

/* Sample outputs, shown before any download. A tile is a whole recipe. */
/* Six samples: three across and two down, never five and an orphan. */
.sample-grid { display: grid; gap: .75rem; grid-template-columns: repeat(3, minmax(0, 1fr)); }
@media (max-width: 34rem) { .sample-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.sample-tile {
  display: grid; gap: .5rem; align-content: start; text-align: left;
  padding: 0; border: 1px solid var(--line); border-radius: var(--r-sm); overflow: hidden;
  background: var(--surface); cursor: pointer;
  transition: border-color .14s ease, transform .14s ease, box-shadow .14s ease;
}
.sample-tile:hover { border-color: var(--brand-line); transform: translateY(-1px); box-shadow: var(--shadow-2); }
.sample-tile img { display: block; width: 100%; height: auto; aspect-ratio: 1; object-fit: cover; background: var(--sunken); }
.sample-tile.is-text { padding-top: .75rem; background: var(--sunken); }
.sample-caption { display: grid; gap: .2rem; padding: 0 .7rem .7rem; font-size: .8125rem; line-height: 1.4; color: var(--ink-2); }
.sample-caption > span:first-child { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }

/* ---------- Storage ------------------------------------------------------- */
.quota-panel .panel-body { gap: .75rem; }

/* One bar for the whole origin, split by what is taking the room. */
.quota-bar {
  display: flex; height: .875rem; overflow: hidden;
  border-radius: var(--r-pill); background: var(--sunken);
  border: 1px solid var(--line);
}
.quota-bar .seg { display: block; height: 100%; }
.seg-models { background: var(--brand); }
.seg-work   { background: var(--heat); }
.seg-other  { background: var(--ink-4); }

.quota-legend { display: flex; flex-wrap: wrap; gap: .5rem 1.1rem; font-size: .8125rem; color: var(--ink-2); }
.quota-key { display: inline-flex; align-items: center; gap: .4rem; }
.quota-key i { width: .625rem; height: .625rem; border-radius: 3px; }
.quota-key .seg-free { background: var(--sunken); border: 1px solid var(--line-2); }

.data-tabs { margin-block: 1.25rem .875rem; flex-wrap: wrap; }
.data-tabs button { display: inline-flex; align-items: center; gap: .4rem; }
.data-panel { display: grid; gap: 1rem; }

/* Model rows */
.model-list { display: grid; }
.model-row {
  display: grid; align-items: center; gap: .875rem;
  grid-template-columns: auto minmax(0, 1fr) auto auto;
  padding: .7rem 0; border-bottom: 1px solid var(--line);
}
.model-list .model-row:last-child { border-bottom: 0; }
.model-icon {
  display: grid; place-items: center; width: 2.125rem; height: 2.125rem;
  border-radius: var(--r-sm); background: var(--sunken); color: var(--ink-3);
}
.model-row.is-cached .model-icon { background: var(--brand-soft); color: var(--brand); }
.model-size { display: grid; justify-items: end; gap: .1rem; text-align: right; }
.model-size strong { font-size: .875rem; font-weight: 600; }
.model-row:not(.is-cached) .model-size strong { color: var(--ink-3); font-weight: 500; }

/* Gallery */
.gallery {
  display: grid; gap: 1rem;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 14rem), 1fr));
}
.gallery-card {
  margin: 0; display: grid; gap: .6rem;
  border: 1px solid var(--line); border-radius: var(--r);
  background: var(--surface); overflow: hidden;
}
.gallery-card img {
  width: 100%; height: auto; aspect-ratio: 1; object-fit: cover;
  background: var(--sunken); border-bottom: 1px solid var(--line);
}
.gallery-missing {
  display: grid; place-items: center; aspect-ratio: 1;
  background: var(--sunken); color: var(--ink-3); font-size: .8125rem;
}
.gallery-card figcaption { display: grid; gap: .3rem; padding: 0 .75rem .75rem; }
.gallery-card figcaption strong {
  font-size: .875rem; font-weight: 600;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}

.audio-row { align-items: start; }
.data-excerpt {
  margin-top: .35rem; font-size: .8125rem; line-height: 1.5; color: var(--ink-2);
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
}

.danger-panel .panel-body {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 1rem;
}
.danger-panel .panel-body > div { display: grid; gap: .2rem; max-width: 46ch; }

/* The label is an inline-flex row; without nowrap the checkbox drops onto its
   own line once the description wraps, which reads as a broken control. */
.toggle-row { align-items: flex-start; gap: .65rem; flex-wrap: nowrap; }
.toggle-row input { margin-top: .25rem; flex: none; }
.toggle-row > span { display: grid; gap: .15rem; min-width: 0; }
.toggle-row strong { font-size: .9375rem; color: var(--ink); }

.data-list { display: grid; }
.data-row {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between;
  gap: .75rem; padding: .7rem 0; border-bottom: 1px solid var(--line);
}
.data-list .data-row:last-child { border-bottom: 0; }
.data-row-main { display: grid; gap: .15rem; min-width: 0; flex: 1; }
.data-row-main strong { font-size: .9375rem; font-weight: 600; overflow-wrap: anywhere; }
.data-row-actions { display: flex; gap: .4rem; flex: none; }

.btn.is-armed { background: var(--bad); border-color: var(--bad); color: #fff; }

/* ---------- Library ------------------------------------------------------- */
.library-controls {
  display: grid; gap: .75rem;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center; margin-bottom: 1.25rem;
}
.filter-row { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }
.checkbox { display: inline-flex; align-items: center; gap: .45rem; font-size: .875rem; color: var(--ink-2); cursor: pointer; }
.checkbox input { width: 1rem; height: 1rem; accent-color: var(--brand); cursor: pointer; }

.library-meta { display: flex; flex-wrap: wrap; gap: .75rem; align-items: center; justify-content: space-between; margin-bottom: .9rem; }
.library-grid { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fill, minmax(min(100%, 20.5rem), 1fr)); }
.tool-card { display: flex; flex-direction: column; gap: .7rem; padding: 1.1rem; }
.tool-card-top { display: flex; align-items: start; justify-content: space-between; gap: .75rem; }
.tool-card h3 { font-size: 1.05rem; }
.tool-card p { font-size: .9063rem; line-height: 1.5; color: var(--ink-2); flex: 1; }
.tool-tags { display: flex; flex-wrap: wrap; gap: .35rem; }
.tool-card footer { display: flex; align-items: center; justify-content: space-between; gap: .5rem; padding-top: .75rem; border-top: 1px solid var(--line); }
.save-btn { display: inline-flex; align-items: center; gap: .35rem; padding: .3rem .5rem; border-radius: var(--r-xs); color: var(--ink-3); font-size: .8125rem; font-weight: 600; }
.save-btn:hover { background: var(--sunken); color: var(--ink); }
.save-btn[aria-pressed="true"] { color: var(--brand); }
.save-btn svg { width: .95rem; height: .95rem; }

.empty-state { display: grid; gap: .6rem; justify-items: center; text-align: center; padding: 3rem 1rem; color: var(--ink-3); }
.empty-state h3 { color: var(--ink); }

/* ---------- Latest -------------------------------------------------------- */
.release-grid { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(min(100%, 17rem), 1fr)); }
.release-card { display: grid; gap: .5rem; padding: 1.1rem; }
.release-card h3 { font-size: 1.35rem; font-variant-numeric: tabular-nums; }
.release-card p { font-size: .9063rem; color: var(--ink-2); }
.release-card a { font-size: .875rem; font-weight: 600; text-decoration: none; }
.release-card a:hover { text-decoration: underline; }

.recent-list { display: grid; border: 1px solid var(--line); border-radius: var(--r); background: var(--surface); overflow: hidden; }
.recent-item {
  display: grid; grid-template-columns: 2.25rem minmax(0, 1fr) auto;
  gap: .75rem; align-items: center;
  padding: .85rem 1rem; border-bottom: 1px solid var(--line);
}
.recent-item:last-child { border-bottom: 0; }
.recent-item:hover { background: var(--sunken); }
.recent-index { font: 500 .8125rem/1 var(--mono); color: var(--ink-4); }
.recent-item h3 { font-size: .96875rem; }
.recent-item h3 a { color: inherit; text-decoration: none; }
.recent-item h3 a:hover { color: var(--brand); }
.recent-item p { font-size: .8125rem; color: var(--ink-3); }
.recent-side { display: flex; align-items: center; gap: .9rem; font: 500 .75rem/1 var(--mono); color: var(--ink-3); white-space: nowrap; }

.feed-status { display: inline-flex; align-items: center; gap: .5rem; font-size: .8125rem; color: var(--ink-3); }

/* ---------- Footer -------------------------------------------------------- */
.fg-footer { border-top: 1px solid var(--line); margin-top: 2rem; padding-block: 2.5rem 3rem; }
.fg-footer-inner { display: grid; gap: 2rem; grid-template-columns: minmax(0, 1.5fr) repeat(4, minmax(0, 1fr)); }
.fg-footer h2 { font-size: .8125rem; font-family: var(--sans); font-weight: 600; color: var(--ink-3); letter-spacing: .02em; margin-bottom: .75rem; }
.fg-footer nav { display: grid; gap: .45rem; }
.fg-footer nav a { display: inline-flex; align-items: center; gap: .25rem; color: var(--ink-2); font-size: .9063rem; text-decoration: none; width: fit-content; }
.fg-footer nav a svg { color: var(--ink-4); }
.fg-footer-brand p { font-size: .9375rem; line-height: 1.55; color: var(--ink-2); }
.fg-footer nav a:hover { color: var(--brand); }
.fg-footer-brand { display: grid; gap: .75rem; max-width: 30ch; }
.fg-footer-legal {
  display: flex; flex-wrap: wrap; gap: .75rem 1.5rem; justify-content: space-between;
  margin-top: 2rem; padding-top: 1.25rem; border-top: 1px solid var(--line);
  font-size: .8125rem; color: var(--ink-3);
}

/* ---------- Responsive ---------------------------------------------------- */
/* The bar gives way in order of least use: the search label, then the GPU
   name, then the studio links move into the sheet. */
@media (max-width: 80rem) {
  .search-trigger { min-width: 0; width: 2.375rem; padding: 0; justify-content: center; }
  .search-trigger span, .search-trigger kbd { display: none; }
}
@media (max-width: 60rem) {
  .hero { grid-template-columns: minmax(0, 1fr); }
  .hero-gallery { justify-items: start; }
  .device-panel { grid-template-columns: minmax(0, 1fr); }
  .studio { grid-template-columns: minmax(0, 1fr); }
  /* In one column the side panels would all stack above the work: on a
     phone, Chat's conversation started a full screen down, under the thread
     list and the privacy note. The side is dissolved so its first panel, the
     model picker, stays on top, the work comes next, and the rest follow. */
  .studio-side { display: contents; }
  .studio-side > * { order: 2; }
  .studio-side > :first-child { order: 0; }
  .studio-main { order: 1; }
  .fg-footer-inner { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .fg-footer-brand { grid-column: 1 / -1; }
}
@media (max-width: 64rem) {
  .nav-toggle { display: inline-flex; }
  .fg-nav {
    position: absolute; inset-inline: 0; top: var(--header-h);
    flex-direction: column; align-items: stretch; gap: .125rem;
    margin: 0; padding: .625rem;
    border-bottom: 1px solid var(--line);
    background: var(--paper); box-shadow: var(--shadow-2);
  }
  .fg-nav:not(.is-open) { display: none; }
  .fg-nav a { padding: .65rem .75rem; font-size: .9375rem; }
  /* In the sheet the menu is a labelled group, not a popover. */
  .nav-more { border-top: 1px solid var(--line); margin-top: .375rem; padding-top: .375rem; }
  .nav-more > summary { pointer-events: none; padding: .5rem .75rem .25rem; font-size: .8125rem; color: var(--ink-3); }
  .nav-more > summary svg { display: none; }
  .nav-menu { position: static; min-width: 0; padding: 0; border: 0; box-shadow: none; background: transparent; animation: none; }
  .nav-studios { display: grid; gap: .125rem; }
  .nav-studios a svg { display: block; }
  .nav-studios a[aria-current="page"] { box-shadow: none; border-radius: var(--r-xs); background: var(--brand-soft); }
  .fg-header-actions { margin-inline-start: auto; }
}
@media (max-width: 48rem) {
  :root { --shell: min(1180px, 100% - 2rem); --wide: min(1400px, 100% - 2rem); }
  .library-controls { grid-template-columns: minmax(0, 1fr); }
  .composer-row { grid-template-columns: minmax(0, 1fr); }
  .device-tag span { display: none; }
  .device-tag { padding-inline: .6rem; }
  .hero-proof { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem 1.25rem; }
}
@media (max-width: 34rem) {
  .fg-footer-inner { grid-template-columns: minmax(0, 1fr); }
  .recent-item { grid-template-columns: 1.75rem minmax(0, 1fr); }
  .recent-side { grid-column: 2; }

  /* Four columns of model metadata do not fit a phone. The size and the
     controls move under the name rather than being squeezed to nothing. */
  .model-row { grid-template-columns: auto minmax(0, 1fr); row-gap: .5rem; }
  .model-size { grid-column: 2; justify-items: start; text-align: left; flex-direction: row; }
  .model-row .data-row-actions { grid-column: 2; }
  .gallery { grid-template-columns: minmax(0, 1fr); }
  .danger-panel .panel-body { flex-direction: column; align-items: stretch; }
}

/* ---------- Motion / print ------------------------------------------------ */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
    scroll-behavior: auto !important;
  }
  /* Entrance animations start from opacity 0, so they must land visible rather
     than simply running instantly from an invisible state. */
  .hero-glow { animation: none; }
  .hero-tile { opacity: 1 !important; }
}
@media print {
  .fg-header, .fg-footer, .composer, .studio-side { display: none !important; }
  body { background: #fff; color: #000; }
}

/* Progress for a run long enough that people ask whether it is still alive. */
.run-phase { margin: 0; font-weight: 550; color: var(--ink); }
.run-meta  { margin: 0; color: var(--ink-3); font-variant-numeric: tabular-nums; }


/* ---------- View changes -------------------------------------------------- */

/* The outlet takes the slack, so a short page pushes the footer to the bottom
   of the window instead of leaving it floating mid screen. */
/* At least a screen tall, so the footer the server writes starts below the
   fold. Under a short server shell it would otherwise sit in view and be
   pushed down when the studio arrives. */
#fg-main { flex: 1 0 auto; min-height: calc(100dvh - var(--header-h)); }
.empty-404 { padding-block: 6rem; }
.fg-footer { flex-shrink: 0; }

/*
 * Cross-fade between views.
 *
 * The header and footer are named separately so they are not part of the fade:
 * they are the parts of the page that did not change, and fading them makes a
 * navigation look like a full reload. Everything here is inside a
 * reduced-motion guard, and the swap still happens without it.
 */
.fg-header { view-transition-name: fg-header; }
.fg-footer { view-transition-name: fg-footer; }

@media (prefers-reduced-motion: no-preference) {
  ::view-transition-old(root) { animation: fg-fade-out .12s ease both; }
  ::view-transition-new(root) { animation: fg-fade-in .18s ease both; }
}
@keyframes fg-fade-out { to { opacity: 0; } }
@keyframes fg-fade-in { from { opacity: 0; transform: translateY(4px); } }



/* ---------- Command palette ------------------------------------------------ */
.palette {
  width: min(40rem, calc(100% - 2rem)); max-height: min(34rem, calc(100dvh - 6rem));
  margin: min(12vh, 7rem) auto auto; padding: 0;
  display: flex; flex-direction: column;
  border: 1px solid var(--line-2); border-radius: var(--r-lg);
  background: var(--surface); color: var(--ink); box-shadow: var(--shadow-3);
  overflow: hidden;
}
.palette:not([open]) { display: none; }
.palette::backdrop { background: var(--overlay); backdrop-filter: blur(3px); }
.palette[open] { animation: fg-pop .16s cubic-bezier(.23, 1, .32, 1) both; }
.palette-field { display: flex; align-items: center; gap: .65rem; padding: .85rem 1rem; border-bottom: 1px solid var(--line); color: var(--ink-3); }
.palette-input { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; font-size: 1.0625rem; color: var(--ink); }
.palette-input::placeholder { color: var(--ink-4); }
.palette-input::-webkit-search-cancel-button { display: none; }
.palette-list { flex: 1; overflow-y: auto; padding: .4rem; overscroll-behavior: contain; }
.palette-item {
  display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: .75rem;
  padding: .55rem .65rem; border-radius: var(--r-sm); cursor: pointer;
}
.palette-item[aria-selected="true"] { background: var(--brand-soft); }
.palette-icon { display: grid; place-items: center; width: 2rem; height: 2rem; border-radius: var(--r-xs); background: var(--sunken); color: var(--ink-2); }
.palette-item[aria-selected="true"] .palette-icon { background: var(--surface); color: var(--brand); }
.palette-text { display: grid; gap: .05rem; min-width: 0; }
.palette-text b { font-weight: 600; font-size: .9375rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.palette-text small { font-size: .8125rem; color: var(--ink-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.palette-kind { font-size: .75rem; font-weight: 600; color: var(--ink-3); }
.palette-empty { padding: 1.5rem 1rem; color: var(--ink-3); font-size: .9375rem; text-align: center; }
.palette-foot { display: flex; gap: 1rem; padding: .6rem 1rem; border-top: 1px solid var(--line); font-size: .75rem; color: var(--ink-3); }
.palette-foot span { display: inline-flex; align-items: center; gap: .25rem; }
