/* The Spin & Gold page (index.html): loaded after style.css, whose palette, panels, cards,
   buttons, advice bars and log it shares. What changes is the three-seat table, after the
   AlphaHoldem webapp (~/pluribus/webapp/public/style.css): you at the bottom, Ada at the top,
   Ben on the right, bet piles on the felt, dealer/blind markers, and the tournament result. */

main { max-width: 60rem; }

.loading .asset-list {
  list-style: none; margin: 0.6rem auto 0; padding: 0; max-width: 22rem;
  font-size: 0.8rem; color: var(--muted); text-align: left;
  font-variant-numeric: tabular-nums;
}
.asset-list li { display: flex; justify-content: space-between; gap: 1rem; padding: 0.1rem 0; }
.asset-list li.done { color: var(--green); }
.loading-note { color: var(--muted); font-size: 0.75rem; margin: 0.8rem 0 0; }

.spin-stats { min-height: 1.4rem; }
.spin-stats .winrate { color: var(--accent); }
.spin-stats strong { color: var(--text); }

/* ---- Table ---- */
.spin-table {
  isolation: isolate;
  min-height: 29.5rem;
  grid-template-rows: minmax(9.1rem, 1fr) 9.5rem minmax(9.1rem, 1fr);
}
.spin-table .seat {
  position: relative;
  min-width: 9rem;
  height: 9.1rem;
  transition: border-color 0.2s, box-shadow 0.2s, opacity 0.2s, filter 0.2s;
}
.spin-table .seat:empty { visibility: hidden; }
.spin-table .seat.acting { animation: acting-pulse 1.25s ease-in-out infinite; }
.spin-table .seat.folded { opacity: 0.45; }
.spin-table .seat.out { opacity: 0.35; filter: grayscale(1); }
.spin-table .seat.winner { animation: winner-glow 0.7s ease-out both; border-color: var(--green); }
.spin-table .seat-right { grid-row: 1; position: absolute; right: 6%; top: 34%; }
.spin-table .seat .stack { font-variant-numeric: tabular-nums; }
.spin-table .seat .stack .chips { opacity: 0.7; font-size: 0.72rem; }
.spin-table .seat .last-action {
  font-size: 0.75rem;
  line-height: 1.05em;
  height: 2.2em;
  flex-shrink: 0;
  max-width: 9rem;
  text-align: center;
  overflow: hidden;
}
.spin-table .seat .last-action.thinking-badge {
  color: var(--gold);
  display: flex; gap: 0.35rem; align-items: center; justify-content: center;
}
.spin-table .seat .out-badge {
  font-size: 0.7rem; font-weight: 800; letter-spacing: 0.08em;
  color: var(--red); border: 1px solid rgba(239, 83, 80, 0.6);
  border-radius: 999px; padding: 0.02rem 0.45rem;
}
.spin-table .position-name {
  color: var(--muted);
  background: none;
  border: 1px solid rgba(139, 148, 158, 0.38);
  padding: 0.02rem 0.35rem;
}

