/* Voodoo Plinko
 *
 * Match production reference (screencapture / plinko.voodootoken.com):
 * - Green neon arena art full-bleed (cover + center, no letterbox)
 * - Large PLINKO logo sits BEHIND the board (top of frame)
 * - Prize color wedges visible along the bottom edge
 * - White pegs / green grid show through around controls (no glass card)
 * - body::before at opacity 0.9 over near-black green (not blue-tinted)
 */
/*
 * Scroll model for modern Chrome/Edge (same fix as StakingPlatform-V4):
 * Overlay root scrollbars ignore ::-webkit-scrollbar on body/html.
 * Scroll happens on #page-scroll.windows-scrollbar so the EXACT plugin CSS
 * (.windows-scrollbar::-webkit-*) applies and is visible.
 * Plugin CSS file: css/windows-scrollbar.css (unchanged 1:1 rules).
 */
html {
  height: 100%;
  min-height: 100vh;
  min-height: 100dvh;
  overflow: hidden;
  background-color: #010f01;
}

body {
  color: white;
  font-family: Arial, Helvetica, sans-serif;
  margin: 0;
  padding: 0;
  position: relative;
  user-select: none;
  height: 100%;
  min-height: 100%;
  /* Match art edge green-black so 0.9 opacity does not blue-tint the bg */
  background-color: #010f01;
  overflow: hidden; /* scroll is on #page-scroll */
  box-sizing: border-box;
  display: block;
}

/* Scrolling element — must have class windows-scrollbar (plugin selectors) */
#page-scroll {
  position: relative;
  z-index: 1;
  height: 100%;
  max-height: 100vh;
  max-height: 100dvh;
  overflow-x: hidden;
  overflow-y: scroll; /* always show classic scrollbar track */
  -webkit-overflow-scrolling: touch;
  width: 100%;
  min-height: 100%;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
}

/* Full-viewport layer — same framing as the reference photo */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  background-color: #010f01;
  background-image: url("../plinko-background.png");
  background-repeat: no-repeat;
  /* Bias upward so the big PLINKO letters sit above the board */
  background-position: center 28%;
  background-size: cover;
  opacity: 0.9;
  z-index: 0;
  pointer-events: none;
}

/* Content above the art (page-scroll and portals) */
body > * {
  position: relative;
  z-index: 1;
}

#page-scroll > * {
  position: relative;
  z-index: 1;
}

.header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 25px;
  background: transparent;
  flex-wrap: wrap;
  gap: 10px;
}

.logo {
  font-size: 24px;
  font-weight: bold;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.6);
}

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

.wallet-btn {
  min-width: 9.5rem;
  height: 2.4rem;
  padding: 0 14px;
  border: none;
  border-radius: 6px;
  font-weight: bold;
  font-size: 13px;
  color: white;
  cursor: pointer;
  font-family: ui-monospace, Consolas, monospace;
}

.wallet-btn-voodoo {
  background: #073749;
}
.wallet-btn-voodoo:hover:not(:disabled) {
  background: #0a4a61;
}

.wallet-btn-other {
  background: #1e88e5;
}
.wallet-btn-other:hover:not(:disabled) {
  background: #1565c0;
}

/* Connected: keep each button’s original colour (Voodoo teal stays teal) */
.wallet-btn.is-connected,
.wallet-btn.connected {
  cursor: default;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.25);
}

.wallet-btn-voodoo.is-connected,
.wallet-btn-voodoo.connected,
.wallet-btn-voodoo.is-connected:hover,
.wallet-btn-voodoo.connected:hover {
  background: #073749 !important;
}

.wallet-btn-other.is-connected,
.wallet-btn-other.connected,
.wallet-btn-other.is-connected:hover,
.wallet-btn-other.connected:hover {
  background: #1e88e5 !important;
}

.wallet-btn:disabled {
  opacity: 0.9;
  cursor: default;
}

#rainbowkit-root {
  position: fixed;
  width: 0;
  height: 0;
  overflow: visible;
  z-index: 2147483000;
  pointer-events: none;
}

/* Keep same framing on all large screens (match reference photo) */
@media (min-width: 1200px) {
  body::before {
    background-size: cover;
    background-position: center 28%;
  }
}

.container {
  display: flex;
  max-width: 1000px;
  margin: 20px auto;
  padding: 20px;
  gap: 25px;
  flex-wrap: wrap;
}

/* Transparent like production so pegs/grid show through (reference photo) */
.controls {
  width: 280px;
  flex-shrink: 0;
  background: transparent;
  border: none;
  border-radius: 0;
  padding: 0;
  backdrop-filter: none;
}

.input-group {
  margin-bottom: 16px;
}

label {
  display: block;
  margin-bottom: 6px;
  font-size: 13px;
  color: #a0b0c0;
}

input,
select {
  width: 100%;
  padding: 10px;
  background: #1e2a3a;
  border: 1px solid #334455;
  border-radius: 6px;
  color: white;
  box-sizing: border-box;
  font-size: 14px;
}

.bet-controls {
  display: flex;
  gap: 8px;
  margin-top: 6px;
}

.bet-btn {
  flex: 1;
  padding: 8px;
  background: #2a3b4c;
  border: none;
  border-radius: 6px;
  color: white;
  cursor: pointer;
  font-size: 13px;
}

.bet-btn:hover {
  background: #3a4b5c;
}

.bet-button {
  width: 100%;
  padding: 14px;
  border: none;
  border-radius: 8px;
  font-size: 16px;
  font-weight: bold;
  cursor: pointer;
}

.bet-button:disabled {
  background: #555 !important;
  cursor: not-allowed;
  opacity: 0.6;
}

