/* ===== Base styles (login / wallet / etc.) ===== */
html, body { height: 100%; }
body { margin:0; font-family: system-ui, -apple-system, Segoe UI, Roboto, Arial; background:#070812; color:#e6e6ff; }
a { color:#7df9ff; text-decoration:none; }
a:hover{ text-decoration: underline; }
.wrap { max-width:900px; margin:0 auto; padding:24px; }

/* ===== Blackjack Table (scoped) ===== */
body.bj{
  --cyan:#7df9ff;
  --mag:#ff00aa;
  --vio:#8a5bff;
  --text:#eaf0ff;
  --muted: rgba(234,240,255,.72);

  --y:#ffd400;
  --y2:#ffb800;

  --pad: clamp(16px, 1.8vw, 34px);
  --gap: clamp(12px, 1.2vw, 18px);
  --radius: clamp(18px, 1.4vw, 28px);

  --cardW: clamp(92px, 6.0vw, 140px);
  --cardH: clamp(132px, 8.2vw, 195px);
  --cardFont: clamp(22px, 1.6vw, 34px);

  --titleSize: clamp(28px, 2.0vw, 44px);
  --sectionTitle: clamp(16px, 1.1vw, 20px);

  --hudBoxW: clamp(110px, 10vw, 150px);

  min-height: 100vh;
  color: var(--text);
  background:
    radial-gradient(1200px 800px at 50% 25%, rgba(125,249,255,.10), transparent 60%),
    radial-gradient(900px 700px at 15% 85%, rgba(255,0,170,.09), transparent 60%),
    radial-gradient(900px 700px at 85% 85%, rgba(138,91,255,.09), transparent 60%),
    linear-gradient(180deg, #05060f 0%, #0a0c18 100%);
  background-repeat: no-repeat;
  background-size: cover;
  background-attachment: fixed;
}
body.bj, body.bj *{ box-sizing: border-box; }
body.bj a{ color: var(--cyan); }
body.bj .wrap{ max-width: 1200px; padding: var(--pad); }

/* Header */
body.bj .header{
  display:flex;
  align-items:flex-end;
  justify-content:space-between;
  gap: var(--gap);
  margin-bottom: var(--gap);
}
body.bj .title{
  display:flex; align-items:center; gap:12px;
  font-size: var(--titleSize);
  font-weight: 900;
  letter-spacing: .02em;
}

/* Pills */
body.bj .pill{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  padding:8px 14px;
  border-radius:999px;
  border:1px solid rgba(125,249,255,.25);
  background: rgba(0,0,0,.22);
  box-shadow: 0 0 16px rgba(125,249,255,.08);
  font-weight: 700;
}
body.bj .balance{
  display:flex; align-items:center; gap:12px;
  color: rgba(234,240,255,.78);
}
body.bj .balance .pill b{
  font-variant-numeric: tabular-nums;
}

/* CR pill: force same size as Balance pill */
body.bj .title .pill{
  padding: 6px 12px;
  height: 38px;                 /* FIXED */
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  font-size: 14px;              /* FIXED */
  line-height: 1;               /* FIXED */
  font-weight: 900;
  letter-spacing: .10em;
}

body.bj .title{
  line-height: 1;               /* prevents tall pill due to title line-height */
}


/* Wallet button (yellow, no dark border) */
body.bj .balance a{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  padding: 10px 16px;
  border-radius: 999px;
  color: #1b1500;
  font-weight: 900;
  letter-spacing: .08em;
  text-transform: uppercase;
  background: linear-gradient(180deg, var(--y) 0%, var(--y2) 100%);
  border: 0;
  box-shadow:
    0 10px 26px rgba(255, 212, 0, .20),
    0 0 30px rgba(255, 212, 0, .18);
}
body.bj .balance a:hover{ filter: brightness(1.06); }
body.bj .balance a:active{ transform: translateY(1px); }

/* Panel */
body.bj .panel{
  border-radius: var(--radius);
  padding: var(--pad);
  background: linear-gradient(180deg, rgba(255,255,255,.06), rgba(255,255,255,.02));
  border: 1px solid rgba(125,249,255,.25);
  box-shadow:
    0 0 0 1px rgba(255,255,255,.06) inset,
    0 0 40px rgba(125,249,255,.08),
    0 0 80px rgba(255,0,170,.04);
  position: relative;
  overflow: hidden;
}
body.bj .panel:before{
  content:"";
  position:absolute; inset:-2px;
  border-radius: calc(var(--radius) + 2px);
  padding:2px;
  background: linear-gradient(90deg, rgba(125,249,255,.45), rgba(255,0,170,.35), rgba(138,91,255,.35));
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  opacity:.55;
  pointer-events:none;
}

body.bj .section{
  padding: var(--pad);
  border: 1px solid rgba(255,255,255,.10);
  border-radius: calc(var(--radius) - 6px);
  background: rgba(0,0,0,.18);
}
body.bj .rowline{ height:1px; background: rgba(255,255,255,.10); margin: calc(var(--pad) * .8) 0; }

/* Section headers */
body.bj .h3{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap: 10px;
  margin: 0 0 calc(var(--gap) * .9);
  flex-wrap: wrap;
}
body.bj .h3 .sectionTitle{
  font-size: var(--sectionTitle);
  font-weight: 500; /* NOT bold */
  letter-spacing: .02em;
  color: rgba(234,240,255,.90);
}

/* Inner content box */
body.bj .contentbox{
  border-radius: calc(var(--radius) - 8px);
  border: 1px solid rgba(255,255,255,.12);
  background: rgba(0,0,0,.14);
  padding: var(--pad);
  overflow: hidden;
}

/* Dealer inner header (TOTAL inside inner content box) */
body.bj .innerhud{
  display:flex;
  align-items:center;
  justify-content:flex-end;
  gap: 10px;
  margin-bottom: calc(var(--gap) * .9);
}

/* HUD total box */
body.bj .hudbox,
body.bj .handtotal{
  width: var(--hudBoxW);
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 14px;
  border: 1px solid rgba(125,249,255,.25);
  background: rgba(0,0,0,.20);
  box-shadow: 0 0 18px rgba(125,249,255,.10);
}
body.bj .hudbox .label,
body.bj .handtotal .label{
  font-size: 11px;
  letter-spacing: .18em;
  color: rgba(234,240,255,.60);
}
body.bj .hudbox .value,
body.bj .handtotal .value{
  font-weight: 900;
  font-size: 26px; /* per request */
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

/* Cards row */
body.bj .cards{
  display:flex;
  gap: var(--gap);
  flex-wrap:nowrap;
  overflow-x:auto;
  padding-bottom: 4px;
}
body.bj .cards::-webkit-scrollbar{ height:6px; }
body.bj .cards::-webkit-scrollbar-thumb{ background: rgba(125,249,255,.25); border-radius: 999px; }

/* Fan layout when too many cards */
body.bj .cards.fan{ overflow: visible; gap: 0; }
body.bj .cards.fan .cardx,
body.bj .cards.fan .cardwrap{ margin-right: -26px; }
body.bj .cards.fan .cardx:last-child,
body.bj .cards.fan .cardwrap:last-child{ margin-right: 0; }

/* Anim */
@keyframes flyIn {
  from { opacity: 0; transform: translateY(10px) scale(.98); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

/* White playing cards */
body.bj .cardx{
  width: var(--cardW);
  height: var(--cardH);
  border-radius: 16px;
  background: linear-gradient(180deg, #ffffff, #f3f6ff);
  border: 1px solid rgba(180, 200, 255, .35);
  box-shadow:
    0 10px 26px rgba(0,0,0,.35),
    0 0 18px rgba(125,249,255,.08);
  display:flex;
  align-items:center;
  justify-content:center;
  font-weight: 900;
  font-size: var(--cardFont);
  letter-spacing:.02em;
  color: #0b0f18; /* black */
  animation: flyIn .18s ease-out;
  position: relative;
}
body.bj .cardx.red{ color: #d1003a; }

/* corners */
body.bj .cardx::before,
body.bj .cardx::after{
  position:absolute;
  font-size: 14px;
  font-weight: 800;
  opacity: .55;
}
body.bj .cardx::before{ content: attr(data-corner); top: 10px; left: 10px; }
body.bj .cardx::after{ content: attr(data-corner); bottom: 10px; right: 10px; transform: rotate(180deg); }

/* Flip card wrapper */
body.bj .cardwrap{
  width: var(--cardW);
  height: var(--cardH);
  perspective: 900px;
}
body.bj .cardinner{
  width:100%; height:100%;
  position: relative;
  transform-style: preserve-3d;
  transition: transform .45s cubic-bezier(.2,.8,.2,1);
}
body.bj .cardwrap.is-facedown .cardinner{ transform: rotateY(180deg); }
body.bj .cardface{ position:absolute; inset:0; backface-visibility: hidden; border-radius: 16px; }
body.bj .cardface.back{ transform: rotateY(180deg); }
body.bj .cardback{
  width: var(--cardW);
  height: var(--cardH);
  border-radius: 16px;
  border: 1px solid rgba(138,91,255,.35);
  background:
    repeating-linear-gradient(135deg, rgba(138,91,255,.18) 0 10px, rgba(0,0,0,.18) 10px 20px),
    linear-gradient(180deg, rgba(10,12,24,.95), rgba(0,0,0,.55));
  box-shadow: 0 10px 26px rgba(0,0,0,.35);
  display:flex; align-items:center; justify-content:center;
  color: rgba(125,249,255,.75);
  font-size: 34px;
  text-shadow: 0 0 14px rgba(125,249,255,.35);
}

/* Hands */
body.bj #hands{ display:flex; flex-direction:column; gap: var(--gap); }
body.bj .handbox{
  max-width: 100%;
  border-radius: calc(var(--radius) - 8px);
  border: 1px solid rgba(255,255,255,.12);
  background: rgba(0,0,0,.14);
  padding: var(--pad);
  overflow: hidden;
}
body.bj .handbox.activehand{
  border-color: rgba(255,0,170,.45);
  box-shadow: 0 0 26px rgba(255,0,170,.12);
}

/* Hand HUD */
body.bj .handhud{
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap: var(--gap);
  margin-bottom: calc(var(--gap) * .9);
  flex-wrap: wrap;
}
body.bj .handhud-left{
  min-width: 0;
  flex: 1 1 auto;
  display:flex;
  align-items:center;
  gap: 10px;
  flex-wrap: wrap;
}
body.bj .handtag{
  display:inline-flex;
  align-items:center;
  gap:12px;
  padding: 10px 12px;
  border-radius: 14px;
  border: 1px solid rgba(125,249,255,.20);
  background: rgba(0,0,0,.18);
  color: rgba(234,240,255,.88);
  font-weight: 700;
  letter-spacing: .02em;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
body.bj .handtotal{
  flex: 0 0 auto;
  max-width: 100%;
  margin-left: auto;
}

/* Bottom action bar */
body.bj .actionbar{
  margin-top: var(--gap);
  border-top: 1px solid rgba(255,255,255,.10);
  padding-top: var(--gap);
  display:grid;
  grid-template-columns: 1.1fr .9fr;
  gap: var(--gap);
  align-items:start;
}
body.bj .setup{
  display:flex;
  flex-direction:column;
  gap: calc(var(--gap) * .9);
}
body.bj .setupRow{
  display:flex;
  gap: var(--gap);
  align-items:center;
  flex-wrap:wrap;
}
body.bj .setupRow label{
  color: rgba(234,240,255,.70);
  font-size: 12px;
  letter-spacing: .20em;
  text-transform: uppercase;
  font-weight: 800;
}
body.bj input#bet{
  width: clamp(160px, 16vw, 260px);
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid rgba(255,255,255,.16);
  background: rgba(0,0,0,.35);
  color: var(--text);
  outline: none;
  font-size: 16px;
}

/* Chips + Reset button row */
body.bj .chipsRow{
  display:flex;
  align-items:center;
  gap: 12px;
  flex-wrap: wrap;
}
body.bj .chips{ display:flex; gap: 10px; flex-wrap:wrap; }

@keyframes chipPulse {
  0% { box-shadow: 0 0 14px rgba(255,0,170,.10), 0 0 10px rgba(125,249,255,.06); }
  50% { box-shadow: 0 0 30px rgba(255,0,170,.18), 0 0 18px rgba(125,249,255,.10); }
  100% { box-shadow: 0 0 14px rgba(255,0,170,.10), 0 0 10px rgba(125,249,255,.06); }
}
body.bj .chip{
  padding: 12px 16px;
  border-radius: 999px;
  border: 1px solid rgba(125,249,255,.20);
  background:
    radial-gradient(30px 18px at 30% 30%, rgba(255,255,255,.18), transparent 60%),
    rgba(0,0,0,.20);
  box-shadow: 0 0 20px rgba(125,249,255,.08);
  cursor:pointer;
  user-select:none;
  font-size: 16px;
  font-weight: 800;
  transition: transform .08s ease, border-color .12s ease, box-shadow .12s ease;
}
body.bj .chip:hover{ border-color: rgba(125,249,255,.45); }
body.bj .chip:active{ transform: translateY(1px); }
body.bj .chip.active{
  border-color: rgba(255,0,170,.60);
  animation: chipPulse 1.2s ease-in-out infinite;
}

/* Reset bet button "R" */
body.bj .resetBet{
  width: 46px;
  height: 46px;
  border-radius: 999px;
  border: 1px solid rgba(125,249,255,.25);
  background: rgba(0,0,0,.22);
  color: rgba(234,240,255,.90);
  font-weight: 900;
  font-size: 18px;
  cursor: pointer;
  box-shadow: 0 0 18px rgba(125,249,255,.06);
}
body.bj .resetBet:hover{ border-color: rgba(125,249,255,.45); }
body.bj .resetBet:active{ transform: translateY(1px); }

/* Buttons */
body.bj .actions{ display:flex; flex-direction:column; gap: calc(var(--gap) * .8); align-items:flex-end; }
body.bj .actionGrid{
  display:grid;
  grid-template-columns: repeat(2, minmax(160px, 1fr));
  gap: 12px;
  width: 100%;
}
body.bj .btn{
  padding: 14px 18px;
  border-radius: 16px;
  border: 1px solid rgba(125,249,255,.25);
  background: rgba(0,0,0,.22);
  color: var(--text);
  cursor: pointer;
  box-shadow: 0 0 18px rgba(125,249,255,.06);
  font-size: 16px;
  font-weight: 900;
}
body.bj .btn:hover{ border-color: rgba(125,249,255,.45); }
body.bj .btn:active{ transform: translateY(1px); }
body.bj .btn:disabled{ opacity:.45; cursor:not-allowed; filter: grayscale(.4); }
body.bj .btn-primary{
  border-color: rgba(255,0,170,.40);
  box-shadow: 0 0 20px rgba(255,0,170,.10);
}
body.bj .btn-primary:hover{ border-color: rgba(255,0,170,.60); }
body.bj .btn-cta{
  border-color: rgba(125,249,255,.40);
  box-shadow: 0 0 26px rgba(125,249,255,.10);
}

/* Status line */
body.bj .statusline{
  margin-top: 6px;
  color: rgba(234,240,255,.78);
  font-size: 14px;
}

/* Result emphasis */
body.bj .result{
  margin-top: 10px;
  font-weight: 900;
  font-size: 18px;
}
body.bj .result.win{ color: #21ffb3; text-shadow: 0 0 10px rgba(33,255,179,.18); }
body.bj .result.lose{ color: #ff3b5c; text-shadow: 0 0 10px rgba(255,59,92,.16); }
body.bj .result.push{ color: #ffd400; text-shadow: 0 0 10px rgba(255,212,0,.16); }

/* Mobile */
@media (max-width: 860px){
  body.bj .header{ flex-direction:column; align-items:flex-start; gap: 10px; }
  body.bj .balance{ width:100%; justify-content:space-between; }
  body.bj .actionbar{ grid-template-columns: 1fr; }
  body.bj .actions{ align-items:stretch; }
  body.bj .actionGrid{ grid-template-columns: 1fr 1fr; }
}
@media (max-width: 520px){
  body.bj{ --cardW: 84px; --cardH: 120px; --hudBoxW: 130px; }
  body.bj .actionGrid{ grid-template-columns: 1fr; }
  body.bj .hudbox, body.bj .handtotal{ padding: 8px 10px; }
}
