/* QWQ 表情包库：父级严格继承世界书 parent-page 骨架；分组卡每行四个，独立分组页同样四列。 */
#page-sticker-library,
#page-sticker-group {
  --sticker-card-radius: 17px;
  --sticker-preview-radius: 17px;
  --sticker-info-height: 48px;
}

.sticker-library-menu {
  position: absolute;
  top: calc(100% - 4.4px);
  right: 0;
  z-index: var(--layer-popover);
  width: min(132px, 44vw);
  padding: 4.4px;
  border: 1px solid var(--ui-line);
  border-radius: 15.4px;
  background: var(--parent-card-bg);
  box-shadow: 0 11px 26.4px rgba(0,0,0,.11);
}
.sticker-library-menu[hidden] { display: none; }
.sticker-library-menu-item {
  position: relative;
  width: 100%;
  min-height: 35.2px;
  padding: 5.5px 6.6px;
  border: 0;
  border-radius: 11px;
  display: flex;
  align-items: center;
  gap: 6.6px;
  background: transparent;
  color: var(--parent-text);
  font-size: calc(11.55px * var(--display-scale));
  font-weight: 600;
  text-align: left;
  cursor: pointer;
  transition: transform .16s ease, background-color .16s ease;
}
.sticker-library-menu-item:hover { background: var(--ui-surface-secondary); }
.sticker-library-menu-item:active { transform: scale(.97); }
.sticker-library-menu-item + .sticker-library-menu-item::before {
  content: "";
  position: absolute;
  top: 0;
  left: 26.4px;
  right: 5.5px;
  height: 1px;
  background: var(--ui-line);
  opacity: .48;
}
.sticker-library-menu-item svg { width: 13.2px; height: 13.2px; flex: 0 0 13.2px; }

