@import url('https://fonts.googleapis.com/css2?family=Montserrat:wght@400;500;600;700&display=swap');

:root {
  --bg: #00033D;
  /* deep indigo */
  --panel: #001A5F;
  /* panel blue */
  --text: #ffffff;
  --muted: #A3D1FF;
  /* light sky */
  --accent: #0074FF;
  /* primary blue */
  --accent-soft: #24AAFF;
  --subaccent: #AF71FF;
  /* violet for subtabs */
  --positive: #19c37d;
  --negative: #ff5d5d;
  --left-rail: 350px;
  /* left sidebar width */
  --right-rail: 320px;
  /* right sidebar width */
  --rail: 360px;
  --rail-gap: 32px;
  /* extra bottom gap to reduce right rail height */
  --subtab-h: 44px;
  /* mobile subtab bar height */
  --bet-gap: 12px;
  /* keep gaps consistent between chips and panels */
}

* {
  box-sizing: border-box
}

html,
body {
  height: 100%
}

body {
  margin: 0;
  font-family: Poppins, system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  color: var(--text);
  background-color: var(--bg);
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  background-attachment: fixed;
  overflow-x: hidden
}

.muted {
  color: var(--muted)
}

.app {
  min-height: 100vh;
  /* Use dynamic viewport height where supported to avoid browser UI issues */
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}


/* Desktop: allow scrolling */
@media (min-width: 1200px) {

  html,
  body {
    overflow-y: auto;
  }

  .app {
    height: auto;
    min-height: 100vh;
    min-height: 100dvh;
    overflow: visible;
  }
}

/* Header */
.hdr-inner {
  position: sticky;
  top: 0;
  z-index: 20;
  background: #004DA9;
  backdrop-filter: blur(8px);
  border-bottom: 1px solid rgba(0, 116, 255, .35);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  width: 100%;
  margin: 0
}

.brand {
  font-weight: 800;
  letter-spacing: .8px;
  text-transform: uppercase
}

.hamb {
  width: 40px;
  height: 36px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, .1);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  color: var(--text);
  cursor: pointer
}

.hamb:focus {
  outline: 2px solid var(--accent);
  outline-offset: 2px
}

.hamb-lines {
  display: grid;
  gap: 4px
}

.hamb-lines span {
  display: block;
  width: 18px;
  height: 2px;
  background: var(--panel);
  border-radius: 10px
}

/* Dropdown */
.dd {
  position: absolute;
  right: 16px;
  top: 56px;
  z-index: 50;
  background: var(--panel);
  border: 1px solid rgba(0, 116, 255, .35);
  border-radius: 10px;
  min-width: 220px;
  max-width: 92vw;
  box-shadow: 0 10px 30px rgba(0, 104, 225, .35);
  padding: 6px
}

.dd a:last-child {
  margin-top: 4px;
  border-top: 1px solid rgba(255, 255, 255, .08);
}

.dd[hidden] {
  display: none
}

.dd a {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border-radius: 8px;
  color: var(--text);
  text-decoration: none
}

.dd a:hover,
.dd a:focus {
  background: rgba(255, 255, 255, .06);
  outline: none
}

/* Main layout - Three column grid */
.main {
  max-width: 100%;
  margin: 0 auto;
  padding: 10px 16px;
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
  width: 100%;
  /* Ensure main content fills the viewport height below the header */
  min-height: calc(100dvh - var(--hdr-offset, 72px));
  max-height: unset;
  overflow: visible;
  background: #040029;
}

@media (min-width:1200px) {
  .main {
    grid-template-columns: var(--left-rail) 1fr var(--right-rail);
    gap: 20px;
    max-width: 1600px
  }
}

/* Center column fills available height */
.center-column {
  /* display: grid;
  grid-template-rows: 1fr auto;
  min-height: 0 */
}

/* Top status */
.status-badge {
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: 6px;
  padding: 10px 14px;
  border-radius: 12px;
  border: 2px solid var(--accent-soft);
  color: var(--muted);
  box-shadow: 0 0 9px 1px rgba(0, 116, 255, 1);
  background: #001A5F;
  font-weight: 700;
  text-transform: uppercase;
  gap: 12px;
  width: 100%;
  box-sizing: border-box
}

@keyframes blink {

  0%,
  100% {
    opacity: 1
  }

  50% {
    opacity: .2
  }
}

.phase-time {
  display: flex;
  align-items: center;
  gap: 10px
}

.status-phase {
  letter-spacing: .3px
}

.status-eta {
  font-variant-numeric: tabular-nums;
  font-family: "Roboto Mono", ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace
}

/* Board */
.canvas-board {
  position: relative;
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  min-height: 0;
  height: auto;
  max-height: unset;
  overflow: visible
}

@media (max-width:899px) {
  .canvas-board {
    grid-template-columns: 1fr
  }
}

/* Left/right stock rails flanking the circle */
.dice-rail {
  position: relative;
  width: var(--railW);
  min-width: 0;
  box-sizing: border-box;
  background: linear-gradient(91deg, #0E377B 1.49%, #000E38 100%);
  border: 1px solid #6DC1EE;
  border-radius: 6px;
  display: grid;
  gap: 4px;
  max-height: 100%;
  overflow: hidden;
  text-align: center;
}

.dice-rail .rail-hdr {
  font-weight: 400;
  text-align: center;
  font-size: 12px;
  background: #4467CC80;
  border-radius: 5px 5px 0 0;
  padding: 5px 0;
  margin: -1px -1px 2px -1px;
  width: calc(100% + 2px);
}

.dice-rail .cells {
  display: grid;
  gap: 0;
  justify-items: stretch;
  width: 100%;
  padding: 0 5px;
}

.dice-rail-left {
  justify-self: start
}

.dice-rail-right {
  justify-self: end
}

.mini-cell {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 2px 4px;
  border-radius: 0;
  background: transparent;
  border: none;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  width: 100%;
  transition: all 0.2s ease;
}

.mini-cell:last-child {
  border-bottom: none;
}

.cell-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
}

.cell-bot {
  display: flex;
  align-items: center;
  gap: 4px;
}

