: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;
  --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%;
  width: 100%;
  overflow-y: auto;
  overflow-x: hidden;
}

@media (min-width: 1200px) {

  html,
  body {
    overflow-y: auto;
    /* Allow main screen scrolling */
  }
}

body {
  margin: 0;
  font-family: Poppins, system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  color: var(--text);
  background-color: var(--bg);
  background-image: url('./bg.png');
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  background-attachment: scroll;
}

.app {
  min-height: 100%;
  width: 100%;
  max-width: 100vw;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
}

@media (min-width: 1200px) {
  .app {
    height: auto;
    /* Allow height to grow */
    overflow: visible;
  }
}

/* ... existing styles ... */

.table-container {
  flex: 1;
  overflow-y: auto;
  /* Enable internal scrolling for the table area */
  padding-right: 4px;
  /* Space for scrollbar */
}

/* Header */
.hdr {
  top: 0;
  left: 0;
  right: 0;
  z-index: 20;
  background: transparent;
  border-bottom: 0;
  transform: translateZ(0);
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  contain: layout paint
}

.hdr-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  max-width: none;
  margin: 0;
  width: 100%;
  gap: 12px
}

.hdr-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: linear-gradient(180deg, #0b57b3, #0a49a0);
  border: 1px solid rgba(0, 0, 0, .25);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .12), 0 2px 6px rgba(0, 0, 0, .18);
  padding: 5px 12px;
  border-radius: 16px;
  width: 100%
}

.bet-input-left {
  position: absolute;
  inset: 0;
  display: flex;
  justify-content: center;
  align-items: center;
  pointer-events: none;
  /* Let clicks pass through to container or buttons if overlapped, though buttons are above z-index */
  z-index: 1;
}

.bet-input-right {
  display: flex;
  flex-direction: column;
  gap: 4px;
  justify-content: center;
  align-items: center;
  margin-left: auto;
  padding-left: 8px;
  position: relative;
  z-index: 2;
  /* Ensure buttons are clickable and above the left text layer */
}

.hdr-left {
  display: flex;
  align-items: center;
  gap: 10px
}

.hdr-right {
  display: flex;
  align-items: center;
  gap: 10px
}

.hdr-center {
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 1;
}

/* Desktop: keep original layout */
@media (min-width: 768px) {

  /* Ensure header right container is visible and hamburger is shown */
  .hdr-right-top {
    display: flex;
    order: 2;
    /* Place hamburger after balance */
  }

  /* Ensure balance comes first on desktop */
  .balance-display {
    order: 1;
  }

  .live-badge-mobile {
    display: none;
  }

  .live-badge-desktop {
    display: inline-flex;
  }

  .hdr-left {
    display: flex;
    align-items: center;
    gap: 10px;
  }
}

.hdr-title {
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: #e8f1ff;
  text-shadow: 0 1px 0 rgba(0, 0, 0, .35)
}

.live-badge {
  /* display: inline-flex; */
  align-items: center;
  gap: 6px;
  background: linear-gradient(180deg, #e01923, #b70f17);
  color: #fff;
  border-radius: 999px;
  padding: 4px 10px;
  font-weight: 800;
  border: 1px solid rgba(140, 10, 16, .9);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .22), 0 1px 3px rgba(0, 0, 0, .25)
}

.live-badge .dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 0 0 2px rgba(255, 255, 255, .4);
  animation: live-pulse 1.6s ease-out infinite
}

.live-badge .txt {
  font-size: 12px;
  letter-spacing: .08em;
  line-height: 1
}

.live-badge[hidden] {
  display: none
}

@keyframes live-pulse {
  0% {
    box-shadow: 0 0 0 2px rgba(255, 255, 255, .4)
  }

  60% {
    box-shadow: 0 0 0 6px rgba(255, 255, 255, 0)
  }

  100% {
    box-shadow: 0 0 0 2px rgba(255, 255, 255, .4)
  }
}

@media (max-width: 767px) {
  .hdr-inner {
    padding: 6px 12px;
  }

  .hdr-bar {
    display: flex;
    /* Back to flex for easier left/right alignment with absolute center */
    justify-content: space-between;
    align-items: center;
    position: relative;
    /* Anchor for absolute center */
    padding: 4px 8px;
    /* Compact padding */
    min-height: 54px;
    /* Ensure height for absolute element */
  }

  /* Game name on left */
  .hdr-left {
    display: flex;
    flex-direction: column;
    z-index: 2;
    /* Ensure above center if overlap */
    flex: 0 0 auto;
  }

  .hdr-title {
    font-size: 10px;
    line-height: 1.1;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
  }

  .t-sep {
    display: none;
  }

  /* Status badge ABSOLUTELY CENTERED */
  .hdr-center {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    width: auto;
    z-index: 1;
    display: flex;
    justify-content: center;
    align-items: center;
  }

  .status-badge {
    font-size: 11px;
    padding: 4px 12px;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.5);
    /* Stronger shadow for layering */
    white-space: nowrap;
    border: 2px solid rgba(255, 255, 255, 0.2);
    /* Make it pop like screenshot */
  }

  /* Right side container */
  .hdr-right {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 2px;
    z-index: 2;
    flex: 0 0 auto;
  }

  /* Top row: live badge + hamburger */
  .hdr-right-top {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 6px;
  }

  .live-badge {
    font-size: 9px;
    padding: 2px 6px;
  }

  .hamb {
    transform: scale(0.9);
    /* Slightly smaller on mobile */
  }

  /* Balance below */
  .balance-display {
    font-size: 10px;
    /* Smaller font */
    margin-right: 0;
    /* Tight align */
    opacity: 0.85;
    line-height: 1;
    /* Tighter line height */
    margin-top: -1px;
    /* Pull closer to row above */
  }

  /* Hide desktop badge */
  .live-badge-desktop {
    display: none;
  }

  /* Show mobile badge */
  .live-badge-mobile {
    display: inline-flex;
  }
}

@media (max-width: 375px) {
  .live-badge {
    font-size: 5px;
    padding: 2px 4px;
    gap: 2px;
    border-width: 0.5px;
  }

  .live-badge .dot {
    width: 5px;
    height: 5px;
    box-shadow: 0 0 0 1px rgba(255, 255, 255, .4);
  }

  .hdr {
    min-width: fit-content;
  }

  .hdr-bar {
    min-width: 355px;
    /* Ensure 350px + borders/offsets safely, or stick to 350px */
    min-width: 350px;
  }
}

.viewer-count {
  color: #d6e6ff;
  opacity: .95;
  letter-spacing: .02em
}

.brand {
  font-weight: 700;
  letter-spacing: .3px;
  text-transform: uppercase
}

.balance-display {
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(255, 255, 255, .08);
  padding: 6px 12px;
  border-radius: 6px;
  border: 1px solid rgba(0, 116, 255, .35)
}

.balance-label {
  font-size: 10px;
  color: var(--text);
  font-weight: 500
}

.balance-amount {
  /* font-size: 14px; */
  font-weight: 700;
  color: var(--positive);
  font-variant-numeric: tabular-nums;
  font-family: "Roboto Mono", ui-monospace, monospace
}

.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 */
.main {
  max-width: 100%;
  margin: 0;
  padding: 16px;
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
  width: 100%;
  overflow-x: hidden;
}

/* Large desktop: fix layout height to viewport below header to avoid page scrollbar */
@media (min-width:1200px) {
  .main {
    min-height: calc(100dvh - var(--hdr-offset, 72px) - var(--main-pad-t, 16px) - var(--main-pad-b, 16px));
    height: auto;
    overflow: visible;
  }
}

@media (min-width:1200px) {
  .main {
    grid-template-columns: 1fr var(--rail)
  }
}

/* Left column fills available height: top status, expandable stage, bottom bet row */
.left {
  display: grid;
  grid-template-rows: auto 1fr auto;
  min-height: 0;
  row-gap: 12px;
  max-width: 100%;
  overflow: visible;
}

/* Top status and stocks */
.top-row {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  position: relative;
  z-index: 4
}

@media (min-width:900px) {
  .top-row {
    grid-template-columns: 1fr auto 1fr
  }
}

.top-row-spacer {
  width: 160px;
  /* Approximate width of the status badge */
  pointer-events: none;
}

