/* Shared components (design/redesign-2026-10/theme.css: base, type, tags, avatars and marks,
   buttons, inputs and controls, surfaces, media, sheets and dialogs, toast, reduced motion;
   NOTES.md §5 and §6). Pages compose these; their own files hold only their layouts. */

/* ---------------------------------------------------------------- base */
*,
*::before,
*::after {
  box-sizing: border-box;
}
html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: var(--fs-14);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-feature-settings: 'ss01' on;
  overflow-x: hidden;
}
h1,
h2,
h3,
h4,
p,
ul,
ol,
figure {
  margin: 0;
}
ul,
ol {
  padding: 0;
}
img,
svg,
video {
  display: block;
  max-width: 100%;
}
button,
input,
textarea,
select {
  font: inherit;
  color: inherit;
}
button {
  cursor: pointer;
  background: none;
  border: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}
a {
  color: inherit;
  text-decoration: none;
}
:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
  border-radius: var(--r-2);
}
[hidden] {
  display: none !important;
}
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}
.num {
  font-variant-numeric: tabular-nums;
}
.mono {
  font-family: var(--font-mono);
  font-size: 0.92em;
}
.serif {
  font-family: var(--font-serif);
}
.muted {
  color: var(--ink-3);
}
.faint {
  color: var(--ink-4);
}
.trunc {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.i {
  width: 18px;
  height: 18px;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.75;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.i-sm {
  width: 15px;
  height: 15px;
}
.i-xs {
  width: 13px;
  height: 13px;
  stroke-width: 2;
}
.i-fill {
  fill: currentColor;
  stroke: none;
}
kbd,
.kbd {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 20px;
  padding: 0 5px;
  border-radius: var(--r-1);
  background: var(--surface-2);
  box-shadow: inset 0 0 0 1px var(--line);
  font: 500 11px/1 var(--font-sans);
  color: var(--ink-3);
}

/* ---------------------------------------------------------------- type */
.t-display {
  font-family: var(--font-serif);
  font-size: var(--fs-38);
  line-height: 1.12;
  font-weight: 400;
  letter-spacing: -0.012em;
  font-optical-sizing: auto;
  text-wrap: balance;
}
.t-title {
  font-family: var(--font-serif);
  font-size: var(--fs-30);
  line-height: 1.15;
  font-weight: 400;
  letter-spacing: -0.01em;
  text-wrap: balance;
}
.t-h2 {
  font-size: var(--fs-15);
  line-height: 1.3;
  font-weight: 650;
  letter-spacing: -0.005em;
  color: var(--ink);
  text-wrap: balance;
}
.t-h3 {
  font-size: var(--fs-14);
  font-weight: 600;
  color: var(--ink);
}
.t-body {
  font-size: var(--fs-14);
  color: var(--ink-2);
  text-wrap: pretty;
}
.t-small {
  font-size: var(--fs-13);
  color: var(--ink-3);
}
.t-tiny {
  font-size: var(--fs-12);
  color: var(--ink-3);
}
.prose {
  font-family: var(--font-serif);
  font-size: 16.5px;
  line-height: 1.65;
  color: var(--ink);
  text-wrap: pretty;
}
.prose > * + * {
  margin-top: 0.7em;
}
.prose ul,
.prose ol {
  padding-left: 1.3em;
}
.prose li + li {
  margin-top: 0.3em;
}
.prose strong {
  font-weight: 600;
}
.prose code {
  font-family: var(--font-mono);
  font-size: 0.84em;
  padding: 0.12em 0.36em;
  border-radius: var(--r-1);
  background: var(--surface-2);
  box-shadow: inset 0 0 0 1px var(--line);
}

/* ---------------------------------------------------------------- tags: .status and .label */
/* Hue defaults sit in :where() (zero specificity) so a modifier class always wins, whatever the
   order of the rules. Components only ever read --h and --chroma; :root holds the neutral
   fallback that bare dots inherit. */
:root {
  --h: 80;
  --chroma: 1;
}
:where(.status, .label, .count) {
  --h: 80;
  --chroma: 1;
}
/* a bare .dot takes its hue from its own modifier or, without one, from its parent (a chip) */
:where(.meter) {
  --h: var(--hue-green);
  --chroma: 1;
}
:where(.chip) {
  --h: 80;
  --chroma: 0;
}
:where(.avatar) {
  --h: 80;
  --chroma: 0.7;
}
:where(.mark) {
  --h: 300;
}
.status,
.label {
  justify-self: start; /* never stretch inside a grid cell */
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex: none;
  max-width: 100%;
  font-size: var(--fs-12);
  font-weight: 600;
  line-height: 1;
  white-space: nowrap;
  color: oklch(var(--tone-ink-l) calc(var(--tone-ink-c) * var(--chroma)) var(--h));
  background: oklch(var(--tone-dot-l) calc(var(--tone-dot-c) * var(--chroma)) var(--h) / var(--tone-fill-a));
  box-shadow: inset 0 0 0 1px oklch(var(--tone-dot-l) calc(var(--tone-dot-c) * var(--chroma)) var(--h) / var(--tone-edge-a));
  font-variant-numeric: tabular-nums;
}
.status {
  height: 22px;
  padding: 0 9px 0 8px;
  border-radius: 999px;
}
.status::before {
  content: '';
  width: 7px;
  height: 7px;
  flex: none;
  border-radius: 50%;
  background: oklch(var(--tone-dot-l) calc(var(--tone-dot-c) * var(--chroma)) var(--h));
}
.status.no-dot::before {
  display: none;
}
.status.no-dot {
  padding: 0 9px;
}
.status.is-live::before {
  animation: dot-pulse 1.8s var(--ease) infinite;
}
.status.is-solid {
  color: var(--tone-solid-ink);
  background: oklch(calc(var(--tone-dot-l) - 0.06) calc(var(--tone-dot-c) * var(--chroma)) var(--h));
  box-shadow: none;
}
.status.is-solid::before {
  background: var(--tone-solid-ink);
}
.status.is-quiet {
  background: none;
  box-shadow: none;
  padding: 0;
  height: auto;
}
.label {
  height: 20px;
  padding: 0 7px;
  border-radius: var(--r-1);
  font-weight: 600;
}
.label.is-plain {
  background: none;
  box-shadow: none;
  padding: 0;
  height: auto;
}
.dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  flex: none;
  border-radius: 50%;
  background: oklch(var(--tone-dot-l) calc(var(--tone-dot-c) * var(--chroma)) var(--h));
}
.dot.is-live {
  animation: dot-pulse 1.8s var(--ease) infinite;
}
.dot.is-hollow {
  background: none;
  box-shadow: inset 0 0 0 2px oklch(var(--tone-dot-l) calc(var(--tone-dot-c) * var(--chroma)) var(--h));
}
.count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 18px;
  padding: 0 6px;
  border-radius: 999px;
  font: 650 11.5px/1 var(--font-sans);
  font-variant-numeric: tabular-nums;
  color: oklch(var(--tone-ink-l) calc(var(--tone-ink-c) * var(--chroma)) var(--h));
  background: oklch(var(--tone-dot-l) calc(var(--tone-dot-c) * var(--chroma)) var(--h) / var(--tone-fill-a));
}
.count.is-solid {
  color: var(--tone-solid-ink);
  background: oklch(calc(var(--tone-dot-l) - 0.06) calc(var(--tone-dot-c) * var(--chroma)) var(--h));
}
@keyframes dot-pulse {
  0% {
    box-shadow: 0 0 0 0 oklch(var(--tone-dot-l) calc(var(--tone-dot-c) * var(--chroma)) var(--h) / 0.55);
  }
  70% {
    box-shadow: 0 0 0 5px oklch(var(--tone-dot-l) calc(var(--tone-dot-c) * var(--chroma)) var(--h) / 0);
  }
  100% {
    box-shadow: 0 0 0 0 oklch(var(--tone-dot-l) calc(var(--tone-dot-c) * var(--chroma)) var(--h) / 0);
  }
}

