/* Spark Config Calculator. Plain CSS, no build step. One screen: inputs, picture, details. */

:root {
  --font: 'Google Sans Flex', 'Google Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --mono: 'Google Sans Code', ui-monospace, 'SF Mono', Menlo, Consolas, monospace;

  --bg: #f0f4f9;
  --surface: #ffffff;
  --surface-2: #f3f6fb;
  --surface-3: #e5ebf3;
  --text: #1f1f1f;
  --muted: #444746;
  --faint: #747775;
  --line: #dde3ea;
  --primary: #0b57d0;
  --on-primary: #ffffff;
  --primary-soft: #d3e3fd;
  --on-primary-soft: #041e49;
  --inverse: #303030;
  --on-inverse: #f2f2f2;
  --inverse-primary: #a8c7fa;
  --error: #b3261e;
  --error-soft: #f9dedc;
  --warn: #a15c00;
  --warn-soft: #ffe7c2;
  --shadow: 0 1px 2px rgb(0 0 0 / 0.08), 0 4px 16px rgb(0 0 0 / 0.1);
  --hatch: #cfd6de;
  --ok: #188038;

  --ease: cubic-bezier(0.2, 0, 0, 1);
  --resize: 0.5s var(--ease);
}

:root[data-theme='dark'] {
  --bg: #131314;
  --surface: #1e1f20;
  --surface-2: #26282a;
  --surface-3: #333537;
  --text: #e3e3e3;
  --muted: #c4c7c5;
  --faint: #8e918f;
  --line: #3c4043;
  --primary: #a8c7fa;
  --on-primary: #062e6f;
  --primary-soft: #0842a0;
  --on-primary-soft: #d3e3fd;
  --inverse: #e3e3e3;
  --on-inverse: #303030;
  --inverse-primary: #0b57d0;
  --error: #f2b8b5;
  --error-soft: #601410;
  --warn: #ffb95c;
  --warn-soft: #4a2800;
  --shadow: 0 1px 3px rgb(0 0 0 / 0.5), 0 8px 24px rgb(0 0 0 / 0.5);
  --hatch: #474a4d;
  --ok: #81c995;
}

/* Colour families shared by the picture, legends and the side panel. */
.tone-executor,
.tone-execution,
.tone-heap {
  --tone: #1a73e8;
  --tone-soft: #d3e3fd;
  --tone-on: #041e49;
}
.tone-storage {
  --tone: #1e8e3e;
  --tone-soft: #c4eed0;
  --tone-on: #072711;
}
.tone-user {
  --tone: #e37400;
  --tone-soft: #ffe08a;
  --tone-on: #3b2a00;
}
.tone-reserved,
.tone-system {
  --tone: #80868b;
  --tone-soft: #e1e3e1;
  --tone-on: #303030;
}
.tone-overhead {
  --tone: #9334e6;
  --tone-soft: #e9ddff;
  --tone-on: #21005d;
}
.tone-offheap {
  --tone: #129eaf;
  --tone-soft: #b8eaf5;
  --tone-on: #001f29;
}
.tone-python {
  --tone: #e8710a;
  --tone-soft: #ffdcc3;
  --tone-on: #2e1500;
}
.tone-driver {
  --tone: #c2185b;
  --tone-soft: #ffd8e4;
  --tone-on: #31111d;
}
.tone-tasks {
  --tone: #1a73e8;
  --tone-soft: #d3e3fd;
  --tone-on: #041e49;
}
.tone-idle {
  --tone: #9aa0a6;
  --tone-soft: transparent;
  --tone-on: var(--muted);
}
:root[data-theme='dark'] :is(.tone-executor, .tone-execution, .tone-heap, .tone-tasks) {
  --tone: #7cacf8;
  --tone-soft: #0842a0;
  --tone-on: #d3e3fd;
}
:root[data-theme='dark'] .tone-storage {
  --tone: #6dd58c;
  --tone-soft: #0f5223;
  --tone-on: #c4eed0;
}
:root[data-theme='dark'] .tone-user {
  --tone: #fdd663;
  --tone-soft: #5c4300;
  --tone-on: #ffe08a;
}
:root[data-theme='dark'] :is(.tone-reserved, .tone-system) {
  --tone: #9aa0a6;
  --tone-soft: #3c4043;
  --tone-on: #e3e3e3;
}
:root[data-theme='dark'] .tone-overhead {
  --tone: #c58af9;
  --tone-soft: #4f378b;
  --tone-on: #e9ddff;
}
:root[data-theme='dark'] .tone-offheap {
  --tone: #78d9ec;
  --tone-soft: #004f58;
  --tone-on: #b8eaf5;
}
:root[data-theme='dark'] .tone-python {
  --tone: #fcad70;
  --tone-soft: #6b3a00;
  --tone-on: #ffdcc3;
}
:root[data-theme='dark'] .tone-driver {
  --tone: #ffb1c8;
  --tone-soft: #633b48;
  --tone-on: #ffd8e4;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  height: 100%;
  color-scheme: light;
  -webkit-text-size-adjust: 100%;
}
html[data-theme='dark'] {
  color-scheme: dark;
}

body {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  height: 100dvh;
  margin: 0;
  overflow: hidden;
  background: var(--bg);
  color: var(--text);
  font: 400 14px/1.45 var(--font);
  font-variant-numeric: tabular-nums;
  -webkit-font-smoothing: antialiased;
}

h1,
h2,
h3,
p,
ul,
ol {
  margin: 0;
}
ul,
ol {
  padding: 0;
  list-style: none;
}
a {
  color: var(--primary);
  text-decoration: none;
}
a:hover {
  text-decoration: underline;
}
button,
input {
  font: inherit;
  color: inherit;
}
button {
  cursor: pointer;
  border: 0;
  background: none;
  padding: 0;
}
button:disabled {
  cursor: default;
  opacity: 0.38;
}
code,
pre {
  font-family: var(--mono);
}
[hidden] {
  display: none !important;
}
:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

.visually-hidden {
  position: fixed;
  left: -9999px;
  opacity: 0;
}
.skip-link {
  position: absolute;
  left: 16px;
  top: -48px;
  z-index: 10;
  padding: 8px 16px;
  border-radius: 20px;
  background: var(--primary);
  color: var(--on-primary);
}
.skip-link:focus {
  top: 8px;
}

.icon {
  width: 20px;
  height: 20px;
  fill: currentColor;
  flex: none;
}

/* ---------- top bar ---------- */

