/* DREAMCARS V151 — true bottom anchored mobile feed/comments viewport.
   Goal:
   1) No blank scrolling below the latest item.
   2) Latest feed post/comment sits at the lower working edge.
   3) Top header and comments chip stay fixed.
   4) With keyboard open: keyboard -> composer -> latest comment. */

@media (max-width:699px){
  html.dc-bottom-anchor-mobile,
  html.dc-bottom-anchor-mobile body{
    height:var(--dc-layout-vh,100dvh) !important;
    min-height:var(--dc-layout-vh,100dvh) !important;
    max-height:var(--dc-layout-vh,100dvh) !important;
  }

  /* Public / guest / user feed: document itself must not create a lower blank scroll area. */
  html.dc-feed-bottom-anchor body.user-mode:not(.auth-mode){
    overflow:hidden !important;
    overscroll-behavior:none !important;
    touch-action:manipulation !important;
    padding-bottom:0 !important;
  }
  html.dc-feed-bottom-anchor body.user-mode:not(.auth-mode) .wrap{
    height:var(--dc-layout-vh,100dvh) !important;
    min-height:var(--dc-layout-vh,100dvh) !important;
    max-height:var(--dc-layout-vh,100dvh) !important;
    overflow:hidden !important;
    padding-bottom:0 !important;
  }
  html.dc-feed-bottom-anchor body.user-mode:not(.auth-mode) #feedPosts{
    position:fixed !important;
    z-index:110 !important;
    left:50% !important;
    right:auto !important;
    transform:translateX(-50%) !important;
    top:var(--dc-feed-viewport-top,208px) !important;
    bottom:var(--dc-feed-viewport-bottom,92px) !important;
    width:min(calc(100vw - 24px),430px) !important;
    max-width:430px !important;
    margin:0 !important;
    padding:0 0 10px !important;
    display:flex !important;
    flex-direction:column !important;
    align-items:flex-start !important;
    gap:12px !important;
    overflow-x:hidden !important;
    overflow-y:auto !important;
    overscroll-behavior-y:contain !important;
    -webkit-overflow-scrolling:touch !important;
    scrollbar-width:none !important;
    scroll-padding-top:0 !important;
    scroll-padding-bottom:10px !important;
  }
  html.dc-feed-bottom-anchor body.user-mode:not(.auth-mode) #feedPosts::-webkit-scrollbar{display:none !important;}
  html.dc-feed-bottom-anchor body.user-mode:not(.auth-mode) #feedPosts::before{
    content:"" !important;
    display:block !important;
    flex:1 1 auto !important;
    min-height:0 !important;
    width:1px !important;
    pointer-events:none !important;
  }
  html.dc-feed-bottom-anchor body.user-mode:not(.auth-mode) #feedPosts > *{
    flex:0 0 auto !important;
  }

  /* Comments: page/document is frozen; the thread owns scrolling. */
  html.dc-comments-bottom-anchor body.comments-mode{
    overflow:hidden !important;
    overscroll-behavior:none !important;
    touch-action:manipulation !important;
    padding-bottom:0 !important;
  }
  html.dc-comments-bottom-anchor body.comments-mode .wrap{
    height:var(--dc-layout-vh,100dvh) !important;
    min-height:var(--dc-layout-vh,100dvh) !important;
    max-height:var(--dc-layout-vh,100dvh) !important;
    overflow:hidden !important;
    padding-bottom:0 !important;
  }

  /* The shell may remain in DOM flow, but it may not add page scrolling. */
  html.dc-comments-bottom-anchor body.comments-mode .feed-comments-screen{
    position:static !important;
    width:100% !important;
    min-height:0 !important;
    height:auto !important;
    margin:0 auto !important;
    padding:0 !important;
    overflow:visible !important;
  }

  /* Header remains attached to top; geometry of user/admin header is preserved by existing styles. */
  html.dc-comments-bottom-anchor body.comments-mode header,
  html.dc-feed-bottom-anchor body.user-mode:not(.auth-mode) header{
    position:fixed !important;
    top:0 !important;
  }

  /* Compact comments chip stays fixed directly under the header. */
  html.dc-comments-bottom-anchor body.comments-mode .feed-comments-dock{
    position:fixed !important;
    top:var(--dc-comments-dock-top,212px) !important;
    left:50% !important;
    transform:translateX(-50%) !important;
    z-index:2147483200 !important;
    margin:0 !important;
  }

  /* Comments viewport: last comment is held immediately above composer/guest CTA. */
  html.dc-comments-bottom-anchor body.comments-mode .feed-comments-thread{
    position:fixed !important;
    z-index:180 !important;
    left:50% !important;
    right:auto !important;
    transform:translateX(-50%) !important;
    top:var(--dc-comments-thread-top,290px) !important;
    bottom:var(--dc-comments-thread-bottom,174px) !important;
    width:min(calc(100vw - 30px),430px) !important;
    max-width:430px !important;
    margin:0 !important;
    padding:var(--dc-comments-thread-start-pad,76px) 0 8px !important;
    display:flex !important;
    flex-direction:column !important;
    align-items:stretch !important;
    gap:10px !important;
    overflow-x:hidden !important;
    overflow-y:auto !important;
    overscroll-behavior-y:contain !important;
    -webkit-overflow-scrolling:touch !important;
    scrollbar-width:none !important;
    scroll-padding-top:0 !important;
    scroll-padding-bottom:0 !important;
  }
  html.dc-comments-bottom-anchor body.comments-mode .feed-comments-thread::-webkit-scrollbar{display:none !important;}
  html.dc-comments-bottom-anchor body.comments-mode .feed-comments-thread::before{
    content:"" !important;
    display:block !important;
    flex:1 1 auto !important;
    min-height:0 !important;
    width:1px !important;
    pointer-events:none !important;
  }
  html.dc-comments-bottom-anchor body.comments-mode .feed-comments-thread > *{
    flex:0 0 auto !important;
  }
  html.dc-comments-bottom-anchor body.comments-mode .feed-comments-empty,
  html.dc-comments-bottom-anchor body.comments-mode .feed-comments-missing{
    margin-top:0 !important;
    margin-bottom:0 !important;
  }

  /* Registered user/admin comment composer: keyboard raises it; without keyboard user composer sits above menu. */
  html.dc-comments-bottom-anchor body.comments-mode .comments-rich-composer{
    bottom:var(--dc-comments-composer-bottom,calc(82px + env(safe-area-inset-bottom,0px))) !important;
    z-index:2147483550 !important;
  }
  html.dc-comments-bottom-anchor body.admin-mode.comments-mode .comments-rich-composer{
    bottom:var(--dc-comments-composer-bottom,14px) !important;
  }
  html.dc-comments-bottom-anchor body.comments-mode.dc-keyboard-open .comments-rich-composer,
  html.dc-comments-bottom-anchor body.admin-mode.comments-mode.dc-keyboard-open .comments-rich-composer{
    bottom:var(--dc-comments-composer-bottom,calc(var(--dc-keyboard-offset,0px) + 10px)) !important;
  }

  /* Guest CTA participates in the same bottom geometry. */
  html.dc-comments-bottom-anchor body.comments-mode .feed-comments-guest{
    bottom:var(--dc-comments-guest-bottom,calc(82px + env(safe-area-inset-bottom,0px))) !important;
    z-index:2147483400 !important;
  }

  /* Composer fade must not artificially reserve extra scrollable page area. */
  html.dc-comments-bottom-anchor body.comments-mode .comments-composer-backdrop{
    bottom:0 !important;
    height:calc(var(--dc-comments-thread-bottom,174px) + 16px) !important;
  }
}

