/* Interactive demo: a browser with the side panel docked beside a crossword. Uses the page's :root tokens. */

.demo-tour {
  --demo-mark: var(--highlighter);
  --demo-selected: rgba(255, 201, 60, 0.3);
  --demo-field: #fff;
  --demo-shadow-teal: rgba(18, 181, 168, 0.26);
  --np-ink: #1d1d1f;
  --site-paper: #fdfcf8;
  --site-cell: #fff;
  --site-hl: rgba(255, 201, 60, 0.42);
  --site-cur: rgba(255, 201, 60, 0.95);
  --site-select: #b8d6fb;
  --pl-paper: #f3ecdc;
  --pl-ink: #1b1a17;
  --pl-biro: #1f2d57;
  --pl-teal: #0b6f68;
  --pl-teal-wash: rgba(18, 181, 168, 0.32);
  --pl-coral: #c23b28;
  --pl-coral-wash: rgba(255, 106, 85, 0.28);
  --pl-red: #d7322a;
  --pl-hl: rgba(255, 201, 60, 0.85);
  --demo-pop: var(--ease-pop, cubic-bezier(0.3, 0.7, 0.2, 1.3));
  --demo-out: var(--ease-out, cubic-bezier(0.3, 0.7, 0.2, 1));
  position: relative;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .demo-tour {
    --demo-mark: rgba(18, 181, 168, 0.4);
    --demo-selected: rgba(124, 92, 255, 0.24);
    --demo-field: #14162a;
    --demo-shadow-teal: rgba(18, 181, 168, 0.34);
    --site-paper: #e2ddd0;
    --site-cell: #eeeae0;
    --site-hl: rgba(255, 201, 60, 0.5);
    --site-select: #9fc2ee;
  }
}

:root[data-theme="dark"] .demo-tour {
  --demo-mark: rgba(18, 181, 168, 0.4);
  --demo-selected: rgba(124, 92, 255, 0.24);
  --demo-field: #14162a;
  --demo-shadow-teal: rgba(18, 181, 168, 0.34);
  --site-paper: #e2ddd0;
  --site-cell: #eeeae0;
  --site-hl: rgba(255, 201, 60, 0.5);
  --site-select: #9fc2ee;
}

.demo-tour p {
  margin: 0;
}

.demo-defs {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}

/* ============ stage and browser ============ */
.demo-frame {
  position: relative;
  container: demo-stage / inline-size;
}

.demo-window,
.demo-stage {
  position: relative;
}

.demo-stage {
  user-select: none;
}

.demo-otto {
  position: absolute;
  z-index: 3;
  top: -86px;
  right: 34px;
  width: 104px;
  height: auto;
  filter: var(--otto-halo, none);
  pointer-events: none;
}

.demo-browser {
  position: relative;
  display: flex;
  flex-direction: column;
  height: 50em;
  overflow: hidden;
  border: 2px solid var(--ink);
  border-radius: 1.2em;
  background: var(--paper-card);
  box-shadow: 0.7em 0.8em 0 -0.15em rgba(18, 181, 168, 0.28);
  color: var(--ink);
  font-family: var(--body);
  font-size: calc(100cqw / 76);
  line-height: 1.4;
}

.demo-tabs {
  display: flex;
  flex: none;
  align-items: flex-end;
  gap: 1em;
  padding: 0.65em 1em 0;
  background: var(--paper-tint);
  border-bottom: 1.5px solid var(--line-strong);
}

.demo-dots {
  display: flex;
  gap: 0.4em;
  align-self: center;
  padding-bottom: 0.6em;
}

.demo-dots i {
  width: 0.8em;
  height: 0.8em;
  border: 1px solid var(--ink);
  border-radius: 50%;
  background: var(--coral);
}

.demo-dots i:nth-child(2) { background: var(--sun); }
.demo-dots i:nth-child(3) { background: var(--teal); }

.demo-tab {
  display: flex;
  align-items: center;
  gap: 0.55em;
  min-width: 0;
  max-width: 26em;
  margin-bottom: -1.5px;
  padding: 0.5em 0.9em 0.55em;
  border: 1.5px solid var(--line-strong);
  border-bottom-color: var(--paper-card);
  border-radius: 0.6em 0.6em 0 0;
  background: var(--paper-card);
  font: 600 0.85em/1.2 var(--body);
}

.demo-fav {
  display: grid;
  flex: none;
  place-items: center;
  width: 1.4em;
  height: 1.4em;
  border-radius: 0.2em;
  background: var(--np-ink);
  color: #f3eee1;
  font: 900 0.85em/1 var(--display);
}