.mini-cell .lbl {
  font-weight: 400;
  font-size: 10px;
  color: #fff;
  text-transform: uppercase;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cell-badge {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 600;
  color: #fff;
}

.mini-cell .mv {
  font-variant-numeric: tabular-nums;
  font-family: "Roboto Mono", ui-monospace, monospace;
  font-size: 12px;
  font-weight: 400;
}

.arrow {
  font-size: 10px;
}

/* Color coding */
.mini-cell.up .mv,
.mini-cell.up .arrow {
  color: var(--positive);
}

.mini-cell.down .mv,
.mini-cell.down .arrow {
  color: var(--negative);
}

.mini-cell.neutral .mv,
.mini-cell.neutral .arrow {
  color: #fff;
}

/* Center column */
.canvas-center {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  width: 100%;
  height: 100%;
}

.status-container {
  margin-top: 10px;
  width: 65%;
  display: flex;
  justify-content: center;
  margin-bottom: 8px;
  z-index: 10;
}

.game-frame {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  padding: 10px 5px;
  border-radius: 10px;
  background: linear-gradient(180deg, #0a193a, #081130);
  border: 1px solid rgba(109, 193, 238, .5);
  box-shadow: 0 0 20px rgba(0, 0, 0, 0.3);
  --railW: 140px;
  --railsPad: 5px
}

.circle-row {
  position: relative;
  display: grid;
  grid-template-columns: var(--railW) 1fr var(--railW);
  align-items: center;
  justify-items: center;
  gap: 12px;
  width: 100%
}

.mid-col {
  display: grid;
  grid-template-rows: auto auto auto;
  place-items: center;
  width: 100%
}

.canvas-circle {
  position: absolute;
  transform: translate(-20%, -22%);
  --circle-size: min(80vmin, 600px);
  --die-size: clamp(40px, calc(var(--circle-size) * .15), 100px);
  --die-half: calc(var(--die-size) / 2);
  --pip: clamp(6px, calc(var(--die-size) * .15), 16px);
  --die-off-x: calc(var(--circle-size) * .15);
  --die-off-y: calc(var(--circle-size) * .025);
  width: var(--circle-size);
  height: var(--circle-size);
  max-width: 50%;
  max-height: 90%;
  border-radius: 50%;
  border: 2px solid #4467CC;
  box-shadow: 20px 20px 100px 18px #4467CC;
  /* box-shadow: inset 0 0 40px rgba(0, 0, 0, .4); */
  display: block;
  margin-top: 35px;
}

.dice-wrap {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  perspective: 700px
}

.die-wrap {
  position: absolute
}

.die-wrap[data-die="d1"] {
  transform: translate(calc(-1 * var(--die-off-x)), calc(-1 * var(--die-off-y)))
}

.die-wrap[data-die="d2"] {
  transform: translate(var(--die-off-x), var(--die-off-y))
}

.die {
  width: var(--die-size);
  height: var(--die-size);
  border-radius: 0;
  position: relative;
  transform-style: preserve-3d;
  transition: transform .28s cubic-bezier(.2, 1, .2, 1), box-shadow .28s ease;
  backface-visibility: hidden;
  transform: none;
  --lift-a: calc(var(--die-size) * .20);
  --lift-b: calc(var(--die-size) * .15);
  --lift-c: calc(var(--die-size) * .10)
}

/* Build 3D cube faces */
.die .face {
  position: absolute;
  inset: 0;
  border-radius: 0;
  background: radial-gradient(circle at 30% 30%, #ffffff, #d9e6ff);
  box-shadow: inset 0 0 0 2px rgba(0, 0, 0, .15), 0 10px 24px rgba(0, 0, 0, .35), 0 2px 0 rgba(0, 0, 0, .35);
}

.die .f1 {
  transform: translateZ(var(--die-half))
}

.die .f6 {
  transform: rotateY(180deg) translateZ(var(--die-half))
}

.die .f2 {
  transform: rotateY(90deg) translateZ(var(--die-half))
}

.die .f5 {
  transform: rotateY(-90deg) translateZ(var(--die-half))
}

.die .f3 {
  transform: rotateX(90deg) translateZ(var(--die-half))
}

.die .f4 {
  transform: rotateX(-90deg) translateZ(var(--die-half))
}

.die.rolling-a {
  animation: dice-roll-a 1.2s cubic-bezier(.35, .9, .2, 1) infinite
}

.die.rolling-b {
  animation: dice-roll-b 1.35s cubic-bezier(.35, .9, .2, 1) infinite
}

@keyframes dice-roll-a {
  0% {
    transform: translateY(0) rotateX(0) rotateY(0) rotateZ(0)
  }

  20% {
    transform: translateY(calc(-1 * var(--lift-a))) rotateX(180deg) rotateY(90deg) rotateZ(10deg)
  }

  40% {
    transform: translateY(0) rotateX(360deg) rotateY(180deg) rotateZ(0)
  }

  60% {
    transform: translateY(calc(-1 * var(--lift-b))) rotateX(540deg) rotateY(270deg) rotateZ(-8deg)
  }

  80% {
    transform: translateY(0) rotateX(720deg) rotateY(360deg) rotateZ(0)
  }

  100% {
    transform: translateY(0) rotateX(900deg) rotateY(450deg) rotateZ(6deg)
  }
}

@keyframes dice-roll-b {
  0% {
    transform: translateY(0) rotateX(0) rotateY(0) rotateZ(0)
  }

  25% {
    transform: translateY(calc(-1 * var(--lift-b))) rotateX(180deg) rotateY(120deg) rotateZ(-8deg)
  }

  50% {
    transform: translateY(0) rotateX(360deg) rotateY(240deg) rotateZ(0)
  }

  75% {
    transform: translateY(calc(-1 * var(--lift-c))) rotateX(540deg) rotateY(360deg) rotateZ(6deg)
  }

  100% {
    transform: translateY(0) rotateX(720deg) rotateY(480deg) rotateZ(0)
  }
}

/* land/settle bounce */
.die.settle {
  animation: die-settle .28s cubic-bezier(.2, 1.4, .34, 1)
}

@keyframes die-settle {
  0% {
    transform: scale(.96)
  }

  60% {
    transform: scale(1.04)
  }

  100% {
    transform: scale(1)
  }
}

@keyframes dice-wobble {
  0% {
    transform: translate(0, 0) rotate(0)
  }

  25% {
    transform: translate(2px, -2px) rotate(3deg)
  }

  50% {
    transform: translate(0, 2px) rotate(0)
  }

  75% {
    transform: translate(-2px, 0) rotate(-3deg)
  }

  100% {
    transform: translate(0, 0) rotate(0)
  }
}

/* pips on each face */
.die .pip {
  position: absolute;
  width: var(--pip);
  height: var(--pip);
  border-radius: 50%;
  background: radial-gradient(circle at 40% 40%, #222, #000);
  box-shadow: inset 0 2px 2px rgba(255, 255, 255, .35)
}

/* Layout 7 reference points (3x3 grid with center) on each face */
.die .p1 {
  left: var(--pip);
  top: var(--pip)
}

.die .p2 {
  left: var(--pip);
  top: calc(50% - (var(--pip) / 2))
}

.die .p3 {
  left: var(--pip);
  bottom: var(--pip)
}

.die .p4 {
  left: calc(50% - (var(--pip) / 2));
  top: calc(50% - (var(--pip) / 2))
}

.die .p5 {
  right: var(--pip);
  top: var(--pip)
}

.die .p6 {
  right: var(--pip);
  top: calc(50% - (var(--pip) / 2))
}

.die .p7 {
  right: var(--pip);
  bottom: var(--pip)
}

/* removed dice-sum */
.genie {
  position: absolute;
  left: 50%;
  bottom: 0;
  transform: translate(-25%, 6%);
  pointer-events: none
}

.genie-img {
  width: clamp(200px, 32vmin, 400px);
  height: auto;
  object-fit: contain;
  filter: drop-shadow(0 8px 24px rgba(0, 0, 0, .55))
}

@media (max-width: 899px) {
  .canvas-circle {
    /* Shift top-left for mobile as requested */
    transform: translate(-55%, -25%);
  }

  .genie {
    /* Adjust genie to clear the shifted circle */
    transform: translate(-39%, 10%) scale(0.9);
    left: 55%;
  }

  .genie-img {
    width: clamp(235px, 45vmin, 350px);
  }
}

.status-below {
  width: 100%;
  margin-top: 6px;
  justify-self: stretch
}

.dice-tabs {
  margin: 10px 0px;
  display: inline-flex;
  gap: 30px;
  border-radius: 23px;
  padding: 1px 1px;
  justify-content: center;
  box-shadow: 0px 0px 25.5px 0px #000000 inset;
  border: 3px solid #4467CC;
  background: #242569;
}

.dice-tab {
  background: transparent;
  border: 0;
  color: #fff;
  padding: 8px 18px;
  border-radius: 23px;
  cursor: pointer;
  font-weight: 700
}

.dice-tab[aria-selected="true"] {
  /* background: linear-gradient(90deg, rgba(0, 116, 255, .18) 0%, rgba(175, 113, 255, .18) 100%);
  box-shadow: inset 0 0 0 1px rgba(36, 170, 255, .45) */
  background: #4632DE;
  border: 1px solid #412ECD;
}

.dice-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  width: 100%;
  justify-items: center
}

.col {
  background: transparent;
  border: 0;
  border-radius: 0;
  padding: 0
}

.col-hdr {
  display: none
}

.opts {
  --dice-opt-w: clamp(48px, 11vw, 72px);
  --dice-gap: 6px;
  display: flex;
  flex-wrap: wrap;
  gap: var(--dice-gap);
  justify-content: center;
  width: calc(6 * var(--dice-opt-w) + 5 * var(--dice-gap));
  max-width: 100%
}

.dice-opt {
  grid-auto-rows: auto
}

.dice-opt .num {
  display: block;
  font-size: 13px;
  font-weight: 700;
}

.dice-opt .mult {
  display: block;
  font-family: 'Inter', sans-serif;
  font-size: 11px;
}

.dice-grid .col {
  display: none
}

.dice-grid[data-active="D1"] .col[data-type="D1"] {
  display: block
}

.dice-grid[data-active="D2"] .col[data-type="D2"] {
  display: block
}

.dice-grid[data-active="SUM"] .col[data-type="SUM"] {
  display: block
}

.dice-opt {
  display: grid;
  gap: 0px;
  place-items: center;
  padding: 4px 6px;
  border-radius: 10px;
  background: linear-gradient(180deg, rgba(255, 255, 255, .10), rgba(255, 255, 255, .02)), linear-gradient(90deg, #2a78ff, #9a66ff);
  color: #fff;
  border: 0;
  cursor: pointer;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .15), inset 0 0 0 2px rgba(0, 0, 0, .35), 0 4px 16px rgba(0, 0, 0, .35);
  flex: 0 0 var(--dice-opt-w);
  width: var(--dice-opt-w);
  position: relative;
}

.dice-opt:hover {
  filter: saturate(1.1)
}

.dice-opt.win {
  position: relative;
  z-index: 1;
}

.dice-opt.win::after {
  content: "";
  position: absolute;
  top: -20px;
  right: -15px;
  width: 36px;
  height: 36px;
  background-image: url("/crown.png");
  background-size: contain;
  background-repeat: no-repeat;
  pointer-events: none;
  z-index: 10;
  transform: rotate(25deg);
}

/* Betting chip overlay */
.bet-chip-overlay {
  position: absolute;
  top: -15px;
  right: -8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  z-index: 10;
}

.bet-chip-overlay .chip-img {
  width: 35px;
  height: 35px;
  object-fit: contain;
}

.bet-chip-overlay .chip-amount {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: #ffffff;
  font-weight: 800;
  font-size: 11px;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.8);
  pointer-events: none;
}

/* Bet controls */
.bet-row {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--bet-gap);
  justify-items: center;
  margin-top: 5px
}

/* keep inner content from stretching edge-to-edge on huge screens */
.bet-row>* {
  width: 100%;
  max-width: min(960px, 100%)
}

@media (min-width:750px) {

  /* Desktop: chips, bet input, total bet on one row; actions below */
  .bet-row {
    grid-template-columns: fit-content(640px) max-content max-content;
    justify-content: center;
    justify-items: center;
    align-items: center
  }

  .bet-row>* {
    width: auto;
    max-width: none
  }

  .bet-actions {
    grid-column: 1 / -1;
    justify-self: center;
    justify-content: center
  }

  /* Left-align chips for clean column alignment */
  .chips {
    justify-content: flex-start
  }

  /* Prevent total bet wrapping for tidy alignment */
  .total-bet {
    white-space: nowrap
  }

  /* Ensure the chips container itself becomes the grid item for precise sizing */
  .chips-host {
    display: contents
  }
}

@media (min-width:750px) and (max-width:899px) {
  .bet-input {
    transform: scale(.92);
    transform-origin: center
  }

  .total-bet {
    transform: scale(.92);
    transform-origin: center
  }
}

.chips {
  display: flex;
  gap: var(--bet-gap);
  flex-wrap: wrap;
  justify-content: center
}

.chip {
  position: relative;
  height: 44px;
  min-width: 64px;
  padding: 0 16px;
  border-radius: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  cursor: pointer;
  user-select: none;
  color: #fff;
  font-weight: 800;
  letter-spacing: .2px;
  text-shadow: 0 0 6px rgba(0, 0, 0, .6), 0 0 2px rgba(255, 255, 255, .4);
  transform: translateZ(0);
  transition: transform .18s cubic-bezier(.34, 1.56, .64, 1), box-shadow .22s ease, filter .22s ease;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  will-change: transform;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, .10), rgba(255, 255, 255, .02)),
    linear-gradient(90deg, #2a78ff, #9a66ff);
  /* box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .15), inset 0 0 0 2px rgba(0, 0, 0, .35), 0 4px 16px rgba(0, 0, 0, .35) */
}

