* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: #0a0e17; overflow: hidden; overscroll-behavior: none; -webkit-user-select: none; user-select: none; -webkit-tap-highlight-color: transparent; }

/* The stage fills the screen; on a wide desktop window it stays phone-shaped. */
#stage {
  position: fixed; inset: 0; margin: 0 auto; width: 100vw; height: 100dvh;
  container-type: size; overflow: hidden; isolation: isolate; background: #070b14; color: #fff;
  font-family: -apple-system, system-ui, "Helvetica Neue", sans-serif;
  --cool: #8fe3d4; --warm: #f2b27c; --dim: rgba(255,255,255,.7);
  --fade: .5;   /* strength of the dark fade behind the text block */
}
@media (min-aspect-ratio: 1/1) { #stage { width: min(100vw, calc(100dvh * 9 / 19.5)); } }

#video, #backdrop, .tint, #overlay, #shadowCanvas { position: absolute; inset: 0; width: 100%; height: 100%; }
#shadowCanvas { pointer-events: none; }
#video { object-fit: cover; display: none; }
#stage.cam #video { display: block; }
#backdrop { background: linear-gradient(#1a2233, #0b101b 70%, #05070d); }
#stage.cam #backdrop { display: none; }
#stage.mirrored #video, #stage.mirrored #overlay, #stage.mirrored #shadowCanvas { transform: scaleX(-1); }

.tint.cool { background: linear-gradient(rgba(10,92,90,.34), rgba(10,92,90,.46)); box-shadow: inset 0 0 0 1.6cqw var(--cool), inset 0 0 12cqw 1cqw rgba(143,227,212,.55); }
.tint.warm { background: linear-gradient(rgba(190,96,30,.36), rgba(190,96,30,.5)); box-shadow: inset 0 0 0 1.6cqw var(--warm), inset 0 0 12cqw 1cqw rgba(242,178,124,.6); }
.tint.idle { background: rgba(9,14,28,.28); }

#overlay .skeleton line { stroke: #fff; stroke-width: .004; stroke-linecap: round; }
#overlay .skeleton circle { fill: #fff; }
#overlay .skeleton circle.head { fill: none; stroke: #fff; stroke-width: .004; }
#stage.demo #overlay .skeleton circle.head { stroke-width: .008; }
#overlay .skeleton { filter: drop-shadow(0 0 1.2px rgba(255,255,255,.7)); }
#stage.demo #overlay .skeleton line { stroke-width: .008; }
#overlay .target { stroke-width: .006; stroke-dasharray: .02 .015; stroke-linecap: butt; fill: none; }
#overlay .highlight { stroke: var(--warm); stroke-width: .009; stroke-linecap: round; }

/* The text block: one rule positions it, one custom property (--fade) sets the fade behind it. */
.info { position: absolute; left: 0; right: 0; bottom: 0; }
.info {
  padding: 10cqw 4cqw max(6cqw, env(safe-area-inset-bottom)); text-align: center; display: flex; flex-direction: column; align-items: center;
  background: linear-gradient(transparent, rgba(5,9,18,calc(var(--fade) * .5)) 40%, rgba(5,9,18,var(--fade)));
  text-shadow: 0 .3cqw 1.6cqw rgba(0,0,0,.75), 0 0 6cqw rgba(0,0,0,.5);
}
.ring { position: relative; flex: none; width: 44cqw; height: 44cqw; margin-bottom: -4cqw; filter: drop-shadow(0 .3cqw 1.4cqw rgba(0,0,0,.6)); }
.ring svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.ring span { position: absolute; inset: 0; display: grid; place-items: center; font-size: 27cqw; font-weight: 400; letter-spacing: -.02em; }
.ring span.glyph { font-size: 10cqw; opacity: .85; letter-spacing: 0; }
.eyebrow { font-size: 4.4cqw; font-weight: 600; letter-spacing: .2em; text-transform: uppercase; color: #fff; }
.eyebrow b { color: var(--c, #fff); font-weight: 600; }
.title { font-size: 13cqw; font-weight: 400; line-height: 1.05; letter-spacing: -.01em; margin-top: 1.2cqw; }
.body { font-size: 4.6cqw; line-height: 1.3; color: #fff; font-weight: 500; margin-top: 1.2cqw; }
.info .title { font-weight: 600; line-height: 1; letter-spacing: -.015em; margin-top: 1.5cqw; text-wrap: balance; }
.info .body { font-size: 5.4cqw; }
.info .ring { transition: none; }

#summary { position: absolute; left: 0; right: 0; bottom: 0; }
#summary {
  padding: 14cqw 6cqw max(6cqw, env(safe-area-inset-bottom)); text-align: center; display: flex; flex-direction: column; align-items: center;
  background: linear-gradient(transparent, rgba(5,9,18,calc(var(--fade) * 1.4)) 22%, rgba(5,9,18,calc(var(--fade) * 1.7)));
  text-shadow: 0 .3cqw 1.6cqw rgba(0,0,0,.75), 0 0 6cqw rgba(0,0,0,.5);
}
#summary[hidden], .screen[hidden], .switch[hidden], .badge[hidden], #startLine [hidden], #debug[hidden], #rec[hidden], [hidden].note, .save-box[hidden] { display: none; }
#stage.summary .info { display: none; }
#summary .stats { display: flex; gap: 12cqw; margin: 3cqw 0 3cqw; }
#summary .stats div { display: flex; flex-direction: column; align-items: center; }
#summary .stats b { font-size: 20cqw; font-weight: 300; line-height: 1; letter-spacing: -.02em; }
#summary .stats span { font-size: 3.5cqw; font-weight: 600; letter-spacing: .2em; text-transform: uppercase; color: var(--dim); margin-top: 1cqw; }
#summary .fault { font-size: 5cqw; font-weight: 500; }
#summary .session { font-size: 4.2cqw; color: var(--dim); margin-top: 1cqw; }
#summary .body { margin-top: 3cqw; }

.btn { font: inherit; font-size: 5cqw; font-weight: 600; color: #0a0e17; background: var(--cool); border: 0; border-radius: 99px; padding: 3.4cqw 9cqw; margin-top: 6cqw; text-shadow: none; cursor: pointer; }
.btn.small { font-size: 4cqw; padding: 2.4cqw 7cqw; margin-top: 4cqw; background: rgba(255,255,255,.16); color: #fff; }

.screen { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 10cqw; background: #070b14; }
.screen .name { font-size: 11cqw; font-weight: 300; letter-spacing: -.01em; }
.screen p { font-size: 4.8cqw; line-height: 1.4; color: var(--dim); margin: 4cqw 0 0; max-width: 80cqw; }

#debug { position: absolute; top: calc(max(2cqw, env(safe-area-inset-top)) + 10cqw); left: 2cqw; margin: 0; padding: 1.5cqw 2cqw; font: 3cqw/1.35 ui-monospace, Menlo, monospace; color: #cfe; background: rgba(0,0,0,.55); border-radius: 2cqw; pointer-events: none; }

.link { font: inherit; font-size: 3.8cqw; color: var(--dim); background: none; border: 0; text-decoration: underline; margin-top: 5cqw; padding: 2cqw; cursor: pointer; }

/* Exercise picker: the row on the start screen and the full-screen list. */
#start { justify-content: flex-start; overflow-y: auto; padding-top: max(8cqw, env(safe-area-inset-top)); }
#start .pick { margin-bottom: 8cqw; }
.pick, .pick-row { display: flex; align-items: center; gap: 3cqw; width: 100%; min-height: 52px; font: inherit; color: #fff; text-align: left; background: rgba(255,255,255,.1); border: 1px solid rgba(255,255,255,.22); border-radius: 4cqw; padding: 3cqw 4cqw; cursor: pointer; }
.pick-text { flex: 1; display: flex; flex-direction: column; gap: 1cqw; min-width: 0; }
.pick-name { font-size: 6.4cqw; font-weight: 500; letter-spacing: -.01em; display: flex; align-items: center; gap: 2.4cqw; }
.pick-place { font-size: 3.6cqw; line-height: 1.3; color: var(--dim); }
.pick-chev { font-size: 8cqw; color: var(--dim); line-height: 1; }
.badge { font-size: 2.8cqw; font-weight: 700; letter-spacing: .16em; text-transform: uppercase; color: var(--cool); border: 1px solid var(--cool); border-radius: 99px; padding: .5cqw 2cqw; }
#picker { justify-content: flex-start; align-items: stretch; overflow-y: auto; padding: max(8cqw, env(safe-area-inset-top)) 6cqw 8cqw; }
.picker-title { font-size: 8cqw; font-weight: 300; text-align: center; margin-bottom: 4cqw; }
.picker-group { text-align: left; font-size: 3.4cqw; font-weight: 600; letter-spacing: .2em; text-transform: uppercase; color: var(--dim); margin: 5cqw 0 2cqw 1cqw; }
.pick-row { margin-bottom: 2cqw; }
.pick-row.current { border-color: var(--cool); }
.pick-row .pick-name { font-size: 5cqw; }
.pick-row .pick-place { font-size: 3.4cqw; }

/* Recorders: start-screen switches, REC marker, save box on the end screen. */
.rec-options { display: flex; flex-direction: column; gap: 3cqw; margin-top: 6cqw; max-width: 80cqw; text-align: left; }
.switch { display: flex; align-items: center; gap: 3cqw; font-size: 4cqw; line-height: 1.3; color: var(--dim); cursor: pointer; }
.switch input { position: absolute; opacity: 0; pointer-events: none; }
.switch .track { flex: none; position: relative; width: 11cqw; height: 6.4cqw; border-radius: 99px; background: rgba(255,255,255,.18); transition: background .15s; }
.switch .track::after { content: ""; position: absolute; top: .8cqw; left: .8cqw; width: 4.8cqw; height: 4.8cqw; border-radius: 50%; background: #fff; transition: transform .15s; }
.switch input:checked + .track { background: var(--cool); }
.switch input:checked + .track::after { transform: translateX(4.6cqw); background: #0a0e17; }
.switch input:disabled + .track { opacity: .5; }
.switch:has(input:disabled) { cursor: default; opacity: .7; }
.switch input:focus-visible + .track { outline: 2px solid #fff; outline-offset: 2px; }
.note { font-size: 3.4cqw; line-height: 1.3; color: var(--dim); margin-top: 2cqw; max-width: 80cqw; }
#rec { position: absolute; top: max(2cqw, env(safe-area-inset-top)); right: 3cqw; padding: 1cqw 3cqw 1cqw 5cqw; font-size: 3.2cqw; font-weight: 700; letter-spacing: .18em; color: #fff; background: rgba(0,0,0,.45); border-radius: 99px; pointer-events: none; }
/* Always reachable while the camera is running, so a session can be ended (and a recording saved) even if setup never passes. */
#doneBtn { display: none; position: absolute; top: max(2cqw, env(safe-area-inset-top)); left: 3cqw; font: inherit; font-size: 3.6cqw; font-weight: 600; color: #fff; background: rgba(0,0,0,.45); border: 0; border-radius: 99px; padding: 1.6cqw 4cqw; cursor: pointer; }
#stage.cam #doneBtn { display: block; }
#rec::before { content: ""; position: absolute; left: 2cqw; top: 50%; width: 1.8cqw; height: 1.8cqw; margin-top: -.9cqw; border-radius: 50%; background: #ff5d5d; }
.save-box { display: flex; flex-direction: column; align-items: center; margin-top: 5cqw; width: 80cqw; }
.save-box textarea { display: block; box-sizing: border-box; width: 100%; resize: none; font: inherit; font-size: 4.2cqw; color: #fff; background: rgba(255,255,255,.1); border: 1px solid rgba(255,255,255,.25); border-radius: 3cqw; padding: 3cqw 4cqw; -webkit-user-select: text; user-select: text; }
.save-box textarea::placeholder { color: rgba(255,255,255,.45); }
.save-box .btn.small { margin-top: 3cqw; }

/* ?bench: the drawing-speed test switches one visual effect off at a time by putting one bx- class on the stage. */
#stage.bench #doneBtn { display: none; }
#messageTable { margin-top: 4cqw; border-collapse: collapse; font-size: 3.8cqw; font-variant-numeric: tabular-nums; }
#messageTable[hidden] { display: none; }
#messageTable th, #messageTable td { padding: .6cqw 3cqw; text-align: right; }
#messageTable th:first-child, #messageTable td:first-child { text-align: left; }
#stage.bx-no-skeleton-filter #overlay .skeleton { filter: none; }
#stage.bx-no-ring-filter .ring, #stage.bx-no-ring-filter #arc { filter: none !important; }
#stage.bx-no-text-shadow .info { text-shadow: none; }
#stage.bx-no-tint .tint, #stage.bx-bare .tint { display: none; }
#stage.bx-no-fade .info { background: none; }
#stage.bx-no-skeleton #overlay .skeleton { display: none; }
#stage.bx-no-shadow #shadowCanvas { display: none; }
/* bx-no-shadow-outline: screen.js skips the outline pass when it sees this class. */
#stage.bx-no-overlay #overlay, #stage.bx-bare #overlay, #stage.bx-no-overlay #shadowCanvas, #stage.bx-bare #shadowCanvas { display: none; }
#stage.bx-no-info .info, #stage.bx-bare .info { display: none; }

/* Set-up walkthrough: three diagrams and the steps, then "Got it". */
#start .guide-btn { margin: -4cqw 0 6cqw; }
#guide { justify-content: flex-start; align-items: stretch; overflow-y: auto; text-align: left; padding: max(5cqw, env(safe-area-inset-top)) 4cqw 6cqw; }
#guide .btn { align-self: center; margin-top: 4cqw; flex: none; }
#guideBody { display: flex; flex-direction: column; flex: none; }
.g-title { font-size: 5.4cqw; font-weight: 500; letter-spacing: -.01em; margin: 0 0 2cqw; text-align: center; }
.g-panel { margin-bottom: 1.5cqw; }
.g-cap { font-size: 3.4cqw; font-weight: 600; letter-spacing: .18em; text-transform: uppercase; color: var(--dim); margin-bottom: .5cqw; }
.g-panel svg { display: block; width: 100%; height: auto; background: rgba(255,255,255,.04); border-radius: 3cqw; font-family: inherit; }
.g-steps { margin: 2cqw 0 0; padding-left: 6cqw; font-size: 3.7cqw; line-height: 1.25; color: #fff; }
.g-steps li { margin-bottom: .8cqw; padding-left: 1cqw; }
