:root {
  --bg-primary: #fcfcfd;
  --bg-surface: rgba(255, 255, 255, 0.88);
  --accent-slate: #0f172a;
  --primary-blue: #2563eb;
  --primary-blue-hover: #1d4ed8;
  --text-main: #090d16;
  --text-muted: #475569;
  --border-color: rgba(226, 232, 240, 0.9);
  --shadow-subtle: 0 4px 20px -2px rgba(15, 23, 42, 0.04);
  --shadow-elevated: 0 24px 48px -12px rgba(15, 23, 42, 0.08);
  --transition-smooth: all 0.28s cubic-bezier(0.16, 1, 0.3, 1);
}

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

html, body {
  width: 100%;
  max-width: 100%;
  overflow-x: hidden;
}

html {
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
}

body {
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  color: var(--text-main);
  line-height: 1.6;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  position: relative;
  background: linear-gradient(135deg, #f0fdfa 0%, #e0f2fe 50%, #f0f9ff 100%);
  background-attachment: fixed;
}

/* Light Flowing Ocean Water Ambient Mesh */
.ambient-mesh {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
  opacity: 0.85;
}

.mesh-blob {
  position: absolute;
  filter: blur(100px);
  border-radius: 50%;
  animation: oceanFlow 18s infinite alternate ease-in-out;
}

.blob-white {
  top: -10%;
  left: 10%;
  width: 650px;
  height: 650px;
  background: rgba(255, 255, 255, 0.85);
  animation-duration: 20s;
}

.blob-ivory {
  top: 20%;
  right: -10%;
  width: 600px;
  height: 600px;
  background: rgba(186, 230, 253, 0.55);
  animation-duration: 25s;
  animation-direction: alternate-reverse;
}

.blob-emerald {
  bottom: -10%;
  left: 20%;
  width: 550px;
  height: 550px;
  background: rgba(153, 246, 228, 0.5);
  animation-duration: 22s;
}

@keyframes oceanFlow {
  0% { transform: translate(0px, 0px) scale(1); }
  50% { transform: translate(45px, 35px) scale(1.08); }
  100% { transform: translate(-35px, -25px) scale(0.95); }
}

/* Real-Time Flowing Ocean Waves Layer */
.ocean-waves-container {
  position: fixed;
  bottom: 0;
  left: 0;
  width: 100vw;
  height: 220px;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
  opacity: 0.55;
}

.ocean-wave {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 200%;
  height: 100px;
}

.wave-1 {
  fill: rgba(14, 165, 233, 0.18);
  animation: waveDrift 12s linear infinite;
  bottom: 0px;
}

.wave-2 {
  fill: rgba(20, 184, 166, 0.15);
  animation: waveDriftInv 18s linear infinite;
  bottom: 15px;
}

.wave-3 {
  fill: rgba(56, 189, 248, 0.12);
  animation: waveDrift 8s linear infinite;
  bottom: 30px;
}

@keyframes waveDrift {
  0% { transform: translateX(0); }
  100% { transform: translateX(-50%); }
}

@keyframes waveDriftInv {
  0% { transform: translateX(-50%); }
  100% { transform: translateX(0); }
}

/* Floating Autohiding Dynamic Glass Pill Header */
.site-header {
  position: fixed;
  top: 14px;
  left: 0;
  right: 0;
  z-index: 1000;
  padding: 0 1.25rem;
  display: flex;
  justify-content: center;
  pointer-events: none;
  transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.3s ease;
}

.site-header.header-hidden {
  transform: translateY(-130%);
  opacity: 0;
}

.header-pill {
  pointer-events: auto;
  width: 100%;
  max-width: 860px;
  background-color: rgba(255, 255, 255, 0.78);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(226, 232, 240, 0.85);
  border-radius: 999px;
  padding: 0.5rem 0.75rem 0.5rem 1rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-shadow: 0 10px 30px -10px rgba(15, 23, 42, 0.08), 0 1px 3px rgba(15, 23, 42, 0.03);
}

.logo-area {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  text-decoration: none;
}

.logo-icon {
  background: var(--accent-slate);
  color: white;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 3px 10px rgba(15, 23, 42, 0.18);
}

.logo-text {
  font-weight: 800;
  font-size: 0.975rem;
  color: var(--text-main);
  letter-spacing: -0.03em;
}

.logo-badge {
  background: #f1f5f9;
  color: #475569;
  font-size: 0.58rem;
  padding: 0.1rem 0.4rem;
  border-radius: 999px;
  font-weight: 700;
  border: 1px solid var(--border-color);
  text-transform: uppercase;
}

.site-nav {
  display: flex;
  gap: 0.65rem;
  align-items: center;
}

.nav-link-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 0.82rem;
  font-weight: 500;
  padding: 0.3rem 0.55rem;
  border-radius: 999px;
  cursor: pointer;
  transition: var(--transition-smooth);
}

