/* Farsight: namespace.css plus motion, depth, and a cursive mark. */

:root {
  --fs-script: "Ms Madi", "Snell Roundhand", "Apple Chancery", cursive;
  /* One face everywhere. The Chicago-style UI stack falls back to Geneva on
     a Mac and a mono face elsewhere, which mixes two fonts on one line. */
  --ns-font-ui: var(--ns-font-mono);
  --fs-ease: cubic-bezier(0.2, 0.8, 0.2, 1);
  --fs-primary: #474747;
  --fs-primary-hover: #5a5a5a;
  --fs-primary-active: #333333;
  --fs-primary-shadow: #b4b4ae;
  --ns-size: 15px;
}

@view-transition {
  navigation: auto;
}

::view-transition-old(root),
::view-transition-new(root) {
  animation-duration: 180ms;
  animation-timing-function: var(--fs-ease);
}

html,
body {
  min-height: 100%;
}

/* Keep the scrollbar gutter on every page: a short page otherwise shifts the
   whole layout sideways and the view transition reads as a reload. */
html {
  scrollbar-gutter: stable;
}

/* One dither for every page: the landing page's 25% screen, drawn on a
   fixed layer so it can sit at 15% strength. */
body {
  background: transparent;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background-image: var(--ns-dither-25);
  opacity: 0.15;
}

/* namespace.css turns smoothing off for a 1-bit look; with outline fonts
   that renders thin, jagged glyphs. Smooth everything. The component
   selectors match namespace.css specificity, which a bare * cannot beat. */
