/* ===== Zenith Agent — AI Design Page ===== */
/* Figma: Shell 1440x1024, r=20 */
/* Sidebar is a FLOATING CARD (240x307), not a full-height panel */
/* All positions proportional to shell for responsiveness */

.agent-page {
  width: 100%;
  height: 100vh;
  background: #f5f3ff;
  position: relative;
  overflow: hidden;
  font-family: -apple-system, 'SF Pro Display', 'SF Pro Text', 'Helvetica Neue', sans-serif;
}

/* — Aura blobs — */
.agent-aura {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
}
.agent-aura span {
  position: absolute;
  border-radius: 50%;
  background: #e1d5ff;
  filter: blur(100px);
  opacity: 0.6;
  animation: auraFloat 12s ease-in-out infinite alternate;
}
.agent-aura span:nth-child(1) { width: 36%; height: 38%; top: 8%; left: 3%; }
.agent-aura span:nth-child(2) { width: 41%; height: 12%; top: 0; right: 8%; animation-delay: -3s; }
.agent-aura span:nth-child(3) { width: 36%; height: 38%; bottom: 5%; right: 0; animation-delay: -6s; }
.agent-aura span:nth-child(4) { width: 13%; height: 39%; bottom: 10%; left: 30%; animation-delay: -9s; }
.agent-aura span:nth-child(5) { width: 40%; height: 56%; top: 18%; left: 38%; opacity: 0.12; background: #c4b5fd; }
@keyframes auraFloat {
  0%   { transform: translate(0, 0) scale(1); }
  100% { transform: translate(30px, -20px) scale(1.08); }
}

/* — Shell — */
.agent-shell {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 1440px;
  height: 100vh;
  margin: 0 auto;
  border-radius: 20px;
  overflow: hidden;
  background: rgba(255,255,255,0.55);
  backdrop-filter: blur(40px);
  -webkit-backdrop-filter: blur(40px);
  box-shadow: 0 8px 60px rgba(130,90,228,0.08);
}

/* ================================================================
   SIDEBAR CARD: 240x307, r=12, bg=#fff
   Figma: left=21, top=22 (1.46%, 2.15%)
   shadow: 0 3px 6.7px rgba(0,0,0,0.15)
   Collapses VERTICALLY (up/down)
   ================================================================ */
.agent-sidebar-card {
  position: absolute;
  left: 1.46%;       /* 21/1440 */
  top: 2.15%;        /* 22/1024 */
  width: 240px;
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 3px 6.7px 0 rgba(0,0,0,0.15);
  z-index: 10;
  overflow: hidden;
  transition: height 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Header: 231x40, bg=#d9d9d9, r=10 */
.agent-sidebar-header {
  display: flex;
  align-items: center;
  height: 40px;
  background: #fff;
  border-radius: 10px;
  margin: 4px 4px 0;
  padding: 0 12px;
  position: relative;
  flex-shrink: 0;
  z-index: 2;
}
.brand-icon {
  font-size: 16px;
  color: #000;
  flex-shrink: 0;
  margin-right: 8px;
}
.brand-text {
  font-size: 16px;
  font-weight: 700;
  color: #000;
  white-space: nowrap;
}
.sidebar-toggle-btn {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  cursor: pointer;
  color: #666;
  font-size: 12px;
  padding: 4px;
  transition: transform 0.3s;
}
.sidebar-toggle-btn:hover { color: #825ae4; }

/* Nav body — collapsible */
.agent-sidebar-body {
  padding: 8px 4px 12px 6px;
  max-height: 260px;
  overflow: hidden;
  transition: max-height 0.4s cubic-bezier(0.4, 0, 0.2, 1),
              padding 0.4s cubic-bezier(0.4, 0, 0.2, 1),
              opacity 0.3s;
  opacity: 1;
}

/* Collapsed state: body hidden, card shrinks to header only */
.agent-sidebar-card.collapsed .agent-sidebar-body {
  max-height: 0;
  padding-top: 0;
  padding-bottom: 0;
  opacity: 0;
}
.agent-sidebar-card.collapsed .sidebar-toggle-btn {
  transform: translateY(-50%) rotate(180deg);
}

.agent-nav-label {
  font-size: 12px;
  font-weight: 590;
  color: #000;
  margin-bottom: 10px;
}
.agent-nav { list-style: none; margin: 0; padding: 0; }
.agent-nav li { margin-bottom: 10px; }
.agent-nav a {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 8px;
  height: 19px;
  border-radius: 5px;
  font-size: 12px;
  font-weight: 400;
  color: #000;
  text-decoration: none;
  transition: all 0.2s;
  white-space: nowrap;
}
.agent-nav a:hover {
  background: rgba(130,90,228,0.08);
  color: #825ae4;
}
/* Active: 225x33, bg=#825ae4, r=5 */
.agent-nav a.active {
  background: #825ae4;
  color: #fff;
  font-weight: 590;
  font-size: 13px;
  height: 33px;
  padding: 0 10px;
}
.agent-nav a i {
  width: 19px;
  min-width: 19px;
  height: 19px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  flex-shrink: 0;
}
.agent-nav-divider {
  width: 223px;
  height: 1px;
  background: rgba(0,0,0,0.1);
  margin: 10px 0;
}

/* ================================================================
   TITLE & SUBTITLE
   Title: top=115 (11.23%), centered in content area
   Subtitle: top=195 (19.04%)
   ================================================================ */
.agent-title {
  position: absolute;
  top: 11.23%;      /* 115/1024 */
  left: 23.33%;     /* 336/1440 — content left edge */
  right: 23.40%;    /* 337/1440 — content right edge */
  text-align: center;
  font-size: clamp(28px, 3.54vw, 51px);
  font-weight: 700;
  color: #000;
  margin: 0;
  line-height: 1.2;
}
.agent-subtitle {
  position: absolute;
  top: 19.04%;      /* 195/1024 */
  left: 23.33%;
  right: 23.40%;
  text-align: center;
  font-size: clamp(11px, 0.97vw, 14px);
  font-weight: 400;
  color: #8f8f8f;
  margin: 0;
}

/* ================================================================
   CONTENT AREA
   Figma: left=336 (23.33%), content width=768 (53.33%)
   Chat top=268 (26.17%), gap=20px between sections
   Bottom area bottom=39px (3.81%)
   ================================================================ */
.agent-content {
  position: absolute;
  left: 23.33%;
  right: 23.40%;
  top: 26.17%;       /* 268/1024 — chat box starts here */
  bottom: 3.81%;     /* 39/1024 */
  display: flex;
  flex-direction: column;
  gap: 20px;
  overflow-y: auto;
}
.agent-content::-webkit-scrollbar { display: none; }
.agent-content { -ms-overflow-style: none; scrollbar-width: none; }

/* ====== DIALOG BOX: 767x195, r=15, pad=11/8/8/8 ====== */
.agent-dialog {
  background: #fff;
  border-radius: 15px;
  padding: 11px 8px 8px 8px;
  display: flex;
  flex-direction: column;
  min-height: 195px;
  box-shadow: 0 3px 6.7px 0 rgba(0,0,0,0.15);
  flex-shrink: 0;
}

/* Textarea: fills the top part */
.agent-dialog-textarea {
  flex: 1;
  border: none;
  background: transparent;
  outline: none;
  resize: none;
  padding: 4px 8px;
  font-family: -apple-system, 'SF Pro Display', sans-serif;
  font-size: 12px;
  color: #000;
  line-height: 1.6;
  min-height: 120px;
}
.agent-dialog-textarea::placeholder {
  color: #8f8f8f;
}

/* Toolbar at bottom: add files + send */
.agent-dialog-toolbar {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-top: auto;
}
.agent-add-btn {
  background: none;
  border: none;
  cursor: pointer;
  color: #aaa;
  font-size: 16px;
  padding: 0;
  display: flex;
  align-items: center;
  flex-shrink: 0;
  transition: color 0.2s;
}
.agent-add-btn:hover { color: #825ae4; }
.agent-add-label {
  font-size: 12px;
  color: #8f8f8f;
  flex: 1;
}

/* Send button: 102x36, bg=#825ae4, r=8 */
.agent-send-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: #825ae4;
  color: #fff;
  border: none;
  border-radius: 8px;
  width: 102px;
  height: 36px;
  font-family: -apple-system, 'SF Pro Display', sans-serif;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.2s;
  flex-shrink: 0;
}
.agent-send-btn:hover { background: #6d45d0; }
.agent-send-btn i { font-size: 13px; }

/* ====== DASHBOARD CARDS ====== */
.agent-cards-row {
  display: flex;
  gap: 14px;
  flex-shrink: 0;
}

.agent-card {
  flex: 1;
  background: #fff;
  border-radius: 15px;
  box-shadow: 0 3px 6.7px 0 rgba(0,0,0,0.10);
  cursor: pointer;
  transition: transform 0.25s, box-shadow 0.25s;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 154px;
  position: relative;
  overflow: visible;
}
.agent-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 6px 20px rgba(0,0,0,0.15);
}

.agent-card-icon {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 20px;
  flex-shrink: 0;
  margin-bottom: 10px;
}

.agent-card-name {
  font-size: 14px;
  font-weight: 700;
  color: #333;
}


.agent-bottom-area {
  flex: 1;
  min-height: 20px;
}

/* ================================================================
   TOOLTIP PORTAL — dedicated layer above ALL other elements
   Including the .cursor with mix-blend-mode: difference
   ================================================================ */
#tooltip-portal {
  position: fixed;
  inset: 0;
  z-index: 2147483647;  /* maximum safe z-index */
  pointer-events: none;
  isolation: isolate;    /* break free from any parent stacking context */
}

/* Hover tooltip — positioned via JS as fixed overlay on body */
.agent-card-tip {
  display: none;
  position: fixed;
  background: #fff;
  border-radius: 14px;
  box-shadow: 0 12px 40px rgba(0,0,0,0.20);
  padding: 14px 16px;
  width: 380px;
  max-width: 92vw;
  z-index: 2147483647;
  pointer-events: none;
  isolation: isolate;
  mix-blend-mode: normal;
  animation: tipFadeIn 0.2s ease;
}
@keyframes tipFadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to   { opacity: 1; transform: translateY(0); }
}
.agent-card-tip::before {
  content: '';
  position: absolute;
  bottom: -6px;
  left: 50%;
  transform: translateX(-50%);
  width: 0;
  height: 0;
  border-left: 6px solid transparent;
  border-right: 6px solid transparent;
  border-top: 6px solid #fff;
}

/* Tooltip show/hide is handled by JS (tip moved to body to escape overflow clipping) */

/* When tooltip shows below the card (not enough space above) */
.agent-card-tip.tip-below::before {
  bottom: auto;
  top: -6px;
  border-top: none;
  border-bottom: 6px solid #fff;
}

/* ===== Preview Panel (image/workflow area at top of tooltip) ===== */
.card-tip-preview {
  margin: -14px -16px 12px;
  border-radius: 14px 14px 0 0;
  overflow: hidden;
}

.preview-banner {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  color: #fff;
  font-size: 12px;
  font-weight: 600;
}
.preview-banner i {
  font-size: 14px;
  opacity: 0.9;
}

.preview-flow {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 14px 12px;
  background: #faf9ff;
  overflow-x: auto;
  flex-wrap: nowrap;
}
.preview-flow::-webkit-scrollbar { display: none; }

.flow-node {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
  min-width: 52px;
}
.flow-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #d1c4f0;
  flex-shrink: 0;
}
.flow-node span {
  font-size: 9px;
  color: #6b5b8a;
  text-align: center;
  line-height: 1.3;
  max-width: 64px;
  word-break: keep-all;
}
.flow-arrow {
  color: #c4b5e8;
  font-size: 9px;
  flex-shrink: 0;
  margin-top: -12px;
}

