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

html,
body {
  height: 100%;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  background: #f5f5f5;
  color: #333;
  min-height: 100%;
  overflow: hidden;
}

#app {
  height: 100%;
  min-height: 100%;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.page {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  overflow: hidden;
  transition: all 0.3s ease;
}

.page.collapsed .glass-sidebar {
  width: 62px;
  padding: 16px 8px;
}

.page.collapsed .nav-label {
  display: none;
}

.page.collapsed .nav-item {
  justify-content: center;
  padding: 10px;
}

.page.collapsed .top-logo {
  transform: translate(0, 8px);
}

.topbar {
  display: flex;
  align-items: center;
  gap: 0;
  padding: 0 12px 0 0;
  height: 60px;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid rgba(0, 0, 0, 0.1);
  position: sticky;
  top: 0;
  z-index: 100;
}

.menu-btn {
  width: 44px;
  height: 44px;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  color: #333;
  cursor: pointer;
  padding: 0;
  margin-left: 5px;
  margin-right: 0;
  border-radius: 50%;
  transition: background 0.2s ease, transform 0.15s ease;
}

.menu-btn:hover {
  background: rgba(0, 0, 0, 0.08);
}

.menu-btn:active {
  transform: scale(0.96);
}

.menu-icon {
  width: 26px;
  height: 26px;
}

.top-logo {
  height: 180px;
  margin-left: -50px;
  transition: transform 0.3s ease;
  transform: translate(0, 8px);
  object-fit: contain;
  flex-shrink: 0;
  align-self: center;
  /* 避免超高 logo 溢出顶栏后盖住下方侧栏，导致「主页」无法划入/点击 */
  pointer-events: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-user-drag: none;
}

.topbar-actions {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 12px;
}

.topbar-theme-btn {
  width: 46px;
  height: 46px;
  padding: 0;
  border: none;
  background: transparent;
  display: inline-grid;
  place-items: center;
  cursor: pointer;
  border-radius: 50%;
  appearance: none;
  -webkit-appearance: none;
}

.topbar-theme-icon {
  width: 100%;
  height: 100%;
  object-fit: contain;
  border-radius: 10px;
}

.topbar-icon-btn {
  width: 40px;
  height: 40px;
  border: none;
  background: transparent;
  padding: 0;
  display: inline-grid;
  place-items: center;
  cursor: pointer;
  border-radius: 50%;
  appearance: none;
  -webkit-appearance: none;
}

.topbar-icon {
  width: 100%;
  height: 100%;
  object-fit: contain;
  border-radius: 10px;
}

.page.theme-dark .topbar {
  background: rgba(17, 24, 39, 0.92);
  border-bottom: 1px solid rgba(148, 163, 184, 0.25);
}

.page.theme-dark .top-logo {
  filter: brightness(1.28) contrast(1.1) drop-shadow(0 2px 8px rgba(0, 0, 0, 0.55));
}

.page.theme-dark .topbar-theme-btn,
.page.theme-dark .topbar-icon-btn {
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
}

.page.theme-dark .topbar-theme-btn:hover,
.page.theme-dark .topbar-icon-btn:hover {
  background: transparent !important;
}

.page.theme-dark .topbar-icon {
  filter: brightness(0) invert(1) contrast(1.05);
}

/* 夜间模式：尽量压掉图片资源自身的白色底板 */
.page.theme-dark .topbar-theme-icon,
.page.theme-dark .topbar-icon {
  mix-blend-mode: multiply;
}

.page.theme-dark .menu-btn {
  color: #e5e7eb;
}

.page.theme-dark .menu-btn:hover {
  background: rgba(148, 163, 184, 0.2);
}

.page.theme-dark .glass-sidebar {
  background: #0f172a;
  border-right: 1px solid #334155;
}

.page.theme-dark .nav-item {
  color: #cbd5e1;
}

.page.theme-dark .nav-item:hover {
  background: rgba(148, 163, 184, 0.18);
}

.page.theme-dark .nav-item.active {
  background: rgba(148, 163, 184, 0.28);
  color: #f8fafc;
}