/* hue modifiers: raw */
.h-red { --h: var(--hue-red); }
.h-orange { --h: var(--hue-orange); }
.h-amber { --h: var(--hue-amber); }
.h-yellow { --h: var(--hue-yellow); }
.h-green { --h: var(--hue-green); }
.h-teal { --h: var(--hue-teal); }
.h-blue { --h: var(--hue-blue); }
.h-indigo { --h: var(--hue-indigo); }
.h-violet { --h: var(--hue-violet); }
.h-pink { --h: var(--hue-pink); }
.h-clay { --h: var(--hue-clay); }
.h-neutral { --h: 80; --chroma: 0; }

/* semantic modifiers: use these in markup, never a raw hue for a state */
.s-working, .s-running, .s-routed { --h: var(--hue-blue); --chroma: 1; }
.s-starting, .s-queued, .s-sending { --h: var(--hue-indigo); --chroma: 1; }
.s-needs, .s-nearly, .s-open, .s-ask { --h: var(--hue-amber); --chroma: 1; }
.s-review { --h: var(--hue-violet); --chroma: 1; }
.s-approved, .s-done, .s-ok, .s-live, .s-connected, .s-fixed { --h: var(--hue-green); --chroma: 1; }
.s-test, .s-playtest { --h: var(--hue-teal); --chroma: 1; }
.s-declined, .s-error, .s-limited, .s-broken { --h: var(--hue-red); --chroma: 1; }
.s-redo { --h: var(--hue-orange); --chroma: 1; }
.s-idle, .s-paused, .s-stopped, .s-draft, .s-archived, .s-wontfix { --h: 80; --chroma: 0; }

