:root {
  --action-font: 16px/1.3 Georgia, serif;
  color-scheme: dark;
  --ink: #f1e8d5;
  --muted: #b9b6bc;
  --gold: #dfc38d;
  --edge: #55505c;
  --panel: #191a25;
  --focus: #e8cf97;
  --danger: #ff8f84;
  font-family: ui-sans-serif, system-ui, sans-serif;
  background: #101119;
  color: var(--ink);
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
button {
  font: inherit;
  color: inherit;
}
button {
  min-height: 44px;
  border: 1px solid var(--edge);
  border-radius: 5px;
  background: #252632;
  padding: 8px 13px;
  cursor: pointer;
}
button:hover {
  border-color: var(--gold);
  background: #353342;
}
button:disabled {
  opacity: 0.4;
  cursor: default;
}
button[aria-pressed="true"] {
  border-color: var(--gold);
  box-shadow: inset 0 0 0 1px var(--gold);
  background: #3f3940;
}
button:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 3px;
}
.primary {
  background: var(--gold);
  color: #1a1a24;
  border-color: var(--gold);
  font-weight: 750;
  min-width: 88px;
}
.primary:hover {
  background: #f3d9a6;
}
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 20px;
  min-height: 58px;
  background: #14151d;
  flex: none;
}
.brand {
  letter-spacing: 0.16em;
  font-size: 12px;
  font-weight: 750;
}
.brand span {
  letter-spacing: 0;
  font-family: Georgia, serif;
  font-weight: 400;
  font-size: 18px;
  margin-left: 18px;
  color: var(--muted);
}
.top-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}
.top-actions button {
  font-size: 12px;
}
@media (max-width: 380px) {
  .topbar .brand {
    display: none;
  }
  .topbar .top-actions {
    width: 100%;
    justify-content: space-between;
  }
}
.music-controls {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 16px;
}
.music-controls input {
  min-height: 44px;
  width: 150px;
  accent-color: var(--gold);
}
.music-status {
  color: var(--muted);
  font-size: 14px;
}
.build-info {
  margin: 16px 0 0;
  color: var(--muted);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  overflow-wrap: anywhere;
}
.build-info a,
.action-beat-note a {
  color: inherit;
}
main {
  min-height: 0;
  display: flex;
  flex: 1;
  flex-direction: column;
}
.stage {
  position: relative;
  min-height: 0;
  flex: 1;
  isolation: isolate;
  /* Keep focus and reply scrolling inside the dialogue, with the scene fixed. */
  overflow: clip;
  background: #232330;
  container-type: size;
}
/* One stage frames every painting. A place's data sets the point kept in
   view when the painting is cropped, and may anchor a resident to the
   painting. The painting then moves only as far as keeps that resident whole
   and standing above the hand, and it always fills the stage. A portrait
   screen shows the painting's full height, so there it cannot rise: the
   resident steps up off its spot instead, just far enough that its cutout
   clears the resting hand, a beat's taller one included. Raising the hand
   never lifts it. */
.stage {
  --art-ratio: 1.5;
  --focus-x: 0.5;
  --focus-y: 0.5;
  --figure-left: 0;
  --figure-right: 1;
  --figure-top: 0;
  --figure-width: 0;
  --floor-line: calc(var(--dock-height) + 6px);
  --figure-floor: calc(var(--dock-height) + 6px);
  --art-w: max(100cqw, calc(100cqh * var(--art-ratio)));
  --art-h: calc(var(--art-w) / var(--art-ratio));
  /* A cutout's feet sit 8% of its square height below its anchor. */
  --figure-foot: calc(
    var(--figure-top) + var(--figure-width) * var(--art-ratio) * 0.08
  );
  --art-left: clamp(
    calc(100cqw - var(--art-w)),
    clamp(
      calc(100cqw - var(--figure-right) * var(--art-w)),
      calc((100cqw - var(--art-w)) * var(--focus-x)),
      calc(var(--figure-left) * var(--art-w) * -1)
    ),
    0px
  );
  --art-top: clamp(
    calc(100cqh - var(--art-h)),
    min(
      calc((100cqh - var(--art-h)) * var(--focus-y)),
      calc(100cqh - var(--figure-floor) - var(--figure-foot) * var(--art-h))
    ),
    0px
  );
  /* Read in .stage-figure, whose container is this stage. */
  --figure-lift: max(
    0px,
    calc(
      var(--art-top) + var(--figure-foot) * var(--art-h) + var(--resting-dock) +
        6px - 100cqh
    )
  );
}
.backdrop,
.scene-shade {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: var(--art-left) var(--art-top);
  z-index: -2;
}
.stage-figures {
  position: absolute;
  left: var(--art-left);
  top: var(--art-top);
  width: var(--art-w);
  height: var(--art-h);
  pointer-events: none;
}
.stage-figure {
  position: absolute;
  width: var(--sprite-width);
  height: auto;
  left: var(--sprite-left);
  top: var(--sprite-top);
  transform: translate(-50%, -92%);
  filter: drop-shadow(0 5px 4px #17201570) var(--tod-figure,);
}
@media (orientation: portrait) {
  .stage-figure {
    translate: 0 calc(var(--figure-lift) * -1);
  }
}
/* A place still face down is black behind whoever is revealed; turning its
   card brings the painting up out of the black (stage-reveal.mjs). */
.stage::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: #000;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.9s ease-in-out;
}
.stage[data-place-covered="true"]::after {
  opacity: 1;
  transition: none;
}
.stage[data-place-covered="true"] > .stage-grade {
  display: none;
}
@media (prefers-reduced-motion: reduce) {
  .stage::after {
    transition: none;
  }
}
.scene-shade {
  z-index: -1;
  background: linear-gradient(
    180deg,
    #10111bc4,
    transparent 38%,
    #10111b22 65%,
    #10111b8c
  );
}
.cast {
  position: absolute;
  inset: 58px 7% 250px;
  pointer-events: none;
}
.portrait {
  position: absolute;
  left: var(--stage-x);
  bottom: var(--stage-floor);
  height: var(--stage-size);
  aspect-ratio: 2 / 3;
  transform: translateX(-50%);
  pointer-events: none;
  transition:
    left 0.85s ease-in-out,
    bottom 0.85s ease-in-out,
    height 0.85s ease-in-out;
}
.portrait[data-depth="foreground"] {
  z-index: 3;
}
.portrait[data-depth="middle"] {
  z-index: 2;
}
.portrait[data-depth="back"] {
  z-index: 1;
}
.portrait-body {
  position: relative;
  width: 100%;
  height: 100%;
  transform-origin: 50% 99%;
  transition:
    filter 0.22s,
    transform 0.22s;
}
.portrait.active .portrait-body {
  filter: brightness(1.08);
  transform: translateY(-2px) rotate(var(--lean));
}
.portrait img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: bottom;
  filter: drop-shadow(0 8px 14px #08091390) var(--tod-figure,);
}
.portrait img[data-flip="true"] {
  transform: scaleX(-1);
}
/* Hand positions follow the original 2:3 character artwork. The prop shares
   the body's movement and scales with it at every viewport size. */
