* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html, body {
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", Roboto, sans-serif;
  background: var(--bg-page);
  min-height: 100vh;
  min-height: -webkit-fill-available;
  position: relative;
  overflow-x: hidden;
  /* 适配微信浏览器安全区域 */
  padding-top: env(safe-area-inset-top);
  padding-bottom: env(safe-area-inset-bottom);
}

/* Stars background */
.stars {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  pointer-events: none;
  background: transparent;
}

.stars span {
  position: absolute;
  border-radius: 50%;
  background: var(--star-dot);
  opacity: 0;
  animation: twinkle 3s infinite;
}

@keyframes twinkle {
  0%, 100% { opacity: 0; }
  50% { opacity: 0.8; }
}

.stars span.star-drift {
  animation: twinkle var(--twinkle-dur, 3s) infinite ease-in-out,
    starDrift var(--drift-dur, 18s) infinite ease-in-out alternate;
}

@keyframes starDrift {
  0% { transform: translate(0, 0); }
  100% { transform: translate(var(--dx, 12px), var(--dy, -8px)); }
}

/* 主页动态背景光晕 */
.home-ambient {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
}

.home-orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(72px);
  opacity: 0.45;
  will-change: transform;
  transform: translate(var(--px, 0), var(--py, 0));
  animation: orbFloat 14s ease-in-out infinite;
}

.home-orb-1 {
  width: min(52vw, 420px);
  height: min(52vw, 420px);
  top: -8%;
  left: -6%;
  background: radial-gradient(circle, rgba(102, 126, 234, 0.55) 0%, transparent 70%);
  animation-duration: 16s;
}

.home-orb-2 {
  width: min(44vw, 360px);
  height: min(44vw, 360px);
  top: 38%;
  right: -10%;
  background: radial-gradient(circle, rgba(0, 119, 212, 0.42) 0%, transparent 70%);
  animation-duration: 20s;
  animation-delay: -4s;
}

.home-orb-3 {
  width: min(38vw, 300px);
  height: min(38vw, 300px);
  bottom: -6%;
  left: 28%;
  background: radial-gradient(circle, rgba(118, 75, 162, 0.4) 0%, transparent 70%);
  animation-duration: 18s;
  animation-delay: -8s;
}

@keyframes orbFloat {
  0%, 100% { transform: translate(var(--px, 0), var(--py, 0)) scale(1); }
  33% { transform: translate(calc(var(--px, 0px) + 24px), calc(var(--py, 0px) - 18px)) scale(1.06); }
  66% { transform: translate(calc(var(--px, 0px) - 16px), calc(var(--py, 0px) + 22px)) scale(0.96); }
}

[data-theme="light"] .home-orb {
  opacity: 0.35;
}

