/* SPDX-License-Identifier: MIT */
/* Interactive lab views (AUTHORING.md §9.3-§9.6). Loaded only on pages that embed a lab.
   Colours come from the course tokens in course.css; nothing here sets a colour of its own. */

.lab-ctl { margin: .25rem 0 .75rem; }
.tt-f, .iv-f { display: inline-flex; align-items: center; gap: .5rem; }
.tt-focus { max-width: 13rem; }
.tt-check { display: inline-flex; align-items: center; gap: .45rem; min-height: 2.75rem; font-size: .9rem; cursor: pointer; }
.tt-check input { width: 1.1rem; height: 1.1rem; margin: 0; accent-color: var(--accent); }
.tt-row { display: flex; flex-wrap: wrap; gap: .6rem; margin: .6rem 0 0; }
.tt-row:empty { display: none; }

/* Trace Theater: a filmstrip of state cards on a rail; the step is the pair. */
.tt-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: .25rem 1rem; }
.tt-head .verdict { margin: 0 0 .5rem; }
.tt-src { flex: 1 1 18rem; margin: 0 0 .5rem; font-size: .85rem; color: var(--muted); }
.tt-note { display: block; }
.tt-steps { list-style: none; margin: 0; padding: 0; max-height: 34rem; overflow-y: auto; border-top: 1px solid var(--rule); position: relative; overscroll-behavior: contain; }
.tt-step { position: relative; padding: .2rem .5rem .55rem 2rem; border-bottom: 1px solid var(--rule); }
.tt-step::before { content: ""; position: absolute; left: .7rem; top: 0; bottom: 0; border-left: 2px solid var(--rule); }
.tt-step::after { content: ""; position: absolute; left: .37rem; top: 1.05rem; width: .8rem; height: .8rem; border-radius: 50%; background: var(--paper); border: 2px solid var(--muted); box-sizing: border-box; }
.tt-step:first-child::before { top: 1.1rem; }
.tt-step:last-child::before { bottom: auto; height: 1.1rem; }
.tt-step.cur { background: var(--mark); }
.tt-step.cur::after { background: var(--accent); border-color: var(--accent); }
.tt-loop::after { border-style: dashed; }
.tt-go { display: flex; flex-wrap: wrap; align-items: baseline; align-content: center; gap: .1rem .75rem; width: 100%; min-height: 2.75rem; padding: .2rem 0; margin: 0; background: none; border: 0; color: inherit; font: inherit; text-align: left; cursor: pointer; }
.tt-go:hover .tt-act { text-decoration: underline; }
.tt-static { cursor: default; }
.tt-static:hover .tt-act { text-decoration: none; }
.tt-n { min-width: 5.5rem; font: 600 .72rem/1.6 var(--mono); letter-spacing: .07em; text-transform: uppercase; color: var(--muted); }
.tt-act { font: 600 .9rem var(--mono); color: var(--accent); overflow-wrap: anywhere; }
.tt-vars { list-style: none; margin: 0; padding: 0; }
.tt-v { margin: 0; font: .85rem/1.65 var(--mono); overflow-wrap: anywhere; }
.tt-name { font-weight: 600; }
.tt-v.ch .tt-val { font-weight: 700; }
.tt-v.un, .tt-tag, .tt-eq, .tt-arrow { color: var(--muted); }
.tt-tag { font-size: .78rem; }
.tt-stut { font-style: italic; color: var(--muted); }
.tt-back { min-height: 2.75rem; margin-left: .25rem; }
.tt-open { margin-top: 1rem; border-top: 1px dashed var(--rule); padding-top: .25rem; }
.tt-open summary { display: flex; align-items: center; min-height: 2.75rem; cursor: pointer; font: 600 .72rem/1.6 var(--mono); letter-spacing: .07em; text-transform: uppercase; color: var(--accent); }
.tt-drop { margin: .5rem 0 0; padding: 1rem 1rem .25rem; border: 2px dashed var(--rule); border-radius: 8px; text-align: center; }
.tt-drop p { margin: 0 0 .75rem; }
.tt-drop .filebtn { vertical-align: middle; }
.tt-dragging { outline: 2px dashed var(--accent); outline-offset: 4px; }
.tt-dragging .tt-drop { border-color: var(--accent); background: var(--mark); }
.tt-msg { min-height: 1.4rem; margin: .5rem 0 0; font-size: .9rem; }

