/* Prototype page — SaaS refresh */

body.proto {
  overflow-x: hidden;
}

.proto-nav-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-top: 24px;
}
.back-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  border-radius: 999px;
  background: #fff;
  border: 1px solid var(--rule);
  font-size: 13px;
  color: var(--ink-2);
  font-weight: 500;
}
.back-link:hover { color: var(--teal-ink); border-color: var(--teal); }

.co-switch {
  display: flex;
  gap: 6px;
  padding: 5px;
  background: #fff;
  border: 1px solid var(--rule);
  border-radius: 999px;
  box-shadow: var(--shadow-sm);
}
.co-switch button {
  border: 0;
  background: transparent;
  font-family: var(--sans);
  font-size: 13px;
  color: var(--ink-3);
  padding: 8px 16px;
  border-radius: 999px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: all .2s;
}
.co-switch button .lg {
  width: 18px; height: 18px; border-radius: 5px;
  display: grid; place-items: center;
  color: #fff; font-size: 10px; font-weight: 800;
}
.co-switch button.active {
  background: var(--grad);
  color: #fff;
  box-shadow: 0 4px 12px rgba(27,169,201,0.3);
}
.co-switch button.active .lg {
  background: rgba(255,255,255,0.22) !important;
}

.proto-header {
  padding: 36px 0 24px;
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 40px;
  align-items: end;
}
.proto-header h1 {
  font-size: clamp(40px, 5vw, 64px);
  font-weight: 800;
  line-height: 1.02;
  letter-spacing: -0.035em;
  margin: 14px 0 0;
  color: var(--ink);
}
.proto-header h1 em {
  font-style: normal;
  background: var(--grad);
  -webkit-background-clip: text; background-clip: text;
  color: transparent;
}
.proto-header .sub {
  font-size: 15.5px;
  color: var(--ink-3);
  line-height: 1.5;
  max-width: 44ch;
  margin: 0 0 8px;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--teal-ink);
  font-weight: 600;
}
.eyebrow .dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--teal);
  box-shadow: 0 0 0 3px rgba(27,169,201,0.2);
  animation: pulse 1.6s infinite;
}

.run-controls {
  margin-top: 22px;
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}
.run-controls .btn-play {
  background: var(--grad);
  color: #fff;
  border: 0;
  padding: 11px 20px;
  border-radius: 999px;
  font-weight: 600;
  font-size: 13.5px;
  box-shadow: 0 8px 20px rgba(27,169,201,0.28);
}
.run-controls .btn-step {
  padding: 11px 18px;
  border-radius: 999px;
  background: #fff;
  border: 1px solid var(--rule-2);
  color: var(--ink-2);
  font-weight: 600;
  font-size: 13.5px;
}
.run-controls .progress-wrap {
  flex: 1;
  min-width: 220px;
  display: flex;
  align-items: center;
  gap: 12px;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--ink-3);
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
.run-controls .bar {
  flex: 1;
  height: 6px;
  background: var(--bg-2);
  border-radius: 999px;
  position: relative;
  overflow: hidden;
}
.run-controls .bar .fill {
  position: absolute; left: 0; top: 0; bottom: 0;
  background: var(--grad);
  width: 0%;
  border-radius: 999px;
  transition: width .6s cubic-bezier(.4,.1,.2,1);
}

/* ---- Stage rail ---- */
.pipeline { padding: 36px 0 64px; }

