:root {
  color-scheme: only light;
  --canvas-width: 1920px;
  --canvas-height: 1080px;
  --row-width: 360px;
  --row-height: 33px;
  --row-pitch: 38px;
}

@font-face {
  font-family: "Bebas Neue Pro";
  src: url("/assets/BebasNeuePro-Regular.otf") format("opentype");
  font-style: normal;
  font-weight: 400;
  font-display: block;
}

@font-face {
  font-family: "Bebas Neue";
  src: url("/assets/BebasNeue-Regular.otf") format("opentype");
  font-style: normal;
  font-weight: 400;
  font-display: block;
}

@font-face {
  font-family: "Big Noodle Titling";
  src: url("/assets/big_noodle_titling.ttf") format("truetype");
  font-style: normal;
  font-weight: 400;
  font-display: block;
}

@font-face {
  font-family: "Big Noodle Titling";
  src: url("/assets/big_noodle_titling_oblique.ttf") format("truetype");
  font-style: italic;
  font-weight: 400;
  font-display: block;
}

* {
  box-sizing: border-box;
}

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

body {
  position: relative;
  font-synthesis: none;
  -webkit-font-smoothing: antialiased;
}

#canvas {
  position: absolute;
  inset: 0 auto auto 0;
  width: var(--canvas-width);
  height: var(--canvas-height);
  overflow: hidden;
  background: transparent;
  transform-origin: top left;
}

.graphic-anchor {
  position: absolute;
  left: 0;
  top: 0;
  transform: translate3d(var(--graphic-x, 0px), var(--graphic-y, 0px), 0) scale(var(--graphic-scale, 1));
  transform-origin: top left;
  pointer-events: none;
}

.graphic-content {
  visibility: hidden;
  opacity: 0;
  will-change: transform, opacity, clip-path;
  backface-visibility: hidden;
}

.graphic-anchor.is-on .graphic-content {
  visibility: visible;
  opacity: 1;
}

.scorebug-anchor {
  --graphic-x: 7px;
  --graphic-y: 18px;
  --graphic-scale: 1;
  z-index: 30;
}

.scorebug-content {
  position: relative;
  width: 275px;
  height: 138px;
  clip-path: inset(0 100% 0 0);
  transform: translate3d(-22px, 0, 0);
  transition:
    opacity 220ms linear,
    transform 500ms cubic-bezier(0.22, 0.72, 0.16, 1),
    clip-path 500ms cubic-bezier(0.22, 0.72, 0.16, 1),
    visibility 0s linear 500ms;
}

.scorebug-anchor.is-on .scorebug-content {
  clip-path: inset(0 0 0 0);
  transform: translate3d(0, 0, 0);
  transition-delay: 0s;
}

.scorebug-content img,
.lower-third-content img {
  position: absolute;
  display: block;
  user-select: none;
}

.scorebug-bg {
  left: 2px;
  top: 2px;
  width: 271px;
  height: 134px;
  opacity: 0.8;
}

.scorebug-stroke {
  inset: 0;
  width: 275px;
  height: 138px;
}

.scorebug-logo {
  left: 28px;
  top: 10px;
  width: 234px;
  height: 87px;
  object-fit: contain;
}

/* Text stays 2px inside the 4-5px red stroke (inner edge x 5-269 at this height). */
.scorebug-event {
  position: absolute;
  left: 7px;
  top: 100px;
  width: 261px;
  height: 36px;
  overflow: hidden;
  color: #fff;
  font: 400 40.5px/36px "Bebas Neue", "Bebas Neue Pro", Impact, sans-serif;
  text-align: center;
  text-shadow: none;
  white-space: nowrap;
}

.slab-anchor {
  --graphic-x: 13px;
  --graphic-y: 228px;
  --graphic-scale: 1;
  z-index: 20;
}

.slab-content {
  position: relative;
  width: var(--row-width);
  height: 603px;
  contain: layout paint style;
  isolation: isolate;
  transform: translate3d(-26px, 0, 0);
  transition:
    opacity 260ms linear,
    transform 550ms cubic-bezier(0.22, 0.72, 0.16, 1),
    visibility 0s linear 550ms;
}

.slab-anchor.is-on .slab-content {
  transform: translate3d(0, 0, 0);
  transition-delay: 0s;
}

