/* =========================================================
   Composants : jetons, boutons, bannière, aide, toasts
   ========================================================= */

.app { --chip: 42px; }

/* ---------- Jetons de mise ---------- */

.chips {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

.chip {
  --chip-base: #b7372f;
  --chip-edge: #f8f1e4;
  position: relative;
  width: var(--chip);
  height: var(--chip);
  border-radius: 50%;
  display: grid;
  place-items: center;
  background:
    radial-gradient(circle at 50% 30%, rgba(255, 255, 255, .5), transparent 46%),
    repeating-conic-gradient(from 6deg, var(--chip-edge) 0 12deg, var(--chip-base) 12deg 30deg);
  box-shadow:
    0 2px 0 rgba(255, 255, 255, .18) inset,
    0 -3px 8px rgba(0, 0, 0, .34) inset,
    0 6px 14px rgba(0, 0, 0, .34);
  transition: transform .16s var(--ease), box-shadow .2s var(--ease), opacity .2s;
  flex: none;
}

.chip::before {
  content: "";
  position: absolute;
  inset: 18%;
  border-radius: 50%;
  background: var(--chip-base);
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, .35) inset,
    0 2px 6px rgba(0, 0, 0, .3) inset;
}

.chip i {
  position: relative;
  z-index: 1;
  font-style: normal;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .01em;
  color: #fff;
  font-variant-numeric: tabular-nums;
  text-shadow: 0 1px 2px rgba(0, 0, 0, .45);
}