html,
body,
*,
*::before,
*::after,
.ns-menubar,
.ns-window__bar,
.ns-menu,
.ns-button,
button.ns-button,
input[type="submit"].ns-button {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

/* ---- Icons -------------------------------------------------------------- */

.fs-icon {
  width: 1.15em;
  height: 1.15em;
  flex: none;
  vertical-align: -0.2em;
}

.ns-button,
.fs-nav-icon {
  gap: 6px;
}

.ns-button .fs-icon {
  width: 1.2em;
  height: 1.2em;
}

/* Primary is dark grey, not black: a black fill with a hard black shadow is
   too heavy. The border stays ink so it matches the other buttons. */
.ns-button.is-primary {
  background: var(--fs-primary);
}

.ns-button.is-primary:hover {
  background: var(--fs-primary-hover);
}

/* Press darkens the grey. The vendored invert to paper flashes white. */
.ns-button.is-primary:active {
  background: var(--fs-primary-active);
  color: var(--ns-paper);
}

.fs-icon-btn {
  padding: 0 6px;
}

.ns-button.is-tiny.fs-icon-btn {
  padding: 0 4px;
}

.ns-menubar .fs-nav-icon {
  display: inline-flex;
  align-items: center;
}

.ns-menubar .fs-nav-icon .fs-icon {
  width: 1.35em;
  height: 1.35em;
}

/* Two-state icon buttons carry both icons; state picks one. */
[data-copy] .fs-icon + .fs-icon,
[data-reveal] .fs-icon + .fs-icon,
[data-copy].is-done .fs-icon:first-child,
[data-reveal][aria-pressed="true"] .fs-icon:first-child {
  display: none;
}

[data-copy].is-done .fs-icon + .fs-icon,
[data-reveal][aria-pressed="true"] .fs-icon + .fs-icon {
  display: inline-block;
}

/* ---- Toasts ------------------------------------------------------------- */

.fs-toasts {
  position: fixed;
  top: 48px;
  right: 12px;
  z-index: 60;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
  width: min(22rem, calc(100vw - 24px));
  pointer-events: none;
}

.fs-toast {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 8px 6px 8px 12px;
  border: 1px solid var(--ns-ink);
  background: var(--ns-paper);
  box-shadow: var(--ns-shadow-deep);
  font-size: var(--ns-text-md);
  pointer-events: auto;
  animation: fs-toast-in 240ms var(--fs-ease) both;
}

.fs-toast.is-error {
  border-color: var(--ns-danger);
  color: var(--ns-danger);
  box-shadow: 4px 4px 0 var(--ns-danger);
}

.fs-toast__icon {
  display: inline-flex;
}

.fs-toast .fs-toast__icon .fs-icon + .fs-icon,
.fs-toast.is-error .fs-toast__icon .fs-icon:first-child {
  display: none;
}

.fs-toast.is-error .fs-toast__icon .fs-icon + .fs-icon {
  display: inline-block;
}

.fs-toast__text {
  flex: 1;
}

.fs-toast__x {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: var(--ns-h-md);
  height: var(--ns-h-md);
  padding: 0;
  border: 1px solid transparent;
  background: none;
  color: inherit;
  cursor: pointer;
}

.fs-toast__x:hover,
.fs-toast__x:focus-visible {
  border-color: currentColor;
}

.fs-toast.is-leaving {
  animation: fs-toast-out 200ms var(--fs-ease) both;
}

@keyframes fs-toast-in {
  from {
    opacity: 0;
    transform: translateX(24px);
  }
}

@keyframes fs-toast-out {
  to {
    opacity: 0;
    transform: translateX(24px);
  }
}

/* ---- Mark --------------------------------------------------------------- */

.fs-mark {
  font-family: var(--fs-script);
  font-weight: 400;
  letter-spacing: 0;
  line-height: 1;
  text-decoration: none;
  color: var(--ns-ink);
}

/* Hairlines thin out at small sizes; a stroke keeps the landing weight. */
.ns-menubar .fs-mark,
.fs-doc h1 {
  -webkit-text-stroke: 0.01em currentColor;
  letter-spacing: 0.02em;
}

.ns-menubar .fs-mark {
  display: inline-flex;
  align-items: center;
  align-self: stretch;
  font-size: 2.4rem;
  padding: 0 calc(var(--ns-unit) * 4) 0 calc(var(--ns-unit) * 3);
  margin-right: calc(var(--ns-unit) * 2);
  border-right: 1px solid var(--ns-ink);
  overflow: visible;
}

.ns-menubar.fs-top {
  --ns-nav-height: 38px;
}

/* Plain labels: sentence case, no prompt mark. */
.ns-field > label,
.ns-label {
  color: var(--ns-ink);
  font-family: var(--ns-font-mono);
  font-size: var(--ns-text-sm);
  font-weight: 600;
  letter-spacing: 0;
  text-transform: none;
}

.ns-field > label::before,
.ns-label::before {
  content: none;
}

/* ---- Shell -------------------------------------------------------------- */

.fs-top {
  position: sticky;
  top: 0;
  z-index: 20;
  overflow-x: auto;
  scrollbar-width: none;
}

.fs-top::-webkit-scrollbar {
  display: none;
}

.fs-top form {
  display: contents;
}

.fs-main {
  width: min(100%, 68rem);
  margin: 0 auto;
  padding: calc(var(--ns-unit) * 6) calc(var(--ns-unit) * 4) calc(var(--ns-unit) * 16);
}

.fs-main.is-narrow {
  width: min(100%, 36rem);
}

.ns-window {
  view-transition-name: fs-window;
  animation: fs-open 260ms var(--fs-ease) both;
  transition: box-shadow 200ms var(--fs-ease), transform 200ms var(--fs-ease);
}

.ns-window + .ns-window,
.fs-stack > * + * {
  margin-top: calc(var(--ns-unit) * 6);
}

.ns-window + .ns-window {
  view-transition-name: none;
}

@keyframes fs-open {
  from {
    opacity: 0;
    transform: translateY(6px) scale(0.985);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.ns-window__title a {
  color: inherit;
  text-decoration: none;
}

.fs-crumb {
  color: var(--ns-ink-soft);
}

/* ---- Cards ------------------------------------------------------------- */

.fs-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(15rem, 1fr));
  gap: calc(var(--ns-unit) * 4);
}

.fs-card {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--ns-ink);
  background: var(--ns-paper);
  color: inherit;
  text-decoration: none;
}

/* Cards sit inside a window, so they never lift. Focus gets an outline. */
a.fs-card:focus-visible {
  outline: 2px solid var(--ns-ink);
  outline-offset: 2px;
}

.fs-card__img {
  position: relative;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  border-bottom: 1px solid var(--ns-ink);
  background: var(--ns-wash);
  background-image: var(--ns-dither-25);
}

.fs-card__img img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: grayscale(1) contrast(1.05);
  transition: filter 320ms var(--fs-ease), transform 600ms var(--fs-ease);
}

.fs-card:hover .fs-card__img img,
.fs-obs.is-open .fs-card__img img {
  filter: none;
  transform: scale(1.02);
}

.fs-card__blank {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-size: 2.5rem;
  color: var(--ns-ink-soft);
}

