.racing-sans-one-regular {
  font-family: "Racing Sans One", "Noto Sans", sans-serif;
  font-weight: 400;
  font-style: normal;
}

:root {
  --moveTime: 1000ms;
}

html {
  block-size: 100dvh;
}

body {
  background-image: linear-gradient(#446, #222);
  block-size: 100dvh;
  font-family: sans-serif;
  display: flex;
  inline-size: 100dvw;
  margin: 0;
  overflow: hidden;
}

#game {
  block-size: 100%;
  flex: 1 0 auto;
  padding: 0 2rem;
  position: relative;
  transition: all calc(var(--moveTime) * 2) linear;
}

hgroup {
  color: hotpink;
  margin: 0 0 1rem 0;

  h1 {
    filter: drop-shadow(0 0 2px #000);
    font-size: clamp(2rem, 5vw, 3rem);
    font-style: italic;
    line-height: 1;
    margin: 0;
    padding: 0;
    text-shadow: 0 -1px #fff;
    text-transform: uppercase;

    span {
      display: inline-block;
      &::first-letter {
        font-size: 1.5em;
      }
    }
  }

  p {
    color: #988;
    filter: drop-shadow(0 0 1px #000);
    font-size: clamp(1rem, 2vw, 1.5rem);
    margin: 0;
    padding: 0;
  }
}

.track {
  border-radius: 0.25rem;
  position: relative;
  transition: all var(--moveTime) ease-in-out;

  &.tiltbackwards {
    transform: rotate(10deg);
  }
  &.tiltforwards {
    transform: rotate(-10deg);
  }
}

.countdown {
  animation: fade-and-shrink 1s infinite linear;
  color: hotpink;
  filter: drop-shadow(0 0 2px #000);
  font-size: 8rem;
  inset: 50% auto auto 50%;
  position: absolute;
  transform: translate(-50%, -50%);
}

#lanes {
  border-inline-start: solid 2px hotpink;
  display: flex;
  flex-direction: column;
  gap: 2px;
  list-style: none;
  margin: 0;
  padding: 0 2rem;
  transition: all calc(var(--moveTime) * 2) linear;
  > li {
    block-size: 4rem;
    position: relative;
    &:nth-child(6n - 5) {
      .surface,
      .emoji {
        filter: hue-rotate(0deg);
      }
    }
    &:nth-child(6n - 1) {
      .surface,
      .emoji {
        filter: hue-rotate(60deg);
      }
    }
    &:nth-child(6n - 3) {
      .surface,
      .emoji {
        filter: hue-rotate(120deg);
      }
    }
    &:nth-child(6n - 4) {
      .surface,
      .emoji {
        filter: hue-rotate(180deg);
      }
    }
    &:nth-child(6n - 2) {
      .surface,
      .emoji {
        filter: hue-rotate(240deg);
      }
    }
    &:nth-child(6n) {
      .surface,
      .emoji {
        filter: hue-rotate(300deg);
      }
    }
    .surface {
      background-color: #889;
      color: rgba(255, 255, 255, 0.1);
      content: "";
      display: block;
      font-family: monospace;
      font-size: 3rem;
      inset: 0 -2rem;
      line-height: 4rem;
      padding-inline-start: 0.5rem;
      position: absolute;
      text-transform: uppercase;
    }
  }
  &.flip {
    transform: rotateY(180deg);
  }
}

#lanes.fixed-emoji-colors li {
  .emoji {
    filter: hue-rotate(0);
  }
}

body.dark {
  animation-duration: 0;
  background-color: #222;
  background-image: none;
  color: #333;
  transition: none;

  hgroup h1,
  hgroup p,
  button {
    animation-duration: 0;
    background-color: #222;
    background-image: none;
    border-color: #333;
    color: #333;
    filter: none;
    text-shadow: none;
    transition: none;
  }
  #lanes li .surface {
    background-color: #282828;
    color: #333;
  }
  .emoji {
    filter: grayscale(1) opacity(0.1) drop-shadow(0 0 1px #cc0) !important;
  }
  .name {
    color: #cc0;
  }
}

body.radioactive {
  background-image: linear-gradient(#0f0, #ff0);
  transition: none;

  #lanes {
    background-color: hotpink;
    background-image: linear-gradient(hotpink, #0ff);
  }
  #lanes > li + li {
    border-block-start-color: #ff0;
  }
}

.button-panel {
  margin-block-start: 1rem;
  text-align: end;
}

#go,
#reset {
  animation: pulse 2s infinite;
  background-color: hotpink;
  border: none;
  border-radius: 3rem;
  font-size: 1.5rem;
  padding: 0.5rem 1rem;
  user-select: none;
}

main > p {
  text-align: center;
}

.timer-container {
  color: #e4dfda;
  font-family: monospace;
  margin: 0.5rem 0 0 0;
  text-align: end;

  .timer {
    background-color: #222;
    border-radius: 0.25rem;
    display: inline-block;
    inline-size: 5.25rem;
    padding: 0.125rem;
    text-align: center;

    span {
      background-color: #000;
      border-radius: 0.25rem;
      display: inline-block;
      padding: 0 0.125rem;

      &.min,
      &.sec {
        inline-size: 1rem;
      }
      &.ms {
        inline-size: 1.5rem;
      }
    }
  }
}
