/* Mobile-first responsive design */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
  height: 100vh;
  height: 100dvh; /* Dynamic viewport height for mobile browsers */
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 10px;
  position: relative;
  color: #e8e8e8;
  overflow: hidden;
}

body::before {
  content: "🍺";
  position: absolute;
  top: 20px;
  left: 20px;
  font-size: 2rem;
  opacity: 0.5;
  animation: float 4s ease-in-out infinite;
}

body::after {
  content: "🍻";
  position: absolute;
  top: 20px;
  right: 20px;
  font-size: 2rem;
  opacity: 0.5;
  animation: float 4s ease-in-out infinite reverse;
}

.beer-bottom-left {
  position: absolute;
  bottom: 20px;
  left: 20px;
  font-size: 2rem;
  opacity: 0.5;
  animation: float 4s ease-in-out infinite 2s;
}

.beer-bottom-right {
  position: absolute;
  bottom: 20px;
  right: 20px;
  font-size: 2rem;
  opacity: 0.5;
  animation: float 4s ease-in-out infinite reverse 2s;
}

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

.message {
  font-size: 24px;
  font-weight: bold;
  text-align: center;
  color: #ffd700;
  margin-bottom: 10px;
  min-height: 30px;
  opacity: 0;
  transition: opacity 0.3s ease;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
}

.message.show {
  opacity: 1;
}

.game-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  max-width: 400px;
  width: 100%;
  height: 100%;
  padding: 10px 0;
}

.card-display {
  width: 100%;
  display: flex;
  justify-content: center;
}

.card {
  width: 260px;
  height: 370px;
  max-width: 90vw;
  max-height: 60vh;
  perspective: 1000px;
  cursor: pointer;
  touch-action: manipulation;
}

.card-inner {
  position: relative;
  width: 100%;
  height: 100%;
  text-align: center;
  transition: transform 0.6s;
  transform-style: preserve-3d;
}

.card.flipped .card-inner {
  transform: rotateY(180deg);
}

.card.transitioning .card-front {
  opacity: 0;
  transform: rotateY(180deg) scale(0.9);
  transition: all 0.15s ease-out;
}

.card:not(.transitioning) .card-front {
  opacity: 1;
  transform: rotateY(180deg) scale(1);
  transition: all 0.15s ease-out;
}

.card-front,
.card-back {
  position: absolute;
  width: 100%;
  height: 100%;
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
  border-radius: 15px;
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  font-weight: bold;
  user-select: none;
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
}

.card-back {
  background: linear-gradient(145deg, #2c3e50, #34495e);
  color: white;
  border: 3px solid #bdc3c7;
}

.card-front {
  background: white;
  color: #2c3e50;
  transform: rotateY(180deg);
  border: 3px solid #34495e;
  flex-direction: column;
  gap: 20px;
}

.card-front.red {
  color: #e74c3c;
}

.card-suit {
  font-size: 100px;
}

.card-value {
  font-size: 72px;
}

.card-joker {
  font-size: 42px;
  font-weight: bold;
  transform: rotate(-15deg);
  text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
}

.game-info {
  text-align: center;
  color: white;
  font-size: 18px;
}

.counter {
  margin-bottom: 15px;
  color: rgba(255, 255, 255, 0.5);
}

.reset-btn {
  background: rgba(255, 255, 255, 0.2);
  color: white;
  border: 2px solid rgba(255, 255, 255, 0.5);
  border-radius: 25px;
  padding: 12px 24px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  touch-action: manipulation;
  transition: all 0.3s ease;
}

.reset-btn:hover {
  background: rgba(255, 255, 255, 0.3);
  transform: translateY(-2px);
}

.reset-btn:active {
  transform: translateY(0);
}

/* Prevent zoom on input focus */
input,
button,
select,
textarea {
  font-size: 16px;
}

/* Ensure touch targets are at least 44px */
.card,
.reset-btn {
  min-height: 44px;
}

/* Landscape orientation adjustments */
@media (orientation: landscape) and (max-height: 500px) {
  .card {
    width: 200px;
    height: 280px;
  }

  .card-suit {
    font-size: 36px;
  }

  .card-value {
    font-size: 54px;
  }

  .game-container {
    gap: 20px;
  }
}
