/* Thinking in Configuration: crisp sketchbook stylesheet. Only gradient: the specified dot grid. */
*, *::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.4; 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: 12px;
}
.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: 17px; font-weight: 700; letter-spacing: -0.01em; white-space: nowrap; }
.subtitle { font-size: 12.5px; color: #475569; font-weight: 500; }
.chapter-nav { display: flex; gap: 6px; align-items: center; }
.ch-pill, .ctrl-btn, .node-tag, .node-row, .mini-btn, .callout-kicker, .yaml-pre, .override-pin, .zero-cred {
  font-family: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
}
.ch-pill {
  background: #FFFFFF; color: #0F172A; border: 2px solid #0F172A; border-radius: 4px;
  padding: 4px 10px; font-size: 12px; font-weight: 700; white-space: nowrap;
}
.ch-pill:hover { background: #FEF08A; }
.ch-pill.done { background: #CCFBF1; border-color: #0F766E; color: #0F766E; }
.ch-pill.active { background: #0F172A; border-color: #0F172A; color: #FFFFFF; }
.ctrl-btn {
  background: #FFFFFF; color: #0F172A; border: 2px solid #0F172A; border-radius: 4px;
  padding: 4px 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: 0 0 0 #0F172A; }
.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: 1280px; max-width: 100%; margin: 0 auto 6px; padding: 4px 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: 3px 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; }
.stage-canvas {
  position: relative; width: 1280px; max-width: 100%; height: 500px; margin: 0 auto;
  background: #FAF8F2; border: 2px solid #0F172A; border-radius: 6px;
  background-image: radial-gradient(#CBD5E1 1px, transparent 1px); background-size: 20px 20px;
}
#graphSvg { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 2; }
.vpc-layer { position: absolute; inset: 0; z-index: 1; pointer-events: none; }
.nodes-layer { position: absolute; inset: 0; z-index: 3; pointer-events: none; }

.node {
  position: absolute; z-index: 4; pointer-events: auto; background: #FFFFFF; border: 2.5px solid #0F172A;
  border-radius: 6px; box-shadow: 4px 4px 0 #0F172A; padding: 10px 12px;
  display: flex; flex-direction: column; gap: 6px; opacity: 1;
}
.node.state-ok { background: #DCFCE7; border-color: #15803D; box-shadow: 4px 4px 0 #15803D; }
.node.state-blue { background: #DBEAFE; border-color: #1D4ED8; box-shadow: 4px 4px 0 #1D4ED8; }
.node.state-teal { background: #CCFBF1; border-color: #0F766E; box-shadow: 4px 4px 0 #0F766E; }
.node.state-red { background: #FEE2E2; border-color: #DC2626; box-shadow: 4px 4px 0 #DC2626; }
.node.state-amber { background: #FEF3C7; border-color: #B45309; box-shadow: 4px 4px 0 #B45309; }
.node.is-target { outline: 3px solid #EA580C; outline-offset: 2px; }
.node-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.node-title { font-size: 16px; font-weight: 700; color: #0F172A; }
.node-tag {
  font-size: 11.5px; font-weight: 700; color: #0F172A; background: #FFFFFF;
  border: 1.5px solid #0F172A; border-radius: 3px; padding: 1px 6px; white-space: nowrap;
}
.node-rows { display: flex; flex-direction: column; gap: 5px; }
.node-row {
  font-size: 13px; color: #1E293B; display: flex; justify-content: space-between;
  align-items: center; gap: 10px;
}
.override-pin {
  background: #1D4ED8; color: #FFFFFF; font-size: 10.5px; font-weight: 700;
  letter-spacing: 0.04em; border-radius: 999px; padding: 1px 7px;
}
.mini-btn {
  background: #FFFFFF; color: #0F172A; border: 1.5px solid #0F172A; border-radius: 4px;
  min-width: 24px; padding: 1px 7px; font-size: 12.5px; font-weight: 700; line-height: 1.3;
  box-shadow: 1.5px 1.5px 0 #0F172A;
}
.mini-btn:hover, .mini-btn.orange { background: #EA580C; color: #FFFFFF; }
.mini-btn:active { transform: translate(1.5px, 1.5px); box-shadow: 0 0 0 #0F172A; }
.node-pulse { animation: nodePop 0.28s ease-out; }
@keyframes nodePop {
  0% { transform: scale(1); }
  45% { transform: scale(1.05); }
  100% { transform: scale(1); }
}

.vpc-zone {
  position: absolute; z-index: 1; background: #F0FDFA; border: 2.5px dashed #0F766E;
  border-radius: 6px; padding: 8px 10px;
}
.vpc-head {
  display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 700; color: #0F766E;
}
.zero-cred {
  background: #15803D; color: #FFFFFF; font-size: 10.5px; font-weight: 700;
  border-radius: 999px; padding: 1px 8px; white-space: nowrap;
}
.guard-shield {
  background: #FFFFFF; border: 3.5px solid #0F172A; border-radius: 8px 8px 28px 28px;
  box-shadow: 4px 4px 0 #0F172A; padding: 10px 14px 18px; text-align: center; font-weight: 700;
}
.guard-shield.state-ok { border-color: #15803D; box-shadow: 4px 4px 0 #15803D; }
.guard-shield.state-red { border-color: #DC2626; box-shadow: 4px 4px 0 #DC2626; }

.callout-box {
  position: absolute; z-index: 4; pointer-events: auto; background: #FEF08A;
  border: 2.5px solid #0F172A; border-radius: 6px; box-shadow: 5px 5px 0 #0F172A;
  padding: 14px 16px; display: flex; flex-direction: column; gap: 8px;
}
.callout-box.alert { background: #FEE2E2; border-color: #B91C1C; box-shadow: 5px 5px 0 #B91C1C; }
.callout-kicker {
  font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; color: #B45309;
}
.callout-box.alert .callout-kicker { color: #B91C1C; }
.callout-title { font-size: 16.5px; font-weight: 700; color: #0F172A; line-height: 1.25; }
.callout-body { font-size: 13.5px; color: #1E293B; }
.callout-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 2px; }
.btn-action {
  background: #0F172A; color: #FFFFFF; border: 2px solid #0F172A; border-radius: 4px;
  padding: 6px 12px; font-size: 13px; font-weight: 700; box-shadow: 2px 2px 0 #64748B;
}
.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: 0 0 0 #0F172A; }
.btn-sec {
  background: #FFFFFF; color: #0F172A; border: 2px solid #0F172A; border-radius: 4px;
  padding: 6px 12px; font-size: 12.5px; font-weight: 700;
}
.btn-sec:hover { background: #FAF8F2; box-shadow: 2px 2px 0 #0F172A; }
.btn-sec:active { transform: translate(2px, 2px); box-shadow: none; }

.sandbox-bar {
  display: none; width: 1280px; max-width: 100%; margin: 8px auto 0; background: #FFFFFF;
  border: 2px solid #0F172A; border-radius: 6px; padding: 6px 10px;
  align-items: center; flex-wrap: wrap; gap: 8px; font-size: 12.5px; font-weight: 700;
}
.sandbox-bar.show, body[data-chapter="6"] .sandbox-bar { display: flex; }

.site-footer {
  display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 16px;
  padding: 4px 16px 8px; font-size: 12px; color: #475569; max-width: 1320px; 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; }

.modal-backdrop {
  position: fixed; inset: 0; z-index: 50; background: rgba(15, 23, 42, 0.72);
  display: none; align-items: center; justify-content: center; padding: 20px;
}
.modal-backdrop.open { display: flex; }
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; border-bottom: 2px solid #E2E8F0; padding-bottom: 8px; }
.modal-card {
  background: #FFFFFF; border: 2.5px solid #0F172A; border-radius: 6px; box-shadow: 6px 6px 0 #EA580C;
  width: 640px; max-width: 100%; padding: 18px 20px; overflow: visible;
  display: flex; flex-direction: column; gap: 10px;
}
.yaml-pre {
  margin: 0; background: #0F172A; color: #F8FAFC; border-radius: 4px; padding: 12px 14px;
  font-size: 12.5px; line-height: 1.45; white-space: pre-wrap; word-break: break-word; overflow: visible;
}

.node.ghost-slot {
  background: #FAF8F2; border: 2.5px dashed #475569; box-shadow: none;
}
.btn-action.busy { opacity: 0.85; cursor: wait; }
.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; }
}
.click-float-layer {
  position: absolute; inset: 0; z-index: 7; pointer-events: none;
}
#clickArrowSvg { position: absolute; inset: 0; width: 100%; height: 100%; }
.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); }
}
@media (prefers-reduced-motion: reduce) {
  .click-badge, .confetti-piece { animation: none; }
}
.callout-box { z-index: 5; }
.callout-list {
  margin: 0; padding-left: 16px; display: flex; flex-direction: column; gap: 4px;
  font-size: 12.5px; color: #0F172A; font-weight: 500;
}
.btn-full { width: 100%; white-space: nowrap; text-align: center; }
.cmd-bar {
  width: 1280px; max-width: 100%; margin: 6px auto 0; padding: 7px 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-family: "IBM Plex Mono", monospace;
  font-size: 11px; font-weight: 700; padding: 2px 6px; border-radius: 3px; flex-shrink: 0;
}
.cmd-prompt {
  color: #FACC15; font-family: "IBM Plex Mono", monospace; font-size: 13px; font-weight: 700; flex-shrink: 0;
}
.cmd-code {
  font-family: "IBM Plex Mono", monospace; font-size: 13px; 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; cursor: pointer;
}
.cmd-copy:hover { background: #EA580C; color: #FFFFFF; }

@media (max-width: 1024px) {
  .topbar { flex-wrap: wrap; }
  .stage-canvas { height: auto; padding: 12px; display: flex; flex-direction: column; gap: 12px; }
  #graphSvg, .click-float-layer, .confetti-layer { display: none; }
  .cmd-code { white-space: normal; word-break: break-word; }
  .vpc-layer, .nodes-layer { display: contents; }
  .node, .vpc-zone, .callout-box, .guard-shield {
    position: static !important; width: 100% !important; height: auto !important; transform: none;
  }
  .callout-box { order: -1; }
  .vpc-zone { display: flex; flex-direction: column; gap: 10px; }
}
@media (max-width: 640px) {
  .topbar { padding: 8px 12px; }
  .subtitle { display: none; }
  .chapter-nav { display: grid; grid-template-columns: repeat(3, 1fr); width: 100%; }
  .ch-pill { text-align: center; padding: 6px 4px; }
  .main-wrap { padding: 10px 12px 8px; }
  .modal-card { padding: 14px; }
}