.nav-link-btn:hover {
  color: var(--text-main);
  background: rgba(15, 23, 42, 0.04);
}

.nav-api-btn {
  background: #ffffff;
  border: 1px solid var(--border-color);
  color: var(--text-main);
  padding: 0.35rem 0.75rem;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  transition: var(--transition-smooth);
  box-shadow: var(--shadow-subtle);
}

.nav-api-btn kbd {
  background: #f1f5f9;
  color: #475569;
  font-size: 0.62rem;
  padding: 0.05rem 0.32rem;
  border-radius: 4px;
  font-family: inherit;
  border: 1px solid var(--border-color);
}

.nav-api-btn:hover {
  border-color: #cbd5e1;
  background: #f8fafc;
}

/* Context-Aware Live Telemetry Pill */
.status-pill {
  font-size: 0.73rem;
  color: #475569;
  background: #f8fafc;
  padding: 0.3rem 0.7rem;
  border-radius: 999px;
  border: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  font-weight: 600;
  transition: var(--transition-smooth);
}

.status-pill.routing {
  color: #065f46;
  background: #ecfdf5;
  border-color: #a7f3d0;
}

.status-dot {
  width: 6px;
  height: 6px;
  background-color: #94a3b8;
  border-radius: 50%;
  margin-right: 0.4rem;
  transition: var(--transition-smooth);
}

.status-pill.routing .status-dot {
  background-color: #059669;
  box-shadow: 0 0 8px #059669;
  animation: livePing 1.1s infinite ease-in-out;
}

@keyframes livePing {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.45); opacity: 0.6; }
}

/* Main & Hero */
.main-container {
  position: relative;
  z-index: 1;
  flex: 1;
  display: flex;
  flex-direction: column;
  padding-top: 3.75rem;
}

.hero {
  max-width: 780px;
  margin: 3.25rem auto 2rem;
  padding: 0 1.25rem;
  text-align: center;
  width: 100%;
}

.hero-badge-wrapper {
  display: inline-flex;
  gap: 0.5rem;
  background: rgba(255, 255, 255, 0.9);
  padding: 0.3rem 0.35rem 0.3rem 0.85rem;
  border-radius: 30px;
  border: 1px solid var(--border-color);
  margin-bottom: 1.5rem;
  box-shadow: var(--shadow-subtle);
  align-items: center;
}

.hero-tag {
  color: var(--primary-blue);
  font-size: 0.75rem;
  font-weight: 700;
}

.hero-tag-sub {
  background: #eff6ff;
  color: #1d4ed8;
  font-size: 0.675rem;
  font-weight: 600;
  padding: 0.15rem 0.55rem;
  border-radius: 20px;
}

.hero h1 {
  font-size: 3rem;
  font-weight: 800;
  letter-spacing: -0.04em;
  line-height: 1.1;
  margin-bottom: 1rem;
  color: var(--text-main);
}

.hero-subtitle {
  font-size: 1.1rem;
  color: var(--text-muted);
  max-width: 600px;
  margin: 0 auto 2.25rem;
  letter-spacing: -0.01em;
}