/* DREAMCARS V157 marker: 20260516_v154_header_restore_feed_lower_gap_v157 */


/* DREAMCARS V179 — comments composer and guest CTA are anchored at the bottom; comments menu is absent */
@media (max-width:767px){
  html.dc-comments-bottom-anchor body.comments-mode .comments-rich-composer{
    bottom:var(--dc-comments-composer-bottom,max(14px,env(safe-area-inset-bottom,0px))) !important;
  }
  html.dc-comments-bottom-anchor body.comments-mode .feed-comments-guest{
    bottom:var(--dc-comments-guest-bottom,max(14px,env(safe-area-inset-bottom,0px))) !important;
  }
}

/* DREAMCARS V193 marker: 20260517_comments_transparent_dock_scroll_under_v193 */

/* DREAMCARS V199 marker: 20260517_comments_lower_backdrop_geometry_soft_fade_v199 */


/* DREAMCARS V200 — comments thread continues underneath the glass backdrop, while bottom padding keeps the last comment readable above the composer */
@media (max-width:767px){
  html.dc-comments-bottom-anchor body.comments-mode .feed-comments-screen[data-can-comment="1"] .feed-comments-thread{
    bottom:0 !important;
    padding-bottom:calc(var(--dc-comments-thread-bottom,174px) + 18px) !important;
    scroll-padding-bottom:calc(var(--dc-comments-thread-bottom,174px) + 18px) !important;
  }
}
/* DREAMCARS V200 marker: 20260517_comments_lower_backdrop_true_thread_blur_v200 */

