/* uniform section rhythm VI (v7.9.297, rhythm6.py): one rhythm on every page family,
   44px desktop / 36px phone between the last content of one block and the first content of the next.
   Loaded last on every page. Measured with a content-to-content gap audit at 1280 and 390px. */

/* 1. main block -> footer ad: trailing margins removed, 36px padding + the ad's 8px = 44 */
:root :is(.lg-body,.gd-layout,.gl-main,.cp-main,.tool-guide,.rh-main,.ri-main,.cmp-main,.rev-body,.faq-section,.list-section,.other-games):has(+ .ad-banner-footer), :root :is(.lg-body,.gd-layout,.gl-main,.cp-main,.tool-guide,.rh-main,.ri-main,.cmp-main,.rev-body,.faq-section,.list-section,.other-games):has(+ script + .ad-banner-footer), :root :is(.lg-body,.gd-layout,.gl-main,.cp-main,.tool-guide,.rh-main,.ri-main,.cmp-main,.rev-body,.faq-section,.list-section,.other-games):has(+ template + .ad-banner-footer), :root :is(.lg-body,.gd-layout,.gl-main,.cp-main,.tool-guide,.rh-main,.ri-main,.cmp-main,.rev-body,.faq-section,.list-section,.other-games):has(+ script + script + .ad-banner-footer){padding-bottom:36px}
:root :is(.lg-body,.cp-main,.gl-main,.vp-main,.gd-body,.wrap-narrow,#ss-out,.faq-section,.list-section,section.info > .wrap,section.info .faq,.gl-hub-links,.gg-inner)> :nth-last-child(1 of :not(script,style,template,[hidden])){margin-bottom:0}
:root main:has(+ .ad-banner-footer) > :is(.faq-section,section.info):last-child, :root main:has(+ script + .ad-banner-footer) > :is(.faq-section,section.info):last-child, :root main:has(+ template + .ad-banner-footer) > :is(.faq-section,section.info):last-child, :root main:has(+ script + script + .ad-banner-footer) > :is(.faq-section,section.info):last-child{padding-bottom:36px}
:root main > :is(.faq-section,section.info):last-child > :nth-last-child(1 of :not(script,style,template,[hidden])){margin-bottom:0}
:root .gd-body > :nth-last-child(1 of :not(script,style,template,[hidden])) > :nth-last-child(1 of :not(script,style,template,[hidden])){margin-bottom:0}
:root .gl-main > .gl-hub-links{margin-bottom:0}
:root .ri-main .ri-more-wrap{margin-bottom:0}
:root #ss-out .ss-start{padding-bottom:0}
:root main.ss-wrap{padding-bottom:30px}

/* 2. top ad -> main block: 44px */
:root body.rp-static .lg-body{padding-top:20px}
:root body.rp-static .lg-body > :nth-child(1 of :not(script,style)){margin-top:0}
:root .ad-banner-top + .gd-layout, :root .ad-banner-top + main > .tool-shell:first-child, :root .ad-banner-top + .tool-shell{padding-top:20px}

/* 3. joins inside pages */
:root .vp-main, :root .vp-main:has(+ .tool-guide > .wrap-narrow > .rp-tip:first-child){padding-bottom:18px !important}
:root .cmp-main{padding-bottom:28px}
:root .game-guide + .nw-box{padding-top:23px}
:root div.wrap + .nw-box{padding-top:44px}
:root main > .nw-about:last-child > :last-child{margin-bottom:0}
:root main > .nw-about:last-child{padding-bottom:9px}
:root .tool-guide:has(+ .ad-banner-footer), :root .tool-guide:has(+ script + .ad-banner-footer), :root .tool-guide:has(+ template + .ad-banner-footer), :root .tool-guide:has(+ script + script + .ad-banner-footer), :root main:has(+ .ad-banner-footer) > .tool-guide:last-child, :root main:has(+ script + .ad-banner-footer) > .tool-guide:last-child, :root main:has(+ template + .ad-banner-footer) > .tool-guide:last-child, :root main:has(+ script + script + .ad-banner-footer) > .tool-guide:last-child{padding-bottom:30px}
:root .list-section:has(+ .ad-banner-mid), :root .list-section:has(+ script + .ad-banner-mid), :root .list-section:has(+ template + .ad-banner-mid), :root .list-section:has(+ script + script + .ad-banner-mid){padding-bottom:15px}
/* FAQ: the divider line sits mid-gap, 22px above and below (18px on phones) */
:root .faq-section{margin-top:0;padding-top:22px}
:root .faq-section > h2:first-child{margin-top:0}
:root :is(.nw-box,.game-guide,.list-section,.wrap,.guides-hub):has(+ .faq-section), :root :is(.nw-box,.game-guide,.list-section,.wrap,.guides-hub):has(+ script + .faq-section), :root :is(.nw-box,.game-guide,.list-section,.wrap,.guides-hub):has(+ template + .faq-section), :root :is(.nw-box,.game-guide,.list-section,.wrap,.guides-hub):has(+ script + script + .faq-section){padding-bottom:22px;margin-bottom:0}
:root .game-guide:has(+ .faq-section){padding-bottom:11px}
:root :is(.nw-box,.game-guide,.list-section,.wrap) > :nth-last-child(1 of :not(script,style,template,[hidden])){margin-bottom:0}
:root .guides-hub:has(+ .faq-section){margin-bottom:0}

/* private-server pages: same joins as standard game pages (their sections carry ID-level margin rules) */
:root body:has(.game-hero.genre-private) :is(#server-profile,#wipe-history,#getting-started,#other-servers,#faq) > :nth-last-child(1 of :not(script,style,template,[hidden])){margin-bottom:0}
:root body:has(.game-hero.genre-private) .list-section{padding-bottom:16px}
:root body:has(.game-hero.genre-private) .list-section + .list-section{padding-top:28px}
:root body:has(.game-hero.genre-private) .list-section:has(+ .faq-section), .list-section:has(+ script + .faq-section), .list-section:has(+ template + .faq-section), .list-section:has(+ script + script + .faq-section){padding-bottom:22px}

@media (max-width:760px){
  :root main.ss-wrap{padding-bottom:22px}
  :root :is(.lg-body,.gd-layout,.gl-main,.cp-main,.tool-guide,.rh-main,.ri-main,.cmp-main,.rev-body,.faq-section,.list-section,.other-games):has(+ .ad-banner-footer), :root :is(.lg-body,.gd-layout,.gl-main,.cp-main,.tool-guide,.rh-main,.ri-main,.cmp-main,.rev-body,.faq-section,.list-section,.other-games):has(+ script + .ad-banner-footer), :root :is(.lg-body,.gd-layout,.gl-main,.cp-main,.tool-guide,.rh-main,.ri-main,.cmp-main,.rev-body,.faq-section,.list-section,.other-games):has(+ template + .ad-banner-footer), :root :is(.lg-body,.gd-layout,.gl-main,.cp-main,.tool-guide,.rh-main,.ri-main,.cmp-main,.rev-body,.faq-section,.list-section,.other-games):has(+ script + script + .ad-banner-footer){padding-bottom:28px}
  :root main:has(+ .ad-banner-footer) > :is(.faq-section,section.info):last-child, :root main:has(+ script + .ad-banner-footer) > :is(.faq-section,section.info):last-child, :root main:has(+ template + .ad-banner-footer) > :is(.faq-section,section.info):last-child, :root main:has(+ script + script + .ad-banner-footer) > :is(.faq-section,section.info):last-child{padding-bottom:28px}
  :root .vp-main, :root .vp-main:has(+ .tool-guide > .wrap-narrow > .rp-tip:first-child){padding-bottom:10px !important}
  :root .game-guide + .nw-box{padding-top:21px}
  :root div.wrap + .nw-box{padding-top:36px}
  :root main > .nw-about:last-child{padding-bottom:2px}
  :root .tool-guide:has(+ .ad-banner-footer), :root .tool-guide:has(+ script + .ad-banner-footer), :root .tool-guide:has(+ template + .ad-banner-footer), :root .tool-guide:has(+ script + script + .ad-banner-footer), :root main:has(+ .ad-banner-footer) > .tool-guide:last-child, :root main:has(+ script + .ad-banner-footer) > .tool-guide:last-child, :root main:has(+ template + .ad-banner-footer) > .tool-guide:last-child, :root main:has(+ script + script + .ad-banner-footer) > .tool-guide:last-child{padding-bottom:22px}
  :root .list-section:has(+ .ad-banner-mid), :root .list-section:has(+ script + .ad-banner-mid), :root .list-section:has(+ template + .ad-banner-mid), :root .list-section:has(+ script + script + .ad-banner-mid){padding-bottom:15px}
  :root .faq-section{padding-top:18px}
  :root :is(.nw-box,.game-guide,.list-section,.wrap,.guides-hub):has(+ .faq-section), :root :is(.nw-box,.game-guide,.list-section,.wrap,.guides-hub):has(+ script + .faq-section), :root :is(.nw-box,.game-guide,.list-section,.wrap,.guides-hub):has(+ template + .faq-section), :root :is(.nw-box,.game-guide,.list-section,.wrap,.guides-hub):has(+ script + script + .faq-section){padding-bottom:18px}
  :root .game-guide:has(+ .faq-section){padding-bottom:7px}
  :root body:has(.game-hero.genre-private) .list-section{padding-bottom:8px}
  :root body:has(.game-hero.genre-private) .list-section:has(+ .ad-banner-mid){padding-bottom:13px}
  :root body:has(.game-hero.genre-private) .list-section + .list-section{padding-top:28px}
  :root body:has(.game-hero.genre-private) .list-section:has(+ .faq-section), .list-section:has(+ script + .faq-section), .list-section:has(+ template + .faq-section), .list-section:has(+ script + script + .faq-section){padding-bottom:18px}
}