/* Interleaving Explorer: TLC's graph unfolded into a tree of runs. */
.iv-legend { display: flex; flex-wrap: wrap; gap: .25rem 1.25rem; margin: 0 0 .5rem; font-size: .82rem; color: var(--muted); }
.iv-note { margin: 0 0 .75rem; }
.iv-find { width: 11rem; min-height: 2.75rem; font-size: .9rem; }
.iv-tree, .iv-tree ul { list-style: none; margin: 0; padding: 0; }
.iv-tree { max-height: 38rem; overflow-y: auto; overscroll-behavior: contain; border-top: 1px solid var(--rule); border-bottom: 1px solid var(--rule); padding: .25rem 0; }
.iv-tree ul { margin-left: .75rem; padding-left: .75rem; border-left: 1px solid var(--rule); }
.iv-tree [role="treeitem"] { outline: none; }
.iv-tree [role="treeitem"]:focus-visible > .iv-row { outline: 2px solid var(--accent); outline-offset: -2px; }
.iv-row { display: grid; grid-template-columns: 1.1rem auto minmax(0, 1fr) auto; align-items: baseline; gap: .1rem .6rem; min-height: 2.75rem; padding: .5rem .5rem; border-radius: 6px; cursor: pointer; font: .85rem/1.5 var(--mono); }
.iv-row:hover { background: var(--wash); }
.iv-row.same { background: var(--wash); box-shadow: inset 3px 0 0 var(--muted); }
.iv-row.hit { background: var(--mark); box-shadow: inset 3px 0 0 var(--accent); }
.iv-g { display: inline-block; width: 1.1rem; text-align: center; color: var(--muted); }
.iv-g.bad { color: var(--bad); font-weight: 700; }
.iv-act { font-weight: 600; color: var(--accent); }
.iv-diff { min-width: 0; overflow-wrap: anywhere; }
.iv-id { justify-self: end; padding: 0 .45rem; border: 1px solid var(--rule); border-radius: 999px; font: .72rem/1.6 var(--mono); color: var(--muted); }
.iv-end { margin: 0 0 .5rem 2.3rem; font: .8rem/1.6 var(--mono); overflow-wrap: anywhere; }
.iv-end .lbl { margin-right: .4rem; }
.iv-leaf > .iv-row .iv-g { color: var(--ink); }
.iv-leaf > .iv-row .iv-g.bad { color: var(--bad); }
.iv-bad { display: inline-block; margin-top: .25rem; padding: 0 .5rem; border: 1px solid currentColor; border-radius: 6px; color: var(--bad); font-weight: 700; }
.iv-count { margin: 1rem 0 0; padding-left: 1rem; border-left: 3px solid var(--accent); }

/* The generic Tier A viewer (labs without a module of their own yet). */
.frames { display: flex; gap: .6rem; overflow-x: auto; padding: .25rem 0 .75rem; list-style: none; margin: 0; }
.frame { flex: none; min-width: 10rem; max-width: 18rem; padding: .6rem .75rem; border: 1px solid var(--rule); border-radius: 8px; font: .8rem/1.5 var(--mono); }
.frame.cur { border-color: var(--accent); background: var(--mark); }
.frame .ch { font-weight: 700; }
.frame .ch::after { content: " · changed"; font-weight: 400; color: var(--muted); }

@media (max-width: 760px) {
  .tt-steps, .iv-tree { max-height: 28rem; }
  .tt-step { padding-left: 1.75rem; }
  .tt-n { min-width: 0; }
  .iv-tree ul { margin-left: .3rem; padding-left: .35rem; }
  .iv-row { padding: .4rem .25rem; gap: .1rem .4rem; }
  .iv-end { margin-left: 1.5rem; }
  .iv-row { grid-template-columns: 1.1rem minmax(0, 1fr) auto; }
  .iv-row .iv-diff { grid-column: 2 / 4; grid-row: 2; }
  .iv-row .iv-id { grid-column: 3; grid-row: 1; }
  .iv-find { width: 9rem; }
}
