/* Shared lab styles. Scoped under .lab; matches the site's dark theme, readable on projectors. */
.lab {
  --lab-bg: #111927;
  --lab-panel: #16202f;
  --lab-ink: #e8e9e5;
  --lab-soft: #b6b9b2;
  --lab-faint: #8d918a;
  --lab-line: rgba(224, 225, 221, 0.16);
  --lab-accent: #22c3e6;
  --lab-pos: #22c3e6;
  --lab-neg: #f59e5b;
  --lab-focus: #fde047;
  --lab-cell: 2.2rem;
  color: var(--lab-ink);
  font-size: 0.95rem;
  line-height: 1.5;
  padding: 1rem;
}
@media (min-width: 640px) { .lab { padding: 1.25rem 1.5rem; } }
.lab *, .lab *::before, .lab *::after { box-sizing: border-box; }
.lab h3, .lab h4 { margin: 0; font-weight: 600; color: var(--lab-ink); }
.lab h3 { font-size: 1.05rem; }
.lab h4 { font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--lab-soft); }
.lab p { margin: 0.4rem 0 0; }
.lab-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.lab-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.5rem 1rem; }
.lab-badge { display: inline-block; border: 1px solid var(--lab-line); border-radius: 999px; padding: 0.05rem 0.55rem; font-size: 0.72rem; color: var(--lab-soft); }
.lab-toolbar { display: flex; flex-wrap: wrap; gap: 0.6rem 0.9rem; align-items: flex-end; margin-top: 0.9rem; }
.lab-field { display: flex; flex-direction: column; gap: 0.2rem; font-size: 0.8rem; color: var(--lab-soft); }
.lab-field-label { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.05em; }
.lab-select, .lab-num {
  background: var(--lab-panel); color: var(--lab-ink); border: 1px solid var(--lab-line); border-radius: 0.4rem;
  padding: 0.35rem 0.5rem; font: inherit; font-size: 0.88rem; min-height: 2.25rem;
}
.lab-num { width: 3.4rem; text-align: center; font-variant-numeric: tabular-nums; }
.lab-seg { display: inline-flex; border: 1px solid var(--lab-line); border-radius: 0.45rem; overflow: hidden; }
.lab-seg button { background: transparent; color: var(--lab-soft); border: 0; padding: 0.4rem 0.7rem; font: inherit; font-size: 0.85rem; min-height: 2.25rem; cursor: pointer; }
.lab-seg button[aria-pressed="true"] { background: rgba(34, 195, 230, 0.18); color: var(--lab-ink); }
.lab-btn { background: var(--lab-panel); color: var(--lab-ink); border: 1px solid var(--lab-line); border-radius: 0.45rem; padding: 0.4rem 0.75rem; font: inherit; font-size: 0.85rem; min-height: 2.25rem; cursor: pointer; }
.lab-btn:hover { border-color: rgba(34, 195, 230, 0.55); }
.lab-btn-primary { background: rgba(34, 195, 230, 0.2); border-color: rgba(34, 195, 230, 0.6); }
.lab button:focus-visible, .lab select:focus-visible, .lab input:focus-visible, .lab canvas:focus-visible, .lab [tabindex]:focus-visible {
  outline: 3px solid var(--lab-focus); outline-offset: 2px;
}
.lab-panels { display: flex; flex-wrap: wrap; gap: 0.75rem; margin-top: 1rem; align-items: flex-start; }
.lab-panels > .lab-panel { flex: 1 1 auto; max-width: 100%; }
.lab-panels .lab-note, .lab-panels .lab-legend, .lab-panels .lab-field { max-width: 17rem; }
.lab-panel { background: var(--lab-panel); border: 1px solid var(--lab-line); border-radius: 0.6rem; padding: 0.75rem; min-width: 0; }
.lab-scroll { overflow-x: auto; max-width: 100%; }
.lab-grid { border-collapse: separate; border-spacing: 2px; margin-top: 0.5rem; }
.lab-grid th { font-size: 0.66rem; color: var(--lab-faint); font-weight: 500; padding: 0 0.15rem; text-align: center; }
.lab-grid td { padding: 0; }
.lab-cellbtn {
  scroll-margin: 6rem 1rem;
  width: var(--lab-cell); height: var(--lab-cell); border-radius: 0.3rem; border: 1px solid transparent; font: inherit;
  font-size: 0.85rem; font-variant-numeric: tabular-nums; cursor: pointer; padding: 0; touch-action: none; position: relative;
}
.lab-cellbtn.is-window { box-shadow: inset 0 0 0 2px var(--lab-accent); }
.lab-cellbtn.is-hot { box-shadow: inset 0 0 0 3px var(--lab-focus); }
.lab-cellbtn.is-selected { box-shadow: inset 0 0 0 3px var(--lab-focus); }
.lab-cellbtn.is-pad { background-image: repeating-linear-gradient(45deg, rgba(255,255,255,0.08) 0 4px, transparent 4px 8px); }
.lab-cellbtn.is-stride-skip { opacity: 0.85; }
.lab-trace { margin-top: 1rem; }
.lab-terms { display: flex; flex-wrap: wrap; gap: 0.3rem; margin-top: 0.5rem; font-variant-numeric: tabular-nums; }
.lab-term { border: 1px solid var(--lab-line); background: var(--lab-bg); color: var(--lab-ink); border-radius: 0.35rem; padding: 0.25rem 0.45rem; font: inherit; font-size: 0.82rem; cursor: default; }
.lab-term.is-pad { color: var(--lab-faint); border-style: dashed; }
.lab-term:hover, .lab-term:focus-visible { border-color: var(--lab-focus); }
.lab-sum { margin-top: 0.5rem; font-size: 0.95rem; font-variant-numeric: tabular-nums; }
.lab-formula { margin-top: 0.75rem; font-size: 0.85rem; color: var(--lab-soft); font-variant-numeric: tabular-nums; }
.lab-msg { margin-top: 0.75rem; border-left: 3px solid var(--lab-neg); padding: 0.3rem 0.6rem; color: var(--lab-ink); background: rgba(245, 158, 91, 0.08); }
.lab-ok { border-left-color: #34d399; background: rgba(52, 211, 153, 0.08); }
.lab-challenge { margin-top: 1rem; border: 1px solid rgba(34, 195, 230, 0.35); border-radius: 0.6rem; padding: 0.85rem; background: rgba(34, 195, 230, 0.06); }
.lab-row { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; margin-top: 0.5rem; }
.lab-legend { display: flex; flex-wrap: wrap; gap: 0.75rem; font-size: 0.75rem; color: var(--lab-soft); margin-top: 0.5rem; }
.lab-swatch { display: inline-block; width: 0.8rem; height: 0.8rem; border-radius: 0.15rem; vertical-align: -0.1rem; margin-right: 0.25rem; border: 1px solid var(--lab-line); }
.lab-canvas { image-rendering: pixelated; width: 100%; max-width: 15rem; height: auto; border-radius: 0.4rem; border: 1px solid var(--lab-line); touch-action: none; }
.lab-pics { display: grid; gap: 0.75rem; grid-template-columns: repeat(auto-fit, minmax(10rem, 1fr)); margin-top: 0.5rem; }
.lab-note { font-size: 0.78rem; color: var(--lab-faint); }
.lab-error { margin: 0 0 0.75rem; color: #fbbf24; }
.lab-solution[hidden] { display: none; }
/* Instructor / projector mode: larger type, larger targets, stronger contrast. */
.lab.lab--projector { --lab-cell: 3.1rem; font-size: 1.12rem; --lab-panel: #0b111b; --lab-line: rgba(255,255,255,0.35); --lab-soft: #e5e7e2; --lab-faint: #c9ccc5; }
.lab.lab--projector .lab-cellbtn { font-size: 1.1rem; font-weight: 600; }
.lab.lab--projector .lab-term { font-size: 1rem; }
@media (max-width: 420px) { .lab { --lab-cell: 2.05rem; } .lab-cellbtn { font-size: 0.78rem; } }
@media (prefers-reduced-motion: reduce) { .lab * { transition: none !important; animation: none !important; } }
.lab-num.is-hot { box-shadow: 0 0 0 3px var(--lab-focus); border-color: var(--lab-focus); }
.lab-banner { margin-top: 0.75rem; border: 1px dashed rgba(253, 224, 71, 0.55); border-radius: 0.5rem; padding: 0.5rem 0.75rem; font-size: 0.9rem; }

/* C022 YOLO coordinate lab: only what lab-base.css lacks. */
.lab .yc-main, .lab .yc-grid { display: grid; gap: 0.75rem; margin-top: 1rem; grid-template-columns: minmax(0, 1fr); }
.lab .yc-main > *, .lab .yc-grid > * { min-width: 0; }
.lab .lab-panel + .lab-panel { margin-top: 0; }
.lab .yc-svg { display: block; width: 100%; height: auto; max-height: 65vh; border-radius: 0.4rem; border: 1px solid var(--lab-line); touch-action: none; background: #1d2a3b; }
.lab .yc-gl { stroke: rgba(255, 255, 255, 0.22); stroke-width: 1px; vector-effect: non-scaling-stroke; stroke-dasharray: 4 4; }
.lab .yc-axis { fill: #b6b9b2; font-family: system-ui, sans-serif; }
.lab .bx-body { fill: rgba(34, 195, 230, 0.12); stroke: #22c3e6; stroke-width: 3px; vector-effect: non-scaling-stroke; cursor: move; }
.lab .bx:focus .bx-body { stroke: #fde047; stroke-width: 4px; stroke-dasharray: 8 3; }
.lab .bx { outline: none; }
.lab .bx-handle { fill: #fde047; stroke: #0b111b; stroke-width: 1px; vector-effect: non-scaling-stroke; }
.lab .bx-nw, .lab .bx-se { cursor: nwse-resize; }
.lab .bx-ne, .lab .bx-sw { cursor: nesw-resize; }
.lab .yc-g { stroke: rgba(253, 224, 71, 0.55); stroke-width: 1.5px; vector-effect: non-scaling-stroke; stroke-dasharray: 6 4; pointer-events: none; }
.lab .yc-bar { stroke: #a7f3d0; stroke-dasharray: none; stroke-width: 2px; }
.lab .yc-g.is-linked { stroke: #fde047; stroke-width: 4px; stroke-dasharray: none; }
.lab .yc-dot { fill: #fde047; pointer-events: none; }
.lab .yc-ghost { fill: rgba(245, 158, 91, 0.12); stroke: #f59e5b; stroke-width: 3px; stroke-dasharray: 10 6; vector-effect: non-scaling-stroke; pointer-events: none; }
.lab .yc-tag { fill: #f59e5b; font-family: system-ui, sans-serif; font-weight: 600; paint-order: stroke; stroke: #0b111b; stroke-width: 3px; pointer-events: none; }
.lab .yc-steps { display: grid; grid-template-columns: minmax(0, 1fr); gap: 0.15rem 1rem; margin-top: 0.4rem; }
@media (min-width: 700px) { .lab .yc-steps { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); } }
.lab .yc-step { margin: 0; padding: 0.2rem 0.4rem; border-radius: 0.3rem; font: 0.8rem/1.45 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.lab .yc-step.is-linked, .lab .yc-row span.is-linked { background: rgba(253, 224, 71, 0.18); outline: 2px solid #fde047; }
.lab .yc-row { margin-top: 0.4rem; font: 600 1.05rem/1.4 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; background: var(--lab-bg); border: 1px solid var(--lab-line); border-radius: 0.4rem; padding: 0.45rem 0.6rem; overflow-wrap: anywhere; }
.lab .yc-row span { border-radius: 0.2rem; padding: 0 0.1rem; }
.lab .yc-bugrow { font-size: 0.9rem; }
.lab .yc-num { width: 5.6rem; }
.lab .yc-decin { min-width: 14rem; max-width: 100%; font-family: ui-monospace, monospace; }
.lab .yc-table { border-collapse: collapse; font-size: 0.8rem; font-variant-numeric: tabular-nums; margin-top: 0.5rem; }
.lab .yc-table th, .lab .yc-table td { text-align: left; padding: 0.3rem 0.5rem; border-bottom: 1px solid var(--lab-line); white-space: nowrap; }
.lab .yc-table thead th { color: var(--lab-soft); font-weight: 500; font-size: 0.72rem; }
.lab .yc-prompt { font-weight: 500; }
.lab .yc-main + .yc-grid { margin-top: 0.75rem; }
.lab > .lab-panel:not(:first-child) { margin-top: 0.75rem; }
.lab.lab--projector .yc-step { font-size: 1rem; }
.lab.lab--projector .yc-row { font-size: 1.35rem; }
.lab.lab--projector .yc-table { font-size: 1rem; }
