
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Arial', 'Microsoft YaHei', sans-serif;
  background: 
    radial-gradient(circle at 20% 20%, rgba(139, 69, 19, 0.1) 0%, transparent 50%),
    radial-gradient(circle at 80% 80%, rgba(139, 69, 19, 0.1) 0%, transparent 50%),
    linear-gradient(135deg, #2c1810 0%, #4a3427 25%, #6b4c35 50%, #8b5a3c 75%, #a0673f 100%);
  min-height: 100vh;
  color: #2c1810;
  position: relative;
}

body::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-image: 
    radial-gradient(circle at 25px 25px, rgba(139, 69, 19, 0.15) 2px, transparent 2px),
    radial-gradient(circle at 75px 75px, rgba(160, 103, 63, 0.1) 1px, transparent 1px);
  background-size: 50px 50px, 100px 100px;
  pointer-events: none;
  z-index: -1;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 20px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.header {
  text-align: center;
  margin-bottom: 30px;
  background: 
    linear-gradient(135deg, rgba(218, 165, 32, 0.9) 0%, rgba(240, 230, 140, 0.95) 100%);
  padding: 25px;
  border-radius: 20px;
  box-shadow: 
    0 10px 30px rgba(139, 69, 19, 0.3),
    inset 0 1px 0 rgba(255, 255, 255, 0.3);
  border: 2px solid rgba(139, 69, 19, 0.2);
  position: relative;
}

.header::before {
  content: '';
  position: absolute;
  top: 10px;
  left: 10px;
  right: 10px;
  bottom: 10px;
  border: 1px solid rgba(139, 69, 19, 0.2);
  border-radius: 15px;
  pointer-events: none;
}

.header h1 {
  color: #2c1810;
  font-size: 3em;
  margin-bottom: 15px;
  text-shadow: 
    2px 2px 4px rgba(139, 69, 19, 0.3),
    0 0 10px rgba(218, 165, 32, 0.5);
  font-weight: bold;
  letter-spacing: 2px;
}

.game-info {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 20px;
}

.current-player {
  font-size: 1.3em;
  font-weight: bold;
  color: #2c1810;
  text-shadow: 1px 1px 2px rgba(218, 165, 32, 0.3);
}

.current-player span {
  color: #8b4513;
  background: rgba(218, 165, 32, 0.2);
  padding: 8px 15px;
  border-radius: 25px;
  border: 1px solid rgba(139, 69, 19, 0.3);
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.1);
}

.game-controls {
  display: flex;
  gap: 10px;
}

