/**
 * User-frontend mobile web shell. Does not apply to Admin or Advertiser.
 */
body.rh-user-app {
  --rh-safe-top: env(safe-area-inset-top, 0px);
  --rh-safe-bottom: env(safe-area-inset-bottom, 0px);
  --rh-safe-left: env(safe-area-inset-left, 0px);
  --rh-safe-right: env(safe-area-inset-right, 0px);
  --rh-mobile-header-height: 56px;
  --rh-mobile-bottom-nav-height: 56px;
  --rh-mobile-gutter: 16px;
}

body.rh-user-app .logo__name {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 46vw;
}

body.rh-user-app .rh-header-actions {
  display: none;
  align-items: center;
  gap: 0.45rem;
  flex-shrink: 0;
}

body.rh-user-app .rh-header-balance {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  min-width: 44px;
  padding: 0 0.75rem;
  border-radius: 999px;
  background: #0f172a;
  color: #5eead4;
  font-weight: 700;
  font-size: 0.88rem;
  white-space: nowrap;
}

body.rh-user-app .rh-header-auth {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

body.rh-user-app .rh-header-auth .btn,
body.rh-user-app .rh-header-auth .nav-link {
  min-height: 44px;
}

body.rh-user-app .rh-drawer-backdrop,
body.rh-user-app .rh-drawer,
body.rh-user-app .rh-bottom-nav {
  display: none;
}

body.rh-user-app .rh-drawer[hidden],
body.rh-user-app .rh-drawer-backdrop[hidden] {
  display: none !important;
}

@media (max-width: 768px) {
  body.rh-user-app {
    --nav-h: var(--rh-mobile-header-height);
  }

  body.rh-user-app.rh-drawer-open {
    overflow: hidden;
  }

  body.rh-user-app .site-header {
    position: sticky;
    top: 0;
    height: calc(var(--rh-mobile-header-height) + var(--rh-safe-top));
    padding-top: var(--rh-safe-top);
    z-index: 40;
  }

  body.rh-user-app .nav {
    height: var(--rh-mobile-header-height);
    gap: 0.5rem;
  }

  body.rh-user-app .logo {
    min-width: 0;
    font-size: 1.05rem;
  }

  body.rh-user-app .logo__mark {
    width: 32px;
    height: 32px;
    flex-shrink: 0;
  }

  body.rh-user-app .rh-header-actions {
    display: flex;
  }

  body.rh-user-app .nav-toggle {
    display: flex;
    width: 44px;
    height: 44px;
    min-width: 44px;
    min-height: 44px;
  }

  body.rh-user-app .nav-links {
    display: none !important;
    position: absolute !important;
    height: 0 !important;
    overflow: hidden !important;
    pointer-events: none !important;
  }

  body.rh-user-app .container {
    width: min(100% - (var(--rh-mobile-gutter) * 2), var(--content-width));
  }

  body.rh-user-app main {
    padding-bottom: calc(var(--rh-mobile-bottom-nav-height) + var(--rh-safe-bottom) + 1.25rem);
    padding-left: var(--rh-safe-left);
    padding-right: var(--rh-safe-right);
    overflow-x: hidden;
  }

  body.rh-user-app .site-footer {
    margin-top: 0.5rem;
    padding: 0.65rem 0 calc(var(--rh-mobile-bottom-nav-height) + var(--rh-safe-bottom) + 0.5rem);
    font-size: 0.8rem;
  }

  body.rh-user-app .page-header {
    margin-bottom: 0.75rem;
  }

  body.rh-user-app .section {
    padding: 1.25rem 0;
  }

  body.rh-user-app .hero {
    padding: 1.5rem 0 1.25rem;
  }

  body.rh-user-app .hero h1 {
    font-size: 1.85rem;
    max-width: none;
  }

  body.rh-user-app .hero__lead {
    font-size: 1rem;
    margin-bottom: 1.1rem;
  }

  body.rh-user-app .hero__actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.65rem;
  }

  body.rh-user-app .hero__actions .btn {
    min-height: 44px;
    width: 100%;
  }

  body.rh-user-app .hero__visual {
    width: 100%;
    max-width: 100%;
    border-radius: 22px;
    aspect-ratio: 16 / 10;
  }

  body.rh-user-app .hero__play {
    width: 56px;
    height: 56px;
    min-width: 56px;
    min-height: 56px;
  }

  body.rh-user-app .hero__visual h3 {
    font-size: 1.15rem;
  }

  body.rh-user-app .hero__visual p {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }

  body.rh-user-app .grid-2,
  body.rh-user-app .grid-3,
  body.rh-user-app .grid-4,
  body.rh-user-app .how-grid,
  body.rh-user-app .wallet-summary {
    grid-template-columns: 1fr;
  }

  body.rh-user-app .stat-grid {
    grid-template-columns: 1fr 1fr;
  }

  body.rh-user-app .stat-grid .stat-card:first-child {
    grid-column: 1 / -1;
  }

  body.rh-user-app .stat-card.summary-card--highlight .stat-value {
    font-size: 1.85rem;
  }

  body.rh-user-app .filters {
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    margin-inline: calc(var(--rh-mobile-gutter) * -1);
    padding-inline: var(--rh-mobile-gutter);
  }

  body.rh-user-app .filters::-webkit-scrollbar {
    display: none;
  }

  body.rh-user-app .filter-btn {
    flex: 0 0 auto;
    min-height: 44px;
    padding: 0.55rem 1rem;
  }

  body.rh-user-app .task-card,
  body.rh-user-app .card {
    max-width: 100%;
  }

  body.rh-user-app .task-card__footer .points-value,
  body.rh-user-app .task-card__footer .points-balance {
    font-size: 1.2rem;
    font-weight: 800;
  }

  body.rh-user-app .task-card__footer .btn,
  body.rh-user-app .redeem-btn {
    min-height: 44px;
  }

  body.rh-user-app .points-value {
    font-size: 1.2rem;
    font-weight: 800;
  }

  body.rh-user-app .tx-item,
  body.rh-user-app .order-row {
    display: grid;
    grid-template-columns: 1fr auto;
    border-radius: 14px;
    margin-bottom: 0.55rem;
    border: 1px solid var(--border);
    background: #fff;
    padding: 0.9rem 1rem;
  }

  body.rh-user-app .tx-list {
    background: transparent;
    border: none;
  }

  body.rh-user-app .tx-item .tx-icon {
    display: none;
  }

  body.rh-user-app .tx-amount {
    text-align: right;
    font-weight: 800;
  }

  body.rh-user-app .order-row__side {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0.35rem;
  }

  body.rh-user-app .order-row__side .btn {
    min-height: 44px;
  }

  body.rh-user-app .empty-state {
    padding: 1.5rem 1rem;
  }

  body.rh-user-app .auth-page {
    min-height: calc(100vh - var(--rh-mobile-header-height) - var(--rh-safe-top));
    min-height: calc(100dvh - var(--rh-mobile-header-height) - var(--rh-safe-top));
    display: block;
    padding: 1.25rem var(--rh-mobile-gutter) 2rem;
  }

  body.rh-user-app .auth-card {
    width: 100%;
    max-width: 100%;
    padding: 1.25rem;
  }

  body.rh-user-app .auth-card input[type="text"],
  body.rh-user-app .auth-card input[type="email"],
  body.rh-user-app .auth-card input[type="password"],
  body.rh-user-app .auth-card input[type="url"],
  body.rh-user-app input[type="text"],
  body.rh-user-app input[type="email"],
  body.rh-user-app input[type="password"],
  body.rh-user-app input[type="url"],
  body.rh-user-app textarea,
  body.rh-user-app select {
    font-size: 16px;
    min-height: 44px;
  }

  body.rh-user-app .auth-card .btn,
  body.rh-user-app .auth-actions .btn {
    min-height: 44px;
  }

  body.rh-user-app .modal:not([hidden]) {
    align-items: end;
    padding: 0;
  }

  body.rh-user-app .modal__dialog,
  body.rh-user-app .modal__dialog--wide {
    width: 100%;
    max-width: 100%;
    max-height: min(88vh, 88dvh);
    border-radius: 24px 24px 0 0;
    padding-bottom: calc(var(--rh-safe-bottom) + 0.75rem);
    overflow-y: auto;
  }

  body.rh-user-app .modal__close {
    min-width: 44px;
    min-height: 44px;
  }

  body.rh-user-app .hero,
  body.rh-user-app .section,
  body.rh-user-app img,
  body.rh-user-app .card,
  body.rh-user-app .grid-2,
  body.rh-user-app .grid-3,
  body.rh-user-app .grid-4 {
    max-width: 100%;
  }

  body.rh-user-app .rh-account-hub {
    display: grid;
    gap: 0.55rem;
  }

  body.rh-user-app .rh-account-hub a,
  body.rh-user-app .rh-account-hub button {
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1rem;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 14px;
    font-weight: 600;
    width: 100%;
    text-align: left;
    cursor: pointer;
  }

  body.rh-user-app .toast-host {
    bottom: calc(var(--rh-mobile-bottom-nav-height) + var(--rh-safe-bottom) + 0.75rem);
    right: 0.75rem;
    left: 0.75rem;
    align-items: stretch;
    z-index: 90;
  }

  body.rh-user-app .toast {
    max-width: none;
  }

  body.rh-user-app .rh-drawer-backdrop:not([hidden]) {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.42);
    z-index: 60;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s;
  }

  body.rh-user-app .rh-drawer-backdrop.is-open {
    opacity: 1;
    pointer-events: auto;
  }

  body.rh-user-app .rh-drawer:not([hidden]) {
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    right: 0;
    width: min(86vw, 360px);
    height: 100vh;
    height: 100dvh;
    min-height: 100vh;
    min-height: 100dvh;
    background: #fff;
    z-index: 70;
    transform: translateX(100%);
    transition: transform 0.22s ease;
    box-shadow: -12px 0 32px rgba(15, 23, 42, 0.18);
    padding: calc(var(--rh-safe-top) + 0.75rem) 1rem calc(var(--rh-safe-bottom) + 1rem);
    overflow-y: auto;
    overscroll-behavior: contain;
  }

  body.rh-user-app .rh-drawer.is-open {
    transform: none;
  }

  body.rh-user-app .rh-drawer__close {
    width: 44px;
    height: 44px;
    min-width: 44px;
    min-height: 44px;
    border: 1px solid var(--border);
    background: #fff;
    border-radius: 12px;
    font-size: 1.4rem;
    line-height: 1;
    margin-left: auto;
    display: grid;
    place-items: center;
    cursor: pointer;
  }

  body.rh-user-app .rh-drawer__account {
    display: grid;
    grid-template-columns: 48px 1fr;
    gap: 0.75rem;
    align-items: center;
    margin: 1rem 0 1.25rem;
  }

  body.rh-user-app .rh-drawer__account .nav-avatar {
    width: 48px;
    height: 48px;
    font-size: 0.95rem;
  }

  body.rh-user-app .rh-drawer__name {
    font-weight: 700;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  body.rh-user-app .rh-drawer__balance {
    color: var(--primary-dark);
    font-weight: 700;
    margin-top: 0.15rem;
  }

  body.rh-user-app .rh-drawer__nav {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    flex: 1;
  }

  body.rh-user-app .rh-drawer__link {
    min-height: 44px;
    display: flex;
    align-items: center;
    padding: 0.7rem 0.85rem;
    border-radius: 12px;
    font-weight: 600;
  }

  body.rh-user-app .rh-drawer__foot {
    margin-top: auto;
    padding-top: 1rem;
  }

  body.rh-user-app .rh-drawer__foot .btn {
    width: 100%;
    min-height: 44px;
  }

  body.rh-user-app .rh-bottom-nav {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 50;
    height: calc(var(--rh-mobile-bottom-nav-height) + var(--rh-safe-bottom));
    padding-bottom: var(--rh-safe-bottom);
    padding-left: var(--rh-safe-left);
    padding-right: var(--rh-safe-right);
    background: rgba(255, 255, 255, 0.96);
    border-top: 1px solid var(--border);
    backdrop-filter: blur(10px);
  }

  body.rh-user-app .rh-bottom-nav__item {
    min-height: 44px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.1rem;
    font-size: 0.68rem;
    font-weight: 600;
    color: var(--muted);
  }

  body.rh-user-app .rh-bottom-nav__icon {
    width: 22px;
    height: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
  }

  body.rh-user-app .rh-bottom-nav__icon .rh-icon {
    width: 20px;
    height: 20px;
  }

  body.rh-user-app .rh-drawer__link {
    gap: 0.75rem;
  }

  body.rh-user-app .rh-drawer__account {
    margin: 0.75rem 0 0.75rem;
  }

  body.rh-user-app .nav-toggle span {
    display: none;
  }

  body.rh-user-app .rh-bottom-nav__item.is-active {
    color: var(--primary-dark);
  }
}

@media (max-width: 390px) {
  body.rh-user-app {
    --rh-mobile-gutter: 12px;
  }
}

@media (max-width: 360px) {
  body.rh-user-app .hero__actions {
    grid-template-columns: 1fr;
  }
}

@media (min-width: 769px) {
  body.rh-user-app .rh-header-balance,
  body.rh-user-app .rh-header-auth,
  body.rh-user-app .rh-drawer,
  body.rh-user-app .rh-drawer-backdrop,
  body.rh-user-app .rh-bottom-nav,
  body.rh-user-app .rh-account-hub {
    display: none !important;
  }

  body.rh-user-app .rh-header-actions {
    display: flex;
  }
}

@media (min-width: 800px) {
  body.rh-user-app .rh-header-actions {
    display: none !important;
  }
}

@media (max-width: 720px) {
  body.rh-user-app .rh-app-profile-card {
    flex-wrap: wrap;
  }

  body.rh-user-app .rh-app-profile-card .btn {
    width: 100%;
  }

  body.rh-user-app .rh-app-page {
    margin-top: 1.25rem;
  }
}
