@import url("/css/fable.css?v=1");
@font-face {
  font-family: "Fredoka";
  src: url("/fonts/fredoka-latin-wght-normal.woff2") format("woff2");
  font-weight: 300 700;
  font-display: swap;
}
/* A workbench and a playroom: navy ink, paper cards, the yellow and black of the glue tube. */
:root {
  --ink: #1c2340;
  --paper: #fffaf0;
  --red: #ff5a4d;
  --yellow: #ffd23b;
  --steel: #7f9fbd;
  --f-bg: #f1e0bb;
  --f-ink: var(--ink);
  --f-soft: rgba(28, 35, 64, 0.8);
  --f-line: rgba(28, 35, 64, 0.25);
  --f-surface: var(--paper);
  --f-accent: var(--yellow);
  --f-on-accent: var(--ink);
  --f-warn: #b3002d;
  --f-display: "Fredoka", "Trebuchet MS", system-ui, sans-serif;
  --f-body: "Fredoka", "Trebuchet MS", system-ui, sans-serif;
}
body {
  overflow: hidden;
  overscroll-behavior: none;
  font-weight: 500;
  font-size: 18px;
}
.game {
  position: fixed;
  inset: 0;
  overflow: hidden;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}
#scene {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  touch-action: none;
}
.bar {
  position: absolute;
  inset: 0 0 auto;
  display: flex;
  align-items: center;
  padding: max(10px, env(safe-area-inset-top)) 14px 10px;
  z-index: 5;
}
.game[data-state="play"] .bar,
.game[data-state="play"] .credit {
  display: none;
}
.bar nav {
  margin-left: auto;
  display: flex;
  gap: 8px;
}
.chip {
  border: 3px solid var(--ink);
  background: var(--paper);
  font-weight: 600;
  min-height: 44px;
}
.chip.icon {
  width: 44px;
}
.start,
.card {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: min(600px, calc(100vw - 20px));
  max-height: calc(100dvh - 84px);
  overflow: auto;
  padding: clamp(16px, 3vw, 26px);
  border: 4px solid var(--ink);
  border-radius: 28px;
  background: var(--paper);
  box-shadow: 0 8px 0 var(--ink);
  z-index: 4;
}
.start {
  top: calc(50% + 24px);
}
/* The best runs: at the foot of the start card, and beside it where the screen is wide enough.
   The list is the site's (js/rankings/shortlist.js); here is only where it stands and how many
   rows it has room for. */
.shortlist {
  width: min(360px, 100%);
  margin: 16px auto 2px;
  --rows: 5;
}
@media (max-width: 560px), (max-height: 700px) {
  .shortlist {
    --rows: 3;
  }
}
@media (min-width: 561px) and (min-height: 521px) {
  .start {
    max-height: calc(100dvh - 112px);
  }
}
@media (min-width: 1240px) and (min-height: 620px) {
  .start {
    overflow: visible;
  }
  .shortlist {
    position: absolute;
    left: calc(100% + 28px);
    top: 50%;
    transform: translateY(-50%);
    width: min(280px, calc(50vw - 352px));
    margin: 0;
    --rows: 10;
  }
}
#title {
  margin: 0;
  font: 700 clamp(38px, 9vw, 66px) / 0.95 var(--f-display);
  letter-spacing: -0.01em;
}
/* The last word is glued on a little crooked. */
#title span {
  display: inline-block;
  color: var(--red);
  rotate: -5deg;
  translate: 0 0.06em;
}
.by {
  margin: 10px 0 0;
  color: var(--f-soft);
  text-wrap: pretty;
}
.how {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin: 14px 0 0;
  padding: 0;
  list-style: none;
}
.how li {
  display: grid;
  justify-items: center;
  gap: 2px;
  padding: 8px 4px;
  border: 3px solid var(--f-line);
  border-radius: 16px;
  background: #fff;
  font-size: 14px;
  font-weight: 600;
  line-height: 1.15;
  text-align: center;
}
.how li:last-child {
  border-color: var(--ink);
  background: var(--yellow);
}
.how canvas {
  width: 100%;
  max-width: 110px;
  aspect-ratio: 11 / 9;
}
.helper {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 14px;
  font-size: 16px;
  line-height: 1.25;
}
.helper input {
  flex: none;
  width: 26px;
  height: 26px;
  accent-color: var(--steel);
}
.alias {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-top: 12px;
  font-size: 16px;
}
.alias button {
  min-height: 46px;
  padding: 0 14px;
  border: 3px solid var(--ink);
  border-radius: 14px;
  background: #fff;
  color: var(--ink);
  font: inherit;
  font-weight: 600;
  text-align: left;
}
dialog {
  background: var(--paper);
  border: 4px solid var(--ink);
}
.tabs {
  background: rgba(28, 35, 64, 0.1);
}
.go-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 14px;
}
.primary {
  flex: 2 1 220px;
  min-height: 60px;
  border: 4px solid var(--ink);
  border-radius: 18px;
  box-shadow: 0 5px 0 var(--ink);
  font: 700 22px var(--f-display);
}
.primary:active {
  translate: 0 3px;
  box-shadow: 0 2px 0 var(--ink);
}
.ghost {
  flex: 1 1 120px;
  min-height: 60px;
  border: 4px solid var(--ink);
  border-radius: 18px;
  background: #fff;
  color: var(--ink);
  font: 600 19px var(--f-display);
}
.fine {
  margin: 12px 0 0;
  font-size: 15px;
  line-height: 1.35;
  color: var(--f-soft);
  text-wrap: pretty;
}

