:root {
  --bg: #0a0b0f;
  --bg-elevated: #111318;
  --surface: #16181f;
  --border: #252830;
  --text: #e8eaef;
  --text-muted: #8b90a0;
  --accent: #3b82f6;
  --accent-dim: #2563eb;
  --glow: rgba(59, 130, 246, 0.15);
  --font-sans: 'Outfit', system-ui, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
}

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

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
}

.page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ----- Header ----- */
.header {
  position: fixed;
  top: 0.75rem;
  left: 0.75rem;
  right: 0.75rem;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.5rem 1.25rem;
  background: rgba(17, 19, 24, 0.75);
  border: 1px solid rgba(59, 130, 246, 0.12);
  border-radius: 9999px;
  backdrop-filter: blur(12px);
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.03),
    0 4px 24px rgba(0, 0, 0, 0.4),
    0 0 40px rgba(59, 130, 246, 0.06);
  transition: background 0.3s ease, box-shadow 0.3s ease, border-color 0.3s ease;
}

.header.scrolled {
  background: rgba(17, 19, 24, 0.9);
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.04),
    0 4px 24px rgba(0, 0, 0, 0.5),
    0 0 48px rgba(59, 130, 246, 0.08);
  border-color: rgba(59, 130, 246, 0.18);
}

.header-end {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  flex-wrap: wrap;
  justify-content: flex-end;
}

/* ── Gander pill button (header nav) ── */
a.nav-gander-btn,
a.nav-gander-btn:link,
a.nav-gander-btn:visited {
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  padding: 0.45rem 1.1rem;
  font-family: var(--font-sans);
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  white-space: nowrap;
  text-decoration: none !important;
  color: #fff !important;
  background: var(--accent) !important;
  border: none !important;
  border-radius: 9999px;
  box-shadow:
    0 0 0 1px rgba(99, 155, 255, 0.25) inset,
    0 2px 10px rgba(59, 130, 246, 0.35);
  cursor: pointer;
  transition: background 0.18s ease, box-shadow 0.18s ease, transform 0.18s ease;
}

a.nav-gander-btn:hover {
  background: var(--accent-dim) !important;
  color: #fff !important;
  text-decoration: none !important;
  box-shadow:
    0 0 0 1px rgba(99, 155, 255, 0.3) inset,
    0 4px 18px rgba(59, 130, 246, 0.45);
  transform: translateY(-1px);
}

a.nav-gander-btn:active {
  background: var(--accent-dim) !important;
  transform: translateY(0);
}

.logo-wrap {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  text-decoration: none;
  color: var(--text);
  font-weight: 600;
  font-size: 1.25rem;
  transition: opacity 0.2s;
}

.logo-wrap:hover {
  opacity: 0.95;
}

/* Circular logo frame (header) */
.logo-circle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  overflow: hidden;
  background: var(--bg-elevated);
  border: 1px solid rgba(59, 130, 246, 0.2);
  box-shadow: 0 0 16px rgba(59, 130, 246, 0.15);
  transition: box-shadow 0.25s ease, border-color 0.25s ease;
}

.logo-wrap:hover .logo-circle {
  box-shadow: 0 0 24px rgba(59, 130, 246, 0.25);
  border-color: rgba(59, 130, 246, 0.35);
}

.logo {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.nav {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.2rem;
  background: rgba(10, 11, 15, 0.4);
  border-radius: 9999px;
  border: 1px solid rgba(255, 255, 255, 0.04);
}

.nav a {
  color: var(--text-muted);
  text-decoration: none;
  font-weight: 500;
  font-size: 0.9rem;
  padding: 0.5rem 1rem;
  border-radius: 9999px;
  transition: color 0.2s, background 0.2s, box-shadow 0.2s;
}

.nav a:hover {
  color: var(--accent);
  background: rgba(59, 130, 246, 0.12);
  box-shadow: 0 0 20px rgba(59, 130, 246, 0.2);
}

.nav a:active {
  background: rgba(59, 130, 246, 0.18);
}

/* Agent entry page (/agent) */
.agent-entry-main {
  flex: 1;
  padding: 6.5rem 1.25rem 4rem;
  display: flex;
  justify-content: center;
  align-items: flex-start;
}

.agent-entry-card {
  width: 100%;
  max-width: 640px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 2rem 2rem 2.25rem;
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.03),
    0 20px 50px rgba(0, 0, 0, 0.35),
    0 0 60px rgba(59, 130, 246, 0.06);
}

.agent-entry-breadcrumb {
  margin: 0 0 1.25rem;
  font-size: 0.875rem;
  color: var(--text-muted);
}

.agent-entry-breadcrumb a {
  color: var(--accent);
  text-decoration: none;
}

.agent-entry-breadcrumb a:hover {
  text-decoration: underline;
}

.agent-entry-md {
  font-size: 1.125rem;
  line-height: 1.65;
  color: var(--text);
}

.agent-entry-md p {
  margin: 0;
}