.fs-card__blank .fs-icon {
  background: var(--ns-paper);
  padding: 6px;
  border: 1px solid var(--ns-ink);
}

.fs-card__img .ns-badge {
  position: absolute;
  top: calc(var(--ns-unit) * 2);
  left: calc(var(--ns-unit) * 2);
}

/* Shown beside a chamber while its stream is live. */
.fs-live-icon {
  display: inline-flex;
  align-items: center;
  align-self: center;
}

.ns-menubar__item .fs-live-icon {
  margin-right: 0.3em;
}

.fs-card__body {
  display: flex;
  flex-direction: column;
  gap: calc(var(--ns-unit) * 2);
  padding: calc(var(--ns-unit) * 3);
  min-height: 3.5rem;
}

.fs-card__title {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: calc(var(--ns-unit) * 2);
  font-weight: 600;
  font-size: var(--ns-text-md);
}

.fs-card__meta {
  font-size: var(--ns-text-xs);
  color: var(--ns-ink-soft);
}

.fs-note {
  font-size: var(--ns-text-sm);
  color: var(--ns-ink-soft);
  margin: 0;
}

/* margin: 0 above would beat the stack spacing at equal specificity. */
.fs-stack > * + .fs-note {
  margin-top: calc(var(--ns-unit) * 6);
}

/* Answers: true is ink, false is paper, a count carries its number. */
.fs-answers {
  display: flex;
  flex-wrap: wrap;
  gap: var(--ns-unit);
}

.fs-ans {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: var(--ns-h-sm);
  padding: 0 6px;
  border: 1px solid var(--ns-ink);
  border-radius: var(--ns-radius);
  font-size: var(--ns-text-xs);
  white-space: nowrap;
}

.fs-ans.is-true {
  background: var(--ns-ink);
  color: var(--ns-paper);
}

.fs-ans.is-false {
  color: var(--ns-ink-soft);
  border-color: var(--ns-rule);
}

.fs-ans.is-null {
  border-style: dashed;
  color: var(--ns-ink-faint);
}

.fs-ans b {
  font-weight: 700;
  padding-left: 6px;
  border-left: 1px solid currentColor;
}

/* Feed view filter: one row of view buttons that scrolls sideways. */
.fs-view-filter {
  display: flex;
  gap: calc(var(--ns-unit) * 2);
  overflow-x: auto;
  overscroll-behavior-x: contain;
  scrollbar-width: thin;
  padding-bottom: 2px;
}

.fs-view-filter .ns-button {
  flex: none;
  white-space: nowrap;
  text-decoration: none;
}

.fs-view-filter .ns-button.is-active {
  background: var(--ns-ink);
  color: var(--ns-paper);
}

/* Observation modal: the observation window over a dimmed feed. */
.fs-modal {
  width: min(56rem, calc(100vw - 32px));
  max-width: none;
  max-height: calc(100dvh - 32px);
  padding: 0;
  border: 0;
  background: transparent;
  overflow: auto;
}

.fs-modal::backdrop {
  background: rgb(0 0 0 / 0.45);
}

.fs-modal .ns-window {
  view-transition-name: none;
}

body:has(.fs-modal[open]) {
  overflow: hidden;
}

/* Pending cards breathe until the analysis lands. */
.fs-obs.is-queued .fs-card__img::after,
.fs-obs.is-processing .fs-card__img::after {
  content: "";
  position: absolute;
  inset: 0;
  background-image: var(--ns-dither-25);
  opacity: 0.25;
  animation: fs-breathe 1.4s ease-in-out infinite;
}

@keyframes fs-breathe {
  50% {
    opacity: 0.05;
  }
}

.fs-fresh {
  animation: fs-land 500ms var(--fs-ease);
}

@keyframes fs-land {
  from {
    opacity: 0.2;
  }
}

/* ---- Drop zone ---------------------------------------------------------- */

.fs-drop {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: calc(var(--ns-unit) * 3);
  padding: calc(var(--ns-unit) * 3);
  border: 1px dashed var(--ns-ink);
  background: var(--ns-paper);
  transition: background 160ms, transform 160ms var(--fs-ease);
}

.fs-drop [data-drop-status] {
  margin-left: auto;
}

.fs-drop.is-over {
  background-image: var(--ns-dither-12);
  transform: scale(1.01);
}

