@font-face {
  font-family: "TikTok Sans";
  src: url("./assets/fonts/tiktok-sans-optimized.woff2") format("woff2");
}

:root {
  --text: #cdd6f4;
  --background: #1e1e2e;
}

* {
  box-sizing: border-box;
  font-family: "TikTok Sans", system-ui, -apple-system, BlinkMacSystemFont,
    "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, "Open Sans", "Helvetica Neue",
    sans-serif;
  font-optical-sizing: auto;
  -webkit-tap-highlight-color: transparent;
}

body {
  max-width: 600px;
  margin: 0 auto;
  padding: 20px;
  overflow-y: scroll;
  background-color: var(--background);
  color: var(--text);
}

h1 {
  text-align: center;
  color: rgb(137, 180, 250);
  font-weight: 600;
  font-size: 1.7em;
  margin-top: 0.8em;
  margin-bottom: 0.7em;
  height: 35px;
}

#results {
  transition: opacity 0.2s;
}

.info {
  margin-top: 1em;
  display: flex;
  flex-direction: column;

  & h2,
  & .cta {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 500;
    font-size: 19px;
    margin-bottom: 11px;

    &:not(:first-child),
    .cta {
      margin-top: 1em;
    }

    & svg {
      width: 20px;
      height: 20px;
    }
  }

  & .cta {
    color: #89b4fa;
    text-decoration: none;
    margin-top: 0.5em;
  }

  & p {
    line-height: 1.4;
    margin-top: 0px;
    margin-bottom: 10px;
    color: #bac2de;
    opacity: 0.92;
  }
}

input {
  border-radius: 0.85rem;
  border: 1px solid rgba(249, 250, 251, 0.038);
  width: 100%;
  display: flex;
  background: rgba(249, 250, 251, 0.028);
  padding: 0.75rem 1rem;
  font-size: inherit;
  font-family: inherit;
  font-weight: 400;
  box-shadow: rgb(0 0 0 / 8%) 0px 0px 0px 2px, rgb(0 0 0 / 2%) 0px 10px 20px 1px,
    rgb(249 250 251 / 0%) 0px 0px 0px 1px,
    rgb(137, 180, 250, 0.2) 0px 0px 0px 0px;
  color: var(--text);
  caret-color: rgb(137, 180, 250);
  transition: none;

  &:focus {
    box-shadow: rgb(0 0 0 / 8%) 0px 0px 0px 2px,
      rgb(0 0 0 / 2%) 0px 10px 20px 1px, rgb(249 250 251 / 0%) 0px 0px 0px 1px,
      rgb(137, 180, 250) 0px 0px 0px 3px;
    outline: none;
  }

  &::placeholder {
    color: var(--text);
    opacity: 0.48;
  }
}

ul {
  padding: 0px;
  display: flex;
  gap: 10px;
  flex-direction: column;
}

li {
  display: block;
  padding: 0px;
  margin: 0px;
  position: relative;

  & .derank {
    position: absolute;
    right: 0px;
    top: 13px;
    font-size: 15px;
    color: rgb(205 214 244 / 63%);
  }

  & a {
    color: #89b4fa;
    line-height: 1.35;
    text-decoration: none;
    text-underline-offset: 2px;
    overflow-wrap: break-word;
    font-size: 17px;

    display: -webkit-box;
    line-clamp: 4;
    -webkit-line-clamp: 4;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;

    &:hover {
      text-decoration: underline;
    }
  }
}

p {
  &.subtitle {
    color: rgb(205 214 244 / 63%);
    font-size: 14px;
    margin-bottom: 3px;
    overflow: hidden;
    white-space: nowrap;
    max-width: 100%;
    display: flex;
    align-items: center;
    gap: 8px;
    position: relative;

    & img.favicon {
      width: 18px;
      height: 18px;
      border-radius: 2px;
      aspect-ratio: 1 / 1;
      pointer-events: none;
      user-select: none;
    }

    &::after {
      position: absolute;
      top: 0px;
      right: 0px;
      bottom: 0px;
      content: " ";
      width: 50px;
      height: 100%;
      background: linear-gradient(
        -90deg,
        var(--background) 0%,
        rgba(0, 0, 0, 0) 100%
      );
      pointer-events: none;
    }
  }

  &.snippet {
    font-size: 14.5px;
    line-height: 1.4;
    margin: 0px;
    color: rgb(205 214 244 / 78%);
    margin-top: 5px;
    display: -webkit-box;
    line-clamp: 3;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;

    & b {
      color: rgb(205 214 244 / 86%);
      font-weight: 600;
    }
  }
}

.resultsCount {
  color: #ffffffd5;
  font-size: 14px;
  margin: 0px;

  & b {
    font-weight: 500;
    color: white;
  }
}

