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

:root {
  --bg-deep: #0c0a14;
  --bg-card: #14111f;
  --bg-card-hover: #1a1528;
  --purple-main: #a855f7;
  --purple-light: #c084fc;
  --purple-glow: rgba(168, 85, 247, 0.3);
  --purple-subtle: rgba(168, 85, 247, 0.08);
  --text-primary: #f0edf6;
  --text-secondary: #9b8fb8;
  --text-muted: #6b5f82;
  --border-subtle: rgba(168, 85, 247, 0.15);
  --gold: #f0c040;
  --font-display: 'Bricolage Grotesque', serif;
  --font-body: 'DM Sans', sans-serif;
}

html { scroll-behavior: smooth; }

body {
  background: var(--bg-deep);
  color: var(--text-primary);
  font-family: var(--font-body);
  line-height: 1.6;
  overflow-x: hidden;
}

/* ===== NOISE OVERLAY ===== */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.04'/%3E%3C/svg%3E");
  pointer-events: none;
  z-index: 9999;
}

/* ===== GLOW BLOBS ===== */
.glow-blob {
  position: absolute;
  border-radius: 50%;
  filter: blur(120px);
  pointer-events: none;
  z-index: 0;
}

/* ===== NAV ===== */
nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  padding: 1rem 2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  backdrop-filter: blur(20px);
  background: rgba(12, 10, 20, 0.7);
  border-bottom: 1px solid var(--border-subtle);
}

.nav-logo {
  font-family: var(--font-display);
  font-size: 1.4rem;
  font-weight: 800;
  background: linear-gradient(135deg, var(--purple-light), var(--gold));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.nav-logo span { font-size: 1.2rem; margin-right: 0.3rem; }

.nav-links { display: flex; gap: 2rem; align-items: center; }
.nav-links a {
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 500;
  transition: color 0.2s;
}
.nav-links a:hover { color: var(--text-primary); }

/* ===== BUTTONS ===== */
.btn-google {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.65rem 1.4rem;
  background: #fff;
  color: #333;
  border: none;
  border-radius: 50px;
  font-family: var(--font-body);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s;
  text-decoration: none;
}
.btn-google:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 30px rgba(255,255,255,0.15);
  color: black !important;
}
.btn-google svg { width: 18px; height: 18px; }

.btn-ghost {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.65rem 1.4rem;
  background: transparent;
  color: var(--purple-light);
  border: 1px solid var(--border-subtle);
  border-radius: 50px;
  font-family: var(--font-body);
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  text-decoration: none;
}
.btn-ghost:hover {
  background: var(--purple-subtle);
  border-color: var(--purple-main);
}

/* ===== HERO ===== */
.hero {
  position: relative;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  padding: 8rem 2rem 4rem;
  overflow: hidden;
}

.hero .glow-blob.one {
  width: 600px; height: 600px;
  background: radial-gradient(circle, rgba(168,85,247,0.25), transparent 70%);
  top: -100px; left: -200px;
}
.hero .glow-blob.two {
  width: 500px; height: 500px;
  background: radial-gradient(circle, rgba(240,192,64,0.12), transparent 70%);
  bottom: -100px; right: -150px;
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.4rem 1rem;
  background: var(--purple-subtle);
  border: 1px solid var(--border-subtle);
  border-radius: 50px;
  font-size: 0.8rem;
  color: var(--purple-light);
  margin-bottom: 2rem;
  animation: fadeInUp 0.6s ease-out both;
}

.hero h1 {
  font-family: var(--font-display);
  font-size: clamp(2.8rem, 7vw, 5rem);
  font-weight: 800;
  line-height: 1.1;
  max-width: 700px;
  margin-bottom: 1.2rem;
  animation: fadeInUp 0.6s ease-out 0.1s both;
}

.hero .gradient-text {
  background: linear-gradient(135deg, var(--purple-light), #e879f9, var(--gold));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero-sub {
  font-size: 1.15rem;
  color: var(--text-secondary);
  max-width: 500px;
  margin-bottom: 2.5rem;
  animation: fadeInUp 0.6s ease-out 0.2s both;
}

.hero-cta {
  display: flex;
  gap: 1rem;
  align-items: center;
  animation: fadeInUp 0.6s ease-out 0.3s both;
}

.hero-screenshot {
  margin-top: 4rem;
  width: 100%;
  max-width: 400px;
  position: relative;
  animation: fadeInUp 0.8s ease-out 0.5s both;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.5rem;
}

.hero-clippy {
  width: 250px;
  height: auto;
  filter: drop-shadow(0 0 6px rgba(255,255,255,0.9)) drop-shadow(0 0 2px rgba(255,255,255,0.6));
}

.clippy-speech {
  position: relative;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: 16px;
  padding: 1.5rem;
  max-width: 320px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.3);
}

