/* ── Reset ─────────────────────────────────────────────────────────────────── */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

html {
  /* On iOS, height:100% chains from the visual viewport (fills screen correctly
     in both Safari browser and PWA/home-screen mode). */
  height: 100%;
  background: #0d0d0d; /* fills notch/home-bar zones that sit outside #app */
}

body {
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: 'Outfit', sans-serif;
  font-size: 15px;
  overscroll-behavior: none;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}

/* ── App shell ─────────────────────────────────────────────────────────────── */
#app {
  display: flex;
  flex-direction: column;
  height: 100%; /* inherit from body → html → visual viewport */
  padding-top: var(--safe-top);
  padding-bottom: var(--safe-bot);
}

/* ── Pages ─────────────────────────────────────────────────────────────────── */
.page {
  display: none;
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding-bottom: calc(var(--nav-h) + 34px + var(--safe-bot));
}

.page.active { display: block; }

.page-content { padding: 16px; }

/* ── Page header ───────────────────────────────────────────────────────────── */
.page-header {
  padding: 24px 16px 16px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.page-title {
  font-family: 'Barlow Condensed', sans-serif; font-weight: 800; text-transform: uppercase;
  font-size: 38px;
  letter-spacing: 1.5px;
  line-height: 1;
  color: var(--text);
}

.page-title-accent {
  display: block;
  width: 28px;
  height: 3px;
  background: var(--accent);
  border-radius: 2px;
  margin-top: 6px;
}

.page-subtitle {
  font-size: 13px;
  color: var(--text3);
  margin-top: 3px;
}

.page-header-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  padding-top: 4px;
}

/* ── Bottom nav ────────────────────────────────────────────────────────────── */
#nav {
  position: fixed;
  bottom: calc(var(--safe-bot) + 14px);
  left: 50%;
  transform: translateX(-50%);
  width: calc(100% - 32px);
  max-width: 460px;
  height: var(--nav-h);
  background: rgba(20, 20, 20, 0.80);
  backdrop-filter: blur(24px) saturate(1.5);
  -webkit-backdrop-filter: blur(24px) saturate(1.5);
  border: 1px solid var(--border2);
  border-radius: 28px;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: stretch;
  z-index: 100;
  overflow: hidden;
}

.nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  cursor: pointer;
  border: none;
  background: none;
  font-family: 'Outfit', sans-serif;
  color: var(--text3);
  position: relative;
  transition: color 0.2s;
  padding: 8px 4px;
}

.nav-item svg {
  width: 22px;
  height: 22px;
  transition: transform 0.2s;
}

.nav-item .nav-label {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.6px;
  text-transform: uppercase;
}

.nav-item .nav-pill {
  position: absolute;
  inset: 8px 6px;
  border-radius: 18px;
  background: var(--accent-dim);
  opacity: 0;
  transition: opacity 0.2s;
}

.nav-item.active {
  color: var(--accent);
}

.nav-item.active .nav-pill {
  opacity: 1;
}

.nav-item.active svg {
  transform: translateY(-1px);
}

/* ── Scrollbar ─────────────────────────────────────────────────────────────── */
::-webkit-scrollbar { width: 0; }

/* ── Selection ─────────────────────────────────────────────────────────────── */
::selection {
  background: var(--accent-dim);
  color: var(--accent);
}

/* ── Focus visibility (keyboard users) ─────────────────────────────────────── */
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* ── Respect reduced-motion preference ─────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
  .home-bg-slide { transform: none !important; }
}
