:root {
  color-scheme: only light;
  --tw-ground: #FAFAF9;
  --tw-surface: #FFFFFF;
  --tw-well: #F4F4F2;
  --tw-ink: #0a0a0f;
  --tw-muted: #6b7280;
  --tw-rule: #e8e8ed;
  --tw-rule-strong: #dcdce2;
  --tw-blue: #1D4AFF;
  --tw-wash: rgba(29, 74, 255, 0.06);
  --tw-wash-strong: rgba(29, 74, 255, 0.1);
  --tw-grid-line: rgba(10, 10, 15, 0.045);
  --tw-contact: rgba(10, 10, 15, 0.05);
  --tw-font: "Inter", "Inter Greek", system-ui, -apple-system, sans-serif;
  --tw-mono: "JetBrains Mono", "Inter Greek", ui-monospace, monospace;
  --tw-r-sm: 8px;
  --tw-r-md: 12px;
  --tw-r-lg: 16px;
}

* {
  box-sizing: border-box;
}

::selection {
  background: var(--tw-wash-strong);
}

html,
body {
  margin: 0;
  height: 100%;
  background: var(--tw-ground);
  color: var(--tw-ink);
  font-family: var(--tw-font);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  display: grid;
  grid-template-rows: 52px minmax(0, 1fr);
  overflow: hidden;
}

button {
  font: inherit;
  color: inherit;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
}

.win-bar:focus-visible,
.win-pill:focus-visible {
  outline: 2px solid var(--tw-blue);
  outline-offset: -2px;
}

.tile:focus-visible,
.win-tool:focus-visible,
.win-menu button:focus-visible {
  outline: 2px solid var(--tw-blue);
  outline-offset: 2px;
}

.tw-bus {
  color: var(--tw-ink);
  border-color: var(--tw-ink);
}

.tw-body {
  display: grid;
  grid-template-columns: 232px minmax(0, 1fr);
  min-height: 0;
}

.tw-rail {
  background: var(--tw-surface);
  border-right: 1px solid var(--tw-rule);
  padding: 16px 10px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 0;
  overflow-y: auto;
}

.tw-rail-label {
  margin: 0;
  padding: 0 10px;
  font-size: 11px;
  font-weight: 600;
  color: var(--tw-muted);
}

.tile-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 4px;
}

.tile {
  display: grid;
  grid-template-columns: 56px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  width: 100%;
  padding: 8px;
  border: 1px solid transparent;
  border-radius: 10px;
  background: transparent;
  text-align: left;
  cursor: pointer;
}

.tile:hover {
  background: var(--tw-well);
}

.tile[aria-pressed="true"] {
  background: var(--tw-wash);
}

.tile-thumb {
  width: 56px;
  height: 36px;
  border-radius: 6px;
  border: 1px solid var(--tw-rule);
  background: var(--tw-well);
  display: grid;
  place-items: center;
  overflow: hidden;
  color: var(--tw-ink);
}

.tile-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.tile-text {
  display: grid;
  gap: 1px;
  min-width: 0;
}

.tile-name {
  font-size: 13px;
  font-weight: 600;
  overflow-wrap: anywhere;
}

.tile[aria-pressed="true"] .tile-name {
  color: var(--tw-blue);
}

.tile-sub,
.tile-state {
  font-size: 11px;
  color: var(--tw-muted);
  overflow-wrap: anywhere;
}

.tile-state {
  font-family: var(--tw-mono);
  font-size: 11px;
}

.tw-hint {
  margin: auto 0 0;
  padding: 10px;
  font-size: 11px;
  line-height: 1.5;
  color: var(--tw-muted);
  border-top: 1px solid var(--tw-rule);
}

.tw-desk {
  position: relative;
  overflow: clip;
  min-height: 0;
  background: var(--tw-ground);
  touch-action: none;
}

#desk-grid {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}

#snap-preview {
  position: absolute;
  left: 0;
  top: 0;
  border: 1px solid var(--tw-blue);
  background: var(--tw-wash);
  border-radius: var(--tw-r-md);
  pointer-events: none;
  z-index: 350;
}

#snap-preview[hidden] {
  display: none;
}

#desk-scrim {
  position: absolute;
  inset: 0;
  background: var(--tw-ground);
  opacity: 0;
  visibility: hidden;
}

.win {
  position: absolute;
  left: 0;
  top: 0;
  --lift: 0;
  background: var(--tw-surface);
  border: 1px solid var(--tw-rule-strong);
  overflow: hidden;
  contain: layout paint;
  box-shadow:
    0 1px 2px rgba(10, 10, 15, calc(0.04 + 0.02 * var(--lift))),
    0 calc(2px + 10px * var(--lift)) calc(8px + 24px * var(--lift)) rgba(10, 10, 15, calc(0.035 + 0.055 * var(--lift)));
}