/* Dual-lane layout (AI智能合同) */
.preview-flow-dual {
  flex-direction: column;
  gap: 6px;
  padding: 8px 10px;
}
.flow-lane {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: nowrap;
}
.flow-lane-label {
  font-size: 9px;
  font-weight: 600;
  color: #7e91e3;
  writing-mode: vertical-rl;
  text-orientation: upright;
  letter-spacing: 2px;
  flex-shrink: 0;
  margin-right: 4px;
  padding: 2px 4px;
  background: rgba(126,145,227,0.06);
  border-radius: 4px;
}

/* Branched layout (AI智能客服) */
.preview-flow-branched {
  flex-wrap: wrap;
  justify-content: center;
}
.flow-node-start {
  width: 100%;
  margin-bottom: 2px;
}
.flow-branches {
  display: flex;
  gap: 6px;
  width: 100%;
  justify-content: center;
  margin-bottom: 4px;
}
.flow-branch {
  font-size: 9px;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 10px;
  background: #fff3e6;
  color: #d4894a;
  border: 1px solid #f5d5b0;
}

/* Tags + description (unchanged but repositioned below preview) */
.card-tip-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-bottom: 8px;
  padding: 0 2px;
}
.card-tip-tags span {
  font-size: 10px;
  color: #8b83ba;
  background: rgba(139,131,186,0.08);
  padding: 2px 8px;
  border-radius: 4px;
  white-space: nowrap;
}