.bar {
  display: flex;
  align-items: center;
  gap: 20px;
  height: 56px;
  padding: 0 16px 0 20px;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
  font-size: 17px;
  font-weight: 500;
  white-space: nowrap;
  flex: none;
}
.brand:hover {
  text-decoration: none;
}
.brand-mark {
  width: 22px;
  height: 22px;
  fill: var(--primary);
}
.bar-tools {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}
.bar-group {
  display: flex;
  align-items: center;
  gap: 2px;
}
.bar-group + .bar-group {
  padding-left: 12px;
  border-left: 1px solid var(--line);
}
.bar-end {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-left: auto;
}

/* ---------- buttons ---------- */

.icon-button {
  display: inline-grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  color: var(--muted);
  flex: none;
  transition: background-color 0.15s var(--ease);
}
.icon-button:not(:disabled):hover {
  background: var(--surface-3);
  color: var(--text);
}
.text-button,
.tonal-button,
.filled-button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 36px;
  padding: 0 12px;
  border-radius: 18px;
  font-size: 13.5px;
  font-weight: 500;
  white-space: nowrap;
  flex: none;
  transition:
    background-color 0.15s var(--ease),
    box-shadow 0.15s var(--ease);
}
.text-button {
  color: var(--primary);
}
.text-button:not(:disabled):hover {
  background: color-mix(in srgb, var(--primary) 10%, transparent);
}
.tonal-button {
  background: var(--primary-soft);
  color: var(--on-primary-soft);
}
.tonal-button:not(:disabled):hover {
  box-shadow: 0 1px 3px rgb(0 0 0 / 0.25);
}
.filled-button {
  background: var(--primary);
  color: var(--on-primary);
  padding: 0 16px;
}
.filled-button:not(:disabled):hover {
  box-shadow: 0 1px 3px rgb(0 0 0 / 0.3);
}
:is(.text-button, .tonal-button, .filled-button) .icon {
  width: 18px;
  height: 18px;
}

/* ---------- layout ---------- */

.work {
  position: relative;
  display: grid;
  grid-template-columns: 336px minmax(0, 1fr) 348px;
  gap: 12px;
  min-height: 0;
  padding: 0 12px;
}
.panel {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  border-radius: 20px;
  background: var(--surface);
  overflow: hidden;
}
.panel-head {
  flex: none;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
}
.panel-body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
}
.failure {
  position: absolute;
  inset: 12px 12px auto;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 12px 20px;
  border-radius: 14px;
  background: var(--error-soft);
  color: var(--text);
}
.foot {
  position: sticky;
  bottom: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px 20px;
  flex-wrap: wrap;
  padding: 6px 20px;
  background: var(--surface);
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 12px;
  line-height: 1.3;
}
.foot-credit {
  color: var(--text);
  font-weight: 500;
}
.foot-sep {
  margin: 0 6px;
  color: var(--faint);
}
.foot-note {
  color: var(--faint);
}
.foot a {
  color: var(--primary);
  text-decoration: none;
}
.foot a:hover {
  text-decoration: underline;
}
.panes {
  display: none;
}
.section-label {
  font-size: 12px;
  font-weight: 500;
  color: var(--muted);
}
.empty {
  color: var(--muted);
}

/* ---------- inputs ---------- */

.inputs {
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  outline: none;
}
.group {
  padding: 8px 16px 6px;
}
.group + .group {
  border-top: 1px solid var(--line);
}
.group-head {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 28px;
}
.group-head h2 {
  font-size: 13px;
  font-weight: 500;
  color: var(--primary);
}
.group-note {
  color: var(--faint);
  font-size: 12px;
}
.more-toggle {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 28px;
  margin-left: auto;
  padding: 0 4px 0 8px;
  border-radius: 14px;
  color: var(--muted);
  font-size: 12px;
}
.more-toggle:hover {
  background: var(--surface-3);
}
.more-toggle .icon {
  width: 16px;
  height: 16px;
  transition: transform 0.25s var(--ease);
}
.more-toggle[aria-expanded='true'] .icon {
  transform: rotate(180deg);
}
.more-count {
  color: var(--primary);
  font-weight: 500;
}
.row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  column-gap: 8px;
  min-height: 35px;
}
.row-head {
  display: flex;
  align-items: center;
  min-width: 0;
}
.row-label {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.25;
}
.info-button {
  width: 24px;
  height: 24px;
  color: var(--faint);
  opacity: 0;
  transition: opacity 0.15s var(--ease);
}
.info-button .icon {
  width: 15px;
  height: 15px;
}
.row:hover .info-button,
.info-button:focus-visible,
.info-button[aria-expanded='true'] {
  opacity: 1;
}
@media (hover: none) {
  .info-button {
    opacity: 1;
  }
}
.row-hint {
  grid-column: 1 / -1;
  padding-bottom: 6px;
  font-size: 12px;
  color: var(--error);
  text-align: right;
}

.control {
  display: flex;
  align-items: center;
  width: 128px;
  height: 32px;
  border-radius: 10px;
  background: var(--surface-2);
  box-shadow: inset 0 0 0 1px var(--line);
  transition:
    box-shadow 0.15s var(--ease),
    background-color 0.15s var(--ease);
}
.control:hover {
  background: var(--surface-3);
}
.control:focus-within {
  background: var(--surface);
  box-shadow: inset 0 0 0 2px var(--primary);
}
.control:has([aria-invalid='true']) {
  box-shadow: inset 0 0 0 2px var(--error);
}
.control input {
  flex: 1;
  min-width: 0;
  height: 100%;
  padding: 0 4px 0 10px;
  border: 0;
  background: none;
  outline: none;
  font-size: 14px;
}
.control input::placeholder {
  color: var(--muted);
  opacity: 1;
}
.unit,
.auto-tag {
  padding-right: 8px;
  color: var(--faint);
  font-size: 12px;
  white-space: nowrap;
}
.auto-tag {
  color: var(--primary);
}
.auto-reset,
.step-button {
  width: 28px;
  height: 28px;
  margin: 0 2px;
}
:is(.auto-reset, .step-button) .icon {
  width: 16px;
  height: 16px;
}
.has-stepper input {
  text-align: center;
  padding: 0;
}

