/* DREAMCARS — unified mobile + PWA layout shell (load after dc-bottom-nav.css) */

:root {
  --dc-mobile-content-bottom-buffer: 14px;
  --dc-mobile-content-bottom-reserve: calc(
    var(--dc-bottom-nav-mobile-reserve, 80px) + var(--dc-mobile-content-bottom-buffer)
  );
  --dc-mobile-wrap-inline: max(12px, env(safe-area-inset-left, 0px));
  --dc-shell-top-ink: #05070d;
  --dc-shell-top-ink-home: #030304;
  --dc-shell-top-ink-premium: #000;
}

html {
  background-color: var(--dc-shell-top-ink);
}

html:has(body.guest-home-open) {
  background-color: var(--dc-shell-top-ink-home);
}

html:has(body.dc-premium-shell-open),
html.dc-premium-shell-open {
  background-color: var(--dc-shell-top-ink-premium);
}

/* Fixed headers must paint through the status bar — not below it */
html body.user-mode:not(.admin-mode):not(.comments-mode) header.dc-app-header,
html body.admin-mode.admin-mobile-shell header.dc-app-header {
  top: 0 !important;
}

@media (max-width: 760px) {
  html body.user-mode:not(.admin-mode):not(.comments-mode) header.dc-app-header {
    padding-top: calc(10px + env(safe-area-inset-top, 0px)) !important;
  }

  html body.admin-mode.admin-mobile-shell header.dc-app-header {
    padding-top: calc(12px + env(safe-area-inset-top, 0px)) !important;
  }

}

@media (orientation: landscape) and (max-height: 520px) {
  body.user-mode:not(.auth-mode):not(.admin-mode):not(.feed-v2-surface) {
    --dc-mobile-content-bottom-buffer: 28px;
  }

  body.user-mode:not(.auth-mode):not(.admin-mode):not(.feed-v2-surface) .wrap {
    padding-bottom: var(--dc-mobile-content-bottom-reserve) !important;
    scroll-padding-bottom: var(--dc-mobile-content-bottom-reserve);
    padding-left: var(--dc-mobile-wrap-inline) !important;
    padding-right: max(12px, env(safe-area-inset-right, 0px)) !important;
  }
}

@media (max-width: 760px) {
  html:has(body.user-mode:not(.admin-mode):not(.auth-mode)) {
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
    overflow-x: clip;
    scroll-padding-bottom: var(--dc-mobile-content-bottom-reserve);
  }

  body.user-mode:not(.auth-mode):not(.admin-mode) {
    width: 100%;
    max-width: 100vw;
    overflow-x: clip;
    min-height: 100dvh;
    min-height: 100vh;
    -webkit-tap-highlight-color: transparent;
  }

  body.user-mode:not(.auth-mode):not(.admin-mode):not(.feed-v2-surface) .wrap {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    box-sizing: border-box !important;
    padding-left: var(--dc-mobile-wrap-inline) !important;
    padding-right: max(12px, env(safe-area-inset-right, 0px)) !important;
    padding-bottom: var(--dc-mobile-content-bottom-reserve) !important;
    scroll-padding-bottom: var(--dc-mobile-content-bottom-reserve);
  }

  body.user-mode.device-mobile.dc-orient-landscape:not(.feed-v2-surface) {
    --dc-mobile-content-bottom-buffer: 24px;
  }

  body.user-mode.device-mobile.dc-orient-landscape:not(.feed-v2-surface) .wrap {
    padding-bottom: var(--dc-mobile-content-bottom-reserve) !important;
  }

  body.contests-public-open .cp-page,
  body.contest-user-open .cu-page,
  body.live-user-open .lu-page,
  body.profile-user-open .profile-page,
  body.stickers-page-open .stickers-vitrine,
  body.legal-page-open .legal-page {
    scroll-margin-bottom: var(--dc-mobile-content-bottom-reserve);
  }

  body.contests-public-open .cp-contest-card__actions,
  body.contests-public-open .cp-contest-card__cta,
  body.contest-user-open .cu-guest-auth,
  body.contest-user-open .cu-actions,
  body.contest-user-open .cu-submit-row,
  body.live-user-open .lu-hero__actions,
  body.profile-user-open .profile-actions {
    scroll-margin-bottom: calc(var(--dc-mobile-content-bottom-reserve) + 8px);
    position: relative;
    z-index: 2;
  }

  body.user-mode:not(.admin-mode):not(.auth-mode) .btn,
  body.user-mode:not(.admin-mode):not(.auth-mode) .cp-contest-card__cta,
  body.user-mode:not(.admin-mode):not(.auth-mode) .cu-guest-auth__actions .btn {
    min-height: 44px;
    touch-action: manipulation;
  }

  body.user-mode:not(.admin-mode):not(.auth-mode) .cp-topbar__back,
  body.user-mode:not(.admin-mode):not(.auth-mode) .dc-bottom-nav__bar > a,
  body.user-mode:not(.admin-mode):not(.auth-mode) .dc-bottom-nav__bar > .dc-bottom-nav__more {
    min-height: 44px;
    touch-action: manipulation;
  }
}

@media (display-mode: standalone), (display-mode: fullscreen) {
  body.dc-pwa-standalone.user-mode:not(.admin-mode):not(.auth-mode) {
    padding-top: 0 !important;
  }

  body.dc-pwa-standalone.user-mode:not(.feed-v2-surface):not(.guest-home-open) .wrap {
    padding-top: calc(var(--admin-header-height, 68px) + 6px + env(safe-area-inset-top, 0px)) !important;
  }

  body.dc-pwa-standalone.contests-public-open .wrap,
  body.dc-pwa-standalone.contest-user-open .wrap {
    padding-top: calc(var(--admin-header-height, 68px) + env(safe-area-inset-top, 0px)) !important;
  }
}

@media (min-width: 761px) and (max-width: 1100px) {
  body.user-mode:not(.auth-mode):not(.admin-mode):not(.feed-v2-surface) .wrap {
    padding-bottom: calc(var(--dc-bottom-nav-desktop-wrap-reserve, 128px) + env(safe-area-inset-bottom, 0px)) !important;
    scroll-padding-bottom: calc(var(--dc-bottom-nav-desktop-wrap-reserve, 128px) + env(safe-area-inset-bottom, 0px));
  }
}

/* Override dc-premium-shell-bg: paint status-bar band on guest home */
html:has(body.guest-home-open)::before {
  content: "" !important;
  display: block !important;
  position: fixed !important;
  top: 0 !important;
  left: 0 !important;
  right: 0 !important;
  bottom: auto !important;
  width: auto !important;
  height: env(safe-area-inset-top, 0px) !important;
  min-height: env(safe-area-inset-top, 0px) !important;
  inset: auto !important;
  background: var(--dc-shell-top-ink-home) !important;
  z-index: 2147483645 !important;
  pointer-events: none !important;
}

/* DREAMCARS lock marker: 20260611_dc_mobile_pwa_shell_v5 */
