/* ============================================
   War — Game-Specific Styles
   ============================================ */

/* ======= TABLE FELT ======= */
.table-felt {
  background: radial-gradient(ellipse at center, #1e6b35 0%, #155c2a 50%, #0f4a20 100%);
  border-radius: var(--radius-lg);
  border: 4px solid #3a2a1a;
  box-shadow: inset 0 0 60px rgba(0, 0, 0, 0.4), 0 4px 20px rgba(0, 0, 0, 0.5);
  padding: 24px 16px;
  min-height: 320px;
  position: relative;
  margin-bottom: 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}

/* ======= DECK COUNTS ======= */
.deck-counts {
  display: flex;
  justify-content: space-between;
  width: 100%;
  max-width: 400px;
}

.deck-count {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}

.deck-label {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: rgba(255, 255, 255, 0.6);
  font-weight: 700;
}

.deck-number {
  font-size: 32px;
  font-weight: 700;
  color: #fff;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
}

.deck-number.danger {
  color: #e74c3c;
}

.deck-number.winning {
  color: #2ecc71;
}

/* ======= BATTLE ZONE ======= */
.battle-zone {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 20px;
  width: 100%;
  min-height: 160px;
}

.battle-side {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  min-width: 100px;
}

.battle-label {
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: rgba(255, 255, 255, 0.5);
}

.battle-cards {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100px;
  position: relative;
}

/* War face-down cards stack behind */
.battle-cards .card {
  position: relative;
}

.battle-cards .card.war-down {
  position: absolute;
}

.battle-cards .card.war-down:nth-child(1) {
  transform: translate(-6px, -4px) rotate(-3deg);
}

.battle-cards .card.war-down:nth-child(2) {
  transform: translate(0, -2px) rotate(1deg);
}

.battle-cards .card.war-down:nth-child(3) {
  transform: translate(6px, 0) rotate(4deg);
}

.vs-badge {
  font-size: 22px;
  font-weight: 700;
  color: rgba(255, 255, 255, 0.3);
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.4);
  flex-shrink: 0;
}

.vs-badge.war {
  color: #f1c40f;
  font-size: 28px;
  text-shadow: 0 0 20px rgba(241, 196, 15, 0.5);
  animation: warPulse 0.6s ease infinite alternate;
}

@keyframes warPulse {
  0% { transform: scale(1); }
  100% { transform: scale(1.15); }
}

/* ======= ROUND RESULT ======= */
.round-result {
  font-size: 16px;
  font-weight: 700;
  color: #f1c40f;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.6);
  min-height: 24px;
  text-align: center;
}

.round-result:empty {
  display: none;
}

/* ======= PLAYING CARDS (same as Blackjack) ======= */
.card {
  width: 72px;
  height: 100px;
  border-radius: 8px;
  flex-shrink: 0;
  transition: transform 0.3s ease, opacity 0.3s ease;
  transform-style: preserve-3d;
  font-family: 'Georgia', serif;
}

.card.dealing {
  animation: dealCard 0.4s ease-out forwards;
}

@keyframes dealCard {
  0% {
    opacity: 0;
    transform: translateY(-60px) scale(0.5) rotateY(180deg);
  }
  60% {
    opacity: 1;
    transform: translateY(4px) scale(1.02) rotateY(20deg);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1) rotateY(0deg);
  }
}

.card-face {
  width: 100%;
  height: 100%;
  background: linear-gradient(145deg, #ffffff 0%, #f5f5f0 100%);
  border-radius: 8px;
  border: 1px solid #ccc;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.8);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 5px 6px;
  position: relative;
  overflow: hidden;
}

.card-face::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  border-radius: 7px;
  border: 2px solid rgba(0, 0, 0, 0.06);
  pointer-events: none;
}

.card.red .card-face {
  color: #c0392b;
}

.card.black .card-face {
  color: #1a1a2e;
}

.card-corner {
  display: flex;
  flex-direction: column;
  align-items: center;
  line-height: 1;
  gap: 0;
}

.card-corner-value {
  font-size: 15px;
  font-weight: 700;
}

