/* Title */
.title-slide h1 { font-size: clamp(2.5rem, 5.5vw + 0.5rem, 5.2rem); max-width: 12ch; }
.title-slide .lead { font-size: clamp(1.05rem, 0.8vw + 0.8rem, 1.35rem); max-width: 40ch; }
.hero-pipe { display: flex; align-items: center; width: min(100%, 520px); margin-bottom: 8px; }
.hero-pipe .g {
  flex: none; width: 58px; height: 58px; border-radius: 50%;
  background: var(--go); color: #fff; display: grid; place-items: center;
  font-family: var(--mono); font-weight: 700; position: relative; z-index: 1;
}
.hero-pipe .tube { flex: 1; height: 24px; border-block: 2px solid var(--ink); position: relative; overflow: hidden; }
.hero-pipe .tube i {
  position: absolute; top: 50%; left: -18px; width: 14px; height: 14px; margin-top: -7px;
  background: var(--value); border: 1.5px solid var(--ink); border-radius: 3px;
  animation: flow 3s linear infinite;
}
.hero-pipe .tube i:nth-child(2) { animation-delay: -1s; }
.hero-pipe .tube i:nth-child(3) { animation-delay: -2s; }
@keyframes flow { to { left: 100%; } }

/* Chips */
.gchip, .mchip, .pchip {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 2.5em; height: 1.85em; padding: 0 0.45em;
  font-family: var(--mono); font-size: 0.74em; font-weight: 700;
  border-radius: 999px; flex: none;
}
.gchip { background: var(--go); color: #fff; }
.gchip.queued { background: var(--go-soft); color: var(--go-deep); }
.gchip.blocked { background: var(--block); }
.mchip { background: var(--ink); color: #fff; border-radius: 4px; }
.mchip.idle { background: var(--line); color: var(--muted); }
.pchip { background: var(--panel); color: var(--ink); border: 1.5px solid var(--ink); border-radius: 4px; }
/* go + WaitGroup */
.lanes { display: flex; flex-direction: column; gap: 8px; }
.lane { display: grid; grid-template-columns: 3.2em minmax(0, 1fr) 6.5em; gap: 10px; align-items: center; }
.lane-state { font-size: 0.78em; color: var(--muted); font-family: var(--mono); }
.lane.main .gchip { background: var(--ink); }
.lane.main .fill { width: 100%; background: var(--ink); opacity: 0.2; }
.lane.main.is-waiting .fill { background: var(--block); opacity: 0.5; }
.lane.main.is-exited .fill { opacity: 0.06; }
.lane.is-done .fill { background: var(--ok); }
.lane.is-done .gchip { background: var(--ok); }
.lane.is-done .lane-state { color: var(--ok); }
.lane.is-killed .fill { background: repeating-linear-gradient(-45deg, var(--block) 0 5px, var(--block-soft) 5px 10px); }
.lane.is-killed .gchip { background: var(--block); }
.lane.is-killed .lane-state { color: var(--block); font-weight: 700; }

/* Memory cost */
.cost-n { font-size: 1.05em; }
.cost-n b { font-size: 2em; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; margin-right: 4px; }
.cost-row { display: grid; gap: 5px; }
.cost-track { height: 16px; background: var(--paper); border: 1px solid var(--line); border-radius: 4px; overflow: hidden; }
.cost-fill { height: 100%; min-width: 2px; transition: width 0.15s; }
.cost-fill.go { background: var(--go); }
.cost-fill.thread { background: var(--ink); }
.cost-fill.over { background: repeating-linear-gradient(-45deg, var(--block) 0 8px, #e7678d 8px 16px); }
.cost-val { font-family: var(--mono); font-size: 0.8em; }

/* GMP */
.gmp-legend { display: grid; grid-template-columns: auto 1fr; gap: 10px 12px; margin: 0; align-items: baseline; }
.gmp-legend dd { margin: 0; }
.gmp-body { display: flex; flex-direction: column; gap: 12px; }
.gmp-row { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; }
.gmp-row .label { min-width: 9.5em; }
.gmp-ps { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 8px; }
.pcard { border: 1.5px solid var(--ink); border-radius: 8px; padding: 8px; display: flex; flex-direction: column; gap: 8px; }
.phead { display: flex; gap: 6px; align-items: center; }
.prun { display: flex; gap: 8px; align-items: center; min-height: 1.9em; }
.queue.small { min-height: 1.6em; }
.queue.small .gchip { min-width: 2.2em; height: 1.6em; font-size: 0.68em; }
.done-count { margin-left: auto; font-size: 0.85em; }
.gmp-log { min-height: 5.5em; }

/* Unbuffered rendezvous */
.rv { display: grid; grid-template-columns: minmax(0, 1fr) minmax(56px, 0.8fr) minmax(0, 1fr); gap: 10px; align-items: stretch; }
.rv-g { display: flex; flex-direction: column; gap: 8px; border: 1.5px solid var(--ink); border-radius: 10px; padding: 10px; transition: background 0.2s, border-color 0.2s; }
.rv-g.is-blocked { border-color: var(--block); background: var(--block-soft); }
.rv-head { display: flex; gap: 6px; align-items: center; font-size: 0.8em; font-weight: 600; flex-wrap: wrap; }
.rv-op { font-size: 0.78em; align-self: flex-start; }
.rv-state { font-size: 0.8em; color: var(--muted); min-height: 2.5em; }
.rv-g.is-blocked .rv-state { color: var(--block); font-weight: 600; }
.rv-got { min-height: 1.9em; font-family: var(--mono); font-size: 0.85em; display: flex; gap: 4px; align-items: center; }
.rv-g .btn { margin-top: auto; padding-inline: 0.4em; white-space: normal; }
.rv-pipe { display: flex; flex-direction: column; justify-content: center; align-items: center; gap: 6px; text-align: center; }
.rv-tube { position: relative; width: 100%; height: 40px; border-block: 2px solid var(--ink); }
.rv-token { position: absolute; left: 4px; top: 50%; margin-top: -0.95em; }
.rv-token.waiting { animation: nudge 1s ease-in-out infinite; }
@keyframes nudge { 50% { transform: translateX(5px); } }

/* Buffered / hchan */
pre.code.mini { padding: 8px 14px; }
.ring { display: flex; gap: 6px; flex-wrap: wrap; min-height: 82px; }
.slot { display: flex; flex-direction: column; align-items: center; gap: 3px; width: 54px; }
.slot .cell { width: 100%; height: 44px; border: 1.5px dashed var(--muted); border-radius: 8px; display: grid; place-items: center; }
.slot.full .cell { border-style: solid; border-color: var(--ink); }
.slot .idx { font-family: var(--mono); font-size: 0.7em; color: var(--muted); }
.slot .ptrs { display: flex; flex-direction: column; gap: 2px; align-items: center; min-height: 2.6em; }
.ptr { font-family: var(--mono); font-size: 0.66em; font-weight: 700; padding: 0 4px; border-radius: 3px; }
.ptr.s { background: var(--ink); color: #fff; }
.ptr.r { background: var(--go-soft); color: var(--go-deep); }
.nobuf { font-size: 0.88em; color: var(--muted); align-self: center; }
.fields { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 6px; }
.field { border: 1px solid var(--line); border-radius: 6px; padding: 5px 8px; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.field span { font-family: var(--mono); font-size: 0.68em; color: var(--muted); }
.field b { font-family: var(--mono); font-size: 0.95em; display: flex; flex-wrap: wrap; gap: 4px; min-height: 1.85em; align-items: center; }
.field.wide { grid-column: span 5; flex-direction: row; align-items: center; gap: 10px; }
.field.wide span { min-width: 3.5em; }
.field.flash { animation: flash 0.7s; }
@keyframes flash { from { background: var(--value); } }
@media (max-width: 520px) {
  .fields { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .field.wide { grid-column: span 3; }
  .slot { width: 44px; }
}

/* nil/open/closed matrix */
.mx { display: grid; grid-template-columns: auto repeat(3, minmax(0, 1fr)); gap: 6px; }
.mx-op { text-align: center; padding-bottom: 4px; align-self: end; }
.mx-op code { font-size: 0.8em; white-space: nowrap; }
.mx-state { font-weight: 700; align-self: center; padding-right: 6px; font-size: 0.9em; }
.mx-cell {
  font: inherit; font-size: 0.78em; font-weight: 600; line-height: 1.25;
  min-height: 62px; padding: 8px 6px; border-radius: 8px; cursor: pointer;
  border: 2px solid transparent; color: var(--ink);
}
.mx-cell.ok { background: var(--ok-soft); }
.mx-cell.block { background: #fdf4c4; }
.mx-cell.panic { background: var(--block); color: #fff; }
.mx-cell.sel { border-color: var(--ink); box-shadow: 0 0 0 2px var(--panel) inset; }
.mx-detail { border-left: 4px solid var(--ok); padding: 4px 0 4px 14px; min-height: 7em; }
.mx-detail.block { border-color: #d9b800; }
.mx-detail.panic { border-color: var(--block); }
.mx-title { font-size: 0.95em; margin-bottom: 6px; }
.mx-detail p { font-size: 0.9em; color: var(--muted); }

/* select */
.sel-code { background: var(--ink); color: #e3ecf3; border-radius: 12px; padding: 10px 6px; font-family: var(--mono); font-size: clamp(11.5px, 0.45vw + 9.5px, 14.5px); }
.sel-code code { background: none; padding: 0; font-size: inherit; color: inherit; overflow-wrap: anywhere; }
.sel-line { padding: 4px 10px; border-radius: 6px; }
.sel-line.case { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding-left: 28px; cursor: pointer; border: 1.5px solid transparent; }
.sel-toggle { display: flex; align-items: center; gap: 6px; font-family: var(--font); font-size: 0.85em; color: #a9bccc; flex: none; }
.sel-line.ready { border-color: rgba(0, 173, 216, 0.6); }
.sel-line.absent code { opacity: 0.35; text-decoration: line-through; }
.sel-line.waiting { border-style: dashed; border-color: var(--block); }
.sel-line.chosen { animation: chosen 1.4s forwards; }
@keyframes chosen { 0%, 60% { background: var(--value); color: var(--ink); } 100% { background: rgba(253, 221, 0, 0.18); } }
.sel-line.chosen code span { color: inherit; }
.sel-stats { display: grid; gap: 6px; }
.bar-row { display: grid; grid-template-columns: 5em 1fr 3em; gap: 10px; align-items: center; font-size: 0.85em; }

/* Worker pool */
.workers { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 8px; }
.worker { display: flex; align-items: center; gap: 8px; border: 1.5px solid var(--line); border-radius: 8px; padding: 6px 8px; }
.worker.busy { border-color: var(--go); }
.worker .gchip { background: var(--ink); }
.wjob { min-width: 2.4em; }
.clock { font-family: var(--mono); font-weight: 700; margin-left: auto; }
.queue.results .val, .queue.jobs .val { font-size: 0.72em; }