.chip:hover {
  filter: saturate(1.2);
  box-shadow: inset 0 0 0 3px rgba(0, 0, 0, .35), inset 0 0 0 6px rgba(255, 255, 255, .1), 0 6px 20px rgba(0, 0, 0, .45)
}

.chip.active {
  /* box-shadow: inset 0 0 0 3px rgba(0, 0, 0, .35), inset 0 0 0 6px rgba(255, 255, 255, .2), 0 8px 24px rgba(36, 170, 255, .45) */
}

.chip:hover {
  transform: translateY(-1px) scale(1.02)
}

.chip:active {
  transform: scale(.88)
}

.chip.is-pressing {
  transform: scale(.88)
}

.chip:focus {
  outline: 0
}

.chip:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px
}

.chip.active {
  border: 0
}

.bet-input {
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--panel);
  border: 1px solid var(--accent);
  border-radius: 999px;
  overflow: visible;
  box-shadow: 0 0 4.1px 0 rgba(0, 116, 255, .86);
  padding: 3px 6px;
  gap: 4px
}

.bet-input .bet-amt {
  display: inline-block;
  min-width: 6ch
}

.bet-input .inc,
.bet-input .dec {
  flex: 0 0 auto
}

.bet-input {
  background: var(--panel);
  box-shadow: 0 0 0 1px rgba(36, 170, 255, .35) inset, inset 0 6px 10px -8px rgba(0, 0, 0, .6), inset 0 -6px 10px -8px rgba(0, 0, 0, .6)
}

.bet-input button {
  height: 44px;
  width: 44px;
  background: linear-gradient(180deg, #2c4a8f, #223a73);
  border: 1px solid rgba(255, 255, 255, .22);
  border-radius: 50%;
  color: var(--text);
  cursor: pointer;
  display: inline-grid;
  place-items: center;
  font-weight: 600;
  font-size: 18px;
  line-height: 1;
  box-shadow: 0 2px 8px rgba(36, 170, 255, .28), inset 0 0 0 1px rgba(255, 255, 255, .08);
  transition: transform .18s cubic-bezier(.34, 1.56, .64, 1), box-shadow .22s ease, background .22s ease
}

.bet-input button:hover {
  background: linear-gradient(180deg, #3559a8, #294788);
  transform: translateY(-1px) scale(1.02);
  box-shadow: 0 4px 12px rgba(36, 170, 255, .38), inset 0 0 0 1px rgba(255, 255, 255, .12)
}

.bet-input button:active {
  transform: scale(.97)
}

.bet-input button:focus {
  outline: 2px solid var(--accent);
  outline-offset: 2px
}

.bet-amt {
  min-width: 96px;
  text-align: center;
  font-variant-numeric: tabular-nums;
  font-family: "Roboto Mono", ui-monospace, monospace;
  padding: 0 10px;
  color: #d7e8ff
}

.total-bet {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 10px 14px;
  background: linear-gradient(270deg, rgba(11, 156, 254, .3) 0%, rgba(211, 5, 254, .3) 100%);
  border: 1px solid var(--accent);
  border-radius: 30px;
  box-shadow: 0 0 4.1px 0 rgba(0, 116, 255, .86);
  font-weight: 500;
  white-space: nowrap
}

.total-bet .amt {
  display: inline-block;
  min-width: 6ch;
  text-align: right;
  font-variant-numeric: tabular-nums;
  font-family: "Roboto Mono", ui-monospace, monospace
}

/* Reduce visual size of bet input and total bet on desktop while keeping touch targets */
@media (min-width:900px) {
  .bet-input {
    transform: scale(.95);
    transform-origin: center
  }

  .total-bet {
    transform: scale(.95);
    transform-origin: center
  }

  .bet-amt {
    min-width: 90px
  }
}

/* Bet actions */
.bet-actions {
  display: flex;
  gap: 10px;
  justify-content: center
}

.bet-actions button {
  height: 44px;
  min-width: 90px;
  padding: 0 16px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, .22);
  background: linear-gradient(180deg, #2c4a8f, #223a73);
  color: #fff;
  cursor: pointer;
  font-weight: 800;
  letter-spacing: .2px;
  box-shadow: 0 2px 8px rgba(36, 170, 255, .28), inset 0 0 0 1px rgba(255, 255, 255, .08)
}

.bet-actions button:hover {
  background: linear-gradient(180deg, #3559a8, #294788)
}

.bet-actions .heads {
  outline: 2px solid rgba(36, 170, 255, .45)
}

.bet-actions .tails {
  outline: 2px solid rgba(175, 113, 255, .45)
}

/* Right rail */
.rail {
  position: relative;
  padding: 0 8px 0 8px;
  overflow: visible
}

/* Make the right panel fill the available viewport height below the header */
.rail-sticky {
  position: sticky;
  top: var(--hdr-offset, 72px);
  display: flex;
  flex-direction: column;
  gap: 0;
  height: calc(100dvh - var(--hdr-offset, 72px) - var(--main-pad-b, 16px) - var(--rail-gap, 32px))
}

.tabs,
.subtabs {
  display: flex;
  border-radius: 12px;
  overflow: hidden;
  font-weight: 600
}

.tabs {
  border: 2px solid var(--accent);
  background: var(--panel);
  margin-bottom: 10px
}

.subtabs {
  margin: 0 0 10px 0;
  border: 2px solid var(--accent);
  background: var(--panel);
  --subtab-h: 44px;
  min-height: var(--subtab-h);
  max-width: 100%
}

.subtabs[hidden] {
  display: none;
  height: 0;
  margin: 0;
  padding: 0;
  border: 0
}

.tabs button,
.subtabs button {
  background: var(--panel);
  color: var(--text);
  border: 0;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  position: relative;
  transition: background .18s ease, color .18s ease, box-shadow .22s ease, transform .18s ease;
  font-weight: 600
}

.tabs button {
  flex: 1;
  padding: 10px 12px
}

.subtabs button {
  flex: 1;
  padding: 8px 10px
}

.tabs button:first-child,
.subtabs button:first-child {
  border-top-left-radius: 10px;
  border-bottom-left-radius: 10px
}

.tabs button:last-child,
.subtabs button:last-child {
  border-top-right-radius: 10px;
  border-bottom-right-radius: 10px
}

.tabs button:hover,
.subtabs button:hover {
  background: #1b2742;
  transform: translateY(-1px)
}

.tabs button:active,
.subtabs button:active {
  transform: translateY(0) scale(.995)
}

.tabs button:focus,
.subtabs button:focus {
  outline: 2px solid var(--accent);
  outline-offset: 2px
}

.tabs button::after,
.subtabs button::after {
  content: "";
  position: absolute;
  left: 8px;
  right: 8px;
  bottom: 6px;
  height: 2px;
  border-radius: 2px;
  background: linear-gradient(90deg, var(--accent) 0%, var(--subaccent) 100%);
  transform: scaleX(0);
  transform-origin: center;
  opacity: 0;
  transition: transform .24s ease, opacity .24s ease
}

.tabs button[aria-selected="true"],
.subtabs button[aria-selected="true"] {
  background: linear-gradient(90deg, rgba(0, 116, 255, .18) 0%, rgba(175, 113, 255, .18) 100%);
  font-weight: 600;
  box-shadow: 0 0 18px rgba(10, 162, 255, .25), inset 0 0 10px rgba(0, 116, 255, .35);
  z-index: 2;
  border-left: 0
}

.tabs button[aria-selected="true"]::before,
.subtabs button[aria-selected="true"]::before {
  content: "";
  position: absolute;
  inset: -2px;
  border-radius: inherit;
  padding: 2px;
  background: linear-gradient(90deg, var(--accent) 0%, var(--subaccent) 100%);
  mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  pointer-events: none;
  filter: blur(.5px)
}

.tabs button[aria-selected="true"]::after,
.subtabs button[aria-selected="true"]::after {
  transform: scaleX(1);
  opacity: 1;
  left: 0;
  right: 0;
  bottom: 0
}

.tabs button+button,
.subtabs button+button {
  border-left: 1px solid rgba(255, 255, 255, .12)
}

@media (prefers-reduced-motion: reduce) {

  .tabs button,
  .subtabs button {
    transition: none
  }

  .tabs button::after,
  .subtabs button::after {
    transition: none
  }

  .result-panel--show {
    animation: none
  }

  .chip,
  .dice-opt {
    transition: none
  }
}

.panel {
  margin-top: 0;
  background: var(--panel);
  border: 1px solid var(--accent);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 0 0 1px rgba(36, 170, 255, .45) inset, inset 0 8px 12px -10px rgba(0, 0, 0, .6), inset 0 -8px 12px -10px rgba(0, 0, 0, .6), inset 0 0 8px rgba(0, 92, 164, 1);
  flex: 1;
  min-height: 0;
  will-change: transform;
  scrollbar-gutter: stable both-edges;
  display: flex;
  flex-direction: column
}

/* Make subpanel a flex container and list the scrollable child */
.panel>#subpanel {
  display: flex;
  flex-direction: column;
  min-height: 0
}

.panel .list {
  flex: 1;
  overflow: auto
}

/* Custom thin blue scrollbar (apply to inner scrolling list) */
.panel,
.panel .list {
  scrollbar-width: thin;
  scrollbar-color: #2a78ff #1a2340
}

.panel::-webkit-scrollbar,
.panel .list::-webkit-scrollbar {
  width: 6px
}

.panel::-webkit-scrollbar-track,
.panel .list::-webkit-scrollbar-track {
  background: #10182c
}

.panel::-webkit-scrollbar-thumb,
.panel .list::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, #2a78ff, #9a66ff);
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, .12)
}

