/**
 * Game Anything — shared casual game shell
 * -----------------------------------------
 * Scope: add class `ga-casual-scope` on the game root (#bp-app, #cr-app, …).
 *
 * AI / theming: override tokens on .ga-casual-scope or via JS:
 *   root.style.setProperty('--ga-accent-game', '#7c3aed')
 * Level JSON packs can ship companion CSS that only touches --ga-* and game --xx-* vars.
 */

.ga-casual-scope {
  /* Brand (aligns with gameanything.com slate + sky) */
  --ga-bg-abyss: #070b14;
  --ga-bg-deep: #0f172a;
  --ga-bg-mid: #111b2d;
  --ga-surface: rgba(15, 23, 42, 0.78);
  --ga-surface-soft: rgba(30, 41, 59, 0.55);
  --ga-border: rgba(56, 189, 248, 0.22);
  --ga-border-strong: rgba(59, 130, 246, 0.42);
  /* Maze games (speed / infinite / puzzle-maze): main panel outline */
  --ga-frame-border: #000000;
  --ga-text: #f1f5f9;
  --ga-muted: #94a3b8;
  --ga-sky: #38bdf8;
  --ga-blue: #3b82f6;
  --ga-blue-deep: #2563eb;
  --ga-violet: #6366f1;
  --ga-success: #4ade80;
  --ga-warn: #fbbf24;
  --ga-danger: #fb7185;
  /* Per-game accent hook (optional) */
  --ga-accent-game: var(--ga-sky);

  /* Main menu card width — align with Speed Maze .sm-menu-panel */
  --ga-puzzle-menu-max: 760px;

  /* Comfortable insets for menu cards, overlays, and hero stacks */
  --ga-screen-pad-x: clamp(18px, 5vw, 32px);
  --ga-screen-pad-y: clamp(16px, 4vw, 28px);
  --ga-card-pad-x: clamp(22px, 4.5vw, 34px);
  --ga-card-pad-y: clamp(24px, 5vw, 38px);

  --ga-radius-xl: 22px;
  --ga-radius-lg: 16px;
  --ga-radius-md: 12px;
  --ga-radius-pill: 999px;

  --ga-shadow-elevated: 0 24px 64px rgba(2, 6, 23, 0.62);
  --ga-shadow-glow: 0 0 48px rgba(56, 189, 248, 0.1);
  --ga-inner-shine: inset 0 1px 0 rgba(255, 255, 255, 0.07);

  --ga-ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --ga-ease-spring: cubic-bezier(0.34, 1.18, 0.64, 1);
  --ga-time: 0.38s;
  --ga-time-fast: 0.22s;

  isolation: isolate;
}

/* Root frame — puzzle/sports shells (#bp-app, #pp-app, #tp-app, #lp-app, #cr-app, #tt-app + .ga-casual-scope) */
.ga-casual-scope#bp-app,
.ga-casual-scope#pp-app,
.ga-casual-scope#tp-app,
.ga-casual-scope#lp-app,
.ga-casual-scope#cr-app,
.ga-casual-scope#tt-app {
  box-sizing: border-box;
  border: 1px solid var(--ga-frame-border);
  border-radius: var(--ga-radius-xl);
  box-shadow: var(--ga-inner-shine), 0 0 0 1px rgba(2, 6, 23, 0.35) inset;
}