.chip--5 { --chip-base: #b7372f; }
.chip--25 { --chip-base: #1d7a4c; }
.chip--100 { --chip-base: #222a30; }
.chip--500 { --chip-base: #5d3a92; }

.chip:hover { transform: translateY(-3px); box-shadow: 0 2px 0 rgba(255, 255, 255, .22) inset, 0 -3px 8px rgba(0, 0, 0, .34) inset, 0 12px 20px rgba(0, 0, 0, .4); }
.chip:active { transform: translateY(0) scale(.93); }
.chip:disabled { opacity: .32; pointer-events: none; }

.chip.is-dropping { animation: chipDrop .34s cubic-bezier(.2, 1.5, .4, 1); }

@keyframes chipDrop {
  0% { transform: translateY(-16px) scale(.9); }
  70% { transform: translateY(2px) scale(1.03); }
  100% { transform: translateY(0) scale(1); }
}

.bet__stack .chip { --chip: 30px; pointer-events: none; }
.bet__stack .chip i { font-size: 9px; }

/* ---------- Boutons ---------- */

.btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  height: 50px;
  min-width: 84px;
  padding: 0 20px;
  border-radius: var(--r-pill);
  font-size: 12px;
  font-weight: 750;
  letter-spacing: .13em;
  color: var(--cream);
  background: linear-gradient(180deg, rgba(255, 255, 255, .1), rgba(255, 255, 255, .02));
  border: 1px solid var(--line);
  box-shadow: 0 1px 0 rgba(255, 255, 255, .08) inset, 0 8px 20px rgba(0, 0, 0, .24);
  transition: transform .12s var(--ease), box-shadow .2s var(--ease), border-color .2s, background .2s, opacity .2s;
  white-space: nowrap;
  overflow: hidden;
  flex: 0 1 auto;
  min-width: 0;
}

.btn:hover { border-color: rgba(233, 200, 133, .42); background: linear-gradient(180deg, rgba(255, 255, 255, .14), rgba(255, 255, 255, .04)); }
.btn:active { transform: translateY(1px) scale(.982); }

.btn--deal {
  color: #241a08;
  border-color: rgba(255, 255, 255, .4);
  background: linear-gradient(180deg, #f9ecca 0%, #e0bb82 52%, #be944d 100%);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, .75) inset,
    0 -2px 0 rgba(120, 82, 26, .28) inset,
    0 10px 26px rgba(200, 160, 88, .24);
  min-width: 132px;
  font-size: 12.5px;
}

.btn--deal::after {
  content: "";
  position: absolute;
  top: 0;
  left: -40%;
  width: 30%;
  height: 100%;
  background: linear-gradient(100deg, transparent, rgba(255, 255, 255, .55), transparent);
  transform: skewX(-18deg);
  animation: sheen 4.6s ease-in-out infinite;
  pointer-events: none;
}

@keyframes sheen {
  0%, 62% { left: -40%; }
  86%, 100% { left: 130%; }
}

.btn--deal:hover {
  background: linear-gradient(180deg, #fff5dc 0%, #e8c68d 52%, #c79c54 100%);
}

.btn--stand {
  border-color: rgba(233, 200, 133, .38);
  color: var(--gold-hi);
}

.btn--split {
  color: #cfe4d9;
}

.btn--yes {
  color: #06251b;
  background: linear-gradient(180deg, #8ff3c8, #3ecf95);
  border-color: rgba(255, 255, 255, .4);
  box-shadow: 0 1px 0 rgba(255, 255, 255, .55) inset, 0 8px 20px rgba(62, 207, 149, .22);
}

.btn--no {
  color: var(--cream-dim);
}

.btn:disabled { opacity: .34; pointer-events: none; }

.btn__amount {
  display: inline-block;
  padding: 2px 6px;
  border-radius: 6px;
  font-size: 10px;
  letter-spacing: .02em;
  background: rgba(0, 0, 0, .22);
  font-variant-numeric: tabular-nums;
}

/* ---------- Bannière de résultat ---------- */

.banner {
  position: relative;
  z-index: 3;
  grid-row: 2;
  height: 46px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  pointer-events: none;
}

.banner__word,
.banner__amount {
  display: block;
  opacity: 0;
  font-variant-numeric: tabular-nums;
  will-change: transform, opacity;
}

.banner__word {
  font-family: var(--font-card);
  font-weight: 700;
  font-size: clamp(17px, 2.6vh + 8px, 27px);
  letter-spacing: .2em;
  color: var(--gold-hi);
  text-shadow: 0 2px 24px rgba(233, 200, 133, .35), 0 1px 2px rgba(0, 0, 0, .5);
  padding-left: .2em;
}

.banner[data-tone="win"] .banner__word,
.banner[data-tone="blackjack"] .banner__word {
  color: #b8ffe0;
  text-shadow: 0 2px 26px rgba(86, 226, 168, .5), 0 1px 2px rgba(0, 0, 0, .5);
}

.banner[data-tone="lose"] .banner__word,
.banner[data-tone="bust"] .banner__word {
  color: #ffc0b9;
  text-shadow: 0 2px 26px rgba(239, 107, 98, .42), 0 1px 2px rgba(0, 0, 0, .5);
}

.banner[data-tone="push"] .banner__word { color: #dbe7f3; }

.banner__amount {
  padding: 4px 10px;
  border-radius: var(--r-pill);
  font-size: 12px;
  font-weight: 750;
  letter-spacing: .06em;
  background: rgba(4, 20, 14, .6);
  border: 1px solid var(--line);
  color: var(--gold);
  backdrop-filter: blur(6px);
}

.banner[data-tone="win"] .banner__amount,
.banner[data-tone="blackjack"] .banner__amount { color: #9bffd0; border-color: rgba(86, 226, 168, .45); }
.banner[data-tone="lose"] .banner__amount,
.banner[data-tone="bust"] .banner__amount { color: #ffb3ab; border-color: rgba(239, 107, 98, .4); }

/* ---------- Toast ---------- */

.toast {
  position: absolute;
  top: calc(var(--topbar-h) + 6px);
  left: 50%;
  transform: translate(-50%, -8px);
  z-index: 50;
  padding: 7px 15px;
  border-radius: var(--r-pill);
  font-size: 11px;
  font-weight: 750;
  letter-spacing: .14em;
  color: var(--gold-hi);
  background: rgba(4, 20, 14, .82);
  border: 1px solid var(--line);
  backdrop-filter: blur(8px);
  opacity: 0;
  pointer-events: none;
  transition: opacity .25s var(--ease), transform .25s var(--ease);
  white-space: nowrap;
}

.toast.is-visible { opacity: 1; transform: translate(-50%, 0); }

/* ---------- Jetons volants ---------- */

.fly-chip {
  --c: #b7372f;
  position: fixed;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background:
    radial-gradient(circle at 50% 30%, rgba(255, 255, 255, .6), transparent 48%),
    repeating-conic-gradient(from 0deg, #f8f1e4 0 20deg, var(--c) 20deg 45deg);
  box-shadow: 0 2px 6px rgba(0, 0, 0, .45), 0 0 0 1px rgba(0, 0, 0, .18) inset;
  transform: translate(-50%, -50%);
  will-change: transform, opacity;
}

/* ---------- Aide ---------- */

.help {
  position: absolute;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(2, 12, 9, .68);
  backdrop-filter: blur(10px);
  animation: fadeIn .22s var(--ease);
}

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.help__card {
  width: min(360px, 100%);
  max-height: 100%;
  overflow: auto;
  padding: 22px 22px 18px;
  border-radius: 22px;
  background: linear-gradient(165deg, rgba(20, 55, 43, .96), rgba(5, 23, 17, .98));
  border: 1px solid var(--line);
  box-shadow: var(--shadow-ui), 0 1px 0 rgba(255, 255, 255, .08) inset;
  animation: popIn .28s var(--ease-out);
}

@keyframes popIn {
  from { opacity: 0; transform: translateY(10px) scale(.96); }
  to { opacity: 1; transform: none; }
}

.help__title {
  font-family: var(--font-card);
  font-size: 15px;
  font-weight: 700;
  letter-spacing: .3em;
  color: var(--gold);
  text-align: center;
  margin-bottom: 14px;
  padding-left: .3em;
}

.help__list { display: grid; gap: 8px; margin-bottom: 16px; }

.help__list li {
  position: relative;
  padding-left: 16px;
  font-size: 13px;
  color: var(--cream-dim);
  line-height: 1.4;
}

.help__list li::before {
  content: "";
  position: absolute;
  left: 2px;
  top: .5em;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--gold-deep);
}

.help__list b { color: var(--cream); font-weight: 650; }

.help__keys {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 10px;
  padding-top: 12px;
  border-top: 1px solid var(--line-soft);
  margin-bottom: 16px;
  font-size: 11px;
  color: var(--cream-faint);
}

.help__keys kbd {
  display: inline-block;
  min-width: 18px;
  padding: 1px 5px;
  margin-right: 4px;
  border-radius: 5px;
  border: 1px solid rgba(255, 255, 255, .18);
  background: rgba(255, 255, 255, .07);
  font-family: var(--font-ui);
  font-size: 10px;
  color: var(--cream-dim);
  text-align: center;
}

.help .btn { width: 100%; }

/* ---------- Adaptations ---------- */

.app[data-size="xs"] .btn,
.app[data-size="sm"] .btn { height: 44px; padding: 0 16px; font-size: 11.5px; letter-spacing: .1em; }

.app[data-size="xs"] .btn { height: 40px; padding: 0 13px; font-size: 11px; letter-spacing: .07em; }
.app[data-size="xs"] .btn--deal { min-width: 104px; }
.app[data-size="xs"] .chips { gap: 8px; }
.app[data-size="xs"] .chip { --chip: 34px; }
.app[data-size="xs"] .chip i { font-size: 9.5px; }
.app[data-size="xs"] .banner { height: 32px; }
.app[data-size="xs"] .banner__word { font-size: 16px; letter-spacing: .14em; }
.app[data-size="xs"] .banner__amount { font-size: 10px; padding: 3px 8px; }

/* Cadres très courts : on récupère de la place pour les cartes */
.app[data-size="xs"] .hand { padding: 3px 1px; gap: 2px; }
.app[data-size="xs"] .hand__foot { min-height: 16px; gap: 4px; }
.app[data-size="xs"] .total { height: 18px; padding: 0 6px; font-size: 10.5px; }
.app[data-size="xs"] .hand__badge { height: 18px; padding: 0 6px; font-size: 9.5px; }
.app[data-size="xs"] .hand__bet { font-size: 9px; }
.app[data-size="xs"] .hand__bet::before { width: 6px; height: 6px; }

.app[data-narrow="1"] .btn { padding: 0 12px; letter-spacing: .06em; }
.app[data-narrow="1"] .console__bar--actions { gap: 6px; }
.app[data-narrow="1"] .btn--deal { flex: 1 1 100%; }

.app[data-busy="1"] .console { opacity: .82; }

/* ---------- Compléments ---------- */

.total.is-bust {
  color: #ffb3ab;
  border-color: rgba(239, 107, 98, .45);
}

.total.is-bj {
  color: #241a08;
  background: linear-gradient(180deg, #f9ecca, #d9b273);
  border-color: rgba(255, 255, 255, .45);
  box-shadow: 0 4px 14px rgba(233, 200, 133, .28);
}

.hand__bet {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .04em;
  color: var(--cream-faint);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.hand__bet::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #fff3d3, #d8ab5f 62%, #9a7132);
  box-shadow: 0 0 0 1px rgba(0, 0, 0, .25);
  flex: none;
}

.hand.is-dim .hand__bet { opacity: .6; }

.app[data-bare="1"] .brand,
.app[data-bare="1"] .tools { display: none; }

/* Invitation discrète : choisissez une mise */
.app[data-hint="bet"] .chips { animation: hintPulse 1.7s ease-in-out infinite; }

@keyframes hintPulse {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-3px); }
}

/* Plusieurs mains : on libère de la place dans le pied de main */
.app[data-hands="3"] .hand__bet,
.app[data-hands="4"] .hand__bet { display: none; }

.app[data-hands="3"] .total,
.app[data-hands="4"] .total { padding: 0 6px; font-size: 11px; }

.app[data-hands="3"] .hand__badge,
.app[data-hands="4"] .hand__badge { padding: 0 6px; font-size: 10px; }
