.b3-menu {
  position: fixed;
  border-radius: 4px;
  box-shadow: var(--b3-dialog-shadow);
  border: 1px solid var(--b3-theme-surface-lighter);
  background-color: var(--b3-menu-background);
  padding: 8px;
  z-index: 210;
  max-height: 80vh;
  overflow: auto;

  &::-webkit-scrollbar {
    display: none;
  }

  &--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);
    }
  }

  &__item {
    padding: 0 8px;
    border-radius: 4px;
    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;

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

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

      & > .b3-menu__submenu {
        display: block;

        &--row {
          display: flex;
          flex-wrap: wrap;
          flex-direction: row;
          width: 312px;
          padding: 4px;

          .b3-menu__icon {
            display: none;
          }

          .b3-menu__item {
            width: auto;
            padding: 4px;
          }

          .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: 1;
      }
    }

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

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

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

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

  &__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);

    // 分屏下拉的页签列表
    & > svg,
    & > img {
      float: left;
      height: 14px;
      width: 14px;
    }

    &--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: 4px;
    background-color: var(--b3-menu-background);
    padding: 8px;
    position: fixed;
    box-shadow: var(--b3-dialog-shadow);
    z-index: 1;

    &::-webkit-scrollbar {
      display: none;
    }
  }

  &__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;
  height: 50vh;
  padding: 0;
  display: flex;
  flex-direction: column;
  max-height: 386px;

  &__item {
    font-size: 24px;
    line-height: 24px;
    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: 0;
    overflow: hidden;

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

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

  &__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;

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

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