.card-tip-desc {
  font-size: 12px;
  color: #777;
  line-height: 1.7;
  margin: 0;
  padding: 0 2px;
}

/* ====== AGENT CHAT VIEW ====== */
.agent-chat-view {
  position: absolute;
  left: 23.33%;
  right: 23.40%;
  top: 2.5%;
  bottom: 3.81%;
  display: flex;
  flex-direction: column;
  background: #fff;
  border-radius: 15px;
  box-shadow: 0 3px 6.7px 0 rgba(0,0,0,0.15);
  overflow: hidden;
}

/* Chat header */
.agent-chat-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 20px;
  border-bottom: 1px solid #f0f0f0;
  flex-shrink: 0;
}
.agent-chat-header-icon {
  width: 40px;
  height: 40px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 18px;
  flex-shrink: 0;
}
.agent-chat-header-name {
  font-size: 16px;
  font-weight: 700;
  color: #000;
}
.agent-chat-header-status {
  font-size: 12px;
  color: #55b05f;
  display: flex;
  align-items: center;
  gap: 4px;
}
.agent-chat-header-status span:first-child {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #55b05f;
  display: inline-block;
}

/* Chat messages */
.agent-chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.agent-chat-messages::-webkit-scrollbar { display: none; }
.agent-chat-messages { -ms-overflow-style: none; scrollbar-width: none; }