/* 按钮样式 */
.btn {
  padding: 12px 24px;
  border: 2px solid rgba(139, 69, 19, 0.3);
  border-radius: 30px;
  cursor: pointer;
  font-size: 14px;
  font-weight: bold;
  transition: all 0.3s ease;
  background: linear-gradient(135deg, #d4a574 0%, #c8956d 100%);
  color: #2c1810;
  box-shadow: 
    0 4px 15px rgba(139, 69, 19, 0.2),
    inset 0 1px 0 rgba(255, 255, 255, 0.3);
  text-shadow: 0 1px 1px rgba(255, 255, 255, 0.3);
}

.btn:hover {
  transform: translateY(-2px);
  box-shadow: 
    0 6px 20px rgba(139, 69, 19, 0.3),
    inset 0 1px 0 rgba(255, 255, 255, 0.4);
  background: linear-gradient(135deg, #dab078 0%, #d4a574 100%);
}

.btn:active {
  transform: translateY(0);
  box-shadow: 
    0 2px 10px rgba(139, 69, 19, 0.3),
    inset 0 2px 4px rgba(0, 0, 0, 0.1);
}

.btn-primary {
  background: linear-gradient(135deg, #cd853f 0%, #b8860b 100%);
  border-color: rgba(139, 69, 19, 0.4);
}

.btn-primary:hover {
  background: linear-gradient(135deg, #daa520 0%, #cd853f 100%);
}

/* 主要内容区域 */
.main-content {
  flex: 1;
  display: flex;
  gap: 30px;
  align-items: flex-start;
}

.game-board-container {
  flex: 1;
  display: flex;
  justify-content: center;
  align-items: center;
  background: 
    radial-gradient(circle at center, rgba(240, 230, 140, 0.9) 0%, rgba(218, 165, 32, 0.85) 100%);
  padding: 40px;
  border-radius: 20px;
  box-shadow: 
    0 15px 35px rgba(139, 69, 19, 0.3),
    inset 0 1px 0 rgba(255, 255, 255, 0.2);
  border: 3px solid rgba(139, 69, 19, 0.2);
  position: relative;
}

.game-board-container::before {
  content: '';
  position: absolute;
  top: 15px;
  left: 15px;
  right: 15px;
  bottom: 15px;
  border: 1px solid rgba(139, 69, 19, 0.15);
  border-radius: 15px;
  pointer-events: none;
}

/* 棋盘样式 */
.game-board {
  position: relative;
  background: 
    linear-gradient(45deg, #deb887 25%, transparent 25%),
    linear-gradient(-45deg, #deb887 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #deb887 75%),
    linear-gradient(-45deg, transparent 75%, #deb887 75%),
    #d2b48c;
  background-size: 2px 2px;
  border: 4px solid #8b4513;
  border-radius: 15px;
  box-shadow: 
    0 10px 30px rgba(139, 69, 19, 0.4),
    inset 0 2px 4px rgba(0, 0, 0, 0.1),
    inset 0 0 20px rgba(139, 69, 19, 0.1);
  width: 480px;
  height: 480px;
  padding: 30px;
}

.game-board::before {
  content: '';
  position: absolute;
  top: 30px;
  left: 30px;
  width: 420px;
  height: 420px;
  background-image:
    repeating-linear-gradient(0deg, rgba(139, 69, 19, 0.6) 0px, rgba(139, 69, 19, 0.6) 1px, transparent 1px, transparent 30px),
    repeating-linear-gradient(90deg, rgba(139, 69, 19, 0.6) 0px, rgba(139, 69, 19, 0.6) 1px, transparent 1px, transparent 30px);
  pointer-events: none;
  border-top: 1px solid rgba(139, 69, 19, 0.6);
  border-right: 1px solid rgba(139, 69, 19, 0.6);
}

.grid-intersection {
  position: absolute;
  width: 30px;
  height: 30px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: all 0.3s ease;
  transform: translate(-50%, -50%);
}

.grid-intersection:hover {
  background: rgba(218, 165, 32, 0.3);
  box-shadow: 0 0 10px rgba(139, 69, 19, 0.3);
}

.grid-intersection.disabled {
  cursor: not-allowed;
}

.piece {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.4);
  transition: all 0.3s ease;
  flex-shrink: 0; 
  z-index: 10;
}

.piece.black {
  background: radial-gradient(circle at 30% 30%, #555, #000);
  border: 2px solid #222;
}

.piece.white {
  background: radial-gradient(circle at 30% 30%, #fff, #ddd);
  border: 2px solid #999;
}

.piece:hover {
  transform: scale(1.1);
}

/* 获胜棋子高亮 */
.piece.winning {
  box-shadow: 0 0 15px #ffd700, 0 0 25px #ffd700;
  animation: pulse 1s infinite;
}

@keyframes pulse {
  0%, 100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.1);
  }
}


.game-status {
  width: 300px;
  background: 
    linear-gradient(135deg, rgba(240, 230, 140, 0.95) 0%, rgba(218, 165, 32, 0.9) 100%);
  padding: 30px;
  border-radius: 20px;
  box-shadow: 
    0 15px 35px rgba(139, 69, 19, 0.3),
    inset 0 1px 0 rgba(255, 255, 255, 0.2);
  border: 2px solid rgba(139, 69, 19, 0.2);
  position: relative;
}

.game-status::before {
  content: '';
  position: absolute;
  top: 10px;
  left: 10px;
  right: 10px;
  bottom: 10px;
  border: 1px solid rgba(139, 69, 19, 0.15);
  border-radius: 15px;
  pointer-events: none;
}

.game-result {
  font-size: 1.4em;
  font-weight: bold;
  text-align: center;
  margin-bottom: 25px;
  min-height: 30px;
  color: #8b4513;
  text-shadow: 1px 1px 2px rgba(218, 165, 32, 0.3);
}

.score-board {
  background: 
    linear-gradient(135deg, rgba(218, 165, 32, 0.15) 0%, rgba(240, 230, 140, 0.15) 100%);
  padding: 25px;
  border-radius: 15px;
  border: 1px solid rgba(139, 69, 19, 0.2);
  box-shadow: inset 0 1px 3px rgba(139, 69, 19, 0.1);
}

.score-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 15px;
  font-size: 1.1em;
}

.score-item:last-child {
  margin-bottom: 0;
}

.player-name {
  color: #2c1810;
  font-weight: 600;
  text-shadow: 0 1px 1px rgba(218, 165, 32, 0.2);
}

.score {
  background: linear-gradient(135deg, #8b4513 0%, #a0522d 100%);
  color: white;
  padding: 8px 16px;
  border-radius: 25px;
  font-weight: bold;
  min-width: 35px;
  text-align: center;
  box-shadow: 
    0 3px 8px rgba(139, 69, 19, 0.3),
    inset 0 1px 0 rgba(255, 255, 255, 0.2);
  text-shadow: 0 1px 1px rgba(0, 0, 0, 0.3);
}


.modal {
  display: none;
  position: fixed;
  z-index: 1000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.6);
  animation: fadeIn 0.3s ease;
}

.modal-content {
  background-color: #fff;
  margin: 10% auto;
  padding: 0;
  border-radius: 15px;
  width: 90%;
  max-width: 500px;
  box-shadow: 0 15px 35px rgba(0, 0, 0, 0.3);
  animation: slideIn 0.3s ease;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 25px;
  border-bottom: 1px solid #e9ecef;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  border-radius: 15px 15px 0 0;
}

.modal-header h3 {
  margin: 0;
  font-size: 1.5em;
}

.close {
  color: white;
  font-size: 28px;
  font-weight: bold;
  cursor: pointer;
  line-height: 1;
}

.close:hover {
  opacity: 0.7;
}

.modal-body {
  padding: 30px 25px;
  text-align: center;
}

.winner-message {
  font-size: 1.5em;
  font-weight: bold;
  margin-bottom: 25px;
  color: #2c3e50;
}

.modal-buttons {
  display: flex;
  gap: 15px;
  justify-content: center;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateY(-50px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* 响应式设计 */
@media (max-width: 768px) {
  .main-content {
    flex-direction: column;
  }
  
  .game-status {
    width: 100%;
  }
  
  .game-board {
    width: 300px;
    height: 300px;
  }
  
  .grid-cell {
    width: 20px;
    height: 20px;
  }
  
  .piece {
    width: 18px;
    height: 18px;
  }
  
  .game-info {
    flex-direction: column;
    text-align: center;
  }
  
  .header h1 {
    font-size: 2em;
  }
}
