/* ============================================================
   Layout shared by every game inside the frame: the bet panel on
   the left, the table on the right.

   The panel is a single component set reused by all thirteen
   games: a mode toggle, labelled fields, the bet amount input,
   sliders, selects, and one full width action bar at the bottom.
   ============================================================ */

body {
  height: 100vh;
  overflow: hidden;
  background: var(--bg);
}

/* The markup lists the stage first, so both are placed explicitly
   rather than relying on source order. */
.game {
  display: grid;
  grid-template-columns: 316px 1fr;
  gap: 0;
  height: 100vh;
  padding: 12px;
}

.rail {
  grid-column: 1;
  grid-row: 1;
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 16px;
  background: var(--panel);
  border-radius: var(--r-lg) 0 0 var(--r-lg);
  overflow-y: auto;
}

.stage {
  grid-column: 2;
  grid-row: 1;
  position: relative;
  display: grid;
  place-items: center;
  min-width: 0;
  overflow: hidden;
  padding: 20px;
  background: var(--panel-2);
  border-radius: 0 var(--r-lg) var(--r-lg) 0;
}

.rail-block { display: flex; flex-direction: column; gap: 8px; }
.rail-foot { margin-top: auto; }

/* ============================================================
   Mode toggle: the pill at the top of the panel
   ============================================================ */

.betmode {
  display: flex;
  padding: 5px;
  border-radius: 100px;
  background: var(--bg);
}
.betmode button {
  flex: 1;
  padding: 13px 0;
  border-radius: 100px;
  font-size: 15px;
  font-weight: 700;
  color: var(--muted);
  transition: background .16s var(--ease), color .16s var(--ease);
}
.betmode button:hover:not([disabled]) { color: var(--text); }
.betmode button.on { background: var(--panel-3); color: var(--text); }
.betmode button[disabled] { opacity: .4; cursor: not-allowed; }

/* ============================================================
   Field: a label row, then the control
   ============================================================ */

.field { display: flex; flex-direction: column; gap: 8px; }

.field-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}
.field-head > span:first-child { font-size: 14px; font-weight: 500; color: var(--muted); }
.field-head .aside {
  font-size: 13.5px;
  font-weight: 500;
  color: var(--faint);
  font-variant-numeric: tabular-nums;
}

/* ---------- bet amount ---------- */

.amount {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 54px;
  padding: 0 6px 0 14px;
  border-radius: var(--r-lg);
  background: var(--bg);
  border: 1px solid var(--line);
  transition: border-color .15s var(--ease);
}
.amount:focus-within { border-color: var(--panel-4); }

.coinmark { flex: none; display: grid; place-items: center; }

