:root {
  color-scheme: dark;
  --black: #000;
  --white: #fff;
  --white-04: rgba(255, 255, 255, 0.04);
  --white-08: rgba(255, 255, 255, 0.08);
  --white-12: rgba(255, 255, 255, 0.12);
  --white-32: rgba(255, 255, 255, 0.54);
  --white-56: rgba(255, 255, 255, 0.74);
  --coral: #ff4f00;
  --ink-on-accent: #000;
  --green: #31c46a;
  --yellow: #e6b23c;
  --red: #e5484d;
  background: var(--black);
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "SF Pro Display", sans-serif;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
  background: var(--black);
  color: var(--white);
}

button {
  font: inherit;
}

.canvas-shell {
  position: relative;
  width: 100%;
  height: 100%;
  padding: 0;
}

.canvas-header {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 20px;
}

.eyebrow,
.state-kicker {
  margin: 0 0 4px;
  color: var(--white-32);
  font-size: 11px;
  font-weight: 650;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  font-size: clamp(17px, 2vw, 23px);
  font-weight: 590;
  letter-spacing: -0.025em;
}

.run-status {
  margin: 0;
  color: var(--white-56);
  font: 11px/1.3 ui-monospace, SFMono-Regular, Menlo, monospace;
  text-align: right;
}

.stages {
  display: grid;
  grid-template-columns: repeat(4, minmax(105px, 1fr));
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.stage {
  position: relative;
  min-width: 0;
  padding: 11px 12px 10px 28px;
  overflow: hidden;
  border: 1px solid var(--white-08);
  border-radius: 13px;
  background: var(--white-04);
}

.stage::before {
  position: absolute;
  top: 15px;
  left: 12px;
  width: 7px;
  height: 7px;
  border-radius: 999px;
  background: var(--white-12);
  content: "";
}

.stage-name {
  overflow: hidden;
  color: var(--white-56);
  font-size: 11px;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.stage-state {
  margin-top: 3px;
  color: var(--white-32);
  font: 11px/1.3 ui-monospace, SFMono-Regular, Menlo, monospace;
  text-transform: uppercase;
}

.stage.is-running {
  border-color: rgba(255, 79, 0, 0.65);
  background: rgba(255, 79, 0, 0.07);
}

.stage.is-running::before {
  background: var(--coral);
  box-shadow: 0 0 0 5px rgba(255, 79, 0, 0.12);
}

.stage.is-running .stage-name,
.stage.is-done .stage-name {
  color: var(--white);
}

.stage.is-done {
  border-color: rgba(49, 196, 106, 0.32);
}

.stage.is-done::before {
  background: var(--green);
}

.stage.is-error {
  border-color: rgba(229, 72, 77, 0.55);
}

.stage.is-error::before {
  background: var(--red);
}

.stage.is-skipped {
  opacity: 0.56;
}

.viewport {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  overflow: hidden;
  border: 0;
  border-radius: 0;
  background: var(--black);
}

.viewport.has-artifact {
  cursor: grab;
}

.viewport.is-dragging {
  cursor: grabbing;
}

.empty-state {
  display: grid;
  justify-items: center;
  max-width: 420px;
  padding: 28px;
  color: var(--white-32);
  text-align: center;
}

.empty-mark {
  width: 38px;
  height: 38px;
  margin-bottom: 13px;
  border: 1px solid var(--white-12);
  border-radius: 12px;
  background: var(--white-04);
  box-shadow: inset 0 0 0 10px rgba(255, 255, 255, 0.012);
}

.empty-state p {
  margin: 0;
  color: var(--white-56);
  font-size: 13px;
}

.empty-state small {
  margin-top: 7px;
  font-size: 11px;
}

.artifact-image,
.artifact-text {
  max-width: 100%;
  max-height: 100%;
  transform-origin: center;
  will-change: transform;
}

.artifact-image {
  position: fixed;
  inset: 0;
  display: block;
  width: 100vw;
  height: 100vh;
  max-width: none;
  max-height: none;
  object-fit: contain;
  user-select: none;
  -webkit-user-drag: none;
}

.artifact-text {
  width: min(82%, 920px);
  max-height: 78%;
  margin: 0;
  padding: 18px;
  overflow: auto;
  border: 1px solid var(--white-08);
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.72);
  color: rgba(255, 255, 255, 0.72);
  font: 11px/1.55 ui-monospace, SFMono-Regular, Menlo, monospace;
  white-space: pre-wrap;
}

.viewport.has-data-overlay .artifact-text {
  position: absolute;
  top: 58px;
  right: 14px;
  z-index: 1;
  width: min(38%, 380px);
  max-height: calc(100% - 110px);
  margin: 0;
  background: rgba(0, 0, 0, 0.84);
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.32);
  backdrop-filter: blur(14px);
}

.artifact-tabs {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 2;
  display: flex;
  max-width: calc(100% - 24px);
  gap: 5px;
  padding: 4px;
  overflow-x: auto;
  border: 1px solid var(--white-08);
  border-radius: 11px;
  background: rgba(0, 0, 0, 0.78);
  backdrop-filter: blur(12px);
}

.artifact-tab {
  flex: none;
  padding: 5px 9px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--white-56);
  cursor: pointer;
  font-size: 11px;
}

.artifact-tab:hover,
.artifact-tab:focus-visible {
  color: var(--white);
}

.artifact-tab.is-selected {
  background: var(--coral);
  color: var(--ink-on-accent);
}

.artifact-caption,
.zoom-hint {
  position: absolute;
  bottom: 11px;
  margin: 0;
  border: 1px solid var(--white-08);
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.72);
  color: var(--white-56);
  font: 11px/1.3 ui-monospace, SFMono-Regular, Menlo, monospace;
  backdrop-filter: blur(8px);
}

.artifact-caption {
  left: 12px;
  max-width: calc(100% - 180px);
  padding: 5px 9px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.zoom-hint {
  right: 12px;
  padding: 5px 9px;
}

.canvas-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 42px;
  gap: 18px;
}

.state-copy {
  margin: 0;
  color: var(--white-32);
  font-size: 11px;
}

.skill-question {
  max-width: min(55%, 620px);
  margin: 0;
  padding: 9px 12px;
  border: 1px solid rgba(230, 178, 60, 0.34);
  border-radius: 11px;
  background: rgba(230, 178, 60, 0.07);
  color: rgba(255, 255, 255, 0.78);
  font-size: 11px;
}

.skill-question::before {
  color: var(--yellow);
  content: "Answer in chat · ";
  font-weight: 650;
}

@media (max-width: 920px) {
  .canvas-shell {
    padding: 0;
  }

  .stages {
    grid-template-columns: repeat(2, minmax(105px, 1fr));
  }

  .canvas-footer {
    align-items: flex-start;
    flex-direction: column;
    gap: 8px;
  }

  .skill-question {
    max-width: 100%;
  }
}

/*
 * The MVP canvas is deliberately presentation-only. Agent progress,
 * intervention, labels, and state remain in the existing Spaceport palette;
 * this surface renders only the current visual artifact.
 */
.canvas-header,
.stages,
.empty-state,
.artifact-text,
.artifact-tabs,
.artifact-caption,
.zoom-hint,
.canvas-footer,
.skill-question {
  display: none !important;
}

.skill-question::before {
  content: none;
}