.agent-chat-welcome {
  text-align: center;
  padding: 60px 40px;
}
.agent-chat-welcome p {
  font-size: 14px;
  color: #8f8f8f;
  line-height: 1.8;
  margin: 0;
}
.agent-chat-welcome p strong {
  color: #e0e0e0;
  font-size: 15px;
}
/* Chat bubbles */
.chat-bubble {
  max-width: 70%;
  padding: 10px 16px;
  border-radius: 12px;
  font-size: 14px;
  line-height: 1.6;
  word-wrap: break-word;
  animation: bubbleIn 0.3s ease;
}
@keyframes bubbleIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}
.chat-bubble-user {
  align-self: flex-end;
  background: #825ae4;
  color: #fff;
  border-radius: 12px 12px 2px 12px;
}
.chat-bubble-ai {
  align-self: flex-start;
  background: #f5f5f5;
  color: #333;
  border-radius: 12px 12px 12px 2px;
  white-space: pre-wrap;
}

/* Chat input bar */
.agent-chat-inputbar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 20px 16px;
  border-top: 1px solid #f0f0f0;
  flex-shrink: 0;
}
.agent-chat-input {
  flex: 1;
  height: 40px;
  border: 1px solid #e0e0e0;
  background: #fff;
  border-radius: 10px;
  outline: none;
  padding: 0 14px;
  font-family: -apple-system, 'SF Pro Display', sans-serif;
  font-size: 13px;
  color: #333;
  box-sizing: border-box;
  transition: border-color 0.2s;
}
.agent-chat-input:focus { border-color: #825ae4; }
.agent-chat-input::placeholder { color: #bbb; }

.agent-chat-sendbtn {
  width: 40px;
  height: 40px;
  border: none;
  background: #825ae4;
  color: #fff;
  border-radius: 10px;
  font-size: 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
  flex-shrink: 0;
}
.agent-chat-sendbtn:hover { background: #6d45d0; }

/* File upload button */
.agent-chat-filebtn {
  width: 40px;
  height: 40px;
  border: 1px solid #e0e0e0;
  background: #fff;
  color: #999;
  border-radius: 10px;
  font-size: 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  flex-shrink: 0;
}
.agent-chat-filebtn:hover {
  border-color: #825ae4;
  color: #825ae4;
}

/* File preview bar */
.agent-chat-file-preview {
  padding: 8px 20px;
  border-top: 1px solid #f0f0f0;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: #666;
  background: #fafafa;
}
.agent-chat-file-preview .file-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #f0ecfb;
  color: #825ae4;
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 12px;
}
.agent-chat-file-preview .file-tag i {
  font-size: 11px;
}
.agent-chat-file-preview .file-remove {
  cursor: pointer;
  color: #999;
  font-size: 13px;
  margin-left: 2px;
  transition: color 0.2s;
}
.agent-chat-file-preview .file-remove:hover {
  color: #e44;
}

/* Typing indicator */
.chat-typing {
  opacity: 0.6;
  animation: typingPulse 1s ease-in-out infinite;
}
@keyframes typingPulse {
  0%, 100% { opacity: 0.6; }
  50% { opacity: 0.3; }
}

/* ====== BACK BUTTON (inside agent-shell, absolute positioned) ====== */
.agent-back {
  position: absolute;
  top: 24px;
  right: 24px;
  z-index: 100;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  background: rgba(255,255,255,0.85);
  backdrop-filter: blur(12px);
  border-radius: 10px;
  font-size: 13px;
  font-weight: 600;
  color: #825ae4;
  text-decoration: none;
  box-shadow: 0 2px 12px rgba(0,0,0,0.06);
  transition: all 0.2s;
}
.agent-back:hover {
  background: #825ae4;
  color: #fff;
}

/* ====== CHAT BACK TO DASHBOARD BUTTON ====== */
.agent-chat-back {
  display: none;
}


/* ====== RESPONSIVE ====== */
@media (max-width: 1100px) {
  .agent-sidebar-card {
    left: 12px;
    top: 12px;
  }
  .agent-title,
  .agent-subtitle {
    left: 20px;
    right: 20px;
  }
  .agent-content {
    left: 20px;
    right: 20px;
    top: 28%;
  }
  .agent-cards-row { gap: 10px; }
}

@media (max-width: 768px) {
  /* Allow page content to fit viewport and scroll internally */
  .agent-page {
    height: 100vh;
    height: 100svh;
    overflow: hidden;
  }
  .agent-sidebar-card {
    position: relative;
    left: auto;
    top: auto;
    width: 100%;
    border-radius: 0;
    box-shadow: 0 1px 4px rgba(0,0,0,0.1);
    flex-shrink: 0;
  }

  /* All top-right controls: fixed to viewport, same top, identical sizing */
  .agent-back,
  .lang-toggle,
  .sidebar-toggle-btn {
    position: fixed !important;
    top: 14px !important;
    z-index: 10000 !important;
    padding: 6px 12px !important;
    font-size: 12px !important;
    font-weight: 600 !important;
    height: auto !important;
    border: none !important;
    border-radius: 8px !important;
    background: rgba(255,255,255,0.85) !important;
    color: #825ae4 !important;
    box-shadow: 0 2px 12px rgba(0,0,0,0.06);
    transform: none !important;
    display: flex !important;
    align-items: center !important;
    line-height: 1 !important;
  }
  .agent-back {
    right: 50px !important;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
  }
  .lang-toggle {
    right: 130px !important;
  }
  .sidebar-toggle-btn {
    right: 12px !important;
  }
  .agent-sidebar-card.collapsed .sidebar-toggle-btn {
    transform: rotate(180deg) !important;
  }

  /* Show back-to-dashboard button in chat views */
  .agent-chat-back {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    background: none;
    border: none;
    color: #825ae4;
    font-size: 13px;
    font-weight: 600;
    font-family: -apple-system, 'SF Pro Display', sans-serif;
    cursor: pointer;
    flex-shrink: 0;
  }
  .agent-chat-back i {
    font-size: 12px;
  }
  .agent-title,
  .agent-subtitle {
    position: relative;
    top: auto;
    left: auto;
    right: auto;
    padding: 0 20px;
  }
  .agent-title { margin-top: 20px; font-size: 28px !important; }
  .agent-subtitle { margin-top: 8px; }

  .agent-content {
    position: relative;
    top: auto;
    left: auto;
    right: auto;
    bottom: auto;
    padding: 20px;
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }
  .agent-shell {
    height: 100%;
    border-radius: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
  }
  .agent-cards-row { flex-direction: column; }
  .agent-card {
    height: auto;
    min-height: 120px;
    padding: 20px 16px;
  }
  .agent-card-icon {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    font-size: 17px;
    margin-bottom: 8px;
  }
  .agent-card-name {
    font-size: 13px;
  }

  /* All views: become flex children */
  .agent-view {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }

  /* Chat views: fill shell as flex child instead of absolute */
  .agent-chat-view {
    position: relative;
    left: auto;
    right: auto;
    top: auto;
    bottom: auto;
    flex: 1;
    min-height: 0;
    margin: 0;
    border-radius: 0;
    box-shadow: none;
  }
  .agent-chat-messages {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }
  .agent-chat-welcome {
    padding: 30px 20px;
  }

  /* Behind the Code scroll area */
  .btc-scroll {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }
}

@media (max-width: 480px) {
  .agent-cards-row { flex-direction: column; }
  .agent-card {
    height: auto;
    min-height: 110px;
    padding: 18px 14px;
  }
  .agent-card-icon {
    width: 34px;
    height: 34px;
    border-radius: 8px;
    font-size: 16px;
    margin-bottom: 8px;
  }
  .agent-card-name {
    font-size: 12px;
  }
  .agent-title { font-size: 22px !important; }
  .agent-chat-inputbar { padding: 8px 12px 12px; gap: 8px; }
  .agent-chat-input { font-size: 16px; } /* prevent iOS zoom on focus */
  .btc-card { padding: 14px 16px; }
  .btc-desc { font-size: 12.5px; }
}

/* ===== AI 自我介绍气泡 ===== */
.ai-intro-bubble {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  flex-shrink: 0;
  animation: bubbleFadeIn 0.5s ease 0.5s both;
}
@keyframes bubbleFadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}
.ai-intro-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, #8680e3, #b893dd);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 16px;
  flex-shrink: 0;
}
.ai-intro-content {
  background: #fff;
  border-radius: 0 16px 16px 16px;
  padding: 12px 18px;
  box-shadow: 0 2px 12px rgba(134, 128, 227, 0.15);
  max-width: 420px;
  font-size: 14px;
  line-height: 1.6;
  color: #333;
  position: relative;
}

