.game-area {
  flex: 1;
  position: relative;
  z-index: 10;
  height: 55%;
  order: 1;
}

@media (min-width: 768px) {
  .game-area {
    height: auto;
    order: 1;
  }
}

.floor-texture {
  width: 100%;
  height: 100%;
  background-color: #111827;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  /* Simple dot pattern */
  background-image: radial-gradient(#374151 1px, transparent 1px);
  background-size: 20px 20px;
}

.poker-table {
  position: relative;
  width: 90vmin;
  height: 90vmin;
  background-color: var(--felt-base);
  border-radius: 50%;
  border: 16px solid var(--wood-border);
  box-shadow: inset 0 0 100px rgba(0,0,0,0.8), 0 20px 50px rgba(0,0,0,0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  container-type: size; 
}

@media (min-width: 768px) {
  .poker-table {
    width: 80vmin;
    height: 80vmin;
  }
}

.table-felt {
  position: absolute;
  inset: 8px;
  border-radius: 50%;
  border: 2px solid rgba(202, 138, 4, 0.2);
  background: radial-gradient(circle, var(--felt-light) 0%, var(--felt-dark) 100%);
}

.table-logo {
  position: absolute;
  top: 25%;
  font-family: "Times New Roman", serif;
  color: rgba(22, 101, 52, 0.3);
  font-size: 2.5rem;
  letter-spacing: 0.05em;
  font-weight: bold;
  user-select: none;
  pointer-events: none;
}

.pot-container {
  position: absolute;
  bottom: 33%;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
}

.pot-text {
  font-size: 1.25rem;
  color: white;
  font-weight: bold;
  text-shadow: 0 2px 4px rgba(0,0,0,0.5);
  white-space: nowrap;
}

/* Community Cards */
.community-cards-area {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 10;
  min-height: var(--card-height);
  
  /* Default Mobile / Small Table: Overlap Mode */
  gap: 0;
}

.community-cards-area > .card,
.community-cards-area > .card-placeholder {
  /* Overlap matching player hand style */
  margin-right: -28px;
  transition: margin-right 0.3s ease;
}

.community-cards-area > .card:last-child,
.community-cards-area > .card-placeholder:last-child {
  margin-right: 0;
}

/* Use Container Query on .poker-table to decide layout */
@container (min-width: 600px) {
  .community-cards-area {
    gap: 8px;
  }
  .community-cards-area > .card,
  .community-cards-area > .card-placeholder {
    margin-right: 0;
  }
}

.phase-indicator {
  position: absolute;
  top: 33%;
  color: rgba(134, 239, 172, 0.8);
  font-size: 0.875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  text-align: center;
  width: 100%;
  text-shadow: 0 1px 2px rgba(0,0,0,0.8);
}

.btn-table-primary {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 50;
    font-size: 1.25rem;
    padding: 1rem 3rem;
    border-radius: 50px;
    background: linear-gradient(to bottom, #22c55e, #15803d);
    border: 4px solid #ffffff;
    color: white;
    font-weight: bold;
    box-shadow: 0 10px 25px rgba(0,0,0,0.5);
    cursor: pointer;
    text-transform: uppercase;
    transition: transform 0.2s, box-shadow 0.2s;
    white-space: nowrap;
}

@media (min-width: 640px) {
    .btn-table-primary {
        font-size: 1.5rem;
    }
}

.btn-table-primary:hover {
    transform: translate(-50%, -50%) scale(1.05);
    box-shadow: 0 10px 30px rgba(0,0,0,0.6);
}

.btn-table-primary:active {
    transform: translate(-50%, -50%) scale(0.95);
}

.players-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
  width: 100%;
  height: 100%;
}

/* Cards */
.card {
  width: var(--card-width);
  height: var(--card-height);
  border-radius: 6px;
  box-shadow: 0 2px 5px rgba(0,0,0,0.3);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  padding: 4px;
  user-select: none;
  overflow: hidden;
  position: relative;
  background: white;
  transition: all 0.2s;
  will-change: transform;
}

.card-back {
  background-color: #1e40af;
  border: 2px solid #f3f4f6;
  /* CSS Pattern for card back */
  background-image: repeating-linear-gradient(45deg, rgba(255,255,255,0.1) 0px, rgba(255,255,255,0.1) 2px, transparent 2px, transparent 4px);
}

.card-content {
  line-height: 1;
  font-weight: bold;
}

.card-top {
  align-self: flex-start;
  font-size: 0.9rem;
}

.card-bottom {
  align-self: flex-end;
  transform: rotate(180deg);
  font-size: 0.9rem;
}

.card-suit {
  display: block;
  font-size: 1.2rem;
  margin-top: -2px;
}

@media (min-width: 640px) {
  .card-top, .card-bottom { font-size: 1.1rem; }
  .card-suit { font-size: 1.5rem; }
}

.card-red { color: #dc2626; }
.card-black { color: black; }
.card-winner { box-shadow: 0 0 0 4px #facc15; z-index: 5; }
.card-placeholder {
    width: var(--card-width);
    height: var(--card-height);
    border: 2px dashed rgba(21, 128, 61, 0.4);
    border-radius: 6px;
    background-color: rgba(21, 128, 61, 0.2);
}

/* Animation for dealing cards (slide from center) */
@keyframes deal-slide {
  0% {
    transform: translate(var(--tx, 0), var(--ty, 0)) scale(0.2) rotate(180deg);
    opacity: 0;
  }
  100% {
    transform: translate(0, 0) scale(1) rotate(0deg);
    opacity: 1;
  }
}

.animate-deal {
  animation: deal-slide 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* Animation for community cards (flip reveal) */
@keyframes flip-reveal {
  0% {
    transform: scaleX(1);
    background-color: #1e40af;
    background-image: repeating-linear-gradient(45deg, rgba(255,255,255,0.1) 0px, rgba(255,255,255,0.1) 2px, transparent 2px, transparent 4px);
    border-color: #f3f4f6;
    color: transparent;
  }
  49% {
    transform: scaleX(0);
    background-color: #1e40af;
    background-image: repeating-linear-gradient(45deg, rgba(255,255,255,0.1) 0px, rgba(255,255,255,0.1) 2px, transparent 2px, transparent 4px);
    border-color: #f3f4f6;
    color: transparent;
  }
  50% {
    transform: scaleX(0);
    background-color: white;
    background-image: none;
    border-color: inherit;
    color: inherit;
  }
  100% {
    transform: scaleX(1);
    background-color: white;
    background-image: none;
    border-color: inherit;
    color: inherit;
  }
}

.animate-flip {
  animation: flip-reveal 0.8s ease-in-out;
}

/* Hide content during first half of flip */
.animate-flip .card-content {
    animation: fade-content 0.8s ease-in-out;
}

@keyframes fade-content {
    0%, 49% { opacity: 0; }
    50% { opacity: 1; }
    100% { opacity: 1; }
}

/* Player Nodes */
.player-node {
  position: absolute;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  transform: translate(-50%, -50%);
  transition: all 0.5s;
}

.player-hand {
  display: flex;
  margin-left: -32px; /* Increased offset for greater overlap */
  margin-bottom: 4px;
  position: relative;
  z-index: 10;
}

.player-hand > .card {
    margin-right: -28px; /* Significantly increased overlap */
}

/* Folded Card Style */
.player-hand.folded > .card {
    filter: grayscale(100%) brightness(0.6);
}

/* Avatar Wrapper to handle dealer badge positioning relative to avatar */
.avatar-wrapper {
    position: relative;
    width: 64px;
    height: 64px;
    z-index: 20;
}

.player-avatar {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  border: 4px solid #4b5563;
  background-color: #1f2937;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  box-shadow: 0 4px 6px rgba(0,0,0,0.3);
  transition: all 0.3s;
  overflow: hidden; /* Clips content inside circle */
}

.player-avatar.active {
  border-color: white;
  box-shadow: 0 0 15px rgba(255,255,255,0.6);
  transform: scale(1.05);
}

.player-avatar.winner {
  border-color: #4ade80;
  box-shadow: 0 0 20px rgba(74,222,128,0.6);
}

.player-avatar.folded {
  border-color: var(--danger);
  background-color: #450a0a; /* Dark Red */
  opacity: 1; 
  box-shadow: inset 0 0 10px rgba(0,0,0,0.8);
}
.player-avatar.folded .player-name, .player-avatar.folded .player-chips {
    opacity: 0.7;
    color: #e5e7eb;
}

.player-avatar.action-call { border-color: #22c55e; }
.player-avatar.action-raise { border-color: #eab308; }

.player-name {
  font-size: 0.75rem;
  font-weight: bold;
  color: white;
  max-width: 58px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.player-chips {
  font-size: 0.65rem;
  color: #facc15;
  font-family: monospace;
  font-weight: bold;
}

.dealer-badge {
  position: absolute;
  top: 0;
  right: 0;
  width: 22px;
  height: 22px;
  background: white;
  color: black;
  border-radius: 50%;
  font-size: 11px;
  font-weight: bold;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid #9ca3af;
  z-index: 30;
  /* Pull it out a bit to be visible */
  transform: translate(25%, -25%);
  box-shadow: 0 2px 4px rgba(0,0,0,0.4);
}

.action-bubble {
  position: absolute;
  bottom: 68px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 15;
  pointer-events: none;
}

.action-text {
  font-size: 1rem; /* Smaller font */
  font-weight: 800;
  text-transform: uppercase;
  color: white;
  padding: 2px 8px;
  border-radius: 4px;
  background: rgba(17, 24, 39, 0.7);
  backdrop-filter: blur(2px);
  text-shadow: 0 1px 2px rgba(0,0,0,0.8);
  white-space: nowrap;
}

.action-text.fold { color: #fecaca; background: rgba(127, 29, 29, 0.7); }

.bet-badge {
  /* margin-top: 8px; REMOVED to support absolute positioning better */
  height: 44px; /* Fix height to match chip SVG height roughly */
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

.chip-bg {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 1;
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.5));
    display: flex;
}

.bet-amount {
  font-size: 1.1rem;
  color: white;
  font-weight: bold;
  font-family: monospace;
  text-shadow: 0 1px 2px rgba(0,0,0,0.8);
  position: relative;
  z-index: 2;
  white-space: nowrap;
}