/* 跳过链接：键盘 Tab 第一站，按回车直接跳到智能体列表 */
.skip-link {
  position: absolute;
  left: 0;
  top: 0;
  padding: 8px 14px;
  background: var(--text-primary);
  color: var(--bg-primary, #0b1020);
  border-radius: 0 0 8px 0;
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  transform: translateY(-110%);
  transition: transform 0.15s ease;
  z-index: 10100;
}

.skip-link:focus-visible {
  transform: translateY(0);
  outline: 2px solid #00d4ff;
  outline-offset: 2px;
}

/* 主页左上角：筛选智能体卡片（默认仅放大镜，点击展开） */
.home-search-bar {
  position: fixed;
  top: calc(12px + env(safe-area-inset-top));
  left: calc(12px + env(safe-area-inset-left));
  z-index: 10050;
  display: flex;
  align-items: flex-start;
  max-width: calc(100vw - 64px - env(safe-area-inset-left) - env(safe-area-inset-right));
}

/* 桌面端：FAB 锚定在容器外的左侧空白带，避免遮挡首张卡 */
@media (max-width: 768px) {
  .home-search-bar {
    top: calc(8px + env(safe-area-inset-top));
    left: calc(8px + env(safe-area-inset-left));
    max-width: calc(100vw - 16px - env(safe-area-inset-left) - env(safe-area-inset-right));
  }

  .home-search-bar.is-expanded .home-search-panel {
    max-width: min(calc(100vw - 68px - env(safe-area-inset-left) - env(safe-area-inset-right)), 340px);
  }

  .home-search-wrap {
    min-width: 0;
  }

  .home-search-input {
    font-size: 16px;
  }
}

@media (min-width: 1024px) {
  .home-search-bar {
    top: 24px;
    left: 24px;
  }
}

.home-search-fab {
  flex-shrink: 0;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1px solid var(--w20);
  background: var(--w05);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: 0 4px 20px var(--shadow-card);
  cursor: pointer;
  font-size: 20px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
  position: relative;
}

.home-search-bar:not(.is-expanded) .home-search-fab::after {
  content: '';
  position: absolute;
  inset: -4px;
  border-radius: 50%;
  border: 1px solid rgba(102, 126, 234, 0.35);
  animation: searchFabPulse 2.8s ease-in-out infinite;
  pointer-events: none;
}

@keyframes searchFabPulse {
  0%, 100% { transform: scale(1); opacity: 0.5; }
  50% { transform: scale(1.12); opacity: 0; }
}

.home-search-fab:hover {
  transform: scale(1.06);
  box-shadow: 0 6px 24px var(--shadow-card-hover);
  border-color: rgba(102, 126, 234, 0.45);
}

.home-search-fab:active {
  transform: scale(0.98);
}

/* 键盘聚焦时给出明显的 focus ring（鼠标点击不会触发） */
.home-search-fab:focus-visible {
  outline: 2px solid #00d4ff;
  outline-offset: 3px;
  border-color: rgba(0, 212, 255, 0.75);
}

.home-search-panel {
  max-width: 0;
  max-height: 0;
  opacity: 0;
  overflow: hidden;
  margin-left: 0;
  pointer-events: none;
  transition: max-width 0.28s ease, max-height 0.28s ease, opacity 0.22s ease, margin-left 0.28s ease;
}

.home-search-bar.is-expanded .home-search-panel {
  max-width: min(52vw, 280px);
  max-height: 160px;
  opacity: 1;
  margin-left: 10px;
  pointer-events: auto;
}

.home-search-wrap {
  display: flex;
  align-items: center;
  min-width: min(52vw, 280px);
  padding: 8px 14px;
  border-radius: 999px;
  border: 1px solid var(--w20);
  background: var(--w05);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: 0 4px 20px var(--shadow-card);
  cursor: text;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.home-search-wrap:focus-within {
  border-color: rgba(102, 126, 234, 0.45);
  box-shadow: 0 6px 24px var(--shadow-card-hover);
}

.home-search-input {
  flex: 1;
  min-width: 0;
  width: 100%;
  border: none;
  background: transparent;
  color: var(--text-primary);
  font-size: 15px;
  outline: none;
  -webkit-appearance: none;
  appearance: none;
}

.home-search-input::placeholder {
  color: var(--w55);
}

.home-search-input::-webkit-search-cancel-button {
  -webkit-appearance: none;
  appearance: none;
}

.agents-grid > .search-empty {
  grid-column: 1 / -1;
}

/* Container */
.container {
  max-width: 1500px;
  margin: 0 auto;
  padding: 40px 20px;
  padding-right: 56px;
  position: relative;
  z-index: 10;
}
/* Header — 霞鹜文楷 (LXGW WenKai) */
.header-title-text,
.header-tagline,
.header-meta,
.header-rotator-line,
.header-stat-chip {
  font-family: "LXGW WenKai", "霞鹜文楷", KaiTi, "楷体", serif;
}

.header {
  text-align: center;
  margin-bottom: 50px;
  padding: 30px 0;
}

.header-title,
.header h1 {
  font-size: 48px;
  margin-bottom: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 15px;
}

/* 大标题：渐变光效 */
.header-title-text {
  font-size: 1.38em;
  line-height: 1;
  font-weight: 400;
  letter-spacing: 2px;
  background: var(--title-gradient);
  background-size: 200% auto;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  filter: drop-shadow(0 0 18px rgba(102, 126, 234, 0.35));
  animation: titleGradientShift 8s linear infinite;
}

.header-tagline {
  font-size: 22px;
  letter-spacing: 1.5px;
  font-weight: 400;
  line-height: 1.6;
  color: var(--w80);
  margin: 6px 0 0;
}

/* 页头数据：自然语句，与标题区字体一致 */
.header-meta {
  position: relative;
  margin: 22px auto 0;
  padding-top: 14px;
  max-width: 36em;
  font-size: 14px;
  line-height: 1.85;
  letter-spacing: 0.5px;
  font-weight: 400;
  color: var(--w40);
}

.header-meta::before {
  content: "";
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: min(120px, 28vw);
  height: 1px;
  background: linear-gradient(
    90deg,
    transparent,
    var(--w15) 20%,
    var(--w20) 50%,
    var(--w15) 80%,
    transparent
  );
}

.header-meta-num {
  font-family: inherit;
  font-weight: 500;
  color: var(--w55);
}

.header-animate > p.header-meta {
  animation: headerFadeUp 0.7s cubic-bezier(0.22, 1, 0.36, 1) 0.36s both;
}

@keyframes titleGradientShift {
  0% { background-position: 0% center; }
  100% { background-position: 200% center; }
}

.header-animate .header-title-text {
  animation: titleGradientShift 8s linear infinite,
    headerFadeUp 0.7s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.header-animate .header-tagline,
.header-animate > p:not(.header-support-line):not(.header-meta) {
  animation: headerFadeUp 0.7s cubic-bezier(0.22, 1, 0.36, 1) 0.12s both;
}

.header-animate .header-support-line {
  animation: headerFadeUp 0.7s cubic-bezier(0.22, 1, 0.36, 1) 0.24s both,
    supportLinePulse 3s ease-in-out 0.9s infinite;
}

@keyframes headerFadeUp {
  from {
    opacity: 0;
    transform: translateY(18px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes supportLinePulse {
  0%, 100% { opacity: 0.88; }
  50% { opacity: 1; }
}

@keyframes titleGlow {
  0%, 100% {
    text-shadow: 0 0 20px rgba(102, 126, 234, 0.4);
    opacity: 0.9;
  }
  50% {
    text-shadow: 0 0 40px rgba(102, 126, 234, 0.8);
    opacity: 1;
  }
}

.header-logo {
  height: 58px;
  width: 58px;
  border-radius: 50%;
  overflow: hidden;
  box-shadow:
    0 0 20px rgba(102, 126, 234, 0.4),
    0 0 40px rgba(0, 212, 255, 0.2);
  flex-shrink: 0;
  animation: logoGlowRing 4s ease-in-out infinite;
  display: flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  color: inherit;
  cursor: pointer;
  transition: box-shadow 0.25s ease;
}

.header-logo:focus-visible {
  outline: 2px solid rgba(102, 126, 234, 0.85);
  outline-offset: 3px;
}

@keyframes logoGlowRing {
  0%, 100% {
    box-shadow:
      0 0 20px rgba(102, 126, 234, 0.4),
      0 0 40px rgba(0, 212, 255, 0.2);
  }
  50% {
    box-shadow:
      0 0 28px rgba(102, 126, 234, 0.65),
      0 0 52px rgba(0, 212, 255, 0.35);
  }
}

.header-logo img {
  height: 100%;
  width: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.3s ease;
  border-radius: 50%;
}

.header:hover .header-logo img,
.header-logo:hover img,
.header-logo:focus-visible img {
  transform: scale(1.05);
}

.header p {
  font-size: 18px;
  color: var(--w80);
  letter-spacing: 2px;
  font-weight: 400;
}

.header p.header-support-line {
  margin-top: 10px;
  font-size: 15px;
  opacity: 0.88;
  letter-spacing: 1.5px;
}

/* Agents Grid */
.agents-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 24px;
}

.agents-grid-flow {
  display: contents;
}

/* 按类别分组：每组横跨整行；组内自适应网格 */
.agents-group {
  grid-column: 1 / -1;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.agents-group + .agents-group {
  margin-top: 32px;
}

.agents-group-head {
  display: flex;
  align-items: baseline;
  gap: 12px;
  padding: 4px 2px 16px;
}

.agents-group-title {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: 2px;
  color: var(--w70);
  margin: 0;
}

.agents-group-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 24px;
}

@media (max-width: 768px) {
  .agents-group-grid {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  .agents-group-title {
    font-size: 20px;
    letter-spacing: 1.5px;
  }

  .agents-group + .agents-group {
    margin-top: 24px;
  }
}

.agents-section-heading,
.coming-soon-section {
  grid-column: 1 / -1;
}

.agents-section-heading {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 16px;
  margin: 4px 2px -4px;
}

.agents-section-heading h2 {
  color: var(--text-primary);
  font-size: 22px;
  letter-spacing: 1px;
}

.agents-section-heading span {
  color: var(--w55);
  font-size: 13px;
}

.platform-stats {
  list-style: none;
  margin: 0;
  padding: 6px;
  display: inline-flex;
  align-items: stretch;
  gap: 6px;
  border: 1px solid var(--w10);
  border-radius: 16px;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.06), rgba(255, 255, 255, 0.02));
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.18);
}

.header-stats {
  margin: 10px auto 0;
}

.platform-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 10px 22px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.03);
  transition: background 0.2s ease, transform 0.2s ease;
}

.platform-stat:hover {
  background: rgba(255, 255, 255, 0.08);
  transform: translateY(-1px);
}

.platform-stat + .platform-stat {
  position: relative;
}

.platform-stat + .platform-stat::before {
  content: "";
  position: absolute;
  left: -3px;
  top: 18%;
  bottom: 18%;
  width: 1px;
  background: var(--w10);
}

.platform-stat-body {
  display: flex;
  flex-direction: column;
  align-items: center;
  line-height: 1.1;
}

.platform-stat-value {
  font-size: 22px;
  font-weight: 600;
  letter-spacing: 0.5px;
  color: var(--text-primary);
  font-variant-numeric: tabular-nums;
  line-height: 1.1;
}

.platform-stat-unit {
  margin-left: 2px;
  font-size: 12px;
  font-weight: 400;
  color: var(--w55);
}

.platform-stat-label {
  font-size: 12px;
  letter-spacing: 1px;
  color: var(--w55);
}

.coming-soon-section {
  margin-top: 24px;
  padding: 0;
  border: 0;
  background: transparent;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}

/* 折叠按钮：从全宽 CTA 退化成低调的虚线胶囊，宽度 auto 居中 */
.coming-soon-toggle {
  width: auto;
  max-width: 100%;
  border: 1px dashed var(--w20);
  background: transparent;
  color: var(--w70);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  cursor: pointer;
  font: inherit;
  font-size: 13px;
  letter-spacing: 0.5px;
  text-align: center;
  padding: 6px 16px;
  border-radius: 999px;
  transition: color 0.2s ease, border-color 0.2s ease, background 0.2s ease;
}

.coming-soon-toggle:hover {
  color: var(--text-primary);
  border-color: var(--w35);
  background: var(--w05);
}

.coming-soon-toggle:focus-visible {
  outline: 2px solid var(--accent, #00d4ff);
  outline-offset: 2px;
}

.coming-soon-toggle strong {
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.5px;
}

/* 旧的「N 个应用筹备中」小字保留为可选，整合到 strong 行末 */
.coming-soon-toggle small {
  display: none;
}

.coming-soon-chevron {
  width: auto;
  height: auto;
  border-radius: 0;
  background: transparent;
  color: inherit;
  font-size: 14px;
  line-height: 1;
  transition: transform 0.2s ease;
}

.coming-soon-chevron.expanded {
  transform: rotate(180deg);
  background: transparent;
}

.coming-soon-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 18px;
  margin-top: 18px;
}

.coming-soon-card {
  opacity: 0.72;
}

/* 搜索筛选：即时显示，无入场动画 */
.agent-card.filter-instant,
.agent-card.filter-instant.show {
  opacity: 1;
  transform: none;
  animation: none;
}

/* Agent Card */
.agent-card {
  position: relative;
  background: var(--w05);
  border: 1px solid var(--w10);
  border-radius: 20px;
  padding: 28px 24px;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  box-shadow: 0 8px 32px var(--shadow-card);
  transition:
    transform 0.35s cubic-bezier(0.22, 1, 0.36, 1),
    box-shadow 0.35s ease,
    background 0.35s ease,
    border-color 0.35s ease;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 12px;
  opacity: 0;
  transform: translateY(28px) scale(0.94);
  user-select: none;
  -webkit-user-select: none;
}

.agent-card-linkable {
  cursor: pointer;
}

.agent-card-cover-link {
  position: absolute;
  inset: 0;
  z-index: 1;
  border-radius: inherit;
  text-decoration: none;
  color: inherit;
}

.agent-card .click-stat {
  position: relative;
  z-index: 3;
}

.agent-card .enter-button-visual {
  position: relative;
  z-index: 2;
  pointer-events: none;
}

.agent-card.show {
  animation: cardSlideIn 0.65s cubic-bezier(0.22, 1, 0.36, 1) both;
  animation-delay: var(--card-delay, 0s);
}

@keyframes cardSlideIn {
  from {
    opacity: 0;
    transform: translateY(28px) scale(0.94);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.agent-card::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: linear-gradient(
    105deg,
    transparent 38%,
    rgba(255, 255, 255, 0.07) 48%,
    transparent 58%
  );
  background-size: 220% 100%;
  background-position: 130% 0;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.35s ease;
}

.agent-card:hover::after {
  opacity: 1;
  animation: cardShine 0.75s ease;
}

@keyframes cardShine {
  from { background-position: 130% 0; }
  to { background-position: -30% 0; }
}

.agent-card:hover {
  transform: translateY(-10px) scale(1.02);
  box-shadow: 0 20px 52px var(--shadow-card-hover);
  background: var(--w08);
  border-color: rgba(102, 126, 234, 0.5);
}

.agent-card:active:not(.disabled) {
  transform: translateY(-6px) scale(1.01);
  transition-duration: 0.12s;
}

.agent-card.disabled {
  cursor: default;
  opacity: 0.6;
}

.agent-card.disabled:hover {
  transform: none;
  box-shadow: 0 8px 32px var(--shadow-card);
  background: var(--w05);
  border-color: var(--w10);
}

.agent-avatar {
  font-size: 48px;
  width: 80px;
  height: 80px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--w05);
  border-radius: 16px;
  margin-bottom: 8px;
  transition: transform 0.4s cubic-bezier(0.22, 1, 0.36, 1);
}

.agent-card:hover:not(.disabled) .agent-avatar {
  transform: scale(1.08) rotate(-3deg);
}

.add-agent-card:hover .add-agent-avatar {
  animation: avatarWiggle 0.6s ease;
}

@keyframes avatarWiggle {
  0%, 100% { transform: scale(1.08) rotate(-3deg); }
  40% { transform: scale(1.12) rotate(4deg); }
  70% { transform: scale(1.06) rotate(-2deg); }
}

.agent-category {
  display: inline-block;
  padding: 4px 12px;
  background: rgba(102, 126, 234, 0.3);
  color: var(--w90);
  border-radius: 12px;
  font-size: 12px;
  letter-spacing: 1px;
  font-weight: 500;
}

.agent-name {
  font-size: 22px;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: 1px;
}

.agent-description {
  font-size: 14px;
  line-height: 1.6;
  color: var(--w70);
  flex: 1;
}

.agent-author {
  font-size: 12px;
  color: var(--w50);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 0;
}

.agent-author .author-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
}

