body.page-minigames {
  --mg-padding: 1.5rem;

  --bingo-accent-purple: #8a4dff;
  --bingo-accent-purple-rgba: 138,77,255;

  --bg: var(--bg, #121217);
  --bg-gradient-top: var(--bg-gradient-top, rgba(127,87,255,0.04));

  --card-surface: linear-gradient(0deg, rgba(127,87,255,0.04), var(--bg));  
  --card-surface-hover: linear-gradient(0deg, rgba(127,87,255,0.08), var(--bg));
}

body.page-minigames .minigames-section {
  padding: 2rem 1rem 3rem;
}

body.page-minigames .tabs {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1rem;
  justify-content: center;
  flex-wrap: wrap;
}

body.page-minigames .tab-btn {
  padding: 0.75rem 1.5rem;
  font-size: 1.05rem;
  background: var(--panel);
  border: 1px solid var(--border);
  border-bottom: none;
  border-radius: 10px 10px 0 0;
  color: var(--text);
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
  font-family: "Montserrat", system-ui, -apple-system, "Segoe UI", Roboto, Ubuntu, Inter, sans-serif;
  -webkit-font-smoothing: antialiased;
}

body.page-minigames .tab-btn:hover { transform: translateY(-1px); }

body.page-minigames .tab-btn.active {
  background: linear-gradient(180deg, var(--accent), var(--accent-strong));
  border-color: var(--accent-strong);
  color: var(--panel);
  transform: translateY(-2px);
  box-shadow: 0 6px 14px rgba(0,0,0,0.16);
}

body.page-minigames .tab-btn:focus {
  outline: none;
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 12%, transparent);
}

body.page-minigames .tab-content {
  display: none;
  padding: 1rem 0;
  border-top: 1px solid var(--border);
}

body.page-minigames .tab-content.active { display: block; }

body.page-minigames .mg-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 2rem;
  box-shadow: 0 6px 16px rgba(0,0,0,.35);
  margin-bottom: 1.5rem;
}

body.page-minigames .mg-card h3 {
  color: var(--brand);
  font-size: 1.5rem;
  margin-top: 0;
  margin-bottom: 0.5rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  text-align: center;
}

body.page-minigames .mg-card .description {
  color: var(--muted);
  line-height: 1.6;
  margin: 0.5rem 0 1rem 0;
  text-align: center;
}

body.page-minigames .mg-placeholder {
  background: rgba(255, 165, 0, 0.05);
  border: 2px dashed var(--highlight);
  border-radius: 10px;
  padding: 2rem;
  text-align: center;
  color: var(--muted);
  margin: 1rem auto;
  max-width: 600px;
}
body.page-minigames .mg-placeholder strong {
  color: var(--highlight);
  display: block;
  margin-bottom: 0.5rem;
  font-size: 1.1rem;
}

body.page-minigames .mg-stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px,1fr));
  gap: 1rem;
  margin: 1.5rem 0;
  padding: 1rem 0;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}
body.page-minigames .mg-stat-card {
  position: relative;
  text-align: center;
  border: 1px solid var(--border);
  background: var(--card-surface);
  border-radius: 12px;
  padding: 1.25rem 1rem;
  transition: transform 0.28s ease, border-color 0.28s ease, box-shadow 0.3s ease, background 0.35s ease;
  box-shadow: 0 3px 10px rgba(0,0,0,0.45);
  overflow: hidden;
}
body.page-minigames .mg-stat-card::before {
  content: "";
  position: absolute;
  top: 0; left: 0;
  height: 4px; width: 100%;
  background: linear-gradient(90deg, rgba(var(--bingo-accent-purple-rgba),0.9), rgba(var(--bingo-accent-purple-rgba),0.35));
}
body.page-minigames .mg-stat-card:hover,
body.page-minigames .mg-stat-card:focus-within {
  transform: translateY(-5px);
  border-color: var(--bingo-accent-purple);
  box-shadow:
    0 0 0 2px rgba(var(--bingo-accent-purple-rgba),0.30),
    0 10px 28px -6px rgba(0,0,0,0.6),
    0 0 24px rgba(var(--bingo-accent-purple-rgba),0.30);
  background: var(--card-surface-hover);
}
body.page-minigames .mg-stat-icon { font-size: 2rem; margin-bottom: 0.5rem; }
body.page-minigames .mg-stat-label {
  font-size: 0.72rem; font-weight: 600; letter-spacing: 0.5px;
  text-transform: uppercase; color: var(--muted); margin-bottom: 0.4rem;
}
body.page-minigames .mg-stat-value { font-size: 1.2rem; font-weight: 800; color: var(--text); }

