/* Draw Hands Blind: a riso sketchbook page. Thin ink lines, pen marks, tape, no filled panels. */

:root {
  --hu-ink: var(--ak-ink, #1A2B5C);
  --hu-muted: var(--ak-ink-muted, #5A6690);
  --hu-blue: var(--ak-accent, #2B59C3);
  --hu-sun: var(--ak-accent-2, #F5B700);
  --hu-paper: var(--ak-bg, #F4EFE4);
  --hu-slip: var(--ak-surface, #FBF7EC);
  --hu-green: color-mix(in srgb, var(--hu-blue) 42%, var(--hu-sun));
  --hu-grid: color-mix(in srgb, var(--hu-blue) 20%, transparent);
  --hu-tape: color-mix(in srgb, var(--hu-sun) 62%, transparent);
  --hu-wobble: 255px 15px 225px 15px / 15px 225px 15px 255px;
  --hu-wobble-2: 15px 225px 15px 255px / 225px 15px 255px 15px;
  --hu-margin: 72px;
  --hu-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --hu-ease: cubic-bezier(0.22, 1, 0.36, 1);
  --hu-chip: 48px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
}

body {
  overflow: hidden;
  background-color: var(--hu-paper);
  background-image: var(--ak-bg-art);
  background-size: var(--ak-bg-size);
  color: var(--hu-ink);
  font-family: var(--ak-font-body, system-ui);
  -webkit-tap-highlight-color: transparent;
}

button { font: inherit; color: inherit; }
[hidden] { display: none !important; }

/* ------------------------------------------------------------------ the page */

.hu-play {
  position: relative;
  display: grid;
  grid-template-columns: var(--hu-margin) minmax(0, 1fr);
  grid-template-rows: auto minmax(0, 1fr) auto auto;
  grid-template-areas:
    "margin note"
    "margin stage"
    "actions actions"
    "tools tools";
  column-gap: 10px;
  width: 100%;
  max-width: 1180px;
  height: 100vh;
  height: 100dvh;
  margin: 0 auto;
  padding:
    calc(var(--ac-status-h, 64px) + 2px)
    max(10px, env(safe-area-inset-right))
    max(6px, env(safe-area-inset-bottom))
    0;
  background-color: var(--hu-paper);
  background-image: var(--ak-backdrop-layer, linear-gradient(color-mix(in srgb, var(--hu-paper) 85%, transparent), color-mix(in srgb, var(--hu-paper) 85%, transparent)), url("./art/graph-page.jpg"));
  background-size: cover;
  background-position: left top;
  background-repeat: no-repeat;
  touch-action: manipulation;
  user-select: none;
  -webkit-user-select: none;
}

.hu-play[data-phase="idle"] > :not(.hu-margin) { visibility: hidden; }

/* ------------------------------------------------------------------ the margin */

.hu-margin {
  grid-area: margin;
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  min-height: 0;
  padding: 2px 6px 0 calc(env(safe-area-inset-left) + 5px);
}

.hu-logo {
  display: block;
  width: 100%;
  max-width: 120px;
  height: auto;
  rotate: -4deg;
}

.hu-mitt-wrap {
  width: 100%;
  max-width: 110px;
}

.hu-mitt {
  width: 100%;
  aspect-ratio: 128 / 163;
  background: url("./art/mitt-mascot.png") 0 0 / 300% 100% no-repeat;
  transform-origin: 50% 90%;
}
.hu-mitt[data-pose="peek"] { background-position: 0% 0; translate: 14% 0; rotate: 8deg; }
.hu-mitt[data-pose="cuff"] { background-position: 50% 0; }
.hu-mitt[data-pose="wave"] { background-position: 100% 0; }

.hu-count {
  position: relative;
  display: grid;
  place-items: center;
  width: 64px;
  height: 64px;
  margin-top: 4px;
  color: var(--hu-ink);
}
.hu-count-ring {
  position: absolute;
  inset: 0 0 8px;
  width: 100%;
  height: 56px;
  overflow: visible;
}
.hu-count-ring path,
.hu-count-tick path {
  fill: none;
  stroke: var(--hu-blue);
  stroke-width: 2.6;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-dasharray: 1;
  stroke-dashoffset: 0;
}
.hu-count-num {
  position: relative;
  margin-top: -10px;
  font-family: var(--ak-font-display, system-ui);
  font-size: 20px;
  line-height: 1;
}
.hu-count-word {
  position: absolute;
  bottom: -14px;
  left: 50%;
  translate: -50% 0;
  white-space: nowrap;
  font-size: 13px;
  font-weight: 600;
  color: var(--hu-ink);
}
.hu-count-tick {
  position: absolute;
  right: -14px;
  top: -8px;
  width: 30px;
  height: 22px;
  overflow: visible;
}
.hu-count-tick path { stroke: var(--hu-ink); stroke-width: 3; }

.hu-stamp {
  position: relative;
  width: min(100%, 96px);
  margin-top: auto;
  margin-bottom: 8px;
  aspect-ratio: 1;
  rotate: -11deg;
}
.hu-stamp svg { display: block; width: 100%; height: 100%; overflow: visible; }
.hu-stamp-ink circle,
.hu-stamp-ink path { fill: none; stroke: var(--hu-sun); stroke-width: 7; }
.hu-stamp-ink path { fill: color-mix(in srgb, var(--hu-sun) 75%, transparent); stroke-width: 4; stroke-linejoin: round; }
.hu-stamp-blue circle,
.hu-stamp-blue path { fill: none; stroke: var(--hu-blue); stroke-width: 2; stroke-linecap: round; opacity: 0.8; }
.hu-stamp-word {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 9%;
  text-align: center;
  font-family: var(--ak-font-display, system-ui);
  font-size: 13px;
  color: var(--hu-ink);
  letter-spacing: 0.06em;
}

/* ------------------------------------------------------------------ the note line */

.hu-note-wrap {
  grid-area: note;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  align-items: flex-start;
  gap: 4px;
  min-height: 52px;
  padding: 2px 4px 4px;
}

.hu-note {
  position: relative;
  margin: 0;
  max-width: 46ch;
  font-size: 18px;
  font-weight: 500;
  line-height: 1.3;
  color: var(--hu-ink);
}
.hu-note.is-wrong { padding-left: 26px; }
.hu-note.is-wrong::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0.2em;
  width: 18px;
  height: 18px;
  background:
    linear-gradient(45deg, transparent 44%, var(--hu-ink) 44% 58%, transparent 58%),
    linear-gradient(-45deg, transparent 44%, var(--hu-ink) 44% 58%, transparent 58%);
}

/* Teaching: a taped slip with solid backing, at least 18px, never on top of what it points at. */
.hu-note.is-guide {
  padding: 10px 14px 10px 14px;
  border: 2px solid var(--hu-ink);
  border-radius: var(--hu-wobble);
  background: var(--hu-slip);
  color: var(--hu-ink);
  font-size: 18px;
  rotate: -0.6deg;
}
.hu-note.is-guide::after {
  content: '';
  position: absolute;
  top: -9px;
  left: 18px;
  width: 54px;
  height: 16px;
  background: var(--hu-tape);
  rotate: -4deg;
}

/* ------------------------------------------------------------------ the sheet */

.hu-stage {
  grid-area: stage;
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  min-height: 0;
  min-width: 0;
  padding: 12px 4px 0;
}

.hu-sheet {
  position: relative;
  width: 100%;
  height: 100%;
  min-height: 0;
  background-color: var(--hu-paper);
  background-image:
    linear-gradient(to right, var(--hu-grid) 1px, transparent 1px),
    linear-gradient(to bottom, var(--hu-grid) 1px, transparent 1px);
  background-size: 22px 22px;
  background-position: 10px 10px;
  touch-action: none;
  outline: none;
  cursor: default;
}
.hu-play[data-phase="draw"] .hu-sheet { cursor: crosshair; }
.hu-sheet:focus-visible { box-shadow: 0 0 0 4px color-mix(in srgb, var(--hu-blue) 45%, transparent); }

.hu-border {
  position: absolute;
  inset: -4px;
  width: calc(100% + 8px);
  height: calc(100% + 8px);
  overflow: visible;
  pointer-events: none;
}
.hu-border path { fill: none; stroke-linecap: round; stroke-linejoin: round; }
.hu-border-ink { stroke: var(--hu-ink); stroke-width: 2.4; }
.hu-border-blue { stroke: color-mix(in srgb, var(--hu-blue) 55%, transparent); stroke-width: 1.6; translate: 1.5px 1px; }

.hu-tape {
  position: absolute;
  top: -13px;
  width: clamp(48px, 18%, 92px);
  height: 22px;
  background: var(--hu-tape);
  box-shadow: 1.5px 1px 0 color-mix(in srgb, var(--hu-green) 40%, transparent);
  pointer-events: none;
  z-index: 3;
}
.hu-tape-l { left: -14px; rotate: -32deg; }
.hu-tape-r { right: -14px; rotate: 30deg; }

.hu-timer {
  position: absolute;
  top: 10px;
  left: 16px;
  right: 16px;
  height: 6px;
  pointer-events: none;
  z-index: 2;
}
.hu-timer-line {
  display: block;
  height: 3px;
  margin-top: 1px;
  border-radius: 2px 1px 2px 1px;
  background: var(--hu-muted);
  transform: scaleX(var(--hu-left, 1));
  transform-origin: left center;
  opacity: 0;
}
.hu-play[data-phase="look"] .hu-timer-line { opacity: 1; }
.hu-puff {
  position: absolute;
  left: 0;
  top: 2px;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  opacity: 0;
  box-shadow:
    6px -4px 0 1px var(--hu-muted),
    12px 3px 0 0 var(--hu-muted),
    3px 7px 0 1px color-mix(in srgb, var(--hu-muted) 70%, transparent),
    -5px -2px 0 0 var(--hu-muted),
    16px -6px 0 0 color-mix(in srgb, var(--hu-muted) 60%, transparent);
}

.hu-look {
  position: absolute;
  inset: 22px 12px 12px;
  display: grid;
  place-items: center;
  container-type: size;
  pointer-events: none;
}
.hu-play:not([data-phase="look"]) .hu-look:not(.is-hiding) { visibility: hidden; }

.hu-hand {
  background-repeat: no-repeat;
  background-size: 300% 100%;
  background-position: var(--hu-cell, 0%) 0;
  background-image: var(--hu-sheet-art);
  aspect-ratio: var(--hu-ar, 0.75);
}
.hu-hand-big {
  width: min(96cqw, calc(96cqh * var(--hu-ar, 0.75)));
}

.hu-blind-word {
  position: absolute;
  top: 28px;
  left: 0;
  right: 0;
  margin: 0;
  padding: 0 16px;
  text-align: center;
  font-size: 20px;
  font-weight: 500;
  color: var(--hu-muted);
  pointer-events: none;
  opacity: 0;
}
.hu-play[data-phase="draw"] .hu-blind-word { opacity: 1; }

.hu-reveal {
  position: absolute;
  inset: 16px 8px 8px;
  display: grid;
  grid-template-columns: 1fr 1fr;
}
.hu-pane {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  margin: 0;
}
.hu-pane-line { border-left: 2px dashed color-mix(in srgb, var(--hu-ink) 55%, transparent); }
.hu-pane-box {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  display: grid;
  place-items: center;
  container-type: size;
}
.hu-pane-hand .hu-hand { width: min(90cqw, calc(90cqh * var(--hu-ar, 0.75))); }
.hu-pane-line { cursor: pointer; }
#lineCanvas { position: absolute; inset: 0; width: 100%; height: 100%; }
.hu-dots { position: absolute; inset: 0; pointer-events: none; }
.hu-dot {
  position: absolute;
  width: 14px;
  height: 14px;
  margin: -7px 0 0 -7px;
  border: 2px solid var(--hu-paper);
  border-radius: 50%;
  background: var(--hu-blue);
}
.hu-dot::after {
  content: '';
  position: absolute;
  inset: -6px;
  border: 2px solid var(--hu-blue);
  border-radius: 50%;
  opacity: 0;
}
.hu-tag {
  padding: 4px 2px 0;
  text-align: center;
  font-size: 15px;
  font-weight: 600;
  color: var(--hu-ink);
  text-decoration: underline wavy color-mix(in srgb, var(--hu-blue) 70%, transparent);
  text-underline-offset: 5px;
  text-decoration-thickness: 1.5px;
}

/* ------------------------------------------------------------------ the wall of prints */

.hu-wall {
  position: absolute;
  inset: 18px 10px 10px;
  display: grid;
  grid-template-rows: repeat(3, minmax(0, 1fr));
  gap: 16px;
}
.hu-print {
  position: relative;
  display: grid;
  margin: 0;
  grid-template-columns: 1fr 1fr;
  grid-template-rows: minmax(0, 1fr) auto;
  min-height: 0;
  padding: 6px 6px 0;
  background: var(--hu-slip);
  box-shadow: 0 3px 8px color-mix(in srgb, var(--hu-ink) 22%, transparent);
  rotate: var(--hu-tilt, 0deg);
}
.hu-print::before {
  content: '';
  position: absolute;
  top: -9px;
  left: 50%;
  width: 56px;
  height: 16px;
  translate: -50% 0;
  background: var(--hu-tape);
  rotate: -3deg;
}
.hu-print-box {
  position: relative;
  min-height: 0;
  display: grid;
  place-items: center;
  container-type: size;
}
.hu-print-box .hu-hand { width: min(90cqw, calc(90cqh * var(--hu-ar, 0.75))); }
.hu-print-box canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
.hu-print-box + .hu-print-box { border-left: 1.5px dashed color-mix(in srgb, var(--hu-ink) 45%, transparent); }
.hu-print-name {
  grid-column: 1 / -1;
  margin: 0;
  padding: 2px 4px 5px;
  text-align: center;
  font-size: 14px;
  font-weight: 600;
  color: var(--hu-ink);
}

/* ------------------------------------------------------------------ actions under the sheet */

.hu-actions {
  grid-area: actions;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  min-height: 56px;
  padding: 4px 2px 4px calc(env(safe-area-inset-left) + 8px);
}
.hu-kept {
  margin: 0;
  padding: 6px 2px 0;
  min-width: 0;
  text-align: right;
  font-size: 13px;
  line-height: 1.3;
  color: var(--hu-muted);
}
.hu-kept.is-wrong { color: var(--hu-ink); font-weight: 600; }

.hu-btn {
  flex: none;
  min-height: 48px;
  min-width: 48px;
  padding: 0 14px;
  border: 2px solid var(--hu-ink);
  border-radius: var(--hu-wobble);
  background: transparent;
  color: var(--hu-ink);
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  touch-action: manipulation;
}
.hu-btn:focus-visible,
.hu-chip:focus-visible,
.hu-modal button:focus-visible,
.hu-shelf button:focus-visible { outline: 3px solid var(--ak-focus, #2B59C3); outline-offset: 3px; }
.hu-again { rotate: 1deg; }
.hu-hint { rotate: -1.5deg; border-style: dashed; margin-right: auto; }
.hu-next {
  padding: 0 18px;
  background: var(--ak-choice-selected-bg, #F5B700);
  color: var(--ak-choice-selected-ink, #1A2B5C);
  font-family: var(--ak-font-display, system-ui);
  font-size: 15px;
  rotate: -1.5deg;
  box-shadow: 2px 2px 0 var(--hu-blue);
}

/* ------------------------------------------------------------------ the tool row */

.hu-tools {
  grid-area: tools;
  position: relative;
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  padding: 4px 0 0 calc(env(safe-area-inset-left) + 8px);
}
.hu-tools::before {
  content: '';
  position: absolute;
  top: 0;
  left: 6px;
  right: 0;
  height: 2px;
  background: color-mix(in srgb, var(--hu-ink) 70%, transparent);
  border-radius: 2px;
  rotate: -0.3deg;
}
.hu-tool-scroll {
  display: flex;
  gap: 12px;
  flex: 1 1 auto;
  min-width: 0;
  overflow-x: auto;
  overflow-y: hidden;
  padding: 10px 6px 8px 2px;
  scroll-snap-type: x proximity;
  scrollbar-width: thin;
  scrollbar-color: var(--hu-muted) transparent;
}
.hu-tools.has-more .hu-tool-scroll {
  -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 28px), transparent);
  mask-image: linear-gradient(to right, #000 calc(100% - 28px), transparent);
}
.hu-tools.has-more .hu-group-fixed::before {
  content: '';
  position: absolute;
  margin: 15px 0 0 -18px;
  width: 9px;
  height: 9px;
  border-top: 2.5px solid var(--hu-ink);
  border-right: 2.5px solid var(--hu-ink);
  rotate: 45deg;
  pointer-events: none;
}
.hu-group { display: flex; gap: 4px; flex: none; }
.hu-group-fixed { padding: 10px 0 8px; gap: 6px; }

.hu-chip {
  position: relative;
  display: grid;
  place-items: center;
  flex: none;
  width: var(--hu-chip);
  height: var(--hu-chip);
  padding: 0;
  border: 2px solid var(--hu-ink);
  border-radius: var(--hu-wobble);
  background: var(--hu-slip);
  color: var(--hu-ink);
  cursor: pointer;
  scroll-snap-align: start;
  touch-action: manipulation;
  transition: translate 180ms var(--hu-spring), rotate 180ms var(--hu-spring);
}
.hu-chip:nth-child(3n + 1) { rotate: -3deg; }
.hu-chip:nth-child(3n + 2) { rotate: 2deg; border-radius: var(--hu-wobble-2); }
.hu-chip:nth-child(3n) { rotate: -1deg; }
.hu-chip[aria-pressed="true"] {
  translate: 0 -5px;
  rotate: 0deg;
  border-width: 3px;
  border-color: var(--hu-blue);
}
.hu-chip[aria-pressed="true"]::after {
  content: '';
  position: absolute;
  left: 8px;
  right: 8px;
  bottom: -9px;
  height: 3px;
  border-radius: 2px;
  background: var(--hu-ink);
  rotate: -3deg;
}
.hu-chip-word {
  display: inline-flex;
  gap: 4px;
  width: auto;
  padding: 0 10px 0 6px;
  font-size: 15px;
  font-weight: 600;
}
.hu-chip-word svg { width: 22px; height: 22px; }
.hu-chip-word svg path { fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
.hu-chip-word[aria-disabled="true"] { border-style: dashed; color: var(--hu-muted); }

.hu-size-dot { display: block; border-radius: 50%; background: var(--hu-ink); }
.hu-swatch {
  display: block;
  width: 28px;
  height: 28px;
  border: 2px solid var(--hu-ink);
  border-radius: 52% 46% 55% 44% / 48% 55% 45% 52%;
  background: var(--hu-swatch, var(--hu-ink));
}
.hu-chip[aria-pressed="true"] .hu-swatch { outline: 2px solid var(--hu-ink); outline-offset: 3px; }

.hu-tools.is-locked .hu-tool-scroll .hu-chip {
  border-style: dashed;
  opacity: 0.5;
}
.hu-tools.is-locked .hu-tool-scroll .hu-chip[aria-pressed="true"] { opacity: 0.8; }

/* ------------------------------------------------------------------ guided first round */

.hu-guide { position: fixed; inset: 0; z-index: 25; pointer-events: none; }
.hu-guide-ring {
  position: fixed;
  border: 3px solid var(--hu-blue);
  border-radius: var(--hu-wobble);
}
.hu-guide-arrow {
  position: fixed;
  width: 34px;
  height: 42px;
  overflow: visible;
}
.hu-guide-arrow path { fill: none; stroke: var(--hu-ink); stroke-width: 3.2; stroke-linecap: round; stroke-linejoin: round; }

/* ------------------------------------------------------------------ in-page sheets */

.hu-modal {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: max(16px, env(safe-area-inset-top)) 16px max(16px, env(safe-area-inset-bottom));
  background: color-mix(in srgb, var(--hu-paper) 72%, transparent);
}
.hu-modal-panel {
  position: relative;
  width: min(100%, 440px);
  max-height: 100%;
  overflow-y: auto;
  padding: 26px 22px 18px;
  border: 2px solid var(--hu-ink);
  border-radius: var(--hu-wobble);
  background: var(--hu-slip);
  color: var(--hu-ink);
  rotate: -1deg;
}
.hu-modal-panel::before {
  content: '';
  position: absolute;
  top: -11px;
  left: 50%;
  width: 88px;
  height: 22px;
  translate: -50% 0;
  background: var(--hu-tape);
  rotate: 3deg;
}
.hu-modal-title {
  margin: 0 0 8px;
  font-family: var(--ak-font-display, system-ui);
  font-weight: var(--ak-title-weight, 400);
  font-size: 20px;
  line-height: 1.2;
}
.hu-modal-text { margin: 0 0 14px; font-size: 17px; line-height: 1.4; }
.hu-modal-art {
  display: grid;
  grid-template-columns: 1fr 1fr;
  height: min(46dvh, 320px);
  margin: 4px 0 12px;
}
.hu-modal-art .hu-print-box + .hu-print-box { border-left: 2px dashed color-mix(in srgb, var(--hu-ink) 50%, transparent); }
.hu-modal-actions { display: flex; flex-wrap: wrap; gap: 10px; justify-content: flex-end; }
.hu-modal-actions .hu-btn.is-main {
  background: var(--ak-btn-fill, #2B59C3);
  color: var(--ak-btn-ink, #F4EFE4);
  border-color: var(--hu-ink);
}

/* ------------------------------------------------------------------ the round summary (chrome.js's ending card)
   chrome.js is shared, so its ending is shaped here. Its layer centres the card with justify-content, which
   pushes a too-tall card off the top where it can't be scrolled to; auto margins centre it only while it fits,
   and the layer scrolls once it doesn't. `:root` outranks the chrome's own rules, which load after this sheet. */

:root #activity-chrome-ending.site-inspicacity { justify-content: flex-start; }
:root #activity-chrome-ending.site-inspicacity .ac-card { flex: none; margin-block: auto; }

/* A phone on its side: a tighter card and a shorter print, so the title and both buttons fit on one screen. */
@media (orientation: landscape) and (max-height: 620px) {
  :root #activity-chrome-ending.site-inspicacity {
    padding:
      max(18px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right))
      max(12px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
  }
  :root #activity-chrome-ending.site-inspicacity .ac-card {
    width: min(100%, 600px);
    gap: 6px;
    padding: 22px 18px 12px;
  }
  :root #activity-chrome-ending.site-inspicacity .ac-card::before { top: 6px; width: 12px; height: 12px; }
  :root #activity-chrome-ending.site-inspicacity .ac-number { font-size: 16px; line-height: 1.2; }
  :root #activity-chrome-ending.site-inspicacity .ac-verdict { font-size: clamp(20px, 6dvh, 28px); line-height: 1.15; }
  :root #activity-chrome-ending.site-inspicacity .ac-lines { font-size: 15px; line-height: 1.3; }
  :root #activity-chrome-ending.site-inspicacity .ac-line { margin: 0 0 2px; }
  :root #activity-chrome-ending.site-inspicacity .ac-work { margin: 2px 0; border-width: 6px; border-bottom-width: 14px; }
  :root #activity-chrome-ending.site-inspicacity .ac-work::before,
  :root #activity-chrome-ending.site-inspicacity .ac-work::after { top: -12px; width: 48px; height: 16px; }
  :root #activity-chrome-ending.site-inspicacity .ac-work::before { left: -22px; }
  :root #activity-chrome-ending.site-inspicacity .ac-work::after { right: -22px; }
  :root #activity-chrome-ending.site-inspicacity .ac-work img { width: auto; max-height: max(80px, min(50vh, calc(100dvh - 280px))); }
}

/* ------------------------------------------------------------------ the shelf on the start screen */

.hu-shelf {
  width: 100%;
  margin: 10px 0 6px;
  text-align: left;
  color: var(--hu-ink);
}
.hu-shelf-title {
  margin: 0 0 6px;
  font-family: var(--ak-font-display, system-ui);
  font-weight: var(--ak-title-weight, 400);
  font-size: 16px;
}
.hu-shelf-row {
  display: flex;
  gap: 14px;
  overflow-x: auto;
  padding: 10px 4px 10px;
  scrollbar-width: thin;
}
.hu-shelf-set {
  display: flex;
  gap: 4px;
  flex: none;
  padding: 6px 6px 4px;
  border: 1.5px dashed color-mix(in srgb, var(--hu-ink) 60%, transparent);
  border-radius: var(--hu-wobble-2);
}
.hu-shelf-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  width: 92px;
  min-height: 48px;
  padding: 4px 4px 3px;
  border: 2px solid var(--hu-ink);
  border-radius: var(--hu-wobble);
  background: var(--hu-slip);
  cursor: pointer;
}
.hu-shelf-item:nth-child(even) { rotate: 1.5deg; }
.hu-shelf-item:nth-child(odd) { rotate: -1.5deg; }
.hu-shelf-item canvas { display: block; width: 80px; height: 56px; }
.hu-shelf-item span { font-size: 12px; font-weight: 600; line-height: 1.15; text-align: center; }
.hu-shelf-empty, .hu-shelf-kept { margin: 0; font-size: 14px; color: var(--hu-muted); }
.hu-shelf-kept { margin-top: 4px; font-size: 13px; }

/* ------------------------------------------------------------------ sideways: sheet on one side, notes and actions on the other */

@media (orientation: landscape) {
  /* The board takes the whole height on the left; words, buttons and tools stack on the right. */
  .hu-play {
    grid-template-columns: var(--hu-margin) minmax(0, 1fr) clamp(320px, 40%, 420px);
    grid-template-rows: minmax(0, 1fr) auto auto;
    grid-template-areas:
      "margin stage note"
      "margin stage actions"
      "margin stage tools";
  }
  .hu-note-wrap { justify-content: flex-start; padding-top: 6px; min-height: 0; overflow-y: auto; }
  .hu-actions { flex-wrap: wrap; align-content: flex-end; justify-content: flex-start; gap: 8px; min-height: 0; margin: 0; padding: 4px 0 2px; }
  .hu-actions .hu-next { margin-left: auto; }

  /* The tools wrap into a block. Outside the look only the brush and colour in use stay, locked,
     beside Undo and Clear, so the column never has to scroll. Undo has nothing to do during the look. */
  .hu-tools {
    flex-wrap: wrap;
    align-content: flex-end;
    gap: 6px 5px;
    padding: 10px 0 4px;
  }
  .hu-tools::before { left: 0; }
  .hu-tool-scroll, #sizes, #colours { display: contents; }
  .hu-tools .hu-chip { width: 46px; height: 46px; }
  .hu-tools .hu-chip-word {
    flex-direction: column;
    gap: 0;
    width: 52px;
    padding: 2px 0 0;
    font-size: 13px;
    line-height: 1.1;
  }
  .hu-chip-word svg { width: 20px; height: 20px; }
  .hu-tools .hu-group-fixed { margin-left: 0; padding: 0 0 0 9px; gap: 5px; }
  .hu-tools .hu-group-fixed::after { top: 4px; bottom: 4px; }
  .hu-tools.has-more .hu-group-fixed::before { display: none; }
  .hu-play[data-phase="look"] #undo,
  .hu-play[data-phase="practice"] #undo { display: none; }
  .hu-tools.is-locked .hu-chip:not(.hu-chip-word):not([aria-pressed="true"]) { display: none; }
  .hu-wall { grid-template-rows: none; grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .hu-print { grid-template-columns: 1fr; grid-template-rows: minmax(0, 1fr) minmax(0, 1fr) auto; }
  .hu-print-box + .hu-print-box { border-left: 0; border-top: 1.5px dashed color-mix(in srgb, var(--hu-ink) 45%, transparent); }
  .hu-margin { gap: 6px; }
  .hu-logo { max-width: 104px; }
  .hu-mitt-wrap { max-width: 84px; }
}

@media (orientation: landscape) and (max-height: 520px) {
  .hu-note { font-size: 18px; line-height: 1.25; }
  .hu-note.is-guide { padding: 8px 12px; }
  .hu-stage { padding-top: 12px; }
  .hu-margin { gap: 4px; }
  .hu-count { width: 52px; height: 50px; margin-top: 0; }
  .hu-count-ring { height: 46px; }
  .hu-count-num { font-size: 17px; }
  .hu-count-word { bottom: -10px; font-size: 12px; }
  .hu-stamp { width: min(100%, 74px); }
  .hu-mitt-wrap { max-width: 54px; }
  .hu-logo { max-width: 78px; }
  .hu-actions { min-height: 0; gap: 6px; }
}

@media (orientation: landscape) and (min-height: 521px) {
  .hu-wall { grid-template-columns: none; grid-template-rows: repeat(3, minmax(0, 1fr)); }
  .hu-print { grid-template-columns: 1fr 1fr; grid-template-rows: minmax(0, 1fr) auto; }
  .hu-print-box + .hu-print-box { border-top: 0; border-left: 1.5px dashed color-mix(in srgb, var(--hu-ink) 45%, transparent); }
}

@media (max-width: 370px) {
  .hu-note { font-size: 18px; }
  .hu-btn { padding: 0 10px; font-size: 15px; }
  .hu-next { font-size: 13px; padding: 0 12px; }
}

/* ------------------------------------------------------------------ motion */

@media (prefers-reduced-motion: no-preference) {
  :root:not(.ac-still) .hu-mitt-wrap { animation: hu-bob 3.4s ease-in-out infinite; }
  :root:not(.ac-still) .hu-mitt.is-pose { animation: hu-squash 520ms var(--hu-spring); }
  :root:not(.ac-still) .hu-tape { animation: hu-flutter 5s ease-in-out infinite; }
  :root:not(.ac-still) .hu-tape-r { animation-delay: -2.2s; }

  :root:not(.ac-still) .hu-chip:active,
  :root:not(.ac-still) .hu-btn:active,
  :root:not(.ac-still) .hu-shelf-item:active { scale: 0.92 0.88; }
  :root:not(.ac-still) .is-pop { animation: hu-pop 300ms var(--hu-spring); }
  :root:not(.ac-still) .is-nope { animation: hu-nope 360ms ease-in-out; }

  :root:not(.ac-still) .hu-look.is-entering .hu-hand-big { animation: hu-hand-in 560ms var(--hu-spring) both; }
  :root:not(.ac-still) .hu-look.is-hiding .hu-hand-big { animation: hu-hand-out 520ms var(--hu-ease) both; }
  :root:not(.ac-still) .hu-puff.is-puff { animation: hu-puff 620ms var(--hu-ease) both; }
  :root:not(.ac-still) .hu-play[data-phase="draw"] .hu-blind-word { animation: hu-write 700ms var(--hu-ease) both; }
  :root:not(.ac-still) .hu-note.is-new { animation: hu-write 460ms var(--hu-ease) both; }

  :root:not(.ac-still) .hu-reveal.is-opening .hu-pane-hand { animation: hu-slide-in-l 520ms var(--hu-spring) both; }
  :root:not(.ac-still) .hu-reveal.is-opening .hu-pane-line { animation: hu-slide-in-r 520ms var(--hu-spring) both; }
  :root:not(.ac-still) .hu-dot.is-live::after { animation: hu-ping 900ms ease-out infinite; }
  :root:not(.ac-still) .hu-dot { animation: hu-dot-in 280ms var(--hu-spring) both; }

  :root:not(.ac-still) .hu-count.is-drawing .hu-count-ring path { animation: hu-ink 620ms var(--hu-ease) both; }
  :root:not(.ac-still) .hu-count.is-drawing .hu-count-tick path { animation: hu-ink 320ms 560ms var(--hu-ease) both; }
  :root:not(.ac-still) .hu-count.is-drawing .hu-count-num { animation: hu-pop 420ms 200ms var(--hu-spring) both; }

  :root:not(.ac-still) .hu-next.is-ready { animation: hu-nudge 2.6s 1.2s ease-in-out infinite; }
  :root:not(.ac-still) .hu-guide-ring { animation: hu-ring 1.3s ease-in-out infinite; }
  :root:not(.ac-still) .hu-guide-arrow { animation: hu-arrow 1.1s ease-in-out infinite; }

  :root:not(.ac-still) .hu-print { animation: hu-pin 560ms var(--hu-spring) both; animation-delay: var(--hu-delay, 0ms); }
  :root:not(.ac-still) .hu-stamp.is-landing { animation: hu-stamp 640ms var(--hu-delay, 0ms) cubic-bezier(0.3, 1.4, 0.5, 1) both; }
  :root:not(.ac-still) .hu-burst { animation: hu-burst 1100ms var(--hu-ease) both; animation-delay: var(--hu-delay, 0ms); }
}

.hu-burst {
  position: fixed;
  z-index: 26;
  width: 22px;
  height: 22px;
  margin: -11px 0 0 -11px;
  pointer-events: none;
  opacity: 0;
}
.hu-burst path { fill: none; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }

@keyframes hu-bob { 0%, 100% { translate: 0 0; } 50% { translate: 0 -4px; } }
@keyframes hu-flutter { 0%, 100% { scale: 1 1; } 50% { scale: 1.02 0.94; } }
@keyframes hu-squash {
  0% { scale: 1 1; }
  30% { scale: 1.14 0.84; }
  60% { scale: 0.94 1.08; }
  100% { scale: 1 1; }
}
@keyframes hu-pop {
  0% { scale: 1; }
  35% { scale: 1.16 0.86; }
  70% { scale: 0.95 1.06; }
  100% { scale: 1; }
}
@keyframes hu-nope {
  0%, 100% { translate: 0 0; }
  20% { translate: -5px 0; }
  45% { translate: 5px 0; }
  70% { translate: -3px 0; }
}
@keyframes hu-hand-in {
  from { opacity: 0; transform: translateY(30px) scale(0.86) rotate(4deg); }
  to { opacity: 1; transform: none; }
}
@keyframes hu-hand-out {
  0% { transform: none; opacity: 1; }
  30% { transform: translateX(4%) scale(1.03, 0.97); opacity: 1; }
  100% { transform: translateX(-120%) rotate(-12deg); opacity: 0; }
}
@keyframes hu-puff {
  0% { opacity: 0.9; scale: 0.4; }
  100% { opacity: 0; scale: 2.6; translate: 4px -6px; }
}
@keyframes hu-write {
  from { clip-path: inset(0 100% 0 0); }
  to { clip-path: inset(0 0 0 0); }
}
@keyframes hu-slide-in-l { from { opacity: 0; transform: translateX(-24px) rotate(-3deg); } to { opacity: 1; transform: none; } }
@keyframes hu-slide-in-r { from { opacity: 0; transform: translateX(24px) rotate(3deg); } to { opacity: 1; transform: none; } }
@keyframes hu-ping {
  0% { opacity: 0.9; scale: 0.6; }
  100% { opacity: 0; scale: 1.7; }
}
@keyframes hu-dot-in { from { scale: 0; } to { scale: 1; } }
@keyframes hu-ink { from { stroke-dashoffset: 1; } to { stroke-dashoffset: 0; } }
@keyframes hu-nudge {
  0%, 82%, 100% { translate: 0 0; }
  88% { translate: 0 -4px; }
  94% { translate: 0 1px; }
}
@keyframes hu-ring {
  0%, 100% { scale: 1; opacity: 1; }
  50% { scale: 1.04; opacity: 0.55; }
}
@keyframes hu-arrow { 0%, 100% { translate: 0 -4px; } 50% { translate: 0 4px; } }
@keyframes hu-pin {
  0% { opacity: 0; transform: translateY(-46px) rotate(10deg) scale(1.1); }
  65% { opacity: 1; transform: translateY(4px) rotate(-2deg) scale(0.98, 1.02); }
  100% { opacity: 1; transform: none; }
}
@keyframes hu-stamp {
  0% { opacity: 0; scale: 2.4; rotate: -30deg; }
  55% { opacity: 1; scale: 0.88 0.82; rotate: -7deg; }
  72% { scale: 1.06; rotate: -14deg; }
  86% { rotate: -9deg; }
  100% { opacity: 1; scale: 1; rotate: -11deg; }
}
@keyframes hu-burst {
  0% { opacity: 0; transform: translate(0, 0) scale(0.3) rotate(0deg); }
  15% { opacity: 1; }
  100% { opacity: 0; transform: translate(var(--hu-dx), var(--hu-dy)) scale(1.1) rotate(var(--hu-spin)); }
}

/* A narrow phone upright: Undo and Clear stack their word under the mark, so more colours show in the row. */
/* Every tool gets room. One row when there is width for it, with Undo and Clear fenced off by a ruled
   divider. Upright on a phone the row splits in two: brushes on the left with Undo and Clear set well
   apart on the right, and the eight colours on their own line underneath, so no chip scrolls under another. */
.hu-group { gap: 8px; }
.hu-group-fixed {
  position: relative;
  margin-left: 6px;
  padding-left: 14px;
  gap: 10px;
}
.hu-group-fixed::after {
  content: '';
  position: absolute;
  left: 0;
  top: 8px;
  bottom: 6px;
  border-left: 2px dashed color-mix(in srgb, var(--hu-ink) 65%, transparent);
}

@media (orientation: portrait) and (max-width: 760px) {
  .hu-tools {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    grid-template-areas:
      "sizes . fixed"
      "colours colours colours";
    gap: 2px 0;
    padding: 4px 4px 0 calc(env(safe-area-inset-left) + 4px);
  }
  .hu-tool-scroll { display: contents; }
  #sizes { grid-area: sizes; gap: 10px; padding: 10px 0 8px 4px; }
  .hu-group-fixed { grid-area: fixed; margin-left: 0; padding: 10px 2px 8px 16px; gap: 12px; }
  .hu-chip-word { min-width: 64px; justify-content: center; padding: 0 8px 0 6px; }
  #colours {
    grid-area: colours;
    display: flex;
    gap: 5px;
    min-width: 0;
    /* Its own width never widens the row: the colours fit or scroll. */
    contain: inline-size;
    overflow-x: auto;
    overflow-y: hidden;
    padding: 10px 2px 10px;
    scroll-snap-type: x proximity;
    scrollbar-width: none;
  }
  #colours .hu-chip { flex: 1 0 44px; width: auto; max-width: 60px; height: 46px; }
  .hu-tools.has-more #colours {
    -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 28px), transparent);
    mask-image: linear-gradient(to right, #000 calc(100% - 28px), transparent);
  }
  .hu-tools.has-more .hu-group-fixed::before { display: none; }
}
@media (orientation: portrait) and (max-width: 380px) {
  #sizes { gap: 6px; }
  .hu-group-fixed { padding-left: 12px; gap: 8px; }
  .hu-chip-word { min-width: 0; padding: 0 6px 0 4px; }
}

/* Check: the line on its own, the hand still under a taped flap until the player keeps the line. */
.hu-flap {
  position: absolute;
  inset: 8% 10%;
  display: none;
  place-items: center;
  border: 2px dashed color-mix(in srgb, var(--hu-ink) 60%, transparent);
  border-radius: var(--hu-wobble-2);
  background:
    repeating-linear-gradient(135deg, transparent 0 9px, color-mix(in srgb, var(--hu-blue) 16%, transparent) 9px 10.5px),
    var(--hu-paper);
}
.hu-flap::before {
  content: '';
  position: absolute;
  top: -10px;
  left: 50%;
  width: 52px;
  height: 18px;
  translate: -50% 0;
  background: var(--hu-tape);
  rotate: -4deg;
}
.hu-flap-word {
  padding: 4px 8px;
  background: var(--hu-paper);
  color: var(--hu-ink);
  font-size: 15px;
  font-weight: 600;
  text-align: center;
}
.hu-reveal.is-checking .hu-flap { display: grid; }
.hu-reveal.is-checking .hu-pane-hand .hu-hand { visibility: hidden; }
.hu-reveal.is-checking .hu-tag-hand { color: var(--hu-muted); }

/* While a sheet or the help is open the look clock stops, and the hand hides with it. */
.hu-held-word {
  position: absolute;
  inset: 0;
  display: none;
  place-items: center;
  margin: 0;
  padding: 0 16px;
  text-align: center;
  font-size: 20px;
  font-weight: 500;
  color: var(--hu-muted);
  pointer-events: none;
}
.hu-play[data-phase="look"].is-held .hu-look { visibility: hidden !important; }
.hu-play[data-phase="look"].is-held .hu-held-word { display: grid; }

/* ------------------------------------------------------------------ the pen, while drawing blind
   The line stays hidden, but the page says the pen is down and how far it has run, so one long
   stroke is something the player can feel happening. */
.hu-pen {
  position: absolute;
  left: 16px;
  right: 16px;
  bottom: 14px;
  display: none;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  pointer-events: none;
  text-align: center;
}
.hu-play[data-phase="draw"] .hu-pen { display: flex; }
.hu-pen-bar {
  position: relative;
  width: min(100%, 260px);
  height: 6px;
  border: 1.5px solid color-mix(in srgb, var(--hu-ink) 60%, transparent);
  border-radius: 4px 2px 4px 2px;
  visibility: hidden;
}
.hu-pen.is-down .hu-pen-bar { visibility: visible; }
.hu-pen-fill {
  position: absolute;
  inset: 0;
  background: var(--hu-blue);
  transform: scaleX(var(--hu-run, 0));
  transform-origin: left center;
}
.hu-pen-word {
  max-width: 34ch;
  padding: 2px 8px;
  background: color-mix(in srgb, var(--hu-paper) 88%, transparent);
  color: var(--hu-ink);
  font-size: 16px;
  font-weight: 500;
  line-height: 1.3;
}
.hu-pen.is-down .hu-pen-word { font-weight: 600; }
@media (orientation: landscape) and (max-height: 520px) {
  .hu-pen { bottom: 8px; gap: 4px; }
  .hu-pen-word { font-size: 15px; }
}

/* A first-time hand or a best yet gets a sunflower tag on its print. */
.hu-print-tag {
  display: inline-block;
  margin-left: 4px;
  padding: 0 6px;
  background: var(--hu-tape);
  color: var(--hu-ink);
  font-size: 12px;
  font-weight: 600;
  rotate: -3deg;
}

/* Locked tools look and read locked. Progression buttons sit clear of the tool row. */
.hu-chip[aria-disabled="true"] { cursor: not-allowed; }
.hu-actions { margin-bottom: 6px; }

/* ------------------------------------------------------------------ the end: prints in full view, the card docked
   The chrome's ending card leaves the work alone: under the prints when upright, beside them when
   sideways. Its own small copy of the work is not needed, the real prints are right there. */
.hu-play[data-phase="done"] {
  grid-template-columns: var(--hu-margin) minmax(0, 1fr);
  grid-template-rows: minmax(0, 1fr);
  grid-template-areas: "margin stage";
  padding-bottom: calc(var(--hu-dock-h, 250px) + max(6px, env(safe-area-inset-bottom)));
}
.hu-play[data-phase="done"] .hu-note-wrap,
.hu-play[data-phase="done"] .hu-actions,
.hu-play[data-phase="done"] .hu-tools { display: none; }

:root #activity-chrome-ending.site-inspicacity.hu-docked {
  inset: auto 0 0 0;
  max-height: 60dvh;
  justify-content: flex-end;
  padding: 0 max(10px, env(safe-area-inset-right)) max(8px, env(safe-area-inset-bottom)) max(10px, env(safe-area-inset-left));
  background: none;
  pointer-events: none;
}
:root #activity-chrome-ending.site-inspicacity.hu-docked .ac-card {
  width: min(100%, 560px);
  margin: 0 auto;
  gap: 6px;
  padding: 22px 16px 12px;
  box-shadow: 3px 3px 0 var(--ak-ink);
  pointer-events: auto;
}
:root #activity-chrome-ending.site-inspicacity.hu-docked .ac-card::before { top: 6px; width: 12px; height: 12px; }
:root #activity-chrome-ending.site-inspicacity.hu-docked .ac-work { display: none; }
:root #activity-chrome-ending.site-inspicacity.hu-docked .ac-number { font-size: 14px; line-height: 1.2; }
:root #activity-chrome-ending.site-inspicacity.hu-docked .ac-verdict { font-size: clamp(15px, 4.4vw, 26px); line-height: 1.15; }
:root #activity-chrome-ending.site-inspicacity.hu-docked .ac-lines { font-size: 15px; line-height: 1.3; }
:root #activity-chrome-ending.site-inspicacity.hu-docked .ac-line { margin: 0 0 2px; }
:root #activity-chrome-ending.site-inspicacity.hu-docked .ac-actions { gap: 10px; margin-top: 2px; }
:root #activity-chrome-ending.site-inspicacity.hu-docked .ac-actions { flex-wrap: nowrap; }
:root #activity-chrome-ending.site-inspicacity.hu-docked .ac-actions button {
  min-height: 48px;
  padding: 0 14px;
  font-family: var(--ak-font-body, system-ui);
  font-size: 16px;
  font-weight: 600;
  letter-spacing: 0;
  text-transform: none;
}

@media (orientation: landscape) {
  .hu-play[data-phase="done"] {
    --hu-dock-w: min(42vw, 360px);
    padding-bottom: max(8px, env(safe-area-inset-bottom));
    padding-right: calc(var(--hu-dock-w) + max(18px, env(safe-area-inset-right)));
  }
  :root #activity-chrome-ending.site-inspicacity.hu-docked {
    inset: calc(var(--ac-status-h, 64px) + 6px) max(8px, env(safe-area-inset-right)) 0 auto;
    width: min(42vw, 360px);
    max-height: none;
    justify-content: flex-start;
    padding: 6px 2px max(8px, env(safe-area-inset-bottom));
  }
  :root #activity-chrome-ending.site-inspicacity.hu-docked .ac-card { width: 100%; margin: auto 0; }
}
@media (orientation: landscape) and (max-height: 520px) {
  :root #activity-chrome-ending.site-inspicacity.hu-docked .ac-card { padding: 18px 12px 10px; gap: 4px; }
  :root #activity-chrome-ending.site-inspicacity.hu-docked .ac-lines { font-size: 14px; line-height: 1.3; }
  :root #activity-chrome-ending.site-inspicacity.hu-docked .ac-verdict { font-size: clamp(18px, 6dvh, 24px); }
  :root #activity-chrome-ending.site-inspicacity.hu-docked .ac-actions { gap: 6px; }
}

/* The smallest phones: the status chips stay on one row, so the sheet keeps its height. */
@media (max-width: 380px) {
  :root #activity-chrome-status.site-inspicacity { gap: 8px; }
  :root #activity-chrome-status.site-inspicacity > * { padding: 4px 9px; font-size: 13px; letter-spacing: 0; }
}

/* ------------------------------------------------------------------ how to draw: the demo on the blank sheet
   A fingertip presses, traces a mitten's outline without lifting, then lifts. It is a different shape
   from any hand, so it shows the gesture without giving the answer away. Gone the moment the finger lands. */
.hu-demo {
  position: absolute;
  inset: 62px 14px 64px;
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  pointer-events: none;
}
.hu-play[data-phase="draw"].has-demo .hu-demo { display: flex; }
.hu-play.has-demo .hu-pen:not(.is-down) .hu-pen-word { visibility: hidden; }
.hu-demo-art {
  width: min(62%, 220px);
  max-height: calc(100% - 96px);
  aspect-ratio: 1;
  overflow: visible;
}
.hu-demo-guide,
.hu-demo-line { fill: none; stroke-linecap: round; stroke-linejoin: round; }
.hu-demo-guide { stroke: color-mix(in srgb, var(--hu-blue) 35%, transparent); stroke-width: 2; stroke-dasharray: 3 7; }
.hu-demo-line { stroke: var(--hu-blue); stroke-width: 5; }
.hu-demo-tip { fill: var(--hu-sun); stroke: var(--hu-ink); stroke-width: 2.5; }
.hu-demo-ring { fill: none; stroke: var(--hu-ink); stroke-width: 2.5; opacity: 0; }
.hu-demo[data-step="1"] .hu-demo-ring,
.hu-demo[data-step="2"] .hu-demo-ring,
.hu-demo[data-step="all"] .hu-demo-ring { opacity: 1; }
.hu-demo[data-step="3"] .hu-demo-tip { opacity: 0.4; }
.hu-demo[data-step="0"] .hu-demo-tip { opacity: 0; }
.hu-demo-steps {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px 8px;
  margin: 0;
  padding: 0;
  list-style: none;
  counter-reset: hu-step;
}
.hu-demo-steps li {
  counter-increment: hu-step;
  padding: 4px 10px;
  border: 2px solid color-mix(in srgb, var(--hu-ink) 45%, transparent);
  border-radius: var(--hu-wobble);
  background: var(--hu-paper);
  color: var(--hu-muted);
  font-size: 16px;
  font-weight: 600;
  line-height: 1.2;
}
.hu-demo-steps li::before { content: counter(hu-step) ". "; }
.hu-demo[data-step="1"] li[data-step="1"],
.hu-demo[data-step="2"] li[data-step="2"],
.hu-demo[data-step="3"] li[data-step="3"],
.hu-demo[data-step="all"] li {
  border-color: var(--hu-ink);
  background: var(--hu-slip);
  color: var(--hu-ink);
  box-shadow: 2px 2px 0 var(--hu-sun);
}
@media (prefers-reduced-motion: no-preference) {
  :root:not(.ac-still) .hu-demo[data-step="1"] .hu-demo-ring { animation: hu-press 800ms ease-out both; }
  :root:not(.ac-still) .hu-demo[data-step="3"] .hu-demo-tip { animation: hu-lift 1100ms var(--hu-ease) both; }
}
@keyframes hu-press { from { transform: scale(1.8); opacity: 0; } to { transform: scale(1); opacity: 1; } }
@keyframes hu-lift { from { translate: 0 0; opacity: 1; } to { translate: 0 -14px; opacity: 0; } }
.hu-demo-ring, .hu-demo-tip { transform-box: fill-box; transform-origin: center; }
@media (orientation: landscape) {
  /* Sideways the board is tall and narrow: the demo shrinks to fit under the heading, and its
     "hard to hold" line moves to the note beside the Pen stays down button. */
  .hu-blind-word { top: 22px; font-size: 18px; line-height: 1.2; }
  .hu-demo { inset: 76px 8px 12px; gap: 6px; }
  .hu-demo-art { flex: 1 1 0; min-height: 72px; width: 100%; height: auto; max-height: none; }
  .hu-demo-steps { gap: 4px 6px; }
  .hu-demo-steps li { padding: 1px 7px; font-size: 15px; }
  .hu-demo-alt { display: none; }
}

.hu-shelf-streak { margin: 0 0 4px; font-size: 14px; font-weight: 600; color: var(--hu-ink); }
.hu-scene-note {
  max-width: 32ch;
  margin: 0 0 6px;
  text-align: center;
  font-family: var(--ak-font-body, system-ui);
  font-size: 16px;
  font-weight: 600;
  line-height: 1.35;
  color: var(--ak-ink, #1A2B5C);
}

/* ------------------------------------------------------------------ the set's dare, from the second set on */
.hu-dare {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 10px;
  margin: 0;
  padding: 2px 8px;
  background: linear-gradient(transparent 30%, color-mix(in srgb, var(--hu-sun) 55%, transparent) 30% 88%, transparent 88%);
  color: var(--hu-ink);
  font-size: 16px;
  font-weight: 600;
  line-height: 1.3;
  rotate: -0.8deg;
}
.hu-dare-tally { display: inline-flex; gap: 5px; }
.hu-dare-box {
  position: relative;
  width: 18px;
  height: 18px;
  border: 2px solid var(--hu-ink);
  border-radius: 3px 5px 3px 4px;
  background: var(--hu-paper);
}
.hu-dare-box.is-met::after {
  content: '';
  position: absolute;
  left: 4px;
  top: -3px;
  width: 6px;
  height: 13px;
  border-right: 3px solid var(--hu-blue);
  border-bottom: 3px solid var(--hu-blue);
  rotate: 40deg;
}
.hu-dare-box.is-missed::after {
  content: '';
  position: absolute;
  left: 2px;
  right: 2px;
  top: 6px;
  height: 2px;
  background: var(--hu-muted);
}
.hu-play[data-phase="done"] .hu-dare { display: none; }

/* Pen stays down: a quiet button while drawing, a filled one while the pen is held down. */
.hu-hold { border-style: dashed; }
.hu-hold.is-on {
  border-style: solid;
  background: var(--ak-btn-fill, #2B59C3);
  color: var(--ak-btn-ink, #F4EFE4);
}
.hu-pen.is-holding .hu-pen-word { font-weight: 600; }
.hu-demo-alt {
  max-width: 30ch;
  margin: 0;
  padding: 2px 8px;
  background: var(--hu-paper);
  color: var(--hu-ink);
  font-size: 15px;
  line-height: 1.3;
  text-align: center;
}

/* ------------------------------------------------------------------ the practice trace (first visit only)
   A dashed mitten with a start dot and an end dot; the player's own line inks over it so the
   press-hold-trace-lift move is learned with the line in sight, before any hand hides. */
.hu-practice { position: absolute; inset: 0; }
.hu-practice-art { position: absolute; inset: 18px 10px 44px; width: calc(100% - 20px); height: calc(100% - 62px); overflow: visible; }
.hu-practice-path {
  fill: none;
  stroke: color-mix(in srgb, var(--hu-blue) 60%, transparent);
  stroke-width: 2.4;
  stroke-dasharray: 5 6;
  stroke-linecap: round;
}
.hu-practice-start { fill: var(--hu-sun); stroke: var(--hu-ink); stroke-width: 2; }
.hu-practice-ring { fill: none; stroke: var(--hu-ink); stroke-width: 2; transform-box: fill-box; transform-origin: center; }
.hu-practice-end { fill: var(--hu-paper); stroke: var(--hu-ink); stroke-width: 2; }
.hu-practice-canvas { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.hu-play[data-phase="practice"] .hu-pen { display: flex; }
.hu-play[data-phase="practice"] .hu-pen:not(.is-down) { visibility: hidden; }
.hu-play[data-phase="practice"] .hu-sheet { cursor: crosshair; }
.hu-skip { border-style: dashed; font-weight: 500; }
@media (prefers-reduced-motion: no-preference) {
  :root:not(.ac-still) .hu-practice-ring { animation: hu-ring 1.3s ease-in-out infinite; }
  :root:not(.ac-still) .hu-ready.is-ready, :root:not(.ac-still) #ready.is-ready { animation: hu-nudge 2.6s 0.6s ease-in-out infinite; }
}