.stage-rail {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 10px;
  margin-bottom: 20px;
}
.stage-chip {
  background: #fff;
  border: 1px solid var(--rule);
  border-radius: 14px;
  padding: 14px 18px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  position: relative;
  cursor: pointer;
  transition: all .2s;
}
.stage-chip .n {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--ink-4);
  letter-spacing: 0.14em;
  font-weight: 600;
}
.stage-chip .t {
  font-size: 17px;
  font-weight: 800;
  color: var(--ink-2);
  letter-spacing: -0.02em;
  transition: color .3s;
}
.stage-chip.done {
  border-color: var(--mint);
  background: linear-gradient(180deg, rgba(78,208,184,0.08), rgba(78,208,184,0.02));
}
.stage-chip.done .t { color: var(--teal-ink); }
.stage-chip.done::after {
  content: '✓';
  position: absolute;
  right: 14px;
  top: 14px;
  font-size: 12px;
  color: #fff;
  background: var(--green);
  width: 18px; height: 18px;
  border-radius: 50%;
  display: grid; place-items: center;
  font-weight: 700;
}
.stage-chip.active {
  border-color: var(--teal);
  box-shadow: 0 8px 24px rgba(27,169,201,0.2);
  background: #fff;
}
.stage-chip.active .t {
  background: var(--grad);
  -webkit-background-clip: text; background-clip: text;
  color: transparent;
}
.stage-chip.active::before {
  content: '';
  position: absolute;
  left: 12px; right: 12px; bottom: 6px;
  height: 3px;
  background: var(--grad);
  border-radius: 999px;
  animation: barFlow 2s linear infinite;
}
@keyframes barFlow {
  0% { opacity: 0.3; } 50% { opacity: 1; } 100% { opacity: 0.3; }
}

/* ---- Board ---- */
.board {
  background: #fff;
  border: 1px solid var(--rule);
  border-radius: 24px;
  min-height: 680px;
  display: grid;
  grid-template-rows: auto 1fr;
  overflow: hidden;
  box-shadow: var(--shadow-md);
}
.board-head {
  padding: 16px 24px;
  border-bottom: 1px solid var(--rule);
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--ink-3);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  background: linear-gradient(180deg, #fff, #FAFCFD);
  font-weight: 600;
}
.board-head .live-dot {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--green);
  font-weight: 700;
}
.board-head .live-dot::before {
  content: '';
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--green);
  animation: blink 1.4s ease-in-out infinite;
}
@keyframes blink { 0%,100% { opacity: 1; } 50% { opacity: 0.3; } }

.board-body {
  padding: 28px 32px;
  position: relative;
  background: var(--bg);
}

/* ======= STAGE 1 — INGEST ======= */
.ingest-grid {
  display: grid;
  grid-template-columns: 240px 1fr 240px;
  gap: 20px;
  min-height: 560px;
}
.col-card {
  background: #fff;
  border: 1px solid var(--rule);
  border-radius: 16px;
  padding: 20px;
}
.col-card h4 {
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--teal-ink);
  margin: 0 0 14px;
  font-weight: 600;
}
.source-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.source-list li {
  padding: 9px 12px;
  font-size: 13px;
  display: flex;
  align-items: center;
  gap: 10px;
  border-radius: 10px;
  color: var(--ink-3);
  transition: all .3s;
  font-weight: 500;
}
.source-list li .sdot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--ink-4);
  flex-shrink: 0;
}
.source-list li.active {
  background: var(--teal-soft);
  color: var(--teal-ink);
  font-weight: 600;
}
.source-list li.active .sdot {
  background: var(--teal);
  box-shadow: 0 0 0 3px rgba(27,169,201,0.18);
}
.source-list li .sc {
  margin-left: auto;
  color: var(--ink-4);
  font-family: var(--mono);
  font-size: 11px;
}
.source-list li.active .sc { color: var(--teal-ink); font-weight: 600; }

.stream-col { position: relative; overflow: hidden; }
.stream {
  display: flex;
  flex-direction: column-reverse;
  gap: 8px;
  height: 520px;
  overflow: hidden;
  position: relative;
  padding-top: 20px;
}
.stream::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0; height: 40px;
  background: linear-gradient(to bottom, var(--bg), transparent);
  z-index: 2;
  pointer-events: none;
}
.sig {
  display: grid;
  grid-template-columns: 74px 56px 1fr auto;
  gap: 12px;
  align-items: center;
  padding: 10px 14px;
  background: #fff;
  border: 1px solid var(--rule);
  border-radius: 12px;
  font-size: 12.5px;
  box-shadow: var(--shadow-sm);
  animation: sigIn .5s ease;
}
@keyframes sigIn {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: translateY(0); }
}
.sig .src {
  font-family: var(--mono);
  font-size: 9.5px;
  letter-spacing: 0.12em;
  color: var(--ink-2);
  padding: 4px 8px;
  border-radius: 6px;
  background: var(--bg);
  text-align: center;
  font-weight: 700;
}
.sig .sent {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  font-weight: 700;
}
.sig .sent.neg { color: var(--coral); }
.sig .sent.pos { color: var(--green); }
.sig .sent.neu { color: var(--ink-4); }
.sig .body { color: var(--ink-2); line-height: 1.35; }
.sig .time { font-family: var(--mono); font-size: 10.5px; color: var(--ink-4); }