/* DREAMCARS V201 — keyboard-open comments thread keeps a full upward scroll range while preserving the closed layout */
@media (max-width:767px){
  html.dc-comments-bottom-anchor body.comments-mode.dc-keyboard-open .feed-comments-screen[data-can-comment="1"] .feed-comments-thread{
    bottom:0 !important;
    overflow-y:auto !important;
    -webkit-overflow-scrolling:touch !important;
    overscroll-behavior-y:contain !important;
  }
}
/* DREAMCARS V201 marker: 20260517_comments_keyboard_scroll_top_composer_closer_v201 */


/* DREAMCARS V202 — comments keyboard-open only: focus-driven thread geometry keeps the first comment reachable */
@media (max-width:767px){
  html.dc-comments-bottom-anchor body.comments-mode.comments-keyboard-focus .feed-comments-screen[data-can-comment="1"] .feed-comments-thread,
  html.dc-comments-bottom-anchor body.comments-mode.dc-keyboard-open .feed-comments-screen[data-can-comment="1"] .feed-comments-thread{
    bottom:0 !important;
    overflow-y:auto !important;
    -webkit-overflow-scrolling:touch !important;
    overscroll-behavior-y:contain !important;
    padding-top:var(--dc-comments-thread-start-pad,76px) !important;
  }
}
/* DREAMCARS V202 marker: 20260517_comments_keyboard_focus_state_v202 */

/* DREAMCARS V203 — keyboard-open comments thread uses the real visible viewport above the composer, so the first comment remains reachable */
@media (max-width:767px){
  html.dc-comments-bottom-anchor body.comments-mode.comments-keyboard-focus .feed-comments-screen[data-can-comment="1"] .feed-comments-thread,
  html.dc-comments-bottom-anchor body.comments-mode.dc-keyboard-open .feed-comments-screen[data-can-comment="1"] .feed-comments-thread{
    bottom:var(--dc-comments-thread-bottom,174px) !important;
    min-height:0 !important;
    padding-top:var(--dc-comments-thread-start-pad,76px) !important;
    overflow-y:auto !important;
    -webkit-overflow-scrolling:touch !important;
    overscroll-behavior-y:contain !important;
  }
}
/* DREAMCARS V203 marker: 20260517_comments_keyboard_scroll_first_comment_v203 */

/* DREAMCARS V204 — keyboard-open comments thread extends under composer/keyboard with reserved padding, so the first comment remains fully reachable */
@media (max-width:767px){
  html.dc-comments-bottom-anchor body.comments-mode.comments-keyboard-focus .feed-comments-screen[data-can-comment="1"] .feed-comments-thread,
  html.dc-comments-bottom-anchor body.comments-mode.dc-keyboard-open .feed-comments-screen[data-can-comment="1"] .feed-comments-thread{
    bottom:0 !important;
    min-height:0 !important;
    padding-top:var(--dc-comments-thread-start-pad,76px) !important;
    padding-bottom:calc(var(--dc-comments-thread-bottom,174px) + 18px) !important;
    scroll-padding-top:0 !important;
    scroll-padding-bottom:calc(var(--dc-comments-thread-bottom,174px) + 18px) !important;
    overflow-y:auto !important;
    -webkit-overflow-scrolling:touch !important;
    overscroll-behavior-y:contain !important;
  }
}
/* DREAMCARS V204 marker: 20260517_comments_keyboard_scroll_to_first_real_v204 */


