/* TubeLens OSS — Modern Responsive CSS Architecture & Performance Optimization */
:root {
  --font-sans: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji";
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  
  --bg-base: #0a0d14;
  --code-text: #e2e8f0;
  --bg-surface: #111622;
  --bg-surface-elevated: #182032;
  --bg-glass: rgba(17, 22, 34, 0.85);
  --border-subtle: rgba(255, 255, 255, 0.08);
  --border-strong: rgba(255, 255, 255, 0.16);
  
  --text-primary: #f1f5f9;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  
  --brand-primary: #ef4444; /* YouTube Red Accent */
  --brand-glow: rgba(239, 68, 68, 0.25);
  --accent-cyan: #06b6d4;
  --accent-blue: #3b82f6;
  --accent-emerald: #10b981;
  --accent-amber: #f59e0b;
  
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --radius-pill: 9999px;
  
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.4), 0 2px 4px -2px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.5), 0 4px 6px -4px rgba(0, 0, 0, 0.4);
  --shadow-glow: 0 0 25px var(--brand-glow);
  
  --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-normal: 250ms cubic-bezier(0.4, 0, 0.2, 1);
}

/* Dark mode only — no light theme */

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

html {
  font-family: var(--font-sans);
  background-color: var(--bg-base);
  color: var(--text-primary);
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-size-adjust: 100%;
  -webkit-text-size-adjust: 100%;
}

body {
  min-height: 100vh;
  line-height: 1.6;
  overflow-x: hidden;
  background-image: 
    radial-gradient(at 0% 0%, rgba(239, 68, 68, 0.08) 0px, transparent 50%),
    radial-gradient(at 100% 100%, rgba(59, 130, 246, 0.06) 0px, transparent 50%);
  background-attachment: fixed;
  display: flex;
  flex-direction: column;
}

main {
  flex: 1;
}

a {
  color: inherit;
  text-decoration: none;
}

/* Header & Navigation */
.navbar {
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  background: var(--bg-glass);
  border-bottom: 1px solid var(--border-subtle);
  padding: max(0.75rem, env(safe-area-inset-top)) 1.5rem 0.75rem;
  transition: background-color var(--transition-normal);
}

.nav-container {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: relative;
}

.brand-link {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-weight: 700;
  font-size: 1.25rem;
  letter-spacing: -0.02em;
  min-height: 44px;
}