.count-card .counter {
  font-size: 56px;
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1;
  background: var(--grad);
  -webkit-background-clip: text; background-clip: text;
  color: transparent;
}
.count-card .counter small {
  font-size: 12px;
  font-family: var(--mono);
  color: var(--ink-4);
  margin-left: 6px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  -webkit-text-fill-color: var(--ink-4);
}
.count-card .counter-sub {
  margin-top: 10px;
  font-size: 11.5px;
  color: var(--ink-3);
  font-family: var(--mono);
  letter-spacing: 0.08em;
}
.mini-stats {
  margin-top: 24px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  border-top: 1px dashed var(--rule);
  padding-top: 16px;
}
.mini-stats .row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
}
.mini-stats .k {
  font-family: var(--mono);
  color: var(--ink-4);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-size: 10px;
  font-weight: 600;
}
.mini-stats .v {
  font-size: 17px;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--ink);
}

/* ======= STAGE 2 — CLUSTER ======= */
.cluster-stage {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 18px;
  min-height: 560px;
}
.galaxy {
  position: relative;
  background: #fff;
  border: 1px solid var(--rule);
  border-radius: 16px;
  overflow: hidden;
}
.galaxy svg { width: 100%; height: 100%; display: block; }
.cluster-side {
  background: #fff;
  border: 1px solid var(--rule);
  border-radius: 16px;
  padding: 20px;
}
.cluster-side h4 {
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--teal-ink);
  margin: 0 0 14px;
  font-weight: 600;
}
.epic-list { display: flex; flex-direction: column; gap: 8px; }
.epic-item {
  padding: 12px 14px;
  background: var(--bg);
  border: 1px solid var(--rule);
  border-radius: 10px;
  transition: all .3s;
  opacity: 0;
  transform: translateY(8px);
}
.epic-item.visible { opacity: 1; transform: none; }
.epic-item.top {
  background: var(--mint-soft);
  border-color: var(--mint);
}
.epic-item .etitle {
  font-size: 13.5px;
  font-weight: 700;
  line-height: 1.3;
  letter-spacing: -0.01em;
  margin-bottom: 6px;
  color: var(--ink);
}
.epic-item .emeta {
  display: flex;
  justify-content: space-between;
  font-family: var(--mono);
  font-size: 10px;
  color: var(--ink-4);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-weight: 600;
}
.epic-item.top .emeta .score { color: var(--teal-ink); }
.epic-item .emeta .score { color: var(--teal); font-weight: 700; }

/* ======= STAGE 3 — SCORE ======= */
.score-stage {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 18px;
  min-height: 560px;
}
.score-left {
  background: #fff;
  border: 1px solid var(--rule);
  border-radius: 16px;
  padding: 28px;
}
.score-left .k {
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--teal-ink);
  font-weight: 600;
  margin-bottom: 8px;
}
.score-left h3 {
  font-size: 26px;
  font-weight: 800;
  line-height: 1.15;
  letter-spacing: -0.025em;
  margin: 0 0 8px;
}
.score-left .e-desc {
  color: var(--ink-3);
  font-size: 14px;
  line-height: 1.55;
  max-width: 46ch;
  margin: 0 0 24px;
}
.rice-bars { display: flex; flex-direction: column; gap: 16px; }
.rice-bar {
  display: grid;
  grid-template-columns: 100px 1fr 44px;
  gap: 14px;
  align-items: center;
}
.rice-bar .lab {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-2);
  font-weight: 600;
}
.rice-bar .track {
  height: 10px;
  background: var(--bg);
  border: 1px solid var(--rule);
  border-radius: 999px;
  overflow: hidden;
  position: relative;
}
.rice-bar .trackfill {
  position: absolute; top: 0; bottom: 0; left: 0;
  width: 0;
  background: var(--grad);
  border-radius: 999px;
  transition: width 1.2s cubic-bezier(.4,.1,.2,1);
}
.rice-bar.accent .trackfill { background: linear-gradient(90deg, var(--coral), var(--lemon)); }
.rice-bar .val {
  font-size: 19px;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--ink);
  text-align: right;
}

