/* A classroom seen from above, under a chalkboard: one fixed look, so it sets no light or dark theme. */
:root {
  color-scheme: dark;
  --board: #1d3a32;
  --board-deep: #142a24;
  --chalk: #eef0e4;
  --chalk-dim: #b4c2b6;
  --chalk-yellow: #f2d666;
  --floor: #8d9a8f;
  --floor-line: #7f8c81;
  --wood: #b07c45;
  --wood-dark: #7d5430;
  --paper: #eef1ec;
  --pen-red: #e2533a;
  --ok: #8fd6a5;
  --wall: #3d4f46;
  --hand: 'Patrick Hand', 'Comic Sans MS', cursive;
  --body: 'Be Vietnam Pro', system-ui, sans-serif;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  background: var(--board-deep);
  color: var(--chalk);
  font: 15px/1.5 var(--body);
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
  padding-block: 12px 24px;
}

#app {
  max-width: 1040px;
  margin: 0 auto;
  display: grid;
  gap: 12px;
}

h1,
h2 {
  font-family: var(--hand);
  font-weight: 400;
  margin: 0;
  text-wrap: balance;
}

p {
  margin: 0;
}

button {
  font: inherit;
  color: inherit;
  cursor: pointer;
}

button:focus-visible,
input:focus-visible,
textarea:focus-visible {
  outline: 3px solid var(--chalk-yellow);
  outline-offset: 2px;
}

.num {
  font-variant-numeric: tabular-nums;
}

