/* Toy scenes are opt-in: teaching colours on the other game boards stay intact. */
#canvasContainerArena[data-scene='toy'] {
  color: var(--focus-ink);
  background: radial-gradient(ellipse at 50% 100%, #dcead5, transparent 65%),
    linear-gradient(135deg, #f9f6e9, #edf5ee);
  border-color: #c6d9c6;
  box-shadow: inset 0 0 0 6px #ffffff50;
}
#introIcon {
  display: grid;
  place-items: center;
}
#introIcon .focus-art {
  width: clamp(112px, 20vh, 164px);
  height: clamp(112px, 20vh, 164px);
}
.focus-play-scene {
  width: 100%;
  max-width: 720px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: clamp(6px, calc(var(--play-height, 500px) * 0.02), 18px);
  padding: 8px;
}
.play-scene-heading {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
}
.play-scene-heading h3 {
  font-size: clamp(21px, 3vw, 30px);
  line-height: 1.15;
  font-weight: 600;
}
.play-scene-heading img {
  width: 64px;
  height: 64px;
  object-fit: contain;
}
.play-scene-status {
  min-height: 2.8em;
  max-width: 44ch;
  font-size: clamp(14px, 2vw, 17px);
  line-height: 1.4;
  color: #355e52;
}
.balance-stage {
  position: relative;
  width: 100%;
  height: clamp(220px, calc(var(--play-height, 500px) - 164px), 340px);
  --balance-angle: 0deg;
  --balance-counter: 0deg;
}
.balance-stage::before {
  content: '';
  position: absolute;
  left: 18%;
  right: 18%;
  bottom: 0;
  height: 22px;
  border-radius: 50%;
  background: #42674418;
}
.balance-stand {
  position: absolute;
  width: 76px;
  height: 34%;
  bottom: 8%;
  left: calc(50% - 38px);
  background: linear-gradient(90deg, #72a48b, #adcdb4 50%, #72a48b);
  clip-path: polygon(
    40% 0,
    60% 0,
    88% 85%,
    100% 85%,
    100% 100%,
    0 100%,
    0 85%,
    12% 85%
  );
  border-radius: 16px;
}
.balance-assembly {
  position: absolute;
  inset: 0 0 40%;
  transform-origin: 50% 100%;
  transform: rotate(var(--balance-angle));
  transition: transform 650ms cubic-bezier(0.22, 0.8, 0.3, 1);
}
.balance-beam {
  position: absolute;
  left: 23%;
  right: 23%;
  bottom: -8px;
  height: 16px;
  border-radius: 12px;
  background: linear-gradient(#eec874, #d49c42);
  box-shadow: 0 3px 0 #96703b;
}
.balance-pin {
  position: absolute;
  bottom: calc(40% - 14px);
  left: calc(50% - 14px);
  width: 28px;
  height: 28px;
  background: #fff9e9;
  border: 6px solid #527b65;
  border-radius: 50%;
  z-index: 2;
}
.balance-tray {
  position: absolute;
  bottom: 0;
  width: 40%;
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  align-items: center;
  transform: rotate(var(--balance-counter));
  transform-origin: 50% 100%;
  transition: transform 650ms cubic-bezier(0.22, 0.8, 0.3, 1);
}
.balance-tray:first-child {
  left: 3%;
}
.balance-tray:nth-child(2) {
  right: 3%;
}
.balance-choice {
  width: 100%;
  height: calc(100% - 14px);
  min-height: 108px;
  background: #fffdf5;
  border: 2px solid #d0decc;
  border-radius: 26px 26px 14px 14px;
  box-shadow: 0 5px 0 #bbcbb5;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
}
.balance-choice:hover:not(:disabled) {
  border-color: #527b65;
}
.balance-choice:focus-visible {
  outline-offset: -6px;
}
.balance-choice[aria-pressed='true'] {
  border-color: #287652;
  background: #e9f5e4;
}
.balance-choice:disabled {
  cursor: default;
  opacity: 1;
}
.balance-side-label {
  color: #526d60;
  font-size: 12px;
}
.balance-number {
  color: #28584b;
  font-size: clamp(42px, 7vw, 72px);
  line-height: 1;
  font-weight: 600;
}
.balance-dots {
  width: 116px;
  max-width: 100%;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-content: center;
  gap: 5px;
}
.balance-dot {
  width: 17px;
  height: 17px;
  flex: 0 0 17px;
  border-radius: 50%;
  background: #315f52;
  box-shadow: inset 0 2px 0 #ffffff40;
}
.balance-pan {
  width: 108%;
  height: 18px;
  flex-shrink: 0;
  border-radius: 4px 4px 24px 24px;
  background: linear-gradient(#c98557, #a66a41);
  box-shadow: 0 3px 0 #815238;
  position: relative;
}
.road-scene {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px 16px;
  align-items: center;
}
.road-scene-top {
  grid-column: 1 / -1;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: clamp(16px, 4vw, 48px);
}
.road-signal {
  position: relative;
  width: clamp(84px, calc(var(--play-height, 500px) * 0.24), 164px);
  flex-shrink: 0;
}
.road-signal img {
  width: 100%;
  height: auto;
}
.road-lens {
  position: absolute;
  left: 43%;
  width: 14%;
  height: 13%;
  border-radius: 50%;
  background: #15252fe8;
}
.road-lens-red {
  top: 18%;
}
.road-lens-amber {
  top: 34%;
}
.road-lens-green {
  top: 50%;
}
.road-scene[data-signal='red'] .road-lens-red,
.road-scene[data-signal='green'] .road-lens-green {
  background: transparent;
  box-shadow: 0 0 0 2px #fff6;
}
.road-signal-copy {
  text-align: left;
}
.road-signal-copy h3 {
  font-size: clamp(22px, 3vw, 32px);
  font-weight: 600;
  line-height: 1.2;
}
.road-signal-copy p {
  color: #526d60;
  margin-top: 8px;
  font-size: 14px;
}
.road-cue {
  display: inline-grid;
  place-items: center;
  width: 40px;
  height: 40px;
  margin-bottom: 8px;
  border-radius: 12px;
  background: #ebd8cb;
  color: #733e31;
  font-weight: 600;
}
.road-scene[data-signal='green'] .road-cue {
  background: #d2e9cd;
  color: #23573b;
}
.toy-road {
  grid-column: 1 / -1;
  position: relative;
  width: 100%;
  height: clamp(100px, calc(var(--play-height, 500px) * 0.27), 156px);
  background: linear-gradient(#dcebc8 0 26%, #94a9a0 26% 85%, #dcebc8 85%);
  border: 1px solid #c1d3b8;
  border-radius: 24px;
  overflow: hidden;
}
.toy-road::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  top: 62%;
  height: 4px;
  background: repeating-linear-gradient(
    90deg,
    transparent 0 18px,
    #fffa 18px 46px,
    transparent 46px 74px
  );
}
.road-tree {
  position: absolute;
  right: 8%;
  top: -12%;
  width: 80px;
  height: 80px;
  object-fit: contain;
}
.road-car-track {
  position: absolute;
  left: 4%;
  right: calc(10% + clamp(104px, 20vw, 150px));
  bottom: 15%;
  height: 70%;
  z-index: 1;
}
.road-car {
  position: absolute;
  left: var(--road-progress, 0%);
  bottom: 0;
  width: clamp(104px, 20vw, 150px);
  height: auto;
  aspect-ratio: 3 / 2;
  object-fit: contain;
  /* Account for the transparent margin below the wheels, without mirroring. */
  transform: translateY(14%);
  transition: left 300ms ease-out;
}
.road-finish {
  position: absolute;
  right: 6%;
  bottom: 18%;
  width: 28px;
  height: 58px;
  z-index: 1;
  border-left: 3px solid #335c50;
}
.road-finish::before {
  content: '';
  display: block;
  width: 27px;
  height: 24px;
  background: conic-gradient(
    #f9f7e9 25%,
    #335c50 0 50%,
    #f9f7e9 0 75%,
    #335c50 0
  );
  background-size: 12px 12px;
}
.road-drive {
  min-height: 58px;
  width: min(100%, 360px);
  padding: 12px 24px;
  border-radius: 18px;
  background: #286754;
  color: white;
  font-size: 21px;
  font-weight: 600;
  border: 2px solid #1c5041;
  box-shadow: 0 4px 0 #1c5041;
  cursor: pointer;
}
.road-drive:active {
  box-shadow: none;
  transform: translateY(3px);
}
.road-drive:disabled {
  opacity: 0.7;
  cursor: default;
}
.road-distance {
  color: #355e52;
  font-size: 15px;
}
.road-scene .play-scene-status {
  grid-column: 1 / -1;
  justify-self: center;
}
.memory-scene {
  max-width: 620px;
}
.memory-board {
  width: min(
    100%,
    calc((var(--play-height, 500px) - 90px) / var(--memory-rows, 4) * 4)
  );
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: clamp(8px, 1.5vw, 14px);
}
.memory-scene .memory-card {
  position: relative;
  aspect-ratio: 1;
  min-height: 56px;
  width: 100%;
  padding: 6px;
  display: grid;
  place-items: center;
  border-radius: clamp(14px, 2vw, 24px);
  border: 2px solid #c0d5c6;
  color: #315f52;
  background: linear-gradient(140deg, #eff7e9, #dcebd7);
  box-shadow: 0 4px 0 #bacdb8;
  cursor: pointer;
}
.memory-card::before {
  content: '';
  position: absolute;
  inset: 6px;
  border: 1px dashed #779b7755;
  border-radius: inherit;
  pointer-events: none;
}
.memory-scene .memory-card[data-face='shown'] {
  background: #fffdf7;
  border-color: #8daec0;
  animation: picture-reveal 240ms ease-out;
}
.memory-scene .memory-card.matched {
  background: #e9f4dd;
  border-color: #719858;
  cursor: default;
  box-shadow: 0 4px 0 #a6c093;
}
.memory-card.matched::after {
  content: '\2713';
  position: absolute;
  right: 8px;
  top: 4px;
  color: #315f36;
  font-size: 18px;
}
.memory-card img {
  width: 88% !important;
  height: 88% !important;
  max-height: 104px;
  object-fit: contain;
}
.memory-card .memory-card-back {
  width: 44% !important;
  height: 44% !important;
  opacity: 0.78;
}
@keyframes picture-reveal {
  from {
    transform: perspective(500px) rotateY(-18deg);
  }
  to {
    transform: perspective(500px) rotateY(0);
  }
}
@media (max-width: 760px) {
  body.in-game > header,
  body.in-game > footer {
    display: none;
  }
  body.in-game .hud-compact-only {
    display: flex;
  }
  body.in-game .hud-roomy-only {
    display: none !important;
  }
}
@media (max-width: 760px) and (orientation: portrait) {
  body.in-game #arenaHud > div:first-child {
    flex-basis: 100%;
  }
  body.in-game #activeGameDesc {
    display: block;
    -webkit-line-clamp: unset;
  }
}
@media (max-width: 450px) {
  .focus-play-scene {
    padding: 2px;
  }
  .play-scene-heading img {
    width: 48px;
    height: 48px;
  }
  .balance-dots {
    gap: 4px;
    width: 100px;
  }
  .balance-dot {
    width: 14px;
    height: 14px;
    flex-basis: 14px;
  }
  .balance-choice {
    padding: 8px;
    border-radius: 20px 20px 10px 10px;
  }
  .balance-stage {
    height: clamp(220px, calc(var(--play-height, 500px) - 112px), 340px);
  }
  .road-scene-top {
    gap: 10px;
  }
  .road-tree {
    width: 64px;
    height: 64px;
  }
  .memory-board {
    gap: 8px;
  }
}
@media (max-height: 540px) and (orientation: landscape) {
  .focus-play-scene {
    gap: 6px;
    padding: 0;
  }
  #introIcon .focus-art {
    width: 80px;
    height: 80px;
  }
  .play-scene-heading img {
    width: 40px;
    height: 40px;
  }
  .play-scene-heading h3 {
    font-size: 20px;
  }
  .balance-stage {
    height: clamp(180px, calc(var(--play-height, 300px) - 84px), 240px);
  }
  .balance-choice {
    min-height: 100px;
  }
  .balance-number {
    font-size: 44px;
  }
  .play-scene-status {
    font-size: 13px;
    min-height: 1.4em;
  }
  .road-scene {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px 12px;
    align-items: center;
  }
  .road-scene-top {
    grid-column: 1 / -1;
  }
  .road-signal {
    width: 84px;
  }
  .road-cue {
    width: 28px;
    height: 28px;
    font-size: 13px;
    margin-bottom: 4px;
  }
  .road-signal-copy h3 {
    font-size: 20px;
  }
  .road-signal-copy p {
    margin-top: 4px;
  }
  .toy-road {
    grid-column: 1 / -1;
    height: 98px;
  }
  .road-drive {
    min-height: 48px;
    font-size: 17px;
  }
  .road-scene .play-scene-status {
    grid-column: 1 / -1;
  }
  .memory-scene {
    max-width: 440px;
  }
  .memory-board {
    width: min(
      100%,
      290px,
      calc((var(--play-height, 300px) - 68px) / var(--memory-rows, 4) * 4)
    );
    gap: 6px;
  }
}
@media (prefers-reduced-motion: reduce) {
  .balance-assembly,
  .balance-tray,
  .road-car,
  .memory-card {
    transition: none !important;
    animation: none !important;
  }
}
body[data-gentle='true'] .balance-assembly,
body[data-gentle='true'] .balance-tray,
body[data-gentle='true'] .road-car,
body[data-gentle='true'] .memory-card {
  transition: none !important;
  animation: none !important;
}
