/* ===== Roulette — game styles =====
   Extends the shared glass casino theme. Layout is a two-column wheel +
   felt on wide screens and a stacked column on narrow. Every roulette-
   specific hook is namespaced .rt-* so nothing clashes with the shared
   .c-* tokens or the blackjack .bj-* rules that also ride on glass.css. */

.rt-table { padding: 14px clamp(10px, 3vw, 26px) 22px; }

.rt-wrap {
  display: grid;
  grid-template-columns: minmax(280px, 360px) 1fr;
  grid-template-areas:
    "wheel felt"
    "ctrl  ctrl";
  gap: 18px;
  align-items: start;
  max-width: 1280px;
  margin: 0 auto;
}
@media (max-width: 900px) {
  .rt-wrap {
    grid-template-columns: 1fr;
    grid-template-areas: "wheel" "felt" "ctrl";
  }
}

/* ---------- Wheel side ---------- */
.rt-wheel-side {
  grid-area: wheel;
  display: flex; flex-direction: column; align-items: center; gap: 10px;
  padding: 14px;
  background: var(--glass);
  border: 1px solid var(--glass-line);
  border-radius: 18px;
  backdrop-filter: blur(14px) saturate(140%);
  -webkit-backdrop-filter: blur(14px) saturate(140%);
  box-shadow: 0 10px 30px rgba(0, 0, 0, .3);
  position: sticky; top: 12px;
}
@media (max-width: 900px) { .rt-wheel-side { position: static; } }

