/* ========== 看板娘切换面板 ========== */
#live2d-switch-panel {
  position: fixed;
  left: 310px;
  bottom: 20px;
  z-index: 10001;
  display: flex;
  flex-direction: column;
  gap: 6px;
  transition: opacity 0.3s ease, transform 0.3s ease;
  opacity: 0;
  transform: translateY(10px);
  pointer-events: none;
}

#live2d-switch-panel.active {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

#live2d-switch-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.2);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
  color: #fff;
  font-size: 18px;
  line-height: 1;
  padding: 0;
  outline: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
}

#live2d-switch-btn:hover {
  background: rgba(0, 0, 0, 0.7);
  border-color: rgba(255, 255, 255, 0.4);
  transform: scale(1.1);
}

#live2d-switch-btn:active {
  transform: scale(0.95);
}

#live2d-switch-btn svg {
  width: 18px;
  height: 18px;
  fill: currentColor;
}

#live2d-model-list {
  display: none;
  flex-direction: column;
  gap: 4px;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 10px;
  padding: 8px;
  max-height: 300px;
  overflow-y: auto;
  min-width: 140px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

#live2d-model-list.show {
  display: flex;
}

#live2d-model-list::-webkit-scrollbar {
  width: 4px;
}

#live2d-model-list::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.2);
  border-radius: 2px;
}

#live2d-model-list::-webkit-scrollbar-track {
  background: transparent;
}

/* Firefox scrollbar */
#live2d-model-list {
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.2) transparent;
}

.live2d-model-item {
  padding: 8px 14px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 13px;
  color: rgba(255, 255, 255, 0.85);
  transition: all 0.2s ease;
  white-space: nowrap;
  text-align: center;
  border: 1px solid transparent;
  background: transparent;
  font-family: inherit;
  outline: none;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  -webkit-user-select: none;
}

.live2d-model-item:hover {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.2);
  color: #fff;
}

.live2d-model-item:active {
  background: rgba(255, 255, 255, 0.2);
  transform: scale(0.97);
}

.live2d-model-item.active {
  background: rgba(64, 158, 255, 0.3);
  border-color: rgba(64, 158, 255, 0.5);
  color: #fff;
  font-weight: 500;
}

/* ========== 手机端适配 ========== */
@media (max-width: 768px) {
  #waifu {
    transform: translateY(25px) scale(0.65) !important;
    transform-origin: left bottom;
    left: 0 !important;
    bottom: -500px !important;
  }

  #waifu.waifu-active {
    bottom: 0 !important;
  }

  #waifu-tips {
    font-size: 11px !important;
    padding: 6px 10px !important;
    max-width: 180px !important;
  }

  #waifu-tool {
    right: -8px !important;
    bottom: 0 !important;
  }

  #waifu-tool span {
    width: 22px !important;
    height: 22px !important;
    font-size: 12px !important;
  }

  #waifu-tool span svg {
    width: 12px !important;
    height: 12px !important;
  }

  #live2d-switch-panel {
    left: 10px !important;
    bottom: 10px !important;
  }

  #live2d-switch-btn {
    width: 32px !important;
    height: 32px !important;
    font-size: 16px !important;
  }

  #live2d-model-list {
    max-height: 220px !important;
    min-width: 120px !important;
    padding: 6px !important;
    gap: 2px !important;
  }

  .live2d-model-item {
    padding: 7px 10px !important;
    font-size: 12px !important;
  }
}

/* ========== 小屏手机适配 ========== */
@media (max-width: 480px) {
  #waifu {
    transform: translateY(25px) scale(0.5) !important;
    transform-origin: left bottom;
  }

  #waifu-tips {
    font-size: 10px !important;
    max-width: 150px !important;
  }

  #live2d-switch-panel {
    left: 2px !important;
    bottom: 2px !important;
  }

  #live2d-switch-btn {
    width: 28px !important;
    height: 28px !important;
  }

  #live2d-model-list {
    max-height: 180px !important;
    min-width: 110px !important;
  }

  .live2d-model-item {
    padding: 6px 8px !important;
    font-size: 11px !important;
  }
}

/* ========== Firefox 特定适配 ========== */
@-moz-document url-prefix() {
  #live2d-switch-btn {
    backdrop-filter: blur(8px);
  }

  #live2d-model-list {
    backdrop-filter: blur(12px);
  }

  /* Firefox 中 canvas 抗锯齿 */
  #live2d {
    image-rendering: auto;
  }
}