:root {
  --board-size: 90vmin;
  --cell-size: calc(var(--board-size) / 10);
  --pawn-size: calc(var(--cell-size) * 0.4);
  --tile-color-1: #b81425;
  --tile-color-2: #de4ed9;
  --tile-color-3: #ffd000;
  --tile-color-4: #2c8c27;
  --tile-color-5: #1175f7;
  --tile-color-6: #732da8;
  --bg-color: #f7f7f7;
  --border-color: #333;
}

body {
  font-family: Arial, sans-serif;
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  background-color: var(--bg-color);
  color: var(--border-color);
  margin: 0;
}

#game-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  padding: 20px;
  width: 100%;
}

h1 {
  text-align: center;
}

#board-container {
  position: relative;
  width: var(--board-size);
  height: var(--board-size);
}

#board {
  display: grid;
  grid-template-columns: repeat(10, 1fr);
  grid-template-rows: repeat(10, 1fr);
  width: 100%;
  height: 100%;
  border: 2px solid var(--border-color);
}

.cell {
  width: var(--cell-size);
  height: var(--cell-size);
  box-sizing: border-box;
  border: 1px solid #ccc;
  position: relative;
  display: flex;
  justify-content: center;
  align-items: center;
  font-size: 1.5vmin;
  text-align: center;
}

#center-panel {
  position: absolute;
  top: var(--cell-size);
  left: var(--cell-size);
  width: calc(var(--board-size) - 2 * var(--cell-size));
  height: calc(var(--board-size) - 2 * var(--cell-size));
  background-color: #fff;
  border: 2px solid var(--border-color);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 10px;
  box-sizing: border-box;
}

#machine-tiles {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  justify-content: center;
  margin-bottom: 10px;
  min-height: 50px;
}

.pawn {
  width: var(--pawn-size);
  height: var(--pawn-size);
  border-radius: 50%;
  position: absolute;
  border: 2px solid white;
  box-shadow: 0 0 5px rgba(0, 0, 0, 0.5);
  transition: all 0.5s ease-in-out;
}

#players-panel {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 15px;
  width: 100%;
}

.player-info {
  border: 2px solid var(--border-color);
  padding: 10px;
  border-radius: 8px;
  min-width: 250px;
  max-width: 300px;
  background-color: #fff;
}

.player-tile-collection {
  margin-top: 10px;
  padding: 5px;
  border: 1px solid #ccc;
  border-radius: 4px;
  background-color: #f9f9f9;
}

.player-collection-row {
  display: flex;
  justify-content: flex-start;
  gap: 1px;
  margin-bottom: 1px;
}

.player-collection-tile {
  width: 18px !important;
  height: 18px !important;
  font-size: 8px !important;
  opacity: 0.25;
  transition: opacity 0.3s ease, box-shadow 0.3s ease;
  margin: 0.5px;
  border-radius: 2px;
}

.player-collection-tile.owned {
  opacity: 1;
}

.player-collection-tile.special-tile {
  border: 2px dotted gold !important;
  box-shadow: 0 0 2px rgba(255, 215, 0, 0.5);
}

.player-collection-tile.special-tile.owned {
  box-shadow: 0 0 3px rgba(255, 215, 0, 0.8);
}

.player-info h4 {
  margin: 0 0 10px 0;
  padding-bottom: 5px;
  border-bottom: 1px solid #ccc;
}

.player-tiles {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(40px, 1fr));
  gap: 5px;
  margin-top: 10px;
}

.tile {
  width: 40px;
  height: 40px;
  display: flex;
  justify-content: center;
  align-items: center;
  border-radius: 4px;
  font-size: 24px;
  font-weight: bold;
  color: black;
  border: 1px solid #333;
}

.tile.face-down {
  background-image: none !important;
  color: transparent;
}

.tile.face-down::after {
  content: "?";
  color: rgba(0, 0, 0, 0.3);
  font-size: 24px;
  font-weight: bold;
}

.tile.special-tile {
  border: 3px dotted gold !important;
  box-shadow: 0 0 5px rgba(255, 215, 0, 0.5);
}

/* Ensure face-down tiles don't show special styling */
.tile.face-down.special-tile {
  border: 1px solid #333 !important;
  box-shadow: none !important;
}

#tile-collection {
  display: none;
}

.tile-collection-row {
  display: flex;
  justify-content: center;
  gap: 2px;
  margin-bottom: 2px;
}

.collection-tile {
  width: 30px !important;
  height: 30px !important;
  font-size: 12px !important;
  opacity: 0.25;
  transition: opacity 0.3s ease, box-shadow 0.3s ease;
  margin: 1px;
}

.collection-tile.owned {
  opacity: 1;
}

.collection-tile.special-tile {
  border: 3px dotted gold !important;
  box-shadow: 0 0 3px rgba(255, 215, 0, 0.5);
}