/* board columns */
.col-ideas { --h: var(--hue-yellow); --chroma: 1; }
.col-next { --h: var(--hue-teal); --chroma: 1; }
.col-doing { --h: var(--hue-blue); --chroma: 1; }
.col-check { --h: var(--hue-violet); --chroma: 1; }
.col-done { --h: var(--hue-green); --chroma: 1; }

/* roles */
.r-owner { --h: var(--hue-clay); --chroma: 1.05; }
.r-developer { --h: var(--hue-indigo); --chroma: 1; }
.r-tester { --h: var(--hue-teal); --chroma: 1; }
.r-viewer { --h: 80; --chroma: 0; }

/* areas and asset groups */
.a-combat { --h: var(--hue-orange); --chroma: 1; }
.a-vfx { --h: var(--hue-pink); --chroma: 1; }
.a-ui, .a-ui-motion, .a-icons { --h: var(--hue-blue); --chroma: 1; }
.a-world, .a-map { --h: var(--hue-green); --chroma: 1; }
.a-animation { --h: var(--hue-amber); --chroma: 1; }
.a-characters { --h: var(--hue-violet); --chroma: 1; }
.a-monetization, .a-shop { --h: var(--hue-yellow); --chroma: 1; }
.a-audio { --h: var(--hue-teal); --chroma: 1; }
.a-models { --h: var(--hue-indigo); --chroma: 1; }
.a-bugs { --h: var(--hue-red); --chroma: 1; }
.a-other, .a-gameplay { --h: 80; --chroma: 0; }

/* ---------------------------------------------------------------- avatars and game marks */
.avatar {
  display: inline-grid;
  place-items: center;
  width: 28px;
  height: 28px;
  flex: none;
  border-radius: 50%;
  font: 650 11.5px/1 var(--font-sans);
  letter-spacing: 0.01em;
  color: oklch(var(--tone-ink-l) calc(var(--tone-ink-c) * var(--chroma)) var(--h));
  background: oklch(var(--tone-dot-l) calc(var(--tone-dot-c) * var(--chroma)) var(--h) / calc(var(--tone-fill-a) + 0.08));
}
.avatar.is-sm {
  width: 22px;
  height: 22px;
  font-size: 10px;
}
.avatar.is-lg {
  width: 44px;
  height: 44px;
  font-size: 15px;
}
.avatar.is-agent {
  border-radius: 8px;
  --h: 80;
  --chroma: 0;
  color: var(--ink-3);
  background: var(--surface-2);
  box-shadow: inset 0 0 0 1px var(--line);
}
.avatar.is-agent.is-sm {
  border-radius: 6px;
}
.avatar-stack {
  display: inline-flex;
}
.avatar-stack .avatar {
  box-shadow: 0 0 0 2px var(--surface);
}
.avatar-stack .avatar + .avatar {
  margin-left: -6px;
}
.mark {
  display: inline-grid;
  place-items: center;
  width: 30px;
  height: 30px;
  flex: none;
  border-radius: 9px;
  font: 700 11px/1 var(--font-sans);
  letter-spacing: 0.02em;
  color: #fff;
  background: linear-gradient(160deg, oklch(0.66 0.15 var(--h)), oklch(0.52 0.15 calc(var(--h) + 18)));
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.14), 0 1px 2px rgba(0, 0, 0, 0.12);
}
.mark.is-sm {
  width: 22px;
  height: 22px;
  border-radius: 6px;
  font-size: 9px;
}
.mark.is-xs {
  width: 16px;
  height: 16px;
  border-radius: 5px;
  font-size: 0;
}
.mark.is-lg {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  font-size: 13px;
}
.mark.is-paused {
  filter: saturate(0.15);
  opacity: 0.75;
}