.fs-drop input[type="file"] {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.fs-drop .ns-input,
.fs-drop input[type="text"] {
  max-width: 10rem;
}

/* The image context input with its info tip, kept on one line. */
.fs-drop__context {
  display: flex;
  flex: 1;
  align-items: center;
  gap: calc(var(--ns-unit) * 2);
  max-width: 26rem;
}

.fs-drop .fs-drop__context .ns-input {
  flex: 1;
  min-width: 0;
  max-width: none;
}

/* ---- Copy blocks -------------------------------------------------------- */

.fs-copy {
  position: relative;
}

.fs-copy pre,
.fs-copy code.is-block {
  display: block;
  margin: 0;
  padding: calc(var(--ns-unit) * 3);
  padding-right: 5.5rem;
  border: 1px solid var(--ns-ink);
  background: var(--ns-wash);
  font-family: var(--ns-font-mono);
  font-size: var(--ns-text-sm);
  white-space: pre-wrap;
  word-break: break-all;
  overflow-wrap: anywhere;
}

.fs-copy__tools {
  position: absolute;
  top: calc(var(--ns-unit) * 2);
  right: calc(var(--ns-unit) * 2);
  display: flex;
  gap: 4px;
}

.fs-key {
  font-size: var(--ns-text-lg);
  letter-spacing: 0.02em;
}

.fs-label {
  display: block;
  font-size: var(--ns-text-sm);
  font-weight: 600;
  margin: 0 0 calc(var(--ns-unit) * 2);
}

.fs-section + .fs-section {
  margin-top: calc(var(--ns-unit) * 6);
}

/* ---- Forms -------------------------------------------------------------- */

.fs-form-row {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: calc(var(--ns-unit) * 3);
}

.fs-form-row .ns-field {
  margin: 0;
  flex: 1 1 8rem;
}

.fs-form-row .ns-field.is-wide {
  flex: 3 1 16rem;
}

.fs-form-row .ns-field.is-type {
  flex: 0 1 8rem;
}

.fs-form-row .ns-field[hidden] {
  display: none;
}

.fs-form-row .ns-field.is-code {
  flex: 0 1 auto;
  min-width: 0;
}

.fs-form-row .ns-field.is-tiny {
  flex: 0 1 5.5rem;
}

.fs-inline-form {
  display: inline;
}

/* Settings list: one row per setting, name left, control right, ruled
   between rows. Stacks on narrow screens. */
.fs-settings {
  border-bottom: 1px solid var(--ns-rule);
}

.fs-setting {
  display: grid;
  grid-template-columns: 8rem 1fr;
  align-items: start;
  gap: calc(var(--ns-unit) * 3);
  padding: calc(var(--ns-unit) * 2) 0;
  margin: 0;
}

.fs-setting:first-child {
  padding-top: 0;
}

.fs-setting + .fs-setting {
  border-top: 1px solid var(--ns-rule);
}

.fs-setting__name {
  display: inline-flex;
  align-items: center;
  gap: var(--ns-unit);
  min-height: var(--ns-h-lg);
  font-size: var(--ns-text-sm);
  font-weight: 600;
}

.fs-setting__control {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: calc(var(--ns-unit) * 2);
  min-width: 0;
}

.fs-setting__control > .fs-copy {
  flex: 1 1 100%;
  min-width: 0;
}

.fs-setting__num.ns-input {
  width: 5.5rem;
}

@media (max-width: 30rem) {
  .fs-setting {
    grid-template-columns: 1fr;
    gap: var(--ns-unit);
  }
}

/* Tooltip: an info icon; the text shows on hover or keyboard focus. */
.fs-tip {
  position: relative;
  display: inline-flex;
  vertical-align: middle;
  font-weight: 400;
}

.fs-tip__icon {
  display: inline-flex;
  align-items: center;
  padding: 0;
  margin: 0;
  border: 0;
  background: none;
  color: var(--ns-ink-soft);
  cursor: help;
}

.fs-tip__icon svg {
  width: 14px;
  height: 14px;
}

.fs-tip__icon:hover {
  color: var(--ns-ink);
}

.fs-tip__icon:focus-visible {
  outline: 2px solid var(--ns-ink);
  outline-offset: 1px;
}

.fs-tip__text {
  position: absolute;
  z-index: 20;
  top: calc(100% + 6px);
  left: -8px;
  width: max-content;
  max-width: min(16rem, 70vw);
  padding: var(--ns-unit) calc(var(--ns-unit) * 2);
  border: 1px solid var(--ns-ink);
  border-radius: var(--ns-radius);
  background: var(--ns-paper);
  box-shadow: var(--ns-shadow);
  color: var(--ns-ink);
  font-family: var(--ns-font-mono);
  font-size: var(--ns-text-xs);
  font-weight: 400;
  line-height: 1.4;
  white-space: normal;
  visibility: hidden;
  opacity: 0;
  transition: opacity 80ms ease;
  pointer-events: none;
}

.fs-tip.is-end .fs-tip__text {
  left: auto;
  right: -8px;
}

.fs-tip:hover .fs-tip__text,
.fs-tip:focus-within .fs-tip__text {
  visibility: visible;
  opacity: 1;
}

.fs-switch {
  display: inline-flex;
  align-items: center;
  gap: calc(var(--ns-unit) * 2);
  min-height: var(--ns-h-lg);
  margin: 0;
  padding: 0;
  border: 0;
  background: none;
  color: var(--ns-ink);
  font-family: var(--ns-font-ui);
  font-size: var(--ns-text-sm);
  font-weight: 700;
  cursor: pointer;
  -webkit-font-smoothing: none;
}

.fs-switch__track {
  position: relative;
  width: 40px;
  height: 20px;
  border: 1px solid var(--ns-ink);
  border-radius: var(--ns-radius);
  background: var(--ns-paper);
  box-shadow: none;
}

.fs-switch__thumb {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 14px;
  height: 14px;
  border: 1px solid var(--ns-ink);
  border-radius: 2px;
  background: var(--ns-paper);
  transition: left 120ms ease;
}

.fs-switch[aria-checked="true"] .fs-switch__track {
  background: var(--ns-ink);
}

.fs-switch[aria-checked="true"] .fs-switch__thumb {
  left: 22px;
  border-color: var(--ns-paper);
}

.fs-switch:hover .fs-switch__track {
  background: var(--ns-wash);
}

.fs-switch[aria-checked="true"]:hover .fs-switch__track {
  background: var(--ns-ink-soft);
}

.fs-switch:active .fs-switch__track {
  box-shadow: none;
}

/* Controls sit on the raised window surface. Focus stays visible without
   adding a second raised layer. */
.ns-window .ns-input:focus,
.ns-window .ns-field input:focus,
.ns-window .ns-field textarea:focus,
.ns-window .ns-field select:focus {
  box-shadow: none;
  outline: 2px solid var(--ns-ink);
  outline-offset: 2px;
}

.fs-switch:focus-visible {
  outline: 2px solid var(--ns-ink);
  outline-offset: 2px;
}

.fs-switch:disabled {
  color: var(--ns-ink-faint);
  cursor: not-allowed;
}

.fs-switch:disabled .fs-switch__track,
.fs-switch:disabled .fs-switch__thumb {
  border-color: var(--ns-ink-faint);
  box-shadow: none;
}

.ns-actions > .fs-push-end {
  margin-left: auto;
}

.fs-check {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: var(--ns-h-lg);
  font-size: var(--ns-text-sm);
  font-weight: 600;
  cursor: pointer;
}

.fs-check[hidden],
.ns-field[hidden] {
  display: none;
}

.ns-field textarea {
  font-family: var(--ns-font-mono);
  line-height: 1.5;
}

/* ---- Evals -------------------------------------------------------------- */

.fs-evals {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--ns-ink);
  background: var(--ns-paper);
}