.demo-tab-text,
.demo-url {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.demo-plus {
  align-self: center;
  padding-bottom: 0.45em;
  font: 400 1.25em/1 var(--body);
  color: var(--muted);
}

.demo-bar {
  display: flex;
  flex: none;
  align-items: center;
  gap: 0.8em;
  padding: 0.5em 1em;
  border-bottom: 1.5px solid var(--ink);
}

.demo-nav {
  font: 400 1.35em/1 var(--body);
  letter-spacing: 0.2em;
  color: var(--muted);
}

.demo-url {
  display: flex;
  flex: 1;
  align-items: center;
  gap: 0.45em;
  min-width: 0;
  padding: 0.35em 0.9em;
  border: 1.5px solid var(--line-strong);
  border-radius: 999px;
  background: var(--paper-tint);
  font-size: 0.85em;
  color: var(--muted);
}

.demo-url svg {
  flex: none;
  width: 0.75em;
  height: 0.9em;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.4;
}

.demo-host {
  font-weight: 600;
  color: var(--ink);
}

.demo-tools {
  display: flex;
  flex: none;
  align-items: center;
  gap: 0.55em;
}

.demo-puzzle {
  width: 1.35em;
  height: 1.35em;
  fill: none;
  stroke: var(--muted);
  stroke-width: 1.7;
  stroke-linejoin: round;
}

.demo-ext {
  display: grid;
  place-items: center;
  width: 2.1em;
  height: 2.1em;
  border-radius: 50%;
  background: var(--sun-tint);
  box-shadow: inset 0 0 0 1.5px var(--ink);
  transition: background-color 0.3s;
}

.demo-ext .demo-mark {
  width: 1.3em;
  height: 1.3em;
}

[data-flags~="open"] .demo-ext {
  background: var(--sun);
}

.demo-more {
  font: 700 1.15em/1 var(--body);
  color: var(--muted);
}

.demo-mark {
  display: block;
  flex: none;
  width: 1.2em;
  height: 1.2em;
  border-radius: 0.2em;
}

.demo-body {
  position: relative;
  flex: 1;
  min-height: 0;
  overflow: hidden;
  background: var(--site-paper);
}

/* the strip at the foot of the window that the tour controls sit on */
.demo-dock {
  flex: none;
  height: 42px;
  border-top: 1.5px solid var(--line-strong);
  background: var(--paper-tint);
}

/* ============ whole-tour progress, over the window's foot ============ */
.demo-scrub {
  position: absolute;
  z-index: 7;
  left: 0;
  right: 0;
  bottom: 2px;
  display: flex;
  align-items: center;
  gap: 6px;
  height: 42px;
  margin: 0 auto;
  padding: 0 18px 0 4px;
  font-size: calc(100cqw / 76);
  visibility: hidden;
}

.demo-live .demo-scrub {
  visibility: visible;
}

.demo-mini {
  position: relative;
  display: grid;
  flex: none;
  place-items: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: none;
  color: var(--paper);
  cursor: pointer;
}

.demo-mini::before {
  content: "";
  position: absolute;
  inset: 8px;
  border-radius: 50%;
  background: var(--ink);
  box-shadow: 0 2px 0 var(--teal);
  transition: transform 0.15s var(--demo-pop);
}

.demo-mini:hover::before {
  transform: scale(1.1);
}

.demo-mini .demo-play-icon {
  position: relative;
  margin-left: 2px;
  border-top-width: 5px;
  border-bottom-width: 5px;
  border-left-width: 8px;
}

.demo-auto .demo-mini .demo-play-icon {
  width: 9px;
  height: 10px;
  margin-left: 0;
  border-left-width: 3px;
  border-right-width: 3px;
}

.demo-mini:focus-visible {
  outline: 3px solid var(--sun);
  outline-offset: -1px;
}

.demo-track {
  display: flex;
  flex: 1;
  align-items: center;
  height: 44px;
  cursor: pointer;
}

.demo-track-line {
  --demo-p: 0;
  --demo-seg-a: 0;
  --demo-seg-b: 0;
  position: relative;
  flex: 1;
  height: 4px;
  border-radius: 4px;
  background: var(--line-strong);
  transition: --demo-p var(--demo-ms, 0ms) linear;
}

.demo-track-step,
.demo-track-fill {
  position: absolute;
  top: 0;
  bottom: 0;
  border-radius: 4px;
}

.demo-track-step {
  left: calc(var(--demo-seg-a) * 100%);
  width: calc((var(--demo-seg-b) - var(--demo-seg-a)) * 100%);
  background: var(--sun-tint);
  box-shadow: 0 0 0 1px var(--sun);
}

.demo-track-fill {
  left: 0;
  width: calc(var(--demo-p) * 100%);
  background: linear-gradient(90deg, var(--teal), var(--sun));
}

.demo-track-ticks i {
  position: absolute;
  top: -3px;
  left: calc(var(--demo-at) * 100%);
  width: 2px;
  height: 10px;
  margin-left: -1px;
  border-radius: 1px;
  background: var(--muted);
  opacity: 0.55;
}

.demo-track-knob {
  position: absolute;
  top: 50%;
  left: calc(var(--demo-p) * 100%);
  width: 12px;
  height: 12px;
  margin: -6px 0 0 -6px;
  border: 2px solid var(--ink);
  border-radius: 50%;
  background: var(--sun);
}

@property --demo-p {
  syntax: "<number>";
  inherits: true;
  initial-value: 0;
}

/* ============ the newspaper's crossword page ============ */
.demo-site {
  position: absolute;
  inset: 0;
  display: grid;
  grid-template-columns: 42.5em minmax(0, 1fr);
  grid-template-rows: auto auto auto 1fr;
  column-gap: 2em;
  align-content: start;
  padding: 1.2em 1.6em;
  color: var(--np-ink);
}

.demo-site-mast {
  grid-column: 1 / -1;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1em;
  padding-bottom: 0.35em;
  border-bottom: 0.18em solid var(--np-ink);
}

.demo-site-name {
  font: 900 1.9em/1 var(--display-large, var(--display));
  font-variation-settings: "SOFT" 0, "WONK" 0, "opsz" 144;
  letter-spacing: -0.035em;
  white-space: nowrap;
}

.demo-the {
  margin-right: 0.08em;
  font-size: 0.5em;
  font-style: italic;
  font-weight: 600;
  letter-spacing: 0;
  vertical-align: 0.5em;
}

.demo-site-nav {
  display: flex;
  gap: 0.9em;
  font: 600 0.8em/1 var(--body);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.demo-site-nav .demo-on {
  text-decoration: underline 0.18em;
  text-underline-offset: 0.35em;
}

.demo-site-title {
  grid-column: 1;
  margin-top: 0.6em !important;
  font: 800 1.6em/1.1 var(--display);
  font-variation-settings: "SOFT" 0, "opsz" 48;
  letter-spacing: -0.02em;
}

.demo-site-title span span {
  font-weight: 400;
}

.demo-site-by {
  grid-column: 1;
  margin: 0.15em 0 0.9em !important;
  font-size: 0.9em;
  color: rgba(29, 29, 31, 0.65);
}

.demo-site-play {
  grid-column: 1;
  display: grid;
  grid-template-columns: 17em minmax(0, 1fr);
  gap: 1.6em;
  align-items: start;
}

.demo-xw {
  display: block;
  width: 100%;
  height: auto;
  overflow: visible;
}

.demo-xw-bg { fill: var(--site-cell); }
.demo-xw-hl { fill: var(--site-hl); }
.demo-xw-cur { fill: var(--site-cur); }
.demo-xw-blk { fill: var(--np-ink); }
.demo-xw-lines { fill: none; stroke: var(--np-ink); stroke-width: 0.6; }
.demo-xw-frame { fill: none; stroke: var(--np-ink); stroke-width: 1.6; }
.demo-xw-num { font: 600 5.6px var(--body); fill: var(--np-ink); }
.demo-xw-let { font: 600 12px var(--body); fill: #2b3a7a; text-anchor: middle; }

.demo-site-bar {
  margin-top: 0.8em !important;
  padding: 0.45em 0.75em;
  border-left: 0.3em solid var(--np-ink);
  background: var(--site-hl);
  font: 600 1.05em/1.3 var(--display);
  font-variation-settings: "SOFT" 0, "opsz" 32;
}

.demo-site-bar b {
  display: block;
  font: 700 0.68em/1.3 var(--body);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.demo-site-clues p {
  display: grid;
  grid-template-columns: 1.7em minmax(0, 1fr);
  margin: 0 -0.4em 0.25em;
  padding: 0.12em 0.4em;
  border-radius: 0.3em;
  font-size: 0.95em;
  line-height: 1.3;
}

.demo-site-clues .demo-site-dir {
  display: block;
  margin-bottom: 0.35em;
  padding-bottom: 0.2em;
  border-bottom: 1px solid var(--np-ink);
  border-radius: 0;
  font: 800 1.1em/1.1 var(--display);
}

.demo-site-clues .demo-site-dir ~ .demo-site-dir {
  margin-top: 0.8em;
}

.demo-site-clues .demo-done {
  color: rgba(29, 29, 31, 0.42);
}

.demo-site-clues .demo-cur {
  background: var(--site-hl);
  font-weight: 600;
}

.demo-sel-row {
  position: relative;
}

.demo-sel {
  background: linear-gradient(var(--site-select), var(--site-select)) no-repeat 0 0 / 0% 100%;
  transition: background-size 0.7s linear;
}

[data-flags~="sel"] .demo-sel {
  background-size: 100% 100%;
}

.demo-stuck {
  display: flex;
  align-items: flex-start;
  gap: 0.3em;
  margin: 0.4em 0 0 1.2em !important;
  font: 700 1.5em/1 var(--hand);
  color: var(--red-pen);
  white-space: nowrap;
  opacity: 0;
  transform: rotate(-3deg) translateY(0.4em);
  transition: opacity 0.35s, transform 0.5s var(--demo-pop);
}

.demo-stuck svg {
  width: 1.1em;
  height: 1.4em;
  margin-top: -0.45em;
  overflow: visible;
}

.demo-stuck path {
  fill: none;
  stroke: currentColor;
  stroke-width: 2.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}

[data-flags~="stuck"] .demo-stuck {
  opacity: 1;
  transform: rotate(-3deg);
}

.demo-site-side {
  grid-column: 2;
  grid-row: 2 / 5;
  align-self: start;
  margin-top: 0.8em;
  padding: 0.9em 1em;
  border-top: 0.18em solid var(--np-ink);
  font-size: 0.9em;
}

.demo-site-side p {
  padding: 0.4em 0;
  border-bottom: 1px solid rgba(29, 29, 31, 0.2);
}

.demo-site-side b {
  display: block;
}

.demo-site-side .demo-side-head {
  font: 800 1.2em/1.1 var(--display);
  border-bottom: 0;
}

.demo-ad {
  display: grid;
  place-items: center;
  height: 9em;
  margin-top: 1em;
  border: 1px dashed rgba(29, 29, 31, 0.3);
  font-size: 0.75em;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: rgba(29, 29, 31, 0.5);
}

.demo-if-prize,
[data-flags~="prize"] .demo-if-daily {
  display: none;
}

[data-flags~="prize"] .demo-if-prize {
  display: inline;
}

/* the browser's right-click menu */
.demo-menu {
  position: absolute;
  z-index: 4;
  top: 100%;
  left: 12%;
  display: flex;
  flex-direction: column;
  width: 19.5em;
  padding: 0.35em 0;
  border: 1px solid rgba(29, 29, 31, 0.25);
  border-radius: 0.5em;
  background: #fff;
  box-shadow: 0 0.5em 1.4em rgba(28, 31, 59, 0.25);
  color: #1d1d1f;
  font: 400 0.92em/1.2 var(--body);
  opacity: 0;
  visibility: hidden;
  transform: scaleY(0.6);
  transform-origin: top left;
  transition: opacity 0.18s, transform 0.25s var(--demo-out), visibility 0s 0.25s;
}

.demo-menu span {
  display: flex;
  align-items: center;
  gap: 0.6em;
  padding: 0.38em 1em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.demo-menu i {
  height: 1px;
  margin: 0.3em 0;
  background: rgba(29, 29, 31, 0.15);
}

.demo-menu .demo-menu-ext {
  font-weight: 600;
  transition: background-color 0.15s;
}

[data-flags~="menu"] .demo-menu {
  opacity: 1;
  visibility: visible;
  transform: none;
  transition: opacity 0.18s, transform 0.3s var(--demo-pop), visibility 0s;
}

[data-live~="menu"] .demo-menu > * {
  animation: demo-rise 0.25s var(--demo-out) both;
}

[data-live~="menu"] .demo-menu > :nth-child(2) { animation-delay: 40ms; }
[data-live~="menu"] .demo-menu > :nth-child(3) { animation-delay: 80ms; }
[data-live~="menu"] .demo-menu > :nth-child(5) { animation-delay: 140ms; }
[data-live~="menu"] .demo-menu > :nth-child(7) { animation-delay: 190ms; }

[data-flags~="menuhover"] .demo-menu-ext {
  background: #e8eefc;
}

/* ============ the side panel ============ */
.demo-panel {
  position: absolute;
  z-index: 2;
  top: 0;
  right: 0;
  bottom: 0;
  display: flex;
  flex-direction: column;
  width: 30em;
  border-left: 1.5px solid var(--ink);
  background: var(--paper);
  box-shadow: -0.4em 0 1.2em rgba(28, 31, 59, 0.12);
  transform: translateX(102%);
  transition: transform 0.6s var(--demo-out);
}

[data-flags~="open"] .demo-panel {
  transform: none;
}

.demo-panel-head {
  display: flex;
  flex: none;
  align-items: center;
  gap: 0.55em;
  padding: 0.55em 1em;
  border-bottom: 1.5px solid var(--line-strong);
  background: var(--paper-tint);
}

.demo-panel-name {
  font: 600 0.9em/1 var(--body);
  white-space: nowrap;
}

.demo-chev {
  width: 0.7em;
  height: 0.45em;
  fill: none;
  stroke: var(--muted);
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.demo-close {
  margin-left: auto;
  font: 400 1.3em/1 var(--body);
  color: var(--muted);
}

.demo-pview {
  position: relative;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

.demo-pmain {
  display: flex;
  flex-direction: column;
  padding: 0 1.07em 2em;
}


.demo-p-header {
  position: sticky;
  z-index: 3;
  top: 0;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.4em 0.67em;
  margin: 0 -1.07em;
  padding: 0.8em 1.07em 0.67em;
  overflow: hidden;
  border-bottom: 1.5px solid var(--line);
  background: var(--paper);
}

.demo-p-header::before {
  content: "";
  position: absolute;
  top: -5em;
  left: -3em;
  width: 9em;
  height: 9em;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 201, 60, 0.45), transparent 65%);
  pointer-events: none;
}

.demo-p-title {
  position: relative;
  display: flex;
  align-items: center;
  gap: 0.53em;
  font: 700 1.33em/1.15 var(--display);
  letter-spacing: -0.01em;
}

.demo-p-title .demo-mark {
  width: 1.2em;
  height: 1.2em;
}

.demo-p-word {
  position: relative;
  padding-bottom: 0.15em;
}

.demo-p-word svg {
  position: absolute;
  left: 0;
  bottom: -0.3em;
  width: calc(100% - 0.2em);
  height: 0.45em;
  overflow: visible;
}

.demo-p-word path {
  fill: none;
  stroke: var(--teal);
  stroke-width: 3;
  stroke-linecap: round;
  vector-effect: non-scaling-stroke;
}

.demo-credits {
  position: relative;
  padding: 0.2em 0.67em;
  border: 1.5px solid var(--ink);
  border-radius: 999px;
  background: var(--sun-tint);
  font: 600 0.8em/1.3 var(--body);
}

.demo-small {
  font-size: 0.83em;
  color: var(--muted);
}

.demo-muted {
  font-weight: 400;
  color: var(--muted);
}

.demo-link {
  align-self: flex-start;
  padding: 0.27em 0;
  color: var(--teal-deep);
  font-size: 0.87em;
  font-weight: 600;
  text-decoration: underline 1.5px;
  text-underline-offset: 3px;
}

.demo-primary {
  align-self: flex-start;
  padding: 0.6em 1.3em;
  border: 2px solid var(--ink);
  border-radius: 999px;
  background: var(--ink);
  color: var(--paper);
  font-weight: 600;
  line-height: 1.2;
  white-space: nowrap;
}

.demo-primary-off {
  opacity: 0.4;
}

/* the hint card opens with a grid-row reveal, so the frame never jumps */
.demo-p-cardwrap {
  display: grid;
  grid-template-rows: 0fr;
  margin: 0 -0.6em 0 -0.2em;
  transition: grid-template-rows 0.45s var(--demo-out);
}

.demo-p-cardwrap > .demo-p-card {
  position: relative;
  isolation: isolate;
  display: flex;
  flex-direction: column;
  gap: 0.67em;
  min-height: 0;
  overflow: hidden;
  padding: 0 1.53em 0 1.13em;
  visibility: hidden;
  transition: padding 0.45s var(--demo-out), visibility 0s 0.45s;
}

[data-flags~="picked"] .demo-p-card-3a > .demo-p-card,
[data-flags~="prizepicked"] .demo-p-card-3a > .demo-p-card,
[data-flags~="picked2"] .demo-p-card-picked > .demo-p-card {
  padding-top: 1.6em;
  padding-bottom: 1.47em;
  visibility: visible;
  transition: padding 0.45s var(--demo-out), visibility 0s;
}

.demo-p-card > * {
  margin: 0 !important;
}

.demo-p-card::after {
  content: "";
  position: absolute;
  z-index: -1;
  inset: 0.67em 0.6em 0.6em 0.2em;
  border: 2px solid var(--ink);
  border-radius: 1.07em;
  background: var(--paper-card);
  box-shadow: 0.4em 0.47em 0 -0.13em var(--demo-shadow-teal);
}

[data-flags~="picked"] .demo-p-card-3a,
[data-flags~="prizepicked"] .demo-p-card-3a,
[data-flags~="picked2"] .demo-p-card-picked {
  grid-template-rows: 1fr;
}

.demo-p-clue {
  font: 600 1.2em/1.35 var(--display);
}

.demo-p-clue b {
  color: var(--coral-deep);
  font-weight: 700;
}

.demo-p-letters {
  display: flex;
  flex-direction: column;
  gap: 0.33em;
  font-size: 0.9em;
  font-weight: 600;
}

.demo-p-letters .demo-small {
  font-weight: 400;
}

.demo-p-input {
  display: flex;
  align-items: center;
  min-height: 2.4em;
  padding: 0.45em 0.8em;
  border: 2px solid var(--control-line, rgba(28, 31, 59, 0.55));
  border-radius: 0.73em;
  background: var(--demo-field);
  font: 600 1.1em/1.2 ui-monospace, "SF Mono", Menlo, monospace;
  letter-spacing: 0.3em;
  white-space: nowrap;
  transition: border-color 0.2s;
}

.demo-p-placeholder {
  color: var(--muted);
  opacity: 0.7;
}

.demo-p-caret {
  width: 2px;
  height: 1.15em;
  margin-right: 1px;
  background: var(--ink);
  opacity: 0;
}

[data-flags~="picked"]:not([data-flags~="asked"]) .demo-p-card-3a .demo-p-input {
  border-color: var(--teal-deep);
}

[data-flags~="picked"]:not([data-flags~="asked"]) .demo-p-caret {
  animation: demo-blink 1s steps(1) infinite;
}

.demo-p-ask {
  display: flex;
  flex-direction: column;
  gap: 0.4em;
}

[data-flags~="asked"] .demo-p-ask,
.demo-p-ladderwrap {
  display: none;
}

[data-flags~="asked"] .demo-p-ladderwrap {
  display: block;
}

.demo-p-ladderbox {
  display: flex;
  flex-direction: column;
  gap: 0.67em;
}

[data-live~="asked"] .demo-p-ladderbox > * {
  animation: demo-rise 0.45s var(--demo-out) both;
}

[data-live~="asked"] .demo-p-ladderbox > :nth-child(2) { animation-delay: 80ms; }
[data-live~="asked"] .demo-p-ladderbox > :nth-child(3) { animation-delay: 160ms; }
[data-live~="asked"] .demo-p-ladderbox > :nth-child(n + 4) { animation-delay: 240ms; }

.demo-p-prize-note,
[data-flags~="prize"] .demo-p-not-prize {
  display: none;
}

[data-flags~="prize"] .demo-p-prize-note {
  display: block;
}

.demo-p-notice {
  padding: 0.67em 0.8em;
  border: 2px dashed var(--sun-deep);
  border-radius: 0.73em;
  background: var(--sun-tint);
  font-size: 0.93em;
}

[data-live~="prizepicked"] .demo-p-prize-note {
  animation: demo-rise 0.45s 0.25s var(--demo-out) both;
}

/* ============ the hint player (always paper, like the real canvas) ============ */
.demo-player {
  position: relative;
  container-type: inline-size;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  border: 2px solid var(--ink);
  border-radius: 0.73em;
  background:
    radial-gradient(ellipse at 20% 10%, rgba(255, 255, 255, 0.5), transparent 60%),
    var(--pl-paper);
  color: var(--pl-ink);
}

.demo-player > * {
  font-size: calc(100cqw / 24);
}

.demo-pl-kicker {
  position: absolute;
  top: 6%;
  left: 5%;
  font: 700 0.62em/1 var(--body);
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.demo-pl-clue {
  position: absolute;
  top: 19%;
  left: 0;
  right: 0;
  display: flex;
  flex-wrap: nowrap;
  justify-content: center;
  column-gap: 0.32em;
  font: 600 1.05em/1.3 var(--display);
  font-variation-settings: "SOFT" 100, "opsz" 32;
  white-space: nowrap;
}

.demo-w {
  position: relative;
  z-index: 0;
}

.demo-w-def {
  background: linear-gradient(transparent 40%, var(--pl-hl) 40%, var(--pl-hl) 88%, transparent 88%) no-repeat 0 0 / 0% 100%;
}

[data-flags~="s1"] .demo-w-def {
  background-size: 100% 100%;
}

[data-live~="s1"] .demo-w-def {
  animation: demo-sweep 0.9s 0.15s var(--demo-out) both;
}

.demo-pl-enum {
  font-weight: 400;
  color: rgba(27, 26, 23, 0.7);
}

.demo-pl-note {
  position: absolute;
  left: 50%;
  font: 700 0.62em/1 var(--hand);
  color: var(--pl-biro);
  white-space: nowrap;
  opacity: 0;
  transform: translateX(-50%);
}

.demo-note-def {
  top: calc(100% + 0.25em);
}

.demo-note-with {
  bottom: calc(100% + 0.35em);
  color: var(--pl-red);
}

[data-flags~="s1"] .demo-note-def,
[data-flags~="s4"] .demo-note-with {
  opacity: 1;
}

[data-live~="s1"] .demo-note-def {
  animation: demo-note 0.4s 0.9s var(--demo-out) both;
}

[data-live~="s4"] .demo-note-with {
  animation: demo-note 0.4s 0.2s var(--demo-out) both;
}

.demo-w-with svg {
  position: absolute;
  inset: -0.3em -0.45em -0.2em -0.4em;
  width: calc(100% + 0.85em);
  height: calc(100% + 0.5em);
  overflow: visible;
}

.demo-w-with path {
  fill: none;
  stroke: var(--pl-red);
  stroke-width: 2.4;
  stroke-linecap: round;
  stroke-dasharray: 1;
  stroke-dashoffset: 1;
  vector-effect: non-scaling-stroke;
}

[data-flags~="s2"] .demo-w-with path {
  stroke-dashoffset: 0;
}

[data-live~="s2"] .demo-w-with path {
  animation: demo-draw 0.75s 0.15s ease-in-out both;
}

.demo-w-motor::after,
.demo-w-fav::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -0.12em;
  height: 0.16em;
  border-radius: 0.1em;
  transform: scaleX(0);
  transform-origin: left;
}

.demo-w-motor::after { background: var(--pl-teal); }
.demo-w-fav::after { background: var(--pl-coral); }

[data-flags~="s3"] .demo-w-motor::after,
[data-flags~="s3"] .demo-w-fav::after {
  transform: none;
}

[data-live~="s3"] .demo-w-motor::after { animation: demo-underline 0.45s 0.1s var(--demo-out) both; }
[data-live~="s3"] .demo-w-fav::after { animation: demo-underline 0.45s 0.75s var(--demo-out) both; }

/* the type stamp lands top right */
.demo-stamp {
  position: absolute;
  top: 6%;
  right: 5%;
  padding: 0.1em 0.45em;
  border: 0.16em double var(--pl-coral);
  border-radius: 0.2em;
  color: var(--pl-coral);
  font: 400 0.7em/1.35 var(--stamp-font);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  opacity: 0;
  rotate: -7deg;
}

[data-flags~="s2"] .demo-stamp {
  opacity: 1;
}

[data-live~="s2"] .demo-stamp {
  animation: demo-thump 0.5s 0.95s var(--demo-pop) both;
}

/* pieces: doodles that pop in, then slide together for the build */
.demo-pl-pieces {
  position: absolute;
  top: 38%;
  left: 0;
  right: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1.6em;
}

.demo-pic {
  display: grid;
  justify-items: center;
  gap: 0.1em;
  opacity: 0;
  transition: translate 0.6s var(--demo-pop);
}

.demo-art {
  position: relative;
  display: block;
  width: 3.6em;
  height: 2.7em;
}

.demo-art::before {
  content: "";
  position: absolute;
  inset: 0.1em 0.3em;
  border-radius: 48% 52% 46% 54%;
  background: var(--pl-teal-wash);
}

.demo-pic-heart .demo-art::before {
  background: var(--pl-coral-wash);
}

.demo-art svg {
  position: absolute;
  inset: -0.3em 0;
  width: 100%;
  height: calc(100% + 0.6em);
  overflow: visible;
}

.demo-art g {
  fill: none;
  stroke: var(--pl-ink);
  stroke-width: 3.4;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.demo-pic-cap {
  font: 700 0.95em/1 var(--hand);
  letter-spacing: 0.08em;
}

.demo-pic-car .demo-pic-cap { color: var(--pl-teal); }
.demo-pic-heart .demo-pic-cap { color: var(--pl-coral); }

[data-flags~="s3"] .demo-pic {
  opacity: 1;
}

[data-live~="s3"] .demo-pic-car {
  animation: demo-drive 0.7s 0.25s var(--demo-out) both;
}

[data-live~="s3"] .demo-pic-heart {
  animation: demo-pop 0.5s 0.9s var(--demo-pop) both;
}

[data-live~="s3"] .demo-pic-cap {
  animation: demo-rise 0.35s var(--demo-out) both;
}

[data-live~="s3"] .demo-pic-car .demo-pic-cap { animation-delay: 0.6s; }
[data-live~="s3"] .demo-pic-heart .demo-pic-cap { animation-delay: 1.2s; }

.demo-op {
  position: absolute;
  left: 50%;
  opacity: 0;
  transform: translateX(-50%);
}

.demo-op {
  top: 0.4em;
  font: 700 1.3em/1 var(--hand);
  color: var(--pl-red);
}

[data-flags~="s4"] .demo-pic-car { translate: 0.55em 0; }
[data-flags~="s4"] .demo-pic-heart { translate: -0.55em 0; }

[data-flags~="s4"] .demo-op {
  opacity: 1;
}

[data-live~="s4"] .demo-op {
  animation: demo-pop-centre 0.45s 0.3s var(--demo-pop) both;
}

/* answer cells */
.demo-pl-answer {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 8%;
  display: flex;
  justify-content: center;
}

.demo-pl-cells {
  display: flex;
}

.demo-pl-cells > span {
  display: grid;
  place-items: center;
  width: 1.55em;
  height: 1.55em;
  margin-left: -1.5px;
  border: 1.5px solid var(--pl-ink);
  background: #fffdf6;
}

.demo-pl-cells i {
  font: 700 1em/1 var(--hand);
  font-style: normal;
  opacity: 0;
}

.demo-pl-cells > span:nth-child(-n + 3) i { color: var(--pl-teal); }
.demo-pl-cells > span:nth-child(n + 4) i { color: var(--pl-coral); }

[data-flags~="s5"] .demo-pl-cells i {
  opacity: 1;
}

[data-live~="s5"] .demo-pl-cells i {
  animation: demo-drop 0.4s var(--demo-pop) both;
}

[data-live~="s5"] .demo-pl-cells > span:nth-child(1) i { animation-delay: 0.2s; }
[data-live~="s5"] .demo-pl-cells > span:nth-child(2) i { animation-delay: 0.34s; }
[data-live~="s5"] .demo-pl-cells > span:nth-child(3) i { animation-delay: 0.48s; }
[data-live~="s5"] .demo-pl-cells > span:nth-child(4) i { animation-delay: 0.62s; }
[data-live~="s5"] .demo-pl-cells > span:nth-child(5) i { animation-delay: 0.76s; }
[data-live~="s5"] .demo-pl-cells > span:nth-child(6) i { animation-delay: 0.9s; }

[data-flags~="s5"] .demo-pl-cells > span {
  background: #fff5d6;
  transition: background-color 0.3s 1s;
}

.demo-enlarge {
  align-self: flex-end;
  margin-top: -0.4em;
}

/* ============ the hint ladder ============ */
.demo-ladder {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.53em;
}

.demo-rung {
  position: relative;
  padding: 0.45em 0.67em;
  border: 2px solid var(--control-line, rgba(28, 31, 59, 0.55));
  border-radius: 0.73em;
  background: var(--paper-card);
  font-size: 0.87em;
  line-height: 1.3;
  transition: background-color 0.2s, border-color 0.2s, box-shadow 0.2s, transform 0.12s;
}

.demo-rung-answer {
  grid-column: 1 / -1;
}

.demo-rung strong {
  display: block;
  font: 700 1.1em/1.25 var(--display);
}

.demo-rung span {
  display: block;
  margin-top: 1px;
  color: var(--muted);
  font-size: 0.95em;
}

.demo-rung[data-state="next"] {
  border-color: var(--ink);
  box-shadow: 0.2em 0.27em 0 var(--teal);
}

.demo-rung[data-state="next"] span {
  color: var(--ink);
}

.demo-rung[data-state="seen"] {
  border-color: var(--teal-deep);
  background: var(--teal-tint);
}

.demo-rung[data-state="seen"] span {
  color: var(--teal-deep);
  font-weight: 600;
}

.demo-rung[data-state="playing"] {
  border-color: var(--sun);
  background: var(--sun-tint);
  animation: demo-press 0.3s var(--demo-out);
}

.demo-rung[data-state="playing"] span {
  color: var(--ink);
  font-weight: 600;
}

.demo-rung[data-state="playing"] span::before {
  content: "";
  display: inline-block;
  width: 0.5em;
  height: 0.5em;
  margin-right: 0.4em;
  border-radius: 50%;
  background: var(--coral);
  vertical-align: 0.05em;
  animation: demo-pulse 1s ease-in-out infinite;
}

.demo-rung[data-state="locked"] {
  border-style: dashed;
  border-color: var(--line-strong);
  background: transparent;
}

.demo-rung-answer:not([data-state="locked"]) strong {
  color: var(--coral-deep);
}

.demo-rung-answer[data-state="next"] {
  box-shadow: 0.2em 0.27em 0 var(--coral);
}

.demo-rung-answer[data-state="seen"] {
  border-color: var(--coral-deep);
  background: var(--coral-tint);
}

.demo-rung-answer[data-state="seen"] span {
  color: var(--coral-deep);
}

[data-flags~="busy"] .demo-everything {
  visibility: hidden;
}

[data-flags~="ans"] .demo-everything {
  display: none;
}

.demo-coach {
  position: relative;
  min-height: 2.8em;
  padding-left: 1.3em;
  font: 400 1.05em/1.35 var(--hand);
  color: var(--biro);
}

.demo-coach::before {
  content: "↳";
  position: absolute;
  left: 0;
  top: 0;
  color: var(--coral);
  font-weight: 700;
}

.demo-p-done {
  display: none;
  flex-direction: column;
  gap: 0.4em;
}

[data-flags~="ans"] .demo-p-done {
  display: flex;
}

[data-live~="ans"] .demo-p-done > * {
  animation: demo-rise 0.4s var(--demo-out) both;
}

[data-live~="ans"] .demo-p-done > :nth-child(2) {
  animation-delay: 0.15s;
}

.demo-label {
  align-self: flex-start;
  padding: 0.2em 0.8em 0.2em 0.67em;
  border: 1.5px solid var(--teal);
  border-radius: 999px;
  background: var(--teal-tint);
  font-size: 0.87em;
  font-weight: 600;
}

.demo-label::before {
  content: "✓ ";
  color: var(--teal-deep);
  font-weight: 700;
}

/* ============ the clue list ============ */
.demo-p-source {
  margin-top: 1em !important;
}

.demo-p-readycount {
  opacity: 0;
  transition: opacity 0.3s;
}

[data-flags~="ready"] .demo-p-readycount {
  opacity: 1;
}

.demo-p-h {
  display: inline-block;
  margin: 0.9em 0 0.4em -0.13em !important;
  padding: 0 0.4em;
  background: linear-gradient(transparent 50%, var(--demo-mark) 50%, var(--demo-mark) 92%, transparent 92%);
  font: 700 1.07em/1.2 var(--display);
}

.demo-p-clues {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}

.demo-p-item {
  display: block;
  align-self: stretch;
  padding: 0.45em 0.53em;
  border-bottom: 1.5px dashed var(--line);
  font-size: 0.95em;
  line-height: 1.4;
  transition: background-color 0.25s, box-shadow 0.25s;
}

.demo-p-item b {
  margin-right: 0.13em;
  font-family: var(--display);
  color: var(--teal-deep);
}

.demo-enum {
  color: var(--muted);
}

.demo-ready {
  display: inline-block;
  margin-left: 0.3em;
  padding: 0 0.47em;
  border-radius: 999px;
  background: var(--violet-tint);
  color: var(--violet-deep);
  font-size: 0.8em;
  font-weight: 600;
  line-height: 1.4;
  white-space: nowrap;
  opacity: 0;
  scale: 0.6;
  transition: opacity 0.25s, scale 0.35s var(--demo-pop);
}

[data-flags~="ready"]:not([data-flags~="prize"]) .demo-ready {
  opacity: 1;
  scale: 1;
}

.demo-p-clues > :nth-child(3) .demo-ready { transition-delay: 0.08s; }
.demo-p-clues > :nth-child(5) .demo-ready { transition-delay: 0.16s; }
.demo-p-clues > :nth-child(7) .demo-ready { transition-delay: 0.24s; }
.demo-p-clues > :nth-child(11) .demo-ready { transition-delay: 0.32s; }

[data-flags~="picked"] .demo-p-item-3a,
[data-flags~="prizepicked"] .demo-p-item-3a {
  border-radius: 0.53em;
  background: var(--demo-selected);
  box-shadow: inset 0.27em 0 var(--coral);
}

[data-live~="open"] .demo-p-clues > * {
  animation: demo-rise 0.4s var(--demo-out) both;
  animation-delay: calc(0.35s + var(--i, 0) * 45ms);
}

.demo-p-clues > :nth-child(2) { --i: 1; }
.demo-p-clues > :nth-child(3) { --i: 2; }
.demo-p-clues > :nth-child(4) { --i: 3; }
.demo-p-clues > :nth-child(5) { --i: 4; }
.demo-p-clues > :nth-child(6) { --i: 5; }
.demo-p-clues > :nth-child(7) { --i: 6; }
.demo-p-clues > :nth-child(8) { --i: 7; }
.demo-p-clues > :nth-child(9) { --i: 8; }
.demo-p-clues > :nth-child(10) { --i: 9; }
.demo-p-clues > :nth-child(11) { --i: 10; }

.demo-p-pastelink {
  margin-top: 0.5em;
}

.demo-p-paste {
  display: none;
  flex-direction: column;
  gap: 0.27em;
  margin-top: 0.5em;
}

[data-flags~="paste"] .demo-p-pastelink {
  display: none;
}

[data-flags~="paste"] .demo-p-paste {
  display: flex;
}

[data-live~="paste"] .demo-p-paste {
  animation: demo-rise 0.4s var(--demo-out) both;
}

.demo-p-paste-label {
  font-size: 0.9em;
  font-weight: 600;
}

.demo-p-row {
  display: flex;
  gap: 0.53em;
  align-items: center;
}

.demo-p-row .demo-p-input {
  flex: 1;
  min-width: 0;
  font: 400 0.95em/1.2 var(--body);
  letter-spacing: 0;
}

.demo-p-foot {
  margin-top: 1.2em !important;
  padding-top: 0.8em;
  border-top: 1.5px dashed var(--line);
}

/* ============ cursor ============ */
.demo-cursor,
.demo-ripple {
  position: absolute;
  z-index: 6;
  top: 0;
  left: 0;
  pointer-events: none;
}

.demo-cursor {
  width: clamp(15px, 1.7cqw, 21px);
  height: auto;
  aspect-ratio: 14 / 20;
  fill: #fff;
  stroke: var(--ink-fixed, #1c1f3b);
  stroke-width: 1.3;
  stroke-linejoin: round;
  filter: drop-shadow(1px 2px 0 rgba(28, 31, 59, 0.3));
  opacity: 0;
  transform: translate(var(--demo-cx, 50%), var(--demo-cy, 50%)) translate(-6%, -4%);
  transform-origin: 0 0;
  transition: transform var(--demo-move, 800ms) cubic-bezier(0.55, 0.05, 0.25, 1), opacity 0.3s;
}

.demo-has-cursor .demo-cursor {
  opacity: 1;
}

.demo-cursor.demo-pressing {
  animation: demo-click 0.28s ease-out;
}

.demo-ripple {
  width: 38px;
  height: 38px;
  margin: -19px 0 0 -19px;
  border: 3px solid var(--sun);
  border-radius: 50%;
  opacity: 0;
  transform: translate(var(--demo-cx, 0), var(--demo-cy, 0));
}

.demo-ripple-right {
  border-color: var(--violet);
}

.demo-ripple.demo-pressing {
  animation: demo-ripple 0.55s var(--demo-out);
}

/* ============ step-entry staggers (re-run on every step) ============ */
.demo-stage[data-at~="open"] .demo-p-header > * {
  animation: demo-arrive 0.3s var(--demo-out) both;
}

.demo-stage[data-at~="open"] .demo-p-header > :nth-child(2) {
  animation-delay: 0.1s;
}

.demo-stage[data-at~="picked"] .demo-p-card-3a .demo-p-card > *,
.demo-stage[data-at~="asked"] .demo-p-ladderbox > * {
  animation: demo-arrive 0.3s var(--demo-out) both;
  animation-delay: calc(var(--i, 0) * 50ms);
}

.demo-p-card > :nth-child(2),
.demo-p-ladderbox > :nth-child(1) { --i: 1; }
.demo-p-card > :nth-child(3),
.demo-p-ladderbox > :nth-child(2) { --i: 2; }
.demo-p-card > :nth-child(4),
.demo-p-ladderbox > :nth-child(3) { --i: 3; }
.demo-p-ladderbox > :nth-child(n + 4) { --i: 4; }

.demo-stage[data-at~="s1"] .demo-player > * {
  animation: demo-arrive 0.3s var(--demo-out) both;
}

.demo-stage[data-at~="s1"] .demo-pl-clue { animation-delay: 0.08s; }
.demo-stage[data-at~="s1"] .demo-pl-pieces { animation-delay: 0.2s; }
.demo-stage[data-at~="s1"] .demo-pl-answer { animation-delay: 0.3s; }

.demo-stage[data-at~="s1"] .demo-w-def {
  animation: demo-sweep 0.5s 0.2s var(--demo-out) both;
}

.demo-stage[data-at~="s1"] .demo-note-def,
.demo-stage[data-at~="s4"] .demo-note-with {
  animation: demo-note 0.3s 0.45s var(--demo-out) both;
}

.demo-stage[data-at~="s2"] .demo-w-with path {
  animation: demo-draw 0.45s 0.3s ease-in-out both;
}

.demo-stage[data-at~="s2"] .demo-stamp {
  animation: demo-thump 0.45s 0.55s var(--demo-pop) both;
}

.demo-stage[data-at~="s3"] .demo-w-motor::after,
.demo-stage[data-at~="s3"] .demo-w-fav::after {
  animation: demo-underline 0.35s 0.3s var(--demo-out) both;
}

.demo-stage[data-at~="s3"] .demo-pic {
  animation: demo-pop 0.4s 0.4s var(--demo-pop) both;
}

.demo-stage[data-at~="s3"] .demo-pic-heart {
  animation-delay: 0.52s;
}

.demo-stage[data-at~="s3"] .demo-pic-cap {
  animation: none;
}

.demo-stage[data-at~="s4"] .demo-op {
  animation: demo-pop-centre 0.35s 0.6s var(--demo-pop) both;
}

.demo-stage[data-at~="s5"] .demo-pl-cells i {
  animation: demo-drop 0.35s var(--demo-pop) both;
}

.demo-stage[data-at~="open"] .demo-p-source {
  animation: demo-arrive 0.3s 0.15s var(--demo-out) both;
}

.demo-stage[data-at~="prize"] .demo-if-prize {
  animation: demo-arrive 0.3s var(--demo-out) both;
}

.demo-stage[data-at~="sel"] .demo-sel {
  transition: none;
}

/* ============ captions and controls ============ */
.demo-controls {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  grid-template-areas: "back rail next";
  gap: 14px 12px;
  align-items: center;
  margin-top: 26px;
}

.demo-buttons {
  display: contents;
}

[data-demo-back] { grid-area: back; }
[data-demo-next] { grid-area: next; }

/* the step caption: a toast over the page side of the window, clear of the docked panel */
.demo-toast {
  position: absolute;
  z-index: 7;
  left: 18px;
  bottom: 58px;
  width: min(560px, calc(100cqw * 46 / 76 - 40px));
  margin: 0;
  padding: 10px 16px 12px;
  border: 2px solid var(--demo-toast-edge);
  border-radius: 14px;
  background: var(--demo-toast-bg);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.28);
  font: 400 16px/1.4 var(--body);
  color: #fff;
  visibility: hidden;
  --demo-toast-bg: #111216;
  --demo-toast-edge: #111216;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .demo-toast {
    --demo-toast-edge: rgba(255, 255, 255, 0.28);
  }
}

:root[data-theme="dark"] .demo-toast {
  --demo-toast-edge: rgba(255, 255, 255, 0.28);
}

.demo-live .demo-toast {
  visibility: visible;
}

.demo-caption-count {
  display: block;
  font: 700 16px/1.3 var(--hand);
  color: var(--sun);
}

.demo-caption-in .demo-caption-count {
  animation: demo-soft-fade 0.35s ease-out both;
}

.demo-caption-in .demo-caption-text {
  display: inline-block;
  animation: demo-soft-fade 0.5s 0.12s ease-out both;
}

.demo-toast-resizing {
  overflow: clip;
  overflow-clip-margin: 10px;
}

.demo-buttons {
  visibility: hidden;
}

.demo-live .demo-buttons {
  visibility: visible;
}

.demo-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-width: 44px;
  min-height: 44px;
  padding: 8px 16px;
  border: 2px solid var(--ink);
  border-radius: 999px;
  background: var(--paper-card);
  color: var(--ink);
  font: 700 15px/1.2 var(--body);
  white-space: nowrap;
  cursor: pointer;
  transition: transform 0.15s, background-color 0.15s, box-shadow 0.15s;
}

.demo-btn:hover:not(:disabled) {
  background: var(--sheet);
  transform: translateY(-2px);
}

.demo-btn:disabled {
  border-color: var(--line-strong);
  color: var(--muted);
  cursor: default;
}

.demo-play-icon {
  width: 0;
  height: 0;
  border-top: 6px solid transparent;
  border-bottom: 6px solid transparent;
  border-left: 10px solid currentColor;
}

.demo-auto .demo-play-icon {
  width: 10px;
  height: 12px;
  border: 0 solid currentColor;
}

.demo-btn:focus-visible,
.demo-rail-btn:focus-visible {
  outline: 3px solid var(--sun);
  outline-offset: 3px;
}

.demo-rail {
  grid-area: rail;
  display: grid;
  grid-template-columns: repeat(10, minmax(0, 1fr));
  gap: 6px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.demo-rail li {
  display: flex;
}

.demo-rail-btn {
  position: relative;
  flex: 1;
  min-width: 0;
  min-height: 44px;
  padding: 6px 6px 8px;
  overflow: hidden;
  border: 2px solid var(--line-strong);
  border-radius: 12px;
  background: var(--paper-card);
  color: var(--muted);
  font: 600 14px/1.15 var(--body);
  cursor: pointer;
  transition: background-color 0.2s, border-color 0.2s, color 0.2s;
}

.demo-rail-btn:hover {
  border-color: var(--ink);
  color: var(--ink);
}

.demo-rail-btn.demo-past {
  border-color: var(--teal-deep);
  background: var(--teal-tint);
  color: var(--ink);
}

.demo-rail-btn[aria-current] {
  border-color: var(--ink);
  background: var(--sun);
  color: var(--ink-fixed, #1c1f3b);
  font-weight: 700;
}

.demo-rail-btn::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 4px;
  background: var(--ink-fixed, #1c1f3b);
  transform: scaleX(0);
  transform-origin: left;
}

.demo-auto .demo-rail-btn.demo-progress::after {
  animation: demo-fill var(--demo-dur, 5000ms) linear both paused;
}

.demo-running .demo-rail-btn.demo-progress::after {
  animation-play-state: running;
}

/* ============ stacked layout: the panel docks along the bottom ============ */
@container demo-stage (max-width: 819px) {
  .demo-browser {
    max-width: 30em;
    height: 47em;
    margin: 0 auto;
    font-size: clamp(11.5px, calc(100cqw / 27.5), 14px);
  }

  .demo-tab {
    max-width: none;
  }

  .demo-toast {
    position: relative;
    left: auto;
    bottom: auto;
    width: auto;
    max-width: calc(30 * clamp(11.5px, calc(100cqw / 27.5), 14px));
    min-height: calc(4 * 1.4em + 45px);
  }

  .demo-tour .demo-toast {
    margin: 14px auto 0;
  }

  .demo-toast::before {
    content: "";
    position: absolute;
    top: -9px;
    left: 28px;
    width: 14px;
    height: 14px;
    border-top: 2px solid var(--demo-toast-edge);
    border-left: 2px solid var(--demo-toast-edge);
    background: var(--demo-toast-bg);
    rotate: 45deg;
  }

  .demo-scrub {
    max-width: 30em;
    font-size: clamp(11.5px, calc(100cqw / 27.5), 14px);
    padding-right: 14px;
  }

  .demo-plus,
  .demo-nav,
  .demo-puzzle,
  .demo-site-side,
  .demo-site-by {
    display: none;
  }

  .demo-site {
    grid-template-columns: minmax(0, 1fr);
    padding: 0.8em 1em;
  }

  .demo-site-name {
    font-size: 1.5em;
  }

  .demo-site-nav span:not(.demo-on) {
    display: none;
  }

  .demo-site-title {
    margin-top: 0.45em !important;
    margin-bottom: 0.5em !important;
    font-size: 1.25em;
  }

  .demo-site-play {
    grid-template-columns: 8.5em minmax(0, 1fr);
    gap: 1em;
  }

  .demo-site-clues > :nth-child(2),
  .demo-site-clues > :nth-child(n + 7) {
    display: none;
  }

  .demo-site-bar {
    margin-top: 0.5em !important;
    font-size: 0.85em;
  }

  .demo-site-clues p {
    font-size: 0.85em;
  }

  .demo-stuck {
    margin: 0.3em 0 0 !important;
    font-size: 1.25em;
  }

  .demo-panel {
    top: auto;
    left: 0;
    width: auto;
    height: 28.5em;
    border-top: 1.5px solid var(--ink);
    border-left: 0;
    box-shadow: 0 -0.4em 1.2em rgba(28, 31, 59, 0.14);
    transform: translateY(102%);
  }

  [data-flags~="sel"]:not([data-flags~="picked2"]) .demo-panel {
    transform: translateY(62%);
  }

  .demo-p-header {
    position: relative;
  }

  .demo-enlarge,
  .demo-p-letters .demo-small,
  .demo-p-ask .demo-small {
    display: none;
  }

  .demo-menu {
    left: 4%;
    width: 15.5em;
  }

  .demo-otto {
    display: none;
  }
}

@media (max-width: 899px) {
  .demo-controls {
    grid-template-columns: auto minmax(0, 1fr) auto;
    grid-template-areas: "rail rail rail" "back . next";
    max-width: 480px;
    margin: 16px auto 0;
  }

  .demo-rail {
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }

  .demo-rail-btn {
    font-size: 13px;
    padding: 4px 3px 7px;
  }
}

/* ============ keyframes ============ */
@keyframes demo-rise {
  from { opacity: 0; translate: 0 0.6em; }
}

@keyframes demo-soft-fade {
  from { opacity: 0; }
}

@keyframes demo-arrive {
  from { opacity: 0.4; translate: 0 0.35em; }
}

@keyframes demo-sweep {
  from { background-size: 0% 100%; }
}

@keyframes demo-note {
  from { opacity: 0; translate: 0 0.3em; }
  to { opacity: 1; }
}

@keyframes demo-draw {
  from { stroke-dashoffset: 1; }
}

@keyframes demo-underline {
  from { transform: scaleX(0); }
}

@keyframes demo-thump {
  0% { opacity: 0; scale: 2.2; rotate: 6deg; }
  60% { opacity: 1; scale: 0.92; rotate: -9deg; }
  100% { opacity: 1; scale: 1; rotate: -7deg; }
}

@keyframes demo-pop {
  from { opacity: 0; scale: 0.4; }
  to { opacity: 1; }
}

@keyframes demo-pop-centre {
  from { opacity: 0; scale: 0.2; }
  to { opacity: 1; }
}

@keyframes demo-drive {
  from { opacity: 0; translate: -3em 0; }
  60% { opacity: 1; }
  to { opacity: 1; }
}

@keyframes demo-drop {
  from { opacity: 0; translate: 0 -1.2em; scale: 1.3; }
  to { opacity: 1; }
}

@keyframes demo-blink {
  50% { opacity: 1; }
}

@keyframes demo-pulse {
  50% { opacity: 0.25; }
}

@keyframes demo-press {
  50% { scale: 0.95; }
}

@keyframes demo-click {
  50% { scale: 0.82; }
}

@keyframes demo-ripple {
  from { opacity: 1; scale: 0.3; }
  to { opacity: 0; scale: 1.3; }
}

@keyframes demo-fill {
  to { transform: scaleX(1); }
}

/* ============ jumps and reduced motion: final states, no movement ============ */
.demo-jump *,
.demo-jump *::before,
.demo-jump *::after {
  transition: none !important;
}

.demo-still *,
.demo-still *::before,
.demo-still *::after {
  animation: none !important;
  transition: none !important;
}

@media (prefers-reduced-motion: reduce) {
  .demo-tour *,
  .demo-tour *::before,
  .demo-tour *::after {
    animation: none !important;
    transition: none !important;
  }
}