@media (max-width: 899px) {
  .top-row-spacer {
    display: none;
    /* Hide on mobile to avoid large vertical gap, unless requested otherwise */
  }
}

.status-badge {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 10px 14px;
  border-radius: 50px;
  border: 2px solid var(--accent-soft);
  color: var(--text);
  box-shadow: 0 0 9px 1px rgba(0, 116, 255, 1);
  background: #001A5F;
  font-weight: 700;
  text-transform: uppercase;
  flex-shrink: 0;
  font-size: 13px;
}

.status-badge .sb-inner {
  display: flex;
  align-items: center;
  gap: 12px
}

.status-badge .sb-text {
  display: flex;
  flex-direction: column;
  text-align: center;
  align-items: center;
  justify-content: center
}

.status-phase {
  letter-spacing: .3px;
  font-weight: 400
}

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

.stocks {
  display: grid;
  grid-template-columns: repeat(2, minmax(160px, 1fr));
  gap: 12px
}

.stock-card {
  background: var(--panel);
  border: 1px solid rgba(108, 220, 251, 1);
  border-radius: 6px;
  padding: 8px 10px;
  display: grid;
  gap: 6px;
  box-shadow: 0 0 6.5px 2px rgba(122, 179, 255, 1) inset
}

.stock-hdr {
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase
}

.stock-num {
  display: flex;
  align-items: baseline;
  justify-content: space-between
}

.baseline-price {
  font-variant-numeric: tabular-nums;
  font-family: "Roboto Mono", ui-monospace, monospace;
  font-size: 16px;
  color: var(--muted)
}

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

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

.delta.pos {
  color: var(--positive)
}

.delta.neg {
  color: var(--negative)
}

/* Stage area */
.stage {
  position: relative;
  z-index: 2;
  display: grid;
  place-items: center;
  background: linear-gradient(180deg, rgba(0, 0, 0, .0), rgba(0, 0, 0, .0));
  border: 0;
  border-radius: 14px;
  overflow: hidden;
  min-height: clamp(280px, 30vh, 760px)
}

@media (min-width: 768px) {
  .stage {
    min-height: clamp(280px, 48vh, 760px);
  }
}

/* Stack lady above table and anchor stack to stage bottom so ordering is preserved */
.stage .stage-stack {
  position: absolute;
  left: 50%;
  bottom: 0;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0;
  width: 100%;
  pointer-events: none
}

.stage .lady {
  position: relative;
  z-index: 1;
  height: auto;
  object-fit: contain;
  /* Scale with viewport height so she grows on higher resolutions */
  width: clamp(220px, 26vh, 420px);
  /* Nudge her up slightly and let the table overlap the lower edge */
  transform: translateY(-1.2vh);
  margin-bottom: clamp(-36px, -0.6vh, -10px)
}

.stage .table {
  position: relative;
  z-index: 2;
  height: auto;
  opacity: 1;
  /* Ensure table never exceeds container on small screens */
  width: min(100%, clamp(280px, 72vh, 1200px));
  max-width: 100%;
}

/* Table bet cards */
.table-cards {
  position: absolute;
  left: 50%;
  /* place at the vertical middle of the table */
  bottom: calc(var(--table-mid, 120px));
  transform: translateX(-50%);
  display: grid;
  grid-template-columns: 1fr 1fr;
  align-items: center;
  justify-items: center;
  gap: min(4vw, 40px);
  width: min(98%, var(--table-w, 720px));
  pointer-events: none
}

.coin {
  position: absolute;
  left: 50%;
  bottom: calc(var(--table-mid, 120px));
  transform: translateX(-50%) scale(1);
  width: var(--coin-size, 80px);
  height: var(--coin-size, 80px);
  pointer-events: none;
  z-index: 4;
  transition: transform .5s cubic-bezier(.22, 1, .36, 1), bottom .5s cubic-bezier(.22, 1, .36, 1);
  will-change: transform, bottom;
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
  perspective: 800px
}

.coin[aria-hidden="true"] {
  display: none
}

.coin .coin-inner {
  position: absolute;
  inset: 0;
  transform-style: preserve-3d;
  transition: transform .6s cubic-bezier(.22, 1, .36, 1)
}

.coin .face {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background-size: cover;
  background-position: center;
  box-shadow: 0 6px 10px rgba(0, 0, 0, .35)
}

.coin .face-heads {
  transform: rotateY(0deg) translateZ(1px);
  background-image: url('./head.png')
}

.coin .face-tails {
  transform: rotateY(180deg) translateZ(1px);
  background-image: url('./tail.png')
}

@keyframes coin-spin {
  0% {
    transform: rotateY(0deg)
  }

  100% {
    transform: rotateY(360deg)
  }
}

.coin.spinning .coin-inner {
  animation: coin-spin .7s linear infinite
}

.coin.land-heads .coin-inner {
  animation: none;
  transform: rotateY(0deg)
}

.coin.land-tails .coin-inner {
  animation: none;
  transform: rotateY(180deg)
}

.coin-enter {
  transition: transform .6s cubic-bezier(.22, 1, .36, 1), bottom .6s cubic-bezier(.22, 1, .36, 1)
}