.clippy-speech::before {
  content: '';
  position: absolute;
  bottom: -10px;
  left: 50%;
  transform: translateX(-50%);
  width: 0;
  height: 0;
  border-left: 10px solid transparent;
  border-right: 10px solid transparent;
  border-top: 10px solid var(--bg-card);
}

.clippy-speech p {
  margin: 0;
  color: var(--text-primary);
  font-size: 0.95rem;
  line-height: 1.5;
  text-align: center;
}

/* ===== SECTIONS ===== */
section {
  position: relative;
  padding: 6rem 2rem;
}

.section-inner {
  max-width: 1100px;
  margin: 0 auto;
}

.section-label {
  font-family: var(--font-display);
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  color: var(--purple-main);
  margin-bottom: 0.8rem;
}

.section-title {
  font-family: var(--font-display);
  font-size: clamp(1.8rem, 4vw, 2.6rem);
  font-weight: 800;
  margin-bottom: 1rem;
  line-height: 1.2;
}

.section-desc {
  color: var(--text-secondary);
  font-size: 1.05rem;
  max-width: 550px;
  margin-bottom: 3rem;
}

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

.feature-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: 16px;
  padding: 2rem;
  transition: transform 0.3s, border-color 0.3s, box-shadow 0.3s;
}

.feature-card:hover {
  transform: translateY(-4px);
  border-color: var(--purple-main);
  box-shadow: 0 20px 40px rgba(0,0,0,0.3), 0 0 30px var(--purple-glow);
}

.feature-icon {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  margin-bottom: 1.2rem;
  background: var(--purple-subtle);
  border: 1px solid var(--border-subtle);
}

.feature-card h3 {
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
}

.feature-card p {
  color: var(--text-secondary);
  font-size: 0.9rem;
  line-height: 1.6;
}

/* ===== SHOWCASE ===== */
.showcase-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
}

.showcase-item {
  border-radius: 16px;
  overflow: hidden;
  border: 1px solid var(--border-subtle);
  transition: transform 0.3s, box-shadow 0.3s;
  position: relative;
}

.showcase-item:hover {
  transform: translateY(-4px);
  box-shadow: 0 20px 40px rgba(0,0,0,0.4);
}

.showcase-item img {
  width: 100%;
  display: block;
  cursor: zoom-in;
  transition: opacity 0.3s;
}

.showcase-item img:hover {
  opacity: 0.95;
}

.showcase-item .showcase-label {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 1.5rem;
  background: linear-gradient(transparent, rgba(12,10,20,0.9));
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.95rem;
}

/* ===== PRICING ===== */
.pricing-section {
  text-align: center;
}

.pricing-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.5rem;
  max-width: 1100px;
  margin: 0 auto;
}

.pricing-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: 20px;
  padding: 2.5rem 2rem;
  text-align: center;
  transition: transform 0.3s, box-shadow 0.3s;
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.pricing-card:hover {
  transform: translateY(-4px);
}

.pricing-card.highlighted {
  border-color: var(--purple-main);
  box-shadow: 0 0 40px var(--purple-glow);
}

.pricing-card.highlighted::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--purple-main), var(--gold));
}

.pricing-avatar {
  width: 90px;
  height: 90px;
  border-radius: 50%;
  margin: 0 auto 1.2rem;
  object-fit: cover;
  border: 3px solid var(--border-subtle);
}

.pricing-card.highlighted .pricing-avatar {
  border-color: var(--purple-main);
  box-shadow: 0 0 20px var(--purple-glow);
}

.pricing-name {
  font-family: var(--font-display);
  font-size: 1.6rem;
  font-weight: 800;
  margin-bottom: 0.3rem;
}

.pricing-price {
  font-family: var(--font-display);
  font-size: 2.2rem;
  font-weight: 800;
  color: var(--purple-light);
  margin-bottom: 0.2rem;
}

.pricing-price-sub {
  color: var(--text-muted);
  font-size: 0.85rem;
  margin-bottom: 1.5rem;
}