.segmented {
  position: relative;
  display: inline-flex;
  height: 32px;
  padding: 3px;
  border-radius: 10px;
  background: var(--surface-3);
}
.segment-thumb {
  position: absolute;
  top: 3px;
  bottom: 3px;
  left: 0;
  width: 0;
  border-radius: 7px;
  background: var(--surface);
  box-shadow: 0 1px 2px rgb(0 0 0 / 0.18);
  opacity: 0;
}
.is-placed > .segment-thumb {
  transition:
    transform 0.28s var(--ease),
    width 0.28s var(--ease);
}
.segment {
  position: relative;
  padding: 0 10px;
  border-radius: 7px;
  color: var(--muted);
  font-size: 12.5px;
  white-space: nowrap;
  transition: color 0.15s var(--ease);
}
.segment[aria-checked='true'] {
  color: var(--primary);
  font-weight: 500;
}
:root[data-theme='dark'] .segment-thumb {
  background: #4a4d50;
}
.segmented.is-small {
  height: 26px;
  padding: 2px;
}
.segmented.is-small .segment-thumb {
  top: 2px;
  bottom: 2px;
}
.segmented.is-small .segment {
  padding: 0 9px;
  font-size: 12px;
}
.row.is-wide {
  grid-template-columns: minmax(0, 1fr);
  padding-bottom: 5px;
}
.row.is-wide .segmented {
  display: flex;
}
.row.is-wide .segment {
  flex: 1;
}
.segmented.is-tabs {
  display: flex;
  height: 36px;
}
.segmented.is-tabs .segment {
  flex: 1;
  font-size: 13.5px;
}
.segmented.is-tabs.has-warning [data-value='checks'] {
  color: var(--warn);
}

.presets {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 4px;
  padding: 3px 0 5px;
}
.preset {
  display: grid;
  justify-items: center;
  padding: 3px 0;
  border-radius: 8px;
  box-shadow: inset 0 0 0 1px var(--line);
  line-height: 1.2;
  transition:
    background-color 0.15s var(--ease),
    box-shadow 0.15s var(--ease);
}
.preset:hover {
  background: var(--surface-3);
}
.preset-cores {
  font-size: 13.5px;
  font-weight: 500;
}
.preset-mem {
  font-size: 11px;
  color: var(--muted);
}
.preset[aria-pressed='true'] {
  background: var(--primary-soft);
  box-shadow: none;
  color: var(--on-primary-soft);
}
.preset[aria-pressed='true'] .preset-mem {
  color: inherit;
}

.switch {
  position: relative;
  width: 40px;
  height: 24px;
  border-radius: 12px;
  background: var(--surface-3);
  box-shadow: inset 0 0 0 2px var(--faint);
  flex: none;
  transition:
    background-color 0.2s var(--ease),
    box-shadow 0.2s var(--ease);
}
.switch-thumb {
  position: absolute;
  top: 6px;
  left: 6px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--faint);
  transition:
    transform 0.25s var(--ease),
    background-color 0.2s var(--ease);
}
.switch[aria-checked='true'] {
  background: var(--primary);
  box-shadow: none;
}
.switch[aria-checked='true'] .switch-thumb {
  background: var(--on-primary);
  transform: translateX(16px) scale(1.35);
}

.collapsible {
  display: grid;
  grid-template-rows: 0fr;
  transition: grid-template-rows 0.3s var(--ease);
}
.collapsible.is-open {
  grid-template-rows: 1fr;
}
.collapsible-inner {
  overflow: hidden;
  min-height: 0;
  opacity: 0;
  transition: opacity 0.2s var(--ease);
}
.collapsible.is-open > .collapsible-inner {
  opacity: 1;
}

/* ---------- the picture ---------- */

.stage {
  gap: 10px;
  padding: 14px 16px 16px;
}
.headline {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  flex: none;
  padding: 0 4px;
}
.stats {
  display: flex;
  align-items: flex-start;
  gap: clamp(6px, 0.9vw, 14px);
}
.stat {
  display: grid;
}
.stat-value {
  display: flex;
  align-items: baseline;
  gap: 4px;
  line-height: 1;
}
.stat-number {
  font-size: clamp(1.9rem, 2.8vw, 2.75rem);
  letter-spacing: -0.02em;
}
.stat-unit {
  font-size: 16px;
  color: var(--muted);
}
.stat-times {
  padding-top: 8px;
  font-size: 22px;
  color: var(--faint);
}
.stat-label {
  margin-top: 2px;
  color: var(--muted);
  font-size: 13px;
  white-space: nowrap;
}
.stat-delta {
  min-height: 16px;
  font-size: 12px;
  color: var(--primary);
}
.meters {
  display: grid;
  gap: 8px;
  flex: 1 1 0;
  min-width: 0;
  max-width: 280px;
  padding-bottom: 6px;
  container-type: inline-size;
}
.meter-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
}
.meter-value {
  color: var(--text);
  white-space: nowrap;
}
@container (max-width: 215px) {
  .meter-detail {
    display: none;
  }
}
.meter-head > :first-child {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}
.meter-track {
  height: 5px;
  margin-top: 3px;
  border-radius: 3px;
  background: var(--surface-3);
  overflow: hidden;
}
.meter-fill {
  height: 100%;
  border-radius: 3px;
  background: var(--primary);
  transform-origin: left;
  transform: scaleX(0);
  transition: transform var(--resize);
}

.tiers {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
}
.tier {
  display: flex;
  flex-direction: column;
  flex: none;
  min-height: 0;
  padding: 8px 12px 12px;
  border-radius: 16px;
  background: var(--surface-2);
}
.tier-executor {
  flex: 1 1 0;
  min-height: 210px;
}
.tier-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 6px;
}
.tier-head h2 {
  font-size: 13.5px;
  font-weight: 500;
}
.tier-meta {
  color: var(--muted);
  font-size: 12.5px;
  text-align: right;
}
.tier-note {
  margin-top: 6px;
  color: var(--faint);
  font-size: 12px;
}

/* Every clickable region of the picture. */
.part {
  position: relative;
  cursor: pointer;
  outline: 2px solid transparent;
  outline-offset: 1px;
  transition:
    outline-color 0.15s var(--ease),
    flex-grow var(--resize),
    opacity 0.3s var(--ease);
}
.part:hover:not(:has(.part:hover)):not(:has(.node-tile:hover)),
.part:focus-visible {
  outline-color: color-mix(in srgb, var(--primary) 55%, transparent);
}
.part.is-lit {
  outline-color: var(--primary);
  animation: lit 0.9s var(--ease);
}
.part.is-selected {
  outline-color: var(--primary);
}
/* Of several identical executors on a node, only the one the close-up shows is outlined. */
.block.is-selected ~ .block.is-selected {
  outline-color: transparent;
}
.part[data-flag]::after,
.tier[data-flag] > .tier-head h2::after {
  content: '!';
  position: absolute;
  top: -7px;
  right: -7px;
  z-index: 2;
  display: grid;
  place-items: center;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--primary);
  color: var(--on-primary);
  font-size: 12px;
  font-weight: 500;
  line-height: 1;
}
.part[data-flag='warn']::after,
.tier[data-flag='warn'] > .tier-head h2::after {
  background: var(--warn);
}
.part[data-flag='error']::after,
.tier[data-flag='error'] > .tier-head h2::after {
  background: var(--error);
}
/* Blocks clip their content, so their marker sits inside the corner. */
.block[data-flag]::after {
  top: 3px;
  right: 3px;
}
/* A whole tier carries its marker next to its title. */
.part.is-empty[data-flag]::after,
.tier[data-flag]::after {
  display: none;
}
.tier[data-flag] > .tier-head h2::after {
  position: static;
  display: inline-grid;
  margin-left: 8px;
  vertical-align: 1px;
}

