@import url("https://fonts.googleapis.com/css2?family=JetBrains+Mono&display=swap");

.root {
  --color-gray-lighter: #a3a3a3;
  --color-gray-light: #383838;
  --color-gray: #232323;
  --color-gray-dark: #121212;
  --color-black: #000000;
  --color-white: #ffffff;
  --color-orange: #ff4d00;

  display: flex;
  flex-direction: column;
  width: 90vw;
  max-width: 800px;
  height: auto;
  max-height: 50vh;
  position: fixed;
  z-index: 9999;
  background: #2b2d37;
  border: 1px solid var(--color-gray-light);
  border-radius: 8px;
  overflow: hidden;
  line-height: 1;
  top: 16px;
  left: 16px;
  font-family: "JetBrains Mono", monospace;
  visibility: hidden;
  color: var(--color-white);

  &.initialized {
    visibility: visible;
  }

  .header {
    background: var(--color-gray-dark);
    text-align: center;
    padding: 4px 16px;
    min-height: 44px;
    font-size: 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    text-transform: uppercase;

    &:hover {
      cursor: grab;
    }

    &:active {
      cursor: grabbing;
    }

    .actions {
      display: flex;
      gap: 0 8px;
      align-items: center;

      .button {
        color: var(--color-white);
        display: flex;
        align-items: center;
        height: 24px;
        padding: 0px 4px;
        border-radius: 4px;
        background: var(--color-gray);
        border: 1px solid var(--color-gray-light);

        svg {
          width: 14px;
          height: 14px;
        }
      }

      .scrollToRoot {
        display: flex;
        align-items: center;
        padding-left: 8px;
        padding-right: 8px;
        gap: 0 8px;

        .text {
          transform: translateY(0.05em);
        }
      }
    }
  }

  .main {
    border-top: 1px solid var(--color-gray-light);
    border-bottom: 1px solid var(--color-gray-light);
    background: var(--color-black);
    padding: 24px 32px 24px;
    flex: 1;
    overflow: auto;
    max-height: 100%;

    .timeline {
      margin-top: 32px;
      position: relative;
      height: 100%;
      width: 100%;

      .guides {
        position: absolute;
        height: 100%;
        bottom: 0;
        width: 100%;
        display: flex;
        flex-direction: column;
        justify-content: space-between;

        .guide {
          position: absolute;
          height: 100%;
          width: 1px;
          border-right: 1px dashed #ffffff88;
          font-size: 14px;

          .percent {
            padding-bottom: 16px;
            position: absolute;
            top: 0;
            left: 50%;
            line-height: 1;
            transform: translateY(-100%) translateX(-50%);
            color: #ffffff88;
          }
        }
      }

      .progress {
        pointer-events: none;
        position: absolute;
        inset: 0;

        .trail {
          position: absolute;
          height: 100%;
          top: 0;
          bottom: 0;
          left: 0;
          width: 100%;
          overflow: hidden;

          .gradient {
            position: absolute;
            height: 100%;
            top: 0;
            bottom: 0;
            width: 200px;
            background: linear-gradient(
              270deg,
              rgba(255, 255, 255, 0.14) 0.53%,
              rgba(255, 255, 255, 0) 100%
            );
            transform: translateX(-100%);
          }
        }

        .marker {
          position: absolute;
          height: 100%;
          top: 0;
          bottom: 0;
          width: 1px;
          background: var(--color-white);
          box-sizing: content-box;
          font-size: 14px;

          .thumb {
            top: 0;
            transform: translateX(-50%) translateY(-100%);
            left: 50%;
            position: absolute;
            display: flex;
            flex-direction: column;
            align-items: center;
            padding-bottom: 2px;

            .percent {
              line-height: 1;
              padding-bottom: 3px;
            }
          }
        }
      }

      .tweens {
        position: relative;
        height: 100%;
        display: flex;
        flex-direction: column;

        .row {
          padding: 4px 0;

          &:nth-child(odd) {
            background: #14151a60;
          }

          &:nth-child(even) {
            background: #14151a90;
          }
        }
      }
    }
  }

  .footer {
    background: var(--color-gray-dark);
    text-transform: uppercase;
    text-align: center;
    padding: 4px 16px;
    min-height: 44px;
    font-size: 14px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    color: var(--color-white);

    .version {
      color: var(--color-gray-lighter);
    }

    .bsmnt {
      color: var(--color-orange);
    }
  }
}

.tween {
  --duration-percentage: 0;
  --start-offset-percentage: 0;

  left: var(--start-offset-percentage);
  /* (1px for outline width + 1px for outline offset) */
  width: calc(var(--duration-percentage) - 3px);

  cursor: default;
  font-size: 12px;
  color: var(--color-white);
  position: relative;
  display: flex;
  align-items: center;
  min-height: 12px;
  height: 18px;
  background: white;
  padding-left: 8px;
  font-weight: 500;
  border-radius: 0px 4px 4px 0px;
  margin: 0 2px;
  outline: 1px solid var(--color-gray-light);
  outline-offset: 1px;
  overflow: hidden;
  white-space: nowrap;
}

.waypoint {
  --start-offset-percentage: 0;

  position: relative;
  left: var(--start-offset-percentage);
  width: 22px;
  height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--color-gray);
  border: 1px solid var(--color-gray-light);
  border-radius: 6px;
  transform: translateX(-50%);

  .onCall,
  .onReverseCall {
    opacity: 0;
    transition-property: transform opacity;
    transition-duration: 0.2s;
    transition-timing-function: ease-out;
  }

  .onCall {
    position: absolute;
    right: -8px;
    transform: translateX(50%);

    &.active {
      opacity: 1;
      transform: translateX(100%) scale(1.2);
    }
  }

  .onReverseCall {
    position: absolute;
    left: -8px;
    transform: translateX(-50%);

    &.active {
      opacity: 1;
      transform: translateX(-100%) scale(1.2);
    }
  }
}

.selectWrapper {
  position: relative;

  .select {
    appearance: none;
    cursor: pointer;
    background: var(--color-gray);
    color: var(--color-white);
    border: 1px solid var(--color-gray-light);
    height: 24px;
    border-radius: 4px;
    width: max-content;
    min-width: 110px;
    padding: 0 8px;
    padding-right: 24px;
  }

  .arrow {
    pointer-events: none;
    position: absolute;
    content: "";
    right: 8px;
    top: 50%;
    width: 12px;
    height: 12px;
    z-index: 10;
    transform: translateY(-50%);
  }
}

.highlight {
  background: #ec5b29aa;
  z-index: 999;
}

@media (max-width: 768px) {
  .root {
    left: 50%;
    transform: translateX(-50%);

    .version {
      display: none;
    }

    .scrollToRoot {
      .text {
        display: none;
      }
    }
  }
}