.win-frame {
  position: absolute;
  inset: 0;
  display: grid;
  grid-template-rows: 40px minmax(0, 1fr);
}

.win-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 6px 0 12px;
  border-bottom: 1px solid var(--tw-rule);
  background: var(--tw-surface);
  cursor: grab;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  container-type: inline-size;
  min-width: 0;
}

.win[data-dragging="true"] .win-bar {
  cursor: grabbing;
}

.win-face {
  display: inline-grid;
  place-items: center;
  width: 20px;
  height: 20px;
  flex: none;
  color: var(--tw-ink);
}

.win[data-focus="true"] .win-bar .win-face {
  color: var(--tw-blue);
}

.win-title {
  flex: 1 1 auto;
  min-width: 0;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.2;
  overflow-wrap: break-word;
}

@container (max-width: 236px) {
  .win-tool[data-cmd="minimize"],
  .win-tool[data-cmd="expand"] {
    display: none;
  }
}

.win-tools {
  display: flex;
  align-items: center;
  gap: 2px;
  flex: none;
}

.win-tool {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--tw-muted);
  cursor: pointer;
  padding: 0;
}

.win-tool:hover {
  background: var(--tw-well);
  color: var(--tw-ink);
}

.win-tool[aria-pressed="true"],
.win-tool[aria-expanded="true"] {
  background: var(--tw-wash);
  color: var(--tw-blue);
}

.win-tool svg {
  width: 16px;
  height: 16px;
  pointer-events: none;
}

.win-content {
  position: relative;
  min-height: 0;
  overflow: hidden;
}

.win-main,
.win-diag {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  right: 0;
  min-width: 0;
}

.win-main {
  container-type: size;
}

.win-diag {
  overflow: auto;
  overscroll-behavior: contain;
  background: var(--tw-surface);
  border-left: 1px solid transparent;
}

.win[data-kind="lab"] .win-diag {
  border-left-color: var(--tw-rule);
}

.tw-desk[data-narrow="true"] .win[data-kind="lab"] .win-diag {
  border-left-color: transparent;
  border-top: 1px solid var(--tw-rule);
}

.tw-desk[data-narrow="true"] .win-bar {
  cursor: default;
}

.diag-note {
  overflow-wrap: anywhere;
}

@media (max-width: 359px) {
  .diag-table .col-plane {
    display: none;
  }
}

.win[data-kind="lab"] .diag {
  grid-template-columns: minmax(0, 1fr);
}

.win[data-kind="lab"] .diag-col {
  border-right: 0;
  border-bottom: 1px solid var(--tw-rule);
}

.win-pill {
  position: absolute;
  inset: 0;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
  text-align: left;
  container-type: inline-size;
}

.pill-inner {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 12px 0 8px;
}

.pill-name {
  font-size: 12px;
  font-weight: 600;
  line-height: 1.1;
  min-width: 0;
}

@container (max-width: 96px) {
  .pill-name {
    display: none;
  }
  .pill-inner {
    justify-content: center;
    padding: 0;
  }
}

.win-menu {
  margin: 0;
  padding: 4px;
  border: 1px solid var(--tw-rule-strong);
  border-radius: var(--tw-r-md);
  background: var(--tw-surface);
  box-shadow: 0 1px 2px rgba(10, 10, 15, 0.05), 0 12px 32px rgba(10, 10, 15, 0.1);
  min-width: 180px;
  inset: auto;
  position: fixed;
}

.win-menu button {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 7px 10px;
  border: 0;
  border-radius: var(--tw-r-sm);
  background: transparent;
  font-size: 13px;
  text-align: left;
  cursor: pointer;
}

.win-menu button:hover {
  background: var(--tw-well);
}

.win-menu button[aria-checked="true"] {
  color: var(--tw-blue);
  background: var(--tw-wash);
}

.win-menu svg {
  width: 16px;
  height: 16px;
  flex: none;
  pointer-events: none;
}

.win-menu [hidden] {
  display: none;
}

.win-menu hr {
  border: 0;
  border-top: 1px solid var(--tw-rule);
  margin: 4px 2px;
}

.win-menu kbd {
  margin-left: auto;
  font-family: var(--tw-mono);
  font-size: 11px;
  color: var(--tw-muted);
}

.agent {
  position: absolute;
  inset: 0;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 10px;
  padding: 12px;
}

.agent-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}

.agent-role {
  font-size: 12px;
  color: var(--tw-muted);
}

.agent-state {
  font-size: 11px;
  line-height: 1.4;
  color: var(--tw-muted);
}