.meanings {
  border: 1px solid rgba(249, 250, 251, 0.038);
  border-radius: 0.85rem;
  padding: 12px;
  background-color: rgba(249, 250, 251, 0.028);
  overflow: hidden;
  position: relative;
  margin-bottom: 10px;
  transition: height 0.1s;

  & h2 {
    margin: 0px;
    font-size: 18px;
    display: flex;
    align-items: center;
    gap: 6px;
    font-weight: 500;
  }

  & > li {
    counter-increment: item;
    display: flex;
    margin-top: 12px;
    cursor: pointer;

    & > .text {
      display: flex;
      flex-direction: column;
    }

    &::before {
      content: counter(item);
      flex-shrink: 0;
      padding: 7px;
      border-radius: 100px;
      aspect-ratio: 1 / 1;
      width: 14px;
      height: 14px;
      display: flex;
      align-items: center;
      justify-content: center;
      background-color: rgba(205, 214, 244, 0.08);
      margin-right: 8px;
      font-size: 14px;
      font-weight: 500;
      transition: background-color 0.2s, transform 0.2s;
    }

    &:hover::before {
      background-color: rgba(205, 214, 244, 0.16);
      transform: scale(1.1);
    }

    &:active::before {
      transform: scale(0.94);
    }

    &:not(.active) span.type {
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
      max-width: 300px;
    }

    &.active .examples {
      opacity: 1;
      margin-top: 6px;
      font-size: 14px;
      height: auto;
    }
  }

  & span.meaning {
    line-height: 1.3;
  }

  & span.type {
    opacity: 0.7;
    font-size: 14px;
  }

  & .examples {
    font-size: 14px;
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
    opacity: 0;
    margin-top: -2px;
    transition: opacity 0.2s, margin-top 0.2s;
    height: 0px;
    flex-direction: row;

    & li:not(:first-child)::before {
      content: "• ";
      opacity: 0.68;
    }
  }

  &.big-list {
    height: 170px;
    max-height: 170px;

    &.extended {
      height: var(--meanings-height, 100%);
    }

    &:not(.extended) {
      cursor: pointer;

      & * {
        pointer-events: none;
        user-select: none;
      }

      &::before {
        display: block;
        position: absolute;
        bottom: 4px;
        right: 0px;
        left: 0px;
        content: "expand contents";
        z-index: 2;
        max-width: fit-content;
        margin: 0px auto;
        pointer-events: none;
        font-size: 0px;
        background-image: url("data:image/svg+xml,%3Csvg%20%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20%20width%3D%2224%22%20%20height%3D%2224%22%20%20viewBox%3D%220%200%2024%2024%22%20%20fill%3D%22none%22%20%20stroke%3D%22white%22%20%20stroke-width%3D%222%22%20%20stroke-linecap%3D%22round%22%20%20stroke-linejoin%3D%22round%22%20%20class%3D%22icon%20icon-tabler%20icons-tabler-outline%20icon-tabler-chevron-down%22%3E%3Cpath%20stroke%3D%22none%22%20d%3D%22M0%200h24v24H0z%22%20fill%3D%22none%22%2F%3E%3Cpath%20d%3D%22M6%209l6%206l6%20-6%22%20%2F%3E%3C%2Fsvg%3E");
        width: 20px;
        height: 20px;
        background-size: 100%;
        background-repeat: no-repeat;
        border-radius: 100px;
        aspect-ratio: 1;
        opacity: 0.65;
        transition: bottom 0.2s, opacity 0.2s;
      }

      &:hover::before {
        bottom: 2px;
        opacity: 1;
      }
    }

    &::after {
      content: " ";
      position: absolute;
      left: 0px;
      right: 0px;
      bottom: 0px;
      height: 100px;
      background: linear-gradient(
        0deg,
        rgb(36 36 52) 0%,
        rgba(36, 36, 52, 0) 100%
      );
      pointer-events: none;
      transition: opacity 0.5s, height 0.5s;
    }

    &.extended::after {
      opacity: 0;
      height: 80px;
    }
  }

  &.extended {
    max-height: 200%;
  }
}

.empty-state {
  display: flex;
  gap: 10px;
  margin-top: 10px;

  & svg {
    width: 40px;
    height: 40px;
  }

  & h2 {
    margin: 0px;
    font-size: 20px;
    font-weight: 500;
    max-width: 400px;
  }

  & h3 {
    margin: 0px;
    font-size: 16px;
    font-weight: 400;
    max-width: 460px;
    margin-top: 4px;
    opacity: 0.9;
    line-height: 1.4;
  }
}

@media (max-width: 500px) {
  .empty-state {
    flex-direction: column;
  }
}

a[class*="credits-"] {
  box-shadow: none !important;
  background-color: #89b4fa !important;
}

a[class*="credits-"]:hover {
  box-shadow: rgba(137, 180, 250, 0.6) 0px 0px 2px,
    rgba(137, 180, 250, 0.4) 0px 0px 5px, rgba(137, 180, 250, 0.3) 0px 0px 10px,
    rgba(137, 180, 250, 0.2) 0px 0px 18px, rgba(137, 180, 250, 0.1) 0px 0px 30px !important;
}
