.bj-main {
  position: relative;
  z-index: 1;
  max-width: 1180px;
  margin: 0 auto;
  padding: clamp(20px, 5vh, 56px) 20px 80px;
}

.bj-shell {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 18px;
  overflow: hidden;
}

/* ── Header ── */
.bj-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 24px;
  border-bottom: 1px solid var(--border);
  background: var(--surface2);
}
.bj-balance { display: flex; flex-direction: column; gap: 2px; }
.bj-balance-label {
  font-size: 0.7rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.6px;
}
.bj-balance-value {
  font-size: 1.6rem;
  font-weight: 700;
  font-family: var(--mono);
  letter-spacing: -0.5px;
  transition: color 0.25s;
}
.bj-balance-value.flash-win  { color: var(--green); }
.bj-balance-value.flash-lose { color: var(--red); }
.bj-balance-value.flash-push { color: #fbbf24; }

.bj-claim {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 16px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface2);
  color: var(--muted);
  font-family: var(--sans);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.18s, color 0.18s, border-color 0.18s, box-shadow 0.18s, transform 0.12s;
}
.bj-claim:not(:disabled) {
  color: white;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  border-color: transparent;
  box-shadow: 0 4px 14px rgba(124, 109, 250, 0.3);
}
.bj-claim:not(:disabled):hover  { transform: translateY(-1px); box-shadow: 0 6px 18px rgba(124, 109, 250, 0.45); }
.bj-claim:not(:disabled):active { transform: translateY(1px); }
.bj-claim:disabled { cursor: not-allowed; opacity: 0.75; }
.bj-claim-icon { font-size: 1rem; line-height: 1; }
.bj-claim-text { font-family: var(--mono); font-size: 0.8rem; letter-spacing: 0.2px; }

/* ── Grid ── */
.bj-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  gap: 0;
}
.bj-board {
  padding: 24px;
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-width: 0;
}
.bj-controls {
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  background: var(--surface);
}