.agent-grid {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 0;
}

.agent-shot {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  border: 1px solid var(--tw-rule);
  border-radius: var(--tw-r-sm);
  background: var(--tw-well);
  overflow: hidden;
  display: grid;
  place-items: center;
}

.agent-shot img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top left;
  display: block;
}

.sample-tag {
  flex: none;
  font-family: var(--tw-mono);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  line-height: 1;
  color: var(--tw-ink);
  background: var(--tw-surface);
  border: 1px solid var(--tw-rule-strong);
  border-radius: 5px;
  padding: 3px 5px;
}

.agent-idle {
  margin: 0;
  flex: 1 1 auto;
  align-self: flex-start;
  width: 100%;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border: 1px solid var(--tw-rule);
  border-radius: var(--tw-r-sm);
  background: var(--tw-well);
  font-size: 12px;
  line-height: 1.4;
  color: var(--tw-muted);
}

.agent-idle svg {
  flex: none;
}

.agent-meta {
  flex: none;
  display: grid;
  gap: 6px;
  min-width: 0;
}

.agent-page {
  margin: 0;
  font-size: 13px;
  font-weight: 550;
  overflow-wrap: anywhere;
}

.agent-host {
  margin: 0;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px 8px;
  font-family: var(--tw-mono);
  font-size: 11px;
  color: var(--tw-muted);
  overflow-wrap: anywhere;
}

@container (min-aspect-ratio: 3 / 2) {
  .agent-grid {
    flex-direction: row;
    align-items: stretch;
  }
  .agent-shot {
    flex: 0 0 auto;
    height: 100%;
    aspect-ratio: 8 / 5;
    max-width: 58cqw;
  }
  .agent-meta {
    flex: 1 1 0;
    align-content: start;
  }
}

@container (max-height: 150px) {
  .agent-shot {
    display: none;
  }
}

.lab {
  position: absolute;
  inset: 0;
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
}

.lab-stage {
  position: relative;
  min-height: 0;
  overflow: hidden;
}

.lab-stage canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}

.lab-caption {
  display: flex;
  justify-content: space-between;
  gap: 4px 8px;
  flex-wrap: wrap;
  padding: 7px 12px;
  border-top: 1px solid var(--tw-rule);
  font-family: var(--tw-mono);
  font-size: 11px;
  color: var(--tw-muted);
}

.diag {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 0;
  min-height: 100%;
}

.diag-col {
  padding: 16px;
  display: grid;
  align-content: start;
  gap: 14px;
  border-right: 1px solid var(--tw-rule);
  min-width: 0;
}

.diag-col:last-child {
  border-right: 0;
}

.diag-h {
  margin: 0;
  font-size: 11px;
  font-weight: 600;
  color: var(--tw-muted);
}

.diag-facts {
  margin: 0;
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 4px 12px;
  font-family: var(--tw-mono);
  font-size: 11px;
}

.diag-facts dt {
  color: var(--tw-muted);
}

