/* 地图挑战专属样式（公共组件、变量见 ../../style.css） */

#app {
  display: grid;
  grid-template-columns: 240px 1fr;
  gap: 20px;
  align-items: start;
  width: 100%;
  max-width: 1100px;
}

#sidebar {
  background: var(--panel);
  border-radius: 18px;
  padding: 22px 20px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.actions { display: flex; flex-direction: column; gap: 8px; }
.btn-row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.btn-row .btn { padding: 10px 8px; }

/* 进度圆点 */
.progress-dots { display: flex; flex-wrap: wrap; gap: 6px; }
.dot { width: 10px; height: 10px; border-radius: 50%; background: var(--border); transition: background .15s; }
.dot.done { background: var(--primary); }

.stat-value.muted { color: var(--primary); opacity: 0.4; }

/* 主区 */
#play-area {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 24px;
  background: var(--panel);
  border-radius: 18px;
  box-shadow: var(--shadow);
}

/* 地图容器 */
.map-container {
  width: 100%;
  background: #f8f5ee;
  border-radius: 14px;
  overflow: hidden;
  border: 1px solid var(--border);
}

#china-map {
  width: 100%;
  height: auto;
  display: block;
}

.map-outline {
  pointer-events: none;
  fill: none;
  stroke: #8c7f61;
  stroke-width: 1.5;
  opacity: 0.9;
}

.map-province {
  cursor: pointer;
  transition: fill .2s, opacity .2s;
}
.map-province.placed {
  cursor: default;
}
.map-province:not(.placed) {
  cursor: pointer;
}
.map-province:not(.placed):hover {
  opacity: 0.8 !important;
  fill: #e8d8a8 !important;
}

/* 入门点击模式：选中拼图块对应的省份高亮 */
.map-province.selected-target {
  animation: target-pulse 1s ease-in-out infinite;
}

@keyframes target-pulse {
  0%, 100% { opacity: 0.6; }
  50% { opacity: 0.9; }
}

/* 拼图块列表 */
.pieces-list {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 14px;
  min-height: 50px;
  align-items: center;
}

.piece-item {
  width: 72px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  cursor: grab;
  user-select: none;
  -webkit-user-select: none;
  touch-action: pan-y;
  transition: transform .12s, filter .15s;
}

.piece-item svg {
  width: 100%;
  height: 56px;
  display: block;
  filter: drop-shadow(0 1px 3px rgba(0,0,0,0.12));
  pointer-events: none;
}

.piece-label {
  color: #4a4035;
  line-height: 1.2;
  text-align: center;
  pointer-events: none;
  white-space: nowrap;
}

.piece-item:hover {
  transform: scale(1.08);
}

.piece-item:hover svg {
  filter: drop-shadow(0 2px 6px rgba(0,0,0,0.22));
}

.piece-item:active {
  cursor: grabbing;
  transform: scale(0.94);
}

.piece-item.dragging {
  opacity: 0.4;
}

.piece-item.selected svg {
  filter: drop-shadow(0 0 4px var(--primary));
}

.piece-item.selected svg path {
  stroke: var(--primary);
  stroke-width: 2.5;
}

.piece-item.hint svg path {
  stroke: #ff9800;
  stroke-width: 2.5;
  animation: hint-pulse 1s ease-in-out infinite;
}

@keyframes hint-pulse {
  0%, 100% { opacity: 0.85; }
  50% { opacity: 1; }
}

/* 胜利弹窗 */
.modal-content .win-record { color: var(--primary); font-size: 15px; min-height: 1.2em; }

/* 响应式 */
@media (max-width: 640px) {
  #app { grid-template-columns: 1fr; }
  #play-area { padding: 16px; }
  .map-container { border-radius: 10px; }
  .piece-item { width: 60px; height: 54px; }
  .pieces-list { }
}