/* ── War Table ── */

.war-table {
  background: linear-gradient(145deg, #0d3b1e, #1a5c2a 40%, #1e6b32 70%, #0d3b1e);
  border-radius: var(--radius-lg, 16px);
  padding: 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  position: relative;
  box-shadow:
    inset 0 2px 20px rgba(0, 0, 0, 0.3),
    0 4px 24px rgba(0, 0, 0, 0.2);
  border: 3px solid #2a4a35;
}

/* ── Score Bar ── */
.war-score-bar {
  display: flex;
  gap: 24px;
  justify-content: center;
  align-items: center;
  width: 100%;
  padding-bottom: 8px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.war-score {
  text-align: center;
  color: rgba(255, 255, 255, 0.7);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  flex: 1;
}

.war-score-value {
  display: block;
  font-size: 1.4rem;
  font-weight: 700;
  color: #fff;
  margin-top: 2px;
}

.war-score.player .war-score-value {
  color: #3b82f6;
}

.war-score.computer .war-score-value {
  color: #e74c3c;
}

.war-vs {
  color: rgba(255, 255, 255, 0.3);
  font-size: 0.85rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

/* ── Battlefield ── */
.war-battlefield {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 32px;
  width: 100%;
  max-width: 480px;
  padding: 12px 0;
}

.war-side {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  flex: 1;
}

.war-side-label {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: rgba(255, 255, 255, 0.45);
}

.war-card-slot {
  width: clamp(60px, 10vw, 90px);
  aspect-ratio: 5 / 7;
  border: 2px dashed rgba(255, 255, 255, 0.15);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

.war-card-slot.has-card {
  border-color: transparent;
}

.war-card-slot .playing-card {
  width: 100%;
}

.war-deck-count {
  font-size: 0.7rem;
  color: rgba(255, 255, 255, 0.4);
  margin-top: 2px;
}

.war-center {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

/* ── Card Row (slot + pile together) ── */
.war-card-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
}

/* ── War Pile (face-down cards during war) ── */
.war-pile {
  display: flex;
  align-items: center;
  min-height: 10px;
}

.war-pile-card {
  width: clamp(30px, 5vw, 44px);
  aspect-ratio: 5 / 7;
  background: #1a5c2a;
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: 5px;
  margin-left: -12px;
  position: relative;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.2);
  opacity: 0;
  transform: translateY(-10px);
  animation: war-card-lay 0.25s ease-out forwards;
}

.war-pile-card::after {
  content: '';
  position: absolute;
  inset: 3px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 3px;
  background:
    repeating-linear-gradient(45deg, transparent, transparent 3px, rgba(255,255,255,0.04) 3px, rgba(255,255,255,0.04) 6px),
    repeating-linear-gradient(-45deg, transparent, transparent 3px, rgba(255,255,255,0.04) 3px, rgba(255,255,255,0.04) 6px);
}

.war-pile-card:first-child {
  margin-left: 0;
}

@keyframes war-card-lay {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ── Result Banner ── */
.war-result {
  background: rgba(0, 0, 0, 0.5);
  color: rgba(255, 255, 255, 0.6);
  padding: 5px 18px;
  border-radius: 20px;
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  white-space: nowrap;
  min-height: 26px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.war-result:empty {
  opacity: 0;
  transform: scale(0.9);
}

.war-result.player-wins {
  color: #5b9cf6;
  background: rgba(59, 130, 246, 0.15);
  border: 1px solid rgba(59, 130, 246, 0.25);
}

.war-result.computer-wins {
  color: #f07070;
  background: rgba(231, 76, 60, 0.15);
  border: 1px solid rgba(231, 76, 60, 0.25);
}

.war-result.war-declared {
  color: #ffd700;
  background: rgba(255, 215, 0, 0.15);
  border: 1px solid rgba(255, 215, 0, 0.3);
  font-size: 0.9rem;
  letter-spacing: 0.15em;
}

.war-result.game-over {
  font-size: 0.9rem;
  padding: 6px 22px;
}

/* ── Controls ── */
.war-controls {
  display: flex;
  gap: 10px;
  padding: 4px 0;
}

.war-btn {
  padding: 10px 28px;
  border: none;
  border-radius: 8px;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  transition: transform 0.15s ease, background 0.15s ease;
}

.war-btn:hover:not(:disabled) {
  transform: translateY(-1px);
}

.war-btn:active:not(:disabled) {
  transform: translateY(0);
}

.war-btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.war-btn-flip {
  background: #ffd700;
  color: #1a1a2e;
}
.war-btn-flip:hover:not(:disabled) { background: #ffed4a; }

.war-btn-new {
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.25);
}
.war-btn-new:hover:not(:disabled) { background: rgba(255, 255, 255, 0.25); }

.war-btn-auto {
  background: rgba(255, 255, 255, 0.1);
  color: rgba(255, 255, 255, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.15);
  font-size: 0.78rem;
  padding: 8px 16px;
}
.war-btn-auto.active {
  background: rgba(59, 130, 246, 0.3);
  color: #fff;
  border-color: rgba(59, 130, 246, 0.5);
}

/* ── Speed Control ── */
.war-speed {
  display: flex;
  align-items: center;
  gap: 6px;
  color: rgba(255, 255, 255, 0.5);
  font-size: 0.7rem;
}

.war-speed input[type="range"] {
  width: 60px;
  accent-color: #ffd700;
}

/* ── Stats Row ── */
.war-stats-row {
  display: flex;
  gap: 20px;
  justify-content: center;
  color: rgba(255, 255, 255, 0.5);
  font-size: 0.72rem;
  padding-top: 4px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  width: 100%;
}

.war-stats-row span {
  color: rgba(255, 255, 255, 0.8);
  font-weight: 600;
}

/* ── Responsive ── */
@media (max-width: 768px) {
  .war-table { padding: 14px 10px; }
  .war-battlefield { gap: 12px; }
  .war-score-value { font-size: 1.2rem; }
  .war-btn { padding: 8px 20px; font-size: 0.85rem; }
  .war-pile-card { margin-left: -8px; }
}

@media (max-width: 480px) {
  .war-table { padding: 10px 6px; border-radius: 12px; gap: 5px; }
  .war-battlefield { gap: 10px; padding: 8px 0; }
  .war-score-bar { gap: 12px; }
  .war-score { font-size: 0.65rem; }
  .war-score-value { font-size: 1rem; }
  .war-result { font-size: 0.68rem; padding: 4px 12px; }
  .war-btn { padding: 7px 16px; font-size: 0.78rem; }
  .war-btn-auto { padding: 6px 12px; font-size: 0.7rem; }
  .war-controls { gap: 6px; }
  .war-pile-card { width: clamp(22px, 5vw, 32px); margin-left: -6px; }
  .war-stats-row { gap: 12px; font-size: 0.65rem; }
}
