:root {
  color-scheme: dark;
  font-family: "IBM Plex Mono", monospace;
  --red: #ff1238;
  --blue: #087dff;
}

* { box-sizing: border-box; }

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
  background: transparent;
}

body {
  display: grid;
  place-items: end center;
  padding: 30px 36px;
  perspective: 1200px;
}

.chase {
  position: relative;
  isolation: isolate;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 142px minmax(0, 1fr);
  width: min(960px, calc(100vw - 72px));
  height: 82px;
  padding: 7px 7px 13px;
  border: 1px solid rgba(255, 255, 255, .2);
  border-radius: 14px 14px 6px 6px;
  background:
    linear-gradient(90deg, transparent 0 49.75%, rgba(255,255,255,.08) 50%, transparent 50.25%),
    linear-gradient(180deg, #34373b 0, #1b1d20 8%, #090a0c 28%, #040506 74%, #151719 75%, #070809 100%);
  box-shadow:
    0 28px 42px rgba(0, 0, 0, .62),
    0 10px 18px rgba(0, 0, 0, .54),
    inset 0 1px rgba(255, 255, 255, .34),
    inset 0 -2px #000;
  transform-origin: 50% 100%;
  transform-style: preserve-3d;
  animation: deploy 720ms cubic-bezier(.16, 1, .3, 1) both;
}

.chase[hidden] { display: none; }

.chase::before {
  content: "";
  position: absolute;
  z-index: 4;
  top: 4px;
  right: 13px;
  left: 13px;
  height: 5px;
  border-radius: 50%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,.28) 18%, rgba(255,255,255,.06) 49%, rgba(255,255,255,.28) 82%, transparent);
  filter: blur(.3px);
  pointer-events: none;
}

