* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: "微软雅黑", "Microsoft YaHei", -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 14px;
  background-color: #0f1118;
  background-image: 
    radial-gradient(circle at 25% 25%, rgba(102, 126, 234, 0.1) 0%, transparent 50%),
    radial-gradient(circle at 75% 75%, rgba(118, 75, 162, 0.1) 0%, transparent 50%);
  color: #e0e0e5;
  line-height: 1.6;
  padding: 0;
  margin: 0 auto;
  max-width: 1920px;
  padding-top: 30px;
  opacity: 0;
  animation: fadeIn 0.3s ease forwards;
}

@keyframes fadeIn {
  to {
    opacity: 1;
  }
}

/* 搜索容器 */
.search-container {
  max-width: 800px;
  margin: 30px auto;
  padding: 0 12px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
  align-items: center;
}

.search-input-wrapper {
  flex: 1;
  min-width: 280px;
  position: relative;
}

.inner-search-select {
  position: absolute;
  left: 4px;
  top: 50%;
  transform: translateY(-50%);
  height: calc(100% - 8px);
  width: 90px;
  padding: 0 12px;
  padding-right: 25px;
  border: none;
  border-radius: 25px;
  background-color: rgba(25, 27, 40, 0.8);
  color: #a0a0ff;
  font-weight: 600;
  font-size: 14px;
  box-shadow: inset 0 0 0 1px rgba(102, 126, 234, 0.3);
  appearance: none;
  cursor: pointer;
  z-index: 2;
  transition: all 0.3s ease;
}

.inner-search-select:focus {
  outline: none;
  box-shadow: 0 0 0 2px rgba(102, 126, 234, 0.2);
}

.search-input-wrapper::after {
  content: "▼";
  position: absolute;
  left: 75px;
  top: 50%;
  transform: translateY(-50%);
  color: #667eea;
  font-size: 9px;
  pointer-events: none;
  z-index: 3;
  transition: all 0.3s ease;
}

.search-input-wrapper:hover::after {
  color: #764ba2;
}

#search-input {
  width: 100%;
  padding: 12px 18px;
  padding-left: 100px;
  border: none;
  border-radius: 30px;
  font-size: 15px;
  background-color: rgba(25, 27, 40, 0.8);
  color: #e0e0e5;
  box-shadow: 0 0 15px rgba(102, 126, 234, 0.1), 
              inset 0 0 0 1px rgba(102, 126, 234, 0.3);
  transition: all 0.3s ease;
}

#search-input:focus {
  outline: none;
  box-shadow: 0 0 20px rgba(102, 126, 234, 0.3), 
              inset 0 0 0 1px rgba(102, 126, 234, 0.5);
  transform: scale(1.02);
}

.search-btn {
  padding: 12px 20px;
  border: none;
  border-radius: 30px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  flex-shrink: 0;
  min-width: 80px;
  font-size: 14px;
  position: relative;
  overflow: hidden;
}

.search-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(118, 75, 162, 0.2);
}

.search-btn::after {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: linear-gradient(
    to right,
    rgba(255, 255, 255, 0) 0%,
    rgba(255, 255, 255, 0.3) 50%,
    rgba(255, 255, 255, 0) 100%
  );
  transform: rotate(30deg);
  animation: shine 3s infinite;
}

@keyframes shine {
  0% { transform: translateX(-100%) rotate(30deg); }
  100% { transform: translateX(100%) rotate(30deg); }
}

.inner-search-select option {
  background-color: #191b28;
  color: #e0e0e5;
  padding: 8px 12px;
  font-weight: 500;
}

.inner-search-select option:checked {
  background-color: #2a2d40;
  color: #667eea;
}

/* 分类网格 */
.category-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(clamp(280px, 100%, 320px), 1fr));
  gap: 16px;
  padding: 0 12px 40px;
  max-width: 1800px;
  margin: 0 auto;
}

.category-card {
  background-color: rgba(25, 27, 40, 0.6);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(102, 126, 234, 0.15);
  border-radius: 12px;
  padding: 16px;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.3);
  transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  height: 100%;
  display: flex;
  flex-direction: column;
}

.category-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 15px 35px rgba(102, 126, 234, 0.15),
              0 8px 20px rgba(0, 0, 0, 0.4);
  border-color: rgba(102, 126, 234, 0.3);
}

.category-title-container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  font-size: clamp(16px, 3vw, 18px);
  color: #9d8aff;
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid rgba(102, 126, 234, 0.15);
}

.category-title-text {
  display: flex;
  align-items: center;
  gap: 6px;
  font-weight: 600;
}

.category-title-text::before {
  content: "✨";
  font-size: 18px;
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.2); }
}

/* 开关样式 */
.integrated-switch {
  position: relative;
  display: inline-block;
  width: 70px;
  height: 28px;
  cursor: pointer;
}

.integrated-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.switch-track {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(30, 33, 50, 0.8);
  border: 1px solid rgba(102, 126, 234, 0.2);
  border-radius: 28px;
  transition: all 0.4s cubic-bezier(0.23, 1, 0.32, 1);
  box-shadow: inset 0 2px 6px rgba(0, 0, 0, 0.1);
  overflow: hidden;
}

.switch-inner {
  position: absolute;
  top: 0;
  left: 0;
  width: 200%;
  height: 100%;
  transition: all 0.4s cubic-bezier(0.23, 1, 0.32, 1);
}

.switch-active, .switch-inactive {
  position: absolute;
  top: 0;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 600;
  color: white;
  user-select: none;
  width: 50%;
}

.switch-inactive {
  left: 0;
  padding-left: 8px;
}

.switch-active {
  right: 0;
  padding-right: 8px;
}