/* Dealer button and blind markers, at each seat's lower right. */
.markers {
  position: absolute;
  right: -0.58rem;
  bottom: 1.45rem;
  display: flex;
  gap: 0.2rem;
  z-index: 4;
}
.table-marker {
  width: 1.72rem;
  height: 1.72rem;
  border-radius: 50%;
  display: inline-flex;
  justify-content: center;
  align-items: center;
  color: #17130a;
  background: linear-gradient(145deg, #fff4bc, #d7a823);
  border: 2px dashed rgba(63, 43, 5, 0.48);
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.48), inset 0 0 0 2px rgba(255, 255, 255, 0.35);
  font-size: 0.55rem;
  font-weight: 900;
  letter-spacing: -0.02em;
}
.marker-small-blind { background: linear-gradient(145deg, #f4f7fa, #9aa6b2); }
.marker-big-blind { background: linear-gradient(145deg, #bce1ff, #508ac0); }
.marker-arrive { animation: marker-pop 0.38s cubic-bezier(.2, .9, .25, 1) both; }

/* Each player's chips this street sit on the felt in front of the seat; spin.js places each
   spot between its seat and the table's center. */
.spin-table .bet-spot {
  position: absolute;
  left: 50%;
  top: 50%;
  height: auto;
  transform: translate(-50%, -50%);
  gap: 0.34rem;
  z-index: 6;
  pointer-events: none;
  font-size: 0.74rem;
  white-space: nowrap;
}
.bet-spot.bet-landed .chip-pile { animation: pile-pop 0.28s cubic-bezier(.2, .9, .25, 1) both; }

/* Chip piles grow with the bet: taller columns and higher-value chip colors. */
.chip-pile {
  display: inline-flex;
  align-items: flex-end;
  gap: 0.14rem;
  transform-origin: center bottom;
  --chip-a: #f4d75d;
  --chip-b: #8d6512;
}
.chip-pile.tier-micro { --chip-a: #a9cdf5; --chip-b: #2f5c93; }
.chip-pile.tier-mid { --chip-a: #63d492; --chip-b: #1c5a37; }
.chip-pile.tier-high { --chip-a: #f07a7a; --chip-b: #7c1d1d; }
.pile-col {
  position: relative;
  width: 1.32rem;
  height: calc(0.52rem + (var(--n) - 1) * 0.3rem);
  flex: 0 0 auto;
}
.pile-col i {
  position: absolute;
  left: 0;
  bottom: calc(var(--i) * 0.3rem);
  width: 1.32rem;
  height: 0.5rem;
  border-radius: 50%;
  background: repeating-conic-gradient(var(--chip-a) 0deg 34deg, var(--chip-b) 34deg 50deg);
  border: 1px solid rgba(18, 11, 0, 0.6);
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.3);
}
.pile-col i:nth-child(even) { filter: brightness(0.92); }
.bet-value { text-shadow: 0 1px 2px rgba(0, 0, 0, 0.7); }

/* Cards animate only when dealt or turned over (style.css animates every card). */
.spin-table .card { animation: none; transform-origin: center; backface-visibility: hidden; }
.spin-table .seat-top { --deal-x: 0px; --deal-y: 8rem; --deal-rotate: -8deg; }
.spin-table .seat-right { --deal-x: -11rem; --deal-y: 1rem; --deal-rotate: 10deg; }
.spin-table .seat-bottom { --deal-x: 0px; --deal-y: -8rem; --deal-rotate: 7deg; }
.spin-table .card.hole-card-deal { animation: deal-hole 0.32s cubic-bezier(.16, .84, .3, 1.05) both; animation-delay: var(--card-delay, 0ms); }
.spin-table .card.board-card-deal { animation: deal-board 0.34s cubic-bezier(.2, .9, .25, 1) both; animation-delay: var(--card-delay, 0ms); }
.spin-table .card.card-reveal { animation: reveal-card 0.4s cubic-bezier(.2, .8, .25, 1) both; }

.spin-table .board-area { padding: 0.4rem 0; }
.spin-table .pot { display: flex; justify-content: center; align-items: center; gap: 0.4rem; }
.pot-chip {
  width: 1rem;
  height: 1rem;
  border-radius: 50%;
  background: repeating-conic-gradient(#f4d75d 0deg 34deg, #8d6512 34deg 50deg);
  border: 2px dashed rgba(50, 32, 2, 0.55);
  box-shadow: 0 2px 3px rgba(0, 0, 0, 0.45);
}
.spin-table .banner { height: 3.4rem; overflow: hidden; line-height: 1.25; }
.spin-table .banner .win, .spin-table .banner .lose, .spin-table .banner .even {
  display: inline-block;
  animation: banner-pop 0.42s cubic-bezier(.2, .9, .25, 1) both;
}
.spin-table .banner .detail {
  display: block;
  margin-top: 0.2rem;
  color: #b8d8ff;
  font-size: 0.74rem;
  font-weight: 500;
}

/* The tournament's result, over the felt. */
.final {
  position: absolute;
  inset: 0;
  z-index: 30;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0.7rem;
  text-align: center;
  padding: 2rem;
  border-radius: inherit;
  background: radial-gradient(ellipse at center, rgba(13, 17, 23, 0.93) 0%, rgba(13, 17, 23, 0.8) 75%);
  animation: banner-pop 0.5s cubic-bezier(.2, .9, .25, 1) both;
}
.final-title { font-size: 1.6rem; font-weight: 800; }
.final.won .final-title { color: var(--gold); text-shadow: 0 0 18px rgba(212, 160, 23, 0.45); }
.final.lost .final-title { color: var(--red); }
.final-detail { color: var(--muted); font-size: 0.9rem; max-width: 28rem; }
.deal-btn {
  background: var(--accent); color: #0d1117;
  border: 1px solid var(--accent); border-radius: 10px;
  padding: 0.7rem 1.8rem;
  font-size: 1rem; font-weight: 700; cursor: pointer;
}
.deal-btn:hover { filter: brightness(1.15); }
.deal-btn .key { opacity: 0.55; font-weight: 500; font-size: 0.75rem; margin-left: 0.3rem; }

/* ---- Below the table ---- */
.action-area { min-height: 8.6rem; }
.actions button { white-space: nowrap; }
.actions button.deal { animation: deal-button-in 0.3s cubic-bezier(.2, .9, .25, 1) both; }
.thinking .elapsed { font-variant-numeric: tabular-nums; }

.copy-log {
  margin-left: 0.6rem;
  background: var(--panel-2); color: var(--text);
  border: 1px solid #3d444d; border-radius: 6px;
  padding: 0.1rem 0.6rem; font-size: 0.75rem; cursor: pointer;
}
.copy-log:hover { border-color: var(--accent); }
.log .line.hand-start { color: var(--text); font-weight: 600; margin-top: 0.5rem; }
.log .line.hand-start:first-child { margin-top: 0; }
.log .line.street { color: #ffe17b; }
.log .line.result { color: var(--green); }
.log .line.mixes { opacity: 0.7; }
.log .line.tourney { color: var(--accent); font-weight: 600; margin: 0.5rem 0 0.2rem; }

@keyframes acting-pulse {
  0%, 100% { box-shadow: 0 0 10px rgba(212, 160, 23, 0.26); }
  50% { box-shadow: 0 0 20px rgba(212, 160, 23, 0.46); }
}
@keyframes marker-pop {
  0% { opacity: 0; transform: scale(0.35) rotate(-35deg); }
  72% { opacity: 1; transform: scale(1.18) rotate(4deg); }
  100% { opacity: 1; transform: scale(1) rotate(0); }
}
@keyframes deal-hole {
  0% { opacity: 0; transform: translate(var(--deal-x), var(--deal-y)) rotate(var(--deal-rotate)) scale(0.82); }
  70% { opacity: 1; transform: translate(0, -2px) rotate(-1deg) scale(1.035); }
  100% { opacity: 1; transform: translate(0, 0) rotate(0) scale(1); }
}
@keyframes deal-board {
  0% { opacity: 0; transform: translate(-4.5rem, -3rem) rotate(-14deg) scale(0.82); }
  72% { opacity: 1; transform: translate(2px, 0) rotate(1deg) scale(1.04); }
  100% { opacity: 1; transform: translate(0, 0) rotate(0) scale(1); }
}
@keyframes winner-glow {
  0% { transform: scale(1); box-shadow: 0 0 0 rgba(76, 175, 125, 0); }
  45% { transform: scale(1.035); box-shadow: 0 0 25px rgba(76, 175, 125, 0.7); }
  100% { transform: scale(1); box-shadow: 0 0 12px rgba(76, 175, 125, 0.35); }
}
@keyframes pile-pop {
  0% { transform: scale(0.55) translateY(0.3rem); }
  70% { transform: scale(1.12) translateY(-1px); }
  100% { transform: scale(1) translateY(0); }
}
@keyframes banner-pop {
  0% { opacity: 0; transform: translateY(6px) scale(0.92); }
  70% { opacity: 1; transform: translateY(-1px) scale(1.04); }
  100% { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes deal-button-in {
  0% { opacity: 0; transform: translateY(6px) scale(0.94); }
  100% { opacity: 1; transform: translateY(0) scale(1); }
}

/* Phones: the two bots share the top row. */
@media (max-width: 640px) {
  .spin-table {
    min-height: 32rem;
    border-radius: 30% / 20%;
    grid-template-columns: 1fr 1fr;
    grid-template-rows: minmax(9.1rem, 1fr) 10.5rem minmax(9.1rem, 1fr);
    padding: 0.8rem 0.4rem;
  }
  .spin-table .seat-top { grid-column: 1; }
  .spin-table .seat-right {
    position: relative; right: auto; top: auto;
    grid-row: 1; grid-column: 2; align-self: center; justify-self: center;
    --deal-x: -5rem; --deal-y: 7rem;
  }
  .spin-table .board-area { grid-column: 1 / -1; }
  .spin-table .seat-bottom { grid-column: 1 / -1; }
  .spin-table .seat { min-width: 8rem; padding-inline: 0.55rem; }
  .spin-table .banner { height: 4.2rem; }
  .markers { right: -0.35rem; }
  .table-marker { width: 1.55rem; height: 1.55rem; font-size: 0.5rem; }
  .final-title { font-size: 1.25rem; }
}
