/* ===== mini-games hub + "Button" game page ===== */

/* header balance chip (mini-games hub) */
.bg-head-right { margin-left: auto; display: flex; align-items: center; gap: 12px; }
.bg-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 8px 14px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.05);
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 14px;
  color: var(--text);
}
.bg-chip b { color: var(--gold, #ffd76a); font-weight: 700; }

.bg-wrap { padding-top: 26px; }

/* button-game container: main#top grid already puts live-drop left;
   this is the right-hand content column with breathing room */
.bg-container { padding: 80px 0 120px; min-width: 0; }

/* top-level game layout: left picks panel + right game */
.bg-layout {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  gap: 20px;
  align-items: start;
}
@media (max-width: 900px) {
  .bg-layout { grid-template-columns: 1fr; }
}

/* left: selected skins panel */
.bg-picks {
  position: sticky;
  top: calc(var(--header-h) + 16px);
  border: 1px solid var(--border);
  border-radius: 18px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.045), rgba(255, 255, 255, 0.012));
  padding: 14px;
}
.bg-picks-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--muted-2);
  margin-bottom: 10px;
}
.bg-picks-head b { color: var(--gold, #ffd76a); font-family: var(--font-display); letter-spacing: 0; font-size: 14px; }
.bg-selected { display: flex; flex-wrap: wrap; gap: 8px; min-height: 36px; align-content: flex-start; }
.bg-sel-empty { font-size: 12px; color: var(--muted-2); }
.bg-sel-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 4px 8px 4px 4px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.045);
  font-size: 12px;
}
.bg-sel-chip img { width: 28px; height: 28px; object-fit: contain; border-radius: 6px; }
.bg-chip-x {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--muted-2);
  font-size: 15px;
  line-height: 1;
  cursor: pointer;
  padding: 0 2px;
}
.bg-chip-x:hover { color: #ff8a96; }

/* right: the game itself */
.bg-center {
  position: relative;
  border: 1px solid var(--border);
  border-radius: 22px;
  background:
    radial-gradient(900px 320px at 50% -10%, rgba(76, 123, 255, 0.18), transparent 60%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.05), rgba(255, 255, 255, 0.012));
  padding: 22px 18px 24px;
  box-shadow: var(--shadow-card);
}
.bg-rules-btn {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.05);
  color: var(--muted);
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 16px;
  cursor: pointer;
  transition: all 0.18s ease;
  z-index: 5;
}
.bg-rules-btn:hover { color: #fff; border-color: rgba(255, 255, 255, 0.4); background: rgba(255, 255, 255, 0.12); }

.bg-stats { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; padding-right: 40px; }
.bg-stat {
  min-width: 128px;
  padding: 10px 14px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.04);
  text-align: center;
}
.bg-stat span { display: block; font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.12em; color: var(--muted-2); }
.bg-stat b { display: block; margin-top: 2px; font-family: var(--font-display); font-size: 17px; color: var(--text); }
.bg-stat--profit b { color: var(--green); }