/* ---------------------------------------------------------------- buttons */
.btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  height: 36px;
  padding: 0 14px;
  flex: none;
  border-radius: var(--r-3);
  font-size: var(--fs-14);
  font-weight: 560;
  line-height: 1;
  white-space: nowrap;
  color: var(--ink);
  background: var(--surface);
  box-shadow: inset 0 0 0 1px var(--line-2), 0 1px 1px rgba(48, 42, 30, 0.04);
  transition-property: background-color, box-shadow, color, scale;
  transition-duration: var(--t-fast);
  transition-timing-function: var(--ease);
}
.btn:hover {
  background: var(--surface-2);
}
.btn:active {
  scale: 0.96;
}
.btn:disabled {
  opacity: 0.5;
  pointer-events: none;
}
.btn .i {
  width: 16px;
  height: 16px;
}
.btn.is-sm {
  height: 30px;
  padding: 0 11px;
  font-size: var(--fs-13);
  border-radius: var(--r-2);
}
.btn.is-sm::after {
  content: '';
  position: absolute;
  inset: -5px 0;
}
.btn.is-accent {
  color: var(--accent-ink);
  background: var(--accent);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.14), 0 1px 2px rgba(120, 50, 20, 0.2);
}
.btn.is-accent:hover {
  background: var(--accent-hover);
}
.btn.is-ink {
  color: var(--bg);
  background: var(--ink);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.15);
}
.btn.is-ink:hover {
  background: var(--ink-2);
}
.btn.is-approve {
  --h: var(--hue-green);
  color: #fff;
  background: oklch(0.56 0.13 var(--h));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.14), 0 1px 2px rgba(0, 60, 20, 0.2);
}
.btn.is-approve:hover {
  background: oklch(0.52 0.13 var(--h));
}
.btn.is-decline {
  --h: var(--hue-red);
  color: oklch(var(--tone-ink-l) var(--tone-ink-c) var(--h));
  background: var(--surface);
  box-shadow: inset 0 0 0 1px oklch(var(--tone-dot-l) var(--tone-dot-c) var(--h) / 0.4);
}
.btn.is-decline:hover {
  background: oklch(var(--tone-dot-l) var(--tone-dot-c) var(--h) / var(--tone-fill-a));
}
.btn.is-danger {
  --h: var(--hue-red);
  color: #fff;
  background: oklch(0.56 0.17 var(--h));
  box-shadow: none;
}
.btn.is-quiet {
  background: none;
  box-shadow: none;
  color: var(--ink-2);
}
.btn.is-quiet:hover {
  background: var(--hover);
  color: var(--ink);
}
.btn.is-link {
  height: auto;
  padding: 0;
  background: none;
  box-shadow: none;
  color: var(--accent);
  font-weight: 560;
}
.btn.is-link:hover {
  text-decoration: underline;
  text-underline-offset: 3px;
}
.icon-btn {
  position: relative;
  display: inline-grid;
  place-items: center;
  width: 34px;
  height: 34px;
  flex: none;
  border-radius: var(--r-2);
  color: var(--ink-3);
  transition-property: background-color, color, scale;
  transition-duration: var(--t-fast);
  transition-timing-function: var(--ease);
}
.icon-btn:hover {
  background: var(--hover);
  color: var(--ink);
}
.icon-btn:active {
  scale: 0.96;
}
.icon-btn.is-sm {
  width: 28px;
  height: 28px;
  border-radius: 7px;
}
.icon-btn.is-sm::after {
  content: '';
  position: absolute;
  inset: -6px;
}
.btn-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