/* Does the workload fit? */
.tier-fit {
  margin-bottom: 10px;
}
.gauges {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
}
.gauge {
  display: grid;
  align-content: start;
  gap: 4px;
  min-width: 0;
  padding: 7px 10px 8px;
  border-radius: 10px;
  background: var(--surface);
}
.gauge-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  font-size: 12.5px;
  white-space: nowrap;
}
.gauge-title {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  font-weight: 500;
}
.gauge-verdict {
  font-size: 12px;
  font-weight: 500;
}
.gauge.is-fits .gauge-verdict {
  color: var(--ok);
}
.gauge.is-tight .gauge-verdict {
  color: var(--warn);
}
.gauge.is-over .gauge-verdict {
  color: var(--error);
}
.gauge-track {
  position: relative;
  height: 12px;
  border-radius: 6px;
  background: repeating-linear-gradient(135deg, var(--hatch) 0 3px, transparent 3px 7px);
  overflow: hidden;
}
.gauge.is-idle .gauge-track {
  display: none;
}
.gauge-most,
.gauge-sure,
.gauge-need {
  position: absolute;
  inset: 0;
  transform-origin: left;
  transition: transform var(--resize);
}
.gauge-most {
  background: var(--primary-soft);
}
.gauge-sure {
  background: color-mix(in srgb, var(--primary) 45%, var(--primary-soft));
}
.gauge-need {
  top: 4px;
  bottom: 4px;
  background: var(--text);
}
.gauge.is-tight .gauge-need {
  background: var(--warn);
}
.gauge.is-over .gauge-need {
  background: var(--error);
}
.gauge-caption {
  color: var(--muted);
  font-size: 11.5px;
  line-height: 1.3;
}
.rounds-line {
  display: flex;
  align-items: baseline;
  gap: 6px;
  min-width: 0;
}
.rounds-value {
  font-size: 19px;
  line-height: 1;
}
.rounds-unit {
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}
.rounds-time {
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
}
.fit-prompt {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  color: var(--muted);
  font-size: 13px;
}
/* The verdict is already written on a gauge, and a headline number needs no outline of its own. */
.gauge[data-flag]::after,
.stat:not([data-part='cluster'])[data-flag]::after {
  display: none;
}
.stat.is-selected:not(:hover) {
  outline-color: transparent;
}
.stat {
  border-radius: 8px;
  outline-offset: 4px;
}
.tier-title {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

/* The wedge that says "this box is a close-up of that one". */
.beam {
  --from: 0%;
  --to: 20%;
  flex: none;
  height: 16px;
  margin: 0 12px;
  background: linear-gradient(to bottom, color-mix(in srgb, var(--primary) 30%, transparent), color-mix(in srgb, var(--primary) 8%, transparent));
  clip-path: polygon(var(--from) 0, var(--to) 0, 100% 100%, 0 100%);
  transition: clip-path var(--resize);
}

/* Node: memory left to right, cores as chips. */
.node-box {
  display: flex;
  gap: 3px;
  height: 72px;
}
.block {
  display: flex;
  flex: 0 1 0;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  min-width: 0;
  padding: 4px 2px;
  border-radius: 10px;
  overflow: hidden;
  container-type: inline-size;
  font-size: 12px;
  white-space: nowrap;
}
.block.is-empty {
  margin-left: -3px;
  padding: 0;
  opacity: 0;
  pointer-events: none;
}
.block-executor {
  background: #d3e3fd;
  color: #041e49;
}
.block-driver {
  background: #ffd8e4;
  color: #31111d;
}
.block-system {
  background: var(--surface-3);
  color: var(--muted);
}
.block-free {
  box-shadow: inset 0 0 0 1.5px var(--hatch);
  color: var(--faint);
}
.block-idle {
  background: repeating-linear-gradient(135deg, var(--hatch) 0 4px, transparent 4px 9px);
  color: var(--muted);
}
:root[data-theme='dark'] .block-executor {
  background: #0842a0;
  color: #d3e3fd;
}
:root[data-theme='dark'] .block-driver {
  background: #633b48;
  color: #ffd8e4;
}
.block-name {
  font-weight: 500;
}
.core-chips {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 3px;
  max-width: 100%;
}
.core-chip {
  width: 9px;
  height: 9px;
  border-radius: 2.5px;
  background: currentColor;
  opacity: 0.8;
}
.core-chip.is-idle {
  background: none;
  box-shadow: inset 0 0 0 1.5px currentColor;
}
@container (max-width: 52px) {
  .block-name,
  .block-value {
    display: none;
  }
}
@container (max-width: 20px) {
  .core-chips {
    display: none;
  }
}

/* Executor: boxes inside boxes, each as wide as its share. */
.executor-box {
  display: flex;
  flex: 1;
  gap: 4px;
  min-height: 0;
}
.box {
  display: flex;
  flex: 0 1 0;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
  padding: 6px;
  border-radius: 14px;
  box-shadow: inset 0 0 0 1.5px color-mix(in srgb, var(--primary) 45%, transparent);
  background: var(--surface);
}
.box-unified {
  border-radius: 11px;
  padding: 5px;
  background: color-mix(in srgb, var(--primary) 6%, var(--surface));
  box-shadow: inset 0 0 0 1.5px color-mix(in srgb, var(--primary) 30%, transparent);
}
.box-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  padding: 0 4px;
  font-size: 12px;
  white-space: nowrap;
  overflow: hidden;
}
.box-name {
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
}
.box-value {
  color: var(--muted);
}
.box-row {
  display: flex;
  flex: 1;
  gap: 4px;
  min-height: 0;
}
.cell {
  display: flex;
  flex: 0 1 0;
  flex-direction: column;
  gap: 2px;
  min-width: 8px;
  padding: 8px;
  border-radius: 9px;
  background: var(--tone-soft);
  color: var(--tone-on);
  container-type: inline-size;
  white-space: nowrap;
}
.executor-box > .cell {
  border-radius: 14px;
}
.cell.tone-idle {
  background: repeating-linear-gradient(135deg, var(--hatch) 0 4px, transparent 4px 9px);
}
.cell.is-empty {
  min-width: 0;
  margin-left: -4px;
  padding: 0;
  opacity: 0;
  pointer-events: none;
}
.cell-name {
  font-size: 12.5px;
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
}
.cell-value {
  font-size: 13px;
  opacity: 0.85;
}
.cell-note {
  margin-top: 4px;
  font-size: 11.5px;
  line-height: 1.3;
  white-space: normal;
  opacity: 0.75;
}
@container (max-width: 118px) {
  .cell-note {
    display: none;
  }
}
@container (max-width: 84px) {
  .cell-name,
  .cell-value {
    writing-mode: vertical-rl;
    text-overflow: clip;
  }
  .cell-value {
    display: none;
  }
}
@container (max-width: 26px) {
  .cell-name {
    display: none;
  }
}
.shared {
  position: relative;
  z-index: 1;
  align-self: center;
  flex: none;
  width: 0;
}
.shared .icon {
  position: absolute;
  top: -12px;
  left: -14px;
  width: 24px;
  height: 24px;
  padding: 3px;
  border-radius: 50%;
  background: var(--surface);
  color: var(--primary);
  box-shadow: 0 1px 3px rgb(0 0 0 / 0.25);
  animation: sway 3.2s ease-in-out infinite;
}

