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

/* Installed PWA should feel native: no double-tap / gesture zoom (pinch is killed
   by the viewport user-scalable=no, which Safari ignores on the open web but the
   standalone app respects). */
@media (display-mode: standalone), (display-mode: fullscreen){
  html, body{ touch-action: manipulation; }
}
body.dc-pwa-standalone, body.dc-runtime-pwa, body.dc-pwa-installed{ touch-action: manipulation; }

: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 paint through the status bar — layout authority in dc-app-header.css */

@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):not(.contest-user-hub-page) .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: 767px) {
  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):not(.contest-user-hub-page) .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):not(.contest-user-hub-page) .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) {
  html {
    height: -webkit-fill-available;
  }

  html,
  body.dc-runtime-pwa.user-mode:not(.admin-mode):not(.auth-mode),
  body.dc-pwa-standalone.user-mode:not(.admin-mode):not(.auth-mode) {
    min-height: var(--dc-layout-vh, 100svh);
  }

  body.dc-runtime-pwa.user-mode:not(.admin-mode):not(.auth-mode),
  body.dc-pwa-standalone.user-mode:not(.admin-mode):not(.auth-mode) {
    padding-top: 0 !important;
    overflow-x: clip;
  }

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

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

  /* Admin PWA (dc-pwa-installed): browser chrome CSS — layout height + nav dock only */
  html,
  body.dc-pwa-installed.admin-mode.admin-mobile-shell {
    min-height: var(--dc-layout-vh, 100svh);
  }

  body.dc-pwa-installed.admin-mode.admin-mobile-shell {
    padding-top: 0 !important;
    overflow-x: clip;
    background: #000 !important;
    -webkit-overflow-scrolling: touch;
  }

  body.dc-pwa-installed.admin-mode.admin-mobile-shell.feed-v2-surface,
  body.dc-pwa-standalone.feed-v2-surface,
  body.dc-runtime-pwa.feed-v2-surface {
    background: transparent !important;
    background-color: transparent !important;
  }

  body.dc-pwa-installed.admin-mode.admin-mobile-shell:not(.feed-v2-surface)::after {
    display: none !important;
    content: none !important;
    height: 0 !important;
    opacity: 0 !important;
    pointer-events: none !important;
  }

  /* Dock flush to screen bottom — safe-area via padding inside nav, not bottom offset.
     The VISITOR nav (nav.user-bottom-nav.dc-bottom-nav) is owned entirely by
     dc-bottom-nav.css (§2/§15) — it already sets bottom/left/right/width/height/
     background/padding-bottom/z-index there, so duplicating it here only created a
     conflicting layer (this block forced z-index:5001 over the intended 99999).
     Only the ADMIN nav lives here, since dc-bottom-nav.css does not style it. */
  body.dc-pwa-installed.admin-mode nav.admin-mobile-bottom-nav,
  html body.dc-pwa-installed.admin-mode.admin-mobile-shell .admin-mobile-bottom-nav,
  html body.dc-pwa-installed.admin-mode.admin-mobile-shell nav.admin-mobile-bottom-nav {
    bottom: 0 !important;
    left: 0 !important;
    right: 0 !important;
    top: auto !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
    width: 100% !important;
    max-width: 100% !important;
    min-height: 0 !important;
    height: auto !important;
    padding-bottom: var(--dc-bottom-nav-padding-bottom) !important;
    box-sizing: border-box !important;
    border-radius: 0 !important;
    z-index: var(--dc-bottom-nav-z-index, 99999) !important;
    background: var(--dc-bottom-nav-bg, linear-gradient(180deg, rgba(20, 20, 20, 0.98), rgba(0, 0, 0, 0.99))) !important;
  }
}

@media (min-width: 761px) and (max-width: 1100px) {
  body.user-mode:not(.auth-mode):not(.admin-mode):not(.feed-v2-surface):not(.contest-user-hub-page) .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: var(--dc-safe-top, env(safe-area-inset-top, 0px)) !important;
  min-height: var(--dc-safe-top, 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: 20260614_dc_mobile_pwa_shell_v13_runtime_profiles */