/* ---------------------------------------------------------------- inputs and controls */
.field {
  display: grid;
  gap: 6px;
}
.field > span {
  font-size: var(--fs-13);
  font-weight: 600;
  color: var(--ink-2);
}
.input,
.textarea,
.select {
  width: 100%;
  min-width: 0;
  height: 40px;
  padding: 0 12px;
  border: 0;
  border-radius: var(--r-3);
  background: var(--surface);
  box-shadow: inset 0 0 0 1px var(--line-2);
  font-size: var(--fs-14);
  color: var(--ink);
  transition: box-shadow var(--t-fast) var(--ease);
}
.textarea {
  height: auto;
  min-height: 96px;
  padding: 10px 12px;
  resize: vertical;
  line-height: 1.5;
}
.input::placeholder,
.textarea::placeholder {
  color: var(--ink-4);
}
.input:focus,
.textarea:focus,
.select:focus {
  outline: none;
  box-shadow: inset 0 0 0 1px var(--accent), 0 0 0 3px var(--accent-soft);
}
.search {
  position: relative;
  display: flex;
  align-items: center;
  min-width: 0;
}
.search .i {
  position: absolute;
  left: 11px;
  color: var(--ink-4);
  pointer-events: none;
}
.search .input {
  padding-left: 36px;
  height: 36px;
}
.seg {
  display: inline-flex;
  max-width: 100%;
  padding: 3px;
  gap: 2px;
  border-radius: var(--r-3);
  background: var(--surface-2);
  box-shadow: inset 0 0 0 1px var(--line);
  overflow-x: auto;
  scrollbar-width: none;
}
.seg::-webkit-scrollbar {
  display: none;
}
.seg button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 28px;
  padding: 0 11px;
  border-radius: 7px; /* 10 outer - 3 padding */
  font-size: var(--fs-13);
  font-weight: 560;
  color: var(--ink-3);
  white-space: nowrap;
  transition-property: background-color, color, box-shadow;
  transition-duration: var(--t-fast);
}
.seg button:hover {
  color: var(--ink);
}
.seg button[aria-pressed='true'],
.seg button[aria-selected='true'] {
  color: var(--ink);
  background: var(--surface);
  box-shadow: var(--shadow-1);
}
.chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 32px;
  padding: 0 12px;
  flex: none;
  border-radius: 999px;
  font-size: var(--fs-13);
  font-weight: 560;
  color: var(--ink-2);
  background: var(--surface);
  box-shadow: inset 0 0 0 1px var(--line-2);
  white-space: nowrap;
  transition-property: background-color, color, box-shadow, scale;
  transition-duration: var(--t-fast);
}
.chip:hover {
  background: var(--surface-2);
}
.chip:active {
  scale: 0.96;
}
.chip .dot {
  width: 7px;
  height: 7px;
}
.chip[aria-pressed='true'] {
  color: oklch(var(--tone-ink-l) calc(var(--tone-ink-c) * var(--chroma)) var(--h));
  background: oklch(var(--tone-dot-l) calc(var(--tone-dot-c) * var(--chroma)) var(--h) / var(--tone-fill-a));
  box-shadow: inset 0 0 0 1.5px oklch(var(--tone-dot-l) calc(var(--tone-dot-c) * var(--chroma)) var(--h) / 0.55);
}
.chip.is-all[aria-pressed='true'] {
  color: var(--bg);
  background: var(--ink);
  box-shadow: none;
}
.chip .n {
  font-variant-numeric: tabular-nums;
  color: var(--ink-4);
  font-weight: 600;
}
.chip[aria-pressed='true'] .n {
  color: inherit;
  opacity: 0.75;
}
.chip-row {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  scrollbar-width: none;
  padding: 2px;
  margin: -2px;
}
.chip-row::-webkit-scrollbar {
  display: none;
}
.radio-card {
  position: relative;
  display: grid;
  grid-template-columns: 20px 1fr auto;
  gap: 4px 12px;
  align-items: start;
  padding: 14px 16px;
  border-radius: var(--r-4);
  background: var(--surface);
  box-shadow: inset 0 0 0 1px var(--line-2);
  cursor: pointer;
  transition: box-shadow var(--t-fast) var(--ease);
}
.radio-card:hover {
  box-shadow: inset 0 0 0 1px var(--ink-4);
}
.radio-card input {
  appearance: none;
  width: 18px;
  height: 18px;
  margin: 1px 0 0;
  border-radius: 50%;
  box-shadow: inset 0 0 0 1.5px var(--ink-4);
  transition: box-shadow var(--t-fast) var(--ease);
}
.radio-card input:checked {
  box-shadow: inset 0 0 0 5.5px var(--accent);
}
.radio-card:has(input:checked) {
  box-shadow: inset 0 0 0 1.5px var(--accent), 0 0 0 3px var(--accent-soft);
}
.radio-card .t-small {
  grid-column: 2 / -1;
}
.switch {
  position: relative;
  width: 36px;
  height: 22px;
  flex: none;
  border-radius: 999px;
  background: var(--surface-3);
  box-shadow: inset 0 0 0 1px var(--line);
  transition: background-color var(--t-med) var(--ease);
}
.switch::after {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.25);
  transition: translate var(--t-med) var(--ease);
}
.switch[aria-checked='true'] {
  background: var(--accent);
}
.switch[aria-checked='true']::after {
  translate: 14px 0;
}

/* ---------------------------------------------------------------- surfaces */
.panel {
  border-radius: var(--r-5);
  background: var(--surface);
  box-shadow: var(--shadow-1);
}
.card {
  border-radius: var(--r-4);
  background: var(--surface);
  box-shadow: var(--shadow-1);
}
.well {
  border-radius: var(--r-4);
  background: var(--surface-2);
}
.divider {
  height: 1px;
  background: var(--line);
  border: 0;
  margin: 0;
}
.rows {
  list-style: none;
  display: grid;
}
.rows > li + li {
  box-shadow: inset 0 1px 0 var(--line);
}
.meter {
  position: relative;
  height: 6px;
  border-radius: 999px;
  background: var(--surface-3);
  overflow: hidden;
}
.meter > i {
  position: absolute;
  inset: 0 auto 0 0;
  border-radius: inherit;
  background: oklch(var(--tone-dot-l) calc(var(--tone-dot-c) * var(--chroma)) var(--h));
}
.empty {
  display: grid;
  justify-items: center;
  gap: 6px;
  padding: 32px 16px;
  text-align: center;
  color: var(--ink-3);
}

/* ---------------------------------------------------------------- media */
.media {
  position: relative;
  display: block;
  aspect-ratio: 16 / 9;
  border-radius: var(--r-4);
  background: var(--stage);
  overflow: hidden;
  isolation: isolate;
}
.media::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  box-shadow: inset 0 0 0 1px var(--img-outline);
  pointer-events: none;
}
.media > svg {
  width: 100%;
  height: 100%;
}
.media .play {
  position: absolute;
  left: 50%;
  top: 50%;
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  margin: -21px 0 0 -21px;
  border-radius: 50%;
  color: #fff;
  background: rgba(20, 20, 18, 0.45);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.18);
}
.media .play .i {
  width: 16px;
  height: 16px;
  margin-left: 2px; /* optical centre of the triangle */
}
.media .badge {
  position: absolute;
  left: 8px;
  bottom: 8px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 22px;
  padding: 0 7px;
  border-radius: 6px;
  font: 600 11.5px/1 var(--font-sans);
  font-variant-numeric: tabular-nums;
  color: #fff;
  background: rgba(20, 20, 18, 0.55);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}
