/* Page around the browser build of the game. Same file in every Swoqy game. */
:root {
  --bg: #0B0C0E; --panel: #15181C; --line: #262B32; --ink: #EEF1F4; --muted: #8F99A3;
  --accent: #FF6B2C; --bar-h: 46px; --gap: 12px;
  --left-w: 0px; --right-w: 0px; --bottom-h: 0px; --mobile-h: 0px;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; background: var(--bg); color: var(--ink); overflow: hidden;
  font: 14px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
[hidden] { display: none !important; }

.sw-bar { height: var(--bar-h); display: flex; align-items: center; gap: 12px;
  padding: 0 max(14px, env(safe-area-inset-left)) 0 max(14px, env(safe-area-inset-right));
  border-bottom: 1px solid var(--line); background: #0F1114; }
.sw-back { color: var(--ink); text-decoration: none; font-weight: 800; font-size: 18px; letter-spacing: -.02em; }
.sw-back i { color: var(--accent); font-style: normal; }
.sw-name { color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.sw-spacer { flex: 1; }
.sw-btn { font: 600 13px system-ui, sans-serif; color: var(--ink); background: var(--panel); border: 1px solid var(--line);
  border-radius: 999px; padding: 6px 12px; text-decoration: none; cursor: pointer; white-space: nowrap; }
.sw-btn:hover { border-color: #3a414b; }
.sw-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.sw-pri { background: var(--accent); color: #111; border-color: transparent; padding: 10px 18px; font-size: 14px; }

/* Ads on: body gets .ads-on and the slot sizes below take effect. */
body.ads-on { --left-w: 160px; --right-w: 300px; --bottom-h: 90px; }
@media (max-width: 1279px) { body.ads-on { --left-w: 0px; } }
@media (max-width: 1023px) { body.ads-on { --right-w: 0px; } }
@media (max-width: 759px), (max-height: 520px) { body.ads-on { --bottom-h: 0px; --mobile-h: 50px; } }

.sw-stage { height: calc(100% - var(--bar-h) - var(--mobile-h)); display: grid; gap: var(--gap);
  grid-template-columns: var(--left-w) minmax(0, 1fr) var(--right-w); padding: var(--gap); }
.sw-ad-left { grid-column: 1; }
.sw-center { grid-column: 2; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: var(--gap); min-width: 0; min-height: 0; }
/* The game keeps the phone's landscape shape (about 2.1 : 1) and takes all
   the room left between the ads. */
.sw-game { position: relative; width: min(100%, calc((100dvh - var(--bar-h) - var(--mobile-h) - var(--bottom-h) - 3 * var(--gap)) * 2.1));
  aspect-ratio: 2.1 / 1; max-height: 100%; background: #000; border-radius: 10px; overflow: hidden; }
/* Portrait games (body.sw-portrait) keep a tall shape instead: at most
   3 : 4, so on a desktop the board stays a column and on a phone held upright
   it fills the screen. */
body.sw-portrait .sw-center { flex: 1; }
body.sw-portrait .sw-game { aspect-ratio: auto; flex: 1; min-height: 0;
  width: min(100%, calc((100dvh - var(--bar-h) - var(--mobile-h) - var(--bottom-h) - 3 * var(--gap)) * 0.75)); }
/* Games that fit either way (body.sw-any) take all the room between the ads. */
body.sw-any .sw-center { flex: 1; }
body.sw-any .sw-game { aspect-ratio: auto; flex: 1; min-height: 0; width: 100%; }
.sw-loading { position: absolute; inset: 0; display: grid; place-content: center; justify-items: center; gap: 12px; color: var(--muted); }
.sw-spin { width: 28px; height: 28px; border: 3px solid var(--line); border-top-color: var(--accent); border-radius: 50%; animation: sw-spin 1s linear infinite; }
@keyframes sw-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .sw-spin { animation: none; } }

.sw-ad { display: none; overflow: hidden; }
body.ads-on .sw-ad { display: block; }
.sw-ad-left { width: 160px; height: 600px; max-height: 100%; }
.sw-ad-right { grid-column: 3; display: flex; flex-direction: column; gap: var(--gap); min-height: 0; }
.sw-ad-r1 { width: 300px; height: 250px; }
.sw-ad-r2 { width: 300px; height: 600px; max-height: calc(100% - 250px - var(--gap)); }
.sw-ad-bottom { width: 728px; max-width: 100%; height: 90px; flex: none; }
.sw-ad-mobile { position: fixed; left: 50%; bottom: 0; transform: translateX(-50%); width: 320px; height: 50px; }
@media (max-width: 1279px) { body.ads-on .sw-ad-left { display: none; } }
@media (max-width: 1023px) { .sw-ad-right { display: none; } }
@media (max-width: 759px), (max-height: 520px) { body.ads-on .sw-ad-bottom { display: none; } }
@media (min-width: 760px) and (min-height: 521px) { body.ads-on .sw-ad-mobile { display: none; } }

/* Phones held sideways: no bar, the game gets the full height. */
@media (max-height: 520px) {
  :root { --bar-h: 0px; --gap: 6px; }
  .sw-bar { display: none; }
}
@media (max-width: 600px) { .sw-hide-sm { display: none; } }

body.sw-full { --bar-h: 0px; }
body.sw-full .sw-bar { display: none; }

.sw-overlay { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; padding: 20px;
  background: rgba(6, 7, 9, .82); backdrop-filter: blur(4px); }
.sw-card { background: var(--panel); border: 1px solid var(--line); border-radius: 16px; padding: 22px 24px; max-width: 460px; width: 100%; }
.sw-card h2 { margin: 0 0 8px; font-size: 22px; letter-spacing: -.01em; }
.sw-card p { margin: 0 0 12px; color: var(--muted); }
.sw-card ol { margin: 0 0 18px; padding-left: 20px; color: var(--muted); }
.sw-rot-ico { width: 46px; height: 28px; border: 3px solid var(--ink); border-radius: 6px; margin: 0 auto 14px; animation: sw-rot 2.2s ease-in-out infinite; }
@keyframes sw-rot { 0%, 30% { transform: rotate(90deg); } 60%, 100% { transform: rotate(0deg); } }
#sw-rotate .sw-card { text-align: center; }
#sw-rotate p { margin: 0; color: var(--ink); }

#sw-bait { position: absolute; left: -9999px; top: -9999px; width: 1px; height: 1px; }

/* House ads: Swoqy promotions shown in the ad slots until an ad network is set. */
.sw-house-slot { border-radius: 12px; }
.sw-house { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px;
  width: 100%; height: 100%; padding: 16px; text-align: center; text-decoration: none; color: var(--ink);
  background: linear-gradient(160deg, #1B2129, #111418); border: 1px solid var(--line); border-radius: 12px; }
.sw-house:hover { border-color: #3a414b; }
.sw-house:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.sw-house img { width: 64px; height: 64px; border-radius: 16px; flex: none; }
.sw-house-txt { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.sw-house-txt b { font-size: 16px; }
.sw-house-txt small { color: var(--muted); font-size: 12px; }
.sw-house-note { color: var(--muted); font-size: 12px; margin-top: 4px; }
.sw-house-cta { background: #2EE6A6; color: #0B0C0E; font-weight: 700; font-size: 13px; padding: 8px 14px; border-radius: 999px; }
.sw-house-tag { position: absolute; top: 6px; right: 8px; font-size: 10px; letter-spacing: .06em; text-transform: uppercase; color: #5d6670; }
.sw-house-left .sw-house img { width: 72px; height: 72px; }
.sw-house-left .sw-house-cta { font-size: 12px; padding: 8px 10px; }
.sw-house-bottom .sw-house, .sw-house-mobile .sw-house { flex-direction: row; justify-content: flex-start; text-align: left; padding: 8px 14px; gap: 12px; }
.sw-house-bottom .sw-house-txt, .sw-house-mobile .sw-house-txt { flex: 1; }
.sw-house-bottom img { width: 56px; height: 56px; border-radius: 12px; }
.sw-house-mobile .sw-house { padding: 4px 8px; gap: 8px; border-radius: 8px; }
.sw-house-mobile img { width: 34px; height: 34px; border-radius: 8px; }
.sw-house-mobile .sw-house-txt b { font-size: 13px; }
.sw-house-mobile .sw-house-txt small, .sw-house-mobile .sw-house-tag { display: none; }
.sw-house-mobile .sw-house-cta { font-size: 11px; padding: 5px 9px; }

/* AdSense: the unit sits over the house promotion and shows once filled. */
.sw-house-slot { position: relative; }
.sw-house-slot .sw-ins { position: absolute; inset: 0; margin: auto; visibility: hidden; }
.sw-house-slot.sw-filled .sw-ins { visibility: visible; }
/* An unfilled AdSense slot still holds a white iframe; keep it (and its children) hidden so the promotion shows. */
.sw-house-slot:not(.sw-filled) .sw-ins, .sw-house-slot:not(.sw-filled) .sw-ins * { visibility: hidden !important; }
.sw-house-slot.sw-filled .sw-house { visibility: hidden; }

/* Store screenshot mode (?open=…): the game alone, full page. */
body.sw-bare { --bar-h: 0px; --gap: 0px; }
body.sw-bare .sw-bar, body.sw-bare .sw-ad, body.sw-bare .sw-ad-right { display: none !important; }
body.sw-bare .sw-stage { grid-template-columns: 0 minmax(0, 1fr) 0; padding: 0; }
body.sw-bare .sw-game { width: 100%; height: 100%; border-radius: 0; flex: 1; aspect-ratio: auto; }