.bet-card {
  pointer-events: auto;
  position: relative;
  overflow: visible;
  --card-size: min(22vw, max(130px, calc(var(--table-w, 720px) * .18)));
  width: var(--card-size);
  height: calc(1.62 * var(--card-size));
  min-width: 101px;
  min-height: 162px;
  border-radius: 15px;
  border: 2px solid rgba(108, 220, 251, 1);
  background: radial-gradient(50% 50%, rgba(57, 151, 201, .87) 0%, rgba(9, 39, 90, .87) 100%);
  box-shadow: 0 0 15px rgba(108, 220, 251, 0.6), 0 0 13.8px 2px rgba(0, 104, 225, 1) inset;
  backdrop-filter: blur(13.3px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  transition: transform .2s ease, filter .2s ease
}

.bet-card:disabled {
  cursor: not-allowed;
  opacity: .92;
  filter: saturate(.9) grayscale(.08)
}

.bet-card:disabled:hover {
  transform: none
}

.bet-card:hover {
  transform: translateY(-2px)
}

.bet-card__hdr {
  width: calc(100% - 12px);
  margin: 6px;
  border-radius: 9px;
  border: 1px solid rgba(108, 220, 251, 1);
  background: #002A68;
  box-shadow: inset 0 0 10.8px -2px rgba(122, 179, 255, 1);
  text-align: center;
  padding: 3px 0
}

.bet-card__hdr span {
  font-size: clamp(10px, calc(var(--card-size) * .105), 14px);
  font-weight: 600;
  letter-spacing: .08em;
  color: #6CDCFB;
  text-transform: uppercase;
  display: block;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap
}

.bet-card__mid {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex: 1;
  width: 100%;
  position: relative
}

.bet-card__symbol {
  font-size: clamp(11px, calc(var(--card-size) * .105), 15px);
  font-weight: 500;
  color: #fff;
  margin-bottom: 4px;
  padding: 0 4px;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  display: block;
  width: 100%;
  text-align: center
}

.bet-card__coin {
  position: relative;
  display: grid;
  place-items: center;
  width: clamp(24px, calc(var(--card-size) * .42), 90px);
  height: clamp(24px, calc(var(--card-size) * .42), 90px);
  margin: 4px 0
}

.bet-card__coin img {
  position: relative;
  z-index: 2;
  object-fit: contain;
  filter: drop-shadow(0 2px 2px rgba(0, 0, 0, .6));
  width: 100%;
  height: 100%
}

.bet-card__coin .bet-card__glow {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: #001D4B;
  filter: blur(calc(var(--card-size) * .04))
}

.bet-card__ratio {
  font-weight: 700;
  color: #fff;
  font-size: clamp(9px, calc(var(--card-size) * .085), 13px);
  margin-bottom: 4px;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap
}

.bet-card__bot {
  width: 100%;
  padding: clamp(4px, calc(var(--card-size) * .05), 8px) 8px;
  display: flex;
  flex-direction: column;
  gap: 2px
}

.bet-card__bot .row {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  column-gap: 6px
}

.bet-card__bot .lbl {
  font-size: clamp(9px, calc(var(--card-size) * .085), 13px);
  font-weight: 600;
  color: #fff;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap
}

.bet-card__bot .val {
  font-size: clamp(9px, calc(var(--card-size) * .085), 13px);
  color: #fff;
  text-align: right;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap
}

.bet-card__shadow {
  position: absolute;
  left: 0;
  right: 0;
  bottom: -12px;
  height: 16px;
  background: rgba(0, 0, 0, .5);
  filter: blur(10px);
  z-index: 1;
  border-bottom-left-radius: 15px;
  border-bottom-right-radius: 15px
}

/* Placed bet overlay chip (fixed size – text scales down to fit, chip never grows) */
.bet-card__placed {
  position: absolute;
  top: -10px;
  left: -10px;
  /* Fixed size – never changes regardless of bet amount */
  width: clamp(52px, calc(var(--card-size) * .38), 110px);
  height: clamp(52px, calc(var(--card-size) * .38), 110px);
  background-image: url('./betting-chip.png');
  background-size: cover;
  background-position: center;
  display: grid;
  place-items: center;
  border-radius: 50%;
  z-index: 3;
  overflow: hidden;
  filter: drop-shadow(0 2px 3px rgba(0, 0, 0, .5))
}

.bet-card__placed[aria-hidden="true"] {
  display: none
}

.bet-card__placed .amt {
  /* Default size for short amounts (≤3 chars e.g. ₹100) */
  font-size: clamp(11px, calc(var(--card-size) * .135), 17px);
  font-weight: 800;
  color: #fff;
  text-shadow: 0 1px 2px rgba(0, 0, 0, .8);
  line-height: 1;
  font-variant-numeric: tabular-nums;
  font-family: "Roboto Mono", ui-monospace, monospace;
  padding: 0 4px;
  max-width: 88%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: clip;
  text-align: center;
  display: block
}

/* Size-variant classes are intentionally kept but no longer alter the chip dimensions */

/* Compact text: used when amount string is 4+ chars (e.g. ₹1.1k, ₹500) */
.bet-card__placed.text-compact .amt {
  font-size: clamp(8px, calc(var(--card-size) * .10), 12px)
}

@media (max-width: 600px) {
  .bet-card__placed .amt {
    font-size: clamp(13px, 3.8vw, 16px)
  }

  .bet-card__placed.text-compact .amt {
    font-size: clamp(10px, 2.8vw, 13px)
  }
}

/* Winner highlight */
@keyframes bet-card-win-pulse {
  0% {
    box-shadow: 0 0 0 0 rgba(255, 215, 0, .6), inset 0 0 0 0 rgba(255, 215, 0, .4);
    transform: translateY(0)
  }

  50% {
    box-shadow: 0 0 22px 6px rgba(255, 215, 0, .6), inset 0 0 14px 2px rgba(255, 215, 0, .4);
    transform: translateY(-2px)
  }

  100% {
    box-shadow: 0 0 0 0 rgba(255, 215, 0, .0), inset 0 0 0 0 rgba(255, 215, 0, .0);
    transform: translateY(0)
  }
}

.bet-card--win {
  outline: 0;
  border-color: #FFD700 !important;
  animation: bet-card-win-pulse 1200ms ease-in-out 3
}

.bet-card--win .bet-card__glow {
  background: radial-gradient(ellipse at center, rgba(255, 215, 0, .4), rgba(0, 0, 0, 0) 60%)
}

/* Debug blink for LOCKED phase: applied via JS class bet-card--blink.
   Only pulse overall opacity (visibility on/off effect), no extra glow/scale. */
@keyframes bet-card-blink {

  0%,
  100% {
    opacity: 1;
  }

  50% {
    opacity: 0.25;
  }
}

.bet-card--blink {
  animation: bet-card-blink .55s linear infinite;
}

@media (min-width:1200px) {
  .table-cards {
    gap: min(3vw, 48px)
  }

  .bet-card__hdr span {
    font-size: 14px
  }

  .bet-card__symbol {
    font-size: 15px
  }
}

/* Desktop: scale stage, table and lady larger for normal PC view */
@media (min-width:1200px) {

  /* Keep stage from forcing the overall layout beyond 100vh */
  .stage {
    min-height: min(62vh, 720px)
  }

  /* Lift the table slightly above the very bottom on desktop */
  .stage .stage-stack {
    bottom: 3vh
  }

  .stage .table {
    width: min(99%, clamp(560px, 86vh, 1600px))
  }

  .stage .lady {
    width: clamp(240px, 30vh, 520px)
  }
}

/* Bet controls */
/* Bet panel row: center, constrain width, adapt columns */
.bet-row {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--bet-gap);
  justify-items: center
}

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

@media (min-width:1000px) {

  /* Desktop: center chips and bet controls together in one row */
  .bet-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--bet-gap)
  }

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

  /* Group bet input and total together as a single flex group */
  .bet-controls {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--bet-gap);
  }

  /* Center preset chips within their container */
  .chips {
    justify-content: center
  }

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

  /* Ensure the chips container itself becomes the flex item */
  .chips-host {
    display: contents
  }
}

/* On large desktops keep them centered with a slightly larger gap */
@media (min-width:1200px) {
  .bet-row {
    justify-content: center;
    gap: 16px
  }
}

/* Tighten spacing to ensure horizontal fit between 1000px and 1199px */
@media (min-width:1000px) and (max-width:1199px) {

  /* Slightly reduce the visual footprint of controls to avoid wrapping */
  .bet-input {
    transform: scale(.92);
    transform-origin: center
  }

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

/* Chips stay on one row, sized by their intrinsic clamp; no scrollbars */
.chips {
  display: grid;
  grid-template-columns: repeat(3, auto);
  gap: 24px;
  justify-content: center;
  justify-items: center;
}

.chip {
  position: relative;
  width: clamp(40px, 6vw, 60px);
  height: clamp(40px, 6vw, 50px);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 0 5px 0;
  background: transparent;
  border: 0;
  cursor: pointer;
  user-select: none;
  background-size: cover;
  background-position: center;
  color: #fff;
  font-weight: 700;
  line-height: 1;
  text-align: center;
  font-variant-numeric: tabular-nums;
  font-family: "Roboto Mono", ui-monospace, monospace;
  text-shadow: 0 0 6px rgba(0, 0, 0, .6), 0 0 2px rgba(255, 255, 255, .4);
  transform: scale(1.12);
  transition: transform .18s cubic-bezier(.34, 1.56, .64, 1);
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  will-change: transform;
  appearance: none;
  -webkit-appearance: none;
  font-size: 11px;
}

/* Realistic oval shadow under chip */
.chip::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: -4px;
  transform: translateX(-50%);
  width: 72%;
  height: 14px;
  background: radial-gradient(ellipse at center, rgba(0, 0, 0, .45) 0%, rgba(0, 0, 0, .28) 40%, rgba(0, 0, 0, 0) 70%);
  filter: blur(2px);
  opacity: .9;
  pointer-events: none;
  transition: transform .18s ease, opacity .18s ease
}

.chip:hover {
  transform: scale(1.02)
}

.chip:hover::after {
  transform: translateX(-50%) scale(.98);
  opacity: .92
}

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

.chip:active::after {
  transform: translateX(-50%) scale(.88);
  opacity: .85
}

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

.chip.is-pressing::after {
  transform: translateX(-50%) scale(.88);
  opacity: .85
}

.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: space-between;
  background: #000a2a;
  border: 1px solid #0074FF;
  border-radius: 30px;
  overflow: hidden;
  box-shadow: 0 0 10px rgba(0, 116, 255, 0.4), inset 0 0 20px rgba(0, 116, 255, 0.2);
  padding: 0 16px;
  width: 200px;
  height: 48px;
  position: relative;
  flex-shrink: 0;
  box-sizing: border-box;
}

.bet-input-left {
  position: absolute;
  inset: 0;
  display: flex;
  justify-content: center;
  align-items: center;
  pointer-events: none;
  z-index: 1;
}

.bet-input-right {
  display: flex;
  flex-direction: column;
  gap: 4px;
  justify-content: center;
  align-items: center;
  margin-left: auto;
  padding-left: 8px;
  position: relative;
  z-index: 2;
}