.media .badge.is-right {
  left: auto;
  right: 8px;
}
.media .badge.is-top {
  bottom: auto;
  top: 8px;
}

/* ---------------------------------------------------------------- sheets and drawers */
.sheet {
  position: fixed;
  z-index: 50;
  top: 0;
  right: 0;
  bottom: 0;
  display: flex;
  flex-direction: column;
  width: min(460px, 100%);
  background: var(--surface);
  box-shadow: var(--shadow-pop);
  transition-property: translate, opacity;
  transition-duration: 260ms;
  transition-timing-function: var(--ease-out);
}
.sheet:not(.is-open) {
  translate: 24px 0;
  opacity: 0;
  pointer-events: none;
  visibility: hidden;
}
.sheet-head {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 18px 18px 14px 22px;
  box-shadow: inset 0 -1px 0 var(--line);
}
.sheet-body {
  flex: 1;
  overflow-y: auto;
  padding: 18px 22px 28px;
  overscroll-behavior: contain;
}
.sheet-foot {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 14px 22px 18px;
  box-shadow: inset 0 1px 0 var(--line);
}
.dialog {
  position: fixed;
  z-index: 50;
  left: 50%;
  top: 50%;
  width: min(520px, calc(100% - 32px));
  translate: -50% -50%;
  border-radius: var(--r-5);
  background: var(--surface);
  box-shadow: var(--shadow-pop);
  transition-property: opacity, scale;
  transition-duration: var(--t-med);
  transition-timing-function: var(--ease-out);
}
.dialog:not(.is-open) {
  opacity: 0;
  scale: 0.97;
  pointer-events: none;
  visibility: hidden;
}
.toast {
  position: fixed;
  z-index: 70;
  left: 50%;
  bottom: 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  max-width: calc(100% - 32px);
  min-height: 46px;
  padding: 6px 6px 6px 16px;
  border-radius: 999px;
  translate: -50% 0;
  color: var(--bg);
  background: var(--ink);
  box-shadow: var(--shadow-pop);
  font-size: var(--fs-14);
  transition-property: opacity, translate;
  transition-duration: var(--t-med);
  transition-timing-function: var(--ease-out);
}
.toast:not(.is-open) {
  opacity: 0;
  translate: -50% 8px;
  pointer-events: none;
}
.toast .btn {
  height: 34px;
  color: var(--bg);
  background: rgba(127, 127, 127, 0.22);
  box-shadow: none;
  border-radius: 999px;
}

/* ---------------------------------------------------------------- reduced motion */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  .shine {
    color: var(--ink-3);
    background: none;
  }
}

/* ---------------------------------------------------------------- dialogs: parts (theme.css "screen: review") */
.dialog {
  max-height: calc(100dvh - 32px);
  overflow-y: auto;
  overscroll-behavior: contain;
}
.dialog:focus,
.sheet:focus {
  outline: none;
}
.dialog-head {
  display: grid;
  gap: 6px;
  padding: 22px 22px 0;
}
.dialog-head h2 {
  font-family: var(--font-serif);
  font-size: var(--fs-20);
  font-weight: 450;
  line-height: 1.25;
  text-wrap: balance;
}
.dialog-body {
  display: grid;
  gap: 12px;
  padding: 16px 22px;
}
.dialog-foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  padding: 0 22px 20px;
}
.dialog-foot .btn.is-accent,
.dialog-foot .btn.is-danger {
  margin-left: auto;
}
.dialog.is-wide {
  width: min(680px, calc(100% - 32px));
}
.with-mic {
  position: relative;
}
.with-mic .icon-btn {
  position: absolute;
  right: 6px;
  bottom: 6px;
}

/* ---------------------------------------------------------------- sheets: parts (theme.css "screen: board") */
.sheet-title,
.card-sheet-title {
  font-family: var(--font-serif);
  font-size: var(--fs-24);
  font-weight: 450;
  line-height: 1.2;
  text-wrap: balance;
}
.sheet-sec {
  display: grid;
  gap: 8px;
  padding: 16px 0;
}
.sheet-sec + .sheet-sec {
  box-shadow: inset 0 1px 0 var(--line);
}
.sheet-sec h3 {
  font-size: var(--fs-13);
  font-weight: 650;
  color: var(--ink-3);
}
.sheet-head .grow {
  display: grid;
  gap: 10px;
  flex: 1;
  min-width: 0;
}

/* key and value rows (theme.css "screen: board" .kv) */
.kv {
  display: grid;
  grid-template-columns: 120px minmax(0, 1fr);
  gap: 10px 16px;
  font-size: var(--fs-14);
  margin: 0;
}
.kv dt {
  color: var(--ink-3);
}
.kv dd {
  margin: 0;
  min-width: 0;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  overflow-wrap: anywhere;
}