.card-corner-suit {
  font-size: 11px;
  line-height: 1;
}

.card-corner.bottom {
  align-self: flex-end;
  transform: rotate(180deg);
}

.card-center {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 32px;
  line-height: 1;
  opacity: 0.85;
}

.card-center.face-card {
  font-size: 26px;
  font-weight: 700;
  opacity: 0.7;
}

.card-back {
  width: 100%;
  height: 100%;
  border-radius: 8px;
  background: linear-gradient(135deg, #1a3a6e 0%, #0f2247 100%);
  border: 1px solid #0a1530;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
  position: relative;
  overflow: hidden;
}

.card-back::before {
  content: '';
  position: absolute;
  inset: 4px;
  border-radius: 5px;
  border: 2px solid rgba(255, 255, 255, 0.12);
  background: repeating-linear-gradient(
    45deg,
    transparent,
    transparent 4px,
    rgba(255, 255, 255, 0.03) 4px,
    rgba(255, 255, 255, 0.03) 8px
  );
}

.card-back::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.15);
  background: radial-gradient(circle, rgba(77, 166, 255, 0.15) 0%, transparent 70%);
}

.card.flipping {
  animation: flipCard 0.5s ease-in-out forwards;
}

@keyframes flipCard {
  0% { transform: rotateY(0deg); }
  50% { transform: rotateY(90deg); }
  100% { transform: rotateY(0deg); }
}

/* Winner highlight */
.card.winner-card {
  box-shadow: 0 0 16px rgba(46, 204, 113, 0.6);
}

.card.loser-card {
  opacity: 0.6;
}

/* ======= CONTROLS ======= */
.controls-area {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  padding: 4px 0;
}

#play-btn {
  min-width: 140px;
  font-size: 18px;
  padding: 12px 32px;
}

#auto-btn {
  min-width: 110px;
}

#auto-btn.active {
  background-color: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

/* ======= RESULT OVERLAY ======= */
#result-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  border-radius: 0;
  z-index: 100;
}

#result-overlay .result-content {
  max-width: 380px;
}

#result-title {
  font-size: 28px;
}

#result-message {
  color: var(--text-secondary);
  font-size: 16px;
  margin-bottom: 8px;
}

/* ======= RESPONSIVE: TABLET ======= */
@media (max-width: 768px) {
  .table-felt {
    padding: 16px 10px;
    min-height: 280px;
  }

  .card {
    width: 60px;
    height: 84px;
  }

  .card-corner-value {
    font-size: 13px;
  }

  .card-corner-suit {
    font-size: 9px;
  }

  .card-center {
    font-size: 26px;
  }

  .card-center.face-card {
    font-size: 22px;
  }

  .battle-zone {
    gap: 14px;
  }

  .deck-number {
    font-size: 28px;
  }

  #play-btn {
    min-width: 120px;
    font-size: 16px;
    padding: 10px 24px;
  }
}

/* ======= RESPONSIVE: PHONE ======= */
@media (max-width: 480px) {
  .table-felt {
    padding: 12px 6px;
    min-height: 240px;
    border-radius: var(--radius-md);
    border-width: 3px;
  }

  .card {
    width: 50px;
    height: 70px;
  }

  .card-corner-value {
    font-size: 11px;
  }

  .card-corner-suit {
    font-size: 8px;
  }

  .card-center {
    font-size: 22px;
  }

  .card-center.face-card {
    font-size: 18px;
  }

  .card-face {
    padding: 3px 4px;
  }

  .battle-zone {
    gap: 10px;
    min-height: 120px;
  }

  .battle-side {
    min-width: 70px;
  }

  .battle-label {
    font-size: 11px;
  }

  .vs-badge {
    font-size: 18px;
  }

  .deck-number {
    font-size: 24px;
  }

  .deck-label {
    font-size: 11px;
  }

  .round-result {
    font-size: 14px;
  }

  #play-btn {
    min-width: 100px;
    font-size: 15px;
    padding: 10px 20px;
  }

  #auto-btn {
    min-width: 90px;
    font-size: 13px;
  }
}