.big-score {
  background: var(--grad-soft);
  border: 1px solid var(--rule);
  border-radius: 16px;
  padding: 28px 28px 28px;
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
}
.big-score::after {
  content: '';
  position: absolute;
  inset: -50% -30% auto auto;
  width: 280px; height: 280px;
  background: radial-gradient(closest-side, rgba(78,208,184,0.25), transparent 70%);
}
.big-score .t {
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--teal-ink);
  font-weight: 600;
}
.big-score .num {
  font-size: 86px;
  font-weight: 800;
  line-height: 0.95;
  letter-spacing: -0.04em;
  margin: 14px 0 6px;
  background: var(--grad);
  -webkit-background-clip: text; background-clip: text;
  color: transparent;
  position: relative;
  z-index: 1;
}
.big-score .num em {
  font-size: 22px;
  font-style: normal;
  color: var(--ink-3);
  -webkit-text-fill-color: var(--ink-3);
  margin-left: 4px;
}
.big-score .band {
  height: 8px;
  background: rgba(255,255,255,0.7);
  margin: 8px 0 18px;
  position: relative;
  border-radius: 999px;
  overflow: hidden;
}
.big-score .band::after {
  content: '';
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 0;
  background: var(--grad);
  border-radius: 999px;
  transition: width 1.6s cubic-bezier(.4,.1,.2,1);
}
.big-score .band.filled::after { width: var(--w); }
.big-score .verdict {
  font-size: 16px;
  line-height: 1.35;
  font-weight: 700;
  color: var(--ink);
  max-width: 28ch;
  margin: 0;
  letter-spacing: -0.01em;
  position: relative;
  z-index: 1;
}
.big-score .ex {
  margin-top: 14px;
  font-size: 12.5px;
  color: var(--ink-3);
  line-height: 1.5;
  position: relative;
  z-index: 1;
}

/* ======= STAGE 4 — RECOMMEND ======= */
.rec-stage {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 18px;
  min-height: 560px;
}
.rec-card {
  background: #fff;
  border: 1px solid var(--rule);
  border-radius: 16px;
  padding: 28px 32px 30px;
  position: relative;
  overflow: hidden;
}
.rec-card .sticker {
  position: absolute;
  top: 14px; right: 14px;
  padding: 6px 12px;
  background: var(--grad);
  color: #fff;
  border-radius: 999px;
  font-size: 10.5px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-weight: 700;
}
.rec-card .kicker {
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--teal-ink);
  font-weight: 600;
}
.rec-card h2 {
  font-size: 28px;
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: -0.03em;
  margin: 10px 0 14px;
  max-width: 22ch;
}
.rec-card .why {
  color: var(--ink-2);
  font-size: 14.5px;
  line-height: 1.55;
  max-width: 48ch;
  margin: 0 0 22px;
  text-wrap: pretty;
}
.accept {
  list-style: none;
  padding: 0;
  margin: 0 0 18px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  border-top: 1px dashed var(--rule);
  padding-top: 16px;
}
.accept li {
  font-size: 13px;
  color: var(--ink-2);
  display: grid;
  grid-template-columns: 20px 1fr;
  gap: 8px;
  line-height: 1.4;
  font-weight: 500;
}
.accept li::before {
  content: '✓';
  color: var(--green);
  font-weight: 700;
}
.ev-col {
  background: #fff;
  border: 1px solid var(--rule);
  border-radius: 16px;
  padding: 22px;
}
.ev-col h4 {
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--teal-ink);
  margin: 0 0 14px;
  font-weight: 600;
}
.quote {
  background: var(--bg);
  border: 1px solid var(--rule);
  border-left: 3px solid var(--teal);
  border-radius: 10px;
  padding: 14px 16px;
  margin-bottom: 10px;
  font-size: 13.5px;
  line-height: 1.45;
  color: var(--ink-2);
  font-weight: 500;
  animation: sigIn .5s ease;
}
.quote .qsrc {
  display: block;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-4);
  margin-top: 8px;
  font-weight: 600;
}

