/* Tesla Roadster Sim: what the game tells you. Stunt titles that punch in mid-screen, the score in
   GTA's money style, the help box top left and the line of keys along the bottom. */

/* stunt titles: NEAR MISS ×2, the points under them, a line of detail */
.notices {
  position: absolute;
  left: 50%;
  top: 29%;
  transform: translateX(-50%);
  width: min(94vw, 960px);
  display: grid;
  justify-items: center;
  text-align: center;
}
.notice {
  grid-area: 1 / 1;
  position: relative;
  display: grid;
  justify-items: center;
  gap: 1px;
  animation: punch 0.42s cubic-bezier(0.2, 1.3, 0.4, 1) both;
}
/* (a soft shade behind, so a white title reads over a white facade) */
.notice::before {
  content: '';
  position: absolute;
  inset: 0 -12%;
  z-index: -1;
  background: radial-gradient(
    closest-side,
    rgba(0, 0, 0, 0.38),
    rgba(0, 0, 0, 0)
  );
}
.notice.out {
  animation: away 0.4s ease-in forwards;
}
.n-title {
  font-weight: 800;
  font-style: italic;
  font-size: clamp(32px, 5.4vw, 66px);
  line-height: 1;
  letter-spacing: 0.01em;
  text-transform: uppercase;
  color: #fff;
  text-shadow: var(--outline-2);
  white-space: nowrap;
}
.n-title .x {
  color: var(--gold);
  margin-left: 0.18em;
}
.n-pts {
  font-weight: 800;
  font-style: italic;
  font-size: clamp(22px, 2.8vw, 34px);
  line-height: 1.1;
  color: var(--gold);
  text-shadow: var(--outline-2);
}
.n-sub {
  font-weight: 600;
  font-size: clamp(12px, 1.25vw, 15px);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: #fff;
  text-shadow: var(--outline);
}
.n-pts:empty,
.n-sub:empty {
  display: none;
}
.notice.red .n-title {
  color: var(--red);
}
.notice.blue .n-pts {
  color: var(--jet);
}
/* a line of text rather than a stunt: smaller */
.notice.plain .n-title {
  font-size: clamp(18px, 2.4vw, 28px);
  letter-spacing: 0.06em;
}
.notice.plain .n-title b {
  color: var(--gold);
}
@keyframes punch {
  0% {
    opacity: 0;
    transform: scale(1.8);
    filter: blur(6px);
  }
  55% {
    opacity: 1;
    transform: scale(0.95);
    filter: none;
  }
  100% {
    transform: none;
  }
}
@keyframes away {
  to {
    opacity: 0;
    transform: translateY(-14px) scale(0.97);
  }
}

/* the score, top right, GTA's money: big white figures in a thin black outline, the last gain
   under them; up while the chrome is, and for a few seconds after it changes */
.score {
  position: absolute;
  right: var(--pad-r);
  top: 58px;
  display: grid;
  justify-items: end;
  opacity: 0;
  transform: translateY(-4px);
  transition: opacity 0.6s, transform 0.6s, margin-top 0.6s;
}
.score.on {
  opacity: 1;
  transform: none;
  transition: opacity 0.2s, transform 0.2s, margin-top 0.6s;
}
/* (below the credit while the chrome is up, in the corner once it has gone) */
body:not(.quiet) .score {
  margin-top: 44px;
}
.score .v {
  font-weight: 800;
  font-size: clamp(32px, 2.9vw, 48px);
  line-height: 1;
  letter-spacing: 0.02em;
  font-variant-numeric: tabular-nums;
  color: #fff;
  text-shadow: var(--outline-2);
}
.score .v::after {
  content: 'pts';
  font-size: 0.42em;
  letter-spacing: 0.08em;
  margin-left: 0.25em;
}
.score .d {
  font-weight: 800;
  font-size: clamp(18px, 1.7vw, 28px);
  line-height: 1.1;
  color: var(--gold);
  text-shadow: var(--outline);
  animation: gain 2.4s ease-out forwards;
}
@keyframes gain {
  0% {
    opacity: 0;
    transform: translateY(-6px);
  }
  10%,
  70% {
    opacity: 1;
    transform: none;
  }
  100% {
    opacity: 0;
  }
}
/* GTA's help box: dark, top left, white words, the keys in white boxes; one hint at a time */
.helpbox {
  position: absolute;
  left: var(--pad-l);
  top: 66px;
  max-width: min(clamp(380px, 29vw, 540px), 76vw);
  padding: 11px 15px;
  background: var(--box);
  border-radius: 2px;
  opacity: 0;
  transform: translateY(-4px);
  transition: opacity 0.25s, transform 0.25s;
}
.helpbox.on {
  opacity: 1;
  transform: none;
}
.helpbox p {
  margin: 0;
  font-weight: 600;
  font-size: clamp(14px, 1.15vw, 18px);
  line-height: 1.5;
  color: #fff;
}
.helpbox b,
.help kbd {
  display: inline-block;
  min-width: 1.45em;
  padding: 0 0.38em;
  margin: 0 0.08em;
  font-family: var(--display);
  font-weight: 800;
  font-size: 0.88em;
  line-height: 1.45;
  text-align: center;
  color: #0d0d0d;
  background: #f2f2f2;
  border-radius: 3px;
  box-shadow: inset 0 -2px 0 rgba(0, 0, 0, 0.28);
}

/* the keys for what the car is doing, along the bottom like a subtitle; it fades out a few
   seconds after it changes, and stays while Autopilot drives */
.context-hint {
  position: absolute;
  left: 50%;
  bottom: calc(var(--pad-b) + 6px);
  transform: translateX(-50%);
  width: max-content;
  max-width: calc(62vw - 80px);
  font-weight: 600;
  font-size: clamp(12.5px, 1.15vw, 17px);
  letter-spacing: 0.02em;
  text-align: center;
  color: #fff;
  text-shadow: var(--outline);
  opacity: 0;
  transition: opacity 0.8s;
}
.context-hint.on {
  opacity: 1;
  transition: opacity 0.3s;
}

@media (prefers-reduced-motion: reduce) {
  .notice,
  .notice.out,
  .score .d {
    animation-duration: 0.01s;
  }
}

/* the radio's station, top centre as GTA shows it while it changes: the frequency over the name
   (under the row of buttons, which may be up) */
.radio-tag {
  position: absolute;
  left: 50%;
  top: 76px;
  transform: translate(-50%, -6px);
  display: grid;
  justify-items: center;
  gap: 2px;
  opacity: 0;
  transition: opacity 0.35s ease, transform 0.35s ease;
  pointer-events: none;
}
.radio-tag.on {
  opacity: 1;
  transform: translate(-50%, 0);
}
.r-freq {
  font-weight: 600;
  font-size: 13px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--gold);
  text-shadow: var(--outline-2);
}
.r-name {
  font-weight: 800;
  font-style: italic;
  font-size: clamp(22px, 2.6vw, 32px);
  line-height: 1;
  text-transform: uppercase;
  color: #fff;
  text-shadow: var(--outline-2);
  white-space: nowrap;
}
