.b3-menu {
  position: fixed;
  border-radius: var(--b3-border-radius-b);
  box-shadow: var(--b3-dialog-shadow);
  border: 1px solid var(--b3-theme-surface-lighter);
  background-color: var(--b3-menu-background);
  padding: 8px 0;
  box-sizing: border-box;

  &::-webkit-scrollbar,
  &__submenu::-webkit-scrollbar {
    width: 5px;
    height: 5px;
  }

  &::-webkit-scrollbar-thumb,
  &__submenu::-webkit-scrollbar-thumb {
    box-sizing: content-box;
    border: 2px solid transparent;
    border-radius: var(--b3-border-radius);
    box-shadow: inset 0 0 2.5px 2.5px var(--b3-scroll-color);

    &:hover {
      border-width: 0.5px;
    }
  }

  &--fullscreen {
    top: 100vh;
    left: 0;
    width: 100%;
    border: 0;
    box-shadow: none;
    right: 0;
    max-height: none;
    height: 100vh;
    padding: 0;
    border-radius: 0;
    transition: transform 0.15s cubic-bezier(0, 0, 0.2, 1) 0ms;
    display: flex;
    flex-direction: column;

    .b3-menu {
      &__submenu {
        top: 49.5px;
        left: 0;
        bottom: 0;
        max-height: none;
        right: 0;
        box-shadow: none;
        border: 0;
        padding: 0;
        border-radius: 0;

        & > .b3-menu__item:first-child {
          border-top: .5px solid var(--b3-theme-background-light);
        }
      }

      &__items {
        flex: 1;
        padding: 24px 0;
        max-height: none;
      }

      &__item {
        border-bottom: .5px solid var(--b3-theme-background-light);
        line-height: 42px;
        background-color: var(--b3-theme-background);
        text-decoration: none;
        border-radius: 0;

        &:first-child {
          border-top: .5px solid var(--b3-theme-background-light);
        }

        &--show > .b3-menu__submenu--row {
          width: 100%;
        }

        &--readonly {
          line-height: 24px;
          padding: 8px 16px;
          margin: 0;
          max-width: none;
        }

        .color__square {
          margin: 0 16px 0 8px;
        }
      }

      &__title {
        border-bottom: .5px solid var(--b3-theme-background-light);
        padding: 0 8px;
        display: flex;
        background-color: var(--b3-theme-background);
        height: 48.5px;

        & > .b3-menu__label {
          line-height: 32.5px;
        }
      }

      &__separator {
        margin: 0;
        height: 24px;
        background-color: var(--b3-menu-background);
        border-bottom: .5px solid var(--b3-theme-background-light);
      }

      &__label {
        font-size: 17px;
        white-space: break-spaces;
        line-height: 26px;
        margin: 8px 0;
      }

      &__icon {
        height: 17px;
        width: 17px;
        margin: 0 16px 0 8px;

        &--arrow {
          width: 12px;
          margin: 0 8px 0 16px;
        }
      }
    }
  }

  &--list {
    overflow: auto;
    max-height: 70vh;

    .b3-menu__label {
      @include text-clamp(1);
      max-width: 30vw;
      white-space: nowrap;
      overflow: hidden;
      -webkit-mask-image: linear-gradient(to left, rgba(0, 0, 0, 0) 0, #000 12px);
    }
  }

  &__items {
    max-height: 80vh;
    overflow: auto;
    padding: 0 8px;
  }

  &__item {
    padding: 0 8px;
    border-radius: var(--b3-border-radius);
    user-select: none;
    display: flex;
    line-height: 30px;
    cursor: pointer;
    white-space: nowrap;
    border: 0;
    text-align: left;
    width: 100%;
    background-color: var(--b3-menu-background);
    color: var(--b3-theme-on-background);
    position: relative;
    box-sizing: border-box;
    margin: 1px 0;

    &[disabled="disabled"] {
      cursor: not-allowed;

      & > *:not(.b3-menu__submenu) {
        opacity: 0.38;
      }
    }

    &--show {
      background-color: var(--b3-list-hover);

      & > .b3-menu__submenu {
        display: block;

        &--row {
          display: flex;
          box-sizing: border-box;
          flex-wrap: wrap;
          flex-direction: row;
          width: 312px;
          padding: 4px;
          align-content: flex-start;

          .b3-menu__item {
            width: auto;
            height: 32px;
            padding: 8px;
          }

          .b3-menu__label {
            min-width: auto;
          }

          .b3-menu__separator {
            background-color: transparent;
            margin: 2px 0;
          }
        }
      }
    }

    &--selected {
      color: var(--b3-theme-primary);
    }

    &--current {
      background-color: var(--b3-list-hover);

      & > .b3-menu__action {
        opacity: .68;
      }
    }

    &--readonly {
      cursor: auto;
      color: var(--b3-theme-on-surface);
      max-width: 374px;
      white-space: normal;
      word-break: break-all;
      line-height: 16px;
      margin: 4px 0;
    }

    &--disabled {
      opacity: .38;
      cursor: not-allowed;
    }
  }

  &__action {
    opacity: 0;
    width: 16px;
    height: 16px;
    align-self: center;
    margin-left: 8px;
    color: var(--b3-theme-on-surface);

    &:hover {
      opacity: 1;
      color: var(--b3-theme-on-background);
    }
  }

  &__label {
    flex: 1;
    min-width: 84px;
  }

  &__icon {
    align-self: center;
    height: 14px;
    width: 14px;
    line-height: 14px;
    margin-right: 8px;
    color: var(--b3-theme-on-surface);
    flex-shrink: 0;

    &--arrow {
      margin: 0 0 0 8px;
      height: 10px;
    }
  }

  &__separator {
    background-color: var(--b3-theme-surface-lighter);
    height: 1px;
    margin: 4px 0;
    display: block;
    border: 0;
    width: 100%;
    box-sizing: border-box;
    padding: 0;
  }

  &__submenu {
    overflow: auto;
    display: none;
    max-height: 80vh;
    border: 1px solid var(--b3-theme-surface-lighter);
    border-radius: var(--b3-border-radius-b);
    background-color: var(--b3-menu-background);
    padding: 8px 0;
    position: fixed;
    box-shadow: var(--b3-dialog-shadow);
    z-index: 1;
  }

  &__accelerator {
    font-size: 0.75rem;
    margin-left: 16px;
    color: var(--b3-theme-on-surface);
    font-family: Consolas, Monaco, monospace;
  }

  // for protyle hint
  &__emoji {
    font-size: 20px;
    float: left;
    margin-right: 8px;
    font-family: var(--b3-font-family-emoji);

    img, svg {
      width: 20px;
      height: 20px;
      float: left;
    }
  }
}

.emojis {
  word-break: break-all;
  white-space: normal;
  display: flex;
  flex-direction: column;
  padding: 8px 0;
  height: 100%;
  box-sizing: border-box;

  &__item {
    font-size: 24px;
    line-height: 28px;
    font-family: var(--b3-font-family-emoji);
    text-align: center;
    height: 28px;
    padding: 2px 4px;
    cursor: pointer;
    display: inline-block;
    transition: var(--b3-transition);
    background-color: transparent;
    border: 0;
    margin: 1px;
    overflow: hidden;

    img, svg {
      height: 24px;
      display: block;
      width: 24px;
    }

    &--current,
    &:hover {
      background: var(--b3-list-hover);
      border-radius: var(--b3-border-radius);
    }
  }

  &__title {
    color: var(--b3-theme-on-surface);
    padding: 8px 4px 4px 4px;
  }

  &__panel {
    flex: 1;
    overflow: auto;
    padding: 0 8px;
  }

  &__content {
    display: flex;
    flex-wrap: wrap;
  }

  &__type {
    cursor: pointer;
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    height: 28px;
    line-height: 28px;
    transition: var(--b3-list-hover);
    font-size: 16px;
    background-color: transparent;
    border: 0;
    padding: 0;

    &:hover {
      background-color: var(--b3-theme-surface-lighter);
    }

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