* {
  margin: 0;
  padding: 0;
}

body {
  user-select: none;
  -webkit-user-select: none;
  font-family: Cochin, "Times New Roman", Times, serif;
  font-size: 14px;
  min-height: 90vh;
  height: 90vh;
  display: flex;
  flex-direction: column;
}

.top-area {
  width: 320px;
  text-align: center;
  font-size: 36px;
  font-weight: bold;
  color: #333;
}

#main-container {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 20px;
  padding: 10px;
}

.game-area {
  display: flex;
  flex-direction: column;
  gap: 20px;
  align-items: center;
  position: relative;
  z-index: 2;
}

.grid-container {
  position: relative;
  display: grid;
  grid-template-columns: repeat(4, 80px);
  grid-template-rows: repeat(4, 80px);
  gap: 1px;
  background-color: #333;
  padding: 1px;
  border: 2px solid #333;
  z-index: 1;
}

@media screen and (min-width: 800px) {
  .top-area {
    width: 100%;
  }

  .game-area {
    flex-direction: row;
    gap: 40px;
  }

  .grid-row.top-pieces,
  .grid-row.bottom-pieces {
    display: flex;
    flex-direction: column;
  }

  .grid-row {
    display: flex;
    flex-direction: column;
    grid-template-columns: unset;
    grid-template-rows: unset;
  }


  .grid-row.top-pieces {
    order: 2;
  }

  .grid-row.bottom-pieces {
    order: 0;
  }

  .grid-container {
    order: 1;
  }
}

.info-area {
  width: 320px;
  min-height: 50px;
  display: flex;
  flex-direction: column;
  gap: 40px;
  margin-top: 10px;
  text-align: center;
  font-size: 20px;
  color: #333;
  z-index: 3;
}

.status-text {
  text-align: center;
  height: 30px;
  font-size: 20px;
  color: #333;
}

.grid-row.top-pieces,
.grid-row.bottom-pieces {
  display: flex;
  gap: 10px;
  grid-template-columns: repeat(4, 60px);
  grid-template-rows: 60px;
}

.grid-row.top-pieces .blue-square,
.grid-row.bottom-pieces .blue-square,
.grid-row.top-pieces .red-square,
.grid-row.bottom-pieces .red-square {
  width: 60px;
  height: 60px;
}

.grid-row .blue-square,
.grid-row .red-square {
  transform: none;
}

.grid-container .blue-square,
.grid-container .red-square {
  width: 70px;
  height: 70px;
}

.grid-container {
  position: relative;
  /* 添加这行 */
  display: grid;
  grid-template-columns: repeat(4, 80px);
  grid-template-rows: repeat(4, 80px);
  gap: 1px;
  background-color: #333;
  padding: 1px;
  border: 2px solid #333;
}

.grid-row {
  display: grid;
  grid-template-rows: repeat(4, 80px);
  gap: 4px;
  background-color: transparent;
  padding: 1px;
}

.grid-cell {
  background-color: transparent;
  width: 100%;
  height: 100%;
}

.grid-container .grid-cell {
  background-color: #ffffff;
  display: flex;
  justify-content: center;
  align-items: center;
}

.piece-cell {
  position: relative;
  width: 60px;
  height: 60px;
  display: flex;
  justify-content: center;
  align-items: center;
}

.cell-number {
  position: absolute;
  bottom: 4px;
  right: 4px;
  color: #333;
  font-size: 16px;
  font-weight: bold;
}

.blue-square {
  position: relative;
  width: 70px;
  height: 70px;
  background-color: #333;
  border-radius: 10px;
  border: 2px solid #333;
  /* 深蓝色边框 */
  box-shadow: 0px 3px 0px rgba(0, 0, 0, 0.2);
}

.red-square {
  position: relative;
  width: 70px;
  height: 70px;
  background-color: #fff;
  border-radius: 10px;
  border: 2px solid #333;
  /* 深红色边框 */
  box-shadow: 0px 3px 0px rgba(0, 0, 0, 0.2);
}

/* 选中状态的边框样式也需要调整 */
.piece-cell.selected .blue-square {
  border: 3px solid #333;
  /* 浅蓝白色 */
  box-shadow: 0 0 0 2px #333;
}

.piece-cell.selected .red-square {
  border: 3px solid #333;
  /* 浅红白色 */
  box-shadow: 0 0 0 2px #333;
}

.piece-cell.selected {
  outline: none;
}

.dot-indicator {
  width: 10px;
  height: 10px;
  opacity: 0.5;
  border-radius: 50%;
  position: absolute;
  background-color: #333;
}

.red-square.x-mark::before,
.red-square.x-mark::after,
.red-square.plus-mark::before,
.red-square.plus-mark::after{
  background-color: #333;
}
.red-square.circle-mark::before,
.red-square.big-circle-mark::before {
  border-color: #333;
}

.x-mark::before,
.x-mark::after {
  content: '';
  position: absolute;
  width: 6px;
  height: 60px;
  background-color: white;
  top: 50%;
  left: 50%;
  border-radius: 4px;
}

.x-mark::before {
  transform: translate(-50%, -50%) rotate(45deg);
}

.x-mark::after {
  transform: translate(-50%, -50%) rotate(-45deg);
}

.plus-mark::before,
.plus-mark::after {
  content: '';
  position: absolute;
  background-color: white;
  border-radius: 2px;
}

.plus-mark::before {
  width: 50px;
  height: 6px;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
}

.plus-mark::after {
  width: 6px;
  height: 50px;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
}

.circle-mark::before {
  content: '';
  position: absolute;
  width: 12px;
  height: 12px;
  border: 8px solid white;
  border-radius: 50%;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
}

.big-circle-mark::before {
  content: '';
  position: absolute;
  width: 36px;
  height: 36px;
  border: 8px solid white;
  border-radius: 50%;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
}

.grid-row .blue-square,
.grid-row .red-square {
  transform: scale(0.9);
}

.grid-container .blue-square,
.grid-container .red-square {
  transform: none;
}

.piece-cell .number-indicator {
  position: absolute;
  bottom: 6px;
  right: 6px;
  width: 15px;
  height: 15px;
  text-align: center;
  color: #fff;
  border-radius: 50%;
  font-size: 14px;
  font-weight: bold;
  background-color: #333;
  border: none;
}

.blue-square+.number-indicator {
  background-color: #333;
  color: #fff;
}

.red-square+.number-indicator {
  background-color: #fff;
  color: #333;
}

/* 添加基础状态的过渡效果 */
.blue-square,
.red-square {
  transition: all 0.1s ease;
}

.piece-cell.selected .x-mark::before,
.piece-cell.selected .x-mark::after,
.piece-cell.selected .plus-mark::before,
.piece-cell.selected .plus-mark::after,
.piece-cell.selected .circle-mark::before,
.piece-cell.selected .big-circle-mark::before {
  border-color: #fff;
}

.grid-container .grid-cell.has-dot:hover {
  background-color: #eee;
  cursor: pointer;
}

.spy-area {
  position: fixed;
  text-align: center;
  height: 20px;
  bottom: 20px;
  left: 0;
  right: 0;
  color: #ddd;
  font-size: 14px;
}