* {
  margin: 0;
  padding: 0;

}

body {
  background: linear-gradient(135deg, #f1f2f3, #dbe1e8);
}

.warpbox{
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 30px;
  min-width: 1300px;
  color: #333;
  box-sizing: border-box;
}

header {
  text-align: center;
  margin: 20px 0;
  width: 100%;
}

h1 {
  font-size: 2.2rem;
  margin-bottom: 10px;
  color: #2c3e50;
  text-shadow: 3px 3px 6px rgba(0, 0, 0, 0.1);
  background: linear-gradient(45deg, #3498db, #9b59b6);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  position: relative;
}

.subtitle {
  font-size: 1rem;
  color: #5a6268;
  max-width: 95%;
  margin: 0 auto;
  line-height: 1.7;
}

.game-container {
  max-width: 1500px;
  min-width: 1200px;
  margin-top: 20px;
  text-align: center;
}

.game-board {
  background: linear-gradient(145deg, #2c3e50, #1a2530);
  border-radius: 20px;
  box-shadow: 0 15px 40px rgba(0, 0, 0, 0.25);
  padding: 25px;
  display: inline-block;
  transition: transform 0.3s ease;
}

.tile-container {
  position: relative;
  background: #34495e;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: inset 0 0 15px rgba(0, 0, 0, 0.4);
  /* 确保棋盘是正方形 */
  aspect-ratio: 1/1;
}

.tile-row {
  display: flex;
  height: calc(100% / var(--board-size));
}

.tile {
  background: linear-gradient(145deg, #3498db, #2980b9);
  color: white;
  display: flex;
  justify-content: center;
  align-items: center;
  font-weight: bold;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.15);
  position: relative;
  overflow: hidden;
  border-radius: 8px;
  margin: 3px;
  flex: 1;
  /* 移动动画 */
  transition: transform 0.2s ease;
}

.tile.moving {
  transform: scale(0.95);
  opacity: 0.9;
}

.tile:after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.2) 0%, rgba(255, 255, 255, 0) 50%);
  pointer-events: none;
  border-radius: 7px;
}

.tile:hover {
  background: linear-gradient(145deg, #3ca0db, #2d8ac7);
  transform: scale(0.97);
  box-shadow: 0 0 15px rgba(52, 152, 219, 0.5);
}

.tile.empty {
  background: transparent;
  box-shadow: none;
  cursor: default;
}

.tile.empty:after {
  display: none;
}

.controls {
  display: flex;
  width: 100%;
  gap: 30px;
  margin-top: 40px;
}

.panel {
  background: rgba(255, 255, 255, 0.92);
  border-radius: 18px;
  padding: 20px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.12);
  backdrop-filter: blur(5px);
  border: 1px solid rgba(255, 255, 255, 0.3);
}

.panel h2 {
  font-size: 1.6rem;
  margin-bottom: 20px;
  color: #2c3e50;
  display: flex;
  align-items: center;
  gap: 12px;
}

.modes {
  display: flex;
  flex-wrap: wrap;
  gap: 15px;
}