.tasks {
  display: grid;
  gap: 4px;
  margin-top: auto;
  padding: 6px;
  border-radius: 7px;
  background: color-mix(in srgb, var(--surface) 55%, transparent);
  min-width: 0;
}
.task-chips {
  --fill: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}
.task-chip {
  position: relative;
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border-radius: 6px;
  box-shadow: inset 0 0 0 1.5px currentColor;
  overflow: hidden;
  font-size: 11px;
}
.task-chip.is-count {
  width: auto;
  padding: 0 6px;
}
.task-fill {
  position: absolute;
  inset: 0;
  background: currentColor;
  opacity: 0.45;
  transform-origin: bottom;
  transform: scaleY(var(--fill));
  transition: transform var(--resize);
}
.tasks:not(.has-data) .task-fill {
  transform: scaleY(0.18);
  animation: work 2.4s ease-in-out infinite alternate;
}
.task-chip:nth-child(2n) .task-fill {
  animation-delay: -0.8s;
}
.task-chip:nth-child(3n) .task-fill {
  animation-delay: -1.6s;
}
.tasks.is-over {
  color: var(--error);
  background: var(--error-soft);
}
.task-note {
  font-size: 11.5px;
  line-height: 1.3;
  white-space: normal;
}
@container (max-width: 118px) {
  .task-note {
    display: none;
  }
}
@container (max-width: 84px) {
  .tasks {
    display: none;
  }
}

.blocked {
  display: grid;
  place-content: center;
  flex: 1;
  gap: 4px;
  text-align: center;
}
.blocked h2 {
  font-size: 22px;
  font-weight: 400;
}
.blocked p {
  color: var(--muted);
}

/* ---------- side panel ---------- */

.inspector-body {
  padding: 16px;
}
.explain-head {
  display: flex;
  align-items: center;
  gap: 10px;
}
.swatch {
  width: 12px;
  height: 12px;
  border-radius: 4px;
  background: var(--tone, var(--faint));
  flex: none;
}
.explain-title {
  font-size: 16px;
  font-weight: 500;
}
.explain-value {
  margin-top: 2px;
  font-size: 26px;
  letter-spacing: -0.01em;
  border-radius: 6px;
  width: fit-content;
}
.explain-text {
  margin-top: 8px;
  color: var(--muted);
}
.explain-hint {
  margin-top: 16px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
  color: var(--faint);
  font-size: 12.5px;
}
.inspector-view > .section-label {
  margin: 16px 0 6px;
}
.explain-settings {
  display: grid;
  gap: 4px;
}
.chip-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  padding: 7px 10px;
  border-radius: 9px;
  background: var(--surface-2);
  font-size: 12px;
  text-align: left;
  transition: background-color 0.15s var(--ease);
}
.chip-row:hover {
  background: var(--surface-3);
}
.chip-key {
  color: var(--muted);
  overflow-wrap: anywhere;
}
.chip-value {
  font-weight: 500;
  white-space: nowrap;
}

.sources {
  display: grid;
  gap: 8px;
}
.source {
  display: grid;
  gap: 4px;
  padding: 10px 12px;
  border-radius: 10px;
  background: var(--surface-2);
  font-size: 12.5px;
}
.source-quote {
  color: var(--text);
  quotes: '“' '”';
}
.source-quote.is-code {
  font-family: var(--mono);
  font-size: 11.5px;
  quotes: none;
  overflow-wrap: anywhere;
}
.source-origin {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--muted);
  font-size: 11.5px;
}
a.source-origin {
  color: var(--primary);
}
.source-origin .icon {
  width: 13px;
  height: 13px;
}
.source-none .source-quote {
  quotes: none;
}
.source-none .source-origin {
  color: var(--warn);
  font-weight: 500;
}

.why summary {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 28px;
  color: var(--primary);
  font-size: 12.5px;
  font-weight: 500;
  cursor: pointer;
  list-style: none;
  border-radius: 8px;
}
.why summary::-webkit-details-marker {
  display: none;
}
.why summary .icon {
  width: 16px;
  height: 16px;
  transition: transform 0.2s var(--ease);
}
.why[open] summary .icon {
  transform: rotate(180deg);
}

.check {
  display: grid;
  grid-template-columns: 20px minmax(0, 1fr);
  gap: 10px;
  padding: 12px 0;
  border-top: 1px solid var(--line);
}
.check:first-child {
  border-top: 0;
  padding-top: 0;
}
.checks.is-inline {
  margin-top: 12px;
}
.checks.is-inline .check {
  padding: 12px;
  border: 0;
  border-radius: 12px;
  background: var(--surface-2);
}
.checks.is-inline .check.is-warn {
  background: var(--warn-soft);
}
.checks.is-inline .check.is-error {
  background: var(--error-soft);
}
.checks.is-inline .check + .check {
  margin-top: 6px;
}
.check-icon {
  color: var(--primary);
}
.check.is-warn :is(.check-icon, .check-level) {
  color: var(--warn);
}
.check.is-error :is(.check-icon, .check-level) {
  color: var(--error);
}
.check-level {
  font-size: 11.5px;
  font-weight: 500;
  color: var(--primary);
}
.check-title {
  font-size: 14px;
  font-weight: 500;
}
.check-text {
  margin-top: 2px;
  color: var(--muted);
  font-size: 13px;
}
.check-fix {
  margin-top: 8px;
  height: auto;
  min-height: 32px;
  padding: 6px 14px;
  line-height: 1.3;
  white-space: normal;
  text-align: left;
}
.check .why {
  margin-top: 2px;
}

