#chat-tabbar {
  display: flex;
  align-items: flex-start;
  gap: 4px;
  flex: none;
  min-width: 0;
}
#chat-tabbar #chat-tabs {
  flex: 1;
  min-width: 0;
  flex-wrap: nowrap;
  overflow-x: auto;
  scrollbar-width: thin;
}
#chat-tabbar #chat-tabs button {
  flex-shrink: 0;
}
#game #chat #chat-tabs button[data-closed] {
  display: none !important;
}
#messages[data-zh-off] > [data-ch=zh] {
  display: none !important;
}
#chat-tabbar .chat-tab-scroll {
  flex: none;
  align-self: stretch;
  min-width: 24px;
  min-height: 30px;
  padding: 0 4px;
  margin: 0;
  font: 700 20px var(--read);
}
#chat-tabbar .chat-tab-scroll[hidden] {
  display: none !important;
}
#chat-tabbar .chat-tab-scroll:disabled {
  opacity: .35;
}
#game[data-pvl-clean-ui=true] #chat .chat-tab-scroll {
  background: transparent;
  border: 1px solid var(--pvlc-line,#a89164);
  border-radius: 4px;
  color: var(--pvlc-gold,#e3c88b);
  box-shadow: none;
}
#chat-tab-editor .chat-visible-tabs {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-bottom: 10px;
}
#chat-tab-editor details {
  margin-top: 16px;
  border-top: 1px solid #b6a17b;
  padding-top: 10px;
}
#chat-tab-editor summary {
  cursor: pointer;
  font-weight: 800;
  min-height: 28px;
}
#chat-tabs [data-custom-tab] {
  max-width: 145px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
#chat-manage-tabs {
  flex: none;
  min-height: 22px;
  padding: 1px 7px;
  margin: 0;
  font: 800 11px var(--read);
}
#game #chat #chatline #chat-manage-tabs {
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  flex: 0 0 28px !important;
  width: 28px !important;
  height: 28px;
  min-width: 28px;
  min-height: 28px;
  padding: 0 !important;
  margin: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
  color: inherit;
}
#chat-manage-tabs .px-icon {
  width: 16px;
  height: 16px;
  pointer-events: none;
}
#chat-tab-editor .chat-tab-order {
  margin-top: 12px;
}
.chat-order-row {
  display: flex;
  gap: 6px;
  align-items: center;
  padding: 3px 0;
}
.chat-order-row > span {
  flex: 1;
  min-width: 0;
  overflow-wrap: anywhere;
}
#chat-tab-editor .chat-order-row button {
  min-width: 38px;
  font-size: 18px;
}
#chat-tab-editor .chat-order-row button:disabled {
  opacity: .35;
}
#chat-tabs button.chat-tab-dragging {
  outline: 2px dashed #e4b953;
  outline-offset: -2px;
  opacity: .7;
}
#chat-custom-target {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: none;
  margin: 3px 2px 5px;
  color: #fff0c7;
  font: 700 12px var(--read);
}
#chat-custom-target[hidden] {
  display: none;
}
#chat-custom-send {
  max-width: 100%;
  padding: 3px 6px;
  font: 700 12px var(--read);
}
#messages[data-show^=custom-] > [data-ch] {
  display: none;
}
#messages[data-show^=custom-][data-include~=chat] > [data-ch=chat],
#messages[data-show^=custom-][data-include~=world] > [data-ch=world],
#messages[data-show^=custom-][data-include~=trade] > [data-ch=trade],
#messages[data-show^=custom-][data-include~=zh] > [data-ch=zh],
#messages[data-show^=custom-][data-include~=guild] > [data-ch=guild],
#messages[data-show^=custom-][data-include~=party] > [data-ch=party],
#messages[data-show^=custom-][data-include~=private] > [data-ch=private],
#messages[data-show^=custom-][data-include~=game] > [data-ch=game],
#messages[data-show^=custom-][data-include~=world] > [data-find] {
  display: block;
}
#chat-tab-editor {
  box-sizing: border-box;
  width: 460px;
  max-width: calc(100vw - 24px);
  max-height: calc(100dvh - 24px);
  overflow: auto;
  border: 3px solid var(--ink);
  border-radius: 8px;
  padding: 18px;
  background: var(--parchment);
  color: var(--ink);
  font: 14px/1.4 var(--read);
}
#chat-tab-editor::backdrop {
  background: #0c191e80;
}
#chat-tab-editor h2 {
  margin: 0;
  font: 800 20px var(--read);
}
#chat-tab-editor p {
  margin: 9px 0;
}
#chat-tab-editor form > label {
  display: block;
  font-weight: 800;
}
#custom-chat-name {
  box-sizing: border-box;
  width: 100%;
  font: 16px var(--read);
  margin: 5px 0 12px;
  padding: 8px;
}
#chat-tab-editor fieldset {
  border: 1px solid #b6a17b;
  border-radius: 5px;
  margin: 0;
  padding: 8px 12px;
}
#chat-tab-editor legend {
  font-weight: 800;
}
#chat-tab-editor fieldset label {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 32px;
  cursor: pointer;
}
#chat-tab-editor input[type=checkbox] {
  width: 18px;
  height: 18px;
  flex: none;
}
.custom-chat-list,
.custom-chat-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin: 12px 0 0;
}
.custom-chat-list {
  margin: 10px 0 14px;
}
.custom-chat-list button {
  overflow-wrap: anywhere;
  max-width: 100%;
}
#chat-tab-editor button {
  font: 700 13px var(--read);
  min-height: 34px;
  margin: 0;
}
#chat-tab-editor [hidden] {
  display: none;
}
#custom-chat-error {
  color: #9b2b26;
  font-weight: 700;
}
#custom-chat-error:empty {
  display: none;
}
@media (pointer: coarse) {
  #chat:not(.open) #chat-tabbar,
  #chat:not(.open) #chat-custom-target,
  #chat.open.compact #chat-tabbar {
    display: none;
  }
  #chat-tabbar #chat-tabs {
    flex-wrap: nowrap;
    overflow-x: auto;
    scrollbar-width: thin;
  }
  #chat-manage-tabs {
    min-height: 44px;
    font-size: 12px;
    padding: 5px 8px;
  }
  #game #chat #chatline #chat-manage-tabs {
    flex-basis: 44px !important;
    width: 44px !important;
    height: 44px;
    min-width: 44px;
    min-height: 44px;
  }
  #chat-custom-send {
    min-height: 36px;
  }
  #chat-tab-editor button,
  #chat-tab-editor fieldset label {
    min-height: 44px;
  }
}