.fs-eval + .fs-eval {
  border-top: 1px solid var(--ns-rule);
}

.fs-eval summary {
  display: grid;
  grid-template-columns: minmax(0, 15rem) 9rem 1fr auto;
  align-items: center;
  gap: calc(var(--ns-unit) * 3);
  padding: calc(var(--ns-unit) * 2) calc(var(--ns-unit) * 3);
  cursor: pointer;
  list-style: none;
}

.fs-eval summary::-webkit-details-marker {
  display: none;
}

.fs-eval summary:hover {
  background: var(--ns-wash);
}

.fs-eval[open] summary {
  background: var(--ns-ink);
  color: var(--ns-paper);
}

.fs-eval[open] summary code {
  color: var(--ns-paper);
  border-color: var(--ns-paper);
  background: transparent;
}

.fs-eval summary code {
  justify-self: start;
  max-width: 100%;
  overflow-wrap: anywhere;
}

.fs-eval__type {
  font-size: var(--ns-text-xs);
  color: var(--ns-ink-soft);
}

.fs-eval[open] .fs-eval summary code {
  justify-self: start;
  max-width: 100%;
  overflow-wrap: anywhere;
}

.fs-eval__type {
  color: inherit;
}

.fs-eval > form {
  padding: calc(var(--ns-unit) * 3);
  border-top: 1px solid var(--ns-ink);
  background: var(--ns-wash);
}