.pricing-features {
  list-style: none;
  text-align: left;
  margin-bottom: 2rem;
}

.pricing-features li {
  padding: 0.5rem 0;
  color: var(--text-secondary);
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.pricing-features li::before {
  content: '✓';
  color: var(--purple-main);
  font-weight: 700;
  font-size: 0.85rem;
  flex-shrink: 0;
}

.pricing-card .btn-google,
.pricing-card .btn-github { width: 100%; justify-content: center; margin-top: auto; }

.btn-github {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.65rem 1.4rem;
  background: #333;
  color: #fff;
  border: none;
  border-radius: 50px;
  font-family: var(--font-body);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s;
  text-decoration: none;
}
.btn-github:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 30px rgba(255,255,255,0.1);
  background: #444;
  color: #fff;
}
.btn-github svg { width: 18px; height: 18px; }

/* ===== FOOTER ===== */
footer {
  text-align: center;
  padding: 3rem 2rem;
  border-top: 1px solid var(--border-subtle);
  color: var(--text-muted);
  font-size: 0.85rem;
}

footer a {
  color: var(--purple-light);
  text-decoration: none;
}

/* ===== ANIMATIONS ===== */
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(30px); }
  to { opacity: 1; transform: translateY(0); }
}

.reveal {
  opacity: 0;
  transform: translateY(30px);
  transition: opacity 0.6s ease-out, transform 0.6s ease-out;
}
.reveal.visible {
  opacity: 1;
  transform: translateY(0);
}

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
  nav { padding: 0.8rem 1.2rem; }
  .nav-links a:not(.btn-google) { display: none; }
  .hero { padding: 6rem 1.5rem 3rem; }
  .hero-cta { flex-direction: column; }
  .showcase-grid { grid-template-columns: 1fr; }
  .pricing-grid { grid-template-columns: 1fr; max-width: 400px; }
  section { padding: 4rem 1.5rem; }
}

/* ===== LIGHTBOX ===== */
.lightbox {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(12, 10, 20, 0.95);
  z-index: 9999;
  justify-content: center;
  align-items: center;
  backdrop-filter: blur(10px);
  cursor: zoom-out;
}

.lightbox.active {
  display: flex;
}

.lightbox img {
  max-width: 90%;
  max-height: 90%;
  border-radius: 12px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.8);
  cursor: default;
}

.lightbox-close {
  position: absolute;
  top: 2rem;
  right: 2rem;
  width: 40px;
  height: 40px;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: transform 0.2s, background 0.2s;
  font-size: 1.5rem;
  color: var(--text-primary);
}

.lightbox-close:hover {
  transform: scale(1.1);
  background: var(--purple-main);
}

/* ===== USERNAME PICKER MODAL ===== */
.username-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(12, 10, 20, 0.95);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.username-modal-overlay.active {
  opacity: 1;
  pointer-events: all;
}

.username-modal-content {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: 16px;
  padding: 2.5rem;
  max-width: 500px;
  width: 90%;
  max-height: 90vh;
  overflow-y: auto;
  position: relative;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
  transform: scale(0.95);
  transition: transform 0.3s ease;
}

.username-modal-overlay.active .username-modal-content {
  transform: scale(1);
}

.username-modal-close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  width: 36px;
  height: 36px;
  background: transparent;
  border: 1px solid var(--border-subtle);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s;
  font-size: 1.5rem;
  color: var(--text-secondary);
  line-height: 1;
}

.username-modal-close:hover {
  background: var(--purple-main);
  border-color: var(--purple-main);
  color: var(--text-primary);
  transform: scale(1.1);
}

.username-modal-content h2 {
  font-family: var(--font-display);
  font-size: 1.75rem;
  font-weight: 800;
  margin-bottom: 0.5rem;
  color: var(--text-primary);
}

.username-modal-subtitle {
  color: var(--text-secondary);
  margin-bottom: 2rem;
  font-size: 0.95rem;
}

.username-modal-subtitle span {
  color: var(--purple-light);
  font-weight: 600;
}

.username-input-group {
  margin-bottom: 1.5rem;
}

.username-input-group label {
  display: block;
  margin-bottom: 0.5rem;
  color: var(--text-secondary);
  font-size: 0.9rem;
  font-weight: 500;
}

.username-input-wrapper {
  display: flex;
  align-items: center;
  background: var(--bg-deep);
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  padding: 0.75rem 1rem;
  transition: border-color 0.2s;
}