.slab-row {
  position: absolute;
  left: 0;
  width: var(--row-width);
  height: var(--row-height);
  overflow: hidden;
  color: #fff;
  background: url("/assets/LSBG.png") 0 0 / 360px 33px no-repeat;
  opacity: 0;
  will-change: transform, opacity;
  backface-visibility: hidden;
  transform-style: preserve-3d;
}

.slab-row.uses-css-fallback {
  transition:
    opacity 260ms linear,
    transform 650ms cubic-bezier(0.22, 0.72, 0.16, 1);
}

.slab-row.is-visible {
  opacity: 1;
}

.slab-row.is-changing .slab-cell {
  animation: data-reveal 480ms ease both;
}

.slab-cell {
  position: absolute;
  top: 0;
  height: 33px;
  overflow: hidden;
  color: #fff;
  white-space: nowrap;
  line-height: 33px;
  text-shadow: none;
}

.position,
.number,
.last-name {
  font-family: "Bebas Neue Pro", "Bebas Neue", "Arial Narrow", Impact, sans-serif;
  font-size: 28px;
  font-weight: 400;
  text-transform: uppercase;
}

.position {
  left: 0;
  width: 34px;
  text-align: center;
}

.number {
  left: 34px;
  width: 52px;
  text-align: center;
}

.last-name {
  left: 89px;
  width: 176px;
  padding-left: 1px;
  text-overflow: clip;
}

.best-lap {
  left: 270px;
  width: 84px;
  padding-right: 1px;
  font-family: Calibri, Arial, sans-serif;
  font-size: 28px;
  font-weight: 700;
  text-align: right;
}

.lower-third-anchor {
  --graphic-x: 192px;
  --graphic-y: 861px;
  --graphic-scale: 1;
  z-index: 40;
}

.lower-third-content {
  position: relative;
  width: 904px;
  height: 124px;
  transform: translate3d(0, 34px, 0) scaleY(0.82);
  transform-origin: bottom left;
  transition:
    opacity 260ms linear,
    transform 600ms cubic-bezier(0.22, 0.72, 0.16, 1),
    visibility 0s linear 600ms;
}

.lower-third-anchor.is-on .lower-third-content {
  transform: translate3d(0, 0, 0) scaleY(1);
  transition-delay: 0s;
}

.lower-top-bg {
  left: 2px;
  top: 2px;
  width: 900px;
  height: 80px;
  opacity: 0.75;
}

.lower-bottom-bg {
  left: 2px;
  top: 82px;
  width: 900px;
  height: 40px;
  opacity: 0.75;
}

.lower-logo-bg {
  left: 2px;
  top: 2px;
  width: 200px;
  height: 120px;
  opacity: 0.75;
}

/* Logo slot sits 2px inside the 4px logo stroke (inner edge 4-199 x 4-119). */
.lower-left-ad {
  left: 6px;
  top: 6px;
  width: 192px;
  height: 112px;
  object-fit: contain;
}

.lower-middle-stroke {
  left: 0;
  top: 80px;
  width: 904px;
  height: 44px;
  opacity: 0.878;
}

.lower-logo-stroke {
  left: 0;
  top: 0;
  width: 204px;
  height: 124px;
  opacity: 0.878;
}

.lower-text-stroke {
  left: 0;
  top: 0;
  width: 904px;
  height: 124px;
}

.lower-third-top,
.lower-third-bottom {
  position: absolute;
  left: 212px;
  overflow: hidden;
  color: #fff;
  text-shadow: none;
  white-space: nowrap;
}

.lower-third-top {
  top: 17px;
  width: 684px;
  height: 72px;
  font: 400 65px/72px "Big Noodle Titling", "Bebas Neue Pro", Impact, sans-serif;
}

.lower-third-bottom {
  top: 89px;
  width: 486px;
  height: 27px;
  font: italic 400 32px/27px "Big Noodle Titling", "Bebas Neue Pro", Impact, sans-serif;
}

.lower-footer-logo {
  left: 698px;
  top: 89px;
  width: 198px;
  height: 27px;
}

/* Top Hat: coordinates are the GT "TopHat" layer's, relative to its 83,30 origin. */
.tophat-anchor {
  --graphic-x: 83px;
  --graphic-y: 30px;
  --graphic-scale: 1;
  z-index: 35;
}

.tophat-content {
  position: relative;
  width: 1749px;
  height: 168px;
  opacity: 1;
  transition: visibility 0s linear 800ms;
}

.tophat-anchor.is-on .tophat-content {
  transition-delay: 0s;
}

