.app-header {
  position: sticky;
  left: 0;
  right: 0;
  top: 0;
  z-index: 100;
  pointer-events: none; /* prevents blocking content */
}

.app-header.scrolled .top-pill {
  /* outer blur/glow effect */
  box-shadow: 0 0 15px 5px var(--primaryGlow);
  backdrop-filter: blur(8px);
}

.top-pill-wrap {
  padding: 16px;
  display: flex;
  justify-content: center;
  pointer-events: auto;
}

.top-pill a {
  position: relative;
  z-index: 1;
  padding: 12px 20px;           /* increased padding for bigger pill */
  font-size: 1rem;              /* larger text */
  color: var(--primary);
  text-decoration: none;
  border-radius: 999px;
  transition: color 0.35s cubic-bezier(.4,0,.2,1);
  white-space: nowrap;
  pointer-events: auto;
}

.top-pill a:hover {
  font-weight: normal;
}

.top-pill {
  display: inline-flex;
  position: relative;
  gap: 10px;                     /* more spacing between links */
  padding: 10px;                 /* more padding around the pill container */
  background: var(--card);
  border-radius: 999px;
  transition: all 0.35s cubic-bezier(.4,0,.2,1);
}

.pill-indicator {
  position: absolute;
  top: 6px;
  bottom: 6px;
  left: 0;
  background: var(--cardAccent);
  border-radius: 999px;
  transition: transform 0.35s cubic-bezier(.4,0,.2,1), width 0.35s cubic-bezier(.4,0,.2,1);
  will-change: transform, width;
  backdrop-filter: blur(6px);
}

a.selectedNav {
  color: var(--accent);
}

@media (prefers-reduced-motion: reduce) {
  .pill-indicator {
    transition: none !important;
  }
}

@media (max-width: 768px), (max-height: 600px) {

  .app-header {
    position: fixed;
    left: 0;
    right: 0;
    bottom: env(safe-area-inset-bottom);
    padding-bottom: env(safe-area-inset-bottom);
    top: auto;
  }

  body {
    padding-bottom: calc(1rem + 60px); /* adjust to pill height */
  }

}