/* DREAMCARS V205 — keyboard-open comments keep the latest comment beside the composer while preserving full upward scroll */
@media (max-width:767px){
  html.dc-comments-bottom-anchor body.comments-mode.comments-keyboard-focus .feed-comments-screen[data-can-comment="1"] .feed-comments-thread,
  html.dc-comments-bottom-anchor body.comments-mode.dc-keyboard-open .feed-comments-screen[data-can-comment="1"] .feed-comments-thread{
    bottom:var(--dc-comments-thread-bottom,174px) !important;
    min-height:0 !important;
    padding-top:var(--dc-comments-thread-start-pad,76px) !important;
    padding-bottom:8px !important;
    scroll-padding-top:0 !important;
    scroll-padding-bottom:8px !important;
    overflow-y:auto !important;
    -webkit-overflow-scrolling:touch !important;
    overscroll-behavior-y:contain !important;
  }
}
/* DREAMCARS V205 marker: 20260517_comments_keyboard_last_near_input_scroll_first_v205 */

/* DREAMCARS V206 — one bottom geometry for comments: same latest-comment gap at closed/open keyboard and full scroll range to the first comment */
@media (max-width:767px){
  html.dc-comments-bottom-anchor body.comments-mode .feed-comments-screen[data-can-comment="1"] .feed-comments-thread,
  html.dc-comments-bottom-anchor body.comments-mode.comments-keyboard-focus .feed-comments-screen[data-can-comment="1"] .feed-comments-thread,
  html.dc-comments-bottom-anchor body.comments-mode.dc-keyboard-open .feed-comments-screen[data-can-comment="1"] .feed-comments-thread{
    bottom:0 !important;
    min-height:0 !important;
    padding-top:var(--dc-comments-thread-start-pad,76px) !important;
    padding-bottom:var(--dc-comments-thread-safe-bottom,calc(var(--dc-comments-thread-bottom,174px) - 4px)) !important;
    scroll-padding-top:0 !important;
    scroll-padding-bottom:var(--dc-comments-thread-safe-bottom,calc(var(--dc-comments-thread-bottom,174px) - 4px)) !important;
    overflow-y:scroll !important;
    overscroll-behavior-y:contain !important;
    -webkit-overflow-scrolling:touch !important;
    touch-action:pan-y !important;
  }
}
/* DREAMCARS V206 marker: 20260517_comments_equal_bottom_gap_keyboard_full_top_scroll_v206 */



/* DREAMCARS V207 — keyboard-open comments thread uses the real visible band up to the composer, so the first comment is reachable */
@media (max-width:767px){
  html.dc-comments-bottom-anchor body.comments-mode.comments-keyboard-focus .feed-comments-screen[data-can-comment="1"] .feed-comments-thread,
  html.dc-comments-bottom-anchor body.comments-mode.dc-keyboard-open .feed-comments-screen[data-can-comment="1"] .feed-comments-thread{
    bottom:auto !important;
    height:var(--dc-comments-thread-keyboard-height,calc(var(--dc-layout-vh,100svh) - var(--dc-comments-thread-top,0px) - var(--dc-comments-thread-bottom,174px))) !important;
    max-height:var(--dc-comments-thread-keyboard-height,calc(var(--dc-layout-vh,100svh) - var(--dc-comments-thread-top,0px) - var(--dc-comments-thread-bottom,174px))) !important;
    min-height:120px !important;
    padding-bottom:8px !important;
    scroll-padding-bottom:8px !important;
    overflow-y:auto !important;
    -webkit-overflow-scrolling:touch !important;
    overscroll-behavior-y:contain !important;
  }
}
/* DREAMCARS V207 marker: 20260517_comments_keyboard_visible_viewport_thread_v207 */

/* DREAMCARS V208 marker: 20260517_comments_keyboard_open_settle_v208 */

/* Unified fixed black canvas after inline feed CSS. */
html,
html.dc-bottom-anchor-mobile,
html.dc-feed-bottom-anchor,
html.dc-comments-bottom-anchor,
html body,
html body.user-mode,
html body.user-mode:not(.auth-mode),
html body.user-mode.public-feed-open,
html body.public-feed-open,
html body.admin-mode,
html body.admin-mobile-shell,
html body.admin-mode.admin-mobile-shell{
  background:#000!important;
  background-color:#000!important;
  background-image:none!important;
  background-attachment:fixed!important;
}