.panel::-webkit-scrollbar-thumb:hover,
.panel .list::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(180deg, #4990ff, #b480ff)
}

.list {
  display: grid;
  gap: 8px;
  padding: 10px
}

.card {
  padding: 10px;
  border: 1px solid rgba(255, 255, 255, .06);
  border-radius: 10px;
  display: grid;
  gap: 6px;
  background: linear-gradient(180deg, rgba(255, 255, 255, .02), rgba(255, 255, 255, .01));
  transition: transform .12s ease, border-color .2s ease, background .2s ease;
  font-weight: 400
}

.card:hover {
  transform: translateY(-1px);
  border-color: rgba(255, 255, 255, .12);
  background: linear-gradient(180deg, rgba(255, 255, 255, .03), rgba(255, 255, 255, .015))
}

.row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px
}

.mono {
  font-family: "Roboto Mono", ui-monospace, monospace;
  font-variant-numeric: tabular-nums
}

.pill {
  padding: 3px 8px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, .12);
  font-size: 12px
}

.pill.win {
  color: var(--positive);
  border-color: var(--positive)
}

.pill.lose {
  color: var(--negative);
  border-color: var(--negative)
}

.pill.open {
  color: #a6d4ff;
  border-color: var(--accent-soft)
}

.pill.void {
  color: #aab3c2;
  border-color: rgba(255, 255, 255, .18)
}

.pill.heads {
  color: #9ed5ff;
  border-color: var(--accent-soft)
}

.pill.tails {
  color: #e3d0ff;
  border-color: rgba(175, 113, 255, .6)
}

.row .rgt {
  display: flex;
  align-items: center;
  gap: 8px
}

.mono.payout {
  color: var(--positive)
}

/* Tab and subtab count badges */
.count {
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: 999px;
  background: #0d2a57;
  border: 1px solid rgba(255, 255, 255, .12);
  font-size: 12px;
  line-height: 18px;
  display: inline-grid;
  place-items: center;
  color: var(--muted);
  font-weight: 500
}

.count[data-empty="true"] {
  opacity: .55
}

/* Empty state inside lists */
.empty {
  padding: 18px 14px;
  text-align: center;
  color: var(--muted);
  border: 1px dashed rgba(255, 255, 255, .12);
  border-radius: 10px
}

/* Loading overlay */
.loading {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  background: #0b0f14;
  z-index: 100
}

.loading .box {
  display: grid;
  place-items: center;
  gap: 10px;
  text-align: center
}

.loading .logo {
  width: 96px;
  height: 96px;
  background: radial-gradient(circle at 30% 30%, #1bb0ff, #0877c8);
  border-radius: 50%;
  filter: drop-shadow(0 0 24px rgba(10, 162, 255, .6))
}

.loading .pct {
  font-variant-numeric: tabular-nums;
  font-family: "Roboto Mono", ui-monospace, monospace;
  color: #d7e8ff
}

/* Responsive stacking */
@media (max-width:1199px) {
  .rail-sticky {
    position: static;
    height: auto
  }

  /* Fixed mobile panel height with contained scroll */
  .panel {
    min-height: min(55vh, 520px);
    height: min(55vh, 520px);
    max-height: min(55vh, 520px)
  }

  /* Keep subtab bar space but pull panel up to fill it when aria-hidden=true */
  .subtabs[aria-hidden="true"] {
    visibility: hidden;
    display: flex;
    height: var(--subtab-h);
    margin: 0 0 10px 0;
    border: 0
  }

  .subtabs[aria-hidden="true"]+.panel {
    margin-top: calc(-1 * (var(--subtab-h) + 10px));
    /* Expand panel height only for Last Game Results (when subtabs are aria-hidden) */
    min-height: calc(min(55vh, 520px) + var(--subtab-h) + 10px);
    height: calc(min(55vh, 520px) + var(--subtab-h) + 10px);
    max-height: calc(min(55vh, 520px) + var(--subtab-h) + 10px);
  }

  .current-bet-panel {
    /* display: none !important; */
  }
}

@media (max-width:749px) {
  .hdr-inner {
    padding: 10px 12px
  }

  .main {
    padding: 0 16px;
  }

  .game-frame {
    margin-top: 15px;
  }

  .bet-row {
    flex-direction: column;
  }

  /* Keep circle vertically centered on mobile */
  .canvas-circle {
    /* transform: none; */
    transform: translate(0%, -63%);
    --circle-size: min(35vmin, 250px);
  }

  /* Keep three-column layout and show side rails on mobile */
  .circle-row {
    grid-template-columns: var(--railW) 1fr var(--railW);
    --col-gap: clamp(8px, 2.2vw, 12px);
    gap: var(--col-gap)
  }

  .game-frame {
    --railW: 110px;
  }

  .dice-rail {
    display: grid
  }

  /* Ensure 6 centered per row on small screens too, with flex centering */
  .opts {
    --dice-opt-w: clamp(44px, 14vw, 60px);
    --dice-gap: 6px;
    display: flex;
    flex-wrap: wrap;
    gap: var(--dice-gap);
    justify-content: center;
    width: calc(6 * var(--dice-opt-w) + 5 * var(--dice-gap));
    max-width: 100%
  }

  /* Keep genie more to the right on mobile and fully inside the circle */
  .genie {
    right: -4px;
    bottom: -31px;
    transform: translate(-36%, -6%)
  }

  /* Center preset bet chips on mobile */
  .chips {
    justify-content: center
  }

  /* Place bet input and total bet side-by-side on mobile */
  .bet-row {
    grid-template-columns: 1fr 1fr;
    justify-content: center;
    align-items: center;
    gap: 12px;
    grid-template-areas: "chips betcontrols";
    margin-top: 5px;
    display: grid !important;
  }

  .chip {
    width: 46px !important;
    height: 39px !important;
  }

  .btn-label {
    font-size: 13px !important;
  }

  .btn-val {
    font-size: 17px !important;
  }

  /* Prevent chip row from pushing layout wider than viewport */
  .chips {
    max-width: 100%;
    /* overflow: hidden; */
  }

  .chips-host {
    display: contents
  }

  .chips {
    grid-area: chips;
    width: 100%;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
    justify-items: center;
  }

  .chips .chip {
    width: 100%;
    min-width: 0;
    height: 38px;
    margin: 0;
    flex: none;
    font-size: 11px;
  }

  .bet-controls {
    grid-area: betcontrols;
    display: flex !important;
    flex-direction: column !important;
    gap: 8px;
    width: 100% !important;
    min-width: 0 !important;
  }

  .bet-input-row,
  .bet-btn-main {
    width: 100%;
    height: 40px;
    /* Consistent height */
  }

  .bet-btn-main {
    height: 48px;
    /* Button slightly taller */
  }

  /* Reset sizing */
  .bet-row>* {
    width: 100%;
    max-width: none;
    justify-self: stretch;
  }

  /* Tighten rails/circle sizing on mobile to avoid vertical scrolling */
  .canvas-center {
    --railW: clamp(86px, 24vw, 112px)
  }

  .dice-rail {
    padding: 0;
    padding-bottom: clamp(6px, 2.4vw, 10px);
    gap: clamp(6px, 1.8vw, 8px)
  }

  .dice-rail .rail-hdr {
    font-size: clamp(11px, 2.9vw, 13px);
    margin: -1px -1px 2px -1px;
    width: calc(100% + 2px);
    border-radius: 5px 5px 0 0;
  }

  .dice-rail .cells {
    padding: 0 clamp(4px, 1.5vw, 6px);
  }

  .mini-cell {
    padding: clamp(5px, 1.8vw, 8px);
    border-radius: clamp(8px, 2.4vw, 10px)
  }

  .mini-cell .lbl {
    font-size: clamp(9px, 2.7vw, 12px)
  }

  .mini-cell .mv {
    font-size: clamp(11px, 3vw, 13px)
  }

  /* Fit circle between rails based on viewport width */
  .canvas-circle {
    --circle-size: min(35vmin, calc(100vw - (2 * var(--railW)) - (2 * var(--col-gap, 12px)) - 24px))
  }

  .bet-actions button {
    height: 42px;
    min-width: 84px
  }
}

@media (max-width: 350px) {
  .genie {
    transform: translate(-70%, -6%);
  }
}



/* Mobile devices around 475px: narrower rails with smaller text */
@media (max-width:475px) {
  .game-frame {
    --railW: 95px;
  }

  .canvas-circle {
    --circle-size: min(33vmin, 320px);
  }

  .dice-rail {
    padding: 0;
    padding-bottom: 4px;
    border-radius: 8px;
  }

  .dice-rail .rail-hdr {
    font-size: 11px;
    margin: -1px -1px 2px -1px;
    width: calc(100% + 2px);
    border-radius: 7px 7px 0 0;
    text-align: center;
  }

  .dice-rail .cells {
    padding: 0 4px;
  }

  .mini-cell .lbl {
    font-size: 9px;
  }

  .mini-cell .mv {
    font-size: 10px;
  }

  .cell-badge {
    width: 16px;
    height: 16px;
    font-size: 8px;
  }

  .arrow {
    font-size: 8px;
  }

  .opts {
    --dice-opt-w: clamp(44px, 13vw, 60px);
  }

  .genie {
    right: -4px;
    bottom: -31px;
    transform: translate(-58%, -6%);
  }

  .genie-img {
    width: clamp(210px, 45vmin, 350px);
  }
}

@media (max-width:420px) {
  .canvas-center {
    --railW: 86px
  }

  .canvas-circle {
    --circle-size: min(32vmin, 320px)
  }

  .canvas-center {
    overflow: hidden
  }

  .opts {
    width: 100%
  }
}

@media (max-width: 375px) {
  .genie {
    transform: translate(-58%, -6%);
  }

  .canvas-circle {
    --circle-size: min(26vmin, 250px) !important;
    transform: translate(-20%, -50%);
  }

  .genie-img {
    width: clamp(200px, 45vmin, 350px) !important;
  }

  .opts {
    --dice-opt-w: clamp(44px, 13vw, 60px);
  }
}

/* Tight mobile range: 360–429px, ensure no clipping and centered rail content */
@media (min-width:360px) and (max-width:429px) {
  .canvas-center {
    --railW: 88px
  }

  .circle-row {
    gap: 8px;
    grid-template-columns: minmax(0, var(--railW)) minmax(0, 1fr) minmax(0, var(--railW))
  }

  .dice-rail {
    padding: 2px;
    gap: 3px
  }

  .dice-rail .rail-hdr {
    font-size: 11px
  }

  .mini-cell {
    padding: 5px;
    border-radius: 8px
  }

  .mini-cell .lbl {
    font-size: 8px
  }

  .mini-cell .mv {
    font-size: 9px
  }

  /* Compute circle from viewport minus rails + gaps to avoid overflow */
  /* .canvas-circle {
    --circle-size: calc(min(54vmin,
          100vw - (2 * var(--railW)) - 2 * 8px - 2 * 12px))
  } */
}

/* Mobile portrait: keep header fixed, full-width, and account for safe areas */
@media (max-width:749px) and (orientation: portrait) {
  .hdr-inner {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    padding-top: calc(10px + env(safe-area-inset-top, 0px))
  }

  /* Prevent content from sliding under the fixed header */
  .main {
    /* padding-top: calc(var(--hdr-offset, 72px) + 12px) */
  }
}

/* Fix mobile viewport height jitter (address browser UI show/hide) */
@supports (height: 100svh) {
  .app {
    min-height: 100svh
  }

  .main {
    min-height: calc(100svh - var(--hdr-offset, 72px))
  }

  .canvas-board {
    min-height: 0;
    height: auto
  }
}

/* Ensure bet controls wrapper doesn't add extra layout; it just groups controls */
.bet-controls {
  display: contents
}

/* Small desktop widths: keep everything fitting without zoom */
@media (min-width:750px) and (max-width:1199px) {
  .opts {
    --dice-opt-w: clamp(52px, 9vw, 68px)
  }

  .canvas-center {
    --railW: 120px
  }

  .canvas-circle {
    --circle-size: min(25vmin, 400px)
  }
}

/* Ultra-narrow phones */
@media (max-width:360px) {
  .canvas-center {
    --railW: 96px
  }

  .opts {
    --dice-opt-w: clamp(40px, 15vw, 56px)
  }

  .bet-input button {
    height: 40px;
    width: 40px
  }

  .bet-amt {
    min-width: 80px
  }

  .total-bet {
    padding: 8px 12px
  }
}

/* Short viewports: reduce sizes to prevent bottom cut-off */
@media (max-height:800px) {
  /* .canvas-circle {
    --circle-size: min(56vmin, 380px)
  } */

  .status-badge {
    padding: 8px 10px
  }
}

@media (min-width:1200px) {
  .canvas-circle {
    --circle-size: min(30vmin, 380px)
  }
}

@media (max-height:700px) {
  :root {
    --rail-gap: 16px
  }

  /* 
  .canvas-circle {
    --circle-size: min(27vmin, 340px)
  } */

  .bet-actions button {
    height: 40px
  }

  /* Short screens: shrink right panel height a bit more */
  .panel {
    min-height: min(48vh, 480px);
    height: min(48vh, 480px);
    max-height: min(48vh, 480px)
  }
}

@media (max-height:600px) {
  .canvas-circle {
    --circle-size: min(46vmin, 300px)
  }

  .genie-img {
    width: clamp(80px, 16vmin, 120px)
  }

  .opts {
    --dice-opt-w: clamp(40px, 9vw, 60px)
  }

  .panel {
    min-height: min(44vh, 440px);
    height: min(44vh, 440px);
    max-height: min(44vh, 440px)
  }
}

/* ========== LEFT SIDEBAR STYLES ========== */
.left-sidebar {
  display: flex;
  flex-direction: column;
  gap: 16px;
  overflow: visible
}

.left-sidebar-sticky {
  position: sticky;
  top: 0;
  display: flex;
  flex-direction: column;
  gap: 16px;
  height: calc(100dvh - 60px);
  max-height: calc(100dvh - 60px)
}

.leaderboard-panel,
.last-round-panel {
  background: linear-gradient(91deg, #0a0259 1.49%, #000E38 100%);
  border: 1px solid #6DC1EE;
  border-radius: 12px;
  padding: 12px 5px;
  box-shadow: 0 0 8px rgba(0, 92, 164, .6);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  flex: 1
}

.panel-header {
  font-weight: 700;
  font-size: 16px;
  text-align: center;
  padding: 10px 12px;
  background: rgba(12, 48, 158, 1);
  border-radius: 12px;
  box-shadow: 6px 5px 4.8px 0px rgba(0, 0, 0, 0.25) inset;
  margin: 0;
  color: #fff;
  letter-spacing: .5px;
}

.leaderboard-table {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  flex: 1
}

.table-body {
  display: flex;
  flex-direction: column;
  gap: 6px;
  overflow-y: auto;
  max-height: 280px;
  padding-right: 4px;
  scrollbar-width: thin;
  scrollbar-color: #2a78ff #0a1a3a
}

.last-round-panel .table-body {
  max-height: none;
  flex: 1;
}

.table-body::-webkit-scrollbar {
  width: 6px
}

.table-body::-webkit-scrollbar-track {
  background: #0a1a3a;
  border-radius: 10px
}

.table-body::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, #2a78ff, #6a96ff);
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, .1)
}