/* Unified Command-Bar Search Box with Reactive Focus Glow */
.search-box-wrapper {
  position: relative;
  background: var(--bg-surface);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid var(--border-color);
  border-radius: 20px;
  padding: 1.25rem;
  box-shadow: var(--shadow-elevated);
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
  text-align: left;
  transition: var(--transition-smooth);
  width: 100%;
}

.search-box-wrapper:focus-within {
  border-color: rgba(37, 99, 235, 0.65);
  box-shadow: 0 28px 56px -12px rgba(37, 99, 235, 0.16), 0 0 0 4px rgba(37, 99, 235, 0.08);
  transform: translateY(-1px);
}

.search-box-wrapper.is-typing {
  border-color: #38bdf8;
  box-shadow: 0 28px 56px -12px rgba(14, 165, 233, 0.18), 0 0 0 4px rgba(56, 189, 248, 0.12);
}

.search-top-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.8rem;
  color: var(--text-muted);
  padding-bottom: 0.4rem;
  border-bottom: 1px solid #f1f5f9;
}

.active-mode-indicator {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-weight: 600;
  color: var(--text-main);
  background: #ffffff;
  padding: 0.25rem 0.65rem;
  border-radius: 6px;
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-subtle);
  font-size: 0.775rem;
}

.search-shortcuts-hint kbd {
  background: #f1f5f9;
  border: 1px solid var(--border-color);
  padding: 0.1rem 0.35rem;
  border-radius: 4px;
  font-size: 0.7rem;
}

.query-input-row {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  width: 100%;
}

.query-textarea {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--text-main);
  font-size: 1.05rem;
  resize: none;
  height: 48px;
  padding: 0.5rem;
  outline: none;
  font-family: inherit;
  min-width: 0;
  width: 100%;
}

.query-textarea::placeholder {
  color: #94a3b8;
  transition: opacity 0.25s ease;
}

.submit-btn {
  background: var(--accent-slate);
  color: white;
  border: none;
  padding: 0.8rem 1.5rem;
  font-weight: 700;
  font-size: 0.875rem;
  border-radius: 12px;
  cursor: pointer;
  transition: var(--transition-smooth);
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex-shrink: 0;
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.2);
}

.submit-btn:hover {
  background: #1e293b;
  transform: translateY(-1px);
}

.submit-btn:disabled {
  opacity: 0.75;
  cursor: wait;
}

/* Telemetry Bar */
.telemetry-bar {
  max-width: 780px;
  margin: 0 auto 2.5rem;
  padding: 0 1.25rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.825rem;
  color: var(--text-muted);
  width: 100%;
}

.quota-badge {
  background: #eff6ff;
  color: #1d4ed8;
  border: 1px solid #dbeafe;
  padding: 0.3rem 0.75rem;
  border-radius: 6px;
  font-family: monospace;
  font-weight: 700;
  font-size: 0.775rem;
}

/* Results Section with Spring Reveal */
.results-container {
  max-width: 780px;
  margin: 0 auto 5rem;
  padding: 0 1.25rem;
  width: 100%;
  display: none;
}