body.page-minigames .mg-status-badge {
  display: inline-block;
  padding: 0.35rem 0.75rem;
  border-radius: 10px;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
body.page-minigames .mg-status-badge.upcoming {
  background: rgba(var(--bingo-accent-purple-rgba),0.15);
  color: var(--bingo-accent-purple);
  border: 1px solid var(--bingo-accent-purple);
}
body.page-minigames .mg-status-badge.active {
  background: rgba(46,204,113,0.2);
  color: var(--brand-2);
  border: 1px solid var(--brand-2);
}
body.page-minigames .mg-status-badge.completed,
body.page-minigames .mg-status-badge.inactive {
  background: rgba(128,128,128,0.22);
  color: var(--muted);
  border: 1px solid var(--border);
}

body.page-minigames .mg-image-container {
  text-align: center;
  margin: 2rem 0 2.5rem;
  display: flex;
  justify-content: center;
}
body.page-minigames .mg-image-container img,
body.page-minigames img.mg-board-image {
  max-width: 100%;
  height: auto;
  border-radius: 12px;
  border: 1px solid var(--border);
  transition: transform 0.26s ease, border-color 0.26s ease, box-shadow 0.3s ease, background 0.26s ease;
  display: block;
  background: var(--bg);
}
body.page-minigames .mg-image-container img:hover,
body.page-minigames img.mg-board-image:hover {
  transform: translateY(-4px) scale(1.02);
  border-color: var(--bingo-accent-purple);
  box-shadow:
    0 0 0 3px rgba(var(--bingo-accent-purple-rgba),0.45),
    0 10px 30px -4px rgba(0,0,0,0.6),
    0 0 28px rgba(var(--bingo-accent-purple-rgba),0.5);
  background: var(--card-surface-hover);
  cursor: pointer;
}

body.page-minigames .mg-card details { margin: 0; padding: 0; }
body.page-minigames .mg-card details > summary::-webkit-details-marker { display: none; }
body.page-minigames .mg-card details > summary {
  display: flex; align-items: center; gap: 0.6rem;
  font-weight: 800; color: var(--text); font-size: 1rem;
  padding: 0.75rem 1rem;
  border-radius: 12px;
  background: var(--card-surface);
  border: 1px solid var(--border);
  transition: transform 0.25s ease, border-color 0.25s ease, box-shadow 0.3s ease, background 0.28s ease;
  list-style: none; cursor: pointer; user-select: none;
  position: relative;
}
body.page-minigames .mg-card details > summary::after {
  content: "+";
  margin-left: auto;
  min-width: 1.2rem; height: 1.2rem;
  display: inline-grid; place-items: center;
  border-radius: 6px;
  background: rgba(127,87,255,0.06);
  color: rgba(255,255,255,0.7);
  border: 1px solid rgba(127,87,255,0.25);
  font-weight: 700;
  font-size: 0.9rem;
  line-height: 1;
}
body.page-minigames .mg-card details[open] > summary::after { content: "−"; }
body.page-minigames .mg-card details > summary:hover {
  transform: translateY(-2px);
  border-color: var(--bingo-accent-purple);
  background: var(--card-surface-hover);
  box-shadow:
    0 0 0 2px rgba(var(--bingo-accent-purple-rgba),0.25),
    0 8px 24px -6px rgba(0,0,0,0.55);
}
body.page-minigames .mg-howto-panel,
body.page-minigames .mg-card details > div {
  padding: 1.5rem;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--card-surface);
  margin-top: 0.75rem;
  box-shadow: 0 4px 16px rgba(0,0,0,0.55);
  transition: background 0.28s ease, border-color 0.28s ease, box-shadow 0.3s ease;
  position: relative;
}
body.page-minigames .mg-howto-panel::before,
body.page-minigames .mg-card details > div::before {
  content: "";
  position: absolute;
  top: 0; left: 0;
  height: 4px; width: 100%;
  background: linear-gradient(90deg, rgba(var(--bingo-accent-purple-rgba),0.9), rgba(var(--bingo-accent-purple-rgba),0.35));
}
body.page-minigames .mg-card details ol {
  margin: 0;
  padding-left: 1.4rem;
  line-height: 1.85;
  font-size: 0.95rem;
  color: var(--text);
}
body.page-minigames .mg-card details ol code {
  background: rgba(127,87,255,0.12);
  padding: 0.15rem 0.4rem;
  border-radius: 4px;
  font-size: 0.85rem;
  color: var(--text);
  border: 1px solid rgba(127,87,255,0.28);
}
body.page-minigames .mg-card .gold { color: var(--gold); }
body.page-minigames .mg-card .brand-2 { color: var(--brand-2); }
body.page-minigames .mg-card .danger { color: var(--danger); }

