/* ════════════════════════════════════════════════
   COOTIE CATCHER + FLOWCHART — scopeado a .auto-demo
   Portado de style2.css: mismas reglas, sin los resets globales,
   y el flowchart con la paleta MGZ. El papel del juego (amarillo)
   se queda como está: es el objeto, no la interfaz.
   ════════════════════════════════════════════════ */
.auto-demo {
  --cc-bg: var(--piedra-clara);
  --cc-line: var(--vino-tinta);
  --cc-pick: var(--cherry);
  --cc-text: var(--gris-profundo);
  --cc-scan: var(--papel);

  display: grid;
  grid-template-columns: 1fr 1fr;
  height: 620px;
  background: var(--cc-bg);
  border-radius: 24px;
  border: 1px solid var(--line);
  overflow: hidden;
  color: var(--cc-text);
  font: 500 16px var(--font);
}

.auto-demo .stage {
  position: relative;
  overflow: hidden;
}

.auto-demo .stage canvas {
  position: absolute;
  inset: 0;
  display: block;
  touch-action: none;
  cursor: grab;
}

.auto-demo .stage canvas:active {
  cursor: grabbing;
}

.auto-demo .chart {
  height: 100%;
  overflow: hidden auto;
  scrollbar-width: none;
  border-left: 1px solid var(--line);
}

.auto-demo .chart::-webkit-scrollbar {
  display: none;
}

.auto-demo .board {
  position: relative;
  min-height: 100%;
  padding: clamp(18px, 3.5vh, 40px) clamp(14px, 3vw, 40px) 48px;
}

.auto-demo .wires {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
  pointer-events: none;
  transition: opacity 0.4s;
}

.auto-demo .wire {
  fill: none;
  stroke: var(--cc-line);
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-dasharray: 1;
  stroke-dashoffset: 1;
  opacity: 0.6;
  transition: stroke-dashoffset 0.45s, opacity 0.3s, stroke-width 0.2s;
}

.auto-demo .wire.in {
  stroke-dashoffset: 0;
}

.auto-demo .wire.on {
  stroke-width: 2.5;
  opacity: 1;
}

.auto-demo .wire.off {
  opacity: 0.2;
}

.auto-demo .tree {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: clamp(20px, 3.6vh, 36px);
  transition: opacity 0.4s;
}

.auto-demo .tree.out,
.auto-demo .wires.out {
  opacity: 0;
}

.auto-demo .row {
  display: flex;
  justify-content: center;
  gap: clamp(8px, 1.2vw, 14px);
  width: 100%;
}

.auto-demo .node,
.auto-demo .chip,
.auto-demo .pip {
  border: 1.5px solid var(--cc-line);
  border-radius: 50px;
  color: var(--cc-line);
  text-transform: uppercase;
  font-family: var(--font-mono);
  letter-spacing: 0.04em;
}

.auto-demo .node,
.auto-demo .chip {
  background: var(--cc-bg);
  opacity: 0;
  translate: 0 10px;
  transition: opacity 0.3s, translate 0.3s, background-color 0.15s, color 0.15s;
}

.auto-demo .node.in,
.auto-demo .chip.in {
  opacity: 1;
  translate: 0 0;
}

.auto-demo .node {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.35em;
  max-width: 92%;
  padding: 0.6em 1.4em;
  font-size: clamp(13px, 1.1vw, 15px);
  text-align: center;
}

.auto-demo .node.bare {
  padding: 0.5em 0.8em;
}

.auto-demo .node.start,
.auto-demo .chip.pick {
  background: var(--cc-line);
  color: var(--piedra-clara);
}

.auto-demo .node.fortune {
  padding: 0.8em 1.8em;
  border-color: var(--cc-pick);
  background: var(--cc-pick);
  color: var(--blanco-calido);
  font-family: var(--font-title);
  font-weight: 500;
  letter-spacing: 0.01em;
  font-size: clamp(20px, 1.8vw, 24px);
  line-height: 1.1;
  text-transform: none;
}

.auto-demo .chip {
  display: flex;
  align-items: center;
  gap: 0.45em;
  padding: 0.4em 0.95em;
  font-size: clamp(11px, 0.95vw, 13px);
}

.auto-demo .chip i {
  width: 0.7em;
  height: 0.7em;
  border-radius: 50%;
}

.auto-demo .chip.scan {
  background: var(--cc-scan);
}

.auto-demo .chip.off {
  opacity: 0.3;
}

.auto-demo .pips {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 5px;
}

.auto-demo .pip {
  display: grid;
  place-items: center;
  min-width: 1.7em;
  height: 1.7em;
  padding: 0 0.3em;
  font-size: 0.78em;
  transition: background-color 0.12s, color 0.12s, border-color 0.12s;
}

.auto-demo .pip.on {
  border-color: var(--cc-pick);
  background: var(--cc-pick);
  color: var(--blanco-calido);
}

@media (max-width: 760px) {
  .auto-demo {
    grid-template-columns: 1fr;
    grid-template-rows: 320px 1fr;
    height: 700px;
  }

  .auto-demo .chart {
    border-left: 0;
    border-top: 1px solid var(--line);
  }
}