input.bet-amt {
  font-size: 18px;
  font-weight: 700;
  color: #fff;
  text-shadow: 0 0 8px rgba(255, 255, 255, 0.5);
  font-family: "Roboto Mono", ui-monospace, monospace;
  font-variant-numeric: tabular-nums;
  line-height: 1;
  text-align: center;
  background-color: transparent !important;
  border: none !important;
  outline: none !important;
  width: 100%;
  padding: 0;
  -moz-appearance: textfield;
  appearance: textfield;
  pointer-events: auto;
}

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

.bet-input button {
  background: transparent;
  border: none;
  padding: 0;
  margin: 0;
  cursor: pointer;
  width: 24px;
  height: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: none;
  transition: transform 0.1s ease-out;
  border-radius: 0;
}

.bet-input button:hover {
  transform: scale(1.2);
  background: transparent;
  box-shadow: none;
}

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

.bet-input button:focus {
  outline: none;
}

.bet-input .inc::before {
  content: '';
  width: 28px;
  height: 10px;
  display: block;
  background-image: url("data:image/svg+xml,%3Csvg width='28' height='10' viewBox='0 0 28 10' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M14 1.5L25 8.5H3L14 1.5Z' fill='%23004DA9' stroke='%23004DA9' stroke-width='3' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: center;
  background-size: contain;
  border: none;
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.5));
}

.bet-input .dec::before {
  content: '';
  width: 28px;
  height: 10px;
  display: block;
  background-image: url("data:image/svg+xml,%3Csvg width='28' height='10' viewBox='0 0 28 10' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M14 8.5L3 1.5H25L14 8.5Z' fill='%23004DA9' stroke='%23004DA9' stroke-width='3' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: center;
  background-size: contain;
  border: none;
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.5));
}

.total-bet {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 16px;
  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;
  width: 200px;
  /* Fixed equal width */
  height: 48px;
  /* Fixed equal height */
  flex-shrink: 0;
  box-sizing: border-box;
}

.total-bet .amt {
  display: inline-block;
  min-width: unset;
  /* Let content flow naturally in fixed container */
  text-align: left;
  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,
  .total-bet {
    transform: scale(1);
    /* Reset scale to avoid discrepancies, rely on fixed sizing */
    transform-origin: center;
  }
}

/* bet action buttons with coin textures */
.bet-actions button {
  height: 44px;
  padding: 0 14px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, .1);
  background: #182233;
  color: var(--text);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px
}

.bet-actions .heads::before,
.bet-actions .tails::before {
  content: "";
  display: inline-block;
  width: 24px;
  height: 24px;
  background-size: cover;
  background-position: center;
  border-radius: 50%
}

.bet-actions .heads::before {
  background-image: url('./head.png')
}

.bet-actions .tails::before {
  background-image: url('./tail.png')
}

/* 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
  }
}

.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
}

/* Bottom bar */
.bbar {
  position: sticky;
  bottom: 0;
  margin-top: auto;
  background: #004DA9;
  backdrop-filter: blur(8px);
  border-top: 1px solid rgba(0, 116, 255, .35)
}

.bbar-inner {
  max-width: none;
  margin: 0;
  padding: 10px 16px;
  display: flex;
  justify-content: center
}

.home-btn {
  padding: 10px 14px;
  border-radius: 10px;
  background: #182233;
  border: 1px solid rgba(255, 255, 255, .08);
  color: var(--text);
  cursor: pointer
}

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

.home-panel {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  bottom: 64px;
  z-index: 30;
  width: min(720px, 92vw);
  background: var(--panel);
  border: 1px solid rgba(255, 255, 255, .08);
  border-radius: 12px;
  padding: 16px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, .5)
}

.home-panel[hidden] {
  display: none
}

/* 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);
  }
}

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

  .main {
    padding: 12px
  }

  /* Reduce gap between top badges and stage */
  .left {
    row-gap: 6px
  }

  /* Center preset bet chips on mobile */
  .chips {
    justify-content: center;
    gap: 24px;
    overflow: visible;
  }

  /* Place bet input and total bet side-by-side on mobile */
  .bet-row {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    gap: 16px;
    padding: 0 8px;
  }

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

  .chips .chip {
    flex: 0 0 auto;
    width: 48px;
    height: 42px;
  }

  .chips-host {
    display: contents
  }

  .chips {
    /* grid-area: chips; removed */
    display: grid;
    grid-template-columns: repeat(3, auto);
    gap: 16px;
    width: auto;
    flex-shrink: 0;
  }

  .bet-controls {
    /* grid-area: betcontrols; removed */
    display: flex;
    flex-direction: column;
    align-items: stretch;
    justify-content: center;
    gap: 12px;
    flex-shrink: 0;
  }

  /* Let the two middle items size to content and center */
  .bet-row>* {
    width: auto;
    max-width: none;
    justify-self: center
  }
}

/* Center bet controls and chips on tablet widths (750px–999px) */
/* Center bet controls and chips on tablet widths (750px–999px) */
@media (min-width:750px) and (max-width:999px) {

  /* Remove intermediate wrapper from layout to let grid participate directly in flex row */
  .chips-host {
    display: contents;
  }

  .bet-row {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    gap: 40px;
    padding: 0;
  }

  .chips {
    justify-content: center;
    gap: 20px;
    padding: 10px;
    flex-shrink: 0;
    overflow: visible;
    /* Ensure shadows/scales don't get clipped */
  }

  /* Fix chip size in tablet mode to prevent shifting/squashing during resize */
  .chips .chip {
    width: 60px;
    height: 50px;
    flex: 0 0 auto;
  }

  .bet-controls {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
  }

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

/* Ensure bet controls wrapper groups the input and total together */
.bet-controls {
  display: flex;
  align-items: center;
  gap: var(--bet-gap)
}

/* Keep top status badge and stock cards in one row on narrow screens */
@media (max-width:899px) {
  .top-row {
    display: flex;
    align-items: stretch;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: nowrap;
    min-width: 0;
  }

  .top-row>* {
    min-width: 0
  }

  .top-row>.stock-card {
    flex: 1 1 0;
    min-width: 0;
    min-height: 0;
  }

  .top-row>.status-badge {
    flex: 0 1 auto;
    white-space: nowrap;
    max-width: 40vw;
  }

  /* Slightly tighten inner spacing so three items fit more comfortably */
  .status-badge {
    padding: 8px 12px;
    font-size: 12px
  }

  .stock-card {
    padding: 6px 8px
  }

  .htp-history {
    width: min(92vw, 500px);
  }

}

/* Extra tightening for smaller portrait widths */
@media (max-width:599px) {
  .top-row {
    gap: 10px
  }

  .top-row>.status-badge {
    max-width: 38vw
  }

  .status-badge {
    padding: 6px 10px;
    font-size: 11px
  }

  .status-badge .sb-inner {
    gap: 8px
  }

  .status-badge svg {
    width: 18px;
    height: 18px
  }

  .stock-hdr {
    flex-wrap: wrap;
    row-gap: 2px;
  }

  .stock-num {
    flex-direction: column;
    align-items: flex-start;
    gap: 2px;
  }

  .baseline-price {
    font-size: 12px;
  }

  .price {
    font-size: 12px;
  }
}

@media (max-width:399px) {
  .top-row {
    gap: 8px
  }

  .top-row>.status-badge {
    max-width: 34vw
  }

  .status-badge {
    padding: 5px 8px;
    font-size: 10px
  }

  .stock-card {
    padding: 4px 6px
  }


}

/* How to Play Modal */
.htp-overlay {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  background: rgba(0, 0, 0, 0.7);
  opacity: 0;
  animation: htp-fade-in 200ms ease-out forwards;
  backdrop-filter: blur(4px);
}

@keyframes htp-fade-in {
  to {
    opacity: 1;
  }
}

.htp-card {
  position: relative;
  background: #00227a;
  background: linear-gradient(0deg, #0A023B 0%, #002A5A 90.29%);
  border-radius: 20px;
  padding: 0;
  width: min(90vw, 600px);
  border: 2px solid #0074FF;
  box-shadow: 0 0 20px rgba(0, 116, 255, 0.4), inset 0 0 20px rgba(0, 116, 255, 0.5);
  color: #fff;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  height: auto;
  min-height: 500px;
}

.htp-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(0, 77, 169, 1);
}

.htp-title {
  font-family: 'Play', sans-serif;
  font-size: 18px;
  font-weight: 700;
  text-transform: capitalize;
  letter-spacing: 0.05em;
}

/* Specific styles for Rules Modal */
.htp-rules-card {
  /* Using same styles as generic card but can override dimensions if needed */
  width: min(90vw, 720px);
}

.htp-rules-title {
  font-size: 16px;
  font-weight: 700;
  color: #fff;
  margin-bottom: -10px;
  /* pull closer to box */
}

.htp-rules-box {
  background: rgba(1, 62, 142, 1);
  backdrop-filter: blur(4.3px);
  box-shadow: 0px 4px 4px 0px rgba(0, 0, 0, 0.25);
  border-radius: 12px;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  font-size: 14px;
  line-height: 1.5;
  color: #d6e6ff;
  border: 1px solid rgba(0, 116, 255, 1);
}

.htp-rule-item {
  display: flex;
  gap: 8px;
}

.htp-close {
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.2s;
}

.htp-close:hover {
  opacity: 0.8;
}

.htp-body {
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  align-items: stretch;
}

.htp-video-placeholder {
  width: 100%;
  aspect-ratio: 16/10;
  background: #003380;
  border-radius: 12px;
  box-shadow: inset 0 0 20px rgba(0, 0, 0, 0.3);
  position: relative;
}

.htp-video-container {
  background: rgba(1, 62, 142, 1);
  backdrop-filter: blur(4.3px);
  box-shadow: 0px 4px 4px 0px rgba(0, 0, 0, 0.25);
  border-radius: 12px;
  padding: 12px;
  /* Small padding for the frame effect */
  border: 1px solid rgba(0, 116, 255, 1);
  display: flex;
  justify-content: center;
  align-items: center;
}

#htp-video {
  width: 100%;
  border-radius: 8px;
  display: block;
}