.settings {
  margin: -6px -8px 0;
}
.setting + .setting {
  border-top: 1px solid var(--line);
}
.setting-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto 18px;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 8px;
  border-radius: 10px;
  text-align: left;
  transition: background-color 0.15s var(--ease);
}
.setting-row:hover {
  background: var(--surface-2);
}
.setting-row > .icon {
  width: 18px;
  height: 18px;
  color: var(--faint);
  transition: transform 0.25s var(--ease);
}
.setting.is-open .setting-row > .icon {
  transform: rotate(180deg);
}
.setting-main,
.setting-side {
  display: grid;
  min-width: 0;
}
.setting-side {
  justify-items: end;
  text-align: right;
  max-width: 150px;
}
.setting-label {
  font-size: 13.5px;
}
.setting-key,
.setting-meta {
  font-size: 11px;
  color: var(--muted);
  overflow-wrap: anywhere;
}
.setting-value {
  padding: 0 4px;
  margin-right: -4px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 500;
  overflow-wrap: anywhere;
}
.setting.is-default .setting-value {
  font-weight: 400;
  color: var(--muted);
}
.setting-detail {
  padding: 2px 8px 12px;
}
.setting-why {
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 13px;
}
.settings-get {
  width: 100%;
  justify-content: center;
  margin-top: 12px;
}

/* ---------- terms ---------- */

.term {
  display: inline;
  padding: 0;
  font: inherit;
  color: inherit;
  text-align: inherit;
  text-decoration: underline dotted var(--primary);
  text-underline-offset: 3px;
  cursor: help;
}
.term:hover {
  color: var(--primary);
  text-decoration-style: solid;
}
.what-button {
  height: 28px;
  margin-left: auto;
  padding: 0 10px;
  font-size: 12.5px;
}
.term-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.term-chip {
  height: 28px;
  padding: 0 11px;
  border-radius: 14px;
  background: var(--surface-2);
  box-shadow: inset 0 0 0 1px var(--line);
  font-size: 12.5px;
  white-space: nowrap;
  transition: background-color 0.15s var(--ease);
}
.term-chip:hover {
  background: var(--surface-3);
}
.term-chip.is-current {
  background: var(--primary-soft);
  box-shadow: none;
  color: var(--on-primary-soft);
}
.dialog.glossary-dialog {
  width: min(900px, calc(100vw - 32px));
}
.glossary-body {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 400px);
  gap: 24px;
  align-items: start;
  padding: 0 24px 20px;
}
.glossary-text {
  display: grid;
  gap: 12px;
}
.glossary-plain {
  font-size: 18px;
  line-height: 1.4;
  text-wrap: pretty;
}
.glossary-more {
  color: var(--muted);
}
.glossary-here {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 4px 12px;
  padding: 10px 6px 10px 14px;
  border-radius: 12px;
  background: var(--surface-2);
}
.glossary-here-text {
  display: grid;
  gap: 1px;
}
.glossary-here-label {
  color: var(--muted);
  font-size: 13px;
}
.glossary-here strong {
  font-size: 20px;
  font-weight: 400;
}
.glossary-block {
  display: grid;
  gap: 6px;
}
.glossary-picture {
  padding: 12px;
  border-radius: 16px;
  background: var(--surface-2);
}
.glossary-picture svg {
  display: block;
  width: 100%;
  height: auto;
}
.glossary-all {
  display: grid;
  gap: 8px;
  padding: 14px 24px 22px;
  border-top: 1px solid var(--line);
}
.g-box {
  fill: var(--surface);
  stroke: var(--faint);
  stroke-width: 1.2;
}
.g-chip {
  fill: var(--faint);
}
.g-fill {
  fill: var(--primary-soft);
}
.g-line,
.g-swap,
.g-dash {
  fill: none;
  stroke: var(--faint);
  stroke-width: 1.2;
}
.g-swap {
  stroke: var(--primary);
}
.g-dash {
  stroke-dasharray: 4 4;
}
.g-label,
.g-note {
  stroke: none;
  font-family: var(--font);
}
.g-label {
  fill: var(--text);
  font-size: 11px;
  font-weight: 500;
}
.g-note {
  fill: var(--muted);
  font-size: 10px;
}
.g-chips rect,
.g-bars rect {
  fill: var(--surface-3);
  transform-box: fill-box;
}
.g-hot,
.g-hot .g-box {
  fill: var(--primary-soft);
  stroke: var(--primary);
  stroke-width: 2;
}
.g-chip.g-hot {
  fill: var(--primary);
  stroke: none;
}
.g-line.g-hot,
.g-hot .g-line {
  fill: none;
  stroke: var(--primary);
  stroke-width: 1.6;
}
.g-hot .g-chips rect {
  fill: var(--primary-soft);
  stroke: var(--primary);
  stroke-width: 1.5;
  animation: chip-in 0.35s var(--ease) both;
}
.g-hot .g-chips rect:nth-child(n + 9) {
  animation-delay: 0.45s;
}
.g-hot .g-chips rect:nth-child(n + 17) {
  animation-delay: 0.9s;
}
.g-hot.g-bars rect {
  fill: var(--primary);
  stroke: none;
  transform-origin: bottom;
  animation: bar-up 0.5s var(--ease) both;
}
.g-bars rect:nth-child(2) {
  animation-delay: 0.06s;
}
.g-bars rect:nth-child(3) {
  animation-delay: 0.12s;
}
.g-bars rect:nth-child(4) {
  animation-delay: 0.18s;
}
.g-bars rect:nth-child(5) {
  animation-delay: 0.24s;
}
.g-bars rect:nth-child(6) {
  animation-delay: 0.3s;
}
.g-bars rect:nth-child(7) {
  animation-delay: 0.36s;
}
.g-bars rect:nth-child(8) {
  animation-delay: 0.42s;
}
.g-bars rect:nth-child(9) {
  animation-delay: 0.48s;
}
@keyframes chip-in {
  from {
    opacity: 0;
    transform: scale(0.6);
  }
}
@keyframes bar-up {
  from {
    transform: scaleY(0);
  }
}

/* ---------- floating panels ---------- */

.info-panel,
.popover-panel {
  position: fixed;
  inset: auto;
  margin: 0;
  width: min(360px, calc(100vw - 24px));
  max-height: min(70vh, 560px);
  overflow-y: auto;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow);
  opacity: 0;
  transform: translateY(-4px) scale(0.98);
  transition:
    opacity 0.16s var(--ease),
    transform 0.16s var(--ease),
    overlay 0.16s allow-discrete,
    display 0.16s allow-discrete;
}
:is(.info-panel, .popover-panel):popover-open {
  opacity: 1;
  transform: none;
}
@starting-style {
  :is(.info-panel, .popover-panel):popover-open {
    opacity: 0;
    transform: translateY(-4px) scale(0.98);
  }
}
.info-title,
.popover-title {
  font-size: 15px;
  font-weight: 500;
}
.info-property {
  display: block;
  margin-top: 2px;
  font-size: 11.5px;
  color: var(--muted);
  overflow-wrap: anywhere;
}
.info-text {
  margin-top: 8px;
}
.info-sources .sources {
  margin-top: 12px;
}

