.david-anchor {
  position: fixed;
  inset: 0 auto auto 0;
  width: 0;
  height: 0;
  z-index: 6;
  pointer-events: none;
  user-select: none;
  -webkit-user-select: none;
}
.david-carrier, .david-crop, .david-motion, .david-image {
  position: absolute;
  pointer-events: none;
}
.david-carrier { inset: 0; }
.david-crop {
  width: var(--actor-width);
  height: var(--actor-height);
  left: calc(-.5 * var(--actor-width));
  bottom: 0;
}
.david-anchor[data-action="intro"] .david-crop { overflow: hidden; }
.david-motion, .david-image { inset: 0; width: 100%; height: 100%; }
.david-motion { transform-origin: 50% 100%; }
.david-image {
  object-fit: contain;
  object-position: center bottom;
  image-rendering: pixelated;
  filter: drop-shadow(0 2px 0 rgba(79,57,51,.19));
}
.david-anchor[data-action="sleep"] .david-image,
.david-anchor[data-action="turn"] .david-image,
.david-anchor[data-action="wake"] .david-image { object-position: right bottom; }
.david-anchor[data-pose="cry"] .david-motion::after {
  content: ""; position: absolute; left: 76%; bottom: 29%;
  width: 5px; height: 7px; background: #96c7df;
  outline: 1px solid #486779; transform: rotate(15deg);
  animation: david-drop 1.65s ease-in infinite;
}
@keyframes david-drop {
  0%, 21% { opacity: 0; transform: translateY(-2px) scale(.4); }
  40% { opacity: 1; transform: translateY(0); }
  70%,100% { opacity: 0; transform: translateY(16px) scale(.7); }
}
.has-david .hour-rail { margin-top: 52px; }
.has-david .hour-rail .range { width: 68%; position: relative; z-index: 7; }
.has-david .hour-limits { grid-template-columns: 32% auto 1fr; }
.has-david .hour-rail .early {
  flex-basis: 32%;
  align-self: end; transform: translateY(7px); background-position: center 1px;
}
.has-david .scene .choices { position: relative; }
.david-talk {
  position: fixed; top: 0; left: 0; z-index: 8;
  margin: 0; padding: 8px 13px; width: max-content;
  max-width: min(23ch, calc(100vw - 20px));
  color: #442f39; background: #fff9ee; border: 1.5px solid #70505a;
  border-radius: 13px 15px 12px 14px; box-shadow: 1px 3px 0 #ae858577;
  font: 600 clamp(14px,1.55vw,17px)/1.3 var(--sans,system-ui,sans-serif);
  text-align: left; overflow-wrap: break-word;
  pointer-events: none;
}
.david-tail {
  position: absolute; left: 0; top: 0; width: 100%; height: 100%;
  overflow: visible; pointer-events: none;
}
.david-tail path {
  fill:#fff9ee; stroke:#70505a; stroke-width:1.5px;
  stroke-linecap:round; stroke-linejoin:round;
}
.david-lines { display:grid; min-width:0; }
.david-measure, .david-printed {
  grid-area:1 / 1; max-height: min(38vh,12em); overflow:hidden;
  text-align:left; white-space:pre-line;
}
.david-measure { visibility:hidden; }
.david-mouth-pin { position:absolute; width:0; height:0; pointer-events:none; }
.david-announcement {
  position:absolute; width:1px; height:1px; padding:0; margin:-1px;
  overflow:hidden; clip-path:inset(50%); white-space:nowrap;
}
.has-david[data-tape-scene="tears"] .scene { animation: none; transform: none; }
.has-david[data-tape-scene="tears"] .tape-actions .secondary {
  position: fixed; right: 22px; bottom: 174px; z-index: 9;
  max-width: 175px; padding: 9px 14px;
}
.has-david[data-tape-scene="tears"] .foot span:last-child { visibility: hidden; }
.has-david .taped[data-presses="1"]::before {
  transform-origin: 15% center;
  animation: david-smooth-tape .7s ease-out .68s both;
}
@keyframes david-smooth-tape {
  0% { transform: rotate(-48deg) skewY(9deg); }
  62% { transform: rotate(-27deg) scaleY(.82); }
  100% { transform: rotate(-32deg) scaleY(1); }
}
/* A clear ledge above wrapped options lets his feet reach a button without covering the label. */
@media(max-width: 860px) {
  .has-david[data-scene="welcome"] .choices { row-gap: 18px; }
  .has-david:is([data-scene="day"],[data-scene="place"],[data-scene="note"]) .controls {
    margin-bottom: clamp(116px,32vw,146px);
  }
  .has-david[data-tape-scene="tears"] .tape-actions {
    margin-bottom: 165px;
  }
  .has-david[data-tape-scene="tears"] .tape-actions .secondary { right: 12px; bottom: 108px; max-width: 156px; }
  .david-talk { font-size: 14px; max-width: min(20ch,calc(100vw - 18px)); }
}
@media(prefers-reduced-motion: reduce) {
  .david-motion::after { animation: none !important; }
}
