/* Shared layout for the game pages (generated by tools/pages.mjs).
   Per-page values (colors, game size, frame) are CSS variables set in each page's <head>. */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; overflow-y: scroll; }   /* (review fix 2026-11-28: the scrollbar's room kept from the start - the game is sized at load, and a scrollbar that came later, with the ad, made the page scroll sideways; phones: html.mobile-play below) */
body { margin: 0; background: var(--page-bg, #000); font: 11px Verdana, sans-serif; }
img { border: 0; }

/* ---------------------------------------------------------------- header
   The 760x74 top bar scales down on narrow screens; the link areas and the house
   banner are positioned in % of the bar, so they stay aligned at any size. */
.topbar {
  position: relative;
  width: 760px;
  max-width: calc(100% - 16px);
  margin: 12px auto;
  aspect-ratio: 760 / 74;
}
.topbar > img { display: block; width: 100%; height: 100%; }
.topbar .hot { position: absolute; }
.topbar .home  { left: 0.13%;  top: 1.35%;  width: 36.45%; height: 58.1%; }
.topbar .games { left: 2.63%;  top: 59.46%; width: 12.89%; height: 40.54%; }
.topbar .store { left: 15.53%; top: 59.46%; width: 9.87%;  height: 40.54%; }
.topbar .share { left: 25.39%; top: 59.46%; width: 10.66%; height: 40.54%; }
/* the banner rotator (shelf/shelf.js; author request 2026-11-26): two pictures on top of each other, the
   next one fading in over the current one; any banner size fits the 468 x 60 spot without stretching (author fix 2026-11-26: 468, was 460) */
.topbar .shelf { position: absolute; left: 37.5%; top: 9.46%; width: 61.58%; aspect-ratio: 468 / 60; }
.topbar .shelf img { position: absolute; left: 0; top: 0; width: 100%; height: 100%; object-fit: contain; transition: opacity .6s; }
.topbar .shelf img.next { opacity: 0; pointer-events: none; }

/* ---------------------------------------------------------------- game + ads
   Three columns: the game sits in the middle column, so it is always centered in the
   window; each side ad hugs the game with the same gap on both sides. */
.stage {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: start;
  padding: 0 16px 40px;
}
.stage.flanked { column-gap: 150px; }   /* keep ads at least 150px from the game */
.stage > .game { grid-column: 2; min-width: 0; text-align: center; }
.side-ad { display: none; width: 160px; min-height: 600px; }
.flanked > .side-ad { display: block; }
/* whatever ends up in a side slot (an ad, or a blocked ad's leftover frame) stays within the
   slot's 160px, so the layout stays symmetric and nothing pushes past the window edge */
.side-ad { overflow: hidden; }
.side-ad ins, .side-ad iframe, .side-ad > * { max-width: 160px !important; }
.side-ad.left  { grid-column: 1; justify-self: end; }
.side-ad.right { grid-column: 3; justify-self: start; }

/* game box: fixed size on desktop, scales down to fit narrow screens */
#content {
  box-sizing: content-box;
  margin: 0 auto;
  width: var(--game-w);
  max-width: calc(100vw - 32px - 2 * var(--frame-w) - 2 * var(--pad));
  aspect-ratio: var(--game-ar);
  padding: var(--pad);
  border: var(--frame);
  background: var(--game-bg);
}
#content > embed,
#content > object,
#content > iframe,
#content > ruffle-embed,
#content > ruffle-object { display: block; width: 100%; height: 100%; border: 0; }

/* fullscreen: the game box fills the screen; ports and Ruffle both letterbox inside it */
.game-tools { margin-top: 8px; }
.fs-btn, .share-btn, .follow-btn { font: 12px Verdana, sans-serif; padding: 4px 12px; border: 1px solid var(--tool-line, currentColor); border-radius: 4px; background: transparent; color: var(--tool, #666); cursor: pointer; opacity: var(--tool-op, .75); font-weight: var(--tool-weight, normal); }
/* (author request 2026-11-29) the "Follow" link to the X account looks like the two buttons beside it */
.follow-btn { display: inline-block; text-decoration: none; line-height: normal; }
.fs-btn:hover, .share-btn:hover, .follow-btn:hover { opacity: 1; }
body.dark .fs-btn, body.dark .share-btn, body.dark .follow-btn { color: var(--tool, #bbb); }
.share-ico, .fs-ico, .follow-ico { width: 11px; height: 11px; vertical-align: -1px; }
#content:fullscreen { width: 100vw !important; height: 100vh; max-width: none; aspect-ratio: auto; padding: 0; border: 0; }
#content:-webkit-full-screen { width: 100vw !important; height: 100vh; max-width: none; aspect-ratio: auto; padding: 0; border: 0; }

.extras { margin-top: 16px; }
.extras img { max-width: 100%; height: auto; vertical-align: middle; }
.extras .credit { display: inline-block; margin: 0; padding: 10px 16px; }

/* (author request 2026-11-27) under the game: its name, how to play, more games (pages.mjs "about") */
/* (the text under each game - shown only with pages.mjs SHOW_ABOUT, off since 2026-11-28) */
.about { max-width: 640px; margin: 28px auto 0; padding: 0 12px; color: #777; font: 12px/1.6 Verdana, sans-serif; }
body.dark .about { color: #aaa; }
.about h1 { margin: 0 0 4px; font: bold 15px/1.4 Verdana, sans-serif; color: inherit; }
.about p { margin: 0 0 4px; }
.about .by { font-size: 11px; }
.about a { color: var(--tool, #888); }
.about h2 { margin: 16px 0 6px; font: 10px Verdana, sans-serif; text-transform: uppercase; letter-spacing: 1px; color: inherit; }
.about ul { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; justify-content: center; gap: 4px 16px; }
html.mobile-play .about { display: none !important; }
.bottom-ad { margin: 150px auto 0; width: 100%; max-width: 970px; }
.bottom-ad:empty { display: none; }

/* ---------------------------------------------------------------- phones and tablets
   (author request 2026-11-16) On touch screens (html.mobile-play, set in each page's <head>) the
   game fills the screen: no top bar, buttons or ads, the game box covering the window (the game
   letterboxes inside it). The first tap also asks for real fullscreen where the browser allows it.
   When the screen is the wrong way round for the game, .rotate-msg asks to turn the device. */
html.mobile-play, html.mobile-play body { height: 100%; overflow: hidden; overscroll-behavior: none; }
/* (author report 2026-11-24: a long press selected the game like text) nothing to select or long-press on
   the playing page; the game frame does the same inside (flash.js) */
html.mobile-play body { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; -webkit-tap-highlight-color: transparent; }
html.mobile-play input, html.mobile-play textarea { -webkit-user-select: text; user-select: text; -webkit-touch-callout: default; }
html.mobile-play body { background: var(--game-bg); }
html.mobile-play .topbar, html.mobile-play .game-tools, html.mobile-play .extras,
html.mobile-play .bottom-ad, html.mobile-play .side-ad { display: none !important; }
html.mobile-play .stage { display: block; padding: 0; }
html.mobile-play #content {
  position: fixed; inset: 0; z-index: 1;
  width: 100vw !important; height: 100vh; height: 100dvh; max-width: none;
  aspect-ratio: auto; padding: 0; border: 0; margin: 0; touch-action: none;
}
.rotate-msg {
  position: fixed; inset: 0; z-index: 5; display: flex; flex-direction: column; align-items: center; justify-content: center;
  background: var(--game-bg); color: #888; font: 15px Verdana, sans-serif; text-align: center; padding: 24px; cursor: pointer;
}
.rotate-msg[hidden] { display: none; }
body.dark .rotate-msg { color: #bbb; }
.rotate-msg svg { width: 72px; height: 72px; margin-bottom: 18px; }
.rotate-msg .rotate-phone { transform-origin: 32px 32px; animation: os-rotate 2.4s ease-in-out infinite; }
/* the phone turns from the wrong way (--from) to the right way (--to) for the game, and back */
@keyframes os-rotate { 0%, 25% { transform: rotate(var(--from, 0deg)); } 50%, 75% { transform: rotate(var(--to, -90deg)); } 100% { transform: rotate(var(--from, 0deg)); } }
