/* UNO 游戏样式 */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: 'Arial', sans-serif;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  min-height: 100vh;
  color: #333;
}

.screen {
  display: block;
  max-width: 1200px;
  margin: 0 auto;
  padding: 20px;
}

.hidden {
  display: none !important;
}

/* 登录界面 */
#login-screen {
  text-align: center;
  padding-top: 100px;
}

#login-screen h1 {
  color: white;
  font-size: 3em;
  margin-bottom: 50px;
  text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
}

.login-form {
  background: white;
  padding: 40px;
  border-radius: 15px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.2);
  display: inline-block;
  min-width: 300px;
}

.login-form input {
  width: 100%;
  padding: 15px;
  margin: 10px 0;
  border: 2px solid #ddd;
  border-radius: 8px;
  font-size: 16px;
}

.login-form button {
  width: 100%;
  padding: 15px;
  margin: 10px 0;
  background: #667eea;
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 16px;
  cursor: pointer;
  transition: background 0.3s;
}

.login-form button:hover {
  background: #5a67d8;
}

/* 大厅界面 */
#lobby-screen {
  background: white;
  border-radius: 15px;
  padding: 30px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.2);
}

.user-info {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 30px;
  padding-bottom: 20px;
  border-bottom: 2px solid #eee;
}

.room-actions {
  display: flex;
  gap: 20px;
  margin-bottom: 30px;
  flex-wrap: wrap;
}

.join-room {
  display: flex;
  gap: 10px;
  flex: 1;
}

.join-room input {
  flex: 1;
  padding: 12px;
  border: 2px solid #ddd;
  border-radius: 8px;
}

button {
  padding: 12px 24px;
  background: #667eea;
  color: white;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-size: 14px;
  transition: background 0.3s;
}

button:hover {
  background: #5a67d8;
}

button:disabled {
  background: #ccc;
  cursor: not-allowed;
}

/* 排行榜 */
#leaderboard {
  background: #f8f9fa;
  padding: 20px;
  border-radius: 10px;
}

#leaderboard h3 {
  margin-bottom: 15px;
  color: #333;
}

.leaderboard-item {
  display: flex;
  justify-content: space-between;
  padding: 10px;
  margin: 5px 0;
  background: white;
  border-radius: 5px;
  box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

.rank {
  font-weight: bold;
  color: #667eea;
}

/* 房间界面 */
#room-screen {
  background: white;
  border-radius: 15px;
  padding: 30px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.2);
}

.room-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 30px;
  padding-bottom: 20px;
  border-bottom: 2px solid #eee;
}

#players-list {
  margin-bottom: 30px;
}

.player-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 15px;
  margin: 10px 0;
  background: #f8f9fa;
  border-radius: 8px;
  border-left: 4px solid #667eea;
}

.player-item.host {
  border-left-color: #ffd700;
  background: #fffbf0;
}

.ready-status {
  font-weight: bold;
  color: #28a745;
}

.room-controls {
  display: flex;
  gap: 15px;
  justify-content: center;
}

/* 游戏界面 */
#game-screen {
  background: #2d5a27;
  border-radius: 15px;
  padding: 20px;
  color: white;
  min-height: 80vh;
}

.game-board {
  display: grid;
  grid-template-areas:
    "info info info"
    "others discard others"
    "hand hand hand"
    "controls controls controls";
  grid-template-rows: auto 1fr auto auto;
  gap: 20px;
  height: 100%;
}

#game-info {
  grid-area: info;
  display: flex;
  justify-content: space-between;
  background: rgba(0,0,0,0.3);
  padding: 15px;
  border-radius: 10px;
}

#discard-pile {
  grid-area: discard;
  display: flex;
  justify-content: center;
  align-items: center;
}

#other-players {
  grid-area: others;
  display: flex;
  flex-wrap: wrap;
  gap: 15px;
  justify-content: space-around;
}

.other-player {
  background: rgba(0,0,0,0.3);
  padding: 15px;
  border-radius: 10px;
  text-align: center;
  min-width: 120px;
}

.player-name {
  font-weight: bold;
  margin-bottom: 5px;
}

.card-count {
  color: #ffd700;
}

#player-hand {
  grid-area: hand;
  display: flex;
  gap: 10px;
  justify-content: center;
  flex-wrap: wrap;
  padding: 20px;
  background: rgba(0,0,0,0.2);
  border-radius: 10px;
  max-height: 200px;
  overflow-y: auto;
}

.game-controls {
  grid-area: controls;
  display: flex;
  gap: 15px;
  justify-content: center;
}

/* 卡牌样式 */
.card {
  width: 80px;
  height: 120px;
  border-radius: 10px;
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s;
  position: relative;
}

.card:hover {
  transform: translateY(-5px);
  box-shadow: 0 5px 15px rgba(0,0,0,0.3);
}

.card.playable {
  box-shadow: 0 0 10px #ffd700;
}

.card-content {
  width: 100%;
  height: 100%;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  font-weight: bold;
  color: white;
  text-shadow: 1px 1px 2px rgba(0,0,0,0.5);
  border: 3px solid white;
}

.card-content.red {
  background: linear-gradient(135deg, #ff6b6b, #ee5a52);
}

.card-content.yellow {
  background: linear-gradient(135deg, #feca57, #ff9ff3);
  color: #333;
}

.card-content.green {
  background: linear-gradient(135deg, #48dbfb, #0abde3);
}

.card-content.blue {
  background: linear-gradient(135deg, #3742fa, #2f3542);
}

.card-content.black {
  background: linear-gradient(135deg, #2c2c54, #40407a);
}

/* 响应式设计 */
@media (max-width: 768px) {
  .room-actions {
    flex-direction: column;
  }

  .join-room {
    flex-direction: column;
  }

  .game-board {
    grid-template-areas:
      "info"
      "discard"
      "others"
      "hand"
      "controls";
    grid-template-columns: 1fr;
  }

  #player-hand {
    max-height: 150px;
  }

  .card {
    width: 60px;
    height: 90px;
  }

  .card-content {
    font-size: 18px;
  }
}

/* 动画效果 */
@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.screen {
  animation: slideIn 0.3s ease-out;
}

/* 通知样式 */
.notification {
  position: fixed;
  top: 20px;
  right: 20px;
  background: #28a745;
  color: white;
  padding: 15px 20px;
  border-radius: 8px;
  box-shadow: 0 5px 15px rgba(0,0,0,0.2);
  z-index: 1000;
  animation: slideIn 0.3s ease-out;
}

.notification.error {
  background: #dc3545;
}

.notification.warning {
  background: #ffc107;
  color: #333;
}
