html {
  text-size-adjust: 100%;
  -webkit-text-size-adjust: 100%;
}

body {
  min-width: 0;
}

main {
  min-width: 0;
}

button,
input,
select,
textarea {
  font: inherit;
}

button,
a,
input,
select,
textarea {
  -webkit-tap-highlight-color: rgba(232, 93, 4, 0.18);
}

a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 3px solid var(--accent, #ff9f1c);
  outline-offset: 3px;
}

img,
svg,
video,
iframe {
  max-width: 100%;
  height: auto;
}

table {
  max-width: 100%;
}

.container {
  padding-left: env(safe-area-inset-left);
  padding-right: env(safe-area-inset-right);
}

.legal-content,
.content-section,
.article-content,
.faq-section,
.guide-section {
  overflow-wrap: anywhere;
}

@media (max-width: 720px) {
  body {
    padding-left: env(safe-area-inset-left);
    padding-right: env(safe-area-inset-right);
  }

  .site-header {
    top: 0;
    padding-top: constant(safe-area-inset-top);
    padding-top: env(safe-area-inset-top);
  }

  .top-nav {
    max-height: min(75vh, 560px);
    overflow-y: auto;
    overscroll-behavior: contain;
  }

  .footer-grid {
    grid-template-columns: 1fr !important;
  }

  .hero,
  .section,
  .legal-main {
    scroll-margin-top: 84px;
  }

  /* Notification bell dropdown: anchor to viewport so it never overflows
     off the left edge on narrow screens. */
  .auth-notif-panel {
    position: fixed;
    left: 0.75rem;
    right: 0.75rem;
    top: calc(env(safe-area-inset-top) + 4.5rem);
    width: auto;
    max-width: none;
  }
}


@media (max-width: 520px) {
  .container {
    width: min(100% - 1rem, 1120px) !important;
  }

  .header-inner {
    min-height: 64px;
  }

  .brand {
    max-width: 52vw;
  }

  .brand-mark {
    width: 36px;
    height: 36px;
  }

  .theme-toggle {
    min-height: 44px;
  }

  .menu-toggle {
    min-width: 44px;
    min-height: 44px;
  }

  input,
  select,
  textarea,
  button {
    min-height: 44px;
  }
}

/* ---------- Bottom Navigation (mobile app pages) ---------- */
.bottom-nav {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 900;
  display: flex;
  align-items: stretch;
  justify-content: space-around;
  background: var(--surface-strong, #fff);
  border-top: 1px solid var(--line, rgba(53, 27, 18, 0.13));
  padding-bottom: env(safe-area-inset-bottom);
  box-shadow: 0 -6px 20px rgba(0, 0, 0, 0.08);
}

.bottom-nav-item {
  flex: 1 1 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.15rem;
  min-height: 56px;
  padding: 0.4rem 0.25rem;
  color: var(--muted, #765142);
  text-decoration: none;
  font-size: 0.68rem;
  font-weight: 600;
  -webkit-tap-highlight-color: transparent;
}

.bottom-nav-icon {
  font-size: 1.25rem;
  line-height: 1;
}

.bottom-nav-item.is-active {
  color: var(--accent-deep, #e85d04);
}

/* Reserve space so fixed bottom nav never covers page content */
body.has-bottom-nav {
  padding-bottom: calc(56px + env(safe-area-inset-bottom));
}

@media (max-width: 420px) {
  body {
    font-size: 0.96rem;
  }


  .store-buttons,
  .hero-actions,
  .cta-actions,
  .form-actions,
  .wizard-nav {
    display: grid !important;
    grid-template-columns: 1fr !important;
    width: 100%;
  }

  .store-button,
  .primary-button,
  .secondary-button,
  .cta-button,
  .next-btn,
  .back-btn,
  .generate-btn {
    justify-content: center;
    width: 100%;
  }
}
