/* ── Miracle Games Hub ── dark-first, html[data-theme="dark"] aware */
@import url('https://fonts.googleapis.com/css2?family=Barlow+Condensed:wght@600;700;900&family=Barlow:wght@400;600&display=swap');

.mgh-root *, .mgh-root *::before, .mgh-root *::after {
  box-sizing: border-box; margin: 0; padding: 0;
}

/* ── CSS variables (dark default) ── */
.mgh-root {
  --bg:        #0a0d12;
  --bg2:       #0d1117;
  --card:      #161b22;
  --card2:     #1c2330;
  --gold:      #D4AF37;
  --gold2:     #f5d76e;
  --ink:       #e6edf3;
  --muted:     #8b949e;
  --line:      rgba(255,255,255,0.08);
  --shadow:    rgba(0,0,0,0.55);
  font-family: 'Barlow', sans-serif;
  color: var(--ink);
  background:
    radial-gradient(ellipse 80% 50% at 50% -10%, rgba(212,175,55,0.08), transparent),
    var(--bg);
  min-height: 100vh;
  padding: 28px 16px 48px;
}

html:not([data-theme="dark"]) .mgh-root {
  --bg:    #eef2f7;
  --bg2:   #f5f7fa;
  --card:  #ffffff;
  --card2: #f6f8fa;
  --ink:   #1a2744;
  --muted: #6b7280;
  --line:  rgba(0,0,0,0.07);
  --shadow:rgba(20,30,50,0.18);
  background:
    radial-gradient(ellipse 80% 50% at 50% -10%, rgba(212,175,55,0.10), transparent),
    var(--bg);
}

/* ── Header ── */
.mgh-header { text-align: center; max-width: 640px; margin: 0 auto 32px; }
.mgh-title {
  font-family: 'Barlow Condensed', sans-serif;
  font-weight: 900;
  font-size: clamp(34px, 9vw, 54px);
  letter-spacing: 1.5px;
  text-transform: uppercase;
  background: linear-gradient(160deg, var(--gold2), var(--gold));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  line-height: 1.05;
}
.mgh-subtitle {
  color: var(--muted);
  font-size: 15px;
  margin-top: 8px;
}

/* ── Grid ── */
.mgh-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
  max-width: 720px;
  margin: 0 auto;
}
@media (min-width: 560px) {
  .mgh-grid { grid-template-columns: repeat(3, 1fr); gap: 18px; }
}
@media (min-width: 860px) {
  .mgh-grid { grid-template-columns: repeat(4, 1fr); gap: 20px; max-width: 960px; }
}

/* ── Card ── */
.mgh-card {
  position: relative;
  border-radius: 20px;
  overflow: hidden;
  background: var(--card);
  border: 1px solid var(--line);
  box-shadow: 0 10px 30px -12px var(--shadow);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  text-decoration: none;
  color: inherit;
  display: block;
  transition: transform 0.18s cubic-bezier(.2,.8,.3,1.2), box-shadow 0.18s ease, border-color 0.18s ease;
  isolation: isolate;
}
.mgh-card:hover {
  transform: translateY(-4px) scale(1.015);
  box-shadow: 0 18px 40px -14px var(--shadow);
}
.mgh-card:active {
  transform: translateY(-1px) scale(0.99);
}

/* Per-card accent gradient backdrop, set via inline CSS custom props */
.mgh-card-glow {
  position: absolute;
  inset: 0;
  background: linear-gradient(155deg, var(--mgh-accent, #D4AF37) 0%, var(--mgh-accent2, #1c2330) 100%);
  opacity: 0.16;
  z-index: 0;
  transition: opacity 0.2s ease;
}
.mgh-card:hover .mgh-card-glow { opacity: 0.26; }

/* Decorative corner glow blob */
.mgh-card-blob {
  position: absolute;
  top: -30%;
  right: -20%;
  width: 70%;
  height: 70%;
  background: radial-gradient(circle, var(--mgh-accent, #D4AF37) 0%, transparent 70%);
  opacity: 0.25;
  filter: blur(6px);
  z-index: 0;
  pointer-events: none;
}

.mgh-card-body {
  position: relative;
  z-index: 1;
  padding: 20px 14px 18px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 6px;
  min-height: 150px;
  justify-content: center;
}

.mgh-card-icon {
  font-size: 42px;
  line-height: 1;
  margin-bottom: 4px;
  filter: drop-shadow(0 4px 10px rgba(0,0,0,0.35));
  transition: transform 0.2s ease;
}
.mgh-card:hover .mgh-card-icon { transform: scale(1.12) rotate(-4deg); }

.mgh-card-title {
  font-family: 'Barlow Condensed', sans-serif;
  font-weight: 700;
  font-size: 17px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--ink);
  line-height: 1.15;
}

.mgh-card-tagline {
  font-size: 11.5px;
  color: var(--muted);
  line-height: 1.3;
  max-width: 140px;
}

/* Play badge — appears bottom of card */
.mgh-card-play {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 9px 0;
  font-family: 'Barlow Condensed', sans-serif;
  font-weight: 700;
  font-size: 12.5px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--mgh-accent, #D4AF37);
  background: var(--card2);
  border-top: 1px solid var(--line);
  transition: background 0.18s ease, color 0.18s ease;
}
.mgh-card:hover .mgh-card-play {
  background: var(--mgh-accent, #D4AF37);
  color: #14171c;
}
.mgh-card-play .mgh-play-arrow {
  transition: transform 0.18s ease;
}
.mgh-card:hover .mgh-card-play .mgh-play-arrow {
  transform: translateX(3px);
}

/* Loading-tap state (brief, while __miracleNav resolves) */
.mgh-card.is-loading { opacity: 0.6; pointer-events: none; }
.mgh-card.is-loading .mgh-card-play { background: var(--card2); color: var(--muted); }

/* ── Empty state ── */
.mgh-empty {
  text-align: center;
  padding: 40px 20px;
  color: var(--muted);
  font-size: 14px;
}

/* ── Loading shimmer ── */
.mgh-loading {
  text-align: center;
  padding: 60px 20px;
  color: var(--muted);
  font-size: 15px;
}

@media (max-width: 380px) {
  .mgh-card-body { min-height: 130px; padding: 16px 10px 14px; }
  .mgh-card-icon { font-size: 36px; }
  .mgh-card-title { font-size: 15px; }
  .mgh-card-tagline { font-size: 11px; }
}

.mgh-casino-modal{position:fixed;inset:0;z-index:999999;background:rgba(0,0,0,.82);backdrop-filter:blur(8px);overflow:auto;padding:12px;display:flex;align-items:center;justify-content:center}
.mgh-casino-modal-inner{position:relative;width:min(1100px,100%);max-height:96vh;overflow:auto}
.mgh-casino-close{position:absolute;z-index:5;right:12px;top:12px;width:38px;height:38px;border:1px solid #ffffff22;border-radius:50%;background:#090b0fdd;color:#fff;font-size:27px;cursor:pointer}
@media(max-width:600px){.mgh-casino-modal{padding:0}.mgh-casino-modal-inner{max-height:100vh}.mgh-casino-close{right:8px;top:8px}}