@media (max-width: 640px) {
  .fs-eval summary {
    grid-template-columns: 1fr auto;
  }
  .fs-eval__prompt {
    grid-column: 1 / -1;
    grid-row: 2;
  }
}

/* ---- Player ------------------------------------------------------------- */

.fs-player {
  position: relative;
  aspect-ratio: 16 / 9;
  border: 1px solid var(--ns-ink);
  background: var(--ns-ink);
  box-shadow: var(--ns-shadow);
}

.fs-live-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 24rem), 1fr));
  gap: calc(var(--ns-unit) * 4);
}

.fs-live-grid > section {
  min-width: 0;
  padding: calc(var(--ns-unit) * 3);
  border: 1px solid var(--ns-rule);
  background: var(--ns-paper);
}

/* Stream controls: one compact row under the player. Name, player, and
   controls sit close together. */
.fs-live-grid > section > * + * {
  margin-top: calc(var(--ns-unit) * 2);
}

.fs-stream-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: calc(var(--ns-unit) * 1) calc(var(--ns-unit) * 4);
  min-width: 0;
}

.fs-stream-bar .fs-switch {
  min-height: var(--ns-h-sm);
  gap: calc(var(--ns-unit) * 1.5);
  font-size: var(--ns-text-xs);
}

.fs-stream-bar .fs-switch__track {
  width: 28px;
  height: 14px;
}

.fs-stream-bar .fs-switch__thumb {
  top: 1px;
  left: 1px;
  width: 10px;
  height: 10px;
}

.fs-stream-bar .fs-switch[aria-checked="true"] .fs-switch__thumb {
  left: 15px;
}

.fs-stream-bar__link {
  display: inline-flex;
  align-items: center;
  gap: var(--ns-unit);
  flex: 0 1 auto;
  min-width: 0;
  font-family: var(--ns-font-mono);
  font-size: var(--ns-text-xs);
}

.fs-stream-bar__link a {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: inherit;
}

.fs-stream-bar > .fs-push-end {
  margin-left: auto;
}

.fs-ingest-modal {
  width: min(48rem, calc(100vw - 2rem));
}

.fs-ingest-window {
  overflow-wrap: anywhere;
}

.fs-eval-config > summary {
  cursor: pointer;
  font-weight: 600;
}

.fs-eval-config[open] > summary {
  margin-bottom: calc(var(--ns-unit) * 3);
}

.fs-player iframe,
.fs-player video,
.fs-player img {
  position: absolute;
  display: block;
  width: 100%;
  height: 100%;
  border: 0;
  object-fit: contain;
}

.fs-player .ns-badge {
  position: absolute;
  top: calc(var(--ns-unit) * 2);
  left: calc(var(--ns-unit) * 2);
  pointer-events: none;
}

/* ---- Keys --------------------------------------------------------------- */

.fs-keys {
  display: flex;
  flex-direction: column;
  gap: calc(var(--ns-unit) * 4);
}

.fs-keyrow {
  display: flex;
  flex-direction: column;
  gap: calc(var(--ns-unit) * 2);
}

.fs-keyrow__head {
  display: flex;
  align-items: center;
  gap: calc(var(--ns-unit) * 3);
}

.fs-keyrow__name {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-weight: 600;
  margin-right: auto;
}

/* ---- Device code -------------------------------------------------------- */

/* JS adds .is-ready: the real input sits on top, see-through, and the
   cells under it show what was typed. */
.fs-code {
  position: relative;
  width: max-content;
  max-width: 100%;
}

.fs-code__cells {
  display: none;
}

.fs-code.is-ready .fs-code__cells {
  display: flex;
  align-items: center;
  gap: min(calc(var(--ns-unit) * 1.5), 1.5vw);
}

.fs-code.is-ready .fs-code__input {
  position: absolute;
  inset: 0;
  z-index: 1;
  width: 100%;
  height: 100%;
  color: transparent;
  caret-color: transparent;
  background: transparent;
  border-color: transparent;
  box-shadow: none;
  cursor: text;
}

.fs-code.is-ready .fs-code__input::placeholder {
  color: transparent;
}