.table-body::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(180deg, #4990ff, #8aadff)
}

.table-header {
  display: grid;
  grid-template-columns: 40px 1fr 60px 80px;
  gap: 6px;
  padding: 6px 8px;
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
  text-align: center;
  border-bottom: 1px solid rgba(255, 255, 255, .1)
}

.last-round-panel .table-header,
.last-round-panel .table-row {
  grid-template-columns: 80px 1fr 80px;
}

.table-row {
  display: grid;
  grid-template-columns: 40px 1fr 60px 80px;
  gap: 6px;
  padding: 8px;
  background: rgba(0, 0, 0, .14);
  border: 1px solid rgba(255, 255, 255, .08);
  border-radius: 8px;
  align-items: center;
  transition: background .2s ease, border-color .2s ease
}

.table-row:hover {
  background: rgba(0, 0, 0, .22);
  border-color: rgba(255, 255, 255, .15)
}

.rank-col,
.name-col,
.price-col,
.change-col {
  font-size: 11px;
  text-align: center;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap
}

.rank-col {
  display: flex;
  justify-content: center
}

.rank-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  /* border-radius: 50%; */
  /* background: linear-gradient(135deg, #2a78ff, #9a66ff); */
  font-weight: 800;
  font-size: 11px;
  /* box-shadow: 0 2px 6px rgba(36, 170, 255, .3) */
}

.name-col {
  text-align: left;
  font-weight: 600
}

.price-col {
  font-family: "Roboto Mono", ui-monospace, monospace;
  font-variant-numeric: tabular-nums
}

.change-col {
  font-family: "Roboto Mono", ui-monospace, monospace;
  font-variant-numeric: tabular-nums;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 3px
}

.change-col.positive {
  color: var(--positive)
}

.change-col.negative {
  color: var(--negative)
}

.change-icon {
  font-size: 10px
}

/* ========== RIGHT SIDEBAR STYLES ========== */
.right-sidebar {
  display: flex;
  flex-direction: column;
  gap: 16px;
  overflow-y: auto
}

.right-sidebar-sticky {
  position: sticky;
  top: 0;
  display: flex;
  flex-direction: column;
  gap: 16px;
  max-height: calc(100dvh - var(--hdr-offset, 72px) - var(--main-pad-b, 16px) - var(--rail-gap, 32px))
}

.current-bet-panel {
  background: rgba(12, 48, 158, 0.26) !important;
  border: none;
  border-radius: 12px;
  padding: 0;
  min-height: 400px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  gap: 8px;
}

.current-bet-content {
  flex: 1;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 4px;
  max-height: 300px;
  overflow-y: auto;
  overflow-x: hidden
}

.no-bets-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px
}

.treasure-chest {
  width: 120px;
  height: 120px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.treasure-box-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  filter: drop-shadow(0 4px 12px rgba(0, 0, 0, .3));
  animation: none !important;
  opacity: 1 !important
}

.no-bets-text {
  text-align: center;
  font-weight: 600;
  font-size: 12px;
  color: var(--muted);
  line-height: 1.5
}

.bets-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 100%
}

.bet-card {
  background: rgba(0, 0, 0, .2);
  border: 1px solid rgba(255, 255, 255, .1);
  border-radius: 8px;
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 6px
}

.bet-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px
}

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

.bet-value {
  font-size: 13px;
  font-weight: 700
}

.bet-type {
  font-size: 11px
}

/* Current Bets Table */
.current-bets-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0 4px;
  font-size: 12px;
  display: table;
  max-height: 280px;
}

.current-bets-table thead {
  display: table-header-group;
  width: 100%;
  position: sticky;
  top: 0;
  z-index: 10;
}