/* ======= STAGE 5 — SYNC ======= */
.sync-stage {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
  min-height: 560px;
  align-items: stretch;
}
.ticket {
  background: #fff;
  border: 1px solid var(--rule);
  border-radius: 16px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: all .4s;
}
.ticket .head {
  padding: 14px 20px;
  border-bottom: 1px solid var(--rule);
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: linear-gradient(180deg, #FAFCFD, #fff);
}
.ticket .head .sys {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-2);
  font-weight: 700;
}
.ticket .head .sys::before {
  content: '';
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--ink-4);
}
.ticket.created .head .sys::before {
  background: var(--green);
  box-shadow: 0 0 0 3px rgba(62,190,111,0.18);
}
.ticket .head .id {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--ink-4);
  font-weight: 600;
}
.ticket .body {
  padding: 22px 24px 24px;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.ticket .tag-row { display: flex; gap: 6px; flex-wrap: wrap; }
.ticket .tag {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 4px 9px;
  border-radius: 6px;
  background: var(--bg);
  color: var(--ink-2);
  border: 1px solid var(--rule);
  font-weight: 700;
}
.ticket h3 {
  font-size: 22px;
  font-weight: 800;
  line-height: 1.15;
  letter-spacing: -0.02em;
  color: var(--ink);
}
.ticket p {
  font-size: 13.5px;
  color: var(--ink-3);
  line-height: 1.55;
}
.ticket .fields {
  margin-top: auto;
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 8px 18px;
  font-size: 12.5px;
  border-top: 1px dashed var(--rule);
  padding-top: 14px;
}
.ticket .fields .k {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-4);
  font-weight: 600;
}
.ticket .fields .v { color: var(--ink-2); font-weight: 500; }
.ticket.syncing { animation: glow 1.2s ease-in-out; }
@keyframes glow {
  0%, 100% { box-shadow: 0 0 0 0 rgba(27,169,201,0); }
  50% { box-shadow: 0 0 0 6px rgba(27,169,201,0.2); }
}

.finale {
  text-align: center;
  padding: 48px 0 16px;
  font-size: 20px;
  font-weight: 700;
  color: var(--ink-2);
  letter-spacing: -0.02em;
  opacity: 0;
  transition: opacity .6s;
}
.finale.visible { opacity: 1; }
.finale em {
  font-style: normal;
  background: var(--grad);
  -webkit-background-clip: text; background-clip: text;
  color: transparent;
  font-weight: 800;
}

/* stage wrapper swap */
.stage { display: none; animation: fadeIn .5s ease; }
.stage.active { display: grid; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

/* ============================================================
   PROTOTYPE ADDITIONS — concept-moment polish
   ============================================================ */

/* ---- Stage chips: bigger click, clearer done/active ---- */
.stage-chip {
  cursor: pointer;
  border-style: solid;
  user-select: none;
  font-family: var(--sans);
  text-align: left;
  appearance: none;
  -webkit-appearance: none;
  outline: none;
}
.stage-chip:focus-visible { box-shadow: 0 0 0 3px rgba(27,169,201,0.25); }
.stage-chip:hover {
  border-color: var(--rule-2);
  background: linear-gradient(180deg, #fff, var(--bg));
  transform: translateY(-1px);
}
.stage-chip.done {
  background: linear-gradient(180deg, var(--mint-soft), #fff);
  border-color: var(--mint);
  cursor: pointer;
}
.stage-chip.done:hover {
  background: linear-gradient(180deg, rgba(78,208,184,0.18), #fff);
  border-color: var(--teal);
}
.stage-chip .hint {
  position: absolute;
  right: 14px; bottom: 14px;
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-4);
  opacity: 0;
  transition: opacity .2s;
  font-weight: 700;
}
.stage-chip.done .hint { color: var(--teal-ink); }
.stage-chip:hover .hint { opacity: 1; }
.stage-chip.active .hint { display: none; }

/* ---- Stage 1: per-source mini-streams ---- */
.mini-stream-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 4;
}
.mini-pulse {
  position: absolute;
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--teal);
  box-shadow: 0 0 8px rgba(27,169,201,0.6), 0 0 0 2px rgba(27,169,201,0.18);
  animation: miniFly 1.1s cubic-bezier(.4,.1,.2,1) forwards;
  opacity: 0;
}
@keyframes miniFly {
  0% { transform: translate(0,0); opacity: 0; }
  20% { opacity: 1; }
  80% { opacity: 1; }
  100% { transform: translate(var(--dx), var(--dy)); opacity: 0; }
}
.board-body { position: relative; }
.ingest-grid { position: relative; }

/* ---- Stage 2: outliers caption ---- */
.galaxy { position: relative; }
.outlier-cap {
  position: absolute;
  bottom: 12px; left: 16px;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-4);
  font-weight: 700;
  background: rgba(255,255,255,0.85);
  padding: 4px 10px;
  border-radius: 5px;
  border: 1px solid var(--rule);
  opacity: 0;
  transform: translateY(4px);
  transition: opacity .4s, transform .4s;
  pointer-events: none;
}
.outlier-cap.show { opacity: 1; transform: translateY(0); }