.sticker-pack-grid {
  width: 100%;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px 8px;
  align-items: start;
}
.sticker-pack-card {
  position: relative;
  min-width: 0;
  width: 100%;
  justify-self: center;
  padding: 0;
  border: 0;
  border-radius: var(--sticker-card-radius);
  overflow: hidden;
  background: transparent;
  color: var(--parent-text);
  text-align: left;
  cursor: pointer;
  box-shadow: 0 5px 14px rgba(0,0,0,.075);
  transition: transform .16s ease, opacity .16s ease, box-shadow .16s ease;
  -webkit-tap-highlight-color: transparent;
}
.sticker-pack-card:active { transform: scale(.975); }
.sticker-pack-card.is-selected { opacity: .72; box-shadow: 0 4px 14px rgba(0,0,0,.07); }
.sticker-pack-preview {
  position: relative;
  width: 100%;
  aspect-ratio: 1 / 1;
  padding: 6px 6px 12px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  grid-template-rows: repeat(2, minmax(0, 1fr));
  gap: 4px;
  overflow: hidden;
  background:
    radial-gradient(circle at 18% 15%, rgba(255,255,255,.72), transparent 32%),
    linear-gradient(145deg, #efefef, #d8d8d8);
}
.sticker-pack-preview::after {
  content: "";
  position: absolute;
  inset: auto 0 0;
  height: 20px;
  background: linear-gradient(to bottom, transparent, rgba(0,0,0,.06));
  pointer-events: none;
}
.sticker-pack-preview-cell {
  position: relative;
  min-width: 0;
  min-height: 0;
  border-radius: 8px;
  overflow: hidden;
  background: rgba(255,255,255,.42);
  display: grid;
  place-items: center;
}
.sticker-pack-preview-cell img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: contain;
  background: rgba(255,255,255,.22);
}
.sticker-pack-preview-cell.is-empty::before {
  content: "";
  width: 22%;
  aspect-ratio: 1;
  border: 1.5px solid rgba(0,0,0,.15);
  border-radius: 50%;
}
.sticker-pack-info {
  position: relative;
  z-index: 2;
  min-height: var(--sticker-info-height);
  margin-top: -5px;
  padding: 12px 7px 7px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 2px;
  background: #fff;
  color: #0a0a0a;
}
/* 预览与白色信息区之间只有一条连续、平滑的上拱边界；禁止拆成左右两段圆包。 */
.sticker-pack-info::before {
  content: "";
  position: absolute;
  z-index: 0;
  top: -8px;
  left: -9%;
  width: 118%;
  height: 16px;
  border-top: 1px solid rgba(0,0,0,.055);
  border-radius: 50% 50% 0 0 / 100% 100% 0 0;
  background: #fff;
  pointer-events: none;
}
.sticker-pack-name,
.sticker-pack-count { position: relative; z-index: 1; }
.sticker-pack-name {
  overflow: hidden;
  font-size: calc(9.5px * var(--display-scale));
  font-weight: 760;
  line-height: 1.25;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.sticker-pack-count {
  color: #7b7b80;
  font-size: calc(8.8px * var(--display-scale));
  line-height: 1.3;
}
.sticker-pack-select,
.sticker-item-select {
  position: absolute;
  z-index: 5;
  width: 21px;
  height: 21px;
  margin: 0;
  accent-color: #000;
  pointer-events: none;
}
.sticker-pack-select { top: 7px; right: 7px; }

.sticker-group-directory {
  width: 100%;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px 8px;
  align-content: start;
}
.sticker-item-card {
  position: relative;
  min-width: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--parent-text);
  text-align: center;
  cursor: pointer;
  transition: transform .16s ease, opacity .16s ease;
  -webkit-tap-highlight-color: transparent;
}
.sticker-item-card:active { transform: scale(.96); }
.sticker-item-card.is-selected { opacity: .62; }
.sticker-item-preview {
  width: 100%;
  aspect-ratio: 1;
  border: 1px solid var(--ui-line);
  border-radius: 15px;
  overflow: hidden;
  display: grid;
  place-items: center;
  background: var(--parent-card-bg);
  box-shadow: var(--global-section-shadow);
}
.sticker-item-preview img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: contain;
}
.sticker-item-name {
  margin-top: 7px;
  padding: 0 3px;
  overflow: hidden;
  color: var(--ui-muted);
  font-size: calc(10.8px * var(--display-scale));
  line-height: 1.3;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.sticker-item-select { top: 7px; right: 7px; }

.sticker-empty {
  margin: auto;
  padding: 42px 20px;
  color: var(--ui-muted);
  font-size: calc(13px * var(--display-scale));
  line-height: 1.65;
  text-align: center;
}

.sticker-manage-toolbar {
  position: absolute;
  left: 50%;
  bottom: max(16px, env(safe-area-inset-bottom));
  z-index: var(--layer-popover);
  width: min(calc(100% - (var(--global-page-inline) * 2)), 560px);
  padding: 8px;
  border: 1px solid var(--ui-line);
  border-radius: 22px;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
  background: color-mix(in srgb, var(--parent-card-bg) 92%, transparent);
  box-shadow: 0 14px 34px rgba(0,0,0,.15);
  backdrop-filter: blur(18px) saturate(118%);
  -webkit-backdrop-filter: blur(18px) saturate(118%);
  transform: translateX(-50%);
}
.sticker-manage-toolbar .ui-action-button {
  min-height: 42px;
  padding: 8px 6px;
  border-radius: 15px;
  gap: 5px;
  font-size: calc(11px * var(--display-scale));
}
.sticker-manage-toolbar .ui-action-button svg { width: 13px; height: 13px; }
.sticker-page-list.has-management-toolbar { padding-bottom: calc(86px + env(safe-area-inset-bottom)); }

.sticker-import-help {
  margin: 0 0 10px;
  color: var(--ui-muted);
  font-size: calc(11px * var(--display-scale));
  line-height: 1.55;
}
.sticker-bulk-input {
  width: 100%;
  min-height: 210px;
  padding: 13px 14px;
  border: 1px solid var(--ui-line);
  border-radius: 17px;
  outline: none;
  resize: vertical;
  background: var(--ui-surface-secondary);
  color: var(--parent-text);
  font: inherit;
  font-size: calc(12px * var(--display-scale));
  line-height: 1.55;
  -webkit-tap-highlight-color: transparent;
}
.sticker-bulk-input:focus { border-color: color-mix(in srgb, var(--parent-text) 48%, var(--ui-line)); }
.sticker-import-error {
  min-height: 18px;
  margin: 7px 2px 0;
  color: #b3261e;
  font-size: calc(10.5px * var(--display-scale));
  line-height: 1.4;
}

/* 聊天中的表情包选择器：使用全局抽屉容器，不创建第二套弹窗皮肤。 */
.sticker-picker-tabs {
  display: flex;
  gap: 7px;
  overflow-x: auto;
  padding: 1px 0 10px;
}
.sticker-picker-tab {
  flex: 0 0 auto;
  min-height: 34px;
  padding: 0 13px;
  border: 1px solid var(--ui-line);
  border-radius: 999px;
  background: var(--parent-card-bg);
  color: var(--parent-text);
  font-size: calc(11px * var(--display-scale));
  font-weight: 650;
}
.sticker-picker-tab.is-active { background: var(--parent-text); color: var(--parent-card-bg); border-color: var(--parent-text); }
.sticker-picker-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0,1fr));
  gap: 10px;
}
.sticker-picker-item {
  min-width: 0;
  padding: 4px;
  border: 0;
  border-radius: 15px;
  background: var(--ui-surface-secondary);
  color: var(--parent-text);
}
.sticker-picker-item img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: contain;
  display: block;
}
.sticker-picker-item span {
  display: block;
  margin-top: 4px;
  overflow: hidden;
  font-size: calc(9.5px * var(--display-scale));
  white-space: nowrap;
  text-overflow: ellipsis;
}

.qq-chat-sticker-bubble {
  width: min(164px, 44vw);
  padding: 6px;
  border-radius: 18px;
  background: transparent;
}
.qq-chat-sticker-bubble img {
  width: 100%;
  max-height: 176px;
  display: block;
  object-fit: contain;
}
.qq-chat-sticker-caption {
  margin-top: 4px;
  color: var(--ui-muted);
  font-size: 10px;
  line-height: 1.3;
  text-align: center;
}

@media (max-width: 350px) {
  .sticker-pack-grid,
  .sticker-group-directory { gap: 10px 6px; }
  .sticker-pack-info { padding-left: 6px; padding-right: 6px; }
}
