* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, "PingFang SC", "Microsoft YaHei", "Helvetica Neue", sans-serif;
  background: #f4f6fa;
  color: #222;
  display: flex;
  min-height: 100vh;
}

aside {
  width: 200px;
  flex-shrink: 0;
  background: #2b2d31;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}

/* logo 原图为黑底，用 lighten 混合让黑底融入侧边栏，只保留白色标志 */
aside .brand {
  display: block;
  height: auto;
  margin: 0 0 8px;
  padding: 18px 16px 14px;
  border-bottom: 1px solid #3a3d44;
  background: none;
}

aside .brand::after {
  content: none;
}

aside .brand:hover {
  background: none;
}

.brand img {
  display: block;
  width: 100%;
  max-width: 168px;
  height: auto;
  margin: 0 auto;
  mix-blend-mode: lighten;
}

aside a {
  display: flex;
  align-items: center;
  gap: 12px;
  height: 52px;
  padding: 0 16px;
  margin: 0 12px;
  color: #d1d5db;
  text-decoration: none;
  font-size: 15px;
  border-bottom: 1px solid #3a3d44;
  position: relative;
}

aside a::after {
  content: '›';
  position: absolute;
  right: 8px;
  color: #6b7280;
  font-size: 18px;
}

aside a:hover {
  color: #fff;
  background: #35373d;
}

.nav-icon {
  width: 22px;
  height: 22px;
  flex-shrink: 0;
  color: #4a9dff;
  display: flex;
}

.nav-icon svg {
  width: 100%;
  height: 100%;
}

/* 内容区居中，最大宽度参考目标站的约 1460px 版心 */
main {
  flex: 1;
  min-width: 0;
  max-width: 1500px;
  margin: 0 auto;
  padding: 24px 32px;
}

section {
  margin-bottom: 32px;
  scroll-margin-top: 16px;
}

/* 分类标题：左上角对齐，带与侧边栏一致的图标 */
h2 {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 17px;
  font-weight: 600;
  color: #333;
  margin: 0 0 14px;
}

h2 .section-icon {
  width: 20px;
  height: 20px;
  color: #4a9dff;
  display: flex;
}

h2 .section-icon svg {
  width: 100%;
  height: 100%;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 12px;
}

.tool {
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 16px 8px;
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.06);
  text-decoration: none;
  color: #222;
  transition:
    transform 0.45s var(--ease),
    box-shadow 0.45s var(--ease);
  will-change: transform;
}

.tool:hover {
  transform: translateY(-4px);
  /* 淡黄色柔光，替代原来的黑色阴影 */
  box-shadow:
    0 0 0 1px rgba(250, 204, 21, 0.25),
    0 8px 24px -4px rgba(250, 204, 21, 0.35);
}

.tool:focus-visible {
  outline: 2px solid rgba(250, 204, 21, 0.6);
  outline-offset: 3px;
}

.icon {
  width: 64px;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.5s var(--ease);
}

.tool:hover .icon {
  transform: scale(1.18);
}

.icon img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  transition: filter 0.45s var(--ease);
}

.tool:hover .icon img {
  filter: drop-shadow(0 4px 8px rgba(250, 204, 21, 0.3));
}


/* 图标加载失败时的文字兜底，不加底框 */
.icon span {
  font-size: 28px;
  font-weight: 600;
  color: #9ca3af;
}

.name {
  font-size: 13px;
  text-align: center;
  word-break: break-all;
}

@media (max-width: 640px) {
  body { flex-direction: column; }
  aside { width: 100%; height: auto; position: static; display: flex; flex-wrap: wrap; gap: 4px; padding: 12px; }
  aside h1 { width: 100%; margin: 0 0 4px; }
  aside a { margin: 0; }
  main { padding: 16px; }
}

/* 用户开启"减少动态效果"时，关闭卡片动画 */
@media (prefers-reduced-motion: reduce) {
  .tool,
  .tool .icon,
  .tool .icon img {
    transition: none;
  }

  .tool:hover,
  .tool:hover .icon {
    transform: none;
  }
}

/* ===== 首页广告位 ===== */
.ads {
  --ad-ease: cubic-bezier(0.22, 1, 0.36, 1);
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 12px;
  margin-bottom: 32px;
}

.ad-carousel {
  position: relative;
  height: 340px;
  border-radius: 14px;
  overflow: hidden;
  background: #fff;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.06);
  outline: none;
}

.ad-carousel:focus-visible {
  box-shadow: 0 0 0 2px rgba(250, 204, 21, 0.6);
}

.ad-track {
  display: flex;
  height: 100%;
  transition: transform 0.7s var(--ad-ease);
  will-change: transform;
}

.ad-track.is-dragging {
  transition: none;
  cursor: grabbing;
}

.ad-slide {
  flex: 0 0 100%;
  height: 100%;
  display: block;
  position: relative;
  user-select: none;
}

.ad-slide img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  pointer-events: none;
  -webkit-user-drag: none;
}

.ad-slide.is-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  background: #fafafa;
  color: #9ca3af;
  font-size: 14px;
}

.ad-side {
  height: 340px;
  display: grid;
  grid-template-rows: 1fr 1fr;
  gap: 12px;
}

.ad-side .ad-slide {
  flex: none;
  border-radius: 14px;
  overflow: hidden;
  background: #fff;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.06);
  transition:
    transform 0.45s var(--ad-ease),
    box-shadow 0.45s var(--ad-ease);
}

.ad-side .ad-slide:hover {
  transform: translateY(-3px);
  box-shadow:
    0 0 0 1px rgba(250, 204, 21, 0.25),
    0 8px 24px -4px rgba(250, 204, 21, 0.35);
}

/* 左右箭头：鼠标或焦点进入时淡入 */
.ad-nav {
  position: absolute;
  top: 50%;
  z-index: 2;
  width: 36px;
  height: 36px;
  margin-top: -18px;
  border: 0;
  border-radius: 50%;
  background: rgba(17, 24, 39, 0.45);
  color: #fff;
  font-size: 22px;
  line-height: 36px;
  text-align: center;
  cursor: pointer;
  opacity: 0;
  transition:
    opacity 0.35s var(--ad-ease),
    background 0.3s var(--ad-ease),
    transform 0.35s var(--ad-ease);
}

.ad-prev { left: 12px; }
.ad-next { right: 12px; }

.ad-carousel:hover .ad-nav,
.ad-carousel:focus-within .ad-nav {
  opacity: 1;
}

.ad-nav:hover {
  background: rgba(17, 24, 39, 0.7);
  transform: scale(1.08);
}

.ad-dots {
  position: absolute;
  left: 50%;
  bottom: 12px;
  z-index: 2;
  transform: translateX(-50%);
  display: flex;
  gap: 6px;
}

/* 圆点：激活态拉长为胶囊形，过渡与轮播同速 */
.ad-dot {
  width: 8px;
  height: 8px;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.6);
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.12);
  cursor: pointer;
  transition:
    width 0.5s var(--ad-ease),
    background 0.4s var(--ad-ease);
}

.ad-dot[aria-current="true"] {
  width: 22px;
  background: #facc15;
}

@media (max-width: 800px) {
  .ads {
    grid-template-columns: 1fr;
  }

  .ad-carousel {
    height: 200px;
  }

  .ad-side {
    height: auto;
    grid-template-rows: none;
    grid-template-columns: 1fr 1fr;
  }

  .ad-side .ad-slide {
    height: 120px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .ad-track,
  .ad-nav,
  .ad-dot,
  .ad-side .ad-slide {
    transition: none;
  }
}