.fs-code__cell {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.25rem;
  height: 2.75rem;
  flex: 0 1 2.25rem;
  min-width: 0;
  border: 1px solid var(--ns-ink);
  border-radius: var(--ns-radius);
  background: var(--ns-paper);
  font-family: var(--ns-font-mono);
  font-size: var(--ns-text-xl);
  font-weight: 600;
}

.fs-code__dash {
  font-family: var(--ns-font-mono);
  font-size: var(--ns-text-xl);
  font-weight: 600;
}

.fs-code__input:focus + .fs-code__cells .fs-code__cell.is-next {
  box-shadow: 2px 2px 0 var(--ns-ink);
}

.fs-keyrow__title {
  padding: 0;
  border: 0;
  border-bottom: 1px dashed transparent;
  background: none;
  color: inherit;
  font: inherit;
  cursor: text;
}

.fs-keyrow__title:hover,
.fs-keyrow__title:focus-visible {
  border-bottom-color: var(--ns-ink);
  outline: 0;
}

.fs-keyrow__input.ns-input {
  width: 16rem;
  max-width: 100%;
  min-height: 0;
  padding: 0 4px;
  font-weight: 600;
}

/* ---- Account ------------------------------------------------------------ */

.fs-stat {
  display: flex;
  flex-direction: column;
  gap: 2px;
  color: inherit;
  text-decoration: none;
  background: var(--ns-paper);
}

.fs-stat b {
  font-size: var(--ns-text-2xl);
  line-height: 1.1;
}

.fs-stat span {
  font-size: var(--ns-text-xs);
  color: var(--ns-ink-soft);
}

a.fs-stat:hover {
  background: var(--ns-wash);
}

/* ---- Dev mail ----------------------------------------------------------- */

.fs-mail {
  margin: 0;
  padding: calc(var(--ns-unit) * 4);
  border: 1px solid var(--ns-ink);
  background: var(--ns-paper);
  font-family: var(--ns-font-mono);
  font-size: var(--ns-text-md);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.fs-mail-frame {
  width: 100%;
  height: 32rem;
  border: 1px solid var(--ns-ink);
  background: #fff;
}

/* ---- Tables ------------------------------------------------------------- */

.fs-scroll-x {
  overflow-x: auto;
}

.fs-table-actions {
  text-align: right;
  white-space: nowrap;
}

/* ---- Support ------------------------------------------------------------ */

.fs-status {
  display: inline-block;
  padding: 0 calc(var(--ns-unit) * 2);
  border: 1px solid var(--ns-ink);
  font-size: var(--ns-text-xs);
  text-transform: uppercase;
}

.fs-status.is-open {
  background: var(--ns-ink);
  color: var(--ns-paper);
}

.fs-reports td {
  white-space: nowrap;
}

.fs-reports .fs-reports__title {
  width: 100%;
  white-space: normal;
  overflow-wrap: anywhere;
}

.fs-post .fs-label time {
  font-weight: 400;
  color: var(--ns-ink-soft);
}

.fs-post.is-team .fs-mail {
  background: var(--ns-wash);
}

.fs-post__logs {
  margin-top: calc(var(--ns-unit) * 2);
}

.fs-post__logs summary {
  cursor: pointer;
  font-size: var(--ns-text-sm);
  font-weight: 600;
}

/* ---- Stats -------------------------------------------------------------- */

.fs-stat-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(7rem, 1fr));
  gap: calc(var(--ns-unit) * 3);
  margin-bottom: calc(var(--ns-unit) * 5);
}

/* ---- Landing ------------------------------------------------------------ */

.fs-landing {
  min-height: 100svh;
  display: grid;
  place-items: center;
  padding: calc(var(--ns-unit) * 6) calc(var(--ns-unit) * 4);
}

.fs-hero {
  width: min(100%, 44rem);
  text-align: center;
}

/* No box: a paper halo keeps the script legible over the dither. */
.fs-hero .fs-mark {
  display: block;
  margin: 0;
  font-size: clamp(6rem, 26vw, 13rem);
  line-height: 0.9;
  padding: 0.1em 0.15em 0.2em;
  text-shadow:
    0 0 6px var(--ns-paper),
    0 0 12px var(--ns-paper),
    0 0 18px var(--ns-paper),
    0 0 28px var(--ns-paper);
  animation: fs-open 700ms var(--fs-ease) both;
}