/* --- Wordmark (matches site energy) --- */
.ga-casual-scope .ga-wordmark {
  font-weight: 800;
  font-size: 0.72rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  background: linear-gradient(102deg, #f8fafc 0%, #7dd3fc 38%, #60a5fa 72%, #a5b4fc 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  text-shadow: none;
  filter: drop-shadow(0 0 20px rgba(56, 189, 248, 0.15));
}

/* --- Topbar chrome --- */
.ga-casual-scope .ga-topbar {
  padding-bottom: 12px;
  margin-bottom: 4px;
  border-bottom: 1px solid rgba(56, 189, 248, 0.12);
  box-shadow: 0 12px 32px rgba(2, 6, 23, 0.2);
}

/* --- Screen / panel entrance (sub-screens; respect motion) --- */
@keyframes ga-enter-up {
  from {
    opacity: 0;
    transform: translateY(16px) scale(0.985);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes ga-enter-fade {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

.ga-casual-scope .ga-screen-enter {
  animation: ga-enter-up var(--ga-time) var(--ga-ease-out) both;
}

.ga-casual-scope .ga-menu-hero {
  position: relative;
  overflow: hidden;
  text-align: center;
}

/* Maze menu: circled world pill + large centered title (infinite-maze / im-menu-panel pattern) */
.ga-casual-scope .ga-puzzle-world {
  display: table;
  margin: 0 auto 16px;
  padding: 4px 10px;
  border-radius: var(--ga-radius-pill);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.05em;
  color: #e7efff;
  background: rgba(34, 211, 238, 0.18);
  border: 1px solid rgba(34, 211, 238, 0.4);
}

.ga-casual-scope .ga-puzzle-world[hidden] {
  display: none !important;
}

.ga-casual-scope .ga-sports-world {
  display: table;
  margin: 0 auto 16px;
  padding: 4px 10px;
  border-radius: var(--ga-radius-pill);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.05em;
  color: #ecfdf5;
  background: rgba(52, 211, 153, 0.18);
  border: 1px solid rgba(52, 211, 153, 0.42);
}

.ga-casual-scope .ga-sports-world[hidden] {
  display: none !important;
}

.ga-casual-scope .ga-menu-hero h1 {
  margin: 8px auto 12px;
  width: 100%;
  max-width: 100%;
  text-align: center;
  font-size: clamp(34px, 5vw, 48px);
  font-weight: 800;
  letter-spacing: 0.01em;
  color: #f8fafc;
  line-height: 1.12;
  text-shadow: 0 4px 20px rgba(56, 189, 248, 0.35);
}

/* Short blurb under title — centered block + lines (host CSS sometimes resets inherited text-align) */
.ga-casual-scope .ga-menu-hero :is(.bp-lead, .pp-lead, .tp-lead, .lp-lead, .cr-lead) {
  text-align: center;
  margin-left: auto;
  margin-right: auto;
  max-width: 36rem;
}

.ga-casual-scope .ga-menu-hero .tp-menu-actions,
.ga-casual-scope .ga-menu-hero .pp-menu-actions,
.ga-casual-scope .ga-menu-hero .lp-actions,
.ga-casual-scope .ga-menu-hero .cr-actions {
  flex-direction: row;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
}

.ga-casual-scope .ga-menu-hero .bp-menu-actions {
  flex-direction: row;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
}

/* Main menu buttons — Puzzle Maze reference: cyan gradient primary, frosted + white-outline secondaries */
.ga-casual-scope
  .ga-menu-hero
  :is(.tp-menu-actions, .pp-menu-actions, .lp-actions, .cr-actions, .bp-menu-actions)
  :is(button.tp-btn, button.pp-btn, button.lp-btn, button.cr-btn, button.bp-btn) {
  min-height: 0;
  padding: 10px 16px;
  font-size: 13px;
  font-weight: 700;
  line-height: 1.2;
  border-radius: 14px;
  cursor: pointer;
  box-sizing: border-box;
  transition:
    transform 0.16s ease,
    background 0.16s ease,
    border-color 0.16s ease,
    box-shadow 0.16s ease;
}

.ga-casual-scope
  .ga-menu-hero
  :is(.tp-menu-actions, .pp-menu-actions, .lp-actions, .cr-actions, .bp-menu-actions)
  :is(
    button.tp-btn:not(.tp-btn-primary),
    button.pp-btn:not(.pp-btn-primary),
    button.lp-btn:not(.lp-btn-primary),
    button.cr-btn:not(.cr-btn-primary),
    button.bp-btn:not(.bp-btn-primary)
  ) {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.38);
  color: #ffffff;
  box-shadow: none;
}

.ga-casual-scope
  .ga-menu-hero
  :is(.tp-menu-actions, .pp-menu-actions, .lp-actions, .cr-actions, .bp-menu-actions)
  :is(
    button.tp-btn:not(.tp-btn-primary),
    button.pp-btn:not(.pp-btn-primary),
    button.lp-btn:not(.lp-btn-primary),
    button.cr-btn:not(.cr-btn-primary),
    button.bp-btn:not(.bp-btn-primary)
  ):hover {
  transform: translateY(-1px);
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.52);
  color: #ffffff;
}

.ga-casual-scope
  .ga-menu-hero
  :is(.tp-menu-actions, .pp-menu-actions, .lp-actions, .cr-actions, .bp-menu-actions)
  :is(
    button.tp-btn-primary,
    button.pp-btn-primary,
    button.lp-btn-primary,
    button.cr-btn-primary,
    button.bp-btn-primary
  ) {
  border-color: transparent;
  background: linear-gradient(135deg, #06b6d4 0%, #0ea5e9 45%, #3b82f6 100%);
  color: #0c1426;
  font-weight: 800;
  box-shadow:
    0 6px 24px rgba(6, 182, 212, 0.4),
    0 2px 8px rgba(59, 130, 246, 0.22);
}

.ga-casual-scope
  .ga-menu-hero
  :is(.tp-menu-actions, .pp-menu-actions, .lp-actions, .cr-actions, .bp-menu-actions)
  :is(
    button.tp-btn-primary,
    button.pp-btn-primary,
    button.lp-btn-primary,
    button.cr-btn-primary,
    button.bp-btn-primary
  ):hover {
  background: linear-gradient(135deg, #22d3ee, #38bdf8 50%, #60a5fa);
  color: #0c1426;
  box-shadow: 0 8px 28px rgba(34, 211, 238, 0.45);
}

.ga-casual-scope
  .ga-menu-hero
  :is(.tp-menu-actions, .pp-menu-actions, .lp-actions, .cr-actions, .bp-menu-actions)
  :is(button.tp-btn, button.pp-btn, button.lp-btn, button.cr-btn, button.bp-btn):focus-visible {
  outline: 2px solid #67e8f9;
  outline-offset: 2px;
}

.ga-casual-scope .ga-menu-hero::before {
  content: "";
  position: absolute;
  inset: -40% -20% auto -20%;
  height: 55%;
  background: radial-gradient(ellipse at 50% 0%, rgba(56, 189, 248, 0.14), transparent 62%);
  pointer-events: none;
}

@media (prefers-reduced-motion: reduce) {
  .ga-casual-scope .ga-screen-enter {
    animation: ga-enter-fade 0.2s ease both;
  }

  .ga-casual-scope .ga-menu-hero::before {
    display: none;
  }
}

/* --- Platform CTA (integrated “hub” card) --- */
.ga-casual-scope .ga-platform-cta {
  margin-top: 18px;
  padding: 16px 18px 18px;
  border-radius: var(--ga-radius-lg);
  border: 1px solid var(--ga-border-strong);
  background: linear-gradient(145deg, rgba(15, 23, 42, 0.92) 0%, rgba(30, 41, 59, 0.65) 100%);
  box-shadow: var(--ga-shadow-glow), var(--ga-inner-shine);
  position: relative;
  text-align: left;
}

.ga-casual-scope .ga-platform-cta::before {
  content: "";
  position: absolute;
  left: 0;
  top: 12px;
  bottom: 12px;
  width: 3px;
  border-radius: 3px;
  background: linear-gradient(180deg, var(--ga-accent-game, var(--ga-sky)), var(--ga-blue));
  opacity: 0.9;
}

.ga-casual-scope .ga-platform-cta__head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
  margin-bottom: 10px;
  padding-left: 10px;
}

.ga-casual-scope .ga-platform-cta__badge {
  font-size: 0.65rem;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ga-sky);
  padding: 4px 10px;
  border-radius: var(--ga-radius-pill);
  border: 1px solid rgba(56, 189, 248, 0.35);
  background: rgba(56, 189, 248, 0.1);
}

.ga-casual-scope .ga-platform-cta__tagline {
  font-size: 0.78rem;
  color: var(--ga-muted);
  font-weight: 500;
}

.ga-casual-scope .ga-platform-cta__text {
  margin: 0 0 14px;
  padding-left: 10px;
  font-size: 0.88rem;
  line-height: 1.55;
  color: #cbd5e1;
}

.ga-casual-scope .ga-platform-cta__text code {
  font-size: 0.84em;
  padding: 2px 6px;
  border-radius: 6px;
  background: rgba(56, 189, 248, 0.1);
  border: 1px solid rgba(56, 189, 248, 0.2);
  color: var(--ga-sky);
}

.ga-casual-scope .ga-platform-cta__actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 14px;
  padding-left: 10px;
}

.ga-casual-scope .ga-platform-cta__link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 44px;
  padding: 0 18px;
  border-radius: 10px;
  font-size: 0.9rem;
  font-weight: 700;
  text-decoration: none;
  transition:
    transform var(--ga-time-fast) var(--ga-ease-out),
    box-shadow var(--ga-time-fast) var(--ga-ease-out),
    background var(--ga-time-fast) ease;
}