.row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.link {
  background: none;
  border: 0;
  padding: 6px 2px;
  color: var(--chalk-dim);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.primary,
.ghost {
  border-radius: 6px;
  padding: 10px 14px;
  font-weight: 600;
}

.primary {
  background: var(--chalk-yellow);
  border: 1px solid var(--chalk-yellow);
  color: var(--board-deep);
}

.ghost {
  background: none;
  border: 1px solid var(--chalk-dim);
}

.primary:disabled {
  opacity: 0.45;
  cursor: default;
}

.hint,
.people {
  color: var(--chalk-dim);
  font-size: 13px;
}

.status {
  color: var(--chalk-yellow);
  min-height: 1.5em;
}

/* Lobby */
.lobby {
  display: grid;
  gap: 16px;
  max-width: 720px;
  margin: 0 auto;
  width: 100%;
}

.lobby-board {
  background: var(--board);
  border: 10px solid var(--wood-dark);
  padding: 24px 20px;
  display: grid;
  gap: 8px;
}

.lobby-board h1 {
  font-size: clamp(44px, 12vw, 72px);
  line-height: 1;
  color: var(--chalk);
}

.lobby-board p {
  font-family: var(--hand);
  font-size: 22px;
  line-height: 1.3;
  color: var(--chalk-dim);
}

.doors {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 12px;
}

.door {
  display: grid;
  gap: 6px;
  text-align: left;
  background: var(--wood);
  border: 0;
  border-bottom: 6px solid var(--wood-dark);
  border-radius: 4px;
  padding: 18px 16px;
  color: #241608;
}

.door-title {
  font: 32px/1.1 var(--hand);
}

.door-go {
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.friends {
  display: grid;
  gap: 6px;
}

.friends-title {
  font: 24px/1.1 var(--hand);
}

.friends input {
  width: 100%;
  background: var(--board);
  color: var(--chalk);
  border: 1px solid var(--chalk-dim);
  border-radius: 4px;
  padding: 10px;
  font: inherit;
}

/* Top bar */
.topbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 12px;
}

.topbar strong {
  font: 24px/1 var(--hand);
}

.topbar-tools {
  margin-left: auto;
  display: flex;
  flex-wrap: wrap;
  gap: 0 12px;
  font-size: 13px;
}

/* The room */
.play {
  display: grid;
  gap: 12px;
}

@media (min-width: 860px) {
  .play {
    grid-template-columns: minmax(0, 1.8fr) minmax(0, 1fr);
    align-items: start;
  }
}

.stage {
  background: var(--board-deep);
  transition: background 0.4s, padding 0.4s;
}

.window {
  width: 100%;
  max-width: min(100%, 86vh);
  margin: 0 auto;
  transition: transform 0.4s;
}

.board {
  background: var(--board);
  border: 6px solid var(--wood-dark);
  border-bottom-width: 10px;
  padding: 6px 10px;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0 12px;
  font: 20px/1.2 var(--hand);
}

.board-rule {
  color: var(--chalk-dim);
}

.floor {
  position: relative;
  aspect-ratio: 1;
  max-width: 100%;
  margin-bottom: 18px;
  background-color: var(--floor);
  background-image: linear-gradient(var(--floor-line) 1px, transparent 1px),
    linear-gradient(90deg, var(--floor-line) 1px, transparent 1px);
  background-size: 10% 10%;
}

.sight {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.sight path {
  fill: var(--chalk-yellow);
  fill-opacity: 0.32;
  stroke: var(--chalk-yellow);
  stroke-opacity: 0.7;
  stroke-width: 0.3;
}

.seat {
  transition: left 0.6s ease-in-out, top 0.6s ease-in-out;
  position: absolute;
  width: var(--seat-width);
  transform: translate(-50%, -50%);
  display: grid;
  justify-items: center;
  container-type: inline-size;
}

/* A lifted seat keeps its bubble and its walking student above the seats drawn after it. */
.seat[data-pose],
.seat.walking,
.seat:has(.bubble:not([hidden])) {
  z-index: 4;
}

/* The student sits facing us, so a tilt, an open mouth and closed eyes can all be seen. */
.figure {
  position: relative;
  z-index: 1;
  display: block;
  width: 100%;
  aspect-ratio: 1 / 0.8;
}

.head,
.torso,
.arm,
.eye {
  transition: transform 0.18s ease-out;
}

.head {
  position: absolute;
  left: 27%;
  top: 0;
  width: 46%;
  aspect-ratio: 1;
  border-radius: 50%;
  transform-origin: 50% 90%;
  z-index: 1;
}

/* The face is clipped to the round head, and whatever the student wears is not. */
.scalp {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: #e8bf98;
  overflow: hidden;
}

/* Hair behind the head belongs to the head, so it tilts and falls asleep with it. */
.hair-back {
  display: none;
  position: absolute;
  z-index: -1;
  left: -9%;
  right: -9%;
  top: -6%;
  height: 132%;
  background: var(--hair, #2b2320);
  border-radius: 50% 50% 14% 14%;
  /* Two locks beside the face with the neck showing, so long hair does not read as a head covering. */
  clip-path: polygon(0 0, 100% 0, 100% 100%, 74% 100%, 74% 72%, 26% 72%, 26% 100%, 0 100%);
}

.head.body-girl .hair-back {
  display: block;
}

.head.hair-pink {
  --hair: #e8619f;
}

.head.hair-smoke {
  --hair: #6d8796;
}

.head.hair-pigtails .hair-back,
.head.hair-bun .hair-back {
  display: block;
  inset: 0;
  height: auto;
  background: none;
  clip-path: none;
}

.head.hair-pigtails .hair-back::before,
.head.hair-pigtails .hair-back::after {
  content: '';
  position: absolute;
  top: 30%;
  width: 30%;
  height: 100%;
  background: var(--hair, #2b2320);
  border-radius: 50%;
}

.head.hair-pigtails .hair-back::before {
  left: -22%;
}

.head.hair-pigtails .hair-back::after {
  right: -22%;
}

.head.hair-bun .hair-back::before {
  content: '';
  position: absolute;
  left: 30%;
  top: -32%;
  width: 40%;
  aspect-ratio: 1;
  background: var(--hair, #2b2320);
  border-radius: 50%;
}

.scalp::before {
  content: '';
  position: absolute;
  inset: -4% -4% auto;
  height: 44%;
  background: var(--hair, #2b2320);
  border-radius: 50% 50% 18% 18%;
}

.eye {
  position: absolute;
  top: 52%;
  width: 13%;
  aspect-ratio: 1;
  border-radius: 50%;
  background: #1d1a1c;
}

.eye.left {
  left: 26%;
}

.eye.right {
  right: 26%;
}

.mouth {
  position: absolute;
  left: 37%;
  top: 75%;
  width: 26%;
  height: 5%;
  background: #7a3a2c;
  border-radius: 40%;
  transition: all 0.18s ease-out;
}

.torso {
  position: absolute;
  left: 22%;
  top: 50%;
  width: 56%;
  height: 50%;
  background: var(--uniform, #e8e9e2);
  border-radius: 34% 34% 0 0;
  transform-origin: 50% 100%;
}

.arm {
  position: absolute;
  top: 58%;
  width: 13%;
  height: 46%;
  background: var(--uniform, #e8e9e2);
  border: 1px solid rgb(23 33 28 / 0.28);
  border-radius: 40%;
  transform-origin: 50% 8%;
  z-index: 2;
}

.arm::after {
  content: '';
  position: absolute;
  left: -8%;
  bottom: -14%;
  width: 116%;
  aspect-ratio: 1;
  border-radius: 50%;
  background: #e8bf98;
}

.arm.left {
  left: 15%;
}

.arm.right {
  right: 15%;
  animation: write 1.5s ease-in-out infinite;
  animation-delay: var(--idle, 0s);
}

.wear {
  position: absolute;
  line-height: 1;
  pointer-events: none;
}

.wear-hat {
  left: 50%;
  bottom: 62%;
  transform: translateX(-50%);
  font-size: 40cqw;
}

.wear.hat-bow,
.wear.hat-flower {
  left: 82%;
  bottom: 58%;
  font-size: 26cqw;
}

.wear.hat-la {
  bottom: 50%;
  width: 165%;
  aspect-ratio: 2.1;
  background: linear-gradient(100deg, #f0d48a, #cfa95a);
  clip-path: polygon(50% 0, 100% 100%, 0 100%);
}

.wear.hat-band {
  left: -3%;
  right: -3%;
  bottom: auto;
  top: 18%;
  height: 22%;
  transform: none;
  background: var(--pen-red);
}

.wear-face {
  left: 50%;
  top: 60%;
  transform: translate(-50%, -50%);
  font-size: 40cqw;
}

.wear-desk {
  right: -6%;
  bottom: 45%;
  z-index: 2;
  font-size: 40cqw;
}

.seat.empty .wear-desk {
  visibility: hidden;
}

.desk {
  position: relative;
  display: grid;
  place-items: center;
  width: 100%;
  aspect-ratio: 2.8;
  margin-top: -2px;
  background: var(--wood);
  border-bottom: 3px solid var(--wood-dark);
  border-radius: 2px;
}

.sheet {
  width: 42%;
  height: 62%;
  background: var(--paper);
}

.seat.empty .figure,
.seat.empty .sheet {
  visibility: hidden;
}

.seat.you .head {
  outline: 2px solid var(--chalk-yellow);
  outline-offset: 0;
}

.seat.friend .head {
  outline: 2px solid var(--paper);
  outline-offset: 0;
}

.seat[data-pose] .arm.right {
  animation: none;
}


/* Startled awake: the student leaps, wobbles in mid-air and lands with eyes like saucers. */
.seat[data-pose='startled'] {
  z-index: 5;
}

.seat[data-pose='startled'] .figure {
  animation: startle-leap 0.9s ease-out;
}

.seat[data-pose='startled'] .eye {
  transform: scale(1.9);
}

.seat[data-pose='startled'] .mouth {
  left: 32%;
  top: 68%;
  width: 36%;
  height: 24%;
  border-radius: 50%;
}

.seat[data-pose='startled'] .head {
  animation: startle-shake 0.16s linear 5;
}

.seat[data-pose='startled'] .arm.left {
  transform: rotate(140deg);
}

.seat[data-pose='startled'] .arm.right {
  animation: none;
  transform: rotate(-140deg);
}

@keyframes startle-leap {
  0% {
    transform: translateY(0) scale(1);
  }

  25% {
    transform: translateY(-75%) scale(1.15) rotate(-8deg);
  }

  50% {
    transform: translateY(-45%) scale(1.1) rotate(8deg);
  }

  75% {
    transform: translateY(-12%) scale(1.05) rotate(-4deg);
  }

  100% {
    transform: translateY(0) scale(1);
  }
}

@keyframes startle-shake {
  0%,
  100% {
    transform: rotate(0);
  }

  25% {
    transform: rotate(-14deg);
  }

  75% {
    transform: rotate(14deg);
  }
}


.seat.gummed .scalp::after {
  content: '';
  position: absolute;
  inset: 34% 8% 2%;
  border-radius: 42%;
  background: #f58fc0;
}

.sign {
  position: absolute;
  left: 50%;
  bottom: 2%;
  transform: translateX(-50%) rotate(-5deg);
  z-index: 3;
  padding: 0 1px;
  white-space: nowrap;
  font-size: 12cqw;
  line-height: 1.1;
  color: #17211c;
  background: var(--paper);
  border: 1px solid rgb(23 33 28 / 0.4);
}

/* Time is nearly up: everyone writes at a panic. */
.floor.rush .arm.right {
  animation-duration: 0.35s;
}


/* Things that leave a student's hand. */
.prop {
  position: absolute;
  z-index: 5;
  transform: translate(-50%, -50%);
  pointer-events: none;
}

.prop.ball {
  width: 3.5%;
  aspect-ratio: 1;
  background: var(--paper);
  border: 1px solid rgb(23 33 28 / 0.45);
  clip-path: polygon(12% 22%, 42% 4%, 74% 12%, 96% 44%, 82% 80%, 50% 96%, 18% 84%, 4% 50%);
}

.prop.ball.litter {
  z-index: 0;
}

.prop.note {
  width: 3.5%;
  aspect-ratio: 1.3;
  background: var(--paper);
  border: 1px solid rgb(23 33 28 / 0.5);
  background-image: linear-gradient(135deg, transparent 47%, rgb(23 33 28 / 0.4) 48% 52%, transparent 53%);
}

.prop.gun {
  font-size: clamp(14px, 3vw, 24px);
  line-height: 1;
}

.prop.drop {
  width: 1.2%;
  aspect-ratio: 1;
  border-radius: 50%;
  background: #7ec8f2;
  border: 1px solid #fff;
}

.prop.band {
  width: 2.4%;
  aspect-ratio: 1;
  border: 2px solid #c8553d;
  border-radius: 50%;
}

.prop.pen {
  font-size: clamp(12px, 2.6vw, 20px);
  line-height: 1;
}

.prop.gum {
  width: 3%;
  aspect-ratio: 1;
  border-radius: 50%;
  background: #f58fc0;
  border: 1px solid #fff;
}

.prop.snore {
  font: 700 clamp(14px, 3.4vw, 24px) / 1 var(--hand);
  color: var(--paper);
  text-shadow: 0 1px 2px rgb(23 33 28 / 0.7);
  opacity: 0;
}

.uniform-white {
  --uniform: #e8e9e2;
}

.uniform-navy {
  --uniform: #27487f;
}

.uniform-red {
  --uniform: #bd3a2c;
}

.you-tag {
  position: absolute;
  bottom: -13px;
  max-width: 130%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 11px;
  font-weight: 700;
  color: #17211c;
}

.bubble {
  position: absolute;
  bottom: 100%;
  z-index: 3;
  white-space: nowrap;
  background: var(--paper);
  color: #17211c;
  font-size: 11px;
  padding: 0 5px;
  border-radius: 3px;
}

.proctor {
  position: absolute;
  width: 6%;
  aspect-ratio: 1;
  transform: translate(-50%, -50%);
  z-index: 3;
}

.proctor-body {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: var(--pen-red);
  border: 3px solid var(--paper);
}

.proctor.walking .proctor-body {
  animation: step 0.5s ease-in-out infinite;
}

/* The nose points where the proctor looks, so a turn reads before the cone does. */
.proctor-nose {
  position: absolute;
  inset: 0;
  transform: rotate(var(--facing, 0rad));
}

.proctor-nose::after {
  content: '';
  position: absolute;
  left: 92%;
  top: 34%;
  width: 34%;
  height: 32%;
  background: var(--paper);
  border-radius: 0 50% 50% 0;
}

.proctor-alert {
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
  font: 700 clamp(22px, 5vw, 34px) / 1 var(--hand);
  color: var(--pen-red);
  text-shadow: 0 0 3px var(--paper), 0 0 3px var(--paper);
  animation: alert-pop 0.25s ease-out;
}

.proctor.outside {
  opacity: 0;
}

.proctor.visitor {
  background: none;
}

.proctor.visitor .proctor-body {
  background: #5b7fa6;
}

.proctor.visitor .proctor-tag {
  left: auto;
  right: 0;
  transform: none;
}

.proctor-prop {
  position: absolute;
  left: 70%;
  top: -20%;
  font-size: clamp(14px, 3vw, 22px);
  line-height: 1;
}

.board-seized {
  flex-basis: 100%;
  color: var(--chalk-yellow);
}

.proctor-say {
  position: absolute;
  bottom: 175%;
  left: 50%;
  transform: translateX(-50%);
  width: max-content;
  max-width: 48vw;
  text-align: center;
  font-size: 12px;
  font-weight: 700;
  color: #fff;
  background: var(--pen-red);
  padding: 1px 6px;
  border-radius: 3px;
  z-index: 6;
}

/* A ruler in the direction the proctor faces, wagging while they tell someone off. */
.proctor-ruler {
  display: none;
  position: absolute;
  left: 100%;
  top: 42%;
  width: 130%;
  height: 16%;
  background: #e8c37a;
  border: 1px solid var(--wood-dark);
  transform-origin: 0 50%;
}

.proctor.scolding .proctor-ruler {
  display: block;
  animation: ruler-wag 0.28s ease-in-out infinite alternate;
}

@keyframes ruler-wag {
  from {
    transform: rotate(-16deg);
  }

  to {
    transform: rotate(16deg);
  }
}

.proctor-tag {
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  white-space: nowrap;
  font-size: 11px;
  font-weight: 700;
  color: #17211c;
  background: var(--paper);
  padding: 0 4px;
  border-radius: 3px;
}

/* In the hallway the same live room shrinks into a window in the wall. */
.stage.is-out {
  background: var(--wall);
  padding: 28px 16px;
}

.stage.is-out .window {
  transform: scale(0.82);
  outline: 12px solid var(--wood-dark);
}

/* Panel */
.panel {
  display: grid;
  gap: 10px;
  min-width: 0;
}

.hud {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 18px;
}

.hud b {
  font-size: 20px;
  color: var(--chalk-yellow);
}

.ladder {
  list-style: none;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 4px;
  margin: 0;
  padding: 0;
  font-size: 13px;
}

.ladder li {
  border: 1px solid var(--chalk-dim);
  padding: 3px 6px;
  text-align: center;
  color: var(--chalk-dim);
}

.ladder li.hit {
  background: var(--pen-red);
  border-color: var(--pen-red);
  color: #fff;
}

.speech {
  font: 21px/1.25 var(--hand);
  min-height: 2.5em;
}

.speech[data-tone='warn'] {
  color: #ff9a84;
}

.speech[data-tone='ok'] {
  color: var(--ok);
}

.actions {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

/* On a phone the buttons scroll sideways, so the room never leaves the screen. */
@media (max-width: 859px) {
  .actions {
    grid-template-columns: none;
    grid-template-rows: repeat(2, auto);
    grid-auto-flow: column;
    grid-auto-columns: 30%;
    overflow-x: auto;
    padding-bottom: 4px;
  }

  .action {
    padding: 5px 2px 3px;
    font-size: 14px;
    line-height: 1.2;
    align-content: center;
  }
}

.action[hidden] {
  display: none;
}

.action {
  position: relative;
  overflow: hidden;
  background: var(--wood);
  color: #241608;
  border: 0;
  border-bottom: 4px solid var(--wood-dark);
  border-radius: 4px;
  padding: 10px 4px 8px;
  display: grid;
  justify-items: center;
  font-weight: 600;
}

.action small {
  font-weight: 500;
  opacity: 0.75;
}

.action::after {
  content: '';
  position: absolute;
  inset: 0;
  background: rgb(20 42 36 / 0.65);
  transform-origin: left;
  transform: scaleX(var(--cool, 0));
}

.action:disabled {
  cursor: default;
}

.hall {
  display: grid;
  gap: 8px;
  background: var(--wall);
  padding: 14px;
}

.hall h2 {
  font-size: 30px;
}

.hall-time {
  font-size: 22px;
  color: var(--chalk-yellow);
}

.study-time {
  font: 72px/1 var(--body);
  font-weight: 700;
  color: var(--chalk);
}

/* Card */
.overlay {
  position: fixed;
  inset: 0;
  z-index: 20;
  overflow-y: auto;
  background: rgb(8 18 15 / 0.96);
  padding: max(16px, env(safe-area-inset-top, 0px)) max(16px, env(safe-area-inset-right, 0px))
    max(16px, env(safe-area-inset-bottom, 0px)) max(16px, env(safe-area-inset-left, 0px));
}

.sheet-panel {
  max-width: 420px;
  margin: 0 auto;
  display: grid;
  gap: 10px;
}

.card-image {
  min-height: 120px;
}

.card-image img {
  display: block;
  width: 100%;
}

.share-text {
  width: 100%;
  background: var(--board);
  color: var(--chalk);
  border: 1px solid var(--chalk-dim);
  border-radius: 4px;
  padding: 8px;
  font: inherit;
  resize: none;
}

/* Shop and metrics */
.page {
  display: grid;
  gap: 14px;
  max-width: 640px;
}

.mirror {
  display: grid;
  justify-items: center;
  padding: 36px 0 12px;
  background: var(--floor);
}

.mirror .seat {
  position: relative;
  width: 140px;
  transform: none;
}

.shop-groups {
  display: grid;
  gap: 16px;
}

.shop-group {
  display: grid;
  gap: 8px;
}

.shop-group h2 {
  font: 24px/1.1 var(--hand);
}

.shop {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 8px;
}

.shop li {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 10px;
  background: var(--board);
  padding: 10px;
}

.shop-name {
  flex: 1 1 140px;
  min-width: 0;
}

.swatch {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  font-size: 18px;
  line-height: 1;
  border-radius: 50%;
  background: var(--uniform, var(--paper));
  border: 2px solid var(--chalk-dim);
}

.swatch.hair-base,
.swatch.hair-pigtails,
.swatch.hair-bun {
  background: #2b2320;
}

.swatch.hair-pink {
  background: #e8619f;
}

.swatch.hair-smoke {
  background: #6d8796;
}

.swatch.hat-la {
  border: 0;
  border-radius: 0;
  height: 18px;
  background: #e2bf74;
  clip-path: polygon(50% 0, 100% 100%, 0 100%);
}

.swatch.hat-band {
  border: 0;
  border-radius: 0;
  height: 10px;
  background: var(--pen-red);
}

.swatch.stamp-red {
  border-radius: 2px;
  background: none;
  border: 3px solid var(--pen-red);
}

.swatch.stamp-plain {
  border-radius: 2px;
}

.metrics {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px 16px;
  margin: 0;
}

.metrics dd {
  margin: 0;
  text-align: right;
  color: var(--chalk-yellow);
  font-weight: 700;
}

@keyframes write {
  0%,
  100% {
    transform: rotate(0deg);
  }

  30% {
    transform: rotate(7deg);
  }

  65% {
    transform: rotate(-4deg);
  }
}


@keyframes step {
  0%,
  100% {
    transform: translateY(0);
  }

  50% {
    transform: translateY(-9%);
  }
}

@keyframes alert-pop {
  from {
    transform: translateX(-50%) scale(0.3);
  }
}

@media (prefers-reduced-motion: reduce) {
  .arm.right,
  .proctor.walking .proctor-body,
  .proctor-alert {
    animation: none;
  }

  .head,
  .torso,
  .arm,
  .eye,
  .mouth,
  .stage,
  .window {
    transition: none;
  }
}

.actions.asleep {
  opacity: 0.45;
}

/* Idle actions are only fidgets, so their buttons stay small and quiet above the pranks. */
.actions.idle-actions {
  grid-template-columns: repeat(auto-fit, minmax(72px, 1fr));
  grid-template-rows: none;
  grid-auto-flow: row;
  gap: 6px;
}

.idle-actions .action {
  padding: 4px 2px;
  font-size: 13px;
  font-weight: 500;
  background: none;
  color: var(--chalk);
  border: 1px solid var(--chalk-dim);
}

.shop-where {
  color: var(--chalk-dim);
  font-size: 12px;
}

.install {
  gap: 6px 12px;
}

/* Choosing who: the seats next to the player light up, and the button waits for a tap on one. */
.floor.choosing .seat:not(.choosable) {
  opacity: 0.6;
}

.seat.choosable {
  z-index: 6;
  cursor: pointer;
  border-radius: 6px;
  outline: 3px dashed var(--chalk-yellow);
  outline-offset: 2px;
  background: rgb(242 214 102 / 0.28);
  animation: choosable 0.9s ease-in-out infinite alternate;
}

.action.choosing {
  background: var(--chalk-yellow);
  border-bottom-color: #b89a2c;
}

@keyframes choosable {
  to {
    outline-offset: 5px;
    background: rgb(242 214 102 / 0.5);
  }
}

/* The close-up: a comic panel over a dimmed room, the two people in it 2.4 times their size. */
.floor.has-closeup::after {
  content: '';
  position: absolute;
  inset: 0;
  z-index: 6;
  background: rgb(8 18 15 / 0.38);
  pointer-events: none;
}

.closeup {
  position: absolute;
  left: 50%;
  z-index: 7;
  width: 74%;
  transform: translateX(-50%) rotate(-1deg);
  background-color: #fbf6e4;
  background-image: radial-gradient(rgb(23 33 28 / 0.12) 1px, transparent 1.4px);
  background-size: 7px 7px;
  border: 4px solid #17211c;
  border-radius: 3px;
  box-shadow: 5px 6px 0 rgb(8 18 15 / 0.6);
  color: #17211c;
  overflow: hidden;
  animation: closeup-in 0.22s ease-out;
  transition: border-color 0.2s, opacity 0.35s;
}

.closeup.at-top {
  top: 3%;
}

.closeup.at-bottom {
  bottom: 3%;
}

.closeup.leaving {
  opacity: 0;
}

.closeup.caught {
  border-color: var(--pen-red);
  box-shadow: 5px 6px 0 rgb(120 20 10 / 0.7);
}

.closeup.escaped {
  border-color: #3fa564;
}

.closeup-scene {
  position: relative;
  display: flex;
  justify-content: center;
  align-items: end;
  gap: 4%;
  padding: 26% 4% 4%;
}

/* A loud act gets the comic's focus lines behind the pair. */
.closeup.loud .closeup-scene {
  background: repeating-conic-gradient(from 3deg at 50% 62%, rgb(23 33 28 / 0.2) 0 1.6deg, transparent 1.6deg 8deg);
}

.closeup .seat {
  position: relative;
  width: var(--closeup-seat);
  transform: none;
  transition: none;
  z-index: auto;
}

.closeup .you-tag {
  bottom: -18px;
  font-size: 13px;
}

.closeup .bubble {
  bottom: 104%;
  max-width: 190%;
  padding: 4px 10px;
  white-space: normal;
  width: max-content;
  text-align: center;
  font: 17px/1.15 var(--hand);
  background: #fff;
  border: 2px solid #17211c;
  border-radius: 14px;
}

.closeup .bubble::after {
  content: '';
  position: absolute;
  left: calc(50% - 6px);
  top: 100%;
  border: 7px solid transparent;
  border-top-color: #17211c;
}

.closeup-foot:empty {
  display: none;
}

.closeup-foot {
  display: grid;
  gap: 6px;
  padding: 8px 10px 10px;
  border-top: 3px solid #17211c;
  background: #fff;
}

.closeup-foot .row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.ask-who {
  font-size: 13px;
}

.ask-time {
  height: 4px;
  background: var(--pen-red);
  transform-origin: left;
  animation: ask-time var(--answer-ms, 5s) linear forwards;
}

/* Caught: the proctor's head slides in from the edge, scolding. */
.closeup-watcher {
  position: absolute;
  right: 0;
  top: 8%;
  display: flex;
  align-items: center;
  gap: 6px;
  flex-direction: row-reverse;
  animation: watcher-in 0.3s ease-out both;
}

.closeup-watcher.from-left {
  left: 0;
  right: auto;
  flex-direction: row;
  animation-name: watcher-in-left;
}

.closeup-watcher-head {
  width: 54px;
  aspect-ratio: 1;
  margin-inline: -14px;
  border-radius: 50%;
  background: var(--pen-red);
  border: 3px solid #17211c;
  background-image: radial-gradient(circle at 34% 44%, #17211c 5px, transparent 6px), radial-gradient(circle at 66% 44%, #17211c 5px, transparent 6px),
    linear-gradient(transparent 70%, #17211c 70% 76%, transparent 76%);
}

.closeup-scold {
  white-space: nowrap;
  font: 700 15px/1.2 var(--body);
  color: #fff;
  background: var(--pen-red);
  border: 2px solid #17211c;
  border-radius: 10px;
  padding: 3px 8px;
}

/* Escaped: hearts, or a giggle, float up out of the panel. */
.closeup-mark {
  position: absolute;
  bottom: 30%;
  font: 700 22px/1 var(--hand);
  color: #c2366b;
  animation: mark-up 1.4s ease-out both;
}

@keyframes closeup-in {
  from {
    transform: translateX(-50%) rotate(-1deg) scale(0.6);
    opacity: 0;
  }
}

@keyframes watcher-in {
  from {
    transform: translateX(110%);
  }
}

@keyframes watcher-in-left {
  from {
    transform: translateX(-110%);
  }
}

@keyframes mark-up {
  from {
    transform: translateY(20px) scale(0.6);
    opacity: 0;
  }

  30% {
    opacity: 1;
  }

  to {
    transform: translateY(-70px) scale(1.2);
    opacity: 0;
  }
}

@keyframes ask-time {
  to {
    transform: scaleX(0);
  }
}

@media (prefers-reduced-motion: reduce) {
  .seat.choosable,
  .closeup,
  .closeup-watcher,
  .closeup-mark,
  .ask-time {
    animation: none;
  }
}

.closeup-foot .ghost {
  color: #17211c;
  border: 2px solid #17211c;
}

.closeup-foot .primary {
  border: 2px solid #17211c;
}

/* An ask with no panel to sit under waits in the side panel instead. */
.ask-dock {
  display: grid;
  gap: 6px;
  padding: 10px;
  background: var(--paper);
  color: #17211c;
}

/* A plea: one person and the proctor's head answering from the side they face, with a gold edge. */
.closeup.alone.faces-left .closeup-scene {
  justify-content: flex-end;
  padding-right: 14%;
}

.closeup.alone.faces-right .closeup-scene {
  justify-content: flex-start;
  padding-left: 14%;
}

.closeup.plea {
  border-color: var(--chalk-yellow);
  box-shadow: 5px 6px 0 rgb(120 96 20 / 0.7);
}

.closeup.plea .closeup-watcher {
  top: 14%;
  max-width: 62%;
}

.closeup.plea .closeup-watcher-head {
  width: 70px;
  margin-inline: 6px;
  background-color: #c9b07a;
}

.closeup-reply {
  font: 18px/1.15 var(--hand);
  color: #17211c;
  background: #fff;
  border: 2px solid #17211c;
  border-radius: 14px;
  padding: 4px 10px;
}

.closeup.plea.granted .closeup-reply {
  background: #fdf3c4;
}

.friends select {
  width: 100%;
  background: var(--board);
  color: var(--chalk);
  border: 1px solid var(--chalk-dim);
  border-radius: 4px;
  padding: 10px;
  font: inherit;
}

.hint[data-tone='warn'] {
  color: var(--pen-red);
}

/* The key dialog says plainly what a lost key means. */
.key-warning {
  border-left: 4px solid var(--pen-red);
  padding: 6px 10px;
  background: rgb(226 83 58 / 0.12);
}

.suggest-count {
  justify-self: end;
}

/* Bundles: the items inside as a row of swatches, the bundle price, and the price one by one struck out. */
.shop li.bundle {
  align-items: flex-start;
}

.bundle-swatches {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  max-width: 140px;
}

.bundle .shop-name {
  display: grid;
  gap: 2px;
}

.bundle-blurb {
  color: var(--chalk-dim);
}

.bundle-price b {
  color: var(--chalk-yellow);
}

.bundle-price s {
  color: var(--chalk-dim);
  font-size: 13px;
}

.shop-owned {
  padding: 10px 14px;
  color: var(--ok);
  font-weight: 600;
}