.collection-tile.special-tile.owned {
  box-shadow: 0 0 5px rgba(255, 215, 0, 0.8);
}

#center-panel {
  position: absolute;
  top: var(--cell-size);
  left: var(--cell-size);
  width: calc(var(--board-size) - 2 * var(--cell-size));
  height: calc(var(--board-size) - 2 * var(--cell-size));
  background-color: #fff;
  border: 2px solid var(--border-color);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 10px;
  box-sizing: border-box;
}

#controls-panel {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 15px;
  border: 2px solid var(--border-color);
  border-radius: 8px;
  background-color: #fff;
}

#game-log {
  width: 100%;
  height: 60px;
  overflow-y: auto;
  border: 1px solid #ccc;
  padding: 5px;
  background-color: #f0f0f0;
}

/* Modal styles */
.modal {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: white;
  padding: 20px;
  border: 2px solid var(--border-color);
  border-radius: 10px;
  z-index: 101;
  min-width: 300px;
  max-width: 90%;
  text-align: center;
}

#modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  z-index: 100;
}

.hidden {
  display: none !important;
}

button {
  padding: 10px 15px;
  font-size: 16px;
  cursor: pointer;
  border-radius: 5px;
  border: 1px solid var(--border-color);
  background-color: #e0e0e0;
  margin: 5px;
}

button:hover {
  background-color: #d0d0d0;
}

/* Player setup styles */
.player-input {
  border: 2px solid #ccc;
  padding: 15px;
  margin: 10px 0;
  border-radius: 8px;
  background-color: #f9f9f9;
}

.player-input h4 {
  margin-top: 0;
}

.player-input input {
  margin: 5px;
  padding: 8px;
  border: 1px solid #ccc;
  border-radius: 4px;
  font-size: 14px;
}

.player-input label {
  display: block;
  margin: 5px 0;
  font-weight: bold;
}
.tile {
  width: 40px;
  height: 40px;
  display: flex;
  justify-content: center;
  align-items: center;
  border-radius: 4px;
  font-size: 24px;
  font-weight: bold;
  color: black;
  border: 1px solid #333;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
}

.tile.face-down {
  background-color: #888;
  background-image: none;
  color: #888;
}

.tile.face-down::after {
  content: "?";
}

/* Machine tiles (larger for better visibility) */
#machine-tiles .tile {
  width: 60px;
  height: 60px;
  font-size: 18px;
}

/* Auction modal tiles */
#auction-tiles .tile {
  width: 60px;
  height: 60px;
  font-size: 18px;
  margin: 5px;
}

/* Steal modal tiles */
#steal-options .tile {
  width: 60px;
  height: 60px;
  font-size: 18px;
  margin: 5px;
  cursor: pointer;
}

#steal-options .tile:hover {
  transform: scale(1.1);
  box-shadow: 0 0 10px rgba(0, 0, 0, 0.3);
}

/* Responsive */
@media (min-width: 1024px) {
  #game-container {
    flex-direction: row;
    align-items: flex-start;
  }
  #board-container {
    order: 2;
  }
  #players-panel {
    order: 1;
    flex-direction: column;
  }
  #controls-panel {
    order: 3;
  }
}

#sell-modal {
  max-width: 600px;
  max-height: 80vh;
  overflow-y: auto;
}

#sell-tiles-container {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(60px, 1fr));
  gap: 10px;
  margin: 20px 0;
  padding: 15px;
  border: 1px solid #ccc;
  border-radius: 5px;
  max-height: 300px;
  overflow-y: auto;
}

#sell-controls {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 15px;
}

#sell-total {
  font-weight: bold;
  font-size: 18px;
  color: #2c8c27;
}

#sell-tiles-btn {
  background-color: #2c8c27;
  color: white;
  border: none;
  padding: 10px 15px;
  border-radius: 5px;
  cursor: pointer;
  margin-bottom: 10px;
  font-size: 14px;
}

#sell-tiles-btn:hover {
  background-color: #1e5f1c;
}

#sell-tiles-btn:disabled {
  background-color: #ccc;
  cursor: not-allowed;
}

#confirm-sell-btn {
  background-color: #de4ed9;
  color: white;
  border: none;
  padding: 10px 20px;
  border-radius: 5px;
  cursor: pointer;
}

#confirm-sell-btn:hover:not(:disabled) {
  background-color: #c23dc2;
}

#confirm-sell-btn:disabled {
  background-color: #ccc;
  cursor: not-allowed;
}

#cancel-sell-btn {
  background-color: #666;
  color: white;
  border: none;
  padding: 10px 20px;
  border-radius: 5px;
  cursor: pointer;
}

#cancel-sell-btn:hover {
  background-color: #444;
}