.brand-icon {
  width: 32px;
  height: 32px;
  background: linear-gradient(135deg, #1e1b4b, #0f172a);
  border: 1px solid rgba(99, 102, 241, 0.4);
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #38bdf8;
  box-shadow: 0 2px 10px rgba(99, 102, 241, 0.3);
}

.badge-oss {
  font-size: 0.7rem;
  font-weight: 600;
  background: rgba(239, 68, 68, 0.15);
  color: var(--brand-primary);
  border: 1px solid rgba(239, 68, 68, 0.3);
  padding: 0.15rem 0.45rem;
  border-radius: var(--radius-pill);
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  list-style: none;
}

.nav-links a {
  color: var(--text-secondary);
  font-size: 0.95rem;
  font-weight: 500;
  transition: color var(--transition-fast);
  padding: 0.5rem 0.25rem;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
}

.nav-links a:hover {
  color: var(--text-primary);
}

.nav-llms-link {
  font-family: var(--font-mono);
  font-size: 0.8rem !important;
  background: rgba(99, 102, 241, 0.12);
  color: #818cf8 !important;
  border: 1px solid rgba(99, 102, 241, 0.3);
  padding: 0.2rem 0.55rem !important;
  border-radius: var(--radius-sm);
  min-height: auto !important;
}

.nav-llms-link:hover {
  background: rgba(99, 102, 241, 0.25);
  color: #a5b4fc !important;
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.btn-icon {
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  width: 44px;
  height: 44px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.btn-icon:hover {
  color: var(--text-primary);
  border-color: var(--border-strong);
}

.mobile-only {
  display: none;
}

.btn-github {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
  padding: 0 1rem;
  height: 44px;
  border-radius: var(--radius-md);
  font-size: 0.9rem;
  font-weight: 600;
  transition: all var(--transition-fast);
}

.btn-github:hover {
  border-color: var(--border-strong);
  background: var(--bg-surface);
  transform: translateY(-1px);
}

/* Hero Section */
.hero {
  max-width: 960px;
  margin: 0 auto;
  padding: clamp(3rem, 8vw, 6rem) 1.5rem clamp(2rem, 5vw, 4rem);
  text-align: center;
}

.hero-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.25);
  color: var(--brand-primary);
  font-size: 0.85rem;
  font-weight: 600;
  padding: 0.35rem 0.9rem;
  border-radius: var(--radius-pill);
  margin-bottom: 1.5rem;
}

.hero h1 {
  font-size: clamp(2.1rem, 5.5vw, 3.8rem);
  font-weight: 800;
  line-height: 1.15;
  letter-spacing: -0.03em;
  margin-bottom: 1.25rem;
}

.gradient-text {
  background: linear-gradient(135deg, #ef4444 0%, #f97316 50%, #3b82f6 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.hero p.lead {
  font-size: clamp(1rem, 2.2vw, 1.25rem);
  color: var(--text-secondary);
  max-width: 720px;
  margin: 0 auto 2.25rem;
  line-height: 1.6;
}

.hero-cta {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 3rem;
}

.btn-primary {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--brand-primary);
  color: white;
  font-weight: 600;
  font-size: 0.98rem;
  padding: 0 1.5rem;
  min-height: 48px;
  border-radius: var(--radius-md);
  box-shadow: 0 4px 14px rgba(239, 68, 68, 0.35);
  transition: all var(--transition-fast);
  border: none;
  cursor: pointer;
}

.btn-primary:hover {
  background: #dc2626;
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(239, 68, 68, 0.45);
}

.btn-secondary {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
  font-weight: 600;
  font-size: 0.98rem;
  padding: 0 1.4rem;
  min-height: 48px;
  border-radius: var(--radius-md);
  transition: all var(--transition-fast);
  cursor: pointer;
}

.btn-secondary:hover {
  border-color: var(--border-strong);
  background: var(--bg-surface);
  transform: translateY(-1px);
}

.features-grid-badges {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.6rem;
}

.feature-badge {
  font-size: 0.82rem;
  font-weight: 500;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  padding: 0.35rem 0.75rem;
  border-radius: var(--radius-pill);
}

/* Sections */
.section {
  max-width: 1200px;
  margin: 0 auto;
  padding: clamp(3rem, 6vw, 5rem) 1.5rem;
  scroll-margin-top: 84px;
}

.section-header {
  text-align: center;
  max-width: 700px;
  margin: 0 auto 3rem;
}

.section-tag {
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--brand-primary);
  margin-bottom: 0.5rem;
}

.section-title {
  font-size: clamp(1.75rem, 3.5vw, 2.5rem);
  font-weight: 800;
  letter-spacing: -0.02em;
  margin-bottom: 0.75rem;
}

.section-subtitle {
  color: var(--text-secondary);
  font-size: clamp(0.95rem, 1.8vw, 1.1rem);
}

/* Interactive Simulator */
.demo-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  display: grid;
  grid-template-columns: 1fr 1fr;
  overflow: hidden;
  box-shadow: var(--shadow-lg);
}

.demo-input-pane, .demo-output-pane {
  padding: clamp(1.25rem, 3vw, 2rem);
}

