/* Course roadmap + AI Agents course widgets */
.roadmap { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.rm-step { position: relative; display: flex; flex-direction: column; gap: 4px; padding: 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--bg-soft); transition: .15s; }
.rm-step:hover { border-color: var(--accent); transform: translateY(-2px); }
.rm-step b { color: var(--ink); font-size: 14px; line-height: 1.3; }
.rm-step small { color: var(--muted); font-size: 12px; }
.rm-step .mini-bar { width: 100%; margin-top: auto; height: 4px; }
.rm-n { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; font-size: 12px; font-weight: 800; background: var(--panel); border: 2px solid var(--accent); color: var(--accent); margin-bottom: 4px; }
.rm-step.done .rm-n { background: var(--ok); border-color: var(--ok); color: #fff; }
.rm-step.part .rm-n { background: var(--accent); color: #fff; }

.w-chip .dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; }
.ag-req { font-size: 15px; font-weight: 600; color: var(--ink); background: var(--accent-soft); border-radius: 12px; padding: 10px 14px; }
.ag-flow { display: flex; align-items: stretch; gap: 6px; overflow-x: auto; padding: 4px 2px 8px; }
.ag-node { flex: 1 0 104px; display: flex; flex-direction: column; gap: 4px; border: 1px solid var(--line); background: var(--bg-soft); border-radius: 12px; padding: 10px; opacity: .45; transition: .3s; }
.ag-node b { font-size: 13px; color: var(--ink); }
.ag-node small { font-size: 12px; color: var(--muted); line-height: 1.35; }
.ag-node.lit { opacity: 1; }
.ag-node.cur { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); transform: translateY(-2px); }
.ag-node.ask { border-style: dashed; }
.ag-arrow { align-self: center; color: var(--line-strong); font-weight: 700; transition: .3s; }
.ag-arrow.lit { color: var(--accent); }
.ag-meter { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 220px; font-size: 12px; color: var(--muted); }
.ag-bar { flex: 1; display: flex; height: 22px; border-radius: 8px; overflow: hidden; font-size: 11px; font-weight: 700; }
.ag-bar i { font-style: normal; display: grid; place-items: center; background: var(--line); color: var(--ink); transition: width .4s; white-space: nowrap; overflow: hidden; }
.ag-bar i.m { background: var(--accent); color: #fff; }

.ag-loop { display: grid; grid-template-columns: 220px 1fr; gap: 18px; align-items: center; }
.ag-ring { width: 100%; max-width: 240px; }
.ag-ring path { transition: .3s; }
.ag-log { margin: 0; padding: 0; list-style: none; display: grid; gap: 5px; font-size: 13px; }
.ag-log li { display: flex; gap: 8px; align-items: baseline; opacity: .2; transition: .25s; padding: 4px 8px; border-radius: 8px; }
.ag-log li span { flex: none; font-size: 10px; font-weight: 800; text-transform: uppercase; letter-spacing: .06em; color: #fff; background: var(--c); border-radius: 5px; padding: 1px 6px; min-width: 52px; text-align: center; }
.ag-log li.shown { opacity: 1; }
.ag-log li.cur { background: var(--bg-soft); box-shadow: inset 3px 0 0 var(--c); }

.ag-layers { display: grid; grid-template-columns: minmax(220px, 300px) 1fr; gap: 16px; align-items: center; }
.ag-rings { width: 100%; }
.ag-r { cursor: pointer; }
.ag-r path { transition: opacity .2s; }
.ag-r:hover path:first-child { opacity: .8; }
.ag-r:focus { outline: none; }
.ag-r:focus-visible path:first-child { stroke: var(--ink); stroke-width: 2; }
.ag-detail { border-left: 4px solid var(--c); }
.ag-detail h3 { margin: 0 0 6px; }
.ag-detail ul { margin: 8px 0 0; padding-left: 18px; font-size: 14px; }

.ag-ts { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.ag-ts .w-field { margin-bottom: 8px; }
.ag-params { display: grid; gap: 6px; margin: 8px 0; }
.ag-prow { display: grid; grid-template-columns: 1fr 96px auto 28px; gap: 6px; align-items: center; }
.ag-prow input:not([type]), .ag-prow select { font: inherit; font-size: 13px; padding: 6px 8px; border: 1px solid var(--line-strong); border-radius: 8px; background: var(--panel); color: var(--ink); min-width: 0; }
.ag-x { border: 0; background: none; color: var(--muted); border-radius: 6px; }
.ag-x:hover { background: var(--bad-soft); color: var(--bad); }
.ag-sig { margin-top: 10px; white-space: pre-wrap; }
.ag-call { width: 100%; font-family: var(--mono); font-size: 13px; padding: 10px; border: 1px solid var(--line-strong); border-radius: 10px; background: var(--panel); color: var(--ink); resize: vertical; margin-bottom: 8px; }
.ag-seq text { font-family: var(--font); }

.ag-trace { display: grid; gap: 6px; }
.ag-step { display: flex; gap: 10px; align-items: baseline; font-size: 14px; padding: 8px 12px; border-radius: 10px; background: var(--bg-soft); border: 1px solid var(--line); opacity: 0; transform: translateY(4px); transition: .3s; }
.ag-step.shown { opacity: 1; transform: none; }
.ag-step > span { flex: none; font-size: 10px; font-weight: 800; text-transform: uppercase; letter-spacing: .06em; padding: 2px 7px; border-radius: 5px; background: var(--line); color: var(--ink); min-width: 78px; text-align: center; }
.ag-step.thought > span { background: #8b6cff; color: #fff; }
.ag-step.action > span { background: #16a38b; color: #fff; }
.ag-step.obs > span { background: #3d6df2; color: #fff; }
.ag-step.answer > span { background: var(--ok); color: #fff; }
.ag-step.branch > span { background: #e0861f; color: #fff; }
.ag-step.eval > span, .ag-step.reflect > span { background: #e8505b; color: #fff; }
.ag-step.guard { border-color: var(--ok); background: var(--ok-soft); }
.ag-step.guard > span { background: var(--ok); color: #fff; }
.ag-step.bad { border-color: var(--bad); background: var(--bad-soft); }
.ag-step.bad > span { background: var(--bad); color: #fff; }
.ag-step.user > span { background: var(--ink); color: var(--bg); }
.ag-evil { color: var(--bad); font-family: var(--mono); font-size: 12px; }

.ag-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(100px, 1fr)); gap: 8px; }
.ag-stats > div { background: var(--bg-soft); border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; text-align: center; }
.ag-stats b { display: block; font-size: 22px; color: var(--ink); line-height: 1.2; }
.ag-stats small { font-size: 12px; color: var(--muted); }
.ag-stats .bad b { color: var(--bad); }
.ag-stats .good b { color: var(--ok); }

.ag-tree { display: grid; gap: 4px; }
.ag-tn .ag-tn { border-left: 2px solid var(--line); padding-left: 10px; margin-left: 10px; }
.ag-tg { display: flex; align-items: center; gap: 10px; padding: 6px 0; }
.ag-tg b { color: var(--ink); }
.ag-tg small { color: var(--muted); font-size: 12px; }
.ag-leaf { display: flex; gap: 8px; align-items: center; padding: 6px 10px; border-radius: 8px; font-size: 14px; cursor: pointer; }
.ag-leaf input { accent-color: var(--accent); }
.ag-leaf.done { color: var(--muted); text-decoration: line-through; }
.ag-leaf.next { background: var(--accent-soft); color: var(--ink); }
.ag-leaf.next em { font-style: normal; font-size: 12px; color: var(--accent); font-weight: 700; }
.ag-leaf.fail { color: var(--bad); }

.ag-hq { display: grid; grid-template-columns: 70px 1fr 1fr; gap: 10px; align-items: center; padding: 8px 12px; border-radius: 10px; font-size: 14px; }
.ag-hq b { color: var(--ink); font-weight: 600; }
.ag-hq.good { background: var(--ok-soft); }
.ag-hq.bad { background: var(--bad-soft); }
.ag-hq.abst { background: var(--bg-soft); color: var(--muted); }
.ag-conf { height: 8px; background: var(--line); border-radius: 6px; overflow: hidden; }
.ag-conf i { display: block; height: 100%; background: var(--accent); }

.ag-bandit { display: grid; gap: 8px; }
.ag-bandit > div { display: grid; grid-template-columns: 170px 1fr 70px; gap: 10px; align-items: center; }
.ag-tool b { display: block; font-family: var(--mono); font-size: 13px; color: var(--ink); }
.ag-tool small { font-size: 11px; color: var(--muted); }
.ag-hbar { position: relative; height: 24px; background: var(--bg-soft); border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.ag-hbar i { display: block; height: 100%; background: var(--accent); transition: width .2s; }
.ag-hbar span { position: absolute; left: 8px; top: 2px; font-size: 12px; font-weight: 700; color: var(--ink); }
.ag-est { font-family: var(--mono); font-size: 12px; color: var(--muted); text-align: right; }

.ag-stack { position: relative; display: flex; height: 34px; margin-top: 16px; border-radius: 10px; background: var(--bg-soft); border: 1px solid var(--line); }
.ag-stack i { display: block; height: 100%; transition: width .3s; }
.ag-stack i:first-child { border-radius: 9px 0 0 9px; }
.ag-limit { position: absolute; top: -6px; bottom: -6px; width: 3px; background: var(--ink); border-radius: 2px; }
.ag-limit::after { content: 'limit'; position: absolute; top: -18px; left: -12px; font-size: 10px; font-weight: 700; color: var(--ink); }
.ag-legend { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 6px 14px; font-size: 13px; }
.ag-legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; }
.ag-legend small { color: var(--muted); }

.ag-rank { display: grid; gap: 5px; }
.ag-rank > div { display: grid; grid-template-columns: 70px 40px 70px 1fr; gap: 8px; align-items: center; font-size: 13px; padding: 5px 8px; border-radius: 8px; opacity: .55; }
.ag-rank > div.in { opacity: 1; background: var(--accent-soft); }
.ag-rank small { color: var(--muted); }
.ag-rank b { color: var(--ink); }
.ag-sc { height: 8px; background: var(--line); border-radius: 6px; overflow: hidden; }
.ag-sc i { display: block; height: 100%; background: var(--accent); }

.ag-net .ag-dot { filter: drop-shadow(0 0 6px var(--accent)); }
.ag-msgs { margin: 0; padding-left: 20px; display: grid; gap: 3px; font-size: 13px; }
.ag-msgs li { opacity: .25; transition: .25s; }
.ag-msgs li.shown { opacity: 1; }
.ag-msgs b { color: var(--accent); font-weight: 600; margin-right: 4px; }

.ag-ev td { white-space: normal; font-family: var(--font); font-size: 13px; }
.ag-ev tr.ok td:last-child { color: var(--ok); font-weight: 700; }
.ag-ev tr.no td { background: var(--bad-soft); }
.ag-ev tr.no td:last-child { color: var(--bad); font-weight: 700; }
.ag-cmp { display: grid; gap: 6px; }
.ag-cmp > div { display: grid; grid-template-columns: 30px 1fr; gap: 8px; align-items: center; font-size: 13px; font-weight: 700; }

.ag-act { display: grid; grid-template-columns: 130px 1fr 80px 150px; gap: 10px; align-items: center; padding: 8px 12px; border-radius: 10px; font-size: 14px; border: 1px solid var(--line); }
.ag-act code { font-size: 12px; }
.ag-risk { color: var(--accent); letter-spacing: 2px; font-size: 11px; }
.ag-act.auto { background: var(--ok-soft); border-color: transparent; }
.ag-act.ask { background: var(--warn-soft); border-color: transparent; }
.ag-act.human, .ag-act.halt { background: var(--bad-soft); border-color: transparent; }
.ag-act b { font-size: 13px; color: var(--ink); text-align: right; }

@media (max-width: 700px) {
  .ag-loop, .ag-layers, .ag-ts { grid-template-columns: 1fr; }
  .ag-ring, .ag-rings { max-width: 240px; margin: 0 auto; }
  .ag-hq { grid-template-columns: 50px 1fr; }
  .ag-hq span:last-child { grid-column: 1 / -1; }
  .ag-bandit > div { grid-template-columns: 1fr; gap: 4px; }
  .ag-est { text-align: left; }
  .ag-act { grid-template-columns: 1fr auto; }
  .ag-act code, .ag-risk { display: none; }
  .ag-rank > div { grid-template-columns: 60px 40px 1fr; }
  .ag-rank small { grid-column: 1 / -1; }
  .ag-prow { grid-template-columns: 1fr 86px 28px; }
  .ag-prow .w-chip { grid-column: 1 / -1; justify-self: start; }
}

/* Switchable featured course card (home hero) */
.feature-wrap { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.feature-tabs { display: inline-flex; align-self: flex-start; max-width: 100%; overflow-x: auto; scrollbar-width: none; gap: 4px; padding: 4px; background: var(--bg-soft); border: 1px solid var(--line); border-radius: 999px; }
.feature-tabs button { flex: none; white-space: nowrap; display: inline-flex; align-items: center; gap: 8px; border: 0; background: transparent; padding: 7px 16px; border-radius: 999px; font-size: 14px; font-weight: 600; color: var(--muted); transition: .15s; }
.feature-tabs button:hover { color: var(--ink); }
.feature-tabs button.on { background: var(--panel); color: var(--ink); box-shadow: 0 1px 4px rgba(0,0,0,.12); }
.ft-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); opacity: .45; }
.feature-tabs button.on .ft-dot { opacity: 1; box-shadow: 0 0 0 3px var(--accent-soft); }
#feature-slot .feature { animation: feature-in .35s ease; }
@keyframes feature-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { #feature-slot .feature { animation: none; } }
.mock-loop { position: relative; width: 62px; height: 62px; margin: 6px auto 0; display: grid; place-items: center; }
.mock-loop i { position: absolute; inset: 0; border-radius: 50%; background: conic-gradient(#3fb8d4 0 23%, transparent 23% 25%, #1f7fa8 25% 48%, transparent 48% 50%, #22c3a6 50% 73%, transparent 73% 75%, #f39a3c 75% 98%, transparent 98%); -webkit-mask: radial-gradient(circle, transparent 55%, #000 56%); mask: radial-gradient(circle, transparent 55%, #000 56%); }
.mock-loop b { font-size: 20px; }
@media (max-width: 420px) { .feature-tabs button { padding: 7px 11px; font-size: 13px; } }
.feature-tabs button { padding: 7px 12px; font-size: 13px; }
.feature-tabs { display: grid; grid-auto-flow: column; grid-auto-columns: auto; align-self: stretch; }
.feature-tabs button { justify-content: center; padding: 7px 8px; gap: 6px; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 560px) { .feature-tabs { display: inline-flex; align-self: flex-start; } .feature-tabs button { padding: 7px 11px; } }
/* Many featured courses: let the tab pills wrap instead of truncating */
.feature-tabs { display: flex; flex-wrap: wrap; justify-content: flex-start; border-radius: 18px; overflow: visible; }
.feature-tabs button { flex: 0 0 auto; overflow: visible; }
/* Narrow lesson columns: wrap fixed-column widget layouts by available width */
.ag-loop, .ag-layers, .ag-ts { grid-template-columns: repeat(auto-fit, minmax(min(100%, 240px), 1fr)); }
.ag-ts > *, .ag-loop > *, .ag-layers > * { min-width: 0; }
.ag-act { grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr) auto auto; }
.ag-step { min-width: 0; overflow-wrap: anywhere; }
.ag-evil { word-break: break-word; }
.ag-step { flex-wrap: wrap; } .ag-step > * { min-width: 0; } .ag-evil { flex: 1 1 220px; }
.ag-step > span.ag-evil { flex: 1 1 220px; min-width: 0; padding: 0; background: none; text-transform: none; letter-spacing: 0; text-align: left; font-weight: 400; font-size: 12px; color: var(--bad); border-radius: 0; }

/* ---------- Agent arena experiment ---------- */
.ar-controls { display: flex; flex-wrap: wrap; gap: 10px 14px; align-items: center; margin-bottom: 14px; }
.ar-stats > div.bad b { color: var(--bad); } .ar-stats > div.good b { color: var(--ok); }
.ar-dots { display: flex; flex-wrap: wrap; gap: 5px; margin: 12px 0; }
.ar-dot { width: 32px; height: 32px; border-radius: 8px; border: 2px solid transparent; font: 700 12px/1 inherit; cursor: pointer; color: #fff; padding: 0; }
.ar-dot.ok { background: var(--ok); } .ar-dot.degraded { background: var(--warn); color: #1a1a1a; } .ar-dot.wrong { background: #b25ae6; }
.ar-dot.harm { background: var(--bad); } .ar-dot.timeout, .ar-dot.failed { background: var(--muted); }
.ar-dot.sel, .ar-dot:focus-visible { border-color: var(--ink); outline: none; box-shadow: 0 0 0 2px var(--panel), 0 0 0 4px var(--accent); }
.ar-detail { min-height: 62px; padding: 10px 14px; border-radius: 10px; background: var(--bg-soft); border: 1px solid var(--line); margin-bottom: 10px; }
.ar-log td.no { color: var(--bad); font-weight: 700; }

/* ---------- Prompt lab ---------- */
.pl-results { list-style: none; margin: 12px 0; padding: 0; display: grid; gap: 6px; }
.pl-results li { display: flex; gap: 10px; align-items: flex-start; padding: 8px 12px; border-radius: 10px; border: 1px solid var(--line); background: var(--bg-soft); }
.pl-results li.ok { border-color: var(--ok); }
.pl-results li.no { border-color: var(--bad); }
.pl-results .mark, .pl-mark { flex: none; width: 22px; height: 22px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; font-weight: 800; font-size: 13px; color: #fff; }
.pl-results li.ok .pl-mark { background: var(--ok); }
.pl-results li.no .pl-mark { background: var(--bad); }
.pl-results small { color: var(--muted); }

/* ---------- Index lab (real SQLite plans) ---------- */
.il-indexes { border: 1px solid var(--line); border-radius: 12px; padding: 10px 14px 12px; margin: 0 0 12px; min-width: 0; }
.il-indexes legend { font-size: 13px; font-weight: 700; color: var(--accent); padding: 0 6px; }
.il-indexes .w-chip { margin: 4px 6px 4px 0; }
.il-queries { list-style: none; counter-reset: ilq; margin: 12px 0; padding: 0; display: grid; gap: 8px; }
.il-queries > li { counter-increment: ilq; border: 1px solid var(--line); border-radius: 12px; padding: 10px 14px; background: var(--bg-soft); min-width: 0; }
.il-head { display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: center; }
.il-head b::before { content: counter(ilq) ". "; color: var(--muted); }
.il-sql { display: block; margin: 6px 0; font-size: 12px; white-space: pre-wrap; overflow-wrap: anywhere; color: var(--muted); }
.il-plan { list-style: none; margin: 6px 0 0; padding: 0; display: grid; gap: 3px; }
.il-plan li { font-size: 12px; overflow-wrap: anywhere; }
.il-badge { font-size: 11px; font-weight: 800; letter-spacing: .02em; padding: 2px 8px; border-radius: 999px; background: var(--line); color: var(--ink); }
.il-badge.scan { background: var(--bad); color: #fff; } .il-badge.seek { background: var(--ok); color: #fff; }
.il-badge.cover { background: var(--accent); color: #fff; } .il-badge.sort { background: var(--warn); color: #1a1a1a; }
