/* Swoqy web shell: frames a portrait Flutter game with ad rails (skill 14.3). */
:root {
  --sw-bg: #F7FAFF;
  --sw-ink: #0F172A;
  --sw-muted: #475569;
  --sw-accent: #2563EB;
  --sw-accent-ink: #FFFFFF;
  --sw-card: #FFFFFF;
  --sw-line: #DBE4F3;
  --sw-top: 52px;
  --sw-gap: 16px;
  /* Portrait game frame: width = height x ratio. */
  --sw-ratio: 0.5;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--sw-bg);
  color: var(--sw-ink);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", sans-serif;
  -webkit-text-size-adjust: 100%;
}

a { color: var(--sw-accent); }

/* ---------------------------------------------------------------- header */
.sw-top {
  height: var(--sw-top);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 0 var(--sw-gap);
  border-bottom: 1px solid var(--sw-line);
  background: var(--sw-card);
}

.sw-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--sw-ink);
  text-decoration: none;
  font-weight: 700;
  min-width: 0;
}

.sw-brand img { width: 32px; height: 32px; border-radius: 8px; }
.sw-brand small { color: var(--sw-muted); font-weight: 500; }

.sw-getapp {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: 0 18px;
  border-radius: 999px;
  background: var(--sw-accent);
  color: var(--sw-accent-ink);
  font-weight: 700;
  text-decoration: none;
  white-space: nowrap;
}

/* ----------------------------------------------------------------- stage */
.sw-stage {
  display: flex;
  justify-content: center;
  align-items: flex-start;
  gap: var(--sw-gap);
  padding: 8px var(--sw-gap) 0;
}

.sw-game-wrap { flex: 0 1 auto; min-width: 0; }

.sw-game {
  position: relative;
  height: calc(100vh - var(--sw-top) - 16px);
  height: calc(100dvh - var(--sw-top) - 16px);
  width: calc((100vh - var(--sw-top) - 16px) * var(--sw-ratio));
  width: calc((100dvh - var(--sw-top) - 16px) * var(--sw-ratio));
  max-width: calc(100vw - 2 * var(--sw-gap));
  min-height: 480px;
  overflow: hidden;
  border-radius: 18px;
  background: var(--sw-bg);
  box-shadow: 0 8px 30px rgba(15, 23, 42, 0.12);
}

.sw-loading {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.sw-loading::after {
  content: "";
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 4px solid var(--sw-line);
  border-top-color: var(--sw-accent);
  animation: sw-spin 0.9s linear infinite;
}

.sw-game-ready .sw-loading { display: none; }

@keyframes sw-spin { to { transform: rotate(360deg); } }

/* ------------------------------------------------------------------ rails */
.sw-rail {
  display: none;
  flex: 0 0 auto;
  flex-direction: column;
  gap: var(--sw-gap);
  position: sticky;
  top: 8px;
}

.sw-rail-left { width: 160px; }
.sw-rail-right { width: 300px; }

.sw-bottom {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--sw-gap);
  padding: var(--sw-gap);
}

[data-slot="bottom"] { display: none; }
[data-slot="mobile"] { display: block; }

/* ------------------------------------------------------------------ slots */
.sw-house-slot {
  position: relative;
  overflow: hidden;
  border-radius: 12px;
  background: var(--sw-card);
  border: 1px solid var(--sw-line);
}

.sw-house {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 12px;
  text-align: center;
  color: var(--sw-ink);
  text-decoration: none;
  font-weight: 600;
  line-height: 1.25;
}

.sw-house img { border-radius: 12px; }

.sw-house-cta {
  padding: 8px 14px;
  border-radius: 999px;
  background: var(--sw-accent);
  color: var(--sw-accent-ink);
  font-size: 14px;
}

[data-slot="mobile"] .sw-house,
[data-slot="bottom"] .sw-house { flex-direction: row; }
[data-slot="mobile"] .sw-house img { width: 32px; height: 32px; }

.sw-ins { position: relative; z-index: 1; }

/* An unfilled AdSense slot leaves a white iframe over the house promo. */
.sw-house-slot:not(.sw-filled) .sw-ins,
.sw-house-slot:not(.sw-filled) .sw-ins * { visibility: hidden !important; }

.sw-adblock-note { display: none; }

.sw-adblock .sw-adblock-note {
  display: block;
  position: absolute;
  left: 8px;
  right: 8px;
  bottom: 8px;
  margin: 0;
  font-size: 12px;
  color: var(--sw-muted);
  text-align: center;
}

[data-slot="mobile"] .sw-adblock-note,
[data-slot="bottom"] .sw-adblock-note { display: none !important; }

/* ----------------------------------------------------------------- footer */
.sw-footer {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px 18px;
  padding: 8px var(--sw-gap) 32px;
  color: var(--sw-muted);
  font-size: 14px;
}

.sw-getapp-block {
  display: none;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 8px var(--sw-gap) 0;
  text-align: center;
}

/* ----------------------------------------------------------- breakpoints */

/* Tablets and small laptops: centred game, 728x90 below it. */
@media (min-width: 760px) {
  [data-slot="bottom"] { display: block; }
  [data-slot="mobile"] { display: none; }
}

/* Desktop: 160x600 on the left, 300x250 + 300x600 on the right. */
@media (min-width: 1080px) and (min-height: 640px) {
  .sw-rail { display: flex; }
}

/* Phones: full-bleed game; promo, ad and footer below the fold. */
@media (max-width: 759px), (max-height: 520px) {
  :root { --sw-top: 0px; }
  .sw-top { display: none; }
  .sw-stage { padding: 0; }
  .sw-game {
    width: 100vw;
    max-width: 100vw;
    height: 100vh;
    height: 100dvh;
    min-height: 0;
    border-radius: 0;
    box-shadow: none;
  }
  .sw-getapp-block { display: flex; }
}

/* ---------------------------------------------------------- special modes */
.sw-ad-playing .sw-game { pointer-events: none; }

.sw-bare .sw-top,
.sw-bare .sw-rail,
.sw-bare .sw-bottom,
.sw-bare .sw-getapp-block,
.sw-bare .sw-footer { display: none !important; }

.sw-bare .sw-stage { padding: 0; }

.sw-bare .sw-game {
  width: 100vw;
  max-width: 100vw;
  height: 100vh;
  height: 100dvh;
  min-height: 0;
  border-radius: 0;
  box-shadow: none;
}
