/* The page around the engine: the loading state, the plain message where the engine cannot run, and the lab's strip.
   Every value is a token of design/tokens.css; the fonts are the design system's own files. */
@font-face { font-family: 'Bricolage Grotesque'; font-weight: 200 800; font-display: swap; src: url('fonts/bricolage-grotesque-latin-opsz-normal.woff2') format('woff2'); }
@font-face { font-family: 'Atkinson Hyperlegible'; font-weight: 400; font-display: swap; src: url('fonts/atkinson-hyperlegible-latin-400-normal.woff2') format('woff2'); }
@font-face { font-family: 'Atkinson Hyperlegible'; font-weight: 700; font-display: swap; src: url('fonts/atkinson-hyperlegible-latin-700-normal.woff2') format('woff2'); }

html, body { margin: 0; height: 100%; overflow: hidden; background: var(--bg); color: var(--ink); }
body { font-family: var(--font-body); font-size: 17px; line-height: 1.55; -webkit-font-smoothing: antialiased; }
* { box-sizing: border-box; }
#page { display: flex; flex-direction: column; height: 100dvh; }
#stage { position: relative; flex: 1 1 auto; min-height: 0; overflow: hidden; }
#canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; outline: none; background: var(--bg); }
/* Inside the canvas the engine draws the design's focus outline on whatever holds the keys. */

#loading, #missing, #noscript {
  position: absolute; inset: 0; z-index: 2; background: var(--bg);
  display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center;
  gap: var(--space-3); padding: var(--space-6) var(--space-4);
}
#missing[hidden], #loading[hidden] { display: none; }
#loading h1, #missing h1, #noscript h1 { font-family: var(--font-display); font-weight: 700; font-size: var(--title); line-height: 1.12; letter-spacing: -0.01em; margin: 0; text-wrap: balance; }
#loading p, #missing p, #noscript p { margin: 0; color: var(--muted); max-width: 30rem; }
.lab-mark { font-family: var(--font-display); font-weight: 700; font-size: var(--heading); color: var(--accent) !important; letter-spacing: -0.01em; }
#loading-track { width: min(22rem, 100%); height: 10px; border-radius: var(--radius-pill); background: var(--surface-3); overflow: hidden; }
#loading-bar { display: block; height: 100%; width: 0; border-radius: inherit; background: var(--map-high); transition: width var(--motion); }
@media (prefers-reduced-motion: reduce) { #loading-bar { transition: none; } }

.k-hidden { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

/* The lab's strip, under the student's view and no part of it. */
#strip { flex: none; position: relative; background: var(--surface-2); border-top: 1px solid var(--line); font-size: var(--text-sm); }
#strip summary { min-height: var(--touch); display: flex; align-items: center; padding: 0 var(--space-4); color: var(--muted); font-weight: 700; cursor: pointer; }
#strip summary:focus-visible, #strip button:focus-visible { outline: 3px solid var(--focus); outline-offset: -3px; }
#strip-in { position: absolute; left: 0; right: 0; bottom: 100%; z-index: 5; max-height: 60dvh; overflow: auto; background: var(--surface); border-top: 1px solid var(--line); box-shadow: var(--shadow-2); padding: var(--space-4); display: flex; flex-direction: column; gap: var(--space-3); }
#strip-in h2 { font-family: var(--font-display); font-size: var(--text-lg); margin: 0; }
#strip-in p { margin: 0; color: var(--muted); }
#strip-in table { border-collapse: collapse; width: 100%; }
#strip-in th, #strip-in td { text-align: left; padding: var(--space-1) var(--space-2); border-bottom: 1px solid var(--line); vertical-align: top; overflow-wrap: anywhere; }
#strip-in th { color: var(--muted); font-size: var(--text-xs); }
#strip .row { display: flex; flex-wrap: wrap; gap: var(--space-2); }
#strip button { min-height: var(--touch); padding: 0 var(--space-5); border-radius: var(--radius-pill); border: 1.5px solid var(--line-strong); background: var(--surface); color: var(--ink); font: inherit; font-weight: 700; cursor: pointer; }