.agent-entry-md p + p {
  margin-top: 0.75em;
}

.agent-md-loading {
  color: var(--text-muted);
  margin: 0;
}

.agent-md-error {
  color: #f87171;
  font-family: var(--font-mono);
  font-size: 0.875rem;
  margin: 0;
}

.agent-md-error code {
  font-size: 0.8em;
}

/* ----- Hero ----- */
.hero {
  position: relative;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 6rem 2rem 4rem;
  overflow: hidden;
}

.hero-bg {
  position: absolute;
  inset: 0;
}

.hero-video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.hero-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(10, 11, 15, 0.7) 0%, var(--bg) 100%);
  pointer-events: none;
}

.hero-content {
  position: relative;
  z-index: 1;
  text-align: center;
  max-width: 720px;
  animation: heroIn 1s ease-out;
}

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

/* Circular frame for hero logo */
.hero-logo-circle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 120px;
  height: 120px;
  border-radius: 50%;
  overflow: hidden;
  margin: 0 auto 1.5rem;
  background: var(--bg-elevated);
  border: 2px solid rgba(59, 130, 246, 0.25);
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.06),
    0 0 40px rgba(59, 130, 246, 0.2),
    inset 0 0 30px rgba(59, 130, 246, 0.06);
  animation: float 6s ease-in-out infinite;
}

.hero-logo {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0.95;
}

@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}

.hero-title {
  margin: 0 0 1rem;
  font-size: clamp(2rem, 5vw, 3.25rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.15;
}

.hero-sub {
  margin: 0 0 0.5rem;
  font-size: 1.15rem;
  color: var(--text-muted);
  font-weight: 400;
  max-width: 480px;
  margin-left: auto;
  margin-right: auto;
}

.hero-typing {
  margin: 0 0 2rem;
  min-height: 1.75em;
  font-size: 1.15rem;
  color: var(--accent);
  font-weight: 500;
  max-width: 520px;
  margin-left: auto;
  margin-right: auto;
}

.hero-typing::after {
  content: '|';
  animation: blink 0.8s step-end infinite;
  margin-left: 2px;
}

@keyframes blink {
  50% { opacity: 0; }
}

.hero-cta {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  justify-content: center;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.875rem 1.75rem;
  font-family: var(--font-sans);
  font-size: 1rem;
  font-weight: 600;
  text-decoration: none;
  border-radius: 10px;
  transition: transform 0.2s, box-shadow 0.2s;
}

.btn:hover {
  transform: translateY(-2px);
}

.btn-primary {
  background: var(--accent);
  color: #fff;
  border: none;
  box-shadow: 0 4px 20px var(--glow);
}

.btn-primary:hover {
  box-shadow: 0 6px 28px var(--glow);
}

.btn-secondary {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
}

.btn-secondary:hover {
  border-color: var(--accent);
  color: var(--accent);
}

/* ----- Explain ----- */
.explain {
  padding: 5rem 2rem;
  max-width: 1100px;
  margin: 0 auto;
}

.section-title {
  margin: 0 0 0.5rem;
  font-size: clamp(1.75rem, 3vw, 2.25rem);
  font-weight: 600;
  text-align: center;
  color: var(--text);
}

.section-intro {
  margin: 0 0 2.5rem;
  text-align: center;
  color: var(--text-muted);
  font-size: 1rem;
  max-width: 480px;
  margin-left: auto;
  margin-right: auto;
}

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.5rem;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 1.75rem;
  transition: border-color 0.25s, transform 0.25s;
}

.card:hover {
  border-color: var(--accent-dim);
  transform: translateY(-2px);
}

.card h3 {
  margin: 0 0 0.75rem;
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text);
}

.card p {
  margin: 0;
  font-size: 0.95rem;
  color: var(--text-muted);
}

.card code {
  font-family: var(--font-mono);
  font-size: 0.85em;
  background: var(--bg-elevated);
  padding: 0.15em 0.4em;
  border-radius: 4px;
  color: var(--accent);
}

.explain-about .section-intro {
  max-width: 36rem;
}

.about-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1.25rem;
  margin-top: 0.5rem;
}

.about-pillar {
  background: linear-gradient(145deg, var(--surface) 0%, rgba(22, 24, 31, 0.85) 100%);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 1.5rem 1.35rem;
  transition: border-color 0.25s, transform 0.25s, box-shadow 0.25s;
}

.about-pillar:hover {
  border-color: rgba(59, 130, 246, 0.35);
  transform: translateY(-3px);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.35), 0 0 0 1px rgba(59, 130, 246, 0.08);
}

.about-pillar-icon {
  display: block;
  font-size: 1.25rem;
  color: var(--accent);
  margin-bottom: 0.65rem;
  opacity: 0.9;
}

.about-pillar-title {
  margin: 0 0 0.5rem;
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--text);
}

.about-pillar-text {
  margin: 0;
  font-size: 0.92rem;
  color: var(--text-muted);
  line-height: 1.55;
}