.htp-history {
  width: min(92vw, 800px);
  min-height: 600px;
}

/* Game History Table (Desktop Default) */
.gh-container {
  width: 100%;
  color: #fff;
}

.gh-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  color: #fff;
}

.gh-table thead tr,
.gh-table tbody tr {
  display: table;
  width: 100%;
  table-layout: fixed;
}

.gh-table tbody {
  display: block;
  max-height: 420px;
  overflow-y: auto;
}

.gh-th {
  padding: 16px;
  text-align: center;
  font-family: 'Play', sans-serif;
  font-weight: 600;
  font-size: 16px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  background: rgba(0, 77, 169, 1);
  color: rgba(142, 194, 255, 1);
}

.gh-th:first-child {
  border-radius: 20px 0 0 20px;
}

.gh-th:last-child {
  border-radius: 0 20px 20px 0;
}

.gh-table td {
  padding: 18px 16px;
  font-size: 13px;
  text-align: center;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  vertical-align: middle;
}

/* Hidden elements on Desktop */
.gh-mobile-day,
.gh-mobile-label {
  display: none;
}

/* Custom Scrollbar */
.gh-tbody::-webkit-scrollbar {
  width: 6px;
}

.gh-tbody::-webkit-scrollbar-track {
  background: transparent;
}

.gh-tbody::-webkit-scrollbar-thumb {
  background: rgba(0, 77, 169, 1);
  border-radius: 10px;
}

/* MOBILE / TABLET CARD VIEW (<= 1199px) */
@media (max-width: 1199px) {

  /* Hide standard header */
  .gh-thead {
    display: none;
  }

  /* List Container */
  /* List Container */
  .gh-tbody {
    display: flex;
    flex-direction: column;
    padding: 4px;
    max-height: 480px;
    /* or auto/calc */
  }

  /* Card Row */
  .gh-row {
    display: flex;
    flex-direction: column;
    background: linear-gradient(180deg, rgba(0, 77, 169, 0.4) 0%, rgba(0, 50, 120, 0.6) 100%);
    border: 1px solid rgba(0, 116, 255, 1);
    border-radius: 12px;
    padding: 0;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    width: 100%;
    /* Override table width */
    box-sizing: border-box;
    margin-bottom: 16px;
  }

  .gh-row:last-child {
    margin-bottom: 0;
  }

  /* Cell Resets: Mobile */
  .gh-table td {
    display: block;
    /* Important: Let inner div fill width */
    padding: 0 !important;
    /* Reset padding so inner div handles it */
    border: none;
    width: 100%;
  }

  /* Top Section Wrapper */
  .gh-top-section {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    background: rgba(1, 62, 142, 1);
    border-radius: 12px 12px 0 0;
    border-bottom: 1px solid rgba(0, 116, 255, 1);
    backdrop-filter: blur(4.3px);
  }

  /* Bottom Section Wrapper */
  .gh-bottom-section {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    background: rgba(0, 77, 169, 1);
    backdrop-filter: blur(4.3px);
    box-shadow: 0px 4px 4px 0px rgba(0, 0, 0, 0.25);
    border-radius: 0 0 12px 12px;
  }

  .gh-date-val {
    font-family: 'Play', sans-serif;
    font-size: 14px;
    color: rgba(142, 194, 255, 1);
    font-weight: 700;
  }

  .gh-mobile-day {
    display: block;
    /* Show Day */
    font-family: 'Play', sans-serif;
    font-size: 14px;
    color: rgba(142, 194, 255, 1);
    font-weight: 700;
    letter-spacing: 0.05em;
  }

  /* Hide Time Column */
  .gh-col-time {
    display: none !important;
  }

  /* Mobile Specific Card Spacing */

  .gh-mobile-label {
    display: block;
    /* Show Label */
    font-family: 'Play', sans-serif;
    font-size: 14px;
    font-weight: 700;
    color: #fff;
    letter-spacing: 0.05em;
  }

  /* Pill Style for Winner Value */
  .gh-winner-val {
    background: #503212;
    /* Brownish background */
    border: 1px solid #b8860b;
    /* Gold/Bronze border */
    color: #ffd700;
    /* Gold text */
    padding: 2px 12px;
    border-radius: 12px;
    font-family: 'Play', sans-serif;
    font-size: 11px;
    line-height: 1.4;
    min-width: 50px;
    text-align: center;
    box-shadow: 0 0 5px rgba(184, 134, 11, 0.4);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.02em;
  }

  /* --- My Bet History Special Grid (Mobile) --- */
  .mbh-table .gh-row {
    display: grid;
    grid-template-areas:
      "header header"
      "side bet"
      "winner cashout";
    grid-template-columns: 1fr 1fr;
    background: rgba(0, 77, 169, 1) !important;
    backdrop-filter: blur(4.3px);
    border: 1px solid rgba(0, 116, 255, 1);
    border-radius: 12px;
    overflow: hidden;
  }

  .mbh-table .gh-col-date {
    grid-area: header;
    display: flex !important;
    justify-content: space-between;
    padding: 12px 16px !important;
    background: rgba(1, 62, 142, 1);
    border-bottom: 1px solid rgba(0, 116, 255, 1) !important;
    border-radius: 12px 12px 0 0;
  }

  .mbh-table .gh-col-side {
    grid-area: side;
  }

  .mbh-table .gh-col-winner {
    grid-area: winner;
  }

  .mbh-table .gh-col-bet {
    grid-area: bet;
  }

  .mbh-table .gh-col-cashout {
    grid-area: cashout;
  }

  .mbh-table .gh-col-side,
  .mbh-table .gh-col-winner,
  .mbh-table .gh-col-bet,
  .mbh-table .gh-col-cashout {
    display: flex !important;
    justify-content: space-between !important;
    align-items: center !important;
  }

  .mbh-table td {
    padding: 7px 16px !important;
    box-sizing: border-box;
    border: none !important;
  }

  .mbh-val {
    font-family: 'Phudu', sans-serif;
    color: #fff;
    font-weight: 300;
    font-size: 14px;
  }
}