.switch-thumb {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 24px;
  height: 24px;
  background-color: white;
  border-radius: 50%;
  transition: all 0.4s cubic-bezier(0.23, 1, 0.32, 1);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
  z-index: 2;
}

input:checked + .switch-track {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

input:checked + .switch-track .switch-inner {
  transform: translateX(-50%);
}

input:checked + .switch-track .switch-thumb {
  transform: translateX(40px);
}

.switch-track {
  background: #f0f0f0;
}

.switch-inactive {
  color: #666;
}

.switch-active {
  color: white;
}

/* 链接样式 - 核心优化：放大图标+限制不溢出 */
.link-group {
  display: grid;
  grid-template-columns: repeat(5, 1fr); /* PC端每行5个 */
  gap: 12px;
  flex: 1;
  align-content: flex-start;
  padding: 8px 0;
}

.link-item {
  text-decoration: none;
  color: #d0d0e0;
  padding: 10px 8px 10px 40px; /* 增加左侧内边距，适配更大图标 */
  border-radius: 8px;
  background: rgba(30, 33, 50, 0.6);
  border: 1px solid rgba(102, 126, 234, 0.1);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  transition: all 0.3s ease;
  font-size: 13px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
  position: relative;
  min-height: 44px; /* 加高背景框，适配大图标 */
  display: flex;
  align-items: center;
}

/* 链接图标 - 核心调整：放大尺寸+保证不溢出 */
.link-item::before {
  content: '';
  position: absolute;
  left: 10px; /* 微调位置，居中显示 */
  top: 50%;
  transform: translateY(-50%);
  width: 22px; /* 放大图标（PC端22px） */
  height: 22px;
  /* 关键：保证图标不溢出，自适应背景框 */
  background-size: contain;
  background-repeat: no-repeat;
  background-position: center;
  background-image: var(--icon-path, url('icons/default.png'));
  /* 防止图标超出背景框 */
  max-width: calc(100% - 8px);
  max-height: calc(100% - 8px);
  flex-shrink: 0;
  filter: drop-shadow(0 0 3px rgba(102, 126, 234, 0.3));
  transition: all 0.3s ease;
}

.link-item::after {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, 
    transparent, 
    rgba(102, 126, 234, 0.1), 
    transparent);
  transition: all 0.6s ease;
}

.link-item:hover::after {
  left: 100%;
}

.link-item:hover {
  background: linear-gradient(135deg, rgba(102, 126, 234, 0.2), rgba(118, 75, 162, 0.2));
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  color: #ffffff;
  transform: translateY(-2px) scale(1.05);
  box-shadow: 0 5px 15px rgba(102, 126, 234, 0.2);
  border-color: rgba(102, 126, 234, 0.3);
}

.link-item:hover::before {
  filter: drop-shadow(0 0 5px rgba(102, 126, 234, 0.8)) brightness(1.2);
  transform: translateY(-50%) scale(1.1);
}

.link-item strong {
  color: #ff6b8b;
}

.link-item:hover strong {
  color: white;
}

/* 响应式调整 */
/* 平板/小屏PC：每行3个 */
@media (max-width: 768px) {
  .link-group {
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
  }
  .link-item {
    padding: 8px 6px 8px 36px;
    font-size: 12px;
    min-height: 40px;
  }
  .link-item::before {
    width: 20px; /* 平板端图标20px */
    height: 20px;
    left: 8px;
  }
}

/* 手机端：每行3个 + 适配大图标 */
@media (max-width: 480px) {
  .link-group {
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
  }
  
  .link-item {
    padding: 8px 4px 8px 34px; /* 适配手机端内边距 */
    font-size: 11px;
    min-height: 38px;
  }
  
  .link-item::before {
    width: 18px; /* 手机端图标18px（放大且不溢出） */
    height: 18px;
    left: 7px;
  }
}

/* 超小屏手机额外适配 */
@media (max-width: 375px) {
  .search-container {
    gap: 8px;
    margin-top: 20px;
  }
  
  .search-input-wrapper {
    min-width: 240px;
  }
  
  .inner-search-select {
    width: 80px;
    font-size: 13px;
  }
  
  #search-input {
    padding: 10px 14px;
    padding-left: 90px;
    font-size: 13px;
  }
  
  .search-input-wrapper::after {
    left: 65px;
  }
  
  .search-btn {
    padding: 10px 14px;
    min-width: 70px;
    font-size: 13px;
  }
  
  .integrated-switch {
    width: 65px;
    height: 26px;
  }
  
  .switch-thumb {
    width: 22px;
    height: 22px;
  }
  
  input:checked + .switch-track .switch-thumb {
    transform: translateX(37px);
  }
  
  .switch-active, .switch-inactive {
    font-size: 11px;
  }
  
  /* 超小屏链接优化 */
  .link-item {
    padding: 6px 3px 6px 32px;
    font-size: 10px;
    min-height: 36px;
  }
  
  .link-item::before {
    width: 16px; /* 超小屏图标16px */
    height: 16px;
    left: 6px;
  }
  
  .category-grid {
    gap: 12px;
  }
}

@media (min-width: 1200px) {
  .category-grid {
    gap: 25px;
    padding: 0 20px 40px;
  }
  
  .category-card {
    padding: 20px;
  }
  
  .search-container {
    margin: 30px auto;
    gap: 12px;
  }
  
  .integrated-switch {
    width: 75px;
    height: 30px;
  }
  
  .switch-thumb {
    width: 26px;
    height: 26px;
  }
  
  input:checked + .switch-track .switch-thumb {
    transform: translateX(43px);
  }
  
  .switch-active, .switch-inactive {
    font-size: 13px;
  }
}

/* 滚动条美化 */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: rgba(25, 27, 40, 0.5);
}

::-webkit-scrollbar-thumb {
  background: rgba(102, 126, 234, 0.3);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(102, 126, 234, 0.5);
}