/* ============================================================
   BLACKJACK STRATEGY TRAINER - STYLES SPÉCIFIQUES & ANIMATIONS
   Optimisé iPhone & Mac avec Tiroir Latéral & Jetons Casino
   ============================================================ */

:root {
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
  --safe-right: env(safe-area-inset-right, 0px);
}

html, body {
  height: 100%;
  height: 100dvh;
  margin: 0;
  padding: 0;
  overflow: hidden;
  touch-action: manipulation;
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

/* Espacements sûrs pour encoche iPhone et barre d'accueil */
.safe-padding-top {
  padding-top: 12px !important;
}

@media (max-width: 768px) {
  .safe-padding-top {
    /* Forcer au moins 54px sur iPhone pour être sous la Dynamic Island et l'horloge 11:54 */
    padding-top: max(54px, calc(env(safe-area-inset-top, 0px) + 14px)) !important;
  }
}

.safe-padding-bottom {
  padding-bottom: calc(env(safe-area-inset-bottom, 0px) + 14px) !important;
}

.safe-padding-x {
  padding-left: calc(env(safe-area-inset-left, 0px) + 12px) !important;
  padding-right: calc(env(safe-area-inset-right, 0px) + 12px) !important;
}

/* Feutre Vert Casino */
.casino-felt {
  background: radial-gradient(ellipse at 50% 30%, #064e3b 0%, #022c22 65%, #011812 100%);
  box-shadow: inset 0 0 90px rgba(0, 0, 0, 0.75);
}

/* Cartes à Jouer Aérées & Nettes */
.playing-card {
  width: 70px;
  height: 102px;
  border-radius: 7px;
  background: #ffffff;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4), 0 1px 3px rgba(0, 0, 0, 0.2);
  transition: transform 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275), box-shadow 0.2s ease;
  user-select: none;
  position: relative;
  overflow: hidden;
  flex-shrink: 0;
}

@media (min-width: 640px) {
  .playing-card {
    width: 96px;
    height: 138px;
    border-radius: 9px;
  }
}

@media (hover: hover) and (pointer: fine) {
  .playing-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.45);
  }
}

/* Animation de distribution 1 à 1 */
@keyframes dealSlide {
  0% {
    opacity: 0;
    transform: translateY(-50px) scale(0.65) rotate(-8deg);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1) rotate(0deg);
  }
}

.card-dealt {
  animation: dealSlide 0.26s cubic-bezier(0.2, 0.8, 0.2, 1) forwards;
}

/* Dos de carte élégant */
.card-back {
  background: repeating-linear-gradient(
    45deg,
    #991b1b,
    #991b1b 6px,
    #7f1d1d 6px,
    #7f1d1d 12px
  );
  border: 3px solid #ffffff;
  box-shadow: inset 0 0 10px rgba(0, 0, 0, 0.6);
}

/* Jetons de Casino Réalistes */
.casino-chip {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 900;
  font-size: 11px;
  position: relative;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.4), inset 0 2px 2px rgba(255, 255, 255, 0.3);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  border: 3px dashed rgba(255, 255, 255, 0.6);
  flex-shrink: 0;
  cursor: pointer;
}

@media (min-width: 640px) {
  .casino-chip {
    width: 50px;
    height: 50px;
    font-size: 13px;
  }
}

.casino-chip:active {
  transform: scale(0.92);
}

.chip-10 {
  background: radial-gradient(circle, #2563eb 0%, #1d4ed8 100%);
  color: #ffffff;
}

.chip-25 {
  background: radial-gradient(circle, #059669 0%, #047857 100%);
  color: #ffffff;
}

.chip-50 {
  background: radial-gradient(circle, #dc2626 0%, #b91c1c 100%);
  color: #ffffff;
}

.chip-100 {
  background: radial-gradient(circle, #312e81 0%, #1e1b4b 100%);
  color: #fcd34d;
  border-color: rgba(251, 191, 36, 0.7);
}

.chip-selected {
  outline: 3px solid #fbbf24;
  outline-offset: 2px;
  transform: translateY(-2px);
  box-shadow: 0 6px 14px rgba(251, 191, 36, 0.5);
}

/* Cercle de Mise sur le Feutre */
.betting-spot {
  border: 2px dashed rgba(251, 191, 36, 0.4);
  border-radius: 9999px;
  background: rgba(0, 0, 0, 0.25);
  box-shadow: inset 0 0 15px rgba(0, 0, 0, 0.4);
}

/* Tiroir Latéral (Slide Drawer) */
.drawer-backdrop {
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(4px);
  transition: opacity 0.3s ease;
}

.drawer-panel {
  transform: translateX(100%);
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.drawer-panel.open {
  transform: translateX(0);
}

/* Feedback Animations */
@keyframes pulseError {
  0%, 100% {
    box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.7);
  }
  50% {
    box-shadow: 0 0 0 10px rgba(239, 68, 68, 0);
  }
}

.banner-error {
  animation: pulseError 1.4s infinite;
}

@keyframes pulseSuccess {
  0%, 100% {
    box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.6);
  }
  50% {
    box-shadow: 0 0 0 8px rgba(16, 185, 129, 0);
  }
}

.banner-success {
  animation: pulseSuccess 1.4s infinite;
}

/* Cellule de Stratégie Active */
@keyframes highlightCell {
  0%, 100% {
    transform: scale(1.15);
    box-shadow: 0 0 14px #f59e0b, inset 0 0 5px #f59e0b;
    z-index: 30;
  }
  50% {
    transform: scale(1.22);
    box-shadow: 0 0 20px #fbbf24, inset 0 0 8px #fbbf24;
    z-index: 30;
  }
}

.matrix-active-cell {
  position: relative;
  outline: 2.5px solid #fbbf24 !important;
  font-weight: 900 !important;
  animation: highlightCell 1.2s ease-in-out infinite !important;
}

.active-hand-indicator {
  box-shadow: 0 0 0 2.5px #fbbf24, 0 4px 16px rgba(251, 191, 36, 0.4);
}

.custom-scrollbar::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
.custom-scrollbar::-webkit-scrollbar-track {
  background: #0f172a;
}
.custom-scrollbar::-webkit-scrollbar-thumb {
  background: #334155;
  border-radius: 4px;
}