body.page-minigames .bonus-rewards-container {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin-top: 2rem;
}
body.page-minigames .bonus-card {
  background: rgba(127,87,255,0.10);
  border: 1px solid rgba(127,87,255,0.30);
  border-radius: 10px;
  padding: 1.3rem 1.2rem;
  transition: transform 0.26s ease, border-color 0.28s ease, box-shadow 0.3s ease, background 0.28s ease;
}
body.page-minigames .bonus-card:hover {
  transform: translateY(-4px);
  border-color: var(--bingo-accent-purple);
  background: rgba(127,87,255,0.18);
  box-shadow:
    0 0 0 2px rgba(127,87,255,0.28),
    0 8px 20px -6px rgba(0,0,0,0.55);
}
body.page-minigames .bonus-card.collapsed { padding: 1rem 1.1rem; min-height: 3rem; }
body.page-minigames .bonus-card.collapsed .bonus-content { display: none; }
body.page-minigames .bonus-card-header { display: flex; justify-content: space-between; align-items: center; gap: 0.9rem; }
body.page-minigames .bonus-card strong { color: var(--text); font-size: 1rem; font-weight: 700; }
body.page-minigames .bonus-minimize-btn {
  background: rgba(127,87,255,0.06);
  border: 1px solid rgba(127,87,255,0.25);
  color: rgba(255,255,255,0.8);
  padding: 0.35rem 0.55rem;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.95rem;
  line-height: 1;
  transition: background 0.25s ease, color 0.25s ease, border-color 0.25s ease;
}
body.page-minigames .bonus-minimize-btn:hover {
  background: rgba(127,87,255,0.12);
  border-color: rgba(127,87,255,0.35);
  color: #fff;
}
body.page-minigames .bonus-content { margin-top: 0.75rem; }
body.page-minigames .bonus-card p { margin: 0.5rem 0; color: var(--text); font-size: 0.9rem; }
body.page-minigames .bonus-card .bonus-amount { font-size: 1.1rem; color: var(--gold); font-weight: 700; margin: 0.4rem 0; }
body.page-minigames .bonus-card .bonus-condition { font-size: 0.8rem; color: var(--muted); margin-top: 0.4rem; }

body.page-minigames .mg-rewards-card {
  background: linear-gradient(135deg, rgba(255, 215, 0, 0.08), rgba(255, 165, 0, 0.04));
  border: 2px solid var(--gold);
  border-radius: 14px;
  padding: 2rem;
  box-shadow: 0 8px 24px rgba(255, 215, 0, 0.18);
  position: relative;
  overflow: hidden;
  margin-top: 2rem;
}
body.page-minigames .mg-rewards-card .mg-rewards-title {
  color: var(--gold);
  margin: 0 0 1rem 0;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
body.page-minigames .mg-rewards-card .emoji { font-size: 1.5rem; }
body.page-minigames .mg-rewards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
}
body.page-minigames .mg-reward-item {
  background: var(--card-surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1.25rem;
  text-align: center;
  transition: transform 0.26s ease, border-color 0.28s ease, box-shadow 0.3s ease, background 0.28s ease;
  position: relative;
}
body.page-minigames .mg-reward-item:hover {
  transform: translateY(-4px);
  border-color: var(--gold);
  background: linear-gradient(135deg, rgba(255,215,0,0.18), rgba(255,165,0,0.06)); /* subtle gold glow */
  box-shadow:
    0 0 0 2px rgba(255,215,0,0.35),
    0 8px 20px -6px rgba(0,0,0,0.55),
    0 0 24px rgba(255,215,0,0.30);
}
body.page-minigames .mg-reward-place { font-size: 2rem; margin-bottom: 0.5rem; }
body.page-minigames .mg-reward-label {
  font-size: 0.9rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 0.5rem;
  font-weight: 600;
}
body.page-minigames .mg-reward-amount {
  font-size: 1.6rem;
  font-weight: 900;
  color: var(--gold);
  text-shadow: 0 2px 4px rgba(255, 215, 0, 0.25);
}

body.page-minigames .mg-image-modal {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.85);
  z-index: 10000;
  justify-content: center;
  align-items: center;
  opacity: 0;
  transition: opacity 0.25s ease;
}
body.page-minigames .mg-image-modal.active { display: flex; opacity: 1; }
body.page-minigames .mg-image-modal-content {
  position: relative;
  max-width: 90vw;
  max-height: 90vh;
  display: flex; justify-content: center; align-items: center;
}
body.page-minigames .mg-image-modal-content img {
  max-width: 100%;
  max-height: 90vh;
  object-fit: contain;
  border-radius: 14px;
  box-shadow: 0 10px 40px rgba(0,0,0,0.7);
}
body.page-minigames .mg-image-modal-close {
  position: absolute;
  top: 20px; right: 30px;
  font-size: 2.4rem; font-weight: 700; color: #fff;
  cursor: pointer; transition: color 0.2s ease; user-select: none;
}
body.page-minigames .mg-image-modal-close:hover { color: var(--bingo-accent-purple); }

@media (max-width: 768px) {
  body.page-minigames .mg-stats-grid { grid-template-columns: repeat(2, 1fr); }
  body.page-minigames .mg-rewards-grid { grid-template-columns: 1fr; }
}