/**
 * 全站主题快捷浮标：可拖拽、可贴边隐藏
 */
#lhSkinFab {
  position: fixed;
  z-index: 13500;
  right: 10px;
  bottom: calc(96px + env(safe-area-inset-bottom, 0px));
  left: auto;
  top: auto;
  width: 0;
  height: 0;
  pointer-events: none;
  font-family: system-ui, -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif;
}

#lhSkinFab * {
  pointer-events: auto;
  box-sizing: border-box;
}

.lh-skin-fab__edge {
  display: none;
  position: absolute;
  right: 0;
  bottom: 0;
  width: 10px;
  min-height: 56px;
  border-radius: 8px 0 0 8px;
  background: rgba(15, 23, 42, 0.78);
  color: #fff;
  align-items: center;
  justify-content: center;
  writing-mode: vertical-rl;
  text-orientation: mixed;
  font-size: 11px;
  letter-spacing: 0.12em;
  cursor: pointer;
  box-shadow: -2px 0 10px rgba(0, 0, 0, 0.12);
  -webkit-tap-highlight-color: transparent;
}

.lh-skin-fab--hidden .lh-skin-fab__edge {
  display: flex;
}

.lh-skin-fab--hidden .lh-skin-fab__dock,
.lh-skin-fab--hidden .lh-skin-fab__panel {
  display: none !important;
}

.lh-skin-fab__dock {
  position: absolute;
  right: 0;
  bottom: 0;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 6px;
  width: 48px;
  padding: 8px 6px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid rgba(15, 23, 42, 0.1);
  box-shadow: 0 10px 28px rgba(15, 23, 42, 0.14);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.lh-skin-fab__drag,
.lh-skin-fab__main,
.lh-skin-fab__hide {
  border: 0;
  margin: 0;
  padding: 0;
  border-radius: 12px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 700;
  color: #0f172a;
  background: rgba(241, 245, 249, 0.95);
  line-height: 1;
  min-height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  -webkit-tap-highlight-color: transparent;
}

.lh-skin-fab__drag {
  font-size: 11px;
  letter-spacing: -0.05em;
  color: #64748b;
  cursor: grab;
  user-select: none;
}

.lh-skin-fab__drag:active {
  cursor: grabbing;
}

.lh-skin-fab__main {
  font-size: 20px;
  background: linear-gradient(145deg, #eef2ff, #e0e7ff);
  border: 1px solid rgba(99, 102, 241, 0.25);
}

.lh-skin-fab__hide {
  font-size: 18px;
  font-weight: 800;
  color: #94a3b8;
  background: transparent;
}

.lh-skin-fab__panel {
  display: none;
  position: absolute;
  right: 56px;
  bottom: 0;
  width: min(92vw, 320px);
  max-height: min(62vh, 420px);
  overflow: hidden auto;
  padding: 12px 12px 10px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.98);
  border: 1px solid rgba(15, 23, 42, 0.1);
  box-shadow: 0 16px 40px rgba(15, 23, 42, 0.16);
  -webkit-overflow-scrolling: touch;
}

.lh-skin-fab__panel.is-open {
  display: block;
}

.lh-skin-fab__panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
}

.lh-skin-fab__panel-title {
  font-size: 14px;
  font-weight: 800;
  color: #0f172a;
}

.lh-skin-fab__panel-close {
  border: 0;
  background: transparent;
  color: #64748b;
  font-size: 20px;
  line-height: 1;
  padding: 4px 8px;
  cursor: pointer;
}

.lh-skin-fab__grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.lh-skin-fab__chip {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 8px 4px;
  border-radius: 12px;
  border: 1px solid rgba(15, 23, 42, 0.08);
  background: #fff;
  cursor: pointer;
  font-size: 11px;
  font-weight: 600;
  color: #0f172a;
  position: relative;
  -webkit-tap-highlight-color: transparent;
}

.lh-skin-fab__chip:active {
  transform: scale(0.98);
}

.lh-skin-fab__chip.is-active {
  border-color: rgba(79, 70, 229, 0.45);
  box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.18);
}

.lh-skin-fab__chip-badge {
  position: absolute;
  top: -2px;
  right: -2px;
  font-size: 9px;
  font-weight: 800;
  color: #fff;
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  padding: 2px 4px;
  border-radius: 6px;
  line-height: 1;
}

.lh-skin-fab__swatch {
  width: 100%;
  aspect-ratio: 1;
  max-width: 36px;
  border-radius: 10px;
  box-shadow: inset 0 0 0 1px rgba(15, 23, 42, 0.06);
}

@media (max-width: 360px) {
  .lh-skin-fab__grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* 主 Tab 页：浮标改到左侧，避免挡住右下角「我的」 */
html body.page-tab-create #lhSkinFab,
html body.page-tab-agent #lhSkinFab,
html body.page-tab-assistant #lhSkinFab,
html body.page-tab-mine #lhSkinFab,
html body.page-tab-template #lhSkinFab {
  left: 10px;
  right: auto;
}

html body.page-tab-create .lh-skin-fab__dock,
html body.page-tab-agent .lh-skin-fab__dock,
html body.page-tab-assistant .lh-skin-fab__dock,
html body.page-tab-mine .lh-skin-fab__dock,
html body.page-tab-template .lh-skin-fab__dock {
  right: auto;
  left: 0;
}

html body.page-tab-create .lh-skin-fab__panel,
html body.page-tab-agent .lh-skin-fab__panel,
html body.page-tab-assistant .lh-skin-fab__panel,
html body.page-tab-mine .lh-skin-fab__panel,
html body.page-tab-template .lh-skin-fab__panel {
  right: auto;
  left: 56px;
}

html body.page-tab-create .lh-skin-fab__edge,
html body.page-tab-agent .lh-skin-fab__edge,
html body.page-tab-assistant .lh-skin-fab__edge,
html body.page-tab-mine .lh-skin-fab__edge,
html body.page-tab-template .lh-skin-fab__edge {
  right: auto;
  left: 0;
  border-radius: 0 8px 8px 0;
  box-shadow: 2px 0 10px rgba(0, 0, 0, 0.12);
}
