/* ==========================================================================
   css/roulette.css — Battle Roulette (`#roulette`, DECISIONS 452, js/ui/roulette.js)
   --------------------------------------------------------------------------
   PC (900 px and up): the wheel in a sticky column on the left, the opponent, today's spins and
   the rules on the right. Phone: one column, the wheel and its button first, so a spin is one tap
   from the top of the page; after a spin the opponent card scrolls into view under it.
   One colour per kind of slice (--k), shared by the wheel, the chips and the opponent card.
   ========================================================================== */

.k-easy    { --k: #3f9d5a; --k-ink: #fff; }
.k-even    { --k: #3b78c4; --k-ink: #fff; }
.k-tough   { --k: #d9822b; --k-ink: #fff; }
.k-brutal  { --k: #c63b3b; --k-ink: #fff; }
.k-items   { --k: #7c55c7; --k-ink: #fff; }
.k-jackpot { --k: #f2c94c; --k-ink: #3a2600; }

.rl-body { display: grid; gap: 14px; grid-template-columns: minmax(0, 1fr); align-items: start; }
.rl-side { display: grid; gap: 14px; min-width: 0; }
@media (min-width: 900px) {
  .rl-body { grid-template-columns: minmax(320px, 400px) minmax(0, 1fr); }
  .rl-wheel-panel { position: sticky; top: 0; }
}

/* ---- the wheel ---------------------------------------------------------------- */
.rl-wheel-panel { display: flex; flex-direction: column; align-items: center; gap: 12px; padding: 20px 16px 16px; }
.rl-wheel { position: relative; width: min(100%, 340px); aspect-ratio: 1; margin-top: 6px; }
.rl-rotor { position: absolute; inset: 0; will-change: transform; }
.rl-rotor svg { display: block; width: 100%; height: 100%; overflow: visible; filter: drop-shadow(0 10px 18px rgba(0, 0, 0, 0.4)); }
.rl-rim { fill: #1b2233; stroke: rgba(255, 255, 255, 0.18); stroke-width: 1.5; }
.rl-slice { fill: var(--k); stroke: rgba(10, 14, 26, 0.55); stroke-width: 0.8; }
.rl-slice.win { animation: rlWin 0.9s ease-in-out 3; }
.rl-pegs circle { fill: #f4f6fb; stroke: rgba(0, 0, 0, 0.35); stroke-width: 0.6; }
.rl-labels text {
  fill: var(--k-ink); font-family: var(--font); font-weight: 800;
  text-anchor: middle; dominant-baseline: central;
  paint-order: stroke; stroke: rgba(0, 0, 0, 0.28); stroke-width: 1.6px;
}
.rl-big { font-size: 15px; }
.rl-small { font-size: 6.5px; letter-spacing: 0.06em; text-transform: uppercase; }
/* The Jackpot is a sliver (3 %): smaller type that still fits, dark on gold. */
.rl-label.k-jackpot text { stroke: none; }
.rl-label.k-jackpot .rl-big { font-size: 9px; }
.rl-label.k-jackpot .rl-small { font-size: 5.2px; }

/* The pointer at the top (it does not turn) and a Poké Ball as the hub. */
.rl-pointer {
  position: absolute; left: 50%; top: -10px; z-index: 2;
  width: 0; height: 0; transform: translateX(-50%);
  border-left: 13px solid transparent; border-right: 13px solid transparent; border-top: 26px solid #f4f6fb;
  filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.55));
  transform-origin: 50% 0;
}
.rl-wheel-panel.spinning .rl-pointer { animation: rlTick 0.11s ease-in-out infinite alternate; }
.rl-hub {
  position: absolute; left: 50%; top: 50%; z-index: 1;
  width: 21%; aspect-ratio: 1; transform: translate(-50%, -50%);
  border-radius: 50%; border: 3px solid #1b2233;
  background: linear-gradient(180deg, #e04848 0 45%, #1b2233 45% 55%, #f4f6fb 55%);
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.45);
}
.rl-hub::after {
  content: ""; position: absolute; left: 50%; top: 50%;
  width: 36%; aspect-ratio: 1; transform: translate(-50%, -50%);
  border-radius: 50%; background: #f4f6fb; border: 3px solid #1b2233;
}

.rl-main { width: min(100%, 340px); justify-content: center; }
.rl-fee { font-weight: 800; opacity: 0.9; margin-left: 2px; }
.rl-hint { margin: -4px 0 0; max-width: 340px; text-align: center; font-size: 0.82rem; color: var(--warning); }
.rl-meta { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px 14px; font-size: 0.8rem; color: var(--muted); }
.rl-meta b { color: var(--text); }

/* ---- chips (slice, kind) -------------------------------------------------------- */
.rl-chip {
  display: inline-flex; align-items: center; gap: 4px; flex: none;
  padding: 2px 9px; border-radius: 999px;
  background: var(--k); color: var(--k-ink);
  font-size: 0.74rem; font-weight: 700; white-space: nowrap;
}
.rl-chip b { font-weight: 900; }

/* ---- the opponent --------------------------------------------------------------- */
.rl-opponent { border-top: 4px solid var(--k); }
.rl-opponent.reveal { animation: rlReveal 0.45s cubic-bezier(0.2, 0.9, 0.3, 1.15); }
.rl-opp-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.rl-opp-main { display: flex; align-items: center; gap: 14px; min-width: 0; }
.rl-opp-sprite {
  flex: none; width: 96px; height: 96px; border-radius: var(--radius);
  display: flex; align-items: flex-end; justify-content: center;
  background: radial-gradient(circle at 50% 75%, rgba(255, 255, 255, 0.12), transparent 70%);
}
.rl-trainer { max-width: 100%; max-height: 96px; width: auto; height: auto; image-rendering: pixelated; }
.rl-opp-info { min-width: 0; }
.rl-opp-name { font-weight: 800; font-size: 1.05rem; }
.rl-team { display: flex; flex-wrap: wrap; gap: 2px 4px; margin-top: 6px; }
.rl-mon { min-width: 42px; display: flex; flex-direction: column; align-items: center; }
.rl-mon-img { width: 36px; height: 36px; image-rendering: pixelated; object-fit: contain; }
.rl-mon-lv { font-size: 0.64rem; line-height: 1; font-family: var(--font-mono); color: var(--muted); white-space: nowrap; }
.rl-prize {
  display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px;
  margin: 14px 0 6px; padding: 10px 12px; border-radius: var(--radius-sm);
  background: rgba(246, 201, 69, 0.1); border: 1px solid rgba(246, 201, 69, 0.3);
}
.rl-prize-label { font-size: 0.72rem; font-weight: 800; text-transform: uppercase; letter-spacing: 0.08em; color: #f6c945; }
.rl-prize-money { font-size: 1.25rem; color: #ffd86b; }
.rl-item { display: inline-flex; align-items: center; gap: 3px; font-size: 0.86rem; }
.rl-item img { width: 24px; height: 24px; image-rendering: pixelated; }
.rl-lose { margin: 0 0 10px; }
.rl-opp-btn { width: 100%; justify-content: center; }

/* ---- today's spins ---------------------------------------------------------------- */
.rl-today-list { display: grid; gap: 6px; }
.rl-row {
  display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 8px 10px;
  padding: 7px 10px; border-radius: var(--radius-sm); background: var(--panel-2);
}
.rl-row-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 0.88rem; }
.rl-res { display: inline-flex; align-items: center; gap: 4px; font-size: 0.84rem; font-weight: 700; white-space: nowrap; }
.rl-res.won { color: var(--success); }
.rl-res.won b { color: #ffd86b; }
.rl-res.lost { color: #ff8f8f; }
.rl-res.wait { color: var(--warning); }
.rl-res-item { width: 22px; height: 22px; image-rendering: pixelated; }

/* ---- how it works + payouts --------------------------------------------------------- */
.rl-rule-list { margin: 0; padding-left: 18px; display: grid; gap: 6px; font-size: 0.88rem; line-height: 1.45; }
.rl-pay-title { margin: 16px 0 4px; font-size: 0.9rem; }
.rl-pay {
  display: grid; grid-template-columns: 104px minmax(0, 1fr) auto; align-items: center; gap: 2px 10px;
  padding: 8px 0; border-top: var(--panel-border);
}
.rl-pay .rl-chip { justify-self: start; }
.rl-pay-who { font-size: 0.85rem; }
.rl-pay-chance { font-family: var(--font-mono); font-size: 0.78rem; color: var(--muted); white-space: nowrap; }
.rl-pay-prize { grid-column: 2 / -1; font-size: 0.85rem; color: #ffd86b; }

/* ---- phone ------------------------------------------------------------------------ */
@media (max-width: 600px) {
  .rl-wheel-panel { padding: 16px 12px 14px; }
  .rl-wheel { width: min(100%, 300px); }
  .rl-main { width: 100%; }
  .rl-opp-sprite { width: 72px; height: 72px; }
  .rl-trainer { max-height: 72px; }
  /* Chip and chance share the first row; who and prize get a row each under them. */
  .rl-pay { grid-template-columns: minmax(0, 1fr) auto; }
  .rl-pay .rl-chip { grid-row: 1; grid-column: 1; }
  .rl-pay-chance { grid-row: 1; grid-column: 2; }
  .rl-pay-who, .rl-pay-prize { grid-column: 1 / -1; }
}

@keyframes rlWin { 50% { filter: brightness(1.4) saturate(1.2); } }
@keyframes rlTick { from { transform: translateX(-50%) rotate(-8deg); } to { transform: translateX(-50%) rotate(6deg); } }
@keyframes rlReveal { from { opacity: 0; transform: translateY(12px) scale(0.98); } }

@media (prefers-reduced-motion: reduce) {
  .rl-slice.win, .rl-opponent.reveal, .rl-wheel-panel.spinning .rl-pointer { animation: none; }
}