.scenario-panel > * + * {
  margin-top: 12px;
}
.scenario-list {
  display: grid;
  gap: 2px;
}
.scenario {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 8px;
  padding: 2px 0 2px 8px;
  border-radius: 10px;
}
.scenario:hover {
  background: var(--surface-2);
}
.scenario-name {
  font-weight: 500;
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.scenario-summary {
  color: var(--muted);
  font-size: 12.5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.scenario-against {
  display: grid;
  gap: 6px;
  justify-items: start;
}
.scenario-actions {
  display: flex;
  justify-content: space-between;
  gap: 8px;
}

.dialog {
  width: min(720px, calc(100vw - 32px));
  max-height: calc(100vh - 48px);
  padding: 0;
  border: 0;
  border-radius: 28px;
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow);
  opacity: 0;
  transform: translateY(12px) scale(0.98);
  transition:
    opacity 0.22s var(--ease),
    transform 0.22s var(--ease),
    overlay 0.22s allow-discrete,
    display 0.22s allow-discrete;
}
.dialog[open] {
  opacity: 1;
  transform: none;
}
@starting-style {
  .dialog[open] {
    opacity: 0;
    transform: translateY(12px) scale(0.98);
  }
}
.dialog::backdrop {
  background: rgb(0 0 0 / 0);
  transition:
    background-color 0.22s var(--ease),
    overlay 0.22s allow-discrete,
    display 0.22s allow-discrete;
}
.dialog[open]::backdrop {
  background: rgb(0 0 0 / 0.42);
}
@starting-style {
  .dialog[open]::backdrop {
    background: rgb(0 0 0 / 0);
  }
}
.dialog-head {
  position: sticky;
  top: 0;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 16px 12px 24px;
  background: var(--surface);
}
.dialog-head h2 {
  font-size: 22px;
  font-weight: 400;
}
.dialog-body {
  display: grid;
  gap: 12px;
  justify-items: start;
  padding: 0 24px 24px;
}
.dialog-note {
  margin-top: 12px;
  font-size: 13px;
  color: var(--muted);
}
.commands-dialog {
  width: min(820px, calc(100vw - 32px));
}
.code {
  width: 100%;
  margin: 0;
  padding: 16px 20px;
  border-radius: 16px;
  background: var(--surface-2);
  font-size: 13px;
  line-height: 1.7;
  overflow-x: auto;
  white-space: pre;
}
.code-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  width: 100%;
}
.checkbox {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 36px;
  color: var(--muted);
  cursor: pointer;
}
.checkbox input {
  width: 18px;
  height: 18px;
  margin: 0;
  accent-color: var(--primary);
  flex: none;
}

.about-body {
  padding: 0 24px 28px;
}
.about-body h3 {
  margin: 20px 0 8px;
  font-size: 15px;
  font-weight: 500;
}
.about-body h3:first-child {
  margin-top: 0;
}
.about-body li {
  padding: 5px 0;
  color: var(--muted);
}
.about-body li strong {
  color: var(--text);
  font-weight: 500;
}
.about-body p {
  color: var(--muted);
}
.about-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 24px;
  margin-top: 16px;
}
.steps {
  counter-reset: step;
}
.steps li {
  position: relative;
  padding-left: 36px;
  counter-increment: step;
}
.steps li::before {
  content: counter(step);
  position: absolute;
  left: 0;
  top: 5px;
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--primary-soft);
  color: var(--on-primary-soft);
  font-size: 13px;
  font-weight: 500;
}

.compare-dialog {
  width: min(1040px, calc(100vw - 32px));
}
.table-wrap {
  padding: 0 24px 24px;
  overflow-x: auto;
}
.compare-table {
  width: 100%;
  border-collapse: collapse;
}
.compare-table :is(th, td) {
  padding: 7px 12px;
  text-align: right;
  white-space: nowrap;
  border-bottom: 1px solid var(--line);
}
.compare-table thead th {
  vertical-align: bottom;
  font-weight: 500;
}
.compare-table .row-head {
  text-align: left;
  font-weight: 400;
  color: var(--muted);
  white-space: normal;
}
.compare-table .section-row th {
  padding-top: 18px;
  text-align: left;
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
}
.compare-table td.is-different {
  color: var(--primary);
  font-weight: 500;
}
.compare-table td.empty {
  text-align: left;
}
.column-name,
.column-name-input {
  display: block;
  width: 100%;
  min-width: 96px;
  height: 36px;
  line-height: 36px;
  font-size: 15px;
  font-weight: 500;
  text-align: right;
}
.column-name-input {
  padding: 0 8px;
  margin-right: -8px;
  border: 0;
  border-radius: 8px;
  background: none;
}
.column-name-input:is(:hover, :focus) {
  background: var(--surface-2);
}
.column-actions {
  display: flex;
  justify-content: flex-end;
  margin-right: -12px;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 40px;
  z-index: 20;
  transform: translateX(-50%);
  width: max-content;
  max-width: calc(100vw - 32px);
  pointer-events: none;
}
.toast-card {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 44px;
  padding: 6px 8px 6px 16px;
  border-radius: 12px;
  background: var(--inverse);
  color: var(--on-inverse);
  box-shadow: var(--shadow);
  pointer-events: auto;
  animation: toast-in 0.25s var(--ease) both;
}
.toast-card > span {
  padding-right: 8px;
}
.toast-card.is-leaving {
  animation: toast-out 0.2s var(--ease) both;
}
.toast-action {
  height: 32px;
  padding: 0 12px;
  border-radius: 16px;
  color: var(--inverse-primary);
  font-weight: 500;
  white-space: nowrap;
}
.toast-action:hover {
  background: rgb(127 127 127 / 0.2);
}
.noscript {
  padding: 32px;
  text-align: center;
}

/* ---------- motion ---------- */

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
}
@keyframes enter {
  from {
    opacity: 0;
    transform: scale(0.85);
  }
}
@keyframes flash {
  from {
    background-color: var(--primary-soft);
  }
}
@keyframes lit {
  from {
    box-shadow: 0 0 0 6px color-mix(in srgb, var(--primary) 30%, transparent);
  }
  to {
    box-shadow: 0 0 0 0 transparent;
  }
}
@keyframes sway {
  0%,
  100% {
    transform: translateX(-3px);
  }
  50% {
    transform: translateX(3px);
  }
}
@keyframes work {
  from {
    transform: scaleY(0.12);
  }
  to {
    transform: scaleY(0.6);
  }
}
@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
}
@keyframes toast-out {
  to {
    opacity: 0;
    transform: translateY(8px);
  }
}