.ga-casual-scope .ga-platform-cta__link--primary {
  background: linear-gradient(135deg, var(--ga-blue-deep), var(--ga-blue) 55%, var(--ga-sky));
  color: #fff !important;
  border: 1px solid rgba(37, 99, 235, 0.6);
  box-shadow: 0 6px 22px rgba(37, 99, 235, 0.45);
}

.ga-casual-scope .ga-platform-cta__link--primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 28px rgba(37, 99, 235, 0.55);
}

.ga-casual-scope .ga-platform-cta__link--ghost {
  background: rgba(255, 255, 255, 0.04);
  color: var(--ga-text) !important;
  border: 1px solid var(--ga-border);
}

.ga-casual-scope .ga-platform-cta__link--ghost:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: var(--ga-border-strong);
}

.ga-casual-scope .ga-platform-cta__hint {
  font-size: 0.75rem;
  color: var(--ga-muted);
  line-height: 1.4;
}

@media (max-width: 480px) {
  .ga-casual-scope .ga-platform-cta {
    padding: 14px 14px 16px;
    border-radius: var(--ga-radius-md);
  }

  .ga-casual-scope .ga-platform-cta__actions {
    flex-direction: column;
    align-items: stretch;
  }

  .ga-casual-scope .ga-platform-cta__link {
    width: 100%;
  }
}

