/* Gin Rummy Styles */
body {
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  background-color: #f0f2f5;
  color: #333;
}

.container {
  max-width: 900px;
  margin: 0 auto;
  padding: 20px;
  text-align: center;
}

h1 {
  color: #1976d2;
  margin-bottom: 20px;
}

/* Matchmaking */
#status {
  margin: 20px 0;
  padding: 10px;
  border-radius: 4px;
  font-weight: 500;
}

#queue-visual {
  background: #fff;
  border: 1px solid #ddd;
}

/* Game Table */
#game {
  background-color: #006400;
  /* Dark Green Felt */
  border: 8px solid #8b4513;
  /* Wood border */
  border-radius: 12px;
  padding: 20px;
  position: relative;
  min-height: 600px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  box-shadow: inset 0 0 50px rgba(0, 0, 0, 0.5);
}

#game-info {
  background: rgba(0, 0, 0, 0.3);
  color: #fff;
  padding: 8px 16px;
  border-radius: 20px;
  display: flex;
  justify-content: space-between;
  margin-bottom: 10px;
  font-size: 1.1em;
}

/* Hands */
.hand-area {
  display: flex;
  justify-content: center;
  gap: -30px;
  /* Overlap cards */
  height: 140px;
  padding: 10px;
}

.opponent-hand .card {
  transform: scale(0.8);
  /* Slightly smaller opponent cards */
}

.my-hand {
  margin-top: auto;
  /* Push to bottom */
}

.my-hand .card {
  cursor: pointer;
  transition: transform 0.2s, margin-top 0.2s;
}

.my-hand .card:hover {
  transform: translateY(-20px);
  z-index: 10;
}

/* Card Styling */
.card {
  width: 80px;
  height: 112px;
  background-color: white;
  border-radius: 6px;
  box-shadow: 2px 2px 5px rgba(0, 0, 0, 0.3);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  font-size: 24px;
  font-weight: bold;
  position: relative;
  user-select: none;
  border: 1px solid #ccc;
  margin-right: -40px;
  /* Overlap */
}

.card:last-child {
  margin-right: 0;
}

.card.red {
  color: #d32f2f;
}

.card.black {
  color: #212121;
}

.card-back {
  background: repeating-linear-gradient(45deg,
      #b71c1c,
      #b71c1c 10px,
      #c62828 10px,
      #c62828 20px);
  border: 2px solid white;
}

/* Top/Bottom markings on cards */
.card-content {
  display: flex;
  flex-direction: column;
  height: 100%;
  width: 100%;
  padding: 4px;
  box-sizing: border-box;
  justify-content: space-between;
}

.card-top,
.card-bottom {
  font-size: 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  line-height: 1;
}

.card-bottom {
  transform: rotate(180deg);
}

.card-center {
  font-size: 32px;
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
}

/* Table Area (Center) */
#table-area {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 40px;
  flex-grow: 1;
}

.card-pile {
  position: relative;
  width: 90px;
  height: 122px;
  border: 2px dashed rgba(255, 255, 255, 0.3);
  border-radius: 8px;
  display: flex;
  justify-content: center;
  align-items: center;
  cursor: pointer;
}

.card-pile .card {
  margin: 0;
  position: absolute;
  top: 2px;
  left: 2px;
}

.pile-label {
  position: absolute;
  bottom: -25px;
  color: #fff;
  font-size: 14px;
  text-transform: uppercase;
  letter-spacing: 1px;
  width: 100%;
  text-align: center;
}

.card-pile:hover {
  background-color: rgba(255, 255, 255, 0.1);
}

/* Controls */
#controls-area {
  margin-top: 10px;
  display: flex;
  justify-content: center;
  gap: 10px;
}

button {
  padding: 8px 16px;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: 1em;
  font-weight: 500;
}

.btn-primary {
  background: #1976d2;
  color: #fff;
}

.btn-primary:hover {
  background: #1565c0;
}

.btn-secondary {
  background: #d32f2f;
  color: #fff;
}

.btn-secondary:disabled {
  background: #ef9a9a;
  cursor: not-allowed;
}

.btn-small {
  background: #f5f5f5;
  color: #333;
  font-size: 0.9em;
}

/* Toast */
.toast {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: rgba(0, 0, 0, 0.8);
  color: white;
  padding: 16px 24px;
  border-radius: 8px;
  font-size: 1.2em;
  z-index: 100;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.3s;
}

.toast.visible {
  opacity: 1;
}