/* While playing: points, the three rides, and the way out. Nothing here has to be read. */
.hud {
  position: absolute;
  inset: max(8px, env(safe-area-inset-top)) 10px auto;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 10px;
  align-items: center;
  z-index: 3;
  pointer-events: none;
}
.hud .chip {
  justify-self: end;
  pointer-events: auto;
  min-height: 40px;
  width: 40px;
}
.tally {
  justify-self: start;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 1px 12px 2px 8px;
  border: 3px solid var(--ink);
  border-radius: 99px;
  background: var(--paper);
  line-height: 1;
}
.tally span {
  color: #f2ae00;
  font-size: 22px;
  -webkit-text-stroke: 1px var(--ink);
}
.tally strong {
  font: 700 22px/1.5 var(--f-display);
  font-variant-numeric: tabular-nums;
}
.tally em {
  margin-left: 2px;
  padding: 0 7px;
  border-radius: 99px;
  background: var(--red);
  color: #fff;
  font: 700 17px/1.4 var(--f-display);
  font-style: normal;
}
.tally em.pop {
  animation: pop 0.35s cubic-bezier(0.2, 1.6, 0.4, 1);
}
@keyframes pop {
  from {
    scale: 0.4;
  }
}
.rides {
  display: flex;
  gap: 6px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.rides li {
  display: flex;
  gap: 2px;
  padding: 5px 7px;
  border: 3px solid var(--ink);
  border-radius: 99px;
  background: var(--paper);
  opacity: 0.55;
}
.rides li.now,
.rides li.done {
  opacity: 1;
}
.rides li.now {
  background: var(--yellow);
}
.rides i,
.stars span {
  display: block;
  width: 13px;
  aspect-ratio: 1;
  background: rgba(28, 35, 64, 0.22);
  clip-path: polygon(50% 0, 61% 35%, 98% 35%, 68% 57%, 79% 91%, 50% 70%, 21% 91%, 32% 57%, 2% 35%, 39% 35%);
}
.rides i.on {
  background: #f2ae00;
}
.way {
  position: absolute;
  inset: auto 0 0;
  height: max(8px, env(safe-area-inset-bottom));
  background: rgba(28, 35, 64, 0.2);
  z-index: 3;
  pointer-events: none;
}
.way i {
  display: block;
  height: 100%;
  transform-origin: left;
  transform: scaleX(0);
  background: var(--red);
}
/* The glowing spots are drawn on the canvas; these lie over them so that they can be reached with a keyboard too. */
.spots {
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
}
.spot {
  position: absolute;
  translate: -50% -50%;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  pointer-events: auto;
  touch-action: none;
  -webkit-tap-highlight-color: transparent;
}
.spot:focus-visible {
  outline: 4px solid var(--ink);
  outline-offset: 4px;
}

/* After the proper fix */
.card {
  text-align: center;
}
.card h2 {
  margin: 0;
  font: 700 clamp(34px, 8vw, 54px) / 1 var(--f-display);
}
.built {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin: 12px 0 0;
  padding: 0;
  list-style: none;
}
.built li {
  display: grid;
  justify-items: center;
  padding: 6px 4px 8px;
  border: 3px solid var(--f-line);
  border-radius: 16px;
  background: #fff;
}
.built canvas {
  width: 100%;
  max-width: 120px;
  aspect-ratio: 5 / 4;
}
.stars {
  display: flex;
  justify-content: center;
  gap: 3px;
  margin: 2px 0 0;
  font-size: 0;
}
.stars span {
  width: 24px;
  background: #f2ae00;
}
.stars .off {
  background: rgba(28, 35, 64, 0.18);
}
.final {
  margin: 10px 0 0;
  font-size: 20px;
}
.final strong {
  font: 700 clamp(40px, 9vw, 58px) / 1 var(--f-display);
  font-variant-numeric: tabular-nums;
}
.detail {
  margin: 4px 0 0;
  color: var(--f-soft);
}
.card .status {
  margin: 8px 0 0;
  min-height: 1.4em;
  font-size: 15px;
}
.card .go-row {
  justify-content: center;
}
.credit {
  position: absolute;
  inset: auto 0 max(8px, env(safe-area-inset-bottom));
  margin: 0;
  text-align: center;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
  opacity: 0.75;
  pointer-events: none;
  z-index: 3;
}
/* The run that plays itself is footage: no cursor, and with ?bare nothing but the picture. */
.game.demo[data-state="play"] {
  cursor: none;
}
.game.bare .hud,
.game.bare .way,
.game.bare .credit {
  display: none;
}

@media (max-width: 560px) {
  body {
    font-size: 16px;
  }
  .start {
    top: calc(50% + 22px);
    max-height: calc(100dvh - 76px);
  }
  .how li {
    font-size: 12.5px;
  }
  .helper,
  .fine {
    font-size: 14px;
  }
  .tally strong {
    font-size: 19px;
  }
  .rides i {
    width: 10px;
  }
  .rides li {
    padding: 4px 5px;
  }
}
/* A phone on its side: the card in two columns, so nothing needs scrolling. */
@media (max-height: 520px) and (min-width: 620px) {
  .start {
    display: grid;
    grid-template-columns: 1.15fr 1fr;
    gap: 0 22px;
    align-items: center;
    width: min(860px, calc(100vw - 20px));
    top: calc(50% + 22px);
    max-height: calc(100dvh - 64px);
    padding: 12px 18px;
  }
  #title {
    font-size: clamp(30px, 9vh, 44px);
  }
  .by {
    margin-top: 4px;
    font-size: 15px;
  }
  .how {
    margin-top: 8px;
  }
  .how li {
    padding: 4px;
    font-size: 12px;
  }
  .how canvas {
    max-width: 70px;
  }
  .helper {
    margin-top: 0;
    font-size: 14px;
  }
  .go-row {
    margin-top: 8px;
  }
  .primary,
  .ghost {
    min-height: 50px;
  }
  .fine {
    margin-top: 8px;
    font-size: 13px;
  }
  .shortlist {
    grid-column: 1 / -1;
    margin-top: 10px;
  }
  .credit {
    display: none;
  }
  #finish:not([hidden]) {
    display: grid;
    grid-template-columns: 1.2fr 1fr;
    grid-template-areas: "title final" "built detail" "built status" "built buttons";
    gap: 2px 20px;
    align-items: center;
    width: min(760px, calc(100vw - 20px));
    max-height: calc(100dvh - 24px);
    padding: 12px 18px;
  }
  #finish h2 {
    grid-area: title;
    font-size: 34px;
  }
  .built {
    grid-area: built;
    margin-top: 4px;
  }
  .built canvas {
    max-width: 84px;
  }
  .final {
    grid-area: final;
    margin: 0;
  }
  .final strong {
    font-size: 40px;
  }
  .detail {
    grid-area: detail;
    font-size: 15px;
  }
  #save-status {
    grid-area: status;
  }
  #finish .go-row {
    grid-area: buttons;
    margin-top: 4px;
  }
}
@media (prefers-reduced-motion: reduce) {
  .tally em.pop {
    animation: none;
  }
}