.username-input-wrapper:focus-within {
  border-color: var(--purple-main);
  box-shadow: 0 0 0 3px var(--purple-subtle);
}

.username-prefix {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin-right: 0.5rem;
  white-space: nowrap;
}

.username-input-wrapper input {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--text-primary);
  font-size: 1rem;
  font-family: var(--font-body);
  outline: none;
  min-width: 0;
}

.username-input-wrapper input::placeholder {
  color: var(--text-muted);
}

.username-hint {
  margin-top: 0.5rem;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.username-error {
  color: #ef4444;
  font-size: 0.9rem;
  margin-bottom: 1rem;
  min-height: 1.5rem;
}

.username-modal-actions {
  display: flex;
  gap: 1rem;
  justify-content: flex-end;
  margin-top: 2rem;
}

.username-modal-actions .btn-ghost,
.username-modal-actions .btn-google {
  padding: 0.75rem 1.5rem;
  font-size: 0.95rem;
}

.username-modal-actions .btn-google:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* ===== EMBEDDED BROWSER BANNER ===== */
.webview-banner {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 200;
  background: linear-gradient(135deg, #1e1333, #261a3d);
  border-bottom: 1px solid var(--purple-main);
  box-shadow: 0 4px 20px rgba(168, 85, 247, 0.25);
  padding: 0.75rem 1rem;
  animation: slideDown 0.4s ease-out;
}

.webview-banner-inner {
  max-width: 1100px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.webview-banner-icon {
  font-size: 1.3rem;
  flex-shrink: 0;
}

.webview-banner-text {
  flex: 1;
  font-size: 0.85rem;
  color: var(--text-secondary);
  line-height: 1.4;
}

.webview-banner-text strong {
  color: var(--text-primary);
}

.webview-banner-btn {
  flex-shrink: 0;
  padding: 0.5rem 1rem;
  background: var(--purple-main);
  color: #fff;
  border: none;
  border-radius: 50px;
  font-family: var(--font-body);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s, transform 0.2s;
  white-space: nowrap;
}

.webview-banner-btn:hover {
  background: var(--purple-light);
  transform: translateY(-1px);
}

.webview-banner-close {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  background: transparent;
  border: 1px solid var(--border-subtle);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 1.2rem;
  color: var(--text-muted);
  transition: all 0.2s;
  line-height: 1;
}

.webview-banner-close:hover {
  color: var(--text-primary);
  border-color: var(--text-muted);
}

/* Shift nav down when banner is showing */
body.has-webview-banner nav {
  top: 56px; /* banner height */
}

body.has-webview-banner .hero {
  padding-top: 12rem;
}

/* Flash animation when user clicks auth button in WebView */
.webview-banner.flash {
  animation: bannerFlash 1.5s ease-out;
}

@keyframes slideDown {
  from { transform: translateY(-100%); }
  to { transform: translateY(0); }
}

@keyframes bannerFlash {
  0%, 100% { box-shadow: 0 4px 20px rgba(168, 85, 247, 0.25); }
  25% { box-shadow: 0 4px 40px rgba(168, 85, 247, 0.7); background: linear-gradient(135deg, #2a1f44, #351f55); }
  50% { box-shadow: 0 4px 30px rgba(168, 85, 247, 0.5); }
}

@media (max-width: 768px) {
  .webview-banner-inner {
    flex-wrap: wrap;
  }
  
  .webview-banner-text {
    flex-basis: calc(100% - 3rem);
    order: 1;
  }
  
  .webview-banner-icon {
    order: 0;
  }
  
  .webview-banner-close {
    order: 2;
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
  }
  
  .webview-banner-btn {
    order: 3;
    width: 100%;
    margin-top: 0.25rem;
  }
  
  .webview-banner {
    position: relative;
    padding-right: 2.5rem;
  }

  body.has-webview-banner nav {
    top: 0;
  }
  
  body.has-webview-banner .hero {
    padding-top: 6rem;
  }
}

@media (max-width: 640px) {
  .username-modal-content {
    padding: 2rem 1.5rem;
    width: 95%;
  }
  
  .username-input-wrapper {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.5rem;
  }
  
  .username-prefix {
    margin-right: 0;
  }
  
  .username-modal-actions {
    flex-direction: column-reverse;
  }
  
  .username-modal-actions .btn-ghost,
  .username-modal-actions .btn-google {
    width: 100%;
  }
}