.th-frame,
.th-header-text,
.th-layer {
  position: absolute;
  inset: 0;
  opacity: 0;
}

.tophat-content img {
  position: absolute;
  display: block;
  user-select: none;
}

/* Transition out: everything fades together, then the frame wipes back up. */
.th-frame {
  clip-path: inset(0 0 100% 0);
  transition:
    clip-path 500ms cubic-bezier(0.55, 0, 0.8, 0.3) 200ms,
    opacity 300ms linear 250ms;
}

.th-header-text,
.th-layer {
  transition: opacity 250ms linear;
}

.th-data {
  clip-path: inset(0 0 100% 0);
  transition:
    opacity 250ms linear,
    clip-path 400ms ease-in;
}

/* Transition in, following the GT storyboard delays. */
.tophat-anchor.is-on .th-frame {
  clip-path: inset(0 0 0 0);
  opacity: 1;
  transition:
    clip-path 550ms cubic-bezier(0.22, 0.72, 0.16, 1) 0ms,
    opacity 350ms linear 200ms;
}

.tophat-anchor.is-on .th-header-text {
  opacity: 1;
  transition: opacity 400ms linear 150ms;
}

.tophat-anchor.is-on .th-transfers {
  opacity: 1;
  transition: opacity 400ms linear 300ms;
}

.tophat-anchor.is-on .th-data {
  clip-path: inset(0 0 0 0);
  opacity: 1;
  transition:
    opacity 400ms linear 500ms,
    clip-path 500ms cubic-bezier(0.22, 0.72, 0.16, 1) 400ms;
}

.tophat-anchor.is-on .th-boxes {
  opacity: 1;
  transition: opacity 400ms linear 700ms;
}

.th-row-top-bg { left: 11px; top: 53px; width: 1728px; height: 57px; opacity: 0.8; }
.th-row-top-stroke { left: 233px; top: 48px; width: 1508px; height: 60px; }
.th-row-bottom-bg { left: 11px; top: 109px; width: 1728px; height: 57px; opacity: 0.8; }
.th-row-bottom-stroke { left: 10px; top: 107px; width: 1731px; height: 60px; }
.th-flag-right { left: 1235px; top: 20px; width: 278px; height: 30px; }
.th-flag-left { left: 236px; top: 20px; width: 266px; height: 30px; }
.th-header-bg { left: 10px; top: 19px; width: 1727px; height: 32px; }
.th-center-logo { left: 781px; top: 23px; width: 188px; height: 25px; }
.th-header-stroke { left: 10px; top: 18px; width: 1731px; height: 35px; }
.th-logo-left-bg { left: 8px; top: 21px; width: 225px; height: 143px; opacity: 0.7; }
/* Logos sit 2px inside their 3px strokes. */
.th-logo-left { left: 10px; top: 23px; width: 221px; height: 139px; }
.th-logo-left-stroke { left: 5px; top: 18px; width: 231px; height: 149px; }
.th-logo-right-bg { left: 1513px; top: 20px; width: 225px; height: 145px; opacity: 0.7; }
.th-logo-right { left: 1518px; top: 24px; width: 218px; height: 138px; }
.th-logo-right-stroke { left: 1513px; top: 19px; width: 228px; height: 148px; }

.th-logo {
  object-fit: contain;
}

.th-event,
.th-laps span,
.th-slot span {
  position: absolute;
  overflow: hidden;
  color: #fff;
  text-shadow: none;
  white-space: nowrap;
  text-transform: uppercase;
}

.th-event {
  left: 331.5px;
  top: 16px;
  width: 443px;
  height: 41px;
  font: 400 30px/41px "Big Noodle Titling", "Bebas Neue Pro", Impact, sans-serif;
  text-align: center;
}

/* GT pins the lap count at x=1201 with "LAPS TO GO:" sitting just to its left. */
.th-laps span {
  top: 16px;
  height: 41px;
  font: 400 30px/41px "Big Noodle Titling", "Bebas Neue Pro", Impact, sans-serif;
}

.th-laps-label {
  right: 550px;
}

.th-laps-value {
  left: 1201px;
  min-width: 46px;
}

.th-laps.is-empty {
  visibility: hidden;
}

.th-box {
  width: 54px;
  height: 46px;
  opacity: 0;
  transition: opacity 250ms linear;
}

.th-box.is-filled {
  opacity: 1;
}

.th-transfer {
  width: 54px;
  height: 5px;
  opacity: 0;
  transition: opacity 300ms linear;
}