.portrait {
  --hand-x: 83%;
  --hand-y: 32.5%;
  --held-offset: -100%;
}
.portrait[data-avatar="mara"] {
  --hand-x: 91%;
  --hand-y: 28%;
}
.portrait[data-avatar="ash"] {
  --hand-x: 90%;
  --hand-y: 38%;
}
.portrait[data-avatar="nell"] {
  --hand-x: 88%;
  --hand-y: 41%;
}
.portrait[data-avatar="tavi"] {
  --hand-x: 92%;
  --hand-y: 20%;
  --held-offset: -20%;
}
.portrait[data-avatar="rue"] {
  --hand-x: 83%;
  --hand-y: 24%;
  --held-offset: -50%;
}
.portrait[data-avatar="orin"] {
  --hand-x: 51%;
  --hand-y: 24%;
  --held-offset: -50%;
}
.portrait[data-avatar="ada"] {
  --hand-x: 88%;
  --hand-y: 22%;
  --held-offset: -15%;
}
.portrait-held-item {
  position: absolute;
  left: var(--hand-x);
  top: var(--hand-y);
  width: 30%;
  aspect-ratio: 1;
  transform: translate(-50%, var(--held-offset));
  pointer-events: none;
}
.portrait[data-flip="true"] .portrait-held-item {
  left: calc(100% - var(--hand-x));
}
.portrait-held-item img {
  position: absolute;
  inset: 0;
  object-position: center bottom;
  filter: drop-shadow(0 2px 3px #08091390) var(--tod-figure,);
}
.portrait-held-item[data-lit="true"] > img:first-child {
  filter: drop-shadow(0 0 7px #e0a94a99);
}
.portrait-held-item[data-lit="false"] > img:first-child {
  filter: saturate(0.35) brightness(0.48);
}
.portrait-held-item[data-covered="true"] > img:first-child {
  opacity: 0.35;
}
.portrait-held-item .object-cover {
  filter: brightness(0.65);
}
.portrait-held-item[data-ringing="true"] > img:first-child {
  animation: sounding 0.5s ease-in-out infinite alternate;
  transform-origin: 50% 20%;
}
/* Things lying in this place stand on the painted floor as cutouts, behind the
   cast and clear of the dialogue. Wide stages set them beside the dialogue;
   narrower ones stand fewer, smaller props on the floor above it, and short
   ones set them beside the hand at the front of the floor. */
.floor-items {
  position: absolute;
  z-index: 0;
  inset: 0;
  pointer-events: none;
}
.floor-item {
  --x: var(--wide-x);
  --lift: var(--wide-lift);
  --prop-size: clamp(56px, 10cqh, 104px);
  position: absolute;
  left: clamp(
    calc(var(--prop-size) / 2 + 4px),
    var(--x),
    calc(100% - var(--prop-size) / 2 - 4px)
  );
  bottom: calc(var(--floor-line) + var(--lift) * 1.2cqh);
  width: calc(var(--prop-size) * (1 - var(--lift) * 0.04));
  aspect-ratio: 1;
  transform: translateX(-50%);
  pointer-events: none;
}
@media (max-width: 1299px) {
  .stage {
    --floor-line: calc(var(--dock-height) + var(--dialogue-reserve, 140px));
  }
  .floor-item {
    --x: var(--narrow-x);
    --lift: var(--narrow-lift);
    --prop-size: clamp(34px, 8cqh, 72px);
  }
  .floor-item[data-narrow="false"] {
    display: none;
  }
}
@media (max-width: 1299px) and (max-height: 640px) {
  .stage {
    --floor-line: 10px;
  }
  .floor-item {
    --x: var(--short-x);
    --lift: var(--short-lift);
  }
  .floor-item[data-narrow] {
    display: block;
  }
  .floor-item[data-short="false"] {
    display: none;
  }
}
.floor-item img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center bottom;
  filter: drop-shadow(0 5px 5px #08091399) var(--tod-figure,);
}
.floor-item[data-lit="true"] > img:first-child {
  filter: drop-shadow(0 5px 5px #08091399) drop-shadow(0 0 9px #e0a94a99);
}
.floor-item[data-lit="false"] > img:first-child {
  filter: drop-shadow(0 5px 5px #08091399) saturate(0.35) brightness(0.48);
}
.floor-item[data-covered="true"] > img:first-child {
  opacity: 0.35;
}
.floor-item .object-cover {
  filter: brightness(0.65);
}
.floor-item[data-ringing="true"] > img:first-child {
  animation: sounding 0.5s ease-in-out infinite alternate;
  transform-origin: 50% 20%;
}
.dialogue {
  position: absolute;
  z-index: 4;
  bottom: 14px;
  left: 50%;
  transform: translateX(-50%);
  width: min(860px, calc(100% - 40px));
  border: 1px solid #a38b64;
  border-radius: 7px;
  background: #181925ed;
  box-shadow: 0 10px 35px #08091470;
  padding: 10px 18px;
  backdrop-filter: blur(12px);
}
.dialogue-heading {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
}
#speaker {
  color: var(--gold);
  font-family: Georgia, serif;
  font-size: 18px;
}
.line-controls {
  margin-left: auto;
  display: flex;
  gap: 4px;
}
.line-controls button {
  min-height: 44px;
  min-width: 44px;
  padding: 0 9px;
  font-size: 22px;
  border-color: transparent;
  background: transparent;
}
#dialogue-text {
  display: block;
  position: relative;
  text-align: left;
  font:
    16px/1.4 Georgia,
    serif;
  height: 68px;
  padding-right: 1em;
  overflow-x: hidden;
  overflow-y: auto;
  scrollbar-gutter: stable;
  margin: 5px 0 12px;
}
.speech-line {
  display: block;
  width: 100%;
  padding: 0;
  border: 0;
  background: transparent;
  text-align: left;
}
.speech-line:hover {
  background: transparent;
}
/* One reveal writes dialogue and inscribed effects (dialogue.mjs): every
   letter is in place from the start, and its ink fades in over 60 ms on its
   turn, so two or three letters are soft at once. A tap fades the rest in
   together. The caret has its own colour and never fades. */
.speech-letter {
  visibility: hidden;
  position: relative;
  color: transparent;
  transition: color 60ms linear;
}
.speech-letter.revealed {
  visibility: visible;
  color: inherit;
}
/* A card named in text takes its card's colour (card-names.mjs). */
.card-name {
  color: var(--tier-color);
}
[data-reveal="finish"] .speech-letter {
  transition: color 150ms ease;
}
[data-reveal="instant"] .speech-letter {
  transition: none;
}
@media (prefers-reduced-motion: reduce) {
  .speech-letter {
    transition: none;
  }
}
.speech-letter.cursor::after {
  content: "";
  visibility: visible;
  position: absolute;
  left: 100%;
  bottom: 0;
  width: 0.5em;
  border-bottom: 2px solid var(--gold);
  animation: speech-blink 0.9s steps(1) infinite;
}
[data-revealing="true"] .speech-letter.cursor::after {
  width: 0;
  height: 1em;
  border-bottom: 0;
  border-left: 2px solid var(--gold);
  animation: none;
}
.speech-hint {
  display: block;
  height: 12px;
  line-height: 12px;
  text-align: right;
  font-size: 10px;
  color: var(--muted);
  margin-top: 2px;
}
#story-status {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 14px;
}
#story-status[hidden] {
  display: none;
}
/* The first tap on the Thinking card asks before it cancels. */
#story-status[data-armed="true"] {
  color: var(--gold);
}
#story-status[data-armed="true"] .thinking-orbit {
  display: none;
}
.thinking-orbit {
  width: 15px;
  height: 15px;
  border: 2px solid #a48d6340;
  border-top-color: var(--gold);
  border-radius: 50%;
  animation: thinking-orbit 1.2s linear 12;
}
@keyframes thinking-orbit {
  to {
    transform: rotate(360deg);
  }
}
@media (prefers-reduced-motion: reduce) {
  .thinking-orbit {
    animation: none;
  }
}
@keyframes speech-blink {
  50% {
    opacity: 0;
  }
}
dialog {
  color: var(--ink);
  background: #1d1e2a;
  border: 1px solid #817053;
  border-radius: 9px;
  width: min(600px, calc(100% - 28px));
  max-height: 85dvh;
  padding: 22px;
  box-shadow: 0 20px 90px #0008;
}
dialog::backdrop {
  background: #090b16ab;
  backdrop-filter: blur(5px);
}
dialog p {
  font-size: 14px;
  line-height: 1.6;
}
h2 {
  font:
    normal 25px Georgia,
    serif;
  margin: 0;
}
.modal-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
}
.messages {
  max-height: 55dvh;
  overflow: auto;
  margin-bottom: 16px;
}
.message {
  border-bottom: 1px solid #ffffff15;
  padding: 10px 0;
}
.message p {
  margin: 6px 0;
  font-size: 13px;
}
.speaker {
  font-weight: 650;
  color: var(--gold);
  font-size: 12px;
  display: flex;
  justify-content: space-between;
}
.speaker span {
  font-weight: 400;
  color: var(--muted);
  font-size: 10px;
}
.sr-only {
  position: absolute;
  top: 0;
  left: 0;
  margin: -1px;
  padding: 0;
  border: 0;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
}
[hidden] {
  display: none !important;
}
@media (max-width: 700px) {
  .topbar {
    padding: 5px 10px;
    min-height: 52px;
  }
  .brand {
    font-size: 10px;
  }
  .brand span {
    display: none;
  }
  .top-actions {
    gap: 4px;
  }
  .top-actions button {
    padding: 5px 9px;
  }
  .cast {
    inset: 65px 4% 235px;
  }
  .cast:not([data-shared="true"])[data-count="3"]
    .portrait[data-depth="foreground"] {
    left: 19%;
  }
  .cast:not(
      [data-shared="true"]
    )[data-count="3"][data-layout="foreground-right"]
    .portrait[data-depth="foreground"] {
    left: 81%;
  }
  .dialogue {
    width: calc(100% - 20px);
    bottom: 9px;
    padding: 8px 11px;
  }
  .dialogue-heading {
    gap: 8px;
  }
  #speaker {
    font-size: 16px;
  }
  #dialogue-text {
    font-size: 14px;
    height: 60px;
    margin: 2px 0 8px;
  }
  .play-dock {
    padding: 0 8px 4px;
  }
  .card .art svg {
    width: 34px;
    height: 42px;
  }
}
@media (max-height: 740px) {
  .topbar {
    min-height: 48px;
    padding-top: 2px;
    padding-bottom: 2px;
  }
  .cast {
    top: 55px;
    bottom: 175px;
  }
  .dialogue {
    bottom: 7px;
    padding: 5px 10px;
  }
  #speaker {
    font-size: 14px;
  }
  #dialogue-text {
    font-size: 12px;
    line-height: 1.3;
    height: 32px;
    margin: 3px 0 6px;
  }
}
/* Frame the group from the scene height, even on a very wide screen. Keep
   their feet above the full two-line exchange, with room for the title. */
@media (min-width: 701px) {
  .cast {
    --cast-top: 18px;
    --cast-bottom: 242px;
    inset: auto 0 var(--cast-bottom);
    height: min(
      580px,
      45vw,
      calc(100cqh - var(--cast-top) - var(--cast-bottom))
    );
    margin-inline: auto;
    width: min(
      90%,
      1200px,
      calc((100cqh - var(--cast-top) - var(--cast-bottom)) * 2.8)
    );
  }
}
@media (min-width: 701px) and (max-height: 740px) {
  .cast {
    --cast-bottom: 168px;
  }
}
/* Frame the cast close. One or two avatars stand waist-deep behind the
   exchange, three stand knee-deep, so faces read large on a wide screen. */
@media (min-width: 701px) {
  .cast[data-count="1"],
  .cast[data-count="2"] {
    --cast-bottom: 0px;
    height: min(
      980px,
      70vw,
      calc(100cqh - var(--cast-top) - var(--cast-bottom))
    );
  }
  .cast[data-count="3"] {
    --cast-bottom: 40px;
    height: min(
      820px,
      60vw,
      calc(100cqh - var(--cast-top) - var(--cast-bottom))
    );
  }
}
@media (max-width: 700px) {
  .cast[data-count="1"],
  .cast[data-count="2"] {
    bottom: 70px;
  }
  .cast[data-count="3"] {
    bottom: 130px;
  }
}
/* Short windows keep a readable scene; the same card row follows below. */
@media (max-height: 640px) {
  body {
    overflow-y: auto;
  }
  .stage {
    min-height: 460px;
  }
}
/* Labels for the reveal and the travel veil, shown at every width. */
.kicker {
  margin: 0;
  font-size: 11px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--gold);
}

/* A change of place dips the scene to dark with the destination's name. */
.travel {
  position: absolute;
  inset: 0;
  z-index: 6;
  display: grid;
  place-content: center;
  gap: 6px;
  text-align: center;
  background: radial-gradient(circle at 50% 45%, #1b1c28f2, #06070c);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.36s ease-in-out;
}
.travel.travelling {
  opacity: 1;
}
/* Driven off: the scene slowly fades to black for the loss screen, and the
   black lifts slowly, wordless, onto where the player comes to. */
.travel.fainting {
  opacity: 1;
  background: #000;
  transition-duration: var(--faint-ms, 1.4s);
}
.travel.fainting:not(.travelling) > :not(.defeat-reveal),
.travel.waking > * {
  visibility: hidden;
}
.travel.waking {
  background: #000;
  transition-duration: var(--wake-ms, 2.5s);
}

/* Reduced motion means nothing moves, not that nothing changes: keyframe
   motion stops, and a transition only fades (opacity), at most 300 ms
   (smoke-card-reduced-fades.mjs checks every element's). */
@media (prefers-reduced-motion: reduce) {
  * {
    animation: none !important;
    transition-property: opacity !important;
    scroll-behavior: auto !important;
  }
  .travel {
    transition-duration: 300ms;
  }
}

/* Let the farewell finish before the cutout leaves its existing slot. */
.portrait.departed {
  opacity: 0;
  translate: var(--exit-x) 0;
}
.hand[aria-busy="true"] .card,
#card-actions[aria-busy="true"] button {
  opacity: 0.7;
}
.hand[aria-busy="true"] .card:hover {
  transform: none;
}

@media (prefers-reduced-motion: reduce) {
  .portrait,
  .portrait-body {
    transition: none;
  }
  .portrait.active .portrait-body {
    transform: none;
  }
  .portrait.departed {
    translate: 0 0;
  }
}

.portrait.entering {
  visibility: hidden;
}