.result-card {
  background: #ffffff;
  border: 1px solid var(--border-color);
  border-radius: 18px;
  padding: 1.75rem;
  box-shadow: var(--shadow-elevated);
  width: 100%;
  animation: springReveal 0.42s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

@keyframes springReveal {
  0% {
    opacity: 0;
    transform: translateY(14px) scale(0.985);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.result-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
  font-size: 0.8rem;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 0.75rem;
  font-weight: 500;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.result-content {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  padding: 1.25rem;
  border-radius: 12px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 0.875rem;
  color: #0369a1;
  overflow-x: auto;
  max-width: 100%;
  line-height: 1.7;
}

.result-content a {
  color: var(--primary-blue);
  text-decoration: none;
}

.result-content a:hover {
  text-decoration: underline;
}

/* Floating Scroll to Top Button */
.scroll-top-btn {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: var(--accent-slate);
  color: white;
  border: 1px solid rgba(255, 255, 255, 0.1);
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 10px 25px -5px rgba(15, 23, 42, 0.3);
  opacity: 0;
  visibility: hidden;
  transform: translateY(10px);
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  z-index: 1500;
}

.scroll-top-btn.visible {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.scroll-top-btn:hover {
  background: var(--primary-blue);
  transform: translateY(-2px);
}

/* Modals */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 2000;
  padding: 1rem;
}

.modal-card {
  background: #ffffff;
  border: 1px solid var(--border-color);
  border-radius: 20px;
  width: 100%;
  max-width: 580px;
  padding: 1.75rem;
  box-shadow: 0 25px 50px -12px rgba(0,0,0,0.25);
  animation: springReveal 0.3s cubic-bezier(0.22, 1, 0.36, 1);
}

.architecture-card {
  max-width: 620px;
}

.architecture-body {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  margin-top: 1rem;
}

.arch-item h4 {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 0.3rem;
}

.arch-item p {
  font-size: 0.875rem;
  color: var(--text-muted);
  line-height: 1.5;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
  font-weight: 700;
  font-size: 1.05rem;
}

.close-btn {
  background: #f1f5f9;
  border: none;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 1.15rem;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  transition: var(--transition-smooth);
}

.close-btn:hover {
  background: #e2e8f0;
  color: var(--text-main);
}

.modal-tabs {
  display: flex;
  gap: 0.4rem;
  margin-bottom: 1rem;
}

.tab-btn {
  background: #f8fafc;
  border: 1px solid var(--border-color);
  padding: 0.35rem 0.75rem;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
  transition: var(--transition-smooth);
}

.tab-btn.active {
  background: var(--accent-slate);
  color: white;
  border-color: var(--accent-slate);
}

.modal-card pre {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  padding: 1rem;
  border-radius: 8px;
  font-size: 0.8rem;
  color: #0369a1;
  margin-bottom: 1rem;
  overflow-x: auto;
  max-width: 100%;
}

.copy-btn {
  background: var(--accent-slate);
  color: white;
  border: none;
  padding: 0.6rem 1.25rem;
  border-radius: 8px;
  font-weight: 600;
  font-size: 0.85rem;
  cursor: pointer;
  transition: var(--transition-smooth);
}

.copy-btn:hover {
  background: #1e293b;
}

.site-footer {
  background: rgba(255, 255, 255, 0.8);
  border-top: 1px solid var(--border-color);
  text-align: center;
  padding: 2rem 1rem;
  color: var(--text-muted);
  font-size: 0.825rem;
  margin-top: auto;
  position: relative;
  z-index: 1;
}

/* Mobile Responsive Adjustments */
@media (max-width: 640px) {
  .site-header { top: 10px; padding: 0 0.75rem; }
  .header-pill { padding: 0.42rem 0.6rem 0.42rem 0.75rem; }
  .hero { margin-top: 2.25rem; }
  .hero h1 { font-size: 2.2rem; }
  .logo-badge { display: none; }
  .status-pill { display: none; }
  
  /* Reduced menu font size for mobile */
  .site-nav { gap: 0.35rem; }
  .nav-link-btn { font-size: 0.75rem; padding: 0.25rem 0.45rem; }
  .nav-api-btn { font-size: 0.73rem; padding: 0.3rem 0.55rem; }
  .nav-api-btn kbd { display: none; }

  /* Compact top bar to save vertical space */
  .search-box-wrapper { padding: 0.85rem; gap: 0.6rem; }
  .search-top-row { border-bottom: none; padding-bottom: 0; }
  .search-shortcuts-hint { display: none; }
  .active-mode-indicator { font-size: 0.7rem; padding: 0.15rem 0.45rem; }

  /* Increased query textarea height and comfort padding for mobile */
  .query-textarea { 
    font-size: 0.95rem; 
    height: 76px; 
    padding: 0.4rem; 
  }

  .query-input-row { flex-direction: column; align-items: stretch; gap: 0.6rem; }
  .submit-btn { width: 100%; justify-content: center; padding: 0.75rem; }
  
  .telemetry-bar { flex-direction: column; gap: 0.5rem; align-items: flex-start; }
}