/* Small Mobile View (< 550px) */
@media (max-width: 550px) {
  .htp-card {
    min-height: 450px !important;
  }

  .htp-body {
    padding: 12px 12px !important;
    gap: 12px !important;
  }

  .mbh-table .gh-col-date {
    padding: 8px 12px !important;
  }

  .mbh-table td {
    padding: 6px 12px !important;
  }

  .gh-date-val,
  .gh-mobile-day {
    font-size: 13px !important;
  }

  .gh-mobile-label,
  .mbh-val {
    font-size: 12px !important;
  }

  .gh-winner-val {
    font-size: 10px !important;
    padding: 2px 10px !important;
    min-width: 45px !important;
  }
}

/* Tiny Mobile View (< 399px) */
@media (max-width: 399px) {
  .htp-card {
    min-height: 400px !important;
  }

  .htp-body {
    padding: 8px 8px !important;
    gap: 8px !important;
  }

  .mbh-table .gh-col-date {
    padding: 6px 10px !important;
  }

  .mbh-table td {
    padding: 4px 10px !important;
  }

  .gh-date-val,
  .gh-mobile-day {
    font-size: 11px !important;
  }

  .gh-mobile-label,
  .mbh-val {
    font-size: 10px !important;
  }

  .gh-winner-val {
    font-size: 9px !important;
    padding: 2px 6px !important;
    min-width: 40px !important;
  }
}



/* Bet Placed Container */
.bet-placed-container {
  position: absolute;
  top: -70px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(180deg, #15803d 0%, #166534 100%);
  border-radius: 6px;
  padding: 8px 8px;
  border: 2px solid #4ade80;
  box-shadow: 0 0 20px hsla(126, 100%, 50%, 0.8), 0 0 40px rgba(74, 222, 128, 0.5), 0 0 60px rgba(74, 222, 128, 0.3);
  z-index: 10;
}

.bet-placed-container[aria-hidden="true"],
.bpc-arrow[aria-hidden="true"] {
  display: none;
}

.bpc-inner {
  display: flex;
  align-items: center;
  gap: 4px;
}

.bpc-tick {
  width: 30px;
  height: 30px;
  object-fit: contain;
}

.bpc-text-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  line-height: 1.2;
}

.bpc-amount {
  font-weight: 600;
  font-size: 14px;
  color: #fff;
}

.bpc-text {
  font-size: 14px;
  color: rgba(255, 255, 255, 0.9);
  font-weight: 600;
}

.bpc-arrow {
  position: absolute;
  top: -20px;
  left: 50%;
  transform: translateX(-50%);
  width: 30px;
  height: auto;
  z-index: 11;
}

@media (max-width: 600px) {
  .bet-placed-container {
    padding: 6px 8px;
    top: -50px;
  }

  .bpc-tick {
    width: 20px;
    height: 20px;
  }

  .bpc-amount {
    font-size: 12px;
  }

  .bpc-text {
    font-size: 10px;
  }

  .bpc-arrow {
    width: 24px;
    top: -13px;
  }
}

/* Result Component */
/* Result Component */
.result-container {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 10px;
  align-items: center;
  justify-content: center;
  background-color: rgba(0, 0, 0, 0.85);
  background-image: url('./star.png'), url('./star.png');
  background-repeat: no-repeat, no-repeat;
  background-position: top left, bottom right;
  background-size: 60% auto, 60% auto;
  pointer-events: auto;
}

.result-heading {
  font-family: 'Play', sans-serif;
  font-size: 30px;
  font-weight: 700;
  color: #fff;
  text-shadow: 0px 0px 6.3px rgba(205, 221, 255, 1);
  margin: 0;
  letter-spacing: 2px;
}

.result-header-wrapper {
  display: flex;
  position: relative;
  width: 500px;
  justify-content: center;
  align-items: center;
  margin-bottom: 10px;
}