/* a strip of thumbnails (theme.css "screen: board" .thumbs, "screen: library asset" .thumb) */
.thumbs {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  scrollbar-width: none;
  padding: 2px;
  margin: -2px;
}
.thumbs::-webkit-scrollbar {
  display: none;
}
.thumbs .media {
  width: 132px;
  flex: none;
  border-radius: var(--r-3);
}
.thumb {
  position: relative;
  display: grid;
  gap: 6px;
  flex: none;
  width: 140px;
  font-size: var(--fs-12);
  color: var(--ink-3);
}
.thumb .media {
  width: 100%;
  border-radius: var(--r-3);
}
.thumb[aria-current='true'] .media {
  box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--accent);
}
.media > img,
.media > video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
}
.media.is-cover > img,
.media.is-cover > video {
  object-fit: cover;
}

/* ---------------------------------------------------------------- the app's own pieces */
/* toasts: a stack at the bottom centre; each is the theme's ink pill */
.toasts {
  position: fixed;
  z-index: 70;
  left: 50%;
  bottom: calc(20px + env(safe-area-inset-bottom, 0px));
  translate: -50% 0;
  display: grid;
  justify-items: center;
  gap: 8px;
  width: max-content;
  max-width: calc(100% - 32px);
  pointer-events: none;
}
.toasts .toast {
  position: relative;
  left: auto;
  bottom: auto;
  translate: none;
  max-width: 100%;
  pointer-events: auto;
}
.toasts .toast:not(.is-open) {
  translate: 0 8px;
}
.toast .toast-t {
  min-width: 0;
  text-wrap: pretty;
  line-height: 1.35;
  padding: 6px 0;
}
.toast:not(:has(.btn)) {
  padding-right: 18px;
}
.toast .dot {
  margin-right: -4px;
}