/* --- Maze-style in-game overlays: translucent dim over live play + framed setting box --- */
.ga-casual-scope .ga-game-overlay {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: max(var(--ga-screen-pad-y), env(safe-area-inset-top))
    max(var(--ga-screen-pad-x), env(safe-area-inset-right))
    max(var(--ga-screen-pad-y), env(safe-area-inset-bottom))
    max(var(--ga-screen-pad-x), env(safe-area-inset-left));
  background: rgba(2, 6, 23, 0.42);
  backdrop-filter: blur(10px) saturate(1.05);
  -webkit-backdrop-filter: blur(10px) saturate(1.05);
}

.ga-casual-scope .ga-game-overlay--dense {
  background: rgba(2, 6, 23, 0.55);
}

.ga-casual-scope .ga-game-overlay--soft {
  background: rgba(2, 6, 23, 0.32);
}

.ga-casual-scope .ga-game-overlay[hidden] {
  display: none !important;
}

/* Matches infinite-maze .im-card.im-card-small (pause / run-end layout) */
.ga-casual-scope .ga-game-setting-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: min(560px, 100%);
  max-width: 560px;
  padding: var(--ga-card-pad-y) var(--ga-card-pad-x);
  border-radius: 20px;
  text-align: center;
  color: #e2e8f0;
  background: rgba(15, 23, 42, 0.92);
  border: 1px solid rgba(148, 163, 184, 0.32);
  box-shadow: 0 18px 34px rgba(2, 6, 23, 0.5);
  position: relative;
  z-index: 1;
}

