
* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  background: linear-gradient(135deg, #1a5c3a 0%, #0d3d26 100%);
  font-family: 'Nunito', sans-serif;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  color: #fff;
}

/* ===== HEADER ===== */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.6rem 1rem;
  background: rgba(0,0,0,0.35);
  border-bottom: 1px solid rgba(255,255,255,0.1);
  flex-wrap: wrap;
  gap: 0.5rem;
}

.btn-back {
  color: rgba(255,255,255,0.7);
  text-decoration: none;
  font-weight: 700;
  font-size: 0.9rem;
}

.btn-back:hover { color: #fff; }

.game-title {
  font-size: 1.1rem;
  font-weight: 800;
  color: #fff;
}

.stats {
  display: flex;
  gap: 1rem;
  font-size: 0.82rem;
  font-weight: 700;
  color: rgba(255,255,255,0.7);
}

/* ===== GAME WRAPPER ===== */
.game-wrapper {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 1rem;
  max-width: 800px;
  margin: 0 auto;
  width: 100%;
}

/* ===== CONFIG PANEL ===== */
.config-panel {
  background: rgba(0,0,0,0.3);
  border-radius: 20px;
  padding: 2rem;
  text-align: center;
  border: 2px solid rgba(255,255,255,0.1);
  max-width: 400px;
  width: 100%;
}

.config-panel h2 {
  font-size: 1.5rem;
  margin-bottom: 1.5rem;
  color: #ffd700;
}

.config-option {
  margin-bottom: 1.5rem;
}

.config-option label {
  display: block;
  font-size: 0.9rem;
  margin-bottom: 0.5rem;
  color: rgba(255,255,255,0.8);
}

.player-selector {
  display: flex;
  gap: 0.5rem;
  justify-content: center;
}

.player-btn {
  width: 50px;
  height: 50px;
  border-radius: 12px;
  border: 2px solid rgba(255,255,255,0.2);
  background: rgba(255,255,255,0.05);
  color: #fff;
  font-size: 1.2rem;
  font-weight: 800;
  cursor: pointer;
  transition: all 0.2s;
}

.player-btn:hover {
  background: rgba(255,107,53,0.2);
  border-color: rgba(255,107,53,0.5);
}

.player-btn.active {
  background: #ff6b35;
  border-color: #ff6b35;
}

.btn-start {
  background: linear-gradient(135deg, #ff6b35 0%, #e85d2a 100%);
  color: #fff;
  border: none;
  border-radius: 999px;
  padding: 0.9rem 2.5rem;
  font-family: 'Nunito', sans-serif;
  font-weight: 800;
  font-size: 1.1rem;
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s;
}

.btn-start:hover {
  transform: scale(1.05);
  box-shadow: 0 4px 20px rgba(255,107,53,0.4);
}

/* ===== GAME AREA ===== */
.game-area {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.game-area.hidden,
.config-panel.hidden {
  display: none;
}

/* ===== OPPONENTS ===== */
.opponents-row {
  display: flex;
  justify-content: center;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 0.5rem;
}

.opponent {
  background: rgba(0,0,0,0.3);
  border-radius: 14px;
  padding: 0.8rem 1rem;
  text-align: center;
  border: 2px solid transparent;
  transition: all 0.3s;
  min-width: 100px;
}

.opponent.active-turn {
  border-color: #ffd700;
  box-shadow: 0 0 15px rgba(255,215,0,0.4);
  animation: pulse 1.5s infinite;
}

.opponent.has-batted {
  border-color: #81c784;
  background: rgba(129,199,132,0.15);
}

@keyframes pulse {
  0%, 100% { box-shadow: 0 0 15px rgba(255,215,0,0.4); }
  50% { box-shadow: 0 0 25px rgba(255,215,0,0.6); }
}

.opp-name {
  font-size: 0.8rem;
  font-weight: 700;
  color: rgba(255,255,255,0.8);
  margin-bottom: 0.5rem;
}

.opp-cards {
  display: flex;
  gap: 3px;
  justify-content: center;
  margin-bottom: 0.3rem;
}

.opp-count {
  font-size: 0.7rem;
  color: rgba(255,255,255,0.5);
}

/* ===== TABLE AREA ===== */
.table-area {
  background: rgba(0,0,0,0.25);
  border-radius: 20px;
  padding: 1.5rem;
  display: flex;
  justify-content: center;
}

.deck-area {
  display: flex;
  gap: 2rem;
  align-items: center;
}

.deck-pile, .discard-pile {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
}

.pile-label {
  font-size: 0.75rem;
  font-weight: 700;
  color: rgba(255,255,255,0.5);
  text-transform: uppercase;
  letter-spacing: 1px;
}

.deck-card {
  position: relative;
  cursor: pointer;
  transition: transform 0.2s;
}

.deck-card.clickable:hover {
  transform: translateY(-5px);
}

.deck-count {
  position: absolute;
  bottom: 5px;
  right: 5px;
  background: rgba(0,0,0,0.7);
  color: #fff;
  font-size: 0.7rem;
  font-weight: 800;
  padding: 2px 6px;
  border-radius: 10px;
}

/* ===== CARDS ===== */
.card {
  width: 50px;
  height: 70px;
  background: #fff;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 1rem;
  color: #222;
  box-shadow: 0 2px 8px rgba(0,0,0,0.4);
  user-select: none;
  flex-shrink: 0;
  border: 2px solid rgba(255,255,255,0.3);
}

.card.red { color: #c0392b; }

.card.back {
  background: linear-gradient(135deg, #1a237e 0%, #283593 50%, #1a237e 100%);
  color: transparent;
  border: 2px solid rgba(255,255,255,0.15);
}

.card.back::after {
  content: '🃏';
  font-size: 1.2rem;
  opacity: 0.3;
}

.card.small {
  width: 35px;
  height: 50px;
  font-size: 0.7rem;
}

.card.placeholder {
  background: rgba(255,255,255,0.08);
  border: 2px dashed rgba(255,255,255,0.2);
  box-shadow: none;
}

.card.clickable {
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s;
}

.card.clickable:hover {
  transform: translateY(-5px);
  box-shadow: 0 4px 15px rgba(0,0,0,0.5);
}

.card.selected {
  box-shadow: 0 0 0 3px #ffd700, 0 4px 15px rgba(255,215,0,0.5);
  transform: translateY(-5px);
}

/* ===== MESSAGE BAR ===== */
.message-bar {
  text-align: center;
  padding: 0.5rem;
  font-size: 0.9rem;
  font-weight: 700;
  color: rgba(255,255,255,0.8);
  min-height: 30px;
}

/* ===== PLAYER AREA ===== */
.player-area {
  background: rgba(0,0,0,0.3);
  border-radius: 20px;
  padding: 1rem;
  border: 2px solid rgba(255,255,255,0.1);
  transition: border-color 0.3s;
}

.player-area.active-turn {
  border-color: #ffd700;
}

.player-info-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.8rem;
}

.player-name {
  font-size: 1rem;
  font-weight: 800;
  color: #fff;
}

.player-status {
  font-size: 0.8rem;
  font-weight: 700;
  color: #81c784;
}

.player-hand {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  margin-bottom: 1rem;
  min-height: 75px;
}

.player-sequences {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  justify-content: center;
  padding: 0.5rem;
  background: rgba(255,255,255,0.05);
  border-radius: 12px;
  min-height: 75px;
}

.sequence {
  display: flex;
  gap: 4px;
  padding: 4px;
  background: rgba(129,199,132,0.2);
  border-radius: 8px;
  border: 1px solid rgba(129,199,132,0.3);
}

.sequence .card {
  width: 40px;
  height: 56px;
  font-size: 0.85rem;
}

/* ===== ACTIONS ===== */
.action-area {
  display: flex;
  gap: 0.75rem;
  justify-content: center;
  flex-wrap: wrap;
  margin-top: 1rem;
}

.btn-action {
  padding: 0.7rem 1.5rem;
  border-radius: 999px;
  border: 2px solid;
  font-family: 'Nunito', sans-serif;
  font-weight: 800;
  font-size: 0.9rem;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-primary {
  background: linear-gradient(135deg, #ff6b35 0%, #e85d2a 100%);
  border-color: #ff6b35;
  color: #fff;
}

.btn-primary:hover:not(:disabled) {
  transform: scale(1.05);
  box-shadow: 0 4px 15px rgba(255,107,53,0.4);
}

.btn-secondary {
  background: linear-gradient(135deg, #4caf50 0%, #388e3c 100%);
  border-color: #4caf50;
  color: #fff;
}

.btn-secondary:hover:not(:disabled) {
  transform: scale(1.05);
  box-shadow: 0 4px 15px rgba(76,175,80,0.4);
}

.btn-danger {
  background: rgba(239,83,80,0.15);
  border-color: rgba(239,83,80,0.5);
  color: #ef9a9a;
}

.btn-danger:hover {
  background: rgba(239,83,80,0.25);
}

.btn-action:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* ===== MODAL ===== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.8);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 1rem;
}

.modal-overlay.hidden { display: none; }

.modal-content {
  background: linear-gradient(135deg, #1a2a1a 0%, #0d1a0d 100%);
  border: 2px solid rgba(255,255,255,0.15);
  border-radius: 24px;
  padding: 2rem;
  text-align: center;
  max-width: 400px;
  width: 100%;
}

.modal-icon {
  font-size: 4rem;
  margin-bottom: 0.5rem;
}

.modal-title {
  font-size: 1.6rem;
  font-weight: 800;
  color: #fff;
  margin-bottom: 1rem;
}

.modal-body {
  margin-bottom: 1.5rem;
}

.results-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.result-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem 1rem;
  background: rgba(255,255,255,0.05);
  border-radius: 12px;
}

.result-row.winner {
  background: rgba(255,215,0,0.15);
  border: 1px solid rgba(255,215,0,0.3);
}

.result-row.human {
  border-left: 3px solid #ff6b35;
}

.result-name {
  font-weight: 700;
  color: rgba(255,255,255,0.9);
}

.result-points {
  font-weight: 800;
  color: #ffd700;
}

/* ===== GAME INFO ===== */
.game-info {
  max-width: 700px;
  margin: 0 auto;
  padding: 2rem 1rem;
  width: 100%;
}

.game-info h2 {
  font-size: 1.4rem;
  font-weight: 800;
  margin-bottom: 1rem;
  color: #333;
}

.game-info h3 {
  font-size: 1.1rem;
  font-weight: 800;
  margin: 1.2rem 0 0.5rem;
  color: #444;
}

.game-info p, .game-info li {
  font-size: 0.95rem;
  color: #555;
  line-height: 1.7;
}

.game-info ul {
  padding-left: 1.5rem;
}

.game-info ul ul {
  margin-top: 0.3rem;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 600px) {
  .card {
    width: 40px;
    height: 56px;
    font-size: 0.85rem;
  }

  .card.small {
    width: 28px;
    height: 40px;
    font-size: 0.6rem;
  }

  .card.back::after {
    font-size: 0.9rem;
  }

  .sequence .card {
    width: 32px;
    height: 45px;
    font-size: 0.7rem;
  }

  .player-hand {
    gap: 5px;
  }

  .opponent {
    min-width: 80px;
    padding: 0.6rem 0.8rem;
  }

  .opp-cards {
    gap: 2px;
  }

  .btn-action {
    padding: 0.6rem 1.2rem;
    font-size: 0.85rem;
  }

  .deck-area {
    gap: 1.5rem;
  }
}

@media (max-width: 400px) {
  .card {
    width: 35px;
    height: 49px;
    font-size: 0.75rem;
  }

  .sequence .card {
    width: 28px;
    height: 39px;
    font-size: 0.65rem;
  }
}