html body::before,
html body.user-mode::before,
html body.user-mode:not(.auth-mode)::before,
html body.user-mode.public-feed-open::before,
html body.public-feed-open::before,
html body.admin-mode::before,
html body.admin-mobile-shell::before,
html body.admin-mode.admin-mobile-shell::before{
  content:""!important;
  position:fixed!important;
  inset:0!important;
  z-index:-1!important;
  pointer-events:none!important;
  background:#000!important;
  background-color:#000!important;
  background-image:none!important;
}

html body .wrap{
  position:relative!important;
  isolation:isolate!important;
}

html body .wrap::before{
  content:""!important;
  position:fixed!important;
  top:76px!important;
  right:0!important;
  width:240px!important;
  height:240px!important;
  z-index:0!important;
  pointer-events:none!important;
  background:radial-gradient(
    circle at 72% 18%,
    rgba(255,138,0,.13) 0,
    rgba(255,138,0,.07) 72px,
    rgba(255,95,0,.035) 138px,
    transparent 240px
  )!important;
}

html body .wrap > *{
  position:relative!important;
  z-index:1!important;
}

html body.user-mode .wrap,
html body.user-mode.public-feed-open .wrap,
html.dc-feed-bottom-anchor body.user-mode:not(.auth-mode) .wrap,
html body.user-mode #feedPosts,
html body.user-mode.public-feed-open #feedPosts,
html.dc-feed-bottom-anchor body.user-mode:not(.auth-mode) #feedPosts{
  background:transparent!important;
  background-color:transparent!important;
  background-image:none!important;
}

@media (max-width:699px){
  html.dc-feed-bottom-anchor body.user-mode:not(.auth-mode) #feedPosts{
    padding-bottom:0!important;
    scroll-padding-bottom:0!important;
  }
  html.dc-feed-bottom-anchor body.user-mode.dc-browser-launch:not(.auth-mode).public-feed-open #feedPosts{
    bottom:var(--public-feed-bottom,74px)!important;
  }

  html body.user-mode.public-feed-open .user-bottom-nav,
  html.dc-feed-bottom-anchor body.user-mode:not(.auth-mode).public-feed-open .user-bottom-nav{
    box-shadow:0 0 14px rgba(255,138,0,.05)!important;
  }
}

/* Admin feed composer glass override: loaded after comments-v149.css. */
@media (max-width:760px){
  body.admin-mode.admin-mobile-shell.mobile-admin-feed-open .mobile-admin-composer-backdrop,
  body.admin-mobile-shell.mobile-admin-feed-open .mobile-admin-composer-backdrop,
  body.admin-mode.admin-mobile-shell.mobile-admin-feed-open .mobile-admin-composer-backdrop::before,
  body.admin-mode.admin-mobile-shell.mobile-admin-feed-open .mobile-admin-composer-backdrop::after,
  body.admin-mobile-shell.mobile-admin-feed-open .mobile-admin-composer-backdrop::before,
  body.admin-mobile-shell.mobile-admin-feed-open .mobile-admin-composer-backdrop::after{
    content:none!important;
    display:none!important;
    background:none!important;
    background-color:transparent!important;
    background-image:none!important;
    border:0!important;
    box-shadow:none!important;
    filter:none!important;
    backdrop-filter:none!important;
    -webkit-backdrop-filter:none!important;
    mask-image:none!important;
    -webkit-mask-image:none!important;
    opacity:0!important;
    pointer-events:none!important;
  }

  body.admin-mode.admin-mobile-shell.mobile-admin-feed-open .mobile-admin-composer,
  body.admin-mobile-shell.mobile-admin-feed-open .mobile-admin-composer{
    background:transparent!important;
    background-image:none!important;
    border:0!important;
    box-shadow:none!important;
    backdrop-filter:none!important;
    -webkit-backdrop-filter:none!important;
  }

  body.admin-mode.admin-mobile-shell.mobile-admin-feed-open .composer-input-wrap,
  body.admin-mobile-shell.mobile-admin-feed-open .composer-input-wrap{
    background:transparent!important;
    background-image:none!important;
    box-shadow:none!important;
    backdrop-filter:none!important;
    -webkit-backdrop-filter:none!important;
  }

  body.admin-mode.admin-mobile-shell.mobile-admin-feed-open #mobileAdminText,
  body.admin-mobile-shell.mobile-admin-feed-open #mobileAdminText{
    background:rgba(19,31,44,.28)!important;
    border:1px solid rgba(255,171,70,.36)!important;
    border-radius:24px!important;
  }
}
