/* ============================================================
   Felt Trainer — Roulette game-specific styles
   Tokens, resets, setup screen, header bar, modals, toasts,
   and tooltips live in shared/styles.css.
   ============================================================ */

/* Roulette stacks the setup-brand vertically like blackjack. */
.setup-brand {
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 4px;
  margin-bottom: 8px;
}

/* ===== Game Screen ===== */

.game-screen { display: none; flex-direction: column; height: 100vh; height: 100dvh; }
.game-screen.active { display: flex; }

/* Row that holds the table and the docked tutorial side-by-side.
   The tutorial reserves its own column so it never overlaps the felt. */
.game-main {
  flex: 1;
  display: flex;
  flex-direction: row;
  min-height: 0;
}

.table-area {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 18px 18px 12px;
  gap: 14px;
  background:
    radial-gradient(ellipse at 50% 50%, rgba(13,107,44,.18) 0%, transparent 70%),
    var(--bg);
  min-height: 0;
  overflow-y: auto;
}

/* ===== Wheel + result/history strip ===== */

.wheel-wrap {
  display: flex;
  align-items: center;
  gap: 18px;
  width: 100%;
  max-width: 900px;
}

.wheel-side {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 0;
}

.wheel {
  position: relative;
  width: 196px;
  height: 196px;
  flex-shrink: 0;
  border-radius: 50%;
  background: radial-gradient(circle at 30% 25%, #6b4a1f 0%, #2a1810 80%);
  border: 5px solid #3a2412;
  box-shadow:
    0 6px 24px rgba(0, 0, 0, .65),
    inset 0 0 0 2px rgba(255, 255, 255, .06),
    inset 0 -4px 12px rgba(0, 0, 0, .5);
}

.wheel-spin {
  position: absolute;
  inset: 6px;
  border-radius: 50%;
  transform-origin: 50% 50%;
  will-change: transform;
  transition: transform 4500ms cubic-bezier(.15, .8, .22, 1);
  overflow: hidden;
}

.wheel-bg {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  /* conic-gradient is assigned in JS */
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .12);
}

.wheel-num {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 16px;
  height: 16px;
  margin-left: -8px;
  margin-top: -8px;
  font-size: 9px;
  font-weight: 800;
  color: #fff;
  text-align: center;
  line-height: 16px;
  font-family: var(--font-body);
  font-variant-numeric: tabular-nums;
  pointer-events: none;
  text-shadow: 0 1px 1px rgba(0, 0, 0, .8);
  letter-spacing: -0.04em;
}