/* Image-first cards. The illustration is the face, not a banner above a report. */
:root {
  --card-width: clamp(174px, 15.5vw, 224px);
  --card-height: clamp(224px, 31dvh, 310px);
  --dock-height: calc(var(--card-height) * 0.75 + 12px);
  /* The resting hand's dock, which app.mjs's measured --dock-height leaves
     out once the hand rises. */
  --resting-dock: calc(var(--card-height) * 0.75 + 12px);
  --hand-top: 26px;
  --hand-inline: calc(var(--card-height) * 0.12);
}
body {
  background: #090d12;
}
.topbar {
  position: absolute;
  inset: 0 0 auto;
  z-index: 10;
  min-height: 58px;
  border: 0;
  background: linear-gradient(#090d12bc, #090d1200);
}
.top-actions button {
  background: #0e121888;
  border-color: #c7af7955;
  border-radius: 22px;
}
main {
  position: relative;
}
.stage {
  min-height: 0;
  flex: 1;
}
.play-dock {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 5;
  padding: 0 22px env(safe-area-inset-bottom);
  background: linear-gradient(#090d1200, #090d12bd 55%, #090d12f5);
  border: 0;
  pointer-events: none;
}
/* A play's journeys leave the locked hand where it is (strikes tuck it
   down, combat.css): only the player lowers it. The dialogue above a raised hand fades out of the
   fighters' way; beside a resting hand it sinks to a strip. Reduced motion
   fades it out and back in place. */
body .dialogue {
  transition:
    translate 280ms ease-in-out,
    opacity 280ms ease-in-out;
}
body .dialogue[data-dropped="true"] {
  opacity: 0;
}
.dialogue .beat-behind {
  transition: opacity 280ms ease-in-out;
}
.dialogue[data-dropped="true"] .beat-behind {
  opacity: 0;
}
@media (prefers-reduced-motion: reduce) {
  body .dialogue {
    transition: opacity 280ms ease-in-out;
  }
  :root body[data-hand-expanded] .dialogue[data-dropped="true"] {
    translate: none;
    opacity: 0;
  }
}
.hand-wrap {
  position: relative;
  pointer-events: auto;
}
.hand {
  display: flex;
  justify-content: safe center;
  gap: 0;
  flex-wrap: nowrap;
  overflow-x: auto;
  overflow-y: hidden;
  /* Each redraw sets the scroll itself: Safari's scroll anchoring moved it. */
  overflow-anchor: none;
  /* Room for the outer cards' lean, the folded quest and a chosen card's lift
     sits inside the scroll box but above the dock. The scroll padding keeps
     it when a focused card scrolls into view. */
  margin-top: calc(12px - var(--hand-top));
  padding: var(--hand-top) var(--hand-inline) 0;
  height: calc(var(--card-height) * 0.75 + var(--hand-top));
  transition: height 220ms ease-out;
  scrollbar-width: none;
  scrollbar-color: #ad97744d transparent;
  scroll-padding: var(--hand-top) var(--hand-inline) 0;
  scroll-snap-type: x proximity;
  overscroll-behavior-x: contain;
}
/* Cards past either edge fade out instead of meeting a hard cut. */
.hand {
  --hand-fade: 44px;
}
.hand[data-fade] {
  --fade-start: 0px;
  --fade-end: 0px;
  -webkit-mask-image: linear-gradient(
    to right,
    transparent,
    #000 var(--fade-start),
    #000 calc(100% - var(--fade-end)),
    transparent
  );
  mask-image: linear-gradient(
    to right,
    transparent,
    #000 var(--fade-start),
    #000 calc(100% - var(--fade-end)),
    transparent
  );
}
.hand[data-fade~="start"] {
  --fade-start: var(--hand-fade);
}
.hand[data-fade~="end"] {
  --fade-end: var(--hand-fade);
}
@media (max-width: 700px) {
  .hand {
    --hand-fade: 28px;
  }
}
/* Settings is a hand of cards in place of the play hand, its groups and
   their settings drawn as places and their things (settings-cards.mjs). */
#settings-screen {
  position: static;
  width: auto;
  max-height: none;
  margin: 0;
  padding: 0;
  border: 0;
  background: none;
  box-shadow: none;
}
/* Authoring uses the same hand, seen from above as branches of open stacks. */
#settings-screen[data-layout="tree"] {
  position: fixed;
  inset: 74px 22px var(--tree-descriptor-height, 150px);
  height: calc(100dvh - 74px - var(--tree-descriptor-height, 150px));
  width: auto;
  max-width: none;
  pointer-events: auto;
}
/* In the editor, the cards carry the rounded edges. */
body:has(#settings-screen[data-layout="tree"][open])
  :is(
    .top-actions,
    .top-actions button,
    .dialogue,
    .action-panel,
    #card-actions button
  ) {
  border-radius: 0;
}
body:has(#settings-screen[data-layout="tree"][open]) .settings-scene {
  opacity: 1;
  animation: none;
}
#settings-screen[data-layout="tree"] #settings-hand {
  --card-height: 180px;
  --fan-overlap: 0px;
  display: grid;
  grid-template-columns: repeat(var(--tree-columns), minmax(124px, 156px));
  grid-auto-rows: max-content;
  gap: 28px 12px;
  align-content: start;
  justify-content: safe center;
  height: 100%;
  margin: 0;
  padding: 14px 10px;
  overflow: auto;
  overscroll-behavior: contain;
  scroll-padding: 14px;
  scroll-snap-type: none;
  mask-image: none;
}
#settings-screen[data-layout="tree"] .card-frame {
  grid-row: var(--tree-row);
  grid-column: var(--tree-column) / span var(--tree-span);
  justify-self: center;
  margin: 0;
  top: 0;
  rotate: none;
  translate: none;
  transform: none;
  filter: none;
}
#settings-screen[data-layout="tree"] .card {
  touch-action: pan-x pan-y;
}
#settings-screen[data-layout="tree"] .art[data-kind="avatar"] img {
  object-fit: contain;
}
#settings-screen[data-layout="tree"] .card :is(.name, .quest-head) {
  padding-inline: 8px;
}
#settings-screen[data-layout="tree"] .quest-verb {
  white-space: normal;
}
@media (max-width: 700px) {
  #settings-screen[data-layout="tree"] {
    inset: 64px 8px var(--tree-descriptor-height, 150px);
    height: calc(100dvh - 64px - var(--tree-descriptor-height, 150px));
  }
  #settings-screen[data-layout="tree"] #settings-hand {
    --card-height: 144px;
    grid-template-columns: repeat(12, minmax(0, 1fr));
    gap: 20px 4px;
    padding: 12px 4px;
  }
  #settings-screen[data-layout="tree"] .card-frame {
    grid-row: var(--tree-phone-row);
    grid-column: var(--tree-phone-column) / span var(--tree-phone-span);
  }
  #settings-screen[data-layout="tree"] .card-frame[data-phone="false"] {
    display: none;
  }
  #settings-screen[data-layout="tree"] .card-frame[data-ancestor="true"] {
    --card-height: 106px;
  }
  #settings-screen[data-layout="tree"] [data-ancestor="true"] .quest-head {
    padding-inline: 4px;
    letter-spacing: 0.04em;
  }
}
/* Behind it the scene fades to black under the world's logo, lifted and
   scaled as the title lifts it over its card (title-intro.mjs). Then the
   owner's workbench comes up as Settings' own scene. */
.settings-veil {
  position: absolute;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  background: #000;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition:
    opacity 0.6s ease,
    visibility 0s 0.6s;
}
body:has(#settings-screen[open]) .settings-veil {
  opacity: 1;
  visibility: visible;
  transition: opacity 0.6s ease;
}
.settings-scene {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  /* Misty: soft and low in contrast behind the settings cards, a little
     enlarged so the blur leaves no dark rim (#2273). */
  filter: blur(3px) contrast(0.7) brightness(1.08) saturate(0.75);
  scale: 1.04;
  opacity: 0;
  /* It stays while the veil fades out. */
  animation: settings-scene-hold 0.6s;
}
body:has(#settings-screen[open]) .settings-scene {
  animation: settings-scene 0.8s ease 1.2s both;
}
@keyframes settings-scene {
  to {
    opacity: 1;
  }
}
@keyframes settings-scene-hold {
  from,
  to {
    opacity: 1;
  }
}
.settings-logo {
  width: min(76vw, 1400px);
  max-height: 80dvh;
  object-fit: contain;
  transform: translateY(-14dvh) scale(0.8);
}
@media (max-width: 640px) {
  .settings-logo {
    width: calc(100vw - 32px);
  }
  /* A phone shows a narrow slice: the armillary sphere, not the candle. */
  .settings-scene {
    object-position: 64% center;
  }
}
@media (prefers-reduced-motion: reduce) {
  .settings-veil,
  body:has(#settings-screen[open]) .settings-veil {
    transition: none;
  }
  .settings-scene,
  body:has(#settings-screen[open]) .settings-scene {
    animation-duration: 0s;
  }
}
.hand-wrap:has(> #settings-screen[open]) > #hand,
body:has(#settings-screen[open]) .dialogue .beat-card {
  display: none;
}
/* Keep the chosen card at the position set by revealHandCard. */
.hand:has(.card-frame[data-raised="true"]) {
  scroll-snap-type: none;
}
.hand-wrap::before,
.hand-wrap::after {
  display: none;
}
/* Avatars and things stand upright at 2:3, the carved back's shape. An
   uncovered place keeps the wider, landscape-leaning card; on phones it
   leans the same way at 4:5. */
body .card-frame {
  --frame-width: calc(var(--card-height) * 2 / 3);
  position: relative;
  flex: 0 0 var(--frame-width);
  width: var(--frame-width);
  height: var(--card-height);
  scroll-snap-align: start;
  transition:
    transform 0.22s ease-out,
    filter 0.22s ease-out;
}
body
  .card-frame:has(
    > .card.location:not([data-unrevealed="true"], [data-locked="true"])
  ) {
  --frame-width: max(var(--card-width), calc(var(--card-height) * 0.8));
}
/* The hand fans: each card overlaps the one before it and leans with its
   place in the row (--fan-at, set by fanHand), the chosen card on top. */
.hand {
  --fan-overlap: calc(var(--card-height) * 0.14);
}
.hand > .card-frame:not([hidden]) ~ .card-frame {
  margin-left: calc(var(--fan-overlap) * -1);
}
/* A raised or chosen card lies on top, so the card after it moves out from
   under it instead of hiding the start of its name. */
.hand
  > .card-frame:is(
    [data-raised="true"],
    :has(> .card[data-selected="true"])
  ):has(~ .card-frame:not([hidden])) {
  margin-right: var(--fan-overlap);
}
body .hand > .card-frame {
  --fan-at: 0;
  rotate: calc(clamp(-4, var(--fan-at), 4) * 1.2deg);
  top: calc(min(var(--fan-at) * var(--fan-at), 16) * 0.5px);
  transform-origin: 50% 120%;
}
body .hand > .card-frame:has(> .card[data-hovered="true"]),
body .hand > .card-frame:has(> .card:focus-visible) {
  z-index: 2;
}
/* Cards leaving the hand fall here as inert ghosts (card-exit.mjs). */
.card-exits {
  position: absolute;
  inset: 0;
  pointer-events: none;
  /* A card at the row's edge never widens the page as it goes. */
  overflow: clip;
}
body .card-frame[data-raised="true"] {
  z-index: 3;
  transform: translateY(-10px);
}
/* A chosen card lifts higher and wears one white edge over its tier border;
   the level-up glow owns the shadow. The rest dims. */
body .card-frame:has(> .card[data-selected="true"]) {
  z-index: 2;
  transform: translateY(-12px);
}
body .card {
  outline: 2px solid transparent;
  outline-offset: -2px;
  transition: outline-color 0.22s ease-out;
}
body .card[data-selected="true"] {
  outline-color: #fffaf0;
}
:is(body, :where(.title-intro)) .card:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 3px;
}
.hand:has(.card[data-selected="true"]) .card-frame:not([data-raised="true"]) {
  filter: saturate(0.45) brightness(0.6);
}
@media (prefers-reduced-motion: reduce) {
  body .card-frame,
  body .card {
    transition: none;
  }
}
/* A pointer over a card shuffles it up out of the fan: it lifts while the
   rest of the fan parts around it, and all settle back on leave. The full
   stack moves; the face keeps its shadow on the same layer. Only translate
   moves, so the hand's layout and scroll stay put and the hovered card keeps
   its edges under the pointer. Touch has no hover; reduced motion only
   brightens the card. */