.result-card {
  background: linear-gradient(180deg, #001F65 0%, #00309D 100%);
  border: 3px solid rgba(111, 176, 255, 1);
  box-shadow: 0 0 120px 0.2px rgba(245, 194, 1, 0.6);
  width: 500px;
  height: 480px;
  border-radius: 12px;
  color: white;
  pointer-events: auto;
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-evenly;
}

.result-timer {
  font-family: 'Play', sans-serif;
  font-weight: 700;
  font-style: normal;
  /* 'Bold' is not a valid font-style, weight handles it */
  font-size: 24px;
  /* Reduced from 32px slightly to fit better or stick to 32px?  User asked 32px. Let's try 24px first or 32px might overflow if 80px space? 360+32+gap? 440 total. 440-360=80. 15px gap. 32px text line-height ~32-40px. 360+15+35 = 410. It fits. Let's use 26px to be safe first or 32px. */
  /* User requested 32px. */
  font-size: 20px;
  /* 32px might be too big for the remaining space if we want padding. Let's start smaller/safer or use 24px */
  /* Wait, user specifically asked for 32px. I should try to honor it. But layout constraint is 440px height. 
     Inner is 360. 440-360 = 80.
     Borders takes space too? 
     result-card border 3px is outside or inside? box-sizing border-box usually.
     So available inner height ~434px. 
     Inner box 360 + 2px border? .result-inner has 1px border. 
     Let's use 20px gap. 360 + 20 = 380. 
     Text 32px. 380 + 32 = 412. 
     Vertical padding of card? none set, justified center.
     It should fit.
  */
  font-size: 24px;
  line-height: 100%;
  letter-spacing: 0.08em;
  text-align: center;
  color: rgba(245, 194, 1, 1);
  /* User asked for box-shadow on text? It likely means text-shadow for glowing effect or they really want a box around it. Given "text ka colour" context, I will use text-shadow for glow. 
     "box-shadow: 0px 0px 10px 0px rgba(0, 27, 80, 1);" -> This color is dark blue. 
     A dark blue shadow on yellow text suggests a drop shadow/outline for contrast.
     So text-shadow: 0px 0px 10px rgba(0, 27, 80, 1);
  */
  text-shadow: 0px 0px 10px rgba(0, 27, 80, 1);
  /* If they literally meant box-shadow (rectangular glow), I can add it, but it looks odd on text without background. I'll stick to text-shadow as 'interpretation'. */
  /* margin-top removed for space-evenly distribution */
}

.result-inner {
  background: rgba(0, 27, 80, 1);
  width: 420px;
  height: 360px;
  border-radius: 8px;
  border: 1px solid rgba(111, 176, 255, 1);
  display: flex;
  flex-direction: column;
  padding: 15px 20px;
  margin-top: 20px;
}

.result-inner span {
  font-family: 'Poppins', sans-serif;
  font-size: 14px;
  font-weight: 500;
  color: #fff;
}

.result-inner span .val {
  color: rgba(245, 194, 1, 1);
  font-weight: 700;
}

.result-info-row {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.result-table {
  width: 100%;
  margin-top: 50px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.rt-header {
  display: grid;
  grid-template-columns: 1fr 1fr 1.5fr;
  text-align: center;
  /* color: inherited by spans via explicit rule below */
  font-family: 'Poppins', sans-serif;
  font-size: 14px;
  font-weight: 600;
  opacity: 1;
}

.rt-header span {
  color: rgba(142, 194, 255, 1);
}

.rt-divider {
  width: 90%;
  height: 1px;
  background: rgba(111, 176, 255, 1);
  margin: 5px auto;
  /* Centered and partial width */
}

.rt-body {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.rt-row {
  display: grid;
  grid-template-columns: 1fr 1fr 1.5fr;
  text-align: center;
  font-family: 'Poppins', sans-serif;
  font-size: 14px;
  font-weight: 500;
  color: #fff;
  align-items: center;
}

.rt-row .won {
  color: rgba(15, 220, 0, 1);
  font-family: 'Phudu', sans-serif;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 3px;
}

.rt-row .loss {
  color: rgba(224, 0, 0, 1);
  font-family: 'Phudu', sans-serif;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 3px;
}

.status-arrow {
  width: 14px;
  height: auto;
}

/* Optional side styling if needed */
.side-tails {
  color: #fff;
  background: rgba(85, 85, 85, 1);
  border: 1px solid rgba(185, 185, 185, 1);
  border-radius: 18px;
  padding: 4px 12px;
  justify-self: center;
  font-size: 12px;
  font-weight: 600;
}

.side-heads {
  color: #fff;
  background: rgba(105, 61, 17, 1);
  border: 1px solid rgba(245, 213, 97, 1);
  border-radius: 18px;
  padding: 4px 12px;
  justify-self: center;
  font-size: 12px;
  font-weight: 600;
}

.side-draw {
  color: #fff;
  background: rgba(180, 140, 0, 1);
  border: 1px solid rgba(255, 215, 0, 1);
  border-radius: 18px;
  padding: 4px 12px;
  justify-self: center;
  font-size: 12px;
  font-weight: 600;
}

.rt-row .draw {
  color: rgba(255, 215, 0, 1);
  font-family: 'Phudu', sans-serif;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 3px;
}

.result-close {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-120%);
  /* Moved further up */
  background: rgba(0, 27, 80, 1);
  border: 2px solid rgba(111, 176, 255, 0.5);
  border-radius: 50%;
  width: 32px;
  height: 32px;
  cursor: pointer;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.2s ease, background 0.2s;
  margin: 0;
  /* Font properties for X */
  font-family: 'Play', sans-serif;
  font-weight: 400;
  font-size: 16px;
  color: rgba(255, 255, 255, 1);
  text-shadow: 0px 0px 4px rgba(205, 221, 255, 1);
  line-height: 1;
  /* Fix vertical alignment */
  padding-bottom: 2px;
  /* Visual optical adjustment for text usually needing slight lift */
}

.result-net {
  font-family: 'Phudu', sans-serif;
  font-weight: 700;
  font-size: 28px;
  line-height: 100%;
  letter-spacing: 0.02em;
  text-align: center;
  color: #fff;
  text-shadow: 0px 0px 9.5px rgba(42, 139, 255, 1);
  margin-top: auto;
  /* Push to bottom of flex container */
  margin-bottom: 15px;
}

.result-price-locked {
  font-family: 'Poppins', sans-serif;
  font-weight: 200;
  font-size: 14px;
  line-height: 100%;
  letter-spacing: 0.01em;
  text-align: center;
  color: rgba(245, 194, 1, 1);
  margin-bottom: 10px;
}

.result-play-again {
  width: 400px;
  height: 60px;
  border-radius: 25px;
  background: linear-gradient(0deg, #002067 0%, #00339D 90.29%);
  border: 2px solid rgba(111, 176, 255, 1);
  box-shadow: 0px 0px 8px 1px rgba(0, 92, 164, 1) inset;

  font-family: 'Play', sans-serif;
  font-weight: 700;
  font-size: 32px;
  line-height: 100%;
  letter-spacing: 0.05em;
  color: rgba(252, 253, 255, 1);
  text-shadow: 0px 0px 5px rgba(205, 221, 255, 1);

  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: 20px;
  transition: transform 0.2s ease, box-shadow 0.2s;
}

.result-play-again:hover {
  transform: scale(1.02);
  box-shadow: 0px 0px 12px 2px rgba(0, 92, 164, 1) inset;
}


.result-close img {
  width: 24px;
  height: 24px;
  object-fit: contain;
}

@media (max-width: 600px) {
  .result-header-wrapper {
    width: 90vw;
  }

  .result-card {
    width: 90vw;
    height: auto;
    min-height: auto;
    padding-bottom: 20px;
    justify-content: flex-start;
    gap: 15px;
  }

  .result-inner {
    width: 85%;
    height: auto;
    min-height: 360px;
    margin-top: 25px;
    padding: 10px;
  }

  .result-play-again {
    width: 80vw;
    font-size: 24px;
    height: 50px;
  }

  .result-heading {
    font-size: 24px;
  }

  .result-timer {
    font-size: 18px;
  }

  .result-price-locked {
    font-size: 12px;
  }
}

/* Winning/Active bet highlight on table cards */
.bet-card.active-glow {
  box-shadow: 0 0 25px rgba(108, 220, 251, 0.9), 0 0 20px rgba(108, 220, 251, 0.6) inset;
  border-color: #ffffff;
  transform: translateY(-2px);
}

/* How to Play Video/Tabs */
.htp-video-card {
  width: min(90vw, 800px);
}

.htp-video-container {
  width: 100%;
  aspect-ratio: 16/9;
  background: black;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
}

.htp-video-container video {
  width: 100%;
  height: 100%;
  display: block;
}

.htp-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 8px;
}

.htp-tab {
  background: rgba(0, 77, 169, 0.4);
  border: 1px solid rgba(0, 116, 255, 0.3);
  border-radius: 8px;
  padding: 12px;
  color: rgba(255, 255, 255, 0.7);
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  font-size: 14px;
}

.htp-tab:hover {
  background: rgba(0, 77, 169, 0.6);
  color: #fff;
}

.htp-tab.active {
  background: #0D0538;
  border-color: #0074FF;
  color: #fff;
  box-shadow: 0 0 15px rgba(0, 116, 255, 0.2);
}

/* Game History Pagination */
.gh-container {
  flex: 1;
  overflow-y: auto;
  min-height: 0;
  /* important for flex overflow */
}

.gh-footer {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  display: flex;
  justify-content: center;
}

.gh-pagination {
  display: flex;
  align-items: center;
  gap: 16px;
  font-size: 14px;
  color: #d6e6ff;
}

.gh-page-btn {
  background: rgba(0, 77, 169, 0.5);
  border: 1px solid rgba(0, 116, 255, 0.3);
  color: #fff;
  border-radius: 6px;
  padding: 6px 14px;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.2s;
}

.gh-page-btn:hover:not(:disabled) {
  background: rgba(0, 116, 255, 0.5);
}


/* My Bet History Specifics */
.mbh-table th,
.mbh-table td {
  padding: 12px 8px;
  /* Slightly tighter padding for more columns */
  font-size: 13px;
}

.mbh-table th {
  font-size: 12px;
}

.pill {
  padding: 4px 8px;
  border-radius: 4px;
  font-weight: 700;
  text-transform: uppercase;
  font-size: 11px;
}

.pill.heads {
  color: #fff;
  background: rgba(0, 116, 255, 0.3);
  border: 1px solid rgba(0, 116, 255, 0.5);
}

.pill.tails {
  color: #fff;
  background: rgba(255, 93, 93, 0.3);
  border: 1px solid rgba(255, 93, 93, 0.5);
}

.htp-refresh {
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 4px;
  transition: opacity 0.2s;
  display: flex;
}

.htp-refresh:hover {
  opacity: 0.7;
}

.my-bets-header {
  display: block;
  background-color: rgba(0, 77, 169, 1);
  border-radius: 10px;
  font-family: 'Play', sans-serif;
  color: #ffffff;
  padding: 8px;
  text-align: center;
  font-weight: 700;
  margin: 12px 12px 8px 12px;
  font-size: 18px;
  letter-spacing: 0.05em;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.2);
}

.bet-history-container {
  background-color: rgba(0, 77, 169, 1);
  border-radius: 10px;
  padding: 4px 8px;
  margin: 0 12px 12px 12px;
  display: flex;
  gap: 12px;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.2);
}

.bet-option {
  flex: 1;
  font-family: 'Play', sans-serif;
  color: rgba(144, 194, 255, 0.6);
  background: transparent;
  border: 1px solid transparent;
  box-shadow: none;
  border-radius: 6px;
  padding: 6px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  transition: all 0.2s ease;
}

.bet-option:hover {
  color: rgba(144, 194, 255, 1);
}

.bet-option.active {
  color: rgba(144, 194, 255, 1);
  background: rgba(0, 3, 61, 0.69);
  border: 1px solid rgba(0, 116, 255, 1);
  box-shadow: 0px 0px 3.6px 1px rgba(0, 116, 255, 1) inset;
}

/* Last Round Winners (Betting Phase) */
.lrw-header {
  display: block;
  background-color: rgba(0, 77, 169, 1);
  border-radius: 10px;
  font-family: 'Play', sans-serif;
  color: #ffffff;
  padding: 8px;
  text-align: center;
  font-weight: 700;
  margin: 12px 12px 8px 12px;
  font-size: 18px;
  letter-spacing: 0.05em;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.2);
}

.lrw-container {
  flex: 1;
  overflow-y: auto;
  padding: 0 12px;
}