.bg-idle-title {
  margin: 0;
  font-family: 'Mountains of Christmas', 'Caveat', cursive;
  font-size: clamp(18px, 2vw, 26px);
  font-weight: 700;
  letter-spacing: 0.02em;
  line-height: 1.15;
  filter: drop-shadow(0 0 14px rgba(76, 123, 255, 0.22));
}
.bg-idle-title .t-blue { color: var(--blue-bright, #6B9BFF); }
.bg-idle-title .t-white { color: #ffffff; }

/* game toolbar (sound + info) */
.bg-toolbar {
  position: absolute;
  top: 14px;
  right: 14px;
  z-index: 6;
  display: flex;
  gap: 8px;
}
.bg-tool-btn {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.05);
  color: var(--muted);
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: all 0.18s ease;
}
.bg-tool-btn svg { width: 16px; height: 16px; }
.bg-tool-btn:hover { color: #fff; border-color: rgba(255, 255, 255, 0.4); background: rgba(255, 255, 255, 0.12); }
.bg-tool-btn.is-active { color: #fff; border-color: rgba(76, 123, 255, 0.6); background: rgba(76, 123, 255, 0.18); }

/* wheel */
.bg-wheel-wrap {
  position: relative;
  width: min(520px, 92vw);
  aspect-ratio: 1;
  margin: 16px auto 6px;
}
.bg-wheel-wrap::before {
  content: '';
  position: absolute;
  inset: -12px;
  border-radius: 50%;
  border: 2px solid rgba(107, 155, 255, 0.22);
  background:
    radial-gradient(circle, transparent 62%, rgba(76, 123, 255, 0.06) 63%, transparent 66%),
    radial-gradient(circle, rgba(76, 123, 255, 0.10), transparent 70%);
  box-shadow: 0 0 50px rgba(76, 123, 255, 0.16), inset 0 0 40px rgba(76, 123, 255, 0.10);
  pointer-events: none;
}
.bg-wheel-divs {
  position: absolute;
  inset: 4%;
  border-radius: 50%;
  z-index: 0;
  background: repeating-conic-gradient(from 0deg, rgba(107, 155, 255, 0.22) 0deg 0.7deg, transparent 0.7deg 30deg);
  -webkit-mask: radial-gradient(circle, transparent 54%, #000 55%);
  mask: radial-gradient(circle, transparent 54%, #000 55%);
  pointer-events: none;
}
.bg-arrow {
  position: absolute;
  top: -4px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 6;
  font-size: 15px;
  line-height: 1;
  color: #6B9BFF;
  filter: drop-shadow(0 0 6px rgba(107, 155, 255, 0.8));
}
.bg-ring { position: absolute; inset: 0; will-change: transform; }
.bg-ring::before {
  content: '';
  position: absolute;
  inset: 16%;
  border-radius: 50%;
  border: 1px dashed rgba(255, 255, 255, 0.12);
}
.bg-ring-item {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 62px;
  height: 62px;
  margin: -31px;
  border-radius: 13px;
  overflow: hidden;
  border: 1px solid var(--border-strong);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.02));
  box-shadow: 0 8px 18px -10px rgba(0, 0, 0, 0.7);
}
.bg-ring-item img { width: 100%; height: 100%; object-fit: contain; }

.bg-bigbtn {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 176px;
  height: 176px;
  border-radius: 50%;
  border: 1px solid rgba(107, 155, 255, 0.55);
  background:
    radial-gradient(circle at 50% 28%, rgba(120, 170, 255, 0.55), rgba(30, 60, 140, 0.85) 62%, rgba(14, 24, 52, 0.98));
  color: #fff;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  box-shadow: 0 0 0 6px rgba(76, 123, 255, 0.10), 0 18px 40px -14px rgba(40, 90, 220, 0.8), inset 0 2px 10px rgba(255, 255, 255, 0.25);
  transition: transform 0.15s ease, filter 0.15s ease;
  z-index: 5;
}
.bg-bigbtn:hover:not(:disabled) { transform: translate(-50%, -50%) scale(1.04); filter: brightness(1.08); }
.bg-bigbtn:active:not(:disabled) { transform: translate(-50%, -50%) scale(0.97); }
.bg-bigbtn:disabled { opacity: 0.55; cursor: default; }
.bg-bigbtn-mult { font-family: var(--font-display); font-size: 36px; font-weight: 700; letter-spacing: 0.02em; }
.bg-bigbtn-lbl { font-family: var(--font-display); font-size: 11px; letter-spacing: 0.24em; color: rgba(255, 255, 255, 0.75); }
.bg-bigbtn.is-spinning { animation: bgPulse 0.6s ease-in-out infinite alternate; }
@keyframes bgPulse { from { filter: brightness(1); } to { filter: brightness(1.22); } }

.bg-result {
  min-height: 74px;
  margin: 32px auto 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  text-align: center;
  font-size: 14px;
  color: var(--muted);
}
.bg-result .bg-res-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 14px 8px 8px;
  border-radius: 14px;
  border: 1px solid var(--border-strong);
  background: rgba(255, 255, 255, 0.05);
  animation: bgPop 0.35s cubic-bezier(0.2, 0.8, 0.3, 1.3) both;
}
.bg-result .bg-res-card img { width: 52px; height: 52px; object-fit: contain; }
.bg-res-name { font-size: 13px; font-weight: 700; color: var(--text); }
.bg-res-price { font-size: 12px; color: var(--gold, #ffd76a); }
.bg-result.is-bust { color: #ff8a96; font-weight: 700; }
.bg-result.is-win { color: var(--green); font-weight: 700; }
@keyframes bgPop { from { opacity: 0; transform: scale(0.8); } to { opacity: 1; transform: scale(1); } }

.bg-controls { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; min-height: 46px; align-items: center; }
.bg-ctrl { min-width: 180px; }
.bg-ctrl[hidden] { display: none; }

/* inventory block, separated below */
.bg-inv-block {
  margin-top: 26px;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.02);
  padding: 16px 16px 18px;
}
.bg-inv-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.bg-inv-head h3 { margin: 0; font-family: var(--font-display); font-size: 14px; letter-spacing: 0.06em; }
.bg-inv-hint { font-size: 11px; color: var(--muted-2); }
.bg-inv {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(102px, 1fr));
  gap: 10px;
  max-height: 420px;
  overflow-y: auto;
  padding-right: 4px;
}
.bg-item {
  position: relative;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 8px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.05), rgba(255, 255, 255, 0.02));
  cursor: pointer;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
}
.bg-item:hover { transform: translateY(-2px); border-color: rgba(76, 123, 255, 0.5); }
.bg-item img { width: 100%; aspect-ratio: 1; object-fit: contain; display: block; }
.bg-item-name { margin-top: 6px; font-size: 10.5px; line-height: 1.25; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bg-item-price { margin-top: 2px; font-size: 11px; font-weight: 700; color: var(--gold, #ffd76a); }
.bg-item.is-selected {
  border-color: var(--blue-bright, #6B9BFF);
  box-shadow: 0 0 0 1px rgba(107, 155, 255, 0.6), 0 12px 26px -14px rgba(76, 123, 255, 0.8);
  background: rgba(76, 123, 255, 0.12);
}
.bg-item.is-locked { opacity: 0.5; }
.bg-item-check {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--blue-bright, #6B9BFF);
  color: #06122e;
  display: none;
  place-items: center;
  font-size: 13px;
  font-weight: 900;
}
.bg-item.is-selected .bg-item-check { display: grid; }
.bg-empty { grid-column: 1 / -1; padding: 24px; text-align: center; color: var(--muted-2); font-size: 13px; }

/* guest notice */
.bg-notice {
  max-width: 520px;
  margin: 40px auto;
  padding: 28px;
  border-radius: 18px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.04);
  text-align: center;
}
.bg-notice h2 { font-family: var(--font-display); margin-bottom: 8px; }
.bg-notice p { color: var(--muted); margin-bottom: 16px; }

/* rules modal */
.bg-modal {
  position: fixed;
  inset: 0;
  z-index: 400;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgba(6, 10, 22, 0.72);
  backdrop-filter: blur(6px);
}
.bg-modal[hidden] { display: none; }
.bg-modal-card {
  position: relative;
  width: min(560px, 100%);
  max-height: 86vh;
  overflow-y: auto;
  padding: 24px;
  border-radius: 20px;
  border: 1px solid var(--border-strong);
  background: linear-gradient(180deg, rgba(24, 30, 52, 0.99), rgba(11, 16, 32, 1));
  box-shadow: 0 40px 100px -30px rgba(0, 0, 0, 0.9);
}
.bg-modal-card h2 { margin: 0 0 4px; font-family: var(--font-display); font-size: 20px; }
.bg-modal-card .bg-sub { margin: 0 0 16px; font-size: 12px; color: var(--muted-2); letter-spacing: 0.08em; text-transform: uppercase; }
.bg-step { display: flex; gap: 12px; margin-bottom: 12px; }
.bg-step-n {
  flex: 0 0 auto;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: rgba(76, 123, 255, 0.18);
  border: 1px solid rgba(76, 123, 255, 0.5);
  color: var(--blue-bright, #6B9BFF);
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 13px;
}
.bg-step b { display: block; font-size: 13.5px; margin-bottom: 2px; }
.bg-step p { margin: 0; font-size: 12.5px; line-height: 1.5; color: var(--muted); }
.bg-tip {
  margin-top: 8px;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid rgba(76, 123, 255, 0.3);
  background: rgba(76, 123, 255, 0.08);
  font-size: 12.5px;
  line-height: 1.5;
  color: #cfe0ff;
}
.bg-modal-x {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.05);
  color: var(--muted);
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
}
.bg-modal-x:hover { color: #fff; background: rgba(255, 255, 255, 0.12); }

/* ===== mini-games hub ===== */
.games-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 18px;
  margin-top: 22px;
}
.game-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 20px;
  border-radius: 20px;
  border: 1px solid var(--border);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.055), rgba(255, 255, 255, 0.015));
  transition: transform 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
  text-decoration: none;
}
.game-card:hover {
  transform: translateY(-3px);
  border-color: rgba(76, 123, 255, 0.5);
  box-shadow: 0 24px 50px -24px rgba(76, 123, 255, 0.7);
}
.game-card__art {
  height: 130px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  background:
    radial-gradient(300px 160px at 50% 10%, rgba(76, 123, 255, 0.35), transparent 70%),
    rgba(255, 255, 255, 0.03);
  overflow: hidden;
}
.game-card__art img { width: 100%; height: 100%; object-fit: cover; }
.game-card h3 { margin: 0; font-family: var(--font-display); font-size: 17px; letter-spacing: 0.03em; }
.game-card p { margin: 0; font-size: 12.5px; line-height: 1.5; color: var(--muted); flex: 1; }
.game-card__badge {
  position: absolute;
  top: 14px;
  left: 14px;
  padding: 4px 9px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #06122e;
  background: linear-gradient(180deg, #bfe6ff, #6fb7ff);
}
.game-card__cta {
  align-self: flex-start;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 13px;
  color: var(--blue-bright, #6B9BFF);
}
.game-card__cta svg { width: 15px; height: 15px; }

/* toast */
.bg-toast {
  position: fixed;
  left: 50%;
  bottom: 26px;
  transform: translateX(-50%);
  z-index: 500;
  padding: 11px 18px;
  border-radius: 12px;
  border: 1px solid var(--border-strong);
  background: rgba(20, 26, 46, 0.97);
  color: #fff;
  font-size: 13px;
  box-shadow: 0 18px 44px -16px rgba(0, 0, 0, 0.8);
  animation: bgToastIn 0.25s ease both;
  max-width: calc(100vw - 24px);
  text-align: center;
}
.bg-toast.is-err { border-color: rgba(255, 93, 108, 0.6); color: #ffb3ba; }
.bg-toast.is-out { opacity: 0; transform: translateX(-50%) translateY(8px); transition: opacity 0.3s ease, transform 0.3s ease; }
@keyframes bgToastIn { from { opacity: 0; transform: translateX(-50%) translateY(10px); } to { opacity: 1; transform: translateX(-50%) translateY(0); } }

/* guest: no left live-drop, single centered column */
body.bg-guest main#top { display: block; }
body.bg-guest .live-drop { display: none; }

/* inventory/shop (library-style) */
.bg-inv-head .tabs { display: flex; gap: 6px; }
.bg-filter {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
}
.bg-filter input[type="search"] {
  flex: 1;
  min-width: 0;
  padding: 9px 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.05);
  color: var(--text);
  font-size: 13px;
  outline: none;
}
.bg-filter input[type="search"]:focus { border-color: rgba(76, 123, 255, 0.5); }
.bg-filter input[type="number"] {
  width: 80px;
  flex: 0 0 auto;
  padding: 9px 10px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.05);
  color: var(--text);
  font-size: 13px;
  outline: none;
}
.bg-filter input[type="number"]:focus { border-color: rgba(76, 123, 255, 0.5); }
.bg-filter select.filter-cat {
  padding: 9px 10px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.05);
  color: var(--text);
  font-size: 13px;
  outline: none;
  cursor: pointer;
}
.bg-inv-block .inv-grid { min-height: 160px; }
.skin-card.is-locked { opacity: 0.5; pointer-events: none; }

/* integrated game view (main SPA) */
#buttonGame[hidden] { display: none; }
body.button-game-open #upgrader,
body.button-game-open #library { display: none; }
body.button-game-open #buttonGame { display: block; }
.button-game { padding: calc(var(--header-h) + 30px) 0 90px; }
.bg-game-head { margin-bottom: 16px; }
.button-game .inv-grid {
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  gap: 12px;
  max-height: 560px;
}
.button-game .skin-card { border-radius: 12px; }
