/* Reset & 基本設定 */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}
body {
  font-family: "Segoe UI", sans-serif;
  background-color: #f9f9f9;
  color: #333;
  line-height: 1.6;
  padding: 2rem;
}

main {
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* 標題 */
h1 {
  font-size: 2.5rem;
  margin-bottom: 1rem;
  color: #444;
}

/* 控制區域 */
.upload-container {
  margin-bottom: 1.5rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 10px;
  background-color: #ffffff;
  padding: 15px 20px;
  border-radius: 8px;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.05);
}

label[for="difficulty"] {
  font-weight: bold;
}

.upload-input,
#difficulty,
#start-btn {
  cursor: pointer;
  border: 1px solid #ccc;
  padding: 0.5rem 0.8rem;
  font-size: 1rem;
  border-radius: 6px;
  background-color: #fff;
  transition: all 0.2s ease-in-out;
}

#difficulty {
  width: 60px;
  text-align: center;
}

.upload-input:hover,
#start-btn:hover {
  background-color: #e2e2e2;
}

#start-btn {
  background-color: #4caf50;
  color: white;
  border: none;
  cursor: pointer;
}
#start-btn:hover {
  background-color: #43a047;
}

/* 預覽區域 */
#preview-area {
  position: fixed;
  top: 20px;
  right: 20px;
  background-color: rgba(255, 255, 255, 0.95);
  border: 2px solid #ccc;
  padding: 10px;
  border-radius: 8px;
  text-align: center;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  z-index: 999;
}

#preview-area p {
  font-size: 1rem;
  font-weight: bold;
  color: #333;
  margin-bottom: 8px;
}

#preview {
  border-radius: 4px;
  border: 1px solid #aaa;
  width: 150px;
  height: 150px;
  object-fit: cover;
}


/* 拼圖容器 */
.game-container {
  width: 900px;
  height: 900px;
  border: 3px solid #222;
  border-radius: 10px;
  overflow: hidden;
  background-color: #fff;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.1);
}

/* 拼圖格 */
#puzzle-board {
  position: relative;
  width: 900px;
  height: 900px;
  display: grid;
  grid-template-columns: repeat(3, 1fr); /* 初始用 3x3 */
  grid-template-rows: repeat(3, 1fr);
  background-color: #eee;
  border: 2px dashed #ccc;
  place-items: center; /* 讓子元素自動居中 */
}

#start-hint {
  grid-column: 2;
  grid-row: 2;
  font-size: 1.2rem;
  color: #777;
  text-align: center;
}

/* 單個拼圖塊 */
.tile {
  width: 100%;
  height: 100%;
  background-size: 900px 900px;
  background-repeat: no-repeat;
  cursor: grab;
  transition: transform 0.1s ease;
  border: 1px solid #999;
}
.tile:active {
  transform: scale(1.03);
  cursor: grabbing;
}

/* 完成提示（未來用） */
#message {
  margin-top: 1rem;
  font-size: 1.2rem;
  color: #28a745;
  font-weight: bold;
}