.wheel-hub {
  position: absolute;
  left: 50%; top: 50%;
  width: 34px; height: 34px;
  margin-left: -17px; margin-top: -17px;
  border-radius: 50%;
  background: radial-gradient(circle at 32% 28%, #e2b76e 0%, #6a4218 75%);
  box-shadow:
    0 2px 4px rgba(0, 0, 0, .6),
    inset 0 -1px 2px rgba(0, 0, 0, .55),
    inset 0 1px 2px rgba(255, 255, 255, .3);
  z-index: 4;
}
.wheel-hub::after {
  content: '';
  position: absolute;
  inset: 6px;
  border-radius: 50%;
  background: radial-gradient(circle at 32% 28%, #f2cd84 0%, #8c5c24 80%);
  box-shadow: inset 0 -1px 1px rgba(0, 0, 0, .4);
}

.wheel-orbit {
  position: absolute;
  inset: 0;
  transform-origin: 50% 50%;
  will-change: transform;
  transition: transform 4500ms cubic-bezier(.18, .9, .15, 1);
  z-index: 3;
  pointer-events: none;
}

.wheel-ball {
  position: absolute;
  left: 50%;
  top: 10px;
  width: 10px;
  height: 10px;
  margin-left: -5px;
  border-radius: 50%;
  background: radial-gradient(circle at 30% 28%, #ffffff 0%, #d0d0d0 80%);
  box-shadow: 0 1px 3px rgba(0, 0, 0, .8), inset 0 -1px 1px rgba(0, 0, 0, .25);
}

.wheel-pointer {
  position: absolute;
  left: 50%;
  top: -10px;
  width: 0;
  height: 0;
  margin-left: -8px;
  border-left: 8px solid transparent;
  border-right: 8px solid transparent;
  border-top: 14px solid var(--gold);
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, .6));
  z-index: 5;
}

/* ===== History strip ===== */

.history-strip {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  justify-content: flex-start;
  min-height: 32px;
}

.history-pip {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.72rem;
  font-weight: 800;
  color: #fff;
  font-variant-numeric: tabular-nums;
  border: 2px solid rgba(255,255,255,0.15);
  box-shadow: 0 2px 4px rgba(0,0,0,.35);
}
.history-pip.pip-red   { background: var(--chip-red); }
.history-pip.pip-black { background: #111; border-color: rgba(255,255,255,0.25); }
.history-pip.pip-green { background: var(--green); }
.history-pip.latest    { box-shadow: 0 0 0 2px var(--gold), 0 2px 6px rgba(0,0,0,.4); transform: scale(1.1); }

/* ===== Result panel ===== */

.result-panel {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: 10px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  min-height: 56px;
  animation: resultIn .3s ease;
}
@keyframes resultIn {
  from { opacity: 0; transform: translateY(-6px); }
  to   { opacity: 1; transform: translateY(0); }
}

.result-pocket {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-size: 1.5rem;
  color: #fff;
  font-variant-numeric: tabular-nums;
  box-shadow: 0 3px 8px rgba(0,0,0,.45), inset 0 1px 2px rgba(255,255,255,.15);
  border: 2px solid rgba(255,255,255,0.18);
}
.result-pocket.color-red   { background: radial-gradient(circle at 35% 30%, #e96363 0%, var(--chip-red) 80%); }
.result-pocket.color-black { background: radial-gradient(circle at 35% 30%, #444 0%, #0c0c0c 80%); }
.result-pocket.color-green { background: radial-gradient(circle at 35% 30%, #46b76a 0%, var(--green) 80%); }

.result-summary {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text);
}
.result-summary .net-pos { color: var(--green-bright); }
.result-summary .net-neg { color: var(--red-bright); }

/* ===== Roulette felt ===== */

.felt-surface {
  width: 100%;
  max-width: 900px;
  background:
    repeating-linear-gradient(
      0deg,
      transparent,
      transparent 2px,
      rgba(0,0,0,.015) 2px,
      rgba(0,0,0,.015) 4px
    ),
    radial-gradient(ellipse at 50% 30%, var(--felt-light) 0%, var(--felt) 55%, var(--felt-dark) 100%);
  border-radius: 14px;
  border: 8px solid #14341c;
  padding: 26px 18px 18px;
  position: relative;
  box-shadow:
    inset 0 2px 32px rgba(0,0,0,.32),
    0 6px 24px rgba(0,0,0,.5);
}
.felt-surface::before {
  content: '';
  position: absolute;
  inset: -8px;
  border-radius: 20px;
  background: linear-gradient(180deg, #1e4528 0%, #14341c 50%, #0f2a16 100%);
  z-index: -1;
  box-shadow:
    inset 0 2px 6px rgba(255,255,255,.08),
    inset 0 -2px 6px rgba(0,0,0,.3),
    0 8px 30px rgba(0,0,0,.55);
}

.felt-edge-label {
  position: absolute;
  top: 6px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 0.58rem;
  font-weight: 700;
  letter-spacing: 0.18em;
  color: rgba(255,255,255,0.22);
  white-space: nowrap;
}

/* ===== The layout: grid arrangement =====
   Columns: [zero-col 36px] [numbers 12fr] [columns 44px]
   Rows: numbers (3 rows), dozens (1 row), outside (2 rows) */
.roulette-layout {
  display: grid;
  grid-template-columns: 40px 1fr 48px;
  grid-template-areas:
    "zero numbers col-bets"
    ".    dozens  ."
    ".    outside .";
  gap: 4px;
}

/* zero column (0 and 00 stacked) — spans the 3 number rows on left */
.zero-col {
  grid-area: zero;
  display: grid;
  grid-template-rows: 1fr 1fr;
  gap: 0;
}

.numbers-grid {
  grid-area: numbers;
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  grid-template-rows: repeat(3, 1fr);
  gap: 0;
  position: relative; /* anchor for the inside-bet overlay */
}

/* ===== Inside-bet overlay (splits, streets, corners, six-lines) =====
   Small click targets positioned on grid edges + intersections. The
   container passes pointer events through to the pockets behind. */

.bet-overlay {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 4;
}

.bet-target {
  position: absolute;
  transform: translate(-50%, -50%);
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.04);
  border: 1px dashed rgba(255, 255, 255, 0.18);
  cursor: pointer;
  pointer-events: auto;
  padding: 0;
  font-size: 0;
  color: transparent;
  transition: background .15s, border-color .15s, transform .1s, opacity .15s;
}
.bet-target:hover {
  background: rgba(229, 184, 74, 0.45);
  border: 2px solid var(--gold);
  transform: translate(-50%, -50%) scale(1.35);
  z-index: 10;
}
.bet-target.flash-win {
  animation: pocketWin 1.6s ease;
}

/* When a chip is sitting on a target, hide the dashed outline so only the
   chip shows. The chip itself indicates the bet is live. */
.bet-target.has-chip {
  background: transparent;
  border-color: transparent;
}
.bet-target.has-chip:hover {
  background: rgba(229, 184, 74, 0.25);
  border: 2px dashed var(--gold);
}

.column-bets {
  grid-area: col-bets;
  display: grid;
  grid-template-rows: repeat(3, 1fr);
  gap: 0;
}

.dozen-bets {
  grid-area: dozens;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0;
}

.outside-bets {
  grid-area: outside;
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 0;
}

/* ===== Pockets (number cells) ===== */

.pocket {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  font-family: var(--font-display);
  font-size: 1.05rem;
  color: #fff;
  border: 1px solid rgba(255,255,255,0.22);
  cursor: pointer;
  font-variant-numeric: tabular-nums;
  transition: filter .12s, transform .08s;
  outline: none;
  user-select: none;
}
.pocket-red   { background: var(--chip-red); }
.pocket-black { background: #0e0e0e; }
.pocket-green {
  background: linear-gradient(180deg, #1a8a42 0%, #0d6b2c 100%);
}
.pocket:hover { filter: brightness(1.18); }
.pocket:active { transform: scale(0.97); }

.pocket.flash-win {
  animation: pocketWin 1.6s ease;
  z-index: 2;
}
@keyframes pocketWin {
  0%, 100% { box-shadow: 0 0 0 0 rgba(229,184,74,0); }
  50%      { box-shadow: 0 0 0 6px rgba(229,184,74,.75), 0 0 18px rgba(229,184,74,.6); }
}

.pocket.flash-result {
  animation: pocketResult 1.6s ease;
}
@keyframes pocketResult {
  0%, 100% { outline: 0 solid transparent; }
  50%      { outline: 3px solid var(--gold-bright); outline-offset: -3px; }
}

/* ===== Outside / column / dozen bet boxes ===== */

.bet-box {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.92);
  background: transparent;
  border: 1px solid rgba(255,255,255,0.22);
  cursor: pointer;
  transition: background .15s, filter .15s, transform .08s;
  font-family: var(--font-body);
  outline: none;
}
.bet-box:hover { background: rgba(255,255,255,.05); }
.bet-box:active { transform: scale(0.98); }

.bet-box.bet-red {
  background: linear-gradient(180deg, rgba(201,61,61,0.65) 0%, rgba(201,61,61,0.85) 100%);
  color: #fff;
}
.bet-box.bet-red:hover {
  background: linear-gradient(180deg, rgba(224,82,82,0.85) 0%, rgba(201,61,61,1) 100%);
}
.bet-box.bet-black {
  background: linear-gradient(180deg, #1a1a1a 0%, #060606 100%);
  color: #fff;
}
.bet-box.bet-black:hover {
  background: linear-gradient(180deg, #2a2a2a 0%, #0e0e0e 100%);
}

.bet-box.flash-win {
  animation: pocketWin 1.6s ease;
}

/* Chip indicator on bet boxes & pockets */
.pocket .chip-indicator,
.bet-box .chip-indicator {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 3;
  pointer-events: none;
}

.chip-indicator {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, var(--gold-bright) 0%, var(--gold) 80%);
  border: 2px dashed rgba(0,0,0,.4);
  color: #1a1a1a;
  font-size: 0.6rem;
  font-weight: 800;
  font-family: var(--font-body);
  box-shadow: 0 2px 5px rgba(0,0,0,.5), inset 0 1px 2px rgba(255,255,255,.3);
  font-variant-numeric: tabular-nums;
}

/* ===== Controls area ===== */

.controls-area {
  flex-shrink: 0;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: 16px 20px 22px;
  background: var(--surface);
  border-top: 1px solid var(--border);
}

.chip-rack {
  display: flex;
  gap: 8px;
  align-items: center;
}

.chip-btn {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  border: 3px dashed rgba(255,255,255,0.4);
  cursor: pointer;
  font-family: var(--font-body);
  font-weight: 800;
  font-size: 0.78rem;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 3px 8px rgba(0,0,0,.45), inset 0 -2px 4px rgba(0,0,0,.3);
  transition: transform .1s, filter .12s;
  flex-shrink: 0;
}
.chip-btn:hover { transform: translateY(-2px); filter: brightness(1.1); }
.chip-btn:active { transform: translateY(0); }
.chip-btn.selected {
  outline: 3px solid var(--gold);
  outline-offset: 2px;
  transform: translateY(-2px);
}
.chip-btn[data-denom="1"]   { background: radial-gradient(circle at 35% 30%, #fff 0%, #d2d2d2 80%); color: #222; }
.chip-btn[data-denom="5"]   { background: radial-gradient(circle at 35% 30%, #e05252 0%, var(--chip-red) 80%); }
.chip-btn[data-denom="25"]  { background: radial-gradient(circle at 35% 30%, #3bb46f 0%, var(--chip-green) 80%); }
.chip-btn[data-denom="100"] { background: radial-gradient(circle at 35% 30%, #2a2a2a 0%, var(--chip-black) 80%); }

.bet-summary {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  padding: 0 16px;
  border-left: 1px solid var(--border);
  border-right: 1px solid var(--border);
}
.bet-summary-label {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-dim);
}
.bet-summary-value {
  font-size: 1.3rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--gold);
}

.action-buttons {
  display: flex;
  gap: 8px;
  align-items: center;
}

.btn-action {
  padding: 11px 18px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 0.85rem;
  font-weight: 700;
  border-radius: var(--radius);
  cursor: pointer;
  transition: all .15s;
  min-width: 84px;
}
.btn-action:hover:not(:disabled) {
  background: var(--surface-3);
  border-color: var(--text-dim);
}
.btn-action:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}
.btn-action.btn-spin {
  background: var(--green);
  color: #fff;
  border-color: transparent;
  box-shadow: 0 2px 10px rgba(45,159,95,.3);
}
.btn-action.btn-spin:hover:not(:disabled) {
  background: var(--green-bright);
  box-shadow: 0 4px 14px rgba(45,159,95,.4);
}
.btn-action.btn-spin:disabled {
  background: var(--surface-2);
  color: var(--text-dim);
  box-shadow: none;
}
.btn-action.btn-new {
  background: var(--gold);
  color: #1a1a1a;
  border-color: transparent;
}
.btn-action.btn-new:hover {
  background: var(--gold-bright);
}
.btn-action.btn-rebet {
  border-color: var(--gold-dim);
  color: var(--gold);
}
.btn-action.btn-rebet:hover {
  border-color: var(--gold);
  background: var(--gold-dim);
}

/* ===== Coach panel ===== */

.coach-panel {
  width: 100%;
  max-width: 900px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 0.9rem;
}
.coach-panel .coach-label {
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--cyan);
  flex-shrink: 0;
}
.coach-panel .coach-text {
  color: var(--text-muted);
  flex: 1;
  line-height: 1.5;
}
.coach-panel .coach-text strong { color: var(--text); }
.coach-panel .coach-text .pos { color: var(--green-bright); font-weight: 700; }
.coach-panel .coach-text .neg { color: var(--red-bright); font-weight: 700; }

/* ===== Spinning animation =====
   We use a flash overlay + rapid pocket highlighting during spin. */

.felt-surface.spinning .pocket,
.felt-surface.spinning .bet-box {
  pointer-events: none;
}

.pocket.spin-flash {
  animation: spinFlash .12s ease;
}
@keyframes spinFlash {
  0%   { box-shadow: 0 0 0 0 var(--gold); }
  50%  { box-shadow: 0 0 8px 3px var(--gold), inset 0 0 0 1px var(--gold); }
  100% { box-shadow: 0 0 0 0 var(--gold); }
}

/* ===== Responsive ===== */

@media (max-width: 720px) {
  .wheel-wrap { flex-direction: column; gap: 10px; align-items: stretch; }
  .wheel { width: 160px; height: 160px; align-self: center; }
  .wheel-num { font-size: 7px; width: 12px; height: 12px; margin-left: -6px; margin-top: -6px; line-height: 12px; }
  .wheel-hub { width: 26px; height: 26px; margin-left: -13px; margin-top: -13px; }
  .wheel-ball { width: 8px; height: 8px; margin-left: -4px; }
  .wheel-side { align-items: stretch; }
  .pocket {
    min-height: 36px;
    font-size: 0.78rem;
  }
  .bet-box {
    min-height: 32px;
    font-size: 0.62rem;
    letter-spacing: 0.04em;
  }
  .chip-indicator {
    width: 18px;
    height: 18px;
    font-size: 0.5rem;
  }
  .bet-target { width: 14px; height: 14px; }
  .felt-edge-label { font-size: 0.5rem; }
  .roulette-layout {
    grid-template-columns: 28px 1fr 38px;
    gap: 2px;
  }
  .felt-surface { padding: 22px 10px 10px; border-width: 6px; }
  .chip-btn { width: 44px; height: 44px; font-size: 0.65rem; }
  .controls-area { gap: 10px; padding: 12px; }
  .btn-action { padding: 9px 12px; font-size: 0.78rem; min-width: 64px; }
  .bet-summary { padding: 0 10px; }
  .bet-summary-value { font-size: 1.05rem; }
  .history-pip { width: 22px; height: 22px; font-size: 0.6rem; }
}

@media (max-width: 460px) {
  .pocket { min-height: 30px; font-size: 0.7rem; }
  .bet-box { min-height: 28px; font-size: 0.55rem; }
  .roulette-layout {
    grid-template-columns: 24px 1fr 32px;
  }
  .felt-edge-label { display: none; }
  .table-area { padding: 10px 6px 8px; }
}

/* ============================================================
   Tutorial — base card/progress/spotlight styles live in
   shared/styles.css. Roulette docks the panel into its own
   flex column inside .game-main (it does NOT float), so it
   overrides the shared fixed-position card and adds a Move
   toggle. Card overrides are scoped under .game-main so they
   win over the shared single-class rules (including media
   queries) by specificity, not source order.
   ============================================================ */

.game-main .tutorial-card {
  position: static;
  z-index: 2;
  inset: auto;
  flex-shrink: 0;
  width: 360px;
  max-width: none;
  overflow-x: visible;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: none;
  border-left: 1px solid var(--green);
  border-radius: 0;
  box-shadow: -8px 0 30px rgba(0, 0, 0, .35);
  animation: rouTutSlideIn .3s ease;
}
/* "Move" toggle flips the dock to the left side. */
.game-main.dock-left .tutorial-card {
  order: -1;
  border-left: none;
  border-right: 1px solid var(--green);
  box-shadow: 8px 0 30px rgba(0, 0, 0, .35);
}
@keyframes rouTutSlideIn {
  from { opacity: 0; transform: translateX(20px); }
  to   { opacity: 1; transform: translateX(0); }
}

.tut-progress-bar { flex-shrink: 0; }
.tut-step-count { gap: 10px; flex-shrink: 0; }
.tut-move {
  margin-left: auto;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 3px 8px;
  font-family: var(--font-body);
  font-size: 10px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.5px; color: var(--text-dim);
  cursor: pointer;
  transition: all .15s;
}
.tut-move:hover { color: var(--text); border-color: var(--text-dim); background: var(--surface-2); }
.tut-skip { margin-top: auto; padding: 10px; flex-shrink: 0; }

/* Narrow screens: stack the table and tutorial vertically. The tutorial
   docks below the felt (in flow) and the controls stay pinned at the bottom,
   so nothing is ever covered. */
@media (max-width: 820px) {
  .game-main { flex-direction: column; }
  .game-main .tutorial-card {
    width: auto;
    max-height: 42vh;
    border-left: none;
    border-top: 1px solid var(--green);
    box-shadow: 0 -8px 30px rgba(0, 0, 0, .35);
  }
  /* On mobile the move toggle flips top/bottom instead of left/right. */
  .game-main.dock-left { flex-direction: column-reverse; }
  .game-main.dock-left .tutorial-card {
    order: 0;
    border-right: none;
    border-top: none;
    border-bottom: 1px solid var(--green);
    box-shadow: 0 8px 30px rgba(0, 0, 0, .35);
  }
}
@media (max-width: 520px) {
  .game-main .tutorial-card { max-height: 46vh; }
}
