:root {
  --bg0: #1a0b2e;
  --bg1: #2d1b4e;
  --ink: #fff8f0;
  --muted: #d8c8e8;
  --card: rgba(255, 255, 255, 0.1);
  --stroke: rgba(255, 255, 255, 0.18);
  --sticky-ad-h: 0px;
  --accent: #ff9f1c;
  --radius: 22px;
  --font: "Fredoka", "Nunito", system-ui, sans-serif;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100%;
  font-family: var(--font);
  color: var(--ink);
  background:
    radial-gradient(1200px 600px at 10% -10%, #5b2d8e 0%, transparent 55%),
    radial-gradient(900px 500px at 100% 0%, #e85d4c 0%, transparent 45%),
    linear-gradient(165deg, #1a0b2e 0%, #24143f 45%, #12263f 100%);
  padding-bottom: calc(24px + var(--sticky-ad-h));
  overflow-x: hidden;
}

a {
  color: inherit;
  text-decoration: none;
}

.bg-blobs {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}

.blob {
  position: absolute;
  border-radius: 50%;
  filter: blur(40px);
  opacity: 0.35;
  animation: floaty 12s ease-in-out infinite;
}

.blob.b1 {
  width: 280px;
  height: 280px;
  background: #ff6b9d;
  top: 10%;
  left: -60px;
}

.blob.b2 {
  width: 320px;
  height: 320px;
  background: #4cc9f0;
  right: -80px;
  top: 40%;
  animation-delay: -4s;
}

.blob.b3 {
  width: 240px;
  height: 240px;
  background: #fee440;
  bottom: 8%;
  left: 30%;
  animation-delay: -7s;
}

@keyframes floaty {
  0%,
  100% {
    transform: translateY(0) scale(1);
  }
  50% {
    transform: translateY(-24px) scale(1.05);
  }
}

.site-header,
.site-main,
.site-footer {
  position: relative;
  z-index: 1;
}

.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px clamp(16px, 4vw, 40px);
  gap: 16px;
}

.logo {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 1.25rem;
}

.logo-mark {
  width: 36px;
  height: 36px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, #ff9f1c, #f72585);
  box-shadow: 0 8px 20px rgba(247, 37, 133, 0.35);
}

.nav {
  display: flex;
  gap: 16px;
  font-weight: 700;
}

.nav a {
  opacity: 0.85;
}

.nav a:hover {
  opacity: 1;
}

.site-main {
  width: min(1120px, calc(100% - 32px));
  margin: 0 auto;
}

.hero {
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  gap: 28px;
  align-items: center;
  padding: 20px 0 36px;
}

.eyebrow {
  display: inline-block;
  padding: 6px 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.hero-brand {
  margin: 12px 0 8px;
  font-size: clamp(2.8rem, 9vw, 4.8rem);
  line-height: 0.95;
  letter-spacing: -0.03em;
  background: linear-gradient(115deg, #fff6e0 10%, #ffc14a 40%, #ff6b9d 70%, #4cc9f0 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.hero-line {
  margin: 0;
  font-size: clamp(1.2rem, 3vw, 1.55rem);
  font-weight: 700;
}

.hero-sub {
  color: var(--muted);
  margin: 8px 0 20px;
  max-width: 36ch;
}

.hero-cta {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.hero-stage {
  position: relative;
  min-height: 260px;
  display: grid;
  place-items: center;
}

.hero-orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(2px);
  animation: floaty 7s ease-in-out infinite;
}

.hero-orb.o1 {
  width: 120px;
  height: 120px;
  background: #ff9f1c;
  top: 20px;
  left: 20px;
}

.hero-orb.o2 {
  width: 90px;
  height: 90px;
  background: #4cc9f0;
  right: 30px;
  top: 50px;
  animation-delay: -2s;
}

.hero-orb.o3 {
  width: 70px;
  height: 70px;
  background: #f72585;
  bottom: 40px;
  left: 40%;
  animation-delay: -3.5s;
}

.hero-card {
  position: relative;
  width: min(220px, 70%);
  aspect-ratio: 1;
  border-radius: 28px;
  display: grid;
  place-items: center;
  text-align: center;
  font-size: 2rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  background: linear-gradient(160deg, #ff9f1c, #f72585 55%, #7b2cbf);
  box-shadow:
    0 20px 50px rgba(0, 0, 0, 0.35),
    inset 0 2px 0 rgba(255, 255, 255, 0.35);
  transform: rotate(-6deg);
  animation: cardTilt 5s ease-in-out infinite;
}

@keyframes cardTilt {
  0%,
  100% {
    transform: rotate(-6deg) translateY(0);
  }
  50% {
    transform: rotate(-2deg) translateY(-8px);
  }
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: none;
  cursor: pointer;
  font: inherit;
  font-weight: 800;
  border-radius: 999px;
  padding: 14px 22px;
  transition:
    transform 0.15s ease,
    box-shadow 0.15s ease;
}

.btn:active {
  transform: scale(0.97);
}

.btn-primary {
  background: linear-gradient(135deg, #ffc14a, #ff6b9d);
  color: #1a0b2e;
  box-shadow: 0 10px 24px rgba(255, 107, 157, 0.35);
}

.btn-halloween {
  background: linear-gradient(135deg, #ff6b00, #9b2226 55%, #3c096c);
  color: #fff8e7;
  box-shadow: 0 12px 28px rgba(255, 107, 0, 0.4);
  font-weight: 800;
}

.eyebrow--spook {
  background: rgba(255, 107, 0, 0.25);
  border: 1px solid rgba(255, 180, 80, 0.45);
}

.hero-brand--spook {
  background: linear-gradient(115deg, #ffe08a, #ff6b00 45%, #c77dff 85%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.hero-card--spook {
  background: linear-gradient(160deg, #ff6b00, #6a040f 50%, #240046);
  transform: rotate(-4deg);
}

.launch-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  list-style: none;
  padding: 0;
  margin: 18px 0 0;
}

.launch-pills li {
  padding: 7px 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.1);
  font-size: 0.82rem;
  font-weight: 800;
}

.promo-banner {
  padding-top: 0;
}

.promo-card {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 22px 22px;
  border-radius: 28px;
  background:
    radial-gradient(400px 160px at 10% 0%, rgba(255, 107, 0, 0.45), transparent),
    linear-gradient(120deg, #2b0a3d, #1a0b2e 50%, #3c096c);
  border: 2px solid rgba(255, 140, 60, 0.35);
}

.promo-kicker {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  opacity: 0.85;
}

.promo-card h2 {
  margin: 6px 0;
  font-size: clamp(1.5rem, 3vw, 2rem);
}

.promo-card p {
  margin: 0;
  max-width: 46ch;
  color: var(--muted);
}

.game-card--featured {
  min-height: 210px;
  border-width: 2px;
}

.game-card--spook {
  background:
    linear-gradient(180deg, rgba(255, 120, 40, 0.18), rgba(40, 10, 60, 0.35)),
    radial-gradient(120px 80px at 20% 0%, color-mix(in srgb, var(--accent) 55%, transparent), transparent);
}

.game-grid--featured {
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
}

.center-cta {
  text-align: center;
  margin: 22px 0 0;
}

body.halloween-hub,
body.theme-halloween {
  background:
    radial-gradient(1000px 500px at 10% -10%, #5c1a1a 0%, transparent 55%),
    radial-gradient(800px 480px at 100% 0%, #3c096c 0%, transparent 50%),
    linear-gradient(165deg, #14081a 0%, #1a0a12 45%, #0d1b2a 100%);
}

.hero--halloween .moon {
  position: absolute;
  width: 140px;
  height: 140px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #fff6c8, #f4a261 70%, #e76f51);
  box-shadow: 0 0 60px rgba(255, 200, 120, 0.45);
  top: 30px;
  right: 40px;
}

.about-card--spook {
  border-color: rgba(255, 140, 60, 0.35);
}

.canvas-wrap--phaser {
  position: relative;
  width: 100%;
  min-height: 360px;
  height: min(52vh, 560px);
  background: #0a0614;
  overflow: hidden;
}

.canvas-wrap--phaser canvas.phaser-game {
  display: block;
  position: relative;
  z-index: 1;
  width: 100% !important;
  height: 100% !important;
  margin: 0 auto;
  object-fit: contain;
}

.game-shell--phaser .game-hud {
  position: relative;
  z-index: 2;
  background: linear-gradient(90deg, color-mix(in srgb, var(--accent) 45%, #000), rgba(0, 0, 0, 0.45));
}

/* Overlay MUST sit above Phaser canvas (Phaser appends canvas last) */
.play-phaser .game-overlay,
.canvas-wrap--phaser .game-overlay {
  z-index: 30 !important;
  position: absolute;
  inset: 0;
  pointer-events: auto;
}

.play-phaser .game-overlay.hidden {
  display: none !important;
}

.play-phaser .overlay-card {
  max-height: 90%;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.play-phaser .play-top {
  margin-bottom: 8px;
}

.play-phaser .play-titles h1 {
  font-size: clamp(1.35rem, 5vw, 1.9rem);
}

.play-phaser .ad-container--play {
  margin-bottom: 8px;
  min-height: 0;
}

@media (max-width: 860px) {
  .play-phaser .play-side {
    display: none; /* more room for the game on phones */
  }

  .play-phaser .play-layout {
    grid-template-columns: 1fr;
  }

  .canvas-wrap--phaser {
    height: min(58vh, 520px);
  }
}

.btn-ghost {
  background: rgba(255, 255, 255, 0.1);
  border: 2px solid rgba(255, 255, 255, 0.25);
  color: #fff;
}

.btn-sm {
  padding: 10px 16px;
  font-size: 0.92rem;
}

.btn-reward {
  width: 100%;
  margin-top: 8px;
  background: linear-gradient(135deg, #4cc9f0, #7b2cbf);
  color: #fff;
  box-shadow: 0 10px 24px rgba(76, 201, 240, 0.3);
}

.btn-reward:disabled {
  opacity: 0.55;
  cursor: wait;
}

.btn-reward.is-ready {
  opacity: 1;
  cursor: pointer;
  animation: pulseReady 1.4s ease-in-out infinite;
}

@keyframes pulseReady {
  0%,
  100% {
    box-shadow: 0 10px 24px rgba(76, 201, 240, 0.3);
  }
  50% {
    box-shadow: 0 10px 32px rgba(123, 44, 191, 0.55);
  }
}

.section {
  padding: 28px 0 40px;
}

.section-head {
  margin-bottom: 22px;
}

.section-head h2,
.about-card h2 {
  margin: 0 0 6px;
  font-size: clamp(1.8rem, 4vw, 2.4rem);
}

.section-head p {
  margin: 0;
  color: var(--muted);
}

.game-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 16px;
}

.game-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 18px 16px 16px;
  border-radius: var(--radius);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.14), rgba(255, 255, 255, 0.06)),
    radial-gradient(120px 80px at 20% 0%, color-mix(in srgb, var(--accent) 55%, transparent), transparent);
  border: 2px solid var(--stroke);
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.18);
  overflow: hidden;
  animation: cardIn 0.5s ease both;
  animation-delay: var(--delay, 0ms);
  transition:
    transform 0.18s ease,
    border-color 0.18s ease;
}

.game-card:hover {
  transform: translateY(-4px) scale(1.01);
  border-color: color-mix(in srgb, var(--accent) 70%, #fff);
}

@keyframes cardIn {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.game-card__tag {
  align-self: flex-start;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 4px 8px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--accent) 35%, #000);
}

.game-card__icon {
  font-size: 2rem;
  line-height: 1;
}

.game-card h3 {
  margin: 0;
  font-size: 1.25rem;
}

.game-card p {
  margin: 0;
  color: var(--muted);
  font-size: 0.92rem;
  flex: 1;
}

.game-card__play {
  margin-top: 6px;
  font-weight: 800;
  color: var(--accent);
}

.ad-band {
  margin: 8px 0 20px;
}

.ad-container {
  border-radius: 16px;
  background: rgba(0, 0, 0, 0.18);
  border: 1px dashed rgba(255, 255, 255, 0.15);
  padding: 8px;
  text-align: center;
  min-height: 60px;
}

.ad-container.is-empty {
  display: none;
}

.ad-label {
  display: block;
  font-size: 0.68rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  opacity: 0.55;
  margin-bottom: 4px;
}

.ad-slot {
  margin: 0 auto;
  min-height: 50px;
}

.ad-container--side {
  margin-top: 14px;
}

.about-card {
  border-radius: 28px;
  padding: 28px;
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.12), rgba(255, 255, 255, 0.05));
  border: 2px solid var(--stroke);
}

.pill-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  list-style: none;
  padding: 0;
  margin: 16px 0 8px;
}

.pill-row li {
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.1);
  font-weight: 700;
  font-size: 0.9rem;
}

.fine {
  font-size: 0.8rem;
  opacity: 0.65;
}

.site-footer {
  width: min(1120px, calc(100% - 32px));
  margin: 20px auto 40px;
  color: var(--muted);
  font-size: 0.92rem;
}

.site-footer .muted {
  opacity: 0.75;
}

/* Play page */
.play-wrap {
  padding-bottom: 24px;
}

.play-top {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 14px;
}

.back-link {
  font-weight: 700;
  opacity: 0.85;
  width: fit-content;
}

.play-titles h1 {
  margin: 0;
  font-size: clamp(1.6rem, 4vw, 2.2rem);
}

.play-titles p {
  margin: 4px 0 0;
  color: var(--muted);
}

.play-layout {
  display: grid;
  grid-template-columns: 1fr 280px;
  gap: 18px;
  margin-top: 14px;
}

.game-shell {
  border-radius: 24px;
  overflow: hidden;
  background: rgba(0, 0, 0, 0.25);
  border: 2px solid color-mix(in srgb, var(--accent) 40%, transparent);
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.28);
}

.game-hud {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  padding: 12px 14px;
  background: linear-gradient(90deg, color-mix(in srgb, var(--accent) 35%, #000), rgba(0, 0, 0, 0.35));
}

.hud-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.hud-stat {
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.28);
  font-weight: 800;
  font-size: 0.88rem;
}

.hud-actions {
  display: flex;
  gap: 8px;
}

.canvas-wrap {
  position: relative;
  width: 100%;
  background: #0d0820;
  touch-action: none;
}

#gameCanvas {
  display: block;
  width: 100%;
  height: auto;
  vertical-align: middle;
}

.game-overlay {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 16px;
  background: rgba(10, 6, 24, 0.55);
  backdrop-filter: blur(4px);
}

.game-overlay.hidden {
  display: none;
}

.overlay-card {
  width: min(360px, 100%);
  padding: 22px 20px;
  border-radius: 22px;
  background: linear-gradient(160deg, rgba(40, 20, 70, 0.95), rgba(20, 30, 60, 0.95));
  border: 2px solid rgba(255, 255, 255, 0.18);
  text-align: center;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.4);
}

.overlay-card h2 {
  margin: 0 0 8px;
  font-size: 1.7rem;
}

.overlay-card p {
  margin: 0 0 14px;
  color: var(--muted);
}

.overlay-score {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-bottom: 14px;
}

.overlay-score strong {
  font-size: 2.2rem;
  line-height: 1;
}

.overlay-score span {
  opacity: 0.8;
  font-weight: 700;
}

.rewarded-box {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid rgba(255, 255, 255, 0.12);
  text-align: center;
}

.rewarded-box[hidden] {
  display: none !important;
}

.rewarded-title {
  margin: 0 0 4px !important;
  font-weight: 800;
  color: #fff !important;
}

.rewarded-desc {
  margin: 0 0 8px !important;
  font-size: 0.9rem;
}

.rewarded-status {
  margin: 0 0 8px !important;
  font-size: 0.85rem;
  font-weight: 700;
}

.rewarded-status.is-error {
  color: #ff8a8a !important;
}

.tip-box {
  border-radius: 20px;
  padding: 16px;
  background: rgba(255, 255, 255, 0.08);
  border: 2px solid var(--stroke);
}

.tip-box h3 {
  margin: 0 0 8px;
}

.tip-box ul {
  margin: 0;
  padding-left: 18px;
  color: var(--muted);
}

.tip-box li + li {
  margin-top: 6px;
}

/* Sticky footer ad */
.sticky-ad {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 50;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 6px 36px 8px;
  background: rgba(12, 8, 24, 0.92);
  border-top: 1px solid rgba(255, 255, 255, 0.12);
  backdrop-filter: blur(10px);
}

.sticky-ad[hidden] {
  display: none !important;
}

.sticky-ad__close {
  position: absolute;
  right: 8px;
  top: 4px;
  width: 28px;
  height: 28px;
  border: none;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  font-size: 18px;
  cursor: pointer;
}

.ad-slot--sticky {
  min-height: 50px;
}

@media (max-width: 860px) {
  .hero {
    grid-template-columns: 1fr;
  }

  .hero-stage {
    order: -1;
    min-height: 200px;
  }

  .play-layout {
    grid-template-columns: 1fr;
  }

  .play-side {
    order: 2;
  }
}

@media (max-width: 560px) {
  .site-header {
    padding-inline: 14px;
  }

  .nav {
    gap: 12px;
    font-size: 0.92rem;
  }

  .game-hud {
    flex-direction: column;
    align-items: stretch;
  }

  .hud-actions {
    justify-content: stretch;
  }

  .hud-actions .btn {
    flex: 1;
  }
}