/* ---- Stage 3: math reveal + runner-ups ---- */
.math-reveal {
  margin-top: 18px;
  padding: 14px 16px;
  background: rgba(255,255,255,0.7);
  border: 1px solid rgba(255,255,255,0.9);
  border-radius: 12px;
  font-family: var(--mono);
  font-size: 13px;
  color: var(--ink);
  letter-spacing: 0.02em;
  opacity: 0;
  transform: translateY(6px);
  transition: opacity .4s, transform .4s;
  position: relative;
  z-index: 1;
}
.math-reveal.show { opacity: 1; transform: translateY(0); }
.mr-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  font-variant-numeric: tabular-nums;
}
.mr-row-2 {
  margin-top: 6px;
  font-size: 11px;
  color: var(--ink-3);
}
.mr-eq { display: inline-flex; gap: 4px; }
.mr-eq b {
  background: var(--mint-soft);
  padding: 1px 6px;
  border-radius: 4px;
  color: var(--teal-ink);
  font-weight: 700;
}
.mr-op {
  font-size: 14px;
  color: var(--teal-ink);
  font-weight: 700;
  margin: 0 2px;
}
.mr-num {
  font-weight: 700;
  font-size: 14px;
  color: var(--ink);
}
.mr-arrow {
  color: var(--teal-ink);
  font-weight: 700;
}
.mr-norm {
  color: var(--ink-3);
  font-size: 11px;
  letter-spacing: 0.04em;
}
.mr-final {
  margin-top: 6px;
  font-size: 13px;
  color: var(--ink);
  font-weight: 700;
}
.mr-final b {
  font-size: 18px;
  background: var(--grad);
  -webkit-background-clip: text; background-clip: text;
  color: transparent;
}
.runners-up {
  margin-top: 12px;
  display: flex;
  align-items: center;
  gap: 10px;
  opacity: 0;
  transform: translateY(4px);
  transition: opacity .4s ease .1s, transform .4s ease .1s;
  position: relative;
  z-index: 1;
}
.runners-up.show { opacity: 1; transform: translateY(0); }
.ru-l {
  font-family: var(--mono);
  font-size: 9.5px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-4);
  font-weight: 700;
}
.ru-list {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--ink-3);
  letter-spacing: 0.04em;
}
.ru-list em {
  font-style: normal;
  background: rgba(255,255,255,0.7);
  padding: 1px 6px;
  border-radius: 3px;
  margin: 0 2px;
  font-weight: 600;
  color: var(--ink-2);
  border: 1px solid var(--rule);
}

/* ---- Stage 4: attribution overlay ---- */
.rec-stage { position: relative; }
.attr-svg {
  position: absolute;
  inset: 0;
  width: 100%; height: 100%;
  pointer-events: none;
  z-index: 5;
}
.attr-path { transition: opacity .8s ease; }