@media (hover: hover) and (pointer: fine) and (prefers-reduced-motion: no-preference) {
  body .hand > .card-frame {
    transition:
      transform 0.22s ease-out,
      filter 0.22s ease-out,
      translate 180ms ease-out;
  }
  /* A chosen card is already up. */
  :is(#hand, #settings-hand):not([aria-busy="true"])
    > .card-frame:has(
      > .card[data-hovered="true"]:not([data-selected="true"])
    ) {
    translate: 0 -8px;
  }
  /* The fan parts around it: cards after it slide right, cards before it
     slide left. */
  :is(#hand, #settings-hand):not([aria-busy="true"])
    > .card-frame:has(> .card[data-hovered="true"])
    ~ .card-frame {
    translate: 12px 0;
  }
  :is(#hand, #settings-hand):not([aria-busy="true"])
    > .card-frame:has(~ .card-frame > .card[data-hovered="true"]) {
    translate: -12px 0;
  }
}
@media (prefers-reduced-motion: reduce) {
  :is(#hand, #settings-hand):not([aria-busy="true"]) .card:hover {
    filter: brightness(1.12);
  }
}
:is(body, :where(.title-intro)) .card {
  position: relative;
  width: 100%;
  height: 100%;
  display: block;
  padding: 0;
  overflow: hidden;
  border: 1px solid #a48d63b3;
  border-radius: 13px;
  text-align: center;
  background: #181b22;
  touch-action: pan-x;
  -webkit-tap-highlight-color: transparent;
  box-shadow: 0 6px 20px #0006;
  /* Its name sizes to the card's width (cqi). */
  container-type: inline-size;
}
body .card:hover {
  background: #181b22;
}
:is(body, :where(.title-intro)) .card .art {
  position: absolute;
  inset: 0;
  display: block;
  overflow: hidden;
  border-radius: inherit;
  background: radial-gradient(ellipse at 50% 66%, #70543c6e, #141b2499);
}
:is(body, :where(.title-intro)) .card .art img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
body .card.item .art img {
  inset: 6% 3% 12%;
  width: 94%;
  height: 82%;
  object-fit: contain;
  filter: drop-shadow(0 8px 10px #0009);
}
:is(body, :where(.title-intro)) .card.avatar .art img {
  --shown: calc(var(--figure-height, 1) * 0.78);
  inset: auto;
  /* The head stands below the name's band at the card's top. */
  top: calc(15% - 100% * var(--figure-top, 0) / var(--shown));
  left: 50%;
  width: auto;
  height: calc(100% / var(--shown));
  translate: calc(-100% * var(--head-x, 0.5)) 0;
  object-fit: fill;
}
/* Center the visible sleeping silhouette, not its transparent canvas. Keep
   the whole pose inside both axes; awake cards retain their head framing. */
body .card.avatar[data-sleeping="true"] .art img {
  top: 50%;
  left: 50%;
  height: min(calc(76% / var(--figure-height, 1)), calc(90cqi / var(--silhouette-width, 1) / var(--figure-ratio, 1)));
  translate: calc(-100% * var(--figure-center-x, 0.5)) calc(-100% * var(--figure-center-y, 0.5));
}
/* Every card's name sits at its top in the quest card's label: one font
   and treatment in its tier colour over a light shade, broken only between
   words (card-label.mjs keeps a hyphenated word whole). */
:is(body, :where(.title-intro)) .card :is(.name, .quest-head) {
  --label-size: max(10px, calc(var(--card-height) * 0.042));
  position: absolute;
  inset: 0 0 auto;
  z-index: 3;
  margin: 0;
  padding: calc(var(--label-size) * 0.85) 10px calc(var(--label-size) * 2.4);
  background: linear-gradient(#080b12db, #080b1285 50%, transparent);
  font:
    600 var(--label-size) / 1.18 system-ui,
    sans-serif;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  text-align: left;
  color: var(--tier-color, #c8dce6);
  text-wrap: balance;
  overflow-wrap: normal;
  word-break: keep-all;
  hyphens: none;
  text-shadow:
    0 1px 2px #000,
    0 0 8px #000c;
  pointer-events: none;
}
:is(body, :where(.title-intro)) .card .label-word {
  white-space: nowrap;
}
:is(body, :where(.title-intro)) .card .name:empty {
  display: none;
}
/* An unlit card dims its name with its face. */
.card[data-lit="false"] :is(.name, .quest-head) {
  filter: brightness(0.6);
}
/* A name stays clear of the next card's overlap in the fan. */
.hand
  > .card-frame:has(~ .card-frame:not([hidden]))
  .card
  :is(.name, .quest-head) {
  padding-right: calc(var(--fan-overlap) + 8px);
}
.hand
  > .card-frame:has(~ .card-frame:not([hidden])):has(> .card:is([data-hovered="true"], :focus-visible))
  .card
  :is(.name, .quest-head),
.hand
  > .card-frame:has(> .card[data-selected="true"])
  .card
  :is(.name, .quest-head),
/* A raised quest card lies over the next card. */
.hand > .card-frame.want-frame[data-raised="true"] .card .quest-head {
  padding-right: 10px;
}
/* A card lifted over the next (pointer or focus) covers its left edge, so
   that card's name moves clear of it. An unlit Settings place dims. */
.hand
  > .card-frame:has(> .card:is([data-hovered="true"], :focus-visible))
  + .card-frame
  > .card[data-setting]
  > :is(.quest-head, .name) {
  padding-left: calc(var(--fan-overlap) + 8px);
}
body .card[data-setting][data-lit="false"] .quest-ground {
  filter: saturate(0.35) brightness(0.48);
}
body .card[data-lit="true"] .art {
  background: radial-gradient(ellipse at 50% 60%, #e0a94a66, #151b24 76%);
}
body .card[data-lit="false"] .art > img:first-child,
body .card.want-card[data-lit="false"] .quest-ground {
  filter: saturate(0.35) brightness(0.48);
}
body .card[data-covered="true"] .art > img:first-child {
  opacity: 0.35;
}
body .card.item .art .object-cover {
  inset: 10% 3% 12%;
  height: 80%;
  filter: brightness(0.65);
}
body .card[data-ringing="true"] .art > img:first-child {
  animation: sounding 0.5s ease-in-out infinite alternate;
  transform-origin: 50% 20%;
}
@keyframes sounding {
  from {
    rotate: -2deg;
  }
  to {
    rotate: 2deg;
  }
}
body .card-frame[hidden] {
  display: none;
}
.card-frame .card {
  z-index: 1;
}
/* Layers in a holder's stack. The carried thing shows its face (the card
   back while it is covered); the ways on, the folded quest and the quest's
   steps to come lie face down, showing the carved card back (--card-back). */
:is(.held-preview, .place-edge, .quest-edge, .quest-fold) {
  position: absolute;
  inset: 0;
  border: 1px solid #a48d6380;
  border-radius: 13px;
  background:
    var(--card-back) center / cover no-repeat,
    #2a2118;
  box-shadow: 0 4px 12px #0007;
  pointer-events: none;
}
.held-preview {
  width: 100%;
  height: 100%;
  object-fit: contain;
  padding: 8px;
  background: #25252c;
  transform: translate(7px, -4px) rotate(3deg);
}
.card-frame[data-expanded="true"] .held-preview {
  display: none;
}
.card-frame[data-holder] .card {
  border-color: #a48d6370;
}
.hand > .card-frame[data-holder="listener"]:has(> [data-face="offered"]) {
  margin-left: calc(var(--fan-overlap) * -1.4);
}
.want-card[data-face="offered"] > .quest-head > .quest-verb {
  white-space: normal;
}
/* The places you can go from here: face-down cards behind the current
   place. Opening the place fans them out like the hand. */
.place-edge {
  translate: calc(var(--i) * 6px) calc(var(--i) * -4px);
  rotate: calc(var(--i) * 1.5deg);
}
.card-frame[data-expanded="true"] .place-edge {
  display: none;
}
/* The quest card shows the player doing the verb with the target, standing
   in the place's painting feathered into the card, or on its dark ground.
   It holds steady while the target is near: a soft halo, unlike the brief
   met glow. */
body .card.want-card {
  /* The scene sits centred in the top 75% the hand shows. */
  --screen-top: 17.5%;
  background:
    radial-gradient(
      ellipse 90% 55% at 50% 0%,
      color-mix(in srgb, var(--tier-color) 20%, transparent),
      transparent 70%
    ),
    linear-gradient(#171a23, #0f1218);
}
body .card.want-card[data-near="true"] {
  box-shadow:
    0 0 0 1px color-mix(in srgb, var(--tier-color) 70%, transparent),
    0 0 18px 3px color-mix(in srgb, var(--tier-color) 45%, transparent),
    0 6px 20px #0006;
}
/* The quest's verb on one line, and a level quest's numeral on the right. */
.quest-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 6px;
}
.want-card > .quest-head > .quest-verb {
  white-space: nowrap;
}
/* A face-down quest keeps its tier until it turns. */
body .card.want-card[data-unrevealed="true"] {
  --tier-color: #c8dce6 !important;
}
.quest-level {
  font:
    calc(var(--card-height) * 0.064) / 1 Georgia,
    serif;
  letter-spacing: 0.08em;
  text-shadow: 0 0 6px var(--tier-color);
}
.quest-screen {
  position: absolute;
  z-index: 2;
  top: var(--screen-top);
  left: 2%;
  width: 96%;
  aspect-ratio: 4 / 3;
  pointer-events: none;
}
/* The quest folds behind the player's avatar as a face-down card leaning
   out to the top left, opposite the carried thing, with a glowing line in
   its tier colour along its edge. The line pulses while a first quest is new
   or a met quest waits to be cleared. */
.card-frame > .quest-fold {
  z-index: 0;
  min-height: 0;
  padding: 0;
  border: 2px solid var(--tier-color);
  box-shadow:
    0 0 6px 1px color-mix(in srgb, var(--tier-color) 70%, transparent),
    0 4px 12px #0007;
  transform: translate(-7px, -5px) rotate(-3deg);
  pointer-events: auto;
  cursor: pointer;
}
.card-frame > .quest-fold[data-glow="near"] {
  box-shadow:
    0 0 14px 3px var(--tier-color),
    0 4px 12px #0007;
}
.card-frame > .quest-fold[data-glow="invite"] {
  box-shadow: 0 0 14px 3px var(--tier-color);
  animation: quest-invite 2.4s ease-in-out infinite alternate;
}
@keyframes quest-invite {
  to {
    box-shadow: 0 0 4px 0 var(--tier-color);
  }
}
@media (prefers-reduced-motion: reduce) {
  .card-frame > .quest-fold[data-glow="invite"] {
    animation: none;
  }
}
.quest-screen img {
  position: absolute;
  max-width: none;
}
.quest-ground {
  inset: -6% -9%;
  width: 118%;
  height: 112%;
  object-fit: cover;
  -webkit-mask-image: radial-gradient(ellipse 50% 50%, #000 55%, transparent);
  mask-image: radial-gradient(ellipse 50% 50%, #000 55%, transparent);
}
.quest-screen[data-back="true"] .quest-back {
  left: 50%;
  height: 100%;
  translate: -50% 0;
  border-radius: 6px;
}
.quest-figure,
.quest-thing,
.quest-back.quest-right {
  bottom: 3%;
  height: 92%;
  width: auto;
  translate: -50% 0;
  filter: drop-shadow(0 3px 4px #000a);
}
.quest-figure[data-flip="true"] {
  scale: -1 1;
}
.quest-left {
  left: 30%;
}
.quest-right {
  left: 70%;
}
.quest-alone {
  left: 50%;
  height: 58%;
}
.quest-thing {
  left: 64%;
  bottom: 30%;
  height: 34%;
}
/* A gift's step shows the giver, the thing and its recipient. */
.quest-screen[data-parts="3"] :is(.quest-left, .quest-right) {
  height: 80%;
}
.quest-screen[data-parts="3"] .quest-left {
  left: 20%;
}
.quest-screen[data-parts="3"] .quest-thing {
  left: 50%;
  height: 28%;
}
.quest-screen[data-parts="3"] .quest-to {
  left: 80%;
}
.quest-screen[data-parts="3"] .quest-back:not(.quest-to) {
  left: 50%;
}
.quest-back.quest-right {
  bottom: 12%;
  height: 64%;
  border-radius: 4px;
}
/* The action beat's status line: words only, never over the stage (#1725). */
.play-status {
  margin: 0;
  color: #f2e3c4;
  font-size: 13px;
  text-align: left;
  text-shadow: 0 1px 3px #000;
  overflow-wrap: anywhere;
}
#card-actions {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 3px 1px;
  scrollbar-width: thin;
}
#card-actions:empty {
  padding: 0;
}
#card-actions button {
  flex: 0 0 auto;
  max-width: min(260px, 85vw);
  min-height: 44px;
  padding: 8px 16px;
  background: #171920ee;
  border: 1px solid #baa37c;
  border-radius: 24px;
  color: #f2e3c4;
  font:
    15px/1.25 Georgia,
    serif;
  white-space: normal;
}
#card-actions button:hover {
  background: #3c3325;
}
/* Dropping a quest is destructive: the usual button with red words. */
body #card-actions button[data-destructive] {
  color: var(--danger);
}
body .card.drag-over {
  outline: 2px solid var(--gold);
}
.stage.ready::after {
  content: attr(data-play);
  position: absolute;
  inset: 60px 15% var(--dock-height);
  border: 1px solid #dfc38d55;
  border-radius: 20px;
  display: grid;
  place-items: center;
  background: #13161a44;
  color: var(--gold);
  font:
    24px Georgia,
    serif;
  pointer-events: none;
  z-index: 8;
}
body .dialogue {
  bottom: calc(var(--dock-height) + 2px);
  max-width: 860px;
  width: calc(100% - 28px);
  background: #10151ddd;
  border-color: #b09a6a55;
}
body .cast {
  --cast-bottom: calc(var(--dock-height) - 70px);
  bottom: var(--cast-bottom);
  top: 64px;
  height: auto;
  width: min(92%, 1100px);
  inset-inline: 0;
  margin-inline: auto;
}
body .cast[data-count] {
  bottom: var(--cast-bottom);
  height: auto;
}
.controls-help {
  margin-bottom: 20px;
}
.controls-help summary {
  min-height: 44px;
  display: flex;
  align-items: center;
  cursor: pointer;
}
@media (max-width: 700px) {
  :root {
    --card-width: 154px;
    --card-height: clamp(196px, 28dvh, 246px);
  }
  .topbar {
    min-height: 50px;
    padding: 4px 10px;
  }
  .top-actions button {
    padding: 5px 10px;
    font-size: 12px;
  }
  .play-dock {
    padding-inline: 16px;
  }
  .hand {
    --fan-overlap: calc(var(--card-height) * 0.2);
  }
  body .cast {
    top: 54px;
    width: 98%;
  }
  body .cast .portrait[data-framing="wide"] {
    height: min(calc(var(--stage-size) * 0.74), 93vw);
    left: clamp(34%, var(--stage-x), 66%);
    z-index: 4;
  }
  /* A solo human's 2:3 frame fits the phone, including outstretched hands. */
  body
    .cast[data-count="1"]
    .portrait:is(
      [data-avatar="vale"],
      [data-avatar="mara"],
      [data-avatar="ash"],
      [data-avatar="nell"],
      [data-avatar="tavi"],
      [data-avatar="rue"],
      [data-avatar="orin"],
      [data-avatar="ada"]
    ) {
    max-height: 144vw;
  }
  /* Short phones keep 380px of the busts in view, but never lift them above
     the back row, whose heads sit 14% down the stage. */
  body .cast[data-shared="true"]:not([data-count="1"]):not([data-count="2"]) {
    --bust-drop: clamp(
      0%,
      min(calc((var(--cast-count) - 2) * 12%), max(calc(100% - 380px), 16%)),
      42%
    );
  }
  body
    .cast[data-shared="true"]:not([data-count="1"]):not([data-count="2"])
    .portrait[data-depth="foreground"] {
    bottom: calc(100% - var(--stage-size) - var(--bust-drop));
  }
  body .cast[data-shared="true"] .portrait[data-depth="back"] {
    left: calc(10% + var(--stage-x) * 0.8);
    bottom: calc(86% - var(--stage-size));
  }
  /* A wide figure is drawn shorter, so lift its feet to keep its head on
     the back row instead of below the foreground busts. */
  body
    .cast[data-shared="true"]
    .portrait[data-depth="back"][data-framing="wide"] {
    bottom: calc(86% - min(calc(var(--stage-size) * 0.74), 93vw));
  }
  body .dialogue {
    bottom: calc(var(--dock-height) + 2px);
    padding: 8px 12px;
  }
}
@media (max-height: 640px) {
  :root {
    --card-height: 176px;
    --card-width: 128px;
    --dock-height: 144px;
  }
}
@media (max-height: 440px) {
  :root {
    --card-height: 140px;
    --card-width: 112px;
  }
}

.speech-row {
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr);
  grid-template-areas:
    "portrait heading"
    "line line"
    "hint hint";
  column-gap: 8px;
  align-items: start;
}
.speaker-portrait {
  grid-area: portrait;
  align-self: center;
  position: relative;
  height: 34px;
  overflow: hidden;
  border-radius: 8px;
  border: 1px solid #b09a6a66;
  background: #252832;
}
.speaker-portrait > img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.speaker-portrait[data-kind="avatar"] img {
  --shown: calc(var(--figure-height, 1) * var(--portrait-crop, 0.3));
  position: absolute;
  width: auto;
  max-width: none;
  height: calc(100% / var(--shown));
  top: calc(6% - 100% * var(--figure-top, 0) / var(--shown));
  left: 50%;
  translate: calc(-100% * var(--head-x, 0.5)) 0;
}
.speech-content {
  display: contents;
}
body .dialogue-heading {
  grid-area: heading;
  align-self: center;
  min-width: 0;
  gap: 4px;
  min-height: 28px;
}
body #speaker {
  font-size: 16px;
}
body .speech-line {
  grid-area: line;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  min-width: 0;
  min-height: 24px;
}
.speech-row .speech-hint {
  grid-area: hint;
}
body #dialogue-text {
  font:
    16px/1.4 Georgia,
    serif;
  height: auto;
  max-height: var(--speech-room, none);
  overflow: hidden auto;
  overscroll-behavior: contain;
  overflow-wrap: anywhere;
  margin: 2px 0 0;
  padding-right: 0;
  scrollbar-gutter: auto;
  scrollbar-width: none;
}
body .line-controls {
  gap: 0;
}
body .line-controls button {
  min-height: 28px;
  min-width: 32px;
  padding: 0 6px;
}
.play-dock[data-selected="true"] .hand,
body[data-hand-expanded="true"] .hand {
  height: calc(var(--card-height) + var(--hand-top) + 4px);
}
/* A resting hand, or one tucked down for a fight, shows only its cards' art:
   the names and their shade fade in as the hand rises, a card is chosen, or
   one is pointed at or focused. The buttons keep their aria-label names. */
.hand .card .name {
  transition: opacity 120ms ease-out;
}
body[data-hand-expanded="false"]
  .play-dock:not([data-selected="true"])
  .hand
  .card:not(:focus-visible)
  .name,
.stage[data-combat="true"] ~ .play-dock .hand .card .name {
  opacity: 0;
}
@media (hover: hover) and (pointer: fine) {
  body[data-hand-expanded="false"]
    .stage:not([data-combat="true"])
    ~ .play-dock:not([data-selected="true"])
    .hand
    .card:hover
    .name {
    opacity: 1;
  }
}
@media (prefers-reduced-motion: reduce) {
  .hand .card .name {
    transition: none;
  }
}
/* A resting hand shares the bottom edge with the dialogue on wide screens. */
@media (min-width: 1100px) and (min-aspect-ratio: 3/2) {
  :root {
    /* As wide as the fanned cards (fitRestingHand, app.mjs), else two
       upright cards, as the 2:3 frames are, inside the hand's padding. */
    --resting-hand-width: var(
      --resting-hand-fit,
      calc(var(--card-height) * 4 / 3 + 14px + var(--hand-inline) * 2)
    );
  }
  body[data-hand-expanded="false"]
    .play-dock:not([data-selected="true"])
    .hand {
    --fan-overlap: var(--resting-fan-overlap, calc(var(--card-height) * 0.14));
  }
  body[data-hand-expanded="false"] .play-dock {
    background: radial-gradient(
      ellipse at bottom right,
      #090d12f5,
      #090d12bd 45%,
      #090d1200 75%
    );
    left: auto;
    width: calc(var(--resting-hand-width) + 44px);
  }
  body[data-hand-expanded="false"] .dialogue[data-dropped="true"] {
    translate: 0 calc(100% - 38px);
    opacity: 0.85;
  }
  body[data-hand-expanded="false"] .dialogue {
    left: 22px;
    bottom: max(22px, env(safe-area-inset-bottom));
    transform: none;
    width: calc(100% - var(--resting-hand-width) - 110px);
    max-width: 900px;
  }
  /* Raising the hand slides the dialogue from beside the deck to the middle
     in the same 280 ms as the cards grow into their row (app.mjs), and back
     on lowering. Reduced motion crossfades instead. */
  :root body[data-hand-expanded] .dialogue {
    transition:
      left 280ms ease-out,
      transform 280ms ease-out,
      width 280ms ease-out,
      max-width 280ms ease-out,
      bottom 280ms ease-out,
      translate 280ms ease-in-out,
      opacity 280ms ease-in-out;
  }
  @media (prefers-reduced-motion: reduce) {
    :root body[data-hand-expanded] .dialogue {
      transition: opacity 280ms ease-in-out;
    }
  }
}
@media (max-width: 700px) {
  body #dialogue-text {
    font-size: 15px;
  }
}

/* An item with its own view, such as the map, opens over the table.
   Tap the image to zoom; tap outside it or press Escape to close. */
.item-view-tools {
  position: fixed;
  top: 12px;
  right: 16px;
  display: flex;
  gap: 8px;
  z-index: 1;
}
.item-view[open] {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100dvh;
  max-width: none;
  max-height: none;
  margin: 0;
  padding: 56px 16px 16px;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  display: grid;
  place-items: center;
  overflow: auto;
}
.item-view img {
  display: block;
  max-width: 100%;
  max-height: calc(100dvh - 72px);
  border-radius: 4px;
  box-shadow: 0 20px 90px #000a;
  cursor: zoom-in;
}
.item-view[data-zoomed="true"] {
  place-items: start;
}
.item-view[data-zoomed="true"] img {
  max-width: none;
  max-height: none;
  width: max(200%, 1600px);
  cursor: zoom-out;
}

body .card.new {
  border-color: #f2dba6;
  box-shadow:
    inset 0 0 0 1px #e7ca86aa,
    0 0 14px #e7ca8655;
}

/* A dim place (one with lamp data) darkens its cards; stage-light.json lights
   its lamp's pool. */
body[data-dim="true"] .card {
  background-color: #0d131c;
  border-color: #847961;
}
/* Phones stand a lone figure in the middle, whatever the place's mark. */
@media (max-width: 700px) {
  .cast[data-count="1"] .portrait {
    left: 50%;
  }
}
@media (max-width: 380px) {
  .topbar {
    padding-inline: 6px;
  }
  .topbar .top-actions {
    gap: 4px;
  }
  .topbar .top-actions button {
    padding-inline: 6px;
    font-size: 11px;
  }
}
/* Short wide screens keep the hand and the scene within one view. */
@media (max-height: 640px) and (min-width: 701px) {
  :root {
    --card-height: clamp(126px, 37dvh, 176px);
    --card-width: clamp(100px, 28dvh, 128px);
    --dock-height: calc(var(--card-height) + 82px);
  }
  body {
    min-height: 0;
    height: 100dvh;
    overflow: hidden;
  }
  main,
  body .stage {
    min-height: 0;
  }
  .topbar {
    min-height: 44px;
    padding-block: 2px;
  }
  body .cast {
    top: 46px;
  }
  body .dialogue {
    bottom: calc(var(--dock-height) + 4px);
    padding: 4px 10px;
  }
}

/* Dialogue beats are cards in depth, not a scrolling log: the current beat in
   front, one earlier beat peeking behind it. See
   v2/docs/card-table/dialogue-beats.md. */
body .dialogue.beat-stack {
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
  backdrop-filter: none;
  overflow: visible;
}
.beat-stack .beat-front {
  position: relative;
  z-index: 2;
  padding: 10px 16px 10px 12px;
  border: 1px solid #b09a6a55;
  border-radius: 8px;
  background: #10151ded;
  box-shadow:
    0 -6px 16px #05060c80,
    0 10px 35px #08091470;
  backdrop-filter: blur(12px);
  transform-origin: 50% 0;
}
/* The earlier beat is a whole card behind the front one: the same size,
   scaled down and raised so only its top edge, one line, peeks out. Its
   resting transform is the slot the stack animates to and from. */
.beat-stack {
  --beat-peek: 30px;
  --beat-behind-scale: 0.94;
}
.beat-behind {
  position: absolute;
  z-index: 1;
  inset: 0;
  display: flex;
  align-items: flex-start;
  gap: 8px;
  min-height: 0;
  padding: 4px 14px 0 10px;
  border: 1px solid #b09a6a44;
  border-radius: 8px;
  background: #0b0f16;
  color: #cfc3ab;
  opacity: 0.72;
  transform: translateY(calc(-1 * var(--beat-peek)))
    scale(var(--beat-behind-scale));
  transform-origin: 50% 0;
  text-align: left;
  font:
    14px/1.3 Georgia,
    serif;
  cursor: pointer;
  overflow: hidden;
}
.beat-behind:hover,
.beat-behind:focus-visible {
  opacity: 1;
  background: #121722;
}
.beat-ghost {
  pointer-events: none;
}
.beat-behind-portrait {
  position: relative;
  flex: none;
  width: 24px;
  height: 24px;
  overflow: hidden;
  border-radius: 50%;
  border: 1px solid #a899765e;
  background: #252832;
}
.beat-behind-portrait img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.beat-behind-portrait[data-kind="avatar"] img {
  --shown: calc(var(--figure-height, 1) * var(--portrait-crop, 0.3) * 0.6);
  position: absolute;
  width: auto;
  max-width: none;
  height: calc(100% / var(--shown));
  top: calc(6% - 100% * var(--figure-top, 0) / var(--shown));
  left: 50%;
  translate: calc(-100% * var(--head-x, 0.5)) 0;
}
.beat-behind-text {
  flex: 1;
  min-width: 0;
  line-height: 24px;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.beat-behind-text strong {
  margin-right: 6px;
  color: var(--gold);
  font-weight: 600;
}
.beat-behind-speech::before {
  content: "“";
}
.beat-behind-speech::after {
  content: "”";
}
.beat-behind-caption {
  margin-left: 6px;
  font-style: italic;
  color: #b9c6cf;
}
.dialogue:has(#live-line:not([hidden])) .beat-behind {
  padding-right: 92px;
}
body .beat-live {
  position: absolute;
  z-index: 3;
  right: 12px;
  bottom: calc(100% - 2px);
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-width: 0;
  min-height: 28px;
  padding: 0 11px;
  border: 1px solid #dfc38d;
  border-radius: 999px;
  background: #1b1f2a;
  color: #f2e4c4;
  font-size: 13px;
  box-shadow: 0 0 0 2px #dfc38d26;
}
.beat-live-dot {
  color: #e7a27c;
  font-size: 10px;
}
.beat-captions {
  display: block;
  margin-top: 2px;
}
.beat-caption {
  display: block;
  color: #b9c6cf;
  font:
    italic 13px/1.4 Georgia,
    serif;
}
.beat-icon {
  display: inline-block;
  width: 1.3em;
  font-style: normal;
}
.beat-icon svg {
  width: 1.1em;
  height: 1.1em;
  vertical-align: -0.2em;
}
.beat-caption:is(
    [data-kind="move"],
    [data-kind="course"],
    [data-kind="accompany"]
  ) {
  color: #9fc4dc;
}
.beat-caption:is(
    [data-kind="threaten"],
    [data-kind="guard"],
    [data-kind="attack"],
    [data-kind="standoff"],
    [data-kind="retreat"],
    [data-kind="sent-home"]
  ) {
  color: #e8a985;
}
.beat-caption:is([data-kind="give"], [data-kind="trade"], [data-kind="ask"]) {
  color: #c9b6ea;
}
.beat-caption:is(
    [data-kind="want_met"],
    [data-kind="choose"],
    [data-kind="use"],
    [data-kind="light"]
  ) {
  color: #e6cf86;
}
.beat-caption[data-kind="refuel"] {
  color: #a3d4a9;
}
.beat-stack .speech-line {
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
/* An action with no speech is one line, as a play folds into the stream:
   the figure, then the caption, which names who acted. */
#speech-row[data-beat="action"] {
  grid-template-areas: "portrait line heading";
  grid-template-columns: auto minmax(0, 1fr) auto;
  grid-template-rows: auto;
  align-content: center;
  align-items: center;
}
#speech-row[data-beat="action"] .speaker-portrait {
  width: 28px;
  height: 28px;
  border-radius: 50%;
}
#speech-row[data-beat="action"] .speaker-portrait[data-kind="action"] {
  width: 96px;
  height: 64px;
  border: 0;
  border-radius: 0;
  background: transparent;
}
#speech-row .speaker-portrait[data-kind="action"] .quest-screen {
  inset: 0;
  width: 100%;
  height: 100%;
}
#speech-row .speaker-portrait[data-kind="action"] .quest-figure {
  width: auto;
  height: 75%;
}
#speech-row[data-beat="action"] #speaker {
  display: none;
}
.beat-stack:not([data-action="true"])
  > #speech-row[data-beat="action"]
  .beat-caption[data-primary]
  .beat-icon {
  display: none;
}
#speech-row[data-beat="action"] .dialogue-heading {
  min-height: 0;
}
.beat-stack:not([data-action="true"])
  > #speech-row[data-beat="action"]
  .beat-caption[data-primary] {
  display: block;
  font: var(--action-font);
  color: #f2e3c4;
  white-space: normal;
  overflow-wrap: anywhere;
}
.beat-stack:not([data-action="true"])
  > #speech-row[data-beat="action"]
  .beat-caption[data-primary][data-named]
  .card-name:first-child {
  font-weight: 700;
  color: inherit;
}
.beat-stack .beat-front[data-beat="silent"] #dialogue-text {
  color: var(--muted);
}
.beat-stack .line-controls:not(:has(button:not([hidden]))) {
  display: none;
}
/* Memory: the avatar's inner life now, then the same beats, opened on
   purpose, newest visit first. */
