/* MarketPulse Dev Sandbox Simulator: 3-column sketchbook theme matching Thinking in Configuration. */
*, *::before, *::after { box-sizing: border-box; }
html, body {
  margin: 0; padding: 0; background: #FAF8F2; color: #0F172A;
  font-family: "IBM Plex Sans", -apple-system, BlinkMacSystemFont, sans-serif;
  line-height: 1.38; overflow-x: hidden;
}
button { font-family: inherit; cursor: pointer; }

.topbar {
  background: #FFFFFF; border-bottom: 2px solid #0F172A; padding: 6px 16px;
  display: flex; flex-direction: row; align-items: center; justify-content: space-between; gap: 10px;
}
.brand-group { display: flex; align-items: center; gap: 10px; }
.topbar-controls { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.brand { display: inline-flex; align-items: center; gap: 8px; font-size: 16.5px; font-weight: 700; letter-spacing: -0.01em; white-space: nowrap; }
.subtitle { font-size: 12.5px; color: #475569; font-weight: 600; }
.step-nav { display: flex; gap: 4px; align-items: center; }

.step-pill, .ctrl-btn, .node-tag, .node-row, .mini-btn, .callout-kicker, .term-box, .yaml-snippet, .gate-badge, .test-pill, .zone-badge, .cmd-code, .cmd-tag, .cmd-prompt, .browser-url, .sb-tab {
  font-family: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
}

.step-pill {
  background: #FFFFFF; color: #0F172A; border: 2px solid #0F172A; border-radius: 4px;
  padding: 3px 7px; font-size: 11px; font-weight: 700; white-space: nowrap;
}
.step-pill:hover { background: #FEF08A; }
.step-pill.done { background: #CCFBF1; border-color: #0F766E; color: #0F766E; }
.step-pill.active { background: #0F172A; border-color: #0F172A; color: #FFFFFF; }

.ctrl-btn {
  background: #FFFFFF; color: #0F172A; border: 2px solid #0F172A; border-radius: 4px;
  padding: 3px 10px; font-size: 12px; font-weight: 700; box-shadow: 2px 2px 0 #0F172A;
}
.ctrl-btn:hover { background: #FAF8F2; }
.ctrl-btn:active { transform: translate(2px, 2px); box-shadow: none; }
.ctrl-btn:disabled { color: #94A3B8; border-color: #94A3B8; box-shadow: none; cursor: default; }

.main-wrap { padding: 6px 16px 4px; display: flex; flex-direction: column; align-items: center; }

.telemetry-bar {
  width: calc(100vw - 32px); max-width: 1720px; margin: 0 auto 8px; padding: 5px 12px;
  background: #FFFFFF; border: 2px solid #0F172A; border-radius: 6px;
  box-shadow: 3px 3px 0 #0F172A;
  display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 10px;
}
.live-pill {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 3px 10px; border-radius: 4px; border: 1.5px solid #0F172A;
  background: #F1F5F9; color: #0F172A; font-family: "IBM Plex Mono", monospace;
  font-size: 12px; font-weight: 600;
}
.live-dot { width: 8px; height: 8px; border-radius: 50%; background: #64748B; display: inline-block; }
.live-pill.live-on { background: #DCFCE7; border-color: #15803D; color: #14532D; }
.live-pill.live-on .live-dot { background: #16A34A; }
.live-pill.live-alert { background: #FEE2E2; border-color: #B91C1C; color: #7F1D1D; }
.live-pill.live-alert .live-dot { background: #DC2626; }

.counters-group { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.counter-chip {
  padding: 2px 9px; background: #FAF8F2; border: 1.5px solid #0F172A; border-radius: 4px;
  font-family: "IBM Plex Mono", monospace; font-size: 12px; font-weight: 500; color: #0F172A;
}
.counter-chip strong { font-weight: 700; color: #1D4ED8; }

.workspace-grid {
  position: relative; width: calc(100vw - 32px); max-width: 1720px; margin: 0 auto;
  display: grid; grid-template-columns: 1.18fr 1.50fr 1.02fr; gap: 14px; align-items: stretch;
}

/* Section 1: Left Terminal + Step Guide */
.left-col {
  position: relative; z-index: 4; height: 676px;
  background: #FEF08A; border: 2px solid #0F172A; border-radius: 6px; box-shadow: 4px 4px 0 #0F172A;
  padding: 12px 13px; display: flex; flex-direction: column; justify-content: space-between; gap: 9px;
}
.left-col.alert { background: #FEE2E2; border-color: #B91C1C; box-shadow: 4px 4px 0 #B91C1C; }
.left-col.alert .callout-kicker { color: #B91C1C; }

.guide-top { display: flex; flex-direction: column; gap: 7px; }
.callout-kicker { font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; color: #B45309; }
.guide-step-dots { display: flex; gap: 5px; align-items: center; }
.guide-dot { height: 5px; flex: 1; border-radius: 999px; background: rgba(15, 23, 42, 0.16); border: 1px solid #0F172A; }
.guide-dot.done { background: #15803D; }
.guide-dot.current { background: #EA580C; }
.callout-title { font-size: 20px; font-weight: 700; color: #0F172A; line-height: 1.18; }
.callout-body { font-size: 14.5px; font-weight: 500; color: #0F172A; line-height: 1.4; }
.guide-box {
  background: #FFFFFF; border: 1.5px solid #0F172A; border-left: 4px solid #1D4ED8;
  border-radius: 4px; padding: 8px 10px; font-size: 13.5px; color: #0F172A; line-height: 1.38;
}
.guide-box.recap { background: #DCFCE7; border-color: #15803D; border-left-width: 4px; }
.guide-label {
  display: block; font-family: "IBM Plex Mono", monospace; font-size: 10.5px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 3px; color: #1D4ED8;
}
.guide-box.recap .guide-label { color: #15803D; }

.term-box {
  background: #0F172A; color: #E2E8F0; border: 2px solid #0F172A; border-radius: 5px;
  padding: 9px 10px; display: flex; flex-direction: column; gap: 6px; flex: 1; min-height: 0; overflow: hidden;
}
.term-head {
  display: flex; align-items: center; justify-content: space-between;
  font-size: 10.5px; color: #94A3B8; border-bottom: 1px solid #334155; padding-bottom: 4px;
}
.term-dots { display: inline-flex; gap: 5px; align-items: center; }
.term-dots span { width: 7px; height: 7px; border-radius: 50%; background: #475569; }
.term-dots span:first-child { background: #EF4444; }
.term-dots span:nth-child(2) { background: #FACC15; }
.term-dots span:nth-child(3) { background: #22C55E; }

.term-entries {
  display: flex; flex-direction: column; justify-content: flex-end; gap: 5px;
  flex: 1; min-height: 0; overflow: hidden; font-size: 11px; line-height: 1.32;
}
.term-entry { display: flex; flex-direction: column; gap: 1.5px; border-left: 2px solid #334155; padding-left: 7px; }
.term-entry.is-done { border-left-color: #334155; opacity: 0.62; }
.term-entry.is-done .term-prompt { color: #94A3B8; font-weight: 500; }
.term-entry.is-done .term-out { color: #64748B; font-size: 10.3px; }
.term-entry.is-latest { border-left-color: #EA580C; }
.term-prompt { color: #FACC15; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.term-claude { color: #38BDF8; font-weight: 600; word-break: break-word; }
.term-cub { color: #CBD5E1; font-size: 10.6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.term-out { color: #86EFAC; font-size: 10.6px; }
.term-out.err { color: #FCA5A5; font-weight: 600; }

.guide-actions { display: flex; flex-direction: column; gap: 6px; padding-top: 38px; }
.guide-actions.no-badge { padding-top: 8px; }
.btn-action {
  background: #0F172A; color: #FFFFFF; border: 2px solid #0F172A; border-radius: 4px;
  padding: 9px 12px; font-size: 14px; font-weight: 700; box-shadow: 2px 2px 0 #64748B; width: 100%; text-align: center;
}
.btn-action.orange { background: #EA580C; box-shadow: 2px 2px 0 #0F172A; }
.btn-action:hover { transform: translate(-1px, -1px); box-shadow: 3px 3px 0 #0F172A; }
.btn-action:active { transform: translate(2px, 2px); box-shadow: none; }
.btn-action.busy { opacity: 0.85; cursor: wait; }
.btn-sec {
  background: #FFFFFF; color: #0F172A; border: 2px solid #0F172A; border-radius: 4px;
  padding: 8px 12px; font-size: 13.5px; font-weight: 700; width: 100%; text-align: center;
}
.btn-sec:hover { background: #FAF8F2; box-shadow: 2px 2px 0 #0F172A; }

/* Section 2: Center Logical Objects Topology */
.stage-canvas {
  position: relative; width: 100%; height: 676px;
  background: #FAF8F2; border: 2px solid #0F172A; border-radius: 6px;
  background-image: radial-gradient(#CBD5E1 1px, transparent 1px); background-size: 20px 20px;
}
.zone-layer { position: absolute; inset: 0; z-index: 1; pointer-events: none; }
#graphSvg { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 2; }
.nodes-layer { position: absolute; inset: 0; z-index: 3; pointer-events: none; }

.zone-box {
  position: absolute; z-index: 1; background: #F8FAFC; border: 2px dashed #475569;
  border-radius: 6px; padding: 6px 10px;
}
.zone-box.zone-local { background: #EFF6FF; border-color: #1E3A8A; }
.zone-box.zone-prod { background: #F0FDFA; border-color: #0F766E; }
.zone-head {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  font-size: 12px; font-weight: 700; color: #0F172A;
}
.zone-box.zone-local .zone-head { color: #1E3A8A; }
.zone-box.zone-prod .zone-head { color: #0F766E; }
.zone-badge {
  background: #0F172A; color: #FFFFFF; font-size: 10px; font-weight: 700;
  border-radius: 999px; padding: 1px 8px; white-space: nowrap;
}
.zone-box.zone-prod .zone-badge { background: #15803D; }

.node {
  position: absolute; z-index: 4; pointer-events: auto; background: #FFFFFF; border: 2px solid #0F172A;
  border-radius: 6px; box-shadow: 3px 3px 0 #0F172A; padding: 5px 7px;
  display: flex; flex-direction: column; gap: 2.5px;
}
.node.clickable { cursor: pointer; }
.node.clickable:hover { transform: translate(-1px, -1px); }
.node.is-selected { outline: 3px solid #EA580C; outline-offset: 2px; }
.node.state-ok { background: #DCFCE7; border-color: #15803D; box-shadow: 3px 3px 0 #15803D; }
.node.state-blue { background: #DBEAFE; border-color: #1D4ED8; box-shadow: 3px 3px 0 #1D4ED8; }
.node.state-teal { background: #CCFBF1; border-color: #0F766E; box-shadow: 3px 3px 0 #0F766E; }
.node.state-red { background: #FEE2E2; border-color: #DC2626; box-shadow: 3px 3px 0 #DC2626; }
.node.state-hub { background: #EFF6FF; border: 2px solid #1E3A8A; box-shadow: 3px 3px 0 #1E3A8A; }
.node.state-hub .node-tag { background: #1E3A8A; color: #FFFFFF; border-color: #1E3A8A; }
.node.node-pulse { animation: nodePop 0.28s ease-out; }
.node.node-enter { animation: nodeEnter 0.24s ease-out; }
.panel-enter { animation: nodeEnter 0.24s ease-out; }
@keyframes nodePop {
  0% { transform: scale(1); }
  45% { transform: scale(1.04); }
  100% { transform: scale(1); }
}
@keyframes nodeEnter {
  0% { opacity: 0; transform: scale(0.94); }
  100% { opacity: 1; transform: scale(1); }
}

.node-head { display: flex; align-items: center; justify-content: space-between; gap: 6px; }
.node-title { font-size: 13px; font-weight: 700; color: #0F172A; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.node-tag {
  font-size: 10.5px; font-weight: 700; color: #0F172A; background: #FFFFFF;
  border: 1.5px solid #0F172A; border-radius: 3px; padding: 1px 5px; white-space: nowrap;
}
.node-rows { display: flex; flex-direction: column; gap: 2.5px; }
.node-row {
  font-size: 11px; color: #0F172A; font-weight: 500; display: flex; justify-content: space-between;
  align-items: center; gap: 6px;
}
.test-strip { display: flex; flex-wrap: nowrap; gap: 3px; margin-top: 1px; }
.test-pill {
  font-size: 9px; font-weight: 700; padding: 1px 3.5px; border-radius: 3px;
  background: #DCFCE7; color: #14532D; border: 1px solid #15803D;
}
.test-pill.fail { background: #DC2626; color: #FFFFFF; border-color: #7F1D1D; }
.test-pill.muted { background: #F1F5F9; color: #64748B; border-color: #94A3B8; }
.gate-badge {
  font-size: 10px; font-weight: 700; padding: 1px 5px; border-radius: 3px; white-space: nowrap;
  background: #15803D; color: #FFFFFF; border: 1px solid #0F172A;
}
.gate-badge.fail { background: #DC2626; border-color: #7F1D1D; }
.gate-badge.blue { background: #1D4ED8; border-color: #0F172A; }

/* Section 3: Right Live Web Page */
.preview-panel {
  position: relative; z-index: 4; height: 676px;
  background: #FFFFFF; border: 2px solid #0F172A; border-radius: 6px; box-shadow: 4px 4px 0 #0F172A;
  padding: 10px 11px; display: flex; flex-direction: column; justify-content: space-between; gap: 8px;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
.preview-panel.push-glow {
  border-color: #15803D; box-shadow: 4px 4px 0 #15803D;
}
.preview-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.preview-kicker {
  font-family: "IBM Plex Mono", monospace; font-size: 11px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.05em; color: #1D4ED8;
}
.browser-bar {
  display: flex; align-items: center; justify-content: space-between; gap: 6px;
  background: #F1F5F9; border: 1.5px solid #0F172A; border-radius: 4px; padding: 4px 8px;
}
.browser-url { font-size: 11.5px; font-weight: 600; color: #0F172A; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.tab-row { display: flex; gap: 5px; }
.sb-tab {
  flex: 1; background: #FFFFFF; color: #0F172A; border: 1.5px solid #0F172A; border-radius: 4px;
  padding: 4px 4px; font-size: 10.5px; font-weight: 700; text-align: center;
}
.sb-tab:disabled { background: #F1F5F9; color: #94A3B8; border-color: #CBD5E1; cursor: default; }
.sb-tab.active { background: #0F172A; color: #FFFFFF; }
.sb-tab.fail { background: #FEE2E2; border-color: #DC2626; color: #991B1B; }
.sb-tab.fail.active { background: #DC2626; color: #FFFFFF; }

.app-viewport {
  flex: 1; min-height: 0; background: #FAF8F2; border: 2px solid #0F172A; border-radius: 5px;
  padding: 9px; display: flex; flex-direction: column; gap: 7px; overflow: hidden;
}
.app-viewport.is-prod { background: #F0FDFA; border-color: #0F766E; }
.app-empty {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center; gap: 6px; color: #475569; font-size: 13px; padding: 14px;
  border: 2px dashed #CBD5E1; border-radius: 4px; background: #FFFFFF;
}
.mp-top {
  display: flex; align-items: center; justify-content: space-between;
  background: #0F172A; color: #FFFFFF; border-radius: 4px; padding: 6px 9px;
}
.mp-logo { font-size: 13px; font-weight: 700; letter-spacing: -0.01em; }
.mp-bal { font-family: "IBM Plex Mono", monospace; font-size: 12px; font-weight: 700; color: #86EFAC; }

.mp-ticker {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px;
}
.mp-tick-chip {
  background: #FFFFFF; border: 1.5px solid #0F172A; border-radius: 3px; padding: 3px 4px;
  font-family: "IBM Plex Mono", monospace; font-size: 10px; font-weight: 700; text-align: center;
}
.mp-tick-chip span { display: block; color: #15803D; font-size: 9.5px; }

.mp-card {
  background: #FFFFFF; border: 1.5px solid #0F172A; border-radius: 4px; padding: 6px 8px;
  display: flex; flex-direction: column; gap: 4px;
}
.mp-card-title { font-size: 11px; font-weight: 700; color: #334155; display: flex; justify-content: space-between; align-items: center; }
.mp-watch-row {
  display: flex; justify-content: space-between; font-family: "IBM Plex Mono", monospace;
  font-size: 11px; font-weight: 600; border-top: 1px solid #E2E8F0; padding-top: 2px;
}
.mp-up { color: #15803D; }

.mp-heatmap { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; }
.mp-hm-cell {
  border: 1.5px solid #0F172A; border-radius: 3px; padding: 4px 6px;
  font-family: "IBM Plex Mono", monospace; font-size: 10.5px; font-weight: 700;
  display: flex; justify-content: space-between; background: #DCFCE7; color: #14532D;
}
.mp-hm-cell.neg { background: #FEE2E2; color: #7F1D1D; }

.mp-alerts { display: flex; flex-direction: column; gap: 3px; font-size: 11px; }
.mp-alert-item {
  background: #EFF6FF; border-left: 3px solid #1D4ED8; padding: 3px 6px; border-radius: 2px;
  font-weight: 500; color: #0F172A;
}

.mp-gate-block {
  background: #FEE2E2; border: 2px solid #DC2626; border-radius: 4px; padding: 7px 8px;
  font-size: 11.5px; color: #7F1D1D; font-weight: 600; line-height: 1.35;
}
.mp-gate-block strong { display: block; font-family: "IBM Plex Mono", monospace; font-size: 11px; color: #B91C1C; margin-bottom: 2px; }

.yaml-box {
  background: #0F172A; color: #F8FAFC; border: 2px solid #0F172A; border-radius: 5px;
  padding: 7px 9px;
}
.yaml-head {
  display: flex; justify-content: space-between; align-items: center;
  font-family: "IBM Plex Mono", monospace; font-size: 10.5px; font-weight: 700; color: #94A3B8; margin-bottom: 4px;
}
.yaml-snippet { margin: 0; font-size: 11px; line-height: 1.35; color: #E2E8F0; white-space: pre; overflow: hidden; }

/* Click pointer overlay */
.click-float-layer { position: absolute; inset: 0; z-index: 8; pointer-events: none; }
#bridgeSvg, #clickArrowSvg { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.click-badge {
  position: absolute; background: #EA580C; color: #FFFFFF;
  border: 2px solid #0F172A; box-shadow: 3px 3px 0 #0F172A;
  border-radius: 4px; padding: 3px 9px; font-family: "IBM Plex Sans", sans-serif;
  font-weight: 700; font-size: 12px; line-height: 1.1; white-space: nowrap;
  animation: clickBob 1.1s ease-in-out infinite;
}
@keyframes clickBob {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-4px); }
}

.confetti-layer { position: absolute; inset: 0; z-index: 6; pointer-events: none; overflow: hidden; }
.confetti-piece {
  position: absolute; width: 8px; height: 8px; border: 1.5px solid #0F172A;
  border-radius: 2px; animation: confettiDrop 1.4s ease-out forwards;
}
@keyframes confettiDrop {
  0% { transform: translate(0, 0) rotate(0deg); opacity: 1; }
  100% { transform: translate(var(--dx, 0px), var(--dy, 120px)) rotate(260deg); opacity: 0; }
}
@media (prefers-reduced-motion: reduce) {
  .click-badge, .confetti-piece { animation: none; }
}

/* Bottom CLI strip */
.cmd-bar {
  width: calc(100vw - 32px); max-width: 1720px; margin: 8px auto 0; padding: 6px 12px;
  background: #0F172A; color: #F8FAFC; border: 2px solid #0F172A; border-radius: 6px;
  box-shadow: 3px 3px 0 #475569; display: flex; align-items: center; justify-content: space-between; gap: 12px;
  transition: border-color 0.2s ease;
}
.cmd-bar.cmd-flash { border-color: #EA580C; }
.cmd-left { display: flex; align-items: center; gap: 9px; min-width: 0; flex: 1; }
.cmd-tag { background: #1D4ED8; color: #FFFFFF; font-size: 11px; font-weight: 700; padding: 2px 6px; border-radius: 3px; flex-shrink: 0; }
.cmd-prompt { color: #FACC15; font-size: 13px; font-weight: 700; flex-shrink: 0; }
.cmd-code { font-size: 12.5px; font-weight: 500; color: #F8FAFC; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cmd-copy {
  background: #FFFFFF; color: #0F172A; border: 1.5px solid #0F172A; border-radius: 4px;
  padding: 3px 10px; font-size: 12px; font-weight: 700; flex-shrink: 0;
}
.cmd-copy:hover { background: #EA580C; color: #FFFFFF; }

.site-footer {
  display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 16px;
  padding: 5px 16px 8px; font-size: 11.5px; color: #475569; width: calc(100vw - 32px); max-width: 1720px; margin: 0 auto;
}
.footer-links { display: flex; gap: 16px; flex-wrap: wrap; }
.site-footer a { color: #0F172A; font-weight: 700; text-decoration: underline; text-underline-offset: 2px; }
.site-footer a:hover { color: #EA580C; }

@media (max-width: 1180px) {
  .topbar { flex-wrap: wrap; }
  .workspace-grid { grid-template-columns: 1fr; }
  .left-col, .preview-panel { height: auto; }
  .stage-canvas { height: auto; padding: 12px; display: flex; flex-direction: column; gap: 10px; }
  #graphSvg, .click-float-layer, .confetti-layer { display: none; }
  .cmd-code { white-space: normal; word-break: break-word; }
  .zone-layer, .nodes-layer { display: contents; }
  .node, .zone-box {
    position: static !important; width: 100% !important; height: auto !important; transform: none;
  }
  .zone-box { display: flex; flex-direction: column; gap: 8px; }
}
@media (max-width: 640px) {
  .topbar { padding: 8px 12px; }
  .subtitle { display: none; }
  .step-nav { display: grid; grid-template-columns: repeat(4, 1fr); width: 100%; }
  .step-pill { text-align: center; padding: 5px 4px; }
  .main-wrap { padding: 8px 10px; }
}