.diag-facts dd {
  margin: 0;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.diag-plot {
  width: 100%;
  max-width: 640px;
  height: auto;
  display: block;
  border: 1px solid var(--tw-rule);
  border-radius: var(--tw-r-sm);
  background: var(--tw-ground);
}

.diag-plot * {
  vector-effect: non-scaling-stroke;
}

.diag-plot .curve,
.diag-plot .hist {
  fill: none;
  stroke: var(--tw-ink);
  stroke-width: 1.5;
  stroke-linejoin: round;
}

.diag-plot .target {
  stroke: var(--tw-rule-strong);
  stroke-dasharray: 3 3;
}

.diag-plot .th {
  stroke: var(--tw-blue);
  stroke-dasharray: 2 3;
}

.diag-plot .marker {
  fill: var(--tw-blue);
}

.diag-table {
  width: 100%;
  border-collapse: collapse;
  font-family: var(--tw-mono);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}

.diag-table th {
  text-align: left;
  font-weight: 500;
  color: var(--tw-muted);
  padding: 4px 6px;
  border-bottom: 1px solid var(--tw-rule);
}

.diag-table td {
  padding: 5px 6px;
  border-bottom: 1px solid var(--tw-rule);
}

.diag-table td + td,
.diag-table th + th {
  text-align: right;
}

.diag-table tr[data-self="true"] td {
  background: var(--tw-wash);
  color: var(--tw-blue);
}

.diag-note {
  margin: 0;
  font-size: 11px;
  line-height: 1.5;
  color: var(--tw-muted);
}

.diag-sim {
  color: var(--tw-ink);
  border-left: 2px solid var(--tw-blue);
  padding-left: 8px;
}

.diag-log {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0;
  font-size: 12px;
  line-height: 1.4;
}

.diag-log li {
  display: grid;
  grid-template-columns: 56px minmax(0, 1fr);
  gap: 8px;
  padding: 6px 0;
  border-top: 1px solid var(--tw-rule);
}

.diag-log li:last-child {
  border-bottom: 1px solid var(--tw-rule);
}

.diag-log-t {
  font-family: var(--tw-mono);
  font-size: 11px;
  color: var(--tw-muted);
  font-variant-numeric: tabular-nums;
}

.diag-log-to {
  color: var(--tw-ink);
  overflow-wrap: anywhere;
}

.diag-log li.diag-log-empty .diag-log-to {
  grid-column: 1 / -1;
  color: var(--tw-muted);
}

.cosplay-drawer {
  background: var(--tw-well);
  border: 1px solid #D2D2CA;
  border-radius: var(--tw-r-md);
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.cosplay-drawer-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  user-select: none;
  font-size: 11px;
  font-weight: 600;
  color: var(--tw-ink);
  list-style: none;
}

.cosplay-drawer-summary::-webkit-details-marker {
  display: none;
}

.cosplay-drawer-badge {
  font-family: var(--tw-mono);
  font-size: 11px;
  font-weight: 500;
  color: var(--tw-blue);
  background: var(--tw-surface);
  border: 1px solid var(--tw-rule);
  border-radius: 4px;
  padding: 1px 6px;
}

.cosplay-drawer-content {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-top: 6px;
  border-top: 1px solid var(--tw-rule);
}

.cosplay-presets {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 4px;
}

.cosplay-preset-btn {
  font-size: 11px;
  font-family: var(--tw-font);
  font-weight: 500;
  padding: 4px 6px;
  background: var(--tw-surface);
  border: 1px solid var(--tw-rule);
  border-radius: 6px;
  color: var(--tw-ink);
  cursor: pointer;
  text-align: center;
}

.cosplay-preset-btn:hover {
  border-color: var(--tw-rule-strong);
  background: #FDFDFB;
}

.cosplay-preset-btn[aria-pressed="true"] {
  background: var(--tw-wash);
  border-color: var(--tw-blue);
  color: var(--tw-blue);
  font-weight: 600;
}

.eco-stage-btn {
  font-size: 11px;
  font-family: var(--tw-mono);
  font-weight: 500;
  padding: 4px 8px;
  background: var(--tw-surface);
  border: 1px solid var(--tw-rule);
  border-radius: 4px;
  color: var(--tw-ink);
  cursor: pointer;
  text-align: center;
}

.eco-stage-btn:hover {
  border-color: var(--tw-rule-strong);
  background: #FDFDFB;
}

.eco-stage-btn[aria-pressed="true"] {
  background: var(--tw-wash);
  border-color: var(--tw-blue);
  color: var(--tw-blue);
  font-weight: 600;
}


.cosplay-sliders {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.cosplay-field {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.cosplay-label-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 11px;
}

.cosplay-label-row label {
  color: var(--tw-muted);
  font-size: 11px;
}

.cosplay-val {
  font-family: var(--tw-mono);
  font-size: 11px;
  color: var(--tw-ink);
  font-variant-numeric: tabular-nums;
}

.cosplay-field input[type="range"] {
  width: 100%;
  margin: 2px 0;
  accent-color: var(--tw-blue);
  cursor: pointer;
}

.cosplay-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 11px;
  padding-top: 4px;
  border-top: 1px solid var(--tw-rule);
  color: var(--tw-muted);
}

.cosplay-footer b {
  color: var(--tw-ink);
  font-family: var(--tw-mono);
  font-weight: 600;
  font-size: 11px;
}

.cosplay-shm-status {
  font-family: var(--tw-mono);
  font-size: 11px;
  color: #0d7a3e;
}

@media (max-width: 720px) {
  .tw-body {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto minmax(0, 1fr);
  }
  .tw-rail {
    flex-direction: row;
    align-items: center;
    border-right: 0;
    border-bottom: 1px solid var(--tw-rule);
    padding: 6px 8px;
    overflow-x: auto;
    overflow-y: hidden;
  }
  .tw-rail-label,
  .tw-hint,
  .cosplay-drawer {
    display: none;
  }
  .tile-list {
    grid-auto-flow: column;
    grid-auto-columns: max-content;
  }
  .tile-name,
  .tile-state {
    overflow-wrap: normal;
  }
  .tile {
    grid-template-columns: 28px minmax(0, 1fr);
    gap: 6px;
    padding: 6px;
  }
  .tile-thumb {
    width: 28px;
    height: 28px;
  }
  .tile-sub {
    display: none;
  }
}