.current-bets-table th {
  padding: 8px 4px 12px 4px !important;
  text-align: center !important;
  font-weight: 500 !important;
  color: #ffffff !important;
  font-size: 11px !important;
  background: #0b1544 !important;
  /* Opaque dark blue resembling the transparent blend */
  border: none !important;
  vertical-align: top !important;
  position: sticky !important;
  top: 0 !important;
  z-index: 10 !important;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.current-bets-table th:first-child {
  border-radius: 0;
}

.current-bets-table th:last-child {
  border-radius: 0;
}

.current-bets-table tbody {
  display: table-row-group;
  width: 100%;
}

.current-bets-table tbody tr:nth-child(odd) {
  background: rgba(12, 48, 158, 1) !important;
}

.current-bets-table tbody tr:nth-child(even) {
  background: rgba(12, 48, 158, 0.26) !important;
}

.current-bets-table tbody tr {
  transition: background 0.2s ease;
}

.current-bets-table tbody tr:hover {
  background: rgba(12, 48, 158, 0.6);
}

.current-bets-table td:first-child {
  border-radius: 6px 0 0 6px;
}

.current-bets-table td:last-child {
  border-radius: 0 6px 6px 0;
}

.current-bets-table tbody tr:last-child td:first-child {
  border-radius: 0 0 0 8px;
}

.current-bets-table tbody tr:last-child td:last-child {
  border-radius: 0 0 8px 0;
}

.current-bets-table td {
  padding: 8px 4px;
  color: #fff;
  text-align: center;
}

.current-bets-table .bet-amount {
  font-weight: 700;
  font-family: "Roboto Mono", ui-monospace, monospace;
  color: #fff;
}

.current-bets-table .bet-side {
  font-weight: 600;
  color: var(--accent-soft);
}

.current-bets-table .bet-status {
  text-align: left;
}

.status-badge {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 12px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.status-badge.status-open {
  background: rgba(25, 195, 125, 0.15);
  color: var(--positive);
  border: 1px solid var(--positive);
}

.status-badge.status-won {
  background: rgba(25, 195, 125, 0.25);
  color: #4fffb3;
  border: 1px solid #4fffb3;
}

.status-badge.status-lost {
  background: rgba(255, 93, 93, 0.15);
  color: var(--negative);
  border: 1px solid var(--negative);
}

.status-badge.status-cancelled {
  background: rgba(163, 209, 255, 0.1);
  color: var(--muted);
  border: 1px solid rgba(163, 209, 255, 0.3);
}

/* Custom scrollbar for current bet content */
.current-bet-content::-webkit-scrollbar {
  width: 6px;
}

.current-bet-content::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.2);
  border-radius: 10px;
}

.current-bet-content::-webkit-scrollbar-thumb {
  background: rgba(109, 193, 238, 0.4);
  border-radius: 10px;
}

.current-bet-content::-webkit-scrollbar-thumb:hover {
  background: rgba(109, 193, 238, 0.6);
}

/* Custom scrollbar for table */
.current-bets-table::-webkit-scrollbar {
  width: 6px;
}

.current-bets-table::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.2);
  border-radius: 10px;
}

.current-bets-table::-webkit-scrollbar-thumb {
  background: rgba(109, 193, 238, 0.4);
  border-radius: 10px;
}

.current-bets-table::-webkit-scrollbar-thumb:hover {
  background: rgba(109, 193, 238, 0.6);
}

.action-buttons-panel {
  display: flex;
  flex-direction: column;
  gap: 10px
}

.action-btn {
  height: 44px;
  width: 80%;
  margin: 0 auto;
  padding: 0 16px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, .22);
  box-shadow: 6px 6px 4px 0px #00000040 inset;
  color: #fff;
  background: rgba(12, 48, 158, 1);
  cursor: pointer;
  font-weight: 700;
  font-family: 'Inter', sans-serif;
  letter-spacing: .3px;
  /* box-shadow: 0 2px 8px rgba(36, 170, 255, .28), inset 0 0 0 1px rgba(255, 255, 255, .08); */
  transition: transform .18s ease, background .22s ease, box-shadow .22s ease;
  display: flex;
  align-items: center;
  justify-content: center
}

.action-btn:hover {
  background: linear-gradient(180deg, #3559a8, #294788);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(36, 170, 255, .38), inset 0 0 0 1px rgba(255, 255, 255, .12)
}

.action-btn:active {
  background: rgba(12, 48, 158, 1) !important;
  transform: scale(.98)
}

.action-btn:focus {
  outline: 2px solid var(--accent);
  outline-offset: 2px
}

.btn-text {
  font-size: 15px
}

/* ========== RESPONSIVE STYLES FOR SIDEBARS ========== */
@media (max-width:1199px) {
  .main {
    grid-template-columns: 1fr !important;
  }

  .action-buttons-panel {
    display: none !important;
  }

  .left-rail {
    order: 10;
  }

  .left-sidebar,
  .right-sidebar {
    max-height: none
  }

  .left-sidebar-sticky,
  .right-sidebar-sticky {
    position: static;
    max-height: none
  }

  .current-bet-panel {
    min-height: 180px
  }
}

@media (max-width:749px) {

  .left-sidebar,
  .right-sidebar {
    gap: 12px
  }

  .leaderboard-panel,
  .last-round-panel,
  .current-bet-panel {
    padding: 10px
  }

  /* Hide center status badge on mobile - REVERTED per user request */
  /* .canvas-center .status-container {
    display: none;
  } */

  /* Hide right sidebar status badge on mobile */
  .right-sidebar .status-container-right {
    display: none;
  }

  .table-body {
    max-height: 200px
  }

  .table-header,
  .table-row {
    grid-template-columns: 32px 1fr 55px 70px;
    padding: 6px;
    font-size: 10px
  }

  .last-round-panel .table-header,
  .last-round-panel .table-row {
    grid-template-columns: 80px 1fr 80px;
  }

  .rank-badge {
    width: 20px;
    height: 20px;
    font-size: 10px
  }

  .panel-header {
    font-size: 12px;
    padding: 6px 10px
  }

  .treasure-chest {
    width: 100px;
    height: 100px
  }


  .no-bets-text {
    font-size: 11px
  }

  .action-btn {
    height: 40px
  }

  .btn-text {
    font-size: 12px
  }
}

/* --- New Bet UI --- */
.bet-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 24px;
  width: 100%;
  margin-top: 4px;
  padding: 10px;
  overflow-x: auto;
}

/* Chips Grid */
.chips-host {
  display: flex !important;
  justify-content: center;
  align-items: center;
}

.chips {
  display: grid !important;
  grid-template-columns: repeat(3, 1fr) !important;
  grid-template-rows: auto auto !important;
  gap: 12px 16px !important;
  margin-right: 0;
}

.chip-item {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.chip {
  width: 58px;
  height: 50px;
  border-radius: 50% !important;
  position: relative;
  background-size: cover !important;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.5);
  transition: transform 0.1s, filter 0.2s;
  cursor: pointer;
  padding: 0 0 5px 0;
  /* border: 4px solid rgba(255, 255, 255, 0.1) !important; */
}

.chip:active {
  transform: scale(0.95);
}

.chip.active {
  transform: scale(1.1);
  /* box-shadow: 0 0 15px currentColor;
  border-color: currentColor !important; */
  z-index: 10;
}

/* Chip Colors */
.chip[data-amt="100"] {
  color: #ff3b3b;
}

.chip[data-amt="200"] {
  color: #ff9d00;
}

.chip[data-amt="500"] {
  color: #26c926;
}

.chip[data-amt="1000"] {
  color: #d12bff;
}

.chip[data-amt="5000"] {
  color: #ffd700;
}

.chip[data-amt="10000"] {
  color: #008cff;
}

/* Bet Controls Area */
.bet-controls {
  display: flex !important;
  flex-direction: column !important;
  gap: 12px !important;
  width: 300px;
  min-width: 280px;
}

/* Blue Input Bar */
.bet-input-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(68, 103, 204, 1);
  border-radius: 8px;
  padding: 0 0 0 16px;
  height: 45px;
  box-shadow: 0px 4px 4px 0px rgba(0, 0, 0, 0.25) inset;
  border: 1px solid rgba(75, 108, 183, 0.5);
  position: relative;
}

.bet-amt-display {
  display: flex;
  align-items: center;
  flex: 1;
}

.currency-symbol {
  font-family: 'Poppins', sans-serif;
  font-weight: 700;
  font-size: 17px;
  color: #fff;
  margin-right: 4px;
}

.bet-amt-input {
  font-family: 'Poppins', sans-serif;
  font-weight: 700;
  font-size: 17px;
  color: #fff;
  background: transparent;
  border: none;
  outline: none;
  width: 100%;
  padding: 0;
  margin: 0;
}

.bet-amt-input::-webkit-outer-spin-button,
.bet-amt-input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
.bet-amt-input {
  appearance: textfield;
  -moz-appearance: textfield;
}

.input-actions {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding-right: 12px;
}

.spin-btn {
  background: transparent;
  border: none;
  color: #88d0ff;
  width: 28px;
  height: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
  transition: opacity 0.2s;
}

.spin-btn:hover {
  opacity: 0.8;
}

.spin-btn svg {
  width: 24px;
  height: 24px;
  fill: currentColor;
  display: block;
}


/* Green Bet Button */
.bet-btn-main {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(0, 124, 62, 1);
  border: none;
  border-radius: 8px;
  padding: 0 20px;
  height: 45px;
  cursor: pointer;
  box-shadow: 0px 4px 4px 0px rgba(0, 0, 0, 0.25) inset;

  transition: filter 0.2s, transform 0.1s;
  width: 100%;
}

.bet-btn-main:hover {
  filter: brightness(1.1);
}

.bet-btn-main:active {
  transform: translateY(2px);
}

