/* ── Reset ── */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family:
    system-ui,
    -apple-system,
    sans-serif;
  background: #111827;
  color: white;
  height: 100dvh;
  overflow: hidden;
}

/* ── Layout principal ── */
#app {
  display: flex;
  height: 100dvh;
  overflow: hidden;
}

/* ── Panneau de jeu (gauche) ── */
#game-panel {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 10px 12px;
  background: linear-gradient(160deg, #064e3b 0%, #065f46 60%, #047857 100%);
  overflow: hidden;
}

/* Conteneur centré du contenu de jeu */
#game-inner {
  width: 100%;
  max-width: 420px;
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* En-tête */
#header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.title {
  font-size: 22px;
  font-weight: bold;
  color: #fde68a;
}

.balance-block {
  text-align: right;
}

.balance-label {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.5);
}

.balance-value {
  font-size: 18px;
  color: #fde68a;
  font-weight: bold;
}

/* Zone croupier */
#dealer-area {
  margin-bottom: 6px;
}

.area-label {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.5);
  margin-bottom: 5px;
  text-transform: uppercase;
  letter-spacing: 1px;
  text-align: center;
}

.dealer-score {
  display: inline-block;
  font-size: 22px;
  font-weight: bold;
  color: white;
  background: rgba(0, 0, 0, 0.3);
  padding: 2px 12px;
  border-radius: 20px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  letter-spacing: 1px;
  text-transform: none;
  margin-left: 6px;
  vertical-align: middle;
}

/* Rangée de cartes */
.cards-row {
  display: flex;
  gap: 5px;
  flex-wrap: wrap;
  justify-content: center;
}

/* Séparateur tirets */
.divider {
  border: none;
  border-top: 1px dashed rgba(255, 255, 255, 0.15);
  margin: 4px 0;
}

/* Zone joueur */
#player-area {
  flex: 1;
  overflow-y: auto;
}

.player-hand {
  margin-bottom: 6px;
  padding: 6px 8px;
  border-radius: 10px;
  border: 1px solid;
}

.hand-info {
  display: flex;
  gap: 8px;
  align-items: center;
  justify-content: center;
  margin-bottom: 5px;
  flex-wrap: wrap;
}

.hand-label {
  color: rgba(255, 255, 255, 0.4);
  font-size: 11px;
}

.hand-total {
  font-weight: bold;
  font-size: 22px;
  background: rgba(0, 0, 0, 0.3);
  padding: 2px 12px;
  border-radius: 20px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  letter-spacing: 1px;
}

.badge {
  font-size: 13px;
  font-weight: bold;
  padding: 2px 10px;
  border-radius: 20px;
  background: rgba(0, 0, 0, 0.25);
}
.badge-bust {
  color: #f87171;
  border: 1px solid #f87171;
}
.badge-bj {
  color: #fde68a;
  border: 1px solid #fde68a;
}

.hand-bet {
  color: #fbbf24;
  font-size: 12px;
  font-weight: bold;
}

/* ── Indice stratégie ── */
.hint-box {
  text-align: center;
  font-size: 12px;
  padding: 5px 8px;
  background: rgba(0, 0, 0, 0.35);
  border-radius: 8px;
  margin-bottom: 8px;
  border: 1px solid rgba(251, 191, 36, 0.2);
}

.hint-box:empty {
  display: none;
}

.hint-label {
  color: rgba(255, 255, 255, 0.5);
}

.hint-value {
  color: #fde68a;
  font-weight: bold;
}

/* ── Message résultat ── */
.msg-box {
  text-align: center;
  font-size: 18px;
  font-weight: bold;
  color: #fde68a;
  margin-bottom: 10px;
  min-height: 0;
}

.msg-box:empty {
  display: none;
}

/* ── Logo au-dessus des mises ── */
.bet-logo {
  display: block;
  width: 80%;
  max-width: 320px;
  height: auto;
  opacity: 0.15;
  filter: invert(1);
  margin: 0 auto 8px;
}

/* ── Jetons de mise ── */
.bet-chips {
  display: flex;
  gap: 6px;
  justify-content: center;
  margin-bottom: 8px;
  flex-wrap: wrap;
}

.chip-btn {
  padding: 7px 12px;
  border-radius: 8px;
  border: 2px solid transparent;
  cursor: pointer;
  font-weight: bold;
  background: rgba(255, 255, 255, 0.08);
  color: white;
  font-size: 14px;
  transition: background 0.15s;
}