/* ----- Footer ----- */
.footer {
  margin-top: auto;
  padding: 2.5rem 2rem;
  text-align: center;
  border-top: 1px solid var(--border);
}

.footer-tagline {
  margin: 0 0 0.5rem;
  font-size: 0.9rem;
  color: var(--text-muted);
}

.footer-link {
  font-family: var(--font-mono);
  font-size: 0.9rem;
  color: var(--accent);
  text-decoration: none;
}

.footer-link:hover {
  text-decoration: underline;
}

/* ----- Generate / Upload pages ----- */
.page-content {
  padding: 6rem 2rem 4rem;
  max-width: 720px;
  margin: 0 auto;
}

.page-content h1 {
  margin: 0 0 0.5rem;
  font-size: 1.75rem;
  font-weight: 600;
}

.page-content .subtitle {
  color: var(--text-muted);
  margin-bottom: 2rem;
}

.form-group {
  margin-bottom: 1.25rem;
}

.form-group label {
  display: block;
  margin-bottom: 0.4rem;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-muted);
}

.form-group input,
.form-group textarea {
  width: 100%;
  padding: 0.75rem 1rem;
  font-family: var(--font-mono);
  font-size: 0.95rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  transition: border-color 0.2s;
}

.form-group input:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--accent);
}

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

.form-actions {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  margin-top: 1.5rem;
}

.form-actions .btn {
  min-width: 140px;
}

/* ----- Generate: live status ----- */
.status-container {
  margin: 1rem 0;
  padding: 1rem;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 8px;
}

.status-title {
  margin: 0 0 0.5rem;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
}

.status-log {
  margin: 0;
  padding-left: 1.25rem;
  max-height: 200px;
  overflow-y: auto;
  font-size: 0.9rem;
  color: var(--text);
}

.status-item {
  margin-bottom: 0.25rem;
}

.message {
  padding: 1rem 1.25rem;
  border-radius: 8px;
  margin-bottom: 1rem;
  font-size: 0.95rem;
}

.message.error {
  background: rgba(239, 68, 68, 0.12);
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: #fca5a5;
}

.message.success {
  background: rgba(34, 197, 94, 0.12);
  border: 1px solid rgba(34, 197, 94, 0.3);
  color: #86efac;
}

.spinner {
  display: inline-block;
  width: 1.25rem;
  height: 1.25rem;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  vertical-align: middle;
  margin-right: 0.5rem;
}

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

/* ----- Responsive ----- */
@media (max-width: 900px) {
  .agent-entry-nav-text {
    display: none;
  }

  .agent-entry-nav {
    padding: 0.3rem;
    gap: 0.25rem;
  }
}

@media (max-width: 640px) {
  .header {
    left: 0.5rem;
    right: 0.5rem;
    top: 0.5rem;
    padding: 0.5rem 1rem;
  }

  .header-end {
    gap: 0.45rem;
  }

  a.nav-gander-btn {
    padding: 0.38rem 0.85rem;
    font-size: 0.78rem;
  }

  .nav a {
    padding: 0.4rem 0.75rem;
    font-size: 0.85rem;
  }

  .agent-entry-nav-btn {
    padding: 0.35rem 0.6rem;
    font-size: 0.75rem;
  }

  .hero {
    padding: 5rem 1rem 3rem;
  }

  .hero-cta {
    flex-direction: column;
  }

  .hero-cta .btn {
    width: 100%;
  }

  .explain {
    padding: 3rem 1rem;
  }

  .page-content {
    padding: 5rem 1rem 3rem;
  }
}

/* ----- Agent entry (navbar center) ----- */
.agent-entry-nav {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.35rem 0.5rem 0.35rem 0.85rem;
  background: rgba(10, 11, 15, 0.5);
  border: 1px solid rgba(59, 130, 246, 0.2);
  border-radius: 9999px;
  box-shadow: 0 0 16px rgba(59, 130, 246, 0.1);
}

.agent-entry-nav-text {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-weight: 500;
  white-space: nowrap;
}

.agent-entry-nav-actions {
  display: flex;
  gap: 0.35rem;
}

.agent-entry-nav-btn {
  padding: 0.4rem 0.75rem;
  font-size: 0.8rem;
  font-weight: 600;
  font-family: var(--font-sans);
  border-radius: 9999px;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  transition: background 0.2s, color 0.2s, border-color 0.2s, box-shadow 0.2s;
}

.agent-entry-nav-btn-primary {
  background: var(--accent);
  color: #fff;
  border: none;
  box-shadow: 0 2px 8px rgba(59, 130, 246, 0.25);
}

.agent-entry-nav-btn-primary:hover {
  background: var(--accent-dim);
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.35);
}

.agent-entry-nav-btn-secondary {
  background: transparent;
  color: var(--text-muted);
  border: 1px solid var(--border);
}

.agent-entry-nav-btn-secondary:hover {
  color: var(--text);
  border-color: var(--text-muted);
}