.memory-dialog .messages {
  margin-bottom: 0;
  padding-right: 18px;
}
.memory-close {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 32px;
  height: 32px;
  min-height: 32px;
  padding: 0;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font-size: 20px;
  line-height: 1;
  opacity: 0.6;
  cursor: pointer;
}
.memory-close:hover,
.memory-close:focus-visible {
  opacity: 1;
  color: var(--ink);
  background: transparent;
}
.memory-close:focus-visible {
  outline: 1px solid var(--gold);
  outline-offset: 1px;
}
.inner-life {
  margin-bottom: 18px;
  padding-bottom: 14px;
  border-bottom: 1px solid #ffffff15;
}
.inner-life h4 {
  margin: 12px 0 4px;
  font-size: 13px;
}
.inner-life p {
  margin: 4px 0;
  font-size: 13px;
  line-height: 1.5;
  overflow-wrap: anywhere;
}
.memory-visit + .memory-visit {
  margin-top: 18px;
}
.memory-place {
  margin: 0 0 6px;
  color: var(--muted);
  font:
    600 12px/1.4 system-ui,
    sans-serif;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.memory-beats {
  margin: 0;
  padding: 0;
  list-style: none;
}
.memory-beat {
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr);
  gap: 10px;
  align-items: start;
}
.memory-portrait {
  position: relative;
  width: 30px;
  height: 30px;
  overflow: hidden;
  border-radius: 50%;
  border: 1px solid #a899765e;
  background: #252832;
}
.memory-portrait img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.memory-portrait[data-kind="avatar"] img {
  --shown: calc(var(--figure-height, 1) * var(--portrait-crop, 0.3) * 0.6);
  position: absolute;
  width: auto;
  max-width: none;
  height: calc(100% / var(--shown));
  top: calc(6% - 100% * var(--figure-top, 0) / var(--shown));
  left: 50%;
  translate: calc(-100% * var(--head-x, 0.5)) 0;
}
.memory-beat .beat-caption {
  margin: 2px 0;
  font-size: 12px;
}
/* Phones keep the stack short: one line of the card behind peeks out, the
   name sits on top of the whole line, and the first action sits under the
   speech on one line. */