/* ---- Stage 5: ring flash on cards ---- */
.ticket.ring-flash {
  animation: ringFlash .7s cubic-bezier(.4,.1,.2,1);
}
@keyframes ringFlash {
  0% { box-shadow: 0 0 0 0 rgba(62,190,111,0); }
  30% { box-shadow: 0 0 0 6px rgba(62,190,111,0.4); }
  100% { box-shadow: 0 0 0 0 rgba(62,190,111,0); }
}

/* ---- Toast stack ---- */
.toast-stack {
  position: fixed;
  top: 20px; right: 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 80;
  width: 360px;
  max-width: calc(100vw - 32px);
  pointer-events: none;
}
.toast {
  display: grid;
  grid-template-columns: 28px 1fr auto;
  align-items: start;
  gap: 12px;
  padding: 14px 14px 14px 16px;
  background: #fff;
  border: 1px solid var(--rule);
  border-left: 3px solid var(--teal);
  border-radius: 12px;
  box-shadow: 0 16px 40px -12px rgba(10,22,40,0.18);
  opacity: 0;
  transform: translateX(20px);
  transition: opacity .3s, transform .3s cubic-bezier(.2,.8,.2,1);
  pointer-events: auto;
}
.toast.toast-conf { border-left-color: var(--purple); }
.toast.show {
  opacity: 1;
  transform: translateX(0);
}
.toast-icon {
  font-size: 18px;
  line-height: 1;
  margin-top: 2px;
}
.toast-h {
  font-weight: 800;
  font-size: 14px;
  color: var(--ink);
  letter-spacing: -0.01em;
}
.toast-d {
  font-size: 12.5px;
  color: var(--ink-2);
  margin-top: 4px;
  line-height: 1.4;
}
.toast-t {
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.06em;
  color: var(--ink-4);
  margin-top: 6px;
  font-weight: 600;
}
.toast-x {
  border: 0;
  background: transparent;
  font-size: 18px;
  color: var(--ink-4);
  cursor: pointer;
  line-height: 1;
  padding: 2px 6px;
  border-radius: 4px;
}
.toast-x:hover { color: var(--ink); background: var(--bg); }

/* ---- Replay pill (next to finale) ---- */
.replay-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-left: 14px;
  padding: 8px 16px;
  border-radius: 999px;
  background: var(--ink);
  color: #fff;
  border: 0;
  font-family: var(--sans);
  font-size: 12.5px;
  font-weight: 600;
  letter-spacing: 0;
  cursor: pointer;
  transition: all .15s;
  vertical-align: middle;
  -webkit-text-fill-color: #fff;
}
.replay-pill:hover { background: #000; transform: translateY(-1px); }

/* ---- Finished board: subtle calm tint after run ---- */
.board.cross { animation: boardCross .38s ease; }
@keyframes boardCross {
  0% { opacity: 0.4; transform: scale(0.998); }
  100% { opacity: 1; transform: scale(1); }
}
.board.finished {
  border-color: var(--mint);
  box-shadow: 0 12px 36px -12px rgba(78,208,184,0.3), var(--shadow-md);
}

/* responsive */
@media (max-width: 980px) {
  .ingest-grid, .cluster-stage, .score-stage, .rec-stage, .sync-stage {
    grid-template-columns: 1fr;
  }
  .proto-header { grid-template-columns: 1fr; }
  .stage-rail { grid-template-columns: repeat(5, 1fr); overflow-x: auto; }
}

/* mobile pass */
@media (max-width: 720px) {
  .proto-nav-row { flex-wrap: wrap; gap: 8px; }
  .co-switch { width: 100%; overflow-x: auto; flex-wrap: nowrap; padding-bottom: 4px; }
  .proto-header h1 { font-size: 28px; line-height: 1.1; }
  .run-controls { flex-wrap: wrap; gap: 8px; }
  .stage-rail { grid-template-columns: repeat(5, minmax(120px, 1fr)); overflow-x: auto; gap: 6px; }
  .stage-chip { padding: 8px 10px; font-size: 11px; }
  .board { padding: 14px 12px; }
  .pipeline { padding: 0; }
  .ingest-grid, .cluster-stage, .score-stage, .rec-stage, .sync-stage { gap: 12px; }
}
