/* Wild-west theme honoring the original 2017 mockups. */

:root {
  --plank-dark:  #3a200e;
  --plank-mid:   #5a2f15;
  --plank-light: #8a4a20;
  --grain:       #2a1408;
  --paper:       #f0d6a1;
  --paper-edge:  #b59558;
  --ink:         #2b160a;
  --accent:      #c8331f;
  --gold:        #f7d979;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; min-height: 100%; font-family: 'Georgia', 'Times New Roman', serif; color: var(--paper); }

/* ── WOOD PANELING BACKGROUND ─────────────────────────────────────────────
   Real wood texture from an SVG (turbulence-generated grain + plank seams +
   knots). Tiled vertically; sized to ~6 planks across at 480px so seams
   read at a believable scale on mobile. Vignette layered on top.
   ────────────────────────────────────────────────────────────────────────── */
body {
  background-color: #4a2810;
  background-image:
    radial-gradient(ellipse at center, transparent 30%, rgba(0,0,0,0.55) 100%),
    url('../assets/wood-paneling.svg');
  background-size: auto, 480px auto;
  background-repeat: no-repeat, repeat;
  background-attachment: fixed, fixed;
  min-height: 100vh;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

.app {
  width: 100%;
  max-width: 440px;
  min-height: 100vh;
  margin: 0 auto;
  padding: 14px 14px 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

/* ── TOPBAR ───────────────────────────────────────────────────────────── */
.topbar {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}
.coin-pill {
  background: #1f0d04;
  border: 2px solid var(--paper-edge);
  border-radius: 999px;
  padding: 5px 14px;
  font-weight: bold;
  color: var(--gold);
  font-size: 15px;
  letter-spacing: 0.5px;
  box-shadow: inset 0 0 6px rgba(0,0,0,0.5), 0 2px 0 rgba(0,0,0,0.4);
}

.subtle {
  background:
    linear-gradient(180deg, #6b3a18 0%, #4a2810 100%);
  border: 2px solid #1f0d04;
  border-radius: 6px;
  color: var(--paper);
  padding: 6px 12px;
  cursor: pointer;
  font-family: inherit;
  font-size: 13px;
  font-weight: bold;
  letter-spacing: 0.5px;
  box-shadow: 0 2px 0 rgba(0,0,0,0.4), inset 0 1px 0 rgba(255,220,170,0.2);
  text-shadow: 1px 1px 0 rgba(0,0,0,0.5);
}
.subtle:active { transform: translateY(1px); box-shadow: 0 1px 0 rgba(0,0,0,0.4); }

.mute-btn {
  background: transparent;
  border: 2px solid var(--paper-edge);
  border-radius: 50%;
  width: 36px; height: 36px;
  font-size: 18px;
  cursor: pointer;
  color: var(--gold);
}

/* ── METAMASK WALLET ROW ───────────────────────────────────────────── */
.wallet-row {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}
.wallet-btn {
  background: linear-gradient(180deg, #f6851b 0%, #d96718 100%);
  border: 3px solid #1f0d04;
  border-radius: 8px;
  color: #fff;
  font-family: inherit;
  font-weight: 900;
  font-size: 13px;
  letter-spacing: 1px;
  padding: 8px 14px;
  cursor: pointer;
  box-shadow: 0 3px 0 rgba(0,0,0,0.45), inset 0 1px 0 rgba(255,220,170,0.3);
  text-shadow: 1px 1px 0 rgba(0,0,0,0.5);
}
.wallet-btn:active { transform: translateY(2px); box-shadow: 0 1px 0 rgba(0,0,0,0.45); }
.wallet-btn[disabled] { background: #5a4a3a; color: #aaa; cursor: not-allowed; }
.wallet-info {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #1f0d04;
  border: 2px solid var(--paper-edge);
  border-radius: 999px;
  padding: 4px 6px 4px 12px;
  color: var(--paper);
  font-size: 12px;
  font-weight: bold;
}
.wallet-addr { color: var(--gold); letter-spacing: 0.5px; }
.wallet-bal  { color: var(--paper); }
.wallet-hint {
  margin-top: 4px;
  font-size: 11px;
  letter-spacing: 0.5px;
  padding: 3px 8px;
  border-radius: 4px;
}
.wallet-hint.ok   { background: rgba(70, 120, 60, 0.4); color: #d8efb6; }
.wallet-hint.warn { background: rgba(200, 51, 31, 0.45); color: #ffe7d8; }

/* ── BUY USDC SHORTCUT ─────────────────────────────────────────────── */
.buy-btn {
  background: linear-gradient(180deg, #4ea861 0%, #2f7a44 100%);
  border: 2px solid #1f0d04;
  border-radius: 999px;
  color: #fff;
  font-family: inherit;
  font-weight: 900;
  font-size: 12px;
  letter-spacing: 1px;
  padding: 6px 12px;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  box-shadow: 0 2px 0 rgba(0,0,0,0.4), inset 0 1px 0 rgba(255,255,255,0.25);
  text-shadow: 1px 1px 0 rgba(0,0,0,0.5);
}
.buy-btn:active { transform: translateY(1px); box-shadow: 0 1px 0 rgba(0,0,0,0.4); }

/* ── WALLET GATE OVERLAY ───────────────────────────────────────────── */
.wallet-gate {
  position: fixed;
  inset: 0;
  background: rgba(10, 4, 0, 0.85);
  backdrop-filter: blur(3px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 20px;
}
.wallet-gate-card {
  background:
    radial-gradient(ellipse at center, var(--paper) 60%, var(--paper-edge) 100%);
  border: 4px solid var(--ink);
  border-radius: 10px;
  padding: 24px 20px;
  max-width: 360px;
  width: 100%;
  text-align: center;
  color: var(--ink);
  box-shadow: 6px 6px 0 rgba(0,0,0,0.5);
}
.wallet-gate-title {
  font-weight: 900;
  font-size: 22px;
  letter-spacing: 2px;
  color: var(--accent);
  margin-bottom: 8px;
}
.wallet-gate-card p {
  font-weight: bold;
  margin: 6px 0 16px;
}
.wallet-gate-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* ── TOAST STACK ───────────────────────────────────────────────────── */
.toast-stack {
  position: fixed;
  bottom: 16px;
  right: 16px;
  z-index: 200;
  display: flex;
  flex-direction: column-reverse;
  gap: 8px;
  max-width: 320px;
  pointer-events: none;
}
.toast {
  pointer-events: auto;
  background:
    radial-gradient(ellipse at center, var(--paper) 60%, var(--paper-edge) 100%);
  border: 3px solid var(--ink);
  border-radius: 8px;
  padding: 10px 32px 10px 12px;
  color: var(--ink);
  font-weight: bold;
  font-size: 13px;
  box-shadow: 4px 4px 0 rgba(0,0,0,0.5);
  position: relative;
  transform: translateX(110%);
  transition: transform 0.3s ease-out, opacity 0.3s;
  opacity: 0;
}
.toast.toast-visible { transform: translateX(0); opacity: 1; }
.toast.toast-payout  { background: radial-gradient(ellipse at center, var(--gold) 60%, #c69c2a 100%); }
.toast.toast-refund  { background: radial-gradient(ellipse at center, #cfe2a3 60%, #95b566 100%); }
.toast.toast-stake   { background: radial-gradient(ellipse at center, #f1d6a8 60%, #b59558 100%); }
.toast.toast-error   { background: radial-gradient(ellipse at center, #d6a6a6 60%, #8a4a4a 100%); color: #2b1010; }
.toast.toast-invite  {
  background: radial-gradient(ellipse at center, #cfe2a3 60%, #95b566 100%);
  border-color: #2b4010;
  animation: invite-pulse 1.5s ease-in-out infinite alternate;
}
@keyframes invite-pulse {
  from { box-shadow: 4px 4px 0 rgba(0,0,0,0.5); }
  to   { box-shadow: 4px 4px 0 rgba(0,0,0,0.5), 0 0 14px rgba(151, 200, 100, 0.7); }
}
.toast-join {
  display: inline-block;
  margin-top: 8px;
  padding: 6px 14px;
  background: linear-gradient(180deg, #4ea861 0%, #2f7a44 100%);
  color: #fff;
  border-radius: 6px;
  font-weight: 900;
  font-size: 12px;
  letter-spacing: 1px;
  text-decoration: none;
  text-shadow: 1px 1px 0 rgba(0,0,0,0.5);
  border: 2px solid #1a2810;
}
.toast-join:active { transform: translateY(1px); }
.toast-row {
  display: flex;
  align-items: center;
  gap: 8px;
}
.toast-icon { font-size: 16px; }
.toast-label { letter-spacing: 0.5px; }
.toast-amount { margin-left: auto; font-weight: 900; }
.toast-note {
  font-size: 11px;
  font-weight: normal;
  margin-top: 4px;
  opacity: 0.85;
}
.toast-link {
  display: inline-block;
  margin-top: 6px;
  font-size: 11px;
  font-weight: bold;
  color: #5a2a0a;
  text-decoration: underline;
  letter-spacing: 0.5px;
}
.toast-close {
  position: absolute;
  top: 4px; right: 4px;
  background: transparent;
  border: 0;
  font-size: 14px;
  cursor: pointer;
  color: var(--ink);
  font-weight: bold;
  width: 22px; height: 22px;
  border-radius: 50%;
  line-height: 1;
}
.toast-close:hover { background: rgba(0,0,0,0.08); }

/* ── BUY MODAL ─────────────────────────────────────────────────────── */
.buy-modal {
  position: fixed;
  inset: 0;
  background: rgba(10,4,0,0.85);
  backdrop-filter: blur(3px);
  z-index: 250;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 30px 16px;
  overflow-y: auto;
}
.buy-modal-card {
  background: radial-gradient(ellipse at center, var(--paper) 60%, var(--paper-edge) 100%);
  border: 4px solid var(--ink);
  border-radius: 10px;
  padding: 18px 18px 16px;
  max-width: 420px;
  width: 100%;
  color: var(--ink);
  position: relative;
  box-shadow: 6px 6px 0 rgba(0,0,0,0.5);
}
.buy-modal-card h2 {
  margin: 0 0 6px;
  font-size: 16px;
  letter-spacing: 1.5px;
  color: var(--accent);
}
.buy-modal-card p { font-size: 12px; margin: 4px 0 8px; line-height: 1.5; }
.buy-modal-checklist {
  list-style: none;
  padding: 6px 10px;
  margin: 6px 0 10px;
  background: rgba(0,0,0,0.05);
  border-left: 3px solid var(--accent);
  font-size: 12px;
}
.buy-modal-checklist li { padding: 2px 0; }
.buy-modal-screenshot {
  width: 100%;
  display: block;
  margin: 4px 0 10px;
  border: 2px solid var(--ink);
  border-radius: 4px;
}
.buy-modal-warn {
  background: rgba(200, 51, 31, 0.15);
  border-left: 3px solid var(--accent);
  padding: 6px 10px;
  font-size: 11px;
}
.buy-modal-actions {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 10px;
}
.buy-modal-primary, .buy-modal-secondary {
  display: block;
  text-align: center;
  padding: 9px 12px;
  border-radius: 6px;
  font-weight: 900;
  font-size: 12px;
  letter-spacing: 1px;
  text-decoration: none;
  border: 2px solid var(--ink);
}
.buy-modal-primary {
  background: linear-gradient(180deg, #f6851b 0%, #d96718 100%);
  color: #fff;
  text-shadow: 1px 1px 0 rgba(0,0,0,0.5);
}
.buy-modal-secondary {
  background: linear-gradient(180deg, #6b3a18 0%, #4a2810 100%);
  color: var(--paper);
}
.buy-modal-close {
  position: absolute;
  top: 8px; right: 8px;
  background: transparent;
  border: 0;
  cursor: pointer;
  font-size: 16px;
  font-weight: 900;
  width: 28px; height: 28px;
  border-radius: 50%;
  color: var(--ink);
}
.buy-modal-close:hover { background: rgba(0,0,0,0.08); }

/* ── LOGO PLAQUE ─────────────────────────────────────────────────────── */
.logo {
  width: 78%;
  max-width: 320px;
  filter: drop-shadow(3px 4px 0 rgba(0,0,0,0.5));
  margin: 4px 0;
}

/* ── HEADER SIGN (wood baseboard with title) ─────────────────────────── */
.header-sign {
  width: 100%;
  display: flex;
  justify-content: center;
}
.header-sign img {
  width: 80%;
  max-width: 320px;
  filter: drop-shadow(3px 3px 0 rgba(0,0,0,0.45));
}

/* When the header sign has the empty wood planks (Standoff baseboard),
   layer the B4YB Logo Plaque on top, sitting in the blank plank area. */
.header-sign.with-overlay {
  position: relative;
}
.header-sign.with-overlay .board {
  display: block;
}
.header-sign.with-overlay .overlay {
  position: absolute;
  top: 56%;
  left: 50%;
  width: 56%;
  max-width: 220px;
  transform: translate(-50%, -50%);
  filter: drop-shadow(2px 3px 0 rgba(0,0,0,0.5));
  pointer-events: none;
}

/* ── MENU CARDS (lobby) ──────────────────────────────────────────────── */
.menu-grid {
  width: 100%;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}
.menu-card {
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  filter: drop-shadow(3px 4px 0 rgba(0,0,0,0.5));
  transition: transform 0.08s;
}
.menu-card:active { transform: translateY(2px); }
.menu-card img { width: 100%; display: block; }
.menu-card[disabled] { opacity: 0.55; cursor: not-allowed; filter: grayscale(0.5) drop-shadow(2px 2px 0 rgba(0,0,0,0.4)); }
.menu-card .label {
  text-align: center;
  color: var(--gold);
  font-weight: bold;
  font-size: 13px;
  letter-spacing: 1px;
  margin-top: 4px;
  text-shadow: 1px 1px 0 #000;
}

/* ── PAPER BANNER ─────────────────────────────────────────────────────── */
.banner {
  position: relative;
  background:
    radial-gradient(ellipse at center, var(--paper) 60%, var(--paper-edge) 100%);
  border: 3px solid var(--ink);
  border-radius: 6px;
  padding: 10px 14px;
  text-align: center;
  font-weight: bold;
  color: var(--ink);
  width: 100%;
  box-shadow: 3px 3px 0 rgba(0,0,0,0.4);
  letter-spacing: 0.5px;
}
.banner.win  { background: radial-gradient(ellipse at center, var(--gold) 60%, #c69c2a 100%); }
.banner.lose { background: radial-gradient(ellipse at center, #d09090 60%, #8a4444 100%); color: #2b1010; }

/* ── ACTION BUTTON (wooden plank with engraved label) ─────────────────── */
.action {
  width: 100%;
  background:
    repeating-linear-gradient(
      0deg,
      rgba(0,0,0,0.06) 0px,
      rgba(0,0,0,0.06) 1px,
      transparent 1px,
      transparent 4px
    ),
    linear-gradient(180deg, #8a4a20 0%, #5a2f15 100%);
  border: 4px solid var(--ink);
  border-radius: 10px;
  color: var(--gold);
  font-family: inherit;
  font-weight: 900;
  font-size: 22px;
  padding: 18px;
  cursor: pointer;
  letter-spacing: 3px;
  text-shadow: 2px 2px 0 #000;
  box-shadow:
    0 4px 0 rgba(0,0,0,0.45),
    inset 0 1px 0 rgba(255,220,170,0.2),
    inset 0 -2px 4px rgba(0,0,0,0.3);
  transition: transform 0.05s, box-shadow 0.05s;
}
.action:active {
  transform: translateY(3px);
  box-shadow: 0 1px 0 rgba(0,0,0,0.45), inset 0 1px 0 rgba(255,220,170,0.2);
}
.action[disabled] {
  background: linear-gradient(180deg, #5a4a3a 0%, #3a2a1a 100%);
  color: #888;
  cursor: not-allowed;
  text-shadow: 1px 1px 0 #000;
}
.action.fire {
  background:
    repeating-linear-gradient(
      0deg,
      rgba(0,0,0,0.08) 0px,
      rgba(0,0,0,0.08) 1px,
      transparent 1px,
      transparent 4px
    ),
    linear-gradient(180deg, #d44a2a 0%, var(--accent) 100%);
  color: #fff7e0;
  animation: pulse 0.4s ease-in-out infinite alternate;
}
@keyframes pulse {
  from { box-shadow: 0 4px 0 rgba(0,0,0,0.45), inset 0 1px 0 rgba(255,220,170,0.3); }
  to   { box-shadow: 0 4px 0 rgba(0,0,0,0.45), inset 0 1px 0 rgba(255,220,170,0.3), 0 0 18px rgba(247,217,121,0.6); }
}

/* ── STAGES, STAKE ROW, SHOOTERS, REVOLVER, CHAMBERS ──────────────────── */
.row { display: flex; gap: 10px; width: 100%; }

.revolver-stage {
  position: relative;
  width: 100%;
  aspect-ratio: 1 / 1;
  display: flex;
  align-items: center;
  justify-content: center;
  background:
    radial-gradient(ellipse at center, #d9b378 0%, #8a5a30 100%);
  border: 4px solid var(--ink);
  border-radius: 10px;
  box-shadow: inset 0 0 40px rgba(0,0,0,0.45), 3px 3px 0 rgba(0,0,0,0.4);
}
.revolver {
  width: 86%;
  transform-origin: 50% 50%;
}
.revolver.spinning {
  animation: spin var(--spin-duration, 3s) cubic-bezier(.18,.7,.2,1) forwards;
}
@keyframes spin {
  from { transform: rotate(0deg); }
  to   { transform: rotate(var(--spin-final, 1800deg)); }
}

.stake-row {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  justify-content: center;
}
.stake-row button {
  background: linear-gradient(180deg, #6b3a18 0%, #3a2010 100%);
  color: var(--gold);
  border: 2px solid var(--ink);
  border-radius: 6px;
  width: 40px; height: 40px;
  font-size: 22px; font-weight: bold;
  cursor: pointer;
  box-shadow: 0 2px 0 rgba(0,0,0,0.4);
}
.stake-row button:active { transform: translateY(1px); box-shadow: 0 1px 0 rgba(0,0,0,0.4); }
.stake-row .stake {
  background: var(--paper);
  border: 2px solid var(--ink);
  border-radius: 6px;
  padding: 6px 14px;
  min-width: 80px;
  text-align: center;
  font-weight: bold;
  color: var(--ink);
  box-shadow: 2px 2px 0 rgba(0,0,0,0.3);
}

.foot {
  margin-top: auto;
  color: rgba(255,220,170,0.6);
  font-size: 11px;
  text-align: center;
  letter-spacing: 0.5px;
  padding-top: 8px;
}

/* ── BOTS/HUMANS TOGGLE ─────────────────────────────────────────────── */
.toggle-row {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}
.toggle-label {
  color: var(--gold);
  font-size: 11px;
  letter-spacing: 2px;
  text-shadow: 1px 1px 0 #000;
}
.seg {
  display: inline-flex;
  background: #1f0d04;
  border: 2px solid var(--paper-edge);
  border-radius: 999px;
  padding: 3px;
  gap: 2px;
}
.seg-btn {
  background: transparent;
  border: none;
  color: var(--paper);
  padding: 6px 16px;
  font-family: inherit;
  font-weight: bold;
  font-size: 13px;
  cursor: pointer;
  border-radius: 999px;
  letter-spacing: 0.5px;
  transition: background 0.15s, color 0.15s;
}
.seg-btn.active {
  background: var(--gold);
  color: var(--ink);
  text-shadow: none;
}
.seg-btn:not(.active):hover { background: rgba(255,255,255,0.06); }

/* ── STAKE TIER LIST (roulette lobby) ──────────────────────────────── */
.tier-list {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.tier-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background:
    radial-gradient(ellipse at center, var(--paper) 60%, var(--paper-edge) 100%);
  border: 3px solid var(--ink);
  border-radius: 8px;
  padding: 12px 16px;
  color: var(--ink);
  cursor: pointer;
  box-shadow: 3px 3px 0 rgba(0,0,0,0.4);
  font-family: inherit;
  width: 100%;
  text-align: left;
  transition: transform 0.05s;
}
.tier-row:active { transform: translateY(2px); }
.tier-row[disabled] { opacity: 0.5; cursor: not-allowed; }
.tier-row .tier-stake { font-weight: 900; font-size: 22px; letter-spacing: 1px; }
.tier-row .tier-payout { font-size: 12px; color: #6a4a20; }
.tier-row .tier-status { font-size: 12px; color: #555; font-weight: bold; }

/* ── WAITING ROOM (player slots) ────────────────────────────────────── */
.slots {
  width: 100%;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}
.slot {
  background:
    radial-gradient(ellipse at center, var(--paper) 60%, var(--paper-edge) 100%);
  border: 3px solid var(--ink);
  border-radius: 8px;
  padding: 8px 4px;
  text-align: center;
  font-size: 11px;
  color: var(--ink);
  min-height: 56px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 2px;
}
.slot.empty { opacity: 0.45; background: #cfb085; }
.slot.you { background: radial-gradient(ellipse at center, var(--gold) 60%, #c69c2a 100%); }
.slot .who { font-weight: 900; font-size: 13px; letter-spacing: 0.5px; }
.slot .tag { font-size: 9px; color: #6a4a20; letter-spacing: 1px; }