.rt-wheelbox {
  position: relative;
  width: min(320px, 78vw);
  aspect-ratio: 1 / 1;
  display: grid; place-items: center;
}
.rt-wheel {
  width: 100%; height: 100%;
  transform-origin: 50% 50%;
  transition: transform 4.6s cubic-bezier(.15, .9, .2, 1);
  will-change: transform;
  filter: drop-shadow(0 10px 22px rgba(0, 0, 0, .55));
  border-radius: 50%;
}
.rt-pointer {
  position: absolute;
  top: -2px; left: 50%;
  width: 0; height: 0;
  transform: translateX(-50%);
  border-left: 9px solid transparent;
  border-right: 9px solid transparent;
  border-top: 16px solid #ffd870;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, .6));
  z-index: 2;
}
.rt-hub {
  position: absolute;
  width: 22%; height: 22%;
  border-radius: 50%;
  background:
    radial-gradient(circle at 30% 30%, #f5e3a8 0%, #c9a55b 55%, #7b5f1e 100%);
  box-shadow: inset 0 0 8px rgba(0, 0, 0, .35), 0 3px 8px rgba(0, 0, 0, .5);
  pointer-events: none;
}

.rt-message {
  min-height: 24px;
  font-size: 15px;
  text-align: center;
  color: var(--c-text);
  letter-spacing: .01em;
}
.rt-message.win { color: #78f0a4; text-shadow: 0 0 12px rgba(120, 240, 164, .35); }
.rt-message.lose { color: #ffa0a0; }

.rt-history {
  display: flex; flex-wrap: wrap; gap: 5px; justify-content: center;
  min-height: 26px;
}
.rt-hist {
  width: 26px; height: 26px;
  border-radius: 50%;
  display: inline-grid; place-items: center;
  font-size: 12px; font-weight: 700;
  color: #fff;
  border: 1px solid rgba(255, 255, 255, .25);
  background: #12131c;
}
.rt-hist.red { background: #b7222b; }
.rt-hist.black { background: #17192a; }
.rt-hist.green { background: #177a3a; }

/* Header "Last" pill.

   Deliberately left as a normal INLINE box (the default for <b>) instead of
   `display: inline-block`. Vertical padding on an inline element still
   extends the *background* visually to form the pill, but crucially it
   does NOT grow the line box or shift the baseline. That was the whole
   alignment problem: the pill had 2px of vertical padding, so the Last
   flex item's line-box grew downward and its number sank below the
   Bank/Bet baselines. Same trick as classic inline badges. */
.rt-last {
  padding: 4px 10px;
  border-radius: 999px;
  font-weight: 800;
  color: var(--c-text);
  background: transparent;
  transition: background .2s ease, color .2s ease;
  white-space: nowrap;
}
.rt-last.red   { background: #b7222b; color: #fff; }
.rt-last.black { background: #17192a; color: #fff; box-shadow: inset 0 0 0 1px rgba(255,255,255,.18); }
.rt-last.green { background: #177a3a; color: #fff; }

/* ---------- Felt (betting grid) ---------- */
.rt-felt {
  grid-area: felt;
  padding: 14px;
  border-radius: 18px;
  background:
    radial-gradient(120% 80% at 50% 0%, rgba(255, 255, 255, .05) 0%, transparent 60%),
    linear-gradient(180deg, #0e5b34 0%, #083e23 100%);
  border: 1px solid rgba(0, 0, 0, .5);
  box-shadow:
    inset 0 0 60px rgba(0, 0, 0, .5),
    0 10px 30px rgba(0, 0, 0, .35);
  overflow-x: auto;
}

.rt-grid {
  display: grid;
  grid-template-columns: 42px repeat(12, minmax(38px, 1fr)) 54px;
  grid-auto-rows: 42px;
  gap: 4px;
  min-width: 640px;
}
.rt-cell {
  position: relative;
  display: grid; place-items: center;
  font-weight: 700;
  font-size: 14px;
  color: #fff;
  border-radius: 6px;
  cursor: pointer;
  user-select: none;
  border: 1px solid rgba(0, 0, 0, .4);
  transition: transform .08s ease, box-shadow .12s ease, filter .12s ease;
}
.rt-cell:hover { filter: brightness(1.15); }
.rt-cell:active { transform: translateY(1px); }
.rt-cell.dragover { outline: 2px dashed #ffd870; outline-offset: 2px; filter: brightness(1.3); }
.rt-cell.rt-red   { background: linear-gradient(180deg, #c62832, #8f1520); }
.rt-cell.rt-black { background: linear-gradient(180deg, #1e2134, #0a0c16); }
.rt-cell.rt-zero  { background: linear-gradient(180deg, #17963f, #0b5e26); grid-row: 1 / 4; }
.rt-cell.rt-out   { background: linear-gradient(180deg, #12442a, #082817); font-size: 12px; letter-spacing: .04em; }
.rt-cell.rt-dozen { background: linear-gradient(180deg, #12442a, #082817); font-size: 12px; letter-spacing: .04em; }
.rt-cell.rt-col   { background: linear-gradient(180deg, #12442a, #082817); font-size: 12px; writing-mode: vertical-rl; }

/* Chip stack badge overlaid on a bet cell */
.rt-stack {
  position: absolute;
  bottom: 3px; right: 3px;
  min-width: 22px; height: 22px;
  padding: 0 5px;
  border-radius: 999px;
  background: #ffd870;
  color: #3b2600;
  font-size: 11px; font-weight: 800;
  display: grid; place-items: center;
  box-shadow: 0 1px 3px rgba(0, 0, 0, .5), inset 0 0 0 1px rgba(0, 0, 0, .15);
  pointer-events: none;
  letter-spacing: 0;
}
.rt-stack.big { background: #d4a017; color: #1a1100; }

/* Winner flash ring */
.rt-cell.winner::after {
  content: "";
  position: absolute; inset: -3px;
  border: 2px solid #ffd870;
  border-radius: 8px;
  box-shadow: 0 0 18px rgba(255, 216, 112, .55);
  pointer-events: none;
  animation: rt-pop .5s ease-out;
}
@keyframes rt-pop {
  0%   { transform: scale(.85); opacity: 0; }
  55%  { transform: scale(1.08); opacity: 1; }
  100% { transform: scale(1); opacity: 1; }
}

/* Losing cells dim briefly after the ball lands */
.rt-grid.resolving .rt-cell:not(.winner) { opacity: .35; transition: opacity .3s ease; }
.rt-grid.resolving .rt-cell.winner      { opacity: 1; }

/* ---------- Bottom controls ---------- */
.rt-controls {
  grid-area: ctrl;
  display: flex; flex-wrap: wrap; gap: 12px; align-items: center; justify-content: space-between;
  padding: 12px 14px;
  background: var(--glass);
  border: 1px solid var(--glass-line);
  border-radius: 16px;
  backdrop-filter: blur(14px) saturate(140%);
  -webkit-backdrop-filter: blur(14px) saturate(140%);
}
.rt-chips { display: flex; gap: 8px; flex-wrap: wrap; }
.rt-chip {
  width: 44px; height: 44px;
  border-radius: 50%;
  border: 2px dashed rgba(255, 255, 255, .55);
  background:
    radial-gradient(circle at 30% 30%, rgba(255, 255, 255, .35) 0%, transparent 55%),
    var(--chip, #666);
  color: #fff;
  font-weight: 800;
  font-size: 13px;
  cursor: pointer;
  box-shadow: 0 3px 8px rgba(0, 0, 0, .45);
  transition: transform .08s ease, box-shadow .1s ease;
  display: grid; place-items: center;
  padding: 0;
  touch-action: none;             /* allow pointer-drag from chip to felt */
  user-select: none;
  -webkit-user-select: none;
}
.rt-chip:hover { transform: translateY(-1px); }
.rt-chip[aria-pressed="true"] {
  box-shadow: 0 0 0 3px #ffd870, 0 3px 10px rgba(0, 0, 0, .5);
  transform: translateY(-2px);
}
.rt-chip--clear  { background: #2b2f36; border-style: solid; font-size: 20px; }
.rt-chip--repeat { background: #2b2f36; border-style: solid; font-size: 18px; }

.rt-spin {
  min-width: 130px;
  font-size: 15px;
  padding: 10px 22px;
  letter-spacing: .04em;
}
.rt-spin[disabled] { opacity: .45; cursor: not-allowed; }
.rt-spin.spinning  { animation: rt-throb 1.4s ease-in-out infinite; }
/* Floating chip clone that follows the pointer during a chip-to-felt drag. */
.rt-chip--ghost {
  position: fixed;
  z-index: 999;
  pointer-events: none;
  transform: scale(1.15);
  opacity: .95;
  box-shadow: 0 10px 22px rgba(0, 0, 0, .55);
  margin: 0;
  animation: none;
}
.rt-chip--ghost.over { transform: scale(1.28); box-shadow: 0 0 0 3px #ffd870, 0 10px 22px rgba(0, 0, 0, .55); }
@keyframes rt-throb {
  0%, 100% { transform: scale(1); }
  50%      { transform: scale(1.03); }
}

/* Reduced motion: no throb, near-instant wheel spin. */
@media (prefers-reduced-motion: reduce) {
  .rt-wheel { transition-duration: .01s; }
  .rt-spin.spinning { animation: none; }
  .rt-cell.winner::after { animation: none; }
}