#betBtn {
  background: #00ff9d;
  color: black;
}

#status {
  text-align: center;
  margin: 10px 0;
  font-size: 14px;
  color: #ffcc00;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.8);
  min-height: 1.4em;
  font-weight: 600;
}

.game-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 280px;
}

.board {
  position: relative;
  width: 640px;
  max-width: 100%;
  height: 520px;
  /* Solid like production reference — not glass */
  background: #161b22;
  border: 1px solid #334455;
  border-radius: 14px;
  margin-bottom: 20px;
  overflow: hidden;
}

.triangle {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 40px 0 60px;
}

.row {
  display: flex;
  justify-content: center;
  margin-bottom: 20px;
}

.peg {
  width: 9px;
  height: 9px;
  background: #e0e0e0;
  border-radius: 50%;
  margin: 0 18px;
  box-shadow: 0 0 6px rgba(224, 224, 224, 0.5);
}

.ball {
  position: absolute;
  width: 31px;
  height: 31px;
  background: #4caf50;
  border-radius: 50%;
  left: 50%;
  top: -40px;
  transform: translateX(-50%);
  box-shadow: 0 0 12px #4caf50;
  z-index: 20;
  transition: opacity 0.15s ease;
}

.multipliers {
  position: absolute;
  bottom: 25px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  justify-content: center;
  width: 92%;
  max-width: 560px;
  gap: 4px;
  z-index: 10;
}

.multiplier-slot {
  flex: 1;
  text-align: center;
  min-width: 42px;
}

.multi-value {
  font-size: 11px;
  font-weight: bold;
  margin-bottom: 4px;
  color: #ffffff;
  background: rgba(0, 0, 0, 0.7);
  padding: 2px 6px;
  border-radius: 4px;
  display: inline-block;
}

.multi {
  padding: 5px 3px;
  border-radius: 5px;
  font-size: 11px;
  font-weight: bold;
  color: white;
  min-height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.6);
}

.multi.great {
  background: #388e3c;
}
.multi.good {
  background: #4caf50;
}
.multi.average {
  background: #fbc02d;
}
.multi.bad {
  background: #d32f2f;
}

.bounce {
  animation: bounce 0.6s ease-in-out 3 alternate;
}

@keyframes bounce {
  from {
    transform: translateY(0);
  }
  to {
    transform: translateY(8px);
  }
}

.bounce-peg {
  animation: bounce-peg 0.2s ease-in-out;
}

@keyframes bounce-peg {
  0%,
  100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.1);
  }
}

.ball.bounce {
  animation: ball-bounce 0.2s ease-in-out;
}

@keyframes ball-bounce {
  0%,
  100% {
    transform: translateX(-50%) translateY(0) scale(1, 1);
  }
  50% {
    transform: translateX(-50%) translateY(3px) scale(1.1, 0.9);
  }
}

.footer {
  text-align: center;
  padding: 30px 20px;
  color: #8899aa;
  font-size: 12px;
  flex-shrink: 0;
  margin-top: auto;
  width: 100%;
  box-sizing: border-box;
}

/* Lock page scroll while VoodooUI modal is open */
body.voodoo-ui-open #page-scroll {
  overflow: hidden;
}

.footer a {
  color: #8899aa;
  text-decoration: none;
}

.footer a:hover {
  color: #fff;
}

#riskSelect,
#rowsSelect {
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  background-image: none;
}

/* ui.js modals — identical on Plinko + Miner (no page font bleed) */
body.voodoo-ui-open {
  overflow: hidden;
}

.voodoo-ui-modal {
  position: fixed;
  inset: 0;
  z-index: 2147483001;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  /* Self-contained type — ignore body / page h2 rules */
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: 16px;
  font-weight: 400;
  line-height: 1.5;
  color: #111;
  -webkit-font-smoothing: antialiased;
}

.voodoo-ui-modal.hidden {
  display: none !important;
}

.voodoo-ui-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
}

.voodoo-ui-panel {
  position: relative;
  background: #fff;
  color: #111;
  border-radius: 12px;
  padding: 1.5rem;
  max-width: 420px;
  width: 100%;
  text-align: center;
  font-family: inherit;
  font-size: inherit;
  font-weight: inherit;
}

.voodoo-ui-title {
  margin: 0 0 0.5rem;
  padding: 0;
  font-family: inherit;
  font-size: 1.25rem;
  font-weight: 600;
  line-height: 1.3;
  color: #111;
  letter-spacing: normal;
}

.voodoo-ui-message {
  margin: 0 0 1rem;
  padding: 0;
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 400;
  line-height: 1.5;
  color: #374151;
  white-space: pre-wrap;
}

.voodoo-ui-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  justify-content: center;
}

.voodoo-ui-btn {
  border: none;
  border-radius: 8px;
  padding: 0.55rem 1rem;
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
}

.voodoo-ui-btn-primary {
  background: #1e40af;
  color: #fff;
}

.voodoo-ui-btn-secondary {
  background: #e5e7eb;
  color: #111;
  text-decoration: none;
  display: inline-flex;
}

.voodoo-ui-btn-ghost {
  background: transparent;
  color: #4b5563;
}

.voodoo-ui-icon {
  width: 48px;
  height: 48px;
  margin: 0 auto 0.75rem;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: inherit;
  font-size: 1.5rem;
  font-weight: 700;
  color: #111;
  background: #e5e7eb;
}

@media (max-width: 900px) {
  .container {
    flex-direction: column;
    align-items: center;
  }
  .controls {
    width: 100%;
    max-width: 400px;
  }
  .board {
    height: auto;
    min-height: 480px;
  }
  .peg {
    margin: 0 12px;
  }
}