.btn-label {
  font-family: 'Poppins', sans-serif;
  font-weight: 800;
  font-size: 17px;
  color: #fff;
  text-transform: uppercase;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

.btn-val {
  font-family: 'Roboto Mono', monospace;
  font-weight: 700;
  font-size: 20px;
  color: #fff;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

/* --- Status Pill Design --- */
.status-pill {
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  border-radius: 8px;
  padding: 12px 24px;
  color: #fff;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
  width: 100%;
  max-width: 100%;
  flex-direction: column;
}



.status-headline {
  font-family: 'Poppins', sans-serif;
  font-weight: 700;
  text-transform: capitalize;
  opacity: 1;
  white-space: nowrap;
}

.status-timer {
  font-family: 'Poppins', sans-serif;
  font-weight: 700;
  text-align: center;
  width: 50px;
}

/* Top Status Container - positioned above game frame */
.top-status-container {
  display: flex;
  justify-content: center;
  align-items: center;
  width: 100%;
  margin-bottom: 6px;
  z-index: 20;
}

/* Top variant (green timer pill above canvas) */
.status-pill-top {
  background: linear-gradient(135deg, #0D9B45 0%, #0A7B38 50%, #086B30 100%);
  border: 1px solid rgba(255, 255, 255, 0.7);
  border-radius: 50px;
  padding: 4px 22px;
  gap: 12px;
  flex-direction: row;
  align-items: center;
  box-shadow:
    0 4px 20px rgba(46, 204, 113, 0.4),
    0 2px 8px rgba(0, 0, 0, 0.3),
    inset 0 1px 0 rgba(255, 255, 255, 0.15);
  width: auto;
  transition: background 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease;
}

/* Red styling for LOCKED phase (Betting Closed) */
.status-pill-top.phase-locked {
  background: linear-gradient(135deg, #C0392B 0%, #A93226 50%, #922B21 100%);
  box-shadow:
    0 4px 20px rgba(231, 76, 60, 0.4),
    0 2px 8px rgba(0, 0, 0, 0.3),
    inset 0 1px 0 rgba(255, 255, 255, 0.15);
}

/* Yellow styling for REVEAL phase */
.status-pill-top.phase-reveal {
  background: linear-gradient(135deg, #D4AC0D 0%, #B7950B 50%, #9A7D0A 100%);
  box-shadow:
    0 4px 20px rgba(241, 196, 15, 0.4),
    0 2px 8px rgba(0, 0, 0, 0.3),
    inset 0 1px 0 rgba(255, 255, 255, 0.15);
}

/* Gray styling for PAYOUT phase */
.status-pill-top.phase-payout {
  background: linear-gradient(135deg, #5D6D7E 0%, #4D5D6E 50%, #3D4D5E 100%);
  box-shadow:
    0 4px 20px rgba(93, 109, 126, 0.4),
    0 2px 8px rgba(0, 0, 0, 0.3),
    inset 0 1px 0 rgba(255, 255, 255, 0.15);
}

.status-pill-top .status-headline {
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.3px;
}

.status-pill-top .status-timer {
  font-size: 14px;
  font-weight: 500;
  width: auto;
  display: flex;
  align-items: baseline;
  gap: 1px;
}

.status-pill-top .status-timer-suffix {
  font-size: 14px;
  font-weight: 500;
}

.status-clock-icon {
  width: 28px;
  height: 28px;
  flex-shrink: 0;
  object-fit: contain;
}

/* Content wrapper for vertical stacking in top variant */
.status-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0;
}




/* Result Modal Styles */
.result-modal-overlay {
  position: fixed;
  inset: 0;
  background: #040029BF;
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  opacity: 0;
  transition: opacity 0.3s ease;
  padding: 20px;
}

.result-modal-overlay.show {
  opacity: 1;
}

.result-modal-overlay.fade-out {
  opacity: 0;
}

.result-modal {
  position: relative;
  background: linear-gradient(171.89deg, #8EB0FF 5.45%, #9895FF 16.91%, #0A3EB6 88.24%);
  border-radius: 20px;
  border: 1px solid #003ECE;
  box-shadow: 0 20px 60px rgba(0, 116, 255, 0.6);
  max-width: 700px;
  width: 100%;
  max-height: 90vh;
  /* min-height: 65vh; */
  overflow: visible;
  animation: slideIn 0.4s cubic-bezier(0.2, 1, 0.2, 1);
  /* margin-left: 150px; */
  /* Make space for character on the left */
}

@keyframes slideIn {
  from {
    transform: translateY(-50px) scale(0.9);
    opacity: 0;
  }

  to {
    transform: translateY(0) scale(1);
    opacity: 1;
  }
}

.result-modal-close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.25);
  border: 2px solid rgba(255, 255, 255, 0.4);
  color: white;
  font-size: 20px;
  font-weight: bold;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
  z-index: 10;
}

.result-modal-close:hover {
  background: rgba(255, 255, 255, 0.35);
  transform: scale(1.1);
}

.result-modal-content {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  padding: 15px 30px 10px 30px;
  min-height: 400px;
  position: relative;
}

.result-modal-character {
  position: absolute;
  left: -100px;
  top: 50%;
  transform: translateY(-55%);
  width: 300px;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 5;
}

.result-character-img {
  /* width: 100%; */
  height: auto;
  max-width: 350px;
  object-fit: contain;
  filter: drop-shadow(0 10px 30px rgba(0, 0, 0, 0.3));
  animation: characterPop 0.6s cubic-bezier(0.2, 1.4, 0.34, 1);
  z-index: 10;
}

@keyframes characterPop {
  0% {
    transform: scale(0.7) translateY(30px);
    opacity: 0;
  }

  60% {
    transform: scale(1.05) translateY(-5px);
  }

  100% {
    transform: scale(1) translateY(0);
    opacity: 1;
  }
}

.result-modal-info {
  display: flex;
  flex-direction: column;
  gap: 5px;
  padding: 0;
  min-width: 470px;
  margin-left: auto;
}

.result-modal-title {
  font-family: 'Poppins', sans-serif;
  font-size: 25px;
  font-weight: 600;
  color: white;
  text-align: center;
  margin: 0 0 12px 0;
  text-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  letter-spacing: 1px;
}

.result-table-wrapper {
  max-height: 300px;
  min-height: 265px;
  overflow-y: auto;
  border-radius: 0px;
  margin-bottom: 8px;
  /* Custom Scrollbar */
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.3) rgba(0, 0, 0, 0.1);
  border: 1px solid #A3B1FF;
  background: rgba(255, 255, 255, 0.1);
  z-index: 11;
}

.result-table-wrapper::-webkit-scrollbar {
  width: 6px;
}

.result-table-wrapper::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.1);
}

.result-table-wrapper::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.3);
  border-radius: 4px;
}

.result-table {
  width: 100%;
  /* border-collapse: separate; */
  border-spacing: 0;
  /* border-radius: 12px; */
  overflow: hidden;
  /* border: 1px solid #A3B1FF; */
  /* background: rgba(255, 255, 255, 0.1); */
  display: flex;
  flex-direction: column;
  min-height: 100%;
}

.result-table thead {
  background: #A3B1FF;
  position: sticky;
  top: 0;
  /* z-index: 10; */
  display: flex;
  width: 100%;
}

.result-table th {
  padding: 12px 16px;
  text-align: center;
  font-weight: 600;
  color: white;
  text-transform: uppercase;
  font-size: 14px;
  /* letter-spacing: 0.5px; */
  border-bottom: 2px solid rgba(0, 0, 0, 0.1);
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}

.result-table tbody {
  display: flex;
  flex-direction: column;
  flex: 1;
  /* Pushes footer to bottom */
  width: 100%;
}

.result-table tbody tr {
  /* background: rgba(255, 255, 255, 0.08); */
  border-bottom: 1px solid #ffffff5c;
}

.result-table tbody tr.win-row {
  background: rgba(25, 195, 125, 0.15);
}

.result-table tbody tr.draw-row {
  background: rgba(255, 193, 7, 0.15);
}

.result-table td {
  padding: 7px 16px;
  text-align: center;
  color: white;
  font-size: 16px;
  font-weight: 500;
  border-bottom: 1px solid rgba(163, 177, 255, 0.3);
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}

.result-table tr {
  display: flex;
  width: 100%;
}

.result-table tbody tr:last-child td {
  border-bottom: none;
}

.result-table tfoot {
  background: #A3B1FF;
  position: sticky;
  bottom: 0;
  margin-top: auto;
  /* Ensures it sits at bottom if flex fails */
  display: flex;
  width: 100%;
}

.result-table tfoot td {
  padding: 14px 16px;
  font-weight: 700;
  font-size: 16px;
  color: white;
  border-bottom: none;
}

.bet-type {
  font-weight: 600;
}

.bet-amount {
  /* background: rgba(255, 255, 255, 0.2); */
  /* border-radius: 20px; */
  padding: 4px 12px;
  /* display: inline-block; */
}

.bet-cashout {
  font-weight: 600;
}

.total-label {
  font-weight: 700;
}

.total-betResult {
  /* background: rgba(255, 255, 255, 0.3); */
  border-radius: 20px;
  padding: 4px 12px;
  display: inline-block;
}

.net-result {
  text-align: center;
  font-size: 20px;
  font-weight: 600;
  padding: 16px 20px;
  border-radius: 12px;
  color: white;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
  animation: resultPulse 0.8s cubic-bezier(0.2, 1, 0.2, 1);
  margin-top: 4px;
}

@keyframes resultPulse {
  0% {
    transform: scale(0.9);
    opacity: 0;
  }

  50% {
    transform: scale(1.02);
  }

  100% {
    transform: scale(1);
    opacity: 1;
  }
}

.net-result.net-win {
  /* background: rgba(25, 195, 125, 0.35);
  border: 2px solid rgba(25, 195, 125, 0.5); */
}

.net-result.net-loss {
  /* background: rgba(255, 93, 93, 0.35);
  border: 2px solid rgba(255, 93, 93, 0.5); */
}

.net-result.net-draw {
  color: #FFC107;
}

