/* Ad layout for the game page (index.html).
   Wide screens (>= 1200px): a 160x600 panel on each side of the game.
   Narrower screens: a banner fixed at the bottom, below the game.
   #app (the game area) is shrunk to leave room, so ads never sit under the tap-anywhere area. */

:root { --ad-side: 0px; --ad-bottom: 0px; }

#app {
  position: fixed;
  top: 0;
  left: var(--ad-side);
  right: var(--ad-side);
  bottom: var(--ad-bottom);
  overflow: hidden;
}

/* "Advertisement" label shared by all slots */
.ad-rail::before, .ad-bottom::before, .ad-inline::before {
  content: "Advertisement";
  display: block;
  color: var(--muted);
  font-size: 0.65rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  text-align: center;
  line-height: 1;
  margin-bottom: 4px;
}

/* ---------- Side panels ---------- */
.ad-rail { display: none; }
@media (min-width: 1200px) {
  /* 160px ad + 20px space on each side of it */
  :root { --ad-side: 200px; }
  .ad-rail {
    position: fixed;
    top: 0;
    bottom: 0;
    width: var(--ad-side);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    overflow: hidden;
  }
  .ad-rail-left { left: 0; }
  .ad-rail-right { right: 0; }
}
.ad-unit-rail { display: inline-block; width: 160px; height: 600px; }

/* ---------- Bottom banner (phones and mid-size screens) ---------- */
.ad-bottom { display: none; }
@media (max-width: 1199px) {
  /* banner height + label + 12px gap above it (separates it from the tap area) + bottom padding */
  :root { --ad-bottom: calc(50px + 34px + env(safe-area-inset-bottom)); }
  .ad-bottom {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    height: var(--ad-bottom);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    padding: 12px 0 env(safe-area-inset-bottom);
    border-top: 1px solid var(--surface-line);
    background: var(--bg);
    overflow: hidden;
  }
}
.ad-unit-bottom { display: inline-block; width: 320px; height: 50px; }
@media (min-width: 500px) and (max-width: 1199px) {
  :root { --ad-bottom: calc(60px + 34px + env(safe-area-inset-bottom)); }
  .ad-unit-bottom { width: 468px; height: 60px; }
}
@media (min-width: 768px) and (max-width: 1199px) {
  :root { --ad-bottom: calc(90px + 34px + env(safe-area-inset-bottom)); }
  .ad-unit-bottom { width: 728px; height: 90px; }
}

/* Game-over screens (run summary, duel results) already show their own ad, so the bottom banner
   is hidden there and the game area takes the full height. :root.game-over beats the rules above. */
:root.game-over { --ad-bottom: 0px; }
.game-over .ad-bottom { display: none; }

/* ---------- Between-games ads (run summary, duel results) ---------- */
.ad-inline { width: 100%; display: flex; flex-direction: column; align-items: center; margin: 16px 0 0; }
.ad-unit-ingame { display: inline-block; width: 320px; height: 100px; }
@media (min-width: 500px) { .ad-unit-ingame { width: 468px; height: 60px; } }
@media (min-width: 768px) { .ad-unit-ingame { width: 728px; height: 90px; } }
/* The summary screens stack the card and the ad. */
#summary, #duel-summary { align-content: center; }

/* Localhost / file:// preview: outline empty slots so the layout is visible before ads are approved. */
.ads-preview ins.adsbygoogle:not([data-ad-status="filled"]) {
  outline: 1px dashed var(--muted);
  outline-offset: -1px;
  background: var(--surface);
}

/* ---------- Content pages (How to play, About, Articles, Privacy, Contact) ---------- */
/* Side panels on wide screens: the page content sits between them, like the game. */
@media (min-width: 1200px) {
  body.content-page { padding-left: var(--ad-side); padding-right: var(--ad-side); }
}
.ad-inpage { margin: 28px 0; }
.ad-unit-inpage { display: block; width: 100%; min-height: 100px; }