@media (max-width: 700px) {
  .beat-stack .beat-front {
    grid-template-columns: 26px minmax(0, 1fr);
    column-gap: 7px;
    padding: 6px 10px 6px 8px;
  }
  .beat-stack .speaker-portrait {
    height: 28px;
  }
  .beat-stack {
    --beat-peek: 20px;
  }
  .beat-behind {
    gap: 6px;
    padding: 2px 10px 0 7px;
    font-size: 12px;
  }
  .beat-behind-text {
    line-height: 17px;
  }
  .beat-behind-portrait {
    width: 17px;
    height: 17px;
  }
  body .beat-stack .dialogue-heading {
    min-height: 22px;
  }
  body .beat-stack #speaker {
    font-size: 15px;
  }
  body .beat-stack #dialogue-text {
    margin: 1px 0 0;
    font-size: 14px;
    line-height: 1.35;
  }
  .beat-stack .beat-captions {
    margin: 0;
  }
  .beat-stack .beat-caption {
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
    font-size: 12px;
    line-height: 1.3;
  }
  .beat-stack .beat-caption:not(:last-child) {
    display: none;
  }
  .dialogue:has(#live-line:not([hidden])) .beat-behind {
    padding-right: 80px;
  }
  body .beat-live {
    min-height: 24px;
    padding: 0 9px;
    font-size: 12px;
  }
}
/* Stack motion: data-motion names the step, set by animateStack(). */
.beat-stack {
  --beat-slot: translateY(calc(-1 * var(--beat-peek)))
    scale(var(--beat-behind-scale));
  --beat-deeper: translateY(calc(-2 * var(--beat-peek)))
    scale(calc(var(--beat-behind-scale) * var(--beat-behind-scale)));
}
.beat-card[data-motion] {
  animation: 300ms cubic-bezier(0.22, 0.61, 0.36, 1) backwards;
}
.beat-card[data-motion="fade"] {
  animation-name: beat-fade;
}
.beat-front[data-motion="arrive"] {
  animation-name: beat-arrive;
}
.beat-front[data-motion="return"] {
  animation-name: beat-return;
}
.beat-behind[data-motion="recede"] {
  animation-name: beat-recede;
}
.beat-behind[data-motion="emerge"] {
  animation-name: beat-emerge;
}
@keyframes beat-fade {
  from {
    opacity: 0;
  }
}
/* A new beat eases in from just in front; the old one settles behind. */
@keyframes beat-arrive {
  from {
    transform: translateY(8px) scale(1.015);
    opacity: 0;
  }
}
@keyframes beat-return {
  from {
    transform: var(--beat-slot);
    opacity: 0;
  }
}
@keyframes beat-recede {
  from {
    transform: translateY(calc(-0.5 * var(--beat-peek)))
      scale(calc((1 + var(--beat-behind-scale)) / 2));
    opacity: 0;
  }
}
@keyframes beat-emerge {
  from {
    transform: var(--beat-deeper);
    opacity: 0;
  }
}
@media (prefers-reduced-motion: reduce) {
  .beat-behind {
    transition: none;
  }
}

/* A ready or pending play is a beat in front of the dialogue: the actor's
   portrait, what the play will do and its buttons, with the status line
   (#1725). The spoken beat settles into the slot behind it, so nothing sits
   between the dialogue and the hand, and the hand never moves for it. A
   strike or journey that drops the dialogue hides it. */
.beat-stack > .action-panel {
  --beat-divider: #b09a6a55;
  position: relative;
  z-index: 3;
  display: grid;
  gap: 6px;
  padding: 0;
  overflow: hidden;
  border: 1px solid var(--beat-divider);
  border-radius: 8px;
  background: #10151ded;
  box-shadow:
    0 -6px 16px #05060c80,
    0 10px 35px #08091470;
  backdrop-filter: blur(12px);
  transform-origin: 50% 0;
}
/* The rarest card in the play edges the box in its tier colour. */
.beat-stack > .action-panel:not([data-tier="common"]) {
  border-color: var(--tier-color);
  box-shadow:
    0 0 14px color-mix(in srgb, var(--tier-color) 30%, transparent),
    0 10px 35px #08091470;
}
.beat-stack[data-dropped="true"] > .action-panel {
  display: none;
}
/* The spoken beat in the slot behind reads as the card behind does: one
   dimmed line of portrait, name, speech and first action. A tap on its line
   still moves the lines on. */
.beat-stack[data-action="true"]:not([data-dropped="true"]) > #speech-row {
  position: absolute;
  z-index: 1;
  inset: 0;
  display: flex;
  align-items: flex-start;
  gap: 8px;
  height: auto;
  margin: 0;
  padding: 4px 14px 0 10px;
  overflow: hidden;
  background: #0b0f16;
  color: #cfc3ab;
  font:
    14px/24px Georgia,
    serif;
  opacity: 0.72;
  transform: var(--beat-slot);
}
.beat-stack[data-action="true"]:not([data-dropped="true"]) > #beat-behind,
.beat-stack[data-action="true"]
  > #speech-row
  :is(.speech-hint, .line-controls, .beat-caption:not(:last-child)) {
  display: none;
}
/* A card shows its latest three effects; Memory keeps them all. */
.beat-stack .beat-caption:nth-last-child(n + 4) {
  display: none;
}
.beat-stack[data-action="true"] > #speech-row * {
  flex: none;
  min-height: 0;
  max-height: none;
  margin: 0;
  font: inherit;
}
.beat-stack[data-action="true"] > #speech-row .speaker-portrait {
  width: 24px;
  height: 24px;
  border-radius: 50%;
}
.beat-stack[data-action="true"] > #speech-row .speech-line {
  display: block;
  flex: 1;
  align-self: auto;
  min-width: 0;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  text-align: left;
}
.beat-stack[data-action="true"]
  > #speech-row
  :is(#speaker, #dialogue-text, .beat-captions, .beat-caption) {
  display: inline;
  margin-right: 6px;
}
.beat-stack[data-action="true"] > #speech-row #speaker {
  font-weight: 600;
}
.beat-stack[data-action="true"] > #speech-row .beat-caption {
  font-style: italic;
}
.beat-action[data-motion="arrive"] {
  animation-name: beat-arrive;
}
#speech-row[data-motion="settle"] {
  animation-name: beat-settle;
}
@keyframes beat-settle {
  from {
    transform: none;
    opacity: 1;
  }
}
.action-beat-heading {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  margin: 0;
  color: #f2e3c4;
  font:
    15px/1.3 Georgia,
    serif;
}
/* One row: who acts and what it acts on, small cards side by side as a
   quest pairs them; then what the play does; then its buttons, flush
   segments on the right of the box itself, each a full-height verb split
   off by a thin divider. Too narrow for that, the buttons wrap into a strip
   along the foot, under the same divider. */
.beat-stack > .action-panel:not([hidden]) {
  display: flex;
  flex-wrap: wrap;
  align-items: stretch;
  column-gap: 0;
}
.action-beat-cards {
  display: flex;
  flex: none;
  align-items: flex-end;
  align-self: stretch;
  padding: 6px 0 2px 10px;
}
.action-beat-cards:empty {
  display: none;
}
.action-beat-cards > .quest-screen {
  position: relative;
  inset: auto;
  align-self: center;
  width: 96px;
  height: 64px;
}
.action-beat-cards > .quest-screen img {
  margin-left: 0;
}
.action-beat-cards > .quest-screen .quest-ground {
  width: 118%;
  height: 112%;
}
.action-beat-cards > .quest-screen .quest-alone {
  height: 75%;
}
.action-beat-body {
  display: grid;
  flex: 1000 1 120px;
  grid-template-columns: minmax(0, 1fr);
  /* Centred while it fits; longer words run down into the scrolling box
     instead of past its top. */
  margin-block: auto;
  align-content: start;
  gap: 4px;
  min-width: 0;
  padding: 8px 12px 8px 10px;
}
.action-beat-cards:empty + .action-beat-body {
  padding-left: 12px;
}
/* A play's figures read as the quest card's pair: no tile, a drop shadow,
   standing a little over each other. */