.agent-card .enter-button:not(.enter-button-visual) {
  position: relative;
  z-index: 2;
}

.enter-button {
  margin-top: auto;
  padding: 12px 20px;
  background: linear-gradient(135deg, #6366f1 0%, #0891b2 100%);
  color: white;
  border: none;
  border-radius: 12px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  letter-spacing: 1px;
  text-decoration: none;
  display: block;
  width: 100%;
  box-sizing: border-box;
  text-align: center;
}

a.enter-button:visited {
  color: white;
}

.agent-card:hover .enter-button {
  transform: scale(1.05);
  box-shadow: 0 8px 24px rgba(99, 102, 241, 0.4);
}

.enter-button:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(99, 102, 241, 0.5);
}

.enter-button.disabled {
  background: rgba(100, 100, 100, 0.4);
  color: var(--w40);
  cursor: not-allowed;
  box-shadow: none;
}

.agent-card:hover .enter-button.disabled {
  transform: none;
  box-shadow: none;
}

.enter-button.disabled:hover {
  transform: none;
  box-shadow: none;
}

/* ============================================================ */
/* 点击量展示（只读）：嵌在作者行末尾                              */
/* ============================================================ */
.click-stat {
  margin: 0;
  padding: 2px 6px;
  background: transparent;
  color: var(--w55);
  border: 0;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 500;
  line-height: 1;
  font-style: normal;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
  position: relative;
  z-index: 3;
  user-select: none;
  pointer-events: none;
}