.chase::after {
  content: "";
  position: absolute;
  z-index: -1;
  right: 17px;
  bottom: -7px;
  left: 17px;
  height: 11px;
  border-radius: 2px 2px 10px 10px;
  background: linear-gradient(180deg, #202327, #060708 62%, #010101);
  box-shadow: 0 9px 16px rgba(0, 0, 0, .78), inset 0 1px rgba(255,255,255,.12);
}

.top-rail {
  position: absolute;
  z-index: 5;
  top: -3px;
  right: 7%;
  left: 7%;
  height: 5px;
  border: 1px solid rgba(255,255,255,.2);
  border-radius: 5px 5px 1px 1px;
  background: linear-gradient(180deg, #35383c, #0a0b0d);
  box-shadow: inset 0 1px rgba(255,255,255,.22), 0 2px 4px #000;
}

.bar {
  --led: #fff;
  position: relative;
  z-index: 2;
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 2px;
  min-width: 0;
  overflow: hidden;
  border: 1px solid rgba(255,255,255,.24);
  background:
    linear-gradient(180deg, rgba(255,255,255,.18), rgba(255,255,255,.035) 12%, transparent 48%, rgba(0,0,0,.42)),
    color-mix(in srgb, var(--led) 5%, #080a0c);
  box-shadow:
    inset 0 0 34px rgba(0,0,0,.78),
    inset 0 2px rgba(255,255,255,.18),
    inset 0 -1px rgba(0,0,0,.92);
  transform: translateZ(5px);
}

.red {
  --led: var(--red);
  border-radius: 12px 3px 3px 8px;
}

.blue {
  --led: var(--blue);
  border-radius: 3px 12px 8px 3px;
}

.bar::before {
  content: "";
  position: absolute;
  z-index: -1;
  inset: 8% 0;
  background: var(--led);
  filter: blur(24px);
  opacity: .08;
  animation: lens-bloom 1.36s steps(1, end) infinite;
}

.blue::before { animation-delay: -.68s; }

.bar::after {
  content: "";
  position: absolute;
  z-index: 4;
  inset: 0;
  background:
    linear-gradient(104deg, transparent 6%, rgba(255,255,255,.08) 24%, rgba(255,255,255,.26) 29%, transparent 32% 69%, rgba(255,255,255,.13) 74%, transparent 78%),
    linear-gradient(180deg, rgba(255,255,255,.21), transparent 22% 72%, rgba(255,255,255,.06));
  background-size: 220% 100%, 100% 100%;
  background-repeat: no-repeat;
  pointer-events: none;
  animation: lens-glide 6.4s linear infinite;
}

.bar > i {
  position: relative;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  grid-template-rows: repeat(2, 1fr);
  gap: 3px;
  min-width: 0;
  margin: 1px 0;
  padding: 3px;
  border: 1px solid color-mix(in srgb, var(--led) 24%, rgba(255,255,255,.16));
  border-radius: 5px;
  background:
    linear-gradient(145deg, rgba(255,255,255,.16), transparent 22%),
    linear-gradient(180deg, #1c2025, #030405 52%, #11151a);
  box-shadow:
    inset 0 2px 4px rgba(255,255,255,.13),
    inset 0 -8px 11px #000,
    0 2px 3px #000;
  opacity: .32;
  transform-style: preserve-3d;
  will-change: opacity, filter, box-shadow;
}

.bar > i::before {
  content: "";
  position: absolute;
  inset: 3px;
  border-radius: 3px;
  background: linear-gradient(90deg, transparent 31%, rgba(255,255,255,.08) 32% 33%, transparent 34% 65%, rgba(255,255,255,.08) 66% 67%, transparent 68%);
  pointer-events: none;
}

.bar b {
  position: relative;
  display: block;
  overflow: hidden;
  border: 1px solid color-mix(in srgb, var(--led) 38%, #777);
  border-radius: 3px;
  background:
    linear-gradient(145deg, rgba(255,255,255,.38), transparent 24%),
    conic-gradient(from 45deg, color-mix(in srgb, var(--led) 38%, #111), #020304, color-mix(in srgb, var(--led) 54%, #111), #020304, color-mix(in srgb, var(--led) 38%, #111));
  box-shadow:
    inset 0 2px 3px rgba(255,255,255,.38),
    inset 0 -5px 7px rgba(0,0,0,.9),
    0 1px 2px #000;
  transform: translateZ(2px);
}

.bar b::before {
  content: "";
  position: absolute;
  inset: 22% 17%;
  border-radius: 2px;
  background: linear-gradient(135deg, #fff 0 8%, color-mix(in srgb, var(--led) 70%, white) 18%, var(--led) 58%, color-mix(in srgb, var(--led) 42%, #030405));
  box-shadow: 0 0 6px var(--led), inset 0 1px 2px #fff, inset 0 -2px 3px rgba(0,0,0,.58);
}

.bar b::after {
  content: "";
  position: absolute;
  inset: 1px;
  border-radius: 2px;
  background:
    linear-gradient(155deg, rgba(255,255,255,.58), transparent 22% 70%, rgba(255,255,255,.1)),
    repeating-linear-gradient(90deg, transparent 0 18%, rgba(255,255,255,.09) 19% 20%);
}

.red > i { animation: strobe-a 1.36s steps(1, end) infinite; }
.blue > i { animation: strobe-b 1.36s steps(1, end) infinite; }

.timer-deck {
  position: relative;
  z-index: 3;
  display: grid;
  place-items: center;
  min-width: 0;
  margin-inline: 4px;
  overflow: hidden;
  border: 1px solid rgba(255,255,255,.16);
  clip-path: polygon(9px 0, calc(100% - 9px) 0, 100% 9px, 100% calc(100% - 7px), calc(100% - 7px) 100%, 7px 100%, 0 calc(100% - 7px), 0 9px);
  background:
    radial-gradient(circle at 0 50%, rgba(255,18,56,.12), transparent 33%),
    radial-gradient(circle at 100% 50%, rgba(8,125,255,.13), transparent 33%),
    linear-gradient(180deg, #101317, #020304 62%, #090b0e);
  box-shadow: inset 0 1px rgba(255,255,255,.09), inset 0 -1px #000;
}

.timer-deck::before {
  content: "";
  position: absolute;
  inset: 7px;
  border: 1px solid rgba(255,255,255,.075);
  background: linear-gradient(102deg, transparent 12%, rgba(255,255,255,.05) 31%, transparent 33% 68%, rgba(255,255,255,.035) 73%, transparent 75%);
  pointer-events: none;
}

.timer-deck::after {
  content: "";
  position: absolute;
  right: 13px;
  bottom: 11px;
  left: 13px;
  height: 1px;
  background: linear-gradient(90deg, var(--red), rgba(255,255,255,.2) 49%, var(--blue));
  box-shadow: 0 0 7px rgba(255,255,255,.16);
  opacity: .58;
}

#timer {
  position: relative;
  z-index: 2;
  color: #fbfcff;
  font: 600 34px/1 "IBM Plex Mono", monospace;
  letter-spacing: -.035em;
  font-variant-numeric: tabular-nums;
  text-shadow:
    -3px 0 15px rgba(255,18,56,.3),
    3px 0 15px rgba(8,125,255,.34),
    0 2px 8px rgba(255,255,255,.14);
}

.undercarriage {
  position: absolute;
  z-index: -2;
  right: 8%;
  bottom: -14px;
  left: 8%;
  display: flex;
  justify-content: space-between;
  height: 11px;
  border-radius: 0 0 12px 12px;
  background: linear-gradient(180deg, #151719, #020203);
  box-shadow: 0 8px 14px rgba(0,0,0,.8), inset 0 1px rgba(255,255,255,.08);
}

.undercarriage i {
  width: 9%;
  height: 15px;
  margin: 4px 10%;
  border-radius: 2px 2px 5px 5px;
  background: linear-gradient(90deg, #020203, #22252a 48%, #050607);
  box-shadow: 0 7px 8px rgba(0,0,0,.72), inset 0 1px rgba(255,255,255,.1);
}

.is-final .bar > i { animation: final-strobe 600ms steps(1, end) infinite; }
.is-final .bar::before { animation: final-bloom 600ms steps(1, end) infinite; }
.is-final #timer { animation: final-readout 600ms steps(1, end) infinite; }

@keyframes deploy {
  0% { opacity: 0; transform: translateY(52px) rotateX(12deg) scale(.94); filter: blur(12px); }
  58% { opacity: 1; transform: translateY(-4px) rotateX(-1.5deg) scale(1.01); filter: blur(0); }
  100% { opacity: 1; transform: none; filter: none; }
}

@keyframes strobe-a {
  0%, 10%, 20%, 30% { opacity: 1; filter: brightness(2.35) saturate(1.12); box-shadow: 0 2px 13px var(--led), inset 0 0 20px var(--led); }
  6%, 16%, 26%, 36%, 100% { opacity: .24; filter: brightness(.42); box-shadow: inset 0 0 17px #000; }
}

@keyframes strobe-b {
  0%, 49%, 86%, 100% { opacity: .24; filter: brightness(.42); box-shadow: inset 0 0 17px #000; }
  50%, 60%, 70%, 80% { opacity: 1; filter: brightness(2.35) saturate(1.12); box-shadow: 0 2px 13px var(--led), inset 0 0 20px var(--led); }
  56%, 66%, 76% { opacity: .24; filter: brightness(.42); box-shadow: inset 0 0 17px #000; }
}

@keyframes lens-bloom {
  0%, 10%, 20%, 30%, 50%, 60%, 70%, 80% { opacity: .48; }
  6%, 16%, 26%, 36%, 49%, 56%, 66%, 76%, 86%, 100% { opacity: .04; }
}

@keyframes lens-glide {
  from { background-position: 130% 0, 0 0; }
  to { background-position: -130% 0, 0 0; }
}

@keyframes final-strobe {
  0%, 18% { opacity: 1; filter: brightness(2.1) saturate(1.18); box-shadow: 0 2px 15px var(--led), inset 0 0 20px var(--led); }
  9%, 27%, 100% { opacity: .12; filter: brightness(.34); box-shadow: inset 0 0 17px #000; }
}

@keyframes final-bloom { 0%, 18% { opacity: .62; } 9%, 27%, 100% { opacity: .04; } }
@keyframes final-readout { 0%, 45% { opacity: 1; filter: brightness(1.3); } 46%, 100% { opacity: .28; filter: brightness(.65); } }

@media (max-width: 820px) {
  body { padding: 20px 12px; }

  .chase {
    grid-template-columns: minmax(0, 1fr) 118px minmax(0, 1fr);
    width: calc(100vw - 64px);
    height: 76px;
    padding: 6px 6px 12px;
    border-radius: 12px 12px 5px 5px;
  }

  .bar { grid-template-columns: repeat(3, 1fr); }
  .bar > i { display: none; margin: 1px 0; padding: 3px; gap: 3px; }
  .red > i:nth-child(4),
  .red > i:nth-child(5),
  .red > i:nth-child(6),
  .blue > i:nth-child(1),
  .blue > i:nth-child(2),
  .blue > i:nth-child(3) { display: grid; }
  .timer-deck { margin-inline: 3px; }
  #timer { font-size: 29px; }
}

@media (max-width: 520px) {
  .chase { grid-template-columns: minmax(0, 1fr) 100px minmax(0, 1fr); width: calc(100vw - 32px); }
  #timer { font-size: 25px; }
  .bar > i { grid-template-columns: repeat(2, 1fr); }
}

@media (prefers-reduced-motion: reduce) {
  .chase { animation: none; }
  .bar::after { animation: none; }
  .bar > i,
  .bar::before { animation-duration: 1.8s; }
}
