/* ============================================================
   table.css — Interactive heat-mapped roulette table
   ============================================================ */

/* -- Heat overlay (used by .rg-cell via --heat custom prop) ---- */
.rg-cell::before {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--heat, transparent);
  opacity: var(--heat-opacity, 0);
  transition: opacity 0.3s ease;
  z-index: 0;
  border-radius: inherit;
  pointer-events: none;
}

/* Legacy r-cell rules (kept for backwards-compat where present) */
.roulette-table {
  width: 100%;
  margin: 0 auto;
}

.r-cell {
  position: relative;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  color: #fff;
  font-size: var(--fs-md);
  cursor: pointer;
  transition: transform 0.1s ease, box-shadow 0.2s ease;
  user-select: none;
  border: 1px solid rgba(0, 0, 0, 0.3);
  overflow: hidden;
}
.r-cell::before {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--heat, transparent);
  opacity: var(--heat-opacity, 0);
  transition: opacity 0.3s ease;
  z-index: 0;
}
.r-cell > * { position: relative; z-index: 1; }
.r-cell:active { transform: scale(0.96); }
.r-cell.is-active {
  box-shadow: 0 0 0 2px var(--gold-2), 0 0 16px rgba(241, 210, 113, 0.4);
  z-index: 2;
}

.r-cell--red   { background: linear-gradient(160deg, #e8506b 0%, #a91b2d 100%); }
.r-cell--black { background: linear-gradient(160deg, #2c2c2c 0%, #0a0a0a 100%); }
.r-cell--green { background: linear-gradient(160deg, #2bbd7a 0%, #126b41 100%); }

.r-cell--zero {
  grid-column: 1 / -1;
  aspect-ratio: 3 / 1;
  max-height: 56px;
  font-size: var(--fs-lg);
}
.r-cell--dzero {
  grid-column: 1 / -1;
  aspect-ratio: 3 / 1;
  max-height: 56px;
  font-size: var(--fs-lg);
}

.r-cell__count {
  position: absolute;
  bottom: 2px;
  right: 4px;
  font-size: 9px;
  color: rgba(255, 255, 255, 0.7);
  font-weight: 600;
  z-index: 1;
}
.r-cell__label {
  position: absolute;
  top: 2px;
  left: 4px;
  font-size: 9px;
  color: rgba(255, 255, 255, 0.5);
  font-weight: 500;
  z-index: 1;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

.r-cell.is-in-sector,
.rg-cell.is-in-sector {
  outline: 2px solid var(--gold);
  outline-offset: -2px;
  box-shadow: inset 0 0 8px rgba(212, 175, 55, 0.4);
  z-index: 2;
}
.r-cell.is-neighbor,
.rg-cell.is-neighbor {
  outline: 2px solid var(--gold-2);
  outline-offset: -2px;
  box-shadow: 0 0 12px rgba(241, 210, 113, 0.6);
  z-index: 3;
}
.r-cell.is-active,
.rg-cell.is-active {
  box-shadow: 0 0 0 2px var(--gold-2), 0 0 16px rgba(241, 210, 113, 0.5);
  z-index: 4;
}

.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  padding-top: 14px;
  margin-top: 12px;
  border-top: 1px solid var(--line);
  font-size: var(--fs-xs);
  color: var(--ink-2);
  justify-content: center;
}
.legend-item {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.swatch {
  display: inline-block;
  width: 12px;
  height: 12px;
  border-radius: 3px;
}
.swatch--hot   { background: linear-gradient(135deg, var(--hot-1), var(--hot-2)); }
.swatch--cold  { background: linear-gradient(135deg, var(--cold-1), var(--cold-2)); }
.swatch--due   { background: var(--due); }
.swatch--zero  { background: var(--green); }

/* ============================================================
   .rgrid — Unified roulette grid used by both Table and Play tabs
   ============================================================ */
.rgrid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  grid-auto-rows: 40px;
  gap: 4px;
  user-select: none;
  width: 100%;
}

.rg-cell {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--felt);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 3px;
  color: #fff;
  font-weight: 600;
  font-size: var(--fs-sm);
  cursor: pointer;
  transition: transform 0.1s, background 0.15s, border-color 0.15s;
  padding: 0;
  font-family: inherit;
  text-align: center;
  line-height: 1.1;
  overflow: hidden;
}
.rg-cell:active { transform: scale(0.96); }
.rg-cell:hover  { border-color: var(--gold); }

.rg-num--red   { background: linear-gradient(160deg, #e8506b 0%, #a91b2d 100%); }
.rg-num--black { background: linear-gradient(160deg, #2c2c2c 0%, #0a0a0a 100%); }
.rg-zero {
  background: linear-gradient(160deg, #2bbd7a 0%, #126b41 100%);
  font-size: var(--fs-md);
}
.rg-zero--single { grid-column: 1 / -1; }

.rg-outside {
  background: linear-gradient(180deg, #16352b 0%, #0a1f17 100%);
  font-size: var(--fs-xs);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.rg-outside small { font-size: 9px; opacity: 0.6; font-weight: 400; }
.rg-outside--red   { background: linear-gradient(160deg, #e8506b 0%, #a91b2d 100%); }
.rg-outside--black { background: linear-gradient(160deg, #2c2c2c 0%, #0a0a0a 100%); }

.rg-text { position: relative; z-index: 1; pointer-events: none; }

.rg-count {
  position: absolute;
  top: 2px;
  right: 4px;
  font-size: 9px;
  color: rgba(255, 255, 255, 0.7);
  font-weight: 600;
  z-index: 2;
  pointer-events: none;
}

.rg-chip {
  position: absolute;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  color: #fff;
  background: var(--gold);
  border: 2px solid #fff;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.6);
  z-index: 3;
  animation: chipPlace 0.3s cubic-bezier(0.34, 1.56, 0.64, 1) both;
  pointer-events: none;
}
.rg-chip--1   { background: #f1d271; color: #1a1a1a; }
.rg-chip--5   { background: var(--red); }
.rg-chip--25  { background: var(--green); }
.rg-chip--100 { background: #1a1a1a; border-color: var(--gold); }
@keyframes chipPlace {
  0% { transform: scale(0); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}

/* When the play table needs slightly larger rows on tall screens */
.rgrid--full { gap: 3px; }
@media (min-width: 520px) {
  .rgrid { grid-auto-rows: 44px; }
  .rg-outside { font-size: var(--fs-sm); }
}