/* empty and failed states */
.empty-ico {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  margin-bottom: 4px;
  border-radius: 50%;
  color: var(--ink-3);
  background: var(--surface-2);
}
.empty[data-tone='bad'] .empty-ico {
  color: oklch(var(--tone-ink-l) var(--tone-ink-c) var(--hue-red));
  background: oklch(var(--tone-dot-l) var(--tone-dot-c) var(--hue-red) / var(--tone-fill-a));
}
.empty[data-tone='warn'] .empty-ico {
  color: oklch(var(--tone-ink-l) var(--tone-ink-c) var(--hue-amber));
  background: oklch(var(--tone-dot-l) var(--tone-dot-c) var(--hue-amber) / var(--tone-fill-a));
}
.empty-t {
  font-size: var(--fs-15);
  font-weight: 600;
  color: var(--ink);
  text-wrap: balance;
}
.empty-b {
  max-width: 34rem;
  font-size: var(--fs-13);
  text-wrap: pretty;
}
.empty-code {
  max-width: 100%;
  padding: 6px 10px;
  border-radius: var(--r-2);
  background: var(--surface-2);
  font: 12.5px/1.5 var(--font-mono);
  color: var(--ink-2);
  overflow-x: auto;
  white-space: pre;
}
.empty .btn {
  margin-top: 8px;
}
.loading {
  color: var(--ink-3);
  font-size: var(--fs-13);
}
.section-acts {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
}
.lbl {
  min-width: 0;
}
.menu.is-fixed {
  position: fixed;
  top: 0;
  left: 0;
  max-height: min(70dvh, 520px);
  overflow-y: auto;
}
.menu-item:disabled {
  opacity: 0.5;
  pointer-events: none;
}
.menu-item.is-danger {
  color: oklch(var(--tone-ink-l) var(--tone-ink-c) var(--hue-red));
}
.menu-l {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.menu-item kbd {
  margin-left: auto;
}

/* the full-screen card: signing in, signed out, can't reach the factory */
.fatal {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: grid;
  place-items: center;
  padding: 24px 16px;
  background: var(--bg);
  overflow-y: auto;
}
.fatal-card {
  display: grid;
  justify-items: center;
  gap: 12px;
  width: min(460px, 100%);
  padding: 36px 28px 30px;
  text-align: center;
  border-radius: var(--r-5);
  background: var(--surface);
  box-shadow: var(--shadow-1);
}
.fatal-card .wordmark {
  margin-bottom: 10px;
}
.fatal-card h1 {
  font-family: var(--font-serif);
  font-size: var(--fs-24);
  font-weight: 450;
  line-height: 1.2;
  text-wrap: balance;
}
.fatal-card p {
  color: var(--ink-3);
  text-wrap: pretty;
}
.fatal-card .fatal-detail {
  font-size: var(--fs-13);
  color: var(--ink-4);
}
.fatal-card .btn {
  margin-top: 8px;
}

/* the command palette: a dialog near the top with a search and menu rows */
.dialog.palette {
  top: max(12dvh, 24px);
  translate: -50% 0;
  width: min(600px, calc(100% - 24px));
  max-height: min(70dvh, 560px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.palette-search {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 16px;
  min-height: 54px;
  box-shadow: inset 0 -1px 0 var(--line);
  color: var(--ink-3);
}
.palette-search input {
  flex: 1;
  min-width: 0;
  height: 52px;
  border: 0;
  background: none;
  font-size: 16px;
  color: var(--ink);
}
.palette-search input:focus {
  outline: none;
}
.palette-list {
  flex: 1;
  overflow-y: auto;
  padding: 6px;
  overscroll-behavior: contain;
}
.palette-group {
  padding: 10px 10px 4px;
  font-size: var(--fs-12);
  font-weight: 600;
  color: var(--ink-4);
}
.palette-list .menu-item[aria-selected='true'] {
  background: var(--surface-3);
  color: var(--ink);
}
.palette-list .menu-item .hint {
  margin-left: 6px;
  font-size: var(--fs-12);
  color: var(--ink-4);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 0 1 auto;
  min-width: 0;
}
.palette-list .menu-item mark {
  background: none;
  color: var(--ink);
  font-weight: 650;
}
.palette-empty {
  padding: 24px 16px;
  text-align: center;
  color: var(--ink-3);
}
.palette-foot {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
  padding: 10px 16px;
  box-shadow: inset 0 1px 0 var(--line);
  font-size: var(--fs-12);
  color: var(--ink-4);
}
.palette-foot kbd {
  margin-right: 4px;
}

/* the keyboard shortcuts dialog */
.keys-list {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 10px 18px;
  margin: 0;
  font-size: var(--fs-14);
}
.keys-list dt {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
}
.keys-list dd {
  margin: 0;
  color: var(--ink-2);
}

/* a field's own error line, and links in running text */
.field-err {
  font-size: var(--fs-13);
  color: oklch(var(--tone-ink-l) var(--tone-ink-c) var(--hue-red));
}
.link {
  color: var(--accent);
  font-weight: 560;
}
.link:hover {
  text-decoration: underline;
  text-underline-offset: 3px;
}
.noscript {
  padding: 24px;
}

/* ---------------------------------------------------------------- phones: sheets become bottom sheets */
@media (max-width: 720px) {
  .sheet {
    top: auto;
    width: 100%;
    max-height: 88dvh;
    border-radius: var(--r-5) var(--r-5) 0 0;
  }
  .sheet:not(.is-open) {
    translate: 0 24px;
  }
  .sheet-head {
    padding-left: 18px;
  }
  .sheet-body,
  .sheet-foot {
    padding-left: 18px;
    padding-right: 18px;
  }
  .sheet-foot {
    padding-bottom: calc(18px + env(safe-area-inset-bottom, 0px));
  }
  .kv {
    grid-template-columns: minmax(0, 1fr);
    gap: 2px;
  }
  .kv dd {
    margin-bottom: 10px;
  }
  .keys-list {
    grid-template-columns: minmax(0, 1fr);
    gap: 2px;
  }
  .keys-list dd {
    margin-bottom: 8px;
  }
}
.palette-list {
  list-style: none;
  margin: 0;
}

/* ---------------------------------------------------------------- the media lightbox
   (library/ui.js openLightbox, studios/inspector.js): the picture or clip at its own aspect ratio
   on the stage colour, a caption bar under it. Never stretched. */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  padding: 24px;
  background: color-mix(in srgb, var(--stage) 92%, transparent);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  opacity: 0;
  transition: opacity var(--t-med) var(--ease-out);
}
.lightbox.is-open {
  opacity: 1;
}
.lightbox[hidden] {
  display: none;
}
.lightbox-card {
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  gap: 12px;
  width: min(1200px, 100%);
  max-height: 100%;
  min-height: 0;
}
.lightbox-media {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 0;
  max-height: calc(100dvh - 140px);
  border-radius: var(--r-4);
  overflow: hidden;
}
.lightbox-media img,
.lightbox-media video {
  max-width: 100%;
  max-height: calc(100dvh - 140px);
  width: auto;
  height: auto;
  object-fit: contain;
  border-radius: var(--r-4);
}
.lightbox-missing {
  padding: 48px 24px;
  color: #cfccc3;
  text-align: center;
}
.lightbox-cap {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 14px;
  color: #f4f2ec;
}
.lightbox-name {
  font-weight: 600;
}
.lightbox-meta {
  font-size: var(--fs-13);
  color: #b9b5aa;
}
.lightbox-actions {
  display: flex;
  gap: 8px;
  margin-left: auto;
}
.lightbox .btn {
  color: #f4f2ec;
  background: rgba(255, 255, 255, 0.1);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.16);
}
.lightbox .btn:hover {
  background: rgba(255, 255, 255, 0.16);
}
@media (max-width: 720px) {
  .lightbox {
    padding: 12px;
  }
  .lightbox-actions {
    margin-left: 0;
  }
}