.mode-btn {
  flex: 1;
  min-width: 140px;
  padding: 18px 10px;
  border: none;
  border-radius: 10px;
  background: linear-gradient(to bottom, #ecf0f1, #dfe6e9);
  color: #2c3e50;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  font-size: 1.1rem;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.08);
}

.mode-btn:hover {
  background: linear-gradient(to bottom, #d5dbdb, #c8d0d3);
  transform: translateY(-3px);
  box-shadow: 0 6px 12px rgba(0, 0, 0, 0.1);
}

.mode-btn.active {
  background: linear-gradient(to bottom, #3498db, #2980b9);
  color: white;
}

.stats {
  display: flex;
  gap:15px;
  justify-content: space-between;
  margin-top: 25px;
  font-size: 1.2rem;
}

.stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  background: rgba(236, 240, 241, 0.7);
  padding: 20px 15px;
  border-radius: 10px;
  width: 48%;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.05);
}

.stat-value {
  font-size: 2.2rem;
  font-weight: 700;
  color: #3498db;
}

.stat-label {
  font-size: 1rem;
  color: #7f8c8d;
  margin-top: 10px;
}

.actions {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.action-btn {
  padding: 18px;
  border: none;
  border-radius: 12px;
  font-size: 1.25rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 12px;
  box-shadow: 0 6px 12px rgba(0, 0, 0, 0.1);
}

.action-btn:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 16px rgba(0, 0, 0, 0.15);
}

.shuffle-btn {
  background: linear-gradient(to right, #9b59b6, #8e44ad);
  color: white;
}

.shuffle-btn:hover {
  background: linear-gradient(to right, #8e44ad, #7d3c98);
}

.solve-btn {
  background: linear-gradient(to right, #2ecc71, #27ae60);
  color: white;
}

.solve-btn:hover {
  background: linear-gradient(to right, #27ae60, #219653);
}

.instructions {
  margin-top: 25px;
  line-height: 1.7;
  color: #5a6268;
  font-size: 1.05rem;
  background: rgba(236, 240, 241, 0.6);
  padding: 10px 15px;
  border-radius: 12px;
}

.instructions p {
  margin: 4px 0;
  display: flex;
  align-items: flex-start;
}

.instructions p:before {
  content: "•";
  margin-right: 10px;
  font-size: 1.2rem;
  color: #3498db;
}

.instructions p:first-child:before{
  display: none;
}

.win-message {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.85);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 1000;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.5s ease;
}

.win-message.show {
  opacity: 1;
  pointer-events: all;
}

.win-content {
  background: linear-gradient(135deg, #1a2a3a, #2c3e50);
  border-radius: 25px;
  padding: 50px;
  text-align: center;
  max-width: 600px;
  transform: scale(0.8);
  transition: transform 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
  border: 2px solid rgba(255, 255, 255, 0.1);
  color: white;
}

.win-message.show .win-content {
  transform: scale(1);
}

.win-content h2 {
  font-size: 3.5rem;
  color: #2ecc71;
  margin-bottom: 25px;
  text-shadow: 0 0 20px rgba(46, 204, 113, 0.5);
}

.win-content p {
  font-size: 1.5rem;
  margin-bottom: 15px;
  color: #ecf0f1;
}

.win-stats {
  display: flex;
  justify-content: center;
  gap: 40px;
  margin: 30px 0;
}

.win-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  background: rgba(255, 255, 255, 0.1);
  padding: 20px;
  border-radius: 15px;
  min-width: 150px;
}

.win-stat-value {
  font-size: 2.5rem;
  font-weight: 700;
  color: #3498db;
  text-shadow: 0 0 10px rgba(52, 152, 219, 0.5);
}

.win-stat-label {
  font-size: 1.2rem;
  color: #bdc3c7;
  margin-top: 10px;
}

.close-btn {
  padding: 16px 45px;
  background: linear-gradient(to right, #3498db, #2980b9);
  color: white;
  border: none;
  border-radius: 12px;
  font-size: 1.3rem;
  cursor: pointer;
  transition: all 0.3s ease;
  margin-top: 20px;
  box-shadow: 0 6px 12px rgba(0, 0, 0, 0.2);
}

.close-btn:hover {
  background: linear-gradient(to right, #2980b9, #2573a7);
  transform: translateY(-3px);
  box-shadow: 0 8px 16px rgba(0, 0, 0, 0.3);
}

footer {
  text-align: center;
  color: #7f8c8d;
  font-size: 0.9rem;
  padding: 30px 20px;
  width: 100%;
}

.confetti {
  position: absolute;
  width: 10px;
  height: 10px;
  background: #f00;
  border-radius: 50%;
  animation: fall 5s linear forwards;
}

@keyframes fall {
  to {
    transform: translateY(100vh) rotate(360deg);
    opacity: 0;
  }
}
