@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@400;600;800&display=swap');

:root {
  --card-width: 120px;
  --card-height: 180px;
  --bg-color: #2c3e50;
  --felt-color: #1e8449;
  --text-color: #ecf0f1;
  --accent-color: #f1c40f;
  --danger-color: #e74c3c;
  --success-color: #2ecc71;
  --shadow-color: rgba(0,0,0,0.5);
  --card-radius: 12px;
}

body {
  margin: 0;
  padding: 0;
  font-family: 'Poppins', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  background-color: var(--felt-color);
  background-image:
    radial-gradient(circle at center, #27ae60 0%, #196f3d 100%),
    repeating-linear-gradient(45deg, transparent, transparent 10px, rgba(0,0,0,0.02) 10px, rgba(0,0,0,0.02) 20px);
  background-blend-mode: overlay;
  color: var(--text-color);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  height: 100vh;
  user-select: none;
  position: relative;
}

body::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  box-shadow: inset 0 0 150px rgba(0, 0, 0, 0.9);
  z-index: 10;
}

@keyframes pulse {
  0% { transform: scale(1); box-shadow: 0 4px 15px rgba(243, 156, 18, 0.4); }
  50% { transform: scale(1.05); box-shadow: 0 8px 25px rgba(243, 156, 18, 0.8); }
  100% { transform: scale(1); box-shadow: 0 4px 15px rgba(243, 156, 18, 0.4); }
}

#game-container {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 20px;
  position: relative;
  perspective: 1200px;
  transition: filter 0.3s ease-out;
}

#game-container.blurred {
  filter: blur(8px) brightness(0.8);
}

.game-header {
  position: absolute;
  top: 15px;
  left: 20px;
  right: 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  z-index: 100;
  pointer-events: none;
}

.game-header button {
  pointer-events: auto;
}

#game-title {
  font-size: 2rem;
  font-weight: 800;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.2);
  letter-spacing: 5px;
}

.player-zone {
  display: flex;
  justify-content: center;
  align-items: center;
  height: 220px;
  position: relative;
}

.player-info {
  position: absolute;
  left: 20px;
  background: rgba(0, 0, 0, 0.6);
  padding: 15px 25px;
  border-radius: 16px;
  text-align: center;
  backdrop-filter: blur(10px);
  min-width: 180px;
  border: 1px solid rgba(241, 196, 15, 0.3);
  box-shadow: 0 0 15px rgba(241, 196, 15, 0.2), 0 8px 32px rgba(0,0,0,0.5);
  transition: transform 0.2s, box-shadow 0.2s;
}

.player-info:hover {
  transform: scale(1.05);
  box-shadow: 0 0 25px rgba(241, 196, 15, 0.4), 0 8px 32px rgba(0,0,0,0.5);
}

.player-info:hover {
  transform: scale(1.05);
}

.player-info h3 {
  margin: 0 0 5px 0;
  font-size: 1.2rem;
  color: var(--accent-color);
}

.deck-container {
  width: var(--card-width);
  height: var(--card-height);
  border: 3px dashed rgba(255, 255, 255, 0.2);
  border-radius: var(--card-radius);
  position: relative;
  display: flex;
  justify-content: center;
  align-items: center;
}

.battle-zone {
  flex: 1;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 40px;
  position: relative;
}

.card {
  width: var(--card-width);
  height: var(--card-height);
  position: absolute;
  transform-style: preserve-3d;
  transition: transform 0.6s cubic-bezier(0.175, 0.885, 0.32, 1.275), left 0.6s ease-out, top 0.6s ease-out;
  cursor: default;
  border-radius: var(--card-radius);
}

.card:hover {
  z-index: 1000 !important;
}

.card-face {
  position: absolute;
  width: 100%;
  height: 100%;
  backface-visibility: hidden;
  border-radius: var(--card-radius);
  overflow: hidden;
  background: white;
  box-shadow: 0 4px 15px rgba(0,0,0,0.3);
}

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

.card-back {
  background: transparent;
}

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

#controls {
  position: absolute;
  bottom: 30px;
  right: 30px;
  display: flex;
  gap: 15px;
  z-index: 100;
  align-items: center;
}