.amount input {
  flex: 1;
  min-width: 0;
  background: none;
  border: 0;
  outline: none;
  color: var(--text);
  font-family: inherit;
  font-size: 17px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.amount input::-webkit-outer-spin-button,
.amount input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.amount input[type=number] { -moz-appearance: textfield; }

/* the half / double pair sitting inside the field */
.quick { display: flex; gap: 6px; flex: none; }
.quick button {
  min-width: 46px;
  height: 42px;
  padding: 0 12px;
  border-radius: var(--r);
  background: var(--panel-3);
  color: var(--text);
  font-size: 14px;
  font-weight: 700;
  transition: background .14s var(--ease);
}
.quick button:hover { background: var(--panel-4); }

/* ---------- select ---------- */

.select {
  position: relative;
  display: flex;
  align-items: center;
  height: 54px;
  padding: 0 44px 0 16px;
  border-radius: var(--r-lg);
  background: var(--bg);
  border: 1px solid var(--line);
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
  cursor: pointer;
  transition: border-color .15s var(--ease);
}
.select:hover { border-color: var(--panel-4); }
.select::after {
  content: '';
  position: absolute;
  right: 18px;
  width: 9px; height: 9px;
  border-right: 2px solid var(--muted);
  border-bottom: 2px solid var(--muted);
  transform: translateY(-3px) rotate(45deg);
  pointer-events: none;
}
.select select {
  position: absolute;
  inset: 0;
  width: 100%;
  opacity: 0;
  cursor: pointer;
  font-family: inherit;
}

/* ---------- slider ---------- */

.sliderow { display: flex; align-items: center; gap: 14px; }
.sliderow > b {
  flex: none;
  min-width: 34px;
  font-size: 17px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

input[type=range].bar {
  flex: 1;
  min-width: 0;
  height: 8px;
  margin: 0;
  border-radius: 100px;
  -webkit-appearance: none;
  appearance: none;
  background: var(--panel-3);
  outline: none;
  cursor: pointer;
}
input[type=range].bar::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 22px; height: 22px;
  border-radius: 50%;
  background: #fff;
  border: 0;
  cursor: grab;
  box-shadow: 0 1px 4px rgba(0,0,0,.6);
}
input[type=range].bar::-moz-range-thumb {
  width: 22px; height: 22px;
  border-radius: 50%;
  background: #fff;
  border: 0;
  cursor: grab;
}
input[type=range].bar:focus-visible { outline: 2px solid var(--green); outline-offset: 3px; }

/* ---------- segmented picker, used for over/under and difficulty ---------- */

.seg { display: flex; gap: 4px; padding: 4px; border-radius: var(--r-lg); background: var(--bg); }
.seg button {
  flex: 1;
  padding: 12px 0;
  border-radius: var(--r);
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
  transition: background .14s var(--ease), color .14s var(--ease);
}
.seg button:hover { color: var(--text); }
.seg button.on { background: var(--panel-3); color: var(--text); }

/* ---------- action grid, two by two ---------- */

.actiongrid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.actiongrid button {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  height: 62px;
  border-radius: var(--r-lg);
  background: var(--panel-2);
  color: var(--text);
  font-size: 15px;
  font-weight: 700;
  transition: background .14s var(--ease);
}
.actiongrid button:hover:not([disabled]) { background: var(--panel-3); }
.actiongrid button[disabled] { opacity: .4; }

/* ---------- quick preset row ---------- */

.chips { display: flex; gap: 6px; }
.chips button {
  flex: 1;
  height: 40px;
  border-radius: var(--r);
  background: var(--panel-2);
  color: var(--muted);
  font-size: 13.5px;
  font-weight: 700;
  transition: background .14s var(--ease), color .14s var(--ease);
}
.chips button:hover { background: var(--panel-3); color: var(--text); }
.chips button.on { background: var(--panel-3); color: var(--text); }

/* ============================================================
   The action bar. Every game's primary button lands here.
   ============================================================ */

.rail .btn-lg,
.rail .btn-primary,
.rail .btn-gold,
.rail .btn-green {
  width: 100%;
  min-height: 62px;
  border-radius: var(--r-lg);
  font-size: 16.5px;
  font-weight: 700;
  letter-spacing: -.005em;
}
.rail .btn-gold, .rail .btn-green, .rail .btn-primary {
  background: var(--green);
  color: #052314;
}
.rail .btn-gold:hover, .rail .btn-green:hover, .rail .btn-primary:hover { background: #1AFF92; }

/* ============================================================
   Readouts and history
   ============================================================ */

.rail .label { font-size: 14px; font-weight: 500; color: var(--muted); }

.readout { display: flex; flex-direction: column; gap: 2px; border-radius: var(--r); overflow: hidden; }
.readout div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  background: var(--panel-2);
  font-size: 13.5px;
  color: var(--muted);
}
.readout b { color: var(--text); font-weight: 700; font-variant-numeric: tabular-nums; }
.readout b.gold { color: var(--green); }

.history { display: flex; flex-wrap: wrap; gap: 5px; }
.history span {
  padding: 5px 10px;
  border-radius: var(--r-sm);
  font-size: 11.5px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  background: var(--panel-2);
  color: var(--muted);
  animation: pop .24s var(--ease);
}
.history span.hot  { background: var(--green); color: #052314; }
.history span.win  { color: var(--green); background: var(--green-dim); }
.history span.cold { color: var(--faint); }
.history span.bust { color: var(--red); background: var(--red-dim); }

@keyframes pop {
  from { transform: scale(.7); opacity: 0; }
  to   { transform: scale(1); opacity: 1; }
}

/* ============================================================
   Narrow: panel drops under the table
   ============================================================ */

@media (max-width: 820px) {
  .game { grid-template-columns: 1fr; grid-template-rows: 1fr auto; padding: 8px; gap: 8px; }
  .stage { grid-column: 1; grid-row: 1; border-radius: var(--r-lg); }
  .rail {
    grid-column: 1;
    grid-row: 2;
    border-radius: var(--r-lg);
    max-height: 46vh;
  }
  .hide-sm { display: none; }
}

/* ============================================================
   Secondary number fields, styled like the bet amount so the
   panel reads as one component set.
   ============================================================ */

.stake {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 54px;
  padding: 0 6px 0 16px;
  border-radius: var(--r-lg);
  background: var(--bg);
  border: 1px solid var(--line);
  transition: border-color .15s var(--ease);
}
.stake:focus-within { border-color: var(--panel-4); }
.stake input {
  flex: 1;
  min-width: 0;
  background: none;
  border: 0;
  outline: none;
  color: var(--text);
  font-family: inherit;
  font-size: 17px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  text-align: left;
}
.stake input::-webkit-outer-spin-button,
.stake input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.stake input[type=number] { -moz-appearance: textfield; }
.stake .suffix { padding-right: 12px; color: var(--faint); font-weight: 700; font-size: 15px; }
.stake button {
  width: 42px; height: 42px;
  flex: none;
  border-radius: var(--r);
  background: var(--panel-3);
  color: var(--text);
  font-size: 16px; font-weight: 700; line-height: 1;
  transition: background .14s var(--ease);
}
.stake button:hover { background: var(--panel-4); }

/* toggles inside the panel */
.toggle { display: flex; align-items: center; gap: 10px; font-size: 13.5px; color: var(--muted); cursor: pointer; user-select: none; }
.toggle input { position: absolute; opacity: 0; width: 0; height: 0; }
.toggle .track {
  width: 38px; height: 22px; flex: none;
  border-radius: 100px; background: var(--panel-3);
  position: relative; transition: background .18s var(--ease);
}
.toggle .knob {
  position: absolute; top: 3px; left: 3px;
  width: 16px; height: 16px; border-radius: 50%;
  background: var(--muted);
  transition: transform .2s var(--ease), background .18s var(--ease);
}
.toggle input:checked + .track { background: var(--green); }
.toggle input:checked + .track .knob { transform: translateX(16px); background: #052314; }
.toggle input:focus-visible + .track { outline: 2px solid var(--green); outline-offset: 2px; }

/* ============================================================
   Cross-game fixes: these two colours were hardcoded in markup
   that predates the per-brand accent system, so they never
   rebranded with everything else.
   ============================================================ */
.coinmark svg circle:first-child { fill: var(--green); }

/* ============================================================
   Autoplay panel. Sits where Manual's controls already are,
   shown only while the Auto tab is selected.
   ============================================================ */

.autopanel { display: flex; flex-direction: column; gap: 14px; }
.autopanel .ap-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.autopanel input[type=number] {
  width: 100%;
  height: 46px;
  padding: 0 14px;
  border-radius: var(--r-lg);
  background: var(--bg);
  border: 1px solid var(--line);
  color: var(--text);
  font-family: inherit;
  font-size: 15px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  transition: border-color .15s var(--ease);
}
.autopanel input[type=number]:focus { outline: none; border-color: var(--green); }
.autopanel input[type=number]::placeholder { color: var(--faint); font-weight: 500; }
.autopanel input:disabled { opacity: .5; }
.ap-start, .ap-stop { width: 100%; }
.ap-stop { background: var(--panel-3); color: var(--text); }
.ap-stop:hover { background: var(--panel-4); }
.ap-live { display: flex; flex-direction: column; gap: 12px; }
.ap-stats { display: flex; gap: 10px; }
.ap-stats > div { flex: 1; padding: 12px 14px; border-radius: var(--r-lg); background: var(--bg); }
.ap-stats span { display: block; margin-bottom: 4px; font-size: 12px; color: var(--faint); }
.ap-stats b { font-size: 18px; font-weight: 700; font-variant-numeric: tabular-nums; color: var(--text); }
.ap-stats b.good { color: var(--green); }
.ap-stats b.bad { color: var(--red); }
.ap-reason { margin: 0; font-size: 13px; line-height: 1.5; color: var(--muted); }