.action-beat-cards img {
  display: block;
  max-width: none;
  height: 68px;
  width: auto;
  filter: drop-shadow(0 3px 4px #000a);
}
.action-beat-cards img + img {
  margin-left: -10px;
}
.action-beat-cards [data-flip="true"] {
  scale: -1 1;
}
.action-beat-cards .beat-thing {
  align-self: center;
  height: 40px;
}
.action-beat-cards .beat-place {
  align-self: center;
  height: 50px;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  -webkit-mask-image: radial-gradient(ellipse 50% 50%, #000 55%, transparent);
  mask-image: radial-gradient(ellipse 50% 50%, #000 55%, transparent);
}
/* A borrowed beat's small card (a setting's art), grey while off. */
.beat-face {
  position: relative;
  display: block;
}
.action-beat-cards .beat-face {
  align-self: center;
}
.beat-face img {
  width: 44px;
  height: auto;
  aspect-ratio: 2 / 3;
  object-fit: cover;
  object-position: 50% 12%;
  border: 1px solid var(--tier-color, #a48d63b3);
  border-radius: 4px;
  background: #181b22;
  filter: none;
}
.beat-face[data-lit="false"] img {
  filter: saturate(0.35) brightness(0.6);
}
.beat-face .card-level {
  top: 4px;
  font-size: 10px;
  visibility: visible;
  opacity: 0.8;
}
/* A chosen avatar is a small quest screen: it stands untiled with a drop
   shadow in its place's feathered painting, under its tier's glow and
   level numeral. */
.action-beat-cards .beat-face.quest-screen {
  position: relative;
  top: auto;
  left: auto;
  width: auto;
  height: 60px;
  background: radial-gradient(
    ellipse 90% 55% at 50% 0%,
    color-mix(in srgb, var(--tier-color, #a48d63) 20%, transparent),
    transparent 70%
  );
}
.beat-face.quest-screen img {
  aspect-ratio: auto;
  border: 0;
  border-radius: 0;
  background: none;
}
.beat-face.quest-screen .quest-ground {
  width: 118%;
  height: 112%;
}
.action-beat-cards .beat-face.quest-screen .quest-figure {
  left: 50%;
  width: auto;
  height: 92%;
  filter: drop-shadow(0 3px 4px #000a);
}
.beat-face.quest-screen[data-lit="false"] .quest-figure {
  filter: drop-shadow(0 3px 4px #000a) saturate(0.35) brightness(0.6);
}
.beat-face .quest-level {
  position: absolute;
  z-index: 3;
  top: 2px;
  right: 4px;
  color: var(--tier-color, #a48d63);
  font:
    12px/1 Georgia,
    serif;
}
/* A chosen avatar's beat has no border, and its two lines, name and
   place, wrap rather than end in an ellipsis. */
.beat-stack > .action-panel[data-avatar] {
  border: 0;
}
.action-panel[data-avatar] .action-beat-text {
  display: block;
  overflow: visible;
  -webkit-line-clamp: none;
  line-clamp: none;
}
.action-beat-info {
  display: block;
  color: #cfc3ab;
}
.action-beat-heading {
  order: -2;
}
.action-beat-note {
  order: -1;
  color: var(--muted);
  font-size: 13px;
}
/* Source editing scrolls inside the existing descriptor beside its action. */
#action-beat .action-beat-note[contenteditable="plaintext-only"] {
  min-height: 1.4em;
  max-height: min(12rem, 24dvh);
  overflow-y: auto;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
  font-size: 16px;
  line-height: 1.4;
}
@media (max-height: 400px) {
  #action-beat .action-beat-note[contenteditable="plaintext-only"] {
    max-height: 3rem;
  }
}
.beat-action #card-actions {
  /* A strip wider than a very narrow box (200% text) wraps its words. */
  flex: 1 1 auto;
  gap: 0;
  padding: 0;
  overflow: visible;
  /* The divider on its left, or above it once it wraps; the box clips the
     other one. */
  box-shadow:
    -1px 0 0 var(--beat-divider),
    0 -1px 0 var(--beat-divider);
}
.beat-action #card-actions:empty {
  display: none;
}
.beat-action #card-actions button {
  flex: 1 1 auto;
  max-width: none;
  min-height: 44px;
  margin: 0;
  padding: 4px 14px;
  border: 0;
  border-radius: 0;
  background: transparent;
  -webkit-tap-highlight-color: transparent;
  color: #f2e3c4;
  font:
    15px/1.25 Georgia,
    serif;
}
.beat-action #card-actions button + button {
  box-shadow: inset 1px 0 0 var(--beat-divider);
}
.beat-action #card-actions button:is(:hover, :focus-visible) {
  background: #dfc38d1f;
}
.beat-action #card-actions button:not([data-blocked]):active {
  background: #dfc38d33;
  color: var(--gold);
}
.beat-action #card-actions button:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: -3px;
}
.beat-action #card-actions button:disabled {
  background: transparent;
  opacity: 0.5;
}
/* A beat with only buttons (a Take refused for space, #2018) leaves no empty
   box beside them. */
.action-beat-body:not(:has(> :not([hidden]))) {
  display: none;
}
.beat-action .action-beat-body:not(:has(> :not([hidden]))) + #card-actions {
  flex: 1 1 100%;
  max-width: none;
  box-shadow: none;
}
.beat-action #card-actions button[data-blocked] {
  background: transparent;
  opacity: 0.85;
  cursor: default;
}
/* What the play does takes two lines before it ends in an ellipsis. */
.action-beat-text {
  display: -webkit-box;
  min-width: 0;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  line-clamp: 2;
}
.action-beat-text strong {
  color: var(--gold);
  font-weight: 600;
}

@media (max-width: 700px) {
  .action-beat-text {
    display: block;
    overflow: visible;
    -webkit-line-clamp: none;
    line-clamp: none;
  }
}

/* The dialogue lies over the hand (option D). It is a sibling of the stage,
   so on phones and tablets it can sit over the dock. There it keeps one fixed
   box at the foot of the screen and never moves: a resting hand shows its
   cards' tops above it, and a raised hand lifts the cards further, with
   their feet still tucked behind it. Each card's name sits just above the
   dialogue. Wide screens keep the dialogue beside the resting hand, and
   short ones above it, since their cards are too short to show above it. */
main > .dialogue {
  z-index: 4;
}
@media (min-height: 641px) {
  body[data-dialogue-over="true"] {
    --dialogue-height: 106px;
    /* The dialogue's box plus the gap under it. */
    --dialogue-cover: calc(
      max(var(--dialogue-height), var(--dialogue-size, 0px)) +
        max(8px, env(safe-area-inset-bottom))
    );
    /* How much of a resting card shows above the dialogue, and how much
       of a raised card stays behind it. */
    --resting-show: 0.4;
    --raised-tuck: 0.2;
    --resting-dock: calc(
      var(--dialogue-cover) + var(--card-height) * var(--resting-show) + 12px
    );
  }
  body[data-dialogue-over="true"] main > .dialogue {
    z-index: 6;
  }
  body[data-dialogue-over="true"] .dialogue {
    top: auto;
    bottom: max(8px, env(safe-area-inset-bottom));
    transition: opacity 280ms ease-in-out;
  }
  body[data-dialogue-over="true"] .dialogue[data-dropped="true"] {
    translate: none;
    opacity: 0.85;
  }
  /* The earlier beat peeks above the front one inside the same box. */
  body[data-dialogue-over="true"] .dialogue.beat-stack {
    --beat-peek: 16px;
  }
  body[data-dialogue-over="true"] .dialogue.beat-stack .beat-behind {
    top: var(--beat-peek);
    gap: 5px;
    padding: 1px 10px 0 7px;
    font-size: 12px;
  }
  body[data-dialogue-over="true"] .beat-behind-text {
    line-height: 15px;
  }
  body[data-dialogue-over="true"] .beat-behind-portrait {
    width: 15px;
    height: 15px;
  }
  body[data-dialogue-over="true"] .dialogue.beat-stack > .beat-front {
    min-height: calc(var(--dialogue-height) - var(--beat-peek));
    margin-top: var(--beat-peek);
    padding-block: 3px 2px;
    grid-template-rows: auto auto auto;
    align-items: start;
  }
  body[data-dialogue-over="true"] .beat-stack .dialogue-heading {
    min-height: 20px;
  }
  body[data-dialogue-over="true"] .beat-stack .speech-line {
    align-self: stretch;
    min-height: 0;
  }
  body[data-dialogue-over="true"] .beat-stack #dialogue-text {
    margin: 0;
    line-height: 1.3;
  }
  body[data-dialogue-over="true"] .beat-stack .speaker-portrait {
    height: 20px;
  }
  body[data-dialogue-over="true"] .beat-stack > .action-panel {
    margin-top: var(--beat-peek);
    align-content: start;
    gap: 3px;
    overflow-y: auto;
    scrollbar-width: none;
  }
  body[data-dialogue-over="true"]
    .beat-stack[data-action="true"]
    > #speech-row {
    top: var(--beat-peek);
    gap: 5px;
    padding: 1px 10px 0 7px;
    font-size: 12px;
    line-height: 15px;
  }
  body[data-dialogue-over="true"]
    .beat-stack[data-action="true"]
    > #speech-row
    .speaker-portrait {
    width: 15px;
    height: 15px;
  }
  /* On a phone the action uses its full width beneath the caption. */
  body[data-dialogue-over="true"] .beat-stack > .action-panel:not([hidden]) {
    flex-wrap: wrap;
  }
  body[data-dialogue-over="true"] .beat-action #card-actions {
    flex: 1 1 100%;
    max-width: none;
  }
  /* Its verbs wrap between words but never clip: a quest's step and
     Discard both fit. */
  body[data-dialogue-over="true"] .beat-action #card-actions button {
    min-width: min-content;
    padding-inline: 10px;
  }
  body[data-dialogue-over="true"] .action-beat-cards {
    padding: 2px 0 0 8px;
  }
  body[data-dialogue-over="true"] .action-beat-body {
    gap: 2px;
    padding: 3px 10px 2px 8px;
  }
  body[data-dialogue-over="true"] .action-beat-cards .beat-figure {
    height: 66px;
  }
  body[data-dialogue-over="true"] .action-beat-cards .beat-face img {
    width: 36px;
  }
  body[data-dialogue-over="true"]
    .action-beat-cards
    .beat-face.quest-screen
    img {
    width: auto;
  }
  /* A chosen play grows up over the hand to show its complete caption. */
  body[data-dialogue-over="true"] .beat-stack > .action-panel {
    min-height: calc(var(--dialogue-height) - var(--beat-peek));
    max-height: 60dvh;
  }
  body[data-dialogue-over="true"] .action-beat-note {
    overflow: hidden;
    font-size: 12px;
    white-space: normal;
    overflow-wrap: anywhere;
  }
  body[data-dialogue-over="true"] .action-beat-text {
    display: block;
    overflow: visible;
    -webkit-line-clamp: none;
    line-clamp: none;
  }
  body[data-dialogue-over="true"] .hand {
    height: calc(
      var(--dialogue-cover) + var(--card-height) * var(--resting-show) +
        var(--hand-top)
    );
  }
  body[data-dialogue-over="true"] .play-dock[data-selected="true"] .hand,
  body[data-dialogue-over="true"][data-hand-expanded="true"] .hand {
    height: calc(
      var(--dialogue-cover) + var(--card-height) * (1 - var(--raised-tuck)) +
        var(--hand-top)
    );
  }
}
/* The caption is the context button. The art and empty parts of the card
   share its tap handler. */
