:root {
  --primary-color: #4a90e2;
  --primary-hover: #357abd;
  --bg-color: #1e1e24;
  --panel-bg: #2b2b36;
  --text-color: #ffffff;
  --board-bg: #1a1a1f;
  --border-radius: 12px;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  background-color: var(--bg-color);
  color: var(--text-color);
  display: flex;
  height: 100vh;
  overflow: hidden;
}

.app-container {
  display: flex;
  width: 100%;
  height: 100%;
}

.sidebar {
  width: 300px;
  background-color: var(--panel-bg);
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  box-shadow: 2px 0 10px rgba(0,0,0,0.5);
  z-index: 10;
}

.sidebar h2 {
  font-size: 24px;
  font-weight: 600;
  text-align: center;
  margin-bottom: 10px;
  letter-spacing: 1px;
}

.preview-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.preview-container p {
  font-size: 14px;
  color: #aaa;
}

.preview-container img {
  width: 100%;
  max-width: 250px;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.3);
  border: 2px solid #444;
}

.controls {
  display: flex;
  flex-direction: column;
  gap: 15px;
  margin-top: 20px;
}

.controls label {
  font-size: 14px;
}

select {
  padding: 10px;
  border-radius: 6px;
  border: 1px solid #555;
  background-color: #333;
  color: white;
  font-size: 16px;
  outline: none;
}

.btn {
  padding: 12px 20px;
  border: none;
  border-radius: 8px;
  font-size: 16px;
  font-weight: bold;
  cursor: pointer;
  transition: all 0.3s ease;
}

.primary {
  background-color: var(--primary-color);
  color: white;
}

.primary:hover {
  background-color: var(--primary-hover);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(74, 144, 226, 0.4);
}

.status-message {
  margin-top: auto;
  padding: 15px;
  text-align: center;
  background-color: rgba(255, 255, 255, 0.05);
  border-radius: 8px;
  font-size: 14px;
  line-height: 1.5;
  min-height: 60px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background-color 0.3s;
}

.status-message.success {
  background-color: rgba(46, 204, 113, 0.2);
  color: #2ecc71;
  font-weight: bold;
}

.main-content {
  flex: 1;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 30px;
  background: radial-gradient(circle, #2a2a35 0%, #1e1e24 100%);
}

.puzzle-board {
  background-color: var(--board-bg);
  padding: 10px;
  border-radius: var(--border-radius);
  box-shadow: 0 10px 30px rgba(0,0,0,0.5);
  display: grid;
  gap: 2px;
  /* 寬高會由 JS 動態設定，保持圖片比例 */
}

.puzzle-piece {
  background-size: 100% 100%;
  background-repeat: no-repeat;
  cursor: grab;
  border-radius: 4px;
  transition: transform 0.1s;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.1);
  position: relative;
}

.puzzle-piece:active {
  cursor: grabbing;
  transform: scale(0.95);
  z-index: 100;
  box-shadow: 0 5px 15px rgba(0,0,0,0.5);
}

.puzzle-piece.drag-over {
  opacity: 0.7;
  transform: scale(1.05);
  box-shadow: 0 0 10px var(--primary-color);
  z-index: 50;
}