.click-stat-icon {
  font-size: 12px;
  line-height: 1;
  opacity: 0.85;
}

.click-stat-count {
  font-variant-numeric: tabular-nums;
}

/* Loading */
.loading {
  grid-column: 1 / -1;
  text-align: center;
  padding: 60px;
  color: var(--w60);
  font-size: 16px;
}

.typing {
  display: inline-flex;
  gap: 4px;
  margin-left: 8px;
  vertical-align: middle;
}

.typing span {
  display: block;
  width: 8px;
  height: 8px;
  background: var(--w60);
  border-radius: 50%;
  animation: typing 1.4s infinite ease-in-out both;
}

.typing span:nth-child(1) { animation-delay: -0.32s; }
.typing span:nth-child(2) { animation-delay: -0.16s; }

@keyframes typing {
  0%, 80%, 100% { transform: scale(0); }
  40% { transform: scale(1); }
}

/* Error state */
.error {
  grid-column: 1 / -1;
  text-align: center;
  padding: 60px;
  color: rgba(255, 100, 100, 0.8);
  font-size: 16px;
  background: rgba(255, 100, 100, 0.1);
  border-radius: 16px;
  border: 1px solid rgba(255, 100, 100, 0.2);
}

/* Empty state */
.empty {
  grid-column: 1 / -1;
  text-align: center;
  padding: 60px;
  color: var(--w60);
  font-size: 16px;
}