.th-transfer.is-on {
  opacity: 1;
}

.th-slot {
  position: absolute;
  width: 272px;
  height: 46px;
}

.th-slot span {
  top: 0;
  height: 46px;
}

.th-position {
  left: 0;
  width: 36px;
  font: italic 400 40px/46px "Big Noodle Titling", "Bebas Neue Pro", Impact, sans-serif;
  text-align: center;
}

.th-number {
  width: 52px;
  font: italic 400 33px/46px "Big Noodle Titling", "Bebas Neue Pro", Impact, sans-serif;
  text-align: center;
}

.th-name {
  width: 168px;
  font: 400 40px/46px "Big Noodle Titling", "Bebas Neue Pro", Impact, sans-serif;
}

/* Flag overlay: Top_Ticker_Flag_Overlay GT card (233x199), aligned so its black logo box sits
   over the Top Hat's left logo box. Only the top-right corner is square, as in the GT. */
/* Frame and title band use the same top-to-bottom gradient as Riivet's flag images. */
.flag-overlay {
  --flag-color: linear-gradient(#00ff00, #00bd00);
  position: absolute;
  left: 3px;
  top: 17px;
  z-index: 5;
  width: 233px;
  height: 199px;
  border-radius: 25px 0 25px 25px;
  background: var(--flag-color);
  visibility: hidden;
  opacity: 0;
  clip-path: inset(0 100% 0 0);
  transition:
    opacity 250ms linear,
    clip-path 300ms ease-in,
    visibility 0s linear 300ms;
}

.flag-overlay[data-flag="yellow"] {
  --flag-color: linear-gradient(#ffff00, #bcbc00);
}

.flag-overlay[data-flag="white"] {
  --flag-color: linear-gradient(#ffffff, #bdbdbd);
}

.flag-overlay.is-shown {
  visibility: visible;
  opacity: 1;
  clip-path: inset(0 0 0 0);
  transition:
    opacity 200ms linear,
    clip-path 480ms cubic-bezier(0.22, 0.72, 0.16, 1),
    visibility 0s;
}

.flag-logo-box {
  position: absolute;
  left: 5px;
  top: 4px;
  width: 223px;
  height: 142px;
  overflow: hidden;
  border-radius: 25px 0 0 0;
  background: #000;
}

/* Sponsor logo keeps 2px of black around it inside the 223x142 logo box. */
.flag-logo {
  position: absolute;
  display: block;
  left: 2px;
  top: 2px;
  width: 219px;
  height: 138px;
  object-fit: contain;
}

.flag-title {
  position: absolute;
  left: 0;
  top: 145px;
  width: 233px;
  height: 54px;
  padding: 0 16px;
  overflow: hidden;
  color: #000;
  font: 400 50px/54px "Bebas Neue", "Bebas Neue Pro", Impact, sans-serif;
  text-align: center;
  text-transform: uppercase;
  white-space: nowrap;
}

/* Control-page flag preview: the three cards in a row, always shown. */
.flag-preview-row {
  position: absolute;
  left: 0;
  top: 0;
  display: flex;
  gap: 20px;
}

.flag-preview-row .flag-overlay {
  position: relative;
  left: auto;
  top: auto;
  flex: none;
  transition: none;
}

.driver-info-anchor {
  z-index: 41;
}

#status {
  position: absolute;
  left: 13px;
  top: 810px;
  display: none;
  max-width: 360px;
  padding: 5px 8px;
  border-radius: 3px;
  color: #fff;
  background: rgb(130 0 0 / 88%);
  font: 700 14px/1.2 Arial, sans-serif;
}

body.debug #canvas {
  background-image:
    linear-gradient(45deg, #aaa 25%, transparent 25%),
    linear-gradient(-45deg, #aaa 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #aaa 75%),
    linear-gradient(-45deg, transparent 75%, #aaa 75%);
  background-position: 0 0, 0 10px, 10px -10px, -10px 0;
  background-size: 20px 20px;
  background-color: #ddd !important;
}

body.debug #status.is-error,
body.motion-test #status.is-test {
  display: block;
}

body.motion-test #status.is-test {
  background: rgb(0 90 30 / 88%);
}

@keyframes data-reveal {
  0% {
    opacity: 0;
    transform: translate3d(0, 6px, 0);
  }
  100% {
    opacity: 1;
    transform: translate3d(0, 0, 0);
  }
}