.chip-btn.active {
  border-color: #fbbf24;
  background: rgba(251, 191, 36, 0.2);
  color: #fde68a;
}

.chip-btn:hover:not(.active) {
  background: rgba(255, 255, 255, 0.15);
}

/* ── Boutons d'action (centre) ── */
#controls-mid {
  position: relative;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 10px 0;
  flex: 1;
  min-height: 0;
  background: rgba(0, 0, 0, 0.15);
  border-radius: 16px;
  margin: 6px 0;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.06);
  overflow: hidden;
}

/* ── Contrôles de mise ── */
#controls {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 8px 0;
}

#controls-mid .action-grid {
  width: 100%;
  max-width: 340px;
}

/* ── Bloc résultat centré ── */
.result-center {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  width: 100%;
}

.result-msg {
  font-size: 20px;
  font-weight: bold;
  color: #fde68a;
  text-align: center;
}

#controls-mid .btn-green {
  width: auto;
  padding: 10px 28px;
}

/* ── Boutons ── */
.action-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.btn {
  padding: 10px 0;
  border-radius: 8px;
  border: none;
  cursor: pointer;
  color: white;
  font-size: 14px;
  font-weight: bold;
  width: 100%;
  transition:
    filter 0.15s,
    transform 0.15s;
}

.btn:hover:not(:disabled) {
  filter: brightness(1.1);
}

.btn:active:not(:disabled),
.btn.btn-pressed {
  transform: scale(0.82);
  filter: brightness(0.75);
  transition:
    transform 0.07s,
    filter 0.07s;
}

.btn:disabled {
  background: #374151 !important;
  cursor: not-allowed;
}

.btn-green {
  background: #15803d;
}
.btn-red {
  background: #dc2626;
}
.btn-blue {
  background: #1d4ed8;
}
.btn-orange {
  background: #c2410c;
}
.btn-purple {
  background: #6d28d9;
}

/* ── Bouton Tirer ── */
.btn-hit {
  background: transparent;
  border: 3px solid #22c55e !important;
  border-radius: 50% !important;
  width: 64px !important;
  height: 64px !important;
  padding: 0 !important;
  color: #22c55e;
  font-size: 36px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto;
}

.btn-hit:hover:not(:disabled) {
  background: rgba(34, 197, 94, 0.15);
  filter: none;
}

/* ── Bouton Doubler ── */
.btn-double {
  background: transparent;
  border: 3px solid #f97316 !important;
  border-radius: 50% !important;
  width: 64px !important;
  height: 64px !important;
  padding: 0 !important;
  color: #f97316;
  font-size: 18px;
  font-weight: bold;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto;
}

.btn-double:hover:not(:disabled) {
  background: rgba(249, 115, 22, 0.15);
  filter: none;
}

.btn-double:disabled {
  border-color: #374151 !important;
  color: #374151 !important;
  background: transparent !important;
}

/* ── Bouton Séparer ── */
.btn-split {
  background: transparent;
  border: 3px solid #a855f7 !important;
  border-radius: 50% !important;
  width: 64px !important;
  height: 64px !important;
  padding: 0 !important;
  color: #a855f7;
  font-size: 20px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto;
}

.btn-split:hover:not(:disabled) {
  background: rgba(168, 85, 247, 0.15);
  filter: none;
}

.btn-split:disabled {
  border-color: #374151 !important;
  color: #374151 !important;
  background: transparent !important;
}

/* ── Bouton Rester ── */
.btn-stand {
  background: transparent;
  border: 3px solid #ef4444 !important;
  border-radius: 8px !important;
  width: 64px !important;
  height: 64px !important;
  padding: 0 !important;
  color: #ef4444;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto;
}

.btn-stand:hover:not(:disabled) {
  background: rgba(239, 68, 68, 0.15);
  filter: none;
}

.btn-icon-stop {
  display: block;
  width: 22px;
  height: 22px;
  background: #ef4444;
  border-radius: 3px;
}

/* ── Mobile ── */
@media (max-width: 600px) {
  body {
    height: auto;
    overflow-y: auto;
  }
  #app {
    flex-direction: column;
    height: auto;
    min-height: 100dvh;
  }
  #game-panel {
    width: 100%;
    flex-shrink: 0;
    height: 100dvh;
    min-height: 100dvh;
    max-height: 100dvh;
  }
  #game-inner {
    overflow: hidden;
    padding-bottom: env(safe-area-inset-bottom, 0px);
  }
}