/* Add Agent Card */
.add-agent-card {
  background: linear-gradient(135deg, rgba(0, 212, 255, 0.08) 0%, rgba(102, 126, 234, 0.08) 100%);
  border: 2px dashed rgba(102, 126, 234, 0.4);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  animation: dashedBorderFlow 6s linear infinite;
}

@keyframes dashedBorderFlow {
  0%, 100% { border-color: rgba(102, 126, 234, 0.4); }
  50% { border-color: rgba(0, 212, 255, 0.55); }
}

.add-agent-card:hover {
  transform: translateY(-8px);
  box-shadow: 0 16px 48px rgba(0, 212, 255, 0.25);
  background: linear-gradient(135deg, rgba(0, 212, 255, 0.12) 0%, rgba(102, 126, 234, 0.12) 100%);
  border-color: rgba(102, 126, 234, 0.7);
}

.add-agent-avatar {
  background: linear-gradient(135deg, #00d4ff 0%, #667eea 100%);
}

.add-agent-category {
  background: linear-gradient(135deg, rgba(0, 212, 255, 0.3) 0%, rgba(102, 126, 234, 0.3) 100%);
}

.add-agent-hint {
  font-size: 12px;
  color: var(--w50);
  margin-top: 4px;
}

.add-agent-card .add-agent-button {
  margin-top: 12px;
  width: 100%;
  padding: 12px 20px;
  background: linear-gradient(135deg, #00d4ff 0%, #667eea 100%);
  color: white;
  border: none;
  border-radius: 12px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  letter-spacing: 1px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.add-agent-card .add-icon {
  font-size: 16px;
  font-weight: 700;
  line-height: 1;
}

/* About Us Card */
.about-us-card {
  background: linear-gradient(135deg, rgba(0, 212, 255, 0.06) 0%, rgba(102, 126, 234, 0.06) 100%);
  border: 1px solid rgba(0, 212, 255, 0.32);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  text-decoration: none;
  color: inherit;
}

.about-us-card:hover {
  transform: translateY(-8px);
  box-shadow: 0 16px 48px rgba(0, 212, 255, 0.22);
  background: linear-gradient(135deg, rgba(0, 212, 255, 0.1) 0%, rgba(102, 126, 234, 0.1) 100%);
  border-color: rgba(0, 212, 255, 0.6);
}

.about-us-avatar {
  background: linear-gradient(135deg, #00d4ff 0%, #667eea 100%);
}

.about-us-category {
  background: linear-gradient(135deg, rgba(0, 212, 255, 0.28) 0%, rgba(102, 126, 234, 0.28) 100%);
}

.about-us-card .about-us-button {
  margin-top: 12px;
  width: 100%;
  padding: 12px 20px;
  background: linear-gradient(135deg, #00d4ff 0%, #667eea 100%);
  color: white;
  border: none;
  border-radius: 12px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  letter-spacing: 1px;
}

.about-us-card .about-us-button:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0, 212, 255, 0.4);
}

/* ============================================================ */
/* 行动卡（添加智能体 / 关于我们）统一 outline 视觉              */
/* 与正常智能体卡区分：透明背景 + 弱描边 + 弱阴影，避免抢戏       */
/* 注意：不要用 animation: none，否则会覆盖 .agent-card.show 的   */
/* cardSlideIn，opacity 卡在 0 → 卡片不可见。仅清掉边框流动动画。  */
/* ============================================================ */
.add-agent-card,
.about-us-card {
  background: transparent !important;
  border: 1.5px dashed var(--w20) !important;
  box-shadow: none !important;
}

.add-agent-card {
  animation-name: cardSlideIn !important;
}

.add-agent-card:hover,
.about-us-card:hover {
  background: var(--w03) !important;
  border-style: solid !important;
  transform: translateY(-4px);
}

/* 三张卡的色相区分（仅 hover 时强化） */
.add-agent-card:hover { border-color: rgba(0, 212, 255, 0.55) !important; box-shadow: 0 10px 28px rgba(0, 212, 255, 0.12) !important; }
.about-us-card:hover  { border-color: rgba(255, 184, 108, 0.55) !important; box-shadow: 0 10px 28px rgba(255, 184, 108, 0.12) !important; }

/* 把内部按钮也调成次要风格，进一步弱化视觉重量 */
.add-agent-card .add-agent-button,
.about-us-card .about-us-button {
  background: transparent !important;
  color: var(--text-primary) !important;
  border: 1px solid var(--w20) !important;
  font-weight: 500 !important;
  letter-spacing: 0.5px !important;
}

.add-agent-card:hover .add-agent-button { border-color: rgba(0, 212, 255, 0.55) !important; color: #00d4ff !important; }
.about-us-card:hover .about-us-button   { border-color: rgba(255, 184, 108, 0.55) !important; color: #ffb86c !important; }

/* 类别胶囊也降饱和度，避免与正常卡片争视觉焦点 */
.add-agent-category,
.about-us-category {
  background: var(--w08) !important;
  color: var(--w70) !important;
}

/* About Us Modal */

/* 回到顶部 — 与 theme-toggle / search-fab 统一的玻璃 FAB */
.back-to-top {
  position: fixed;
  right: calc(12px + env(safe-area-inset-right));
  bottom: calc(20px + env(safe-area-inset-bottom));
  z-index: 9990;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  border: 1px solid var(--w20);
  background: var(--w05);
  color: var(--w80);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: 0 4px 20px var(--shadow-card);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translateY(14px) scale(0.92);
  transition:
    opacity 0.28s ease,
    visibility 0.28s ease,
    transform 0.28s cubic-bezier(0.34, 1.2, 0.64, 1),
    box-shadow 0.2s ease,
    border-color 0.2s ease,
    color 0.2s ease;
}

.back-to-top.is-visible {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: translateY(0) scale(1);
}

.back-to-top-icon {
  display: block;
  flex-shrink: 0;
  transition: transform 0.25s ease;
}

.back-to-top:hover {
  color: #00d4ff;
  border-color: rgba(0, 212, 255, 0.45);
  box-shadow:
    0 8px 28px rgba(0, 212, 255, 0.18),
    0 0 0 1px rgba(102, 126, 234, 0.12) inset;
}

.back-to-top:hover .back-to-top-icon {
  transform: translateY(-2px);
}

.back-to-top:active {
  transform: translateY(0) scale(0.96);
}

.back-to-top.is-visible:active {
  transform: translateY(0) scale(0.96);
}

.back-to-top:focus-visible {
  outline: 2px solid #00d4ff;
  outline-offset: 3px;
  border-color: rgba(0, 212, 255, 0.75);
}

@media (min-width: 1024px) {
  .back-to-top {
    right: 24px;
    bottom: 28px;
  }
}

/* Footer */
.footer {
  margin-top: 60px;
  text-align: center;
  padding: 30px 0;
  border-top: 1px solid var(--w10);
}

.footer p {
  color: var(--w50);
  font-size: 14px;
  letter-spacing: 1px;
}

.footer p.contact {
  background: linear-gradient(90deg, #ffffff 0%, #667eea 25%, #00d4ff 50%, #ffffff 75%, #667eea 100%);
  background-size: 400% 400%;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  animation: gradientShift 8s ease infinite;
  margin-top: 8px;
  font-size: 15px;
}

.footer p.icp {
  margin-top: 12px;
  font-size: 13px;
  opacity: 0.7;
}

.footer p.icp a {
  color: inherit;
  text-decoration: none;
}

.footer p.icp a:hover {
  text-decoration: underline;
}

@keyframes gradientShift {
  0% {
    background-position: 0% 50%;
  }
  50% {
    background-position: 100% 50%;
  }
  100% {
    background-position: 0% 50%;
  }
}

/* Markdown styles */
.assistant-message h1,
.assistant-message h2,
.assistant-message h3,
.assistant-message h4,
.assistant-message h5,
.assistant-message h6 {
  margin: 12px 0 0 0;
  font-weight: 700;
  color: var(--text-primary);
}

.assistant-message h1 { font-size: 1.5em; }
.assistant-message h2 { font-size: 1.4em; }
.assistant-message h3 { font-size: 1.3em; }
.assistant-message h4 { font-size: 1.2em; }
.assistant-message h5 { font-size: 1.1em; }
.assistant-message h6 { font-size: 1em; }

.assistant-message p {
  margin-bottom: 0;
  margin-top: 0;
}

.assistant-message p:last-child {
  margin-bottom: 0;
}

.assistant-message ul,
.assistant-message ol {
  margin: 0.5em 0;
  padding-left: 1.8em;
}

.assistant-message li {
  margin: 0.2em 0;
}

.assistant-message code {
  background: var(--code-bg);
  padding: 2px 6px;
  border-radius: 4px;
  font-family: 'Courier New', monospace;
  font-size: 0.9em;
}

.assistant-message pre {
  background: var(--pre-bg);
  border-radius: 8px;
  padding: 12px;
  margin: 10px 0;
  overflow-x: auto;
}

.assistant-message pre code {
  background: none;
  padding: 0;
  border-radius: 0;
}

.assistant-message blockquote {
  border-left: 4px solid var(--w40);
  padding-left: 12px;
  margin: 10px 0;
  color: var(--w80);
}

.assistant-message a {
  color: var(--link);
  text-decoration: underline;
}

.assistant-message a:hover {
  color: var(--link-hover);
}

.assistant-message strong {
  font-weight: 700;
}

.assistant-message em {
  font-style: italic;
}

.assistant-message hr {
  border: none;
  border-top: 1px solid var(--w20);
  margin: 16px 0;
}

.assistant-message table {
  border-collapse: collapse;
  margin: 10px 0;
  width: 100%;
}

.assistant-message th,
.assistant-message td {
  border: 1px solid var(--w20);
  padding: 6px 10px;
}

.assistant-message th {
  background: var(--md-th-bg);
  font-weight: 700;
}

/* Password modal */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: var(--overlay);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.modal-overlay.show {
  display: flex;
}

.password-modal {
  background: var(--modal-bg);
  border: 1px solid var(--w20);
  border-radius: 20px;
  padding: 40px 30px;
  width: 90%;
  max-width: 400px;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  box-shadow: 0 20px 60px var(--shadow-deep);
  animation: modalSlideIn 0.3s ease;
}

@keyframes modalSlideIn {
  from {
    transform: translateY(-20px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

.password-modal h2 {
  color: var(--text-primary);
  font-size: 24px;
  margin-bottom: 10px;
  text-align: center;
}

.password-modal p {
  color: var(--w70);
  font-size: 14px;
  margin-bottom: 25px;
  text-align: center;
}

.password-input {
  width: 100%;
  padding: 14px 18px;
  background: var(--w10);
  border: 1px solid var(--w20);
  border-radius: 12px;
  color: var(--text-primary);
  font-size: 16px;
  outline: none;
  margin-bottom: 20px;
  box-sizing: border-box;
}

.password-input:focus {
  border-color: #667eea;
  box-shadow: 0 0 20px rgba(102, 126, 234, 0.3);
}

.password-input::placeholder {
  color: var(--w40);
}

.error-message {
  color: #ff6b6b;
  font-size: 13px;
  margin-bottom: 15px;
  display: none;
  text-align: center;
}

.error-message.show {
  display: block;
}

.modal-buttons {
  display: flex;
  gap: 12px;
}

.modal-button {
  flex: 1;
  padding: 12px 20px;
  border-radius: 12px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  border: none;
}

.modal-button.cancel {
  background: var(--w10);
  color: var(--text-primary);
  border: 1px solid var(--w20);
}

.modal-button.cancel:hover {
  background: var(--w20);
}

.modal-button.confirm {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
}

.modal-button.confirm:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(102, 126, 234, 0.4);
}

/* Add Agent Modal */
.add-agent-modal {
  background: var(--modal-bg);
  border: 1px solid var(--w20);
  border-radius: 20px;
  padding: 40px 30px;
  width: 90%;
  max-width: 500px;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  box-shadow: 0 20px 60px var(--shadow-deep);
  animation: modalSlideIn 0.3s ease;
  max-height: 85vh;
  overflow-y: auto;
}

.add-agent-modal h2 {
  color: var(--text-primary);
  font-size: 24px;
  margin-bottom: 8px;
  text-align: center;
}

.modal-description {
  color: var(--w70);
  font-size: 14px;
  margin-bottom: 25px;
  text-align: center;
}

.form-group {
  margin-bottom: 18px;
}

.form-group label {
  display: block;
  color: var(--w90);
  font-size: 14px;
  font-weight: 500;
  margin-bottom: 8px;
  line-height: 1.35;
}

.form-group .required {
  color: #ff6b6b;
  white-space: nowrap;
}

.form-input,
.form-textarea {
  width: 100%;
  padding: 12px 16px;
  background: var(--w10);
  border: 1px solid var(--w20);
  border-radius: 12px;
  color: var(--text-primary);
  font-size: 15px;
  outline: none;
  box-sizing: border-box;
  transition: all 0.3s ease;
  font-family: inherit;
}

.form-input:focus,
.form-textarea:focus {
  border-color: #667eea;
  box-shadow: 0 0 20px rgba(102, 126, 234, 0.3);
}

.form-input::placeholder,
.form-textarea::placeholder {
  color: var(--w40);
}

.form-textarea {
  resize: vertical;
  min-height: 80px;
}

.success-message {
  color: #4ecdc4;
  font-size: 14px;
  margin-bottom: 15px;
  display: none;
  text-align: center;
  padding: 10px;
  background: rgba(78, 205, 196, 0.1);
  border-radius: 8px;
  border: 1px solid rgba(78, 205, 196, 0.3);
}

.success-message.show {
  display: block;
}

/* Add Agent 优化：头像选择器 */
.avatar-picker {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}

.avatar-option {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  border: 1px solid var(--w20);
  background: var(--w08);
  font-size: 18px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  padding: 0;
}

.avatar-option:hover,
.avatar-option.picked {
  border-color: #667eea;
  background: rgba(102, 126, 234, 0.15);
  transform: scale(1.1);
}

.avatar-custom-input {
  max-width: 120px;
  padding: 8px 12px;
  font-size: 14px;
}

/* Add Agent 优化：分类选择器 */
.category-picker {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}

.category-option {
  padding: 5px 12px;
  border-radius: 16px;
  border: 1px solid var(--w20);
  background: var(--w08);
  color: var(--w70);
  font-size: 12px;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.category-option:hover,
.category-option.picked {
  border-color: #667eea;
  background: rgba(102, 126, 234, 0.15);
  color: #a0b0ff;
}

.category-custom-input {
  max-width: 160px;
  padding: 6px 12px;
  font-size: 13px;
  border-radius: 16px;
}

/* Add Agent 优化：代码附件上传区域 */
.file-upload-zone {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  min-height: 52px;
  padding: 12px 16px;
  background: var(--w08);
  border: 2px dashed var(--w20);
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.3s ease;
  box-sizing: border-box;
}

.file-upload-zone:hover,
.file-upload-zone.has-file {
  border-color: #667eea;
  background: rgba(102, 126, 234, 0.06);
}

.file-upload-hint {
  color: var(--w55);
  font-size: 14px;
}

.file-upload-name {
  color: var(--text-primary);
  font-size: 13px;
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.file-upload-remove {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: none;
  background: rgba(255, 107, 107, 0.15);
  color: #ff6b6b;
  font-size: 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: all 0.2s ease;
  padding: 0;
  line-height: 1;
}

.file-upload-remove:hover {
  background: rgba(255, 107, 107, 0.3);
  transform: scale(1.1);
}

/* Add Agent 优化：字段提示与错误 */
.field-hint {
  color: var(--w55);
  font-size: 11px;
  font-weight: 400;
}

.field-err {
  display: block;
  color: #ff6b6b;
  font-size: 12px;
  margin-top: 4px;
}

.form-input.invalid,
.form-textarea.invalid {
  border-color: #ff6b6b;
  box-shadow: 0 0 8px rgba(255, 107, 107, 0.2);
}

/* 提交按钮加载动画 */
.spinner {
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 2px solid rgba(255,255,255,0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
  margin-right: 6px;
  vertical-align: middle;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Responsive */
@media (max-width: 768px) {
  .container {
    padding: 20px 12px;
    padding-right: 52px;
    padding-top: calc(20px + env(safe-area-inset-top));
    padding-bottom: calc(20px + env(safe-area-inset-bottom));
  }

  .header {
    margin-bottom: 30px;
    padding: 15px 0;
  }

  .header h1 {
    font-size: 28px;
    letter-spacing: 1px;
    margin-bottom: 14px;
  }

  .header-title-text {
    font-size: 1.38em;
  }

  .header-logo {
    height: 40px;
    width: 40px;
  }

  .header p {
    font-size: 14px;
  }

  .header-tagline {
    font-size: 18px;
    letter-spacing: 2px;
    margin-top: 8px;
    line-height: 1.65;
  }

  .header-meta {
    font-size: 13px;
    letter-spacing: 0.5px;
    line-height: 1.75;
    padding-top: 12px;
    margin-top: 16px;
    max-width: 92vw;
  }

  .header p.header-support-line {
    font-size: 13px;
    margin-top: 8px;
  }

  .agents-grid,
  .coming-soon-grid {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  .agents-section-heading {
    align-items: stretch;
    flex-direction: column;
    gap: 4px;
  }

  .platform-stats:not(.header-stats) {
    width: 100%;
    justify-content: stretch;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    padding: 6px;
    gap: 4px;
  }

  .coming-soon-section {
    padding: 16px;
  }

  .agent-card {
    padding: 20px 16px;
  }

  .agent-avatar {
    width: 60px;
    height: 60px;
    font-size: 36px;
  }

  .agent-name {
    font-size: 18px;
  }

  .teaching-mgmt-badge {
    top: 10px;
    right: 10px;
    font-size: 10px;
    padding: 3px 9px;
  }

  .password-modal {
    padding: 30px 20px;
    margin: 20px;
    max-height: calc(100vh - 40px);
    max-height: calc(100vh - 40px - env(safe-area-inset-top) - env(safe-area-inset-bottom));
    overflow-y: auto;
  }

  .password-input {
    font-size: 16px;
  }

  .add-agent-modal {
    padding: 30px 20px;
    margin: 20px;
    max-height: calc(100vh - 40px);
    max-height: calc(100vh - 40px - env(safe-area-inset-top) - env(safe-area-inset-bottom));
    overflow-y: auto;
  }

  .form-input,
  .form-textarea {
    font-size: 16px;
  }
}

@media (min-width: 1200px) {
  .agents-grid,
  .coming-soon-grid {
    grid-template-columns: repeat(5, 1fr);
  }
}

@media (prefers-reduced-motion: reduce) {
  .home-orb,
  .stars span,
  .header-title,
  .header h1,
  .header-title-text,
  .header-animate .header-tagline,
  .header-meta,
  .header-animate .header-support-line,
  .header-animate > p:not(.header-support-line):not(.header-meta),
  .header-logo,
  .home-search-fab::after,
  .add-agent-card,
  .about-us-card,
  .agent-card.show,
  .agent-card::after {
    animation: none !important;
    transition: none !important;
  }

  .agent-card,
  .agent-card.show {
    opacity: 1;
    transform: none;
  }

  .agent-card:hover {
    transform: none;
  }

  .home-orb {
    transform: none;
  }
}