.demo-input-pane {
  background: rgba(0, 0, 0, 0.15);
  border-right: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.pane-label {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin-bottom: 0.25rem;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.form-group label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.form-input, .form-select {
  background: var(--bg-base);
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 0.9rem;
  padding: 0.75rem 0.9rem;
  border-radius: var(--radius-md);
  min-height: 48px;
  transition: border-color var(--transition-fast);
  width: 100%;
}

.form-input:focus, .form-select:focus {
  outline: none;
  border-color: var(--brand-primary);
}

.sim-output-box {
  background: var(--bg-base);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  height: 100%;
  min-height: 320px;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  font-size: 0.9rem;
  line-height: 1.55;
}

.citation-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  background: rgba(239, 68, 68, 0.15);
  color: var(--brand-primary);
  border: 1px solid rgba(239, 68, 68, 0.3);
  padding: 0.25rem 0.6rem;
  border-radius: var(--radius-sm);
  font-family: var(--font-mono);
  font-size: 0.78rem;
  font-weight: 600;
}

.attribution-bar {
  margin-top: auto;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border-subtle);
  font-size: 0.8rem;
  color: var(--text-muted);
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.5rem;
}

/* Tools Grid */
.tools-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 1.25rem;
}

.tool-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 1.5rem;
  transition: all var(--transition-fast);
  display: flex;
  flex-direction: column;
}

.tool-card:hover {
  border-color: var(--border-strong);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.tool-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}

.tool-name {
  font-family: var(--font-mono);
  font-weight: 600;
  font-size: 0.92rem;
  color: var(--text-primary);
  word-break: break-all;
}

.badge-tag {
  font-size: 0.72rem;
  font-weight: 600;
  padding: 0.15rem 0.5rem;
  border-radius: var(--radius-pill);
  white-space: nowrap;
}