/* Mobile Responsive */
@media (max-width: 768px) {
  .result-modal {
    margin: 0 auto;
    /* Center the modal */
    max-width: 95vw;
    /* nearly full width */
    overflow: visible;
    /* Allow character to pop out */
  }

  .result-modal-content {
    display: block;
    /* Remove grid to allow absolute positioning context to work simpler */
    padding: 40px 10px 20px 10px;
    min-height: auto;
  }

  .result-modal-character {
    position: absolute;
    left: -25px;
    bottom: 0;
    top: auto;
    height: 85%;
    width: 160px;
    transform: none;
    /* Reset desktop transform */
    display: flex;
    align-items: flex-end;
    margin-bottom: 0;
    z-index: 20;
  }

  .result-character-img {
    max-width: 100%;
    height: auto;
    object-fit: contain;
  }

  .result-modal-info {
    min-width: 0;
    /* Reset desktop min-width constraint */
    margin-left: 110px;
    /* Space for character */
    width: auto;
    gap: 8px;
  }

  .result-modal-title {
    font-size: 20px;
    text-align: center;
    margin-bottom: 8px;
    /* Adjust for closer spacing */
  }

  .result-table-wrapper {
    min-height: 0;
    max-height: 160px;
  }

  .result-table th,
  .result-table td {
    padding: 8px 4px;
    font-size: 12px;
  }

  .result-table tfoot td {
    font-size: 12px;
    padding: 8px 4px;
  }

  .net-result {
    font-size: 16px;
    padding: 8px 12px;
  }

  /* Responsive green timer pill - reduced height */
  .status-pill-top {
    padding: 3px 16px;
    gap: 8px;
  }

  .status-pill-top .status-headline {
    font-size: 12px;
  }

  .status-pill-top .status-timer {
    font-size: 14px;
  }

  .status-pill-top .status-timer-suffix {
    font-size: 12px;
  }

  .status-clock-icon {
    width: 22px;
    height: 22px;
  }
}

/* --- History Modal Styles --- */
#my-bet-history-modal.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  backdrop-filter: blur(4px);
  animation: fadeIn 0.2s ease-out;
}

.history-modal {
  width: 90%;
  max-width: 800px;
  background: #140d3a;
  /* Dark blue/purple background */
  border-radius: 12px;
  border: 1px solid rgba(64, 97, 192, 1);
  box-shadow: 0 0 30px rgba(0, 0, 0, 0.6);
  display: flex;
  flex-direction: column;
  max-height: 90vh;
  overflow: hidden;
}

.history-modal .modal-header {
  padding: 16px 24px;
  background: rgba(20, 5, 56, 1);
  box-shadow: 6px 6px 21.2px 0px rgba(0, 0, 0, 0.25) inset;
  border-bottom: 1px solid rgba(68, 103, 204, 1);
  display: flex;
  justify-content: center;
  align-items: center;
  position: relative;
}

.history-modal .modal-header h2 {
  margin: 0;
  font-size: 1.25rem;
  color: #fff;
  font-weight: 600;
  text-align: center;
}

.history-modal .close-btn {
  position: absolute;
  right: 16px;
  top: 50%;
  transform: translateY(-50%);
  background: transparent;
  border: none;
  color: rgba(255, 255, 255, 0.6);
  font-size: 1.5rem;
  cursor: pointer;
  padding: 0;
  line-height: 1;
}

.history-modal .close-btn:hover {
  color: #fff;
}

.history-modal .modal-body {
  padding: 2px;
  display: flex;
  flex-direction: column;
  flex: 1;
  overflow: hidden;
}

.history-table-container {
  overflow-y: auto;
  flex: 1;
  padding: 12px;
  /* Padding for the container itself */
  margin: 16px;
  /* Spacing from the main modal edges */
  background: rgba(0, 34, 95, 1);
  backdrop-filter: blur(10.1px);
  border-radius: 0 0 12px 12px;
}

.history-table {
  width: 100%;
  border-collapse: separate;
  /* Needed for border-radius on rows */
  border-spacing: 0 8px;
  /* Gap between rows */
  font-size: 0.9rem;
}

/* Header Stylings as a Single Bar */
.history-table thead tr {
  background: rgba(0, 56, 131, 1);
  box-shadow: 6px 6px 13.9px 0px rgba(0, 0, 0, 0.25) inset;
  border: 1px solid rgba(0, 56, 131, 1);
  border-radius: 8px;
  /* Ensure bg is clipped to radius */
}

.history-table thead tr th {
  padding: 14px;
  color: #fff;
  font-weight: 700;
  text-transform: capitalize;
  background: transparent;
  border: none;
  box-shadow: none;
}

/* Rounded corners for the Header Row */
.history-table thead tr th:first-child {
  border-top-left-radius: 8px;
  border-bottom-left-radius: 8px;
}

.history-table thead tr th:last-child {
  border-top-right-radius: 8px;
  border-bottom-right-radius: 8px;
}

.history-table th {
  /* Removed sticky for now to match card style structure simplicity, can add back if needed */
  text-align: center;
}

.history-table td {
  padding: 14px;
  text-align: center;
  border: none;
  color: #fff;
  background: transparent;
  /* Ensure row color shows through */
}

/* Row Styling - Alternating/Cards */
.history-table tbody tr {
  /* Default transparent for odd rows? Image shows row #! is transparent/dark */
  background: transparent;
  transition: transform 0.1s;
}

.history-table tbody tr:nth-child(even) {
  background: rgba(96, 88, 197, 0.2) !important;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
  border-radius: 8px;
}

.history-table tbody tr:nth-child(even) td {
  background: rgba(96, 88, 197, 0.2) !important;
}

.history-table tbody tr:nth-child(even) td:first-child {
  border-top-left-radius: 8px;
  border-bottom-left-radius: 8px;
}

.history-table tbody tr:nth-child(even) td:last-child {
  border-top-right-radius: 8px;
  border-bottom-right-radius: 8px;
}

.history-table tbody tr:nth-child(even) td:first-child {
  border-top-left-radius: 8px;
  border-bottom-left-radius: 8px;
}

.history-table tbody tr:nth-child(even) td:last-child {
  border-top-right-radius: 8px;
  border-bottom-right-radius: 8px;
}

.history-table tbody tr:hover {
  background: rgba(255, 255, 255, 0.03);
}

/* Specific Columns */
.col-round {
  font-family: monospace;
  color: #a0a0c0;
}

.col-amount,
.col-pl {
  font-weight: 500;
}

.status-win {
  color: #4ade80;
  /* bright green */
  font-weight: 600;
}

.status-lost {
  color: #f87171;
  /* soft red */
  font-weight: 600;
}

.status-draw {
  color: #FFC107;
  font-weight: 600;
}

.pl-win {
  color: #4ade80;
}

.pl-lost {
  color: #f87171;
}

.pl-draw {
  color: #FFC107;
}

.loading-text {
  padding: 24px;
  color: #a0a0c0;
  font-style: italic;
}

.pagination-controls {
  padding: 12px;
  display: flex;
  justify-content: center;
  /* Center pagination */
  align-items: center;
  gap: 16px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(0, 0, 0, 0.2);
}

.page-btn {
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #fff;
  padding: 6px 12px;
  border-radius: 4px;
  cursor: pointer;
  min-width: 32px;
}

.page-btn:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.2);
}

.page-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

#hist-page-info {
  color: #a0a0c0;
  font-size: 0.9rem;
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

/* Generic Modal Overlay */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  backdrop-filter: blur(4px);
  animation: fadeIn 0.2s ease-out;
}

/* Right Panel Tabs & Tables */
.tab-header {
  display: flex !important;
  background: rgba(20, 5, 56, 1) !important;
  border: none !important;
  border-radius: 10px !important;
  overflow: hidden !important;
  margin-bottom: 4px !important;
  padding: 4px !important;
  gap: 4px !important;
  margin-left: 10px !important;
  margin-right: 10px !important;
}

.tab-btn {
  flex: 1;
  background: transparent;
  border: none;
  color: #fff;
  padding: 8px 4px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  font-family: 'Poppins', sans-serif;
  font-size: 13px;
  border-radius: 8px;
}

.tab-btn:hover {
  background: rgba(255, 255, 255, 0.05);
  color: #fff;
}

.tab-btn.active {
  background: rgba(12, 48, 158, 1);
  color: #fff;
  box-shadow: 0px 4px 4px 0px rgba(0, 0, 0, 0.25) inset;
}

.current-bet-content {
  background: transparent;
  height: 300px;
  /* Fixed height for scrolling */
  overflow-y: auto;
  /* Enable vertical scrolling */
  border-radius: 0 0 8px 8px;
  padding: 0 10px;
  /* Remove padding to let table fill */
  position: relative;
}

.current-bets-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.current-bets-table th {
  color: #A3D1FF;
  font-weight: 500;
  text-align: left;
  padding: 12px 10px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  position: sticky;
  top: 0;
  background: #001A5F;
  /* Match panel background */
  z-index: 10;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.current-bets-table td {
  padding: 8px 10px;
  color: #fff;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.current-bets-table tbody tr:nth-child(odd) {
  background: #0C309E;
}

.current-bets-table tbody tr:nth-child(even) {
  background: #0C309E42;
}

.current-bets-table td.bet-amount {
  font-weight: 700;
  color: #fff;
}

.previous-bets-table td {
  font-size: 12px;
}

/* Mobile Layout Reordering (max-width: 1199px matches the desktop media query break) */
@media (max-width: 1199px) {

  /* Default Mobile Order: Center -> Right -> Left */
  .center-column {
    order: 1;
  }

  .right-rail {
    order: 2;
  }

  .left-rail {
    order: 3;
  }

  /* Betting Phase Mobile Order: Center -> Left -> Right */
  .main.phase-betting .center-column {
    order: 1;
  }

  .main.phase-betting .left-rail {
    order: 2;
  }

  .main.phase-betting .right-rail {
    order: 3;
  }
}