:root {
  --rail-blue: #244d68;
  --snow: #f7fbf4;
  --pine: #236451;
  --gold: #f3bd4f;
  --ink: #173342;
}
html,
body {
  height: 100%;
  overflow: hidden;
  overscroll-behavior: none;
  background: #244d68;
}
body.whistle-day {
  color: var(--ink);
  background: linear-gradient(#79c8dc 0 48%, #315f57 48%);
  touch-action: manipulation;
}
.whistle-day .game-shell {
  height: 100dvh;
  min-height: 0;
  padding: max(7px, env(safe-area-inset-top))
    max(8px, env(safe-area-inset-right)) max(7px, env(safe-area-inset-bottom))
    max(8px, env(safe-area-inset-left));
  display: grid;
  grid-template-rows: 50px auto minmax(180px, 1fr) auto;
  gap: 6px;
  max-width: 760px;
  background: transparent;
}
.whistle-day header {
  padding: 0;
  min-height: 50px;
}
.whistle-day .brand {
  color: white;
}
.whistle-day .brand small {
  color: #fff0a8;
}
.whistle-day .round-button {
  width: 46px;
  height: 46px;
  min-height: 46px;
  background: #fffdf0;
  color: var(--rail-blue);
  border-color: white;
}
.whistle-day .mission-card {
  margin: 0;
  min-height: 72px;
  padding: 7px 12px;
  background: #fffdf2f7;
  border: 2px solid var(--rail-blue);
  color: var(--ink);
}
.whistle-day .mission-card > div:first-child {
  display: flex;
  justify-content: space-between;
}
.whistle-day .mission-card p {
  margin: 4px 0;
  font-size: 13px;
  line-height: 1.15;
}
.whistle-day .progress-track {
  height: 7px;
  margin: 4px 0 0;
}
.whistle-day .progress-track i {
  background: linear-gradient(90deg, #f3bd4f, #e66f55);
}
#stage {
  position: relative;
  min-height: 0;
  height: auto;
  overflow: hidden;
  border: 2px solid white;
  border-radius: 22px;
  background: linear-gradient(#7bc8dd 0 66%, #e9f3e7 66%);
  box-shadow: 0 8px 18px #17334266;
  isolation: isolate;
}
#stage canvas {
  position: absolute;
  inset: 0;
  z-index: 0;
  width: 100% !important;
  height: 100% !important;
  pointer-events: none;
}
.scene-caption {
  position: absolute;
  z-index: 4;
  top: 7px;
  left: 50%;
  transform: translateX(-50%);
  padding: 4px 9px;
  border-radius: 999px;
  background: #244d68dd;
  color: white;
  white-space: nowrap;
  font-size: 9px;
  letter-spacing: 0.12em;
}
#car-targets {
  display: contents;
}
.car-button {
  position: absolute;
  z-index: 5;
  top: 57%;
  transform: translate(-50%, -50%);
  width: 46px;
  height: 58px;
  min-height: 58px;
  padding: 2px;
  border: 3px solid #fff;
  border-radius: 13px;
  color: white;
  font:
    900 11px/1 Nunito,
    sans-serif;
  text-shadow: 0 1px 2px #0008;
  box-shadow:
    0 4px 0 #183d4d,
    0 0 0 2px #244d6855;
  touch-action: manipulation;
}
.car-button span {
  display: block;
  font-size: 19px;
  line-height: 20px;
}
.car-button.selected {
  outline: 5px solid #ffe36e;
  outline-offset: 2px;
  transform: translate(-50%, -50%) scale(1.05);
}
.car-button.hinted {
  animation: signal 0.7s ease-in-out infinite alternate;
}
.car-button:active {
  transform: translate(-50%, -50%) scale(0.96);
}
@keyframes signal {
  to {
    box-shadow:
      0 4px 0 #183d4d,
      0 0 18px 7px #fff087;
    filter: brightness(1.15);
  }
}
.track-labels {
  position: absolute;
  z-index: 3;
  left: 5%;
  right: 5%;
  bottom: 6px;
  display: flex;
  justify-content: space-between;
  color: #173342;
  font-size: 9px;
  font-weight: 900;
  letter-spacing: 0.08em;
}
#loading {
  position: absolute;
  inset: 0;
  z-index: 8;
  display: grid;
  place-items: center;
  background: #244d68;
  color: white;
  font-weight: 900;
}
.dispatch-board {
  margin: 0;
  padding: 7px 8px;
  border: 2px solid var(--rail-blue);
  border-radius: 17px;
  background: #fffdf2f7;
  color: var(--ink);
  display: grid;
  gap: 6px;
}
#clues {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 4px;
}
.clue {
  min-height: 25px;
  display: flex;
  align-items: center;
  padding: 4px 7px;
  border-radius: 8px;
  background: #e8f3ee;
  border: 1px solid #76a99b;
  font-size: 10px;
  font-weight: 900;
  line-height: 1.05;
}
.board-actions {
  display: flex;
  justify-content: center;
  gap: 5px;
}
.whistle-day #hint,
.whistle-day #undo,
.whistle-day #check,
.whistle-day #restart {
  min-height: 44px;
  padding: 6px 8px;
}
.whistle-day #hint,
.whistle-day #undo {
  min-width: 65px;
}
.whistle-day #check {
  flex: 1;
  max-width: 190px;
  margin: 0;
  background: linear-gradient(135deg, #e76f51, #bd493f);
}
.whistle-day #restart {
  min-width: 44px;
}
.whistle-day .intro-card {
  border-color: var(--rail-blue);
  background: #fffdf2;
}
.whistle-day .primary {
  background: linear-gradient(135deg, #2b7591, #244d68);
}
.whistle-day .eyebrow {
  color: #2b7591;
}
.whistle-day button:focus-visible,
.whistle-day a:focus-visible {
  outline: 4px solid #ffe36e;
  outline-offset: 2px;
}
body.stage-complete #stage {
  box-shadow:
    0 0 0 4px #ffe36e,
    0 0 30px #fff39b;
}
@media (prefers-reduced-motion: reduce) {
  .car-button {
    animation: none !important;
    transition: none !important;
  }
}
@media (max-width: 360px) {
  .whistle-day .brand small {
    display: none;
  }
  .whistle-day .mission-card p {
    font-size: 11px;
  }
  .clue {
    font-size: 9px;
    padding: 3px 5px;
  }
  .whistle-day #hint,
  .whistle-day #undo {
    min-width: 58px;
    font-size: 10px;
  }
  .whistle-day #check {
    font-size: 10px;
  }
  .dispatch-board {
    padding: 5px;
    gap: 4px;
  }
}
@media (max-height: 620px) and (orientation: portrait) {
  .whistle-day .game-shell {
    grid-template-rows: 46px 69px minmax(164px, 1fr) auto;
    gap: 4px;
  }
  .whistle-day header {
    min-height: 46px;
  }
  .whistle-day .round-button {
    width: 44px;
    height: 44px;
    min-height: 44px;
  }
  .whistle-day .mission-card {
    min-height: 0;
    padding: 4px 10px;
  }
  .dispatch-board {
    padding: 4px 6px;
  }
  .clue {
    min-height: 21px;
  }
  .car-button {
    top: 59%;
    height: 52px;
    min-height: 52px;
  }
}
@media (orientation: landscape) and (max-height: 500px) {
  .whistle-day .game-shell {
    max-width: 940px;
    grid-template-columns: 180px minmax(0, 1fr) 250px;
    grid-template-rows: 48px minmax(240px, 1fr);
    gap: 6px;
  }
  .whistle-day header {
    grid-column: 1/4;
  }
  .whistle-day .mission-card {
    grid-column: 1;
    grid-row: 2;
    align-self: stretch;
    display: flex;
    flex-direction: column;
    justify-content: center;
    width: auto;
  }
  .whistle-day .mission-card > div:first-child {
    display: block;
  }
  .whistle-day .mission-card p {
    font-size: 12px;
    margin: 8px 0;
  }
  .whistle-day #stage {
    grid-column: 2;
    grid-row: 2;
    margin: 0;
    width: auto;
  }
  .whistle-day .dispatch-board {
    grid-column: 3;
    grid-row: 2;
    width: auto;
    align-content: center;
  }
  .whistle-day #clues {
    display: grid;
    grid-template-columns: 1fr;
  }
  .clue {
    min-height: 27px;
  }
  .board-actions {
    flex-wrap: wrap;
  }
  .whistle-day #check {
    order: -1;
    flex-basis: 100%;
    max-width: none;
  }
}