button, .menu-btn {
  background: linear-gradient(135deg, #f1c40f 0%, #f39c12 100%);
  border: none;
  padding: 12px 28px;
  font-size: 1.1rem;
  font-weight: bold;
  color: #2c3e50;
  border-radius: 50px;
  cursor: pointer;
  box-shadow: 0 4px 15px rgba(243, 156, 18, 0.4);
  transition: all 0.2s cubic-bezier(0.25, 0.8, 0.25, 1);
  text-transform: uppercase;
  letter-spacing: 1px;
  position: relative;
  overflow: hidden;
}

button::after {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: rgba(255, 255, 255, 0.2);
  transform: rotate(45deg);
  transition: all 0.3s ease;
  opacity: 0;
}

button:hover::after {
  opacity: 1;
  transform: rotate(45deg) translate(50%, 50%);
}

#draw-btn, #btn-hit {
  animation: pulse 2s infinite;
}

#draw-btn:disabled, #btn-hit:disabled {
  animation: none;
}

button.secondary, .secondary-btn {
  background: linear-gradient(135deg, #ecf0f1 0%, #bdc3c7 100%);
  color: #2c3e50;
  box-shadow: 0 4px 15px rgba(189, 195, 199, 0.4);
}

button:hover:not(:disabled) {
  transform: translateY(-3px) scale(1.08);
  box-shadow: 0 10px 30px rgba(243, 156, 18, 0.7);
}

button:active:not(:disabled) {
  transform: translateY(1px) scale(0.98);
  box-shadow: 0 2px 10px rgba(243, 156, 18, 0.4);
}

button:disabled {
  background: #95a5a6;
  box-shadow: none;
  cursor: not-allowed;
  transform: none;
  opacity: 0.7;
}

.hidden {
  display: none !important;
}

.overlay, .menu-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(5px);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  z-index: 1000;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.4s ease;
}

.overlay.visible, .menu-overlay.visible {
  opacity: 1;
  pointer-events: auto;
}

.menu-content, .modal-content {
  background: white;
  color: #2c3e50;
  padding: 50px;
  border-radius: 30px;
  text-align: center;
  box-shadow: 0 20px 60px rgba(0,0,0,0.5);
  max-width: 600px;
  width: 90%;
  transform: translateY(20px);
  transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  pointer-events: auto;
}

.overlay.visible .menu-content, .overlay.visible .modal-content {
  transform: translateY(0);
}

.menu-buttons {
  display: flex;
  flex-direction: column;
  gap: 15px;
  margin-top: 30px;
}

.setting-item {
  display: flex;
  justify-content: space-between;
  width: 100%;
  margin-bottom: 1.5rem;
  font-size: 1.2rem;
  color: #2c3e50;
  align-items: center;
  background: #f8f9fa;
  padding: 15px 20px;
  border-radius: 12px;
  box-shadow: inset 0 2px 5px rgba(0,0,0,0.05);
  box-sizing: border-box;
}

.setting-item input[type="range"] {
  width: 50%;
  accent-color: var(--accent-color);
}

.setting-item input[type="checkbox"] {
  width: 24px;
  height: 24px;
  accent-color: var(--accent-color);
  cursor: pointer;
}

.war-badge {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) rotate(-15deg) scale(0.5);
  font-size: 6rem;
  color: #e74c3c;
  font-weight: 900;
  text-shadow: 0 0 20px rgba(231, 76, 60, 0.8);
  opacity: 0;
  transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  z-index: 50;
  pointer-events: none;
}

.war-badge.visible {
  opacity: 1;
  transform: translate(-50%, -50%) rotate(0deg) scale(1.2);
}

.center-message {
  position: absolute;
  top: 40%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 2.5rem;
  font-weight: bold;
  color: white;
  text-shadow: 0 4px 10px rgba(0,0,0,0.5);
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.3s;
  text-align: center;
  background: rgba(0,0,0,0.5);
  padding: 10px 30px;
  border-radius: 50px;
}
.center-message.visible { opacity: 1; }

#message-overlay h1 {
  font-size: 3rem;
  color: #e74c3c;
  margin-bottom: 10px;
}

#message-overlay h2 {
  font-size: 2rem;
  color: #2c3e50;
  margin-bottom: 20px;
}

@media (max-width: 600px) {
  :root {
    --card-width: 80px;
    --card-height: 120px;
  }
  .player-info {
    position: relative;
    left: auto;
    width: auto;
    margin-right: 10px;
    padding: 8px 15px;
    min-width: auto;
  }
  .player-info h3 {
    font-size: 1rem;
  }
  #controls {
    bottom: 10px;
    right: 10px;
    flex-wrap: wrap;
    justify-content: flex-end;
  }
  button {
    padding: 10px 20px;
    font-size: 0.9rem;
  }
}