.page.theme-dark .nav-icon {
  color: #cbd5e1;
}

.page.theme-dark .sidebar-about {
  background: rgba(15, 23, 42, 0.95);
  border-color: #334155;
  color: #cbd5e1;
}

.page.theme-dark .sidebar-about:hover {
  background: #111827;
  color: #f8fafc;
  box-shadow: 0 6px 22px rgba(2, 6, 23, 0.45);
}

.page.theme-dark .content {
  background: rgba(15, 23, 42, 0.9);
}

.page.theme-dark .agent-card {
  background: #111827;
  border-color: rgba(148, 163, 184, 0.25);
  box-shadow: 0 2px 10px rgba(2, 6, 23, 0.4);
}

.page.theme-dark .agent-card--gradient {
  background:
    linear-gradient(#111827, #111827) padding-box,
    linear-gradient(135deg, #ff78c6, #a855f7) border-box;
}

.page.theme-dark .agent-name {
  color: #f8fafc;
}

.page.theme-dark .agent-card__desc {
  color: #cbd5e1;
}

.page.theme-dark .email-panel {
  background: #0f172a;
  border-color: #334155;
}

.page.theme-dark .email-title {
  color: #f8fafc;
}

.page.theme-dark .email-label {
  color: #cbd5e1;
}

.page.theme-dark .email-input,
.page.theme-dark .email-textarea {
  background: #111827;
  border-color: #374151;
  color: #e5e7eb;
}

.page.theme-dark .email-btn--ghost {
  background: #1f2937;
  color: #e5e7eb;
}

.page-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
  position: relative;
  background: #1a2332 url("./background.png") center center / cover no-repeat fixed;
}

.layout {
  display: flex;
  flex: 1;
  position: relative;
  min-height: 0;
  overflow: hidden;
  align-items: stretch;
}

.glass-sidebar {
  width: 250px;
  flex-shrink: 0;
  padding: 16px 12px 16px 16px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-height: 0;
  align-self: stretch;
  overflow-y: auto;
  overflow-x: hidden;
  background: #ffffff;
  border-right: 1px solid #e8edf3;
  box-shadow: none;
  transition: width 0.28s ease, padding 0.28s ease;
  position: relative;
  z-index: 20;
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 0 0 auto;
  overflow: visible;
  position: relative;
  z-index: 2;
}

.sidebar-spacer {
  flex: 1;
  min-height: 12px;
  pointer-events: none;
}

/* 固定在视口左下角，不随智能体列表滚动；宽度与侧栏对齐 */
.sidebar-about {
  position: fixed;
  z-index: 60;
  left: 16px;
  bottom: max(16px, env(safe-area-inset-bottom, 16px));
  width: calc(250px - 28px);
  box-sizing: border-box;
  margin: 0;
  padding: 12px 14px;
  border: 1px solid #e8edf3;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(8px);
  box-shadow: 0 4px 18px rgba(15, 23, 42, 0.1);
  color: #5f6368;
  font-size: 16px;
  font-weight: 500;
  font-family: inherit;
  text-align: center;
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease, box-shadow 0.2s ease;
}

.page.collapsed .sidebar-about {
  width: calc(62px - 16px);
  left: 8px;
  padding: 10px 6px;
  font-size: 14px;
}

.sidebar-about:hover {
  background: #fff;
  color: #202124;
  box-shadow: 0 6px 22px rgba(15, 23, 42, 0.12);
}

.nav-item {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  width: 100%;
  min-height: 48px;
  padding: 12px 16px;
  margin: 0;
  background: transparent;
  border: none;
  text-align: left;
  cursor: pointer;
  border-radius: 999px;
  color: #3c4043;
  font-size: 16px;
  font-weight: 400;
  font-family: inherit;
  transition: background 0.18s ease, color 0.18s ease;
  position: relative;
  z-index: 3;
  align-self: stretch;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

.nav-item .nav-icon,
.nav-item .nav-label {
  pointer-events: none;
}

.nav-item:hover {
  background: #f1f3f4;
}

.nav-item.active {
  background: #e8eaed;
  font-weight: 500;
  color: #202124;
}

.nav-item.active .nav-icon {
  color: #202124;
}

.nav-icon {
  width: 28px;
  height: 28px;
  margin-right: 14px;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #5f6368;
}

.nav-icon svg {
  width: 24px;
  height: 24px;
  display: block;
}

.nav-icon-lg svg {
  width: 25px;
  height: 25px;
}

.nav-label {
  font-size: 16px;
  letter-spacing: 0.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* 关于 — 全屏层 */
.about-overlay {
  position: fixed;
  inset: 0;
  z-index: 10000;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.about-bg {
  position: fixed;
  inset: 0;
  z-index: 0;
  background: #1a2332 url("./background.png") center center / cover no-repeat;
  background-attachment: fixed;
}

.about-scrim {
  position: fixed;
  inset: 0;
  z-index: 1;
  background: rgba(0, 0, 0, 0.42);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}

.about-panel {
  position: relative;
  z-index: 2;
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding: 32px 24px 80px;
  pointer-events: none;
}

.about-panel .about-inner,
.about-panel .about-close {
  pointer-events: auto;
}

.about-close {
  position: fixed;
  top: 16px;
  right: 20px;
  z-index: 3;
  width: 44px;
  height: 44px;
  border: none;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
  font-size: 28px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s ease;
}

.about-close:hover {
  background: rgba(255, 255, 255, 0.28);
}

.email-overlay {
  position: fixed;
  inset: 0;
  z-index: 12000;
}

.email-scrim {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.5);
  backdrop-filter: blur(4px);
}

.email-panel {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: min(560px, calc(100vw - 36px));
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 14px;
  box-shadow: 0 16px 38px rgba(15, 23, 42, 0.28);
  padding: 18px;
}

.email-title {
  margin: 0 0 14px;
  font-size: 18px;
  color: #111827;
}

.email-label {
  display: block;
  margin: 10px 0 6px;
  font-size: 13px;
  color: #4b5563;
}

.email-input,
.email-textarea {
  width: 100%;
  border: 1px solid #d1d5db;
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 14px;
  outline: none;
  background: #fff;
  color: #111827;
}

.email-textarea {
  resize: vertical;
  min-height: 150px;
}

.email-input:focus,
.email-textarea:focus {
  border-color: #8b5cf6;
  box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.15);
}

.email-actions {
  margin-top: 14px;
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.email-btn {
  border: none;
  border-radius: 9px;
  padding: 9px 14px;
  font-size: 14px;
  cursor: pointer;
}

.email-btn--ghost {
  background: #f3f4f6;
  color: #374151;
}

.email-btn--primary {
  background: #8b5cf6;
  color: #fff;
}

.email-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.about-inner {
  max-width: 720px;
  width: 100%;
  color: #fff;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.35);
}

.about-brand {
  text-align: center;
  margin-top: -12px;
  margin-bottom: 24px;
}

.about-brand-logo {
  max-height: min(280px, 42vh);
  width: auto;
  max-width: min(480px, 88vw);
  object-fit: contain;
  filter: drop-shadow(0 2px 8px rgba(0, 0, 0, 0.25));
}

.about-tagline {
  margin-top: 12px;
  font-size: 18px;
  letter-spacing: 0.2em;
  color: rgba(255, 255, 255, 0.92);
}

.about-title {
  font-size: 22px;
  font-weight: 600;
  margin: 0 0 12px;
  color: #fff;
}

.about-divider {
  height: 1px;
  width: 100%;
  max-width: 100%;
  background: rgba(255, 255, 255, 0.75);
  margin-bottom: 24px;
}

.about-body {
  font-size: 15px;
  line-height: 1.85;
  color: rgba(255, 255, 255, 0.95);
}

.about-body p {
  margin: 0 0 16px;
}

.about-body strong {
  font-weight: 600;
  color: #fff;
}

.about-lead {
  font-weight: 600;
  font-size: 16px;
  margin-top: 28px !important;
  line-height: 1.7;
}

.content {
  flex: 1;
  min-width: 0;
  min-height: 0;
  padding: 20px;
  overflow-y: auto;
  background: rgba(248, 250, 252, 0.94);
  backdrop-filter: blur(8px);
}

.content.content--home {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: transparent;
}

.home-image-wrap {
  position: relative;
  flex: 0 0 auto;
  width: fit-content;
  max-width: 100%;
  margin: 0 auto;
  display: block;
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.08);
  background: transparent;
  line-height: 0;
}

.home-image {
  max-width: 100%;
  max-height: calc(100vh - 140px);
  width: auto;
  height: auto;
  object-fit: contain;
  object-position: center;
  display: block;
  vertical-align: top;
}

.agents-panel {
  padding: 20px 0;
}

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

.agent-card {
  background: #fff;
  border-radius: 14px;
  padding: 20px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
  transition: all 0.3s ease;
  cursor: pointer;
  border: 1px solid rgba(0, 0, 0, 0.06);
}

.agent-card--gradient {
  border: 1px solid transparent;
  background:
    linear-gradient(#ffffff, #ffffff) padding-box,
    linear-gradient(135deg, #ff78c6, #a855f7) border-box;
}

.agent-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 25px rgba(168, 85, 247, 0.18);
}

.agent-card--gradient:hover {
  box-shadow: 0 10px 28px rgba(236, 72, 153, 0.22);
}

.agent-header {
  display: flex;
  align-items: flex-start;
  margin-bottom: 12px;
}

.agent-avatar {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-right: 12px;
  flex-shrink: 0;
  font-weight: 600;
  font-size: 16px;
  color: white;
}

.agent-avatar.has-icon {
  background: none;
}

.agent-avatar-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  border-radius: 8px;
}

.agent-title-row {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.agent-name-box {
  flex: 1;
  min-width: 0;
}

.agent-name {
  font-size: 16px;
  font-weight: 600;
  margin: 0;
  color: #111827;
  line-height: 1.3;
}

.agent-card__desc {
  margin: 0;
  font-size: 14px;
  line-height: 1.5;
  color: #666;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 4;
  word-break: break-word;
}

.agent-desc-box {
  min-width: 0;
}

.agent-card-tooltip {
  max-width: min(420px, 90vw) !important;
  line-height: 1.55;
  word-break: break-word;
}

.official-badge {
  display: inline-flex;
  align-items: center;
  font-size: 11px;
  padding: 3px 10px;
  color: #fff;
  font-weight: 600;
  border-radius: 999px;
  flex-shrink: 0;
  background: linear-gradient(135deg, #ff78c6, #a855f7);
  box-shadow: 0 1px 4px rgba(168, 85, 247, 0.35);
}

@media (max-width: 768px) {
  .glass-sidebar {
    width: 62px;
    padding: 16px 8px;
  }

  .nav-label {
    display: none;
  }

  .sidebar-about {
    left: max(12px, env(safe-area-inset-left, 12px));
    bottom: max(12px, env(safe-area-inset-bottom, 12px));
    width: auto;
    min-width: 56px;
    padding: 10px 14px;
    font-size: 14px;
  }

  .nav-item {
    justify-content: center;
    padding: 10px;
  }

  .nav-icon {
    margin-right: 0;
  }

  .top-logo {
    height: 140px;
    margin-left: -16px;
    transform: translate(0, 4px);
  }

  .about-brand-logo {
    max-height: min(200px, 36vh);
    max-width: min(88vw, 360px);
  }

  .about-brand {
    margin-top: -8px;
    margin-bottom: 20px;
  }

  .about-panel {
    padding-top: 24px;
  }
  
  .agents-grid {
    grid-template-columns: 1fr;
  }

  .content {
    padding: 10px;
  }
  
  .content.content--home {
    min-height: 0;
  }

  .home-image {
    max-height: calc(100vh - 200px);
  }
}

@media (max-width: 480px) {
  .topbar {
    padding: 0 10px;
  }
  
  .menu-btn {
    margin-right: 10px;
  }
  
  .agent-card {
    padding: 15px;
  }
}