body {
  font-family: sans-serif;
  margin: 0; /* remove default margin */
  padding: 0; /* remove padding so grid can expand */
  display: flex;
  flex-direction: column;
  align-items: center;
  height: 100vh; /* ensure full height */
}

#share-popup-container {
  display: none;
}

#close-share-popup,
#close-rules-popup {
  position: absolute;
  top: 10px;
  right: 10px;

  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2em;
  height: 2em;
  border-radius: 50%;
  background-color: #d9a9d2;
  font-weight: bold;
  cursor: pointer;
}

#close-share-popup span {
  color: black;
  font-size: 1.5em;
}

#share-button {
  display: none;
  cursor: pointer;
  border-radius: 100px;
  background-color: #000;
  color: white;
  width: 10em;
  height: 3em;
  border: none;
  margin-bottom: 30px;
}

#continue-button {
  display: block;
  cursor: pointer;
  border-radius: 100px;
  background-color: #000;
  color: white;
  width: 10em;
  height: 3em;
  border: none;
  margin-top: 10px;
  margin-bottom: 30px;
}

#share-icon {
  vertical-align: middle;
  margin-left: 10px;
  color: white;
}

#game-result-share {
  text-align: left;
}

.grid-container {
  display: grid;
  grid-template-columns: repeat(6, 1fr); /* 6 equal-width columns */
  gap: 10px;
  padding-top: 80px; /* leave room for navbar */
  width: 90%;
  box-sizing: border-box;
}

@media (min-width: 600px) {
  .grid-container {
    width: 50%;
  }
}
.cell {
  border: 3px solid #333;
  border-radius: 5px;
  /* background-color: #333; */
  display: flex;
  justify-content: center;
  align-items: center;
  font-size: 1.25rem;
  font-weight: bold;
  cursor: grab;
  aspect-ratio: 2 / 3;
  max-width: 50px;
  touch-action: none; /* prevent scrolling when touching */
  user-select: none; /* prevent text highlighting */
  white-space: pre-line;
}

.cell.selected {
  outline: 3px solid #f5793a;
  outline-offset: -3px;
  background-color: #ffe6cc;
}

.row-hand,
.col-hand {
  background: #eee;
  font-size: 12px;
  display: flex;
  justify-content: center;
  align-items: center;
  text-align: center;
}
.dragging {
  opacity: 0.5;
}
#stats-container {
  display: flex;
  justify-content: center; /* center both tables */
  gap: 40px;
  margin-top: 20px;
  flex-wrap: wrap;
}

#stats-container table {
  border-collapse: collapse;
  text-align: center;
  min-width: 150px;
  table-layout: fixed; /* ensures cells shrink proportionally */
}

/* Horizontal table: th on top, td in a single row */
#stats-container th,
#stats-container td {
  border: 1px solid #333;
  padding: 6px 8px;
  font-size: 1em;
  white-space: nowrap; /* prevent line breaks inside cells */
}

#stats-container th {
  background-color: #f0f0f0;
  font-weight: bold;
}

@media (max-width: 600px) {
  #stats-container table {
    transform: scale(0.9); /* shrink table proportionally */
    transform-origin: top center;
  }
}

#navbar {
  display: flex;
  justify-content: center;
  align-items: center;
  /* background-color: #f5793a; */
  background-color: #e15b9e;

  /* background-color: #d97840; */
  color: #fff;
  padding: 10px;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  z-index: 1;
}

#navbar-logo {
  font-size: 1.5em;
  font-weight: bold;
  margin-right: auto;
  padding-left: 2rem;
}

.navbar-icon {
  width: 50px;
  height: 50px;
  /* margin-right: auto; */
  padding-right: 2rem;
}

.navbar-back {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.5em;
  height: 2.5em;
  border-radius: 50%;
  background-color: white;
  /* margin-right: 2rem; */
  font-weight: bold;
  cursor: pointer;
}

.navbar-back span {
  color: black;
  font-size: 1.5em;
  display: inline-block;
  transform: rotate(180deg);
}

.cell.swap-anim {
  animation: pop 120ms ease-out;
}

@keyframes pop {
  0% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.25);
  }
  100% {
    transform: scale(1);
  }
}

/* Dropdown styles */
.dropdown-content {
  display: none;
  position: absolute;
  top: 100%;
  right: 2.5em;
  border: 2px solid #000;
  border-radius: 12px;
  /* background-color: #b5d9a9; */
  /* min-width: 120px; */
  overflow: hidden;
  box-shadow: 0px 8px 16px rgba(0, 0, 0, 0.2);
  z-index: 2;
  flex-direction: column;
  /* padding-right: 2em; */
}

.dropdown-content button {
  color: #000;
  /* background-color: #b5d9a9; */
  border: none;
  border-radius: 0px;
  padding: 15px;
  text-align: left;
  font-size: 1em;
  cursor: pointer;
  width: 100%;
  border-bottom: 1px solid #000; /* line between buttons */
}

/* Remove the border from the last button */
.dropdown-content button:last-child {
  border-bottom: none;
}

.dropdown-content button:hover {
  background-color: #d9a9d2;
  /* background-color: #b5d9a9; */
}

#rules-popup-container,
#pause-popup-container {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.75);
  justify-content: center;
  align-items: center;
  z-index: 2;
  overflow: auto;
}

#rules-popup,
#pause-popup {
  position: relative;
  margin-top: 400px;
  background: #fff;
  padding: 20px;
  border-radius: 8px;
  box-shadow: 0 0 10px rgba(0, 0, 0, 0.5);
  text-align: left;
  overflow: auto;
}

#pause-popup {
      margin-top: 100px;

}

#close-rules-popup {
  position: absolute;
  top: 10px;
  right: 10px;
  cursor: pointer;
  font-size: 20px;
  font-weight: bold;
  color: #000;
}

.hand-table {
  width: 100%;
  border-collapse: collapse;
}

.hand-table th,
.hand-table td {
  border: 1px solid #000;
  padding: 6px;
  text-align: left;
}
