body {
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  height: 100vh;
  background-color: #f0f2f5;
}

.controls {
  padding: 15px;
  background-color: #fff;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
  display: flex;
  gap: 15px;
  align-items: center;
  justify-content: center;
  z-index: 10;
}

button {
  padding: 8px 16px;
  border: none;
  border-radius: 4px;
  background-color: #007bff;
  color: white;
  cursor: pointer;
  font-size: 14px;
  transition: background-color 0.2s;
}

button:hover {
  background-color: #0056b3;
}

#check-btn {
  background-color: #28a745;
}

#check-btn:hover {
  background-color: #218838;
}

.game-container {
  flex: 1;
  display: flex;
  overflow: hidden;
  padding: 20px;
  gap: 20px;
}

.panel {
  flex: 1;
  background-color: #fff;
  border-radius: 8px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
  position: relative;
  overflow: hidden;
  border: 2px dashed #ccc;
  display: flex;
  justify-content: center;
  align-items: center;
}

.left-panel {
  background-color: #fafafa;
}

.right-panel {
  background-color: #fff;
}

.placeholder-text,
.board-placeholder {
  color: #999;
  font-size: 1.2em;
  pointer-events: none;
}

/* 拼图块样式 */
.puzzle-piece {
  position: absolute;
  cursor: grab;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.2)) brightness(0.65)
    saturate(0.7); /* 未拼的块偏暗 */
  transition: transform 0.1s, filter 0.3s;
  touch-action: none; /* 防止触摸设备上的滚动 */
}

.puzzle-piece:hover {
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.2)) brightness(0.85)
    saturate(0.9); /* 悬停稍亮 */
}

.puzzle-piece:active {
  cursor: grabbing;
  z-index: 1000;
  transform: scale(1.05);
  filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.3)) brightness(1) saturate(1); /* 拖拽时正常亮度 */
}

/* 放置正确的拼图块 - 整体高亮，完全清晰 */
.puzzle-piece.snapped {
  z-index: 2 !important;
  cursor: default !important;
  pointer-events: none !important;
  filter: brightness(1.15) saturate(1.3) contrast(1.1)
    drop-shadow(0 2px 6px rgba(0, 0, 0, 0.2)) !important; /* 整体明亮、饱和、清晰 */
  transition: all 0.3s ease !important;
}

/* 游戏区域内的画布容器 */
#board-canvas-container {
  position: relative;
  box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
}

/* 网格高亮层容器 */
.highlight-container {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 1;
}

/* 单个高亮形状 */
.highlight-shape {
  position: absolute;
  opacity: 0;
  transition: opacity 0.1s;
  pointer-events: none;
}

.highlight-shape.active {
  opacity: 1;
}

/* 移除旧的 grid-cell 样式，但保留类名以防 JS 报错（虽然我们会修改 JS） */
.grid-cell {
  display: none;
}

.grid-cell {
  border: 1px solid rgba(255, 255, 255, 0.3);
  box-sizing: border-box;
  transition: background-color 0.2s;
}

.grid-cell.highlight {
  background-color: rgba(255, 255, 0, 0.3);
  border: 2px solid rgba(255, 255, 0, 0.8);
}

/* Toast 提示框 */
.toast {
  position: fixed;
  bottom: 30px;
  left: 50%;
  transform: translateX(-50%);
  background-color: rgba(0, 0, 0, 0.8);
  color: white;
  padding: 12px 24px;
  border-radius: 24px;
  font-size: 16px;
  z-index: 2000;
  opacity: 1;
  transition: opacity 0.3s, transform 0.3s;
}

.toast.hidden {
  opacity: 0;
  transform: translateX(-50%) translateY(20px);
  pointer-events: none;
}
