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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', sans-serif;
  background: linear-gradient(135deg, #2c1810 0%, #1a0f0a 100%);
  min-height: 100vh;
  color: #e8d5b7;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 20px;
}

/* 登录/注册页 */
.auth-page {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
}

.auth-box {
  background: rgba(0,0,0,0.6);
  border: 2px solid #8b6914;
  border-radius: 12px;
  padding: 40px;
  width: 360px;
  text-align: center;
}

.auth-box h1 {
  font-size: 28px;
  color: #d4a843;
  margin-bottom: 8px;
}

.auth-box .subtitle {
  color: #a08060;
  margin-bottom: 30px;
  font-size: 14px;
}

.auth-box input {
  width: 100%;
  padding: 12px 16px;
  margin-bottom: 12px;
  border: 1px solid #5a4020;
  border-radius: 6px;
  background: rgba(40,25,10,0.8);
  color: #e8d5b7;
  font-size: 16px;
}

.auth-box input:focus {
  outline: none;
  border-color: #d4a843;
}

.auth-box button {
  width: 100%;
  padding: 12px;
  margin-top: 8px;
  background: linear-gradient(135deg, #8b6914, #d4a843);
  border: none;
  border-radius: 6px;
  color: #1a0f0a;
  font-size: 16px;
  font-weight: bold;
  cursor: pointer;
  transition: transform 0.2s;
}

.auth-box button:hover {
  transform: scale(1.02);
}

.auth-box .link {
  margin-top: 16px;
  color: #a08060;
  font-size: 14px;
}

.auth-box .link a {
  color: #d4a843;
  text-decoration: none;
}

/* 大厅页 */
.lobby-page {
  text-align: center;
  padding-top: 60px;
}

.lobby-page h1 {
  font-size: 36px;
  color: #d4a843;
  margin-bottom: 8px;
}

.lobby-page .username-display {
  color: #a08060;
  margin-bottom: 40px;
}

.mode-buttons {
  display: flex;
  gap: 30px;
  justify-content: center;
  flex-wrap: wrap;
  margin-top: 40px;
}

.mode-btn {
  background: rgba(0,0,0,0.6);
  border: 2px solid #8b6914;
  border-radius: 12px;
  padding: 30px 50px;
  cursor: pointer;
  transition: all 0.3s;
}

.mode-btn:hover {
  border-color: #d4a843;
  transform: translateY(-4px);
}

.mode-btn h2 {
  font-size: 22px;
  color: #d4a843;
  margin-bottom: 8px;
}

.mode-btn p {
  color: #a08060;
  font-size: 14px;
}

/* 难度选择 */
.difficulty-modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0,0,0,0.8);
  justify-content: center;
  align-items: center;
  z-index: 100;
}

.difficulty-modal.show {
  display: flex;
}

.difficulty-box {
  background: rgba(40,25,10,0.95);
  border: 2px solid #8b6914;
  border-radius: 12px;
  padding: 30px;
  text-align: center;
}

.difficulty-box h2 {
  color: #d4a843;
  margin-bottom: 20px;
}

.difficulty-box button {
  display: block;
  width: 200px;
  padding: 12px;
  margin: 10px auto;
  background: linear-gradient(135deg, #5a4020, #8b6914);
  border: none;
  border-radius: 6px;
  color: #e8d5b7;
  font-size: 16px;
  cursor: pointer;
}

.difficulty-box button:hover {
  background: linear-gradient(135deg, #8b6914, #d4a843);
  color: #1a0f0a;
}

/* 房间列表 */
.rooms-page h1 {
  text-align: center;
  color: #d4a843;
  margin-bottom: 20px;
}

.rooms-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

.back-btn, .logout-btn {
  padding: 10px 20px;
  background: rgba(0,0,0,0.6);
  border: 1px solid #5a4020;
  border-radius: 6px;
  color: #e8d5b7;
  cursor: pointer;
  text-decoration: none;
}

.rooms-list {
  display: grid;
  gap: 12px;
}

.room-item {
  background: rgba(0,0,0,0.6);
  border: 1px solid #5a4020;
  border-radius: 8px;
  padding: 16px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.room-item .room-name {
  font-size: 18px;
  color: #d4a843;
}

.room-item .room-info {
  color: #a08060;
  font-size: 14px;
}

.room-item .room-actions button {
  padding: 8px 16px;
  margin-left: 8px;
  background: linear-gradient(135deg, #5a4020, #8b6914);
  border: none;
  border-radius: 4px;
  color: #e8d5b7;
  cursor: pointer;
}

.create-room-form {
  margin-top: 20px;
  display: flex;
  gap: 10px;
}

.create-room-form input {
  flex: 1;
  padding: 10px;
  background: rgba(40,25,10,0.8);
  border: 1px solid #5a4020;
  border-radius: 6px;
  color: #e8d5b7;
}

/* 游戏页 */
.game-page {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 20px;
}

.game-header {
  display: flex;
  justify-content: space-between;
  width: 100%;
  max-width: 600px;
  margin-bottom: 15px;
}

.game-info {
  text-align: center;
  background: rgba(0,0,0,0.6);
  border: 1px solid #5a4020;
  border-radius: 8px;
  padding: 10px 20px;
}

.game-info .turn {
  font-size: 16px;
  color: #d4a843;
}

.game-info .mode {
  font-size: 12px;
  color: #a08060;
}

.board-container {
  position: relative;
  background: #f5e6c8;
  border: 4px solid #8b6914;
  border-radius: 4px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.5);
  display: inline-block;
}

canvas {
  display: block;
  max-width: 100%;
  height: auto;
}

.game-sidebar {
  display: flex;
  gap: 20px;
  margin-top: 15px;
  width: 100%;
  max-width: 600px;
  justify-content: center;
}

.captured-pieces {
  background: rgba(0,0,0,0.6);
  border: 1px solid #5a4020;
  border-radius: 8px;
  padding: 10px 15px;
  min-width: 120px;
}

.captured-pieces h4 {
  color: #d4a843;
  font-size: 12px;
  margin-bottom: 6px;
}

.captured-pieces .pieces {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  font-size: 20px;
}

.game-controls {
  display: flex;
  gap: 10px;
  margin-top: 15px;
}

.game-controls button {
  padding: 10px 24px;
  background: linear-gradient(135deg, #5a4020, #8b6914);
  border: none;
  border-radius: 6px;
  color: #e8d5b7;
  cursor: pointer;
  font-size: 14px;
}

.game-controls button:hover {
  background: linear-gradient(135deg, #8b6914, #d4a843);
  color: #1a0f0a;
}

/* 消息提示 */
.message {
  position: fixed;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(139, 105, 20, 0.95);
  color: #1a0f0a;
  padding: 12px 24px;
  border-radius: 8px;
  font-weight: bold;
  z-index: 1000;
  display: none;
}

.message.show {
  display: block;
}