/* 打字跳动点 —— 2秒后消失 */
.ai-intro-typing {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 4px 0;
  animation: typingHide 0.3s ease 2s forwards;
}
@keyframes typingHide {
  to { height: 0; padding: 0; overflow: hidden; opacity: 0; }
}
.ai-intro-typing span {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #8680e3;
  animation: typingBounce 1.2s ease-in-out infinite;
}
.ai-intro-typing span:nth-child(2) { animation-delay: 0.2s; }
.ai-intro-typing span:nth-child(3) { animation-delay: 0.4s; }
@keyframes typingBounce {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
  30% { transform: translateY(-6px); opacity: 1; }
}

/* 文字 —— 2秒后出现 */
.ai-intro-text {
  opacity: 0;
  max-height: 0;
  overflow: hidden;
  animation: textReveal 0.5s ease 2s forwards;
}
@keyframes textReveal {
  to { opacity: 1; max-height: 200px; }
}

/* ===== Behind the Code ===== */
.btc-scroll {
  flex: 1;
  overflow-y: auto;
  padding: 24px 32px 40px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}
.btc-card {
  display: flex;
  gap: 20px;
  background: #fff;
  border-radius: 16px;
  padding: 24px 28px;
  box-shadow: 0 2px 12px rgba(134, 128, 227, 0.08);
  transition: box-shadow 0.3s, transform 0.3s;
}
.btc-card:hover {
  box-shadow: 0 6px 24px rgba(134, 128, 227, 0.18);
  transform: translateY(-2px);
}
.btc-number {
  font-size: 32px;
  font-weight: 800;
  color: #e0dbff;
  line-height: 1;
  flex-shrink: 0;
  width: 48px;
  font-family: 'SF Mono', 'Fira Code', monospace;
}
.btc-body {
  flex: 1;
  min-width: 0;
}
.btc-title {
  font-size: 17px;
  font-weight: 700;
  color: #1a1a2e;
  margin-bottom: 8px;
}
.btc-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 10px;
}
.btc-tags span {
  font-size: 11px;
  padding: 3px 10px;
  border-radius: 20px;
  background: #f0edff;
  color: #6c63ff;
  font-weight: 500;
}
.btc-desc {
  font-size: 13.5px;
  line-height: 1.7;
  color: #555;
  margin: 0;
}
.btc-desc code {
  background: #f0edff;
  color: #6c63ff;
  padding: 1px 6px;
  border-radius: 4px;
  font-size: 12.5px;
  font-family: 'SF Mono', 'Fira Code', monospace;
}

/* Cursor demo area */
.btc-demo {
  margin-top: 14px;
  height: 120px;
  border-radius: 12px;
  background: linear-gradient(135deg, #1a1a2e 0%, #2d2b55 100%);
  position: relative;
  overflow: hidden;
  cursor: none;
}
.btc-demo-hint {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: rgba(255,255,255,0.3);
  font-size: 13px;
  pointer-events: none;
  transition: opacity 0.3s;
}
.btc-demo:hover .btc-demo-hint {
  opacity: 0;
}
.btc-demo-cursor-big {
  position: absolute;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1.5px solid rgba(255,255,255,0.8);
  mix-blend-mode: difference;
  pointer-events: none;
  transform: translate(-50%, -50%);
  transition: width 0.3s, height 0.3s;
  display: none;
}
.btc-demo-cursor-small {
  position: absolute;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #fff;
  pointer-events: none;
  transform: translate(-50%, -50%);
  display: none;
}

/* Responsive */
@media (max-width: 768px) {
  .btc-scroll { padding: 16px 16px 32px; }
  .btc-card { flex-direction: column; gap: 8px; padding: 18px 20px; }
  .btc-number { font-size: 24px; width: auto; }
}