/* ── History ── */
.bj-history {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  min-height: 28px;
}
.bj-chip {
  font-family: var(--mono);
  font-size: 0.72rem;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--text);
  letter-spacing: 0.4px;
  animation: bjChipIn 0.25s ease-out;
}
.bj-chip.win  { color: var(--green); border-color: rgba(52, 211, 153, 0.4); }
.bj-chip.lose { color: var(--red);   border-color: rgba(248, 113, 113, 0.4); }
.bj-chip.push { color: #fbbf24;     border-color: rgba(251, 191, 36, 0.4); }
.bj-chip.bj   {
  color: white;
  border-color: transparent;
  background: linear-gradient(135deg, #10b981, #34d399);
}
@keyframes bjChipIn {
  from { transform: scale(0.6); opacity: 0; }
  to   { transform: scale(1);   opacity: 1; }
}

/* ── Table felt ── */
.bj-table {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 18px;
  padding: 22px 22px 26px;
  border-radius: 16px;
  background:
    radial-gradient(120% 80% at 50% 0%, rgba(124, 109, 250, 0.10), transparent 60%),
    linear-gradient(180deg, var(--surface2) 0%, var(--surface) 100%);
  border: 1px solid var(--border);
  min-height: 320px;
}
.bj-row { display: flex; flex-direction: column; gap: 10px; }
.bj-row-head {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--mono);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.7px;
  color: var(--muted);
}
.bj-row-label { font-weight: 700; }
.bj-score {
  display: inline-block;
  min-width: 38px;
  padding: 2px 10px;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  font-family: var(--mono);
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.4px;
  text-align: center;
}
.bj-score.bust { color: var(--red); border-color: rgba(248, 113, 113, 0.5); }
.bj-score.bj   { color: var(--green); border-color: rgba(52, 211, 153, 0.55); }
.bj-score.soft::after {
  content: " soft";
  font-weight: 400;
  opacity: 0.7;
  font-size: 0.85em;
}

/* ── Cards ── */
.bj-cards {
  display: flex;
  align-items: center;
  min-height: 100px;
  perspective: 900px;
}
.bj-card {
  position: relative;
  width: 70px;
  height: 100px;
  flex-shrink: 0;
  margin-left: -22px;
  user-select: none;
  font-family: var(--sans);
  filter: drop-shadow(0 6px 14px rgba(0, 0, 0, 0.45));
}
.bj-card:first-child { margin-left: 0; }

/* The inner element is the one that flips. */
.bj-card-inner {
  position: relative;
  width: 100%;
  height: 100%;
  transform-style: preserve-3d;
  transition: transform 0.5s cubic-bezier(0.2, 0.8, 0.3, 1);
}
.bj-card.face-down .bj-card-inner { transform: rotateY(180deg); }

.bj-card-front, .bj-card-back {
  position: absolute;
  inset: 0;
  border-radius: 9px;
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
}

.bj-card-front {
  background: #fafafa;
  color: #1a1a2e;
  border: 1px solid #d8d8e0;
  overflow: hidden;
}
.bj-card.red .bj-card-front { color: #c1272d; }

.bj-card-back {
  transform: rotateY(180deg);
  background:
    repeating-linear-gradient(45deg, rgba(255,255,255,0.06) 0 6px, transparent 6px 12px),
    linear-gradient(135deg, #4338ca 0%, #7c6dfa 60%, #a78bfa 100%);
  border: 1px solid rgba(255, 255, 255, 0.18);
}
.bj-card-back::after {
  content: "";
  position: absolute;
  inset: 6px;
  border-radius: 6px;
  border: 1px solid rgba(255, 255, 255, 0.25);
}

.bj-card-rank { font-size: 1.05rem; font-weight: 700; line-height: 1; }
.bj-card-suit-sm { font-size: 0.95rem; line-height: 1; }
.bj-card-corner {
  position: absolute;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
}
.bj-card-corner.top { top: 6px;    left: 8px; }
.bj-card-corner.bot { bottom: 6px; right: 8px; transform: rotate(180deg); }
.bj-card-suit-big {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.1rem;
  opacity: 0.85;
  pointer-events: none;
}

/* Slide-in from the right (only the new card animates). */
@keyframes bjSlideIn {
  0%   { transform: translateX(220px) translateY(-18px) rotate(14deg); opacity: 0; }
  60%  { transform: translateX(0)     translateY(0)     rotate(0);     opacity: 1; }
  100% { transform: translateX(0)     translateY(0)     rotate(0);     opacity: 1; }
}
.bj-card.dealing { animation: bjSlideIn 0.4s cubic-bezier(0.2, 0.8, 0.3, 1); }

/* Status text */
.bj-status {
  text-align: center;
  font-size: 0.92rem;
  color: var(--muted);
  min-height: 1.4em;
  padding: 6px 0;
}
.bj-status.win  { color: var(--green); font-weight: 600; }
.bj-status.lose { color: var(--red);   font-weight: 600; }
.bj-status.push { color: #fbbf24;     font-weight: 600; }
.bj-status.bj   {
  color: transparent;
  background: linear-gradient(135deg, #10b981, #34d399);
  -webkit-background-clip: text;
  background-clip: text;
  font-weight: 700;
  letter-spacing: 0.5px;
}

/* ── Form ── */
.bj-field { display: flex; flex-direction: column; gap: 6px; }
.bj-field-label {
  font-size: 0.72rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.6px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.bj-field-quick { display: inline-flex; gap: 4px; }
.bj-field-quick button {
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 2px 8px;
  font-size: 0.7rem;
  font-family: var(--mono);
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s, background 0.15s;
}
.bj-field-quick button:hover {
  color: var(--text);
  border-color: var(--accent);
  background: var(--surface2);
}

.bj-input-wrap {
  display: flex;
  align-items: center;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0 12px;
  transition: border-color 0.15s;
}
.bj-input-wrap:focus-within { border-color: var(--accent); }
.bj-input-wrap input {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--text);
  font-family: var(--mono);
  font-size: 1rem;
  font-weight: 600;
  padding: 10px 0;
  outline: none;
  width: 100%;
  -moz-appearance: textfield;
}
.bj-input-wrap input::-webkit-outer-spin-button,
.bj-input-wrap input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.bj-input-prefix { color: var(--muted); font-family: var(--mono); margin-right: 6px; }

/* ── Action buttons ── */
.bj-actions {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 6px;
}
.bj-action-btn {
  padding: 10px 0;
  border: 1px solid var(--border);
  background: var(--surface2);
  color: var(--text);
  font-family: var(--sans);
  font-size: 0.85rem;
  font-weight: 600;
  border-radius: 9px;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s, transform 0.12s;
}
.bj-action-btn:not(:disabled):hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--surface);
}
.bj-action-btn:not(:disabled):active { transform: translateY(1px); }
.bj-action-btn:disabled { opacity: 0.4; cursor: not-allowed; }

.bj-info {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 10px;
}
.bj-info-row {
  display: flex;
  justify-content: space-between;
  font-size: 0.78rem;
  color: var(--muted);
}
.bj-info-val { color: var(--text); font-family: var(--mono); font-weight: 600; }

.bj-deal-btn {
  margin-top: auto;
  padding: 14px;
  border: none;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  color: white;
  font-family: var(--sans);
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: 0.4px;
  cursor: pointer;
  box-shadow: 0 6px 18px rgba(124, 109, 250, 0.32);
  transition: transform 0.12s, box-shadow 0.18s, opacity 0.18s;
}
.bj-deal-btn:hover  { transform: translateY(-1px); box-shadow: 0 8px 22px rgba(124, 109, 250, 0.45); }
.bj-deal-btn:active { transform: translateY(1px); }
.bj-deal-btn:disabled { opacity: 0.55; cursor: not-allowed; transform: none; box-shadow: none; }

/* ── Responsive ── */
@media (max-width: 820px) {
  .bj-grid { grid-template-columns: 1fr; }
  .bj-board {
    border-right: none;
    border-bottom: 1px solid var(--border);
  }
}
@media (max-width: 480px) {
  .bj-card { width: 58px; height: 84px; margin-left: -18px; }
  .bj-card-rank { font-size: 0.92rem; }
  .bj-card-suit-big { font-size: 1.7rem; }
  .bj-table { padding: 16px 16px 20px; }
}