.lrw-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0 4px;
  /* Reduced gap between ROWS, but 0 between cols */
  font-family: 'Play', sans-serif;
}

.lrw-th {
  font-size: 14px;
  color: rgba(255, 255, 255, 1);
  font-weight: 500;
  font-family: 'Montserrat', sans-serif;
  padding: 8px 0;
  text-align: center;
  border: none !important;
}

.lrw-th:first-child {
  padding-left: 5px;
}

.lrw-th:last-child {
  padding-right: 5px;
}

.lrw-row {
  transition: background 0.2s;
}

.lrw-row td {
  background: rgba(53, 93, 174, 1);
  padding: 8px 4px;
  text-align: center;
  font-size: 13px;
  color: #fff;
  border: none !important;
  box-shadow: none !important;
  font-family: 'Phudu', sans-serif;
  font-weight: 300;
}

.lrw-row td:first-child {
  border-radius: 20px 0 0 20px;
  padding-left: 16px;
}

.lrw-row td:last-child {
  border-radius: 0 20px 20px 0;
  padding-right: 16px;
}

.lrw-winner-cell {
  display: flex;
  justify-content: center;
  align-items: center;
}

.bets-table {
  width: 100%;
  padding: 0 5px;
  border-collapse: separate;
  border-spacing: 0 8px;
  font-family: 'Poppins', sans-serif;
  font-size: 13px;
  color: #fff;
  display: block;
}

.bets-table thead {
  display: block;
  width: 100%;
  margin-bottom: 8px;
}

.bets-table tbody {
  display: block;
  width: 100%;
}

.bets-table tr {
  display: grid;
  grid-template-columns: 0.5fr 1.2fr 1fr 1fr;
  align-items: center;
  width: 100%;
}

.bets-table tbody tr {
  margin-bottom: 8px;
  border-radius: 12px;
  /* Ensure content stays inside rounded corners */
  overflow: hidden;
}

.bets-table th {
  text-align: center;
  padding: 8px 4px;
  color: #fff;
  font-family: 'Play', sans-serif;
  font-weight: 500;
  font-size: 14px;
  white-space: nowrap;
  border: none;
}

.bets-table td {
  padding: 8px 4px;
  /* Reduced horizontal padding */
  background: transparent;
  /* Transparent so tr background shows */
  border: none;
  text-align: center;
  font-weight: 400;
  color: #d6e6ff;
  font-family: 'Phudu', sans-serif;
}

/* Specific gradients for HEADS vs TAILS on the ROW */
.bets-table tr.heads {
  background: linear-gradient(90deg, rgba(182, 143, 0, 0.3) 0%, rgba(147, 115, 0, 0.3) 100%);
}

.bets-table tr.tails {
  background: linear-gradient(90deg, rgba(218, 218, 218, 0.35) 0%, rgba(137, 137, 137, 0.35) 100%);
}

/* Highlight style for the top/active row */
.bets-table tr.highlight-row {
  /* Border removed as requested */
  /* border: 1px solid #0074FF; */
  box-shadow: 0 0 10px rgba(0, 116, 255, 0.2);
  /* The border radius on the tr handles the shape matching */
}

.bets-table .empty-cell {
  grid-column: 1 / -1;
  text-align: center;
  padding: 24px;
  color: rgba(144, 194, 255, 0.6);
  /* Fallback/explicit color just in case */
  font-style: italic;
  background: transparent !important;
  /* No background for empty message row */
}

.bets-table td:nth-child(4) {
  /* Bets INR column */
  font-weight: 400;
}

/* Small screen responsive fixes to prevent horizontal overflow */
@media (max-width: 450px) {

  /* Reduce main padding to gain more horizontal space */
  .main {
    padding: 12px 12px;
  }

  /* Make top row more flexible - allow wrapping if needed */
  .top-row {
    gap: 8px;
    flex-wrap: wrap;
    max-width: 100%;
  }

  .top-row>.stock-card {
    flex: 1 1 calc(50% - 4px);
    min-width: 0;
    max-width: calc(50% - 4px);
    overflow: hidden;
  }

  /* Ensure stock card content can shrink */
  .stock-card {
    max-width: 100%;
    overflow: hidden;
  }

  .stock-num {
    overflow: hidden;
    width: 100%;
  }

  .price,
  .baseline-price {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 100%;
  }

  /* Table cards container - make bet cards fit */
  .table-cards {
    width: calc(100% - 16px);
    gap: min(3vw, 20px);
  }

  .top-row>.status-badge {
    display: none;
    /* Hide status badge on very small screens to save space */
  }

  /* Reduce stock card font sizes */
  .stock-hdr {
    font-size: 9px;
  }

  .baseline-price,
  .price {
    font-size: 11px;
  }

  /* Reduce bet card minimum sizes */
  .bet-card {
    min-width: 80px;
    min-height: 130px;
    --card-size: min(28vw, max(80px, calc(var(--table-w, 720px) * .16)));
  }

  .bet-card__hdr {
    margin: 4px;
    padding: 2px 0;
  }

  .bet-card__hdr span {
    font-size: 9px;
  }

  .bet-card__symbol {
    font-size: 10px;
  }

  /* Reduce stage table minimum */
  .stage .table {
    width: min(100%, clamp(240px, 72vh, 1200px));
  }

  /* More compact bets table grid */
  .bets-table tr {
    grid-template-columns: 0.4fr 0.9fr 0.8fr 0.9fr;
  }

  .bets-table th {
    font-size: 11px;
    padding: 6px 2px;
  }

  .bets-table td {
    font-size: 11px;
    padding: 6px 2px;
  }

  /* More compact Last Round Winners table */
  .lrw-th {
    font-size: 12px;
    padding: 6px 0;
  }

  .lrw-row td {
    font-size: 11px;
    padding: 6px 2px;
  }

  .lrw-row td:first-child {
    padding-left: 8px;
  }

  .lrw-row td:last-child {
    padding-right: 8px;
  }

  /* Ensure panels don't overflow */
  .panel {
    max-width: 100%;
    overflow-x: hidden;
  }

  .rail {
    max-width: 100%;
    overflow-x: hidden;
  }

  /* Reduce chip sizes */
  .chips .chip {
    width: 42px;
    height: 36px;
  }

  .chips {
    gap: 10px;
  }

  /* More compact bet controls */
  .bet-controls {
    gap: 8px;
  }

  .bet-row {
    gap: 10px;
    padding: 0 4px;
  }

  .chips .chip {
    font-size: 9px;
  }

  .bet-card__bot .lbl {
    font-size: 7px;
  }

  .bet-card__bot .val {
    font-size: 8px;
  }

  /* Reduce bet controls size */
  .bet-input,
  .total-bet {
    width: 140px;
    height: 40px;
    padding: 0 8px;
    font-size: 13px;
  }

  input.bet-amt {
    font-size: 14px;
  }

  .bet-input button {
    transform: scale(0.9);
  }

  .bet-input-right {
    margin-right: 5px;
    gap: 2px;
  }
}

/* Extra small screens below 380px */
@media (max-width: 380px) {
  .main {
    padding: 10px 12px;
  }

  .top-row {
    gap: 6px;
  }

  .stock-card {
    padding: 4px 5px;
  }

  .stock-hdr {
    font-size: 8px;
  }

  .baseline-price,
  .price {
    font-size: 10px;
  }

  .bet-card {
    min-width: 70px;
    min-height: 115px;
    --card-size: min(30vw, max(70px, calc(var(--table-w, 720px) * .14)));
  }

  .chips .chip {
    width: 38px;
    height: 32px;
  }

  .chips {
    gap: 8px;
  }

  .chips .chip {
    font-size: 7px;
  }

  .bet-card__bot .lbl {
    font-size: 6px;
  }

  .bet-card__bot .val {
    font-size: 7px;
  }

  /* Further reduce bet controls for tiny screens */
  .bet-input,
  .total-bet {
    width: 110px;
    height: 36px;
    padding: 0 4px;
    font-size: 11px;
  }

  input.bet-amt {
    font-size: 12px;
  }

  .bet-input button {
    transform: scale(0.8);
    width: 20px;
  }

  .bet-input-right {
    gap: 1px;
    margin-right: 5px;
  }
}