/* ============================================
   BLACKJACK
   ============================================ */

.bj-wrap { max-width: 520px !important; }

/* ── Máquina / mesa ── */
.bj-machine {
  position: relative;
  background: linear-gradient(160deg, #0a1f0e 0%, #071209 60%, #0d1a0a 100%);
  border: 3px solid #c8a030;
  border-radius: 28px;
  padding: 0 1.5rem 2rem;
  box-shadow:
    0 0 0 6px #071209,
    0 0 0 8px rgba(200,160,48,0.3),
    0 30px 80px rgba(0,0,0,0.7),
    inset 0 0 60px rgba(0,0,0,0.4);
  overflow: hidden;
}

[data-theme="light"] .bj-machine {
  background: linear-gradient(160deg, #103a16 0%, #0a2010 60%, #102a0e 100%);
}

/* ── Topo ── */
.bj-top {
  text-align: center;
  padding: 1.2rem 0 0.8rem;
  border-bottom: 1px solid rgba(200,160,48,0.2);
  margin: 0 -1.5rem 1rem;
  padding-left: 1.5rem;
  padding-right: 1.5rem;
}

/* ── Displays ── */
.bj-displays {
  display: flex;
  gap: 0.6rem;
  margin-bottom: 1rem;
}

.bj-display-box {
  flex: 1;
  background: #000;
  border: 2px solid #222;
  border-radius: 8px;
  padding: 0.5rem 0.4rem;
  text-align: center;
  box-shadow: inset 0 2px 8px rgba(0,0,0,0.8);
}

.bj-display-bet { border-color: rgba(200,160,48,0.4); }

.bj-display-label {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.5rem;
  letter-spacing: 0.15em;
  color: #555;
  text-transform: uppercase;
  margin-bottom: 0.2rem;
}

.bj-display-val {
  font-family: 'Bebas Neue', cursive;
  font-size: 1.6rem;
  letter-spacing: 0.05em;
  color: #c8a030;
  text-shadow: 0 0 10px rgba(200,160,48,0.5);
  line-height: 1;
}

/* ── Mesa de jogo ── */
.bj-table {
  background: rgba(0,0,0,0.35);
  border: 1px solid rgba(200,160,48,0.2);
  border-radius: 18px;
  overflow: hidden;
  margin-bottom: 1rem;
}

/* Área do dealer */
.bj-dealer-area {
  padding: 1rem 1rem 0.8rem;
  border-bottom: 2px dashed rgba(200,160,48,0.2);
  background: rgba(0,0,0,0.15);
}

/* Área do jogador */
.bj-player-area {
  padding: 0.8rem 1rem 1rem;
}

.bj-area-label {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.55rem;
  letter-spacing: 0.25em;
  color: rgba(200,160,48,0.5);
  text-transform: uppercase;
  margin-bottom: 0.6rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.bj-hand-score {
  font-family: 'Bebas Neue', cursive;
  font-size: 1.1rem;
  letter-spacing: 0.05em;
  color: #c8a030;
}

.bj-hand-score.bj-bust { color: #e03e3e; }
.bj-hand-score.bj-blackjack-score { color: #f5c518; }

/* Linha de cartas */
.bj-hand {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  min-height: 100px;
  align-items: flex-start;
}

/* ── Carta ── */
.bj-card {
  width: 68px;
  height: 98px;
  border-radius: 8px;
  background: #fffef5;
  border: 1.5px solid #ddd;
  box-shadow:
    0 3px 12px rgba(0,0,0,0.5),
    inset 0 1px 0 rgba(255,255,255,0.9);
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  animation: cardDeal 0.28s cubic-bezier(0.34, 1.3, 0.64, 1) both;
  transform-origin: bottom center;
  user-select: none;
}

@keyframes cardDeal {
  from {
    opacity: 0;
    transform: translateY(-40px) rotate(-8deg) scale(0.7);
  }
  to {
    opacity: 1;
    transform: translateY(0) rotate(0deg) scale(1);
  }
}

/* Canto superior esquerdo */
.bj-card-corner-tl {
  position: absolute;
  top: 5px;
  left: 5px;
  display: flex;
  flex-direction: column;
  align-items: center;
  line-height: 1;
}

/* Canto inferior direito (rotacionado) */
.bj-card-corner-br {
  position: absolute;
  bottom: 5px;
  right: 5px;
  display: flex;
  flex-direction: column;
  align-items: center;
  line-height: 1;
  transform: rotate(180deg);
}

.bj-card-val {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.72rem;
  font-weight: 700;
  line-height: 1;
}

.bj-card-suit-corner {
  font-size: 0.6rem;
  line-height: 1;
}

/* Naipe central grande */
.bj-card-center {
  font-size: 2rem;
  line-height: 1;
  pointer-events: none;
}

/* Cores dos naipes */
.bj-card.bj-red .bj-card-val,
.bj-card.bj-red .bj-card-suit-corner,
.bj-card.bj-red .bj-card-center {
  color: #c8202a;
}

.bj-card.bj-dark .bj-card-val,
.bj-card.bj-dark .bj-card-suit-corner,
.bj-card.bj-dark .bj-card-center {
  color: #1a1a1a;
}

/* Carta virada (face-down) */
.bj-card.bj-facedown {
  background: linear-gradient(145deg, #1a2e6e 0%, #0d1a48 50%, #1a2e6e 100%);
  border: 1.5px solid #2a3e80;
  box-shadow:
    0 3px 12px rgba(0,0,0,0.6),
    inset 0 0 0 4px rgba(30,60,140,0.5);
}

.bj-card.bj-facedown::before {
  content: '';
  position: absolute;
  inset: 6px;
  border: 1.5px solid rgba(100,140,255,0.3);
  border-radius: 4px;
  background: repeating-linear-gradient(
    45deg,
    transparent,
    transparent 4px,
    rgba(50,80,200,0.12) 4px,
    rgba(50,80,200,0.12) 8px
  );
}

.bj-card.bj-facedown .bj-card-val,
.bj-card.bj-facedown .bj-card-suit-corner,
.bj-card.bj-facedown .bj-card-center {
  display: none;
}

/* ── Fichas ── */
.bj-chips {
  display: flex;
  gap: 0.5rem;
  justify-content: center;
  flex-wrap: wrap;
  margin-bottom: 0.8rem;
}

.bj-chip {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  border: 3px solid rgba(255,255,255,0.25);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Bebas Neue', cursive;
  font-size: 0.85rem;
  letter-spacing: 0.05em;
  color: #fff;
  cursor: pointer;
  transition: all 0.18s cubic-bezier(0.34, 1.56, 0.64, 1);
  position: relative;
  box-shadow:
    0 4px 12px rgba(0,0,0,0.4),
    inset 0 2px 0 rgba(255,255,255,0.25),
    inset 0 -2px 0 rgba(0,0,0,0.25);
  user-select: none;
}

.bj-chip:hover:not(:disabled) {
  transform: translateY(-4px) scale(1.1);
  box-shadow: 0 8px 20px rgba(0,0,0,0.5), inset 0 2px 0 rgba(255,255,255,0.3);
}

.bj-chip:active:not(:disabled) { transform: translateY(0) scale(0.96); }

.bj-chip:disabled {
  opacity: 0.35;
  cursor: not-allowed;
  transform: none;
}

/* Notches decorativos nas fichas */
.bj-chip::before {
  content: '';
  position: absolute;
  inset: 5px;
  border-radius: 50%;
  border: 2px dashed rgba(255,255,255,0.2);
}

.bj-chip-10  { background: radial-gradient(circle at 35% 35%, #4a8cff, #1a3a99); border-color: rgba(100,160,255,0.5); }
.bj-chip-25  { background: radial-gradient(circle at 35% 35%, #3dc870, #1a6a38); border-color: rgba(80,220,120,0.5); }
.bj-chip-50  { background: radial-gradient(circle at 35% 35%, #e03e3e, #7a1818); border-color: rgba(240,80,80,0.5); }
.bj-chip-100 { background: radial-gradient(circle at 35% 35%, #e8a020, #7a4800); border-color: rgba(240,180,40,0.5); }

/* ── Mensagem ── */
.bj-msg {
  min-height: 36px;
  text-align: center;
  font-family: 'Bebas Neue', cursive;
  font-size: 1.3rem;
  letter-spacing: 0.12em;
  color: transparent;
  margin-bottom: 0.8rem;
  transition: all 0.3s;
  opacity: 0;
}

.bj-msg-visible {
  opacity: 1;
  animation: msgPop 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes msgPop {
  from { transform: scale(0.8); opacity: 0; }
  to   { transform: scale(1);   opacity: 1; }
}

.bj-msg-win       { color: #f5c518; }
.bj-msg-blackjack { color: #f5c518; text-shadow: 0 0 30px rgba(245,197,24,0.9); animation: bjPulse 0.5s infinite alternate, msgPop 0.4s cubic-bezier(0.34,1.56,0.64,1); }
.bj-msg-push      { color: #60a5fa; }
.bj-msg-lose      { color: #888; }
.bj-msg-warn      { color: #e03e3e; }

@keyframes bjPulse {
  from { transform: scale(1); }
  to   { transform: scale(1.05); }
}

/* ── Controles ── */
.bj-controls {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  margin-bottom: 0.8rem;
}

.bj-btn {
  flex: 1;
  padding: 0.9rem 0.5rem;
  border: none;
  border-radius: 12px;
  font-family: 'Bebas Neue', cursive;
  font-size: 1.1rem;
  letter-spacing: 0.15em;
  cursor: pointer;
  transition: all 0.18s;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.1rem;
}

.bj-btn-sub {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.5rem;
  letter-spacing: 0.1em;
  opacity: 0.7;
}

.bj-btn:hover:not(:disabled) { transform: translateY(-2px); }
.bj-btn:active:not(:disabled) { transform: translateY(0); }
.bj-btn:disabled { opacity: 0.3; cursor: not-allowed; transform: none; }

.bj-btn-hit {
  background: linear-gradient(135deg, #2a7a30, #3da845);
  color: #fff;
  box-shadow: 0 4px 16px rgba(45,168,60,0.4);
}
.bj-btn-hit:hover:not(:disabled) { box-shadow: 0 8px 24px rgba(45,168,60,0.55); }

.bj-btn-stand {
  background: linear-gradient(135deg, #7a2020, #c03030);
  color: #fff;
  box-shadow: 0 4px 16px rgba(192,48,48,0.4);
}
.bj-btn-stand:hover:not(:disabled) { box-shadow: 0 8px 24px rgba(192,48,48,0.55); }

.bj-btn-double {
  background: linear-gradient(135deg, #7a5810, #c8a030);
  color: #fff;
  box-shadow: 0 4px 16px rgba(200,160,48,0.4);
  font-size: 0.9rem;
}
.bj-btn-double:hover:not(:disabled) { box-shadow: 0 8px 24px rgba(200,160,48,0.55); }

.bj-btn-deal {
  flex: 2;
  padding: 1rem;
  background: linear-gradient(135deg, #a08020, #c8a030, #a08020);
  color: #0a0a0f;
  font-size: 1.4rem;
  box-shadow: 0 4px 20px rgba(200,160,48,0.4), inset 0 1px 0 rgba(255,255,255,0.3);
}
.bj-btn-deal:hover:not(:disabled) { box-shadow: 0 8px 30px rgba(200,160,48,0.6); }

.bj-btn-new {
  flex: 1;
  padding: 0.9rem 0.5rem;
  background: rgba(255,255,255,0.07);
  border: 1px solid rgba(255,255,255,0.12);
  color: rgba(255,255,255,0.7);
  font-size: 0.95rem;
}
.bj-btn-new:hover:not(:disabled) {
  background: rgba(200,160,48,0.12);
  border-color: rgba(200,160,48,0.4);
  color: #c8a030;
}

/* Linha de crédito (clear bet) */
.bj-bet-row {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  margin-bottom: 0.8rem;
}

.bj-clear-btn {
  padding: 0.55rem 1.2rem;
  background: transparent;
  border: 1px solid rgba(200,160,48,0.3);
  border-radius: 8px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.65rem;
  letter-spacing: 0.1em;
  color: rgba(200,160,48,0.7);
  cursor: pointer;
  transition: all 0.2s;
  text-transform: uppercase;
}
.bj-clear-btn:hover:not(:disabled) {
  border-color: #c8a030;
  color: #c8a030;
}
.bj-clear-btn:disabled { opacity: 0.3; cursor: not-allowed; }

.bj-bet-hint {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.58rem;
  letter-spacing: 0.1em;
  color: rgba(200,160,48,0.5);
  flex: 1;
  text-align: right;
}

/* ── Regras ── */
.bj-rules {
  margin-top: 0.5rem;
  background: rgba(0,0,0,0.3);
  border: 1px solid rgba(200,160,48,0.12);
  border-radius: 10px;
  padding: 0.7rem 1rem;
  display: flex;
  justify-content: center;
  gap: 1.2rem;
  flex-wrap: wrap;
}

.bj-rule-item {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.58rem;
  letter-spacing: 0.08em;
  color: rgba(200,160,48,0.55);
  text-transform: uppercase;
}

/* ── Responsividade ── */
@media (max-width: 540px) {
  .bj-wrap { padding-left: 0.75rem !important; padding-right: 0.75rem !important; }

  .bj-machine {
    border-radius: 20px;
    padding: 0 1rem 1.5rem;
    border-width: 2px;
    box-shadow:
      0 0 0 4px #071209,
      0 0 0 6px rgba(200,160,48,0.3),
      0 16px 40px rgba(0,0,0,0.7);
  }

  .bj-top { margin: 0 -1rem 0.8rem; padding: 0.8rem 1rem; }

  .bj-displays { gap: 0.4rem; margin-bottom: 0.8rem; }
  .bj-display-box { padding: 0.4rem 0.3rem; border-radius: 6px; }
  .bj-display-label { font-size: 0.45rem; }
  .bj-display-val   { font-size: 1.3rem; }

  .bj-card { width: 56px; height: 82px; }
  .bj-card-val { font-size: 0.62rem; }
  .bj-card-suit-corner { font-size: 0.52rem; }
  .bj-card-center { font-size: 1.6rem; }

  .bj-hand { min-height: 82px; gap: 0.4rem; }
  .bj-area-label { font-size: 0.5rem; }

  .bj-chip { width: 46px; height: 46px; font-size: 0.75rem; }

  .bj-msg { font-size: 1rem; min-height: 28px; margin-bottom: 0.6rem; }

  .bj-controls { gap: 0.4rem; margin-bottom: 0.6rem; }
  .bj-btn { padding: 0.75rem 0.35rem; font-size: 0.95rem; border-radius: 10px; }
  .bj-btn-deal { font-size: 1.2rem; padding: 0.85rem; }

  .bj-rules { gap: 0.8rem; padding: 0.55rem 0.8rem; }
  .bj-rule-item { font-size: 0.52rem; }
}

@media (max-width: 390px) {
  .bj-machine { border-radius: 16px; padding: 0 0.7rem 1.2rem; }
  .bj-top { margin: 0 -0.7rem 0.7rem; padding: 0.7rem; }

  .bj-display-val { font-size: 1.1rem; }
  .bj-display-label { font-size: 0.4rem; }

  .bj-card { width: 48px; height: 70px; }
  .bj-card-val { font-size: 0.56rem; }
  .bj-card-center { font-size: 1.3rem; }
  .bj-hand { min-height: 70px; gap: 0.3rem; }

  .bj-chip { width: 40px; height: 40px; font-size: 0.68rem; }
  .bj-chip::before { inset: 4px; }

  .bj-btn { font-size: 0.85rem; padding: 0.65rem 0.25rem; }
  .bj-btn-double { font-size: 0.75rem; }
  .bj-btn-sub { font-size: 0.42rem; }

  .bj-rules { display: none; }
}

@media (max-width: 320px) {
  .bj-display-val { font-size: 1rem; }
  .bj-card { width: 42px; height: 62px; }
  .bj-card-center { font-size: 1.1rem; }
  .bj-chip { width: 36px; height: 36px; font-size: 0.6rem; }
  .bj-controls { flex-wrap: wrap; }
  .bj-btn { min-width: 45%; }
}