.is-ready .work > .panel {
  animation: rise 0.45s var(--ease) both;
}
.is-ready .work > .panel:nth-of-type(2) {
  animation-delay: 0.06s;
}
.is-ready .work > .panel:nth-of-type(3) {
  animation-delay: 0.12s;
}
.is-ready .is-entering {
  animation: enter 0.3s var(--ease) both;
}
.is-changed {
  animation: flash 0.9s var(--ease);
}

/* ---------- embedded, and screens that cannot hold three columns ---------- */

.is-embed :is(.brand, .foot) {
  display: none;
}

/* Laptops: tighter rows, then no footer, so the three panels still fit one screen. */
@media (max-width: 1366px) and (min-width: 1240px) {
  .work {
    grid-template-columns: 320px minmax(0, 1fr) 332px;
  }
  .control {
    width: 120px;
  }
}
@media (max-height: 800px) and (min-width: 861px) {
  .row {
    min-height: 33px;
  }
  .control,
  .segmented:not(.is-tabs) {
    height: 30px;
  }
  .group {
    padding: 6px 16px 4px;
  }
  .presets {
    padding: 2px 0 3px;
  }
  .tier-note,
  .cell-note,
  .task-note {
    display: none;
  }
  .task-chip {
    width: 16px;
    height: 16px;
    border-radius: 4px;
  }
  .tasks {
    padding: 4px;
  }
  .tier-fit {
    margin-bottom: 8px;
  }
}
@media (max-height: 760px) and (min-width: 861px) {
  .foot {
    padding: 4px 16px;
    font-size: 11.5px;
  }
}
@media (max-height: 639px) and (min-width: 861px) {
  body {
    height: auto;
    min-height: 100dvh;
    overflow: auto;
  }
  .work {
    height: 580px;
  }
}

@media (max-width: 1239px) and (min-width: 861px) {
  body {
    height: auto;
    min-height: 100dvh;
    overflow: auto;
  }
  .work {
    grid-template-columns: 316px minmax(0, 1fr);
    grid-template-rows: minmax(680px, calc(100dvh - 100px)) auto;
  }
  .inputs {
    grid-row: 1 / span 2;
    position: sticky;
    top: 12px;
    max-height: calc(100dvh - 24px);
    align-self: start;
  }
  .inspector {
    grid-column: 2;
  }
  .bar-tools .text-button span,
  .bar-end .filled-button span {
    display: none;
  }
}

@media (max-width: 860px) {
  .bar {
    gap: 4px;
    height: 52px;
    padding: 0 6px 0 10px;
  }
  .bar-group,
  .bar-end {
    gap: 0;
  }
  .bar .text-button {
    padding: 0 8px;
  }
  .bar .filled-button {
    padding: 0 12px;
  }
  .brand span {
    display: none;
  }
  .bar-tools {
    gap: 4px;
  }
  .bar-group + .bar-group {
    padding-left: 4px;
  }
  .bar-tools .text-button span,
  .bar-end .filled-button span {
    display: none;
  }
  .work {
    grid-template-columns: minmax(0, 1fr);
    padding: 0 8px;
  }
  .work > .panel {
    display: none;
  }
  [data-pane='inputs'] .work > .inputs,
  [data-pane='picture'] .work > .stage,
  [data-pane='details'] .work > .inspector {
    display: flex;
  }
  [data-pane='inputs'] .work > .inputs {
    display: block;
  }
  .panes {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 4px;
    padding: 8px;
  }
  .panes button {
    height: 40px;
    border-radius: 20px;
    color: var(--muted);
    font-weight: 500;
  }
  .panes button[aria-pressed='true'] {
    background: var(--primary-soft);
    color: var(--on-primary-soft);
  }
  body {
    grid-template-rows: auto minmax(0, 1fr) auto auto;
  }
  .foot {
    padding: 4px 12px;
    font-size: 11.5px;
  }
  .foot-note {
    display: none;
  }
  .control {
    width: 150px;
    height: 36px;
  }
  .row {
    min-height: 44px;
  }
  .stage {
    overflow-y: auto;
    padding: 12px;
  }
  .headline {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }
  .meters {
    width: auto;
  }
  .stat-number {
    font-size: 2rem;
  }
  .tiers {
    flex: none;
  }
  .tier-executor {
    flex: none;
    height: 300px;
  }
  .gauges {
    grid-template-columns: minmax(0, 1fr);
  }
  .fit-prompt {
    flex-direction: column;
    align-items: flex-start;
  }
  .tier-head {
    flex-direction: column;
    gap: 0;
  }
  .tier-meta {
    text-align: left;
  }
  .code-actions {
    flex-direction: column;
    align-items: stretch;
  }
  .glossary-body {
    grid-template-columns: minmax(0, 1fr);
  }
  .toast {
    bottom: 72px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-delay: 0s !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* ----- which way YARN counts: the line under the choice, and the picture when tasks outnumber cores ----- */
.row-note {
  display: flex;
  align-items: center;
  gap: 5px;
  margin: 0 0 0 auto;
  white-space: nowrap;
  color: var(--warn);
  font-size: 12px;
  line-height: 1.3;
}
.row-note.is-ok {
  color: var(--muted);
}
.row-note-mark {
  flex: none;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
}
.row-note.is-ok .row-note-mark {
  background: var(--ok);
}
.row-note-text {
  min-width: 0;
}
.row-note-why {
  flex: none;
  min-height: 0;
  padding: 0 4px;
  font-size: 12px;
}
.meter.is-over .meter-fill {
  background: var(--warn);
}
.meter.is-over .meter-value {
  color: var(--warn);
}
.tier-meta.is-over {
  color: var(--warn);
  font-weight: 500;
}
.node-box.is-sharing .core-chip:not(.is-idle) {
  background: var(--warn);
}
.glossary-advice {
  display: grid;
  gap: 4px;
  padding: 10px 14px;
  border-radius: 12px;
  border: 1px solid var(--warn);
  font-size: 13.5px;
  line-height: 1.45;
  text-wrap: pretty;
}
.glossary-advice.is-ok {
  border-color: var(--line);
}
.glossary-advice p {
  margin: 0;
  color: var(--muted);
}
.g-over.g-box {
  stroke: var(--warn);
  stroke-dasharray: 3 3;
}
.g-chip.g-over {
  fill: var(--warn);
}
.g-hot .g-chip {
  fill: var(--primary);
}
.g-hot .g-chip.g-over {
  fill: var(--warn);
}
.g-hot .g-over.g-box {
  stroke: var(--warn);
}

/* ----- inputs shown where their effect is explained ----- */
.inline-inputs {
  padding: 4px 10px;
  border-radius: 12px;
  background: var(--surface-2);
}
.setting-inputs {
  margin: 0 0 10px;
}
.block-note {
  color: var(--faint);
  font-size: 11px;
}
.code-note {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.4;
}
