@impactFontFamily: Impact, -apple-system, BlinkMacSystemFont, Helvetica,
  'Segoe UI', 'Noto Sans CJK SC', Arial, Ubuntu, sans-serif, 'Apple Color Emoji';

@purple: #4334ab;
@cyan: #00d5ff;

@fontSize: 0.9rem;

.tpc-subtitle {
  position: relative;
  color: @purple !important;
  font-size: @fontSize !important;

  &:after {
    content: '';
    position: absolute;
    top: 30px;
    left: 50%;
    display: block;
    width: 40px;
    margin-left: -20px;
    border-top: 4px solid @cyan;
  }
}

.title-en {
  font-size: 2.4rem !important;
}

.tpc-arrow-button {
  transition: 0.5s;

  &:after {
    content: '➔';
    position: absolute;
    opacity: 0;
    top: 15px;
    left: 0;
    transition: 0.5s;
  }

  &:hover {
    padding-left: 30px !important;
  }

  &:hover:after {
    opacity: 1;
    left: 25px;
  }
}

.tpc-hero {
  margin-top: 3rem;
  background: linear-gradient(30deg, #3cafe7, #030faf);

  .hero-body {
    background: url('https://download.pingcap.com/images/tidb-performance-challenge/banner-pc.png')
      no-repeat center;
    background-size: cover;

    @media only screen and (max-width: 767px) {
      height: 250px;
      background: url('https://download.pingcap.com/images/tidb-performance-challenge/banner-mobile.jpg')
        no-repeat center;
      background-size: cover;
    }
  }

  .hero-body-en {
    @media only screen and (max-width: 767px) {
      height: 250px;
      background: url('https://download.pingcap.com/images/tidb-performance-challenge/banner-en-mobile.jpg')
        no-repeat center;
      background-size: cover;
    }
  }

  .title,
  .subtitle {
    color: #fff;

    @media only screen and (max-width: 767px) {
      display: none;
    }
  }

  .subtitle {
    font-size: 1.5rem;
  }

  .banner-buttons {
    margin-top: 5rem;

    @media only screen and (max-width: 767px) {
      display: none;
    }

    .button {
      width: 180px;
      height: auto;
      padding: 0.8em;
      color: #fff;
      border: none;
      font-size: @fontSize;

      a:hover {
        color: #fff;
      }
    }

    .button-receive {
      background: @purple;
    }

    .button-details {
      position: absolute;
      bottom: 0;
      left: 15em;

      background: @cyan;
    }

    .button-en {
      width: 230px;

      @media only screen and (max-width: 768px) {
        width: 180px;
      }
    }
  }
}

.tpc-readme {
  padding: 4rem 0;

  .desc {
    padding: 0.5rem 1rem;
    font-size: 0.8rem;
    line-height: 1.4rem;

    &:first-of-type {
      margin-top: 3rem;

      @media only screen and (max-width: 767px) {
        margin-top: 2rem;
      }
    }

    &:nth-child(odd) {
      padding-top: 0;
    }
  }

  .banner-buttons {
    margin-top: 2rem;

    @media only screen and (min-width: 768px) {
      display: none;
    }

    .button {
      width: 150px;
      height: auto;
      margin: 0 0.8em;
      padding: 0.8em;
      color: #fff;
      border: none;
      font-size: @fontSize;

      a:hover {
        color: #fff;
      }
    }

    .button-receive {
      background: @purple;
    }

    .button-details {
      background: @cyan;
    }
  }
}

.tpc-highlights {
  padding: 4rem 0;
  background: #f8f8f8;

  .container-highlights {
    margin-top: 5rem;

    @media only screen and (max-width: 767px) {
      margin-top: 4rem;
    }
  }

  .columns-highlights {
    box-shadow: 0 0.5em 1em -0.125em rgba(10, 10, 10, 0.1),
      0 0 0 1px rgba(10, 10, 10, 0.02);

    @media only screen and (max-width: 767px) {
      box-shadow: none;
    }
  }

  .column {
    padding: 0;
  }

  .card {
    height: 400px;
    box-shadow: none;

    @media only screen and (max-width: 767px) {
      height: 300px;
      margin: 0 3em;
    }
  }

  .card-purple {
    background: @purple;
    color: #fff;

    .card-content {
      .subtitle {
        color: #fff;
      }
    }
  }

  .card-content {
    .card-en-desc {
      text-align: left;

      @media only screen and (max-width: 375px) {
        padding: 0 !important;
      }
    }

    p {
      padding: 1rem 0;
      font-size: 0.8rem;
      line-height: 1.4rem;
    }

    .subtitle {
      margin: 1rem 0 !important;
      color: @purple;
      font-size: 0.8rem;
    }
  }

  .button-en {
    width: 230px !important;

    @media only screen and (max-width: 768px) {
      width: 180px !important;
    }
  }

  .button-details {
    width: 180px;
    height: auto;
    margin-top: 3rem;
    padding: 0.8em;
    background: transparent;
    color: @purple;
    border: 1px solid @purple;
    border-radius: 0;
    font-size: @fontSize;

    a:hover {
      color: @purple;
    }

    @media only screen and (min-width: 768px) {
      .tpc-arrow-button();
    }

    &:hover {
      color: @purple;
      border-color: @purple;
    }
  }
}

.tpc-prize {
  padding: 4rem 0;

  .container-prize {
    margin-top: 4rem;

    @media only screen and (max-width: 767px) {
      margin-top: 3rem;
    }

    @media only screen and (max-width: 767px) {
      .columns > .column {
        &:nth-child(odd) {
          padding-left: 2.25rem;
        }

        &:nth-child(even) {
          padding-right: 2.25rem;
        }
      }
    }
  }

  .prize-card {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 400px;
    border: 1px solid rgba(67, 52, 171, 0.2);
    transition: all 0.5s;

    &:hover {
      transform: scale(1.05);
      box-shadow: 0 0.5em 1em -0.125em rgba(10, 10, 10, 0.1),
        0 0 0 1px rgba(10, 10, 10, 0.02);
    }

    @media only screen and (max-width: 767px) {
      height: 200px;

      .title {
        margin-bottom: 0.5rem;
      }
    }

    .title {
      color: @purple;
      font-family: @impactFontFamily;

      sub {
        position: relative;
        top: -8px;
        font-size: @fontSize;
      }
    }

    p {
      margin: 0 0.1rem;
      color: rgba(67, 52, 171, 0.7);

      @media only screen and (max-width: 767px) {
        font-size: 0.8rem;
      }
    }

    img {
      width: 192px;
      height: 192px;
      margin-top: 1rem;

      @media only screen and (max-width: 767px) {
        width: 64px;
        height: 64px;
        margin-top: 1rem;
      }
    }
  }
}

.unclickable-btn {
  cursor: not-allowed !important;
  background-color:#cacaca !important;
  color: #fff !important;
}

.tpc-study {
  padding: 4rem 0;
}

.tpc-ranking {
  padding: 4rem 0;
  background: #f8f8f8;

  .intro {
    padding: 0.5rem 2rem;
    font-size: 0.8rem;
    line-height: 1.4rem;
    max-width: 800px;
    margin: 0 auto;
  }

  #tpc-ranking-switch {
    display: flex;
    margin-top: 4rem;

    @media only screen and (max-width: 767px) {
      margin-top: 3rem;
    }

    > div {
      position: relative;
      flex: 1;
      height: 50px;
      line-height: 50px;
      background: #dad8ea;
      color: @purple;
      border-radius: 25px;
      font-size: 0.9rem;
      cursor: pointer;

      @media only screen and (max-width: 767px) {
        height: 40px;
        line-height: 40px;
      }

      &.first {
        left: 1rem;
      }

      &.second {
        left: -1rem;
      }

      &.slider {
        position: absolute;
        left: 1rem;
        width: 50%;
        background: @purple;
        color: #fff;
        transition: left ease 0.5s;
      }
    }
  }

  #ranking-list {
    margin-top: 2rem;

    > div {
      display: flex;
      align-items: center;
      width: calc(100% - 4rem);
      margin: 4rem auto;

      @media only screen and (max-width: 767px) {
        width: calc(100% - 10rem);
        margin: 2rem auto;
      }

      .medal {
        width: 48px;
        height: 48px;

        @media only screen and (max-width: 767px) {
          width: 24px;
          height: 24px;
        }
      }

      .medal1 {
        background: url(https://download.pingcap.com/images/tidb-performance-challenge/medal1.png)
          no-repeat center;
        background-size: cover;
      }

      .medal2 {
        background: url(https://download.pingcap.com/images/tidb-performance-challenge/medal2.png)
          no-repeat center;
        background-size: cover;
      }

      .medal3 {
        background: url(https://download.pingcap.com/images/tidb-performance-challenge/medal3.png)
          no-repeat center;
        background-size: cover;
      }

      .index {
        width: 48px;
        height: 48px;
        line-height: 48px;
        color: @purple;
        font-family: @impactFontFamily;
        font-style: italic;

        @media only screen and (max-width: 767px) {
          width: 24px;
          height: 24px;
          line-height: 24px;
        }
      }

      .github {
        width: 48px;
        height: 48px;
        margin-left: 1rem;
        background: url(https://download.pingcap.com/images/tidb-performance-challenge/github-purple.png)
          no-repeat center;
        background-size: cover;

        @media only screen and (max-width: 767px) {
          width: 24px;
          height: 24px;
        }
      }

      .main {
        flex: 1;
        margin-left: 2rem;

        @media only screen and (max-width: 767px) {
          margin-left: 1rem;
        }

        .info {
          display: flex;
          justify-content: space-between;

          .name {
            color: @purple;

            .ti {
              position: relative;
              top: 50%;
              display: inline-block;
              width: 24px;
              height: 24px;
              margin-left: 0.5rem;
              background: url(https://download.pingcap.com/images/tidb-performance-challenge/ti.png)
                no-repeat center;
              background-size: cover;
              transform: translateY(-50%);

              @media only screen and (max-width: 767px) {
                width: 12px;
                height: 12px;
                transform: translateY(-100%);
              }
            }

            .team {
              position: relative;
              bottom: 1px;
              margin-left: 0.5rem;
              padding: 0.1rem 0.3rem;
              background: #1bafea;
              color: #fff;
              border-radius: 25px;
              font-size: 0.6rem;
              font-weight: bold;

              @media only screen and (max-width: 767px) {
                bottom: 2px;
                font-size: 0.5rem;
              }
            }
          }

          .score {
            color: @purple;
            font-weight: bold;
            font-style: italic;
          }
        }

        .progress-wrapper {
          width: 100%;

          .progress {
            height: 0.5rem;

            &::-webkit-progress-value {
              background-color: @purple;
            }

            &::-moz-progress-bar {
              background-color: @purple;
            }

            &::-ms-fill {
              background-color: @purple;
            }
          }
        }
      }
    }
  }
}

.cards-list {
  display: flex;
  flex-flow: row wrap;
  justify-content: center;
  max-width: 1200px;
  margin: 4rem auto 0;
  padding: 0.75rem;

  @media only screen and (max-width: 767px) {
    margin-top: 3rem;
  }

  .card-item {
    display: flex;
    flex-flow: row wrap;
    justify-content: center;
    width: 550px;
    margin: 10px 10px;
    border: 1px solid rgba(13, 48, 158, 0.17);
    border-radius: 10px;
    overflow: hidden;
    cursor: pointer;
    transition: all 0.3s ease;

    .thumbnail {
      width: 298px;
      height: 200px;
      display: block;

      .mobile-bg {
        display: none;
      }

      img {
        width: 100%;
        height: 100%;
        display: block;
      }
    }

    .info {
      width: 250px;
      padding: 10px;

      h2 {
        font-size: 18px;
        padding: 7px;
        text-align: start;
        color: @purple;
      }

      p {
        font-size: 16px;
        padding: 7px;
        line-height: 1.6;
        color: @purple;
        text-align: start;
      }
    }

    &:hover {
      box-shadow: 0 3px 10px 3px #ddd;
    }
  }
}

@media (max-width: 600px) {
  .cards-list .card-item {
    .thumbnail {
      width: 100%;
      height: auto;

      .pc-bg {
        display: none;
      }

      .mobile-bg {
        display: block;
      }
    }

    .info {
      width: 100%;
      padding: 20px;

      h2 {
        padding: 0 0 10px;
        font-size: 16px;
      }

      p {
        font-size: 14px;
        padding: 3px;
        line-height: 1.7;
      }
    }
  }
}
