/* ADS (21 Nov 2026) — where the units web/src/ads.js places go, and how
   they look. The reasons are in ads.js; tests/test_ads.js holds both. */
.ad-slot{box-sizing:border-box;text-align:center}

/* UNDER THE GAME, ABOVE THE GUIDE. 8px below the end of the screen, which
   already keeps its own 23-34px under its last control. The owner, 23 Nov
   2026: "By getting rid of the layer between the background and the gameplay,
   the ads underneath the games can come up higher and be closer to the bottom
   of the game, especially atless." The width of a leaderboard unit on a
   computer, the screen's on a phone.
   ITS ROOM IS HELD BEFORE GOOGLE FILLS IT (21 Nov 2026): the height the unit
   most often comes in, a 728x90 on a computer and a 300x250 on a phone, so an
   ad arriving does not push the guide under it down. A taller ad still pushes
   it by the difference; a unit Google leaves unfilled, or a page Google's
   script never reached (html.ads-off, ads.js), gives the room back. */
.ad-bottom{max-width:760px;min-height:90px;margin:8px auto 0;padding:0 16px}
@media (max-width:980px){
  .ad-bottom{max-width:none;min-height:250px;margin:8px 0 0;padding:0}
}

/* THE SIDE ADS AT THE EDGES OF THE WINDOW, THE SCREEN BETWEEN THEM (23 Nov
   2026). The owner: "push the vertical side ads all the way to the edges of
   the display and extend the top bar to the left and right edges and extend
   the bar background to the ads."

   --ad-rail is how wide a side ad is at this window, 0 where there are none:
   120px from a 1271px window, 160px from 1655px, 300px from 1951px, and only
   on a page that carries Google's ad code (the :has(); the server leaves the
   code out of empty screens and the no-ads accounts' pages). DECIDED HERE, SO
   IT IS THERE FROM THE FIRST PAINT: nothing moves when ads.js arrives, which
   reads this and places the units.

   THE SCREEN'S COLUMN. Everything in the frame but the top bar (#authbar; the
   Hall of Fame's .topbar) is drawn between the ads and never wider than
   --screen-max, the 1240px the card used to be (1720px in a live room,
   gauntletlive.css). --room-x is the same inset for the tap room's grounds,
   which run past it to the window's edges (taproom.css). */
:root{--ad-rail:0px;--screen-max:1240px;
  --room-x:max(var(--ad-rail), calc((100vw - var(--screen-max)) / 2))}
@media (min-width:1271px){ html:has(> head > script[src*="googlesyndication.com/pagead/js/adsbygoogle.js"]){--ad-rail:120px} }
@media (min-width:1655px){ html:has(> head > script[src*="googlesyndication.com/pagead/js/adsbygoogle.js"]){--ad-rail:160px} }
@media (min-width:1951px){ html:has(> head > script[src*="googlesyndication.com/pagead/js/adsbygoogle.js"]){--ad-rail:300px} }
@media (min-width:1241px){
  .wrap > :not(#authbar):not(.topbar){
    margin-left:max(var(--ad-rail), calc((100% - var(--screen-max)) / 2));
    margin-right:max(var(--ad-rail), calc((100% - var(--screen-max)) / 2))}
}
/* The footer keeps clear of a side ad on a page short enough to reach it. */
body > .cdev-foot{margin-left:var(--ad-rail);margin-right:var(--ad-rail)}

/* THE RAILS, flush with the window's edges and straight under the top bar
   (ads.js sets the top), scrolling with the page: 160px, 120px where only that
   fits, 300px on a very wide window. */
.ad-rail{position:absolute;z-index:1;width:160px;display:none}
.ad-rail-left{left:0}
.ad-rail-right{right:0}
.ad-rail-narrow{width:120px}
.ad-rail-wide{width:300px}
@media (max-width:980px){
  .ad-rail{display:none !important}
}

/* ROOM FOR GOOGLE'S ANCHOR AD at the foot of a phone's screen (ads.js keeps
   --ad-anchor, its height, and --ad-clear, the gap over it, while one is up):
   the end of the page scrolls clear of both. */
html{padding-bottom:calc(var(--ad-anchor, 0px) + var(--ad-clear, 0px))}
/* AND THE POP-UPS STAND ON IT (23 Nov 2026). The anchor is drawn over everything
   on the page, a full-window dialog included, so a dialog's own buttons would
   otherwise end up under it on a short phone. The gap is a clear border: the
   dimmed backdrop runs down to the ad, and what scrolls inside stops above it. */
html .modal-bg,html .gg-howover,html .hl-over,html .lvlup-back,html #playerModal{
  bottom:var(--ad-anchor, 0px);border-bottom:var(--ad-clear, 0px) solid transparent}
/* The marked bar a copy that is not the site shows in its place (ads.js), as
   high in the stacking order as Google's own, so a review shows what it covers. */
.ad-anchor-ph{position:fixed;left:0;right:0;bottom:0;z-index:2147483000;height:62px;
  display:flex;align-items:center;justify-content:center;gap:10px;box-sizing:border-box;
  background:var(--panel, #fff);border-top:2px dashed var(--text-soft, var(--muted-2, currentColor));
  color:var(--text-soft, var(--muted-2, currentColor));font-size:12px;font-weight:700;
  box-shadow:0 -6px 18px rgba(0,0,0,.18)}
.ad-anchor-x{position:absolute;top:-22px;right:10px;width:34px;height:22px;
  display:flex;align-items:center;justify-content:center;border-radius:8px 8px 0 0;
  background:var(--panel, #fff);font-size:14px}

/* NOT WHILE A LINK IS OPENING (base.css html.deep-boot): the frame is nearly
   empty then, and the bottom unit would show at the top of the screen. NOR,
   the bottom unit, UNTIL THE SCREEN HAS SETTLED (core.js footSettle,
   html.foot-wait): a screen drawn just after the hold lifts would otherwise
   push it down in sight — the guide and the footer wait the same way
   (base.css). */
html.deep-boot .ad-slot, html.foot-wait #adBottom{visibility:hidden}

/* A UNIT GOOGLE HAD NOTHING FOR TAKES NO ROOM: AdSense marks it
   data-ad-status="unfilled". Nor does any unit on a page Google's script
   never reached (a blocker, a network that drops it): ads.js marks the page
   html.ads-off, and the room held for the bottom unit is given back. */
.ad-slot:has(> ins.adsbygoogle[data-ad-status="unfilled"]){display:none}
html.ads-off .ad-slot{display:none}

/* THE MARKED BOXES a copy that is not the site draws instead (ads.js). */
.ad-ph{display:flex;align-items:center;justify-content:center;box-sizing:border-box;
  border:2px dashed var(--text-soft, var(--muted-2, currentColor));border-radius:10px;
  color:var(--text-soft, var(--muted-2, currentColor));
  font-size:12px;font-weight:700;padding:8px;opacity:.75}
.ad-bottom .ad-ph{height:90px}
.ad-rail .ad-ph{height:600px}
@media (max-width:980px){
  .ad-bottom .ad-ph{height:250px;margin:0 16px}
}