.badge-qna { background: rgba(6, 182, 212, 0.15); color: var(--accent-cyan); border: 1px solid rgba(6, 182, 212, 0.3); }
.badge-analysis { background: rgba(16, 185, 129, 0.15); color: var(--accent-emerald); border: 1px solid rgba(16, 185, 129, 0.3); }
.badge-meta { background: rgba(59, 130, 246, 0.15); color: var(--accent-blue); border: 1px solid rgba(59, 130, 246, 0.3); }
.badge-intel { background: rgba(168, 85, 247, 0.15); color: #c084fc; border: 1px solid rgba(168, 85, 247, 0.3); }
.badge-fit { background: rgba(236, 72, 153, 0.15); color: #f472b6; border: 1px solid rgba(236, 72, 153, 0.3); }
.badge-compare { background: rgba(249, 115, 22, 0.15); color: #fb923c; border: 1px solid rgba(249, 115, 22, 0.3); }

.tool-desc {
  color: var(--text-secondary);
  font-size: 0.88rem;
  line-height: 1.5;
}

/* Agent Config Tabs */
.config-container {
  background: var(--bg-surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.tabs-nav {
  display: flex;
  border-bottom: 1px solid var(--border-subtle);
  background: rgba(0, 0, 0, 0.2);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.tab-btn {
  background: none;
  border: none;
  padding: 0.9rem 1.4rem;
  color: var(--text-secondary);
  font-family: inherit;
  font-size: 0.92rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast);
  border-bottom: 2px solid transparent;
  white-space: nowrap;
  min-height: 48px;
}

.tab-btn:hover {
  color: var(--text-primary);
}

.tab-btn.active {
  color: var(--brand-primary);
  border-bottom-color: var(--brand-primary);
  background: var(--bg-surface);
}

.tab-content {
  padding: 1.5rem;
  display: none;
}

.tab-content.active {
  display: block;
}

.code-wrapper {
  position: relative;
  background: var(--bg-base);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.code-wrapper pre {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: var(--code-text);
  line-height: 1.55;
}

.copy-btn {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  padding: 0.4rem 0.75rem;
  border-radius: var(--radius-sm);
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast);
  min-height: 32px;
}

.copy-btn:hover {
  color: var(--text-primary);
  border-color: var(--border-strong);
}

/* Accessible FAQ Accordion */
.faq-container {
  max-width: 800px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.faq-item {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  overflow: hidden;
  transition: border-color var(--transition-fast);
}

.faq-item[open] {
  border-color: var(--border-strong);
}

.faq-summary {
  padding: 1.25rem;
  font-weight: 600;
  font-size: 1rem;
  color: var(--text-primary);
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  list-style: none;
  user-select: none;
  min-height: 48px;
}

.faq-summary::-webkit-details-marker {
  display: none;
}

.faq-icon {
  color: var(--text-secondary);
  transition: transform var(--transition-normal);
  flex-shrink: 0;
}

.faq-item[open] .faq-icon {
  transform: rotate(180deg);
  color: var(--brand-primary);
}

.faq-content {
  padding: 0 1.25rem 1.25rem;
  color: var(--text-secondary);
  font-size: 0.92rem;
  line-height: 1.6;
  border-top: 1px solid var(--border-subtle);
  padding-top: 0.9rem;
}

/* Footer */
footer {
  border-top: 1px solid var(--border-subtle);
  background: var(--bg-surface);
  padding: 3.5rem 1.5rem max(2rem, env(safe-area-inset-bottom));
  margin-top: auto;
}

.footer-container {
  max-width: 1200px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 2fr 1fr 1fr;
  gap: 2.5rem;
  margin-bottom: 2.5rem;
}

.footer-col h4 {
  font-size: 0.9rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-primary);
  margin-bottom: 1rem;
}

.footer-col ul {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.footer-col a {
  color: var(--text-secondary);
  font-size: 0.88rem;
  transition: color var(--transition-fast);
  padding: 0.2rem 0;
  display: inline-block;
  min-height: 28px;
}

.footer-col a:hover {
  color: var(--brand-primary);
}

.footer-bottom {
  max-width: 1200px;
  margin: 0 auto;
  padding-top: 2rem;
  border-top: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.85rem;
  color: var(--text-muted);
  flex-wrap: wrap;
  gap: 1rem;
}

/* Responsive Media Queries */
@media (max-width: 900px) {
  .demo-card {
    grid-template-columns: 1fr;
  }
  
  .demo-input-pane {
    border-right: none;
    border-bottom: 1px solid var(--border-subtle);
  }

  .footer-container {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 640px) {
  .navbar {
    padding: max(0.5rem, env(safe-area-inset-top)) 1rem 0.5rem;
  }

  .mobile-only {
    display: flex;
  }

  .nav-links {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--bg-surface);
    border-bottom: 1px solid var(--border-strong);
    padding: 1.25rem 1.5rem;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.75rem;
    box-shadow: var(--shadow-lg);
  }

  .nav-links.open {
    display: flex;
  }

  .nav-links a {
    width: 100%;
    font-size: 1.05rem;
    padding: 0.5rem 0;
  }

  .tools-grid {
    grid-template-columns: 1fr;
  }

  .footer-container {
    grid-template-columns: 1fr;
    gap: 2rem;
  }

  .btn-github span {
    display: none;
  }

  .btn-github {
    padding: 0 0.75rem;
    width: 44px;
  }
}

/* ===== Agent Demo (Chat-style MCP Workflow) ===== */
.agent-demo {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-lg), 0 0 60px rgba(6, 182, 212, 0.04);
  max-width: 860px;
  margin: 0 auto;
}

/* macOS-style title bar */
.agent-titlebar {
  display: flex;
  align-items: center;
  padding: 0.55rem 0.85rem;
  background: var(--bg-surface-elevated);
  border-bottom: 1px solid var(--border-subtle);
  position: relative;
}

.agent-titlebar-dots {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}

.agent-titlebar-dots span {
  width: 11px;
  height: 11px;
  border-radius: 50%;
}

.dot-close { background: #ff5f57; }
.dot-minimize { background: #febc2e; }
.dot-expand { background: #28c840; }

.agent-titlebar-title {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-primary);
  letter-spacing: 0.01em;
}

.agent-titlebar-title svg { color: var(--text-secondary); }

.agent-titlebar-actions {
  margin-left: auto;
  display: flex;
  align-items: center;
}

/* MCP Connection Status Bar */
.mcp-connection-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.4rem 0.85rem;
  background: rgba(6, 182, 212, 0.04);
  border-bottom: 1px solid var(--border-subtle);
  gap: 0.75rem;
}

.mcp-connection-left {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex-shrink: 0;
}

.mcp-status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #22c55e;
  box-shadow: 0 0 6px rgba(34, 197, 94, 0.5);
  animation: statusPulse 2.5s infinite ease-in-out;
}

@keyframes statusPulse {
  0%, 100% { box-shadow: 0 0 4px rgba(34, 197, 94, 0.3); }
  50% { box-shadow: 0 0 8px rgba(34, 197, 94, 0.6); }
}

.mcp-status-label {
  font-size: 0.7rem;
  font-family: var(--font-mono);
  font-weight: 600;
  color: #22c55e;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.mcp-connection-endpoint {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  flex: 1;
  justify-content: center;
  min-width: 0;
}

.mcp-connection-endpoint svg {
  color: var(--text-muted);
  flex-shrink: 0;
}

.mcp-connection-endpoint code {
  font-size: 0.72rem;
  font-family: var(--font-mono);
  color: var(--text-secondary);
  background: rgba(0, 0, 0, 0.2);
  padding: 0.15rem 0.5rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.mcp-connection-right {
  flex-shrink: 0;
}

.mcp-tools-count {
  font-size: 0.65rem;
  font-family: var(--font-mono);
  padding: 0.15rem 0.5rem;
  border-radius: var(--radius-pill);
  background: rgba(99, 102, 241, 0.1);
  color: #a78bfa;
  border: 1px solid rgba(99, 102, 241, 0.2);
}

.agent-replay-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.3rem 0.65rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
  background: transparent;
  color: var(--text-secondary);
  font-size: 0.75rem;
  font-family: var(--font-mono);
  cursor: pointer;
  transition: all var(--transition-fast);
}
.agent-replay-btn:hover {
  border-color: var(--accent-cyan);
  color: var(--accent-cyan);
  background: rgba(6, 182, 212, 0.06);
}

.agent-chat {
  padding: 1.25rem;
  min-height: 200px;
  overflow-y: visible;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

/* User message */
.agent-msg-user {
  align-self: flex-end;
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.18), rgba(6, 182, 212, 0.12));
  border: 1px solid rgba(99, 102, 241, 0.25);
  border-radius: var(--radius-md) var(--radius-md) 4px var(--radius-md);
  padding: 0.7rem 1rem;
  max-width: 85%;
  color: var(--text-primary);
  font-size: 0.9rem;
  line-height: 1.5;
  animation: agentFadeSlideIn 0.35s ease-out;
}

/* Tool call block */
.agent-msg-tool {
  align-self: flex-start;
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid var(--border-subtle);
  border-left: 3px solid var(--accent-cyan);
  border-radius: 4px var(--radius-md) var(--radius-md) 4px;
  padding: 0;
  max-width: 92%;
  overflow: hidden;
  animation: agentFadeSlideIn 0.35s ease-out;
}

.tool-call-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.85rem;
  background: rgba(6, 182, 212, 0.06);
  border-bottom: 1px solid var(--border-subtle);
  font-family: var(--font-mono);
  font-size: 0.78rem;
}

.tool-call-icon {
  color: var(--accent-cyan);
  font-size: 0.7rem;
  flex-shrink: 0;
}

.tool-call-name {
  color: var(--accent-cyan);
  font-weight: 600;
}

.tool-call-badge {
  margin-left: auto;
  font-size: 0.65rem;
  font-family: var(--font-mono);
  padding: 0.1rem 0.5rem;
  border-radius: var(--radius-pill);
  background: rgba(16, 185, 129, 0.12);
  color: var(--accent-emerald);
  border: 1px solid rgba(16, 185, 129, 0.2);
  white-space: nowrap;
  flex-shrink: 0;
}

.tool-call-params {
  padding: 0.55rem 0.85rem;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-secondary);
  line-height: 1.6;
}

.tool-call-params .param-key {
  color: #c084fc;
}

.tool-call-params .param-val {
  color: #86efac;
}

/* Tool response */
.tool-call-response {
  padding: 0.65rem 0.85rem;
  border-top: 1px solid var(--border-subtle);
  font-size: 0.82rem;
  color: var(--text-primary);
  line-height: 1.55;
}

.tool-call-response .response-label {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--accent-emerald);
  margin-bottom: 0.35rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.tool-call-response .response-items {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.tool-call-response .response-item {
  display: flex;
  align-items: baseline;
  gap: 0.4rem;
}

.tool-call-response .response-item .item-icon {
  color: var(--accent-cyan);
  font-size: 0.7rem;
  flex-shrink: 0;
}

.tool-call-response .response-kv {
  display: flex;
  gap: 0.4rem;
  font-family: var(--font-mono);
  font-size: 0.75rem;
}

.tool-call-response .response-kv .kv-key {
  color: var(--text-secondary);
}

.tool-call-response .response-kv .kv-val {
  color: var(--text-primary);
}

.tool-call-response .citation-link {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  color: var(--accent-cyan);
  font-size: 0.75rem;
  font-family: var(--font-mono);
  text-decoration: none;
  margin-top: 0.3rem;
  transition: color var(--transition-fast);
}
.tool-call-response .citation-link:hover { color: #22d3ee; }

/* Agent thinking bubble */
.agent-msg-thinking {
  align-self: flex-start;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.85rem;
  background: rgba(0, 0, 0, 0.15);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  font-size: 0.8rem;
  color: var(--text-secondary);
  font-style: italic;
  animation: agentFadeSlideIn 0.3s ease-out;
}

.thinking-dots span {
  display: inline-block;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--accent-cyan);
  opacity: 0.4;
  animation: dotPulse 1.2s infinite ease-in-out;
}
.thinking-dots span:nth-child(2) { animation-delay: 0.2s; }
.thinking-dots span:nth-child(3) { animation-delay: 0.4s; }

/* Agent final summary message */
.agent-msg-assistant {
  align-self: flex-start;
  background: rgba(16, 185, 129, 0.06);
  border: 1px solid rgba(16, 185, 129, 0.15);
  border-radius: 4px var(--radius-md) var(--radius-md) var(--radius-md);
  padding: 0.8rem 1rem;
  max-width: 92%;
  color: var(--text-primary);
  font-size: 0.88rem;
  line-height: 1.6;
  animation: agentFadeSlideIn 0.4s ease-out;
}

.agent-msg-assistant strong {
  color: var(--accent-emerald);
}

/* Progress bar */
.agent-progress {
  padding: 0.65rem 1rem;
  border-top: 1px solid var(--border-subtle);
  background: var(--bg-surface-elevated);
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.agent-progress-track {
  flex: 1;
  height: 4px;
  background: rgba(255, 255, 255, 0.06);
  border-radius: 2px;
  overflow: hidden;
}

.agent-progress-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--accent-cyan), #6366f1);
  border-radius: 2px;
  transition: width 0.5s ease;
}

.agent-progress-label {
  font-size: 0.7rem;
  font-family: var(--font-mono);
  color: var(--text-muted);
  white-space: nowrap;
  min-width: 100px;
  text-align: right;
}

/* Animations */
@keyframes agentFadeSlideIn {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes dotPulse {
  0%, 80%, 100% { opacity: 0.2; transform: scale(0.8); }
  40% { opacity: 1; transform: scale(1.1); }
}

/* Mobile adjustments */
@media (max-width: 640px) {
  .agent-chat { min-height: 180px; padding: 0.85rem; gap: 0.7rem; }
  .agent-msg-user, .agent-msg-tool, .agent-msg-assistant { max-width: 98%; }
  .tool-call-params, .tool-call-response { font-size: 0.72rem; }
  .mcp-connection-endpoint { display: none; }
  .mcp-connection-bar { justify-content: space-between; }
  .agent-titlebar-dots span { width: 9px; height: 9px; }
}

/* Reduced motion — WCAG 2.3.3 */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}