.fs-tagline {
  margin: calc(var(--ns-unit) * 2) 0 0;
  font-size: var(--ns-text-lg);
  font-weight: 600;
  letter-spacing: 0.08em;
  text-shadow:
    0 0 3px var(--ns-paper),
    0 0 6px var(--ns-paper),
    0 0 10px var(--ns-paper),
    0 0 16px var(--ns-paper);
}

.fs-hero__actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: calc(var(--ns-unit) * 4);
  margin-top: calc(var(--ns-unit) * 10);
}

.fs-agent-link {
  display: inline-block;
  margin-top: calc(var(--ns-unit) * 6);
  color: var(--ns-ink);
  font-size: var(--ns-text-md);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.ns-button.fs-big-btn {
  min-width: 11rem;
  min-height: 56px;
  padding: 0 28px;
  font-size: var(--ns-text-lg);
  box-shadow: 4px 4px 0 var(--fs-primary-shadow);
}

.ns-button.fs-big-btn:hover {
  transform: translate(-2px, -2px);
  box-shadow: 6px 6px 0 var(--fs-primary-shadow);
}

/* ---- Docs --------------------------------------------------------------- */

.fs-doc {
  font-size: var(--ns-text-md);
  line-height: 1.65;
}

/* The doc title is the product name, so it wears the mark. */
.fs-doc h1 {
  font-family: var(--fs-script);
  font-weight: 400;
  font-size: 5rem;
  line-height: 1;
  text-transform: lowercase;
  margin: 0 0 0.75rem;
}

.fs-doc h2,
.fs-doc h3 {
  scroll-margin-top: 52px;
}

.fs-doc h3:target {
  background: var(--ns-ink);
  color: var(--ns-paper);
  padding: 0 6px;
}

.fs-doc h2 {
  margin-top: 2rem;
  padding-bottom: 4px;
  border-bottom: 1px solid var(--ns-ink);
}

.fs-doc pre {
  padding: calc(var(--ns-unit) * 3);
  border: 1px solid var(--ns-ink);
  background: var(--ns-wash);
  overflow-x: auto;
  font-size: var(--ns-text-sm);
}

.fs-doc code {
  word-break: break-word;
}

/* ---- Small screens ------------------------------------------------------ */

@media (max-width: 640px) {
  .ns-menubar.fs-top {
    --ns-nav-pad: 6px;
  }
  .ns-menubar .fs-mark {
    font-size: 1.6rem;
    padding: 0 10px;
    margin-right: 2px;
  }
  .fs-drop [data-drop-status]:empty {
    display: none;
  }
  .fs-main {
    padding: calc(var(--ns-unit) * 3) calc(var(--ns-unit) * 2) calc(var(--ns-unit) * 12);
  }
  .fs-cards {
    grid-template-columns: repeat(auto-fill, minmax(10rem, 1fr));
    gap: calc(var(--ns-unit) * 3);
  }
  .fs-drop {
    flex-direction: column;
    align-items: stretch;
  }
  .fs-drop__context {
    max-width: none;
  }
  .fs-drop .ns-input,
  .fs-drop input[type="text"] {
    max-width: none;
  }
  .ns-window__body {
    padding: calc(var(--ns-unit) * 3);
  }
  .fs-hide-sm {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
  }
}

/* Customer metadata: key/value rows, and its JSON editor. */
.fs-meta {
  display: grid;
  grid-template-columns: minmax(0, max-content) minmax(0, 1fr);
  gap: calc(var(--ns-unit) * 1) calc(var(--ns-unit) * 3);
  margin: 0;
  font-size: var(--ns-text-sm);
}

.fs-meta__row {
  display: contents;
}

.fs-meta dt {
  color: var(--ns-ink-soft);
  font-family: var(--ns-font-mono, monospace);
  overflow-wrap: anywhere;
}

.fs-meta dd {
  margin: 0;
  overflow-wrap: anywhere;
}

.fs-meta-edit > summary {
  display: inline-flex;
  align-items: center;
  gap: calc(var(--ns-unit) * 1);
  cursor: pointer;
  font-size: var(--ns-text-xs);
  color: var(--ns-ink-soft);
}

.fs-meta-edit[open] > summary {
  margin-bottom: calc(var(--ns-unit) * 2);
}

.fs-json {
  font-family: var(--ns-font-mono, monospace);
  font-size: var(--ns-text-sm);
}

.fs-json.is-invalid {
  outline: 2px solid var(--ns-danger, #b3261e);
}
