/* Render the room and the character on the same native 192 × 76 grid. */
.work-card {
  display: grid;
  place-items: center;
  position: relative;
  overflow: hidden;
  box-sizing: border-box;
  padding: 0;
  background: #253a39;
  border: 0;
  cursor: zoom-in;
  break-inside: avoid;
}
.work-card:focus-visible, .work-motion:focus-visible {outline: 3px solid #e7bb67;outline-offset: -3px;}
.work-picture {
  position: relative;
  display: block;
  flex: none;
  overflow: hidden;
  isolation: isolate;
  aspect-ratio: 192/76;
}
.work-film {display: block;position: absolute;inset: 0;}
.work-picture .work-backdrop, .work-picture .work-actors {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  box-shadow: none;
  image-rendering: pixelated;
  pointer-events: none;
}
.work-picture .work-actors {
  background-size: 400% 1200%;
  background-repeat: no-repeat;
  background-position: 0% var(--work-row);
  animation: work-idle 1.28s steps(1,end) infinite;
}
.work-awarded .work-actors {animation: work-idle 1.28s steps(1,end) infinite, work-cheer 1.28s steps(1,end) 1;}
@keyframes work-idle {
  0%,100% {background-position-x: 0%;}
  30% {background-position-x: 33.333333%;}
  60% {background-position-x: 66.666667%;}
  90% {background-position-x: 100%;}
}
@keyframes work-cheer {from,to {background-position-y: var(--work-cheer-row);}}
.work-paused .work-actors {animation: none;}
.work-paused .work-awarded .work-actors {background-position: 33.333333% var(--work-cheer-row);}
@media(prefers-reduced-motion: reduce) {
  .work-picture .work-actors {animation: none;}
  .work-awarded .work-actors {background-position: 33.333333% var(--work-cheer-row);}
}

.fq-workspace .work-prompt {
  container-type: size;
  width: 100%;
  height: clamp(94px,18dvh,148px);
  min-height: 0;
  border: 1px solid #8c8164;
  border-radius: 8px;
  flex: 0 1 auto;
  background: #293b38;
}
.fq-workspace .work-prompt::before {
  content: '';
  position: absolute;
  inset: -8px;
  z-index: auto;
  background: linear-gradient(90deg,#172a2be0,#243b38a6 50%,#172a2be0),var(--work-room) center / 100% 100%;
  filter: blur(4px);
}
.fq-workspace .work-prompt::after {content: none;}
.work-prompt .work-picture {width: min(100cqw,252.6316cqh);height: auto;}
@media(max-width:600px) and (min-height:651px) {
  .fq-workspace .work-prompt {height: min(157px,calc((100vw - 24px) * .395834 + 2px),20dvh);}
}
@media(max-height:650px) {.fq-workspace .work-prompt {height: clamp(58px,12dvh,76px);}}
@media(max-height:500px) {.fq-workspace .work-prompt {display: none;}}
@media(max-height:650px) {.fq-question:has(.fq-card-flow > .fq-mark) .work-prompt {display: none;}}
@media(max-height:610px) {.fq-question:has(.fq-mark,.fq-hint-line) .work-prompt {display: none;}}

.fq-feedback .work-verdict {
  display: grid;
  grid-template-columns: minmax(0,1fr) clamp(88px,32%,150px);
  overflow: hidden;
  border: 1px solid #214c40;
  border-radius: 7px;
  background: #255747;
  break-inside: avoid;
}
.fq-feedback.is-retry .work-verdict {border-color: #71333d;background: #803d46;}
.fq-feedback .work-verdict .fq-feedback-heading {margin: 0;border: 0;border-radius: 0;}
.work-feedback {width: 100%;min-height: 44px;container-type: size;}
.work-feedback .work-picture {width: 100%;height: 100%;}
/* Crop the room for the small verdict illustration; both layers keep their aspect ratio. */
.work-feedback .work-film {
  inset: auto;
  width: max(180cqw,445cqh);
  aspect-ratio: 192/76;
  top: 50%;
  left: 50%;
  transform: translate(-55%,-52%);
}
@media(max-width:360px) {
  .work-feedback .work-film {width: max(178cqw,410cqh);transform: translate(-52%,-52%);}
}

/* Larger celebrations show the same room and sprite grid beside the verdict. */
.fq-verdict-cutin[data-work-power] strong {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  padding-inline-end: 28%;
}
.work-cutin-label {
  display: flex;
  align-items: center;
  gap: .3em;
  z-index: 1;
}
.work-cutin-scene {
  position: absolute;
  inset: 8% 1% 8% auto;
  width: 42%;
  overflow: hidden;
  container-type: size;
  pointer-events: none;
}
.work-cutin-scene .work-picture {
  width: 100%;
  height: 100%;
  mask-image: linear-gradient(90deg, transparent, #000 27%, #000 94%, transparent);
}
.work-cutin-scene .work-film {
  inset: auto;
  top: 50%;
  left: 50%;
  width: max(158cqw, 181cqh);
  aspect-ratio: 192/76;
  transform: translate(-52%, -52%);
}

/* Stars sit around the edges of the room, leaving the clerk's face visible. */
.work-celebration {
  --spark-cream: #fff1b8;
  --spark-gold: #eeb850;
  --spark-mint: #a9edce;
  --spark-duration: 1.55s;
  --spark-delay: 30ms;
  --spark-pixel: clamp(2px, 1.8cqw, 3px);
  position: absolute;
  inset: 0;
  z-index: 1;
  overflow: hidden;
  pointer-events: none;
}
[data-work-power="finale"] .work-celebration {--spark-duration: 1.73s; --spark-delay: 34ms;}
[data-work-power="perfect"] .work-celebration {
  --spark-duration: 1.85s;
  --spark-delay: 39ms;
  --spark-cream: #fff9df;
  --spark-gold: #ffcf66;
}
.work-cutin-scene .work-celebration {
  --spark-duration: .92s;
  --spark-delay: 18ms;
  --spark-pixel: clamp(3px, 2cqw, 5px);
}
.work-celebration::before {
  content: "";
  position: absolute;
  inset: 0;
  box-shadow: inset 0 0 0 1px #f5cc7a9c;
  opacity: .67;
}
[data-work-power="finale"] .work-celebration::before,
[data-work-power="perfect"] .work-celebration::before {
  box-shadow: inset 0 0 0 1px #fff0bc, inset 0 0 13px 3px #f3b75575;
}
[data-work-power="perfect"] .work-celebration::before {
  box-shadow: inset 0 0 0 2px #ffe19a, inset 0 0 19px 6px #ffd46983;
}
.work-cutin-scene .work-celebration::before {
  mask-image: linear-gradient(90deg, transparent 5%, #000 34%);
}
.work-spark {
  --spark-color: var(--spark-cream);
  --spark-size: 3;
  --spark-lag: 0;
  position: absolute;
  left: var(--spark-x);
  top: var(--spark-y);
  width: calc(var(--spark-pixel) * var(--spark-size));
  height: calc(var(--spark-pixel) * var(--spark-size));
  translate: -50% -50%;
  filter: drop-shadow(0 1px #735226);
}
.work-spark::before {
  content: "";
  display: block;
  width: 100%;
  height: 100%;
  background: var(--spark-color);
  clip-path: polygon(39% 0, 61% 0, 61% 28%, 72% 28%, 72% 39%, 100% 39%, 100% 61%,
    72% 61%, 72% 72%, 61% 72%, 61% 100%, 39% 100%, 39% 72%, 28% 72%, 28% 61%, 0 61%,
    0 39%, 28% 39%, 28% 28%, 39% 28%);
}
.work-spark:nth-child(3n)::before {clip-path: none;}
.work-spark:nth-child(1) {--spark-x: 75%; --spark-y: 33%; --spark-size: 4;}
.work-spark:nth-child(2) {--spark-x: 90%; --spark-y: 66%; --spark-lag: 3; --spark-color: var(--spark-gold);}
.work-spark:nth-child(3) {--spark-x: 9%; --spark-y: 26%; --spark-size: 1; --spark-lag: 2;}
.work-spark:nth-child(4) {--spark-x: 10%; --spark-y: 78%; --spark-lag: 4; --spark-color: var(--spark-gold);}
.work-spark:nth-child(5) {--spark-x: 49%; --spark-y: 15%; --spark-size: 2; --spark-lag: 1;}
.work-spark:nth-child(6) {--spark-x: 94%; --spark-y: 33%; --spark-size: 1; --spark-lag: 4; --spark-color: var(--spark-mint);}
.work-spark:nth-child(7) {--spark-x: 72%; --spark-y: 76%; --spark-size: 3; --spark-lag: 2; --spark-color: var(--spark-mint);}
.work-spark:nth-child(8) {--spark-x: 34%; --spark-y: 83%; --spark-size: 2; --spark-lag: 5;}
.work-spark:nth-child(9) {--spark-x: 62%; --spark-y: 17%; --spark-size: 1; --spark-lag: 1; --spark-color: var(--spark-gold);}
.work-spark:nth-child(10) {--spark-x: 84%; --spark-y: 16%; --spark-size: 4; --spark-lag: 3;}
.work-spark:nth-child(11) {--spark-x: 23%; --spark-y: 23%; --spark-size: 3; --spark-lag: 1; --spark-color: var(--spark-mint);}
.work-spark:nth-child(12) {--spark-x: 54%; --spark-y: 76%; --spark-size: 1; --spark-lag: 5; --spark-color: var(--spark-gold);}
@media(max-width:360px) {
  .fq-verdict-cutin[data-work-power] strong {padding-inline-end: 32%;}
  .work-cutin-label {gap: .22em;}
  .work-cutin-label .fq-icon {width: 1em;height: 1em;}
}
@media(prefers-reduced-motion: no-preference) {
  .fq-verdict-cutin[data-work-power="bright"],
  .fq-verdict-cutin[data-work-power="finale"],
  .fq-verdict-cutin[data-work-power="perfect"] {animation-duration: 1.08s;}
  :root:not(.work-paused) .work-celebration::before {
    animation: work-celebration-glow var(--spark-duration) ease-out both;
  }
  :root:not(.work-paused) .work-spark {
    animation: work-spark-rise var(--spark-duration) steps(8,end) both;
    animation-delay: calc(var(--spark-delay) * var(--spark-lag));
  }
}
@keyframes work-celebration-glow {
  0% {opacity: .25;}
  26%, 57% {opacity: .9;}
  100% {opacity: 0;}
}
@keyframes work-spark-rise {
  0% {opacity: 0;transform: translateY(6px) scale(.55);}
  22% {opacity: 1;transform: translateY(4px) scale(1);}
  58% {opacity: 1;transform: translateY(0) scale(1);}
  100% {opacity: 0;transform: translateY(-7px) scale(.75);}
}

.work-details .work-picture {width: 100%;margin: 0 auto;outline: 1px solid #aa9b74;border-radius: 5px;}
.work-motion {
  display: block;min-height: 40px;margin: 10px 0 0 auto;padding: 5px 12px;
  background: transparent;border: 1px solid #a5ac96;border-radius: 5px;color: #395346;font: inherit;font-size: 13px;cursor: pointer;
}