body .beat-stack > .action-panel[data-card-tap]:not([hidden]) {
  max-height: none;
  overflow: hidden;
  flex-wrap: nowrap;
  align-content: stretch;
  cursor: pointer;
}
.beat-action[data-card-tap] #card-actions {
  display: contents;
}
#speech-row[data-beat="action"] .speech-hint,
.beat-action[data-card-tap=""] #card-actions button::after {
  position: absolute;
  right: 12px;
  bottom: 6px;
}
.beat-action[data-card-tap=""] #card-actions button::after {
  content: attr(data-tap-hint);
  color: var(--muted);
  font: 10px/12px Arial, sans-serif;
}
/* A note shares the card with the action message. */
.beat-action[data-card-tap=""]
  .action-beat-body:has(:is(#play-status, .action-beat-note:not([contenteditable])):not([hidden])) {
  flex: 0 1 33%;
}
.beat-action[data-card-tap] #card-actions button {
  flex: 1 1 0;
  min-width: 0;
  padding: 8px 12px;
  text-align: left;
  overflow-wrap: anywhere;
  font: var(--action-font);
}
.beat-action[data-card-tap=""] #card-actions button {
  position: relative;
  padding-block: 16px 18px;
}
.beat-action[data-card-tap]
  #card-actions
  button:is(:hover, :focus-visible, :active) {
  background: transparent;
}
.beat-stack > .action-panel[data-avatar][data-card-tap="hint"] {
  border: 1px solid var(--beat-divider);
}
.action-panel[data-card-tap="hint"] .action-beat-body {
  padding-bottom: 22px;
}
.action-panel[data-card-tap="hint"] .action-beat-text {
  display: block;
  overflow: visible;
  overflow-wrap: break-word;
  font: var(--action-font);
  color: #f2e3c4;
}
.action-panel[data-card-tap="hint"] .action-beat-text strong {
  font-weight: 700;
  color: inherit;
}
.beat-action[data-card-tap="hint"] #card-actions button {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: flex-end;
  justify-content: flex-end;
  padding: 6px 12px;
  color: var(--muted);
  font:
    10px/12px Arial,
    sans-serif;
}
.beat-action[data-card-tap="hint"] #card-actions button[data-destructive] {
  color: var(--danger);
}
@media (max-width: 700px) {
  body .beat-stack > .action-panel[data-card-tap=""]:has(:is(#play-status, .action-beat-note:not([contenteditable])):not([hidden])) {
    flex-wrap: wrap;
  }
  .beat-action[data-card-tap=""] .action-beat-body:has(:is(#play-status, .action-beat-note:not([contenteditable])):not([hidden])) {
    flex: 1 1 100%;
    order: 1;
    padding-top: 0;
  }
  body[data-dialogue-over="true"] {
    --dialogue-height: 96px;
  }
  /* While a beat shows, the cast stands on the dock's top edge, so the
     resting cards' tops never hide their feet. */
  body[data-dialogue-over="true"] .cast {
    --cast-bottom: var(--dock-height);
  }
}
#privacy-link {
  color: #e5cb92;
  font-size: 14px;
}
/* The new-world Lonely Forest title (title-intro.mjs). */
.title-intro {
  position: fixed;
  inset: 0;
  z-index: 2147483000;
  display: grid;
  place-items: center;
  background: #000;
  cursor: pointer;
  outline: none;
}
.title-intro > img {
  width: min(76vw, 1400px);
  max-height: 80dvh;
  object-fit: contain;
  opacity: 0;
}
@media (max-width: 640px) {
  .title-intro > img {
    width: calc(100vw - 32px);
  }
}
/* Follow the transparent lettering, never its rectangular image bounds. */
:root[data-world-tier] .title-intro > img {
  filter: drop-shadow(0 0 7px color-mix(in srgb, var(--world-tier) 65%, transparent));
}
.title-intro[data-phase="wake"] {
  cursor: default;
}
/* The land acknowledgement comes first, as real text that scrolls in place. */
.title-ack {
  position: absolute;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  width: min(34em, calc(100vw - 32px));
  max-height: calc(100dvh - 32px);
  color: #fff4dc;
  font:
    1.1rem/1.65 Georgia,
    serif;
}
/* The hand cue appears as the words start writing. */
.title-ack .speech-letter {
  visibility: visible;
}
.title-ack[data-stream] .title-continue {
  animation: beat-fade 900ms ease 300ms backwards;
}
/* A film's opening card: generous leading. */
.title-ack-text {
  min-height: 0;
  overflow-y: auto;
  padding: 0 4px;
}
.title-ack p {
  margin: 0 0 0.9em;
}
/* A short phone (375x667) fits the whole poem without scrolling. */
@media (max-height: 720px) {
  .title-ack {
    font-size: 1rem;
    line-height: 1.5;
  }
  .title-ack p {
    margin-bottom: 0.7em;
  }
}
/* Each line as written; a line too long for a phone wraps under a hanging
   indent, so it still reads as one line of the poem, its rows balanced so
   no word ("box,") is left alone. */
.title-ack-line {
  display: block;
  padding-left: 1.2em;
  text-indent: -1.2em;
  text-wrap: balance;
}
/* Its highlighted words take a gentle tint of their set's rarity tier colour
   (level-tiers.mjs), climbing as the poem goes, with a soft, low glow and a
   little weight: a stroke under the fill, so no glyph widens and nothing
   reflows. The tint rises as the next stanza starts writing, with no motion,
   and stays: all fifteen light the finished poem, well above AA contrast on
   the black. Reduced motion shows the tint and weight still, with no glow. */
.title-ack-glow {
  -webkit-text-stroke: 0.03em transparent;
  paint-order: stroke fill;
  transition:
    color var(--glow-in, 600ms) ease,
    -webkit-text-stroke-color var(--glow-in, 600ms) ease,
    text-shadow var(--glow-in, 600ms) ease;
}
.title-ack-glow[data-lit] {
  color: color-mix(in srgb, var(--tier-color) 45%, #fff4dc);
  -webkit-text-stroke-color: currentColor;
  text-shadow: 0 0 5px color-mix(in srgb, var(--tier-color) 30%, transparent);
}
@media (prefers-reduced-motion: reduce) {
  .title-ack .title-continue {
    animation: none;
  }
  .title-ack-glow,
  .title-ack-glow[data-lit] {
    transition: none;
    text-shadow: none;
  }
}
.title-intro a {
  color: inherit;
  text-decoration-color: rgba(255, 244, 220, 0.5);
}
.title-ack-text:focus-visible,
.title-intro a:focus-visible {
  outline: 2px solid #fff4dc;
  outline-offset: 3px;
}
/* The logo lifts over the card, with its hint and Privacy under it. The row
   ends above the screen's foot: on a short screen or at a large text size
   the card gives up height, never the lines under it. */
.title-reveal {
  position: absolute;
  top: 55%;
  bottom: calc(3rem + 48px);
  left: 50%;
  translate: -50% 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  width: max-content;
  max-width: calc(100vw - 32px);
  opacity: 0;
}
/* One face-down card, sized as in the hand; its reveal enters the world. */
.title-card {
  --card-height: clamp(200px, 30dvh, 280px);
  position: relative;
  flex: 0 1 var(--card-height);
  min-height: 0;
  aspect-ratio: 2 / 3;
}
.title-card .card {
  cursor: pointer;
}
/* As in the hand: a pointer over the face-down card lifts it (brightens it
   under reduced motion), and only the keyboard shows its focus ring. */
@media (hover: hover) and (pointer: fine) and (prefers-reduced-motion: no-preference) {
  .title-card .card {
    transition: translate 180ms ease-out;
  }
  .title-card .card[data-unrevealed="true"]:hover {
    translate: 0 -8px;
  }
}
@media (hover: hover) and (prefers-reduced-motion: reduce) {
  .title-card .card[data-unrevealed="true"]:hover {
    filter: brightness(1.12);
  }
}
.title-intro[data-pointer] .title-card .card:focus-visible {
  outline-color: transparent;
}
.title-privacy {
  position: absolute;
  right: max(16px, env(safe-area-inset-right));
  bottom: max(12px, env(safe-area-inset-bottom));
  flex: none;
  padding: 6px 8px;
  color: #fff4dc;
  font:
    0.85rem Georgia,
    serif;
  opacity: 0.7;
}
/* The quiet lines wrap rather than run off a narrow screen at a large size. */
.title-continue,
.title-hint {
  flex: none;
  max-width: 100%;
  text-align: center;
  text-wrap: balance;
}
.title-continue {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45em;
  min-height: 44px;
  padding: 4px 8px;
  border: 0;
  background: none;
  color: #fff4dc;
  font:
    italic 0.85rem Georgia,
    serif;
  letter-spacing: 0.04em;
  opacity: 0.6;
  cursor: pointer;
}
.title-continue::before {
  content: "☞";
  font-size: 1.4em;
  font-style: normal;
  line-height: 1;
}
@media (max-width: 640px) {
  .title-reveal {
    top: 52%;
  }
}
.title-continue:hover {
  opacity: 0.85;
}
.title-continue:focus:not(:focus-visible) {
  outline: none;
}
.title-continue:focus-visible {
  outline: 2px solid #fff4dc;
  outline-offset: 3px;
}

/* Left alone, the box breathes a faint warm light. Its invitation whispers
   around it (REVEAL_HINT in title-intro.mjs); reduced motion holds it still. */
.title-card::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 13px;
  box-shadow: 0 0 24px 5px color-mix(in srgb, var(--gold) 50%, transparent);
  opacity: 0;
  pointer-events: none;
}
.title-reveal[data-idle] .title-card::before {
  animation:
    title-glow-in 2s ease-out forwards,
    title-glow 3.6s ease-in-out 2s infinite alternate;
}
@keyframes title-glow-in {
  from {
    opacity: 0;
  }
  to {
    opacity: 0.7;
  }
}
@keyframes title-glow {
  from {
    opacity: 0.7;
  }
  to {
    opacity: 0.35;
  }
}
.title-hint {
  position: absolute;
  width: max-content;
  max-width: calc(100vw - 32px);
  white-space: normal;
  margin: 0;
  padding: 4px 8px;
  color: #fff4dc;
  font:
    italic 0.85rem Georgia,
    serif;
  letter-spacing: 0.04em;
  opacity: 0;
  pointer-events: none;
}
.title-reveal[data-idle="hint"] .title-hint {
  opacity: 0.6;
  pointer-events: auto;
}
@media (prefers-reduced-motion: reduce) {
  .title-reveal[data-idle] .title-card::before {
    animation: none;
    opacity: 0.55;
  }
  .title-reveal[data-idle="hint"] .title-hint {
    animation: none;
  }
}
/* Leaving goes to black, then the black slowly opens on the scene. */
.title-dark {
  position: absolute;
  inset: 0;
  background: #000;
}
.title-intro[data-phase="out"] {
  pointer-events: none;
}

/* A recipe uses the quest scene: maker and ingredients within its home. */
.action-beat-cards .quest-screen[data-recipe="true"] {
  position: relative;
  top: auto;
  left: auto;
  width: 144px;
  height: 88px;
  aspect-ratio: auto;
}
.quest-screen[data-recipe="true"] img {
  margin-left: 0;
}
.quest-screen[data-recipe="true"] .quest-ground {
  width: 118%;
  height: 112%;
}
.quest-screen[data-recipe="true"] .quest-figure {
  left: 25%;
  height: 96%;
}
.quest-screen[data-recipe="true"] .quest-thing {
  left: 84%;
  bottom: 4%;
  height: 32%;
}
.quest-screen[data-recipe="true"] .quest-thing:nth-last-child(2) {
  left: 66%;
}
.quest-screen[data-recipe="true"] .quest-thing:nth-last-child(3) {
  left: 48%;
}

/* Maker: played boxes remain on the table; their loose cards form the hand. */
#settings-screen[data-layout="tree"][data-maker-hand="true"] #settings-hand {
  grid-template-rows: repeat(var(--tree-table-rows), max-content) minmax(
      max-content,
      1fr
    );
}
#settings-screen[data-layout="tree"][data-maker-hand="true"] .card-frame[data-zone="hand"] {
  align-self: end;
  margin-top: 44px;
  rotate: clamp(-4deg, calc(var(--fan-at) * 1deg), 4deg);
}
@media (max-width: 700px) {
  #settings-screen[data-layout="tree"][data-maker-hand="true"] #settings-hand {
    grid-template-columns: repeat(var(--tree-columns), minmax(96px, 116px));
    justify-content: safe center;
  }
  #settings-screen[data-layout="tree"][data-maker-hand="true"] .card-frame {
    grid-row: var(--tree-row);
    grid-column: var(--tree-column) / span var(--tree-span);
  }
}
