body.run { height: 100vh; display: flex; flex-direction: column; overflow: hidden; }
.run .top { flex: none; }
.run .btn { background: var(--bg); cursor: pointer; font-family: var(--sans); }

.run-layout { flex: 1; min-height: 0; display: grid; grid-template-columns: 1fr minmax(340px, 34%); }

.stage {
  min-width: 0; min-height: 0; display: flex; flex-direction: column;
  background: #f4f4f1; background-image: radial-gradient(#e2e2dc 1px, transparent 1px); background-size: 18px 18px;
}
.stage-inner { flex: 1; min-height: 0; position: relative; display: grid; place-items: center; padding: 20px; }
#canvas {
  max-width: 100%; max-height: 100%;
  background: #000; outline: none;
  box-shadow: 0 0 0 1px rgba(0,0,0,0.12), 0 8px 30px rgba(0,0,0,0.08);
  image-rendering: auto;
}
#canvas:not([width]) { width: 640px; height: 400px; }
#canvas:focus { box-shadow: 0 0 0 2px var(--accent), 0 8px 30px rgba(0,0,0,0.08); }
.stage-hint { flex: none; text-align: center; font-size: 12px; color: var(--faint); padding: 0 0 12px; }

.overlay { position: absolute; inset: 0; display: grid; place-items: center; pointer-events: none; }
.overlay.hidden { display: none; }
.steps { background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: 16px 20px; min-width: 300px; font-size: 14px; }
.step { display: flex; align-items: center; gap: 10px; padding: 3px 0; color: var(--faint); }
.step::before { content: ""; width: 8px; height: 8px; border-radius: 50%; border: 1.5px solid currentColor; flex: none; }
.step.active { color: var(--text); }
.step.active::before { border-color: var(--accent); border-top-color: transparent; animation: spin 0.8s linear infinite; width: 9px; height: 9px; }
.step.done { color: var(--muted); }
.step.done::before { background: var(--accent); border-color: var(--accent); }
.step.fail { color: var(--warn); }
.step.fail::before { background: var(--warn); border-color: var(--warn); }
.step small { margin-left: auto; color: var(--faint); font-variant-numeric: tabular-nums; }
@keyframes spin { to { transform: rotate(360deg); } }

.console { min-width: 0; min-height: 0; display: flex; flex-direction: column; border-left: 1px solid var(--line); background: #fff; }
.console-head { flex: none; display: flex; align-items: center; justify-content: space-between; padding: 0 14px; height: 38px; border-bottom: 1px solid var(--line); font-size: 12px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); font-weight: 600; }
.console-head .link { text-transform: none; letter-spacing: 0; font-weight: 500; }
.log { flex: 1; min-height: 0; overflow-y: auto; padding: 10px 14px; font: 12.5px/1.55 var(--mono); white-space: pre-wrap; word-break: break-word; }
.log .l-out { color: var(--text); }
.log .l-err { color: #b3261e; }
.log .l-sys { color: var(--faint); font-family: var(--sans); font-size: 12px; }
.log .l-in { color: var(--accent); }
.log .l-res { color: #2f5f9e; }

.repl { flex: none; display: flex; align-items: flex-start; gap: 8px; border-top: 1px solid var(--line); padding: 9px 14px; font: 12.5px/1.55 var(--mono); }
.repl .prompt { color: var(--accent); user-select: none; padding-top: 1px; }
.repl textarea { flex: 1; border: 0; outline: none; resize: none; font: inherit; color: var(--text); background: transparent; padding: 1px 0; max-height: 160px; }

@media (max-width: 900px) {
  .run-layout { grid-template-columns: 1fr; grid-template-rows: 1fr 40%; }
  .console { border-left: 0; border-top: 1px solid var(--line); }
}