.ga-casual-scope .ga-game-setting-box--narrow {
  max-width: min(400px, 100%);
  width: min(400px, 100%);
}

.ga-casual-scope .ga-game-setting-box [class*="-kicker"] {
  display: table;
  margin: 0 auto 8px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.05em;
  color: #e7efff;
  background: rgba(34, 211, 238, 0.18);
  border: 1px solid rgba(34, 211, 238, 0.4);
}

.ga-casual-scope .ga-game-setting-box h2,
.ga-casual-scope .ga-game-setting-box h3 {
  margin: 4px 0 8px;
  color: #f8fafc;
  font-size: clamp(26px, 5vw, 34px);
  font-weight: 800;
  letter-spacing: 0.01em;
  line-height: 1.15;
  text-shadow: 0 4px 20px rgba(56, 189, 248, 0.35);
}

.ga-casual-scope .ga-game-setting-box > p:not([class*="-kicker"]):not([class*="win-stars"]):not([class*="-streak"]) {
  margin: 0 0 10px;
  color: #cbd5e1;
  line-height: 1.55;
  max-width: 100%;
}

.ga-casual-scope .ga-game-setting-actions {
  margin-top: 14px;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  width: 100%;
}

/* Maze overlay buttons (monster-maze .mm-mini-btn scale + .mm-btn look) */
.ga-casual-scope .ga-game-setting-actions :is(
  button.tp-btn,
  button.pp-btn,
  button.lp-btn,
  button.cr-btn,
  button.bp-btn
) {
  min-height: 0;
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.2;
  border-radius: 10px;
  border: 1px solid rgba(148, 163, 184, 0.35);
  background: rgba(15, 23, 42, 0.88);
  color: #e2e8f0;
  box-shadow: none;
  transition: transform 0.16s ease, background 0.16s ease, box-shadow 0.16s ease;
}

.ga-casual-scope .ga-game-setting-actions :is(
  button.tp-btn,
  button.pp-btn,
  button.lp-btn,
  button.cr-btn,
  button.bp-btn
):hover {
  transform: translateY(-1px);
  background: rgba(30, 41, 59, 0.95);
  box-shadow: 0 8px 18px rgba(2, 6, 23, 0.35);
}

.ga-casual-scope .ga-game-setting-actions :is(
  button.tp-btn,
  button.pp-btn,
  button.lp-btn,
  button.cr-btn,
  button.bp-btn
):focus-visible {
  outline: 2px solid #67e8f9;
  outline-offset: 2px;
}

.ga-casual-scope .ga-game-setting-actions :is(
  button.tp-btn-primary,
  button.pp-btn-primary,
  button.lp-btn-primary,
  button.cr-btn-primary,
  button.bp-btn-primary
) {
  background: linear-gradient(135deg, #22d3ee, #3b82f6);
  color: #081121;
  border-color: transparent;
}

.ga-casual-scope .ga-game-setting-actions :is(
  button.tp-btn-primary,
  button.pp-btn-primary,
  button.lp-btn-primary,
  button.cr-btn-primary,
  button.bp-btn-primary
):hover {
  background: linear-gradient(135deg, #67e8f9, #60a5fa);
  color: #081121;
  box-shadow: 0 8px 18px rgba(2, 6, 23, 0.35);
}
